aboutsummaryrefslogtreecommitdiff
path: root/contrib/llvm-project/libcxx/include
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/llvm-project/libcxx/include')
-rw-r--r--contrib/llvm-project/libcxx/include/__algorithm/binary_search.h20
-rw-r--r--contrib/llvm-project/libcxx/include/__algorithm/comp_ref_type.h66
-rw-r--r--contrib/llvm-project/libcxx/include/__algorithm/copy_backward.h16
-rw-r--r--contrib/llvm-project/libcxx/include/__algorithm/copy_if.h23
-rw-r--r--contrib/llvm-project/libcxx/include/__algorithm/copy_move_common.h25
-rw-r--r--contrib/llvm-project/libcxx/include/__algorithm/copy_n.h59
-rw-r--r--contrib/llvm-project/libcxx/include/__algorithm/equal.h29
-rw-r--r--contrib/llvm-project/libcxx/include/__algorithm/equal_range.h11
-rw-r--r--contrib/llvm-project/libcxx/include/__algorithm/fill.h26
-rw-r--r--contrib/llvm-project/libcxx/include/__algorithm/fill_n.h20
-rw-r--r--contrib/llvm-project/libcxx/include/__algorithm/find.h19
-rw-r--r--contrib/llvm-project/libcxx/include/__algorithm/find_end.h92
-rw-r--r--contrib/llvm-project/libcxx/include/__algorithm/find_first_of.h21
-rw-r--r--contrib/llvm-project/libcxx/include/__algorithm/fold.h125
-rw-r--r--contrib/llvm-project/libcxx/include/__algorithm/for_each_n.h5
-rw-r--r--contrib/llvm-project/libcxx/include/__algorithm/generate.h10
-rw-r--r--contrib/llvm-project/libcxx/include/__algorithm/generate_n.h16
-rw-r--r--contrib/llvm-project/libcxx/include/__algorithm/half_positive.h14
-rw-r--r--contrib/llvm-project/libcxx/include/__algorithm/in_found_result.h2
-rw-r--r--contrib/llvm-project/libcxx/include/__algorithm/in_fun_result.h2
-rw-r--r--contrib/llvm-project/libcxx/include/__algorithm/in_in_out_result.h14
-rw-r--r--contrib/llvm-project/libcxx/include/__algorithm/in_in_result.h6
-rw-r--r--contrib/llvm-project/libcxx/include/__algorithm/in_out_out_result.h14
-rw-r--r--contrib/llvm-project/libcxx/include/__algorithm/in_out_result.h8
-rw-r--r--contrib/llvm-project/libcxx/include/__algorithm/includes.h31
-rw-r--r--contrib/llvm-project/libcxx/include/__algorithm/inplace_merge.h304
-rw-r--r--contrib/llvm-project/libcxx/include/__algorithm/is_heap.h20
-rw-r--r--contrib/llvm-project/libcxx/include/__algorithm/is_heap_until.h56
-rw-r--r--contrib/llvm-project/libcxx/include/__algorithm/is_partitioned.h21
-rw-r--r--contrib/llvm-project/libcxx/include/__algorithm/is_permutation.h177
-rw-r--r--contrib/llvm-project/libcxx/include/__algorithm/is_sorted.h20
-rw-r--r--contrib/llvm-project/libcxx/include/__algorithm/is_sorted_until.h33
-rw-r--r--contrib/llvm-project/libcxx/include/__algorithm/iter_swap.h3
-rw-r--r--contrib/llvm-project/libcxx/include/__algorithm/iterator_operations.h67
-rw-r--r--contrib/llvm-project/libcxx/include/__algorithm/lexicographical_compare.h49
-rw-r--r--contrib/llvm-project/libcxx/include/__algorithm/lower_bound.h15
-rw-r--r--contrib/llvm-project/libcxx/include/__algorithm/make_heap.h16
-rw-r--r--contrib/llvm-project/libcxx/include/__algorithm/make_projected.h47
-rw-r--r--contrib/llvm-project/libcxx/include/__algorithm/max.h39
-rw-r--r--contrib/llvm-project/libcxx/include/__algorithm/max_element.h33
-rw-r--r--contrib/llvm-project/libcxx/include/__algorithm/merge.h65
-rw-r--r--contrib/llvm-project/libcxx/include/__algorithm/min.h39
-rw-r--r--contrib/llvm-project/libcxx/include/__algorithm/min_element.h23
-rw-r--r--contrib/llvm-project/libcxx/include/__algorithm/min_max_result.h2
-rw-r--r--contrib/llvm-project/libcxx/include/__algorithm/minmax.h48
-rw-r--r--contrib/llvm-project/libcxx/include/__algorithm/minmax_element.h31
-rw-r--r--contrib/llvm-project/libcxx/include/__algorithm/mismatch.h25
-rw-r--r--contrib/llvm-project/libcxx/include/__algorithm/move.h3
-rw-r--r--contrib/llvm-project/libcxx/include/__algorithm/move_backward.h6
-rw-r--r--contrib/llvm-project/libcxx/include/__algorithm/next_permutation.h61
-rw-r--r--contrib/llvm-project/libcxx/include/__algorithm/nth_element.h386
-rw-r--r--contrib/llvm-project/libcxx/include/__algorithm/partial_sort.h39
-rw-r--r--contrib/llvm-project/libcxx/include/__algorithm/partial_sort_copy.h94
-rw-r--r--contrib/llvm-project/libcxx/include/__algorithm/partition.h84
-rw-r--r--contrib/llvm-project/libcxx/include/__algorithm/partition_copy.h36
-rw-r--r--contrib/llvm-project/libcxx/include/__algorithm/partition_point.h34
-rw-r--r--contrib/llvm-project/libcxx/include/__algorithm/pop_heap.h18
-rw-r--r--contrib/llvm-project/libcxx/include/__algorithm/prev_permutation.h64
-rw-r--r--contrib/llvm-project/libcxx/include/__algorithm/push_heap.h24
-rw-r--r--contrib/llvm-project/libcxx/include/__algorithm/ranges_contains.h61
-rw-r--r--contrib/llvm-project/libcxx/include/__algorithm/ranges_max.h5
-rw-r--r--contrib/llvm-project/libcxx/include/__algorithm/ranges_min.h5
-rw-r--r--contrib/llvm-project/libcxx/include/__algorithm/ranges_minmax.h5
-rw-r--r--contrib/llvm-project/libcxx/include/__algorithm/remove.h26
-rw-r--r--contrib/llvm-project/libcxx/include/__algorithm/remove_copy.h20
-rw-r--r--contrib/llvm-project/libcxx/include/__algorithm/remove_copy_if.h20
-rw-r--r--contrib/llvm-project/libcxx/include/__algorithm/remove_if.h26
-rw-r--r--contrib/llvm-project/libcxx/include/__algorithm/replace.h12
-rw-r--r--contrib/llvm-project/libcxx/include/__algorithm/replace_copy.h23
-rw-r--r--contrib/llvm-project/libcxx/include/__algorithm/replace_copy_if.h23
-rw-r--r--contrib/llvm-project/libcxx/include/__algorithm/replace_if.h12
-rw-r--r--contrib/llvm-project/libcxx/include/__algorithm/reverse.h40
-rw-r--r--contrib/llvm-project/libcxx/include/__algorithm/reverse_copy.h12
-rw-r--r--contrib/llvm-project/libcxx/include/__algorithm/rotate.h264
-rw-r--r--contrib/llvm-project/libcxx/include/__algorithm/rotate_copy.h8
-rw-r--r--contrib/llvm-project/libcxx/include/__algorithm/sample.h83
-rw-r--r--contrib/llvm-project/libcxx/include/__algorithm/search.h123
-rw-r--r--contrib/llvm-project/libcxx/include/__algorithm/search_n.h96
-rw-r--r--contrib/llvm-project/libcxx/include/__algorithm/set_difference.h2
-rw-r--r--contrib/llvm-project/libcxx/include/__algorithm/shift_left.h43
-rw-r--r--contrib/llvm-project/libcxx/include/__algorithm/shift_right.h123
-rw-r--r--contrib/llvm-project/libcxx/include/__algorithm/shuffle.h127
-rw-r--r--contrib/llvm-project/libcxx/include/__algorithm/sift_down.h141
-rw-r--r--contrib/llvm-project/libcxx/include/__algorithm/sort.h245
-rw-r--r--contrib/llvm-project/libcxx/include/__algorithm/sort_heap.h16
-rw-r--r--contrib/llvm-project/libcxx/include/__algorithm/stable_partition.h487
-rw-r--r--contrib/llvm-project/libcxx/include/__algorithm/stable_sort.h332
-rw-r--r--contrib/llvm-project/libcxx/include/__algorithm/swap_ranges.h9
-rw-r--r--contrib/llvm-project/libcxx/include/__algorithm/transform.h29
-rw-r--r--contrib/llvm-project/libcxx/include/__algorithm/uniform_random_bit_generator_adaptor.h14
-rw-r--r--contrib/llvm-project/libcxx/include/__algorithm/unwrap_iter.h10
-rw-r--r--contrib/llvm-project/libcxx/include/__atomic/atomic.h812
-rw-r--r--contrib/llvm-project/libcxx/include/__atomic/atomic_base.h321
-rw-r--r--contrib/llvm-project/libcxx/include/__atomic/atomic_flag.h246
-rw-r--r--contrib/llvm-project/libcxx/include/__atomic/atomic_lock_free.h52
-rw-r--r--contrib/llvm-project/libcxx/include/__atomic/atomic_sync.h90
-rw-r--r--contrib/llvm-project/libcxx/include/__atomic/check_memory_order.h22
-rw-r--r--contrib/llvm-project/libcxx/include/__atomic/contention_t.h4
-rw-r--r--contrib/llvm-project/libcxx/include/__atomic/cxx_atomic_impl.h560
-rw-r--r--contrib/llvm-project/libcxx/include/__atomic/fence.h16
-rw-r--r--contrib/llvm-project/libcxx/include/__atomic/kill_dependency.h6
-rw-r--r--contrib/llvm-project/libcxx/include/__atomic/memory_order.h11
-rw-r--r--contrib/llvm-project/libcxx/include/__availability82
-rw-r--r--contrib/llvm-project/libcxx/include/__bit/bit_cast.h3
-rw-r--r--contrib/llvm-project/libcxx/include/__bit/bit_ceil.h2
-rw-r--r--contrib/llvm-project/libcxx/include/__bit/byteswap.h11
-rw-r--r--contrib/llvm-project/libcxx/include/__bit/countl.h84
-rw-r--r--contrib/llvm-project/libcxx/include/__bit/countr.h17
-rw-r--r--contrib/llvm-project/libcxx/include/__bit/endian.h2
-rw-r--r--contrib/llvm-project/libcxx/include/__bit/popcount.h15
-rw-r--r--contrib/llvm-project/libcxx/include/__chrono/calendar.h12
-rw-r--r--contrib/llvm-project/libcxx/include/__chrono/convert_to_timespec.h15
-rw-r--r--contrib/llvm-project/libcxx/include/__chrono/day.h91
-rw-r--r--contrib/llvm-project/libcxx/include/__chrono/duration.h693
-rw-r--r--contrib/llvm-project/libcxx/include/__chrono/file_clock.h24
-rw-r--r--contrib/llvm-project/libcxx/include/__chrono/formatter.h63
-rw-r--r--contrib/llvm-project/libcxx/include/__chrono/hh_mm_ss.h117
-rw-r--r--contrib/llvm-project/libcxx/include/__chrono/high_resolution_clock.h3
-rw-r--r--contrib/llvm-project/libcxx/include/__chrono/literals.h24
-rw-r--r--contrib/llvm-project/libcxx/include/__chrono/month.h94
-rw-r--r--contrib/llvm-project/libcxx/include/__chrono/month_weekday.h104
-rw-r--r--contrib/llvm-project/libcxx/include/__chrono/monthday.h134
-rw-r--r--contrib/llvm-project/libcxx/include/__chrono/steady_clock.h18
-rw-r--r--contrib/llvm-project/libcxx/include/__chrono/system_clock.h24
-rw-r--r--contrib/llvm-project/libcxx/include/__chrono/time_point.h186
-rw-r--r--contrib/llvm-project/libcxx/include/__chrono/weekday.h201
-rw-r--r--contrib/llvm-project/libcxx/include/__chrono/year.h104
-rw-r--r--contrib/llvm-project/libcxx/include/__chrono/year_month.h102
-rw-r--r--contrib/llvm-project/libcxx/include/__chrono/year_month_day.h460
-rw-r--r--contrib/llvm-project/libcxx/include/__chrono/year_month_weekday.h369
-rw-r--r--contrib/llvm-project/libcxx/include/__compare/common_comparison_category.h27
-rw-r--r--contrib/llvm-project/libcxx/include/__compare/compare_partial_order_fallback.h68
-rw-r--r--contrib/llvm-project/libcxx/include/__compare/compare_strong_order_fallback.h62
-rw-r--r--contrib/llvm-project/libcxx/include/__compare/compare_three_way.h19
-rw-r--r--contrib/llvm-project/libcxx/include/__compare/compare_three_way_result.h23
-rw-r--r--contrib/llvm-project/libcxx/include/__compare/compare_weak_order_fallback.h62
-rw-r--r--contrib/llvm-project/libcxx/include/__compare/ordering.h164
-rw-r--r--contrib/llvm-project/libcxx/include/__compare/partial_order.h63
-rw-r--r--contrib/llvm-project/libcxx/include/__compare/strong_order.h173
-rw-r--r--contrib/llvm-project/libcxx/include/__compare/three_way_comparable.h36
-rw-r--r--contrib/llvm-project/libcxx/include/__compare/weak_order.h115
-rw-r--r--contrib/llvm-project/libcxx/include/__config4
-rw-r--r--contrib/llvm-project/libcxx/include/__coroutine/coroutine_handle.h257
-rw-r--r--contrib/llvm-project/libcxx/include/__coroutine/coroutine_traits.h9
-rw-r--r--contrib/llvm-project/libcxx/include/__coroutine/noop_coroutine_handle.h103
-rw-r--r--contrib/llvm-project/libcxx/include/__coroutine/trivial_awaitables.h18
-rw-r--r--contrib/llvm-project/libcxx/include/__debug_utils/randomize_range.h3
-rw-r--r--contrib/llvm-project/libcxx/include/__expected/expected.h205
-rw-r--r--contrib/llvm-project/libcxx/include/__filesystem/copy_options.h50
-rw-r--r--contrib/llvm-project/libcxx/include/__filesystem/directory_entry.h251
-rw-r--r--contrib/llvm-project/libcxx/include/__filesystem/directory_iterator.h73
-rw-r--r--contrib/llvm-project/libcxx/include/__filesystem/directory_options.h44
-rw-r--r--contrib/llvm-project/libcxx/include/__filesystem/file_status.h28
-rw-r--r--contrib/llvm-project/libcxx/include/__filesystem/file_type.h14
-rw-r--r--contrib/llvm-project/libcxx/include/__filesystem/operations.h224
-rw-r--r--contrib/llvm-project/libcxx/include/__filesystem/path.h652
-rw-r--r--contrib/llvm-project/libcxx/include/__filesystem/path_iterator.h50
-rw-r--r--contrib/llvm-project/libcxx/include/__filesystem/perm_options.h39
-rw-r--r--contrib/llvm-project/libcxx/include/__filesystem/perms.h56
-rw-r--r--contrib/llvm-project/libcxx/include/__filesystem/recursive_directory_iterator.h85
-rw-r--r--contrib/llvm-project/libcxx/include/__filesystem/u8path.h48
-rw-r--r--contrib/llvm-project/libcxx/include/__format/buffer.h52
-rw-r--r--contrib/llvm-project/libcxx/include/__format/concepts.h2
-rw-r--r--contrib/llvm-project/libcxx/include/__format/format_arg.h32
-rw-r--r--contrib/llvm-project/libcxx/include/__format/format_arg_store.h10
-rw-r--r--contrib/llvm-project/libcxx/include/__format/format_args.h5
-rw-r--r--contrib/llvm-project/libcxx/include/__format/format_context.h72
-rw-r--r--contrib/llvm-project/libcxx/include/__format/format_error.h17
-rw-r--r--contrib/llvm-project/libcxx/include/__format/format_functions.h184
-rw-r--r--contrib/llvm-project/libcxx/include/__format/format_parse_context.h30
-rw-r--r--contrib/llvm-project/libcxx/include/__format/format_string.h20
-rw-r--r--contrib/llvm-project/libcxx/include/__format/formatter.h4
-rw-r--r--contrib/llvm-project/libcxx/include/__format/formatter_floating_point.h92
-rw-r--r--contrib/llvm-project/libcxx/include/__format/formatter_integer.h37
-rw-r--r--contrib/llvm-project/libcxx/include/__format/formatter_integral.h77
-rw-r--r--contrib/llvm-project/libcxx/include/__format/formatter_output.h58
-rw-r--r--contrib/llvm-project/libcxx/include/__format/formatter_pointer.h9
-rw-r--r--contrib/llvm-project/libcxx/include/__format/formatter_string.h18
-rw-r--r--contrib/llvm-project/libcxx/include/__format/parser_std_format_spec.h79
-rw-r--r--contrib/llvm-project/libcxx/include/__format/unicode.h10
-rw-r--r--contrib/llvm-project/libcxx/include/__format/write_escaped.h19
-rw-r--r--contrib/llvm-project/libcxx/include/__functional/binary_function.h16
-rw-r--r--contrib/llvm-project/libcxx/include/__functional/binary_negate.h25
-rw-r--r--contrib/llvm-project/libcxx/include/__functional/bind.h385
-rw-r--r--contrib/llvm-project/libcxx/include/__functional/bind_back.h34
-rw-r--r--contrib/llvm-project/libcxx/include/__functional/bind_front.h21
-rw-r--r--contrib/llvm-project/libcxx/include/__functional/binder1st.h35
-rw-r--r--contrib/llvm-project/libcxx/include/__functional/binder2nd.h35
-rw-r--r--contrib/llvm-project/libcxx/include/__functional/boyer_moore_searcher.h128
-rw-r--r--contrib/llvm-project/libcxx/include/__functional/compose.h25
-rw-r--r--contrib/llvm-project/libcxx/include/__functional/default_searcher.h31
-rw-r--r--contrib/llvm-project/libcxx/include/__functional/function.h1645
-rw-r--r--contrib/llvm-project/libcxx/include/__functional/hash.h682
-rw-r--r--contrib/llvm-project/libcxx/include/__functional/identity.h20
-rw-r--r--contrib/llvm-project/libcxx/include/__functional/invoke.h30
-rw-r--r--contrib/llvm-project/libcxx/include/__functional/is_transparent.h3
-rw-r--r--contrib/llvm-project/libcxx/include/__functional/mem_fn.h36
-rw-r--r--contrib/llvm-project/libcxx/include/__functional/mem_fun_ref.h183
-rw-r--r--contrib/llvm-project/libcxx/include/__functional/not_fn.h25
-rw-r--r--contrib/llvm-project/libcxx/include/__functional/operations.h540
-rw-r--r--contrib/llvm-project/libcxx/include/__functional/perfect_forward.h48
-rw-r--r--contrib/llvm-project/libcxx/include/__functional/pointer_to_binary_function.h20
-rw-r--r--contrib/llvm-project/libcxx/include/__functional/pointer_to_unary_function.h20
-rw-r--r--contrib/llvm-project/libcxx/include/__functional/ranges_operations.h24
-rw-r--r--contrib/llvm-project/libcxx/include/__functional/reference_wrapper.h97
-rw-r--r--contrib/llvm-project/libcxx/include/__functional/unary_function.h12
-rw-r--r--contrib/llvm-project/libcxx/include/__functional/unary_negate.h25
-rw-r--r--contrib/llvm-project/libcxx/include/__functional/weak_result_type.h225
-rw-r--r--contrib/llvm-project/libcxx/include/__fwd/get.h48
-rw-r--r--contrib/llvm-project/libcxx/include/__fwd/span.h3
-rw-r--r--contrib/llvm-project/libcxx/include/__fwd/string_view.h8
-rw-r--r--contrib/llvm-project/libcxx/include/__fwd/subrange.h2
-rw-r--r--contrib/llvm-project/libcxx/include/__hash_table3216
-rw-r--r--contrib/llvm-project/libcxx/include/__ios/fpos.h9
-rw-r--r--contrib/llvm-project/libcxx/include/__iterator/access.h67
-rw-r--r--contrib/llvm-project/libcxx/include/__iterator/advance.h57
-rw-r--r--contrib/llvm-project/libcxx/include/__iterator/back_insert_iterator.h53
-rw-r--r--contrib/llvm-project/libcxx/include/__iterator/common_iterator.h211
-rw-r--r--contrib/llvm-project/libcxx/include/__iterator/concepts.h338
-rw-r--r--contrib/llvm-project/libcxx/include/__iterator/counted_iterator.h200
-rw-r--r--contrib/llvm-project/libcxx/include/__iterator/data.h32
-rw-r--r--contrib/llvm-project/libcxx/include/__iterator/default_sentinel.h2
-rw-r--r--contrib/llvm-project/libcxx/include/__iterator/distance.h49
-rw-r--r--contrib/llvm-project/libcxx/include/__iterator/empty.h19
-rw-r--r--contrib/llvm-project/libcxx/include/__iterator/erase_if_container.h4
-rw-r--r--contrib/llvm-project/libcxx/include/__iterator/front_insert_iterator.h51
-rw-r--r--contrib/llvm-project/libcxx/include/__iterator/incrementable_traits.h33
-rw-r--r--contrib/llvm-project/libcxx/include/__iterator/indirectly_comparable.h3
-rw-r--r--contrib/llvm-project/libcxx/include/__iterator/insert_iterator.h57
-rw-r--r--contrib/llvm-project/libcxx/include/__iterator/istream_iterator.h95
-rw-r--r--contrib/llvm-project/libcxx/include/__iterator/istreambuf_iterator.h131
-rw-r--r--contrib/llvm-project/libcxx/include/__iterator/iter_move.h68
-rw-r--r--contrib/llvm-project/libcxx/include/__iterator/iter_swap.h100
-rw-r--r--contrib/llvm-project/libcxx/include/__iterator/iterator.h16
-rw-r--r--contrib/llvm-project/libcxx/include/__iterator/iterator_traits.h397
-rw-r--r--contrib/llvm-project/libcxx/include/__iterator/mergeable.h15
-rw-r--r--contrib/llvm-project/libcxx/include/__iterator/move_iterator.h419
-rw-r--r--contrib/llvm-project/libcxx/include/__iterator/move_sentinel.h21
-rw-r--r--contrib/llvm-project/libcxx/include/__iterator/next.h13
-rw-r--r--contrib/llvm-project/libcxx/include/__iterator/ostream_iterator.h55
-rw-r--r--contrib/llvm-project/libcxx/include/__iterator/ostreambuf_iterator.h61
-rw-r--r--contrib/llvm-project/libcxx/include/__iterator/permutable.h3
-rw-r--r--contrib/llvm-project/libcxx/include/__iterator/prev.h13
-rw-r--r--contrib/llvm-project/libcxx/include/__iterator/readable_traits.h46
-rw-r--r--contrib/llvm-project/libcxx/include/__iterator/reverse_access.h60
-rw-r--r--contrib/llvm-project/libcxx/include/__iterator/reverse_iterator.h366
-rw-r--r--contrib/llvm-project/libcxx/include/__iterator/size.h32
-rw-r--r--contrib/llvm-project/libcxx/include/__iterator/sortable.h4
-rw-r--r--contrib/llvm-project/libcxx/include/__iterator/unreachable_sentinel.h5
-rw-r--r--contrib/llvm-project/libcxx/include/__iterator/wrap_iter.h258
-rw-r--r--contrib/llvm-project/libcxx/include/__locale2434
-rw-r--r--contrib/llvm-project/libcxx/include/__locale_dir/locale_base_api/bsd_locale_defaults.h28
-rw-r--r--contrib/llvm-project/libcxx/include/__locale_dir/locale_base_api/bsd_locale_fallbacks.h144
-rw-r--r--contrib/llvm-project/libcxx/include/__locale_dir/locale_base_api/locale_guard.h67
-rw-r--r--contrib/llvm-project/libcxx/include/__mbstate_t.h16
-rw-r--r--contrib/llvm-project/libcxx/include/__memory/addressof.h35
-rw-r--r--contrib/llvm-project/libcxx/include/__memory/aligned_alloc.h42
-rw-r--r--contrib/llvm-project/libcxx/include/__memory/allocate_at_least.h10
-rw-r--r--contrib/llvm-project/libcxx/include/__memory/allocation_guard.h98
-rw-r--r--contrib/llvm-project/libcxx/include/__memory/allocator.h331
-rw-r--r--contrib/llvm-project/libcxx/include/__memory/allocator_arg_t.h45
-rw-r--r--contrib/llvm-project/libcxx/include/__memory/allocator_destructor.h24
-rw-r--r--contrib/llvm-project/libcxx/include/__memory/allocator_traits.h379
-rw-r--r--contrib/llvm-project/libcxx/include/__memory/assume_aligned.h3
-rw-r--r--contrib/llvm-project/libcxx/include/__memory/auto_ptr.h94
-rw-r--r--contrib/llvm-project/libcxx/include/__memory/builtin_new_allocator.h23
-rw-r--r--contrib/llvm-project/libcxx/include/__memory/compressed_pair.h81
-rw-r--r--contrib/llvm-project/libcxx/include/__memory/concepts.h15
-rw-r--r--contrib/llvm-project/libcxx/include/__memory/construct_at.h65
-rw-r--r--contrib/llvm-project/libcxx/include/__memory/destruct_n.h61
-rw-r--r--contrib/llvm-project/libcxx/include/__memory/pointer_traits.h174
-rw-r--r--contrib/llvm-project/libcxx/include/__memory/ranges_construct_at.h28
-rw-r--r--contrib/llvm-project/libcxx/include/__memory/ranges_uninitialized_algorithms.h89
-rw-r--r--contrib/llvm-project/libcxx/include/__memory/raw_storage_iterator.h66
-rw-r--r--contrib/llvm-project/libcxx/include/__memory/shared_ptr.h2495
-rw-r--r--contrib/llvm-project/libcxx/include/__memory/temp_value.h32
-rw-r--r--contrib/llvm-project/libcxx/include/__memory/temporary_buffer.h78
-rw-r--r--contrib/llvm-project/libcxx/include/__memory/uninitialized_algorithms.h461
-rw-r--r--contrib/llvm-project/libcxx/include/__memory/unique_ptr.h373
-rw-r--r--contrib/llvm-project/libcxx/include/__memory/uses_allocator.h27
-rw-r--r--contrib/llvm-project/libcxx/include/__node_handle224
-rw-r--r--contrib/llvm-project/libcxx/include/__numeric/accumulate.h28
-rw-r--r--contrib/llvm-project/libcxx/include/__numeric/adjacent_difference.h57
-rw-r--r--contrib/llvm-project/libcxx/include/__numeric/exclusive_scan.h2
-rw-r--r--contrib/llvm-project/libcxx/include/__numeric/gcd_lcm.h82
-rw-r--r--contrib/llvm-project/libcxx/include/__numeric/inclusive_scan.h9
-rw-r--r--contrib/llvm-project/libcxx/include/__numeric/inner_product.h34
-rw-r--r--contrib/llvm-project/libcxx/include/__numeric/iota.h10
-rw-r--r--contrib/llvm-project/libcxx/include/__numeric/midpoint.h61
-rw-r--r--contrib/llvm-project/libcxx/include/__numeric/partial_sum.h53
-rw-r--r--contrib/llvm-project/libcxx/include/__numeric/reduce.h8
-rw-r--r--contrib/llvm-project/libcxx/include/__numeric/transform_exclusive_scan.h33
-rw-r--r--contrib/llvm-project/libcxx/include/__numeric/transform_inclusive_scan.h42
-rw-r--r--contrib/llvm-project/libcxx/include/__numeric/transform_reduce.h24
-rw-r--r--contrib/llvm-project/libcxx/include/__random/bernoulli_distribution.h160
-rw-r--r--contrib/llvm-project/libcxx/include/__random/binomial_distribution.h291
-rw-r--r--contrib/llvm-project/libcxx/include/__random/cauchy_distribution.h194
-rw-r--r--contrib/llvm-project/libcxx/include/__random/chi_squared_distribution.h161
-rw-r--r--contrib/llvm-project/libcxx/include/__random/clamp_to_integral.h22
-rw-r--r--contrib/llvm-project/libcxx/include/__random/discard_block_engine.h256
-rw-r--r--contrib/llvm-project/libcxx/include/__random/discrete_distribution.h340
-rw-r--r--contrib/llvm-project/libcxx/include/__random/exponential_distribution.h171
-rw-r--r--contrib/llvm-project/libcxx/include/__random/extreme_value_distribution.h196
-rw-r--r--contrib/llvm-project/libcxx/include/__random/fisher_f_distribution.h194
-rw-r--r--contrib/llvm-project/libcxx/include/__random/gamma_distribution.h280
-rw-r--r--contrib/llvm-project/libcxx/include/__random/generate_canonical.h28
-rw-r--r--contrib/llvm-project/libcxx/include/__random/geometric_distribution.h157
-rw-r--r--contrib/llvm-project/libcxx/include/__random/independent_bits_engine.h331
-rw-r--r--contrib/llvm-project/libcxx/include/__random/is_seed_sequence.h8
-rw-r--r--contrib/llvm-project/libcxx/include/__random/is_valid.h53
-rw-r--r--contrib/llvm-project/libcxx/include/__random/linear_congruential_engine.h491
-rw-r--r--contrib/llvm-project/libcxx/include/__random/log2.h39
-rw-r--r--contrib/llvm-project/libcxx/include/__random/lognormal_distribution.h189
-rw-r--r--contrib/llvm-project/libcxx/include/__random/mersenne_twister_engine.h1224
-rw-r--r--contrib/llvm-project/libcxx/include/__random/negative_binomial_distribution.h232
-rw-r--r--contrib/llvm-project/libcxx/include/__random/normal_distribution.h278
-rw-r--r--contrib/llvm-project/libcxx/include/__random/piecewise_constant_distribution.h508
-rw-r--r--contrib/llvm-project/libcxx/include/__random/piecewise_linear_distribution.h537
-rw-r--r--contrib/llvm-project/libcxx/include/__random/poisson_distribution.h392
-rw-r--r--contrib/llvm-project/libcxx/include/__random/random_device.h87
-rw-r--r--contrib/llvm-project/libcxx/include/__random/ranlux.h2
-rw-r--r--contrib/llvm-project/libcxx/include/__random/seed_seq.h231
-rw-r--r--contrib/llvm-project/libcxx/include/__random/shuffle_order_engine.h355
-rw-r--r--contrib/llvm-project/libcxx/include/__random/student_t_distribution.h169
-rw-r--r--contrib/llvm-project/libcxx/include/__random/subtract_with_carry_engine.h468
-rw-r--r--contrib/llvm-project/libcxx/include/__random/uniform_int_distribution.h403
-rw-r--r--contrib/llvm-project/libcxx/include/__random/uniform_random_bit_generator.h14
-rw-r--r--contrib/llvm-project/libcxx/include/__random/uniform_real_distribution.h194
-rw-r--r--contrib/llvm-project/libcxx/include/__random/weibull_distribution.h185
-rw-r--r--contrib/llvm-project/libcxx/include/__ranges/access.h237
-rw-r--r--contrib/llvm-project/libcxx/include/__ranges/all.h55
-rw-r--r--contrib/llvm-project/libcxx/include/__ranges/common_view.h83
-rw-r--r--contrib/llvm-project/libcxx/include/__ranges/concepts.h126
-rw-r--r--contrib/llvm-project/libcxx/include/__ranges/counted.h62
-rw-r--r--contrib/llvm-project/libcxx/include/__ranges/data.h91
-rw-r--r--contrib/llvm-project/libcxx/include/__ranges/drop_view.h303
-rw-r--r--contrib/llvm-project/libcxx/include/__ranges/empty.h71
-rw-r--r--contrib/llvm-project/libcxx/include/__ranges/empty_view.h40
-rw-r--r--contrib/llvm-project/libcxx/include/__ranges/enable_view.h11
-rw-r--r--contrib/llvm-project/libcxx/include/__ranges/filter_view.h381
-rw-r--r--contrib/llvm-project/libcxx/include/__ranges/iota_view.h569
-rw-r--r--contrib/llvm-project/libcxx/include/__ranges/istream_view.h3
-rw-r--r--contrib/llvm-project/libcxx/include/__ranges/join_view.h647
-rw-r--r--contrib/llvm-project/libcxx/include/__ranges/lazy_split_view.h245
-rw-r--r--contrib/llvm-project/libcxx/include/__ranges/non_propagating_cache.h129
-rw-r--r--contrib/llvm-project/libcxx/include/__ranges/owning_view.h106
-rw-r--r--contrib/llvm-project/libcxx/include/__ranges/range_adaptor.h32
-rw-r--r--contrib/llvm-project/libcxx/include/__ranges/rbegin.h67
-rw-r--r--contrib/llvm-project/libcxx/include/__ranges/ref_view.h80
-rw-r--r--contrib/llvm-project/libcxx/include/__ranges/rend.h71
-rw-r--r--contrib/llvm-project/libcxx/include/__ranges/reverse_view.h297
-rw-r--r--contrib/llvm-project/libcxx/include/__ranges/single_view.h16
-rw-r--r--contrib/llvm-project/libcxx/include/__ranges/size.h52
-rw-r--r--contrib/llvm-project/libcxx/include/__ranges/subrange.h356
-rw-r--r--contrib/llvm-project/libcxx/include/__ranges/take_view.h194
-rw-r--r--contrib/llvm-project/libcxx/include/__ranges/transform_view.h300
-rw-r--r--contrib/llvm-project/libcxx/include/__ranges/view_interface.h94
-rw-r--r--contrib/llvm-project/libcxx/include/__ranges/views.h2
-rw-r--r--contrib/llvm-project/libcxx/include/__ranges/zip_view.h235
-rw-r--r--contrib/llvm-project/libcxx/include/__split_buffer604
-rw-r--r--contrib/llvm-project/libcxx/include/__string/char_traits.h1093
-rw-r--r--contrib/llvm-project/libcxx/include/__system_error/errc.h172
-rw-r--r--contrib/llvm-project/libcxx/include/__thread/formatter.h62
-rw-r--r--contrib/llvm-project/libcxx/include/__thread/poll_with_backoff.h37
-rw-r--r--contrib/llvm-project/libcxx/include/__thread/this_thread.h63
-rw-r--r--contrib/llvm-project/libcxx/include/__thread/thread.h324
-rw-r--r--contrib/llvm-project/libcxx/include/__thread/timed_backoff_policy.h28
-rw-r--r--contrib/llvm-project/libcxx/include/__threading_support410
-rw-r--r--contrib/llvm-project/libcxx/include/__tree3613
-rw-r--r--contrib/llvm-project/libcxx/include/__tuple/make_tuple_types.h24
-rw-r--r--contrib/llvm-project/libcxx/include/__tuple/sfinae_helpers.h136
-rw-r--r--contrib/llvm-project/libcxx/include/__tuple/tuple_element.h64
-rw-r--r--contrib/llvm-project/libcxx/include/__tuple/tuple_indices.h10
-rw-r--r--contrib/llvm-project/libcxx/include/__tuple/tuple_like_ext.h24
-rw-r--r--contrib/llvm-project/libcxx/include/__tuple/tuple_size.h47
-rw-r--r--contrib/llvm-project/libcxx/include/__tuple/tuple_types.h3
-rw-r--r--contrib/llvm-project/libcxx/include/__type_traits/datasizeof.h11
-rw-r--r--contrib/llvm-project/libcxx/include/__utility/as_const.h4
-rw-r--r--contrib/llvm-project/libcxx/include/__utility/cmp.h73
-rw-r--r--contrib/llvm-project/libcxx/include/__utility/convert_to_integral.h50
-rw-r--r--contrib/llvm-project/libcxx/include/__utility/exchange.h14
-rw-r--r--contrib/llvm-project/libcxx/include/__utility/in_place.h12
-rw-r--r--contrib/llvm-project/libcxx/include/__utility/integer_sequence.h104
-rw-r--r--contrib/llvm-project/libcxx/include/__utility/is_pointer_in_range.h2
-rw-r--r--contrib/llvm-project/libcxx/include/__utility/pair.h1162
-rw-r--r--contrib/llvm-project/libcxx/include/__utility/piecewise_construct.h4
-rw-r--r--contrib/llvm-project/libcxx/include/__utility/priority_tag.h6
-rw-r--r--contrib/llvm-project/libcxx/include/__utility/rel_ops.h41
-rw-r--r--contrib/llvm-project/libcxx/include/__utility/to_underlying.h6
-rw-r--r--contrib/llvm-project/libcxx/include/__utility/unreachable.h4
-rw-r--r--contrib/llvm-project/libcxx/include/__variant/monostate.h2
-rw-r--r--contrib/llvm-project/libcxx/include/__verbose_abort4
-rw-r--r--contrib/llvm-project/libcxx/include/algorithm30
-rw-r--r--contrib/llvm-project/libcxx/include/any788
-rw-r--r--contrib/llvm-project/libcxx/include/array535
-rw-r--r--contrib/llvm-project/libcxx/include/barrier356
-rw-r--r--contrib/llvm-project/libcxx/include/bitset1290
-rw-r--r--contrib/llvm-project/libcxx/include/cctype29
-rw-r--r--contrib/llvm-project/libcxx/include/cmath173
-rw-r--r--contrib/llvm-project/libcxx/include/codecvt776
-rw-r--r--contrib/llvm-project/libcxx/include/complex1921
-rw-r--r--contrib/llvm-project/libcxx/include/condition_variable223
-rw-r--r--contrib/llvm-project/libcxx/include/cstddef52
-rw-r--r--contrib/llvm-project/libcxx/include/ctype.h28
-rw-r--r--contrib/llvm-project/libcxx/include/cuchar2
-rw-r--r--contrib/llvm-project/libcxx/include/deque3722
-rw-r--r--contrib/llvm-project/libcxx/include/errno.h522
-rw-r--r--contrib/llvm-project/libcxx/include/expected1
-rw-r--r--contrib/llvm-project/libcxx/include/experimental/__config22
-rw-r--r--contrib/llvm-project/libcxx/include/experimental/__memory90
-rw-r--r--contrib/llvm-project/libcxx/include/experimental/__simd/abi_tag.h55
-rw-r--r--contrib/llvm-project/libcxx/include/experimental/__simd/aligned_tag.h13
-rw-r--r--contrib/llvm-project/libcxx/include/experimental/__simd/declaration.h52
-rw-r--r--contrib/llvm-project/libcxx/include/experimental/__simd/internal_declaration.h41
-rw-r--r--contrib/llvm-project/libcxx/include/experimental/__simd/scalar.h2
-rw-r--r--contrib/llvm-project/libcxx/include/experimental/__simd/simd.h2
-rw-r--r--contrib/llvm-project/libcxx/include/experimental/__simd/simd_mask.h2
-rw-r--r--contrib/llvm-project/libcxx/include/experimental/__simd/traits.h15
-rw-r--r--contrib/llvm-project/libcxx/include/experimental/__simd/vec_ext.h6
-rw-r--r--contrib/llvm-project/libcxx/include/experimental/iterator69
-rw-r--r--contrib/llvm-project/libcxx/include/experimental/propagate_const305
-rw-r--r--contrib/llvm-project/libcxx/include/experimental/simd1
-rw-r--r--contrib/llvm-project/libcxx/include/experimental/type_traits69
-rw-r--r--contrib/llvm-project/libcxx/include/experimental/utility2
-rw-r--r--contrib/llvm-project/libcxx/include/ext/__hash130
-rw-r--r--contrib/llvm-project/libcxx/include/ext/hash_map1132
-rw-r--r--contrib/llvm-project/libcxx/include/ext/hash_set634
-rw-r--r--contrib/llvm-project/libcxx/include/fenv.h70
-rw-r--r--contrib/llvm-project/libcxx/include/float.h12
-rw-r--r--contrib/llvm-project/libcxx/include/forward_list2031
-rw-r--r--contrib/llvm-project/libcxx/include/fstream2095
-rw-r--r--contrib/llvm-project/libcxx/include/future2551
-rw-r--r--contrib/llvm-project/libcxx/include/initializer_list71
-rw-r--r--contrib/llvm-project/libcxx/include/inttypes.h10
-rw-r--r--contrib/llvm-project/libcxx/include/iomanip754
-rw-r--r--contrib/llvm-project/libcxx/include/ios953
-rw-r--r--contrib/llvm-project/libcxx/include/iosfwd65
-rw-r--r--contrib/llvm-project/libcxx/include/istream2051
-rw-r--r--contrib/llvm-project/libcxx/include/latch98
-rw-r--r--contrib/llvm-project/libcxx/include/limits1078
-rw-r--r--contrib/llvm-project/libcxx/include/list2390
-rw-r--r--contrib/llvm-project/libcxx/include/locale6071
-rw-r--r--contrib/llvm-project/libcxx/include/locale.h2
-rw-r--r--contrib/llvm-project/libcxx/include/map2618
-rw-r--r--contrib/llvm-project/libcxx/include/math.h81
-rw-r--r--contrib/llvm-project/libcxx/include/module.modulemap.in4
-rw-r--r--contrib/llvm-project/libcxx/include/mutex467
-rw-r--r--contrib/llvm-project/libcxx/include/new220
-rw-r--r--contrib/llvm-project/libcxx/include/numbers93
-rw-r--r--contrib/llvm-project/libcxx/include/optional1759
-rw-r--r--contrib/llvm-project/libcxx/include/ostream1349
-rw-r--r--contrib/llvm-project/libcxx/include/print14
-rw-r--r--contrib/llvm-project/libcxx/include/queue1008
-rw-r--r--contrib/llvm-project/libcxx/include/ranges2
-rw-r--r--contrib/llvm-project/libcxx/include/ratio396
-rw-r--r--contrib/llvm-project/libcxx/include/regex8352
-rw-r--r--contrib/llvm-project/libcxx/include/scoped_allocator821
-rw-r--r--contrib/llvm-project/libcxx/include/semaphore193
-rw-r--r--contrib/llvm-project/libcxx/include/set1577
-rw-r--r--contrib/llvm-project/libcxx/include/span701
-rw-r--r--contrib/llvm-project/libcxx/include/sstream1274
-rw-r--r--contrib/llvm-project/libcxx/include/stack349
-rw-r--r--contrib/llvm-project/libcxx/include/stdatomic.h18
-rw-r--r--contrib/llvm-project/libcxx/include/stdbool.h10
-rw-r--r--contrib/llvm-project/libcxx/include/stddef.h28
-rw-r--r--contrib/llvm-project/libcxx/include/stdexcept232
-rw-r--r--contrib/llvm-project/libcxx/include/stdint.h6
-rw-r--r--contrib/llvm-project/libcxx/include/stdio.h36
-rw-r--r--contrib/llvm-project/libcxx/include/stdlib.h86
-rw-r--r--contrib/llvm-project/libcxx/include/streambuf530
-rw-r--r--contrib/llvm-project/libcxx/include/string4634
-rw-r--r--contrib/llvm-project/libcxx/include/string.h2
-rw-r--r--contrib/llvm-project/libcxx/include/string_view1135
-rw-r--r--contrib/llvm-project/libcxx/include/strstream334
-rw-r--r--contrib/llvm-project/libcxx/include/thread2
-rw-r--r--contrib/llvm-project/libcxx/include/tuple2126
-rw-r--r--contrib/llvm-project/libcxx/include/typeindex65
-rw-r--r--contrib/llvm-project/libcxx/include/typeinfo242
-rw-r--r--contrib/llvm-project/libcxx/include/uchar.h12
-rw-r--r--contrib/llvm-project/libcxx/include/unordered_map3111
-rw-r--r--contrib/llvm-project/libcxx/include/unordered_set1953
-rw-r--r--contrib/llvm-project/libcxx/include/valarray4682
-rw-r--r--contrib/llvm-project/libcxx/include/variant1235
-rw-r--r--contrib/llvm-project/libcxx/include/vector3836
-rw-r--r--contrib/llvm-project/libcxx/include/version6
-rw-r--r--contrib/llvm-project/libcxx/include/wchar.h157
-rw-r--r--contrib/llvm-project/libcxx/include/wctype.h43
487 files changed, 59974 insertions, 74864 deletions
diff --git a/contrib/llvm-project/libcxx/include/__algorithm/binary_search.h b/contrib/llvm-project/libcxx/include/__algorithm/binary_search.h
index 5a1d49f5f43e..7a77d7b5447b 100644
--- a/contrib/llvm-project/libcxx/include/__algorithm/binary_search.h
+++ b/contrib/llvm-project/libcxx/include/__algorithm/binary_search.h
@@ -22,22 +22,16 @@
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _ForwardIterator, class _Tp, class _Compare>
-_LIBCPP_NODISCARD_EXT inline
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-bool
-binary_search(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value, _Compare __comp)
-{
- __first = std::lower_bound<_ForwardIterator, _Tp, __comp_ref_type<_Compare> >(__first, __last, __value, __comp);
- return __first != __last && !__comp(__value, *__first);
+_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool
+binary_search(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value, _Compare __comp) {
+ __first = std::lower_bound<_ForwardIterator, _Tp, __comp_ref_type<_Compare> >(__first, __last, __value, __comp);
+ return __first != __last && !__comp(__value, *__first);
}
template <class _ForwardIterator, class _Tp>
-_LIBCPP_NODISCARD_EXT inline
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-bool
-binary_search(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value)
-{
- return std::binary_search(__first, __last, __value, __less<>());
+_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool
+binary_search(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value) {
+ return std::binary_search(__first, __last, __value, __less<>());
}
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__algorithm/comp_ref_type.h b/contrib/llvm-project/libcxx/include/__algorithm/comp_ref_type.h
index 2797e9da6658..15f4a535a30b 100644
--- a/contrib/llvm-project/libcxx/include/__algorithm/comp_ref_type.h
+++ b/contrib/llvm-project/libcxx/include/__algorithm/comp_ref_type.h
@@ -20,52 +20,42 @@
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _Compare>
-struct __debug_less
-{
- _Compare &__comp_;
- _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI __debug_less(_Compare& __c) : __comp_(__c) {}
+struct __debug_less {
+ _Compare& __comp_;
+ _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI __debug_less(_Compare& __c) : __comp_(__c) {}
- template <class _Tp, class _Up>
- _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
- bool operator()(const _Tp& __x, const _Up& __y)
- {
- bool __r = __comp_(__x, __y);
- if (__r)
- __do_compare_assert(0, __y, __x);
- return __r;
- }
+ template <class _Tp, class _Up>
+ _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI bool operator()(const _Tp& __x, const _Up& __y) {
+ bool __r = __comp_(__x, __y);
+ if (__r)
+ __do_compare_assert(0, __y, __x);
+ return __r;
+ }
- template <class _Tp, class _Up>
- _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
- bool operator()(_Tp& __x, _Up& __y)
- {
- bool __r = __comp_(__x, __y);
- if (__r)
- __do_compare_assert(0, __y, __x);
- return __r;
- }
+ template <class _Tp, class _Up>
+ _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI bool operator()(_Tp& __x, _Up& __y) {
+ bool __r = __comp_(__x, __y);
+ if (__r)
+ __do_compare_assert(0, __y, __x);
+ return __r;
+ }
- template <class _LHS, class _RHS>
- _LIBCPP_CONSTEXPR_SINCE_CXX14
- inline _LIBCPP_HIDE_FROM_ABI
- decltype((void)std::declval<_Compare&>()(
- std::declval<_LHS &>(), std::declval<_RHS &>()))
- __do_compare_assert(int, _LHS & __l, _RHS & __r) {
- _LIBCPP_ASSERT_UNCATEGORIZED(!__comp_(__l, __r),
- "Comparator does not induce a strict weak ordering");
- (void)__l;
- (void)__r;
- }
+ template <class _LHS, class _RHS>
+ _LIBCPP_CONSTEXPR_SINCE_CXX14 inline _LIBCPP_HIDE_FROM_ABI decltype((void)std::declval<_Compare&>()(
+ std::declval<_LHS&>(), std::declval<_RHS&>()))
+ __do_compare_assert(int, _LHS& __l, _RHS& __r) {
+ _LIBCPP_ASSERT_UNCATEGORIZED(!__comp_(__l, __r), "Comparator does not induce a strict weak ordering");
+ (void)__l;
+ (void)__r;
+ }
- template <class _LHS, class _RHS>
- _LIBCPP_CONSTEXPR_SINCE_CXX14
- inline _LIBCPP_HIDE_FROM_ABI
- void __do_compare_assert(long, _LHS &, _RHS &) {}
+ template <class _LHS, class _RHS>
+ _LIBCPP_CONSTEXPR_SINCE_CXX14 inline _LIBCPP_HIDE_FROM_ABI void __do_compare_assert(long, _LHS&, _RHS&) {}
};
// Pass the comparator by lvalue reference. Or in debug mode, using a
// debugging wrapper that stores a reference.
-# if _LIBCPP_HARDENING_MODE == _LIBCPP_HARDENING_MODE_DEBUG
+#if _LIBCPP_HARDENING_MODE == _LIBCPP_HARDENING_MODE_DEBUG
template <class _Comp>
using __comp_ref_type = __debug_less<_Comp>;
#else
diff --git a/contrib/llvm-project/libcxx/include/__algorithm/copy_backward.h b/contrib/llvm-project/libcxx/include/__algorithm/copy_backward.h
index d85d297b3226..3ec88d8bd5cc 100644
--- a/contrib/llvm-project/libcxx/include/__algorithm/copy_backward.h
+++ b/contrib/llvm-project/libcxx/include/__algorithm/copy_backward.h
@@ -108,8 +108,7 @@ struct __copy_backward_loop {
struct __copy_backward_trivial {
// At this point, the iterators have been unwrapped so any `contiguous_iterator` has been unwrapped to a pointer.
- template <class _In, class _Out,
- __enable_if_t<__can_lower_copy_assignment_to_memmove<_In, _Out>::value, int> = 0>
+ template <class _In, class _Out, __enable_if_t<__can_lower_copy_assignment_to_memmove<_In, _Out>::value, int> = 0>
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair<_In*, _Out*>
operator()(_In* __first, _In* __last, _Out* __result) const {
return std::__copy_backward_trivial_impl(__first, __last, __result);
@@ -124,16 +123,13 @@ __copy_backward(_BidirectionalIterator1 __first, _Sentinel __last, _Bidirectiona
}
template <class _BidirectionalIterator1, class _BidirectionalIterator2>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-_BidirectionalIterator2
-copy_backward(_BidirectionalIterator1 __first, _BidirectionalIterator1 __last,
- _BidirectionalIterator2 __result)
-{
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _BidirectionalIterator2
+copy_backward(_BidirectionalIterator1 __first, _BidirectionalIterator1 __last, _BidirectionalIterator2 __result) {
static_assert(std::is_copy_constructible<_BidirectionalIterator1>::value &&
- std::is_copy_constructible<_BidirectionalIterator1>::value, "Iterators must be copy constructible.");
+ std::is_copy_constructible<_BidirectionalIterator1>::value,
+ "Iterators must be copy constructible.");
- return std::__copy_backward<_ClassicAlgPolicy>(
- std::move(__first), std::move(__last), std::move(__result)).second;
+ return std::__copy_backward<_ClassicAlgPolicy>(std::move(__first), std::move(__last), std::move(__result)).second;
}
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__algorithm/copy_if.h b/contrib/llvm-project/libcxx/include/__algorithm/copy_if.h
index d68d1dbbadf8..228e4d22323e 100644
--- a/contrib/llvm-project/libcxx/include/__algorithm/copy_if.h
+++ b/contrib/llvm-project/libcxx/include/__algorithm/copy_if.h
@@ -17,21 +17,16 @@
_LIBCPP_BEGIN_NAMESPACE_STD
-template<class _InputIterator, class _OutputIterator, class _Predicate>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-_OutputIterator
-copy_if(_InputIterator __first, _InputIterator __last,
- _OutputIterator __result, _Predicate __pred)
-{
- for (; __first != __last; ++__first)
- {
- if (__pred(*__first))
- {
- *__result = *__first;
- ++__result;
- }
+template <class _InputIterator, class _OutputIterator, class _Predicate>
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _OutputIterator
+copy_if(_InputIterator __first, _InputIterator __last, _OutputIterator __result, _Predicate __pred) {
+ for (; __first != __last; ++__first) {
+ if (__pred(*__first)) {
+ *__result = *__first;
+ ++__result;
}
- return __result;
+ }
+ return __result;
}
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__algorithm/copy_move_common.h b/contrib/llvm-project/libcxx/include/__algorithm/copy_move_common.h
index c06892e9e3c7..b350507e32ba 100644
--- a/contrib/llvm-project/libcxx/include/__algorithm/copy_move_common.h
+++ b/contrib/llvm-project/libcxx/include/__algorithm/copy_move_common.h
@@ -38,22 +38,19 @@ _LIBCPP_BEGIN_NAMESPACE_STD
template <class _From, class _To>
struct __can_lower_copy_assignment_to_memmove {
static const bool value =
- // If the types are always bitcastable, it's valid to do a bitwise copy between them.
- __is_always_bitcastable<_From, _To>::value &&
- // Reject conversions that wouldn't be performed by the regular built-in assignment (e.g. between arrays).
- is_trivially_assignable<_To&, const _From&>::value &&
- // `memmove` doesn't accept `volatile` pointers, make sure the optimization SFINAEs away in that case.
- !is_volatile<_From>::value &&
- !is_volatile<_To>::value;
+ // If the types are always bitcastable, it's valid to do a bitwise copy between them.
+ __is_always_bitcastable<_From, _To>::value &&
+ // Reject conversions that wouldn't be performed by the regular built-in assignment (e.g. between arrays).
+ is_trivially_assignable<_To&, const _From&>::value &&
+ // `memmove` doesn't accept `volatile` pointers, make sure the optimization SFINAEs away in that case.
+ !is_volatile<_From>::value && !is_volatile<_To>::value;
};
template <class _From, class _To>
struct __can_lower_move_assignment_to_memmove {
static const bool value =
- __is_always_bitcastable<_From, _To>::value &&
- is_trivially_assignable<_To&, _From&&>::value &&
- !is_volatile<_From>::value &&
- !is_volatile<_To>::value;
+ __is_always_bitcastable<_From, _To>::value && is_trivially_assignable<_To&, _From&&>::value &&
+ !is_volatile<_From>::value && !is_volatile<_To>::value;
};
// `memmove` algorithms implementation.
@@ -95,8 +92,8 @@ struct __can_rewrap<_InIter,
_Sent,
_OutIter,
// Note that sentinels are always copy-constructible.
- __enable_if_t< is_copy_constructible<_InIter>::value &&
- is_copy_constructible<_OutIter>::value > > : true_type {};
+ __enable_if_t< is_copy_constructible<_InIter>::value && is_copy_constructible<_OutIter>::value > >
+ : true_type {};
template <class _Algorithm,
class _InIter,
@@ -108,7 +105,7 @@ __unwrap_and_dispatch(_InIter __first, _Sent __last, _OutIter __out_first) {
auto __range = std::__unwrap_range(__first, std::move(__last));
auto __result = _Algorithm()(std::move(__range.first), std::move(__range.second), std::__unwrap_iter(__out_first));
return std::make_pair(std::__rewrap_range<_Sent>(std::move(__first), std::move(__result.first)),
- std::__rewrap_iter(std::move(__out_first), std::move(__result.second)));
+ std::__rewrap_iter(std::move(__out_first), std::move(__result.second)));
}
template <class _Algorithm,
diff --git a/contrib/llvm-project/libcxx/include/__algorithm/copy_n.h b/contrib/llvm-project/libcxx/include/__algorithm/copy_n.h
index 1707e26688c6..f93f39203a7e 100644
--- a/contrib/llvm-project/libcxx/include/__algorithm/copy_n.h
+++ b/contrib/llvm-project/libcxx/include/__algorithm/copy_n.h
@@ -21,39 +21,38 @@
_LIBCPP_BEGIN_NAMESPACE_STD
-template<class _InputIterator, class _Size, class _OutputIterator,
- __enable_if_t<__has_input_iterator_category<_InputIterator>::value &&
- !__has_random_access_iterator_category<_InputIterator>::value, int> = 0>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-_OutputIterator
-copy_n(_InputIterator __first, _Size __orig_n, _OutputIterator __result)
-{
- typedef decltype(std::__convert_to_integral(__orig_n)) _IntegralSize;
- _IntegralSize __n = __orig_n;
- if (__n > 0)
- {
- *__result = *__first;
- ++__result;
- for (--__n; __n > 0; --__n)
- {
- ++__first;
- *__result = *__first;
- ++__result;
- }
+template <class _InputIterator,
+ class _Size,
+ class _OutputIterator,
+ __enable_if_t<__has_input_iterator_category<_InputIterator>::value &&
+ !__has_random_access_iterator_category<_InputIterator>::value,
+ int> = 0>
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _OutputIterator
+copy_n(_InputIterator __first, _Size __orig_n, _OutputIterator __result) {
+ typedef decltype(std::__convert_to_integral(__orig_n)) _IntegralSize;
+ _IntegralSize __n = __orig_n;
+ if (__n > 0) {
+ *__result = *__first;
+ ++__result;
+ for (--__n; __n > 0; --__n) {
+ ++__first;
+ *__result = *__first;
+ ++__result;
}
- return __result;
+ }
+ return __result;
}
-template<class _InputIterator, class _Size, class _OutputIterator,
- __enable_if_t<__has_random_access_iterator_category<_InputIterator>::value, int> = 0>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-_OutputIterator
-copy_n(_InputIterator __first, _Size __orig_n, _OutputIterator __result)
-{
- typedef typename iterator_traits<_InputIterator>::difference_type difference_type;
- typedef decltype(std::__convert_to_integral(__orig_n)) _IntegralSize;
- _IntegralSize __n = __orig_n;
- return std::copy(__first, __first + difference_type(__n), __result);
+template <class _InputIterator,
+ class _Size,
+ class _OutputIterator,
+ __enable_if_t<__has_random_access_iterator_category<_InputIterator>::value, int> = 0>
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _OutputIterator
+copy_n(_InputIterator __first, _Size __orig_n, _OutputIterator __result) {
+ typedef typename iterator_traits<_InputIterator>::difference_type difference_type;
+ typedef decltype(std::__convert_to_integral(__orig_n)) _IntegralSize;
+ _IntegralSize __n = __orig_n;
+ return std::copy(__first, __first + difference_type(__n), __result);
}
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__algorithm/equal.h b/contrib/llvm-project/libcxx/include/__algorithm/equal.h
index fb358613e210..f03f010aa51a 100644
--- a/contrib/llvm-project/libcxx/include/__algorithm/equal.h
+++ b/contrib/llvm-project/libcxx/include/__algorithm/equal.h
@@ -68,8 +68,13 @@ equal(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first
#if _LIBCPP_STD_VER >= 14
template <class _BinaryPredicate, class _InputIterator1, class _InputIterator2>
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool
-__equal(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2, _InputIterator2 __last2,
- _BinaryPredicate __pred, input_iterator_tag, input_iterator_tag) {
+__equal(_InputIterator1 __first1,
+ _InputIterator1 __last1,
+ _InputIterator2 __first2,
+ _InputIterator2 __last2,
+ _BinaryPredicate __pred,
+ input_iterator_tag,
+ input_iterator_tag) {
for (; __first1 != __last1 && __first2 != __last2; ++__first1, (void)++__first2)
if (!__pred(*__first1, *__first2))
return false;
@@ -104,8 +109,12 @@ __equal_impl(_Tp* __first1, _Tp* __last1, _Up* __first2, _Up*, _Pred&, _Proj1&,
template <class _BinaryPredicate, class _RandomAccessIterator1, class _RandomAccessIterator2>
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool
-__equal(_RandomAccessIterator1 __first1, _RandomAccessIterator1 __last1, _RandomAccessIterator2 __first2,
- _RandomAccessIterator2 __last2, _BinaryPredicate __pred, random_access_iterator_tag,
+__equal(_RandomAccessIterator1 __first1,
+ _RandomAccessIterator1 __last1,
+ _RandomAccessIterator2 __first2,
+ _RandomAccessIterator2 __last2,
+ _BinaryPredicate __pred,
+ random_access_iterator_tag,
random_access_iterator_tag) {
if (std::distance(__first1, __last1) != std::distance(__first2, __last2))
return false;
@@ -122,10 +131,18 @@ __equal(_RandomAccessIterator1 __first1, _RandomAccessIterator1 __last1, _Random
template <class _InputIterator1, class _InputIterator2, class _BinaryPredicate>
_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool
-equal(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2, _InputIterator2 __last2,
+equal(_InputIterator1 __first1,
+ _InputIterator1 __last1,
+ _InputIterator2 __first2,
+ _InputIterator2 __last2,
_BinaryPredicate __pred) {
return std::__equal<_BinaryPredicate&>(
- __first1, __last1, __first2, __last2, __pred, typename iterator_traits<_InputIterator1>::iterator_category(),
+ __first1,
+ __last1,
+ __first2,
+ __last2,
+ __pred,
+ typename iterator_traits<_InputIterator1>::iterator_category(),
typename iterator_traits<_InputIterator2>::iterator_category());
}
diff --git a/contrib/llvm-project/libcxx/include/__algorithm/equal_range.h b/contrib/llvm-project/libcxx/include/__algorithm/equal_range.h
index dc1268a6ff11..7ce54965fff0 100644
--- a/contrib/llvm-project/libcxx/include/__algorithm/equal_range.h
+++ b/contrib/llvm-project/libcxx/include/__algorithm/equal_range.h
@@ -49,9 +49,8 @@ __equal_range(_Iter __first, _Sent __last, const _Tp& __value, _Compare&& __comp
__len = __half_len;
} else {
_Iter __mp1 = __mid;
- return pair<_Iter, _Iter>(
- std::__lower_bound<_AlgPolicy>(__first, __mid, __value, __comp, __proj),
- std::__upper_bound<_AlgPolicy>(++__mp1, __end, __value, __comp, __proj));
+ return pair<_Iter, _Iter>(std::__lower_bound<_AlgPolicy>(__first, __mid, __value, __comp, __proj),
+ std::__upper_bound<_AlgPolicy>(++__mp1, __end, __value, __comp, __proj));
}
}
return pair<_Iter, _Iter>(__first, __first);
@@ -60,10 +59,8 @@ __equal_range(_Iter __first, _Sent __last, const _Tp& __value, _Compare&& __comp
template <class _ForwardIterator, class _Tp, class _Compare>
_LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 pair<_ForwardIterator, _ForwardIterator>
equal_range(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value, _Compare __comp) {
- static_assert(__is_callable<_Compare, decltype(*__first), const _Tp&>::value,
- "The comparator has to be callable");
- static_assert(is_copy_constructible<_ForwardIterator>::value,
- "Iterator has to be copy constructible");
+ static_assert(__is_callable<_Compare, decltype(*__first), const _Tp&>::value, "The comparator has to be callable");
+ static_assert(is_copy_constructible<_ForwardIterator>::value, "Iterator has to be copy constructible");
return std::__equal_range<_ClassicAlgPolicy>(
std::move(__first),
std::move(__last),
diff --git a/contrib/llvm-project/libcxx/include/__algorithm/fill.h b/contrib/llvm-project/libcxx/include/__algorithm/fill.h
index 360e2c3c3c85..1ce3eadb013d 100644
--- a/contrib/llvm-project/libcxx/include/__algorithm/fill.h
+++ b/contrib/llvm-project/libcxx/include/__algorithm/fill.h
@@ -22,28 +22,22 @@ _LIBCPP_BEGIN_NAMESPACE_STD
// fill isn't specialized for std::memset, because the compiler already optimizes the loop to a call to std::memset.
template <class _ForwardIterator, class _Tp>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-void
-__fill(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value, forward_iterator_tag)
-{
- for (; __first != __last; ++__first)
- *__first = __value;
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void
+__fill(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value, forward_iterator_tag) {
+ for (; __first != __last; ++__first)
+ *__first = __value;
}
template <class _RandomAccessIterator, class _Tp>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-void
-__fill(_RandomAccessIterator __first, _RandomAccessIterator __last, const _Tp& __value, random_access_iterator_tag)
-{
- std::fill_n(__first, __last - __first, __value);
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void
+__fill(_RandomAccessIterator __first, _RandomAccessIterator __last, const _Tp& __value, random_access_iterator_tag) {
+ std::fill_n(__first, __last - __first, __value);
}
template <class _ForwardIterator, class _Tp>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-void
-fill(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value)
-{
- std::__fill(__first, __last, __value, typename iterator_traits<_ForwardIterator>::iterator_category());
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void
+fill(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value) {
+ std::__fill(__first, __last, __value, typename iterator_traits<_ForwardIterator>::iterator_category());
}
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__algorithm/fill_n.h b/contrib/llvm-project/libcxx/include/__algorithm/fill_n.h
index 89681a342ea7..36f3349d9e7a 100644
--- a/contrib/llvm-project/libcxx/include/__algorithm/fill_n.h
+++ b/contrib/llvm-project/libcxx/include/__algorithm/fill_n.h
@@ -22,21 +22,17 @@ _LIBCPP_BEGIN_NAMESPACE_STD
// fill_n isn't specialized for std::memset, because the compiler already optimizes the loop to a call to std::memset.
template <class _OutputIterator, class _Size, class _Tp>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-_OutputIterator
-__fill_n(_OutputIterator __first, _Size __n, const _Tp& __value)
-{
- for (; __n > 0; ++__first, (void) --__n)
- *__first = __value;
- return __first;
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _OutputIterator
+__fill_n(_OutputIterator __first, _Size __n, const _Tp& __value) {
+ for (; __n > 0; ++__first, (void)--__n)
+ *__first = __value;
+ return __first;
}
template <class _OutputIterator, class _Size, class _Tp>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-_OutputIterator
-fill_n(_OutputIterator __first, _Size __n, const _Tp& __value)
-{
- return std::__fill_n(__first, std::__convert_to_integral(__n), __value);
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _OutputIterator
+fill_n(_OutputIterator __first, _Size __n, const _Tp& __value) {
+ return std::__fill_n(__first, std::__convert_to_integral(__n), __value);
}
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__algorithm/find.h b/contrib/llvm-project/libcxx/include/__algorithm/find.h
index 754e597130c5..7d7631b6e98a 100644
--- a/contrib/llvm-project/libcxx/include/__algorithm/find.h
+++ b/contrib/llvm-project/libcxx/include/__algorithm/find.h
@@ -21,8 +21,11 @@
#include <__fwd/bit_reference.h>
#include <__iterator/segmented_iterator.h>
#include <__string/constexpr_c_functions.h>
+#include <__type_traits/is_integral.h>
#include <__type_traits/is_same.h>
+#include <__type_traits/is_signed.h>
#include <__utility/move.h>
+#include <limits>
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
# include <cwchar>
@@ -76,6 +79,22 @@ __find_impl(_Tp* __first, _Tp* __last, const _Up& __value, _Proj&) {
}
#endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS
+// TODO: This should also be possible to get right with different signedness
+// cast integral types to allow vectorization
+template <class _Tp,
+ class _Up,
+ class _Proj,
+ __enable_if_t<__is_identity<_Proj>::value && !__libcpp_is_trivially_equality_comparable<_Tp, _Up>::value &&
+ is_integral<_Tp>::value && is_integral<_Up>::value &&
+ is_signed<_Tp>::value == is_signed<_Up>::value,
+ int> = 0>
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _Tp*
+__find_impl(_Tp* __first, _Tp* __last, const _Up& __value, _Proj& __proj) {
+ if (__value < numeric_limits<_Tp>::min() || __value > numeric_limits<_Tp>::max())
+ return __last;
+ return std::__find_impl(__first, __last, _Tp(__value), __proj);
+}
+
// __bit_iterator implementation
template <bool _ToFind, class _Cp, bool _IsConst>
_LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI __bit_iterator<_Cp, _IsConst>
diff --git a/contrib/llvm-project/libcxx/include/__algorithm/find_end.h b/contrib/llvm-project/libcxx/include/__algorithm/find_end.h
index edb9891c66f7..4c26891666b2 100644
--- a/contrib/llvm-project/libcxx/include/__algorithm/find_end.h
+++ b/contrib/llvm-project/libcxx/include/__algorithm/find_end.h
@@ -28,15 +28,14 @@
_LIBCPP_BEGIN_NAMESPACE_STD
-template <
- class _AlgPolicy,
- class _Iter1,
- class _Sent1,
- class _Iter2,
- class _Sent2,
- class _Pred,
- class _Proj1,
- class _Proj2>
+template < class _AlgPolicy,
+ class _Iter1,
+ class _Sent1,
+ class _Iter2,
+ class _Sent2,
+ class _Pred,
+ class _Proj1,
+ class _Proj2>
_LIBCPP_HIDE_FROM_ABI inline _LIBCPP_CONSTEXPR_SINCE_CXX14 pair<_Iter1, _Iter1> __find_end_impl(
_Iter1 __first1,
_Sent1 __last1,
@@ -49,7 +48,7 @@ _LIBCPP_HIDE_FROM_ABI inline _LIBCPP_CONSTEXPR_SINCE_CXX14 pair<_Iter1, _Iter1>
forward_iterator_tag) {
// modeled after search algorithm
_Iter1 __match_first = _IterOps<_AlgPolicy>::next(__first1, __last1); // __last1 is the "default" answer
- _Iter1 __match_last = __match_first;
+ _Iter1 __match_last = __match_first;
if (__first2 == __last2)
return pair<_Iter1, _Iter1>(__match_last, __match_last);
while (true) {
@@ -66,15 +65,14 @@ _LIBCPP_HIDE_FROM_ABI inline _LIBCPP_CONSTEXPR_SINCE_CXX14 pair<_Iter1, _Iter1>
while (true) {
if (++__m2 == __last2) { // Pattern exhaused, record answer and search for another one
__match_first = __first1;
- __match_last = ++__m1;
+ __match_last = ++__m1;
++__first1;
break;
}
if (++__m1 == __last1) // Source exhausted, return last answer
return pair<_Iter1, _Iter1>(__match_first, __match_last);
- // mismatch, restart with a new __first
- if (!std::__invoke(__pred, std::__invoke(__proj1, *__m1), std::__invoke(__proj2, *__m2)))
- {
+ // mismatch, restart with a new __first
+ if (!std::__invoke(__pred, std::__invoke(__proj1, *__m1), std::__invoke(__proj2, *__m2))) {
++__first1;
break;
} // else there is a match, check next elements
@@ -82,15 +80,14 @@ _LIBCPP_HIDE_FROM_ABI inline _LIBCPP_CONSTEXPR_SINCE_CXX14 pair<_Iter1, _Iter1>
}
}
-template <
- class _IterOps,
- class _Pred,
- class _Iter1,
- class _Sent1,
- class _Iter2,
- class _Sent2,
- class _Proj1,
- class _Proj2>
+template < class _IterOps,
+ class _Pred,
+ class _Iter1,
+ class _Sent1,
+ class _Iter2,
+ class _Sent2,
+ class _Proj1,
+ class _Proj2>
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _Iter1 __find_end(
_Iter1 __first1,
_Sent1 __sent1,
@@ -127,23 +124,21 @@ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _Iter1 __find_end(
return __last1;
// if there is a mismatch, restart with a new __l1
- if (!std::__invoke(__pred, std::__invoke(__proj1, *--__m1), std::__invoke(__proj2, *--__m2)))
- {
+ if (!std::__invoke(__pred, std::__invoke(__proj1, *--__m1), std::__invoke(__proj2, *--__m2))) {
break;
} // else there is a match, check next elements
}
}
}
-template <
- class _AlgPolicy,
- class _Pred,
- class _Iter1,
- class _Sent1,
- class _Iter2,
- class _Sent2,
- class _Proj1,
- class _Proj2>
+template < class _AlgPolicy,
+ class _Pred,
+ class _Iter1,
+ class _Sent1,
+ class _Iter2,
+ class _Sent2,
+ class _Proj1,
+ class _Proj2>
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _Iter1 __find_end(
_Iter1 __first1,
_Sent1 __sent1,
@@ -165,8 +160,8 @@ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _Iter1 __find_end(
if (__len1 < __len2)
return __last1;
const _Iter1 __s = __first1 + _D1(__len2 - 1); // End of pattern match can't go before here
- _Iter1 __l1 = __last1;
- _Iter2 __l2 = __last2;
+ _Iter1 __l1 = __last1;
+ _Iter2 __l2 = __last2;
--__l2;
while (true) {
while (true) {
@@ -189,10 +184,12 @@ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _Iter1 __find_end(
}
template <class _ForwardIterator1, class _ForwardIterator2, class _BinaryPredicate>
-_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
-_ForwardIterator1 __find_end_classic(_ForwardIterator1 __first1, _ForwardIterator1 __last1,
- _ForwardIterator2 __first2, _ForwardIterator2 __last2,
- _BinaryPredicate& __pred) {
+_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _ForwardIterator1 __find_end_classic(
+ _ForwardIterator1 __first1,
+ _ForwardIterator1 __last1,
+ _ForwardIterator2 __first2,
+ _ForwardIterator2 __last2,
+ _BinaryPredicate& __pred) {
auto __proj = __identity();
return std::__find_end_impl<_ClassicAlgPolicy>(
__first1,
@@ -208,17 +205,18 @@ _ForwardIterator1 __find_end_classic(_ForwardIterator1 __first1, _ForwardIterato
}
template <class _ForwardIterator1, class _ForwardIterator2, class _BinaryPredicate>
-_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-_ForwardIterator1 find_end(_ForwardIterator1 __first1, _ForwardIterator1 __last1,
- _ForwardIterator2 __first2, _ForwardIterator2 __last2,
- _BinaryPredicate __pred) {
+_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _ForwardIterator1 find_end(
+ _ForwardIterator1 __first1,
+ _ForwardIterator1 __last1,
+ _ForwardIterator2 __first2,
+ _ForwardIterator2 __last2,
+ _BinaryPredicate __pred) {
return std::__find_end_classic(__first1, __last1, __first2, __last2, __pred);
}
template <class _ForwardIterator1, class _ForwardIterator2>
-_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-_ForwardIterator1 find_end(_ForwardIterator1 __first1, _ForwardIterator1 __last1,
- _ForwardIterator2 __first2, _ForwardIterator2 __last2) {
+_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _ForwardIterator1
+find_end(_ForwardIterator1 __first1, _ForwardIterator1 __last1, _ForwardIterator2 __first2, _ForwardIterator2 __last2) {
return std::find_end(__first1, __last1, __first2, __last2, __equal_to());
}
diff --git a/contrib/llvm-project/libcxx/include/__algorithm/find_first_of.h b/contrib/llvm-project/libcxx/include/__algorithm/find_first_of.h
index 15a147242b0e..14271cccc42b 100644
--- a/contrib/llvm-project/libcxx/include/__algorithm/find_first_of.h
+++ b/contrib/llvm-project/libcxx/include/__algorithm/find_first_of.h
@@ -21,12 +21,12 @@
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _ForwardIterator1, class _ForwardIterator2, class _BinaryPredicate>
-_LIBCPP_HIDE_FROM_ABI
-_LIBCPP_CONSTEXPR_SINCE_CXX14 _ForwardIterator1 __find_first_of_ce(_ForwardIterator1 __first1,
- _ForwardIterator1 __last1,
- _ForwardIterator2 __first2,
- _ForwardIterator2 __last2,
- _BinaryPredicate&& __pred) {
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _ForwardIterator1 __find_first_of_ce(
+ _ForwardIterator1 __first1,
+ _ForwardIterator1 __last1,
+ _ForwardIterator2 __first2,
+ _ForwardIterator2 __last2,
+ _BinaryPredicate&& __pred) {
for (; __first1 != __last1; ++__first1)
for (_ForwardIterator2 __j = __first2; __j != __last2; ++__j)
if (__pred(*__first1, *__j))
@@ -35,9 +35,12 @@ _LIBCPP_CONSTEXPR_SINCE_CXX14 _ForwardIterator1 __find_first_of_ce(_ForwardItera
}
template <class _ForwardIterator1, class _ForwardIterator2, class _BinaryPredicate>
-_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _ForwardIterator1
-find_first_of(_ForwardIterator1 __first1, _ForwardIterator1 __last1, _ForwardIterator2 __first2,
- _ForwardIterator2 __last2, _BinaryPredicate __pred) {
+_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _ForwardIterator1 find_first_of(
+ _ForwardIterator1 __first1,
+ _ForwardIterator1 __last1,
+ _ForwardIterator2 __first2,
+ _ForwardIterator2 __last2,
+ _BinaryPredicate __pred) {
return std::__find_first_of_ce(__first1, __last1, __first2, __last2, __pred);
}
diff --git a/contrib/llvm-project/libcxx/include/__algorithm/fold.h b/contrib/llvm-project/libcxx/include/__algorithm/fold.h
new file mode 100644
index 000000000000..88e6814d5cf9
--- /dev/null
+++ b/contrib/llvm-project/libcxx/include/__algorithm/fold.h
@@ -0,0 +1,125 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBCPP___ALGORITHM_FOLD_H
+#define _LIBCPP___ALGORITHM_FOLD_H
+
+#include <__concepts/assignable.h>
+#include <__concepts/convertible_to.h>
+#include <__concepts/invocable.h>
+#include <__concepts/movable.h>
+#include <__config>
+#include <__functional/invoke.h>
+#include <__functional/reference_wrapper.h>
+#include <__iterator/concepts.h>
+#include <__iterator/iterator_traits.h>
+#include <__iterator/next.h>
+#include <__ranges/access.h>
+#include <__ranges/concepts.h>
+#include <__ranges/dangling.h>
+#include <__type_traits/decay.h>
+#include <__type_traits/invoke.h>
+#include <__utility/forward.h>
+#include <__utility/move.h>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+# pragma GCC system_header
+#endif
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+#if _LIBCPP_STD_VER >= 23
+
+namespace ranges {
+template <class _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>
+ _LIBCPP_NODISCARD_EXT _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>
+ _LIBCPP_NODISCARD_EXT _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>
+ _LIBCPP_NODISCARD_EXT _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>
+ _LIBCPP_NODISCARD_EXT _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
+
+#endif // _LIBCPP___ALGORITHM_FOLD_H
diff --git a/contrib/llvm-project/libcxx/include/__algorithm/for_each_n.h b/contrib/llvm-project/libcxx/include/__algorithm/for_each_n.h
index a72a0912cfa5..fce380b49df3 100644
--- a/contrib/llvm-project/libcxx/include/__algorithm/for_each_n.h
+++ b/contrib/llvm-project/libcxx/include/__algorithm/for_each_n.h
@@ -22,9 +22,8 @@ _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) {
+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) {
diff --git a/contrib/llvm-project/libcxx/include/__algorithm/generate.h b/contrib/llvm-project/libcxx/include/__algorithm/generate.h
index e2051dc16dc0..c95b527402f5 100644
--- a/contrib/llvm-project/libcxx/include/__algorithm/generate.h
+++ b/contrib/llvm-project/libcxx/include/__algorithm/generate.h
@@ -18,12 +18,10 @@
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _ForwardIterator, class _Generator>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-void
-generate(_ForwardIterator __first, _ForwardIterator __last, _Generator __gen)
-{
- for (; __first != __last; ++__first)
- *__first = __gen();
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void
+generate(_ForwardIterator __first, _ForwardIterator __last, _Generator __gen) {
+ for (; __first != __last; ++__first)
+ *__first = __gen();
}
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__algorithm/generate_n.h b/contrib/llvm-project/libcxx/include/__algorithm/generate_n.h
index 5719826e93ed..f36403fd0f94 100644
--- a/contrib/llvm-project/libcxx/include/__algorithm/generate_n.h
+++ b/contrib/llvm-project/libcxx/include/__algorithm/generate_n.h
@@ -19,15 +19,13 @@
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _OutputIterator, class _Size, class _Generator>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-_OutputIterator
-generate_n(_OutputIterator __first, _Size __orig_n, _Generator __gen)
-{
- typedef decltype(std::__convert_to_integral(__orig_n)) _IntegralSize;
- _IntegralSize __n = __orig_n;
- for (; __n > 0; ++__first, (void) --__n)
- *__first = __gen();
- return __first;
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _OutputIterator
+generate_n(_OutputIterator __first, _Size __orig_n, _Generator __gen) {
+ typedef decltype(std::__convert_to_integral(__orig_n)) _IntegralSize;
+ _IntegralSize __n = __orig_n;
+ for (; __n > 0; ++__first, (void)--__n)
+ *__first = __gen();
+ return __first;
}
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__algorithm/half_positive.h b/contrib/llvm-project/libcxx/include/__algorithm/half_positive.h
index 2315e154fb2e..ebda0da37236 100644
--- a/contrib/llvm-project/libcxx/include/__algorithm/half_positive.h
+++ b/contrib/llvm-project/libcxx/include/__algorithm/half_positive.h
@@ -23,19 +23,13 @@ _LIBCPP_BEGIN_NAMESPACE_STD
// Perform division by two quickly for positive integers (llvm.org/PR39129)
template <typename _Integral, __enable_if_t<is_integral<_Integral>::value, int> = 0>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR
-_Integral
-__half_positive(_Integral __value)
-{
- return static_cast<_Integral>(static_cast<__make_unsigned_t<_Integral> >(__value) / 2);
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR _Integral __half_positive(_Integral __value) {
+ return static_cast<_Integral>(static_cast<__make_unsigned_t<_Integral> >(__value) / 2);
}
template <typename _Tp, __enable_if_t<!is_integral<_Tp>::value, int> = 0>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR
-_Tp
-__half_positive(_Tp __value)
-{
- return __value / 2;
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR _Tp __half_positive(_Tp __value) {
+ return __value / 2;
}
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__algorithm/in_found_result.h b/contrib/llvm-project/libcxx/include/__algorithm/in_found_result.h
index d9ca287f017b..88a0255d1698 100644
--- a/contrib/llvm-project/libcxx/include/__algorithm/in_found_result.h
+++ b/contrib/llvm-project/libcxx/include/__algorithm/in_found_result.h
@@ -30,7 +30,7 @@ struct in_found_result {
template <class _InIter2>
requires convertible_to<const _InIter1&, _InIter2>
- _LIBCPP_HIDE_FROM_ABI constexpr operator in_found_result<_InIter2>() const & {
+ _LIBCPP_HIDE_FROM_ABI constexpr operator in_found_result<_InIter2>() const& {
return {in, found};
}
diff --git a/contrib/llvm-project/libcxx/include/__algorithm/in_fun_result.h b/contrib/llvm-project/libcxx/include/__algorithm/in_fun_result.h
index 33374eddc30d..6110c1cf86cd 100644
--- a/contrib/llvm-project/libcxx/include/__algorithm/in_fun_result.h
+++ b/contrib/llvm-project/libcxx/include/__algorithm/in_fun_result.h
@@ -30,7 +30,7 @@ struct in_fun_result {
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 & {
+ _LIBCPP_HIDE_FROM_ABI constexpr operator in_fun_result<_InIter2, _Func2>() const& {
return {in, fun};
}
diff --git a/contrib/llvm-project/libcxx/include/__algorithm/in_in_out_result.h b/contrib/llvm-project/libcxx/include/__algorithm/in_in_out_result.h
index 6b50e0e24564..95ce4f4fd5bd 100644
--- a/contrib/llvm-project/libcxx/include/__algorithm/in_in_out_result.h
+++ b/contrib/llvm-project/libcxx/include/__algorithm/in_in_out_result.h
@@ -31,18 +31,16 @@ struct in_in_out_result {
_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& {
+ 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>() && {
+ 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)};
}
};
diff --git a/contrib/llvm-project/libcxx/include/__algorithm/in_in_result.h b/contrib/llvm-project/libcxx/include/__algorithm/in_in_result.h
index 1eceb9de0233..d1d62dae7f67 100644
--- a/contrib/llvm-project/libcxx/include/__algorithm/in_in_result.h
+++ b/contrib/llvm-project/libcxx/include/__algorithm/in_in_result.h
@@ -31,15 +31,13 @@ struct in_in_result {
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 & {
+ _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>() && {
+ _LIBCPP_HIDE_FROM_ABI constexpr operator in_in_result<_InIter3, _InIter4>() && {
return {std::move(in1), std::move(in2)};
}
};
diff --git a/contrib/llvm-project/libcxx/include/__algorithm/in_out_out_result.h b/contrib/llvm-project/libcxx/include/__algorithm/in_out_out_result.h
index 2f7a09b5c301..143642368750 100644
--- a/contrib/llvm-project/libcxx/include/__algorithm/in_out_out_result.h
+++ b/contrib/llvm-project/libcxx/include/__algorithm/in_out_out_result.h
@@ -30,18 +30,16 @@ struct in_out_out_result {
_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& {
+ 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>() && {
+ 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)};
}
};
diff --git a/contrib/llvm-project/libcxx/include/__algorithm/in_out_result.h b/contrib/llvm-project/libcxx/include/__algorithm/in_out_result.h
index e4741cb71f66..a7a986cf8e6c 100644
--- a/contrib/llvm-project/libcxx/include/__algorithm/in_out_result.h
+++ b/contrib/llvm-project/libcxx/include/__algorithm/in_out_result.h
@@ -27,22 +27,20 @@ _LIBCPP_BEGIN_NAMESPACE_STD
namespace ranges {
-template<class _InIter1, class _OutIter1>
+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 & {
+ _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>() && {
+ _LIBCPP_HIDE_FROM_ABI constexpr operator in_out_result<_InIter2, _OutIter2>() && {
return {std::move(in), std::move(out)};
}
};
diff --git a/contrib/llvm-project/libcxx/include/__algorithm/includes.h b/contrib/llvm-project/libcxx/include/__algorithm/includes.h
index 88253e2653d2..531752e93175 100644
--- a/contrib/llvm-project/libcxx/include/__algorithm/includes.h
+++ b/contrib/llvm-project/libcxx/include/__algorithm/includes.h
@@ -25,12 +25,17 @@
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _Iter1, class _Sent1, class _Iter2, class _Sent2, class _Comp, class _Proj1, class _Proj2>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool
-__includes(_Iter1 __first1, _Sent1 __last1, _Iter2 __first2, _Sent2 __last2,
- _Comp&& __comp, _Proj1&& __proj1, _Proj2&& __proj2) {
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool __includes(
+ _Iter1 __first1,
+ _Sent1 __last1,
+ _Iter2 __first2,
+ _Sent2 __last2,
+ _Comp&& __comp,
+ _Proj1&& __proj1,
+ _Proj2&& __proj2) {
for (; __first2 != __last2; ++__first1) {
- if (__first1 == __last1 || std::__invoke(
- __comp, std::__invoke(__proj2, *__first2), std::__invoke(__proj1, *__first1)))
+ if (__first1 == __last1 ||
+ std::__invoke(__comp, std::__invoke(__proj2, *__first2), std::__invoke(__proj1, *__first1)))
return false;
if (!std::__invoke(__comp, std::__invoke(__proj1, *__first1), std::__invoke(__proj2, *__first2)))
++__first2;
@@ -39,14 +44,14 @@ __includes(_Iter1 __first1, _Sent1 __last1, _Iter2 __first2, _Sent2 __last2,
}
template <class _InputIterator1, class _InputIterator2, class _Compare>
-_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool includes(
- _InputIterator1 __first1,
- _InputIterator1 __last1,
- _InputIterator2 __first2,
- _InputIterator2 __last2,
- _Compare __comp) {
- static_assert(__is_callable<_Compare, decltype(*__first1), decltype(*__first2)>::value,
- "Comparator has to be callable");
+_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool
+includes(_InputIterator1 __first1,
+ _InputIterator1 __last1,
+ _InputIterator2 __first2,
+ _InputIterator2 __last2,
+ _Compare __comp) {
+ static_assert(
+ __is_callable<_Compare, decltype(*__first1), decltype(*__first2)>::value, "Comparator has to be callable");
return std::__includes(
std::move(__first1),
diff --git a/contrib/llvm-project/libcxx/include/__algorithm/inplace_merge.h b/contrib/llvm-project/libcxx/include/__algorithm/inplace_merge.h
index d49c2e5cedda..eb3c0bdbc2db 100644
--- a/contrib/llvm-project/libcxx/include/__algorithm/inplace_merge.h
+++ b/contrib/llvm-project/libcxx/include/__algorithm/inplace_merge.h
@@ -42,54 +42,57 @@ template <class _Predicate>
class __invert // invert the sense of a comparison
{
private:
- _Predicate __p_;
+ _Predicate __p_;
+
public:
- _LIBCPP_HIDE_FROM_ABI __invert() {}
+ _LIBCPP_HIDE_FROM_ABI __invert() {}
- _LIBCPP_HIDE_FROM_ABI
- explicit __invert(_Predicate __p) : __p_(__p) {}
+ _LIBCPP_HIDE_FROM_ABI explicit __invert(_Predicate __p) : __p_(__p) {}
- template <class _T1>
- _LIBCPP_HIDE_FROM_ABI
- bool operator()(const _T1& __x) {return !__p_(__x);}
+ template <class _T1>
+ _LIBCPP_HIDE_FROM_ABI bool operator()(const _T1& __x) {
+ return !__p_(__x);
+ }
- template <class _T1, class _T2>
- _LIBCPP_HIDE_FROM_ABI
- bool operator()(const _T1& __x, const _T2& __y) {return __p_(__y, __x);}
+ template <class _T1, class _T2>
+ _LIBCPP_HIDE_FROM_ABI bool operator()(const _T1& __x, const _T2& __y) {
+ return __p_(__y, __x);
+ }
};
-template <class _AlgPolicy, class _Compare, class _InputIterator1, class _Sent1,
- class _InputIterator2, class _Sent2, class _OutputIterator>
-_LIBCPP_HIDE_FROM_ABI
-void __half_inplace_merge(_InputIterator1 __first1, _Sent1 __last1,
- _InputIterator2 __first2, _Sent2 __last2,
- _OutputIterator __result, _Compare&& __comp)
-{
- for (; __first1 != __last1; ++__result)
- {
- if (__first2 == __last2)
- {
- std::__move<_AlgPolicy>(__first1, __last1, __result);
- return;
- }
+template <class _AlgPolicy,
+ class _Compare,
+ class _InputIterator1,
+ class _Sent1,
+ class _InputIterator2,
+ class _Sent2,
+ class _OutputIterator>
+_LIBCPP_HIDE_FROM_ABI void __half_inplace_merge(
+ _InputIterator1 __first1,
+ _Sent1 __last1,
+ _InputIterator2 __first2,
+ _Sent2 __last2,
+ _OutputIterator __result,
+ _Compare&& __comp) {
+ for (; __first1 != __last1; ++__result) {
+ if (__first2 == __last2) {
+ std::__move<_AlgPolicy>(__first1, __last1, __result);
+ return;
+ }
- if (__comp(*__first2, *__first1))
- {
- *__result = _IterOps<_AlgPolicy>::__iter_move(__first2);
- ++__first2;
- }
- else
- {
- *__result = _IterOps<_AlgPolicy>::__iter_move(__first1);
- ++__first1;
- }
+ if (__comp(*__first2, *__first1)) {
+ *__result = _IterOps<_AlgPolicy>::__iter_move(__first2);
+ ++__first2;
+ } else {
+ *__result = _IterOps<_AlgPolicy>::__iter_move(__first1);
+ ++__first1;
}
- // __first2 through __last2 are already in the right spot.
+ }
+ // __first2 through __last2 are already in the right spot.
}
template <class _AlgPolicy, class _Compare, class _BidirectionalIterator>
-_LIBCPP_HIDE_FROM_ABI
-void __buffered_inplace_merge(
+_LIBCPP_HIDE_FROM_ABI void __buffered_inplace_merge(
_BidirectionalIterator __first,
_BidirectionalIterator __middle,
_BidirectionalIterator __last,
@@ -98,27 +101,25 @@ void __buffered_inplace_merge(
typename iterator_traits<_BidirectionalIterator>::difference_type __len2,
typename iterator_traits<_BidirectionalIterator>::value_type* __buff) {
typedef typename iterator_traits<_BidirectionalIterator>::value_type value_type;
- __destruct_n __d(0);
- unique_ptr<value_type, __destruct_n&> __h2(__buff, __d);
- if (__len1 <= __len2)
- {
- value_type* __p = __buff;
- for (_BidirectionalIterator __i = __first; __i != __middle; __d.template __incr<value_type>(), (void) ++__i, (void) ++__p)
- ::new ((void*)__p) value_type(_IterOps<_AlgPolicy>::__iter_move(__i));
- std::__half_inplace_merge<_AlgPolicy>(__buff, __p, __middle, __last, __first, __comp);
- }
- else
- {
- value_type* __p = __buff;
- for (_BidirectionalIterator __i = __middle; __i != __last; __d.template __incr<value_type>(), (void) ++__i, (void) ++__p)
- ::new ((void*)__p) value_type(_IterOps<_AlgPolicy>::__iter_move(__i));
- typedef __unconstrained_reverse_iterator<_BidirectionalIterator> _RBi;
- typedef __unconstrained_reverse_iterator<value_type*> _Rv;
- typedef __invert<_Compare> _Inverted;
- std::__half_inplace_merge<_AlgPolicy>(_Rv(__p), _Rv(__buff),
- _RBi(__middle), _RBi(__first),
- _RBi(__last), _Inverted(__comp));
- }
+ __destruct_n __d(0);
+ unique_ptr<value_type, __destruct_n&> __h2(__buff, __d);
+ if (__len1 <= __len2) {
+ value_type* __p = __buff;
+ for (_BidirectionalIterator __i = __first; __i != __middle;
+ __d.template __incr<value_type>(), (void)++__i, (void)++__p)
+ ::new ((void*)__p) value_type(_IterOps<_AlgPolicy>::__iter_move(__i));
+ std::__half_inplace_merge<_AlgPolicy>(__buff, __p, __middle, __last, __first, __comp);
+ } else {
+ value_type* __p = __buff;
+ for (_BidirectionalIterator __i = __middle; __i != __last;
+ __d.template __incr<value_type>(), (void)++__i, (void)++__p)
+ ::new ((void*)__p) value_type(_IterOps<_AlgPolicy>::__iter_move(__i));
+ typedef __unconstrained_reverse_iterator<_BidirectionalIterator> _RBi;
+ typedef __unconstrained_reverse_iterator<value_type*> _Rv;
+ typedef __invert<_Compare> _Inverted;
+ std::__half_inplace_merge<_AlgPolicy>(
+ _Rv(__p), _Rv(__buff), _RBi(__middle), _RBi(__first), _RBi(__last), _Inverted(__comp));
+ }
}
template <class _AlgPolicy, class _Compare, class _BidirectionalIterator>
@@ -131,107 +132,92 @@ void __inplace_merge(
typename iterator_traits<_BidirectionalIterator>::difference_type __len2,
typename iterator_traits<_BidirectionalIterator>::value_type* __buff,
ptrdiff_t __buff_size) {
- using _Ops = _IterOps<_AlgPolicy>;
-
- typedef typename iterator_traits<_BidirectionalIterator>::difference_type difference_type;
- while (true)
- {
- // if __middle == __last, we're done
- if (__len2 == 0)
- return;
- if (__len1 <= __buff_size || __len2 <= __buff_size)
- return std::__buffered_inplace_merge<_AlgPolicy>
- (__first, __middle, __last, __comp, __len1, __len2, __buff);
- // shrink [__first, __middle) as much as possible (with no moves), returning if it shrinks to 0
- for (; true; ++__first, (void) --__len1)
- {
- if (__len1 == 0)
- return;
- if (__comp(*__middle, *__first))
- break;
- }
- // __first < __middle < __last
- // *__first > *__middle
- // partition [__first, __m1) [__m1, __middle) [__middle, __m2) [__m2, __last) such that
- // all elements in:
- // [__first, __m1) <= [__middle, __m2)
- // [__middle, __m2) < [__m1, __middle)
- // [__m1, __middle) <= [__m2, __last)
- // and __m1 or __m2 is in the middle of its range
- _BidirectionalIterator __m1; // "median" of [__first, __middle)
- _BidirectionalIterator __m2; // "median" of [__middle, __last)
- difference_type __len11; // distance(__first, __m1)
- difference_type __len21; // distance(__middle, __m2)
- // binary search smaller range
- if (__len1 < __len2)
- { // __len >= 1, __len2 >= 2
- __len21 = __len2 / 2;
- __m2 = __middle;
- _Ops::advance(__m2, __len21);
- __m1 = std::__upper_bound<_AlgPolicy>(__first, __middle, *__m2, __comp, std::__identity());
- __len11 = _Ops::distance(__first, __m1);
- }
- else
- {
- if (__len1 == 1)
- { // __len1 >= __len2 && __len2 > 0, therefore __len2 == 1
- // It is known *__first > *__middle
- _Ops::iter_swap(__first, __middle);
- return;
- }
- // __len1 >= 2, __len2 >= 1
- __len11 = __len1 / 2;
- __m1 = __first;
- _Ops::advance(__m1, __len11);
- __m2 = std::lower_bound(__middle, __last, *__m1, __comp);
- __len21 = _Ops::distance(__middle, __m2);
- }
- difference_type __len12 = __len1 - __len11; // distance(__m1, __middle)
- difference_type __len22 = __len2 - __len21; // distance(__m2, __last)
- // [__first, __m1) [__m1, __middle) [__middle, __m2) [__m2, __last)
- // swap middle two partitions
- __middle = std::__rotate<_AlgPolicy>(__m1, __middle, __m2).first;
- // __len12 and __len21 now have swapped meanings
- // merge smaller range with recursive call and larger with tail recursion elimination
- if (__len11 + __len21 < __len12 + __len22)
- {
- std::__inplace_merge<_AlgPolicy>(
- __first, __m1, __middle, __comp, __len11, __len21, __buff, __buff_size);
- __first = __middle;
- __middle = __m2;
- __len1 = __len12;
- __len2 = __len22;
- }
- else
- {
- std::__inplace_merge<_AlgPolicy>(
- __middle, __m2, __last, __comp, __len12, __len22, __buff, __buff_size);
- __last = __middle;
- __middle = __m1;
- __len1 = __len11;
- __len2 = __len21;
- }
+ using _Ops = _IterOps<_AlgPolicy>;
+
+ typedef typename iterator_traits<_BidirectionalIterator>::difference_type difference_type;
+ while (true) {
+ // if __middle == __last, we're done
+ if (__len2 == 0)
+ return;
+ if (__len1 <= __buff_size || __len2 <= __buff_size)
+ return std::__buffered_inplace_merge<_AlgPolicy>(__first, __middle, __last, __comp, __len1, __len2, __buff);
+ // shrink [__first, __middle) as much as possible (with no moves), returning if it shrinks to 0
+ for (; true; ++__first, (void)--__len1) {
+ if (__len1 == 0)
+ return;
+ if (__comp(*__middle, *__first))
+ break;
}
+ // __first < __middle < __last
+ // *__first > *__middle
+ // partition [__first, __m1) [__m1, __middle) [__middle, __m2) [__m2, __last) such that
+ // all elements in:
+ // [__first, __m1) <= [__middle, __m2)
+ // [__middle, __m2) < [__m1, __middle)
+ // [__m1, __middle) <= [__m2, __last)
+ // and __m1 or __m2 is in the middle of its range
+ _BidirectionalIterator __m1; // "median" of [__first, __middle)
+ _BidirectionalIterator __m2; // "median" of [__middle, __last)
+ difference_type __len11; // distance(__first, __m1)
+ difference_type __len21; // distance(__middle, __m2)
+ // binary search smaller range
+ if (__len1 < __len2) { // __len >= 1, __len2 >= 2
+ __len21 = __len2 / 2;
+ __m2 = __middle;
+ _Ops::advance(__m2, __len21);
+ __m1 = std::__upper_bound<_AlgPolicy>(__first, __middle, *__m2, __comp, std::__identity());
+ __len11 = _Ops::distance(__first, __m1);
+ } else {
+ if (__len1 == 1) { // __len1 >= __len2 && __len2 > 0, therefore __len2 == 1
+ // It is known *__first > *__middle
+ _Ops::iter_swap(__first, __middle);
+ return;
+ }
+ // __len1 >= 2, __len2 >= 1
+ __len11 = __len1 / 2;
+ __m1 = __first;
+ _Ops::advance(__m1, __len11);
+ __m2 = std::lower_bound(__middle, __last, *__m1, __comp);
+ __len21 = _Ops::distance(__middle, __m2);
+ }
+ difference_type __len12 = __len1 - __len11; // distance(__m1, __middle)
+ difference_type __len22 = __len2 - __len21; // distance(__m2, __last)
+ // [__first, __m1) [__m1, __middle) [__middle, __m2) [__m2, __last)
+ // swap middle two partitions
+ __middle = std::__rotate<_AlgPolicy>(__m1, __middle, __m2).first;
+ // __len12 and __len21 now have swapped meanings
+ // merge smaller range with recursive call and larger with tail recursion elimination
+ if (__len11 + __len21 < __len12 + __len22) {
+ std::__inplace_merge<_AlgPolicy>(__first, __m1, __middle, __comp, __len11, __len21, __buff, __buff_size);
+ __first = __middle;
+ __middle = __m2;
+ __len1 = __len12;
+ __len2 = __len22;
+ } else {
+ std::__inplace_merge<_AlgPolicy>(__middle, __m2, __last, __comp, __len12, __len22, __buff, __buff_size);
+ __last = __middle;
+ __middle = __m1;
+ __len1 = __len11;
+ __len2 = __len21;
+ }
+ }
}
template <class _AlgPolicy, class _BidirectionalIterator, class _Compare>
-_LIBCPP_HIDE_FROM_ABI
-void
-__inplace_merge(_BidirectionalIterator __first, _BidirectionalIterator __middle, _BidirectionalIterator __last,
- _Compare&& __comp)
-{
- typedef typename iterator_traits<_BidirectionalIterator>::value_type value_type;
- typedef typename iterator_traits<_BidirectionalIterator>::difference_type difference_type;
- difference_type __len1 = _IterOps<_AlgPolicy>::distance(__first, __middle);
- difference_type __len2 = _IterOps<_AlgPolicy>::distance(__middle, __last);
- difference_type __buf_size = std::min(__len1, __len2);
-// TODO: Remove the use of std::get_temporary_buffer
-_LIBCPP_SUPPRESS_DEPRECATED_PUSH
- pair<value_type*, ptrdiff_t> __buf = std::get_temporary_buffer<value_type>(__buf_size);
-_LIBCPP_SUPPRESS_DEPRECATED_POP
- unique_ptr<value_type, __return_temporary_buffer> __h(__buf.first);
- return std::__inplace_merge<_AlgPolicy>(
- std::move(__first), std::move(__middle), std::move(__last), __comp, __len1, __len2, __buf.first, __buf.second);
+_LIBCPP_HIDE_FROM_ABI void __inplace_merge(
+ _BidirectionalIterator __first, _BidirectionalIterator __middle, _BidirectionalIterator __last, _Compare&& __comp) {
+ typedef typename iterator_traits<_BidirectionalIterator>::value_type value_type;
+ typedef typename iterator_traits<_BidirectionalIterator>::difference_type difference_type;
+ difference_type __len1 = _IterOps<_AlgPolicy>::distance(__first, __middle);
+ difference_type __len2 = _IterOps<_AlgPolicy>::distance(__middle, __last);
+ difference_type __buf_size = std::min(__len1, __len2);
+ // TODO: Remove the use of std::get_temporary_buffer
+ _LIBCPP_SUPPRESS_DEPRECATED_PUSH
+ pair<value_type*, ptrdiff_t> __buf = std::get_temporary_buffer<value_type>(__buf_size);
+ _LIBCPP_SUPPRESS_DEPRECATED_POP
+ unique_ptr<value_type, __return_temporary_buffer> __h(__buf.first);
+ return std::__inplace_merge<_AlgPolicy>(
+ std::move(__first), std::move(__middle), std::move(__last), __comp, __len1, __len2, __buf.first, __buf.second);
}
template <class _BidirectionalIterator, class _Compare>
@@ -242,11 +228,9 @@ inline _LIBCPP_HIDE_FROM_ABI void inplace_merge(
}
template <class _BidirectionalIterator>
-inline _LIBCPP_HIDE_FROM_ABI
-void
-inplace_merge(_BidirectionalIterator __first, _BidirectionalIterator __middle, _BidirectionalIterator __last)
-{
- std::inplace_merge(std::move(__first), std::move(__middle), std::move(__last), __less<>());
+inline _LIBCPP_HIDE_FROM_ABI void
+inplace_merge(_BidirectionalIterator __first, _BidirectionalIterator __middle, _BidirectionalIterator __last) {
+ std::inplace_merge(std::move(__first), std::move(__middle), std::move(__last), __less<>());
}
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__algorithm/is_heap.h b/contrib/llvm-project/libcxx/include/__algorithm/is_heap.h
index dd78031579ec..0d2d43c2c3ab 100644
--- a/contrib/llvm-project/libcxx/include/__algorithm/is_heap.h
+++ b/contrib/llvm-project/libcxx/include/__algorithm/is_heap.h
@@ -22,21 +22,15 @@
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _RandomAccessIterator, class _Compare>
-_LIBCPP_NODISCARD_EXT inline
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-bool
-is_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp)
-{
- return std::__is_heap_until(__first, __last, static_cast<__comp_ref_type<_Compare> >(__comp)) == __last;
+_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool
+is_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp) {
+ return std::__is_heap_until(__first, __last, static_cast<__comp_ref_type<_Compare> >(__comp)) == __last;
}
-template<class _RandomAccessIterator>
-_LIBCPP_NODISCARD_EXT inline
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-bool
-is_heap(_RandomAccessIterator __first, _RandomAccessIterator __last)
-{
- return std::is_heap(__first, __last, __less<>());
+template <class _RandomAccessIterator>
+_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool
+is_heap(_RandomAccessIterator __first, _RandomAccessIterator __last) {
+ return std::is_heap(__first, __last, __less<>());
}
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__algorithm/is_heap_until.h b/contrib/llvm-project/libcxx/include/__algorithm/is_heap_until.h
index 85f70e649f56..1eae3b86b90d 100644
--- a/contrib/llvm-project/libcxx/include/__algorithm/is_heap_until.h
+++ b/contrib/llvm-project/libcxx/include/__algorithm/is_heap_until.h
@@ -22,43 +22,39 @@ _LIBCPP_BEGIN_NAMESPACE_STD
template <class _Compare, class _RandomAccessIterator>
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _RandomAccessIterator
-__is_heap_until(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare&& __comp)
-{
- typedef typename iterator_traits<_RandomAccessIterator>::difference_type difference_type;
- difference_type __len = __last - __first;
- difference_type __p = 0;
- difference_type __c = 1;
- _RandomAccessIterator __pp = __first;
- while (__c < __len)
- {
- _RandomAccessIterator __cp = __first + __c;
- if (__comp(*__pp, *__cp))
- return __cp;
- ++__c;
- ++__cp;
- if (__c == __len)
- return __last;
- if (__comp(*__pp, *__cp))
- return __cp;
- ++__p;
- ++__pp;
- __c = 2 * __p + 1;
- }
- return __last;
+__is_heap_until(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare&& __comp) {
+ typedef typename iterator_traits<_RandomAccessIterator>::difference_type difference_type;
+ difference_type __len = __last - __first;
+ difference_type __p = 0;
+ difference_type __c = 1;
+ _RandomAccessIterator __pp = __first;
+ while (__c < __len) {
+ _RandomAccessIterator __cp = __first + __c;
+ if (__comp(*__pp, *__cp))
+ return __cp;
+ ++__c;
+ ++__cp;
+ if (__c == __len)
+ return __last;
+ if (__comp(*__pp, *__cp))
+ return __cp;
+ ++__p;
+ ++__pp;
+ __c = 2 * __p + 1;
+ }
+ return __last;
}
template <class _RandomAccessIterator, class _Compare>
_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _RandomAccessIterator
-is_heap_until(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp)
-{
- return std::__is_heap_until(__first, __last, static_cast<__comp_ref_type<_Compare> >(__comp));
+is_heap_until(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp) {
+ return std::__is_heap_until(__first, __last, static_cast<__comp_ref_type<_Compare> >(__comp));
}
-template<class _RandomAccessIterator>
+template <class _RandomAccessIterator>
_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _RandomAccessIterator
-is_heap_until(_RandomAccessIterator __first, _RandomAccessIterator __last)
-{
- return std::__is_heap_until(__first, __last, __less<>());
+is_heap_until(_RandomAccessIterator __first, _RandomAccessIterator __last) {
+ return std::__is_heap_until(__first, __last, __less<>());
}
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__algorithm/is_partitioned.h b/contrib/llvm-project/libcxx/include/__algorithm/is_partitioned.h
index ab59d3cce582..71feed332060 100644
--- a/contrib/llvm-project/libcxx/include/__algorithm/is_partitioned.h
+++ b/contrib/llvm-project/libcxx/include/__algorithm/is_partitioned.h
@@ -19,18 +19,17 @@ _LIBCPP_BEGIN_NAMESPACE_STD
template <class _InputIterator, class _Predicate>
_LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool
-is_partitioned(_InputIterator __first, _InputIterator __last, _Predicate __pred)
-{
- for (; __first != __last; ++__first)
- if (!__pred(*__first))
- break;
- if ( __first == __last )
- return true;
- ++__first;
- for (; __first != __last; ++__first)
- if (__pred(*__first))
- return false;
+is_partitioned(_InputIterator __first, _InputIterator __last, _Predicate __pred) {
+ for (; __first != __last; ++__first)
+ if (!__pred(*__first))
+ break;
+ if (__first == __last)
return true;
+ ++__first;
+ for (; __first != __last; ++__first)
+ if (__pred(*__first))
+ return false;
+ return true;
}
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__algorithm/is_permutation.h b/contrib/llvm-project/libcxx/include/__algorithm/is_permutation.h
index 105a0732283c..4226151222bb 100644
--- a/contrib/llvm-project/libcxx/include/__algorithm/is_permutation.h
+++ b/contrib/llvm-project/libcxx/include/__algorithm/is_permutation.h
@@ -37,18 +37,24 @@ struct _ConstTimeDistance : false_type {};
#if _LIBCPP_STD_VER >= 20
template <class _Iter1, class _Sent1, class _Iter2, class _Sent2>
-struct _ConstTimeDistance<_Iter1, _Sent1, _Iter2, _Sent2, __enable_if_t<
- sized_sentinel_for<_Sent1, _Iter1> &&
- sized_sentinel_for<_Sent2, _Iter2>
->> : true_type {};
+struct _ConstTimeDistance<_Iter1,
+ _Sent1,
+ _Iter2,
+ _Sent2,
+ __enable_if_t< sized_sentinel_for<_Sent1, _Iter1> && sized_sentinel_for<_Sent2, _Iter2> >>
+ : true_type {};
#else
template <class _Iter1, class _Iter2>
-struct _ConstTimeDistance<_Iter1, _Iter1, _Iter2, _Iter2, __enable_if_t<
- is_same<typename iterator_traits<_Iter1>::iterator_category, random_access_iterator_tag>::value &&
- is_same<typename iterator_traits<_Iter2>::iterator_category, random_access_iterator_tag>::value
-> > : true_type {};
+struct _ConstTimeDistance<
+ _Iter1,
+ _Iter1,
+ _Iter2,
+ _Iter2,
+ __enable_if_t< is_same<typename iterator_traits<_Iter1>::iterator_category, random_access_iterator_tag>::value &&
+ is_same<typename iterator_traits<_Iter2>::iterator_category, random_access_iterator_tag>::value > >
+ : true_type {};
#endif // _LIBCPP_STD_VER >= 20
@@ -56,11 +62,21 @@ struct _ConstTimeDistance<_Iter1, _Iter1, _Iter2, _Iter2, __enable_if_t<
// For each element in [f1, l1) see if there are the same number of equal elements in [f2, l2)
template <class _AlgPolicy,
- class _Iter1, class _Sent1, class _Iter2, class _Sent2,
- class _Proj1, class _Proj2, class _Pred>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool
-__is_permutation_impl(_Iter1 __first1, _Sent1 __last1, _Iter2 __first2, _Sent2 __last2,
- _Pred&& __pred, _Proj1&& __proj1, _Proj2&& __proj2) {
+ class _Iter1,
+ class _Sent1,
+ class _Iter2,
+ class _Sent2,
+ class _Proj1,
+ class _Proj2,
+ class _Pred>
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool __is_permutation_impl(
+ _Iter1 __first1,
+ _Sent1 __last1,
+ _Iter2 __first2,
+ _Sent2 __last2,
+ _Pred&& __pred,
+ _Proj1&& __proj1,
+ _Proj2&& __proj2) {
using _D1 = __iter_diff_t<_Iter1>;
for (auto __i = __first1; __i != __last1; ++__i) {
@@ -97,9 +113,8 @@ __is_permutation_impl(_Iter1 __first1, _Sent1 __last1, _Iter2 __first2, _Sent2 _
// 2+1 iterators, predicate. Not used by range algorithms.
template <class _AlgPolicy, class _ForwardIterator1, class _Sentinel1, class _ForwardIterator2, class _BinaryPredicate>
-_LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool
-__is_permutation(_ForwardIterator1 __first1, _Sentinel1 __last1, _ForwardIterator2 __first2,
- _BinaryPredicate&& __pred) {
+_LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool __is_permutation(
+ _ForwardIterator1 __first1, _Sentinel1 __last1, _ForwardIterator2 __first2, _BinaryPredicate&& __pred) {
// Shorten sequences as much as possible by lopping of any equal prefix.
for (; __first1 != __last1; ++__first1, (void)++__first2) {
if (!__pred(*__first1, *__first2))
@@ -111,24 +126,39 @@ __is_permutation(_ForwardIterator1 __first1, _Sentinel1 __last1, _ForwardIterato
// __first1 != __last1 && *__first1 != *__first2
using _D1 = __iter_diff_t<_ForwardIterator1>;
- _D1 __l1 = _IterOps<_AlgPolicy>::distance(__first1, __last1);
+ _D1 __l1 = _IterOps<_AlgPolicy>::distance(__first1, __last1);
if (__l1 == _D1(1))
return false;
auto __last2 = _IterOps<_AlgPolicy>::next(__first2, __l1);
return std::__is_permutation_impl<_AlgPolicy>(
- std::move(__first1), std::move(__last1), std::move(__first2), std::move(__last2),
- __pred, __identity(), __identity());
+ std::move(__first1),
+ std::move(__last1),
+ std::move(__first2),
+ std::move(__last2),
+ __pred,
+ __identity(),
+ __identity());
}
// 2+2 iterators, predicate, non-constant time `distance`.
template <class _AlgPolicy,
- class _Iter1, class _Sent1, class _Iter2, class _Sent2,
- class _Proj1, class _Proj2, class _Pred>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool
-__is_permutation(_Iter1 __first1, _Sent1 __last1, _Iter2 __first2, _Sent2 __last2,
- _Pred&& __pred, _Proj1&& __proj1, _Proj2&& __proj2,
- /*_ConstTimeDistance=*/false_type) {
+ class _Iter1,
+ class _Sent1,
+ class _Iter2,
+ class _Sent2,
+ class _Proj1,
+ class _Proj2,
+ class _Pred>
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool __is_permutation(
+ _Iter1 __first1,
+ _Sent1 __last1,
+ _Iter2 __first2,
+ _Sent2 __last2,
+ _Pred&& __pred,
+ _Proj1&& __proj1,
+ _Proj2&& __proj2,
+ /*_ConstTimeDistance=*/false_type) {
// Shorten sequences as much as possible by lopping of any equal prefix.
while (__first1 != __last1 && __first2 != __last2) {
if (!std::__invoke(__pred, std::__invoke(__proj1, *__first1), std::__invoke(__proj2, *__first2)))
@@ -143,44 +173,73 @@ __is_permutation(_Iter1 __first1, _Sent1 __last1, _Iter2 __first2, _Sent2 __last
return false;
using _D1 = __iter_diff_t<_Iter1>;
- _D1 __l1 = _IterOps<_AlgPolicy>::distance(__first1, __last1);
+ _D1 __l1 = _IterOps<_AlgPolicy>::distance(__first1, __last1);
using _D2 = __iter_diff_t<_Iter2>;
- _D2 __l2 = _IterOps<_AlgPolicy>::distance(__first2, __last2);
+ _D2 __l2 = _IterOps<_AlgPolicy>::distance(__first2, __last2);
if (__l1 != __l2)
return false;
return std::__is_permutation_impl<_AlgPolicy>(
- std::move(__first1), std::move(__last1), std::move(__first2), std::move(__last2),
- __pred, __proj1, __proj2);
+ std::move(__first1), std::move(__last1), std::move(__first2), std::move(__last2), __pred, __proj1, __proj2);
}
// 2+2 iterators, predicate, specialization for constant-time `distance` call.
template <class _AlgPolicy,
- class _Iter1, class _Sent1, class _Iter2, class _Sent2,
- class _Proj1, class _Proj2, class _Pred>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool
-__is_permutation(_Iter1 __first1, _Sent1 __last1, _Iter2 __first2, _Sent2 __last2,
- _Pred&& __pred, _Proj1&& __proj1, _Proj2&& __proj2,
- /*_ConstTimeDistance=*/true_type) {
+ class _Iter1,
+ class _Sent1,
+ class _Iter2,
+ class _Sent2,
+ class _Proj1,
+ class _Proj2,
+ class _Pred>
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool __is_permutation(
+ _Iter1 __first1,
+ _Sent1 __last1,
+ _Iter2 __first2,
+ _Sent2 __last2,
+ _Pred&& __pred,
+ _Proj1&& __proj1,
+ _Proj2&& __proj2,
+ /*_ConstTimeDistance=*/true_type) {
if (std::distance(__first1, __last1) != std::distance(__first2, __last2))
return false;
return std::__is_permutation<_AlgPolicy>(
- std::move(__first1), std::move(__last1), std::move(__first2), std::move(__last2),
- __pred, __proj1, __proj2,
+ std::move(__first1),
+ std::move(__last1),
+ std::move(__first2),
+ std::move(__last2),
+ __pred,
+ __proj1,
+ __proj2,
/*_ConstTimeDistance=*/false_type());
}
// 2+2 iterators, predicate
template <class _AlgPolicy,
- class _Iter1, class _Sent1, class _Iter2, class _Sent2,
- class _Proj1, class _Proj2, class _Pred>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool
-__is_permutation(_Iter1 __first1, _Sent1 __last1, _Iter2 __first2, _Sent2 __last2,
- _Pred&& __pred, _Proj1&& __proj1, _Proj2&& __proj2) {
+ class _Iter1,
+ class _Sent1,
+ class _Iter2,
+ class _Sent2,
+ class _Proj1,
+ class _Proj2,
+ class _Pred>
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool __is_permutation(
+ _Iter1 __first1,
+ _Sent1 __last1,
+ _Iter2 __first2,
+ _Sent2 __last2,
+ _Pred&& __pred,
+ _Proj1&& __proj1,
+ _Proj2&& __proj2) {
return std::__is_permutation<_AlgPolicy>(
- std::move(__first1), std::move(__last1), std::move(__first2), std::move(__last2),
- __pred, __proj1, __proj2,
+ std::move(__first1),
+ std::move(__last1),
+ std::move(__first2),
+ std::move(__last2),
+ __pred,
+ __proj1,
+ __proj2,
_ConstTimeDistance<_Iter1, _Sent1, _Iter2, _Sent2>());
}
@@ -188,14 +247,12 @@ __is_permutation(_Iter1 __first1, _Sent1 __last1, _Iter2 __first2, _Sent2 __last
// 2+1 iterators, predicate
template <class _ForwardIterator1, class _ForwardIterator2, class _BinaryPredicate>
-_LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool
-is_permutation(_ForwardIterator1 __first1, _ForwardIterator1 __last1, _ForwardIterator2 __first2,
- _BinaryPredicate __pred) {
+_LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool is_permutation(
+ _ForwardIterator1 __first1, _ForwardIterator1 __last1, _ForwardIterator2 __first2, _BinaryPredicate __pred) {
static_assert(__is_callable<_BinaryPredicate, decltype(*__first1), decltype(*__first2)>::value,
- "The predicate has to be callable");
+ "The predicate has to be callable");
- return std::__is_permutation<_ClassicAlgPolicy>(
- std::move(__first1), std::move(__last1), std::move(__first2), __pred);
+ return std::__is_permutation<_ClassicAlgPolicy>(std::move(__first1), std::move(__last1), std::move(__first2), __pred);
}
// 2+1 iterators
@@ -223,15 +280,23 @@ _LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
// 2+2 iterators, predicate
template <class _ForwardIterator1, class _ForwardIterator2, class _BinaryPredicate>
-_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool
-is_permutation(_ForwardIterator1 __first1, _ForwardIterator1 __last1, _ForwardIterator2 __first2,
- _ForwardIterator2 __last2, _BinaryPredicate __pred) {
+_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool is_permutation(
+ _ForwardIterator1 __first1,
+ _ForwardIterator1 __last1,
+ _ForwardIterator2 __first2,
+ _ForwardIterator2 __last2,
+ _BinaryPredicate __pred) {
static_assert(__is_callable<_BinaryPredicate, decltype(*__first1), decltype(*__first2)>::value,
- "The predicate has to be callable");
+ "The predicate has to be callable");
return std::__is_permutation<_ClassicAlgPolicy>(
- std::move(__first1), std::move(__last1), std::move(__first2), std::move(__last2),
- __pred, __identity(), __identity());
+ std::move(__first1),
+ std::move(__last1),
+ std::move(__first2),
+ std::move(__last2),
+ __pred,
+ __identity(),
+ __identity());
}
#endif // _LIBCPP_STD_VER >= 14
diff --git a/contrib/llvm-project/libcxx/include/__algorithm/is_sorted.h b/contrib/llvm-project/libcxx/include/__algorithm/is_sorted.h
index 0003097b362c..1874cace882c 100644
--- a/contrib/llvm-project/libcxx/include/__algorithm/is_sorted.h
+++ b/contrib/llvm-project/libcxx/include/__algorithm/is_sorted.h
@@ -22,21 +22,15 @@
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _ForwardIterator, class _Compare>
-_LIBCPP_NODISCARD_EXT inline
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-bool
-is_sorted(_ForwardIterator __first, _ForwardIterator __last, _Compare __comp)
-{
- return std::__is_sorted_until<__comp_ref_type<_Compare> >(__first, __last, __comp) == __last;
+_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool
+is_sorted(_ForwardIterator __first, _ForwardIterator __last, _Compare __comp) {
+ return std::__is_sorted_until<__comp_ref_type<_Compare> >(__first, __last, __comp) == __last;
}
-template<class _ForwardIterator>
-_LIBCPP_NODISCARD_EXT inline
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-bool
-is_sorted(_ForwardIterator __first, _ForwardIterator __last)
-{
- return std::is_sorted(__first, __last, __less<>());
+template <class _ForwardIterator>
+_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool
+is_sorted(_ForwardIterator __first, _ForwardIterator __last) {
+ return std::is_sorted(__first, __last, __less<>());
}
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__algorithm/is_sorted_until.h b/contrib/llvm-project/libcxx/include/__algorithm/is_sorted_until.h
index aeb3f1c8be98..7450440df2d8 100644
--- a/contrib/llvm-project/libcxx/include/__algorithm/is_sorted_until.h
+++ b/contrib/llvm-project/libcxx/include/__algorithm/is_sorted_until.h
@@ -22,33 +22,28 @@ _LIBCPP_BEGIN_NAMESPACE_STD
template <class _Compare, class _ForwardIterator>
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _ForwardIterator
-__is_sorted_until(_ForwardIterator __first, _ForwardIterator __last, _Compare __comp)
-{
- if (__first != __last)
- {
- _ForwardIterator __i = __first;
- while (++__i != __last)
- {
- if (__comp(*__i, *__first))
- return __i;
- __first = __i;
- }
+__is_sorted_until(_ForwardIterator __first, _ForwardIterator __last, _Compare __comp) {
+ if (__first != __last) {
+ _ForwardIterator __i = __first;
+ while (++__i != __last) {
+ if (__comp(*__i, *__first))
+ return __i;
+ __first = __i;
}
- return __last;
+ }
+ return __last;
}
template <class _ForwardIterator, class _Compare>
_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _ForwardIterator
-is_sorted_until(_ForwardIterator __first, _ForwardIterator __last, _Compare __comp)
-{
- return std::__is_sorted_until<__comp_ref_type<_Compare> >(__first, __last, __comp);
+is_sorted_until(_ForwardIterator __first, _ForwardIterator __last, _Compare __comp) {
+ return std::__is_sorted_until<__comp_ref_type<_Compare> >(__first, __last, __comp);
}
-template<class _ForwardIterator>
+template <class _ForwardIterator>
_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _ForwardIterator
-is_sorted_until(_ForwardIterator __first, _ForwardIterator __last)
-{
- return std::is_sorted_until(__first, __last, __less<>());
+is_sorted_until(_ForwardIterator __first, _ForwardIterator __last) {
+ return std::is_sorted_until(__first, __last, __less<>());
}
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__algorithm/iter_swap.h b/contrib/llvm-project/libcxx/include/__algorithm/iter_swap.h
index f647e7432467..a1412e5d8720 100644
--- a/contrib/llvm-project/libcxx/include/__algorithm/iter_swap.h
+++ b/contrib/llvm-project/libcxx/include/__algorithm/iter_swap.h
@@ -20,8 +20,7 @@
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _ForwardIterator1, class _ForwardIterator2>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void iter_swap(_ForwardIterator1 __a,
- _ForwardIterator2 __b)
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void iter_swap(_ForwardIterator1 __a, _ForwardIterator2 __b)
// _NOEXCEPT_(_NOEXCEPT_(swap(*__a, *__b)))
_NOEXCEPT_(_NOEXCEPT_(swap(*std::declval<_ForwardIterator1>(), *std::declval<_ForwardIterator2>()))) {
swap(*__a, *__b);
diff --git a/contrib/llvm-project/libcxx/include/__algorithm/iterator_operations.h b/contrib/llvm-project/libcxx/include/__algorithm/iterator_operations.h
index e6176da4f560..5cf13f0a3f29 100644
--- a/contrib/llvm-project/libcxx/include/__algorithm/iterator_operations.h
+++ b/contrib/llvm-project/libcxx/include/__algorithm/iterator_operations.h
@@ -38,14 +38,14 @@ _LIBCPP_PUSH_MACROS
_LIBCPP_BEGIN_NAMESPACE_STD
-template <class _AlgPolicy> struct _IterOps;
+template <class _AlgPolicy>
+struct _IterOps;
#if _LIBCPP_STD_VER >= 20
struct _RangeAlgPolicy {};
template <>
struct _IterOps<_RangeAlgPolicy> {
-
template <class _Iter>
using __value_type = iter_value_t<_Iter>;
@@ -55,12 +55,12 @@ struct _IterOps<_RangeAlgPolicy> {
template <class _Iter>
using __difference_type = iter_difference_t<_Iter>;
- static constexpr auto advance = ranges::advance;
- static constexpr auto distance = ranges::distance;
- static constexpr auto __iter_move = ranges::iter_move;
- static constexpr auto iter_swap = ranges::iter_swap;
- static constexpr auto next = ranges::next;
- static constexpr auto prev = ranges::prev;
+ static constexpr auto advance = ranges::advance;
+ static constexpr auto distance = ranges::distance;
+ static constexpr auto __iter_move = ranges::iter_move;
+ static constexpr auto iter_swap = ranges::iter_swap;
+ static constexpr auto next = ranges::next;
+ static constexpr auto prev = ranges::prev;
static constexpr auto __advance_to = ranges::advance;
};
@@ -70,7 +70,6 @@ struct _ClassicAlgPolicy {};
template <>
struct _IterOps<_ClassicAlgPolicy> {
-
template <class _Iter>
using __value_type = typename iterator_traits<_Iter>::value_type;
@@ -82,15 +81,14 @@ struct _IterOps<_ClassicAlgPolicy> {
// advance
template <class _Iter, class _Distance>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
- static void advance(_Iter& __iter, _Distance __count) {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 static void advance(_Iter& __iter, _Distance __count) {
std::advance(__iter, __count);
}
// distance
template <class _Iter>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
- static typename iterator_traits<_Iter>::difference_type distance(_Iter __first, _Iter __last) {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 static typename iterator_traits<_Iter>::difference_type
+ distance(_Iter __first, _Iter __last) {
return std::distance(__first, __last);
}
@@ -101,9 +99,9 @@ struct _IterOps<_ClassicAlgPolicy> {
using __move_t = decltype(std::move(*std::declval<_Iter&>()));
template <class _Iter>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
- static void __validate_iter_reference() {
- static_assert(is_same<__deref_t<_Iter>, typename iterator_traits<__remove_cvref_t<_Iter> >::reference>::value,
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 static void __validate_iter_reference() {
+ static_assert(
+ is_same<__deref_t<_Iter>, typename iterator_traits<__remove_cvref_t<_Iter> >::reference>::value,
"It looks like your iterator's `iterator_traits<It>::reference` does not match the return type of "
"dereferencing the iterator, i.e., calling `*it`. This is undefined behavior according to [input.iterators] "
"and can lead to dangling reference issues at runtime, so we are flagging this.");
@@ -112,10 +110,10 @@ struct _IterOps<_ClassicAlgPolicy> {
// iter_move
template <class _Iter, __enable_if_t<is_reference<__deref_t<_Iter> >::value, int> = 0>
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 static
- // If the result of dereferencing `_Iter` is a reference type, deduce the result of calling `std::move` on it. Note
- // that the C++03 mode doesn't support `decltype(auto)` as the return type.
- __move_t<_Iter>
- __iter_move(_Iter&& __i) {
+ // If the result of dereferencing `_Iter` is a reference type, deduce the result of calling `std::move` on it.
+ // Note that the C++03 mode doesn't support `decltype(auto)` as the return type.
+ __move_t<_Iter>
+ __iter_move(_Iter&& __i) {
__validate_iter_reference<_Iter>();
return std::move(*std::forward<_Iter>(__i));
@@ -123,11 +121,11 @@ struct _IterOps<_ClassicAlgPolicy> {
template <class _Iter, __enable_if_t<!is_reference<__deref_t<_Iter> >::value, int> = 0>
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 static
- // If the result of dereferencing `_Iter` is a value type, deduce the return value of this function to also be a
- // value -- otherwise, after `operator*` returns a temporary, this function would return a dangling reference to that
- // temporary. Note that the C++03 mode doesn't support `auto` as the return type.
- __deref_t<_Iter>
- __iter_move(_Iter&& __i) {
+ // If the result of dereferencing `_Iter` is a value type, deduce the return value of this function to also be a
+ // value -- otherwise, after `operator*` returns a temporary, this function would return a dangling reference to
+ // that temporary. Note that the C++03 mode doesn't support `auto` as the return type.
+ __deref_t<_Iter>
+ __iter_move(_Iter&& __i) {
__validate_iter_reference<_Iter>();
return *std::forward<_Iter>(__i);
@@ -135,36 +133,31 @@ struct _IterOps<_ClassicAlgPolicy> {
// iter_swap
template <class _Iter1, class _Iter2>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
- static void iter_swap(_Iter1&& __a, _Iter2&& __b) {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 static void iter_swap(_Iter1&& __a, _Iter2&& __b) {
std::iter_swap(std::forward<_Iter1>(__a), std::forward<_Iter2>(__b));
}
// next
template <class _Iterator>
- _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR_SINCE_CXX14
- _Iterator next(_Iterator, _Iterator __last) {
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR_SINCE_CXX14 _Iterator next(_Iterator, _Iterator __last) {
return __last;
}
template <class _Iter>
- _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR_SINCE_CXX14
- __remove_cvref_t<_Iter> next(_Iter&& __it,
- typename iterator_traits<__remove_cvref_t<_Iter> >::difference_type __n = 1) {
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR_SINCE_CXX14 __remove_cvref_t<_Iter>
+ next(_Iter&& __it, typename iterator_traits<__remove_cvref_t<_Iter> >::difference_type __n = 1) {
return std::next(std::forward<_Iter>(__it), __n);
}
// prev
template <class _Iter>
- _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR_SINCE_CXX14
- __remove_cvref_t<_Iter> prev(_Iter&& __iter,
- typename iterator_traits<__remove_cvref_t<_Iter> >::difference_type __n = 1) {
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR_SINCE_CXX14 __remove_cvref_t<_Iter>
+ prev(_Iter&& __iter, typename iterator_traits<__remove_cvref_t<_Iter> >::difference_type __n = 1) {
return std::prev(std::forward<_Iter>(__iter), __n);
}
template <class _Iter>
- _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR_SINCE_CXX14
- void __advance_to(_Iter& __first, _Iter __last) {
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR_SINCE_CXX14 void __advance_to(_Iter& __first, _Iter __last) {
__first = __last;
}
};
diff --git a/contrib/llvm-project/libcxx/include/__algorithm/lexicographical_compare.h b/contrib/llvm-project/libcxx/include/__algorithm/lexicographical_compare.h
index 1ee189a25902..3efd8e24bf6c 100644
--- a/contrib/llvm-project/libcxx/include/__algorithm/lexicographical_compare.h
+++ b/contrib/llvm-project/libcxx/include/__algorithm/lexicographical_compare.h
@@ -21,38 +21,35 @@
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _Compare, class _InputIterator1, class _InputIterator2>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool
-__lexicographical_compare(_InputIterator1 __first1, _InputIterator1 __last1,
- _InputIterator2 __first2, _InputIterator2 __last2, _Compare __comp)
-{
- for (; __first2 != __last2; ++__first1, (void) ++__first2)
- {
- if (__first1 == __last1 || __comp(*__first1, *__first2))
- return true;
- if (__comp(*__first2, *__first1))
- return false;
- }
- return false;
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool __lexicographical_compare(
+ _InputIterator1 __first1,
+ _InputIterator1 __last1,
+ _InputIterator2 __first2,
+ _InputIterator2 __last2,
+ _Compare __comp) {
+ for (; __first2 != __last2; ++__first1, (void)++__first2) {
+ if (__first1 == __last1 || __comp(*__first1, *__first2))
+ return true;
+ if (__comp(*__first2, *__first1))
+ return false;
+ }
+ return false;
}
template <class _InputIterator1, class _InputIterator2, class _Compare>
-_LIBCPP_NODISCARD_EXT inline
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-bool
-lexicographical_compare(_InputIterator1 __first1, _InputIterator1 __last1,
- _InputIterator2 __first2, _InputIterator2 __last2, _Compare __comp)
-{
- return std::__lexicographical_compare<__comp_ref_type<_Compare> >(__first1, __last1, __first2, __last2, __comp);
+_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool lexicographical_compare(
+ _InputIterator1 __first1,
+ _InputIterator1 __last1,
+ _InputIterator2 __first2,
+ _InputIterator2 __last2,
+ _Compare __comp) {
+ return std::__lexicographical_compare<__comp_ref_type<_Compare> >(__first1, __last1, __first2, __last2, __comp);
}
template <class _InputIterator1, class _InputIterator2>
-_LIBCPP_NODISCARD_EXT inline
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-bool
-lexicographical_compare(_InputIterator1 __first1, _InputIterator1 __last1,
- _InputIterator2 __first2, _InputIterator2 __last2)
-{
- return std::lexicographical_compare(__first1, __last1, __first2, __last2, __less<>());
+_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool lexicographical_compare(
+ _InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2, _InputIterator2 __last2) {
+ return std::lexicographical_compare(__first1, __last1, __first2, __last2, __less<>());
}
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__algorithm/lower_bound.h b/contrib/llvm-project/libcxx/include/__algorithm/lower_bound.h
index 91c3bdaafd0c..8f57f3592c4b 100644
--- a/contrib/llvm-project/libcxx/include/__algorithm/lower_bound.h
+++ b/contrib/llvm-project/libcxx/include/__algorithm/lower_bound.h
@@ -28,8 +28,8 @@
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _AlgPolicy, class _Iter, class _Sent, class _Type, class _Proj, class _Comp>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-_Iter __lower_bound(_Iter __first, _Sent __last, const _Type& __value, _Comp& __comp, _Proj& __proj) {
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _Iter
+__lower_bound(_Iter __first, _Sent __last, const _Type& __value, _Comp& __comp, _Proj& __proj) {
auto __len = _IterOps<_AlgPolicy>::distance(__first, __last);
while (__len != 0) {
@@ -47,17 +47,16 @@ _Iter __lower_bound(_Iter __first, _Sent __last, const _Type& __value, _Comp& __
}
template <class _ForwardIterator, class _Tp, class _Compare>
-_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-_ForwardIterator lower_bound(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value, _Compare __comp) {
- static_assert(__is_callable<_Compare, decltype(*__first), const _Tp&>::value,
- "The comparator has to be callable");
+_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _ForwardIterator
+lower_bound(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value, _Compare __comp) {
+ static_assert(__is_callable<_Compare, decltype(*__first), const _Tp&>::value, "The comparator has to be callable");
auto __proj = std::__identity();
return std::__lower_bound<_ClassicAlgPolicy>(__first, __last, __value, __comp, __proj);
}
template <class _ForwardIterator, class _Tp>
-_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-_ForwardIterator lower_bound(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value) {
+_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _ForwardIterator
+lower_bound(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value) {
return std::lower_bound(__first, __last, __value, __less<>());
}
diff --git a/contrib/llvm-project/libcxx/include/__algorithm/make_heap.h b/contrib/llvm-project/libcxx/include/__algorithm/make_heap.h
index eaf9259c0b31..e8f0cdb27333 100644
--- a/contrib/llvm-project/libcxx/include/__algorithm/make_heap.h
+++ b/contrib/llvm-project/libcxx/include/__algorithm/make_heap.h
@@ -27,29 +27,29 @@ _LIBCPP_PUSH_MACROS
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _AlgPolicy, class _Compare, class _RandomAccessIterator>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
-void __make_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare&& __comp) {
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 void
+__make_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare&& __comp) {
__comp_ref_type<_Compare> __comp_ref = __comp;
using difference_type = typename iterator_traits<_RandomAccessIterator>::difference_type;
- difference_type __n = __last - __first;
+ difference_type __n = __last - __first;
if (__n > 1) {
// start from the first parent, there is no need to consider children
for (difference_type __start = (__n - 2) / 2; __start >= 0; --__start) {
- std::__sift_down<_AlgPolicy>(__first, __comp_ref, __n, __first + __start);
+ std::__sift_down<_AlgPolicy>(__first, __comp_ref, __n, __first + __start);
}
}
}
template <class _RandomAccessIterator, class _Compare>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-void make_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp) {
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void
+make_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp) {
std::__make_heap<_ClassicAlgPolicy>(std::move(__first), std::move(__last), __comp);
}
template <class _RandomAccessIterator>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-void make_heap(_RandomAccessIterator __first, _RandomAccessIterator __last) {
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void
+make_heap(_RandomAccessIterator __first, _RandomAccessIterator __last) {
std::make_heap(std::move(__first), std::move(__last), __less<>());
}
diff --git a/contrib/llvm-project/libcxx/include/__algorithm/make_projected.h b/contrib/llvm-project/libcxx/include/__algorithm/make_projected.h
index 3a8670111814..bb7bc7e8c0b5 100644
--- a/contrib/llvm-project/libcxx/include/__algorithm/make_projected.h
+++ b/contrib/llvm-project/libcxx/include/__algorithm/make_projected.h
@@ -36,44 +36,38 @@ struct _ProjectedPred {
: __pred(__pred_arg), __proj(__proj_arg) {}
template <class _Tp>
- typename __invoke_of<_Pred&,
- decltype(std::__invoke(std::declval<_Proj&>(), std::declval<_Tp>()))
- >::type
- _LIBCPP_CONSTEXPR _LIBCPP_HIDE_FROM_ABI operator()(_Tp&& __v) const {
+ typename __invoke_of<_Pred&, decltype(std::__invoke(std::declval<_Proj&>(), std::declval<_Tp>())) >::
+ type _LIBCPP_CONSTEXPR _LIBCPP_HIDE_FROM_ABI
+ operator()(_Tp&& __v) const {
return std::__invoke(__pred, std::__invoke(__proj, std::forward<_Tp>(__v)));
}
template <class _T1, class _T2>
typename __invoke_of<_Pred&,
decltype(std::__invoke(std::declval<_Proj&>(), std::declval<_T1>())),
- decltype(std::__invoke(std::declval<_Proj&>(), std::declval<_T2>()))
- >::type
- _LIBCPP_CONSTEXPR _LIBCPP_HIDE_FROM_ABI operator()(_T1&& __lhs, _T2&& __rhs) const {
- return std::__invoke(__pred,
- std::__invoke(__proj, std::forward<_T1>(__lhs)),
- std::__invoke(__proj, std::forward<_T2>(__rhs)));
+ decltype(std::__invoke(std::declval<_Proj&>(),
+ std::declval<_T2>())) >::type _LIBCPP_CONSTEXPR _LIBCPP_HIDE_FROM_ABI
+ operator()(_T1&& __lhs, _T2&& __rhs) const {
+ return std::__invoke(
+ __pred, std::__invoke(__proj, std::forward<_T1>(__lhs)), std::__invoke(__proj, std::forward<_T2>(__rhs)));
}
-
};
-template <class _Pred,
- class _Proj,
- __enable_if_t<!(!is_member_pointer<__decay_t<_Pred> >::value &&
- __is_identity<__decay_t<_Proj> >::value),
- int> = 0>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR _ProjectedPred<_Pred, _Proj>
-__make_projected(_Pred& __pred, _Proj& __proj) {
+template <
+ class _Pred,
+ class _Proj,
+ __enable_if_t<!(!is_member_pointer<__decay_t<_Pred> >::value && __is_identity<__decay_t<_Proj> >::value), int> = 0>
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR _ProjectedPred<_Pred, _Proj> __make_projected(_Pred& __pred, _Proj& __proj) {
return _ProjectedPred<_Pred, _Proj>(__pred, __proj);
}
// Avoid creating the functor and just use the pristine comparator -- for certain algorithms, this would enable
// optimizations that rely on the type of the comparator. Additionally, this results in less layers of indirection in
// the call stack when the comparator is invoked, even in an unoptimized build.
-template <class _Pred,
- class _Proj,
- __enable_if_t<!is_member_pointer<__decay_t<_Pred> >::value &&
- __is_identity<__decay_t<_Proj> >::value,
- int> = 0>
+template <
+ class _Pred,
+ class _Proj,
+ __enable_if_t<!is_member_pointer<__decay_t<_Pred> >::value && __is_identity<__decay_t<_Proj> >::value, int> = 0>
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR _Pred& __make_projected(_Pred& __pred, _Proj&) {
return __pred;
}
@@ -87,8 +81,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
namespace ranges {
template <class _Comp, class _Proj1, class _Proj2>
-_LIBCPP_HIDE_FROM_ABI constexpr
-decltype(auto) __make_projected_comp(_Comp& __comp, _Proj1& __proj1, _Proj2& __proj2) {
+_LIBCPP_HIDE_FROM_ABI constexpr decltype(auto) __make_projected_comp(_Comp& __comp, _Proj1& __proj1, _Proj2& __proj2) {
if constexpr (__is_identity<decay_t<_Proj1>>::value && __is_identity<decay_t<_Proj2>>::value &&
!is_member_pointer_v<decay_t<_Comp>>) {
// Avoid creating the lambda and just use the pristine comparator -- for certain algorithms, this would enable
@@ -98,8 +91,8 @@ decltype(auto) __make_projected_comp(_Comp& __comp, _Proj1& __proj1, _Proj2& __p
} else {
return [&](auto&& __lhs, auto&& __rhs) -> bool {
return std::invoke(__comp,
- std::invoke(__proj1, std::forward<decltype(__lhs)>(__lhs)),
- std::invoke(__proj2, std::forward<decltype(__rhs)>(__rhs)));
+ std::invoke(__proj1, std::forward<decltype(__lhs)>(__lhs)),
+ std::invoke(__proj2, std::forward<decltype(__rhs)>(__rhs)));
};
}
}
diff --git a/contrib/llvm-project/libcxx/include/__algorithm/max.h b/contrib/llvm-project/libcxx/include/__algorithm/max.h
index 183a4e9cac06..8171677f155c 100644
--- a/contrib/llvm-project/libcxx/include/__algorithm/max.h
+++ b/contrib/llvm-project/libcxx/include/__algorithm/max.h
@@ -25,41 +25,28 @@ _LIBCPP_PUSH_MACROS
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _Tp, class _Compare>
-_LIBCPP_NODISCARD_EXT inline
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
-const _Tp&
-max(_LIBCPP_LIFETIMEBOUND const _Tp& __a, _LIBCPP_LIFETIMEBOUND const _Tp& __b, _Compare __comp)
-{
- return __comp(__a, __b) ? __b : __a;
+_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 const _Tp&
+max(_LIBCPP_LIFETIMEBOUND const _Tp& __a, _LIBCPP_LIFETIMEBOUND const _Tp& __b, _Compare __comp) {
+ return __comp(__a, __b) ? __b : __a;
}
template <class _Tp>
-_LIBCPP_NODISCARD_EXT inline
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
-const _Tp&
-max(_LIBCPP_LIFETIMEBOUND const _Tp& __a, _LIBCPP_LIFETIMEBOUND const _Tp& __b)
-{
- return std::max(__a, __b, __less<>());
+_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 const _Tp&
+max(_LIBCPP_LIFETIMEBOUND const _Tp& __a, _LIBCPP_LIFETIMEBOUND const _Tp& __b) {
+ return std::max(__a, __b, __less<>());
}
#ifndef _LIBCPP_CXX03_LANG
-template<class _Tp, class _Compare>
-_LIBCPP_NODISCARD_EXT inline
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
-_Tp
-max(initializer_list<_Tp> __t, _Compare __comp)
-{
- return *std::__max_element<__comp_ref_type<_Compare> >(__t.begin(), __t.end(), __comp);
+template <class _Tp, class _Compare>
+_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _Tp
+max(initializer_list<_Tp> __t, _Compare __comp) {
+ return *std::__max_element<__comp_ref_type<_Compare> >(__t.begin(), __t.end(), __comp);
}
-template<class _Tp>
-_LIBCPP_NODISCARD_EXT inline
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
-_Tp
-max(initializer_list<_Tp> __t)
-{
- return *std::max_element(__t.begin(), __t.end(), __less<>());
+template <class _Tp>
+_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _Tp max(initializer_list<_Tp> __t) {
+ return *std::max_element(__t.begin(), __t.end(), __less<>());
}
#endif // _LIBCPP_CXX03_LANG
diff --git a/contrib/llvm-project/libcxx/include/__algorithm/max_element.h b/contrib/llvm-project/libcxx/include/__algorithm/max_element.h
index a2dc9707c00b..f1d4f1cd0938 100644
--- a/contrib/llvm-project/libcxx/include/__algorithm/max_element.h
+++ b/contrib/llvm-project/libcxx/include/__algorithm/max_element.h
@@ -22,33 +22,28 @@ _LIBCPP_BEGIN_NAMESPACE_STD
template <class _Compare, class _ForwardIterator>
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _ForwardIterator
-__max_element(_ForwardIterator __first, _ForwardIterator __last, _Compare __comp)
-{
- static_assert(__has_forward_iterator_category<_ForwardIterator>::value,
- "std::max_element requires a ForwardIterator");
- if (__first != __last)
- {
- _ForwardIterator __i = __first;
- while (++__i != __last)
- if (__comp(*__first, *__i))
- __first = __i;
- }
- return __first;
+__max_element(_ForwardIterator __first, _ForwardIterator __last, _Compare __comp) {
+ static_assert(
+ __has_forward_iterator_category<_ForwardIterator>::value, "std::max_element requires a ForwardIterator");
+ if (__first != __last) {
+ _ForwardIterator __i = __first;
+ while (++__i != __last)
+ if (__comp(*__first, *__i))
+ __first = __i;
+ }
+ return __first;
}
template <class _ForwardIterator, class _Compare>
_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _ForwardIterator
-max_element(_ForwardIterator __first, _ForwardIterator __last, _Compare __comp)
-{
- return std::__max_element<__comp_ref_type<_Compare> >(__first, __last, __comp);
+max_element(_ForwardIterator __first, _ForwardIterator __last, _Compare __comp) {
+ return std::__max_element<__comp_ref_type<_Compare> >(__first, __last, __comp);
}
-
template <class _ForwardIterator>
_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _ForwardIterator
-max_element(_ForwardIterator __first, _ForwardIterator __last)
-{
- return std::max_element(__first, __last, __less<>());
+max_element(_ForwardIterator __first, _ForwardIterator __last) {
+ return std::max_element(__first, __last, __less<>());
}
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__algorithm/merge.h b/contrib/llvm-project/libcxx/include/__algorithm/merge.h
index 8a6021f1880b..bad663c4b9f1 100644
--- a/contrib/llvm-project/libcxx/include/__algorithm/merge.h
+++ b/contrib/llvm-project/libcxx/include/__algorithm/merge.h
@@ -22,45 +22,46 @@
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _Compare, class _InputIterator1, class _InputIterator2, class _OutputIterator>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-_OutputIterator
-__merge(_InputIterator1 __first1, _InputIterator1 __last1,
- _InputIterator2 __first2, _InputIterator2 __last2, _OutputIterator __result, _Compare __comp)
-{
- for (; __first1 != __last1; ++__result)
- {
- if (__first2 == __last2)
- return std::copy(__first1, __last1, __result);
- if (__comp(*__first2, *__first1))
- {
- *__result = *__first2;
- ++__first2;
- }
- else
- {
- *__result = *__first1;
- ++__first1;
- }
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _OutputIterator __merge(
+ _InputIterator1 __first1,
+ _InputIterator1 __last1,
+ _InputIterator2 __first2,
+ _InputIterator2 __last2,
+ _OutputIterator __result,
+ _Compare __comp) {
+ for (; __first1 != __last1; ++__result) {
+ if (__first2 == __last2)
+ return std::copy(__first1, __last1, __result);
+ if (__comp(*__first2, *__first1)) {
+ *__result = *__first2;
+ ++__first2;
+ } else {
+ *__result = *__first1;
+ ++__first1;
}
- return std::copy(__first2, __last2, __result);
+ }
+ return std::copy(__first2, __last2, __result);
}
template <class _InputIterator1, class _InputIterator2, class _OutputIterator, class _Compare>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-_OutputIterator
-merge(_InputIterator1 __first1, _InputIterator1 __last1,
- _InputIterator2 __first2, _InputIterator2 __last2, _OutputIterator __result, _Compare __comp)
-{
- return std::__merge<__comp_ref_type<_Compare> >(__first1, __last1, __first2, __last2, __result, __comp);
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _OutputIterator
+merge(_InputIterator1 __first1,
+ _InputIterator1 __last1,
+ _InputIterator2 __first2,
+ _InputIterator2 __last2,
+ _OutputIterator __result,
+ _Compare __comp) {
+ return std::__merge<__comp_ref_type<_Compare> >(__first1, __last1, __first2, __last2, __result, __comp);
}
template <class _InputIterator1, class _InputIterator2, class _OutputIterator>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-_OutputIterator
-merge(_InputIterator1 __first1, _InputIterator1 __last1,
- _InputIterator2 __first2, _InputIterator2 __last2, _OutputIterator __result)
-{
- return std::merge(__first1, __last1, __first2, __last2, __result, __less<>());
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _OutputIterator
+merge(_InputIterator1 __first1,
+ _InputIterator1 __last1,
+ _InputIterator2 __first2,
+ _InputIterator2 __last2,
+ _OutputIterator __result) {
+ return std::merge(__first1, __last1, __first2, __last2, __result, __less<>());
}
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__algorithm/min.h b/contrib/llvm-project/libcxx/include/__algorithm/min.h
index 58574517132f..919508486fd5 100644
--- a/contrib/llvm-project/libcxx/include/__algorithm/min.h
+++ b/contrib/llvm-project/libcxx/include/__algorithm/min.h
@@ -25,41 +25,28 @@ _LIBCPP_PUSH_MACROS
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _Tp, class _Compare>
-_LIBCPP_NODISCARD_EXT inline
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
-const _Tp&
-min(_LIBCPP_LIFETIMEBOUND const _Tp& __a, _LIBCPP_LIFETIMEBOUND const _Tp& __b, _Compare __comp)
-{
- return __comp(__b, __a) ? __b : __a;
+_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 const _Tp&
+min(_LIBCPP_LIFETIMEBOUND const _Tp& __a, _LIBCPP_LIFETIMEBOUND const _Tp& __b, _Compare __comp) {
+ return __comp(__b, __a) ? __b : __a;
}
template <class _Tp>
-_LIBCPP_NODISCARD_EXT inline
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
-const _Tp&
-min(_LIBCPP_LIFETIMEBOUND const _Tp& __a, _LIBCPP_LIFETIMEBOUND const _Tp& __b)
-{
- return std::min(__a, __b, __less<>());
+_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 const _Tp&
+min(_LIBCPP_LIFETIMEBOUND const _Tp& __a, _LIBCPP_LIFETIMEBOUND const _Tp& __b) {
+ return std::min(__a, __b, __less<>());
}
#ifndef _LIBCPP_CXX03_LANG
-template<class _Tp, class _Compare>
-_LIBCPP_NODISCARD_EXT inline
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
-_Tp
-min(initializer_list<_Tp> __t, _Compare __comp)
-{
- return *std::__min_element<__comp_ref_type<_Compare> >(__t.begin(), __t.end(), __comp);
+template <class _Tp, class _Compare>
+_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _Tp
+min(initializer_list<_Tp> __t, _Compare __comp) {
+ return *std::__min_element<__comp_ref_type<_Compare> >(__t.begin(), __t.end(), __comp);
}
-template<class _Tp>
-_LIBCPP_NODISCARD_EXT inline
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
-_Tp
-min(initializer_list<_Tp> __t)
-{
- return *std::min_element(__t.begin(), __t.end(), __less<>());
+template <class _Tp>
+_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _Tp min(initializer_list<_Tp> __t) {
+ return *std::min_element(__t.begin(), __t.end(), __less<>());
}
#endif // _LIBCPP_CXX03_LANG
diff --git a/contrib/llvm-project/libcxx/include/__algorithm/min_element.h b/contrib/llvm-project/libcxx/include/__algorithm/min_element.h
index 0ce7af69333f..c576d665601d 100644
--- a/contrib/llvm-project/libcxx/include/__algorithm/min_element.h
+++ b/contrib/llvm-project/libcxx/include/__algorithm/min_element.h
@@ -28,8 +28,8 @@ _LIBCPP_PUSH_MACROS
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _Comp, class _Iter, class _Sent, class _Proj>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
-_Iter __min_element(_Iter __first, _Sent __last, _Comp __comp, _Proj& __proj) {
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _Iter
+__min_element(_Iter __first, _Sent __last, _Comp __comp, _Proj& __proj) {
if (__first == __last)
return __first;
@@ -42,29 +42,26 @@ _Iter __min_element(_Iter __first, _Sent __last, _Comp __comp, _Proj& __proj) {
}
template <class _Comp, class _Iter, class _Sent>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
-_Iter __min_element(_Iter __first, _Sent __last, _Comp __comp) {
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _Iter __min_element(_Iter __first, _Sent __last, _Comp __comp) {
auto __proj = __identity();
return std::__min_element<_Comp>(std::move(__first), std::move(__last), __comp, __proj);
}
template <class _ForwardIterator, class _Compare>
_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _ForwardIterator
-min_element(_ForwardIterator __first, _ForwardIterator __last, _Compare __comp)
-{
- static_assert(__has_forward_iterator_category<_ForwardIterator>::value,
- "std::min_element requires a ForwardIterator");
- static_assert(__is_callable<_Compare, decltype(*__first), decltype(*__first)>::value,
- "The comparator has to be callable");
+min_element(_ForwardIterator __first, _ForwardIterator __last, _Compare __comp) {
+ static_assert(
+ __has_forward_iterator_category<_ForwardIterator>::value, "std::min_element requires a ForwardIterator");
+ static_assert(
+ __is_callable<_Compare, decltype(*__first), decltype(*__first)>::value, "The comparator has to be callable");
return std::__min_element<__comp_ref_type<_Compare> >(std::move(__first), std::move(__last), __comp);
}
template <class _ForwardIterator>
_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _ForwardIterator
-min_element(_ForwardIterator __first, _ForwardIterator __last)
-{
- return std::min_element(__first, __last, __less<>());
+min_element(_ForwardIterator __first, _ForwardIterator __last) {
+ return std::min_element(__first, __last, __less<>());
}
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__algorithm/min_max_result.h b/contrib/llvm-project/libcxx/include/__algorithm/min_max_result.h
index ef2d99038087..e988df7c114e 100644
--- a/contrib/llvm-project/libcxx/include/__algorithm/min_max_result.h
+++ b/contrib/llvm-project/libcxx/include/__algorithm/min_max_result.h
@@ -34,7 +34,7 @@ struct min_max_result {
template <class _T2>
requires convertible_to<const _T1&, _T2>
- _LIBCPP_HIDE_FROM_ABI constexpr operator min_max_result<_T2>() const & {
+ _LIBCPP_HIDE_FROM_ABI constexpr operator min_max_result<_T2>() const& {
return {min, max};
}
diff --git a/contrib/llvm-project/libcxx/include/__algorithm/minmax.h b/contrib/llvm-project/libcxx/include/__algorithm/minmax.h
index 115bf93f90ba..5227b8857175 100644
--- a/contrib/llvm-project/libcxx/include/__algorithm/minmax.h
+++ b/contrib/llvm-project/libcxx/include/__algorithm/minmax.h
@@ -23,43 +23,33 @@
_LIBCPP_BEGIN_NAMESPACE_STD
-template<class _Tp, class _Compare>
-_LIBCPP_NODISCARD_EXT inline
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
-pair<const _Tp&, const _Tp&>
-minmax(_LIBCPP_LIFETIMEBOUND const _Tp& __a, _LIBCPP_LIFETIMEBOUND const _Tp& __b, _Compare __comp)
-{
- return __comp(__b, __a) ? pair<const _Tp&, const _Tp&>(__b, __a) :
- pair<const _Tp&, const _Tp&>(__a, __b);
+template <class _Tp, class _Compare>
+_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair<const _Tp&, const _Tp&>
+minmax(_LIBCPP_LIFETIMEBOUND const _Tp& __a, _LIBCPP_LIFETIMEBOUND const _Tp& __b, _Compare __comp) {
+ return __comp(__b, __a) ? pair<const _Tp&, const _Tp&>(__b, __a) : pair<const _Tp&, const _Tp&>(__a, __b);
}
-template<class _Tp>
-_LIBCPP_NODISCARD_EXT inline
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
-pair<const _Tp&, const _Tp&>
-minmax(_LIBCPP_LIFETIMEBOUND const _Tp& __a, _LIBCPP_LIFETIMEBOUND const _Tp& __b)
-{
- return std::minmax(__a, __b, __less<>());
+template <class _Tp>
+_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair<const _Tp&, const _Tp&>
+minmax(_LIBCPP_LIFETIMEBOUND const _Tp& __a, _LIBCPP_LIFETIMEBOUND const _Tp& __b) {
+ return std::minmax(__a, __b, __less<>());
}
#ifndef _LIBCPP_CXX03_LANG
-template<class _Tp, class _Compare>
-_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
-pair<_Tp, _Tp> minmax(initializer_list<_Tp> __t, _Compare __comp) {
- static_assert(__is_callable<_Compare, _Tp, _Tp>::value, "The comparator has to be callable");
- __identity __proj;
- auto __ret = std::__minmax_element_impl(__t.begin(), __t.end(), __comp, __proj);
- return pair<_Tp, _Tp>(*__ret.first, *__ret.second);
+template <class _Tp, class _Compare>
+_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair<_Tp, _Tp>
+minmax(initializer_list<_Tp> __t, _Compare __comp) {
+ static_assert(__is_callable<_Compare, _Tp, _Tp>::value, "The comparator has to be callable");
+ __identity __proj;
+ auto __ret = std::__minmax_element_impl(__t.begin(), __t.end(), __comp, __proj);
+ return pair<_Tp, _Tp>(*__ret.first, *__ret.second);
}
-template<class _Tp>
-_LIBCPP_NODISCARD_EXT inline
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
-pair<_Tp, _Tp>
-minmax(initializer_list<_Tp> __t)
-{
- return std::minmax(__t, __less<>());
+template <class _Tp>
+_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair<_Tp, _Tp>
+minmax(initializer_list<_Tp> __t) {
+ return std::minmax(__t, __less<>());
}
#endif // _LIBCPP_CXX03_LANG
diff --git a/contrib/llvm-project/libcxx/include/__algorithm/minmax_element.h b/contrib/llvm-project/libcxx/include/__algorithm/minmax_element.h
index 5bcaf8354d9f..ff8cda321cef 100644
--- a/contrib/llvm-project/libcxx/include/__algorithm/minmax_element.h
+++ b/contrib/llvm-project/libcxx/include/__algorithm/minmax_element.h
@@ -29,19 +29,18 @@ class _MinmaxElementLessFunc {
_Proj& __proj_;
public:
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR
- _MinmaxElementLessFunc(_Comp& __comp, _Proj& __proj) : __comp_(__comp), __proj_(__proj) {}
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR _MinmaxElementLessFunc(_Comp& __comp, _Proj& __proj)
+ : __comp_(__comp), __proj_(__proj) {}
template <class _Iter>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
- bool operator()(_Iter& __it1, _Iter& __it2) {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 bool operator()(_Iter& __it1, _Iter& __it2) {
return std::__invoke(__comp_, std::__invoke(__proj_, *__it1), std::__invoke(__proj_, *__it2));
}
};
template <class _Iter, class _Sent, class _Proj, class _Comp>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
-pair<_Iter, _Iter> __minmax_element_impl(_Iter __first, _Sent __last, _Comp& __comp, _Proj& __proj) {
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair<_Iter, _Iter>
+__minmax_element_impl(_Iter __first, _Sent __last, _Comp& __comp, _Proj& __proj) {
auto __less = _MinmaxElementLessFunc<_Comp, _Proj>(__comp, __proj);
pair<_Iter, _Iter> __result(__first, __first);
@@ -66,8 +65,8 @@ pair<_Iter, _Iter> __minmax_element_impl(_Iter __first, _Sent __last, _Comp& __c
if (__less(__first, __i)) {
if (__less(__first, __result.first))
__result.first = __first;
- if (!__less(__i, __result.second))
- __result.second = __i;
+ if (!__less(__i, __result.second))
+ __result.second = __i;
} else {
if (__less(__i, __result.first))
__result.first = __i;
@@ -80,21 +79,21 @@ pair<_Iter, _Iter> __minmax_element_impl(_Iter __first, _Sent __last, _Comp& __c
}
template <class _ForwardIterator, class _Compare>
-_LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
-pair<_ForwardIterator, _ForwardIterator>
+_LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair<_ForwardIterator, _ForwardIterator>
minmax_element(_ForwardIterator __first, _ForwardIterator __last, _Compare __comp) {
- static_assert(__has_forward_iterator_category<_ForwardIterator>::value,
- "std::minmax_element requires a ForwardIterator");
- static_assert(__is_callable<_Compare, decltype(*__first), decltype(*__first)>::value,
- "The comparator has to be callable");
+ static_assert(
+ __has_forward_iterator_category<_ForwardIterator>::value, "std::minmax_element requires a ForwardIterator");
+ static_assert(
+ __is_callable<_Compare, decltype(*__first), decltype(*__first)>::value, "The comparator has to be callable");
auto __proj = __identity();
return std::__minmax_element_impl(__first, __last, __comp, __proj);
}
template <class _ForwardIterator>
_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
-pair<_ForwardIterator, _ForwardIterator> minmax_element(_ForwardIterator __first, _ForwardIterator __last) {
- return std::minmax_element(__first, __last, __less<>());
+ pair<_ForwardIterator, _ForwardIterator>
+ minmax_element(_ForwardIterator __first, _ForwardIterator __last) {
+ return std::minmax_element(__first, __last, __less<>());
}
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__algorithm/mismatch.h b/contrib/llvm-project/libcxx/include/__algorithm/mismatch.h
index 8330d21d56f3..d345b6048a7e 100644
--- a/contrib/llvm-project/libcxx/include/__algorithm/mismatch.h
+++ b/contrib/llvm-project/libcxx/include/__algorithm/mismatch.h
@@ -22,9 +22,8 @@
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _InputIterator1, class _InputIterator2, class _BinaryPredicate>
-_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI
- _LIBCPP_CONSTEXPR_SINCE_CXX20 pair<_InputIterator1, _InputIterator2>
- mismatch(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2, _BinaryPredicate __pred) {
+_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 pair<_InputIterator1, _InputIterator2>
+mismatch(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2, _BinaryPredicate __pred) {
for (; __first1 != __last1; ++__first1, (void)++__first2)
if (!__pred(*__first1, *__first2))
break;
@@ -32,18 +31,19 @@ _LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI
}
template <class _InputIterator1, class _InputIterator2>
-_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI
- _LIBCPP_CONSTEXPR_SINCE_CXX20 pair<_InputIterator1, _InputIterator2>
- mismatch(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2) {
+_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 pair<_InputIterator1, _InputIterator2>
+mismatch(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2) {
return std::mismatch(__first1, __last1, __first2, __equal_to());
}
#if _LIBCPP_STD_VER >= 14
template <class _InputIterator1, class _InputIterator2, class _BinaryPredicate>
-_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI
- _LIBCPP_CONSTEXPR_SINCE_CXX20 pair<_InputIterator1, _InputIterator2>
- mismatch(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2, _InputIterator2 __last2,
- _BinaryPredicate __pred) {
+_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 pair<_InputIterator1, _InputIterator2>
+mismatch(_InputIterator1 __first1,
+ _InputIterator1 __last1,
+ _InputIterator2 __first2,
+ _InputIterator2 __last2,
+ _BinaryPredicate __pred) {
for (; __first1 != __last1 && __first2 != __last2; ++__first1, (void)++__first2)
if (!__pred(*__first1, *__first2))
break;
@@ -51,9 +51,8 @@ _LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI
}
template <class _InputIterator1, class _InputIterator2>
-_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI
- _LIBCPP_CONSTEXPR_SINCE_CXX20 pair<_InputIterator1, _InputIterator2>
- mismatch(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2, _InputIterator2 __last2) {
+_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 pair<_InputIterator1, _InputIterator2>
+mismatch(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2, _InputIterator2 __last2) {
return std::mismatch(__first1, __last1, __first2, __last2, __equal_to());
}
#endif
diff --git a/contrib/llvm-project/libcxx/include/__algorithm/move.h b/contrib/llvm-project/libcxx/include/__algorithm/move.h
index e0da07117e66..dba6d487fff7 100644
--- a/contrib/llvm-project/libcxx/include/__algorithm/move.h
+++ b/contrib/llvm-project/libcxx/include/__algorithm/move.h
@@ -99,8 +99,7 @@ struct __move_loop {
struct __move_trivial {
// At this point, the iterators have been unwrapped so any `contiguous_iterator` has been unwrapped to a pointer.
- template <class _In, class _Out,
- __enable_if_t<__can_lower_move_assignment_to_memmove<_In, _Out>::value, int> = 0>
+ template <class _In, class _Out, __enable_if_t<__can_lower_move_assignment_to_memmove<_In, _Out>::value, int> = 0>
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair<_In*, _Out*>
operator()(_In* __first, _In* __last, _Out* __result) const {
return std::__copy_trivial_impl(__first, __last, __result);
diff --git a/contrib/llvm-project/libcxx/include/__algorithm/move_backward.h b/contrib/llvm-project/libcxx/include/__algorithm/move_backward.h
index 8151e4ef3243..aeedf4241dce 100644
--- a/contrib/llvm-project/libcxx/include/__algorithm/move_backward.h
+++ b/contrib/llvm-project/libcxx/include/__algorithm/move_backward.h
@@ -108,8 +108,7 @@ struct __move_backward_loop {
struct __move_backward_trivial {
// At this point, the iterators have been unwrapped so any `contiguous_iterator` has been unwrapped to a pointer.
- template <class _In, class _Out,
- __enable_if_t<__can_lower_move_assignment_to_memmove<_In, _Out>::value, int> = 0>
+ template <class _In, class _Out, __enable_if_t<__can_lower_move_assignment_to_memmove<_In, _Out>::value, int> = 0>
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair<_In*, _Out*>
operator()(_In* __first, _In* __last, _Out* __result) const {
return std::__copy_backward_trivial_impl(__first, __last, __result);
@@ -120,7 +119,8 @@ template <class _AlgPolicy, class _BidirectionalIterator1, class _Sentinel, clas
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 pair<_BidirectionalIterator1, _BidirectionalIterator2>
__move_backward(_BidirectionalIterator1 __first, _Sentinel __last, _BidirectionalIterator2 __result) {
static_assert(std::is_copy_constructible<_BidirectionalIterator1>::value &&
- std::is_copy_constructible<_BidirectionalIterator1>::value, "Iterators must be copy constructible.");
+ std::is_copy_constructible<_BidirectionalIterator1>::value,
+ "Iterators must be copy constructible.");
return std::__dispatch_copy_or_move<_AlgPolicy, __move_backward_loop<_AlgPolicy>, __move_backward_trivial>(
std::move(__first), std::move(__last), std::move(__result));
diff --git a/contrib/llvm-project/libcxx/include/__algorithm/next_permutation.h b/contrib/llvm-project/libcxx/include/__algorithm/next_permutation.h
index ebaed15ae2ad..d66ea9b97345 100644
--- a/contrib/llvm-project/libcxx/include/__algorithm/next_permutation.h
+++ b/contrib/llvm-project/libcxx/include/__algorithm/next_permutation.h
@@ -26,50 +26,43 @@ _LIBCPP_BEGIN_NAMESPACE_STD
template <class _AlgPolicy, class _Compare, class _BidirectionalIterator, class _Sentinel>
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 pair<_BidirectionalIterator, bool>
-__next_permutation(_BidirectionalIterator __first, _Sentinel __last, _Compare&& __comp)
-{
- using _Result = pair<_BidirectionalIterator, bool>;
+__next_permutation(_BidirectionalIterator __first, _Sentinel __last, _Compare&& __comp) {
+ using _Result = pair<_BidirectionalIterator, bool>;
- _BidirectionalIterator __last_iter = _IterOps<_AlgPolicy>::next(__first, __last);
- _BidirectionalIterator __i = __last_iter;
- if (__first == __last || __first == --__i)
- return _Result(std::move(__last_iter), false);
+ _BidirectionalIterator __last_iter = _IterOps<_AlgPolicy>::next(__first, __last);
+ _BidirectionalIterator __i = __last_iter;
+ if (__first == __last || __first == --__i)
+ return _Result(std::move(__last_iter), false);
- while (true)
- {
- _BidirectionalIterator __ip1 = __i;
- if (__comp(*--__i, *__ip1))
- {
- _BidirectionalIterator __j = __last_iter;
- while (!__comp(*__i, *--__j))
- ;
- _IterOps<_AlgPolicy>::iter_swap(__i, __j);
- std::__reverse<_AlgPolicy>(__ip1, __last_iter);
- return _Result(std::move(__last_iter), true);
- }
- if (__i == __first)
- {
- std::__reverse<_AlgPolicy>(__first, __last_iter);
- return _Result(std::move(__last_iter), false);
- }
+ while (true) {
+ _BidirectionalIterator __ip1 = __i;
+ if (__comp(*--__i, *__ip1)) {
+ _BidirectionalIterator __j = __last_iter;
+ while (!__comp(*__i, *--__j))
+ ;
+ _IterOps<_AlgPolicy>::iter_swap(__i, __j);
+ std::__reverse<_AlgPolicy>(__ip1, __last_iter);
+ return _Result(std::move(__last_iter), true);
}
+ if (__i == __first) {
+ std::__reverse<_AlgPolicy>(__first, __last_iter);
+ return _Result(std::move(__last_iter), false);
+ }
+ }
}
template <class _BidirectionalIterator, class _Compare>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-bool
-next_permutation(_BidirectionalIterator __first, _BidirectionalIterator __last, _Compare __comp)
-{
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool
+next_permutation(_BidirectionalIterator __first, _BidirectionalIterator __last, _Compare __comp) {
return std::__next_permutation<_ClassicAlgPolicy>(
- std::move(__first), std::move(__last), static_cast<__comp_ref_type<_Compare> >(__comp)).second;
+ std::move(__first), std::move(__last), static_cast<__comp_ref_type<_Compare> >(__comp))
+ .second;
}
template <class _BidirectionalIterator>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-bool
-next_permutation(_BidirectionalIterator __first, _BidirectionalIterator __last)
-{
- return std::next_permutation(__first, __last, __less<>());
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool
+next_permutation(_BidirectionalIterator __first, _BidirectionalIterator __last) {
+ return std::next_permutation(__first, __last, __less<>());
}
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__algorithm/nth_element.h b/contrib/llvm-project/libcxx/include/__algorithm/nth_element.h
index 6b3b2bb434d5..a05970512595 100644
--- a/contrib/llvm-project/libcxx/include/__algorithm/nth_element.h
+++ b/contrib/llvm-project/libcxx/include/__algorithm/nth_element.h
@@ -25,224 +25,207 @@
_LIBCPP_BEGIN_NAMESPACE_STD
-template<class _Compare, class _RandomAccessIterator>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 bool
-__nth_element_find_guard(_RandomAccessIterator& __i, _RandomAccessIterator& __j,
- _RandomAccessIterator __m, _Compare __comp)
-{
- // manually guard downward moving __j against __i
- while (true) {
- if (__i == --__j) {
- return false;
- }
- if (__comp(*__j, *__m)) {
- return true; // found guard for downward moving __j, now use unguarded partition
- }
+template <class _Compare, class _RandomAccessIterator>
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 bool __nth_element_find_guard(
+ _RandomAccessIterator& __i, _RandomAccessIterator& __j, _RandomAccessIterator __m, _Compare __comp) {
+ // manually guard downward moving __j against __i
+ while (true) {
+ if (__i == --__j) {
+ return false;
}
+ if (__comp(*__j, *__m)) {
+ return true; // found guard for downward moving __j, now use unguarded partition
+ }
+ }
}
template <class _AlgPolicy, class _Compare, class _RandomAccessIterator>
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 void
// NOLINTNEXTLINE(readability-function-cognitive-complexity)
-__nth_element(_RandomAccessIterator __first, _RandomAccessIterator __nth, _RandomAccessIterator __last, _Compare __comp)
-{
- using _Ops = _IterOps<_AlgPolicy>;
+__nth_element(
+ _RandomAccessIterator __first, _RandomAccessIterator __nth, _RandomAccessIterator __last, _Compare __comp) {
+ using _Ops = _IterOps<_AlgPolicy>;
- // _Compare is known to be a reference type
- typedef typename iterator_traits<_RandomAccessIterator>::difference_type difference_type;
- const difference_type __limit = 7;
- while (true)
+ // _Compare is known to be a reference type
+ typedef typename iterator_traits<_RandomAccessIterator>::difference_type difference_type;
+ const difference_type __limit = 7;
+ while (true) {
+ if (__nth == __last)
+ return;
+ difference_type __len = __last - __first;
+ switch (__len) {
+ case 0:
+ case 1:
+ return;
+ case 2:
+ if (__comp(*--__last, *__first))
+ _Ops::iter_swap(__first, __last);
+ return;
+ case 3: {
+ _RandomAccessIterator __m = __first;
+ std::__sort3<_AlgPolicy, _Compare>(__first, ++__m, --__last, __comp);
+ return;
+ }
+ }
+ if (__len <= __limit) {
+ std::__selection_sort<_AlgPolicy, _Compare>(__first, __last, __comp);
+ return;
+ }
+ // __len > __limit >= 3
+ _RandomAccessIterator __m = __first + __len / 2;
+ _RandomAccessIterator __lm1 = __last;
+ unsigned __n_swaps = std::__sort3<_AlgPolicy, _Compare>(__first, __m, --__lm1, __comp);
+ // *__m is median
+ // partition [__first, __m) < *__m and *__m <= [__m, __last)
+ // (this inhibits tossing elements equivalent to __m around unnecessarily)
+ _RandomAccessIterator __i = __first;
+ _RandomAccessIterator __j = __lm1;
+ // j points beyond range to be tested, *__lm1 is known to be <= *__m
+ // The search going up is known to be guarded but the search coming down isn't.
+ // Prime the downward search with a guard.
+ if (!__comp(*__i, *__m)) // if *__first == *__m
{
- if (__nth == __last)
- return;
- difference_type __len = __last - __first;
- switch (__len)
- {
- case 0:
- case 1:
- return;
- case 2:
- if (__comp(*--__last, *__first))
- _Ops::iter_swap(__first, __last);
- return;
- case 3:
- {
- _RandomAccessIterator __m = __first;
- std::__sort3<_AlgPolicy, _Compare>(__first, ++__m, --__last, __comp);
- return;
+ // *__first == *__m, *__first doesn't go in first part
+ if (std::__nth_element_find_guard<_Compare>(__i, __j, __m, __comp)) {
+ _Ops::iter_swap(__i, __j);
+ ++__n_swaps;
+ } else {
+ // *__first == *__m, *__m <= all other elements
+ // Partition instead into [__first, __i) == *__first and *__first < [__i, __last)
+ ++__i; // __first + 1
+ __j = __last;
+ if (!__comp(*__first, *--__j)) { // we need a guard if *__first == *(__last-1)
+ while (true) {
+ if (__i == __j) {
+ return; // [__first, __last) all equivalent elements
+ } else if (__comp(*__first, *__i)) {
+ _Ops::iter_swap(__i, __j);
+ ++__n_swaps;
+ ++__i;
+ break;
}
+ ++__i;
+ }
}
- if (__len <= __limit)
- {
- std::__selection_sort<_AlgPolicy, _Compare>(__first, __last, __comp);
- return;
+ // [__first, __i) == *__first and *__first < [__j, __last) and __j == __last - 1
+ if (__i == __j) {
+ return;
}
- // __len > __limit >= 3
- _RandomAccessIterator __m = __first + __len/2;
- _RandomAccessIterator __lm1 = __last;
- unsigned __n_swaps = std::__sort3<_AlgPolicy, _Compare>(__first, __m, --__lm1, __comp);
- // *__m is median
- // partition [__first, __m) < *__m and *__m <= [__m, __last)
- // (this inhibits tossing elements equivalent to __m around unnecessarily)
- _RandomAccessIterator __i = __first;
- _RandomAccessIterator __j = __lm1;
- // j points beyond range to be tested, *__lm1 is known to be <= *__m
- // The search going up is known to be guarded but the search coming down isn't.
- // Prime the downward search with a guard.
- if (!__comp(*__i, *__m)) // if *__first == *__m
- {
- // *__first == *__m, *__first doesn't go in first part
- if (std::__nth_element_find_guard<_Compare>(__i, __j, __m, __comp)) {
- _Ops::iter_swap(__i, __j);
- ++__n_swaps;
- } else {
- // *__first == *__m, *__m <= all other elements
- // Partition instead into [__first, __i) == *__first and *__first < [__i, __last)
- ++__i; // __first + 1
- __j = __last;
- if (!__comp(*__first, *--__j)) { // we need a guard if *__first == *(__last-1)
- while (true) {
- if (__i == __j) {
- return; // [__first, __last) all equivalent elements
- } else if (__comp(*__first, *__i)) {
- _Ops::iter_swap(__i, __j);
- ++__n_swaps;
- ++__i;
- break;
- }
- ++__i;
- }
- }
- // [__first, __i) == *__first and *__first < [__j, __last) and __j == __last - 1
- if (__i == __j) {
- return;
- }
- while (true) {
- while (!__comp(*__first, *__i)) {
- ++__i;
- _LIBCPP_ASSERT_UNCATEGORIZED(
- __i != __last,
- "Would read out of bounds, does your comparator satisfy the strict-weak ordering requirement?");
- }
- do {
- _LIBCPP_ASSERT_UNCATEGORIZED(
- __j != __first,
- "Would read out of bounds, does your comparator satisfy the strict-weak ordering requirement?");
- --__j;
- } while (__comp(*__first, *__j));
- if (__i >= __j)
- break;
- _Ops::iter_swap(__i, __j);
- ++__n_swaps;
- ++__i;
- }
- // [__first, __i) == *__first and *__first < [__i, __last)
- // The first part is sorted,
- if (__nth < __i) {
- return;
- }
- // __nth_element the second part
- // std::__nth_element<_Compare>(__i, __nth, __last, __comp);
- __first = __i;
- continue;
- }
+ while (true) {
+ while (!__comp(*__first, *__i)) {
+ ++__i;
+ _LIBCPP_ASSERT_UNCATEGORIZED(
+ __i != __last,
+ "Would read out of bounds, does your comparator satisfy the strict-weak ordering requirement?");
+ }
+ do {
+ _LIBCPP_ASSERT_UNCATEGORIZED(
+ __j != __first,
+ "Would read out of bounds, does your comparator satisfy the strict-weak ordering requirement?");
+ --__j;
+ } while (__comp(*__first, *__j));
+ if (__i >= __j)
+ break;
+ _Ops::iter_swap(__i, __j);
+ ++__n_swaps;
+ ++__i;
}
- ++__i;
- // j points beyond range to be tested, *__lm1 is known to be <= *__m
- // if not yet partitioned...
- if (__i < __j)
- {
- // known that *(__i - 1) < *__m
- while (true)
- {
- // __m still guards upward moving __i
- while (__comp(*__i, *__m)) {
- ++__i;
- _LIBCPP_ASSERT_UNCATEGORIZED(
- __i != __last,
- "Would read out of bounds, does your comparator satisfy the strict-weak ordering requirement?");
- }
- // It is now known that a guard exists for downward moving __j
- do {
- _LIBCPP_ASSERT_UNCATEGORIZED(
- __j != __first,
- "Would read out of bounds, does your comparator satisfy the strict-weak ordering requirement?");
- --__j;
- } while (!__comp(*__j, *__m));
- if (__i >= __j)
- break;
- _Ops::iter_swap(__i, __j);
- ++__n_swaps;
- // It is known that __m != __j
- // If __m just moved, follow it
- if (__m == __i)
- __m = __j;
- ++__i;
- }
+ // [__first, __i) == *__first and *__first < [__i, __last)
+ // The first part is sorted,
+ if (__nth < __i) {
+ return;
}
- // [__first, __i) < *__m and *__m <= [__i, __last)
- if (__i != __m && __comp(*__m, *__i))
- {
- _Ops::iter_swap(__i, __m);
- ++__n_swaps;
+ // __nth_element the second part
+ // std::__nth_element<_Compare>(__i, __nth, __last, __comp);
+ __first = __i;
+ continue;
+ }
+ }
+ ++__i;
+ // j points beyond range to be tested, *__lm1 is known to be <= *__m
+ // if not yet partitioned...
+ if (__i < __j) {
+ // known that *(__i - 1) < *__m
+ while (true) {
+ // __m still guards upward moving __i
+ while (__comp(*__i, *__m)) {
+ ++__i;
+ _LIBCPP_ASSERT_UNCATEGORIZED(
+ __i != __last,
+ "Would read out of bounds, does your comparator satisfy the strict-weak ordering requirement?");
}
- // [__first, __i) < *__i and *__i <= [__i+1, __last)
- if (__nth == __i)
+ // It is now known that a guard exists for downward moving __j
+ do {
+ _LIBCPP_ASSERT_UNCATEGORIZED(
+ __j != __first,
+ "Would read out of bounds, does your comparator satisfy the strict-weak ordering requirement?");
+ --__j;
+ } while (!__comp(*__j, *__m));
+ if (__i >= __j)
+ break;
+ _Ops::iter_swap(__i, __j);
+ ++__n_swaps;
+ // It is known that __m != __j
+ // If __m just moved, follow it
+ if (__m == __i)
+ __m = __j;
+ ++__i;
+ }
+ }
+ // [__first, __i) < *__m and *__m <= [__i, __last)
+ if (__i != __m && __comp(*__m, *__i)) {
+ _Ops::iter_swap(__i, __m);
+ ++__n_swaps;
+ }
+ // [__first, __i) < *__i and *__i <= [__i+1, __last)
+ if (__nth == __i)
+ return;
+ if (__n_swaps == 0) {
+ // We were given a perfectly partitioned sequence. Coincidence?
+ if (__nth < __i) {
+ // Check for [__first, __i) already sorted
+ __j = __m = __first;
+ while (true) {
+ if (++__j == __i) {
+ // [__first, __i) sorted
return;
- if (__n_swaps == 0)
- {
- // We were given a perfectly partitioned sequence. Coincidence?
- if (__nth < __i)
- {
- // Check for [__first, __i) already sorted
- __j = __m = __first;
- while (true) {
- if (++__j == __i) {
- // [__first, __i) sorted
- return;
- }
- if (__comp(*__j, *__m)) {
- // not yet sorted, so sort
- break;
- }
- __m = __j;
- }
- }
- else
- {
- // Check for [__i, __last) already sorted
- __j = __m = __i;
- while (true) {
- if (++__j == __last) {
- // [__i, __last) sorted
- return;
- }
- if (__comp(*__j, *__m)) {
- // not yet sorted, so sort
- break;
- }
- __m = __j;
- }
- }
- }
- // __nth_element on range containing __nth
- if (__nth < __i)
- {
- // std::__nth_element<_Compare>(__first, __nth, __i, __comp);
- __last = __i;
+ }
+ if (__comp(*__j, *__m)) {
+ // not yet sorted, so sort
+ break;
+ }
+ __m = __j;
}
- else
- {
- // std::__nth_element<_Compare>(__i+1, __nth, __last, __comp);
- __first = ++__i;
+ } else {
+ // Check for [__i, __last) already sorted
+ __j = __m = __i;
+ while (true) {
+ if (++__j == __last) {
+ // [__i, __last) sorted
+ return;
+ }
+ if (__comp(*__j, *__m)) {
+ // not yet sorted, so sort
+ break;
+ }
+ __m = __j;
}
+ }
+ }
+ // __nth_element on range containing __nth
+ if (__nth < __i) {
+ // std::__nth_element<_Compare>(__first, __nth, __i, __comp);
+ __last = __i;
+ } else {
+ // std::__nth_element<_Compare>(__i+1, __nth, __last, __comp);
+ __first = ++__i;
}
+ }
}
template <class _AlgPolicy, class _RandomAccessIterator, class _Compare>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-void __nth_element_impl(_RandomAccessIterator __first, _RandomAccessIterator __nth, _RandomAccessIterator __last,
- _Compare& __comp) {
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __nth_element_impl(
+ _RandomAccessIterator __first, _RandomAccessIterator __nth, _RandomAccessIterator __last, _Compare& __comp) {
if (__nth == __last)
return;
@@ -257,15 +240,14 @@ void __nth_element_impl(_RandomAccessIterator __first, _RandomAccessIterator __n
}
template <class _RandomAccessIterator, class _Compare>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-void nth_element(_RandomAccessIterator __first, _RandomAccessIterator __nth, _RandomAccessIterator __last,
- _Compare __comp) {
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void
+nth_element(_RandomAccessIterator __first, _RandomAccessIterator __nth, _RandomAccessIterator __last, _Compare __comp) {
std::__nth_element_impl<_ClassicAlgPolicy>(std::move(__first), std::move(__nth), std::move(__last), __comp);
}
template <class _RandomAccessIterator>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-void nth_element(_RandomAccessIterator __first, _RandomAccessIterator __nth, _RandomAccessIterator __last) {
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void
+nth_element(_RandomAccessIterator __first, _RandomAccessIterator __nth, _RandomAccessIterator __last) {
std::nth_element(std::move(__first), std::move(__nth), std::move(__last), __less<>());
}
diff --git a/contrib/llvm-project/libcxx/include/__algorithm/partial_sort.h b/contrib/llvm-project/libcxx/include/__algorithm/partial_sort.h
index de4ebfcbd858..27511a124229 100644
--- a/contrib/llvm-project/libcxx/include/__algorithm/partial_sort.h
+++ b/contrib/llvm-project/libcxx/include/__algorithm/partial_sort.h
@@ -29,8 +29,7 @@
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _AlgPolicy, class _Compare, class _RandomAccessIterator, class _Sentinel>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-_RandomAccessIterator __partial_sort_impl(
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _RandomAccessIterator __partial_sort_impl(
_RandomAccessIterator __first, _RandomAccessIterator __middle, _Sentinel __last, _Compare&& __comp) {
if (__first == __middle) {
return _IterOps<_AlgPolicy>::next(__middle, __last);
@@ -39,14 +38,12 @@ _RandomAccessIterator __partial_sort_impl(
std::__make_heap<_AlgPolicy>(__first, __middle, __comp);
typename iterator_traits<_RandomAccessIterator>::difference_type __len = __middle - __first;
- _RandomAccessIterator __i = __middle;
- for (; __i != __last; ++__i)
- {
- if (__comp(*__i, *__first))
- {
- _IterOps<_AlgPolicy>::iter_swap(__i, __first);
- std::__sift_down<_AlgPolicy>(__first, __comp, __len, __first);
- }
+ _RandomAccessIterator __i = __middle;
+ for (; __i != __last; ++__i) {
+ if (__comp(*__i, *__first)) {
+ _IterOps<_AlgPolicy>::iter_swap(__i, __first);
+ std::__sift_down<_AlgPolicy>(__first, __comp, __len, __first);
+ }
}
std::__sort_heap<_AlgPolicy>(std::move(__first), std::move(__middle), __comp);
@@ -54,11 +51,10 @@ _RandomAccessIterator __partial_sort_impl(
}
template <class _AlgPolicy, class _Compare, class _RandomAccessIterator, class _Sentinel>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-_RandomAccessIterator __partial_sort(_RandomAccessIterator __first, _RandomAccessIterator __middle, _Sentinel __last,
- _Compare& __comp) {
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _RandomAccessIterator
+__partial_sort(_RandomAccessIterator __first, _RandomAccessIterator __middle, _Sentinel __last, _Compare& __comp) {
if (__first == __middle)
- return _IterOps<_AlgPolicy>::next(__middle, __last);
+ return _IterOps<_AlgPolicy>::next(__middle, __last);
std::__debug_randomize_range<_AlgPolicy>(__first, __last);
@@ -71,11 +67,8 @@ _RandomAccessIterator __partial_sort(_RandomAccessIterator __first, _RandomAcces
}
template <class _RandomAccessIterator, class _Compare>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-void
-partial_sort(_RandomAccessIterator __first, _RandomAccessIterator __middle, _RandomAccessIterator __last,
- _Compare __comp)
-{
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void partial_sort(
+ _RandomAccessIterator __first, _RandomAccessIterator __middle, _RandomAccessIterator __last, _Compare __comp) {
static_assert(std::is_copy_constructible<_RandomAccessIterator>::value, "Iterators must be copy constructible.");
static_assert(std::is_copy_assignable<_RandomAccessIterator>::value, "Iterators must be copy assignable.");
@@ -83,11 +76,9 @@ partial_sort(_RandomAccessIterator __first, _RandomAccessIterator __middle, _Ran
}
template <class _RandomAccessIterator>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-void
-partial_sort(_RandomAccessIterator __first, _RandomAccessIterator __middle, _RandomAccessIterator __last)
-{
- std::partial_sort(__first, __middle, __last, __less<>());
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void
+partial_sort(_RandomAccessIterator __first, _RandomAccessIterator __middle, _RandomAccessIterator __last) {
+ std::partial_sort(__first, __middle, __last, __less<>());
}
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__algorithm/partial_sort_copy.h b/contrib/llvm-project/libcxx/include/__algorithm/partial_sort_copy.h
index 2c1e786d030e..e7d8df4de89f 100644
--- a/contrib/llvm-project/libcxx/include/__algorithm/partial_sort_copy.h
+++ b/contrib/llvm-project/libcxx/include/__algorithm/partial_sort_copy.h
@@ -30,56 +30,70 @@
_LIBCPP_BEGIN_NAMESPACE_STD
-template <class _AlgPolicy, class _Compare,
- class _InputIterator, class _Sentinel1, class _RandomAccessIterator, class _Sentinel2,
- class _Proj1, class _Proj2>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 pair<_InputIterator, _RandomAccessIterator>
-__partial_sort_copy(_InputIterator __first, _Sentinel1 __last,
- _RandomAccessIterator __result_first, _Sentinel2 __result_last,
- _Compare&& __comp, _Proj1&& __proj1, _Proj2&& __proj2)
-{
- _RandomAccessIterator __r = __result_first;
- auto&& __projected_comp = std::__make_projected(__comp, __proj2);
+template <class _AlgPolicy,
+ class _Compare,
+ class _InputIterator,
+ class _Sentinel1,
+ class _RandomAccessIterator,
+ class _Sentinel2,
+ class _Proj1,
+ class _Proj2>
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 pair<_InputIterator, _RandomAccessIterator> __partial_sort_copy(
+ _InputIterator __first,
+ _Sentinel1 __last,
+ _RandomAccessIterator __result_first,
+ _Sentinel2 __result_last,
+ _Compare&& __comp,
+ _Proj1&& __proj1,
+ _Proj2&& __proj2) {
+ _RandomAccessIterator __r = __result_first;
+ auto&& __projected_comp = std::__make_projected(__comp, __proj2);
- if (__r != __result_last)
- {
- for (; __first != __last && __r != __result_last; ++__first, (void) ++__r)
- *__r = *__first;
- std::__make_heap<_AlgPolicy>(__result_first, __r, __projected_comp);
- typename iterator_traits<_RandomAccessIterator>::difference_type __len = __r - __result_first;
- for (; __first != __last; ++__first)
- if (std::__invoke(__comp, std::__invoke(__proj1, *__first), std::__invoke(__proj2, *__result_first))) {
- *__result_first = *__first;
- std::__sift_down<_AlgPolicy>(__result_first, __projected_comp, __len, __result_first);
- }
- std::__sort_heap<_AlgPolicy>(__result_first, __r, __projected_comp);
- }
+ if (__r != __result_last) {
+ for (; __first != __last && __r != __result_last; ++__first, (void)++__r)
+ *__r = *__first;
+ std::__make_heap<_AlgPolicy>(__result_first, __r, __projected_comp);
+ typename iterator_traits<_RandomAccessIterator>::difference_type __len = __r - __result_first;
+ for (; __first != __last; ++__first)
+ if (std::__invoke(__comp, std::__invoke(__proj1, *__first), std::__invoke(__proj2, *__result_first))) {
+ *__result_first = *__first;
+ std::__sift_down<_AlgPolicy>(__result_first, __projected_comp, __len, __result_first);
+ }
+ std::__sort_heap<_AlgPolicy>(__result_first, __r, __projected_comp);
+ }
- return pair<_InputIterator, _RandomAccessIterator>(
- _IterOps<_AlgPolicy>::next(std::move(__first), std::move(__last)), std::move(__r));
+ return pair<_InputIterator, _RandomAccessIterator>(
+ _IterOps<_AlgPolicy>::next(std::move(__first), std::move(__last)), std::move(__r));
}
template <class _InputIterator, class _RandomAccessIterator, class _Compare>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-_RandomAccessIterator
-partial_sort_copy(_InputIterator __first, _InputIterator __last,
- _RandomAccessIterator __result_first, _RandomAccessIterator __result_last, _Compare __comp)
-{
- static_assert(__is_callable<_Compare, decltype(*__first), decltype(*__result_first)>::value,
- "Comparator has to be callable");
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _RandomAccessIterator partial_sort_copy(
+ _InputIterator __first,
+ _InputIterator __last,
+ _RandomAccessIterator __result_first,
+ _RandomAccessIterator __result_last,
+ _Compare __comp) {
+ static_assert(
+ __is_callable<_Compare, decltype(*__first), decltype(*__result_first)>::value, "Comparator has to be callable");
- auto __result = std::__partial_sort_copy<_ClassicAlgPolicy>(__first, __last, __result_first, __result_last,
- static_cast<__comp_ref_type<_Compare> >(__comp), __identity(), __identity());
+ auto __result = std::__partial_sort_copy<_ClassicAlgPolicy>(
+ __first,
+ __last,
+ __result_first,
+ __result_last,
+ static_cast<__comp_ref_type<_Compare> >(__comp),
+ __identity(),
+ __identity());
return __result.second;
}
template <class _InputIterator, class _RandomAccessIterator>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-_RandomAccessIterator
-partial_sort_copy(_InputIterator __first, _InputIterator __last,
- _RandomAccessIterator __result_first, _RandomAccessIterator __result_last)
-{
- return std::partial_sort_copy(__first, __last, __result_first, __result_last, __less<>());
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _RandomAccessIterator partial_sort_copy(
+ _InputIterator __first,
+ _InputIterator __last,
+ _RandomAccessIterator __result_first,
+ _RandomAccessIterator __result_last) {
+ return std::partial_sort_copy(__first, __last, __result_first, __result_last, __less<>());
}
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__algorithm/partition.h b/contrib/llvm-project/libcxx/include/__algorithm/partition.h
index a6aaf634aaa5..e2ceb07bf195 100644
--- a/contrib/llvm-project/libcxx/include/__algorithm/partition.h
+++ b/contrib/llvm-project/libcxx/include/__algorithm/partition.h
@@ -23,70 +23,58 @@ _LIBCPP_BEGIN_NAMESPACE_STD
template <class _Predicate, class _AlgPolicy, class _ForwardIterator, class _Sentinel>
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 pair<_ForwardIterator, _ForwardIterator>
-__partition_impl(_ForwardIterator __first, _Sentinel __last, _Predicate __pred, forward_iterator_tag)
-{
- while (true)
- {
- if (__first == __last)
- return std::make_pair(std::move(__first), std::move(__first));
- if (!__pred(*__first))
- break;
- ++__first;
- }
+__partition_impl(_ForwardIterator __first, _Sentinel __last, _Predicate __pred, forward_iterator_tag) {
+ while (true) {
+ if (__first == __last)
+ return std::make_pair(std::move(__first), std::move(__first));
+ if (!__pred(*__first))
+ break;
+ ++__first;
+ }
- _ForwardIterator __p = __first;
- while (++__p != __last)
- {
- if (__pred(*__p))
- {
- _IterOps<_AlgPolicy>::iter_swap(__first, __p);
- ++__first;
- }
+ _ForwardIterator __p = __first;
+ while (++__p != __last) {
+ if (__pred(*__p)) {
+ _IterOps<_AlgPolicy>::iter_swap(__first, __p);
+ ++__first;
}
- return std::make_pair(std::move(__first), std::move(__p));
+ }
+ return std::make_pair(std::move(__first), std::move(__p));
}
template <class _Predicate, class _AlgPolicy, class _BidirectionalIterator, class _Sentinel>
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 pair<_BidirectionalIterator, _BidirectionalIterator>
-__partition_impl(_BidirectionalIterator __first, _Sentinel __sentinel, _Predicate __pred,
- bidirectional_iterator_tag)
-{
- _BidirectionalIterator __original_last = _IterOps<_AlgPolicy>::next(__first, __sentinel);
- _BidirectionalIterator __last = __original_last;
+__partition_impl(_BidirectionalIterator __first, _Sentinel __sentinel, _Predicate __pred, bidirectional_iterator_tag) {
+ _BidirectionalIterator __original_last = _IterOps<_AlgPolicy>::next(__first, __sentinel);
+ _BidirectionalIterator __last = __original_last;
- while (true)
- {
- while (true)
- {
- if (__first == __last)
- return std::make_pair(std::move(__first), std::move(__original_last));
- if (!__pred(*__first))
- break;
- ++__first;
- }
- do
- {
- if (__first == --__last)
- return std::make_pair(std::move(__first), std::move(__original_last));
- } while (!__pred(*__last));
- _IterOps<_AlgPolicy>::iter_swap(__first, __last);
- ++__first;
+ while (true) {
+ while (true) {
+ if (__first == __last)
+ return std::make_pair(std::move(__first), std::move(__original_last));
+ if (!__pred(*__first))
+ break;
+ ++__first;
}
+ do {
+ if (__first == --__last)
+ return std::make_pair(std::move(__first), std::move(__original_last));
+ } while (!__pred(*__last));
+ _IterOps<_AlgPolicy>::iter_swap(__first, __last);
+ ++__first;
+ }
}
template <class _AlgPolicy, class _ForwardIterator, class _Sentinel, class _Predicate, class _IterCategory>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-pair<_ForwardIterator, _ForwardIterator> __partition(
- _ForwardIterator __first, _Sentinel __last, _Predicate&& __pred, _IterCategory __iter_category) {
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 pair<_ForwardIterator, _ForwardIterator>
+__partition(_ForwardIterator __first, _Sentinel __last, _Predicate&& __pred, _IterCategory __iter_category) {
return std::__partition_impl<__remove_cvref_t<_Predicate>&, _AlgPolicy>(
std::move(__first), std::move(__last), __pred, __iter_category);
}
template <class _ForwardIterator, class _Predicate>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-_ForwardIterator
-partition(_ForwardIterator __first, _ForwardIterator __last, _Predicate __pred)
-{
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _ForwardIterator
+partition(_ForwardIterator __first, _ForwardIterator __last, _Predicate __pred) {
using _IterCategory = typename iterator_traits<_ForwardIterator>::iterator_category;
auto __result = std::__partition<_ClassicAlgPolicy>(std::move(__first), std::move(__last), __pred, _IterCategory());
return __result.first;
diff --git a/contrib/llvm-project/libcxx/include/__algorithm/partition_copy.h b/contrib/llvm-project/libcxx/include/__algorithm/partition_copy.h
index ff8826a93712..147b45c7882a 100644
--- a/contrib/llvm-project/libcxx/include/__algorithm/partition_copy.h
+++ b/contrib/llvm-project/libcxx/include/__algorithm/partition_copy.h
@@ -19,27 +19,23 @@
_LIBCPP_BEGIN_NAMESPACE_STD
-template <class _InputIterator, class _OutputIterator1,
- class _OutputIterator2, class _Predicate>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 pair<_OutputIterator1, _OutputIterator2>
-partition_copy(_InputIterator __first, _InputIterator __last,
- _OutputIterator1 __out_true, _OutputIterator2 __out_false,
- _Predicate __pred)
-{
- for (; __first != __last; ++__first)
- {
- if (__pred(*__first))
- {
- *__out_true = *__first;
- ++__out_true;
- }
- else
- {
- *__out_false = *__first;
- ++__out_false;
- }
+template <class _InputIterator, class _OutputIterator1, class _OutputIterator2, class _Predicate>
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 pair<_OutputIterator1, _OutputIterator2> partition_copy(
+ _InputIterator __first,
+ _InputIterator __last,
+ _OutputIterator1 __out_true,
+ _OutputIterator2 __out_false,
+ _Predicate __pred) {
+ for (; __first != __last; ++__first) {
+ if (__pred(*__first)) {
+ *__out_true = *__first;
+ ++__out_true;
+ } else {
+ *__out_false = *__first;
+ ++__out_false;
}
- return pair<_OutputIterator1, _OutputIterator2>(__out_true, __out_false);
+ }
+ return pair<_OutputIterator1, _OutputIterator2>(__out_true, __out_false);
}
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__algorithm/partition_point.h b/contrib/llvm-project/libcxx/include/__algorithm/partition_point.h
index a61ed5ec5b41..504dbf1d1a05 100644
--- a/contrib/llvm-project/libcxx/include/__algorithm/partition_point.h
+++ b/contrib/llvm-project/libcxx/include/__algorithm/partition_point.h
@@ -21,26 +21,22 @@
_LIBCPP_BEGIN_NAMESPACE_STD
-template<class _ForwardIterator, class _Predicate>
+template <class _ForwardIterator, class _Predicate>
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _ForwardIterator
-partition_point(_ForwardIterator __first, _ForwardIterator __last, _Predicate __pred)
-{
- typedef typename iterator_traits<_ForwardIterator>::difference_type difference_type;
- difference_type __len = std::distance(__first, __last);
- while (__len != 0)
- {
- difference_type __l2 = std::__half_positive(__len);
- _ForwardIterator __m = __first;
- std::advance(__m, __l2);
- if (__pred(*__m))
- {
- __first = ++__m;
- __len -= __l2 + 1;
- }
- else
- __len = __l2;
- }
- return __first;
+partition_point(_ForwardIterator __first, _ForwardIterator __last, _Predicate __pred) {
+ typedef typename iterator_traits<_ForwardIterator>::difference_type difference_type;
+ difference_type __len = std::distance(__first, __last);
+ while (__len != 0) {
+ difference_type __l2 = std::__half_positive(__len);
+ _ForwardIterator __m = __first;
+ std::advance(__m, __l2);
+ if (__pred(*__m)) {
+ __first = ++__m;
+ __len -= __l2 + 1;
+ } else
+ __len = __l2;
+ }
+ return __first;
}
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__algorithm/pop_heap.h b/contrib/llvm-project/libcxx/include/__algorithm/pop_heap.h
index 033af6f2f80f..a93a9875f705 100644
--- a/contrib/llvm-project/libcxx/include/__algorithm/pop_heap.h
+++ b/contrib/llvm-project/libcxx/include/__algorithm/pop_heap.h
@@ -31,16 +31,18 @@ _LIBCPP_PUSH_MACROS
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _AlgPolicy, class _Compare, class _RandomAccessIterator>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
-void __pop_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare& __comp,
- typename iterator_traits<_RandomAccessIterator>::difference_type __len) {
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 void
+__pop_heap(_RandomAccessIterator __first,
+ _RandomAccessIterator __last,
+ _Compare& __comp,
+ typename iterator_traits<_RandomAccessIterator>::difference_type __len) {
_LIBCPP_ASSERT_UNCATEGORIZED(__len > 0, "The heap given to pop_heap must be non-empty");
__comp_ref_type<_Compare> __comp_ref = __comp;
using value_type = typename iterator_traits<_RandomAccessIterator>::value_type;
if (__len > 1) {
- value_type __top = _IterOps<_AlgPolicy>::__iter_move(__first); // create a hole at __first
+ value_type __top = _IterOps<_AlgPolicy>::__iter_move(__first); // create a hole at __first
_RandomAccessIterator __hole = std::__floyd_sift_down<_AlgPolicy>(__first, __comp_ref, __len);
--__last;
@@ -56,8 +58,8 @@ void __pop_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, _Co
}
template <class _RandomAccessIterator, class _Compare>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-void pop_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp) {
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void
+pop_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp) {
static_assert(std::is_copy_constructible<_RandomAccessIterator>::value, "Iterators must be copy constructible.");
static_assert(std::is_copy_assignable<_RandomAccessIterator>::value, "Iterators must be copy assignable.");
@@ -66,8 +68,8 @@ void pop_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, _Comp
}
template <class _RandomAccessIterator>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-void pop_heap(_RandomAccessIterator __first, _RandomAccessIterator __last) {
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void
+pop_heap(_RandomAccessIterator __first, _RandomAccessIterator __last) {
std::pop_heap(std::move(__first), std::move(__last), __less<>());
}
diff --git a/contrib/llvm-project/libcxx/include/__algorithm/prev_permutation.h b/contrib/llvm-project/libcxx/include/__algorithm/prev_permutation.h
index 4a6bf4a66439..3e4bbb3fbb16 100644
--- a/contrib/llvm-project/libcxx/include/__algorithm/prev_permutation.h
+++ b/contrib/llvm-project/libcxx/include/__algorithm/prev_permutation.h
@@ -25,52 +25,44 @@
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _AlgPolicy, class _Compare, class _BidirectionalIterator, class _Sentinel>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-pair<_BidirectionalIterator, bool>
-__prev_permutation(_BidirectionalIterator __first, _Sentinel __last, _Compare&& __comp)
-{
- using _Result = pair<_BidirectionalIterator, bool>;
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 pair<_BidirectionalIterator, bool>
+__prev_permutation(_BidirectionalIterator __first, _Sentinel __last, _Compare&& __comp) {
+ using _Result = pair<_BidirectionalIterator, bool>;
- _BidirectionalIterator __last_iter = _IterOps<_AlgPolicy>::next(__first, __last);
- _BidirectionalIterator __i = __last_iter;
- if (__first == __last || __first == --__i)
- return _Result(std::move(__last_iter), false);
+ _BidirectionalIterator __last_iter = _IterOps<_AlgPolicy>::next(__first, __last);
+ _BidirectionalIterator __i = __last_iter;
+ if (__first == __last || __first == --__i)
+ return _Result(std::move(__last_iter), false);
- while (true)
- {
- _BidirectionalIterator __ip1 = __i;
- if (__comp(*__ip1, *--__i))
- {
- _BidirectionalIterator __j = __last_iter;
- while (!__comp(*--__j, *__i))
- ;
- _IterOps<_AlgPolicy>::iter_swap(__i, __j);
- std::__reverse<_AlgPolicy>(__ip1, __last_iter);
- return _Result(std::move(__last_iter), true);
- }
- if (__i == __first)
- {
- std::__reverse<_AlgPolicy>(__first, __last_iter);
- return _Result(std::move(__last_iter), false);
- }
+ while (true) {
+ _BidirectionalIterator __ip1 = __i;
+ if (__comp(*__ip1, *--__i)) {
+ _BidirectionalIterator __j = __last_iter;
+ while (!__comp(*--__j, *__i))
+ ;
+ _IterOps<_AlgPolicy>::iter_swap(__i, __j);
+ std::__reverse<_AlgPolicy>(__ip1, __last_iter);
+ return _Result(std::move(__last_iter), true);
}
+ if (__i == __first) {
+ std::__reverse<_AlgPolicy>(__first, __last_iter);
+ return _Result(std::move(__last_iter), false);
+ }
+ }
}
template <class _BidirectionalIterator, class _Compare>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-bool
-prev_permutation(_BidirectionalIterator __first, _BidirectionalIterator __last, _Compare __comp)
-{
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool
+prev_permutation(_BidirectionalIterator __first, _BidirectionalIterator __last, _Compare __comp) {
return std::__prev_permutation<_ClassicAlgPolicy>(
- std::move(__first), std::move(__last), static_cast<__comp_ref_type<_Compare> >(__comp)).second;
+ std::move(__first), std::move(__last), static_cast<__comp_ref_type<_Compare> >(__comp))
+ .second;
}
template <class _BidirectionalIterator>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-bool
-prev_permutation(_BidirectionalIterator __first, _BidirectionalIterator __last)
-{
- return std::prev_permutation(__first, __last, __less<>());
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool
+prev_permutation(_BidirectionalIterator __first, _BidirectionalIterator __last) {
+ return std::prev_permutation(__first, __last, __less<>());
}
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__algorithm/push_heap.h b/contrib/llvm-project/libcxx/include/__algorithm/push_heap.h
index 82b571e44bd4..7d8720e3a93d 100644
--- a/contrib/llvm-project/libcxx/include/__algorithm/push_heap.h
+++ b/contrib/llvm-project/libcxx/include/__algorithm/push_heap.h
@@ -28,20 +28,22 @@ _LIBCPP_PUSH_MACROS
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _AlgPolicy, class _Compare, class _RandomAccessIterator>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
-void __sift_up(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare&& __comp,
- typename iterator_traits<_RandomAccessIterator>::difference_type __len) {
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 void
+__sift_up(_RandomAccessIterator __first,
+ _RandomAccessIterator __last,
+ _Compare&& __comp,
+ typename iterator_traits<_RandomAccessIterator>::difference_type __len) {
using value_type = typename iterator_traits<_RandomAccessIterator>::value_type;
if (__len > 1) {
- __len = (__len - 2) / 2;
+ __len = (__len - 2) / 2;
_RandomAccessIterator __ptr = __first + __len;
if (__comp(*__ptr, *--__last)) {
value_type __t(_IterOps<_AlgPolicy>::__iter_move(__last));
do {
*__last = _IterOps<_AlgPolicy>::__iter_move(__ptr);
- __last = __ptr;
+ __last = __ptr;
if (__len == 0)
break;
__len = (__len - 1) / 2;
@@ -54,15 +56,15 @@ void __sift_up(_RandomAccessIterator __first, _RandomAccessIterator __last, _Com
}
template <class _AlgPolicy, class _RandomAccessIterator, class _Compare>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
-void __push_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare& __comp) {
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 void
+__push_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare& __comp) {
typename iterator_traits<_RandomAccessIterator>::difference_type __len = __last - __first;
std::__sift_up<_AlgPolicy, __comp_ref_type<_Compare> >(std::move(__first), std::move(__last), __comp, __len);
}
template <class _RandomAccessIterator, class _Compare>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-void push_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp) {
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void
+push_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp) {
static_assert(std::is_copy_constructible<_RandomAccessIterator>::value, "Iterators must be copy constructible.");
static_assert(std::is_copy_assignable<_RandomAccessIterator>::value, "Iterators must be copy assignable.");
@@ -70,8 +72,8 @@ void push_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, _Com
}
template <class _RandomAccessIterator>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-void push_heap(_RandomAccessIterator __first, _RandomAccessIterator __last) {
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void
+push_heap(_RandomAccessIterator __first, _RandomAccessIterator __last) {
std::push_heap(std::move(__first), std::move(__last), __less<>());
}
diff --git a/contrib/llvm-project/libcxx/include/__algorithm/ranges_contains.h b/contrib/llvm-project/libcxx/include/__algorithm/ranges_contains.h
new file mode 100644
index 000000000000..f92fcec587d8
--- /dev/null
+++ b/contrib/llvm-project/libcxx/include/__algorithm/ranges_contains.h
@@ -0,0 +1,61 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBCPP___ALGORITHM_RANGES_CONTAINS_H
+#define _LIBCPP___ALGORITHM_RANGES_CONTAINS_H
+
+#include <__algorithm/ranges_find.h>
+#include <__config>
+#include <__functional/identity.h>
+#include <__functional/ranges_operations.h>
+#include <__functional/reference_wrapper.h>
+#include <__iterator/concepts.h>
+#include <__iterator/indirectly_comparable.h>
+#include <__iterator/projected.h>
+#include <__ranges/access.h>
+#include <__ranges/concepts.h>
+#include <__utility/move.h>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+# pragma GCC system_header
+#endif
+
+#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*>
+ _LIBCPP_NODISCARD_EXT _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*>
+ _LIBCPP_NODISCARD_EXT _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
+
+#endif // _LIBCPP___ALGORITHM_RANGES_CONTAINS_H
diff --git a/contrib/llvm-project/libcxx/include/__algorithm/ranges_max.h b/contrib/llvm-project/libcxx/include/__algorithm/ranges_max.h
index 782ce2670f05..0f89cb2ff5bf 100644
--- a/contrib/llvm-project/libcxx/include/__algorithm/ranges_max.h
+++ b/contrib/llvm-project/libcxx/include/__algorithm/ranges_max.h
@@ -54,7 +54,8 @@ struct __fn {
indirect_strict_weak_order<projected<const _Tp*, _Proj>> _Comp = ranges::less>
_LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr _Tp
operator()(initializer_list<_Tp> __il, _Comp __comp = {}, _Proj __proj = {}) const {
- _LIBCPP_ASSERT_UNCATEGORIZED(__il.begin() != __il.end(), "initializer_list must contain at least one element");
+ _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);
@@ -69,7 +70,7 @@ struct __fn {
auto __first = ranges::begin(__r);
auto __last = ranges::end(__r);
- _LIBCPP_ASSERT_UNCATEGORIZED(__first != __last, "range must contain at least one element");
+ _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 {
diff --git a/contrib/llvm-project/libcxx/include/__algorithm/ranges_min.h b/contrib/llvm-project/libcxx/include/__algorithm/ranges_min.h
index be15b4536734..8757358cdf37 100644
--- a/contrib/llvm-project/libcxx/include/__algorithm/ranges_min.h
+++ b/contrib/llvm-project/libcxx/include/__algorithm/ranges_min.h
@@ -53,7 +53,8 @@ struct __fn {
indirect_strict_weak_order<projected<const _Tp*, _Proj>> _Comp = ranges::less>
_LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr _Tp
operator()(initializer_list<_Tp> __il, _Comp __comp = {}, _Proj __proj = {}) const {
- _LIBCPP_ASSERT_UNCATEGORIZED(__il.begin() != __il.end(), "initializer_list must contain at least one element");
+ _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);
}
@@ -65,7 +66,7 @@ struct __fn {
operator()(_Rp&& __r, _Comp __comp = {}, _Proj __proj = {}) const {
auto __first = ranges::begin(__r);
auto __last = ranges::end(__r);
- _LIBCPP_ASSERT_UNCATEGORIZED(__first != __last, "range must contain at least one element");
+ _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 {
diff --git a/contrib/llvm-project/libcxx/include/__algorithm/ranges_minmax.h b/contrib/llvm-project/libcxx/include/__algorithm/ranges_minmax.h
index a5b5cf9bd0ab..22a62b620c93 100644
--- a/contrib/llvm-project/libcxx/include/__algorithm/ranges_minmax.h
+++ b/contrib/llvm-project/libcxx/include/__algorithm/ranges_minmax.h
@@ -65,7 +65,8 @@ struct __fn {
indirect_strict_weak_order<projected<const _Type*, _Proj>> _Comp = ranges::less>
_LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr ranges::minmax_result<_Type>
operator()(initializer_list<_Type> __il, _Comp __comp = {}, _Proj __proj = {}) const {
- _LIBCPP_ASSERT_UNCATEGORIZED(__il.begin() != __il.end(), "initializer_list has to contain at least one element");
+ _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};
}
@@ -80,7 +81,7 @@ struct __fn {
auto __last = ranges::end(__r);
using _ValueT = range_value_t<_Range>;
- _LIBCPP_ASSERT_UNCATEGORIZED(__first != __last, "range has to contain at least one element");
+ _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__first != __last, "range has to contain at least one element");
if constexpr (forward_range<_Range>) {
// Special-case the one element case. Avoid repeatedly initializing objects from the result of an iterator
diff --git a/contrib/llvm-project/libcxx/include/__algorithm/remove.h b/contrib/llvm-project/libcxx/include/__algorithm/remove.h
index eff22757186e..2b9d4ff26ed2 100644
--- a/contrib/llvm-project/libcxx/include/__algorithm/remove.h
+++ b/contrib/llvm-project/libcxx/include/__algorithm/remove.h
@@ -22,22 +22,18 @@ _LIBCPP_BEGIN_NAMESPACE_STD
template <class _ForwardIterator, class _Tp>
_LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _ForwardIterator
-remove(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value)
-{
- __first = std::find(__first, __last, __value);
- if (__first != __last)
- {
- _ForwardIterator __i = __first;
- while (++__i != __last)
- {
- if (!(*__i == __value))
- {
- *__first = std::move(*__i);
- ++__first;
- }
- }
+remove(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value) {
+ __first = std::find(__first, __last, __value);
+ if (__first != __last) {
+ _ForwardIterator __i = __first;
+ while (++__i != __last) {
+ if (!(*__i == __value)) {
+ *__first = std::move(*__i);
+ ++__first;
+ }
}
- return __first;
+ }
+ return __first;
}
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__algorithm/remove_copy.h b/contrib/llvm-project/libcxx/include/__algorithm/remove_copy.h
index 060833813d21..7be4c166ce3d 100644
--- a/contrib/llvm-project/libcxx/include/__algorithm/remove_copy.h
+++ b/contrib/llvm-project/libcxx/include/__algorithm/remove_copy.h
@@ -18,19 +18,15 @@
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _InputIterator, class _OutputIterator, class _Tp>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-_OutputIterator
-remove_copy(_InputIterator __first, _InputIterator __last, _OutputIterator __result, const _Tp& __value)
-{
- for (; __first != __last; ++__first)
- {
- if (!(*__first == __value))
- {
- *__result = *__first;
- ++__result;
- }
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _OutputIterator
+remove_copy(_InputIterator __first, _InputIterator __last, _OutputIterator __result, const _Tp& __value) {
+ for (; __first != __last; ++__first) {
+ if (!(*__first == __value)) {
+ *__result = *__first;
+ ++__result;
}
- return __result;
+ }
+ return __result;
}
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__algorithm/remove_copy_if.h b/contrib/llvm-project/libcxx/include/__algorithm/remove_copy_if.h
index 9858d43c043f..dcafed169157 100644
--- a/contrib/llvm-project/libcxx/include/__algorithm/remove_copy_if.h
+++ b/contrib/llvm-project/libcxx/include/__algorithm/remove_copy_if.h
@@ -18,19 +18,15 @@
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _InputIterator, class _OutputIterator, class _Predicate>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-_OutputIterator
-remove_copy_if(_InputIterator __first, _InputIterator __last, _OutputIterator __result, _Predicate __pred)
-{
- for (; __first != __last; ++__first)
- {
- if (!__pred(*__first))
- {
- *__result = *__first;
- ++__result;
- }
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _OutputIterator
+remove_copy_if(_InputIterator __first, _InputIterator __last, _OutputIterator __result, _Predicate __pred) {
+ for (; __first != __last; ++__first) {
+ if (!__pred(*__first)) {
+ *__result = *__first;
+ ++__result;
}
- return __result;
+ }
+ return __result;
}
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__algorithm/remove_if.h b/contrib/llvm-project/libcxx/include/__algorithm/remove_if.h
index 8197e4fc2f8e..6eceddce8d56 100644
--- a/contrib/llvm-project/libcxx/include/__algorithm/remove_if.h
+++ b/contrib/llvm-project/libcxx/include/__algorithm/remove_if.h
@@ -21,22 +21,18 @@ _LIBCPP_BEGIN_NAMESPACE_STD
template <class _ForwardIterator, class _Predicate>
_LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _ForwardIterator
-remove_if(_ForwardIterator __first, _ForwardIterator __last, _Predicate __pred)
-{
- __first = std::find_if<_ForwardIterator, _Predicate&>(__first, __last, __pred);
- if (__first != __last)
- {
- _ForwardIterator __i = __first;
- while (++__i != __last)
- {
- if (!__pred(*__i))
- {
- *__first = std::move(*__i);
- ++__first;
- }
- }
+remove_if(_ForwardIterator __first, _ForwardIterator __last, _Predicate __pred) {
+ __first = std::find_if<_ForwardIterator, _Predicate&>(__first, __last, __pred);
+ if (__first != __last) {
+ _ForwardIterator __i = __first;
+ while (++__i != __last) {
+ if (!__pred(*__i)) {
+ *__first = std::move(*__i);
+ ++__first;
+ }
}
- return __first;
+ }
+ return __first;
}
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__algorithm/replace.h b/contrib/llvm-project/libcxx/include/__algorithm/replace.h
index 09b1dac79b70..8057c78686e1 100644
--- a/contrib/llvm-project/libcxx/include/__algorithm/replace.h
+++ b/contrib/llvm-project/libcxx/include/__algorithm/replace.h
@@ -18,13 +18,11 @@
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _ForwardIterator, class _Tp>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-void
-replace(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __old_value, const _Tp& __new_value)
-{
- for (; __first != __last; ++__first)
- if (*__first == __old_value)
- *__first = __new_value;
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void
+replace(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __old_value, const _Tp& __new_value) {
+ for (; __first != __last; ++__first)
+ if (*__first == __old_value)
+ *__first = __new_value;
}
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__algorithm/replace_copy.h b/contrib/llvm-project/libcxx/include/__algorithm/replace_copy.h
index 107e92968944..9a2258d9f58e 100644
--- a/contrib/llvm-project/libcxx/include/__algorithm/replace_copy.h
+++ b/contrib/llvm-project/libcxx/include/__algorithm/replace_copy.h
@@ -18,17 +18,18 @@
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _InputIterator, class _OutputIterator, class _Tp>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-_OutputIterator
-replace_copy(_InputIterator __first, _InputIterator __last, _OutputIterator __result,
- const _Tp& __old_value, const _Tp& __new_value)
-{
- for (; __first != __last; ++__first, (void) ++__result)
- if (*__first == __old_value)
- *__result = __new_value;
- else
- *__result = *__first;
- return __result;
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _OutputIterator replace_copy(
+ _InputIterator __first,
+ _InputIterator __last,
+ _OutputIterator __result,
+ const _Tp& __old_value,
+ const _Tp& __new_value) {
+ for (; __first != __last; ++__first, (void)++__result)
+ if (*__first == __old_value)
+ *__result = __new_value;
+ else
+ *__result = *__first;
+ return __result;
}
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__algorithm/replace_copy_if.h b/contrib/llvm-project/libcxx/include/__algorithm/replace_copy_if.h
index a77b1caa805a..c2ed30f08d59 100644
--- a/contrib/llvm-project/libcxx/include/__algorithm/replace_copy_if.h
+++ b/contrib/llvm-project/libcxx/include/__algorithm/replace_copy_if.h
@@ -18,17 +18,18 @@
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _InputIterator, class _OutputIterator, class _Predicate, class _Tp>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-_OutputIterator
-replace_copy_if(_InputIterator __first, _InputIterator __last, _OutputIterator __result,
- _Predicate __pred, const _Tp& __new_value)
-{
- for (; __first != __last; ++__first, (void) ++__result)
- if (__pred(*__first))
- *__result = __new_value;
- else
- *__result = *__first;
- return __result;
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _OutputIterator replace_copy_if(
+ _InputIterator __first,
+ _InputIterator __last,
+ _OutputIterator __result,
+ _Predicate __pred,
+ const _Tp& __new_value) {
+ for (; __first != __last; ++__first, (void)++__result)
+ if (__pred(*__first))
+ *__result = __new_value;
+ else
+ *__result = *__first;
+ return __result;
}
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__algorithm/replace_if.h b/contrib/llvm-project/libcxx/include/__algorithm/replace_if.h
index 05269065f025..78487e3deed7 100644
--- a/contrib/llvm-project/libcxx/include/__algorithm/replace_if.h
+++ b/contrib/llvm-project/libcxx/include/__algorithm/replace_if.h
@@ -18,13 +18,11 @@
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _ForwardIterator, class _Predicate, class _Tp>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-void
-replace_if(_ForwardIterator __first, _ForwardIterator __last, _Predicate __pred, const _Tp& __new_value)
-{
- for (; __first != __last; ++__first)
- if (__pred(*__first))
- *__first = __new_value;
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void
+replace_if(_ForwardIterator __first, _ForwardIterator __last, _Predicate __pred, const _Tp& __new_value) {
+ for (; __first != __last; ++__first)
+ if (__pred(*__first))
+ *__first = __new_value;
}
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__algorithm/reverse.h b/contrib/llvm-project/libcxx/include/__algorithm/reverse.h
index 86634520aa26..6bd0aa393280 100644
--- a/contrib/llvm-project/libcxx/include/__algorithm/reverse.h
+++ b/contrib/llvm-project/libcxx/include/__algorithm/reverse.h
@@ -22,41 +22,33 @@
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _AlgPolicy, class _BidirectionalIterator>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-void
-__reverse_impl(_BidirectionalIterator __first, _BidirectionalIterator __last, bidirectional_iterator_tag)
-{
- while (__first != __last)
- {
- if (__first == --__last)
- break;
- _IterOps<_AlgPolicy>::iter_swap(__first, __last);
- ++__first;
- }
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void
+__reverse_impl(_BidirectionalIterator __first, _BidirectionalIterator __last, bidirectional_iterator_tag) {
+ while (__first != __last) {
+ if (__first == --__last)
+ break;
+ _IterOps<_AlgPolicy>::iter_swap(__first, __last);
+ ++__first;
+ }
}
template <class _AlgPolicy, class _RandomAccessIterator>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-void
-__reverse_impl(_RandomAccessIterator __first, _RandomAccessIterator __last, random_access_iterator_tag)
-{
- if (__first != __last)
- for (; __first < --__last; ++__first)
- _IterOps<_AlgPolicy>::iter_swap(__first, __last);
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void
+__reverse_impl(_RandomAccessIterator __first, _RandomAccessIterator __last, random_access_iterator_tag) {
+ if (__first != __last)
+ for (; __first < --__last; ++__first)
+ _IterOps<_AlgPolicy>::iter_swap(__first, __last);
}
template <class _AlgPolicy, class _BidirectionalIterator, class _Sentinel>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-void __reverse(_BidirectionalIterator __first, _Sentinel __last) {
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __reverse(_BidirectionalIterator __first, _Sentinel __last) {
using _IterCategory = typename _IterOps<_AlgPolicy>::template __iterator_category<_BidirectionalIterator>;
std::__reverse_impl<_AlgPolicy>(std::move(__first), std::move(__last), _IterCategory());
}
template <class _BidirectionalIterator>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-void
-reverse(_BidirectionalIterator __first, _BidirectionalIterator __last)
-{
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void
+reverse(_BidirectionalIterator __first, _BidirectionalIterator __last) {
std::__reverse<_ClassicAlgPolicy>(std::move(__first), std::move(__last));
}
diff --git a/contrib/llvm-project/libcxx/include/__algorithm/reverse_copy.h b/contrib/llvm-project/libcxx/include/__algorithm/reverse_copy.h
index 7672fc86686b..0fcecc392326 100644
--- a/contrib/llvm-project/libcxx/include/__algorithm/reverse_copy.h
+++ b/contrib/llvm-project/libcxx/include/__algorithm/reverse_copy.h
@@ -18,13 +18,11 @@
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _BidirectionalIterator, class _OutputIterator>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-_OutputIterator
-reverse_copy(_BidirectionalIterator __first, _BidirectionalIterator __last, _OutputIterator __result)
-{
- for (; __first != __last; ++__result)
- *__result = *--__last;
- return __result;
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _OutputIterator
+reverse_copy(_BidirectionalIterator __first, _BidirectionalIterator __last, _OutputIterator __result) {
+ for (; __first != __last; ++__result)
+ *__result = *--__last;
+ return __result;
}
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__algorithm/rotate.h b/contrib/llvm-project/libcxx/include/__algorithm/rotate.h
index f9236fcaafb2..d8162b1a94b2 100644
--- a/contrib/llvm-project/libcxx/include/__algorithm/rotate.h
+++ b/contrib/llvm-project/libcxx/include/__algorithm/rotate.h
@@ -27,193 +27,165 @@ _LIBCPP_BEGIN_NAMESPACE_STD
template <class _AlgPolicy, class _ForwardIterator>
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _ForwardIterator
-__rotate_left(_ForwardIterator __first, _ForwardIterator __last)
-{
- typedef typename iterator_traits<_ForwardIterator>::value_type value_type;
- using _Ops = _IterOps<_AlgPolicy>;
-
- value_type __tmp = _Ops::__iter_move(__first);
- _ForwardIterator __lm1 = std::__move<_AlgPolicy>(
- _Ops::next(__first), __last, __first).second;
- *__lm1 = std::move(__tmp);
- return __lm1;
+__rotate_left(_ForwardIterator __first, _ForwardIterator __last) {
+ typedef typename iterator_traits<_ForwardIterator>::value_type value_type;
+ using _Ops = _IterOps<_AlgPolicy>;
+
+ value_type __tmp = _Ops::__iter_move(__first);
+ _ForwardIterator __lm1 = std::__move<_AlgPolicy>(_Ops::next(__first), __last, __first).second;
+ *__lm1 = std::move(__tmp);
+ return __lm1;
}
template <class _AlgPolicy, class _BidirectionalIterator>
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _BidirectionalIterator
-__rotate_right(_BidirectionalIterator __first, _BidirectionalIterator __last)
-{
- typedef typename iterator_traits<_BidirectionalIterator>::value_type value_type;
- using _Ops = _IterOps<_AlgPolicy>;
-
- _BidirectionalIterator __lm1 = _Ops::prev(__last);
- value_type __tmp = _Ops::__iter_move(__lm1);
- _BidirectionalIterator __fp1 = std::__move_backward<_AlgPolicy>(__first, __lm1, std::move(__last)).second;
- *__first = std::move(__tmp);
- return __fp1;
+__rotate_right(_BidirectionalIterator __first, _BidirectionalIterator __last) {
+ typedef typename iterator_traits<_BidirectionalIterator>::value_type value_type;
+ using _Ops = _IterOps<_AlgPolicy>;
+
+ _BidirectionalIterator __lm1 = _Ops::prev(__last);
+ value_type __tmp = _Ops::__iter_move(__lm1);
+ _BidirectionalIterator __fp1 = std::__move_backward<_AlgPolicy>(__first, __lm1, std::move(__last)).second;
+ *__first = std::move(__tmp);
+ return __fp1;
}
template <class _AlgPolicy, class _ForwardIterator>
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 _ForwardIterator
-__rotate_forward(_ForwardIterator __first, _ForwardIterator __middle, _ForwardIterator __last)
-{
- _ForwardIterator __i = __middle;
- while (true)
- {
- _IterOps<_AlgPolicy>::iter_swap(__first, __i);
- ++__first;
- if (++__i == __last)
- break;
+__rotate_forward(_ForwardIterator __first, _ForwardIterator __middle, _ForwardIterator __last) {
+ _ForwardIterator __i = __middle;
+ while (true) {
+ _IterOps<_AlgPolicy>::iter_swap(__first, __i);
+ ++__first;
+ if (++__i == __last)
+ break;
+ if (__first == __middle)
+ __middle = __i;
+ }
+ _ForwardIterator __r = __first;
+ if (__first != __middle) {
+ __i = __middle;
+ while (true) {
+ _IterOps<_AlgPolicy>::iter_swap(__first, __i);
+ ++__first;
+ if (++__i == __last) {
if (__first == __middle)
- __middle = __i;
- }
- _ForwardIterator __r = __first;
- if (__first != __middle)
- {
+ break;
__i = __middle;
- while (true)
- {
- _IterOps<_AlgPolicy>::iter_swap(__first, __i);
- ++__first;
- if (++__i == __last)
- {
- if (__first == __middle)
- break;
- __i = __middle;
- }
- else if (__first == __middle)
- __middle = __i;
- }
+ } else if (__first == __middle)
+ __middle = __i;
}
- return __r;
+ }
+ return __r;
}
-template<typename _Integral>
-inline _LIBCPP_HIDE_FROM_ABI
-_LIBCPP_CONSTEXPR_SINCE_CXX17 _Integral
-__algo_gcd(_Integral __x, _Integral __y)
-{
- do
- {
- _Integral __t = __x % __y;
- __x = __y;
- __y = __t;
- } while (__y);
- return __x;
+template <typename _Integral>
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 _Integral __algo_gcd(_Integral __x, _Integral __y) {
+ do {
+ _Integral __t = __x % __y;
+ __x = __y;
+ __y = __t;
+ } while (__y);
+ return __x;
}
template <class _AlgPolicy, typename _RandomAccessIterator>
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 _RandomAccessIterator
-__rotate_gcd(_RandomAccessIterator __first, _RandomAccessIterator __middle, _RandomAccessIterator __last)
-{
- typedef typename iterator_traits<_RandomAccessIterator>::difference_type difference_type;
- typedef typename iterator_traits<_RandomAccessIterator>::value_type value_type;
- using _Ops = _IterOps<_AlgPolicy>;
-
- const difference_type __m1 = __middle - __first;
- const difference_type __m2 = _Ops::distance(__middle, __last);
- if (__m1 == __m2)
- {
- std::__swap_ranges<_AlgPolicy>(__first, __middle, __middle, __last);
- return __middle;
- }
- const difference_type __g = std::__algo_gcd(__m1, __m2);
- for (_RandomAccessIterator __p = __first + __g; __p != __first;)
- {
- value_type __t(_Ops::__iter_move(--__p));
- _RandomAccessIterator __p1 = __p;
- _RandomAccessIterator __p2 = __p1 + __m1;
- do
- {
- *__p1 = _Ops::__iter_move(__p2);
- __p1 = __p2;
- const difference_type __d = _Ops::distance(__p2, __last);
- if (__m1 < __d)
- __p2 += __m1;
- else
- __p2 = __first + (__m1 - __d);
- } while (__p2 != __p);
- *__p1 = std::move(__t);
- }
- return __first + __m2;
+__rotate_gcd(_RandomAccessIterator __first, _RandomAccessIterator __middle, _RandomAccessIterator __last) {
+ typedef typename iterator_traits<_RandomAccessIterator>::difference_type difference_type;
+ typedef typename iterator_traits<_RandomAccessIterator>::value_type value_type;
+ using _Ops = _IterOps<_AlgPolicy>;
+
+ const difference_type __m1 = __middle - __first;
+ const difference_type __m2 = _Ops::distance(__middle, __last);
+ if (__m1 == __m2) {
+ std::__swap_ranges<_AlgPolicy>(__first, __middle, __middle, __last);
+ return __middle;
+ }
+ const difference_type __g = std::__algo_gcd(__m1, __m2);
+ for (_RandomAccessIterator __p = __first + __g; __p != __first;) {
+ value_type __t(_Ops::__iter_move(--__p));
+ _RandomAccessIterator __p1 = __p;
+ _RandomAccessIterator __p2 = __p1 + __m1;
+ do {
+ *__p1 = _Ops::__iter_move(__p2);
+ __p1 = __p2;
+ const difference_type __d = _Ops::distance(__p2, __last);
+ if (__m1 < __d)
+ __p2 += __m1;
+ else
+ __p2 = __first + (__m1 - __d);
+ } while (__p2 != __p);
+ *__p1 = std::move(__t);
+ }
+ return __first + __m2;
}
template <class _AlgPolicy, class _ForwardIterator>
-inline _LIBCPP_HIDE_FROM_ABI
-_LIBCPP_CONSTEXPR_SINCE_CXX14 _ForwardIterator
-__rotate_impl(_ForwardIterator __first, _ForwardIterator __middle, _ForwardIterator __last,
- std::forward_iterator_tag)
-{
- typedef typename iterator_traits<_ForwardIterator>::value_type value_type;
- if (is_trivially_move_assignable<value_type>::value)
- {
- if (_IterOps<_AlgPolicy>::next(__first) == __middle)
- return std::__rotate_left<_AlgPolicy>(__first, __last);
- }
- return std::__rotate_forward<_AlgPolicy>(__first, __middle, __last);
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _ForwardIterator
+__rotate_impl(_ForwardIterator __first, _ForwardIterator __middle, _ForwardIterator __last, std::forward_iterator_tag) {
+ typedef typename iterator_traits<_ForwardIterator>::value_type value_type;
+ if (is_trivially_move_assignable<value_type>::value) {
+ if (_IterOps<_AlgPolicy>::next(__first) == __middle)
+ return std::__rotate_left<_AlgPolicy>(__first, __last);
+ }
+ return std::__rotate_forward<_AlgPolicy>(__first, __middle, __last);
}
template <class _AlgPolicy, class _BidirectionalIterator>
-inline _LIBCPP_HIDE_FROM_ABI
-_LIBCPP_CONSTEXPR_SINCE_CXX14 _BidirectionalIterator
-__rotate_impl(_BidirectionalIterator __first, _BidirectionalIterator __middle, _BidirectionalIterator __last,
- bidirectional_iterator_tag)
-{
- typedef typename iterator_traits<_BidirectionalIterator>::value_type value_type;
- if (is_trivially_move_assignable<value_type>::value)
- {
- if (_IterOps<_AlgPolicy>::next(__first) == __middle)
- return std::__rotate_left<_AlgPolicy>(__first, __last);
- if (_IterOps<_AlgPolicy>::next(__middle) == __last)
- return std::__rotate_right<_AlgPolicy>(__first, __last);
- }
- return std::__rotate_forward<_AlgPolicy>(__first, __middle, __last);
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _BidirectionalIterator __rotate_impl(
+ _BidirectionalIterator __first,
+ _BidirectionalIterator __middle,
+ _BidirectionalIterator __last,
+ bidirectional_iterator_tag) {
+ typedef typename iterator_traits<_BidirectionalIterator>::value_type value_type;
+ if (is_trivially_move_assignable<value_type>::value) {
+ if (_IterOps<_AlgPolicy>::next(__first) == __middle)
+ return std::__rotate_left<_AlgPolicy>(__first, __last);
+ if (_IterOps<_AlgPolicy>::next(__middle) == __last)
+ return std::__rotate_right<_AlgPolicy>(__first, __last);
+ }
+ return std::__rotate_forward<_AlgPolicy>(__first, __middle, __last);
}
template <class _AlgPolicy, class _RandomAccessIterator>
-inline _LIBCPP_HIDE_FROM_ABI
-_LIBCPP_CONSTEXPR_SINCE_CXX14 _RandomAccessIterator
-__rotate_impl(_RandomAccessIterator __first, _RandomAccessIterator __middle, _RandomAccessIterator __last,
- random_access_iterator_tag)
-{
- typedef typename iterator_traits<_RandomAccessIterator>::value_type value_type;
- if (is_trivially_move_assignable<value_type>::value)
- {
- if (_IterOps<_AlgPolicy>::next(__first) == __middle)
- return std::__rotate_left<_AlgPolicy>(__first, __last);
- if (_IterOps<_AlgPolicy>::next(__middle) == __last)
- return std::__rotate_right<_AlgPolicy>(__first, __last);
- return std::__rotate_gcd<_AlgPolicy>(__first, __middle, __last);
- }
- return std::__rotate_forward<_AlgPolicy>(__first, __middle, __last);
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _RandomAccessIterator __rotate_impl(
+ _RandomAccessIterator __first,
+ _RandomAccessIterator __middle,
+ _RandomAccessIterator __last,
+ random_access_iterator_tag) {
+ typedef typename iterator_traits<_RandomAccessIterator>::value_type value_type;
+ if (is_trivially_move_assignable<value_type>::value) {
+ if (_IterOps<_AlgPolicy>::next(__first) == __middle)
+ return std::__rotate_left<_AlgPolicy>(__first, __last);
+ if (_IterOps<_AlgPolicy>::next(__middle) == __last)
+ return std::__rotate_right<_AlgPolicy>(__first, __last);
+ return std::__rotate_gcd<_AlgPolicy>(__first, __middle, __last);
+ }
+ return std::__rotate_forward<_AlgPolicy>(__first, __middle, __last);
}
template <class _AlgPolicy, class _Iterator, class _Sentinel>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
-pair<_Iterator, _Iterator>
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair<_Iterator, _Iterator>
__rotate(_Iterator __first, _Iterator __middle, _Sentinel __last) {
- using _Ret = pair<_Iterator, _Iterator>;
+ using _Ret = pair<_Iterator, _Iterator>;
_Iterator __last_iter = _IterOps<_AlgPolicy>::next(__middle, __last);
if (__first == __middle)
- return _Ret(__last_iter, __last_iter);
+ return _Ret(__last_iter, __last_iter);
if (__middle == __last)
- return _Ret(std::move(__first), std::move(__last_iter));
+ return _Ret(std::move(__first), std::move(__last_iter));
using _IterCategory = typename _IterOps<_AlgPolicy>::template __iterator_category<_Iterator>;
- auto __result = std::__rotate_impl<_AlgPolicy>(
- std::move(__first), std::move(__middle), __last_iter, _IterCategory());
+ auto __result = std::__rotate_impl<_AlgPolicy>(std::move(__first), std::move(__middle), __last_iter, _IterCategory());
return _Ret(std::move(__result), std::move(__last_iter));
}
template <class _ForwardIterator>
-inline _LIBCPP_HIDE_FROM_ABI
-_LIBCPP_CONSTEXPR_SINCE_CXX20 _ForwardIterator
-rotate(_ForwardIterator __first, _ForwardIterator __middle, _ForwardIterator __last)
-{
- return std::__rotate<_ClassicAlgPolicy>(
- std::move(__first), std::move(__middle), std::move(__last)).first;
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _ForwardIterator
+rotate(_ForwardIterator __first, _ForwardIterator __middle, _ForwardIterator __last) {
+ return std::__rotate<_ClassicAlgPolicy>(std::move(__first), std::move(__middle), std::move(__last)).first;
}
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__algorithm/rotate_copy.h b/contrib/llvm-project/libcxx/include/__algorithm/rotate_copy.h
index 6e886cb73cfc..cddcadd237d9 100644
--- a/contrib/llvm-project/libcxx/include/__algorithm/rotate_copy.h
+++ b/contrib/llvm-project/libcxx/include/__algorithm/rotate_copy.h
@@ -19,11 +19,9 @@
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _ForwardIterator, class _OutputIterator>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-_OutputIterator
-rotate_copy(_ForwardIterator __first, _ForwardIterator __middle, _ForwardIterator __last, _OutputIterator __result)
-{
- return std::copy(__first, __middle, std::copy(__middle, __last, __result));
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _OutputIterator
+rotate_copy(_ForwardIterator __first, _ForwardIterator __middle, _ForwardIterator __last, _OutputIterator __result) {
+ return std::copy(__first, __middle, std::copy(__middle, __last, __result));
}
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__algorithm/sample.h b/contrib/llvm-project/libcxx/include/__algorithm/sample.h
index 100b0a466863..ebe5180b7eec 100644
--- a/contrib/llvm-project/libcxx/include/__algorithm/sample.h
+++ b/contrib/llvm-project/libcxx/include/__algorithm/sample.h
@@ -29,20 +29,23 @@ _LIBCPP_PUSH_MACROS
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _AlgPolicy,
- class _PopulationIterator, class _PopulationSentinel, class _SampleIterator, class _Distance,
+ class _PopulationIterator,
+ class _PopulationSentinel,
+ class _SampleIterator,
+ class _Distance,
class _UniformRandomNumberGenerator>
-_LIBCPP_HIDE_FROM_ABI
-_SampleIterator __sample(_PopulationIterator __first,
- _PopulationSentinel __last, _SampleIterator __output_iter,
- _Distance __n,
- _UniformRandomNumberGenerator& __g,
- input_iterator_tag) {
-
+_LIBCPP_HIDE_FROM_ABI _SampleIterator __sample(
+ _PopulationIterator __first,
+ _PopulationSentinel __last,
+ _SampleIterator __output_iter,
+ _Distance __n,
+ _UniformRandomNumberGenerator& __g,
+ input_iterator_tag) {
_Distance __k = 0;
- for (; __first != __last && __k < __n; ++__first, (void) ++__k)
+ for (; __first != __last && __k < __n; ++__first, (void)++__k)
__output_iter[__k] = *__first;
_Distance __sz = __k;
- for (; __first != __last; ++__first, (void) ++__k) {
+ for (; __first != __last; ++__first, (void)++__k) {
_Distance __r = uniform_int_distribution<_Distance>(0, __k)(__g);
if (__r < __sz)
__output_iter[__r] = *__first;
@@ -51,14 +54,18 @@ _SampleIterator __sample(_PopulationIterator __first,
}
template <class _AlgPolicy,
- class _PopulationIterator, class _PopulationSentinel, class _SampleIterator, class _Distance,
+ class _PopulationIterator,
+ class _PopulationSentinel,
+ class _SampleIterator,
+ class _Distance,
class _UniformRandomNumberGenerator>
-_LIBCPP_HIDE_FROM_ABI
-_SampleIterator __sample(_PopulationIterator __first,
- _PopulationSentinel __last, _SampleIterator __output_iter,
- _Distance __n,
- _UniformRandomNumberGenerator& __g,
- forward_iterator_tag) {
+_LIBCPP_HIDE_FROM_ABI _SampleIterator __sample(
+ _PopulationIterator __first,
+ _PopulationSentinel __last,
+ _SampleIterator __output_iter,
+ _Distance __n,
+ _UniformRandomNumberGenerator& __g,
+ forward_iterator_tag) {
_Distance __unsampled_sz = _IterOps<_AlgPolicy>::distance(__first, __last);
for (__n = std::min(__n, __unsampled_sz); __n != 0; ++__first) {
_Distance __r = uniform_int_distribution<_Distance>(0, --__unsampled_sz)(__g);
@@ -71,36 +78,40 @@ _SampleIterator __sample(_PopulationIterator __first,
}
template <class _AlgPolicy,
- class _PopulationIterator, class _PopulationSentinel, class _SampleIterator, class _Distance,
+ class _PopulationIterator,
+ class _PopulationSentinel,
+ class _SampleIterator,
+ class _Distance,
class _UniformRandomNumberGenerator>
-_LIBCPP_HIDE_FROM_ABI
-_SampleIterator __sample(_PopulationIterator __first,
- _PopulationSentinel __last, _SampleIterator __output_iter,
- _Distance __n, _UniformRandomNumberGenerator& __g) {
- _LIBCPP_ASSERT_UNCATEGORIZED(__n >= 0, "N must be a positive number.");
+_LIBCPP_HIDE_FROM_ABI _SampleIterator __sample(
+ _PopulationIterator __first,
+ _PopulationSentinel __last,
+ _SampleIterator __output_iter,
+ _Distance __n,
+ _UniformRandomNumberGenerator& __g) {
+ _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__n >= 0, "N must be a positive number.");
using _PopIterCategory = typename _IterOps<_AlgPolicy>::template __iterator_category<_PopulationIterator>;
- using _Difference = typename _IterOps<_AlgPolicy>::template __difference_type<_PopulationIterator>;
- using _CommonType = typename common_type<_Distance, _Difference>::type;
+ using _Difference = typename _IterOps<_AlgPolicy>::template __difference_type<_PopulationIterator>;
+ using _CommonType = typename common_type<_Distance, _Difference>::type;
return std::__sample<_AlgPolicy>(
- std::move(__first), std::move(__last), std::move(__output_iter), _CommonType(__n),
- __g, _PopIterCategory());
+ std::move(__first), std::move(__last), std::move(__output_iter), _CommonType(__n), __g, _PopIterCategory());
}
#if _LIBCPP_STD_VER >= 17
-template <class _PopulationIterator, class _SampleIterator, class _Distance,
- class _UniformRandomNumberGenerator>
-inline _LIBCPP_HIDE_FROM_ABI
-_SampleIterator sample(_PopulationIterator __first,
- _PopulationIterator __last, _SampleIterator __output_iter,
- _Distance __n, _UniformRandomNumberGenerator&& __g) {
+template <class _PopulationIterator, class _SampleIterator, class _Distance, class _UniformRandomNumberGenerator>
+inline _LIBCPP_HIDE_FROM_ABI _SampleIterator
+sample(_PopulationIterator __first,
+ _PopulationIterator __last,
+ _SampleIterator __output_iter,
+ _Distance __n,
+ _UniformRandomNumberGenerator&& __g) {
static_assert(__has_forward_iterator_category<_PopulationIterator>::value ||
- __has_random_access_iterator_category<_SampleIterator>::value,
+ __has_random_access_iterator_category<_SampleIterator>::value,
"SampleIterator must meet the requirements of RandomAccessIterator");
- return std::__sample<_ClassicAlgPolicy>(
- std::move(__first), std::move(__last), std::move(__output_iter), __n, __g);
+ return std::__sample<_ClassicAlgPolicy>(std::move(__first), std::move(__last), std::move(__output_iter), __n, __g);
}
#endif // _LIBCPP_STD_VER >= 17
diff --git a/contrib/llvm-project/libcxx/include/__algorithm/search.h b/contrib/llvm-project/libcxx/include/__algorithm/search.h
index 544e127f7d4c..75f936d0f217 100644
--- a/contrib/llvm-project/libcxx/include/__algorithm/search.h
+++ b/contrib/llvm-project/libcxx/include/__algorithm/search.h
@@ -29,17 +29,15 @@
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _AlgPolicy,
- class _Iter1, class _Sent1,
- class _Iter2, class _Sent2,
+ class _Iter1,
+ class _Sent1,
+ class _Iter2,
+ class _Sent2,
class _Pred,
class _Proj1,
class _Proj2>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
-pair<_Iter1, _Iter1> __search_forward_impl(_Iter1 __first1, _Sent1 __last1,
- _Iter2 __first2, _Sent2 __last2,
- _Pred& __pred,
- _Proj1& __proj1,
- _Proj2& __proj2) {
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair<_Iter1, _Iter1> __search_forward_impl(
+ _Iter1 __first1, _Sent1 __last1, _Iter2 __first2, _Sent2 __last2, _Pred& __pred, _Proj1& __proj1, _Proj2& __proj2) {
if (__first2 == __last2)
return std::make_pair(__first1, __first1); // Everything matches an empty sequence
while (true) {
@@ -64,8 +62,7 @@ pair<_Iter1, _Iter1> __search_forward_impl(_Iter1 __first1, _Sent1 __last1,
}
// if there is a mismatch, restart with a new __first1
- if (!std::__invoke(__pred, std::__invoke(__proj1, *__m1), std::__invoke(__proj2, *__m2)))
- {
+ if (!std::__invoke(__pred, std::__invoke(__proj1, *__m1), std::__invoke(__proj2, *__m2))) {
++__first1;
break;
} // else there is a match, check next elements
@@ -74,21 +71,25 @@ pair<_Iter1, _Iter1> __search_forward_impl(_Iter1 __first1, _Sent1 __last1,
}
template <class _AlgPolicy,
- class _Iter1, class _Sent1,
- class _Iter2, class _Sent2,
+ class _Iter1,
+ class _Sent1,
+ class _Iter2,
+ class _Sent2,
class _Pred,
class _Proj1,
class _Proj2,
class _DiffT1,
class _DiffT2>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
-pair<_Iter1, _Iter1> __search_random_access_impl(_Iter1 __first1, _Sent1 __last1,
- _Iter2 __first2, _Sent2 __last2,
- _Pred& __pred,
- _Proj1& __proj1,
- _Proj2& __proj2,
- _DiffT1 __size1,
- _DiffT2 __size2) {
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair<_Iter1, _Iter1> __search_random_access_impl(
+ _Iter1 __first1,
+ _Sent1 __last1,
+ _Iter2 __first2,
+ _Sent2 __last2,
+ _Pred& __pred,
+ _Proj1& __proj1,
+ _Proj2& __proj2,
+ _DiffT1 __size1,
+ _DiffT2 __size2) {
const _Iter1 __s = __first1 + __size1 - _DiffT1(__size2 - 1); // Start of pattern match can't go beyond here
while (true) {
@@ -116,20 +117,17 @@ pair<_Iter1, _Iter1> __search_random_access_impl(_Iter1 __first1, _Sent1 __last1
}
}
-template <class _Iter1, class _Sent1,
- class _Iter2, class _Sent2,
- class _Pred,
- class _Proj1,
- class _Proj2>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
-pair<_Iter1, _Iter1> __search_impl(_Iter1 __first1, _Sent1 __last1,
- _Iter2 __first2, _Sent2 __last2,
- _Pred& __pred,
- _Proj1& __proj1,
- _Proj2& __proj2,
- __enable_if_t<__has_random_access_iterator_category<_Iter1>::value
- && __has_random_access_iterator_category<_Iter2>::value>* = nullptr) {
-
+template <class _Iter1, class _Sent1, class _Iter2, class _Sent2, class _Pred, class _Proj1, class _Proj2>
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair<_Iter1, _Iter1> __search_impl(
+ _Iter1 __first1,
+ _Sent1 __last1,
+ _Iter2 __first2,
+ _Sent2 __last2,
+ _Pred& __pred,
+ _Proj1& __proj1,
+ _Proj2& __proj2,
+ __enable_if_t<__has_random_access_iterator_category<_Iter1>::value &&
+ __has_random_access_iterator_category<_Iter2>::value>* = nullptr) {
auto __size2 = __last2 - __first2;
if (__size2 == 0)
return std::make_pair(__first1, __first1);
@@ -139,42 +137,32 @@ pair<_Iter1, _Iter1> __search_impl(_Iter1 __first1, _Sent1 __last1,
return std::make_pair(__last1, __last1);
}
- return std::__search_random_access_impl<_ClassicAlgPolicy>(__first1, __last1,
- __first2, __last2,
- __pred,
- __proj1,
- __proj2,
- __size1,
- __size2);
+ return std::__search_random_access_impl<_ClassicAlgPolicy>(
+ __first1, __last1, __first2, __last2, __pred, __proj1, __proj2, __size1, __size2);
}
-template <class _Iter1, class _Sent1,
- class _Iter2, class _Sent2,
- class _Pred,
- class _Proj1,
- class _Proj2>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
-pair<_Iter1, _Iter1> __search_impl(_Iter1 __first1, _Sent1 __last1,
- _Iter2 __first2, _Sent2 __last2,
- _Pred& __pred,
- _Proj1& __proj1,
- _Proj2& __proj2,
- __enable_if_t<__has_forward_iterator_category<_Iter1>::value
- && __has_forward_iterator_category<_Iter2>::value
- && !(__has_random_access_iterator_category<_Iter1>::value
- && __has_random_access_iterator_category<_Iter2>::value)>* = nullptr) {
- return std::__search_forward_impl<_ClassicAlgPolicy>(__first1, __last1,
- __first2, __last2,
- __pred,
- __proj1,
- __proj2);
+template <class _Iter1, class _Sent1, class _Iter2, class _Sent2, class _Pred, class _Proj1, class _Proj2>
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair<_Iter1, _Iter1> __search_impl(
+ _Iter1 __first1,
+ _Sent1 __last1,
+ _Iter2 __first2,
+ _Sent2 __last2,
+ _Pred& __pred,
+ _Proj1& __proj1,
+ _Proj2& __proj2,
+ __enable_if_t<__has_forward_iterator_category<_Iter1>::value && __has_forward_iterator_category<_Iter2>::value &&
+ !(__has_random_access_iterator_category<_Iter1>::value &&
+ __has_random_access_iterator_category<_Iter2>::value)>* = nullptr) {
+ return std::__search_forward_impl<_ClassicAlgPolicy>(__first1, __last1, __first2, __last2, __pred, __proj1, __proj2);
}
template <class _ForwardIterator1, class _ForwardIterator2, class _BinaryPredicate>
-_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-_ForwardIterator1 search(_ForwardIterator1 __first1, _ForwardIterator1 __last1,
- _ForwardIterator2 __first2, _ForwardIterator2 __last2,
- _BinaryPredicate __pred) {
+_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _ForwardIterator1
+search(_ForwardIterator1 __first1,
+ _ForwardIterator1 __last1,
+ _ForwardIterator2 __first2,
+ _ForwardIterator2 __last2,
+ _BinaryPredicate __pred) {
static_assert(__is_callable<_BinaryPredicate, decltype(*__first1), decltype(*__first2)>::value,
"BinaryPredicate has to be callable");
auto __proj = __identity();
@@ -182,9 +170,8 @@ _ForwardIterator1 search(_ForwardIterator1 __first1, _ForwardIterator1 __last1,
}
template <class _ForwardIterator1, class _ForwardIterator2>
-_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-_ForwardIterator1 search(_ForwardIterator1 __first1, _ForwardIterator1 __last1,
- _ForwardIterator2 __first2, _ForwardIterator2 __last2) {
+_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _ForwardIterator1
+search(_ForwardIterator1 __first1, _ForwardIterator1 __last1, _ForwardIterator2 __first2, _ForwardIterator2 __last2) {
return std::search(__first1, __last1, __first2, __last2, __equal_to());
}
diff --git a/contrib/llvm-project/libcxx/include/__algorithm/search_n.h b/contrib/llvm-project/libcxx/include/__algorithm/search_n.h
index 7e3ddf48a2b6..c3c01e700bf6 100644
--- a/contrib/llvm-project/libcxx/include/__algorithm/search_n.h
+++ b/contrib/llvm-project/libcxx/include/__algorithm/search_n.h
@@ -31,12 +31,8 @@
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _AlgPolicy, class _Pred, class _Iter, class _Sent, class _SizeT, class _Type, class _Proj>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
-pair<_Iter, _Iter> __search_n_forward_impl(_Iter __first, _Sent __last,
- _SizeT __count,
- const _Type& __value,
- _Pred& __pred,
- _Proj& __proj) {
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair<_Iter, _Iter> __search_n_forward_impl(
+ _Iter __first, _Sent __last, _SizeT __count, const _Type& __value, _Pred& __pred, _Proj& __proj) {
if (__count <= 0)
return std::make_pair(__first, __first);
while (true) {
@@ -62,8 +58,7 @@ pair<_Iter, _Iter> __search_n_forward_impl(_Iter __first, _Sent __last,
}
// if there is a mismatch, restart with a new __first
- if (!std::__invoke(__pred, std::__invoke(__proj, *__m), __value))
- {
+ if (!std::__invoke(__pred, std::__invoke(__proj, *__m), __value)) {
__first = __m;
++__first;
break;
@@ -73,13 +68,8 @@ pair<_Iter, _Iter> __search_n_forward_impl(_Iter __first, _Sent __last,
}
template <class _AlgPolicy, class _Pred, class _Iter, class _Sent, class _SizeT, class _Type, class _Proj, class _DiffT>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
-std::pair<_Iter, _Iter> __search_n_random_access_impl(_Iter __first, _Sent __last,
- _SizeT __count,
- const _Type& __value,
- _Pred& __pred,
- _Proj& __proj,
- _DiffT __size1) {
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 std::pair<_Iter, _Iter> __search_n_random_access_impl(
+ _Iter __first, _Sent __last, _SizeT __count, const _Type& __value, _Pred& __pred, _Proj& __proj, _DiffT __size1) {
using difference_type = typename iterator_traits<_Iter>::difference_type;
if (__count == 0)
return std::make_pair(__first, __first);
@@ -109,8 +99,7 @@ std::pair<_Iter, _Iter> __search_n_random_access_impl(_Iter __first, _Sent __las
++__m; // no need to check range on __m because __s guarantees we have enough source
// if there is a mismatch, restart with a new __first
- if (!std::__invoke(__pred, std::__invoke(__proj, *__m), __value))
- {
+ if (!std::__invoke(__pred, std::__invoke(__proj, *__m), __value)) {
__first = __m;
++__first;
break;
@@ -119,61 +108,44 @@ std::pair<_Iter, _Iter> __search_n_random_access_impl(_Iter __first, _Sent __las
}
}
-template <class _Iter, class _Sent,
- class _DiffT,
- class _Type,
- class _Pred,
- class _Proj>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
-pair<_Iter, _Iter> __search_n_impl(_Iter __first, _Sent __last,
- _DiffT __count,
- const _Type& __value,
- _Pred& __pred,
- _Proj& __proj,
- __enable_if_t<__has_random_access_iterator_category<_Iter>::value>* = nullptr) {
- return std::__search_n_random_access_impl<_ClassicAlgPolicy>(__first, __last,
- __count,
- __value,
- __pred,
- __proj,
- __last - __first);
+template <class _Iter, class _Sent, class _DiffT, class _Type, class _Pred, class _Proj>
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair<_Iter, _Iter> __search_n_impl(
+ _Iter __first,
+ _Sent __last,
+ _DiffT __count,
+ const _Type& __value,
+ _Pred& __pred,
+ _Proj& __proj,
+ __enable_if_t<__has_random_access_iterator_category<_Iter>::value>* = nullptr) {
+ return std::__search_n_random_access_impl<_ClassicAlgPolicy>(
+ __first, __last, __count, __value, __pred, __proj, __last - __first);
}
-template <class _Iter1, class _Sent1,
- class _DiffT,
- class _Type,
- class _Pred,
- class _Proj>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
-pair<_Iter1, _Iter1> __search_n_impl(_Iter1 __first, _Sent1 __last,
- _DiffT __count,
- const _Type& __value,
- _Pred& __pred,
- _Proj& __proj,
- __enable_if_t<__has_forward_iterator_category<_Iter1>::value
- && !__has_random_access_iterator_category<_Iter1>::value>* = nullptr) {
- return std::__search_n_forward_impl<_ClassicAlgPolicy>(__first, __last,
- __count,
- __value,
- __pred,
- __proj);
+template <class _Iter1, class _Sent1, class _DiffT, class _Type, class _Pred, class _Proj>
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair<_Iter1, _Iter1> __search_n_impl(
+ _Iter1 __first,
+ _Sent1 __last,
+ _DiffT __count,
+ const _Type& __value,
+ _Pred& __pred,
+ _Proj& __proj,
+ __enable_if_t<__has_forward_iterator_category<_Iter1>::value &&
+ !__has_random_access_iterator_category<_Iter1>::value>* = nullptr) {
+ return std::__search_n_forward_impl<_ClassicAlgPolicy>(__first, __last, __count, __value, __pred, __proj);
}
template <class _ForwardIterator, class _Size, class _Tp, class _BinaryPredicate>
-_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-_ForwardIterator search_n(_ForwardIterator __first, _ForwardIterator __last,
- _Size __count,
- const _Tp& __value,
- _BinaryPredicate __pred) {
- static_assert(__is_callable<_BinaryPredicate, decltype(*__first), const _Tp&>::value,
- "BinaryPredicate has to be callable");
+_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _ForwardIterator search_n(
+ _ForwardIterator __first, _ForwardIterator __last, _Size __count, const _Tp& __value, _BinaryPredicate __pred) {
+ static_assert(
+ __is_callable<_BinaryPredicate, decltype(*__first), const _Tp&>::value, "BinaryPredicate has to be callable");
auto __proj = __identity();
return std::__search_n_impl(__first, __last, std::__convert_to_integral(__count), __value, __pred, __proj).first;
}
template <class _ForwardIterator, class _Size, class _Tp>
-_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-_ForwardIterator search_n(_ForwardIterator __first, _ForwardIterator __last, _Size __count, const _Tp& __value) {
+_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _ForwardIterator
+search_n(_ForwardIterator __first, _ForwardIterator __last, _Size __count, const _Tp& __value) {
return std::search_n(__first, __last, std::__convert_to_integral(__count), __value, __equal_to());
}
diff --git a/contrib/llvm-project/libcxx/include/__algorithm/set_difference.h b/contrib/llvm-project/libcxx/include/__algorithm/set_difference.h
index 26a300092c91..a924702ce5f2 100644
--- a/contrib/llvm-project/libcxx/include/__algorithm/set_difference.h
+++ b/contrib/llvm-project/libcxx/include/__algorithm/set_difference.h
@@ -55,7 +55,7 @@ inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _OutputIterator set_d
_OutputIterator __result,
_Compare __comp) {
return std::__set_difference<_ClassicAlgPolicy, __comp_ref_type<_Compare> >(
- __first1, __last1, __first2, __last2, __result, __comp)
+ __first1, __last1, __first2, __last2, __result, __comp)
.second;
}
diff --git a/contrib/llvm-project/libcxx/include/__algorithm/shift_left.h b/contrib/llvm-project/libcxx/include/__algorithm/shift_left.h
index c9f2cbb9f7b6..645c58c29119 100644
--- a/contrib/llvm-project/libcxx/include/__algorithm/shift_left.h
+++ b/contrib/llvm-project/libcxx/include/__algorithm/shift_left.h
@@ -22,30 +22,29 @@ _LIBCPP_BEGIN_NAMESPACE_STD
#if _LIBCPP_STD_VER >= 20
template <class _ForwardIterator>
-inline _LIBCPP_HIDE_FROM_ABI constexpr
-_ForwardIterator
-shift_left(_ForwardIterator __first, _ForwardIterator __last,
- typename iterator_traits<_ForwardIterator>::difference_type __n)
-{
- if (__n == 0) {
- return __last;
+inline _LIBCPP_HIDE_FROM_ABI constexpr _ForwardIterator
+shift_left(_ForwardIterator __first,
+ _ForwardIterator __last,
+ typename iterator_traits<_ForwardIterator>::difference_type __n) {
+ if (__n == 0) {
+ return __last;
+ }
+
+ _ForwardIterator __m = __first;
+ if constexpr (__has_random_access_iterator_category<_ForwardIterator>::value) {
+ if (__n >= __last - __first) {
+ return __first;
}
-
- _ForwardIterator __m = __first;
- if constexpr (__has_random_access_iterator_category<_ForwardIterator>::value) {
- if (__n >= __last - __first) {
- return __first;
- }
- __m += __n;
- } else {
- for (; __n > 0; --__n) {
- if (__m == __last) {
- return __first;
- }
- ++__m;
- }
+ __m += __n;
+ } else {
+ for (; __n > 0; --__n) {
+ if (__m == __last) {
+ return __first;
+ }
+ ++__m;
}
- return std::move(__m, __last, __first);
+ }
+ return std::move(__m, __last, __first);
}
#endif // _LIBCPP_STD_VER >= 20
diff --git a/contrib/llvm-project/libcxx/include/__algorithm/shift_right.h b/contrib/llvm-project/libcxx/include/__algorithm/shift_right.h
index 70983e327bcb..73ef98bd39de 100644
--- a/contrib/llvm-project/libcxx/include/__algorithm/shift_right.h
+++ b/contrib/llvm-project/libcxx/include/__algorithm/shift_right.h
@@ -25,73 +25,72 @@ _LIBCPP_BEGIN_NAMESPACE_STD
#if _LIBCPP_STD_VER >= 20
template <class _ForwardIterator>
-inline _LIBCPP_HIDE_FROM_ABI constexpr
-_ForwardIterator
-shift_right(_ForwardIterator __first, _ForwardIterator __last,
- typename iterator_traits<_ForwardIterator>::difference_type __n)
-{
- if (__n == 0) {
- return __first;
- }
+inline _LIBCPP_HIDE_FROM_ABI constexpr _ForwardIterator
+shift_right(_ForwardIterator __first,
+ _ForwardIterator __last,
+ typename iterator_traits<_ForwardIterator>::difference_type __n) {
+ if (__n == 0) {
+ return __first;
+ }
- if constexpr (__has_random_access_iterator_category<_ForwardIterator>::value) {
- decltype(__n) __d = __last - __first;
- if (__n >= __d) {
- return __last;
- }
- _ForwardIterator __m = __first + (__d - __n);
- return std::move_backward(__first, __m, __last);
- } else if constexpr (__has_bidirectional_iterator_category<_ForwardIterator>::value) {
- _ForwardIterator __m = __last;
- for (; __n > 0; --__n) {
- if (__m == __first) {
- return __last;
- }
- --__m;
- }
- return std::move_backward(__first, __m, __last);
- } else {
- _ForwardIterator __ret = __first;
- for (; __n > 0; --__n) {
- if (__ret == __last) {
- return __last;
- }
- ++__ret;
- }
+ if constexpr (__has_random_access_iterator_category<_ForwardIterator>::value) {
+ decltype(__n) __d = __last - __first;
+ if (__n >= __d) {
+ return __last;
+ }
+ _ForwardIterator __m = __first + (__d - __n);
+ return std::move_backward(__first, __m, __last);
+ } else if constexpr (__has_bidirectional_iterator_category<_ForwardIterator>::value) {
+ _ForwardIterator __m = __last;
+ for (; __n > 0; --__n) {
+ if (__m == __first) {
+ return __last;
+ }
+ --__m;
+ }
+ return std::move_backward(__first, __m, __last);
+ } else {
+ _ForwardIterator __ret = __first;
+ for (; __n > 0; --__n) {
+ if (__ret == __last) {
+ return __last;
+ }
+ ++__ret;
+ }
- // We have an __n-element scratch space from __first to __ret.
- // Slide an __n-element window [__trail, __lead) from left to right.
- // We're essentially doing swap_ranges(__first, __ret, __trail, __lead)
- // over and over; but once __lead reaches __last we needn't bother
- // to save the values of elements [__trail, __last).
+ // We have an __n-element scratch space from __first to __ret.
+ // Slide an __n-element window [__trail, __lead) from left to right.
+ // We're essentially doing swap_ranges(__first, __ret, __trail, __lead)
+ // over and over; but once __lead reaches __last we needn't bother
+ // to save the values of elements [__trail, __last).
- auto __trail = __first;
- auto __lead = __ret;
- while (__trail != __ret) {
- if (__lead == __last) {
- std::move(__first, __trail, __ret);
- return __ret;
- }
- ++__trail;
- ++__lead;
- }
+ auto __trail = __first;
+ auto __lead = __ret;
+ while (__trail != __ret) {
+ if (__lead == __last) {
+ std::move(__first, __trail, __ret);
+ return __ret;
+ }
+ ++__trail;
+ ++__lead;
+ }
- _ForwardIterator __mid = __first;
- while (true) {
- if (__lead == __last) {
- __trail = std::move(__mid, __ret, __trail);
- std::move(__first, __mid, __trail);
- return __ret;
- }
- swap(*__mid, *__trail);
- ++__mid;
- ++__trail;
- ++__lead;
- if (__mid == __ret) {
- __mid = __first;
- }
- }
+ _ForwardIterator __mid = __first;
+ while (true) {
+ if (__lead == __last) {
+ __trail = std::move(__mid, __ret, __trail);
+ std::move(__first, __mid, __trail);
+ return __ret;
+ }
+ swap(*__mid, *__trail);
+ ++__mid;
+ ++__trail;
+ ++__lead;
+ if (__mid == __ret) {
+ __mid = __first;
+ }
}
+ }
}
#endif // _LIBCPP_STD_VER >= 20
diff --git a/contrib/llvm-project/libcxx/include/__algorithm/shuffle.h b/contrib/llvm-project/libcxx/include/__algorithm/shuffle.h
index 6fee88ca6ff2..c9c56ce8c2c0 100644
--- a/contrib/llvm-project/libcxx/include/__algorithm/shuffle.h
+++ b/contrib/llvm-project/libcxx/include/__algorithm/shuffle.h
@@ -32,8 +32,8 @@ class _LIBCPP_EXPORTED_FROM_ABI __libcpp_debug_randomizer {
public:
_LIBCPP_HIDE_FROM_ABI __libcpp_debug_randomizer() {
__state_ = __seed();
- __inc_ = __state_ + 0xda3e39cb94b95bdbULL;
- __inc_ = (__inc_ << 1) | 1;
+ __inc_ = __state_ + 0xda3e39cb94b95bdbULL;
+ __inc_ = (__inc_ << 1) | 1;
}
typedef uint_fast32_t result_type;
@@ -42,7 +42,7 @@ public:
_LIBCPP_HIDE_FROM_ABI result_type operator()() {
uint_fast64_t __oldstate = __state_;
- __state_ = __oldstate * 6364136223846793005ULL + __inc_;
+ __state_ = __oldstate * 6364136223846793005ULL + __inc_;
return __oldstate >> 32;
}
@@ -62,102 +62,95 @@ private:
}
};
-#if _LIBCPP_STD_VER <= 14 || defined(_LIBCPP_ENABLE_CXX17_REMOVED_RANDOM_SHUFFLE) \
- || defined(_LIBCPP_BUILDING_LIBRARY)
+#if _LIBCPP_STD_VER <= 14 || defined(_LIBCPP_ENABLE_CXX17_REMOVED_RANDOM_SHUFFLE) || defined(_LIBCPP_BUILDING_LIBRARY)
class _LIBCPP_EXPORTED_FROM_ABI __rs_default;
_LIBCPP_EXPORTED_FROM_ABI __rs_default __rs_get();
-class _LIBCPP_EXPORTED_FROM_ABI __rs_default
-{
- static unsigned __c_;
+class _LIBCPP_EXPORTED_FROM_ABI __rs_default {
+ static unsigned __c_;
+
+ __rs_default();
- __rs_default();
public:
- typedef uint_fast32_t result_type;
+ typedef uint_fast32_t result_type;
- static const result_type _Min = 0;
- static const result_type _Max = 0xFFFFFFFF;
+ static const result_type _Min = 0;
+ static const result_type _Max = 0xFFFFFFFF;
- __rs_default(const __rs_default&);
- ~__rs_default();
+ __rs_default(const __rs_default&);
+ ~__rs_default();
- result_type operator()();
+ result_type operator()();
- static _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR result_type min() {return _Min;}
- static _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR result_type max() {return _Max;}
+ static _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR result_type min() { return _Min; }
+ static _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR result_type max() { return _Max; }
- friend _LIBCPP_EXPORTED_FROM_ABI __rs_default __rs_get();
+ friend _LIBCPP_EXPORTED_FROM_ABI __rs_default __rs_get();
};
_LIBCPP_EXPORTED_FROM_ABI __rs_default __rs_get();
template <class _RandomAccessIterator>
_LIBCPP_HIDE_FROM_ABI _LIBCPP_DEPRECATED_IN_CXX14 void
-random_shuffle(_RandomAccessIterator __first, _RandomAccessIterator __last)
-{
- typedef typename iterator_traits<_RandomAccessIterator>::difference_type difference_type;
- typedef uniform_int_distribution<ptrdiff_t> _Dp;
- typedef typename _Dp::param_type _Pp;
- difference_type __d = __last - __first;
- if (__d > 1)
- {
- _Dp __uid;
- __rs_default __g = __rs_get();
- for (--__last, (void) --__d; __first < __last; ++__first, (void) --__d)
- {
- difference_type __i = __uid(__g, _Pp(0, __d));
- if (__i != difference_type(0))
- swap(*__first, *(__first + __i));
- }
+random_shuffle(_RandomAccessIterator __first, _RandomAccessIterator __last) {
+ typedef typename iterator_traits<_RandomAccessIterator>::difference_type difference_type;
+ typedef uniform_int_distribution<ptrdiff_t> _Dp;
+ typedef typename _Dp::param_type _Pp;
+ difference_type __d = __last - __first;
+ if (__d > 1) {
+ _Dp __uid;
+ __rs_default __g = __rs_get();
+ for (--__last, (void)--__d; __first < __last; ++__first, (void)--__d) {
+ difference_type __i = __uid(__g, _Pp(0, __d));
+ if (__i != difference_type(0))
+ swap(*__first, *(__first + __i));
}
+ }
}
template <class _RandomAccessIterator, class _RandomNumberGenerator>
_LIBCPP_HIDE_FROM_ABI _LIBCPP_DEPRECATED_IN_CXX14 void
-random_shuffle(_RandomAccessIterator __first, _RandomAccessIterator __last,
-#ifndef _LIBCPP_CXX03_LANG
+random_shuffle(_RandomAccessIterator __first,
+ _RandomAccessIterator __last,
+# ifndef _LIBCPP_CXX03_LANG
_RandomNumberGenerator&& __rand)
-#else
+# else
_RandomNumberGenerator& __rand)
-#endif
+# endif
{
- typedef typename iterator_traits<_RandomAccessIterator>::difference_type difference_type;
- difference_type __d = __last - __first;
- if (__d > 1)
- {
- for (--__last; __first < __last; ++__first, (void) --__d)
- {
- difference_type __i = __rand(__d);
- if (__i != difference_type(0))
- swap(*__first, *(__first + __i));
- }
+ typedef typename iterator_traits<_RandomAccessIterator>::difference_type difference_type;
+ difference_type __d = __last - __first;
+ if (__d > 1) {
+ for (--__last; __first < __last; ++__first, (void)--__d) {
+ difference_type __i = __rand(__d);
+ if (__i != difference_type(0))
+ swap(*__first, *(__first + __i));
}
+ }
}
#endif
template <class _AlgPolicy, class _RandomAccessIterator, class _Sentinel, class _UniformRandomNumberGenerator>
-_LIBCPP_HIDE_FROM_ABI _RandomAccessIterator __shuffle(
- _RandomAccessIterator __first, _Sentinel __last_sentinel, _UniformRandomNumberGenerator&& __g) {
- typedef typename iterator_traits<_RandomAccessIterator>::difference_type difference_type;
- typedef uniform_int_distribution<ptrdiff_t> _Dp;
- typedef typename _Dp::param_type _Pp;
-
- auto __original_last = _IterOps<_AlgPolicy>::next(__first, __last_sentinel);
- auto __last = __original_last;
- difference_type __d = __last - __first;
- if (__d > 1)
- {
- _Dp __uid;
- for (--__last, (void) --__d; __first < __last; ++__first, (void) --__d)
- {
- difference_type __i = __uid(__g, _Pp(0, __d));
- if (__i != difference_type(0))
- _IterOps<_AlgPolicy>::iter_swap(__first, __first + __i);
- }
+_LIBCPP_HIDE_FROM_ABI _RandomAccessIterator
+__shuffle(_RandomAccessIterator __first, _Sentinel __last_sentinel, _UniformRandomNumberGenerator&& __g) {
+ typedef typename iterator_traits<_RandomAccessIterator>::difference_type difference_type;
+ typedef uniform_int_distribution<ptrdiff_t> _Dp;
+ typedef typename _Dp::param_type _Pp;
+
+ auto __original_last = _IterOps<_AlgPolicy>::next(__first, __last_sentinel);
+ auto __last = __original_last;
+ difference_type __d = __last - __first;
+ if (__d > 1) {
+ _Dp __uid;
+ for (--__last, (void)--__d; __first < __last; ++__first, (void)--__d) {
+ difference_type __i = __uid(__g, _Pp(0, __d));
+ if (__i != difference_type(0))
+ _IterOps<_AlgPolicy>::iter_swap(__first, __first + __i);
}
+ }
- return __original_last;
+ return __original_last;
}
template <class _RandomAccessIterator, class _UniformRandomNumberGenerator>
diff --git a/contrib/llvm-project/libcxx/include/__algorithm/sift_down.h b/contrib/llvm-project/libcxx/include/__algorithm/sift_down.h
index 3a222f7c7f1b..7f152e4dbd7f 100644
--- a/contrib/llvm-project/libcxx/include/__algorithm/sift_down.h
+++ b/contrib/llvm-project/libcxx/include/__algorithm/sift_down.h
@@ -26,90 +26,89 @@ _LIBCPP_BEGIN_NAMESPACE_STD
template <class _AlgPolicy, class _Compare, class _RandomAccessIterator>
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 void
-__sift_down(_RandomAccessIterator __first, _Compare&& __comp,
+__sift_down(_RandomAccessIterator __first,
+ _Compare&& __comp,
typename iterator_traits<_RandomAccessIterator>::difference_type __len,
- _RandomAccessIterator __start)
-{
- using _Ops = _IterOps<_AlgPolicy>;
+ _RandomAccessIterator __start) {
+ using _Ops = _IterOps<_AlgPolicy>;
- typedef typename iterator_traits<_RandomAccessIterator>::difference_type difference_type;
- typedef typename iterator_traits<_RandomAccessIterator>::value_type value_type;
- // left-child of __start is at 2 * __start + 1
- // right-child of __start is at 2 * __start + 2
- difference_type __child = __start - __first;
+ typedef typename iterator_traits<_RandomAccessIterator>::difference_type difference_type;
+ typedef typename iterator_traits<_RandomAccessIterator>::value_type value_type;
+ // left-child of __start is at 2 * __start + 1
+ // right-child of __start is at 2 * __start + 2
+ difference_type __child = __start - __first;
- if (__len < 2 || (__len - 2) / 2 < __child)
- return;
+ if (__len < 2 || (__len - 2) / 2 < __child)
+ return;
- __child = 2 * __child + 1;
- _RandomAccessIterator __child_i = __first + __child;
+ __child = 2 * __child + 1;
+ _RandomAccessIterator __child_i = __first + __child;
+
+ if ((__child + 1) < __len && __comp(*__child_i, *(__child_i + difference_type(1)))) {
+ // right-child exists and is greater than left-child
+ ++__child_i;
+ ++__child;
+ }
+
+ // check if we are in heap-order
+ if (__comp(*__child_i, *__start))
+ // we are, __start is larger than its largest child
+ return;
+
+ value_type __top(_Ops::__iter_move(__start));
+ do {
+ // we are not in heap-order, swap the parent with its largest child
+ *__start = _Ops::__iter_move(__child_i);
+ __start = __child_i;
+
+ if ((__len - 2) / 2 < __child)
+ break;
+
+ // recompute the child based off of the updated parent
+ __child = 2 * __child + 1;
+ __child_i = __first + __child;
if ((__child + 1) < __len && __comp(*__child_i, *(__child_i + difference_type(1)))) {
- // right-child exists and is greater than left-child
- ++__child_i;
- ++__child;
+ // right-child exists and is greater than left-child
+ ++__child_i;
+ ++__child;
}
// check if we are in heap-order
- if (__comp(*__child_i, *__start))
- // we are, __start is larger than its largest child
- return;
-
- value_type __top(_Ops::__iter_move(__start));
- do
- {
- // we are not in heap-order, swap the parent with its largest child
- *__start = _Ops::__iter_move(__child_i);
- __start = __child_i;
-
- if ((__len - 2) / 2 < __child)
- break;
-
- // recompute the child based off of the updated parent
- __child = 2 * __child + 1;
- __child_i = __first + __child;
-
- if ((__child + 1) < __len && __comp(*__child_i, *(__child_i + difference_type(1)))) {
- // right-child exists and is greater than left-child
- ++__child_i;
- ++__child;
- }
-
- // check if we are in heap-order
- } while (!__comp(*__child_i, __top));
- *__start = std::move(__top);
+ } while (!__comp(*__child_i, __top));
+ *__start = std::move(__top);
}
template <class _AlgPolicy, class _Compare, class _RandomAccessIterator>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _RandomAccessIterator
-__floyd_sift_down(_RandomAccessIterator __first, _Compare&& __comp,
- typename iterator_traits<_RandomAccessIterator>::difference_type __len)
-{
- using difference_type = typename iterator_traits<_RandomAccessIterator>::difference_type;
- _LIBCPP_ASSERT_UNCATEGORIZED(__len >= 2, "shouldn't be called unless __len >= 2");
-
- _RandomAccessIterator __hole = __first;
- _RandomAccessIterator __child_i = __first;
- difference_type __child = 0;
-
- while (true) {
- __child_i += difference_type(__child + 1);
- __child = 2 * __child + 1;
-
- if ((__child + 1) < __len && __comp(*__child_i, *(__child_i + difference_type(1)))) {
- // right-child exists and is greater than left-child
- ++__child_i;
- ++__child;
- }
-
- // swap __hole with its largest child
- *__hole = _IterOps<_AlgPolicy>::__iter_move(__child_i);
- __hole = __child_i;
-
- // if __hole is now a leaf, we're done
- if (__child > (__len - 2) / 2)
- return __hole;
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _RandomAccessIterator __floyd_sift_down(
+ _RandomAccessIterator __first,
+ _Compare&& __comp,
+ typename iterator_traits<_RandomAccessIterator>::difference_type __len) {
+ using difference_type = typename iterator_traits<_RandomAccessIterator>::difference_type;
+ _LIBCPP_ASSERT_UNCATEGORIZED(__len >= 2, "shouldn't be called unless __len >= 2");
+
+ _RandomAccessIterator __hole = __first;
+ _RandomAccessIterator __child_i = __first;
+ difference_type __child = 0;
+
+ while (true) {
+ __child_i += difference_type(__child + 1);
+ __child = 2 * __child + 1;
+
+ if ((__child + 1) < __len && __comp(*__child_i, *(__child_i + difference_type(1)))) {
+ // right-child exists and is greater than left-child
+ ++__child_i;
+ ++__child;
}
+
+ // swap __hole with its largest child
+ *__hole = _IterOps<_AlgPolicy>::__iter_move(__child_i);
+ __hole = __child_i;
+
+ // if __hole is now a leaf, we're done
+ if (__child > (__len - 2) / 2)
+ return __hole;
+ }
}
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__algorithm/sort.h b/contrib/llvm-project/libcxx/include/__algorithm/sort.h
index 567c988ff0d3..1b878c33c7a1 100644
--- a/contrib/llvm-project/libcxx/include/__algorithm/sort.h
+++ b/contrib/llvm-project/libcxx/include/__algorithm/sort.h
@@ -44,49 +44,47 @@ _LIBCPP_BEGIN_NAMESPACE_STD
// stable, 2-3 compares, 0-2 swaps
template <class _AlgPolicy, class _Compare, class _ForwardIterator>
-_LIBCPP_HIDE_FROM_ABI
-_LIBCPP_CONSTEXPR_SINCE_CXX14 unsigned __sort3(_ForwardIterator __x, _ForwardIterator __y, _ForwardIterator __z,
- _Compare __c) {
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 unsigned
+__sort3(_ForwardIterator __x, _ForwardIterator __y, _ForwardIterator __z, _Compare __c) {
using _Ops = _IterOps<_AlgPolicy>;
unsigned __r = 0;
- if (!__c(*__y, *__x)) // if x <= y
+ if (!__c(*__y, *__x)) // if x <= y
{
- if (!__c(*__z, *__y)) // if y <= z
- return __r; // x <= y && y <= z
- // x <= y && y > z
- _Ops::iter_swap(__y, __z); // x <= z && y < z
+ if (!__c(*__z, *__y)) // if y <= z
+ return __r; // x <= y && y <= z
+ // x <= y && y > z
+ _Ops::iter_swap(__y, __z); // x <= z && y < z
__r = 1;
- if (__c(*__y, *__x)) // if x > y
+ if (__c(*__y, *__x)) // if x > y
{
- _Ops::iter_swap(__x, __y); // x < y && y <= z
+ _Ops::iter_swap(__x, __y); // x < y && y <= z
__r = 2;
}
- return __r; // x <= y && y < z
+ return __r; // x <= y && y < z
}
- if (__c(*__z, *__y)) // x > y, if y > z
+ if (__c(*__z, *__y)) // x > y, if y > z
{
- _Ops::iter_swap(__x, __z); // x < y && y < z
+ _Ops::iter_swap(__x, __z); // x < y && y < z
__r = 1;
return __r;
}
- _Ops::iter_swap(__x, __y); // x > y && y <= z
- __r = 1; // x < y && x <= z
- if (__c(*__z, *__y)) // if y > z
+ _Ops::iter_swap(__x, __y); // x > y && y <= z
+ __r = 1; // x < y && x <= z
+ if (__c(*__z, *__y)) // if y > z
{
- _Ops::iter_swap(__y, __z); // x <= y && y < z
+ _Ops::iter_swap(__y, __z); // x <= y && y < z
__r = 2;
}
return __r;
-} // x <= y && y <= z
+} // x <= y && y <= z
// stable, 3-6 compares, 0-5 swaps
template <class _AlgPolicy, class _Compare, class _ForwardIterator>
-_LIBCPP_HIDE_FROM_ABI
-void __sort4(_ForwardIterator __x1, _ForwardIterator __x2, _ForwardIterator __x3, _ForwardIterator __x4,
- _Compare __c) {
- using _Ops = _IterOps<_AlgPolicy>;
+_LIBCPP_HIDE_FROM_ABI void
+__sort4(_ForwardIterator __x1, _ForwardIterator __x2, _ForwardIterator __x3, _ForwardIterator __x4, _Compare __c) {
+ using _Ops = _IterOps<_AlgPolicy>;
std::__sort3<_AlgPolicy, _Compare>(__x1, __x2, __x3, __c);
if (__c(*__x4, *__x3)) {
_Ops::iter_swap(__x3, __x4);
@@ -102,8 +100,13 @@ void __sort4(_ForwardIterator __x1, _ForwardIterator __x2, _ForwardIterator __x3
// stable, 4-10 compares, 0-9 swaps
template <class _AlgPolicy, class _Comp, class _ForwardIterator>
-_LIBCPP_HIDE_FROM_ABI void __sort5(_ForwardIterator __x1, _ForwardIterator __x2, _ForwardIterator __x3,
- _ForwardIterator __x4, _ForwardIterator __x5, _Comp __comp) {
+_LIBCPP_HIDE_FROM_ABI void
+__sort5(_ForwardIterator __x1,
+ _ForwardIterator __x2,
+ _ForwardIterator __x3,
+ _ForwardIterator __x4,
+ _ForwardIterator __x5,
+ _Comp __comp) {
using _Ops = _IterOps<_AlgPolicy>;
std::__sort4<_AlgPolicy, _Comp>(__x1, __x2, __x3, __x4, __comp);
@@ -139,8 +142,9 @@ struct __is_simple_comparator<ranges::greater&> : true_type {};
template <class _Compare, class _Iter, class _Tp = typename iterator_traits<_Iter>::value_type>
using __use_branchless_sort =
- integral_constant<bool, __libcpp_is_contiguous_iterator<_Iter>::value && sizeof(_Tp) <= sizeof(void*) &&
- is_arithmetic<_Tp>::value && __is_simple_comparator<_Compare>::value>;
+ integral_constant<bool,
+ __libcpp_is_contiguous_iterator<_Iter>::value && sizeof(_Tp) <= sizeof(void*) &&
+ is_arithmetic<_Tp>::value && __is_simple_comparator<_Compare>::value>;
namespace __detail {
@@ -154,49 +158,56 @@ template <class _Compare, class _RandomAccessIterator>
inline _LIBCPP_HIDE_FROM_ABI void __cond_swap(_RandomAccessIterator __x, _RandomAccessIterator __y, _Compare __c) {
// Note: this function behaves correctly even with proxy iterators (because it relies on `value_type`).
using value_type = typename iterator_traits<_RandomAccessIterator>::value_type;
- bool __r = __c(*__x, *__y);
+ bool __r = __c(*__x, *__y);
value_type __tmp = __r ? *__x : *__y;
- *__y = __r ? *__y : *__x;
- *__x = __tmp;
+ *__y = __r ? *__y : *__x;
+ *__x = __tmp;
}
// Ensures that *__x, *__y and *__z are ordered according to the comparator __c,
// under the assumption that *__y and *__z are already ordered.
template <class _Compare, class _RandomAccessIterator>
-inline _LIBCPP_HIDE_FROM_ABI void __partially_sorted_swap(_RandomAccessIterator __x, _RandomAccessIterator __y,
- _RandomAccessIterator __z, _Compare __c) {
+inline _LIBCPP_HIDE_FROM_ABI void
+__partially_sorted_swap(_RandomAccessIterator __x, _RandomAccessIterator __y, _RandomAccessIterator __z, _Compare __c) {
// Note: this function behaves correctly even with proxy iterators (because it relies on `value_type`).
using value_type = typename iterator_traits<_RandomAccessIterator>::value_type;
- bool __r = __c(*__z, *__x);
+ bool __r = __c(*__z, *__x);
value_type __tmp = __r ? *__z : *__x;
- *__z = __r ? *__x : *__z;
- __r = __c(__tmp, *__y);
- *__x = __r ? *__x : *__y;
- *__y = __r ? *__y : __tmp;
+ *__z = __r ? *__x : *__z;
+ __r = __c(__tmp, *__y);
+ *__x = __r ? *__x : *__y;
+ *__y = __r ? *__y : __tmp;
}
-template <class, class _Compare, class _RandomAccessIterator,
+template <class,
+ class _Compare,
+ class _RandomAccessIterator,
__enable_if_t<__use_branchless_sort<_Compare, _RandomAccessIterator>::value, int> = 0>
-inline _LIBCPP_HIDE_FROM_ABI void
-__sort3_maybe_branchless(_RandomAccessIterator __x1, _RandomAccessIterator __x2, _RandomAccessIterator __x3,
- _Compare __c) {
+inline _LIBCPP_HIDE_FROM_ABI void __sort3_maybe_branchless(
+ _RandomAccessIterator __x1, _RandomAccessIterator __x2, _RandomAccessIterator __x3, _Compare __c) {
std::__cond_swap<_Compare>(__x2, __x3, __c);
std::__partially_sorted_swap<_Compare>(__x1, __x2, __x3, __c);
}
-template <class _AlgPolicy, class _Compare, class _RandomAccessIterator,
+template <class _AlgPolicy,
+ class _Compare,
+ class _RandomAccessIterator,
__enable_if_t<!__use_branchless_sort<_Compare, _RandomAccessIterator>::value, int> = 0>
-inline _LIBCPP_HIDE_FROM_ABI void
-__sort3_maybe_branchless(_RandomAccessIterator __x1, _RandomAccessIterator __x2, _RandomAccessIterator __x3,
- _Compare __c) {
+inline _LIBCPP_HIDE_FROM_ABI void __sort3_maybe_branchless(
+ _RandomAccessIterator __x1, _RandomAccessIterator __x2, _RandomAccessIterator __x3, _Compare __c) {
std::__sort3<_AlgPolicy, _Compare>(__x1, __x2, __x3, __c);
}
-template <class, class _Compare, class _RandomAccessIterator,
+template <class,
+ class _Compare,
+ class _RandomAccessIterator,
__enable_if_t<__use_branchless_sort<_Compare, _RandomAccessIterator>::value, int> = 0>
-inline _LIBCPP_HIDE_FROM_ABI void
-__sort4_maybe_branchless(_RandomAccessIterator __x1, _RandomAccessIterator __x2, _RandomAccessIterator __x3,
- _RandomAccessIterator __x4, _Compare __c) {
+inline _LIBCPP_HIDE_FROM_ABI void __sort4_maybe_branchless(
+ _RandomAccessIterator __x1,
+ _RandomAccessIterator __x2,
+ _RandomAccessIterator __x3,
+ _RandomAccessIterator __x4,
+ _Compare __c) {
std::__cond_swap<_Compare>(__x1, __x3, __c);
std::__cond_swap<_Compare>(__x2, __x4, __c);
std::__cond_swap<_Compare>(__x1, __x2, __c);
@@ -204,18 +215,24 @@ __sort4_maybe_branchless(_RandomAccessIterator __x1, _RandomAccessIterator __x2,
std::__cond_swap<_Compare>(__x2, __x3, __c);
}
-template <class _AlgPolicy, class _Compare, class _RandomAccessIterator,
+template <class _AlgPolicy,
+ class _Compare,
+ class _RandomAccessIterator,
__enable_if_t<!__use_branchless_sort<_Compare, _RandomAccessIterator>::value, int> = 0>
-inline _LIBCPP_HIDE_FROM_ABI void
-__sort4_maybe_branchless(_RandomAccessIterator __x1, _RandomAccessIterator __x2, _RandomAccessIterator __x3,
- _RandomAccessIterator __x4, _Compare __c) {
+inline _LIBCPP_HIDE_FROM_ABI void __sort4_maybe_branchless(
+ _RandomAccessIterator __x1,
+ _RandomAccessIterator __x2,
+ _RandomAccessIterator __x3,
+ _RandomAccessIterator __x4,
+ _Compare __c) {
std::__sort4<_AlgPolicy, _Compare>(__x1, __x2, __x3, __x4, __c);
}
-template <class _AlgPolicy, class _Compare, class _RandomAccessIterator,
+template <class _AlgPolicy,
+ class _Compare,
+ class _RandomAccessIterator,
__enable_if_t<__use_branchless_sort<_Compare, _RandomAccessIterator>::value, int> = 0>
-inline _LIBCPP_HIDE_FROM_ABI void
-__sort5_maybe_branchless(
+inline _LIBCPP_HIDE_FROM_ABI void __sort5_maybe_branchless(
_RandomAccessIterator __x1,
_RandomAccessIterator __x2,
_RandomAccessIterator __x3,
@@ -230,20 +247,25 @@ __sort5_maybe_branchless(
std::__partially_sorted_swap<_Compare>(__x2, __x3, __x4, __c);
}
-template <class _AlgPolicy, class _Compare, class _RandomAccessIterator,
+template <class _AlgPolicy,
+ class _Compare,
+ class _RandomAccessIterator,
__enable_if_t<!__use_branchless_sort<_Compare, _RandomAccessIterator>::value, int> = 0>
-inline _LIBCPP_HIDE_FROM_ABI void
-__sort5_maybe_branchless(_RandomAccessIterator __x1, _RandomAccessIterator __x2, _RandomAccessIterator __x3,
- _RandomAccessIterator __x4, _RandomAccessIterator __x5, _Compare __c) {
+inline _LIBCPP_HIDE_FROM_ABI void __sort5_maybe_branchless(
+ _RandomAccessIterator __x1,
+ _RandomAccessIterator __x2,
+ _RandomAccessIterator __x3,
+ _RandomAccessIterator __x4,
+ _RandomAccessIterator __x5,
+ _Compare __c) {
std::__sort5<_AlgPolicy, _Compare, _RandomAccessIterator>(
std::move(__x1), std::move(__x2), std::move(__x3), std::move(__x4), std::move(__x5), __c);
}
// Assumes size > 0
template <class _AlgPolicy, class _Compare, class _BidirectionalIterator>
-_LIBCPP_HIDE_FROM_ABI
-_LIBCPP_CONSTEXPR_SINCE_CXX14 void __selection_sort(_BidirectionalIterator __first, _BidirectionalIterator __last,
- _Compare __comp) {
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 void
+__selection_sort(_BidirectionalIterator __first, _BidirectionalIterator __last, _Compare __comp) {
_BidirectionalIterator __lm1 = __last;
for (--__lm1; __first != __lm1; ++__first) {
_BidirectionalIterator __i = std::__min_element<_Compare>(__first, __last, __comp);
@@ -255,8 +277,8 @@ _LIBCPP_CONSTEXPR_SINCE_CXX14 void __selection_sort(_BidirectionalIterator __fir
// Sort the iterator range [__first, __last) using the comparator __comp using
// the insertion sort algorithm.
template <class _AlgPolicy, class _Compare, class _BidirectionalIterator>
-_LIBCPP_HIDE_FROM_ABI
-void __insertion_sort(_BidirectionalIterator __first, _BidirectionalIterator __last, _Compare __comp) {
+_LIBCPP_HIDE_FROM_ABI void
+__insertion_sort(_BidirectionalIterator __first, _BidirectionalIterator __last, _Compare __comp) {
using _Ops = _IterOps<_AlgPolicy>;
typedef typename iterator_traits<_BidirectionalIterator>::value_type value_type;
@@ -292,16 +314,17 @@ __insertion_sort_unguarded(_RandomAccessIterator const __first, _RandomAccessIte
typedef typename iterator_traits<_RandomAccessIterator>::value_type value_type;
if (__first == __last)
return;
- const _RandomAccessIterator __leftmost = __first - difference_type(1); (void)__leftmost; // can be unused when assertions are disabled
+ const _RandomAccessIterator __leftmost = __first - difference_type(1);
+ (void)__leftmost; // can be unused when assertions are disabled
for (_RandomAccessIterator __i = __first + difference_type(1); __i != __last; ++__i) {
_RandomAccessIterator __j = __i - difference_type(1);
if (__comp(*__i, *__j)) {
value_type __t(_Ops::__iter_move(__i));
_RandomAccessIterator __k = __j;
- __j = __i;
+ __j = __i;
do {
*__j = _Ops::__iter_move(__k);
- __j = __k;
+ __j = __k;
_LIBCPP_ASSERT_UNCATEGORIZED(
__k != __leftmost,
"Would read out of bounds, does your comparator satisfy the strict-weak ordering requirement?");
@@ -312,8 +335,8 @@ __insertion_sort_unguarded(_RandomAccessIterator const __first, _RandomAccessIte
}
template <class _AlgPolicy, class _Comp, class _RandomAccessIterator>
-_LIBCPP_HIDE_FROM_ABI bool __insertion_sort_incomplete(
- _RandomAccessIterator __first, _RandomAccessIterator __last, _Comp __comp) {
+_LIBCPP_HIDE_FROM_ABI bool
+__insertion_sort_incomplete(_RandomAccessIterator __first, _RandomAccessIterator __last, _Comp __comp) {
using _Ops = _IterOps<_AlgPolicy>;
typedef typename iterator_traits<_RandomAccessIterator>::difference_type difference_type;
@@ -334,23 +357,27 @@ _LIBCPP_HIDE_FROM_ABI bool __insertion_sort_incomplete(
return true;
case 5:
std::__sort5_maybe_branchless<_AlgPolicy, _Comp>(
- __first, __first + difference_type(1), __first + difference_type(2), __first + difference_type(3),
- --__last, __comp);
+ __first,
+ __first + difference_type(1),
+ __first + difference_type(2),
+ __first + difference_type(3),
+ --__last,
+ __comp);
return true;
}
typedef typename iterator_traits<_RandomAccessIterator>::value_type value_type;
_RandomAccessIterator __j = __first + difference_type(2);
std::__sort3_maybe_branchless<_AlgPolicy, _Comp>(__first, __first + difference_type(1), __j, __comp);
const unsigned __limit = 8;
- unsigned __count = 0;
+ unsigned __count = 0;
for (_RandomAccessIterator __i = __j + difference_type(1); __i != __last; ++__i) {
if (__comp(*__i, *__j)) {
value_type __t(_Ops::__iter_move(__i));
_RandomAccessIterator __k = __j;
- __j = __i;
+ __j = __i;
do {
*__j = _Ops::__iter_move(__k);
- __j = __k;
+ __j = __k;
} while (__j != __first && __comp(__t, *--__k));
*__j = std::move(__t);
if (++__count == __limit)
@@ -507,8 +534,9 @@ __bitset_partition(_RandomAccessIterator __first, _RandomAccessIterator __last,
typedef typename std::iterator_traits<_RandomAccessIterator>::value_type value_type;
typedef typename std::iterator_traits<_RandomAccessIterator>::difference_type difference_type;
_LIBCPP_ASSERT_UNCATEGORIZED(__last - __first >= difference_type(3), "");
- const _RandomAccessIterator __begin = __first; // used for bounds checking, those are not moved around
- const _RandomAccessIterator __end = __last; (void)__end; //
+ const _RandomAccessIterator __begin = __first; // used for bounds checking, those are not moved around
+ const _RandomAccessIterator __end = __last;
+ (void)__end; //
value_type __pivot(_Ops::__iter_move(__first));
// Find the first element greater than the pivot.
@@ -598,8 +626,9 @@ __partition_with_equals_on_right(_RandomAccessIterator __first, _RandomAccessIte
typedef typename iterator_traits<_RandomAccessIterator>::difference_type difference_type;
typedef typename std::iterator_traits<_RandomAccessIterator>::value_type value_type;
_LIBCPP_ASSERT_UNCATEGORIZED(__last - __first >= difference_type(3), "");
- const _RandomAccessIterator __begin = __first; // used for bounds checking, those are not moved around
- const _RandomAccessIterator __end = __last; (void)__end; //
+ const _RandomAccessIterator __begin = __first; // used for bounds checking, those are not moved around
+ const _RandomAccessIterator __end = __last;
+ (void)__end; //
value_type __pivot(_Ops::__iter_move(__first));
// Find the first element greater or equal to the pivot. It will be always
// guarded because __introsort will do the median-of-three before calling
@@ -665,8 +694,9 @@ __partition_with_equals_on_left(_RandomAccessIterator __first, _RandomAccessIter
typedef typename iterator_traits<_RandomAccessIterator>::difference_type difference_type;
typedef typename std::iterator_traits<_RandomAccessIterator>::value_type value_type;
// TODO(LLVM18): Make __begin const, see https://reviews.llvm.org/D147089#4349748
- _RandomAccessIterator __begin = __first; // used for bounds checking, those are not moved around
- const _RandomAccessIterator __end = __last; (void)__end; //
+ _RandomAccessIterator __begin = __first; // used for bounds checking, those are not moved around
+ const _RandomAccessIterator __end = __last;
+ (void)__end; //
value_type __pivot(_Ops::__iter_move(__first));
if (__comp(__pivot, *(__last - difference_type(1)))) {
// Guarded.
@@ -753,8 +783,12 @@ void __introsort(_RandomAccessIterator __first,
return;
case 5:
std::__sort5_maybe_branchless<_AlgPolicy, _Compare>(
- __first, __first + difference_type(1), __first + difference_type(2), __first + difference_type(3),
- --__last, __comp);
+ __first,
+ __first + difference_type(1),
+ __first + difference_type(2),
+ __first + difference_type(3),
+ --__last,
+ __comp);
return;
}
// Use insertion sort if the length of the range is below the specified limit.
@@ -803,10 +837,10 @@ void __introsort(_RandomAccessIterator __first,
continue;
}
// Use bitset partition only if asked for.
- auto __ret =
- _UseBitSetPartition
- ? std::__bitset_partition<_AlgPolicy, _RandomAccessIterator, _Compare>(__first, __last, __comp)
- : std::__partition_with_equals_on_right<_AlgPolicy, _RandomAccessIterator, _Compare>(__first, __last, __comp);
+ auto __ret = _UseBitSetPartition
+ ? std::__bitset_partition<_AlgPolicy, _RandomAccessIterator, _Compare>(__first, __last, __comp)
+ : std::__partition_with_equals_on_right<_AlgPolicy, _RandomAccessIterator, _Compare>(
+ __first, __last, __comp);
_RandomAccessIterator __i = __ret.first;
// [__first, __i) < *__i and *__i <= [__i+1, __last)
// If we were given a perfect partition, see if insertion sort is quick...
@@ -858,19 +892,27 @@ extern template _LIBCPP_EXPORTED_FROM_ABI void __sort<__less<char>&, char*>(char
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
extern template _LIBCPP_EXPORTED_FROM_ABI void __sort<__less<wchar_t>&, wchar_t*>(wchar_t*, wchar_t*, __less<wchar_t>&);
#endif
-extern template _LIBCPP_EXPORTED_FROM_ABI void __sort<__less<signed char>&, signed char*>(signed char*, signed char*, __less<signed char>&);
-extern template _LIBCPP_EXPORTED_FROM_ABI void __sort<__less<unsigned char>&, unsigned char*>(unsigned char*, unsigned char*, __less<unsigned char>&);
+extern template _LIBCPP_EXPORTED_FROM_ABI void
+__sort<__less<signed char>&, signed char*>(signed char*, signed char*, __less<signed char>&);
+extern template _LIBCPP_EXPORTED_FROM_ABI void
+__sort<__less<unsigned char>&, unsigned char*>(unsigned char*, unsigned char*, __less<unsigned char>&);
extern template _LIBCPP_EXPORTED_FROM_ABI void __sort<__less<short>&, short*>(short*, short*, __less<short>&);
-extern template _LIBCPP_EXPORTED_FROM_ABI void __sort<__less<unsigned short>&, unsigned short*>(unsigned short*, unsigned short*, __less<unsigned short>&);
+extern template _LIBCPP_EXPORTED_FROM_ABI void
+__sort<__less<unsigned short>&, unsigned short*>(unsigned short*, unsigned short*, __less<unsigned short>&);
extern template _LIBCPP_EXPORTED_FROM_ABI void __sort<__less<int>&, int*>(int*, int*, __less<int>&);
-extern template _LIBCPP_EXPORTED_FROM_ABI void __sort<__less<unsigned>&, unsigned*>(unsigned*, unsigned*, __less<unsigned>&);
+extern template _LIBCPP_EXPORTED_FROM_ABI void
+__sort<__less<unsigned>&, unsigned*>(unsigned*, unsigned*, __less<unsigned>&);
extern template _LIBCPP_EXPORTED_FROM_ABI void __sort<__less<long>&, long*>(long*, long*, __less<long>&);
-extern template _LIBCPP_EXPORTED_FROM_ABI void __sort<__less<unsigned long>&, unsigned long*>(unsigned long*, unsigned long*, __less<unsigned long>&);
-extern template _LIBCPP_EXPORTED_FROM_ABI void __sort<__less<long long>&, long long*>(long long*, long long*, __less<long long>&);
-extern template _LIBCPP_EXPORTED_FROM_ABI void __sort<__less<unsigned long long>&, unsigned long long*>(unsigned long long*, unsigned long long*, __less<unsigned long long>&);
+extern template _LIBCPP_EXPORTED_FROM_ABI void
+__sort<__less<unsigned long>&, unsigned long*>(unsigned long*, unsigned long*, __less<unsigned long>&);
+extern template _LIBCPP_EXPORTED_FROM_ABI void
+__sort<__less<long long>&, long long*>(long long*, long long*, __less<long long>&);
+extern template _LIBCPP_EXPORTED_FROM_ABI void __sort<__less<unsigned long long>&, unsigned long long*>(
+ unsigned long long*, unsigned long long*, __less<unsigned long long>&);
extern template _LIBCPP_EXPORTED_FROM_ABI void __sort<__less<float>&, float*>(float*, float*, __less<float>&);
extern template _LIBCPP_EXPORTED_FROM_ABI void __sort<__less<double>&, double*>(double*, double*, __less<double>&);
-extern template _LIBCPP_EXPORTED_FROM_ABI void __sort<__less<long double>&, long double*>(long double*, long double*, __less<long double>&);
+extern template _LIBCPP_EXPORTED_FROM_ABI void
+__sort<__less<long double>&, long double*>(long double*, long double*, __less<long double>&);
template <class _AlgPolicy, class _RandomAccessIterator, class _Comp>
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void
@@ -884,8 +926,7 @@ __sort_dispatch(_RandomAccessIterator __first, _RandomAccessIterator __last, _Co
std::__introsort<_AlgPolicy,
_Comp&,
_RandomAccessIterator,
- __use_branchless_sort<_Comp, _RandomAccessIterator>::value>(
- __first, __last, __comp, __depth_limit);
+ __use_branchless_sort<_Comp, _RandomAccessIterator>::value>(__first, __last, __comp, __depth_limit);
}
template <class _Type, class... _Options>
@@ -941,8 +982,8 @@ _LIBCPP_HIDE_FROM_ABI void __sort_dispatch(_Type* __first, _Type* __last, ranges
#endif
template <class _AlgPolicy, class _RandomAccessIterator, class _Comp>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-void __sort_impl(_RandomAccessIterator __first, _RandomAccessIterator __last, _Comp& __comp) {
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void
+__sort_impl(_RandomAccessIterator __first, _RandomAccessIterator __last, _Comp& __comp) {
std::__debug_randomize_range<_AlgPolicy>(__first, __last);
if (__libcpp_is_constant_evaluated()) {
@@ -955,14 +996,14 @@ void __sort_impl(_RandomAccessIterator __first, _RandomAccessIterator __last, _C
}
template <class _RandomAccessIterator, class _Comp>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-void sort(_RandomAccessIterator __first, _RandomAccessIterator __last, _Comp __comp) {
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void
+sort(_RandomAccessIterator __first, _RandomAccessIterator __last, _Comp __comp) {
std::__sort_impl<_ClassicAlgPolicy>(std::move(__first), std::move(__last), __comp);
}
template <class _RandomAccessIterator>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-void sort(_RandomAccessIterator __first, _RandomAccessIterator __last) {
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void
+sort(_RandomAccessIterator __first, _RandomAccessIterator __last) {
std::sort(__first, __last, __less<>());
}
diff --git a/contrib/llvm-project/libcxx/include/__algorithm/sort_heap.h b/contrib/llvm-project/libcxx/include/__algorithm/sort_heap.h
index a82926ed1cca..0a6d992d0090 100644
--- a/contrib/llvm-project/libcxx/include/__algorithm/sort_heap.h
+++ b/contrib/llvm-project/libcxx/include/__algorithm/sort_heap.h
@@ -27,20 +27,20 @@
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _AlgPolicy, class _Compare, class _RandomAccessIterator>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
-void __sort_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare&& __comp) {
- _RandomAccessIterator __saved_last = __last;
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 void
+__sort_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare&& __comp) {
+ _RandomAccessIterator __saved_last = __last;
__comp_ref_type<_Compare> __comp_ref = __comp;
using difference_type = typename iterator_traits<_RandomAccessIterator>::difference_type;
- for (difference_type __n = __last - __first; __n > 1; --__last, (void) --__n)
+ for (difference_type __n = __last - __first; __n > 1; --__last, (void)--__n)
std::__pop_heap<_AlgPolicy>(__first, __last, __comp_ref, __n);
std::__check_strict_weak_ordering_sorted(__first, __saved_last, __comp_ref);
}
template <class _RandomAccessIterator, class _Compare>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-void sort_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp) {
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void
+sort_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp) {
static_assert(std::is_copy_constructible<_RandomAccessIterator>::value, "Iterators must be copy constructible.");
static_assert(std::is_copy_assignable<_RandomAccessIterator>::value, "Iterators must be copy assignable.");
@@ -48,8 +48,8 @@ void sort_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, _Com
}
template <class _RandomAccessIterator>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-void sort_heap(_RandomAccessIterator __first, _RandomAccessIterator __last) {
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void
+sort_heap(_RandomAccessIterator __first, _RandomAccessIterator __last) {
std::sort_heap(std::move(__first), std::move(__last), __less<>());
}
diff --git a/contrib/llvm-project/libcxx/include/__algorithm/stable_partition.h b/contrib/llvm-project/libcxx/include/__algorithm/stable_partition.h
index 0e92a0a5f73d..8762abcf18e1 100644
--- a/contrib/llvm-project/libcxx/include/__algorithm/stable_partition.h
+++ b/contrib/llvm-project/libcxx/include/__algorithm/stable_partition.h
@@ -29,296 +29,269 @@
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _AlgPolicy, class _Predicate, class _ForwardIterator, class _Distance, class _Pair>
-_LIBCPP_HIDE_FROM_ABI _ForwardIterator
-__stable_partition_impl(_ForwardIterator __first, _ForwardIterator __last, _Predicate __pred,
- _Distance __len, _Pair __p, forward_iterator_tag __fit)
-{
- using _Ops = _IterOps<_AlgPolicy>;
+_LIBCPP_HIDE_FROM_ABI _ForwardIterator __stable_partition_impl(
+ _ForwardIterator __first,
+ _ForwardIterator __last,
+ _Predicate __pred,
+ _Distance __len,
+ _Pair __p,
+ forward_iterator_tag __fit) {
+ using _Ops = _IterOps<_AlgPolicy>;
- // *__first is known to be false
- // __len >= 1
- if (__len == 1)
- return __first;
- if (__len == 2)
- {
- _ForwardIterator __m = __first;
- if (__pred(*++__m))
- {
- _Ops::iter_swap(__first, __m);
- return __m;
- }
- return __first;
+ // *__first is known to be false
+ // __len >= 1
+ if (__len == 1)
+ return __first;
+ if (__len == 2) {
+ _ForwardIterator __m = __first;
+ if (__pred(*++__m)) {
+ _Ops::iter_swap(__first, __m);
+ return __m;
}
- if (__len <= __p.second)
- { // The buffer is big enough to use
- typedef typename iterator_traits<_ForwardIterator>::value_type value_type;
- __destruct_n __d(0);
- unique_ptr<value_type, __destruct_n&> __h(__p.first, __d);
- // Move the falses into the temporary buffer, and the trues to the front of the line
- // Update __first to always point to the end of the trues
- value_type* __t = __p.first;
- ::new ((void*)__t) value_type(_Ops::__iter_move(__first));
+ return __first;
+ }
+ if (__len <= __p.second) { // The buffer is big enough to use
+ typedef typename iterator_traits<_ForwardIterator>::value_type value_type;
+ __destruct_n __d(0);
+ unique_ptr<value_type, __destruct_n&> __h(__p.first, __d);
+ // Move the falses into the temporary buffer, and the trues to the front of the line
+ // Update __first to always point to the end of the trues
+ value_type* __t = __p.first;
+ ::new ((void*)__t) value_type(_Ops::__iter_move(__first));
+ __d.template __incr<value_type>();
+ ++__t;
+ _ForwardIterator __i = __first;
+ while (++__i != __last) {
+ if (__pred(*__i)) {
+ *__first = _Ops::__iter_move(__i);
+ ++__first;
+ } else {
+ ::new ((void*)__t) value_type(_Ops::__iter_move(__i));
__d.template __incr<value_type>();
++__t;
- _ForwardIterator __i = __first;
- while (++__i != __last)
- {
- if (__pred(*__i))
- {
- *__first = _Ops::__iter_move(__i);
- ++__first;
- }
- else
- {
- ::new ((void*)__t) value_type(_Ops::__iter_move(__i));
- __d.template __incr<value_type>();
- ++__t;
- }
- }
- // All trues now at start of range, all falses in buffer
- // Move falses back into range, but don't mess up __first which points to first false
- __i = __first;
- for (value_type* __t2 = __p.first; __t2 < __t; ++__t2, (void) ++__i)
- *__i = _Ops::__iter_move(__t2);
- // __h destructs moved-from values out of the temp buffer, but doesn't deallocate buffer
- return __first;
- }
- // Else not enough buffer, do in place
- // __len >= 3
- _ForwardIterator __m = __first;
- _Distance __len2 = __len / 2; // __len2 >= 2
- _Ops::advance(__m, __len2);
- // recurse on [__first, __m), *__first know to be false
- // F?????????????????
- // f m l
- _ForwardIterator __first_false = std::__stable_partition_impl<_AlgPolicy, _Predicate&>(
- __first, __m, __pred, __len2, __p, __fit);
- // TTTFFFFF??????????
- // f ff m l
- // recurse on [__m, __last], except increase __m until *(__m) is false, *__last know to be true
- _ForwardIterator __m1 = __m;
- _ForwardIterator __second_false = __last;
- _Distance __len_half = __len - __len2;
- while (__pred(*__m1))
- {
- if (++__m1 == __last)
- goto __second_half_done;
- --__len_half;
+ }
}
- // TTTFFFFFTTTF??????
- // f ff m m1 l
- __second_false = std::__stable_partition_impl<_AlgPolicy, _Predicate&>(
- __m1, __last, __pred, __len_half, __p, __fit);
+ // All trues now at start of range, all falses in buffer
+ // Move falses back into range, but don't mess up __first which points to first false
+ __i = __first;
+ for (value_type* __t2 = __p.first; __t2 < __t; ++__t2, (void)++__i)
+ *__i = _Ops::__iter_move(__t2);
+ // __h destructs moved-from values out of the temp buffer, but doesn't deallocate buffer
+ return __first;
+ }
+ // Else not enough buffer, do in place
+ // __len >= 3
+ _ForwardIterator __m = __first;
+ _Distance __len2 = __len / 2; // __len2 >= 2
+ _Ops::advance(__m, __len2);
+ // recurse on [__first, __m), *__first know to be false
+ // F?????????????????
+ // f m l
+ _ForwardIterator __first_false =
+ std::__stable_partition_impl<_AlgPolicy, _Predicate&>(__first, __m, __pred, __len2, __p, __fit);
+ // TTTFFFFF??????????
+ // f ff m l
+ // recurse on [__m, __last], except increase __m until *(__m) is false, *__last know to be true
+ _ForwardIterator __m1 = __m;
+ _ForwardIterator __second_false = __last;
+ _Distance __len_half = __len - __len2;
+ while (__pred(*__m1)) {
+ if (++__m1 == __last)
+ goto __second_half_done;
+ --__len_half;
+ }
+ // TTTFFFFFTTTF??????
+ // f ff m m1 l
+ __second_false = std::__stable_partition_impl<_AlgPolicy, _Predicate&>(__m1, __last, __pred, __len_half, __p, __fit);
__second_half_done:
- // TTTFFFFFTTTTTFFFFF
- // f ff m sf l
- return std::__rotate<_AlgPolicy>(__first_false, __m, __second_false).first;
- // TTTTTTTTFFFFFFFFFF
- // |
+ // TTTFFFFFTTTTTFFFFF
+ // f ff m sf l
+ return std::__rotate<_AlgPolicy>(__first_false, __m, __second_false).first;
+ // TTTTTTTTFFFFFFFFFF
+ // |
}
template <class _AlgPolicy, class _Predicate, class _ForwardIterator>
_LIBCPP_HIDE_FROM_ABI _ForwardIterator
-__stable_partition_impl(_ForwardIterator __first, _ForwardIterator __last, _Predicate __pred,
- forward_iterator_tag)
-{
- typedef typename iterator_traits<_ForwardIterator>::difference_type difference_type;
- typedef typename iterator_traits<_ForwardIterator>::value_type value_type;
+__stable_partition_impl(_ForwardIterator __first, _ForwardIterator __last, _Predicate __pred, forward_iterator_tag) {
+ typedef typename iterator_traits<_ForwardIterator>::difference_type difference_type;
+ typedef typename iterator_traits<_ForwardIterator>::value_type value_type;
- const difference_type __alloc_limit = 3; // might want to make this a function of trivial assignment
- // Either prove all true and return __first or point to first false
- while (true)
- {
- if (__first == __last)
- return __first;
- if (!__pred(*__first))
- break;
- ++__first;
- }
- // We now have a reduced range [__first, __last)
- // *__first is known to be false
- difference_type __len = _IterOps<_AlgPolicy>::distance(__first, __last);
- pair<value_type*, ptrdiff_t> __p(0, 0);
- unique_ptr<value_type, __return_temporary_buffer> __h;
- if (__len >= __alloc_limit)
- {
-// TODO: Remove the use of std::get_temporary_buffer
-_LIBCPP_SUPPRESS_DEPRECATED_PUSH
- __p = std::get_temporary_buffer<value_type>(__len);
-_LIBCPP_SUPPRESS_DEPRECATED_POP
- __h.reset(__p.first);
- }
- return std::__stable_partition_impl<_AlgPolicy, _Predicate&>(
- std::move(__first), std::move(__last), __pred, __len, __p, forward_iterator_tag());
+ const difference_type __alloc_limit = 3; // might want to make this a function of trivial assignment
+ // Either prove all true and return __first or point to first false
+ while (true) {
+ if (__first == __last)
+ return __first;
+ if (!__pred(*__first))
+ break;
+ ++__first;
+ }
+ // We now have a reduced range [__first, __last)
+ // *__first is known to be false
+ difference_type __len = _IterOps<_AlgPolicy>::distance(__first, __last);
+ pair<value_type*, ptrdiff_t> __p(0, 0);
+ unique_ptr<value_type, __return_temporary_buffer> __h;
+ if (__len >= __alloc_limit) {
+ // TODO: Remove the use of std::get_temporary_buffer
+ _LIBCPP_SUPPRESS_DEPRECATED_PUSH
+ __p = std::get_temporary_buffer<value_type>(__len);
+ _LIBCPP_SUPPRESS_DEPRECATED_POP
+ __h.reset(__p.first);
+ }
+ return std::__stable_partition_impl<_AlgPolicy, _Predicate&>(
+ std::move(__first), std::move(__last), __pred, __len, __p, forward_iterator_tag());
}
template <class _AlgPolicy, class _Predicate, class _BidirectionalIterator, class _Distance, class _Pair>
-_BidirectionalIterator
-__stable_partition_impl(_BidirectionalIterator __first, _BidirectionalIterator __last, _Predicate __pred,
- _Distance __len, _Pair __p, bidirectional_iterator_tag __bit)
-{
- using _Ops = _IterOps<_AlgPolicy>;
+_BidirectionalIterator __stable_partition_impl(
+ _BidirectionalIterator __first,
+ _BidirectionalIterator __last,
+ _Predicate __pred,
+ _Distance __len,
+ _Pair __p,
+ bidirectional_iterator_tag __bit) {
+ using _Ops = _IterOps<_AlgPolicy>;
- // *__first is known to be false
- // *__last is known to be true
- // __len >= 2
- if (__len == 2)
- {
- _Ops::iter_swap(__first, __last);
- return __last;
- }
- if (__len == 3)
- {
- _BidirectionalIterator __m = __first;
- if (__pred(*++__m))
- {
- _Ops::iter_swap(__first, __m);
- _Ops::iter_swap(__m, __last);
- return __last;
- }
- _Ops::iter_swap(__m, __last);
- _Ops::iter_swap(__first, __m);
- return __m;
+ // *__first is known to be false
+ // *__last is known to be true
+ // __len >= 2
+ if (__len == 2) {
+ _Ops::iter_swap(__first, __last);
+ return __last;
+ }
+ if (__len == 3) {
+ _BidirectionalIterator __m = __first;
+ if (__pred(*++__m)) {
+ _Ops::iter_swap(__first, __m);
+ _Ops::iter_swap(__m, __last);
+ return __last;
}
- if (__len <= __p.second)
- { // The buffer is big enough to use
- typedef typename iterator_traits<_BidirectionalIterator>::value_type value_type;
- __destruct_n __d(0);
- unique_ptr<value_type, __destruct_n&> __h(__p.first, __d);
- // Move the falses into the temporary buffer, and the trues to the front of the line
- // Update __first to always point to the end of the trues
- value_type* __t = __p.first;
- ::new ((void*)__t) value_type(_Ops::__iter_move(__first));
+ _Ops::iter_swap(__m, __last);
+ _Ops::iter_swap(__first, __m);
+ return __m;
+ }
+ if (__len <= __p.second) { // The buffer is big enough to use
+ typedef typename iterator_traits<_BidirectionalIterator>::value_type value_type;
+ __destruct_n __d(0);
+ unique_ptr<value_type, __destruct_n&> __h(__p.first, __d);
+ // Move the falses into the temporary buffer, and the trues to the front of the line
+ // Update __first to always point to the end of the trues
+ value_type* __t = __p.first;
+ ::new ((void*)__t) value_type(_Ops::__iter_move(__first));
+ __d.template __incr<value_type>();
+ ++__t;
+ _BidirectionalIterator __i = __first;
+ while (++__i != __last) {
+ if (__pred(*__i)) {
+ *__first = _Ops::__iter_move(__i);
+ ++__first;
+ } else {
+ ::new ((void*)__t) value_type(_Ops::__iter_move(__i));
__d.template __incr<value_type>();
++__t;
- _BidirectionalIterator __i = __first;
- while (++__i != __last)
- {
- if (__pred(*__i))
- {
- *__first = _Ops::__iter_move(__i);
- ++__first;
- }
- else
- {
- ::new ((void*)__t) value_type(_Ops::__iter_move(__i));
- __d.template __incr<value_type>();
- ++__t;
- }
- }
- // move *__last, known to be true
- *__first = _Ops::__iter_move(__i);
- __i = ++__first;
- // All trues now at start of range, all falses in buffer
- // Move falses back into range, but don't mess up __first which points to first false
- for (value_type* __t2 = __p.first; __t2 < __t; ++__t2, (void) ++__i)
- *__i = _Ops::__iter_move(__t2);
- // __h destructs moved-from values out of the temp buffer, but doesn't deallocate buffer
- return __first;
- }
- // Else not enough buffer, do in place
- // __len >= 4
- _BidirectionalIterator __m = __first;
- _Distance __len2 = __len / 2; // __len2 >= 2
- _Ops::advance(__m, __len2);
- // recurse on [__first, __m-1], except reduce __m-1 until *(__m-1) is true, *__first know to be false
- // F????????????????T
- // f m l
- _BidirectionalIterator __m1 = __m;
- _BidirectionalIterator __first_false = __first;
- _Distance __len_half = __len2;
- while (!__pred(*--__m1))
- {
- if (__m1 == __first)
- goto __first_half_done;
- --__len_half;
+ }
}
- // F???TFFF?????????T
- // f m1 m l
- __first_false = std::__stable_partition_impl<_AlgPolicy, _Predicate&>(
- __first, __m1, __pred, __len_half, __p, __bit);
+ // move *__last, known to be true
+ *__first = _Ops::__iter_move(__i);
+ __i = ++__first;
+ // All trues now at start of range, all falses in buffer
+ // Move falses back into range, but don't mess up __first which points to first false
+ for (value_type* __t2 = __p.first; __t2 < __t; ++__t2, (void)++__i)
+ *__i = _Ops::__iter_move(__t2);
+ // __h destructs moved-from values out of the temp buffer, but doesn't deallocate buffer
+ return __first;
+ }
+ // Else not enough buffer, do in place
+ // __len >= 4
+ _BidirectionalIterator __m = __first;
+ _Distance __len2 = __len / 2; // __len2 >= 2
+ _Ops::advance(__m, __len2);
+ // recurse on [__first, __m-1], except reduce __m-1 until *(__m-1) is true, *__first know to be false
+ // F????????????????T
+ // f m l
+ _BidirectionalIterator __m1 = __m;
+ _BidirectionalIterator __first_false = __first;
+ _Distance __len_half = __len2;
+ while (!__pred(*--__m1)) {
+ if (__m1 == __first)
+ goto __first_half_done;
+ --__len_half;
+ }
+ // F???TFFF?????????T
+ // f m1 m l
+ __first_false = std::__stable_partition_impl<_AlgPolicy, _Predicate&>(__first, __m1, __pred, __len_half, __p, __bit);
__first_half_done:
- // TTTFFFFF?????????T
- // f ff m l
- // recurse on [__m, __last], except increase __m until *(__m) is false, *__last know to be true
- __m1 = __m;
- _BidirectionalIterator __second_false = __last;
- ++__second_false;
- __len_half = __len - __len2;
- while (__pred(*__m1))
- {
- if (++__m1 == __last)
- goto __second_half_done;
- --__len_half;
- }
- // TTTFFFFFTTTF?????T
- // f ff m m1 l
- __second_false = std::__stable_partition_impl<_AlgPolicy, _Predicate&>(
- __m1, __last, __pred, __len_half, __p, __bit);
+ // TTTFFFFF?????????T
+ // f ff m l
+ // recurse on [__m, __last], except increase __m until *(__m) is false, *__last know to be true
+ __m1 = __m;
+ _BidirectionalIterator __second_false = __last;
+ ++__second_false;
+ __len_half = __len - __len2;
+ while (__pred(*__m1)) {
+ if (++__m1 == __last)
+ goto __second_half_done;
+ --__len_half;
+ }
+ // TTTFFFFFTTTF?????T
+ // f ff m m1 l
+ __second_false = std::__stable_partition_impl<_AlgPolicy, _Predicate&>(__m1, __last, __pred, __len_half, __p, __bit);
__second_half_done:
- // TTTFFFFFTTTTTFFFFF
- // f ff m sf l
- return std::__rotate<_AlgPolicy>(__first_false, __m, __second_false).first;
- // TTTTTTTTFFFFFFFFFF
- // |
+ // TTTFFFFFTTTTTFFFFF
+ // f ff m sf l
+ return std::__rotate<_AlgPolicy>(__first_false, __m, __second_false).first;
+ // TTTTTTTTFFFFFFFFFF
+ // |
}
template <class _AlgPolicy, class _Predicate, class _BidirectionalIterator>
-_LIBCPP_HIDE_FROM_ABI _BidirectionalIterator
-__stable_partition_impl(_BidirectionalIterator __first, _BidirectionalIterator __last, _Predicate __pred,
- bidirectional_iterator_tag)
-{
- typedef typename iterator_traits<_BidirectionalIterator>::difference_type difference_type;
- typedef typename iterator_traits<_BidirectionalIterator>::value_type value_type;
- const difference_type __alloc_limit = 4; // might want to make this a function of trivial assignment
- // Either prove all true and return __first or point to first false
- while (true)
- {
- if (__first == __last)
- return __first;
- if (!__pred(*__first))
- break;
- ++__first;
- }
- // __first points to first false, everything prior to __first is already set.
- // Either prove [__first, __last) is all false and return __first, or point __last to last true
- do
- {
- if (__first == --__last)
- return __first;
- } while (!__pred(*__last));
- // We now have a reduced range [__first, __last]
- // *__first is known to be false
- // *__last is known to be true
- // __len >= 2
- difference_type __len = _IterOps<_AlgPolicy>::distance(__first, __last) + 1;
- pair<value_type*, ptrdiff_t> __p(0, 0);
- unique_ptr<value_type, __return_temporary_buffer> __h;
- if (__len >= __alloc_limit)
- {
-// TODO: Remove the use of std::get_temporary_buffer
-_LIBCPP_SUPPRESS_DEPRECATED_PUSH
- __p = std::get_temporary_buffer<value_type>(__len);
-_LIBCPP_SUPPRESS_DEPRECATED_POP
- __h.reset(__p.first);
- }
- return std::__stable_partition_impl<_AlgPolicy, _Predicate&>(
- std::move(__first), std::move(__last), __pred, __len, __p, bidirectional_iterator_tag());
+_LIBCPP_HIDE_FROM_ABI _BidirectionalIterator __stable_partition_impl(
+ _BidirectionalIterator __first, _BidirectionalIterator __last, _Predicate __pred, bidirectional_iterator_tag) {
+ typedef typename iterator_traits<_BidirectionalIterator>::difference_type difference_type;
+ typedef typename iterator_traits<_BidirectionalIterator>::value_type value_type;
+ const difference_type __alloc_limit = 4; // might want to make this a function of trivial assignment
+ // Either prove all true and return __first or point to first false
+ while (true) {
+ if (__first == __last)
+ return __first;
+ if (!__pred(*__first))
+ break;
+ ++__first;
+ }
+ // __first points to first false, everything prior to __first is already set.
+ // Either prove [__first, __last) is all false and return __first, or point __last to last true
+ do {
+ if (__first == --__last)
+ return __first;
+ } while (!__pred(*__last));
+ // We now have a reduced range [__first, __last]
+ // *__first is known to be false
+ // *__last is known to be true
+ // __len >= 2
+ difference_type __len = _IterOps<_AlgPolicy>::distance(__first, __last) + 1;
+ pair<value_type*, ptrdiff_t> __p(0, 0);
+ unique_ptr<value_type, __return_temporary_buffer> __h;
+ if (__len >= __alloc_limit) {
+ // TODO: Remove the use of std::get_temporary_buffer
+ _LIBCPP_SUPPRESS_DEPRECATED_PUSH
+ __p = std::get_temporary_buffer<value_type>(__len);
+ _LIBCPP_SUPPRESS_DEPRECATED_POP
+ __h.reset(__p.first);
+ }
+ return std::__stable_partition_impl<_AlgPolicy, _Predicate&>(
+ std::move(__first), std::move(__last), __pred, __len, __p, bidirectional_iterator_tag());
}
template <class _AlgPolicy, class _Predicate, class _ForwardIterator, class _IterCategory>
-_LIBCPP_HIDE_FROM_ABI
-_ForwardIterator __stable_partition(
+_LIBCPP_HIDE_FROM_ABI _ForwardIterator __stable_partition(
_ForwardIterator __first, _ForwardIterator __last, _Predicate&& __pred, _IterCategory __iter_category) {
return std::__stable_partition_impl<_AlgPolicy, __remove_cvref_t<_Predicate>&>(
std::move(__first), std::move(__last), __pred, __iter_category);
}
template <class _ForwardIterator, class _Predicate>
-inline _LIBCPP_HIDE_FROM_ABI
-_ForwardIterator
-stable_partition(_ForwardIterator __first, _ForwardIterator __last, _Predicate __pred)
-{
+inline _LIBCPP_HIDE_FROM_ABI _ForwardIterator
+stable_partition(_ForwardIterator __first, _ForwardIterator __last, _Predicate __pred) {
using _IterCategory = typename iterator_traits<_ForwardIterator>::iterator_category;
return std::__stable_partition<_ClassicAlgPolicy, _Predicate&>(
std::move(__first), std::move(__last), __pred, _IterCategory());
diff --git a/contrib/llvm-project/libcxx/include/__algorithm/stable_sort.h b/contrib/llvm-project/libcxx/include/__algorithm/stable_sort.h
index 175393fc4777..ffc6e4ce2818 100644
--- a/contrib/llvm-project/libcxx/include/__algorithm/stable_sort.h
+++ b/contrib/llvm-project/libcxx/include/__algorithm/stable_sort.h
@@ -32,9 +32,11 @@
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _AlgPolicy, class _Compare, class _BidirectionalIterator>
-_LIBCPP_HIDE_FROM_ABI
-void __insertion_sort_move(_BidirectionalIterator __first1, _BidirectionalIterator __last1,
- typename iterator_traits<_BidirectionalIterator>::value_type* __first2, _Compare __comp) {
+_LIBCPP_HIDE_FROM_ABI void __insertion_sort_move(
+ _BidirectionalIterator __first1,
+ _BidirectionalIterator __last1,
+ typename iterator_traits<_BidirectionalIterator>::value_type* __first2,
+ _Compare __comp) {
using _Ops = _IterOps<_AlgPolicy>;
typedef typename iterator_traits<_BidirectionalIterator>::value_type value_type;
@@ -63,200 +65,187 @@ void __insertion_sort_move(_BidirectionalIterator __first1, _BidirectionalIterat
}
template <class _AlgPolicy, class _Compare, class _InputIterator1, class _InputIterator2>
-_LIBCPP_HIDE_FROM_ABI void
-__merge_move_construct(_InputIterator1 __first1, _InputIterator1 __last1,
- _InputIterator2 __first2, _InputIterator2 __last2,
- typename iterator_traits<_InputIterator1>::value_type* __result, _Compare __comp)
-{
- using _Ops = _IterOps<_AlgPolicy>;
+_LIBCPP_HIDE_FROM_ABI void __merge_move_construct(
+ _InputIterator1 __first1,
+ _InputIterator1 __last1,
+ _InputIterator2 __first2,
+ _InputIterator2 __last2,
+ typename iterator_traits<_InputIterator1>::value_type* __result,
+ _Compare __comp) {
+ using _Ops = _IterOps<_AlgPolicy>;
- typedef typename iterator_traits<_InputIterator1>::value_type value_type;
- __destruct_n __d(0);
- unique_ptr<value_type, __destruct_n&> __h(__result, __d);
- for (; true; ++__result)
- {
- if (__first1 == __last1)
- {
- for (; __first2 != __last2; ++__first2, (void) ++__result, __d.template __incr<value_type>())
- ::new ((void*)__result) value_type(_Ops::__iter_move(__first2));
- __h.release();
- return;
- }
- if (__first2 == __last2)
- {
- for (; __first1 != __last1; ++__first1, (void) ++__result, __d.template __incr<value_type>())
- ::new ((void*)__result) value_type(_Ops::__iter_move(__first1));
- __h.release();
- return;
- }
- if (__comp(*__first2, *__first1))
- {
- ::new ((void*)__result) value_type(_Ops::__iter_move(__first2));
- __d.template __incr<value_type>();
- ++__first2;
- }
- else
- {
- ::new ((void*)__result) value_type(_Ops::__iter_move(__first1));
- __d.template __incr<value_type>();
- ++__first1;
- }
+ typedef typename iterator_traits<_InputIterator1>::value_type value_type;
+ __destruct_n __d(0);
+ unique_ptr<value_type, __destruct_n&> __h(__result, __d);
+ for (; true; ++__result) {
+ if (__first1 == __last1) {
+ for (; __first2 != __last2; ++__first2, (void)++__result, __d.template __incr<value_type>())
+ ::new ((void*)__result) value_type(_Ops::__iter_move(__first2));
+ __h.release();
+ return;
+ }
+ if (__first2 == __last2) {
+ for (; __first1 != __last1; ++__first1, (void)++__result, __d.template __incr<value_type>())
+ ::new ((void*)__result) value_type(_Ops::__iter_move(__first1));
+ __h.release();
+ return;
}
+ if (__comp(*__first2, *__first1)) {
+ ::new ((void*)__result) value_type(_Ops::__iter_move(__first2));
+ __d.template __incr<value_type>();
+ ++__first2;
+ } else {
+ ::new ((void*)__result) value_type(_Ops::__iter_move(__first1));
+ __d.template __incr<value_type>();
+ ++__first1;
+ }
+ }
}
template <class _AlgPolicy, class _Compare, class _InputIterator1, class _InputIterator2, class _OutputIterator>
-_LIBCPP_HIDE_FROM_ABI void
-__merge_move_assign(_InputIterator1 __first1, _InputIterator1 __last1,
- _InputIterator2 __first2, _InputIterator2 __last2,
- _OutputIterator __result, _Compare __comp)
-{
- using _Ops = _IterOps<_AlgPolicy>;
+_LIBCPP_HIDE_FROM_ABI void __merge_move_assign(
+ _InputIterator1 __first1,
+ _InputIterator1 __last1,
+ _InputIterator2 __first2,
+ _InputIterator2 __last2,
+ _OutputIterator __result,
+ _Compare __comp) {
+ using _Ops = _IterOps<_AlgPolicy>;
- for (; __first1 != __last1; ++__result)
- {
- if (__first2 == __last2)
- {
- for (; __first1 != __last1; ++__first1, (void) ++__result)
- *__result = _Ops::__iter_move(__first1);
- return;
- }
- if (__comp(*__first2, *__first1))
- {
- *__result = _Ops::__iter_move(__first2);
- ++__first2;
- }
- else
- {
- *__result = _Ops::__iter_move(__first1);
- ++__first1;
- }
+ for (; __first1 != __last1; ++__result) {
+ if (__first2 == __last2) {
+ for (; __first1 != __last1; ++__first1, (void)++__result)
+ *__result = _Ops::__iter_move(__first1);
+ return;
}
- for (; __first2 != __last2; ++__first2, (void) ++__result)
- *__result = _Ops::__iter_move(__first2);
+ if (__comp(*__first2, *__first1)) {
+ *__result = _Ops::__iter_move(__first2);
+ ++__first2;
+ } else {
+ *__result = _Ops::__iter_move(__first1);
+ ++__first1;
+ }
+ }
+ for (; __first2 != __last2; ++__first2, (void)++__result)
+ *__result = _Ops::__iter_move(__first2);
}
template <class _AlgPolicy, class _Compare, class _RandomAccessIterator>
-void
-__stable_sort(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp,
- typename iterator_traits<_RandomAccessIterator>::difference_type __len,
- typename iterator_traits<_RandomAccessIterator>::value_type* __buff, ptrdiff_t __buff_size);
+void __stable_sort(_RandomAccessIterator __first,
+ _RandomAccessIterator __last,
+ _Compare __comp,
+ typename iterator_traits<_RandomAccessIterator>::difference_type __len,
+ typename iterator_traits<_RandomAccessIterator>::value_type* __buff,
+ ptrdiff_t __buff_size);
template <class _AlgPolicy, class _Compare, class _RandomAccessIterator>
-void
-__stable_sort_move(_RandomAccessIterator __first1, _RandomAccessIterator __last1, _Compare __comp,
- typename iterator_traits<_RandomAccessIterator>::difference_type __len,
- typename iterator_traits<_RandomAccessIterator>::value_type* __first2)
-{
- using _Ops = _IterOps<_AlgPolicy>;
+void __stable_sort_move(_RandomAccessIterator __first1,
+ _RandomAccessIterator __last1,
+ _Compare __comp,
+ typename iterator_traits<_RandomAccessIterator>::difference_type __len,
+ typename iterator_traits<_RandomAccessIterator>::value_type* __first2) {
+ using _Ops = _IterOps<_AlgPolicy>;
- typedef typename iterator_traits<_RandomAccessIterator>::value_type value_type;
- switch (__len)
- {
- case 0:
- return;
- case 1:
- ::new ((void*)__first2) value_type(_Ops::__iter_move(__first1));
- return;
- case 2:
- __destruct_n __d(0);
- unique_ptr<value_type, __destruct_n&> __h2(__first2, __d);
- if (__comp(*--__last1, *__first1))
- {
- ::new ((void*)__first2) value_type(_Ops::__iter_move(__last1));
- __d.template __incr<value_type>();
- ++__first2;
- ::new ((void*)__first2) value_type(_Ops::__iter_move(__first1));
- }
- else
- {
- ::new ((void*)__first2) value_type(_Ops::__iter_move(__first1));
- __d.template __incr<value_type>();
- ++__first2;
- ::new ((void*)__first2) value_type(_Ops::__iter_move(__last1));
- }
- __h2.release();
- return;
- }
- if (__len <= 8)
- {
- std::__insertion_sort_move<_AlgPolicy, _Compare>(__first1, __last1, __first2, __comp);
- return;
+ typedef typename iterator_traits<_RandomAccessIterator>::value_type value_type;
+ switch (__len) {
+ case 0:
+ return;
+ case 1:
+ ::new ((void*)__first2) value_type(_Ops::__iter_move(__first1));
+ return;
+ case 2:
+ __destruct_n __d(0);
+ unique_ptr<value_type, __destruct_n&> __h2(__first2, __d);
+ if (__comp(*--__last1, *__first1)) {
+ ::new ((void*)__first2) value_type(_Ops::__iter_move(__last1));
+ __d.template __incr<value_type>();
+ ++__first2;
+ ::new ((void*)__first2) value_type(_Ops::__iter_move(__first1));
+ } else {
+ ::new ((void*)__first2) value_type(_Ops::__iter_move(__first1));
+ __d.template __incr<value_type>();
+ ++__first2;
+ ::new ((void*)__first2) value_type(_Ops::__iter_move(__last1));
}
- typename iterator_traits<_RandomAccessIterator>::difference_type __l2 = __len / 2;
- _RandomAccessIterator __m = __first1 + __l2;
- std::__stable_sort<_AlgPolicy, _Compare>(__first1, __m, __comp, __l2, __first2, __l2);
- std::__stable_sort<_AlgPolicy, _Compare>(__m, __last1, __comp, __len - __l2, __first2 + __l2, __len - __l2);
- std::__merge_move_construct<_AlgPolicy, _Compare>(__first1, __m, __m, __last1, __first2, __comp);
+ __h2.release();
+ return;
+ }
+ if (__len <= 8) {
+ std::__insertion_sort_move<_AlgPolicy, _Compare>(__first1, __last1, __first2, __comp);
+ return;
+ }
+ typename iterator_traits<_RandomAccessIterator>::difference_type __l2 = __len / 2;
+ _RandomAccessIterator __m = __first1 + __l2;
+ std::__stable_sort<_AlgPolicy, _Compare>(__first1, __m, __comp, __l2, __first2, __l2);
+ std::__stable_sort<_AlgPolicy, _Compare>(__m, __last1, __comp, __len - __l2, __first2 + __l2, __len - __l2);
+ std::__merge_move_construct<_AlgPolicy, _Compare>(__first1, __m, __m, __last1, __first2, __comp);
}
template <class _Tp>
-struct __stable_sort_switch
-{
- static const unsigned value = 128*is_trivially_copy_assignable<_Tp>::value;
+struct __stable_sort_switch {
+ static const unsigned value = 128 * is_trivially_copy_assignable<_Tp>::value;
};
template <class _AlgPolicy, class _Compare, class _RandomAccessIterator>
-void
-__stable_sort(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp,
- typename iterator_traits<_RandomAccessIterator>::difference_type __len,
- typename iterator_traits<_RandomAccessIterator>::value_type* __buff, ptrdiff_t __buff_size)
-{
- typedef typename iterator_traits<_RandomAccessIterator>::value_type value_type;
- typedef typename iterator_traits<_RandomAccessIterator>::difference_type difference_type;
- switch (__len)
- {
- case 0:
- case 1:
- return;
- case 2:
- if (__comp(*--__last, *__first))
- _IterOps<_AlgPolicy>::iter_swap(__first, __last);
- return;
- }
- if (__len <= static_cast<difference_type>(__stable_sort_switch<value_type>::value))
- {
- std::__insertion_sort<_AlgPolicy, _Compare>(__first, __last, __comp);
- return;
- }
- typename iterator_traits<_RandomAccessIterator>::difference_type __l2 = __len / 2;
- _RandomAccessIterator __m = __first + __l2;
- if (__len <= __buff_size)
- {
- __destruct_n __d(0);
- unique_ptr<value_type, __destruct_n&> __h2(__buff, __d);
- std::__stable_sort_move<_AlgPolicy, _Compare>(__first, __m, __comp, __l2, __buff);
- __d.__set(__l2, (value_type*)nullptr);
- std::__stable_sort_move<_AlgPolicy, _Compare>(__m, __last, __comp, __len - __l2, __buff + __l2);
- __d.__set(__len, (value_type*)nullptr);
- std::__merge_move_assign<_AlgPolicy, _Compare>(
- __buff, __buff + __l2, __buff + __l2, __buff + __len, __first, __comp);
-// std::__merge<_Compare>(move_iterator<value_type*>(__buff),
-// move_iterator<value_type*>(__buff + __l2),
-// move_iterator<_RandomAccessIterator>(__buff + __l2),
-// move_iterator<_RandomAccessIterator>(__buff + __len),
-// __first, __comp);
- return;
- }
- std::__stable_sort<_AlgPolicy, _Compare>(__first, __m, __comp, __l2, __buff, __buff_size);
- std::__stable_sort<_AlgPolicy, _Compare>(__m, __last, __comp, __len - __l2, __buff, __buff_size);
- std::__inplace_merge<_AlgPolicy>(__first, __m, __last, __comp, __l2, __len - __l2, __buff, __buff_size);
+void __stable_sort(_RandomAccessIterator __first,
+ _RandomAccessIterator __last,
+ _Compare __comp,
+ typename iterator_traits<_RandomAccessIterator>::difference_type __len,
+ typename iterator_traits<_RandomAccessIterator>::value_type* __buff,
+ ptrdiff_t __buff_size) {
+ typedef typename iterator_traits<_RandomAccessIterator>::value_type value_type;
+ typedef typename iterator_traits<_RandomAccessIterator>::difference_type difference_type;
+ switch (__len) {
+ case 0:
+ case 1:
+ return;
+ case 2:
+ if (__comp(*--__last, *__first))
+ _IterOps<_AlgPolicy>::iter_swap(__first, __last);
+ return;
+ }
+ if (__len <= static_cast<difference_type>(__stable_sort_switch<value_type>::value)) {
+ std::__insertion_sort<_AlgPolicy, _Compare>(__first, __last, __comp);
+ return;
+ }
+ typename iterator_traits<_RandomAccessIterator>::difference_type __l2 = __len / 2;
+ _RandomAccessIterator __m = __first + __l2;
+ if (__len <= __buff_size) {
+ __destruct_n __d(0);
+ unique_ptr<value_type, __destruct_n&> __h2(__buff, __d);
+ std::__stable_sort_move<_AlgPolicy, _Compare>(__first, __m, __comp, __l2, __buff);
+ __d.__set(__l2, (value_type*)nullptr);
+ std::__stable_sort_move<_AlgPolicy, _Compare>(__m, __last, __comp, __len - __l2, __buff + __l2);
+ __d.__set(__len, (value_type*)nullptr);
+ std::__merge_move_assign<_AlgPolicy, _Compare>(
+ __buff, __buff + __l2, __buff + __l2, __buff + __len, __first, __comp);
+ // std::__merge<_Compare>(move_iterator<value_type*>(__buff),
+ // move_iterator<value_type*>(__buff + __l2),
+ // move_iterator<_RandomAccessIterator>(__buff + __l2),
+ // move_iterator<_RandomAccessIterator>(__buff + __len),
+ // __first, __comp);
+ return;
+ }
+ std::__stable_sort<_AlgPolicy, _Compare>(__first, __m, __comp, __l2, __buff, __buff_size);
+ std::__stable_sort<_AlgPolicy, _Compare>(__m, __last, __comp, __len - __l2, __buff, __buff_size);
+ std::__inplace_merge<_AlgPolicy>(__first, __m, __last, __comp, __l2, __len - __l2, __buff, __buff_size);
}
template <class _AlgPolicy, class _RandomAccessIterator, class _Compare>
-inline _LIBCPP_HIDE_FROM_ABI
-void __stable_sort_impl(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare& __comp) {
- using value_type = typename iterator_traits<_RandomAccessIterator>::value_type;
+inline _LIBCPP_HIDE_FROM_ABI void
+__stable_sort_impl(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare& __comp) {
+ using value_type = typename iterator_traits<_RandomAccessIterator>::value_type;
using difference_type = typename iterator_traits<_RandomAccessIterator>::difference_type;
difference_type __len = __last - __first;
pair<value_type*, ptrdiff_t> __buf(0, 0);
unique_ptr<value_type, __return_temporary_buffer> __h;
if (__len > static_cast<difference_type>(__stable_sort_switch<value_type>::value)) {
-// TODO: Remove the use of std::get_temporary_buffer
-_LIBCPP_SUPPRESS_DEPRECATED_PUSH
- __buf = std::get_temporary_buffer<value_type>(__len);
-_LIBCPP_SUPPRESS_DEPRECATED_POP
- __h.reset(__buf.first);
+ // TODO: Remove the use of std::get_temporary_buffer
+ _LIBCPP_SUPPRESS_DEPRECATED_PUSH
+ __buf = std::get_temporary_buffer<value_type>(__len);
+ _LIBCPP_SUPPRESS_DEPRECATED_POP
+ __h.reset(__buf.first);
}
std::__stable_sort<_AlgPolicy, __comp_ref_type<_Compare> >(__first, __last, __comp, __len, __buf.first, __buf.second);
@@ -264,14 +253,13 @@ _LIBCPP_SUPPRESS_DEPRECATED_POP
}
template <class _RandomAccessIterator, class _Compare>
-inline _LIBCPP_HIDE_FROM_ABI
-void stable_sort(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp) {
+inline _LIBCPP_HIDE_FROM_ABI void
+stable_sort(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp) {
std::__stable_sort_impl<_ClassicAlgPolicy>(std::move(__first), std::move(__last), __comp);
}
template <class _RandomAccessIterator>
-inline _LIBCPP_HIDE_FROM_ABI
-void stable_sort(_RandomAccessIterator __first, _RandomAccessIterator __last) {
+inline _LIBCPP_HIDE_FROM_ABI void stable_sort(_RandomAccessIterator __first, _RandomAccessIterator __last) {
std::stable_sort(__first, __last, __less<>());
}
diff --git a/contrib/llvm-project/libcxx/include/__algorithm/swap_ranges.h b/contrib/llvm-project/libcxx/include/__algorithm/swap_ranges.h
index 96eba7484bf4..7fab5c49a656 100644
--- a/contrib/llvm-project/libcxx/include/__algorithm/swap_ranges.h
+++ b/contrib/llvm-project/libcxx/include/__algorithm/swap_ranges.h
@@ -22,8 +22,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
// 2+2 iterators: the shorter size will be used.
template <class _AlgPolicy, class _ForwardIterator1, class _Sentinel1, class _ForwardIterator2, class _Sentinel2>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-pair<_ForwardIterator1, _ForwardIterator2>
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 pair<_ForwardIterator1, _ForwardIterator2>
__swap_ranges(_ForwardIterator1 __first1, _Sentinel1 __last1, _ForwardIterator2 __first2, _Sentinel2 __last2) {
while (__first1 != __last1 && __first2 != __last2) {
_IterOps<_AlgPolicy>::iter_swap(__first1, __first2);
@@ -36,8 +35,7 @@ __swap_ranges(_ForwardIterator1 __first1, _Sentinel1 __last1, _ForwardIterator2
// 2+1 iterators: size2 >= size1.
template <class _AlgPolicy, class _ForwardIterator1, class _Sentinel1, class _ForwardIterator2>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-pair<_ForwardIterator1, _ForwardIterator2>
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 pair<_ForwardIterator1, _ForwardIterator2>
__swap_ranges(_ForwardIterator1 __first1, _Sentinel1 __last1, _ForwardIterator2 __first2) {
while (__first1 != __last1) {
_IterOps<_AlgPolicy>::iter_swap(__first1, __first2);
@@ -51,8 +49,7 @@ __swap_ranges(_ForwardIterator1 __first1, _Sentinel1 __last1, _ForwardIterator2
template <class _ForwardIterator1, class _ForwardIterator2>
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _ForwardIterator2
swap_ranges(_ForwardIterator1 __first1, _ForwardIterator1 __last1, _ForwardIterator2 __first2) {
- return std::__swap_ranges<_ClassicAlgPolicy>(
- std::move(__first1), std::move(__last1), std::move(__first2)).second;
+ return std::__swap_ranges<_ClassicAlgPolicy>(std::move(__first1), std::move(__last1), std::move(__first2)).second;
}
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__algorithm/transform.h b/contrib/llvm-project/libcxx/include/__algorithm/transform.h
index 76b9bb780cf9..1b424409591c 100644
--- a/contrib/llvm-project/libcxx/include/__algorithm/transform.h
+++ b/contrib/llvm-project/libcxx/include/__algorithm/transform.h
@@ -18,24 +18,23 @@
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _InputIterator, class _OutputIterator, class _UnaryOperation>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-_OutputIterator
-transform(_InputIterator __first, _InputIterator __last, _OutputIterator __result, _UnaryOperation __op)
-{
- for (; __first != __last; ++__first, (void) ++__result)
- *__result = __op(*__first);
- return __result;
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _OutputIterator
+transform(_InputIterator __first, _InputIterator __last, _OutputIterator __result, _UnaryOperation __op) {
+ for (; __first != __last; ++__first, (void)++__result)
+ *__result = __op(*__first);
+ return __result;
}
template <class _InputIterator1, class _InputIterator2, class _OutputIterator, class _BinaryOperation>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-_OutputIterator
-transform(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2,
- _OutputIterator __result, _BinaryOperation __binary_op)
-{
- for (; __first1 != __last1; ++__first1, (void) ++__first2, ++__result)
- *__result = __binary_op(*__first1, *__first2);
- return __result;
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _OutputIterator transform(
+ _InputIterator1 __first1,
+ _InputIterator1 __last1,
+ _InputIterator2 __first2,
+ _OutputIterator __result,
+ _BinaryOperation __binary_op) {
+ for (; __first1 != __last1; ++__first1, (void)++__first2, ++__result)
+ *__result = __binary_op(*__first1, *__first2);
+ return __result;
}
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__algorithm/uniform_random_bit_generator_adaptor.h b/contrib/llvm-project/libcxx/include/__algorithm/uniform_random_bit_generator_adaptor.h
index 1f2039949d74..aef0fbfb7c28 100644
--- a/contrib/llvm-project/libcxx/include/__algorithm/uniform_random_bit_generator_adaptor.h
+++ b/contrib/llvm-project/libcxx/include/__algorithm/uniform_random_bit_generator_adaptor.h
@@ -20,7 +20,7 @@
#if _LIBCPP_STD_VER >= 20
_LIBCPP_PUSH_MACROS
-#include <__undef_macros>
+# include <__undef_macros>
_LIBCPP_BEGIN_NAMESPACE_STD
@@ -41,16 +41,12 @@ private:
public:
using result_type = invoke_result_t<_Gen&>;
- _LIBCPP_HIDE_FROM_ABI
- static constexpr auto min() { return __remove_cvref_t<_Gen>::min(); }
- _LIBCPP_HIDE_FROM_ABI
- static constexpr auto max() { return __remove_cvref_t<_Gen>::max(); }
+ _LIBCPP_HIDE_FROM_ABI static constexpr auto min() { return __remove_cvref_t<_Gen>::min(); }
+ _LIBCPP_HIDE_FROM_ABI static constexpr auto max() { return __remove_cvref_t<_Gen>::max(); }
- _LIBCPP_HIDE_FROM_ABI
- constexpr explicit _ClassicGenAdaptor(_Gen& __g) : __gen_(__g) {}
+ _LIBCPP_HIDE_FROM_ABI constexpr explicit _ClassicGenAdaptor(_Gen& __g) : __gen_(__g) {}
- _LIBCPP_HIDE_FROM_ABI
- constexpr auto operator()() const { return __gen_(); }
+ _LIBCPP_HIDE_FROM_ABI constexpr auto operator()() const { return __gen_(); }
};
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__algorithm/unwrap_iter.h b/contrib/llvm-project/libcxx/include/__algorithm/unwrap_iter.h
index 91346e3c1bd2..a298a2b27105 100644
--- a/contrib/llvm-project/libcxx/include/__algorithm/unwrap_iter.h
+++ b/contrib/llvm-project/libcxx/include/__algorithm/unwrap_iter.h
@@ -57,11 +57,11 @@ struct __unwrap_iter_impl<_Iter, true> {
}
};
-template<class _Iter,
- class _Impl = __unwrap_iter_impl<_Iter>,
- __enable_if_t<is_copy_constructible<_Iter>::value, int> = 0>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
-decltype(_Impl::__unwrap(std::declval<_Iter>())) __unwrap_iter(_Iter __i) _NOEXCEPT {
+template <class _Iter,
+ class _Impl = __unwrap_iter_impl<_Iter>,
+ __enable_if_t<is_copy_constructible<_Iter>::value, int> = 0>
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 decltype(_Impl::__unwrap(std::declval<_Iter>()))
+__unwrap_iter(_Iter __i) _NOEXCEPT {
return _Impl::__unwrap(__i);
}
diff --git a/contrib/llvm-project/libcxx/include/__atomic/atomic.h b/contrib/llvm-project/libcxx/include/__atomic/atomic.h
index 449802a2e304..3dfb6937d032 100644
--- a/contrib/llvm-project/libcxx/include/__atomic/atomic.h
+++ b/contrib/llvm-project/libcxx/include/__atomic/atomic.h
@@ -33,241 +33,220 @@
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _Tp>
-struct atomic
- : public __atomic_base<_Tp>
-{
+struct atomic : public __atomic_base<_Tp> {
using __base = __atomic_base<_Tp>;
using value_type = _Tp;
using difference_type = value_type;
#if _LIBCPP_STD_VER >= 20
- _LIBCPP_HIDE_FROM_ABI
- atomic() = default;
+ _LIBCPP_HIDE_FROM_ABI atomic() = default;
#else
- _LIBCPP_HIDE_FROM_ABI
- atomic() _NOEXCEPT = default;
+ _LIBCPP_HIDE_FROM_ABI atomic() _NOEXCEPT = default;
#endif
- _LIBCPP_HIDE_FROM_ABI
- _LIBCPP_CONSTEXPR atomic(_Tp __d) _NOEXCEPT : __base(__d) {}
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR atomic(_Tp __d) _NOEXCEPT : __base(__d) {}
- _LIBCPP_HIDE_FROM_ABI
- _Tp operator=(_Tp __d) volatile _NOEXCEPT
- {__base::store(__d); return __d;}
- _LIBCPP_HIDE_FROM_ABI
- _Tp operator=(_Tp __d) _NOEXCEPT
- {__base::store(__d); return __d;}
+ _LIBCPP_HIDE_FROM_ABI _Tp operator=(_Tp __d) volatile _NOEXCEPT {
+ __base::store(__d);
+ return __d;
+ }
+ _LIBCPP_HIDE_FROM_ABI _Tp operator=(_Tp __d) _NOEXCEPT {
+ __base::store(__d);
+ return __d;
+ }
- atomic& operator=(const atomic&) = delete;
- atomic& operator=(const atomic&) volatile = delete;
+ atomic& operator=(const atomic&) = delete;
+ atomic& operator=(const atomic&) volatile = delete;
};
// atomic<T*>
template <class _Tp>
-struct atomic<_Tp*>
- : public __atomic_base<_Tp*>
-{
- using __base = __atomic_base<_Tp*>;
- using value_type = _Tp*;
- using difference_type = ptrdiff_t;
-
- _LIBCPP_HIDE_FROM_ABI
- atomic() _NOEXCEPT = default;
-
- _LIBCPP_HIDE_FROM_ABI
- _LIBCPP_CONSTEXPR atomic(_Tp* __d) _NOEXCEPT : __base(__d) {}
-
- _LIBCPP_HIDE_FROM_ABI
- _Tp* operator=(_Tp* __d) volatile _NOEXCEPT
- {__base::store(__d); return __d;}
- _LIBCPP_HIDE_FROM_ABI
- _Tp* operator=(_Tp* __d) _NOEXCEPT
- {__base::store(__d); return __d;}
-
- _LIBCPP_HIDE_FROM_ABI
- _Tp* fetch_add(ptrdiff_t __op, memory_order __m = memory_order_seq_cst) volatile _NOEXCEPT {
- // __atomic_fetch_add accepts function pointers, guard against them.
- static_assert(!is_function<__remove_pointer_t<_Tp> >::value, "Pointer to function isn't allowed");
- return std::__cxx_atomic_fetch_add(std::addressof(this->__a_), __op, __m);
- }
-
- _LIBCPP_HIDE_FROM_ABI
- _Tp* fetch_add(ptrdiff_t __op, memory_order __m = memory_order_seq_cst) _NOEXCEPT {
- // __atomic_fetch_add accepts function pointers, guard against them.
- static_assert(!is_function<__remove_pointer_t<_Tp> >::value, "Pointer to function isn't allowed");
- return std::__cxx_atomic_fetch_add(std::addressof(this->__a_), __op, __m);
- }
-
- _LIBCPP_HIDE_FROM_ABI
- _Tp* fetch_sub(ptrdiff_t __op, memory_order __m = memory_order_seq_cst) volatile _NOEXCEPT {
- // __atomic_fetch_add accepts function pointers, guard against them.
- static_assert(!is_function<__remove_pointer_t<_Tp> >::value, "Pointer to function isn't allowed");
- return std::__cxx_atomic_fetch_sub(std::addressof(this->__a_), __op, __m);
- }
-
- _LIBCPP_HIDE_FROM_ABI
- _Tp* fetch_sub(ptrdiff_t __op, memory_order __m = memory_order_seq_cst) _NOEXCEPT {
- // __atomic_fetch_add accepts function pointers, guard against them.
- static_assert(!is_function<__remove_pointer_t<_Tp> >::value, "Pointer to function isn't allowed");
- return std::__cxx_atomic_fetch_sub(std::addressof(this->__a_), __op, __m);
- }
-
- _LIBCPP_HIDE_FROM_ABI
- _Tp* operator++(int) volatile _NOEXCEPT {return fetch_add(1);}
- _LIBCPP_HIDE_FROM_ABI
- _Tp* operator++(int) _NOEXCEPT {return fetch_add(1);}
- _LIBCPP_HIDE_FROM_ABI
- _Tp* operator--(int) volatile _NOEXCEPT {return fetch_sub(1);}
- _LIBCPP_HIDE_FROM_ABI
- _Tp* operator--(int) _NOEXCEPT {return fetch_sub(1);}
- _LIBCPP_HIDE_FROM_ABI
- _Tp* operator++() volatile _NOEXCEPT {return fetch_add(1) + 1;}
- _LIBCPP_HIDE_FROM_ABI
- _Tp* operator++() _NOEXCEPT {return fetch_add(1) + 1;}
- _LIBCPP_HIDE_FROM_ABI
- _Tp* operator--() volatile _NOEXCEPT {return fetch_sub(1) - 1;}
- _LIBCPP_HIDE_FROM_ABI
- _Tp* operator--() _NOEXCEPT {return fetch_sub(1) - 1;}
- _LIBCPP_HIDE_FROM_ABI
- _Tp* operator+=(ptrdiff_t __op) volatile _NOEXCEPT {return fetch_add(__op) + __op;}
- _LIBCPP_HIDE_FROM_ABI
- _Tp* operator+=(ptrdiff_t __op) _NOEXCEPT {return fetch_add(__op) + __op;}
- _LIBCPP_HIDE_FROM_ABI
- _Tp* operator-=(ptrdiff_t __op) volatile _NOEXCEPT {return fetch_sub(__op) - __op;}
- _LIBCPP_HIDE_FROM_ABI
- _Tp* operator-=(ptrdiff_t __op) _NOEXCEPT {return fetch_sub(__op) - __op;}
-
- atomic& operator=(const atomic&) = delete;
- atomic& operator=(const atomic&) volatile = delete;
+struct atomic<_Tp*> : public __atomic_base<_Tp*> {
+ using __base = __atomic_base<_Tp*>;
+ using value_type = _Tp*;
+ using difference_type = ptrdiff_t;
+
+ _LIBCPP_HIDE_FROM_ABI atomic() _NOEXCEPT = default;
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR atomic(_Tp* __d) _NOEXCEPT : __base(__d) {}
+
+ _LIBCPP_HIDE_FROM_ABI _Tp* operator=(_Tp* __d) volatile _NOEXCEPT {
+ __base::store(__d);
+ return __d;
+ }
+ _LIBCPP_HIDE_FROM_ABI _Tp* operator=(_Tp* __d) _NOEXCEPT {
+ __base::store(__d);
+ return __d;
+ }
+
+ _LIBCPP_HIDE_FROM_ABI _Tp* fetch_add(ptrdiff_t __op, memory_order __m = memory_order_seq_cst) volatile _NOEXCEPT {
+ // __atomic_fetch_add accepts function pointers, guard against them.
+ static_assert(!is_function<__remove_pointer_t<_Tp> >::value, "Pointer to function isn't allowed");
+ return std::__cxx_atomic_fetch_add(std::addressof(this->__a_), __op, __m);
+ }
+
+ _LIBCPP_HIDE_FROM_ABI _Tp* fetch_add(ptrdiff_t __op, memory_order __m = memory_order_seq_cst) _NOEXCEPT {
+ // __atomic_fetch_add accepts function pointers, guard against them.
+ static_assert(!is_function<__remove_pointer_t<_Tp> >::value, "Pointer to function isn't allowed");
+ return std::__cxx_atomic_fetch_add(std::addressof(this->__a_), __op, __m);
+ }
+
+ _LIBCPP_HIDE_FROM_ABI _Tp* fetch_sub(ptrdiff_t __op, memory_order __m = memory_order_seq_cst) volatile _NOEXCEPT {
+ // __atomic_fetch_add accepts function pointers, guard against them.
+ static_assert(!is_function<__remove_pointer_t<_Tp> >::value, "Pointer to function isn't allowed");
+ return std::__cxx_atomic_fetch_sub(std::addressof(this->__a_), __op, __m);
+ }
+
+ _LIBCPP_HIDE_FROM_ABI _Tp* fetch_sub(ptrdiff_t __op, memory_order __m = memory_order_seq_cst) _NOEXCEPT {
+ // __atomic_fetch_add accepts function pointers, guard against them.
+ static_assert(!is_function<__remove_pointer_t<_Tp> >::value, "Pointer to function isn't allowed");
+ return std::__cxx_atomic_fetch_sub(std::addressof(this->__a_), __op, __m);
+ }
+
+ _LIBCPP_HIDE_FROM_ABI _Tp* operator++(int) volatile _NOEXCEPT { return fetch_add(1); }
+ _LIBCPP_HIDE_FROM_ABI _Tp* operator++(int) _NOEXCEPT { return fetch_add(1); }
+ _LIBCPP_HIDE_FROM_ABI _Tp* operator--(int) volatile _NOEXCEPT { return fetch_sub(1); }
+ _LIBCPP_HIDE_FROM_ABI _Tp* operator--(int) _NOEXCEPT { return fetch_sub(1); }
+ _LIBCPP_HIDE_FROM_ABI _Tp* operator++() volatile _NOEXCEPT { return fetch_add(1) + 1; }
+ _LIBCPP_HIDE_FROM_ABI _Tp* operator++() _NOEXCEPT { return fetch_add(1) + 1; }
+ _LIBCPP_HIDE_FROM_ABI _Tp* operator--() volatile _NOEXCEPT { return fetch_sub(1) - 1; }
+ _LIBCPP_HIDE_FROM_ABI _Tp* operator--() _NOEXCEPT { return fetch_sub(1) - 1; }
+ _LIBCPP_HIDE_FROM_ABI _Tp* operator+=(ptrdiff_t __op) volatile _NOEXCEPT { return fetch_add(__op) + __op; }
+ _LIBCPP_HIDE_FROM_ABI _Tp* operator+=(ptrdiff_t __op) _NOEXCEPT { return fetch_add(__op) + __op; }
+ _LIBCPP_HIDE_FROM_ABI _Tp* operator-=(ptrdiff_t __op) volatile _NOEXCEPT { return fetch_sub(__op) - __op; }
+ _LIBCPP_HIDE_FROM_ABI _Tp* operator-=(ptrdiff_t __op) _NOEXCEPT { return fetch_sub(__op) - __op; }
+
+ atomic& operator=(const atomic&) = delete;
+ atomic& operator=(const atomic&) volatile = delete;
};
#if _LIBCPP_STD_VER >= 20
template <class _Tp>
requires is_floating_point_v<_Tp>
struct atomic<_Tp> : __atomic_base<_Tp> {
- private:
- _LIBCPP_HIDE_FROM_ABI static constexpr bool __is_fp80_long_double() {
- // Only x87-fp80 long double has 64-bit mantissa
- return __LDBL_MANT_DIG__ == 64 && std::is_same_v<_Tp, long double>;
- }
+private:
+ _LIBCPP_HIDE_FROM_ABI static constexpr bool __is_fp80_long_double() {
+ // Only x87-fp80 long double has 64-bit mantissa
+ return __LDBL_MANT_DIG__ == 64 && std::is_same_v<_Tp, long double>;
+ }
- _LIBCPP_HIDE_FROM_ABI static constexpr bool __has_rmw_builtin() {
+ _LIBCPP_HIDE_FROM_ABI static constexpr bool __has_rmw_builtin() {
# ifndef _LIBCPP_COMPILER_CLANG_BASED
- return false;
+ return false;
# else
- // The builtin __cxx_atomic_fetch_add errors during compilation for
- // long double on platforms with fp80 format.
- // For more details, see
- // lib/Sema/SemaChecking.cpp function IsAllowedValueType
- // LLVM Parser does not allow atomicrmw with x86_fp80 type.
- // if (ValType->isSpecificBuiltinType(BuiltinType::LongDouble) &&
- // &Context.getTargetInfo().getLongDoubleFormat() ==
- // &llvm::APFloat::x87DoubleExtended())
- // For more info
- // https://github.com/llvm/llvm-project/issues/68602
- // https://reviews.llvm.org/D53965
- return !__is_fp80_long_double();
+ // The builtin __cxx_atomic_fetch_add errors during compilation for
+ // long double on platforms with fp80 format.
+ // For more details, see
+ // lib/Sema/SemaChecking.cpp function IsAllowedValueType
+ // LLVM Parser does not allow atomicrmw with x86_fp80 type.
+ // if (ValType->isSpecificBuiltinType(BuiltinType::LongDouble) &&
+ // &Context.getTargetInfo().getLongDoubleFormat() ==
+ // &llvm::APFloat::x87DoubleExtended())
+ // For more info
+ // https://github.com/llvm/llvm-project/issues/68602
+ // https://reviews.llvm.org/D53965
+ return !__is_fp80_long_double();
# endif
- }
-
- template <class _This, class _Operation, class _BuiltinOp>
- _LIBCPP_HIDE_FROM_ABI static _Tp
- __rmw_op(_This&& __self, _Tp __operand, memory_order __m, _Operation __operation, _BuiltinOp __builtin_op) {
- if constexpr (__has_rmw_builtin()) {
- return __builtin_op(std::addressof(std::forward<_This>(__self).__a_), __operand, __m);
- } else {
- _Tp __old = __self.load(memory_order_relaxed);
- _Tp __new = __operation(__old, __operand);
- while (!__self.compare_exchange_weak(__old, __new, __m, memory_order_relaxed)) {
+ }
+
+ template <class _This, class _Operation, class _BuiltinOp>
+ _LIBCPP_HIDE_FROM_ABI static _Tp
+ __rmw_op(_This&& __self, _Tp __operand, memory_order __m, _Operation __operation, _BuiltinOp __builtin_op) {
+ if constexpr (__has_rmw_builtin()) {
+ return __builtin_op(std::addressof(std::forward<_This>(__self).__a_), __operand, __m);
+ } else {
+ _Tp __old = __self.load(memory_order_relaxed);
+ _Tp __new = __operation(__old, __operand);
+ while (!__self.compare_exchange_weak(__old, __new, __m, memory_order_relaxed)) {
# ifdef _LIBCPP_COMPILER_CLANG_BASED
- if constexpr (__is_fp80_long_double()) {
- // https://github.com/llvm/llvm-project/issues/47978
- // clang bug: __old is not updated on failure for atomic<long double>::compare_exchange_weak
- // Note __old = __self.load(memory_order_relaxed) will not work
- std::__cxx_atomic_load_inplace(std::addressof(__self.__a_), &__old, memory_order_relaxed);
- }
-# endif
- __new = __operation(__old, __operand);
- }
- return __old;
+ if constexpr (__is_fp80_long_double()) {
+ // https://github.com/llvm/llvm-project/issues/47978
+ // clang bug: __old is not updated on failure for atomic<long double>::compare_exchange_weak
+ // Note __old = __self.load(memory_order_relaxed) will not work
+ std::__cxx_atomic_load_inplace(std::addressof(__self.__a_), &__old, memory_order_relaxed);
}
+# endif
+ __new = __operation(__old, __operand);
+ }
+ return __old;
}
+ }
+
+ template <class _This>
+ _LIBCPP_HIDE_FROM_ABI static _Tp __fetch_add(_This&& __self, _Tp __operand, memory_order __m) {
+ auto __builtin_op = [](auto __a, auto __builtin_operand, auto __order) {
+ return std::__cxx_atomic_fetch_add(__a, __builtin_operand, __order);
+ };
+ return __rmw_op(std::forward<_This>(__self), __operand, __m, std::plus<>{}, __builtin_op);
+ }
+
+ template <class _This>
+ _LIBCPP_HIDE_FROM_ABI static _Tp __fetch_sub(_This&& __self, _Tp __operand, memory_order __m) {
+ auto __builtin_op = [](auto __a, auto __builtin_operand, auto __order) {
+ return std::__cxx_atomic_fetch_sub(__a, __builtin_operand, __order);
+ };
+ return __rmw_op(std::forward<_This>(__self), __operand, __m, std::minus<>{}, __builtin_op);
+ }
+
+public:
+ using __base = __atomic_base<_Tp>;
+ using value_type = _Tp;
+ using difference_type = value_type;
- template <class _This>
- _LIBCPP_HIDE_FROM_ABI static _Tp __fetch_add(_This&& __self, _Tp __operand, memory_order __m) {
- auto __builtin_op = [](auto __a, auto __builtin_operand, auto __order) {
- return std::__cxx_atomic_fetch_add(__a, __builtin_operand, __order);
- };
- return __rmw_op(std::forward<_This>(__self), __operand, __m, std::plus<>{}, __builtin_op);
- }
-
- template <class _This>
- _LIBCPP_HIDE_FROM_ABI static _Tp __fetch_sub(_This&& __self, _Tp __operand, memory_order __m) {
- auto __builtin_op = [](auto __a, auto __builtin_operand, auto __order) {
- return std::__cxx_atomic_fetch_sub(__a, __builtin_operand, __order);
- };
- return __rmw_op(std::forward<_This>(__self), __operand, __m, std::minus<>{}, __builtin_op);
- }
-
- public:
- using __base = __atomic_base<_Tp>;
- using value_type = _Tp;
- using difference_type = value_type;
-
- _LIBCPP_HIDE_FROM_ABI constexpr atomic() noexcept = default;
- _LIBCPP_HIDE_FROM_ABI constexpr atomic(_Tp __d) noexcept : __base(__d) {}
-
- atomic(const atomic&) = delete;
- atomic& operator=(const atomic&) = delete;
- atomic& operator=(const atomic&) volatile = delete;
-
- _LIBCPP_HIDE_FROM_ABI _Tp operator=(_Tp __d) volatile noexcept
- requires __base::is_always_lock_free
- {
- __base::store(__d);
- return __d;
- }
- _LIBCPP_HIDE_FROM_ABI _Tp operator=(_Tp __d) noexcept {
- __base::store(__d);
- return __d;
- }
-
- _LIBCPP_HIDE_FROM_ABI _Tp fetch_add(_Tp __op, memory_order __m = memory_order_seq_cst) volatile noexcept
- requires __base::is_always_lock_free
- {
- return __fetch_add(*this, __op, __m);
- }
-
- _LIBCPP_HIDE_FROM_ABI _Tp fetch_add(_Tp __op, memory_order __m = memory_order_seq_cst) noexcept {
- return __fetch_add(*this, __op, __m);
- }
-
- _LIBCPP_HIDE_FROM_ABI _Tp fetch_sub(_Tp __op, memory_order __m = memory_order_seq_cst) volatile noexcept
- requires __base::is_always_lock_free
- {
- return __fetch_sub(*this, __op, __m);
- }
-
- _LIBCPP_HIDE_FROM_ABI _Tp fetch_sub(_Tp __op, memory_order __m = memory_order_seq_cst) noexcept {
- return __fetch_sub(*this, __op, __m);
- }
-
- _LIBCPP_HIDE_FROM_ABI _Tp operator+=(_Tp __op) volatile noexcept
- requires __base::is_always_lock_free
- {
- return fetch_add(__op) + __op;
- }
-
- _LIBCPP_HIDE_FROM_ABI _Tp operator+=(_Tp __op) noexcept { return fetch_add(__op) + __op; }
-
- _LIBCPP_HIDE_FROM_ABI _Tp operator-=(_Tp __op) volatile noexcept
- requires __base::is_always_lock_free
- {
- return fetch_sub(__op) - __op;
- }
-
- _LIBCPP_HIDE_FROM_ABI _Tp operator-=(_Tp __op) noexcept { return fetch_sub(__op) - __op; }
+ _LIBCPP_HIDE_FROM_ABI constexpr atomic() noexcept = default;
+ _LIBCPP_HIDE_FROM_ABI constexpr atomic(_Tp __d) noexcept : __base(__d) {}
+
+ atomic(const atomic&) = delete;
+ atomic& operator=(const atomic&) = delete;
+ atomic& operator=(const atomic&) volatile = delete;
+
+ _LIBCPP_HIDE_FROM_ABI _Tp operator=(_Tp __d) volatile noexcept
+ requires __base::is_always_lock_free
+ {
+ __base::store(__d);
+ return __d;
+ }
+ _LIBCPP_HIDE_FROM_ABI _Tp operator=(_Tp __d) noexcept {
+ __base::store(__d);
+ return __d;
+ }
+
+ _LIBCPP_HIDE_FROM_ABI _Tp fetch_add(_Tp __op, memory_order __m = memory_order_seq_cst) volatile noexcept
+ requires __base::is_always_lock_free
+ {
+ return __fetch_add(*this, __op, __m);
+ }
+
+ _LIBCPP_HIDE_FROM_ABI _Tp fetch_add(_Tp __op, memory_order __m = memory_order_seq_cst) noexcept {
+ return __fetch_add(*this, __op, __m);
+ }
+
+ _LIBCPP_HIDE_FROM_ABI _Tp fetch_sub(_Tp __op, memory_order __m = memory_order_seq_cst) volatile noexcept
+ requires __base::is_always_lock_free
+ {
+ return __fetch_sub(*this, __op, __m);
+ }
+
+ _LIBCPP_HIDE_FROM_ABI _Tp fetch_sub(_Tp __op, memory_order __m = memory_order_seq_cst) noexcept {
+ return __fetch_sub(*this, __op, __m);
+ }
+
+ _LIBCPP_HIDE_FROM_ABI _Tp operator+=(_Tp __op) volatile noexcept
+ requires __base::is_always_lock_free
+ {
+ return fetch_add(__op) + __op;
+ }
+
+ _LIBCPP_HIDE_FROM_ABI _Tp operator+=(_Tp __op) noexcept { return fetch_add(__op) + __op; }
+
+ _LIBCPP_HIDE_FROM_ABI _Tp operator-=(_Tp __op) volatile noexcept
+ requires __base::is_always_lock_free
+ {
+ return fetch_sub(__op) - __op;
+ }
+
+ _LIBCPP_HIDE_FROM_ABI _Tp operator-=(_Tp __op) noexcept { return fetch_sub(__op) - __op; }
};
#endif // _LIBCPP_STD_VER >= 20
@@ -275,476 +254,363 @@ struct atomic<_Tp> : __atomic_base<_Tp> {
// atomic_is_lock_free
template <class _Tp>
-_LIBCPP_HIDE_FROM_ABI
-bool
-atomic_is_lock_free(const volatile atomic<_Tp>* __o) _NOEXCEPT
-{
- return __o->is_lock_free();
+_LIBCPP_HIDE_FROM_ABI bool atomic_is_lock_free(const volatile atomic<_Tp>* __o) _NOEXCEPT {
+ return __o->is_lock_free();
}
template <class _Tp>
-_LIBCPP_HIDE_FROM_ABI
-bool
-atomic_is_lock_free(const atomic<_Tp>* __o) _NOEXCEPT
-{
- return __o->is_lock_free();
+_LIBCPP_HIDE_FROM_ABI bool atomic_is_lock_free(const atomic<_Tp>* __o) _NOEXCEPT {
+ return __o->is_lock_free();
}
// atomic_init
template <class _Tp>
-_LIBCPP_DEPRECATED_IN_CXX20 _LIBCPP_HIDE_FROM_ABI
-void
-atomic_init(volatile atomic<_Tp>* __o, typename atomic<_Tp>::value_type __d) _NOEXCEPT
-{
- std::__cxx_atomic_init(std::addressof(__o->__a_), __d);
+_LIBCPP_DEPRECATED_IN_CXX20 _LIBCPP_HIDE_FROM_ABI void
+atomic_init(volatile atomic<_Tp>* __o, typename atomic<_Tp>::value_type __d) _NOEXCEPT {
+ std::__cxx_atomic_init(std::addressof(__o->__a_), __d);
}
template <class _Tp>
-_LIBCPP_DEPRECATED_IN_CXX20 _LIBCPP_HIDE_FROM_ABI
-void
-atomic_init(atomic<_Tp>* __o, typename atomic<_Tp>::value_type __d) _NOEXCEPT
-{
- std::__cxx_atomic_init(std::addressof(__o->__a_), __d);
+_LIBCPP_DEPRECATED_IN_CXX20 _LIBCPP_HIDE_FROM_ABI void
+atomic_init(atomic<_Tp>* __o, typename atomic<_Tp>::value_type __d) _NOEXCEPT {
+ std::__cxx_atomic_init(std::addressof(__o->__a_), __d);
}
// atomic_store
template <class _Tp>
-_LIBCPP_HIDE_FROM_ABI
-void
-atomic_store(volatile atomic<_Tp>* __o, typename atomic<_Tp>::value_type __d) _NOEXCEPT
-{
- __o->store(__d);
+_LIBCPP_HIDE_FROM_ABI void atomic_store(volatile atomic<_Tp>* __o, typename atomic<_Tp>::value_type __d) _NOEXCEPT {
+ __o->store(__d);
}
template <class _Tp>
-_LIBCPP_HIDE_FROM_ABI
-void
-atomic_store(atomic<_Tp>* __o, typename atomic<_Tp>::value_type __d) _NOEXCEPT
-{
- __o->store(__d);
+_LIBCPP_HIDE_FROM_ABI void atomic_store(atomic<_Tp>* __o, typename atomic<_Tp>::value_type __d) _NOEXCEPT {
+ __o->store(__d);
}
// atomic_store_explicit
template <class _Tp>
-_LIBCPP_HIDE_FROM_ABI
-void
+_LIBCPP_HIDE_FROM_ABI void
atomic_store_explicit(volatile atomic<_Tp>* __o, typename atomic<_Tp>::value_type __d, memory_order __m) _NOEXCEPT
- _LIBCPP_CHECK_STORE_MEMORY_ORDER(__m)
-{
- __o->store(__d, __m);
+ _LIBCPP_CHECK_STORE_MEMORY_ORDER(__m) {
+ __o->store(__d, __m);
}
template <class _Tp>
-_LIBCPP_HIDE_FROM_ABI
-void
+_LIBCPP_HIDE_FROM_ABI void
atomic_store_explicit(atomic<_Tp>* __o, typename atomic<_Tp>::value_type __d, memory_order __m) _NOEXCEPT
- _LIBCPP_CHECK_STORE_MEMORY_ORDER(__m)
-{
- __o->store(__d, __m);
+ _LIBCPP_CHECK_STORE_MEMORY_ORDER(__m) {
+ __o->store(__d, __m);
}
// atomic_load
template <class _Tp>
-_LIBCPP_HIDE_FROM_ABI
-_Tp
-atomic_load(const volatile atomic<_Tp>* __o) _NOEXCEPT
-{
- return __o->load();
+_LIBCPP_HIDE_FROM_ABI _Tp atomic_load(const volatile atomic<_Tp>* __o) _NOEXCEPT {
+ return __o->load();
}
template <class _Tp>
-_LIBCPP_HIDE_FROM_ABI
-_Tp
-atomic_load(const atomic<_Tp>* __o) _NOEXCEPT
-{
- return __o->load();
+_LIBCPP_HIDE_FROM_ABI _Tp atomic_load(const atomic<_Tp>* __o) _NOEXCEPT {
+ return __o->load();
}
// atomic_load_explicit
template <class _Tp>
-_LIBCPP_HIDE_FROM_ABI
-_Tp
-atomic_load_explicit(const volatile atomic<_Tp>* __o, memory_order __m) _NOEXCEPT
- _LIBCPP_CHECK_LOAD_MEMORY_ORDER(__m)
-{
- return __o->load(__m);
+_LIBCPP_HIDE_FROM_ABI _Tp atomic_load_explicit(const volatile atomic<_Tp>* __o, memory_order __m) _NOEXCEPT
+ _LIBCPP_CHECK_LOAD_MEMORY_ORDER(__m) {
+ return __o->load(__m);
}
template <class _Tp>
-_LIBCPP_HIDE_FROM_ABI
-_Tp
-atomic_load_explicit(const atomic<_Tp>* __o, memory_order __m) _NOEXCEPT
- _LIBCPP_CHECK_LOAD_MEMORY_ORDER(__m)
-{
- return __o->load(__m);
+_LIBCPP_HIDE_FROM_ABI _Tp atomic_load_explicit(const atomic<_Tp>* __o, memory_order __m) _NOEXCEPT
+ _LIBCPP_CHECK_LOAD_MEMORY_ORDER(__m) {
+ return __o->load(__m);
}
// atomic_exchange
template <class _Tp>
-_LIBCPP_HIDE_FROM_ABI
-_Tp
-atomic_exchange(volatile atomic<_Tp>* __o, typename atomic<_Tp>::value_type __d) _NOEXCEPT
-{
- return __o->exchange(__d);
+_LIBCPP_HIDE_FROM_ABI _Tp atomic_exchange(volatile atomic<_Tp>* __o, typename atomic<_Tp>::value_type __d) _NOEXCEPT {
+ return __o->exchange(__d);
}
template <class _Tp>
-_LIBCPP_HIDE_FROM_ABI
-_Tp
-atomic_exchange(atomic<_Tp>* __o, typename atomic<_Tp>::value_type __d) _NOEXCEPT
-{
- return __o->exchange(__d);
+_LIBCPP_HIDE_FROM_ABI _Tp atomic_exchange(atomic<_Tp>* __o, typename atomic<_Tp>::value_type __d) _NOEXCEPT {
+ return __o->exchange(__d);
}
// atomic_exchange_explicit
template <class _Tp>
-_LIBCPP_HIDE_FROM_ABI
-_Tp
-atomic_exchange_explicit(volatile atomic<_Tp>* __o, typename atomic<_Tp>::value_type __d, memory_order __m) _NOEXCEPT
-{
- return __o->exchange(__d, __m);
+_LIBCPP_HIDE_FROM_ABI _Tp
+atomic_exchange_explicit(volatile atomic<_Tp>* __o, typename atomic<_Tp>::value_type __d, memory_order __m) _NOEXCEPT {
+ return __o->exchange(__d, __m);
}
template <class _Tp>
-_LIBCPP_HIDE_FROM_ABI
-_Tp
-atomic_exchange_explicit(atomic<_Tp>* __o, typename atomic<_Tp>::value_type __d, memory_order __m) _NOEXCEPT
-{
- return __o->exchange(__d, __m);
+_LIBCPP_HIDE_FROM_ABI _Tp
+atomic_exchange_explicit(atomic<_Tp>* __o, typename atomic<_Tp>::value_type __d, memory_order __m) _NOEXCEPT {
+ return __o->exchange(__d, __m);
}
// atomic_compare_exchange_weak
template <class _Tp>
-_LIBCPP_HIDE_FROM_ABI
-bool
-atomic_compare_exchange_weak(volatile atomic<_Tp>* __o, typename atomic<_Tp>::value_type* __e, typename atomic<_Tp>::value_type __d) _NOEXCEPT
-{
- return __o->compare_exchange_weak(*__e, __d);
+_LIBCPP_HIDE_FROM_ABI bool atomic_compare_exchange_weak(
+ volatile atomic<_Tp>* __o, typename atomic<_Tp>::value_type* __e, typename atomic<_Tp>::value_type __d) _NOEXCEPT {
+ return __o->compare_exchange_weak(*__e, __d);
}
template <class _Tp>
-_LIBCPP_HIDE_FROM_ABI
-bool
-atomic_compare_exchange_weak(atomic<_Tp>* __o, typename atomic<_Tp>::value_type* __e, typename atomic<_Tp>::value_type __d) _NOEXCEPT
-{
- return __o->compare_exchange_weak(*__e, __d);
+_LIBCPP_HIDE_FROM_ABI bool atomic_compare_exchange_weak(
+ atomic<_Tp>* __o, typename atomic<_Tp>::value_type* __e, typename atomic<_Tp>::value_type __d) _NOEXCEPT {
+ return __o->compare_exchange_weak(*__e, __d);
}
// atomic_compare_exchange_strong
template <class _Tp>
-_LIBCPP_HIDE_FROM_ABI
-bool
-atomic_compare_exchange_strong(volatile atomic<_Tp>* __o, typename atomic<_Tp>::value_type* __e, typename atomic<_Tp>::value_type __d) _NOEXCEPT
-{
- return __o->compare_exchange_strong(*__e, __d);
+_LIBCPP_HIDE_FROM_ABI bool atomic_compare_exchange_strong(
+ volatile atomic<_Tp>* __o, typename atomic<_Tp>::value_type* __e, typename atomic<_Tp>::value_type __d) _NOEXCEPT {
+ return __o->compare_exchange_strong(*__e, __d);
}
template <class _Tp>
-_LIBCPP_HIDE_FROM_ABI
-bool
-atomic_compare_exchange_strong(atomic<_Tp>* __o, typename atomic<_Tp>::value_type* __e, typename atomic<_Tp>::value_type __d) _NOEXCEPT
-{
- return __o->compare_exchange_strong(*__e, __d);
+_LIBCPP_HIDE_FROM_ABI bool atomic_compare_exchange_strong(
+ atomic<_Tp>* __o, typename atomic<_Tp>::value_type* __e, typename atomic<_Tp>::value_type __d) _NOEXCEPT {
+ return __o->compare_exchange_strong(*__e, __d);
}
// atomic_compare_exchange_weak_explicit
template <class _Tp>
-_LIBCPP_HIDE_FROM_ABI
-bool
-atomic_compare_exchange_weak_explicit(volatile atomic<_Tp>* __o, typename atomic<_Tp>::value_type* __e,
- typename atomic<_Tp>::value_type __d,
- memory_order __s, memory_order __f) _NOEXCEPT
- _LIBCPP_CHECK_EXCHANGE_MEMORY_ORDER(__s, __f)
-{
- return __o->compare_exchange_weak(*__e, __d, __s, __f);
+_LIBCPP_HIDE_FROM_ABI bool atomic_compare_exchange_weak_explicit(
+ volatile atomic<_Tp>* __o,
+ typename atomic<_Tp>::value_type* __e,
+ typename atomic<_Tp>::value_type __d,
+ memory_order __s,
+ memory_order __f) _NOEXCEPT _LIBCPP_CHECK_EXCHANGE_MEMORY_ORDER(__s, __f) {
+ return __o->compare_exchange_weak(*__e, __d, __s, __f);
}
template <class _Tp>
-_LIBCPP_HIDE_FROM_ABI
-bool
-atomic_compare_exchange_weak_explicit(atomic<_Tp>* __o, typename atomic<_Tp>::value_type* __e, typename atomic<_Tp>::value_type __d,
- memory_order __s, memory_order __f) _NOEXCEPT
- _LIBCPP_CHECK_EXCHANGE_MEMORY_ORDER(__s, __f)
-{
- return __o->compare_exchange_weak(*__e, __d, __s, __f);
+_LIBCPP_HIDE_FROM_ABI bool atomic_compare_exchange_weak_explicit(
+ atomic<_Tp>* __o,
+ typename atomic<_Tp>::value_type* __e,
+ typename atomic<_Tp>::value_type __d,
+ memory_order __s,
+ memory_order __f) _NOEXCEPT _LIBCPP_CHECK_EXCHANGE_MEMORY_ORDER(__s, __f) {
+ return __o->compare_exchange_weak(*__e, __d, __s, __f);
}
// atomic_compare_exchange_strong_explicit
template <class _Tp>
-_LIBCPP_HIDE_FROM_ABI
-bool
-atomic_compare_exchange_strong_explicit(volatile atomic<_Tp>* __o,
- typename atomic<_Tp>::value_type* __e, typename atomic<_Tp>::value_type __d,
- memory_order __s, memory_order __f) _NOEXCEPT
- _LIBCPP_CHECK_EXCHANGE_MEMORY_ORDER(__s, __f)
-{
- return __o->compare_exchange_strong(*__e, __d, __s, __f);
+_LIBCPP_HIDE_FROM_ABI bool atomic_compare_exchange_strong_explicit(
+ volatile atomic<_Tp>* __o,
+ typename atomic<_Tp>::value_type* __e,
+ typename atomic<_Tp>::value_type __d,
+ memory_order __s,
+ memory_order __f) _NOEXCEPT _LIBCPP_CHECK_EXCHANGE_MEMORY_ORDER(__s, __f) {
+ return __o->compare_exchange_strong(*__e, __d, __s, __f);
}
template <class _Tp>
-_LIBCPP_HIDE_FROM_ABI
-bool
-atomic_compare_exchange_strong_explicit(atomic<_Tp>* __o, typename atomic<_Tp>::value_type* __e,
- typename atomic<_Tp>::value_type __d,
- memory_order __s, memory_order __f) _NOEXCEPT
- _LIBCPP_CHECK_EXCHANGE_MEMORY_ORDER(__s, __f)
-{
- return __o->compare_exchange_strong(*__e, __d, __s, __f);
+_LIBCPP_HIDE_FROM_ABI bool atomic_compare_exchange_strong_explicit(
+ atomic<_Tp>* __o,
+ typename atomic<_Tp>::value_type* __e,
+ typename atomic<_Tp>::value_type __d,
+ memory_order __s,
+ memory_order __f) _NOEXCEPT _LIBCPP_CHECK_EXCHANGE_MEMORY_ORDER(__s, __f) {
+ return __o->compare_exchange_strong(*__e, __d, __s, __f);
}
// atomic_wait
template <class _Tp>
-_LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI
-void atomic_wait(const volatile atomic<_Tp>* __o,
- typename atomic<_Tp>::value_type __v) _NOEXCEPT
-{
- return __o->wait(__v);
+_LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI void
+atomic_wait(const volatile atomic<_Tp>* __o, typename atomic<_Tp>::value_type __v) _NOEXCEPT {
+ return __o->wait(__v);
}
template <class _Tp>
-_LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI
-void atomic_wait(const atomic<_Tp>* __o,
- typename atomic<_Tp>::value_type __v) _NOEXCEPT
-{
- return __o->wait(__v);
+_LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI void
+atomic_wait(const atomic<_Tp>* __o, typename atomic<_Tp>::value_type __v) _NOEXCEPT {
+ return __o->wait(__v);
}
// atomic_wait_explicit
template <class _Tp>
-_LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI
-void atomic_wait_explicit(const volatile atomic<_Tp>* __o,
- typename atomic<_Tp>::value_type __v,
- memory_order __m) _NOEXCEPT
- _LIBCPP_CHECK_LOAD_MEMORY_ORDER(__m)
-{
- return __o->wait(__v, __m);
+_LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI void
+atomic_wait_explicit(const volatile atomic<_Tp>* __o, typename atomic<_Tp>::value_type __v, memory_order __m) _NOEXCEPT
+ _LIBCPP_CHECK_LOAD_MEMORY_ORDER(__m) {
+ return __o->wait(__v, __m);
}
template <class _Tp>
-_LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI
-void atomic_wait_explicit(const atomic<_Tp>* __o,
- typename atomic<_Tp>::value_type __v,
- memory_order __m) _NOEXCEPT
- _LIBCPP_CHECK_LOAD_MEMORY_ORDER(__m)
-{
- return __o->wait(__v, __m);
+_LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI void
+atomic_wait_explicit(const atomic<_Tp>* __o, typename atomic<_Tp>::value_type __v, memory_order __m) _NOEXCEPT
+ _LIBCPP_CHECK_LOAD_MEMORY_ORDER(__m) {
+ return __o->wait(__v, __m);
}
// atomic_notify_one
template <class _Tp>
-_LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI
-void atomic_notify_one(volatile atomic<_Tp>* __o) _NOEXCEPT
-{
- __o->notify_one();
+_LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI void atomic_notify_one(volatile atomic<_Tp>* __o) _NOEXCEPT {
+ __o->notify_one();
}
template <class _Tp>
-_LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI
-void atomic_notify_one(atomic<_Tp>* __o) _NOEXCEPT
-{
- __o->notify_one();
+_LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI void atomic_notify_one(atomic<_Tp>* __o) _NOEXCEPT {
+ __o->notify_one();
}
// atomic_notify_all
template <class _Tp>
-_LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI
-void atomic_notify_all(volatile atomic<_Tp>* __o) _NOEXCEPT
-{
- __o->notify_all();
+_LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI void atomic_notify_all(volatile atomic<_Tp>* __o) _NOEXCEPT {
+ __o->notify_all();
}
template <class _Tp>
-_LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI
-void atomic_notify_all(atomic<_Tp>* __o) _NOEXCEPT
-{
- __o->notify_all();
+_LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI void atomic_notify_all(atomic<_Tp>* __o) _NOEXCEPT {
+ __o->notify_all();
}
// atomic_fetch_add
template <class _Tp>
-_LIBCPP_HIDE_FROM_ABI
-_Tp
-atomic_fetch_add(volatile atomic<_Tp>* __o, typename atomic<_Tp>::difference_type __op) _NOEXCEPT
-{
- return __o->fetch_add(__op);
+_LIBCPP_HIDE_FROM_ABI _Tp
+atomic_fetch_add(volatile atomic<_Tp>* __o, typename atomic<_Tp>::difference_type __op) _NOEXCEPT {
+ return __o->fetch_add(__op);
}
template <class _Tp>
-_LIBCPP_HIDE_FROM_ABI
-_Tp
-atomic_fetch_add(atomic<_Tp>* __o, typename atomic<_Tp>::difference_type __op) _NOEXCEPT
-{
- return __o->fetch_add(__op);
+_LIBCPP_HIDE_FROM_ABI _Tp atomic_fetch_add(atomic<_Tp>* __o, typename atomic<_Tp>::difference_type __op) _NOEXCEPT {
+ return __o->fetch_add(__op);
}
// atomic_fetch_add_explicit
template <class _Tp>
-_LIBCPP_HIDE_FROM_ABI
-_Tp atomic_fetch_add_explicit(volatile atomic<_Tp>* __o, typename atomic<_Tp>::difference_type __op, memory_order __m) _NOEXCEPT
-{
- return __o->fetch_add(__op, __m);
+_LIBCPP_HIDE_FROM_ABI _Tp atomic_fetch_add_explicit(
+ volatile atomic<_Tp>* __o, typename atomic<_Tp>::difference_type __op, memory_order __m) _NOEXCEPT {
+ return __o->fetch_add(__op, __m);
}
template <class _Tp>
-_LIBCPP_HIDE_FROM_ABI
-_Tp atomic_fetch_add_explicit(atomic<_Tp>* __o, typename atomic<_Tp>::difference_type __op, memory_order __m) _NOEXCEPT
-{
- return __o->fetch_add(__op, __m);
+_LIBCPP_HIDE_FROM_ABI _Tp
+atomic_fetch_add_explicit(atomic<_Tp>* __o, typename atomic<_Tp>::difference_type __op, memory_order __m) _NOEXCEPT {
+ return __o->fetch_add(__op, __m);
}
// atomic_fetch_sub
template <class _Tp>
-_LIBCPP_HIDE_FROM_ABI
-_Tp atomic_fetch_sub(volatile atomic<_Tp>* __o, typename atomic<_Tp>::difference_type __op) _NOEXCEPT
-{
- return __o->fetch_sub(__op);
+_LIBCPP_HIDE_FROM_ABI _Tp
+atomic_fetch_sub(volatile atomic<_Tp>* __o, typename atomic<_Tp>::difference_type __op) _NOEXCEPT {
+ return __o->fetch_sub(__op);
}
template <class _Tp>
-_LIBCPP_HIDE_FROM_ABI
-_Tp atomic_fetch_sub(atomic<_Tp>* __o, typename atomic<_Tp>::difference_type __op) _NOEXCEPT
-{
- return __o->fetch_sub(__op);
+_LIBCPP_HIDE_FROM_ABI _Tp atomic_fetch_sub(atomic<_Tp>* __o, typename atomic<_Tp>::difference_type __op) _NOEXCEPT {
+ return __o->fetch_sub(__op);
}
// atomic_fetch_sub_explicit
template <class _Tp>
-_LIBCPP_HIDE_FROM_ABI
-_Tp atomic_fetch_sub_explicit(volatile atomic<_Tp>* __o, typename atomic<_Tp>::difference_type __op, memory_order __m) _NOEXCEPT
-{
- return __o->fetch_sub(__op, __m);
+_LIBCPP_HIDE_FROM_ABI _Tp atomic_fetch_sub_explicit(
+ volatile atomic<_Tp>* __o, typename atomic<_Tp>::difference_type __op, memory_order __m) _NOEXCEPT {
+ return __o->fetch_sub(__op, __m);
}
template <class _Tp>
-_LIBCPP_HIDE_FROM_ABI
-_Tp atomic_fetch_sub_explicit(atomic<_Tp>* __o, typename atomic<_Tp>::difference_type __op, memory_order __m) _NOEXCEPT
-{
- return __o->fetch_sub(__op, __m);
+_LIBCPP_HIDE_FROM_ABI _Tp
+atomic_fetch_sub_explicit(atomic<_Tp>* __o, typename atomic<_Tp>::difference_type __op, memory_order __m) _NOEXCEPT {
+ return __o->fetch_sub(__op, __m);
}
// atomic_fetch_and
template <class _Tp, __enable_if_t<is_integral<_Tp>::value && !is_same<_Tp, bool>::value, int> = 0>
-_LIBCPP_HIDE_FROM_ABI
-_Tp
-atomic_fetch_and(volatile atomic<_Tp>* __o, typename atomic<_Tp>::value_type __op) _NOEXCEPT
-{
- return __o->fetch_and(__op);
+_LIBCPP_HIDE_FROM_ABI _Tp atomic_fetch_and(volatile atomic<_Tp>* __o, typename atomic<_Tp>::value_type __op) _NOEXCEPT {
+ return __o->fetch_and(__op);
}
template <class _Tp, __enable_if_t<is_integral<_Tp>::value && !is_same<_Tp, bool>::value, int> = 0>
-_LIBCPP_HIDE_FROM_ABI
-_Tp
-atomic_fetch_and(atomic<_Tp>* __o, typename atomic<_Tp>::value_type __op) _NOEXCEPT
-{
- return __o->fetch_and(__op);
+_LIBCPP_HIDE_FROM_ABI _Tp atomic_fetch_and(atomic<_Tp>* __o, typename atomic<_Tp>::value_type __op) _NOEXCEPT {
+ return __o->fetch_and(__op);
}
// atomic_fetch_and_explicit
template <class _Tp, __enable_if_t<is_integral<_Tp>::value && !is_same<_Tp, bool>::value, int> = 0>
-_LIBCPP_HIDE_FROM_ABI
-_Tp
-atomic_fetch_and_explicit(volatile atomic<_Tp>* __o, typename atomic<_Tp>::value_type __op, memory_order __m) _NOEXCEPT
-{
- return __o->fetch_and(__op, __m);
+_LIBCPP_HIDE_FROM_ABI _Tp atomic_fetch_and_explicit(
+ volatile atomic<_Tp>* __o, typename atomic<_Tp>::value_type __op, memory_order __m) _NOEXCEPT {
+ return __o->fetch_and(__op, __m);
}
template <class _Tp, __enable_if_t<is_integral<_Tp>::value && !is_same<_Tp, bool>::value, int> = 0>
-_LIBCPP_HIDE_FROM_ABI
-_Tp
-atomic_fetch_and_explicit(atomic<_Tp>* __o, typename atomic<_Tp>::value_type __op, memory_order __m) _NOEXCEPT
-{
- return __o->fetch_and(__op, __m);
+_LIBCPP_HIDE_FROM_ABI _Tp
+atomic_fetch_and_explicit(atomic<_Tp>* __o, typename atomic<_Tp>::value_type __op, memory_order __m) _NOEXCEPT {
+ return __o->fetch_and(__op, __m);
}
// atomic_fetch_or
template <class _Tp, __enable_if_t<is_integral<_Tp>::value && !is_same<_Tp, bool>::value, int> = 0>
-_LIBCPP_HIDE_FROM_ABI
-_Tp
-atomic_fetch_or(volatile atomic<_Tp>* __o, typename atomic<_Tp>::value_type __op) _NOEXCEPT
-{
- return __o->fetch_or(__op);
+_LIBCPP_HIDE_FROM_ABI _Tp atomic_fetch_or(volatile atomic<_Tp>* __o, typename atomic<_Tp>::value_type __op) _NOEXCEPT {
+ return __o->fetch_or(__op);
}
template <class _Tp, __enable_if_t<is_integral<_Tp>::value && !is_same<_Tp, bool>::value, int> = 0>
-_LIBCPP_HIDE_FROM_ABI
-_Tp
-atomic_fetch_or(atomic<_Tp>* __o, typename atomic<_Tp>::value_type __op) _NOEXCEPT
-{
- return __o->fetch_or(__op);
+_LIBCPP_HIDE_FROM_ABI _Tp atomic_fetch_or(atomic<_Tp>* __o, typename atomic<_Tp>::value_type __op) _NOEXCEPT {
+ return __o->fetch_or(__op);
}
// atomic_fetch_or_explicit
template <class _Tp, __enable_if_t<is_integral<_Tp>::value && !is_same<_Tp, bool>::value, int> = 0>
-_LIBCPP_HIDE_FROM_ABI
-_Tp
-atomic_fetch_or_explicit(volatile atomic<_Tp>* __o, typename atomic<_Tp>::value_type __op, memory_order __m) _NOEXCEPT
-{
- return __o->fetch_or(__op, __m);
+_LIBCPP_HIDE_FROM_ABI _Tp
+atomic_fetch_or_explicit(volatile atomic<_Tp>* __o, typename atomic<_Tp>::value_type __op, memory_order __m) _NOEXCEPT {
+ return __o->fetch_or(__op, __m);
}
template <class _Tp, __enable_if_t<is_integral<_Tp>::value && !is_same<_Tp, bool>::value, int> = 0>
-_LIBCPP_HIDE_FROM_ABI
-_Tp
-atomic_fetch_or_explicit(atomic<_Tp>* __o, typename atomic<_Tp>::value_type __op, memory_order __m) _NOEXCEPT
-{
- return __o->fetch_or(__op, __m);
+_LIBCPP_HIDE_FROM_ABI _Tp
+atomic_fetch_or_explicit(atomic<_Tp>* __o, typename atomic<_Tp>::value_type __op, memory_order __m) _NOEXCEPT {
+ return __o->fetch_or(__op, __m);
}
// atomic_fetch_xor
template <class _Tp, __enable_if_t<is_integral<_Tp>::value && !is_same<_Tp, bool>::value, int> = 0>
-_LIBCPP_HIDE_FROM_ABI
-_Tp
-atomic_fetch_xor(volatile atomic<_Tp>* __o, typename atomic<_Tp>::value_type __op) _NOEXCEPT
-{
- return __o->fetch_xor(__op);
+_LIBCPP_HIDE_FROM_ABI _Tp atomic_fetch_xor(volatile atomic<_Tp>* __o, typename atomic<_Tp>::value_type __op) _NOEXCEPT {
+ return __o->fetch_xor(__op);
}
template <class _Tp, __enable_if_t<is_integral<_Tp>::value && !is_same<_Tp, bool>::value, int> = 0>
-_LIBCPP_HIDE_FROM_ABI
-_Tp
-atomic_fetch_xor(atomic<_Tp>* __o, typename atomic<_Tp>::value_type __op) _NOEXCEPT
-{
- return __o->fetch_xor(__op);
+_LIBCPP_HIDE_FROM_ABI _Tp atomic_fetch_xor(atomic<_Tp>* __o, typename atomic<_Tp>::value_type __op) _NOEXCEPT {
+ return __o->fetch_xor(__op);
}
// atomic_fetch_xor_explicit
template <class _Tp, __enable_if_t<is_integral<_Tp>::value && !is_same<_Tp, bool>::value, int> = 0>
-_LIBCPP_HIDE_FROM_ABI
-_Tp
-atomic_fetch_xor_explicit(volatile atomic<_Tp>* __o, typename atomic<_Tp>::value_type __op, memory_order __m) _NOEXCEPT
-{
- return __o->fetch_xor(__op, __m);
+_LIBCPP_HIDE_FROM_ABI _Tp atomic_fetch_xor_explicit(
+ volatile atomic<_Tp>* __o, typename atomic<_Tp>::value_type __op, memory_order __m) _NOEXCEPT {
+ return __o->fetch_xor(__op, __m);
}
template <class _Tp, __enable_if_t<is_integral<_Tp>::value && !is_same<_Tp, bool>::value, int> = 0>
-_LIBCPP_HIDE_FROM_ABI
-_Tp
-atomic_fetch_xor_explicit(atomic<_Tp>* __o, typename atomic<_Tp>::value_type __op, memory_order __m) _NOEXCEPT
-{
- return __o->fetch_xor(__op, __m);
+_LIBCPP_HIDE_FROM_ABI _Tp
+atomic_fetch_xor_explicit(atomic<_Tp>* __o, typename atomic<_Tp>::value_type __op, memory_order __m) _NOEXCEPT {
+ return __o->fetch_xor(__op, __m);
}
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__atomic/atomic_base.h b/contrib/llvm-project/libcxx/include/__atomic/atomic_base.h
index 775d06d75701..3ad3b562c598 100644
--- a/contrib/llvm-project/libcxx/include/__atomic/atomic_base.h
+++ b/contrib/llvm-project/libcxx/include/__atomic/atomic_base.h
@@ -29,114 +29,109 @@
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _Tp, bool = is_integral<_Tp>::value && !is_same<_Tp, bool>::value>
-struct __atomic_base // false
+struct __atomic_base // false
{
- mutable __cxx_atomic_impl<_Tp> __a_;
+ mutable __cxx_atomic_impl<_Tp> __a_;
#if _LIBCPP_STD_VER >= 17
static _LIBCPP_CONSTEXPR bool is_always_lock_free = __libcpp_is_always_lock_free<__cxx_atomic_impl<_Tp> >::__value;
#endif
- _LIBCPP_HIDE_FROM_ABI
- bool is_lock_free() const volatile _NOEXCEPT
- {return __cxx_atomic_is_lock_free(sizeof(__cxx_atomic_impl<_Tp>));}
- _LIBCPP_HIDE_FROM_ABI
- bool is_lock_free() const _NOEXCEPT
- {return static_cast<__atomic_base const volatile*>(this)->is_lock_free();}
- _LIBCPP_HIDE_FROM_ABI void store(_Tp __d, memory_order __m = memory_order_seq_cst) volatile _NOEXCEPT
- _LIBCPP_CHECK_STORE_MEMORY_ORDER(__m) {
- std::__cxx_atomic_store(std::addressof(__a_), __d, __m);
- }
- _LIBCPP_HIDE_FROM_ABI void store(_Tp __d, memory_order __m = memory_order_seq_cst) _NOEXCEPT
- _LIBCPP_CHECK_STORE_MEMORY_ORDER(__m) {
- std::__cxx_atomic_store(std::addressof(__a_), __d, __m);
- }
- _LIBCPP_HIDE_FROM_ABI _Tp load(memory_order __m = memory_order_seq_cst) const volatile _NOEXCEPT
- _LIBCPP_CHECK_LOAD_MEMORY_ORDER(__m) {
- return std::__cxx_atomic_load(std::addressof(__a_), __m);
- }
- _LIBCPP_HIDE_FROM_ABI _Tp load(memory_order __m = memory_order_seq_cst) const _NOEXCEPT
- _LIBCPP_CHECK_LOAD_MEMORY_ORDER(__m) {
- return std::__cxx_atomic_load(std::addressof(__a_), __m);
- }
- _LIBCPP_HIDE_FROM_ABI
- operator _Tp() const volatile _NOEXCEPT {return load();}
- _LIBCPP_HIDE_FROM_ABI
- operator _Tp() const _NOEXCEPT {return load();}
- _LIBCPP_HIDE_FROM_ABI _Tp exchange(_Tp __d, memory_order __m = memory_order_seq_cst) volatile _NOEXCEPT {
- return std::__cxx_atomic_exchange(std::addressof(__a_), __d, __m);
- }
- _LIBCPP_HIDE_FROM_ABI _Tp exchange(_Tp __d, memory_order __m = memory_order_seq_cst) _NOEXCEPT {
- return std::__cxx_atomic_exchange(std::addressof(__a_), __d, __m);
- }
- _LIBCPP_HIDE_FROM_ABI bool
- compare_exchange_weak(_Tp& __e, _Tp __d, memory_order __s, memory_order __f) volatile _NOEXCEPT
- _LIBCPP_CHECK_EXCHANGE_MEMORY_ORDER(__s, __f) {
- return std::__cxx_atomic_compare_exchange_weak(std::addressof(__a_), std::addressof(__e), __d, __s, __f);
- }
- _LIBCPP_HIDE_FROM_ABI bool compare_exchange_weak(_Tp& __e, _Tp __d, memory_order __s, memory_order __f) _NOEXCEPT
- _LIBCPP_CHECK_EXCHANGE_MEMORY_ORDER(__s, __f) {
- return std::__cxx_atomic_compare_exchange_weak(std::addressof(__a_), std::addressof(__e), __d, __s, __f);
- }
- _LIBCPP_HIDE_FROM_ABI bool
- compare_exchange_strong(_Tp& __e, _Tp __d, memory_order __s, memory_order __f) volatile _NOEXCEPT
- _LIBCPP_CHECK_EXCHANGE_MEMORY_ORDER(__s, __f) {
- return std::__cxx_atomic_compare_exchange_strong(std::addressof(__a_), std::addressof(__e), __d, __s, __f);
- }
- _LIBCPP_HIDE_FROM_ABI bool compare_exchange_strong(_Tp& __e, _Tp __d, memory_order __s, memory_order __f) _NOEXCEPT
- _LIBCPP_CHECK_EXCHANGE_MEMORY_ORDER(__s, __f) {
- return std::__cxx_atomic_compare_exchange_strong(std::addressof(__a_), std::addressof(__e), __d, __s, __f);
- }
- _LIBCPP_HIDE_FROM_ABI bool
- compare_exchange_weak(_Tp& __e, _Tp __d, memory_order __m = memory_order_seq_cst) volatile _NOEXCEPT {
- return std::__cxx_atomic_compare_exchange_weak(std::addressof(__a_), std::addressof(__e), __d, __m, __m);
- }
- _LIBCPP_HIDE_FROM_ABI bool
- compare_exchange_weak(_Tp& __e, _Tp __d, memory_order __m = memory_order_seq_cst) _NOEXCEPT {
- return std::__cxx_atomic_compare_exchange_weak(std::addressof(__a_), std::addressof(__e), __d, __m, __m);
- }
- _LIBCPP_HIDE_FROM_ABI bool
- compare_exchange_strong(_Tp& __e, _Tp __d, memory_order __m = memory_order_seq_cst) volatile _NOEXCEPT {
- return std::__cxx_atomic_compare_exchange_strong(std::addressof(__a_), std::addressof(__e), __d, __m, __m);
- }
- _LIBCPP_HIDE_FROM_ABI bool
- compare_exchange_strong(_Tp& __e, _Tp __d, memory_order __m = memory_order_seq_cst) _NOEXCEPT {
- return std::__cxx_atomic_compare_exchange_strong(std::addressof(__a_), std::addressof(__e), __d, __m, __m);
- }
-
- _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI void wait(_Tp __v, memory_order __m = memory_order_seq_cst) const
- volatile _NOEXCEPT {
- std::__cxx_atomic_wait(std::addressof(__a_), __v, __m);
- }
- _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI void
- wait(_Tp __v, memory_order __m = memory_order_seq_cst) const _NOEXCEPT {
- std::__cxx_atomic_wait(std::addressof(__a_), __v, __m);
- }
- _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI void notify_one() volatile _NOEXCEPT {
- std::__cxx_atomic_notify_one(std::addressof(__a_));
- }
- _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI void notify_one() _NOEXCEPT {
- std::__cxx_atomic_notify_one(std::addressof(__a_));
- }
- _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI void notify_all() volatile _NOEXCEPT {
- std::__cxx_atomic_notify_all(std::addressof(__a_));
- }
- _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI void notify_all() _NOEXCEPT {
- std::__cxx_atomic_notify_all(std::addressof(__a_));
- }
+ _LIBCPP_HIDE_FROM_ABI bool is_lock_free() const volatile _NOEXCEPT {
+ return __cxx_atomic_is_lock_free(sizeof(__cxx_atomic_impl<_Tp>));
+ }
+ _LIBCPP_HIDE_FROM_ABI bool is_lock_free() const _NOEXCEPT {
+ return static_cast<__atomic_base const volatile*>(this)->is_lock_free();
+ }
+ _LIBCPP_HIDE_FROM_ABI void store(_Tp __d, memory_order __m = memory_order_seq_cst) volatile _NOEXCEPT
+ _LIBCPP_CHECK_STORE_MEMORY_ORDER(__m) {
+ std::__cxx_atomic_store(std::addressof(__a_), __d, __m);
+ }
+ _LIBCPP_HIDE_FROM_ABI void store(_Tp __d, memory_order __m = memory_order_seq_cst) _NOEXCEPT
+ _LIBCPP_CHECK_STORE_MEMORY_ORDER(__m) {
+ std::__cxx_atomic_store(std::addressof(__a_), __d, __m);
+ }
+ _LIBCPP_HIDE_FROM_ABI _Tp load(memory_order __m = memory_order_seq_cst) const volatile _NOEXCEPT
+ _LIBCPP_CHECK_LOAD_MEMORY_ORDER(__m) {
+ return std::__cxx_atomic_load(std::addressof(__a_), __m);
+ }
+ _LIBCPP_HIDE_FROM_ABI _Tp load(memory_order __m = memory_order_seq_cst) const _NOEXCEPT
+ _LIBCPP_CHECK_LOAD_MEMORY_ORDER(__m) {
+ return std::__cxx_atomic_load(std::addressof(__a_), __m);
+ }
+ _LIBCPP_HIDE_FROM_ABI operator _Tp() const volatile _NOEXCEPT { return load(); }
+ _LIBCPP_HIDE_FROM_ABI operator _Tp() const _NOEXCEPT { return load(); }
+ _LIBCPP_HIDE_FROM_ABI _Tp exchange(_Tp __d, memory_order __m = memory_order_seq_cst) volatile _NOEXCEPT {
+ return std::__cxx_atomic_exchange(std::addressof(__a_), __d, __m);
+ }
+ _LIBCPP_HIDE_FROM_ABI _Tp exchange(_Tp __d, memory_order __m = memory_order_seq_cst) _NOEXCEPT {
+ return std::__cxx_atomic_exchange(std::addressof(__a_), __d, __m);
+ }
+ _LIBCPP_HIDE_FROM_ABI bool
+ compare_exchange_weak(_Tp& __e, _Tp __d, memory_order __s, memory_order __f) volatile _NOEXCEPT
+ _LIBCPP_CHECK_EXCHANGE_MEMORY_ORDER(__s, __f) {
+ return std::__cxx_atomic_compare_exchange_weak(std::addressof(__a_), std::addressof(__e), __d, __s, __f);
+ }
+ _LIBCPP_HIDE_FROM_ABI bool compare_exchange_weak(_Tp& __e, _Tp __d, memory_order __s, memory_order __f) _NOEXCEPT
+ _LIBCPP_CHECK_EXCHANGE_MEMORY_ORDER(__s, __f) {
+ return std::__cxx_atomic_compare_exchange_weak(std::addressof(__a_), std::addressof(__e), __d, __s, __f);
+ }
+ _LIBCPP_HIDE_FROM_ABI bool
+ compare_exchange_strong(_Tp& __e, _Tp __d, memory_order __s, memory_order __f) volatile _NOEXCEPT
+ _LIBCPP_CHECK_EXCHANGE_MEMORY_ORDER(__s, __f) {
+ return std::__cxx_atomic_compare_exchange_strong(std::addressof(__a_), std::addressof(__e), __d, __s, __f);
+ }
+ _LIBCPP_HIDE_FROM_ABI bool compare_exchange_strong(_Tp& __e, _Tp __d, memory_order __s, memory_order __f) _NOEXCEPT
+ _LIBCPP_CHECK_EXCHANGE_MEMORY_ORDER(__s, __f) {
+ return std::__cxx_atomic_compare_exchange_strong(std::addressof(__a_), std::addressof(__e), __d, __s, __f);
+ }
+ _LIBCPP_HIDE_FROM_ABI bool
+ compare_exchange_weak(_Tp& __e, _Tp __d, memory_order __m = memory_order_seq_cst) volatile _NOEXCEPT {
+ return std::__cxx_atomic_compare_exchange_weak(std::addressof(__a_), std::addressof(__e), __d, __m, __m);
+ }
+ _LIBCPP_HIDE_FROM_ABI bool
+ compare_exchange_weak(_Tp& __e, _Tp __d, memory_order __m = memory_order_seq_cst) _NOEXCEPT {
+ return std::__cxx_atomic_compare_exchange_weak(std::addressof(__a_), std::addressof(__e), __d, __m, __m);
+ }
+ _LIBCPP_HIDE_FROM_ABI bool
+ compare_exchange_strong(_Tp& __e, _Tp __d, memory_order __m = memory_order_seq_cst) volatile _NOEXCEPT {
+ return std::__cxx_atomic_compare_exchange_strong(std::addressof(__a_), std::addressof(__e), __d, __m, __m);
+ }
+ _LIBCPP_HIDE_FROM_ABI bool
+ compare_exchange_strong(_Tp& __e, _Tp __d, memory_order __m = memory_order_seq_cst) _NOEXCEPT {
+ return std::__cxx_atomic_compare_exchange_strong(std::addressof(__a_), std::addressof(__e), __d, __m, __m);
+ }
+
+ _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI void wait(_Tp __v, memory_order __m = memory_order_seq_cst) const
+ volatile _NOEXCEPT {
+ std::__cxx_atomic_wait(std::addressof(__a_), __v, __m);
+ }
+ _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI void
+ wait(_Tp __v, memory_order __m = memory_order_seq_cst) const _NOEXCEPT {
+ std::__cxx_atomic_wait(std::addressof(__a_), __v, __m);
+ }
+ _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI void notify_one() volatile _NOEXCEPT {
+ std::__cxx_atomic_notify_one(std::addressof(__a_));
+ }
+ _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI void notify_one() _NOEXCEPT {
+ std::__cxx_atomic_notify_one(std::addressof(__a_));
+ }
+ _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI void notify_all() volatile _NOEXCEPT {
+ std::__cxx_atomic_notify_all(std::addressof(__a_));
+ }
+ _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI void notify_all() _NOEXCEPT {
+ std::__cxx_atomic_notify_all(std::addressof(__a_));
+ }
#if _LIBCPP_STD_VER >= 20
- _LIBCPP_HIDE_FROM_ABI constexpr
- __atomic_base() noexcept(is_nothrow_default_constructible_v<_Tp>) : __a_(_Tp()) {}
+ _LIBCPP_HIDE_FROM_ABI constexpr __atomic_base() noexcept(is_nothrow_default_constructible_v<_Tp>) : __a_(_Tp()) {}
#else
- _LIBCPP_HIDE_FROM_ABI
- __atomic_base() _NOEXCEPT = default;
+ _LIBCPP_HIDE_FROM_ABI __atomic_base() _NOEXCEPT = default;
#endif
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR
- __atomic_base(_Tp __d) _NOEXCEPT : __a_(__d) {}
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR __atomic_base(_Tp __d) _NOEXCEPT : __a_(__d) {}
- __atomic_base(const __atomic_base&) = delete;
+ __atomic_base(const __atomic_base&) = delete;
};
#if _LIBCPP_STD_VER >= 17
@@ -147,84 +142,62 @@ _LIBCPP_CONSTEXPR bool __atomic_base<_Tp, __b>::is_always_lock_free;
// atomic<Integral>
template <class _Tp>
-struct __atomic_base<_Tp, true>
- : public __atomic_base<_Tp, false>
-{
- using __base = __atomic_base<_Tp, false>;
-
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- __atomic_base() _NOEXCEPT = default;
-
- _LIBCPP_HIDE_FROM_ABI
- _LIBCPP_CONSTEXPR __atomic_base(_Tp __d) _NOEXCEPT : __base(__d) {}
-
- _LIBCPP_HIDE_FROM_ABI _Tp fetch_add(_Tp __op, memory_order __m = memory_order_seq_cst) volatile _NOEXCEPT {
- return std::__cxx_atomic_fetch_add(std::addressof(this->__a_), __op, __m);
- }
- _LIBCPP_HIDE_FROM_ABI _Tp fetch_add(_Tp __op, memory_order __m = memory_order_seq_cst) _NOEXCEPT {
- return std::__cxx_atomic_fetch_add(std::addressof(this->__a_), __op, __m);
- }
- _LIBCPP_HIDE_FROM_ABI _Tp fetch_sub(_Tp __op, memory_order __m = memory_order_seq_cst) volatile _NOEXCEPT {
- return std::__cxx_atomic_fetch_sub(std::addressof(this->__a_), __op, __m);
- }
- _LIBCPP_HIDE_FROM_ABI _Tp fetch_sub(_Tp __op, memory_order __m = memory_order_seq_cst) _NOEXCEPT {
- return std::__cxx_atomic_fetch_sub(std::addressof(this->__a_), __op, __m);
- }
- _LIBCPP_HIDE_FROM_ABI _Tp fetch_and(_Tp __op, memory_order __m = memory_order_seq_cst) volatile _NOEXCEPT {
- return std::__cxx_atomic_fetch_and(std::addressof(this->__a_), __op, __m);
- }
- _LIBCPP_HIDE_FROM_ABI _Tp fetch_and(_Tp __op, memory_order __m = memory_order_seq_cst) _NOEXCEPT {
- return std::__cxx_atomic_fetch_and(std::addressof(this->__a_), __op, __m);
- }
- _LIBCPP_HIDE_FROM_ABI _Tp fetch_or(_Tp __op, memory_order __m = memory_order_seq_cst) volatile _NOEXCEPT {
- return std::__cxx_atomic_fetch_or(std::addressof(this->__a_), __op, __m);
- }
- _LIBCPP_HIDE_FROM_ABI _Tp fetch_or(_Tp __op, memory_order __m = memory_order_seq_cst) _NOEXCEPT {
- return std::__cxx_atomic_fetch_or(std::addressof(this->__a_), __op, __m);
- }
- _LIBCPP_HIDE_FROM_ABI _Tp fetch_xor(_Tp __op, memory_order __m = memory_order_seq_cst) volatile _NOEXCEPT {
- return std::__cxx_atomic_fetch_xor(std::addressof(this->__a_), __op, __m);
- }
- _LIBCPP_HIDE_FROM_ABI _Tp fetch_xor(_Tp __op, memory_order __m = memory_order_seq_cst) _NOEXCEPT {
- return std::__cxx_atomic_fetch_xor(std::addressof(this->__a_), __op, __m);
- }
-
- _LIBCPP_HIDE_FROM_ABI
- _Tp operator++(int) volatile _NOEXCEPT {return fetch_add(_Tp(1));}
- _LIBCPP_HIDE_FROM_ABI
- _Tp operator++(int) _NOEXCEPT {return fetch_add(_Tp(1));}
- _LIBCPP_HIDE_FROM_ABI
- _Tp operator--(int) volatile _NOEXCEPT {return fetch_sub(_Tp(1));}
- _LIBCPP_HIDE_FROM_ABI
- _Tp operator--(int) _NOEXCEPT {return fetch_sub(_Tp(1));}
- _LIBCPP_HIDE_FROM_ABI
- _Tp operator++() volatile _NOEXCEPT {return fetch_add(_Tp(1)) + _Tp(1);}
- _LIBCPP_HIDE_FROM_ABI
- _Tp operator++() _NOEXCEPT {return fetch_add(_Tp(1)) + _Tp(1);}
- _LIBCPP_HIDE_FROM_ABI
- _Tp operator--() volatile _NOEXCEPT {return fetch_sub(_Tp(1)) - _Tp(1);}
- _LIBCPP_HIDE_FROM_ABI
- _Tp operator--() _NOEXCEPT {return fetch_sub(_Tp(1)) - _Tp(1);}
- _LIBCPP_HIDE_FROM_ABI
- _Tp operator+=(_Tp __op) volatile _NOEXCEPT {return fetch_add(__op) + __op;}
- _LIBCPP_HIDE_FROM_ABI
- _Tp operator+=(_Tp __op) _NOEXCEPT {return fetch_add(__op) + __op;}
- _LIBCPP_HIDE_FROM_ABI
- _Tp operator-=(_Tp __op) volatile _NOEXCEPT {return fetch_sub(__op) - __op;}
- _LIBCPP_HIDE_FROM_ABI
- _Tp operator-=(_Tp __op) _NOEXCEPT {return fetch_sub(__op) - __op;}
- _LIBCPP_HIDE_FROM_ABI
- _Tp operator&=(_Tp __op) volatile _NOEXCEPT {return fetch_and(__op) & __op;}
- _LIBCPP_HIDE_FROM_ABI
- _Tp operator&=(_Tp __op) _NOEXCEPT {return fetch_and(__op) & __op;}
- _LIBCPP_HIDE_FROM_ABI
- _Tp operator|=(_Tp __op) volatile _NOEXCEPT {return fetch_or(__op) | __op;}
- _LIBCPP_HIDE_FROM_ABI
- _Tp operator|=(_Tp __op) _NOEXCEPT {return fetch_or(__op) | __op;}
- _LIBCPP_HIDE_FROM_ABI
- _Tp operator^=(_Tp __op) volatile _NOEXCEPT {return fetch_xor(__op) ^ __op;}
- _LIBCPP_HIDE_FROM_ABI
- _Tp operator^=(_Tp __op) _NOEXCEPT {return fetch_xor(__op) ^ __op;}
+struct __atomic_base<_Tp, true> : public __atomic_base<_Tp, false> {
+ using __base = __atomic_base<_Tp, false>;
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 __atomic_base() _NOEXCEPT = default;
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR __atomic_base(_Tp __d) _NOEXCEPT : __base(__d) {}
+
+ _LIBCPP_HIDE_FROM_ABI _Tp fetch_add(_Tp __op, memory_order __m = memory_order_seq_cst) volatile _NOEXCEPT {
+ return std::__cxx_atomic_fetch_add(std::addressof(this->__a_), __op, __m);
+ }
+ _LIBCPP_HIDE_FROM_ABI _Tp fetch_add(_Tp __op, memory_order __m = memory_order_seq_cst) _NOEXCEPT {
+ return std::__cxx_atomic_fetch_add(std::addressof(this->__a_), __op, __m);
+ }
+ _LIBCPP_HIDE_FROM_ABI _Tp fetch_sub(_Tp __op, memory_order __m = memory_order_seq_cst) volatile _NOEXCEPT {
+ return std::__cxx_atomic_fetch_sub(std::addressof(this->__a_), __op, __m);
+ }
+ _LIBCPP_HIDE_FROM_ABI _Tp fetch_sub(_Tp __op, memory_order __m = memory_order_seq_cst) _NOEXCEPT {
+ return std::__cxx_atomic_fetch_sub(std::addressof(this->__a_), __op, __m);
+ }
+ _LIBCPP_HIDE_FROM_ABI _Tp fetch_and(_Tp __op, memory_order __m = memory_order_seq_cst) volatile _NOEXCEPT {
+ return std::__cxx_atomic_fetch_and(std::addressof(this->__a_), __op, __m);
+ }
+ _LIBCPP_HIDE_FROM_ABI _Tp fetch_and(_Tp __op, memory_order __m = memory_order_seq_cst) _NOEXCEPT {
+ return std::__cxx_atomic_fetch_and(std::addressof(this->__a_), __op, __m);
+ }
+ _LIBCPP_HIDE_FROM_ABI _Tp fetch_or(_Tp __op, memory_order __m = memory_order_seq_cst) volatile _NOEXCEPT {
+ return std::__cxx_atomic_fetch_or(std::addressof(this->__a_), __op, __m);
+ }
+ _LIBCPP_HIDE_FROM_ABI _Tp fetch_or(_Tp __op, memory_order __m = memory_order_seq_cst) _NOEXCEPT {
+ return std::__cxx_atomic_fetch_or(std::addressof(this->__a_), __op, __m);
+ }
+ _LIBCPP_HIDE_FROM_ABI _Tp fetch_xor(_Tp __op, memory_order __m = memory_order_seq_cst) volatile _NOEXCEPT {
+ return std::__cxx_atomic_fetch_xor(std::addressof(this->__a_), __op, __m);
+ }
+ _LIBCPP_HIDE_FROM_ABI _Tp fetch_xor(_Tp __op, memory_order __m = memory_order_seq_cst) _NOEXCEPT {
+ return std::__cxx_atomic_fetch_xor(std::addressof(this->__a_), __op, __m);
+ }
+
+ _LIBCPP_HIDE_FROM_ABI _Tp operator++(int) volatile _NOEXCEPT { return fetch_add(_Tp(1)); }
+ _LIBCPP_HIDE_FROM_ABI _Tp operator++(int) _NOEXCEPT { return fetch_add(_Tp(1)); }
+ _LIBCPP_HIDE_FROM_ABI _Tp operator--(int) volatile _NOEXCEPT { return fetch_sub(_Tp(1)); }
+ _LIBCPP_HIDE_FROM_ABI _Tp operator--(int) _NOEXCEPT { return fetch_sub(_Tp(1)); }
+ _LIBCPP_HIDE_FROM_ABI _Tp operator++() volatile _NOEXCEPT { return fetch_add(_Tp(1)) + _Tp(1); }
+ _LIBCPP_HIDE_FROM_ABI _Tp operator++() _NOEXCEPT { return fetch_add(_Tp(1)) + _Tp(1); }
+ _LIBCPP_HIDE_FROM_ABI _Tp operator--() volatile _NOEXCEPT { return fetch_sub(_Tp(1)) - _Tp(1); }
+ _LIBCPP_HIDE_FROM_ABI _Tp operator--() _NOEXCEPT { return fetch_sub(_Tp(1)) - _Tp(1); }
+ _LIBCPP_HIDE_FROM_ABI _Tp operator+=(_Tp __op) volatile _NOEXCEPT { return fetch_add(__op) + __op; }
+ _LIBCPP_HIDE_FROM_ABI _Tp operator+=(_Tp __op) _NOEXCEPT { return fetch_add(__op) + __op; }
+ _LIBCPP_HIDE_FROM_ABI _Tp operator-=(_Tp __op) volatile _NOEXCEPT { return fetch_sub(__op) - __op; }
+ _LIBCPP_HIDE_FROM_ABI _Tp operator-=(_Tp __op) _NOEXCEPT { return fetch_sub(__op) - __op; }
+ _LIBCPP_HIDE_FROM_ABI _Tp operator&=(_Tp __op) volatile _NOEXCEPT { return fetch_and(__op) & __op; }
+ _LIBCPP_HIDE_FROM_ABI _Tp operator&=(_Tp __op) _NOEXCEPT { return fetch_and(__op) & __op; }
+ _LIBCPP_HIDE_FROM_ABI _Tp operator|=(_Tp __op) volatile _NOEXCEPT { return fetch_or(__op) | __op; }
+ _LIBCPP_HIDE_FROM_ABI _Tp operator|=(_Tp __op) _NOEXCEPT { return fetch_or(__op) | __op; }
+ _LIBCPP_HIDE_FROM_ABI _Tp operator^=(_Tp __op) volatile _NOEXCEPT { return fetch_xor(__op) ^ __op; }
+ _LIBCPP_HIDE_FROM_ABI _Tp operator^=(_Tp __op) _NOEXCEPT { return fetch_xor(__op) ^ __op; }
};
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__atomic/atomic_flag.h b/contrib/llvm-project/libcxx/include/__atomic/atomic_flag.h
index edfa978f9935..d76e5e45c01a 100644
--- a/contrib/llvm-project/libcxx/include/__atomic/atomic_flag.h
+++ b/contrib/llvm-project/libcxx/include/__atomic/atomic_flag.h
@@ -24,205 +24,135 @@
_LIBCPP_BEGIN_NAMESPACE_STD
-struct atomic_flag
-{
- __cxx_atomic_impl<_LIBCPP_ATOMIC_FLAG_TYPE> __a_;
-
- _LIBCPP_HIDE_FROM_ABI
- bool test(memory_order __m = memory_order_seq_cst) const volatile _NOEXCEPT
- {return _LIBCPP_ATOMIC_FLAG_TYPE(true) == __cxx_atomic_load(&__a_, __m);}
- _LIBCPP_HIDE_FROM_ABI
- bool test(memory_order __m = memory_order_seq_cst) const _NOEXCEPT
- {return _LIBCPP_ATOMIC_FLAG_TYPE(true) == __cxx_atomic_load(&__a_, __m);}
-
- _LIBCPP_HIDE_FROM_ABI
- bool test_and_set(memory_order __m = memory_order_seq_cst) volatile _NOEXCEPT
- {return __cxx_atomic_exchange(&__a_, _LIBCPP_ATOMIC_FLAG_TYPE(true), __m);}
- _LIBCPP_HIDE_FROM_ABI
- bool test_and_set(memory_order __m = memory_order_seq_cst) _NOEXCEPT
- {return __cxx_atomic_exchange(&__a_, _LIBCPP_ATOMIC_FLAG_TYPE(true), __m);}
- _LIBCPP_HIDE_FROM_ABI
- void clear(memory_order __m = memory_order_seq_cst) volatile _NOEXCEPT
- {__cxx_atomic_store(&__a_, _LIBCPP_ATOMIC_FLAG_TYPE(false), __m);}
- _LIBCPP_HIDE_FROM_ABI
- void clear(memory_order __m = memory_order_seq_cst) _NOEXCEPT
- {__cxx_atomic_store(&__a_, _LIBCPP_ATOMIC_FLAG_TYPE(false), __m);}
-
- _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI
- void wait(bool __v, memory_order __m = memory_order_seq_cst) const volatile _NOEXCEPT
- {__cxx_atomic_wait(&__a_, _LIBCPP_ATOMIC_FLAG_TYPE(__v), __m);}
- _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI
- void wait(bool __v, memory_order __m = memory_order_seq_cst) const _NOEXCEPT
- {__cxx_atomic_wait(&__a_, _LIBCPP_ATOMIC_FLAG_TYPE(__v), __m);}
- _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI
- void notify_one() volatile _NOEXCEPT
- {__cxx_atomic_notify_one(&__a_);}
- _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI
- void notify_one() _NOEXCEPT
- {__cxx_atomic_notify_one(&__a_);}
- _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI
- void notify_all() volatile _NOEXCEPT
- {__cxx_atomic_notify_all(&__a_);}
- _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI
- void notify_all() _NOEXCEPT
- {__cxx_atomic_notify_all(&__a_);}
+struct atomic_flag {
+ __cxx_atomic_impl<_LIBCPP_ATOMIC_FLAG_TYPE> __a_;
+
+ _LIBCPP_HIDE_FROM_ABI bool test(memory_order __m = memory_order_seq_cst) const volatile _NOEXCEPT {
+ return _LIBCPP_ATOMIC_FLAG_TYPE(true) == __cxx_atomic_load(&__a_, __m);
+ }
+ _LIBCPP_HIDE_FROM_ABI bool test(memory_order __m = memory_order_seq_cst) const _NOEXCEPT {
+ return _LIBCPP_ATOMIC_FLAG_TYPE(true) == __cxx_atomic_load(&__a_, __m);
+ }
+
+ _LIBCPP_HIDE_FROM_ABI bool test_and_set(memory_order __m = memory_order_seq_cst) volatile _NOEXCEPT {
+ return __cxx_atomic_exchange(&__a_, _LIBCPP_ATOMIC_FLAG_TYPE(true), __m);
+ }
+ _LIBCPP_HIDE_FROM_ABI bool test_and_set(memory_order __m = memory_order_seq_cst) _NOEXCEPT {
+ return __cxx_atomic_exchange(&__a_, _LIBCPP_ATOMIC_FLAG_TYPE(true), __m);
+ }
+ _LIBCPP_HIDE_FROM_ABI void clear(memory_order __m = memory_order_seq_cst) volatile _NOEXCEPT {
+ __cxx_atomic_store(&__a_, _LIBCPP_ATOMIC_FLAG_TYPE(false), __m);
+ }
+ _LIBCPP_HIDE_FROM_ABI void clear(memory_order __m = memory_order_seq_cst) _NOEXCEPT {
+ __cxx_atomic_store(&__a_, _LIBCPP_ATOMIC_FLAG_TYPE(false), __m);
+ }
+
+ _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI void wait(bool __v, memory_order __m = memory_order_seq_cst) const
+ volatile _NOEXCEPT {
+ __cxx_atomic_wait(&__a_, _LIBCPP_ATOMIC_FLAG_TYPE(__v), __m);
+ }
+ _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI void
+ wait(bool __v, memory_order __m = memory_order_seq_cst) const _NOEXCEPT {
+ __cxx_atomic_wait(&__a_, _LIBCPP_ATOMIC_FLAG_TYPE(__v), __m);
+ }
+ _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI void notify_one() volatile _NOEXCEPT {
+ __cxx_atomic_notify_one(&__a_);
+ }
+ _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI void notify_one() _NOEXCEPT { __cxx_atomic_notify_one(&__a_); }
+ _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI void notify_all() volatile _NOEXCEPT {
+ __cxx_atomic_notify_all(&__a_);
+ }
+ _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI void notify_all() _NOEXCEPT { __cxx_atomic_notify_all(&__a_); }
#if _LIBCPP_STD_VER >= 20
- _LIBCPP_HIDE_FROM_ABI constexpr
- atomic_flag() _NOEXCEPT : __a_(false) {}
+ _LIBCPP_HIDE_FROM_ABI constexpr atomic_flag() _NOEXCEPT : __a_(false) {}
#else
- atomic_flag() _NOEXCEPT = default;
+ atomic_flag() _NOEXCEPT = default;
#endif
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR
- atomic_flag(bool __b) _NOEXCEPT : __a_(__b) {} // EXTENSION
-
- atomic_flag(const atomic_flag&) = delete;
- atomic_flag& operator=(const atomic_flag&) = delete;
- atomic_flag& operator=(const atomic_flag&) volatile = delete;
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR atomic_flag(bool __b) _NOEXCEPT : __a_(__b) {} // EXTENSION
+ atomic_flag(const atomic_flag&) = delete;
+ atomic_flag& operator=(const atomic_flag&) = delete;
+ atomic_flag& operator=(const atomic_flag&) volatile = delete;
};
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-atomic_flag_test(const volatile atomic_flag* __o) _NOEXCEPT
-{
- return __o->test();
-}
+inline _LIBCPP_HIDE_FROM_ABI bool atomic_flag_test(const volatile atomic_flag* __o) _NOEXCEPT { return __o->test(); }
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-atomic_flag_test(const atomic_flag* __o) _NOEXCEPT
-{
- return __o->test();
-}
+inline _LIBCPP_HIDE_FROM_ABI bool atomic_flag_test(const atomic_flag* __o) _NOEXCEPT { return __o->test(); }
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-atomic_flag_test_explicit(const volatile atomic_flag* __o, memory_order __m) _NOEXCEPT
-{
- return __o->test(__m);
+inline _LIBCPP_HIDE_FROM_ABI bool
+atomic_flag_test_explicit(const volatile atomic_flag* __o, memory_order __m) _NOEXCEPT {
+ return __o->test(__m);
}
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-atomic_flag_test_explicit(const atomic_flag* __o, memory_order __m) _NOEXCEPT
-{
- return __o->test(__m);
+inline _LIBCPP_HIDE_FROM_ABI bool atomic_flag_test_explicit(const atomic_flag* __o, memory_order __m) _NOEXCEPT {
+ return __o->test(__m);
}
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-atomic_flag_test_and_set(volatile atomic_flag* __o) _NOEXCEPT
-{
- return __o->test_and_set();
+inline _LIBCPP_HIDE_FROM_ABI bool atomic_flag_test_and_set(volatile atomic_flag* __o) _NOEXCEPT {
+ return __o->test_and_set();
}
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-atomic_flag_test_and_set(atomic_flag* __o) _NOEXCEPT
-{
- return __o->test_and_set();
-}
+inline _LIBCPP_HIDE_FROM_ABI bool atomic_flag_test_and_set(atomic_flag* __o) _NOEXCEPT { return __o->test_and_set(); }
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-atomic_flag_test_and_set_explicit(volatile atomic_flag* __o, memory_order __m) _NOEXCEPT
-{
- return __o->test_and_set(__m);
+inline _LIBCPP_HIDE_FROM_ABI bool
+atomic_flag_test_and_set_explicit(volatile atomic_flag* __o, memory_order __m) _NOEXCEPT {
+ return __o->test_and_set(__m);
}
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-atomic_flag_test_and_set_explicit(atomic_flag* __o, memory_order __m) _NOEXCEPT
-{
- return __o->test_and_set(__m);
+inline _LIBCPP_HIDE_FROM_ABI bool atomic_flag_test_and_set_explicit(atomic_flag* __o, memory_order __m) _NOEXCEPT {
+ return __o->test_and_set(__m);
}
-inline _LIBCPP_HIDE_FROM_ABI
-void
-atomic_flag_clear(volatile atomic_flag* __o) _NOEXCEPT
-{
- __o->clear();
-}
+inline _LIBCPP_HIDE_FROM_ABI void atomic_flag_clear(volatile atomic_flag* __o) _NOEXCEPT { __o->clear(); }
-inline _LIBCPP_HIDE_FROM_ABI
-void
-atomic_flag_clear(atomic_flag* __o) _NOEXCEPT
-{
- __o->clear();
-}
+inline _LIBCPP_HIDE_FROM_ABI void atomic_flag_clear(atomic_flag* __o) _NOEXCEPT { __o->clear(); }
-inline _LIBCPP_HIDE_FROM_ABI
-void
-atomic_flag_clear_explicit(volatile atomic_flag* __o, memory_order __m) _NOEXCEPT
-{
- __o->clear(__m);
+inline _LIBCPP_HIDE_FROM_ABI void atomic_flag_clear_explicit(volatile atomic_flag* __o, memory_order __m) _NOEXCEPT {
+ __o->clear(__m);
}
-inline _LIBCPP_HIDE_FROM_ABI
-void
-atomic_flag_clear_explicit(atomic_flag* __o, memory_order __m) _NOEXCEPT
-{
- __o->clear(__m);
+inline _LIBCPP_HIDE_FROM_ABI void atomic_flag_clear_explicit(atomic_flag* __o, memory_order __m) _NOEXCEPT {
+ __o->clear(__m);
}
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_SYNC
-void
-atomic_flag_wait(const volatile atomic_flag* __o, bool __v) _NOEXCEPT
-{
- __o->wait(__v);
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_SYNC void
+atomic_flag_wait(const volatile atomic_flag* __o, bool __v) _NOEXCEPT {
+ __o->wait(__v);
}
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_SYNC
-void
-atomic_flag_wait(const atomic_flag* __o, bool __v) _NOEXCEPT
-{
- __o->wait(__v);
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_SYNC void
+atomic_flag_wait(const atomic_flag* __o, bool __v) _NOEXCEPT {
+ __o->wait(__v);
}
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_SYNC
-void
-atomic_flag_wait_explicit(const volatile atomic_flag* __o,
- bool __v, memory_order __m) _NOEXCEPT
-{
- __o->wait(__v, __m);
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_SYNC void
+atomic_flag_wait_explicit(const volatile atomic_flag* __o, bool __v, memory_order __m) _NOEXCEPT {
+ __o->wait(__v, __m);
}
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_SYNC
-void
-atomic_flag_wait_explicit(const atomic_flag* __o,
- bool __v, memory_order __m) _NOEXCEPT
-{
- __o->wait(__v, __m);
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_SYNC void
+atomic_flag_wait_explicit(const atomic_flag* __o, bool __v, memory_order __m) _NOEXCEPT {
+ __o->wait(__v, __m);
}
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_SYNC
-void
-atomic_flag_notify_one(volatile atomic_flag* __o) _NOEXCEPT
-{
- __o->notify_one();
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_SYNC void
+atomic_flag_notify_one(volatile atomic_flag* __o) _NOEXCEPT {
+ __o->notify_one();
}
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_SYNC
-void
-atomic_flag_notify_one(atomic_flag* __o) _NOEXCEPT
-{
- __o->notify_one();
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_SYNC void atomic_flag_notify_one(atomic_flag* __o) _NOEXCEPT {
+ __o->notify_one();
}
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_SYNC
-void
-atomic_flag_notify_all(volatile atomic_flag* __o) _NOEXCEPT
-{
- __o->notify_all();
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_SYNC void
+atomic_flag_notify_all(volatile atomic_flag* __o) _NOEXCEPT {
+ __o->notify_all();
}
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_SYNC
-void
-atomic_flag_notify_all(atomic_flag* __o) _NOEXCEPT
-{
- __o->notify_all();
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_SYNC void atomic_flag_notify_all(atomic_flag* __o) _NOEXCEPT {
+ __o->notify_all();
}
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__atomic/atomic_lock_free.h b/contrib/llvm-project/libcxx/include/__atomic/atomic_lock_free.h
index d607569ed07d..0715439db450 100644
--- a/contrib/llvm-project/libcxx/include/__atomic/atomic_lock_free.h
+++ b/contrib/llvm-project/libcxx/include/__atomic/atomic_lock_free.h
@@ -16,33 +16,33 @@
#endif
#if defined(__CLANG_ATOMIC_BOOL_LOCK_FREE)
-# define ATOMIC_BOOL_LOCK_FREE __CLANG_ATOMIC_BOOL_LOCK_FREE
-# define ATOMIC_CHAR_LOCK_FREE __CLANG_ATOMIC_CHAR_LOCK_FREE
-#ifndef _LIBCPP_HAS_NO_CHAR8_T
-# define ATOMIC_CHAR8_T_LOCK_FREE __CLANG_ATOMIC_CHAR8_T_LOCK_FREE
-#endif
-# define ATOMIC_CHAR16_T_LOCK_FREE __CLANG_ATOMIC_CHAR16_T_LOCK_FREE
-# define ATOMIC_CHAR32_T_LOCK_FREE __CLANG_ATOMIC_CHAR32_T_LOCK_FREE
-# define ATOMIC_WCHAR_T_LOCK_FREE __CLANG_ATOMIC_WCHAR_T_LOCK_FREE
-# define ATOMIC_SHORT_LOCK_FREE __CLANG_ATOMIC_SHORT_LOCK_FREE
-# define ATOMIC_INT_LOCK_FREE __CLANG_ATOMIC_INT_LOCK_FREE
-# define ATOMIC_LONG_LOCK_FREE __CLANG_ATOMIC_LONG_LOCK_FREE
-# define ATOMIC_LLONG_LOCK_FREE __CLANG_ATOMIC_LLONG_LOCK_FREE
-# define ATOMIC_POINTER_LOCK_FREE __CLANG_ATOMIC_POINTER_LOCK_FREE
+# define ATOMIC_BOOL_LOCK_FREE __CLANG_ATOMIC_BOOL_LOCK_FREE
+# define ATOMIC_CHAR_LOCK_FREE __CLANG_ATOMIC_CHAR_LOCK_FREE
+# ifndef _LIBCPP_HAS_NO_CHAR8_T
+# define ATOMIC_CHAR8_T_LOCK_FREE __CLANG_ATOMIC_CHAR8_T_LOCK_FREE
+# endif
+# define ATOMIC_CHAR16_T_LOCK_FREE __CLANG_ATOMIC_CHAR16_T_LOCK_FREE
+# define ATOMIC_CHAR32_T_LOCK_FREE __CLANG_ATOMIC_CHAR32_T_LOCK_FREE
+# define ATOMIC_WCHAR_T_LOCK_FREE __CLANG_ATOMIC_WCHAR_T_LOCK_FREE
+# define ATOMIC_SHORT_LOCK_FREE __CLANG_ATOMIC_SHORT_LOCK_FREE
+# define ATOMIC_INT_LOCK_FREE __CLANG_ATOMIC_INT_LOCK_FREE
+# define ATOMIC_LONG_LOCK_FREE __CLANG_ATOMIC_LONG_LOCK_FREE
+# define ATOMIC_LLONG_LOCK_FREE __CLANG_ATOMIC_LLONG_LOCK_FREE
+# define ATOMIC_POINTER_LOCK_FREE __CLANG_ATOMIC_POINTER_LOCK_FREE
#elif defined(__GCC_ATOMIC_BOOL_LOCK_FREE)
-# define ATOMIC_BOOL_LOCK_FREE __GCC_ATOMIC_BOOL_LOCK_FREE
-# define ATOMIC_CHAR_LOCK_FREE __GCC_ATOMIC_CHAR_LOCK_FREE
-#ifndef _LIBCPP_HAS_NO_CHAR8_T
-# define ATOMIC_CHAR8_T_LOCK_FREE __GCC_ATOMIC_CHAR8_T_LOCK_FREE
-#endif
-# define ATOMIC_CHAR16_T_LOCK_FREE __GCC_ATOMIC_CHAR16_T_LOCK_FREE
-# define ATOMIC_CHAR32_T_LOCK_FREE __GCC_ATOMIC_CHAR32_T_LOCK_FREE
-# define ATOMIC_WCHAR_T_LOCK_FREE __GCC_ATOMIC_WCHAR_T_LOCK_FREE
-# define ATOMIC_SHORT_LOCK_FREE __GCC_ATOMIC_SHORT_LOCK_FREE
-# define ATOMIC_INT_LOCK_FREE __GCC_ATOMIC_INT_LOCK_FREE
-# define ATOMIC_LONG_LOCK_FREE __GCC_ATOMIC_LONG_LOCK_FREE
-# define ATOMIC_LLONG_LOCK_FREE __GCC_ATOMIC_LLONG_LOCK_FREE
-# define ATOMIC_POINTER_LOCK_FREE __GCC_ATOMIC_POINTER_LOCK_FREE
+# define ATOMIC_BOOL_LOCK_FREE __GCC_ATOMIC_BOOL_LOCK_FREE
+# define ATOMIC_CHAR_LOCK_FREE __GCC_ATOMIC_CHAR_LOCK_FREE
+# ifndef _LIBCPP_HAS_NO_CHAR8_T
+# define ATOMIC_CHAR8_T_LOCK_FREE __GCC_ATOMIC_CHAR8_T_LOCK_FREE
+# endif
+# define ATOMIC_CHAR16_T_LOCK_FREE __GCC_ATOMIC_CHAR16_T_LOCK_FREE
+# define ATOMIC_CHAR32_T_LOCK_FREE __GCC_ATOMIC_CHAR32_T_LOCK_FREE
+# define ATOMIC_WCHAR_T_LOCK_FREE __GCC_ATOMIC_WCHAR_T_LOCK_FREE
+# define ATOMIC_SHORT_LOCK_FREE __GCC_ATOMIC_SHORT_LOCK_FREE
+# define ATOMIC_INT_LOCK_FREE __GCC_ATOMIC_INT_LOCK_FREE
+# define ATOMIC_LONG_LOCK_FREE __GCC_ATOMIC_LONG_LOCK_FREE
+# define ATOMIC_LLONG_LOCK_FREE __GCC_ATOMIC_LLONG_LOCK_FREE
+# define ATOMIC_POINTER_LOCK_FREE __GCC_ATOMIC_POINTER_LOCK_FREE
#endif
#endif // _LIBCPP___ATOMIC_ATOMIC_LOCK_FREE_H
diff --git a/contrib/llvm-project/libcxx/include/__atomic/atomic_sync.h b/contrib/llvm-project/libcxx/include/__atomic/atomic_sync.h
index d55450bb5f9c..3d20d6a8ce25 100644
--- a/contrib/llvm-project/libcxx/include/__atomic/atomic_sync.h
+++ b/contrib/llvm-project/libcxx/include/__atomic/atomic_sync.h
@@ -34,77 +34,73 @@ _LIBCPP_AVAILABILITY_SYNC _LIBCPP_EXPORTED_FROM_ABI void __cxx_atomic_notify_all
_LIBCPP_AVAILABILITY_SYNC _LIBCPP_EXPORTED_FROM_ABI __cxx_contention_t __libcpp_atomic_monitor(void const volatile*);
_LIBCPP_AVAILABILITY_SYNC _LIBCPP_EXPORTED_FROM_ABI void __libcpp_atomic_wait(void const volatile*, __cxx_contention_t);
-_LIBCPP_AVAILABILITY_SYNC _LIBCPP_EXPORTED_FROM_ABI void __cxx_atomic_notify_one(__cxx_atomic_contention_t const volatile*);
-_LIBCPP_AVAILABILITY_SYNC _LIBCPP_EXPORTED_FROM_ABI void __cxx_atomic_notify_all(__cxx_atomic_contention_t const volatile*);
-_LIBCPP_AVAILABILITY_SYNC _LIBCPP_EXPORTED_FROM_ABI __cxx_contention_t __libcpp_atomic_monitor(__cxx_atomic_contention_t const volatile*);
-_LIBCPP_AVAILABILITY_SYNC _LIBCPP_EXPORTED_FROM_ABI void __libcpp_atomic_wait(__cxx_atomic_contention_t const volatile*, __cxx_contention_t);
+_LIBCPP_AVAILABILITY_SYNC _LIBCPP_EXPORTED_FROM_ABI void
+__cxx_atomic_notify_one(__cxx_atomic_contention_t const volatile*);
+_LIBCPP_AVAILABILITY_SYNC _LIBCPP_EXPORTED_FROM_ABI void
+__cxx_atomic_notify_all(__cxx_atomic_contention_t const volatile*);
+_LIBCPP_AVAILABILITY_SYNC _LIBCPP_EXPORTED_FROM_ABI __cxx_contention_t
+__libcpp_atomic_monitor(__cxx_atomic_contention_t const volatile*);
+_LIBCPP_AVAILABILITY_SYNC _LIBCPP_EXPORTED_FROM_ABI void
+__libcpp_atomic_wait(__cxx_atomic_contention_t const volatile*, __cxx_contention_t);
template <class _Atp, class _Fn>
struct __libcpp_atomic_wait_backoff_impl {
- _Atp* __a;
- _Fn __test_fn;
- _LIBCPP_AVAILABILITY_SYNC
- _LIBCPP_HIDE_FROM_ABI bool operator()(chrono::nanoseconds __elapsed) const
- {
- if(__elapsed > chrono::microseconds(64))
- {
- auto const __monitor = std::__libcpp_atomic_monitor(__a);
- if(__test_fn())
- return true;
- std::__libcpp_atomic_wait(__a, __monitor);
- }
- else if(__elapsed > chrono::microseconds(4))
- __libcpp_thread_yield();
- else
- {} // poll
- return false;
- }
+ _Atp* __a;
+ _Fn __test_fn;
+ _LIBCPP_AVAILABILITY_SYNC
+ _LIBCPP_HIDE_FROM_ABI bool operator()(chrono::nanoseconds __elapsed) const {
+ if (__elapsed > chrono::microseconds(64)) {
+ auto const __monitor = std::__libcpp_atomic_monitor(__a);
+ if (__test_fn())
+ return true;
+ std::__libcpp_atomic_wait(__a, __monitor);
+ } else if (__elapsed > chrono::microseconds(4))
+ __libcpp_thread_yield();
+ else {
+ } // poll
+ return false;
+ }
};
template <class _Atp, class _Fn>
-_LIBCPP_AVAILABILITY_SYNC
-_LIBCPP_HIDE_FROM_ABI bool __cxx_atomic_wait(_Atp* __a, _Fn && __test_fn)
-{
- __libcpp_atomic_wait_backoff_impl<_Atp, __decay_t<_Fn> > __backoff_fn = {__a, __test_fn};
- return std::__libcpp_thread_poll_with_backoff(__test_fn, __backoff_fn);
+_LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI bool __cxx_atomic_wait(_Atp* __a, _Fn&& __test_fn) {
+ __libcpp_atomic_wait_backoff_impl<_Atp, __decay_t<_Fn> > __backoff_fn = {__a, __test_fn};
+ return std::__libcpp_thread_poll_with_backoff(__test_fn, __backoff_fn);
}
#else // _LIBCPP_HAS_NO_THREADS
template <class _Tp>
-_LIBCPP_HIDE_FROM_ABI void __cxx_atomic_notify_all(__cxx_atomic_impl<_Tp> const volatile*) { }
+_LIBCPP_HIDE_FROM_ABI void __cxx_atomic_notify_all(__cxx_atomic_impl<_Tp> const volatile*) {}
template <class _Tp>
-_LIBCPP_HIDE_FROM_ABI void __cxx_atomic_notify_one(__cxx_atomic_impl<_Tp> const volatile*) { }
+_LIBCPP_HIDE_FROM_ABI void __cxx_atomic_notify_one(__cxx_atomic_impl<_Tp> const volatile*) {}
template <class _Atp, class _Fn>
-_LIBCPP_HIDE_FROM_ABI bool __cxx_atomic_wait(_Atp*, _Fn && __test_fn)
-{
- return std::__libcpp_thread_poll_with_backoff(__test_fn, __spinning_backoff_policy());
+_LIBCPP_HIDE_FROM_ABI bool __cxx_atomic_wait(_Atp*, _Fn&& __test_fn) {
+ return std::__libcpp_thread_poll_with_backoff(__test_fn, __spinning_backoff_policy());
}
#endif // _LIBCPP_HAS_NO_THREADS
-template <typename _Tp> _LIBCPP_HIDE_FROM_ABI
-bool __cxx_nonatomic_compare_equal(_Tp const& __lhs, _Tp const& __rhs) {
- return std::memcmp(std::addressof(__lhs), std::addressof(__rhs), sizeof(_Tp)) == 0;
+template <typename _Tp>
+_LIBCPP_HIDE_FROM_ABI bool __cxx_nonatomic_compare_equal(_Tp const& __lhs, _Tp const& __rhs) {
+ return std::memcmp(std::addressof(__lhs), std::addressof(__rhs), sizeof(_Tp)) == 0;
}
template <class _Atp, class _Tp>
struct __cxx_atomic_wait_test_fn_impl {
- _Atp* __a;
- _Tp __val;
- memory_order __order;
- _LIBCPP_HIDE_FROM_ABI bool operator()() const
- {
- return !std::__cxx_nonatomic_compare_equal(std::__cxx_atomic_load(__a, __order), __val);
- }
+ _Atp* __a;
+ _Tp __val;
+ memory_order __order;
+ _LIBCPP_HIDE_FROM_ABI bool operator()() const {
+ return !std::__cxx_nonatomic_compare_equal(std::__cxx_atomic_load(__a, __order), __val);
+ }
};
template <class _Atp, class _Tp>
-_LIBCPP_AVAILABILITY_SYNC
-_LIBCPP_HIDE_FROM_ABI bool __cxx_atomic_wait(_Atp* __a, _Tp const __val, memory_order __order)
-{
- __cxx_atomic_wait_test_fn_impl<_Atp, _Tp> __test_fn = {__a, __val, __order};
- return std::__cxx_atomic_wait(__a, __test_fn);
+_LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI bool
+__cxx_atomic_wait(_Atp* __a, _Tp const __val, memory_order __order) {
+ __cxx_atomic_wait_test_fn_impl<_Atp, _Tp> __test_fn = {__a, __val, __order};
+ return std::__cxx_atomic_wait(__a, __test_fn);
}
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__atomic/check_memory_order.h b/contrib/llvm-project/libcxx/include/__atomic/check_memory_order.h
index d744312122bd..3012aec0521b 100644
--- a/contrib/llvm-project/libcxx/include/__atomic/check_memory_order.h
+++ b/contrib/llvm-project/libcxx/include/__atomic/check_memory_order.h
@@ -15,20 +15,16 @@
# pragma GCC system_header
#endif
-#define _LIBCPP_CHECK_STORE_MEMORY_ORDER(__m) \
- _LIBCPP_DIAGNOSE_WARNING(__m == memory_order_consume || \
- __m == memory_order_acquire || \
- __m == memory_order_acq_rel, \
- "memory order argument to atomic operation is invalid")
+#define _LIBCPP_CHECK_STORE_MEMORY_ORDER(__m) \
+ _LIBCPP_DIAGNOSE_WARNING(__m == memory_order_consume || __m == memory_order_acquire || __m == memory_order_acq_rel, \
+ "memory order argument to atomic operation is invalid")
-#define _LIBCPP_CHECK_LOAD_MEMORY_ORDER(__m) \
- _LIBCPP_DIAGNOSE_WARNING(__m == memory_order_release || \
- __m == memory_order_acq_rel, \
- "memory order argument to atomic operation is invalid")
+#define _LIBCPP_CHECK_LOAD_MEMORY_ORDER(__m) \
+ _LIBCPP_DIAGNOSE_WARNING(__m == memory_order_release || __m == memory_order_acq_rel, \
+ "memory order argument to atomic operation is invalid")
-#define _LIBCPP_CHECK_EXCHANGE_MEMORY_ORDER(__m, __f) \
- _LIBCPP_DIAGNOSE_WARNING(__f == memory_order_release || \
- __f == memory_order_acq_rel, \
- "memory order argument to atomic operation is invalid")
+#define _LIBCPP_CHECK_EXCHANGE_MEMORY_ORDER(__m, __f) \
+ _LIBCPP_DIAGNOSE_WARNING(__f == memory_order_release || __f == memory_order_acq_rel, \
+ "memory order argument to atomic operation is invalid")
#endif // _LIBCPP___ATOMIC_CHECK_MEMORY_ORDER_H
diff --git a/contrib/llvm-project/libcxx/include/__atomic/contention_t.h b/contrib/llvm-project/libcxx/include/__atomic/contention_t.h
index 1d8d02430b4f..65890f338ce9 100644
--- a/contrib/llvm-project/libcxx/include/__atomic/contention_t.h
+++ b/contrib/llvm-project/libcxx/include/__atomic/contention_t.h
@@ -20,9 +20,9 @@
_LIBCPP_BEGIN_NAMESPACE_STD
#if defined(__linux__) || (defined(_AIX) && !defined(__64BIT__))
- using __cxx_contention_t = int32_t;
+using __cxx_contention_t = int32_t;
#else
- using __cxx_contention_t = int64_t;
+using __cxx_contention_t = int64_t;
#endif // __linux__ || (_AIX && !__64BIT__)
using __cxx_atomic_contention_t = __cxx_atomic_impl<__cxx_contention_t>;
diff --git a/contrib/llvm-project/libcxx/include/__atomic/cxx_atomic_impl.h b/contrib/llvm-project/libcxx/include/__atomic/cxx_atomic_impl.h
index 5d724669fee8..1a0b808a0cb1 100644
--- a/contrib/llvm-project/libcxx/include/__atomic/cxx_atomic_impl.h
+++ b/contrib/llvm-project/libcxx/include/__atomic/cxx_atomic_impl.h
@@ -26,20 +26,19 @@
_LIBCPP_BEGIN_NAMESPACE_STD
-#if defined(_LIBCPP_HAS_GCC_ATOMIC_IMP) || \
- defined(_LIBCPP_ATOMIC_ONLY_USE_BUILTINS)
+#if defined(_LIBCPP_HAS_GCC_ATOMIC_IMP) || defined(_LIBCPP_ATOMIC_ONLY_USE_BUILTINS)
// [atomics.types.generic]p1 guarantees _Tp is trivially copyable. Because
// the default operator= in an object is not volatile, a byte-by-byte copy
// is required.
-template <typename _Tp, typename _Tv, __enable_if_t<is_assignable<_Tp&, _Tv>::value, int> = 0> _LIBCPP_HIDE_FROM_ABI
-void __cxx_atomic_assign_volatile(_Tp& __a_value, _Tv const& __val) {
+template <typename _Tp, typename _Tv, __enable_if_t<is_assignable<_Tp&, _Tv>::value, int> = 0>
+_LIBCPP_HIDE_FROM_ABI void __cxx_atomic_assign_volatile(_Tp& __a_value, _Tv const& __val) {
__a_value = __val;
}
-template <typename _Tp, typename _Tv, __enable_if_t<is_assignable<_Tp&, _Tv>::value, int> = 0> _LIBCPP_HIDE_FROM_ABI
-void __cxx_atomic_assign_volatile(_Tp volatile& __a_value, _Tv volatile const& __val) {
+template <typename _Tp, typename _Tv, __enable_if_t<is_assignable<_Tp&, _Tv>::value, int> = 0>
+_LIBCPP_HIDE_FROM_ABI void __cxx_atomic_assign_volatile(_Tp volatile& __a_value, _Tv volatile const& __val) {
volatile char* __to = reinterpret_cast<volatile char*>(std::addressof(__a_value));
- volatile char* __end = __to + sizeof(_Tp);
+ volatile char* __end = __to + sizeof(_Tp);
volatile const char* __from = reinterpret_cast<volatile const char*>(std::addressof(__val));
while (__to != __end)
*__to++ = *__from++;
@@ -51,78 +50,74 @@ void __cxx_atomic_assign_volatile(_Tp volatile& __a_value, _Tv volatile const& _
template <typename _Tp>
struct __cxx_atomic_base_impl {
-
_LIBCPP_HIDE_FROM_ABI
-#ifndef _LIBCPP_CXX03_LANG
- __cxx_atomic_base_impl() _NOEXCEPT = default;
-#else
- __cxx_atomic_base_impl() _NOEXCEPT : __a_value() {}
-#endif // _LIBCPP_CXX03_LANG
- _LIBCPP_CONSTEXPR explicit __cxx_atomic_base_impl(_Tp value) _NOEXCEPT
- : __a_value(value) {}
+# ifndef _LIBCPP_CXX03_LANG
+ __cxx_atomic_base_impl() _NOEXCEPT = default;
+# else
+ __cxx_atomic_base_impl() _NOEXCEPT : __a_value() {
+ }
+# endif // _LIBCPP_CXX03_LANG
+ _LIBCPP_CONSTEXPR explicit __cxx_atomic_base_impl(_Tp value) _NOEXCEPT : __a_value(value) {}
_Tp __a_value;
};
_LIBCPP_HIDE_FROM_ABI inline _LIBCPP_CONSTEXPR int __to_gcc_order(memory_order __order) {
// Avoid switch statement to make this a constexpr.
- return __order == memory_order_relaxed ? __ATOMIC_RELAXED:
- (__order == memory_order_acquire ? __ATOMIC_ACQUIRE:
- (__order == memory_order_release ? __ATOMIC_RELEASE:
- (__order == memory_order_seq_cst ? __ATOMIC_SEQ_CST:
- (__order == memory_order_acq_rel ? __ATOMIC_ACQ_REL:
- __ATOMIC_CONSUME))));
+ return __order == memory_order_relaxed
+ ? __ATOMIC_RELAXED
+ : (__order == memory_order_acquire
+ ? __ATOMIC_ACQUIRE
+ : (__order == memory_order_release
+ ? __ATOMIC_RELEASE
+ : (__order == memory_order_seq_cst
+ ? __ATOMIC_SEQ_CST
+ : (__order == memory_order_acq_rel ? __ATOMIC_ACQ_REL : __ATOMIC_CONSUME))));
}
_LIBCPP_HIDE_FROM_ABI inline _LIBCPP_CONSTEXPR int __to_gcc_failure_order(memory_order __order) {
// Avoid switch statement to make this a constexpr.
- return __order == memory_order_relaxed ? __ATOMIC_RELAXED:
- (__order == memory_order_acquire ? __ATOMIC_ACQUIRE:
- (__order == memory_order_release ? __ATOMIC_RELAXED:
- (__order == memory_order_seq_cst ? __ATOMIC_SEQ_CST:
- (__order == memory_order_acq_rel ? __ATOMIC_ACQUIRE:
- __ATOMIC_CONSUME))));
+ return __order == memory_order_relaxed
+ ? __ATOMIC_RELAXED
+ : (__order == memory_order_acquire
+ ? __ATOMIC_ACQUIRE
+ : (__order == memory_order_release
+ ? __ATOMIC_RELAXED
+ : (__order == memory_order_seq_cst
+ ? __ATOMIC_SEQ_CST
+ : (__order == memory_order_acq_rel ? __ATOMIC_ACQUIRE : __ATOMIC_CONSUME))));
}
template <typename _Tp>
-_LIBCPP_HIDE_FROM_ABI
-void __cxx_atomic_init(volatile __cxx_atomic_base_impl<_Tp>* __a, _Tp __val) {
+_LIBCPP_HIDE_FROM_ABI void __cxx_atomic_init(volatile __cxx_atomic_base_impl<_Tp>* __a, _Tp __val) {
__cxx_atomic_assign_volatile(__a->__a_value, __val);
}
template <typename _Tp>
-_LIBCPP_HIDE_FROM_ABI
-void __cxx_atomic_init(__cxx_atomic_base_impl<_Tp>* __a, _Tp __val) {
+_LIBCPP_HIDE_FROM_ABI void __cxx_atomic_init(__cxx_atomic_base_impl<_Tp>* __a, _Tp __val) {
__a->__a_value = __val;
}
-_LIBCPP_HIDE_FROM_ABI inline
-void __cxx_atomic_thread_fence(memory_order __order) {
+_LIBCPP_HIDE_FROM_ABI inline void __cxx_atomic_thread_fence(memory_order __order) {
__atomic_thread_fence(__to_gcc_order(__order));
}
-_LIBCPP_HIDE_FROM_ABI inline
-void __cxx_atomic_signal_fence(memory_order __order) {
+_LIBCPP_HIDE_FROM_ABI inline void __cxx_atomic_signal_fence(memory_order __order) {
__atomic_signal_fence(__to_gcc_order(__order));
}
template <typename _Tp>
-_LIBCPP_HIDE_FROM_ABI
-void __cxx_atomic_store(volatile __cxx_atomic_base_impl<_Tp>* __a, _Tp __val,
- memory_order __order) {
+_LIBCPP_HIDE_FROM_ABI void
+__cxx_atomic_store(volatile __cxx_atomic_base_impl<_Tp>* __a, _Tp __val, memory_order __order) {
__atomic_store(std::addressof(__a->__a_value), std::addressof(__val), __to_gcc_order(__order));
}
template <typename _Tp>
-_LIBCPP_HIDE_FROM_ABI
-void __cxx_atomic_store(__cxx_atomic_base_impl<_Tp>* __a, _Tp __val,
- memory_order __order) {
+_LIBCPP_HIDE_FROM_ABI void __cxx_atomic_store(__cxx_atomic_base_impl<_Tp>* __a, _Tp __val, memory_order __order) {
__atomic_store(std::addressof(__a->__a_value), std::addressof(__val), __to_gcc_order(__order));
}
template <typename _Tp>
-_LIBCPP_HIDE_FROM_ABI
-_Tp __cxx_atomic_load(const volatile __cxx_atomic_base_impl<_Tp>* __a,
- memory_order __order) {
+_LIBCPP_HIDE_FROM_ABI _Tp __cxx_atomic_load(const volatile __cxx_atomic_base_impl<_Tp>* __a, memory_order __order) {
_Tp __ret;
__atomic_load(std::addressof(__a->__a_value), std::addressof(__ret), __to_gcc_order(__order));
return __ret;
@@ -141,17 +136,15 @@ __cxx_atomic_load_inplace(const __cxx_atomic_base_impl<_Tp>* __a, _Tp* __dst, me
}
template <typename _Tp>
-_LIBCPP_HIDE_FROM_ABI
-_Tp __cxx_atomic_load(const __cxx_atomic_base_impl<_Tp>* __a, memory_order __order) {
+_LIBCPP_HIDE_FROM_ABI _Tp __cxx_atomic_load(const __cxx_atomic_base_impl<_Tp>* __a, memory_order __order) {
_Tp __ret;
__atomic_load(std::addressof(__a->__a_value), std::addressof(__ret), __to_gcc_order(__order));
return __ret;
}
template <typename _Tp>
-_LIBCPP_HIDE_FROM_ABI
-_Tp __cxx_atomic_exchange(volatile __cxx_atomic_base_impl<_Tp>* __a,
- _Tp __value, memory_order __order) {
+_LIBCPP_HIDE_FROM_ABI _Tp
+__cxx_atomic_exchange(volatile __cxx_atomic_base_impl<_Tp>* __a, _Tp __value, memory_order __order) {
_Tp __ret;
__atomic_exchange(
std::addressof(__a->__a_value), std::addressof(__value), std::addressof(__ret), __to_gcc_order(__order));
@@ -159,9 +152,7 @@ _Tp __cxx_atomic_exchange(volatile __cxx_atomic_base_impl<_Tp>* __a,
}
template <typename _Tp>
-_LIBCPP_HIDE_FROM_ABI
-_Tp __cxx_atomic_exchange(__cxx_atomic_base_impl<_Tp>* __a, _Tp __value,
- memory_order __order) {
+_LIBCPP_HIDE_FROM_ABI _Tp __cxx_atomic_exchange(__cxx_atomic_base_impl<_Tp>* __a, _Tp __value, memory_order __order) {
_Tp __ret;
__atomic_exchange(
std::addressof(__a->__a_value), std::addressof(__value), std::addressof(__ret), __to_gcc_order(__order));
@@ -169,10 +160,12 @@ _Tp __cxx_atomic_exchange(__cxx_atomic_base_impl<_Tp>* __a, _Tp __value,
}
template <typename _Tp>
-_LIBCPP_HIDE_FROM_ABI
-bool __cxx_atomic_compare_exchange_strong(
- volatile __cxx_atomic_base_impl<_Tp>* __a, _Tp* __expected, _Tp __value,
- memory_order __success, memory_order __failure) {
+_LIBCPP_HIDE_FROM_ABI bool __cxx_atomic_compare_exchange_strong(
+ volatile __cxx_atomic_base_impl<_Tp>* __a,
+ _Tp* __expected,
+ _Tp __value,
+ memory_order __success,
+ memory_order __failure) {
return __atomic_compare_exchange(
std::addressof(__a->__a_value),
__expected,
@@ -183,10 +176,8 @@ bool __cxx_atomic_compare_exchange_strong(
}
template <typename _Tp>
-_LIBCPP_HIDE_FROM_ABI
-bool __cxx_atomic_compare_exchange_strong(
- __cxx_atomic_base_impl<_Tp>* __a, _Tp* __expected, _Tp __value, memory_order __success,
- memory_order __failure) {
+_LIBCPP_HIDE_FROM_ABI bool __cxx_atomic_compare_exchange_strong(
+ __cxx_atomic_base_impl<_Tp>* __a, _Tp* __expected, _Tp __value, memory_order __success, memory_order __failure) {
return __atomic_compare_exchange(
std::addressof(__a->__a_value),
__expected,
@@ -197,10 +188,12 @@ bool __cxx_atomic_compare_exchange_strong(
}
template <typename _Tp>
-_LIBCPP_HIDE_FROM_ABI
-bool __cxx_atomic_compare_exchange_weak(
- volatile __cxx_atomic_base_impl<_Tp>* __a, _Tp* __expected, _Tp __value,
- memory_order __success, memory_order __failure) {
+_LIBCPP_HIDE_FROM_ABI bool __cxx_atomic_compare_exchange_weak(
+ volatile __cxx_atomic_base_impl<_Tp>* __a,
+ _Tp* __expected,
+ _Tp __value,
+ memory_order __success,
+ memory_order __failure) {
return __atomic_compare_exchange(
std::addressof(__a->__a_value),
__expected,
@@ -211,10 +204,8 @@ bool __cxx_atomic_compare_exchange_weak(
}
template <typename _Tp>
-_LIBCPP_HIDE_FROM_ABI
-bool __cxx_atomic_compare_exchange_weak(
- __cxx_atomic_base_impl<_Tp>* __a, _Tp* __expected, _Tp __value, memory_order __success,
- memory_order __failure) {
+_LIBCPP_HIDE_FROM_ABI bool __cxx_atomic_compare_exchange_weak(
+ __cxx_atomic_base_impl<_Tp>* __a, _Tp* __expected, _Tp __value, memory_order __success, memory_order __failure) {
return __atomic_compare_exchange(
std::addressof(__a->__a_value),
__expected,
@@ -225,193 +216,182 @@ bool __cxx_atomic_compare_exchange_weak(
}
template <typename _Tp>
-struct __skip_amt { enum {value = 1}; };
+struct __skip_amt {
+ enum { value = 1 };
+};
template <typename _Tp>
-struct __skip_amt<_Tp*> { enum {value = sizeof(_Tp)}; };
+struct __skip_amt<_Tp*> {
+ enum { value = sizeof(_Tp) };
+};
// FIXME: Haven't figured out what the spec says about using arrays with
// atomic_fetch_add. Force a failure rather than creating bad behavior.
template <typename _Tp>
-struct __skip_amt<_Tp[]> { };
+struct __skip_amt<_Tp[]> {};
template <typename _Tp, int n>
-struct __skip_amt<_Tp[n]> { };
+struct __skip_amt<_Tp[n]> {};
template <typename _Tp, typename _Td>
-_LIBCPP_HIDE_FROM_ABI
-_Tp __cxx_atomic_fetch_add(volatile __cxx_atomic_base_impl<_Tp>* __a,
- _Td __delta, memory_order __order) {
+_LIBCPP_HIDE_FROM_ABI _Tp
+__cxx_atomic_fetch_add(volatile __cxx_atomic_base_impl<_Tp>* __a, _Td __delta, memory_order __order) {
return __atomic_fetch_add(std::addressof(__a->__a_value), __delta * __skip_amt<_Tp>::value, __to_gcc_order(__order));
}
template <typename _Tp, typename _Td>
-_LIBCPP_HIDE_FROM_ABI
-_Tp __cxx_atomic_fetch_add(__cxx_atomic_base_impl<_Tp>* __a, _Td __delta,
- memory_order __order) {
+_LIBCPP_HIDE_FROM_ABI _Tp __cxx_atomic_fetch_add(__cxx_atomic_base_impl<_Tp>* __a, _Td __delta, memory_order __order) {
return __atomic_fetch_add(std::addressof(__a->__a_value), __delta * __skip_amt<_Tp>::value, __to_gcc_order(__order));
}
template <typename _Tp, typename _Td>
-_LIBCPP_HIDE_FROM_ABI
-_Tp __cxx_atomic_fetch_sub(volatile __cxx_atomic_base_impl<_Tp>* __a,
- _Td __delta, memory_order __order) {
+_LIBCPP_HIDE_FROM_ABI _Tp
+__cxx_atomic_fetch_sub(volatile __cxx_atomic_base_impl<_Tp>* __a, _Td __delta, memory_order __order) {
return __atomic_fetch_sub(std::addressof(__a->__a_value), __delta * __skip_amt<_Tp>::value, __to_gcc_order(__order));
}
template <typename _Tp, typename _Td>
-_LIBCPP_HIDE_FROM_ABI
-_Tp __cxx_atomic_fetch_sub(__cxx_atomic_base_impl<_Tp>* __a, _Td __delta,
- memory_order __order) {
+_LIBCPP_HIDE_FROM_ABI _Tp __cxx_atomic_fetch_sub(__cxx_atomic_base_impl<_Tp>* __a, _Td __delta, memory_order __order) {
return __atomic_fetch_sub(std::addressof(__a->__a_value), __delta * __skip_amt<_Tp>::value, __to_gcc_order(__order));
}
template <typename _Tp>
-_LIBCPP_HIDE_FROM_ABI
-_Tp __cxx_atomic_fetch_and(volatile __cxx_atomic_base_impl<_Tp>* __a,
- _Tp __pattern, memory_order __order) {
+_LIBCPP_HIDE_FROM_ABI _Tp
+__cxx_atomic_fetch_and(volatile __cxx_atomic_base_impl<_Tp>* __a, _Tp __pattern, memory_order __order) {
return __atomic_fetch_and(std::addressof(__a->__a_value), __pattern, __to_gcc_order(__order));
}
template <typename _Tp>
-_LIBCPP_HIDE_FROM_ABI
-_Tp __cxx_atomic_fetch_and(__cxx_atomic_base_impl<_Tp>* __a,
- _Tp __pattern, memory_order __order) {
+_LIBCPP_HIDE_FROM_ABI _Tp
+__cxx_atomic_fetch_and(__cxx_atomic_base_impl<_Tp>* __a, _Tp __pattern, memory_order __order) {
return __atomic_fetch_and(std::addressof(__a->__a_value), __pattern, __to_gcc_order(__order));
}
template <typename _Tp>
-_LIBCPP_HIDE_FROM_ABI
-_Tp __cxx_atomic_fetch_or(volatile __cxx_atomic_base_impl<_Tp>* __a,
- _Tp __pattern, memory_order __order) {
+_LIBCPP_HIDE_FROM_ABI _Tp
+__cxx_atomic_fetch_or(volatile __cxx_atomic_base_impl<_Tp>* __a, _Tp __pattern, memory_order __order) {
return __atomic_fetch_or(std::addressof(__a->__a_value), __pattern, __to_gcc_order(__order));
}
template <typename _Tp>
-_LIBCPP_HIDE_FROM_ABI
-_Tp __cxx_atomic_fetch_or(__cxx_atomic_base_impl<_Tp>* __a, _Tp __pattern,
- memory_order __order) {
+_LIBCPP_HIDE_FROM_ABI _Tp __cxx_atomic_fetch_or(__cxx_atomic_base_impl<_Tp>* __a, _Tp __pattern, memory_order __order) {
return __atomic_fetch_or(std::addressof(__a->__a_value), __pattern, __to_gcc_order(__order));
}
template <typename _Tp>
-_LIBCPP_HIDE_FROM_ABI
-_Tp __cxx_atomic_fetch_xor(volatile __cxx_atomic_base_impl<_Tp>* __a,
- _Tp __pattern, memory_order __order) {
+_LIBCPP_HIDE_FROM_ABI _Tp
+__cxx_atomic_fetch_xor(volatile __cxx_atomic_base_impl<_Tp>* __a, _Tp __pattern, memory_order __order) {
return __atomic_fetch_xor(std::addressof(__a->__a_value), __pattern, __to_gcc_order(__order));
}
template <typename _Tp>
-_LIBCPP_HIDE_FROM_ABI
-_Tp __cxx_atomic_fetch_xor(__cxx_atomic_base_impl<_Tp>* __a, _Tp __pattern,
- memory_order __order) {
+_LIBCPP_HIDE_FROM_ABI _Tp
+__cxx_atomic_fetch_xor(__cxx_atomic_base_impl<_Tp>* __a, _Tp __pattern, memory_order __order) {
return __atomic_fetch_xor(std::addressof(__a->__a_value), __pattern, __to_gcc_order(__order));
}
-#define __cxx_atomic_is_lock_free(__s) __atomic_is_lock_free(__s, 0)
+# define __cxx_atomic_is_lock_free(__s) __atomic_is_lock_free(__s, 0)
#elif defined(_LIBCPP_HAS_C_ATOMIC_IMP)
template <typename _Tp>
struct __cxx_atomic_base_impl {
-
_LIBCPP_HIDE_FROM_ABI
-#ifndef _LIBCPP_CXX03_LANG
- __cxx_atomic_base_impl() _NOEXCEPT = default;
-#else
- __cxx_atomic_base_impl() _NOEXCEPT : __a_value() {}
-#endif // _LIBCPP_CXX03_LANG
- _LIBCPP_CONSTEXPR explicit __cxx_atomic_base_impl(_Tp __value) _NOEXCEPT
- : __a_value(__value) {}
+# ifndef _LIBCPP_CXX03_LANG
+ __cxx_atomic_base_impl() _NOEXCEPT = default;
+# else
+ __cxx_atomic_base_impl() _NOEXCEPT : __a_value() {
+ }
+# endif // _LIBCPP_CXX03_LANG
+ _LIBCPP_CONSTEXPR explicit __cxx_atomic_base_impl(_Tp __value) _NOEXCEPT : __a_value(__value) {}
_LIBCPP_DISABLE_EXTENSION_WARNING _Atomic(_Tp) __a_value;
};
-#define __cxx_atomic_is_lock_free(__s) __c11_atomic_is_lock_free(__s)
+# define __cxx_atomic_is_lock_free(__s) __c11_atomic_is_lock_free(__s)
-_LIBCPP_HIDE_FROM_ABI inline
-void __cxx_atomic_thread_fence(memory_order __order) _NOEXCEPT {
- __c11_atomic_thread_fence(static_cast<__memory_order_underlying_t>(__order));
+_LIBCPP_HIDE_FROM_ABI inline void __cxx_atomic_thread_fence(memory_order __order) _NOEXCEPT {
+ __c11_atomic_thread_fence(static_cast<__memory_order_underlying_t>(__order));
}
-_LIBCPP_HIDE_FROM_ABI inline
-void __cxx_atomic_signal_fence(memory_order __order) _NOEXCEPT {
- __c11_atomic_signal_fence(static_cast<__memory_order_underlying_t>(__order));
+_LIBCPP_HIDE_FROM_ABI inline void __cxx_atomic_signal_fence(memory_order __order) _NOEXCEPT {
+ __c11_atomic_signal_fence(static_cast<__memory_order_underlying_t>(__order));
}
-template<class _Tp>
-_LIBCPP_HIDE_FROM_ABI
-void __cxx_atomic_init(__cxx_atomic_base_impl<_Tp> volatile* __a, _Tp __val) _NOEXCEPT {
- __c11_atomic_init(std::addressof(__a->__a_value), __val);
+template <class _Tp>
+_LIBCPP_HIDE_FROM_ABI void __cxx_atomic_init(__cxx_atomic_base_impl<_Tp> volatile* __a, _Tp __val) _NOEXCEPT {
+ __c11_atomic_init(std::addressof(__a->__a_value), __val);
}
-template<class _Tp>
-_LIBCPP_HIDE_FROM_ABI
-void __cxx_atomic_init(__cxx_atomic_base_impl<_Tp> * __a, _Tp __val) _NOEXCEPT {
- __c11_atomic_init(std::addressof(__a->__a_value), __val);
+template <class _Tp>
+_LIBCPP_HIDE_FROM_ABI void __cxx_atomic_init(__cxx_atomic_base_impl<_Tp>* __a, _Tp __val) _NOEXCEPT {
+ __c11_atomic_init(std::addressof(__a->__a_value), __val);
}
-template<class _Tp>
-_LIBCPP_HIDE_FROM_ABI
-void __cxx_atomic_store(__cxx_atomic_base_impl<_Tp> volatile* __a, _Tp __val, memory_order __order) _NOEXCEPT {
- __c11_atomic_store(std::addressof(__a->__a_value), __val, static_cast<__memory_order_underlying_t>(__order));
+template <class _Tp>
+_LIBCPP_HIDE_FROM_ABI void
+__cxx_atomic_store(__cxx_atomic_base_impl<_Tp> volatile* __a, _Tp __val, memory_order __order) _NOEXCEPT {
+ __c11_atomic_store(std::addressof(__a->__a_value), __val, static_cast<__memory_order_underlying_t>(__order));
}
-template<class _Tp>
-_LIBCPP_HIDE_FROM_ABI
-void __cxx_atomic_store(__cxx_atomic_base_impl<_Tp> * __a, _Tp __val, memory_order __order) _NOEXCEPT {
- __c11_atomic_store(std::addressof(__a->__a_value), __val, static_cast<__memory_order_underlying_t>(__order));
+template <class _Tp>
+_LIBCPP_HIDE_FROM_ABI void
+__cxx_atomic_store(__cxx_atomic_base_impl<_Tp>* __a, _Tp __val, memory_order __order) _NOEXCEPT {
+ __c11_atomic_store(std::addressof(__a->__a_value), __val, static_cast<__memory_order_underlying_t>(__order));
}
-template<class _Tp>
-_LIBCPP_HIDE_FROM_ABI
-_Tp __cxx_atomic_load(__cxx_atomic_base_impl<_Tp> const volatile* __a, memory_order __order) _NOEXCEPT {
- using __ptr_type = __remove_const_t<decltype(__a->__a_value)>*;
- return __c11_atomic_load(
- const_cast<__ptr_type>(std::addressof(__a->__a_value)), static_cast<__memory_order_underlying_t>(__order));
+template <class _Tp>
+_LIBCPP_HIDE_FROM_ABI _Tp
+__cxx_atomic_load(__cxx_atomic_base_impl<_Tp> const volatile* __a, memory_order __order) _NOEXCEPT {
+ using __ptr_type = __remove_const_t<decltype(__a->__a_value)>*;
+ return __c11_atomic_load(
+ const_cast<__ptr_type>(std::addressof(__a->__a_value)), static_cast<__memory_order_underlying_t>(__order));
}
-template<class _Tp>
-_LIBCPP_HIDE_FROM_ABI
-_Tp __cxx_atomic_load(__cxx_atomic_base_impl<_Tp> const* __a, memory_order __order) _NOEXCEPT {
- using __ptr_type = __remove_const_t<decltype(__a->__a_value)>*;
- return __c11_atomic_load(
- const_cast<__ptr_type>(std::addressof(__a->__a_value)), static_cast<__memory_order_underlying_t>(__order));
+template <class _Tp>
+_LIBCPP_HIDE_FROM_ABI _Tp __cxx_atomic_load(__cxx_atomic_base_impl<_Tp> const* __a, memory_order __order) _NOEXCEPT {
+ using __ptr_type = __remove_const_t<decltype(__a->__a_value)>*;
+ return __c11_atomic_load(
+ const_cast<__ptr_type>(std::addressof(__a->__a_value)), static_cast<__memory_order_underlying_t>(__order));
}
template <class _Tp>
_LIBCPP_HIDE_FROM_ABI void
__cxx_atomic_load_inplace(__cxx_atomic_base_impl<_Tp> const volatile* __a, _Tp* __dst, memory_order __order) _NOEXCEPT {
- using __ptr_type = __remove_const_t<decltype(__a->__a_value)>*;
- *__dst = __c11_atomic_load(
- const_cast<__ptr_type>(std::addressof(__a->__a_value)), static_cast<__memory_order_underlying_t>(__order));
+ using __ptr_type = __remove_const_t<decltype(__a->__a_value)>*;
+ *__dst = __c11_atomic_load(
+ const_cast<__ptr_type>(std::addressof(__a->__a_value)), static_cast<__memory_order_underlying_t>(__order));
}
template <class _Tp>
_LIBCPP_HIDE_FROM_ABI void
__cxx_atomic_load_inplace(__cxx_atomic_base_impl<_Tp> const* __a, _Tp* __dst, memory_order __order) _NOEXCEPT {
- using __ptr_type = __remove_const_t<decltype(__a->__a_value)>*;
- *__dst = __c11_atomic_load(
- const_cast<__ptr_type>(std::addressof(__a->__a_value)), static_cast<__memory_order_underlying_t>(__order));
+ using __ptr_type = __remove_const_t<decltype(__a->__a_value)>*;
+ *__dst = __c11_atomic_load(
+ const_cast<__ptr_type>(std::addressof(__a->__a_value)), static_cast<__memory_order_underlying_t>(__order));
}
-template<class _Tp>
-_LIBCPP_HIDE_FROM_ABI
-_Tp __cxx_atomic_exchange(__cxx_atomic_base_impl<_Tp> volatile* __a, _Tp __value, memory_order __order) _NOEXCEPT {
- return __c11_atomic_exchange(
- std::addressof(__a->__a_value), __value, static_cast<__memory_order_underlying_t>(__order));
+template <class _Tp>
+_LIBCPP_HIDE_FROM_ABI _Tp
+__cxx_atomic_exchange(__cxx_atomic_base_impl<_Tp> volatile* __a, _Tp __value, memory_order __order) _NOEXCEPT {
+ return __c11_atomic_exchange(
+ std::addressof(__a->__a_value), __value, static_cast<__memory_order_underlying_t>(__order));
}
-template<class _Tp>
-_LIBCPP_HIDE_FROM_ABI
-_Tp __cxx_atomic_exchange(__cxx_atomic_base_impl<_Tp> * __a, _Tp __value, memory_order __order) _NOEXCEPT {
- return __c11_atomic_exchange(
- std::addressof(__a->__a_value), __value, static_cast<__memory_order_underlying_t>(__order));
+template <class _Tp>
+_LIBCPP_HIDE_FROM_ABI _Tp
+__cxx_atomic_exchange(__cxx_atomic_base_impl<_Tp>* __a, _Tp __value, memory_order __order) _NOEXCEPT {
+ return __c11_atomic_exchange(
+ std::addressof(__a->__a_value), __value, static_cast<__memory_order_underlying_t>(__order));
}
_LIBCPP_HIDE_FROM_ABI inline _LIBCPP_CONSTEXPR memory_order __to_failure_order(memory_order __order) {
// Avoid switch statement to make this a constexpr.
- return __order == memory_order_release ? memory_order_relaxed:
- (__order == memory_order_acq_rel ? memory_order_acquire:
- __order);
+ return __order == memory_order_release
+ ? memory_order_relaxed
+ : (__order == memory_order_acq_rel ? memory_order_acquire : __order);
}
-template<class _Tp>
-_LIBCPP_HIDE_FROM_ABI
-bool __cxx_atomic_compare_exchange_strong(__cxx_atomic_base_impl<_Tp> volatile* __a, _Tp* __expected, _Tp __value, memory_order __success, memory_order __failure) _NOEXCEPT {
+template <class _Tp>
+_LIBCPP_HIDE_FROM_ABI bool __cxx_atomic_compare_exchange_strong(
+ __cxx_atomic_base_impl<_Tp> volatile* __a,
+ _Tp* __expected,
+ _Tp __value,
+ memory_order __success,
+ memory_order __failure) _NOEXCEPT {
return __c11_atomic_compare_exchange_strong(
std::addressof(__a->__a_value),
__expected,
@@ -419,9 +399,10 @@ bool __cxx_atomic_compare_exchange_strong(__cxx_atomic_base_impl<_Tp> volatile*
static_cast<__memory_order_underlying_t>(__success),
static_cast<__memory_order_underlying_t>(__to_failure_order(__failure)));
}
-template<class _Tp>
-_LIBCPP_HIDE_FROM_ABI
-bool __cxx_atomic_compare_exchange_strong(__cxx_atomic_base_impl<_Tp> * __a, _Tp* __expected, _Tp __value, memory_order __success, memory_order __failure) _NOEXCEPT {
+template <class _Tp>
+_LIBCPP_HIDE_FROM_ABI bool __cxx_atomic_compare_exchange_strong(
+ __cxx_atomic_base_impl<_Tp>* __a, _Tp* __expected, _Tp __value, memory_order __success, memory_order __failure)
+ _NOEXCEPT {
return __c11_atomic_compare_exchange_strong(
std::addressof(__a->__a_value),
__expected,
@@ -430,9 +411,13 @@ bool __cxx_atomic_compare_exchange_strong(__cxx_atomic_base_impl<_Tp> * __a, _Tp
static_cast<__memory_order_underlying_t>(__to_failure_order(__failure)));
}
-template<class _Tp>
-_LIBCPP_HIDE_FROM_ABI
-bool __cxx_atomic_compare_exchange_weak(__cxx_atomic_base_impl<_Tp> volatile* __a, _Tp* __expected, _Tp __value, memory_order __success, memory_order __failure) _NOEXCEPT {
+template <class _Tp>
+_LIBCPP_HIDE_FROM_ABI bool __cxx_atomic_compare_exchange_weak(
+ __cxx_atomic_base_impl<_Tp> volatile* __a,
+ _Tp* __expected,
+ _Tp __value,
+ memory_order __success,
+ memory_order __failure) _NOEXCEPT {
return __c11_atomic_compare_exchange_weak(
std::addressof(__a->__a_value),
__expected,
@@ -440,9 +425,10 @@ bool __cxx_atomic_compare_exchange_weak(__cxx_atomic_base_impl<_Tp> volatile* __
static_cast<__memory_order_underlying_t>(__success),
static_cast<__memory_order_underlying_t>(__to_failure_order(__failure)));
}
-template<class _Tp>
-_LIBCPP_HIDE_FROM_ABI
-bool __cxx_atomic_compare_exchange_weak(__cxx_atomic_base_impl<_Tp> * __a, _Tp* __expected, _Tp __value, memory_order __success, memory_order __failure) _NOEXCEPT {
+template <class _Tp>
+_LIBCPP_HIDE_FROM_ABI bool __cxx_atomic_compare_exchange_weak(
+ __cxx_atomic_base_impl<_Tp>* __a, _Tp* __expected, _Tp __value, memory_order __success, memory_order __failure)
+ _NOEXCEPT {
return __c11_atomic_compare_exchange_weak(
std::addressof(__a->__a_value),
__expected,
@@ -451,92 +437,92 @@ bool __cxx_atomic_compare_exchange_weak(__cxx_atomic_base_impl<_Tp> * __a, _Tp*
static_cast<__memory_order_underlying_t>(__to_failure_order(__failure)));
}
-template<class _Tp>
-_LIBCPP_HIDE_FROM_ABI
-_Tp __cxx_atomic_fetch_add(__cxx_atomic_base_impl<_Tp> volatile* __a, _Tp __delta, memory_order __order) _NOEXCEPT {
+template <class _Tp>
+_LIBCPP_HIDE_FROM_ABI _Tp
+__cxx_atomic_fetch_add(__cxx_atomic_base_impl<_Tp> volatile* __a, _Tp __delta, memory_order __order) _NOEXCEPT {
return __c11_atomic_fetch_add(
std::addressof(__a->__a_value), __delta, static_cast<__memory_order_underlying_t>(__order));
}
-template<class _Tp>
-_LIBCPP_HIDE_FROM_ABI
-_Tp __cxx_atomic_fetch_add(__cxx_atomic_base_impl<_Tp> * __a, _Tp __delta, memory_order __order) _NOEXCEPT {
+template <class _Tp>
+_LIBCPP_HIDE_FROM_ABI _Tp
+__cxx_atomic_fetch_add(__cxx_atomic_base_impl<_Tp>* __a, _Tp __delta, memory_order __order) _NOEXCEPT {
return __c11_atomic_fetch_add(
std::addressof(__a->__a_value), __delta, static_cast<__memory_order_underlying_t>(__order));
}
-template<class _Tp>
-_LIBCPP_HIDE_FROM_ABI
-_Tp* __cxx_atomic_fetch_add(__cxx_atomic_base_impl<_Tp*> volatile* __a, ptrdiff_t __delta, memory_order __order) _NOEXCEPT {
+template <class _Tp>
+_LIBCPP_HIDE_FROM_ABI _Tp*
+__cxx_atomic_fetch_add(__cxx_atomic_base_impl<_Tp*> volatile* __a, ptrdiff_t __delta, memory_order __order) _NOEXCEPT {
return __c11_atomic_fetch_add(
std::addressof(__a->__a_value), __delta, static_cast<__memory_order_underlying_t>(__order));
}
-template<class _Tp>
-_LIBCPP_HIDE_FROM_ABI
-_Tp* __cxx_atomic_fetch_add(__cxx_atomic_base_impl<_Tp*> * __a, ptrdiff_t __delta, memory_order __order) _NOEXCEPT {
+template <class _Tp>
+_LIBCPP_HIDE_FROM_ABI _Tp*
+__cxx_atomic_fetch_add(__cxx_atomic_base_impl<_Tp*>* __a, ptrdiff_t __delta, memory_order __order) _NOEXCEPT {
return __c11_atomic_fetch_add(
std::addressof(__a->__a_value), __delta, static_cast<__memory_order_underlying_t>(__order));
}
-template<class _Tp>
-_LIBCPP_HIDE_FROM_ABI
-_Tp __cxx_atomic_fetch_sub(__cxx_atomic_base_impl<_Tp> volatile* __a, _Tp __delta, memory_order __order) _NOEXCEPT {
+template <class _Tp>
+_LIBCPP_HIDE_FROM_ABI _Tp
+__cxx_atomic_fetch_sub(__cxx_atomic_base_impl<_Tp> volatile* __a, _Tp __delta, memory_order __order) _NOEXCEPT {
return __c11_atomic_fetch_sub(
std::addressof(__a->__a_value), __delta, static_cast<__memory_order_underlying_t>(__order));
}
-template<class _Tp>
-_LIBCPP_HIDE_FROM_ABI
-_Tp __cxx_atomic_fetch_sub(__cxx_atomic_base_impl<_Tp> * __a, _Tp __delta, memory_order __order) _NOEXCEPT {
+template <class _Tp>
+_LIBCPP_HIDE_FROM_ABI _Tp
+__cxx_atomic_fetch_sub(__cxx_atomic_base_impl<_Tp>* __a, _Tp __delta, memory_order __order) _NOEXCEPT {
return __c11_atomic_fetch_sub(
std::addressof(__a->__a_value), __delta, static_cast<__memory_order_underlying_t>(__order));
}
-template<class _Tp>
-_LIBCPP_HIDE_FROM_ABI
-_Tp* __cxx_atomic_fetch_sub(__cxx_atomic_base_impl<_Tp*> volatile* __a, ptrdiff_t __delta, memory_order __order) _NOEXCEPT {
+template <class _Tp>
+_LIBCPP_HIDE_FROM_ABI _Tp*
+__cxx_atomic_fetch_sub(__cxx_atomic_base_impl<_Tp*> volatile* __a, ptrdiff_t __delta, memory_order __order) _NOEXCEPT {
return __c11_atomic_fetch_sub(
std::addressof(__a->__a_value), __delta, static_cast<__memory_order_underlying_t>(__order));
}
-template<class _Tp>
-_LIBCPP_HIDE_FROM_ABI
-_Tp* __cxx_atomic_fetch_sub(__cxx_atomic_base_impl<_Tp*> * __a, ptrdiff_t __delta, memory_order __order) _NOEXCEPT {
+template <class _Tp>
+_LIBCPP_HIDE_FROM_ABI _Tp*
+__cxx_atomic_fetch_sub(__cxx_atomic_base_impl<_Tp*>* __a, ptrdiff_t __delta, memory_order __order) _NOEXCEPT {
return __c11_atomic_fetch_sub(
std::addressof(__a->__a_value), __delta, static_cast<__memory_order_underlying_t>(__order));
}
-template<class _Tp>
-_LIBCPP_HIDE_FROM_ABI
-_Tp __cxx_atomic_fetch_and(__cxx_atomic_base_impl<_Tp> volatile* __a, _Tp __pattern, memory_order __order) _NOEXCEPT {
+template <class _Tp>
+_LIBCPP_HIDE_FROM_ABI _Tp
+__cxx_atomic_fetch_and(__cxx_atomic_base_impl<_Tp> volatile* __a, _Tp __pattern, memory_order __order) _NOEXCEPT {
return __c11_atomic_fetch_and(
std::addressof(__a->__a_value), __pattern, static_cast<__memory_order_underlying_t>(__order));
}
-template<class _Tp>
-_LIBCPP_HIDE_FROM_ABI
-_Tp __cxx_atomic_fetch_and(__cxx_atomic_base_impl<_Tp> * __a, _Tp __pattern, memory_order __order) _NOEXCEPT {
+template <class _Tp>
+_LIBCPP_HIDE_FROM_ABI _Tp
+__cxx_atomic_fetch_and(__cxx_atomic_base_impl<_Tp>* __a, _Tp __pattern, memory_order __order) _NOEXCEPT {
return __c11_atomic_fetch_and(
std::addressof(__a->__a_value), __pattern, static_cast<__memory_order_underlying_t>(__order));
}
-template<class _Tp>
-_LIBCPP_HIDE_FROM_ABI
-_Tp __cxx_atomic_fetch_or(__cxx_atomic_base_impl<_Tp> volatile* __a, _Tp __pattern, memory_order __order) _NOEXCEPT {
+template <class _Tp>
+_LIBCPP_HIDE_FROM_ABI _Tp
+__cxx_atomic_fetch_or(__cxx_atomic_base_impl<_Tp> volatile* __a, _Tp __pattern, memory_order __order) _NOEXCEPT {
return __c11_atomic_fetch_or(
std::addressof(__a->__a_value), __pattern, static_cast<__memory_order_underlying_t>(__order));
}
-template<class _Tp>
-_LIBCPP_HIDE_FROM_ABI
-_Tp __cxx_atomic_fetch_or(__cxx_atomic_base_impl<_Tp> * __a, _Tp __pattern, memory_order __order) _NOEXCEPT {
+template <class _Tp>
+_LIBCPP_HIDE_FROM_ABI _Tp
+__cxx_atomic_fetch_or(__cxx_atomic_base_impl<_Tp>* __a, _Tp __pattern, memory_order __order) _NOEXCEPT {
return __c11_atomic_fetch_or(
std::addressof(__a->__a_value), __pattern, static_cast<__memory_order_underlying_t>(__order));
}
-template<class _Tp>
-_LIBCPP_HIDE_FROM_ABI
-_Tp __cxx_atomic_fetch_xor(__cxx_atomic_base_impl<_Tp> volatile* __a, _Tp __pattern, memory_order __order) _NOEXCEPT {
+template <class _Tp>
+_LIBCPP_HIDE_FROM_ABI _Tp
+__cxx_atomic_fetch_xor(__cxx_atomic_base_impl<_Tp> volatile* __a, _Tp __pattern, memory_order __order) _NOEXCEPT {
return __c11_atomic_fetch_xor(
std::addressof(__a->__a_value), __pattern, static_cast<__memory_order_underlying_t>(__order));
}
-template<class _Tp>
-_LIBCPP_HIDE_FROM_ABI
-_Tp __cxx_atomic_fetch_xor(__cxx_atomic_base_impl<_Tp> * __a, _Tp __pattern, memory_order __order) _NOEXCEPT {
+template <class _Tp>
+_LIBCPP_HIDE_FROM_ABI _Tp
+__cxx_atomic_fetch_xor(__cxx_atomic_base_impl<_Tp>* __a, _Tp __pattern, memory_order __order) _NOEXCEPT {
return __c11_atomic_fetch_xor(
std::addressof(__a->__a_value), __pattern, static_cast<__memory_order_underlying_t>(__order));
}
@@ -545,26 +531,23 @@ _Tp __cxx_atomic_fetch_xor(__cxx_atomic_base_impl<_Tp> * __a, _Tp __pattern, mem
#ifdef _LIBCPP_ATOMIC_ONLY_USE_BUILTINS
-template<typename _Tp>
+template <typename _Tp>
struct __cxx_atomic_lock_impl {
-
- _LIBCPP_HIDE_FROM_ABI
- __cxx_atomic_lock_impl() _NOEXCEPT
- : __a_value(), __a_lock(0) {}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR explicit
- __cxx_atomic_lock_impl(_Tp value) _NOEXCEPT
- : __a_value(value), __a_lock(0) {}
+ _LIBCPP_HIDE_FROM_ABI __cxx_atomic_lock_impl() _NOEXCEPT : __a_value(), __a_lock(0) {}
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR explicit __cxx_atomic_lock_impl(_Tp value) _NOEXCEPT
+ : __a_value(value),
+ __a_lock(0) {}
_Tp __a_value;
mutable __cxx_atomic_base_impl<_LIBCPP_ATOMIC_FLAG_TYPE> __a_lock;
_LIBCPP_HIDE_FROM_ABI void __lock() const volatile {
- while(1 == __cxx_atomic_exchange(&__a_lock, _LIBCPP_ATOMIC_FLAG_TYPE(true), memory_order_acquire))
- /*spin*/;
+ while (1 == __cxx_atomic_exchange(&__a_lock, _LIBCPP_ATOMIC_FLAG_TYPE(true), memory_order_acquire))
+ /*spin*/;
}
_LIBCPP_HIDE_FROM_ABI void __lock() const {
- while(1 == __cxx_atomic_exchange(&__a_lock, _LIBCPP_ATOMIC_FLAG_TYPE(true), memory_order_acquire))
- /*spin*/;
+ while (1 == __cxx_atomic_exchange(&__a_lock, _LIBCPP_ATOMIC_FLAG_TYPE(true), memory_order_acquire))
+ /*spin*/;
}
_LIBCPP_HIDE_FROM_ABI void __unlock() const volatile {
__cxx_atomic_store(&__a_lock, _LIBCPP_ATOMIC_FLAG_TYPE(false), memory_order_release);
@@ -598,39 +581,33 @@ struct __cxx_atomic_lock_impl {
};
template <typename _Tp>
-_LIBCPP_HIDE_FROM_ABI
-void __cxx_atomic_init(volatile __cxx_atomic_lock_impl<_Tp>* __a, _Tp __val) {
+_LIBCPP_HIDE_FROM_ABI void __cxx_atomic_init(volatile __cxx_atomic_lock_impl<_Tp>* __a, _Tp __val) {
__cxx_atomic_assign_volatile(__a->__a_value, __val);
}
template <typename _Tp>
-_LIBCPP_HIDE_FROM_ABI
-void __cxx_atomic_init(__cxx_atomic_lock_impl<_Tp>* __a, _Tp __val) {
+_LIBCPP_HIDE_FROM_ABI void __cxx_atomic_init(__cxx_atomic_lock_impl<_Tp>* __a, _Tp __val) {
__a->__a_value = __val;
}
template <typename _Tp>
-_LIBCPP_HIDE_FROM_ABI
-void __cxx_atomic_store(volatile __cxx_atomic_lock_impl<_Tp>* __a, _Tp __val, memory_order) {
+_LIBCPP_HIDE_FROM_ABI void __cxx_atomic_store(volatile __cxx_atomic_lock_impl<_Tp>* __a, _Tp __val, memory_order) {
__a->__lock();
__cxx_atomic_assign_volatile(__a->__a_value, __val);
__a->__unlock();
}
template <typename _Tp>
-_LIBCPP_HIDE_FROM_ABI
-void __cxx_atomic_store(__cxx_atomic_lock_impl<_Tp>* __a, _Tp __val, memory_order) {
+_LIBCPP_HIDE_FROM_ABI void __cxx_atomic_store(__cxx_atomic_lock_impl<_Tp>* __a, _Tp __val, memory_order) {
__a->__lock();
__a->__a_value = __val;
__a->__unlock();
}
template <typename _Tp>
-_LIBCPP_HIDE_FROM_ABI
-_Tp __cxx_atomic_load(const volatile __cxx_atomic_lock_impl<_Tp>* __a, memory_order) {
+_LIBCPP_HIDE_FROM_ABI _Tp __cxx_atomic_load(const volatile __cxx_atomic_lock_impl<_Tp>* __a, memory_order) {
return __a->__read();
}
template <typename _Tp>
-_LIBCPP_HIDE_FROM_ABI
-_Tp __cxx_atomic_load(const __cxx_atomic_lock_impl<_Tp>* __a, memory_order) {
+_LIBCPP_HIDE_FROM_ABI _Tp __cxx_atomic_load(const __cxx_atomic_lock_impl<_Tp>* __a, memory_order) {
return __a->__read();
}
@@ -645,8 +622,7 @@ _LIBCPP_HIDE_FROM_ABI void __cxx_atomic_load(const __cxx_atomic_lock_impl<_Tp>*
}
template <typename _Tp>
-_LIBCPP_HIDE_FROM_ABI
-_Tp __cxx_atomic_exchange(volatile __cxx_atomic_lock_impl<_Tp>* __a, _Tp __value, memory_order) {
+_LIBCPP_HIDE_FROM_ABI _Tp __cxx_atomic_exchange(volatile __cxx_atomic_lock_impl<_Tp>* __a, _Tp __value, memory_order) {
__a->__lock();
_Tp __old;
__cxx_atomic_assign_volatile(__old, __a->__a_value);
@@ -655,24 +631,22 @@ _Tp __cxx_atomic_exchange(volatile __cxx_atomic_lock_impl<_Tp>* __a, _Tp __value
return __old;
}
template <typename _Tp>
-_LIBCPP_HIDE_FROM_ABI
-_Tp __cxx_atomic_exchange(__cxx_atomic_lock_impl<_Tp>* __a, _Tp __value, memory_order) {
+_LIBCPP_HIDE_FROM_ABI _Tp __cxx_atomic_exchange(__cxx_atomic_lock_impl<_Tp>* __a, _Tp __value, memory_order) {
__a->__lock();
- _Tp __old = __a->__a_value;
+ _Tp __old = __a->__a_value;
__a->__a_value = __value;
__a->__unlock();
return __old;
}
template <typename _Tp>
-_LIBCPP_HIDE_FROM_ABI
-bool __cxx_atomic_compare_exchange_strong(volatile __cxx_atomic_lock_impl<_Tp>* __a,
- _Tp* __expected, _Tp __value, memory_order, memory_order) {
+_LIBCPP_HIDE_FROM_ABI bool __cxx_atomic_compare_exchange_strong(
+ volatile __cxx_atomic_lock_impl<_Tp>* __a, _Tp* __expected, _Tp __value, memory_order, memory_order) {
_Tp __temp;
__a->__lock();
__cxx_atomic_assign_volatile(__temp, __a->__a_value);
bool __ret = (std::memcmp(&__temp, __expected, sizeof(_Tp)) == 0);
- if(__ret)
+ if (__ret)
__cxx_atomic_assign_volatile(__a->__a_value, __value);
else
__cxx_atomic_assign_volatile(*__expected, __a->__a_value);
@@ -680,12 +654,11 @@ bool __cxx_atomic_compare_exchange_strong(volatile __cxx_atomic_lock_impl<_Tp>*
return __ret;
}
template <typename _Tp>
-_LIBCPP_HIDE_FROM_ABI
-bool __cxx_atomic_compare_exchange_strong(__cxx_atomic_lock_impl<_Tp>* __a,
- _Tp* __expected, _Tp __value, memory_order, memory_order) {
+_LIBCPP_HIDE_FROM_ABI bool __cxx_atomic_compare_exchange_strong(
+ __cxx_atomic_lock_impl<_Tp>* __a, _Tp* __expected, _Tp __value, memory_order, memory_order) {
__a->__lock();
bool __ret = (std::memcmp(&__a->__a_value, __expected, sizeof(_Tp)) == 0);
- if(__ret)
+ if (__ret)
std::memcpy(&__a->__a_value, &__value, sizeof(_Tp));
else
std::memcpy(__expected, &__a->__a_value, sizeof(_Tp));
@@ -694,14 +667,13 @@ bool __cxx_atomic_compare_exchange_strong(__cxx_atomic_lock_impl<_Tp>* __a,
}
template <typename _Tp>
-_LIBCPP_HIDE_FROM_ABI
-bool __cxx_atomic_compare_exchange_weak(volatile __cxx_atomic_lock_impl<_Tp>* __a,
- _Tp* __expected, _Tp __value, memory_order, memory_order) {
+_LIBCPP_HIDE_FROM_ABI bool __cxx_atomic_compare_exchange_weak(
+ volatile __cxx_atomic_lock_impl<_Tp>* __a, _Tp* __expected, _Tp __value, memory_order, memory_order) {
_Tp __temp;
__a->__lock();
__cxx_atomic_assign_volatile(__temp, __a->__a_value);
bool __ret = (std::memcmp(&__temp, __expected, sizeof(_Tp)) == 0);
- if(__ret)
+ if (__ret)
__cxx_atomic_assign_volatile(__a->__a_value, __value);
else
__cxx_atomic_assign_volatile(*__expected, __a->__a_value);
@@ -709,12 +681,11 @@ bool __cxx_atomic_compare_exchange_weak(volatile __cxx_atomic_lock_impl<_Tp>* __
return __ret;
}
template <typename _Tp>
-_LIBCPP_HIDE_FROM_ABI
-bool __cxx_atomic_compare_exchange_weak(__cxx_atomic_lock_impl<_Tp>* __a,
- _Tp* __expected, _Tp __value, memory_order, memory_order) {
+_LIBCPP_HIDE_FROM_ABI bool __cxx_atomic_compare_exchange_weak(
+ __cxx_atomic_lock_impl<_Tp>* __a, _Tp* __expected, _Tp __value, memory_order, memory_order) {
__a->__lock();
bool __ret = (std::memcmp(&__a->__a_value, __expected, sizeof(_Tp)) == 0);
- if(__ret)
+ if (__ret)
std::memcpy(&__a->__a_value, &__value, sizeof(_Tp));
else
std::memcpy(__expected, &__a->__a_value, sizeof(_Tp));
@@ -723,9 +694,7 @@ bool __cxx_atomic_compare_exchange_weak(__cxx_atomic_lock_impl<_Tp>* __a,
}
template <typename _Tp, typename _Td>
-_LIBCPP_HIDE_FROM_ABI
-_Tp __cxx_atomic_fetch_add(volatile __cxx_atomic_lock_impl<_Tp>* __a,
- _Td __delta, memory_order) {
+_LIBCPP_HIDE_FROM_ABI _Tp __cxx_atomic_fetch_add(volatile __cxx_atomic_lock_impl<_Tp>* __a, _Td __delta, memory_order) {
__a->__lock();
_Tp __old;
__cxx_atomic_assign_volatile(__old, __a->__a_value);
@@ -734,9 +703,7 @@ _Tp __cxx_atomic_fetch_add(volatile __cxx_atomic_lock_impl<_Tp>* __a,
return __old;
}
template <typename _Tp, typename _Td>
-_LIBCPP_HIDE_FROM_ABI
-_Tp __cxx_atomic_fetch_add(__cxx_atomic_lock_impl<_Tp>* __a,
- _Td __delta, memory_order) {
+_LIBCPP_HIDE_FROM_ABI _Tp __cxx_atomic_fetch_add(__cxx_atomic_lock_impl<_Tp>* __a, _Td __delta, memory_order) {
__a->__lock();
_Tp __old = __a->__a_value;
__a->__a_value += __delta;
@@ -745,9 +712,8 @@ _Tp __cxx_atomic_fetch_add(__cxx_atomic_lock_impl<_Tp>* __a,
}
template <typename _Tp, typename _Td>
-_LIBCPP_HIDE_FROM_ABI
-_Tp* __cxx_atomic_fetch_add(volatile __cxx_atomic_lock_impl<_Tp*>* __a,
- ptrdiff_t __delta, memory_order) {
+_LIBCPP_HIDE_FROM_ABI _Tp*
+__cxx_atomic_fetch_add(volatile __cxx_atomic_lock_impl<_Tp*>* __a, ptrdiff_t __delta, memory_order) {
__a->__lock();
_Tp* __old;
__cxx_atomic_assign_volatile(__old, __a->__a_value);
@@ -756,9 +722,7 @@ _Tp* __cxx_atomic_fetch_add(volatile __cxx_atomic_lock_impl<_Tp*>* __a,
return __old;
}
template <typename _Tp, typename _Td>
-_LIBCPP_HIDE_FROM_ABI
-_Tp* __cxx_atomic_fetch_add(__cxx_atomic_lock_impl<_Tp*>* __a,
- ptrdiff_t __delta, memory_order) {
+_LIBCPP_HIDE_FROM_ABI _Tp* __cxx_atomic_fetch_add(__cxx_atomic_lock_impl<_Tp*>* __a, ptrdiff_t __delta, memory_order) {
__a->__lock();
_Tp* __old = __a->__a_value;
__a->__a_value += __delta;
@@ -767,9 +731,7 @@ _Tp* __cxx_atomic_fetch_add(__cxx_atomic_lock_impl<_Tp*>* __a,
}
template <typename _Tp, typename _Td>
-_LIBCPP_HIDE_FROM_ABI
-_Tp __cxx_atomic_fetch_sub(volatile __cxx_atomic_lock_impl<_Tp>* __a,
- _Td __delta, memory_order) {
+_LIBCPP_HIDE_FROM_ABI _Tp __cxx_atomic_fetch_sub(volatile __cxx_atomic_lock_impl<_Tp>* __a, _Td __delta, memory_order) {
__a->__lock();
_Tp __old;
__cxx_atomic_assign_volatile(__old, __a->__a_value);
@@ -778,9 +740,7 @@ _Tp __cxx_atomic_fetch_sub(volatile __cxx_atomic_lock_impl<_Tp>* __a,
return __old;
}
template <typename _Tp, typename _Td>
-_LIBCPP_HIDE_FROM_ABI
-_Tp __cxx_atomic_fetch_sub(__cxx_atomic_lock_impl<_Tp>* __a,
- _Td __delta, memory_order) {
+_LIBCPP_HIDE_FROM_ABI _Tp __cxx_atomic_fetch_sub(__cxx_atomic_lock_impl<_Tp>* __a, _Td __delta, memory_order) {
__a->__lock();
_Tp __old = __a->__a_value;
__a->__a_value -= __delta;
@@ -789,9 +749,8 @@ _Tp __cxx_atomic_fetch_sub(__cxx_atomic_lock_impl<_Tp>* __a,
}
template <typename _Tp>
-_LIBCPP_HIDE_FROM_ABI
-_Tp __cxx_atomic_fetch_and(volatile __cxx_atomic_lock_impl<_Tp>* __a,
- _Tp __pattern, memory_order) {
+_LIBCPP_HIDE_FROM_ABI _Tp
+__cxx_atomic_fetch_and(volatile __cxx_atomic_lock_impl<_Tp>* __a, _Tp __pattern, memory_order) {
__a->__lock();
_Tp __old;
__cxx_atomic_assign_volatile(__old, __a->__a_value);
@@ -800,9 +759,7 @@ _Tp __cxx_atomic_fetch_and(volatile __cxx_atomic_lock_impl<_Tp>* __a,
return __old;
}
template <typename _Tp>
-_LIBCPP_HIDE_FROM_ABI
-_Tp __cxx_atomic_fetch_and(__cxx_atomic_lock_impl<_Tp>* __a,
- _Tp __pattern, memory_order) {
+_LIBCPP_HIDE_FROM_ABI _Tp __cxx_atomic_fetch_and(__cxx_atomic_lock_impl<_Tp>* __a, _Tp __pattern, memory_order) {
__a->__lock();
_Tp __old = __a->__a_value;
__a->__a_value &= __pattern;
@@ -811,9 +768,8 @@ _Tp __cxx_atomic_fetch_and(__cxx_atomic_lock_impl<_Tp>* __a,
}
template <typename _Tp>
-_LIBCPP_HIDE_FROM_ABI
-_Tp __cxx_atomic_fetch_or(volatile __cxx_atomic_lock_impl<_Tp>* __a,
- _Tp __pattern, memory_order) {
+_LIBCPP_HIDE_FROM_ABI _Tp
+__cxx_atomic_fetch_or(volatile __cxx_atomic_lock_impl<_Tp>* __a, _Tp __pattern, memory_order) {
__a->__lock();
_Tp __old;
__cxx_atomic_assign_volatile(__old, __a->__a_value);
@@ -822,9 +778,7 @@ _Tp __cxx_atomic_fetch_or(volatile __cxx_atomic_lock_impl<_Tp>* __a,
return __old;
}
template <typename _Tp>
-_LIBCPP_HIDE_FROM_ABI
-_Tp __cxx_atomic_fetch_or(__cxx_atomic_lock_impl<_Tp>* __a,
- _Tp __pattern, memory_order) {
+_LIBCPP_HIDE_FROM_ABI _Tp __cxx_atomic_fetch_or(__cxx_atomic_lock_impl<_Tp>* __a, _Tp __pattern, memory_order) {
__a->__lock();
_Tp __old = __a->__a_value;
__a->__a_value |= __pattern;
@@ -833,9 +787,8 @@ _Tp __cxx_atomic_fetch_or(__cxx_atomic_lock_impl<_Tp>* __a,
}
template <typename _Tp>
-_LIBCPP_HIDE_FROM_ABI
-_Tp __cxx_atomic_fetch_xor(volatile __cxx_atomic_lock_impl<_Tp>* __a,
- _Tp __pattern, memory_order) {
+_LIBCPP_HIDE_FROM_ABI _Tp
+__cxx_atomic_fetch_xor(volatile __cxx_atomic_lock_impl<_Tp>* __a, _Tp __pattern, memory_order) {
__a->__lock();
_Tp __old;
__cxx_atomic_assign_volatile(__old, __a->__a_value);
@@ -844,9 +797,7 @@ _Tp __cxx_atomic_fetch_xor(volatile __cxx_atomic_lock_impl<_Tp>* __a,
return __old;
}
template <typename _Tp>
-_LIBCPP_HIDE_FROM_ABI
-_Tp __cxx_atomic_fetch_xor(__cxx_atomic_lock_impl<_Tp>* __a,
- _Tp __pattern, memory_order) {
+_LIBCPP_HIDE_FROM_ABI _Tp __cxx_atomic_fetch_xor(__cxx_atomic_lock_impl<_Tp>* __a, _Tp __pattern, memory_order) {
__a->__lock();
_Tp __old = __a->__a_value;
__a->__a_value ^= __pattern;
@@ -859,16 +810,13 @@ template <typename _Tp,
__cxx_atomic_base_impl<_Tp>,
__cxx_atomic_lock_impl<_Tp> >::type>
#else
-template <typename _Tp,
- typename _Base = __cxx_atomic_base_impl<_Tp> >
+template <typename _Tp, typename _Base = __cxx_atomic_base_impl<_Tp> >
#endif //_LIBCPP_ATOMIC_ONLY_USE_BUILTINS
struct __cxx_atomic_impl : public _Base {
- static_assert(is_trivially_copyable<_Tp>::value,
- "std::atomic<T> requires that 'T' be a trivially copyable type");
+ static_assert(is_trivially_copyable<_Tp>::value, "std::atomic<T> requires that 'T' be a trivially copyable type");
_LIBCPP_HIDE_FROM_ABI __cxx_atomic_impl() _NOEXCEPT = default;
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR explicit __cxx_atomic_impl(_Tp __value) _NOEXCEPT
- : _Base(__value) {}
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR explicit __cxx_atomic_impl(_Tp __value) _NOEXCEPT : _Base(__value) {}
};
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__atomic/fence.h b/contrib/llvm-project/libcxx/include/__atomic/fence.h
index c62f38f21157..8c27ea54d62d 100644
--- a/contrib/llvm-project/libcxx/include/__atomic/fence.h
+++ b/contrib/llvm-project/libcxx/include/__atomic/fence.h
@@ -19,19 +19,9 @@
_LIBCPP_BEGIN_NAMESPACE_STD
-inline _LIBCPP_HIDE_FROM_ABI
-void
-atomic_thread_fence(memory_order __m) _NOEXCEPT
-{
- __cxx_atomic_thread_fence(__m);
-}
-
-inline _LIBCPP_HIDE_FROM_ABI
-void
-atomic_signal_fence(memory_order __m) _NOEXCEPT
-{
- __cxx_atomic_signal_fence(__m);
-}
+inline _LIBCPP_HIDE_FROM_ABI void atomic_thread_fence(memory_order __m) _NOEXCEPT { __cxx_atomic_thread_fence(__m); }
+
+inline _LIBCPP_HIDE_FROM_ABI void atomic_signal_fence(memory_order __m) _NOEXCEPT { __cxx_atomic_signal_fence(__m); }
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__atomic/kill_dependency.h b/contrib/llvm-project/libcxx/include/__atomic/kill_dependency.h
index 1bd5c8ca765a..103d52d35787 100644
--- a/contrib/llvm-project/libcxx/include/__atomic/kill_dependency.h
+++ b/contrib/llvm-project/libcxx/include/__atomic/kill_dependency.h
@@ -18,10 +18,8 @@
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _Tp>
-_LIBCPP_HIDE_FROM_ABI
-_Tp kill_dependency(_Tp __y) _NOEXCEPT
-{
- return __y;
+_LIBCPP_HIDE_FROM_ABI _Tp kill_dependency(_Tp __y) _NOEXCEPT {
+ return __y;
}
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__atomic/memory_order.h b/contrib/llvm-project/libcxx/include/__atomic/memory_order.h
index 3671dc3cf9be..16fd1867698f 100644
--- a/contrib/llvm-project/libcxx/include/__atomic/memory_order.h
+++ b/contrib/llvm-project/libcxx/include/__atomic/memory_order.h
@@ -22,14 +22,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
// Figure out what the underlying type for `memory_order` would be if it were
// declared as an unscoped enum (accounting for -fshort-enums). Use this result
// to pin the underlying type in C++20.
-enum __legacy_memory_order {
- __mo_relaxed,
- __mo_consume,
- __mo_acquire,
- __mo_release,
- __mo_acq_rel,
- __mo_seq_cst
-};
+enum __legacy_memory_order { __mo_relaxed, __mo_consume, __mo_acquire, __mo_release, __mo_acq_rel, __mo_seq_cst };
using __memory_order_underlying_t = underlying_type<__legacy_memory_order>::type;
@@ -45,7 +38,7 @@ enum class memory_order : __memory_order_underlying_t {
};
static_assert((is_same<underlying_type<memory_order>::type, __memory_order_underlying_t>::value),
- "unexpected underlying type for std::memory_order");
+ "unexpected underlying type for std::memory_order");
inline constexpr auto memory_order_relaxed = memory_order::relaxed;
inline constexpr auto memory_order_consume = memory_order::consume;
diff --git a/contrib/llvm-project/libcxx/include/__availability b/contrib/llvm-project/libcxx/include/__availability
index b5230b3f56b8..5df2783dd0c7 100644
--- a/contrib/llvm-project/libcxx/include/__availability
+++ b/contrib/llvm-project/libcxx/include/__availability
@@ -64,25 +64,22 @@
//
// [1]: https://clang.llvm.org/docs/AttributeReference.html#availability
-
// For backwards compatibility, allow users to define _LIBCPP_DISABLE_AVAILABILITY
// for a while.
#if defined(_LIBCPP_DISABLE_AVAILABILITY)
-# if !defined(_LIBCPP_HAS_NO_VENDOR_AVAILABILITY_ANNOTATIONS)
-# define _LIBCPP_HAS_NO_VENDOR_AVAILABILITY_ANNOTATIONS
-# endif
+# if !defined(_LIBCPP_HAS_NO_VENDOR_AVAILABILITY_ANNOTATIONS)
+# define _LIBCPP_HAS_NO_VENDOR_AVAILABILITY_ANNOTATIONS
+# endif
#endif
// Availability markup is disabled when building the library, or when the compiler
// doesn't support the proper attributes.
-#if defined(_LIBCPP_BUILDING_LIBRARY) || \
- defined(_LIBCXXABI_BUILDING_LIBRARY) || \
- !__has_feature(attribute_availability_with_strict) || \
- !__has_feature(attribute_availability_in_templates) || \
+#if defined(_LIBCPP_BUILDING_LIBRARY) || defined(_LIBCXXABI_BUILDING_LIBRARY) || \
+ !__has_feature(attribute_availability_with_strict) || !__has_feature(attribute_availability_in_templates) || \
!__has_extension(pragma_clang_attribute_external_declaration)
-# if !defined(_LIBCPP_HAS_NO_VENDOR_AVAILABILITY_ANNOTATIONS)
-# define _LIBCPP_HAS_NO_VENDOR_AVAILABILITY_ANNOTATIONS
-# endif
+# if !defined(_LIBCPP_HAS_NO_VENDOR_AVAILABILITY_ANNOTATIONS)
+# define _LIBCPP_HAS_NO_VENDOR_AVAILABILITY_ANNOTATIONS
+# endif
#endif
#if defined(_LIBCPP_HAS_NO_VENDOR_AVAILABILITY_ANNOTATIONS)
@@ -139,6 +136,12 @@
# define _LIBCPP_AVAILABILITY_HAS_TZDB 1
# define _LIBCPP_AVAILABILITY_TZDB
+ // This controls the availability of C++23 <print>, which
+ // has a dependency on the built library (it needs access to
+ // the underlying buffer types of std::cout, std::cerr, and std::clog.
+# define _LIBCPP_AVAILABILITY_HAS_PRINT 1
+# define _LIBCPP_AVAILABILITY_PRINT
+
// Enable additional explicit instantiations of iostreams components. This
// reduces the number of weak definitions generated in programs that use
// iostreams by providing a single strong definition in the shared library.
@@ -160,7 +163,7 @@
# define _LIBCPP_AVAILABILITY_HAS_BAD_VARIANT_ACCESS _LIBCPP_AVAILABILITY_HAS_BAD_OPTIONAL_ACCESS
# define _LIBCPP_AVAILABILITY_HAS_BAD_ANY_CAST _LIBCPP_AVAILABILITY_HAS_BAD_OPTIONAL_ACCESS
-# define _LIBCPP_AVAILABILITY_BAD_OPTIONAL_ACCESS __attribute__((availability(watchos,strict,introduced=5.0)))
+# define _LIBCPP_AVAILABILITY_BAD_OPTIONAL_ACCESS __attribute__((availability(watchos, strict, introduced = 5.0)))
# define _LIBCPP_AVAILABILITY_BAD_VARIANT_ACCESS _LIBCPP_AVAILABILITY_BAD_OPTIONAL_ACCESS
# define _LIBCPP_AVAILABILITY_BAD_ANY_CAST _LIBCPP_AVAILABILITY_BAD_OPTIONAL_ACCESS
@@ -175,11 +178,11 @@
# else
# define _LIBCPP_AVAILABILITY_HAS_FILESYSTEM_LIBRARY 1
# endif
-# define _LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY \
- __attribute__((availability(macos,strict,introduced=10.15))) \
- __attribute__((availability(ios,strict,introduced=13.0))) \
- __attribute__((availability(tvos,strict,introduced=13.0))) \
- __attribute__((availability(watchos,strict,introduced=6.0)))
+# define _LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY \
+ __attribute__((availability(macos, strict, introduced = 10.15))) \
+ __attribute__((availability(ios, strict, introduced = 13.0))) \
+ __attribute__((availability(tvos, strict, introduced = 13.0))) \
+ __attribute__((availability(watchos, strict, introduced = 6.0)))
// clang-format off
# define _LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY_PUSH \
_Pragma("clang attribute push(__attribute__((availability(macos,strict,introduced=10.15))), apply_to=any(function,record))") \
@@ -204,13 +207,13 @@
# else
# define _LIBCPP_AVAILABILITY_HAS_TO_CHARS_FLOATING_POINT 1
# endif
-# define _LIBCPP_AVAILABILITY_TO_CHARS_FLOATING_POINT \
- __attribute__((availability(macos,strict,introduced=13.3))) \
- __attribute__((availability(ios,strict,introduced=16.3))) \
- __attribute__((availability(tvos,strict,introduced=16.3))) \
- __attribute__((availability(watchos,strict,introduced=9.3)))
+# define _LIBCPP_AVAILABILITY_TO_CHARS_FLOATING_POINT \
+ __attribute__((availability(macos, strict, introduced = 13.3))) \
+ __attribute__((availability(ios, strict, introduced = 16.3))) \
+ __attribute__((availability(tvos, strict, introduced = 16.3))) \
+ __attribute__((availability(watchos, strict, introduced = 9.3)))
- // c++20 synchronization library
+// c++20 synchronization library
// clang-format off
# if (defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 110000) || \
(defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ < 140000) || \
@@ -220,19 +223,18 @@
# define _LIBCPP_AVAILABILITY_HAS_SYNC 0
# else
# define _LIBCPP_AVAILABILITY_HAS_SYNC 1
-# endif
-# define _LIBCPP_AVAILABILITY_SYNC \
- __attribute__((availability(macos,strict,introduced=11.0))) \
- __attribute__((availability(ios,strict,introduced=14.0))) \
- __attribute__((availability(tvos,strict,introduced=14.0))) \
- __attribute__((availability(watchos,strict,introduced=7.0)))
+# endif
+# define _LIBCPP_AVAILABILITY_SYNC \
+ __attribute__((availability(macos, strict, introduced = 11.0))) \
+ __attribute__((availability(ios, strict, introduced = 14.0))) \
+ __attribute__((availability(tvos, strict, introduced = 14.0))) \
+ __attribute__((availability(watchos, strict, introduced = 7.0)))
// __libcpp_verbose_abort
// TODO: Update once this is released
# define _LIBCPP_AVAILABILITY_HAS_VERBOSE_ABORT 0
-# define _LIBCPP_AVAILABILITY_VERBOSE_ABORT \
- __attribute__((unavailable))
+# define _LIBCPP_AVAILABILITY_VERBOSE_ABORT __attribute__((unavailable))
// std::pmr
// clang-format off
@@ -262,6 +264,9 @@
# define _LIBCPP_AVAILABILITY_HAS_TZDB 0
# define _LIBCPP_AVAILABILITY_TZDB __attribute__((unavailable))
+# define _LIBCPP_AVAILABILITY_HAS_PRINT 0
+# define _LIBCPP_AVAILABILITY_PRINT __attribute__((unavailable))
+
// clang-format off
# if (defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 120000) || \
(defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ < 150000) || \
@@ -276,7 +281,8 @@
// ...New vendors can add availability markup here...
-# error "It looks like you're trying to enable vendor availability markup, but you haven't defined the corresponding macros yet!"
+# error \
+ "It looks like you're trying to enable vendor availability markup, but you haven't defined the corresponding macros yet!"
#endif
@@ -284,13 +290,13 @@
// Those are defined in terms of the availability attributes above, and
// should not be vendor-specific.
#if defined(_LIBCPP_HAS_NO_EXCEPTIONS)
-# define _LIBCPP_AVAILABILITY_THROW_BAD_ANY_CAST
-# define _LIBCPP_AVAILABILITY_THROW_BAD_OPTIONAL_ACCESS
-# define _LIBCPP_AVAILABILITY_THROW_BAD_VARIANT_ACCESS
+# define _LIBCPP_AVAILABILITY_THROW_BAD_ANY_CAST
+# define _LIBCPP_AVAILABILITY_THROW_BAD_OPTIONAL_ACCESS
+# define _LIBCPP_AVAILABILITY_THROW_BAD_VARIANT_ACCESS
#else
-# define _LIBCPP_AVAILABILITY_THROW_BAD_ANY_CAST _LIBCPP_AVAILABILITY_BAD_ANY_CAST
-# define _LIBCPP_AVAILABILITY_THROW_BAD_OPTIONAL_ACCESS _LIBCPP_AVAILABILITY_BAD_OPTIONAL_ACCESS
-# define _LIBCPP_AVAILABILITY_THROW_BAD_VARIANT_ACCESS _LIBCPP_AVAILABILITY_BAD_VARIANT_ACCESS
+# define _LIBCPP_AVAILABILITY_THROW_BAD_ANY_CAST _LIBCPP_AVAILABILITY_BAD_ANY_CAST
+# define _LIBCPP_AVAILABILITY_THROW_BAD_OPTIONAL_ACCESS _LIBCPP_AVAILABILITY_BAD_OPTIONAL_ACCESS
+# define _LIBCPP_AVAILABILITY_THROW_BAD_VARIANT_ACCESS _LIBCPP_AVAILABILITY_BAD_VARIANT_ACCESS
#endif
#endif // _LIBCPP___AVAILABILITY
diff --git a/contrib/llvm-project/libcxx/include/__bit/bit_cast.h b/contrib/llvm-project/libcxx/include/__bit/bit_cast.h
index 39842465e12a..f20b39ae748b 100644
--- a/contrib/llvm-project/libcxx/include/__bit/bit_cast.h
+++ b/contrib/llvm-project/libcxx/include/__bit/bit_cast.h
@@ -22,8 +22,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
#if _LIBCPP_STD_VER >= 20
template <class _ToType, class _FromType>
- requires(sizeof(_ToType) == sizeof(_FromType) &&
- is_trivially_copyable_v<_ToType> &&
+ requires(sizeof(_ToType) == sizeof(_FromType) && is_trivially_copyable_v<_ToType> &&
is_trivially_copyable_v<_FromType>)
_LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr _ToType bit_cast(const _FromType& __from) noexcept {
return __builtin_bit_cast(_ToType, __from);
diff --git a/contrib/llvm-project/libcxx/include/__bit/bit_ceil.h b/contrib/llvm-project/libcxx/include/__bit/bit_ceil.h
index 9eae5c391a83..17fe06aa41cc 100644
--- a/contrib/llvm-project/libcxx/include/__bit/bit_ceil.h
+++ b/contrib/llvm-project/libcxx/include/__bit/bit_ceil.h
@@ -33,7 +33,7 @@ _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr _Tp __bit_ceil(_Tp __t) no
if constexpr (sizeof(_Tp) >= sizeof(unsigned))
return _Tp{1} << __n;
else {
- const unsigned __extra = numeric_limits<unsigned>::digits - numeric_limits<_Tp>::digits;
+ const unsigned __extra = numeric_limits<unsigned>::digits - numeric_limits<_Tp>::digits;
const unsigned __ret_val = 1u << (__n + __extra);
return (_Tp)(__ret_val >> __extra);
}
diff --git a/contrib/llvm-project/libcxx/include/__bit/byteswap.h b/contrib/llvm-project/libcxx/include/__bit/byteswap.h
index a1e1b530975e..20045d6fd43c 100644
--- a/contrib/llvm-project/libcxx/include/__bit/byteswap.h
+++ b/contrib/llvm-project/libcxx/include/__bit/byteswap.h
@@ -24,7 +24,6 @@ _LIBCPP_BEGIN_NAMESPACE_STD
template <integral _Tp>
_LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr _Tp byteswap(_Tp __val) noexcept {
-
if constexpr (sizeof(_Tp) == 1) {
return __val;
} else if constexpr (sizeof(_Tp) == 2) {
@@ -33,15 +32,15 @@ _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr _Tp byteswap(_Tp __val) no
return __builtin_bswap32(__val);
} else if constexpr (sizeof(_Tp) == 8) {
return __builtin_bswap64(__val);
-#ifndef _LIBCPP_HAS_NO_INT128
+# ifndef _LIBCPP_HAS_NO_INT128
} else if constexpr (sizeof(_Tp) == 16) {
-#if __has_builtin(__builtin_bswap128)
+# if __has_builtin(__builtin_bswap128)
return __builtin_bswap128(__val);
-#else
+# else
return static_cast<_Tp>(byteswap(static_cast<uint64_t>(__val))) << 64 |
static_cast<_Tp>(byteswap(static_cast<uint64_t>(__val >> 64)));
-#endif // __has_builtin(__builtin_bswap128)
-#endif // _LIBCPP_HAS_NO_INT128
+# endif // __has_builtin(__builtin_bswap128)
+# endif // _LIBCPP_HAS_NO_INT128
} else {
static_assert(sizeof(_Tp) == 0, "byteswap is unimplemented for integral types of this size");
}
diff --git a/contrib/llvm-project/libcxx/include/__bit/countl.h b/contrib/llvm-project/libcxx/include/__bit/countl.h
index efc9e200b13a..396cfc2c3f40 100644
--- a/contrib/llvm-project/libcxx/include/__bit/countl.h
+++ b/contrib/llvm-project/libcxx/include/__bit/countl.h
@@ -24,18 +24,20 @@ _LIBCPP_PUSH_MACROS
_LIBCPP_BEGIN_NAMESPACE_STD
-_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR
-int __libcpp_clz(unsigned __x) _NOEXCEPT { return __builtin_clz(__x); }
+_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR int __libcpp_clz(unsigned __x) _NOEXCEPT {
+ return __builtin_clz(__x);
+}
-_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR
-int __libcpp_clz(unsigned long __x) _NOEXCEPT { return __builtin_clzl(__x); }
+_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR int __libcpp_clz(unsigned long __x) _NOEXCEPT {
+ return __builtin_clzl(__x);
+}
-_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR
-int __libcpp_clz(unsigned long long __x) _NOEXCEPT { return __builtin_clzll(__x); }
+_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR int __libcpp_clz(unsigned long long __x) _NOEXCEPT {
+ return __builtin_clzll(__x);
+}
-# ifndef _LIBCPP_HAS_NO_INT128
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR
-int __libcpp_clz(__uint128_t __x) _NOEXCEPT {
+#ifndef _LIBCPP_HAS_NO_INT128
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR int __libcpp_clz(__uint128_t __x) _NOEXCEPT {
// The function is written in this form due to C++ constexpr limitations.
// The algorithm:
// - Test whether any bit in the high 64-bits is set
@@ -45,42 +47,38 @@ int __libcpp_clz(__uint128_t __x) _NOEXCEPT {
// - Any bits set:
// - The number of leading zeros of the input is the number of leading
// zeros in the high 64-bits.
- return ((__x >> 64) == 0)
- ? (64 + __builtin_clzll(static_cast<unsigned long long>(__x)))
- : __builtin_clzll(static_cast<unsigned long long>(__x >> 64));
+ return ((__x >> 64) == 0) ? (64 + __builtin_clzll(static_cast<unsigned long long>(__x)))
+ : __builtin_clzll(static_cast<unsigned long long>(__x >> 64));
}
-# endif // _LIBCPP_HAS_NO_INT128
-
-template<class _Tp>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
-int __countl_zero(_Tp __t) _NOEXCEPT
-{
- static_assert(__libcpp_is_unsigned_integer<_Tp>::value, "__countl_zero requires an unsigned integer type");
- if (__t == 0)
- return numeric_limits<_Tp>::digits;
-
- if (sizeof(_Tp) <= sizeof(unsigned int))
- return std::__libcpp_clz(static_cast<unsigned int>(__t))
- - (numeric_limits<unsigned int>::digits - numeric_limits<_Tp>::digits);
- else if (sizeof(_Tp) <= sizeof(unsigned long))
- return std::__libcpp_clz(static_cast<unsigned long>(__t))
- - (numeric_limits<unsigned long>::digits - numeric_limits<_Tp>::digits);
- else if (sizeof(_Tp) <= sizeof(unsigned long long))
- return std::__libcpp_clz(static_cast<unsigned long long>(__t))
- - (numeric_limits<unsigned long long>::digits - numeric_limits<_Tp>::digits);
- else
- {
- int __ret = 0;
- int __iter = 0;
- const unsigned int __ulldigits = numeric_limits<unsigned long long>::digits;
- while (true) {
- __t = std::__rotl(__t, __ulldigits);
- if ((__iter = std::__countl_zero(static_cast<unsigned long long>(__t))) != __ulldigits)
- break;
- __ret += __iter;
- }
- return __ret + __iter;
+#endif // _LIBCPP_HAS_NO_INT128
+
+template <class _Tp>
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 int __countl_zero(_Tp __t) _NOEXCEPT {
+ static_assert(__libcpp_is_unsigned_integer<_Tp>::value, "__countl_zero requires an unsigned integer type");
+ if (__t == 0)
+ return numeric_limits<_Tp>::digits;
+
+ if (sizeof(_Tp) <= sizeof(unsigned int))
+ return std::__libcpp_clz(static_cast<unsigned int>(__t)) -
+ (numeric_limits<unsigned int>::digits - numeric_limits<_Tp>::digits);
+ else if (sizeof(_Tp) <= sizeof(unsigned long))
+ return std::__libcpp_clz(static_cast<unsigned long>(__t)) -
+ (numeric_limits<unsigned long>::digits - numeric_limits<_Tp>::digits);
+ else if (sizeof(_Tp) <= sizeof(unsigned long long))
+ return std::__libcpp_clz(static_cast<unsigned long long>(__t)) -
+ (numeric_limits<unsigned long long>::digits - numeric_limits<_Tp>::digits);
+ else {
+ int __ret = 0;
+ int __iter = 0;
+ const unsigned int __ulldigits = numeric_limits<unsigned long long>::digits;
+ while (true) {
+ __t = std::__rotl(__t, __ulldigits);
+ if ((__iter = std::__countl_zero(static_cast<unsigned long long>(__t))) != __ulldigits)
+ break;
+ __ret += __iter;
}
+ return __ret + __iter;
+ }
}
#if _LIBCPP_STD_VER >= 20
diff --git a/contrib/llvm-project/libcxx/include/__bit/countr.h b/contrib/llvm-project/libcxx/include/__bit/countr.h
index 66ca5e7e66f2..0cc679f87a99 100644
--- a/contrib/llvm-project/libcxx/include/__bit/countr.h
+++ b/contrib/llvm-project/libcxx/include/__bit/countr.h
@@ -23,14 +23,17 @@ _LIBCPP_PUSH_MACROS
_LIBCPP_BEGIN_NAMESPACE_STD
-_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR
-int __libcpp_ctz(unsigned __x) _NOEXCEPT { return __builtin_ctz(__x); }
+_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR int __libcpp_ctz(unsigned __x) _NOEXCEPT {
+ return __builtin_ctz(__x);
+}
-_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR
-int __libcpp_ctz(unsigned long __x) _NOEXCEPT { return __builtin_ctzl(__x); }
+_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR int __libcpp_ctz(unsigned long __x) _NOEXCEPT {
+ return __builtin_ctzl(__x);
+}
-_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR
-int __libcpp_ctz(unsigned long long __x) _NOEXCEPT { return __builtin_ctzll(__x); }
+_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR int __libcpp_ctz(unsigned long long __x) _NOEXCEPT {
+ return __builtin_ctzll(__x);
+}
#if _LIBCPP_STD_VER >= 20
@@ -46,7 +49,7 @@ _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr int countr_zero(_Tp __t) n
else if (sizeof(_Tp) <= sizeof(unsigned long long))
return std::__libcpp_ctz(static_cast<unsigned long long>(__t));
else {
- int __ret = 0;
+ int __ret = 0;
const unsigned int __ulldigits = numeric_limits<unsigned long long>::digits;
while (static_cast<unsigned long long>(__t) == 0uLL) {
__ret += __ulldigits;
diff --git a/contrib/llvm-project/libcxx/include/__bit/endian.h b/contrib/llvm-project/libcxx/include/__bit/endian.h
index 52635f2d2495..2d31e5ddff4f 100644
--- a/contrib/llvm-project/libcxx/include/__bit/endian.h
+++ b/contrib/llvm-project/libcxx/include/__bit/endian.h
@@ -21,7 +21,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
enum class endian {
little = 0xDEAD,
- big = 0xFACE,
+ big = 0xFACE,
# if defined(_LIBCPP_LITTLE_ENDIAN)
native = little
# elif defined(_LIBCPP_BIG_ENDIAN)
diff --git a/contrib/llvm-project/libcxx/include/__bit/popcount.h b/contrib/llvm-project/libcxx/include/__bit/popcount.h
index f0bb87ea717e..b0319cef2518 100644
--- a/contrib/llvm-project/libcxx/include/__bit/popcount.h
+++ b/contrib/llvm-project/libcxx/include/__bit/popcount.h
@@ -23,14 +23,17 @@ _LIBCPP_PUSH_MACROS
_LIBCPP_BEGIN_NAMESPACE_STD
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR
-int __libcpp_popcount(unsigned __x) _NOEXCEPT { return __builtin_popcount(__x); }
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR int __libcpp_popcount(unsigned __x) _NOEXCEPT {
+ return __builtin_popcount(__x);
+}
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR
-int __libcpp_popcount(unsigned long __x) _NOEXCEPT { return __builtin_popcountl(__x); }
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR int __libcpp_popcount(unsigned long __x) _NOEXCEPT {
+ return __builtin_popcountl(__x);
+}
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR
-int __libcpp_popcount(unsigned long long __x) _NOEXCEPT { return __builtin_popcountll(__x); }
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR int __libcpp_popcount(unsigned long long __x) _NOEXCEPT {
+ return __builtin_popcountll(__x);
+}
#if _LIBCPP_STD_VER >= 20
diff --git a/contrib/llvm-project/libcxx/include/__chrono/calendar.h b/contrib/llvm-project/libcxx/include/__chrono/calendar.h
index 91aaf6325389..bb1c5e7ebc8d 100644
--- a/contrib/llvm-project/libcxx/include/__chrono/calendar.h
+++ b/contrib/llvm-project/libcxx/include/__chrono/calendar.h
@@ -22,19 +22,19 @@
_LIBCPP_BEGIN_NAMESPACE_STD
-namespace chrono
-{
+namespace chrono {
struct local_t {};
-template<class _Duration>
-using local_time = time_point<local_t, _Duration>;
+template <class _Duration>
+using local_time = time_point<local_t, _Duration>;
using local_seconds = local_time<seconds>;
using local_days = local_time<days>;
-struct last_spec { explicit last_spec() = default; };
+struct last_spec {
+ explicit last_spec() = default;
+};
inline constexpr last_spec last{};
-
} // namespace chrono
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__chrono/convert_to_timespec.h b/contrib/llvm-project/libcxx/include/__chrono/convert_to_timespec.h
index fab07f2567d4..11e0b826d05b 100644
--- a/contrib/llvm-project/libcxx/include/__chrono/convert_to_timespec.h
+++ b/contrib/llvm-project/libcxx/include/__chrono/convert_to_timespec.h
@@ -26,23 +26,18 @@ _LIBCPP_BEGIN_NAMESPACE_STD
// Convert a nanoseconds duration to the given TimeSpec type, which must have
// the same properties as std::timespec.
template <class _TimeSpec>
-_LIBCPP_HIDE_FROM_ABI inline
-_TimeSpec __convert_to_timespec(const chrono::nanoseconds& __ns)
-{
+_LIBCPP_HIDE_FROM_ABI inline _TimeSpec __convert_to_timespec(const chrono::nanoseconds& __ns) {
using namespace chrono;
seconds __s = duration_cast<seconds>(__ns);
_TimeSpec __ts;
typedef decltype(__ts.tv_sec) __ts_sec;
const __ts_sec __ts_sec_max = numeric_limits<__ts_sec>::max();
- if (__s.count() < __ts_sec_max)
- {
- __ts.tv_sec = static_cast<__ts_sec>(__s.count());
+ if (__s.count() < __ts_sec_max) {
+ __ts.tv_sec = static_cast<__ts_sec>(__s.count());
__ts.tv_nsec = static_cast<decltype(__ts.tv_nsec)>((__ns - __s).count());
- }
- else
- {
- __ts.tv_sec = __ts_sec_max;
+ } else {
+ __ts.tv_sec = __ts_sec_max;
__ts.tv_nsec = 999999999; // (10^9 - 1)
}
diff --git a/contrib/llvm-project/libcxx/include/__chrono/day.h b/contrib/llvm-project/libcxx/include/__chrono/day.h
index d908453d5b08..7342084b08c8 100644
--- a/contrib/llvm-project/libcxx/include/__chrono/day.h
+++ b/contrib/llvm-project/libcxx/include/__chrono/day.h
@@ -22,58 +22,73 @@
_LIBCPP_BEGIN_NAMESPACE_STD
-namespace chrono
-{
+namespace chrono {
class day {
private:
- unsigned char __d_;
+ unsigned char __d_;
+
public:
- day() = default;
- _LIBCPP_HIDE_FROM_ABI explicit inline constexpr day(unsigned __val) noexcept : __d_(static_cast<unsigned char>(__val)) {}
- _LIBCPP_HIDE_FROM_ABI inline constexpr day& operator++() noexcept { ++__d_; return *this; }
- _LIBCPP_HIDE_FROM_ABI inline constexpr day operator++(int) noexcept { day __tmp = *this; ++(*this); return __tmp; }
- _LIBCPP_HIDE_FROM_ABI inline constexpr day& operator--() noexcept { --__d_; return *this; }
- _LIBCPP_HIDE_FROM_ABI inline constexpr day operator--(int) noexcept { day __tmp = *this; --(*this); return __tmp; }
- _LIBCPP_HIDE_FROM_ABI constexpr day& operator+=(const days& __dd) noexcept;
- _LIBCPP_HIDE_FROM_ABI constexpr day& operator-=(const days& __dd) noexcept;
- _LIBCPP_HIDE_FROM_ABI explicit inline constexpr operator unsigned() const noexcept { return __d_; }
- _LIBCPP_HIDE_FROM_ABI inline constexpr bool ok() const noexcept { return __d_ >= 1 && __d_ <= 31; }
- };
-
-
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-bool operator==(const day& __lhs, const day& __rhs) noexcept
-{ return static_cast<unsigned>(__lhs) == static_cast<unsigned>(__rhs); }
+ day() = default;
+ _LIBCPP_HIDE_FROM_ABI explicit inline constexpr day(unsigned __val) noexcept
+ : __d_(static_cast<unsigned char>(__val)) {}
+ _LIBCPP_HIDE_FROM_ABI inline constexpr day& operator++() noexcept {
+ ++__d_;
+ return *this;
+ }
+ _LIBCPP_HIDE_FROM_ABI inline constexpr day operator++(int) noexcept {
+ day __tmp = *this;
+ ++(*this);
+ return __tmp;
+ }
+ _LIBCPP_HIDE_FROM_ABI inline constexpr day& operator--() noexcept {
+ --__d_;
+ return *this;
+ }
+ _LIBCPP_HIDE_FROM_ABI inline constexpr day operator--(int) noexcept {
+ day __tmp = *this;
+ --(*this);
+ return __tmp;
+ }
+ _LIBCPP_HIDE_FROM_ABI constexpr day& operator+=(const days& __dd) noexcept;
+ _LIBCPP_HIDE_FROM_ABI constexpr day& operator-=(const days& __dd) noexcept;
+ _LIBCPP_HIDE_FROM_ABI explicit inline constexpr operator unsigned() const noexcept { return __d_; }
+ _LIBCPP_HIDE_FROM_ABI inline constexpr bool ok() const noexcept { return __d_ >= 1 && __d_ <= 31; }
+};
+
+_LIBCPP_HIDE_FROM_ABI inline constexpr bool operator==(const day& __lhs, const day& __rhs) noexcept {
+ return static_cast<unsigned>(__lhs) == static_cast<unsigned>(__rhs);
+}
_LIBCPP_HIDE_FROM_ABI inline constexpr strong_ordering operator<=>(const day& __lhs, const day& __rhs) noexcept {
return static_cast<unsigned>(__lhs) <=> static_cast<unsigned>(__rhs);
}
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-day operator+ (const day& __lhs, const days& __rhs) noexcept
-{ return day(static_cast<unsigned>(__lhs) + __rhs.count()); }
+_LIBCPP_HIDE_FROM_ABI inline constexpr day operator+(const day& __lhs, const days& __rhs) noexcept {
+ return day(static_cast<unsigned>(__lhs) + __rhs.count());
+}
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-day operator+ (const days& __lhs, const day& __rhs) noexcept
-{ return __rhs + __lhs; }
+_LIBCPP_HIDE_FROM_ABI inline constexpr day operator+(const days& __lhs, const day& __rhs) noexcept {
+ return __rhs + __lhs;
+}
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-day operator- (const day& __lhs, const days& __rhs) noexcept
-{ return __lhs + -__rhs; }
+_LIBCPP_HIDE_FROM_ABI inline constexpr day operator-(const day& __lhs, const days& __rhs) noexcept {
+ return __lhs + -__rhs;
+}
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-days operator-(const day& __lhs, const day& __rhs) noexcept
-{ return days(static_cast<int>(static_cast<unsigned>(__lhs)) -
- static_cast<int>(static_cast<unsigned>(__rhs))); }
+_LIBCPP_HIDE_FROM_ABI inline constexpr days operator-(const day& __lhs, const day& __rhs) noexcept {
+ return days(static_cast<int>(static_cast<unsigned>(__lhs)) - static_cast<int>(static_cast<unsigned>(__rhs)));
+}
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-day& day::operator+=(const days& __dd) noexcept
-{ *this = *this + __dd; return *this; }
+_LIBCPP_HIDE_FROM_ABI inline constexpr day& day::operator+=(const days& __dd) noexcept {
+ *this = *this + __dd;
+ return *this;
+}
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-day& day::operator-=(const days& __dd) noexcept
-{ *this = *this - __dd; return *this; }
+_LIBCPP_HIDE_FROM_ABI inline constexpr day& day::operator-=(const days& __dd) noexcept {
+ *this = *this - __dd;
+ return *this;
+}
} // namespace chrono
diff --git a/contrib/llvm-project/libcxx/include/__chrono/duration.h b/contrib/llvm-project/libcxx/include/__chrono/duration.h
index a19d55fc6682..5693ee644091 100644
--- a/contrib/llvm-project/libcxx/include/__chrono/duration.h
+++ b/contrib/llvm-project/libcxx/include/__chrono/duration.h
@@ -29,100 +29,82 @@ _LIBCPP_PUSH_MACROS
_LIBCPP_BEGIN_NAMESPACE_STD
-namespace chrono
-{
+namespace chrono {
-template <class _Rep, class _Period = ratio<1> > class _LIBCPP_TEMPLATE_VIS duration;
+template <class _Rep, class _Period = ratio<1> >
+class _LIBCPP_TEMPLATE_VIS duration;
template <class _Tp>
struct __is_duration : false_type {};
template <class _Rep, class _Period>
-struct __is_duration<duration<_Rep, _Period> > : true_type {};
+struct __is_duration<duration<_Rep, _Period> > : true_type {};
template <class _Rep, class _Period>
-struct __is_duration<const duration<_Rep, _Period> > : true_type {};
+struct __is_duration<const duration<_Rep, _Period> > : true_type {};
template <class _Rep, class _Period>
-struct __is_duration<volatile duration<_Rep, _Period> > : true_type {};
+struct __is_duration<volatile duration<_Rep, _Period> > : true_type {};
template <class _Rep, class _Period>
-struct __is_duration<const volatile duration<_Rep, _Period> > : true_type {};
+struct __is_duration<const volatile duration<_Rep, _Period> > : true_type {};
} // namespace chrono
template <class _Rep1, class _Period1, class _Rep2, class _Period2>
-struct _LIBCPP_TEMPLATE_VIS common_type<chrono::duration<_Rep1, _Period1>,
- chrono::duration<_Rep2, _Period2> >
-{
- typedef chrono::duration<typename common_type<_Rep1, _Rep2>::type,
- typename __ratio_gcd<_Period1, _Period2>::type> type;
+struct _LIBCPP_TEMPLATE_VIS common_type<chrono::duration<_Rep1, _Period1>, chrono::duration<_Rep2, _Period2> > {
+ typedef chrono::duration<typename common_type<_Rep1, _Rep2>::type, typename __ratio_gcd<_Period1, _Period2>::type>
+ type;
};
namespace chrono {
// duration_cast
-template <class _FromDuration, class _ToDuration,
+template <class _FromDuration,
+ class _ToDuration,
class _Period = typename ratio_divide<typename _FromDuration::period, typename _ToDuration::period>::type,
- bool = _Period::num == 1,
- bool = _Period::den == 1>
+ bool = _Period::num == 1,
+ bool = _Period::den == 1>
struct __duration_cast;
template <class _FromDuration, class _ToDuration, class _Period>
-struct __duration_cast<_FromDuration, _ToDuration, _Period, true, true>
-{
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR
- _ToDuration operator()(const _FromDuration& __fd) const
- {
- return _ToDuration(static_cast<typename _ToDuration::rep>(__fd.count()));
- }
+struct __duration_cast<_FromDuration, _ToDuration, _Period, true, true> {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR _ToDuration operator()(const _FromDuration& __fd) const {
+ return _ToDuration(static_cast<typename _ToDuration::rep>(__fd.count()));
+ }
};
template <class _FromDuration, class _ToDuration, class _Period>
-struct __duration_cast<_FromDuration, _ToDuration, _Period, true, false>
-{
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR
- _ToDuration operator()(const _FromDuration& __fd) const
- {
- typedef typename common_type<typename _ToDuration::rep, typename _FromDuration::rep, intmax_t>::type _Ct;
- return _ToDuration(static_cast<typename _ToDuration::rep>(
- static_cast<_Ct>(__fd.count()) / static_cast<_Ct>(_Period::den)));
- }
+struct __duration_cast<_FromDuration, _ToDuration, _Period, true, false> {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR _ToDuration operator()(const _FromDuration& __fd) const {
+ typedef typename common_type<typename _ToDuration::rep, typename _FromDuration::rep, intmax_t>::type _Ct;
+ return _ToDuration(
+ static_cast<typename _ToDuration::rep>(static_cast<_Ct>(__fd.count()) / static_cast<_Ct>(_Period::den)));
+ }
};
template <class _FromDuration, class _ToDuration, class _Period>
-struct __duration_cast<_FromDuration, _ToDuration, _Period, false, true>
-{
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR
- _ToDuration operator()(const _FromDuration& __fd) const
- {
- typedef typename common_type<typename _ToDuration::rep, typename _FromDuration::rep, intmax_t>::type _Ct;
- return _ToDuration(static_cast<typename _ToDuration::rep>(
- static_cast<_Ct>(__fd.count()) * static_cast<_Ct>(_Period::num)));
- }
+struct __duration_cast<_FromDuration, _ToDuration, _Period, false, true> {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR _ToDuration operator()(const _FromDuration& __fd) const {
+ typedef typename common_type<typename _ToDuration::rep, typename _FromDuration::rep, intmax_t>::type _Ct;
+ return _ToDuration(
+ static_cast<typename _ToDuration::rep>(static_cast<_Ct>(__fd.count()) * static_cast<_Ct>(_Period::num)));
+ }
};
template <class _FromDuration, class _ToDuration, class _Period>
-struct __duration_cast<_FromDuration, _ToDuration, _Period, false, false>
-{
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR
- _ToDuration operator()(const _FromDuration& __fd) const
- {
- typedef typename common_type<typename _ToDuration::rep, typename _FromDuration::rep, intmax_t>::type _Ct;
- return _ToDuration(static_cast<typename _ToDuration::rep>(
- static_cast<_Ct>(__fd.count()) * static_cast<_Ct>(_Period::num)
- / static_cast<_Ct>(_Period::den)));
- }
+struct __duration_cast<_FromDuration, _ToDuration, _Period, false, false> {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR _ToDuration operator()(const _FromDuration& __fd) const {
+ typedef typename common_type<typename _ToDuration::rep, typename _FromDuration::rep, intmax_t>::type _Ct;
+ return _ToDuration(static_cast<typename _ToDuration::rep>(
+ static_cast<_Ct>(__fd.count()) * static_cast<_Ct>(_Period::num) / static_cast<_Ct>(_Period::den)));
+ }
};
template <class _ToDuration, class _Rep, class _Period, __enable_if_t<__is_duration<_ToDuration>::value, int> = 0>
-inline _LIBCPP_HIDE_FROM_ABI
-_LIBCPP_CONSTEXPR
-_ToDuration
-duration_cast(const duration<_Rep, _Period>& __fd)
-{
- return __duration_cast<duration<_Rep, _Period>, _ToDuration>()(__fd);
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR _ToDuration duration_cast(const duration<_Rep, _Period>& __fd) {
+ return __duration_cast<duration<_Rep, _Period>, _ToDuration>()(__fd);
}
template <class _Rep>
@@ -134,190 +116,204 @@ inline constexpr bool treat_as_floating_point_v = treat_as_floating_point<_Rep>:
#endif
template <class _Rep>
-struct _LIBCPP_TEMPLATE_VIS duration_values
-{
+struct _LIBCPP_TEMPLATE_VIS duration_values {
public:
- _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR _Rep zero() _NOEXCEPT {return _Rep(0);}
- _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR _Rep max() _NOEXCEPT {return numeric_limits<_Rep>::max();}
- _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR _Rep min() _NOEXCEPT {return numeric_limits<_Rep>::lowest();}
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR _Rep zero() _NOEXCEPT { return _Rep(0); }
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR _Rep max() _NOEXCEPT { return numeric_limits<_Rep>::max(); }
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR _Rep min() _NOEXCEPT { return numeric_limits<_Rep>::lowest(); }
};
#if _LIBCPP_STD_VER >= 17
template <class _ToDuration, class _Rep, class _Period, enable_if_t<__is_duration<_ToDuration>::value, int> = 0>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR
-_ToDuration
-floor(const duration<_Rep, _Period>& __d)
-{
- _ToDuration __t = chrono::duration_cast<_ToDuration>(__d);
- if (__t > __d)
- __t = __t - _ToDuration{1};
- return __t;
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR _ToDuration floor(const duration<_Rep, _Period>& __d) {
+ _ToDuration __t = chrono::duration_cast<_ToDuration>(__d);
+ if (__t > __d)
+ __t = __t - _ToDuration{1};
+ return __t;
}
template <class _ToDuration, class _Rep, class _Period, enable_if_t<__is_duration<_ToDuration>::value, int> = 0>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR
-_ToDuration
-ceil(const duration<_Rep, _Period>& __d)
-{
- _ToDuration __t = chrono::duration_cast<_ToDuration>(__d);
- if (__t < __d)
- __t = __t + _ToDuration{1};
- return __t;
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR _ToDuration ceil(const duration<_Rep, _Period>& __d) {
+ _ToDuration __t = chrono::duration_cast<_ToDuration>(__d);
+ if (__t < __d)
+ __t = __t + _ToDuration{1};
+ return __t;
}
template <class _ToDuration, class _Rep, class _Period, enable_if_t<__is_duration<_ToDuration>::value, int> = 0>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR
-_ToDuration
-round(const duration<_Rep, _Period>& __d)
-{
- _ToDuration __lower = chrono::floor<_ToDuration>(__d);
- _ToDuration __upper = __lower + _ToDuration{1};
- auto __lower_diff = __d - __lower;
- auto __upper_diff = __upper - __d;
- if (__lower_diff < __upper_diff)
- return __lower;
- if (__lower_diff > __upper_diff)
- return __upper;
- return __lower.count() & 1 ? __upper : __lower;
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR _ToDuration round(const duration<_Rep, _Period>& __d) {
+ _ToDuration __lower = chrono::floor<_ToDuration>(__d);
+ _ToDuration __upper = __lower + _ToDuration{1};
+ auto __lower_diff = __d - __lower;
+ auto __upper_diff = __upper - __d;
+ if (__lower_diff < __upper_diff)
+ return __lower;
+ if (__lower_diff > __upper_diff)
+ return __upper;
+ return __lower.count() & 1 ? __upper : __lower;
}
#endif
// duration
template <class _Rep, class _Period>
-class _LIBCPP_TEMPLATE_VIS duration
-{
- static_assert(!__is_duration<_Rep>::value, "A duration representation can not be a duration");
- static_assert(__is_ratio<_Period>::value, "Second template parameter of duration must be a std::ratio");
- static_assert(_Period::num > 0, "duration period must be positive");
-
- template <class _R1, class _R2>
- struct __no_overflow
+class _LIBCPP_TEMPLATE_VIS duration {
+ static_assert(!__is_duration<_Rep>::value, "A duration representation can not be a duration");
+ static_assert(__is_ratio<_Period>::value, "Second template parameter of duration must be a std::ratio");
+ static_assert(_Period::num > 0, "duration period must be positive");
+
+ template <class _R1, class _R2>
+ struct __no_overflow {
+ private:
+ static const intmax_t __gcd_n1_n2 = __static_gcd<_R1::num, _R2::num>::value;
+ static const intmax_t __gcd_d1_d2 = __static_gcd<_R1::den, _R2::den>::value;
+ static const intmax_t __n1 = _R1::num / __gcd_n1_n2;
+ static const intmax_t __d1 = _R1::den / __gcd_d1_d2;
+ static const intmax_t __n2 = _R2::num / __gcd_n1_n2;
+ static const intmax_t __d2 = _R2::den / __gcd_d1_d2;
+ static const intmax_t max = -((intmax_t(1) << (sizeof(intmax_t) * CHAR_BIT - 1)) + 1);
+
+ template <intmax_t _Xp, intmax_t _Yp, bool __overflow>
+ struct __mul // __overflow == false
{
- private:
- static const intmax_t __gcd_n1_n2 = __static_gcd<_R1::num, _R2::num>::value;
- static const intmax_t __gcd_d1_d2 = __static_gcd<_R1::den, _R2::den>::value;
- static const intmax_t __n1 = _R1::num / __gcd_n1_n2;
- static const intmax_t __d1 = _R1::den / __gcd_d1_d2;
- static const intmax_t __n2 = _R2::num / __gcd_n1_n2;
- static const intmax_t __d2 = _R2::den / __gcd_d1_d2;
- static const intmax_t max = -((intmax_t(1) << (sizeof(intmax_t) * CHAR_BIT - 1)) + 1);
-
- template <intmax_t _Xp, intmax_t _Yp, bool __overflow>
- struct __mul // __overflow == false
- {
- static const intmax_t value = _Xp * _Yp;
- };
-
- template <intmax_t _Xp, intmax_t _Yp>
- struct __mul<_Xp, _Yp, true>
- {
- static const intmax_t value = 1;
- };
-
- public:
- static const bool value = (__n1 <= max / __d2) && (__n2 <= max / __d1);
- typedef ratio<__mul<__n1, __d2, !value>::value,
- __mul<__n2, __d1, !value>::value> type;
+ static const intmax_t value = _Xp * _Yp;
+ };
+
+ template <intmax_t _Xp, intmax_t _Yp>
+ struct __mul<_Xp, _Yp, true> {
+ static const intmax_t value = 1;
};
+ public:
+ static const bool value = (__n1 <= max / __d2) && (__n2 <= max / __d1);
+ typedef ratio<__mul<__n1, __d2, !value>::value, __mul<__n2, __d1, !value>::value> type;
+ };
+
public:
- typedef _Rep rep;
- typedef typename _Period::type period;
+ typedef _Rep rep;
+ typedef typename _Period::type period;
+
private:
- rep __rep_;
-public:
+ rep __rep_;
+public:
#ifndef _LIBCPP_CXX03_LANG
- constexpr duration() = default;
+ constexpr duration() = default;
#else
- _LIBCPP_HIDE_FROM_ABI duration() {}
+ _LIBCPP_HIDE_FROM_ABI duration() {}
#endif
- template <class _Rep2, __enable_if_t<is_convertible<const _Rep2&, rep>::value &&
- (treat_as_floating_point<rep>::value ||
- !treat_as_floating_point<_Rep2>::value), int> = 0>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR
- explicit duration(const _Rep2& __r)
- : __rep_(__r) {}
-
- // conversions
- template <class _Rep2, class _Period2, __enable_if_t<__no_overflow<_Period2, period>::value && (
- treat_as_floating_point<rep>::value ||
- (__no_overflow<_Period2, period>::type::den == 1 &&
- !treat_as_floating_point<_Rep2>::value)), int> = 0>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR
- duration(const duration<_Rep2, _Period2>& __d)
- : __rep_(chrono::duration_cast<duration>(__d).count()) {}
-
- // observer
-
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR rep count() const {return __rep_;}
-
- // arithmetic
-
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR typename common_type<duration>::type operator+() const {return typename common_type<duration>::type(*this);}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR typename common_type<duration>::type operator-() const {return typename common_type<duration>::type(-__rep_);}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 duration& operator++() {++__rep_; return *this;}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 duration operator++(int) {return duration(__rep_++);}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 duration& operator--() {--__rep_; return *this;}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 duration operator--(int) {return duration(__rep_--);}
-
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 duration& operator+=(const duration& __d) {__rep_ += __d.count(); return *this;}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 duration& operator-=(const duration& __d) {__rep_ -= __d.count(); return *this;}
-
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 duration& operator*=(const rep& __rhs) {__rep_ *= __rhs; return *this;}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 duration& operator/=(const rep& __rhs) {__rep_ /= __rhs; return *this;}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 duration& operator%=(const rep& __rhs) {__rep_ %= __rhs; return *this;}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 duration& operator%=(const duration& __rhs) {__rep_ %= __rhs.count(); return *this;}
-
- // special values
-
- _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR duration zero() _NOEXCEPT {return duration(duration_values<rep>::zero());}
- _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR duration min() _NOEXCEPT {return duration(duration_values<rep>::min());}
- _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR duration max() _NOEXCEPT {return duration(duration_values<rep>::max());}
+ template <class _Rep2,
+ __enable_if_t<is_convertible<const _Rep2&, rep>::value &&
+ (treat_as_floating_point<rep>::value || !treat_as_floating_point<_Rep2>::value),
+ int> = 0>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR explicit duration(const _Rep2& __r) : __rep_(__r) {}
+
+ // conversions
+ template <class _Rep2,
+ class _Period2,
+ __enable_if_t<__no_overflow<_Period2, period>::value && (treat_as_floating_point<rep>::value ||
+ (__no_overflow<_Period2, period>::type::den == 1 &&
+ !treat_as_floating_point<_Rep2>::value)),
+ int> = 0>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR duration(const duration<_Rep2, _Period2>& __d)
+ : __rep_(chrono::duration_cast<duration>(__d).count()) {}
+
+ // observer
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR rep count() const { return __rep_; }
+
+ // arithmetic
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR typename common_type<duration>::type operator+() const {
+ return typename common_type<duration>::type(*this);
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR typename common_type<duration>::type operator-() const {
+ return typename common_type<duration>::type(-__rep_);
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 duration& operator++() {
+ ++__rep_;
+ return *this;
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 duration operator++(int) { return duration(__rep_++); }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 duration& operator--() {
+ --__rep_;
+ return *this;
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 duration operator--(int) { return duration(__rep_--); }
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 duration& operator+=(const duration& __d) {
+ __rep_ += __d.count();
+ return *this;
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 duration& operator-=(const duration& __d) {
+ __rep_ -= __d.count();
+ return *this;
+ }
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 duration& operator*=(const rep& __rhs) {
+ __rep_ *= __rhs;
+ return *this;
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 duration& operator/=(const rep& __rhs) {
+ __rep_ /= __rhs;
+ return *this;
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 duration& operator%=(const rep& __rhs) {
+ __rep_ %= __rhs;
+ return *this;
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 duration& operator%=(const duration& __rhs) {
+ __rep_ %= __rhs.count();
+ return *this;
+ }
+
+ // special values
+
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR duration zero() _NOEXCEPT {
+ return duration(duration_values<rep>::zero());
+ }
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR duration min() _NOEXCEPT {
+ return duration(duration_values<rep>::min());
+ }
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR duration max() _NOEXCEPT {
+ return duration(duration_values<rep>::max());
+ }
};
-typedef duration<long long, nano> nanoseconds;
-typedef duration<long long, micro> microseconds;
-typedef duration<long long, milli> milliseconds;
-typedef duration<long long > seconds;
-typedef duration< long, ratio< 60> > minutes;
-typedef duration< long, ratio<3600> > hours;
+typedef duration<long long, nano> nanoseconds;
+typedef duration<long long, micro> microseconds;
+typedef duration<long long, milli> milliseconds;
+typedef duration<long long > seconds;
+typedef duration< long, ratio< 60> > minutes;
+typedef duration< long, ratio<3600> > hours;
#if _LIBCPP_STD_VER >= 20
-typedef duration< int, ratio_multiply<ratio<24>, hours::period>> days;
-typedef duration< int, ratio_multiply<ratio<7>, days::period>> weeks;
-typedef duration< int, ratio_multiply<ratio<146097, 400>, days::period>> years;
-typedef duration< int, ratio_divide<years::period, ratio<12>>> months;
+typedef duration< int, ratio_multiply<ratio<24>, hours::period>> days;
+typedef duration< int, ratio_multiply<ratio<7>, days::period>> weeks;
+typedef duration< int, ratio_multiply<ratio<146097, 400>, days::period>> years;
+typedef duration< int, ratio_divide<years::period, ratio<12>>> months;
#endif
// Duration ==
template <class _LhsDuration, class _RhsDuration>
-struct __duration_eq
-{
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR
- bool operator()(const _LhsDuration& __lhs, const _RhsDuration& __rhs) const
- {
- typedef typename common_type<_LhsDuration, _RhsDuration>::type _Ct;
- return _Ct(__lhs).count() == _Ct(__rhs).count();
- }
+struct __duration_eq {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool operator()(const _LhsDuration& __lhs, const _RhsDuration& __rhs) const {
+ typedef typename common_type<_LhsDuration, _RhsDuration>::type _Ct;
+ return _Ct(__lhs).count() == _Ct(__rhs).count();
+ }
};
template <class _LhsDuration>
-struct __duration_eq<_LhsDuration, _LhsDuration>
-{
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR
- bool operator()(const _LhsDuration& __lhs, const _LhsDuration& __rhs) const
- {return __lhs.count() == __rhs.count();}
+struct __duration_eq<_LhsDuration, _LhsDuration> {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool operator()(const _LhsDuration& __lhs, const _LhsDuration& __rhs) const {
+ return __lhs.count() == __rhs.count();
+ }
};
template <class _Rep1, class _Period1, class _Rep2, class _Period2>
-inline _LIBCPP_HIDE_FROM_ABI
-_LIBCPP_CONSTEXPR
-bool
-operator==(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs)
-{
- return __duration_eq<duration<_Rep1, _Period1>, duration<_Rep2, _Period2> >()(__lhs, __rhs);
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool
+operator==(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs) {
+ return __duration_eq<duration<_Rep1, _Period1>, duration<_Rep2, _Period2> >()(__lhs, __rhs);
}
#if _LIBCPP_STD_VER <= 17
@@ -325,12 +321,9 @@ operator==(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period
// Duration !=
template <class _Rep1, class _Period1, class _Rep2, class _Period2>
-inline _LIBCPP_HIDE_FROM_ABI
-_LIBCPP_CONSTEXPR
-bool
-operator!=(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs)
-{
- return !(__lhs == __rhs);
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool
+operator!=(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs) {
+ return !(__lhs == __rhs);
}
#endif // _LIBCPP_STD_VER <= 17
@@ -338,76 +331,58 @@ operator!=(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period
// Duration <
template <class _LhsDuration, class _RhsDuration>
-struct __duration_lt
-{
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR
- bool operator()(const _LhsDuration& __lhs, const _RhsDuration& __rhs) const
- {
- typedef typename common_type<_LhsDuration, _RhsDuration>::type _Ct;
- return _Ct(__lhs).count() < _Ct(__rhs).count();
- }
+struct __duration_lt {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool operator()(const _LhsDuration& __lhs, const _RhsDuration& __rhs) const {
+ typedef typename common_type<_LhsDuration, _RhsDuration>::type _Ct;
+ return _Ct(__lhs).count() < _Ct(__rhs).count();
+ }
};
template <class _LhsDuration>
-struct __duration_lt<_LhsDuration, _LhsDuration>
-{
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR
- bool operator()(const _LhsDuration& __lhs, const _LhsDuration& __rhs) const
- {return __lhs.count() < __rhs.count();}
+struct __duration_lt<_LhsDuration, _LhsDuration> {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool operator()(const _LhsDuration& __lhs, const _LhsDuration& __rhs) const {
+ return __lhs.count() < __rhs.count();
+ }
};
template <class _Rep1, class _Period1, class _Rep2, class _Period2>
-inline _LIBCPP_HIDE_FROM_ABI
-_LIBCPP_CONSTEXPR
-bool
-operator< (const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs)
-{
- return __duration_lt<duration<_Rep1, _Period1>, duration<_Rep2, _Period2> >()(__lhs, __rhs);
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool
+operator<(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs) {
+ return __duration_lt<duration<_Rep1, _Period1>, duration<_Rep2, _Period2> >()(__lhs, __rhs);
}
// Duration >
template <class _Rep1, class _Period1, class _Rep2, class _Period2>
-inline _LIBCPP_HIDE_FROM_ABI
-_LIBCPP_CONSTEXPR
-bool
-operator> (const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs)
-{
- return __rhs < __lhs;
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool
+operator>(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs) {
+ return __rhs < __lhs;
}
// Duration <=
template <class _Rep1, class _Period1, class _Rep2, class _Period2>
-inline _LIBCPP_HIDE_FROM_ABI
-_LIBCPP_CONSTEXPR
-bool
-operator<=(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs)
-{
- return !(__rhs < __lhs);
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool
+operator<=(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs) {
+ return !(__rhs < __lhs);
}
// Duration >=
template <class _Rep1, class _Period1, class _Rep2, class _Period2>
-inline _LIBCPP_HIDE_FROM_ABI
-_LIBCPP_CONSTEXPR
-bool
-operator>=(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs)
-{
- return !(__lhs < __rhs);
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool
+operator>=(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs) {
+ return !(__lhs < __rhs);
}
#if _LIBCPP_STD_VER >= 20
-template<class _Rep1, class _Period1, class _Rep2, class _Period2>
+template <class _Rep1, class _Period1, class _Rep2, class _Period2>
requires three_way_comparable<common_type_t<_Rep1, _Rep2>>
-_LIBCPP_HIDE_FROM_ABI
-constexpr auto operator<=>(const duration<_Rep1, _Period1>& __lhs,
- const duration<_Rep2, _Period2>& __rhs)
-{
- using _Ct = common_type_t<duration<_Rep1, _Period1>, duration<_Rep2, _Period2>>;
- return _Ct(__lhs).count() <=> _Ct(__rhs).count();
+_LIBCPP_HIDE_FROM_ABI constexpr auto
+operator<=>(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs) {
+ using _Ct = common_type_t<duration<_Rep1, _Period1>, duration<_Rep2, _Period2>>;
+ return _Ct(__lhs).count() <=> _Ct(__rhs).count();
}
#endif // _LIBCPP_STD_VER >= 20
@@ -415,179 +390,151 @@ constexpr auto operator<=>(const duration<_Rep1, _Period1>& __lhs,
// Duration +
template <class _Rep1, class _Period1, class _Rep2, class _Period2>
-inline _LIBCPP_HIDE_FROM_ABI
-_LIBCPP_CONSTEXPR
-typename common_type<duration<_Rep1, _Period1>, duration<_Rep2, _Period2> >::type
-operator+(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs)
-{
- typedef typename common_type<duration<_Rep1, _Period1>, duration<_Rep2, _Period2> >::type _Cd;
- return _Cd(_Cd(__lhs).count() + _Cd(__rhs).count());
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR
+ typename common_type<duration<_Rep1, _Period1>, duration<_Rep2, _Period2> >::type
+ operator+(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs) {
+ typedef typename common_type<duration<_Rep1, _Period1>, duration<_Rep2, _Period2> >::type _Cd;
+ return _Cd(_Cd(__lhs).count() + _Cd(__rhs).count());
}
// Duration -
template <class _Rep1, class _Period1, class _Rep2, class _Period2>
-inline _LIBCPP_HIDE_FROM_ABI
-_LIBCPP_CONSTEXPR
-typename common_type<duration<_Rep1, _Period1>, duration<_Rep2, _Period2> >::type
-operator-(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs)
-{
- typedef typename common_type<duration<_Rep1, _Period1>, duration<_Rep2, _Period2> >::type _Cd;
- return _Cd(_Cd(__lhs).count() - _Cd(__rhs).count());
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR
+ typename common_type<duration<_Rep1, _Period1>, duration<_Rep2, _Period2> >::type
+ operator-(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs) {
+ typedef typename common_type<duration<_Rep1, _Period1>, duration<_Rep2, _Period2> >::type _Cd;
+ return _Cd(_Cd(__lhs).count() - _Cd(__rhs).count());
}
// Duration *
-template <class _Rep1, class _Period, class _Rep2,
+template <class _Rep1,
+ class _Period,
+ class _Rep2,
__enable_if_t<is_convertible<_Rep2, typename common_type<_Rep1, _Rep2>::type>::value, int> = 0>
-inline _LIBCPP_HIDE_FROM_ABI
-_LIBCPP_CONSTEXPR
-duration<typename common_type<_Rep1, _Rep2>::type, _Period>
-operator*(const duration<_Rep1, _Period>& __d, const _Rep2& __s)
-{
- typedef typename common_type<_Rep1, _Rep2>::type _Cr;
- typedef duration<_Cr, _Period> _Cd;
- return _Cd(_Cd(__d).count() * static_cast<_Cr>(__s));
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR duration<typename common_type<_Rep1, _Rep2>::type, _Period>
+operator*(const duration<_Rep1, _Period>& __d, const _Rep2& __s) {
+ typedef typename common_type<_Rep1, _Rep2>::type _Cr;
+ typedef duration<_Cr, _Period> _Cd;
+ return _Cd(_Cd(__d).count() * static_cast<_Cr>(__s));
}
-template <class _Rep1, class _Period, class _Rep2,
+template <class _Rep1,
+ class _Period,
+ class _Rep2,
__enable_if_t<is_convertible<_Rep1, typename common_type<_Rep1, _Rep2>::type>::value, int> = 0>
-inline _LIBCPP_HIDE_FROM_ABI
-_LIBCPP_CONSTEXPR
-duration<typename common_type<_Rep1, _Rep2>::type, _Period>
-operator*(const _Rep1& __s, const duration<_Rep2, _Period>& __d)
-{
- return __d * __s;
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR duration<typename common_type<_Rep1, _Rep2>::type, _Period>
+operator*(const _Rep1& __s, const duration<_Rep2, _Period>& __d) {
+ return __d * __s;
}
// Duration /
-template <class _Rep1, class _Period, class _Rep2,
- __enable_if_t<!__is_duration<_Rep2>::value && is_convertible<_Rep2, typename common_type<_Rep1, _Rep2>::type>::value, int> = 0>
-inline _LIBCPP_HIDE_FROM_ABI
-_LIBCPP_CONSTEXPR
-duration<typename common_type<_Rep1, _Rep2>::type, _Period>
-operator/(const duration<_Rep1, _Period>& __d, const _Rep2& __s)
-{
- typedef typename common_type<_Rep1, _Rep2>::type _Cr;
- typedef duration<_Cr, _Period> _Cd;
- return _Cd(_Cd(__d).count() / static_cast<_Cr>(__s));
+template <class _Rep1,
+ class _Period,
+ class _Rep2,
+ __enable_if_t<!__is_duration<_Rep2>::value &&
+ is_convertible<_Rep2, typename common_type<_Rep1, _Rep2>::type>::value,
+ int> = 0>
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR duration<typename common_type<_Rep1, _Rep2>::type, _Period>
+operator/(const duration<_Rep1, _Period>& __d, const _Rep2& __s) {
+ typedef typename common_type<_Rep1, _Rep2>::type _Cr;
+ typedef duration<_Cr, _Period> _Cd;
+ return _Cd(_Cd(__d).count() / static_cast<_Cr>(__s));
}
template <class _Rep1, class _Period1, class _Rep2, class _Period2>
-inline _LIBCPP_HIDE_FROM_ABI
-_LIBCPP_CONSTEXPR
-typename common_type<_Rep1, _Rep2>::type
-operator/(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs)
-{
- typedef typename common_type<duration<_Rep1, _Period1>, duration<_Rep2, _Period2> >::type _Ct;
- return _Ct(__lhs).count() / _Ct(__rhs).count();
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR typename common_type<_Rep1, _Rep2>::type
+operator/(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs) {
+ typedef typename common_type<duration<_Rep1, _Period1>, duration<_Rep2, _Period2> >::type _Ct;
+ return _Ct(__lhs).count() / _Ct(__rhs).count();
}
// Duration %
-template <class _Rep1, class _Period, class _Rep2,
- __enable_if_t<!__is_duration<_Rep2>::value && is_convertible<_Rep2, typename common_type<_Rep1, _Rep2>::type>::value, int> = 0>
-inline _LIBCPP_HIDE_FROM_ABI
-_LIBCPP_CONSTEXPR
-duration<typename common_type<_Rep1, _Rep2>::type, _Period>
-operator%(const duration<_Rep1, _Period>& __d, const _Rep2& __s)
-{
- typedef typename common_type<_Rep1, _Rep2>::type _Cr;
- typedef duration<_Cr, _Period> _Cd;
- return _Cd(_Cd(__d).count() % static_cast<_Cr>(__s));
+template <class _Rep1,
+ class _Period,
+ class _Rep2,
+ __enable_if_t<!__is_duration<_Rep2>::value &&
+ is_convertible<_Rep2, typename common_type<_Rep1, _Rep2>::type>::value,
+ int> = 0>
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR duration<typename common_type<_Rep1, _Rep2>::type, _Period>
+operator%(const duration<_Rep1, _Period>& __d, const _Rep2& __s) {
+ typedef typename common_type<_Rep1, _Rep2>::type _Cr;
+ typedef duration<_Cr, _Period> _Cd;
+ return _Cd(_Cd(__d).count() % static_cast<_Cr>(__s));
}
template <class _Rep1, class _Period1, class _Rep2, class _Period2>
-inline _LIBCPP_HIDE_FROM_ABI
-_LIBCPP_CONSTEXPR
-typename common_type<duration<_Rep1, _Period1>, duration<_Rep2, _Period2> >::type
-operator%(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs)
-{
- typedef typename common_type<_Rep1, _Rep2>::type _Cr;
- typedef typename common_type<duration<_Rep1, _Period1>, duration<_Rep2, _Period2> >::type _Cd;
- return _Cd(static_cast<_Cr>(_Cd(__lhs).count()) % static_cast<_Cr>(_Cd(__rhs).count()));
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR
+ typename common_type<duration<_Rep1, _Period1>, duration<_Rep2, _Period2> >::type
+ operator%(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs) {
+ typedef typename common_type<_Rep1, _Rep2>::type _Cr;
+ typedef typename common_type<duration<_Rep1, _Period1>, duration<_Rep2, _Period2> >::type _Cd;
+ return _Cd(static_cast<_Cr>(_Cd(__lhs).count()) % static_cast<_Cr>(_Cd(__rhs).count()));
}
} // namespace chrono
#if _LIBCPP_STD_VER >= 14
// Suffixes for duration literals [time.duration.literals]
-inline namespace literals
-{
- inline namespace chrono_literals
- {
-
- _LIBCPP_HIDE_FROM_ABI constexpr chrono::hours operator""h(unsigned long long __h)
- {
- return chrono::hours(static_cast<chrono::hours::rep>(__h));
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr chrono::duration<long double, ratio<3600,1>> operator""h(long double __h)
- {
- return chrono::duration<long double, ratio<3600,1>>(__h);
- }
-
-
- _LIBCPP_HIDE_FROM_ABI constexpr chrono::minutes operator""min(unsigned long long __m)
- {
- return chrono::minutes(static_cast<chrono::minutes::rep>(__m));
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr chrono::duration<long double, ratio<60,1>> operator""min(long double __m)
- {
- return chrono::duration<long double, ratio<60,1>> (__m);
- }
+inline namespace literals {
+inline namespace chrono_literals {
+_LIBCPP_HIDE_FROM_ABI constexpr chrono::hours operator""h(unsigned long long __h) {
+ return chrono::hours(static_cast<chrono::hours::rep>(__h));
+}
- _LIBCPP_HIDE_FROM_ABI constexpr chrono::seconds operator""s(unsigned long long __s)
- {
- return chrono::seconds(static_cast<chrono::seconds::rep>(__s));
- }
+_LIBCPP_HIDE_FROM_ABI constexpr chrono::duration<long double, ratio<3600, 1>> operator""h(long double __h) {
+ return chrono::duration<long double, ratio<3600, 1>>(__h);
+}
- _LIBCPP_HIDE_FROM_ABI constexpr chrono::duration<long double> operator""s(long double __s)
- {
- return chrono::duration<long double> (__s);
- }
+_LIBCPP_HIDE_FROM_ABI constexpr chrono::minutes operator""min(unsigned long long __m) {
+ return chrono::minutes(static_cast<chrono::minutes::rep>(__m));
+}
+_LIBCPP_HIDE_FROM_ABI constexpr chrono::duration<long double, ratio<60, 1>> operator""min(long double __m) {
+ return chrono::duration<long double, ratio<60, 1>>(__m);
+}
- _LIBCPP_HIDE_FROM_ABI constexpr chrono::milliseconds operator""ms(unsigned long long __ms)
- {
- return chrono::milliseconds(static_cast<chrono::milliseconds::rep>(__ms));
- }
+_LIBCPP_HIDE_FROM_ABI constexpr chrono::seconds operator""s(unsigned long long __s) {
+ return chrono::seconds(static_cast<chrono::seconds::rep>(__s));
+}
- _LIBCPP_HIDE_FROM_ABI constexpr chrono::duration<long double, milli> operator""ms(long double __ms)
- {
- return chrono::duration<long double, milli>(__ms);
- }
+_LIBCPP_HIDE_FROM_ABI constexpr chrono::duration<long double> operator""s(long double __s) {
+ return chrono::duration<long double>(__s);
+}
+_LIBCPP_HIDE_FROM_ABI constexpr chrono::milliseconds operator""ms(unsigned long long __ms) {
+ return chrono::milliseconds(static_cast<chrono::milliseconds::rep>(__ms));
+}
- _LIBCPP_HIDE_FROM_ABI constexpr chrono::microseconds operator""us(unsigned long long __us)
- {
- return chrono::microseconds(static_cast<chrono::microseconds::rep>(__us));
- }
+_LIBCPP_HIDE_FROM_ABI constexpr chrono::duration<long double, milli> operator""ms(long double __ms) {
+ return chrono::duration<long double, milli>(__ms);
+}
- _LIBCPP_HIDE_FROM_ABI constexpr chrono::duration<long double, micro> operator""us(long double __us)
- {
- return chrono::duration<long double, micro> (__us);
- }
+_LIBCPP_HIDE_FROM_ABI constexpr chrono::microseconds operator""us(unsigned long long __us) {
+ return chrono::microseconds(static_cast<chrono::microseconds::rep>(__us));
+}
+_LIBCPP_HIDE_FROM_ABI constexpr chrono::duration<long double, micro> operator""us(long double __us) {
+ return chrono::duration<long double, micro>(__us);
+}
- _LIBCPP_HIDE_FROM_ABI constexpr chrono::nanoseconds operator""ns(unsigned long long __ns)
- {
- return chrono::nanoseconds(static_cast<chrono::nanoseconds::rep>(__ns));
- }
+_LIBCPP_HIDE_FROM_ABI constexpr chrono::nanoseconds operator""ns(unsigned long long __ns) {
+ return chrono::nanoseconds(static_cast<chrono::nanoseconds::rep>(__ns));
+}
- _LIBCPP_HIDE_FROM_ABI constexpr chrono::duration<long double, nano> operator""ns(long double __ns)
- {
- return chrono::duration<long double, nano> (__ns);
- }
+_LIBCPP_HIDE_FROM_ABI constexpr chrono::duration<long double, nano> operator""ns(long double __ns) {
+ return chrono::duration<long double, nano>(__ns);
+}
} // namespace chrono_literals
} // namespace literals
namespace chrono { // hoist the literals into namespace std::chrono
- using namespace literals::chrono_literals;
+using namespace literals::chrono_literals;
} // namespace chrono
#endif // _LIBCPP_STD_VER >= 14
diff --git a/contrib/llvm-project/libcxx/include/__chrono/file_clock.h b/contrib/llvm-project/libcxx/include/__chrono/file_clock.h
index 9ea2fcb97935..7d25729fec01 100644
--- a/contrib/llvm-project/libcxx/include/__chrono/file_clock.h
+++ b/contrib/llvm-project/libcxx/include/__chrono/file_clock.h
@@ -31,13 +31,12 @@ _LIBCPP_END_NAMESPACE_FILESYSTEM
_LIBCPP_BEGIN_NAMESPACE_STD
-namespace chrono
-{
+namespace chrono {
// [time.clock.file], type file_clock
using file_clock = filesystem::_FilesystemClock;
-template<class _Duration>
+template <class _Duration>
using file_time = time_point<file_clock, _Duration>;
} // namespace chrono
@@ -49,35 +48,32 @@ _LIBCPP_END_NAMESPACE_STD
#ifndef _LIBCPP_CXX03_LANG
_LIBCPP_BEGIN_NAMESPACE_FILESYSTEM
struct _FilesystemClock {
-#if !defined(_LIBCPP_HAS_NO_INT128)
+# if !defined(_LIBCPP_HAS_NO_INT128)
typedef __int128_t rep;
typedef nano period;
-#else
+# else
typedef long long rep;
typedef nano period;
-#endif
+# endif
typedef chrono::duration<rep, period> duration;
typedef chrono::time_point<_FilesystemClock> time_point;
- _LIBCPP_EXPORTED_FROM_ABI
- static _LIBCPP_CONSTEXPR_SINCE_CXX14 const bool is_steady = false;
+ _LIBCPP_EXPORTED_FROM_ABI static _LIBCPP_CONSTEXPR_SINCE_CXX14 const bool is_steady = false;
_LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY _LIBCPP_EXPORTED_FROM_ABI static time_point now() noexcept;
-#if _LIBCPP_STD_VER >= 20
+# if _LIBCPP_STD_VER >= 20
template <class _Duration>
- _LIBCPP_HIDE_FROM_ABI
- static chrono::sys_time<_Duration> to_sys(const chrono::file_time<_Duration>& __t) {
+ _LIBCPP_HIDE_FROM_ABI static chrono::sys_time<_Duration> to_sys(const chrono::file_time<_Duration>& __t) {
return chrono::sys_time<_Duration>(__t.time_since_epoch());
}
template <class _Duration>
- _LIBCPP_HIDE_FROM_ABI
- static chrono::file_time<_Duration> from_sys(const chrono::sys_time<_Duration>& __t) {
+ _LIBCPP_HIDE_FROM_ABI static chrono::file_time<_Duration> from_sys(const chrono::sys_time<_Duration>& __t) {
return chrono::file_time<_Duration>(__t.time_since_epoch());
}
-#endif // _LIBCPP_STD_VER >= 20
+# endif // _LIBCPP_STD_VER >= 20
};
_LIBCPP_END_NAMESPACE_FILESYSTEM
#endif // !_LIBCPP_CXX03_LANG
diff --git a/contrib/llvm-project/libcxx/include/__chrono/formatter.h b/contrib/llvm-project/libcxx/include/__chrono/formatter.h
index 30ed360d4ef5..4ad59382a414 100644
--- a/contrib/llvm-project/libcxx/include/__chrono/formatter.h
+++ b/contrib/llvm-project/libcxx/include/__chrono/formatter.h
@@ -198,7 +198,8 @@ _LIBCPP_HIDE_FROM_ABI void __format_chrono_using_chrono_specs(
if (__year < 1000 || __year > 9999)
__formatter::__format_century(__year, __sstr);
else
- __facet.put({__sstr}, __sstr, _CharT(' '), std::addressof(__t), std::to_address(__s), std::to_address(__it + 1));
+ __facet.put(
+ {__sstr}, __sstr, _CharT(' '), std::addressof(__t), std::to_address(__s), std::to_address(__it + 1));
} break;
case _CharT('j'):
@@ -209,7 +210,8 @@ _LIBCPP_HIDE_FROM_ABI void __format_chrono_using_chrono_specs(
// an intemediate step.
__sstr << chrono::duration_cast<chrono::days>(chrono::duration_cast<chrono::seconds>(__value)).count();
else
- __facet.put({__sstr}, __sstr, _CharT(' '), std::addressof(__t), std::to_address(__s), std::to_address(__it + 1));
+ __facet.put(
+ {__sstr}, __sstr, _CharT(' '), std::addressof(__t), std::to_address(__s), std::to_address(__it + 1));
break;
case _CharT('q'):
@@ -237,7 +239,8 @@ _LIBCPP_HIDE_FROM_ABI void __format_chrono_using_chrono_specs(
case _CharT('S'):
case _CharT('T'):
- __facet.put({__sstr}, __sstr, _CharT(' '), std::addressof(__t), std::to_address(__s), std::to_address(__it + 1));
+ __facet.put(
+ {__sstr}, __sstr, _CharT(' '), std::addressof(__t), std::to_address(__s), std::to_address(__it + 1));
if constexpr (__use_fraction<_Tp>())
__formatter::__format_sub_seconds(__value, __sstr);
break;
@@ -289,7 +292,8 @@ _LIBCPP_HIDE_FROM_ABI void __format_chrono_using_chrono_specs(
__formatter::__format_year(__year, __sstr);
__sstr << std::format(_LIBCPP_STATICALLY_WIDEN(_CharT, "-{:02}-{:02}"), __t.tm_mon + 1, __t.tm_mday);
} else
- __facet.put({__sstr}, __sstr, _CharT(' '), std::addressof(__t), std::to_address(__s), std::to_address(__it + 1));
+ __facet.put(
+ {__sstr}, __sstr, _CharT(' '), std::addressof(__t), std::to_address(__s), std::to_address(__it + 1));
} break;
case _CharT('Z'):
@@ -304,7 +308,8 @@ _LIBCPP_HIDE_FROM_ABI void __format_chrono_using_chrono_specs(
// fractional part should be formatted.
if (*(__it + 1) == 'S') {
++__it;
- __facet.put({__sstr}, __sstr, _CharT(' '), std::addressof(__t), std::to_address(__s), std::to_address(__it + 1));
+ __facet.put(
+ {__sstr}, __sstr, _CharT(' '), std::addressof(__t), std::to_address(__s), std::to_address(__it + 1));
__formatter::__format_sub_seconds(__value, __sstr);
break;
}
@@ -314,7 +319,8 @@ _LIBCPP_HIDE_FROM_ABI void __format_chrono_using_chrono_specs(
++__it;
[[fallthrough]];
default:
- __facet.put({__sstr}, __sstr, _CharT(' '), std::addressof(__t), std::to_address(__s), std::to_address(__it + 1));
+ __facet.put(
+ {__sstr}, __sstr, _CharT(' '), std::addressof(__t), std::to_address(__s), std::to_address(__it + 1));
break;
}
} else {
@@ -634,8 +640,7 @@ public:
};
template <__fmt_char_type _CharT>
-struct _LIBCPP_TEMPLATE_VIS formatter<chrono::day, _CharT>
- : public __formatter_chrono<_CharT> {
+struct _LIBCPP_TEMPLATE_VIS formatter<chrono::day, _CharT> : public __formatter_chrono<_CharT> {
public:
using _Base = __formatter_chrono<_CharT>;
@@ -646,8 +651,7 @@ public:
};
template <__fmt_char_type _CharT>
-struct _LIBCPP_TEMPLATE_VIS formatter<chrono::month, _CharT>
- : public __formatter_chrono<_CharT> {
+struct _LIBCPP_TEMPLATE_VIS formatter<chrono::month, _CharT> : public __formatter_chrono<_CharT> {
public:
using _Base = __formatter_chrono<_CharT>;
@@ -658,8 +662,7 @@ public:
};
template <__fmt_char_type _CharT>
-struct _LIBCPP_TEMPLATE_VIS formatter<chrono::year, _CharT>
- : public __formatter_chrono<_CharT> {
+struct _LIBCPP_TEMPLATE_VIS formatter<chrono::year, _CharT> : public __formatter_chrono<_CharT> {
public:
using _Base = __formatter_chrono<_CharT>;
@@ -670,8 +673,7 @@ public:
};
template <__fmt_char_type _CharT>
-struct _LIBCPP_TEMPLATE_VIS formatter<chrono::weekday, _CharT>
- : public __formatter_chrono<_CharT> {
+struct _LIBCPP_TEMPLATE_VIS formatter<chrono::weekday, _CharT> : public __formatter_chrono<_CharT> {
public:
using _Base = __formatter_chrono<_CharT>;
@@ -682,8 +684,7 @@ public:
};
template <__fmt_char_type _CharT>
-struct _LIBCPP_TEMPLATE_VIS formatter<chrono::weekday_indexed, _CharT>
- : public __formatter_chrono<_CharT> {
+struct _LIBCPP_TEMPLATE_VIS formatter<chrono::weekday_indexed, _CharT> : public __formatter_chrono<_CharT> {
public:
using _Base = __formatter_chrono<_CharT>;
@@ -694,8 +695,7 @@ public:
};
template <__fmt_char_type _CharT>
-struct _LIBCPP_TEMPLATE_VIS formatter<chrono::weekday_last, _CharT>
- : public __formatter_chrono<_CharT> {
+struct _LIBCPP_TEMPLATE_VIS formatter<chrono::weekday_last, _CharT> : public __formatter_chrono<_CharT> {
public:
using _Base = __formatter_chrono<_CharT>;
@@ -706,8 +706,7 @@ public:
};
template <__fmt_char_type _CharT>
-struct _LIBCPP_TEMPLATE_VIS formatter<chrono::month_day, _CharT>
- : public __formatter_chrono<_CharT> {
+struct _LIBCPP_TEMPLATE_VIS formatter<chrono::month_day, _CharT> : public __formatter_chrono<_CharT> {
public:
using _Base = __formatter_chrono<_CharT>;
@@ -718,8 +717,7 @@ public:
};
template <__fmt_char_type _CharT>
-struct _LIBCPP_TEMPLATE_VIS formatter<chrono::month_day_last, _CharT>
- : public __formatter_chrono<_CharT> {
+struct _LIBCPP_TEMPLATE_VIS formatter<chrono::month_day_last, _CharT> : public __formatter_chrono<_CharT> {
public:
using _Base = __formatter_chrono<_CharT>;
@@ -730,8 +728,7 @@ public:
};
template <__fmt_char_type _CharT>
-struct _LIBCPP_TEMPLATE_VIS formatter<chrono::month_weekday, _CharT>
- : public __formatter_chrono<_CharT> {
+struct _LIBCPP_TEMPLATE_VIS formatter<chrono::month_weekday, _CharT> : public __formatter_chrono<_CharT> {
public:
using _Base = __formatter_chrono<_CharT>;
@@ -742,8 +739,7 @@ public:
};
template <__fmt_char_type _CharT>
-struct _LIBCPP_TEMPLATE_VIS formatter<chrono::month_weekday_last, _CharT>
- : public __formatter_chrono<_CharT> {
+struct _LIBCPP_TEMPLATE_VIS formatter<chrono::month_weekday_last, _CharT> : public __formatter_chrono<_CharT> {
public:
using _Base = __formatter_chrono<_CharT>;
@@ -754,8 +750,7 @@ public:
};
template <__fmt_char_type _CharT>
-struct _LIBCPP_TEMPLATE_VIS formatter<chrono::year_month, _CharT>
- : public __formatter_chrono<_CharT> {
+struct _LIBCPP_TEMPLATE_VIS formatter<chrono::year_month, _CharT> : public __formatter_chrono<_CharT> {
public:
using _Base = __formatter_chrono<_CharT>;
@@ -766,8 +761,7 @@ public:
};
template <__fmt_char_type _CharT>
-struct _LIBCPP_TEMPLATE_VIS formatter<chrono::year_month_day, _CharT>
- : public __formatter_chrono<_CharT> {
+struct _LIBCPP_TEMPLATE_VIS formatter<chrono::year_month_day, _CharT> : public __formatter_chrono<_CharT> {
public:
using _Base = __formatter_chrono<_CharT>;
@@ -778,8 +772,7 @@ public:
};
template <__fmt_char_type _CharT>
-struct _LIBCPP_TEMPLATE_VIS formatter<chrono::year_month_day_last, _CharT>
- : public __formatter_chrono<_CharT> {
+struct _LIBCPP_TEMPLATE_VIS formatter<chrono::year_month_day_last, _CharT> : public __formatter_chrono<_CharT> {
public:
using _Base = __formatter_chrono<_CharT>;
@@ -790,8 +783,7 @@ public:
};
template <__fmt_char_type _CharT>
-struct _LIBCPP_TEMPLATE_VIS formatter<chrono::year_month_weekday, _CharT>
- : public __formatter_chrono<_CharT> {
+struct _LIBCPP_TEMPLATE_VIS formatter<chrono::year_month_weekday, _CharT> : public __formatter_chrono<_CharT> {
public:
using _Base = __formatter_chrono<_CharT>;
@@ -802,8 +794,7 @@ public:
};
template <__fmt_char_type _CharT>
-struct _LIBCPP_TEMPLATE_VIS formatter<chrono::year_month_weekday_last, _CharT>
- : public __formatter_chrono<_CharT> {
+struct _LIBCPP_TEMPLATE_VIS formatter<chrono::year_month_weekday_last, _CharT> : public __formatter_chrono<_CharT> {
public:
using _Base = __formatter_chrono<_CharT>;
diff --git a/contrib/llvm-project/libcxx/include/__chrono/hh_mm_ss.h b/contrib/llvm-project/libcxx/include/__chrono/hh_mm_ss.h
index 0adee2d60db8..57d2247fe6a3 100644
--- a/contrib/llvm-project/libcxx/include/__chrono/hh_mm_ss.h
+++ b/contrib/llvm-project/libcxx/include/__chrono/hh_mm_ss.h
@@ -24,85 +24,84 @@
_LIBCPP_BEGIN_NAMESPACE_STD
-namespace chrono
-{
+namespace chrono {
template <class _Duration>
-class hh_mm_ss
-{
+class hh_mm_ss {
private:
- static_assert(__is_duration<_Duration>::value, "template parameter of hh_mm_ss must be a std::chrono::duration");
- using __CommonType = common_type_t<_Duration, chrono::seconds>;
-
- _LIBCPP_HIDE_FROM_ABI static constexpr uint64_t __pow10(unsigned __exp)
- {
- uint64_t __ret = 1;
- for (unsigned __i = 0; __i < __exp; ++__i)
- __ret *= 10U;
- return __ret;
- }
-
- _LIBCPP_HIDE_FROM_ABI static constexpr unsigned __width(uint64_t __n, uint64_t __d = 10, unsigned __w = 0)
- {
- if (__n >= 2 && __d != 0 && __w < 19)
- return 1 + __width(__n, __d % __n * 10, __w+1);
- return 0;
- }
+ static_assert(__is_duration<_Duration>::value, "template parameter of hh_mm_ss must be a std::chrono::duration");
+ using __CommonType = common_type_t<_Duration, chrono::seconds>;
+
+ _LIBCPP_HIDE_FROM_ABI static constexpr uint64_t __pow10(unsigned __exp) {
+ uint64_t __ret = 1;
+ for (unsigned __i = 0; __i < __exp; ++__i)
+ __ret *= 10U;
+ return __ret;
+ }
+
+ _LIBCPP_HIDE_FROM_ABI static constexpr unsigned __width(uint64_t __n, uint64_t __d = 10, unsigned __w = 0) {
+ if (__n >= 2 && __d != 0 && __w < 19)
+ return 1 + __width(__n, __d % __n * 10, __w + 1);
+ return 0;
+ }
public:
- _LIBCPP_HIDE_FROM_ABI static unsigned constexpr fractional_width = __width(__CommonType::period::den) < 19 ?
- __width(__CommonType::period::den) : 6u;
- using precision = duration<typename __CommonType::rep, ratio<1, __pow10(fractional_width)>>;
+ _LIBCPP_HIDE_FROM_ABI static unsigned constexpr fractional_width =
+ __width(__CommonType::period::den) < 19 ? __width(__CommonType::period::den) : 6u;
+ using precision = duration<typename __CommonType::rep, ratio<1, __pow10(fractional_width)>>;
- _LIBCPP_HIDE_FROM_ABI constexpr hh_mm_ss() noexcept : hh_mm_ss{_Duration::zero()} {}
+ _LIBCPP_HIDE_FROM_ABI constexpr hh_mm_ss() noexcept : hh_mm_ss{_Duration::zero()} {}
- _LIBCPP_HIDE_FROM_ABI constexpr explicit hh_mm_ss(_Duration __d) noexcept :
- __is_neg_(__d < _Duration(0)),
- __h_(chrono::duration_cast<chrono::hours> (chrono::abs(__d))),
+ _LIBCPP_HIDE_FROM_ABI constexpr explicit hh_mm_ss(_Duration __d) noexcept
+ : __is_neg_(__d < _Duration(0)),
+ __h_(chrono::duration_cast<chrono::hours>(chrono::abs(__d))),
__m_(chrono::duration_cast<chrono::minutes>(chrono::abs(__d) - hours())),
__s_(chrono::duration_cast<chrono::seconds>(chrono::abs(__d) - hours() - minutes())),
- __f_(chrono::duration_cast<precision> (chrono::abs(__d) - hours() - minutes() - seconds()))
- {}
+ __f_(chrono::duration_cast<precision>(chrono::abs(__d) - hours() - minutes() - seconds())) {}
- _LIBCPP_HIDE_FROM_ABI constexpr bool is_negative() const noexcept { return __is_neg_; }
- _LIBCPP_HIDE_FROM_ABI constexpr chrono::hours hours() const noexcept { return __h_; }
- _LIBCPP_HIDE_FROM_ABI constexpr chrono::minutes minutes() const noexcept { return __m_; }
- _LIBCPP_HIDE_FROM_ABI constexpr chrono::seconds seconds() const noexcept { return __s_; }
- _LIBCPP_HIDE_FROM_ABI constexpr precision subseconds() const noexcept { return __f_; }
+ _LIBCPP_HIDE_FROM_ABI constexpr bool is_negative() const noexcept { return __is_neg_; }
+ _LIBCPP_HIDE_FROM_ABI constexpr chrono::hours hours() const noexcept { return __h_; }
+ _LIBCPP_HIDE_FROM_ABI constexpr chrono::minutes minutes() const noexcept { return __m_; }
+ _LIBCPP_HIDE_FROM_ABI constexpr chrono::seconds seconds() const noexcept { return __s_; }
+ _LIBCPP_HIDE_FROM_ABI constexpr precision subseconds() const noexcept { return __f_; }
- _LIBCPP_HIDE_FROM_ABI constexpr precision to_duration() const noexcept
- {
- auto __dur = __h_ + __m_ + __s_ + __f_;
- return __is_neg_ ? -__dur : __dur;
- }
+ _LIBCPP_HIDE_FROM_ABI constexpr precision to_duration() const noexcept {
+ auto __dur = __h_ + __m_ + __s_ + __f_;
+ return __is_neg_ ? -__dur : __dur;
+ }
- _LIBCPP_HIDE_FROM_ABI constexpr explicit operator precision() const noexcept { return to_duration(); }
+ _LIBCPP_HIDE_FROM_ABI constexpr explicit operator precision() const noexcept { return to_duration(); }
private:
- bool __is_neg_;
- chrono::hours __h_;
- chrono::minutes __m_;
- chrono::seconds __s_;
- precision __f_;
+ bool __is_neg_;
+ chrono::hours __h_;
+ chrono::minutes __m_;
+ chrono::seconds __s_;
+ precision __f_;
};
_LIBCPP_CTAD_SUPPORTED_FOR_TYPE(hh_mm_ss);
-_LIBCPP_HIDE_FROM_ABI inline constexpr bool is_am(const hours& __h) noexcept { return __h >= hours( 0) && __h < hours(12); }
-_LIBCPP_HIDE_FROM_ABI inline constexpr bool is_pm(const hours& __h) noexcept { return __h >= hours(12) && __h < hours(24); }
+_LIBCPP_HIDE_FROM_ABI inline constexpr bool is_am(const hours& __h) noexcept {
+ return __h >= hours(0) && __h < hours(12);
+}
+_LIBCPP_HIDE_FROM_ABI inline constexpr bool is_pm(const hours& __h) noexcept {
+ return __h >= hours(12) && __h < hours(24);
+}
-_LIBCPP_HIDE_FROM_ABI inline constexpr hours make12(const hours& __h) noexcept
-{
- if (__h == hours( 0)) return hours(12);
- else if (__h <= hours(12)) return __h;
- else return __h - hours(12);
+_LIBCPP_HIDE_FROM_ABI inline constexpr hours make12(const hours& __h) noexcept {
+ if (__h == hours(0))
+ return hours(12);
+ else if (__h <= hours(12))
+ return __h;
+ else
+ return __h - hours(12);
}
-_LIBCPP_HIDE_FROM_ABI inline constexpr hours make24(const hours& __h, bool __is_pm) noexcept
-{
- if (__is_pm)
- return __h == hours(12) ? __h : __h + hours(12);
- else
- return __h == hours(12) ? hours(0) : __h;
+_LIBCPP_HIDE_FROM_ABI inline constexpr hours make24(const hours& __h, bool __is_pm) noexcept {
+ if (__is_pm)
+ return __h == hours(12) ? __h : __h + hours(12);
+ else
+ return __h == hours(12) ? hours(0) : __h;
}
} // namespace chrono
diff --git a/contrib/llvm-project/libcxx/include/__chrono/high_resolution_clock.h b/contrib/llvm-project/libcxx/include/__chrono/high_resolution_clock.h
index 778ff44f3d09..0697fd2de9b4 100644
--- a/contrib/llvm-project/libcxx/include/__chrono/high_resolution_clock.h
+++ b/contrib/llvm-project/libcxx/include/__chrono/high_resolution_clock.h
@@ -20,8 +20,7 @@
_LIBCPP_BEGIN_NAMESPACE_STD
-namespace chrono
-{
+namespace chrono {
#ifndef _LIBCPP_HAS_NO_MONOTONIC_CLOCK
typedef steady_clock high_resolution_clock;
diff --git a/contrib/llvm-project/libcxx/include/__chrono/literals.h b/contrib/llvm-project/libcxx/include/__chrono/literals.h
index 28ddc43a2c0c..89800440edf4 100644
--- a/contrib/llvm-project/libcxx/include/__chrono/literals.h
+++ b/contrib/llvm-project/libcxx/include/__chrono/literals.h
@@ -22,24 +22,20 @@
_LIBCPP_BEGIN_NAMESPACE_STD
-inline namespace literals
-{
- inline namespace chrono_literals
- {
- _LIBCPP_HIDE_FROM_ABI constexpr chrono::day operator ""d(unsigned long long __d) noexcept
- {
- return chrono::day(static_cast<unsigned>(__d));
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr chrono::year operator ""y(unsigned long long __y) noexcept
- {
- return chrono::year(static_cast<int>(__y));
- }
+inline namespace literals {
+inline namespace chrono_literals {
+_LIBCPP_HIDE_FROM_ABI constexpr chrono::day operator""d(unsigned long long __d) noexcept {
+ return chrono::day(static_cast<unsigned>(__d));
+}
+
+_LIBCPP_HIDE_FROM_ABI constexpr chrono::year operator""y(unsigned long long __y) noexcept {
+ return chrono::year(static_cast<int>(__y));
+}
} // namespace chrono_literals
} // namespace literals
namespace chrono { // hoist the literals into namespace std::chrono
- using namespace literals::chrono_literals;
+using namespace literals::chrono_literals;
} // namespace chrono
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__chrono/month.h b/contrib/llvm-project/libcxx/include/__chrono/month.h
index 2dee5d8c6c70..ce5cc21aab7d 100644
--- a/contrib/llvm-project/libcxx/include/__chrono/month.h
+++ b/contrib/llvm-project/libcxx/include/__chrono/month.h
@@ -22,64 +22,76 @@
_LIBCPP_BEGIN_NAMESPACE_STD
-namespace chrono
-{
+namespace chrono {
class month {
private:
- unsigned char __m_;
+ unsigned char __m_;
+
public:
- month() = default;
- _LIBCPP_HIDE_FROM_ABI explicit inline constexpr month(unsigned __val) noexcept : __m_(static_cast<unsigned char>(__val)) {}
- _LIBCPP_HIDE_FROM_ABI inline constexpr month& operator++() noexcept { *this += months{1}; return *this; }
- _LIBCPP_HIDE_FROM_ABI inline constexpr month operator++(int) noexcept { month __tmp = *this; ++(*this); return __tmp; }
- _LIBCPP_HIDE_FROM_ABI inline constexpr month& operator--() noexcept { *this -= months{1}; return *this; }
- _LIBCPP_HIDE_FROM_ABI inline constexpr month operator--(int) noexcept { month __tmp = *this; --(*this); return __tmp; }
- _LIBCPP_HIDE_FROM_ABI constexpr month& operator+=(const months& __m1) noexcept;
- _LIBCPP_HIDE_FROM_ABI constexpr month& operator-=(const months& __m1) noexcept;
- _LIBCPP_HIDE_FROM_ABI explicit inline constexpr operator unsigned() const noexcept { return __m_; }
- _LIBCPP_HIDE_FROM_ABI inline constexpr bool ok() const noexcept { return __m_ >= 1 && __m_ <= 12; }
+ month() = default;
+ _LIBCPP_HIDE_FROM_ABI explicit inline constexpr month(unsigned __val) noexcept
+ : __m_(static_cast<unsigned char>(__val)) {}
+ _LIBCPP_HIDE_FROM_ABI inline constexpr month& operator++() noexcept {
+ *this += months{1};
+ return *this;
+ }
+ _LIBCPP_HIDE_FROM_ABI inline constexpr month operator++(int) noexcept {
+ month __tmp = *this;
+ ++(*this);
+ return __tmp;
+ }
+ _LIBCPP_HIDE_FROM_ABI inline constexpr month& operator--() noexcept {
+ *this -= months{1};
+ return *this;
+ }
+ _LIBCPP_HIDE_FROM_ABI inline constexpr month operator--(int) noexcept {
+ month __tmp = *this;
+ --(*this);
+ return __tmp;
+ }
+ _LIBCPP_HIDE_FROM_ABI constexpr month& operator+=(const months& __m1) noexcept;
+ _LIBCPP_HIDE_FROM_ABI constexpr month& operator-=(const months& __m1) noexcept;
+ _LIBCPP_HIDE_FROM_ABI explicit inline constexpr operator unsigned() const noexcept { return __m_; }
+ _LIBCPP_HIDE_FROM_ABI inline constexpr bool ok() const noexcept { return __m_ >= 1 && __m_ <= 12; }
};
-
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-bool operator==(const month& __lhs, const month& __rhs) noexcept
-{ return static_cast<unsigned>(__lhs) == static_cast<unsigned>(__rhs); }
+_LIBCPP_HIDE_FROM_ABI inline constexpr bool operator==(const month& __lhs, const month& __rhs) noexcept {
+ return static_cast<unsigned>(__lhs) == static_cast<unsigned>(__rhs);
+}
_LIBCPP_HIDE_FROM_ABI inline constexpr strong_ordering operator<=>(const month& __lhs, const month& __rhs) noexcept {
- return static_cast<unsigned>(__lhs) <=> static_cast<unsigned>(__rhs);
+ return static_cast<unsigned>(__lhs) <=> static_cast<unsigned>(__rhs);
}
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-month operator+ (const month& __lhs, const months& __rhs) noexcept
-{
- auto const __mu = static_cast<long long>(static_cast<unsigned>(__lhs)) + (__rhs.count() - 1);
- auto const __yr = (__mu >= 0 ? __mu : __mu - 11) / 12;
- return month{static_cast<unsigned>(__mu - __yr * 12 + 1)};
+_LIBCPP_HIDE_FROM_ABI inline constexpr month operator+(const month& __lhs, const months& __rhs) noexcept {
+ auto const __mu = static_cast<long long>(static_cast<unsigned>(__lhs)) + (__rhs.count() - 1);
+ auto const __yr = (__mu >= 0 ? __mu : __mu - 11) / 12;
+ return month{static_cast<unsigned>(__mu - __yr * 12 + 1)};
}
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-month operator+ (const months& __lhs, const month& __rhs) noexcept
-{ return __rhs + __lhs; }
+_LIBCPP_HIDE_FROM_ABI inline constexpr month operator+(const months& __lhs, const month& __rhs) noexcept {
+ return __rhs + __lhs;
+}
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-month operator- (const month& __lhs, const months& __rhs) noexcept
-{ return __lhs + -__rhs; }
+_LIBCPP_HIDE_FROM_ABI inline constexpr month operator-(const month& __lhs, const months& __rhs) noexcept {
+ return __lhs + -__rhs;
+}
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-months operator-(const month& __lhs, const month& __rhs) noexcept
-{
- auto const __dm = static_cast<unsigned>(__lhs) - static_cast<unsigned>(__rhs);
- return months(__dm <= 11 ? __dm : __dm + 12);
+_LIBCPP_HIDE_FROM_ABI inline constexpr months operator-(const month& __lhs, const month& __rhs) noexcept {
+ auto const __dm = static_cast<unsigned>(__lhs) - static_cast<unsigned>(__rhs);
+ return months(__dm <= 11 ? __dm : __dm + 12);
}
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-month& month::operator+=(const months& __dm) noexcept
-{ *this = *this + __dm; return *this; }
+_LIBCPP_HIDE_FROM_ABI inline constexpr month& month::operator+=(const months& __dm) noexcept {
+ *this = *this + __dm;
+ return *this;
+}
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-month& month::operator-=(const months& __dm) noexcept
-{ *this = *this - __dm; return *this; }
+_LIBCPP_HIDE_FROM_ABI inline constexpr month& month::operator-=(const months& __dm) noexcept {
+ *this = *this - __dm;
+ return *this;
+}
inline constexpr month January{1};
inline constexpr month February{2};
diff --git a/contrib/llvm-project/libcxx/include/__chrono/month_weekday.h b/contrib/llvm-project/libcxx/include/__chrono/month_weekday.h
index eb9e42d01f85..791987965521 100644
--- a/contrib/llvm-project/libcxx/include/__chrono/month_weekday.h
+++ b/contrib/llvm-project/libcxx/include/__chrono/month_weekday.h
@@ -22,72 +22,80 @@
_LIBCPP_BEGIN_NAMESPACE_STD
-namespace chrono
-{
+namespace chrono {
class month_weekday {
private:
- chrono::month __m_;
- chrono::weekday_indexed __wdi_;
+ chrono::month __m_;
+ chrono::weekday_indexed __wdi_;
+
public:
- _LIBCPP_HIDE_FROM_ABI constexpr month_weekday(const chrono::month& __mval, const chrono::weekday_indexed& __wdival) noexcept
- : __m_{__mval}, __wdi_{__wdival} {}
- _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::month month() const noexcept { return __m_; }
- _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::weekday_indexed weekday_indexed() const noexcept { return __wdi_; }
- _LIBCPP_HIDE_FROM_ABI inline constexpr bool ok() const noexcept { return __m_.ok() && __wdi_.ok(); }
+ _LIBCPP_HIDE_FROM_ABI constexpr month_weekday(const chrono::month& __mval,
+ const chrono::weekday_indexed& __wdival) noexcept
+ : __m_{__mval}, __wdi_{__wdival} {}
+ _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::month month() const noexcept { return __m_; }
+ _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::weekday_indexed weekday_indexed() const noexcept { return __wdi_; }
+ _LIBCPP_HIDE_FROM_ABI inline constexpr bool ok() const noexcept { return __m_.ok() && __wdi_.ok(); }
};
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-bool operator==(const month_weekday& __lhs, const month_weekday& __rhs) noexcept
-{ return __lhs.month() == __rhs.month() && __lhs.weekday_indexed() == __rhs.weekday_indexed(); }
-
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-month_weekday operator/(const month& __lhs, const weekday_indexed& __rhs) noexcept
-{ return month_weekday{__lhs, __rhs}; }
+_LIBCPP_HIDE_FROM_ABI inline constexpr bool
+operator==(const month_weekday& __lhs, const month_weekday& __rhs) noexcept {
+ return __lhs.month() == __rhs.month() && __lhs.weekday_indexed() == __rhs.weekday_indexed();
+}
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-month_weekday operator/(int __lhs, const weekday_indexed& __rhs) noexcept
-{ return month_weekday{month(__lhs), __rhs}; }
+_LIBCPP_HIDE_FROM_ABI inline constexpr month_weekday
+operator/(const month& __lhs, const weekday_indexed& __rhs) noexcept {
+ return month_weekday{__lhs, __rhs};
+}
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-month_weekday operator/(const weekday_indexed& __lhs, const month& __rhs) noexcept
-{ return month_weekday{__rhs, __lhs}; }
+_LIBCPP_HIDE_FROM_ABI inline constexpr month_weekday operator/(int __lhs, const weekday_indexed& __rhs) noexcept {
+ return month_weekday{month(__lhs), __rhs};
+}
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-month_weekday operator/(const weekday_indexed& __lhs, int __rhs) noexcept
-{ return month_weekday{month(__rhs), __lhs}; }
+_LIBCPP_HIDE_FROM_ABI inline constexpr month_weekday
+operator/(const weekday_indexed& __lhs, const month& __rhs) noexcept {
+ return month_weekday{__rhs, __lhs};
+}
+_LIBCPP_HIDE_FROM_ABI inline constexpr month_weekday operator/(const weekday_indexed& __lhs, int __rhs) noexcept {
+ return month_weekday{month(__rhs), __lhs};
+}
class month_weekday_last {
- chrono::month __m_;
- chrono::weekday_last __wdl_;
- public:
- _LIBCPP_HIDE_FROM_ABI constexpr month_weekday_last(const chrono::month& __mval, const chrono::weekday_last& __wdlval) noexcept
- : __m_{__mval}, __wdl_{__wdlval} {}
- _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::month month() const noexcept { return __m_; }
- _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::weekday_last weekday_last() const noexcept { return __wdl_; }
- _LIBCPP_HIDE_FROM_ABI inline constexpr bool ok() const noexcept { return __m_.ok() && __wdl_.ok(); }
+ chrono::month __m_;
+ chrono::weekday_last __wdl_;
+
+public:
+ _LIBCPP_HIDE_FROM_ABI constexpr month_weekday_last(const chrono::month& __mval,
+ const chrono::weekday_last& __wdlval) noexcept
+ : __m_{__mval}, __wdl_{__wdlval} {}
+ _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::month month() const noexcept { return __m_; }
+ _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::weekday_last weekday_last() const noexcept { return __wdl_; }
+ _LIBCPP_HIDE_FROM_ABI inline constexpr bool ok() const noexcept { return __m_.ok() && __wdl_.ok(); }
};
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-bool operator==(const month_weekday_last& __lhs, const month_weekday_last& __rhs) noexcept
-{ return __lhs.month() == __rhs.month() && __lhs.weekday_last() == __rhs.weekday_last(); }
+_LIBCPP_HIDE_FROM_ABI inline constexpr bool
+operator==(const month_weekday_last& __lhs, const month_weekday_last& __rhs) noexcept {
+ return __lhs.month() == __rhs.month() && __lhs.weekday_last() == __rhs.weekday_last();
+}
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-month_weekday_last operator/(const month& __lhs, const weekday_last& __rhs) noexcept
-{ return month_weekday_last{__lhs, __rhs}; }
+_LIBCPP_HIDE_FROM_ABI inline constexpr month_weekday_last
+operator/(const month& __lhs, const weekday_last& __rhs) noexcept {
+ return month_weekday_last{__lhs, __rhs};
+}
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-month_weekday_last operator/(int __lhs, const weekday_last& __rhs) noexcept
-{ return month_weekday_last{month(__lhs), __rhs}; }
+_LIBCPP_HIDE_FROM_ABI inline constexpr month_weekday_last operator/(int __lhs, const weekday_last& __rhs) noexcept {
+ return month_weekday_last{month(__lhs), __rhs};
+}
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-month_weekday_last operator/(const weekday_last& __lhs, const month& __rhs) noexcept
-{ return month_weekday_last{__rhs, __lhs}; }
+_LIBCPP_HIDE_FROM_ABI inline constexpr month_weekday_last
+operator/(const weekday_last& __lhs, const month& __rhs) noexcept {
+ return month_weekday_last{__rhs, __lhs};
+}
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-month_weekday_last operator/(const weekday_last& __lhs, int __rhs) noexcept
-{ return month_weekday_last{month(__rhs), __lhs}; }
+_LIBCPP_HIDE_FROM_ABI inline constexpr month_weekday_last operator/(const weekday_last& __lhs, int __rhs) noexcept {
+ return month_weekday_last{month(__rhs), __lhs};
+}
} // namespace chrono
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__chrono/monthday.h b/contrib/llvm-project/libcxx/include/__chrono/monthday.h
index 8403d9ec4eeb..a89d16e51861 100644
--- a/contrib/llvm-project/libcxx/include/__chrono/monthday.h
+++ b/contrib/llvm-project/libcxx/include/__chrono/monthday.h
@@ -24,101 +24,105 @@
_LIBCPP_BEGIN_NAMESPACE_STD
-namespace chrono
-{
+namespace chrono {
class month_day {
private:
- chrono::month __m_;
- chrono::day __d_;
+ chrono::month __m_;
+ chrono::day __d_;
+
public:
- month_day() = default;
- _LIBCPP_HIDE_FROM_ABI constexpr month_day(const chrono::month& __mval, const chrono::day& __dval) noexcept
- : __m_{__mval}, __d_{__dval} {}
- _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::month month() const noexcept { return __m_; }
- _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::day day() const noexcept { return __d_; }
- _LIBCPP_HIDE_FROM_ABI constexpr bool ok() const noexcept;
+ month_day() = default;
+ _LIBCPP_HIDE_FROM_ABI constexpr month_day(const chrono::month& __mval, const chrono::day& __dval) noexcept
+ : __m_{__mval}, __d_{__dval} {}
+ _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::month month() const noexcept { return __m_; }
+ _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::day day() const noexcept { return __d_; }
+ _LIBCPP_HIDE_FROM_ABI constexpr bool ok() const noexcept;
};
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-bool month_day::ok() const noexcept
-{
- if (!__m_.ok()) return false;
- const unsigned __dval = static_cast<unsigned>(__d_);
- if (__dval < 1 || __dval > 31) return false;
- if (__dval <= 29) return true;
-// Now we've got either 30 or 31
- const unsigned __mval = static_cast<unsigned>(__m_);
- if (__mval == 2) return false;
- if (__mval == 4 || __mval == 6 || __mval == 9 || __mval == 11)
- return __dval == 30;
+_LIBCPP_HIDE_FROM_ABI inline constexpr bool month_day::ok() const noexcept {
+ if (!__m_.ok())
+ return false;
+ const unsigned __dval = static_cast<unsigned>(__d_);
+ if (__dval < 1 || __dval > 31)
+ return false;
+ if (__dval <= 29)
return true;
+ // Now we've got either 30 or 31
+ const unsigned __mval = static_cast<unsigned>(__m_);
+ if (__mval == 2)
+ return false;
+ if (__mval == 4 || __mval == 6 || __mval == 9 || __mval == 11)
+ return __dval == 30;
+ return true;
}
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-bool operator==(const month_day& __lhs, const month_day& __rhs) noexcept
-{ return __lhs.month() == __rhs.month() && __lhs.day() == __rhs.day(); }
+_LIBCPP_HIDE_FROM_ABI inline constexpr bool operator==(const month_day& __lhs, const month_day& __rhs) noexcept {
+ return __lhs.month() == __rhs.month() && __lhs.day() == __rhs.day();
+}
-_LIBCPP_HIDE_FROM_ABI inline constexpr strong_ordering operator<=>(const month_day& __lhs, const month_day& __rhs) noexcept {
- if (auto __c = __lhs.month() <=> __rhs.month(); __c != 0)
- return __c;
- return __lhs.day() <=> __rhs.day();
+_LIBCPP_HIDE_FROM_ABI inline constexpr strong_ordering
+operator<=>(const month_day& __lhs, const month_day& __rhs) noexcept {
+ if (auto __c = __lhs.month() <=> __rhs.month(); __c != 0)
+ return __c;
+ return __lhs.day() <=> __rhs.day();
}
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-month_day operator/(const month& __lhs, const day& __rhs) noexcept
-{ return month_day{__lhs, __rhs}; }
+_LIBCPP_HIDE_FROM_ABI inline constexpr month_day operator/(const month& __lhs, const day& __rhs) noexcept {
+ return month_day{__lhs, __rhs};
+}
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-month_day operator/(const day& __lhs, const month& __rhs) noexcept
-{ return __rhs / __lhs; }
+_LIBCPP_HIDE_FROM_ABI inline constexpr month_day operator/(const day& __lhs, const month& __rhs) noexcept {
+ return __rhs / __lhs;
+}
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-month_day operator/(const month& __lhs, int __rhs) noexcept
-{ return __lhs / day(__rhs); }
+_LIBCPP_HIDE_FROM_ABI inline constexpr month_day operator/(const month& __lhs, int __rhs) noexcept {
+ return __lhs / day(__rhs);
+}
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-month_day operator/(int __lhs, const day& __rhs) noexcept
-{ return month(__lhs) / __rhs; }
+_LIBCPP_HIDE_FROM_ABI inline constexpr month_day operator/(int __lhs, const day& __rhs) noexcept {
+ return month(__lhs) / __rhs;
+}
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-month_day operator/(const day& __lhs, int __rhs) noexcept
-{ return month(__rhs) / __lhs; }
+_LIBCPP_HIDE_FROM_ABI inline constexpr month_day operator/(const day& __lhs, int __rhs) noexcept {
+ return month(__rhs) / __lhs;
+}
class month_day_last {
private:
- chrono::month __m_;
+ chrono::month __m_;
+
public:
- _LIBCPP_HIDE_FROM_ABI explicit constexpr month_day_last(const chrono::month& __val) noexcept
- : __m_{__val} {}
- _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::month month() const noexcept { return __m_; }
- _LIBCPP_HIDE_FROM_ABI inline constexpr bool ok() const noexcept { return __m_.ok(); }
+ _LIBCPP_HIDE_FROM_ABI explicit constexpr month_day_last(const chrono::month& __val) noexcept : __m_{__val} {}
+ _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::month month() const noexcept { return __m_; }
+ _LIBCPP_HIDE_FROM_ABI inline constexpr bool ok() const noexcept { return __m_.ok(); }
};
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-bool operator==(const month_day_last& __lhs, const month_day_last& __rhs) noexcept
-{ return __lhs.month() == __rhs.month(); }
+_LIBCPP_HIDE_FROM_ABI inline constexpr bool
+operator==(const month_day_last& __lhs, const month_day_last& __rhs) noexcept {
+ return __lhs.month() == __rhs.month();
+}
_LIBCPP_HIDE_FROM_ABI inline constexpr strong_ordering
operator<=>(const month_day_last& __lhs, const month_day_last& __rhs) noexcept {
- return __lhs.month() <=> __rhs.month();
+ return __lhs.month() <=> __rhs.month();
}
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-month_day_last operator/(const month& __lhs, last_spec) noexcept
-{ return month_day_last{__lhs}; }
+_LIBCPP_HIDE_FROM_ABI inline constexpr month_day_last operator/(const month& __lhs, last_spec) noexcept {
+ return month_day_last{__lhs};
+}
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-month_day_last operator/(last_spec, const month& __rhs) noexcept
-{ return month_day_last{__rhs}; }
+_LIBCPP_HIDE_FROM_ABI inline constexpr month_day_last operator/(last_spec, const month& __rhs) noexcept {
+ return month_day_last{__rhs};
+}
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-month_day_last operator/(int __lhs, last_spec) noexcept
-{ return month_day_last{month(__lhs)}; }
+_LIBCPP_HIDE_FROM_ABI inline constexpr month_day_last operator/(int __lhs, last_spec) noexcept {
+ return month_day_last{month(__lhs)};
+}
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-month_day_last operator/(last_spec, int __rhs) noexcept
-{ return month_day_last{month(__rhs)}; }
+_LIBCPP_HIDE_FROM_ABI inline constexpr month_day_last operator/(last_spec, int __rhs) noexcept {
+ return month_day_last{month(__rhs)};
+}
} // namespace chrono
diff --git a/contrib/llvm-project/libcxx/include/__chrono/steady_clock.h b/contrib/llvm-project/libcxx/include/__chrono/steady_clock.h
index cdcd2fa0d970..612a7f156e63 100644
--- a/contrib/llvm-project/libcxx/include/__chrono/steady_clock.h
+++ b/contrib/llvm-project/libcxx/include/__chrono/steady_clock.h
@@ -20,20 +20,18 @@
_LIBCPP_BEGIN_NAMESPACE_STD
-namespace chrono
-{
+namespace chrono {
#ifndef _LIBCPP_HAS_NO_MONOTONIC_CLOCK
-class _LIBCPP_EXPORTED_FROM_ABI steady_clock
-{
+class _LIBCPP_EXPORTED_FROM_ABI steady_clock {
public:
- typedef nanoseconds duration;
- typedef duration::rep rep;
- typedef duration::period period;
- typedef chrono::time_point<steady_clock, duration> time_point;
- static _LIBCPP_CONSTEXPR_SINCE_CXX14 const bool is_steady = true;
+ typedef nanoseconds duration;
+ typedef duration::rep rep;
+ typedef duration::period period;
+ typedef chrono::time_point<steady_clock, duration> time_point;
+ static _LIBCPP_CONSTEXPR_SINCE_CXX14 const bool is_steady = true;
- static time_point now() _NOEXCEPT;
+ static time_point now() _NOEXCEPT;
};
#endif
diff --git a/contrib/llvm-project/libcxx/include/__chrono/system_clock.h b/contrib/llvm-project/libcxx/include/__chrono/system_clock.h
index 06fe071df2b6..5a9eb65bdae7 100644
--- a/contrib/llvm-project/libcxx/include/__chrono/system_clock.h
+++ b/contrib/llvm-project/libcxx/include/__chrono/system_clock.h
@@ -21,21 +21,19 @@
_LIBCPP_BEGIN_NAMESPACE_STD
-namespace chrono
-{
+namespace chrono {
-class _LIBCPP_EXPORTED_FROM_ABI system_clock
-{
+class _LIBCPP_EXPORTED_FROM_ABI system_clock {
public:
- typedef microseconds duration;
- typedef duration::rep rep;
- typedef duration::period period;
- typedef chrono::time_point<system_clock> time_point;
- static _LIBCPP_CONSTEXPR_SINCE_CXX14 const bool is_steady = false;
-
- static time_point now() _NOEXCEPT;
- static time_t to_time_t (const time_point& __t) _NOEXCEPT;
- static time_point from_time_t(time_t __t) _NOEXCEPT;
+ typedef microseconds duration;
+ typedef duration::rep rep;
+ typedef duration::period period;
+ typedef chrono::time_point<system_clock> time_point;
+ static _LIBCPP_CONSTEXPR_SINCE_CXX14 const bool is_steady = false;
+
+ static time_point now() _NOEXCEPT;
+ static time_t to_time_t(const time_point& __t) _NOEXCEPT;
+ static time_point from_time_t(time_t __t) _NOEXCEPT;
};
#if _LIBCPP_STD_VER >= 20
diff --git a/contrib/llvm-project/libcxx/include/__chrono/time_point.h b/contrib/llvm-project/libcxx/include/__chrono/time_point.h
index 5060d9b55539..e65253ddb98e 100644
--- a/contrib/llvm-project/libcxx/include/__chrono/time_point.h
+++ b/contrib/llvm-project/libcxx/include/__chrono/time_point.h
@@ -28,108 +28,99 @@ _LIBCPP_PUSH_MACROS
_LIBCPP_BEGIN_NAMESPACE_STD
-namespace chrono
-{
+namespace chrono {
template <class _Clock, class _Duration = typename _Clock::duration>
-class _LIBCPP_TEMPLATE_VIS time_point
-{
- static_assert(__is_duration<_Duration>::value,
- "Second template parameter of time_point must be a std::chrono::duration");
+class _LIBCPP_TEMPLATE_VIS time_point {
+ static_assert(__is_duration<_Duration>::value,
+ "Second template parameter of time_point must be a std::chrono::duration");
+
public:
- typedef _Clock clock;
- typedef _Duration duration;
- typedef typename duration::rep rep;
- typedef typename duration::period period;
+ typedef _Clock clock;
+ typedef _Duration duration;
+ typedef typename duration::rep rep;
+ typedef typename duration::period period;
+
private:
- duration __d_;
+ duration __d_;
public:
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 time_point() : __d_(duration::zero()) {}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 explicit time_point(const duration& __d) : __d_(__d) {}
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 time_point() : __d_(duration::zero()) {}
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 explicit time_point(const duration& __d) : __d_(__d) {}
- // conversions
- template <class _Duration2, __enable_if_t<is_convertible<_Duration2, duration>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
- time_point(const time_point<clock, _Duration2>& __t)
- : __d_(__t.time_since_epoch()) {}
+ // conversions
+ template <class _Duration2, __enable_if_t<is_convertible<_Duration2, duration>::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 time_point(const time_point<clock, _Duration2>& __t)
+ : __d_(__t.time_since_epoch()) {}
- // observer
+ // observer
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 duration time_since_epoch() const {return __d_;}
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 duration time_since_epoch() const { return __d_; }
- // arithmetic
+ // arithmetic
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 time_point& operator+=(const duration& __d) {__d_ += __d; return *this;}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 time_point& operator-=(const duration& __d) {__d_ -= __d; return *this;}
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 time_point& operator+=(const duration& __d) {
+ __d_ += __d;
+ return *this;
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 time_point& operator-=(const duration& __d) {
+ __d_ -= __d;
+ return *this;
+ }
- // special values
+ // special values
- _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR time_point min() _NOEXCEPT {return time_point(duration::min());}
- _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR time_point max() _NOEXCEPT {return time_point(duration::max());}
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR time_point min() _NOEXCEPT { return time_point(duration::min()); }
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR time_point max() _NOEXCEPT { return time_point(duration::max()); }
};
} // namespace chrono
template <class _Clock, class _Duration1, class _Duration2>
-struct _LIBCPP_TEMPLATE_VIS common_type<chrono::time_point<_Clock, _Duration1>,
- chrono::time_point<_Clock, _Duration2> >
-{
- typedef chrono::time_point<_Clock, typename common_type<_Duration1, _Duration2>::type> type;
+struct _LIBCPP_TEMPLATE_VIS
+ common_type<chrono::time_point<_Clock, _Duration1>, chrono::time_point<_Clock, _Duration2> > {
+ typedef chrono::time_point<_Clock, typename common_type<_Duration1, _Duration2>::type> type;
};
namespace chrono {
template <class _ToDuration, class _Clock, class _Duration>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
-time_point<_Clock, _ToDuration>
-time_point_cast(const time_point<_Clock, _Duration>& __t)
-{
- return time_point<_Clock, _ToDuration>(chrono::duration_cast<_ToDuration>(__t.time_since_epoch()));
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 time_point<_Clock, _ToDuration>
+time_point_cast(const time_point<_Clock, _Duration>& __t) {
+ return time_point<_Clock, _ToDuration>(chrono::duration_cast<_ToDuration>(__t.time_since_epoch()));
}
#if _LIBCPP_STD_VER >= 17
template <class _ToDuration, class _Clock, class _Duration, enable_if_t<__is_duration<_ToDuration>::value, int> = 0>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR
-time_point<_Clock, _ToDuration>
-floor(const time_point<_Clock, _Duration>& __t)
-{
- return time_point<_Clock, _ToDuration>{chrono::floor<_ToDuration>(__t.time_since_epoch())};
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR time_point<_Clock, _ToDuration>
+floor(const time_point<_Clock, _Duration>& __t) {
+ return time_point<_Clock, _ToDuration>{chrono::floor<_ToDuration>(__t.time_since_epoch())};
}
template <class _ToDuration, class _Clock, class _Duration, enable_if_t<__is_duration<_ToDuration>::value, int> = 0>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR
-time_point<_Clock, _ToDuration>
-ceil(const time_point<_Clock, _Duration>& __t)
-{
- return time_point<_Clock, _ToDuration>{chrono::ceil<_ToDuration>(__t.time_since_epoch())};
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR time_point<_Clock, _ToDuration>
+ceil(const time_point<_Clock, _Duration>& __t) {
+ return time_point<_Clock, _ToDuration>{chrono::ceil<_ToDuration>(__t.time_since_epoch())};
}
template <class _ToDuration, class _Clock, class _Duration, enable_if_t<__is_duration<_ToDuration>::value, int> = 0>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR
-time_point<_Clock, _ToDuration>
-round(const time_point<_Clock, _Duration>& __t)
-{
- return time_point<_Clock, _ToDuration>{chrono::round<_ToDuration>(__t.time_since_epoch())};
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR time_point<_Clock, _ToDuration>
+round(const time_point<_Clock, _Duration>& __t) {
+ return time_point<_Clock, _ToDuration>{chrono::round<_ToDuration>(__t.time_since_epoch())};
}
template <class _Rep, class _Period, enable_if_t<numeric_limits<_Rep>::is_signed, int> = 0>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR
-duration<_Rep, _Period>
-abs(duration<_Rep, _Period> __d)
-{
- return __d >= __d.zero() ? +__d : -__d;
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR duration<_Rep, _Period> abs(duration<_Rep, _Period> __d) {
+ return __d >= __d.zero() ? +__d : -__d;
}
#endif // _LIBCPP_STD_VER >= 17
// time_point ==
template <class _Clock, class _Duration1, class _Duration2>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
-bool
-operator==(const time_point<_Clock, _Duration1>& __lhs, const time_point<_Clock, _Duration2>& __rhs)
-{
- return __lhs.time_since_epoch() == __rhs.time_since_epoch();
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 bool
+operator==(const time_point<_Clock, _Duration1>& __lhs, const time_point<_Clock, _Duration2>& __rhs) {
+ return __lhs.time_since_epoch() == __rhs.time_since_epoch();
}
#if _LIBCPP_STD_VER <= 17
@@ -137,11 +128,9 @@ operator==(const time_point<_Clock, _Duration1>& __lhs, const time_point<_Clock,
// time_point !=
template <class _Clock, class _Duration1, class _Duration2>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
-bool
-operator!=(const time_point<_Clock, _Duration1>& __lhs, const time_point<_Clock, _Duration2>& __rhs)
-{
- return !(__lhs == __rhs);
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 bool
+operator!=(const time_point<_Clock, _Duration1>& __lhs, const time_point<_Clock, _Duration2>& __rhs) {
+ return !(__lhs == __rhs);
}
#endif // _LIBCPP_STD_VER <= 17
@@ -149,41 +138,33 @@ operator!=(const time_point<_Clock, _Duration1>& __lhs, const time_point<_Clock,
// time_point <
template <class _Clock, class _Duration1, class _Duration2>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
-bool
-operator<(const time_point<_Clock, _Duration1>& __lhs, const time_point<_Clock, _Duration2>& __rhs)
-{
- return __lhs.time_since_epoch() < __rhs.time_since_epoch();
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 bool
+operator<(const time_point<_Clock, _Duration1>& __lhs, const time_point<_Clock, _Duration2>& __rhs) {
+ return __lhs.time_since_epoch() < __rhs.time_since_epoch();
}
// time_point >
template <class _Clock, class _Duration1, class _Duration2>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
-bool
-operator>(const time_point<_Clock, _Duration1>& __lhs, const time_point<_Clock, _Duration2>& __rhs)
-{
- return __rhs < __lhs;
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 bool
+operator>(const time_point<_Clock, _Duration1>& __lhs, const time_point<_Clock, _Duration2>& __rhs) {
+ return __rhs < __lhs;
}
// time_point <=
template <class _Clock, class _Duration1, class _Duration2>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
-bool
-operator<=(const time_point<_Clock, _Duration1>& __lhs, const time_point<_Clock, _Duration2>& __rhs)
-{
- return !(__rhs < __lhs);
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 bool
+operator<=(const time_point<_Clock, _Duration1>& __lhs, const time_point<_Clock, _Duration2>& __rhs) {
+ return !(__rhs < __lhs);
}
// time_point >=
template <class _Clock, class _Duration1, class _Duration2>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
-bool
-operator>=(const time_point<_Clock, _Duration1>& __lhs, const time_point<_Clock, _Duration2>& __rhs)
-{
- return !(__lhs < __rhs);
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 bool
+operator>=(const time_point<_Clock, _Duration1>& __lhs, const time_point<_Clock, _Duration2>& __rhs) {
+ return !(__lhs < __rhs);
}
#if _LIBCPP_STD_VER >= 20
@@ -191,7 +172,7 @@ operator>=(const time_point<_Clock, _Duration1>& __lhs, const time_point<_Clock,
template <class _Clock, class _Duration1, three_way_comparable_with<_Duration1> _Duration2>
_LIBCPP_HIDE_FROM_ABI constexpr auto
operator<=>(const time_point<_Clock, _Duration1>& __lhs, const time_point<_Clock, _Duration2>& __rhs) {
- return __lhs.time_since_epoch() <=> __rhs.time_since_epoch();
+ return __lhs.time_since_epoch() <=> __rhs.time_since_epoch();
}
#endif // _LIBCPP_STD_VER >= 20
@@ -200,42 +181,37 @@ operator<=>(const time_point<_Clock, _Duration1>& __lhs, const time_point<_Clock
template <class _Clock, class _Duration1, class _Rep2, class _Period2>
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
-time_point<_Clock, typename common_type<_Duration1, duration<_Rep2, _Period2> >::type>
-operator+(const time_point<_Clock, _Duration1>& __lhs, const duration<_Rep2, _Period2>& __rhs)
-{
- typedef time_point<_Clock, typename common_type<_Duration1, duration<_Rep2, _Period2> >::type> _Tr;
- return _Tr (__lhs.time_since_epoch() + __rhs);
+ time_point<_Clock, typename common_type<_Duration1, duration<_Rep2, _Period2> >::type>
+ operator+(const time_point<_Clock, _Duration1>& __lhs, const duration<_Rep2, _Period2>& __rhs) {
+ typedef time_point<_Clock, typename common_type<_Duration1, duration<_Rep2, _Period2> >::type> _Tr;
+ return _Tr(__lhs.time_since_epoch() + __rhs);
}
// time_point operator+(duration x, time_point y);
template <class _Rep1, class _Period1, class _Clock, class _Duration2>
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
-time_point<_Clock, typename common_type<duration<_Rep1, _Period1>, _Duration2>::type>
-operator+(const duration<_Rep1, _Period1>& __lhs, const time_point<_Clock, _Duration2>& __rhs)
-{
- return __rhs + __lhs;
+ time_point<_Clock, typename common_type<duration<_Rep1, _Period1>, _Duration2>::type>
+ operator+(const duration<_Rep1, _Period1>& __lhs, const time_point<_Clock, _Duration2>& __rhs) {
+ return __rhs + __lhs;
}
// time_point operator-(time_point x, duration y);
template <class _Clock, class _Duration1, class _Rep2, class _Period2>
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
-time_point<_Clock, typename common_type<_Duration1, duration<_Rep2, _Period2> >::type>
-operator-(const time_point<_Clock, _Duration1>& __lhs, const duration<_Rep2, _Period2>& __rhs)
-{
- typedef time_point<_Clock, typename common_type<_Duration1, duration<_Rep2, _Period2> >::type> _Ret;
- return _Ret(__lhs.time_since_epoch() -__rhs);
+ time_point<_Clock, typename common_type<_Duration1, duration<_Rep2, _Period2> >::type>
+ operator-(const time_point<_Clock, _Duration1>& __lhs, const duration<_Rep2, _Period2>& __rhs) {
+ typedef time_point<_Clock, typename common_type<_Duration1, duration<_Rep2, _Period2> >::type> _Ret;
+ return _Ret(__lhs.time_since_epoch() - __rhs);
}
// duration operator-(time_point x, time_point y);
template <class _Clock, class _Duration1, class _Duration2>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
-typename common_type<_Duration1, _Duration2>::type
-operator-(const time_point<_Clock, _Duration1>& __lhs, const time_point<_Clock, _Duration2>& __rhs)
-{
- return __lhs.time_since_epoch() - __rhs.time_since_epoch();
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 typename common_type<_Duration1, _Duration2>::type
+operator-(const time_point<_Clock, _Duration1>& __lhs, const time_point<_Clock, _Duration2>& __rhs) {
+ return __lhs.time_since_epoch() - __rhs.time_since_epoch();
}
} // namespace chrono
diff --git a/contrib/llvm-project/libcxx/include/__chrono/weekday.h b/contrib/llvm-project/libcxx/include/__chrono/weekday.h
index 292fcb40dc30..5a7dedc6e3a1 100644
--- a/contrib/llvm-project/libcxx/include/__chrono/weekday.h
+++ b/contrib/llvm-project/libcxx/include/__chrono/weekday.h
@@ -24,144 +24,155 @@
_LIBCPP_BEGIN_NAMESPACE_STD
-namespace chrono
-{
+namespace chrono {
class weekday_indexed;
class weekday_last;
class weekday {
private:
- unsigned char __wd_;
- _LIBCPP_HIDE_FROM_ABI static constexpr unsigned char __weekday_from_days(int __days) noexcept;
+ unsigned char __wd_;
+ _LIBCPP_HIDE_FROM_ABI static constexpr unsigned char __weekday_from_days(int __days) noexcept;
+
public:
weekday() = default;
- _LIBCPP_HIDE_FROM_ABI inline explicit constexpr weekday(unsigned __val) noexcept : __wd_(static_cast<unsigned char>(__val == 7 ? 0 : __val)) {}
- _LIBCPP_HIDE_FROM_ABI inline constexpr weekday(const sys_days& __sysd) noexcept
- : __wd_(__weekday_from_days(__sysd.time_since_epoch().count())) {}
+ _LIBCPP_HIDE_FROM_ABI inline explicit constexpr weekday(unsigned __val) noexcept
+ : __wd_(static_cast<unsigned char>(__val == 7 ? 0 : __val)) {}
+ _LIBCPP_HIDE_FROM_ABI inline constexpr weekday(const sys_days& __sysd) noexcept
+ : __wd_(__weekday_from_days(__sysd.time_since_epoch().count())) {}
_LIBCPP_HIDE_FROM_ABI inline explicit constexpr weekday(const local_days& __locd) noexcept
- : __wd_(__weekday_from_days(__locd.time_since_epoch().count())) {}
-
- _LIBCPP_HIDE_FROM_ABI inline constexpr weekday& operator++() noexcept { __wd_ = (__wd_ == 6 ? 0 : __wd_ + 1); return *this; }
- _LIBCPP_HIDE_FROM_ABI inline constexpr weekday operator++(int) noexcept { weekday __tmp = *this; ++(*this); return __tmp; }
- _LIBCPP_HIDE_FROM_ABI inline constexpr weekday& operator--() noexcept { __wd_ = (__wd_ == 0 ? 6 : __wd_ - 1); return *this; }
- _LIBCPP_HIDE_FROM_ABI inline constexpr weekday operator--(int) noexcept { weekday __tmp = *this; --(*this); return __tmp; }
- _LIBCPP_HIDE_FROM_ABI constexpr weekday& operator+=(const days& __dd) noexcept;
- _LIBCPP_HIDE_FROM_ABI constexpr weekday& operator-=(const days& __dd) noexcept;
- _LIBCPP_HIDE_FROM_ABI inline constexpr unsigned c_encoding() const noexcept { return __wd_; }
+ : __wd_(__weekday_from_days(__locd.time_since_epoch().count())) {}
+
+ _LIBCPP_HIDE_FROM_ABI inline constexpr weekday& operator++() noexcept {
+ __wd_ = (__wd_ == 6 ? 0 : __wd_ + 1);
+ return *this;
+ }
+ _LIBCPP_HIDE_FROM_ABI inline constexpr weekday operator++(int) noexcept {
+ weekday __tmp = *this;
+ ++(*this);
+ return __tmp;
+ }
+ _LIBCPP_HIDE_FROM_ABI inline constexpr weekday& operator--() noexcept {
+ __wd_ = (__wd_ == 0 ? 6 : __wd_ - 1);
+ return *this;
+ }
+ _LIBCPP_HIDE_FROM_ABI inline constexpr weekday operator--(int) noexcept {
+ weekday __tmp = *this;
+ --(*this);
+ return __tmp;
+ }
+ _LIBCPP_HIDE_FROM_ABI constexpr weekday& operator+=(const days& __dd) noexcept;
+ _LIBCPP_HIDE_FROM_ABI constexpr weekday& operator-=(const days& __dd) noexcept;
+ _LIBCPP_HIDE_FROM_ABI inline constexpr unsigned c_encoding() const noexcept { return __wd_; }
_LIBCPP_HIDE_FROM_ABI inline constexpr unsigned iso_encoding() const noexcept { return __wd_ == 0u ? 7 : __wd_; }
_LIBCPP_HIDE_FROM_ABI inline constexpr bool ok() const noexcept { return __wd_ <= 6; }
- _LIBCPP_HIDE_FROM_ABI constexpr weekday_indexed operator[](unsigned __index) const noexcept;
- _LIBCPP_HIDE_FROM_ABI constexpr weekday_last operator[](last_spec) const noexcept;
+ _LIBCPP_HIDE_FROM_ABI constexpr weekday_indexed operator[](unsigned __index) const noexcept;
+ _LIBCPP_HIDE_FROM_ABI constexpr weekday_last operator[](last_spec) const noexcept;
};
-
// https://howardhinnant.github.io/date_algorithms.html#weekday_from_days
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-unsigned char weekday::__weekday_from_days(int __days) noexcept
-{
- return static_cast<unsigned char>(
- static_cast<unsigned>(__days >= -4 ? (__days+4) % 7 : (__days+5) % 7 + 6)
- );
+_LIBCPP_HIDE_FROM_ABI inline constexpr unsigned char weekday::__weekday_from_days(int __days) noexcept {
+ return static_cast<unsigned char>(static_cast<unsigned>(__days >= -4 ? (__days + 4) % 7 : (__days + 5) % 7 + 6));
}
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-bool operator==(const weekday& __lhs, const weekday& __rhs) noexcept
-{ return __lhs.c_encoding() == __rhs.c_encoding(); }
+_LIBCPP_HIDE_FROM_ABI inline constexpr bool operator==(const weekday& __lhs, const weekday& __rhs) noexcept {
+ return __lhs.c_encoding() == __rhs.c_encoding();
+}
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-bool operator< (const weekday& __lhs, const weekday& __rhs) noexcept
-{ return __lhs.c_encoding() < __rhs.c_encoding(); }
+_LIBCPP_HIDE_FROM_ABI inline constexpr bool operator<(const weekday& __lhs, const weekday& __rhs) noexcept {
+ return __lhs.c_encoding() < __rhs.c_encoding();
+}
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-bool operator> (const weekday& __lhs, const weekday& __rhs) noexcept
-{ return __rhs < __lhs; }
+_LIBCPP_HIDE_FROM_ABI inline constexpr bool operator>(const weekday& __lhs, const weekday& __rhs) noexcept {
+ return __rhs < __lhs;
+}
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-bool operator<=(const weekday& __lhs, const weekday& __rhs) noexcept
-{ return !(__rhs < __lhs);}
+_LIBCPP_HIDE_FROM_ABI inline constexpr bool operator<=(const weekday& __lhs, const weekday& __rhs) noexcept {
+ return !(__rhs < __lhs);
+}
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-bool operator>=(const weekday& __lhs, const weekday& __rhs) noexcept
-{ return !(__lhs < __rhs); }
+_LIBCPP_HIDE_FROM_ABI inline constexpr bool operator>=(const weekday& __lhs, const weekday& __rhs) noexcept {
+ return !(__lhs < __rhs);
+}
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-weekday operator+(const weekday& __lhs, const days& __rhs) noexcept
-{
- auto const __mu = static_cast<long long>(__lhs.c_encoding()) + __rhs.count();
- auto const __yr = (__mu >= 0 ? __mu : __mu - 6) / 7;
- return weekday{static_cast<unsigned>(__mu - __yr * 7)};
+_LIBCPP_HIDE_FROM_ABI inline constexpr weekday operator+(const weekday& __lhs, const days& __rhs) noexcept {
+ auto const __mu = static_cast<long long>(__lhs.c_encoding()) + __rhs.count();
+ auto const __yr = (__mu >= 0 ? __mu : __mu - 6) / 7;
+ return weekday{static_cast<unsigned>(__mu - __yr * 7)};
}
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-weekday operator+(const days& __lhs, const weekday& __rhs) noexcept
-{ return __rhs + __lhs; }
+_LIBCPP_HIDE_FROM_ABI inline constexpr weekday operator+(const days& __lhs, const weekday& __rhs) noexcept {
+ return __rhs + __lhs;
+}
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-weekday operator-(const weekday& __lhs, const days& __rhs) noexcept
-{ return __lhs + -__rhs; }
+_LIBCPP_HIDE_FROM_ABI inline constexpr weekday operator-(const weekday& __lhs, const days& __rhs) noexcept {
+ return __lhs + -__rhs;
+}
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-days operator-(const weekday& __lhs, const weekday& __rhs) noexcept
-{
- const int __wdu = __lhs.c_encoding() - __rhs.c_encoding();
- const int __wk = (__wdu >= 0 ? __wdu : __wdu-6) / 7;
- return days{__wdu - __wk * 7};
+_LIBCPP_HIDE_FROM_ABI inline constexpr days operator-(const weekday& __lhs, const weekday& __rhs) noexcept {
+ const int __wdu = __lhs.c_encoding() - __rhs.c_encoding();
+ const int __wk = (__wdu >= 0 ? __wdu : __wdu - 6) / 7;
+ return days{__wdu - __wk * 7};
}
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-weekday& weekday::operator+=(const days& __dd) noexcept
-{ *this = *this + __dd; return *this; }
+_LIBCPP_HIDE_FROM_ABI inline constexpr weekday& weekday::operator+=(const days& __dd) noexcept {
+ *this = *this + __dd;
+ return *this;
+}
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-weekday& weekday::operator-=(const days& __dd) noexcept
-{ *this = *this - __dd; return *this; }
+_LIBCPP_HIDE_FROM_ABI inline constexpr weekday& weekday::operator-=(const days& __dd) noexcept {
+ *this = *this - __dd;
+ return *this;
+}
class weekday_indexed {
private:
- chrono::weekday __wd_;
- unsigned char __idx_;
+ chrono::weekday __wd_;
+ unsigned char __idx_;
+
public:
- weekday_indexed() = default;
- _LIBCPP_HIDE_FROM_ABI inline constexpr weekday_indexed(const chrono::weekday& __wdval, unsigned __idxval) noexcept
- : __wd_{__wdval}, __idx_(__idxval) {}
- _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::weekday weekday() const noexcept { return __wd_; }
- _LIBCPP_HIDE_FROM_ABI inline constexpr unsigned index() const noexcept { return __idx_; }
- _LIBCPP_HIDE_FROM_ABI inline constexpr bool ok() const noexcept { return __wd_.ok() && __idx_ >= 1 && __idx_ <= 5; }
+ weekday_indexed() = default;
+ _LIBCPP_HIDE_FROM_ABI inline constexpr weekday_indexed(const chrono::weekday& __wdval, unsigned __idxval) noexcept
+ : __wd_{__wdval}, __idx_(__idxval) {}
+ _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::weekday weekday() const noexcept { return __wd_; }
+ _LIBCPP_HIDE_FROM_ABI inline constexpr unsigned index() const noexcept { return __idx_; }
+ _LIBCPP_HIDE_FROM_ABI inline constexpr bool ok() const noexcept { return __wd_.ok() && __idx_ >= 1 && __idx_ <= 5; }
};
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-bool operator==(const weekday_indexed& __lhs, const weekday_indexed& __rhs) noexcept
-{ return __lhs.weekday() == __rhs.weekday() && __lhs.index() == __rhs.index(); }
+_LIBCPP_HIDE_FROM_ABI inline constexpr bool
+operator==(const weekday_indexed& __lhs, const weekday_indexed& __rhs) noexcept {
+ return __lhs.weekday() == __rhs.weekday() && __lhs.index() == __rhs.index();
+}
class weekday_last {
private:
- chrono::weekday __wd_;
+ chrono::weekday __wd_;
+
public:
- _LIBCPP_HIDE_FROM_ABI explicit constexpr weekday_last(const chrono::weekday& __val) noexcept
- : __wd_{__val} {}
- _LIBCPP_HIDE_FROM_ABI constexpr chrono::weekday weekday() const noexcept { return __wd_; }
- _LIBCPP_HIDE_FROM_ABI constexpr bool ok() const noexcept { return __wd_.ok(); }
+ _LIBCPP_HIDE_FROM_ABI explicit constexpr weekday_last(const chrono::weekday& __val) noexcept : __wd_{__val} {}
+ _LIBCPP_HIDE_FROM_ABI constexpr chrono::weekday weekday() const noexcept { return __wd_; }
+ _LIBCPP_HIDE_FROM_ABI constexpr bool ok() const noexcept { return __wd_.ok(); }
};
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-bool operator==(const weekday_last& __lhs, const weekday_last& __rhs) noexcept
-{ return __lhs.weekday() == __rhs.weekday(); }
-
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-weekday_indexed weekday::operator[](unsigned __index) const noexcept { return weekday_indexed{*this, __index}; }
+_LIBCPP_HIDE_FROM_ABI inline constexpr bool operator==(const weekday_last& __lhs, const weekday_last& __rhs) noexcept {
+ return __lhs.weekday() == __rhs.weekday();
+}
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-weekday_last weekday::operator[](last_spec) const noexcept { return weekday_last{*this}; }
+_LIBCPP_HIDE_FROM_ABI inline constexpr weekday_indexed weekday::operator[](unsigned __index) const noexcept {
+ return weekday_indexed{*this, __index};
+}
+_LIBCPP_HIDE_FROM_ABI inline constexpr weekday_last weekday::operator[](last_spec) const noexcept {
+ return weekday_last{*this};
+}
-inline constexpr weekday Sunday{0};
-inline constexpr weekday Monday{1};
-inline constexpr weekday Tuesday{2};
-inline constexpr weekday Wednesday{3};
-inline constexpr weekday Thursday{4};
-inline constexpr weekday Friday{5};
-inline constexpr weekday Saturday{6};
+inline constexpr weekday Sunday{0};
+inline constexpr weekday Monday{1};
+inline constexpr weekday Tuesday{2};
+inline constexpr weekday Wednesday{3};
+inline constexpr weekday Thursday{4};
+inline constexpr weekday Friday{5};
+inline constexpr weekday Saturday{6};
} // namespace chrono
diff --git a/contrib/llvm-project/libcxx/include/__chrono/year.h b/contrib/llvm-project/libcxx/include/__chrono/year.h
index 14bcbdafdd8a..1899d09f38db 100644
--- a/contrib/llvm-project/libcxx/include/__chrono/year.h
+++ b/contrib/llvm-project/libcxx/include/__chrono/year.h
@@ -26,65 +26,81 @@ _LIBCPP_PUSH_MACROS
_LIBCPP_BEGIN_NAMESPACE_STD
-namespace chrono
-{
+namespace chrono {
class year {
private:
- short __y_;
+ short __y_;
+
public:
- year() = default;
- _LIBCPP_HIDE_FROM_ABI explicit inline constexpr year(int __val) noexcept : __y_(static_cast<short>(__val)) {}
-
- _LIBCPP_HIDE_FROM_ABI inline constexpr year& operator++() noexcept { ++__y_; return *this; }
- _LIBCPP_HIDE_FROM_ABI inline constexpr year operator++(int) noexcept { year __tmp = *this; ++(*this); return __tmp; }
- _LIBCPP_HIDE_FROM_ABI inline constexpr year& operator--() noexcept { --__y_; return *this; }
- _LIBCPP_HIDE_FROM_ABI inline constexpr year operator--(int) noexcept { year __tmp = *this; --(*this); return __tmp; }
- _LIBCPP_HIDE_FROM_ABI constexpr year& operator+=(const years& __dy) noexcept;
- _LIBCPP_HIDE_FROM_ABI constexpr year& operator-=(const years& __dy) noexcept;
- _LIBCPP_HIDE_FROM_ABI inline constexpr year operator+() const noexcept { return *this; }
- _LIBCPP_HIDE_FROM_ABI inline constexpr year operator-() const noexcept { return year{-__y_}; }
-
- _LIBCPP_HIDE_FROM_ABI inline constexpr bool is_leap() const noexcept { return __y_ % 4 == 0 && (__y_ % 100 != 0 || __y_ % 400 == 0); }
- _LIBCPP_HIDE_FROM_ABI explicit inline constexpr operator int() const noexcept { return __y_; }
- _LIBCPP_HIDE_FROM_ABI constexpr bool ok() const noexcept;
- _LIBCPP_HIDE_FROM_ABI static inline constexpr year min() noexcept { return year{-32767}; }
- _LIBCPP_HIDE_FROM_ABI static inline constexpr year max() noexcept { return year{ 32767}; }
+ year() = default;
+ _LIBCPP_HIDE_FROM_ABI explicit inline constexpr year(int __val) noexcept : __y_(static_cast<short>(__val)) {}
+
+ _LIBCPP_HIDE_FROM_ABI inline constexpr year& operator++() noexcept {
+ ++__y_;
+ return *this;
+ }
+ _LIBCPP_HIDE_FROM_ABI inline constexpr year operator++(int) noexcept {
+ year __tmp = *this;
+ ++(*this);
+ return __tmp;
+ }
+ _LIBCPP_HIDE_FROM_ABI inline constexpr year& operator--() noexcept {
+ --__y_;
+ return *this;
+ }
+ _LIBCPP_HIDE_FROM_ABI inline constexpr year operator--(int) noexcept {
+ year __tmp = *this;
+ --(*this);
+ return __tmp;
+ }
+ _LIBCPP_HIDE_FROM_ABI constexpr year& operator+=(const years& __dy) noexcept;
+ _LIBCPP_HIDE_FROM_ABI constexpr year& operator-=(const years& __dy) noexcept;
+ _LIBCPP_HIDE_FROM_ABI inline constexpr year operator+() const noexcept { return *this; }
+ _LIBCPP_HIDE_FROM_ABI inline constexpr year operator-() const noexcept { return year{-__y_}; }
+
+ _LIBCPP_HIDE_FROM_ABI inline constexpr bool is_leap() const noexcept {
+ return __y_ % 4 == 0 && (__y_ % 100 != 0 || __y_ % 400 == 0);
+ }
+ _LIBCPP_HIDE_FROM_ABI explicit inline constexpr operator int() const noexcept { return __y_; }
+ _LIBCPP_HIDE_FROM_ABI constexpr bool ok() const noexcept;
+ _LIBCPP_HIDE_FROM_ABI static inline constexpr year min() noexcept { return year{-32767}; }
+ _LIBCPP_HIDE_FROM_ABI static inline constexpr year max() noexcept { return year{32767}; }
};
-
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-bool operator==(const year& __lhs, const year& __rhs) noexcept
-{ return static_cast<int>(__lhs) == static_cast<int>(__rhs); }
+_LIBCPP_HIDE_FROM_ABI inline constexpr bool operator==(const year& __lhs, const year& __rhs) noexcept {
+ return static_cast<int>(__lhs) == static_cast<int>(__rhs);
+}
_LIBCPP_HIDE_FROM_ABI constexpr strong_ordering operator<=>(const year& __lhs, const year& __rhs) noexcept {
- return static_cast<int>(__lhs) <=> static_cast<int>(__rhs);
+ return static_cast<int>(__lhs) <=> static_cast<int>(__rhs);
}
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-year operator+ (const year& __lhs, const years& __rhs) noexcept
-{ return year(static_cast<int>(__lhs) + __rhs.count()); }
-
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-year operator+ (const years& __lhs, const year& __rhs) noexcept
-{ return __rhs + __lhs; }
+_LIBCPP_HIDE_FROM_ABI inline constexpr year operator+(const year& __lhs, const years& __rhs) noexcept {
+ return year(static_cast<int>(__lhs) + __rhs.count());
+}
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-year operator- (const year& __lhs, const years& __rhs) noexcept
-{ return __lhs + -__rhs; }
+_LIBCPP_HIDE_FROM_ABI inline constexpr year operator+(const years& __lhs, const year& __rhs) noexcept {
+ return __rhs + __lhs;
+}
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-years operator-(const year& __lhs, const year& __rhs) noexcept
-{ return years{static_cast<int>(__lhs) - static_cast<int>(__rhs)}; }
+_LIBCPP_HIDE_FROM_ABI inline constexpr year operator-(const year& __lhs, const years& __rhs) noexcept {
+ return __lhs + -__rhs;
+}
+_LIBCPP_HIDE_FROM_ABI inline constexpr years operator-(const year& __lhs, const year& __rhs) noexcept {
+ return years{static_cast<int>(__lhs) - static_cast<int>(__rhs)};
+}
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-year& year::operator+=(const years& __dy) noexcept
-{ *this = *this + __dy; return *this; }
+_LIBCPP_HIDE_FROM_ABI inline constexpr year& year::operator+=(const years& __dy) noexcept {
+ *this = *this + __dy;
+ return *this;
+}
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-year& year::operator-=(const years& __dy) noexcept
-{ *this = *this - __dy; return *this; }
+_LIBCPP_HIDE_FROM_ABI inline constexpr year& year::operator-=(const years& __dy) noexcept {
+ *this = *this - __dy;
+ return *this;
+}
_LIBCPP_HIDE_FROM_ABI constexpr bool year::ok() const noexcept {
static_assert(static_cast<int>(std::numeric_limits<decltype(__y_)>::max()) == static_cast<int>(max()));
diff --git a/contrib/llvm-project/libcxx/include/__chrono/year_month.h b/contrib/llvm-project/libcxx/include/__chrono/year_month.h
index 320cf588ccd3..369ea38f7560 100644
--- a/contrib/llvm-project/libcxx/include/__chrono/year_month.h
+++ b/contrib/llvm-project/libcxx/include/__chrono/year_month.h
@@ -24,73 +24,75 @@
_LIBCPP_BEGIN_NAMESPACE_STD
-namespace chrono
-{
+namespace chrono {
class year_month {
- chrono::year __y_;
- chrono::month __m_;
+ chrono::year __y_;
+ chrono::month __m_;
+
public:
- year_month() = default;
- _LIBCPP_HIDE_FROM_ABI constexpr year_month(const chrono::year& __yval, const chrono::month& __mval) noexcept
- : __y_{__yval}, __m_{__mval} {}
- _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::year year() const noexcept { return __y_; }
- _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::month month() const noexcept { return __m_; }
- _LIBCPP_HIDE_FROM_ABI inline constexpr year_month& operator+=(const months& __dm) noexcept;
- _LIBCPP_HIDE_FROM_ABI inline constexpr year_month& operator-=(const months& __dm) noexcept;
- _LIBCPP_HIDE_FROM_ABI inline constexpr year_month& operator+=(const years& __dy) noexcept;
- _LIBCPP_HIDE_FROM_ABI inline constexpr year_month& operator-=(const years& __dy) noexcept;
- _LIBCPP_HIDE_FROM_ABI inline constexpr bool ok() const noexcept { return __y_.ok() && __m_.ok(); }
+ year_month() = default;
+ _LIBCPP_HIDE_FROM_ABI constexpr year_month(const chrono::year& __yval, const chrono::month& __mval) noexcept
+ : __y_{__yval}, __m_{__mval} {}
+ _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::year year() const noexcept { return __y_; }
+ _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::month month() const noexcept { return __m_; }
+ _LIBCPP_HIDE_FROM_ABI inline constexpr year_month& operator+=(const months& __dm) noexcept;
+ _LIBCPP_HIDE_FROM_ABI inline constexpr year_month& operator-=(const months& __dm) noexcept;
+ _LIBCPP_HIDE_FROM_ABI inline constexpr year_month& operator+=(const years& __dy) noexcept;
+ _LIBCPP_HIDE_FROM_ABI inline constexpr year_month& operator-=(const years& __dy) noexcept;
+ _LIBCPP_HIDE_FROM_ABI inline constexpr bool ok() const noexcept { return __y_.ok() && __m_.ok(); }
};
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-year_month operator/(const year& __y, const month& __m) noexcept { return year_month{__y, __m}; }
+_LIBCPP_HIDE_FROM_ABI inline constexpr year_month operator/(const year& __y, const month& __m) noexcept {
+ return year_month{__y, __m};
+}
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-year_month operator/(const year& __y, int __m) noexcept { return year_month{__y, month(__m)}; }
+_LIBCPP_HIDE_FROM_ABI inline constexpr year_month operator/(const year& __y, int __m) noexcept {
+ return year_month{__y, month(__m)};
+}
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-bool operator==(const year_month& __lhs, const year_month& __rhs) noexcept
-{ return __lhs.year() == __rhs.year() && __lhs.month() == __rhs.month(); }
+_LIBCPP_HIDE_FROM_ABI inline constexpr bool operator==(const year_month& __lhs, const year_month& __rhs) noexcept {
+ return __lhs.year() == __rhs.year() && __lhs.month() == __rhs.month();
+}
-_LIBCPP_HIDE_FROM_ABI inline constexpr strong_ordering operator<=>(const year_month& __lhs, const year_month& __rhs) noexcept {
- if (auto __c = __lhs.year() <=> __rhs.year(); __c != 0)
- return __c;
- return __lhs.month() <=> __rhs.month();
+_LIBCPP_HIDE_FROM_ABI inline constexpr strong_ordering
+operator<=>(const year_month& __lhs, const year_month& __rhs) noexcept {
+ if (auto __c = __lhs.year() <=> __rhs.year(); __c != 0)
+ return __c;
+ return __lhs.month() <=> __rhs.month();
}
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-year_month operator+(const year_month& __lhs, const months& __rhs) noexcept
-{
- int __dmi = static_cast<int>(static_cast<unsigned>(__lhs.month())) - 1 + __rhs.count();
- const int __dy = (__dmi >= 0 ? __dmi : __dmi-11) / 12;
- __dmi = __dmi - __dy * 12 + 1;
- return (__lhs.year() + years(__dy)) / month(static_cast<unsigned>(__dmi));
+_LIBCPP_HIDE_FROM_ABI inline constexpr year_month operator+(const year_month& __lhs, const months& __rhs) noexcept {
+ int __dmi = static_cast<int>(static_cast<unsigned>(__lhs.month())) - 1 + __rhs.count();
+ const int __dy = (__dmi >= 0 ? __dmi : __dmi - 11) / 12;
+ __dmi = __dmi - __dy * 12 + 1;
+ return (__lhs.year() + years(__dy)) / month(static_cast<unsigned>(__dmi));
}
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-year_month operator+(const months& __lhs, const year_month& __rhs) noexcept
-{ return __rhs + __lhs; }
+_LIBCPP_HIDE_FROM_ABI inline constexpr year_month operator+(const months& __lhs, const year_month& __rhs) noexcept {
+ return __rhs + __lhs;
+}
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-year_month operator+(const year_month& __lhs, const years& __rhs) noexcept
-{ return (__lhs.year() + __rhs) / __lhs.month(); }
+_LIBCPP_HIDE_FROM_ABI inline constexpr year_month operator+(const year_month& __lhs, const years& __rhs) noexcept {
+ return (__lhs.year() + __rhs) / __lhs.month();
+}
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-year_month operator+(const years& __lhs, const year_month& __rhs) noexcept
-{ return __rhs + __lhs; }
+_LIBCPP_HIDE_FROM_ABI inline constexpr year_month operator+(const years& __lhs, const year_month& __rhs) noexcept {
+ return __rhs + __lhs;
+}
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-months operator-(const year_month& __lhs, const year_month& __rhs) noexcept
-{ return (__lhs.year() - __rhs.year()) + months(static_cast<unsigned>(__lhs.month()) - static_cast<unsigned>(__rhs.month())); }
+_LIBCPP_HIDE_FROM_ABI inline constexpr months operator-(const year_month& __lhs, const year_month& __rhs) noexcept {
+ return (__lhs.year() - __rhs.year()) +
+ months(static_cast<unsigned>(__lhs.month()) - static_cast<unsigned>(__rhs.month()));
+}
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-year_month operator-(const year_month& __lhs, const months& __rhs) noexcept
-{ return __lhs + -__rhs; }
+_LIBCPP_HIDE_FROM_ABI inline constexpr year_month operator-(const year_month& __lhs, const months& __rhs) noexcept {
+ return __lhs + -__rhs;
+}
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-year_month operator-(const year_month& __lhs, const years& __rhs) noexcept
-{ return __lhs + -__rhs; }
+_LIBCPP_HIDE_FROM_ABI inline constexpr year_month operator-(const year_month& __lhs, const years& __rhs) noexcept {
+ return __lhs + -__rhs;
+}
_LIBCPP_HIDE_FROM_ABI inline constexpr year_month& year_month::operator+=(const months& __dm) noexcept {
*this = *this + __dm;
diff --git a/contrib/llvm-project/libcxx/include/__chrono/year_month_day.h b/contrib/llvm-project/libcxx/include/__chrono/year_month_day.h
index e84d2f8a838b..75884f3654d8 100644
--- a/contrib/llvm-project/libcxx/include/__chrono/year_month_day.h
+++ b/contrib/llvm-project/libcxx/include/__chrono/year_month_day.h
@@ -31,271 +31,323 @@
_LIBCPP_BEGIN_NAMESPACE_STD
-namespace chrono
-{
+namespace chrono {
class year_month_day_last;
class year_month_day {
private:
- chrono::year __y_;
- chrono::month __m_;
- chrono::day __d_;
+ chrono::year __y_;
+ chrono::month __m_;
+ chrono::day __d_;
+
public:
- year_month_day() = default;
- _LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day(
- const chrono::year& __yval, const chrono::month& __mval, const chrono::day& __dval) noexcept
- : __y_{__yval}, __m_{__mval}, __d_{__dval} {}
- _LIBCPP_HIDE_FROM_ABI constexpr year_month_day(const year_month_day_last& __ymdl) noexcept;
- _LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day(const sys_days& __sysd) noexcept
- : year_month_day(__from_days(__sysd.time_since_epoch())) {}
- _LIBCPP_HIDE_FROM_ABI inline explicit constexpr year_month_day(const local_days& __locd) noexcept
- : year_month_day(__from_days(__locd.time_since_epoch())) {}
-
- _LIBCPP_HIDE_FROM_ABI constexpr year_month_day& operator+=(const months& __dm) noexcept;
- _LIBCPP_HIDE_FROM_ABI constexpr year_month_day& operator-=(const months& __dm) noexcept;
- _LIBCPP_HIDE_FROM_ABI constexpr year_month_day& operator+=(const years& __dy) noexcept;
- _LIBCPP_HIDE_FROM_ABI constexpr year_month_day& operator-=(const years& __dy) noexcept;
-
- _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::year year() const noexcept { return __y_; }
- _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::month month() const noexcept { return __m_; }
- _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::day day() const noexcept { return __d_; }
- _LIBCPP_HIDE_FROM_ABI inline constexpr operator sys_days() const noexcept { return sys_days{__to_days()}; }
- _LIBCPP_HIDE_FROM_ABI inline explicit constexpr operator local_days() const noexcept { return local_days{__to_days()}; }
-
- _LIBCPP_HIDE_FROM_ABI constexpr bool ok() const noexcept;
-
- _LIBCPP_HIDE_FROM_ABI static constexpr year_month_day __from_days(days __d) noexcept;
- _LIBCPP_HIDE_FROM_ABI constexpr days __to_days() const noexcept;
+ year_month_day() = default;
+ _LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day(
+ const chrono::year& __yval, const chrono::month& __mval, const chrono::day& __dval) noexcept
+ : __y_{__yval}, __m_{__mval}, __d_{__dval} {}
+ _LIBCPP_HIDE_FROM_ABI constexpr year_month_day(const year_month_day_last& __ymdl) noexcept;
+ _LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day(const sys_days& __sysd) noexcept
+ : year_month_day(__from_days(__sysd.time_since_epoch())) {}
+ _LIBCPP_HIDE_FROM_ABI inline explicit constexpr year_month_day(const local_days& __locd) noexcept
+ : year_month_day(__from_days(__locd.time_since_epoch())) {}
+
+ _LIBCPP_HIDE_FROM_ABI constexpr year_month_day& operator+=(const months& __dm) noexcept;
+ _LIBCPP_HIDE_FROM_ABI constexpr year_month_day& operator-=(const months& __dm) noexcept;
+ _LIBCPP_HIDE_FROM_ABI constexpr year_month_day& operator+=(const years& __dy) noexcept;
+ _LIBCPP_HIDE_FROM_ABI constexpr year_month_day& operator-=(const years& __dy) noexcept;
+
+ _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::year year() const noexcept { return __y_; }
+ _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::month month() const noexcept { return __m_; }
+ _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::day day() const noexcept { return __d_; }
+ _LIBCPP_HIDE_FROM_ABI inline constexpr operator sys_days() const noexcept { return sys_days{__to_days()}; }
+ _LIBCPP_HIDE_FROM_ABI inline explicit constexpr operator local_days() const noexcept {
+ return local_days{__to_days()};
+ }
+
+ _LIBCPP_HIDE_FROM_ABI constexpr bool ok() const noexcept;
+
+ _LIBCPP_HIDE_FROM_ABI static constexpr year_month_day __from_days(days __d) noexcept;
+ _LIBCPP_HIDE_FROM_ABI constexpr days __to_days() const noexcept;
};
-
// https://howardhinnant.github.io/date_algorithms.html#civil_from_days
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-year_month_day year_month_day::__from_days(days __d) noexcept
-{
- static_assert(numeric_limits<unsigned>::digits >= 18, "");
- static_assert(numeric_limits<int>::digits >= 20 , "");
- const int __z = __d.count() + 719468;
- const int __era = (__z >= 0 ? __z : __z - 146096) / 146097;
- const unsigned __doe = static_cast<unsigned>(__z - __era * 146097); // [0, 146096]
- const unsigned __yoe = (__doe - __doe/1460 + __doe/36524 - __doe/146096) / 365; // [0, 399]
- const int __yr = static_cast<int>(__yoe) + __era * 400;
- const unsigned __doy = __doe - (365 * __yoe + __yoe/4 - __yoe/100); // [0, 365]
- const unsigned __mp = (5 * __doy + 2)/153; // [0, 11]
- const unsigned __dy = __doy - (153 * __mp + 2)/5 + 1; // [1, 31]
- const unsigned __mth = __mp + (__mp < 10 ? 3 : -9); // [1, 12]
- return year_month_day{chrono::year{__yr + (__mth <= 2)}, chrono::month{__mth}, chrono::day{__dy}};
+_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day year_month_day::__from_days(days __d) noexcept {
+ static_assert(numeric_limits<unsigned>::digits >= 18, "");
+ static_assert(numeric_limits<int>::digits >= 20, "");
+ const int __z = __d.count() + 719468;
+ const int __era = (__z >= 0 ? __z : __z - 146096) / 146097;
+ const unsigned __doe = static_cast<unsigned>(__z - __era * 146097); // [0, 146096]
+ const unsigned __yoe = (__doe - __doe / 1460 + __doe / 36524 - __doe / 146096) / 365; // [0, 399]
+ const int __yr = static_cast<int>(__yoe) + __era * 400;
+ const unsigned __doy = __doe - (365 * __yoe + __yoe / 4 - __yoe / 100); // [0, 365]
+ const unsigned __mp = (5 * __doy + 2) / 153; // [0, 11]
+ const unsigned __dy = __doy - (153 * __mp + 2) / 5 + 1; // [1, 31]
+ const unsigned __mth = __mp + (__mp < 10 ? 3 : -9); // [1, 12]
+ return year_month_day{chrono::year{__yr + (__mth <= 2)}, chrono::month{__mth}, chrono::day{__dy}};
}
// https://howardhinnant.github.io/date_algorithms.html#days_from_civil
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-days year_month_day::__to_days() const noexcept
-{
- static_assert(numeric_limits<unsigned>::digits >= 18, "");
- static_assert(numeric_limits<int>::digits >= 20 , "");
-
- const int __yr = static_cast<int>(__y_) - (__m_ <= February);
- const unsigned __mth = static_cast<unsigned>(__m_);
- const unsigned __dy = static_cast<unsigned>(__d_);
-
- const int __era = (__yr >= 0 ? __yr : __yr - 399) / 400;
- const unsigned __yoe = static_cast<unsigned>(__yr - __era * 400); // [0, 399]
- const unsigned __doy = (153 * (__mth + (__mth > 2 ? -3 : 9)) + 2) / 5 + __dy-1; // [0, 365]
- const unsigned __doe = __yoe * 365 + __yoe/4 - __yoe/100 + __doy; // [0, 146096]
- return days{__era * 146097 + static_cast<int>(__doe) - 719468};
+_LIBCPP_HIDE_FROM_ABI inline constexpr days year_month_day::__to_days() const noexcept {
+ static_assert(numeric_limits<unsigned>::digits >= 18, "");
+ static_assert(numeric_limits<int>::digits >= 20, "");
+
+ const int __yr = static_cast<int>(__y_) - (__m_ <= February);
+ const unsigned __mth = static_cast<unsigned>(__m_);
+ const unsigned __dy = static_cast<unsigned>(__d_);
+
+ const int __era = (__yr >= 0 ? __yr : __yr - 399) / 400;
+ const unsigned __yoe = static_cast<unsigned>(__yr - __era * 400); // [0, 399]
+ const unsigned __doy = (153 * (__mth + (__mth > 2 ? -3 : 9)) + 2) / 5 + __dy - 1; // [0, 365]
+ const unsigned __doe = __yoe * 365 + __yoe / 4 - __yoe / 100 + __doy; // [0, 146096]
+ return days{__era * 146097 + static_cast<int>(__doe) - 719468};
}
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-bool operator==(const year_month_day& __lhs, const year_month_day& __rhs) noexcept
-{ return __lhs.year() == __rhs.year() && __lhs.month() == __rhs.month() && __lhs.day() == __rhs.day(); }
+_LIBCPP_HIDE_FROM_ABI inline constexpr bool
+operator==(const year_month_day& __lhs, const year_month_day& __rhs) noexcept {
+ return __lhs.year() == __rhs.year() && __lhs.month() == __rhs.month() && __lhs.day() == __rhs.day();
+}
_LIBCPP_HIDE_FROM_ABI inline constexpr strong_ordering
operator<=>(const year_month_day& __lhs, const year_month_day& __rhs) noexcept {
- if (auto __c = __lhs.year() <=> __rhs.year(); __c != 0)
- return __c;
- if (auto __c = __lhs.month() <=> __rhs.month(); __c != 0)
- return __c;
- return __lhs.day() <=> __rhs.day();
+ if (auto __c = __lhs.year() <=> __rhs.year(); __c != 0)
+ return __c;
+ if (auto __c = __lhs.month() <=> __rhs.month(); __c != 0)
+ return __c;
+ return __lhs.day() <=> __rhs.day();
}
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-year_month_day operator/(const year_month& __lhs, const day& __rhs) noexcept
-{ return year_month_day{__lhs.year(), __lhs.month(), __rhs}; }
-
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-year_month_day operator/(const year_month& __lhs, int __rhs) noexcept
-{ return __lhs / day(__rhs); }
+_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day operator/(const year_month& __lhs, const day& __rhs) noexcept {
+ return year_month_day{__lhs.year(), __lhs.month(), __rhs};
+}
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-year_month_day operator/(const year& __lhs, const month_day& __rhs) noexcept
-{ return __lhs / __rhs.month() / __rhs.day(); }
+_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day operator/(const year_month& __lhs, int __rhs) noexcept {
+ return __lhs / day(__rhs);
+}
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-year_month_day operator/(int __lhs, const month_day& __rhs) noexcept
-{ return year(__lhs) / __rhs; }
+_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day operator/(const year& __lhs, const month_day& __rhs) noexcept {
+ return __lhs / __rhs.month() / __rhs.day();
+}
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-year_month_day operator/(const month_day& __lhs, const year& __rhs) noexcept
-{ return __rhs / __lhs; }
+_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day operator/(int __lhs, const month_day& __rhs) noexcept {
+ return year(__lhs) / __rhs;
+}
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-year_month_day operator/(const month_day& __lhs, int __rhs) noexcept
-{ return year(__rhs) / __lhs; }
+_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day operator/(const month_day& __lhs, const year& __rhs) noexcept {
+ return __rhs / __lhs;
+}
+_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day operator/(const month_day& __lhs, int __rhs) noexcept {
+ return year(__rhs) / __lhs;
+}
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-year_month_day operator+(const year_month_day& __lhs, const months& __rhs) noexcept
-{ return (__lhs.year()/__lhs.month() + __rhs)/__lhs.day(); }
+_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day
+operator+(const year_month_day& __lhs, const months& __rhs) noexcept {
+ return (__lhs.year() / __lhs.month() + __rhs) / __lhs.day();
+}
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-year_month_day operator+(const months& __lhs, const year_month_day& __rhs) noexcept
-{ return __rhs + __lhs; }
+_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day
+operator+(const months& __lhs, const year_month_day& __rhs) noexcept {
+ return __rhs + __lhs;
+}
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-year_month_day operator-(const year_month_day& __lhs, const months& __rhs) noexcept
-{ return __lhs + -__rhs; }
+_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day
+operator-(const year_month_day& __lhs, const months& __rhs) noexcept {
+ return __lhs + -__rhs;
+}
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-year_month_day operator+(const year_month_day& __lhs, const years& __rhs) noexcept
-{ return (__lhs.year() + __rhs) / __lhs.month() / __lhs.day(); }
+_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day
+operator+(const year_month_day& __lhs, const years& __rhs) noexcept {
+ return (__lhs.year() + __rhs) / __lhs.month() / __lhs.day();
+}
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-year_month_day operator+(const years& __lhs, const year_month_day& __rhs) noexcept
-{ return __rhs + __lhs; }
+_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day
+operator+(const years& __lhs, const year_month_day& __rhs) noexcept {
+ return __rhs + __lhs;
+}
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-year_month_day operator-(const year_month_day& __lhs, const years& __rhs) noexcept
-{ return __lhs + -__rhs; }
+_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day
+operator-(const year_month_day& __lhs, const years& __rhs) noexcept {
+ return __lhs + -__rhs;
+}
-_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day& year_month_day::operator+=(const months& __dm) noexcept { *this = *this + __dm; return *this; }
-_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day& year_month_day::operator-=(const months& __dm) noexcept { *this = *this - __dm; return *this; }
-_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day& year_month_day::operator+=(const years& __dy) noexcept { *this = *this + __dy; return *this; }
-_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day& year_month_day::operator-=(const years& __dy) noexcept { *this = *this - __dy; return *this; }
+_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day& year_month_day::operator+=(const months& __dm) noexcept {
+ *this = *this + __dm;
+ return *this;
+}
+_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day& year_month_day::operator-=(const months& __dm) noexcept {
+ *this = *this - __dm;
+ return *this;
+}
+_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day& year_month_day::operator+=(const years& __dy) noexcept {
+ *this = *this + __dy;
+ return *this;
+}
+_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day& year_month_day::operator-=(const years& __dy) noexcept {
+ *this = *this - __dy;
+ return *this;
+}
class year_month_day_last {
private:
- chrono::year __y_;
- chrono::month_day_last __mdl_;
+ chrono::year __y_;
+ chrono::month_day_last __mdl_;
+
public:
- _LIBCPP_HIDE_FROM_ABI constexpr year_month_day_last(const year& __yval, const month_day_last& __mdlval) noexcept
- : __y_{__yval}, __mdl_{__mdlval} {}
-
- _LIBCPP_HIDE_FROM_ABI constexpr year_month_day_last& operator+=(const months& __m) noexcept;
- _LIBCPP_HIDE_FROM_ABI constexpr year_month_day_last& operator-=(const months& __m) noexcept;
- _LIBCPP_HIDE_FROM_ABI constexpr year_month_day_last& operator+=(const years& __y) noexcept;
- _LIBCPP_HIDE_FROM_ABI constexpr year_month_day_last& operator-=(const years& __y) noexcept;
-
- _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::year year() const noexcept { return __y_; }
- _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::month month() const noexcept { return __mdl_.month(); }
- _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::month_day_last month_day_last() const noexcept { return __mdl_; }
- _LIBCPP_HIDE_FROM_ABI constexpr chrono::day day() const noexcept;
- _LIBCPP_HIDE_FROM_ABI inline constexpr operator sys_days() const noexcept { return sys_days{year()/month()/day()}; }
- _LIBCPP_HIDE_FROM_ABI inline explicit constexpr operator local_days() const noexcept { return local_days{year()/month()/day()}; }
- _LIBCPP_HIDE_FROM_ABI inline constexpr bool ok() const noexcept { return __y_.ok() && __mdl_.ok(); }
+ _LIBCPP_HIDE_FROM_ABI constexpr year_month_day_last(const year& __yval, const month_day_last& __mdlval) noexcept
+ : __y_{__yval}, __mdl_{__mdlval} {}
+
+ _LIBCPP_HIDE_FROM_ABI constexpr year_month_day_last& operator+=(const months& __m) noexcept;
+ _LIBCPP_HIDE_FROM_ABI constexpr year_month_day_last& operator-=(const months& __m) noexcept;
+ _LIBCPP_HIDE_FROM_ABI constexpr year_month_day_last& operator+=(const years& __y) noexcept;
+ _LIBCPP_HIDE_FROM_ABI constexpr year_month_day_last& operator-=(const years& __y) noexcept;
+
+ _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::year year() const noexcept { return __y_; }
+ _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::month month() const noexcept { return __mdl_.month(); }
+ _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::month_day_last month_day_last() const noexcept { return __mdl_; }
+ _LIBCPP_HIDE_FROM_ABI constexpr chrono::day day() const noexcept;
+ _LIBCPP_HIDE_FROM_ABI inline constexpr operator sys_days() const noexcept {
+ return sys_days{year() / month() / day()};
+ }
+ _LIBCPP_HIDE_FROM_ABI inline explicit constexpr operator local_days() const noexcept {
+ return local_days{year() / month() / day()};
+ }
+ _LIBCPP_HIDE_FROM_ABI inline constexpr bool ok() const noexcept { return __y_.ok() && __mdl_.ok(); }
};
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-chrono::day year_month_day_last::day() const noexcept
-{
- constexpr chrono::day __d[] =
- {
- chrono::day(31), chrono::day(28), chrono::day(31),
- chrono::day(30), chrono::day(31), chrono::day(30),
- chrono::day(31), chrono::day(31), chrono::day(30),
- chrono::day(31), chrono::day(30), chrono::day(31)
- };
- return (month() != February || !__y_.is_leap()) && month().ok() ?
- __d[static_cast<unsigned>(month()) - 1] : chrono::day{29};
+_LIBCPP_HIDE_FROM_ABI inline constexpr chrono::day year_month_day_last::day() const noexcept {
+ constexpr chrono::day __d[] = {
+ chrono::day(31),
+ chrono::day(28),
+ chrono::day(31),
+ chrono::day(30),
+ chrono::day(31),
+ chrono::day(30),
+ chrono::day(31),
+ chrono::day(31),
+ chrono::day(30),
+ chrono::day(31),
+ chrono::day(30),
+ chrono::day(31)};
+ return (month() != February || !__y_.is_leap()) && month().ok()
+ ? __d[static_cast<unsigned>(month()) - 1]
+ : chrono::day{29};
}
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-bool operator==(const year_month_day_last& __lhs, const year_month_day_last& __rhs) noexcept
-{ return __lhs.year() == __rhs.year() && __lhs.month_day_last() == __rhs.month_day_last(); }
+_LIBCPP_HIDE_FROM_ABI inline constexpr bool
+operator==(const year_month_day_last& __lhs, const year_month_day_last& __rhs) noexcept {
+ return __lhs.year() == __rhs.year() && __lhs.month_day_last() == __rhs.month_day_last();
+}
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-bool operator!=(const year_month_day_last& __lhs, const year_month_day_last& __rhs) noexcept
-{ return !(__lhs == __rhs); }
+_LIBCPP_HIDE_FROM_ABI inline constexpr bool
+operator!=(const year_month_day_last& __lhs, const year_month_day_last& __rhs) noexcept {
+ return !(__lhs == __rhs);
+}
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-bool operator< (const year_month_day_last& __lhs, const year_month_day_last& __rhs) noexcept
-{
- if (__lhs.year() < __rhs.year()) return true;
- if (__lhs.year() > __rhs.year()) return false;
- return __lhs.month_day_last() < __rhs.month_day_last();
+_LIBCPP_HIDE_FROM_ABI inline constexpr bool
+operator<(const year_month_day_last& __lhs, const year_month_day_last& __rhs) noexcept {
+ if (__lhs.year() < __rhs.year())
+ return true;
+ if (__lhs.year() > __rhs.year())
+ return false;
+ return __lhs.month_day_last() < __rhs.month_day_last();
}
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-bool operator> (const year_month_day_last& __lhs, const year_month_day_last& __rhs) noexcept
-{ return __rhs < __lhs; }
+_LIBCPP_HIDE_FROM_ABI inline constexpr bool
+operator>(const year_month_day_last& __lhs, const year_month_day_last& __rhs) noexcept {
+ return __rhs < __lhs;
+}
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-bool operator<=(const year_month_day_last& __lhs, const year_month_day_last& __rhs) noexcept
-{ return !(__rhs < __lhs);}
+_LIBCPP_HIDE_FROM_ABI inline constexpr bool
+operator<=(const year_month_day_last& __lhs, const year_month_day_last& __rhs) noexcept {
+ return !(__rhs < __lhs);
+}
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-bool operator>=(const year_month_day_last& __lhs, const year_month_day_last& __rhs) noexcept
-{ return !(__lhs < __rhs); }
+_LIBCPP_HIDE_FROM_ABI inline constexpr bool
+operator>=(const year_month_day_last& __lhs, const year_month_day_last& __rhs) noexcept {
+ return !(__lhs < __rhs);
+}
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-year_month_day_last operator/(const year_month& __lhs, last_spec) noexcept
-{ return year_month_day_last{__lhs.year(), month_day_last{__lhs.month()}}; }
+_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day_last operator/(const year_month& __lhs, last_spec) noexcept {
+ return year_month_day_last{__lhs.year(), month_day_last{__lhs.month()}};
+}
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-year_month_day_last operator/(const year& __lhs, const month_day_last& __rhs) noexcept
-{ return year_month_day_last{__lhs, __rhs}; }
+_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day_last
+operator/(const year& __lhs, const month_day_last& __rhs) noexcept {
+ return year_month_day_last{__lhs, __rhs};
+}
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-year_month_day_last operator/(int __lhs, const month_day_last& __rhs) noexcept
-{ return year_month_day_last{year{__lhs}, __rhs}; }
+_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day_last operator/(int __lhs, const month_day_last& __rhs) noexcept {
+ return year_month_day_last{year{__lhs}, __rhs};
+}
_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day_last
-operator/(const month_day_last& __lhs, const year& __rhs) noexcept
-{ return __rhs / __lhs; }
-
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-year_month_day_last operator/(const month_day_last& __lhs, int __rhs) noexcept
-{ return year{__rhs} / __lhs; }
+operator/(const month_day_last& __lhs, const year& __rhs) noexcept {
+ return __rhs / __lhs;
+}
+_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day_last operator/(const month_day_last& __lhs, int __rhs) noexcept {
+ return year{__rhs} / __lhs;
+}
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-year_month_day_last operator+(const year_month_day_last& __lhs, const months& __rhs) noexcept
-{ return (__lhs.year() / __lhs.month() + __rhs) / last; }
+_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day_last
+operator+(const year_month_day_last& __lhs, const months& __rhs) noexcept {
+ return (__lhs.year() / __lhs.month() + __rhs) / last;
+}
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-year_month_day_last operator+(const months& __lhs, const year_month_day_last& __rhs) noexcept
-{ return __rhs + __lhs; }
+_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day_last
+operator+(const months& __lhs, const year_month_day_last& __rhs) noexcept {
+ return __rhs + __lhs;
+}
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-year_month_day_last operator-(const year_month_day_last& __lhs, const months& __rhs) noexcept
-{ return __lhs + (-__rhs); }
+_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day_last
+operator-(const year_month_day_last& __lhs, const months& __rhs) noexcept {
+ return __lhs + (-__rhs);
+}
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-year_month_day_last operator+(const year_month_day_last& __lhs, const years& __rhs) noexcept
-{ return year_month_day_last{__lhs.year() + __rhs, __lhs.month_day_last()}; }
+_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day_last
+operator+(const year_month_day_last& __lhs, const years& __rhs) noexcept {
+ return year_month_day_last{__lhs.year() + __rhs, __lhs.month_day_last()};
+}
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-year_month_day_last operator+(const years& __lhs, const year_month_day_last& __rhs) noexcept
-{ return __rhs + __lhs; }
+_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day_last
+operator+(const years& __lhs, const year_month_day_last& __rhs) noexcept {
+ return __rhs + __lhs;
+}
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-year_month_day_last operator-(const year_month_day_last& __lhs, const years& __rhs) noexcept
-{ return __lhs + (-__rhs); }
+_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day_last
+operator-(const year_month_day_last& __lhs, const years& __rhs) noexcept {
+ return __lhs + (-__rhs);
+}
-_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day_last& year_month_day_last::operator+=(const months& __dm) noexcept { *this = *this + __dm; return *this; }
-_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day_last& year_month_day_last::operator-=(const months& __dm) noexcept { *this = *this - __dm; return *this; }
-_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day_last& year_month_day_last::operator+=(const years& __dy) noexcept { *this = *this + __dy; return *this; }
-_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day_last& year_month_day_last::operator-=(const years& __dy) noexcept { *this = *this - __dy; return *this; }
+_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day_last&
+year_month_day_last::operator+=(const months& __dm) noexcept {
+ *this = *this + __dm;
+ return *this;
+}
+_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day_last&
+year_month_day_last::operator-=(const months& __dm) noexcept {
+ *this = *this - __dm;
+ return *this;
+}
+_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day_last&
+year_month_day_last::operator+=(const years& __dy) noexcept {
+ *this = *this + __dy;
+ return *this;
+}
+_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day_last&
+year_month_day_last::operator-=(const years& __dy) noexcept {
+ *this = *this - __dy;
+ return *this;
+}
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-year_month_day::year_month_day(const year_month_day_last& __ymdl) noexcept
+_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day::year_month_day(const year_month_day_last& __ymdl) noexcept
: __y_{__ymdl.year()}, __m_{__ymdl.month()}, __d_{__ymdl.day()} {}
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-bool year_month_day::ok() const noexcept
-{
- if (!__y_.ok() || !__m_.ok()) return false;
- return chrono::day{1} <= __d_ && __d_ <= (__y_ / __m_ / last).day();
+_LIBCPP_HIDE_FROM_ABI inline constexpr bool year_month_day::ok() const noexcept {
+ if (!__y_.ok() || !__m_.ok())
+ return false;
+ return chrono::day{1} <= __d_ && __d_ <= (__y_ / __m_ / last).day();
}
} // namespace chrono
diff --git a/contrib/llvm-project/libcxx/include/__chrono/year_month_weekday.h b/contrib/llvm-project/libcxx/include/__chrono/year_month_weekday.h
index 4b5cb492a191..0c3dd494c878 100644
--- a/contrib/llvm-project/libcxx/include/__chrono/year_month_weekday.h
+++ b/contrib/llvm-project/libcxx/include/__chrono/year_month_weekday.h
@@ -31,211 +31,252 @@
_LIBCPP_BEGIN_NAMESPACE_STD
-namespace chrono
-{
+namespace chrono {
class year_month_weekday {
- chrono::year __y_;
- chrono::month __m_;
- chrono::weekday_indexed __wdi_;
+ chrono::year __y_;
+ chrono::month __m_;
+ chrono::weekday_indexed __wdi_;
+
public:
- year_month_weekday() = default;
- _LIBCPP_HIDE_FROM_ABI constexpr year_month_weekday(const chrono::year& __yval, const chrono::month& __mval,
- const chrono::weekday_indexed& __wdival) noexcept
- : __y_{__yval}, __m_{__mval}, __wdi_{__wdival} {}
- _LIBCPP_HIDE_FROM_ABI constexpr year_month_weekday(const sys_days& __sysd) noexcept
- : year_month_weekday(__from_days(__sysd.time_since_epoch())) {}
- _LIBCPP_HIDE_FROM_ABI inline explicit constexpr year_month_weekday(const local_days& __locd) noexcept
- : year_month_weekday(__from_days(__locd.time_since_epoch())) {}
- _LIBCPP_HIDE_FROM_ABI constexpr year_month_weekday& operator+=(const months&) noexcept;
- _LIBCPP_HIDE_FROM_ABI constexpr year_month_weekday& operator-=(const months&) noexcept;
- _LIBCPP_HIDE_FROM_ABI constexpr year_month_weekday& operator+=(const years&) noexcept;
- _LIBCPP_HIDE_FROM_ABI constexpr year_month_weekday& operator-=(const years&) noexcept;
-
- _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::year year() const noexcept { return __y_; }
- _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::month month() const noexcept { return __m_; }
- _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::weekday weekday() const noexcept { return __wdi_.weekday(); }
- _LIBCPP_HIDE_FROM_ABI inline constexpr unsigned index() const noexcept { return __wdi_.index(); }
- _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::weekday_indexed weekday_indexed() const noexcept { return __wdi_; }
-
- _LIBCPP_HIDE_FROM_ABI inline constexpr operator sys_days() const noexcept { return sys_days{__to_days()}; }
- _LIBCPP_HIDE_FROM_ABI inline explicit constexpr operator local_days() const noexcept { return local_days{__to_days()}; }
- _LIBCPP_HIDE_FROM_ABI inline constexpr bool ok() const noexcept
- {
- if (!__y_.ok() || !__m_.ok() || !__wdi_.ok()) return false;
- if (__wdi_.index() <= 4) return true;
- auto __nth_weekday_day =
- __wdi_.weekday() -
- chrono::weekday{static_cast<sys_days>(__y_ / __m_ / 1)} +
- days{(__wdi_.index() - 1) * 7 + 1};
- return static_cast<unsigned>(__nth_weekday_day.count()) <=
- static_cast<unsigned>((__y_ / __m_ / last).day());
- }
-
- _LIBCPP_HIDE_FROM_ABI static constexpr year_month_weekday __from_days(days __d) noexcept;
- _LIBCPP_HIDE_FROM_ABI constexpr days __to_days() const noexcept;
+ year_month_weekday() = default;
+ _LIBCPP_HIDE_FROM_ABI constexpr year_month_weekday(
+ const chrono::year& __yval, const chrono::month& __mval, const chrono::weekday_indexed& __wdival) noexcept
+ : __y_{__yval}, __m_{__mval}, __wdi_{__wdival} {}
+ _LIBCPP_HIDE_FROM_ABI constexpr year_month_weekday(const sys_days& __sysd) noexcept
+ : year_month_weekday(__from_days(__sysd.time_since_epoch())) {}
+ _LIBCPP_HIDE_FROM_ABI inline explicit constexpr year_month_weekday(const local_days& __locd) noexcept
+ : year_month_weekday(__from_days(__locd.time_since_epoch())) {}
+ _LIBCPP_HIDE_FROM_ABI constexpr year_month_weekday& operator+=(const months&) noexcept;
+ _LIBCPP_HIDE_FROM_ABI constexpr year_month_weekday& operator-=(const months&) noexcept;
+ _LIBCPP_HIDE_FROM_ABI constexpr year_month_weekday& operator+=(const years&) noexcept;
+ _LIBCPP_HIDE_FROM_ABI constexpr year_month_weekday& operator-=(const years&) noexcept;
+
+ _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::year year() const noexcept { return __y_; }
+ _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::month month() const noexcept { return __m_; }
+ _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::weekday weekday() const noexcept { return __wdi_.weekday(); }
+ _LIBCPP_HIDE_FROM_ABI inline constexpr unsigned index() const noexcept { return __wdi_.index(); }
+ _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::weekday_indexed weekday_indexed() const noexcept { return __wdi_; }
+
+ _LIBCPP_HIDE_FROM_ABI inline constexpr operator sys_days() const noexcept { return sys_days{__to_days()}; }
+ _LIBCPP_HIDE_FROM_ABI inline explicit constexpr operator local_days() const noexcept {
+ return local_days{__to_days()};
+ }
+ _LIBCPP_HIDE_FROM_ABI inline constexpr bool ok() const noexcept {
+ if (!__y_.ok() || !__m_.ok() || !__wdi_.ok())
+ return false;
+ if (__wdi_.index() <= 4)
+ return true;
+ auto __nth_weekday_day =
+ __wdi_.weekday() - chrono::weekday{static_cast<sys_days>(__y_ / __m_ / 1)} + days{(__wdi_.index() - 1) * 7 + 1};
+ return static_cast<unsigned>(__nth_weekday_day.count()) <= static_cast<unsigned>((__y_ / __m_ / last).day());
+ }
+
+ _LIBCPP_HIDE_FROM_ABI static constexpr year_month_weekday __from_days(days __d) noexcept;
+ _LIBCPP_HIDE_FROM_ABI constexpr days __to_days() const noexcept;
};
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-year_month_weekday year_month_weekday::__from_days(days __d) noexcept
-{
- const sys_days __sysd{__d};
- const chrono::weekday __wd = chrono::weekday(__sysd);
- const year_month_day __ymd = year_month_day(__sysd);
- return year_month_weekday{__ymd.year(), __ymd.month(),
- __wd[(static_cast<unsigned>(__ymd.day())-1)/7+1]};
+_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_weekday year_month_weekday::__from_days(days __d) noexcept {
+ const sys_days __sysd{__d};
+ const chrono::weekday __wd = chrono::weekday(__sysd);
+ const year_month_day __ymd = year_month_day(__sysd);
+ return year_month_weekday{__ymd.year(), __ymd.month(), __wd[(static_cast<unsigned>(__ymd.day()) - 1) / 7 + 1]};
}
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-days year_month_weekday::__to_days() const noexcept
-{
- const sys_days __sysd = sys_days(__y_/__m_/1);
- return (__sysd + (__wdi_.weekday() - chrono::weekday(__sysd) + days{(__wdi_.index()-1)*7}))
- .time_since_epoch();
+_LIBCPP_HIDE_FROM_ABI inline constexpr days year_month_weekday::__to_days() const noexcept {
+ const sys_days __sysd = sys_days(__y_ / __m_ / 1);
+ return (__sysd + (__wdi_.weekday() - chrono::weekday(__sysd) + days{(__wdi_.index() - 1) * 7})).time_since_epoch();
}
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-bool operator==(const year_month_weekday& __lhs, const year_month_weekday& __rhs) noexcept
-{ return __lhs.year() == __rhs.year() && __lhs.month() == __rhs.month() && __lhs.weekday_indexed() == __rhs.weekday_indexed(); }
-
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-year_month_weekday operator/(const year_month& __lhs, const weekday_indexed& __rhs) noexcept
-{ return year_month_weekday{__lhs.year(), __lhs.month(), __rhs}; }
-
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-year_month_weekday operator/(const year& __lhs, const month_weekday& __rhs) noexcept
-{ return year_month_weekday{__lhs, __rhs.month(), __rhs.weekday_indexed()}; }
+_LIBCPP_HIDE_FROM_ABI inline constexpr bool
+operator==(const year_month_weekday& __lhs, const year_month_weekday& __rhs) noexcept {
+ return __lhs.year() == __rhs.year() && __lhs.month() == __rhs.month() &&
+ __lhs.weekday_indexed() == __rhs.weekday_indexed();
+}
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-year_month_weekday operator/(int __lhs, const month_weekday& __rhs) noexcept
-{ return year(__lhs) / __rhs; }
+_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_weekday
+operator/(const year_month& __lhs, const weekday_indexed& __rhs) noexcept {
+ return year_month_weekday{__lhs.year(), __lhs.month(), __rhs};
+}
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-year_month_weekday operator/(const month_weekday& __lhs, const year& __rhs) noexcept
-{ return __rhs / __lhs; }
+_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_weekday
+operator/(const year& __lhs, const month_weekday& __rhs) noexcept {
+ return year_month_weekday{__lhs, __rhs.month(), __rhs.weekday_indexed()};
+}
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-year_month_weekday operator/(const month_weekday& __lhs, int __rhs) noexcept
-{ return year(__rhs) / __lhs; }
+_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_weekday operator/(int __lhs, const month_weekday& __rhs) noexcept {
+ return year(__lhs) / __rhs;
+}
+_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_weekday
+operator/(const month_weekday& __lhs, const year& __rhs) noexcept {
+ return __rhs / __lhs;
+}
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-year_month_weekday operator+(const year_month_weekday& __lhs, const months& __rhs) noexcept
-{ return (__lhs.year() / __lhs.month() + __rhs) / __lhs.weekday_indexed(); }
+_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_weekday operator/(const month_weekday& __lhs, int __rhs) noexcept {
+ return year(__rhs) / __lhs;
+}
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-year_month_weekday operator+(const months& __lhs, const year_month_weekday& __rhs) noexcept
-{ return __rhs + __lhs; }
+_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_weekday
+operator+(const year_month_weekday& __lhs, const months& __rhs) noexcept {
+ return (__lhs.year() / __lhs.month() + __rhs) / __lhs.weekday_indexed();
+}
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-year_month_weekday operator-(const year_month_weekday& __lhs, const months& __rhs) noexcept
-{ return __lhs + (-__rhs); }
+_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_weekday
+operator+(const months& __lhs, const year_month_weekday& __rhs) noexcept {
+ return __rhs + __lhs;
+}
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-year_month_weekday operator+(const year_month_weekday& __lhs, const years& __rhs) noexcept
-{ return year_month_weekday{__lhs.year() + __rhs, __lhs.month(), __lhs.weekday_indexed()}; }
+_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_weekday
+operator-(const year_month_weekday& __lhs, const months& __rhs) noexcept {
+ return __lhs + (-__rhs);
+}
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-year_month_weekday operator+(const years& __lhs, const year_month_weekday& __rhs) noexcept
-{ return __rhs + __lhs; }
+_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_weekday
+operator+(const year_month_weekday& __lhs, const years& __rhs) noexcept {
+ return year_month_weekday{__lhs.year() + __rhs, __lhs.month(), __lhs.weekday_indexed()};
+}
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-year_month_weekday operator-(const year_month_weekday& __lhs, const years& __rhs) noexcept
-{ return __lhs + (-__rhs); }
+_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_weekday
+operator+(const years& __lhs, const year_month_weekday& __rhs) noexcept {
+ return __rhs + __lhs;
+}
+_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_weekday
+operator-(const year_month_weekday& __lhs, const years& __rhs) noexcept {
+ return __lhs + (-__rhs);
+}
-_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_weekday& year_month_weekday::operator+=(const months& __dm) noexcept { *this = *this + __dm; return *this; }
-_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_weekday& year_month_weekday::operator-=(const months& __dm) noexcept { *this = *this - __dm; return *this; }
-_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_weekday& year_month_weekday::operator+=(const years& __dy) noexcept { *this = *this + __dy; return *this; }
-_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_weekday& year_month_weekday::operator-=(const years& __dy) noexcept { *this = *this - __dy; return *this; }
+_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_weekday& year_month_weekday::operator+=(const months& __dm) noexcept {
+ *this = *this + __dm;
+ return *this;
+}
+_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_weekday& year_month_weekday::operator-=(const months& __dm) noexcept {
+ *this = *this - __dm;
+ return *this;
+}
+_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_weekday& year_month_weekday::operator+=(const years& __dy) noexcept {
+ *this = *this + __dy;
+ return *this;
+}
+_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_weekday& year_month_weekday::operator-=(const years& __dy) noexcept {
+ *this = *this - __dy;
+ return *this;
+}
class year_month_weekday_last {
private:
- chrono::year __y_;
- chrono::month __m_;
- chrono::weekday_last __wdl_;
-public:
- _LIBCPP_HIDE_FROM_ABI constexpr year_month_weekday_last(const chrono::year& __yval, const chrono::month& __mval,
- const chrono::weekday_last& __wdlval) noexcept
- : __y_{__yval}, __m_{__mval}, __wdl_{__wdlval} {}
- _LIBCPP_HIDE_FROM_ABI constexpr year_month_weekday_last& operator+=(const months& __dm) noexcept;
- _LIBCPP_HIDE_FROM_ABI constexpr year_month_weekday_last& operator-=(const months& __dm) noexcept;
- _LIBCPP_HIDE_FROM_ABI constexpr year_month_weekday_last& operator+=(const years& __dy) noexcept;
- _LIBCPP_HIDE_FROM_ABI constexpr year_month_weekday_last& operator-=(const years& __dy) noexcept;
-
- _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::year year() const noexcept { return __y_; }
- _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::month month() const noexcept { return __m_; }
- _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::weekday weekday() const noexcept { return __wdl_.weekday(); }
- _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::weekday_last weekday_last() const noexcept { return __wdl_; }
- _LIBCPP_HIDE_FROM_ABI inline constexpr operator sys_days() const noexcept { return sys_days{__to_days()}; }
- _LIBCPP_HIDE_FROM_ABI inline explicit constexpr operator local_days() const noexcept { return local_days{__to_days()}; }
- _LIBCPP_HIDE_FROM_ABI inline constexpr bool ok() const noexcept { return __y_.ok() && __m_.ok() && __wdl_.ok(); }
-
- _LIBCPP_HIDE_FROM_ABI constexpr days __to_days() const noexcept;
+ chrono::year __y_;
+ chrono::month __m_;
+ chrono::weekday_last __wdl_;
+public:
+ _LIBCPP_HIDE_FROM_ABI constexpr year_month_weekday_last(
+ const chrono::year& __yval, const chrono::month& __mval, const chrono::weekday_last& __wdlval) noexcept
+ : __y_{__yval}, __m_{__mval}, __wdl_{__wdlval} {}
+ _LIBCPP_HIDE_FROM_ABI constexpr year_month_weekday_last& operator+=(const months& __dm) noexcept;
+ _LIBCPP_HIDE_FROM_ABI constexpr year_month_weekday_last& operator-=(const months& __dm) noexcept;
+ _LIBCPP_HIDE_FROM_ABI constexpr year_month_weekday_last& operator+=(const years& __dy) noexcept;
+ _LIBCPP_HIDE_FROM_ABI constexpr year_month_weekday_last& operator-=(const years& __dy) noexcept;
+
+ _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::year year() const noexcept { return __y_; }
+ _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::month month() const noexcept { return __m_; }
+ _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::weekday weekday() const noexcept { return __wdl_.weekday(); }
+ _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::weekday_last weekday_last() const noexcept { return __wdl_; }
+ _LIBCPP_HIDE_FROM_ABI inline constexpr operator sys_days() const noexcept { return sys_days{__to_days()}; }
+ _LIBCPP_HIDE_FROM_ABI inline explicit constexpr operator local_days() const noexcept {
+ return local_days{__to_days()};
+ }
+ _LIBCPP_HIDE_FROM_ABI inline constexpr bool ok() const noexcept { return __y_.ok() && __m_.ok() && __wdl_.ok(); }
+
+ _LIBCPP_HIDE_FROM_ABI constexpr days __to_days() const noexcept;
};
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-days year_month_weekday_last::__to_days() const noexcept
-{
- const sys_days __last = sys_days{__y_/__m_/last};
- return (__last - (chrono::weekday{__last} - __wdl_.weekday())).time_since_epoch();
-
+_LIBCPP_HIDE_FROM_ABI inline constexpr days year_month_weekday_last::__to_days() const noexcept {
+ const sys_days __last = sys_days{__y_ / __m_ / last};
+ return (__last - (chrono::weekday{__last} - __wdl_.weekday())).time_since_epoch();
}
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-bool operator==(const year_month_weekday_last& __lhs, const year_month_weekday_last& __rhs) noexcept
-{ return __lhs.year() == __rhs.year() && __lhs.month() == __rhs.month() && __lhs.weekday_last() == __rhs.weekday_last(); }
-
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-year_month_weekday_last operator/(const year_month& __lhs, const weekday_last& __rhs) noexcept
-{ return year_month_weekday_last{__lhs.year(), __lhs.month(), __rhs}; }
+_LIBCPP_HIDE_FROM_ABI inline constexpr bool
+operator==(const year_month_weekday_last& __lhs, const year_month_weekday_last& __rhs) noexcept {
+ return __lhs.year() == __rhs.year() && __lhs.month() == __rhs.month() && __lhs.weekday_last() == __rhs.weekday_last();
+}
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-year_month_weekday_last operator/(const year& __lhs, const month_weekday_last& __rhs) noexcept
-{ return year_month_weekday_last{__lhs, __rhs.month(), __rhs.weekday_last()}; }
+_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_weekday_last
+operator/(const year_month& __lhs, const weekday_last& __rhs) noexcept {
+ return year_month_weekday_last{__lhs.year(), __lhs.month(), __rhs};
+}
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-year_month_weekday_last operator/(int __lhs, const month_weekday_last& __rhs) noexcept
-{ return year(__lhs) / __rhs; }
+_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_weekday_last
+operator/(const year& __lhs, const month_weekday_last& __rhs) noexcept {
+ return year_month_weekday_last{__lhs, __rhs.month(), __rhs.weekday_last()};
+}
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-year_month_weekday_last operator/(const month_weekday_last& __lhs, const year& __rhs) noexcept
-{ return __rhs / __lhs; }
+_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_weekday_last
+operator/(int __lhs, const month_weekday_last& __rhs) noexcept {
+ return year(__lhs) / __rhs;
+}
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-year_month_weekday_last operator/(const month_weekday_last& __lhs, int __rhs) noexcept
-{ return year(__rhs) / __lhs; }
+_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_weekday_last
+operator/(const month_weekday_last& __lhs, const year& __rhs) noexcept {
+ return __rhs / __lhs;
+}
+_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_weekday_last
+operator/(const month_weekday_last& __lhs, int __rhs) noexcept {
+ return year(__rhs) / __lhs;
+}
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-year_month_weekday_last operator+(const year_month_weekday_last& __lhs, const months& __rhs) noexcept
-{ return (__lhs.year() / __lhs.month() + __rhs) / __lhs.weekday_last(); }
+_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_weekday_last
+operator+(const year_month_weekday_last& __lhs, const months& __rhs) noexcept {
+ return (__lhs.year() / __lhs.month() + __rhs) / __lhs.weekday_last();
+}
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-year_month_weekday_last operator+(const months& __lhs, const year_month_weekday_last& __rhs) noexcept
-{ return __rhs + __lhs; }
+_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_weekday_last
+operator+(const months& __lhs, const year_month_weekday_last& __rhs) noexcept {
+ return __rhs + __lhs;
+}
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-year_month_weekday_last operator-(const year_month_weekday_last& __lhs, const months& __rhs) noexcept
-{ return __lhs + (-__rhs); }
+_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_weekday_last
+operator-(const year_month_weekday_last& __lhs, const months& __rhs) noexcept {
+ return __lhs + (-__rhs);
+}
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-year_month_weekday_last operator+(const year_month_weekday_last& __lhs, const years& __rhs) noexcept
-{ return year_month_weekday_last{__lhs.year() + __rhs, __lhs.month(), __lhs.weekday_last()}; }
+_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_weekday_last
+operator+(const year_month_weekday_last& __lhs, const years& __rhs) noexcept {
+ return year_month_weekday_last{__lhs.year() + __rhs, __lhs.month(), __lhs.weekday_last()};
+}
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-year_month_weekday_last operator+(const years& __lhs, const year_month_weekday_last& __rhs) noexcept
-{ return __rhs + __lhs; }
+_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_weekday_last
+operator+(const years& __lhs, const year_month_weekday_last& __rhs) noexcept {
+ return __rhs + __lhs;
+}
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-year_month_weekday_last operator-(const year_month_weekday_last& __lhs, const years& __rhs) noexcept
-{ return __lhs + (-__rhs); }
+_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_weekday_last
+operator-(const year_month_weekday_last& __lhs, const years& __rhs) noexcept {
+ return __lhs + (-__rhs);
+}
-_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_weekday_last& year_month_weekday_last::operator+=(const months& __dm) noexcept { *this = *this + __dm; return *this; }
-_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_weekday_last& year_month_weekday_last::operator-=(const months& __dm) noexcept { *this = *this - __dm; return *this; }
-_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_weekday_last& year_month_weekday_last::operator+=(const years& __dy) noexcept { *this = *this + __dy; return *this; }
-_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_weekday_last& year_month_weekday_last::operator-=(const years& __dy) noexcept { *this = *this - __dy; return *this; }
+_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_weekday_last&
+year_month_weekday_last::operator+=(const months& __dm) noexcept {
+ *this = *this + __dm;
+ return *this;
+}
+_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_weekday_last&
+year_month_weekday_last::operator-=(const months& __dm) noexcept {
+ *this = *this - __dm;
+ return *this;
+}
+_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_weekday_last&
+year_month_weekday_last::operator+=(const years& __dy) noexcept {
+ *this = *this + __dy;
+ return *this;
+}
+_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_weekday_last&
+year_month_weekday_last::operator-=(const years& __dy) noexcept {
+ *this = *this - __dy;
+ return *this;
+}
} // namespace chrono
diff --git a/contrib/llvm-project/libcxx/include/__compare/common_comparison_category.h b/contrib/llvm-project/libcxx/include/__compare/common_comparison_category.h
index 5fad99bf5ce0..7aeb3da03a4f 100644
--- a/contrib/llvm-project/libcxx/include/__compare/common_comparison_category.h
+++ b/contrib/llvm-project/libcxx/include/__compare/common_comparison_category.h
@@ -24,17 +24,10 @@ _LIBCPP_BEGIN_NAMESPACE_STD
namespace __comp_detail {
-enum _ClassifyCompCategory : unsigned {
- _None,
- _PartialOrd,
- _WeakOrd,
- _StrongOrd,
- _CCC_Size
-};
+enum _ClassifyCompCategory : unsigned { _None, _PartialOrd, _WeakOrd, _StrongOrd, _CCC_Size };
template <class _Tp>
-_LIBCPP_HIDE_FROM_ABI
-constexpr _ClassifyCompCategory __type_to_enum() noexcept {
+_LIBCPP_HIDE_FROM_ABI constexpr _ClassifyCompCategory __type_to_enum() noexcept {
if (is_same_v<_Tp, partial_ordering>)
return _PartialOrd;
if (is_same_v<_Tp, weak_ordering>)
@@ -45,8 +38,7 @@ constexpr _ClassifyCompCategory __type_to_enum() noexcept {
}
template <size_t _Size>
-_LIBCPP_HIDE_FROM_ABI
-constexpr _ClassifyCompCategory
+_LIBCPP_HIDE_FROM_ABI constexpr _ClassifyCompCategory
__compute_comp_type(const _ClassifyCompCategory (&__types)[_Size]) {
int __seen[_CCC_Size] = {};
for (auto __type : __types)
@@ -60,12 +52,11 @@ __compute_comp_type(const _ClassifyCompCategory (&__types)[_Size]) {
return _StrongOrd;
}
-template <class ..._Ts, bool _False = false>
-_LIBCPP_HIDE_FROM_ABI
-constexpr auto __get_comp_type() {
- using _CCC = _ClassifyCompCategory;
+template <class... _Ts, bool _False = false>
+_LIBCPP_HIDE_FROM_ABI constexpr auto __get_comp_type() {
+ using _CCC = _ClassifyCompCategory;
constexpr _CCC __type_kinds[] = {_StrongOrd, __type_to_enum<_Ts>()...};
- constexpr _CCC __cat = __comp_detail::__compute_comp_type(__type_kinds);
+ constexpr _CCC __cat = __comp_detail::__compute_comp_type(__type_kinds);
if constexpr (__cat == _None)
return void();
else if constexpr (__cat == _PartialOrd)
@@ -80,12 +71,12 @@ constexpr auto __get_comp_type() {
} // namespace __comp_detail
// [cmp.common], common comparison category type
-template<class... _Ts>
+template <class... _Ts>
struct _LIBCPP_TEMPLATE_VIS common_comparison_category {
using type = decltype(__comp_detail::__get_comp_type<_Ts...>());
};
-template<class... _Ts>
+template <class... _Ts>
using common_comparison_category_t = typename common_comparison_category<_Ts...>::type;
#endif // _LIBCPP_STD_VER >= 20
diff --git a/contrib/llvm-project/libcxx/include/__compare/compare_partial_order_fallback.h b/contrib/llvm-project/libcxx/include/__compare/compare_partial_order_fallback.h
index a49408e1cfda..e0efa3ccb88d 100644
--- a/contrib/llvm-project/libcxx/include/__compare/compare_partial_order_fallback.h
+++ b/contrib/llvm-project/libcxx/include/__compare/compare_partial_order_fallback.h
@@ -27,44 +27,46 @@ _LIBCPP_BEGIN_NAMESPACE_STD
// [cmp.alg]
namespace __compare_partial_order_fallback {
- struct __fn {
- template<class _Tp, class _Up>
- requires is_same_v<decay_t<_Tp>, decay_t<_Up>>
- _LIBCPP_HIDE_FROM_ABI static constexpr auto
- __go(_Tp&& __t, _Up&& __u, __priority_tag<1>)
- noexcept(noexcept(std::partial_order(std::forward<_Tp>(__t), std::forward<_Up>(__u))))
- -> decltype( std::partial_order(std::forward<_Tp>(__t), std::forward<_Up>(__u)))
- { return std::partial_order(std::forward<_Tp>(__t), std::forward<_Up>(__u)); }
+struct __fn {
+ template <class _Tp, class _Up>
+ requires is_same_v<decay_t<_Tp>, decay_t<_Up>>
+ _LIBCPP_HIDE_FROM_ABI static constexpr auto __go(_Tp&& __t, _Up&& __u, __priority_tag<1>) noexcept(
+ noexcept(std::partial_order(std::forward<_Tp>(__t), std::forward<_Up>(__u))))
+ -> decltype(std::partial_order(std::forward<_Tp>(__t), std::forward<_Up>(__u))) {
+ return std::partial_order(std::forward<_Tp>(__t), std::forward<_Up>(__u));
+ }
- template<class _Tp, class _Up>
- requires is_same_v<decay_t<_Tp>, decay_t<_Up>>
- _LIBCPP_HIDE_FROM_ABI static constexpr auto
- __go(_Tp&& __t, _Up&& __u, __priority_tag<0>)
- noexcept(noexcept(std::forward<_Tp>(__t) == std::forward<_Up>(__u) ? partial_ordering::equivalent :
- std::forward<_Tp>(__t) < std::forward<_Up>(__u) ? partial_ordering::less :
- std::forward<_Up>(__u) < std::forward<_Tp>(__t) ? partial_ordering::greater :
- partial_ordering::unordered))
- -> decltype( std::forward<_Tp>(__t) == std::forward<_Up>(__u) ? partial_ordering::equivalent :
- std::forward<_Tp>(__t) < std::forward<_Up>(__u) ? partial_ordering::less :
- std::forward<_Up>(__u) < std::forward<_Tp>(__t) ? partial_ordering::greater :
- partial_ordering::unordered)
- {
- return std::forward<_Tp>(__t) == std::forward<_Up>(__u) ? partial_ordering::equivalent :
- std::forward<_Tp>(__t) < std::forward<_Up>(__u) ? partial_ordering::less :
- std::forward<_Up>(__u) < std::forward<_Tp>(__t) ? partial_ordering::greater :
- partial_ordering::unordered;
- }
+ template <class _Tp, class _Up>
+ requires is_same_v<decay_t<_Tp>, decay_t<_Up>>
+ _LIBCPP_HIDE_FROM_ABI static constexpr auto __go(_Tp&& __t, _Up&& __u, __priority_tag<0>) noexcept(noexcept(
+ std::forward<_Tp>(__t) == std::forward<_Up>(__u) ? partial_ordering::equivalent
+ : std::forward<_Tp>(__t) < std::forward<_Up>(__u) ? partial_ordering::less
+ : std::forward<_Up>(__u) < std::forward<_Tp>(__t)
+ ? partial_ordering::greater
+ : partial_ordering::unordered))
+ -> decltype(std::forward<_Tp>(__t) == std::forward<_Up>(__u) ? partial_ordering::equivalent
+ : std::forward<_Tp>(__t) < std::forward<_Up>(__u) ? partial_ordering::less
+ : std::forward<_Up>(__u) < std::forward<_Tp>(__t)
+ ? partial_ordering::greater
+ : partial_ordering::unordered) {
+ return std::forward<_Tp>(__t) == std::forward<_Up>(__u) ? partial_ordering::equivalent
+ : std::forward<_Tp>(__t) < std::forward<_Up>(__u) ? partial_ordering::less
+ : std::forward<_Up>(__u) < std::forward<_Tp>(__t)
+ ? partial_ordering::greater
+ : partial_ordering::unordered;
+ }
- template<class _Tp, class _Up>
- _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t, _Up&& __u) const
- noexcept(noexcept(__go(std::forward<_Tp>(__t), std::forward<_Up>(__u), __priority_tag<1>())))
- -> decltype( __go(std::forward<_Tp>(__t), std::forward<_Up>(__u), __priority_tag<1>()))
- { return __go(std::forward<_Tp>(__t), std::forward<_Up>(__u), __priority_tag<1>()); }
- };
+ template <class _Tp, class _Up>
+ _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t, _Up&& __u) const
+ noexcept(noexcept(__go(std::forward<_Tp>(__t), std::forward<_Up>(__u), __priority_tag<1>())))
+ -> decltype(__go(std::forward<_Tp>(__t), std::forward<_Up>(__u), __priority_tag<1>())) {
+ return __go(std::forward<_Tp>(__t), std::forward<_Up>(__u), __priority_tag<1>());
+ }
+};
} // namespace __compare_partial_order_fallback
inline namespace __cpo {
- inline constexpr auto compare_partial_order_fallback = __compare_partial_order_fallback::__fn{};
+inline constexpr auto compare_partial_order_fallback = __compare_partial_order_fallback::__fn{};
} // namespace __cpo
#endif // _LIBCPP_STD_VER >= 20
diff --git a/contrib/llvm-project/libcxx/include/__compare/compare_strong_order_fallback.h b/contrib/llvm-project/libcxx/include/__compare/compare_strong_order_fallback.h
index 9e2dfee6b389..a94d517ed30f 100644
--- a/contrib/llvm-project/libcxx/include/__compare/compare_strong_order_fallback.h
+++ b/contrib/llvm-project/libcxx/include/__compare/compare_strong_order_fallback.h
@@ -27,41 +27,43 @@ _LIBCPP_BEGIN_NAMESPACE_STD
// [cmp.alg]
namespace __compare_strong_order_fallback {
- struct __fn {
- template<class _Tp, class _Up>
- requires is_same_v<decay_t<_Tp>, decay_t<_Up>>
- _LIBCPP_HIDE_FROM_ABI static constexpr auto
- __go(_Tp&& __t, _Up&& __u, __priority_tag<1>)
- noexcept(noexcept(std::strong_order(std::forward<_Tp>(__t), std::forward<_Up>(__u))))
- -> decltype( std::strong_order(std::forward<_Tp>(__t), std::forward<_Up>(__u)))
- { return std::strong_order(std::forward<_Tp>(__t), std::forward<_Up>(__u)); }
+struct __fn {
+ template <class _Tp, class _Up>
+ requires is_same_v<decay_t<_Tp>, decay_t<_Up>>
+ _LIBCPP_HIDE_FROM_ABI static constexpr auto __go(_Tp&& __t, _Up&& __u, __priority_tag<1>) noexcept(
+ noexcept(std::strong_order(std::forward<_Tp>(__t), std::forward<_Up>(__u))))
+ -> decltype(std::strong_order(std::forward<_Tp>(__t), std::forward<_Up>(__u))) {
+ return std::strong_order(std::forward<_Tp>(__t), std::forward<_Up>(__u));
+ }
- template<class _Tp, class _Up>
- requires is_same_v<decay_t<_Tp>, decay_t<_Up>>
- _LIBCPP_HIDE_FROM_ABI static constexpr auto
- __go(_Tp&& __t, _Up&& __u, __priority_tag<0>)
- noexcept(noexcept(std::forward<_Tp>(__t) == std::forward<_Up>(__u) ? strong_ordering::equal :
- std::forward<_Tp>(__t) < std::forward<_Up>(__u) ? strong_ordering::less :
- strong_ordering::greater))
- -> decltype( std::forward<_Tp>(__t) == std::forward<_Up>(__u) ? strong_ordering::equal :
- std::forward<_Tp>(__t) < std::forward<_Up>(__u) ? strong_ordering::less :
- strong_ordering::greater)
- {
- return std::forward<_Tp>(__t) == std::forward<_Up>(__u) ? strong_ordering::equal :
- std::forward<_Tp>(__t) < std::forward<_Up>(__u) ? strong_ordering::less :
- strong_ordering::greater;
- }
+ template <class _Tp, class _Up>
+ requires is_same_v<decay_t<_Tp>, decay_t<_Up>>
+ _LIBCPP_HIDE_FROM_ABI static constexpr auto __go(_Tp&& __t, _Up&& __u, __priority_tag<0>) noexcept(noexcept(
+ std::forward<_Tp>(__t) == std::forward<_Up>(__u) ? strong_ordering::equal
+ : std::forward<_Tp>(__t) < std::forward<_Up>(__u)
+ ? strong_ordering::less
+ : strong_ordering::greater))
+ -> decltype(std::forward<_Tp>(__t) == std::forward<_Up>(__u) ? strong_ordering::equal
+ : std::forward<_Tp>(__t) < std::forward<_Up>(__u)
+ ? strong_ordering::less
+ : strong_ordering::greater) {
+ return std::forward<_Tp>(__t) == std::forward<_Up>(__u) ? strong_ordering::equal
+ : std::forward<_Tp>(__t) < std::forward<_Up>(__u)
+ ? strong_ordering::less
+ : strong_ordering::greater;
+ }
- template<class _Tp, class _Up>
- _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t, _Up&& __u) const
- noexcept(noexcept(__go(std::forward<_Tp>(__t), std::forward<_Up>(__u), __priority_tag<1>())))
- -> decltype( __go(std::forward<_Tp>(__t), std::forward<_Up>(__u), __priority_tag<1>()))
- { return __go(std::forward<_Tp>(__t), std::forward<_Up>(__u), __priority_tag<1>()); }
- };
+ template <class _Tp, class _Up>
+ _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t, _Up&& __u) const
+ noexcept(noexcept(__go(std::forward<_Tp>(__t), std::forward<_Up>(__u), __priority_tag<1>())))
+ -> decltype(__go(std::forward<_Tp>(__t), std::forward<_Up>(__u), __priority_tag<1>())) {
+ return __go(std::forward<_Tp>(__t), std::forward<_Up>(__u), __priority_tag<1>());
+ }
+};
} // namespace __compare_strong_order_fallback
inline namespace __cpo {
- inline constexpr auto compare_strong_order_fallback = __compare_strong_order_fallback::__fn{};
+inline constexpr auto compare_strong_order_fallback = __compare_strong_order_fallback::__fn{};
} // namespace __cpo
#endif // _LIBCPP_STD_VER >= 20
diff --git a/contrib/llvm-project/libcxx/include/__compare/compare_three_way.h b/contrib/llvm-project/libcxx/include/__compare/compare_three_way.h
index b1ed2d1e7251..01c12076c0d7 100644
--- a/contrib/llvm-project/libcxx/include/__compare/compare_three_way.h
+++ b/contrib/llvm-project/libcxx/include/__compare/compare_three_way.h
@@ -22,16 +22,15 @@ _LIBCPP_BEGIN_NAMESPACE_STD
#if _LIBCPP_STD_VER >= 20
-struct _LIBCPP_TEMPLATE_VIS compare_three_way
-{
- template<class _T1, class _T2>
- requires three_way_comparable_with<_T1, _T2>
- constexpr _LIBCPP_HIDE_FROM_ABI
- auto operator()(_T1&& __t, _T2&& __u) const
- noexcept(noexcept(std::forward<_T1>(__t) <=> std::forward<_T2>(__u)))
- { return std::forward<_T1>(__t) <=> std::forward<_T2>(__u); }
-
- using is_transparent = void;
+struct _LIBCPP_TEMPLATE_VIS compare_three_way {
+ template <class _T1, class _T2>
+ requires three_way_comparable_with<_T1, _T2>
+ constexpr _LIBCPP_HIDE_FROM_ABI auto operator()(_T1&& __t, _T2&& __u) const
+ noexcept(noexcept(std::forward<_T1>(__t) <=> std::forward<_T2>(__u))) {
+ return std::forward<_T1>(__t) <=> std::forward<_T2>(__u);
+ }
+
+ using is_transparent = void;
};
#endif // _LIBCPP_STD_VER >= 20
diff --git a/contrib/llvm-project/libcxx/include/__compare/compare_three_way_result.h b/contrib/llvm-project/libcxx/include/__compare/compare_three_way_result.h
index 632ebdce1bce..d7508073433a 100644
--- a/contrib/llvm-project/libcxx/include/__compare/compare_three_way_result.h
+++ b/contrib/llvm-project/libcxx/include/__compare/compare_three_way_result.h
@@ -21,20 +21,21 @@ _LIBCPP_BEGIN_NAMESPACE_STD
#if _LIBCPP_STD_VER >= 20
-template<class, class, class>
-struct _LIBCPP_HIDE_FROM_ABI __compare_three_way_result { };
-
-template<class _Tp, class _Up>
-struct _LIBCPP_HIDE_FROM_ABI __compare_three_way_result<_Tp, _Up, decltype(
- std::declval<__make_const_lvalue_ref<_Tp>>() <=> std::declval<__make_const_lvalue_ref<_Up>>(), void()
-)> {
- using type = decltype(std::declval<__make_const_lvalue_ref<_Tp>>() <=> std::declval<__make_const_lvalue_ref<_Up>>());
+template <class, class, class>
+struct _LIBCPP_HIDE_FROM_ABI __compare_three_way_result {};
+
+template <class _Tp, class _Up>
+struct _LIBCPP_HIDE_FROM_ABI __compare_three_way_result<
+ _Tp,
+ _Up,
+ decltype(std::declval<__make_const_lvalue_ref<_Tp>>() <=> std::declval<__make_const_lvalue_ref<_Up>>(), void())> {
+ using type = decltype(std::declval<__make_const_lvalue_ref<_Tp>>() <=> std::declval<__make_const_lvalue_ref<_Up>>());
};
-template<class _Tp, class _Up = _Tp>
-struct _LIBCPP_TEMPLATE_VIS compare_three_way_result : __compare_three_way_result<_Tp, _Up, void> { };
+template <class _Tp, class _Up = _Tp>
+struct _LIBCPP_TEMPLATE_VIS compare_three_way_result : __compare_three_way_result<_Tp, _Up, void> {};
-template<class _Tp, class _Up = _Tp>
+template <class _Tp, class _Up = _Tp>
using compare_three_way_result_t = typename compare_three_way_result<_Tp, _Up>::type;
#endif // _LIBCPP_STD_VER >= 20
diff --git a/contrib/llvm-project/libcxx/include/__compare/compare_weak_order_fallback.h b/contrib/llvm-project/libcxx/include/__compare/compare_weak_order_fallback.h
index b0a04abcaaf0..062b7b582cd7 100644
--- a/contrib/llvm-project/libcxx/include/__compare/compare_weak_order_fallback.h
+++ b/contrib/llvm-project/libcxx/include/__compare/compare_weak_order_fallback.h
@@ -27,41 +27,43 @@ _LIBCPP_BEGIN_NAMESPACE_STD
// [cmp.alg]
namespace __compare_weak_order_fallback {
- struct __fn {
- template<class _Tp, class _Up>
- requires is_same_v<decay_t<_Tp>, decay_t<_Up>>
- _LIBCPP_HIDE_FROM_ABI static constexpr auto
- __go(_Tp&& __t, _Up&& __u, __priority_tag<1>)
- noexcept(noexcept(std::weak_order(std::forward<_Tp>(__t), std::forward<_Up>(__u))))
- -> decltype( std::weak_order(std::forward<_Tp>(__t), std::forward<_Up>(__u)))
- { return std::weak_order(std::forward<_Tp>(__t), std::forward<_Up>(__u)); }
+struct __fn {
+ template <class _Tp, class _Up>
+ requires is_same_v<decay_t<_Tp>, decay_t<_Up>>
+ _LIBCPP_HIDE_FROM_ABI static constexpr auto __go(_Tp&& __t, _Up&& __u, __priority_tag<1>) noexcept(
+ noexcept(std::weak_order(std::forward<_Tp>(__t), std::forward<_Up>(__u))))
+ -> decltype(std::weak_order(std::forward<_Tp>(__t), std::forward<_Up>(__u))) {
+ return std::weak_order(std::forward<_Tp>(__t), std::forward<_Up>(__u));
+ }
- template<class _Tp, class _Up>
- requires is_same_v<decay_t<_Tp>, decay_t<_Up>>
- _LIBCPP_HIDE_FROM_ABI static constexpr auto
- __go(_Tp&& __t, _Up&& __u, __priority_tag<0>)
- noexcept(noexcept(std::forward<_Tp>(__t) == std::forward<_Up>(__u) ? weak_ordering::equivalent :
- std::forward<_Tp>(__t) < std::forward<_Up>(__u) ? weak_ordering::less :
- weak_ordering::greater))
- -> decltype( std::forward<_Tp>(__t) == std::forward<_Up>(__u) ? weak_ordering::equivalent :
- std::forward<_Tp>(__t) < std::forward<_Up>(__u) ? weak_ordering::less :
- weak_ordering::greater)
- {
- return std::forward<_Tp>(__t) == std::forward<_Up>(__u) ? weak_ordering::equivalent :
- std::forward<_Tp>(__t) < std::forward<_Up>(__u) ? weak_ordering::less :
- weak_ordering::greater;
- }
+ template <class _Tp, class _Up>
+ requires is_same_v<decay_t<_Tp>, decay_t<_Up>>
+ _LIBCPP_HIDE_FROM_ABI static constexpr auto __go(_Tp&& __t, _Up&& __u, __priority_tag<0>) noexcept(noexcept(
+ std::forward<_Tp>(__t) == std::forward<_Up>(__u) ? weak_ordering::equivalent
+ : std::forward<_Tp>(__t) < std::forward<_Up>(__u)
+ ? weak_ordering::less
+ : weak_ordering::greater))
+ -> decltype(std::forward<_Tp>(__t) == std::forward<_Up>(__u) ? weak_ordering::equivalent
+ : std::forward<_Tp>(__t) < std::forward<_Up>(__u)
+ ? weak_ordering::less
+ : weak_ordering::greater) {
+ return std::forward<_Tp>(__t) == std::forward<_Up>(__u) ? weak_ordering::equivalent
+ : std::forward<_Tp>(__t) < std::forward<_Up>(__u)
+ ? weak_ordering::less
+ : weak_ordering::greater;
+ }
- template<class _Tp, class _Up>
- _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t, _Up&& __u) const
- noexcept(noexcept(__go(std::forward<_Tp>(__t), std::forward<_Up>(__u), __priority_tag<1>())))
- -> decltype( __go(std::forward<_Tp>(__t), std::forward<_Up>(__u), __priority_tag<1>()))
- { return __go(std::forward<_Tp>(__t), std::forward<_Up>(__u), __priority_tag<1>()); }
- };
+ template <class _Tp, class _Up>
+ _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t, _Up&& __u) const
+ noexcept(noexcept(__go(std::forward<_Tp>(__t), std::forward<_Up>(__u), __priority_tag<1>())))
+ -> decltype(__go(std::forward<_Tp>(__t), std::forward<_Up>(__u), __priority_tag<1>())) {
+ return __go(std::forward<_Tp>(__t), std::forward<_Up>(__u), __priority_tag<1>());
+ }
+};
} // namespace __compare_weak_order_fallback
inline namespace __cpo {
- inline constexpr auto compare_weak_order_fallback = __compare_weak_order_fallback::__fn{};
+inline constexpr auto compare_weak_order_fallback = __compare_weak_order_fallback::__fn{};
} // namespace __cpo
#endif // _LIBCPP_STD_VER >= 20
diff --git a/contrib/llvm-project/libcxx/include/__compare/ordering.h b/contrib/llvm-project/libcxx/include/__compare/ordering.h
index c9a15efb3c2f..2995d381304f 100644
--- a/contrib/llvm-project/libcxx/include/__compare/ordering.h
+++ b/contrib/llvm-project/libcxx/include/__compare/ordering.h
@@ -22,46 +22,35 @@ _LIBCPP_BEGIN_NAMESPACE_STD
#if _LIBCPP_STD_VER >= 20
// exposition only
-enum class _OrdResult : signed char {
- __less = -1,
- __equiv = 0,
- __greater = 1
-};
+enum class _OrdResult : signed char { __less = -1, __equiv = 0, __greater = 1 };
-enum class _NCmpResult : signed char {
- __unordered = -127
-};
+enum class _NCmpResult : signed char { __unordered = -127 };
class partial_ordering;
class weak_ordering;
class strong_ordering;
-template<class _Tp, class... _Args>
+template <class _Tp, class... _Args>
inline constexpr bool __one_of_v = (is_same_v<_Tp, _Args> || ...);
struct _CmpUnspecifiedParam {
- _LIBCPP_HIDE_FROM_ABI constexpr
- _CmpUnspecifiedParam(int _CmpUnspecifiedParam::*) noexcept {}
+ _LIBCPP_HIDE_FROM_ABI constexpr _CmpUnspecifiedParam(int _CmpUnspecifiedParam::*) noexcept {}
- template<class _Tp, class = enable_if_t<!__one_of_v<_Tp, int, partial_ordering, weak_ordering, strong_ordering>>>
+ template <class _Tp, class = enable_if_t<!__one_of_v<_Tp, int, partial_ordering, weak_ordering, strong_ordering>>>
_CmpUnspecifiedParam(_Tp) = delete;
};
class partial_ordering {
using _ValueT = signed char;
- _LIBCPP_HIDE_FROM_ABI
- explicit constexpr partial_ordering(_OrdResult __v) noexcept
- : __value_(_ValueT(__v)) {}
+ _LIBCPP_HIDE_FROM_ABI explicit constexpr partial_ordering(_OrdResult __v) noexcept : __value_(_ValueT(__v)) {}
- _LIBCPP_HIDE_FROM_ABI
- explicit constexpr partial_ordering(_NCmpResult __v) noexcept
- : __value_(_ValueT(__v)) {}
+ _LIBCPP_HIDE_FROM_ABI explicit constexpr partial_ordering(_NCmpResult __v) noexcept : __value_(_ValueT(__v)) {}
- _LIBCPP_HIDE_FROM_ABI
- constexpr bool __is_ordered() const noexcept {
+ _LIBCPP_HIDE_FROM_ABI constexpr bool __is_ordered() const noexcept {
return __value_ != _ValueT(_NCmpResult::__unordered);
}
+
public:
// valid values
static const partial_ordering less;
@@ -70,63 +59,54 @@ public:
static const partial_ordering unordered;
// comparisons
- _LIBCPP_HIDE_FROM_ABI
- friend constexpr bool operator==(partial_ordering, partial_ordering) noexcept = default;
+ _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator==(partial_ordering, partial_ordering) noexcept = default;
- _LIBCPP_HIDE_FROM_ABI
- friend constexpr bool operator==(partial_ordering __v, _CmpUnspecifiedParam) noexcept {
+ _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator==(partial_ordering __v, _CmpUnspecifiedParam) noexcept {
return __v.__is_ordered() && __v.__value_ == 0;
}
- _LIBCPP_HIDE_FROM_ABI
- friend constexpr bool operator< (partial_ordering __v, _CmpUnspecifiedParam) noexcept {
+ _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator<(partial_ordering __v, _CmpUnspecifiedParam) noexcept {
return __v.__is_ordered() && __v.__value_ < 0;
}
- _LIBCPP_HIDE_FROM_ABI
- friend constexpr bool operator<=(partial_ordering __v, _CmpUnspecifiedParam) noexcept {
+ _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator<=(partial_ordering __v, _CmpUnspecifiedParam) noexcept {
return __v.__is_ordered() && __v.__value_ <= 0;
}
- _LIBCPP_HIDE_FROM_ABI
- friend constexpr bool operator> (partial_ordering __v, _CmpUnspecifiedParam) noexcept {
+ _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator>(partial_ordering __v, _CmpUnspecifiedParam) noexcept {
return __v.__is_ordered() && __v.__value_ > 0;
}
- _LIBCPP_HIDE_FROM_ABI
- friend constexpr bool operator>=(partial_ordering __v, _CmpUnspecifiedParam) noexcept {
+ _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator>=(partial_ordering __v, _CmpUnspecifiedParam) noexcept {
return __v.__is_ordered() && __v.__value_ >= 0;
}
- _LIBCPP_HIDE_FROM_ABI
- friend constexpr bool operator< (_CmpUnspecifiedParam, partial_ordering __v) noexcept {
+ _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator<(_CmpUnspecifiedParam, partial_ordering __v) noexcept {
return __v.__is_ordered() && 0 < __v.__value_;
}
- _LIBCPP_HIDE_FROM_ABI
- friend constexpr bool operator<=(_CmpUnspecifiedParam, partial_ordering __v) noexcept {
+ _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator<=(_CmpUnspecifiedParam, partial_ordering __v) noexcept {
return __v.__is_ordered() && 0 <= __v.__value_;
}
- _LIBCPP_HIDE_FROM_ABI
- friend constexpr bool operator> (_CmpUnspecifiedParam, partial_ordering __v) noexcept {
+ _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator>(_CmpUnspecifiedParam, partial_ordering __v) noexcept {
return __v.__is_ordered() && 0 > __v.__value_;
}
- _LIBCPP_HIDE_FROM_ABI
- friend constexpr bool operator>=(_CmpUnspecifiedParam, partial_ordering __v) noexcept {
+ _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator>=(_CmpUnspecifiedParam, partial_ordering __v) noexcept {
return __v.__is_ordered() && 0 >= __v.__value_;
}
- _LIBCPP_HIDE_FROM_ABI
- friend constexpr partial_ordering operator<=>(partial_ordering __v, _CmpUnspecifiedParam) noexcept {
+ _LIBCPP_HIDE_FROM_ABI friend constexpr partial_ordering
+ operator<=>(partial_ordering __v, _CmpUnspecifiedParam) noexcept {
return __v;
}
- _LIBCPP_HIDE_FROM_ABI
- friend constexpr partial_ordering operator<=>(_CmpUnspecifiedParam, partial_ordering __v) noexcept {
+ _LIBCPP_HIDE_FROM_ABI friend constexpr partial_ordering
+ operator<=>(_CmpUnspecifiedParam, partial_ordering __v) noexcept {
return __v < 0 ? partial_ordering::greater : (__v > 0 ? partial_ordering::less : __v);
}
+
private:
_ValueT __value_;
};
@@ -139,76 +119,62 @@ inline constexpr partial_ordering partial_ordering::unordered(_NCmpResult ::__un
class weak_ordering {
using _ValueT = signed char;
- _LIBCPP_HIDE_FROM_ABI
- explicit constexpr weak_ordering(_OrdResult __v) noexcept : __value_(_ValueT(__v)) {}
+ _LIBCPP_HIDE_FROM_ABI explicit constexpr weak_ordering(_OrdResult __v) noexcept : __value_(_ValueT(__v)) {}
public:
static const weak_ordering less;
static const weak_ordering equivalent;
static const weak_ordering greater;
- _LIBCPP_HIDE_FROM_ABI
- constexpr operator partial_ordering() const noexcept {
+ _LIBCPP_HIDE_FROM_ABI constexpr operator partial_ordering() const noexcept {
return __value_ == 0 ? partial_ordering::equivalent
- : (__value_ < 0 ? partial_ordering::less : partial_ordering::greater);
+ : (__value_ < 0 ? partial_ordering::less : partial_ordering::greater);
}
// comparisons
- _LIBCPP_HIDE_FROM_ABI
- friend constexpr bool operator==(weak_ordering, weak_ordering) noexcept = default;
+ _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator==(weak_ordering, weak_ordering) noexcept = default;
- _LIBCPP_HIDE_FROM_ABI
- friend constexpr bool operator==(weak_ordering __v, _CmpUnspecifiedParam) noexcept {
+ _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator==(weak_ordering __v, _CmpUnspecifiedParam) noexcept {
return __v.__value_ == 0;
}
- _LIBCPP_HIDE_FROM_ABI
- friend constexpr bool operator< (weak_ordering __v, _CmpUnspecifiedParam) noexcept {
+ _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator<(weak_ordering __v, _CmpUnspecifiedParam) noexcept {
return __v.__value_ < 0;
}
- _LIBCPP_HIDE_FROM_ABI
- friend constexpr bool operator<=(weak_ordering __v, _CmpUnspecifiedParam) noexcept {
+ _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator<=(weak_ordering __v, _CmpUnspecifiedParam) noexcept {
return __v.__value_ <= 0;
}
- _LIBCPP_HIDE_FROM_ABI
- friend constexpr bool operator> (weak_ordering __v, _CmpUnspecifiedParam) noexcept {
+ _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator>(weak_ordering __v, _CmpUnspecifiedParam) noexcept {
return __v.__value_ > 0;
}
- _LIBCPP_HIDE_FROM_ABI
- friend constexpr bool operator>=(weak_ordering __v, _CmpUnspecifiedParam) noexcept {
+ _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator>=(weak_ordering __v, _CmpUnspecifiedParam) noexcept {
return __v.__value_ >= 0;
}
- _LIBCPP_HIDE_FROM_ABI
- friend constexpr bool operator< (_CmpUnspecifiedParam, weak_ordering __v) noexcept {
+ _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator<(_CmpUnspecifiedParam, weak_ordering __v) noexcept {
return 0 < __v.__value_;
}
- _LIBCPP_HIDE_FROM_ABI
- friend constexpr bool operator<=(_CmpUnspecifiedParam, weak_ordering __v) noexcept {
+ _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator<=(_CmpUnspecifiedParam, weak_ordering __v) noexcept {
return 0 <= __v.__value_;
}
- _LIBCPP_HIDE_FROM_ABI
- friend constexpr bool operator> (_CmpUnspecifiedParam, weak_ordering __v) noexcept {
+ _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator>(_CmpUnspecifiedParam, weak_ordering __v) noexcept {
return 0 > __v.__value_;
}
- _LIBCPP_HIDE_FROM_ABI
- friend constexpr bool operator>=(_CmpUnspecifiedParam, weak_ordering __v) noexcept {
+ _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator>=(_CmpUnspecifiedParam, weak_ordering __v) noexcept {
return 0 >= __v.__value_;
}
- _LIBCPP_HIDE_FROM_ABI
- friend constexpr weak_ordering operator<=>(weak_ordering __v, _CmpUnspecifiedParam) noexcept {
+ _LIBCPP_HIDE_FROM_ABI friend constexpr weak_ordering operator<=>(weak_ordering __v, _CmpUnspecifiedParam) noexcept {
return __v;
}
- _LIBCPP_HIDE_FROM_ABI
- friend constexpr weak_ordering operator<=>(_CmpUnspecifiedParam, weak_ordering __v) noexcept {
+ _LIBCPP_HIDE_FROM_ABI friend constexpr weak_ordering operator<=>(_CmpUnspecifiedParam, weak_ordering __v) noexcept {
return __v < 0 ? weak_ordering::greater : (__v > 0 ? weak_ordering::less : __v);
}
@@ -223,8 +189,7 @@ inline constexpr weak_ordering weak_ordering::greater(_OrdResult::__greater);
class strong_ordering {
using _ValueT = signed char;
- _LIBCPP_HIDE_FROM_ABI
- explicit constexpr strong_ordering(_OrdResult __v) noexcept : __value_(_ValueT(__v)) {}
+ _LIBCPP_HIDE_FROM_ABI explicit constexpr strong_ordering(_OrdResult __v) noexcept : __value_(_ValueT(__v)) {}
public:
static const strong_ordering less;
@@ -233,74 +198,61 @@ public:
static const strong_ordering greater;
// conversions
- _LIBCPP_HIDE_FROM_ABI
- constexpr operator partial_ordering() const noexcept {
+ _LIBCPP_HIDE_FROM_ABI constexpr operator partial_ordering() const noexcept {
return __value_ == 0 ? partial_ordering::equivalent
- : (__value_ < 0 ? partial_ordering::less : partial_ordering::greater);
+ : (__value_ < 0 ? partial_ordering::less : partial_ordering::greater);
}
- _LIBCPP_HIDE_FROM_ABI
- constexpr operator weak_ordering() const noexcept {
- return __value_ == 0 ? weak_ordering::equivalent
- : (__value_ < 0 ? weak_ordering::less : weak_ordering::greater);
+ _LIBCPP_HIDE_FROM_ABI constexpr operator weak_ordering() const noexcept {
+ return __value_ == 0 ? weak_ordering::equivalent : (__value_ < 0 ? weak_ordering::less : weak_ordering::greater);
}
// comparisons
- _LIBCPP_HIDE_FROM_ABI
- friend constexpr bool operator==(strong_ordering, strong_ordering) noexcept = default;
+ _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator==(strong_ordering, strong_ordering) noexcept = default;
- _LIBCPP_HIDE_FROM_ABI
- friend constexpr bool operator==(strong_ordering __v, _CmpUnspecifiedParam) noexcept {
+ _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator==(strong_ordering __v, _CmpUnspecifiedParam) noexcept {
return __v.__value_ == 0;
}
- _LIBCPP_HIDE_FROM_ABI
- friend constexpr bool operator< (strong_ordering __v, _CmpUnspecifiedParam) noexcept {
+ _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator<(strong_ordering __v, _CmpUnspecifiedParam) noexcept {
return __v.__value_ < 0;
}
- _LIBCPP_HIDE_FROM_ABI
- friend constexpr bool operator<=(strong_ordering __v, _CmpUnspecifiedParam) noexcept {
+ _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator<=(strong_ordering __v, _CmpUnspecifiedParam) noexcept {
return __v.__value_ <= 0;
}
- _LIBCPP_HIDE_FROM_ABI
- friend constexpr bool operator> (strong_ordering __v, _CmpUnspecifiedParam) noexcept {
+ _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator>(strong_ordering __v, _CmpUnspecifiedParam) noexcept {
return __v.__value_ > 0;
}
- _LIBCPP_HIDE_FROM_ABI
- friend constexpr bool operator>=(strong_ordering __v, _CmpUnspecifiedParam) noexcept {
+ _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator>=(strong_ordering __v, _CmpUnspecifiedParam) noexcept {
return __v.__value_ >= 0;
}
- _LIBCPP_HIDE_FROM_ABI
- friend constexpr bool operator< (_CmpUnspecifiedParam, strong_ordering __v) noexcept {
+ _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator<(_CmpUnspecifiedParam, strong_ordering __v) noexcept {
return 0 < __v.__value_;
}
- _LIBCPP_HIDE_FROM_ABI
- friend constexpr bool operator<=(_CmpUnspecifiedParam, strong_ordering __v) noexcept {
+ _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator<=(_CmpUnspecifiedParam, strong_ordering __v) noexcept {
return 0 <= __v.__value_;
}
- _LIBCPP_HIDE_FROM_ABI
- friend constexpr bool operator> (_CmpUnspecifiedParam, strong_ordering __v) noexcept {
+ _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator>(_CmpUnspecifiedParam, strong_ordering __v) noexcept {
return 0 > __v.__value_;
}
- _LIBCPP_HIDE_FROM_ABI
- friend constexpr bool operator>=(_CmpUnspecifiedParam, strong_ordering __v) noexcept {
+ _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator>=(_CmpUnspecifiedParam, strong_ordering __v) noexcept {
return 0 >= __v.__value_;
}
- _LIBCPP_HIDE_FROM_ABI
- friend constexpr strong_ordering operator<=>(strong_ordering __v, _CmpUnspecifiedParam) noexcept {
+ _LIBCPP_HIDE_FROM_ABI friend constexpr strong_ordering
+ operator<=>(strong_ordering __v, _CmpUnspecifiedParam) noexcept {
return __v;
}
- _LIBCPP_HIDE_FROM_ABI
- friend constexpr strong_ordering operator<=>(_CmpUnspecifiedParam, strong_ordering __v) noexcept {
+ _LIBCPP_HIDE_FROM_ABI friend constexpr strong_ordering
+ operator<=>(_CmpUnspecifiedParam, strong_ordering __v) noexcept {
return __v < 0 ? strong_ordering::greater : (__v > 0 ? strong_ordering::less : __v);
}
diff --git a/contrib/llvm-project/libcxx/include/__compare/partial_order.h b/contrib/llvm-project/libcxx/include/__compare/partial_order.h
index 36a11dfaa288..f3ed4900fbff 100644
--- a/contrib/llvm-project/libcxx/include/__compare/partial_order.h
+++ b/contrib/llvm-project/libcxx/include/__compare/partial_order.h
@@ -28,43 +28,44 @@ _LIBCPP_BEGIN_NAMESPACE_STD
// [cmp.alg]
namespace __partial_order {
- struct __fn {
- // NOLINTBEGIN(libcpp-robust-against-adl) partial_order should use ADL, but only here
- template<class _Tp, class _Up>
- requires is_same_v<decay_t<_Tp>, decay_t<_Up>>
- _LIBCPP_HIDE_FROM_ABI static constexpr auto
- __go(_Tp&& __t, _Up&& __u, __priority_tag<2>)
- noexcept(noexcept(partial_ordering(partial_order(std::forward<_Tp>(__t), std::forward<_Up>(__u)))))
- -> decltype( partial_ordering(partial_order(std::forward<_Tp>(__t), std::forward<_Up>(__u))))
- { return partial_ordering(partial_order(std::forward<_Tp>(__t), std::forward<_Up>(__u))); }
- // NOLINTEND(libcpp-robust-against-adl)
+struct __fn {
+ // NOLINTBEGIN(libcpp-robust-against-adl) partial_order should use ADL, but only here
+ template <class _Tp, class _Up>
+ requires is_same_v<decay_t<_Tp>, decay_t<_Up>>
+ _LIBCPP_HIDE_FROM_ABI static constexpr auto __go(_Tp&& __t, _Up&& __u, __priority_tag<2>) noexcept(
+ noexcept(partial_ordering(partial_order(std::forward<_Tp>(__t), std::forward<_Up>(__u)))))
+ -> decltype(partial_ordering(partial_order(std::forward<_Tp>(__t), std::forward<_Up>(__u)))) {
+ return partial_ordering(partial_order(std::forward<_Tp>(__t), std::forward<_Up>(__u)));
+ }
+ // NOLINTEND(libcpp-robust-against-adl)
- template<class _Tp, class _Up>
- requires is_same_v<decay_t<_Tp>, decay_t<_Up>>
- _LIBCPP_HIDE_FROM_ABI static constexpr auto
- __go(_Tp&& __t, _Up&& __u, __priority_tag<1>)
- noexcept(noexcept(partial_ordering(compare_three_way()(std::forward<_Tp>(__t), std::forward<_Up>(__u)))))
- -> decltype( partial_ordering(compare_three_way()(std::forward<_Tp>(__t), std::forward<_Up>(__u))))
- { return partial_ordering(compare_three_way()(std::forward<_Tp>(__t), std::forward<_Up>(__u))); }
+ template <class _Tp, class _Up>
+ requires is_same_v<decay_t<_Tp>, decay_t<_Up>>
+ _LIBCPP_HIDE_FROM_ABI static constexpr auto __go(_Tp&& __t, _Up&& __u, __priority_tag<1>) noexcept(
+ noexcept(partial_ordering(compare_three_way()(std::forward<_Tp>(__t), std::forward<_Up>(__u)))))
+ -> decltype(partial_ordering(compare_three_way()(std::forward<_Tp>(__t), std::forward<_Up>(__u)))) {
+ return partial_ordering(compare_three_way()(std::forward<_Tp>(__t), std::forward<_Up>(__u)));
+ }
- template<class _Tp, class _Up>
- requires is_same_v<decay_t<_Tp>, decay_t<_Up>>
- _LIBCPP_HIDE_FROM_ABI static constexpr auto
- __go(_Tp&& __t, _Up&& __u, __priority_tag<0>)
- noexcept(noexcept(partial_ordering(std::weak_order(std::forward<_Tp>(__t), std::forward<_Up>(__u)))))
- -> decltype( partial_ordering(std::weak_order(std::forward<_Tp>(__t), std::forward<_Up>(__u))))
- { return partial_ordering(std::weak_order(std::forward<_Tp>(__t), std::forward<_Up>(__u))); }
+ template <class _Tp, class _Up>
+ requires is_same_v<decay_t<_Tp>, decay_t<_Up>>
+ _LIBCPP_HIDE_FROM_ABI static constexpr auto __go(_Tp&& __t, _Up&& __u, __priority_tag<0>) noexcept(
+ noexcept(partial_ordering(std::weak_order(std::forward<_Tp>(__t), std::forward<_Up>(__u)))))
+ -> decltype(partial_ordering(std::weak_order(std::forward<_Tp>(__t), std::forward<_Up>(__u)))) {
+ return partial_ordering(std::weak_order(std::forward<_Tp>(__t), std::forward<_Up>(__u)));
+ }
- template<class _Tp, class _Up>
- _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t, _Up&& __u) const
- noexcept(noexcept(__go(std::forward<_Tp>(__t), std::forward<_Up>(__u), __priority_tag<2>())))
- -> decltype( __go(std::forward<_Tp>(__t), std::forward<_Up>(__u), __priority_tag<2>()))
- { return __go(std::forward<_Tp>(__t), std::forward<_Up>(__u), __priority_tag<2>()); }
- };
+ template <class _Tp, class _Up>
+ _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t, _Up&& __u) const
+ noexcept(noexcept(__go(std::forward<_Tp>(__t), std::forward<_Up>(__u), __priority_tag<2>())))
+ -> decltype(__go(std::forward<_Tp>(__t), std::forward<_Up>(__u), __priority_tag<2>())) {
+ return __go(std::forward<_Tp>(__t), std::forward<_Up>(__u), __priority_tag<2>());
+ }
+};
} // namespace __partial_order
inline namespace __cpo {
- inline constexpr auto partial_order = __partial_order::__fn{};
+inline constexpr auto partial_order = __partial_order::__fn{};
} // namespace __cpo
#endif // _LIBCPP_STD_VER >= 20
diff --git a/contrib/llvm-project/libcxx/include/__compare/strong_order.h b/contrib/llvm-project/libcxx/include/__compare/strong_order.h
index cbfcf7316de9..5f6ade5aef8e 100644
--- a/contrib/llvm-project/libcxx/include/__compare/strong_order.h
+++ b/contrib/llvm-project/libcxx/include/__compare/strong_order.h
@@ -34,100 +34,99 @@ _LIBCPP_BEGIN_NAMESPACE_STD
// [cmp.alg]
namespace __strong_order {
- struct __fn {
- // NOLINTBEGIN(libcpp-robust-against-adl) strong_order should use ADL, but only here
- template<class _Tp, class _Up>
- requires is_same_v<decay_t<_Tp>, decay_t<_Up>>
- _LIBCPP_HIDE_FROM_ABI static constexpr auto
- __go(_Tp&& __t, _Up&& __u, __priority_tag<2>)
- noexcept(noexcept(strong_ordering(strong_order(std::forward<_Tp>(__t), std::forward<_Up>(__u)))))
- -> decltype( strong_ordering(strong_order(std::forward<_Tp>(__t), std::forward<_Up>(__u))))
- { return strong_ordering(strong_order(std::forward<_Tp>(__t), std::forward<_Up>(__u))); }
- // NOLINTEND(libcpp-robust-against-adl)
+struct __fn {
+ // NOLINTBEGIN(libcpp-robust-against-adl) strong_order should use ADL, but only here
+ template <class _Tp, class _Up>
+ requires is_same_v<decay_t<_Tp>, decay_t<_Up>>
+ _LIBCPP_HIDE_FROM_ABI static constexpr auto __go(_Tp&& __t, _Up&& __u, __priority_tag<2>) noexcept(
+ noexcept(strong_ordering(strong_order(std::forward<_Tp>(__t), std::forward<_Up>(__u)))))
+ -> decltype(strong_ordering(strong_order(std::forward<_Tp>(__t), std::forward<_Up>(__u)))) {
+ return strong_ordering(strong_order(std::forward<_Tp>(__t), std::forward<_Up>(__u)));
+ }
+ // NOLINTEND(libcpp-robust-against-adl)
- template<class _Tp, class _Up, class _Dp = decay_t<_Tp>>
- requires is_same_v<_Dp, decay_t<_Up>> && is_floating_point_v<_Dp>
- _LIBCPP_HIDE_FROM_ABI static constexpr strong_ordering
- __go(_Tp&& __t, _Up&& __u, __priority_tag<1>) noexcept
- {
- if constexpr (numeric_limits<_Dp>::is_iec559 && sizeof(_Dp) == sizeof(int32_t)) {
- int32_t __rx = std::bit_cast<int32_t>(__t);
- int32_t __ry = std::bit_cast<int32_t>(__u);
- __rx = (__rx < 0) ? (numeric_limits<int32_t>::min() - __rx - 1) : __rx;
- __ry = (__ry < 0) ? (numeric_limits<int32_t>::min() - __ry - 1) : __ry;
- return (__rx <=> __ry);
- } else if constexpr (numeric_limits<_Dp>::is_iec559 && sizeof(_Dp) == sizeof(int64_t)) {
- int64_t __rx = std::bit_cast<int64_t>(__t);
- int64_t __ry = std::bit_cast<int64_t>(__u);
- __rx = (__rx < 0) ? (numeric_limits<int64_t>::min() - __rx - 1) : __rx;
- __ry = (__ry < 0) ? (numeric_limits<int64_t>::min() - __ry - 1) : __ry;
- return (__rx <=> __ry);
- } else if (__t < __u) {
- return strong_ordering::less;
- } else if (__t > __u) {
- return strong_ordering::greater;
- } else if (__t == __u) {
- if constexpr (numeric_limits<_Dp>::radix == 2) {
- return std::signbit(__u) <=> std::signbit(__t);
- } else {
- // This is bullet 3 of the IEEE754 algorithm, relevant
- // only for decimal floating-point;
- // see https://stackoverflow.com/questions/69068075/
- if (__t == 0 || std::isinf(__t)) {
- return std::signbit(__u) <=> std::signbit(__t);
- } else {
- int __texp, __uexp;
- (void)std::frexp(__t, &__texp);
- (void)std::frexp(__u, &__uexp);
- return (__t < 0) ? (__texp <=> __uexp) : (__uexp <=> __texp);
- }
- }
- } else {
- // They're unordered, so one of them must be a NAN.
- // The order is -QNAN, -SNAN, numbers, +SNAN, +QNAN.
- bool __t_is_nan = std::isnan(__t);
- bool __u_is_nan = std::isnan(__u);
- bool __t_is_negative = std::signbit(__t);
- bool __u_is_negative = std::signbit(__u);
- using _IntType = conditional_t<
- sizeof(__t) == sizeof(int32_t), int32_t, conditional_t<
- sizeof(__t) == sizeof(int64_t), int64_t, void>
- >;
- if constexpr (is_same_v<_IntType, void>) {
- static_assert(sizeof(_Dp) == 0, "std::strong_order is unimplemented for this floating-point type");
- } else if (__t_is_nan && __u_is_nan) {
- // Order by sign bit, then by "payload bits" (we'll just use bit_cast).
- if (__t_is_negative != __u_is_negative) {
- return (__u_is_negative <=> __t_is_negative);
- } else {
- return std::bit_cast<_IntType>(__t) <=> std::bit_cast<_IntType>(__u);
- }
- } else if (__t_is_nan) {
- return __t_is_negative ? strong_ordering::less : strong_ordering::greater;
- } else {
- return __u_is_negative ? strong_ordering::greater : strong_ordering::less;
- }
- }
+ template <class _Tp, class _Up, class _Dp = decay_t<_Tp>>
+ requires is_same_v<_Dp, decay_t<_Up>> && is_floating_point_v<_Dp>
+ _LIBCPP_HIDE_FROM_ABI static constexpr strong_ordering __go(_Tp&& __t, _Up&& __u, __priority_tag<1>) noexcept {
+ if constexpr (numeric_limits<_Dp>::is_iec559 && sizeof(_Dp) == sizeof(int32_t)) {
+ int32_t __rx = std::bit_cast<int32_t>(__t);
+ int32_t __ry = std::bit_cast<int32_t>(__u);
+ __rx = (__rx < 0) ? (numeric_limits<int32_t>::min() - __rx - 1) : __rx;
+ __ry = (__ry < 0) ? (numeric_limits<int32_t>::min() - __ry - 1) : __ry;
+ return (__rx <=> __ry);
+ } else if constexpr (numeric_limits<_Dp>::is_iec559 && sizeof(_Dp) == sizeof(int64_t)) {
+ int64_t __rx = std::bit_cast<int64_t>(__t);
+ int64_t __ry = std::bit_cast<int64_t>(__u);
+ __rx = (__rx < 0) ? (numeric_limits<int64_t>::min() - __rx - 1) : __rx;
+ __ry = (__ry < 0) ? (numeric_limits<int64_t>::min() - __ry - 1) : __ry;
+ return (__rx <=> __ry);
+ } else if (__t < __u) {
+ return strong_ordering::less;
+ } else if (__t > __u) {
+ return strong_ordering::greater;
+ } else if (__t == __u) {
+ if constexpr (numeric_limits<_Dp>::radix == 2) {
+ return std::signbit(__u) <=> std::signbit(__t);
+ } else {
+ // This is bullet 3 of the IEEE754 algorithm, relevant
+ // only for decimal floating-point;
+ // see https://stackoverflow.com/questions/69068075/
+ if (__t == 0 || std::isinf(__t)) {
+ return std::signbit(__u) <=> std::signbit(__t);
+ } else {
+ int __texp, __uexp;
+ (void)std::frexp(__t, &__texp);
+ (void)std::frexp(__u, &__uexp);
+ return (__t < 0) ? (__texp <=> __uexp) : (__uexp <=> __texp);
}
+ }
+ } else {
+ // They're unordered, so one of them must be a NAN.
+ // The order is -QNAN, -SNAN, numbers, +SNAN, +QNAN.
+ bool __t_is_nan = std::isnan(__t);
+ bool __u_is_nan = std::isnan(__u);
+ bool __t_is_negative = std::signbit(__t);
+ bool __u_is_negative = std::signbit(__u);
+ using _IntType =
+ conditional_t< sizeof(__t) == sizeof(int32_t),
+ int32_t,
+ conditional_t< sizeof(__t) == sizeof(int64_t), int64_t, void> >;
+ if constexpr (is_same_v<_IntType, void>) {
+ static_assert(sizeof(_Dp) == 0, "std::strong_order is unimplemented for this floating-point type");
+ } else if (__t_is_nan && __u_is_nan) {
+ // Order by sign bit, then by "payload bits" (we'll just use bit_cast).
+ if (__t_is_negative != __u_is_negative) {
+ return (__u_is_negative <=> __t_is_negative);
+ } else {
+ return std::bit_cast<_IntType>(__t) <=> std::bit_cast<_IntType>(__u);
+ }
+ } else if (__t_is_nan) {
+ return __t_is_negative ? strong_ordering::less : strong_ordering::greater;
+ } else {
+ return __u_is_negative ? strong_ordering::greater : strong_ordering::less;
+ }
+ }
+ }
- template<class _Tp, class _Up>
- requires is_same_v<decay_t<_Tp>, decay_t<_Up>>
- _LIBCPP_HIDE_FROM_ABI static constexpr auto
- __go(_Tp&& __t, _Up&& __u, __priority_tag<0>)
- noexcept(noexcept(strong_ordering(compare_three_way()(std::forward<_Tp>(__t), std::forward<_Up>(__u)))))
- -> decltype( strong_ordering(compare_three_way()(std::forward<_Tp>(__t), std::forward<_Up>(__u))))
- { return strong_ordering(compare_three_way()(std::forward<_Tp>(__t), std::forward<_Up>(__u))); }
+ template <class _Tp, class _Up>
+ requires is_same_v<decay_t<_Tp>, decay_t<_Up>>
+ _LIBCPP_HIDE_FROM_ABI static constexpr auto __go(_Tp&& __t, _Up&& __u, __priority_tag<0>) noexcept(
+ noexcept(strong_ordering(compare_three_way()(std::forward<_Tp>(__t), std::forward<_Up>(__u)))))
+ -> decltype(strong_ordering(compare_three_way()(std::forward<_Tp>(__t), std::forward<_Up>(__u)))) {
+ return strong_ordering(compare_three_way()(std::forward<_Tp>(__t), std::forward<_Up>(__u)));
+ }
- template<class _Tp, class _Up>
- _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t, _Up&& __u) const
- noexcept(noexcept(__go(std::forward<_Tp>(__t), std::forward<_Up>(__u), __priority_tag<2>())))
- -> decltype( __go(std::forward<_Tp>(__t), std::forward<_Up>(__u), __priority_tag<2>()))
- { return __go(std::forward<_Tp>(__t), std::forward<_Up>(__u), __priority_tag<2>()); }
- };
+ template <class _Tp, class _Up>
+ _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t, _Up&& __u) const
+ noexcept(noexcept(__go(std::forward<_Tp>(__t), std::forward<_Up>(__u), __priority_tag<2>())))
+ -> decltype(__go(std::forward<_Tp>(__t), std::forward<_Up>(__u), __priority_tag<2>())) {
+ return __go(std::forward<_Tp>(__t), std::forward<_Up>(__u), __priority_tag<2>());
+ }
+};
} // namespace __strong_order
inline namespace __cpo {
- inline constexpr auto strong_order = __strong_order::__fn{};
+inline constexpr auto strong_order = __strong_order::__fn{};
} // namespace __cpo
#endif // _LIBCPP_STD_VER >= 20
diff --git a/contrib/llvm-project/libcxx/include/__compare/three_way_comparable.h b/contrib/llvm-project/libcxx/include/__compare/three_way_comparable.h
index 2b77bc3f54e6..7a44ea9158a6 100644
--- a/contrib/llvm-project/libcxx/include/__compare/three_way_comparable.h
+++ b/contrib/llvm-project/libcxx/include/__compare/three_way_comparable.h
@@ -27,30 +27,26 @@ _LIBCPP_BEGIN_NAMESPACE_STD
#if _LIBCPP_STD_VER >= 20
-template<class _Tp, class _Cat>
-concept __compares_as =
- same_as<common_comparison_category_t<_Tp, _Cat>, _Cat>;
+template <class _Tp, class _Cat>
+concept __compares_as = same_as<common_comparison_category_t<_Tp, _Cat>, _Cat>;
-template<class _Tp, class _Cat = partial_ordering>
+template <class _Tp, class _Cat = partial_ordering>
concept three_way_comparable =
- __weakly_equality_comparable_with<_Tp, _Tp> &&
- __partially_ordered_with<_Tp, _Tp> &&
- requires(__make_const_lvalue_ref<_Tp> __a, __make_const_lvalue_ref<_Tp> __b) {
- { __a <=> __b } -> __compares_as<_Cat>;
- };
+ __weakly_equality_comparable_with<_Tp, _Tp> && __partially_ordered_with<_Tp, _Tp> &&
+ requires(__make_const_lvalue_ref<_Tp> __a, __make_const_lvalue_ref<_Tp> __b) {
+ { __a <=> __b } -> __compares_as<_Cat>;
+ };
-template<class _Tp, class _Up, class _Cat = partial_ordering>
+template <class _Tp, class _Up, class _Cat = partial_ordering>
concept three_way_comparable_with =
- three_way_comparable<_Tp, _Cat> &&
- three_way_comparable<_Up, _Cat> &&
- common_reference_with<__make_const_lvalue_ref<_Tp>, __make_const_lvalue_ref<_Up>> &&
- three_way_comparable<common_reference_t<__make_const_lvalue_ref<_Tp>, __make_const_lvalue_ref<_Up>>, _Cat> &&
- __weakly_equality_comparable_with<_Tp, _Up> &&
- __partially_ordered_with<_Tp, _Up> &&
- requires(__make_const_lvalue_ref<_Tp> __t, __make_const_lvalue_ref<_Up> __u) {
- { __t <=> __u } -> __compares_as<_Cat>;
- { __u <=> __t } -> __compares_as<_Cat>;
- };
+ three_way_comparable<_Tp, _Cat> && three_way_comparable<_Up, _Cat> &&
+ common_reference_with<__make_const_lvalue_ref<_Tp>, __make_const_lvalue_ref<_Up>> &&
+ three_way_comparable<common_reference_t<__make_const_lvalue_ref<_Tp>, __make_const_lvalue_ref<_Up>>, _Cat> &&
+ __weakly_equality_comparable_with<_Tp, _Up> && __partially_ordered_with<_Tp, _Up> &&
+ requires(__make_const_lvalue_ref<_Tp> __t, __make_const_lvalue_ref<_Up> __u) {
+ { __t <=> __u } -> __compares_as<_Cat>;
+ { __u <=> __t } -> __compares_as<_Cat>;
+ };
#endif // _LIBCPP_STD_VER >= 20
diff --git a/contrib/llvm-project/libcxx/include/__compare/weak_order.h b/contrib/llvm-project/libcxx/include/__compare/weak_order.h
index e6a42ac4c923..9f719eb64bbc 100644
--- a/contrib/llvm-project/libcxx/include/__compare/weak_order.h
+++ b/contrib/llvm-project/libcxx/include/__compare/weak_order.h
@@ -28,71 +28,70 @@ _LIBCPP_BEGIN_NAMESPACE_STD
// [cmp.alg]
namespace __weak_order {
- struct __fn {
- // NOLINTBEGIN(libcpp-robust-against-adl) weak_order should use ADL, but only here
- template<class _Tp, class _Up>
- requires is_same_v<decay_t<_Tp>, decay_t<_Up>>
- _LIBCPP_HIDE_FROM_ABI static constexpr auto
- __go(_Tp&& __t, _Up&& __u, __priority_tag<3>)
- noexcept(noexcept(weak_ordering(weak_order(std::forward<_Tp>(__t), std::forward<_Up>(__u)))))
- -> decltype( weak_ordering(weak_order(std::forward<_Tp>(__t), std::forward<_Up>(__u))))
- { return weak_ordering(weak_order(std::forward<_Tp>(__t), std::forward<_Up>(__u))); }
- // NOLINTEND(libcpp-robust-against-adl)
+struct __fn {
+ // NOLINTBEGIN(libcpp-robust-against-adl) weak_order should use ADL, but only here
+ template <class _Tp, class _Up>
+ requires is_same_v<decay_t<_Tp>, decay_t<_Up>>
+ _LIBCPP_HIDE_FROM_ABI static constexpr auto __go(_Tp&& __t, _Up&& __u, __priority_tag<3>) noexcept(
+ noexcept(weak_ordering(weak_order(std::forward<_Tp>(__t), std::forward<_Up>(__u)))))
+ -> decltype(weak_ordering(weak_order(std::forward<_Tp>(__t), std::forward<_Up>(__u)))) {
+ return weak_ordering(weak_order(std::forward<_Tp>(__t), std::forward<_Up>(__u)));
+ }
+ // NOLINTEND(libcpp-robust-against-adl)
- template<class _Tp, class _Up, class _Dp = decay_t<_Tp>>
- requires is_same_v<_Dp, decay_t<_Up>> && is_floating_point_v<_Dp>
- _LIBCPP_HIDE_FROM_ABI static constexpr weak_ordering
- __go(_Tp&& __t, _Up&& __u, __priority_tag<2>) noexcept
- {
- partial_ordering __po = (__t <=> __u);
- if (__po == partial_ordering::less) {
- return weak_ordering::less;
- } else if (__po == partial_ordering::equivalent) {
- return weak_ordering::equivalent;
- } else if (__po == partial_ordering::greater) {
- return weak_ordering::greater;
- } else {
- // Otherwise, at least one of them is a NaN.
- bool __t_is_nan = std::isnan(__t);
- bool __u_is_nan = std::isnan(__u);
- bool __t_is_negative = std::signbit(__t);
- bool __u_is_negative = std::signbit(__u);
- if (__t_is_nan && __u_is_nan) {
- return (__u_is_negative <=> __t_is_negative);
- } else if (__t_is_nan) {
- return __t_is_negative ? weak_ordering::less : weak_ordering::greater;
- } else {
- return __u_is_negative ? weak_ordering::greater : weak_ordering::less;
- }
- }
- }
+ template <class _Tp, class _Up, class _Dp = decay_t<_Tp>>
+ requires is_same_v<_Dp, decay_t<_Up>> && is_floating_point_v<_Dp>
+ _LIBCPP_HIDE_FROM_ABI static constexpr weak_ordering __go(_Tp&& __t, _Up&& __u, __priority_tag<2>) noexcept {
+ partial_ordering __po = (__t <=> __u);
+ if (__po == partial_ordering::less) {
+ return weak_ordering::less;
+ } else if (__po == partial_ordering::equivalent) {
+ return weak_ordering::equivalent;
+ } else if (__po == partial_ordering::greater) {
+ return weak_ordering::greater;
+ } else {
+ // Otherwise, at least one of them is a NaN.
+ bool __t_is_nan = std::isnan(__t);
+ bool __u_is_nan = std::isnan(__u);
+ bool __t_is_negative = std::signbit(__t);
+ bool __u_is_negative = std::signbit(__u);
+ if (__t_is_nan && __u_is_nan) {
+ return (__u_is_negative <=> __t_is_negative);
+ } else if (__t_is_nan) {
+ return __t_is_negative ? weak_ordering::less : weak_ordering::greater;
+ } else {
+ return __u_is_negative ? weak_ordering::greater : weak_ordering::less;
+ }
+ }
+ }
- template<class _Tp, class _Up>
- requires is_same_v<decay_t<_Tp>, decay_t<_Up>>
- _LIBCPP_HIDE_FROM_ABI static constexpr auto
- __go(_Tp&& __t, _Up&& __u, __priority_tag<1>)
- noexcept(noexcept(weak_ordering(compare_three_way()(std::forward<_Tp>(__t), std::forward<_Up>(__u)))))
- -> decltype( weak_ordering(compare_three_way()(std::forward<_Tp>(__t), std::forward<_Up>(__u))))
- { return weak_ordering(compare_three_way()(std::forward<_Tp>(__t), std::forward<_Up>(__u))); }
+ template <class _Tp, class _Up>
+ requires is_same_v<decay_t<_Tp>, decay_t<_Up>>
+ _LIBCPP_HIDE_FROM_ABI static constexpr auto __go(_Tp&& __t, _Up&& __u, __priority_tag<1>) noexcept(
+ noexcept(weak_ordering(compare_three_way()(std::forward<_Tp>(__t), std::forward<_Up>(__u)))))
+ -> decltype(weak_ordering(compare_three_way()(std::forward<_Tp>(__t), std::forward<_Up>(__u)))) {
+ return weak_ordering(compare_three_way()(std::forward<_Tp>(__t), std::forward<_Up>(__u)));
+ }
- template<class _Tp, class _Up>
- requires is_same_v<decay_t<_Tp>, decay_t<_Up>>
- _LIBCPP_HIDE_FROM_ABI static constexpr auto
- __go(_Tp&& __t, _Up&& __u, __priority_tag<0>)
- noexcept(noexcept(weak_ordering(std::strong_order(std::forward<_Tp>(__t), std::forward<_Up>(__u)))))
- -> decltype( weak_ordering(std::strong_order(std::forward<_Tp>(__t), std::forward<_Up>(__u))))
- { return weak_ordering(std::strong_order(std::forward<_Tp>(__t), std::forward<_Up>(__u))); }
+ template <class _Tp, class _Up>
+ requires is_same_v<decay_t<_Tp>, decay_t<_Up>>
+ _LIBCPP_HIDE_FROM_ABI static constexpr auto __go(_Tp&& __t, _Up&& __u, __priority_tag<0>) noexcept(
+ noexcept(weak_ordering(std::strong_order(std::forward<_Tp>(__t), std::forward<_Up>(__u)))))
+ -> decltype(weak_ordering(std::strong_order(std::forward<_Tp>(__t), std::forward<_Up>(__u)))) {
+ return weak_ordering(std::strong_order(std::forward<_Tp>(__t), std::forward<_Up>(__u)));
+ }
- template<class _Tp, class _Up>
- _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t, _Up&& __u) const
- noexcept(noexcept(__go(std::forward<_Tp>(__t), std::forward<_Up>(__u), __priority_tag<3>())))
- -> decltype( __go(std::forward<_Tp>(__t), std::forward<_Up>(__u), __priority_tag<3>()))
- { return __go(std::forward<_Tp>(__t), std::forward<_Up>(__u), __priority_tag<3>()); }
- };
+ template <class _Tp, class _Up>
+ _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t, _Up&& __u) const
+ noexcept(noexcept(__go(std::forward<_Tp>(__t), std::forward<_Up>(__u), __priority_tag<3>())))
+ -> decltype(__go(std::forward<_Tp>(__t), std::forward<_Up>(__u), __priority_tag<3>())) {
+ return __go(std::forward<_Tp>(__t), std::forward<_Up>(__u), __priority_tag<3>());
+ }
+};
} // namespace __weak_order
inline namespace __cpo {
- inline constexpr auto weak_order = __weak_order::__fn{};
+inline constexpr auto weak_order = __weak_order::__fn{};
} // namespace __cpo
#endif // _LIBCPP_STD_VER >= 20
diff --git a/contrib/llvm-project/libcxx/include/__config b/contrib/llvm-project/libcxx/include/__config
index 7f66042f9025..adff13e714cb 100644
--- a/contrib/llvm-project/libcxx/include/__config
+++ b/contrib/llvm-project/libcxx/include/__config
@@ -1010,8 +1010,8 @@ typedef __char32_t char32_t;
# endif
# ifndef _LIBCPP_HAS_NO_ASAN
- extern "C" _LIBCPP_EXPORTED_FROM_ABI void
- __sanitizer_annotate_contiguous_container(const void*, const void*, const void*, const void*);
+extern "C" _LIBCPP_EXPORTED_FROM_ABI void
+__sanitizer_annotate_contiguous_container(const void*, const void*, const void*, const void*);
extern "C" _LIBCPP_EXPORTED_FROM_ABI void __sanitizer_annotate_double_ended_contiguous_container(
const void*, const void*, const void*, const void*, const void*, const void*);
extern "C" _LIBCPP_EXPORTED_FROM_ABI int
diff --git a/contrib/llvm-project/libcxx/include/__coroutine/coroutine_handle.h b/contrib/llvm-project/libcxx/include/__coroutine/coroutine_handle.h
index 4e4e3eb5ba30..54bfe5b44f4c 100644
--- a/contrib/llvm-project/libcxx/include/__coroutine/coroutine_handle.h
+++ b/contrib/llvm-project/libcxx/include/__coroutine/coroutine_handle.h
@@ -32,166 +32,141 @@ struct _LIBCPP_TEMPLATE_VIS coroutine_handle;
template <>
struct _LIBCPP_TEMPLATE_VIS coroutine_handle<void> {
public:
- // [coroutine.handle.con], construct/reset
- constexpr coroutine_handle() noexcept = default;
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr coroutine_handle(nullptr_t) noexcept {}
-
- _LIBCPP_HIDE_FROM_ABI
- coroutine_handle& operator=(nullptr_t) noexcept {
- __handle_ = nullptr;
- return *this;
- }
-
- // [coroutine.handle.export.import], export/import
- _LIBCPP_HIDE_FROM_ABI
- constexpr void* address() const noexcept { return __handle_; }
-
- _LIBCPP_HIDE_FROM_ABI
- static constexpr coroutine_handle from_address(void* __addr) noexcept {
- coroutine_handle __tmp;
- __tmp.__handle_ = __addr;
- return __tmp;
- }
-
- // [coroutine.handle.observers], observers
- _LIBCPP_HIDE_FROM_ABI
- constexpr explicit operator bool() const noexcept {
- return __handle_ != nullptr;
- }
-
- _LIBCPP_HIDE_FROM_ABI
- bool done() const {
- _LIBCPP_ASSERT_UNCATEGORIZED(__is_suspended(), "done() can be called only on suspended coroutines");
- return __builtin_coro_done(__handle_);
- }
-
- // [coroutine.handle.resumption], resumption
- _LIBCPP_HIDE_FROM_ABI
- void operator()() const { resume(); }
-
- _LIBCPP_HIDE_FROM_ABI
- void resume() const {
- _LIBCPP_ASSERT_UNCATEGORIZED(__is_suspended(), "resume() can be called only on suspended coroutines");
- _LIBCPP_ASSERT_UNCATEGORIZED(!done(), "resume() has undefined behavior when the coroutine is done");
- __builtin_coro_resume(__handle_);
- }
-
- _LIBCPP_HIDE_FROM_ABI
- void destroy() const {
- _LIBCPP_ASSERT_UNCATEGORIZED(__is_suspended(), "destroy() can be called only on suspended coroutines");
- __builtin_coro_destroy(__handle_);
- }
+ // [coroutine.handle.con], construct/reset
+ constexpr coroutine_handle() noexcept = default;
+
+ _LIBCPP_HIDE_FROM_ABI constexpr coroutine_handle(nullptr_t) noexcept {}
+
+ _LIBCPP_HIDE_FROM_ABI coroutine_handle& operator=(nullptr_t) noexcept {
+ __handle_ = nullptr;
+ return *this;
+ }
+
+ // [coroutine.handle.export.import], export/import
+ _LIBCPP_HIDE_FROM_ABI constexpr void* address() const noexcept { return __handle_; }
+
+ _LIBCPP_HIDE_FROM_ABI static constexpr coroutine_handle from_address(void* __addr) noexcept {
+ coroutine_handle __tmp;
+ __tmp.__handle_ = __addr;
+ return __tmp;
+ }
+
+ // [coroutine.handle.observers], observers
+ _LIBCPP_HIDE_FROM_ABI constexpr explicit operator bool() const noexcept { return __handle_ != nullptr; }
+
+ _LIBCPP_HIDE_FROM_ABI bool done() const {
+ _LIBCPP_ASSERT_UNCATEGORIZED(__is_suspended(), "done() can be called only on suspended coroutines");
+ return __builtin_coro_done(__handle_);
+ }
+
+ // [coroutine.handle.resumption], resumption
+ _LIBCPP_HIDE_FROM_ABI void operator()() const { resume(); }
+
+ _LIBCPP_HIDE_FROM_ABI void resume() const {
+ _LIBCPP_ASSERT_UNCATEGORIZED(__is_suspended(), "resume() can be called only on suspended coroutines");
+ _LIBCPP_ASSERT_UNCATEGORIZED(!done(), "resume() has undefined behavior when the coroutine is done");
+ __builtin_coro_resume(__handle_);
+ }
+
+ _LIBCPP_HIDE_FROM_ABI void destroy() const {
+ _LIBCPP_ASSERT_UNCATEGORIZED(__is_suspended(), "destroy() can be called only on suspended coroutines");
+ __builtin_coro_destroy(__handle_);
+ }
private:
- _LIBCPP_HIDE_FROM_ABI bool __is_suspended() const {
- // FIXME actually implement a check for if the coro is suspended.
- return __handle_ != nullptr;
- }
+ _LIBCPP_HIDE_FROM_ABI bool __is_suspended() const {
+ // FIXME actually implement a check for if the coro is suspended.
+ return __handle_ != nullptr;
+ }
- void* __handle_ = nullptr;
+ void* __handle_ = nullptr;
};
// [coroutine.handle.compare]
-inline _LIBCPP_HIDE_FROM_ABI
-constexpr bool operator==(coroutine_handle<> __x, coroutine_handle<> __y) noexcept {
- return __x.address() == __y.address();
+inline _LIBCPP_HIDE_FROM_ABI constexpr bool operator==(coroutine_handle<> __x, coroutine_handle<> __y) noexcept {
+ return __x.address() == __y.address();
}
-inline _LIBCPP_HIDE_FROM_ABI
-constexpr strong_ordering operator<=>(coroutine_handle<> __x, coroutine_handle<> __y) noexcept {
- return compare_three_way()(__x.address(), __y.address());
+inline _LIBCPP_HIDE_FROM_ABI constexpr strong_ordering
+operator<=>(coroutine_handle<> __x, coroutine_handle<> __y) noexcept {
+ return compare_three_way()(__x.address(), __y.address());
}
template <class _Promise>
struct _LIBCPP_TEMPLATE_VIS coroutine_handle {
public:
- // [coroutine.handle.con], construct/reset
- constexpr coroutine_handle() noexcept = default;
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr coroutine_handle(nullptr_t) noexcept {}
-
- _LIBCPP_HIDE_FROM_ABI
- static coroutine_handle from_promise(_Promise& __promise) {
- using _RawPromise = __remove_cv_t<_Promise>;
- coroutine_handle __tmp;
- __tmp.__handle_ =
- __builtin_coro_promise(std::addressof(const_cast<_RawPromise&>(__promise)), alignof(_Promise), true);
- return __tmp;
- }
-
- _LIBCPP_HIDE_FROM_ABI
- coroutine_handle& operator=(nullptr_t) noexcept {
- __handle_ = nullptr;
- return *this;
- }
-
- // [coroutine.handle.export.import], export/import
- _LIBCPP_HIDE_FROM_ABI
- constexpr void* address() const noexcept { return __handle_; }
-
- _LIBCPP_HIDE_FROM_ABI
- static constexpr coroutine_handle from_address(void* __addr) noexcept {
- coroutine_handle __tmp;
- __tmp.__handle_ = __addr;
- return __tmp;
- }
-
- // [coroutine.handle.conv], conversion
- _LIBCPP_HIDE_FROM_ABI
- constexpr operator coroutine_handle<>() const noexcept {
- return coroutine_handle<>::from_address(address());
- }
-
- // [coroutine.handle.observers], observers
- _LIBCPP_HIDE_FROM_ABI
- constexpr explicit operator bool() const noexcept {
- return __handle_ != nullptr;
- }
-
- _LIBCPP_HIDE_FROM_ABI
- bool done() const {
- _LIBCPP_ASSERT_UNCATEGORIZED(__is_suspended(), "done() can be called only on suspended coroutines");
- return __builtin_coro_done(__handle_);
- }
-
- // [coroutine.handle.resumption], resumption
- _LIBCPP_HIDE_FROM_ABI
- void operator()() const { resume(); }
-
- _LIBCPP_HIDE_FROM_ABI
- void resume() const {
- _LIBCPP_ASSERT_UNCATEGORIZED(__is_suspended(), "resume() can be called only on suspended coroutines");
- _LIBCPP_ASSERT_UNCATEGORIZED(!done(), "resume() has undefined behavior when the coroutine is done");
- __builtin_coro_resume(__handle_);
- }
-
- _LIBCPP_HIDE_FROM_ABI
- void destroy() const {
- _LIBCPP_ASSERT_UNCATEGORIZED(__is_suspended(), "destroy() can be called only on suspended coroutines");
- __builtin_coro_destroy(__handle_);
- }
-
- // [coroutine.handle.promise], promise access
- _LIBCPP_HIDE_FROM_ABI
- _Promise& promise() const {
- return *static_cast<_Promise*>(__builtin_coro_promise(this->__handle_, alignof(_Promise), false));
- }
+ // [coroutine.handle.con], construct/reset
+ constexpr coroutine_handle() noexcept = default;
+
+ _LIBCPP_HIDE_FROM_ABI constexpr coroutine_handle(nullptr_t) noexcept {}
+
+ _LIBCPP_HIDE_FROM_ABI static coroutine_handle from_promise(_Promise& __promise) {
+ using _RawPromise = __remove_cv_t<_Promise>;
+ coroutine_handle __tmp;
+ __tmp.__handle_ =
+ __builtin_coro_promise(std::addressof(const_cast<_RawPromise&>(__promise)), alignof(_Promise), true);
+ return __tmp;
+ }
+
+ _LIBCPP_HIDE_FROM_ABI coroutine_handle& operator=(nullptr_t) noexcept {
+ __handle_ = nullptr;
+ return *this;
+ }
+
+ // [coroutine.handle.export.import], export/import
+ _LIBCPP_HIDE_FROM_ABI constexpr void* address() const noexcept { return __handle_; }
+
+ _LIBCPP_HIDE_FROM_ABI static constexpr coroutine_handle from_address(void* __addr) noexcept {
+ coroutine_handle __tmp;
+ __tmp.__handle_ = __addr;
+ return __tmp;
+ }
+
+ // [coroutine.handle.conv], conversion
+ _LIBCPP_HIDE_FROM_ABI constexpr operator coroutine_handle<>() const noexcept {
+ return coroutine_handle<>::from_address(address());
+ }
+
+ // [coroutine.handle.observers], observers
+ _LIBCPP_HIDE_FROM_ABI constexpr explicit operator bool() const noexcept { return __handle_ != nullptr; }
+
+ _LIBCPP_HIDE_FROM_ABI bool done() const {
+ _LIBCPP_ASSERT_UNCATEGORIZED(__is_suspended(), "done() can be called only on suspended coroutines");
+ return __builtin_coro_done(__handle_);
+ }
+
+ // [coroutine.handle.resumption], resumption
+ _LIBCPP_HIDE_FROM_ABI void operator()() const { resume(); }
+
+ _LIBCPP_HIDE_FROM_ABI void resume() const {
+ _LIBCPP_ASSERT_UNCATEGORIZED(__is_suspended(), "resume() can be called only on suspended coroutines");
+ _LIBCPP_ASSERT_UNCATEGORIZED(!done(), "resume() has undefined behavior when the coroutine is done");
+ __builtin_coro_resume(__handle_);
+ }
+
+ _LIBCPP_HIDE_FROM_ABI void destroy() const {
+ _LIBCPP_ASSERT_UNCATEGORIZED(__is_suspended(), "destroy() can be called only on suspended coroutines");
+ __builtin_coro_destroy(__handle_);
+ }
+
+ // [coroutine.handle.promise], promise access
+ _LIBCPP_HIDE_FROM_ABI _Promise& promise() const {
+ return *static_cast<_Promise*>(__builtin_coro_promise(this->__handle_, alignof(_Promise), false));
+ }
private:
- _LIBCPP_HIDE_FROM_ABI bool __is_suspended() const {
- // FIXME actually implement a check for if the coro is suspended.
- return __handle_ != nullptr;
- }
- void* __handle_ = nullptr;
+ _LIBCPP_HIDE_FROM_ABI bool __is_suspended() const {
+ // FIXME actually implement a check for if the coro is suspended.
+ return __handle_ != nullptr;
+ }
+ void* __handle_ = nullptr;
};
// [coroutine.handle.hash]
template <class _Tp>
struct hash<coroutine_handle<_Tp>> {
- _LIBCPP_HIDE_FROM_ABI
- size_t operator()(const coroutine_handle<_Tp>& __v) const noexcept { return hash<void*>()(__v.address()); }
+ _LIBCPP_HIDE_FROM_ABI size_t operator()(const coroutine_handle<_Tp>& __v) const noexcept {
+ return hash<void*>()(__v.address());
+ }
};
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__coroutine/coroutine_traits.h b/contrib/llvm-project/libcxx/include/__coroutine/coroutine_traits.h
index 7122cc8ea8fb..78f05341f748 100644
--- a/contrib/llvm-project/libcxx/include/__coroutine/coroutine_traits.h
+++ b/contrib/llvm-project/libcxx/include/__coroutine/coroutine_traits.h
@@ -34,17 +34,12 @@ template <class _Tp, class = void>
struct __coroutine_traits_sfinae {};
template <class _Tp>
-struct __coroutine_traits_sfinae<
- _Tp, __void_t<typename _Tp::promise_type> >
-{
+struct __coroutine_traits_sfinae< _Tp, __void_t<typename _Tp::promise_type> > {
using promise_type = typename _Tp::promise_type;
};
template <class _Ret, class... _Args>
-struct coroutine_traits
- : public __coroutine_traits_sfinae<_Ret>
-{
-};
+struct coroutine_traits : public __coroutine_traits_sfinae<_Ret> {};
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__coroutine/noop_coroutine_handle.h b/contrib/llvm-project/libcxx/include/__coroutine/noop_coroutine_handle.h
index 9b7802d1e282..da13d579604b 100644
--- a/contrib/llvm-project/libcxx/include/__coroutine/noop_coroutine_handle.h
+++ b/contrib/llvm-project/libcxx/include/__coroutine/noop_coroutine_handle.h
@@ -20,7 +20,7 @@
_LIBCPP_BEGIN_NAMESPACE_STD
-#if __has_builtin(__builtin_coro_noop) || defined(_LIBCPP_COMPILER_GCC)
+# if __has_builtin(__builtin_coro_noop) || defined(_LIBCPP_COMPILER_GCC)
// [coroutine.noop]
// [coroutine.promise.noop]
@@ -30,80 +30,67 @@ struct noop_coroutine_promise {};
template <>
struct _LIBCPP_TEMPLATE_VIS coroutine_handle<noop_coroutine_promise> {
public:
- // [coroutine.handle.noop.conv], conversion
- _LIBCPP_HIDE_FROM_ABI
- constexpr operator coroutine_handle<>() const noexcept {
- return coroutine_handle<>::from_address(address());
- }
-
- // [coroutine.handle.noop.observers], observers
- _LIBCPP_HIDE_FROM_ABI
- constexpr explicit operator bool() const noexcept { return true; }
- _LIBCPP_HIDE_FROM_ABI
- constexpr bool done() const noexcept { return false; }
-
- // [coroutine.handle.noop.resumption], resumption
- _LIBCPP_HIDE_FROM_ABI
- constexpr void operator()() const noexcept {}
- _LIBCPP_HIDE_FROM_ABI
- constexpr void resume() const noexcept {}
- _LIBCPP_HIDE_FROM_ABI
- constexpr void destroy() const noexcept {}
-
- // [coroutine.handle.noop.promise], promise access
- _LIBCPP_HIDE_FROM_ABI
- noop_coroutine_promise& promise() const noexcept {
- return *static_cast<noop_coroutine_promise*>(
- __builtin_coro_promise(this->__handle_, alignof(noop_coroutine_promise), false));
- }
-
- // [coroutine.handle.noop.address], address
- _LIBCPP_HIDE_FROM_ABI
- constexpr void* address() const noexcept { return __handle_; }
+ // [coroutine.handle.noop.conv], conversion
+ _LIBCPP_HIDE_FROM_ABI constexpr operator coroutine_handle<>() const noexcept {
+ return coroutine_handle<>::from_address(address());
+ }
+
+ // [coroutine.handle.noop.observers], observers
+ _LIBCPP_HIDE_FROM_ABI constexpr explicit operator bool() const noexcept { return true; }
+ _LIBCPP_HIDE_FROM_ABI constexpr bool done() const noexcept { return false; }
+
+ // [coroutine.handle.noop.resumption], resumption
+ _LIBCPP_HIDE_FROM_ABI constexpr void operator()() const noexcept {}
+ _LIBCPP_HIDE_FROM_ABI constexpr void resume() const noexcept {}
+ _LIBCPP_HIDE_FROM_ABI constexpr void destroy() const noexcept {}
+
+ // [coroutine.handle.noop.promise], promise access
+ _LIBCPP_HIDE_FROM_ABI noop_coroutine_promise& promise() const noexcept {
+ return *static_cast<noop_coroutine_promise*>(
+ __builtin_coro_promise(this->__handle_, alignof(noop_coroutine_promise), false));
+ }
+
+ // [coroutine.handle.noop.address], address
+ _LIBCPP_HIDE_FROM_ABI constexpr void* address() const noexcept { return __handle_; }
private:
- _LIBCPP_HIDE_FROM_ABI
- friend coroutine_handle<noop_coroutine_promise> noop_coroutine() noexcept;
+ _LIBCPP_HIDE_FROM_ABI friend coroutine_handle<noop_coroutine_promise> noop_coroutine() noexcept;
-#if __has_builtin(__builtin_coro_noop)
- _LIBCPP_HIDE_FROM_ABI coroutine_handle() noexcept {
- this->__handle_ = __builtin_coro_noop();
- }
+# if __has_builtin(__builtin_coro_noop)
+ _LIBCPP_HIDE_FROM_ABI coroutine_handle() noexcept { this->__handle_ = __builtin_coro_noop(); }
- void* __handle_ = nullptr;
+ void* __handle_ = nullptr;
-#elif defined(_LIBCPP_COMPILER_GCC)
- // GCC doesn't implement __builtin_coro_noop().
- // Construct the coroutine frame manually instead.
- struct __noop_coroutine_frame_ty_ {
- static void __dummy_resume_destroy_func() { }
+# elif defined(_LIBCPP_COMPILER_GCC)
+ // GCC doesn't implement __builtin_coro_noop().
+ // Construct the coroutine frame manually instead.
+ struct __noop_coroutine_frame_ty_ {
+ static void __dummy_resume_destroy_func() {}
- void (*__resume_)() = __dummy_resume_destroy_func;
- void (*__destroy_)() = __dummy_resume_destroy_func;
- struct noop_coroutine_promise __promise_;
- };
+ void (*__resume_)() = __dummy_resume_destroy_func;
+ void (*__destroy_)() = __dummy_resume_destroy_func;
+ struct noop_coroutine_promise __promise_;
+ };
- static __noop_coroutine_frame_ty_ __noop_coroutine_frame_;
+ static __noop_coroutine_frame_ty_ __noop_coroutine_frame_;
- void* __handle_ = &__noop_coroutine_frame_;
+ void* __handle_ = &__noop_coroutine_frame_;
- _LIBCPP_HIDE_FROM_ABI coroutine_handle() noexcept = default;
+ _LIBCPP_HIDE_FROM_ABI coroutine_handle() noexcept = default;
-#endif // __has_builtin(__builtin_coro_noop)
+# endif // __has_builtin(__builtin_coro_noop)
};
using noop_coroutine_handle = coroutine_handle<noop_coroutine_promise>;
-#if defined(_LIBCPP_COMPILER_GCC)
-inline noop_coroutine_handle::__noop_coroutine_frame_ty_
- noop_coroutine_handle::__noop_coroutine_frame_{};
-#endif
+# if defined(_LIBCPP_COMPILER_GCC)
+inline noop_coroutine_handle::__noop_coroutine_frame_ty_ noop_coroutine_handle::__noop_coroutine_frame_{};
+# endif
// [coroutine.noop.coroutine]
-inline _LIBCPP_HIDE_FROM_ABI
-noop_coroutine_handle noop_coroutine() noexcept { return noop_coroutine_handle(); }
+inline _LIBCPP_HIDE_FROM_ABI noop_coroutine_handle noop_coroutine() noexcept { return noop_coroutine_handle(); }
-#endif // __has_builtin(__builtin_coro_noop) || defined(_LIBCPP_COMPILER_GCC)
+# endif // __has_builtin(__builtin_coro_noop) || defined(_LIBCPP_COMPILER_GCC)
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__coroutine/trivial_awaitables.h b/contrib/llvm-project/libcxx/include/__coroutine/trivial_awaitables.h
index 0e4b08e377c0..b604bd3c2d8a 100644
--- a/contrib/llvm-project/libcxx/include/__coroutine/trivial_awaitables.h
+++ b/contrib/llvm-project/libcxx/include/__coroutine/trivial_awaitables.h
@@ -22,21 +22,15 @@ _LIBCPP_BEGIN_NAMESPACE_STD
// [coroutine.trivial.awaitables]
struct suspend_never {
- _LIBCPP_HIDE_FROM_ABI
- constexpr bool await_ready() const noexcept { return true; }
- _LIBCPP_HIDE_FROM_ABI
- constexpr void await_suspend(coroutine_handle<>) const noexcept {}
- _LIBCPP_HIDE_FROM_ABI
- constexpr void await_resume() const noexcept {}
+ _LIBCPP_HIDE_FROM_ABI constexpr bool await_ready() const noexcept { return true; }
+ _LIBCPP_HIDE_FROM_ABI constexpr void await_suspend(coroutine_handle<>) const noexcept {}
+ _LIBCPP_HIDE_FROM_ABI constexpr void await_resume() const noexcept {}
};
struct suspend_always {
- _LIBCPP_HIDE_FROM_ABI
- constexpr bool await_ready() const noexcept { return false; }
- _LIBCPP_HIDE_FROM_ABI
- constexpr void await_suspend(coroutine_handle<>) const noexcept {}
- _LIBCPP_HIDE_FROM_ABI
- constexpr void await_resume() const noexcept {}
+ _LIBCPP_HIDE_FROM_ABI constexpr bool await_ready() const noexcept { return false; }
+ _LIBCPP_HIDE_FROM_ABI constexpr void await_suspend(coroutine_handle<>) const noexcept {}
+ _LIBCPP_HIDE_FROM_ABI constexpr void await_resume() const noexcept {}
};
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__debug_utils/randomize_range.h b/contrib/llvm-project/libcxx/include/__debug_utils/randomize_range.h
index dce61923bc9c..7eb77d81ab2a 100644
--- a/contrib/llvm-project/libcxx/include/__debug_utils/randomize_range.h
+++ b/contrib/llvm-project/libcxx/include/__debug_utils/randomize_range.h
@@ -23,8 +23,7 @@
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _AlgPolicy, class _Iterator, class _Sentinel>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
-void __debug_randomize_range(_Iterator __first, _Sentinel __last) {
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 void __debug_randomize_range(_Iterator __first, _Sentinel __last) {
#ifdef _LIBCPP_DEBUG_RANDOMIZE_UNSPECIFIED_STABILITY
# ifdef _LIBCPP_CXX03_LANG
# error Support for unspecified stability is only for C++11 and higher
diff --git a/contrib/llvm-project/libcxx/include/__expected/expected.h b/contrib/llvm-project/libcxx/include/__expected/expected.h
index bf16c8f720d2..97f92bdfe44c 100644
--- a/contrib/llvm-project/libcxx/include/__expected/expected.h
+++ b/contrib/llvm-project/libcxx/include/__expected/expected.h
@@ -90,19 +90,14 @@ _LIBCPP_HIDE_FROM_ABI void __throw_bad_expected_access(_Arg&& __arg) {
template <class _Tp, class _Err>
class expected {
- static_assert(
- !is_reference_v<_Tp> &&
- !is_function_v<_Tp> &&
- !is_same_v<remove_cv_t<_Tp>, in_place_t> &&
- !is_same_v<remove_cv_t<_Tp>, unexpect_t> &&
- !__is_std_unexpected<remove_cv_t<_Tp>>::value &&
- __valid_std_unexpected<_Err>::value
- ,
- "[expected.object.general] A program that instantiates the definition of template expected<T, E> for a "
- "reference type, a function type, or for possibly cv-qualified types in_place_t, unexpect_t, or a "
- "specialization of unexpected for the T parameter is ill-formed. A program that instantiates the "
- "definition of the template expected<T, E> with a type for the E parameter that is not a valid "
- "template argument for unexpected is ill-formed.");
+ static_assert(!is_reference_v<_Tp> && !is_function_v<_Tp> && !is_same_v<remove_cv_t<_Tp>, in_place_t> &&
+ !is_same_v<remove_cv_t<_Tp>, unexpect_t> && !__is_std_unexpected<remove_cv_t<_Tp>>::value &&
+ __valid_std_unexpected<_Err>::value,
+ "[expected.object.general] A program that instantiates the definition of template expected<T, E> for a "
+ "reference type, a function type, or for possibly cv-qualified types in_place_t, unexpect_t, or a "
+ "specialization of unexpected for the T parameter is ill-formed. A program that instantiates the "
+ "definition of the template expected<T, E> with a type for the E parameter that is not a valid "
+ "template argument for unexpected is ill-formed.");
template <class _Up, class _OtherErr>
friend class expected;
@@ -116,36 +111,33 @@ public:
using rebind = expected<_Up, error_type>;
// [expected.object.ctor], constructors
- _LIBCPP_HIDE_FROM_ABI constexpr expected()
- noexcept(is_nothrow_default_constructible_v<_Tp>) // strengthened
+ _LIBCPP_HIDE_FROM_ABI constexpr expected() noexcept(is_nothrow_default_constructible_v<_Tp>) // strengthened
requires is_default_constructible_v<_Tp>
: __union_(std::in_place), __has_val_(true) {}
_LIBCPP_HIDE_FROM_ABI constexpr expected(const expected&) = delete;
_LIBCPP_HIDE_FROM_ABI constexpr expected(const expected&)
- requires(is_copy_constructible_v<_Tp> &&
- is_copy_constructible_v<_Err> &&
- is_trivially_copy_constructible_v<_Tp> &&
+ requires(is_copy_constructible_v<_Tp> && is_copy_constructible_v<_Err> && is_trivially_copy_constructible_v<_Tp> &&
is_trivially_copy_constructible_v<_Err>)
= default;
- _LIBCPP_HIDE_FROM_ABI constexpr expected(const expected& __other)
- noexcept(is_nothrow_copy_constructible_v<_Tp> && is_nothrow_copy_constructible_v<_Err>) // strengthened
+ _LIBCPP_HIDE_FROM_ABI constexpr expected(const expected& __other) noexcept(
+ is_nothrow_copy_constructible_v<_Tp> && is_nothrow_copy_constructible_v<_Err>) // strengthened
requires(is_copy_constructible_v<_Tp> && is_copy_constructible_v<_Err> &&
!(is_trivially_copy_constructible_v<_Tp> && is_trivially_copy_constructible_v<_Err>))
- : __union_(__other.__has_val_, __other.__union_), __has_val_(__other.__has_val_) { }
+ : __union_(__other.__has_val_, __other.__union_), __has_val_(__other.__has_val_) {}
_LIBCPP_HIDE_FROM_ABI constexpr expected(expected&&)
- requires(is_move_constructible_v<_Tp> && is_move_constructible_v<_Err>
- && is_trivially_move_constructible_v<_Tp> && is_trivially_move_constructible_v<_Err>)
+ requires(is_move_constructible_v<_Tp> && is_move_constructible_v<_Err> && is_trivially_move_constructible_v<_Tp> &&
+ is_trivially_move_constructible_v<_Err>)
= default;
- _LIBCPP_HIDE_FROM_ABI constexpr expected(expected&& __other)
- noexcept(is_nothrow_move_constructible_v<_Tp> && is_nothrow_move_constructible_v<_Err>)
+ _LIBCPP_HIDE_FROM_ABI constexpr expected(expected&& __other) noexcept(
+ is_nothrow_move_constructible_v<_Tp> && is_nothrow_move_constructible_v<_Err>)
requires(is_move_constructible_v<_Tp> && is_move_constructible_v<_Err> &&
!(is_trivially_move_constructible_v<_Tp> && is_trivially_move_constructible_v<_Err>))
- : __union_(__other.__has_val_, std::move(__other.__union_)), __has_val_(__other.__has_val_) { }
+ : __union_(__other.__has_val_, std::move(__other.__union_)), __has_val_(__other.__has_val_) {}
private:
template <class _Up, class _OtherErr, class _UfQual, class _OtherErrQual>
@@ -182,16 +174,16 @@ public:
requires __can_convert<_Up, _OtherErr, const _Up&, const _OtherErr&>::value
_LIBCPP_HIDE_FROM_ABI constexpr explicit(!is_convertible_v<const _Up&, _Tp> ||
!is_convertible_v<const _OtherErr&, _Err>)
- expected(const expected<_Up, _OtherErr>& __other)
- noexcept(is_nothrow_constructible_v<_Tp, const _Up&> &&
- is_nothrow_constructible_v<_Err, const _OtherErr&>) // strengthened
+ expected(const expected<_Up, _OtherErr>& __other) noexcept(
+ is_nothrow_constructible_v<_Tp, const _Up&> &&
+ is_nothrow_constructible_v<_Err, const _OtherErr&>) // strengthened
: __union_(__other.__has_val_, __other.__union_), __has_val_(__other.__has_val_) {}
template <class _Up, class _OtherErr>
requires __can_convert<_Up, _OtherErr, _Up, _OtherErr>::value
_LIBCPP_HIDE_FROM_ABI constexpr explicit(!is_convertible_v<_Up, _Tp> || !is_convertible_v<_OtherErr, _Err>)
- expected(expected<_Up, _OtherErr>&& __other)
- noexcept(is_nothrow_constructible_v<_Tp, _Up> && is_nothrow_constructible_v<_Err, _OtherErr>) // strengthened
+ expected(expected<_Up, _OtherErr>&& __other) noexcept(
+ is_nothrow_constructible_v<_Tp, _Up> && is_nothrow_constructible_v<_Err, _OtherErr>) // strengthened
: __union_(__other.__has_val_, std::move(__other.__union_)), __has_val_(__other.__has_val_) {}
template <class _Up = _Tp>
@@ -204,42 +196,38 @@ public:
template <class _OtherErr>
requires is_constructible_v<_Err, const _OtherErr&>
- _LIBCPP_HIDE_FROM_ABI constexpr explicit(!is_convertible_v<const _OtherErr&, _Err>)
- expected(const unexpected<_OtherErr>& __unex)
- noexcept(is_nothrow_constructible_v<_Err, const _OtherErr&>) // strengthened
+ _LIBCPP_HIDE_FROM_ABI constexpr explicit(!is_convertible_v<const _OtherErr&, _Err>) expected(
+ const unexpected<_OtherErr>& __unex) noexcept(is_nothrow_constructible_v<_Err, const _OtherErr&>) // strengthened
: __union_(std::unexpect, __unex.error()), __has_val_(false) {}
template <class _OtherErr>
requires is_constructible_v<_Err, _OtherErr>
_LIBCPP_HIDE_FROM_ABI constexpr explicit(!is_convertible_v<_OtherErr, _Err>)
- expected(unexpected<_OtherErr>&& __unex)
- noexcept(is_nothrow_constructible_v<_Err, _OtherErr>) // strengthened
+ expected(unexpected<_OtherErr>&& __unex) noexcept(is_nothrow_constructible_v<_Err, _OtherErr>) // strengthened
: __union_(std::unexpect, std::move(__unex.error())), __has_val_(false) {}
template <class... _Args>
requires is_constructible_v<_Tp, _Args...>
- _LIBCPP_HIDE_FROM_ABI constexpr explicit expected(in_place_t, _Args&&... __args)
- noexcept(is_nothrow_constructible_v<_Tp, _Args...>) // strengthened
+ _LIBCPP_HIDE_FROM_ABI constexpr explicit expected(in_place_t, _Args&&... __args) noexcept(
+ is_nothrow_constructible_v<_Tp, _Args...>) // strengthened
: __union_(std::in_place, std::forward<_Args>(__args)...), __has_val_(true) {}
template <class _Up, class... _Args>
requires is_constructible_v< _Tp, initializer_list<_Up>&, _Args... >
- _LIBCPP_HIDE_FROM_ABI constexpr explicit
- expected(in_place_t, initializer_list<_Up> __il, _Args&&... __args)
- noexcept(is_nothrow_constructible_v<_Tp, initializer_list<_Up>&, _Args...>) // strengthened
+ _LIBCPP_HIDE_FROM_ABI constexpr explicit expected(in_place_t, initializer_list<_Up> __il, _Args&&... __args) noexcept(
+ is_nothrow_constructible_v<_Tp, initializer_list<_Up>&, _Args...>) // strengthened
: __union_(std::in_place, __il, std::forward<_Args>(__args)...), __has_val_(true) {}
template <class... _Args>
requires is_constructible_v<_Err, _Args...>
- _LIBCPP_HIDE_FROM_ABI constexpr explicit expected(unexpect_t, _Args&&... __args)
- noexcept(is_nothrow_constructible_v<_Err, _Args...>) // strengthened
+ _LIBCPP_HIDE_FROM_ABI constexpr explicit expected(unexpect_t, _Args&&... __args) noexcept(
+ is_nothrow_constructible_v<_Err, _Args...>) // strengthened
: __union_(std::unexpect, std::forward<_Args>(__args)...), __has_val_(false) {}
template <class _Up, class... _Args>
requires is_constructible_v< _Err, initializer_list<_Up>&, _Args... >
- _LIBCPP_HIDE_FROM_ABI constexpr explicit
- expected(unexpect_t, initializer_list<_Up> __il, _Args&&... __args)
- noexcept(is_nothrow_constructible_v<_Err, initializer_list<_Up>&, _Args...>) // strengthened
+ _LIBCPP_HIDE_FROM_ABI constexpr explicit expected(unexpect_t, initializer_list<_Up> __il, _Args&&... __args) noexcept(
+ is_nothrow_constructible_v<_Err, initializer_list<_Up>&, _Args...>) // strengthened
: __union_(std::unexpect, __il, std::forward<_Args>(__args)...), __has_val_(false) {}
// [expected.object.dtor], destructor
@@ -286,17 +274,12 @@ public:
// [expected.object.assign], assignment
_LIBCPP_HIDE_FROM_ABI constexpr expected& operator=(const expected&) = delete;
- _LIBCPP_HIDE_FROM_ABI constexpr expected& operator=(const expected& __rhs)
- noexcept(is_nothrow_copy_assignable_v<_Tp> &&
- is_nothrow_copy_constructible_v<_Tp> &&
- is_nothrow_copy_assignable_v<_Err> &&
- is_nothrow_copy_constructible_v<_Err>) // strengthened
- requires(is_copy_assignable_v<_Tp> &&
- is_copy_constructible_v<_Tp> &&
- is_copy_assignable_v<_Err> &&
+ _LIBCPP_HIDE_FROM_ABI constexpr expected& operator=(const expected& __rhs) noexcept(
+ is_nothrow_copy_assignable_v<_Tp> && is_nothrow_copy_constructible_v<_Tp> && is_nothrow_copy_assignable_v<_Err> &&
+ is_nothrow_copy_constructible_v<_Err>) // strengthened
+ requires(is_copy_assignable_v<_Tp> && is_copy_constructible_v<_Tp> && is_copy_assignable_v<_Err> &&
is_copy_constructible_v<_Err> &&
- (is_nothrow_move_constructible_v<_Tp> ||
- is_nothrow_move_constructible_v<_Err>))
+ (is_nothrow_move_constructible_v<_Tp> || is_nothrow_move_constructible_v<_Err>))
{
if (__has_val_ && __rhs.__has_val_) {
__union_.__val_ = __rhs.__union_.__val_;
@@ -312,17 +295,12 @@ public:
return *this;
}
- _LIBCPP_HIDE_FROM_ABI constexpr expected& operator=(expected&& __rhs)
- noexcept(is_nothrow_move_assignable_v<_Tp> &&
- is_nothrow_move_constructible_v<_Tp> &&
- is_nothrow_move_assignable_v<_Err> &&
- is_nothrow_move_constructible_v<_Err>)
- requires(is_move_constructible_v<_Tp> &&
- is_move_assignable_v<_Tp> &&
- is_move_constructible_v<_Err> &&
+ _LIBCPP_HIDE_FROM_ABI constexpr expected&
+ operator=(expected&& __rhs) noexcept(is_nothrow_move_assignable_v<_Tp> && is_nothrow_move_constructible_v<_Tp> &&
+ is_nothrow_move_assignable_v<_Err> && is_nothrow_move_constructible_v<_Err>)
+ requires(is_move_constructible_v<_Tp> && is_move_assignable_v<_Tp> && is_move_constructible_v<_Err> &&
is_move_assignable_v<_Err> &&
- (is_nothrow_move_constructible_v<_Tp> ||
- is_nothrow_move_constructible_v<_Err>))
+ (is_nothrow_move_constructible_v<_Tp> || is_nothrow_move_constructible_v<_Err>))
{
if (__has_val_ && __rhs.__has_val_) {
__union_.__val_ = std::move(__rhs.__union_.__val_);
@@ -340,12 +318,9 @@ public:
template <class _Up = _Tp>
_LIBCPP_HIDE_FROM_ABI constexpr expected& operator=(_Up&& __v)
- requires(!is_same_v<expected, remove_cvref_t<_Up>> &&
- !__is_std_unexpected<remove_cvref_t<_Up>>::value &&
- is_constructible_v<_Tp, _Up> &&
- is_assignable_v<_Tp&, _Up> &&
- (is_nothrow_constructible_v<_Tp, _Up> ||
- is_nothrow_move_constructible_v<_Tp> ||
+ requires(!is_same_v<expected, remove_cvref_t<_Up>> && !__is_std_unexpected<remove_cvref_t<_Up>>::value &&
+ is_constructible_v<_Tp, _Up> && is_assignable_v<_Tp&, _Up> &&
+ (is_nothrow_constructible_v<_Tp, _Up> || is_nothrow_move_constructible_v<_Tp> ||
is_nothrow_move_constructible_v<_Err>))
{
if (__has_val_) {
@@ -418,20 +393,14 @@ public:
return __union_.__val_;
}
-
public:
// [expected.object.swap], swap
- _LIBCPP_HIDE_FROM_ABI constexpr void swap(expected& __rhs)
- noexcept(is_nothrow_move_constructible_v<_Tp> &&
- is_nothrow_swappable_v<_Tp> &&
- is_nothrow_move_constructible_v<_Err> &&
- is_nothrow_swappable_v<_Err>)
- requires(is_swappable_v<_Tp> &&
- is_swappable_v<_Err> &&
- is_move_constructible_v<_Tp> &&
+ _LIBCPP_HIDE_FROM_ABI constexpr void
+ swap(expected& __rhs) noexcept(is_nothrow_move_constructible_v<_Tp> && is_nothrow_swappable_v<_Tp> &&
+ is_nothrow_move_constructible_v<_Err> && is_nothrow_swappable_v<_Err>)
+ requires(is_swappable_v<_Tp> && is_swappable_v<_Err> && is_move_constructible_v<_Tp> &&
is_move_constructible_v<_Err> &&
- (is_nothrow_move_constructible_v<_Tp> ||
- is_nothrow_move_constructible_v<_Err>))
+ (is_nothrow_move_constructible_v<_Tp> || is_nothrow_move_constructible_v<_Err>))
{
auto __swap_val_unex_impl = [&](expected& __with_val, expected& __with_err) {
if constexpr (is_nothrow_move_constructible_v<_Err>) {
@@ -479,8 +448,7 @@ public:
}
}
- _LIBCPP_HIDE_FROM_ABI friend constexpr void swap(expected& __x, expected& __y)
- noexcept(noexcept(__x.swap(__y)))
+ _LIBCPP_HIDE_FROM_ABI friend constexpr void swap(expected& __x, expected& __y) noexcept(noexcept(__x.swap(__y)))
requires requires { __x.swap(__y); }
{
__x.swap(__y);
@@ -724,7 +692,8 @@ public:
return expected<_Up, _Err>(unexpect, error());
}
if constexpr (!is_void_v<_Up>) {
- return expected<_Up, _Err>(__expected_construct_in_place_from_invoke_tag{}, std::forward<_Func>(__f), __union_.__val_);
+ return expected<_Up, _Err>(
+ __expected_construct_in_place_from_invoke_tag{}, std::forward<_Func>(__f), __union_.__val_);
} else {
std::invoke(std::forward<_Func>(__f), __union_.__val_);
return expected<_Up, _Err>();
@@ -739,7 +708,8 @@ public:
return expected<_Up, _Err>(unexpect, error());
}
if constexpr (!is_void_v<_Up>) {
- return expected<_Up, _Err>(__expected_construct_in_place_from_invoke_tag{}, std::forward<_Func>(__f), __union_.__val_);
+ return expected<_Up, _Err>(
+ __expected_construct_in_place_from_invoke_tag{}, std::forward<_Func>(__f), __union_.__val_);
} else {
std::invoke(std::forward<_Func>(__f), __union_.__val_);
return expected<_Up, _Err>();
@@ -900,7 +870,7 @@ private:
template <class _ValueType, class _ErrorType>
requires(is_trivially_move_constructible_v<_ValueType> && is_trivially_move_constructible_v<_ErrorType>)
union __union_t<_ValueType, _ErrorType> {
- _LIBCPP_HIDE_FROM_ABI constexpr __union_t(const __union_t&) = default;
+ _LIBCPP_HIDE_FROM_ABI constexpr __union_t(const __union_t&) = default;
_LIBCPP_HIDE_FROM_ABI constexpr __union_t& operator=(const __union_t&) = default;
template <class... _Args>
@@ -982,8 +952,8 @@ public:
requires(is_copy_constructible_v<_Err> && is_trivially_copy_constructible_v<_Err>)
= default;
- _LIBCPP_HIDE_FROM_ABI constexpr expected(const expected& __rhs)
- noexcept(is_nothrow_copy_constructible_v<_Err>) // strengthened
+ _LIBCPP_HIDE_FROM_ABI constexpr expected(const expected& __rhs) noexcept(
+ is_nothrow_copy_constructible_v<_Err>) // strengthened
requires(is_copy_constructible_v<_Err> && !is_trivially_copy_constructible_v<_Err>)
: __union_(__rhs.__has_val_, __rhs.__union_), __has_val_(__rhs.__has_val_) {}
@@ -991,51 +961,47 @@ public:
requires(is_move_constructible_v<_Err> && is_trivially_move_constructible_v<_Err>)
= default;
- _LIBCPP_HIDE_FROM_ABI constexpr expected(expected&& __rhs)
- noexcept(is_nothrow_move_constructible_v<_Err>)
+ _LIBCPP_HIDE_FROM_ABI constexpr expected(expected&& __rhs) noexcept(is_nothrow_move_constructible_v<_Err>)
requires(is_move_constructible_v<_Err> && !is_trivially_move_constructible_v<_Err>)
: __union_(__rhs.__has_val_, std::move(__rhs.__union_)), __has_val_(__rhs.__has_val_) {}
template <class _Up, class _OtherErr>
requires __can_convert<_Up, _OtherErr, const _OtherErr&>::value
_LIBCPP_HIDE_FROM_ABI constexpr explicit(!is_convertible_v<const _OtherErr&, _Err>)
- expected(const expected<_Up, _OtherErr>& __rhs)
- noexcept(is_nothrow_constructible_v<_Err, const _OtherErr&>) // strengthened
+ expected(const expected<_Up, _OtherErr>& __rhs) noexcept(
+ is_nothrow_constructible_v<_Err, const _OtherErr&>) // strengthened
: __union_(__rhs.__has_val_, __rhs.__union_), __has_val_(__rhs.__has_val_) {}
template <class _Up, class _OtherErr>
requires __can_convert<_Up, _OtherErr, _OtherErr>::value
_LIBCPP_HIDE_FROM_ABI constexpr explicit(!is_convertible_v<_OtherErr, _Err>)
- expected(expected<_Up, _OtherErr>&& __rhs)
- noexcept(is_nothrow_constructible_v<_Err, _OtherErr>) // strengthened
+ expected(expected<_Up, _OtherErr>&& __rhs) noexcept(is_nothrow_constructible_v<_Err, _OtherErr>) // strengthened
: __union_(__rhs.__has_val_, std::move(__rhs.__union_)), __has_val_(__rhs.__has_val_) {}
template <class _OtherErr>
requires is_constructible_v<_Err, const _OtherErr&>
- _LIBCPP_HIDE_FROM_ABI constexpr explicit(!is_convertible_v<const _OtherErr&, _Err>)
- expected(const unexpected<_OtherErr>& __unex)
- noexcept(is_nothrow_constructible_v<_Err, const _OtherErr&>) // strengthened
+ _LIBCPP_HIDE_FROM_ABI constexpr explicit(!is_convertible_v<const _OtherErr&, _Err>) expected(
+ const unexpected<_OtherErr>& __unex) noexcept(is_nothrow_constructible_v<_Err, const _OtherErr&>) // strengthened
: __union_(std::unexpect, __unex.error()), __has_val_(false) {}
template <class _OtherErr>
requires is_constructible_v<_Err, _OtherErr>
_LIBCPP_HIDE_FROM_ABI constexpr explicit(!is_convertible_v<_OtherErr, _Err>)
- expected(unexpected<_OtherErr>&& __unex)
- noexcept(is_nothrow_constructible_v<_Err, _OtherErr>) // strengthened
+ expected(unexpected<_OtherErr>&& __unex) noexcept(is_nothrow_constructible_v<_Err, _OtherErr>) // strengthened
: __union_(std::unexpect, std::move(__unex.error())), __has_val_(false) {}
_LIBCPP_HIDE_FROM_ABI constexpr explicit expected(in_place_t) noexcept : __has_val_(true) {}
template <class... _Args>
requires is_constructible_v<_Err, _Args...>
- _LIBCPP_HIDE_FROM_ABI constexpr explicit expected(unexpect_t, _Args&&... __args)
- noexcept(is_nothrow_constructible_v<_Err, _Args...>) // strengthened
+ _LIBCPP_HIDE_FROM_ABI constexpr explicit expected(unexpect_t, _Args&&... __args) noexcept(
+ is_nothrow_constructible_v<_Err, _Args...>) // strengthened
: __union_(std::unexpect, std::forward<_Args>(__args)...), __has_val_(false) {}
template <class _Up, class... _Args>
requires is_constructible_v< _Err, initializer_list<_Up>&, _Args... >
- _LIBCPP_HIDE_FROM_ABI constexpr explicit expected(unexpect_t, initializer_list<_Up> __il, _Args&&... __args)
- noexcept(is_nothrow_constructible_v<_Err, initializer_list<_Up>&, _Args...>) // strengthened
+ _LIBCPP_HIDE_FROM_ABI constexpr explicit expected(unexpect_t, initializer_list<_Up> __il, _Args&&... __args) noexcept(
+ is_nothrow_constructible_v<_Err, initializer_list<_Up>&, _Args...>) // strengthened
: __union_(std::unexpect, __il, std::forward<_Args>(__args)...), __has_val_(false) {}
private:
@@ -1069,8 +1035,8 @@ public:
_LIBCPP_HIDE_FROM_ABI constexpr expected& operator=(const expected&) = delete;
- _LIBCPP_HIDE_FROM_ABI constexpr expected& operator=(const expected& __rhs)
- noexcept(is_nothrow_copy_assignable_v<_Err> && is_nothrow_copy_constructible_v<_Err>) // strengthened
+ _LIBCPP_HIDE_FROM_ABI constexpr expected& operator=(const expected& __rhs) noexcept(
+ is_nothrow_copy_assignable_v<_Err> && is_nothrow_copy_constructible_v<_Err>) // strengthened
requires(is_copy_assignable_v<_Err> && is_copy_constructible_v<_Err>)
{
if (__has_val_) {
@@ -1091,11 +1057,9 @@ public:
_LIBCPP_HIDE_FROM_ABI constexpr expected& operator=(expected&&) = delete;
- _LIBCPP_HIDE_FROM_ABI constexpr expected& operator=(expected&& __rhs)
- noexcept(is_nothrow_move_assignable_v<_Err> &&
- is_nothrow_move_constructible_v<_Err>)
- requires(is_move_assignable_v<_Err> &&
- is_move_constructible_v<_Err>)
+ _LIBCPP_HIDE_FROM_ABI constexpr expected&
+ operator=(expected&& __rhs) noexcept(is_nothrow_move_assignable_v<_Err> && is_nothrow_move_constructible_v<_Err>)
+ requires(is_move_assignable_v<_Err> && is_move_constructible_v<_Err>)
{
if (__has_val_) {
if (!__rhs.__has_val_) {
@@ -1145,8 +1109,8 @@ public:
}
// [expected.void.swap], swap
- _LIBCPP_HIDE_FROM_ABI constexpr void swap(expected& __rhs)
- noexcept(is_nothrow_move_constructible_v<_Err> && is_nothrow_swappable_v<_Err>)
+ _LIBCPP_HIDE_FROM_ABI constexpr void
+ swap(expected& __rhs) noexcept(is_nothrow_move_constructible_v<_Err> && is_nothrow_swappable_v<_Err>)
requires(is_swappable_v<_Err> && is_move_constructible_v<_Err>)
{
auto __swap_val_unex_impl = [&](expected& __with_val, expected& __with_err) {
@@ -1170,8 +1134,7 @@ public:
}
}
- _LIBCPP_HIDE_FROM_ABI friend constexpr void swap(expected& __x, expected& __y)
- noexcept(noexcept(__x.swap(__y)))
+ _LIBCPP_HIDE_FROM_ABI friend constexpr void swap(expected& __x, expected& __y) noexcept(noexcept(__x.swap(__y)))
requires requires { __x.swap(__y); }
{
__x.swap(__y);
@@ -1318,8 +1281,8 @@ public:
template <class _Func>
_LIBCPP_HIDE_FROM_ABI constexpr auto or_else(_Func&& __f) && {
using _Gp = remove_cvref_t<invoke_result_t<_Func, _Err&&>>;
- static_assert(__is_std_expected<_Gp>::value,
- "The result of f(std::move(error())) must be a specialization of std::expected");
+ static_assert(
+ __is_std_expected<_Gp>::value, "The result of f(std::move(error())) must be a specialization of std::expected");
static_assert(is_same_v<typename _Gp::value_type, _Tp>,
"The result of f(std::move(error())) must have the same value_type as this expected");
if (has_value()) {
@@ -1331,8 +1294,8 @@ public:
template <class _Func>
_LIBCPP_HIDE_FROM_ABI constexpr auto or_else(_Func&& __f) const&& {
using _Gp = remove_cvref_t<invoke_result_t<_Func, const _Err&&>>;
- static_assert(__is_std_expected<_Gp>::value,
- "The result of f(std::move(error())) must be a specialization of std::expected");
+ static_assert(
+ __is_std_expected<_Gp>::value, "The result of f(std::move(error())) must be a specialization of std::expected");
static_assert(is_same_v<typename _Gp::value_type, _Tp>,
"The result of f(std::move(error())) must have the same value_type as this expected");
if (has_value()) {
@@ -1506,7 +1469,7 @@ private:
requires is_trivially_move_constructible_v<_ErrorType>
union __union_t<_ErrorType> {
_LIBCPP_HIDE_FROM_ABI constexpr __union_t() : __empty_() {}
- _LIBCPP_HIDE_FROM_ABI constexpr __union_t(const __union_t&) = default;
+ _LIBCPP_HIDE_FROM_ABI constexpr __union_t(const __union_t&) = default;
_LIBCPP_HIDE_FROM_ABI constexpr __union_t& operator=(const __union_t&) = default;
template <class... _Args>
diff --git a/contrib/llvm-project/libcxx/include/__filesystem/copy_options.h b/contrib/llvm-project/libcxx/include/__filesystem/copy_options.h
index 60cab4ee6973..1bf71292c8a6 100644
--- a/contrib/llvm-project/libcxx/include/__filesystem/copy_options.h
+++ b/contrib/llvm-project/libcxx/include/__filesystem/copy_options.h
@@ -22,54 +22,44 @@
_LIBCPP_BEGIN_NAMESPACE_FILESYSTEM
enum class copy_options : unsigned short {
- none = 0,
- skip_existing = 1,
- overwrite_existing = 2,
- update_existing = 4,
- recursive = 8,
- copy_symlinks = 16,
- skip_symlinks = 32,
- directories_only = 64,
- create_symlinks = 128,
- create_hard_links = 256,
+ none = 0,
+ skip_existing = 1,
+ overwrite_existing = 2,
+ update_existing = 4,
+ recursive = 8,
+ copy_symlinks = 16,
+ skip_symlinks = 32,
+ directories_only = 64,
+ create_symlinks = 128,
+ create_hard_links = 256,
__in_recursive_copy = 512,
};
-_LIBCPP_HIDE_FROM_ABI
-inline constexpr copy_options operator&(copy_options __lhs, copy_options __rhs) {
- return static_cast<copy_options>(static_cast<unsigned short>(__lhs) &
- static_cast<unsigned short>(__rhs));
+_LIBCPP_HIDE_FROM_ABI inline constexpr copy_options operator&(copy_options __lhs, copy_options __rhs) {
+ return static_cast<copy_options>(static_cast<unsigned short>(__lhs) & static_cast<unsigned short>(__rhs));
}
-_LIBCPP_HIDE_FROM_ABI
-inline constexpr copy_options operator|(copy_options __lhs, copy_options __rhs) {
- return static_cast<copy_options>(static_cast<unsigned short>(__lhs) |
- static_cast<unsigned short>(__rhs));
+_LIBCPP_HIDE_FROM_ABI inline constexpr copy_options operator|(copy_options __lhs, copy_options __rhs) {
+ return static_cast<copy_options>(static_cast<unsigned short>(__lhs) | static_cast<unsigned short>(__rhs));
}
-_LIBCPP_HIDE_FROM_ABI
-inline constexpr copy_options operator^(copy_options __lhs, copy_options __rhs) {
- return static_cast<copy_options>(static_cast<unsigned short>(__lhs) ^
- static_cast<unsigned short>(__rhs));
+_LIBCPP_HIDE_FROM_ABI inline constexpr copy_options operator^(copy_options __lhs, copy_options __rhs) {
+ return static_cast<copy_options>(static_cast<unsigned short>(__lhs) ^ static_cast<unsigned short>(__rhs));
}
-_LIBCPP_HIDE_FROM_ABI
-inline constexpr copy_options operator~(copy_options __lhs) {
+_LIBCPP_HIDE_FROM_ABI inline constexpr copy_options operator~(copy_options __lhs) {
return static_cast<copy_options>(~static_cast<unsigned short>(__lhs));
}
-_LIBCPP_HIDE_FROM_ABI
-inline copy_options& operator&=(copy_options& __lhs, copy_options __rhs) {
+_LIBCPP_HIDE_FROM_ABI inline copy_options& operator&=(copy_options& __lhs, copy_options __rhs) {
return __lhs = __lhs & __rhs;
}
-_LIBCPP_HIDE_FROM_ABI
-inline copy_options& operator|=(copy_options& __lhs, copy_options __rhs) {
+_LIBCPP_HIDE_FROM_ABI inline copy_options& operator|=(copy_options& __lhs, copy_options __rhs) {
return __lhs = __lhs | __rhs;
}
-_LIBCPP_HIDE_FROM_ABI
-inline copy_options& operator^=(copy_options& __lhs, copy_options __rhs) {
+_LIBCPP_HIDE_FROM_ABI inline copy_options& operator^=(copy_options& __lhs, copy_options __rhs) {
return __lhs = __lhs ^ __rhs;
}
diff --git a/contrib/llvm-project/libcxx/include/__filesystem/directory_entry.h b/contrib/llvm-project/libcxx/include/__filesystem/directory_entry.h
index fe3cace853d6..016ad94a853d 100644
--- a/contrib/llvm-project/libcxx/include/__filesystem/directory_entry.h
+++ b/contrib/llvm-project/libcxx/include/__filesystem/directory_entry.h
@@ -45,219 +45,149 @@ class directory_entry {
public:
// constructors and destructors
- _LIBCPP_HIDE_FROM_ABI directory_entry() noexcept = default;
- _LIBCPP_HIDE_FROM_ABI directory_entry(directory_entry const&) = default;
+ _LIBCPP_HIDE_FROM_ABI directory_entry() noexcept = default;
+ _LIBCPP_HIDE_FROM_ABI directory_entry(directory_entry const&) = default;
_LIBCPP_HIDE_FROM_ABI directory_entry(directory_entry&&) noexcept = default;
- _LIBCPP_HIDE_FROM_ABI
- explicit directory_entry(_Path const& __p) : __p_(__p) {
+ _LIBCPP_HIDE_FROM_ABI explicit directory_entry(_Path const& __p) : __p_(__p) {
error_code __ec;
__refresh(&__ec);
}
- _LIBCPP_HIDE_FROM_ABI
- directory_entry(_Path const& __p, error_code& __ec) : __p_(__p) {
- __refresh(&__ec);
- }
+ _LIBCPP_HIDE_FROM_ABI directory_entry(_Path const& __p, error_code& __ec) : __p_(__p) { __refresh(&__ec); }
_LIBCPP_HIDE_FROM_ABI ~directory_entry() {}
- _LIBCPP_HIDE_FROM_ABI directory_entry& operator=(directory_entry const&) = default;
+ _LIBCPP_HIDE_FROM_ABI directory_entry& operator=(directory_entry const&) = default;
_LIBCPP_HIDE_FROM_ABI directory_entry& operator=(directory_entry&&) noexcept = default;
- _LIBCPP_HIDE_FROM_ABI
- void assign(_Path const& __p) {
+ _LIBCPP_HIDE_FROM_ABI void assign(_Path const& __p) {
__p_ = __p;
error_code __ec;
__refresh(&__ec);
}
- _LIBCPP_HIDE_FROM_ABI
- void assign(_Path const& __p, error_code& __ec) {
+ _LIBCPP_HIDE_FROM_ABI void assign(_Path const& __p, error_code& __ec) {
__p_ = __p;
__refresh(&__ec);
}
- _LIBCPP_HIDE_FROM_ABI
- void replace_filename(_Path const& __p) {
+ _LIBCPP_HIDE_FROM_ABI void replace_filename(_Path const& __p) {
__p_.replace_filename(__p);
error_code __ec;
__refresh(&__ec);
}
- _LIBCPP_HIDE_FROM_ABI
- void replace_filename(_Path const& __p, error_code& __ec) {
+ _LIBCPP_HIDE_FROM_ABI void replace_filename(_Path const& __p, error_code& __ec) {
__p_ = __p_.parent_path() / __p;
__refresh(&__ec);
}
- _LIBCPP_HIDE_FROM_ABI
- void refresh() { __refresh(); }
+ _LIBCPP_HIDE_FROM_ABI void refresh() { __refresh(); }
- _LIBCPP_HIDE_FROM_ABI
- void refresh(error_code& __ec) noexcept { __refresh(&__ec); }
+ _LIBCPP_HIDE_FROM_ABI void refresh(error_code& __ec) noexcept { __refresh(&__ec); }
- _LIBCPP_HIDE_FROM_ABI
- _Path const& path() const noexcept { return __p_; }
+ _LIBCPP_HIDE_FROM_ABI _Path const& path() const noexcept { return __p_; }
- _LIBCPP_HIDE_FROM_ABI
- operator const _Path&() const noexcept { return __p_; }
+ _LIBCPP_HIDE_FROM_ABI operator const _Path&() const noexcept { return __p_; }
- _LIBCPP_HIDE_FROM_ABI
- bool exists() const { return filesystem::exists(file_status{__get_ft()}); }
+ _LIBCPP_HIDE_FROM_ABI bool exists() const { return filesystem::exists(file_status{__get_ft()}); }
- _LIBCPP_HIDE_FROM_ABI
- bool exists(error_code& __ec) const noexcept {
+ _LIBCPP_HIDE_FROM_ABI bool exists(error_code& __ec) const noexcept {
return filesystem::exists(file_status{__get_ft(&__ec)});
}
- _LIBCPP_HIDE_FROM_ABI
- bool is_block_file() const { return __get_ft() == file_type::block; }
+ _LIBCPP_HIDE_FROM_ABI bool is_block_file() const { return __get_ft() == file_type::block; }
- _LIBCPP_HIDE_FROM_ABI
- bool is_block_file(error_code& __ec) const noexcept {
+ _LIBCPP_HIDE_FROM_ABI bool is_block_file(error_code& __ec) const noexcept {
return __get_ft(&__ec) == file_type::block;
}
- _LIBCPP_HIDE_FROM_ABI
- bool is_character_file() const { return __get_ft() == file_type::character; }
+ _LIBCPP_HIDE_FROM_ABI bool is_character_file() const { return __get_ft() == file_type::character; }
- _LIBCPP_HIDE_FROM_ABI
- bool is_character_file(error_code& __ec) const noexcept {
+ _LIBCPP_HIDE_FROM_ABI bool is_character_file(error_code& __ec) const noexcept {
return __get_ft(&__ec) == file_type::character;
}
- _LIBCPP_HIDE_FROM_ABI
- bool is_directory() const { return __get_ft() == file_type::directory; }
+ _LIBCPP_HIDE_FROM_ABI bool is_directory() const { return __get_ft() == file_type::directory; }
- _LIBCPP_HIDE_FROM_ABI
- bool is_directory(error_code& __ec) const noexcept {
+ _LIBCPP_HIDE_FROM_ABI bool is_directory(error_code& __ec) const noexcept {
return __get_ft(&__ec) == file_type::directory;
}
- _LIBCPP_HIDE_FROM_ABI
- bool is_fifo() const { return __get_ft() == file_type::fifo; }
+ _LIBCPP_HIDE_FROM_ABI bool is_fifo() const { return __get_ft() == file_type::fifo; }
- _LIBCPP_HIDE_FROM_ABI
- bool is_fifo(error_code& __ec) const noexcept {
- return __get_ft(&__ec) == file_type::fifo;
- }
+ _LIBCPP_HIDE_FROM_ABI bool is_fifo(error_code& __ec) const noexcept { return __get_ft(&__ec) == file_type::fifo; }
- _LIBCPP_HIDE_FROM_ABI
- bool is_other() const { return filesystem::is_other(file_status{__get_ft()}); }
+ _LIBCPP_HIDE_FROM_ABI bool is_other() const { return filesystem::is_other(file_status{__get_ft()}); }
- _LIBCPP_HIDE_FROM_ABI
- bool is_other(error_code& __ec) const noexcept {
+ _LIBCPP_HIDE_FROM_ABI bool is_other(error_code& __ec) const noexcept {
return filesystem::is_other(file_status{__get_ft(&__ec)});
}
- _LIBCPP_HIDE_FROM_ABI
- bool is_regular_file() const { return __get_ft() == file_type::regular; }
+ _LIBCPP_HIDE_FROM_ABI bool is_regular_file() const { return __get_ft() == file_type::regular; }
- _LIBCPP_HIDE_FROM_ABI
- bool is_regular_file(error_code& __ec) const noexcept {
+ _LIBCPP_HIDE_FROM_ABI bool is_regular_file(error_code& __ec) const noexcept {
return __get_ft(&__ec) == file_type::regular;
}
- _LIBCPP_HIDE_FROM_ABI
- bool is_socket() const { return __get_ft() == file_type::socket; }
+ _LIBCPP_HIDE_FROM_ABI bool is_socket() const { return __get_ft() == file_type::socket; }
- _LIBCPP_HIDE_FROM_ABI
- bool is_socket(error_code& __ec) const noexcept {
- return __get_ft(&__ec) == file_type::socket;
- }
+ _LIBCPP_HIDE_FROM_ABI bool is_socket(error_code& __ec) const noexcept { return __get_ft(&__ec) == file_type::socket; }
- _LIBCPP_HIDE_FROM_ABI
- bool is_symlink() const { return __get_sym_ft() == file_type::symlink; }
+ _LIBCPP_HIDE_FROM_ABI bool is_symlink() const { return __get_sym_ft() == file_type::symlink; }
- _LIBCPP_HIDE_FROM_ABI
- bool is_symlink(error_code& __ec) const noexcept {
+ _LIBCPP_HIDE_FROM_ABI bool is_symlink(error_code& __ec) const noexcept {
return __get_sym_ft(&__ec) == file_type::symlink;
}
- _LIBCPP_HIDE_FROM_ABI
- uintmax_t file_size() const { return __get_size(); }
+ _LIBCPP_HIDE_FROM_ABI uintmax_t file_size() const { return __get_size(); }
- _LIBCPP_HIDE_FROM_ABI
- uintmax_t file_size(error_code& __ec) const noexcept {
- return __get_size(&__ec);
- }
+ _LIBCPP_HIDE_FROM_ABI uintmax_t file_size(error_code& __ec) const noexcept { return __get_size(&__ec); }
- _LIBCPP_HIDE_FROM_ABI
- uintmax_t hard_link_count() const { return __get_nlink(); }
+ _LIBCPP_HIDE_FROM_ABI uintmax_t hard_link_count() const { return __get_nlink(); }
- _LIBCPP_HIDE_FROM_ABI
- uintmax_t hard_link_count(error_code& __ec) const noexcept {
- return __get_nlink(&__ec);
- }
+ _LIBCPP_HIDE_FROM_ABI uintmax_t hard_link_count(error_code& __ec) const noexcept { return __get_nlink(&__ec); }
- _LIBCPP_HIDE_FROM_ABI
- file_time_type last_write_time() const { return __get_write_time(); }
+ _LIBCPP_HIDE_FROM_ABI file_time_type last_write_time() const { return __get_write_time(); }
- _LIBCPP_HIDE_FROM_ABI
- file_time_type last_write_time(error_code& __ec) const noexcept {
+ _LIBCPP_HIDE_FROM_ABI file_time_type last_write_time(error_code& __ec) const noexcept {
return __get_write_time(&__ec);
}
- _LIBCPP_HIDE_FROM_ABI
- file_status status() const { return __get_status(); }
+ _LIBCPP_HIDE_FROM_ABI file_status status() const { return __get_status(); }
- _LIBCPP_HIDE_FROM_ABI
- file_status status(error_code& __ec) const noexcept {
- return __get_status(&__ec);
- }
+ _LIBCPP_HIDE_FROM_ABI file_status status(error_code& __ec) const noexcept { return __get_status(&__ec); }
- _LIBCPP_HIDE_FROM_ABI
- file_status symlink_status() const { return __get_symlink_status(); }
+ _LIBCPP_HIDE_FROM_ABI file_status symlink_status() const { return __get_symlink_status(); }
- _LIBCPP_HIDE_FROM_ABI
- file_status symlink_status(error_code& __ec) const noexcept {
+ _LIBCPP_HIDE_FROM_ABI file_status symlink_status(error_code& __ec) const noexcept {
return __get_symlink_status(&__ec);
}
+ _LIBCPP_HIDE_FROM_ABI bool operator==(directory_entry const& __rhs) const noexcept { return __p_ == __rhs.__p_; }
- _LIBCPP_HIDE_FROM_ABI
- bool operator==(directory_entry const& __rhs) const noexcept {
- return __p_ == __rhs.__p_;
- }
+# if _LIBCPP_STD_VER <= 17
+ _LIBCPP_HIDE_FROM_ABI bool operator!=(directory_entry const& __rhs) const noexcept { return __p_ != __rhs.__p_; }
-#if _LIBCPP_STD_VER <= 17
- _LIBCPP_HIDE_FROM_ABI
- bool operator!=(directory_entry const& __rhs) const noexcept {
- return __p_ != __rhs.__p_;
- }
+ _LIBCPP_HIDE_FROM_ABI bool operator<(directory_entry const& __rhs) const noexcept { return __p_ < __rhs.__p_; }
- _LIBCPP_HIDE_FROM_ABI
- bool operator<(directory_entry const& __rhs) const noexcept {
- return __p_ < __rhs.__p_;
- }
+ _LIBCPP_HIDE_FROM_ABI bool operator<=(directory_entry const& __rhs) const noexcept { return __p_ <= __rhs.__p_; }
- _LIBCPP_HIDE_FROM_ABI
- bool operator<=(directory_entry const& __rhs) const noexcept {
- return __p_ <= __rhs.__p_;
- }
+ _LIBCPP_HIDE_FROM_ABI bool operator>(directory_entry const& __rhs) const noexcept { return __p_ > __rhs.__p_; }
- _LIBCPP_HIDE_FROM_ABI
- bool operator>(directory_entry const& __rhs) const noexcept {
- return __p_ > __rhs.__p_;
- }
+ _LIBCPP_HIDE_FROM_ABI bool operator>=(directory_entry const& __rhs) const noexcept { return __p_ >= __rhs.__p_; }
- _LIBCPP_HIDE_FROM_ABI
- bool operator>=(directory_entry const& __rhs) const noexcept {
- return __p_ >= __rhs.__p_;
- }
-
-#else // _LIBCPP_STD_VER <= 17
+# else // _LIBCPP_STD_VER <= 17
- _LIBCPP_HIDE_FROM_ABI
- strong_ordering operator<=>(const directory_entry& __rhs) const noexcept {
+ _LIBCPP_HIDE_FROM_ABI strong_ordering operator<=>(const directory_entry& __rhs) const noexcept {
return __p_ <=> __rhs.__p_;
}
-#endif // _LIBCPP_STD_VER <= 17
+# endif // _LIBCPP_STD_VER <= 17
template <class _CharT, class _Traits>
- _LIBCPP_HIDE_FROM_ABI
- friend basic_ostream<_CharT, _Traits>& operator<<(basic_ostream<_CharT, _Traits>& __os, const directory_entry& __d) {
+ _LIBCPP_HIDE_FROM_ABI friend basic_ostream<_CharT, _Traits>&
+ operator<<(basic_ostream<_CharT, _Traits>& __os, const directory_entry& __d) {
return __os << __d.path();
}
@@ -284,23 +214,20 @@ private:
file_type __type_;
_CacheType __cache_type_;
- _LIBCPP_HIDE_FROM_ABI
- __cached_data() noexcept { __reset(); }
+ _LIBCPP_HIDE_FROM_ABI __cached_data() noexcept { __reset(); }
- _LIBCPP_HIDE_FROM_ABI
- void __reset() {
+ _LIBCPP_HIDE_FROM_ABI void __reset() {
__cache_type_ = _Empty;
- __type_ = file_type::none;
+ __type_ = file_type::none;
__sym_perms_ = __non_sym_perms_ = perms::unknown;
__size_ = __nlink_ = uintmax_t(-1);
- __write_time_ = file_time_type::min();
+ __write_time_ = file_time_type::min();
}
};
- _LIBCPP_HIDE_FROM_ABI
- static __cached_data __create_iter_result(file_type __ft) {
+ _LIBCPP_HIDE_FROM_ABI static __cached_data __create_iter_result(file_type __ft) {
__cached_data __data;
- __data.__type_ = __ft;
+ __data.__type_ = __ft;
__data.__cache_type_ = [&]() {
switch (__ft) {
case file_type::none:
@@ -314,16 +241,14 @@ private:
return __data;
}
- _LIBCPP_HIDE_FROM_ABI
- void __assign_iter_entry(_Path&& __p, __cached_data __dt) {
- __p_ = std::move(__p);
+ _LIBCPP_HIDE_FROM_ABI void __assign_iter_entry(_Path&& __p, __cached_data __dt) {
+ __p_ = std::move(__p);
__data_ = __dt;
}
_LIBCPP_EXPORTED_FROM_ABI error_code __do_refresh() noexcept;
- _LIBCPP_HIDE_FROM_ABI
- static bool __is_dne_error(error_code const& __ec) {
+ _LIBCPP_HIDE_FROM_ABI static bool __is_dne_error(error_code const& __ec) {
if (!__ec)
return true;
switch (static_cast<errc>(__ec.value())) {
@@ -335,9 +260,8 @@ private:
}
}
- _LIBCPP_HIDE_FROM_ABI
- void __handle_error(const char* __msg, error_code* __dest_ec,
- error_code const& __ec, bool __allow_dne = false) const {
+ _LIBCPP_HIDE_FROM_ABI void
+ __handle_error(const char* __msg, error_code* __dest_ec, error_code const& __ec, bool __allow_dne = false) const {
if (__dest_ec) {
*__dest_ec = __ec;
return;
@@ -346,14 +270,14 @@ private:
__throw_filesystem_error(__msg, __p_, __ec);
}
- _LIBCPP_HIDE_FROM_ABI
- void __refresh(error_code* __ec = nullptr) {
- __handle_error("in directory_entry::refresh", __ec, __do_refresh(),
+ _LIBCPP_HIDE_FROM_ABI void __refresh(error_code* __ec = nullptr) {
+ __handle_error("in directory_entry::refresh",
+ __ec,
+ __do_refresh(),
/*allow_dne*/ true);
}
- _LIBCPP_HIDE_FROM_ABI
- file_type __get_sym_ft(error_code* __ec = nullptr) const {
+ _LIBCPP_HIDE_FROM_ABI file_type __get_sym_ft(error_code* __ec = nullptr) const {
switch (__data_.__cache_type_) {
case _Empty:
return __symlink_status(__p_, __ec).type();
@@ -375,8 +299,7 @@ private:
__libcpp_unreachable();
}
- _LIBCPP_HIDE_FROM_ABI
- file_type __get_ft(error_code* __ec = nullptr) const {
+ _LIBCPP_HIDE_FROM_ABI file_type __get_ft(error_code* __ec = nullptr) const {
switch (__data_.__cache_type_) {
case _Empty:
case _IterSymlink:
@@ -396,8 +319,7 @@ private:
__libcpp_unreachable();
}
- _LIBCPP_HIDE_FROM_ABI
- file_status __get_status(error_code* __ec = nullptr) const {
+ _LIBCPP_HIDE_FROM_ABI file_status __get_status(error_code* __ec = nullptr) const {
switch (__data_.__cache_type_) {
case _Empty:
case _IterNonSymlink:
@@ -411,8 +333,7 @@ private:
__libcpp_unreachable();
}
- _LIBCPP_HIDE_FROM_ABI
- file_status __get_symlink_status(error_code* __ec = nullptr) const {
+ _LIBCPP_HIDE_FROM_ABI file_status __get_symlink_status(error_code* __ec = nullptr) const {
switch (__data_.__cache_type_) {
case _Empty:
case _IterNonSymlink:
@@ -427,8 +348,7 @@ private:
__libcpp_unreachable();
}
- _LIBCPP_HIDE_FROM_ABI
- uintmax_t __get_size(error_code* __ec = nullptr) const {
+ _LIBCPP_HIDE_FROM_ABI uintmax_t __get_size(error_code* __ec = nullptr) const {
switch (__data_.__cache_type_) {
case _Empty:
case _IterNonSymlink:
@@ -441,10 +361,8 @@ private:
file_status __st(__get_ft(&__m_ec));
__handle_error("in directory_entry::file_size", __ec, __m_ec);
if (filesystem::exists(__st) && !filesystem::is_regular_file(__st)) {
- errc __err_kind = filesystem::is_directory(__st) ? errc::is_a_directory
- : errc::not_supported;
- __handle_error("in directory_entry::file_size", __ec,
- make_error_code(__err_kind));
+ errc __err_kind = filesystem::is_directory(__st) ? errc::is_a_directory : errc::not_supported;
+ __handle_error("in directory_entry::file_size", __ec, make_error_code(__err_kind));
}
return __data_.__size_;
}
@@ -452,8 +370,7 @@ private:
__libcpp_unreachable();
}
- _LIBCPP_HIDE_FROM_ABI
- uintmax_t __get_nlink(error_code* __ec = nullptr) const {
+ _LIBCPP_HIDE_FROM_ABI uintmax_t __get_nlink(error_code* __ec = nullptr) const {
switch (__data_.__cache_type_) {
case _Empty:
case _IterNonSymlink:
@@ -471,8 +388,7 @@ private:
__libcpp_unreachable();
}
- _LIBCPP_HIDE_FROM_ABI
- file_time_type __get_write_time(error_code* __ec = nullptr) const {
+ _LIBCPP_HIDE_FROM_ABI file_time_type __get_write_time(error_code* __ec = nullptr) const {
switch (__data_.__cache_type_) {
case _Empty:
case _IterNonSymlink:
@@ -484,10 +400,8 @@ private:
error_code __m_ec;
file_status __st(__get_ft(&__m_ec));
__handle_error("in directory_entry::last_write_time", __ec, __m_ec);
- if (filesystem::exists(__st) &&
- __data_.__write_time_ == file_time_type::min())
- __handle_error("in directory_entry::last_write_time", __ec,
- make_error_code(errc::value_too_large));
+ if (filesystem::exists(__st) && __data_.__write_time_ == file_time_type::min())
+ __handle_error("in directory_entry::last_write_time", __ec, make_error_code(errc::value_too_large));
return __data_.__write_time_;
}
}
@@ -501,16 +415,13 @@ private:
class __dir_element_proxy {
public:
- inline _LIBCPP_HIDE_FROM_ABI directory_entry operator*() {
- return std::move(__elem_);
- }
+ inline _LIBCPP_HIDE_FROM_ABI directory_entry operator*() { return std::move(__elem_); }
private:
friend class directory_iterator;
friend class recursive_directory_iterator;
_LIBCPP_HIDE_FROM_ABI explicit __dir_element_proxy(directory_entry const& __e) : __elem_(__e) {}
- _LIBCPP_HIDE_FROM_ABI __dir_element_proxy(__dir_element_proxy&& __o)
- : __elem_(std::move(__o.__elem_)) {}
+ _LIBCPP_HIDE_FROM_ABI __dir_element_proxy(__dir_element_proxy&& __o) : __elem_(std::move(__o.__elem_)) {}
directory_entry __elem_;
};
diff --git a/contrib/llvm-project/libcxx/include/__filesystem/directory_iterator.h b/contrib/llvm-project/libcxx/include/__filesystem/directory_iterator.h
index a2a48e593307..29bd8da6caa4 100644
--- a/contrib/llvm-project/libcxx/include/__filesystem/directory_iterator.h
+++ b/contrib/llvm-project/libcxx/include/__filesystem/directory_iterator.h
@@ -45,33 +45,24 @@ public:
typedef input_iterator_tag iterator_category;
public:
- //ctor & dtor
- _LIBCPP_HIDE_FROM_ABI
- directory_iterator() noexcept {}
+ // ctor & dtor
+ _LIBCPP_HIDE_FROM_ABI directory_iterator() noexcept {}
- _LIBCPP_HIDE_FROM_ABI
- explicit directory_iterator(const path& __p)
- : directory_iterator(__p, nullptr) {}
+ _LIBCPP_HIDE_FROM_ABI explicit directory_iterator(const path& __p) : directory_iterator(__p, nullptr) {}
- _LIBCPP_HIDE_FROM_ABI
- directory_iterator(const path& __p, directory_options __opts)
+ _LIBCPP_HIDE_FROM_ABI directory_iterator(const path& __p, directory_options __opts)
: directory_iterator(__p, nullptr, __opts) {}
- _LIBCPP_HIDE_FROM_ABI
- directory_iterator(const path& __p, error_code& __ec)
- : directory_iterator(__p, &__ec) {}
+ _LIBCPP_HIDE_FROM_ABI directory_iterator(const path& __p, error_code& __ec) : directory_iterator(__p, &__ec) {}
- _LIBCPP_HIDE_FROM_ABI
- directory_iterator(const path& __p, directory_options __opts,
- error_code& __ec)
+ _LIBCPP_HIDE_FROM_ABI directory_iterator(const path& __p, directory_options __opts, error_code& __ec)
: directory_iterator(__p, &__ec, __opts) {}
- _LIBCPP_HIDE_FROM_ABI directory_iterator(const directory_iterator&) = default;
- _LIBCPP_HIDE_FROM_ABI directory_iterator(directory_iterator&&) = default;
+ _LIBCPP_HIDE_FROM_ABI directory_iterator(const directory_iterator&) = default;
+ _LIBCPP_HIDE_FROM_ABI directory_iterator(directory_iterator&&) = default;
_LIBCPP_HIDE_FROM_ABI directory_iterator& operator=(const directory_iterator&) = default;
- _LIBCPP_HIDE_FROM_ABI
- directory_iterator& operator=(directory_iterator&& __o) noexcept {
+ _LIBCPP_HIDE_FROM_ABI directory_iterator& operator=(directory_iterator&& __o) noexcept {
// non-default implementation provided to support self-move assign.
if (this != &__o) {
__imp_ = std::move(__o.__imp_);
@@ -81,27 +72,22 @@ public:
_LIBCPP_HIDE_FROM_ABI ~directory_iterator() = default;
- _LIBCPP_HIDE_FROM_ABI
- const directory_entry& operator*() const {
+ _LIBCPP_HIDE_FROM_ABI const directory_entry& operator*() const {
_LIBCPP_ASSERT_UNCATEGORIZED(__imp_, "The end iterator cannot be dereferenced");
return __dereference();
}
- _LIBCPP_HIDE_FROM_ABI
- const directory_entry* operator->() const { return &**this; }
+ _LIBCPP_HIDE_FROM_ABI const directory_entry* operator->() const { return &**this; }
- _LIBCPP_HIDE_FROM_ABI
- directory_iterator& operator++() { return __increment(); }
+ _LIBCPP_HIDE_FROM_ABI directory_iterator& operator++() { return __increment(); }
- _LIBCPP_HIDE_FROM_ABI
- __dir_element_proxy operator++(int) {
+ _LIBCPP_HIDE_FROM_ABI __dir_element_proxy operator++(int) {
__dir_element_proxy __p(**this);
__increment();
return __p;
}
- _LIBCPP_HIDE_FROM_ABI
- directory_iterator& increment(error_code& __ec) { return __increment(&__ec); }
+ _LIBCPP_HIDE_FROM_ABI directory_iterator& increment(error_code& __ec) { return __increment(&__ec); }
# if _LIBCPP_STD_VER >= 20
@@ -111,8 +97,7 @@ public:
private:
inline _LIBCPP_HIDE_FROM_ABI friend bool
- operator==(const directory_iterator& __lhs,
- const directory_iterator& __rhs) noexcept;
+ operator==(const directory_iterator& __lhs, const directory_iterator& __rhs) noexcept;
// construct the dir_stream
_LIBCPP_EXPORTED_FROM_ABI directory_iterator(const path&, error_code*, directory_options = directory_options::none);
@@ -126,43 +111,35 @@ private:
};
inline _LIBCPP_HIDE_FROM_ABI bool
-operator==(const directory_iterator& __lhs,
- const directory_iterator& __rhs) noexcept {
+operator==(const directory_iterator& __lhs, const directory_iterator& __rhs) noexcept {
return __lhs.__imp_ == __rhs.__imp_;
}
inline _LIBCPP_HIDE_FROM_ABI bool
-operator!=(const directory_iterator& __lhs,
- const directory_iterator& __rhs) noexcept {
+operator!=(const directory_iterator& __lhs, const directory_iterator& __rhs) noexcept {
return !(__lhs == __rhs);
}
// enable directory_iterator range-based for statements
-inline _LIBCPP_HIDE_FROM_ABI directory_iterator
-begin(directory_iterator __iter) noexcept {
- return __iter;
-}
+inline _LIBCPP_HIDE_FROM_ABI directory_iterator begin(directory_iterator __iter) noexcept { return __iter; }
-inline _LIBCPP_HIDE_FROM_ABI directory_iterator
-end(directory_iterator) noexcept {
- return directory_iterator();
-}
+inline _LIBCPP_HIDE_FROM_ABI directory_iterator end(directory_iterator) noexcept { return directory_iterator(); }
_LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY_POP
_LIBCPP_END_NAMESPACE_FILESYSTEM
-#if _LIBCPP_STD_VER >= 20
+# if _LIBCPP_STD_VER >= 20
template <>
-_LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY
-inline constexpr bool std::ranges::enable_borrowed_range<std::filesystem::directory_iterator> = true;
+_LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY inline constexpr bool
+ std::ranges::enable_borrowed_range<std::filesystem::directory_iterator> = true;
template <>
-_LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY
-inline constexpr bool std::ranges::enable_view<std::filesystem::directory_iterator> = true;
+_LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY inline constexpr bool
+ std::ranges::enable_view<std::filesystem::directory_iterator> = true;
-#endif // _LIBCPP_STD_VER >= 20
+# endif // _LIBCPP_STD_VER >= 20
#endif // _LIBCPP_STD_VER >= 17 && !defined(_LIBCPP_HAS_NO_FILESYSTEM)
diff --git a/contrib/llvm-project/libcxx/include/__filesystem/directory_options.h b/contrib/llvm-project/libcxx/include/__filesystem/directory_options.h
index 05885bc488b0..683c4678e083 100644
--- a/contrib/llvm-project/libcxx/include/__filesystem/directory_options.h
+++ b/contrib/llvm-project/libcxx/include/__filesystem/directory_options.h
@@ -21,53 +21,33 @@
_LIBCPP_BEGIN_NAMESPACE_FILESYSTEM
-enum class directory_options : unsigned char {
- none = 0,
- follow_directory_symlink = 1,
- skip_permission_denied = 2
-};
-
-_LIBCPP_HIDE_FROM_ABI
-inline constexpr directory_options operator&(directory_options __lhs,
- directory_options __rhs) {
- return static_cast<directory_options>(static_cast<unsigned char>(__lhs) &
- static_cast<unsigned char>(__rhs));
+enum class directory_options : unsigned char { none = 0, follow_directory_symlink = 1, skip_permission_denied = 2 };
+
+_LIBCPP_HIDE_FROM_ABI inline constexpr directory_options operator&(directory_options __lhs, directory_options __rhs) {
+ return static_cast<directory_options>(static_cast<unsigned char>(__lhs) & static_cast<unsigned char>(__rhs));
}
-_LIBCPP_HIDE_FROM_ABI
-inline constexpr directory_options operator|(directory_options __lhs,
- directory_options __rhs) {
- return static_cast<directory_options>(static_cast<unsigned char>(__lhs) |
- static_cast<unsigned char>(__rhs));
+_LIBCPP_HIDE_FROM_ABI inline constexpr directory_options operator|(directory_options __lhs, directory_options __rhs) {
+ return static_cast<directory_options>(static_cast<unsigned char>(__lhs) | static_cast<unsigned char>(__rhs));
}
-_LIBCPP_HIDE_FROM_ABI
-inline constexpr directory_options operator^(directory_options __lhs,
- directory_options __rhs) {
- return static_cast<directory_options>(static_cast<unsigned char>(__lhs) ^
- static_cast<unsigned char>(__rhs));
+_LIBCPP_HIDE_FROM_ABI inline constexpr directory_options operator^(directory_options __lhs, directory_options __rhs) {
+ return static_cast<directory_options>(static_cast<unsigned char>(__lhs) ^ static_cast<unsigned char>(__rhs));
}
-_LIBCPP_HIDE_FROM_ABI
-inline constexpr directory_options operator~(directory_options __lhs) {
+_LIBCPP_HIDE_FROM_ABI inline constexpr directory_options operator~(directory_options __lhs) {
return static_cast<directory_options>(~static_cast<unsigned char>(__lhs));
}
-_LIBCPP_HIDE_FROM_ABI
-inline directory_options& operator&=(directory_options& __lhs,
- directory_options __rhs) {
+_LIBCPP_HIDE_FROM_ABI inline directory_options& operator&=(directory_options& __lhs, directory_options __rhs) {
return __lhs = __lhs & __rhs;
}
-_LIBCPP_HIDE_FROM_ABI
-inline directory_options& operator|=(directory_options& __lhs,
- directory_options __rhs) {
+_LIBCPP_HIDE_FROM_ABI inline directory_options& operator|=(directory_options& __lhs, directory_options __rhs) {
return __lhs = __lhs | __rhs;
}
-_LIBCPP_HIDE_FROM_ABI
-inline directory_options& operator^=(directory_options& __lhs,
- directory_options __rhs) {
+_LIBCPP_HIDE_FROM_ABI inline directory_options& operator^=(directory_options& __lhs, directory_options __rhs) {
return __lhs = __lhs ^ __rhs;
}
diff --git a/contrib/llvm-project/libcxx/include/__filesystem/file_status.h b/contrib/llvm-project/libcxx/include/__filesystem/file_status.h
index 2a1ce85a3754..3e2b32eef82e 100644
--- a/contrib/llvm-project/libcxx/include/__filesystem/file_status.h
+++ b/contrib/llvm-project/libcxx/include/__filesystem/file_status.h
@@ -26,35 +26,27 @@ _LIBCPP_BEGIN_NAMESPACE_FILESYSTEM
class _LIBCPP_EXPORTED_FROM_ABI file_status {
public:
// constructors
- _LIBCPP_HIDE_FROM_ABI
- file_status() noexcept : file_status(file_type::none) {}
- _LIBCPP_HIDE_FROM_ABI
- explicit file_status(file_type __ft, perms __prms = perms::unknown) noexcept
- : __ft_(__ft),
- __prms_(__prms) {}
+ _LIBCPP_HIDE_FROM_ABI file_status() noexcept : file_status(file_type::none) {}
+ _LIBCPP_HIDE_FROM_ABI explicit file_status(file_type __ft, perms __prms = perms::unknown) noexcept
+ : __ft_(__ft), __prms_(__prms) {}
_LIBCPP_HIDE_FROM_ABI file_status(const file_status&) noexcept = default;
- _LIBCPP_HIDE_FROM_ABI file_status(file_status&&) noexcept = default;
+ _LIBCPP_HIDE_FROM_ABI file_status(file_status&&) noexcept = default;
- _LIBCPP_HIDE_FROM_ABI
- ~file_status() {}
+ _LIBCPP_HIDE_FROM_ABI ~file_status() {}
_LIBCPP_HIDE_FROM_ABI file_status& operator=(const file_status&) noexcept = default;
- _LIBCPP_HIDE_FROM_ABI file_status& operator=(file_status&&) noexcept = default;
+ _LIBCPP_HIDE_FROM_ABI file_status& operator=(file_status&&) noexcept = default;
// observers
- _LIBCPP_HIDE_FROM_ABI
- file_type type() const noexcept { return __ft_; }
+ _LIBCPP_HIDE_FROM_ABI file_type type() const noexcept { return __ft_; }
- _LIBCPP_HIDE_FROM_ABI
- perms permissions() const noexcept { return __prms_; }
+ _LIBCPP_HIDE_FROM_ABI perms permissions() const noexcept { return __prms_; }
// modifiers
- _LIBCPP_HIDE_FROM_ABI
- void type(file_type __ft) noexcept { __ft_ = __ft; }
+ _LIBCPP_HIDE_FROM_ABI void type(file_type __ft) noexcept { __ft_ = __ft; }
- _LIBCPP_HIDE_FROM_ABI
- void permissions(perms __p) noexcept { __prms_ = __p; }
+ _LIBCPP_HIDE_FROM_ABI void permissions(perms __p) noexcept { __prms_ = __p; }
# if _LIBCPP_STD_VER >= 20
diff --git a/contrib/llvm-project/libcxx/include/__filesystem/file_type.h b/contrib/llvm-project/libcxx/include/__filesystem/file_type.h
index f456552db543..c509085d90de 100644
--- a/contrib/llvm-project/libcxx/include/__filesystem/file_type.h
+++ b/contrib/llvm-project/libcxx/include/__filesystem/file_type.h
@@ -24,16 +24,16 @@ _LIBCPP_BEGIN_NAMESPACE_FILESYSTEM
// On Windows, the library never identifies files as block, character, fifo
// or socket.
enum class file_type : signed char {
- none = 0,
+ none = 0,
not_found = -1,
- regular = 1,
+ regular = 1,
directory = 2,
- symlink = 3,
- block = 4,
+ symlink = 3,
+ block = 4,
character = 5,
- fifo = 6,
- socket = 7,
- unknown = 8
+ fifo = 6,
+ socket = 7,
+ unknown = 8
};
_LIBCPP_END_NAMESPACE_FILESYSTEM
diff --git a/contrib/llvm-project/libcxx/include/__filesystem/operations.h b/contrib/llvm-project/libcxx/include/__filesystem/operations.h
index ebe816549a9e..9bb83576f54b 100644
--- a/contrib/llvm-project/libcxx/include/__filesystem/operations.h
+++ b/contrib/llvm-project/libcxx/include/__filesystem/operations.h
@@ -36,15 +36,21 @@ _LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY_PUSH
_LIBCPP_EXPORTED_FROM_ABI path __absolute(const path&, error_code* __ec = nullptr);
_LIBCPP_EXPORTED_FROM_ABI path __canonical(const path&, error_code* __ec = nullptr);
-_LIBCPP_EXPORTED_FROM_ABI bool __copy_file(const path& __from, const path& __to, copy_options __opt, error_code* __ec = nullptr);
-_LIBCPP_EXPORTED_FROM_ABI void __copy_symlink(const path& __existing_symlink, const path& __new_symlink, error_code* __ec = nullptr);
-_LIBCPP_EXPORTED_FROM_ABI void __copy(const path& __from, const path& __to, copy_options __opt, error_code* __ec = nullptr);
+_LIBCPP_EXPORTED_FROM_ABI bool
+__copy_file(const path& __from, const path& __to, copy_options __opt, error_code* __ec = nullptr);
+_LIBCPP_EXPORTED_FROM_ABI void
+__copy_symlink(const path& __existing_symlink, const path& __new_symlink, error_code* __ec = nullptr);
+_LIBCPP_EXPORTED_FROM_ABI void
+__copy(const path& __from, const path& __to, copy_options __opt, error_code* __ec = nullptr);
_LIBCPP_EXPORTED_FROM_ABI bool __create_directories(const path&, error_code* = nullptr);
-_LIBCPP_EXPORTED_FROM_ABI void __create_directory_symlink(const path& __to, const path& __new_symlink, error_code* __ec = nullptr);
+_LIBCPP_EXPORTED_FROM_ABI void
+__create_directory_symlink(const path& __to, const path& __new_symlink, error_code* __ec = nullptr);
_LIBCPP_EXPORTED_FROM_ABI bool __create_directory(const path&, error_code* = nullptr);
_LIBCPP_EXPORTED_FROM_ABI bool __create_directory(const path&, const path& __attributes, error_code* = nullptr);
-_LIBCPP_EXPORTED_FROM_ABI void __create_hard_link(const path& __to, const path& __new_hard_link, error_code* __ec = nullptr);
-_LIBCPP_EXPORTED_FROM_ABI void __create_symlink(const path& __to, const path& __new_symlink, error_code* __ec = nullptr);
+_LIBCPP_EXPORTED_FROM_ABI void
+__create_hard_link(const path& __to, const path& __new_hard_link, error_code* __ec = nullptr);
+_LIBCPP_EXPORTED_FROM_ABI void
+__create_symlink(const path& __to, const path& __new_symlink, error_code* __ec = nullptr);
_LIBCPP_EXPORTED_FROM_ABI path __current_path(error_code* __ec = nullptr);
_LIBCPP_EXPORTED_FROM_ABI void __current_path(const path&, error_code* __ec = nullptr);
_LIBCPP_EXPORTED_FROM_ABI bool __equivalent(const path&, const path&, error_code* __ec = nullptr);
@@ -64,38 +70,85 @@ _LIBCPP_EXPORTED_FROM_ABI path __temp_directory_path(error_code* __ec = nullptr)
inline _LIBCPP_HIDE_FROM_ABI path absolute(const path& __p) { return __absolute(__p); }
inline _LIBCPP_HIDE_FROM_ABI path absolute(const path& __p, error_code& __ec) { return __absolute(__p, &__ec); }
-inline _LIBCPP_HIDE_FROM_ABI path canonical(const path& __p) { return __canonical(__p); }
+inline _LIBCPP_HIDE_FROM_ABI path canonical(const path& __p) { return __canonical(__p); }
inline _LIBCPP_HIDE_FROM_ABI path canonical(const path& __p, error_code& __ec) { return __canonical(__p, &__ec); }
-inline _LIBCPP_HIDE_FROM_ABI bool copy_file(const path& __from, const path& __to) { return __copy_file(__from, __to, copy_options::none); }
-inline _LIBCPP_HIDE_FROM_ABI bool copy_file(const path& __from, const path& __to, error_code& __ec) { return __copy_file(__from, __to, copy_options::none, &__ec); }
-inline _LIBCPP_HIDE_FROM_ABI bool copy_file(const path& __from, const path& __to, copy_options __opt) { return __copy_file(__from, __to, __opt); }
-inline _LIBCPP_HIDE_FROM_ABI bool copy_file(const path& __from, const path& __to, copy_options __opt, error_code& __ec) { return __copy_file(__from, __to, __opt, &__ec); }
+inline _LIBCPP_HIDE_FROM_ABI bool copy_file(const path& __from, const path& __to) {
+ return __copy_file(__from, __to, copy_options::none);
+}
+inline _LIBCPP_HIDE_FROM_ABI bool copy_file(const path& __from, const path& __to, error_code& __ec) {
+ return __copy_file(__from, __to, copy_options::none, &__ec);
+}
+inline _LIBCPP_HIDE_FROM_ABI bool copy_file(const path& __from, const path& __to, copy_options __opt) {
+ return __copy_file(__from, __to, __opt);
+}
+inline _LIBCPP_HIDE_FROM_ABI bool
+copy_file(const path& __from, const path& __to, copy_options __opt, error_code& __ec) {
+ return __copy_file(__from, __to, __opt, &__ec);
+}
inline _LIBCPP_HIDE_FROM_ABI void copy_symlink(const path& __from, const path& __to) { __copy_symlink(__from, __to); }
-inline _LIBCPP_HIDE_FROM_ABI void copy_symlink(const path& __from, const path& __to, error_code& __ec) noexcept { __copy_symlink(__from, __to, &__ec); }
-inline _LIBCPP_HIDE_FROM_ABI void copy(const path& __from, const path& __to) { __copy(__from, __to, copy_options::none); }
-inline _LIBCPP_HIDE_FROM_ABI void copy(const path& __from, const path& __to, error_code& __ec) { __copy(__from, __to, copy_options::none, &__ec); }
-inline _LIBCPP_HIDE_FROM_ABI void copy(const path& __from, const path& __to, copy_options __opt) { __copy(__from, __to, __opt); }
-inline _LIBCPP_HIDE_FROM_ABI void copy(const path& __from, const path& __to, copy_options __opt, error_code& __ec) { __copy(__from, __to, __opt, &__ec); }
+inline _LIBCPP_HIDE_FROM_ABI void copy_symlink(const path& __from, const path& __to, error_code& __ec) noexcept {
+ __copy_symlink(__from, __to, &__ec);
+}
+inline _LIBCPP_HIDE_FROM_ABI void copy(const path& __from, const path& __to) {
+ __copy(__from, __to, copy_options::none);
+}
+inline _LIBCPP_HIDE_FROM_ABI void copy(const path& __from, const path& __to, error_code& __ec) {
+ __copy(__from, __to, copy_options::none, &__ec);
+}
+inline _LIBCPP_HIDE_FROM_ABI void copy(const path& __from, const path& __to, copy_options __opt) {
+ __copy(__from, __to, __opt);
+}
+inline _LIBCPP_HIDE_FROM_ABI void copy(const path& __from, const path& __to, copy_options __opt, error_code& __ec) {
+ __copy(__from, __to, __opt, &__ec);
+}
inline _LIBCPP_HIDE_FROM_ABI bool create_directories(const path& __p) { return __create_directories(__p); }
-inline _LIBCPP_HIDE_FROM_ABI bool create_directories(const path& __p, error_code& __ec) { return __create_directories(__p, &__ec); }
-inline _LIBCPP_HIDE_FROM_ABI void create_directory_symlink(const path& __target, const path& __link) { __create_directory_symlink(__target, __link); }
-inline _LIBCPP_HIDE_FROM_ABI void create_directory_symlink(const path& __target, const path& __link, error_code& __ec) noexcept { __create_directory_symlink(__target, __link, &__ec); }
+inline _LIBCPP_HIDE_FROM_ABI bool create_directories(const path& __p, error_code& __ec) {
+ return __create_directories(__p, &__ec);
+}
+inline _LIBCPP_HIDE_FROM_ABI void create_directory_symlink(const path& __target, const path& __link) {
+ __create_directory_symlink(__target, __link);
+}
+inline _LIBCPP_HIDE_FROM_ABI void
+create_directory_symlink(const path& __target, const path& __link, error_code& __ec) noexcept {
+ __create_directory_symlink(__target, __link, &__ec);
+}
inline _LIBCPP_HIDE_FROM_ABI bool create_directory(const path& __p) { return __create_directory(__p); }
-inline _LIBCPP_HIDE_FROM_ABI bool create_directory(const path& __p, error_code& __ec) noexcept { return __create_directory(__p, &__ec); }
-inline _LIBCPP_HIDE_FROM_ABI bool create_directory(const path& __p, const path& __attrs) { return __create_directory(__p, __attrs); }
-inline _LIBCPP_HIDE_FROM_ABI bool create_directory(const path& __p, const path& __attrs, error_code& __ec) noexcept { return __create_directory(__p, __attrs, &__ec); }
-inline _LIBCPP_HIDE_FROM_ABI void create_hard_link(const path& __target, const path& __link) { __create_hard_link(__target, __link); }
-inline _LIBCPP_HIDE_FROM_ABI void create_hard_link(const path& __target, const path& __link, error_code& __ec) noexcept { __create_hard_link(__target, __link, &__ec); }
-inline _LIBCPP_HIDE_FROM_ABI void create_symlink(const path& __target, const path& __link) { __create_symlink(__target, __link); }
-inline _LIBCPP_HIDE_FROM_ABI void create_symlink(const path& __target, const path& __link, error_code& __ec) noexcept { return __create_symlink(__target, __link, &__ec); }
+inline _LIBCPP_HIDE_FROM_ABI bool create_directory(const path& __p, error_code& __ec) noexcept {
+ return __create_directory(__p, &__ec);
+}
+inline _LIBCPP_HIDE_FROM_ABI bool create_directory(const path& __p, const path& __attrs) {
+ return __create_directory(__p, __attrs);
+}
+inline _LIBCPP_HIDE_FROM_ABI bool create_directory(const path& __p, const path& __attrs, error_code& __ec) noexcept {
+ return __create_directory(__p, __attrs, &__ec);
+}
+inline _LIBCPP_HIDE_FROM_ABI void create_hard_link(const path& __target, const path& __link) {
+ __create_hard_link(__target, __link);
+}
+inline _LIBCPP_HIDE_FROM_ABI void
+create_hard_link(const path& __target, const path& __link, error_code& __ec) noexcept {
+ __create_hard_link(__target, __link, &__ec);
+}
+inline _LIBCPP_HIDE_FROM_ABI void create_symlink(const path& __target, const path& __link) {
+ __create_symlink(__target, __link);
+}
+inline _LIBCPP_HIDE_FROM_ABI void create_symlink(const path& __target, const path& __link, error_code& __ec) noexcept {
+ return __create_symlink(__target, __link, &__ec);
+}
inline _LIBCPP_HIDE_FROM_ABI path current_path() { return __current_path(); }
inline _LIBCPP_HIDE_FROM_ABI path current_path(error_code& __ec) { return __current_path(&__ec); }
inline _LIBCPP_HIDE_FROM_ABI void current_path(const path& __p) { __current_path(__p); }
-inline _LIBCPP_HIDE_FROM_ABI void current_path(const path& __p, error_code& __ec) noexcept { __current_path(__p, &__ec); }
+inline _LIBCPP_HIDE_FROM_ABI void current_path(const path& __p, error_code& __ec) noexcept {
+ __current_path(__p, &__ec);
+}
inline _LIBCPP_HIDE_FROM_ABI bool equivalent(const path& __p1, const path& __p2) { return __equivalent(__p1, __p2); }
-inline _LIBCPP_HIDE_FROM_ABI bool equivalent(const path& __p1, const path& __p2, error_code& __ec) noexcept { return __equivalent(__p1, __p2, &__ec); }
+inline _LIBCPP_HIDE_FROM_ABI bool equivalent(const path& __p1, const path& __p2, error_code& __ec) noexcept {
+ return __equivalent(__p1, __p2, &__ec);
+}
inline _LIBCPP_HIDE_FROM_ABI bool status_known(file_status __s) noexcept { return __s.type() != file_type::none; }
-inline _LIBCPP_HIDE_FROM_ABI bool exists(file_status __s) noexcept { return status_known(__s) && __s.type() != file_type::not_found; }
+inline _LIBCPP_HIDE_FROM_ABI bool exists(file_status __s) noexcept {
+ return status_known(__s) && __s.type() != file_type::not_found;
+}
inline _LIBCPP_HIDE_FROM_ABI bool exists(const path& __p) { return exists(__status(__p)); }
inline _LIBCPP_HIDE_FROM_ABI bool exists(const path& __p, error_code& __ec) noexcept {
@@ -106,44 +159,79 @@ inline _LIBCPP_HIDE_FROM_ABI bool exists(const path& __p, error_code& __ec) noex
}
inline _LIBCPP_HIDE_FROM_ABI uintmax_t file_size(const path& __p) { return __file_size(__p); }
-inline _LIBCPP_HIDE_FROM_ABI uintmax_t file_size(const path& __p, error_code& __ec) noexcept { return __file_size(__p, &__ec); }
+inline _LIBCPP_HIDE_FROM_ABI uintmax_t file_size(const path& __p, error_code& __ec) noexcept {
+ return __file_size(__p, &__ec);
+}
inline _LIBCPP_HIDE_FROM_ABI uintmax_t hard_link_count(const path& __p) { return __hard_link_count(__p); }
-inline _LIBCPP_HIDE_FROM_ABI uintmax_t hard_link_count(const path& __p, error_code& __ec) noexcept { return __hard_link_count(__p, &__ec); }
+inline _LIBCPP_HIDE_FROM_ABI uintmax_t hard_link_count(const path& __p, error_code& __ec) noexcept {
+ return __hard_link_count(__p, &__ec);
+}
inline _LIBCPP_HIDE_FROM_ABI bool is_block_file(file_status __s) noexcept { return __s.type() == file_type::block; }
inline _LIBCPP_HIDE_FROM_ABI bool is_block_file(const path& __p) { return is_block_file(__status(__p)); }
-inline _LIBCPP_HIDE_FROM_ABI bool is_block_file(const path& __p, error_code& __ec) noexcept { return is_block_file(__status(__p, &__ec)); }
-inline _LIBCPP_HIDE_FROM_ABI bool is_character_file(file_status __s) noexcept { return __s.type() == file_type::character; }
+inline _LIBCPP_HIDE_FROM_ABI bool is_block_file(const path& __p, error_code& __ec) noexcept {
+ return is_block_file(__status(__p, &__ec));
+}
+inline _LIBCPP_HIDE_FROM_ABI bool is_character_file(file_status __s) noexcept {
+ return __s.type() == file_type::character;
+}
inline _LIBCPP_HIDE_FROM_ABI bool is_character_file(const path& __p) { return is_character_file(__status(__p)); }
-inline _LIBCPP_HIDE_FROM_ABI bool is_character_file(const path& __p, error_code& __ec) noexcept { return is_character_file(__status(__p, &__ec)); }
+inline _LIBCPP_HIDE_FROM_ABI bool is_character_file(const path& __p, error_code& __ec) noexcept {
+ return is_character_file(__status(__p, &__ec));
+}
inline _LIBCPP_HIDE_FROM_ABI bool is_directory(file_status __s) noexcept { return __s.type() == file_type::directory; }
inline _LIBCPP_HIDE_FROM_ABI bool is_directory(const path& __p) { return is_directory(__status(__p)); }
-inline _LIBCPP_HIDE_FROM_ABI bool is_directory(const path& __p, error_code& __ec) noexcept { return is_directory(__status(__p, &__ec)); }
+inline _LIBCPP_HIDE_FROM_ABI bool is_directory(const path& __p, error_code& __ec) noexcept {
+ return is_directory(__status(__p, &__ec));
+}
_LIBCPP_EXPORTED_FROM_ABI bool __fs_is_empty(const path& __p, error_code* __ec = nullptr);
inline _LIBCPP_HIDE_FROM_ABI bool is_empty(const path& __p) { return __fs_is_empty(__p); }
inline _LIBCPP_HIDE_FROM_ABI bool is_empty(const path& __p, error_code& __ec) { return __fs_is_empty(__p, &__ec); }
inline _LIBCPP_HIDE_FROM_ABI bool is_fifo(file_status __s) noexcept { return __s.type() == file_type::fifo; }
inline _LIBCPP_HIDE_FROM_ABI bool is_fifo(const path& __p) { return is_fifo(__status(__p)); }
-inline _LIBCPP_HIDE_FROM_ABI bool is_fifo(const path& __p, error_code& __ec) noexcept { return is_fifo(__status(__p, &__ec)); }
+inline _LIBCPP_HIDE_FROM_ABI bool is_fifo(const path& __p, error_code& __ec) noexcept {
+ return is_fifo(__status(__p, &__ec));
+}
inline _LIBCPP_HIDE_FROM_ABI bool is_regular_file(file_status __s) noexcept { return __s.type() == file_type::regular; }
inline _LIBCPP_HIDE_FROM_ABI bool is_regular_file(const path& __p) { return is_regular_file(__status(__p)); }
-inline _LIBCPP_HIDE_FROM_ABI bool is_regular_file(const path& __p, error_code& __ec) noexcept { return is_regular_file(__status(__p, &__ec)); }
+inline _LIBCPP_HIDE_FROM_ABI bool is_regular_file(const path& __p, error_code& __ec) noexcept {
+ return is_regular_file(__status(__p, &__ec));
+}
inline _LIBCPP_HIDE_FROM_ABI bool is_symlink(file_status __s) noexcept { return __s.type() == file_type::symlink; }
inline _LIBCPP_HIDE_FROM_ABI bool is_symlink(const path& __p) { return is_symlink(__symlink_status(__p)); }
-inline _LIBCPP_HIDE_FROM_ABI bool is_symlink(const path& __p, error_code& __ec) noexcept { return is_symlink(__symlink_status(__p, &__ec)); }
-inline _LIBCPP_HIDE_FROM_ABI bool is_other(file_status __s) noexcept { return exists(__s) && !is_regular_file(__s) && !is_directory(__s) && !is_symlink(__s); }
+inline _LIBCPP_HIDE_FROM_ABI bool is_symlink(const path& __p, error_code& __ec) noexcept {
+ return is_symlink(__symlink_status(__p, &__ec));
+}
+inline _LIBCPP_HIDE_FROM_ABI bool is_other(file_status __s) noexcept {
+ return exists(__s) && !is_regular_file(__s) && !is_directory(__s) && !is_symlink(__s);
+}
inline _LIBCPP_HIDE_FROM_ABI bool is_other(const path& __p) { return is_other(__status(__p)); }
-inline _LIBCPP_HIDE_FROM_ABI bool is_other(const path& __p, error_code& __ec) noexcept { return is_other(__status(__p, &__ec)); }
+inline _LIBCPP_HIDE_FROM_ABI bool is_other(const path& __p, error_code& __ec) noexcept {
+ return is_other(__status(__p, &__ec));
+}
inline _LIBCPP_HIDE_FROM_ABI bool is_socket(file_status __s) noexcept { return __s.type() == file_type::socket; }
inline _LIBCPP_HIDE_FROM_ABI bool is_socket(const path& __p) { return is_socket(__status(__p)); }
-inline _LIBCPP_HIDE_FROM_ABI bool is_socket(const path& __p, error_code& __ec) noexcept { return is_socket(__status(__p, &__ec)); }
+inline _LIBCPP_HIDE_FROM_ABI bool is_socket(const path& __p, error_code& __ec) noexcept {
+ return is_socket(__status(__p, &__ec));
+}
inline _LIBCPP_HIDE_FROM_ABI file_time_type last_write_time(const path& __p) { return __last_write_time(__p); }
-inline _LIBCPP_HIDE_FROM_ABI file_time_type last_write_time(const path& __p, error_code& __ec) noexcept { return __last_write_time(__p, &__ec); }
+inline _LIBCPP_HIDE_FROM_ABI file_time_type last_write_time(const path& __p, error_code& __ec) noexcept {
+ return __last_write_time(__p, &__ec);
+}
inline _LIBCPP_HIDE_FROM_ABI void last_write_time(const path& __p, file_time_type __t) { __last_write_time(__p, __t); }
-inline _LIBCPP_HIDE_FROM_ABI void last_write_time(const path& __p, file_time_type __t, error_code& __ec) noexcept { __last_write_time(__p, __t, &__ec); }
+inline _LIBCPP_HIDE_FROM_ABI void last_write_time(const path& __p, file_time_type __t, error_code& __ec) noexcept {
+ __last_write_time(__p, __t, &__ec);
+}
_LIBCPP_EXPORTED_FROM_ABI void __permissions(const path&, perms, perm_options, error_code* = nullptr);
-inline _LIBCPP_HIDE_FROM_ABI void permissions(const path& __p, perms __prms, perm_options __opts = perm_options::replace) { __permissions(__p, __prms, __opts); }
-inline _LIBCPP_HIDE_FROM_ABI void permissions(const path& __p, perms __prms, error_code& __ec) noexcept { __permissions(__p, __prms, perm_options::replace, &__ec); }
-inline _LIBCPP_HIDE_FROM_ABI void permissions(const path& __p, perms __prms, perm_options __opts, error_code& __ec) { __permissions(__p, __prms, __opts, &__ec); }
+inline _LIBCPP_HIDE_FROM_ABI void
+permissions(const path& __p, perms __prms, perm_options __opts = perm_options::replace) {
+ __permissions(__p, __prms, __opts);
+}
+inline _LIBCPP_HIDE_FROM_ABI void permissions(const path& __p, perms __prms, error_code& __ec) noexcept {
+ __permissions(__p, __prms, perm_options::replace, &__ec);
+}
+inline _LIBCPP_HIDE_FROM_ABI void permissions(const path& __p, perms __prms, perm_options __opts, error_code& __ec) {
+ __permissions(__p, __prms, __opts, &__ec);
+}
inline _LIBCPP_HIDE_FROM_ABI path proximate(const path& __p, const path& __base, error_code& __ec) {
path __tmp = __weakly_canonical(__p, &__ec);
@@ -155,8 +243,12 @@ inline _LIBCPP_HIDE_FROM_ABI path proximate(const path& __p, const path& __base,
return __tmp.lexically_proximate(__tmp_base);
}
-inline _LIBCPP_HIDE_FROM_ABI path proximate(const path& __p, error_code& __ec) { return proximate(__p, current_path(), __ec); }
-inline _LIBCPP_HIDE_FROM_ABI path proximate(const path& __p, const path& __base = current_path()) { return __weakly_canonical(__p).lexically_proximate(__weakly_canonical(__base)); }
+inline _LIBCPP_HIDE_FROM_ABI path proximate(const path& __p, error_code& __ec) {
+ return proximate(__p, current_path(), __ec);
+}
+inline _LIBCPP_HIDE_FROM_ABI path proximate(const path& __p, const path& __base = current_path()) {
+ return __weakly_canonical(__p).lexically_proximate(__weakly_canonical(__base));
+}
inline _LIBCPP_HIDE_FROM_ABI path read_symlink(const path& __p) { return __read_symlink(__p); }
inline _LIBCPP_HIDE_FROM_ABI path read_symlink(const path& __p, error_code& __ec) { return __read_symlink(__p, &__ec); }
@@ -170,27 +262,45 @@ inline _LIBCPP_HIDE_FROM_ABI path relative(const path& __p, const path& __base,
return __tmp.lexically_relative(__tmpbase);
}
-inline _LIBCPP_HIDE_FROM_ABI path relative(const path& __p, error_code& __ec) { return relative(__p, current_path(), __ec); }
-inline _LIBCPP_HIDE_FROM_ABI path relative(const path& __p, const path& __base = current_path()) { return __weakly_canonical(__p).lexically_relative(__weakly_canonical(__base)); }
+inline _LIBCPP_HIDE_FROM_ABI path relative(const path& __p, error_code& __ec) {
+ return relative(__p, current_path(), __ec);
+}
+inline _LIBCPP_HIDE_FROM_ABI path relative(const path& __p, const path& __base = current_path()) {
+ return __weakly_canonical(__p).lexically_relative(__weakly_canonical(__base));
+}
inline _LIBCPP_HIDE_FROM_ABI uintmax_t remove_all(const path& __p) { return __remove_all(__p); }
-inline _LIBCPP_HIDE_FROM_ABI uintmax_t remove_all(const path& __p, error_code& __ec) { return __remove_all(__p, &__ec); }
+inline _LIBCPP_HIDE_FROM_ABI uintmax_t remove_all(const path& __p, error_code& __ec) {
+ return __remove_all(__p, &__ec);
+}
inline _LIBCPP_HIDE_FROM_ABI bool remove(const path& __p) { return __remove(__p); }
inline _LIBCPP_HIDE_FROM_ABI bool remove(const path& __p, error_code& __ec) noexcept { return __remove(__p, &__ec); }
inline _LIBCPP_HIDE_FROM_ABI void rename(const path& __from, const path& __to) { return __rename(__from, __to); }
-inline _LIBCPP_HIDE_FROM_ABI void rename(const path& __from, const path& __to, error_code& __ec) noexcept { return __rename(__from, __to, &__ec); }
+inline _LIBCPP_HIDE_FROM_ABI void rename(const path& __from, const path& __to, error_code& __ec) noexcept {
+ return __rename(__from, __to, &__ec);
+}
inline _LIBCPP_HIDE_FROM_ABI void resize_file(const path& __p, uintmax_t __ns) { return __resize_file(__p, __ns); }
-inline _LIBCPP_HIDE_FROM_ABI void resize_file(const path& __p, uintmax_t __ns, error_code& __ec) noexcept { return __resize_file(__p, __ns, &__ec); }
+inline _LIBCPP_HIDE_FROM_ABI void resize_file(const path& __p, uintmax_t __ns, error_code& __ec) noexcept {
+ return __resize_file(__p, __ns, &__ec);
+}
_LIBCPP_EXPORTED_FROM_ABI space_info __space(const path&, error_code* __ec = nullptr);
inline _LIBCPP_HIDE_FROM_ABI space_info space(const path& __p) { return __space(__p); }
-inline _LIBCPP_HIDE_FROM_ABI space_info space(const path& __p, error_code& __ec) noexcept { return __space(__p, &__ec); }
+inline _LIBCPP_HIDE_FROM_ABI space_info space(const path& __p, error_code& __ec) noexcept {
+ return __space(__p, &__ec);
+}
inline _LIBCPP_HIDE_FROM_ABI file_status status(const path& __p) { return __status(__p); }
-inline _LIBCPP_HIDE_FROM_ABI file_status status(const path& __p, error_code& __ec) noexcept { return __status(__p, &__ec); }
+inline _LIBCPP_HIDE_FROM_ABI file_status status(const path& __p, error_code& __ec) noexcept {
+ return __status(__p, &__ec);
+}
inline _LIBCPP_HIDE_FROM_ABI file_status symlink_status(const path& __p) { return __symlink_status(__p); }
-inline _LIBCPP_HIDE_FROM_ABI file_status symlink_status(const path& __p, error_code& __ec) noexcept { return __symlink_status(__p, &__ec); }
+inline _LIBCPP_HIDE_FROM_ABI file_status symlink_status(const path& __p, error_code& __ec) noexcept {
+ return __symlink_status(__p, &__ec);
+}
inline _LIBCPP_HIDE_FROM_ABI path temp_directory_path() { return __temp_directory_path(); }
inline _LIBCPP_HIDE_FROM_ABI path temp_directory_path(error_code& __ec) { return __temp_directory_path(&__ec); }
inline _LIBCPP_HIDE_FROM_ABI path weakly_canonical(path const& __p) { return __weakly_canonical(__p); }
-inline _LIBCPP_HIDE_FROM_ABI path weakly_canonical(path const& __p, error_code& __ec) { return __weakly_canonical(__p, &__ec); }
+inline _LIBCPP_HIDE_FROM_ABI path weakly_canonical(path const& __p, error_code& __ec) {
+ return __weakly_canonical(__p, &__ec);
+}
_LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY_POP
diff --git a/contrib/llvm-project/libcxx/include/__filesystem/path.h b/contrib/llvm-project/libcxx/include/__filesystem/path.h
index 466fa25a38ed..1ff992dd64e6 100644
--- a/contrib/llvm-project/libcxx/include/__filesystem/path.h
+++ b/contrib/llvm-project/libcxx/include/__filesystem/path.h
@@ -28,8 +28,8 @@
#include <string_view>
#if !defined(_LIBCPP_HAS_NO_LOCALIZATION)
-# include <iomanip> // for quoted
-# include <locale>
+# include <iomanip> // for quoted
+# include <locale>
#endif
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
@@ -51,47 +51,45 @@ struct __can_convert_char<const _Tp> : public __can_convert_char<_Tp> {};
template <>
struct __can_convert_char<char> {
static const bool value = true;
- using __char_type = char;
+ using __char_type = char;
};
template <>
struct __can_convert_char<wchar_t> {
static const bool value = true;
- using __char_type = wchar_t;
+ using __char_type = wchar_t;
};
-#ifndef _LIBCPP_HAS_NO_CHAR8_T
+# ifndef _LIBCPP_HAS_NO_CHAR8_T
template <>
struct __can_convert_char<char8_t> {
static const bool value = true;
- using __char_type = char8_t;
+ using __char_type = char8_t;
};
-#endif
+# endif
template <>
struct __can_convert_char<char16_t> {
static const bool value = true;
- using __char_type = char16_t;
+ using __char_type = char16_t;
};
template <>
struct __can_convert_char<char32_t> {
static const bool value = true;
- using __char_type = char32_t;
+ using __char_type = char32_t;
};
template <class _ECharT, __enable_if_t<__can_convert_char<_ECharT>::value, int> = 0>
-_LIBCPP_HIDE_FROM_ABI
-bool
-__is_separator(_ECharT __e) {
-#if defined(_LIBCPP_WIN32API)
+_LIBCPP_HIDE_FROM_ABI bool __is_separator(_ECharT __e) {
+# if defined(_LIBCPP_WIN32API)
return __e == _ECharT('/') || __e == _ECharT('\\');
-#else
+# else
return __e == _ECharT('/');
-#endif
+# endif
}
-#ifndef _LIBCPP_HAS_NO_CHAR8_T
+# ifndef _LIBCPP_HAS_NO_CHAR8_T
typedef u8string __u8_string;
-#else
+# else
typedef string __u8_string;
-#endif
+# endif
struct _NullSentinel {};
@@ -102,99 +100,75 @@ template <class _Tp, class = void>
struct __is_pathable_string : public false_type {};
template <class _ECharT, class _Traits, class _Alloc>
-struct __is_pathable_string<
- basic_string<_ECharT, _Traits, _Alloc>,
- _Void<typename __can_convert_char<_ECharT>::__char_type> >
+struct __is_pathable_string< basic_string<_ECharT, _Traits, _Alloc>,
+ _Void<typename __can_convert_char<_ECharT>::__char_type> >
: public __can_convert_char<_ECharT> {
using _Str = basic_string<_ECharT, _Traits, _Alloc>;
- _LIBCPP_HIDE_FROM_ABI
- static _ECharT const* __range_begin(_Str const& __s) { return __s.data(); }
+ _LIBCPP_HIDE_FROM_ABI static _ECharT const* __range_begin(_Str const& __s) { return __s.data(); }
- _LIBCPP_HIDE_FROM_ABI
- static _ECharT const* __range_end(_Str const& __s) {
- return __s.data() + __s.length();
- }
+ _LIBCPP_HIDE_FROM_ABI static _ECharT const* __range_end(_Str const& __s) { return __s.data() + __s.length(); }
- _LIBCPP_HIDE_FROM_ABI
- static _ECharT __first_or_null(_Str const& __s) {
- return __s.empty() ? _ECharT{} : __s[0];
- }
+ _LIBCPP_HIDE_FROM_ABI static _ECharT __first_or_null(_Str const& __s) { return __s.empty() ? _ECharT{} : __s[0]; }
};
template <class _ECharT, class _Traits>
-struct __is_pathable_string<
- basic_string_view<_ECharT, _Traits>,
- _Void<typename __can_convert_char<_ECharT>::__char_type> >
+struct __is_pathable_string< basic_string_view<_ECharT, _Traits>,
+ _Void<typename __can_convert_char<_ECharT>::__char_type> >
: public __can_convert_char<_ECharT> {
using _Str = basic_string_view<_ECharT, _Traits>;
- _LIBCPP_HIDE_FROM_ABI
- static _ECharT const* __range_begin(_Str const& __s) { return __s.data(); }
+ _LIBCPP_HIDE_FROM_ABI static _ECharT const* __range_begin(_Str const& __s) { return __s.data(); }
- _LIBCPP_HIDE_FROM_ABI
- static _ECharT const* __range_end(_Str const& __s) {
- return __s.data() + __s.length();
- }
+ _LIBCPP_HIDE_FROM_ABI static _ECharT const* __range_end(_Str const& __s) { return __s.data() + __s.length(); }
- _LIBCPP_HIDE_FROM_ABI
- static _ECharT __first_or_null(_Str const& __s) {
- return __s.empty() ? _ECharT{} : __s[0];
- }
+ _LIBCPP_HIDE_FROM_ABI static _ECharT __first_or_null(_Str const& __s) { return __s.empty() ? _ECharT{} : __s[0]; }
};
-template <class _Source, class _DS = __decay_t<_Source>,
- class _UnqualPtrType =
- __remove_const_t<__remove_pointer_t<_DS> >,
- bool _IsCharPtr = is_pointer<_DS>::value&&
- __can_convert_char<_UnqualPtrType>::value>
+template <class _Source,
+ class _DS = __decay_t<_Source>,
+ class _UnqualPtrType = __remove_const_t<__remove_pointer_t<_DS> >,
+ bool _IsCharPtr = is_pointer<_DS>::value && __can_convert_char<_UnqualPtrType>::value>
struct __is_pathable_char_array : false_type {};
template <class _Source, class _ECharT, class _UPtr>
-struct __is_pathable_char_array<_Source, _ECharT*, _UPtr, true>
- : __can_convert_char<__remove_const_t<_ECharT> > {
- _LIBCPP_HIDE_FROM_ABI
- static _ECharT const* __range_begin(const _ECharT* __b) { return __b; }
-
- _LIBCPP_HIDE_FROM_ABI
- static _ECharT const* __range_end(const _ECharT* __b) {
- using _Iter = const _ECharT*;
+struct __is_pathable_char_array<_Source, _ECharT*, _UPtr, true> : __can_convert_char<__remove_const_t<_ECharT> > {
+ _LIBCPP_HIDE_FROM_ABI static _ECharT const* __range_begin(const _ECharT* __b) { return __b; }
+
+ _LIBCPP_HIDE_FROM_ABI static _ECharT const* __range_end(const _ECharT* __b) {
+ using _Iter = const _ECharT*;
const _ECharT __sentinel = _ECharT{};
- _Iter __e = __b;
+ _Iter __e = __b;
for (; *__e != __sentinel; ++__e)
;
return __e;
}
- _LIBCPP_HIDE_FROM_ABI
- static _ECharT __first_or_null(const _ECharT* __b) { return *__b; }
+ _LIBCPP_HIDE_FROM_ABI static _ECharT __first_or_null(const _ECharT* __b) { return *__b; }
};
-template <class _Iter, bool _IsIt = __has_input_iterator_category<_Iter>::value,
- class = void>
+template <class _Iter, bool _IsIt = __has_input_iterator_category<_Iter>::value, class = void>
struct __is_pathable_iter : false_type {};
template <class _Iter>
struct __is_pathable_iter<
- _Iter, true,
- _Void<typename __can_convert_char<
- typename iterator_traits<_Iter>::value_type>::__char_type> >
+ _Iter,
+ true,
+ _Void<typename __can_convert_char< typename iterator_traits<_Iter>::value_type>::__char_type> >
: __can_convert_char<typename iterator_traits<_Iter>::value_type> {
using _ECharT = typename iterator_traits<_Iter>::value_type;
- _LIBCPP_HIDE_FROM_ABI
- static _Iter __range_begin(_Iter __b) { return __b; }
+ _LIBCPP_HIDE_FROM_ABI static _Iter __range_begin(_Iter __b) { return __b; }
- _LIBCPP_HIDE_FROM_ABI
- static _NullSentinel __range_end(_Iter) { return _NullSentinel{}; }
+ _LIBCPP_HIDE_FROM_ABI static _NullSentinel __range_end(_Iter) { return _NullSentinel{}; }
- _LIBCPP_HIDE_FROM_ABI
- static _ECharT __first_or_null(_Iter __b) { return *__b; }
+ _LIBCPP_HIDE_FROM_ABI static _ECharT __first_or_null(_Iter __b) { return *__b; }
};
-template <class _Tp, bool _IsStringT = __is_pathable_string<_Tp>::value,
+template <class _Tp,
+ bool _IsStringT = __is_pathable_string<_Tp>::value,
bool _IsCharIterT = __is_pathable_char_array<_Tp>::value,
- bool _IsIterT = !_IsCharIterT && __is_pathable_iter<_Tp>::value>
+ bool _IsIterT = !_IsCharIterT && __is_pathable_iter<_Tp>::value>
struct __is_pathable : false_type {
static_assert(!_IsStringT && !_IsCharIterT && !_IsIterT, "Must all be false");
};
@@ -203,72 +177,64 @@ template <class _Tp>
struct __is_pathable<_Tp, true, false, false> : __is_pathable_string<_Tp> {};
template <class _Tp>
-struct __is_pathable<_Tp, false, true, false> : __is_pathable_char_array<_Tp> {
-};
+struct __is_pathable<_Tp, false, true, false> : __is_pathable_char_array<_Tp> {};
template <class _Tp>
struct __is_pathable<_Tp, false, false, true> : __is_pathable_iter<_Tp> {};
-#if defined(_LIBCPP_WIN32API)
+# if defined(_LIBCPP_WIN32API)
typedef wstring __path_string;
typedef wchar_t __path_value;
-#else
+# else
typedef string __path_string;
typedef char __path_value;
-#endif
+# endif
-#if defined(_LIBCPP_WIN32API)
+# if defined(_LIBCPP_WIN32API)
_LIBCPP_EXPORTED_FROM_ABI size_t __wide_to_char(const wstring&, char*, size_t);
_LIBCPP_EXPORTED_FROM_ABI size_t __char_to_wide(const string&, wchar_t*, size_t);
-#endif
+# endif
template <class _ECharT>
struct _PathCVT;
-#if !defined(_LIBCPP_HAS_NO_LOCALIZATION)
+# if !defined(_LIBCPP_HAS_NO_LOCALIZATION)
template <class _ECharT>
struct _PathCVT {
- static_assert(__can_convert_char<_ECharT>::value,
- "Char type not convertible");
+ static_assert(__can_convert_char<_ECharT>::value, "Char type not convertible");
typedef __narrow_to_utf8<sizeof(_ECharT) * __CHAR_BIT__> _Narrower;
-#if defined(_LIBCPP_WIN32API)
+# if defined(_LIBCPP_WIN32API)
typedef __widen_from_utf8<sizeof(wchar_t) * __CHAR_BIT__> _Widener;
-#endif
+# endif
- _LIBCPP_HIDE_FROM_ABI
- static void __append_range(__path_string& __dest, _ECharT const* __b,
- _ECharT const* __e) {
-#if defined(_LIBCPP_WIN32API)
+ _LIBCPP_HIDE_FROM_ABI static void __append_range(__path_string& __dest, _ECharT const* __b, _ECharT const* __e) {
+# if defined(_LIBCPP_WIN32API)
string __utf8;
_Narrower()(back_inserter(__utf8), __b, __e);
_Widener()(back_inserter(__dest), __utf8.data(), __utf8.data() + __utf8.size());
-#else
+# else
_Narrower()(back_inserter(__dest), __b, __e);
-#endif
+# endif
}
template <class _Iter>
- _LIBCPP_HIDE_FROM_ABI
- static void __append_range(__path_string& __dest, _Iter __b, _Iter __e) {
+ _LIBCPP_HIDE_FROM_ABI static void __append_range(__path_string& __dest, _Iter __b, _Iter __e) {
static_assert(!is_same<_Iter, _ECharT*>::value, "Call const overload");
if (__b == __e)
return;
basic_string<_ECharT> __tmp(__b, __e);
-#if defined(_LIBCPP_WIN32API)
+# if defined(_LIBCPP_WIN32API)
string __utf8;
- _Narrower()(back_inserter(__utf8), __tmp.data(),
- __tmp.data() + __tmp.length());
+ _Narrower()(back_inserter(__utf8), __tmp.data(), __tmp.data() + __tmp.length());
_Widener()(back_inserter(__dest), __utf8.data(), __utf8.data() + __utf8.size());
-#else
- _Narrower()(back_inserter(__dest), __tmp.data(),
- __tmp.data() + __tmp.length());
-#endif
+# else
+ _Narrower()(back_inserter(__dest), __tmp.data(), __tmp.data() + __tmp.length());
+# endif
}
template <class _Iter>
- _LIBCPP_HIDE_FROM_ABI
- static void __append_range(__path_string& __dest, _Iter __b, _NullSentinel) {
+ _LIBCPP_HIDE_FROM_ABI static void __append_range(__path_string& __dest, _Iter __b, _NullSentinel) {
static_assert(!is_same<_Iter, _ECharT*>::value, "Call const overload");
const _ECharT __sentinel = _ECharT{};
if (*__b == __sentinel)
@@ -276,94 +242,74 @@ struct _PathCVT {
basic_string<_ECharT> __tmp;
for (; *__b != __sentinel; ++__b)
__tmp.push_back(*__b);
-#if defined(_LIBCPP_WIN32API)
+# if defined(_LIBCPP_WIN32API)
string __utf8;
- _Narrower()(back_inserter(__utf8), __tmp.data(),
- __tmp.data() + __tmp.length());
+ _Narrower()(back_inserter(__utf8), __tmp.data(), __tmp.data() + __tmp.length());
_Widener()(back_inserter(__dest), __utf8.data(), __utf8.data() + __utf8.size());
-#else
- _Narrower()(back_inserter(__dest), __tmp.data(),
- __tmp.data() + __tmp.length());
-#endif
+# else
+ _Narrower()(back_inserter(__dest), __tmp.data(), __tmp.data() + __tmp.length());
+# endif
}
template <class _Source>
- _LIBCPP_HIDE_FROM_ABI
- static void __append_source(__path_string& __dest, _Source const& __s) {
+ _LIBCPP_HIDE_FROM_ABI static void __append_source(__path_string& __dest, _Source const& __s) {
using _Traits = __is_pathable<_Source>;
- __append_range(__dest, _Traits::__range_begin(__s),
- _Traits::__range_end(__s));
+ __append_range(__dest, _Traits::__range_begin(__s), _Traits::__range_end(__s));
}
};
-#endif // !_LIBCPP_HAS_NO_LOCALIZATION
+# endif // !_LIBCPP_HAS_NO_LOCALIZATION
template <>
struct _PathCVT<__path_value> {
-
template <class _Iter, __enable_if_t<__has_exactly_input_iterator_category<_Iter>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI
- static void
- __append_range(__path_string& __dest, _Iter __b, _Iter __e) {
+ _LIBCPP_HIDE_FROM_ABI static void __append_range(__path_string& __dest, _Iter __b, _Iter __e) {
for (; __b != __e; ++__b)
__dest.push_back(*__b);
}
template <class _Iter, __enable_if_t<__has_forward_iterator_category<_Iter>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI
- static void
- __append_range(__path_string& __dest, _Iter __b, _Iter __e) {
+ _LIBCPP_HIDE_FROM_ABI static void __append_range(__path_string& __dest, _Iter __b, _Iter __e) {
__dest.append(__b, __e);
}
template <class _Iter>
- _LIBCPP_HIDE_FROM_ABI
- static void __append_range(__path_string& __dest, _Iter __b, _NullSentinel) {
+ _LIBCPP_HIDE_FROM_ABI static void __append_range(__path_string& __dest, _Iter __b, _NullSentinel) {
const char __sentinel = char{};
for (; *__b != __sentinel; ++__b)
__dest.push_back(*__b);
}
template <class _Source>
- _LIBCPP_HIDE_FROM_ABI
- static void __append_source(__path_string& __dest, _Source const& __s) {
+ _LIBCPP_HIDE_FROM_ABI static void __append_source(__path_string& __dest, _Source const& __s) {
using _Traits = __is_pathable<_Source>;
- __append_range(__dest, _Traits::__range_begin(__s),
- _Traits::__range_end(__s));
+ __append_range(__dest, _Traits::__range_begin(__s), _Traits::__range_end(__s));
}
};
-#if defined(_LIBCPP_WIN32API)
+# if defined(_LIBCPP_WIN32API)
template <>
struct _PathCVT<char> {
-
- _LIBCPP_HIDE_FROM_ABI
- static void
- __append_string(__path_string& __dest, const basic_string<char> &__str) {
- size_t __size = __char_to_wide(__str, nullptr, 0);
- size_t __pos = __dest.size();
- __dest.resize(__pos + __size);
- __char_to_wide(__str, const_cast<__path_value*>(__dest.data()) + __pos, __size);
+ _LIBCPP_HIDE_FROM_ABI static void __append_string(__path_string& __dest, const basic_string<char>& __str) {
+ size_t __size = __char_to_wide(__str, nullptr, 0);
+ size_t __pos = __dest.size();
+ __dest.resize(__pos + __size);
+ __char_to_wide(__str, const_cast<__path_value*>(__dest.data()) + __pos, __size);
}
template <class _Iter, __enable_if_t<__has_exactly_input_iterator_category<_Iter>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI
- static void
- __append_range(__path_string& __dest, _Iter __b, _Iter __e) {
+ _LIBCPP_HIDE_FROM_ABI static void __append_range(__path_string& __dest, _Iter __b, _Iter __e) {
basic_string<char> __tmp(__b, __e);
__append_string(__dest, __tmp);
}
template <class _Iter, __enable_if_t<__has_forward_iterator_category<_Iter>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI
- static void
- __append_range(__path_string& __dest, _Iter __b, _Iter __e) {
+ _LIBCPP_HIDE_FROM_ABI static void __append_range(__path_string& __dest, _Iter __b, _Iter __e) {
basic_string<char> __tmp(__b, __e);
__append_string(__dest, __tmp);
}
template <class _Iter>
- _LIBCPP_HIDE_FROM_ABI
- static void __append_range(__path_string& __dest, _Iter __b, _NullSentinel) {
+ _LIBCPP_HIDE_FROM_ABI static void __append_range(__path_string& __dest, _Iter __b, _NullSentinel) {
const char __sentinel = char{};
basic_string<char> __tmp;
for (; *__b != __sentinel; ++__b)
@@ -372,11 +318,9 @@ struct _PathCVT<char> {
}
template <class _Source>
- _LIBCPP_HIDE_FROM_ABI
- static void __append_source(__path_string& __dest, _Source const& __s) {
+ _LIBCPP_HIDE_FROM_ABI static void __append_source(__path_string& __dest, _Source const& __s) {
using _Traits = __is_pathable<_Source>;
- __append_range(__dest, _Traits::__range_begin(__s),
- _Traits::__range_end(__s));
+ __append_range(__dest, _Traits::__range_begin(__s), _Traits::__range_end(__s));
}
};
@@ -386,8 +330,7 @@ struct _PathExport {
typedef __widen_from_utf8<sizeof(_ECharT) * __CHAR_BIT__> _Widener;
template <class _Str>
- _LIBCPP_HIDE_FROM_ABI
- static void __append(_Str& __dest, const __path_string& __src) {
+ _LIBCPP_HIDE_FROM_ABI static void __append(_Str& __dest, const __path_string& __src) {
string __utf8;
_Narrower()(back_inserter(__utf8), __src.data(), __src.data() + __src.size());
_Widener()(back_inserter(__dest), __utf8.data(), __utf8.data() + __utf8.size());
@@ -397,10 +340,9 @@ struct _PathExport {
template <>
struct _PathExport<char> {
template <class _Str>
- _LIBCPP_HIDE_FROM_ABI
- static void __append(_Str& __dest, const __path_string& __src) {
+ _LIBCPP_HIDE_FROM_ABI static void __append(_Str& __dest, const __path_string& __src) {
size_t __size = __wide_to_char(__src, nullptr, 0);
- size_t __pos = __dest.size();
+ size_t __pos = __dest.size();
__dest.resize(__size);
__wide_to_char(__src, const_cast<char*>(__dest.data()) + __pos, __size);
}
@@ -409,8 +351,7 @@ struct _PathExport<char> {
template <>
struct _PathExport<wchar_t> {
template <class _Str>
- _LIBCPP_HIDE_FROM_ABI
- static void __append(_Str& __dest, const __path_string& __src) {
+ _LIBCPP_HIDE_FROM_ABI static void __append(_Str& __dest, const __path_string& __src) {
__dest.append(__src.begin(), __src.end());
}
};
@@ -418,25 +359,23 @@ struct _PathExport<wchar_t> {
template <>
struct _PathExport<char16_t> {
template <class _Str>
- _LIBCPP_HIDE_FROM_ABI
- static void __append(_Str& __dest, const __path_string& __src) {
+ _LIBCPP_HIDE_FROM_ABI static void __append(_Str& __dest, const __path_string& __src) {
__dest.append(__src.begin(), __src.end());
}
};
-#ifndef _LIBCPP_HAS_NO_CHAR8_T
+# ifndef _LIBCPP_HAS_NO_CHAR8_T
template <>
struct _PathExport<char8_t> {
typedef __narrow_to_utf8<sizeof(wchar_t) * __CHAR_BIT__> _Narrower;
template <class _Str>
- _LIBCPP_HIDE_FROM_ABI
- static void __append(_Str& __dest, const __path_string& __src) {
+ _LIBCPP_HIDE_FROM_ABI static void __append(_Str& __dest, const __path_string& __src) {
_Narrower()(back_inserter(__dest), __src.data(), __src.data() + __src.size());
}
};
-#endif /* !_LIBCPP_HAS_NO_CHAR8_T */
-#endif /* _LIBCPP_WIN32API */
+# endif /* !_LIBCPP_HAS_NO_CHAR8_T */
+# endif /* _LIBCPP_WIN32API */
class _LIBCPP_EXPORTED_FROM_ABI path {
template <class _SourceOrIter, class _Tp = path&>
@@ -449,101 +388,84 @@ class _LIBCPP_EXPORTED_FROM_ABI path {
using _SourceCVT = _PathCVT<_SourceChar<_Tp> >;
public:
-#if defined(_LIBCPP_WIN32API)
+# if defined(_LIBCPP_WIN32API)
typedef wchar_t value_type;
static constexpr value_type preferred_separator = L'\\';
-#else
+# else
typedef char value_type;
static constexpr value_type preferred_separator = '/';
-#endif
+# endif
typedef basic_string<value_type> string_type;
typedef basic_string_view<value_type> __string_view;
- enum format : unsigned char {
- auto_format,
- native_format,
- generic_format
- };
+ enum format : unsigned char { auto_format, native_format, generic_format };
// constructors and destructor
_LIBCPP_HIDE_FROM_ABI path() noexcept {}
_LIBCPP_HIDE_FROM_ABI path(const path& __p) : __pn_(__p.__pn_) {}
- _LIBCPP_HIDE_FROM_ABI path(path&& __p) noexcept
- : __pn_(std::move(__p.__pn_)) {}
+ _LIBCPP_HIDE_FROM_ABI path(path&& __p) noexcept : __pn_(std::move(__p.__pn_)) {}
- _LIBCPP_HIDE_FROM_ABI
- path(string_type&& __s, format = format::auto_format) noexcept
- : __pn_(std::move(__s)) {}
+ _LIBCPP_HIDE_FROM_ABI path(string_type&& __s, format = format::auto_format) noexcept : __pn_(std::move(__s)) {}
template <class _Source, class = _EnableIfPathable<_Source, void> >
- _LIBCPP_HIDE_FROM_ABI
- path(const _Source& __src, format = format::auto_format) {
+ _LIBCPP_HIDE_FROM_ABI path(const _Source& __src, format = format::auto_format) {
_SourceCVT<_Source>::__append_source(__pn_, __src);
}
template <class _InputIt>
- _LIBCPP_HIDE_FROM_ABI
- path(_InputIt __first, _InputIt __last, format = format::auto_format) {
+ _LIBCPP_HIDE_FROM_ABI path(_InputIt __first, _InputIt __last, format = format::auto_format) {
typedef typename iterator_traits<_InputIt>::value_type _ItVal;
_PathCVT<_ItVal>::__append_range(__pn_, __first, __last);
}
-/*
-#if !defined(_LIBCPP_HAS_NO_LOCALIZATION)
- // TODO Implement locale conversions.
- template <class _Source, class = _EnableIfPathable<_Source, void> >
- path(const _Source& __src, const locale& __loc, format = format::auto_format);
- template <class _InputIt>
- path(_InputIt __first, _InputIt _last, const locale& __loc,
- format = format::auto_format);
-#endif
-*/
+ /*
+ #if !defined(_LIBCPP_HAS_NO_LOCALIZATION)
+ // TODO Implement locale conversions.
+ template <class _Source, class = _EnableIfPathable<_Source, void> >
+ path(const _Source& __src, const locale& __loc, format = format::auto_format);
+ template <class _InputIt>
+ path(_InputIt __first, _InputIt _last, const locale& __loc,
+ format = format::auto_format);
+ #endif
+ */
- _LIBCPP_HIDE_FROM_ABI
- ~path() = default;
+ _LIBCPP_HIDE_FROM_ABI ~path() = default;
// assignments
- _LIBCPP_HIDE_FROM_ABI
- path& operator=(const path& __p) {
+ _LIBCPP_HIDE_FROM_ABI path& operator=(const path& __p) {
__pn_ = __p.__pn_;
return *this;
}
- _LIBCPP_HIDE_FROM_ABI
- path& operator=(path&& __p) noexcept {
+ _LIBCPP_HIDE_FROM_ABI path& operator=(path&& __p) noexcept {
__pn_ = std::move(__p.__pn_);
return *this;
}
- _LIBCPP_HIDE_FROM_ABI
- path& operator=(string_type&& __s) noexcept {
+ _LIBCPP_HIDE_FROM_ABI path& operator=(string_type&& __s) noexcept {
__pn_ = std::move(__s);
return *this;
}
- _LIBCPP_HIDE_FROM_ABI
- path& assign(string_type&& __s) noexcept {
+ _LIBCPP_HIDE_FROM_ABI path& assign(string_type&& __s) noexcept {
__pn_ = std::move(__s);
return *this;
}
template <class _Source>
- _LIBCPP_HIDE_FROM_ABI _EnableIfPathable<_Source>
- operator=(const _Source& __src) {
+ _LIBCPP_HIDE_FROM_ABI _EnableIfPathable<_Source> operator=(const _Source& __src) {
return this->assign(__src);
}
template <class _Source>
- _LIBCPP_HIDE_FROM_ABI
- _EnableIfPathable<_Source> assign(const _Source& __src) {
+ _LIBCPP_HIDE_FROM_ABI _EnableIfPathable<_Source> assign(const _Source& __src) {
__pn_.clear();
_SourceCVT<_Source>::__append_source(__pn_, __src);
return *this;
}
template <class _InputIt>
- _LIBCPP_HIDE_FROM_ABI
- path& assign(_InputIt __first, _InputIt __last) {
+ _LIBCPP_HIDE_FROM_ABI path& assign(_InputIt __first, _InputIt __last) {
typedef typename iterator_traits<_InputIt>::value_type _ItVal;
__pn_.clear();
_PathCVT<_ItVal>::__append_range(__pn_, __first, __last);
@@ -552,19 +474,17 @@ public:
public:
// appends
-#if defined(_LIBCPP_WIN32API)
- _LIBCPP_HIDE_FROM_ABI
- path& operator/=(const path& __p) {
- auto __p_root_name = __p.__root_name();
+# if defined(_LIBCPP_WIN32API)
+ _LIBCPP_HIDE_FROM_ABI path& operator/=(const path& __p) {
+ auto __p_root_name = __p.__root_name();
auto __p_root_name_size = __p_root_name.size();
- if (__p.is_absolute() ||
- (!__p_root_name.empty() && __p_root_name != __string_view(root_name().__pn_))) {
+ if (__p.is_absolute() || (!__p_root_name.empty() && __p_root_name != __string_view(root_name().__pn_))) {
__pn_ = __p.__pn_;
return *this;
}
if (__p.has_root_directory()) {
path __root_name_str = root_name();
- __pn_ = __root_name_str.native();
+ __pn_ = __root_name_str.native();
__pn_ += __string_view(__p.__pn_).substr(__p_root_name_size);
return *this;
}
@@ -574,25 +494,21 @@ public:
return *this;
}
template <class _Source>
- _LIBCPP_HIDE_FROM_ABI _EnableIfPathable<_Source>
- operator/=(const _Source& __src) {
+ _LIBCPP_HIDE_FROM_ABI _EnableIfPathable<_Source> operator/=(const _Source& __src) {
return operator/=(path(__src));
}
template <class _Source>
- _LIBCPP_HIDE_FROM_ABI
- _EnableIfPathable<_Source> append(const _Source& __src) {
+ _LIBCPP_HIDE_FROM_ABI _EnableIfPathable<_Source> append(const _Source& __src) {
return operator/=(path(__src));
}
template <class _InputIt>
- _LIBCPP_HIDE_FROM_ABI
- path& append(_InputIt __first, _InputIt __last) {
+ _LIBCPP_HIDE_FROM_ABI path& append(_InputIt __first, _InputIt __last) {
return operator/=(path(__first, __last));
}
-#else
- _LIBCPP_HIDE_FROM_ABI
- path& operator/=(const path& __p) {
+# else
+ _LIBCPP_HIDE_FROM_ABI path& operator/=(const path& __p) {
if (__p.is_absolute()) {
__pn_ = __p.__pn_;
return *this;
@@ -607,16 +523,14 @@ public:
// is known at compile time to be "/' since the user almost certainly intended
// to append a separator instead of overwriting the path with "/"
template <class _Source>
- _LIBCPP_HIDE_FROM_ABI _EnableIfPathable<_Source>
- operator/=(const _Source& __src) {
+ _LIBCPP_HIDE_FROM_ABI _EnableIfPathable<_Source> operator/=(const _Source& __src) {
return this->append(__src);
}
template <class _Source>
- _LIBCPP_HIDE_FROM_ABI
- _EnableIfPathable<_Source> append(const _Source& __src) {
- using _Traits = __is_pathable<_Source>;
- using _CVT = _PathCVT<_SourceChar<_Source> >;
+ _LIBCPP_HIDE_FROM_ABI _EnableIfPathable<_Source> append(const _Source& __src) {
+ using _Traits = __is_pathable<_Source>;
+ using _CVT = _PathCVT<_SourceChar<_Source> >;
bool __source_is_absolute = filesystem::__is_separator(_Traits::__first_or_null(__src));
if (__source_is_absolute)
__pn_.clear();
@@ -627,8 +541,7 @@ public:
}
template <class _InputIt>
- _LIBCPP_HIDE_FROM_ABI
- path& append(_InputIt __first, _InputIt __last) {
+ _LIBCPP_HIDE_FROM_ABI path& append(_InputIt __first, _InputIt __last) {
typedef typename iterator_traits<_InputIt>::value_type _ItVal;
static_assert(__can_convert_char<_ItVal>::value, "Must convertible");
using _CVT = _PathCVT<_ItVal>;
@@ -639,91 +552,76 @@ public:
_CVT::__append_range(__pn_, __first, __last);
return *this;
}
-#endif
+# endif
// concatenation
- _LIBCPP_HIDE_FROM_ABI
- path& operator+=(const path& __x) {
+ _LIBCPP_HIDE_FROM_ABI path& operator+=(const path& __x) {
__pn_ += __x.__pn_;
return *this;
}
- _LIBCPP_HIDE_FROM_ABI
- path& operator+=(const string_type& __x) {
+ _LIBCPP_HIDE_FROM_ABI path& operator+=(const string_type& __x) {
__pn_ += __x;
return *this;
}
- _LIBCPP_HIDE_FROM_ABI
- path& operator+=(__string_view __x) {
+ _LIBCPP_HIDE_FROM_ABI path& operator+=(__string_view __x) {
__pn_ += __x;
return *this;
}
- _LIBCPP_HIDE_FROM_ABI
- path& operator+=(const value_type* __x) {
+ _LIBCPP_HIDE_FROM_ABI path& operator+=(const value_type* __x) {
__pn_ += __x;
return *this;
}
- _LIBCPP_HIDE_FROM_ABI
- path& operator+=(value_type __x) {
+ _LIBCPP_HIDE_FROM_ABI path& operator+=(value_type __x) {
__pn_ += __x;
return *this;
}
template <class _ECharT, __enable_if_t<__can_convert_char<_ECharT>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI
- path&
- operator+=(_ECharT __x) {
- _PathCVT<_ECharT>::__append_source(__pn_,
- basic_string_view<_ECharT>(&__x, 1));
+ _LIBCPP_HIDE_FROM_ABI path& operator+=(_ECharT __x) {
+ _PathCVT<_ECharT>::__append_source(__pn_, basic_string_view<_ECharT>(&__x, 1));
return *this;
}
template <class _Source>
- _LIBCPP_HIDE_FROM_ABI
- _EnableIfPathable<_Source> operator+=(const _Source& __x) {
+ _LIBCPP_HIDE_FROM_ABI _EnableIfPathable<_Source> operator+=(const _Source& __x) {
return this->concat(__x);
}
template <class _Source>
- _LIBCPP_HIDE_FROM_ABI
- _EnableIfPathable<_Source> concat(const _Source& __x) {
+ _LIBCPP_HIDE_FROM_ABI _EnableIfPathable<_Source> concat(const _Source& __x) {
_SourceCVT<_Source>::__append_source(__pn_, __x);
return *this;
}
template <class _InputIt>
- _LIBCPP_HIDE_FROM_ABI
- path& concat(_InputIt __first, _InputIt __last) {
+ _LIBCPP_HIDE_FROM_ABI path& concat(_InputIt __first, _InputIt __last) {
typedef typename iterator_traits<_InputIt>::value_type _ItVal;
_PathCVT<_ItVal>::__append_range(__pn_, __first, __last);
return *this;
}
// modifiers
- _LIBCPP_HIDE_FROM_ABI
- void clear() noexcept { __pn_.clear(); }
+ _LIBCPP_HIDE_FROM_ABI void clear() noexcept { __pn_.clear(); }
- _LIBCPP_HIDE_FROM_ABI
- path& make_preferred() {
-#if defined(_LIBCPP_WIN32API)
+ _LIBCPP_HIDE_FROM_ABI path& make_preferred() {
+# if defined(_LIBCPP_WIN32API)
std::replace(__pn_.begin(), __pn_.end(), L'/', L'\\');
-#endif
+# endif
return *this;
}
- _LIBCPP_HIDE_FROM_ABI
- path& remove_filename() {
+ _LIBCPP_HIDE_FROM_ABI path& remove_filename() {
auto __fname = __filename();
if (!__fname.empty())
__pn_.erase(__fname.data() - __pn_.data());
return *this;
}
- _LIBCPP_HIDE_FROM_ABI
- path& replace_filename(const path& __replacement) {
+ _LIBCPP_HIDE_FROM_ABI path& replace_filename(const path& __replacement) {
remove_filename();
return (*this /= __replacement);
}
@@ -749,7 +647,7 @@ public:
friend _LIBCPP_HIDE_FROM_ABI bool operator>=(const path& __lhs, const path& __rhs) noexcept {
return __lhs.__compare(__rhs.__pn_) >= 0;
}
-# else // _LIBCPP_STD_VER <= 17
+# else // _LIBCPP_STD_VER <= 17
friend _LIBCPP_HIDE_FROM_ABI strong_ordering operator<=>(const path& __lhs, const path& __rhs) noexcept {
return __lhs.__compare(__rhs.__pn_) <=> 0;
}
@@ -761,39 +659,31 @@ public:
return __result;
}
- _LIBCPP_HIDE_FROM_ABI
- void swap(path& __rhs) noexcept { __pn_.swap(__rhs.__pn_); }
+ _LIBCPP_HIDE_FROM_ABI void swap(path& __rhs) noexcept { __pn_.swap(__rhs.__pn_); }
// private helper to allow reserving memory in the path
- _LIBCPP_HIDE_FROM_ABI
- void __reserve(size_t __s) { __pn_.reserve(__s); }
+ _LIBCPP_HIDE_FROM_ABI void __reserve(size_t __s) { __pn_.reserve(__s); }
// native format observers
- _LIBCPP_HIDE_FROM_ABI
- const string_type& native() const noexcept { return __pn_; }
+ _LIBCPP_HIDE_FROM_ABI const string_type& native() const noexcept { return __pn_; }
- _LIBCPP_HIDE_FROM_ABI
- const value_type* c_str() const noexcept { return __pn_.c_str(); }
+ _LIBCPP_HIDE_FROM_ABI const value_type* c_str() const noexcept { return __pn_.c_str(); }
_LIBCPP_HIDE_FROM_ABI operator string_type() const { return __pn_; }
-#if defined(_LIBCPP_WIN32API)
+# if defined(_LIBCPP_WIN32API)
_LIBCPP_HIDE_FROM_ABI std::wstring wstring() const { return __pn_; }
- _LIBCPP_HIDE_FROM_ABI
- std::wstring generic_wstring() const {
+ _LIBCPP_HIDE_FROM_ABI std::wstring generic_wstring() const {
std::wstring __s;
__s.resize(__pn_.size());
std::replace_copy(__pn_.begin(), __pn_.end(), __s.begin(), '\\', '/');
return __s;
}
-#if !defined(_LIBCPP_HAS_NO_LOCALIZATION)
- template <class _ECharT, class _Traits = char_traits<_ECharT>,
- class _Allocator = allocator<_ECharT> >
- _LIBCPP_HIDE_FROM_ABI
- basic_string<_ECharT, _Traits, _Allocator>
- string(const _Allocator& __a = _Allocator()) const {
+# if !defined(_LIBCPP_HAS_NO_LOCALIZATION)
+ template <class _ECharT, class _Traits = char_traits<_ECharT>, class _Allocator = allocator<_ECharT> >
+ _LIBCPP_HIDE_FROM_ABI basic_string<_ECharT, _Traits, _Allocator> string(const _Allocator& __a = _Allocator()) const {
using _Str = basic_string<_ECharT, _Traits, _Allocator>;
_Str __s(__a);
__s.reserve(__pn_.size());
@@ -801,9 +691,7 @@ public:
return __s;
}
- _LIBCPP_HIDE_FROM_ABI std::string string() const {
- return string<char>();
- }
+ _LIBCPP_HIDE_FROM_ABI std::string string() const { return string<char>(); }
_LIBCPP_HIDE_FROM_ABI __u8_string u8string() const {
using _CVT = __narrow_to_utf8<sizeof(wchar_t) * __CHAR_BIT__>;
__u8_string __s;
@@ -812,54 +700,43 @@ public:
return __s;
}
- _LIBCPP_HIDE_FROM_ABI std::u16string u16string() const {
- return string<char16_t>();
- }
- _LIBCPP_HIDE_FROM_ABI std::u32string u32string() const {
- return string<char32_t>();
- }
+ _LIBCPP_HIDE_FROM_ABI std::u16string u16string() const { return string<char16_t>(); }
+ _LIBCPP_HIDE_FROM_ABI std::u32string u32string() const { return string<char32_t>(); }
// generic format observers
- template <class _ECharT, class _Traits = char_traits<_ECharT>,
- class _Allocator = allocator<_ECharT> >
- _LIBCPP_HIDE_FROM_ABI
- basic_string<_ECharT, _Traits, _Allocator>
+ template <class _ECharT, class _Traits = char_traits<_ECharT>, class _Allocator = allocator<_ECharT> >
+ _LIBCPP_HIDE_FROM_ABI basic_string<_ECharT, _Traits, _Allocator>
generic_string(const _Allocator& __a = _Allocator()) const {
using _Str = basic_string<_ECharT, _Traits, _Allocator>;
- _Str __s = string<_ECharT, _Traits, _Allocator>(__a);
+ _Str __s = string<_ECharT, _Traits, _Allocator>(__a);
// Note: This (and generic_u8string below) is slightly suboptimal as
// it iterates twice over the string; once to convert it to the right
// character type, and once to replace path delimiters.
- std::replace(__s.begin(), __s.end(),
- static_cast<_ECharT>('\\'), static_cast<_ECharT>('/'));
+ std::replace(__s.begin(), __s.end(), static_cast<_ECharT>('\\'), static_cast<_ECharT>('/'));
return __s;
}
_LIBCPP_HIDE_FROM_ABI std::string generic_string() const { return generic_string<char>(); }
_LIBCPP_HIDE_FROM_ABI std::u16string generic_u16string() const { return generic_string<char16_t>(); }
_LIBCPP_HIDE_FROM_ABI std::u32string generic_u32string() const { return generic_string<char32_t>(); }
- _LIBCPP_HIDE_FROM_ABI
- __u8_string generic_u8string() const {
+ _LIBCPP_HIDE_FROM_ABI __u8_string generic_u8string() const {
__u8_string __s = u8string();
std::replace(__s.begin(), __s.end(), '\\', '/');
return __s;
}
-#endif /* !_LIBCPP_HAS_NO_LOCALIZATION */
-#else /* _LIBCPP_WIN32API */
+# endif /* !_LIBCPP_HAS_NO_LOCALIZATION */
+# else /* _LIBCPP_WIN32API */
_LIBCPP_HIDE_FROM_ABI std::string string() const { return __pn_; }
-#ifndef _LIBCPP_HAS_NO_CHAR8_T
+# ifndef _LIBCPP_HAS_NO_CHAR8_T
_LIBCPP_HIDE_FROM_ABI std::u8string u8string() const { return std::u8string(__pn_.begin(), __pn_.end()); }
-#else
+# else
_LIBCPP_HIDE_FROM_ABI std::string u8string() const { return __pn_; }
-#endif
+# endif
-#if !defined(_LIBCPP_HAS_NO_LOCALIZATION)
- template <class _ECharT, class _Traits = char_traits<_ECharT>,
- class _Allocator = allocator<_ECharT> >
- _LIBCPP_HIDE_FROM_ABI
- basic_string<_ECharT, _Traits, _Allocator>
- string(const _Allocator& __a = _Allocator()) const {
+# if !defined(_LIBCPP_HAS_NO_LOCALIZATION)
+ template <class _ECharT, class _Traits = char_traits<_ECharT>, class _Allocator = allocator<_ECharT> >
+ _LIBCPP_HIDE_FROM_ABI basic_string<_ECharT, _Traits, _Allocator> string(const _Allocator& __a = _Allocator()) const {
using _CVT = __widen_from_utf8<sizeof(_ECharT) * __CHAR_BIT__>;
using _Str = basic_string<_ECharT, _Traits, _Allocator>;
_Str __s(__a);
@@ -868,43 +745,35 @@ public:
return __s;
}
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
- _LIBCPP_HIDE_FROM_ABI std::wstring wstring() const {
- return string<wchar_t>();
- }
-#endif
- _LIBCPP_HIDE_FROM_ABI std::u16string u16string() const {
- return string<char16_t>();
- }
- _LIBCPP_HIDE_FROM_ABI std::u32string u32string() const {
- return string<char32_t>();
- }
-#endif /* !_LIBCPP_HAS_NO_LOCALIZATION */
+# ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+ _LIBCPP_HIDE_FROM_ABI std::wstring wstring() const { return string<wchar_t>(); }
+# endif
+ _LIBCPP_HIDE_FROM_ABI std::u16string u16string() const { return string<char16_t>(); }
+ _LIBCPP_HIDE_FROM_ABI std::u32string u32string() const { return string<char32_t>(); }
+# endif /* !_LIBCPP_HAS_NO_LOCALIZATION */
// generic format observers
_LIBCPP_HIDE_FROM_ABI std::string generic_string() const { return __pn_; }
-#ifndef _LIBCPP_HAS_NO_CHAR8_T
+# ifndef _LIBCPP_HAS_NO_CHAR8_T
_LIBCPP_HIDE_FROM_ABI std::u8string generic_u8string() const { return std::u8string(__pn_.begin(), __pn_.end()); }
-#else
+# else
_LIBCPP_HIDE_FROM_ABI std::string generic_u8string() const { return __pn_; }
-#endif
+# endif
-#if !defined(_LIBCPP_HAS_NO_LOCALIZATION)
- template <class _ECharT, class _Traits = char_traits<_ECharT>,
- class _Allocator = allocator<_ECharT> >
- _LIBCPP_HIDE_FROM_ABI
- basic_string<_ECharT, _Traits, _Allocator>
+# if !defined(_LIBCPP_HAS_NO_LOCALIZATION)
+ template <class _ECharT, class _Traits = char_traits<_ECharT>, class _Allocator = allocator<_ECharT> >
+ _LIBCPP_HIDE_FROM_ABI basic_string<_ECharT, _Traits, _Allocator>
generic_string(const _Allocator& __a = _Allocator()) const {
return string<_ECharT, _Traits, _Allocator>(__a);
}
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+# ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
_LIBCPP_HIDE_FROM_ABI std::wstring generic_wstring() const { return string<wchar_t>(); }
-#endif
+# endif
_LIBCPP_HIDE_FROM_ABI std::u16string generic_u16string() const { return string<char16_t>(); }
_LIBCPP_HIDE_FROM_ABI std::u32string generic_u32string() const { return string<char32_t>(); }
-#endif /* !_LIBCPP_HAS_NO_LOCALIZATION */
-#endif /* !_LIBCPP_WIN32API */
+# endif /* !_LIBCPP_HAS_NO_LOCALIZATION */
+# endif /* !_LIBCPP_WIN32API */
private:
int __compare(__string_view) const;
@@ -919,80 +788,43 @@ private:
public:
// compare
- _LIBCPP_HIDE_FROM_ABI int compare(const path& __p) const noexcept {
- return __compare(__p.__pn_);
- }
- _LIBCPP_HIDE_FROM_ABI int compare(const string_type& __s) const {
- return __compare(__s);
- }
- _LIBCPP_HIDE_FROM_ABI int compare(__string_view __s) const {
- return __compare(__s);
- }
- _LIBCPP_HIDE_FROM_ABI int compare(const value_type* __s) const {
- return __compare(__s);
- }
+ _LIBCPP_HIDE_FROM_ABI int compare(const path& __p) const noexcept { return __compare(__p.__pn_); }
+ _LIBCPP_HIDE_FROM_ABI int compare(const string_type& __s) const { return __compare(__s); }
+ _LIBCPP_HIDE_FROM_ABI int compare(__string_view __s) const { return __compare(__s); }
+ _LIBCPP_HIDE_FROM_ABI int compare(const value_type* __s) const { return __compare(__s); }
// decomposition
- _LIBCPP_HIDE_FROM_ABI path root_name() const {
- return string_type(__root_name());
- }
- _LIBCPP_HIDE_FROM_ABI path root_directory() const {
- return string_type(__root_directory());
- }
+ _LIBCPP_HIDE_FROM_ABI path root_name() const { return string_type(__root_name()); }
+ _LIBCPP_HIDE_FROM_ABI path root_directory() const { return string_type(__root_directory()); }
_LIBCPP_HIDE_FROM_ABI path root_path() const {
-#if defined(_LIBCPP_WIN32API)
+# if defined(_LIBCPP_WIN32API)
return string_type(__root_path_raw());
-#else
+# else
return root_name().append(string_type(__root_directory()));
-#endif
- }
- _LIBCPP_HIDE_FROM_ABI path relative_path() const {
- return string_type(__relative_path());
- }
- _LIBCPP_HIDE_FROM_ABI path parent_path() const {
- return string_type(__parent_path());
- }
- _LIBCPP_HIDE_FROM_ABI path filename() const {
- return string_type(__filename());
+# endif
}
+ _LIBCPP_HIDE_FROM_ABI path relative_path() const { return string_type(__relative_path()); }
+ _LIBCPP_HIDE_FROM_ABI path parent_path() const { return string_type(__parent_path()); }
+ _LIBCPP_HIDE_FROM_ABI path filename() const { return string_type(__filename()); }
_LIBCPP_HIDE_FROM_ABI path stem() const { return string_type(__stem()); }
- _LIBCPP_HIDE_FROM_ABI path extension() const {
- return string_type(__extension());
- }
+ _LIBCPP_HIDE_FROM_ABI path extension() const { return string_type(__extension()); }
// query
- _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_HIDE_FROM_ABI bool
- empty() const noexcept {
- return __pn_.empty();
- }
-
- _LIBCPP_HIDE_FROM_ABI bool has_root_name() const {
- return !__root_name().empty();
- }
- _LIBCPP_HIDE_FROM_ABI bool has_root_directory() const {
- return !__root_directory().empty();
- }
- _LIBCPP_HIDE_FROM_ABI bool has_root_path() const {
- return !__root_path_raw().empty();
- }
- _LIBCPP_HIDE_FROM_ABI bool has_relative_path() const {
- return !__relative_path().empty();
- }
- _LIBCPP_HIDE_FROM_ABI bool has_parent_path() const {
- return !__parent_path().empty();
- }
- _LIBCPP_HIDE_FROM_ABI bool has_filename() const {
- return !__filename().empty();
- }
+ _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_HIDE_FROM_ABI bool empty() const noexcept { return __pn_.empty(); }
+
+ _LIBCPP_HIDE_FROM_ABI bool has_root_name() const { return !__root_name().empty(); }
+ _LIBCPP_HIDE_FROM_ABI bool has_root_directory() const { return !__root_directory().empty(); }
+ _LIBCPP_HIDE_FROM_ABI bool has_root_path() const { return !__root_path_raw().empty(); }
+ _LIBCPP_HIDE_FROM_ABI bool has_relative_path() const { return !__relative_path().empty(); }
+ _LIBCPP_HIDE_FROM_ABI bool has_parent_path() const { return !__parent_path().empty(); }
+ _LIBCPP_HIDE_FROM_ABI bool has_filename() const { return !__filename().empty(); }
_LIBCPP_HIDE_FROM_ABI bool has_stem() const { return !__stem().empty(); }
- _LIBCPP_HIDE_FROM_ABI bool has_extension() const {
- return !__extension().empty();
- }
+ _LIBCPP_HIDE_FROM_ABI bool has_extension() const { return !__extension().empty(); }
_LIBCPP_HIDE_FROM_ABI bool is_absolute() const {
-#if defined(_LIBCPP_WIN32API)
+# if defined(_LIBCPP_WIN32API)
__string_view __root_name_str = __root_name();
- __string_view __root_dir = __root_directory();
+ __string_view __root_dir = __root_directory();
if (__root_name_str.size() == 2 && __root_name_str[1] == ':') {
// A drive letter with no root directory is relative, e.g. x:example.
return !__root_dir.empty();
@@ -1009,9 +841,9 @@ public:
return false;
// Seems to be a server root name
return true;
-#else
+# else
return has_root_directory();
-#endif
+# endif
}
_LIBCPP_HIDE_FROM_ABI bool is_relative() const { return !is_absolute(); }
@@ -1033,21 +865,23 @@ public:
iterator begin() const;
iterator end() const;
-#if !defined(_LIBCPP_HAS_NO_LOCALIZATION)
- template <class _CharT, class _Traits, __enable_if_t<is_same<_CharT, value_type>::value &&
- is_same<_Traits, char_traits<value_type> >::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI friend
- basic_ostream<_CharT, _Traits>&
- operator<<(basic_ostream<_CharT, _Traits>& __os, const path& __p) {
+# if !defined(_LIBCPP_HAS_NO_LOCALIZATION)
+ template <
+ class _CharT,
+ class _Traits,
+ __enable_if_t<is_same<_CharT, value_type>::value && is_same<_Traits, char_traits<value_type> >::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI friend basic_ostream<_CharT, _Traits>&
+ operator<<(basic_ostream<_CharT, _Traits>& __os, const path& __p) {
__os << std::__quoted(__p.native());
return __os;
}
- template <class _CharT, class _Traits, __enable_if_t<!is_same<_CharT, value_type>::value ||
- !is_same<_Traits, char_traits<value_type> >::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI friend
- basic_ostream<_CharT, _Traits>&
- operator<<(basic_ostream<_CharT, _Traits>& __os, const path& __p) {
+ template <
+ class _CharT,
+ class _Traits,
+ __enable_if_t<!is_same<_CharT, value_type>::value || !is_same<_Traits, char_traits<value_type> >::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI friend basic_ostream<_CharT, _Traits>&
+ operator<<(basic_ostream<_CharT, _Traits>& __os, const path& __p) {
__os << std::__quoted(__p.string<_CharT, _Traits>());
return __os;
}
@@ -1060,7 +894,7 @@ public:
__p = __tmp;
return __is;
}
-#endif // !_LIBCPP_HAS_NO_LOCALIZATION
+# endif // !_LIBCPP_HAS_NO_LOCALIZATION
private:
inline _LIBCPP_HIDE_FROM_ABI path& __assign_view(__string_view const& __s) {
@@ -1070,9 +904,7 @@ private:
string_type __pn_;
};
-inline _LIBCPP_HIDE_FROM_ABI void swap(path& __lhs, path& __rhs) noexcept {
- __lhs.swap(__rhs);
-}
+inline _LIBCPP_HIDE_FROM_ABI void swap(path& __lhs, path& __rhs) noexcept { __lhs.swap(__rhs); }
_LIBCPP_EXPORTED_FROM_ABI size_t hash_value(const path& __p) noexcept;
diff --git a/contrib/llvm-project/libcxx/include/__filesystem/path_iterator.h b/contrib/llvm-project/libcxx/include/__filesystem/path_iterator.h
index 598d65d3d72e..1a9aaf0e7d99 100644
--- a/contrib/llvm-project/libcxx/include/__filesystem/path_iterator.h
+++ b/contrib/llvm-project/libcxx/include/__filesystem/path_iterator.h
@@ -49,49 +49,37 @@ public:
typedef path reference;
public:
- _LIBCPP_HIDE_FROM_ABI
- iterator()
- : __stashed_elem_(), __path_ptr_(nullptr), __entry_(),
- __state_(_Singular) {}
+ _LIBCPP_HIDE_FROM_ABI iterator() : __stashed_elem_(), __path_ptr_(nullptr), __entry_(), __state_(_Singular) {}
_LIBCPP_HIDE_FROM_ABI iterator(const iterator&) = default;
- _LIBCPP_HIDE_FROM_ABI ~iterator() = default;
+ _LIBCPP_HIDE_FROM_ABI ~iterator() = default;
_LIBCPP_HIDE_FROM_ABI iterator& operator=(const iterator&) = default;
- _LIBCPP_HIDE_FROM_ABI
- reference operator*() const { return __stashed_elem_; }
+ _LIBCPP_HIDE_FROM_ABI reference operator*() const { return __stashed_elem_; }
- _LIBCPP_HIDE_FROM_ABI
- pointer operator->() const { return &__stashed_elem_; }
+ _LIBCPP_HIDE_FROM_ABI pointer operator->() const { return &__stashed_elem_; }
- _LIBCPP_HIDE_FROM_ABI
- iterator& operator++() {
- _LIBCPP_ASSERT_UNCATEGORIZED(__state_ != _Singular,
- "attempting to increment a singular iterator");
- _LIBCPP_ASSERT_UNCATEGORIZED(__state_ != _AtEnd,
- "attempting to increment the end iterator");
+ _LIBCPP_HIDE_FROM_ABI iterator& operator++() {
+ _LIBCPP_ASSERT_UNCATEGORIZED(__state_ != _Singular, "attempting to increment a singular iterator");
+ _LIBCPP_ASSERT_UNCATEGORIZED(__state_ != _AtEnd, "attempting to increment the end iterator");
return __increment();
}
- _LIBCPP_HIDE_FROM_ABI
- iterator operator++(int) {
+ _LIBCPP_HIDE_FROM_ABI iterator operator++(int) {
iterator __it(*this);
this->operator++();
return __it;
}
- _LIBCPP_HIDE_FROM_ABI
- iterator& operator--() {
- _LIBCPP_ASSERT_UNCATEGORIZED(__state_ != _Singular,
- "attempting to decrement a singular iterator");
- _LIBCPP_ASSERT_UNCATEGORIZED(__entry_.data() != __path_ptr_->native().data(),
- "attempting to decrement the begin iterator");
+ _LIBCPP_HIDE_FROM_ABI iterator& operator--() {
+ _LIBCPP_ASSERT_UNCATEGORIZED(__state_ != _Singular, "attempting to decrement a singular iterator");
+ _LIBCPP_ASSERT_UNCATEGORIZED(
+ __entry_.data() != __path_ptr_->native().data(), "attempting to decrement the begin iterator");
return __decrement();
}
- _LIBCPP_HIDE_FROM_ABI
- iterator operator--(int) {
+ _LIBCPP_HIDE_FROM_ABI iterator operator--(int) {
iterator __it(*this);
this->operator--();
return __it;
@@ -100,8 +88,7 @@ public:
private:
friend class path;
- inline _LIBCPP_HIDE_FROM_ABI friend bool operator==(const iterator&,
- const iterator&);
+ inline _LIBCPP_HIDE_FROM_ABI friend bool operator==(const iterator&, const iterator&);
iterator& __increment();
iterator& __decrement();
@@ -113,15 +100,12 @@ private:
};
_LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY
-inline _LIBCPP_HIDE_FROM_ABI bool operator==(const path::iterator& __lhs,
- const path::iterator& __rhs) {
- return __lhs.__path_ptr_ == __rhs.__path_ptr_ &&
- __lhs.__entry_.data() == __rhs.__entry_.data();
+inline _LIBCPP_HIDE_FROM_ABI bool operator==(const path::iterator& __lhs, const path::iterator& __rhs) {
+ return __lhs.__path_ptr_ == __rhs.__path_ptr_ && __lhs.__entry_.data() == __rhs.__entry_.data();
}
_LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY
-inline _LIBCPP_HIDE_FROM_ABI bool operator!=(const path::iterator& __lhs,
- const path::iterator& __rhs) {
+inline _LIBCPP_HIDE_FROM_ABI bool operator!=(const path::iterator& __lhs, const path::iterator& __rhs) {
return !(__lhs == __rhs);
}
diff --git a/contrib/llvm-project/libcxx/include/__filesystem/perm_options.h b/contrib/llvm-project/libcxx/include/__filesystem/perm_options.h
index ecf506fa4e8f..529ef13558e9 100644
--- a/contrib/llvm-project/libcxx/include/__filesystem/perm_options.h
+++ b/contrib/llvm-project/libcxx/include/__filesystem/perm_options.h
@@ -21,48 +21,33 @@
_LIBCPP_BEGIN_NAMESPACE_FILESYSTEM
-enum class perm_options : unsigned char {
- replace = 1,
- add = 2,
- remove = 4,
- nofollow = 8
-};
-
-_LIBCPP_HIDE_FROM_ABI
-inline constexpr perm_options operator&(perm_options __lhs, perm_options __rhs) {
- return static_cast<perm_options>(static_cast<unsigned>(__lhs) &
- static_cast<unsigned>(__rhs));
+enum class perm_options : unsigned char { replace = 1, add = 2, remove = 4, nofollow = 8 };
+
+_LIBCPP_HIDE_FROM_ABI inline constexpr perm_options operator&(perm_options __lhs, perm_options __rhs) {
+ return static_cast<perm_options>(static_cast<unsigned>(__lhs) & static_cast<unsigned>(__rhs));
}
-_LIBCPP_HIDE_FROM_ABI
-inline constexpr perm_options operator|(perm_options __lhs, perm_options __rhs) {
- return static_cast<perm_options>(static_cast<unsigned>(__lhs) |
- static_cast<unsigned>(__rhs));
+_LIBCPP_HIDE_FROM_ABI inline constexpr perm_options operator|(perm_options __lhs, perm_options __rhs) {
+ return static_cast<perm_options>(static_cast<unsigned>(__lhs) | static_cast<unsigned>(__rhs));
}
-_LIBCPP_HIDE_FROM_ABI
-inline constexpr perm_options operator^(perm_options __lhs, perm_options __rhs) {
- return static_cast<perm_options>(static_cast<unsigned>(__lhs) ^
- static_cast<unsigned>(__rhs));
+_LIBCPP_HIDE_FROM_ABI inline constexpr perm_options operator^(perm_options __lhs, perm_options __rhs) {
+ return static_cast<perm_options>(static_cast<unsigned>(__lhs) ^ static_cast<unsigned>(__rhs));
}
-_LIBCPP_HIDE_FROM_ABI
-inline constexpr perm_options operator~(perm_options __lhs) {
+_LIBCPP_HIDE_FROM_ABI inline constexpr perm_options operator~(perm_options __lhs) {
return static_cast<perm_options>(~static_cast<unsigned>(__lhs));
}
-_LIBCPP_HIDE_FROM_ABI
-inline perm_options& operator&=(perm_options& __lhs, perm_options __rhs) {
+_LIBCPP_HIDE_FROM_ABI inline perm_options& operator&=(perm_options& __lhs, perm_options __rhs) {
return __lhs = __lhs & __rhs;
}
-_LIBCPP_HIDE_FROM_ABI
-inline perm_options& operator|=(perm_options& __lhs, perm_options __rhs) {
+_LIBCPP_HIDE_FROM_ABI inline perm_options& operator|=(perm_options& __lhs, perm_options __rhs) {
return __lhs = __lhs | __rhs;
}
-_LIBCPP_HIDE_FROM_ABI
-inline perm_options& operator^=(perm_options& __lhs, perm_options __rhs) {
+_LIBCPP_HIDE_FROM_ABI inline perm_options& operator^=(perm_options& __lhs, perm_options __rhs) {
return __lhs = __lhs ^ __rhs;
}
diff --git a/contrib/llvm-project/libcxx/include/__filesystem/perms.h b/contrib/llvm-project/libcxx/include/__filesystem/perms.h
index 9f45f0c25f03..8f5f9a7e8248 100644
--- a/contrib/llvm-project/libcxx/include/__filesystem/perms.h
+++ b/contrib/llvm-project/libcxx/include/__filesystem/perms.h
@@ -28,61 +28,51 @@ _LIBCPP_BEGIN_NAMESPACE_FILESYSTEM
enum class perms : unsigned {
none = 0,
- owner_read = 0400,
+ owner_read = 0400,
owner_write = 0200,
- owner_exec = 0100,
- owner_all = 0700,
+ owner_exec = 0100,
+ owner_all = 0700,
- group_read = 040,
+ group_read = 040,
group_write = 020,
- group_exec = 010,
- group_all = 070,
+ group_exec = 010,
+ group_all = 070,
- others_read = 04,
+ others_read = 04,
others_write = 02,
- others_exec = 01,
- others_all = 07,
+ others_exec = 01,
+ others_all = 07,
all = 0777,
- set_uid = 04000,
- set_gid = 02000,
+ set_uid = 04000,
+ set_gid = 02000,
sticky_bit = 01000,
- mask = 07777,
- unknown = 0xFFFF,
+ mask = 07777,
+ unknown = 0xFFFF,
};
-_LIBCPP_HIDE_FROM_ABI
-inline constexpr perms operator&(perms __lhs, perms __rhs) {
- return static_cast<perms>(static_cast<unsigned>(__lhs) &
- static_cast<unsigned>(__rhs));
+_LIBCPP_HIDE_FROM_ABI inline constexpr perms operator&(perms __lhs, perms __rhs) {
+ return static_cast<perms>(static_cast<unsigned>(__lhs) & static_cast<unsigned>(__rhs));
}
-_LIBCPP_HIDE_FROM_ABI
-inline constexpr perms operator|(perms __lhs, perms __rhs) {
- return static_cast<perms>(static_cast<unsigned>(__lhs) |
- static_cast<unsigned>(__rhs));
+_LIBCPP_HIDE_FROM_ABI inline constexpr perms operator|(perms __lhs, perms __rhs) {
+ return static_cast<perms>(static_cast<unsigned>(__lhs) | static_cast<unsigned>(__rhs));
}
-_LIBCPP_HIDE_FROM_ABI
-inline constexpr perms operator^(perms __lhs, perms __rhs) {
- return static_cast<perms>(static_cast<unsigned>(__lhs) ^
- static_cast<unsigned>(__rhs));
+_LIBCPP_HIDE_FROM_ABI inline constexpr perms operator^(perms __lhs, perms __rhs) {
+ return static_cast<perms>(static_cast<unsigned>(__lhs) ^ static_cast<unsigned>(__rhs));
}
-_LIBCPP_HIDE_FROM_ABI
-inline constexpr perms operator~(perms __lhs) {
+_LIBCPP_HIDE_FROM_ABI inline constexpr perms operator~(perms __lhs) {
return static_cast<perms>(~static_cast<unsigned>(__lhs));
}
-_LIBCPP_HIDE_FROM_ABI
-inline perms& operator&=(perms& __lhs, perms __rhs) { return __lhs = __lhs & __rhs; }
+_LIBCPP_HIDE_FROM_ABI inline perms& operator&=(perms& __lhs, perms __rhs) { return __lhs = __lhs & __rhs; }
-_LIBCPP_HIDE_FROM_ABI
-inline perms& operator|=(perms& __lhs, perms __rhs) { return __lhs = __lhs | __rhs; }
+_LIBCPP_HIDE_FROM_ABI inline perms& operator|=(perms& __lhs, perms __rhs) { return __lhs = __lhs | __rhs; }
-_LIBCPP_HIDE_FROM_ABI
-inline perms& operator^=(perms& __lhs, perms __rhs) { return __lhs = __lhs ^ __rhs; }
+_LIBCPP_HIDE_FROM_ABI inline perms& operator^=(perms& __lhs, perms __rhs) { return __lhs = __lhs ^ __rhs; }
_LIBCPP_END_NAMESPACE_FILESYSTEM
diff --git a/contrib/llvm-project/libcxx/include/__filesystem/recursive_directory_iterator.h b/contrib/llvm-project/libcxx/include/__filesystem/recursive_directory_iterator.h
index e0aac636db8c..7519cc2f2932 100644
--- a/contrib/llvm-project/libcxx/include/__filesystem/recursive_directory_iterator.h
+++ b/contrib/llvm-project/libcxx/include/__filesystem/recursive_directory_iterator.h
@@ -36,40 +36,32 @@ _LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY_PUSH
class recursive_directory_iterator {
public:
- using value_type = directory_entry;
- using difference_type = ptrdiff_t;
- using pointer = directory_entry const*;
- using reference = directory_entry const&;
+ using value_type = directory_entry;
+ using difference_type = ptrdiff_t;
+ using pointer = directory_entry const*;
+ using reference = directory_entry const&;
using iterator_category = input_iterator_tag;
public:
// constructors and destructor
- _LIBCPP_HIDE_FROM_ABI
- recursive_directory_iterator() noexcept : __rec_(false) {}
+ _LIBCPP_HIDE_FROM_ABI recursive_directory_iterator() noexcept : __rec_(false) {}
- _LIBCPP_HIDE_FROM_ABI
- explicit recursive_directory_iterator(
+ _LIBCPP_HIDE_FROM_ABI explicit recursive_directory_iterator(
const path& __p, directory_options __xoptions = directory_options::none)
: recursive_directory_iterator(__p, __xoptions, nullptr) {}
- _LIBCPP_HIDE_FROM_ABI
- recursive_directory_iterator(const path& __p, directory_options __xoptions,
- error_code& __ec)
+ _LIBCPP_HIDE_FROM_ABI recursive_directory_iterator(const path& __p, directory_options __xoptions, error_code& __ec)
: recursive_directory_iterator(__p, __xoptions, &__ec) {}
- _LIBCPP_HIDE_FROM_ABI
- recursive_directory_iterator(const path& __p, error_code& __ec)
+ _LIBCPP_HIDE_FROM_ABI recursive_directory_iterator(const path& __p, error_code& __ec)
: recursive_directory_iterator(__p, directory_options::none, &__ec) {}
_LIBCPP_HIDE_FROM_ABI recursive_directory_iterator(const recursive_directory_iterator&) = default;
- _LIBCPP_HIDE_FROM_ABI recursive_directory_iterator(recursive_directory_iterator&&) = default;
+ _LIBCPP_HIDE_FROM_ABI recursive_directory_iterator(recursive_directory_iterator&&) = default;
- _LIBCPP_HIDE_FROM_ABI recursive_directory_iterator&
- operator=(const recursive_directory_iterator&) = default;
+ _LIBCPP_HIDE_FROM_ABI recursive_directory_iterator& operator=(const recursive_directory_iterator&) = default;
- _LIBCPP_HIDE_FROM_ABI
- recursive_directory_iterator&
- operator=(recursive_directory_iterator&& __o) noexcept {
+ _LIBCPP_HIDE_FROM_ABI recursive_directory_iterator& operator=(recursive_directory_iterator&& __o) noexcept {
// non-default implementation provided to support self-move assign.
if (this != &__o) {
__imp_ = std::move(__o.__imp_);
@@ -80,40 +72,30 @@ public:
_LIBCPP_HIDE_FROM_ABI ~recursive_directory_iterator() = default;
- _LIBCPP_HIDE_FROM_ABI
- const directory_entry& operator*() const { return __dereference(); }
+ _LIBCPP_HIDE_FROM_ABI const directory_entry& operator*() const { return __dereference(); }
- _LIBCPP_HIDE_FROM_ABI
- const directory_entry* operator->() const { return &__dereference(); }
+ _LIBCPP_HIDE_FROM_ABI const directory_entry* operator->() const { return &__dereference(); }
_LIBCPP_HIDE_FROM_ABI recursive_directory_iterator& operator++() { return __increment(); }
- _LIBCPP_HIDE_FROM_ABI
- __dir_element_proxy operator++(int) {
+ _LIBCPP_HIDE_FROM_ABI __dir_element_proxy operator++(int) {
__dir_element_proxy __p(**this);
__increment();
return __p;
}
- _LIBCPP_HIDE_FROM_ABI
- recursive_directory_iterator& increment(error_code& __ec) {
- return __increment(&__ec);
- }
+ _LIBCPP_HIDE_FROM_ABI recursive_directory_iterator& increment(error_code& __ec) { return __increment(&__ec); }
_LIBCPP_EXPORTED_FROM_ABI directory_options options() const;
_LIBCPP_EXPORTED_FROM_ABI int depth() const;
- _LIBCPP_HIDE_FROM_ABI
- void pop() { __pop(); }
+ _LIBCPP_HIDE_FROM_ABI void pop() { __pop(); }
- _LIBCPP_HIDE_FROM_ABI
- void pop(error_code& __ec) { __pop(&__ec); }
+ _LIBCPP_HIDE_FROM_ABI void pop(error_code& __ec) { __pop(&__ec); }
- _LIBCPP_HIDE_FROM_ABI
- bool recursion_pending() const { return __rec_; }
+ _LIBCPP_HIDE_FROM_ABI bool recursion_pending() const { return __rec_; }
- _LIBCPP_HIDE_FROM_ABI
- void disable_recursion_pending() { __rec_ = false; }
+ _LIBCPP_HIDE_FROM_ABI void disable_recursion_pending() { __rec_ = false; }
# if _LIBCPP_STD_VER >= 20
@@ -132,8 +114,7 @@ private:
_LIBCPP_EXPORTED_FROM_ABI void __pop(error_code* __ec = nullptr);
inline _LIBCPP_HIDE_FROM_ABI friend bool
- operator==(const recursive_directory_iterator&,
- const recursive_directory_iterator&) noexcept;
+ operator==(const recursive_directory_iterator&, const recursive_directory_iterator&) noexcept;
struct _LIBCPP_HIDDEN __shared_imp;
shared_ptr<__shared_imp> __imp_;
@@ -141,24 +122,20 @@ private:
}; // class recursive_directory_iterator
inline _LIBCPP_HIDE_FROM_ABI bool
-operator==(const recursive_directory_iterator& __lhs,
- const recursive_directory_iterator& __rhs) noexcept {
+operator==(const recursive_directory_iterator& __lhs, const recursive_directory_iterator& __rhs) noexcept {
return __lhs.__imp_ == __rhs.__imp_;
}
-_LIBCPP_HIDE_FROM_ABI
-inline bool operator!=(const recursive_directory_iterator& __lhs,
- const recursive_directory_iterator& __rhs) noexcept {
+_LIBCPP_HIDE_FROM_ABI inline bool
+operator!=(const recursive_directory_iterator& __lhs, const recursive_directory_iterator& __rhs) noexcept {
return !(__lhs == __rhs);
}
// enable recursive_directory_iterator range-based for statements
-inline _LIBCPP_HIDE_FROM_ABI recursive_directory_iterator
-begin(recursive_directory_iterator __iter) noexcept {
+inline _LIBCPP_HIDE_FROM_ABI recursive_directory_iterator begin(recursive_directory_iterator __iter) noexcept {
return __iter;
}
-inline _LIBCPP_HIDE_FROM_ABI recursive_directory_iterator
-end(recursive_directory_iterator) noexcept {
+inline _LIBCPP_HIDE_FROM_ABI recursive_directory_iterator end(recursive_directory_iterator) noexcept {
return recursive_directory_iterator();
}
@@ -166,17 +143,17 @@ _LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY_POP
_LIBCPP_END_NAMESPACE_FILESYSTEM
-#if _LIBCPP_STD_VER >= 20
+# if _LIBCPP_STD_VER >= 20
template <>
-_LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY
-inline constexpr bool std::ranges::enable_borrowed_range<std::filesystem::recursive_directory_iterator> = true;
+_LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY inline constexpr bool
+ std::ranges::enable_borrowed_range<std::filesystem::recursive_directory_iterator> = true;
template <>
-_LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY
-inline constexpr bool std::ranges::enable_view<std::filesystem::recursive_directory_iterator> = true;
+_LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY inline constexpr bool
+ std::ranges::enable_view<std::filesystem::recursive_directory_iterator> = true;
-#endif // _LIBCPP_STD_VER >= 20
+# endif // _LIBCPP_STD_VER >= 20
#endif // _LIBCPP_STD_VER >= 17 && !defined(_LIBCPP_HAS_NO_FILESYSTEM)
diff --git a/contrib/llvm-project/libcxx/include/__filesystem/u8path.h b/contrib/llvm-project/libcxx/include/__filesystem/u8path.h
index a79007e969ca..bde878054865 100644
--- a/contrib/llvm-project/libcxx/include/__filesystem/u8path.h
+++ b/contrib/llvm-project/libcxx/include/__filesystem/u8path.h
@@ -19,7 +19,7 @@
// Only required on Windows for __widen_from_utf8, and included conservatively
// because it requires support for localization.
#if defined(_LIBCPP_WIN32API)
-# include <locale>
+# include <locale>
#endif
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
@@ -33,38 +33,34 @@ _LIBCPP_BEGIN_NAMESPACE_FILESYSTEM
_LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY_PUSH
template <class _InputIt, __enable_if_t<__is_pathable<_InputIt>::value, int> = 0>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_DEPRECATED_WITH_CHAR8_T
- path
- u8path(_InputIt __f, _InputIt __l) {
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_DEPRECATED_WITH_CHAR8_T path u8path(_InputIt __f, _InputIt __l) {
static_assert(
-#ifndef _LIBCPP_HAS_NO_CHAR8_T
+# ifndef _LIBCPP_HAS_NO_CHAR8_T
is_same<typename __is_pathable<_InputIt>::__char_type, char8_t>::value ||
-#endif
- is_same<typename __is_pathable<_InputIt>::__char_type, char>::value,
+# endif
+ is_same<typename __is_pathable<_InputIt>::__char_type, char>::value,
"u8path(Iter, Iter) requires Iter have a value_type of type 'char'"
" or 'char8_t'");
-#if defined(_LIBCPP_WIN32API)
+# if defined(_LIBCPP_WIN32API)
string __tmp(__f, __l);
using _CVT = __widen_from_utf8<sizeof(wchar_t) * __CHAR_BIT__>;
std::wstring __w;
__w.reserve(__tmp.size());
_CVT()(back_inserter(__w), __tmp.data(), __tmp.data() + __tmp.size());
return path(__w);
-#else
+# else
return path(__f, __l);
-#endif /* !_LIBCPP_WIN32API */
+# endif /* !_LIBCPP_WIN32API */
}
-#if defined(_LIBCPP_WIN32API)
+# if defined(_LIBCPP_WIN32API)
template <class _InputIt, __enable_if_t<__is_pathable<_InputIt>::value, int> = 0>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_DEPRECATED_WITH_CHAR8_T
- path
- u8path(_InputIt __f, _NullSentinel) {
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_DEPRECATED_WITH_CHAR8_T path u8path(_InputIt __f, _NullSentinel) {
static_assert(
-#ifndef _LIBCPP_HAS_NO_CHAR8_T
+# ifndef _LIBCPP_HAS_NO_CHAR8_T
is_same<typename __is_pathable<_InputIt>::__char_type, char8_t>::value ||
-#endif
- is_same<typename __is_pathable<_InputIt>::__char_type, char>::value,
+# endif
+ is_same<typename __is_pathable<_InputIt>::__char_type, char>::value,
"u8path(Iter, Iter) requires Iter have a value_type of type 'char'"
" or 'char8_t'");
string __tmp;
@@ -77,25 +73,23 @@ _LIBCPP_HIDE_FROM_ABI _LIBCPP_DEPRECATED_WITH_CHAR8_T
_CVT()(back_inserter(__w), __tmp.data(), __tmp.data() + __tmp.size());
return path(__w);
}
-#endif /* _LIBCPP_WIN32API */
+# endif /* _LIBCPP_WIN32API */
template <class _Source, __enable_if_t<__is_pathable<_Source>::value, int> = 0>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_DEPRECATED_WITH_CHAR8_T
- path
- u8path(const _Source& __s) {
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_DEPRECATED_WITH_CHAR8_T path u8path(const _Source& __s) {
static_assert(
-#ifndef _LIBCPP_HAS_NO_CHAR8_T
+# ifndef _LIBCPP_HAS_NO_CHAR8_T
is_same<typename __is_pathable<_Source>::__char_type, char8_t>::value ||
-#endif
- is_same<typename __is_pathable<_Source>::__char_type, char>::value,
+# endif
+ is_same<typename __is_pathable<_Source>::__char_type, char>::value,
"u8path(Source const&) requires Source have a character type of type "
"'char' or 'char8_t'");
-#if defined(_LIBCPP_WIN32API)
+# if defined(_LIBCPP_WIN32API)
using _Traits = __is_pathable<_Source>;
return u8path(std::__unwrap_iter(_Traits::__range_begin(__s)), std::__unwrap_iter(_Traits::__range_end(__s)));
-#else
+# else
return path(__s);
-#endif
+# endif
}
_LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY_POP
diff --git a/contrib/llvm-project/libcxx/include/__format/buffer.h b/contrib/llvm-project/libcxx/include/__format/buffer.h
index 8aa58d6464bb..7ee583d81394 100644
--- a/contrib/llvm-project/libcxx/include/__format/buffer.h
+++ b/contrib/llvm-project/libcxx/include/__format/buffer.h
@@ -71,7 +71,7 @@ public:
__obj_(__obj) {}
_LIBCPP_HIDE_FROM_ABI void __reset(_CharT* __ptr, size_t __capacity) {
- __ptr_ = __ptr;
+ __ptr_ = __ptr;
__capacity_ = __capacity;
}
@@ -130,8 +130,10 @@ public:
/// A std::transform wrapper.
///
/// Like @ref __copy it may need to do type conversion.
- template <__fmt_char_type _InCharT, class _UnaryOperation>
- _LIBCPP_HIDE_FROM_ABI void __transform(const _InCharT* __first, const _InCharT* __last, _UnaryOperation __operation) {
+ template <contiguous_iterator _Iterator,
+ class _UnaryOperation,
+ __fmt_char_type _InCharT = typename iterator_traits<_Iterator>::value_type>
+ _LIBCPP_HIDE_FROM_ABI void __transform(_Iterator __first, _Iterator __last, _UnaryOperation __operation) {
_LIBCPP_ASSERT_UNCATEGORIZED(__first <= __last, "not a valid range");
size_t __n = static_cast<size_t>(__last - __first);
@@ -251,19 +253,18 @@ template <__fmt_char_type _CharT>
class _LIBCPP_TEMPLATE_VIS __direct_storage {};
template <class _OutIt, class _CharT>
-concept __enable_direct_output = __fmt_char_type<_CharT> &&
+concept __enable_direct_output =
+ __fmt_char_type<_CharT> &&
(same_as<_OutIt, _CharT*>
// TODO(hardening): the following check might not apply to hardened iterators and might need to be wrapped in an
// `#ifdef`.
- || same_as<_OutIt, __wrap_iter<_CharT*>>
- );
+ || same_as<_OutIt, __wrap_iter<_CharT*>>);
/// Write policy for directly writing to the underlying output.
template <class _OutIt, __fmt_char_type _CharT>
class _LIBCPP_TEMPLATE_VIS __writer_direct {
public:
- _LIBCPP_HIDE_FROM_ABI explicit __writer_direct(_OutIt __out_it)
- : __out_it_(__out_it) {}
+ _LIBCPP_HIDE_FROM_ABI explicit __writer_direct(_OutIt __out_it) : __out_it_(__out_it) {}
_LIBCPP_HIDE_FROM_ABI _OutIt __out_it() { return __out_it_; }
@@ -281,8 +282,7 @@ private:
template <class _OutIt, __fmt_char_type _CharT>
class _LIBCPP_TEMPLATE_VIS __writer_iterator {
public:
- _LIBCPP_HIDE_FROM_ABI explicit __writer_iterator(_OutIt __out_it)
- : __out_it_{std::move(__out_it)} {}
+ _LIBCPP_HIDE_FROM_ABI explicit __writer_iterator(_OutIt __out_it) : __out_it_{std::move(__out_it)} {}
_LIBCPP_HIDE_FROM_ABI _OutIt __out_it() && { return std::move(__out_it_); }
@@ -304,7 +304,8 @@ private:
template <class _Container>
concept __insertable =
__enable_insertable<_Container> && __fmt_char_type<typename _Container::value_type> &&
- requires(_Container& __t, add_pointer_t<typename _Container::value_type> __first,
+ requires(_Container& __t,
+ add_pointer_t<typename _Container::value_type> __first,
add_pointer_t<typename _Container::value_type> __last) { __t.insert(__t.end(), __first, __last); };
/// Extract the container type of a \ref back_insert_iterator.
@@ -343,28 +344,29 @@ class _LIBCPP_TEMPLATE_VIS __writer_selector {
using _Container = typename __back_insert_iterator_container<_OutIt>::type;
public:
- using type = conditional_t<!same_as<_Container, void>, __writer_container<_Container>,
- conditional_t<__enable_direct_output<_OutIt, _CharT>, __writer_direct<_OutIt, _CharT>,
- __writer_iterator<_OutIt, _CharT>>>;
+ using type =
+ conditional_t<!same_as<_Container, void>,
+ __writer_container<_Container>,
+ conditional_t<__enable_direct_output<_OutIt, _CharT>,
+ __writer_direct<_OutIt, _CharT>,
+ __writer_iterator<_OutIt, _CharT>>>;
};
/// The generic formatting buffer.
template <class _OutIt, __fmt_char_type _CharT>
-requires(output_iterator<_OutIt, const _CharT&>) class _LIBCPP_TEMPLATE_VIS
- __format_buffer {
+ requires(output_iterator<_OutIt, const _CharT&>)
+class _LIBCPP_TEMPLATE_VIS __format_buffer {
using _Storage =
- conditional_t<__enable_direct_output<_OutIt, _CharT>,
- __direct_storage<_CharT>, __internal_storage<_CharT>>;
+ conditional_t<__enable_direct_output<_OutIt, _CharT>, __direct_storage<_CharT>, __internal_storage<_CharT>>;
public:
_LIBCPP_HIDE_FROM_ABI explicit __format_buffer(_OutIt __out_it)
requires(same_as<_Storage, __internal_storage<_CharT>>)
: __output_(__storage_.__begin(), __storage_.__buffer_size, this), __writer_(std::move(__out_it)) {}
- _LIBCPP_HIDE_FROM_ABI explicit __format_buffer(_OutIt __out_it) requires(
- same_as<_Storage, __direct_storage<_CharT>>)
- : __output_(std::__unwrap_iter(__out_it), size_t(-1), this),
- __writer_(std::move(__out_it)) {}
+ _LIBCPP_HIDE_FROM_ABI explicit __format_buffer(_OutIt __out_it)
+ requires(same_as<_Storage, __direct_storage<_CharT>>)
+ : __output_(std::__unwrap_iter(__out_it), size_t(-1), this), __writer_(std::move(__out_it)) {}
_LIBCPP_HIDE_FROM_ABI auto __make_output_iterator() { return __output_.__make_output_iterator(); }
@@ -590,8 +592,10 @@ public:
__size_ += __n;
}
- template <__fmt_char_type _InCharT, class _UnaryOperation>
- _LIBCPP_HIDE_FROM_ABI void __transform(const _InCharT* __first, const _InCharT* __last, _UnaryOperation __operation) {
+ template <contiguous_iterator _Iterator,
+ class _UnaryOperation,
+ __fmt_char_type _InCharT = typename iterator_traits<_Iterator>::value_type>
+ _LIBCPP_HIDE_FROM_ABI void __transform(_Iterator __first, _Iterator __last, _UnaryOperation __operation) {
_LIBCPP_ASSERT_UNCATEGORIZED(__first <= __last, "not a valid range");
size_t __n = static_cast<size_t>(__last - __first);
diff --git a/contrib/llvm-project/libcxx/include/__format/concepts.h b/contrib/llvm-project/libcxx/include/__format/concepts.h
index ae96b6a19811..299c5f40ee35 100644
--- a/contrib/llvm-project/libcxx/include/__format/concepts.h
+++ b/contrib/llvm-project/libcxx/include/__format/concepts.h
@@ -74,7 +74,7 @@ concept __fmt_pair_like =
__is_specialization_v<_Tp, pair> || (__is_specialization_v<_Tp, tuple> && tuple_size_v<_Tp> == 2);
# endif //_LIBCPP_STD_VER >= 23
-#endif //_LIBCPP_STD_VER >= 20
+#endif //_LIBCPP_STD_VER >= 20
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__format/format_arg.h b/contrib/llvm-project/libcxx/include/__format/format_arg.h
index cc6be7a25660..280c91082417 100644
--- a/contrib/llvm-project/libcxx/include/__format/format_arg.h
+++ b/contrib/llvm-project/libcxx/include/__format/format_arg.h
@@ -73,16 +73,16 @@ enum class __arg_t : uint8_t {
};
inline constexpr unsigned __packed_arg_t_bits = 5;
-inline constexpr uint8_t __packed_arg_t_mask = 0x1f;
+inline constexpr uint8_t __packed_arg_t_mask = 0x1f;
inline constexpr unsigned __packed_types_storage_bits = 64;
-inline constexpr unsigned __packed_types_max = __packed_types_storage_bits / __packed_arg_t_bits;
+inline constexpr unsigned __packed_types_max = __packed_types_storage_bits / __packed_arg_t_bits;
-_LIBCPP_HIDE_FROM_ABI
-constexpr bool __use_packed_format_arg_store(size_t __size) { return __size <= __packed_types_max; }
+_LIBCPP_HIDE_FROM_ABI constexpr bool __use_packed_format_arg_store(size_t __size) {
+ return __size <= __packed_types_max;
+}
-_LIBCPP_HIDE_FROM_ABI
-constexpr __arg_t __get_packed_type(uint64_t __types, size_t __id) {
+_LIBCPP_HIDE_FROM_ABI constexpr __arg_t __get_packed_type(uint64_t __types, size_t __id) {
_LIBCPP_ASSERT_UNCATEGORIZED(__id <= __packed_types_max, "");
if (__id > 0)
@@ -96,8 +96,7 @@ constexpr __arg_t __get_packed_type(uint64_t __types, size_t __id) {
// This function is not user obervable, so it can directly use the non-standard
// types of the "variant". See __arg_t for more details.
template <class _Visitor, class _Context>
-_LIBCPP_HIDE_FROM_ABI decltype(auto)
-__visit_format_arg(_Visitor&& __vis, basic_format_arg<_Context> __arg) {
+_LIBCPP_HIDE_FROM_ABI decltype(auto) __visit_format_arg(_Visitor&& __vis, basic_format_arg<_Context> __arg) {
switch (__arg.__type_) {
case __format::__arg_t::__none:
return std::invoke(std::forward<_Visitor>(__vis), __arg.__value_.__monostate_);
@@ -138,8 +137,8 @@ __visit_format_arg(_Visitor&& __vis, basic_format_arg<_Context> __arg) {
case __format::__arg_t::__ptr:
return std::invoke(std::forward<_Visitor>(__vis), __arg.__value_.__ptr_);
case __format::__arg_t::__handle:
- return std::invoke(std::forward<_Visitor>(__vis),
- typename basic_format_arg<_Context>::handle{__arg.__value_.__handle_});
+ return std::invoke(
+ std::forward<_Visitor>(__vis), typename basic_format_arg<_Context>::handle{__arg.__value_.__handle_});
}
__libcpp_unreachable();
@@ -224,12 +223,9 @@ class _LIBCPP_TEMPLATE_VIS basic_format_arg {
public:
class _LIBCPP_TEMPLATE_VIS handle;
- _LIBCPP_HIDE_FROM_ABI basic_format_arg() noexcept
- : __type_{__format::__arg_t::__none} {}
+ _LIBCPP_HIDE_FROM_ABI basic_format_arg() noexcept : __type_{__format::__arg_t::__none} {}
- _LIBCPP_HIDE_FROM_ABI explicit operator bool() const noexcept {
- return __type_ != __format::__arg_t::__none;
- }
+ _LIBCPP_HIDE_FROM_ABI explicit operator bool() const noexcept { return __type_ != __format::__arg_t::__none; }
private:
using char_type = typename _Context::char_type;
@@ -257,8 +253,7 @@ public:
template <class _Context>
class _LIBCPP_TEMPLATE_VIS basic_format_arg<_Context>::handle {
public:
- _LIBCPP_HIDE_FROM_ABI
- void format(basic_format_parse_context<char_type>& __parse_ctx, _Context& __ctx) const {
+ _LIBCPP_HIDE_FROM_ABI void format(basic_format_parse_context<char_type>& __parse_ctx, _Context& __ctx) const {
__handle_.__format_(__parse_ctx, __ctx, __handle_.__ptr_);
}
@@ -272,8 +267,7 @@ private:
// This function is user facing, so it must wrap the non-standard types of
// the "variant" in a handle to stay conforming. See __arg_t for more details.
template <class _Visitor, class _Context>
-_LIBCPP_HIDE_FROM_ABI decltype(auto)
-visit_format_arg(_Visitor&& __vis, basic_format_arg<_Context> __arg) {
+_LIBCPP_HIDE_FROM_ABI decltype(auto) visit_format_arg(_Visitor&& __vis, basic_format_arg<_Context> __arg) {
switch (__arg.__type_) {
# ifndef _LIBCPP_HAS_NO_INT128
case __format::__arg_t::__i128: {
diff --git a/contrib/llvm-project/libcxx/include/__format/format_arg_store.h b/contrib/llvm-project/libcxx/include/__format/format_arg_store.h
index 64ee12440b62..c481992d2d71 100644
--- a/contrib/llvm-project/libcxx/include/__format/format_arg_store.h
+++ b/contrib/llvm-project/libcxx/include/__format/format_arg_store.h
@@ -243,8 +243,7 @@ struct __unpacked_format_arg_store {
template <class _Context, class... _Args>
struct _LIBCPP_TEMPLATE_VIS __format_arg_store {
- _LIBCPP_HIDE_FROM_ABI
- __format_arg_store(_Args&... __args) noexcept {
+ _LIBCPP_HIDE_FROM_ABI __format_arg_store(_Args&... __args) noexcept {
if constexpr (sizeof...(_Args) != 0) {
if constexpr (__format::__use_packed_format_arg_store(sizeof...(_Args)))
__format::__create_packed_storage(__storage.__types_, __storage.__values_, __args...);
@@ -253,9 +252,10 @@ struct _LIBCPP_TEMPLATE_VIS __format_arg_store {
}
}
- using _Storage = conditional_t<__format::__use_packed_format_arg_store(sizeof...(_Args)),
- __format::__packed_format_arg_store<_Context, sizeof...(_Args)>,
- __format::__unpacked_format_arg_store<_Context, sizeof...(_Args)>>;
+ using _Storage =
+ conditional_t<__format::__use_packed_format_arg_store(sizeof...(_Args)),
+ __format::__packed_format_arg_store<_Context, sizeof...(_Args)>,
+ __format::__unpacked_format_arg_store<_Context, sizeof...(_Args)>>;
_Storage __storage;
};
diff --git a/contrib/llvm-project/libcxx/include/__format/format_args.h b/contrib/llvm-project/libcxx/include/__format/format_args.h
index defb42a4ab00..9e0afecc0ae9 100644
--- a/contrib/llvm-project/libcxx/include/__format/format_args.h
+++ b/contrib/llvm-project/libcxx/include/__format/format_args.h
@@ -37,14 +37,13 @@ public:
if constexpr (sizeof...(_Args) != 0) {
if constexpr (__format::__use_packed_format_arg_store(sizeof...(_Args))) {
__values_ = __store.__storage.__values_;
- __types_ = __store.__storage.__types_;
+ __types_ = __store.__storage.__types_;
} else
__args_ = __store.__storage.__args_;
}
}
- _LIBCPP_HIDE_FROM_ABI
- basic_format_arg<_Context> get(size_t __id) const noexcept {
+ _LIBCPP_HIDE_FROM_ABI basic_format_arg<_Context> get(size_t __id) const noexcept {
if (__id >= __size_)
return basic_format_arg<_Context>{};
diff --git a/contrib/llvm-project/libcxx/include/__format/format_context.h b/contrib/llvm-project/libcxx/include/__format/format_context.h
index 4e3d15ec862e..5b252b81f691 100644
--- a/contrib/llvm-project/libcxx/include/__format/format_context.h
+++ b/contrib/llvm-project/libcxx/include/__format/format_context.h
@@ -27,8 +27,8 @@
#include <cstddef>
#ifndef _LIBCPP_HAS_NO_LOCALIZATION
-#include <locale>
-#include <optional>
+# include <locale>
+# include <optional>
#endif
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
@@ -40,10 +40,10 @@ _LIBCPP_BEGIN_NAMESPACE_STD
#if _LIBCPP_STD_VER >= 20
template <class _OutIt, class _CharT>
-requires output_iterator<_OutIt, const _CharT&>
+ requires output_iterator<_OutIt, const _CharT&>
class _LIBCPP_TEMPLATE_VIS basic_format_context;
-#ifndef _LIBCPP_HAS_NO_LOCALIZATION
+# ifndef _LIBCPP_HAS_NO_LOCALIZATION
/**
* Helper to create a basic_format_context.
*
@@ -51,32 +51,26 @@ class _LIBCPP_TEMPLATE_VIS basic_format_context;
*/
template <class _OutIt, class _CharT>
_LIBCPP_HIDE_FROM_ABI basic_format_context<_OutIt, _CharT>
-__format_context_create(
- _OutIt __out_it,
- basic_format_args<basic_format_context<_OutIt, _CharT>> __args,
- optional<std::locale>&& __loc = nullopt) {
+__format_context_create(_OutIt __out_it,
+ basic_format_args<basic_format_context<_OutIt, _CharT>> __args,
+ optional<std::locale>&& __loc = nullopt) {
return std::basic_format_context(std::move(__out_it), __args, std::move(__loc));
}
-#else
+# else
template <class _OutIt, class _CharT>
_LIBCPP_HIDE_FROM_ABI basic_format_context<_OutIt, _CharT>
-__format_context_create(
- _OutIt __out_it,
- basic_format_args<basic_format_context<_OutIt, _CharT>> __args) {
+__format_context_create(_OutIt __out_it, basic_format_args<basic_format_context<_OutIt, _CharT>> __args) {
return std::basic_format_context(std::move(__out_it), __args);
}
-#endif
+# endif
-using format_context =
- basic_format_context<back_insert_iterator<__format::__output_buffer<char>>,
- char>;
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
-using wformat_context = basic_format_context<
- back_insert_iterator<__format::__output_buffer<wchar_t>>, wchar_t>;
-#endif
+using format_context = basic_format_context<back_insert_iterator<__format::__output_buffer<char>>, char>;
+# ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+using wformat_context = basic_format_context< back_insert_iterator<__format::__output_buffer<wchar_t>>, wchar_t>;
+# endif
template <class _OutIt, class _CharT>
-requires output_iterator<_OutIt, const _CharT&>
+ requires output_iterator<_OutIt, const _CharT&>
class
// clang-format off
_LIBCPP_TEMPLATE_VIS
@@ -85,29 +79,28 @@ class
// clang-format on
basic_format_context {
public:
- using iterator = _OutIt;
+ using iterator = _OutIt;
using char_type = _CharT;
template <class _Tp>
using formatter_type = formatter<_Tp, _CharT>;
- _LIBCPP_HIDE_FROM_ABI basic_format_arg<basic_format_context>
- arg(size_t __id) const noexcept {
+ _LIBCPP_HIDE_FROM_ABI basic_format_arg<basic_format_context> arg(size_t __id) const noexcept {
return __args_.get(__id);
}
-#ifndef _LIBCPP_HAS_NO_LOCALIZATION
+# ifndef _LIBCPP_HAS_NO_LOCALIZATION
_LIBCPP_HIDE_FROM_ABI std::locale locale() {
if (!__loc_)
__loc_ = std::locale{};
return *__loc_;
}
-#endif
+# endif
_LIBCPP_HIDE_FROM_ABI iterator out() { return std::move(__out_it_); }
_LIBCPP_HIDE_FROM_ABI void advance_to(iterator __it) { __out_it_ = std::move(__it); }
private:
iterator __out_it_;
basic_format_args<basic_format_context> __args_;
-#ifndef _LIBCPP_HAS_NO_LOCALIZATION
+# ifndef _LIBCPP_HAS_NO_LOCALIZATION
// The Standard doesn't specify how the locale is stored.
// [format.context]/6
@@ -121,27 +114,21 @@ private:
optional<std::locale> __loc_;
template <class _OtherOutIt, class _OtherCharT>
- friend _LIBCPP_HIDE_FROM_ABI basic_format_context<_OtherOutIt, _OtherCharT>
- __format_context_create(_OtherOutIt, basic_format_args<basic_format_context<_OtherOutIt, _OtherCharT>>,
- optional<std::locale>&&);
+ friend _LIBCPP_HIDE_FROM_ABI basic_format_context<_OtherOutIt, _OtherCharT> __format_context_create(
+ _OtherOutIt, basic_format_args<basic_format_context<_OtherOutIt, _OtherCharT>>, optional<std::locale>&&);
// Note: the Standard doesn't specify the required constructors.
- _LIBCPP_HIDE_FROM_ABI
- explicit basic_format_context(_OutIt __out_it,
- basic_format_args<basic_format_context> __args,
- optional<std::locale>&& __loc)
- : __out_it_(std::move(__out_it)), __args_(__args),
- __loc_(std::move(__loc)) {}
-#else
+ _LIBCPP_HIDE_FROM_ABI explicit basic_format_context(
+ _OutIt __out_it, basic_format_args<basic_format_context> __args, optional<std::locale>&& __loc)
+ : __out_it_(std::move(__out_it)), __args_(__args), __loc_(std::move(__loc)) {}
+# else
template <class _OtherOutIt, class _OtherCharT>
friend _LIBCPP_HIDE_FROM_ABI basic_format_context<_OtherOutIt, _OtherCharT>
__format_context_create(_OtherOutIt, basic_format_args<basic_format_context<_OtherOutIt, _OtherCharT>>);
- _LIBCPP_HIDE_FROM_ABI
- explicit basic_format_context(_OutIt __out_it,
- basic_format_args<basic_format_context> __args)
+ _LIBCPP_HIDE_FROM_ABI explicit basic_format_context(_OutIt __out_it, basic_format_args<basic_format_context> __args)
: __out_it_(std::move(__out_it)), __args_(__args) {}
-#endif
+# endif
};
// A specialization for __retarget_buffer
@@ -161,8 +148,7 @@ private:
// Here the width of an element in input is determined dynamically.
// Note when the top-level element has no width the retargeting is not needed.
template <class _CharT>
-class _LIBCPP_TEMPLATE_VIS
- basic_format_context<typename __format::__retarget_buffer<_CharT>::__iterator, _CharT> {
+class _LIBCPP_TEMPLATE_VIS basic_format_context<typename __format::__retarget_buffer<_CharT>::__iterator, _CharT> {
public:
using iterator = typename __format::__retarget_buffer<_CharT>::__iterator;
using char_type = _CharT;
diff --git a/contrib/llvm-project/libcxx/include/__format/format_error.h b/contrib/llvm-project/libcxx/include/__format/format_error.h
index 51d6c5823091..ed40e395d6af 100644
--- a/contrib/llvm-project/libcxx/include/__format/format_error.h
+++ b/contrib/llvm-project/libcxx/include/__format/format_error.h
@@ -26,24 +26,21 @@ _LIBCPP_DIAGNOSTIC_PUSH
_LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Wweak-vtables")
class _LIBCPP_EXPORTED_FROM_ABI format_error : public runtime_error {
public:
- _LIBCPP_HIDE_FROM_ABI explicit format_error(const string& __s)
- : runtime_error(__s) {}
- _LIBCPP_HIDE_FROM_ABI explicit format_error(const char* __s)
- : runtime_error(__s) {}
- _LIBCPP_HIDE_FROM_ABI format_error(const format_error&) = default;
+ _LIBCPP_HIDE_FROM_ABI explicit format_error(const string& __s) : runtime_error(__s) {}
+ _LIBCPP_HIDE_FROM_ABI explicit format_error(const char* __s) : runtime_error(__s) {}
+ _LIBCPP_HIDE_FROM_ABI format_error(const format_error&) = default;
_LIBCPP_HIDE_FROM_ABI format_error& operator=(const format_error&) = default;
_LIBCPP_HIDE_FROM_ABI_VIRTUAL
~format_error() noexcept override = default;
};
_LIBCPP_DIAGNOSTIC_POP
-_LIBCPP_NORETURN inline _LIBCPP_HIDE_FROM_ABI void
-__throw_format_error(const char* __s) {
-#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
+_LIBCPP_NORETURN inline _LIBCPP_HIDE_FROM_ABI void __throw_format_error(const char* __s) {
+# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
throw format_error(__s);
-#else
+# else
_LIBCPP_VERBOSE_ABORT("format_error was thrown in -fno-exceptions mode with message \"%s\"", __s);
-#endif
+# endif
}
#endif //_LIBCPP_STD_VER >= 20
diff --git a/contrib/llvm-project/libcxx/include/__format/format_functions.h b/contrib/llvm-project/libcxx/include/__format/format_functions.h
index 8b2111f0e287..015bff70f51d 100644
--- a/contrib/llvm-project/libcxx/include/__format/format_functions.h
+++ b/contrib/llvm-project/libcxx/include/__format/format_functions.h
@@ -41,7 +41,7 @@
#include <string_view>
#ifndef _LIBCPP_HAS_NO_LOCALIZATION
-#include <locale>
+# include <locale>
#endif
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
@@ -58,9 +58,9 @@ _LIBCPP_BEGIN_NAMESPACE_STD
// to do this optimization now.
using format_args = basic_format_args<format_context>;
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+# ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
using wformat_args = basic_format_args<wformat_context>;
-#endif
+# endif
template <class _Context = format_context, class... _Args>
_LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI __format_arg_store<_Context, _Args...> make_format_args(_Args&... __args) {
@@ -188,9 +188,10 @@ _LIBCPP_HIDE_FROM_ABI constexpr void __compile_time_validate_argument(
// This function is not user facing, so it can directly use the non-standard types of the "variant".
template <class _CharT>
-_LIBCPP_HIDE_FROM_ABI constexpr void __compile_time_visit_format_arg(basic_format_parse_context<_CharT>& __parse_ctx,
- __compile_time_basic_format_context<_CharT>& __ctx,
- __arg_t __type) {
+_LIBCPP_HIDE_FROM_ABI constexpr void __compile_time_visit_format_arg(
+ basic_format_parse_context<_CharT>& __parse_ctx,
+ __compile_time_basic_format_context<_CharT>& __ctx,
+ __arg_t __type) {
switch (__type) {
case __arg_t::__none:
std::__throw_format_error("Invalid argument");
@@ -203,22 +204,22 @@ _LIBCPP_HIDE_FROM_ABI constexpr void __compile_time_visit_format_arg(basic_forma
case __arg_t::__long_long:
return __format::__compile_time_validate_argument<_CharT, long long>(__parse_ctx, __ctx);
case __arg_t::__i128:
-# ifndef _LIBCPP_HAS_NO_INT128
+# ifndef _LIBCPP_HAS_NO_INT128
return __format::__compile_time_validate_argument<_CharT, __int128_t>(__parse_ctx, __ctx);
-# else
+# else
std::__throw_format_error("Invalid argument");
-# endif
+# endif
return;
case __arg_t::__unsigned:
return __format::__compile_time_validate_argument<_CharT, unsigned>(__parse_ctx, __ctx);
case __arg_t::__unsigned_long_long:
return __format::__compile_time_validate_argument<_CharT, unsigned long long>(__parse_ctx, __ctx);
case __arg_t::__u128:
-# ifndef _LIBCPP_HAS_NO_INT128
+# ifndef _LIBCPP_HAS_NO_INT128
return __format::__compile_time_validate_argument<_CharT, __uint128_t>(__parse_ctx, __ctx);
-# else
+# else
std::__throw_format_error("Invalid argument");
-# endif
+# endif
return;
case __arg_t::__float:
return __format::__compile_time_validate_argument<_CharT, float, true>(__parse_ctx, __ctx);
@@ -240,9 +241,8 @@ _LIBCPP_HIDE_FROM_ABI constexpr void __compile_time_visit_format_arg(basic_forma
template <contiguous_iterator _Iterator, class _ParseCtx, class _Ctx>
_LIBCPP_HIDE_FROM_ABI constexpr _Iterator
-__handle_replacement_field(_Iterator __begin, _Iterator __end,
- _ParseCtx& __parse_ctx, _Ctx& __ctx) {
- using _CharT = iter_value_t<_Iterator>;
+__handle_replacement_field(_Iterator __begin, _Iterator __end, _ParseCtx& __parse_ctx, _Ctx& __ctx) {
+ using _CharT = iter_value_t<_Iterator>;
__format::__parse_number_result __r = __format::__parse_arg_id(__begin, __end, __parse_ctx);
if (__r.__last == __end)
@@ -294,13 +294,12 @@ __handle_replacement_field(_Iterator __begin, _Iterator __end,
}
template <class _ParseCtx, class _Ctx>
-_LIBCPP_HIDE_FROM_ABI constexpr typename _Ctx::iterator
-__vformat_to(_ParseCtx&& __parse_ctx, _Ctx&& __ctx) {
+_LIBCPP_HIDE_FROM_ABI constexpr typename _Ctx::iterator __vformat_to(_ParseCtx&& __parse_ctx, _Ctx&& __ctx) {
using _CharT = typename _ParseCtx::char_type;
static_assert(same_as<typename _Ctx::char_type, _CharT>);
- auto __begin = __parse_ctx.begin();
- auto __end = __parse_ctx.end();
+ auto __begin = __parse_ctx.begin();
+ auto __end = __parse_ctx.end();
typename _Ctx::iterator __out_it = __ctx.out();
while (__begin != __end) {
switch (*__begin) {
@@ -311,8 +310,7 @@ __vformat_to(_ParseCtx&& __parse_ctx, _Ctx&& __ctx) {
if (*__begin != _CharT('{')) [[likely]] {
__ctx.advance_to(std::move(__out_it));
- __begin =
- __format::__handle_replacement_field(__begin, __end, __parse_ctx, __ctx);
+ __begin = __format::__handle_replacement_field(__begin, __end, __parse_ctx, __ctx);
__out_it = __ctx.out();
// The output is written and __begin points to the next character. So
@@ -371,9 +369,7 @@ struct _LIBCPP_TEMPLATE_VIS basic_format_string {
_Context{__types_.data(), __handles_.data(), sizeof...(_Args)});
}
- _LIBCPP_HIDE_FROM_ABI constexpr basic_string_view<_CharT> get() const noexcept {
- return __str_;
- }
+ _LIBCPP_HIDE_FROM_ABI constexpr basic_string_view<_CharT> get() const noexcept { return __str_; }
# if _LIBCPP_STD_VER >= 26
_LIBCPP_HIDE_FROM_ABI basic_format_string(__runtime_format_string<_CharT> __s) noexcept : __str_(__s.__str_) {}
# endif
@@ -399,23 +395,23 @@ private:
template <class... _Args>
using format_string = basic_format_string<char, type_identity_t<_Args>...>;
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+# ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
template <class... _Args>
using wformat_string = basic_format_string<wchar_t, type_identity_t<_Args>...>;
-#endif
+# endif
template <class _OutIt, class _CharT, class _FormatOutIt>
-requires(output_iterator<_OutIt, const _CharT&>) _LIBCPP_HIDE_FROM_ABI _OutIt
- __vformat_to(
- _OutIt __out_it, basic_string_view<_CharT> __fmt,
- basic_format_args<basic_format_context<_FormatOutIt, _CharT>> __args) {
+ requires(output_iterator<_OutIt, const _CharT&>)
+_LIBCPP_HIDE_FROM_ABI _OutIt __vformat_to(_OutIt __out_it,
+ basic_string_view<_CharT> __fmt,
+ basic_format_args<basic_format_context<_FormatOutIt, _CharT>> __args) {
if constexpr (same_as<_OutIt, _FormatOutIt>)
- return std::__format::__vformat_to(basic_format_parse_context{__fmt, __args.__size()},
- std::__format_context_create(std::move(__out_it), __args));
+ return std::__format::__vformat_to(
+ basic_format_parse_context{__fmt, __args.__size()}, std::__format_context_create(std::move(__out_it), __args));
else {
__format::__format_buffer<_OutIt, _CharT> __buffer{std::move(__out_it)};
std::__format::__vformat_to(basic_format_parse_context{__fmt, __args.__size()},
- std::__format_context_create(__buffer.__make_output_iterator(), __args));
+ std::__format_context_create(__buffer.__make_output_iterator(), __args));
return std::move(__buffer).__out_it();
}
}
@@ -424,34 +420,31 @@ requires(output_iterator<_OutIt, const _CharT&>) _LIBCPP_HIDE_FROM_ABI _OutIt
// https://reviews.llvm.org/D110499#inline-1180704
// TODO FMT Evaluate whether we want to file a Clang bug report regarding this.
template <output_iterator<const char&> _OutIt>
-_LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI _OutIt
-vformat_to(_OutIt __out_it, string_view __fmt, format_args __args) {
+_LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI _OutIt vformat_to(_OutIt __out_it, string_view __fmt, format_args __args) {
return std::__vformat_to(std::move(__out_it), __fmt, __args);
}
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+# ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
template <output_iterator<const wchar_t&> _OutIt>
_LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI _OutIt
vformat_to(_OutIt __out_it, wstring_view __fmt, wformat_args __args) {
return std::__vformat_to(std::move(__out_it), __fmt, __args);
}
-#endif
+# endif
template <output_iterator<const char&> _OutIt, class... _Args>
_LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI _OutIt
format_to(_OutIt __out_it, format_string<_Args...> __fmt, _Args&&... __args) {
- return std::vformat_to(std::move(__out_it), __fmt.get(),
- std::make_format_args(__args...));
+ return std::vformat_to(std::move(__out_it), __fmt.get(), std::make_format_args(__args...));
}
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+# ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
template <output_iterator<const wchar_t&> _OutIt, class... _Args>
_LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI _OutIt
format_to(_OutIt __out_it, wformat_string<_Args...> __fmt, _Args&&... __args) {
- return std::vformat_to(std::move(__out_it), __fmt.get(),
- std::make_wformat_args(__args...));
+ return std::vformat_to(std::move(__out_it), __fmt.get(), std::make_wformat_args(__args...));
}
-#endif
+# endif
// TODO FMT This needs to be a template or std::to_chars(floating-point) availability markup
// fires too eagerly, see http://llvm.org/PR61563.
@@ -490,12 +483,14 @@ format(wformat_string<_Args...> __fmt, _Args&&... __args) {
# endif
template <class _Context, class _OutIt, class _CharT>
-_LIBCPP_HIDE_FROM_ABI format_to_n_result<_OutIt> __vformat_to_n(_OutIt __out_it, iter_difference_t<_OutIt> __n,
- basic_string_view<_CharT> __fmt,
- basic_format_args<_Context> __args) {
+_LIBCPP_HIDE_FROM_ABI format_to_n_result<_OutIt>
+__vformat_to_n(_OutIt __out_it,
+ iter_difference_t<_OutIt> __n,
+ basic_string_view<_CharT> __fmt,
+ basic_format_args<_Context> __args) {
__format::__format_to_n_buffer<_OutIt, _CharT> __buffer{std::move(__out_it), __n};
std::__format::__vformat_to(basic_format_parse_context{__fmt, __args.__size()},
- std::__format_context_create(__buffer.__make_output_iterator(), __args));
+ std::__format_context_create(__buffer.__make_output_iterator(), __args));
return std::move(__buffer).__result();
}
@@ -505,20 +500,19 @@ format_to_n(_OutIt __out_it, iter_difference_t<_OutIt> __n, format_string<_Args.
return std::__vformat_to_n<format_context>(std::move(__out_it), __n, __fmt.get(), std::make_format_args(__args...));
}
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+# ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
template <output_iterator<const wchar_t&> _OutIt, class... _Args>
_LIBCPP_HIDE_FROM_ABI format_to_n_result<_OutIt>
-format_to_n(_OutIt __out_it, iter_difference_t<_OutIt> __n, wformat_string<_Args...> __fmt,
- _Args&&... __args) {
+format_to_n(_OutIt __out_it, iter_difference_t<_OutIt> __n, wformat_string<_Args...> __fmt, _Args&&... __args) {
return std::__vformat_to_n<wformat_context>(std::move(__out_it), __n, __fmt.get(), std::make_wformat_args(__args...));
}
-#endif
+# endif
template <class _CharT>
_LIBCPP_HIDE_FROM_ABI size_t __vformatted_size(basic_string_view<_CharT> __fmt, auto __args) {
__format::__formatted_size_buffer<_CharT> __buffer;
std::__format::__vformat_to(basic_format_parse_context{__fmt, __args.__size()},
- std::__format_context_create(__buffer.__make_output_iterator(), __args));
+ std::__format_context_create(__buffer.__make_output_iterator(), __args));
return std::move(__buffer).__result();
}
@@ -539,14 +533,15 @@ formatted_size(wformat_string<_Args...> __fmt, _Args&&... __args) {
# ifndef _LIBCPP_HAS_NO_LOCALIZATION
template <class _OutIt, class _CharT, class _FormatOutIt>
-requires(output_iterator<_OutIt, const _CharT&>) _LIBCPP_HIDE_FROM_ABI _OutIt
- __vformat_to(
- _OutIt __out_it, locale __loc, basic_string_view<_CharT> __fmt,
- basic_format_args<basic_format_context<_FormatOutIt, _CharT>> __args) {
+ requires(output_iterator<_OutIt, const _CharT&>)
+_LIBCPP_HIDE_FROM_ABI _OutIt __vformat_to(
+ _OutIt __out_it,
+ locale __loc,
+ basic_string_view<_CharT> __fmt,
+ basic_format_args<basic_format_context<_FormatOutIt, _CharT>> __args) {
if constexpr (same_as<_OutIt, _FormatOutIt>)
- return std::__format::__vformat_to(
- basic_format_parse_context{__fmt, __args.__size()},
- std::__format_context_create(std::move(__out_it), __args, std::move(__loc)));
+ return std::__format::__vformat_to(basic_format_parse_context{__fmt, __args.__size()},
+ std::__format_context_create(std::move(__out_it), __args, std::move(__loc)));
else {
__format::__format_buffer<_OutIt, _CharT> __buffer{std::move(__out_it)};
std::__format::__vformat_to(
@@ -557,36 +552,32 @@ requires(output_iterator<_OutIt, const _CharT&>) _LIBCPP_HIDE_FROM_ABI _OutIt
}
template <output_iterator<const char&> _OutIt>
-_LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI _OutIt vformat_to(
- _OutIt __out_it, locale __loc, string_view __fmt, format_args __args) {
- return std::__vformat_to(std::move(__out_it), std::move(__loc), __fmt,
- __args);
+_LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI _OutIt
+vformat_to(_OutIt __out_it, locale __loc, string_view __fmt, format_args __args) {
+ return std::__vformat_to(std::move(__out_it), std::move(__loc), __fmt, __args);
}
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+# ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
template <output_iterator<const wchar_t&> _OutIt>
-_LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI _OutIt vformat_to(
- _OutIt __out_it, locale __loc, wstring_view __fmt, wformat_args __args) {
- return std::__vformat_to(std::move(__out_it), std::move(__loc), __fmt,
- __args);
+_LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI _OutIt
+vformat_to(_OutIt __out_it, locale __loc, wstring_view __fmt, wformat_args __args) {
+ return std::__vformat_to(std::move(__out_it), std::move(__loc), __fmt, __args);
}
-#endif
+# endif
template <output_iterator<const char&> _OutIt, class... _Args>
_LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI _OutIt
format_to(_OutIt __out_it, locale __loc, format_string<_Args...> __fmt, _Args&&... __args) {
- return std::vformat_to(std::move(__out_it), std::move(__loc), __fmt.get(),
- std::make_format_args(__args...));
+ return std::vformat_to(std::move(__out_it), std::move(__loc), __fmt.get(), std::make_format_args(__args...));
}
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+# ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
template <output_iterator<const wchar_t&> _OutIt, class... _Args>
_LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI _OutIt
format_to(_OutIt __out_it, locale __loc, wformat_string<_Args...> __fmt, _Args&&... __args) {
- return std::vformat_to(std::move(__out_it), std::move(__loc), __fmt.get(),
- std::make_wformat_args(__args...));
+ return std::vformat_to(std::move(__out_it), std::move(__loc), __fmt.get(), std::make_wformat_args(__args...));
}
-#endif
+# endif
// TODO FMT This needs to be a template or std::to_chars(floating-point) availability markup
// fires too eagerly, see http://llvm.org/PR61563.
@@ -594,8 +585,7 @@ template <class = void>
_LIBCPP_NODISCARD_EXT _LIBCPP_ALWAYS_INLINE inline _LIBCPP_HIDE_FROM_ABI string
vformat(locale __loc, string_view __fmt, format_args __args) {
string __res;
- std::vformat_to(std::back_inserter(__res), std::move(__loc), __fmt,
- __args);
+ std::vformat_to(std::back_inserter(__res), std::move(__loc), __fmt, __args);
return __res;
}
@@ -606,8 +596,7 @@ template <class = void>
_LIBCPP_NODISCARD_EXT _LIBCPP_ALWAYS_INLINE inline _LIBCPP_HIDE_FROM_ABI wstring
vformat(locale __loc, wstring_view __fmt, wformat_args __args) {
wstring __res;
- std::vformat_to(std::back_inserter(__res), std::move(__loc), __fmt,
- __args);
+ std::vformat_to(std::back_inserter(__res), std::move(__loc), __fmt, __args);
return __res;
}
# endif
@@ -615,23 +604,24 @@ vformat(locale __loc, wstring_view __fmt, wformat_args __args) {
template <class... _Args>
_LIBCPP_NODISCARD_EXT _LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI string
format(locale __loc, format_string<_Args...> __fmt, _Args&&... __args) {
- return std::vformat(std::move(__loc), __fmt.get(),
- std::make_format_args(__args...));
+ return std::vformat(std::move(__loc), __fmt.get(), std::make_format_args(__args...));
}
# ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
template <class... _Args>
_LIBCPP_NODISCARD_EXT _LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI wstring
format(locale __loc, wformat_string<_Args...> __fmt, _Args&&... __args) {
- return std::vformat(std::move(__loc), __fmt.get(),
- std::make_wformat_args(__args...));
+ return std::vformat(std::move(__loc), __fmt.get(), std::make_wformat_args(__args...));
}
# endif
template <class _Context, class _OutIt, class _CharT>
-_LIBCPP_HIDE_FROM_ABI format_to_n_result<_OutIt> __vformat_to_n(_OutIt __out_it, iter_difference_t<_OutIt> __n,
- locale __loc, basic_string_view<_CharT> __fmt,
- basic_format_args<_Context> __args) {
+_LIBCPP_HIDE_FROM_ABI format_to_n_result<_OutIt> __vformat_to_n(
+ _OutIt __out_it,
+ iter_difference_t<_OutIt> __n,
+ locale __loc,
+ basic_string_view<_CharT> __fmt,
+ basic_format_args<_Context> __args) {
__format::__format_to_n_buffer<_OutIt, _CharT> __buffer{std::move(__out_it), __n};
std::__format::__vformat_to(
basic_format_parse_context{__fmt, __args.__size()},
@@ -640,22 +630,20 @@ _LIBCPP_HIDE_FROM_ABI format_to_n_result<_OutIt> __vformat_to_n(_OutIt __out_it,
}
template <output_iterator<const char&> _OutIt, class... _Args>
-_LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI format_to_n_result<_OutIt>
-format_to_n(_OutIt __out_it, iter_difference_t<_OutIt> __n, locale __loc, format_string<_Args...> __fmt,
- _Args&&... __args) {
- return std::__vformat_to_n<format_context>(std::move(__out_it), __n, std::move(__loc), __fmt.get(),
- std::make_format_args(__args...));
+_LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI format_to_n_result<_OutIt> format_to_n(
+ _OutIt __out_it, iter_difference_t<_OutIt> __n, locale __loc, format_string<_Args...> __fmt, _Args&&... __args) {
+ return std::__vformat_to_n<format_context>(
+ std::move(__out_it), __n, std::move(__loc), __fmt.get(), std::make_format_args(__args...));
}
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+# ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
template <output_iterator<const wchar_t&> _OutIt, class... _Args>
-_LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI format_to_n_result<_OutIt>
-format_to_n(_OutIt __out_it, iter_difference_t<_OutIt> __n, locale __loc, wformat_string<_Args...> __fmt,
- _Args&&... __args) {
- return std::__vformat_to_n<wformat_context>(std::move(__out_it), __n, std::move(__loc), __fmt.get(),
- std::make_wformat_args(__args...));
+_LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI format_to_n_result<_OutIt> format_to_n(
+ _OutIt __out_it, iter_difference_t<_OutIt> __n, locale __loc, wformat_string<_Args...> __fmt, _Args&&... __args) {
+ return std::__vformat_to_n<wformat_context>(
+ std::move(__out_it), __n, std::move(__loc), __fmt.get(), std::make_wformat_args(__args...));
}
-#endif
+# endif
template <class _CharT>
_LIBCPP_HIDE_FROM_ABI size_t __vformatted_size(locale __loc, basic_string_view<_CharT> __fmt, auto __args) {
diff --git a/contrib/llvm-project/libcxx/include/__format/format_parse_context.h b/contrib/llvm-project/libcxx/include/__format/format_parse_context.h
index 79f53f77d4a0..aefcd5497f3b 100644
--- a/contrib/llvm-project/libcxx/include/__format/format_parse_context.h
+++ b/contrib/llvm-project/libcxx/include/__format/format_parse_context.h
@@ -26,32 +26,24 @@ _LIBCPP_BEGIN_NAMESPACE_STD
template <class _CharT>
class _LIBCPP_TEMPLATE_VIS basic_format_parse_context {
public:
- using char_type = _CharT;
+ using char_type = _CharT;
using const_iterator = typename basic_string_view<_CharT>::const_iterator;
- using iterator = const_iterator;
+ using iterator = const_iterator;
- _LIBCPP_HIDE_FROM_ABI
- constexpr explicit basic_format_parse_context(basic_string_view<_CharT> __fmt,
- size_t __num_args = 0) noexcept
+ _LIBCPP_HIDE_FROM_ABI constexpr explicit basic_format_parse_context(
+ basic_string_view<_CharT> __fmt, size_t __num_args = 0) noexcept
: __begin_(__fmt.begin()),
__end_(__fmt.end()),
__indexing_(__unknown),
__next_arg_id_(0),
__num_args_(__num_args) {}
- basic_format_parse_context(const basic_format_parse_context&) = delete;
- basic_format_parse_context&
- operator=(const basic_format_parse_context&) = delete;
+ basic_format_parse_context(const basic_format_parse_context&) = delete;
+ basic_format_parse_context& operator=(const basic_format_parse_context&) = delete;
- _LIBCPP_HIDE_FROM_ABI constexpr const_iterator begin() const noexcept {
- return __begin_;
- }
- _LIBCPP_HIDE_FROM_ABI constexpr const_iterator end() const noexcept {
- return __end_;
- }
- _LIBCPP_HIDE_FROM_ABI constexpr void advance_to(const_iterator __it) {
- __begin_ = __it;
- }
+ _LIBCPP_HIDE_FROM_ABI constexpr const_iterator begin() const noexcept { return __begin_; }
+ _LIBCPP_HIDE_FROM_ABI constexpr const_iterator end() const noexcept { return __end_; }
+ _LIBCPP_HIDE_FROM_ABI constexpr void advance_to(const_iterator __it) { __begin_ = __it; }
_LIBCPP_HIDE_FROM_ABI constexpr size_t next_arg_id() {
if (__indexing_ == __manual)
@@ -102,9 +94,9 @@ private:
_LIBCPP_CTAD_SUPPORTED_FOR_TYPE(basic_format_parse_context);
using format_parse_context = basic_format_parse_context<char>;
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+# ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
using wformat_parse_context = basic_format_parse_context<wchar_t>;
-#endif
+# endif
#endif //_LIBCPP_STD_VER >= 20
diff --git a/contrib/llvm-project/libcxx/include/__format/format_string.h b/contrib/llvm-project/libcxx/include/__format/format_string.h
index 2e1c71b3d01b..bdf3cff7f49b 100644
--- a/contrib/llvm-project/libcxx/include/__format/format_string.h
+++ b/contrib/llvm-project/libcxx/include/__format/format_string.h
@@ -38,8 +38,7 @@ template <contiguous_iterator _Iterator>
__parse_number_result(_Iterator, uint32_t) -> __parse_number_result<_Iterator>;
template <contiguous_iterator _Iterator>
-_LIBCPP_HIDE_FROM_ABI constexpr __parse_number_result<_Iterator>
-__parse_number(_Iterator __begin, _Iterator __end);
+_LIBCPP_HIDE_FROM_ABI constexpr __parse_number_result<_Iterator> __parse_number(_Iterator __begin, _Iterator __end);
/**
* The maximum value of a numeric argument.
@@ -66,9 +65,7 @@ template <contiguous_iterator _Iterator>
_LIBCPP_HIDE_FROM_ABI constexpr __parse_number_result<_Iterator>
__parse_automatic(_Iterator __begin, _Iterator, auto& __parse_ctx) {
size_t __value = __parse_ctx.next_arg_id();
- _LIBCPP_ASSERT_UNCATEGORIZED(
- __value <= __number_max,
- "Compilers don't support this number of arguments");
+ _LIBCPP_ASSERT_UNCATEGORIZED(__value <= __number_max, "Compilers don't support this number of arguments");
return {__begin, uint32_t(__value)};
}
@@ -93,8 +90,7 @@ template <contiguous_iterator _Iterator>
_LIBCPP_HIDE_FROM_ABI constexpr __parse_number_result<_Iterator>
__parse_number(_Iterator __begin, _Iterator __end_input) {
using _CharT = iter_value_t<_Iterator>;
- static_assert(__format::__number_max == INT32_MAX,
- "The algorithm is implemented based on this value.");
+ static_assert(__format::__number_max == INT32_MAX, "The algorithm is implemented based on this value.");
/*
* Limit the input to 9 digits, otherwise we need two checks during every
* iteration:
@@ -102,7 +98,7 @@ __parse_number(_Iterator __begin, _Iterator __end_input) {
* - Does the value exceed width of an uint32_t? (Switching to uint64_t would
* have the same issue, but with a higher maximum.)
*/
- _Iterator __end = __end_input - __begin > 9 ? __begin + 9 : __end_input;
+ _Iterator __end = __end_input - __begin > 9 ? __begin + 9 : __end_input;
uint32_t __value = *__begin - _CharT('0');
while (++__begin != __end) {
if (*__begin < _CharT('0') || *__begin > _CharT('9'))
@@ -111,9 +107,7 @@ __parse_number(_Iterator __begin, _Iterator __end_input) {
__value = __value * 10 + *__begin - _CharT('0');
}
- if (__begin != __end_input && *__begin >= _CharT('0') &&
- *__begin <= _CharT('9')) {
-
+ if (__begin != __end_input && *__begin >= _CharT('0') && *__begin <= _CharT('9')) {
/*
* There are more than 9 digits, do additional validations:
* - Does the 10th digit exceed the maximum allowed value?
@@ -121,9 +115,7 @@ __parse_number(_Iterator __begin, _Iterator __end_input) {
* (More than 10 digits always overflows the maximum.)
*/
uint64_t __v = uint64_t(__value) * 10 + *__begin++ - _CharT('0');
- if (__v > __number_max ||
- (__begin != __end_input && *__begin >= _CharT('0') &&
- *__begin <= _CharT('9')))
+ if (__v > __number_max || (__begin != __end_input && *__begin >= _CharT('0') && *__begin <= _CharT('9')))
std::__throw_format_error("The numeric value of the format specifier is too large");
__value = __v;
diff --git a/contrib/llvm-project/libcxx/include/__format/formatter.h b/contrib/llvm-project/libcxx/include/__format/formatter.h
index 172b2d5f7b8a..079befc5bd9c 100644
--- a/contrib/llvm-project/libcxx/include/__format/formatter.h
+++ b/contrib/llvm-project/libcxx/include/__format/formatter.h
@@ -33,8 +33,8 @@ _LIBCPP_BEGIN_NAMESPACE_STD
/// - is_move_assignable<F>.
template <class _Tp, class _CharT>
struct _LIBCPP_TEMPLATE_VIS formatter {
- formatter() = delete;
- formatter(const formatter&) = delete;
+ formatter() = delete;
+ formatter(const formatter&) = delete;
formatter& operator=(const formatter&) = delete;
};
diff --git a/contrib/llvm-project/libcxx/include/__format/formatter_floating_point.h b/contrib/llvm-project/libcxx/include/__format/formatter_floating_point.h
index b45c2a6ebd39..33cc2a4ed661 100644
--- a/contrib/llvm-project/libcxx/include/__format/formatter_floating_point.h
+++ b/contrib/llvm-project/libcxx/include/__format/formatter_floating_point.h
@@ -116,8 +116,8 @@ _LIBCPP_HIDE_FROM_ABI constexpr size_t __float_buffer_size(int __precision) {
template <>
struct __traits<float> {
- static constexpr int __max_integral = 38;
- static constexpr int __max_fractional = 149;
+ static constexpr int __max_integral = 38;
+ static constexpr int __max_fractional = 149;
static constexpr int __max_fractional_value = 3;
static constexpr size_t __stack_buffer_size = 256;
@@ -126,8 +126,8 @@ struct __traits<float> {
template <>
struct __traits<double> {
- static constexpr int __max_integral = 308;
- static constexpr int __max_fractional = 1074;
+ static constexpr int __max_integral = 308;
+ static constexpr int __max_fractional = 1074;
static constexpr int __max_fractional_value = 4;
static constexpr size_t __stack_buffer_size = 1024;
@@ -153,7 +153,6 @@ public:
// required.
explicit _LIBCPP_HIDE_FROM_ABI __float_buffer(int __precision)
: __precision_(__precision != -1 ? __precision : _Traits::__max_fractional) {
-
// When the precision is larger than _Traits::__max_fractional the digits in
// the range (_Traits::__max_fractional, precision] will contain the value
// zero. There's no need to request to_chars to write these zeros:
@@ -165,7 +164,7 @@ public:
// to be converted from a char to a wchar_t.
if (__precision_ > _Traits::__max_fractional) {
__num_trailing_zeros_ = __precision_ - _Traits::__max_fractional;
- __precision_ = _Traits::__max_fractional;
+ __precision_ = _Traits::__max_fractional;
}
__size_ = __formatter::__float_buffer_size<_Fp>(__precision_);
@@ -180,7 +179,7 @@ public:
if (__size_ > _Traits::__stack_buffer_size)
allocator<char>{}.deallocate(__begin_, __size_);
}
- _LIBCPP_HIDE_FROM_ABI __float_buffer(const __float_buffer&) = delete;
+ _LIBCPP_HIDE_FROM_ABI __float_buffer(const __float_buffer&) = delete;
_LIBCPP_HIDE_FROM_ABI __float_buffer& operator=(const __float_buffer&) = delete;
_LIBCPP_HIDE_FROM_ABI char* begin() const { return __begin_; }
@@ -234,8 +233,8 @@ constexpr inline _LIBCPP_HIDE_FROM_ABI char* __find_exponent(char* __first, char
}
template <class _Fp, class _Tp>
-_LIBCPP_HIDE_FROM_ABI __float_result __format_buffer_default(const __float_buffer<_Fp>& __buffer, _Tp __value,
- char* __integral) {
+_LIBCPP_HIDE_FROM_ABI __float_result
+__format_buffer_default(const __float_buffer<_Fp>& __buffer, _Tp __value, char* __integral) {
__float_result __result;
__result.__integral = __integral;
__result.__last = __formatter::__to_buffer(__integral, __buffer.end(), __value);
@@ -263,9 +262,8 @@ _LIBCPP_HIDE_FROM_ABI __float_result __format_buffer_default(const __float_buffe
}
template <class _Fp, class _Tp>
-_LIBCPP_HIDE_FROM_ABI __float_result __format_buffer_hexadecimal_lower_case(const __float_buffer<_Fp>& __buffer,
- _Tp __value, int __precision,
- char* __integral) {
+_LIBCPP_HIDE_FROM_ABI __float_result __format_buffer_hexadecimal_lower_case(
+ const __float_buffer<_Fp>& __buffer, _Tp __value, int __precision, char* __integral) {
__float_result __result;
__result.__integral = __integral;
if (__precision == -1)
@@ -297,12 +295,12 @@ _LIBCPP_HIDE_FROM_ABI __float_result __format_buffer_hexadecimal_lower_case(cons
// 0123456789
static_assert(__traits<_Fp>::__hex_precision_digits <= 4, "Guard against possible underflow.");
- char* __last = __result.__last - 2;
- __first = __last - __traits<_Fp>::__hex_precision_digits;
+ char* __last = __result.__last - 2;
+ __first = __last - __traits<_Fp>::__hex_precision_digits;
__result.__exponent = std::find(__first, __last, 'p');
} else {
__result.__radix_point = __result.__last;
- __result.__exponent = __first;
+ __result.__exponent = __first;
}
// clang-format off
@@ -316,9 +314,8 @@ _LIBCPP_HIDE_FROM_ABI __float_result __format_buffer_hexadecimal_lower_case(cons
}
template <class _Fp, class _Tp>
-_LIBCPP_HIDE_FROM_ABI __float_result __format_buffer_hexadecimal_upper_case(const __float_buffer<_Fp>& __buffer,
- _Tp __value, int __precision,
- char* __integral) {
+_LIBCPP_HIDE_FROM_ABI __float_result __format_buffer_hexadecimal_upper_case(
+ const __float_buffer<_Fp>& __buffer, _Tp __value, int __precision, char* __integral) {
__float_result __result =
__formatter::__format_buffer_hexadecimal_lower_case(__buffer, __value, __precision, __integral);
std::transform(__result.__integral, __result.__exponent, __result.__integral, __hex_to_upper);
@@ -327,9 +324,8 @@ _LIBCPP_HIDE_FROM_ABI __float_result __format_buffer_hexadecimal_upper_case(cons
}
template <class _Fp, class _Tp>
-_LIBCPP_HIDE_FROM_ABI __float_result __format_buffer_scientific_lower_case(const __float_buffer<_Fp>& __buffer,
- _Tp __value, int __precision,
- char* __integral) {
+_LIBCPP_HIDE_FROM_ABI __float_result __format_buffer_scientific_lower_case(
+ const __float_buffer<_Fp>& __buffer, _Tp __value, int __precision, char* __integral) {
__float_result __result;
__result.__integral = __integral;
__result.__last =
@@ -342,7 +338,7 @@ _LIBCPP_HIDE_FROM_ABI __float_result __format_buffer_scientific_lower_case(const
__result.__exponent = __formatter::__find_exponent(__first + 1, __result.__last);
} else {
__result.__radix_point = __result.__last;
- __result.__exponent = __first;
+ __result.__exponent = __first;
}
// clang-format off
@@ -355,9 +351,8 @@ _LIBCPP_HIDE_FROM_ABI __float_result __format_buffer_scientific_lower_case(const
}
template <class _Fp, class _Tp>
-_LIBCPP_HIDE_FROM_ABI __float_result __format_buffer_scientific_upper_case(const __float_buffer<_Fp>& __buffer,
- _Tp __value, int __precision,
- char* __integral) {
+_LIBCPP_HIDE_FROM_ABI __float_result __format_buffer_scientific_upper_case(
+ const __float_buffer<_Fp>& __buffer, _Tp __value, int __precision, char* __integral) {
__float_result __result =
__formatter::__format_buffer_scientific_lower_case(__buffer, __value, __precision, __integral);
*__result.__exponent = 'E';
@@ -365,8 +360,8 @@ _LIBCPP_HIDE_FROM_ABI __float_result __format_buffer_scientific_upper_case(const
}
template <class _Fp, class _Tp>
-_LIBCPP_HIDE_FROM_ABI __float_result __format_buffer_fixed(const __float_buffer<_Fp>& __buffer, _Tp __value,
- int __precision, char* __integral) {
+_LIBCPP_HIDE_FROM_ABI __float_result
+__format_buffer_fixed(const __float_buffer<_Fp>& __buffer, _Tp __value, int __precision, char* __integral) {
__float_result __result;
__result.__integral = __integral;
__result.__last = __formatter::__to_buffer(__integral, __buffer.end(), __value, chars_format::fixed, __precision);
@@ -376,7 +371,7 @@ _LIBCPP_HIDE_FROM_ABI __float_result __format_buffer_fixed(const __float_buffer<
// By converting __precision to a bool the subtraction can be done
// unconditionally.
__result.__radix_point = __result.__last - (__precision + bool(__precision));
- __result.__exponent = __result.__last;
+ __result.__exponent = __result.__last;
// clang-format off
_LIBCPP_ASSERT_UNCATEGORIZED((__result.__integral != __result.__last) &&
@@ -388,9 +383,8 @@ _LIBCPP_HIDE_FROM_ABI __float_result __format_buffer_fixed(const __float_buffer<
}
template <class _Fp, class _Tp>
-_LIBCPP_HIDE_FROM_ABI __float_result __format_buffer_general_lower_case(__float_buffer<_Fp>& __buffer, _Tp __value,
- int __precision, char* __integral) {
-
+_LIBCPP_HIDE_FROM_ABI __float_result
+__format_buffer_general_lower_case(__float_buffer<_Fp>& __buffer, _Tp __value, int __precision, char* __integral) {
__buffer.__remove_trailing_zeros();
__float_result __result;
@@ -400,7 +394,7 @@ _LIBCPP_HIDE_FROM_ABI __float_result __format_buffer_general_lower_case(__float_
char* __first = __integral + 1;
if (__first == __result.__last) {
__result.__radix_point = __result.__last;
- __result.__exponent = __result.__last;
+ __result.__exponent = __result.__last;
} else {
__result.__exponent = __formatter::__find_exponent(__first, __result.__last);
if (__result.__exponent != __result.__last)
@@ -426,8 +420,8 @@ _LIBCPP_HIDE_FROM_ABI __float_result __format_buffer_general_lower_case(__float_
}
template <class _Fp, class _Tp>
-_LIBCPP_HIDE_FROM_ABI __float_result __format_buffer_general_upper_case(__float_buffer<_Fp>& __buffer, _Tp __value,
- int __precision, char* __integral) {
+_LIBCPP_HIDE_FROM_ABI __float_result
+__format_buffer_general_upper_case(__float_buffer<_Fp>& __buffer, _Tp __value, int __precision, char* __integral) {
__float_result __result = __formatter::__format_buffer_general_lower_case(__buffer, __value, __precision, __integral);
if (__result.__exponent != __result.__last)
*__result.__exponent = 'E';
@@ -504,9 +498,9 @@ _LIBCPP_HIDE_FROM_ABI _OutIt __format_locale_specific_form(
const __float_result& __result,
std::locale __loc,
__format_spec::__parsed_specifications<_CharT> __specs) {
- const auto& __np = std::use_facet<numpunct<_CharT>>(__loc);
+ const auto& __np = std::use_facet<numpunct<_CharT>>(__loc);
string __grouping = __np.grouping();
- char* __first = __result.__integral;
+ char* __first = __result.__integral;
// When no radix point or exponent are present __last will be __result.__last.
char* __last = std::min(__result.__radix_point, __result.__exponent);
@@ -524,11 +518,11 @@ _LIBCPP_HIDE_FROM_ABI _OutIt __format_locale_specific_form(
__grouping.size() - // Grouping contains one
!__grouping.empty(); // additional character
- __formatter::__padding_size_result __padding = {0, 0};
- bool __zero_padding = __specs.__alignment_ == __format_spec::__alignment::__zero_padding;
+ __formatter::__padding_size_result __padding = {0, 0};
+ bool __zero_padding = __specs.__alignment_ == __format_spec::__alignment::__zero_padding;
if (__size < __specs.__width_) {
if (__zero_padding) {
- __specs.__alignment_ = __format_spec::__alignment::__right;
+ __specs.__alignment_ = __format_spec::__alignment::__right;
__specs.__fill_.__data[0] = _CharT('0');
}
@@ -546,8 +540,8 @@ _LIBCPP_HIDE_FROM_ABI _OutIt __format_locale_specific_form(
if (__grouping.empty()) {
__out_it = __formatter::__copy(__first, __digits, std::move(__out_it));
} else {
- auto __r = __grouping.rbegin();
- auto __e = __grouping.rend() - 1;
+ auto __r = __grouping.rbegin();
+ auto __e = __grouping.rend() - 1;
_CharT __sep = __np.thousands_sep();
// The output is divided in small groups of numbers to write:
// - A group before the first separator.
@@ -627,8 +621,8 @@ _LIBCPP_HIDE_FROM_ABI auto __write_using_trailing_zeros(
const _CharT* __exponent,
size_t __num_trailing_zeros) -> decltype(__out_it) {
_LIBCPP_ASSERT_UNCATEGORIZED(__first <= __last, "Not a valid range");
- _LIBCPP_ASSERT_UNCATEGORIZED(__num_trailing_zeros > 0,
- "The overload not writing trailing zeros should have been used");
+ _LIBCPP_ASSERT_UNCATEGORIZED(
+ __num_trailing_zeros > 0, "The overload not writing trailing zeros should have been used");
__padding_size_result __padding =
__formatter::__padding_size(__size + __num_trailing_zeros, __specs.__width_, __specs.__alignment_);
@@ -639,7 +633,6 @@ _LIBCPP_HIDE_FROM_ABI auto __write_using_trailing_zeros(
return __formatter::__fill(std::move(__out_it), __padding.__after_, __specs.__fill_);
}
-
template <floating_point _Tp, class _CharT, class _FormatContext>
_LIBCPP_HIDE_FROM_ABI typename _FormatContext::iterator
__format_floating_point(_Tp __value, _FormatContext& __ctx, __format_spec::__parsed_specifications<_CharT> __specs) {
@@ -743,7 +736,7 @@ __format_floating_point(_Tp __value, _FormatContext& __ctx, __format_spec::__par
*__out_it++ = *__first++;
// After the sign is written, zero padding is the same a right alignment
// with '0'.
- __specs.__alignment_ = __format_spec::__alignment::__right;
+ __specs.__alignment_ = __format_spec::__alignment::__right;
__specs.__fill_.__data[0] = _CharT('0');
}
@@ -775,14 +768,11 @@ public:
};
template <__fmt_char_type _CharT>
-struct _LIBCPP_TEMPLATE_VIS formatter<float, _CharT>
- : public __formatter_floating_point<_CharT> {};
+struct _LIBCPP_TEMPLATE_VIS formatter<float, _CharT> : public __formatter_floating_point<_CharT> {};
template <__fmt_char_type _CharT>
-struct _LIBCPP_TEMPLATE_VIS formatter<double, _CharT>
- : public __formatter_floating_point<_CharT> {};
+struct _LIBCPP_TEMPLATE_VIS formatter<double, _CharT> : public __formatter_floating_point<_CharT> {};
template <__fmt_char_type _CharT>
-struct _LIBCPP_TEMPLATE_VIS formatter<long double, _CharT>
- : public __formatter_floating_point<_CharT> {};
+struct _LIBCPP_TEMPLATE_VIS formatter<long double, _CharT> : public __formatter_floating_point<_CharT> {};
#endif //_LIBCPP_STD_VER >= 20
diff --git a/contrib/llvm-project/libcxx/include/__format/formatter_integer.h b/contrib/llvm-project/libcxx/include/__format/formatter_integer.h
index 5590bff5aa98..d57082b3881b 100644
--- a/contrib/llvm-project/libcxx/include/__format/formatter_integer.h
+++ b/contrib/llvm-project/libcxx/include/__format/formatter_integer.h
@@ -26,13 +26,12 @@
# pragma GCC system_header
#endif
- _LIBCPP_BEGIN_NAMESPACE_STD
+_LIBCPP_BEGIN_NAMESPACE_STD
#if _LIBCPP_STD_VER >= 20
- template <__fmt_char_type _CharT>
- struct _LIBCPP_TEMPLATE_VIS __formatter_integer {
-
+template <__fmt_char_type _CharT>
+struct _LIBCPP_TEMPLATE_VIS __formatter_integer {
public:
template <class _ParseContext>
_LIBCPP_HIDE_FROM_ABI constexpr typename _ParseContext::iterator parse(_ParseContext& __ctx) {
@@ -60,44 +59,34 @@ public:
// Signed integral types.
template <__fmt_char_type _CharT>
-struct _LIBCPP_TEMPLATE_VIS formatter<signed char, _CharT>
- : public __formatter_integer<_CharT> {};
+struct _LIBCPP_TEMPLATE_VIS formatter<signed char, _CharT> : public __formatter_integer<_CharT> {};
template <__fmt_char_type _CharT>
-struct _LIBCPP_TEMPLATE_VIS formatter<short, _CharT> : public __formatter_integer<_CharT> {
-};
+struct _LIBCPP_TEMPLATE_VIS formatter<short, _CharT> : public __formatter_integer<_CharT> {};
template <__fmt_char_type _CharT>
struct _LIBCPP_TEMPLATE_VIS formatter<int, _CharT> : public __formatter_integer<_CharT> {};
template <__fmt_char_type _CharT>
struct _LIBCPP_TEMPLATE_VIS formatter<long, _CharT> : public __formatter_integer<_CharT> {};
template <__fmt_char_type _CharT>
-struct _LIBCPP_TEMPLATE_VIS formatter<long long, _CharT>
- : public __formatter_integer<_CharT> {};
+struct _LIBCPP_TEMPLATE_VIS formatter<long long, _CharT> : public __formatter_integer<_CharT> {};
# ifndef _LIBCPP_HAS_NO_INT128
template <__fmt_char_type _CharT>
-struct _LIBCPP_TEMPLATE_VIS formatter<__int128_t, _CharT>
- : public __formatter_integer<_CharT> {};
+struct _LIBCPP_TEMPLATE_VIS formatter<__int128_t, _CharT> : public __formatter_integer<_CharT> {};
# endif
// Unsigned integral types.
template <__fmt_char_type _CharT>
-struct _LIBCPP_TEMPLATE_VIS formatter<unsigned char, _CharT>
- : public __formatter_integer<_CharT> {};
+struct _LIBCPP_TEMPLATE_VIS formatter<unsigned char, _CharT> : public __formatter_integer<_CharT> {};
template <__fmt_char_type _CharT>
-struct _LIBCPP_TEMPLATE_VIS formatter<unsigned short, _CharT>
- : public __formatter_integer<_CharT> {};
+struct _LIBCPP_TEMPLATE_VIS formatter<unsigned short, _CharT> : public __formatter_integer<_CharT> {};
template <__fmt_char_type _CharT>
-struct _LIBCPP_TEMPLATE_VIS formatter<unsigned, _CharT>
- : public __formatter_integer<_CharT> {};
+struct _LIBCPP_TEMPLATE_VIS formatter<unsigned, _CharT> : public __formatter_integer<_CharT> {};
template <__fmt_char_type _CharT>
-struct _LIBCPP_TEMPLATE_VIS formatter<unsigned long, _CharT>
- : public __formatter_integer<_CharT> {};
+struct _LIBCPP_TEMPLATE_VIS formatter<unsigned long, _CharT> : public __formatter_integer<_CharT> {};
template <__fmt_char_type _CharT>
-struct _LIBCPP_TEMPLATE_VIS formatter<unsigned long long, _CharT>
- : public __formatter_integer<_CharT> {};
+struct _LIBCPP_TEMPLATE_VIS formatter<unsigned long long, _CharT> : public __formatter_integer<_CharT> {};
# ifndef _LIBCPP_HAS_NO_INT128
template <__fmt_char_type _CharT>
-struct _LIBCPP_TEMPLATE_VIS formatter<__uint128_t, _CharT>
- : public __formatter_integer<_CharT> {};
+struct _LIBCPP_TEMPLATE_VIS formatter<__uint128_t, _CharT> : public __formatter_integer<_CharT> {};
# endif
#endif //_LIBCPP_STD_VER >= 20
diff --git a/contrib/llvm-project/libcxx/include/__format/formatter_integral.h b/contrib/llvm-project/libcxx/include/__format/formatter_integral.h
index 598decb0a95e..ca66e26ede10 100644
--- a/contrib/llvm-project/libcxx/include/__format/formatter_integral.h
+++ b/contrib/llvm-project/libcxx/include/__format/formatter_integral.h
@@ -20,6 +20,9 @@
#include <__format/format_error.h>
#include <__format/formatter_output.h>
#include <__format/parser_std_format_spec.h>
+#include <__iterator/concepts.h>
+#include <__iterator/iterator_traits.h>
+#include <__memory/pointer_traits.h>
#include <__system_error/errc.h>
#include <__type_traits/make_unsigned.h>
#include <__utility/unreachable.h>
@@ -49,7 +52,9 @@ namespace __formatter {
// Generic
//
-_LIBCPP_HIDE_FROM_ABI inline char* __insert_sign(char* __buf, bool __negative, __format_spec::__sign __sign) {
+template <contiguous_iterator _Iterator>
+ requires same_as<char, iter_value_t<_Iterator>>
+_LIBCPP_HIDE_FROM_ABI inline _Iterator __insert_sign(_Iterator __buf, bool __negative, __format_spec::__sign __sign) {
if (__negative)
*__buf++ = '-';
else
@@ -85,9 +90,10 @@ _LIBCPP_HIDE_FROM_ABI inline char* __insert_sign(char* __buf, bool __negative, _
* regardless whether the @c std::numpunct's type is @c char or @c wchar_t.
*/
_LIBCPP_HIDE_FROM_ABI inline string __determine_grouping(ptrdiff_t __size, const string& __grouping) {
- _LIBCPP_ASSERT_UNCATEGORIZED(!__grouping.empty() && __size > __grouping[0],
- "The slow grouping formatting is used while there will be no "
- "separators written");
+ _LIBCPP_ASSERT_UNCATEGORIZED(
+ !__grouping.empty() && __size > __grouping[0],
+ "The slow grouping formatting is used while there will be no "
+ "separators written");
string __r;
auto __end = __grouping.end() - 1;
auto __ptr = __grouping.begin();
@@ -119,10 +125,10 @@ _LIBCPP_HIDE_FROM_ABI inline string __determine_grouping(ptrdiff_t __size, const
//
template <__fmt_char_type _CharT>
-_LIBCPP_HIDE_FROM_ABI auto __format_char(
- integral auto __value,
- output_iterator<const _CharT&> auto __out_it,
- __format_spec::__parsed_specifications<_CharT> __specs) -> decltype(__out_it) {
+_LIBCPP_HIDE_FROM_ABI auto
+__format_char(integral auto __value,
+ output_iterator<const _CharT&> auto __out_it,
+ __format_spec::__parsed_specifications<_CharT> __specs) -> decltype(__out_it) {
using _Tp = decltype(__value);
if constexpr (!same_as<_CharT, _Tp>) {
// cmp_less and cmp_greater can't be used for character types.
@@ -148,14 +154,16 @@ _LIBCPP_HIDE_FROM_ABI auto __format_char(
// Integer
//
-/** Wrapper around @ref to_chars, returning the output pointer. */
-template <integral _Tp>
-_LIBCPP_HIDE_FROM_ABI char* __to_buffer(char* __first, char* __last, _Tp __value, int __base) {
+/** Wrapper around @ref to_chars, returning the output iterator. */
+template <contiguous_iterator _Iterator, integral _Tp>
+ requires same_as<char, iter_value_t<_Iterator>>
+_LIBCPP_HIDE_FROM_ABI _Iterator __to_buffer(_Iterator __first, _Iterator __last, _Tp __value, int __base) {
// TODO FMT Evaluate code overhead due to not calling the internal function
// directly. (Should be zero overhead.)
- to_chars_result __r = std::to_chars(__first, __last, __value, __base);
+ to_chars_result __r = std::to_chars(std::to_address(__first), std::to_address(__last), __value, __base);
_LIBCPP_ASSERT_UNCATEGORIZED(__r.ec == errc(0), "Internal buffer too small");
- return __r.ptr;
+ auto __diff = __r.ptr - std::to_address(__first);
+ return __first + __diff;
}
/**
@@ -203,10 +211,16 @@ consteval size_t __buffer_size() noexcept
+ 1; // Reserve space for the sign.
}
-template <class _OutIt, class _CharT>
-_LIBCPP_HIDE_FROM_ABI _OutIt __write_using_decimal_separators(_OutIt __out_it, const char* __begin, const char* __first,
- const char* __last, string&& __grouping, _CharT __sep,
- __format_spec::__parsed_specifications<_CharT> __specs) {
+template <class _OutIt, contiguous_iterator _Iterator, class _CharT>
+ requires same_as<char, iter_value_t<_Iterator>>
+_LIBCPP_HIDE_FROM_ABI _OutIt __write_using_decimal_separators(
+ _OutIt __out_it,
+ _Iterator __begin,
+ _Iterator __first,
+ _Iterator __last,
+ string&& __grouping,
+ _CharT __sep,
+ __format_spec::__parsed_specifications<_CharT> __specs) {
int __size = (__first - __begin) + // [sign][prefix]
(__last - __first) + // data
(__grouping.size() - 1); // number of separator characters
@@ -234,8 +248,10 @@ _LIBCPP_HIDE_FROM_ABI _OutIt __write_using_decimal_separators(_OutIt __out_it, c
auto __r = __grouping.rbegin();
auto __e = __grouping.rend() - 1;
- _LIBCPP_ASSERT_UNCATEGORIZED(__r != __e, "The slow grouping formatting is used while "
- "there will be no separators written.");
+ _LIBCPP_ASSERT_UNCATEGORIZED(
+ __r != __e,
+ "The slow grouping formatting is used while "
+ "there will be no separators written.");
// The output is divided in small groups of numbers to write:
// - A group before the first separator.
// - A separator and a group, repeated for the number of separators.
@@ -249,9 +265,9 @@ _LIBCPP_HIDE_FROM_ABI _OutIt __write_using_decimal_separators(_OutIt __out_it, c
// hoisting the invariant is worth the effort.
while (true) {
if (__specs.__std_.__type_ == __format_spec::__type::__hexadecimal_upper_case) {
- __last = __first + *__r;
+ __last = __first + *__r;
__out_it = __formatter::__transform(__first, __last, std::move(__out_it), __hex_to_upper);
- __first = __last;
+ __first = __last;
} else {
__out_it = __formatter::__copy(__first, *__r, std::move(__out_it));
__first += *__r;
@@ -267,24 +283,23 @@ _LIBCPP_HIDE_FROM_ABI _OutIt __write_using_decimal_separators(_OutIt __out_it, c
return __formatter::__fill(std::move(__out_it), __padding.__after_, __specs.__fill_);
}
-
-
-template <unsigned_integral _Tp, class _CharT, class _FormatContext>
+template <unsigned_integral _Tp, contiguous_iterator _Iterator, class _CharT, class _FormatContext>
+ requires same_as<char, iter_value_t<_Iterator>>
_LIBCPP_HIDE_FROM_ABI typename _FormatContext::iterator __format_integer(
_Tp __value,
_FormatContext& __ctx,
__format_spec::__parsed_specifications<_CharT> __specs,
bool __negative,
- char* __begin,
- char* __end,
+ _Iterator __begin,
+ _Iterator __end,
const char* __prefix,
int __base) {
- char* __first = __formatter::__insert_sign(__begin, __negative, __specs.__std_.__sign_);
+ _Iterator __first = __formatter::__insert_sign(__begin, __negative, __specs.__std_.__sign_);
if (__specs.__std_.__alternate_form_ && __prefix)
while (*__prefix)
*__first++ = *__prefix++;
- char* __last = __formatter::__to_buffer(__first, __end, __value, __base);
+ _Iterator __last = __formatter::__to_buffer(__first, __end, __value, __base);
# ifndef _LIBCPP_HAS_NO_LOCALIZATION
if (__specs.__std_.__locale_specific_form_) {
@@ -315,10 +330,10 @@ _LIBCPP_HIDE_FROM_ABI typename _FormatContext::iterator __format_integer(
// The zero padding is done like:
// - Write [sign][prefix]
// - Write data right aligned with '0' as fill character.
- __out_it = __formatter::__copy(__begin, __first, std::move(__out_it));
- __specs.__alignment_ = __format_spec::__alignment::__right;
+ __out_it = __formatter::__copy(__begin, __first, std::move(__out_it));
+ __specs.__alignment_ = __format_spec::__alignment::__right;
__specs.__fill_.__data[0] = _CharT('0');
- int32_t __size = __first - __begin;
+ int32_t __size = __first - __begin;
__specs.__width_ -= std::min(__size, __specs.__width_);
}
diff --git a/contrib/llvm-project/libcxx/include/__format/formatter_output.h b/contrib/llvm-project/libcxx/include/__format/formatter_output.h
index 2909fcd9baf1..31e06425703a 100644
--- a/contrib/llvm-project/libcxx/include/__format/formatter_output.h
+++ b/contrib/llvm-project/libcxx/include/__format/formatter_output.h
@@ -23,8 +23,9 @@
#include <__format/unicode.h>
#include <__iterator/back_insert_iterator.h>
#include <__iterator/concepts.h>
-#include <__iterator/iterator_traits.h> // iter_value_t
+#include <__iterator/iterator_traits.h>
#include <__memory/addressof.h>
+#include <__memory/pointer_traits.h>
#include <__utility/move.h>
#include <__utility/unreachable.h>
#include <cstddef>
@@ -101,8 +102,7 @@ _LIBCPP_HIDE_FROM_ABI auto __copy(basic_string_view<_CharT> __str, output_iterat
if constexpr (std::same_as<decltype(__out_it), std::back_insert_iterator<__format::__output_buffer<_OutCharT>>>) {
__out_it.__get_container()->__copy(__str);
return __out_it;
- } else if constexpr (std::same_as<decltype(__out_it),
- typename __format::__retarget_buffer<_OutCharT>::__iterator>) {
+ } else if constexpr (std::same_as<decltype(__out_it), typename __format::__retarget_buffer<_OutCharT>::__iterator>) {
__out_it.__buffer_->__copy(__str);
return __out_it;
} else {
@@ -110,33 +110,36 @@ _LIBCPP_HIDE_FROM_ABI auto __copy(basic_string_view<_CharT> __str, output_iterat
}
}
-template <__fmt_char_type _CharT, __fmt_char_type _OutCharT = _CharT>
-_LIBCPP_HIDE_FROM_ABI auto
-__copy(const _CharT* __first, const _CharT* __last, output_iterator<const _OutCharT&> auto __out_it)
+template <contiguous_iterator _Iterator,
+ __fmt_char_type _CharT = typename iterator_traits<_Iterator>::value_type,
+ __fmt_char_type _OutCharT = _CharT>
+_LIBCPP_HIDE_FROM_ABI auto __copy(_Iterator __first, _Iterator __last, output_iterator<const _OutCharT&> auto __out_it)
-> decltype(__out_it) {
return __formatter::__copy(basic_string_view{__first, __last}, std::move(__out_it));
}
-template <__fmt_char_type _CharT, __fmt_char_type _OutCharT = _CharT>
-_LIBCPP_HIDE_FROM_ABI auto __copy(const _CharT* __first, size_t __n, output_iterator<const _OutCharT&> auto __out_it)
+template <contiguous_iterator _Iterator,
+ __fmt_char_type _CharT = typename iterator_traits<_Iterator>::value_type,
+ __fmt_char_type _OutCharT = _CharT>
+_LIBCPP_HIDE_FROM_ABI auto __copy(_Iterator __first, size_t __n, output_iterator<const _OutCharT&> auto __out_it)
-> decltype(__out_it) {
- return __formatter::__copy(basic_string_view{__first, __n}, std::move(__out_it));
+ return __formatter::__copy(basic_string_view{std::to_address(__first), __n}, std::move(__out_it));
}
/// Transform wrapper.
///
/// This uses a "mass output function" of __format::__output_buffer when possible.
-template <__fmt_char_type _CharT, __fmt_char_type _OutCharT = _CharT, class _UnaryOperation>
-_LIBCPP_HIDE_FROM_ABI auto
-__transform(const _CharT* __first,
- const _CharT* __last,
- output_iterator<const _OutCharT&> auto __out_it,
- _UnaryOperation __operation) -> decltype(__out_it) {
+template <contiguous_iterator _Iterator,
+ __fmt_char_type _CharT = typename iterator_traits<_Iterator>::value_type,
+ __fmt_char_type _OutCharT = _CharT,
+ class _UnaryOperation>
+_LIBCPP_HIDE_FROM_ABI auto __transform(
+ _Iterator __first, _Iterator __last, output_iterator<const _OutCharT&> auto __out_it, _UnaryOperation __operation)
+ -> decltype(__out_it) {
if constexpr (std::same_as<decltype(__out_it), std::back_insert_iterator<__format::__output_buffer<_OutCharT>>>) {
__out_it.__get_container()->__transform(__first, __last, std::move(__operation));
return __out_it;
- } else if constexpr (std::same_as<decltype(__out_it),
- typename __format::__retarget_buffer<_OutCharT>::__iterator>) {
+ } else if constexpr (std::same_as<decltype(__out_it), typename __format::__retarget_buffer<_OutCharT>::__iterator>) {
__out_it.__buffer_->__transform(__first, __last, std::move(__operation));
return __out_it;
} else {
@@ -243,7 +246,7 @@ __write(_Iterator __first,
output_iterator<const iter_value_t<_Iterator>&> auto __out_it,
__format_spec::__parsed_specifications<_ParserCharT> __specs,
ptrdiff_t __size) -> decltype(__out_it) {
- _LIBCPP_ASSERT_UNCATEGORIZED(__first <= __last, "Not a valid range");
+ _LIBCPP_ASSERT_VALID_INPUT_RANGE(__first <= __last, "Not a valid range");
return __formatter::__write(basic_string_view{__first, __last}, std::move(__out_it), __specs, __size);
}
@@ -256,16 +259,21 @@ __write(_Iterator __first,
_Iterator __last,
output_iterator<const iter_value_t<_Iterator>&> auto __out_it,
__format_spec::__parsed_specifications<_ParserCharT> __specs) -> decltype(__out_it) {
- _LIBCPP_ASSERT_UNCATEGORIZED(__first <= __last, "Not a valid range");
+ _LIBCPP_ASSERT_VALID_INPUT_RANGE(__first <= __last, "Not a valid range");
return __formatter::__write(__first, __last, std::move(__out_it), __specs, __last - __first);
}
-template <class _CharT, class _ParserCharT, class _UnaryOperation>
-_LIBCPP_HIDE_FROM_ABI auto __write_transformed(const _CharT* __first, const _CharT* __last,
- output_iterator<const _CharT&> auto __out_it,
- __format_spec::__parsed_specifications<_ParserCharT> __specs,
- _UnaryOperation __op) -> decltype(__out_it) {
- _LIBCPP_ASSERT_UNCATEGORIZED(__first <= __last, "Not a valid range");
+template <contiguous_iterator _Iterator,
+ class _CharT = typename iterator_traits<_Iterator>::value_type,
+ class _ParserCharT,
+ class _UnaryOperation>
+_LIBCPP_HIDE_FROM_ABI auto __write_transformed(
+ _Iterator __first,
+ _Iterator __last,
+ output_iterator<const _CharT&> auto __out_it,
+ __format_spec::__parsed_specifications<_ParserCharT> __specs,
+ _UnaryOperation __op) -> decltype(__out_it) {
+ _LIBCPP_ASSERT_VALID_INPUT_RANGE(__first <= __last, "Not a valid range");
ptrdiff_t __size = __last - __first;
if (__size >= __specs.__width_)
diff --git a/contrib/llvm-project/libcxx/include/__format/formatter_pointer.h b/contrib/llvm-project/libcxx/include/__format/formatter_pointer.h
index a2212611df48..3373996ec3d5 100644
--- a/contrib/llvm-project/libcxx/include/__format/formatter_pointer.h
+++ b/contrib/llvm-project/libcxx/include/__format/formatter_pointer.h
@@ -60,14 +60,11 @@ public:
// - template<> struct formatter<void*, charT>;
// - template<> struct formatter<const void*, charT>;
template <__fmt_char_type _CharT>
-struct _LIBCPP_TEMPLATE_VIS formatter<nullptr_t, _CharT>
- : public __formatter_pointer<_CharT> {};
+struct _LIBCPP_TEMPLATE_VIS formatter<nullptr_t, _CharT> : public __formatter_pointer<_CharT> {};
template <__fmt_char_type _CharT>
-struct _LIBCPP_TEMPLATE_VIS formatter<void*, _CharT> : public __formatter_pointer<_CharT> {
-};
+struct _LIBCPP_TEMPLATE_VIS formatter<void*, _CharT> : public __formatter_pointer<_CharT> {};
template <__fmt_char_type _CharT>
-struct _LIBCPP_TEMPLATE_VIS formatter<const void*, _CharT>
- : public __formatter_pointer<_CharT> {};
+struct _LIBCPP_TEMPLATE_VIS formatter<const void*, _CharT> : public __formatter_pointer<_CharT> {};
#endif //_LIBCPP_STD_VER >= 20
diff --git a/contrib/llvm-project/libcxx/include/__format/formatter_string.h b/contrib/llvm-project/libcxx/include/__format/formatter_string.h
index ba64a64af80a..4ba5617a49c8 100644
--- a/contrib/llvm-project/libcxx/include/__format/formatter_string.h
+++ b/contrib/llvm-project/libcxx/include/__format/formatter_string.h
@@ -59,14 +59,15 @@ public:
// Formatter const char*.
template <__fmt_char_type _CharT>
-struct _LIBCPP_TEMPLATE_VIS formatter<const _CharT*, _CharT>
- : public __formatter_string<_CharT> {
+struct _LIBCPP_TEMPLATE_VIS formatter<const _CharT*, _CharT> : public __formatter_string<_CharT> {
using _Base = __formatter_string<_CharT>;
template <class _FormatContext>
_LIBCPP_HIDE_FROM_ABI typename _FormatContext::iterator format(const _CharT* __str, _FormatContext& __ctx) const {
- _LIBCPP_ASSERT_UNCATEGORIZED(__str, "The basic_format_arg constructor should have "
- "prevented an invalid pointer.");
+ _LIBCPP_ASSERT_UNCATEGORIZED(
+ __str,
+ "The basic_format_arg constructor should have "
+ "prevented an invalid pointer.");
__format_spec::__parsed_specifications<_CharT> __specs = _Base::__parser_.__get_parsed_std_specifications(__ctx);
# if _LIBCPP_STD_VER >= 23
@@ -98,8 +99,7 @@ struct _LIBCPP_TEMPLATE_VIS formatter<const _CharT*, _CharT>
// Formatter char*.
template <__fmt_char_type _CharT>
-struct _LIBCPP_TEMPLATE_VIS formatter<_CharT*, _CharT>
- : public formatter<const _CharT*, _CharT> {
+struct _LIBCPP_TEMPLATE_VIS formatter<_CharT*, _CharT> : public formatter<const _CharT*, _CharT> {
using _Base = formatter<const _CharT*, _CharT>;
template <class _FormatContext>
@@ -110,8 +110,7 @@ struct _LIBCPP_TEMPLATE_VIS formatter<_CharT*, _CharT>
// Formatter char[].
template <__fmt_char_type _CharT, size_t _Size>
-struct _LIBCPP_TEMPLATE_VIS formatter<_CharT[_Size], _CharT>
- : public __formatter_string<_CharT> {
+struct _LIBCPP_TEMPLATE_VIS formatter<_CharT[_Size], _CharT> : public __formatter_string<_CharT> {
using _Base = __formatter_string<_CharT>;
template <class _FormatContext>
@@ -137,8 +136,7 @@ struct _LIBCPP_TEMPLATE_VIS formatter<basic_string<_CharT, _Traits, _Allocator>,
// Formatter std::string_view.
template <__fmt_char_type _CharT, class _Traits>
-struct _LIBCPP_TEMPLATE_VIS formatter<basic_string_view<_CharT, _Traits>, _CharT>
- : public __formatter_string<_CharT> {
+struct _LIBCPP_TEMPLATE_VIS formatter<basic_string_view<_CharT, _Traits>, _CharT> : public __formatter_string<_CharT> {
using _Base = __formatter_string<_CharT>;
template <class _FormatContext>
diff --git a/contrib/llvm-project/libcxx/include/__format/parser_std_format_spec.h b/contrib/llvm-project/libcxx/include/__format/parser_std_format_spec.h
index ea5dfdf30511..e38729db965c 100644
--- a/contrib/llvm-project/libcxx/include/__format/parser_std_format_spec.h
+++ b/contrib/llvm-project/libcxx/include/__format/parser_std_format_spec.h
@@ -82,8 +82,7 @@ __parse_arg_id(_Iterator __begin, _Iterator __end, _ParseContext& __ctx) {
}
template <class _Context>
-_LIBCPP_HIDE_FROM_ABI constexpr uint32_t
-__substitute_arg_id(basic_format_arg<_Context> __format_arg) {
+_LIBCPP_HIDE_FROM_ABI constexpr uint32_t __substitute_arg_id(basic_format_arg<_Context> __format_arg) {
// [format.string.std]/8
// If the corresponding formatting argument is not of integral type...
// This wording allows char and bool too. LWG-3720 changes the wording to
@@ -240,22 +239,22 @@ inline constexpr uint32_t __type_mask_integer =
__create_type_mask(__type::__hexadecimal_upper_case);
struct __std {
- __alignment __alignment_ : 3;
- __sign __sign_ : 2;
- bool __alternate_form_ : 1;
+ __alignment __alignment_ : 3;
+ __sign __sign_ : 2;
+ bool __alternate_form_ : 1;
bool __locale_specific_form_ : 1;
__type __type_;
};
struct __chrono {
- __alignment __alignment_ : 3;
+ __alignment __alignment_ : 3;
bool __locale_specific_form_ : 1;
bool __hour_ : 1;
- bool __weekday_name_ : 1;
+ bool __weekday_name_ : 1;
bool __weekday_ : 1;
bool __day_of_year_ : 1;
bool __week_of_year_ : 1;
- bool __month_name_ : 1;
+ bool __month_name_ : 1;
};
// The fill UCS scalar value.
@@ -495,8 +494,7 @@ public:
}
/// \returns the `__parsed_specifications` with the resolved dynamic sizes..
- _LIBCPP_HIDE_FROM_ABI
- __parsed_specifications<_CharT> __get_parsed_std_specifications(auto& __ctx) const {
+ _LIBCPP_HIDE_FROM_ABI __parsed_specifications<_CharT> __get_parsed_std_specifications(auto& __ctx) const {
return __parsed_specifications<_CharT>{
.__std_ = __std{.__alignment_ = __alignment_,
.__sign_ = __sign_,
@@ -524,9 +522,9 @@ public:
.__fill_{__fill_}};
}
- __alignment __alignment_ : 3 {__alignment::__default};
- __sign __sign_ : 2 {__sign::__default};
- bool __alternate_form_ : 1 {false};
+ __alignment __alignment_ : 3 {__alignment::__default};
+ __sign __sign_ : 2 {__sign::__default};
+ bool __alternate_form_ : 1 {false};
bool __locale_specific_form_ : 1 {false};
bool __clear_brackets_ : 1 {false};
__type __type_{__type::__default};
@@ -547,7 +545,7 @@ public:
uint8_t __reserved_1_ : 6 {0};
// These two flags are only used internally and not part of the
// __parsed_specifications. Therefore put them at the end.
- bool __width_as_arg_ : 1 {false};
+ bool __width_as_arg_ : 1 {false};
bool __precision_as_arg_ : 1 {false};
/// The requested width, either the value or the arg-id.
@@ -593,9 +591,10 @@ private:
|| (same_as<_CharT, wchar_t> && sizeof(wchar_t) == 2)
# endif
_LIBCPP_HIDE_FROM_ABI constexpr bool __parse_fill_align(_Iterator& __begin, _Iterator __end, bool __use_range_fill) {
- _LIBCPP_ASSERT_UNCATEGORIZED(__begin != __end,
- "when called with an empty input the function will cause "
- "undefined behavior by evaluating data not in the input");
+ _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
+ __begin != __end,
+ "when called with an empty input the function will cause "
+ "undefined behavior by evaluating data not in the input");
__unicode::__code_point_view<_CharT> __view{__begin, __end};
__unicode::__consume_result __consumed = __view.__consume();
if (__consumed.__status != __unicode::__consume_result::__ok)
@@ -625,9 +624,10 @@ private:
template <contiguous_iterator _Iterator>
requires(same_as<_CharT, wchar_t> && sizeof(wchar_t) == 4)
_LIBCPP_HIDE_FROM_ABI constexpr bool __parse_fill_align(_Iterator& __begin, _Iterator __end, bool __use_range_fill) {
- _LIBCPP_ASSERT_UNCATEGORIZED(__begin != __end,
- "when called with an empty input the function will cause "
- "undefined behavior by evaluating data not in the input");
+ _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
+ __begin != __end,
+ "when called with an empty input the function will cause "
+ "undefined behavior by evaluating data not in the input");
if (__begin + 1 != __end && __parse_alignment(*(__begin + 1))) {
if (!__unicode::__is_scalar_value(*__begin))
std::__throw_format_error("The fill option contains an invalid value");
@@ -652,9 +652,10 @@ private:
// range-fill and tuple-fill are identical
template <contiguous_iterator _Iterator>
_LIBCPP_HIDE_FROM_ABI constexpr bool __parse_fill_align(_Iterator& __begin, _Iterator __end, bool __use_range_fill) {
- _LIBCPP_ASSERT_UNCATEGORIZED(__begin != __end,
- "when called with an empty input the function will cause "
- "undefined behavior by evaluating data not in the input");
+ _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
+ __begin != __end,
+ "when called with an empty input the function will cause "
+ "undefined behavior by evaluating data not in the input");
if (__begin + 1 != __end) {
if (__parse_alignment(*(__begin + 1))) {
__validate_fill_character(*__begin, __use_range_fill);
@@ -721,9 +722,9 @@ private:
if (*__begin == _CharT('{')) {
__format::__parse_number_result __r = __format_spec::__parse_arg_id(++__begin, __end, __ctx);
- __width_as_arg_ = true;
- __width_ = __r.__value;
- __begin = __r.__last;
+ __width_as_arg_ = true;
+ __width_ = __r.__value;
+ __begin = __r.__last;
return true;
}
@@ -731,9 +732,11 @@ private:
return false;
__format::__parse_number_result __r = __format::__parse_number(__begin, __end);
- __width_ = __r.__value;
- _LIBCPP_ASSERT_UNCATEGORIZED(__width_ != 0, "A zero value isn't allowed and should be impossible, "
- "due to validations in this function");
+ __width_ = __r.__value;
+ _LIBCPP_ASSERT_UNCATEGORIZED(
+ __width_ != 0,
+ "A zero value isn't allowed and should be impossible, "
+ "due to validations in this function");
__begin = __r.__last;
return true;
}
@@ -749,9 +752,9 @@ private:
if (*__begin == _CharT('{')) {
__format::__parse_number_result __arg_id = __format_spec::__parse_arg_id(++__begin, __end, __ctx);
- __precision_as_arg_ = true;
- __precision_ = __arg_id.__value;
- __begin = __arg_id.__last;
+ __precision_as_arg_ = true;
+ __precision_ = __arg_id.__value;
+ __begin = __arg_id.__last;
return true;
}
@@ -759,9 +762,9 @@ private:
std::__throw_format_error("The precision option does not contain a value or an argument index");
__format::__parse_number_result __r = __format::__parse_number(__begin, __end);
- __precision_ = __r.__value;
- __precision_as_arg_ = false;
- __begin = __r.__last;
+ __precision_ = __r.__value;
+ __precision_as_arg_ = false;
+ __begin = __r.__last;
return true;
}
@@ -858,16 +861,14 @@ private:
++__begin;
}
- _LIBCPP_HIDE_FROM_ABI
- int32_t __get_width(auto& __ctx) const {
+ _LIBCPP_HIDE_FROM_ABI int32_t __get_width(auto& __ctx) const {
if (!__width_as_arg_)
return __width_;
return __format_spec::__substitute_arg_id(__ctx.arg(__width_));
}
- _LIBCPP_HIDE_FROM_ABI
- int32_t __get_precision(auto& __ctx) const {
+ _LIBCPP_HIDE_FROM_ABI int32_t __get_precision(auto& __ctx) const {
if (!__precision_as_arg_)
return __precision_;
diff --git a/contrib/llvm-project/libcxx/include/__format/unicode.h b/contrib/llvm-project/libcxx/include/__format/unicode.h
index 8666f80c78a2..8e1e7bb192a0 100644
--- a/contrib/llvm-project/libcxx/include/__format/unicode.h
+++ b/contrib/llvm-project/libcxx/include/__format/unicode.h
@@ -319,9 +319,8 @@ _LIBCPP_HIDE_FROM_ABI constexpr bool __at_extended_grapheme_cluster_break(
return true;
// *** Do not break Hangul syllable sequences. ***
- if (__prev == __property::__L &&
- (__next == __property::__L || __next == __property::__V || __next == __property::__LV ||
- __next == __property::__LVT)) // GB6
+ if (__prev == __property::__L && (__next == __property::__L || __next == __property::__V ||
+ __next == __property::__LV || __next == __property::__LVT)) // GB6
return false;
if ((__prev == __property::__LV || __prev == __property::__V) &&
@@ -402,9 +401,8 @@ public:
};
_LIBCPP_HIDE_FROM_ABI constexpr __cluster __consume() {
- _LIBCPP_ASSERT_UNCATEGORIZED(
- __next_prop_ != __extended_grapheme_custer_property_boundary::__property::__eot,
- "can't move beyond the end of input");
+ _LIBCPP_ASSERT_UNCATEGORIZED(__next_prop_ != __extended_grapheme_custer_property_boundary::__property::__eot,
+ "can't move beyond the end of input");
char32_t __code_point = __next_code_point_;
if (!__code_point_view_.__at_end())
diff --git a/contrib/llvm-project/libcxx/include/__format/write_escaped.h b/contrib/llvm-project/libcxx/include/__format/write_escaped.h
index 51bae3cb238f..15141eebc029 100644
--- a/contrib/llvm-project/libcxx/include/__format/write_escaped.h
+++ b/contrib/llvm-project/libcxx/include/__format/write_escaped.h
@@ -32,7 +32,6 @@
_LIBCPP_BEGIN_NAMESPACE_STD
-
namespace __formatter {
#if _LIBCPP_STD_VER >= 20
@@ -42,10 +41,10 @@ namespace __formatter {
/// \note When \c _LIBCPP_HAS_NO_UNICODE is defined the function assumes the
/// input is ASCII.
template <class _CharT>
-_LIBCPP_HIDE_FROM_ABI auto __write_string(
- basic_string_view<_CharT> __str,
- output_iterator<const _CharT&> auto __out_it,
- __format_spec::__parsed_specifications<_CharT> __specs) -> decltype(__out_it) {
+_LIBCPP_HIDE_FROM_ABI auto
+__write_string(basic_string_view<_CharT> __str,
+ output_iterator<const _CharT&> auto __out_it,
+ __format_spec::__parsed_specifications<_CharT> __specs) -> decltype(__out_it) {
if (!__specs.__has_precision())
return __formatter::__write_string_no_precision(__str, std::move(__out_it), __specs);
@@ -54,8 +53,8 @@ _LIBCPP_HIDE_FROM_ABI auto __write_string(
return __formatter::__write(__str.begin(), __str.end(), std::move(__out_it), __specs, __size);
}
-# endif // _LIBCPP_STD_VER >= 20
-# if _LIBCPP_STD_VER >= 23
+#endif // _LIBCPP_STD_VER >= 20
+#if _LIBCPP_STD_VER >= 23
struct __nul_terminator {};
@@ -100,11 +99,11 @@ _LIBCPP_HIDE_FROM_ABI void __write_escape_ill_formed_code_unit(basic_string<_Cha
template <class _CharT>
[[nodiscard]] _LIBCPP_HIDE_FROM_ABI bool __is_escaped_sequence_written(basic_string<_CharT>& __str, char32_t __value) {
-# ifdef _LIBCPP_HAS_NO_UNICODE
+# ifdef _LIBCPP_HAS_NO_UNICODE
// For ASCII assume everything above 127 is printable.
if (__value > 127)
return false;
-# endif
+# endif
if (!__escaped_output_table::__needs_escape(__value))
return false;
@@ -213,7 +212,7 @@ __format_escaped_string(basic_string_view<_CharT> __values,
return __formatter::__write_string(basic_string_view{__str}, std::move(__out_it), __specs);
}
-# endif // _LIBCPP_STD_VER >= 23
+#endif // _LIBCPP_STD_VER >= 23
} // namespace __formatter
diff --git a/contrib/llvm-project/libcxx/include/__functional/binary_function.h b/contrib/llvm-project/libcxx/include/__functional/binary_function.h
index fdedb8b177da..ddee3b170311 100644
--- a/contrib/llvm-project/libcxx/include/__functional/binary_function.h
+++ b/contrib/llvm-project/libcxx/include/__functional/binary_function.h
@@ -21,20 +21,20 @@ _LIBCPP_BEGIN_NAMESPACE_STD
#if _LIBCPP_STD_VER <= 14 || defined(_LIBCPP_ENABLE_CXX17_REMOVED_UNARY_BINARY_FUNCTION)
template <class _Arg1, class _Arg2, class _Result>
-struct _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX11 binary_function
-{
- typedef _Arg1 first_argument_type;
- typedef _Arg2 second_argument_type;
- typedef _Result result_type;
+struct _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX11 binary_function {
+ typedef _Arg1 first_argument_type;
+ typedef _Arg2 second_argument_type;
+ typedef _Result result_type;
};
#endif // _LIBCPP_STD_VER <= 14 || defined(_LIBCPP_ENABLE_CXX17_REMOVED_UNARY_BINARY_FUNCTION)
-template <class _Arg1, class _Arg2, class _Result> struct __binary_function_keep_layout_base {
+template <class _Arg1, class _Arg2, class _Result>
+struct __binary_function_keep_layout_base {
#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_BINDER_TYPEDEFS)
- using first_argument_type _LIBCPP_DEPRECATED_IN_CXX17 = _Arg1;
+ using first_argument_type _LIBCPP_DEPRECATED_IN_CXX17 = _Arg1;
using second_argument_type _LIBCPP_DEPRECATED_IN_CXX17 = _Arg2;
- using result_type _LIBCPP_DEPRECATED_IN_CXX17 = _Result;
+ using result_type _LIBCPP_DEPRECATED_IN_CXX17 = _Result;
#endif
};
diff --git a/contrib/llvm-project/libcxx/include/__functional/binary_negate.h b/contrib/llvm-project/libcxx/include/__functional/binary_negate.h
index 3180284fc382..ce52b5ae9fc4 100644
--- a/contrib/llvm-project/libcxx/include/__functional/binary_negate.h
+++ b/contrib/llvm-project/libcxx/include/__functional/binary_negate.h
@@ -25,23 +25,24 @@ template <class _Predicate>
class _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX17 binary_negate
: public __binary_function<typename _Predicate::first_argument_type,
typename _Predicate::second_argument_type,
- bool>
-{
- _Predicate __pred_;
+ bool> {
+ _Predicate __pred_;
+
public:
- _LIBCPP_HIDE_FROM_ABI explicit _LIBCPP_CONSTEXPR_SINCE_CXX14
- binary_negate(const _Predicate& __pred) : __pred_(__pred) {}
+ _LIBCPP_HIDE_FROM_ABI explicit _LIBCPP_CONSTEXPR_SINCE_CXX14 binary_negate(const _Predicate& __pred)
+ : __pred_(__pred) {}
- _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
- bool operator()(const typename _Predicate::first_argument_type& __x,
- const typename _Predicate::second_argument_type& __y) const
- {return !__pred_(__x, __y);}
+ _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI bool operator()(
+ const typename _Predicate::first_argument_type& __x, const typename _Predicate::second_argument_type& __y) const {
+ return !__pred_(__x, __y);
+ }
};
template <class _Predicate>
-_LIBCPP_DEPRECATED_IN_CXX17 inline _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
-binary_negate<_Predicate>
-not2(const _Predicate& __pred) {return binary_negate<_Predicate>(__pred);}
+_LIBCPP_DEPRECATED_IN_CXX17 inline _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI binary_negate<_Predicate>
+not2(const _Predicate& __pred) {
+ return binary_negate<_Predicate>(__pred);
+}
#endif // _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_NEGATORS)
diff --git a/contrib/llvm-project/libcxx/include/__functional/bind.h b/contrib/llvm-project/libcxx/include/__functional/bind.h
index 61d99e1fd564..19e7d82155ec 100644
--- a/contrib/llvm-project/libcxx/include/__functional/bind.h
+++ b/contrib/llvm-project/libcxx/include/__functional/bind.h
@@ -25,34 +25,30 @@
_LIBCPP_BEGIN_NAMESPACE_STD
-template<class _Tp>
-struct is_bind_expression : _If<
- _IsSame<_Tp, __remove_cvref_t<_Tp> >::value,
- false_type,
- is_bind_expression<__remove_cvref_t<_Tp> >
-> {};
+template <class _Tp>
+struct is_bind_expression
+ : _If< _IsSame<_Tp, __remove_cvref_t<_Tp> >::value, false_type, is_bind_expression<__remove_cvref_t<_Tp> > > {};
#if _LIBCPP_STD_VER >= 17
template <class _Tp>
inline constexpr bool is_bind_expression_v = is_bind_expression<_Tp>::value;
#endif
-template<class _Tp>
-struct is_placeholder : _If<
- _IsSame<_Tp, __remove_cvref_t<_Tp> >::value,
- integral_constant<int, 0>,
- is_placeholder<__remove_cvref_t<_Tp> >
-> {};
+template <class _Tp>
+struct is_placeholder
+ : _If< _IsSame<_Tp, __remove_cvref_t<_Tp> >::value,
+ integral_constant<int, 0>,
+ is_placeholder<__remove_cvref_t<_Tp> > > {};
#if _LIBCPP_STD_VER >= 17
template <class _Tp>
inline constexpr int is_placeholder_v = is_placeholder<_Tp>::value;
#endif
-namespace placeholders
-{
+namespace placeholders {
-template <int _Np> struct __ph {};
+template <int _Np>
+struct __ph {};
// C++17 recommends that we implement placeholders as `inline constexpr`, but allows
// implementing them as `extern <implementation-defined>`. Libc++ implements them as
@@ -62,291 +58,234 @@ template <int _Np> struct __ph {};
//
// In practice, since placeholders are empty, `extern const` is almost impossible
// to distinguish from `inline constexpr` from a usage stand point.
-_LIBCPP_EXPORTED_FROM_ABI extern const __ph<1> _1;
-_LIBCPP_EXPORTED_FROM_ABI extern const __ph<2> _2;
-_LIBCPP_EXPORTED_FROM_ABI extern const __ph<3> _3;
-_LIBCPP_EXPORTED_FROM_ABI extern const __ph<4> _4;
-_LIBCPP_EXPORTED_FROM_ABI extern const __ph<5> _5;
-_LIBCPP_EXPORTED_FROM_ABI extern const __ph<6> _6;
-_LIBCPP_EXPORTED_FROM_ABI extern const __ph<7> _7;
-_LIBCPP_EXPORTED_FROM_ABI extern const __ph<8> _8;
-_LIBCPP_EXPORTED_FROM_ABI extern const __ph<9> _9;
+_LIBCPP_EXPORTED_FROM_ABI extern const __ph<1> _1;
+_LIBCPP_EXPORTED_FROM_ABI extern const __ph<2> _2;
+_LIBCPP_EXPORTED_FROM_ABI extern const __ph<3> _3;
+_LIBCPP_EXPORTED_FROM_ABI extern const __ph<4> _4;
+_LIBCPP_EXPORTED_FROM_ABI extern const __ph<5> _5;
+_LIBCPP_EXPORTED_FROM_ABI extern const __ph<6> _6;
+_LIBCPP_EXPORTED_FROM_ABI extern const __ph<7> _7;
+_LIBCPP_EXPORTED_FROM_ABI extern const __ph<8> _8;
+_LIBCPP_EXPORTED_FROM_ABI extern const __ph<9> _9;
_LIBCPP_EXPORTED_FROM_ABI extern const __ph<10> _10;
} // namespace placeholders
-template<int _Np>
-struct is_placeholder<placeholders::__ph<_Np> >
- : public integral_constant<int, _Np> {};
-
+template <int _Np>
+struct is_placeholder<placeholders::__ph<_Np> > : public integral_constant<int, _Np> {};
#ifndef _LIBCPP_CXX03_LANG
template <class _Tp, class _Uj>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-_Tp&
-__mu(reference_wrapper<_Tp> __t, _Uj&)
-{
- return __t.get();
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _Tp& __mu(reference_wrapper<_Tp> __t, _Uj&) {
+ return __t.get();
}
-template <class _Ti, class ..._Uj, size_t ..._Indx>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-typename __invoke_of<_Ti&, _Uj...>::type
-__mu_expand(_Ti& __ti, tuple<_Uj...>& __uj, __tuple_indices<_Indx...>)
-{
- return __ti(std::forward<_Uj>(std::get<_Indx>(__uj))...);
+template <class _Ti, class... _Uj, size_t... _Indx>
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 typename __invoke_of<_Ti&, _Uj...>::type
+__mu_expand(_Ti& __ti, tuple<_Uj...>& __uj, __tuple_indices<_Indx...>) {
+ return __ti(std::forward<_Uj>(std::get<_Indx>(__uj))...);
}
-template <class _Ti, class ..._Uj, __enable_if_t<is_bind_expression<_Ti>::value, int> = 0>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-typename __invoke_of<_Ti&, _Uj...>::type
-__mu(_Ti& __ti, tuple<_Uj...>& __uj)
-{
- typedef typename __make_tuple_indices<sizeof...(_Uj)>::type __indices;
- return std::__mu_expand(__ti, __uj, __indices());
+template <class _Ti, class... _Uj, __enable_if_t<is_bind_expression<_Ti>::value, int> = 0>
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 typename __invoke_of<_Ti&, _Uj...>::type
+__mu(_Ti& __ti, tuple<_Uj...>& __uj) {
+ typedef typename __make_tuple_indices<sizeof...(_Uj)>::type __indices;
+ return std::__mu_expand(__ti, __uj, __indices());
}
template <bool IsPh, class _Ti, class _Uj>
struct __mu_return2 {};
template <class _Ti, class _Uj>
-struct __mu_return2<true, _Ti, _Uj>
-{
- typedef typename tuple_element<is_placeholder<_Ti>::value - 1, _Uj>::type type;
+struct __mu_return2<true, _Ti, _Uj> {
+ typedef typename tuple_element<is_placeholder<_Ti>::value - 1, _Uj>::type type;
};
template <class _Ti, class _Uj, __enable_if_t<0 < is_placeholder<_Ti>::value, int> = 0>
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-typename __mu_return2<0 < is_placeholder<_Ti>::value, _Ti, _Uj>::type
-__mu(_Ti&, _Uj& __uj)
-{
- const size_t __indx = is_placeholder<_Ti>::value - 1;
- return std::forward<typename tuple_element<__indx, _Uj>::type>(std::get<__indx>(__uj));
+ typename __mu_return2<0 < is_placeholder<_Ti>::value, _Ti, _Uj>::type
+ __mu(_Ti&, _Uj& __uj) {
+ const size_t __indx = is_placeholder<_Ti>::value - 1;
+ return std::forward<typename tuple_element<__indx, _Uj>::type>(std::get<__indx>(__uj));
}
-template <class _Ti, class _Uj, __enable_if_t<!is_bind_expression<_Ti>::value &&
- is_placeholder<_Ti>::value == 0 &&
- !__is_reference_wrapper<_Ti>::value, int> = 0>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-_Ti&
-__mu(_Ti& __ti, _Uj&)
-{
- return __ti;
+template <class _Ti,
+ class _Uj,
+ __enable_if_t<!is_bind_expression<_Ti>::value && is_placeholder<_Ti>::value == 0 &&
+ !__is_reference_wrapper<_Ti>::value,
+ int> = 0>
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _Ti& __mu(_Ti& __ti, _Uj&) {
+ return __ti;
}
-template <class _Ti, bool IsReferenceWrapper, bool IsBindEx, bool IsPh,
- class _TupleUj>
+template <class _Ti, bool IsReferenceWrapper, bool IsBindEx, bool IsPh, class _TupleUj>
struct __mu_return_impl;
-template <bool _Invokable, class _Ti, class ..._Uj>
-struct __mu_return_invokable // false
+template <bool _Invokable, class _Ti, class... _Uj>
+struct __mu_return_invokable // false
{
- typedef __nat type;
+ typedef __nat type;
};
-template <class _Ti, class ..._Uj>
-struct __mu_return_invokable<true, _Ti, _Uj...>
-{
- typedef typename __invoke_of<_Ti&, _Uj...>::type type;
+template <class _Ti, class... _Uj>
+struct __mu_return_invokable<true, _Ti, _Uj...> {
+ typedef typename __invoke_of<_Ti&, _Uj...>::type type;
};
-template <class _Ti, class ..._Uj>
+template <class _Ti, class... _Uj>
struct __mu_return_impl<_Ti, false, true, false, tuple<_Uj...> >
- : public __mu_return_invokable<__invokable<_Ti&, _Uj...>::value, _Ti, _Uj...>
-{
-};
+ : public __mu_return_invokable<__invokable<_Ti&, _Uj...>::value, _Ti, _Uj...> {};
template <class _Ti, class _TupleUj>
-struct __mu_return_impl<_Ti, false, false, true, _TupleUj>
-{
- typedef typename tuple_element<is_placeholder<_Ti>::value - 1,
- _TupleUj>::type&& type;
+struct __mu_return_impl<_Ti, false, false, true, _TupleUj> {
+ typedef typename tuple_element<is_placeholder<_Ti>::value - 1, _TupleUj>::type&& type;
};
template <class _Ti, class _TupleUj>
-struct __mu_return_impl<_Ti, true, false, false, _TupleUj>
-{
- typedef typename _Ti::type& type;
+struct __mu_return_impl<_Ti, true, false, false, _TupleUj> {
+ typedef typename _Ti::type& type;
};
template <class _Ti, class _TupleUj>
-struct __mu_return_impl<_Ti, false, false, false, _TupleUj>
-{
- typedef _Ti& type;
+struct __mu_return_impl<_Ti, false, false, false, _TupleUj> {
+ typedef _Ti& type;
};
template <class _Ti, class _TupleUj>
struct __mu_return
- : public __mu_return_impl<_Ti,
- __is_reference_wrapper<_Ti>::value,
- is_bind_expression<_Ti>::value,
- 0 < is_placeholder<_Ti>::value &&
- is_placeholder<_Ti>::value <= tuple_size<_TupleUj>::value,
- _TupleUj>
-{
-};
+ : public __mu_return_impl<
+ _Ti,
+ __is_reference_wrapper<_Ti>::value,
+ is_bind_expression<_Ti>::value,
+ 0 < is_placeholder<_Ti>::value && is_placeholder<_Ti>::value <= tuple_size<_TupleUj>::value,
+ _TupleUj> {};
template <class _Fp, class _BoundArgs, class _TupleUj>
-struct __is_valid_bind_return
-{
- static const bool value = false;
+struct __is_valid_bind_return {
+ static const bool value = false;
};
-template <class _Fp, class ..._BoundArgs, class _TupleUj>
-struct __is_valid_bind_return<_Fp, tuple<_BoundArgs...>, _TupleUj>
-{
- static const bool value = __invokable<_Fp,
- typename __mu_return<_BoundArgs, _TupleUj>::type...>::value;
+template <class _Fp, class... _BoundArgs, class _TupleUj>
+struct __is_valid_bind_return<_Fp, tuple<_BoundArgs...>, _TupleUj> {
+ static const bool value = __invokable<_Fp, typename __mu_return<_BoundArgs, _TupleUj>::type...>::value;
};
-template <class _Fp, class ..._BoundArgs, class _TupleUj>
-struct __is_valid_bind_return<_Fp, const tuple<_BoundArgs...>, _TupleUj>
-{
- static const bool value = __invokable<_Fp,
- typename __mu_return<const _BoundArgs, _TupleUj>::type...>::value;
+template <class _Fp, class... _BoundArgs, class _TupleUj>
+struct __is_valid_bind_return<_Fp, const tuple<_BoundArgs...>, _TupleUj> {
+ static const bool value = __invokable<_Fp, typename __mu_return<const _BoundArgs, _TupleUj>::type...>::value;
};
-template <class _Fp, class _BoundArgs, class _TupleUj,
- bool = __is_valid_bind_return<_Fp, _BoundArgs, _TupleUj>::value>
+template <class _Fp, class _BoundArgs, class _TupleUj, bool = __is_valid_bind_return<_Fp, _BoundArgs, _TupleUj>::value>
struct __bind_return;
-template <class _Fp, class ..._BoundArgs, class _TupleUj>
-struct __bind_return<_Fp, tuple<_BoundArgs...>, _TupleUj, true>
-{
- typedef typename __invoke_of
- <
- _Fp&,
- typename __mu_return
- <
- _BoundArgs,
- _TupleUj
- >::type...
- >::type type;
+template <class _Fp, class... _BoundArgs, class _TupleUj>
+struct __bind_return<_Fp, tuple<_BoundArgs...>, _TupleUj, true> {
+ typedef typename __invoke_of< _Fp&, typename __mu_return< _BoundArgs, _TupleUj >::type... >::type type;
};
-template <class _Fp, class ..._BoundArgs, class _TupleUj>
-struct __bind_return<_Fp, const tuple<_BoundArgs...>, _TupleUj, true>
-{
- typedef typename __invoke_of
- <
- _Fp&,
- typename __mu_return
- <
- const _BoundArgs,
- _TupleUj
- >::type...
- >::type type;
+template <class _Fp, class... _BoundArgs, class _TupleUj>
+struct __bind_return<_Fp, const tuple<_BoundArgs...>, _TupleUj, true> {
+ typedef typename __invoke_of< _Fp&, typename __mu_return< const _BoundArgs, _TupleUj >::type... >::type type;
};
-template <class _Fp, class _BoundArgs, size_t ..._Indx, class _Args>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-typename __bind_return<_Fp, _BoundArgs, _Args>::type
-__apply_functor(_Fp& __f, _BoundArgs& __bound_args, __tuple_indices<_Indx...>,
- _Args&& __args)
-{
- return std::__invoke(__f, std::__mu(std::get<_Indx>(__bound_args), __args)...);
+template <class _Fp, class _BoundArgs, size_t... _Indx, class _Args>
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 typename __bind_return<_Fp, _BoundArgs, _Args>::type
+__apply_functor(_Fp& __f, _BoundArgs& __bound_args, __tuple_indices<_Indx...>, _Args&& __args) {
+ return std::__invoke(__f, std::__mu(std::get<_Indx>(__bound_args), __args)...);
}
-template<class _Fp, class ..._BoundArgs>
-class __bind : public __weak_result_type<__decay_t<_Fp> >
-{
+template <class _Fp, class... _BoundArgs>
+class __bind : public __weak_result_type<__decay_t<_Fp> > {
protected:
- using _Fd = __decay_t<_Fp>;
- typedef tuple<__decay_t<_BoundArgs>...> _Td;
+ using _Fd = __decay_t<_Fp>;
+ typedef tuple<__decay_t<_BoundArgs>...> _Td;
+
private:
- _Fd __f_;
- _Td __bound_args_;
+ _Fd __f_;
+ _Td __bound_args_;
+
+ typedef typename __make_tuple_indices<sizeof...(_BoundArgs)>::type __indices;
- typedef typename __make_tuple_indices<sizeof...(_BoundArgs)>::type __indices;
public:
- template <class _Gp, class ..._BA,
- __enable_if_t<is_constructible<_Fd, _Gp>::value && !is_same<__libcpp_remove_reference_t<_Gp>, __bind>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- explicit __bind(_Gp&& __f, _BA&& ...__bound_args)
- : __f_(std::forward<_Gp>(__f)),
- __bound_args_(std::forward<_BA>(__bound_args)...) {}
-
- template <class ..._Args>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- typename __bind_return<_Fd, _Td, tuple<_Args&&...> >::type
- operator()(_Args&& ...__args)
- {
- return std::__apply_functor(__f_, __bound_args_, __indices(),
- tuple<_Args&&...>(std::forward<_Args>(__args)...));
- }
-
- template <class ..._Args>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- typename __bind_return<const _Fd, const _Td, tuple<_Args&&...> >::type
- operator()(_Args&& ...__args) const
- {
- return std::__apply_functor(__f_, __bound_args_, __indices(),
- tuple<_Args&&...>(std::forward<_Args>(__args)...));
- }
+ template <
+ class _Gp,
+ class... _BA,
+ __enable_if_t<is_constructible<_Fd, _Gp>::value && !is_same<__libcpp_remove_reference_t<_Gp>, __bind>::value,
+ int> = 0>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 explicit __bind(_Gp&& __f, _BA&&... __bound_args)
+ : __f_(std::forward<_Gp>(__f)), __bound_args_(std::forward<_BA>(__bound_args)...) {}
+
+ template <class... _Args>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 typename __bind_return<_Fd, _Td, tuple<_Args&&...> >::type
+ operator()(_Args&&... __args) {
+ return std::__apply_functor(__f_, __bound_args_, __indices(), tuple<_Args&&...>(std::forward<_Args>(__args)...));
+ }
+
+ template <class... _Args>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
+ typename __bind_return<const _Fd, const _Td, tuple<_Args&&...> >::type
+ operator()(_Args&&... __args) const {
+ return std::__apply_functor(__f_, __bound_args_, __indices(), tuple<_Args&&...>(std::forward<_Args>(__args)...));
+ }
};
-template<class _Fp, class ..._BoundArgs>
+template <class _Fp, class... _BoundArgs>
struct is_bind_expression<__bind<_Fp, _BoundArgs...> > : public true_type {};
-template<class _Rp, class _Fp, class ..._BoundArgs>
-class __bind_r
- : public __bind<_Fp, _BoundArgs...>
-{
- typedef __bind<_Fp, _BoundArgs...> base;
- typedef typename base::_Fd _Fd;
- typedef typename base::_Td _Td;
+template <class _Rp, class _Fp, class... _BoundArgs>
+class __bind_r : public __bind<_Fp, _BoundArgs...> {
+ typedef __bind<_Fp, _BoundArgs...> base;
+ typedef typename base::_Fd _Fd;
+ typedef typename base::_Td _Td;
+
public:
- typedef _Rp result_type;
-
-
- template <class _Gp, class ..._BA,
- __enable_if_t<is_constructible<_Fd, _Gp>::value && !is_same<__libcpp_remove_reference_t<_Gp>, __bind_r>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- explicit __bind_r(_Gp&& __f, _BA&& ...__bound_args)
- : base(std::forward<_Gp>(__f),
- std::forward<_BA>(__bound_args)...) {}
-
- template <class ..._Args, __enable_if_t<is_convertible<typename __bind_return<_Fd, _Td, tuple<_Args&&...> >::type,
- result_type>::value || is_void<_Rp>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- result_type
- operator()(_Args&& ...__args)
- {
- typedef __invoke_void_return_wrapper<_Rp> _Invoker;
- return _Invoker::__call(static_cast<base&>(*this), std::forward<_Args>(__args)...);
- }
-
- template <class ..._Args, __enable_if_t<is_convertible<typename __bind_return<const _Fd, const _Td, tuple<_Args&&...> >::type,
- result_type>::value || is_void<_Rp>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- result_type
- operator()(_Args&& ...__args) const
- {
- typedef __invoke_void_return_wrapper<_Rp> _Invoker;
- return _Invoker::__call(static_cast<base const&>(*this), std::forward<_Args>(__args)...);
- }
+ typedef _Rp result_type;
+
+ template <
+ class _Gp,
+ class... _BA,
+ __enable_if_t<is_constructible<_Fd, _Gp>::value && !is_same<__libcpp_remove_reference_t<_Gp>, __bind_r>::value,
+ int> = 0>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 explicit __bind_r(_Gp&& __f, _BA&&... __bound_args)
+ : base(std::forward<_Gp>(__f), std::forward<_BA>(__bound_args)...) {}
+
+ template <
+ class... _Args,
+ __enable_if_t<is_convertible<typename __bind_return<_Fd, _Td, tuple<_Args&&...> >::type, result_type>::value ||
+ is_void<_Rp>::value,
+ int> = 0>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 result_type operator()(_Args&&... __args) {
+ typedef __invoke_void_return_wrapper<_Rp> _Invoker;
+ return _Invoker::__call(static_cast<base&>(*this), std::forward<_Args>(__args)...);
+ }
+
+ template <class... _Args,
+ __enable_if_t<is_convertible<typename __bind_return<const _Fd, const _Td, tuple<_Args&&...> >::type,
+ result_type>::value ||
+ is_void<_Rp>::value,
+ int> = 0>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 result_type operator()(_Args&&... __args) const {
+ typedef __invoke_void_return_wrapper<_Rp> _Invoker;
+ return _Invoker::__call(static_cast<base const&>(*this), std::forward<_Args>(__args)...);
+ }
};
-template<class _Rp, class _Fp, class ..._BoundArgs>
+template <class _Rp, class _Fp, class... _BoundArgs>
struct is_bind_expression<__bind_r<_Rp, _Fp, _BoundArgs...> > : public true_type {};
-template<class _Fp, class ..._BoundArgs>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-__bind<_Fp, _BoundArgs...>
-bind(_Fp&& __f, _BoundArgs&&... __bound_args)
-{
- typedef __bind<_Fp, _BoundArgs...> type;
- return type(std::forward<_Fp>(__f), std::forward<_BoundArgs>(__bound_args)...);
+template <class _Fp, class... _BoundArgs>
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 __bind<_Fp, _BoundArgs...>
+bind(_Fp&& __f, _BoundArgs&&... __bound_args) {
+ typedef __bind<_Fp, _BoundArgs...> type;
+ return type(std::forward<_Fp>(__f), std::forward<_BoundArgs>(__bound_args)...);
}
-template<class _Rp, class _Fp, class ..._BoundArgs>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-__bind_r<_Rp, _Fp, _BoundArgs...>
-bind(_Fp&& __f, _BoundArgs&&... __bound_args)
-{
- typedef __bind_r<_Rp, _Fp, _BoundArgs...> type;
- return type(std::forward<_Fp>(__f), std::forward<_BoundArgs>(__bound_args)...);
+template <class _Rp, class _Fp, class... _BoundArgs>
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 __bind_r<_Rp, _Fp, _BoundArgs...>
+bind(_Fp&& __f, _BoundArgs&&... __bound_args) {
+ typedef __bind_r<_Rp, _Fp, _BoundArgs...> type;
+ return type(std::forward<_Fp>(__f), std::forward<_BoundArgs>(__bound_args)...);
}
#endif // _LIBCPP_CXX03_LANG
diff --git a/contrib/llvm-project/libcxx/include/__functional/bind_back.h b/contrib/llvm-project/libcxx/include/__functional/bind_back.h
index 5b5b40520933..ce26d3b70630 100644
--- a/contrib/llvm-project/libcxx/include/__functional/bind_back.h
+++ b/contrib/llvm-project/libcxx/include/__functional/bind_back.h
@@ -29,28 +29,38 @@ _LIBCPP_BEGIN_NAMESPACE_STD
template <size_t _NBound, class = make_index_sequence<_NBound>>
struct __bind_back_op;
-template <size_t _NBound, size_t ..._Ip>
+template <size_t _NBound, size_t... _Ip>
struct __bind_back_op<_NBound, index_sequence<_Ip...>> {
- template <class _Fn, class _BoundArgs, class... _Args>
- _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Fn&& __f, _BoundArgs&& __bound_args, _Args&&... __args) const
- noexcept(noexcept(std::invoke(std::forward<_Fn>(__f), std::forward<_Args>(__args)..., std::get<_Ip>(std::forward<_BoundArgs>(__bound_args))...)))
- -> decltype( std::invoke(std::forward<_Fn>(__f), std::forward<_Args>(__args)..., std::get<_Ip>(std::forward<_BoundArgs>(__bound_args))...))
- { return std::invoke(std::forward<_Fn>(__f), std::forward<_Args>(__args)..., std::get<_Ip>(std::forward<_BoundArgs>(__bound_args))...); }
+ template <class _Fn, class _BoundArgs, class... _Args>
+ _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Fn&& __f, _BoundArgs&& __bound_args, _Args&&... __args) const
+ noexcept(noexcept(std::invoke(std::forward<_Fn>(__f),
+ std::forward<_Args>(__args)...,
+ std::get<_Ip>(std::forward<_BoundArgs>(__bound_args))...)))
+ -> decltype(std::invoke(std::forward<_Fn>(__f),
+ std::forward<_Args>(__args)...,
+ std::get<_Ip>(std::forward<_BoundArgs>(__bound_args))...)) {
+ return std::invoke(std::forward<_Fn>(__f),
+ std::forward<_Args>(__args)...,
+ std::get<_Ip>(std::forward<_BoundArgs>(__bound_args))...);
+ }
};
template <class _Fn, class _BoundArgs>
struct __bind_back_t : __perfect_forward<__bind_back_op<tuple_size_v<_BoundArgs>>, _Fn, _BoundArgs> {
- using __perfect_forward<__bind_back_op<tuple_size_v<_BoundArgs>>, _Fn, _BoundArgs>::__perfect_forward;
+ using __perfect_forward<__bind_back_op<tuple_size_v<_BoundArgs>>, _Fn, _BoundArgs>::__perfect_forward;
};
template <class _Fn, class... _Args>
requires is_constructible_v<decay_t<_Fn>, _Fn> && is_move_constructible_v<decay_t<_Fn>> &&
(is_constructible_v<decay_t<_Args>, _Args> && ...) && (is_move_constructible_v<decay_t<_Args>> && ...)
-_LIBCPP_HIDE_FROM_ABI
-constexpr auto __bind_back(_Fn&& __f, _Args&&... __args)
- noexcept(noexcept(__bind_back_t<decay_t<_Fn>, tuple<decay_t<_Args>...>>(std::forward<_Fn>(__f), std::forward_as_tuple(std::forward<_Args>(__args)...))))
- -> decltype( __bind_back_t<decay_t<_Fn>, tuple<decay_t<_Args>...>>(std::forward<_Fn>(__f), std::forward_as_tuple(std::forward<_Args>(__args)...)))
- { return __bind_back_t<decay_t<_Fn>, tuple<decay_t<_Args>...>>(std::forward<_Fn>(__f), std::forward_as_tuple(std::forward<_Args>(__args)...)); }
+_LIBCPP_HIDE_FROM_ABI constexpr auto __bind_back(_Fn&& __f, _Args&&... __args) noexcept(
+ noexcept(__bind_back_t<decay_t<_Fn>, tuple<decay_t<_Args>...>>(
+ std::forward<_Fn>(__f), std::forward_as_tuple(std::forward<_Args>(__args)...))))
+ -> decltype(__bind_back_t<decay_t<_Fn>, tuple<decay_t<_Args>...>>(
+ std::forward<_Fn>(__f), std::forward_as_tuple(std::forward<_Args>(__args)...))) {
+ return __bind_back_t<decay_t<_Fn>, tuple<decay_t<_Args>...>>(
+ std::forward<_Fn>(__f), std::forward_as_tuple(std::forward<_Args>(__args)...));
+}
#endif // _LIBCPP_STD_VER >= 20
diff --git a/contrib/llvm-project/libcxx/include/__functional/bind_front.h b/contrib/llvm-project/libcxx/include/__functional/bind_front.h
index d47624343876..30dda533615b 100644
--- a/contrib/llvm-project/libcxx/include/__functional/bind_front.h
+++ b/contrib/llvm-project/libcxx/include/__functional/bind_front.h
@@ -29,25 +29,24 @@ _LIBCPP_BEGIN_NAMESPACE_STD
#if _LIBCPP_STD_VER >= 20
struct __bind_front_op {
- template <class ..._Args>
- _LIBCPP_HIDE_FROM_ABI
- constexpr auto operator()(_Args&& ...__args) const
- noexcept(noexcept(std::invoke(std::forward<_Args>(__args)...)))
- -> decltype( std::invoke(std::forward<_Args>(__args)...))
- { return std::invoke(std::forward<_Args>(__args)...); }
+ template <class... _Args>
+ _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Args&&... __args) const
+ noexcept(noexcept(std::invoke(std::forward<_Args>(__args)...)))
+ -> decltype(std::invoke(std::forward<_Args>(__args)...)) {
+ return std::invoke(std::forward<_Args>(__args)...);
+ }
};
-template <class _Fn, class ..._BoundArgs>
+template <class _Fn, class... _BoundArgs>
struct __bind_front_t : __perfect_forward<__bind_front_op, _Fn, _BoundArgs...> {
- using __perfect_forward<__bind_front_op, _Fn, _BoundArgs...>::__perfect_forward;
+ using __perfect_forward<__bind_front_op, _Fn, _BoundArgs...>::__perfect_forward;
};
template <class _Fn, class... _Args>
requires is_constructible_v<decay_t<_Fn>, _Fn> && is_move_constructible_v<decay_t<_Fn>> &&
(is_constructible_v<decay_t<_Args>, _Args> && ...) && (is_move_constructible_v<decay_t<_Args>> && ...)
-_LIBCPP_HIDE_FROM_ABI
-constexpr auto bind_front(_Fn&& __f, _Args&&... __args) {
- return __bind_front_t<decay_t<_Fn>, decay_t<_Args>...>(std::forward<_Fn>(__f), std::forward<_Args>(__args)...);
+_LIBCPP_HIDE_FROM_ABI constexpr auto bind_front(_Fn&& __f, _Args&&... __args) {
+ return __bind_front_t<decay_t<_Fn>, decay_t<_Args>...>(std::forward<_Fn>(__f), std::forward<_Args>(__args)...);
}
#endif // _LIBCPP_STD_VER >= 20
diff --git a/contrib/llvm-project/libcxx/include/__functional/binder1st.h b/contrib/llvm-project/libcxx/include/__functional/binder1st.h
index 9f0dc08ba6b1..04b51fefab70 100644
--- a/contrib/llvm-project/libcxx/include/__functional/binder1st.h
+++ b/contrib/llvm-project/libcxx/include/__functional/binder1st.h
@@ -23,28 +23,29 @@ _LIBCPP_BEGIN_NAMESPACE_STD
template <class _Operation>
class _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX11 binder1st
- : public __unary_function<typename _Operation::second_argument_type, typename _Operation::result_type>
-{
+ : public __unary_function<typename _Operation::second_argument_type, typename _Operation::result_type> {
protected:
- _Operation op;
- typename _Operation::first_argument_type value;
+ _Operation op;
+ typename _Operation::first_argument_type value;
+
public:
- _LIBCPP_HIDE_FROM_ABI binder1st(const _Operation& __x,
- const typename _Operation::first_argument_type __y)
- : op(__x), value(__y) {}
- _LIBCPP_HIDE_FROM_ABI typename _Operation::result_type operator()
- (typename _Operation::second_argument_type& __x) const
- {return op(value, __x);}
- _LIBCPP_HIDE_FROM_ABI typename _Operation::result_type operator()
- (const typename _Operation::second_argument_type& __x) const
- {return op(value, __x);}
+ _LIBCPP_HIDE_FROM_ABI binder1st(const _Operation& __x, const typename _Operation::first_argument_type __y)
+ : op(__x), value(__y) {}
+ _LIBCPP_HIDE_FROM_ABI typename _Operation::result_type
+ operator()(typename _Operation::second_argument_type& __x) const {
+ return op(value, __x);
+ }
+ _LIBCPP_HIDE_FROM_ABI typename _Operation::result_type
+ operator()(const typename _Operation::second_argument_type& __x) const {
+ return op(value, __x);
+ }
};
template <class _Operation, class _Tp>
-_LIBCPP_DEPRECATED_IN_CXX11 inline _LIBCPP_HIDE_FROM_ABI
-binder1st<_Operation>
-bind1st(const _Operation& __op, const _Tp& __x)
- {return binder1st<_Operation>(__op, __x);}
+_LIBCPP_DEPRECATED_IN_CXX11 inline _LIBCPP_HIDE_FROM_ABI binder1st<_Operation>
+bind1st(const _Operation& __op, const _Tp& __x) {
+ return binder1st<_Operation>(__op, __x);
+}
#endif // _LIBCPP_STD_VER <= 14 || defined(_LIBCPP_ENABLE_CXX17_REMOVED_BINDERS)
diff --git a/contrib/llvm-project/libcxx/include/__functional/binder2nd.h b/contrib/llvm-project/libcxx/include/__functional/binder2nd.h
index cf80a55bc6a3..9d22e4430b1b 100644
--- a/contrib/llvm-project/libcxx/include/__functional/binder2nd.h
+++ b/contrib/llvm-project/libcxx/include/__functional/binder2nd.h
@@ -23,28 +23,29 @@ _LIBCPP_BEGIN_NAMESPACE_STD
template <class _Operation>
class _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX11 binder2nd
- : public __unary_function<typename _Operation::first_argument_type, typename _Operation::result_type>
-{
+ : public __unary_function<typename _Operation::first_argument_type, typename _Operation::result_type> {
protected:
- _Operation op;
- typename _Operation::second_argument_type value;
+ _Operation op;
+ typename _Operation::second_argument_type value;
+
public:
- _LIBCPP_HIDE_FROM_ABI
- binder2nd(const _Operation& __x, const typename _Operation::second_argument_type __y)
- : op(__x), value(__y) {}
- _LIBCPP_HIDE_FROM_ABI typename _Operation::result_type operator()
- ( typename _Operation::first_argument_type& __x) const
- {return op(__x, value);}
- _LIBCPP_HIDE_FROM_ABI typename _Operation::result_type operator()
- (const typename _Operation::first_argument_type& __x) const
- {return op(__x, value);}
+ _LIBCPP_HIDE_FROM_ABI binder2nd(const _Operation& __x, const typename _Operation::second_argument_type __y)
+ : op(__x), value(__y) {}
+ _LIBCPP_HIDE_FROM_ABI typename _Operation::result_type
+ operator()(typename _Operation::first_argument_type& __x) const {
+ return op(__x, value);
+ }
+ _LIBCPP_HIDE_FROM_ABI typename _Operation::result_type
+ operator()(const typename _Operation::first_argument_type& __x) const {
+ return op(__x, value);
+ }
};
template <class _Operation, class _Tp>
-_LIBCPP_DEPRECATED_IN_CXX11 inline _LIBCPP_HIDE_FROM_ABI
-binder2nd<_Operation>
-bind2nd(const _Operation& __op, const _Tp& __x)
- {return binder2nd<_Operation>(__op, __x);}
+_LIBCPP_DEPRECATED_IN_CXX11 inline _LIBCPP_HIDE_FROM_ABI binder2nd<_Operation>
+bind2nd(const _Operation& __op, const _Tp& __x) {
+ return binder2nd<_Operation>(__op, __x);
+}
#endif // _LIBCPP_STD_VER <= 14 || defined(_LIBCPP_ENABLE_CXX17_REMOVED_BINDERS)
diff --git a/contrib/llvm-project/libcxx/include/__functional/boyer_moore_searcher.h b/contrib/llvm-project/libcxx/include/__functional/boyer_moore_searcher.h
index 0165e062810f..648b60c50521 100644
--- a/contrib/llvm-project/libcxx/include/__functional/boyer_moore_searcher.h
+++ b/contrib/llvm-project/libcxx/include/__functional/boyer_moore_searcher.h
@@ -29,39 +29,29 @@
#if _LIBCPP_STD_VER >= 17
_LIBCPP_PUSH_MACROS
-#include <__undef_macros>
+# include <__undef_macros>
_LIBCPP_BEGIN_NAMESPACE_STD
-template <class _Key,
- class _Value,
- class _Hash,
- class _BinaryPredicate,
- bool /*useArray*/>
+template <class _Key, class _Value, class _Hash, class _BinaryPredicate, bool /*useArray*/>
class _BMSkipTable;
// General case for BM data searching; use a map
-template <class _Key,
- class _Value,
- class _Hash,
- class _BinaryPredicate>
+template <class _Key, class _Value, class _Hash, class _BinaryPredicate>
class _BMSkipTable<_Key, _Value, _Hash, _BinaryPredicate, false> {
private:
using value_type = _Value;
- using key_type = _Key;
+ using key_type = _Key;
const value_type __default_value_;
unordered_map<_Key, _Value, _Hash, _BinaryPredicate> __table_;
public:
- _LIBCPP_HIDE_FROM_ABI
- explicit _BMSkipTable(size_t __sz, value_type __default_value, _Hash __hash, _BinaryPredicate __pred)
- : __default_value_(__default_value),
- __table_(__sz, __hash, __pred) {}
+ _LIBCPP_HIDE_FROM_ABI explicit _BMSkipTable(
+ size_t __sz, value_type __default_value, _Hash __hash, _BinaryPredicate __pred)
+ : __default_value_(__default_value), __table_(__sz, __hash, __pred) {}
- _LIBCPP_HIDE_FROM_ABI void insert(const key_type& __key, value_type __val) {
- __table_[__key] = __val;
- }
+ _LIBCPP_HIDE_FROM_ABI void insert(const key_type& __key, value_type __val) { __table_[__key] = __val; }
_LIBCPP_HIDE_FROM_ABI value_type operator[](const key_type& __key) const {
auto __it = __table_.find(__key);
@@ -70,14 +60,11 @@ public:
};
// Special case small numeric values; use an array
-template <class _Key,
- class _Value,
- class _Hash,
- class _BinaryPredicate>
+template <class _Key, class _Value, class _Hash, class _BinaryPredicate>
class _BMSkipTable<_Key, _Value, _Hash, _BinaryPredicate, true> {
private:
using value_type = _Value;
- using key_type = _Key;
+ using key_type = _Key;
using unsigned_key_type = make_unsigned_t<key_type>;
std::array<value_type, 256> __table_;
@@ -98,34 +85,33 @@ public:
};
template <class _RandomAccessIterator1,
- class _Hash = hash<typename iterator_traits<_RandomAccessIterator1>::value_type>,
+ class _Hash = hash<typename iterator_traits<_RandomAccessIterator1>::value_type>,
class _BinaryPredicate = equal_to<>>
class _LIBCPP_TEMPLATE_VIS boyer_moore_searcher {
private:
using difference_type = typename std::iterator_traits<_RandomAccessIterator1>::difference_type;
- using value_type = typename std::iterator_traits<_RandomAccessIterator1>::value_type;
- using __skip_table_type = _BMSkipTable<value_type,
- difference_type,
- _Hash,
- _BinaryPredicate,
- is_integral_v<value_type>
- && sizeof(value_type) == 1
- && is_same_v<_Hash, hash<value_type>>
- && is_same_v<_BinaryPredicate, equal_to<>>>;
+ using value_type = typename std::iterator_traits<_RandomAccessIterator1>::value_type;
+ using __skip_table_type =
+ _BMSkipTable<value_type,
+ difference_type,
+ _Hash,
+ _BinaryPredicate,
+ is_integral_v<value_type> && sizeof(value_type) == 1 && is_same_v<_Hash, hash<value_type>> &&
+ is_same_v<_BinaryPredicate, equal_to<>>>;
public:
- _LIBCPP_HIDE_FROM_ABI
- boyer_moore_searcher(_RandomAccessIterator1 __first,
- _RandomAccessIterator1 __last,
- _Hash __hash = _Hash(),
- _BinaryPredicate __pred = _BinaryPredicate())
- : __first_(__first),
- __last_(__last),
- __pred_(__pred),
- __pattern_length_(__last - __first),
- __skip_table_(std::make_shared<__skip_table_type>(__pattern_length_, -1, __hash, __pred_)),
- __suffix_(std::__allocate_shared_unbounded_array<difference_type[]>(
- allocator<difference_type>(), __pattern_length_ + 1)) {
+ _LIBCPP_HIDE_FROM_ABI boyer_moore_searcher(
+ _RandomAccessIterator1 __first,
+ _RandomAccessIterator1 __last,
+ _Hash __hash = _Hash(),
+ _BinaryPredicate __pred = _BinaryPredicate())
+ : __first_(__first),
+ __last_(__last),
+ __pred_(__pred),
+ __pattern_length_(__last - __first),
+ __skip_table_(std::make_shared<__skip_table_type>(__pattern_length_, -1, __hash, __pred_)),
+ __suffix_(std::__allocate_shared_unbounded_array<difference_type[]>(
+ allocator<difference_type>(), __pattern_length_ + 1)) {
difference_type __i = 0;
while (__first != __last) {
__skip_table_->insert(*__first, __i);
@@ -162,8 +148,8 @@ private:
template <class _RandomAccessIterator2>
_LIBCPP_HIDE_FROM_ABI pair<_RandomAccessIterator2, _RandomAccessIterator2>
__search(_RandomAccessIterator2 __f, _RandomAccessIterator2 __l) const {
- _RandomAccessIterator2 __current = __f;
- const _RandomAccessIterator2 __last = __l - __pattern_length_;
+ _RandomAccessIterator2 __current = __f;
+ const _RandomAccessIterator2 __last = __l - __pattern_length_;
const __skip_table_type& __skip_table = *__skip_table_;
while (__current <= __last) {
@@ -190,7 +176,7 @@ private:
const size_t __count = __last - __first;
__prefix[0] = 0;
- size_t __k = 0;
+ size_t __k = 0;
for (size_t __i = 1; __i != __count; ++__i) {
while (__k > 0 && !__pred(__first[__k], __first[__i]))
@@ -219,7 +205,7 @@ private:
__compute_bm_prefix(_ReverseIter(__last), _ReverseIter(__first), __pred, __scratch);
for (size_t __i = 0; __i != __count; ++__i) {
- const size_t __j = __count - __scratch[__i];
+ const size_t __j = __count - __scratch[__i];
const difference_type __k = __i - __scratch[__i] + 1;
if (__suffix_[__j] > __k)
@@ -230,31 +216,31 @@ private:
_LIBCPP_CTAD_SUPPORTED_FOR_TYPE(boyer_moore_searcher);
template <class _RandomAccessIterator1,
- class _Hash = hash<typename iterator_traits<_RandomAccessIterator1>::value_type>,
+ class _Hash = hash<typename iterator_traits<_RandomAccessIterator1>::value_type>,
class _BinaryPredicate = equal_to<>>
class _LIBCPP_TEMPLATE_VIS boyer_moore_horspool_searcher {
private:
using difference_type = typename iterator_traits<_RandomAccessIterator1>::difference_type;
- using value_type = typename iterator_traits<_RandomAccessIterator1>::value_type;
- using __skip_table_type = _BMSkipTable<value_type,
- difference_type,
- _Hash,
- _BinaryPredicate,
- is_integral_v<value_type>
- && sizeof(value_type) == 1
- && is_same_v<_Hash, hash<value_type>>
- && is_same_v<_BinaryPredicate, equal_to<>>>;
+ using value_type = typename iterator_traits<_RandomAccessIterator1>::value_type;
+ using __skip_table_type =
+ _BMSkipTable<value_type,
+ difference_type,
+ _Hash,
+ _BinaryPredicate,
+ is_integral_v<value_type> && sizeof(value_type) == 1 && is_same_v<_Hash, hash<value_type>> &&
+ is_same_v<_BinaryPredicate, equal_to<>>>;
+
public:
- _LIBCPP_HIDE_FROM_ABI
- boyer_moore_horspool_searcher(_RandomAccessIterator1 __first,
- _RandomAccessIterator1 __last,
- _Hash __hash = _Hash(),
- _BinaryPredicate __pred = _BinaryPredicate())
- : __first_(__first),
- __last_(__last),
- __pred_(__pred),
- __pattern_length_(__last - __first),
- __skip_table_(std::make_shared<__skip_table_type>(__pattern_length_, __pattern_length_, __hash, __pred_)) {
+ _LIBCPP_HIDE_FROM_ABI boyer_moore_horspool_searcher(
+ _RandomAccessIterator1 __first,
+ _RandomAccessIterator1 __last,
+ _Hash __hash = _Hash(),
+ _BinaryPredicate __pred = _BinaryPredicate())
+ : __first_(__first),
+ __last_(__last),
+ __pred_(__pred),
+ __pattern_length_(__last - __first),
+ __skip_table_(std::make_shared<__skip_table_type>(__pattern_length_, __pattern_length_, __hash, __pred_)) {
if (__first == __last)
return;
--__last;
@@ -293,8 +279,8 @@ private:
template <class _RandomAccessIterator2>
_LIBCPP_HIDE_FROM_ABI pair<_RandomAccessIterator2, _RandomAccessIterator2>
__search(_RandomAccessIterator2 __f, _RandomAccessIterator2 __l) const {
- _RandomAccessIterator2 __current = __f;
- const _RandomAccessIterator2 __last = __l - __pattern_length_;
+ _RandomAccessIterator2 __current = __f;
+ const _RandomAccessIterator2 __last = __l - __pattern_length_;
const __skip_table_type& __skip_table = *__skip_table_;
while (__current <= __last) {
diff --git a/contrib/llvm-project/libcxx/include/__functional/compose.h b/contrib/llvm-project/libcxx/include/__functional/compose.h
index af207e7cbafb..4b86dd37cd48 100644
--- a/contrib/llvm-project/libcxx/include/__functional/compose.h
+++ b/contrib/llvm-project/libcxx/include/__functional/compose.h
@@ -25,25 +25,26 @@ _LIBCPP_BEGIN_NAMESPACE_STD
#if _LIBCPP_STD_VER >= 20
struct __compose_op {
- template<class _Fn1, class _Fn2, class ..._Args>
- _LIBCPP_HIDE_FROM_ABI
- constexpr auto operator()(_Fn1&& __f1, _Fn2&& __f2, _Args&&... __args) const
- noexcept(noexcept(std::invoke(std::forward<_Fn1>(__f1), std::invoke(std::forward<_Fn2>(__f2), std::forward<_Args>(__args)...))))
- -> decltype( std::invoke(std::forward<_Fn1>(__f1), std::invoke(std::forward<_Fn2>(__f2), std::forward<_Args>(__args)...)))
- { return std::invoke(std::forward<_Fn1>(__f1), std::invoke(std::forward<_Fn2>(__f2), std::forward<_Args>(__args)...)); }
+ template <class _Fn1, class _Fn2, class... _Args>
+ _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Fn1&& __f1, _Fn2&& __f2, _Args&&... __args) const noexcept(noexcept(
+ std::invoke(std::forward<_Fn1>(__f1), std::invoke(std::forward<_Fn2>(__f2), std::forward<_Args>(__args)...))))
+ -> decltype(std::invoke(std::forward<_Fn1>(__f1),
+ std::invoke(std::forward<_Fn2>(__f2), std::forward<_Args>(__args)...))) {
+ return std::invoke(std::forward<_Fn1>(__f1), std::invoke(std::forward<_Fn2>(__f2), std::forward<_Args>(__args)...));
+ }
};
template <class _Fn1, class _Fn2>
struct __compose_t : __perfect_forward<__compose_op, _Fn1, _Fn2> {
- using __perfect_forward<__compose_op, _Fn1, _Fn2>::__perfect_forward;
+ using __perfect_forward<__compose_op, _Fn1, _Fn2>::__perfect_forward;
};
template <class _Fn1, class _Fn2>
-_LIBCPP_HIDE_FROM_ABI
-constexpr auto __compose(_Fn1&& __f1, _Fn2&& __f2)
- noexcept(noexcept(__compose_t<decay_t<_Fn1>, decay_t<_Fn2>>(std::forward<_Fn1>(__f1), std::forward<_Fn2>(__f2))))
- -> decltype( __compose_t<decay_t<_Fn1>, decay_t<_Fn2>>(std::forward<_Fn1>(__f1), std::forward<_Fn2>(__f2)))
- { return __compose_t<decay_t<_Fn1>, decay_t<_Fn2>>(std::forward<_Fn1>(__f1), std::forward<_Fn2>(__f2)); }
+_LIBCPP_HIDE_FROM_ABI constexpr auto __compose(_Fn1&& __f1, _Fn2&& __f2) noexcept(
+ noexcept(__compose_t<decay_t<_Fn1>, decay_t<_Fn2>>(std::forward<_Fn1>(__f1), std::forward<_Fn2>(__f2))))
+ -> decltype(__compose_t<decay_t<_Fn1>, decay_t<_Fn2>>(std::forward<_Fn1>(__f1), std::forward<_Fn2>(__f2))) {
+ return __compose_t<decay_t<_Fn1>, decay_t<_Fn2>>(std::forward<_Fn1>(__f1), std::forward<_Fn2>(__f2));
+}
#endif // _LIBCPP_STD_VER >= 20
diff --git a/contrib/llvm-project/libcxx/include/__functional/default_searcher.h b/contrib/llvm-project/libcxx/include/__functional/default_searcher.h
index 21b6de9c34c8..db89d10757c1 100644
--- a/contrib/llvm-project/libcxx/include/__functional/default_searcher.h
+++ b/contrib/llvm-project/libcxx/include/__functional/default_searcher.h
@@ -26,27 +26,24 @@ _LIBCPP_BEGIN_NAMESPACE_STD
#if _LIBCPP_STD_VER >= 17
// default searcher
-template<class _ForwardIterator, class _BinaryPredicate = equal_to<>>
+template <class _ForwardIterator, class _BinaryPredicate = equal_to<>>
class _LIBCPP_TEMPLATE_VIS default_searcher {
public:
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- default_searcher(_ForwardIterator __f, _ForwardIterator __l,
- _BinaryPredicate __p = _BinaryPredicate())
- : __first_(__f), __last_(__l), __pred_(__p) {}
-
- template <typename _ForwardIterator2>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- pair<_ForwardIterator2, _ForwardIterator2>
- operator () (_ForwardIterator2 __f, _ForwardIterator2 __l) const
- {
- auto __proj = __identity();
- return std::__search_impl(__f, __l, __first_, __last_, __pred_, __proj, __proj);
- }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
+ default_searcher(_ForwardIterator __f, _ForwardIterator __l, _BinaryPredicate __p = _BinaryPredicate())
+ : __first_(__f), __last_(__l), __pred_(__p) {}
+
+ template <typename _ForwardIterator2>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 pair<_ForwardIterator2, _ForwardIterator2>
+ operator()(_ForwardIterator2 __f, _ForwardIterator2 __l) const {
+ auto __proj = __identity();
+ return std::__search_impl(__f, __l, __first_, __last_, __pred_, __proj, __proj);
+ }
private:
- _ForwardIterator __first_;
- _ForwardIterator __last_;
- _BinaryPredicate __pred_;
+ _ForwardIterator __first_;
+ _ForwardIterator __last_;
+ _BinaryPredicate __pred_;
};
_LIBCPP_CTAD_SUPPORTED_FOR_TYPE(default_searcher);
diff --git a/contrib/llvm-project/libcxx/include/__functional/function.h b/contrib/llvm-project/libcxx/include/__functional/function.h
index 7cc4cccc26cd..6505bb587173 100644
--- a/contrib/llvm-project/libcxx/include/__functional/function.h
+++ b/contrib/llvm-project/libcxx/include/__functional/function.h
@@ -53,86 +53,77 @@ _LIBCPP_BEGIN_NAMESPACE_STD
_LIBCPP_DIAGNOSTIC_PUSH
_LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Wweak-vtables")
-class _LIBCPP_EXPORTED_FROM_ABI bad_function_call
- : public exception
-{
+class _LIBCPP_EXPORTED_FROM_ABI bad_function_call : public exception {
public:
- _LIBCPP_HIDE_FROM_ABI bad_function_call() _NOEXCEPT = default;
- _LIBCPP_HIDE_FROM_ABI bad_function_call(const bad_function_call&) _NOEXCEPT = default;
- _LIBCPP_HIDE_FROM_ABI bad_function_call& operator=(const bad_function_call&) _NOEXCEPT = default;
+ _LIBCPP_HIDE_FROM_ABI bad_function_call() _NOEXCEPT = default;
+ _LIBCPP_HIDE_FROM_ABI bad_function_call(const bad_function_call&) _NOEXCEPT = default;
+ _LIBCPP_HIDE_FROM_ABI bad_function_call& operator=(const bad_function_call&) _NOEXCEPT = default;
// Note that when a key function is not used, every translation unit that uses
// bad_function_call will end up containing a weak definition of the vtable and
// typeinfo.
-#ifdef _LIBCPP_ABI_BAD_FUNCTION_CALL_KEY_FUNCTION
- ~bad_function_call() _NOEXCEPT override;
-#else
- _LIBCPP_HIDE_FROM_ABI_VIRTUAL ~bad_function_call() _NOEXCEPT override {}
-#endif
-
-#ifdef _LIBCPP_ABI_BAD_FUNCTION_CALL_GOOD_WHAT_MESSAGE
- const char* what() const _NOEXCEPT override;
-#endif
+# ifdef _LIBCPP_ABI_BAD_FUNCTION_CALL_KEY_FUNCTION
+ ~bad_function_call() _NOEXCEPT override;
+# else
+ _LIBCPP_HIDE_FROM_ABI_VIRTUAL ~bad_function_call() _NOEXCEPT override {}
+# endif
+
+# ifdef _LIBCPP_ABI_BAD_FUNCTION_CALL_GOOD_WHAT_MESSAGE
+ const char* what() const _NOEXCEPT override;
+# endif
};
_LIBCPP_DIAGNOSTIC_POP
-_LIBCPP_NORETURN inline _LIBCPP_HIDE_FROM_ABI
-void __throw_bad_function_call()
-{
-#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- throw bad_function_call();
-#else
- _LIBCPP_VERBOSE_ABORT("bad_function_call was thrown in -fno-exceptions mode");
-#endif
+_LIBCPP_NORETURN inline _LIBCPP_HIDE_FROM_ABI void __throw_bad_function_call() {
+# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
+ throw bad_function_call();
+# else
+ _LIBCPP_VERBOSE_ABORT("bad_function_call was thrown in -fno-exceptions mode");
+# endif
}
-template<class _Fp> class _LIBCPP_TEMPLATE_VIS function; // undefined
+template <class _Fp>
+class _LIBCPP_TEMPLATE_VIS function; // undefined
-namespace __function
-{
+namespace __function {
-template<class _Rp>
-struct __maybe_derive_from_unary_function
-{
-};
+template <class _Rp>
+struct __maybe_derive_from_unary_function {};
-template<class _Rp, class _A1>
-struct __maybe_derive_from_unary_function<_Rp(_A1)>
- : public __unary_function<_A1, _Rp>
-{
-};
+template <class _Rp, class _A1>
+struct __maybe_derive_from_unary_function<_Rp(_A1)> : public __unary_function<_A1, _Rp> {};
-template<class _Rp>
-struct __maybe_derive_from_binary_function
-{
-};
+template <class _Rp>
+struct __maybe_derive_from_binary_function {};
-template<class _Rp, class _A1, class _A2>
-struct __maybe_derive_from_binary_function<_Rp(_A1, _A2)>
- : public __binary_function<_A1, _A2, _Rp>
-{
-};
+template <class _Rp, class _A1, class _A2>
+struct __maybe_derive_from_binary_function<_Rp(_A1, _A2)> : public __binary_function<_A1, _A2, _Rp> {};
template <class _Fp>
-_LIBCPP_HIDE_FROM_ABI
-bool __not_null(_Fp const&) { return true; }
+_LIBCPP_HIDE_FROM_ABI bool __not_null(_Fp const&) {
+ return true;
+}
template <class _Fp>
-_LIBCPP_HIDE_FROM_ABI
-bool __not_null(_Fp* __ptr) { return __ptr; }
+_LIBCPP_HIDE_FROM_ABI bool __not_null(_Fp* __ptr) {
+ return __ptr;
+}
template <class _Ret, class _Class>
-_LIBCPP_HIDE_FROM_ABI
-bool __not_null(_Ret _Class::*__ptr) { return __ptr; }
+_LIBCPP_HIDE_FROM_ABI bool __not_null(_Ret _Class::*__ptr) {
+ return __ptr;
+}
template <class _Fp>
-_LIBCPP_HIDE_FROM_ABI
-bool __not_null(function<_Fp> const& __f) { return !!__f; }
+_LIBCPP_HIDE_FROM_ABI bool __not_null(function<_Fp> const& __f) {
+ return !!__f;
+}
-#ifdef _LIBCPP_HAS_EXTENSION_BLOCKS
-template <class _Rp, class ..._Args>
-_LIBCPP_HIDE_FROM_ABI
-bool __not_null(_Rp (^__p)(_Args...)) { return __p; }
-#endif
+# ifdef _LIBCPP_HAS_EXTENSION_BLOCKS
+template <class _Rp, class... _Args>
+_LIBCPP_HIDE_FROM_ABI bool __not_null(_Rp (^__p)(_Args...)) {
+ return __p;
+}
+# endif
} // namespace __function
@@ -140,84 +131,60 @@ namespace __function {
// __alloc_func holds a functor and an allocator.
-template <class _Fp, class _Ap, class _FB> class __alloc_func;
+template <class _Fp, class _Ap, class _FB>
+class __alloc_func;
template <class _Fp, class _FB>
class __default_alloc_func;
template <class _Fp, class _Ap, class _Rp, class... _ArgTypes>
-class __alloc_func<_Fp, _Ap, _Rp(_ArgTypes...)>
-{
- __compressed_pair<_Fp, _Ap> __f_;
-
- public:
- typedef _LIBCPP_NODEBUG _Fp _Target;
- typedef _LIBCPP_NODEBUG _Ap _Alloc;
-
- _LIBCPP_HIDE_FROM_ABI
- const _Target& __target() const { return __f_.first(); }
-
- // WIN32 APIs may define __allocator, so use __get_allocator instead.
- _LIBCPP_HIDE_FROM_ABI
- const _Alloc& __get_allocator() const { return __f_.second(); }
-
- _LIBCPP_HIDE_FROM_ABI
- explicit __alloc_func(_Target&& __f)
- : __f_(piecewise_construct, std::forward_as_tuple(std::move(__f)),
- std::forward_as_tuple())
- {
- }
+class __alloc_func<_Fp, _Ap, _Rp(_ArgTypes...)> {
+ __compressed_pair<_Fp, _Ap> __f_;
- _LIBCPP_HIDE_FROM_ABI
- explicit __alloc_func(const _Target& __f, const _Alloc& __a)
- : __f_(piecewise_construct, std::forward_as_tuple(__f),
- std::forward_as_tuple(__a))
- {
- }
+public:
+ typedef _LIBCPP_NODEBUG _Fp _Target;
+ typedef _LIBCPP_NODEBUG _Ap _Alloc;
- _LIBCPP_HIDE_FROM_ABI
- explicit __alloc_func(const _Target& __f, _Alloc&& __a)
- : __f_(piecewise_construct, std::forward_as_tuple(__f),
- std::forward_as_tuple(std::move(__a)))
- {
- }
+ _LIBCPP_HIDE_FROM_ABI const _Target& __target() const { return __f_.first(); }
- _LIBCPP_HIDE_FROM_ABI
- explicit __alloc_func(_Target&& __f, _Alloc&& __a)
- : __f_(piecewise_construct, std::forward_as_tuple(std::move(__f)),
- std::forward_as_tuple(std::move(__a)))
- {
- }
+ // WIN32 APIs may define __allocator, so use __get_allocator instead.
+ _LIBCPP_HIDE_FROM_ABI const _Alloc& __get_allocator() const { return __f_.second(); }
- _LIBCPP_HIDE_FROM_ABI
- _Rp operator()(_ArgTypes&&... __arg)
- {
- typedef __invoke_void_return_wrapper<_Rp> _Invoker;
- return _Invoker::__call(__f_.first(),
- std::forward<_ArgTypes>(__arg)...);
- }
+ _LIBCPP_HIDE_FROM_ABI explicit __alloc_func(_Target&& __f)
+ : __f_(piecewise_construct, std::forward_as_tuple(std::move(__f)), std::forward_as_tuple()) {}
- _LIBCPP_HIDE_FROM_ABI
- __alloc_func* __clone() const
- {
- typedef allocator_traits<_Alloc> __alloc_traits;
- typedef __rebind_alloc<__alloc_traits, __alloc_func> _AA;
- _AA __a(__f_.second());
- typedef __allocator_destructor<_AA> _Dp;
- unique_ptr<__alloc_func, _Dp> __hold(__a.allocate(1), _Dp(__a, 1));
- ::new ((void*)__hold.get()) __alloc_func(__f_.first(), _Alloc(__a));
- return __hold.release();
- }
+ _LIBCPP_HIDE_FROM_ABI explicit __alloc_func(const _Target& __f, const _Alloc& __a)
+ : __f_(piecewise_construct, std::forward_as_tuple(__f), std::forward_as_tuple(__a)) {}
- _LIBCPP_HIDE_FROM_ABI
- void destroy() _NOEXCEPT { __f_.~__compressed_pair<_Target, _Alloc>(); }
+ _LIBCPP_HIDE_FROM_ABI explicit __alloc_func(const _Target& __f, _Alloc&& __a)
+ : __f_(piecewise_construct, std::forward_as_tuple(__f), std::forward_as_tuple(std::move(__a))) {}
- _LIBCPP_HIDE_FROM_ABI static void __destroy_and_delete(__alloc_func* __f) {
- typedef allocator_traits<_Alloc> __alloc_traits;
- typedef __rebind_alloc<__alloc_traits, __alloc_func> _FunAlloc;
- _FunAlloc __a(__f->__get_allocator());
- __f->destroy();
- __a.deallocate(__f, 1);
- }
+ _LIBCPP_HIDE_FROM_ABI explicit __alloc_func(_Target&& __f, _Alloc&& __a)
+ : __f_(piecewise_construct, std::forward_as_tuple(std::move(__f)), std::forward_as_tuple(std::move(__a))) {}
+
+ _LIBCPP_HIDE_FROM_ABI _Rp operator()(_ArgTypes&&... __arg) {
+ typedef __invoke_void_return_wrapper<_Rp> _Invoker;
+ return _Invoker::__call(__f_.first(), std::forward<_ArgTypes>(__arg)...);
+ }
+
+ _LIBCPP_HIDE_FROM_ABI __alloc_func* __clone() const {
+ typedef allocator_traits<_Alloc> __alloc_traits;
+ typedef __rebind_alloc<__alloc_traits, __alloc_func> _AA;
+ _AA __a(__f_.second());
+ typedef __allocator_destructor<_AA> _Dp;
+ unique_ptr<__alloc_func, _Dp> __hold(__a.allocate(1), _Dp(__a, 1));
+ ::new ((void*)__hold.get()) __alloc_func(__f_.first(), _Alloc(__a));
+ return __hold.release();
+ }
+
+ _LIBCPP_HIDE_FROM_ABI void destroy() _NOEXCEPT { __f_.~__compressed_pair<_Target, _Alloc>(); }
+
+ _LIBCPP_HIDE_FROM_ABI static void __destroy_and_delete(__alloc_func* __f) {
+ typedef allocator_traits<_Alloc> __alloc_traits;
+ typedef __rebind_alloc<__alloc_traits, __alloc_func> _FunAlloc;
+ _FunAlloc __a(__f->__get_allocator());
+ __f->destroy();
+ __a.deallocate(__f, 1);
+ }
};
template <class _Fp, class _Rp, class... _ArgTypes>
@@ -227,454 +194,377 @@ class __default_alloc_func<_Fp, _Rp(_ArgTypes...)> {
public:
typedef _LIBCPP_NODEBUG _Fp _Target;
- _LIBCPP_HIDE_FROM_ABI
- const _Target& __target() const { return __f_; }
+ _LIBCPP_HIDE_FROM_ABI const _Target& __target() const { return __f_; }
- _LIBCPP_HIDE_FROM_ABI
- explicit __default_alloc_func(_Target&& __f) : __f_(std::move(__f)) {}
+ _LIBCPP_HIDE_FROM_ABI explicit __default_alloc_func(_Target&& __f) : __f_(std::move(__f)) {}
- _LIBCPP_HIDE_FROM_ABI
- explicit __default_alloc_func(const _Target& __f) : __f_(__f) {}
+ _LIBCPP_HIDE_FROM_ABI explicit __default_alloc_func(const _Target& __f) : __f_(__f) {}
- _LIBCPP_HIDE_FROM_ABI
- _Rp operator()(_ArgTypes&&... __arg) {
+ _LIBCPP_HIDE_FROM_ABI _Rp operator()(_ArgTypes&&... __arg) {
typedef __invoke_void_return_wrapper<_Rp> _Invoker;
return _Invoker::__call(__f_, std::forward<_ArgTypes>(__arg)...);
}
- _LIBCPP_HIDE_FROM_ABI
- __default_alloc_func* __clone() const {
- __builtin_new_allocator::__holder_t __hold =
- __builtin_new_allocator::__allocate_type<__default_alloc_func>(1);
- __default_alloc_func* __res =
- ::new ((void*)__hold.get()) __default_alloc_func(__f_);
+ _LIBCPP_HIDE_FROM_ABI __default_alloc_func* __clone() const {
+ __builtin_new_allocator::__holder_t __hold = __builtin_new_allocator::__allocate_type<__default_alloc_func>(1);
+ __default_alloc_func* __res = ::new ((void*)__hold.get()) __default_alloc_func(__f_);
(void)__hold.release();
return __res;
}
- _LIBCPP_HIDE_FROM_ABI
- void destroy() _NOEXCEPT { __f_.~_Target(); }
+ _LIBCPP_HIDE_FROM_ABI void destroy() _NOEXCEPT { __f_.~_Target(); }
_LIBCPP_HIDE_FROM_ABI static void __destroy_and_delete(__default_alloc_func* __f) {
__f->destroy();
- __builtin_new_allocator::__deallocate_type<__default_alloc_func>(__f, 1);
+ __builtin_new_allocator::__deallocate_type<__default_alloc_func>(__f, 1);
}
};
// __base provides an abstract interface for copyable functors.
-template<class _Fp> class _LIBCPP_TEMPLATE_VIS __base;
+template <class _Fp>
+class _LIBCPP_TEMPLATE_VIS __base;
+
+template <class _Rp, class... _ArgTypes>
+class __base<_Rp(_ArgTypes...)> {
+ __base(const __base&);
+ __base& operator=(const __base&);
-template<class _Rp, class ..._ArgTypes>
-class __base<_Rp(_ArgTypes...)>
-{
- __base(const __base&);
- __base& operator=(const __base&);
public:
- _LIBCPP_HIDE_FROM_ABI __base() {}
- _LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual ~__base() {}
- virtual __base* __clone() const = 0;
- virtual void __clone(__base*) const = 0;
- virtual void destroy() _NOEXCEPT = 0;
- virtual void destroy_deallocate() _NOEXCEPT = 0;
- virtual _Rp operator()(_ArgTypes&& ...) = 0;
-#ifndef _LIBCPP_HAS_NO_RTTI
- virtual const void* target(const type_info&) const _NOEXCEPT = 0;
- virtual const std::type_info& target_type() const _NOEXCEPT = 0;
-#endif // _LIBCPP_HAS_NO_RTTI
+ _LIBCPP_HIDE_FROM_ABI __base() {}
+ _LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual ~__base() {}
+ virtual __base* __clone() const = 0;
+ virtual void __clone(__base*) const = 0;
+ virtual void destroy() _NOEXCEPT = 0;
+ virtual void destroy_deallocate() _NOEXCEPT = 0;
+ virtual _Rp operator()(_ArgTypes&&...) = 0;
+# ifndef _LIBCPP_HAS_NO_RTTI
+ virtual const void* target(const type_info&) const _NOEXCEPT = 0;
+ virtual const std::type_info& target_type() const _NOEXCEPT = 0;
+# endif // _LIBCPP_HAS_NO_RTTI
};
// __func implements __base for a given functor type.
-template<class _FD, class _Alloc, class _FB> class __func;
+template <class _FD, class _Alloc, class _FB>
+class __func;
+
+template <class _Fp, class _Alloc, class _Rp, class... _ArgTypes>
+class __func<_Fp, _Alloc, _Rp(_ArgTypes...)> : public __base<_Rp(_ArgTypes...)> {
+ __alloc_func<_Fp, _Alloc, _Rp(_ArgTypes...)> __f_;
-template<class _Fp, class _Alloc, class _Rp, class ..._ArgTypes>
-class __func<_Fp, _Alloc, _Rp(_ArgTypes...)>
- : public __base<_Rp(_ArgTypes...)>
-{
- __alloc_func<_Fp, _Alloc, _Rp(_ArgTypes...)> __f_;
public:
- _LIBCPP_HIDE_FROM_ABI
- explicit __func(_Fp&& __f)
- : __f_(std::move(__f)) {}
-
- _LIBCPP_HIDE_FROM_ABI
- explicit __func(const _Fp& __f, const _Alloc& __a)
- : __f_(__f, __a) {}
-
- _LIBCPP_HIDE_FROM_ABI
- explicit __func(const _Fp& __f, _Alloc&& __a)
- : __f_(__f, std::move(__a)) {}
-
- _LIBCPP_HIDE_FROM_ABI
- explicit __func(_Fp&& __f, _Alloc&& __a)
- : __f_(std::move(__f), std::move(__a)) {}
-
- _LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual __base<_Rp(_ArgTypes...)>* __clone() const;
- _LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual void __clone(__base<_Rp(_ArgTypes...)>*) const;
- _LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual void destroy() _NOEXCEPT;
- _LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual void destroy_deallocate() _NOEXCEPT;
- _LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual _Rp operator()(_ArgTypes&&... __arg);
-#ifndef _LIBCPP_HAS_NO_RTTI
- _LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual const void* target(const type_info&) const _NOEXCEPT;
- _LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual const std::type_info& target_type() const _NOEXCEPT;
-#endif // _LIBCPP_HAS_NO_RTTI
+ _LIBCPP_HIDE_FROM_ABI explicit __func(_Fp&& __f) : __f_(std::move(__f)) {}
+
+ _LIBCPP_HIDE_FROM_ABI explicit __func(const _Fp& __f, const _Alloc& __a) : __f_(__f, __a) {}
+
+ _LIBCPP_HIDE_FROM_ABI explicit __func(const _Fp& __f, _Alloc&& __a) : __f_(__f, std::move(__a)) {}
+
+ _LIBCPP_HIDE_FROM_ABI explicit __func(_Fp&& __f, _Alloc&& __a) : __f_(std::move(__f), std::move(__a)) {}
+
+ _LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual __base<_Rp(_ArgTypes...)>* __clone() const;
+ _LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual void __clone(__base<_Rp(_ArgTypes...)>*) const;
+ _LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual void destroy() _NOEXCEPT;
+ _LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual void destroy_deallocate() _NOEXCEPT;
+ _LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual _Rp operator()(_ArgTypes&&... __arg);
+# ifndef _LIBCPP_HAS_NO_RTTI
+ _LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual const void* target(const type_info&) const _NOEXCEPT;
+ _LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual const std::type_info& target_type() const _NOEXCEPT;
+# endif // _LIBCPP_HAS_NO_RTTI
};
-template<class _Fp, class _Alloc, class _Rp, class ..._ArgTypes>
-__base<_Rp(_ArgTypes...)>*
-__func<_Fp, _Alloc, _Rp(_ArgTypes...)>::__clone() const
-{
- typedef allocator_traits<_Alloc> __alloc_traits;
- typedef __rebind_alloc<__alloc_traits, __func> _Ap;
- _Ap __a(__f_.__get_allocator());
- typedef __allocator_destructor<_Ap> _Dp;
- unique_ptr<__func, _Dp> __hold(__a.allocate(1), _Dp(__a, 1));
- ::new ((void*)__hold.get()) __func(__f_.__target(), _Alloc(__a));
- return __hold.release();
+template <class _Fp, class _Alloc, class _Rp, class... _ArgTypes>
+__base<_Rp(_ArgTypes...)>* __func<_Fp, _Alloc, _Rp(_ArgTypes...)>::__clone() const {
+ typedef allocator_traits<_Alloc> __alloc_traits;
+ typedef __rebind_alloc<__alloc_traits, __func> _Ap;
+ _Ap __a(__f_.__get_allocator());
+ typedef __allocator_destructor<_Ap> _Dp;
+ unique_ptr<__func, _Dp> __hold(__a.allocate(1), _Dp(__a, 1));
+ ::new ((void*)__hold.get()) __func(__f_.__target(), _Alloc(__a));
+ return __hold.release();
}
-template<class _Fp, class _Alloc, class _Rp, class ..._ArgTypes>
-void
-__func<_Fp, _Alloc, _Rp(_ArgTypes...)>::__clone(__base<_Rp(_ArgTypes...)>* __p) const
-{
- ::new ((void*)__p) __func(__f_.__target(), __f_.__get_allocator());
+template <class _Fp, class _Alloc, class _Rp, class... _ArgTypes>
+void __func<_Fp, _Alloc, _Rp(_ArgTypes...)>::__clone(__base<_Rp(_ArgTypes...)>* __p) const {
+ ::new ((void*)__p) __func(__f_.__target(), __f_.__get_allocator());
}
-template<class _Fp, class _Alloc, class _Rp, class ..._ArgTypes>
-void
-__func<_Fp, _Alloc, _Rp(_ArgTypes...)>::destroy() _NOEXCEPT
-{
- __f_.destroy();
+template <class _Fp, class _Alloc, class _Rp, class... _ArgTypes>
+void __func<_Fp, _Alloc, _Rp(_ArgTypes...)>::destroy() _NOEXCEPT {
+ __f_.destroy();
}
-template<class _Fp, class _Alloc, class _Rp, class ..._ArgTypes>
-void
-__func<_Fp, _Alloc, _Rp(_ArgTypes...)>::destroy_deallocate() _NOEXCEPT
-{
- typedef allocator_traits<_Alloc> __alloc_traits;
- typedef __rebind_alloc<__alloc_traits, __func> _Ap;
- _Ap __a(__f_.__get_allocator());
- __f_.destroy();
- __a.deallocate(this, 1);
+template <class _Fp, class _Alloc, class _Rp, class... _ArgTypes>
+void __func<_Fp, _Alloc, _Rp(_ArgTypes...)>::destroy_deallocate() _NOEXCEPT {
+ typedef allocator_traits<_Alloc> __alloc_traits;
+ typedef __rebind_alloc<__alloc_traits, __func> _Ap;
+ _Ap __a(__f_.__get_allocator());
+ __f_.destroy();
+ __a.deallocate(this, 1);
}
-template<class _Fp, class _Alloc, class _Rp, class ..._ArgTypes>
-_Rp
-__func<_Fp, _Alloc, _Rp(_ArgTypes...)>::operator()(_ArgTypes&& ... __arg)
-{
- return __f_(std::forward<_ArgTypes>(__arg)...);
+template <class _Fp, class _Alloc, class _Rp, class... _ArgTypes>
+_Rp __func<_Fp, _Alloc, _Rp(_ArgTypes...)>::operator()(_ArgTypes&&... __arg) {
+ return __f_(std::forward<_ArgTypes>(__arg)...);
}
-#ifndef _LIBCPP_HAS_NO_RTTI
+# ifndef _LIBCPP_HAS_NO_RTTI
-template<class _Fp, class _Alloc, class _Rp, class ..._ArgTypes>
-const void*
-__func<_Fp, _Alloc, _Rp(_ArgTypes...)>::target(const type_info& __ti) const _NOEXCEPT
-{
- if (__ti == typeid(_Fp))
- return std::addressof(__f_.__target());
- return nullptr;
+template <class _Fp, class _Alloc, class _Rp, class... _ArgTypes>
+const void* __func<_Fp, _Alloc, _Rp(_ArgTypes...)>::target(const type_info& __ti) const _NOEXCEPT {
+ if (__ti == typeid(_Fp))
+ return std::addressof(__f_.__target());
+ return nullptr;
}
-template<class _Fp, class _Alloc, class _Rp, class ..._ArgTypes>
-const std::type_info&
-__func<_Fp, _Alloc, _Rp(_ArgTypes...)>::target_type() const _NOEXCEPT
-{
- return typeid(_Fp);
+template <class _Fp, class _Alloc, class _Rp, class... _ArgTypes>
+const std::type_info& __func<_Fp, _Alloc, _Rp(_ArgTypes...)>::target_type() const _NOEXCEPT {
+ return typeid(_Fp);
}
-#endif // _LIBCPP_HAS_NO_RTTI
+# endif // _LIBCPP_HAS_NO_RTTI
// __value_func creates a value-type from a __func.
-template <class _Fp> class __value_func;
+template <class _Fp>
+class __value_func;
-template <class _Rp, class... _ArgTypes> class __value_func<_Rp(_ArgTypes...)>
-{
- _LIBCPP_SUPPRESS_DEPRECATED_PUSH
- typename aligned_storage<3 * sizeof(void*)>::type __buf_;
- _LIBCPP_SUPPRESS_DEPRECATED_POP
+template <class _Rp, class... _ArgTypes>
+class __value_func<_Rp(_ArgTypes...)> {
+ _LIBCPP_SUPPRESS_DEPRECATED_PUSH
+ typename aligned_storage<3 * sizeof(void*)>::type __buf_;
+ _LIBCPP_SUPPRESS_DEPRECATED_POP
- typedef __base<_Rp(_ArgTypes...)> __func;
- __func* __f_;
+ typedef __base<_Rp(_ArgTypes...)> __func;
+ __func* __f_;
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_NO_CFI static __func* __as_base(void* __p)
- {
- return reinterpret_cast<__func*>(__p);
- }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_NO_CFI static __func* __as_base(void* __p) { return reinterpret_cast<__func*>(__p); }
- public:
- _LIBCPP_HIDE_FROM_ABI
- __value_func() _NOEXCEPT : __f_(nullptr) {}
-
- template <class _Fp, class _Alloc>
- _LIBCPP_HIDE_FROM_ABI __value_func(_Fp&& __f, const _Alloc& __a)
- : __f_(nullptr)
- {
- typedef allocator_traits<_Alloc> __alloc_traits;
- typedef __function::__func<_Fp, _Alloc, _Rp(_ArgTypes...)> _Fun;
- typedef __rebind_alloc<__alloc_traits, _Fun> _FunAlloc;
-
- if (__function::__not_null(__f))
- {
- _FunAlloc __af(__a);
- if (sizeof(_Fun) <= sizeof(__buf_) &&
- is_nothrow_copy_constructible<_Fp>::value &&
- is_nothrow_copy_constructible<_FunAlloc>::value)
- {
- __f_ =
- ::new ((void*)&__buf_) _Fun(std::move(__f), _Alloc(__af));
- }
- else
- {
- typedef __allocator_destructor<_FunAlloc> _Dp;
- unique_ptr<__func, _Dp> __hold(__af.allocate(1), _Dp(__af, 1));
- ::new ((void*)__hold.get()) _Fun(std::move(__f), _Alloc(__a));
- __f_ = __hold.release();
- }
- }
- }
+public:
+ _LIBCPP_HIDE_FROM_ABI __value_func() _NOEXCEPT : __f_(nullptr) {}
- template <class _Fp, __enable_if_t<!is_same<__decay_t<_Fp>, __value_func>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI explicit __value_func(_Fp&& __f)
- : __value_func(std::forward<_Fp>(__f), allocator<_Fp>()) {}
-
- _LIBCPP_HIDE_FROM_ABI
- __value_func(const __value_func& __f)
- {
- if (__f.__f_ == nullptr)
- __f_ = nullptr;
- else if ((void*)__f.__f_ == &__f.__buf_)
- {
- __f_ = __as_base(&__buf_);
- __f.__f_->__clone(__f_);
- }
- else
- __f_ = __f.__f_->__clone();
+ template <class _Fp, class _Alloc>
+ _LIBCPP_HIDE_FROM_ABI __value_func(_Fp&& __f, const _Alloc& __a) : __f_(nullptr) {
+ typedef allocator_traits<_Alloc> __alloc_traits;
+ typedef __function::__func<_Fp, _Alloc, _Rp(_ArgTypes...)> _Fun;
+ typedef __rebind_alloc<__alloc_traits, _Fun> _FunAlloc;
+
+ if (__function::__not_null(__f)) {
+ _FunAlloc __af(__a);
+ if (sizeof(_Fun) <= sizeof(__buf_) && is_nothrow_copy_constructible<_Fp>::value &&
+ is_nothrow_copy_constructible<_FunAlloc>::value) {
+ __f_ = ::new ((void*)&__buf_) _Fun(std::move(__f), _Alloc(__af));
+ } else {
+ typedef __allocator_destructor<_FunAlloc> _Dp;
+ unique_ptr<__func, _Dp> __hold(__af.allocate(1), _Dp(__af, 1));
+ ::new ((void*)__hold.get()) _Fun(std::move(__f), _Alloc(__a));
+ __f_ = __hold.release();
+ }
}
+ }
- _LIBCPP_HIDE_FROM_ABI
- __value_func(__value_func&& __f) _NOEXCEPT
- {
- if (__f.__f_ == nullptr)
- __f_ = nullptr;
- else if ((void*)__f.__f_ == &__f.__buf_)
- {
- __f_ = __as_base(&__buf_);
- __f.__f_->__clone(__f_);
- }
- else
- {
- __f_ = __f.__f_;
- __f.__f_ = nullptr;
- }
- }
+ template <class _Fp, __enable_if_t<!is_same<__decay_t<_Fp>, __value_func>::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI explicit __value_func(_Fp&& __f) : __value_func(std::forward<_Fp>(__f), allocator<_Fp>()) {}
+
+ _LIBCPP_HIDE_FROM_ABI __value_func(const __value_func& __f) {
+ if (__f.__f_ == nullptr)
+ __f_ = nullptr;
+ else if ((void*)__f.__f_ == &__f.__buf_) {
+ __f_ = __as_base(&__buf_);
+ __f.__f_->__clone(__f_);
+ } else
+ __f_ = __f.__f_->__clone();
+ }
- _LIBCPP_HIDE_FROM_ABI
- ~__value_func()
- {
- if ((void*)__f_ == &__buf_)
- __f_->destroy();
- else if (__f_)
- __f_->destroy_deallocate();
+ _LIBCPP_HIDE_FROM_ABI __value_func(__value_func&& __f) _NOEXCEPT {
+ if (__f.__f_ == nullptr)
+ __f_ = nullptr;
+ else if ((void*)__f.__f_ == &__f.__buf_) {
+ __f_ = __as_base(&__buf_);
+ __f.__f_->__clone(__f_);
+ } else {
+ __f_ = __f.__f_;
+ __f.__f_ = nullptr;
}
+ }
- _LIBCPP_HIDE_FROM_ABI
- __value_func& operator=(__value_func&& __f)
- {
- *this = nullptr;
- if (__f.__f_ == nullptr)
- __f_ = nullptr;
- else if ((void*)__f.__f_ == &__f.__buf_)
- {
- __f_ = __as_base(&__buf_);
- __f.__f_->__clone(__f_);
- }
- else
- {
- __f_ = __f.__f_;
- __f.__f_ = nullptr;
- }
- return *this;
- }
+ _LIBCPP_HIDE_FROM_ABI ~__value_func() {
+ if ((void*)__f_ == &__buf_)
+ __f_->destroy();
+ else if (__f_)
+ __f_->destroy_deallocate();
+ }
- _LIBCPP_HIDE_FROM_ABI
- __value_func& operator=(nullptr_t)
- {
- __func* __f = __f_;
- __f_ = nullptr;
- if ((void*)__f == &__buf_)
- __f->destroy();
- else if (__f)
- __f->destroy_deallocate();
- return *this;
+ _LIBCPP_HIDE_FROM_ABI __value_func& operator=(__value_func&& __f) {
+ *this = nullptr;
+ if (__f.__f_ == nullptr)
+ __f_ = nullptr;
+ else if ((void*)__f.__f_ == &__f.__buf_) {
+ __f_ = __as_base(&__buf_);
+ __f.__f_->__clone(__f_);
+ } else {
+ __f_ = __f.__f_;
+ __f.__f_ = nullptr;
}
+ return *this;
+ }
- _LIBCPP_HIDE_FROM_ABI
- _Rp operator()(_ArgTypes&&... __args) const
- {
- if (__f_ == nullptr)
- __throw_bad_function_call();
- return (*__f_)(std::forward<_ArgTypes>(__args)...);
- }
+ _LIBCPP_HIDE_FROM_ABI __value_func& operator=(nullptr_t) {
+ __func* __f = __f_;
+ __f_ = nullptr;
+ if ((void*)__f == &__buf_)
+ __f->destroy();
+ else if (__f)
+ __f->destroy_deallocate();
+ return *this;
+ }
- _LIBCPP_HIDE_FROM_ABI
- void swap(__value_func& __f) _NOEXCEPT
- {
- if (&__f == this)
- return;
- if ((void*)__f_ == &__buf_ && (void*)__f.__f_ == &__f.__buf_)
- {
- _LIBCPP_SUPPRESS_DEPRECATED_PUSH
- typename aligned_storage<sizeof(__buf_)>::type __tempbuf;
- _LIBCPP_SUPPRESS_DEPRECATED_POP
- __func* __t = __as_base(&__tempbuf);
- __f_->__clone(__t);
- __f_->destroy();
- __f_ = nullptr;
- __f.__f_->__clone(__as_base(&__buf_));
- __f.__f_->destroy();
- __f.__f_ = nullptr;
- __f_ = __as_base(&__buf_);
- __t->__clone(__as_base(&__f.__buf_));
- __t->destroy();
- __f.__f_ = __as_base(&__f.__buf_);
- }
- else if ((void*)__f_ == &__buf_)
- {
- __f_->__clone(__as_base(&__f.__buf_));
- __f_->destroy();
- __f_ = __f.__f_;
- __f.__f_ = __as_base(&__f.__buf_);
- }
- else if ((void*)__f.__f_ == &__f.__buf_)
- {
- __f.__f_->__clone(__as_base(&__buf_));
- __f.__f_->destroy();
- __f.__f_ = __f_;
- __f_ = __as_base(&__buf_);
- }
- else
- std::swap(__f_, __f.__f_);
- }
+ _LIBCPP_HIDE_FROM_ABI _Rp operator()(_ArgTypes&&... __args) const {
+ if (__f_ == nullptr)
+ __throw_bad_function_call();
+ return (*__f_)(std::forward<_ArgTypes>(__args)...);
+ }
- _LIBCPP_HIDE_FROM_ABI
- explicit operator bool() const _NOEXCEPT { return __f_ != nullptr; }
+ _LIBCPP_HIDE_FROM_ABI void swap(__value_func& __f) _NOEXCEPT {
+ if (&__f == this)
+ return;
+ if ((void*)__f_ == &__buf_ && (void*)__f.__f_ == &__f.__buf_) {
+ _LIBCPP_SUPPRESS_DEPRECATED_PUSH
+ typename aligned_storage<sizeof(__buf_)>::type __tempbuf;
+ _LIBCPP_SUPPRESS_DEPRECATED_POP
+ __func* __t = __as_base(&__tempbuf);
+ __f_->__clone(__t);
+ __f_->destroy();
+ __f_ = nullptr;
+ __f.__f_->__clone(__as_base(&__buf_));
+ __f.__f_->destroy();
+ __f.__f_ = nullptr;
+ __f_ = __as_base(&__buf_);
+ __t->__clone(__as_base(&__f.__buf_));
+ __t->destroy();
+ __f.__f_ = __as_base(&__f.__buf_);
+ } else if ((void*)__f_ == &__buf_) {
+ __f_->__clone(__as_base(&__f.__buf_));
+ __f_->destroy();
+ __f_ = __f.__f_;
+ __f.__f_ = __as_base(&__f.__buf_);
+ } else if ((void*)__f.__f_ == &__f.__buf_) {
+ __f.__f_->__clone(__as_base(&__buf_));
+ __f.__f_->destroy();
+ __f.__f_ = __f_;
+ __f_ = __as_base(&__buf_);
+ } else
+ std::swap(__f_, __f.__f_);
+ }
-#ifndef _LIBCPP_HAS_NO_RTTI
- _LIBCPP_HIDE_FROM_ABI
- const std::type_info& target_type() const _NOEXCEPT
- {
- if (__f_ == nullptr)
- return typeid(void);
- return __f_->target_type();
- }
+ _LIBCPP_HIDE_FROM_ABI explicit operator bool() const _NOEXCEPT { return __f_ != nullptr; }
- template <typename _Tp>
- _LIBCPP_HIDE_FROM_ABI const _Tp* target() const _NOEXCEPT
- {
- if (__f_ == nullptr)
- return nullptr;
- return (const _Tp*)__f_->target(typeid(_Tp));
- }
-#endif // _LIBCPP_HAS_NO_RTTI
+# ifndef _LIBCPP_HAS_NO_RTTI
+ _LIBCPP_HIDE_FROM_ABI const std::type_info& target_type() const _NOEXCEPT {
+ if (__f_ == nullptr)
+ return typeid(void);
+ return __f_->target_type();
+ }
+
+ template <typename _Tp>
+ _LIBCPP_HIDE_FROM_ABI const _Tp* target() const _NOEXCEPT {
+ if (__f_ == nullptr)
+ return nullptr;
+ return (const _Tp*)__f_->target(typeid(_Tp));
+ }
+# endif // _LIBCPP_HAS_NO_RTTI
};
// Storage for a functor object, to be used with __policy to manage copy and
// destruction.
-union __policy_storage
-{
- mutable char __small[sizeof(void*) * 2];
- void* __large;
+union __policy_storage {
+ mutable char __small[sizeof(void*) * 2];
+ void* __large;
};
// True if _Fun can safely be held in __policy_storage.__small.
template <typename _Fun>
struct __use_small_storage
: public integral_constant<
- bool, sizeof(_Fun) <= sizeof(__policy_storage) &&
- _LIBCPP_ALIGNOF(_Fun) <= _LIBCPP_ALIGNOF(__policy_storage) &&
- is_trivially_copy_constructible<_Fun>::value &&
- is_trivially_destructible<_Fun>::value> {};
+ bool,
+ sizeof(_Fun) <= sizeof(__policy_storage)&& _LIBCPP_ALIGNOF(_Fun) <= _LIBCPP_ALIGNOF(__policy_storage) &&
+ is_trivially_copy_constructible<_Fun>::value && is_trivially_destructible<_Fun>::value> {};
// Policy contains information about how to copy, destroy, and move the
// underlying functor. You can think of it as a vtable of sorts.
-struct __policy
-{
- // Used to copy or destroy __large values. null for trivial objects.
- void* (*const __clone)(const void*);
- void (*const __destroy)(void*);
-
- // True if this is the null policy (no value).
- const bool __is_null;
-
- // The target type. May be null if RTTI is disabled.
- const std::type_info* const __type_info;
-
- // Returns a pointer to a static policy object suitable for the functor
- // type.
- template <typename _Fun>
- _LIBCPP_HIDE_FROM_ABI static const __policy* __create()
- {
- return __choose_policy<_Fun>(__use_small_storage<_Fun>());
- }
+struct __policy {
+ // Used to copy or destroy __large values. null for trivial objects.
+ void* (*const __clone)(const void*);
+ void (*const __destroy)(void*);
+
+ // True if this is the null policy (no value).
+ const bool __is_null;
+
+ // The target type. May be null if RTTI is disabled.
+ const std::type_info* const __type_info;
+
+ // Returns a pointer to a static policy object suitable for the functor
+ // type.
+ template <typename _Fun>
+ _LIBCPP_HIDE_FROM_ABI static const __policy* __create() {
+ return __choose_policy<_Fun>(__use_small_storage<_Fun>());
+ }
- _LIBCPP_HIDE_FROM_ABI
- static const __policy* __create_empty()
- {
- static const _LIBCPP_CONSTEXPR __policy __policy = {nullptr, nullptr,
- true,
-#ifndef _LIBCPP_HAS_NO_RTTI
- &typeid(void)
-#else
- nullptr
-#endif
- };
- return &__policy;
- }
+ _LIBCPP_HIDE_FROM_ABI static const __policy* __create_empty() {
+ static const _LIBCPP_CONSTEXPR __policy __policy = {
+ nullptr,
+ nullptr,
+ true,
+# ifndef _LIBCPP_HAS_NO_RTTI
+ &typeid(void)
+# else
+ nullptr
+# endif
+ };
+ return &__policy;
+ }
- private:
- template <typename _Fun>
- _LIBCPP_HIDE_FROM_ABI static void* __large_clone(const void* __s)
- {
- const _Fun* __f = static_cast<const _Fun*>(__s);
- return __f->__clone();
- }
+private:
+ template <typename _Fun>
+ _LIBCPP_HIDE_FROM_ABI static void* __large_clone(const void* __s) {
+ const _Fun* __f = static_cast<const _Fun*>(__s);
+ return __f->__clone();
+ }
- template <typename _Fun>
- _LIBCPP_HIDE_FROM_ABI static void __large_destroy(void* __s) {
- _Fun::__destroy_and_delete(static_cast<_Fun*>(__s));
- }
+ template <typename _Fun>
+ _LIBCPP_HIDE_FROM_ABI static void __large_destroy(void* __s) {
+ _Fun::__destroy_and_delete(static_cast<_Fun*>(__s));
+ }
- template <typename _Fun>
- _LIBCPP_HIDE_FROM_ABI static const __policy*
- __choose_policy(/* is_small = */ false_type) {
- static const _LIBCPP_CONSTEXPR __policy __policy = {
- &__large_clone<_Fun>, &__large_destroy<_Fun>, false,
-#ifndef _LIBCPP_HAS_NO_RTTI
- &typeid(typename _Fun::_Target)
-#else
- nullptr
-#endif
- };
- return &__policy;
- }
+ template <typename _Fun>
+ _LIBCPP_HIDE_FROM_ABI static const __policy* __choose_policy(/* is_small = */ false_type) {
+ static const _LIBCPP_CONSTEXPR __policy __policy = {
+ &__large_clone<_Fun>,
+ &__large_destroy<_Fun>,
+ false,
+# ifndef _LIBCPP_HAS_NO_RTTI
+ &typeid(typename _Fun::_Target)
+# else
+ nullptr
+# endif
+ };
+ return &__policy;
+ }
- template <typename _Fun>
- _LIBCPP_HIDE_FROM_ABI static const __policy*
- __choose_policy(/* is_small = */ true_type)
- {
- static const _LIBCPP_CONSTEXPR __policy __policy = {
- nullptr, nullptr, false,
-#ifndef _LIBCPP_HAS_NO_RTTI
- &typeid(typename _Fun::_Target)
-#else
- nullptr
-#endif
- };
- return &__policy;
- }
+ template <typename _Fun>
+ _LIBCPP_HIDE_FROM_ABI static const __policy* __choose_policy(/* is_small = */ true_type) {
+ static const _LIBCPP_CONSTEXPR __policy __policy = {
+ nullptr,
+ nullptr,
+ false,
+# ifndef _LIBCPP_HAS_NO_RTTI
+ &typeid(typename _Fun::_Target)
+# else
+ nullptr
+# endif
+ };
+ return &__policy;
+ }
};
// Used to choose between perfect forwarding or pass-by-value. Pass-by-value is
@@ -684,548 +574,459 @@ using __fast_forward = __conditional_t<is_scalar<_Tp>::value, _Tp, _Tp&&>;
// __policy_invoker calls an instance of __alloc_func held in __policy_storage.
-template <class _Fp> struct __policy_invoker;
+template <class _Fp>
+struct __policy_invoker;
template <class _Rp, class... _ArgTypes>
-struct __policy_invoker<_Rp(_ArgTypes...)>
-{
- typedef _Rp (*__Call)(const __policy_storage*,
- __fast_forward<_ArgTypes>...);
-
- __Call __call_;
-
- // Creates an invoker that throws bad_function_call.
- _LIBCPP_HIDE_FROM_ABI
- __policy_invoker() : __call_(&__call_empty) {}
-
- // Creates an invoker that calls the given instance of __func.
- template <typename _Fun>
- _LIBCPP_HIDE_FROM_ABI static __policy_invoker __create()
- {
- return __policy_invoker(&__call_impl<_Fun>);
- }
+struct __policy_invoker<_Rp(_ArgTypes...)> {
+ typedef _Rp (*__Call)(const __policy_storage*, __fast_forward<_ArgTypes>...);
- private:
- _LIBCPP_HIDE_FROM_ABI
- explicit __policy_invoker(__Call __c) : __call_(__c) {}
+ __Call __call_;
- _LIBCPP_HIDE_FROM_ABI static _Rp __call_empty(const __policy_storage*,
- __fast_forward<_ArgTypes>...)
- {
- __throw_bad_function_call();
- }
+ // Creates an invoker that throws bad_function_call.
+ _LIBCPP_HIDE_FROM_ABI __policy_invoker() : __call_(&__call_empty) {}
- template <typename _Fun>
- _LIBCPP_HIDE_FROM_ABI static _Rp __call_impl(const __policy_storage* __buf,
- __fast_forward<_ArgTypes>... __args)
- {
- _Fun* __f = reinterpret_cast<_Fun*>(__use_small_storage<_Fun>::value
- ? &__buf->__small
- : __buf->__large);
- return (*__f)(std::forward<_ArgTypes>(__args)...);
- }
+ // Creates an invoker that calls the given instance of __func.
+ template <typename _Fun>
+ _LIBCPP_HIDE_FROM_ABI static __policy_invoker __create() {
+ return __policy_invoker(&__call_impl<_Fun>);
+ }
+
+private:
+ _LIBCPP_HIDE_FROM_ABI explicit __policy_invoker(__Call __c) : __call_(__c) {}
+
+ _LIBCPP_HIDE_FROM_ABI static _Rp __call_empty(const __policy_storage*, __fast_forward<_ArgTypes>...) {
+ __throw_bad_function_call();
+ }
+
+ template <typename _Fun>
+ _LIBCPP_HIDE_FROM_ABI static _Rp __call_impl(const __policy_storage* __buf, __fast_forward<_ArgTypes>... __args) {
+ _Fun* __f = reinterpret_cast<_Fun*>(__use_small_storage<_Fun>::value ? &__buf->__small : __buf->__large);
+ return (*__f)(std::forward<_ArgTypes>(__args)...);
+ }
};
// __policy_func uses a __policy and __policy_invoker to create a type-erased,
// copyable functor.
-template <class _Fp> class __policy_func;
-
-template <class _Rp, class... _ArgTypes> class __policy_func<_Rp(_ArgTypes...)>
-{
- // Inline storage for small objects.
- __policy_storage __buf_;
-
- // Calls the value stored in __buf_. This could technically be part of
- // policy, but storing it here eliminates a level of indirection inside
- // operator().
- typedef __function::__policy_invoker<_Rp(_ArgTypes...)> __invoker;
- __invoker __invoker_;
-
- // The policy that describes how to move / copy / destroy __buf_. Never
- // null, even if the function is empty.
- const __policy* __policy_;
-
- public:
- _LIBCPP_HIDE_FROM_ABI
- __policy_func() : __policy_(__policy::__create_empty()) {}
-
- template <class _Fp, class _Alloc>
- _LIBCPP_HIDE_FROM_ABI __policy_func(_Fp&& __f, const _Alloc& __a)
- : __policy_(__policy::__create_empty())
- {
- typedef __alloc_func<_Fp, _Alloc, _Rp(_ArgTypes...)> _Fun;
- typedef allocator_traits<_Alloc> __alloc_traits;
- typedef __rebind_alloc<__alloc_traits, _Fun> _FunAlloc;
-
- if (__function::__not_null(__f))
- {
- __invoker_ = __invoker::template __create<_Fun>();
- __policy_ = __policy::__create<_Fun>();
-
- _FunAlloc __af(__a);
- if (__use_small_storage<_Fun>())
- {
- ::new ((void*)&__buf_.__small)
- _Fun(std::move(__f), _Alloc(__af));
- }
- else
- {
- typedef __allocator_destructor<_FunAlloc> _Dp;
- unique_ptr<_Fun, _Dp> __hold(__af.allocate(1), _Dp(__af, 1));
- ::new ((void*)__hold.get())
- _Fun(std::move(__f), _Alloc(__af));
- __buf_.__large = __hold.release();
- }
- }
- }
+template <class _Fp>
+class __policy_func;
+
+template <class _Rp, class... _ArgTypes>
+class __policy_func<_Rp(_ArgTypes...)> {
+ // Inline storage for small objects.
+ __policy_storage __buf_;
+
+ // Calls the value stored in __buf_. This could technically be part of
+ // policy, but storing it here eliminates a level of indirection inside
+ // operator().
+ typedef __function::__policy_invoker<_Rp(_ArgTypes...)> __invoker;
+ __invoker __invoker_;
- template <class _Fp, __enable_if_t<!is_same<__decay_t<_Fp>, __policy_func>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI explicit __policy_func(_Fp&& __f)
- : __policy_(__policy::__create_empty()) {
- typedef __default_alloc_func<_Fp, _Rp(_ArgTypes...)> _Fun;
-
- if (__function::__not_null(__f)) {
- __invoker_ = __invoker::template __create<_Fun>();
- __policy_ = __policy::__create<_Fun>();
- if (__use_small_storage<_Fun>()) {
- ::new ((void*)&__buf_.__small) _Fun(std::move(__f));
- } else {
- __builtin_new_allocator::__holder_t __hold =
- __builtin_new_allocator::__allocate_type<_Fun>(1);
- __buf_.__large = ::new ((void*)__hold.get()) _Fun(std::move(__f));
- (void)__hold.release();
- }
+ // The policy that describes how to move / copy / destroy __buf_. Never
+ // null, even if the function is empty.
+ const __policy* __policy_;
+
+public:
+ _LIBCPP_HIDE_FROM_ABI __policy_func() : __policy_(__policy::__create_empty()) {}
+
+ template <class _Fp, class _Alloc>
+ _LIBCPP_HIDE_FROM_ABI __policy_func(_Fp&& __f, const _Alloc& __a) : __policy_(__policy::__create_empty()) {
+ typedef __alloc_func<_Fp, _Alloc, _Rp(_ArgTypes...)> _Fun;
+ typedef allocator_traits<_Alloc> __alloc_traits;
+ typedef __rebind_alloc<__alloc_traits, _Fun> _FunAlloc;
+
+ if (__function::__not_null(__f)) {
+ __invoker_ = __invoker::template __create<_Fun>();
+ __policy_ = __policy::__create<_Fun>();
+
+ _FunAlloc __af(__a);
+ if (__use_small_storage<_Fun>()) {
+ ::new ((void*)&__buf_.__small) _Fun(std::move(__f), _Alloc(__af));
+ } else {
+ typedef __allocator_destructor<_FunAlloc> _Dp;
+ unique_ptr<_Fun, _Dp> __hold(__af.allocate(1), _Dp(__af, 1));
+ ::new ((void*)__hold.get()) _Fun(std::move(__f), _Alloc(__af));
+ __buf_.__large = __hold.release();
}
}
+ }
- _LIBCPP_HIDE_FROM_ABI
- __policy_func(const __policy_func& __f)
- : __buf_(__f.__buf_), __invoker_(__f.__invoker_),
- __policy_(__f.__policy_)
- {
- if (__policy_->__clone)
- __buf_.__large = __policy_->__clone(__f.__buf_.__large);
+ template <class _Fp, __enable_if_t<!is_same<__decay_t<_Fp>, __policy_func>::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI explicit __policy_func(_Fp&& __f) : __policy_(__policy::__create_empty()) {
+ typedef __default_alloc_func<_Fp, _Rp(_ArgTypes...)> _Fun;
+
+ if (__function::__not_null(__f)) {
+ __invoker_ = __invoker::template __create<_Fun>();
+ __policy_ = __policy::__create<_Fun>();
+ if (__use_small_storage<_Fun>()) {
+ ::new ((void*)&__buf_.__small) _Fun(std::move(__f));
+ } else {
+ __builtin_new_allocator::__holder_t __hold = __builtin_new_allocator::__allocate_type<_Fun>(1);
+ __buf_.__large = ::new ((void*)__hold.get()) _Fun(std::move(__f));
+ (void)__hold.release();
+ }
}
+ }
- _LIBCPP_HIDE_FROM_ABI
- __policy_func(__policy_func&& __f)
- : __buf_(__f.__buf_), __invoker_(__f.__invoker_),
- __policy_(__f.__policy_)
- {
- if (__policy_->__destroy)
- {
- __f.__policy_ = __policy::__create_empty();
- __f.__invoker_ = __invoker();
- }
- }
+ _LIBCPP_HIDE_FROM_ABI __policy_func(const __policy_func& __f)
+ : __buf_(__f.__buf_), __invoker_(__f.__invoker_), __policy_(__f.__policy_) {
+ if (__policy_->__clone)
+ __buf_.__large = __policy_->__clone(__f.__buf_.__large);
+ }
- _LIBCPP_HIDE_FROM_ABI
- ~__policy_func()
- {
- if (__policy_->__destroy)
- __policy_->__destroy(__buf_.__large);
+ _LIBCPP_HIDE_FROM_ABI __policy_func(__policy_func&& __f)
+ : __buf_(__f.__buf_), __invoker_(__f.__invoker_), __policy_(__f.__policy_) {
+ if (__policy_->__destroy) {
+ __f.__policy_ = __policy::__create_empty();
+ __f.__invoker_ = __invoker();
}
+ }
- _LIBCPP_HIDE_FROM_ABI
- __policy_func& operator=(__policy_func&& __f)
- {
- *this = nullptr;
- __buf_ = __f.__buf_;
- __invoker_ = __f.__invoker_;
- __policy_ = __f.__policy_;
- __f.__policy_ = __policy::__create_empty();
- __f.__invoker_ = __invoker();
- return *this;
- }
+ _LIBCPP_HIDE_FROM_ABI ~__policy_func() {
+ if (__policy_->__destroy)
+ __policy_->__destroy(__buf_.__large);
+ }
- _LIBCPP_HIDE_FROM_ABI
- __policy_func& operator=(nullptr_t)
- {
- const __policy* __p = __policy_;
- __policy_ = __policy::__create_empty();
- __invoker_ = __invoker();
- if (__p->__destroy)
- __p->__destroy(__buf_.__large);
- return *this;
- }
+ _LIBCPP_HIDE_FROM_ABI __policy_func& operator=(__policy_func&& __f) {
+ *this = nullptr;
+ __buf_ = __f.__buf_;
+ __invoker_ = __f.__invoker_;
+ __policy_ = __f.__policy_;
+ __f.__policy_ = __policy::__create_empty();
+ __f.__invoker_ = __invoker();
+ return *this;
+ }
- _LIBCPP_HIDE_FROM_ABI
- _Rp operator()(_ArgTypes&&... __args) const
- {
- return __invoker_.__call_(std::addressof(__buf_),
- std::forward<_ArgTypes>(__args)...);
- }
+ _LIBCPP_HIDE_FROM_ABI __policy_func& operator=(nullptr_t) {
+ const __policy* __p = __policy_;
+ __policy_ = __policy::__create_empty();
+ __invoker_ = __invoker();
+ if (__p->__destroy)
+ __p->__destroy(__buf_.__large);
+ return *this;
+ }
- _LIBCPP_HIDE_FROM_ABI
- void swap(__policy_func& __f)
- {
- std::swap(__invoker_, __f.__invoker_);
- std::swap(__policy_, __f.__policy_);
- std::swap(__buf_, __f.__buf_);
- }
+ _LIBCPP_HIDE_FROM_ABI _Rp operator()(_ArgTypes&&... __args) const {
+ return __invoker_.__call_(std::addressof(__buf_), std::forward<_ArgTypes>(__args)...);
+ }
- _LIBCPP_HIDE_FROM_ABI
- explicit operator bool() const _NOEXCEPT
- {
- return !__policy_->__is_null;
- }
+ _LIBCPP_HIDE_FROM_ABI void swap(__policy_func& __f) {
+ std::swap(__invoker_, __f.__invoker_);
+ std::swap(__policy_, __f.__policy_);
+ std::swap(__buf_, __f.__buf_);
+ }
-#ifndef _LIBCPP_HAS_NO_RTTI
- _LIBCPP_HIDE_FROM_ABI
- const std::type_info& target_type() const _NOEXCEPT
- {
- return *__policy_->__type_info;
- }
+ _LIBCPP_HIDE_FROM_ABI explicit operator bool() const _NOEXCEPT { return !__policy_->__is_null; }
- template <typename _Tp>
- _LIBCPP_HIDE_FROM_ABI const _Tp* target() const _NOEXCEPT
- {
- if (__policy_->__is_null || typeid(_Tp) != *__policy_->__type_info)
- return nullptr;
- if (__policy_->__clone) // Out of line storage.
- return reinterpret_cast<const _Tp*>(__buf_.__large);
- else
- return reinterpret_cast<const _Tp*>(&__buf_.__small);
- }
-#endif // _LIBCPP_HAS_NO_RTTI
+# ifndef _LIBCPP_HAS_NO_RTTI
+ _LIBCPP_HIDE_FROM_ABI const std::type_info& target_type() const _NOEXCEPT { return *__policy_->__type_info; }
+
+ template <typename _Tp>
+ _LIBCPP_HIDE_FROM_ABI const _Tp* target() const _NOEXCEPT {
+ if (__policy_->__is_null || typeid(_Tp) != *__policy_->__type_info)
+ return nullptr;
+ if (__policy_->__clone) // Out of line storage.
+ return reinterpret_cast<const _Tp*>(__buf_.__large);
+ else
+ return reinterpret_cast<const _Tp*>(&__buf_.__small);
+ }
+# endif // _LIBCPP_HAS_NO_RTTI
};
-#if defined(_LIBCPP_HAS_BLOCKS_RUNTIME)
+# if defined(_LIBCPP_HAS_BLOCKS_RUNTIME)
-extern "C" void *_Block_copy(const void *);
-extern "C" void _Block_release(const void *);
+extern "C" void* _Block_copy(const void*);
+extern "C" void _Block_release(const void*);
-template<class _Rp1, class ..._ArgTypes1, class _Alloc, class _Rp, class ..._ArgTypes>
-class __func<_Rp1(^)(_ArgTypes1...), _Alloc, _Rp(_ArgTypes...)>
- : public __base<_Rp(_ArgTypes...)>
-{
- typedef _Rp1(^__block_type)(_ArgTypes1...);
- __block_type __f_;
+template <class _Rp1, class... _ArgTypes1, class _Alloc, class _Rp, class... _ArgTypes>
+class __func<_Rp1 (^)(_ArgTypes1...), _Alloc, _Rp(_ArgTypes...)> : public __base<_Rp(_ArgTypes...)> {
+ typedef _Rp1 (^__block_type)(_ArgTypes1...);
+ __block_type __f_;
public:
- _LIBCPP_HIDE_FROM_ABI
- explicit __func(__block_type const& __f)
-#ifdef _LIBCPP_HAS_OBJC_ARC
- : __f_(__f)
-#else
- : __f_(reinterpret_cast<__block_type>(__f ? _Block_copy(__f) : nullptr))
-#endif
- { }
+ _LIBCPP_HIDE_FROM_ABI explicit __func(__block_type const& __f)
+# ifdef _LIBCPP_HAS_OBJC_ARC
+ : __f_(__f)
+# else
+ : __f_(reinterpret_cast<__block_type>(__f ? _Block_copy(__f) : nullptr))
+# endif
+ {
+ }
- // [TODO] add && to save on a retain
+ // [TODO] add && to save on a retain
- _LIBCPP_HIDE_FROM_ABI
- explicit __func(__block_type __f, const _Alloc& /* unused */)
-#ifdef _LIBCPP_HAS_OBJC_ARC
- : __f_(__f)
-#else
- : __f_(reinterpret_cast<__block_type>(__f ? _Block_copy(__f) : nullptr))
-#endif
- { }
-
- virtual __base<_Rp(_ArgTypes...)>* __clone() const {
- _LIBCPP_ASSERT_INTERNAL(false,
- "Block pointers are just pointers, so they should always fit into "
- "std::function's small buffer optimization. This function should "
- "never be invoked.");
- return nullptr;
- }
+ _LIBCPP_HIDE_FROM_ABI explicit __func(__block_type __f, const _Alloc& /* unused */)
+# ifdef _LIBCPP_HAS_OBJC_ARC
+ : __f_(__f)
+# else
+ : __f_(reinterpret_cast<__block_type>(__f ? _Block_copy(__f) : nullptr))
+# endif
+ {
+ }
- virtual void __clone(__base<_Rp(_ArgTypes...)>* __p) const {
- ::new ((void*)__p) __func(__f_);
- }
+ virtual __base<_Rp(_ArgTypes...)>* __clone() const {
+ _LIBCPP_ASSERT_INTERNAL(
+ false,
+ "Block pointers are just pointers, so they should always fit into "
+ "std::function's small buffer optimization. This function should "
+ "never be invoked.");
+ return nullptr;
+ }
- virtual void destroy() _NOEXCEPT {
-#ifndef _LIBCPP_HAS_OBJC_ARC
- if (__f_)
- _Block_release(__f_);
-#endif
- __f_ = 0;
- }
+ virtual void __clone(__base<_Rp(_ArgTypes...)>* __p) const { ::new ((void*)__p) __func(__f_); }
- virtual void destroy_deallocate() _NOEXCEPT {
- _LIBCPP_ASSERT_INTERNAL(false,
- "Block pointers are just pointers, so they should always fit into "
- "std::function's small buffer optimization. This function should "
- "never be invoked.");
- }
+ virtual void destroy() _NOEXCEPT {
+# ifndef _LIBCPP_HAS_OBJC_ARC
+ if (__f_)
+ _Block_release(__f_);
+# endif
+ __f_ = 0;
+ }
- virtual _Rp operator()(_ArgTypes&& ... __arg) {
- return std::__invoke(__f_, std::forward<_ArgTypes>(__arg)...);
- }
+ virtual void destroy_deallocate() _NOEXCEPT {
+ _LIBCPP_ASSERT_INTERNAL(
+ false,
+ "Block pointers are just pointers, so they should always fit into "
+ "std::function's small buffer optimization. This function should "
+ "never be invoked.");
+ }
-#ifndef _LIBCPP_HAS_NO_RTTI
- virtual const void* target(type_info const& __ti) const _NOEXCEPT {
- if (__ti == typeid(__func::__block_type))
- return &__f_;
- return (const void*)nullptr;
- }
+ virtual _Rp operator()(_ArgTypes&&... __arg) { return std::__invoke(__f_, std::forward<_ArgTypes>(__arg)...); }
- virtual const std::type_info& target_type() const _NOEXCEPT {
- return typeid(__func::__block_type);
- }
-#endif // _LIBCPP_HAS_NO_RTTI
+# ifndef _LIBCPP_HAS_NO_RTTI
+ virtual const void* target(type_info const& __ti) const _NOEXCEPT {
+ if (__ti == typeid(__func::__block_type))
+ return &__f_;
+ return (const void*)nullptr;
+ }
+
+ virtual const std::type_info& target_type() const _NOEXCEPT { return typeid(__func::__block_type); }
+# endif // _LIBCPP_HAS_NO_RTTI
};
-#endif // _LIBCPP_HAS_EXTENSION_BLOCKS
+# endif // _LIBCPP_HAS_EXTENSION_BLOCKS
} // namespace __function
-template<class _Rp, class ..._ArgTypes>
+template <class _Rp, class... _ArgTypes>
class _LIBCPP_TEMPLATE_VIS function<_Rp(_ArgTypes...)>
: public __function::__maybe_derive_from_unary_function<_Rp(_ArgTypes...)>,
- public __function::__maybe_derive_from_binary_function<_Rp(_ArgTypes...)>
-{
-#ifndef _LIBCPP_ABI_OPTIMIZED_FUNCTION
- typedef __function::__value_func<_Rp(_ArgTypes...)> __func;
-#else
- typedef __function::__policy_func<_Rp(_ArgTypes...)> __func;
-#endif
-
- __func __f_;
-
- template <class _Fp, bool = _And<
- _IsNotSame<__remove_cvref_t<_Fp>, function>,
- __invokable<_Fp, _ArgTypes...>
- >::value>
- struct __callable;
- template <class _Fp>
- struct __callable<_Fp, true>
- {
- static const bool value = is_void<_Rp>::value ||
- __is_core_convertible<typename __invoke_of<_Fp, _ArgTypes...>::type,
- _Rp>::value;
- };
- template <class _Fp>
- struct __callable<_Fp, false>
- {
- static const bool value = false;
- };
+ public __function::__maybe_derive_from_binary_function<_Rp(_ArgTypes...)> {
+# ifndef _LIBCPP_ABI_OPTIMIZED_FUNCTION
+ typedef __function::__value_func<_Rp(_ArgTypes...)> __func;
+# else
+ typedef __function::__policy_func<_Rp(_ArgTypes...)> __func;
+# endif
+
+ __func __f_;
+
+ template <class _Fp,
+ bool = _And< _IsNotSame<__remove_cvref_t<_Fp>, function>, __invokable<_Fp, _ArgTypes...> >::value>
+ struct __callable;
+ template <class _Fp>
+ struct __callable<_Fp, true> {
+ static const bool value =
+ is_void<_Rp>::value || __is_core_convertible<typename __invoke_of<_Fp, _ArgTypes...>::type, _Rp>::value;
+ };
+ template <class _Fp>
+ struct __callable<_Fp, false> {
+ static const bool value = false;
+ };
template <class _Fp>
using _EnableIfLValueCallable = __enable_if_t<__callable<_Fp&>::value>;
-public:
- typedef _Rp result_type;
-
- // construct/copy/destroy:
- _LIBCPP_HIDE_FROM_ABI
- function() _NOEXCEPT { }
- _LIBCPP_HIDE_FROM_ABI
- _LIBCPP_HIDE_FROM_ABI function(nullptr_t) _NOEXCEPT {}
- _LIBCPP_HIDE_FROM_ABI function(const function&);
- _LIBCPP_HIDE_FROM_ABI function(function&&) _NOEXCEPT;
- template<class _Fp, class = _EnableIfLValueCallable<_Fp>>
- _LIBCPP_HIDE_FROM_ABI function(_Fp);
-
-#if _LIBCPP_STD_VER <= 14
- template<class _Alloc>
- _LIBCPP_HIDE_FROM_ABI
- function(allocator_arg_t, const _Alloc&) _NOEXCEPT {}
- template<class _Alloc>
- _LIBCPP_HIDE_FROM_ABI
- function(allocator_arg_t, const _Alloc&, nullptr_t) _NOEXCEPT {}
- template<class _Alloc>
- _LIBCPP_HIDE_FROM_ABI function(allocator_arg_t, const _Alloc&, const function&);
- template<class _Alloc>
- _LIBCPP_HIDE_FROM_ABI function(allocator_arg_t, const _Alloc&, function&&);
- template<class _Fp, class _Alloc, class = _EnableIfLValueCallable<_Fp>>
- _LIBCPP_HIDE_FROM_ABI function(allocator_arg_t, const _Alloc& __a, _Fp __f);
-#endif
- _LIBCPP_HIDE_FROM_ABI function& operator=(const function&);
- _LIBCPP_HIDE_FROM_ABI function& operator=(function&&) _NOEXCEPT;
- _LIBCPP_HIDE_FROM_ABI function& operator=(nullptr_t) _NOEXCEPT;
- template<class _Fp, class = _EnableIfLValueCallable<__decay_t<_Fp>>>
- _LIBCPP_HIDE_FROM_ABI function& operator=(_Fp&&);
-
- _LIBCPP_HIDE_FROM_ABI ~function();
-
- // function modifiers:
- _LIBCPP_HIDE_FROM_ABI void swap(function&) _NOEXCEPT;
+public:
+ typedef _Rp result_type;
+
+ // construct/copy/destroy:
+ _LIBCPP_HIDE_FROM_ABI function() _NOEXCEPT {}
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_HIDE_FROM_ABI function(nullptr_t) _NOEXCEPT {}
+ _LIBCPP_HIDE_FROM_ABI function(const function&);
+ _LIBCPP_HIDE_FROM_ABI function(function&&) _NOEXCEPT;
+ template <class _Fp, class = _EnableIfLValueCallable<_Fp>>
+ _LIBCPP_HIDE_FROM_ABI function(_Fp);
+
+# if _LIBCPP_STD_VER <= 14
+ template <class _Alloc>
+ _LIBCPP_HIDE_FROM_ABI function(allocator_arg_t, const _Alloc&) _NOEXCEPT {}
+ template <class _Alloc>
+ _LIBCPP_HIDE_FROM_ABI function(allocator_arg_t, const _Alloc&, nullptr_t) _NOEXCEPT {}
+ template <class _Alloc>
+ _LIBCPP_HIDE_FROM_ABI function(allocator_arg_t, const _Alloc&, const function&);
+ template <class _Alloc>
+ _LIBCPP_HIDE_FROM_ABI function(allocator_arg_t, const _Alloc&, function&&);
+ template <class _Fp, class _Alloc, class = _EnableIfLValueCallable<_Fp>>
+ _LIBCPP_HIDE_FROM_ABI function(allocator_arg_t, const _Alloc& __a, _Fp __f);
+# endif
+
+ _LIBCPP_HIDE_FROM_ABI function& operator=(const function&);
+ _LIBCPP_HIDE_FROM_ABI function& operator=(function&&) _NOEXCEPT;
+ _LIBCPP_HIDE_FROM_ABI function& operator=(nullptr_t) _NOEXCEPT;
+ template <class _Fp, class = _EnableIfLValueCallable<__decay_t<_Fp>>>
+ _LIBCPP_HIDE_FROM_ABI function& operator=(_Fp&&);
+
+ _LIBCPP_HIDE_FROM_ABI ~function();
+
+ // function modifiers:
+ _LIBCPP_HIDE_FROM_ABI void swap(function&) _NOEXCEPT;
+
+# if _LIBCPP_STD_VER <= 14
+ template <class _Fp, class _Alloc>
+ _LIBCPP_HIDE_FROM_ABI void assign(_Fp&& __f, const _Alloc& __a) {
+ function(allocator_arg, __a, std::forward<_Fp>(__f)).swap(*this);
+ }
+# endif
-#if _LIBCPP_STD_VER <= 14
- template<class _Fp, class _Alloc>
- _LIBCPP_HIDE_FROM_ABI
- void assign(_Fp&& __f, const _Alloc& __a)
- {function(allocator_arg, __a, std::forward<_Fp>(__f)).swap(*this);}
-#endif
+ // function capacity:
+ _LIBCPP_HIDE_FROM_ABI explicit operator bool() const _NOEXCEPT { return static_cast<bool>(__f_); }
- // function capacity:
- _LIBCPP_HIDE_FROM_ABI
- explicit operator bool() const _NOEXCEPT {
- return static_cast<bool>(__f_);
- }
+ // deleted overloads close possible hole in the type system
+ template <class _R2, class... _ArgTypes2>
+ bool operator==(const function<_R2(_ArgTypes2...)>&) const = delete;
+# if _LIBCPP_STD_VER <= 17
+ template <class _R2, class... _ArgTypes2>
+ bool operator!=(const function<_R2(_ArgTypes2...)>&) const = delete;
+# endif
- // deleted overloads close possible hole in the type system
- template<class _R2, class... _ArgTypes2>
- bool operator==(const function<_R2(_ArgTypes2...)>&) const = delete;
-#if _LIBCPP_STD_VER <= 17
- template<class _R2, class... _ArgTypes2>
- bool operator!=(const function<_R2(_ArgTypes2...)>&) const = delete;
-#endif
public:
- // function invocation:
- _LIBCPP_HIDE_FROM_ABI _Rp operator()(_ArgTypes...) const;
-
-#ifndef _LIBCPP_HAS_NO_RTTI
- // function target access:
- _LIBCPP_HIDE_FROM_ABI const std::type_info& target_type() const _NOEXCEPT;
- template <typename _Tp>
- _LIBCPP_HIDE_FROM_ABI _Tp* target() _NOEXCEPT;
- template <typename _Tp>
- _LIBCPP_HIDE_FROM_ABI const _Tp* target() const _NOEXCEPT;
-#endif // _LIBCPP_HAS_NO_RTTI
+ // function invocation:
+ _LIBCPP_HIDE_FROM_ABI _Rp operator()(_ArgTypes...) const;
+
+# ifndef _LIBCPP_HAS_NO_RTTI
+ // function target access:
+ _LIBCPP_HIDE_FROM_ABI const std::type_info& target_type() const _NOEXCEPT;
+ template <typename _Tp>
+ _LIBCPP_HIDE_FROM_ABI _Tp* target() _NOEXCEPT;
+ template <typename _Tp>
+ _LIBCPP_HIDE_FROM_ABI const _Tp* target() const _NOEXCEPT;
+# endif // _LIBCPP_HAS_NO_RTTI
};
-#if _LIBCPP_STD_VER >= 17
-template<class _Rp, class ..._Ap>
-function(_Rp(*)(_Ap...)) -> function<_Rp(_Ap...)>;
+# if _LIBCPP_STD_VER >= 17
+template <class _Rp, class... _Ap>
+function(_Rp (*)(_Ap...)) -> function<_Rp(_Ap...)>;
-template<class _Fp, class _Stripped = typename __strip_signature<decltype(&_Fp::operator())>::type>
+template <class _Fp, class _Stripped = typename __strip_signature<decltype(&_Fp::operator())>::type>
function(_Fp) -> function<_Stripped>;
-#endif // _LIBCPP_STD_VER >= 17
+# endif // _LIBCPP_STD_VER >= 17
-template<class _Rp, class ..._ArgTypes>
+template <class _Rp, class... _ArgTypes>
function<_Rp(_ArgTypes...)>::function(const function& __f) : __f_(__f.__f_) {}
-#if _LIBCPP_STD_VER <= 14
-template<class _Rp, class ..._ArgTypes>
+# if _LIBCPP_STD_VER <= 14
+template <class _Rp, class... _ArgTypes>
template <class _Alloc>
-function<_Rp(_ArgTypes...)>::function(allocator_arg_t, const _Alloc&,
- const function& __f) : __f_(__f.__f_) {}
-#endif
+function<_Rp(_ArgTypes...)>::function(allocator_arg_t, const _Alloc&, const function& __f) : __f_(__f.__f_) {}
+# endif
template <class _Rp, class... _ArgTypes>
-function<_Rp(_ArgTypes...)>::function(function&& __f) _NOEXCEPT
- : __f_(std::move(__f.__f_)) {}
+function<_Rp(_ArgTypes...)>::function(function&& __f) _NOEXCEPT : __f_(std::move(__f.__f_)) {}
-#if _LIBCPP_STD_VER <= 14
-template<class _Rp, class ..._ArgTypes>
+# if _LIBCPP_STD_VER <= 14
+template <class _Rp, class... _ArgTypes>
template <class _Alloc>
-function<_Rp(_ArgTypes...)>::function(allocator_arg_t, const _Alloc&,
- function&& __f)
- : __f_(std::move(__f.__f_)) {}
-#endif
+function<_Rp(_ArgTypes...)>::function(allocator_arg_t, const _Alloc&, function&& __f) : __f_(std::move(__f.__f_)) {}
+# endif
template <class _Rp, class... _ArgTypes>
template <class _Fp, class>
function<_Rp(_ArgTypes...)>::function(_Fp __f) : __f_(std::move(__f)) {}
-#if _LIBCPP_STD_VER <= 14
+# if _LIBCPP_STD_VER <= 14
template <class _Rp, class... _ArgTypes>
template <class _Fp, class _Alloc, class>
-function<_Rp(_ArgTypes...)>::function(allocator_arg_t, const _Alloc& __a,
- _Fp __f)
- : __f_(std::move(__f), __a) {}
-#endif
+function<_Rp(_ArgTypes...)>::function(allocator_arg_t, const _Alloc& __a, _Fp __f) : __f_(std::move(__f), __a) {}
+# endif
-template<class _Rp, class ..._ArgTypes>
-function<_Rp(_ArgTypes...)>&
-function<_Rp(_ArgTypes...)>::operator=(const function& __f)
-{
- function(__f).swap(*this);
- return *this;
+template <class _Rp, class... _ArgTypes>
+function<_Rp(_ArgTypes...)>& function<_Rp(_ArgTypes...)>::operator=(const function& __f) {
+ function(__f).swap(*this);
+ return *this;
}
-template<class _Rp, class ..._ArgTypes>
-function<_Rp(_ArgTypes...)>&
-function<_Rp(_ArgTypes...)>::operator=(function&& __f) _NOEXCEPT
-{
- __f_ = std::move(__f.__f_);
- return *this;
+template <class _Rp, class... _ArgTypes>
+function<_Rp(_ArgTypes...)>& function<_Rp(_ArgTypes...)>::operator=(function&& __f) _NOEXCEPT {
+ __f_ = std::move(__f.__f_);
+ return *this;
}
-template<class _Rp, class ..._ArgTypes>
-function<_Rp(_ArgTypes...)>&
-function<_Rp(_ArgTypes...)>::operator=(nullptr_t) _NOEXCEPT
-{
- __f_ = nullptr;
- return *this;
+template <class _Rp, class... _ArgTypes>
+function<_Rp(_ArgTypes...)>& function<_Rp(_ArgTypes...)>::operator=(nullptr_t) _NOEXCEPT {
+ __f_ = nullptr;
+ return *this;
}
-template<class _Rp, class ..._ArgTypes>
+template <class _Rp, class... _ArgTypes>
template <class _Fp, class>
-function<_Rp(_ArgTypes...)>&
-function<_Rp(_ArgTypes...)>::operator=(_Fp&& __f)
-{
- function(std::forward<_Fp>(__f)).swap(*this);
- return *this;
+function<_Rp(_ArgTypes...)>& function<_Rp(_ArgTypes...)>::operator=(_Fp&& __f) {
+ function(std::forward<_Fp>(__f)).swap(*this);
+ return *this;
}
-template<class _Rp, class ..._ArgTypes>
+template <class _Rp, class... _ArgTypes>
function<_Rp(_ArgTypes...)>::~function() {}
-template<class _Rp, class ..._ArgTypes>
-void
-function<_Rp(_ArgTypes...)>::swap(function& __f) _NOEXCEPT
-{
- __f_.swap(__f.__f_);
+template <class _Rp, class... _ArgTypes>
+void function<_Rp(_ArgTypes...)>::swap(function& __f) _NOEXCEPT {
+ __f_.swap(__f.__f_);
}
-template<class _Rp, class ..._ArgTypes>
-_Rp
-function<_Rp(_ArgTypes...)>::operator()(_ArgTypes... __arg) const
-{
- return __f_(std::forward<_ArgTypes>(__arg)...);
+template <class _Rp, class... _ArgTypes>
+_Rp function<_Rp(_ArgTypes...)>::operator()(_ArgTypes... __arg) const {
+ return __f_(std::forward<_ArgTypes>(__arg)...);
}
-#ifndef _LIBCPP_HAS_NO_RTTI
+# ifndef _LIBCPP_HAS_NO_RTTI
-template<class _Rp, class ..._ArgTypes>
-const std::type_info&
-function<_Rp(_ArgTypes...)>::target_type() const _NOEXCEPT
-{
- return __f_.target_type();
+template <class _Rp, class... _ArgTypes>
+const std::type_info& function<_Rp(_ArgTypes...)>::target_type() const _NOEXCEPT {
+ return __f_.target_type();
}
-template<class _Rp, class ..._ArgTypes>
+template <class _Rp, class... _ArgTypes>
template <typename _Tp>
-_Tp*
-function<_Rp(_ArgTypes...)>::target() _NOEXCEPT
-{
- return (_Tp*)(__f_.template target<_Tp>());
+_Tp* function<_Rp(_ArgTypes...)>::target() _NOEXCEPT {
+ return (_Tp*)(__f_.template target<_Tp>());
}
-template<class _Rp, class ..._ArgTypes>
+template <class _Rp, class... _ArgTypes>
template <typename _Tp>
-const _Tp*
-function<_Rp(_ArgTypes...)>::target() const _NOEXCEPT
-{
- return __f_.template target<_Tp>();
+const _Tp* function<_Rp(_ArgTypes...)>::target() const _NOEXCEPT {
+ return __f_.template target<_Tp>();
}
-#endif // _LIBCPP_HAS_NO_RTTI
+# endif // _LIBCPP_HAS_NO_RTTI
template <class _Rp, class... _ArgTypes>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator==(const function<_Rp(_ArgTypes...)>& __f, nullptr_t) _NOEXCEPT {return !__f;}
+inline _LIBCPP_HIDE_FROM_ABI bool operator==(const function<_Rp(_ArgTypes...)>& __f, nullptr_t) _NOEXCEPT {
+ return !__f;
+}
-#if _LIBCPP_STD_VER <= 17
+# if _LIBCPP_STD_VER <= 17
template <class _Rp, class... _ArgTypes>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator==(nullptr_t, const function<_Rp(_ArgTypes...)>& __f) _NOEXCEPT {return !__f;}
+inline _LIBCPP_HIDE_FROM_ABI bool operator==(nullptr_t, const function<_Rp(_ArgTypes...)>& __f) _NOEXCEPT {
+ return !__f;
+}
template <class _Rp, class... _ArgTypes>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator!=(const function<_Rp(_ArgTypes...)>& __f, nullptr_t) _NOEXCEPT {return (bool)__f;}
+inline _LIBCPP_HIDE_FROM_ABI bool operator!=(const function<_Rp(_ArgTypes...)>& __f, nullptr_t) _NOEXCEPT {
+ return (bool)__f;
+}
template <class _Rp, class... _ArgTypes>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator!=(nullptr_t, const function<_Rp(_ArgTypes...)>& __f) _NOEXCEPT {return (bool)__f;}
+inline _LIBCPP_HIDE_FROM_ABI bool operator!=(nullptr_t, const function<_Rp(_ArgTypes...)>& __f) _NOEXCEPT {
+ return (bool)__f;
+}
-#endif // _LIBCPP_STD_VER <= 17
+# endif // _LIBCPP_STD_VER <= 17
template <class _Rp, class... _ArgTypes>
-inline _LIBCPP_HIDE_FROM_ABI
-void
-swap(function<_Rp(_ArgTypes...)>& __x, function<_Rp(_ArgTypes...)>& __y) _NOEXCEPT
-{return __x.swap(__y);}
+inline _LIBCPP_HIDE_FROM_ABI void swap(function<_Rp(_ArgTypes...)>& __x, function<_Rp(_ArgTypes...)>& __y) _NOEXCEPT {
+ return __x.swap(__y);
+}
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__functional/hash.h b/contrib/llvm-project/libcxx/include/__functional/hash.h
index c369e39ce003..ff22055d6915 100644
--- a/contrib/llvm-project/libcxx/include/__functional/hash.h
+++ b/contrib/llvm-project/libcxx/include/__functional/hash.h
@@ -35,133 +35,117 @@
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _Size>
-inline _LIBCPP_HIDE_FROM_ABI
-_Size
-__loadword(const void* __p)
-{
- _Size __r;
- std::memcpy(&__r, __p, sizeof(__r));
- return __r;
+inline _LIBCPP_HIDE_FROM_ABI _Size __loadword(const void* __p) {
+ _Size __r;
+ std::memcpy(&__r, __p, sizeof(__r));
+ return __r;
}
// We use murmur2 when size_t is 32 bits, and cityhash64 when size_t
// is 64 bits. This is because cityhash64 uses 64bit x 64bit
// multiplication, which can be very slow on 32-bit systems.
-template <class _Size, size_t = sizeof(_Size)*__CHAR_BIT__>
+template <class _Size, size_t = sizeof(_Size) * __CHAR_BIT__>
struct __murmur2_or_cityhash;
template <class _Size>
-struct __murmur2_or_cityhash<_Size, 32>
-{
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK
- _Size operator()(const void* __key, _Size __len) const {
- // murmur2
- const _Size __m = 0x5bd1e995;
- const _Size __r = 24;
- _Size __h = __len;
- const unsigned char* __data = static_cast<const unsigned char*>(__key);
- for (; __len >= 4; __data += 4, __len -= 4)
- {
- _Size __k = std::__loadword<_Size>(__data);
- __k *= __m;
- __k ^= __k >> __r;
- __k *= __m;
- __h *= __m;
- __h ^= __k;
- }
- switch (__len)
- {
- case 3:
- __h ^= static_cast<_Size>(__data[2] << 16);
- _LIBCPP_FALLTHROUGH();
- case 2:
- __h ^= static_cast<_Size>(__data[1] << 8);
- _LIBCPP_FALLTHROUGH();
- case 1:
- __h ^= __data[0];
- __h *= __m;
- }
- __h ^= __h >> 13;
+struct __murmur2_or_cityhash<_Size, 32> {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK _Size
+ operator()(const void* __key, _Size __len) const {
+ // murmur2
+ const _Size __m = 0x5bd1e995;
+ const _Size __r = 24;
+ _Size __h = __len;
+ const unsigned char* __data = static_cast<const unsigned char*>(__key);
+ for (; __len >= 4; __data += 4, __len -= 4) {
+ _Size __k = std::__loadword<_Size>(__data);
+ __k *= __m;
+ __k ^= __k >> __r;
+ __k *= __m;
__h *= __m;
- __h ^= __h >> 15;
- return __h;
+ __h ^= __k;
}
+ switch (__len) {
+ case 3:
+ __h ^= static_cast<_Size>(__data[2] << 16);
+ _LIBCPP_FALLTHROUGH();
+ case 2:
+ __h ^= static_cast<_Size>(__data[1] << 8);
+ _LIBCPP_FALLTHROUGH();
+ case 1:
+ __h ^= __data[0];
+ __h *= __m;
+ }
+ __h ^= __h >> 13;
+ __h *= __m;
+ __h ^= __h >> 15;
+ return __h;
+ }
};
template <class _Size>
-struct __murmur2_or_cityhash<_Size, 64>
-{
+struct __murmur2_or_cityhash<_Size, 64> {
// cityhash64
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK
- _Size operator()(const void* __key, _Size __len) const {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK _Size
+ operator()(const void* __key, _Size __len) const {
const char* __s = static_cast<const char*>(__key);
if (__len <= 32) {
- if (__len <= 16) {
+ if (__len <= 16) {
return __hash_len_0_to_16(__s, __len);
- } else {
+ } else {
return __hash_len_17_to_32(__s, __len);
- }
+ }
} else if (__len <= 64) {
- return __hash_len_33_to_64(__s, __len);
+ return __hash_len_33_to_64(__s, __len);
}
// For strings over 64 bytes we hash the end first, and then as we
// loop we keep 56 bytes of state: v, w, x, y, and z.
_Size __x = std::__loadword<_Size>(__s + __len - 40);
- _Size __y = std::__loadword<_Size>(__s + __len - 16) +
- std::__loadword<_Size>(__s + __len - 56);
- _Size __z = __hash_len_16(std::__loadword<_Size>(__s + __len - 48) + __len,
- std::__loadword<_Size>(__s + __len - 24));
+ _Size __y = std::__loadword<_Size>(__s + __len - 16) + std::__loadword<_Size>(__s + __len - 56);
+ _Size __z =
+ __hash_len_16(std::__loadword<_Size>(__s + __len - 48) + __len, std::__loadword<_Size>(__s + __len - 24));
pair<_Size, _Size> __v = __weak_hash_len_32_with_seeds(__s + __len - 64, __len, __z);
pair<_Size, _Size> __w = __weak_hash_len_32_with_seeds(__s + __len - 32, __y + __k1, __x);
- __x = __x * __k1 + std::__loadword<_Size>(__s);
+ __x = __x * __k1 + std::__loadword<_Size>(__s);
// Decrease len to the nearest multiple of 64, and operate on 64-byte chunks.
__len = (__len - 1) & ~static_cast<_Size>(63);
do {
- __x = __rotate(__x + __y + __v.first + std::__loadword<_Size>(__s + 8), 37) * __k1;
- __y = __rotate(__y + __v.second + std::__loadword<_Size>(__s + 48), 42) * __k1;
- __x ^= __w.second;
- __y += __v.first + std::__loadword<_Size>(__s + 40);
- __z = __rotate(__z + __w.first, 33) * __k1;
- __v = __weak_hash_len_32_with_seeds(__s, __v.second * __k1, __x + __w.first);
- __w = __weak_hash_len_32_with_seeds(__s + 32, __z + __w.second,
- __y + std::__loadword<_Size>(__s + 16));
- std::swap(__z, __x);
- __s += 64;
- __len -= 64;
+ __x = __rotate(__x + __y + __v.first + std::__loadword<_Size>(__s + 8), 37) * __k1;
+ __y = __rotate(__y + __v.second + std::__loadword<_Size>(__s + 48), 42) * __k1;
+ __x ^= __w.second;
+ __y += __v.first + std::__loadword<_Size>(__s + 40);
+ __z = __rotate(__z + __w.first, 33) * __k1;
+ __v = __weak_hash_len_32_with_seeds(__s, __v.second * __k1, __x + __w.first);
+ __w = __weak_hash_len_32_with_seeds(__s + 32, __z + __w.second, __y + std::__loadword<_Size>(__s + 16));
+ std::swap(__z, __x);
+ __s += 64;
+ __len -= 64;
} while (__len != 0);
- return __hash_len_16(
- __hash_len_16(__v.first, __w.first) + __shift_mix(__y) * __k1 + __z,
- __hash_len_16(__v.second, __w.second) + __x);
+ return __hash_len_16(__hash_len_16(__v.first, __w.first) + __shift_mix(__y) * __k1 + __z,
+ __hash_len_16(__v.second, __w.second) + __x);
}
- private:
- // Some primes between 2^63 and 2^64.
- static const _Size __k0 = 0xc3a5c85c97cb3127ULL;
- static const _Size __k1 = 0xb492b66fbe98f273ULL;
- static const _Size __k2 = 0x9ae16a3b2f90404fULL;
- static const _Size __k3 = 0xc949d7c7509e6557ULL;
+private:
+ // Some primes between 2^63 and 2^64.
+ static const _Size __k0 = 0xc3a5c85c97cb3127ULL;
+ static const _Size __k1 = 0xb492b66fbe98f273ULL;
+ static const _Size __k2 = 0x9ae16a3b2f90404fULL;
+ static const _Size __k3 = 0xc949d7c7509e6557ULL;
- _LIBCPP_HIDE_FROM_ABI
- static _Size __rotate(_Size __val, int __shift) {
+ _LIBCPP_HIDE_FROM_ABI static _Size __rotate(_Size __val, int __shift) {
return __shift == 0 ? __val : ((__val >> __shift) | (__val << (64 - __shift)));
}
- _LIBCPP_HIDE_FROM_ABI
- static _Size __rotate_by_at_least_1(_Size __val, int __shift) {
+ _LIBCPP_HIDE_FROM_ABI static _Size __rotate_by_at_least_1(_Size __val, int __shift) {
return (__val >> __shift) | (__val << (64 - __shift));
}
- _LIBCPP_HIDE_FROM_ABI
- static _Size __shift_mix(_Size __val) {
- return __val ^ (__val >> 47);
- }
+ _LIBCPP_HIDE_FROM_ABI static _Size __shift_mix(_Size __val) { return __val ^ (__val >> 47); }
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK
- static _Size __hash_len_16(_Size __u, _Size __v) {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK static _Size __hash_len_16(_Size __u, _Size __v) {
const _Size __mul = 0x9ddfea08eb382d69ULL;
- _Size __a = (__u ^ __v) * __mul;
+ _Size __a = (__u ^ __v) * __mul;
__a ^= (__a >> 47);
_Size __b = (__v ^ __a) * __mul;
__b ^= (__b >> 47);
@@ -169,8 +153,8 @@ struct __murmur2_or_cityhash<_Size, 64>
return __b;
}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK
- static _Size __hash_len_0_to_16(const char* __s, _Size __len) {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK static _Size
+ __hash_len_0_to_16(const char* __s, _Size __len) {
if (__len > 8) {
const _Size __a = std::__loadword<_Size>(__s);
const _Size __b = std::__loadword<_Size>(__s + __len - 8);
@@ -189,32 +173,29 @@ struct __murmur2_or_cityhash<_Size, 64>
const unsigned char __a = static_cast<unsigned char>(__s[0]);
const unsigned char __b = static_cast<unsigned char>(__s[__len >> 1]);
const unsigned char __c = static_cast<unsigned char>(__s[__len - 1]);
- const uint32_t __y = static_cast<uint32_t>(__a) +
- (static_cast<uint32_t>(__b) << 8);
- const uint32_t __z = __len + (static_cast<uint32_t>(__c) << 2);
+ const uint32_t __y = static_cast<uint32_t>(__a) + (static_cast<uint32_t>(__b) << 8);
+ const uint32_t __z = __len + (static_cast<uint32_t>(__c) << 2);
return __shift_mix(__y * __k2 ^ __z * __k3) * __k2;
}
return __k2;
}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK
- static _Size __hash_len_17_to_32(const char *__s, _Size __len) {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK static _Size
+ __hash_len_17_to_32(const char* __s, _Size __len) {
const _Size __a = std::__loadword<_Size>(__s) * __k1;
const _Size __b = std::__loadword<_Size>(__s + 8);
const _Size __c = std::__loadword<_Size>(__s + __len - 8) * __k2;
const _Size __d = std::__loadword<_Size>(__s + __len - 16) * __k0;
- return __hash_len_16(__rotate(__a - __b, 43) + __rotate(__c, 30) + __d,
- __a + __rotate(__b ^ __k3, 20) - __c + __len);
+ return __hash_len_16(
+ __rotate(__a - __b, 43) + __rotate(__c, 30) + __d, __a + __rotate(__b ^ __k3, 20) - __c + __len);
}
// Return a 16-byte hash for 48 bytes. Quick and dirty.
// Callers do best to use "random-looking" values for a and b.
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK
- static pair<_Size, _Size> __weak_hash_len_32_with_seeds(
- _Size __w, _Size __x, _Size __y, _Size __z, _Size __a, _Size __b)
- {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK static pair<_Size, _Size>
+ __weak_hash_len_32_with_seeds(_Size __w, _Size __x, _Size __y, _Size __z, _Size __a, _Size __b) {
__a += __w;
- __b = __rotate(__b + __a + __z, 21);
+ __b = __rotate(__b + __a + __z, 21);
const _Size __c = __a;
__a += __x;
__a += __y;
@@ -223,24 +204,22 @@ struct __murmur2_or_cityhash<_Size, 64>
}
// Return a 16-byte hash for s[0] ... s[31], a, and b. Quick and dirty.
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK
- static pair<_Size, _Size> __weak_hash_len_32_with_seeds(
- const char* __s, _Size __a, _Size __b)
- {
- return __weak_hash_len_32_with_seeds(std::__loadword<_Size>(__s),
- std::__loadword<_Size>(__s + 8),
- std::__loadword<_Size>(__s + 16),
- std::__loadword<_Size>(__s + 24),
- __a,
- __b);
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK static pair<_Size, _Size>
+ __weak_hash_len_32_with_seeds(const char* __s, _Size __a, _Size __b) {
+ return __weak_hash_len_32_with_seeds(
+ std::__loadword<_Size>(__s),
+ std::__loadword<_Size>(__s + 8),
+ std::__loadword<_Size>(__s + 16),
+ std::__loadword<_Size>(__s + 24),
+ __a,
+ __b);
}
// Return an 8-byte hash for 33 to 64 bytes.
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK
- static _Size __hash_len_33_to_64(const char *__s, size_t __len) {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK static _Size
+ __hash_len_33_to_64(const char* __s, size_t __len) {
_Size __z = std::__loadword<_Size>(__s + 24);
- _Size __a = std::__loadword<_Size>(__s) +
- (__len + std::__loadword<_Size>(__s + __len - 16)) * __k0;
+ _Size __a = std::__loadword<_Size>(__s) + (__len + std::__loadword<_Size>(__s + __len - 16)) * __k0;
_Size __b = __rotate(__a + __z, 52);
_Size __c = __rotate(__a, 37);
__a += std::__loadword<_Size>(__s + 8);
@@ -248,7 +227,7 @@ struct __murmur2_or_cityhash<_Size, 64>
__a += std::__loadword<_Size>(__s + 16);
_Size __vf = __a + __z;
_Size __vs = __b + __rotate(__a, 31) + __c;
- __a = std::__loadword<_Size>(__s + 16) + std::__loadword<_Size>(__s + __len - 32);
+ __a = std::__loadword<_Size>(__s + 16) + std::__loadword<_Size>(__s + __len - 32);
__z += std::__loadword<_Size>(__s + __len - 8);
__b = __rotate(__a + __z, 52);
__c = __rotate(__a, 37);
@@ -257,7 +236,7 @@ struct __murmur2_or_cityhash<_Size, 64>
__a += std::__loadword<_Size>(__s + __len - 16);
_Size __wf = __a + __z;
_Size __ws = __b + __rotate(__a, 31) + __c;
- _Size __r = __shift_mix((__vf + __ws) * __k2 + (__wf + __vs) * __k0);
+ _Size __r = __shift_mix((__vf + __ws) * __k2 + (__wf + __vs) * __k0);
return __shift_mix(__r * __k0 + __vs) * __k2;
}
};
@@ -266,104 +245,76 @@ template <class _Tp, size_t = sizeof(_Tp) / sizeof(size_t)>
struct __scalar_hash;
template <class _Tp>
-struct __scalar_hash<_Tp, 0>
- : public __unary_function<_Tp, size_t>
-{
- _LIBCPP_HIDE_FROM_ABI
- size_t operator()(_Tp __v) const _NOEXCEPT
- {
- union
- {
- _Tp __t;
- size_t __a;
- } __u;
- __u.__a = 0;
- __u.__t = __v;
- return __u.__a;
- }
+struct __scalar_hash<_Tp, 0> : public __unary_function<_Tp, size_t> {
+ _LIBCPP_HIDE_FROM_ABI size_t operator()(_Tp __v) const _NOEXCEPT {
+ union {
+ _Tp __t;
+ size_t __a;
+ } __u;
+ __u.__a = 0;
+ __u.__t = __v;
+ return __u.__a;
+ }
};
template <class _Tp>
-struct __scalar_hash<_Tp, 1>
- : public __unary_function<_Tp, size_t>
-{
- _LIBCPP_HIDE_FROM_ABI
- size_t operator()(_Tp __v) const _NOEXCEPT
- {
- union
- {
- _Tp __t;
- size_t __a;
- } __u;
- __u.__t = __v;
- return __u.__a;
- }
+struct __scalar_hash<_Tp, 1> : public __unary_function<_Tp, size_t> {
+ _LIBCPP_HIDE_FROM_ABI size_t operator()(_Tp __v) const _NOEXCEPT {
+ union {
+ _Tp __t;
+ size_t __a;
+ } __u;
+ __u.__t = __v;
+ return __u.__a;
+ }
};
template <class _Tp>
-struct __scalar_hash<_Tp, 2>
- : public __unary_function<_Tp, size_t>
-{
- _LIBCPP_HIDE_FROM_ABI
- size_t operator()(_Tp __v) const _NOEXCEPT
- {
- union
- {
- _Tp __t;
- struct
- {
- size_t __a;
- size_t __b;
- } __s;
- } __u;
- __u.__t = __v;
- return __murmur2_or_cityhash<size_t>()(&__u, sizeof(__u));
- }
+struct __scalar_hash<_Tp, 2> : public __unary_function<_Tp, size_t> {
+ _LIBCPP_HIDE_FROM_ABI size_t operator()(_Tp __v) const _NOEXCEPT {
+ union {
+ _Tp __t;
+ struct {
+ size_t __a;
+ size_t __b;
+ } __s;
+ } __u;
+ __u.__t = __v;
+ return __murmur2_or_cityhash<size_t>()(&__u, sizeof(__u));
+ }
};
template <class _Tp>
-struct __scalar_hash<_Tp, 3>
- : public __unary_function<_Tp, size_t>
-{
- _LIBCPP_HIDE_FROM_ABI
- size_t operator()(_Tp __v) const _NOEXCEPT
- {
- union
- {
- _Tp __t;
- struct
- {
- size_t __a;
- size_t __b;
- size_t __c;
- } __s;
- } __u;
- __u.__t = __v;
- return __murmur2_or_cityhash<size_t>()(&__u, sizeof(__u));
- }
+struct __scalar_hash<_Tp, 3> : public __unary_function<_Tp, size_t> {
+ _LIBCPP_HIDE_FROM_ABI size_t operator()(_Tp __v) const _NOEXCEPT {
+ union {
+ _Tp __t;
+ struct {
+ size_t __a;
+ size_t __b;
+ size_t __c;
+ } __s;
+ } __u;
+ __u.__t = __v;
+ return __murmur2_or_cityhash<size_t>()(&__u, sizeof(__u));
+ }
};
template <class _Tp>
-struct __scalar_hash<_Tp, 4>
- : public __unary_function<_Tp, size_t>
-{
- _LIBCPP_HIDE_FROM_ABI
- size_t operator()(_Tp __v) const _NOEXCEPT
- {
- union
- {
- _Tp __t;
- struct
- {
- size_t __a;
- size_t __b;
- size_t __c;
- size_t __d;
- } __s;
- } __u;
- __u.__t = __v;
- return __murmur2_or_cityhash<size_t>()(&__u, sizeof(__u));
- }
+struct __scalar_hash<_Tp, 4> : public __unary_function<_Tp, size_t> {
+ _LIBCPP_HIDE_FROM_ABI size_t operator()(_Tp __v) const _NOEXCEPT {
+ union {
+ _Tp __t;
+ struct {
+ size_t __a;
+ size_t __b;
+ size_t __c;
+ size_t __d;
+ } __s;
+ } __u;
+ __u.__t = __v;
+ return __murmur2_or_cityhash<size_t>()(&__u, sizeof(__u));
+ }
};
struct _PairT {
@@ -371,314 +322,223 @@ struct _PairT {
size_t second;
};
-_LIBCPP_HIDE_FROM_ABI
-inline size_t __hash_combine(size_t __lhs, size_t __rhs) _NOEXCEPT {
- typedef __scalar_hash<_PairT> _HashT;
- const _PairT __p = {__lhs, __rhs};
- return _HashT()(__p);
+_LIBCPP_HIDE_FROM_ABI inline size_t __hash_combine(size_t __lhs, size_t __rhs) _NOEXCEPT {
+ typedef __scalar_hash<_PairT> _HashT;
+ const _PairT __p = {__lhs, __rhs};
+ return _HashT()(__p);
}
-template<class _Tp>
-struct _LIBCPP_TEMPLATE_VIS hash<_Tp*>
- : public __unary_function<_Tp*, size_t>
-{
- _LIBCPP_HIDE_FROM_ABI
- size_t operator()(_Tp* __v) const _NOEXCEPT
- {
- union
- {
- _Tp* __t;
- size_t __a;
- } __u;
- __u.__t = __v;
- return __murmur2_or_cityhash<size_t>()(&__u, sizeof(__u));
- }
+template <class _Tp>
+struct _LIBCPP_TEMPLATE_VIS hash<_Tp*> : public __unary_function<_Tp*, size_t> {
+ _LIBCPP_HIDE_FROM_ABI size_t operator()(_Tp* __v) const _NOEXCEPT {
+ union {
+ _Tp* __t;
+ size_t __a;
+ } __u;
+ __u.__t = __v;
+ return __murmur2_or_cityhash<size_t>()(&__u, sizeof(__u));
+ }
};
template <>
-struct _LIBCPP_TEMPLATE_VIS hash<bool>
- : public __unary_function<bool, size_t>
-{
- _LIBCPP_HIDE_FROM_ABI
- size_t operator()(bool __v) const _NOEXCEPT {return static_cast<size_t>(__v);}
+struct _LIBCPP_TEMPLATE_VIS hash<bool> : public __unary_function<bool, size_t> {
+ _LIBCPP_HIDE_FROM_ABI size_t operator()(bool __v) const _NOEXCEPT { return static_cast<size_t>(__v); }
};
template <>
-struct _LIBCPP_TEMPLATE_VIS hash<char>
- : public __unary_function<char, size_t>
-{
- _LIBCPP_HIDE_FROM_ABI
- size_t operator()(char __v) const _NOEXCEPT {return static_cast<size_t>(__v);}
+struct _LIBCPP_TEMPLATE_VIS hash<char> : public __unary_function<char, size_t> {
+ _LIBCPP_HIDE_FROM_ABI size_t operator()(char __v) const _NOEXCEPT { return static_cast<size_t>(__v); }
};
template <>
-struct _LIBCPP_TEMPLATE_VIS hash<signed char>
- : public __unary_function<signed char, size_t>
-{
- _LIBCPP_HIDE_FROM_ABI
- size_t operator()(signed char __v) const _NOEXCEPT {return static_cast<size_t>(__v);}
+struct _LIBCPP_TEMPLATE_VIS hash<signed char> : public __unary_function<signed char, size_t> {
+ _LIBCPP_HIDE_FROM_ABI size_t operator()(signed char __v) const _NOEXCEPT { return static_cast<size_t>(__v); }
};
template <>
-struct _LIBCPP_TEMPLATE_VIS hash<unsigned char>
- : public __unary_function<unsigned char, size_t>
-{
- _LIBCPP_HIDE_FROM_ABI
- size_t operator()(unsigned char __v) const _NOEXCEPT {return static_cast<size_t>(__v);}
+struct _LIBCPP_TEMPLATE_VIS hash<unsigned char> : public __unary_function<unsigned char, size_t> {
+ _LIBCPP_HIDE_FROM_ABI size_t operator()(unsigned char __v) const _NOEXCEPT { return static_cast<size_t>(__v); }
};
#ifndef _LIBCPP_HAS_NO_CHAR8_T
template <>
-struct _LIBCPP_TEMPLATE_VIS hash<char8_t>
- : public __unary_function<char8_t, size_t>
-{
- _LIBCPP_HIDE_FROM_ABI
- size_t operator()(char8_t __v) const _NOEXCEPT {return static_cast<size_t>(__v);}
+struct _LIBCPP_TEMPLATE_VIS hash<char8_t> : public __unary_function<char8_t, size_t> {
+ _LIBCPP_HIDE_FROM_ABI size_t operator()(char8_t __v) const _NOEXCEPT { return static_cast<size_t>(__v); }
};
#endif // !_LIBCPP_HAS_NO_CHAR8_T
template <>
-struct _LIBCPP_TEMPLATE_VIS hash<char16_t>
- : public __unary_function<char16_t, size_t>
-{
- _LIBCPP_HIDE_FROM_ABI
- size_t operator()(char16_t __v) const _NOEXCEPT {return static_cast<size_t>(__v);}
+struct _LIBCPP_TEMPLATE_VIS hash<char16_t> : public __unary_function<char16_t, size_t> {
+ _LIBCPP_HIDE_FROM_ABI size_t operator()(char16_t __v) const _NOEXCEPT { return static_cast<size_t>(__v); }
};
template <>
-struct _LIBCPP_TEMPLATE_VIS hash<char32_t>
- : public __unary_function<char32_t, size_t>
-{
- _LIBCPP_HIDE_FROM_ABI
- size_t operator()(char32_t __v) const _NOEXCEPT {return static_cast<size_t>(__v);}
+struct _LIBCPP_TEMPLATE_VIS hash<char32_t> : public __unary_function<char32_t, size_t> {
+ _LIBCPP_HIDE_FROM_ABI size_t operator()(char32_t __v) const _NOEXCEPT { return static_cast<size_t>(__v); }
};
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
template <>
-struct _LIBCPP_TEMPLATE_VIS hash<wchar_t>
- : public __unary_function<wchar_t, size_t>
-{
- _LIBCPP_HIDE_FROM_ABI
- size_t operator()(wchar_t __v) const _NOEXCEPT {return static_cast<size_t>(__v);}
+struct _LIBCPP_TEMPLATE_VIS hash<wchar_t> : public __unary_function<wchar_t, size_t> {
+ _LIBCPP_HIDE_FROM_ABI size_t operator()(wchar_t __v) const _NOEXCEPT { return static_cast<size_t>(__v); }
};
#endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS
template <>
-struct _LIBCPP_TEMPLATE_VIS hash<short>
- : public __unary_function<short, size_t>
-{
- _LIBCPP_HIDE_FROM_ABI
- size_t operator()(short __v) const _NOEXCEPT {return static_cast<size_t>(__v);}
+struct _LIBCPP_TEMPLATE_VIS hash<short> : public __unary_function<short, size_t> {
+ _LIBCPP_HIDE_FROM_ABI size_t operator()(short __v) const _NOEXCEPT { return static_cast<size_t>(__v); }
};
template <>
-struct _LIBCPP_TEMPLATE_VIS hash<unsigned short>
- : public __unary_function<unsigned short, size_t>
-{
- _LIBCPP_HIDE_FROM_ABI
- size_t operator()(unsigned short __v) const _NOEXCEPT {return static_cast<size_t>(__v);}
+struct _LIBCPP_TEMPLATE_VIS hash<unsigned short> : public __unary_function<unsigned short, size_t> {
+ _LIBCPP_HIDE_FROM_ABI size_t operator()(unsigned short __v) const _NOEXCEPT { return static_cast<size_t>(__v); }
};
template <>
-struct _LIBCPP_TEMPLATE_VIS hash<int>
- : public __unary_function<int, size_t>
-{
- _LIBCPP_HIDE_FROM_ABI
- size_t operator()(int __v) const _NOEXCEPT {return static_cast<size_t>(__v);}
+struct _LIBCPP_TEMPLATE_VIS hash<int> : public __unary_function<int, size_t> {
+ _LIBCPP_HIDE_FROM_ABI size_t operator()(int __v) const _NOEXCEPT { return static_cast<size_t>(__v); }
};
template <>
-struct _LIBCPP_TEMPLATE_VIS hash<unsigned int>
- : public __unary_function<unsigned int, size_t>
-{
- _LIBCPP_HIDE_FROM_ABI
- size_t operator()(unsigned int __v) const _NOEXCEPT {return static_cast<size_t>(__v);}
+struct _LIBCPP_TEMPLATE_VIS hash<unsigned int> : public __unary_function<unsigned int, size_t> {
+ _LIBCPP_HIDE_FROM_ABI size_t operator()(unsigned int __v) const _NOEXCEPT { return static_cast<size_t>(__v); }
};
template <>
-struct _LIBCPP_TEMPLATE_VIS hash<long>
- : public __unary_function<long, size_t>
-{
- _LIBCPP_HIDE_FROM_ABI
- size_t operator()(long __v) const _NOEXCEPT {return static_cast<size_t>(__v);}
+struct _LIBCPP_TEMPLATE_VIS hash<long> : public __unary_function<long, size_t> {
+ _LIBCPP_HIDE_FROM_ABI size_t operator()(long __v) const _NOEXCEPT { return static_cast<size_t>(__v); }
};
template <>
-struct _LIBCPP_TEMPLATE_VIS hash<unsigned long>
- : public __unary_function<unsigned long, size_t>
-{
- _LIBCPP_HIDE_FROM_ABI
- size_t operator()(unsigned long __v) const _NOEXCEPT {return static_cast<size_t>(__v);}
+struct _LIBCPP_TEMPLATE_VIS hash<unsigned long> : public __unary_function<unsigned long, size_t> {
+ _LIBCPP_HIDE_FROM_ABI size_t operator()(unsigned long __v) const _NOEXCEPT { return static_cast<size_t>(__v); }
};
template <>
-struct _LIBCPP_TEMPLATE_VIS hash<long long>
- : public __scalar_hash<long long>
-{
-};
+struct _LIBCPP_TEMPLATE_VIS hash<long long> : public __scalar_hash<long long> {};
template <>
-struct _LIBCPP_TEMPLATE_VIS hash<unsigned long long>
- : public __scalar_hash<unsigned long long>
-{
-};
+struct _LIBCPP_TEMPLATE_VIS hash<unsigned long long> : public __scalar_hash<unsigned long long> {};
#ifndef _LIBCPP_HAS_NO_INT128
template <>
-struct _LIBCPP_TEMPLATE_VIS hash<__int128_t>
- : public __scalar_hash<__int128_t>
-{
-};
+struct _LIBCPP_TEMPLATE_VIS hash<__int128_t> : public __scalar_hash<__int128_t> {};
template <>
-struct _LIBCPP_TEMPLATE_VIS hash<__uint128_t>
- : public __scalar_hash<__uint128_t>
-{
-};
+struct _LIBCPP_TEMPLATE_VIS hash<__uint128_t> : public __scalar_hash<__uint128_t> {};
#endif
template <>
-struct _LIBCPP_TEMPLATE_VIS hash<float>
- : public __scalar_hash<float>
-{
- _LIBCPP_HIDE_FROM_ABI
- size_t operator()(float __v) const _NOEXCEPT
- {
- // -0.0 and 0.0 should return same hash
- if (__v == 0.0f)
- return 0;
- return __scalar_hash<float>::operator()(__v);
- }
+struct _LIBCPP_TEMPLATE_VIS hash<float> : public __scalar_hash<float> {
+ _LIBCPP_HIDE_FROM_ABI size_t operator()(float __v) const _NOEXCEPT {
+ // -0.0 and 0.0 should return same hash
+ if (__v == 0.0f)
+ return 0;
+ return __scalar_hash<float>::operator()(__v);
+ }
};
template <>
-struct _LIBCPP_TEMPLATE_VIS hash<double>
- : public __scalar_hash<double>
-{
- _LIBCPP_HIDE_FROM_ABI
- size_t operator()(double __v) const _NOEXCEPT
- {
- // -0.0 and 0.0 should return same hash
- if (__v == 0.0)
- return 0;
- return __scalar_hash<double>::operator()(__v);
- }
+struct _LIBCPP_TEMPLATE_VIS hash<double> : public __scalar_hash<double> {
+ _LIBCPP_HIDE_FROM_ABI size_t operator()(double __v) const _NOEXCEPT {
+ // -0.0 and 0.0 should return same hash
+ if (__v == 0.0)
+ return 0;
+ return __scalar_hash<double>::operator()(__v);
+ }
};
template <>
-struct _LIBCPP_TEMPLATE_VIS hash<long double>
- : public __scalar_hash<long double>
-{
- _LIBCPP_HIDE_FROM_ABI
- size_t operator()(long double __v) const _NOEXCEPT
- {
- // -0.0 and 0.0 should return same hash
- if (__v == 0.0L)
- return 0;
+struct _LIBCPP_TEMPLATE_VIS hash<long double> : public __scalar_hash<long double> {
+ _LIBCPP_HIDE_FROM_ABI size_t operator()(long double __v) const _NOEXCEPT {
+ // -0.0 and 0.0 should return same hash
+ if (__v == 0.0L)
+ return 0;
#if defined(__i386__) || (defined(__x86_64__) && defined(__ILP32__))
- // Zero out padding bits
- union
- {
- long double __t;
- struct
- {
- size_t __a;
- size_t __b;
- size_t __c;
- size_t __d;
- } __s;
- } __u;
- __u.__s.__a = 0;
- __u.__s.__b = 0;
- __u.__s.__c = 0;
- __u.__s.__d = 0;
- __u.__t = __v;
- return __u.__s.__a ^ __u.__s.__b ^ __u.__s.__c ^ __u.__s.__d;
+ // Zero out padding bits
+ union {
+ long double __t;
+ struct {
+ size_t __a;
+ size_t __b;
+ size_t __c;
+ size_t __d;
+ } __s;
+ } __u;
+ __u.__s.__a = 0;
+ __u.__s.__b = 0;
+ __u.__s.__c = 0;
+ __u.__s.__d = 0;
+ __u.__t = __v;
+ return __u.__s.__a ^ __u.__s.__b ^ __u.__s.__c ^ __u.__s.__d;
#elif defined(__x86_64__)
- // Zero out padding bits
- union
- {
- long double __t;
- struct
- {
- size_t __a;
- size_t __b;
- } __s;
- } __u;
- __u.__s.__a = 0;
- __u.__s.__b = 0;
- __u.__t = __v;
- return __u.__s.__a ^ __u.__s.__b;
+ // Zero out padding bits
+ union {
+ long double __t;
+ struct {
+ size_t __a;
+ size_t __b;
+ } __s;
+ } __u;
+ __u.__s.__a = 0;
+ __u.__s.__b = 0;
+ __u.__t = __v;
+ return __u.__s.__a ^ __u.__s.__b;
#else
- return __scalar_hash<long double>::operator()(__v);
+ return __scalar_hash<long double>::operator()(__v);
#endif
- }
+ }
};
template <class _Tp, bool = is_enum<_Tp>::value>
-struct _LIBCPP_TEMPLATE_VIS __enum_hash
- : public __unary_function<_Tp, size_t>
-{
- _LIBCPP_HIDE_FROM_ABI
- size_t operator()(_Tp __v) const _NOEXCEPT
- {
- typedef typename underlying_type<_Tp>::type type;
- return hash<type>()(static_cast<type>(__v));
- }
+struct _LIBCPP_TEMPLATE_VIS __enum_hash : public __unary_function<_Tp, size_t> {
+ _LIBCPP_HIDE_FROM_ABI size_t operator()(_Tp __v) const _NOEXCEPT {
+ typedef typename underlying_type<_Tp>::type type;
+ return hash<type>()(static_cast<type>(__v));
+ }
};
template <class _Tp>
struct _LIBCPP_TEMPLATE_VIS __enum_hash<_Tp, false> {
- __enum_hash() = delete;
- __enum_hash(__enum_hash const&) = delete;
- __enum_hash& operator=(__enum_hash const&) = delete;
+ __enum_hash() = delete;
+ __enum_hash(__enum_hash const&) = delete;
+ __enum_hash& operator=(__enum_hash const&) = delete;
};
template <class _Tp>
-struct _LIBCPP_TEMPLATE_VIS hash : public __enum_hash<_Tp>
-{
-};
+struct _LIBCPP_TEMPLATE_VIS hash : public __enum_hash<_Tp> {};
#if _LIBCPP_STD_VER >= 17
template <>
-struct _LIBCPP_TEMPLATE_VIS hash<nullptr_t>
- : public __unary_function<nullptr_t, size_t>
-{
- _LIBCPP_HIDE_FROM_ABI
- size_t operator()(nullptr_t) const _NOEXCEPT {
- return 662607004ull;
- }
+struct _LIBCPP_TEMPLATE_VIS hash<nullptr_t> : public __unary_function<nullptr_t, size_t> {
+ _LIBCPP_HIDE_FROM_ABI size_t operator()(nullptr_t) const _NOEXCEPT { return 662607004ull; }
};
#endif
#ifndef _LIBCPP_CXX03_LANG
template <class _Key, class _Hash>
-using __check_hash_requirements _LIBCPP_NODEBUG = integral_constant<bool,
- is_copy_constructible<_Hash>::value &&
- is_move_constructible<_Hash>::value &&
- __invokable_r<size_t, _Hash, _Key const&>::value
->;
+using __check_hash_requirements _LIBCPP_NODEBUG =
+ integral_constant<bool,
+ is_copy_constructible<_Hash>::value && is_move_constructible<_Hash>::value &&
+ __invokable_r<size_t, _Hash, _Key const&>::value >;
template <class _Key, class _Hash = hash<_Key> >
-using __has_enabled_hash _LIBCPP_NODEBUG = integral_constant<bool,
- __check_hash_requirements<_Key, _Hash>::value &&
- is_default_constructible<_Hash>::value
->;
+using __has_enabled_hash _LIBCPP_NODEBUG =
+ integral_constant<bool, __check_hash_requirements<_Key, _Hash>::value && is_default_constructible<_Hash>::value >;
-#if _LIBCPP_STD_VER >= 17
+# if _LIBCPP_STD_VER >= 17
template <class _Type, class>
using __enable_hash_helper_imp _LIBCPP_NODEBUG = _Type;
-template <class _Type, class ..._Keys>
-using __enable_hash_helper _LIBCPP_NODEBUG = __enable_hash_helper_imp<_Type,
- __enable_if_t<__all<__has_enabled_hash<_Keys>::value...>::value>
->;
-#else
-template <class _Type, class ...>
+template <class _Type, class... _Keys>
+using __enable_hash_helper _LIBCPP_NODEBUG =
+ __enable_hash_helper_imp<_Type, __enable_if_t<__all<__has_enabled_hash<_Keys>::value...>::value> >;
+# else
+template <class _Type, class...>
using __enable_hash_helper _LIBCPP_NODEBUG = _Type;
-#endif
+# endif
#endif // !_LIBCPP_CXX03_LANG
diff --git a/contrib/llvm-project/libcxx/include/__functional/identity.h b/contrib/llvm-project/libcxx/include/__functional/identity.h
index ee92c4130e71..7fbfc6c6249b 100644
--- a/contrib/llvm-project/libcxx/include/__functional/identity.h
+++ b/contrib/llvm-project/libcxx/include/__functional/identity.h
@@ -11,6 +11,7 @@
#define _LIBCPP___FUNCTIONAL_IDENTITY_H
#include <__config>
+#include <__functional/reference_wrapper.h>
#include <__type_traits/integral_constant.h>
#include <__utility/forward.h>
@@ -34,21 +35,28 @@ struct __identity {
template <>
struct __is_identity<__identity> : true_type {};
+template <>
+struct __is_identity<reference_wrapper<__identity> > : true_type {};
+template <>
+struct __is_identity<reference_wrapper<const __identity> > : true_type {};
#if _LIBCPP_STD_VER >= 20
struct identity {
- template<class _Tp>
- _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr _Tp&& operator()(_Tp&& __t) const noexcept
- {
- return std::forward<_Tp>(__t);
- }
+ template <class _Tp>
+ _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr _Tp&& operator()(_Tp&& __t) const noexcept {
+ return std::forward<_Tp>(__t);
+ }
- using is_transparent = void;
+ using is_transparent = void;
};
template <>
struct __is_identity<identity> : true_type {};
+template <>
+struct __is_identity<reference_wrapper<identity> > : true_type {};
+template <>
+struct __is_identity<reference_wrapper<const identity> > : true_type {};
#endif // _LIBCPP_STD_VER >= 20
diff --git a/contrib/llvm-project/libcxx/include/__functional/invoke.h b/contrib/llvm-project/libcxx/include/__functional/invoke.h
index df2f99fe27d6..ef4bf25f0775 100644
--- a/contrib/llvm-project/libcxx/include/__functional/invoke.h
+++ b/contrib/llvm-project/libcxx/include/__functional/invoke.h
@@ -22,12 +22,10 @@ _LIBCPP_BEGIN_NAMESPACE_STD
#if _LIBCPP_STD_VER >= 17
-template <class _Fn, class ..._Args>
+template <class _Fn, class... _Args>
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 invoke_result_t<_Fn, _Args...>
-invoke(_Fn&& __f, _Args&&... __args)
- noexcept(is_nothrow_invocable_v<_Fn, _Args...>)
-{
- return std::__invoke(std::forward<_Fn>(__f), std::forward<_Args>(__args)...);
+invoke(_Fn&& __f, _Args&&... __args) noexcept(is_nothrow_invocable_v<_Fn, _Args...>) {
+ return std::__invoke(std::forward<_Fn>(__f), std::forward<_Args>(__args)...);
}
#endif // _LIBCPP_STD_VER >= 17
@@ -37,17 +35,17 @@ template <class _Result, class _Fn, class... _Args>
requires is_invocable_r_v<_Result, _Fn, _Args...>
_LIBCPP_HIDE_FROM_ABI constexpr _Result
invoke_r(_Fn&& __f, _Args&&... __args) noexcept(is_nothrow_invocable_r_v<_Result, _Fn, _Args...>) {
- if constexpr (is_void_v<_Result>) {
- static_cast<void>(std::invoke(std::forward<_Fn>(__f), std::forward<_Args>(__args)...));
- } else {
- // TODO: Use reference_converts_from_temporary_v once implemented
- // using _ImplicitInvokeResult = invoke_result_t<_Fn, _Args...>;
- // static_assert(!reference_converts_from_temporary_v<_Result, _ImplicitInvokeResult>,
- static_assert(true,
- "Returning from invoke_r would bind a temporary object to the reference return type, "
- "which would result in a dangling reference.");
- return std::invoke(std::forward<_Fn>(__f), std::forward<_Args>(__args)...);
- }
+ if constexpr (is_void_v<_Result>) {
+ static_cast<void>(std::invoke(std::forward<_Fn>(__f), std::forward<_Args>(__args)...));
+ } else {
+ // TODO: Use reference_converts_from_temporary_v once implemented
+ // using _ImplicitInvokeResult = invoke_result_t<_Fn, _Args...>;
+ // static_assert(!reference_converts_from_temporary_v<_Result, _ImplicitInvokeResult>,
+ static_assert(true,
+ "Returning from invoke_r would bind a temporary object to the reference return type, "
+ "which would result in a dangling reference.");
+ return std::invoke(std::forward<_Fn>(__f), std::forward<_Args>(__args)...);
+ }
}
#endif
diff --git a/contrib/llvm-project/libcxx/include/__functional/is_transparent.h b/contrib/llvm-project/libcxx/include/__functional/is_transparent.h
index c539a07d696d..13fc94f71c6b 100644
--- a/contrib/llvm-project/libcxx/include/__functional/is_transparent.h
+++ b/contrib/llvm-project/libcxx/include/__functional/is_transparent.h
@@ -26,8 +26,7 @@ template <class _Tp, class, class = void>
struct __is_transparent : false_type {};
template <class _Tp, class _Up>
-struct __is_transparent<_Tp, _Up, __void_t<typename _Tp::is_transparent> >
- : true_type {};
+struct __is_transparent<_Tp, _Up, __void_t<typename _Tp::is_transparent> > : true_type {};
#endif
diff --git a/contrib/llvm-project/libcxx/include/__functional/mem_fn.h b/contrib/llvm-project/libcxx/include/__functional/mem_fn.h
index 77c8136d8785..349a6ce3a757 100644
--- a/contrib/llvm-project/libcxx/include/__functional/mem_fn.h
+++ b/contrib/llvm-project/libcxx/include/__functional/mem_fn.h
@@ -23,34 +23,30 @@
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _Tp>
-class __mem_fn : public __weak_result_type<_Tp>
-{
+class __mem_fn : public __weak_result_type<_Tp> {
public:
- // types
- typedef _Tp type;
+ // types
+ typedef _Tp type;
+
private:
- type __f_;
+ type __f_;
public:
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- __mem_fn(type __f) _NOEXCEPT : __f_(__f) {}
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 __mem_fn(type __f) _NOEXCEPT : __f_(__f) {}
- // invoke
- template <class... _ArgTypes>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
+ // invoke
+ template <class... _ArgTypes>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- typename __invoke_return<type, _ArgTypes...>::type
- operator() (_ArgTypes&&... __args) const {
- return std::__invoke(__f_, std::forward<_ArgTypes>(__args)...);
- }
+ typename __invoke_return<type, _ArgTypes...>::type
+ operator()(_ArgTypes&&... __args) const {
+ return std::__invoke(__f_, std::forward<_ArgTypes>(__args)...);
+ }
};
-template<class _Rp, class _Tp>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-__mem_fn<_Rp _Tp::*>
-mem_fn(_Rp _Tp::* __pm) _NOEXCEPT
-{
- return __mem_fn<_Rp _Tp::*>(__pm);
+template <class _Rp, class _Tp>
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 __mem_fn<_Rp _Tp::*> mem_fn(_Rp _Tp::*__pm) _NOEXCEPT {
+ return __mem_fn<_Rp _Tp::*>(__pm);
}
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__functional/mem_fun_ref.h b/contrib/llvm-project/libcxx/include/__functional/mem_fun_ref.h
index 620d479fdd61..fe43c4656092 100644
--- a/contrib/llvm-project/libcxx/include/__functional/mem_fun_ref.h
+++ b/contrib/llvm-project/libcxx/include/__functional/mem_fun_ref.h
@@ -22,149 +22,122 @@ _LIBCPP_BEGIN_NAMESPACE_STD
#if _LIBCPP_STD_VER <= 14 || defined(_LIBCPP_ENABLE_CXX17_REMOVED_BINDERS)
-template<class _Sp, class _Tp>
-class _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX11 mem_fun_t
- : public __unary_function<_Tp*, _Sp>
-{
- _Sp (_Tp::*__p_)();
+template <class _Sp, class _Tp>
+class _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX11 mem_fun_t : public __unary_function<_Tp*, _Sp> {
+ _Sp (_Tp::*__p_)();
+
public:
- _LIBCPP_HIDE_FROM_ABI explicit mem_fun_t(_Sp (_Tp::*__p)())
- : __p_(__p) {}
- _LIBCPP_HIDE_FROM_ABI _Sp operator()(_Tp* __p) const
- {return (__p->*__p_)();}
+ _LIBCPP_HIDE_FROM_ABI explicit mem_fun_t(_Sp (_Tp::*__p)()) : __p_(__p) {}
+ _LIBCPP_HIDE_FROM_ABI _Sp operator()(_Tp* __p) const { return (__p->*__p_)(); }
};
-template<class _Sp, class _Tp, class _Ap>
-class _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX11 mem_fun1_t
- : public __binary_function<_Tp*, _Ap, _Sp>
-{
- _Sp (_Tp::*__p_)(_Ap);
+template <class _Sp, class _Tp, class _Ap>
+class _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX11 mem_fun1_t : public __binary_function<_Tp*, _Ap, _Sp> {
+ _Sp (_Tp::*__p_)(_Ap);
+
public:
- _LIBCPP_HIDE_FROM_ABI explicit mem_fun1_t(_Sp (_Tp::*__p)(_Ap))
- : __p_(__p) {}
- _LIBCPP_HIDE_FROM_ABI _Sp operator()(_Tp* __p, _Ap __x) const
- {return (__p->*__p_)(__x);}
+ _LIBCPP_HIDE_FROM_ABI explicit mem_fun1_t(_Sp (_Tp::*__p)(_Ap)) : __p_(__p) {}
+ _LIBCPP_HIDE_FROM_ABI _Sp operator()(_Tp* __p, _Ap __x) const { return (__p->*__p_)(__x); }
};
-template<class _Sp, class _Tp>
-_LIBCPP_DEPRECATED_IN_CXX11 inline _LIBCPP_HIDE_FROM_ABI
-mem_fun_t<_Sp,_Tp>
-mem_fun(_Sp (_Tp::*__f)())
- {return mem_fun_t<_Sp,_Tp>(__f);}
-
-template<class _Sp, class _Tp, class _Ap>
-_LIBCPP_DEPRECATED_IN_CXX11 inline _LIBCPP_HIDE_FROM_ABI
-mem_fun1_t<_Sp,_Tp,_Ap>
-mem_fun(_Sp (_Tp::*__f)(_Ap))
- {return mem_fun1_t<_Sp,_Tp,_Ap>(__f);}
-
-template<class _Sp, class _Tp>
-class _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX11 mem_fun_ref_t
- : public __unary_function<_Tp, _Sp>
-{
- _Sp (_Tp::*__p_)();
+template <class _Sp, class _Tp>
+_LIBCPP_DEPRECATED_IN_CXX11 inline _LIBCPP_HIDE_FROM_ABI mem_fun_t<_Sp, _Tp> mem_fun(_Sp (_Tp::*__f)()) {
+ return mem_fun_t<_Sp, _Tp>(__f);
+}
+
+template <class _Sp, class _Tp, class _Ap>
+_LIBCPP_DEPRECATED_IN_CXX11 inline _LIBCPP_HIDE_FROM_ABI mem_fun1_t<_Sp, _Tp, _Ap> mem_fun(_Sp (_Tp::*__f)(_Ap)) {
+ return mem_fun1_t<_Sp, _Tp, _Ap>(__f);
+}
+
+template <class _Sp, class _Tp>
+class _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX11 mem_fun_ref_t : public __unary_function<_Tp, _Sp> {
+ _Sp (_Tp::*__p_)();
+
public:
- _LIBCPP_HIDE_FROM_ABI explicit mem_fun_ref_t(_Sp (_Tp::*__p)())
- : __p_(__p) {}
- _LIBCPP_HIDE_FROM_ABI _Sp operator()(_Tp& __p) const
- {return (__p.*__p_)();}
+ _LIBCPP_HIDE_FROM_ABI explicit mem_fun_ref_t(_Sp (_Tp::*__p)()) : __p_(__p) {}
+ _LIBCPP_HIDE_FROM_ABI _Sp operator()(_Tp& __p) const { return (__p.*__p_)(); }
};
-template<class _Sp, class _Tp, class _Ap>
-class _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX11 mem_fun1_ref_t
- : public __binary_function<_Tp, _Ap, _Sp>
-{
- _Sp (_Tp::*__p_)(_Ap);
+template <class _Sp, class _Tp, class _Ap>
+class _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX11 mem_fun1_ref_t : public __binary_function<_Tp, _Ap, _Sp> {
+ _Sp (_Tp::*__p_)(_Ap);
+
public:
- _LIBCPP_HIDE_FROM_ABI explicit mem_fun1_ref_t(_Sp (_Tp::*__p)(_Ap))
- : __p_(__p) {}
- _LIBCPP_HIDE_FROM_ABI _Sp operator()(_Tp& __p, _Ap __x) const
- {return (__p.*__p_)(__x);}
+ _LIBCPP_HIDE_FROM_ABI explicit mem_fun1_ref_t(_Sp (_Tp::*__p)(_Ap)) : __p_(__p) {}
+ _LIBCPP_HIDE_FROM_ABI _Sp operator()(_Tp& __p, _Ap __x) const { return (__p.*__p_)(__x); }
};
-template<class _Sp, class _Tp>
-_LIBCPP_DEPRECATED_IN_CXX11 inline _LIBCPP_HIDE_FROM_ABI
-mem_fun_ref_t<_Sp,_Tp>
-mem_fun_ref(_Sp (_Tp::*__f)())
- {return mem_fun_ref_t<_Sp,_Tp>(__f);}
+template <class _Sp, class _Tp>
+_LIBCPP_DEPRECATED_IN_CXX11 inline _LIBCPP_HIDE_FROM_ABI mem_fun_ref_t<_Sp, _Tp> mem_fun_ref(_Sp (_Tp::*__f)()) {
+ return mem_fun_ref_t<_Sp, _Tp>(__f);
+}
-template<class _Sp, class _Tp, class _Ap>
-_LIBCPP_DEPRECATED_IN_CXX11 inline _LIBCPP_HIDE_FROM_ABI
-mem_fun1_ref_t<_Sp,_Tp,_Ap>
-mem_fun_ref(_Sp (_Tp::*__f)(_Ap))
- {return mem_fun1_ref_t<_Sp,_Tp,_Ap>(__f);}
+template <class _Sp, class _Tp, class _Ap>
+_LIBCPP_DEPRECATED_IN_CXX11 inline _LIBCPP_HIDE_FROM_ABI mem_fun1_ref_t<_Sp, _Tp, _Ap>
+mem_fun_ref(_Sp (_Tp::*__f)(_Ap)) {
+ return mem_fun1_ref_t<_Sp, _Tp, _Ap>(__f);
+}
template <class _Sp, class _Tp>
-class _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX11 const_mem_fun_t
- : public __unary_function<const _Tp*, _Sp>
-{
- _Sp (_Tp::*__p_)() const;
+class _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX11 const_mem_fun_t : public __unary_function<const _Tp*, _Sp> {
+ _Sp (_Tp::*__p_)() const;
+
public:
- _LIBCPP_HIDE_FROM_ABI explicit const_mem_fun_t(_Sp (_Tp::*__p)() const)
- : __p_(__p) {}
- _LIBCPP_HIDE_FROM_ABI _Sp operator()(const _Tp* __p) const
- {return (__p->*__p_)();}
+ _LIBCPP_HIDE_FROM_ABI explicit const_mem_fun_t(_Sp (_Tp::*__p)() const) : __p_(__p) {}
+ _LIBCPP_HIDE_FROM_ABI _Sp operator()(const _Tp* __p) const { return (__p->*__p_)(); }
};
template <class _Sp, class _Tp, class _Ap>
class _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX11 const_mem_fun1_t
- : public __binary_function<const _Tp*, _Ap, _Sp>
-{
- _Sp (_Tp::*__p_)(_Ap) const;
+ : public __binary_function<const _Tp*, _Ap, _Sp> {
+ _Sp (_Tp::*__p_)(_Ap) const;
+
public:
- _LIBCPP_HIDE_FROM_ABI explicit const_mem_fun1_t(_Sp (_Tp::*__p)(_Ap) const)
- : __p_(__p) {}
- _LIBCPP_HIDE_FROM_ABI _Sp operator()(const _Tp* __p, _Ap __x) const
- {return (__p->*__p_)(__x);}
+ _LIBCPP_HIDE_FROM_ABI explicit const_mem_fun1_t(_Sp (_Tp::*__p)(_Ap) const) : __p_(__p) {}
+ _LIBCPP_HIDE_FROM_ABI _Sp operator()(const _Tp* __p, _Ap __x) const { return (__p->*__p_)(__x); }
};
template <class _Sp, class _Tp>
-_LIBCPP_DEPRECATED_IN_CXX11 inline _LIBCPP_HIDE_FROM_ABI
-const_mem_fun_t<_Sp,_Tp>
-mem_fun(_Sp (_Tp::*__f)() const)
- {return const_mem_fun_t<_Sp,_Tp>(__f);}
+_LIBCPP_DEPRECATED_IN_CXX11 inline _LIBCPP_HIDE_FROM_ABI const_mem_fun_t<_Sp, _Tp> mem_fun(_Sp (_Tp::*__f)() const) {
+ return const_mem_fun_t<_Sp, _Tp>(__f);
+}
template <class _Sp, class _Tp, class _Ap>
-_LIBCPP_DEPRECATED_IN_CXX11 inline _LIBCPP_HIDE_FROM_ABI
-const_mem_fun1_t<_Sp,_Tp,_Ap>
-mem_fun(_Sp (_Tp::*__f)(_Ap) const)
- {return const_mem_fun1_t<_Sp,_Tp,_Ap>(__f);}
+_LIBCPP_DEPRECATED_IN_CXX11 inline _LIBCPP_HIDE_FROM_ABI const_mem_fun1_t<_Sp, _Tp, _Ap>
+mem_fun(_Sp (_Tp::*__f)(_Ap) const) {
+ return const_mem_fun1_t<_Sp, _Tp, _Ap>(__f);
+}
template <class _Sp, class _Tp>
-class _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX11 const_mem_fun_ref_t
- : public __unary_function<_Tp, _Sp>
-{
- _Sp (_Tp::*__p_)() const;
+class _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX11 const_mem_fun_ref_t : public __unary_function<_Tp, _Sp> {
+ _Sp (_Tp::*__p_)() const;
+
public:
- _LIBCPP_HIDE_FROM_ABI explicit const_mem_fun_ref_t(_Sp (_Tp::*__p)() const)
- : __p_(__p) {}
- _LIBCPP_HIDE_FROM_ABI _Sp operator()(const _Tp& __p) const
- {return (__p.*__p_)();}
+ _LIBCPP_HIDE_FROM_ABI explicit const_mem_fun_ref_t(_Sp (_Tp::*__p)() const) : __p_(__p) {}
+ _LIBCPP_HIDE_FROM_ABI _Sp operator()(const _Tp& __p) const { return (__p.*__p_)(); }
};
template <class _Sp, class _Tp, class _Ap>
-class _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX11 const_mem_fun1_ref_t
- : public __binary_function<_Tp, _Ap, _Sp>
-{
- _Sp (_Tp::*__p_)(_Ap) const;
+class _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX11 const_mem_fun1_ref_t : public __binary_function<_Tp, _Ap, _Sp> {
+ _Sp (_Tp::*__p_)(_Ap) const;
+
public:
- _LIBCPP_HIDE_FROM_ABI explicit const_mem_fun1_ref_t(_Sp (_Tp::*__p)(_Ap) const)
- : __p_(__p) {}
- _LIBCPP_HIDE_FROM_ABI _Sp operator()(const _Tp& __p, _Ap __x) const
- {return (__p.*__p_)(__x);}
+ _LIBCPP_HIDE_FROM_ABI explicit const_mem_fun1_ref_t(_Sp (_Tp::*__p)(_Ap) const) : __p_(__p) {}
+ _LIBCPP_HIDE_FROM_ABI _Sp operator()(const _Tp& __p, _Ap __x) const { return (__p.*__p_)(__x); }
};
template <class _Sp, class _Tp>
-_LIBCPP_DEPRECATED_IN_CXX11 inline _LIBCPP_HIDE_FROM_ABI
-const_mem_fun_ref_t<_Sp,_Tp>
-mem_fun_ref(_Sp (_Tp::*__f)() const)
- {return const_mem_fun_ref_t<_Sp,_Tp>(__f);}
+_LIBCPP_DEPRECATED_IN_CXX11 inline _LIBCPP_HIDE_FROM_ABI const_mem_fun_ref_t<_Sp, _Tp>
+mem_fun_ref(_Sp (_Tp::*__f)() const) {
+ return const_mem_fun_ref_t<_Sp, _Tp>(__f);
+}
template <class _Sp, class _Tp, class _Ap>
-_LIBCPP_DEPRECATED_IN_CXX11 inline _LIBCPP_HIDE_FROM_ABI
-const_mem_fun1_ref_t<_Sp,_Tp,_Ap>
-mem_fun_ref(_Sp (_Tp::*__f)(_Ap) const)
- {return const_mem_fun1_ref_t<_Sp,_Tp,_Ap>(__f);}
+_LIBCPP_DEPRECATED_IN_CXX11 inline _LIBCPP_HIDE_FROM_ABI const_mem_fun1_ref_t<_Sp, _Tp, _Ap>
+mem_fun_ref(_Sp (_Tp::*__f)(_Ap) const) {
+ return const_mem_fun1_ref_t<_Sp, _Tp, _Ap>(__f);
+}
#endif // _LIBCPP_STD_VER <= 14 || defined(_LIBCPP_ENABLE_CXX17_REMOVED_BINDERS)
diff --git a/contrib/llvm-project/libcxx/include/__functional/not_fn.h b/contrib/llvm-project/libcxx/include/__functional/not_fn.h
index bbd1a8bc35af..23a491c135d7 100644
--- a/contrib/llvm-project/libcxx/include/__functional/not_fn.h
+++ b/contrib/llvm-project/libcxx/include/__functional/not_fn.h
@@ -28,26 +28,23 @@ _LIBCPP_BEGIN_NAMESPACE_STD
#if _LIBCPP_STD_VER >= 17
struct __not_fn_op {
- template <class... _Args>
- _LIBCPP_HIDE_FROM_ABI
- _LIBCPP_CONSTEXPR_SINCE_CXX20 auto operator()(_Args&&... __args) const
- noexcept(noexcept(!std::invoke(std::forward<_Args>(__args)...)))
- -> decltype( !std::invoke(std::forward<_Args>(__args)...))
- { return !std::invoke(std::forward<_Args>(__args)...); }
+ template <class... _Args>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 auto operator()(_Args&&... __args) const
+ noexcept(noexcept(!std::invoke(std::forward<_Args>(__args)...)))
+ -> decltype(!std::invoke(std::forward<_Args>(__args)...)) {
+ return !std::invoke(std::forward<_Args>(__args)...);
+ }
};
template <class _Fn>
struct __not_fn_t : __perfect_forward<__not_fn_op, _Fn> {
- using __perfect_forward<__not_fn_op, _Fn>::__perfect_forward;
+ using __perfect_forward<__not_fn_op, _Fn>::__perfect_forward;
};
-template <class _Fn, class = enable_if_t<
- is_constructible_v<decay_t<_Fn>, _Fn> &&
- is_move_constructible_v<decay_t<_Fn>>
->>
-_LIBCPP_HIDE_FROM_ABI
-_LIBCPP_CONSTEXPR_SINCE_CXX20 auto not_fn(_Fn&& __f) {
- return __not_fn_t<decay_t<_Fn>>(std::forward<_Fn>(__f));
+template <class _Fn,
+ class = enable_if_t< is_constructible_v<decay_t<_Fn>, _Fn> && is_move_constructible_v<decay_t<_Fn>> >>
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 auto not_fn(_Fn&& __f) {
+ return __not_fn_t<decay_t<_Fn>>(std::forward<_Fn>(__f));
}
#endif // _LIBCPP_STD_VER >= 17
diff --git a/contrib/llvm-project/libcxx/include/__functional/operations.h b/contrib/llvm-project/libcxx/include/__functional/operations.h
index 23928e9fc22d..7ddc00650f16 100644
--- a/contrib/llvm-project/libcxx/include/__functional/operations.h
+++ b/contrib/llvm-project/libcxx/include/__functional/operations.h
@@ -30,13 +30,11 @@ template <class _Tp = void>
#else
template <class _Tp>
#endif
-struct _LIBCPP_TEMPLATE_VIS plus
- : __binary_function<_Tp, _Tp, _Tp>
-{
- typedef _Tp __result_type; // used by valarray
- _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
- _Tp operator()(const _Tp& __x, const _Tp& __y) const
- {return __x + __y;}
+struct _LIBCPP_TEMPLATE_VIS plus : __binary_function<_Tp, _Tp, _Tp> {
+ typedef _Tp __result_type; // used by valarray
+ _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI _Tp operator()(const _Tp& __x, const _Tp& __y) const {
+ return __x + __y;
+ }
};
_LIBCPP_CTAD_SUPPORTED_FOR_TYPE(plus);
@@ -50,15 +48,14 @@ struct __desugars_to<__plus_tag, plus<void>, _Tp, _Up> : true_type {};
#if _LIBCPP_STD_VER >= 14
template <>
-struct _LIBCPP_TEMPLATE_VIS plus<void>
-{
- template <class _T1, class _T2>
- _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
- auto operator()(_T1&& __t, _T2&& __u) const
- noexcept(noexcept(std::forward<_T1>(__t) + std::forward<_T2>(__u)))
- -> decltype( std::forward<_T1>(__t) + std::forward<_T2>(__u))
- { return std::forward<_T1>(__t) + std::forward<_T2>(__u); }
- typedef void is_transparent;
+struct _LIBCPP_TEMPLATE_VIS plus<void> {
+ template <class _T1, class _T2>
+ _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI auto operator()(_T1&& __t, _T2&& __u) const
+ noexcept(noexcept(std::forward<_T1>(__t) + std::forward<_T2>(__u)))
+ -> decltype(std::forward<_T1>(__t) + std::forward<_T2>(__u)) {
+ return std::forward<_T1>(__t) + std::forward<_T2>(__u);
+ }
+ typedef void is_transparent;
};
#endif
@@ -67,27 +64,24 @@ template <class _Tp = void>
#else
template <class _Tp>
#endif
-struct _LIBCPP_TEMPLATE_VIS minus
- : __binary_function<_Tp, _Tp, _Tp>
-{
- typedef _Tp __result_type; // used by valarray
- _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
- _Tp operator()(const _Tp& __x, const _Tp& __y) const
- {return __x - __y;}
+struct _LIBCPP_TEMPLATE_VIS minus : __binary_function<_Tp, _Tp, _Tp> {
+ typedef _Tp __result_type; // used by valarray
+ _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI _Tp operator()(const _Tp& __x, const _Tp& __y) const {
+ return __x - __y;
+ }
};
_LIBCPP_CTAD_SUPPORTED_FOR_TYPE(minus);
#if _LIBCPP_STD_VER >= 14
template <>
-struct _LIBCPP_TEMPLATE_VIS minus<void>
-{
- template <class _T1, class _T2>
- _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
- auto operator()(_T1&& __t, _T2&& __u) const
- noexcept(noexcept(std::forward<_T1>(__t) - std::forward<_T2>(__u)))
- -> decltype( std::forward<_T1>(__t) - std::forward<_T2>(__u))
- { return std::forward<_T1>(__t) - std::forward<_T2>(__u); }
- typedef void is_transparent;
+struct _LIBCPP_TEMPLATE_VIS minus<void> {
+ template <class _T1, class _T2>
+ _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI auto operator()(_T1&& __t, _T2&& __u) const
+ noexcept(noexcept(std::forward<_T1>(__t) - std::forward<_T2>(__u)))
+ -> decltype(std::forward<_T1>(__t) - std::forward<_T2>(__u)) {
+ return std::forward<_T1>(__t) - std::forward<_T2>(__u);
+ }
+ typedef void is_transparent;
};
#endif
@@ -96,27 +90,24 @@ template <class _Tp = void>
#else
template <class _Tp>
#endif
-struct _LIBCPP_TEMPLATE_VIS multiplies
- : __binary_function<_Tp, _Tp, _Tp>
-{
- typedef _Tp __result_type; // used by valarray
- _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
- _Tp operator()(const _Tp& __x, const _Tp& __y) const
- {return __x * __y;}
+struct _LIBCPP_TEMPLATE_VIS multiplies : __binary_function<_Tp, _Tp, _Tp> {
+ typedef _Tp __result_type; // used by valarray
+ _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI _Tp operator()(const _Tp& __x, const _Tp& __y) const {
+ return __x * __y;
+ }
};
_LIBCPP_CTAD_SUPPORTED_FOR_TYPE(multiplies);
#if _LIBCPP_STD_VER >= 14
template <>
-struct _LIBCPP_TEMPLATE_VIS multiplies<void>
-{
- template <class _T1, class _T2>
- _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
- auto operator()(_T1&& __t, _T2&& __u) const
- noexcept(noexcept(std::forward<_T1>(__t) * std::forward<_T2>(__u)))
- -> decltype( std::forward<_T1>(__t) * std::forward<_T2>(__u))
- { return std::forward<_T1>(__t) * std::forward<_T2>(__u); }
- typedef void is_transparent;
+struct _LIBCPP_TEMPLATE_VIS multiplies<void> {
+ template <class _T1, class _T2>
+ _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI auto operator()(_T1&& __t, _T2&& __u) const
+ noexcept(noexcept(std::forward<_T1>(__t) * std::forward<_T2>(__u)))
+ -> decltype(std::forward<_T1>(__t) * std::forward<_T2>(__u)) {
+ return std::forward<_T1>(__t) * std::forward<_T2>(__u);
+ }
+ typedef void is_transparent;
};
#endif
@@ -125,27 +116,24 @@ template <class _Tp = void>
#else
template <class _Tp>
#endif
-struct _LIBCPP_TEMPLATE_VIS divides
- : __binary_function<_Tp, _Tp, _Tp>
-{
- typedef _Tp __result_type; // used by valarray
- _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
- _Tp operator()(const _Tp& __x, const _Tp& __y) const
- {return __x / __y;}
+struct _LIBCPP_TEMPLATE_VIS divides : __binary_function<_Tp, _Tp, _Tp> {
+ typedef _Tp __result_type; // used by valarray
+ _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI _Tp operator()(const _Tp& __x, const _Tp& __y) const {
+ return __x / __y;
+ }
};
_LIBCPP_CTAD_SUPPORTED_FOR_TYPE(divides);
#if _LIBCPP_STD_VER >= 14
template <>
-struct _LIBCPP_TEMPLATE_VIS divides<void>
-{
- template <class _T1, class _T2>
- _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
- auto operator()(_T1&& __t, _T2&& __u) const
- noexcept(noexcept(std::forward<_T1>(__t) / std::forward<_T2>(__u)))
- -> decltype( std::forward<_T1>(__t) / std::forward<_T2>(__u))
- { return std::forward<_T1>(__t) / std::forward<_T2>(__u); }
- typedef void is_transparent;
+struct _LIBCPP_TEMPLATE_VIS divides<void> {
+ template <class _T1, class _T2>
+ _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI auto operator()(_T1&& __t, _T2&& __u) const
+ noexcept(noexcept(std::forward<_T1>(__t) / std::forward<_T2>(__u)))
+ -> decltype(std::forward<_T1>(__t) / std::forward<_T2>(__u)) {
+ return std::forward<_T1>(__t) / std::forward<_T2>(__u);
+ }
+ typedef void is_transparent;
};
#endif
@@ -154,27 +142,24 @@ template <class _Tp = void>
#else
template <class _Tp>
#endif
-struct _LIBCPP_TEMPLATE_VIS modulus
- : __binary_function<_Tp, _Tp, _Tp>
-{
- typedef _Tp __result_type; // used by valarray
- _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
- _Tp operator()(const _Tp& __x, const _Tp& __y) const
- {return __x % __y;}
+struct _LIBCPP_TEMPLATE_VIS modulus : __binary_function<_Tp, _Tp, _Tp> {
+ typedef _Tp __result_type; // used by valarray
+ _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI _Tp operator()(const _Tp& __x, const _Tp& __y) const {
+ return __x % __y;
+ }
};
_LIBCPP_CTAD_SUPPORTED_FOR_TYPE(modulus);
#if _LIBCPP_STD_VER >= 14
template <>
-struct _LIBCPP_TEMPLATE_VIS modulus<void>
-{
- template <class _T1, class _T2>
- _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
- auto operator()(_T1&& __t, _T2&& __u) const
- noexcept(noexcept(std::forward<_T1>(__t) % std::forward<_T2>(__u)))
- -> decltype( std::forward<_T1>(__t) % std::forward<_T2>(__u))
- { return std::forward<_T1>(__t) % std::forward<_T2>(__u); }
- typedef void is_transparent;
+struct _LIBCPP_TEMPLATE_VIS modulus<void> {
+ template <class _T1, class _T2>
+ _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI auto operator()(_T1&& __t, _T2&& __u) const
+ noexcept(noexcept(std::forward<_T1>(__t) % std::forward<_T2>(__u)))
+ -> decltype(std::forward<_T1>(__t) % std::forward<_T2>(__u)) {
+ return std::forward<_T1>(__t) % std::forward<_T2>(__u);
+ }
+ typedef void is_transparent;
};
#endif
@@ -183,27 +168,21 @@ template <class _Tp = void>
#else
template <class _Tp>
#endif
-struct _LIBCPP_TEMPLATE_VIS negate
- : __unary_function<_Tp, _Tp>
-{
- typedef _Tp __result_type; // used by valarray
- _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
- _Tp operator()(const _Tp& __x) const
- {return -__x;}
+struct _LIBCPP_TEMPLATE_VIS negate : __unary_function<_Tp, _Tp> {
+ typedef _Tp __result_type; // used by valarray
+ _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI _Tp operator()(const _Tp& __x) const { return -__x; }
};
_LIBCPP_CTAD_SUPPORTED_FOR_TYPE(negate);
#if _LIBCPP_STD_VER >= 14
template <>
-struct _LIBCPP_TEMPLATE_VIS negate<void>
-{
- template <class _Tp>
- _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
- auto operator()(_Tp&& __x) const
- noexcept(noexcept(- std::forward<_Tp>(__x)))
- -> decltype( - std::forward<_Tp>(__x))
- { return - std::forward<_Tp>(__x); }
- typedef void is_transparent;
+struct _LIBCPP_TEMPLATE_VIS negate<void> {
+ template <class _Tp>
+ _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI auto operator()(_Tp&& __x) const
+ noexcept(noexcept(-std::forward<_Tp>(__x))) -> decltype(-std::forward<_Tp>(__x)) {
+ return -std::forward<_Tp>(__x);
+ }
+ typedef void is_transparent;
};
#endif
@@ -214,51 +193,42 @@ template <class _Tp = void>
#else
template <class _Tp>
#endif
-struct _LIBCPP_TEMPLATE_VIS bit_and
- : __binary_function<_Tp, _Tp, _Tp>
-{
- typedef _Tp __result_type; // used by valarray
- _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
- _Tp operator()(const _Tp& __x, const _Tp& __y) const
- {return __x & __y;}
+struct _LIBCPP_TEMPLATE_VIS bit_and : __binary_function<_Tp, _Tp, _Tp> {
+ typedef _Tp __result_type; // used by valarray
+ _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI _Tp operator()(const _Tp& __x, const _Tp& __y) const {
+ return __x & __y;
+ }
};
_LIBCPP_CTAD_SUPPORTED_FOR_TYPE(bit_and);
#if _LIBCPP_STD_VER >= 14
template <>
-struct _LIBCPP_TEMPLATE_VIS bit_and<void>
-{
- template <class _T1, class _T2>
- _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
- auto operator()(_T1&& __t, _T2&& __u) const
- noexcept(noexcept(std::forward<_T1>(__t) & std::forward<_T2>(__u)))
- -> decltype( std::forward<_T1>(__t) & std::forward<_T2>(__u))
- { return std::forward<_T1>(__t) & std::forward<_T2>(__u); }
- typedef void is_transparent;
+struct _LIBCPP_TEMPLATE_VIS bit_and<void> {
+ template <class _T1, class _T2>
+ _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI auto operator()(_T1&& __t, _T2&& __u) const
+ noexcept(noexcept(std::forward<_T1>(__t) & std::forward<_T2>(__u)))
+ -> decltype(std::forward<_T1>(__t) & std::forward<_T2>(__u)) {
+ return std::forward<_T1>(__t) & std::forward<_T2>(__u);
+ }
+ typedef void is_transparent;
};
#endif
#if _LIBCPP_STD_VER >= 14
template <class _Tp = void>
-struct _LIBCPP_TEMPLATE_VIS bit_not
- : __unary_function<_Tp, _Tp>
-{
- _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
- _Tp operator()(const _Tp& __x) const
- {return ~__x;}
+struct _LIBCPP_TEMPLATE_VIS bit_not : __unary_function<_Tp, _Tp> {
+ _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI _Tp operator()(const _Tp& __x) const { return ~__x; }
};
_LIBCPP_CTAD_SUPPORTED_FOR_TYPE(bit_not);
template <>
-struct _LIBCPP_TEMPLATE_VIS bit_not<void>
-{
- template <class _Tp>
- _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
- auto operator()(_Tp&& __x) const
- noexcept(noexcept(~std::forward<_Tp>(__x)))
- -> decltype( ~std::forward<_Tp>(__x))
- { return ~std::forward<_Tp>(__x); }
- typedef void is_transparent;
+struct _LIBCPP_TEMPLATE_VIS bit_not<void> {
+ template <class _Tp>
+ _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI auto operator()(_Tp&& __x) const
+ noexcept(noexcept(~std::forward<_Tp>(__x))) -> decltype(~std::forward<_Tp>(__x)) {
+ return ~std::forward<_Tp>(__x);
+ }
+ typedef void is_transparent;
};
#endif
@@ -267,27 +237,24 @@ template <class _Tp = void>
#else
template <class _Tp>
#endif
-struct _LIBCPP_TEMPLATE_VIS bit_or
- : __binary_function<_Tp, _Tp, _Tp>
-{
- typedef _Tp __result_type; // used by valarray
- _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
- _Tp operator()(const _Tp& __x, const _Tp& __y) const
- {return __x | __y;}
+struct _LIBCPP_TEMPLATE_VIS bit_or : __binary_function<_Tp, _Tp, _Tp> {
+ typedef _Tp __result_type; // used by valarray
+ _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI _Tp operator()(const _Tp& __x, const _Tp& __y) const {
+ return __x | __y;
+ }
};
_LIBCPP_CTAD_SUPPORTED_FOR_TYPE(bit_or);
#if _LIBCPP_STD_VER >= 14
template <>
-struct _LIBCPP_TEMPLATE_VIS bit_or<void>
-{
- template <class _T1, class _T2>
- _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
- auto operator()(_T1&& __t, _T2&& __u) const
- noexcept(noexcept(std::forward<_T1>(__t) | std::forward<_T2>(__u)))
- -> decltype( std::forward<_T1>(__t) | std::forward<_T2>(__u))
- { return std::forward<_T1>(__t) | std::forward<_T2>(__u); }
- typedef void is_transparent;
+struct _LIBCPP_TEMPLATE_VIS bit_or<void> {
+ template <class _T1, class _T2>
+ _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI auto operator()(_T1&& __t, _T2&& __u) const
+ noexcept(noexcept(std::forward<_T1>(__t) | std::forward<_T2>(__u)))
+ -> decltype(std::forward<_T1>(__t) | std::forward<_T2>(__u)) {
+ return std::forward<_T1>(__t) | std::forward<_T2>(__u);
+ }
+ typedef void is_transparent;
};
#endif
@@ -296,27 +263,24 @@ template <class _Tp = void>
#else
template <class _Tp>
#endif
-struct _LIBCPP_TEMPLATE_VIS bit_xor
- : __binary_function<_Tp, _Tp, _Tp>
-{
- typedef _Tp __result_type; // used by valarray
- _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
- _Tp operator()(const _Tp& __x, const _Tp& __y) const
- {return __x ^ __y;}
+struct _LIBCPP_TEMPLATE_VIS bit_xor : __binary_function<_Tp, _Tp, _Tp> {
+ typedef _Tp __result_type; // used by valarray
+ _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI _Tp operator()(const _Tp& __x, const _Tp& __y) const {
+ return __x ^ __y;
+ }
};
_LIBCPP_CTAD_SUPPORTED_FOR_TYPE(bit_xor);
#if _LIBCPP_STD_VER >= 14
template <>
-struct _LIBCPP_TEMPLATE_VIS bit_xor<void>
-{
- template <class _T1, class _T2>
- _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
- auto operator()(_T1&& __t, _T2&& __u) const
- noexcept(noexcept(std::forward<_T1>(__t) ^ std::forward<_T2>(__u)))
- -> decltype( std::forward<_T1>(__t) ^ std::forward<_T2>(__u))
- { return std::forward<_T1>(__t) ^ std::forward<_T2>(__u); }
- typedef void is_transparent;
+struct _LIBCPP_TEMPLATE_VIS bit_xor<void> {
+ template <class _T1, class _T2>
+ _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI auto operator()(_T1&& __t, _T2&& __u) const
+ noexcept(noexcept(std::forward<_T1>(__t) ^ std::forward<_T2>(__u)))
+ -> decltype(std::forward<_T1>(__t) ^ std::forward<_T2>(__u)) {
+ return std::forward<_T1>(__t) ^ std::forward<_T2>(__u);
+ }
+ typedef void is_transparent;
};
#endif
@@ -327,27 +291,24 @@ template <class _Tp = void>
#else
template <class _Tp>
#endif
-struct _LIBCPP_TEMPLATE_VIS equal_to
- : __binary_function<_Tp, _Tp, bool>
-{
- typedef bool __result_type; // used by valarray
- _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
- bool operator()(const _Tp& __x, const _Tp& __y) const
- {return __x == __y;}
+struct _LIBCPP_TEMPLATE_VIS equal_to : __binary_function<_Tp, _Tp, bool> {
+ typedef bool __result_type; // used by valarray
+ _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI bool operator()(const _Tp& __x, const _Tp& __y) const {
+ return __x == __y;
+ }
};
_LIBCPP_CTAD_SUPPORTED_FOR_TYPE(equal_to);
#if _LIBCPP_STD_VER >= 14
template <>
-struct _LIBCPP_TEMPLATE_VIS equal_to<void>
-{
- template <class _T1, class _T2>
- _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
- auto operator()(_T1&& __t, _T2&& __u) const
- noexcept(noexcept(std::forward<_T1>(__t) == std::forward<_T2>(__u)))
- -> decltype( std::forward<_T1>(__t) == std::forward<_T2>(__u))
- { return std::forward<_T1>(__t) == std::forward<_T2>(__u); }
- typedef void is_transparent;
+struct _LIBCPP_TEMPLATE_VIS equal_to<void> {
+ template <class _T1, class _T2>
+ _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI auto operator()(_T1&& __t, _T2&& __u) const
+ noexcept(noexcept(std::forward<_T1>(__t) == std::forward<_T2>(__u)))
+ -> decltype(std::forward<_T1>(__t) == std::forward<_T2>(__u)) {
+ return std::forward<_T1>(__t) == std::forward<_T2>(__u);
+ }
+ typedef void is_transparent;
};
#endif
@@ -365,27 +326,24 @@ template <class _Tp = void>
#else
template <class _Tp>
#endif
-struct _LIBCPP_TEMPLATE_VIS not_equal_to
- : __binary_function<_Tp, _Tp, bool>
-{
- typedef bool __result_type; // used by valarray
- _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
- bool operator()(const _Tp& __x, const _Tp& __y) const
- {return __x != __y;}
+struct _LIBCPP_TEMPLATE_VIS not_equal_to : __binary_function<_Tp, _Tp, bool> {
+ typedef bool __result_type; // used by valarray
+ _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI bool operator()(const _Tp& __x, const _Tp& __y) const {
+ return __x != __y;
+ }
};
_LIBCPP_CTAD_SUPPORTED_FOR_TYPE(not_equal_to);
#if _LIBCPP_STD_VER >= 14
template <>
-struct _LIBCPP_TEMPLATE_VIS not_equal_to<void>
-{
- template <class _T1, class _T2>
- _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
- auto operator()(_T1&& __t, _T2&& __u) const
- noexcept(noexcept(std::forward<_T1>(__t) != std::forward<_T2>(__u)))
- -> decltype( std::forward<_T1>(__t) != std::forward<_T2>(__u))
- { return std::forward<_T1>(__t) != std::forward<_T2>(__u); }
- typedef void is_transparent;
+struct _LIBCPP_TEMPLATE_VIS not_equal_to<void> {
+ template <class _T1, class _T2>
+ _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI auto operator()(_T1&& __t, _T2&& __u) const
+ noexcept(noexcept(std::forward<_T1>(__t) != std::forward<_T2>(__u)))
+ -> decltype(std::forward<_T1>(__t) != std::forward<_T2>(__u)) {
+ return std::forward<_T1>(__t) != std::forward<_T2>(__u);
+ }
+ typedef void is_transparent;
};
#endif
@@ -394,27 +352,24 @@ template <class _Tp = void>
#else
template <class _Tp>
#endif
-struct _LIBCPP_TEMPLATE_VIS less
- : __binary_function<_Tp, _Tp, bool>
-{
- typedef bool __result_type; // used by valarray
- _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
- bool operator()(const _Tp& __x, const _Tp& __y) const
- {return __x < __y;}
+struct _LIBCPP_TEMPLATE_VIS less : __binary_function<_Tp, _Tp, bool> {
+ typedef bool __result_type; // used by valarray
+ _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI bool operator()(const _Tp& __x, const _Tp& __y) const {
+ return __x < __y;
+ }
};
_LIBCPP_CTAD_SUPPORTED_FOR_TYPE(less);
#if _LIBCPP_STD_VER >= 14
template <>
-struct _LIBCPP_TEMPLATE_VIS less<void>
-{
- template <class _T1, class _T2>
- _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
- auto operator()(_T1&& __t, _T2&& __u) const
- noexcept(noexcept(std::forward<_T1>(__t) < std::forward<_T2>(__u)))
- -> decltype( std::forward<_T1>(__t) < std::forward<_T2>(__u))
- { return std::forward<_T1>(__t) < std::forward<_T2>(__u); }
- typedef void is_transparent;
+struct _LIBCPP_TEMPLATE_VIS less<void> {
+ template <class _T1, class _T2>
+ _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI auto operator()(_T1&& __t, _T2&& __u) const
+ noexcept(noexcept(std::forward<_T1>(__t) < std::forward<_T2>(__u)))
+ -> decltype(std::forward<_T1>(__t) < std::forward<_T2>(__u)) {
+ return std::forward<_T1>(__t) < std::forward<_T2>(__u);
+ }
+ typedef void is_transparent;
};
#endif
@@ -423,27 +378,24 @@ template <class _Tp = void>
#else
template <class _Tp>
#endif
-struct _LIBCPP_TEMPLATE_VIS less_equal
- : __binary_function<_Tp, _Tp, bool>
-{
- typedef bool __result_type; // used by valarray
- _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
- bool operator()(const _Tp& __x, const _Tp& __y) const
- {return __x <= __y;}
+struct _LIBCPP_TEMPLATE_VIS less_equal : __binary_function<_Tp, _Tp, bool> {
+ typedef bool __result_type; // used by valarray
+ _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI bool operator()(const _Tp& __x, const _Tp& __y) const {
+ return __x <= __y;
+ }
};
_LIBCPP_CTAD_SUPPORTED_FOR_TYPE(less_equal);
#if _LIBCPP_STD_VER >= 14
template <>
-struct _LIBCPP_TEMPLATE_VIS less_equal<void>
-{
- template <class _T1, class _T2>
- _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
- auto operator()(_T1&& __t, _T2&& __u) const
- noexcept(noexcept(std::forward<_T1>(__t) <= std::forward<_T2>(__u)))
- -> decltype( std::forward<_T1>(__t) <= std::forward<_T2>(__u))
- { return std::forward<_T1>(__t) <= std::forward<_T2>(__u); }
- typedef void is_transparent;
+struct _LIBCPP_TEMPLATE_VIS less_equal<void> {
+ template <class _T1, class _T2>
+ _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI auto operator()(_T1&& __t, _T2&& __u) const
+ noexcept(noexcept(std::forward<_T1>(__t) <= std::forward<_T2>(__u)))
+ -> decltype(std::forward<_T1>(__t) <= std::forward<_T2>(__u)) {
+ return std::forward<_T1>(__t) <= std::forward<_T2>(__u);
+ }
+ typedef void is_transparent;
};
#endif
@@ -452,27 +404,24 @@ template <class _Tp = void>
#else
template <class _Tp>
#endif
-struct _LIBCPP_TEMPLATE_VIS greater_equal
- : __binary_function<_Tp, _Tp, bool>
-{
- typedef bool __result_type; // used by valarray
- _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
- bool operator()(const _Tp& __x, const _Tp& __y) const
- {return __x >= __y;}
+struct _LIBCPP_TEMPLATE_VIS greater_equal : __binary_function<_Tp, _Tp, bool> {
+ typedef bool __result_type; // used by valarray
+ _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI bool operator()(const _Tp& __x, const _Tp& __y) const {
+ return __x >= __y;
+ }
};
_LIBCPP_CTAD_SUPPORTED_FOR_TYPE(greater_equal);
#if _LIBCPP_STD_VER >= 14
template <>
-struct _LIBCPP_TEMPLATE_VIS greater_equal<void>
-{
- template <class _T1, class _T2>
- _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
- auto operator()(_T1&& __t, _T2&& __u) const
- noexcept(noexcept(std::forward<_T1>(__t) >= std::forward<_T2>(__u)))
- -> decltype( std::forward<_T1>(__t) >= std::forward<_T2>(__u))
- { return std::forward<_T1>(__t) >= std::forward<_T2>(__u); }
- typedef void is_transparent;
+struct _LIBCPP_TEMPLATE_VIS greater_equal<void> {
+ template <class _T1, class _T2>
+ _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI auto operator()(_T1&& __t, _T2&& __u) const
+ noexcept(noexcept(std::forward<_T1>(__t) >= std::forward<_T2>(__u)))
+ -> decltype(std::forward<_T1>(__t) >= std::forward<_T2>(__u)) {
+ return std::forward<_T1>(__t) >= std::forward<_T2>(__u);
+ }
+ typedef void is_transparent;
};
#endif
@@ -481,27 +430,24 @@ template <class _Tp = void>
#else
template <class _Tp>
#endif
-struct _LIBCPP_TEMPLATE_VIS greater
- : __binary_function<_Tp, _Tp, bool>
-{
- typedef bool __result_type; // used by valarray
- _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
- bool operator()(const _Tp& __x, const _Tp& __y) const
- {return __x > __y;}
+struct _LIBCPP_TEMPLATE_VIS greater : __binary_function<_Tp, _Tp, bool> {
+ typedef bool __result_type; // used by valarray
+ _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI bool operator()(const _Tp& __x, const _Tp& __y) const {
+ return __x > __y;
+ }
};
_LIBCPP_CTAD_SUPPORTED_FOR_TYPE(greater);
#if _LIBCPP_STD_VER >= 14
template <>
-struct _LIBCPP_TEMPLATE_VIS greater<void>
-{
- template <class _T1, class _T2>
- _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
- auto operator()(_T1&& __t, _T2&& __u) const
- noexcept(noexcept(std::forward<_T1>(__t) > std::forward<_T2>(__u)))
- -> decltype( std::forward<_T1>(__t) > std::forward<_T2>(__u))
- { return std::forward<_T1>(__t) > std::forward<_T2>(__u); }
- typedef void is_transparent;
+struct _LIBCPP_TEMPLATE_VIS greater<void> {
+ template <class _T1, class _T2>
+ _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI auto operator()(_T1&& __t, _T2&& __u) const
+ noexcept(noexcept(std::forward<_T1>(__t) > std::forward<_T2>(__u)))
+ -> decltype(std::forward<_T1>(__t) > std::forward<_T2>(__u)) {
+ return std::forward<_T1>(__t) > std::forward<_T2>(__u);
+ }
+ typedef void is_transparent;
};
#endif
@@ -512,27 +458,24 @@ template <class _Tp = void>
#else
template <class _Tp>
#endif
-struct _LIBCPP_TEMPLATE_VIS logical_and
- : __binary_function<_Tp, _Tp, bool>
-{
- typedef bool __result_type; // used by valarray
- _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
- bool operator()(const _Tp& __x, const _Tp& __y) const
- {return __x && __y;}
+struct _LIBCPP_TEMPLATE_VIS logical_and : __binary_function<_Tp, _Tp, bool> {
+ typedef bool __result_type; // used by valarray
+ _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI bool operator()(const _Tp& __x, const _Tp& __y) const {
+ return __x && __y;
+ }
};
_LIBCPP_CTAD_SUPPORTED_FOR_TYPE(logical_and);
#if _LIBCPP_STD_VER >= 14
template <>
-struct _LIBCPP_TEMPLATE_VIS logical_and<void>
-{
- template <class _T1, class _T2>
- _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
- auto operator()(_T1&& __t, _T2&& __u) const
- noexcept(noexcept(std::forward<_T1>(__t) && std::forward<_T2>(__u)))
- -> decltype( std::forward<_T1>(__t) && std::forward<_T2>(__u))
- { return std::forward<_T1>(__t) && std::forward<_T2>(__u); }
- typedef void is_transparent;
+struct _LIBCPP_TEMPLATE_VIS logical_and<void> {
+ template <class _T1, class _T2>
+ _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI auto operator()(_T1&& __t, _T2&& __u) const
+ noexcept(noexcept(std::forward<_T1>(__t) && std::forward<_T2>(__u)))
+ -> decltype(std::forward<_T1>(__t) && std::forward<_T2>(__u)) {
+ return std::forward<_T1>(__t) && std::forward<_T2>(__u);
+ }
+ typedef void is_transparent;
};
#endif
@@ -541,27 +484,21 @@ template <class _Tp = void>
#else
template <class _Tp>
#endif
-struct _LIBCPP_TEMPLATE_VIS logical_not
- : __unary_function<_Tp, bool>
-{
- typedef bool __result_type; // used by valarray
- _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
- bool operator()(const _Tp& __x) const
- {return !__x;}
+struct _LIBCPP_TEMPLATE_VIS logical_not : __unary_function<_Tp, bool> {
+ typedef bool __result_type; // used by valarray
+ _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI bool operator()(const _Tp& __x) const { return !__x; }
};
_LIBCPP_CTAD_SUPPORTED_FOR_TYPE(logical_not);
#if _LIBCPP_STD_VER >= 14
template <>
-struct _LIBCPP_TEMPLATE_VIS logical_not<void>
-{
- template <class _Tp>
- _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
- auto operator()(_Tp&& __x) const
- noexcept(noexcept(!std::forward<_Tp>(__x)))
- -> decltype( !std::forward<_Tp>(__x))
- { return !std::forward<_Tp>(__x); }
- typedef void is_transparent;
+struct _LIBCPP_TEMPLATE_VIS logical_not<void> {
+ template <class _Tp>
+ _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI auto operator()(_Tp&& __x) const
+ noexcept(noexcept(!std::forward<_Tp>(__x))) -> decltype(!std::forward<_Tp>(__x)) {
+ return !std::forward<_Tp>(__x);
+ }
+ typedef void is_transparent;
};
#endif
@@ -570,27 +507,24 @@ template <class _Tp = void>
#else
template <class _Tp>
#endif
-struct _LIBCPP_TEMPLATE_VIS logical_or
- : __binary_function<_Tp, _Tp, bool>
-{
- typedef bool __result_type; // used by valarray
- _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
- bool operator()(const _Tp& __x, const _Tp& __y) const
- {return __x || __y;}
+struct _LIBCPP_TEMPLATE_VIS logical_or : __binary_function<_Tp, _Tp, bool> {
+ typedef bool __result_type; // used by valarray
+ _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI bool operator()(const _Tp& __x, const _Tp& __y) const {
+ return __x || __y;
+ }
};
_LIBCPP_CTAD_SUPPORTED_FOR_TYPE(logical_or);
#if _LIBCPP_STD_VER >= 14
template <>
-struct _LIBCPP_TEMPLATE_VIS logical_or<void>
-{
- template <class _T1, class _T2>
- _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
- auto operator()(_T1&& __t, _T2&& __u) const
- noexcept(noexcept(std::forward<_T1>(__t) || std::forward<_T2>(__u)))
- -> decltype( std::forward<_T1>(__t) || std::forward<_T2>(__u))
- { return std::forward<_T1>(__t) || std::forward<_T2>(__u); }
- typedef void is_transparent;
+struct _LIBCPP_TEMPLATE_VIS logical_or<void> {
+ template <class _T1, class _T2>
+ _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI auto operator()(_T1&& __t, _T2&& __u) const
+ noexcept(noexcept(std::forward<_T1>(__t) || std::forward<_T2>(__u)))
+ -> decltype(std::forward<_T1>(__t) || std::forward<_T2>(__u)) {
+ return std::forward<_T1>(__t) || std::forward<_T2>(__u);
+ }
+ typedef void is_transparent;
};
#endif
diff --git a/contrib/llvm-project/libcxx/include/__functional/perfect_forward.h b/contrib/llvm-project/libcxx/include/__functional/perfect_forward.h
index 2fbb623a7d89..74177c789b4a 100644
--- a/contrib/llvm-project/libcxx/include/__functional/perfect_forward.h
+++ b/contrib/llvm-project/libcxx/include/__functional/perfect_forward.h
@@ -40,57 +40,59 @@ private:
tuple<_BoundArgs...> __bound_args_;
public:
- template <class... _Args, class = enable_if_t<
- is_constructible_v<tuple<_BoundArgs...>, _Args&&...>
- >>
+ template <class... _Args, class = enable_if_t< is_constructible_v<tuple<_BoundArgs...>, _Args&&...> >>
_LIBCPP_HIDE_FROM_ABI explicit constexpr __perfect_forward_impl(_Args&&... __bound_args)
- : __bound_args_(std::forward<_Args>(__bound_args)...) {}
+ : __bound_args_(std::forward<_Args>(__bound_args)...) {}
_LIBCPP_HIDE_FROM_ABI __perfect_forward_impl(__perfect_forward_impl const&) = default;
- _LIBCPP_HIDE_FROM_ABI __perfect_forward_impl(__perfect_forward_impl&&) = default;
+ _LIBCPP_HIDE_FROM_ABI __perfect_forward_impl(__perfect_forward_impl&&) = default;
_LIBCPP_HIDE_FROM_ABI __perfect_forward_impl& operator=(__perfect_forward_impl const&) = default;
- _LIBCPP_HIDE_FROM_ABI __perfect_forward_impl& operator=(__perfect_forward_impl&&) = default;
+ _LIBCPP_HIDE_FROM_ABI __perfect_forward_impl& operator=(__perfect_forward_impl&&) = default;
template <class... _Args, class = enable_if_t<is_invocable_v<_Op, _BoundArgs&..., _Args...>>>
- _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Args&&... __args) &
- noexcept(noexcept(_Op()(std::get<_Idx>(__bound_args_)..., std::forward<_Args>(__args)...)))
- -> decltype( _Op()(std::get<_Idx>(__bound_args_)..., std::forward<_Args>(__args)...))
- { return _Op()(std::get<_Idx>(__bound_args_)..., std::forward<_Args>(__args)...); }
+ _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Args&&... __args) & noexcept(
+ noexcept(_Op()(std::get<_Idx>(__bound_args_)..., std::forward<_Args>(__args)...)))
+ -> decltype(_Op()(std::get<_Idx>(__bound_args_)..., std::forward<_Args>(__args)...)) {
+ return _Op()(std::get<_Idx>(__bound_args_)..., std::forward<_Args>(__args)...);
+ }
template <class... _Args, class = enable_if_t<!is_invocable_v<_Op, _BoundArgs&..., _Args...>>>
auto operator()(_Args&&...) & = delete;
template <class... _Args, class = enable_if_t<is_invocable_v<_Op, _BoundArgs const&..., _Args...>>>
- _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Args&&... __args) const&
- noexcept(noexcept(_Op()(std::get<_Idx>(__bound_args_)..., std::forward<_Args>(__args)...)))
- -> decltype( _Op()(std::get<_Idx>(__bound_args_)..., std::forward<_Args>(__args)...))
- { return _Op()(std::get<_Idx>(__bound_args_)..., std::forward<_Args>(__args)...); }
+ _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Args&&... __args) const& noexcept(
+ noexcept(_Op()(std::get<_Idx>(__bound_args_)..., std::forward<_Args>(__args)...)))
+ -> decltype(_Op()(std::get<_Idx>(__bound_args_)..., std::forward<_Args>(__args)...)) {
+ return _Op()(std::get<_Idx>(__bound_args_)..., std::forward<_Args>(__args)...);
+ }
template <class... _Args, class = enable_if_t<!is_invocable_v<_Op, _BoundArgs const&..., _Args...>>>
auto operator()(_Args&&...) const& = delete;
template <class... _Args, class = enable_if_t<is_invocable_v<_Op, _BoundArgs..., _Args...>>>
- _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Args&&... __args) &&
- noexcept(noexcept(_Op()(std::get<_Idx>(std::move(__bound_args_))..., std::forward<_Args>(__args)...)))
- -> decltype( _Op()(std::get<_Idx>(std::move(__bound_args_))..., std::forward<_Args>(__args)...))
- { return _Op()(std::get<_Idx>(std::move(__bound_args_))..., std::forward<_Args>(__args)...); }
+ _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Args&&... __args) && noexcept(
+ noexcept(_Op()(std::get<_Idx>(std::move(__bound_args_))..., std::forward<_Args>(__args)...)))
+ -> decltype(_Op()(std::get<_Idx>(std::move(__bound_args_))..., std::forward<_Args>(__args)...)) {
+ return _Op()(std::get<_Idx>(std::move(__bound_args_))..., std::forward<_Args>(__args)...);
+ }
template <class... _Args, class = enable_if_t<!is_invocable_v<_Op, _BoundArgs..., _Args...>>>
auto operator()(_Args&&...) && = delete;
template <class... _Args, class = enable_if_t<is_invocable_v<_Op, _BoundArgs const..., _Args...>>>
- _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Args&&... __args) const&&
- noexcept(noexcept(_Op()(std::get<_Idx>(std::move(__bound_args_))..., std::forward<_Args>(__args)...)))
- -> decltype( _Op()(std::get<_Idx>(std::move(__bound_args_))..., std::forward<_Args>(__args)...))
- { return _Op()(std::get<_Idx>(std::move(__bound_args_))..., std::forward<_Args>(__args)...); }
+ _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Args&&... __args) const&& noexcept(
+ noexcept(_Op()(std::get<_Idx>(std::move(__bound_args_))..., std::forward<_Args>(__args)...)))
+ -> decltype(_Op()(std::get<_Idx>(std::move(__bound_args_))..., std::forward<_Args>(__args)...)) {
+ return _Op()(std::get<_Idx>(std::move(__bound_args_))..., std::forward<_Args>(__args)...);
+ }
template <class... _Args, class = enable_if_t<!is_invocable_v<_Op, _BoundArgs const..., _Args...>>>
auto operator()(_Args&&...) const&& = delete;
};
// __perfect_forward implements a perfect-forwarding call wrapper as explained in [func.require].
-template <class _Op, class ..._Args>
+template <class _Op, class... _Args>
using __perfect_forward = __perfect_forward_impl<_Op, index_sequence_for<_Args...>, _Args...>;
#endif // _LIBCPP_STD_VER >= 17
diff --git a/contrib/llvm-project/libcxx/include/__functional/pointer_to_binary_function.h b/contrib/llvm-project/libcxx/include/__functional/pointer_to_binary_function.h
index 88e6db222e07..51a7c3fe0fc0 100644
--- a/contrib/llvm-project/libcxx/include/__functional/pointer_to_binary_function.h
+++ b/contrib/llvm-project/libcxx/include/__functional/pointer_to_binary_function.h
@@ -23,21 +23,19 @@ _LIBCPP_BEGIN_NAMESPACE_STD
template <class _Arg1, class _Arg2, class _Result>
class _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX11 pointer_to_binary_function
- : public __binary_function<_Arg1, _Arg2, _Result>
-{
- _Result (*__f_)(_Arg1, _Arg2);
+ : public __binary_function<_Arg1, _Arg2, _Result> {
+ _Result (*__f_)(_Arg1, _Arg2);
+
public:
- _LIBCPP_HIDE_FROM_ABI explicit pointer_to_binary_function(_Result (*__f)(_Arg1, _Arg2))
- : __f_(__f) {}
- _LIBCPP_HIDE_FROM_ABI _Result operator()(_Arg1 __x, _Arg2 __y) const
- {return __f_(__x, __y);}
+ _LIBCPP_HIDE_FROM_ABI explicit pointer_to_binary_function(_Result (*__f)(_Arg1, _Arg2)) : __f_(__f) {}
+ _LIBCPP_HIDE_FROM_ABI _Result operator()(_Arg1 __x, _Arg2 __y) const { return __f_(__x, __y); }
};
template <class _Arg1, class _Arg2, class _Result>
-_LIBCPP_DEPRECATED_IN_CXX11 inline _LIBCPP_HIDE_FROM_ABI
-pointer_to_binary_function<_Arg1,_Arg2,_Result>
-ptr_fun(_Result (*__f)(_Arg1,_Arg2))
- {return pointer_to_binary_function<_Arg1,_Arg2,_Result>(__f);}
+_LIBCPP_DEPRECATED_IN_CXX11 inline _LIBCPP_HIDE_FROM_ABI pointer_to_binary_function<_Arg1, _Arg2, _Result>
+ptr_fun(_Result (*__f)(_Arg1, _Arg2)) {
+ return pointer_to_binary_function<_Arg1, _Arg2, _Result>(__f);
+}
#endif
diff --git a/contrib/llvm-project/libcxx/include/__functional/pointer_to_unary_function.h b/contrib/llvm-project/libcxx/include/__functional/pointer_to_unary_function.h
index ee13acfff757..0338e7671789 100644
--- a/contrib/llvm-project/libcxx/include/__functional/pointer_to_unary_function.h
+++ b/contrib/llvm-project/libcxx/include/__functional/pointer_to_unary_function.h
@@ -23,21 +23,19 @@ _LIBCPP_BEGIN_NAMESPACE_STD
template <class _Arg, class _Result>
class _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX11 pointer_to_unary_function
- : public __unary_function<_Arg, _Result>
-{
- _Result (*__f_)(_Arg);
+ : public __unary_function<_Arg, _Result> {
+ _Result (*__f_)(_Arg);
+
public:
- _LIBCPP_HIDE_FROM_ABI explicit pointer_to_unary_function(_Result (*__f)(_Arg))
- : __f_(__f) {}
- _LIBCPP_HIDE_FROM_ABI _Result operator()(_Arg __x) const
- {return __f_(__x);}
+ _LIBCPP_HIDE_FROM_ABI explicit pointer_to_unary_function(_Result (*__f)(_Arg)) : __f_(__f) {}
+ _LIBCPP_HIDE_FROM_ABI _Result operator()(_Arg __x) const { return __f_(__x); }
};
template <class _Arg, class _Result>
-_LIBCPP_DEPRECATED_IN_CXX11 inline _LIBCPP_HIDE_FROM_ABI
-pointer_to_unary_function<_Arg,_Result>
-ptr_fun(_Result (*__f)(_Arg))
- {return pointer_to_unary_function<_Arg,_Result>(__f);}
+_LIBCPP_DEPRECATED_IN_CXX11 inline _LIBCPP_HIDE_FROM_ABI pointer_to_unary_function<_Arg, _Result>
+ptr_fun(_Result (*__f)(_Arg)) {
+ return pointer_to_unary_function<_Arg, _Result>(__f);
+}
#endif // _LIBCPP_STD_VER <= 14 || defined(_LIBCPP_ENABLE_CXX17_REMOVED_BINDERS)
diff --git a/contrib/llvm-project/libcxx/include/__functional/ranges_operations.h b/contrib/llvm-project/libcxx/include/__functional/ranges_operations.h
index 0ed631d8a74b..38b28018049e 100644
--- a/contrib/llvm-project/libcxx/include/__functional/ranges_operations.h
+++ b/contrib/llvm-project/libcxx/include/__functional/ranges_operations.h
@@ -29,8 +29,8 @@ namespace ranges {
struct equal_to {
template <class _Tp, class _Up>
- requires equality_comparable_with<_Tp, _Up>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool operator()(_Tp &&__t, _Up &&__u) const
+ requires equality_comparable_with<_Tp, _Up>
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool operator()(_Tp&& __t, _Up&& __u) const
noexcept(noexcept(bool(std::forward<_Tp>(__t) == std::forward<_Up>(__u)))) {
return std::forward<_Tp>(__t) == std::forward<_Up>(__u);
}
@@ -40,8 +40,8 @@ struct equal_to {
struct not_equal_to {
template <class _Tp, class _Up>
- requires equality_comparable_with<_Tp, _Up>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool operator()(_Tp &&__t, _Up &&__u) const
+ requires equality_comparable_with<_Tp, _Up>
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool operator()(_Tp&& __t, _Up&& __u) const
noexcept(noexcept(bool(!(std::forward<_Tp>(__t) == std::forward<_Up>(__u))))) {
return !(std::forward<_Tp>(__t) == std::forward<_Up>(__u));
}
@@ -51,8 +51,8 @@ struct not_equal_to {
struct less {
template <class _Tp, class _Up>
- requires totally_ordered_with<_Tp, _Up>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool operator()(_Tp &&__t, _Up &&__u) const
+ requires totally_ordered_with<_Tp, _Up>
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool operator()(_Tp&& __t, _Up&& __u) const
noexcept(noexcept(bool(std::forward<_Tp>(__t) < std::forward<_Up>(__u)))) {
return std::forward<_Tp>(__t) < std::forward<_Up>(__u);
}
@@ -62,8 +62,8 @@ struct less {
struct less_equal {
template <class _Tp, class _Up>
- requires totally_ordered_with<_Tp, _Up>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool operator()(_Tp &&__t, _Up &&__u) const
+ requires totally_ordered_with<_Tp, _Up>
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool operator()(_Tp&& __t, _Up&& __u) const
noexcept(noexcept(bool(!(std::forward<_Up>(__u) < std::forward<_Tp>(__t))))) {
return !(std::forward<_Up>(__u) < std::forward<_Tp>(__t));
}
@@ -73,8 +73,8 @@ struct less_equal {
struct greater {
template <class _Tp, class _Up>
- requires totally_ordered_with<_Tp, _Up>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool operator()(_Tp &&__t, _Up &&__u) const
+ requires totally_ordered_with<_Tp, _Up>
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool operator()(_Tp&& __t, _Up&& __u) const
noexcept(noexcept(bool(std::forward<_Up>(__u) < std::forward<_Tp>(__t)))) {
return std::forward<_Up>(__u) < std::forward<_Tp>(__t);
}
@@ -84,8 +84,8 @@ struct greater {
struct greater_equal {
template <class _Tp, class _Up>
- requires totally_ordered_with<_Tp, _Up>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool operator()(_Tp &&__t, _Up &&__u) const
+ requires totally_ordered_with<_Tp, _Up>
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool operator()(_Tp&& __t, _Up&& __u) const
noexcept(noexcept(bool(!(std::forward<_Tp>(__t) < std::forward<_Up>(__u))))) {
return !(std::forward<_Tp>(__t) < std::forward<_Up>(__u));
}
diff --git a/contrib/llvm-project/libcxx/include/__functional/reference_wrapper.h b/contrib/llvm-project/libcxx/include/__functional/reference_wrapper.h
index 3688590d10d1..54de06a8879c 100644
--- a/contrib/llvm-project/libcxx/include/__functional/reference_wrapper.h
+++ b/contrib/llvm-project/libcxx/include/__functional/reference_wrapper.h
@@ -26,44 +26,43 @@
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _Tp>
-class _LIBCPP_TEMPLATE_VIS reference_wrapper : public __weak_result_type<_Tp>
-{
+class _LIBCPP_TEMPLATE_VIS reference_wrapper : public __weak_result_type<_Tp> {
public:
- // types
- typedef _Tp type;
+ // types
+ typedef _Tp type;
+
private:
- type* __f_;
+ type* __f_;
- static void __fun(_Tp&) _NOEXCEPT;
- static void __fun(_Tp&&) = delete;
+ static void __fun(_Tp&) _NOEXCEPT;
+ static void __fun(_Tp&&) = delete;
public:
- template <class _Up, class = __enable_if_t<!__is_same_uncvref<_Up, reference_wrapper>::value, decltype(__fun(std::declval<_Up>())) > >
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- reference_wrapper(_Up&& __u) _NOEXCEPT_(noexcept(__fun(std::declval<_Up>()))) {
- type& __f = static_cast<_Up&&>(__u);
- __f_ = std::addressof(__f);
- }
-
- // access
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- operator type&() const _NOEXCEPT {return *__f_;}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- type& get() const _NOEXCEPT {return *__f_;}
-
- // invoke
- template <class... _ArgTypes>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- typename __invoke_of<type&, _ArgTypes...>::type
- operator() (_ArgTypes&&... __args) const
+ template <
+ class _Up,
+ class = __enable_if_t<!__is_same_uncvref<_Up, reference_wrapper>::value, decltype(__fun(std::declval<_Up>())) > >
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 reference_wrapper(_Up&& __u)
+ _NOEXCEPT_(noexcept(__fun(std::declval<_Up>()))) {
+ type& __f = static_cast<_Up&&>(__u);
+ __f_ = std::addressof(__f);
+ }
+
+ // access
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 operator type&() const _NOEXCEPT { return *__f_; }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 type& get() const _NOEXCEPT { return *__f_; }
+
+ // invoke
+ template <class... _ArgTypes>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 typename __invoke_of<type&, _ArgTypes...>::type
+ operator()(_ArgTypes&&... __args) const
#if _LIBCPP_STD_VER >= 17
- // Since is_nothrow_invocable requires C++17 LWG3764 is not backported
- // to earlier versions.
- noexcept(is_nothrow_invocable_v<_Tp&, _ArgTypes...>)
+ // Since is_nothrow_invocable requires C++17 LWG3764 is not backported
+ // to earlier versions.
+ noexcept(is_nothrow_invocable_v<_Tp&, _ArgTypes...>)
#endif
- {
- return std::__invoke(get(), std::forward<_ArgTypes>(__args)...);
- }
+ {
+ return std::__invoke(get(), std::forward<_ArgTypes>(__args)...);
+ }
};
#if _LIBCPP_STD_VER >= 17
@@ -72,39 +71,31 @@ reference_wrapper(_Tp&) -> reference_wrapper<_Tp>;
#endif
template <class _Tp>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-reference_wrapper<_Tp>
-ref(_Tp& __t) _NOEXCEPT
-{
- return reference_wrapper<_Tp>(__t);
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 reference_wrapper<_Tp> ref(_Tp& __t) _NOEXCEPT {
+ return reference_wrapper<_Tp>(__t);
}
template <class _Tp>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-reference_wrapper<_Tp>
-ref(reference_wrapper<_Tp> __t) _NOEXCEPT
-{
- return __t;
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 reference_wrapper<_Tp>
+ref(reference_wrapper<_Tp> __t) _NOEXCEPT {
+ return __t;
}
template <class _Tp>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-reference_wrapper<const _Tp>
-cref(const _Tp& __t) _NOEXCEPT
-{
- return reference_wrapper<const _Tp>(__t);
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 reference_wrapper<const _Tp> cref(const _Tp& __t) _NOEXCEPT {
+ return reference_wrapper<const _Tp>(__t);
}
template <class _Tp>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-reference_wrapper<const _Tp>
-cref(reference_wrapper<_Tp> __t) _NOEXCEPT
-{
- return __t;
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 reference_wrapper<const _Tp>
+cref(reference_wrapper<_Tp> __t) _NOEXCEPT {
+ return __t;
}
-template <class _Tp> void ref(const _Tp&&) = delete;
-template <class _Tp> void cref(const _Tp&&) = delete;
+template <class _Tp>
+void ref(const _Tp&&) = delete;
+template <class _Tp>
+void cref(const _Tp&&) = delete;
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__functional/unary_function.h b/contrib/llvm-project/libcxx/include/__functional/unary_function.h
index f07cac175a99..69b1bc94220a 100644
--- a/contrib/llvm-project/libcxx/include/__functional/unary_function.h
+++ b/contrib/llvm-project/libcxx/include/__functional/unary_function.h
@@ -20,18 +20,18 @@ _LIBCPP_BEGIN_NAMESPACE_STD
#if _LIBCPP_STD_VER <= 14 || defined(_LIBCPP_ENABLE_CXX17_REMOVED_UNARY_BINARY_FUNCTION)
template <class _Arg, class _Result>
-struct _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX11 unary_function
-{
- typedef _Arg argument_type;
- typedef _Result result_type;
+struct _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX11 unary_function {
+ typedef _Arg argument_type;
+ typedef _Result result_type;
};
#endif // _LIBCPP_STD_VER <= 14
-template <class _Arg, class _Result> struct __unary_function_keep_layout_base {
+template <class _Arg, class _Result>
+struct __unary_function_keep_layout_base {
#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_BINDER_TYPEDEFS)
using argument_type _LIBCPP_DEPRECATED_IN_CXX17 = _Arg;
- using result_type _LIBCPP_DEPRECATED_IN_CXX17 = _Result;
+ using result_type _LIBCPP_DEPRECATED_IN_CXX17 = _Result;
#endif
};
diff --git a/contrib/llvm-project/libcxx/include/__functional/unary_negate.h b/contrib/llvm-project/libcxx/include/__functional/unary_negate.h
index b2eed8e2db35..d130b7d728a2 100644
--- a/contrib/llvm-project/libcxx/include/__functional/unary_negate.h
+++ b/contrib/llvm-project/libcxx/include/__functional/unary_negate.h
@@ -23,22 +23,23 @@ _LIBCPP_BEGIN_NAMESPACE_STD
template <class _Predicate>
class _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX17 unary_negate
- : public __unary_function<typename _Predicate::argument_type, bool>
-{
- _Predicate __pred_;
+ : public __unary_function<typename _Predicate::argument_type, bool> {
+ _Predicate __pred_;
+
public:
- _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
- explicit unary_negate(const _Predicate& __pred)
- : __pred_(__pred) {}
- _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
- bool operator()(const typename _Predicate::argument_type& __x) const
- {return !__pred_(__x);}
+ _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI explicit unary_negate(const _Predicate& __pred)
+ : __pred_(__pred) {}
+ _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI bool
+ operator()(const typename _Predicate::argument_type& __x) const {
+ return !__pred_(__x);
+ }
};
template <class _Predicate>
-_LIBCPP_DEPRECATED_IN_CXX17 inline _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
-unary_negate<_Predicate>
-not1(const _Predicate& __pred) {return unary_negate<_Predicate>(__pred);}
+_LIBCPP_DEPRECATED_IN_CXX17 inline _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI unary_negate<_Predicate>
+not1(const _Predicate& __pred) {
+ return unary_negate<_Predicate>(__pred);
+}
#endif // _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_NEGATORS)
diff --git a/contrib/llvm-project/libcxx/include/__functional/weak_result_type.h b/contrib/llvm-project/libcxx/include/__functional/weak_result_type.h
index da6fe54bfae7..ad7a8395186c 100644
--- a/contrib/llvm-project/libcxx/include/__functional/weak_result_type.h
+++ b/contrib/llvm-project/libcxx/include/__functional/weak_result_type.h
@@ -25,268 +25,205 @@
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _Tp>
-struct __has_result_type
-{
+struct __has_result_type {
private:
- template <class _Up> static false_type __test(...);
- template <class _Up> static true_type __test(typename _Up::result_type* = 0);
+ template <class _Up>
+ static false_type __test(...);
+ template <class _Up>
+ static true_type __test(typename _Up::result_type* = 0);
+
public:
- static const bool value = decltype(__test<_Tp>(0))::value;
+ static const bool value = decltype(__test<_Tp>(0))::value;
};
// __weak_result_type
template <class _Tp>
-struct __derives_from_unary_function
-{
+struct __derives_from_unary_function {
private:
- struct __two {char __lx; char __lxx;};
- static __two __test(...);
- template <class _Ap, class _Rp>
- static __unary_function<_Ap, _Rp>
- __test(const volatile __unary_function<_Ap, _Rp>*);
+ struct __two {
+ char __lx;
+ char __lxx;
+ };
+ static __two __test(...);
+ template <class _Ap, class _Rp>
+ static __unary_function<_Ap, _Rp> __test(const volatile __unary_function<_Ap, _Rp>*);
public:
- static const bool value = !is_same<decltype(__test((_Tp*)0)), __two>::value;
- typedef decltype(__test((_Tp*)0)) type;
+ static const bool value = !is_same<decltype(__test((_Tp*)0)), __two>::value;
+ typedef decltype(__test((_Tp*)0)) type;
};
template <class _Tp>
-struct __derives_from_binary_function
-{
+struct __derives_from_binary_function {
private:
- struct __two {char __lx; char __lxx;};
- static __two __test(...);
- template <class _A1, class _A2, class _Rp>
- static __binary_function<_A1, _A2, _Rp>
- __test(const volatile __binary_function<_A1, _A2, _Rp>*);
+ struct __two {
+ char __lx;
+ char __lxx;
+ };
+ static __two __test(...);
+ template <class _A1, class _A2, class _Rp>
+ static __binary_function<_A1, _A2, _Rp> __test(const volatile __binary_function<_A1, _A2, _Rp>*);
public:
- static const bool value = !is_same<decltype(__test((_Tp*)0)), __two>::value;
- typedef decltype(__test((_Tp*)0)) type;
+ static const bool value = !is_same<decltype(__test((_Tp*)0)), __two>::value;
+ typedef decltype(__test((_Tp*)0)) type;
};
template <class _Tp, bool = __derives_from_unary_function<_Tp>::value>
-struct __maybe_derive_from_unary_function // bool is true
- : public __derives_from_unary_function<_Tp>::type
-{
-};
+struct __maybe_derive_from_unary_function // bool is true
+ : public __derives_from_unary_function<_Tp>::type {};
template <class _Tp>
-struct __maybe_derive_from_unary_function<_Tp, false>
-{
-};
+struct __maybe_derive_from_unary_function<_Tp, false> {};
template <class _Tp, bool = __derives_from_binary_function<_Tp>::value>
-struct __maybe_derive_from_binary_function // bool is true
- : public __derives_from_binary_function<_Tp>::type
-{
-};
+struct __maybe_derive_from_binary_function // bool is true
+ : public __derives_from_binary_function<_Tp>::type {};
template <class _Tp>
-struct __maybe_derive_from_binary_function<_Tp, false>
-{
-};
+struct __maybe_derive_from_binary_function<_Tp, false> {};
template <class _Tp, bool = __has_result_type<_Tp>::value>
struct __weak_result_type_imp // bool is true
: public __maybe_derive_from_unary_function<_Tp>,
- public __maybe_derive_from_binary_function<_Tp>
-{
+ public __maybe_derive_from_binary_function<_Tp> {
#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_BINDER_TYPEDEFS)
- using result_type _LIBCPP_NODEBUG _LIBCPP_DEPRECATED_IN_CXX17 = typename _Tp::result_type;
+ using result_type _LIBCPP_NODEBUG _LIBCPP_DEPRECATED_IN_CXX17 = typename _Tp::result_type;
#endif
};
template <class _Tp>
struct __weak_result_type_imp<_Tp, false>
- : public __maybe_derive_from_unary_function<_Tp>,
- public __maybe_derive_from_binary_function<_Tp>
-{
-};
+ : public __maybe_derive_from_unary_function<_Tp>, public __maybe_derive_from_binary_function<_Tp> {};
template <class _Tp>
-struct __weak_result_type
- : public __weak_result_type_imp<_Tp>
-{
-};
+struct __weak_result_type : public __weak_result_type_imp<_Tp> {};
// 0 argument case
template <class _Rp>
-struct __weak_result_type<_Rp ()>
-{
+struct __weak_result_type<_Rp()> {
#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_BINDER_TYPEDEFS)
- using result_type _LIBCPP_NODEBUG _LIBCPP_DEPRECATED_IN_CXX17 = _Rp;
+ using result_type _LIBCPP_NODEBUG _LIBCPP_DEPRECATED_IN_CXX17 = _Rp;
#endif
};
template <class _Rp>
-struct __weak_result_type<_Rp (&)()>
-{
+struct __weak_result_type<_Rp (&)()> {
#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_BINDER_TYPEDEFS)
- using result_type _LIBCPP_NODEBUG _LIBCPP_DEPRECATED_IN_CXX17 = _Rp;
+ using result_type _LIBCPP_NODEBUG _LIBCPP_DEPRECATED_IN_CXX17 = _Rp;
#endif
};
template <class _Rp>
-struct __weak_result_type<_Rp (*)()>
-{
+struct __weak_result_type<_Rp (*)()> {
#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_BINDER_TYPEDEFS)
- using result_type _LIBCPP_NODEBUG _LIBCPP_DEPRECATED_IN_CXX17 = _Rp;
+ using result_type _LIBCPP_NODEBUG _LIBCPP_DEPRECATED_IN_CXX17 = _Rp;
#endif
};
// 1 argument case
template <class _Rp, class _A1>
-struct __weak_result_type<_Rp (_A1)>
- : public __unary_function<_A1, _Rp>
-{
-};
+struct __weak_result_type<_Rp(_A1)> : public __unary_function<_A1, _Rp> {};
template <class _Rp, class _A1>
-struct __weak_result_type<_Rp (&)(_A1)>
- : public __unary_function<_A1, _Rp>
-{
-};
+struct __weak_result_type<_Rp (&)(_A1)> : public __unary_function<_A1, _Rp> {};
template <class _Rp, class _A1>
-struct __weak_result_type<_Rp (*)(_A1)>
- : public __unary_function<_A1, _Rp>
-{
-};
+struct __weak_result_type<_Rp (*)(_A1)> : public __unary_function<_A1, _Rp> {};
template <class _Rp, class _Cp>
-struct __weak_result_type<_Rp (_Cp::*)()>
- : public __unary_function<_Cp*, _Rp>
-{
-};
+struct __weak_result_type<_Rp (_Cp::*)()> : public __unary_function<_Cp*, _Rp> {};
template <class _Rp, class _Cp>
-struct __weak_result_type<_Rp (_Cp::*)() const>
- : public __unary_function<const _Cp*, _Rp>
-{
-};
+struct __weak_result_type<_Rp (_Cp::*)() const> : public __unary_function<const _Cp*, _Rp> {};
template <class _Rp, class _Cp>
-struct __weak_result_type<_Rp (_Cp::*)() volatile>
- : public __unary_function<volatile _Cp*, _Rp>
-{
-};
+struct __weak_result_type<_Rp (_Cp::*)() volatile> : public __unary_function<volatile _Cp*, _Rp> {};
template <class _Rp, class _Cp>
-struct __weak_result_type<_Rp (_Cp::*)() const volatile>
- : public __unary_function<const volatile _Cp*, _Rp>
-{
-};
+struct __weak_result_type<_Rp (_Cp::*)() const volatile> : public __unary_function<const volatile _Cp*, _Rp> {};
// 2 argument case
template <class _Rp, class _A1, class _A2>
-struct __weak_result_type<_Rp (_A1, _A2)>
- : public __binary_function<_A1, _A2, _Rp>
-{
-};
+struct __weak_result_type<_Rp(_A1, _A2)> : public __binary_function<_A1, _A2, _Rp> {};
template <class _Rp, class _A1, class _A2>
-struct __weak_result_type<_Rp (*)(_A1, _A2)>
- : public __binary_function<_A1, _A2, _Rp>
-{
-};
+struct __weak_result_type<_Rp (*)(_A1, _A2)> : public __binary_function<_A1, _A2, _Rp> {};
template <class _Rp, class _A1, class _A2>
-struct __weak_result_type<_Rp (&)(_A1, _A2)>
- : public __binary_function<_A1, _A2, _Rp>
-{
-};
+struct __weak_result_type<_Rp (&)(_A1, _A2)> : public __binary_function<_A1, _A2, _Rp> {};
template <class _Rp, class _Cp, class _A1>
-struct __weak_result_type<_Rp (_Cp::*)(_A1)>
- : public __binary_function<_Cp*, _A1, _Rp>
-{
-};
+struct __weak_result_type<_Rp (_Cp::*)(_A1)> : public __binary_function<_Cp*, _A1, _Rp> {};
template <class _Rp, class _Cp, class _A1>
-struct __weak_result_type<_Rp (_Cp::*)(_A1) const>
- : public __binary_function<const _Cp*, _A1, _Rp>
-{
-};
+struct __weak_result_type<_Rp (_Cp::*)(_A1) const> : public __binary_function<const _Cp*, _A1, _Rp> {};
template <class _Rp, class _Cp, class _A1>
-struct __weak_result_type<_Rp (_Cp::*)(_A1) volatile>
- : public __binary_function<volatile _Cp*, _A1, _Rp>
-{
-};
+struct __weak_result_type<_Rp (_Cp::*)(_A1) volatile> : public __binary_function<volatile _Cp*, _A1, _Rp> {};
template <class _Rp, class _Cp, class _A1>
-struct __weak_result_type<_Rp (_Cp::*)(_A1) const volatile>
- : public __binary_function<const volatile _Cp*, _A1, _Rp>
-{
+struct __weak_result_type<_Rp (_Cp::*)(_A1) const volatile> : public __binary_function<const volatile _Cp*, _A1, _Rp> {
};
// 3 or more arguments
-template <class _Rp, class _A1, class _A2, class _A3, class ..._A4>
-struct __weak_result_type<_Rp (_A1, _A2, _A3, _A4...)>
-{
+template <class _Rp, class _A1, class _A2, class _A3, class... _A4>
+struct __weak_result_type<_Rp(_A1, _A2, _A3, _A4...)> {
#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_BINDER_TYPEDEFS)
- using result_type _LIBCPP_NODEBUG _LIBCPP_DEPRECATED_IN_CXX17 = _Rp;
+ using result_type _LIBCPP_NODEBUG _LIBCPP_DEPRECATED_IN_CXX17 = _Rp;
#endif
};
-template <class _Rp, class _A1, class _A2, class _A3, class ..._A4>
-struct __weak_result_type<_Rp (&)(_A1, _A2, _A3, _A4...)>
-{
+template <class _Rp, class _A1, class _A2, class _A3, class... _A4>
+struct __weak_result_type<_Rp (&)(_A1, _A2, _A3, _A4...)> {
#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_BINDER_TYPEDEFS)
- using result_type _LIBCPP_NODEBUG _LIBCPP_DEPRECATED_IN_CXX17 = _Rp;
+ using result_type _LIBCPP_NODEBUG _LIBCPP_DEPRECATED_IN_CXX17 = _Rp;
#endif
};
-template <class _Rp, class _A1, class _A2, class _A3, class ..._A4>
-struct __weak_result_type<_Rp (*)(_A1, _A2, _A3, _A4...)>
-{
+template <class _Rp, class _A1, class _A2, class _A3, class... _A4>
+struct __weak_result_type<_Rp (*)(_A1, _A2, _A3, _A4...)> {
#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_BINDER_TYPEDEFS)
- using result_type _LIBCPP_NODEBUG _LIBCPP_DEPRECATED_IN_CXX17 = _Rp;
+ using result_type _LIBCPP_NODEBUG _LIBCPP_DEPRECATED_IN_CXX17 = _Rp;
#endif
};
-template <class _Rp, class _Cp, class _A1, class _A2, class ..._A3>
-struct __weak_result_type<_Rp (_Cp::*)(_A1, _A2, _A3...)>
-{
+template <class _Rp, class _Cp, class _A1, class _A2, class... _A3>
+struct __weak_result_type<_Rp (_Cp::*)(_A1, _A2, _A3...)> {
#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_BINDER_TYPEDEFS)
- using result_type _LIBCPP_NODEBUG _LIBCPP_DEPRECATED_IN_CXX17 = _Rp;
+ using result_type _LIBCPP_NODEBUG _LIBCPP_DEPRECATED_IN_CXX17 = _Rp;
#endif
};
-template <class _Rp, class _Cp, class _A1, class _A2, class ..._A3>
-struct __weak_result_type<_Rp (_Cp::*)(_A1, _A2, _A3...) const>
-{
+template <class _Rp, class _Cp, class _A1, class _A2, class... _A3>
+struct __weak_result_type<_Rp (_Cp::*)(_A1, _A2, _A3...) const> {
#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_BINDER_TYPEDEFS)
- using result_type _LIBCPP_NODEBUG _LIBCPP_DEPRECATED_IN_CXX17 = _Rp;
+ using result_type _LIBCPP_NODEBUG _LIBCPP_DEPRECATED_IN_CXX17 = _Rp;
#endif
};
-template <class _Rp, class _Cp, class _A1, class _A2, class ..._A3>
-struct __weak_result_type<_Rp (_Cp::*)(_A1, _A2, _A3...) volatile>
-{
+template <class _Rp, class _Cp, class _A1, class _A2, class... _A3>
+struct __weak_result_type<_Rp (_Cp::*)(_A1, _A2, _A3...) volatile> {
#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_BINDER_TYPEDEFS)
- using result_type _LIBCPP_NODEBUG _LIBCPP_DEPRECATED_IN_CXX17 = _Rp;
+ using result_type _LIBCPP_NODEBUG _LIBCPP_DEPRECATED_IN_CXX17 = _Rp;
#endif
};
-template <class _Rp, class _Cp, class _A1, class _A2, class ..._A3>
-struct __weak_result_type<_Rp (_Cp::*)(_A1, _A2, _A3...) const volatile>
-{
+template <class _Rp, class _Cp, class _A1, class _A2, class... _A3>
+struct __weak_result_type<_Rp (_Cp::*)(_A1, _A2, _A3...) const volatile> {
#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_BINDER_TYPEDEFS)
- using result_type _LIBCPP_NODEBUG _LIBCPP_DEPRECATED_IN_CXX17 = _Rp;
+ using result_type _LIBCPP_NODEBUG _LIBCPP_DEPRECATED_IN_CXX17 = _Rp;
#endif
};
-template <class _Tp, class ..._Args>
-struct __invoke_return
-{
- typedef decltype(std::__invoke(std::declval<_Tp>(), std::declval<_Args>()...)) type;
+template <class _Tp, class... _Args>
+struct __invoke_return {
+ typedef decltype(std::__invoke(std::declval<_Tp>(), std::declval<_Args>()...)) type;
};
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__fwd/get.h b/contrib/llvm-project/libcxx/include/__fwd/get.h
index 1ca7148e3fa2..e7261b826953 100644
--- a/contrib/llvm-project/libcxx/include/__fwd/get.h
+++ b/contrib/llvm-project/libcxx/include/__fwd/get.h
@@ -26,70 +26,54 @@ _LIBCPP_BEGIN_NAMESPACE_STD
#ifndef _LIBCPP_CXX03_LANG
-template <size_t _Ip, class ..._Tp>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
-typename tuple_element<_Ip, tuple<_Tp...> >::type&
+template <size_t _Ip, class... _Tp>
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 typename tuple_element<_Ip, tuple<_Tp...> >::type&
get(tuple<_Tp...>&) _NOEXCEPT;
-template <size_t _Ip, class ..._Tp>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
-const typename tuple_element<_Ip, tuple<_Tp...> >::type&
+template <size_t _Ip, class... _Tp>
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 const typename tuple_element<_Ip, tuple<_Tp...> >::type&
get(const tuple<_Tp...>&) _NOEXCEPT;
-template <size_t _Ip, class ..._Tp>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
-typename tuple_element<_Ip, tuple<_Tp...> >::type&&
+template <size_t _Ip, class... _Tp>
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 typename tuple_element<_Ip, tuple<_Tp...> >::type&&
get(tuple<_Tp...>&&) _NOEXCEPT;
-template <size_t _Ip, class ..._Tp>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
-const typename tuple_element<_Ip, tuple<_Tp...> >::type&&
+template <size_t _Ip, class... _Tp>
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 const typename tuple_element<_Ip, tuple<_Tp...> >::type&&
get(const tuple<_Tp...>&&) _NOEXCEPT;
#endif //_LIBCPP_CXX03_LANG
template <size_t _Ip, class _T1, class _T2>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
-typename tuple_element<_Ip, pair<_T1, _T2> >::type&
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 typename tuple_element<_Ip, pair<_T1, _T2> >::type&
get(pair<_T1, _T2>&) _NOEXCEPT;
template <size_t _Ip, class _T1, class _T2>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
-const typename tuple_element<_Ip, pair<_T1, _T2> >::type&
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 const typename tuple_element<_Ip, pair<_T1, _T2> >::type&
get(const pair<_T1, _T2>&) _NOEXCEPT;
#ifndef _LIBCPP_CXX03_LANG
template <size_t _Ip, class _T1, class _T2>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
-typename tuple_element<_Ip, pair<_T1, _T2> >::type&&
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 typename tuple_element<_Ip, pair<_T1, _T2> >::type&&
get(pair<_T1, _T2>&&) _NOEXCEPT;
template <size_t _Ip, class _T1, class _T2>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
-const typename tuple_element<_Ip, pair<_T1, _T2> >::type&&
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 const typename tuple_element<_Ip, pair<_T1, _T2> >::type&&
get(const pair<_T1, _T2>&&) _NOEXCEPT;
#endif
template <size_t _Ip, class _Tp, size_t _Size>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
-_Tp&
-get(array<_Tp, _Size>&) _NOEXCEPT;
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _Tp& get(array<_Tp, _Size>&) _NOEXCEPT;
template <size_t _Ip, class _Tp, size_t _Size>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
-const _Tp&
-get(const array<_Tp, _Size>&) _NOEXCEPT;
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 const _Tp& get(const array<_Tp, _Size>&) _NOEXCEPT;
#ifndef _LIBCPP_CXX03_LANG
template <size_t _Ip, class _Tp, size_t _Size>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
-_Tp&&
-get(array<_Tp, _Size>&&) _NOEXCEPT;
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _Tp&& get(array<_Tp, _Size>&&) _NOEXCEPT;
template <size_t _Ip, class _Tp, size_t _Size>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
-const _Tp&&
-get(const array<_Tp, _Size>&&) _NOEXCEPT;
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 const _Tp&& get(const array<_Tp, _Size>&&) _NOEXCEPT;
#endif
#if _LIBCPP_STD_VER >= 20
diff --git a/contrib/llvm-project/libcxx/include/__fwd/span.h b/contrib/llvm-project/libcxx/include/__fwd/span.h
index e9fa70382f59..8dafa742c19d 100644
--- a/contrib/llvm-project/libcxx/include/__fwd/span.h
+++ b/contrib/llvm-project/libcxx/include/__fwd/span.h
@@ -26,7 +26,8 @@ _LIBCPP_BEGIN_NAMESPACE_STD
#if _LIBCPP_STD_VER >= 20
inline constexpr size_t dynamic_extent = numeric_limits<size_t>::max();
-template <typename _Tp, size_t _Extent = dynamic_extent> class span;
+template <typename _Tp, size_t _Extent = dynamic_extent>
+class span;
#endif
diff --git a/contrib/llvm-project/libcxx/include/__fwd/string_view.h b/contrib/llvm-project/libcxx/include/__fwd/string_view.h
index 786765ca6a2e..72a64be5b00b 100644
--- a/contrib/llvm-project/libcxx/include/__fwd/string_view.h
+++ b/contrib/llvm-project/libcxx/include/__fwd/string_view.h
@@ -19,17 +19,17 @@
_LIBCPP_BEGIN_NAMESPACE_STD
-template<class _CharT, class _Traits = char_traits<_CharT> >
+template <class _CharT, class _Traits = char_traits<_CharT> >
class _LIBCPP_TEMPLATE_VIS basic_string_view;
-typedef basic_string_view<char> string_view;
+typedef basic_string_view<char> string_view;
#ifndef _LIBCPP_HAS_NO_CHAR8_T
-typedef basic_string_view<char8_t> u8string_view;
+typedef basic_string_view<char8_t> u8string_view;
#endif
typedef basic_string_view<char16_t> u16string_view;
typedef basic_string_view<char32_t> u32string_view;
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
-typedef basic_string_view<wchar_t> wstring_view;
+typedef basic_string_view<wchar_t> wstring_view;
#endif
// clang-format off
diff --git a/contrib/llvm-project/libcxx/include/__fwd/subrange.h b/contrib/llvm-project/libcxx/include/__fwd/subrange.h
index 24db670575f4..d09b9b1c5b97 100644
--- a/contrib/llvm-project/libcxx/include/__fwd/subrange.h
+++ b/contrib/llvm-project/libcxx/include/__fwd/subrange.h
@@ -17,7 +17,7 @@
#if _LIBCPP_STD_VER >= 20
-#include <__iterator/concepts.h>
+# include <__iterator/concepts.h>
_LIBCPP_BEGIN_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__hash_table b/contrib/llvm-project/libcxx/include/__hash_table
index fa950ac7e9b7..3cee48ef8538 100644
--- a/contrib/llvm-project/libcxx/include/__hash_table
+++ b/contrib/llvm-project/libcxx/include/__hash_table
@@ -55,7 +55,6 @@
_LIBCPP_PUSH_MACROS
#include <__undef_macros>
-
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _Key, class _Tp>
@@ -67,7 +66,7 @@ struct __is_hash_value_type_imp : false_type {};
template <class _Key, class _Value>
struct __is_hash_value_type_imp<__hash_value_type<_Key, _Value> > : true_type {};
-template <class ..._Args>
+template <class... _Args>
struct __is_hash_value_type : false_type {};
template <class _One>
@@ -76,110 +75,91 @@ struct __is_hash_value_type<_One> : __is_hash_value_type_imp<__remove_cvref_t<_O
_LIBCPP_EXPORTED_FROM_ABI size_t __next_prime(size_t __n);
template <class _NodePtr>
-struct __hash_node_base
-{
- typedef typename pointer_traits<_NodePtr>::element_type __node_type;
- typedef __hash_node_base __first_node;
- typedef __rebind_pointer_t<_NodePtr, __first_node> __node_base_pointer;
- typedef _NodePtr __node_pointer;
+struct __hash_node_base {
+ typedef typename pointer_traits<_NodePtr>::element_type __node_type;
+ typedef __hash_node_base __first_node;
+ typedef __rebind_pointer_t<_NodePtr, __first_node> __node_base_pointer;
+ typedef _NodePtr __node_pointer;
#if defined(_LIBCPP_ABI_FIX_UNORDERED_NODE_POINTER_UB)
typedef __node_base_pointer __next_pointer;
#else
- typedef __conditional_t<is_pointer<__node_pointer>::value, __node_base_pointer, __node_pointer> __next_pointer;
+ typedef __conditional_t<is_pointer<__node_pointer>::value, __node_base_pointer, __node_pointer> __next_pointer;
#endif
- __next_pointer __next_;
+ __next_pointer __next_;
- _LIBCPP_HIDE_FROM_ABI
- __next_pointer __ptr() _NOEXCEPT {
- return static_cast<__next_pointer>(
- pointer_traits<__node_base_pointer>::pointer_to(*this));
- }
+ _LIBCPP_HIDE_FROM_ABI __next_pointer __ptr() _NOEXCEPT {
+ return static_cast<__next_pointer>(pointer_traits<__node_base_pointer>::pointer_to(*this));
+ }
- _LIBCPP_HIDE_FROM_ABI
- __node_pointer __upcast() _NOEXCEPT {
- return static_cast<__node_pointer>(
- pointer_traits<__node_base_pointer>::pointer_to(*this));
- }
+ _LIBCPP_HIDE_FROM_ABI __node_pointer __upcast() _NOEXCEPT {
+ return static_cast<__node_pointer>(pointer_traits<__node_base_pointer>::pointer_to(*this));
+ }
- _LIBCPP_HIDE_FROM_ABI
- size_t __hash() const _NOEXCEPT {
- return static_cast<__node_type const&>(*this).__hash_;
- }
+ _LIBCPP_HIDE_FROM_ABI size_t __hash() const _NOEXCEPT { return static_cast<__node_type const&>(*this).__hash_; }
- _LIBCPP_HIDE_FROM_ABI __hash_node_base() _NOEXCEPT : __next_(nullptr) {}
- _LIBCPP_HIDE_FROM_ABI explicit __hash_node_base(__next_pointer __next) _NOEXCEPT : __next_(__next) {}
+ _LIBCPP_HIDE_FROM_ABI __hash_node_base() _NOEXCEPT : __next_(nullptr) {}
+ _LIBCPP_HIDE_FROM_ABI explicit __hash_node_base(__next_pointer __next) _NOEXCEPT : __next_(__next) {}
};
template <class _Tp, class _VoidPtr>
-struct __hash_node
- : public __hash_node_base
- <
- __rebind_pointer_t<_VoidPtr, __hash_node<_Tp, _VoidPtr> >
- >
-{
- typedef _Tp __node_value_type;
- using _Base = __hash_node_base<__rebind_pointer_t<_VoidPtr, __hash_node<_Tp, _VoidPtr> > >;
- using __next_pointer = typename _Base::__next_pointer;
+struct __hash_node : public __hash_node_base< __rebind_pointer_t<_VoidPtr, __hash_node<_Tp, _VoidPtr> > > {
+ typedef _Tp __node_value_type;
+ using _Base = __hash_node_base<__rebind_pointer_t<_VoidPtr, __hash_node<_Tp, _VoidPtr> > >;
+ using __next_pointer = typename _Base::__next_pointer;
- size_t __hash_;
+ size_t __hash_;
- // We allow starting the lifetime of nodes without initializing the value held by the node,
- // since that is handled by the hash table itself in order to be allocator-aware.
+ // We allow starting the lifetime of nodes without initializing the value held by the node,
+ // since that is handled by the hash table itself in order to be allocator-aware.
#ifndef _LIBCPP_CXX03_LANG
+
private:
- union {
- _Tp __value_;
- };
+ union {
+ _Tp __value_;
+ };
public:
- _LIBCPP_HIDE_FROM_ABI _Tp& __get_value() { return __value_; }
+ _LIBCPP_HIDE_FROM_ABI _Tp& __get_value() { return __value_; }
#else
+
private:
- _ALIGNAS_TYPE(_Tp) char __buffer_[sizeof(_Tp)];
+ _ALIGNAS_TYPE(_Tp) char __buffer_[sizeof(_Tp)];
public:
- _LIBCPP_HIDE_FROM_ABI _Tp& __get_value() {
- return *std::__launder(reinterpret_cast<_Tp*>(&__buffer_));
- }
+ _LIBCPP_HIDE_FROM_ABI _Tp& __get_value() { return *std::__launder(reinterpret_cast<_Tp*>(&__buffer_)); }
#endif
- _LIBCPP_HIDE_FROM_ABI explicit __hash_node(__next_pointer __next, size_t __hash) : _Base(__next), __hash_(__hash) {}
- _LIBCPP_HIDE_FROM_ABI ~__hash_node() {}
+ _LIBCPP_HIDE_FROM_ABI explicit __hash_node(__next_pointer __next, size_t __hash) : _Base(__next), __hash_(__hash) {}
+ _LIBCPP_HIDE_FROM_ABI ~__hash_node() {}
};
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-__is_hash_power2(size_t __bc)
-{
- return __bc > 2 && !(__bc & (__bc - 1));
-}
+inline _LIBCPP_HIDE_FROM_ABI bool __is_hash_power2(size_t __bc) { return __bc > 2 && !(__bc & (__bc - 1)); }
-inline _LIBCPP_HIDE_FROM_ABI
-size_t
-__constrain_hash(size_t __h, size_t __bc)
-{
- return !(__bc & (__bc - 1)) ? __h & (__bc - 1) :
- (__h < __bc ? __h : __h % __bc);
+inline _LIBCPP_HIDE_FROM_ABI size_t __constrain_hash(size_t __h, size_t __bc) {
+ return !(__bc & (__bc - 1)) ? __h & (__bc - 1) : (__h < __bc ? __h : __h % __bc);
}
-inline _LIBCPP_HIDE_FROM_ABI
-size_t
-__next_hash_pow2(size_t __n)
-{
- return __n < 2 ? __n : (size_t(1) << (numeric_limits<size_t>::digits - __libcpp_clz(__n-1)));
+inline _LIBCPP_HIDE_FROM_ABI size_t __next_hash_pow2(size_t __n) {
+ return __n < 2 ? __n : (size_t(1) << (numeric_limits<size_t>::digits - __libcpp_clz(__n - 1)));
}
+template <class _Tp, class _Hash, class _Equal, class _Alloc>
+class __hash_table;
-template <class _Tp, class _Hash, class _Equal, class _Alloc> class __hash_table;
-
-template <class _NodePtr> class _LIBCPP_TEMPLATE_VIS __hash_iterator;
-template <class _ConstNodePtr> class _LIBCPP_TEMPLATE_VIS __hash_const_iterator;
-template <class _NodePtr> class _LIBCPP_TEMPLATE_VIS __hash_local_iterator;
-template <class _ConstNodePtr> class _LIBCPP_TEMPLATE_VIS __hash_const_local_iterator;
-template <class _HashIterator> class _LIBCPP_TEMPLATE_VIS __hash_map_iterator;
-template <class _HashIterator> class _LIBCPP_TEMPLATE_VIS __hash_map_const_iterator;
+template <class _NodePtr>
+class _LIBCPP_TEMPLATE_VIS __hash_iterator;
+template <class _ConstNodePtr>
+class _LIBCPP_TEMPLATE_VIS __hash_const_iterator;
+template <class _NodePtr>
+class _LIBCPP_TEMPLATE_VIS __hash_local_iterator;
+template <class _ConstNodePtr>
+class _LIBCPP_TEMPLATE_VIS __hash_const_local_iterator;
+template <class _HashIterator>
+class _LIBCPP_TEMPLATE_VIS __hash_map_iterator;
+template <class _HashIterator>
+class _LIBCPP_TEMPLATE_VIS __hash_map_const_iterator;
template <class _Tp>
struct __hash_key_value_types {
@@ -189,73 +169,47 @@ struct __hash_key_value_types {
typedef _Tp __container_value_type;
static const bool __is_map = false;
- _LIBCPP_HIDE_FROM_ABI
- static key_type const& __get_key(_Tp const& __v) {
- return __v;
- }
- _LIBCPP_HIDE_FROM_ABI
- static __container_value_type const& __get_value(__node_value_type const& __v) {
- return __v;
- }
- _LIBCPP_HIDE_FROM_ABI
- static __container_value_type* __get_ptr(__node_value_type& __n) {
- return std::addressof(__n);
- }
- _LIBCPP_HIDE_FROM_ABI
- static __container_value_type&& __move(__node_value_type& __v) {
- return std::move(__v);
- }
+ _LIBCPP_HIDE_FROM_ABI static key_type const& __get_key(_Tp const& __v) { return __v; }
+ _LIBCPP_HIDE_FROM_ABI static __container_value_type const& __get_value(__node_value_type const& __v) { return __v; }
+ _LIBCPP_HIDE_FROM_ABI static __container_value_type* __get_ptr(__node_value_type& __n) { return std::addressof(__n); }
+ _LIBCPP_HIDE_FROM_ABI static __container_value_type&& __move(__node_value_type& __v) { return std::move(__v); }
};
template <class _Key, class _Tp>
struct __hash_key_value_types<__hash_value_type<_Key, _Tp> > {
- typedef _Key key_type;
- typedef _Tp mapped_type;
- typedef __hash_value_type<_Key, _Tp> __node_value_type;
- typedef pair<const _Key, _Tp> __container_value_type;
- typedef __container_value_type __map_value_type;
+ typedef _Key key_type;
+ typedef _Tp mapped_type;
+ typedef __hash_value_type<_Key, _Tp> __node_value_type;
+ typedef pair<const _Key, _Tp> __container_value_type;
+ typedef __container_value_type __map_value_type;
static const bool __is_map = true;
- _LIBCPP_HIDE_FROM_ABI
- static key_type const& __get_key(__container_value_type const& __v) {
- return __v.first;
- }
+ _LIBCPP_HIDE_FROM_ABI static key_type const& __get_key(__container_value_type const& __v) { return __v.first; }
template <class _Up, __enable_if_t<__is_same_uncvref<_Up, __node_value_type>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI
- static __container_value_type const&
- __get_value(_Up& __t) {
+ _LIBCPP_HIDE_FROM_ABI static __container_value_type const& __get_value(_Up& __t) {
return __t.__get_value();
}
template <class _Up, __enable_if_t<__is_same_uncvref<_Up, __container_value_type>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI
- static __container_value_type const&
- __get_value(_Up& __t) {
+ _LIBCPP_HIDE_FROM_ABI static __container_value_type const& __get_value(_Up& __t) {
return __t;
}
- _LIBCPP_HIDE_FROM_ABI
- static __container_value_type* __get_ptr(__node_value_type& __n) {
+ _LIBCPP_HIDE_FROM_ABI static __container_value_type* __get_ptr(__node_value_type& __n) {
return std::addressof(__n.__get_value());
}
- _LIBCPP_HIDE_FROM_ABI
- static pair<key_type&&, mapped_type&&> __move(__node_value_type& __v) {
- return __v.__move();
- }
+ _LIBCPP_HIDE_FROM_ABI static pair<key_type&&, mapped_type&&> __move(__node_value_type& __v) { return __v.__move(); }
};
-template <class _Tp, class _AllocPtr, class _KVTypes = __hash_key_value_types<_Tp>,
- bool = _KVTypes::__is_map>
+template <class _Tp, class _AllocPtr, class _KVTypes = __hash_key_value_types<_Tp>, bool = _KVTypes::__is_map>
struct __hash_map_pointer_types {};
template <class _Tp, class _AllocPtr, class _KVTypes>
struct __hash_map_pointer_types<_Tp, _AllocPtr, _KVTypes, true> {
- typedef typename _KVTypes::__map_value_type _Mv;
- typedef __rebind_pointer_t<_AllocPtr, _Mv>
- __map_value_type_pointer;
- typedef __rebind_pointer_t<_AllocPtr, const _Mv>
- __const_map_value_type_pointer;
+ typedef typename _KVTypes::__map_value_type _Mv;
+ typedef __rebind_pointer_t<_AllocPtr, _Mv> __map_value_type_pointer;
+ typedef __rebind_pointer_t<_AllocPtr, const _Mv> __const_map_value_type_pointer;
};
template <class _NodePtr, class _NodeT = typename pointer_traits<_NodePtr>::element_type>
@@ -263,39 +217,36 @@ struct __hash_node_types;
template <class _NodePtr, class _Tp, class _VoidPtr>
struct __hash_node_types<_NodePtr, __hash_node<_Tp, _VoidPtr> >
- : public __hash_key_value_types<_Tp>, __hash_map_pointer_types<_Tp, _VoidPtr>
+ : public __hash_key_value_types<_Tp>,
+ __hash_map_pointer_types<_Tp, _VoidPtr>
{
- typedef __hash_key_value_types<_Tp> __base;
+ typedef __hash_key_value_types<_Tp> __base;
public:
typedef ptrdiff_t difference_type;
typedef size_t size_type;
- typedef __rebind_pointer_t<_NodePtr, void> __void_pointer;
+ typedef __rebind_pointer_t<_NodePtr, void> __void_pointer;
- typedef typename pointer_traits<_NodePtr>::element_type __node_type;
- typedef _NodePtr __node_pointer;
+ typedef typename pointer_traits<_NodePtr>::element_type __node_type;
+ typedef _NodePtr __node_pointer;
- typedef __hash_node_base<__node_pointer> __node_base_type;
- typedef __rebind_pointer_t<_NodePtr, __node_base_type>
- __node_base_pointer;
+ typedef __hash_node_base<__node_pointer> __node_base_type;
+ typedef __rebind_pointer_t<_NodePtr, __node_base_type> __node_base_pointer;
- typedef typename __node_base_type::__next_pointer __next_pointer;
+ typedef typename __node_base_type::__next_pointer __next_pointer;
- typedef _Tp __node_value_type;
- typedef __rebind_pointer_t<_VoidPtr, __node_value_type>
- __node_value_type_pointer;
- typedef __rebind_pointer_t<_VoidPtr, const __node_value_type>
- __const_node_value_type_pointer;
+ typedef _Tp __node_value_type;
+ typedef __rebind_pointer_t<_VoidPtr, __node_value_type> __node_value_type_pointer;
+ typedef __rebind_pointer_t<_VoidPtr, const __node_value_type> __const_node_value_type_pointer;
private:
- static_assert(!is_const<__node_type>::value,
- "_NodePtr should never be a pointer to const");
- static_assert((is_same<typename pointer_traits<_VoidPtr>::element_type, void>::value),
- "_VoidPtr does not point to unqualified void type");
- static_assert((is_same<__rebind_pointer_t<_VoidPtr, __node_type>,
- _NodePtr>::value), "_VoidPtr does not rebind to _NodePtr.");
+ static_assert(!is_const<__node_type>::value, "_NodePtr should never be a pointer to const");
+ static_assert((is_same<typename pointer_traits<_VoidPtr>::element_type, void>::value),
+ "_VoidPtr does not point to unqualified void type");
+ static_assert((is_same<__rebind_pointer_t<_VoidPtr, __node_type>, _NodePtr>::value),
+ "_VoidPtr does not rebind to _NodePtr.");
};
template <class _HashIterator>
@@ -309,7 +260,6 @@ struct __hash_node_types_from_iterator<__hash_local_iterator<_NodePtr> > : __has
template <class _NodePtr>
struct __hash_node_types_from_iterator<__hash_const_local_iterator<_NodePtr> > : __hash_node_types<_NodePtr> {};
-
template <class _NodeValueTp, class _VoidPtr>
struct __make_hash_node_types {
typedef __hash_node<_NodeValueTp, _VoidPtr> _NodeTp;
@@ -318,394 +268,327 @@ struct __make_hash_node_types {
};
template <class _NodePtr>
-class _LIBCPP_TEMPLATE_VIS __hash_iterator
-{
- typedef __hash_node_types<_NodePtr> _NodeTypes;
- typedef _NodePtr __node_pointer;
- typedef typename _NodeTypes::__next_pointer __next_pointer;
+class _LIBCPP_TEMPLATE_VIS __hash_iterator {
+ typedef __hash_node_types<_NodePtr> _NodeTypes;
+ typedef _NodePtr __node_pointer;
+ typedef typename _NodeTypes::__next_pointer __next_pointer;
- __next_pointer __node_;
+ __next_pointer __node_;
public:
- typedef forward_iterator_tag iterator_category;
- typedef typename _NodeTypes::__node_value_type value_type;
- typedef typename _NodeTypes::difference_type difference_type;
- typedef value_type& reference;
- typedef typename _NodeTypes::__node_value_type_pointer pointer;
+ typedef forward_iterator_tag iterator_category;
+ typedef typename _NodeTypes::__node_value_type value_type;
+ typedef typename _NodeTypes::difference_type difference_type;
+ typedef value_type& reference;
+ typedef typename _NodeTypes::__node_value_type_pointer pointer;
- _LIBCPP_HIDE_FROM_ABI __hash_iterator() _NOEXCEPT : __node_(nullptr) {
- }
+ _LIBCPP_HIDE_FROM_ABI __hash_iterator() _NOEXCEPT : __node_(nullptr) {}
- _LIBCPP_HIDE_FROM_ABI
- reference operator*() const {
- return __node_->__upcast()->__get_value();
- }
+ _LIBCPP_HIDE_FROM_ABI reference operator*() const { return __node_->__upcast()->__get_value(); }
- _LIBCPP_HIDE_FROM_ABI
- pointer operator->() const {
- return pointer_traits<pointer>::pointer_to(__node_->__upcast()->__get_value());
- }
+ _LIBCPP_HIDE_FROM_ABI pointer operator->() const {
+ return pointer_traits<pointer>::pointer_to(__node_->__upcast()->__get_value());
+ }
- _LIBCPP_HIDE_FROM_ABI
- __hash_iterator& operator++() {
- __node_ = __node_->__next_;
- return *this;
- }
+ _LIBCPP_HIDE_FROM_ABI __hash_iterator& operator++() {
+ __node_ = __node_->__next_;
+ return *this;
+ }
- _LIBCPP_HIDE_FROM_ABI
- __hash_iterator operator++(int)
- {
- __hash_iterator __t(*this);
- ++(*this);
- return __t;
- }
+ _LIBCPP_HIDE_FROM_ABI __hash_iterator operator++(int) {
+ __hash_iterator __t(*this);
+ ++(*this);
+ return __t;
+ }
- friend _LIBCPP_HIDE_FROM_ABI
- bool operator==(const __hash_iterator& __x, const __hash_iterator& __y)
- {
- return __x.__node_ == __y.__node_;
- }
- friend _LIBCPP_HIDE_FROM_ABI
- bool operator!=(const __hash_iterator& __x, const __hash_iterator& __y)
- {return !(__x == __y);}
+ friend _LIBCPP_HIDE_FROM_ABI bool operator==(const __hash_iterator& __x, const __hash_iterator& __y) {
+ return __x.__node_ == __y.__node_;
+ }
+ friend _LIBCPP_HIDE_FROM_ABI bool operator!=(const __hash_iterator& __x, const __hash_iterator& __y) {
+ return !(__x == __y);
+ }
private:
- _LIBCPP_HIDE_FROM_ABI
- explicit __hash_iterator(__next_pointer __node) _NOEXCEPT
- : __node_(__node)
- {
- }
-
- template <class, class, class, class> friend class __hash_table;
- template <class> friend class _LIBCPP_TEMPLATE_VIS __hash_const_iterator;
- template <class> friend class _LIBCPP_TEMPLATE_VIS __hash_map_iterator;
- template <class, class, class, class, class> friend class _LIBCPP_TEMPLATE_VIS unordered_map;
- template <class, class, class, class, class> friend class _LIBCPP_TEMPLATE_VIS unordered_multimap;
+ _LIBCPP_HIDE_FROM_ABI explicit __hash_iterator(__next_pointer __node) _NOEXCEPT : __node_(__node) {}
+
+ template <class, class, class, class>
+ friend class __hash_table;
+ template <class>
+ friend class _LIBCPP_TEMPLATE_VIS __hash_const_iterator;
+ template <class>
+ friend class _LIBCPP_TEMPLATE_VIS __hash_map_iterator;
+ template <class, class, class, class, class>
+ friend class _LIBCPP_TEMPLATE_VIS unordered_map;
+ template <class, class, class, class, class>
+ friend class _LIBCPP_TEMPLATE_VIS unordered_multimap;
};
template <class _NodePtr>
-class _LIBCPP_TEMPLATE_VIS __hash_const_iterator
-{
- static_assert(!is_const<typename pointer_traits<_NodePtr>::element_type>::value, "");
- typedef __hash_node_types<_NodePtr> _NodeTypes;
- typedef _NodePtr __node_pointer;
- typedef typename _NodeTypes::__next_pointer __next_pointer;
+class _LIBCPP_TEMPLATE_VIS __hash_const_iterator {
+ static_assert(!is_const<typename pointer_traits<_NodePtr>::element_type>::value, "");
+ typedef __hash_node_types<_NodePtr> _NodeTypes;
+ typedef _NodePtr __node_pointer;
+ typedef typename _NodeTypes::__next_pointer __next_pointer;
- __next_pointer __node_;
+ __next_pointer __node_;
public:
- typedef __hash_iterator<_NodePtr> __non_const_iterator;
-
- typedef forward_iterator_tag iterator_category;
- typedef typename _NodeTypes::__node_value_type value_type;
- typedef typename _NodeTypes::difference_type difference_type;
- typedef const value_type& reference;
- typedef typename _NodeTypes::__const_node_value_type_pointer pointer;
+ typedef __hash_iterator<_NodePtr> __non_const_iterator;
+ typedef forward_iterator_tag iterator_category;
+ typedef typename _NodeTypes::__node_value_type value_type;
+ typedef typename _NodeTypes::difference_type difference_type;
+ typedef const value_type& reference;
+ typedef typename _NodeTypes::__const_node_value_type_pointer pointer;
- _LIBCPP_HIDE_FROM_ABI __hash_const_iterator() _NOEXCEPT : __node_(nullptr) {
- }
+ _LIBCPP_HIDE_FROM_ABI __hash_const_iterator() _NOEXCEPT : __node_(nullptr) {}
- _LIBCPP_HIDE_FROM_ABI
- __hash_const_iterator(const __non_const_iterator& __x) _NOEXCEPT
- : __node_(__x.__node_)
- {
- }
+ _LIBCPP_HIDE_FROM_ABI __hash_const_iterator(const __non_const_iterator& __x) _NOEXCEPT : __node_(__x.__node_) {}
- _LIBCPP_HIDE_FROM_ABI
- reference operator*() const {
- return __node_->__upcast()->__get_value();
- }
- _LIBCPP_HIDE_FROM_ABI
- pointer operator->() const {
- return pointer_traits<pointer>::pointer_to(__node_->__upcast()->__get_value());
- }
+ _LIBCPP_HIDE_FROM_ABI reference operator*() const { return __node_->__upcast()->__get_value(); }
+ _LIBCPP_HIDE_FROM_ABI pointer operator->() const {
+ return pointer_traits<pointer>::pointer_to(__node_->__upcast()->__get_value());
+ }
- _LIBCPP_HIDE_FROM_ABI
- __hash_const_iterator& operator++() {
- __node_ = __node_->__next_;
- return *this;
- }
+ _LIBCPP_HIDE_FROM_ABI __hash_const_iterator& operator++() {
+ __node_ = __node_->__next_;
+ return *this;
+ }
- _LIBCPP_HIDE_FROM_ABI
- __hash_const_iterator operator++(int)
- {
- __hash_const_iterator __t(*this);
- ++(*this);
- return __t;
- }
+ _LIBCPP_HIDE_FROM_ABI __hash_const_iterator operator++(int) {
+ __hash_const_iterator __t(*this);
+ ++(*this);
+ return __t;
+ }
- friend _LIBCPP_HIDE_FROM_ABI
- bool operator==(const __hash_const_iterator& __x, const __hash_const_iterator& __y)
- {
- return __x.__node_ == __y.__node_;
- }
- friend _LIBCPP_HIDE_FROM_ABI
- bool operator!=(const __hash_const_iterator& __x, const __hash_const_iterator& __y)
- {return !(__x == __y);}
+ friend _LIBCPP_HIDE_FROM_ABI bool operator==(const __hash_const_iterator& __x, const __hash_const_iterator& __y) {
+ return __x.__node_ == __y.__node_;
+ }
+ friend _LIBCPP_HIDE_FROM_ABI bool operator!=(const __hash_const_iterator& __x, const __hash_const_iterator& __y) {
+ return !(__x == __y);
+ }
private:
- _LIBCPP_HIDE_FROM_ABI
- explicit __hash_const_iterator(__next_pointer __node) _NOEXCEPT
- : __node_(__node)
- {
- }
-
- template <class, class, class, class> friend class __hash_table;
- template <class> friend class _LIBCPP_TEMPLATE_VIS __hash_map_const_iterator;
- template <class, class, class, class, class> friend class _LIBCPP_TEMPLATE_VIS unordered_map;
- template <class, class, class, class, class> friend class _LIBCPP_TEMPLATE_VIS unordered_multimap;
+ _LIBCPP_HIDE_FROM_ABI explicit __hash_const_iterator(__next_pointer __node) _NOEXCEPT : __node_(__node) {}
+
+ template <class, class, class, class>
+ friend class __hash_table;
+ template <class>
+ friend class _LIBCPP_TEMPLATE_VIS __hash_map_const_iterator;
+ template <class, class, class, class, class>
+ friend class _LIBCPP_TEMPLATE_VIS unordered_map;
+ template <class, class, class, class, class>
+ friend class _LIBCPP_TEMPLATE_VIS unordered_multimap;
};
template <class _NodePtr>
-class _LIBCPP_TEMPLATE_VIS __hash_local_iterator
-{
- typedef __hash_node_types<_NodePtr> _NodeTypes;
- typedef _NodePtr __node_pointer;
- typedef typename _NodeTypes::__next_pointer __next_pointer;
+class _LIBCPP_TEMPLATE_VIS __hash_local_iterator {
+ typedef __hash_node_types<_NodePtr> _NodeTypes;
+ typedef _NodePtr __node_pointer;
+ typedef typename _NodeTypes::__next_pointer __next_pointer;
- __next_pointer __node_;
- size_t __bucket_;
- size_t __bucket_count_;
+ __next_pointer __node_;
+ size_t __bucket_;
+ size_t __bucket_count_;
public:
- typedef forward_iterator_tag iterator_category;
- typedef typename _NodeTypes::__node_value_type value_type;
- typedef typename _NodeTypes::difference_type difference_type;
- typedef value_type& reference;
- typedef typename _NodeTypes::__node_value_type_pointer pointer;
+ typedef forward_iterator_tag iterator_category;
+ typedef typename _NodeTypes::__node_value_type value_type;
+ typedef typename _NodeTypes::difference_type difference_type;
+ typedef value_type& reference;
+ typedef typename _NodeTypes::__node_value_type_pointer pointer;
- _LIBCPP_HIDE_FROM_ABI __hash_local_iterator() _NOEXCEPT : __node_(nullptr) {
- }
+ _LIBCPP_HIDE_FROM_ABI __hash_local_iterator() _NOEXCEPT : __node_(nullptr) {}
- _LIBCPP_HIDE_FROM_ABI
- reference operator*() const {
- return __node_->__upcast()->__get_value();
- }
+ _LIBCPP_HIDE_FROM_ABI reference operator*() const { return __node_->__upcast()->__get_value(); }
- _LIBCPP_HIDE_FROM_ABI
- pointer operator->() const {
- return pointer_traits<pointer>::pointer_to(__node_->__upcast()->__get_value());
- }
+ _LIBCPP_HIDE_FROM_ABI pointer operator->() const {
+ return pointer_traits<pointer>::pointer_to(__node_->__upcast()->__get_value());
+ }
- _LIBCPP_HIDE_FROM_ABI
- __hash_local_iterator& operator++() {
- __node_ = __node_->__next_;
- if (__node_ != nullptr && std::__constrain_hash(__node_->__hash(), __bucket_count_) != __bucket_)
- __node_ = nullptr;
- return *this;
- }
+ _LIBCPP_HIDE_FROM_ABI __hash_local_iterator& operator++() {
+ __node_ = __node_->__next_;
+ if (__node_ != nullptr && std::__constrain_hash(__node_->__hash(), __bucket_count_) != __bucket_)
+ __node_ = nullptr;
+ return *this;
+ }
- _LIBCPP_HIDE_FROM_ABI
- __hash_local_iterator operator++(int)
- {
- __hash_local_iterator __t(*this);
- ++(*this);
- return __t;
- }
+ _LIBCPP_HIDE_FROM_ABI __hash_local_iterator operator++(int) {
+ __hash_local_iterator __t(*this);
+ ++(*this);
+ return __t;
+ }
- friend _LIBCPP_HIDE_FROM_ABI
- bool operator==(const __hash_local_iterator& __x, const __hash_local_iterator& __y)
- {
- return __x.__node_ == __y.__node_;
- }
- friend _LIBCPP_HIDE_FROM_ABI
- bool operator!=(const __hash_local_iterator& __x, const __hash_local_iterator& __y)
- {return !(__x == __y);}
+ friend _LIBCPP_HIDE_FROM_ABI bool operator==(const __hash_local_iterator& __x, const __hash_local_iterator& __y) {
+ return __x.__node_ == __y.__node_;
+ }
+ friend _LIBCPP_HIDE_FROM_ABI bool operator!=(const __hash_local_iterator& __x, const __hash_local_iterator& __y) {
+ return !(__x == __y);
+ }
private:
- _LIBCPP_HIDE_FROM_ABI
- explicit __hash_local_iterator(__next_pointer __node, size_t __bucket,
- size_t __bucket_count) _NOEXCEPT
- : __node_(__node),
- __bucket_(__bucket),
- __bucket_count_(__bucket_count)
- {
- if (__node_ != nullptr)
- __node_ = __node_->__next_;
- }
+ _LIBCPP_HIDE_FROM_ABI explicit __hash_local_iterator(
+ __next_pointer __node, size_t __bucket, size_t __bucket_count) _NOEXCEPT
+ : __node_(__node),
+ __bucket_(__bucket),
+ __bucket_count_(__bucket_count) {
+ if (__node_ != nullptr)
+ __node_ = __node_->__next_;
+ }
- template <class, class, class, class> friend class __hash_table;
- template <class> friend class _LIBCPP_TEMPLATE_VIS __hash_const_local_iterator;
- template <class> friend class _LIBCPP_TEMPLATE_VIS __hash_map_iterator;
+ template <class, class, class, class>
+ friend class __hash_table;
+ template <class>
+ friend class _LIBCPP_TEMPLATE_VIS __hash_const_local_iterator;
+ template <class>
+ friend class _LIBCPP_TEMPLATE_VIS __hash_map_iterator;
};
template <class _ConstNodePtr>
-class _LIBCPP_TEMPLATE_VIS __hash_const_local_iterator
-{
- typedef __hash_node_types<_ConstNodePtr> _NodeTypes;
- typedef _ConstNodePtr __node_pointer;
- typedef typename _NodeTypes::__next_pointer __next_pointer;
-
- __next_pointer __node_;
- size_t __bucket_;
- size_t __bucket_count_;
-
- typedef pointer_traits<__node_pointer> __pointer_traits;
- typedef typename __pointer_traits::element_type __node;
- typedef __remove_const_t<__node> __non_const_node;
- typedef __rebind_pointer_t<__node_pointer, __non_const_node>
- __non_const_node_pointer;
-public:
- typedef __hash_local_iterator<__non_const_node_pointer>
- __non_const_iterator;
+class _LIBCPP_TEMPLATE_VIS __hash_const_local_iterator {
+ typedef __hash_node_types<_ConstNodePtr> _NodeTypes;
+ typedef _ConstNodePtr __node_pointer;
+ typedef typename _NodeTypes::__next_pointer __next_pointer;
- typedef forward_iterator_tag iterator_category;
- typedef typename _NodeTypes::__node_value_type value_type;
- typedef typename _NodeTypes::difference_type difference_type;
- typedef const value_type& reference;
- typedef typename _NodeTypes::__const_node_value_type_pointer pointer;
+ __next_pointer __node_;
+ size_t __bucket_;
+ size_t __bucket_count_;
+ typedef pointer_traits<__node_pointer> __pointer_traits;
+ typedef typename __pointer_traits::element_type __node;
+ typedef __remove_const_t<__node> __non_const_node;
+ typedef __rebind_pointer_t<__node_pointer, __non_const_node> __non_const_node_pointer;
- _LIBCPP_HIDE_FROM_ABI __hash_const_local_iterator() _NOEXCEPT : __node_(nullptr) {
- }
+public:
+ typedef __hash_local_iterator<__non_const_node_pointer> __non_const_iterator;
- _LIBCPP_HIDE_FROM_ABI
- __hash_const_local_iterator(const __non_const_iterator& __x) _NOEXCEPT
- : __node_(__x.__node_),
- __bucket_(__x.__bucket_),
- __bucket_count_(__x.__bucket_count_)
- {
- }
+ typedef forward_iterator_tag iterator_category;
+ typedef typename _NodeTypes::__node_value_type value_type;
+ typedef typename _NodeTypes::difference_type difference_type;
+ typedef const value_type& reference;
+ typedef typename _NodeTypes::__const_node_value_type_pointer pointer;
- _LIBCPP_HIDE_FROM_ABI
- reference operator*() const {
- return __node_->__upcast()->__get_value();
- }
+ _LIBCPP_HIDE_FROM_ABI __hash_const_local_iterator() _NOEXCEPT : __node_(nullptr) {}
- _LIBCPP_HIDE_FROM_ABI
- pointer operator->() const {
- return pointer_traits<pointer>::pointer_to(__node_->__upcast()->__get_value());
- }
+ _LIBCPP_HIDE_FROM_ABI __hash_const_local_iterator(const __non_const_iterator& __x) _NOEXCEPT
+ : __node_(__x.__node_),
+ __bucket_(__x.__bucket_),
+ __bucket_count_(__x.__bucket_count_) {}
- _LIBCPP_HIDE_FROM_ABI
- __hash_const_local_iterator& operator++() {
- __node_ = __node_->__next_;
- if (__node_ != nullptr && std::__constrain_hash(__node_->__hash(), __bucket_count_) != __bucket_)
- __node_ = nullptr;
- return *this;
- }
+ _LIBCPP_HIDE_FROM_ABI reference operator*() const { return __node_->__upcast()->__get_value(); }
- _LIBCPP_HIDE_FROM_ABI
- __hash_const_local_iterator operator++(int)
- {
- __hash_const_local_iterator __t(*this);
- ++(*this);
- return __t;
- }
+ _LIBCPP_HIDE_FROM_ABI pointer operator->() const {
+ return pointer_traits<pointer>::pointer_to(__node_->__upcast()->__get_value());
+ }
- friend _LIBCPP_HIDE_FROM_ABI
- bool operator==(const __hash_const_local_iterator& __x, const __hash_const_local_iterator& __y)
- {
- return __x.__node_ == __y.__node_;
- }
- friend _LIBCPP_HIDE_FROM_ABI
- bool operator!=(const __hash_const_local_iterator& __x, const __hash_const_local_iterator& __y)
- {return !(__x == __y);}
+ _LIBCPP_HIDE_FROM_ABI __hash_const_local_iterator& operator++() {
+ __node_ = __node_->__next_;
+ if (__node_ != nullptr && std::__constrain_hash(__node_->__hash(), __bucket_count_) != __bucket_)
+ __node_ = nullptr;
+ return *this;
+ }
+
+ _LIBCPP_HIDE_FROM_ABI __hash_const_local_iterator operator++(int) {
+ __hash_const_local_iterator __t(*this);
+ ++(*this);
+ return __t;
+ }
+
+ friend _LIBCPP_HIDE_FROM_ABI bool
+ operator==(const __hash_const_local_iterator& __x, const __hash_const_local_iterator& __y) {
+ return __x.__node_ == __y.__node_;
+ }
+ friend _LIBCPP_HIDE_FROM_ABI bool
+ operator!=(const __hash_const_local_iterator& __x, const __hash_const_local_iterator& __y) {
+ return !(__x == __y);
+ }
private:
- _LIBCPP_HIDE_FROM_ABI
- explicit __hash_const_local_iterator(__next_pointer __node_ptr, size_t __bucket,
- size_t __bucket_count) _NOEXCEPT
- : __node_(__node_ptr),
- __bucket_(__bucket),
- __bucket_count_(__bucket_count)
- {
- if (__node_ != nullptr)
- __node_ = __node_->__next_;
- }
+ _LIBCPP_HIDE_FROM_ABI explicit __hash_const_local_iterator(
+ __next_pointer __node_ptr, size_t __bucket, size_t __bucket_count) _NOEXCEPT
+ : __node_(__node_ptr),
+ __bucket_(__bucket),
+ __bucket_count_(__bucket_count) {
+ if (__node_ != nullptr)
+ __node_ = __node_->__next_;
+ }
- template <class, class, class, class> friend class __hash_table;
- template <class> friend class _LIBCPP_TEMPLATE_VIS __hash_map_const_iterator;
+ template <class, class, class, class>
+ friend class __hash_table;
+ template <class>
+ friend class _LIBCPP_TEMPLATE_VIS __hash_map_const_iterator;
};
template <class _Alloc>
-class __bucket_list_deallocator
-{
- typedef _Alloc allocator_type;
- typedef allocator_traits<allocator_type> __alloc_traits;
- typedef typename __alloc_traits::size_type size_type;
+class __bucket_list_deallocator {
+ typedef _Alloc allocator_type;
+ typedef allocator_traits<allocator_type> __alloc_traits;
+ typedef typename __alloc_traits::size_type size_type;
+
+ __compressed_pair<size_type, allocator_type> __data_;
- __compressed_pair<size_type, allocator_type> __data_;
public:
- typedef typename __alloc_traits::pointer pointer;
-
- _LIBCPP_HIDE_FROM_ABI
- __bucket_list_deallocator()
- _NOEXCEPT_(is_nothrow_default_constructible<allocator_type>::value)
- : __data_(0, __default_init_tag()) {}
-
- _LIBCPP_HIDE_FROM_ABI
- __bucket_list_deallocator(const allocator_type& __a, size_type __size)
- _NOEXCEPT_(is_nothrow_copy_constructible<allocator_type>::value)
- : __data_(__size, __a) {}
-
- _LIBCPP_HIDE_FROM_ABI
- __bucket_list_deallocator(__bucket_list_deallocator&& __x)
- _NOEXCEPT_(is_nothrow_move_constructible<allocator_type>::value)
- : __data_(std::move(__x.__data_))
- {
- __x.size() = 0;
- }
+ typedef typename __alloc_traits::pointer pointer;
- _LIBCPP_HIDE_FROM_ABI
- size_type& size() _NOEXCEPT {return __data_.first();}
- _LIBCPP_HIDE_FROM_ABI
- size_type size() const _NOEXCEPT {return __data_.first();}
+ _LIBCPP_HIDE_FROM_ABI __bucket_list_deallocator() _NOEXCEPT_(is_nothrow_default_constructible<allocator_type>::value)
+ : __data_(0, __default_init_tag()) {}
- _LIBCPP_HIDE_FROM_ABI
- allocator_type& __alloc() _NOEXCEPT {return __data_.second();}
- _LIBCPP_HIDE_FROM_ABI
- const allocator_type& __alloc() const _NOEXCEPT {return __data_.second();}
+ _LIBCPP_HIDE_FROM_ABI __bucket_list_deallocator(const allocator_type& __a, size_type __size)
+ _NOEXCEPT_(is_nothrow_copy_constructible<allocator_type>::value)
+ : __data_(__size, __a) {}
- _LIBCPP_HIDE_FROM_ABI
- void operator()(pointer __p) _NOEXCEPT
- {
- __alloc_traits::deallocate(__alloc(), __p, size());
- }
+ _LIBCPP_HIDE_FROM_ABI __bucket_list_deallocator(__bucket_list_deallocator&& __x)
+ _NOEXCEPT_(is_nothrow_move_constructible<allocator_type>::value)
+ : __data_(std::move(__x.__data_)) {
+ __x.size() = 0;
+ }
+
+ _LIBCPP_HIDE_FROM_ABI size_type& size() _NOEXCEPT { return __data_.first(); }
+ _LIBCPP_HIDE_FROM_ABI size_type size() const _NOEXCEPT { return __data_.first(); }
+
+ _LIBCPP_HIDE_FROM_ABI allocator_type& __alloc() _NOEXCEPT { return __data_.second(); }
+ _LIBCPP_HIDE_FROM_ABI const allocator_type& __alloc() const _NOEXCEPT { return __data_.second(); }
+
+ _LIBCPP_HIDE_FROM_ABI void operator()(pointer __p) _NOEXCEPT { __alloc_traits::deallocate(__alloc(), __p, size()); }
};
-template <class _Alloc> class __hash_map_node_destructor;
+template <class _Alloc>
+class __hash_map_node_destructor;
template <class _Alloc>
-class __hash_node_destructor
-{
- typedef _Alloc allocator_type;
- typedef allocator_traits<allocator_type> __alloc_traits;
+class __hash_node_destructor {
+ typedef _Alloc allocator_type;
+ typedef allocator_traits<allocator_type> __alloc_traits;
public:
- typedef typename __alloc_traits::pointer pointer;
+ typedef typename __alloc_traits::pointer pointer;
+
private:
- typedef __hash_node_types<pointer> _NodeTypes;
+ typedef __hash_node_types<pointer> _NodeTypes;
- allocator_type& __na_;
+ allocator_type& __na_;
public:
- bool __value_constructed;
-
- _LIBCPP_HIDE_FROM_ABI __hash_node_destructor(__hash_node_destructor const&) = default;
- _LIBCPP_HIDE_FROM_ABI __hash_node_destructor& operator=(const __hash_node_destructor&) = delete;
+ bool __value_constructed;
+ _LIBCPP_HIDE_FROM_ABI __hash_node_destructor(__hash_node_destructor const&) = default;
+ _LIBCPP_HIDE_FROM_ABI __hash_node_destructor& operator=(const __hash_node_destructor&) = delete;
- _LIBCPP_HIDE_FROM_ABI
- explicit __hash_node_destructor(allocator_type& __na,
- bool __constructed = false) _NOEXCEPT
- : __na_(__na),
- __value_constructed(__constructed)
- {}
+ _LIBCPP_HIDE_FROM_ABI explicit __hash_node_destructor(allocator_type& __na, bool __constructed = false) _NOEXCEPT
+ : __na_(__na),
+ __value_constructed(__constructed) {}
- _LIBCPP_HIDE_FROM_ABI
- void operator()(pointer __p) _NOEXCEPT
- {
- if (__value_constructed) {
- __alloc_traits::destroy(__na_, _NodeTypes::__get_ptr(__p->__get_value()));
- std::__destroy_at(std::addressof(*__p));
- }
- if (__p)
- __alloc_traits::deallocate(__na_, __p, 1);
+ _LIBCPP_HIDE_FROM_ABI void operator()(pointer __p) _NOEXCEPT {
+ if (__value_constructed) {
+ __alloc_traits::destroy(__na_, _NodeTypes::__get_ptr(__p->__get_value()));
+ std::__destroy_at(std::addressof(*__p));
}
+ if (__p)
+ __alloc_traits::deallocate(__na_, __p, 1);
+ }
- template <class> friend class __hash_map_node_destructor;
+ template <class>
+ friend class __hash_map_node_destructor;
};
#if _LIBCPP_STD_VER >= 17
@@ -713,33 +596,30 @@ template <class _NodeType, class _Alloc>
struct __generic_container_node_destructor;
template <class _Tp, class _VoidPtr, class _Alloc>
-struct __generic_container_node_destructor<__hash_node<_Tp, _VoidPtr>, _Alloc>
- : __hash_node_destructor<_Alloc>
-{
- using __hash_node_destructor<_Alloc>::__hash_node_destructor;
+struct __generic_container_node_destructor<__hash_node<_Tp, _VoidPtr>, _Alloc> : __hash_node_destructor<_Alloc> {
+ using __hash_node_destructor<_Alloc>::__hash_node_destructor;
};
#endif
template <class _Key, class _Hash, class _Equal>
struct __enforce_unordered_container_requirements {
#ifndef _LIBCPP_CXX03_LANG
- static_assert(__check_hash_requirements<_Key, _Hash>::value,
- "the specified hash does not meet the Hash requirements");
- static_assert(is_copy_constructible<_Equal>::value,
- "the specified comparator is required to be copy constructible");
+ static_assert(__check_hash_requirements<_Key, _Hash>::value,
+ "the specified hash does not meet the Hash requirements");
+ static_assert(is_copy_constructible<_Equal>::value, "the specified comparator is required to be copy constructible");
#endif
- typedef int type;
+ typedef int type;
};
template <class _Key, class _Hash, class _Equal>
#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_DIAGNOSE_WARNING(!__invokable<_Equal const&, _Key const&, _Key const&>::value,
- "the specified comparator type does not provide a viable const call operator")
- _LIBCPP_DIAGNOSE_WARNING(!__invokable<_Hash const&, _Key const&>::value,
- "the specified hash functor does not provide a viable const call operator")
+_LIBCPP_DIAGNOSE_WARNING(!__invokable<_Equal const&, _Key const&, _Key const&>::value,
+ "the specified comparator type does not provide a viable const call operator")
+_LIBCPP_DIAGNOSE_WARNING(!__invokable<_Hash const&, _Key const&>::value,
+ "the specified hash functor does not provide a viable const call operator")
#endif
-typename __enforce_unordered_container_requirements<_Key, _Hash, _Equal>::type
-__diagnose_unordered_container_requirements(int);
+ typename __enforce_unordered_container_requirements<_Key, _Hash, _Equal>::type
+ __diagnose_unordered_container_requirements(int);
// This dummy overload is used so that the compiler won't emit a spurious
// "no matching function for call to __diagnose_unordered_xxx" diagnostic
@@ -748,890 +628,668 @@ template <class _Key, class _Hash, class _Equal>
int __diagnose_unordered_container_requirements(void*);
template <class _Tp, class _Hash, class _Equal, class _Alloc>
-class __hash_table
-{
+class __hash_table {
public:
- typedef _Tp value_type;
- typedef _Hash hasher;
- typedef _Equal key_equal;
- typedef _Alloc allocator_type;
+ typedef _Tp value_type;
+ typedef _Hash hasher;
+ typedef _Equal key_equal;
+ typedef _Alloc allocator_type;
private:
- typedef allocator_traits<allocator_type> __alloc_traits;
- typedef typename
- __make_hash_node_types<value_type, typename __alloc_traits::void_pointer>::type
- _NodeTypes;
-public:
+ typedef allocator_traits<allocator_type> __alloc_traits;
+ typedef typename __make_hash_node_types<value_type, typename __alloc_traits::void_pointer>::type _NodeTypes;
- typedef typename _NodeTypes::__node_value_type __node_value_type;
- typedef typename _NodeTypes::__container_value_type __container_value_type;
- typedef typename _NodeTypes::key_type key_type;
- typedef value_type& reference;
- typedef const value_type& const_reference;
- typedef typename __alloc_traits::pointer pointer;
- typedef typename __alloc_traits::const_pointer const_pointer;
+public:
+ typedef typename _NodeTypes::__node_value_type __node_value_type;
+ typedef typename _NodeTypes::__container_value_type __container_value_type;
+ typedef typename _NodeTypes::key_type key_type;
+ typedef value_type& reference;
+ typedef const value_type& const_reference;
+ typedef typename __alloc_traits::pointer pointer;
+ typedef typename __alloc_traits::const_pointer const_pointer;
#ifndef _LIBCPP_ABI_FIX_UNORDERED_CONTAINER_SIZE_TYPE
- typedef typename __alloc_traits::size_type size_type;
+ typedef typename __alloc_traits::size_type size_type;
#else
- typedef typename _NodeTypes::size_type size_type;
+ typedef typename _NodeTypes::size_type size_type;
#endif
- typedef typename _NodeTypes::difference_type difference_type;
+ typedef typename _NodeTypes::difference_type difference_type;
+
public:
- // Create __node
-
- typedef typename _NodeTypes::__node_type __node;
- typedef __rebind_alloc<__alloc_traits, __node> __node_allocator;
- typedef allocator_traits<__node_allocator> __node_traits;
- typedef typename _NodeTypes::__void_pointer __void_pointer;
- typedef typename _NodeTypes::__node_pointer __node_pointer;
- typedef typename _NodeTypes::__node_pointer __node_const_pointer;
- typedef typename _NodeTypes::__node_base_type __first_node;
- typedef typename _NodeTypes::__node_base_pointer __node_base_pointer;
- typedef typename _NodeTypes::__next_pointer __next_pointer;
+ // Create __node
+
+ typedef typename _NodeTypes::__node_type __node;
+ typedef __rebind_alloc<__alloc_traits, __node> __node_allocator;
+ typedef allocator_traits<__node_allocator> __node_traits;
+ typedef typename _NodeTypes::__void_pointer __void_pointer;
+ typedef typename _NodeTypes::__node_pointer __node_pointer;
+ typedef typename _NodeTypes::__node_pointer __node_const_pointer;
+ typedef typename _NodeTypes::__node_base_type __first_node;
+ typedef typename _NodeTypes::__node_base_pointer __node_base_pointer;
+ typedef typename _NodeTypes::__next_pointer __next_pointer;
private:
- // check for sane allocator pointer rebinding semantics. Rebinding the
- // allocator for a new pointer type should be exactly the same as rebinding
- // the pointer using 'pointer_traits'.
- static_assert((is_same<__node_pointer, typename __node_traits::pointer>::value),
- "Allocator does not rebind pointers in a sane manner.");
- typedef __rebind_alloc<__node_traits, __first_node> __node_base_allocator;
- typedef allocator_traits<__node_base_allocator> __node_base_traits;
- static_assert((is_same<__node_base_pointer, typename __node_base_traits::pointer>::value),
- "Allocator does not rebind pointers in a sane manner.");
+ // check for sane allocator pointer rebinding semantics. Rebinding the
+ // allocator for a new pointer type should be exactly the same as rebinding
+ // the pointer using 'pointer_traits'.
+ static_assert((is_same<__node_pointer, typename __node_traits::pointer>::value),
+ "Allocator does not rebind pointers in a sane manner.");
+ typedef __rebind_alloc<__node_traits, __first_node> __node_base_allocator;
+ typedef allocator_traits<__node_base_allocator> __node_base_traits;
+ static_assert((is_same<__node_base_pointer, typename __node_base_traits::pointer>::value),
+ "Allocator does not rebind pointers in a sane manner.");
private:
+ typedef __rebind_alloc<__node_traits, __next_pointer> __pointer_allocator;
+ typedef __bucket_list_deallocator<__pointer_allocator> __bucket_list_deleter;
+ typedef unique_ptr<__next_pointer[], __bucket_list_deleter> __bucket_list;
+ typedef allocator_traits<__pointer_allocator> __pointer_alloc_traits;
+ typedef typename __bucket_list_deleter::pointer __node_pointer_pointer;
+
+ // --- Member data begin ---
+ __bucket_list __bucket_list_;
+ __compressed_pair<__first_node, __node_allocator> __p1_;
+ __compressed_pair<size_type, hasher> __p2_;
+ __compressed_pair<float, key_equal> __p3_;
+ // --- Member data end ---
+
+ _LIBCPP_HIDE_FROM_ABI size_type& size() _NOEXCEPT { return __p2_.first(); }
- typedef __rebind_alloc<__node_traits, __next_pointer> __pointer_allocator;
- typedef __bucket_list_deallocator<__pointer_allocator> __bucket_list_deleter;
- typedef unique_ptr<__next_pointer[], __bucket_list_deleter> __bucket_list;
- typedef allocator_traits<__pointer_allocator> __pointer_alloc_traits;
- typedef typename __bucket_list_deleter::pointer __node_pointer_pointer;
-
- // --- Member data begin ---
- __bucket_list __bucket_list_;
- __compressed_pair<__first_node, __node_allocator> __p1_;
- __compressed_pair<size_type, hasher> __p2_;
- __compressed_pair<float, key_equal> __p3_;
- // --- Member data end ---
-
- _LIBCPP_HIDE_FROM_ABI
- size_type& size() _NOEXCEPT {return __p2_.first();}
public:
- _LIBCPP_HIDE_FROM_ABI
- size_type size() const _NOEXCEPT {return __p2_.first();}
-
- _LIBCPP_HIDE_FROM_ABI
- hasher& hash_function() _NOEXCEPT {return __p2_.second();}
- _LIBCPP_HIDE_FROM_ABI
- const hasher& hash_function() const _NOEXCEPT {return __p2_.second();}
-
- _LIBCPP_HIDE_FROM_ABI
- float& max_load_factor() _NOEXCEPT {return __p3_.first();}
- _LIBCPP_HIDE_FROM_ABI
- float max_load_factor() const _NOEXCEPT {return __p3_.first();}
-
- _LIBCPP_HIDE_FROM_ABI
- key_equal& key_eq() _NOEXCEPT {return __p3_.second();}
- _LIBCPP_HIDE_FROM_ABI
- const key_equal& key_eq() const _NOEXCEPT {return __p3_.second();}
-
- _LIBCPP_HIDE_FROM_ABI
- __node_allocator& __node_alloc() _NOEXCEPT {return __p1_.second();}
- _LIBCPP_HIDE_FROM_ABI
- const __node_allocator& __node_alloc() const _NOEXCEPT
- {return __p1_.second();}
+ _LIBCPP_HIDE_FROM_ABI size_type size() const _NOEXCEPT { return __p2_.first(); }
+
+ _LIBCPP_HIDE_FROM_ABI hasher& hash_function() _NOEXCEPT { return __p2_.second(); }
+ _LIBCPP_HIDE_FROM_ABI const hasher& hash_function() const _NOEXCEPT { return __p2_.second(); }
+
+ _LIBCPP_HIDE_FROM_ABI float& max_load_factor() _NOEXCEPT { return __p3_.first(); }
+ _LIBCPP_HIDE_FROM_ABI float max_load_factor() const _NOEXCEPT { return __p3_.first(); }
+
+ _LIBCPP_HIDE_FROM_ABI key_equal& key_eq() _NOEXCEPT { return __p3_.second(); }
+ _LIBCPP_HIDE_FROM_ABI const key_equal& key_eq() const _NOEXCEPT { return __p3_.second(); }
+
+ _LIBCPP_HIDE_FROM_ABI __node_allocator& __node_alloc() _NOEXCEPT { return __p1_.second(); }
+ _LIBCPP_HIDE_FROM_ABI const __node_allocator& __node_alloc() const _NOEXCEPT { return __p1_.second(); }
public:
- typedef __hash_iterator<__node_pointer> iterator;
- typedef __hash_const_iterator<__node_pointer> const_iterator;
- typedef __hash_local_iterator<__node_pointer> local_iterator;
- typedef __hash_const_local_iterator<__node_pointer> const_local_iterator;
-
- _LIBCPP_HIDE_FROM_ABI
- __hash_table()
- _NOEXCEPT_(
- is_nothrow_default_constructible<__bucket_list>::value &&
- is_nothrow_default_constructible<__first_node>::value &&
- is_nothrow_default_constructible<__node_allocator>::value &&
- is_nothrow_default_constructible<hasher>::value &&
- is_nothrow_default_constructible<key_equal>::value);
- _LIBCPP_HIDE_FROM_ABI
- __hash_table(const hasher& __hf, const key_equal& __eql);
- _LIBCPP_HIDE_FROM_ABI __hash_table(const hasher& __hf, const key_equal& __eql,
- const allocator_type& __a);
- _LIBCPP_HIDE_FROM_ABI explicit __hash_table(const allocator_type& __a);
- _LIBCPP_HIDE_FROM_ABI __hash_table(const __hash_table& __u);
- _LIBCPP_HIDE_FROM_ABI __hash_table(const __hash_table& __u, const allocator_type& __a);
- _LIBCPP_HIDE_FROM_ABI __hash_table(__hash_table&& __u)
- _NOEXCEPT_(
- is_nothrow_move_constructible<__bucket_list>::value &&
- is_nothrow_move_constructible<__first_node>::value &&
- is_nothrow_move_constructible<__node_allocator>::value &&
- is_nothrow_move_constructible<hasher>::value &&
- is_nothrow_move_constructible<key_equal>::value);
- _LIBCPP_HIDE_FROM_ABI __hash_table(__hash_table&& __u, const allocator_type& __a);
- _LIBCPP_HIDE_FROM_ABI ~__hash_table();
-
- _LIBCPP_HIDE_FROM_ABI __hash_table& operator=(const __hash_table& __u);
- _LIBCPP_HIDE_FROM_ABI
- __hash_table& operator=(__hash_table&& __u)
- _NOEXCEPT_(
- __node_traits::propagate_on_container_move_assignment::value &&
- is_nothrow_move_assignable<__node_allocator>::value &&
- is_nothrow_move_assignable<hasher>::value &&
- is_nothrow_move_assignable<key_equal>::value);
- template <class _InputIterator>
- _LIBCPP_HIDE_FROM_ABI void __assign_unique(_InputIterator __first, _InputIterator __last);
- template <class _InputIterator>
- _LIBCPP_HIDE_FROM_ABI void __assign_multi(_InputIterator __first, _InputIterator __last);
-
- _LIBCPP_HIDE_FROM_ABI
- size_type max_size() const _NOEXCEPT
- {
- return std::min<size_type>(
- __node_traits::max_size(__node_alloc()),
- numeric_limits<difference_type >::max()
- );
- }
+ typedef __hash_iterator<__node_pointer> iterator;
+ typedef __hash_const_iterator<__node_pointer> const_iterator;
+ typedef __hash_local_iterator<__node_pointer> local_iterator;
+ typedef __hash_const_local_iterator<__node_pointer> const_local_iterator;
+
+ _LIBCPP_HIDE_FROM_ABI __hash_table() _NOEXCEPT_(
+ is_nothrow_default_constructible<__bucket_list>::value&& is_nothrow_default_constructible<__first_node>::value&&
+ is_nothrow_default_constructible<__node_allocator>::value&& is_nothrow_default_constructible<hasher>::value&&
+ is_nothrow_default_constructible<key_equal>::value);
+ _LIBCPP_HIDE_FROM_ABI __hash_table(const hasher& __hf, const key_equal& __eql);
+ _LIBCPP_HIDE_FROM_ABI __hash_table(const hasher& __hf, const key_equal& __eql, const allocator_type& __a);
+ _LIBCPP_HIDE_FROM_ABI explicit __hash_table(const allocator_type& __a);
+ _LIBCPP_HIDE_FROM_ABI __hash_table(const __hash_table& __u);
+ _LIBCPP_HIDE_FROM_ABI __hash_table(const __hash_table& __u, const allocator_type& __a);
+ _LIBCPP_HIDE_FROM_ABI __hash_table(__hash_table&& __u) _NOEXCEPT_(
+ is_nothrow_move_constructible<__bucket_list>::value&& is_nothrow_move_constructible<__first_node>::value&&
+ is_nothrow_move_constructible<__node_allocator>::value&& is_nothrow_move_constructible<hasher>::value&&
+ is_nothrow_move_constructible<key_equal>::value);
+ _LIBCPP_HIDE_FROM_ABI __hash_table(__hash_table&& __u, const allocator_type& __a);
+ _LIBCPP_HIDE_FROM_ABI ~__hash_table();
+
+ _LIBCPP_HIDE_FROM_ABI __hash_table& operator=(const __hash_table& __u);
+ _LIBCPP_HIDE_FROM_ABI __hash_table& operator=(__hash_table&& __u)
+ _NOEXCEPT_(__node_traits::propagate_on_container_move_assignment::value&&
+ is_nothrow_move_assignable<__node_allocator>::value&& is_nothrow_move_assignable<hasher>::value&&
+ is_nothrow_move_assignable<key_equal>::value);
+ template <class _InputIterator>
+ _LIBCPP_HIDE_FROM_ABI void __assign_unique(_InputIterator __first, _InputIterator __last);
+ template <class _InputIterator>
+ _LIBCPP_HIDE_FROM_ABI void __assign_multi(_InputIterator __first, _InputIterator __last);
+
+ _LIBCPP_HIDE_FROM_ABI size_type max_size() const _NOEXCEPT {
+ return std::min<size_type>(__node_traits::max_size(__node_alloc()), numeric_limits<difference_type >::max());
+ }
private:
- _LIBCPP_HIDE_FROM_ABI
- __next_pointer __node_insert_multi_prepare(size_t __cp_hash,
- value_type& __cp_val);
- _LIBCPP_HIDE_FROM_ABI
- void __node_insert_multi_perform(__node_pointer __cp,
- __next_pointer __pn) _NOEXCEPT;
-
- _LIBCPP_HIDE_FROM_ABI
- __next_pointer __node_insert_unique_prepare(size_t __nd_hash,
- value_type& __nd_val);
- _LIBCPP_HIDE_FROM_ABI
- void __node_insert_unique_perform(__node_pointer __ptr) _NOEXCEPT;
+ _LIBCPP_HIDE_FROM_ABI __next_pointer __node_insert_multi_prepare(size_t __cp_hash, value_type& __cp_val);
+ _LIBCPP_HIDE_FROM_ABI void __node_insert_multi_perform(__node_pointer __cp, __next_pointer __pn) _NOEXCEPT;
+
+ _LIBCPP_HIDE_FROM_ABI __next_pointer __node_insert_unique_prepare(size_t __nd_hash, value_type& __nd_val);
+ _LIBCPP_HIDE_FROM_ABI void __node_insert_unique_perform(__node_pointer __ptr) _NOEXCEPT;
public:
- _LIBCPP_HIDE_FROM_ABI
- pair<iterator, bool> __node_insert_unique(__node_pointer __nd);
- _LIBCPP_HIDE_FROM_ABI
- iterator __node_insert_multi(__node_pointer __nd);
- _LIBCPP_HIDE_FROM_ABI
- iterator __node_insert_multi(const_iterator __p,
- __node_pointer __nd);
-
- template <class _Key, class ..._Args>
- _LIBCPP_HIDE_FROM_ABI
- pair<iterator, bool> __emplace_unique_key_args(_Key const& __k, _Args&&... __args);
-
- template <class... _Args>
- _LIBCPP_HIDE_FROM_ABI
- pair<iterator, bool> __emplace_unique_impl(_Args&&... __args);
-
- template <class _Pp>
- _LIBCPP_HIDE_FROM_ABI
- pair<iterator, bool> __emplace_unique(_Pp&& __x) {
- return __emplace_unique_extract_key(std::forward<_Pp>(__x),
- __can_extract_key<_Pp, key_type>());
- }
+ _LIBCPP_HIDE_FROM_ABI pair<iterator, bool> __node_insert_unique(__node_pointer __nd);
+ _LIBCPP_HIDE_FROM_ABI iterator __node_insert_multi(__node_pointer __nd);
+ _LIBCPP_HIDE_FROM_ABI iterator __node_insert_multi(const_iterator __p, __node_pointer __nd);
- template <class _First, class _Second,
- __enable_if_t<__can_extract_map_key<_First, key_type, __container_value_type>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI
- pair<iterator, bool>
- __emplace_unique(_First&& __f, _Second&& __s) {
- return __emplace_unique_key_args(__f, std::forward<_First>(__f),
- std::forward<_Second>(__s));
- }
+ template <class _Key, class... _Args>
+ _LIBCPP_HIDE_FROM_ABI pair<iterator, bool> __emplace_unique_key_args(_Key const& __k, _Args&&... __args);
- template <class... _Args>
- _LIBCPP_HIDE_FROM_ABI
- pair<iterator, bool> __emplace_unique(_Args&&... __args) {
- return __emplace_unique_impl(std::forward<_Args>(__args)...);
- }
+ template <class... _Args>
+ _LIBCPP_HIDE_FROM_ABI pair<iterator, bool> __emplace_unique_impl(_Args&&... __args);
- template <class _Pp>
- _LIBCPP_HIDE_FROM_ABI
- pair<iterator, bool>
- __emplace_unique_extract_key(_Pp&& __x, __extract_key_fail_tag) {
- return __emplace_unique_impl(std::forward<_Pp>(__x));
- }
- template <class _Pp>
- _LIBCPP_HIDE_FROM_ABI
- pair<iterator, bool>
- __emplace_unique_extract_key(_Pp&& __x, __extract_key_self_tag) {
- return __emplace_unique_key_args(__x, std::forward<_Pp>(__x));
- }
- template <class _Pp>
- _LIBCPP_HIDE_FROM_ABI
- pair<iterator, bool>
- __emplace_unique_extract_key(_Pp&& __x, __extract_key_first_tag) {
- return __emplace_unique_key_args(__x.first, std::forward<_Pp>(__x));
- }
+ template <class _Pp>
+ _LIBCPP_HIDE_FROM_ABI pair<iterator, bool> __emplace_unique(_Pp&& __x) {
+ return __emplace_unique_extract_key(std::forward<_Pp>(__x), __can_extract_key<_Pp, key_type>());
+ }
- template <class... _Args>
- _LIBCPP_HIDE_FROM_ABI
- iterator __emplace_multi(_Args&&... __args);
- template <class... _Args>
- _LIBCPP_HIDE_FROM_ABI
- iterator __emplace_hint_multi(const_iterator __p, _Args&&... __args);
+ template <class _First,
+ class _Second,
+ __enable_if_t<__can_extract_map_key<_First, key_type, __container_value_type>::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI pair<iterator, bool> __emplace_unique(_First&& __f, _Second&& __s) {
+ return __emplace_unique_key_args(__f, std::forward<_First>(__f), std::forward<_Second>(__s));
+ }
+ template <class... _Args>
+ _LIBCPP_HIDE_FROM_ABI pair<iterator, bool> __emplace_unique(_Args&&... __args) {
+ return __emplace_unique_impl(std::forward<_Args>(__args)...);
+ }
- _LIBCPP_HIDE_FROM_ABI
- pair<iterator, bool>
- __insert_unique(__container_value_type&& __x) {
- return __emplace_unique_key_args(_NodeTypes::__get_key(__x), std::move(__x));
- }
+ template <class _Pp>
+ _LIBCPP_HIDE_FROM_ABI pair<iterator, bool> __emplace_unique_extract_key(_Pp&& __x, __extract_key_fail_tag) {
+ return __emplace_unique_impl(std::forward<_Pp>(__x));
+ }
+ template <class _Pp>
+ _LIBCPP_HIDE_FROM_ABI pair<iterator, bool> __emplace_unique_extract_key(_Pp&& __x, __extract_key_self_tag) {
+ return __emplace_unique_key_args(__x, std::forward<_Pp>(__x));
+ }
+ template <class _Pp>
+ _LIBCPP_HIDE_FROM_ABI pair<iterator, bool> __emplace_unique_extract_key(_Pp&& __x, __extract_key_first_tag) {
+ return __emplace_unique_key_args(__x.first, std::forward<_Pp>(__x));
+ }
- template <class _Pp, class = __enable_if_t<!__is_same_uncvref<_Pp, __container_value_type>::value> >
- _LIBCPP_HIDE_FROM_ABI
- pair<iterator, bool> __insert_unique(_Pp&& __x) {
- return __emplace_unique(std::forward<_Pp>(__x));
- }
+ template <class... _Args>
+ _LIBCPP_HIDE_FROM_ABI iterator __emplace_multi(_Args&&... __args);
+ template <class... _Args>
+ _LIBCPP_HIDE_FROM_ABI iterator __emplace_hint_multi(const_iterator __p, _Args&&... __args);
- template <class _Pp>
- _LIBCPP_HIDE_FROM_ABI
- iterator __insert_multi(_Pp&& __x) {
- return __emplace_multi(std::forward<_Pp>(__x));
- }
+ _LIBCPP_HIDE_FROM_ABI pair<iterator, bool> __insert_unique(__container_value_type&& __x) {
+ return __emplace_unique_key_args(_NodeTypes::__get_key(__x), std::move(__x));
+ }
- template <class _Pp>
- _LIBCPP_HIDE_FROM_ABI
- iterator __insert_multi(const_iterator __p, _Pp&& __x) {
- return __emplace_hint_multi(__p, std::forward<_Pp>(__x));
- }
+ template <class _Pp, class = __enable_if_t<!__is_same_uncvref<_Pp, __container_value_type>::value> >
+ _LIBCPP_HIDE_FROM_ABI pair<iterator, bool> __insert_unique(_Pp&& __x) {
+ return __emplace_unique(std::forward<_Pp>(__x));
+ }
- _LIBCPP_HIDE_FROM_ABI
- pair<iterator, bool> __insert_unique(const __container_value_type& __x) {
- return __emplace_unique_key_args(_NodeTypes::__get_key(__x), __x);
- }
+ template <class _Pp>
+ _LIBCPP_HIDE_FROM_ABI iterator __insert_multi(_Pp&& __x) {
+ return __emplace_multi(std::forward<_Pp>(__x));
+ }
+
+ template <class _Pp>
+ _LIBCPP_HIDE_FROM_ABI iterator __insert_multi(const_iterator __p, _Pp&& __x) {
+ return __emplace_hint_multi(__p, std::forward<_Pp>(__x));
+ }
+
+ _LIBCPP_HIDE_FROM_ABI pair<iterator, bool> __insert_unique(const __container_value_type& __x) {
+ return __emplace_unique_key_args(_NodeTypes::__get_key(__x), __x);
+ }
#if _LIBCPP_STD_VER >= 17
- template <class _NodeHandle, class _InsertReturnType>
- _LIBCPP_HIDE_FROM_ABI
- _InsertReturnType __node_handle_insert_unique(_NodeHandle&& __nh);
- template <class _NodeHandle>
- _LIBCPP_HIDE_FROM_ABI
- iterator __node_handle_insert_unique(const_iterator __hint,
- _NodeHandle&& __nh);
- template <class _Table>
- _LIBCPP_HIDE_FROM_ABI
- void __node_handle_merge_unique(_Table& __source);
-
- template <class _NodeHandle>
- _LIBCPP_HIDE_FROM_ABI
- iterator __node_handle_insert_multi(_NodeHandle&& __nh);
- template <class _NodeHandle>
- _LIBCPP_HIDE_FROM_ABI
- iterator __node_handle_insert_multi(const_iterator __hint, _NodeHandle&& __nh);
- template <class _Table>
- _LIBCPP_HIDE_FROM_ABI
- void __node_handle_merge_multi(_Table& __source);
-
- template <class _NodeHandle>
- _LIBCPP_HIDE_FROM_ABI
- _NodeHandle __node_handle_extract(key_type const& __key);
- template <class _NodeHandle>
- _LIBCPP_HIDE_FROM_ABI
- _NodeHandle __node_handle_extract(const_iterator __it);
+ template <class _NodeHandle, class _InsertReturnType>
+ _LIBCPP_HIDE_FROM_ABI _InsertReturnType __node_handle_insert_unique(_NodeHandle&& __nh);
+ template <class _NodeHandle>
+ _LIBCPP_HIDE_FROM_ABI iterator __node_handle_insert_unique(const_iterator __hint, _NodeHandle&& __nh);
+ template <class _Table>
+ _LIBCPP_HIDE_FROM_ABI void __node_handle_merge_unique(_Table& __source);
+
+ template <class _NodeHandle>
+ _LIBCPP_HIDE_FROM_ABI iterator __node_handle_insert_multi(_NodeHandle&& __nh);
+ template <class _NodeHandle>
+ _LIBCPP_HIDE_FROM_ABI iterator __node_handle_insert_multi(const_iterator __hint, _NodeHandle&& __nh);
+ template <class _Table>
+ _LIBCPP_HIDE_FROM_ABI void __node_handle_merge_multi(_Table& __source);
+
+ template <class _NodeHandle>
+ _LIBCPP_HIDE_FROM_ABI _NodeHandle __node_handle_extract(key_type const& __key);
+ template <class _NodeHandle>
+ _LIBCPP_HIDE_FROM_ABI _NodeHandle __node_handle_extract(const_iterator __it);
#endif
- _LIBCPP_HIDE_FROM_ABI void clear() _NOEXCEPT;
- _LIBCPP_HIDE_FROM_ABI void __rehash_unique(size_type __n) { __rehash<true>(__n); }
- _LIBCPP_HIDE_FROM_ABI void __rehash_multi(size_type __n) { __rehash<false>(__n); }
- _LIBCPP_HIDE_FROM_ABI void __reserve_unique(size_type __n)
- {
- __rehash_unique(static_cast<size_type>(std::ceil(__n / max_load_factor())));
- }
- _LIBCPP_HIDE_FROM_ABI void __reserve_multi(size_type __n)
- {
- __rehash_multi(static_cast<size_type>(std::ceil(__n / max_load_factor())));
- }
+ _LIBCPP_HIDE_FROM_ABI void clear() _NOEXCEPT;
+ _LIBCPP_HIDE_FROM_ABI void __rehash_unique(size_type __n) { __rehash<true>(__n); }
+ _LIBCPP_HIDE_FROM_ABI void __rehash_multi(size_type __n) { __rehash<false>(__n); }
+ _LIBCPP_HIDE_FROM_ABI void __reserve_unique(size_type __n) {
+ __rehash_unique(static_cast<size_type>(std::ceil(__n / max_load_factor())));
+ }
+ _LIBCPP_HIDE_FROM_ABI void __reserve_multi(size_type __n) {
+ __rehash_multi(static_cast<size_type>(std::ceil(__n / max_load_factor())));
+ }
- _LIBCPP_HIDE_FROM_ABI
- size_type bucket_count() const _NOEXCEPT
- {
- return __bucket_list_.get_deleter().size();
- }
+ _LIBCPP_HIDE_FROM_ABI size_type bucket_count() const _NOEXCEPT { return __bucket_list_.get_deleter().size(); }
- _LIBCPP_HIDE_FROM_ABI
- iterator begin() _NOEXCEPT;
- _LIBCPP_HIDE_FROM_ABI
- iterator end() _NOEXCEPT;
- _LIBCPP_HIDE_FROM_ABI
- const_iterator begin() const _NOEXCEPT;
- _LIBCPP_HIDE_FROM_ABI
- const_iterator end() const _NOEXCEPT;
-
- template <class _Key>
- _LIBCPP_HIDE_FROM_ABI
- size_type bucket(const _Key& __k) const
- {
- _LIBCPP_ASSERT_UNCATEGORIZED(bucket_count() > 0,
- "unordered container::bucket(key) called when bucket_count() == 0");
- return std::__constrain_hash(hash_function()(__k), bucket_count());
- }
+ _LIBCPP_HIDE_FROM_ABI iterator begin() _NOEXCEPT;
+ _LIBCPP_HIDE_FROM_ABI iterator end() _NOEXCEPT;
+ _LIBCPP_HIDE_FROM_ABI const_iterator begin() const _NOEXCEPT;
+ _LIBCPP_HIDE_FROM_ABI const_iterator end() const _NOEXCEPT;
+
+ template <class _Key>
+ _LIBCPP_HIDE_FROM_ABI size_type bucket(const _Key& __k) const {
+ _LIBCPP_ASSERT_UNCATEGORIZED(
+ bucket_count() > 0, "unordered container::bucket(key) called when bucket_count() == 0");
+ return std::__constrain_hash(hash_function()(__k), bucket_count());
+ }
- template <class _Key>
- _LIBCPP_HIDE_FROM_ABI iterator find(const _Key& __x);
- template <class _Key>
- _LIBCPP_HIDE_FROM_ABI const_iterator find(const _Key& __x) const;
-
- typedef __hash_node_destructor<__node_allocator> _Dp;
- typedef unique_ptr<__node, _Dp> __node_holder;
-
- _LIBCPP_HIDE_FROM_ABI iterator erase(const_iterator __p);
- _LIBCPP_HIDE_FROM_ABI iterator erase(const_iterator __first, const_iterator __last);
- template <class _Key>
- _LIBCPP_HIDE_FROM_ABI size_type __erase_unique(const _Key& __k);
- template <class _Key>
- _LIBCPP_HIDE_FROM_ABI size_type __erase_multi(const _Key& __k);
- _LIBCPP_HIDE_FROM_ABI __node_holder remove(const_iterator __p) _NOEXCEPT;
-
- template <class _Key>
- _LIBCPP_HIDE_FROM_ABI
- size_type __count_unique(const _Key& __k) const;
- template <class _Key>
- _LIBCPP_HIDE_FROM_ABI size_type __count_multi(const _Key& __k) const;
-
- template <class _Key>
- _LIBCPP_HIDE_FROM_ABI pair<iterator, iterator>
- __equal_range_unique(const _Key& __k);
- template <class _Key>
- _LIBCPP_HIDE_FROM_ABI pair<const_iterator, const_iterator>
- __equal_range_unique(const _Key& __k) const;
-
- template <class _Key>
- _LIBCPP_HIDE_FROM_ABI pair<iterator, iterator>
- __equal_range_multi(const _Key& __k);
- template <class _Key>
- _LIBCPP_HIDE_FROM_ABI pair<const_iterator, const_iterator>
- __equal_range_multi(const _Key& __k) const;
-
- _LIBCPP_HIDE_FROM_ABI void swap(__hash_table& __u)
+ template <class _Key>
+ _LIBCPP_HIDE_FROM_ABI iterator find(const _Key& __x);
+ template <class _Key>
+ _LIBCPP_HIDE_FROM_ABI const_iterator find(const _Key& __x) const;
+
+ typedef __hash_node_destructor<__node_allocator> _Dp;
+ typedef unique_ptr<__node, _Dp> __node_holder;
+
+ _LIBCPP_HIDE_FROM_ABI iterator erase(const_iterator __p);
+ _LIBCPP_HIDE_FROM_ABI iterator erase(const_iterator __first, const_iterator __last);
+ template <class _Key>
+ _LIBCPP_HIDE_FROM_ABI size_type __erase_unique(const _Key& __k);
+ template <class _Key>
+ _LIBCPP_HIDE_FROM_ABI size_type __erase_multi(const _Key& __k);
+ _LIBCPP_HIDE_FROM_ABI __node_holder remove(const_iterator __p) _NOEXCEPT;
+
+ template <class _Key>
+ _LIBCPP_HIDE_FROM_ABI size_type __count_unique(const _Key& __k) const;
+ template <class _Key>
+ _LIBCPP_HIDE_FROM_ABI size_type __count_multi(const _Key& __k) const;
+
+ template <class _Key>
+ _LIBCPP_HIDE_FROM_ABI pair<iterator, iterator> __equal_range_unique(const _Key& __k);
+ template <class _Key>
+ _LIBCPP_HIDE_FROM_ABI pair<const_iterator, const_iterator> __equal_range_unique(const _Key& __k) const;
+
+ template <class _Key>
+ _LIBCPP_HIDE_FROM_ABI pair<iterator, iterator> __equal_range_multi(const _Key& __k);
+ template <class _Key>
+ _LIBCPP_HIDE_FROM_ABI pair<const_iterator, const_iterator> __equal_range_multi(const _Key& __k) const;
+
+ _LIBCPP_HIDE_FROM_ABI void swap(__hash_table& __u)
#if _LIBCPP_STD_VER <= 11
- _NOEXCEPT_(
- __is_nothrow_swappable<hasher>::value && __is_nothrow_swappable<key_equal>::value
- && (!allocator_traits<__pointer_allocator>::propagate_on_container_swap::value
- || __is_nothrow_swappable<__pointer_allocator>::value)
- && (!__node_traits::propagate_on_container_swap::value
- || __is_nothrow_swappable<__node_allocator>::value)
- );
+ _NOEXCEPT_(__is_nothrow_swappable<hasher>::value&& __is_nothrow_swappable<key_equal>::value &&
+ (!allocator_traits<__pointer_allocator>::propagate_on_container_swap::value ||
+ __is_nothrow_swappable<__pointer_allocator>::value) &&
+ (!__node_traits::propagate_on_container_swap::value ||
+ __is_nothrow_swappable<__node_allocator>::value));
#else
- _NOEXCEPT_(__is_nothrow_swappable<hasher>::value && __is_nothrow_swappable<key_equal>::value);
+ _NOEXCEPT_(__is_nothrow_swappable<hasher>::value&& __is_nothrow_swappable<key_equal>::value);
#endif
- _LIBCPP_HIDE_FROM_ABI
- size_type max_bucket_count() const _NOEXCEPT
- {return max_size(); }
- _LIBCPP_HIDE_FROM_ABI size_type bucket_size(size_type __n) const;
- _LIBCPP_HIDE_FROM_ABI float load_factor() const _NOEXCEPT
- {
- size_type __bc = bucket_count();
- return __bc != 0 ? (float)size() / __bc : 0.f;
- }
- _LIBCPP_HIDE_FROM_ABI void max_load_factor(float __mlf) _NOEXCEPT
- {
- _LIBCPP_ASSERT_UNCATEGORIZED(__mlf > 0,
- "unordered container::max_load_factor(lf) called with lf <= 0");
- max_load_factor() = std::max(__mlf, load_factor());
- }
+ _LIBCPP_HIDE_FROM_ABI size_type max_bucket_count() const _NOEXCEPT { return max_size(); }
+ _LIBCPP_HIDE_FROM_ABI size_type bucket_size(size_type __n) const;
+ _LIBCPP_HIDE_FROM_ABI float load_factor() const _NOEXCEPT {
+ size_type __bc = bucket_count();
+ return __bc != 0 ? (float)size() / __bc : 0.f;
+ }
+ _LIBCPP_HIDE_FROM_ABI void max_load_factor(float __mlf) _NOEXCEPT {
+ _LIBCPP_ASSERT_UNCATEGORIZED(__mlf > 0, "unordered container::max_load_factor(lf) called with lf <= 0");
+ max_load_factor() = std::max(__mlf, load_factor());
+ }
- _LIBCPP_HIDE_FROM_ABI
- local_iterator
- begin(size_type __n)
- {
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__n < bucket_count(),
- "unordered container::begin(n) called with n >= bucket_count()");
- return local_iterator(__bucket_list_[__n], __n, bucket_count());
- }
+ _LIBCPP_HIDE_FROM_ABI local_iterator begin(size_type __n) {
+ _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
+ __n < bucket_count(), "unordered container::begin(n) called with n >= bucket_count()");
+ return local_iterator(__bucket_list_[__n], __n, bucket_count());
+ }
- _LIBCPP_HIDE_FROM_ABI
- local_iterator
- end(size_type __n)
- {
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__n < bucket_count(),
- "unordered container::end(n) called with n >= bucket_count()");
- return local_iterator(nullptr, __n, bucket_count());
- }
+ _LIBCPP_HIDE_FROM_ABI local_iterator end(size_type __n) {
+ _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
+ __n < bucket_count(), "unordered container::end(n) called with n >= bucket_count()");
+ return local_iterator(nullptr, __n, bucket_count());
+ }
- _LIBCPP_HIDE_FROM_ABI
- const_local_iterator
- cbegin(size_type __n) const
- {
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__n < bucket_count(),
- "unordered container::cbegin(n) called with n >= bucket_count()");
- return const_local_iterator(__bucket_list_[__n], __n, bucket_count());
- }
+ _LIBCPP_HIDE_FROM_ABI const_local_iterator cbegin(size_type __n) const {
+ _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
+ __n < bucket_count(), "unordered container::cbegin(n) called with n >= bucket_count()");
+ return const_local_iterator(__bucket_list_[__n], __n, bucket_count());
+ }
- _LIBCPP_HIDE_FROM_ABI
- const_local_iterator
- cend(size_type __n) const
- {
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__n < bucket_count(),
- "unordered container::cend(n) called with n >= bucket_count()");
- return const_local_iterator(nullptr, __n, bucket_count());
- }
+ _LIBCPP_HIDE_FROM_ABI const_local_iterator cend(size_type __n) const {
+ _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
+ __n < bucket_count(), "unordered container::cend(n) called with n >= bucket_count()");
+ return const_local_iterator(nullptr, __n, bucket_count());
+ }
private:
- template <bool _UniqueKeys>
- _LIBCPP_HIDE_FROM_ABI void __rehash(size_type __n);
- template <bool _UniqueKeys>
- _LIBCPP_HIDE_FROM_ABI void __do_rehash(size_type __n);
-
- template <class ..._Args>
- _LIBCPP_HIDE_FROM_ABI __node_holder __construct_node(_Args&& ...__args);
-
- template <class _First, class ..._Rest>
- _LIBCPP_HIDE_FROM_ABI __node_holder __construct_node_hash(size_t __hash, _First&& __f, _Rest&&... __rest);
-
-
- _LIBCPP_HIDE_FROM_ABI
- void __copy_assign_alloc(const __hash_table& __u)
- {__copy_assign_alloc(__u, integral_constant<bool,
- __node_traits::propagate_on_container_copy_assignment::value>());}
- _LIBCPP_HIDE_FROM_ABI void __copy_assign_alloc(const __hash_table& __u, true_type);
- _LIBCPP_HIDE_FROM_ABI
- void __copy_assign_alloc(const __hash_table&, false_type) {}
-
- _LIBCPP_HIDE_FROM_ABI void __move_assign(__hash_table& __u, false_type);
- _LIBCPP_HIDE_FROM_ABI void __move_assign(__hash_table& __u, true_type)
- _NOEXCEPT_(
- is_nothrow_move_assignable<__node_allocator>::value &&
- is_nothrow_move_assignable<hasher>::value &&
- is_nothrow_move_assignable<key_equal>::value);
- _LIBCPP_HIDE_FROM_ABI
- void __move_assign_alloc(__hash_table& __u)
- _NOEXCEPT_(
- !__node_traits::propagate_on_container_move_assignment::value ||
- (is_nothrow_move_assignable<__pointer_allocator>::value &&
- is_nothrow_move_assignable<__node_allocator>::value))
- {__move_assign_alloc(__u, integral_constant<bool,
- __node_traits::propagate_on_container_move_assignment::value>());}
- _LIBCPP_HIDE_FROM_ABI
- void __move_assign_alloc(__hash_table& __u, true_type)
- _NOEXCEPT_(
- is_nothrow_move_assignable<__pointer_allocator>::value &&
- is_nothrow_move_assignable<__node_allocator>::value)
- {
- __bucket_list_.get_deleter().__alloc() =
- std::move(__u.__bucket_list_.get_deleter().__alloc());
- __node_alloc() = std::move(__u.__node_alloc());
- }
- _LIBCPP_HIDE_FROM_ABI
- void __move_assign_alloc(__hash_table&, false_type) _NOEXCEPT {}
+ template <bool _UniqueKeys>
+ _LIBCPP_HIDE_FROM_ABI void __rehash(size_type __n);
+ template <bool _UniqueKeys>
+ _LIBCPP_HIDE_FROM_ABI void __do_rehash(size_type __n);
- _LIBCPP_HIDE_FROM_ABI void __deallocate_node(__next_pointer __np) _NOEXCEPT;
- _LIBCPP_HIDE_FROM_ABI __next_pointer __detach() _NOEXCEPT;
+ template <class... _Args>
+ _LIBCPP_HIDE_FROM_ABI __node_holder __construct_node(_Args&&... __args);
- template <class, class, class, class, class> friend class _LIBCPP_TEMPLATE_VIS unordered_map;
- template <class, class, class, class, class> friend class _LIBCPP_TEMPLATE_VIS unordered_multimap;
+ template <class _First, class... _Rest>
+ _LIBCPP_HIDE_FROM_ABI __node_holder __construct_node_hash(size_t __hash, _First&& __f, _Rest&&... __rest);
+
+ _LIBCPP_HIDE_FROM_ABI void __copy_assign_alloc(const __hash_table& __u) {
+ __copy_assign_alloc(__u, integral_constant<bool, __node_traits::propagate_on_container_copy_assignment::value>());
+ }
+ _LIBCPP_HIDE_FROM_ABI void __copy_assign_alloc(const __hash_table& __u, true_type);
+ _LIBCPP_HIDE_FROM_ABI void __copy_assign_alloc(const __hash_table&, false_type) {}
+
+ _LIBCPP_HIDE_FROM_ABI void __move_assign(__hash_table& __u, false_type);
+ _LIBCPP_HIDE_FROM_ABI void __move_assign(__hash_table& __u, true_type)
+ _NOEXCEPT_(is_nothrow_move_assignable<__node_allocator>::value&& is_nothrow_move_assignable<hasher>::value&&
+ is_nothrow_move_assignable<key_equal>::value);
+ _LIBCPP_HIDE_FROM_ABI void __move_assign_alloc(__hash_table& __u) _NOEXCEPT_(
+ !__node_traits::propagate_on_container_move_assignment::value ||
+ (is_nothrow_move_assignable<__pointer_allocator>::value && is_nothrow_move_assignable<__node_allocator>::value)) {
+ __move_assign_alloc(__u, integral_constant<bool, __node_traits::propagate_on_container_move_assignment::value>());
+ }
+ _LIBCPP_HIDE_FROM_ABI void __move_assign_alloc(__hash_table& __u, true_type) _NOEXCEPT_(
+ is_nothrow_move_assignable<__pointer_allocator>::value&& is_nothrow_move_assignable<__node_allocator>::value) {
+ __bucket_list_.get_deleter().__alloc() = std::move(__u.__bucket_list_.get_deleter().__alloc());
+ __node_alloc() = std::move(__u.__node_alloc());
+ }
+ _LIBCPP_HIDE_FROM_ABI void __move_assign_alloc(__hash_table&, false_type) _NOEXCEPT {}
+
+ _LIBCPP_HIDE_FROM_ABI void __deallocate_node(__next_pointer __np) _NOEXCEPT;
+ _LIBCPP_HIDE_FROM_ABI __next_pointer __detach() _NOEXCEPT;
+
+ template <class, class, class, class, class>
+ friend class _LIBCPP_TEMPLATE_VIS unordered_map;
+ template <class, class, class, class, class>
+ friend class _LIBCPP_TEMPLATE_VIS unordered_multimap;
};
template <class _Tp, class _Hash, class _Equal, class _Alloc>
-inline
-__hash_table<_Tp, _Hash, _Equal, _Alloc>::__hash_table()
- _NOEXCEPT_(
- is_nothrow_default_constructible<__bucket_list>::value &&
- is_nothrow_default_constructible<__first_node>::value &&
- is_nothrow_default_constructible<__node_allocator>::value &&
- is_nothrow_default_constructible<hasher>::value &&
- is_nothrow_default_constructible<key_equal>::value)
- : __p2_(0, __default_init_tag()),
- __p3_(1.0f, __default_init_tag())
-{
-}
+inline __hash_table<_Tp, _Hash, _Equal, _Alloc>::__hash_table() _NOEXCEPT_(
+ is_nothrow_default_constructible<__bucket_list>::value&& is_nothrow_default_constructible<__first_node>::value&&
+ is_nothrow_default_constructible<__node_allocator>::value&& is_nothrow_default_constructible<hasher>::value&&
+ is_nothrow_default_constructible<key_equal>::value)
+ : __p2_(0, __default_init_tag()), __p3_(1.0f, __default_init_tag()) {}
template <class _Tp, class _Hash, class _Equal, class _Alloc>
-inline
-__hash_table<_Tp, _Hash, _Equal, _Alloc>::__hash_table(const hasher& __hf,
- const key_equal& __eql)
- : __bucket_list_(nullptr, __bucket_list_deleter()),
- __p1_(),
- __p2_(0, __hf),
- __p3_(1.0f, __eql)
-{
-}
+inline __hash_table<_Tp, _Hash, _Equal, _Alloc>::__hash_table(const hasher& __hf, const key_equal& __eql)
+ : __bucket_list_(nullptr, __bucket_list_deleter()), __p1_(), __p2_(0, __hf), __p3_(1.0f, __eql) {}
template <class _Tp, class _Hash, class _Equal, class _Alloc>
-__hash_table<_Tp, _Hash, _Equal, _Alloc>::__hash_table(const hasher& __hf,
- const key_equal& __eql,
- const allocator_type& __a)
+__hash_table<_Tp, _Hash, _Equal, _Alloc>::__hash_table(
+ const hasher& __hf, const key_equal& __eql, const allocator_type& __a)
: __bucket_list_(nullptr, __bucket_list_deleter(__pointer_allocator(__a), 0)),
__p1_(__default_init_tag(), __node_allocator(__a)),
__p2_(0, __hf),
- __p3_(1.0f, __eql)
-{
-}
+ __p3_(1.0f, __eql) {}
template <class _Tp, class _Hash, class _Equal, class _Alloc>
__hash_table<_Tp, _Hash, _Equal, _Alloc>::__hash_table(const allocator_type& __a)
: __bucket_list_(nullptr, __bucket_list_deleter(__pointer_allocator(__a), 0)),
__p1_(__default_init_tag(), __node_allocator(__a)),
__p2_(0, __default_init_tag()),
- __p3_(1.0f, __default_init_tag())
-{
-}
+ __p3_(1.0f, __default_init_tag()) {}
template <class _Tp, class _Hash, class _Equal, class _Alloc>
__hash_table<_Tp, _Hash, _Equal, _Alloc>::__hash_table(const __hash_table& __u)
: __bucket_list_(nullptr,
- __bucket_list_deleter(allocator_traits<__pointer_allocator>::
- select_on_container_copy_construction(
- __u.__bucket_list_.get_deleter().__alloc()), 0)),
- __p1_(__default_init_tag(), allocator_traits<__node_allocator>::
- select_on_container_copy_construction(__u.__node_alloc())),
+ __bucket_list_deleter(allocator_traits<__pointer_allocator>::select_on_container_copy_construction(
+ __u.__bucket_list_.get_deleter().__alloc()),
+ 0)),
+ __p1_(__default_init_tag(),
+ allocator_traits<__node_allocator>::select_on_container_copy_construction(__u.__node_alloc())),
__p2_(0, __u.hash_function()),
- __p3_(__u.__p3_)
-{
-}
+ __p3_(__u.__p3_) {}
template <class _Tp, class _Hash, class _Equal, class _Alloc>
-__hash_table<_Tp, _Hash, _Equal, _Alloc>::__hash_table(const __hash_table& __u,
- const allocator_type& __a)
+__hash_table<_Tp, _Hash, _Equal, _Alloc>::__hash_table(const __hash_table& __u, const allocator_type& __a)
: __bucket_list_(nullptr, __bucket_list_deleter(__pointer_allocator(__a), 0)),
__p1_(__default_init_tag(), __node_allocator(__a)),
__p2_(0, __u.hash_function()),
- __p3_(__u.__p3_)
-{
-}
+ __p3_(__u.__p3_) {}
template <class _Tp, class _Hash, class _Equal, class _Alloc>
-__hash_table<_Tp, _Hash, _Equal, _Alloc>::__hash_table(__hash_table&& __u)
- _NOEXCEPT_(
- is_nothrow_move_constructible<__bucket_list>::value &&
- is_nothrow_move_constructible<__first_node>::value &&
- is_nothrow_move_constructible<__node_allocator>::value &&
- is_nothrow_move_constructible<hasher>::value &&
+__hash_table<_Tp, _Hash, _Equal, _Alloc>::__hash_table(__hash_table&& __u) _NOEXCEPT_(
+ is_nothrow_move_constructible<__bucket_list>::value&& is_nothrow_move_constructible<__first_node>::value&&
+ is_nothrow_move_constructible<__node_allocator>::value&& is_nothrow_move_constructible<hasher>::value&&
is_nothrow_move_constructible<key_equal>::value)
: __bucket_list_(std::move(__u.__bucket_list_)),
__p1_(std::move(__u.__p1_)),
__p2_(std::move(__u.__p2_)),
- __p3_(std::move(__u.__p3_))
-{
- if (size() > 0)
- {
- __bucket_list_[std::__constrain_hash(__p1_.first().__next_->__hash(), bucket_count())] =
- __p1_.first().__ptr();
- __u.__p1_.first().__next_ = nullptr;
- __u.size() = 0;
- }
+ __p3_(std::move(__u.__p3_)) {
+ if (size() > 0) {
+ __bucket_list_[std::__constrain_hash(__p1_.first().__next_->__hash(), bucket_count())] = __p1_.first().__ptr();
+ __u.__p1_.first().__next_ = nullptr;
+ __u.size() = 0;
+ }
}
template <class _Tp, class _Hash, class _Equal, class _Alloc>
-__hash_table<_Tp, _Hash, _Equal, _Alloc>::__hash_table(__hash_table&& __u,
- const allocator_type& __a)
+__hash_table<_Tp, _Hash, _Equal, _Alloc>::__hash_table(__hash_table&& __u, const allocator_type& __a)
: __bucket_list_(nullptr, __bucket_list_deleter(__pointer_allocator(__a), 0)),
__p1_(__default_init_tag(), __node_allocator(__a)),
__p2_(0, std::move(__u.hash_function())),
- __p3_(std::move(__u.__p3_))
-{
- if (__a == allocator_type(__u.__node_alloc()))
- {
- __bucket_list_.reset(__u.__bucket_list_.release());
- __bucket_list_.get_deleter().size() = __u.__bucket_list_.get_deleter().size();
- __u.__bucket_list_.get_deleter().size() = 0;
- if (__u.size() > 0)
- {
- __p1_.first().__next_ = __u.__p1_.first().__next_;
- __u.__p1_.first().__next_ = nullptr;
- __bucket_list_[std::__constrain_hash(__p1_.first().__next_->__hash(), bucket_count())] =
- __p1_.first().__ptr();
- size() = __u.size();
- __u.size() = 0;
- }
+ __p3_(std::move(__u.__p3_)) {
+ if (__a == allocator_type(__u.__node_alloc())) {
+ __bucket_list_.reset(__u.__bucket_list_.release());
+ __bucket_list_.get_deleter().size() = __u.__bucket_list_.get_deleter().size();
+ __u.__bucket_list_.get_deleter().size() = 0;
+ if (__u.size() > 0) {
+ __p1_.first().__next_ = __u.__p1_.first().__next_;
+ __u.__p1_.first().__next_ = nullptr;
+ __bucket_list_[std::__constrain_hash(__p1_.first().__next_->__hash(), bucket_count())] = __p1_.first().__ptr();
+ size() = __u.size();
+ __u.size() = 0;
}
+ }
}
template <class _Tp, class _Hash, class _Equal, class _Alloc>
-__hash_table<_Tp, _Hash, _Equal, _Alloc>::~__hash_table()
-{
+__hash_table<_Tp, _Hash, _Equal, _Alloc>::~__hash_table() {
#if defined(_LIBCPP_CXX03_LANG)
- static_assert((is_copy_constructible<key_equal>::value),
- "Predicate must be copy-constructible.");
- static_assert((is_copy_constructible<hasher>::value),
- "Hasher must be copy-constructible.");
+ static_assert((is_copy_constructible<key_equal>::value), "Predicate must be copy-constructible.");
+ static_assert((is_copy_constructible<hasher>::value), "Hasher must be copy-constructible.");
#endif
- __deallocate_node(__p1_.first().__next_);
+ __deallocate_node(__p1_.first().__next_);
}
template <class _Tp, class _Hash, class _Equal, class _Alloc>
-void
-__hash_table<_Tp, _Hash, _Equal, _Alloc>::__copy_assign_alloc(
- const __hash_table& __u, true_type)
-{
- if (__node_alloc() != __u.__node_alloc())
- {
- clear();
- __bucket_list_.reset();
- __bucket_list_.get_deleter().size() = 0;
- }
- __bucket_list_.get_deleter().__alloc() = __u.__bucket_list_.get_deleter().__alloc();
- __node_alloc() = __u.__node_alloc();
+void __hash_table<_Tp, _Hash, _Equal, _Alloc>::__copy_assign_alloc(const __hash_table& __u, true_type) {
+ if (__node_alloc() != __u.__node_alloc()) {
+ clear();
+ __bucket_list_.reset();
+ __bucket_list_.get_deleter().size() = 0;
+ }
+ __bucket_list_.get_deleter().__alloc() = __u.__bucket_list_.get_deleter().__alloc();
+ __node_alloc() = __u.__node_alloc();
}
template <class _Tp, class _Hash, class _Equal, class _Alloc>
-__hash_table<_Tp, _Hash, _Equal, _Alloc>&
-__hash_table<_Tp, _Hash, _Equal, _Alloc>::operator=(const __hash_table& __u)
-{
- if (this != std::addressof(__u))
- {
- __copy_assign_alloc(__u);
- hash_function() = __u.hash_function();
- key_eq() = __u.key_eq();
- max_load_factor() = __u.max_load_factor();
- __assign_multi(__u.begin(), __u.end());
- }
- return *this;
+__hash_table<_Tp, _Hash, _Equal, _Alloc>& __hash_table<_Tp, _Hash, _Equal, _Alloc>::operator=(const __hash_table& __u) {
+ if (this != std::addressof(__u)) {
+ __copy_assign_alloc(__u);
+ hash_function() = __u.hash_function();
+ key_eq() = __u.key_eq();
+ max_load_factor() = __u.max_load_factor();
+ __assign_multi(__u.begin(), __u.end());
+ }
+ return *this;
}
template <class _Tp, class _Hash, class _Equal, class _Alloc>
-void
-__hash_table<_Tp, _Hash, _Equal, _Alloc>::__deallocate_node(__next_pointer __np)
- _NOEXCEPT
-{
- __node_allocator& __na = __node_alloc();
- while (__np != nullptr)
- {
- __next_pointer __next = __np->__next_;
- __node_pointer __real_np = __np->__upcast();
- __node_traits::destroy(__na, _NodeTypes::__get_ptr(__real_np->__get_value()));
- std::__destroy_at(std::addressof(*__real_np));
- __node_traits::deallocate(__na, __real_np, 1);
- __np = __next;
- }
+void __hash_table<_Tp, _Hash, _Equal, _Alloc>::__deallocate_node(__next_pointer __np) _NOEXCEPT {
+ __node_allocator& __na = __node_alloc();
+ while (__np != nullptr) {
+ __next_pointer __next = __np->__next_;
+ __node_pointer __real_np = __np->__upcast();
+ __node_traits::destroy(__na, _NodeTypes::__get_ptr(__real_np->__get_value()));
+ std::__destroy_at(std::addressof(*__real_np));
+ __node_traits::deallocate(__na, __real_np, 1);
+ __np = __next;
+ }
}
template <class _Tp, class _Hash, class _Equal, class _Alloc>
typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::__next_pointer
-__hash_table<_Tp, _Hash, _Equal, _Alloc>::__detach() _NOEXCEPT
-{
- size_type __bc = bucket_count();
- for (size_type __i = 0; __i < __bc; ++__i)
- __bucket_list_[__i] = nullptr;
- size() = 0;
- __next_pointer __cache = __p1_.first().__next_;
- __p1_.first().__next_ = nullptr;
- return __cache;
+__hash_table<_Tp, _Hash, _Equal, _Alloc>::__detach() _NOEXCEPT {
+ size_type __bc = bucket_count();
+ for (size_type __i = 0; __i < __bc; ++__i)
+ __bucket_list_[__i] = nullptr;
+ size() = 0;
+ __next_pointer __cache = __p1_.first().__next_;
+ __p1_.first().__next_ = nullptr;
+ return __cache;
}
template <class _Tp, class _Hash, class _Equal, class _Alloc>
-void
-__hash_table<_Tp, _Hash, _Equal, _Alloc>::__move_assign(
- __hash_table& __u, true_type)
- _NOEXCEPT_(
- is_nothrow_move_assignable<__node_allocator>::value &&
- is_nothrow_move_assignable<hasher>::value &&
- is_nothrow_move_assignable<key_equal>::value)
-{
- clear();
- __bucket_list_.reset(__u.__bucket_list_.release());
- __bucket_list_.get_deleter().size() = __u.__bucket_list_.get_deleter().size();
- __u.__bucket_list_.get_deleter().size() = 0;
- __move_assign_alloc(__u);
- size() = __u.size();
- hash_function() = std::move(__u.hash_function());
- max_load_factor() = __u.max_load_factor();
- key_eq() = std::move(__u.key_eq());
- __p1_.first().__next_ = __u.__p1_.first().__next_;
- if (size() > 0)
- {
- __bucket_list_[std::__constrain_hash(__p1_.first().__next_->__hash(), bucket_count())] =
- __p1_.first().__ptr();
- __u.__p1_.first().__next_ = nullptr;
- __u.size() = 0;
- }
+void __hash_table<_Tp, _Hash, _Equal, _Alloc>::__move_assign(__hash_table& __u, true_type)
+ _NOEXCEPT_(is_nothrow_move_assignable<__node_allocator>::value&& is_nothrow_move_assignable<hasher>::value&&
+ is_nothrow_move_assignable<key_equal>::value) {
+ clear();
+ __bucket_list_.reset(__u.__bucket_list_.release());
+ __bucket_list_.get_deleter().size() = __u.__bucket_list_.get_deleter().size();
+ __u.__bucket_list_.get_deleter().size() = 0;
+ __move_assign_alloc(__u);
+ size() = __u.size();
+ hash_function() = std::move(__u.hash_function());
+ max_load_factor() = __u.max_load_factor();
+ key_eq() = std::move(__u.key_eq());
+ __p1_.first().__next_ = __u.__p1_.first().__next_;
+ if (size() > 0) {
+ __bucket_list_[std::__constrain_hash(__p1_.first().__next_->__hash(), bucket_count())] = __p1_.first().__ptr();
+ __u.__p1_.first().__next_ = nullptr;
+ __u.size() = 0;
+ }
}
template <class _Tp, class _Hash, class _Equal, class _Alloc>
-void
-__hash_table<_Tp, _Hash, _Equal, _Alloc>::__move_assign(
- __hash_table& __u, false_type)
-{
- if (__node_alloc() == __u.__node_alloc())
- __move_assign(__u, true_type());
- else
- {
- hash_function() = std::move(__u.hash_function());
- key_eq() = std::move(__u.key_eq());
- max_load_factor() = __u.max_load_factor();
- if (bucket_count() != 0)
- {
- __next_pointer __cache = __detach();
-#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- try
- {
-#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- const_iterator __i = __u.begin();
- while (__cache != nullptr && __u.size() != 0)
- {
- __cache->__upcast()->__get_value() =
- std::move(__u.remove(__i++)->__get_value());
- __next_pointer __next = __cache->__next_;
- __node_insert_multi(__cache->__upcast());
- __cache = __next;
- }
+void __hash_table<_Tp, _Hash, _Equal, _Alloc>::__move_assign(__hash_table& __u, false_type) {
+ if (__node_alloc() == __u.__node_alloc())
+ __move_assign(__u, true_type());
+ else {
+ hash_function() = std::move(__u.hash_function());
+ key_eq() = std::move(__u.key_eq());
+ max_load_factor() = __u.max_load_factor();
+ if (bucket_count() != 0) {
+ __next_pointer __cache = __detach();
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- }
- catch (...)
- {
- __deallocate_node(__cache);
- throw;
- }
+ try {
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- __deallocate_node(__cache);
- }
const_iterator __i = __u.begin();
- while (__u.size() != 0)
- {
- __node_holder __h = __construct_node(_NodeTypes::__move(__u.remove(__i++)->__get_value()));
- __node_insert_multi(__h.get());
- __h.release();
+ while (__cache != nullptr && __u.size() != 0) {
+ __cache->__upcast()->__get_value() = std::move(__u.remove(__i++)->__get_value());
+ __next_pointer __next = __cache->__next_;
+ __node_insert_multi(__cache->__upcast());
+ __cache = __next;
}
+#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
+ } catch (...) {
+ __deallocate_node(__cache);
+ throw;
+ }
+#endif // _LIBCPP_HAS_NO_EXCEPTIONS
+ __deallocate_node(__cache);
+ }
+ const_iterator __i = __u.begin();
+ while (__u.size() != 0) {
+ __node_holder __h = __construct_node(_NodeTypes::__move(__u.remove(__i++)->__get_value()));
+ __node_insert_multi(__h.get());
+ __h.release();
}
+ }
}
template <class _Tp, class _Hash, class _Equal, class _Alloc>
-inline
-__hash_table<_Tp, _Hash, _Equal, _Alloc>&
-__hash_table<_Tp, _Hash, _Equal, _Alloc>::operator=(__hash_table&& __u)
- _NOEXCEPT_(
- __node_traits::propagate_on_container_move_assignment::value &&
- is_nothrow_move_assignable<__node_allocator>::value &&
- is_nothrow_move_assignable<hasher>::value &&
- is_nothrow_move_assignable<key_equal>::value)
-{
- __move_assign(__u, integral_constant<bool,
- __node_traits::propagate_on_container_move_assignment::value>());
- return *this;
+inline __hash_table<_Tp, _Hash, _Equal, _Alloc>&
+__hash_table<_Tp, _Hash, _Equal, _Alloc>::operator=(__hash_table&& __u) _NOEXCEPT_(
+ __node_traits::propagate_on_container_move_assignment::value&& is_nothrow_move_assignable<__node_allocator>::value&&
+ is_nothrow_move_assignable<hasher>::value&& is_nothrow_move_assignable<key_equal>::value) {
+ __move_assign(__u, integral_constant<bool, __node_traits::propagate_on_container_move_assignment::value>());
+ return *this;
}
template <class _Tp, class _Hash, class _Equal, class _Alloc>
template <class _InputIterator>
-void
-__hash_table<_Tp, _Hash, _Equal, _Alloc>::__assign_unique(_InputIterator __first,
- _InputIterator __last)
-{
- typedef iterator_traits<_InputIterator> _ITraits;
- typedef typename _ITraits::value_type _ItValueType;
- static_assert((is_same<_ItValueType, __container_value_type>::value),
- "__assign_unique may only be called with the containers value type");
-
- if (bucket_count() != 0)
- {
- __next_pointer __cache = __detach();
+void __hash_table<_Tp, _Hash, _Equal, _Alloc>::__assign_unique(_InputIterator __first, _InputIterator __last) {
+ typedef iterator_traits<_InputIterator> _ITraits;
+ typedef typename _ITraits::value_type _ItValueType;
+ static_assert((is_same<_ItValueType, __container_value_type>::value),
+ "__assign_unique may only be called with the containers value type");
+
+ if (bucket_count() != 0) {
+ __next_pointer __cache = __detach();
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- try
- {
+ try {
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- for (; __cache != nullptr && __first != __last; ++__first)
- {
- __cache->__upcast()->__get_value() = *__first;
- __next_pointer __next = __cache->__next_;
- __node_insert_unique(__cache->__upcast());
- __cache = __next;
- }
+ for (; __cache != nullptr && __first != __last; ++__first) {
+ __cache->__upcast()->__get_value() = *__first;
+ __next_pointer __next = __cache->__next_;
+ __node_insert_unique(__cache->__upcast());
+ __cache = __next;
+ }
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- }
- catch (...)
- {
- __deallocate_node(__cache);
- throw;
- }
-#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- __deallocate_node(__cache);
+ } catch (...) {
+ __deallocate_node(__cache);
+ throw;
}
- for (; __first != __last; ++__first)
- __insert_unique(*__first);
+#endif // _LIBCPP_HAS_NO_EXCEPTIONS
+ __deallocate_node(__cache);
+ }
+ for (; __first != __last; ++__first)
+ __insert_unique(*__first);
}
template <class _Tp, class _Hash, class _Equal, class _Alloc>
template <class _InputIterator>
-void
-__hash_table<_Tp, _Hash, _Equal, _Alloc>::__assign_multi(_InputIterator __first,
- _InputIterator __last)
-{
- typedef iterator_traits<_InputIterator> _ITraits;
- typedef typename _ITraits::value_type _ItValueType;
- static_assert((is_same<_ItValueType, __container_value_type>::value ||
- is_same<_ItValueType, __node_value_type>::value),
- "__assign_multi may only be called with the containers value type"
- " or the nodes value type");
- if (bucket_count() != 0)
- {
- __next_pointer __cache = __detach();
+void __hash_table<_Tp, _Hash, _Equal, _Alloc>::__assign_multi(_InputIterator __first, _InputIterator __last) {
+ typedef iterator_traits<_InputIterator> _ITraits;
+ typedef typename _ITraits::value_type _ItValueType;
+ static_assert(
+ (is_same<_ItValueType, __container_value_type>::value || is_same<_ItValueType, __node_value_type>::value),
+ "__assign_multi may only be called with the containers value type"
+ " or the nodes value type");
+ if (bucket_count() != 0) {
+ __next_pointer __cache = __detach();
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- try
- {
+ try {
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- for (; __cache != nullptr && __first != __last; ++__first)
- {
- __cache->__upcast()->__get_value() = *__first;
- __next_pointer __next = __cache->__next_;
- __node_insert_multi(__cache->__upcast());
- __cache = __next;
- }
+ for (; __cache != nullptr && __first != __last; ++__first) {
+ __cache->__upcast()->__get_value() = *__first;
+ __next_pointer __next = __cache->__next_;
+ __node_insert_multi(__cache->__upcast());
+ __cache = __next;
+ }
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- }
- catch (...)
- {
- __deallocate_node(__cache);
- throw;
- }
-#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- __deallocate_node(__cache);
+ } catch (...) {
+ __deallocate_node(__cache);
+ throw;
}
- for (; __first != __last; ++__first)
- __insert_multi(_NodeTypes::__get_value(*__first));
+#endif // _LIBCPP_HAS_NO_EXCEPTIONS
+ __deallocate_node(__cache);
+ }
+ for (; __first != __last; ++__first)
+ __insert_multi(_NodeTypes::__get_value(*__first));
}
template <class _Tp, class _Hash, class _Equal, class _Alloc>
-inline
-typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::iterator
-__hash_table<_Tp, _Hash, _Equal, _Alloc>::begin() _NOEXCEPT
-{
- return iterator(__p1_.first().__next_);
+inline typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::iterator
+__hash_table<_Tp, _Hash, _Equal, _Alloc>::begin() _NOEXCEPT {
+ return iterator(__p1_.first().__next_);
}
template <class _Tp, class _Hash, class _Equal, class _Alloc>
-inline
-typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::iterator
-__hash_table<_Tp, _Hash, _Equal, _Alloc>::end() _NOEXCEPT
-{
- return iterator(nullptr);
+inline typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::iterator
+__hash_table<_Tp, _Hash, _Equal, _Alloc>::end() _NOEXCEPT {
+ return iterator(nullptr);
}
template <class _Tp, class _Hash, class _Equal, class _Alloc>
-inline
-typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::const_iterator
-__hash_table<_Tp, _Hash, _Equal, _Alloc>::begin() const _NOEXCEPT
-{
- return const_iterator(__p1_.first().__next_);
+inline typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::const_iterator
+__hash_table<_Tp, _Hash, _Equal, _Alloc>::begin() const _NOEXCEPT {
+ return const_iterator(__p1_.first().__next_);
}
template <class _Tp, class _Hash, class _Equal, class _Alloc>
-inline
-typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::const_iterator
-__hash_table<_Tp, _Hash, _Equal, _Alloc>::end() const _NOEXCEPT
-{
- return const_iterator(nullptr);
+inline typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::const_iterator
+__hash_table<_Tp, _Hash, _Equal, _Alloc>::end() const _NOEXCEPT {
+ return const_iterator(nullptr);
}
template <class _Tp, class _Hash, class _Equal, class _Alloc>
-void
-__hash_table<_Tp, _Hash, _Equal, _Alloc>::clear() _NOEXCEPT
-{
- if (size() > 0)
- {
- __deallocate_node(__p1_.first().__next_);
- __p1_.first().__next_ = nullptr;
- size_type __bc = bucket_count();
- for (size_type __i = 0; __i < __bc; ++__i)
- __bucket_list_[__i] = nullptr;
- size() = 0;
- }
+void __hash_table<_Tp, _Hash, _Equal, _Alloc>::clear() _NOEXCEPT {
+ if (size() > 0) {
+ __deallocate_node(__p1_.first().__next_);
+ __p1_.first().__next_ = nullptr;
+ size_type __bc = bucket_count();
+ for (size_type __i = 0; __i < __bc; ++__i)
+ __bucket_list_[__i] = nullptr;
+ size() = 0;
+ }
}
-
// Prepare the container for an insertion of the value __value with the hash
// __hash. This does a lookup into the container to see if __value is already
// present, and performs a rehash if necessary. Returns a pointer to the
@@ -1640,36 +1298,28 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::clear() _NOEXCEPT
// Note that this function does forward exceptions if key_eq() throws, and never
// mutates __value or actually inserts into the map.
template <class _Tp, class _Hash, class _Equal, class _Alloc>
-_LIBCPP_HIDE_FROM_ABI
-typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::__next_pointer
-__hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_insert_unique_prepare(
- size_t __hash, value_type& __value)
-{
- size_type __bc = bucket_count();
-
- if (__bc != 0)
- {
- size_t __chash = std::__constrain_hash(__hash, __bc);
- __next_pointer __ndptr = __bucket_list_[__chash];
- if (__ndptr != nullptr)
- {
- for (__ndptr = __ndptr->__next_; __ndptr != nullptr &&
- (__ndptr->__hash() == __hash ||
- std::__constrain_hash(__ndptr->__hash(), __bc) == __chash);
- __ndptr = __ndptr->__next_)
- {
- if ((__ndptr->__hash() == __hash) &&
- key_eq()(__ndptr->__upcast()->__get_value(), __value))
- return __ndptr;
- }
- }
- }
- if (size()+1 > __bc * max_load_factor() || __bc == 0)
- {
- __rehash_unique(std::max<size_type>(2 * __bc + !std::__is_hash_power2(__bc),
- size_type(std::ceil(float(size() + 1) / max_load_factor()))));
+_LIBCPP_HIDE_FROM_ABI typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::__next_pointer
+__hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_insert_unique_prepare(size_t __hash, value_type& __value) {
+ size_type __bc = bucket_count();
+
+ if (__bc != 0) {
+ size_t __chash = std::__constrain_hash(__hash, __bc);
+ __next_pointer __ndptr = __bucket_list_[__chash];
+ if (__ndptr != nullptr) {
+ for (__ndptr = __ndptr->__next_;
+ __ndptr != nullptr &&
+ (__ndptr->__hash() == __hash || std::__constrain_hash(__ndptr->__hash(), __bc) == __chash);
+ __ndptr = __ndptr->__next_) {
+ if ((__ndptr->__hash() == __hash) && key_eq()(__ndptr->__upcast()->__get_value(), __value))
+ return __ndptr;
+ }
}
- return nullptr;
+ }
+ if (size() + 1 > __bc * max_load_factor() || __bc == 0) {
+ __rehash_unique(std::max<size_type>(
+ 2 * __bc + !std::__is_hash_power2(__bc), size_type(std::ceil(float(size() + 1) / max_load_factor()))));
+ }
+ return nullptr;
}
// Insert the node __nd into the container by pushing it into the right bucket,
@@ -1677,50 +1327,41 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_insert_unique_prepare(
// rehashing has already occurred and that no element with the same key exists
// in the map.
template <class _Tp, class _Hash, class _Equal, class _Alloc>
-_LIBCPP_HIDE_FROM_ABI
-void
-__hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_insert_unique_perform(
- __node_pointer __nd) _NOEXCEPT
-{
- size_type __bc = bucket_count();
- size_t __chash = std::__constrain_hash(__nd->__hash(), __bc);
- // insert_after __bucket_list_[__chash], or __first_node if bucket is null
- __next_pointer __pn = __bucket_list_[__chash];
- if (__pn == nullptr)
- {
- __pn =__p1_.first().__ptr();
- __nd->__next_ = __pn->__next_;
- __pn->__next_ = __nd->__ptr();
- // fix up __bucket_list_
- __bucket_list_[__chash] = __pn;
- if (__nd->__next_ != nullptr)
- __bucket_list_[std::__constrain_hash(__nd->__next_->__hash(), __bc)] = __nd->__ptr();
- }
- else
- {
- __nd->__next_ = __pn->__next_;
- __pn->__next_ = __nd->__ptr();
- }
- ++size();
+_LIBCPP_HIDE_FROM_ABI void
+__hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_insert_unique_perform(__node_pointer __nd) _NOEXCEPT {
+ size_type __bc = bucket_count();
+ size_t __chash = std::__constrain_hash(__nd->__hash(), __bc);
+ // insert_after __bucket_list_[__chash], or __first_node if bucket is null
+ __next_pointer __pn = __bucket_list_[__chash];
+ if (__pn == nullptr) {
+ __pn = __p1_.first().__ptr();
+ __nd->__next_ = __pn->__next_;
+ __pn->__next_ = __nd->__ptr();
+ // fix up __bucket_list_
+ __bucket_list_[__chash] = __pn;
+ if (__nd->__next_ != nullptr)
+ __bucket_list_[std::__constrain_hash(__nd->__next_->__hash(), __bc)] = __nd->__ptr();
+ } else {
+ __nd->__next_ = __pn->__next_;
+ __pn->__next_ = __nd->__ptr();
+ }
+ ++size();
}
template <class _Tp, class _Hash, class _Equal, class _Alloc>
pair<typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::iterator, bool>
-__hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_insert_unique(__node_pointer __nd)
-{
- __nd->__hash_ = hash_function()(__nd->__get_value());
- __next_pointer __existing_node =
- __node_insert_unique_prepare(__nd->__hash(), __nd->__get_value());
-
- // Insert the node, unless it already exists in the container.
- bool __inserted = false;
- if (__existing_node == nullptr)
- {
- __node_insert_unique_perform(__nd);
- __existing_node = __nd->__ptr();
- __inserted = true;
- }
- return pair<iterator, bool>(iterator(__existing_node), __inserted);
+__hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_insert_unique(__node_pointer __nd) {
+ __nd->__hash_ = hash_function()(__nd->__get_value());
+ __next_pointer __existing_node = __node_insert_unique_prepare(__nd->__hash(), __nd->__get_value());
+
+ // Insert the node, unless it already exists in the container.
+ bool __inserted = false;
+ if (__existing_node == nullptr) {
+ __node_insert_unique_perform(__nd);
+ __existing_node = __nd->__ptr();
+ __inserted = true;
+ }
+ return pair<iterator, bool>(iterator(__existing_node), __inserted);
}
// Prepare the container for an insertion of the value __cp_val with the hash
@@ -1732,40 +1373,34 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_insert_unique(__node_pointer __
// mutates __value or actually inserts into the map.
template <class _Tp, class _Hash, class _Equal, class _Alloc>
typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::__next_pointer
-__hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_insert_multi_prepare(
- size_t __cp_hash, value_type& __cp_val)
-{
- size_type __bc = bucket_count();
- if (size()+1 > __bc * max_load_factor() || __bc == 0)
- {
- __rehash_multi(std::max<size_type>(2 * __bc + !std::__is_hash_power2(__bc),
- size_type(std::ceil(float(size() + 1) / max_load_factor()))));
- __bc = bucket_count();
- }
- size_t __chash = std::__constrain_hash(__cp_hash, __bc);
- __next_pointer __pn = __bucket_list_[__chash];
- if (__pn != nullptr)
- {
- for (bool __found = false; __pn->__next_ != nullptr &&
- std::__constrain_hash(__pn->__next_->__hash(), __bc) == __chash;
- __pn = __pn->__next_)
- {
- // __found key_eq() action
- // false false loop
- // true true loop
- // false true set __found to true
- // true false break
- if (__found != (__pn->__next_->__hash() == __cp_hash &&
- key_eq()(__pn->__next_->__upcast()->__get_value(), __cp_val)))
- {
- if (!__found)
- __found = true;
- else
- break;
- }
- }
+__hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_insert_multi_prepare(size_t __cp_hash, value_type& __cp_val) {
+ size_type __bc = bucket_count();
+ if (size() + 1 > __bc * max_load_factor() || __bc == 0) {
+ __rehash_multi(std::max<size_type>(
+ 2 * __bc + !std::__is_hash_power2(__bc), size_type(std::ceil(float(size() + 1) / max_load_factor()))));
+ __bc = bucket_count();
+ }
+ size_t __chash = std::__constrain_hash(__cp_hash, __bc);
+ __next_pointer __pn = __bucket_list_[__chash];
+ if (__pn != nullptr) {
+ for (bool __found = false;
+ __pn->__next_ != nullptr && std::__constrain_hash(__pn->__next_->__hash(), __bc) == __chash;
+ __pn = __pn->__next_) {
+ // __found key_eq() action
+ // false false loop
+ // true true loop
+ // false true set __found to true
+ // true false break
+ if (__found !=
+ (__pn->__next_->__hash() == __cp_hash && key_eq()(__pn->__next_->__upcast()->__get_value(), __cp_val))) {
+ if (!__found)
+ __found = true;
+ else
+ break;
+ }
}
- return __pn;
+ }
+ return __pn;
}
// Insert the node __cp into the container after __pn (which is the last node in
@@ -1774,746 +1409,601 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_insert_multi_prepare(
// all we need to do is update the bucket and size(). Assumes that __cp->__hash
// is up-to-date.
template <class _Tp, class _Hash, class _Equal, class _Alloc>
-void
-__hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_insert_multi_perform(
- __node_pointer __cp, __next_pointer __pn) _NOEXCEPT
-{
- size_type __bc = bucket_count();
- size_t __chash = std::__constrain_hash(__cp->__hash_, __bc);
- if (__pn == nullptr)
- {
- __pn =__p1_.first().__ptr();
- __cp->__next_ = __pn->__next_;
- __pn->__next_ = __cp->__ptr();
- // fix up __bucket_list_
- __bucket_list_[__chash] = __pn;
- if (__cp->__next_ != nullptr)
- __bucket_list_[std::__constrain_hash(__cp->__next_->__hash(), __bc)]
- = __cp->__ptr();
- }
- else
- {
- __cp->__next_ = __pn->__next_;
- __pn->__next_ = __cp->__ptr();
- if (__cp->__next_ != nullptr)
- {
- size_t __nhash = std::__constrain_hash(__cp->__next_->__hash(), __bc);
- if (__nhash != __chash)
- __bucket_list_[__nhash] = __cp->__ptr();
- }
+void __hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_insert_multi_perform(
+ __node_pointer __cp, __next_pointer __pn) _NOEXCEPT {
+ size_type __bc = bucket_count();
+ size_t __chash = std::__constrain_hash(__cp->__hash_, __bc);
+ if (__pn == nullptr) {
+ __pn = __p1_.first().__ptr();
+ __cp->__next_ = __pn->__next_;
+ __pn->__next_ = __cp->__ptr();
+ // fix up __bucket_list_
+ __bucket_list_[__chash] = __pn;
+ if (__cp->__next_ != nullptr)
+ __bucket_list_[std::__constrain_hash(__cp->__next_->__hash(), __bc)] = __cp->__ptr();
+ } else {
+ __cp->__next_ = __pn->__next_;
+ __pn->__next_ = __cp->__ptr();
+ if (__cp->__next_ != nullptr) {
+ size_t __nhash = std::__constrain_hash(__cp->__next_->__hash(), __bc);
+ if (__nhash != __chash)
+ __bucket_list_[__nhash] = __cp->__ptr();
}
- ++size();
+ }
+ ++size();
}
-
template <class _Tp, class _Hash, class _Equal, class _Alloc>
typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::iterator
-__hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_insert_multi(__node_pointer __cp)
-{
- __cp->__hash_ = hash_function()(__cp->__get_value());
- __next_pointer __pn = __node_insert_multi_prepare(__cp->__hash(), __cp->__get_value());
- __node_insert_multi_perform(__cp, __pn);
+__hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_insert_multi(__node_pointer __cp) {
+ __cp->__hash_ = hash_function()(__cp->__get_value());
+ __next_pointer __pn = __node_insert_multi_prepare(__cp->__hash(), __cp->__get_value());
+ __node_insert_multi_perform(__cp, __pn);
- return iterator(__cp->__ptr());
+ return iterator(__cp->__ptr());
}
template <class _Tp, class _Hash, class _Equal, class _Alloc>
typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::iterator
-__hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_insert_multi(
- const_iterator __p, __node_pointer __cp)
-{
- if (__p != end() && key_eq()(*__p, __cp->__get_value()))
- {
- __next_pointer __np = __p.__node_;
- __cp->__hash_ = __np->__hash();
- size_type __bc = bucket_count();
- if (size()+1 > __bc * max_load_factor() || __bc == 0)
- {
- __rehash_multi(std::max<size_type>(2 * __bc + !std::__is_hash_power2(__bc),
- size_type(std::ceil(float(size() + 1) / max_load_factor()))));
- __bc = bucket_count();
- }
- size_t __chash = std::__constrain_hash(__cp->__hash_, __bc);
- __next_pointer __pp = __bucket_list_[__chash];
- while (__pp->__next_ != __np)
- __pp = __pp->__next_;
- __cp->__next_ = __np;
- __pp->__next_ = static_cast<__next_pointer>(__cp);
- ++size();
- return iterator(static_cast<__next_pointer>(__cp));
- }
- return __node_insert_multi(__cp);
+__hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_insert_multi(const_iterator __p, __node_pointer __cp) {
+ if (__p != end() && key_eq()(*__p, __cp->__get_value())) {
+ __next_pointer __np = __p.__node_;
+ __cp->__hash_ = __np->__hash();
+ size_type __bc = bucket_count();
+ if (size() + 1 > __bc * max_load_factor() || __bc == 0) {
+ __rehash_multi(std::max<size_type>(
+ 2 * __bc + !std::__is_hash_power2(__bc), size_type(std::ceil(float(size() + 1) / max_load_factor()))));
+ __bc = bucket_count();
+ }
+ size_t __chash = std::__constrain_hash(__cp->__hash_, __bc);
+ __next_pointer __pp = __bucket_list_[__chash];
+ while (__pp->__next_ != __np)
+ __pp = __pp->__next_;
+ __cp->__next_ = __np;
+ __pp->__next_ = static_cast<__next_pointer>(__cp);
+ ++size();
+ return iterator(static_cast<__next_pointer>(__cp));
+ }
+ return __node_insert_multi(__cp);
}
-
-
template <class _Tp, class _Hash, class _Equal, class _Alloc>
-template <class _Key, class ..._Args>
+template <class _Key, class... _Args>
pair<typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::iterator, bool>
-__hash_table<_Tp, _Hash, _Equal, _Alloc>::__emplace_unique_key_args(_Key const& __k, _Args&&... __args)
-{
-
- size_t __hash = hash_function()(__k);
- size_type __bc = bucket_count();
- bool __inserted = false;
- __next_pointer __nd;
- size_t __chash;
- if (__bc != 0)
- {
- __chash = std::__constrain_hash(__hash, __bc);
- __nd = __bucket_list_[__chash];
- if (__nd != nullptr)
- {
- for (__nd = __nd->__next_; __nd != nullptr &&
- (__nd->__hash() == __hash || std::__constrain_hash(__nd->__hash(), __bc) == __chash);
- __nd = __nd->__next_)
- {
- if ((__nd->__hash() == __hash) &&
- key_eq()(__nd->__upcast()->__get_value(), __k))
- goto __done;
- }
- }
+__hash_table<_Tp, _Hash, _Equal, _Alloc>::__emplace_unique_key_args(_Key const& __k, _Args&&... __args) {
+ size_t __hash = hash_function()(__k);
+ size_type __bc = bucket_count();
+ bool __inserted = false;
+ __next_pointer __nd;
+ size_t __chash;
+ if (__bc != 0) {
+ __chash = std::__constrain_hash(__hash, __bc);
+ __nd = __bucket_list_[__chash];
+ if (__nd != nullptr) {
+ for (__nd = __nd->__next_;
+ __nd != nullptr && (__nd->__hash() == __hash || std::__constrain_hash(__nd->__hash(), __bc) == __chash);
+ __nd = __nd->__next_) {
+ if ((__nd->__hash() == __hash) && key_eq()(__nd->__upcast()->__get_value(), __k))
+ goto __done;
+ }
}
- {
- __node_holder __h = __construct_node_hash(__hash, std::forward<_Args>(__args)...);
- if (size()+1 > __bc * max_load_factor() || __bc == 0)
- {
- __rehash_unique(std::max<size_type>(2 * __bc + !std::__is_hash_power2(__bc),
- size_type(std::ceil(float(size() + 1) / max_load_factor()))));
- __bc = bucket_count();
- __chash = std::__constrain_hash(__hash, __bc);
- }
- // insert_after __bucket_list_[__chash], or __first_node if bucket is null
- __next_pointer __pn = __bucket_list_[__chash];
- if (__pn == nullptr)
- {
- __pn = __p1_.first().__ptr();
- __h->__next_ = __pn->__next_;
- __pn->__next_ = __h.get()->__ptr();
- // fix up __bucket_list_
- __bucket_list_[__chash] = __pn;
- if (__h->__next_ != nullptr)
- __bucket_list_[std::__constrain_hash(__h->__next_->__hash(), __bc)]
- = __h.get()->__ptr();
- }
- else
- {
- __h->__next_ = __pn->__next_;
- __pn->__next_ = static_cast<__next_pointer>(__h.get());
- }
- __nd = static_cast<__next_pointer>(__h.release());
- // increment size
- ++size();
- __inserted = true;
+ }
+ {
+ __node_holder __h = __construct_node_hash(__hash, std::forward<_Args>(__args)...);
+ if (size() + 1 > __bc * max_load_factor() || __bc == 0) {
+ __rehash_unique(std::max<size_type>(
+ 2 * __bc + !std::__is_hash_power2(__bc), size_type(std::ceil(float(size() + 1) / max_load_factor()))));
+ __bc = bucket_count();
+ __chash = std::__constrain_hash(__hash, __bc);
}
+ // insert_after __bucket_list_[__chash], or __first_node if bucket is null
+ __next_pointer __pn = __bucket_list_[__chash];
+ if (__pn == nullptr) {
+ __pn = __p1_.first().__ptr();
+ __h->__next_ = __pn->__next_;
+ __pn->__next_ = __h.get()->__ptr();
+ // fix up __bucket_list_
+ __bucket_list_[__chash] = __pn;
+ if (__h->__next_ != nullptr)
+ __bucket_list_[std::__constrain_hash(__h->__next_->__hash(), __bc)] = __h.get()->__ptr();
+ } else {
+ __h->__next_ = __pn->__next_;
+ __pn->__next_ = static_cast<__next_pointer>(__h.get());
+ }
+ __nd = static_cast<__next_pointer>(__h.release());
+ // increment size
+ ++size();
+ __inserted = true;
+ }
__done:
- return pair<iterator, bool>(iterator(__nd), __inserted);
+ return pair<iterator, bool>(iterator(__nd), __inserted);
}
template <class _Tp, class _Hash, class _Equal, class _Alloc>
template <class... _Args>
pair<typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::iterator, bool>
-__hash_table<_Tp, _Hash, _Equal, _Alloc>::__emplace_unique_impl(_Args&&... __args)
-{
- __node_holder __h = __construct_node(std::forward<_Args>(__args)...);
- pair<iterator, bool> __r = __node_insert_unique(__h.get());
- if (__r.second)
- __h.release();
- return __r;
+__hash_table<_Tp, _Hash, _Equal, _Alloc>::__emplace_unique_impl(_Args&&... __args) {
+ __node_holder __h = __construct_node(std::forward<_Args>(__args)...);
+ pair<iterator, bool> __r = __node_insert_unique(__h.get());
+ if (__r.second)
+ __h.release();
+ return __r;
}
template <class _Tp, class _Hash, class _Equal, class _Alloc>
template <class... _Args>
typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::iterator
-__hash_table<_Tp, _Hash, _Equal, _Alloc>::__emplace_multi(_Args&&... __args)
-{
- __node_holder __h = __construct_node(std::forward<_Args>(__args)...);
- iterator __r = __node_insert_multi(__h.get());
- __h.release();
- return __r;
+__hash_table<_Tp, _Hash, _Equal, _Alloc>::__emplace_multi(_Args&&... __args) {
+ __node_holder __h = __construct_node(std::forward<_Args>(__args)...);
+ iterator __r = __node_insert_multi(__h.get());
+ __h.release();
+ return __r;
}
template <class _Tp, class _Hash, class _Equal, class _Alloc>
template <class... _Args>
typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::iterator
-__hash_table<_Tp, _Hash, _Equal, _Alloc>::__emplace_hint_multi(
- const_iterator __p, _Args&&... __args)
-{
- __node_holder __h = __construct_node(std::forward<_Args>(__args)...);
- iterator __r = __node_insert_multi(__p, __h.get());
- __h.release();
- return __r;
+__hash_table<_Tp, _Hash, _Equal, _Alloc>::__emplace_hint_multi(const_iterator __p, _Args&&... __args) {
+ __node_holder __h = __construct_node(std::forward<_Args>(__args)...);
+ iterator __r = __node_insert_multi(__p, __h.get());
+ __h.release();
+ return __r;
}
#if _LIBCPP_STD_VER >= 17
template <class _Tp, class _Hash, class _Equal, class _Alloc>
template <class _NodeHandle, class _InsertReturnType>
-_LIBCPP_HIDE_FROM_ABI
-_InsertReturnType
-__hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_handle_insert_unique(
- _NodeHandle&& __nh)
-{
- if (__nh.empty())
- return _InsertReturnType{end(), false, _NodeHandle()};
- pair<iterator, bool> __result = __node_insert_unique(__nh.__ptr_);
- if (__result.second)
- __nh.__release_ptr();
- return _InsertReturnType{__result.first, __result.second, std::move(__nh)};
+_LIBCPP_HIDE_FROM_ABI _InsertReturnType
+__hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_handle_insert_unique(_NodeHandle&& __nh) {
+ if (__nh.empty())
+ return _InsertReturnType{end(), false, _NodeHandle()};
+ pair<iterator, bool> __result = __node_insert_unique(__nh.__ptr_);
+ if (__result.second)
+ __nh.__release_ptr();
+ return _InsertReturnType{__result.first, __result.second, std::move(__nh)};
}
template <class _Tp, class _Hash, class _Equal, class _Alloc>
template <class _NodeHandle>
-_LIBCPP_HIDE_FROM_ABI
-typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::iterator
-__hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_handle_insert_unique(
- const_iterator, _NodeHandle&& __nh)
-{
- if (__nh.empty())
- return end();
- pair<iterator, bool> __result = __node_insert_unique(__nh.__ptr_);
- if (__result.second)
- __nh.__release_ptr();
- return __result.first;
+_LIBCPP_HIDE_FROM_ABI typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::iterator
+__hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_handle_insert_unique(const_iterator, _NodeHandle&& __nh) {
+ if (__nh.empty())
+ return end();
+ pair<iterator, bool> __result = __node_insert_unique(__nh.__ptr_);
+ if (__result.second)
+ __nh.__release_ptr();
+ return __result.first;
}
template <class _Tp, class _Hash, class _Equal, class _Alloc>
template <class _NodeHandle>
-_LIBCPP_HIDE_FROM_ABI
-_NodeHandle
-__hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_handle_extract(
- key_type const& __key)
-{
- iterator __i = find(__key);
- if (__i == end())
- return _NodeHandle();
- return __node_handle_extract<_NodeHandle>(__i);
+_LIBCPP_HIDE_FROM_ABI _NodeHandle
+__hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_handle_extract(key_type const& __key) {
+ iterator __i = find(__key);
+ if (__i == end())
+ return _NodeHandle();
+ return __node_handle_extract<_NodeHandle>(__i);
}
template <class _Tp, class _Hash, class _Equal, class _Alloc>
template <class _NodeHandle>
-_LIBCPP_HIDE_FROM_ABI
-_NodeHandle
-__hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_handle_extract(
- const_iterator __p)
-{
- allocator_type __alloc(__node_alloc());
- return _NodeHandle(remove(__p).release(), __alloc);
+_LIBCPP_HIDE_FROM_ABI _NodeHandle __hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_handle_extract(const_iterator __p) {
+ allocator_type __alloc(__node_alloc());
+ return _NodeHandle(remove(__p).release(), __alloc);
}
template <class _Tp, class _Hash, class _Equal, class _Alloc>
template <class _Table>
-_LIBCPP_HIDE_FROM_ABI
-void
-__hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_handle_merge_unique(
- _Table& __source)
-{
- static_assert(is_same<__node, typename _Table::__node>::value, "");
-
- for (typename _Table::iterator __it = __source.begin();
- __it != __source.end();)
- {
- __node_pointer __src_ptr = __it.__node_->__upcast();
- size_t __hash = hash_function()(__src_ptr->__get_value());
- __next_pointer __existing_node =
- __node_insert_unique_prepare(__hash, __src_ptr->__get_value());
- auto __prev_iter = __it++;
- if (__existing_node == nullptr)
- {
- (void)__source.remove(__prev_iter).release();
- __src_ptr->__hash_ = __hash;
- __node_insert_unique_perform(__src_ptr);
- }
+_LIBCPP_HIDE_FROM_ABI void __hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_handle_merge_unique(_Table& __source) {
+ static_assert(is_same<__node, typename _Table::__node>::value, "");
+
+ for (typename _Table::iterator __it = __source.begin(); __it != __source.end();) {
+ __node_pointer __src_ptr = __it.__node_->__upcast();
+ size_t __hash = hash_function()(__src_ptr->__get_value());
+ __next_pointer __existing_node = __node_insert_unique_prepare(__hash, __src_ptr->__get_value());
+ auto __prev_iter = __it++;
+ if (__existing_node == nullptr) {
+ (void)__source.remove(__prev_iter).release();
+ __src_ptr->__hash_ = __hash;
+ __node_insert_unique_perform(__src_ptr);
}
+ }
}
template <class _Tp, class _Hash, class _Equal, class _Alloc>
template <class _NodeHandle>
-_LIBCPP_HIDE_FROM_ABI
-typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::iterator
-__hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_handle_insert_multi(
- _NodeHandle&& __nh)
-{
- if (__nh.empty())
- return end();
- iterator __result = __node_insert_multi(__nh.__ptr_);
- __nh.__release_ptr();
- return __result;
+_LIBCPP_HIDE_FROM_ABI typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::iterator
+__hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_handle_insert_multi(_NodeHandle&& __nh) {
+ if (__nh.empty())
+ return end();
+ iterator __result = __node_insert_multi(__nh.__ptr_);
+ __nh.__release_ptr();
+ return __result;
}
template <class _Tp, class _Hash, class _Equal, class _Alloc>
template <class _NodeHandle>
-_LIBCPP_HIDE_FROM_ABI
-typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::iterator
-__hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_handle_insert_multi(
- const_iterator __hint, _NodeHandle&& __nh)
-{
- if (__nh.empty())
- return end();
- iterator __result = __node_insert_multi(__hint, __nh.__ptr_);
- __nh.__release_ptr();
- return __result;
+_LIBCPP_HIDE_FROM_ABI typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::iterator
+__hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_handle_insert_multi(const_iterator __hint, _NodeHandle&& __nh) {
+ if (__nh.empty())
+ return end();
+ iterator __result = __node_insert_multi(__hint, __nh.__ptr_);
+ __nh.__release_ptr();
+ return __result;
}
template <class _Tp, class _Hash, class _Equal, class _Alloc>
template <class _Table>
-_LIBCPP_HIDE_FROM_ABI
-void
-__hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_handle_merge_multi(
- _Table& __source)
-{
- static_assert(is_same<typename _Table::__node, __node>::value, "");
-
- for (typename _Table::iterator __it = __source.begin();
- __it != __source.end();)
- {
- __node_pointer __src_ptr = __it.__node_->__upcast();
- size_t __src_hash = hash_function()(__src_ptr->__get_value());
- __next_pointer __pn =
- __node_insert_multi_prepare(__src_hash, __src_ptr->__get_value());
- (void)__source.remove(__it++).release();
- __src_ptr->__hash_ = __src_hash;
- __node_insert_multi_perform(__src_ptr, __pn);
- }
+_LIBCPP_HIDE_FROM_ABI void __hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_handle_merge_multi(_Table& __source) {
+ static_assert(is_same<typename _Table::__node, __node>::value, "");
+
+ for (typename _Table::iterator __it = __source.begin(); __it != __source.end();) {
+ __node_pointer __src_ptr = __it.__node_->__upcast();
+ size_t __src_hash = hash_function()(__src_ptr->__get_value());
+ __next_pointer __pn = __node_insert_multi_prepare(__src_hash, __src_ptr->__get_value());
+ (void)__source.remove(__it++).release();
+ __src_ptr->__hash_ = __src_hash;
+ __node_insert_multi_perform(__src_ptr, __pn);
+ }
}
#endif // _LIBCPP_STD_VER >= 17
template <class _Tp, class _Hash, class _Equal, class _Alloc>
template <bool _UniqueKeys>
-void
-__hash_table<_Tp, _Hash, _Equal, _Alloc>::__rehash(size_type __n)
-_LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK
-{
- if (__n == 1)
- __n = 2;
- else if (__n & (__n - 1))
- __n = std::__next_prime(__n);
- size_type __bc = bucket_count();
- if (__n > __bc)
- __do_rehash<_UniqueKeys>(__n);
- else if (__n < __bc)
- {
- __n = std::max<size_type>
- (
- __n,
- std::__is_hash_power2(__bc) ? std::__next_hash_pow2(size_t(std::ceil(float(size()) / max_load_factor()))) :
- std::__next_prime(size_t(std::ceil(float(size()) / max_load_factor())))
- );
- if (__n < __bc)
- __do_rehash<_UniqueKeys>(__n);
- }
+void __hash_table<_Tp, _Hash, _Equal, _Alloc>::__rehash(size_type __n) _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK {
+ if (__n == 1)
+ __n = 2;
+ else if (__n & (__n - 1))
+ __n = std::__next_prime(__n);
+ size_type __bc = bucket_count();
+ if (__n > __bc)
+ __do_rehash<_UniqueKeys>(__n);
+ else if (__n < __bc) {
+ __n = std::max<size_type>(
+ __n,
+ std::__is_hash_power2(__bc) ? std::__next_hash_pow2(size_t(std::ceil(float(size()) / max_load_factor())))
+ : std::__next_prime(size_t(std::ceil(float(size()) / max_load_factor()))));
+ if (__n < __bc)
+ __do_rehash<_UniqueKeys>(__n);
+ }
}
template <class _Tp, class _Hash, class _Equal, class _Alloc>
template <bool _UniqueKeys>
-void
-__hash_table<_Tp, _Hash, _Equal, _Alloc>::__do_rehash(size_type __nbc)
-{
- __pointer_allocator& __npa = __bucket_list_.get_deleter().__alloc();
- __bucket_list_.reset(__nbc > 0 ?
- __pointer_alloc_traits::allocate(__npa, __nbc) : nullptr);
- __bucket_list_.get_deleter().size() = __nbc;
- if (__nbc > 0)
- {
- for (size_type __i = 0; __i < __nbc; ++__i)
- __bucket_list_[__i] = nullptr;
- __next_pointer __pp = __p1_.first().__ptr();
- __next_pointer __cp = __pp->__next_;
- if (__cp != nullptr)
- {
- size_type __chash = std::__constrain_hash(__cp->__hash(), __nbc);
+void __hash_table<_Tp, _Hash, _Equal, _Alloc>::__do_rehash(size_type __nbc) {
+ __pointer_allocator& __npa = __bucket_list_.get_deleter().__alloc();
+ __bucket_list_.reset(__nbc > 0 ? __pointer_alloc_traits::allocate(__npa, __nbc) : nullptr);
+ __bucket_list_.get_deleter().size() = __nbc;
+ if (__nbc > 0) {
+ for (size_type __i = 0; __i < __nbc; ++__i)
+ __bucket_list_[__i] = nullptr;
+ __next_pointer __pp = __p1_.first().__ptr();
+ __next_pointer __cp = __pp->__next_;
+ if (__cp != nullptr) {
+ size_type __chash = std::__constrain_hash(__cp->__hash(), __nbc);
+ __bucket_list_[__chash] = __pp;
+ size_type __phash = __chash;
+ for (__pp = __cp, void(), __cp = __cp->__next_; __cp != nullptr; __cp = __pp->__next_) {
+ __chash = std::__constrain_hash(__cp->__hash(), __nbc);
+ if (__chash == __phash)
+ __pp = __cp;
+ else {
+ if (__bucket_list_[__chash] == nullptr) {
__bucket_list_[__chash] = __pp;
- size_type __phash = __chash;
- for (__pp = __cp, void(), __cp = __cp->__next_; __cp != nullptr;
- __cp = __pp->__next_)
- {
- __chash = std::__constrain_hash(__cp->__hash(), __nbc);
- if (__chash == __phash)
- __pp = __cp;
- else
- {
- if (__bucket_list_[__chash] == nullptr)
- {
- __bucket_list_[__chash] = __pp;
- __pp = __cp;
- __phash = __chash;
- }
- else
- {
- __next_pointer __np = __cp;
- if _LIBCPP_CONSTEXPR_SINCE_CXX17 (!_UniqueKeys)
- {
- for (; __np->__next_ != nullptr &&
- key_eq()(__cp->__upcast()->__get_value(),
- __np->__next_->__upcast()->__get_value());
- __np = __np->__next_)
- ;
- }
- __pp->__next_ = __np->__next_;
- __np->__next_ = __bucket_list_[__chash]->__next_;
- __bucket_list_[__chash]->__next_ = __cp;
-
- }
- }
+ __pp = __cp;
+ __phash = __chash;
+ } else {
+ __next_pointer __np = __cp;
+ if _LIBCPP_CONSTEXPR_SINCE_CXX17 (!_UniqueKeys) {
+ for (; __np->__next_ != nullptr &&
+ key_eq()(__cp->__upcast()->__get_value(), __np->__next_->__upcast()->__get_value());
+ __np = __np->__next_)
+ ;
}
+ __pp->__next_ = __np->__next_;
+ __np->__next_ = __bucket_list_[__chash]->__next_;
+ __bucket_list_[__chash]->__next_ = __cp;
+ }
}
+ }
}
+ }
}
template <class _Tp, class _Hash, class _Equal, class _Alloc>
template <class _Key>
typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::iterator
-__hash_table<_Tp, _Hash, _Equal, _Alloc>::find(const _Key& __k)
-{
- size_t __hash = hash_function()(__k);
- size_type __bc = bucket_count();
- if (__bc != 0)
- {
- size_t __chash = std::__constrain_hash(__hash, __bc);
- __next_pointer __nd = __bucket_list_[__chash];
- if (__nd != nullptr)
- {
- for (__nd = __nd->__next_; __nd != nullptr &&
- (__nd->__hash() == __hash
- || std::__constrain_hash(__nd->__hash(), __bc) == __chash);
- __nd = __nd->__next_)
- {
- if ((__nd->__hash() == __hash)
- && key_eq()(__nd->__upcast()->__get_value(), __k))
- return iterator(__nd);
- }
- }
+__hash_table<_Tp, _Hash, _Equal, _Alloc>::find(const _Key& __k) {
+ size_t __hash = hash_function()(__k);
+ size_type __bc = bucket_count();
+ if (__bc != 0) {
+ size_t __chash = std::__constrain_hash(__hash, __bc);
+ __next_pointer __nd = __bucket_list_[__chash];
+ if (__nd != nullptr) {
+ for (__nd = __nd->__next_;
+ __nd != nullptr && (__nd->__hash() == __hash || std::__constrain_hash(__nd->__hash(), __bc) == __chash);
+ __nd = __nd->__next_) {
+ if ((__nd->__hash() == __hash) && key_eq()(__nd->__upcast()->__get_value(), __k))
+ return iterator(__nd);
+ }
}
- return end();
+ }
+ return end();
}
template <class _Tp, class _Hash, class _Equal, class _Alloc>
template <class _Key>
typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::const_iterator
-__hash_table<_Tp, _Hash, _Equal, _Alloc>::find(const _Key& __k) const
-{
- size_t __hash = hash_function()(__k);
- size_type __bc = bucket_count();
- if (__bc != 0)
- {
- size_t __chash = std::__constrain_hash(__hash, __bc);
- __next_pointer __nd = __bucket_list_[__chash];
- if (__nd != nullptr)
- {
- for (__nd = __nd->__next_; __nd != nullptr &&
- (__hash == __nd->__hash()
- || std::__constrain_hash(__nd->__hash(), __bc) == __chash);
- __nd = __nd->__next_)
- {
- if ((__nd->__hash() == __hash)
- && key_eq()(__nd->__upcast()->__get_value(), __k))
- return const_iterator(__nd);
- }
- }
-
+__hash_table<_Tp, _Hash, _Equal, _Alloc>::find(const _Key& __k) const {
+ size_t __hash = hash_function()(__k);
+ size_type __bc = bucket_count();
+ if (__bc != 0) {
+ size_t __chash = std::__constrain_hash(__hash, __bc);
+ __next_pointer __nd = __bucket_list_[__chash];
+ if (__nd != nullptr) {
+ for (__nd = __nd->__next_;
+ __nd != nullptr && (__hash == __nd->__hash() || std::__constrain_hash(__nd->__hash(), __bc) == __chash);
+ __nd = __nd->__next_) {
+ if ((__nd->__hash() == __hash) && key_eq()(__nd->__upcast()->__get_value(), __k))
+ return const_iterator(__nd);
+ }
}
- return end();
+ }
+ return end();
}
template <class _Tp, class _Hash, class _Equal, class _Alloc>
-template <class ..._Args>
+template <class... _Args>
typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_holder
-__hash_table<_Tp, _Hash, _Equal, _Alloc>::__construct_node(_Args&& ...__args)
-{
- static_assert(!__is_hash_value_type<_Args...>::value,
- "Construct cannot be called with a hash value type");
- __node_allocator& __na = __node_alloc();
- __node_holder __h(__node_traits::allocate(__na, 1), _Dp(__na));
-
- // Begin the lifetime of the node itself. Note that this doesn't begin the lifetime of the value
- // held inside the node, since we need to use the allocator's construct() method for that.
- //
- // We don't use the allocator's construct() method to construct the node itself since the
- // Cpp17FooInsertable named requirements don't require the allocator's construct() method
- // to work on anything other than the value_type.
- std::__construct_at(std::addressof(*__h), /* next = */nullptr, /* hash = */0);
-
- // Now construct the value_type using the allocator's construct() method.
- __node_traits::construct(__na, _NodeTypes::__get_ptr(__h->__get_value()), std::forward<_Args>(__args)...);
- __h.get_deleter().__value_constructed = true;
-
- __h->__hash_ = hash_function()(__h->__get_value());
- return __h;
+__hash_table<_Tp, _Hash, _Equal, _Alloc>::__construct_node(_Args&&... __args) {
+ static_assert(!__is_hash_value_type<_Args...>::value, "Construct cannot be called with a hash value type");
+ __node_allocator& __na = __node_alloc();
+ __node_holder __h(__node_traits::allocate(__na, 1), _Dp(__na));
+
+ // Begin the lifetime of the node itself. Note that this doesn't begin the lifetime of the value
+ // held inside the node, since we need to use the allocator's construct() method for that.
+ //
+ // We don't use the allocator's construct() method to construct the node itself since the
+ // Cpp17FooInsertable named requirements don't require the allocator's construct() method
+ // to work on anything other than the value_type.
+ std::__construct_at(std::addressof(*__h), /* next = */ nullptr, /* hash = */ 0);
+
+ // Now construct the value_type using the allocator's construct() method.
+ __node_traits::construct(__na, _NodeTypes::__get_ptr(__h->__get_value()), std::forward<_Args>(__args)...);
+ __h.get_deleter().__value_constructed = true;
+
+ __h->__hash_ = hash_function()(__h->__get_value());
+ return __h;
}
template <class _Tp, class _Hash, class _Equal, class _Alloc>
-template <class _First, class ..._Rest>
+template <class _First, class... _Rest>
typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_holder
-__hash_table<_Tp, _Hash, _Equal, _Alloc>::__construct_node_hash(
- size_t __hash, _First&& __f, _Rest&& ...__rest)
-{
- static_assert(!__is_hash_value_type<_First, _Rest...>::value,
- "Construct cannot be called with a hash value type");
- __node_allocator& __na = __node_alloc();
- __node_holder __h(__node_traits::allocate(__na, 1), _Dp(__na));
- std::__construct_at(std::addressof(*__h), /* next = */nullptr, /* hash = */__hash);
- __node_traits::construct(__na, _NodeTypes::__get_ptr(__h->__get_value()),
- std::forward<_First>(__f),
- std::forward<_Rest>(__rest)...);
- __h.get_deleter().__value_constructed = true;
- return __h;
+__hash_table<_Tp, _Hash, _Equal, _Alloc>::__construct_node_hash(size_t __hash, _First&& __f, _Rest&&... __rest) {
+ static_assert(!__is_hash_value_type<_First, _Rest...>::value, "Construct cannot be called with a hash value type");
+ __node_allocator& __na = __node_alloc();
+ __node_holder __h(__node_traits::allocate(__na, 1), _Dp(__na));
+ std::__construct_at(std::addressof(*__h), /* next = */ nullptr, /* hash = */ __hash);
+ __node_traits::construct(
+ __na, _NodeTypes::__get_ptr(__h->__get_value()), std::forward<_First>(__f), std::forward<_Rest>(__rest)...);
+ __h.get_deleter().__value_constructed = true;
+ return __h;
}
template <class _Tp, class _Hash, class _Equal, class _Alloc>
typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::iterator
-__hash_table<_Tp, _Hash, _Equal, _Alloc>::erase(const_iterator __p)
-{
- __next_pointer __np = __p.__node_;
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__p != end(),
- "unordered container::erase(iterator) called with a non-dereferenceable iterator");
- iterator __r(__np);
- ++__r;
- remove(__p);
- return __r;
+__hash_table<_Tp, _Hash, _Equal, _Alloc>::erase(const_iterator __p) {
+ __next_pointer __np = __p.__node_;
+ _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
+ __p != end(), "unordered container::erase(iterator) called with a non-dereferenceable iterator");
+ iterator __r(__np);
+ ++__r;
+ remove(__p);
+ return __r;
}
template <class _Tp, class _Hash, class _Equal, class _Alloc>
typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::iterator
-__hash_table<_Tp, _Hash, _Equal, _Alloc>::erase(const_iterator __first,
- const_iterator __last)
-{
- for (const_iterator __p = __first; __first != __last; __p = __first)
- {
- ++__first;
- erase(__p);
- }
- __next_pointer __np = __last.__node_;
- return iterator (__np);
+__hash_table<_Tp, _Hash, _Equal, _Alloc>::erase(const_iterator __first, const_iterator __last) {
+ for (const_iterator __p = __first; __first != __last; __p = __first) {
+ ++__first;
+ erase(__p);
+ }
+ __next_pointer __np = __last.__node_;
+ return iterator(__np);
}
template <class _Tp, class _Hash, class _Equal, class _Alloc>
template <class _Key>
typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::size_type
-__hash_table<_Tp, _Hash, _Equal, _Alloc>::__erase_unique(const _Key& __k)
-{
- iterator __i = find(__k);
- if (__i == end())
- return 0;
- erase(__i);
- return 1;
+__hash_table<_Tp, _Hash, _Equal, _Alloc>::__erase_unique(const _Key& __k) {
+ iterator __i = find(__k);
+ if (__i == end())
+ return 0;
+ erase(__i);
+ return 1;
}
template <class _Tp, class _Hash, class _Equal, class _Alloc>
template <class _Key>
typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::size_type
-__hash_table<_Tp, _Hash, _Equal, _Alloc>::__erase_multi(const _Key& __k)
-{
- size_type __r = 0;
- iterator __i = find(__k);
- if (__i != end())
- {
- iterator __e = end();
- do
- {
- erase(__i++);
- ++__r;
- } while (__i != __e && key_eq()(*__i, __k));
- }
- return __r;
+__hash_table<_Tp, _Hash, _Equal, _Alloc>::__erase_multi(const _Key& __k) {
+ size_type __r = 0;
+ iterator __i = find(__k);
+ if (__i != end()) {
+ iterator __e = end();
+ do {
+ erase(__i++);
+ ++__r;
+ } while (__i != __e && key_eq()(*__i, __k));
+ }
+ return __r;
}
template <class _Tp, class _Hash, class _Equal, class _Alloc>
typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_holder
-__hash_table<_Tp, _Hash, _Equal, _Alloc>::remove(const_iterator __p) _NOEXCEPT
-{
- // current node
- __next_pointer __cn = __p.__node_;
- size_type __bc = bucket_count();
- size_t __chash = std::__constrain_hash(__cn->__hash(), __bc);
- // find previous node
- __next_pointer __pn = __bucket_list_[__chash];
- for (; __pn->__next_ != __cn; __pn = __pn->__next_)
- ;
- // Fix up __bucket_list_
- // if __pn is not in same bucket (before begin is not in same bucket) &&
- // if __cn->__next_ is not in same bucket (nullptr is not in same bucket)
- if (__pn == __p1_.first().__ptr()
- || std::__constrain_hash(__pn->__hash(), __bc) != __chash)
- {
- if (__cn->__next_ == nullptr
- || std::__constrain_hash(__cn->__next_->__hash(), __bc) != __chash)
- __bucket_list_[__chash] = nullptr;
- }
- // if __cn->__next_ is not in same bucket (nullptr is in same bucket)
- if (__cn->__next_ != nullptr)
- {
- size_t __nhash = std::__constrain_hash(__cn->__next_->__hash(), __bc);
- if (__nhash != __chash)
- __bucket_list_[__nhash] = __pn;
- }
- // remove __cn
- __pn->__next_ = __cn->__next_;
- __cn->__next_ = nullptr;
- --size();
- return __node_holder(__cn->__upcast(), _Dp(__node_alloc(), true));
+__hash_table<_Tp, _Hash, _Equal, _Alloc>::remove(const_iterator __p) _NOEXCEPT {
+ // current node
+ __next_pointer __cn = __p.__node_;
+ size_type __bc = bucket_count();
+ size_t __chash = std::__constrain_hash(__cn->__hash(), __bc);
+ // find previous node
+ __next_pointer __pn = __bucket_list_[__chash];
+ for (; __pn->__next_ != __cn; __pn = __pn->__next_)
+ ;
+ // Fix up __bucket_list_
+ // if __pn is not in same bucket (before begin is not in same bucket) &&
+ // if __cn->__next_ is not in same bucket (nullptr is not in same bucket)
+ if (__pn == __p1_.first().__ptr() || std::__constrain_hash(__pn->__hash(), __bc) != __chash) {
+ if (__cn->__next_ == nullptr || std::__constrain_hash(__cn->__next_->__hash(), __bc) != __chash)
+ __bucket_list_[__chash] = nullptr;
+ }
+ // if __cn->__next_ is not in same bucket (nullptr is in same bucket)
+ if (__cn->__next_ != nullptr) {
+ size_t __nhash = std::__constrain_hash(__cn->__next_->__hash(), __bc);
+ if (__nhash != __chash)
+ __bucket_list_[__nhash] = __pn;
+ }
+ // remove __cn
+ __pn->__next_ = __cn->__next_;
+ __cn->__next_ = nullptr;
+ --size();
+ return __node_holder(__cn->__upcast(), _Dp(__node_alloc(), true));
}
template <class _Tp, class _Hash, class _Equal, class _Alloc>
template <class _Key>
-inline
-typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::size_type
-__hash_table<_Tp, _Hash, _Equal, _Alloc>::__count_unique(const _Key& __k) const
-{
- return static_cast<size_type>(find(__k) != end());
+inline typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::size_type
+__hash_table<_Tp, _Hash, _Equal, _Alloc>::__count_unique(const _Key& __k) const {
+ return static_cast<size_type>(find(__k) != end());
}
template <class _Tp, class _Hash, class _Equal, class _Alloc>
template <class _Key>
typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::size_type
-__hash_table<_Tp, _Hash, _Equal, _Alloc>::__count_multi(const _Key& __k) const
-{
- size_type __r = 0;
- const_iterator __i = find(__k);
- if (__i != end())
- {
- const_iterator __e = end();
- do
- {
- ++__i;
- ++__r;
- } while (__i != __e && key_eq()(*__i, __k));
- }
- return __r;
+__hash_table<_Tp, _Hash, _Equal, _Alloc>::__count_multi(const _Key& __k) const {
+ size_type __r = 0;
+ const_iterator __i = find(__k);
+ if (__i != end()) {
+ const_iterator __e = end();
+ do {
+ ++__i;
+ ++__r;
+ } while (__i != __e && key_eq()(*__i, __k));
+ }
+ return __r;
}
template <class _Tp, class _Hash, class _Equal, class _Alloc>
template <class _Key>
pair<typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::iterator,
typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::iterator>
-__hash_table<_Tp, _Hash, _Equal, _Alloc>::__equal_range_unique(
- const _Key& __k)
-{
- iterator __i = find(__k);
- iterator __j = __i;
- if (__i != end())
- ++__j;
- return pair<iterator, iterator>(__i, __j);
+__hash_table<_Tp, _Hash, _Equal, _Alloc>::__equal_range_unique(const _Key& __k) {
+ iterator __i = find(__k);
+ iterator __j = __i;
+ if (__i != end())
+ ++__j;
+ return pair<iterator, iterator>(__i, __j);
}
template <class _Tp, class _Hash, class _Equal, class _Alloc>
template <class _Key>
pair<typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::const_iterator,
typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::const_iterator>
-__hash_table<_Tp, _Hash, _Equal, _Alloc>::__equal_range_unique(
- const _Key& __k) const
-{
- const_iterator __i = find(__k);
- const_iterator __j = __i;
- if (__i != end())
- ++__j;
- return pair<const_iterator, const_iterator>(__i, __j);
+__hash_table<_Tp, _Hash, _Equal, _Alloc>::__equal_range_unique(const _Key& __k) const {
+ const_iterator __i = find(__k);
+ const_iterator __j = __i;
+ if (__i != end())
+ ++__j;
+ return pair<const_iterator, const_iterator>(__i, __j);
}
template <class _Tp, class _Hash, class _Equal, class _Alloc>
template <class _Key>
pair<typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::iterator,
typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::iterator>
-__hash_table<_Tp, _Hash, _Equal, _Alloc>::__equal_range_multi(
- const _Key& __k)
-{
- iterator __i = find(__k);
- iterator __j = __i;
- if (__i != end())
- {
- iterator __e = end();
- do
- {
- ++__j;
- } while (__j != __e && key_eq()(*__j, __k));
- }
- return pair<iterator, iterator>(__i, __j);
+__hash_table<_Tp, _Hash, _Equal, _Alloc>::__equal_range_multi(const _Key& __k) {
+ iterator __i = find(__k);
+ iterator __j = __i;
+ if (__i != end()) {
+ iterator __e = end();
+ do {
+ ++__j;
+ } while (__j != __e && key_eq()(*__j, __k));
+ }
+ return pair<iterator, iterator>(__i, __j);
}
template <class _Tp, class _Hash, class _Equal, class _Alloc>
template <class _Key>
pair<typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::const_iterator,
typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::const_iterator>
-__hash_table<_Tp, _Hash, _Equal, _Alloc>::__equal_range_multi(
- const _Key& __k) const
-{
- const_iterator __i = find(__k);
- const_iterator __j = __i;
- if (__i != end())
- {
- const_iterator __e = end();
- do
- {
- ++__j;
- } while (__j != __e && key_eq()(*__j, __k));
- }
- return pair<const_iterator, const_iterator>(__i, __j);
+__hash_table<_Tp, _Hash, _Equal, _Alloc>::__equal_range_multi(const _Key& __k) const {
+ const_iterator __i = find(__k);
+ const_iterator __j = __i;
+ if (__i != end()) {
+ const_iterator __e = end();
+ do {
+ ++__j;
+ } while (__j != __e && key_eq()(*__j, __k));
+ }
+ return pair<const_iterator, const_iterator>(__i, __j);
}
template <class _Tp, class _Hash, class _Equal, class _Alloc>
-void
-__hash_table<_Tp, _Hash, _Equal, _Alloc>::swap(__hash_table& __u)
+void __hash_table<_Tp, _Hash, _Equal, _Alloc>::swap(__hash_table& __u)
#if _LIBCPP_STD_VER <= 11
- _NOEXCEPT_(
- __is_nothrow_swappable<hasher>::value && __is_nothrow_swappable<key_equal>::value
- && (!allocator_traits<__pointer_allocator>::propagate_on_container_swap::value
- || __is_nothrow_swappable<__pointer_allocator>::value)
- && (!__node_traits::propagate_on_container_swap::value
- || __is_nothrow_swappable<__node_allocator>::value)
- )
+ _NOEXCEPT_(__is_nothrow_swappable<hasher>::value&& __is_nothrow_swappable<key_equal>::value &&
+ (!allocator_traits<__pointer_allocator>::propagate_on_container_swap::value ||
+ __is_nothrow_swappable<__pointer_allocator>::value) &&
+ (!__node_traits::propagate_on_container_swap::value || __is_nothrow_swappable<__node_allocator>::value))
#else
- _NOEXCEPT_(__is_nothrow_swappable<hasher>::value && __is_nothrow_swappable<key_equal>::value)
+ _NOEXCEPT_(__is_nothrow_swappable<hasher>::value&& __is_nothrow_swappable<key_equal>::value)
#endif
{
- _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(__node_traits::propagate_on_container_swap::value ||
- this->__node_alloc() == __u.__node_alloc(),
- "unordered container::swap: Either propagate_on_container_swap "
- "must be true or the allocators must compare equal");
- {
+ _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(
+ __node_traits::propagate_on_container_swap::value || this->__node_alloc() == __u.__node_alloc(),
+ "unordered container::swap: Either propagate_on_container_swap "
+ "must be true or the allocators must compare equal");
+ {
__node_pointer_pointer __npp = __bucket_list_.release();
__bucket_list_.reset(__u.__bucket_list_.release());
__u.__bucket_list_.reset(__npp);
- }
- std::swap(__bucket_list_.get_deleter().size(), __u.__bucket_list_.get_deleter().size());
- std::__swap_allocator(__bucket_list_.get_deleter().__alloc(),
- __u.__bucket_list_.get_deleter().__alloc());
- std::__swap_allocator(__node_alloc(), __u.__node_alloc());
- std::swap(__p1_.first().__next_, __u.__p1_.first().__next_);
- __p2_.swap(__u.__p2_);
- __p3_.swap(__u.__p3_);
- if (size() > 0)
- __bucket_list_[std::__constrain_hash(__p1_.first().__next_->__hash(), bucket_count())] =
- __p1_.first().__ptr();
- if (__u.size() > 0)
- __u.__bucket_list_[std::__constrain_hash(__u.__p1_.first().__next_->__hash(), __u.bucket_count())] =
- __u.__p1_.first().__ptr();
+ }
+ std::swap(__bucket_list_.get_deleter().size(), __u.__bucket_list_.get_deleter().size());
+ std::__swap_allocator(__bucket_list_.get_deleter().__alloc(), __u.__bucket_list_.get_deleter().__alloc());
+ std::__swap_allocator(__node_alloc(), __u.__node_alloc());
+ std::swap(__p1_.first().__next_, __u.__p1_.first().__next_);
+ __p2_.swap(__u.__p2_);
+ __p3_.swap(__u.__p3_);
+ if (size() > 0)
+ __bucket_list_[std::__constrain_hash(__p1_.first().__next_->__hash(), bucket_count())] = __p1_.first().__ptr();
+ if (__u.size() > 0)
+ __u.__bucket_list_[std::__constrain_hash(__u.__p1_.first().__next_->__hash(), __u.bucket_count())] =
+ __u.__p1_.first().__ptr();
}
template <class _Tp, class _Hash, class _Equal, class _Alloc>
typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::size_type
-__hash_table<_Tp, _Hash, _Equal, _Alloc>::bucket_size(size_type __n) const
-{
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__n < bucket_count(),
- "unordered container::bucket_size(n) called with n >= bucket_count()");
- __next_pointer __np = __bucket_list_[__n];
- size_type __bc = bucket_count();
- size_type __r = 0;
- if (__np != nullptr)
- {
- for (__np = __np->__next_; __np != nullptr &&
- std::__constrain_hash(__np->__hash(), __bc) == __n;
- __np = __np->__next_, (void) ++__r)
- ;
- }
- return __r;
+__hash_table<_Tp, _Hash, _Equal, _Alloc>::bucket_size(size_type __n) const {
+ _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
+ __n < bucket_count(), "unordered container::bucket_size(n) called with n >= bucket_count()");
+ __next_pointer __np = __bucket_list_[__n];
+ size_type __bc = bucket_count();
+ size_type __r = 0;
+ if (__np != nullptr) {
+ for (__np = __np->__next_; __np != nullptr && std::__constrain_hash(__np->__hash(), __bc) == __n;
+ __np = __np->__next_, (void)++__r)
+ ;
+ }
+ return __r;
}
template <class _Tp, class _Hash, class _Equal, class _Alloc>
-inline _LIBCPP_HIDE_FROM_ABI
-void
-swap(__hash_table<_Tp, _Hash, _Equal, _Alloc>& __x,
- __hash_table<_Tp, _Hash, _Equal, _Alloc>& __y)
- _NOEXCEPT_(_NOEXCEPT_(__x.swap(__y)))
-{
- __x.swap(__y);
+inline _LIBCPP_HIDE_FROM_ABI void
+swap(__hash_table<_Tp, _Hash, _Equal, _Alloc>& __x, __hash_table<_Tp, _Hash, _Equal, _Alloc>& __y)
+ _NOEXCEPT_(_NOEXCEPT_(__x.swap(__y))) {
+ __x.swap(__y);
}
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__ios/fpos.h b/contrib/llvm-project/libcxx/include/__ios/fpos.h
index ae578bdbb916..1af1e23ee50d 100644
--- a/contrib/llvm-project/libcxx/include/__ios/fpos.h
+++ b/contrib/llvm-project/libcxx/include/__ios/fpos.h
@@ -57,20 +57,17 @@ public:
};
template <class _StateT>
-inline _LIBCPP_HIDE_FROM_ABI
-streamoff operator-(const fpos<_StateT>& __x, const fpos<_StateT>& __y) {
+inline _LIBCPP_HIDE_FROM_ABI streamoff operator-(const fpos<_StateT>& __x, const fpos<_StateT>& __y) {
return streamoff(__x) - streamoff(__y);
}
template <class _StateT>
-inline _LIBCPP_HIDE_FROM_ABI
-bool operator==(const fpos<_StateT>& __x, const fpos<_StateT>& __y) {
+inline _LIBCPP_HIDE_FROM_ABI bool operator==(const fpos<_StateT>& __x, const fpos<_StateT>& __y) {
return streamoff(__x) == streamoff(__y);
}
template <class _StateT>
-inline _LIBCPP_HIDE_FROM_ABI
-bool operator!=(const fpos<_StateT>& __x, const fpos<_StateT>& __y) {
+inline _LIBCPP_HIDE_FROM_ABI bool operator!=(const fpos<_StateT>& __x, const fpos<_StateT>& __y) {
return streamoff(__x) != streamoff(__y);
}
diff --git a/contrib/llvm-project/libcxx/include/__iterator/access.h b/contrib/llvm-project/libcxx/include/__iterator/access.h
index 3ab3955e12a5..5c6090eeb40c 100644
--- a/contrib/llvm-project/libcxx/include/__iterator/access.h
+++ b/contrib/llvm-project/libcxx/include/__iterator/access.h
@@ -32,85 +32,60 @@ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR _Tp* end(_Tp (&__array)[_Np]) _NOEXCEPT
#if !defined(_LIBCPP_CXX03_LANG)
template <class _Cp>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
-auto
-begin(_Cp& __c) -> decltype(__c.begin())
-{
- return __c.begin();
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 auto begin(_Cp& __c) -> decltype(__c.begin()) {
+ return __c.begin();
}
template <class _Cp>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
-auto
-begin(const _Cp& __c) -> decltype(__c.begin())
-{
- return __c.begin();
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 auto begin(const _Cp& __c) -> decltype(__c.begin()) {
+ return __c.begin();
}
template <class _Cp>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
-auto
-end(_Cp& __c) -> decltype(__c.end())
-{
- return __c.end();
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 auto end(_Cp& __c) -> decltype(__c.end()) {
+ return __c.end();
}
template <class _Cp>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
-auto
-end(const _Cp& __c) -> decltype(__c.end())
-{
- return __c.end();
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 auto end(const _Cp& __c) -> decltype(__c.end()) {
+ return __c.end();
}
-#if _LIBCPP_STD_VER >= 14
+# if _LIBCPP_STD_VER >= 14
template <class _Cp>
_LIBCPP_HIDE_FROM_ABI constexpr auto cbegin(const _Cp& __c) noexcept(noexcept(std::begin(__c)))
-> decltype(std::begin(__c)) {
- return std::begin(__c);
+ return std::begin(__c);
}
template <class _Cp>
_LIBCPP_HIDE_FROM_ABI constexpr auto cend(const _Cp& __c) noexcept(noexcept(std::end(__c))) -> decltype(std::end(__c)) {
- return std::end(__c);
+ return std::end(__c);
}
-#endif
-
+# endif
-#else // defined(_LIBCPP_CXX03_LANG)
+#else // defined(_LIBCPP_CXX03_LANG)
template <class _Cp>
-_LIBCPP_HIDE_FROM_ABI
-typename _Cp::iterator
-begin(_Cp& __c)
-{
- return __c.begin();
+_LIBCPP_HIDE_FROM_ABI typename _Cp::iterator begin(_Cp& __c) {
+ return __c.begin();
}
template <class _Cp>
-_LIBCPP_HIDE_FROM_ABI
-typename _Cp::const_iterator
-begin(const _Cp& __c)
-{
- return __c.begin();
+_LIBCPP_HIDE_FROM_ABI typename _Cp::const_iterator begin(const _Cp& __c) {
+ return __c.begin();
}
template <class _Cp>
-_LIBCPP_HIDE_FROM_ABI
-typename _Cp::iterator
-end(_Cp& __c)
-{
- return __c.end();
+_LIBCPP_HIDE_FROM_ABI typename _Cp::iterator end(_Cp& __c) {
+ return __c.end();
}
template <class _Cp>
-_LIBCPP_HIDE_FROM_ABI
-typename _Cp::const_iterator
-end(const _Cp& __c)
-{
- return __c.end();
+_LIBCPP_HIDE_FROM_ABI typename _Cp::const_iterator end(const _Cp& __c) {
+ return __c.end();
}
#endif // !defined(_LIBCPP_CXX03_LANG)
diff --git a/contrib/llvm-project/libcxx/include/__iterator/advance.h b/contrib/llvm-project/libcxx/include/__iterator/advance.h
index 76938970b0c3..64c8d249f78f 100644
--- a/contrib/llvm-project/libcxx/include/__iterator/advance.h
+++ b/contrib/llvm-project/libcxx/include/__iterator/advance.h
@@ -35,15 +35,15 @@ _LIBCPP_PUSH_MACROS
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _InputIter>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
-void __advance(_InputIter& __i, typename iterator_traits<_InputIter>::difference_type __n, input_iterator_tag) {
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 void
+__advance(_InputIter& __i, typename iterator_traits<_InputIter>::difference_type __n, input_iterator_tag) {
for (; __n > 0; --__n)
++__i;
}
template <class _BiDirIter>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
-void __advance(_BiDirIter& __i, typename iterator_traits<_BiDirIter>::difference_type __n, bidirectional_iterator_tag) {
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 void
+__advance(_BiDirIter& __i, typename iterator_traits<_BiDirIter>::difference_type __n, bidirectional_iterator_tag) {
if (__n >= 0)
for (; __n > 0; --__n)
++__i;
@@ -53,17 +53,16 @@ void __advance(_BiDirIter& __i, typename iterator_traits<_BiDirIter>::difference
}
template <class _RandIter>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
-void __advance(_RandIter& __i, typename iterator_traits<_RandIter>::difference_type __n, random_access_iterator_tag) {
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 void
+__advance(_RandIter& __i, typename iterator_traits<_RandIter>::difference_type __n, random_access_iterator_tag) {
__i += __n;
}
-template <
- class _InputIter, class _Distance,
- class _IntegralDistance = decltype(std::__convert_to_integral(std::declval<_Distance>())),
- class = __enable_if_t<is_integral<_IntegralDistance>::value> >
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
-void advance(_InputIter& __i, _Distance __orig_n) {
+template < class _InputIter,
+ class _Distance,
+ class _IntegralDistance = decltype(std::__convert_to_integral(std::declval<_Distance>())),
+ class = __enable_if_t<is_integral<_IntegralDistance>::value> >
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 void advance(_InputIter& __i, _Distance __orig_n) {
typedef typename iterator_traits<_InputIter>::difference_type _Difference;
_Difference __n = static_cast<_Difference>(std::__convert_to_integral(__orig_n));
_LIBCPP_ASSERT_UNCATEGORIZED(__n >= 0 || __has_bidirectional_iterator_category<_InputIter>::value,
@@ -81,8 +80,7 @@ namespace __advance {
struct __fn {
private:
template <class _Ip>
- _LIBCPP_HIDE_FROM_ABI
- static constexpr void __advance_forward(_Ip& __i, iter_difference_t<_Ip> __n) {
+ _LIBCPP_HIDE_FROM_ABI static constexpr void __advance_forward(_Ip& __i, iter_difference_t<_Ip> __n) {
while (__n > 0) {
--__n;
++__i;
@@ -90,8 +88,7 @@ private:
}
template <class _Ip>
- _LIBCPP_HIDE_FROM_ABI
- static constexpr void __advance_backward(_Ip& __i, iter_difference_t<_Ip> __n) {
+ _LIBCPP_HIDE_FROM_ABI static constexpr void __advance_backward(_Ip& __i, iter_difference_t<_Ip> __n) {
while (__n < 0) {
++__n;
--__i;
@@ -101,10 +98,9 @@ private:
public:
// Preconditions: If `I` does not model `bidirectional_iterator`, `n` is not negative.
template <input_or_output_iterator _Ip>
- _LIBCPP_HIDE_FROM_ABI
- constexpr void operator()(_Ip& __i, iter_difference_t<_Ip> __n) const {
- _LIBCPP_ASSERT_UNCATEGORIZED(__n >= 0 || bidirectional_iterator<_Ip>,
- "If `n < 0`, then `bidirectional_iterator<I>` must be true.");
+ _LIBCPP_HIDE_FROM_ABI constexpr void operator()(_Ip& __i, iter_difference_t<_Ip> __n) const {
+ _LIBCPP_ASSERT_UNCATEGORIZED(
+ __n >= 0 || bidirectional_iterator<_Ip>, "If `n < 0`, then `bidirectional_iterator<I>` must be true.");
// If `I` models `random_access_iterator`, equivalent to `i += n`.
if constexpr (random_access_iterator<_Ip>) {
@@ -123,14 +119,16 @@ public:
}
}
- // Preconditions: Either `assignable_from<I&, S> || sized_sentinel_for<S, I>` is modeled, or [i, bound_sentinel) denotes a range.
+ // Preconditions: Either `assignable_from<I&, S> || sized_sentinel_for<S, I>` is modeled, or [i, bound_sentinel)
+ // denotes a range.
template <input_or_output_iterator _Ip, sentinel_for<_Ip> _Sp>
_LIBCPP_HIDE_FROM_ABI constexpr void operator()(_Ip& __i, _Sp __bound_sentinel) const {
// If `I` and `S` model `assignable_from<I&, S>`, equivalent to `i = std::move(bound_sentinel)`.
if constexpr (assignable_from<_Ip&, _Sp>) {
__i = std::move(__bound_sentinel);
}
- // Otherwise, if `S` and `I` model `sized_sentinel_for<S, I>`, equivalent to `ranges::advance(i, bound_sentinel - i)`.
+ // Otherwise, if `S` and `I` model `sized_sentinel_for<S, I>`, equivalent to `ranges::advance(i, bound_sentinel -
+ // i)`.
else if constexpr (sized_sentinel_for<_Sp, _Ip>) {
(*this)(__i, __bound_sentinel - __i);
}
@@ -145,22 +143,19 @@ public:
// Preconditions:
// * If `n > 0`, [i, bound_sentinel) denotes a range.
// * If `n == 0`, [i, bound_sentinel) or [bound_sentinel, i) denotes a range.
- // * If `n < 0`, [bound_sentinel, i) denotes a range, `I` models `bidirectional_iterator`, and `I` and `S` model `same_as<I, S>`.
+ // * If `n < 0`, [bound_sentinel, i) denotes a range, `I` models `bidirectional_iterator`, and `I` and `S` model
+ // `same_as<I, S>`.
// Returns: `n - M`, where `M` is the difference between the ending and starting position.
template <input_or_output_iterator _Ip, sentinel_for<_Ip> _Sp>
- _LIBCPP_HIDE_FROM_ABI constexpr iter_difference_t<_Ip> operator()(_Ip& __i, iter_difference_t<_Ip> __n,
- _Sp __bound_sentinel) const {
+ _LIBCPP_HIDE_FROM_ABI constexpr iter_difference_t<_Ip>
+ operator()(_Ip& __i, iter_difference_t<_Ip> __n, _Sp __bound_sentinel) const {
_LIBCPP_ASSERT_UNCATEGORIZED((__n >= 0) || (bidirectional_iterator<_Ip> && same_as<_Ip, _Sp>),
"If `n < 0`, then `bidirectional_iterator<I> && same_as<I, S>` must be true.");
// If `S` and `I` model `sized_sentinel_for<S, I>`:
if constexpr (sized_sentinel_for<_Sp, _Ip>) {
// If |n| >= |bound_sentinel - i|, equivalent to `ranges::advance(i, bound_sentinel)`.
// __magnitude_geq(a, b) returns |a| >= |b|, assuming they have the same sign.
- auto __magnitude_geq = [](auto __a, auto __b) {
- return __a == 0 ? __b == 0 :
- __a > 0 ? __a >= __b :
- __a <= __b;
- };
+ auto __magnitude_geq = [](auto __a, auto __b) { return __a == 0 ? __b == 0 : __a > 0 ? __a >= __b : __a <= __b; };
if (const auto __m = __bound_sentinel - __i; __magnitude_geq(__n, __m)) {
(*this)(__i, __bound_sentinel);
return __n - __m;
@@ -194,7 +189,7 @@ public:
} // namespace __advance
inline namespace __cpo {
- inline constexpr auto advance = __advance::__fn{};
+inline constexpr auto advance = __advance::__fn{};
} // namespace __cpo
} // namespace ranges
diff --git a/contrib/llvm-project/libcxx/include/__iterator/back_insert_iterator.h b/contrib/llvm-project/libcxx/include/__iterator/back_insert_iterator.h
index f022d3bdf8dd..6d3dd4b12966 100644
--- a/contrib/llvm-project/libcxx/include/__iterator/back_insert_iterator.h
+++ b/contrib/llvm-project/libcxx/include/__iterator/back_insert_iterator.h
@@ -33,42 +33,49 @@ class _LIBCPP_TEMPLATE_VIS back_insert_iterator
: public iterator<output_iterator_tag, void, void, void, void>
#endif
{
-_LIBCPP_SUPPRESS_DEPRECATED_POP
+ _LIBCPP_SUPPRESS_DEPRECATED_POP
+
protected:
- _Container* container;
+ _Container* container;
+
public:
- typedef output_iterator_tag iterator_category;
- typedef void value_type;
+ typedef output_iterator_tag iterator_category;
+ typedef void value_type;
#if _LIBCPP_STD_VER >= 20
- typedef ptrdiff_t difference_type;
+ typedef ptrdiff_t difference_type;
#else
- typedef void difference_type;
+ typedef void difference_type;
#endif
- typedef void pointer;
- typedef void reference;
- typedef _Container container_type;
+ typedef void pointer;
+ typedef void reference;
+ typedef _Container container_type;
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 explicit back_insert_iterator(_Container& __x) : container(std::addressof(__x)) {}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 back_insert_iterator& operator=(const typename _Container::value_type& __value)
- {container->push_back(__value); return *this;}
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 explicit back_insert_iterator(_Container& __x)
+ : container(std::addressof(__x)) {}
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 back_insert_iterator&
+ operator=(const typename _Container::value_type& __value) {
+ container->push_back(__value);
+ return *this;
+ }
#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 back_insert_iterator& operator=(typename _Container::value_type&& __value)
- {container->push_back(std::move(__value)); return *this;}
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 back_insert_iterator&
+ operator=(typename _Container::value_type&& __value) {
+ container->push_back(std::move(__value));
+ return *this;
+ }
#endif // _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 back_insert_iterator& operator*() {return *this;}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 back_insert_iterator& operator++() {return *this;}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 back_insert_iterator operator++(int) {return *this;}
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 back_insert_iterator& operator*() { return *this; }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 back_insert_iterator& operator++() { return *this; }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 back_insert_iterator operator++(int) { return *this; }
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _Container* __get_container() const { return container; }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _Container* __get_container() const { return container; }
};
_LIBCPP_CTAD_SUPPORTED_FOR_TYPE(back_insert_iterator);
template <class _Container>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-back_insert_iterator<_Container>
-back_inserter(_Container& __x)
-{
- return back_insert_iterator<_Container>(__x);
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 back_insert_iterator<_Container>
+back_inserter(_Container& __x) {
+ return back_insert_iterator<_Container>(__x);
}
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__iterator/common_iterator.h b/contrib/llvm-project/libcxx/include/__iterator/common_iterator.h
index d7c308d8da00..7b3f4610d531 100644
--- a/contrib/llvm-project/libcxx/include/__iterator/common_iterator.h
+++ b/contrib/llvm-project/libcxx/include/__iterator/common_iterator.h
@@ -41,13 +41,12 @@ _LIBCPP_BEGIN_NAMESPACE_STD
#if _LIBCPP_STD_VER >= 20
-template<class _Iter>
+template <class _Iter>
concept __can_use_postfix_proxy =
- constructible_from<iter_value_t<_Iter>, iter_reference_t<_Iter>> &&
- move_constructible<iter_value_t<_Iter>>;
+ constructible_from<iter_value_t<_Iter>, iter_reference_t<_Iter>> && move_constructible<iter_value_t<_Iter>>;
-template<input_or_output_iterator _Iter, sentinel_for<_Iter> _Sent>
- requires (!same_as<_Iter, _Sent> && copyable<_Iter>)
+template <input_or_output_iterator _Iter, sentinel_for<_Iter> _Sent>
+ requires(!same_as<_Iter, _Sent> && copyable<_Iter>)
class common_iterator {
struct __proxy {
_LIBCPP_HIDE_FROM_ABI constexpr const iter_value_t<_Iter>* operator->() const noexcept {
@@ -57,42 +56,42 @@ class common_iterator {
};
struct __postfix_proxy {
- _LIBCPP_HIDE_FROM_ABI constexpr const iter_value_t<_Iter>& operator*() const noexcept {
- return __value_;
- }
+ _LIBCPP_HIDE_FROM_ABI constexpr const iter_value_t<_Iter>& operator*() const noexcept { return __value_; }
iter_value_t<_Iter> __value_;
};
variant<_Iter, _Sent> __hold_;
- template<input_or_output_iterator _OtherIter, sentinel_for<_OtherIter> _OtherSent>
- requires (!same_as<_OtherIter, _OtherSent> && copyable<_OtherIter>)
+ template <input_or_output_iterator _OtherIter, sentinel_for<_OtherIter> _OtherSent>
+ requires(!same_as<_OtherIter, _OtherSent> && copyable<_OtherIter>)
friend class common_iterator;
public:
- _LIBCPP_HIDE_FROM_ABI common_iterator() requires default_initializable<_Iter> = default;
+ _LIBCPP_HIDE_FROM_ABI common_iterator()
+ requires default_initializable<_Iter>
+ = default;
_LIBCPP_HIDE_FROM_ABI constexpr common_iterator(_Iter __i) : __hold_(in_place_type<_Iter>, std::move(__i)) {}
_LIBCPP_HIDE_FROM_ABI constexpr common_iterator(_Sent __s) : __hold_(in_place_type<_Sent>, std::move(__s)) {}
- template<class _I2, class _S2>
+ template <class _I2, class _S2>
requires convertible_to<const _I2&, _Iter> && convertible_to<const _S2&, _Sent>
_LIBCPP_HIDE_FROM_ABI constexpr common_iterator(const common_iterator<_I2, _S2>& __other)
- : __hold_([&]() -> variant<_Iter, _Sent> {
- _LIBCPP_ASSERT_UNCATEGORIZED(!__other.__hold_.valueless_by_exception(),
- "Attempted to construct from a valueless common_iterator");
- if (__other.__hold_.index() == 0)
- return variant<_Iter, _Sent>{in_place_index<0>, std::__unchecked_get<0>(__other.__hold_)};
- return variant<_Iter, _Sent>{in_place_index<1>, std::__unchecked_get<1>(__other.__hold_)};
- }()) {}
-
- template<class _I2, class _S2>
+ : __hold_([&]() -> variant<_Iter, _Sent> {
+ _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
+ !__other.__hold_.valueless_by_exception(), "Attempted to construct from a valueless common_iterator");
+ if (__other.__hold_.index() == 0)
+ return variant<_Iter, _Sent>{in_place_index<0>, std::__unchecked_get<0>(__other.__hold_)};
+ return variant<_Iter, _Sent>{in_place_index<1>, std::__unchecked_get<1>(__other.__hold_)};
+ }()) {}
+
+ template <class _I2, class _S2>
requires convertible_to<const _I2&, _Iter> && convertible_to<const _S2&, _Sent> &&
assignable_from<_Iter&, const _I2&> && assignable_from<_Sent&, const _S2&>
_LIBCPP_HIDE_FROM_ABI common_iterator& operator=(const common_iterator<_I2, _S2>& __other) {
- _LIBCPP_ASSERT_UNCATEGORIZED(!__other.__hold_.valueless_by_exception(),
- "Attempted to assign from a valueless common_iterator");
+ _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
+ !__other.__hold_.valueless_by_exception(), "Attempted to assign from a valueless common_iterator");
- auto __idx = __hold_.index();
+ auto __idx = __hold_.index();
auto __other_idx = __other.__hold_.index();
// If they're the same index, just assign.
@@ -110,31 +109,29 @@ public:
return *this;
}
- _LIBCPP_HIDE_FROM_ABI constexpr decltype(auto) operator*()
- {
- _LIBCPP_ASSERT_UNCATEGORIZED(std::holds_alternative<_Iter>(__hold_),
- "Attempted to dereference a non-dereferenceable common_iterator");
+ _LIBCPP_HIDE_FROM_ABI constexpr decltype(auto) operator*() {
+ _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
+ std::holds_alternative<_Iter>(__hold_), "Attempted to dereference a non-dereferenceable common_iterator");
return *std::__unchecked_get<_Iter>(__hold_);
}
_LIBCPP_HIDE_FROM_ABI constexpr decltype(auto) operator*() const
requires __dereferenceable<const _Iter>
{
- _LIBCPP_ASSERT_UNCATEGORIZED(std::holds_alternative<_Iter>(__hold_),
- "Attempted to dereference a non-dereferenceable common_iterator");
+ _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
+ std::holds_alternative<_Iter>(__hold_), "Attempted to dereference a non-dereferenceable common_iterator");
return *std::__unchecked_get<_Iter>(__hold_);
}
- template<class _I2 = _Iter>
+ template <class _I2 = _Iter>
_LIBCPP_HIDE_FROM_ABI decltype(auto) operator->() const
- requires indirectly_readable<const _I2> &&
- (requires(const _I2& __i) { __i.operator->(); } ||
- is_reference_v<iter_reference_t<_I2>> ||
- constructible_from<iter_value_t<_I2>, iter_reference_t<_I2>>)
+ requires indirectly_readable<const _I2> && (requires(const _I2& __i) {
+ __i.operator->();
+ } || is_reference_v<iter_reference_t<_I2>> || constructible_from<iter_value_t<_I2>, iter_reference_t<_I2>>)
{
- _LIBCPP_ASSERT_UNCATEGORIZED(std::holds_alternative<_Iter>(__hold_),
- "Attempted to dereference a non-dereferenceable common_iterator");
- if constexpr (is_pointer_v<_Iter> || requires(const _Iter& __i) { __i.operator->(); }) {
+ _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
+ std::holds_alternative<_Iter>(__hold_), "Attempted to dereference a non-dereferenceable common_iterator");
+ if constexpr (is_pointer_v<_Iter> || requires(const _Iter& __i) { __i.operator->(); }) {
return std::__unchecked_get<_Iter>(__hold_);
} else if constexpr (is_reference_v<iter_reference_t<_Iter>>) {
auto&& __tmp = *std::__unchecked_get<_Iter>(__hold_);
@@ -145,20 +142,22 @@ public:
}
_LIBCPP_HIDE_FROM_ABI common_iterator& operator++() {
- _LIBCPP_ASSERT_UNCATEGORIZED(std::holds_alternative<_Iter>(__hold_),
- "Attempted to increment a non-dereferenceable common_iterator");
- ++std::__unchecked_get<_Iter>(__hold_); return *this;
+ _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
+ std::holds_alternative<_Iter>(__hold_), "Attempted to increment a non-dereferenceable common_iterator");
+ ++std::__unchecked_get<_Iter>(__hold_);
+ return *this;
}
_LIBCPP_HIDE_FROM_ABI decltype(auto) operator++(int) {
- _LIBCPP_ASSERT_UNCATEGORIZED(std::holds_alternative<_Iter>(__hold_),
- "Attempted to increment a non-dereferenceable common_iterator");
+ _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
+ std::holds_alternative<_Iter>(__hold_), "Attempted to increment a non-dereferenceable common_iterator");
if constexpr (forward_iterator<_Iter>) {
auto __tmp = *this;
++*this;
return __tmp;
- } else if constexpr (requires (_Iter& __i) { { *__i++ } -> __can_reference; } ||
- !__can_use_postfix_proxy<_Iter>) {
+ } else if constexpr (requires(_Iter& __i) {
+ { *__i++ } -> __can_reference;
+ } || !__can_use_postfix_proxy<_Iter>) {
return std::__unchecked_get<_Iter>(__hold_)++;
} else {
auto __p = __postfix_proxy{**this};
@@ -167,14 +166,14 @@ public:
}
}
- template<class _I2, sentinel_for<_Iter> _S2>
+ template <class _I2, sentinel_for<_Iter> _S2>
requires sentinel_for<_Sent, _I2>
- _LIBCPP_HIDE_FROM_ABI
- friend constexpr bool operator==(const common_iterator& __x, const common_iterator<_I2, _S2>& __y) {
- _LIBCPP_ASSERT_UNCATEGORIZED(!__x.__hold_.valueless_by_exception(),
- "Attempted to compare a valueless common_iterator");
- _LIBCPP_ASSERT_UNCATEGORIZED(!__y.__hold_.valueless_by_exception(),
- "Attempted to compare a valueless common_iterator");
+ _LIBCPP_HIDE_FROM_ABI friend constexpr bool
+ operator==(const common_iterator& __x, const common_iterator<_I2, _S2>& __y) {
+ _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
+ !__x.__hold_.valueless_by_exception(), "Attempted to compare a valueless common_iterator");
+ _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
+ !__y.__hold_.valueless_by_exception(), "Attempted to compare a valueless common_iterator");
auto __x_index = __x.__hold_.index();
auto __y_index = __y.__hold_.index();
@@ -188,14 +187,14 @@ public:
return std::__unchecked_get<_Sent>(__x.__hold_) == std::__unchecked_get<_I2>(__y.__hold_);
}
- template<class _I2, sentinel_for<_Iter> _S2>
+ template <class _I2, sentinel_for<_Iter> _S2>
requires sentinel_for<_Sent, _I2> && equality_comparable_with<_Iter, _I2>
- _LIBCPP_HIDE_FROM_ABI
- friend constexpr bool operator==(const common_iterator& __x, const common_iterator<_I2, _S2>& __y) {
- _LIBCPP_ASSERT_UNCATEGORIZED(!__x.__hold_.valueless_by_exception(),
- "Attempted to compare a valueless common_iterator");
- _LIBCPP_ASSERT_UNCATEGORIZED(!__y.__hold_.valueless_by_exception(),
- "Attempted to compare a valueless common_iterator");
+ _LIBCPP_HIDE_FROM_ABI friend constexpr bool
+ operator==(const common_iterator& __x, const common_iterator<_I2, _S2>& __y) {
+ _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
+ !__x.__hold_.valueless_by_exception(), "Attempted to compare a valueless common_iterator");
+ _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
+ !__y.__hold_.valueless_by_exception(), "Attempted to compare a valueless common_iterator");
auto __x_index = __x.__hold_.index();
auto __y_index = __y.__hold_.index();
@@ -204,22 +203,22 @@ public:
return true;
if (__x_index == 0 && __y_index == 0)
- return std::__unchecked_get<_Iter>(__x.__hold_) == std::__unchecked_get<_I2>(__y.__hold_);
+ return std::__unchecked_get<_Iter>(__x.__hold_) == std::__unchecked_get<_I2>(__y.__hold_);
if (__x_index == 0)
- return std::__unchecked_get<_Iter>(__x.__hold_) == std::__unchecked_get<_S2>(__y.__hold_);
+ return std::__unchecked_get<_Iter>(__x.__hold_) == std::__unchecked_get<_S2>(__y.__hold_);
- return std::__unchecked_get<_Sent>(__x.__hold_) == std::__unchecked_get<_I2>(__y.__hold_);
+ return std::__unchecked_get<_Sent>(__x.__hold_) == std::__unchecked_get<_I2>(__y.__hold_);
}
- template<sized_sentinel_for<_Iter> _I2, sized_sentinel_for<_Iter> _S2>
+ template <sized_sentinel_for<_Iter> _I2, sized_sentinel_for<_Iter> _S2>
requires sized_sentinel_for<_Sent, _I2>
- _LIBCPP_HIDE_FROM_ABI
- friend constexpr iter_difference_t<_I2> operator-(const common_iterator& __x, const common_iterator<_I2, _S2>& __y) {
- _LIBCPP_ASSERT_UNCATEGORIZED(!__x.__hold_.valueless_by_exception(),
- "Attempted to subtract from a valueless common_iterator");
- _LIBCPP_ASSERT_UNCATEGORIZED(!__y.__hold_.valueless_by_exception(),
- "Attempted to subtract a valueless common_iterator");
+ _LIBCPP_HIDE_FROM_ABI friend constexpr iter_difference_t<_I2>
+ operator-(const common_iterator& __x, const common_iterator<_I2, _S2>& __y) {
+ _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
+ !__x.__hold_.valueless_by_exception(), "Attempted to subtract from a valueless common_iterator");
+ _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
+ !__y.__hold_.valueless_by_exception(), "Attempted to subtract a valueless common_iterator");
auto __x_index = __x.__hold_.index();
auto __y_index = __y.__hold_.index();
@@ -228,73 +227,67 @@ public:
return 0;
if (__x_index == 0 && __y_index == 0)
- return std::__unchecked_get<_Iter>(__x.__hold_) - std::__unchecked_get<_I2>(__y.__hold_);
+ return std::__unchecked_get<_Iter>(__x.__hold_) - std::__unchecked_get<_I2>(__y.__hold_);
if (__x_index == 0)
- return std::__unchecked_get<_Iter>(__x.__hold_) - std::__unchecked_get<_S2>(__y.__hold_);
+ return std::__unchecked_get<_Iter>(__x.__hold_) - std::__unchecked_get<_S2>(__y.__hold_);
return std::__unchecked_get<_Sent>(__x.__hold_) - std::__unchecked_get<_I2>(__y.__hold_);
}
- _LIBCPP_HIDE_FROM_ABI friend constexpr iter_rvalue_reference_t<_Iter> iter_move(const common_iterator& __i)
- noexcept(noexcept(ranges::iter_move(std::declval<const _Iter&>())))
- requires input_iterator<_Iter>
+ _LIBCPP_HIDE_FROM_ABI friend constexpr iter_rvalue_reference_t<_Iter>
+ iter_move(const common_iterator& __i) noexcept(noexcept(ranges::iter_move(std::declval<const _Iter&>())))
+ requires input_iterator<_Iter>
{
- _LIBCPP_ASSERT_UNCATEGORIZED(std::holds_alternative<_Iter>(__i.__hold_),
- "Attempted to iter_move a non-dereferenceable common_iterator");
- return ranges::iter_move( std::__unchecked_get<_Iter>(__i.__hold_));
+ _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
+ std::holds_alternative<_Iter>(__i.__hold_), "Attempted to iter_move a non-dereferenceable common_iterator");
+ return ranges::iter_move(std::__unchecked_get<_Iter>(__i.__hold_));
}
- template<indirectly_swappable<_Iter> _I2, class _S2>
- _LIBCPP_HIDE_FROM_ABI friend constexpr void iter_swap(const common_iterator& __x, const common_iterator<_I2, _S2>& __y)
- noexcept(noexcept(ranges::iter_swap(std::declval<const _Iter&>(), std::declval<const _I2&>())))
- {
- _LIBCPP_ASSERT_UNCATEGORIZED(std::holds_alternative<_Iter>(__x.__hold_),
- "Attempted to iter_swap a non-dereferenceable common_iterator");
- _LIBCPP_ASSERT_UNCATEGORIZED(std::holds_alternative<_I2>(__y.__hold_),
- "Attempted to iter_swap a non-dereferenceable common_iterator");
+ template <indirectly_swappable<_Iter> _I2, class _S2>
+ _LIBCPP_HIDE_FROM_ABI friend constexpr void
+ iter_swap(const common_iterator& __x, const common_iterator<_I2, _S2>& __y) noexcept(
+ noexcept(ranges::iter_swap(std::declval<const _Iter&>(), std::declval<const _I2&>()))) {
+ _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
+ std::holds_alternative<_Iter>(__x.__hold_), "Attempted to iter_swap a non-dereferenceable common_iterator");
+ _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
+ std::holds_alternative<_I2>(__y.__hold_), "Attempted to iter_swap a non-dereferenceable common_iterator");
return ranges::iter_swap(std::__unchecked_get<_Iter>(__x.__hold_), std::__unchecked_get<_I2>(__y.__hold_));
}
};
-template<class _Iter, class _Sent>
+template <class _Iter, class _Sent>
struct incrementable_traits<common_iterator<_Iter, _Sent>> {
using difference_type = iter_difference_t<_Iter>;
};
-template<class _Iter>
-concept __denotes_forward_iter =
- requires { typename iterator_traits<_Iter>::iterator_category; } &&
- derived_from<typename iterator_traits<_Iter>::iterator_category, forward_iterator_tag>;
+template <class _Iter>
+concept __denotes_forward_iter = requires {
+ typename iterator_traits<_Iter>::iterator_category;
+} && derived_from<typename iterator_traits<_Iter>::iterator_category, forward_iterator_tag>;
-template<class _Iter, class _Sent>
-concept __common_iter_has_ptr_op = requires(const common_iterator<_Iter, _Sent>& __a) {
- __a.operator->();
-};
+template <class _Iter, class _Sent>
+concept __common_iter_has_ptr_op = requires(const common_iterator<_Iter, _Sent>& __a) { __a.operator->(); };
-template<class, class>
+template <class, class>
struct __arrow_type_or_void {
- using type = void;
+ using type = void;
};
-template<class _Iter, class _Sent>
+template <class _Iter, class _Sent>
requires __common_iter_has_ptr_op<_Iter, _Sent>
struct __arrow_type_or_void<_Iter, _Sent> {
- using type = decltype(std::declval<const common_iterator<_Iter, _Sent>&>().operator->());
+ using type = decltype(std::declval<const common_iterator<_Iter, _Sent>&>().operator->());
};
-template<input_iterator _Iter, class _Sent>
+template <input_iterator _Iter, class _Sent>
struct iterator_traits<common_iterator<_Iter, _Sent>> {
- using iterator_concept = _If<forward_iterator<_Iter>,
- forward_iterator_tag,
- input_iterator_tag>;
- using iterator_category = _If<__denotes_forward_iter<_Iter>,
- forward_iterator_tag,
- input_iterator_tag>;
- using pointer = typename __arrow_type_or_void<_Iter, _Sent>::type;
- using value_type = iter_value_t<_Iter>;
- using difference_type = iter_difference_t<_Iter>;
- using reference = iter_reference_t<_Iter>;
+ using iterator_concept = _If<forward_iterator<_Iter>, forward_iterator_tag, input_iterator_tag>;
+ using iterator_category = _If<__denotes_forward_iter<_Iter>, forward_iterator_tag, input_iterator_tag>;
+ using pointer = typename __arrow_type_or_void<_Iter, _Sent>::type;
+ using value_type = iter_value_t<_Iter>;
+ using difference_type = iter_difference_t<_Iter>;
+ using reference = iter_reference_t<_Iter>;
};
#endif // _LIBCPP_STD_VER >= 20
diff --git a/contrib/llvm-project/libcxx/include/__iterator/concepts.h b/contrib/llvm-project/libcxx/include/__iterator/concepts.h
index 614de85847a0..afb7b821a99c 100644
--- a/contrib/llvm-project/libcxx/include/__iterator/concepts.h
+++ b/contrib/llvm-project/libcxx/include/__iterator/concepts.h
@@ -49,246 +49,198 @@ _LIBCPP_BEGIN_NAMESPACE_STD
#if _LIBCPP_STD_VER >= 20
// [iterator.concept.readable]
-template<class _In>
+template <class _In>
concept __indirectly_readable_impl =
- requires(const _In __i) {
- typename iter_value_t<_In>;
- typename iter_reference_t<_In>;
- typename iter_rvalue_reference_t<_In>;
- { *__i } -> same_as<iter_reference_t<_In>>;
- { ranges::iter_move(__i) } -> same_as<iter_rvalue_reference_t<_In>>;
- } &&
- common_reference_with<iter_reference_t<_In>&&, iter_value_t<_In>&> &&
- common_reference_with<iter_reference_t<_In>&&, iter_rvalue_reference_t<_In>&&> &&
- common_reference_with<iter_rvalue_reference_t<_In>&&, const iter_value_t<_In>&>;
-
-template<class _In>
+ requires(const _In __i) {
+ typename iter_value_t<_In>;
+ typename iter_reference_t<_In>;
+ typename iter_rvalue_reference_t<_In>;
+ { *__i } -> same_as<iter_reference_t<_In>>;
+ { ranges::iter_move(__i) } -> same_as<iter_rvalue_reference_t<_In>>;
+ } && common_reference_with<iter_reference_t<_In>&&, iter_value_t<_In>&> &&
+ common_reference_with<iter_reference_t<_In>&&, iter_rvalue_reference_t<_In>&&> &&
+ common_reference_with<iter_rvalue_reference_t<_In>&&, const iter_value_t<_In>&>;
+
+template <class _In>
concept indirectly_readable = __indirectly_readable_impl<remove_cvref_t<_In>>;
-template<indirectly_readable _Tp>
+template <indirectly_readable _Tp>
using iter_common_reference_t = common_reference_t<iter_reference_t<_Tp>, iter_value_t<_Tp>&>;
// [iterator.concept.writable]
-template<class _Out, class _Tp>
-concept indirectly_writable =
- requires(_Out&& __o, _Tp&& __t) {
- *__o = std::forward<_Tp>(__t); // not required to be equality-preserving
- *std::forward<_Out>(__o) = std::forward<_Tp>(__t); // not required to be equality-preserving
- const_cast<const iter_reference_t<_Out>&&>(*__o) = std::forward<_Tp>(__t); // not required to be equality-preserving
- const_cast<const iter_reference_t<_Out>&&>(*std::forward<_Out>(__o)) = std::forward<_Tp>(__t); // not required to be equality-preserving
- };
+template <class _Out, class _Tp>
+concept indirectly_writable = requires(_Out&& __o, _Tp&& __t) {
+ *__o = std::forward<_Tp>(__t); // not required to be equality-preserving
+ *std::forward<_Out>(__o) = std::forward<_Tp>(__t); // not required to be equality-preserving
+ const_cast<const iter_reference_t<_Out>&&>(*__o) = std::forward<_Tp>(__t); // not required to be equality-preserving
+ const_cast<const iter_reference_t<_Out>&&>(*std::forward<_Out>(__o)) =
+ std::forward<_Tp>(__t); // not required to be equality-preserving
+};
// [iterator.concept.winc]
-template<class _Tp>
+template <class _Tp>
concept __integer_like = integral<_Tp> && !same_as<_Tp, bool>;
-template<class _Tp>
+template <class _Tp>
concept __signed_integer_like = signed_integral<_Tp>;
-template<class _Ip>
+template <class _Ip>
concept weakly_incrementable =
- // TODO: remove this once the clang bug is fixed (bugs.llvm.org/PR48173).
- !same_as<_Ip, bool> && // Currently, clang does not handle bool correctly.
- movable<_Ip> &&
- requires(_Ip __i) {
- typename iter_difference_t<_Ip>;
- requires __signed_integer_like<iter_difference_t<_Ip>>;
- { ++__i } -> same_as<_Ip&>; // not required to be equality-preserving
- __i++; // not required to be equality-preserving
- };
+ // TODO: remove this once the clang bug is fixed (bugs.llvm.org/PR48173).
+ !same_as<_Ip, bool> && // Currently, clang does not handle bool correctly.
+ movable<_Ip> && requires(_Ip __i) {
+ typename iter_difference_t<_Ip>;
+ requires __signed_integer_like<iter_difference_t<_Ip>>;
+ { ++__i } -> same_as<_Ip&>; // not required to be equality-preserving
+ __i++; // not required to be equality-preserving
+ };
// [iterator.concept.inc]
-template<class _Ip>
-concept incrementable =
- regular<_Ip> &&
- weakly_incrementable<_Ip> &&
- requires(_Ip __i) {
- { __i++ } -> same_as<_Ip>;
- };
+template <class _Ip>
+concept incrementable = regular<_Ip> && weakly_incrementable<_Ip> && requires(_Ip __i) {
+ { __i++ } -> same_as<_Ip>;
+};
// [iterator.concept.iterator]
-template<class _Ip>
-concept input_or_output_iterator =
- requires(_Ip __i) {
- { *__i } -> __can_reference;
- } &&
- weakly_incrementable<_Ip>;
+template <class _Ip>
+concept input_or_output_iterator = requires(_Ip __i) {
+ { *__i } -> __can_reference;
+} && weakly_incrementable<_Ip>;
// [iterator.concept.sentinel]
-template<class _Sp, class _Ip>
-concept sentinel_for =
- semiregular<_Sp> &&
- input_or_output_iterator<_Ip> &&
- __weakly_equality_comparable_with<_Sp, _Ip>;
+template <class _Sp, class _Ip>
+concept sentinel_for = semiregular<_Sp> && input_or_output_iterator<_Ip> && __weakly_equality_comparable_with<_Sp, _Ip>;
-template<class, class>
+template <class, class>
inline constexpr bool disable_sized_sentinel_for = false;
-template<class _Sp, class _Ip>
+template <class _Sp, class _Ip>
concept sized_sentinel_for =
- sentinel_for<_Sp, _Ip> &&
- !disable_sized_sentinel_for<remove_cv_t<_Sp>, remove_cv_t<_Ip>> &&
- requires(const _Ip& __i, const _Sp& __s) {
- { __s - __i } -> same_as<iter_difference_t<_Ip>>;
- { __i - __s } -> same_as<iter_difference_t<_Ip>>;
- };
+ sentinel_for<_Sp, _Ip> && !disable_sized_sentinel_for<remove_cv_t<_Sp>, remove_cv_t<_Ip>> &&
+ requires(const _Ip& __i, const _Sp& __s) {
+ { __s - __i } -> same_as<iter_difference_t<_Ip>>;
+ { __i - __s } -> same_as<iter_difference_t<_Ip>>;
+ };
// [iterator.concept.input]
-template<class _Ip>
-concept input_iterator =
- input_or_output_iterator<_Ip> &&
- indirectly_readable<_Ip> &&
- requires { typename _ITER_CONCEPT<_Ip>; } &&
- derived_from<_ITER_CONCEPT<_Ip>, input_iterator_tag>;
+template <class _Ip>
+concept input_iterator = input_or_output_iterator<_Ip> && indirectly_readable<_Ip> && requires {
+ typename _ITER_CONCEPT<_Ip>;
+} && derived_from<_ITER_CONCEPT<_Ip>, input_iterator_tag>;
// [iterator.concept.output]
-template<class _Ip, class _Tp>
+template <class _Ip, class _Tp>
concept output_iterator =
- input_or_output_iterator<_Ip> &&
- indirectly_writable<_Ip, _Tp> &&
- requires (_Ip __it, _Tp&& __t) {
- *__it++ = std::forward<_Tp>(__t); // not required to be equality-preserving
- };
+ input_or_output_iterator<_Ip> && indirectly_writable<_Ip, _Tp> && requires(_Ip __it, _Tp&& __t) {
+ *__it++ = std::forward<_Tp>(__t); // not required to be equality-preserving
+ };
// [iterator.concept.forward]
-template<class _Ip>
+template <class _Ip>
concept forward_iterator =
- input_iterator<_Ip> &&
- derived_from<_ITER_CONCEPT<_Ip>, forward_iterator_tag> &&
- incrementable<_Ip> &&
- sentinel_for<_Ip, _Ip>;
+ input_iterator<_Ip> && derived_from<_ITER_CONCEPT<_Ip>, forward_iterator_tag> && incrementable<_Ip> &&
+ sentinel_for<_Ip, _Ip>;
// [iterator.concept.bidir]
-template<class _Ip>
+template <class _Ip>
concept bidirectional_iterator =
- forward_iterator<_Ip> &&
- derived_from<_ITER_CONCEPT<_Ip>, bidirectional_iterator_tag> &&
- requires(_Ip __i) {
- { --__i } -> same_as<_Ip&>;
- { __i-- } -> same_as<_Ip>;
- };
-
-template<class _Ip>
+ forward_iterator<_Ip> && derived_from<_ITER_CONCEPT<_Ip>, bidirectional_iterator_tag> && requires(_Ip __i) {
+ { --__i } -> same_as<_Ip&>;
+ { __i-- } -> same_as<_Ip>;
+ };
+
+template <class _Ip>
concept random_access_iterator =
- bidirectional_iterator<_Ip> &&
- derived_from<_ITER_CONCEPT<_Ip>, random_access_iterator_tag> &&
- totally_ordered<_Ip> &&
- sized_sentinel_for<_Ip, _Ip> &&
- requires(_Ip __i, const _Ip __j, const iter_difference_t<_Ip> __n) {
- { __i += __n } -> same_as<_Ip&>;
- { __j + __n } -> same_as<_Ip>;
- { __n + __j } -> same_as<_Ip>;
- { __i -= __n } -> same_as<_Ip&>;
- { __j - __n } -> same_as<_Ip>;
- { __j[__n] } -> same_as<iter_reference_t<_Ip>>;
- };
-
-template<class _Ip>
+ bidirectional_iterator<_Ip> && derived_from<_ITER_CONCEPT<_Ip>, random_access_iterator_tag> &&
+ totally_ordered<_Ip> && sized_sentinel_for<_Ip, _Ip> &&
+ requires(_Ip __i, const _Ip __j, const iter_difference_t<_Ip> __n) {
+ { __i += __n } -> same_as<_Ip&>;
+ { __j + __n } -> same_as<_Ip>;
+ { __n + __j } -> same_as<_Ip>;
+ { __i -= __n } -> same_as<_Ip&>;
+ { __j - __n } -> same_as<_Ip>;
+ { __j[__n] } -> same_as<iter_reference_t<_Ip>>;
+ };
+
+template <class _Ip>
concept contiguous_iterator =
- random_access_iterator<_Ip> &&
- derived_from<_ITER_CONCEPT<_Ip>, contiguous_iterator_tag> &&
- is_lvalue_reference_v<iter_reference_t<_Ip>> &&
- same_as<iter_value_t<_Ip>, remove_cvref_t<iter_reference_t<_Ip>>> &&
- requires(const _Ip& __i) {
- { std::to_address(__i) } -> same_as<add_pointer_t<iter_reference_t<_Ip>>>;
- };
-
-template<class _Ip>
+ random_access_iterator<_Ip> && derived_from<_ITER_CONCEPT<_Ip>, contiguous_iterator_tag> &&
+ is_lvalue_reference_v<iter_reference_t<_Ip>> && same_as<iter_value_t<_Ip>, remove_cvref_t<iter_reference_t<_Ip>>> &&
+ requires(const _Ip& __i) {
+ { std::to_address(__i) } -> same_as<add_pointer_t<iter_reference_t<_Ip>>>;
+ };
+
+template <class _Ip>
concept __has_arrow = input_iterator<_Ip> && (is_pointer_v<_Ip> || requires(_Ip __i) { __i.operator->(); });
// [indirectcallable.indirectinvocable]
-template<class _Fp, class _It>
+template <class _Fp, class _It>
concept indirectly_unary_invocable =
- indirectly_readable<_It> &&
- copy_constructible<_Fp> &&
- invocable<_Fp&, iter_value_t<_It>&> &&
- invocable<_Fp&, iter_reference_t<_It>> &&
- invocable<_Fp&, iter_common_reference_t<_It>> &&
- common_reference_with<
- invoke_result_t<_Fp&, iter_value_t<_It>&>,
- invoke_result_t<_Fp&, iter_reference_t<_It>>>;
-
-template<class _Fp, class _It>
+ indirectly_readable<_It> && copy_constructible<_Fp> && invocable<_Fp&, iter_value_t<_It>&> &&
+ invocable<_Fp&, iter_reference_t<_It>> && invocable<_Fp&, iter_common_reference_t<_It>> &&
+ common_reference_with< invoke_result_t<_Fp&, iter_value_t<_It>&>, invoke_result_t<_Fp&, iter_reference_t<_It>>>;
+
+template <class _Fp, class _It>
concept indirectly_regular_unary_invocable =
- indirectly_readable<_It> &&
- copy_constructible<_Fp> &&
- regular_invocable<_Fp&, iter_value_t<_It>&> &&
- regular_invocable<_Fp&, iter_reference_t<_It>> &&
- regular_invocable<_Fp&, iter_common_reference_t<_It>> &&
- common_reference_with<
- invoke_result_t<_Fp&, iter_value_t<_It>&>,
- invoke_result_t<_Fp&, iter_reference_t<_It>>>;
-
-template<class _Fp, class _It>
+ indirectly_readable<_It> && copy_constructible<_Fp> && regular_invocable<_Fp&, iter_value_t<_It>&> &&
+ regular_invocable<_Fp&, iter_reference_t<_It>> && regular_invocable<_Fp&, iter_common_reference_t<_It>> &&
+ common_reference_with< invoke_result_t<_Fp&, iter_value_t<_It>&>, invoke_result_t<_Fp&, iter_reference_t<_It>>>;
+
+template <class _Fp, class _It>
concept indirect_unary_predicate =
- indirectly_readable<_It> &&
- copy_constructible<_Fp> &&
- predicate<_Fp&, iter_value_t<_It>&> &&
- predicate<_Fp&, iter_reference_t<_It>> &&
- predicate<_Fp&, iter_common_reference_t<_It>>;
+ indirectly_readable<_It> && copy_constructible<_Fp> && predicate<_Fp&, iter_value_t<_It>&> &&
+ predicate<_Fp&, iter_reference_t<_It>> && predicate<_Fp&, iter_common_reference_t<_It>>;
-template<class _Fp, class _It1, class _It2>
+template <class _Fp, class _It1, class _It2>
concept indirect_binary_predicate =
- indirectly_readable<_It1> && indirectly_readable<_It2> &&
- copy_constructible<_Fp> &&
- predicate<_Fp&, iter_value_t<_It1>&, iter_value_t<_It2>&> &&
- predicate<_Fp&, iter_value_t<_It1>&, iter_reference_t<_It2>> &&
- predicate<_Fp&, iter_reference_t<_It1>, iter_value_t<_It2>&> &&
- predicate<_Fp&, iter_reference_t<_It1>, iter_reference_t<_It2>> &&
- predicate<_Fp&, iter_common_reference_t<_It1>, iter_common_reference_t<_It2>>;
-
-template<class _Fp, class _It1, class _It2 = _It1>
+ indirectly_readable<_It1> && indirectly_readable<_It2> && copy_constructible<_Fp> &&
+ predicate<_Fp&, iter_value_t<_It1>&, iter_value_t<_It2>&> &&
+ predicate<_Fp&, iter_value_t<_It1>&, iter_reference_t<_It2>> &&
+ predicate<_Fp&, iter_reference_t<_It1>, iter_value_t<_It2>&> &&
+ predicate<_Fp&, iter_reference_t<_It1>, iter_reference_t<_It2>> &&
+ predicate<_Fp&, iter_common_reference_t<_It1>, iter_common_reference_t<_It2>>;
+
+template <class _Fp, class _It1, class _It2 = _It1>
concept indirect_equivalence_relation =
- indirectly_readable<_It1> && indirectly_readable<_It2> &&
- copy_constructible<_Fp> &&
- equivalence_relation<_Fp&, iter_value_t<_It1>&, iter_value_t<_It2>&> &&
- equivalence_relation<_Fp&, iter_value_t<_It1>&, iter_reference_t<_It2>> &&
- equivalence_relation<_Fp&, iter_reference_t<_It1>, iter_value_t<_It2>&> &&
- equivalence_relation<_Fp&, iter_reference_t<_It1>, iter_reference_t<_It2>> &&
- equivalence_relation<_Fp&, iter_common_reference_t<_It1>, iter_common_reference_t<_It2>>;
-
-template<class _Fp, class _It1, class _It2 = _It1>
+ indirectly_readable<_It1> && indirectly_readable<_It2> && copy_constructible<_Fp> &&
+ equivalence_relation<_Fp&, iter_value_t<_It1>&, iter_value_t<_It2>&> &&
+ equivalence_relation<_Fp&, iter_value_t<_It1>&, iter_reference_t<_It2>> &&
+ equivalence_relation<_Fp&, iter_reference_t<_It1>, iter_value_t<_It2>&> &&
+ equivalence_relation<_Fp&, iter_reference_t<_It1>, iter_reference_t<_It2>> &&
+ equivalence_relation<_Fp&, iter_common_reference_t<_It1>, iter_common_reference_t<_It2>>;
+
+template <class _Fp, class _It1, class _It2 = _It1>
concept indirect_strict_weak_order =
- indirectly_readable<_It1> && indirectly_readable<_It2> &&
- copy_constructible<_Fp> &&
- strict_weak_order<_Fp&, iter_value_t<_It1>&, iter_value_t<_It2>&> &&
- strict_weak_order<_Fp&, iter_value_t<_It1>&, iter_reference_t<_It2>> &&
- strict_weak_order<_Fp&, iter_reference_t<_It1>, iter_value_t<_It2>&> &&
- strict_weak_order<_Fp&, iter_reference_t<_It1>, iter_reference_t<_It2>> &&
- strict_weak_order<_Fp&, iter_common_reference_t<_It1>, iter_common_reference_t<_It2>>;
-
-template<class _Fp, class... _Its>
- requires (indirectly_readable<_Its> && ...) && invocable<_Fp, iter_reference_t<_Its>...>
+ indirectly_readable<_It1> && indirectly_readable<_It2> && copy_constructible<_Fp> &&
+ strict_weak_order<_Fp&, iter_value_t<_It1>&, iter_value_t<_It2>&> &&
+ strict_weak_order<_Fp&, iter_value_t<_It1>&, iter_reference_t<_It2>> &&
+ strict_weak_order<_Fp&, iter_reference_t<_It1>, iter_value_t<_It2>&> &&
+ strict_weak_order<_Fp&, iter_reference_t<_It1>, iter_reference_t<_It2>> &&
+ strict_weak_order<_Fp&, iter_common_reference_t<_It1>, iter_common_reference_t<_It2>>;
+
+template <class _Fp, class... _Its>
+ requires(indirectly_readable<_Its> && ...) && invocable<_Fp, iter_reference_t<_Its>...>
using indirect_result_t = invoke_result_t<_Fp, iter_reference_t<_Its>...>;
-template<class _In, class _Out>
-concept indirectly_movable =
- indirectly_readable<_In> &&
- indirectly_writable<_Out, iter_rvalue_reference_t<_In>>;
+template <class _In, class _Out>
+concept indirectly_movable = indirectly_readable<_In> && indirectly_writable<_Out, iter_rvalue_reference_t<_In>>;
-template<class _In, class _Out>
+template <class _In, class _Out>
concept indirectly_movable_storable =
- indirectly_movable<_In, _Out> &&
- indirectly_writable<_Out, iter_value_t<_In>> &&
- movable<iter_value_t<_In>> &&
- constructible_from<iter_value_t<_In>, iter_rvalue_reference_t<_In>> &&
- assignable_from<iter_value_t<_In>&, iter_rvalue_reference_t<_In>>;
-
-template<class _In, class _Out>
-concept indirectly_copyable =
- indirectly_readable<_In> &&
- indirectly_writable<_Out, iter_reference_t<_In>>;
-
-template<class _In, class _Out>
+ indirectly_movable<_In, _Out> && indirectly_writable<_Out, iter_value_t<_In>> && movable<iter_value_t<_In>> &&
+ constructible_from<iter_value_t<_In>, iter_rvalue_reference_t<_In>> &&
+ assignable_from<iter_value_t<_In>&, iter_rvalue_reference_t<_In>>;
+
+template <class _In, class _Out>
+concept indirectly_copyable = indirectly_readable<_In> && indirectly_writable<_Out, iter_reference_t<_In>>;
+
+template <class _In, class _Out>
concept indirectly_copyable_storable =
- indirectly_copyable<_In, _Out> &&
- indirectly_writable<_Out, iter_value_t<_In>&> &&
- indirectly_writable<_Out, const iter_value_t<_In>&> &&
- indirectly_writable<_Out, iter_value_t<_In>&&> &&
- indirectly_writable<_Out, const iter_value_t<_In>&&> &&
- copyable<iter_value_t<_In>> &&
- constructible_from<iter_value_t<_In>, iter_reference_t<_In>> &&
- assignable_from<iter_value_t<_In>&, iter_reference_t<_In>>;
+ indirectly_copyable<_In, _Out> && indirectly_writable<_Out, iter_value_t<_In>&> &&
+ indirectly_writable<_Out, const iter_value_t<_In>&> && indirectly_writable<_Out, iter_value_t<_In>&&> &&
+ indirectly_writable<_Out, const iter_value_t<_In>&&> && copyable<iter_value_t<_In>> &&
+ constructible_from<iter_value_t<_In>, iter_reference_t<_In>> &&
+ assignable_from<iter_value_t<_In>&, iter_reference_t<_In>>;
// Note: indirectly_swappable is located in iter_swap.h to prevent a dependency cycle
// (both iter_swap and indirectly_swappable require indirectly_readable).
@@ -298,10 +250,10 @@ concept indirectly_copyable_storable =
template <class _Tp>
using __has_random_access_iterator_category_or_concept
#if _LIBCPP_STD_VER >= 20
- = integral_constant<bool, random_access_iterator<_Tp>>;
-#else // _LIBCPP_STD_VER < 20
- = __has_random_access_iterator_category<_Tp>;
-#endif // _LIBCPP_STD_VER
+ = integral_constant<bool, random_access_iterator<_Tp>>;
+#else // _LIBCPP_STD_VER < 20
+ = __has_random_access_iterator_category<_Tp>;
+#endif // _LIBCPP_STD_VER
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__iterator/counted_iterator.h b/contrib/llvm-project/libcxx/include/__iterator/counted_iterator.h
index 171c0d7f0e77..008c52fa87ce 100644
--- a/contrib/llvm-project/libcxx/include/__iterator/counted_iterator.h
+++ b/contrib/llvm-project/libcxx/include/__iterator/counted_iterator.h
@@ -41,118 +41,110 @@ _LIBCPP_BEGIN_NAMESPACE_STD
#if _LIBCPP_STD_VER >= 20
-template<class>
+template <class>
struct __counted_iterator_concept {};
-template<class _Iter>
+template <class _Iter>
requires requires { typename _Iter::iterator_concept; }
struct __counted_iterator_concept<_Iter> {
using iterator_concept = typename _Iter::iterator_concept;
};
-template<class>
+template <class>
struct __counted_iterator_category {};
-template<class _Iter>
+template <class _Iter>
requires requires { typename _Iter::iterator_category; }
struct __counted_iterator_category<_Iter> {
using iterator_category = typename _Iter::iterator_category;
};
-template<class>
+template <class>
struct __counted_iterator_value_type {};
-template<indirectly_readable _Iter>
+template <indirectly_readable _Iter>
struct __counted_iterator_value_type<_Iter> {
using value_type = iter_value_t<_Iter>;
};
-template<input_or_output_iterator _Iter>
+template <input_or_output_iterator _Iter>
class counted_iterator
- : public __counted_iterator_concept<_Iter>
- , public __counted_iterator_category<_Iter>
- , public __counted_iterator_value_type<_Iter>
-{
+ : public __counted_iterator_concept<_Iter>,
+ public __counted_iterator_category<_Iter>,
+ public __counted_iterator_value_type<_Iter> {
public:
- using iterator_type = _Iter;
+ using iterator_type = _Iter;
using difference_type = iter_difference_t<_Iter>;
- _LIBCPP_HIDE_FROM_ABI
- constexpr counted_iterator() requires default_initializable<_Iter> = default;
+ _LIBCPP_HIDE_FROM_ABI constexpr counted_iterator()
+ requires default_initializable<_Iter>
+ = default;
- _LIBCPP_HIDE_FROM_ABI
- constexpr counted_iterator(_Iter __iter, iter_difference_t<_Iter> __n)
- : __current_(std::move(__iter)), __count_(__n) {
+ _LIBCPP_HIDE_FROM_ABI constexpr counted_iterator(_Iter __iter, iter_difference_t<_Iter> __n)
+ : __current_(std::move(__iter)), __count_(__n) {
_LIBCPP_ASSERT_UNCATEGORIZED(__n >= 0, "__n must not be negative.");
}
- template<class _I2>
+ template <class _I2>
requires convertible_to<const _I2&, _Iter>
- _LIBCPP_HIDE_FROM_ABI
- constexpr counted_iterator(const counted_iterator<_I2>& __other)
- : __current_(__other.__current_), __count_(__other.__count_) {}
+ _LIBCPP_HIDE_FROM_ABI constexpr counted_iterator(const counted_iterator<_I2>& __other)
+ : __current_(__other.__current_), __count_(__other.__count_) {}
- template<class _I2>
+ template <class _I2>
requires assignable_from<_Iter&, const _I2&>
- _LIBCPP_HIDE_FROM_ABI
- constexpr counted_iterator& operator=(const counted_iterator<_I2>& __other) {
+ _LIBCPP_HIDE_FROM_ABI constexpr counted_iterator& operator=(const counted_iterator<_I2>& __other) {
__current_ = __other.__current_;
- __count_ = __other.__count_;
+ __count_ = __other.__count_;
return *this;
}
- _LIBCPP_HIDE_FROM_ABI
- constexpr const _Iter& base() const& noexcept { return __current_; }
+ _LIBCPP_HIDE_FROM_ABI constexpr const _Iter& base() const& noexcept { return __current_; }
- _LIBCPP_HIDE_FROM_ABI
- constexpr _Iter base() && { return std::move(__current_); }
+ _LIBCPP_HIDE_FROM_ABI constexpr _Iter base() && { return std::move(__current_); }
- _LIBCPP_HIDE_FROM_ABI
- constexpr iter_difference_t<_Iter> count() const noexcept { return __count_; }
+ _LIBCPP_HIDE_FROM_ABI constexpr iter_difference_t<_Iter> count() const noexcept { return __count_; }
- _LIBCPP_HIDE_FROM_ABI
- constexpr decltype(auto) operator*() {
- _LIBCPP_ASSERT_UNCATEGORIZED(__count_ > 0, "Iterator is equal to or past end.");
+ _LIBCPP_HIDE_FROM_ABI constexpr decltype(auto) operator*() {
+ _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__count_ > 0, "Iterator is equal to or past end.");
return *__current_;
}
- _LIBCPP_HIDE_FROM_ABI
- constexpr decltype(auto) operator*() const
+ _LIBCPP_HIDE_FROM_ABI constexpr decltype(auto) operator*() const
requires __dereferenceable<const _Iter>
{
- _LIBCPP_ASSERT_UNCATEGORIZED(__count_ > 0, "Iterator is equal to or past end.");
+ _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__count_ > 0, "Iterator is equal to or past end.");
return *__current_;
}
- _LIBCPP_HIDE_FROM_ABI
- constexpr auto operator->() const noexcept
+ _LIBCPP_HIDE_FROM_ABI constexpr auto operator->() const noexcept
requires contiguous_iterator<_Iter>
{
return std::to_address(__current_);
}
- _LIBCPP_HIDE_FROM_ABI
- constexpr counted_iterator& operator++() {
+ _LIBCPP_HIDE_FROM_ABI constexpr counted_iterator& operator++() {
_LIBCPP_ASSERT_UNCATEGORIZED(__count_ > 0, "Iterator already at or past end.");
++__current_;
--__count_;
return *this;
}
- _LIBCPP_HIDE_FROM_ABI
- decltype(auto) operator++(int) {
+ _LIBCPP_HIDE_FROM_ABI decltype(auto) operator++(int) {
_LIBCPP_ASSERT_UNCATEGORIZED(__count_ > 0, "Iterator already at or past end.");
--__count_;
-#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- try { return __current_++; }
- catch(...) { ++__count_; throw; }
-#else
+# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
+ try {
+ return __current_++;
+ } catch (...) {
+ ++__count_;
+ throw;
+ }
+# else
return __current_++;
-#endif // _LIBCPP_HAS_NO_EXCEPTIONS
+# endif // _LIBCPP_HAS_NO_EXCEPTIONS
}
- _LIBCPP_HIDE_FROM_ABI
- constexpr counted_iterator operator++(int)
+ _LIBCPP_HIDE_FROM_ABI constexpr counted_iterator operator++(int)
requires forward_iterator<_Iter>
{
_LIBCPP_ASSERT_UNCATEGORIZED(__count_ > 0, "Iterator already at or past end.");
@@ -161,8 +153,7 @@ public:
return __tmp;
}
- _LIBCPP_HIDE_FROM_ABI
- constexpr counted_iterator& operator--()
+ _LIBCPP_HIDE_FROM_ABI constexpr counted_iterator& operator--()
requires bidirectional_iterator<_Iter>
{
--__current_;
@@ -170,8 +161,7 @@ public:
return *this;
}
- _LIBCPP_HIDE_FROM_ABI
- constexpr counted_iterator operator--(int)
+ _LIBCPP_HIDE_FROM_ABI constexpr counted_iterator operator--(int)
requires bidirectional_iterator<_Iter>
{
counted_iterator __tmp = *this;
@@ -179,23 +169,20 @@ public:
return __tmp;
}
- _LIBCPP_HIDE_FROM_ABI
- constexpr counted_iterator operator+(iter_difference_t<_Iter> __n) const
+ _LIBCPP_HIDE_FROM_ABI constexpr counted_iterator operator+(iter_difference_t<_Iter> __n) const
requires random_access_iterator<_Iter>
{
return counted_iterator(__current_ + __n, __count_ - __n);
}
- _LIBCPP_HIDE_FROM_ABI
- friend constexpr counted_iterator operator+(
- iter_difference_t<_Iter> __n, const counted_iterator& __x)
+ _LIBCPP_HIDE_FROM_ABI friend constexpr counted_iterator
+ operator+(iter_difference_t<_Iter> __n, const counted_iterator& __x)
requires random_access_iterator<_Iter>
{
return __x + __n;
}
- _LIBCPP_HIDE_FROM_ABI
- constexpr counted_iterator& operator+=(iter_difference_t<_Iter> __n)
+ _LIBCPP_HIDE_FROM_ABI constexpr counted_iterator& operator+=(iter_difference_t<_Iter> __n)
requires random_access_iterator<_Iter>
{
_LIBCPP_ASSERT_UNCATEGORIZED(__n <= __count_, "Cannot advance iterator past end.");
@@ -204,110 +191,93 @@ public:
return *this;
}
- _LIBCPP_HIDE_FROM_ABI
- constexpr counted_iterator operator-(iter_difference_t<_Iter> __n) const
+ _LIBCPP_HIDE_FROM_ABI constexpr counted_iterator operator-(iter_difference_t<_Iter> __n) const
requires random_access_iterator<_Iter>
{
return counted_iterator(__current_ - __n, __count_ + __n);
}
- template<common_with<_Iter> _I2>
- _LIBCPP_HIDE_FROM_ABI
- friend constexpr iter_difference_t<_I2> operator-(
- const counted_iterator& __lhs, const counted_iterator<_I2>& __rhs)
- {
+ template <common_with<_Iter> _I2>
+ _LIBCPP_HIDE_FROM_ABI friend constexpr iter_difference_t<_I2>
+ operator-(const counted_iterator& __lhs, const counted_iterator<_I2>& __rhs) {
return __rhs.__count_ - __lhs.__count_;
}
- _LIBCPP_HIDE_FROM_ABI
- friend constexpr iter_difference_t<_Iter> operator-(
- const counted_iterator& __lhs, default_sentinel_t)
- {
+ _LIBCPP_HIDE_FROM_ABI friend constexpr iter_difference_t<_Iter>
+ operator-(const counted_iterator& __lhs, default_sentinel_t) {
return -__lhs.__count_;
}
- _LIBCPP_HIDE_FROM_ABI
- friend constexpr iter_difference_t<_Iter> operator-(
- default_sentinel_t, const counted_iterator& __rhs)
- {
+ _LIBCPP_HIDE_FROM_ABI friend constexpr iter_difference_t<_Iter>
+ operator-(default_sentinel_t, const counted_iterator& __rhs) {
return __rhs.__count_;
}
- _LIBCPP_HIDE_FROM_ABI
- constexpr counted_iterator& operator-=(iter_difference_t<_Iter> __n)
+ _LIBCPP_HIDE_FROM_ABI constexpr counted_iterator& operator-=(iter_difference_t<_Iter> __n)
requires random_access_iterator<_Iter>
{
- _LIBCPP_ASSERT_UNCATEGORIZED(-__n <= __count_,
- "Attempt to subtract too large of a size: "
- "counted_iterator would be decremented before the "
- "first element of its range.");
+ _LIBCPP_ASSERT_UNCATEGORIZED(
+ -__n <= __count_,
+ "Attempt to subtract too large of a size: "
+ "counted_iterator would be decremented before the "
+ "first element of its range.");
__current_ -= __n;
__count_ += __n;
return *this;
}
- _LIBCPP_HIDE_FROM_ABI
- constexpr decltype(auto) operator[](iter_difference_t<_Iter> __n) const
+ _LIBCPP_HIDE_FROM_ABI constexpr decltype(auto) operator[](iter_difference_t<_Iter> __n) const
requires random_access_iterator<_Iter>
{
- _LIBCPP_ASSERT_UNCATEGORIZED(__n < __count_, "Subscript argument must be less than size.");
+ _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__n < __count_, "Subscript argument must be less than size.");
return __current_[__n];
}
- template<common_with<_Iter> _I2>
- _LIBCPP_HIDE_FROM_ABI
- friend constexpr bool operator==(
- const counted_iterator& __lhs, const counted_iterator<_I2>& __rhs)
- {
+ template <common_with<_Iter> _I2>
+ _LIBCPP_HIDE_FROM_ABI friend constexpr bool
+ operator==(const counted_iterator& __lhs, const counted_iterator<_I2>& __rhs) {
return __lhs.__count_ == __rhs.__count_;
}
- _LIBCPP_HIDE_FROM_ABI
- friend constexpr bool operator==(
- const counted_iterator& __lhs, default_sentinel_t)
- {
+ _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator==(const counted_iterator& __lhs, default_sentinel_t) {
return __lhs.__count_ == 0;
}
- template<common_with<_Iter> _I2>
- _LIBCPP_HIDE_FROM_ABI friend constexpr strong_ordering operator<=>(
- const counted_iterator& __lhs, const counted_iterator<_I2>& __rhs)
- {
+ template <common_with<_Iter> _I2>
+ _LIBCPP_HIDE_FROM_ABI friend constexpr strong_ordering
+ operator<=>(const counted_iterator& __lhs, const counted_iterator<_I2>& __rhs) {
return __rhs.__count_ <=> __lhs.__count_;
}
- _LIBCPP_HIDE_FROM_ABI
- friend constexpr iter_rvalue_reference_t<_Iter> iter_move(const counted_iterator& __i)
- noexcept(noexcept(ranges::iter_move(__i.__current_)))
- requires input_iterator<_Iter>
+ _LIBCPP_HIDE_FROM_ABI friend constexpr iter_rvalue_reference_t<_Iter>
+ iter_move(const counted_iterator& __i) noexcept(noexcept(ranges::iter_move(__i.__current_)))
+ requires input_iterator<_Iter>
{
- _LIBCPP_ASSERT_UNCATEGORIZED(__i.__count_ > 0, "Iterator must not be past end of range.");
+ _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__i.__count_ > 0, "Iterator must not be past end of range.");
return ranges::iter_move(__i.__current_);
}
- template<indirectly_swappable<_Iter> _I2>
- _LIBCPP_HIDE_FROM_ABI
- friend constexpr void iter_swap(const counted_iterator& __x, const counted_iterator<_I2>& __y)
- noexcept(noexcept(ranges::iter_swap(__x.__current_, __y.__current_)))
- {
- _LIBCPP_ASSERT_UNCATEGORIZED(__x.__count_ > 0 && __y.__count_ > 0,
- "Iterators must not be past end of range.");
+ template <indirectly_swappable<_Iter> _I2>
+ _LIBCPP_HIDE_FROM_ABI friend constexpr void
+ iter_swap(const counted_iterator& __x,
+ const counted_iterator<_I2>& __y) noexcept(noexcept(ranges::iter_swap(__x.__current_, __y.__current_))) {
+ _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
+ __x.__count_ > 0 && __y.__count_ > 0, "Iterators must not be past end of range.");
return ranges::iter_swap(__x.__current_, __y.__current_);
}
private:
_LIBCPP_NO_UNIQUE_ADDRESS _Iter __current_ = _Iter();
- iter_difference_t<_Iter> __count_ = 0;
- template<input_or_output_iterator _OtherIter>
+ iter_difference_t<_Iter> __count_ = 0;
+ template <input_or_output_iterator _OtherIter>
friend class counted_iterator;
};
_LIBCPP_CTAD_SUPPORTED_FOR_TYPE(counted_iterator);
-template<input_iterator _Iter>
+template <input_iterator _Iter>
requires same_as<_ITER_TRAITS<_Iter>, iterator_traits<_Iter>>
struct iterator_traits<counted_iterator<_Iter>> : iterator_traits<_Iter> {
- using pointer = conditional_t<contiguous_iterator<_Iter>,
- add_pointer_t<iter_reference_t<_Iter>>, void>;
+ using pointer = conditional_t<contiguous_iterator<_Iter>, add_pointer_t<iter_reference_t<_Iter>>, void>;
};
#endif // _LIBCPP_STD_VER >= 20
diff --git a/contrib/llvm-project/libcxx/include/__iterator/data.h b/contrib/llvm-project/libcxx/include/__iterator/data.h
index 894de49991d6..398673906101 100644
--- a/contrib/llvm-project/libcxx/include/__iterator/data.h
+++ b/contrib/llvm-project/libcxx/include/__iterator/data.h
@@ -22,27 +22,25 @@ _LIBCPP_BEGIN_NAMESPACE_STD
#if _LIBCPP_STD_VER >= 17
-template <class _Cont> constexpr
-_LIBCPP_HIDE_FROM_ABI
-auto data(_Cont& __c)
-_NOEXCEPT_(noexcept(__c.data()))
--> decltype (__c.data())
-{ return __c.data(); }
-
-template <class _Cont> constexpr
-_LIBCPP_HIDE_FROM_ABI
-auto data(const _Cont& __c)
-_NOEXCEPT_(noexcept(__c.data()))
--> decltype (__c.data())
-{ return __c.data(); }
+template <class _Cont>
+constexpr _LIBCPP_HIDE_FROM_ABI auto data(_Cont& __c) _NOEXCEPT_(noexcept(__c.data())) -> decltype(__c.data()) {
+ return __c.data();
+}
+
+template <class _Cont>
+constexpr _LIBCPP_HIDE_FROM_ABI auto data(const _Cont& __c) _NOEXCEPT_(noexcept(__c.data())) -> decltype(__c.data()) {
+ return __c.data();
+}
template <class _Tp, size_t _Sz>
-_LIBCPP_HIDE_FROM_ABI
-constexpr _Tp* data(_Tp (&__array)[_Sz]) noexcept { return __array; }
+_LIBCPP_HIDE_FROM_ABI constexpr _Tp* data(_Tp (&__array)[_Sz]) noexcept {
+ return __array;
+}
template <class _Ep>
-_LIBCPP_HIDE_FROM_ABI
-constexpr const _Ep* data(initializer_list<_Ep> __il) noexcept { return __il.begin(); }
+_LIBCPP_HIDE_FROM_ABI constexpr const _Ep* data(initializer_list<_Ep> __il) noexcept {
+ return __il.begin();
+}
#endif
diff --git a/contrib/llvm-project/libcxx/include/__iterator/default_sentinel.h b/contrib/llvm-project/libcxx/include/__iterator/default_sentinel.h
index d5fb2b699ad4..3b65f442f1a8 100644
--- a/contrib/llvm-project/libcxx/include/__iterator/default_sentinel.h
+++ b/contrib/llvm-project/libcxx/include/__iterator/default_sentinel.h
@@ -20,7 +20,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
#if _LIBCPP_STD_VER >= 20
-struct default_sentinel_t { };
+struct default_sentinel_t {};
inline constexpr default_sentinel_t default_sentinel{};
#endif // _LIBCPP_STD_VER >= 20
diff --git a/contrib/llvm-project/libcxx/include/__iterator/distance.h b/contrib/llvm-project/libcxx/include/__iterator/distance.h
index 83a926539095..75bd49c9ae73 100644
--- a/contrib/llvm-project/libcxx/include/__iterator/distance.h
+++ b/contrib/llvm-project/libcxx/include/__iterator/distance.h
@@ -27,30 +27,24 @@
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _InputIter>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
-typename iterator_traits<_InputIter>::difference_type
-__distance(_InputIter __first, _InputIter __last, input_iterator_tag)
-{
- typename iterator_traits<_InputIter>::difference_type __r(0);
- for (; __first != __last; ++__first)
- ++__r;
- return __r;
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 typename iterator_traits<_InputIter>::difference_type
+__distance(_InputIter __first, _InputIter __last, input_iterator_tag) {
+ typename iterator_traits<_InputIter>::difference_type __r(0);
+ for (; __first != __last; ++__first)
+ ++__r;
+ return __r;
}
template <class _RandIter>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
-typename iterator_traits<_RandIter>::difference_type
-__distance(_RandIter __first, _RandIter __last, random_access_iterator_tag)
-{
- return __last - __first;
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 typename iterator_traits<_RandIter>::difference_type
+__distance(_RandIter __first, _RandIter __last, random_access_iterator_tag) {
+ return __last - __first;
}
template <class _InputIter>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
-typename iterator_traits<_InputIter>::difference_type
-distance(_InputIter __first, _InputIter __last)
-{
- return std::__distance(__first, __last, typename iterator_traits<_InputIter>::iterator_category());
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 typename iterator_traits<_InputIter>::difference_type
+distance(_InputIter __first, _InputIter __last) {
+ return std::__distance(__first, __last, typename iterator_traits<_InputIter>::iterator_category());
}
#if _LIBCPP_STD_VER >= 20
@@ -61,10 +55,9 @@ namespace ranges {
namespace __distance {
struct __fn {
- template<class _Ip, sentinel_for<_Ip> _Sp>
- requires (!sized_sentinel_for<_Sp, _Ip>)
- _LIBCPP_HIDE_FROM_ABI
- constexpr iter_difference_t<_Ip> operator()(_Ip __first, _Sp __last) const {
+ template <class _Ip, sentinel_for<_Ip> _Sp>
+ requires(!sized_sentinel_for<_Sp, _Ip>)
+ _LIBCPP_HIDE_FROM_ABI constexpr iter_difference_t<_Ip> operator()(_Ip __first, _Sp __last) const {
iter_difference_t<_Ip> __n = 0;
while (__first != __last) {
++__first;
@@ -73,9 +66,8 @@ struct __fn {
return __n;
}
- template<class _Ip, sized_sentinel_for<decay_t<_Ip>> _Sp>
- _LIBCPP_HIDE_FROM_ABI
- constexpr iter_difference_t<_Ip> operator()(_Ip&& __first, _Sp __last) const {
+ template <class _Ip, sized_sentinel_for<decay_t<_Ip>> _Sp>
+ _LIBCPP_HIDE_FROM_ABI constexpr iter_difference_t<_Ip> operator()(_Ip&& __first, _Sp __last) const {
if constexpr (sized_sentinel_for<_Sp, __remove_cvref_t<_Ip>>) {
return __last - __first;
} else {
@@ -83,9 +75,8 @@ struct __fn {
}
}
- template<range _Rp>
- _LIBCPP_HIDE_FROM_ABI
- constexpr range_difference_t<_Rp> operator()(_Rp&& __r) const {
+ template <range _Rp>
+ _LIBCPP_HIDE_FROM_ABI constexpr range_difference_t<_Rp> operator()(_Rp&& __r) const {
if constexpr (sized_range<_Rp>) {
return static_cast<range_difference_t<_Rp>>(ranges::size(__r));
} else {
@@ -97,7 +88,7 @@ struct __fn {
} // namespace __distance
inline namespace __cpo {
- inline constexpr auto distance = __distance::__fn{};
+inline constexpr auto distance = __distance::__fn{};
} // namespace __cpo
} // namespace ranges
diff --git a/contrib/llvm-project/libcxx/include/__iterator/empty.h b/contrib/llvm-project/libcxx/include/__iterator/empty.h
index 6c7b0dcb1ebc..3ca0aff6be46 100644
--- a/contrib/llvm-project/libcxx/include/__iterator/empty.h
+++ b/contrib/llvm-project/libcxx/include/__iterator/empty.h
@@ -23,19 +23,20 @@ _LIBCPP_BEGIN_NAMESPACE_STD
#if _LIBCPP_STD_VER >= 17
template <class _Cont>
-_LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_HIDE_FROM_ABI
-constexpr auto empty(const _Cont& __c)
-_NOEXCEPT_(noexcept(__c.empty()))
--> decltype (__c.empty())
-{ return __c.empty(); }
+_LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_HIDE_FROM_ABI constexpr auto empty(const _Cont& __c)
+ _NOEXCEPT_(noexcept(__c.empty())) -> decltype(__c.empty()) {
+ return __c.empty();
+}
template <class _Tp, size_t _Sz>
-_LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_HIDE_FROM_ABI
-constexpr bool empty(const _Tp (&)[_Sz]) noexcept { return false; }
+_LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_HIDE_FROM_ABI constexpr bool empty(const _Tp (&)[_Sz]) noexcept {
+ return false;
+}
template <class _Ep>
-_LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_HIDE_FROM_ABI
-constexpr bool empty(initializer_list<_Ep> __il) noexcept { return __il.size() == 0; }
+_LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_HIDE_FROM_ABI constexpr bool empty(initializer_list<_Ep> __il) noexcept {
+ return __il.size() == 0;
+}
#endif // _LIBCPP_STD_VER >= 17
diff --git a/contrib/llvm-project/libcxx/include/__iterator/erase_if_container.h b/contrib/llvm-project/libcxx/include/__iterator/erase_if_container.h
index 532ec9c1de0b..0f87f50cd1c1 100644
--- a/contrib/llvm-project/libcxx/include/__iterator/erase_if_container.h
+++ b/contrib/llvm-project/libcxx/include/__iterator/erase_if_container.h
@@ -22,9 +22,7 @@ _LIBCPP_PUSH_MACROS
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _Container, class _Predicate>
-_LIBCPP_HIDE_FROM_ABI
-typename _Container::size_type
-__libcpp_erase_if_container(_Container& __c, _Predicate& __pred) {
+_LIBCPP_HIDE_FROM_ABI typename _Container::size_type __libcpp_erase_if_container(_Container& __c, _Predicate& __pred) {
typename _Container::size_type __old_size = __c.size();
const typename _Container::iterator __last = __c.end();
diff --git a/contrib/llvm-project/libcxx/include/__iterator/front_insert_iterator.h b/contrib/llvm-project/libcxx/include/__iterator/front_insert_iterator.h
index f9aa442177b2..7f2c54ec8744 100644
--- a/contrib/llvm-project/libcxx/include/__iterator/front_insert_iterator.h
+++ b/contrib/llvm-project/libcxx/include/__iterator/front_insert_iterator.h
@@ -33,40 +33,47 @@ class _LIBCPP_TEMPLATE_VIS front_insert_iterator
: public iterator<output_iterator_tag, void, void, void, void>
#endif
{
-_LIBCPP_SUPPRESS_DEPRECATED_POP
+ _LIBCPP_SUPPRESS_DEPRECATED_POP
+
protected:
- _Container* container;
+ _Container* container;
+
public:
- typedef output_iterator_tag iterator_category;
- typedef void value_type;
+ typedef output_iterator_tag iterator_category;
+ typedef void value_type;
#if _LIBCPP_STD_VER >= 20
- typedef ptrdiff_t difference_type;
+ typedef ptrdiff_t difference_type;
#else
- typedef void difference_type;
+ typedef void difference_type;
#endif
- typedef void pointer;
- typedef void reference;
- typedef _Container container_type;
+ typedef void pointer;
+ typedef void reference;
+ typedef _Container container_type;
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 explicit front_insert_iterator(_Container& __x) : container(std::addressof(__x)) {}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 front_insert_iterator& operator=(const typename _Container::value_type& __value)
- {container->push_front(__value); return *this;}
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 explicit front_insert_iterator(_Container& __x)
+ : container(std::addressof(__x)) {}
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 front_insert_iterator&
+ operator=(const typename _Container::value_type& __value) {
+ container->push_front(__value);
+ return *this;
+ }
#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 front_insert_iterator& operator=(typename _Container::value_type&& __value)
- {container->push_front(std::move(__value)); return *this;}
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 front_insert_iterator&
+ operator=(typename _Container::value_type&& __value) {
+ container->push_front(std::move(__value));
+ return *this;
+ }
#endif // _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 front_insert_iterator& operator*() {return *this;}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 front_insert_iterator& operator++() {return *this;}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 front_insert_iterator operator++(int) {return *this;}
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 front_insert_iterator& operator*() { return *this; }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 front_insert_iterator& operator++() { return *this; }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 front_insert_iterator operator++(int) { return *this; }
};
_LIBCPP_CTAD_SUPPORTED_FOR_TYPE(front_insert_iterator);
template <class _Container>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-front_insert_iterator<_Container>
-front_inserter(_Container& __x)
-{
- return front_insert_iterator<_Container>(__x);
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 front_insert_iterator<_Container>
+front_inserter(_Container& __x) {
+ return front_insert_iterator<_Container>(__x);
}
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__iterator/incrementable_traits.h b/contrib/llvm-project/libcxx/include/__iterator/incrementable_traits.h
index 604e9580ef7c..a228b228f6e5 100644
--- a/contrib/llvm-project/libcxx/include/__iterator/incrementable_traits.h
+++ b/contrib/llvm-project/libcxx/include/__iterator/incrementable_traits.h
@@ -29,33 +29,33 @@ _LIBCPP_BEGIN_NAMESPACE_STD
#if _LIBCPP_STD_VER >= 20
// [incrementable.traits]
-template<class> struct incrementable_traits {};
+template <class>
+struct incrementable_traits {};
-template<class _Tp>
-requires is_object_v<_Tp>
+template <class _Tp>
+ requires is_object_v<_Tp>
struct incrementable_traits<_Tp*> {
using difference_type = ptrdiff_t;
};
-template<class _Ip>
+template <class _Ip>
struct incrementable_traits<const _Ip> : incrementable_traits<_Ip> {};
-template<class _Tp>
+template <class _Tp>
concept __has_member_difference_type = requires { typename _Tp::difference_type; };
-template<__has_member_difference_type _Tp>
+template <__has_member_difference_type _Tp>
struct incrementable_traits<_Tp> {
using difference_type = typename _Tp::difference_type;
};
-template<class _Tp>
-concept __has_integral_minus =
- requires(const _Tp& __x, const _Tp& __y) {
- { __x - __y } -> integral;
- };
+template <class _Tp>
+concept __has_integral_minus = requires(const _Tp& __x, const _Tp& __y) {
+ { __x - __y } -> integral;
+};
-template<__has_integral_minus _Tp>
-requires (!__has_member_difference_type<_Tp>)
+template <__has_integral_minus _Tp>
+ requires(!__has_member_difference_type<_Tp>)
struct incrementable_traits<_Tp> {
using difference_type = make_signed_t<decltype(std::declval<_Tp>() - std::declval<_Tp>())>;
};
@@ -67,9 +67,10 @@ struct iterator_traits;
// `incrementable_traits<RI>::difference_type` if `iterator_traits<RI>` names a specialization
// generated from the primary template, and `iterator_traits<RI>::difference_type` otherwise.
template <class _Ip>
-using iter_difference_t = typename conditional_t<__is_primary_template<iterator_traits<remove_cvref_t<_Ip> > >::value,
- incrementable_traits<remove_cvref_t<_Ip> >,
- iterator_traits<remove_cvref_t<_Ip> > >::difference_type;
+using iter_difference_t =
+ typename conditional_t<__is_primary_template<iterator_traits<remove_cvref_t<_Ip> > >::value,
+ incrementable_traits<remove_cvref_t<_Ip> >,
+ iterator_traits<remove_cvref_t<_Ip> > >::difference_type;
#endif // _LIBCPP_STD_VER >= 20
diff --git a/contrib/llvm-project/libcxx/include/__iterator/indirectly_comparable.h b/contrib/llvm-project/libcxx/include/__iterator/indirectly_comparable.h
index e60ba25ca768..e8a7398bacd2 100644
--- a/contrib/llvm-project/libcxx/include/__iterator/indirectly_comparable.h
+++ b/contrib/llvm-project/libcxx/include/__iterator/indirectly_comparable.h
@@ -24,8 +24,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
#if _LIBCPP_STD_VER >= 20
template <class _I1, class _I2, class _Rp, class _P1 = identity, class _P2 = identity>
-concept indirectly_comparable =
- indirect_binary_predicate<_Rp, projected<_I1, _P1>, projected<_I2, _P2>>;
+concept indirectly_comparable = indirect_binary_predicate<_Rp, projected<_I1, _P1>, projected<_I2, _P2>>;
#endif // _LIBCPP_STD_VER >= 20
diff --git a/contrib/llvm-project/libcxx/include/__iterator/insert_iterator.h b/contrib/llvm-project/libcxx/include/__iterator/insert_iterator.h
index 1a9c74a16f4f..8b7574dc9ec0 100644
--- a/contrib/llvm-project/libcxx/include/__iterator/insert_iterator.h
+++ b/contrib/llvm-project/libcxx/include/__iterator/insert_iterator.h
@@ -42,41 +42,50 @@ class _LIBCPP_TEMPLATE_VIS insert_iterator
: public iterator<output_iterator_tag, void, void, void, void>
#endif
{
-_LIBCPP_SUPPRESS_DEPRECATED_POP
+ _LIBCPP_SUPPRESS_DEPRECATED_POP
+
protected:
- _Container* container;
- __insert_iterator_iter_t<_Container> iter;
+ _Container* container;
+ __insert_iterator_iter_t<_Container> iter;
+
public:
- typedef output_iterator_tag iterator_category;
- typedef void value_type;
+ typedef output_iterator_tag iterator_category;
+ typedef void value_type;
#if _LIBCPP_STD_VER >= 20
- typedef ptrdiff_t difference_type;
+ typedef ptrdiff_t difference_type;
#else
- typedef void difference_type;
+ typedef void difference_type;
#endif
- typedef void pointer;
- typedef void reference;
- typedef _Container container_type;
+ typedef void pointer;
+ typedef void reference;
+ typedef _Container container_type;
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 insert_iterator(_Container& __x, __insert_iterator_iter_t<_Container> __i)
- : container(std::addressof(__x)), iter(__i) {}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 insert_iterator& operator=(const typename _Container::value_type& __value)
- {iter = container->insert(iter, __value); ++iter; return *this;}
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
+ insert_iterator(_Container& __x, __insert_iterator_iter_t<_Container> __i)
+ : container(std::addressof(__x)), iter(__i) {}
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 insert_iterator&
+ operator=(const typename _Container::value_type& __value) {
+ iter = container->insert(iter, __value);
+ ++iter;
+ return *this;
+ }
#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 insert_iterator& operator=(typename _Container::value_type&& __value)
- {iter = container->insert(iter, std::move(__value)); ++iter; return *this;}
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 insert_iterator&
+ operator=(typename _Container::value_type&& __value) {
+ iter = container->insert(iter, std::move(__value));
+ ++iter;
+ return *this;
+ }
#endif // _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 insert_iterator& operator*() {return *this;}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 insert_iterator& operator++() {return *this;}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 insert_iterator& operator++(int) {return *this;}
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 insert_iterator& operator*() { return *this; }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 insert_iterator& operator++() { return *this; }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 insert_iterator& operator++(int) { return *this; }
};
template <class _Container>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-insert_iterator<_Container>
-inserter(_Container& __x, __insert_iterator_iter_t<_Container> __i)
-{
- return insert_iterator<_Container>(__x, __i);
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 insert_iterator<_Container>
+inserter(_Container& __x, __insert_iterator_iter_t<_Container> __i) {
+ return insert_iterator<_Container>(__x, __i);
}
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__iterator/istream_iterator.h b/contrib/llvm-project/libcxx/include/__iterator/istream_iterator.h
index 2efe5772ba61..58c9ac6d4ccc 100644
--- a/contrib/llvm-project/libcxx/include/__iterator/istream_iterator.h
+++ b/contrib/llvm-project/libcxx/include/__iterator/istream_iterator.h
@@ -26,78 +26,73 @@
_LIBCPP_BEGIN_NAMESPACE_STD
_LIBCPP_SUPPRESS_DEPRECATED_PUSH
-template <class _Tp, class _CharT = char,
- class _Traits = char_traits<_CharT>, class _Distance = ptrdiff_t>
+template <class _Tp, class _CharT = char, class _Traits = char_traits<_CharT>, class _Distance = ptrdiff_t>
class _LIBCPP_TEMPLATE_VIS istream_iterator
#if _LIBCPP_STD_VER <= 14 || !defined(_LIBCPP_ABI_NO_ITERATOR_BASES)
: public iterator<input_iterator_tag, _Tp, _Distance, const _Tp*, const _Tp&>
#endif
{
-_LIBCPP_SUPPRESS_DEPRECATED_POP
+ _LIBCPP_SUPPRESS_DEPRECATED_POP
+
public:
- typedef input_iterator_tag iterator_category;
- typedef _Tp value_type;
- typedef _Distance difference_type;
- typedef const _Tp* pointer;
- typedef const _Tp& reference;
- typedef _CharT char_type;
- typedef _Traits traits_type;
- typedef basic_istream<_CharT,_Traits> istream_type;
+ typedef input_iterator_tag iterator_category;
+ typedef _Tp value_type;
+ typedef _Distance difference_type;
+ typedef const _Tp* pointer;
+ typedef const _Tp& reference;
+ typedef _CharT char_type;
+ typedef _Traits traits_type;
+ typedef basic_istream<_CharT, _Traits> istream_type;
+
private:
- istream_type* __in_stream_;
- _Tp __value_;
+ istream_type* __in_stream_;
+ _Tp __value_;
+
public:
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR istream_iterator() : __in_stream_(nullptr), __value_() {}
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR istream_iterator() : __in_stream_(nullptr), __value_() {}
#if _LIBCPP_STD_VER >= 20
- _LIBCPP_HIDE_FROM_ABI constexpr istream_iterator(default_sentinel_t) : istream_iterator() {}
+ _LIBCPP_HIDE_FROM_ABI constexpr istream_iterator(default_sentinel_t) : istream_iterator() {}
#endif // _LIBCPP_STD_VER >= 20
- _LIBCPP_HIDE_FROM_ABI istream_iterator(istream_type& __s) : __in_stream_(std::addressof(__s))
- {
- if (!(*__in_stream_ >> __value_))
- __in_stream_ = nullptr;
- }
+ _LIBCPP_HIDE_FROM_ABI istream_iterator(istream_type& __s) : __in_stream_(std::addressof(__s)) {
+ if (!(*__in_stream_ >> __value_))
+ __in_stream_ = nullptr;
+ }
- _LIBCPP_HIDE_FROM_ABI const _Tp& operator*() const {return __value_;}
- _LIBCPP_HIDE_FROM_ABI const _Tp* operator->() const {return std::addressof((operator*()));}
- _LIBCPP_HIDE_FROM_ABI istream_iterator& operator++()
- {
- if (!(*__in_stream_ >> __value_))
- __in_stream_ = nullptr;
- return *this;
- }
- _LIBCPP_HIDE_FROM_ABI istream_iterator operator++(int)
- {istream_iterator __t(*this); ++(*this); return __t;}
+ _LIBCPP_HIDE_FROM_ABI const _Tp& operator*() const { return __value_; }
+ _LIBCPP_HIDE_FROM_ABI const _Tp* operator->() const { return std::addressof((operator*())); }
+ _LIBCPP_HIDE_FROM_ABI istream_iterator& operator++() {
+ if (!(*__in_stream_ >> __value_))
+ __in_stream_ = nullptr;
+ return *this;
+ }
+ _LIBCPP_HIDE_FROM_ABI istream_iterator operator++(int) {
+ istream_iterator __t(*this);
+ ++(*this);
+ return __t;
+ }
- template <class _Up, class _CharU, class _TraitsU, class _DistanceU>
- friend _LIBCPP_HIDE_FROM_ABI
- bool
- operator==(const istream_iterator<_Up, _CharU, _TraitsU, _DistanceU>& __x,
- const istream_iterator<_Up, _CharU, _TraitsU, _DistanceU>& __y);
+ template <class _Up, class _CharU, class _TraitsU, class _DistanceU>
+ friend _LIBCPP_HIDE_FROM_ABI bool operator==(const istream_iterator<_Up, _CharU, _TraitsU, _DistanceU>& __x,
+ const istream_iterator<_Up, _CharU, _TraitsU, _DistanceU>& __y);
#if _LIBCPP_STD_VER >= 20
- friend _LIBCPP_HIDE_FROM_ABI bool operator==(const istream_iterator& __i, default_sentinel_t) {
- return __i.__in_stream_ == nullptr;
- }
+ friend _LIBCPP_HIDE_FROM_ABI bool operator==(const istream_iterator& __i, default_sentinel_t) {
+ return __i.__in_stream_ == nullptr;
+ }
#endif // _LIBCPP_STD_VER >= 20
};
template <class _Tp, class _CharT, class _Traits, class _Distance>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator==(const istream_iterator<_Tp, _CharT, _Traits, _Distance>& __x,
- const istream_iterator<_Tp, _CharT, _Traits, _Distance>& __y)
-{
- return __x.__in_stream_ == __y.__in_stream_;
+inline _LIBCPP_HIDE_FROM_ABI bool operator==(const istream_iterator<_Tp, _CharT, _Traits, _Distance>& __x,
+ const istream_iterator<_Tp, _CharT, _Traits, _Distance>& __y) {
+ return __x.__in_stream_ == __y.__in_stream_;
}
#if _LIBCPP_STD_VER <= 17
template <class _Tp, class _CharT, class _Traits, class _Distance>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator!=(const istream_iterator<_Tp, _CharT, _Traits, _Distance>& __x,
- const istream_iterator<_Tp, _CharT, _Traits, _Distance>& __y)
-{
- return !(__x == __y);
+inline _LIBCPP_HIDE_FROM_ABI bool operator!=(const istream_iterator<_Tp, _CharT, _Traits, _Distance>& __x,
+ const istream_iterator<_Tp, _CharT, _Traits, _Distance>& __y) {
+ return !(__x == __y);
}
#endif // _LIBCPP_STD_VER <= 17
diff --git a/contrib/llvm-project/libcxx/include/__iterator/istreambuf_iterator.h b/contrib/llvm-project/libcxx/include/__iterator/istreambuf_iterator.h
index ed5012a68d82..51c4ecff351f 100644
--- a/contrib/llvm-project/libcxx/include/__iterator/istreambuf_iterator.h
+++ b/contrib/llvm-project/libcxx/include/__iterator/istreambuf_iterator.h
@@ -24,95 +24,84 @@
_LIBCPP_BEGIN_NAMESPACE_STD
_LIBCPP_SUPPRESS_DEPRECATED_PUSH
-template<class _CharT, class _Traits>
+template <class _CharT, class _Traits>
class _LIBCPP_TEMPLATE_VIS istreambuf_iterator
#if _LIBCPP_STD_VER <= 14 || !defined(_LIBCPP_ABI_NO_ITERATOR_BASES)
- : public iterator<input_iterator_tag, _CharT,
- typename _Traits::off_type, _CharT*,
- _CharT>
+ : public iterator<input_iterator_tag, _CharT, typename _Traits::off_type, _CharT*, _CharT>
#endif
{
-_LIBCPP_SUPPRESS_DEPRECATED_POP
+ _LIBCPP_SUPPRESS_DEPRECATED_POP
+
public:
- typedef input_iterator_tag iterator_category;
- typedef _CharT value_type;
- typedef typename _Traits::off_type difference_type;
- typedef _CharT* pointer;
- typedef _CharT reference;
- typedef _CharT char_type;
- typedef _Traits traits_type;
- typedef typename _Traits::int_type int_type;
- typedef basic_streambuf<_CharT,_Traits> streambuf_type;
- typedef basic_istream<_CharT,_Traits> istream_type;
+ typedef input_iterator_tag iterator_category;
+ typedef _CharT value_type;
+ typedef typename _Traits::off_type difference_type;
+ typedef _CharT* pointer;
+ typedef _CharT reference;
+ typedef _CharT char_type;
+ typedef _Traits traits_type;
+ typedef typename _Traits::int_type int_type;
+ typedef basic_streambuf<_CharT, _Traits> streambuf_type;
+ typedef basic_istream<_CharT, _Traits> istream_type;
+
private:
- mutable streambuf_type* __sbuf_;
-
- class __proxy
- {
- char_type __keep_;
- streambuf_type* __sbuf_;
- _LIBCPP_HIDE_FROM_ABI
- explicit __proxy(char_type __c, streambuf_type* __s)
- : __keep_(__c), __sbuf_(__s) {}
- friend class istreambuf_iterator;
- public:
- _LIBCPP_HIDE_FROM_ABI char_type operator*() const {return __keep_;}
- };
-
- _LIBCPP_HIDE_FROM_ABI
- bool __test_for_eof() const
- {
- if (__sbuf_ && traits_type::eq_int_type(__sbuf_->sgetc(), traits_type::eof()))
- __sbuf_ = nullptr;
- return __sbuf_ == nullptr;
- }
+ mutable streambuf_type* __sbuf_;
+
+ class __proxy {
+ char_type __keep_;
+ streambuf_type* __sbuf_;
+ _LIBCPP_HIDE_FROM_ABI explicit __proxy(char_type __c, streambuf_type* __s) : __keep_(__c), __sbuf_(__s) {}
+ friend class istreambuf_iterator;
+
+ public:
+ _LIBCPP_HIDE_FROM_ABI char_type operator*() const { return __keep_; }
+ };
+
+ _LIBCPP_HIDE_FROM_ABI bool __test_for_eof() const {
+ if (__sbuf_ && traits_type::eq_int_type(__sbuf_->sgetc(), traits_type::eof()))
+ __sbuf_ = nullptr;
+ return __sbuf_ == nullptr;
+ }
+
public:
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR istreambuf_iterator() _NOEXCEPT : __sbuf_(nullptr) {}
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR istreambuf_iterator() _NOEXCEPT : __sbuf_(nullptr) {}
#if _LIBCPP_STD_VER >= 20
- _LIBCPP_HIDE_FROM_ABI constexpr istreambuf_iterator(default_sentinel_t) noexcept
- : istreambuf_iterator() {}
+ _LIBCPP_HIDE_FROM_ABI constexpr istreambuf_iterator(default_sentinel_t) noexcept : istreambuf_iterator() {}
#endif // _LIBCPP_STD_VER >= 20
- _LIBCPP_HIDE_FROM_ABI istreambuf_iterator(istream_type& __s) _NOEXCEPT
- : __sbuf_(__s.rdbuf()) {}
- _LIBCPP_HIDE_FROM_ABI istreambuf_iterator(streambuf_type* __s) _NOEXCEPT
- : __sbuf_(__s) {}
- _LIBCPP_HIDE_FROM_ABI istreambuf_iterator(const __proxy& __p) _NOEXCEPT
- : __sbuf_(__p.__sbuf_) {}
-
- _LIBCPP_HIDE_FROM_ABI char_type operator*() const
- {return static_cast<char_type>(__sbuf_->sgetc());}
- _LIBCPP_HIDE_FROM_ABI istreambuf_iterator& operator++()
- {
- __sbuf_->sbumpc();
- return *this;
- }
- _LIBCPP_HIDE_FROM_ABI __proxy operator++(int)
- {
- return __proxy(__sbuf_->sbumpc(), __sbuf_);
- }
-
- _LIBCPP_HIDE_FROM_ABI bool equal(const istreambuf_iterator& __b) const
- {return __test_for_eof() == __b.__test_for_eof();}
+ _LIBCPP_HIDE_FROM_ABI istreambuf_iterator(istream_type& __s) _NOEXCEPT : __sbuf_(__s.rdbuf()) {}
+ _LIBCPP_HIDE_FROM_ABI istreambuf_iterator(streambuf_type* __s) _NOEXCEPT : __sbuf_(__s) {}
+ _LIBCPP_HIDE_FROM_ABI istreambuf_iterator(const __proxy& __p) _NOEXCEPT : __sbuf_(__p.__sbuf_) {}
+
+ _LIBCPP_HIDE_FROM_ABI char_type operator*() const { return static_cast<char_type>(__sbuf_->sgetc()); }
+ _LIBCPP_HIDE_FROM_ABI istreambuf_iterator& operator++() {
+ __sbuf_->sbumpc();
+ return *this;
+ }
+ _LIBCPP_HIDE_FROM_ABI __proxy operator++(int) { return __proxy(__sbuf_->sbumpc(), __sbuf_); }
+
+ _LIBCPP_HIDE_FROM_ABI bool equal(const istreambuf_iterator& __b) const {
+ return __test_for_eof() == __b.__test_for_eof();
+ }
#if _LIBCPP_STD_VER >= 20
- friend _LIBCPP_HIDE_FROM_ABI bool operator==(const istreambuf_iterator& __i, default_sentinel_t) {
- return __i.__test_for_eof();
- }
+ friend _LIBCPP_HIDE_FROM_ABI bool operator==(const istreambuf_iterator& __i, default_sentinel_t) {
+ return __i.__test_for_eof();
+ }
#endif // _LIBCPP_STD_VER >= 20
};
template <class _CharT, class _Traits>
-inline _LIBCPP_HIDE_FROM_ABI
-bool operator==(const istreambuf_iterator<_CharT,_Traits>& __a,
- const istreambuf_iterator<_CharT,_Traits>& __b)
- {return __a.equal(__b);}
+inline _LIBCPP_HIDE_FROM_ABI bool
+operator==(const istreambuf_iterator<_CharT, _Traits>& __a, const istreambuf_iterator<_CharT, _Traits>& __b) {
+ return __a.equal(__b);
+}
#if _LIBCPP_STD_VER <= 17
template <class _CharT, class _Traits>
-inline _LIBCPP_HIDE_FROM_ABI
-bool operator!=(const istreambuf_iterator<_CharT,_Traits>& __a,
- const istreambuf_iterator<_CharT,_Traits>& __b)
- {return !__a.equal(__b);}
+inline _LIBCPP_HIDE_FROM_ABI bool
+operator!=(const istreambuf_iterator<_CharT, _Traits>& __a, const istreambuf_iterator<_CharT, _Traits>& __b) {
+ return !__a.equal(__b);
+}
#endif // _LIBCPP_STD_VER <= 17
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__iterator/iter_move.h b/contrib/llvm-project/libcxx/include/__iterator/iter_move.h
index d9ff90bf6545..202b94cccc5a 100644
--- a/contrib/llvm-project/libcxx/include/__iterator/iter_move.h
+++ b/contrib/llvm-project/libcxx/include/__iterator/iter_move.h
@@ -38,66 +38,60 @@ namespace __iter_move {
void iter_move();
template <class _Tp>
-concept __unqualified_iter_move =
- __class_or_enum<remove_cvref_t<_Tp>> &&
- requires (_Tp&& __t) {
- // NOLINTNEXTLINE(libcpp-robust-against-adl) iter_swap ADL calls should only be made through ranges::iter_swap
- iter_move(std::forward<_Tp>(__t));
- };
-
-template<class _Tp>
-concept __move_deref =
- !__unqualified_iter_move<_Tp> &&
- requires (_Tp&& __t) {
- *__t;
- requires is_lvalue_reference_v<decltype(*__t)>;
- };
-
-template<class _Tp>
-concept __just_deref =
- !__unqualified_iter_move<_Tp> &&
- !__move_deref<_Tp> &&
- requires (_Tp&& __t) {
- *__t;
- requires (!is_lvalue_reference_v<decltype(*__t)>);
- };
+concept __unqualified_iter_move = __class_or_enum<remove_cvref_t<_Tp>> && requires(_Tp&& __t) {
+ // NOLINTNEXTLINE(libcpp-robust-against-adl) iter_swap ADL calls should only be made through ranges::iter_swap
+ iter_move(std::forward<_Tp>(__t));
+};
+
+template <class _Tp>
+concept __move_deref = !__unqualified_iter_move<_Tp> && requires(_Tp&& __t) {
+ *__t;
+ requires is_lvalue_reference_v<decltype(*__t)>;
+};
+
+template <class _Tp>
+concept __just_deref = !__unqualified_iter_move<_Tp> && !__move_deref<_Tp> && requires(_Tp&& __t) {
+ *__t;
+ requires(!is_lvalue_reference_v<decltype(*__t)>);
+};
// [iterator.cust.move]
struct __fn {
// NOLINTBEGIN(libcpp-robust-against-adl) iter_move ADL calls should only be made through ranges::iter_move
- template<class _Ip>
+ template <class _Ip>
requires __unqualified_iter_move<_Ip>
[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr decltype(auto) operator()(_Ip&& __i) const
- noexcept(noexcept(iter_move(std::forward<_Ip>(__i))))
- {
+ noexcept(noexcept(iter_move(std::forward<_Ip>(__i)))) {
return iter_move(std::forward<_Ip>(__i));
}
// NOLINTEND(libcpp-robust-against-adl)
- template<class _Ip>
+ template <class _Ip>
requires __move_deref<_Ip>
[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Ip&& __i) const
- noexcept(noexcept(std::move(*std::forward<_Ip>(__i))))
- -> decltype( std::move(*std::forward<_Ip>(__i)))
- { return std::move(*std::forward<_Ip>(__i)); }
+ noexcept(noexcept(std::move(*std::forward<_Ip>(__i)))) -> decltype(std::move(*std::forward<_Ip>(__i))) {
+ return std::move(*std::forward<_Ip>(__i));
+ }
- template<class _Ip>
+ template <class _Ip>
requires __just_deref<_Ip>
[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Ip&& __i) const
- noexcept(noexcept(*std::forward<_Ip>(__i)))
- -> decltype( *std::forward<_Ip>(__i))
- { return *std::forward<_Ip>(__i); }
+ noexcept(noexcept(*std::forward<_Ip>(__i))) -> decltype(*std::forward<_Ip>(__i)) {
+ return *std::forward<_Ip>(__i);
+ }
};
} // namespace __iter_move
inline namespace __cpo {
- inline constexpr auto iter_move = __iter_move::__fn{};
+inline constexpr auto iter_move = __iter_move::__fn{};
} // namespace __cpo
} // namespace ranges
-template<__dereferenceable _Tp>
- requires requires(_Tp& __t) { { ranges::iter_move(__t) } -> __can_reference; }
+template <__dereferenceable _Tp>
+ requires requires(_Tp& __t) {
+ { ranges::iter_move(__t) } -> __can_reference;
+ }
using iter_rvalue_reference_t = decltype(ranges::iter_move(std::declval<_Tp&>()));
#endif // _LIBCPP_STD_VER >= 20
diff --git a/contrib/llvm-project/libcxx/include/__iterator/iter_swap.h b/contrib/llvm-project/libcxx/include/__iterator/iter_swap.h
index 23d3e4009f53..52c3f095e7fb 100644
--- a/contrib/llvm-project/libcxx/include/__iterator/iter_swap.h
+++ b/contrib/llvm-project/libcxx/include/__iterator/iter_swap.h
@@ -37,77 +37,67 @@ _LIBCPP_BEGIN_NAMESPACE_STD
namespace ranges {
namespace __iter_swap {
- template<class _I1, class _I2>
- void iter_swap(_I1, _I2) = delete;
+template <class _I1, class _I2>
+void iter_swap(_I1, _I2) = delete;
- template<class _T1, class _T2>
- concept __unqualified_iter_swap =
- (__class_or_enum<remove_cvref_t<_T1>> || __class_or_enum<remove_cvref_t<_T2>>) &&
- requires (_T1&& __x, _T2&& __y) {
+template <class _T1, class _T2>
+concept __unqualified_iter_swap =
+ (__class_or_enum<remove_cvref_t<_T1>> || __class_or_enum<remove_cvref_t<_T2>>)&&requires(_T1&& __x, _T2&& __y) {
// NOLINTNEXTLINE(libcpp-robust-against-adl) iter_swap ADL calls should only be made through ranges::iter_swap
iter_swap(std::forward<_T1>(__x), std::forward<_T2>(__y));
};
- template<class _T1, class _T2>
- concept __readable_swappable =
+template <class _T1, class _T2>
+concept __readable_swappable =
indirectly_readable<_T1> && indirectly_readable<_T2> &&
swappable_with<iter_reference_t<_T1>, iter_reference_t<_T2>>;
-
- struct __fn {
- // NOLINTBEGIN(libcpp-robust-against-adl) iter_swap ADL calls should only be made through ranges::iter_swap
- template <class _T1, class _T2>
- requires __unqualified_iter_swap<_T1, _T2>
- _LIBCPP_HIDE_FROM_ABI
- constexpr void operator()(_T1&& __x, _T2&& __y) const
- noexcept(noexcept(iter_swap(std::forward<_T1>(__x), std::forward<_T2>(__y))))
- {
- (void)iter_swap(std::forward<_T1>(__x), std::forward<_T2>(__y));
- }
- // NOLINTEND(libcpp-robust-against-adl)
-
- template <class _T1, class _T2>
- requires (!__unqualified_iter_swap<_T1, _T2>) &&
- __readable_swappable<_T1, _T2>
- _LIBCPP_HIDE_FROM_ABI
- constexpr void operator()(_T1&& __x, _T2&& __y) const
- noexcept(noexcept(ranges::swap(*std::forward<_T1>(__x), *std::forward<_T2>(__y))))
- {
- ranges::swap(*std::forward<_T1>(__x), *std::forward<_T2>(__y));
- }
-
- template <class _T1, class _T2>
- requires (!__unqualified_iter_swap<_T1, _T2> && //
- !__readable_swappable<_T1, _T2>) && //
- indirectly_movable_storable<_T1, _T2> && //
- indirectly_movable_storable<_T2, _T1>
- _LIBCPP_HIDE_FROM_ABI
- constexpr void operator()(_T1&& __x, _T2&& __y) const
+struct __fn {
+ // NOLINTBEGIN(libcpp-robust-against-adl) iter_swap ADL calls should only be made through ranges::iter_swap
+ template <class _T1, class _T2>
+ requires __unqualified_iter_swap<_T1, _T2>
+ _LIBCPP_HIDE_FROM_ABI constexpr void operator()(_T1&& __x, _T2&& __y) const
+ noexcept(noexcept(iter_swap(std::forward<_T1>(__x), std::forward<_T2>(__y)))) {
+ (void)iter_swap(std::forward<_T1>(__x), std::forward<_T2>(__y));
+ }
+ // NOLINTEND(libcpp-robust-against-adl)
+
+ template <class _T1, class _T2>
+ requires(!__unqualified_iter_swap<_T1, _T2>) && __readable_swappable<_T1, _T2>
+ _LIBCPP_HIDE_FROM_ABI constexpr void operator()(_T1&& __x, _T2&& __y) const
+ noexcept(noexcept(ranges::swap(*std::forward<_T1>(__x), *std::forward<_T2>(__y)))) {
+ ranges::swap(*std::forward<_T1>(__x), *std::forward<_T2>(__y));
+ }
+
+ template <class _T1, class _T2>
+ requires(!__unqualified_iter_swap<_T1, _T2> && //
+ !__readable_swappable<_T1, _T2>) && //
+ indirectly_movable_storable<_T1, _T2> && //
+ indirectly_movable_storable<_T2, _T1>
+ _LIBCPP_HIDE_FROM_ABI constexpr void operator()(_T1&& __x, _T2&& __y) const
noexcept(noexcept(iter_value_t<_T2>(ranges::iter_move(__y))) && //
- noexcept(*__y = ranges::iter_move(__x)) && //
- noexcept(*std::forward<_T1>(__x) = std::declval<iter_value_t<_T2>>()))
- {
- iter_value_t<_T2> __old(ranges::iter_move(__y));
- *__y = ranges::iter_move(__x);
- *std::forward<_T1>(__x) = std::move(__old);
- }
- };
+ noexcept(*__y = ranges::iter_move(__x)) && //
+ noexcept(*std::forward<_T1>(__x) = std::declval<iter_value_t<_T2>>())) {
+ iter_value_t<_T2> __old(ranges::iter_move(__y));
+ *__y = ranges::iter_move(__x);
+ *std::forward<_T1>(__x) = std::move(__old);
+ }
+};
} // namespace __iter_swap
inline namespace __cpo {
- inline constexpr auto iter_swap = __iter_swap::__fn{};
+inline constexpr auto iter_swap = __iter_swap::__fn{};
} // namespace __cpo
} // namespace ranges
-template<class _I1, class _I2 = _I1>
+template <class _I1, class _I2 = _I1>
concept indirectly_swappable =
- indirectly_readable<_I1> && indirectly_readable<_I2> &&
- requires(const _I1 __i1, const _I2 __i2) {
- ranges::iter_swap(__i1, __i1);
- ranges::iter_swap(__i2, __i2);
- ranges::iter_swap(__i1, __i2);
- ranges::iter_swap(__i2, __i1);
- };
+ indirectly_readable<_I1> && indirectly_readable<_I2> && requires(const _I1 __i1, const _I2 __i2) {
+ ranges::iter_swap(__i1, __i1);
+ ranges::iter_swap(__i2, __i2);
+ ranges::iter_swap(__i1, __i2);
+ ranges::iter_swap(__i2, __i1);
+ };
#endif // _LIBCPP_STD_VER >= 20
diff --git a/contrib/llvm-project/libcxx/include/__iterator/iterator.h b/contrib/llvm-project/libcxx/include/__iterator/iterator.h
index b417eeab79bf..ba9308f3c224 100644
--- a/contrib/llvm-project/libcxx/include/__iterator/iterator.h
+++ b/contrib/llvm-project/libcxx/include/__iterator/iterator.h
@@ -19,15 +19,13 @@
_LIBCPP_BEGIN_NAMESPACE_STD
-template<class _Category, class _Tp, class _Distance = ptrdiff_t,
- class _Pointer = _Tp*, class _Reference = _Tp&>
-struct _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX17 iterator
-{
- typedef _Tp value_type;
- typedef _Distance difference_type;
- typedef _Pointer pointer;
- typedef _Reference reference;
- typedef _Category iterator_category;
+template <class _Category, class _Tp, class _Distance = ptrdiff_t, class _Pointer = _Tp*, class _Reference = _Tp&>
+struct _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX17 iterator {
+ typedef _Tp value_type;
+ typedef _Distance difference_type;
+ typedef _Pointer pointer;
+ typedef _Reference reference;
+ typedef _Category iterator_category;
};
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__iterator/iterator_traits.h b/contrib/llvm-project/libcxx/include/__iterator/iterator_traits.h
index 248987e9b560..dae8cc75ae34 100644
--- a/contrib/llvm-project/libcxx/include/__iterator/iterator_traits.h
+++ b/contrib/llvm-project/libcxx/include/__iterator/iterator_traits.h
@@ -49,9 +49,7 @@ template <class _Tp>
using __with_reference = _Tp&;
template <class _Tp>
-concept __can_reference = requires {
- typename __with_reference<_Tp>;
-};
+concept __can_reference = requires { typename __with_reference<_Tp>; };
template <class _Tp>
concept __dereferenceable = requires(_Tp& __t) {
@@ -59,7 +57,7 @@ concept __dereferenceable = requires(_Tp& __t) {
};
// [iterator.traits]
-template<__dereferenceable _Tp>
+template <__dereferenceable _Tp>
using iter_reference_t = decltype(*std::declval<_Tp&>());
#endif // _LIBCPP_STD_VER >= 20
@@ -69,20 +67,16 @@ struct _LIBCPP_TEMPLATE_VIS iterator_traits;
struct _LIBCPP_TEMPLATE_VIS input_iterator_tag {};
struct _LIBCPP_TEMPLATE_VIS output_iterator_tag {};
-struct _LIBCPP_TEMPLATE_VIS forward_iterator_tag : public input_iterator_tag {};
+struct _LIBCPP_TEMPLATE_VIS forward_iterator_tag : public input_iterator_tag {};
struct _LIBCPP_TEMPLATE_VIS bidirectional_iterator_tag : public forward_iterator_tag {};
struct _LIBCPP_TEMPLATE_VIS random_access_iterator_tag : public bidirectional_iterator_tag {};
#if _LIBCPP_STD_VER >= 20
-struct _LIBCPP_TEMPLATE_VIS contiguous_iterator_tag : public random_access_iterator_tag {};
+struct _LIBCPP_TEMPLATE_VIS contiguous_iterator_tag : public random_access_iterator_tag {};
#endif
template <class _Iter>
struct __iter_traits_cache {
- using type = _If<
- __is_primary_template<iterator_traits<_Iter> >::value,
- _Iter,
- iterator_traits<_Iter>
- >;
+ using type = _If< __is_primary_template<iterator_traits<_Iter> >::value, _Iter, iterator_traits<_Iter> >;
};
template <class _Iter>
using _ITER_TRAITS = typename __iter_traits_cache<_Iter>::type;
@@ -97,64 +91,61 @@ struct __iter_concept_category_test {
};
struct __iter_concept_random_fallback {
template <class _Iter>
- using _Apply = __enable_if_t<
- __is_primary_template<iterator_traits<_Iter> >::value,
- random_access_iterator_tag
- >;
+ using _Apply = __enable_if_t< __is_primary_template<iterator_traits<_Iter> >::value, random_access_iterator_tag >;
};
-template <class _Iter, class _Tester> struct __test_iter_concept
- : _IsValidExpansion<_Tester::template _Apply, _Iter>,
- _Tester
-{
-};
+template <class _Iter, class _Tester>
+struct __test_iter_concept : _IsValidExpansion<_Tester::template _Apply, _Iter>, _Tester {};
template <class _Iter>
struct __iter_concept_cache {
- using type = _Or<
- __test_iter_concept<_Iter, __iter_concept_concept_test>,
- __test_iter_concept<_Iter, __iter_concept_category_test>,
- __test_iter_concept<_Iter, __iter_concept_random_fallback>
- >;
+ using type = _Or< __test_iter_concept<_Iter, __iter_concept_concept_test>,
+ __test_iter_concept<_Iter, __iter_concept_category_test>,
+ __test_iter_concept<_Iter, __iter_concept_random_fallback> >;
};
template <class _Iter>
using _ITER_CONCEPT = typename __iter_concept_cache<_Iter>::type::template _Apply<_Iter>;
-
template <class _Tp>
-struct __has_iterator_typedefs
-{
+struct __has_iterator_typedefs {
private:
- template <class _Up> static false_type __test(...);
- template <class _Up> static true_type __test(__void_t<typename _Up::iterator_category>* = nullptr,
- __void_t<typename _Up::difference_type>* = nullptr,
- __void_t<typename _Up::value_type>* = nullptr,
- __void_t<typename _Up::reference>* = nullptr,
- __void_t<typename _Up::pointer>* = nullptr);
+ template <class _Up>
+ static false_type __test(...);
+ template <class _Up>
+ static true_type
+ __test(__void_t<typename _Up::iterator_category>* = nullptr,
+ __void_t<typename _Up::difference_type>* = nullptr,
+ __void_t<typename _Up::value_type>* = nullptr,
+ __void_t<typename _Up::reference>* = nullptr,
+ __void_t<typename _Up::pointer>* = nullptr);
+
public:
- static const bool value = decltype(__test<_Tp>(0,0,0,0,0))::value;
+ static const bool value = decltype(__test<_Tp>(0, 0, 0, 0, 0))::value;
};
-
template <class _Tp>
-struct __has_iterator_category
-{
+struct __has_iterator_category {
private:
- template <class _Up> static false_type __test(...);
- template <class _Up> static true_type __test(typename _Up::iterator_category* = nullptr);
+ template <class _Up>
+ static false_type __test(...);
+ template <class _Up>
+ static true_type __test(typename _Up::iterator_category* = nullptr);
+
public:
- static const bool value = decltype(__test<_Tp>(nullptr))::value;
+ static const bool value = decltype(__test<_Tp>(nullptr))::value;
};
template <class _Tp>
-struct __has_iterator_concept
-{
+struct __has_iterator_concept {
private:
- template <class _Up> static false_type __test(...);
- template <class _Up> static true_type __test(typename _Up::iterator_concept* = nullptr);
+ template <class _Up>
+ static false_type __test(...);
+ template <class _Up>
+ static true_type __test(typename _Up::iterator_concept* = nullptr);
+
public:
- static const bool value = decltype(__test<_Tp>(nullptr))::value;
+ static const bool value = decltype(__test<_Tp>(nullptr))::value;
};
#if _LIBCPP_STD_VER >= 20
@@ -163,200 +154,194 @@ public:
// from `[iterator.cpp17]`. To avoid confusion between the two, the exposition-only concepts have been banished to
// a "detail" namespace indicating they have a niche use-case.
namespace __iterator_traits_detail {
-template<class _Ip>
-concept __cpp17_iterator =
- requires(_Ip __i) {
- { *__i } -> __can_reference;
- { ++__i } -> same_as<_Ip&>;
- { *__i++ } -> __can_reference;
- } &&
- copyable<_Ip>;
-
-template<class _Ip>
-concept __cpp17_input_iterator =
- __cpp17_iterator<_Ip> &&
- equality_comparable<_Ip> &&
- requires(_Ip __i) {
- typename incrementable_traits<_Ip>::difference_type;
- typename indirectly_readable_traits<_Ip>::value_type;
- typename common_reference_t<iter_reference_t<_Ip>&&,
- typename indirectly_readable_traits<_Ip>::value_type&>;
- typename common_reference_t<decltype(*__i++)&&,
- typename indirectly_readable_traits<_Ip>::value_type&>;
- requires signed_integral<typename incrementable_traits<_Ip>::difference_type>;
- };
-
-template<class _Ip>
+template <class _Ip>
+concept __cpp17_iterator = requires(_Ip __i) {
+ { *__i } -> __can_reference;
+ { ++__i } -> same_as<_Ip&>;
+ { *__i++ } -> __can_reference;
+} && copyable<_Ip>;
+
+template <class _Ip>
+concept __cpp17_input_iterator = __cpp17_iterator<_Ip> && equality_comparable<_Ip> && requires(_Ip __i) {
+ typename incrementable_traits<_Ip>::difference_type;
+ typename indirectly_readable_traits<_Ip>::value_type;
+ typename common_reference_t<iter_reference_t<_Ip>&&, typename indirectly_readable_traits<_Ip>::value_type&>;
+ typename common_reference_t<decltype(*__i++)&&, typename indirectly_readable_traits<_Ip>::value_type&>;
+ requires signed_integral<typename incrementable_traits<_Ip>::difference_type>;
+};
+
+template <class _Ip>
concept __cpp17_forward_iterator =
- __cpp17_input_iterator<_Ip> &&
- constructible_from<_Ip> &&
- is_reference_v<iter_reference_t<_Ip>> &&
- same_as<remove_cvref_t<iter_reference_t<_Ip>>,
- typename indirectly_readable_traits<_Ip>::value_type> &&
- requires(_Ip __i) {
- { __i++ } -> convertible_to<_Ip const&>;
- { *__i++ } -> same_as<iter_reference_t<_Ip>>;
- };
-
-template<class _Ip>
-concept __cpp17_bidirectional_iterator =
- __cpp17_forward_iterator<_Ip> &&
- requires(_Ip __i) {
- { --__i } -> same_as<_Ip&>;
- { __i-- } -> convertible_to<_Ip const&>;
- { *__i-- } -> same_as<iter_reference_t<_Ip>>;
- };
-
-template<class _Ip>
+ __cpp17_input_iterator<_Ip> && constructible_from<_Ip> && is_reference_v<iter_reference_t<_Ip>> &&
+ same_as<remove_cvref_t<iter_reference_t<_Ip>>, typename indirectly_readable_traits<_Ip>::value_type> &&
+ requires(_Ip __i) {
+ { __i++ } -> convertible_to<_Ip const&>;
+ { *__i++ } -> same_as<iter_reference_t<_Ip>>;
+ };
+
+template <class _Ip>
+concept __cpp17_bidirectional_iterator = __cpp17_forward_iterator<_Ip> && requires(_Ip __i) {
+ { --__i } -> same_as<_Ip&>;
+ { __i-- } -> convertible_to<_Ip const&>;
+ { *__i-- } -> same_as<iter_reference_t<_Ip>>;
+};
+
+template <class _Ip>
concept __cpp17_random_access_iterator =
- __cpp17_bidirectional_iterator<_Ip> &&
- totally_ordered<_Ip> &&
- requires(_Ip __i, typename incrementable_traits<_Ip>::difference_type __n) {
- { __i += __n } -> same_as<_Ip&>;
- { __i -= __n } -> same_as<_Ip&>;
- { __i + __n } -> same_as<_Ip>;
- { __n + __i } -> same_as<_Ip>;
- { __i - __n } -> same_as<_Ip>;
- { __i - __i } -> same_as<decltype(__n)>; // NOLINT(misc-redundant-expression) ; This is llvm.org/PR54114
- { __i[__n] } -> convertible_to<iter_reference_t<_Ip>>;
- };
+ __cpp17_bidirectional_iterator<_Ip> && totally_ordered<_Ip> &&
+ requires(_Ip __i, typename incrementable_traits<_Ip>::difference_type __n) {
+ { __i += __n } -> same_as<_Ip&>;
+ { __i -= __n } -> same_as<_Ip&>;
+ { __i + __n } -> same_as<_Ip>;
+ { __n + __i } -> same_as<_Ip>;
+ { __i - __n } -> same_as<_Ip>;
+ { __i - __i } -> same_as<decltype(__n)>; // NOLINT(misc-redundant-expression) ; This is llvm.org/PR54114
+ { __i[__n] } -> convertible_to<iter_reference_t<_Ip>>;
+ };
} // namespace __iterator_traits_detail
-template<class _Ip>
+template <class _Ip>
concept __has_member_reference = requires { typename _Ip::reference; };
-template<class _Ip>
+template <class _Ip>
concept __has_member_pointer = requires { typename _Ip::pointer; };
-template<class _Ip>
+template <class _Ip>
concept __has_member_iterator_category = requires { typename _Ip::iterator_category; };
-template<class _Ip>
+template <class _Ip>
concept __specifies_members = requires {
- typename _Ip::value_type;
- typename _Ip::difference_type;
- requires __has_member_reference<_Ip>;
- requires __has_member_iterator_category<_Ip>;
- };
+ typename _Ip::value_type;
+ typename _Ip::difference_type;
+ requires __has_member_reference<_Ip>;
+ requires __has_member_iterator_category<_Ip>;
+};
-template<class>
+template <class>
struct __iterator_traits_member_pointer_or_void {
using type = void;
};
-template<__has_member_pointer _Tp>
+template <__has_member_pointer _Tp>
struct __iterator_traits_member_pointer_or_void<_Tp> {
using type = typename _Tp::pointer;
};
-template<class _Tp>
-concept __cpp17_iterator_missing_members =
- !__specifies_members<_Tp> &&
- __iterator_traits_detail::__cpp17_iterator<_Tp>;
+template <class _Tp>
+concept __cpp17_iterator_missing_members = !__specifies_members<_Tp> && __iterator_traits_detail::__cpp17_iterator<_Tp>;
-template<class _Tp>
+template <class _Tp>
concept __cpp17_input_iterator_missing_members =
- __cpp17_iterator_missing_members<_Tp> &&
- __iterator_traits_detail::__cpp17_input_iterator<_Tp>;
+ __cpp17_iterator_missing_members<_Tp> && __iterator_traits_detail::__cpp17_input_iterator<_Tp>;
// Otherwise, `pointer` names `void`.
-template<class>
-struct __iterator_traits_member_pointer_or_arrow_or_void { using type = void; };
+template <class>
+struct __iterator_traits_member_pointer_or_arrow_or_void {
+ using type = void;
+};
// [iterator.traits]/3.2.1
// If the qualified-id `I::pointer` is valid and denotes a type, `pointer` names that type.
-template<__has_member_pointer _Ip>
-struct __iterator_traits_member_pointer_or_arrow_or_void<_Ip> { using type = typename _Ip::pointer; };
+template <__has_member_pointer _Ip>
+struct __iterator_traits_member_pointer_or_arrow_or_void<_Ip> {
+ using type = typename _Ip::pointer;
+};
// Otherwise, if `decltype(declval<I&>().operator->())` is well-formed, then `pointer` names that
// type.
-template<class _Ip>
+template <class _Ip>
requires requires(_Ip& __i) { __i.operator->(); } && (!__has_member_pointer<_Ip>)
struct __iterator_traits_member_pointer_or_arrow_or_void<_Ip> {
using type = decltype(std::declval<_Ip&>().operator->());
};
// Otherwise, `reference` names `iter-reference-t<I>`.
-template<class _Ip>
-struct __iterator_traits_member_reference { using type = iter_reference_t<_Ip>; };
+template <class _Ip>
+struct __iterator_traits_member_reference {
+ using type = iter_reference_t<_Ip>;
+};
// [iterator.traits]/3.2.2
// If the qualified-id `I::reference` is valid and denotes a type, `reference` names that type.
-template<__has_member_reference _Ip>
-struct __iterator_traits_member_reference<_Ip> { using type = typename _Ip::reference; };
+template <__has_member_reference _Ip>
+struct __iterator_traits_member_reference<_Ip> {
+ using type = typename _Ip::reference;
+};
// [iterator.traits]/3.2.3.4
// input_iterator_tag
-template<class _Ip>
+template <class _Ip>
struct __deduce_iterator_category {
using type = input_iterator_tag;
};
// [iterator.traits]/3.2.3.1
// `random_access_iterator_tag` if `I` satisfies `cpp17-random-access-iterator`, or otherwise
-template<__iterator_traits_detail::__cpp17_random_access_iterator _Ip>
+template <__iterator_traits_detail::__cpp17_random_access_iterator _Ip>
struct __deduce_iterator_category<_Ip> {
using type = random_access_iterator_tag;
};
// [iterator.traits]/3.2.3.2
// `bidirectional_iterator_tag` if `I` satisfies `cpp17-bidirectional-iterator`, or otherwise
-template<__iterator_traits_detail::__cpp17_bidirectional_iterator _Ip>
+template <__iterator_traits_detail::__cpp17_bidirectional_iterator _Ip>
struct __deduce_iterator_category<_Ip> {
using type = bidirectional_iterator_tag;
};
// [iterator.traits]/3.2.3.3
// `forward_iterator_tag` if `I` satisfies `cpp17-forward-iterator`, or otherwise
-template<__iterator_traits_detail::__cpp17_forward_iterator _Ip>
+template <__iterator_traits_detail::__cpp17_forward_iterator _Ip>
struct __deduce_iterator_category<_Ip> {
using type = forward_iterator_tag;
};
-template<class _Ip>
+template <class _Ip>
struct __iterator_traits_iterator_category : __deduce_iterator_category<_Ip> {};
// [iterator.traits]/3.2.3
// If the qualified-id `I::iterator-category` is valid and denotes a type, `iterator-category` names
// that type.
-template<__has_member_iterator_category _Ip>
+template <__has_member_iterator_category _Ip>
struct __iterator_traits_iterator_category<_Ip> {
using type = typename _Ip::iterator_category;
};
// otherwise, it names void.
-template<class>
-struct __iterator_traits_difference_type { using type = void; };
+template <class>
+struct __iterator_traits_difference_type {
+ using type = void;
+};
// If the qualified-id `incrementable_traits<I>::difference_type` is valid and denotes a type, then
// `difference_type` names that type;
-template<class _Ip>
-requires requires { typename incrementable_traits<_Ip>::difference_type; }
+template <class _Ip>
+ requires requires { typename incrementable_traits<_Ip>::difference_type; }
struct __iterator_traits_difference_type<_Ip> {
using type = typename incrementable_traits<_Ip>::difference_type;
};
// [iterator.traits]/3.4
// Otherwise, `iterator_traits<I>` has no members by any of the above names.
-template<class>
+template <class>
struct __iterator_traits {};
// [iterator.traits]/3.1
// If `I` has valid ([temp.deduct]) member types `difference-type`, `value-type`, `reference`, and
// `iterator-category`, then `iterator-traits<I>` has the following publicly accessible members:
-template<__specifies_members _Ip>
+template <__specifies_members _Ip>
struct __iterator_traits<_Ip> {
- using iterator_category = typename _Ip::iterator_category;
- using value_type = typename _Ip::value_type;
- using difference_type = typename _Ip::difference_type;
- using pointer = typename __iterator_traits_member_pointer_or_void<_Ip>::type;
- using reference = typename _Ip::reference;
+ using iterator_category = typename _Ip::iterator_category;
+ using value_type = typename _Ip::value_type;
+ using difference_type = typename _Ip::difference_type;
+ using pointer = typename __iterator_traits_member_pointer_or_void<_Ip>::type;
+ using reference = typename _Ip::reference;
};
// [iterator.traits]/3.2
// Otherwise, if `I` satisfies the exposition-only concept `cpp17-input-iterator`,
// `iterator-traits<I>` has the following publicly accessible members:
-template<__cpp17_input_iterator_missing_members _Ip>
+template <__cpp17_input_iterator_missing_members _Ip>
struct __iterator_traits<_Ip> {
using iterator_category = typename __iterator_traits_iterator_category<_Ip>::type;
using value_type = typename indirectly_readable_traits<_Ip>::value_type;
@@ -367,7 +352,7 @@ struct __iterator_traits<_Ip> {
// Otherwise, if `I` satisfies the exposition-only concept `cpp17-iterator`, then
// `iterator_traits<I>` has the following publicly accessible members:
-template<__cpp17_iterator_missing_members _Ip>
+template <__cpp17_iterator_missing_members _Ip>
struct __iterator_traits<_Ip> {
using iterator_category = output_iterator_tag;
using value_type = void;
@@ -376,36 +361,33 @@ struct __iterator_traits<_Ip> {
using reference = void;
};
-template<class _Ip>
+template <class _Ip>
struct iterator_traits : __iterator_traits<_Ip> {
using __primary_template = iterator_traits;
};
-#else // _LIBCPP_STD_VER >= 20
+#else // _LIBCPP_STD_VER >= 20
-template <class _Iter, bool> struct __iterator_traits {};
+template <class _Iter, bool>
+struct __iterator_traits {};
-template <class _Iter, bool> struct __iterator_traits_impl {};
+template <class _Iter, bool>
+struct __iterator_traits_impl {};
template <class _Iter>
-struct __iterator_traits_impl<_Iter, true>
-{
- typedef typename _Iter::difference_type difference_type;
- typedef typename _Iter::value_type value_type;
- typedef typename _Iter::pointer pointer;
- typedef typename _Iter::reference reference;
- typedef typename _Iter::iterator_category iterator_category;
+struct __iterator_traits_impl<_Iter, true> {
+ typedef typename _Iter::difference_type difference_type;
+ typedef typename _Iter::value_type value_type;
+ typedef typename _Iter::pointer pointer;
+ typedef typename _Iter::reference reference;
+ typedef typename _Iter::iterator_category iterator_category;
};
template <class _Iter>
struct __iterator_traits<_Iter, true>
- : __iterator_traits_impl
- <
- _Iter,
- is_convertible<typename _Iter::iterator_category, input_iterator_tag>::value ||
- is_convertible<typename _Iter::iterator_category, output_iterator_tag>::value
- >
-{};
+ : __iterator_traits_impl< _Iter,
+ is_convertible<typename _Iter::iterator_category, input_iterator_tag>::value ||
+ is_convertible<typename _Iter::iterator_category, output_iterator_tag>::value > {};
// iterator_traits<Iterator> will only have the nested types if Iterator::iterator_category
// exists. Else iterator_traits<Iterator> will be an empty class. This is a
@@ -413,41 +395,35 @@ struct __iterator_traits<_Iter, true>
// the client expects instead of failing at compile time.
template <class _Iter>
-struct _LIBCPP_TEMPLATE_VIS iterator_traits
- : __iterator_traits<_Iter, __has_iterator_typedefs<_Iter>::value> {
-
+struct _LIBCPP_TEMPLATE_VIS iterator_traits : __iterator_traits<_Iter, __has_iterator_typedefs<_Iter>::value> {
using __primary_template = iterator_traits;
};
#endif // _LIBCPP_STD_VER >= 20
-template<class _Tp>
+template <class _Tp>
#if _LIBCPP_STD_VER >= 20
-requires is_object_v<_Tp>
+ requires is_object_v<_Tp>
#endif
-struct _LIBCPP_TEMPLATE_VIS iterator_traits<_Tp*>
-{
- typedef ptrdiff_t difference_type;
- typedef __remove_cv_t<_Tp> value_type;
- typedef _Tp* pointer;
- typedef _Tp& reference;
- typedef random_access_iterator_tag iterator_category;
+struct _LIBCPP_TEMPLATE_VIS iterator_traits<_Tp*> {
+ typedef ptrdiff_t difference_type;
+ typedef __remove_cv_t<_Tp> value_type;
+ typedef _Tp* pointer;
+ typedef _Tp& reference;
+ typedef random_access_iterator_tag iterator_category;
#if _LIBCPP_STD_VER >= 20
- typedef contiguous_iterator_tag iterator_concept;
+ typedef contiguous_iterator_tag iterator_concept;
#endif
};
template <class _Tp, class _Up, bool = __has_iterator_category<iterator_traits<_Tp> >::value>
-struct __has_iterator_category_convertible_to
- : is_convertible<typename iterator_traits<_Tp>::iterator_category, _Up>
-{};
+struct __has_iterator_category_convertible_to : is_convertible<typename iterator_traits<_Tp>::iterator_category, _Up> {
+};
template <class _Tp, class _Up>
struct __has_iterator_category_convertible_to<_Tp, _Up, false> : false_type {};
template <class _Tp, class _Up, bool = __has_iterator_concept<_Tp>::value>
-struct __has_iterator_concept_convertible_to
- : is_convertible<typename _Tp::iterator_concept, _Up>
-{};
+struct __has_iterator_concept_convertible_to : is_convertible<typename _Tp::iterator_concept, _Up> {};
template <class _Tp, class _Up>
struct __has_iterator_concept_convertible_to<_Tp, _Up, false> : false_type {};
@@ -473,10 +449,9 @@ using __has_random_access_iterator_category = __has_iterator_category_convertibl
//
#if _LIBCPP_STD_VER >= 20
template <class _Tp>
-struct __libcpp_is_contiguous_iterator : _Or<
- __has_iterator_category_convertible_to<_Tp, contiguous_iterator_tag>,
- __has_iterator_concept_convertible_to<_Tp, contiguous_iterator_tag>
-> {};
+struct __libcpp_is_contiguous_iterator
+ : _Or< __has_iterator_category_convertible_to<_Tp, contiguous_iterator_tag>,
+ __has_iterator_concept_convertible_to<_Tp, contiguous_iterator_tag> > {};
#else
template <class _Tp>
struct __libcpp_is_contiguous_iterator : false_type {};
@@ -486,41 +461,40 @@ struct __libcpp_is_contiguous_iterator : false_type {};
template <class _Up>
struct __libcpp_is_contiguous_iterator<_Up*> : true_type {};
-
template <class _Iter>
class __wrap_iter;
template <class _Tp>
-using __has_exactly_input_iterator_category
- = integral_constant<bool,
- __has_iterator_category_convertible_to<_Tp, input_iterator_tag>::value &&
- !__has_iterator_category_convertible_to<_Tp, forward_iterator_tag>::value>;
+using __has_exactly_input_iterator_category =
+ integral_constant<bool,
+ __has_iterator_category_convertible_to<_Tp, input_iterator_tag>::value &&
+ !__has_iterator_category_convertible_to<_Tp, forward_iterator_tag>::value>;
template <class _Tp>
-using __has_exactly_forward_iterator_category
- = integral_constant<bool,
- __has_iterator_category_convertible_to<_Tp, forward_iterator_tag>::value &&
- !__has_iterator_category_convertible_to<_Tp, bidirectional_iterator_tag>::value>;
+using __has_exactly_forward_iterator_category =
+ integral_constant<bool,
+ __has_iterator_category_convertible_to<_Tp, forward_iterator_tag>::value &&
+ !__has_iterator_category_convertible_to<_Tp, bidirectional_iterator_tag>::value>;
template <class _Tp>
-using __has_exactly_bidirectional_iterator_category
- = integral_constant<bool,
- __has_iterator_category_convertible_to<_Tp, bidirectional_iterator_tag>::value &&
- !__has_iterator_category_convertible_to<_Tp, random_access_iterator_tag>::value>;
+using __has_exactly_bidirectional_iterator_category =
+ integral_constant<bool,
+ __has_iterator_category_convertible_to<_Tp, bidirectional_iterator_tag>::value &&
+ !__has_iterator_category_convertible_to<_Tp, random_access_iterator_tag>::value>;
-template<class _InputIterator>
+template <class _InputIterator>
using __iter_value_type = typename iterator_traits<_InputIterator>::value_type;
-template<class _InputIterator>
+template <class _InputIterator>
using __iter_key_type = __remove_const_t<typename iterator_traits<_InputIterator>::value_type::first_type>;
-template<class _InputIterator>
+template <class _InputIterator>
using __iter_mapped_type = typename iterator_traits<_InputIterator>::value_type::second_type;
-template<class _InputIterator>
-using __iter_to_alloc_type = pair<
- typename add_const<typename iterator_traits<_InputIterator>::value_type::first_type>::type,
- typename iterator_traits<_InputIterator>::value_type::second_type>;
+template <class _InputIterator>
+using __iter_to_alloc_type =
+ pair< typename add_const<typename iterator_traits<_InputIterator>::value_type::first_type>::type,
+ typename iterator_traits<_InputIterator>::value_type::second_type>;
template <class _Iter>
using __iterator_category_type = typename iterator_traits<_Iter>::iterator_category;
@@ -543,9 +517,10 @@ using __iter_reference = typename iterator_traits<_Iter>::reference;
// generated from the primary template, and `iterator_traits<RI>::value_type` otherwise.
// This has to be in this file and not readable_traits.h to break the include cycle between the two.
template <class _Ip>
-using iter_value_t = typename conditional_t<__is_primary_template<iterator_traits<remove_cvref_t<_Ip> > >::value,
- indirectly_readable_traits<remove_cvref_t<_Ip> >,
- iterator_traits<remove_cvref_t<_Ip> > >::value_type;
+using iter_value_t =
+ typename conditional_t<__is_primary_template<iterator_traits<remove_cvref_t<_Ip> > >::value,
+ indirectly_readable_traits<remove_cvref_t<_Ip> >,
+ iterator_traits<remove_cvref_t<_Ip> > >::value_type;
#endif // _LIBCPP_STD_VER >= 20
diff --git a/contrib/llvm-project/libcxx/include/__iterator/mergeable.h b/contrib/llvm-project/libcxx/include/__iterator/mergeable.h
index 494fda956e27..7976d751095e 100644
--- a/contrib/llvm-project/libcxx/include/__iterator/mergeable.h
+++ b/contrib/llvm-project/libcxx/include/__iterator/mergeable.h
@@ -24,14 +24,15 @@ _LIBCPP_BEGIN_NAMESPACE_STD
#if _LIBCPP_STD_VER >= 20
-template <class _Input1, class _Input2, class _Output,
- class _Comp = ranges::less, class _Proj1 = identity, class _Proj2 = identity>
+template <class _Input1,
+ class _Input2,
+ class _Output,
+ class _Comp = ranges::less,
+ class _Proj1 = identity,
+ class _Proj2 = identity>
concept mergeable =
- input_iterator<_Input1> &&
- input_iterator<_Input2> &&
- weakly_incrementable<_Output> &&
- indirectly_copyable<_Input1, _Output> &&
- indirectly_copyable<_Input2, _Output> &&
+ input_iterator<_Input1> && input_iterator<_Input2> && weakly_incrementable<_Output> &&
+ indirectly_copyable<_Input1, _Output> && indirectly_copyable<_Input2, _Output> &&
indirect_strict_weak_order<_Comp, projected<_Input1, _Proj1>, projected<_Input2, _Proj2>>;
#endif // _LIBCPP_STD_VER >= 20
diff --git a/contrib/llvm-project/libcxx/include/__iterator/move_iterator.h b/contrib/llvm-project/libcxx/include/__iterator/move_iterator.h
index 2f79d9a3d263..d1bd0138bdda 100644
--- a/contrib/llvm-project/libcxx/include/__iterator/move_iterator.h
+++ b/contrib/llvm-project/libcxx/include/__iterator/move_iterator.h
@@ -45,22 +45,21 @@ _LIBCPP_PUSH_MACROS
_LIBCPP_BEGIN_NAMESPACE_STD
#if _LIBCPP_STD_VER >= 20
-template<class _Iter, class = void>
+template <class _Iter, class = void>
struct __move_iter_category_base {};
-template<class _Iter>
+template <class _Iter>
requires requires { typename iterator_traits<_Iter>::iterator_category; }
struct __move_iter_category_base<_Iter> {
- using iterator_category = _If<
- derived_from<typename iterator_traits<_Iter>::iterator_category, random_access_iterator_tag>,
- random_access_iterator_tag,
- typename iterator_traits<_Iter>::iterator_category
- >;
+ using iterator_category =
+ _If< derived_from<typename iterator_traits<_Iter>::iterator_category, random_access_iterator_tag>,
+ random_access_iterator_tag,
+ typename iterator_traits<_Iter>::iterator_category >;
};
-template<class _Iter, class _Sent>
+template <class _Iter, class _Sent>
concept __move_iter_comparable = requires {
- { std::declval<const _Iter&>() == std::declval<_Sent>() } -> convertible_to<bool>;
+ { std::declval<const _Iter&>() == std::declval<_Sent>() } -> convertible_to<bool>;
};
#endif // _LIBCPP_STD_VER >= 20
@@ -70,282 +69,270 @@ class _LIBCPP_TEMPLATE_VIS move_iterator
: public __move_iter_category_base<_Iter>
#endif
{
- #if _LIBCPP_STD_VER >= 20
+#if _LIBCPP_STD_VER >= 20
+
private:
- _LIBCPP_HIDE_FROM_ABI
- static constexpr auto __get_iter_concept() {
- 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 {
- return input_iterator_tag{};
- }
+ _LIBCPP_HIDE_FROM_ABI static constexpr auto __get_iter_concept() {
+ 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 {
+ return input_iterator_tag{};
}
+ }
#endif // _LIBCPP_STD_VER >= 20
+
public:
#if _LIBCPP_STD_VER >= 20
- using iterator_type = _Iter;
- using iterator_concept = decltype(__get_iter_concept());
- // iterator_category is inherited and not always present
- using value_type = iter_value_t<_Iter>;
- using difference_type = iter_difference_t<_Iter>;
- using pointer = _Iter;
- using reference = iter_rvalue_reference_t<_Iter>;
+ using iterator_type = _Iter;
+ using iterator_concept = decltype(__get_iter_concept());
+ // iterator_category is inherited and not always present
+ using value_type = iter_value_t<_Iter>;
+ using difference_type = iter_difference_t<_Iter>;
+ using pointer = _Iter;
+ using reference = iter_rvalue_reference_t<_Iter>;
#else
- typedef _Iter iterator_type;
- typedef _If<
- __has_random_access_iterator_category<_Iter>::value,
- random_access_iterator_tag,
- typename iterator_traits<_Iter>::iterator_category
- > iterator_category;
- typedef typename iterator_traits<iterator_type>::value_type value_type;
- typedef typename iterator_traits<iterator_type>::difference_type difference_type;
- typedef iterator_type pointer;
-
- typedef typename iterator_traits<iterator_type>::reference __reference;
- typedef typename conditional<
- is_reference<__reference>::value,
- __libcpp_remove_reference_t<__reference>&&,
- __reference
- >::type reference;
+ typedef _Iter iterator_type;
+ typedef _If< __has_random_access_iterator_category<_Iter>::value,
+ random_access_iterator_tag,
+ typename iterator_traits<_Iter>::iterator_category >
+ iterator_category;
+ typedef typename iterator_traits<iterator_type>::value_type value_type;
+ typedef typename iterator_traits<iterator_type>::difference_type difference_type;
+ typedef iterator_type pointer;
+
+ typedef typename iterator_traits<iterator_type>::reference __reference;
+ typedef typename conditional< is_reference<__reference>::value,
+ __libcpp_remove_reference_t<__reference>&&,
+ __reference >::type reference;
#endif // _LIBCPP_STD_VER >= 20
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
- explicit move_iterator(_Iter __i) : __current_(std::move(__i)) {}
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 explicit move_iterator(_Iter __i) : __current_(std::move(__i)) {}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
- move_iterator& operator++() { ++__current_; return *this; }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 move_iterator& operator++() {
+ ++__current_;
+ return *this;
+ }
- _LIBCPP_DEPRECATED_IN_CXX20 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
- pointer operator->() const { return __current_; }
+ _LIBCPP_DEPRECATED_IN_CXX20 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 pointer operator->() const {
+ return __current_;
+ }
#if _LIBCPP_STD_VER >= 20
- _LIBCPP_HIDE_FROM_ABI constexpr
- move_iterator() requires is_constructible_v<_Iter> : __current_() {}
-
- template <class _Up>
- requires (!_IsSame<_Up, _Iter>::value) && convertible_to<const _Up&, _Iter>
- _LIBCPP_HIDE_FROM_ABI constexpr
- move_iterator(const move_iterator<_Up>& __u) : __current_(__u.base()) {}
-
- template <class _Up>
- requires (!_IsSame<_Up, _Iter>::value) &&
- convertible_to<const _Up&, _Iter> &&
- assignable_from<_Iter&, const _Up&>
- _LIBCPP_HIDE_FROM_ABI constexpr
- move_iterator& operator=(const move_iterator<_Up>& __u) {
- __current_ = __u.base();
- return *this;
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr const _Iter& base() const & noexcept { return __current_; }
- _LIBCPP_HIDE_FROM_ABI constexpr _Iter base() && { return std::move(__current_); }
-
- _LIBCPP_HIDE_FROM_ABI constexpr
- reference operator*() const { return ranges::iter_move(__current_); }
- _LIBCPP_HIDE_FROM_ABI constexpr
- reference operator[](difference_type __n) const { return ranges::iter_move(__current_ + __n); }
-
- _LIBCPP_HIDE_FROM_ABI constexpr
- auto operator++(int)
- requires forward_iterator<_Iter>
- {
- move_iterator __tmp(*this); ++__current_; return __tmp;
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr
- void operator++(int) { ++__current_; }
+ _LIBCPP_HIDE_FROM_ABI constexpr move_iterator()
+ requires is_constructible_v<_Iter>
+ : __current_() {}
+
+ template <class _Up>
+ requires(!_IsSame<_Up, _Iter>::value) && convertible_to<const _Up&, _Iter>
+ _LIBCPP_HIDE_FROM_ABI constexpr move_iterator(const move_iterator<_Up>& __u) : __current_(__u.base()) {}
+
+ template <class _Up>
+ requires(!_IsSame<_Up, _Iter>::value) && convertible_to<const _Up&, _Iter> && assignable_from<_Iter&, const _Up&>
+ _LIBCPP_HIDE_FROM_ABI constexpr move_iterator& operator=(const move_iterator<_Up>& __u) {
+ __current_ = __u.base();
+ return *this;
+ }
+
+ _LIBCPP_HIDE_FROM_ABI constexpr const _Iter& base() const& noexcept { return __current_; }
+ _LIBCPP_HIDE_FROM_ABI constexpr _Iter base() && { return std::move(__current_); }
+
+ _LIBCPP_HIDE_FROM_ABI constexpr reference operator*() const { return ranges::iter_move(__current_); }
+ _LIBCPP_HIDE_FROM_ABI constexpr reference operator[](difference_type __n) const {
+ return ranges::iter_move(__current_ + __n);
+ }
+
+ _LIBCPP_HIDE_FROM_ABI constexpr auto operator++(int)
+ requires forward_iterator<_Iter>
+ {
+ move_iterator __tmp(*this);
+ ++__current_;
+ return __tmp;
+ }
+
+ _LIBCPP_HIDE_FROM_ABI constexpr void operator++(int) { ++__current_; }
#else
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
- move_iterator() : __current_() {}
-
- template <class _Up, class = __enable_if_t<
- !is_same<_Up, _Iter>::value && is_convertible<const _Up&, _Iter>::value
- > >
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
- move_iterator(const move_iterator<_Up>& __u) : __current_(__u.base()) {}
-
- template <class _Up, class = __enable_if_t<
- !is_same<_Up, _Iter>::value &&
- is_convertible<const _Up&, _Iter>::value &&
- is_assignable<_Iter&, const _Up&>::value
- > >
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
- move_iterator& operator=(const move_iterator<_Up>& __u) {
- __current_ = __u.base();
- return *this;
- }
-
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
- _Iter base() const { return __current_; }
-
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
- reference operator*() const { return static_cast<reference>(*__current_); }
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
- reference operator[](difference_type __n) const { return static_cast<reference>(__current_[__n]); }
-
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
- move_iterator operator++(int) { move_iterator __tmp(*this); ++__current_; return __tmp; }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 move_iterator() : __current_() {}
+
+ template <class _Up,
+ class = __enable_if_t< !is_same<_Up, _Iter>::value && is_convertible<const _Up&, _Iter>::value > >
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 move_iterator(const move_iterator<_Up>& __u)
+ : __current_(__u.base()) {}
+
+ template <class _Up,
+ class = __enable_if_t< !is_same<_Up, _Iter>::value && is_convertible<const _Up&, _Iter>::value &&
+ is_assignable<_Iter&, const _Up&>::value > >
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 move_iterator& operator=(const move_iterator<_Up>& __u) {
+ __current_ = __u.base();
+ return *this;
+ }
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 _Iter base() const { return __current_; }
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 reference operator*() const {
+ return static_cast<reference>(*__current_);
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 reference operator[](difference_type __n) const {
+ return static_cast<reference>(__current_[__n]);
+ }
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 move_iterator operator++(int) {
+ move_iterator __tmp(*this);
+ ++__current_;
+ return __tmp;
+ }
#endif // _LIBCPP_STD_VER >= 20
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
- move_iterator& operator--() { --__current_; return *this; }
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
- move_iterator operator--(int) { move_iterator __tmp(*this); --__current_; return __tmp; }
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
- move_iterator operator+(difference_type __n) const { return move_iterator(__current_ + __n); }
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
- move_iterator& operator+=(difference_type __n) { __current_ += __n; return *this; }
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
- move_iterator operator-(difference_type __n) const { return move_iterator(__current_ - __n); }
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
- move_iterator& operator-=(difference_type __n) { __current_ -= __n; return *this; }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 move_iterator& operator--() {
+ --__current_;
+ return *this;
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 move_iterator operator--(int) {
+ move_iterator __tmp(*this);
+ --__current_;
+ return __tmp;
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 move_iterator operator+(difference_type __n) const {
+ return move_iterator(__current_ + __n);
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 move_iterator& operator+=(difference_type __n) {
+ __current_ += __n;
+ return *this;
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 move_iterator operator-(difference_type __n) const {
+ return move_iterator(__current_ - __n);
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 move_iterator& operator-=(difference_type __n) {
+ __current_ -= __n;
+ return *this;
+ }
#if _LIBCPP_STD_VER >= 20
- template<sentinel_for<_Iter> _Sent>
- friend _LIBCPP_HIDE_FROM_ABI constexpr
- bool operator==(const move_iterator& __x, const move_sentinel<_Sent>& __y)
- requires __move_iter_comparable<_Iter, _Sent>
- {
- return __x.base() == __y.base();
- }
-
- template<sized_sentinel_for<_Iter> _Sent>
- friend _LIBCPP_HIDE_FROM_ABI constexpr
- iter_difference_t<_Iter> operator-(const move_sentinel<_Sent>& __x, const move_iterator& __y)
- {
- return __x.base() - __y.base();
- }
-
- template<sized_sentinel_for<_Iter> _Sent>
- friend _LIBCPP_HIDE_FROM_ABI constexpr
- iter_difference_t<_Iter> operator-(const move_iterator& __x, const move_sentinel<_Sent>& __y)
- {
- return __x.base() - __y.base();
- }
+ template <sentinel_for<_Iter> _Sent>
+ friend _LIBCPP_HIDE_FROM_ABI constexpr bool operator==(const move_iterator& __x, const move_sentinel<_Sent>& __y)
+ requires __move_iter_comparable<_Iter, _Sent>
+ {
+ return __x.base() == __y.base();
+ }
- friend _LIBCPP_HIDE_FROM_ABI constexpr
- iter_rvalue_reference_t<_Iter> iter_move(const move_iterator& __i)
- noexcept(noexcept(ranges::iter_move(__i.__current_)))
- {
- return ranges::iter_move(__i.__current_);
- }
+ template <sized_sentinel_for<_Iter> _Sent>
+ friend _LIBCPP_HIDE_FROM_ABI constexpr iter_difference_t<_Iter>
+ operator-(const move_sentinel<_Sent>& __x, const move_iterator& __y) {
+ return __x.base() - __y.base();
+ }
- template<indirectly_swappable<_Iter> _It2>
- friend _LIBCPP_HIDE_FROM_ABI constexpr
- void iter_swap(const move_iterator& __x, const move_iterator<_It2>& __y)
- noexcept(noexcept(ranges::iter_swap(__x.__current_, __y.__current_)))
- {
- return ranges::iter_swap(__x.__current_, __y.__current_);
- }
+ template <sized_sentinel_for<_Iter> _Sent>
+ friend _LIBCPP_HIDE_FROM_ABI constexpr iter_difference_t<_Iter>
+ operator-(const move_iterator& __x, const move_sentinel<_Sent>& __y) {
+ return __x.base() - __y.base();
+ }
+
+ friend _LIBCPP_HIDE_FROM_ABI constexpr iter_rvalue_reference_t<_Iter>
+ iter_move(const move_iterator& __i) noexcept(noexcept(ranges::iter_move(__i.__current_))) {
+ return ranges::iter_move(__i.__current_);
+ }
+
+ template <indirectly_swappable<_Iter> _It2>
+ friend _LIBCPP_HIDE_FROM_ABI constexpr void
+ iter_swap(const move_iterator& __x,
+ const move_iterator<_It2>& __y) noexcept(noexcept(ranges::iter_swap(__x.__current_, __y.__current_))) {
+ return ranges::iter_swap(__x.__current_, __y.__current_);
+ }
#endif // _LIBCPP_STD_VER >= 20
private:
- template<class _It2> friend class move_iterator;
+ template <class _It2>
+ friend class move_iterator;
- _Iter __current_;
+ _Iter __current_;
};
_LIBCPP_CTAD_SUPPORTED_FOR_TYPE(move_iterator);
template <class _Iter1, class _Iter2>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
-bool operator==(const move_iterator<_Iter1>& __x, const move_iterator<_Iter2>& __y)
-{
- return __x.base() == __y.base();
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 bool
+operator==(const move_iterator<_Iter1>& __x, const move_iterator<_Iter2>& __y) {
+ return __x.base() == __y.base();
}
#if _LIBCPP_STD_VER <= 17
template <class _Iter1, class _Iter2>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
-bool operator!=(const move_iterator<_Iter1>& __x, const move_iterator<_Iter2>& __y)
-{
- return __x.base() != __y.base();
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 bool
+operator!=(const move_iterator<_Iter1>& __x, const move_iterator<_Iter2>& __y) {
+ return __x.base() != __y.base();
}
#endif // _LIBCPP_STD_VER <= 17
template <class _Iter1, class _Iter2>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
-bool operator<(const move_iterator<_Iter1>& __x, const move_iterator<_Iter2>& __y)
-{
- return __x.base() < __y.base();
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 bool
+operator<(const move_iterator<_Iter1>& __x, const move_iterator<_Iter2>& __y) {
+ return __x.base() < __y.base();
}
template <class _Iter1, class _Iter2>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
-bool operator>(const move_iterator<_Iter1>& __x, const move_iterator<_Iter2>& __y)
-{
- return __x.base() > __y.base();
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 bool
+operator>(const move_iterator<_Iter1>& __x, const move_iterator<_Iter2>& __y) {
+ return __x.base() > __y.base();
}
template <class _Iter1, class _Iter2>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
-bool operator<=(const move_iterator<_Iter1>& __x, const move_iterator<_Iter2>& __y)
-{
- return __x.base() <= __y.base();
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 bool
+operator<=(const move_iterator<_Iter1>& __x, const move_iterator<_Iter2>& __y) {
+ return __x.base() <= __y.base();
}
template <class _Iter1, class _Iter2>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
-bool operator>=(const move_iterator<_Iter1>& __x, const move_iterator<_Iter2>& __y)
-{
- return __x.base() >= __y.base();
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 bool
+operator>=(const move_iterator<_Iter1>& __x, const move_iterator<_Iter2>& __y) {
+ return __x.base() >= __y.base();
}
#if _LIBCPP_STD_VER >= 20
template <class _Iter1, three_way_comparable_with<_Iter1> _Iter2>
-inline _LIBCPP_HIDE_FROM_ABI constexpr
-auto operator<=>(const move_iterator<_Iter1>& __x, const move_iterator<_Iter2>& __y)
- -> compare_three_way_result_t<_Iter1, _Iter2>
-{
- return __x.base() <=> __y.base();
+inline _LIBCPP_HIDE_FROM_ABI constexpr auto
+operator<=>(const move_iterator<_Iter1>& __x, const move_iterator<_Iter2>& __y)
+ -> compare_three_way_result_t<_Iter1, _Iter2> {
+ return __x.base() <=> __y.base();
}
#endif // _LIBCPP_STD_VER >= 20
#ifndef _LIBCPP_CXX03_LANG
template <class _Iter1, class _Iter2>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
-auto operator-(const move_iterator<_Iter1>& __x, const move_iterator<_Iter2>& __y)
- -> decltype(__x.base() - __y.base())
-{
- return __x.base() - __y.base();
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 auto
+operator-(const move_iterator<_Iter1>& __x, const move_iterator<_Iter2>& __y) -> decltype(__x.base() - __y.base()) {
+ return __x.base() - __y.base();
}
#else
template <class _Iter1, class _Iter2>
-inline _LIBCPP_HIDE_FROM_ABI
-typename move_iterator<_Iter1>::difference_type
-operator-(const move_iterator<_Iter1>& __x, const move_iterator<_Iter2>& __y)
-{
- return __x.base() - __y.base();
+inline _LIBCPP_HIDE_FROM_ABI typename move_iterator<_Iter1>::difference_type
+operator-(const move_iterator<_Iter1>& __x, const move_iterator<_Iter2>& __y) {
+ return __x.base() - __y.base();
}
#endif // !_LIBCPP_CXX03_LANG
#if _LIBCPP_STD_VER >= 20
template <class _Iter>
-inline _LIBCPP_HIDE_FROM_ABI constexpr
-move_iterator<_Iter> operator+(iter_difference_t<_Iter> __n, const move_iterator<_Iter>& __x)
- requires requires { { __x.base() + __n } -> same_as<_Iter>; }
+inline _LIBCPP_HIDE_FROM_ABI constexpr move_iterator<_Iter>
+operator+(iter_difference_t<_Iter> __n, const move_iterator<_Iter>& __x)
+ requires requires {
+ { __x.base() + __n } -> same_as<_Iter>;
+ }
{
- return __x + __n;
+ return __x + __n;
}
#else
template <class _Iter>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
-move_iterator<_Iter>
-operator+(typename move_iterator<_Iter>::difference_type __n, const move_iterator<_Iter>& __x)
-{
- return move_iterator<_Iter>(__x.base() + __n);
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 move_iterator<_Iter>
+operator+(typename move_iterator<_Iter>::difference_type __n, const move_iterator<_Iter>& __x) {
+ return move_iterator<_Iter>(__x.base() + __n);
}
#endif // _LIBCPP_STD_VER >= 20
template <class _Iter>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
-move_iterator<_Iter>
-make_move_iterator(_Iter __i)
-{
- return move_iterator<_Iter>(std::move(__i));
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 move_iterator<_Iter> make_move_iterator(_Iter __i) {
+ return move_iterator<_Iter>(std::move(__i));
}
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__iterator/move_sentinel.h b/contrib/llvm-project/libcxx/include/__iterator/move_sentinel.h
index 34b3c25417c4..4a2a09ef0611 100644
--- a/contrib/llvm-project/libcxx/include/__iterator/move_sentinel.h
+++ b/contrib/llvm-project/libcxx/include/__iterator/move_sentinel.h
@@ -27,30 +27,27 @@ _LIBCPP_BEGIN_NAMESPACE_STD
#if _LIBCPP_STD_VER >= 20
template <semiregular _Sent>
-class _LIBCPP_TEMPLATE_VIS move_sentinel
-{
+class _LIBCPP_TEMPLATE_VIS move_sentinel {
public:
- _LIBCPP_HIDE_FROM_ABI
- move_sentinel() = default;
+ _LIBCPP_HIDE_FROM_ABI move_sentinel() = default;
- _LIBCPP_HIDE_FROM_ABI constexpr
- explicit move_sentinel(_Sent __s) : __last_(std::move(__s)) {}
+ _LIBCPP_HIDE_FROM_ABI constexpr explicit move_sentinel(_Sent __s) : __last_(std::move(__s)) {}
template <class _S2>
requires convertible_to<const _S2&, _Sent>
- _LIBCPP_HIDE_FROM_ABI constexpr
- move_sentinel(const move_sentinel<_S2>& __s) : __last_(__s.base()) {}
+ _LIBCPP_HIDE_FROM_ABI constexpr move_sentinel(const move_sentinel<_S2>& __s) : __last_(__s.base()) {}
template <class _S2>
requires assignable_from<_Sent&, const _S2&>
- _LIBCPP_HIDE_FROM_ABI constexpr
- move_sentinel& operator=(const move_sentinel<_S2>& __s)
- { __last_ = __s.base(); return *this; }
+ _LIBCPP_HIDE_FROM_ABI constexpr move_sentinel& operator=(const move_sentinel<_S2>& __s) {
+ __last_ = __s.base();
+ return *this;
+ }
_LIBCPP_HIDE_FROM_ABI constexpr _Sent base() const { return __last_; }
private:
- _Sent __last_ = _Sent();
+ _Sent __last_ = _Sent();
};
_LIBCPP_CTAD_SUPPORTED_FOR_TYPE(move_sentinel);
diff --git a/contrib/llvm-project/libcxx/include/__iterator/next.h b/contrib/llvm-project/libcxx/include/__iterator/next.h
index ae98229bdabf..da60aacfd08d 100644
--- a/contrib/llvm-project/libcxx/include/__iterator/next.h
+++ b/contrib/llvm-project/libcxx/include/__iterator/next.h
@@ -25,9 +25,8 @@
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _InputIter, __enable_if_t<__has_input_iterator_category<_InputIter>::value, int> = 0>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
- _InputIter
- next(_InputIter __x, typename iterator_traits<_InputIter>::difference_type __n = 1) {
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 _InputIter
+next(_InputIter __x, typename iterator_traits<_InputIter>::difference_type __n = 1) {
_LIBCPP_ASSERT_UNCATEGORIZED(__n >= 0 || __has_bidirectional_iterator_category<_InputIter>::value,
"Attempt to next(it, n) with negative n on a non-bidirectional iterator");
@@ -44,15 +43,13 @@ namespace __next {
struct __fn {
template <input_or_output_iterator _Ip>
- _LIBCPP_HIDE_FROM_ABI
- constexpr _Ip operator()(_Ip __x) const {
+ _LIBCPP_HIDE_FROM_ABI constexpr _Ip operator()(_Ip __x) const {
++__x;
return __x;
}
template <input_or_output_iterator _Ip>
- _LIBCPP_HIDE_FROM_ABI
- constexpr _Ip operator()(_Ip __x, iter_difference_t<_Ip> __n) const {
+ _LIBCPP_HIDE_FROM_ABI constexpr _Ip operator()(_Ip __x, iter_difference_t<_Ip> __n) const {
ranges::advance(__x, __n);
return __x;
}
@@ -73,7 +70,7 @@ struct __fn {
} // namespace __next
inline namespace __cpo {
- inline constexpr auto next = __next::__fn{};
+inline constexpr auto next = __next::__fn{};
} // namespace __cpo
} // namespace ranges
diff --git a/contrib/llvm-project/libcxx/include/__iterator/ostream_iterator.h b/contrib/llvm-project/libcxx/include/__iterator/ostream_iterator.h
index 381f75832fc6..05697e62d9dc 100644
--- a/contrib/llvm-project/libcxx/include/__iterator/ostream_iterator.h
+++ b/contrib/llvm-project/libcxx/include/__iterator/ostream_iterator.h
@@ -31,40 +31,43 @@ class _LIBCPP_TEMPLATE_VIS ostream_iterator
: public iterator<output_iterator_tag, void, void, void, void>
#endif
{
-_LIBCPP_SUPPRESS_DEPRECATED_POP
+ _LIBCPP_SUPPRESS_DEPRECATED_POP
+
public:
- typedef output_iterator_tag iterator_category;
- typedef void value_type;
+ typedef output_iterator_tag iterator_category;
+ typedef void value_type;
#if _LIBCPP_STD_VER >= 20
- typedef ptrdiff_t difference_type;
+ typedef ptrdiff_t difference_type;
#else
- typedef void difference_type;
+ typedef void difference_type;
#endif
- typedef void pointer;
- typedef void reference;
- typedef _CharT char_type;
- typedef _Traits traits_type;
- typedef basic_ostream<_CharT, _Traits> ostream_type;
+ typedef void pointer;
+ typedef void reference;
+ typedef _CharT char_type;
+ typedef _Traits traits_type;
+ typedef basic_ostream<_CharT, _Traits> ostream_type;
private:
- ostream_type* __out_stream_;
- const char_type* __delim_;
+ ostream_type* __out_stream_;
+ const char_type* __delim_;
+
public:
- _LIBCPP_HIDE_FROM_ABI ostream_iterator(ostream_type& __s) _NOEXCEPT
- : __out_stream_(std::addressof(__s)), __delim_(nullptr) {}
- _LIBCPP_HIDE_FROM_ABI ostream_iterator(ostream_type& __s, const _CharT* __delimiter) _NOEXCEPT
- : __out_stream_(std::addressof(__s)), __delim_(__delimiter) {}
- _LIBCPP_HIDE_FROM_ABI ostream_iterator& operator=(const _Tp& __value)
- {
- *__out_stream_ << __value;
- if (__delim_)
- *__out_stream_ << __delim_;
- return *this;
- }
+ _LIBCPP_HIDE_FROM_ABI ostream_iterator(ostream_type& __s) _NOEXCEPT
+ : __out_stream_(std::addressof(__s)),
+ __delim_(nullptr) {}
+ _LIBCPP_HIDE_FROM_ABI ostream_iterator(ostream_type& __s, const _CharT* __delimiter) _NOEXCEPT
+ : __out_stream_(std::addressof(__s)),
+ __delim_(__delimiter) {}
+ _LIBCPP_HIDE_FROM_ABI ostream_iterator& operator=(const _Tp& __value) {
+ *__out_stream_ << __value;
+ if (__delim_)
+ *__out_stream_ << __delim_;
+ return *this;
+ }
- _LIBCPP_HIDE_FROM_ABI ostream_iterator& operator*() {return *this;}
- _LIBCPP_HIDE_FROM_ABI ostream_iterator& operator++() {return *this;}
- _LIBCPP_HIDE_FROM_ABI ostream_iterator& operator++(int) {return *this;}
+ _LIBCPP_HIDE_FROM_ABI ostream_iterator& operator*() { return *this; }
+ _LIBCPP_HIDE_FROM_ABI ostream_iterator& operator++() { return *this; }
+ _LIBCPP_HIDE_FROM_ABI ostream_iterator& operator++(int) { return *this; }
};
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__iterator/ostreambuf_iterator.h b/contrib/llvm-project/libcxx/include/__iterator/ostreambuf_iterator.h
index 6f7491eda5b4..dda0094dc3f5 100644
--- a/contrib/llvm-project/libcxx/include/__iterator/ostreambuf_iterator.h
+++ b/contrib/llvm-project/libcxx/include/__iterator/ostreambuf_iterator.h
@@ -29,47 +29,42 @@ class _LIBCPP_TEMPLATE_VIS ostreambuf_iterator
: public iterator<output_iterator_tag, void, void, void, void>
#endif
{
-_LIBCPP_SUPPRESS_DEPRECATED_POP
+ _LIBCPP_SUPPRESS_DEPRECATED_POP
+
public:
- typedef output_iterator_tag iterator_category;
- typedef void value_type;
+ typedef output_iterator_tag iterator_category;
+ typedef void value_type;
#if _LIBCPP_STD_VER >= 20
- typedef ptrdiff_t difference_type;
+ typedef ptrdiff_t difference_type;
#else
- typedef void difference_type;
+ typedef void difference_type;
#endif
- typedef void pointer;
- typedef void reference;
- typedef _CharT char_type;
- typedef _Traits traits_type;
- typedef basic_streambuf<_CharT, _Traits> streambuf_type;
- typedef basic_ostream<_CharT, _Traits> ostream_type;
+ typedef void pointer;
+ typedef void reference;
+ typedef _CharT char_type;
+ typedef _Traits traits_type;
+ typedef basic_streambuf<_CharT, _Traits> streambuf_type;
+ typedef basic_ostream<_CharT, _Traits> ostream_type;
private:
- streambuf_type* __sbuf_;
+ streambuf_type* __sbuf_;
+
public:
- _LIBCPP_HIDE_FROM_ABI ostreambuf_iterator(ostream_type& __s) _NOEXCEPT
- : __sbuf_(__s.rdbuf()) {}
- _LIBCPP_HIDE_FROM_ABI ostreambuf_iterator(streambuf_type* __s) _NOEXCEPT
- : __sbuf_(__s) {}
- _LIBCPP_HIDE_FROM_ABI ostreambuf_iterator& operator=(_CharT __c)
- {
- if (__sbuf_ && traits_type::eq_int_type(__sbuf_->sputc(__c), traits_type::eof()))
- __sbuf_ = nullptr;
- return *this;
- }
- _LIBCPP_HIDE_FROM_ABI ostreambuf_iterator& operator*() {return *this;}
- _LIBCPP_HIDE_FROM_ABI ostreambuf_iterator& operator++() {return *this;}
- _LIBCPP_HIDE_FROM_ABI ostreambuf_iterator& operator++(int) {return *this;}
- _LIBCPP_HIDE_FROM_ABI bool failed() const _NOEXCEPT {return __sbuf_ == nullptr;}
+ _LIBCPP_HIDE_FROM_ABI ostreambuf_iterator(ostream_type& __s) _NOEXCEPT : __sbuf_(__s.rdbuf()) {}
+ _LIBCPP_HIDE_FROM_ABI ostreambuf_iterator(streambuf_type* __s) _NOEXCEPT : __sbuf_(__s) {}
+ _LIBCPP_HIDE_FROM_ABI ostreambuf_iterator& operator=(_CharT __c) {
+ if (__sbuf_ && traits_type::eq_int_type(__sbuf_->sputc(__c), traits_type::eof()))
+ __sbuf_ = nullptr;
+ return *this;
+ }
+ _LIBCPP_HIDE_FROM_ABI ostreambuf_iterator& operator*() { return *this; }
+ _LIBCPP_HIDE_FROM_ABI ostreambuf_iterator& operator++() { return *this; }
+ _LIBCPP_HIDE_FROM_ABI ostreambuf_iterator& operator++(int) { return *this; }
+ _LIBCPP_HIDE_FROM_ABI bool failed() const _NOEXCEPT { return __sbuf_ == nullptr; }
- template <class _Ch, class _Tr>
- friend
- _LIBCPP_HIDE_FROM_ABI
- ostreambuf_iterator<_Ch, _Tr>
- __pad_and_output(ostreambuf_iterator<_Ch, _Tr> __s,
- const _Ch* __ob, const _Ch* __op, const _Ch* __oe,
- ios_base& __iob, _Ch __fl);
+ template <class _Ch, class _Tr>
+ friend _LIBCPP_HIDE_FROM_ABI ostreambuf_iterator<_Ch, _Tr> __pad_and_output(
+ ostreambuf_iterator<_Ch, _Tr> __s, const _Ch* __ob, const _Ch* __op, const _Ch* __oe, ios_base& __iob, _Ch __fl);
};
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__iterator/permutable.h b/contrib/llvm-project/libcxx/include/__iterator/permutable.h
index adf88f506529..f65ba3bfbbaa 100644
--- a/contrib/llvm-project/libcxx/include/__iterator/permutable.h
+++ b/contrib/llvm-project/libcxx/include/__iterator/permutable.h
@@ -24,8 +24,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
template <class _Iterator>
concept permutable =
- forward_iterator<_Iterator> &&
- indirectly_movable_storable<_Iterator, _Iterator> &&
+ forward_iterator<_Iterator> && indirectly_movable_storable<_Iterator, _Iterator> &&
indirectly_swappable<_Iterator, _Iterator>;
#endif // _LIBCPP_STD_VER >= 20
diff --git a/contrib/llvm-project/libcxx/include/__iterator/prev.h b/contrib/llvm-project/libcxx/include/__iterator/prev.h
index 3bc29a27e743..1651942acea9 100644
--- a/contrib/llvm-project/libcxx/include/__iterator/prev.h
+++ b/contrib/llvm-project/libcxx/include/__iterator/prev.h
@@ -25,9 +25,8 @@
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _InputIter, __enable_if_t<__has_input_iterator_category<_InputIter>::value, int> = 0>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
- _InputIter
- prev(_InputIter __x, typename iterator_traits<_InputIter>::difference_type __n = 1) {
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 _InputIter
+prev(_InputIter __x, typename iterator_traits<_InputIter>::difference_type __n = 1) {
_LIBCPP_ASSERT_UNCATEGORIZED(__n <= 0 || __has_bidirectional_iterator_category<_InputIter>::value,
"Attempt to prev(it, n) with a positive n on a non-bidirectional iterator");
std::advance(__x, -__n);
@@ -43,15 +42,13 @@ namespace __prev {
struct __fn {
template <bidirectional_iterator _Ip>
- _LIBCPP_HIDE_FROM_ABI
- constexpr _Ip operator()(_Ip __x) const {
+ _LIBCPP_HIDE_FROM_ABI constexpr _Ip operator()(_Ip __x) const {
--__x;
return __x;
}
template <bidirectional_iterator _Ip>
- _LIBCPP_HIDE_FROM_ABI
- constexpr _Ip operator()(_Ip __x, iter_difference_t<_Ip> __n) const {
+ _LIBCPP_HIDE_FROM_ABI constexpr _Ip operator()(_Ip __x, iter_difference_t<_Ip> __n) const {
ranges::advance(__x, -__n);
return __x;
}
@@ -66,7 +63,7 @@ struct __fn {
} // namespace __prev
inline namespace __cpo {
- inline constexpr auto prev = __prev::__fn{};
+inline constexpr auto prev = __prev::__fn{};
} // namespace __cpo
} // namespace ranges
diff --git a/contrib/llvm-project/libcxx/include/__iterator/readable_traits.h b/contrib/llvm-project/libcxx/include/__iterator/readable_traits.h
index 9e101fc28a6f..25e74567fff1 100644
--- a/contrib/llvm-project/libcxx/include/__iterator/readable_traits.h
+++ b/contrib/llvm-project/libcxx/include/__iterator/readable_traits.h
@@ -29,50 +29,50 @@ _LIBCPP_BEGIN_NAMESPACE_STD
#if _LIBCPP_STD_VER >= 20
// [readable.traits]
-template<class> struct __cond_value_type {};
+template <class>
+struct __cond_value_type {};
-template<class _Tp>
-requires is_object_v<_Tp>
-struct __cond_value_type<_Tp> { using value_type = remove_cv_t<_Tp>; };
+template <class _Tp>
+ requires is_object_v<_Tp>
+struct __cond_value_type<_Tp> {
+ using value_type = remove_cv_t<_Tp>;
+};
-template<class _Tp>
+template <class _Tp>
concept __has_member_value_type = requires { typename _Tp::value_type; };
-template<class _Tp>
+template <class _Tp>
concept __has_member_element_type = requires { typename _Tp::element_type; };
-template<class> struct indirectly_readable_traits {};
+template <class>
+struct indirectly_readable_traits {};
-template<class _Ip>
-requires is_array_v<_Ip>
+template <class _Ip>
+ requires is_array_v<_Ip>
struct indirectly_readable_traits<_Ip> {
using value_type = remove_cv_t<remove_extent_t<_Ip>>;
};
-template<class _Ip>
+template <class _Ip>
struct indirectly_readable_traits<const _Ip> : indirectly_readable_traits<_Ip> {};
-template<class _Tp>
+template <class _Tp>
struct indirectly_readable_traits<_Tp*> : __cond_value_type<_Tp> {};
-template<__has_member_value_type _Tp>
-struct indirectly_readable_traits<_Tp>
- : __cond_value_type<typename _Tp::value_type> {};
+template <__has_member_value_type _Tp>
+struct indirectly_readable_traits<_Tp> : __cond_value_type<typename _Tp::value_type> {};
-template<__has_member_element_type _Tp>
-struct indirectly_readable_traits<_Tp>
- : __cond_value_type<typename _Tp::element_type> {};
+template <__has_member_element_type _Tp>
+struct indirectly_readable_traits<_Tp> : __cond_value_type<typename _Tp::element_type> {};
-template<__has_member_value_type _Tp>
+template <__has_member_value_type _Tp>
requires __has_member_element_type<_Tp>
struct indirectly_readable_traits<_Tp> {};
-template<__has_member_value_type _Tp>
+template <__has_member_value_type _Tp>
requires __has_member_element_type<_Tp> &&
- same_as<remove_cv_t<typename _Tp::element_type>,
- remove_cv_t<typename _Tp::value_type>>
-struct indirectly_readable_traits<_Tp>
- : __cond_value_type<typename _Tp::value_type> {};
+ same_as<remove_cv_t<typename _Tp::element_type>, remove_cv_t<typename _Tp::value_type>>
+struct indirectly_readable_traits<_Tp> : __cond_value_type<typename _Tp::value_type> {};
#endif // _LIBCPP_STD_VER >= 20
diff --git a/contrib/llvm-project/libcxx/include/__iterator/reverse_access.h b/contrib/llvm-project/libcxx/include/__iterator/reverse_access.h
index 5e01f667e115..54d7270b04a5 100644
--- a/contrib/llvm-project/libcxx/include/__iterator/reverse_access.h
+++ b/contrib/llvm-project/libcxx/include/__iterator/reverse_access.h
@@ -24,73 +24,53 @@ _LIBCPP_BEGIN_NAMESPACE_STD
#if _LIBCPP_STD_VER >= 14
template <class _Tp, size_t _Np>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
-reverse_iterator<_Tp*> rbegin(_Tp (&__array)[_Np])
-{
- return reverse_iterator<_Tp*>(__array + _Np);
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 reverse_iterator<_Tp*> rbegin(_Tp (&__array)[_Np]) {
+ return reverse_iterator<_Tp*>(__array + _Np);
}
template <class _Tp, size_t _Np>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
-reverse_iterator<_Tp*> rend(_Tp (&__array)[_Np])
-{
- return reverse_iterator<_Tp*>(__array);
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 reverse_iterator<_Tp*> rend(_Tp (&__array)[_Np]) {
+ return reverse_iterator<_Tp*>(__array);
}
template <class _Ep>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
-reverse_iterator<const _Ep*> rbegin(initializer_list<_Ep> __il)
-{
- return reverse_iterator<const _Ep*>(__il.end());
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 reverse_iterator<const _Ep*> rbegin(initializer_list<_Ep> __il) {
+ return reverse_iterator<const _Ep*>(__il.end());
}
template <class _Ep>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
-reverse_iterator<const _Ep*> rend(initializer_list<_Ep> __il)
-{
- return reverse_iterator<const _Ep*>(__il.begin());
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 reverse_iterator<const _Ep*> rend(initializer_list<_Ep> __il) {
+ return reverse_iterator<const _Ep*>(__il.begin());
}
template <class _Cp>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
-auto rbegin(_Cp& __c) -> decltype(__c.rbegin())
-{
- return __c.rbegin();
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 auto rbegin(_Cp& __c) -> decltype(__c.rbegin()) {
+ return __c.rbegin();
}
template <class _Cp>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
-auto rbegin(const _Cp& __c) -> decltype(__c.rbegin())
-{
- return __c.rbegin();
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 auto rbegin(const _Cp& __c) -> decltype(__c.rbegin()) {
+ return __c.rbegin();
}
template <class _Cp>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
-auto rend(_Cp& __c) -> decltype(__c.rend())
-{
- return __c.rend();
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 auto rend(_Cp& __c) -> decltype(__c.rend()) {
+ return __c.rend();
}
template <class _Cp>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
-auto rend(const _Cp& __c) -> decltype(__c.rend())
-{
- return __c.rend();
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 auto rend(const _Cp& __c) -> decltype(__c.rend()) {
+ return __c.rend();
}
template <class _Cp>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
-auto crbegin(const _Cp& __c) -> decltype(std::rbegin(__c))
-{
- return std::rbegin(__c);
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 auto crbegin(const _Cp& __c) -> decltype(std::rbegin(__c)) {
+ return std::rbegin(__c);
}
template <class _Cp>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
-auto crend(const _Cp& __c) -> decltype(std::rend(__c))
-{
- return std::rend(__c);
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 auto crend(const _Cp& __c) -> decltype(std::rend(__c)) {
+ return std::rend(__c);
}
#endif // _LIBCPP_STD_VER >= 14
diff --git a/contrib/llvm-project/libcxx/include/__iterator/reverse_iterator.h b/contrib/llvm-project/libcxx/include/__iterator/reverse_iterator.h
index 552699bfafa4..79b48bcea57a 100644
--- a/contrib/llvm-project/libcxx/include/__iterator/reverse_iterator.h
+++ b/contrib/llvm-project/libcxx/include/__iterator/reverse_iterator.h
@@ -57,279 +57,262 @@ class _LIBCPP_TEMPLATE_VIS reverse_iterator
typename iterator_traits<_Iter>::reference>
#endif
{
-_LIBCPP_SUPPRESS_DEPRECATED_POP
+ _LIBCPP_SUPPRESS_DEPRECATED_POP
+
private:
#ifndef _LIBCPP_ABI_NO_ITERATOR_BASES
- _Iter __t_; // no longer used as of LWG #2360, not removed due to ABI break
+ _Iter __t_; // no longer used as of LWG #2360, not removed due to ABI break
#endif
#if _LIBCPP_STD_VER >= 20
- static_assert(__has_bidirectional_iterator_category<_Iter>::value || bidirectional_iterator<_Iter>,
- "reverse_iterator<It> requires It to be a bidirectional iterator.");
+ static_assert(__has_bidirectional_iterator_category<_Iter>::value || bidirectional_iterator<_Iter>,
+ "reverse_iterator<It> requires It to be a bidirectional iterator.");
#endif // _LIBCPP_STD_VER >= 20
protected:
- _Iter current;
+ _Iter current;
+
public:
- using iterator_type = _Iter;
+ using iterator_type = _Iter;
- using iterator_category = _If<__has_random_access_iterator_category<_Iter>::value,
- random_access_iterator_tag,
- typename iterator_traits<_Iter>::iterator_category>;
- using pointer = typename iterator_traits<_Iter>::pointer;
+ using iterator_category =
+ _If<__has_random_access_iterator_category<_Iter>::value,
+ random_access_iterator_tag,
+ typename iterator_traits<_Iter>::iterator_category>;
+ using pointer = typename iterator_traits<_Iter>::pointer;
#if _LIBCPP_STD_VER >= 20
- using iterator_concept = _If<random_access_iterator<_Iter>, random_access_iterator_tag, bidirectional_iterator_tag>;
- using value_type = iter_value_t<_Iter>;
- using difference_type = iter_difference_t<_Iter>;
- using reference = iter_reference_t<_Iter>;
+ using iterator_concept = _If<random_access_iterator<_Iter>, random_access_iterator_tag, bidirectional_iterator_tag>;
+ using value_type = iter_value_t<_Iter>;
+ using difference_type = iter_difference_t<_Iter>;
+ using reference = iter_reference_t<_Iter>;
#else
- using value_type = typename iterator_traits<_Iter>::value_type;
- using difference_type = typename iterator_traits<_Iter>::difference_type;
- using reference = typename iterator_traits<_Iter>::reference;
+ using value_type = typename iterator_traits<_Iter>::value_type;
+ using difference_type = typename iterator_traits<_Iter>::difference_type;
+ using reference = typename iterator_traits<_Iter>::reference;
#endif
#ifndef _LIBCPP_ABI_NO_ITERATOR_BASES
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
- reverse_iterator() : __t_(), current() {}
-
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
- explicit reverse_iterator(_Iter __x) : __t_(__x), current(__x) {}
-
- template <class _Up, class = __enable_if_t<
- !is_same<_Up, _Iter>::value && is_convertible<_Up const&, _Iter>::value
- > >
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
- reverse_iterator(const reverse_iterator<_Up>& __u)
- : __t_(__u.base()), current(__u.base())
- { }
-
- template <class _Up, class = __enable_if_t<
- !is_same<_Up, _Iter>::value &&
- is_convertible<_Up const&, _Iter>::value &&
- is_assignable<_Iter&, _Up const&>::value
- > >
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
- reverse_iterator& operator=(const reverse_iterator<_Up>& __u) {
- __t_ = current = __u.base();
- return *this;
- }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 reverse_iterator() : __t_(), current() {}
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 explicit reverse_iterator(_Iter __x) : __t_(__x), current(__x) {}
+
+ template <class _Up,
+ class = __enable_if_t< !is_same<_Up, _Iter>::value && is_convertible<_Up const&, _Iter>::value > >
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 reverse_iterator(const reverse_iterator<_Up>& __u)
+ : __t_(__u.base()), current(__u.base()) {}
+
+ template <class _Up,
+ class = __enable_if_t< !is_same<_Up, _Iter>::value && is_convertible<_Up const&, _Iter>::value &&
+ is_assignable<_Iter&, _Up const&>::value > >
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 reverse_iterator& operator=(const reverse_iterator<_Up>& __u) {
+ __t_ = current = __u.base();
+ return *this;
+ }
#else
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
- reverse_iterator() : current() {}
-
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
- explicit reverse_iterator(_Iter __x) : current(__x) {}
-
- template <class _Up, class = __enable_if_t<
- !is_same<_Up, _Iter>::value && is_convertible<_Up const&, _Iter>::value
- > >
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
- reverse_iterator(const reverse_iterator<_Up>& __u)
- : current(__u.base())
- { }
-
- template <class _Up, class = __enable_if_t<
- !is_same<_Up, _Iter>::value &&
- is_convertible<_Up const&, _Iter>::value &&
- is_assignable<_Iter&, _Up const&>::value
- > >
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
- reverse_iterator& operator=(const reverse_iterator<_Up>& __u) {
- current = __u.base();
- return *this;
- }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 reverse_iterator() : current() {}
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 explicit reverse_iterator(_Iter __x) : current(__x) {}
+
+ template <class _Up,
+ class = __enable_if_t< !is_same<_Up, _Iter>::value && is_convertible<_Up const&, _Iter>::value > >
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 reverse_iterator(const reverse_iterator<_Up>& __u)
+ : current(__u.base()) {}
+
+ template <class _Up,
+ class = __enable_if_t< !is_same<_Up, _Iter>::value && is_convertible<_Up const&, _Iter>::value &&
+ is_assignable<_Iter&, _Up const&>::value > >
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 reverse_iterator& operator=(const reverse_iterator<_Up>& __u) {
+ current = __u.base();
+ return *this;
+ }
#endif
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
- _Iter base() const {return current;}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
- reference operator*() const {_Iter __tmp = current; return *--__tmp;}
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 _Iter base() const { return current; }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 reference operator*() const {
+ _Iter __tmp = current;
+ return *--__tmp;
+ }
#if _LIBCPP_STD_VER >= 20
- _LIBCPP_HIDE_FROM_ABI
- constexpr pointer operator->() const
- requires is_pointer_v<_Iter> || requires(const _Iter __i) { __i.operator->(); }
- {
- if constexpr (is_pointer_v<_Iter>) {
- return std::prev(current);
- } else {
- return std::prev(current).operator->();
- }
+ _LIBCPP_HIDE_FROM_ABI constexpr pointer operator->() const
+ requires is_pointer_v<_Iter> || requires(const _Iter __i) { __i.operator->(); }
+ {
+ if constexpr (is_pointer_v<_Iter>) {
+ return std::prev(current);
+ } else {
+ return std::prev(current).operator->();
}
+ }
#else
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
- pointer operator->() const {
- return std::addressof(operator*());
- }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 pointer operator->() const { return std::addressof(operator*()); }
#endif // _LIBCPP_STD_VER >= 20
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
- reverse_iterator& operator++() {--current; return *this;}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
- reverse_iterator operator++(int) {reverse_iterator __tmp(*this); --current; return __tmp;}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
- reverse_iterator& operator--() {++current; return *this;}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
- reverse_iterator operator--(int) {reverse_iterator __tmp(*this); ++current; return __tmp;}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
- reverse_iterator operator+(difference_type __n) const {return reverse_iterator(current - __n);}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
- reverse_iterator& operator+=(difference_type __n) {current -= __n; return *this;}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
- reverse_iterator operator-(difference_type __n) const {return reverse_iterator(current + __n);}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
- reverse_iterator& operator-=(difference_type __n) {current += __n; return *this;}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
- reference operator[](difference_type __n) const {return *(*this + __n);}
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 reverse_iterator& operator++() {
+ --current;
+ return *this;
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 reverse_iterator operator++(int) {
+ reverse_iterator __tmp(*this);
+ --current;
+ return __tmp;
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 reverse_iterator& operator--() {
+ ++current;
+ return *this;
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 reverse_iterator operator--(int) {
+ reverse_iterator __tmp(*this);
+ ++current;
+ return __tmp;
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 reverse_iterator operator+(difference_type __n) const {
+ return reverse_iterator(current - __n);
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 reverse_iterator& operator+=(difference_type __n) {
+ current -= __n;
+ return *this;
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 reverse_iterator operator-(difference_type __n) const {
+ return reverse_iterator(current + __n);
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 reverse_iterator& operator-=(difference_type __n) {
+ current += __n;
+ return *this;
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 reference operator[](difference_type __n) const {
+ return *(*this + __n);
+ }
#if _LIBCPP_STD_VER >= 20
- _LIBCPP_HIDE_FROM_ABI friend constexpr
- iter_rvalue_reference_t<_Iter> iter_move(const reverse_iterator& __i)
- noexcept(is_nothrow_copy_constructible_v<_Iter> &&
- noexcept(ranges::iter_move(--std::declval<_Iter&>()))) {
- auto __tmp = __i.base();
- return ranges::iter_move(--__tmp);
- }
+ _LIBCPP_HIDE_FROM_ABI friend constexpr iter_rvalue_reference_t<_Iter> iter_move(const reverse_iterator& __i) noexcept(
+ is_nothrow_copy_constructible_v<_Iter>&& noexcept(ranges::iter_move(--std::declval<_Iter&>()))) {
+ auto __tmp = __i.base();
+ return ranges::iter_move(--__tmp);
+ }
- template <indirectly_swappable<_Iter> _Iter2>
- _LIBCPP_HIDE_FROM_ABI friend constexpr
- void iter_swap(const reverse_iterator& __x, const reverse_iterator<_Iter2>& __y)
- noexcept(is_nothrow_copy_constructible_v<_Iter> &&
- is_nothrow_copy_constructible_v<_Iter2> &&
- noexcept(ranges::iter_swap(--std::declval<_Iter&>(), --std::declval<_Iter2&>()))) {
- auto __xtmp = __x.base();
- auto __ytmp = __y.base();
- ranges::iter_swap(--__xtmp, --__ytmp);
- }
+ template <indirectly_swappable<_Iter> _Iter2>
+ _LIBCPP_HIDE_FROM_ABI friend constexpr void
+ iter_swap(const reverse_iterator& __x, const reverse_iterator<_Iter2>& __y) noexcept(
+ is_nothrow_copy_constructible_v<_Iter> &&
+ is_nothrow_copy_constructible_v<_Iter2>&& noexcept(
+ ranges::iter_swap(--std::declval<_Iter&>(), --std::declval<_Iter2&>()))) {
+ auto __xtmp = __x.base();
+ auto __ytmp = __y.base();
+ ranges::iter_swap(--__xtmp, --__ytmp);
+ }
#endif // _LIBCPP_STD_VER >= 20
};
template <class _Iter1, class _Iter2>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
-bool
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 bool
operator==(const reverse_iterator<_Iter1>& __x, const reverse_iterator<_Iter2>& __y)
#if _LIBCPP_STD_VER >= 20
- requires requires {
- { __x.base() == __y.base() } -> convertible_to<bool>;
- }
+ requires requires {
+ { __x.base() == __y.base() } -> convertible_to<bool>;
+ }
#endif // _LIBCPP_STD_VER >= 20
{
- return __x.base() == __y.base();
+ return __x.base() == __y.base();
}
template <class _Iter1, class _Iter2>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
-bool
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 bool
operator<(const reverse_iterator<_Iter1>& __x, const reverse_iterator<_Iter2>& __y)
#if _LIBCPP_STD_VER >= 20
- requires requires {
- { __x.base() > __y.base() } -> convertible_to<bool>;
- }
+ requires requires {
+ { __x.base() > __y.base() } -> convertible_to<bool>;
+ }
#endif // _LIBCPP_STD_VER >= 20
{
- return __x.base() > __y.base();
+ return __x.base() > __y.base();
}
template <class _Iter1, class _Iter2>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
-bool
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 bool
operator!=(const reverse_iterator<_Iter1>& __x, const reverse_iterator<_Iter2>& __y)
#if _LIBCPP_STD_VER >= 20
- requires requires {
- { __x.base() != __y.base() } -> convertible_to<bool>;
- }
+ requires requires {
+ { __x.base() != __y.base() } -> convertible_to<bool>;
+ }
#endif // _LIBCPP_STD_VER >= 20
{
- return __x.base() != __y.base();
+ return __x.base() != __y.base();
}
template <class _Iter1, class _Iter2>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
-bool
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 bool
operator>(const reverse_iterator<_Iter1>& __x, const reverse_iterator<_Iter2>& __y)
#if _LIBCPP_STD_VER >= 20
- requires requires {
- { __x.base() < __y.base() } -> convertible_to<bool>;
- }
+ requires requires {
+ { __x.base() < __y.base() } -> convertible_to<bool>;
+ }
#endif // _LIBCPP_STD_VER >= 20
{
- return __x.base() < __y.base();
+ return __x.base() < __y.base();
}
template <class _Iter1, class _Iter2>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
-bool
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 bool
operator>=(const reverse_iterator<_Iter1>& __x, const reverse_iterator<_Iter2>& __y)
#if _LIBCPP_STD_VER >= 20
- requires requires {
- { __x.base() <= __y.base() } -> convertible_to<bool>;
- }
+ requires requires {
+ { __x.base() <= __y.base() } -> convertible_to<bool>;
+ }
#endif // _LIBCPP_STD_VER >= 20
{
- return __x.base() <= __y.base();
+ return __x.base() <= __y.base();
}
template <class _Iter1, class _Iter2>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
-bool
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 bool
operator<=(const reverse_iterator<_Iter1>& __x, const reverse_iterator<_Iter2>& __y)
#if _LIBCPP_STD_VER >= 20
- requires requires {
- { __x.base() >= __y.base() } -> convertible_to<bool>;
- }
+ requires requires {
+ { __x.base() >= __y.base() } -> convertible_to<bool>;
+ }
#endif // _LIBCPP_STD_VER >= 20
{
- return __x.base() >= __y.base();
+ return __x.base() >= __y.base();
}
#if _LIBCPP_STD_VER >= 20
template <class _Iter1, three_way_comparable_with<_Iter1> _Iter2>
-_LIBCPP_HIDE_FROM_ABI constexpr
-compare_three_way_result_t<_Iter1, _Iter2>
-operator<=>(const reverse_iterator<_Iter1>& __x, const reverse_iterator<_Iter2>& __y)
-{
- return __y.base() <=> __x.base();
+_LIBCPP_HIDE_FROM_ABI constexpr compare_three_way_result_t<_Iter1, _Iter2>
+operator<=>(const reverse_iterator<_Iter1>& __x, const reverse_iterator<_Iter2>& __y) {
+ return __y.base() <=> __x.base();
}
#endif // _LIBCPP_STD_VER >= 20
#ifndef _LIBCPP_CXX03_LANG
template <class _Iter1, class _Iter2>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
-auto
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 auto
operator-(const reverse_iterator<_Iter1>& __x, const reverse_iterator<_Iter2>& __y)
--> decltype(__y.base() - __x.base())
-{
- return __y.base() - __x.base();
+ -> decltype(__y.base() - __x.base()) {
+ return __y.base() - __x.base();
}
#else
template <class _Iter1, class _Iter2>
-inline _LIBCPP_HIDE_FROM_ABI
-typename reverse_iterator<_Iter1>::difference_type
-operator-(const reverse_iterator<_Iter1>& __x, const reverse_iterator<_Iter2>& __y)
-{
- return __y.base() - __x.base();
+inline _LIBCPP_HIDE_FROM_ABI typename reverse_iterator<_Iter1>::difference_type
+operator-(const reverse_iterator<_Iter1>& __x, const reverse_iterator<_Iter2>& __y) {
+ return __y.base() - __x.base();
}
#endif
template <class _Iter>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
-reverse_iterator<_Iter>
-operator+(typename reverse_iterator<_Iter>::difference_type __n, const reverse_iterator<_Iter>& __x)
-{
- return reverse_iterator<_Iter>(__x.base() - __n);
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 reverse_iterator<_Iter>
+operator+(typename reverse_iterator<_Iter>::difference_type __n, const reverse_iterator<_Iter>& __x) {
+ return reverse_iterator<_Iter>(__x.base() - __n);
}
#if _LIBCPP_STD_VER >= 20
template <class _Iter1, class _Iter2>
- requires (!sized_sentinel_for<_Iter1, _Iter2>)
+ requires(!sized_sentinel_for<_Iter1, _Iter2>)
inline constexpr bool disable_sized_sentinel_for<reverse_iterator<_Iter1>, reverse_iterator<_Iter2>> = true;
#endif // _LIBCPP_STD_VER >= 20
#if _LIBCPP_STD_VER >= 14
template <class _Iter>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
-reverse_iterator<_Iter> make_reverse_iterator(_Iter __i)
-{
- return reverse_iterator<_Iter>(__i);
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 reverse_iterator<_Iter> make_reverse_iterator(_Iter __i) {
+ return reverse_iterator<_Iter>(__i);
}
#endif
@@ -369,13 +352,15 @@ public:
using iterator_type = _Iter;
using iterator_category =
- _If<__has_random_access_iterator_category<_Iter>::value, random_access_iterator_tag, __iterator_category_type<_Iter>>;
- using pointer = __iterator_pointer_type<_Iter>;
- using value_type = iter_value_t<_Iter>;
+ _If<__has_random_access_iterator_category<_Iter>::value,
+ random_access_iterator_tag,
+ __iterator_category_type<_Iter>>;
+ using pointer = __iterator_pointer_type<_Iter>;
+ using value_type = iter_value_t<_Iter>;
using difference_type = iter_difference_t<_Iter>;
- using reference = iter_reference_t<_Iter>;
+ using reference = iter_reference_t<_Iter>;
- _LIBCPP_HIDE_FROM_ABI constexpr __unconstrained_reverse_iterator() = default;
+ _LIBCPP_HIDE_FROM_ABI constexpr __unconstrained_reverse_iterator() = default;
_LIBCPP_HIDE_FROM_ABI constexpr __unconstrained_reverse_iterator(const __unconstrained_reverse_iterator&) = default;
_LIBCPP_HIDE_FROM_ABI constexpr explicit __unconstrained_reverse_iterator(_Iter __iter) : __iter_(__iter) {}
@@ -393,10 +378,9 @@ public:
}
}
- _LIBCPP_HIDE_FROM_ABI friend constexpr
- iter_rvalue_reference_t<_Iter> iter_move(const __unconstrained_reverse_iterator& __i)
- noexcept(is_nothrow_copy_constructible_v<_Iter> &&
- noexcept(ranges::iter_move(--std::declval<_Iter&>()))) {
+ _LIBCPP_HIDE_FROM_ABI friend constexpr iter_rvalue_reference_t<_Iter>
+ iter_move(const __unconstrained_reverse_iterator& __i) noexcept(
+ is_nothrow_copy_constructible_v<_Iter>&& noexcept(ranges::iter_move(--std::declval<_Iter&>()))) {
auto __tmp = __i.base();
return ranges::iter_move(--__tmp);
}
@@ -484,7 +468,7 @@ public:
template <template <class> class _RevIter1, template <class> class _RevIter2, class _Iter>
struct __unwrap_reverse_iter_impl {
- using _UnwrappedIter = decltype(__unwrap_iter_impl<_Iter>::__unwrap(std::declval<_Iter>()));
+ using _UnwrappedIter = decltype(__unwrap_iter_impl<_Iter>::__unwrap(std::declval<_Iter>()));
using _ReverseWrapper = _RevIter1<_RevIter2<_Iter> >;
static _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR _ReverseWrapper
@@ -500,9 +484,9 @@ struct __unwrap_reverse_iter_impl {
#if _LIBCPP_STD_VER >= 20
template <ranges::bidirectional_range _Range>
-_LIBCPP_HIDE_FROM_ABI constexpr ranges::
- subrange<reverse_iterator<ranges::iterator_t<_Range>>, reverse_iterator<ranges::iterator_t<_Range>>>
- __reverse_range(_Range&& __range) {
+_LIBCPP_HIDE_FROM_ABI constexpr ranges::subrange<reverse_iterator<ranges::iterator_t<_Range>>,
+ reverse_iterator<ranges::iterator_t<_Range>>>
+__reverse_range(_Range&& __range) {
auto __first = ranges::begin(__range);
return {std::make_reverse_iterator(ranges::next(__first, ranges::end(__range))), std::make_reverse_iterator(__first)};
}
diff --git a/contrib/llvm-project/libcxx/include/__iterator/size.h b/contrib/llvm-project/libcxx/include/__iterator/size.h
index 11c757f751c0..eac3ccf522c3 100644
--- a/contrib/llvm-project/libcxx/include/__iterator/size.h
+++ b/contrib/llvm-project/libcxx/include/__iterator/size.h
@@ -24,33 +24,33 @@ _LIBCPP_BEGIN_NAMESPACE_STD
#if _LIBCPP_STD_VER >= 17
template <class _Cont>
-_LIBCPP_HIDE_FROM_ABI
-constexpr auto size(const _Cont& __c)
-_NOEXCEPT_(noexcept(__c.size()))
--> decltype (__c.size())
-{ return __c.size(); }
+_LIBCPP_HIDE_FROM_ABI constexpr auto size(const _Cont& __c) _NOEXCEPT_(noexcept(__c.size())) -> decltype(__c.size()) {
+ return __c.size();
+}
template <class _Tp, size_t _Sz>
-_LIBCPP_HIDE_FROM_ABI
-constexpr size_t size(const _Tp (&)[_Sz]) noexcept { return _Sz; }
+_LIBCPP_HIDE_FROM_ABI constexpr size_t size(const _Tp (&)[_Sz]) noexcept {
+ return _Sz;
+}
-#if _LIBCPP_STD_VER >= 20
+# if _LIBCPP_STD_VER >= 20
template <class _Cont>
-_LIBCPP_HIDE_FROM_ABI
-constexpr auto ssize(const _Cont& __c)
-_NOEXCEPT_(noexcept(static_cast<common_type_t<ptrdiff_t, make_signed_t<decltype(__c.size())>>>(__c.size())))
--> common_type_t<ptrdiff_t, make_signed_t<decltype(__c.size())>>
-{ return static_cast<common_type_t<ptrdiff_t, make_signed_t<decltype(__c.size())>>>(__c.size()); }
+_LIBCPP_HIDE_FROM_ABI constexpr auto ssize(const _Cont& __c)
+ _NOEXCEPT_(noexcept(static_cast<common_type_t<ptrdiff_t, make_signed_t<decltype(__c.size())>>>(__c.size())))
+ -> common_type_t<ptrdiff_t, make_signed_t<decltype(__c.size())>> {
+ return static_cast<common_type_t<ptrdiff_t, make_signed_t<decltype(__c.size())>>>(__c.size());
+}
// GCC complains about the implicit conversion from ptrdiff_t to size_t in
// the array bound.
_LIBCPP_DIAGNOSTIC_PUSH
_LIBCPP_GCC_DIAGNOSTIC_IGNORED("-Wsign-conversion")
template <class _Tp, ptrdiff_t _Sz>
-_LIBCPP_HIDE_FROM_ABI
-constexpr ptrdiff_t ssize(const _Tp (&)[_Sz]) noexcept { return _Sz; }
+_LIBCPP_HIDE_FROM_ABI constexpr ptrdiff_t ssize(const _Tp (&)[_Sz]) noexcept {
+ return _Sz;
+}
_LIBCPP_DIAGNOSTIC_POP
-#endif
+# endif
#endif // _LIBCPP_STD_VER >= 17
diff --git a/contrib/llvm-project/libcxx/include/__iterator/sortable.h b/contrib/llvm-project/libcxx/include/__iterator/sortable.h
index d4d77d6cf334..1444860f2aa1 100644
--- a/contrib/llvm-project/libcxx/include/__iterator/sortable.h
+++ b/contrib/llvm-project/libcxx/include/__iterator/sortable.h
@@ -26,9 +26,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
#if _LIBCPP_STD_VER >= 20
template <class _Iter, class _Comp = ranges::less, class _Proj = identity>
-concept sortable =
- permutable<_Iter> &&
- indirect_strict_weak_order<_Comp, projected<_Iter, _Proj>>;
+concept sortable = permutable<_Iter> && indirect_strict_weak_order<_Comp, projected<_Iter, _Proj>>;
#endif // _LIBCPP_STD_VER >= 20
diff --git a/contrib/llvm-project/libcxx/include/__iterator/unreachable_sentinel.h b/contrib/llvm-project/libcxx/include/__iterator/unreachable_sentinel.h
index 91fd0a57ab3f..77e663da4b3a 100644
--- a/contrib/llvm-project/libcxx/include/__iterator/unreachable_sentinel.h
+++ b/contrib/llvm-project/libcxx/include/__iterator/unreachable_sentinel.h
@@ -22,9 +22,8 @@ _LIBCPP_BEGIN_NAMESPACE_STD
#if _LIBCPP_STD_VER >= 20
struct unreachable_sentinel_t {
- template<weakly_incrementable _Iter>
- _LIBCPP_HIDE_FROM_ABI
- friend constexpr bool operator==(unreachable_sentinel_t, const _Iter&) noexcept {
+ template <weakly_incrementable _Iter>
+ _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator==(unreachable_sentinel_t, const _Iter&) noexcept {
return false;
}
};
diff --git a/contrib/llvm-project/libcxx/include/__iterator/wrap_iter.h b/contrib/llvm-project/libcxx/include/__iterator/wrap_iter.h
index d028d7b3c33c..3827241e5fe4 100644
--- a/contrib/llvm-project/libcxx/include/__iterator/wrap_iter.h
+++ b/contrib/llvm-project/libcxx/include/__iterator/wrap_iter.h
@@ -25,187 +25,175 @@
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _Iter>
-class __wrap_iter
-{
+class __wrap_iter {
public:
- typedef _Iter iterator_type;
- typedef typename iterator_traits<iterator_type>::value_type value_type;
- typedef typename iterator_traits<iterator_type>::difference_type difference_type;
- typedef typename iterator_traits<iterator_type>::pointer pointer;
- typedef typename iterator_traits<iterator_type>::reference reference;
- typedef typename iterator_traits<iterator_type>::iterator_category iterator_category;
+ typedef _Iter iterator_type;
+ typedef typename iterator_traits<iterator_type>::value_type value_type;
+ typedef typename iterator_traits<iterator_type>::difference_type difference_type;
+ typedef typename iterator_traits<iterator_type>::pointer pointer;
+ typedef typename iterator_traits<iterator_type>::reference reference;
+ typedef typename iterator_traits<iterator_type>::iterator_category iterator_category;
#if _LIBCPP_STD_VER >= 20
- typedef contiguous_iterator_tag iterator_concept;
+ typedef contiguous_iterator_tag iterator_concept;
#endif
private:
- iterator_type __i_;
+ iterator_type __i_;
+
public:
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 __wrap_iter() _NOEXCEPT
- : __i_()
- {
- }
- template <class _Up, __enable_if_t<is_convertible<_Up, iterator_type>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 __wrap_iter(const __wrap_iter<_Up>& __u) _NOEXCEPT
- : __i_(__u.base())
- {
- }
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 reference operator*() const _NOEXCEPT
- {
- return *__i_;
- }
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pointer operator->() const _NOEXCEPT
- {
- return std::__to_address(__i_);
- }
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 __wrap_iter& operator++() _NOEXCEPT
- {
- ++__i_;
- return *this;
- }
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 __wrap_iter operator++(int) _NOEXCEPT
- {__wrap_iter __tmp(*this); ++(*this); return __tmp;}
-
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 __wrap_iter& operator--() _NOEXCEPT
- {
- --__i_;
- return *this;
- }
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 __wrap_iter operator--(int) _NOEXCEPT
- {__wrap_iter __tmp(*this); --(*this); return __tmp;}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 __wrap_iter operator+ (difference_type __n) const _NOEXCEPT
- {__wrap_iter __w(*this); __w += __n; return __w;}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 __wrap_iter& operator+=(difference_type __n) _NOEXCEPT
- {
- __i_ += __n;
- return *this;
- }
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 __wrap_iter operator- (difference_type __n) const _NOEXCEPT
- {return *this + (-__n);}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 __wrap_iter& operator-=(difference_type __n) _NOEXCEPT
- {*this += -__n; return *this;}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 reference operator[](difference_type __n) const _NOEXCEPT
- {
- return __i_[__n];
- }
-
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 iterator_type base() const _NOEXCEPT {return __i_;}
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 __wrap_iter() _NOEXCEPT : __i_() {}
+ template <class _Up, __enable_if_t<is_convertible<_Up, iterator_type>::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 __wrap_iter(const __wrap_iter<_Up>& __u) _NOEXCEPT
+ : __i_(__u.base()) {}
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 reference operator*() const _NOEXCEPT { return *__i_; }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pointer operator->() const _NOEXCEPT {
+ return std::__to_address(__i_);
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 __wrap_iter& operator++() _NOEXCEPT {
+ ++__i_;
+ return *this;
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 __wrap_iter operator++(int) _NOEXCEPT {
+ __wrap_iter __tmp(*this);
+ ++(*this);
+ return __tmp;
+ }
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 __wrap_iter& operator--() _NOEXCEPT {
+ --__i_;
+ return *this;
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 __wrap_iter operator--(int) _NOEXCEPT {
+ __wrap_iter __tmp(*this);
+ --(*this);
+ return __tmp;
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 __wrap_iter operator+(difference_type __n) const _NOEXCEPT {
+ __wrap_iter __w(*this);
+ __w += __n;
+ return __w;
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 __wrap_iter& operator+=(difference_type __n) _NOEXCEPT {
+ __i_ += __n;
+ return *this;
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 __wrap_iter operator-(difference_type __n) const _NOEXCEPT {
+ return *this + (-__n);
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 __wrap_iter& operator-=(difference_type __n) _NOEXCEPT {
+ *this += -__n;
+ return *this;
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 reference operator[](difference_type __n) const _NOEXCEPT {
+ return __i_[__n];
+ }
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 iterator_type base() const _NOEXCEPT { return __i_; }
private:
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
- explicit __wrap_iter(iterator_type __x) _NOEXCEPT : __i_(__x)
- {
- }
-
- template <class _Up> friend class __wrap_iter;
- template <class _CharT, class _Traits, class _Alloc> friend class basic_string;
- template <class _Tp, class _Alloc> friend class _LIBCPP_TEMPLATE_VIS vector;
- template <class _Tp, size_t> friend class _LIBCPP_TEMPLATE_VIS span;
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 explicit __wrap_iter(iterator_type __x) _NOEXCEPT : __i_(__x) {}
+
+ template <class _Up>
+ friend class __wrap_iter;
+ template <class _CharT, class _Traits, class _Alloc>
+ friend class basic_string;
+ template <class _Tp, class _Alloc>
+ friend class _LIBCPP_TEMPLATE_VIS vector;
+ template <class _Tp, size_t>
+ friend class _LIBCPP_TEMPLATE_VIS span;
};
template <class _Iter1>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR
-bool operator==(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter1>& __y) _NOEXCEPT
-{
- return __x.base() == __y.base();
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool
+operator==(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter1>& __y) _NOEXCEPT {
+ return __x.base() == __y.base();
}
template <class _Iter1, class _Iter2>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR
-bool operator==(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT
-{
- return __x.base() == __y.base();
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool
+operator==(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT {
+ return __x.base() == __y.base();
}
template <class _Iter1>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
-bool operator<(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter1>& __y) _NOEXCEPT
-{
- return __x.base() < __y.base();
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 bool
+operator<(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter1>& __y) _NOEXCEPT {
+ return __x.base() < __y.base();
}
template <class _Iter1, class _Iter2>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
-bool operator<(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT
-{
- return __x.base() < __y.base();
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 bool
+operator<(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT {
+ return __x.base() < __y.base();
}
template <class _Iter1>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR
-bool operator!=(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter1>& __y) _NOEXCEPT
-{
- return !(__x == __y);
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool
+operator!=(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter1>& __y) _NOEXCEPT {
+ return !(__x == __y);
}
template <class _Iter1, class _Iter2>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR
-bool operator!=(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT
-{
- return !(__x == __y);
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool
+operator!=(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT {
+ return !(__x == __y);
}
template <class _Iter1>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR
-bool operator>(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter1>& __y) _NOEXCEPT
-{
- return __y < __x;
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool
+operator>(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter1>& __y) _NOEXCEPT {
+ return __y < __x;
}
template <class _Iter1, class _Iter2>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR
-bool operator>(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT
-{
- return __y < __x;
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool
+operator>(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT {
+ return __y < __x;
}
template <class _Iter1>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR
-bool operator>=(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter1>& __y) _NOEXCEPT
-{
- return !(__x < __y);
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool
+operator>=(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter1>& __y) _NOEXCEPT {
+ return !(__x < __y);
}
template <class _Iter1, class _Iter2>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR
-bool operator>=(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT
-{
- return !(__x < __y);
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool
+operator>=(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT {
+ return !(__x < __y);
}
template <class _Iter1>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR
-bool operator<=(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter1>& __y) _NOEXCEPT
-{
- return !(__y < __x);
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool
+operator<=(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter1>& __y) _NOEXCEPT {
+ return !(__y < __x);
}
template <class _Iter1, class _Iter2>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR
-bool operator<=(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT
-{
- return !(__y < __x);
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool
+operator<=(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT {
+ return !(__y < __x);
}
template <class _Iter1, class _Iter2>
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
#ifndef _LIBCPP_CXX03_LANG
-auto operator-(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT
- -> decltype(__x.base() - __y.base())
+ auto
+ operator-(const __wrap_iter<_Iter1>& __x,
+ const __wrap_iter<_Iter2>& __y) _NOEXCEPT->decltype(__x.base() - __y.base())
#else
-typename __wrap_iter<_Iter1>::difference_type
-operator-(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT
+ typename __wrap_iter<_Iter1>::difference_type
+ operator-(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT
#endif // C++03
{
- return __x.base() - __y.base();
+ return __x.base() - __y.base();
}
template <class _Iter1>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
-__wrap_iter<_Iter1> operator+(typename __wrap_iter<_Iter1>::difference_type __n, __wrap_iter<_Iter1> __x) _NOEXCEPT
-{
- __x += __n;
- return __x;
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 __wrap_iter<_Iter1>
+operator+(typename __wrap_iter<_Iter1>::difference_type __n, __wrap_iter<_Iter1> __x) _NOEXCEPT {
+ __x += __n;
+ return __x;
}
#if _LIBCPP_STD_VER <= 17
@@ -214,16 +202,14 @@ struct __libcpp_is_contiguous_iterator<__wrap_iter<_It> > : true_type {};
#endif
template <class _It>
-struct _LIBCPP_TEMPLATE_VIS pointer_traits<__wrap_iter<_It> >
-{
- typedef __wrap_iter<_It> pointer;
- typedef typename pointer_traits<_It>::element_type element_type;
- typedef typename pointer_traits<_It>::difference_type difference_type;
-
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR
- static element_type *to_address(pointer __w) _NOEXCEPT {
- return std::__to_address(__w.base());
- }
+struct _LIBCPP_TEMPLATE_VIS pointer_traits<__wrap_iter<_It> > {
+ typedef __wrap_iter<_It> pointer;
+ typedef typename pointer_traits<_It>::element_type element_type;
+ typedef typename pointer_traits<_It>::difference_type difference_type;
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR static element_type* to_address(pointer __w) _NOEXCEPT {
+ return std::__to_address(__w.base());
+ }
};
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__locale b/contrib/llvm-project/libcxx/include/__locale
index 6eb892287160..3ba7ac18b0b3 100644
--- a/contrib/llvm-project/libcxx/include/__locale
+++ b/contrib/llvm-project/libcxx/include/__locale
@@ -33,24 +33,24 @@
#endif
#if defined(_LIBCPP_MSVCRT_LIKE)
-# include <__support/win32/locale_win32.h>
+# include <__support/win32/locale_win32.h>
#elif defined(_AIX) || defined(__MVS__)
-# include <__support/ibm/xlocale.h>
+# include <__support/ibm/xlocale.h>
#elif defined(__ANDROID__)
-# include <__support/android/locale_bionic.h>
+# include <__support/android/locale_bionic.h>
#elif defined(_NEWLIB_VERSION)
-# include <__support/newlib/xlocale.h>
+# include <__support/newlib/xlocale.h>
#elif defined(__OpenBSD__)
-# include <__support/openbsd/xlocale.h>
+# include <__support/openbsd/xlocale.h>
#elif (defined(__APPLE__) || defined(__FreeBSD__))
-# include <xlocale.h>
+# include <xlocale.h>
#elif defined(__Fuchsia__)
-# include <__support/fuchsia/xlocale.h>
+# include <__support/fuchsia/xlocale.h>
#elif defined(__wasi__)
// WASI libc uses musl's locales support.
-# include <__support/musl/xlocale.h>
+# include <__support/musl/xlocale.h>
#elif defined(_LIBCPP_HAS_MUSL_LIBC)
-# include <__support/musl/xlocale.h>
+# include <__support/musl/xlocale.h>
#endif
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
@@ -62,235 +62,195 @@ _LIBCPP_BEGIN_NAMESPACE_STD
class _LIBCPP_EXPORTED_FROM_ABI locale;
template <class _Facet>
-_LIBCPP_HIDE_FROM_ABI
-bool
-has_facet(const locale&) _NOEXCEPT;
+_LIBCPP_HIDE_FROM_ABI bool has_facet(const locale&) _NOEXCEPT;
template <class _Facet>
-_LIBCPP_HIDE_FROM_ABI
-const _Facet&
-use_facet(const locale&);
+_LIBCPP_HIDE_FROM_ABI const _Facet& use_facet(const locale&);
-class _LIBCPP_EXPORTED_FROM_ABI locale
-{
+class _LIBCPP_EXPORTED_FROM_ABI locale {
public:
- // types:
- class _LIBCPP_EXPORTED_FROM_ABI facet;
- class _LIBCPP_EXPORTED_FROM_ABI id;
-
- typedef int category;
-
- static const category // values assigned here are for exposition only
- none = 0,
- collate = LC_COLLATE_MASK,
- ctype = LC_CTYPE_MASK,
- monetary = LC_MONETARY_MASK,
- numeric = LC_NUMERIC_MASK,
- time = LC_TIME_MASK,
- messages = LC_MESSAGES_MASK,
- all = collate | ctype | monetary | numeric | time | messages;
-
- // construct/copy/destroy:
- locale() _NOEXCEPT;
- locale(const locale&) _NOEXCEPT;
- explicit locale(const char*);
- explicit locale(const string&);
- locale(const locale&, const char*, category);
- locale(const locale&, const string&, category);
- template <class _Facet>
- _LIBCPP_HIDE_FROM_ABI locale(const locale&, _Facet*);
- locale(const locale&, const locale&, category);
-
- ~locale();
-
- const locale& operator=(const locale&) _NOEXCEPT;
-
- template <class _Facet>
- _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
- locale combine(const locale&) const;
-
- // locale operations:
- string name() const;
- bool operator==(const locale&) const;
+ // types:
+ class _LIBCPP_EXPORTED_FROM_ABI facet;
+ class _LIBCPP_EXPORTED_FROM_ABI id;
+
+ typedef int category;
+
+ static const category // values assigned here are for exposition only
+ none = 0,
+ collate = LC_COLLATE_MASK, ctype = LC_CTYPE_MASK, monetary = LC_MONETARY_MASK, numeric = LC_NUMERIC_MASK,
+ time = LC_TIME_MASK, messages = LC_MESSAGES_MASK, all = collate | ctype | monetary | numeric | time | messages;
+
+ // construct/copy/destroy:
+ locale() _NOEXCEPT;
+ locale(const locale&) _NOEXCEPT;
+ explicit locale(const char*);
+ explicit locale(const string&);
+ locale(const locale&, const char*, category);
+ locale(const locale&, const string&, category);
+ template <class _Facet>
+ _LIBCPP_HIDE_FROM_ABI locale(const locale&, _Facet*);
+ locale(const locale&, const locale&, category);
+
+ ~locale();
+
+ const locale& operator=(const locale&) _NOEXCEPT;
+
+ template <class _Facet>
+ _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS locale combine(const locale&) const;
+
+ // locale operations:
+ string name() const;
+ bool operator==(const locale&) const;
#if _LIBCPP_STD_VER <= 17
- _LIBCPP_HIDE_FROM_ABI bool operator!=(const locale& __y) const {return !(*this == __y);}
+ _LIBCPP_HIDE_FROM_ABI bool operator!=(const locale& __y) const { return !(*this == __y); }
#endif
- template <class _CharT, class _Traits, class _Allocator>
- _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
- bool operator()(const basic_string<_CharT, _Traits, _Allocator>&,
- const basic_string<_CharT, _Traits, _Allocator>&) const;
+ template <class _CharT, class _Traits, class _Allocator>
+ _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS bool
+ operator()(const basic_string<_CharT, _Traits, _Allocator>&, const basic_string<_CharT, _Traits, _Allocator>&) const;
- // global locale objects:
- static locale global(const locale&);
- static const locale& classic();
+ // global locale objects:
+ static locale global(const locale&);
+ static const locale& classic();
private:
- class __imp;
- __imp* __locale_;
-
- template <class> friend struct __no_destroy;
- struct __private_tag { };
- _LIBCPP_HIDE_FROM_ABI explicit locale(__private_tag, __imp* __loc) : __locale_(__loc) {}
-
- void __install_ctor(const locale&, facet*, long);
- static locale& __global();
- bool has_facet(id&) const;
- const facet* use_facet(id&) const;
-
- template <class _Facet> friend bool has_facet(const locale&) _NOEXCEPT;
- template <class _Facet> friend const _Facet& use_facet(const locale&);
+ class __imp;
+ __imp* __locale_;
+
+ template <class>
+ friend struct __no_destroy;
+ struct __private_tag {};
+ _LIBCPP_HIDE_FROM_ABI explicit locale(__private_tag, __imp* __loc) : __locale_(__loc) {}
+
+ void __install_ctor(const locale&, facet*, long);
+ static locale& __global();
+ bool has_facet(id&) const;
+ const facet* use_facet(id&) const;
+
+ template <class _Facet>
+ friend bool has_facet(const locale&) _NOEXCEPT;
+ template <class _Facet>
+ friend const _Facet& use_facet(const locale&);
};
-class _LIBCPP_EXPORTED_FROM_ABI locale::facet
- : public __shared_count
-{
+class _LIBCPP_EXPORTED_FROM_ABI locale::facet : public __shared_count {
protected:
- _LIBCPP_HIDE_FROM_ABI
- explicit facet(size_t __refs = 0)
- : __shared_count(static_cast<long>(__refs)-1) {}
+ _LIBCPP_HIDE_FROM_ABI explicit facet(size_t __refs = 0) : __shared_count(static_cast<long>(__refs) - 1) {}
- ~facet() override;
+ ~facet() override;
+
+ // facet(const facet&) = delete; // effectively done in __shared_count
+ // void operator=(const facet&) = delete;
-// facet(const facet&) = delete; // effectively done in __shared_count
-// void operator=(const facet&) = delete;
private:
- void __on_zero_shared() _NOEXCEPT override;
+ void __on_zero_shared() _NOEXCEPT override;
};
-class _LIBCPP_EXPORTED_FROM_ABI locale::id
-{
- once_flag __flag_;
- int32_t __id_;
+class _LIBCPP_EXPORTED_FROM_ABI locale::id {
+ once_flag __flag_;
+ int32_t __id_;
+
+ static int32_t __next_id;
- static int32_t __next_id;
public:
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR id() :__id_(0) {}
- void operator=(const id&) = delete;
- id(const id&) = delete;
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR id() : __id_(0) {}
+ void operator=(const id&) = delete;
+ id(const id&) = delete;
-public: // only needed for tests
- long __get();
+public: // only needed for tests
+ long __get();
- friend class locale;
- friend class locale::__imp;
+ friend class locale;
+ friend class locale::__imp;
};
template <class _Facet>
-inline _LIBCPP_HIDE_FROM_ABI
-locale::locale(const locale& __other, _Facet* __f)
-{
- __install_ctor(__other, __f, __f ? __f->id.__get() : 0);
+inline _LIBCPP_HIDE_FROM_ABI locale::locale(const locale& __other, _Facet* __f) {
+ __install_ctor(__other, __f, __f ? __f->id.__get() : 0);
}
template <class _Facet>
-locale
-locale::combine(const locale& __other) const
-{
- if (!std::has_facet<_Facet>(__other))
- __throw_runtime_error("locale::combine: locale missing facet");
+locale locale::combine(const locale& __other) const {
+ if (!std::has_facet<_Facet>(__other))
+ __throw_runtime_error("locale::combine: locale missing facet");
- return locale(*this, &const_cast<_Facet&>(std::use_facet<_Facet>(__other)));
+ return locale(*this, &const_cast<_Facet&>(std::use_facet<_Facet>(__other)));
}
template <class _Facet>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-has_facet(const locale& __l) _NOEXCEPT
-{
- return __l.has_facet(_Facet::id);
+inline _LIBCPP_HIDE_FROM_ABI bool has_facet(const locale& __l) _NOEXCEPT {
+ return __l.has_facet(_Facet::id);
}
template <class _Facet>
-inline _LIBCPP_HIDE_FROM_ABI
-const _Facet&
-use_facet(const locale& __l)
-{
- return static_cast<const _Facet&>(*__l.use_facet(_Facet::id));
+inline _LIBCPP_HIDE_FROM_ABI const _Facet& use_facet(const locale& __l) {
+ return static_cast<const _Facet&>(*__l.use_facet(_Facet::id));
}
// template <class _CharT> class collate;
template <class _CharT>
-class _LIBCPP_TEMPLATE_VIS collate
- : public locale::facet
-{
+class _LIBCPP_TEMPLATE_VIS collate : public locale::facet {
public:
- typedef _CharT char_type;
- typedef basic_string<char_type> string_type;
-
- _LIBCPP_HIDE_FROM_ABI
- explicit collate(size_t __refs = 0)
- : locale::facet(__refs) {}
-
- _LIBCPP_HIDE_FROM_ABI
- int compare(const char_type* __lo1, const char_type* __hi1,
- const char_type* __lo2, const char_type* __hi2) const
- {
- return do_compare(__lo1, __hi1, __lo2, __hi2);
- }
+ typedef _CharT char_type;
+ typedef basic_string<char_type> string_type;
- // FIXME(EricWF): The _LIBCPP_ALWAYS_INLINE is needed on Windows to work
- // around a dllimport bug that expects an external instantiation.
- _LIBCPP_HIDE_FROM_ABI
- _LIBCPP_ALWAYS_INLINE
- string_type transform(const char_type* __lo, const char_type* __hi) const
- {
- return do_transform(__lo, __hi);
- }
+ _LIBCPP_HIDE_FROM_ABI explicit collate(size_t __refs = 0) : locale::facet(__refs) {}
- _LIBCPP_HIDE_FROM_ABI
- long hash(const char_type* __lo, const char_type* __hi) const
- {
- return do_hash(__lo, __hi);
- }
+ _LIBCPP_HIDE_FROM_ABI int
+ compare(const char_type* __lo1, const char_type* __hi1, const char_type* __lo2, const char_type* __hi2) const {
+ return do_compare(__lo1, __hi1, __lo2, __hi2);
+ }
+
+ // FIXME(EricWF): The _LIBCPP_ALWAYS_INLINE is needed on Windows to work
+ // around a dllimport bug that expects an external instantiation.
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_ALWAYS_INLINE string_type
+ transform(const char_type* __lo, const char_type* __hi) const {
+ return do_transform(__lo, __hi);
+ }
+
+ _LIBCPP_HIDE_FROM_ABI long hash(const char_type* __lo, const char_type* __hi) const { return do_hash(__lo, __hi); }
- static locale::id id;
+ static locale::id id;
protected:
- ~collate() override;
- virtual int do_compare(const char_type* __lo1, const char_type* __hi1,
- const char_type* __lo2, const char_type* __hi2) const;
- virtual string_type do_transform(const char_type* __lo, const char_type* __hi) const
- {return string_type(__lo, __hi);}
- virtual long do_hash(const char_type* __lo, const char_type* __hi) const;
+ ~collate() override;
+ virtual int
+ do_compare(const char_type* __lo1, const char_type* __hi1, const char_type* __lo2, const char_type* __hi2) const;
+ virtual string_type do_transform(const char_type* __lo, const char_type* __hi) const {
+ return string_type(__lo, __hi);
+ }
+ virtual long do_hash(const char_type* __lo, const char_type* __hi) const;
};
-template <class _CharT> locale::id collate<_CharT>::id;
+template <class _CharT>
+locale::id collate<_CharT>::id;
template <class _CharT>
-collate<_CharT>::~collate()
-{
-}
+collate<_CharT>::~collate() {}
template <class _CharT>
-int
-collate<_CharT>::do_compare(const char_type* __lo1, const char_type* __hi1,
- const char_type* __lo2, const char_type* __hi2) const
-{
- for (; __lo2 != __hi2; ++__lo1, ++__lo2)
- {
- if (__lo1 == __hi1 || *__lo1 < *__lo2)
- return -1;
- if (*__lo2 < *__lo1)
- return 1;
- }
- return __lo1 != __hi1;
+int collate<_CharT>::do_compare(
+ const char_type* __lo1, const char_type* __hi1, const char_type* __lo2, const char_type* __hi2) const {
+ for (; __lo2 != __hi2; ++__lo1, ++__lo2) {
+ if (__lo1 == __hi1 || *__lo1 < *__lo2)
+ return -1;
+ if (*__lo2 < *__lo1)
+ return 1;
+ }
+ return __lo1 != __hi1;
}
template <class _CharT>
-long
-collate<_CharT>::do_hash(const char_type* __lo, const char_type* __hi) const
-{
- size_t __h = 0;
- const size_t __sr = __CHAR_BIT__ * sizeof(size_t) - 8;
- const size_t __mask = size_t(0xF) << (__sr + 4);
- for(const char_type* __p = __lo; __p != __hi; ++__p)
- {
- __h = (__h << 4) + static_cast<size_t>(*__p);
- size_t __g = __h & __mask;
- __h ^= __g | (__g >> __sr);
- }
- return static_cast<long>(__h);
+long collate<_CharT>::do_hash(const char_type* __lo, const char_type* __hi) const {
+ size_t __h = 0;
+ const size_t __sr = __CHAR_BIT__ * sizeof(size_t) - 8;
+ const size_t __mask = size_t(0xF) << (__sr + 4);
+ for (const char_type* __p = __lo; __p != __hi; ++__p) {
+ __h = (__h << 4) + static_cast<size_t>(*__p);
+ size_t __g = __h & __mask;
+ __h ^= __g | (__g >> __sr);
+ }
+ return static_cast<long>(__h);
}
extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS collate<char>;
@@ -300,786 +260,663 @@ extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS collate<wchar_t>;
// template <class CharT> class collate_byname;
-template <class _CharT> class _LIBCPP_TEMPLATE_VIS collate_byname;
+template <class _CharT>
+class _LIBCPP_TEMPLATE_VIS collate_byname;
template <>
-class _LIBCPP_EXPORTED_FROM_ABI collate_byname<char>
- : public collate<char>
-{
- locale_t __l_;
+class _LIBCPP_EXPORTED_FROM_ABI collate_byname<char> : public collate<char> {
+ locale_t __l_;
+
public:
- typedef char char_type;
- typedef basic_string<char_type> string_type;
+ typedef char char_type;
+ typedef basic_string<char_type> string_type;
- explicit collate_byname(const char* __n, size_t __refs = 0);
- explicit collate_byname(const string& __n, size_t __refs = 0);
+ explicit collate_byname(const char* __n, size_t __refs = 0);
+ explicit collate_byname(const string& __n, size_t __refs = 0);
protected:
- ~collate_byname() override;
- int do_compare(const char_type* __lo1, const char_type* __hi1,
- const char_type* __lo2, const char_type* __hi2) const override;
- string_type do_transform(const char_type* __lo, const char_type* __hi) const override;
+ ~collate_byname() override;
+ int do_compare(
+ const char_type* __lo1, const char_type* __hi1, const char_type* __lo2, const char_type* __hi2) const override;
+ string_type do_transform(const char_type* __lo, const char_type* __hi) const override;
};
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
template <>
-class _LIBCPP_EXPORTED_FROM_ABI collate_byname<wchar_t>
- : public collate<wchar_t>
-{
- locale_t __l_;
+class _LIBCPP_EXPORTED_FROM_ABI collate_byname<wchar_t> : public collate<wchar_t> {
+ locale_t __l_;
+
public:
- typedef wchar_t char_type;
- typedef basic_string<char_type> string_type;
+ typedef wchar_t char_type;
+ typedef basic_string<char_type> string_type;
- explicit collate_byname(const char* __n, size_t __refs = 0);
- explicit collate_byname(const string& __n, size_t __refs = 0);
+ explicit collate_byname(const char* __n, size_t __refs = 0);
+ explicit collate_byname(const string& __n, size_t __refs = 0);
protected:
- ~collate_byname() override;
+ ~collate_byname() override;
- int do_compare(const char_type* __lo1, const char_type* __hi1,
- const char_type* __lo2, const char_type* __hi2) const override;
- string_type do_transform(const char_type* __lo, const char_type* __hi) const override;
+ int do_compare(
+ const char_type* __lo1, const char_type* __hi1, const char_type* __lo2, const char_type* __hi2) const override;
+ string_type do_transform(const char_type* __lo, const char_type* __hi) const override;
};
#endif
template <class _CharT, class _Traits, class _Allocator>
-bool
-locale::operator()(const basic_string<_CharT, _Traits, _Allocator>& __x,
- const basic_string<_CharT, _Traits, _Allocator>& __y) const
-{
- return std::use_facet<std::collate<_CharT> >(*this).compare(
- __x.data(), __x.data() + __x.size(),
- __y.data(), __y.data() + __y.size()) < 0;
+bool locale::operator()(const basic_string<_CharT, _Traits, _Allocator>& __x,
+ const basic_string<_CharT, _Traits, _Allocator>& __y) const {
+ return std::use_facet<std::collate<_CharT> >(*this).compare(
+ __x.data(), __x.data() + __x.size(), __y.data(), __y.data() + __y.size()) < 0;
}
// template <class charT> class ctype
-class _LIBCPP_EXPORTED_FROM_ABI ctype_base
-{
+class _LIBCPP_EXPORTED_FROM_ABI ctype_base {
public:
#if defined(_LIBCPP_PROVIDES_DEFAULT_RUNE_TABLE)
- typedef unsigned long mask;
- static const mask space = 1<<0;
- static const mask print = 1<<1;
- static const mask cntrl = 1<<2;
- static const mask upper = 1<<3;
- static const mask lower = 1<<4;
- static const mask alpha = 1<<5;
- static const mask digit = 1<<6;
- static const mask punct = 1<<7;
- static const mask xdigit = 1<<8;
- static const mask blank = 1<<9;
-#if defined(__BIONIC__)
- // Historically this was a part of regex_traits rather than ctype_base. The
- // historical value of the constant is preserved for ABI compatibility.
- static const mask __regex_word = 0x8000;
-#else
- static const mask __regex_word = 1<<10;
-#endif // defined(__BIONIC__)
+ typedef unsigned long mask;
+ static const mask space = 1 << 0;
+ static const mask print = 1 << 1;
+ static const mask cntrl = 1 << 2;
+ static const mask upper = 1 << 3;
+ static const mask lower = 1 << 4;
+ static const mask alpha = 1 << 5;
+ static const mask digit = 1 << 6;
+ static const mask punct = 1 << 7;
+ static const mask xdigit = 1 << 8;
+ static const mask blank = 1 << 9;
+# if defined(__BIONIC__)
+ // Historically this was a part of regex_traits rather than ctype_base. The
+ // historical value of the constant is preserved for ABI compatibility.
+ static const mask __regex_word = 0x8000;
+# else
+ static const mask __regex_word = 1 << 10;
+# endif // defined(__BIONIC__)
#elif defined(__GLIBC__)
- typedef unsigned short mask;
- static const mask space = _ISspace;
- static const mask print = _ISprint;
- static const mask cntrl = _IScntrl;
- static const mask upper = _ISupper;
- static const mask lower = _ISlower;
- static const mask alpha = _ISalpha;
- static const mask digit = _ISdigit;
- static const mask punct = _ISpunct;
- static const mask xdigit = _ISxdigit;
- static const mask blank = _ISblank;
-#if defined(__mips__) || (BYTE_ORDER == BIG_ENDIAN)
- static const mask __regex_word = static_cast<mask>(_ISbit(15));
-#else
- static const mask __regex_word = 0x80;
-#endif
+ typedef unsigned short mask;
+ static const mask space = _ISspace;
+ static const mask print = _ISprint;
+ static const mask cntrl = _IScntrl;
+ static const mask upper = _ISupper;
+ static const mask lower = _ISlower;
+ static const mask alpha = _ISalpha;
+ static const mask digit = _ISdigit;
+ static const mask punct = _ISpunct;
+ static const mask xdigit = _ISxdigit;
+ static const mask blank = _ISblank;
+# if defined(__mips__) || (BYTE_ORDER == BIG_ENDIAN)
+ static const mask __regex_word = static_cast<mask>(_ISbit(15));
+# else
+ static const mask __regex_word = 0x80;
+# endif
#elif defined(_LIBCPP_MSVCRT_LIKE)
- typedef unsigned short mask;
- static const mask space = _SPACE;
- static const mask print = _BLANK|_PUNCT|_ALPHA|_DIGIT;
- static const mask cntrl = _CONTROL;
- static const mask upper = _UPPER;
- static const mask lower = _LOWER;
- static const mask alpha = _ALPHA;
- static const mask digit = _DIGIT;
- static const mask punct = _PUNCT;
- static const mask xdigit = _HEX;
- static const mask blank = _BLANK;
- static const mask __regex_word = 0x4000; // 0x8000 and 0x0100 and 0x00ff are used
-# define _LIBCPP_CTYPE_MASK_IS_COMPOSITE_PRINT
-# define _LIBCPP_CTYPE_MASK_IS_COMPOSITE_ALPHA
+ typedef unsigned short mask;
+ static const mask space = _SPACE;
+ static const mask print = _BLANK | _PUNCT | _ALPHA | _DIGIT;
+ static const mask cntrl = _CONTROL;
+ static const mask upper = _UPPER;
+ static const mask lower = _LOWER;
+ static const mask alpha = _ALPHA;
+ static const mask digit = _DIGIT;
+ static const mask punct = _PUNCT;
+ static const mask xdigit = _HEX;
+ static const mask blank = _BLANK;
+ static const mask __regex_word = 0x4000; // 0x8000 and 0x0100 and 0x00ff are used
+# define _LIBCPP_CTYPE_MASK_IS_COMPOSITE_PRINT
+# define _LIBCPP_CTYPE_MASK_IS_COMPOSITE_ALPHA
#elif defined(__APPLE__) || defined(__FreeBSD__) || defined(__EMSCRIPTEN__) || defined(__NetBSD__)
-# ifdef __APPLE__
- typedef __uint32_t mask;
-# elif defined(__FreeBSD__)
- typedef unsigned long mask;
-# elif defined(__EMSCRIPTEN__) || defined(__NetBSD__)
- typedef unsigned short mask;
-# endif
- static const mask space = _CTYPE_S;
- static const mask print = _CTYPE_R;
- static const mask cntrl = _CTYPE_C;
- static const mask upper = _CTYPE_U;
- static const mask lower = _CTYPE_L;
- static const mask alpha = _CTYPE_A;
- static const mask digit = _CTYPE_D;
- static const mask punct = _CTYPE_P;
- static const mask xdigit = _CTYPE_X;
-
-# if defined(__NetBSD__)
- static const mask blank = _CTYPE_BL;
- // NetBSD defines classes up to 0x2000
- // see sys/ctype_bits.h, _CTYPE_Q
- static const mask __regex_word = 0x8000;
-# else
- static const mask blank = _CTYPE_B;
- static const mask __regex_word = 0x80;
-# endif
+# ifdef __APPLE__
+ typedef __uint32_t mask;
+# elif defined(__FreeBSD__)
+ typedef unsigned long mask;
+# elif defined(__EMSCRIPTEN__) || defined(__NetBSD__)
+ typedef unsigned short mask;
+# endif
+ static const mask space = _CTYPE_S;
+ static const mask print = _CTYPE_R;
+ static const mask cntrl = _CTYPE_C;
+ static const mask upper = _CTYPE_U;
+ static const mask lower = _CTYPE_L;
+ static const mask alpha = _CTYPE_A;
+ static const mask digit = _CTYPE_D;
+ static const mask punct = _CTYPE_P;
+ static const mask xdigit = _CTYPE_X;
+
+# if defined(__NetBSD__)
+ static const mask blank = _CTYPE_BL;
+ // NetBSD defines classes up to 0x2000
+ // see sys/ctype_bits.h, _CTYPE_Q
+ static const mask __regex_word = 0x8000;
+# else
+ static const mask blank = _CTYPE_B;
+ static const mask __regex_word = 0x80;
+# endif
#elif defined(_AIX)
- typedef unsigned int mask;
- static const mask space = _ISSPACE;
- static const mask print = _ISPRINT;
- static const mask cntrl = _ISCNTRL;
- static const mask upper = _ISUPPER;
- static const mask lower = _ISLOWER;
- static const mask alpha = _ISALPHA;
- static const mask digit = _ISDIGIT;
- static const mask punct = _ISPUNCT;
- static const mask xdigit = _ISXDIGIT;
- static const mask blank = _ISBLANK;
- static const mask __regex_word = 0x8000;
+ typedef unsigned int mask;
+ static const mask space = _ISSPACE;
+ static const mask print = _ISPRINT;
+ static const mask cntrl = _ISCNTRL;
+ static const mask upper = _ISUPPER;
+ static const mask lower = _ISLOWER;
+ static const mask alpha = _ISALPHA;
+ static const mask digit = _ISDIGIT;
+ static const mask punct = _ISPUNCT;
+ static const mask xdigit = _ISXDIGIT;
+ static const mask blank = _ISBLANK;
+ static const mask __regex_word = 0x8000;
#elif defined(_NEWLIB_VERSION)
- // Same type as Newlib's _ctype_ array in newlib/libc/include/ctype.h.
- typedef char mask;
- // In case char is signed, static_cast is needed to avoid warning on
- // positive value becomming negative.
- static const mask space = static_cast<mask>(_S);
- static const mask print = static_cast<mask>(_P | _U | _L | _N | _B);
- static const mask cntrl = static_cast<mask>(_C);
- static const mask upper = static_cast<mask>(_U);
- static const mask lower = static_cast<mask>(_L);
- static const mask alpha = static_cast<mask>(_U | _L);
- static const mask digit = static_cast<mask>(_N);
- static const mask punct = static_cast<mask>(_P);
- static const mask xdigit = static_cast<mask>(_X | _N);
- static const mask blank = static_cast<mask>(_B);
- // mask is already fully saturated, use a different type in regex_type_traits.
- static const unsigned short __regex_word = 0x100;
-# define _LIBCPP_CTYPE_MASK_IS_COMPOSITE_PRINT
-# define _LIBCPP_CTYPE_MASK_IS_COMPOSITE_ALPHA
-# define _LIBCPP_CTYPE_MASK_IS_COMPOSITE_XDIGIT
+ // Same type as Newlib's _ctype_ array in newlib/libc/include/ctype.h.
+ typedef char mask;
+ // In case char is signed, static_cast is needed to avoid warning on
+ // positive value becomming negative.
+ static const mask space = static_cast<mask>(_S);
+ static const mask print = static_cast<mask>(_P | _U | _L | _N | _B);
+ static const mask cntrl = static_cast<mask>(_C);
+ static const mask upper = static_cast<mask>(_U);
+ static const mask lower = static_cast<mask>(_L);
+ static const mask alpha = static_cast<mask>(_U | _L);
+ static const mask digit = static_cast<mask>(_N);
+ static const mask punct = static_cast<mask>(_P);
+ static const mask xdigit = static_cast<mask>(_X | _N);
+ static const mask blank = static_cast<mask>(_B);
+ // mask is already fully saturated, use a different type in regex_type_traits.
+ static const unsigned short __regex_word = 0x100;
+# define _LIBCPP_CTYPE_MASK_IS_COMPOSITE_PRINT
+# define _LIBCPP_CTYPE_MASK_IS_COMPOSITE_ALPHA
+# define _LIBCPP_CTYPE_MASK_IS_COMPOSITE_XDIGIT
#elif defined(__MVS__)
-# if defined(__NATIVE_ASCII_F)
- typedef unsigned int mask;
- static const mask space = _ISSPACE_A;
- static const mask print = _ISPRINT_A;
- static const mask cntrl = _ISCNTRL_A;
- static const mask upper = _ISUPPER_A;
- static const mask lower = _ISLOWER_A;
- static const mask alpha = _ISALPHA_A;
- static const mask digit = _ISDIGIT_A;
- static const mask punct = _ISPUNCT_A;
- static const mask xdigit = _ISXDIGIT_A;
- static const mask blank = _ISBLANK_A;
-# else
- typedef unsigned short mask;
- static const mask space = __ISSPACE;
- static const mask print = __ISPRINT;
- static const mask cntrl = __ISCNTRL;
- static const mask upper = __ISUPPER;
- static const mask lower = __ISLOWER;
- static const mask alpha = __ISALPHA;
- static const mask digit = __ISDIGIT;
- static const mask punct = __ISPUNCT;
- static const mask xdigit = __ISXDIGIT;
- static const mask blank = __ISBLANK;
-# endif
- static const mask __regex_word = 0x8000;
+# if defined(__NATIVE_ASCII_F)
+ typedef unsigned int mask;
+ static const mask space = _ISSPACE_A;
+ static const mask print = _ISPRINT_A;
+ static const mask cntrl = _ISCNTRL_A;
+ static const mask upper = _ISUPPER_A;
+ static const mask lower = _ISLOWER_A;
+ static const mask alpha = _ISALPHA_A;
+ static const mask digit = _ISDIGIT_A;
+ static const mask punct = _ISPUNCT_A;
+ static const mask xdigit = _ISXDIGIT_A;
+ static const mask blank = _ISBLANK_A;
+# else
+ typedef unsigned short mask;
+ static const mask space = __ISSPACE;
+ static const mask print = __ISPRINT;
+ static const mask cntrl = __ISCNTRL;
+ static const mask upper = __ISUPPER;
+ static const mask lower = __ISLOWER;
+ static const mask alpha = __ISALPHA;
+ static const mask digit = __ISDIGIT;
+ static const mask punct = __ISPUNCT;
+ static const mask xdigit = __ISXDIGIT;
+ static const mask blank = __ISBLANK;
+# endif
+ static const mask __regex_word = 0x8000;
#else
-# error unknown rune table for this platform -- do you mean to define _LIBCPP_PROVIDES_DEFAULT_RUNE_TABLE?
+# error unknown rune table for this platform -- do you mean to define _LIBCPP_PROVIDES_DEFAULT_RUNE_TABLE?
#endif
- static const mask alnum = alpha | digit;
- static const mask graph = alnum | punct;
+ static const mask alnum = alpha | digit;
+ static const mask graph = alnum | punct;
- _LIBCPP_HIDE_FROM_ABI ctype_base() {}
+ _LIBCPP_HIDE_FROM_ABI ctype_base() {}
- static_assert((__regex_word & ~(std::make_unsigned<mask>::type)(space | print | cntrl | upper | lower | alpha |
- digit | punct | xdigit | blank)) == __regex_word,
- "__regex_word can't overlap other bits");
+ static_assert((__regex_word & ~(std::make_unsigned<mask>::type)(space | print | cntrl | upper | lower | alpha |
+ digit | punct | xdigit | blank)) == __regex_word,
+ "__regex_word can't overlap other bits");
};
-template <class _CharT> class _LIBCPP_TEMPLATE_VIS ctype;
+template <class _CharT>
+class _LIBCPP_TEMPLATE_VIS ctype;
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
template <>
-class _LIBCPP_EXPORTED_FROM_ABI ctype<wchar_t>
- : public locale::facet,
- public ctype_base
-{
+class _LIBCPP_EXPORTED_FROM_ABI ctype<wchar_t> : public locale::facet, public ctype_base {
public:
- typedef wchar_t char_type;
+ typedef wchar_t char_type;
- _LIBCPP_HIDE_FROM_ABI
- explicit ctype(size_t __refs = 0)
- : locale::facet(__refs) {}
+ _LIBCPP_HIDE_FROM_ABI explicit ctype(size_t __refs = 0) : locale::facet(__refs) {}
- _LIBCPP_HIDE_FROM_ABI
- bool is(mask __m, char_type __c) const
- {
- return do_is(__m, __c);
- }
+ _LIBCPP_HIDE_FROM_ABI bool is(mask __m, char_type __c) const { return do_is(__m, __c); }
- _LIBCPP_HIDE_FROM_ABI
- const char_type* is(const char_type* __low, const char_type* __high, mask* __vec) const
- {
- return do_is(__low, __high, __vec);
- }
+ _LIBCPP_HIDE_FROM_ABI const char_type* is(const char_type* __low, const char_type* __high, mask* __vec) const {
+ return do_is(__low, __high, __vec);
+ }
- _LIBCPP_HIDE_FROM_ABI
- const char_type* scan_is(mask __m, const char_type* __low, const char_type* __high) const
- {
- return do_scan_is(__m, __low, __high);
- }
+ _LIBCPP_HIDE_FROM_ABI const char_type* scan_is(mask __m, const char_type* __low, const char_type* __high) const {
+ return do_scan_is(__m, __low, __high);
+ }
- _LIBCPP_HIDE_FROM_ABI
- const char_type* scan_not(mask __m, const char_type* __low, const char_type* __high) const
- {
- return do_scan_not(__m, __low, __high);
- }
+ _LIBCPP_HIDE_FROM_ABI const char_type* scan_not(mask __m, const char_type* __low, const char_type* __high) const {
+ return do_scan_not(__m, __low, __high);
+ }
- _LIBCPP_HIDE_FROM_ABI
- char_type toupper(char_type __c) const
- {
- return do_toupper(__c);
- }
+ _LIBCPP_HIDE_FROM_ABI char_type toupper(char_type __c) const { return do_toupper(__c); }
- _LIBCPP_HIDE_FROM_ABI
- const char_type* toupper(char_type* __low, const char_type* __high) const
- {
- return do_toupper(__low, __high);
- }
+ _LIBCPP_HIDE_FROM_ABI const char_type* toupper(char_type* __low, const char_type* __high) const {
+ return do_toupper(__low, __high);
+ }
- _LIBCPP_HIDE_FROM_ABI
- char_type tolower(char_type __c) const
- {
- return do_tolower(__c);
- }
+ _LIBCPP_HIDE_FROM_ABI char_type tolower(char_type __c) const { return do_tolower(__c); }
- _LIBCPP_HIDE_FROM_ABI
- const char_type* tolower(char_type* __low, const char_type* __high) const
- {
- return do_tolower(__low, __high);
- }
+ _LIBCPP_HIDE_FROM_ABI const char_type* tolower(char_type* __low, const char_type* __high) const {
+ return do_tolower(__low, __high);
+ }
- _LIBCPP_HIDE_FROM_ABI
- char_type widen(char __c) const
- {
- return do_widen(__c);
- }
+ _LIBCPP_HIDE_FROM_ABI char_type widen(char __c) const { return do_widen(__c); }
- _LIBCPP_HIDE_FROM_ABI
- const char* widen(const char* __low, const char* __high, char_type* __to) const
- {
- return do_widen(__low, __high, __to);
- }
+ _LIBCPP_HIDE_FROM_ABI const char* widen(const char* __low, const char* __high, char_type* __to) const {
+ return do_widen(__low, __high, __to);
+ }
- _LIBCPP_HIDE_FROM_ABI
- char narrow(char_type __c, char __dfault) const
- {
- return do_narrow(__c, __dfault);
- }
+ _LIBCPP_HIDE_FROM_ABI char narrow(char_type __c, char __dfault) const { return do_narrow(__c, __dfault); }
- _LIBCPP_HIDE_FROM_ABI
- const char_type* narrow(const char_type* __low, const char_type* __high, char __dfault, char* __to) const
- {
- return do_narrow(__low, __high, __dfault, __to);
- }
+ _LIBCPP_HIDE_FROM_ABI const char_type*
+ narrow(const char_type* __low, const char_type* __high, char __dfault, char* __to) const {
+ return do_narrow(__low, __high, __dfault, __to);
+ }
- static locale::id id;
+ static locale::id id;
protected:
- ~ctype() override;
- virtual bool do_is(mask __m, char_type __c) const;
- virtual const char_type* do_is(const char_type* __low, const char_type* __high, mask* __vec) const;
- virtual const char_type* do_scan_is(mask __m, const char_type* __low, const char_type* __high) const;
- virtual const char_type* do_scan_not(mask __m, const char_type* __low, const char_type* __high) const;
- virtual char_type do_toupper(char_type) const;
- virtual const char_type* do_toupper(char_type* __low, const char_type* __high) const;
- virtual char_type do_tolower(char_type) const;
- virtual const char_type* do_tolower(char_type* __low, const char_type* __high) const;
- virtual char_type do_widen(char) const;
- virtual const char* do_widen(const char* __low, const char* __high, char_type* __dest) const;
- virtual char do_narrow(char_type, char __dfault) const;
- virtual const char_type* do_narrow(const char_type* __low, const char_type* __high, char __dfault, char* __dest) const;
+ ~ctype() override;
+ virtual bool do_is(mask __m, char_type __c) const;
+ virtual const char_type* do_is(const char_type* __low, const char_type* __high, mask* __vec) const;
+ virtual const char_type* do_scan_is(mask __m, const char_type* __low, const char_type* __high) const;
+ virtual const char_type* do_scan_not(mask __m, const char_type* __low, const char_type* __high) const;
+ virtual char_type do_toupper(char_type) const;
+ virtual const char_type* do_toupper(char_type* __low, const char_type* __high) const;
+ virtual char_type do_tolower(char_type) const;
+ virtual const char_type* do_tolower(char_type* __low, const char_type* __high) const;
+ virtual char_type do_widen(char) const;
+ virtual const char* do_widen(const char* __low, const char* __high, char_type* __dest) const;
+ virtual char do_narrow(char_type, char __dfault) const;
+ virtual const char_type*
+ do_narrow(const char_type* __low, const char_type* __high, char __dfault, char* __dest) const;
};
#endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS
template <>
-class _LIBCPP_EXPORTED_FROM_ABI ctype<char>
- : public locale::facet, public ctype_base
-{
- const mask* __tab_;
- bool __del_;
+class _LIBCPP_EXPORTED_FROM_ABI ctype<char> : public locale::facet, public ctype_base {
+ const mask* __tab_;
+ bool __del_;
+
public:
- typedef char char_type;
+ typedef char char_type;
- explicit ctype(const mask* __tab = nullptr, bool __del = false, size_t __refs = 0);
+ explicit ctype(const mask* __tab = nullptr, bool __del = false, size_t __refs = 0);
- _LIBCPP_HIDE_FROM_ABI
- bool is(mask __m, char_type __c) const
- {
- return isascii(__c) ? (__tab_[static_cast<int>(__c)] & __m) !=0 : false;
- }
+ _LIBCPP_HIDE_FROM_ABI bool is(mask __m, char_type __c) const {
+ return isascii(__c) ? (__tab_[static_cast<int>(__c)] & __m) != 0 : false;
+ }
- _LIBCPP_HIDE_FROM_ABI
- const char_type* is(const char_type* __low, const char_type* __high, mask* __vec) const
- {
- for (; __low != __high; ++__low, ++__vec)
- *__vec = isascii(*__low) ? __tab_[static_cast<int>(*__low)] : 0;
- return __low;
- }
+ _LIBCPP_HIDE_FROM_ABI const char_type* is(const char_type* __low, const char_type* __high, mask* __vec) const {
+ for (; __low != __high; ++__low, ++__vec)
+ *__vec = isascii(*__low) ? __tab_[static_cast<int>(*__low)] : 0;
+ return __low;
+ }
- _LIBCPP_HIDE_FROM_ABI
- const char_type* scan_is (mask __m, const char_type* __low, const char_type* __high) const
- {
- for (; __low != __high; ++__low)
- if (isascii(*__low) && (__tab_[static_cast<int>(*__low)] & __m))
- break;
- return __low;
- }
+ _LIBCPP_HIDE_FROM_ABI const char_type* scan_is(mask __m, const char_type* __low, const char_type* __high) const {
+ for (; __low != __high; ++__low)
+ if (isascii(*__low) && (__tab_[static_cast<int>(*__low)] & __m))
+ break;
+ return __low;
+ }
- _LIBCPP_HIDE_FROM_ABI
- const char_type* scan_not(mask __m, const char_type* __low, const char_type* __high) const
- {
- for (; __low != __high; ++__low)
- if (!isascii(*__low) || !(__tab_[static_cast<int>(*__low)] & __m))
- break;
- return __low;
- }
+ _LIBCPP_HIDE_FROM_ABI const char_type* scan_not(mask __m, const char_type* __low, const char_type* __high) const {
+ for (; __low != __high; ++__low)
+ if (!isascii(*__low) || !(__tab_[static_cast<int>(*__low)] & __m))
+ break;
+ return __low;
+ }
- _LIBCPP_HIDE_FROM_ABI
- char_type toupper(char_type __c) const
- {
- return do_toupper(__c);
- }
+ _LIBCPP_HIDE_FROM_ABI char_type toupper(char_type __c) const { return do_toupper(__c); }
- _LIBCPP_HIDE_FROM_ABI
- const char_type* toupper(char_type* __low, const char_type* __high) const
- {
- return do_toupper(__low, __high);
- }
+ _LIBCPP_HIDE_FROM_ABI const char_type* toupper(char_type* __low, const char_type* __high) const {
+ return do_toupper(__low, __high);
+ }
- _LIBCPP_HIDE_FROM_ABI
- char_type tolower(char_type __c) const
- {
- return do_tolower(__c);
- }
+ _LIBCPP_HIDE_FROM_ABI char_type tolower(char_type __c) const { return do_tolower(__c); }
- _LIBCPP_HIDE_FROM_ABI
- const char_type* tolower(char_type* __low, const char_type* __high) const
- {
- return do_tolower(__low, __high);
- }
+ _LIBCPP_HIDE_FROM_ABI const char_type* tolower(char_type* __low, const char_type* __high) const {
+ return do_tolower(__low, __high);
+ }
- _LIBCPP_HIDE_FROM_ABI
- char_type widen(char __c) const
- {
- return do_widen(__c);
- }
+ _LIBCPP_HIDE_FROM_ABI char_type widen(char __c) const { return do_widen(__c); }
- _LIBCPP_HIDE_FROM_ABI
- const char* widen(const char* __low, const char* __high, char_type* __to) const
- {
- return do_widen(__low, __high, __to);
- }
+ _LIBCPP_HIDE_FROM_ABI const char* widen(const char* __low, const char* __high, char_type* __to) const {
+ return do_widen(__low, __high, __to);
+ }
- _LIBCPP_HIDE_FROM_ABI
- char narrow(char_type __c, char __dfault) const
- {
- return do_narrow(__c, __dfault);
- }
+ _LIBCPP_HIDE_FROM_ABI char narrow(char_type __c, char __dfault) const { return do_narrow(__c, __dfault); }
- _LIBCPP_HIDE_FROM_ABI
- const char* narrow(const char_type* __low, const char_type* __high, char __dfault, char* __to) const
- {
- return do_narrow(__low, __high, __dfault, __to);
- }
+ _LIBCPP_HIDE_FROM_ABI const char*
+ narrow(const char_type* __low, const char_type* __high, char __dfault, char* __to) const {
+ return do_narrow(__low, __high, __dfault, __to);
+ }
- static locale::id id;
+ static locale::id id;
#ifdef _CACHED_RUNES
- static const size_t table_size = _CACHED_RUNES;
+ static const size_t table_size = _CACHED_RUNES;
#else
- static const size_t table_size = 256; // FIXME: Don't hardcode this.
+ static const size_t table_size = 256; // FIXME: Don't hardcode this.
#endif
- _LIBCPP_HIDE_FROM_ABI const mask* table() const _NOEXCEPT {return __tab_;}
- static const mask* classic_table() _NOEXCEPT;
+ _LIBCPP_HIDE_FROM_ABI const mask* table() const _NOEXCEPT { return __tab_; }
+ static const mask* classic_table() _NOEXCEPT;
#if defined(__GLIBC__) || defined(__EMSCRIPTEN__)
- static const int* __classic_upper_table() _NOEXCEPT;
- static const int* __classic_lower_table() _NOEXCEPT;
+ static const int* __classic_upper_table() _NOEXCEPT;
+ static const int* __classic_lower_table() _NOEXCEPT;
#endif
#if defined(__NetBSD__)
- static const short* __classic_upper_table() _NOEXCEPT;
- static const short* __classic_lower_table() _NOEXCEPT;
+ static const short* __classic_upper_table() _NOEXCEPT;
+ static const short* __classic_lower_table() _NOEXCEPT;
#endif
#if defined(__MVS__)
- static const unsigned short* __classic_upper_table() _NOEXCEPT;
- static const unsigned short* __classic_lower_table() _NOEXCEPT;
+ static const unsigned short* __classic_upper_table() _NOEXCEPT;
+ static const unsigned short* __classic_lower_table() _NOEXCEPT;
#endif
protected:
- ~ctype() override;
- virtual char_type do_toupper(char_type __c) const;
- virtual const char_type* do_toupper(char_type* __low, const char_type* __high) const;
- virtual char_type do_tolower(char_type __c) const;
- virtual const char_type* do_tolower(char_type* __low, const char_type* __high) const;
- virtual char_type do_widen(char __c) const;
- virtual const char* do_widen(const char* __low, const char* __high, char_type* __to) const;
- virtual char do_narrow(char_type __c, char __dfault) const;
- virtual const char* do_narrow(const char_type* __low, const char_type* __high, char __dfault, char* __to) const;
+ ~ctype() override;
+ virtual char_type do_toupper(char_type __c) const;
+ virtual const char_type* do_toupper(char_type* __low, const char_type* __high) const;
+ virtual char_type do_tolower(char_type __c) const;
+ virtual const char_type* do_tolower(char_type* __low, const char_type* __high) const;
+ virtual char_type do_widen(char __c) const;
+ virtual const char* do_widen(const char* __low, const char* __high, char_type* __to) const;
+ virtual char do_narrow(char_type __c, char __dfault) const;
+ virtual const char* do_narrow(const char_type* __low, const char_type* __high, char __dfault, char* __to) const;
};
// template <class CharT> class ctype_byname;
-template <class _CharT> class _LIBCPP_TEMPLATE_VIS ctype_byname;
+template <class _CharT>
+class _LIBCPP_TEMPLATE_VIS ctype_byname;
template <>
-class _LIBCPP_EXPORTED_FROM_ABI ctype_byname<char>
- : public ctype<char>
-{
- locale_t __l_;
+class _LIBCPP_EXPORTED_FROM_ABI ctype_byname<char> : public ctype<char> {
+ locale_t __l_;
public:
- explicit ctype_byname(const char*, size_t = 0);
- explicit ctype_byname(const string&, size_t = 0);
+ explicit ctype_byname(const char*, size_t = 0);
+ explicit ctype_byname(const string&, size_t = 0);
protected:
- ~ctype_byname() override;
- char_type do_toupper(char_type) const override;
- const char_type* do_toupper(char_type* __low, const char_type* __high) const override;
- char_type do_tolower(char_type) const override;
- const char_type* do_tolower(char_type* __low, const char_type* __high) const override;
+ ~ctype_byname() override;
+ char_type do_toupper(char_type) const override;
+ const char_type* do_toupper(char_type* __low, const char_type* __high) const override;
+ char_type do_tolower(char_type) const override;
+ const char_type* do_tolower(char_type* __low, const char_type* __high) const override;
};
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
template <>
-class _LIBCPP_EXPORTED_FROM_ABI ctype_byname<wchar_t>
- : public ctype<wchar_t>
-{
- locale_t __l_;
+class _LIBCPP_EXPORTED_FROM_ABI ctype_byname<wchar_t> : public ctype<wchar_t> {
+ locale_t __l_;
public:
- explicit ctype_byname(const char*, size_t = 0);
- explicit ctype_byname(const string&, size_t = 0);
+ explicit ctype_byname(const char*, size_t = 0);
+ explicit ctype_byname(const string&, size_t = 0);
protected:
- ~ctype_byname() override;
- bool do_is(mask __m, char_type __c) const override;
- const char_type* do_is(const char_type* __low, const char_type* __high, mask* __vec) const override;
- const char_type* do_scan_is(mask __m, const char_type* __low, const char_type* __high) const override;
- const char_type* do_scan_not(mask __m, const char_type* __low, const char_type* __high) const override;
- char_type do_toupper(char_type) const override;
- const char_type* do_toupper(char_type* __low, const char_type* __high) const override;
- char_type do_tolower(char_type) const override;
- const char_type* do_tolower(char_type* __low, const char_type* __high) const override;
- char_type do_widen(char) const override;
- const char* do_widen(const char* __low, const char* __high, char_type* __dest) const override;
- char do_narrow(char_type, char __dfault) const override;
- const char_type* do_narrow(const char_type* __low, const char_type* __high, char __dfault, char* __dest) const override;
+ ~ctype_byname() override;
+ bool do_is(mask __m, char_type __c) const override;
+ const char_type* do_is(const char_type* __low, const char_type* __high, mask* __vec) const override;
+ const char_type* do_scan_is(mask __m, const char_type* __low, const char_type* __high) const override;
+ const char_type* do_scan_not(mask __m, const char_type* __low, const char_type* __high) const override;
+ char_type do_toupper(char_type) const override;
+ const char_type* do_toupper(char_type* __low, const char_type* __high) const override;
+ char_type do_tolower(char_type) const override;
+ const char_type* do_tolower(char_type* __low, const char_type* __high) const override;
+ char_type do_widen(char) const override;
+ const char* do_widen(const char* __low, const char* __high, char_type* __dest) const override;
+ char do_narrow(char_type, char __dfault) const override;
+ const char_type*
+ do_narrow(const char_type* __low, const char_type* __high, char __dfault, char* __dest) const override;
};
#endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS
template <class _CharT>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-isspace(_CharT __c, const locale& __loc)
-{
- return std::use_facet<ctype<_CharT> >(__loc).is(ctype_base::space, __c);
+inline _LIBCPP_HIDE_FROM_ABI bool isspace(_CharT __c, const locale& __loc) {
+ return std::use_facet<ctype<_CharT> >(__loc).is(ctype_base::space, __c);
}
template <class _CharT>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-isprint(_CharT __c, const locale& __loc)
-{
- return std::use_facet<ctype<_CharT> >(__loc).is(ctype_base::print, __c);
+inline _LIBCPP_HIDE_FROM_ABI bool isprint(_CharT __c, const locale& __loc) {
+ return std::use_facet<ctype<_CharT> >(__loc).is(ctype_base::print, __c);
}
template <class _CharT>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-iscntrl(_CharT __c, const locale& __loc)
-{
- return std::use_facet<ctype<_CharT> >(__loc).is(ctype_base::cntrl, __c);
+inline _LIBCPP_HIDE_FROM_ABI bool iscntrl(_CharT __c, const locale& __loc) {
+ return std::use_facet<ctype<_CharT> >(__loc).is(ctype_base::cntrl, __c);
}
template <class _CharT>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-isupper(_CharT __c, const locale& __loc)
-{
- return std::use_facet<ctype<_CharT> >(__loc).is(ctype_base::upper, __c);
+inline _LIBCPP_HIDE_FROM_ABI bool isupper(_CharT __c, const locale& __loc) {
+ return std::use_facet<ctype<_CharT> >(__loc).is(ctype_base::upper, __c);
}
template <class _CharT>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-islower(_CharT __c, const locale& __loc)
-{
- return std::use_facet<ctype<_CharT> >(__loc).is(ctype_base::lower, __c);
+inline _LIBCPP_HIDE_FROM_ABI bool islower(_CharT __c, const locale& __loc) {
+ return std::use_facet<ctype<_CharT> >(__loc).is(ctype_base::lower, __c);
}
template <class _CharT>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-isalpha(_CharT __c, const locale& __loc)
-{
- return std::use_facet<ctype<_CharT> >(__loc).is(ctype_base::alpha, __c);
+inline _LIBCPP_HIDE_FROM_ABI bool isalpha(_CharT __c, const locale& __loc) {
+ return std::use_facet<ctype<_CharT> >(__loc).is(ctype_base::alpha, __c);
}
template <class _CharT>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-isdigit(_CharT __c, const locale& __loc)
-{
- return std::use_facet<ctype<_CharT> >(__loc).is(ctype_base::digit, __c);
+inline _LIBCPP_HIDE_FROM_ABI bool isdigit(_CharT __c, const locale& __loc) {
+ return std::use_facet<ctype<_CharT> >(__loc).is(ctype_base::digit, __c);
}
template <class _CharT>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-ispunct(_CharT __c, const locale& __loc)
-{
- return std::use_facet<ctype<_CharT> >(__loc).is(ctype_base::punct, __c);
+inline _LIBCPP_HIDE_FROM_ABI bool ispunct(_CharT __c, const locale& __loc) {
+ return std::use_facet<ctype<_CharT> >(__loc).is(ctype_base::punct, __c);
}
template <class _CharT>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-isxdigit(_CharT __c, const locale& __loc)
-{
- return std::use_facet<ctype<_CharT> >(__loc).is(ctype_base::xdigit, __c);
+inline _LIBCPP_HIDE_FROM_ABI bool isxdigit(_CharT __c, const locale& __loc) {
+ return std::use_facet<ctype<_CharT> >(__loc).is(ctype_base::xdigit, __c);
}
template <class _CharT>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-isalnum(_CharT __c, const locale& __loc)
-{
- return std::use_facet<ctype<_CharT> >(__loc).is(ctype_base::alnum, __c);
+inline _LIBCPP_HIDE_FROM_ABI bool isalnum(_CharT __c, const locale& __loc) {
+ return std::use_facet<ctype<_CharT> >(__loc).is(ctype_base::alnum, __c);
}
template <class _CharT>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-isgraph(_CharT __c, const locale& __loc)
-{
- return std::use_facet<ctype<_CharT> >(__loc).is(ctype_base::graph, __c);
+inline _LIBCPP_HIDE_FROM_ABI bool isgraph(_CharT __c, const locale& __loc) {
+ return std::use_facet<ctype<_CharT> >(__loc).is(ctype_base::graph, __c);
}
template <class _CharT>
_LIBCPP_HIDE_FROM_ABI bool isblank(_CharT __c, const locale& __loc) {
- return std::use_facet<ctype<_CharT> >(__loc).is(ctype_base::blank, __c);
+ return std::use_facet<ctype<_CharT> >(__loc).is(ctype_base::blank, __c);
}
template <class _CharT>
-inline _LIBCPP_HIDE_FROM_ABI
-_CharT
-toupper(_CharT __c, const locale& __loc)
-{
- return std::use_facet<ctype<_CharT> >(__loc).toupper(__c);
+inline _LIBCPP_HIDE_FROM_ABI _CharT toupper(_CharT __c, const locale& __loc) {
+ return std::use_facet<ctype<_CharT> >(__loc).toupper(__c);
}
template <class _CharT>
-inline _LIBCPP_HIDE_FROM_ABI
-_CharT
-tolower(_CharT __c, const locale& __loc)
-{
- return std::use_facet<ctype<_CharT> >(__loc).tolower(__c);
+inline _LIBCPP_HIDE_FROM_ABI _CharT tolower(_CharT __c, const locale& __loc) {
+ return std::use_facet<ctype<_CharT> >(__loc).tolower(__c);
}
// codecvt_base
-class _LIBCPP_EXPORTED_FROM_ABI codecvt_base
-{
+class _LIBCPP_EXPORTED_FROM_ABI codecvt_base {
public:
- _LIBCPP_HIDE_FROM_ABI codecvt_base() {}
- enum result {ok, partial, error, noconv};
+ _LIBCPP_HIDE_FROM_ABI codecvt_base() {}
+ enum result { ok, partial, error, noconv };
};
// template <class internT, class externT, class stateT> class codecvt;
-template <class _InternT, class _ExternT, class _StateT> class _LIBCPP_TEMPLATE_VIS codecvt;
+template <class _InternT, class _ExternT, class _StateT>
+class _LIBCPP_TEMPLATE_VIS codecvt;
// template <> class codecvt<char, char, mbstate_t>
template <>
-class _LIBCPP_EXPORTED_FROM_ABI codecvt<char, char, mbstate_t>
- : public locale::facet,
- public codecvt_base
-{
+class _LIBCPP_EXPORTED_FROM_ABI codecvt<char, char, mbstate_t> : public locale::facet, public codecvt_base {
public:
- typedef char intern_type;
- typedef char extern_type;
- typedef mbstate_t state_type;
-
- _LIBCPP_HIDE_FROM_ABI
- explicit codecvt(size_t __refs = 0)
- : locale::facet(__refs) {}
-
- _LIBCPP_HIDE_FROM_ABI
- result out(state_type& __st,
- const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt,
- extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const
- {
- return do_out(__st, __frm, __frm_end, __frm_nxt, __to, __to_end, __to_nxt);
- }
-
- _LIBCPP_HIDE_FROM_ABI
- result unshift(state_type& __st,
- extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const
- {
- return do_unshift(__st, __to, __to_end, __to_nxt);
- }
-
- _LIBCPP_HIDE_FROM_ABI
- result in(state_type& __st,
- const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt,
- intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const
- {
- return do_in(__st, __frm, __frm_end, __frm_nxt, __to, __to_end, __to_nxt);
- }
-
- _LIBCPP_HIDE_FROM_ABI
- int encoding() const _NOEXCEPT
- {
- return do_encoding();
- }
-
- _LIBCPP_HIDE_FROM_ABI
- bool always_noconv() const _NOEXCEPT
- {
- return do_always_noconv();
- }
-
- _LIBCPP_HIDE_FROM_ABI
- int length(state_type& __st, const extern_type* __frm, const extern_type* __end, size_t __mx) const
- {
- return do_length(__st, __frm, __end, __mx);
- }
-
- _LIBCPP_HIDE_FROM_ABI
- int max_length() const _NOEXCEPT
- {
- return do_max_length();
- }
-
- static locale::id id;
+ typedef char intern_type;
+ typedef char extern_type;
+ typedef mbstate_t state_type;
+
+ _LIBCPP_HIDE_FROM_ABI explicit codecvt(size_t __refs = 0) : locale::facet(__refs) {}
+
+ _LIBCPP_HIDE_FROM_ABI result
+ out(state_type& __st,
+ const intern_type* __frm,
+ const intern_type* __frm_end,
+ const intern_type*& __frm_nxt,
+ extern_type* __to,
+ extern_type* __to_end,
+ extern_type*& __to_nxt) const {
+ return do_out(__st, __frm, __frm_end, __frm_nxt, __to, __to_end, __to_nxt);
+ }
+
+ _LIBCPP_HIDE_FROM_ABI result
+ unshift(state_type& __st, extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const {
+ return do_unshift(__st, __to, __to_end, __to_nxt);
+ }
+
+ _LIBCPP_HIDE_FROM_ABI result
+ in(state_type& __st,
+ const extern_type* __frm,
+ const extern_type* __frm_end,
+ const extern_type*& __frm_nxt,
+ intern_type* __to,
+ intern_type* __to_end,
+ intern_type*& __to_nxt) const {
+ return do_in(__st, __frm, __frm_end, __frm_nxt, __to, __to_end, __to_nxt);
+ }
+
+ _LIBCPP_HIDE_FROM_ABI int encoding() const _NOEXCEPT { return do_encoding(); }
+
+ _LIBCPP_HIDE_FROM_ABI bool always_noconv() const _NOEXCEPT { return do_always_noconv(); }
+
+ _LIBCPP_HIDE_FROM_ABI int
+ length(state_type& __st, const extern_type* __frm, const extern_type* __end, size_t __mx) const {
+ return do_length(__st, __frm, __end, __mx);
+ }
+
+ _LIBCPP_HIDE_FROM_ABI int max_length() const _NOEXCEPT { return do_max_length(); }
+
+ static locale::id id;
protected:
- _LIBCPP_HIDE_FROM_ABI
- explicit codecvt(const char*, size_t __refs = 0)
- : locale::facet(__refs) {}
-
- ~codecvt() override;
-
- virtual result do_out(state_type& __st,
- const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt,
- extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
- virtual result do_in(state_type& __st,
- const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt,
- intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const;
- virtual result do_unshift(state_type& __st,
- extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
- virtual int do_encoding() const _NOEXCEPT;
- virtual bool do_always_noconv() const _NOEXCEPT;
- virtual int do_length(state_type& __st, const extern_type* __frm, const extern_type* __end, size_t __mx) const;
- virtual int do_max_length() const _NOEXCEPT;
+ _LIBCPP_HIDE_FROM_ABI explicit codecvt(const char*, size_t __refs = 0) : locale::facet(__refs) {}
+
+ ~codecvt() override;
+
+ virtual result
+ do_out(state_type& __st,
+ const intern_type* __frm,
+ const intern_type* __frm_end,
+ const intern_type*& __frm_nxt,
+ extern_type* __to,
+ extern_type* __to_end,
+ extern_type*& __to_nxt) const;
+ virtual result
+ do_in(state_type& __st,
+ const extern_type* __frm,
+ const extern_type* __frm_end,
+ const extern_type*& __frm_nxt,
+ intern_type* __to,
+ intern_type* __to_end,
+ intern_type*& __to_nxt) const;
+ virtual result do_unshift(state_type& __st, extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
+ virtual int do_encoding() const _NOEXCEPT;
+ virtual bool do_always_noconv() const _NOEXCEPT;
+ virtual int do_length(state_type& __st, const extern_type* __frm, const extern_type* __end, size_t __mx) const;
+ virtual int do_max_length() const _NOEXCEPT;
};
// template <> class codecvt<wchar_t, char, mbstate_t>
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
template <>
-class _LIBCPP_EXPORTED_FROM_ABI codecvt<wchar_t, char, mbstate_t>
- : public locale::facet,
- public codecvt_base
-{
- locale_t __l_;
-public:
- typedef wchar_t intern_type;
- typedef char extern_type;
- typedef mbstate_t state_type;
-
- explicit codecvt(size_t __refs = 0);
-
- _LIBCPP_HIDE_FROM_ABI
- result out(state_type& __st,
- const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt,
- extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const
- {
- return do_out(__st, __frm, __frm_end, __frm_nxt, __to, __to_end, __to_nxt);
- }
-
- _LIBCPP_HIDE_FROM_ABI
- result unshift(state_type& __st,
- extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const
- {
- return do_unshift(__st, __to, __to_end, __to_nxt);
- }
-
- _LIBCPP_HIDE_FROM_ABI
- result in(state_type& __st,
- const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt,
- intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const
- {
- return do_in(__st, __frm, __frm_end, __frm_nxt, __to, __to_end, __to_nxt);
- }
-
- _LIBCPP_HIDE_FROM_ABI
- int encoding() const _NOEXCEPT
- {
- return do_encoding();
- }
-
- _LIBCPP_HIDE_FROM_ABI
- bool always_noconv() const _NOEXCEPT
- {
- return do_always_noconv();
- }
-
- _LIBCPP_HIDE_FROM_ABI
- int length(state_type& __st, const extern_type* __frm, const extern_type* __end, size_t __mx) const
- {
- return do_length(__st, __frm, __end, __mx);
- }
-
- _LIBCPP_HIDE_FROM_ABI
- int max_length() const _NOEXCEPT
- {
- return do_max_length();
- }
+class _LIBCPP_EXPORTED_FROM_ABI codecvt<wchar_t, char, mbstate_t> : public locale::facet, public codecvt_base {
+ locale_t __l_;
- static locale::id id;
+public:
+ typedef wchar_t intern_type;
+ typedef char extern_type;
+ typedef mbstate_t state_type;
+
+ explicit codecvt(size_t __refs = 0);
+
+ _LIBCPP_HIDE_FROM_ABI result
+ out(state_type& __st,
+ const intern_type* __frm,
+ const intern_type* __frm_end,
+ const intern_type*& __frm_nxt,
+ extern_type* __to,
+ extern_type* __to_end,
+ extern_type*& __to_nxt) const {
+ return do_out(__st, __frm, __frm_end, __frm_nxt, __to, __to_end, __to_nxt);
+ }
+
+ _LIBCPP_HIDE_FROM_ABI result
+ unshift(state_type& __st, extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const {
+ return do_unshift(__st, __to, __to_end, __to_nxt);
+ }
+
+ _LIBCPP_HIDE_FROM_ABI result
+ in(state_type& __st,
+ const extern_type* __frm,
+ const extern_type* __frm_end,
+ const extern_type*& __frm_nxt,
+ intern_type* __to,
+ intern_type* __to_end,
+ intern_type*& __to_nxt) const {
+ return do_in(__st, __frm, __frm_end, __frm_nxt, __to, __to_end, __to_nxt);
+ }
+
+ _LIBCPP_HIDE_FROM_ABI int encoding() const _NOEXCEPT { return do_encoding(); }
+
+ _LIBCPP_HIDE_FROM_ABI bool always_noconv() const _NOEXCEPT { return do_always_noconv(); }
+
+ _LIBCPP_HIDE_FROM_ABI int
+ length(state_type& __st, const extern_type* __frm, const extern_type* __end, size_t __mx) const {
+ return do_length(__st, __frm, __end, __mx);
+ }
+
+ _LIBCPP_HIDE_FROM_ABI int max_length() const _NOEXCEPT { return do_max_length(); }
+
+ static locale::id id;
protected:
- explicit codecvt(const char*, size_t __refs = 0);
-
- ~codecvt() override;
-
- virtual result do_out(state_type& __st,
- const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt,
- extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
- virtual result do_in(state_type& __st,
- const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt,
- intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const;
- virtual result do_unshift(state_type& __st,
- extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
- virtual int do_encoding() const _NOEXCEPT;
- virtual bool do_always_noconv() const _NOEXCEPT;
- virtual int do_length(state_type&, const extern_type* __frm, const extern_type* __end, size_t __mx) const;
- virtual int do_max_length() const _NOEXCEPT;
+ explicit codecvt(const char*, size_t __refs = 0);
+
+ ~codecvt() override;
+
+ virtual result
+ do_out(state_type& __st,
+ const intern_type* __frm,
+ const intern_type* __frm_end,
+ const intern_type*& __frm_nxt,
+ extern_type* __to,
+ extern_type* __to_end,
+ extern_type*& __to_nxt) const;
+ virtual result
+ do_in(state_type& __st,
+ const extern_type* __frm,
+ const extern_type* __frm_end,
+ const extern_type*& __frm_nxt,
+ intern_type* __to,
+ intern_type* __to_end,
+ intern_type*& __to_nxt) const;
+ virtual result do_unshift(state_type& __st, extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
+ virtual int do_encoding() const _NOEXCEPT;
+ virtual bool do_always_noconv() const _NOEXCEPT;
+ virtual int do_length(state_type&, const extern_type* __frm, const extern_type* __end, size_t __mx) const;
+ virtual int do_max_length() const _NOEXCEPT;
};
#endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS
@@ -1087,86 +924,80 @@ protected:
template <>
class _LIBCPP_DEPRECATED_IN_CXX20 _LIBCPP_EXPORTED_FROM_ABI codecvt<char16_t, char, mbstate_t>
- : public locale::facet,
- public codecvt_base
-{
+ : public locale::facet, public codecvt_base {
public:
- typedef char16_t intern_type;
- typedef char extern_type;
- typedef mbstate_t state_type;
-
- _LIBCPP_HIDE_FROM_ABI
- explicit codecvt(size_t __refs = 0)
- : locale::facet(__refs) {}
-
- _LIBCPP_HIDE_FROM_ABI
- result out(state_type& __st,
- const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt,
- extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const
- {
- return do_out(__st, __frm, __frm_end, __frm_nxt, __to, __to_end, __to_nxt);
- }
-
- _LIBCPP_HIDE_FROM_ABI
- result unshift(state_type& __st,
- extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const
- {
- return do_unshift(__st, __to, __to_end, __to_nxt);
- }
-
- _LIBCPP_HIDE_FROM_ABI
- result in(state_type& __st,
- const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt,
- intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const
- {
- return do_in(__st, __frm, __frm_end, __frm_nxt, __to, __to_end, __to_nxt);
- }
-
- _LIBCPP_HIDE_FROM_ABI
- int encoding() const _NOEXCEPT
- {
- return do_encoding();
- }
-
- _LIBCPP_HIDE_FROM_ABI
- bool always_noconv() const _NOEXCEPT
- {
- return do_always_noconv();
- }
-
- _LIBCPP_HIDE_FROM_ABI
- int length(state_type& __st, const extern_type* __frm, const extern_type* __end, size_t __mx) const
- {
- return do_length(__st, __frm, __end, __mx);
- }
-
- _LIBCPP_HIDE_FROM_ABI
- int max_length() const _NOEXCEPT
- {
- return do_max_length();
- }
-
- static locale::id id;
+ typedef char16_t intern_type;
+ typedef char extern_type;
+ typedef mbstate_t state_type;
+
+ _LIBCPP_HIDE_FROM_ABI explicit codecvt(size_t __refs = 0) : locale::facet(__refs) {}
+
+ _LIBCPP_HIDE_FROM_ABI result
+ out(state_type& __st,
+ const intern_type* __frm,
+ const intern_type* __frm_end,
+ const intern_type*& __frm_nxt,
+ extern_type* __to,
+ extern_type* __to_end,
+ extern_type*& __to_nxt) const {
+ return do_out(__st, __frm, __frm_end, __frm_nxt, __to, __to_end, __to_nxt);
+ }
+
+ _LIBCPP_HIDE_FROM_ABI result
+ unshift(state_type& __st, extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const {
+ return do_unshift(__st, __to, __to_end, __to_nxt);
+ }
+
+ _LIBCPP_HIDE_FROM_ABI result
+ in(state_type& __st,
+ const extern_type* __frm,
+ const extern_type* __frm_end,
+ const extern_type*& __frm_nxt,
+ intern_type* __to,
+ intern_type* __to_end,
+ intern_type*& __to_nxt) const {
+ return do_in(__st, __frm, __frm_end, __frm_nxt, __to, __to_end, __to_nxt);
+ }
+
+ _LIBCPP_HIDE_FROM_ABI int encoding() const _NOEXCEPT { return do_encoding(); }
+
+ _LIBCPP_HIDE_FROM_ABI bool always_noconv() const _NOEXCEPT { return do_always_noconv(); }
+
+ _LIBCPP_HIDE_FROM_ABI int
+ length(state_type& __st, const extern_type* __frm, const extern_type* __end, size_t __mx) const {
+ return do_length(__st, __frm, __end, __mx);
+ }
+
+ _LIBCPP_HIDE_FROM_ABI int max_length() const _NOEXCEPT { return do_max_length(); }
+
+ static locale::id id;
protected:
- _LIBCPP_HIDE_FROM_ABI
- explicit codecvt(const char*, size_t __refs = 0)
- : locale::facet(__refs) {}
-
- ~codecvt() override;
-
- virtual result do_out(state_type& __st,
- const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt,
- extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
- virtual result do_in(state_type& __st,
- const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt,
- intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const;
- virtual result do_unshift(state_type& __st,
- extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
- virtual int do_encoding() const _NOEXCEPT;
- virtual bool do_always_noconv() const _NOEXCEPT;
- virtual int do_length(state_type&, const extern_type* __frm, const extern_type* __end, size_t __mx) const;
- virtual int do_max_length() const _NOEXCEPT;
+ _LIBCPP_HIDE_FROM_ABI explicit codecvt(const char*, size_t __refs = 0) : locale::facet(__refs) {}
+
+ ~codecvt() override;
+
+ virtual result
+ do_out(state_type& __st,
+ const intern_type* __frm,
+ const intern_type* __frm_end,
+ const intern_type*& __frm_nxt,
+ extern_type* __to,
+ extern_type* __to_end,
+ extern_type*& __to_nxt) const;
+ virtual result
+ do_in(state_type& __st,
+ const extern_type* __frm,
+ const extern_type* __frm_end,
+ const extern_type*& __frm_nxt,
+ intern_type* __to,
+ intern_type* __to_end,
+ intern_type*& __to_nxt) const;
+ virtual result do_unshift(state_type& __st, extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
+ virtual int do_encoding() const _NOEXCEPT;
+ virtual bool do_always_noconv() const _NOEXCEPT;
+ virtual int do_length(state_type&, const extern_type* __frm, const extern_type* __end, size_t __mx) const;
+ virtual int do_max_length() const _NOEXCEPT;
};
#ifndef _LIBCPP_HAS_NO_CHAR8_T
@@ -1174,87 +1005,80 @@ protected:
// template <> class codecvt<char16_t, char8_t, mbstate_t> // C++20
template <>
-class _LIBCPP_EXPORTED_FROM_ABI codecvt<char16_t, char8_t, mbstate_t>
- : public locale::facet,
- public codecvt_base
-{
+class _LIBCPP_EXPORTED_FROM_ABI codecvt<char16_t, char8_t, mbstate_t> : public locale::facet, public codecvt_base {
public:
- typedef char16_t intern_type;
- typedef char8_t extern_type;
- typedef mbstate_t state_type;
-
- _LIBCPP_HIDE_FROM_ABI
- explicit codecvt(size_t __refs = 0)
- : locale::facet(__refs) {}
-
- _LIBCPP_HIDE_FROM_ABI
- result out(state_type& __st,
- const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt,
- extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const
- {
- return do_out(__st, __frm, __frm_end, __frm_nxt, __to, __to_end, __to_nxt);
- }
-
- _LIBCPP_HIDE_FROM_ABI
- result unshift(state_type& __st,
- extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const
- {
- return do_unshift(__st, __to, __to_end, __to_nxt);
- }
-
- _LIBCPP_HIDE_FROM_ABI
- result in(state_type& __st,
- const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt,
- intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const
- {
- return do_in(__st, __frm, __frm_end, __frm_nxt, __to, __to_end, __to_nxt);
- }
-
- _LIBCPP_HIDE_FROM_ABI
- int encoding() const _NOEXCEPT
- {
- return do_encoding();
- }
-
- _LIBCPP_HIDE_FROM_ABI
- bool always_noconv() const _NOEXCEPT
- {
- return do_always_noconv();
- }
-
- _LIBCPP_HIDE_FROM_ABI
- int length(state_type& __st, const extern_type* __frm, const extern_type* __end, size_t __mx) const
- {
- return do_length(__st, __frm, __end, __mx);
- }
-
- _LIBCPP_HIDE_FROM_ABI
- int max_length() const _NOEXCEPT
- {
- return do_max_length();
- }
-
- static locale::id id;
+ typedef char16_t intern_type;
+ typedef char8_t extern_type;
+ typedef mbstate_t state_type;
+
+ _LIBCPP_HIDE_FROM_ABI explicit codecvt(size_t __refs = 0) : locale::facet(__refs) {}
+
+ _LIBCPP_HIDE_FROM_ABI result
+ out(state_type& __st,
+ const intern_type* __frm,
+ const intern_type* __frm_end,
+ const intern_type*& __frm_nxt,
+ extern_type* __to,
+ extern_type* __to_end,
+ extern_type*& __to_nxt) const {
+ return do_out(__st, __frm, __frm_end, __frm_nxt, __to, __to_end, __to_nxt);
+ }
+
+ _LIBCPP_HIDE_FROM_ABI result
+ unshift(state_type& __st, extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const {
+ return do_unshift(__st, __to, __to_end, __to_nxt);
+ }
+
+ _LIBCPP_HIDE_FROM_ABI result
+ in(state_type& __st,
+ const extern_type* __frm,
+ const extern_type* __frm_end,
+ const extern_type*& __frm_nxt,
+ intern_type* __to,
+ intern_type* __to_end,
+ intern_type*& __to_nxt) const {
+ return do_in(__st, __frm, __frm_end, __frm_nxt, __to, __to_end, __to_nxt);
+ }
+
+ _LIBCPP_HIDE_FROM_ABI int encoding() const _NOEXCEPT { return do_encoding(); }
+
+ _LIBCPP_HIDE_FROM_ABI bool always_noconv() const _NOEXCEPT { return do_always_noconv(); }
+
+ _LIBCPP_HIDE_FROM_ABI int
+ length(state_type& __st, const extern_type* __frm, const extern_type* __end, size_t __mx) const {
+ return do_length(__st, __frm, __end, __mx);
+ }
+
+ _LIBCPP_HIDE_FROM_ABI int max_length() const _NOEXCEPT { return do_max_length(); }
+
+ static locale::id id;
protected:
- _LIBCPP_HIDE_FROM_ABI
- explicit codecvt(const char*, size_t __refs = 0)
- : locale::facet(__refs) {}
-
- ~codecvt() override;
-
- virtual result do_out(state_type& __st,
- const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt,
- extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
- virtual result do_in(state_type& __st,
- const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt,
- intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const;
- virtual result do_unshift(state_type& __st,
- extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
- virtual int do_encoding() const _NOEXCEPT;
- virtual bool do_always_noconv() const _NOEXCEPT;
- virtual int do_length(state_type&, const extern_type* __frm, const extern_type* __end, size_t __mx) const;
- virtual int do_max_length() const _NOEXCEPT;
+ _LIBCPP_HIDE_FROM_ABI explicit codecvt(const char*, size_t __refs = 0) : locale::facet(__refs) {}
+
+ ~codecvt() override;
+
+ virtual result
+ do_out(state_type& __st,
+ const intern_type* __frm,
+ const intern_type* __frm_end,
+ const intern_type*& __frm_nxt,
+ extern_type* __to,
+ extern_type* __to_end,
+ extern_type*& __to_nxt) const;
+ virtual result
+ do_in(state_type& __st,
+ const extern_type* __frm,
+ const extern_type* __frm_end,
+ const extern_type*& __frm_nxt,
+ intern_type* __to,
+ intern_type* __to_end,
+ intern_type*& __to_nxt) const;
+ virtual result do_unshift(state_type& __st, extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
+ virtual int do_encoding() const _NOEXCEPT;
+ virtual bool do_always_noconv() const _NOEXCEPT;
+ virtual int do_length(state_type&, const extern_type* __frm, const extern_type* __end, size_t __mx) const;
+ virtual int do_max_length() const _NOEXCEPT;
};
#endif
@@ -1263,86 +1087,80 @@ protected:
template <>
class _LIBCPP_DEPRECATED_IN_CXX20 _LIBCPP_EXPORTED_FROM_ABI codecvt<char32_t, char, mbstate_t>
- : public locale::facet,
- public codecvt_base
-{
+ : public locale::facet, public codecvt_base {
public:
- typedef char32_t intern_type;
- typedef char extern_type;
- typedef mbstate_t state_type;
-
- _LIBCPP_HIDE_FROM_ABI
- explicit codecvt(size_t __refs = 0)
- : locale::facet(__refs) {}
-
- _LIBCPP_HIDE_FROM_ABI
- result out(state_type& __st,
- const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt,
- extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const
- {
- return do_out(__st, __frm, __frm_end, __frm_nxt, __to, __to_end, __to_nxt);
- }
-
- _LIBCPP_HIDE_FROM_ABI
- result unshift(state_type& __st,
- extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const
- {
- return do_unshift(__st, __to, __to_end, __to_nxt);
- }
-
- _LIBCPP_HIDE_FROM_ABI
- result in(state_type& __st,
- const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt,
- intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const
- {
- return do_in(__st, __frm, __frm_end, __frm_nxt, __to, __to_end, __to_nxt);
- }
-
- _LIBCPP_HIDE_FROM_ABI
- int encoding() const _NOEXCEPT
- {
- return do_encoding();
- }
-
- _LIBCPP_HIDE_FROM_ABI
- bool always_noconv() const _NOEXCEPT
- {
- return do_always_noconv();
- }
-
- _LIBCPP_HIDE_FROM_ABI
- int length(state_type& __st, const extern_type* __frm, const extern_type* __end, size_t __mx) const
- {
- return do_length(__st, __frm, __end, __mx);
- }
-
- _LIBCPP_HIDE_FROM_ABI
- int max_length() const _NOEXCEPT
- {
- return do_max_length();
- }
-
- static locale::id id;
+ typedef char32_t intern_type;
+ typedef char extern_type;
+ typedef mbstate_t state_type;
+
+ _LIBCPP_HIDE_FROM_ABI explicit codecvt(size_t __refs = 0) : locale::facet(__refs) {}
+
+ _LIBCPP_HIDE_FROM_ABI result
+ out(state_type& __st,
+ const intern_type* __frm,
+ const intern_type* __frm_end,
+ const intern_type*& __frm_nxt,
+ extern_type* __to,
+ extern_type* __to_end,
+ extern_type*& __to_nxt) const {
+ return do_out(__st, __frm, __frm_end, __frm_nxt, __to, __to_end, __to_nxt);
+ }
+
+ _LIBCPP_HIDE_FROM_ABI result
+ unshift(state_type& __st, extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const {
+ return do_unshift(__st, __to, __to_end, __to_nxt);
+ }
+
+ _LIBCPP_HIDE_FROM_ABI result
+ in(state_type& __st,
+ const extern_type* __frm,
+ const extern_type* __frm_end,
+ const extern_type*& __frm_nxt,
+ intern_type* __to,
+ intern_type* __to_end,
+ intern_type*& __to_nxt) const {
+ return do_in(__st, __frm, __frm_end, __frm_nxt, __to, __to_end, __to_nxt);
+ }
+
+ _LIBCPP_HIDE_FROM_ABI int encoding() const _NOEXCEPT { return do_encoding(); }
+
+ _LIBCPP_HIDE_FROM_ABI bool always_noconv() const _NOEXCEPT { return do_always_noconv(); }
+
+ _LIBCPP_HIDE_FROM_ABI int
+ length(state_type& __st, const extern_type* __frm, const extern_type* __end, size_t __mx) const {
+ return do_length(__st, __frm, __end, __mx);
+ }
+
+ _LIBCPP_HIDE_FROM_ABI int max_length() const _NOEXCEPT { return do_max_length(); }
+
+ static locale::id id;
protected:
- _LIBCPP_HIDE_FROM_ABI
- explicit codecvt(const char*, size_t __refs = 0)
- : locale::facet(__refs) {}
-
- ~codecvt() override;
-
- virtual result do_out(state_type& __st,
- const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt,
- extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
- virtual result do_in(state_type& __st,
- const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt,
- intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const;
- virtual result do_unshift(state_type& __st,
- extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
- virtual int do_encoding() const _NOEXCEPT;
- virtual bool do_always_noconv() const _NOEXCEPT;
- virtual int do_length(state_type&, const extern_type* __frm, const extern_type* __end, size_t __mx) const;
- virtual int do_max_length() const _NOEXCEPT;
+ _LIBCPP_HIDE_FROM_ABI explicit codecvt(const char*, size_t __refs = 0) : locale::facet(__refs) {}
+
+ ~codecvt() override;
+
+ virtual result
+ do_out(state_type& __st,
+ const intern_type* __frm,
+ const intern_type* __frm_end,
+ const intern_type*& __frm_nxt,
+ extern_type* __to,
+ extern_type* __to_end,
+ extern_type*& __to_nxt) const;
+ virtual result
+ do_in(state_type& __st,
+ const extern_type* __frm,
+ const extern_type* __frm_end,
+ const extern_type*& __frm_nxt,
+ intern_type* __to,
+ intern_type* __to_end,
+ intern_type*& __to_nxt) const;
+ virtual result do_unshift(state_type& __st, extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
+ virtual int do_encoding() const _NOEXCEPT;
+ virtual bool do_always_noconv() const _NOEXCEPT;
+ virtual int do_length(state_type&, const extern_type* __frm, const extern_type* __end, size_t __mx) const;
+ virtual int do_max_length() const _NOEXCEPT;
};
#ifndef _LIBCPP_HAS_NO_CHAR8_T
@@ -1350,87 +1168,80 @@ protected:
// template <> class codecvt<char32_t, char8_t, mbstate_t> // C++20
template <>
-class _LIBCPP_EXPORTED_FROM_ABI codecvt<char32_t, char8_t, mbstate_t>
- : public locale::facet,
- public codecvt_base
-{
+class _LIBCPP_EXPORTED_FROM_ABI codecvt<char32_t, char8_t, mbstate_t> : public locale::facet, public codecvt_base {
public:
- typedef char32_t intern_type;
- typedef char8_t extern_type;
- typedef mbstate_t state_type;
-
- _LIBCPP_HIDE_FROM_ABI
- explicit codecvt(size_t __refs = 0)
- : locale::facet(__refs) {}
-
- _LIBCPP_HIDE_FROM_ABI
- result out(state_type& __st,
- const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt,
- extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const
- {
- return do_out(__st, __frm, __frm_end, __frm_nxt, __to, __to_end, __to_nxt);
- }
-
- _LIBCPP_HIDE_FROM_ABI
- result unshift(state_type& __st,
- extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const
- {
- return do_unshift(__st, __to, __to_end, __to_nxt);
- }
-
- _LIBCPP_HIDE_FROM_ABI
- result in(state_type& __st,
- const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt,
- intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const
- {
- return do_in(__st, __frm, __frm_end, __frm_nxt, __to, __to_end, __to_nxt);
- }
-
- _LIBCPP_HIDE_FROM_ABI
- int encoding() const _NOEXCEPT
- {
- return do_encoding();
- }
-
- _LIBCPP_HIDE_FROM_ABI
- bool always_noconv() const _NOEXCEPT
- {
- return do_always_noconv();
- }
-
- _LIBCPP_HIDE_FROM_ABI
- int length(state_type& __st, const extern_type* __frm, const extern_type* __end, size_t __mx) const
- {
- return do_length(__st, __frm, __end, __mx);
- }
-
- _LIBCPP_HIDE_FROM_ABI
- int max_length() const _NOEXCEPT
- {
- return do_max_length();
- }
-
- static locale::id id;
+ typedef char32_t intern_type;
+ typedef char8_t extern_type;
+ typedef mbstate_t state_type;
+
+ _LIBCPP_HIDE_FROM_ABI explicit codecvt(size_t __refs = 0) : locale::facet(__refs) {}
+
+ _LIBCPP_HIDE_FROM_ABI result
+ out(state_type& __st,
+ const intern_type* __frm,
+ const intern_type* __frm_end,
+ const intern_type*& __frm_nxt,
+ extern_type* __to,
+ extern_type* __to_end,
+ extern_type*& __to_nxt) const {
+ return do_out(__st, __frm, __frm_end, __frm_nxt, __to, __to_end, __to_nxt);
+ }
+
+ _LIBCPP_HIDE_FROM_ABI result
+ unshift(state_type& __st, extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const {
+ return do_unshift(__st, __to, __to_end, __to_nxt);
+ }
+
+ _LIBCPP_HIDE_FROM_ABI result
+ in(state_type& __st,
+ const extern_type* __frm,
+ const extern_type* __frm_end,
+ const extern_type*& __frm_nxt,
+ intern_type* __to,
+ intern_type* __to_end,
+ intern_type*& __to_nxt) const {
+ return do_in(__st, __frm, __frm_end, __frm_nxt, __to, __to_end, __to_nxt);
+ }
+
+ _LIBCPP_HIDE_FROM_ABI int encoding() const _NOEXCEPT { return do_encoding(); }
+
+ _LIBCPP_HIDE_FROM_ABI bool always_noconv() const _NOEXCEPT { return do_always_noconv(); }
+
+ _LIBCPP_HIDE_FROM_ABI int
+ length(state_type& __st, const extern_type* __frm, const extern_type* __end, size_t __mx) const {
+ return do_length(__st, __frm, __end, __mx);
+ }
+
+ _LIBCPP_HIDE_FROM_ABI int max_length() const _NOEXCEPT { return do_max_length(); }
+
+ static locale::id id;
protected:
- _LIBCPP_HIDE_FROM_ABI
- explicit codecvt(const char*, size_t __refs = 0)
- : locale::facet(__refs) {}
-
- ~codecvt() override;
-
- virtual result do_out(state_type& __st,
- const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt,
- extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
- virtual result do_in(state_type& __st,
- const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt,
- intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const;
- virtual result do_unshift(state_type& __st,
- extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
- virtual int do_encoding() const _NOEXCEPT;
- virtual bool do_always_noconv() const _NOEXCEPT;
- virtual int do_length(state_type&, const extern_type* __frm, const extern_type* __end, size_t __mx) const;
- virtual int do_max_length() const _NOEXCEPT;
+ _LIBCPP_HIDE_FROM_ABI explicit codecvt(const char*, size_t __refs = 0) : locale::facet(__refs) {}
+
+ ~codecvt() override;
+
+ virtual result
+ do_out(state_type& __st,
+ const intern_type* __frm,
+ const intern_type* __frm_end,
+ const intern_type*& __frm_nxt,
+ extern_type* __to,
+ extern_type* __to_end,
+ extern_type*& __to_nxt) const;
+ virtual result
+ do_in(state_type& __st,
+ const extern_type* __frm,
+ const extern_type* __frm_end,
+ const extern_type*& __frm_nxt,
+ intern_type* __to,
+ intern_type* __to_end,
+ intern_type*& __to_nxt) const;
+ virtual result do_unshift(state_type& __st, extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
+ virtual int do_encoding() const _NOEXCEPT;
+ virtual bool do_always_noconv() const _NOEXCEPT;
+ virtual int do_length(state_type&, const extern_type* __frm, const extern_type* __end, size_t __mx) const;
+ virtual int do_max_length() const _NOEXCEPT;
};
#endif
@@ -1438,333 +1249,280 @@ protected:
// template <class _InternT, class _ExternT, class _StateT> class codecvt_byname
template <class _InternT, class _ExternT, class _StateT>
-class _LIBCPP_TEMPLATE_VIS codecvt_byname
- : public codecvt<_InternT, _ExternT, _StateT>
-{
+class _LIBCPP_TEMPLATE_VIS codecvt_byname : public codecvt<_InternT, _ExternT, _StateT> {
public:
- _LIBCPP_HIDE_FROM_ABI
- explicit codecvt_byname(const char* __nm, size_t __refs = 0)
- : codecvt<_InternT, _ExternT, _StateT>(__nm, __refs) {}
- _LIBCPP_HIDE_FROM_ABI
- explicit codecvt_byname(const string& __nm, size_t __refs = 0)
- : codecvt<_InternT, _ExternT, _StateT>(__nm.c_str(), __refs) {}
+ _LIBCPP_HIDE_FROM_ABI explicit codecvt_byname(const char* __nm, size_t __refs = 0)
+ : codecvt<_InternT, _ExternT, _StateT>(__nm, __refs) {}
+ _LIBCPP_HIDE_FROM_ABI explicit codecvt_byname(const string& __nm, size_t __refs = 0)
+ : codecvt<_InternT, _ExternT, _StateT>(__nm.c_str(), __refs) {}
+
protected:
- ~codecvt_byname() override;
+ ~codecvt_byname() override;
};
_LIBCPP_SUPPRESS_DEPRECATED_PUSH
template <class _InternT, class _ExternT, class _StateT>
-codecvt_byname<_InternT, _ExternT, _StateT>::~codecvt_byname()
-{
-}
+codecvt_byname<_InternT, _ExternT, _StateT>::~codecvt_byname() {}
_LIBCPP_SUPPRESS_DEPRECATED_POP
extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS codecvt_byname<char, char, mbstate_t>;
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS codecvt_byname<wchar_t, char, mbstate_t>;
#endif
-extern template class _LIBCPP_DEPRECATED_IN_CXX20 _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS codecvt_byname<char16_t, char, mbstate_t>; // deprecated in C++20
-extern template class _LIBCPP_DEPRECATED_IN_CXX20 _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS codecvt_byname<char32_t, char, mbstate_t>; // deprecated in C++20
+extern template class _LIBCPP_DEPRECATED_IN_CXX20 _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS
+ codecvt_byname<char16_t, char, mbstate_t>; // deprecated in C++20
+extern template class _LIBCPP_DEPRECATED_IN_CXX20 _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS
+ codecvt_byname<char32_t, char, mbstate_t>; // deprecated in C++20
#ifndef _LIBCPP_HAS_NO_CHAR8_T
extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS codecvt_byname<char16_t, char8_t, mbstate_t>; // C++20
extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS codecvt_byname<char32_t, char8_t, mbstate_t>; // C++20
#endif
template <size_t _Np>
-struct __narrow_to_utf8
-{
- template <class _OutputIterator, class _CharT>
- _OutputIterator
- operator()(_OutputIterator __s, const _CharT* __wb, const _CharT* __we) const;
+struct __narrow_to_utf8 {
+ template <class _OutputIterator, class _CharT>
+ _OutputIterator operator()(_OutputIterator __s, const _CharT* __wb, const _CharT* __we) const;
};
template <>
-struct __narrow_to_utf8<8>
-{
- template <class _OutputIterator, class _CharT>
- _LIBCPP_HIDE_FROM_ABI
- _OutputIterator
- operator()(_OutputIterator __s, const _CharT* __wb, const _CharT* __we) const
- {
- for (; __wb < __we; ++__wb, ++__s)
- *__s = *__wb;
- return __s;
- }
+struct __narrow_to_utf8<8> {
+ template <class _OutputIterator, class _CharT>
+ _LIBCPP_HIDE_FROM_ABI _OutputIterator operator()(_OutputIterator __s, const _CharT* __wb, const _CharT* __we) const {
+ for (; __wb < __we; ++__wb, ++__s)
+ *__s = *__wb;
+ return __s;
+ }
};
_LIBCPP_SUPPRESS_DEPRECATED_PUSH
template <>
-struct _LIBCPP_EXPORTED_FROM_ABI __narrow_to_utf8<16>
- : public codecvt<char16_t, char, mbstate_t>
-{
- _LIBCPP_HIDE_FROM_ABI
- __narrow_to_utf8() : codecvt<char16_t, char, mbstate_t>(1) {}
-_LIBCPP_SUPPRESS_DEPRECATED_POP
-
- ~__narrow_to_utf8() override;
-
- template <class _OutputIterator, class _CharT>
- _LIBCPP_HIDE_FROM_ABI
- _OutputIterator
- operator()(_OutputIterator __s, const _CharT* __wb, const _CharT* __we) const
- {
- result __r = ok;
- mbstate_t __mb;
- while (__wb < __we && __r != error)
- {
- const int __sz = 32;
- char __buf[__sz];
- char* __bn;
- const char16_t* __wn = (const char16_t*)__wb;
- __r = do_out(__mb, (const char16_t*)__wb, (const char16_t*)__we, __wn,
- __buf, __buf+__sz, __bn);
- if (__r == codecvt_base::error || __wn == (const char16_t*)__wb)
- __throw_runtime_error("locale not supported");
- for (const char* __p = __buf; __p < __bn; ++__p, ++__s)
- *__s = *__p;
- __wb = (const _CharT*)__wn;
- }
- return __s;
- }
+struct _LIBCPP_EXPORTED_FROM_ABI __narrow_to_utf8<16> : public codecvt<char16_t, char, mbstate_t> {
+ _LIBCPP_HIDE_FROM_ABI __narrow_to_utf8() : codecvt<char16_t, char, mbstate_t>(1) {}
+ _LIBCPP_SUPPRESS_DEPRECATED_POP
+
+ ~__narrow_to_utf8() override;
+
+ template <class _OutputIterator, class _CharT>
+ _LIBCPP_HIDE_FROM_ABI _OutputIterator operator()(_OutputIterator __s, const _CharT* __wb, const _CharT* __we) const {
+ result __r = ok;
+ mbstate_t __mb;
+ while (__wb < __we && __r != error) {
+ const int __sz = 32;
+ char __buf[__sz];
+ char* __bn;
+ const char16_t* __wn = (const char16_t*)__wb;
+ __r = do_out(__mb, (const char16_t*)__wb, (const char16_t*)__we, __wn, __buf, __buf + __sz, __bn);
+ if (__r == codecvt_base::error || __wn == (const char16_t*)__wb)
+ __throw_runtime_error("locale not supported");
+ for (const char* __p = __buf; __p < __bn; ++__p, ++__s)
+ *__s = *__p;
+ __wb = (const _CharT*)__wn;
+ }
+ return __s;
+ }
};
_LIBCPP_SUPPRESS_DEPRECATED_PUSH
template <>
-struct _LIBCPP_EXPORTED_FROM_ABI __narrow_to_utf8<32>
- : public codecvt<char32_t, char, mbstate_t>
-{
- _LIBCPP_HIDE_FROM_ABI
- __narrow_to_utf8() : codecvt<char32_t, char, mbstate_t>(1) {}
-_LIBCPP_SUPPRESS_DEPRECATED_POP
-
- ~__narrow_to_utf8() override;
-
- template <class _OutputIterator, class _CharT>
- _LIBCPP_HIDE_FROM_ABI
- _OutputIterator
- operator()(_OutputIterator __s, const _CharT* __wb, const _CharT* __we) const
- {
- result __r = ok;
- mbstate_t __mb;
- while (__wb < __we && __r != error)
- {
- const int __sz = 32;
- char __buf[__sz];
- char* __bn;
- const char32_t* __wn = (const char32_t*)__wb;
- __r = do_out(__mb, (const char32_t*)__wb, (const char32_t*)__we, __wn,
- __buf, __buf+__sz, __bn);
- if (__r == codecvt_base::error || __wn == (const char32_t*)__wb)
- __throw_runtime_error("locale not supported");
- for (const char* __p = __buf; __p < __bn; ++__p, ++__s)
- *__s = *__p;
- __wb = (const _CharT*)__wn;
- }
- return __s;
- }
+struct _LIBCPP_EXPORTED_FROM_ABI __narrow_to_utf8<32> : public codecvt<char32_t, char, mbstate_t> {
+ _LIBCPP_HIDE_FROM_ABI __narrow_to_utf8() : codecvt<char32_t, char, mbstate_t>(1) {}
+ _LIBCPP_SUPPRESS_DEPRECATED_POP
+
+ ~__narrow_to_utf8() override;
+
+ template <class _OutputIterator, class _CharT>
+ _LIBCPP_HIDE_FROM_ABI _OutputIterator operator()(_OutputIterator __s, const _CharT* __wb, const _CharT* __we) const {
+ result __r = ok;
+ mbstate_t __mb;
+ while (__wb < __we && __r != error) {
+ const int __sz = 32;
+ char __buf[__sz];
+ char* __bn;
+ const char32_t* __wn = (const char32_t*)__wb;
+ __r = do_out(__mb, (const char32_t*)__wb, (const char32_t*)__we, __wn, __buf, __buf + __sz, __bn);
+ if (__r == codecvt_base::error || __wn == (const char32_t*)__wb)
+ __throw_runtime_error("locale not supported");
+ for (const char* __p = __buf; __p < __bn; ++__p, ++__s)
+ *__s = *__p;
+ __wb = (const _CharT*)__wn;
+ }
+ return __s;
+ }
};
template <size_t _Np>
-struct __widen_from_utf8
-{
- template <class _OutputIterator>
- _OutputIterator
- operator()(_OutputIterator __s, const char* __nb, const char* __ne) const;
+struct __widen_from_utf8 {
+ template <class _OutputIterator>
+ _OutputIterator operator()(_OutputIterator __s, const char* __nb, const char* __ne) const;
};
template <>
-struct __widen_from_utf8<8>
-{
- template <class _OutputIterator>
- _LIBCPP_HIDE_FROM_ABI
- _OutputIterator
- operator()(_OutputIterator __s, const char* __nb, const char* __ne) const
- {
- for (; __nb < __ne; ++__nb, ++__s)
- *__s = *__nb;
- return __s;
- }
+struct __widen_from_utf8<8> {
+ template <class _OutputIterator>
+ _LIBCPP_HIDE_FROM_ABI _OutputIterator operator()(_OutputIterator __s, const char* __nb, const char* __ne) const {
+ for (; __nb < __ne; ++__nb, ++__s)
+ *__s = *__nb;
+ return __s;
+ }
};
_LIBCPP_SUPPRESS_DEPRECATED_PUSH
template <>
-struct _LIBCPP_EXPORTED_FROM_ABI __widen_from_utf8<16>
- : public codecvt<char16_t, char, mbstate_t>
-{
- _LIBCPP_HIDE_FROM_ABI
- __widen_from_utf8() : codecvt<char16_t, char, mbstate_t>(1) {}
-_LIBCPP_SUPPRESS_DEPRECATED_POP
-
- ~__widen_from_utf8() override;
-
- template <class _OutputIterator>
- _LIBCPP_HIDE_FROM_ABI
- _OutputIterator
- operator()(_OutputIterator __s, const char* __nb, const char* __ne) const
- {
- result __r = ok;
- mbstate_t __mb;
- while (__nb < __ne && __r != error)
- {
- const int __sz = 32;
- char16_t __buf[__sz];
- char16_t* __bn;
- const char* __nn = __nb;
- __r = do_in(__mb, __nb, __ne - __nb > __sz ? __nb+__sz : __ne, __nn,
- __buf, __buf+__sz, __bn);
- if (__r == codecvt_base::error || __nn == __nb)
- __throw_runtime_error("locale not supported");
- for (const char16_t* __p = __buf; __p < __bn; ++__p, ++__s)
- *__s = *__p;
- __nb = __nn;
- }
- return __s;
- }
+struct _LIBCPP_EXPORTED_FROM_ABI __widen_from_utf8<16> : public codecvt<char16_t, char, mbstate_t> {
+ _LIBCPP_HIDE_FROM_ABI __widen_from_utf8() : codecvt<char16_t, char, mbstate_t>(1) {}
+ _LIBCPP_SUPPRESS_DEPRECATED_POP
+
+ ~__widen_from_utf8() override;
+
+ template <class _OutputIterator>
+ _LIBCPP_HIDE_FROM_ABI _OutputIterator operator()(_OutputIterator __s, const char* __nb, const char* __ne) const {
+ result __r = ok;
+ mbstate_t __mb;
+ while (__nb < __ne && __r != error) {
+ const int __sz = 32;
+ char16_t __buf[__sz];
+ char16_t* __bn;
+ const char* __nn = __nb;
+ __r = do_in(__mb, __nb, __ne - __nb > __sz ? __nb + __sz : __ne, __nn, __buf, __buf + __sz, __bn);
+ if (__r == codecvt_base::error || __nn == __nb)
+ __throw_runtime_error("locale not supported");
+ for (const char16_t* __p = __buf; __p < __bn; ++__p, ++__s)
+ *__s = *__p;
+ __nb = __nn;
+ }
+ return __s;
+ }
};
_LIBCPP_SUPPRESS_DEPRECATED_PUSH
template <>
-struct _LIBCPP_EXPORTED_FROM_ABI __widen_from_utf8<32>
- : public codecvt<char32_t, char, mbstate_t>
-{
- _LIBCPP_HIDE_FROM_ABI
- __widen_from_utf8() : codecvt<char32_t, char, mbstate_t>(1) {}
-_LIBCPP_SUPPRESS_DEPRECATED_POP
-
- ~__widen_from_utf8() override;
-
- template <class _OutputIterator>
- _LIBCPP_HIDE_FROM_ABI
- _OutputIterator
- operator()(_OutputIterator __s, const char* __nb, const char* __ne) const
- {
- result __r = ok;
- mbstate_t __mb;
- while (__nb < __ne && __r != error)
- {
- const int __sz = 32;
- char32_t __buf[__sz];
- char32_t* __bn;
- const char* __nn = __nb;
- __r = do_in(__mb, __nb, __ne - __nb > __sz ? __nb+__sz : __ne, __nn,
- __buf, __buf+__sz, __bn);
- if (__r == codecvt_base::error || __nn == __nb)
- __throw_runtime_error("locale not supported");
- for (const char32_t* __p = __buf; __p < __bn; ++__p, ++__s)
- *__s = *__p;
- __nb = __nn;
- }
- return __s;
- }
+struct _LIBCPP_EXPORTED_FROM_ABI __widen_from_utf8<32> : public codecvt<char32_t, char, mbstate_t> {
+ _LIBCPP_HIDE_FROM_ABI __widen_from_utf8() : codecvt<char32_t, char, mbstate_t>(1) {}
+ _LIBCPP_SUPPRESS_DEPRECATED_POP
+
+ ~__widen_from_utf8() override;
+
+ template <class _OutputIterator>
+ _LIBCPP_HIDE_FROM_ABI _OutputIterator operator()(_OutputIterator __s, const char* __nb, const char* __ne) const {
+ result __r = ok;
+ mbstate_t __mb;
+ while (__nb < __ne && __r != error) {
+ const int __sz = 32;
+ char32_t __buf[__sz];
+ char32_t* __bn;
+ const char* __nn = __nb;
+ __r = do_in(__mb, __nb, __ne - __nb > __sz ? __nb + __sz : __ne, __nn, __buf, __buf + __sz, __bn);
+ if (__r == codecvt_base::error || __nn == __nb)
+ __throw_runtime_error("locale not supported");
+ for (const char32_t* __p = __buf; __p < __bn; ++__p, ++__s)
+ *__s = *__p;
+ __nb = __nn;
+ }
+ return __s;
+ }
};
// template <class charT> class numpunct
-template <class _CharT> class _LIBCPP_TEMPLATE_VIS numpunct;
+template <class _CharT>
+class _LIBCPP_TEMPLATE_VIS numpunct;
template <>
-class _LIBCPP_EXPORTED_FROM_ABI numpunct<char>
- : public locale::facet
-{
+class _LIBCPP_EXPORTED_FROM_ABI numpunct<char> : public locale::facet {
public:
- typedef char char_type;
- typedef basic_string<char_type> string_type;
+ typedef char char_type;
+ typedef basic_string<char_type> string_type;
- explicit numpunct(size_t __refs = 0);
+ explicit numpunct(size_t __refs = 0);
- _LIBCPP_HIDE_FROM_ABI char_type decimal_point() const {return do_decimal_point();}
- _LIBCPP_HIDE_FROM_ABI char_type thousands_sep() const {return do_thousands_sep();}
- _LIBCPP_HIDE_FROM_ABI string grouping() const {return do_grouping();}
- _LIBCPP_HIDE_FROM_ABI string_type truename() const {return do_truename();}
- _LIBCPP_HIDE_FROM_ABI string_type falsename() const {return do_falsename();}
+ _LIBCPP_HIDE_FROM_ABI char_type decimal_point() const { return do_decimal_point(); }
+ _LIBCPP_HIDE_FROM_ABI char_type thousands_sep() const { return do_thousands_sep(); }
+ _LIBCPP_HIDE_FROM_ABI string grouping() const { return do_grouping(); }
+ _LIBCPP_HIDE_FROM_ABI string_type truename() const { return do_truename(); }
+ _LIBCPP_HIDE_FROM_ABI string_type falsename() const { return do_falsename(); }
- static locale::id id;
+ static locale::id id;
protected:
- ~numpunct() override;
- virtual char_type do_decimal_point() const;
- virtual char_type do_thousands_sep() const;
- virtual string do_grouping() const;
- virtual string_type do_truename() const;
- virtual string_type do_falsename() const;
-
- char_type __decimal_point_;
- char_type __thousands_sep_;
- string __grouping_;
+ ~numpunct() override;
+ virtual char_type do_decimal_point() const;
+ virtual char_type do_thousands_sep() const;
+ virtual string do_grouping() const;
+ virtual string_type do_truename() const;
+ virtual string_type do_falsename() const;
+
+ char_type __decimal_point_;
+ char_type __thousands_sep_;
+ string __grouping_;
};
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
template <>
-class _LIBCPP_EXPORTED_FROM_ABI numpunct<wchar_t>
- : public locale::facet
-{
+class _LIBCPP_EXPORTED_FROM_ABI numpunct<wchar_t> : public locale::facet {
public:
- typedef wchar_t char_type;
- typedef basic_string<char_type> string_type;
+ typedef wchar_t char_type;
+ typedef basic_string<char_type> string_type;
- explicit numpunct(size_t __refs = 0);
+ explicit numpunct(size_t __refs = 0);
- _LIBCPP_HIDE_FROM_ABI char_type decimal_point() const {return do_decimal_point();}
- _LIBCPP_HIDE_FROM_ABI char_type thousands_sep() const {return do_thousands_sep();}
- _LIBCPP_HIDE_FROM_ABI string grouping() const {return do_grouping();}
- _LIBCPP_HIDE_FROM_ABI string_type truename() const {return do_truename();}
- _LIBCPP_HIDE_FROM_ABI string_type falsename() const {return do_falsename();}
+ _LIBCPP_HIDE_FROM_ABI char_type decimal_point() const { return do_decimal_point(); }
+ _LIBCPP_HIDE_FROM_ABI char_type thousands_sep() const { return do_thousands_sep(); }
+ _LIBCPP_HIDE_FROM_ABI string grouping() const { return do_grouping(); }
+ _LIBCPP_HIDE_FROM_ABI string_type truename() const { return do_truename(); }
+ _LIBCPP_HIDE_FROM_ABI string_type falsename() const { return do_falsename(); }
- static locale::id id;
+ static locale::id id;
protected:
- ~numpunct() override;
- virtual char_type do_decimal_point() const;
- virtual char_type do_thousands_sep() const;
- virtual string do_grouping() const;
- virtual string_type do_truename() const;
- virtual string_type do_falsename() const;
-
- char_type __decimal_point_;
- char_type __thousands_sep_;
- string __grouping_;
+ ~numpunct() override;
+ virtual char_type do_decimal_point() const;
+ virtual char_type do_thousands_sep() const;
+ virtual string do_grouping() const;
+ virtual string_type do_truename() const;
+ virtual string_type do_falsename() const;
+
+ char_type __decimal_point_;
+ char_type __thousands_sep_;
+ string __grouping_;
};
#endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS
// template <class charT> class numpunct_byname
-template <class _CharT> class _LIBCPP_TEMPLATE_VIS numpunct_byname;
+template <class _CharT>
+class _LIBCPP_TEMPLATE_VIS numpunct_byname;
template <>
-class _LIBCPP_EXPORTED_FROM_ABI numpunct_byname<char>
-: public numpunct<char>
-{
+class _LIBCPP_EXPORTED_FROM_ABI numpunct_byname<char> : public numpunct<char> {
public:
- typedef char char_type;
- typedef basic_string<char_type> string_type;
+ typedef char char_type;
+ typedef basic_string<char_type> string_type;
- explicit numpunct_byname(const char* __nm, size_t __refs = 0);
- explicit numpunct_byname(const string& __nm, size_t __refs = 0);
+ explicit numpunct_byname(const char* __nm, size_t __refs = 0);
+ explicit numpunct_byname(const string& __nm, size_t __refs = 0);
protected:
- ~numpunct_byname() override;
+ ~numpunct_byname() override;
private:
- void __init(const char*);
+ void __init(const char*);
};
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
template <>
-class _LIBCPP_EXPORTED_FROM_ABI numpunct_byname<wchar_t>
-: public numpunct<wchar_t>
-{
+class _LIBCPP_EXPORTED_FROM_ABI numpunct_byname<wchar_t> : public numpunct<wchar_t> {
public:
- typedef wchar_t char_type;
- typedef basic_string<char_type> string_type;
+ typedef wchar_t char_type;
+ typedef basic_string<char_type> string_type;
- explicit numpunct_byname(const char* __nm, size_t __refs = 0);
- explicit numpunct_byname(const string& __nm, size_t __refs = 0);
+ explicit numpunct_byname(const char* __nm, size_t __refs = 0);
+ explicit numpunct_byname(const string& __nm, size_t __refs = 0);
protected:
- ~numpunct_byname() override;
+ ~numpunct_byname() override;
private:
- void __init(const char*);
+ void __init(const char*);
};
#endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS
diff --git a/contrib/llvm-project/libcxx/include/__locale_dir/locale_base_api/bsd_locale_defaults.h b/contrib/llvm-project/libcxx/include/__locale_dir/locale_base_api/bsd_locale_defaults.h
index 38d36f0aa8fc..1f9607209842 100644
--- a/contrib/llvm-project/libcxx/include/__locale_dir/locale_base_api/bsd_locale_defaults.h
+++ b/contrib/llvm-project/libcxx/include/__locale_dir/locale_base_api/bsd_locale_defaults.h
@@ -18,19 +18,19 @@
# pragma GCC system_header
#endif
-#define __libcpp_mb_cur_max_l(loc) MB_CUR_MAX_L(loc)
-#define __libcpp_btowc_l(ch, loc) btowc_l(ch, loc)
-#define __libcpp_wctob_l(wch, loc) wctob_l(wch, loc)
-#define __libcpp_wcsnrtombs_l(dst, src, nwc, len, ps, loc) wcsnrtombs_l(dst, src, nwc, len, ps, loc)
-#define __libcpp_wcrtomb_l(src, wc, ps, loc) wcrtomb_l(src, wc, ps, loc)
-#define __libcpp_mbsnrtowcs_l(dst, src, nms, len, ps, loc) mbsnrtowcs_l(dst, src, nms, len, ps, loc)
-#define __libcpp_mbrtowc_l(pwc, s, n, ps, l) mbrtowc_l(pwc, s, n, ps, l)
-#define __libcpp_mbtowc_l(pwc, pmb, max, l) mbtowc_l(pwc, pmb, max, l)
-#define __libcpp_mbrlen_l(s, n, ps, l) mbrlen_l(s, n, ps, l)
-#define __libcpp_localeconv_l(l) localeconv_l(l)
-#define __libcpp_mbsrtowcs_l(dest, src, len, ps, l) mbsrtowcs_l(dest, src, len, ps, l)
-#define __libcpp_snprintf_l(...) snprintf_l(__VA_ARGS__)
-#define __libcpp_asprintf_l(...) asprintf_l(__VA_ARGS__)
-#define __libcpp_sscanf_l(...) sscanf_l(__VA_ARGS__)
+#define __libcpp_mb_cur_max_l(loc) MB_CUR_MAX_L(loc)
+#define __libcpp_btowc_l(ch, loc) btowc_l(ch, loc)
+#define __libcpp_wctob_l(wch, loc) wctob_l(wch, loc)
+#define __libcpp_wcsnrtombs_l(dst, src, nwc, len, ps, loc) wcsnrtombs_l(dst, src, nwc, len, ps, loc)
+#define __libcpp_wcrtomb_l(src, wc, ps, loc) wcrtomb_l(src, wc, ps, loc)
+#define __libcpp_mbsnrtowcs_l(dst, src, nms, len, ps, loc) mbsnrtowcs_l(dst, src, nms, len, ps, loc)
+#define __libcpp_mbrtowc_l(pwc, s, n, ps, l) mbrtowc_l(pwc, s, n, ps, l)
+#define __libcpp_mbtowc_l(pwc, pmb, max, l) mbtowc_l(pwc, pmb, max, l)
+#define __libcpp_mbrlen_l(s, n, ps, l) mbrlen_l(s, n, ps, l)
+#define __libcpp_localeconv_l(l) localeconv_l(l)
+#define __libcpp_mbsrtowcs_l(dest, src, len, ps, l) mbsrtowcs_l(dest, src, len, ps, l)
+#define __libcpp_snprintf_l(...) snprintf_l(__VA_ARGS__)
+#define __libcpp_asprintf_l(...) asprintf_l(__VA_ARGS__)
+#define __libcpp_sscanf_l(...) sscanf_l(__VA_ARGS__)
#endif // _LIBCPP___LOCALE_LOCALE_BASE_API_BSD_LOCALE_DEFAULTS_H
diff --git a/contrib/llvm-project/libcxx/include/__locale_dir/locale_base_api/bsd_locale_fallbacks.h b/contrib/llvm-project/libcxx/include/__locale_dir/locale_base_api/bsd_locale_fallbacks.h
index 575a942125d4..76b94287cd6c 100644
--- a/contrib/llvm-project/libcxx/include/__locale_dir/locale_base_api/bsd_locale_fallbacks.h
+++ b/contrib/llvm-project/libcxx/include/__locale_dir/locale_base_api/bsd_locale_fallbacks.h
@@ -28,119 +28,97 @@
_LIBCPP_BEGIN_NAMESPACE_STD
-inline _LIBCPP_HIDE_FROM_ABI
-decltype(MB_CUR_MAX) __libcpp_mb_cur_max_l(locale_t __l)
-{
- __libcpp_locale_guard __current(__l);
- return MB_CUR_MAX;
+inline _LIBCPP_HIDE_FROM_ABI decltype(MB_CUR_MAX) __libcpp_mb_cur_max_l(locale_t __l) {
+ __libcpp_locale_guard __current(__l);
+ return MB_CUR_MAX;
}
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
-inline _LIBCPP_HIDE_FROM_ABI
-wint_t __libcpp_btowc_l(int __c, locale_t __l)
-{
- __libcpp_locale_guard __current(__l);
- return btowc(__c);
+inline _LIBCPP_HIDE_FROM_ABI wint_t __libcpp_btowc_l(int __c, locale_t __l) {
+ __libcpp_locale_guard __current(__l);
+ return btowc(__c);
}
-inline _LIBCPP_HIDE_FROM_ABI
-int __libcpp_wctob_l(wint_t __c, locale_t __l)
-{
- __libcpp_locale_guard __current(__l);
- return wctob(__c);
+inline _LIBCPP_HIDE_FROM_ABI int __libcpp_wctob_l(wint_t __c, locale_t __l) {
+ __libcpp_locale_guard __current(__l);
+ return wctob(__c);
}
-inline _LIBCPP_HIDE_FROM_ABI
-size_t __libcpp_wcsnrtombs_l(char *__dest, const wchar_t **__src, size_t __nwc,
- size_t __len, mbstate_t *__ps, locale_t __l)
-{
- __libcpp_locale_guard __current(__l);
- return wcsnrtombs(__dest, __src, __nwc, __len, __ps);
+inline _LIBCPP_HIDE_FROM_ABI size_t
+__libcpp_wcsnrtombs_l(char* __dest, const wchar_t** __src, size_t __nwc, size_t __len, mbstate_t* __ps, locale_t __l) {
+ __libcpp_locale_guard __current(__l);
+ return wcsnrtombs(__dest, __src, __nwc, __len, __ps);
}
-inline _LIBCPP_HIDE_FROM_ABI
-size_t __libcpp_wcrtomb_l(char *__s, wchar_t __wc, mbstate_t *__ps, locale_t __l)
-{
- __libcpp_locale_guard __current(__l);
- return wcrtomb(__s, __wc, __ps);
+inline _LIBCPP_HIDE_FROM_ABI size_t __libcpp_wcrtomb_l(char* __s, wchar_t __wc, mbstate_t* __ps, locale_t __l) {
+ __libcpp_locale_guard __current(__l);
+ return wcrtomb(__s, __wc, __ps);
}
-inline _LIBCPP_HIDE_FROM_ABI
-size_t __libcpp_mbsnrtowcs_l(wchar_t * __dest, const char **__src, size_t __nms,
- size_t __len, mbstate_t *__ps, locale_t __l)
-{
- __libcpp_locale_guard __current(__l);
- return mbsnrtowcs(__dest, __src, __nms, __len, __ps);
+inline _LIBCPP_HIDE_FROM_ABI size_t
+__libcpp_mbsnrtowcs_l(wchar_t* __dest, const char** __src, size_t __nms, size_t __len, mbstate_t* __ps, locale_t __l) {
+ __libcpp_locale_guard __current(__l);
+ return mbsnrtowcs(__dest, __src, __nms, __len, __ps);
}
-inline _LIBCPP_HIDE_FROM_ABI
-size_t __libcpp_mbrtowc_l(wchar_t *__pwc, const char *__s, size_t __n,
- mbstate_t *__ps, locale_t __l)
-{
- __libcpp_locale_guard __current(__l);
- return mbrtowc(__pwc, __s, __n, __ps);
+inline _LIBCPP_HIDE_FROM_ABI size_t
+__libcpp_mbrtowc_l(wchar_t* __pwc, const char* __s, size_t __n, mbstate_t* __ps, locale_t __l) {
+ __libcpp_locale_guard __current(__l);
+ return mbrtowc(__pwc, __s, __n, __ps);
}
-inline _LIBCPP_HIDE_FROM_ABI
-int __libcpp_mbtowc_l(wchar_t *__pwc, const char *__pmb, size_t __max, locale_t __l)
-{
- __libcpp_locale_guard __current(__l);
- return mbtowc(__pwc, __pmb, __max);
+inline _LIBCPP_HIDE_FROM_ABI int __libcpp_mbtowc_l(wchar_t* __pwc, const char* __pmb, size_t __max, locale_t __l) {
+ __libcpp_locale_guard __current(__l);
+ return mbtowc(__pwc, __pmb, __max);
}
-inline _LIBCPP_HIDE_FROM_ABI
-size_t __libcpp_mbrlen_l(const char *__s, size_t __n, mbstate_t *__ps, locale_t __l)
-{
- __libcpp_locale_guard __current(__l);
- return mbrlen(__s, __n, __ps);
+inline _LIBCPP_HIDE_FROM_ABI size_t __libcpp_mbrlen_l(const char* __s, size_t __n, mbstate_t* __ps, locale_t __l) {
+ __libcpp_locale_guard __current(__l);
+ return mbrlen(__s, __n, __ps);
}
#endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS
-inline _LIBCPP_HIDE_FROM_ABI
-lconv *__libcpp_localeconv_l(locale_t __l)
-{
- __libcpp_locale_guard __current(__l);
- return localeconv();
+inline _LIBCPP_HIDE_FROM_ABI lconv* __libcpp_localeconv_l(locale_t __l) {
+ __libcpp_locale_guard __current(__l);
+ return localeconv();
}
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
-inline _LIBCPP_HIDE_FROM_ABI
-size_t __libcpp_mbsrtowcs_l(wchar_t *__dest, const char **__src, size_t __len,
- mbstate_t *__ps, locale_t __l)
-{
- __libcpp_locale_guard __current(__l);
- return mbsrtowcs(__dest, __src, __len, __ps);
+inline _LIBCPP_HIDE_FROM_ABI size_t
+__libcpp_mbsrtowcs_l(wchar_t* __dest, const char** __src, size_t __len, mbstate_t* __ps, locale_t __l) {
+ __libcpp_locale_guard __current(__l);
+ return mbsrtowcs(__dest, __src, __len, __ps);
}
#endif
-inline _LIBCPP_ATTRIBUTE_FORMAT(__printf__, 4, 5)
-int __libcpp_snprintf_l(char *__s, size_t __n, locale_t __l, const char *__format, ...) {
- va_list __va;
- va_start(__va, __format);
- __libcpp_locale_guard __current(__l);
- int __res = vsnprintf(__s, __n, __format, __va);
- va_end(__va);
- return __res;
+inline _LIBCPP_ATTRIBUTE_FORMAT(__printf__, 4, 5) int __libcpp_snprintf_l(
+ char* __s, size_t __n, locale_t __l, const char* __format, ...) {
+ va_list __va;
+ va_start(__va, __format);
+ __libcpp_locale_guard __current(__l);
+ int __res = vsnprintf(__s, __n, __format, __va);
+ va_end(__va);
+ return __res;
}
-inline _LIBCPP_ATTRIBUTE_FORMAT(__printf__, 3, 4)
-int __libcpp_asprintf_l(char **__s, locale_t __l, const char *__format, ...) {
- va_list __va;
- va_start(__va, __format);
- __libcpp_locale_guard __current(__l);
- int __res = vasprintf(__s, __format, __va);
- va_end(__va);
- return __res;
+inline _LIBCPP_ATTRIBUTE_FORMAT(__printf__, 3, 4) int __libcpp_asprintf_l(
+ char** __s, locale_t __l, const char* __format, ...) {
+ va_list __va;
+ va_start(__va, __format);
+ __libcpp_locale_guard __current(__l);
+ int __res = vasprintf(__s, __format, __va);
+ va_end(__va);
+ return __res;
}
-inline _LIBCPP_ATTRIBUTE_FORMAT(__scanf__, 3, 4)
-int __libcpp_sscanf_l(const char *__s, locale_t __l, const char *__format, ...) {
- va_list __va;
- va_start(__va, __format);
- __libcpp_locale_guard __current(__l);
- int __res = vsscanf(__s, __format, __va);
- va_end(__va);
- return __res;
+inline _LIBCPP_ATTRIBUTE_FORMAT(__scanf__, 3, 4) int __libcpp_sscanf_l(
+ const char* __s, locale_t __l, const char* __format, ...) {
+ va_list __va;
+ va_start(__va, __format);
+ __libcpp_locale_guard __current(__l);
+ int __res = vsscanf(__s, __format, __va);
+ va_end(__va);
+ return __res;
}
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__locale_dir/locale_base_api/locale_guard.h b/contrib/llvm-project/libcxx/include/__locale_dir/locale_base_api/locale_guard.h
index efe674b5e7b3..b7e3be756e71 100644
--- a/contrib/llvm-project/libcxx/include/__locale_dir/locale_base_api/locale_guard.h
+++ b/contrib/llvm-project/libcxx/include/__locale_dir/locale_base_api/locale_guard.h
@@ -36,42 +36,41 @@ private:
};
#elif defined(_LIBCPP_MSVCRT_LIKE)
struct __libcpp_locale_guard {
- __libcpp_locale_guard(locale_t __l) :
- __status(_configthreadlocale(_ENABLE_PER_THREAD_LOCALE)) {
- // Setting the locale can be expensive even when the locale given is
- // already the current locale, so do an explicit check to see if the
- // current locale is already the one we want.
- const char* __lc = __setlocale(nullptr);
- // If every category is the same, the locale string will simply be the
- // locale name, otherwise it will be a semicolon-separated string listing
- // each category. In the second case, we know at least one category won't
- // be what we want, so we only have to check the first case.
- if (std::strcmp(__l.__get_locale(), __lc) != 0) {
- __locale_all = _strdup(__lc);
- if (__locale_all == nullptr)
- __throw_bad_alloc();
- __setlocale(__l.__get_locale());
- }
- }
- ~__libcpp_locale_guard() {
- // The CRT documentation doesn't explicitly say, but setlocale() does the
- // right thing when given a semicolon-separated list of locale settings
- // for the different categories in the same format as returned by
- // setlocale(LC_ALL, nullptr).
- if (__locale_all != nullptr) {
- __setlocale(__locale_all);
- free(__locale_all);
- }
- _configthreadlocale(__status);
- }
- static const char* __setlocale(const char* __locale) {
- const char* __new_locale = setlocale(LC_ALL, __locale);
- if (__new_locale == nullptr)
+ __libcpp_locale_guard(locale_t __l) : __status(_configthreadlocale(_ENABLE_PER_THREAD_LOCALE)) {
+ // Setting the locale can be expensive even when the locale given is
+ // already the current locale, so do an explicit check to see if the
+ // current locale is already the one we want.
+ const char* __lc = __setlocale(nullptr);
+ // If every category is the same, the locale string will simply be the
+ // locale name, otherwise it will be a semicolon-separated string listing
+ // each category. In the second case, we know at least one category won't
+ // be what we want, so we only have to check the first case.
+ if (std::strcmp(__l.__get_locale(), __lc) != 0) {
+ __locale_all = _strdup(__lc);
+ if (__locale_all == nullptr)
__throw_bad_alloc();
- return __new_locale;
+ __setlocale(__l.__get_locale());
+ }
+ }
+ ~__libcpp_locale_guard() {
+ // The CRT documentation doesn't explicitly say, but setlocale() does the
+ // right thing when given a semicolon-separated list of locale settings
+ // for the different categories in the same format as returned by
+ // setlocale(LC_ALL, nullptr).
+ if (__locale_all != nullptr) {
+ __setlocale(__locale_all);
+ free(__locale_all);
}
- int __status;
- char* __locale_all = nullptr;
+ _configthreadlocale(__status);
+ }
+ static const char* __setlocale(const char* __locale) {
+ const char* __new_locale = setlocale(LC_ALL, __locale);
+ if (__new_locale == nullptr)
+ __throw_bad_alloc();
+ return __new_locale;
+ }
+ int __status;
+ char* __locale_all = nullptr;
};
#endif
diff --git a/contrib/llvm-project/libcxx/include/__mbstate_t.h b/contrib/llvm-project/libcxx/include/__mbstate_t.h
index 2b9e719b1f2e..bfa6d617e2b8 100644
--- a/contrib/llvm-project/libcxx/include/__mbstate_t.h
+++ b/contrib/llvm-project/libcxx/include/__mbstate_t.h
@@ -36,19 +36,19 @@
#endif
#if defined(_LIBCPP_HAS_MUSL_LIBC)
-# define __NEED_mbstate_t
-# include <bits/alltypes.h>
-# undef __NEED_mbstate_t
+# define __NEED_mbstate_t
+# include <bits/alltypes.h>
+# undef __NEED_mbstate_t
#elif __has_include(<bits/types/mbstate_t.h>)
-# include <bits/types/mbstate_t.h> // works on most Unixes
+# include <bits/types/mbstate_t.h> // works on most Unixes
#elif __has_include(<sys/_types/_mbstate_t.h>)
-# include <sys/_types/_mbstate_t.h> // works on Darwin
+# include <sys/_types/_mbstate_t.h> // works on Darwin
#elif !defined(_LIBCPP_HAS_NO_WIDE_CHARACTERS) && __has_include_next(<wchar.h>)
-# include_next <wchar.h> // fall back to the C standard provider of mbstate_t
+# include_next <wchar.h> // fall back to the C standard provider of mbstate_t
#elif __has_include_next(<uchar.h>)
-# include_next <uchar.h> // <uchar.h> is also required to make mbstate_t visible
+# include_next <uchar.h> // <uchar.h> is also required to make mbstate_t visible
#else
-# error "We don't know how to get the definition of mbstate_t without <wchar.h> on your platform."
+# error "We don't know how to get the definition of mbstate_t without <wchar.h> on your platform."
#endif
#endif // _LIBCPP___MBSTATE_T_H
diff --git a/contrib/llvm-project/libcxx/include/__memory/addressof.h b/contrib/llvm-project/libcxx/include/__memory/addressof.h
index 7cb2065038a7..fa590212c49b 100644
--- a/contrib/llvm-project/libcxx/include/__memory/addressof.h
+++ b/contrib/llvm-project/libcxx/include/__memory/addressof.h
@@ -19,12 +19,8 @@
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _Tp>
-inline _LIBCPP_CONSTEXPR_SINCE_CXX17
-_LIBCPP_NO_CFI _LIBCPP_HIDE_FROM_ABI
-_Tp*
-addressof(_Tp& __x) _NOEXCEPT
-{
- return __builtin_addressof(__x);
+inline _LIBCPP_CONSTEXPR_SINCE_CXX17 _LIBCPP_NO_CFI _LIBCPP_HIDE_FROM_ABI _Tp* addressof(_Tp& __x) _NOEXCEPT {
+ return __builtin_addressof(__x);
}
#if defined(_LIBCPP_HAS_OBJC_ARC) && !defined(_LIBCPP_PREDEFINED_OBJC_ARC_ADDRESSOF)
@@ -33,42 +29,31 @@ addressof(_Tp& __x) _NOEXCEPT
// _LIBCPP_PREDEFINED_OBJC_ARC_ADDRESSOF is defined, the compiler
// itself is providing these definitions. Otherwise, we provide them.
template <class _Tp>
-inline _LIBCPP_HIDE_FROM_ABI
-__strong _Tp*
-addressof(__strong _Tp& __x) _NOEXCEPT
-{
+inline _LIBCPP_HIDE_FROM_ABI __strong _Tp* addressof(__strong _Tp& __x) _NOEXCEPT {
return &__x;
}
-#ifdef _LIBCPP_HAS_OBJC_ARC_WEAK
+# ifdef _LIBCPP_HAS_OBJC_ARC_WEAK
template <class _Tp>
-inline _LIBCPP_HIDE_FROM_ABI
-__weak _Tp*
-addressof(__weak _Tp& __x) _NOEXCEPT
-{
+inline _LIBCPP_HIDE_FROM_ABI __weak _Tp* addressof(__weak _Tp& __x) _NOEXCEPT {
return &__x;
}
-#endif
+# endif
template <class _Tp>
-inline _LIBCPP_HIDE_FROM_ABI
-__autoreleasing _Tp*
-addressof(__autoreleasing _Tp& __x) _NOEXCEPT
-{
+inline _LIBCPP_HIDE_FROM_ABI __autoreleasing _Tp* addressof(__autoreleasing _Tp& __x) _NOEXCEPT {
return &__x;
}
template <class _Tp>
-inline _LIBCPP_HIDE_FROM_ABI
-__unsafe_unretained _Tp*
-addressof(__unsafe_unretained _Tp& __x) _NOEXCEPT
-{
+inline _LIBCPP_HIDE_FROM_ABI __unsafe_unretained _Tp* addressof(__unsafe_unretained _Tp& __x) _NOEXCEPT {
return &__x;
}
#endif
#if !defined(_LIBCPP_CXX03_LANG)
-template <class _Tp> _Tp* addressof(const _Tp&&) noexcept = delete;
+template <class _Tp>
+_Tp* addressof(const _Tp&&) noexcept = delete;
#endif
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__memory/aligned_alloc.h b/contrib/llvm-project/libcxx/include/__memory/aligned_alloc.h
index 786963c72dfc..cb424328bcaf 100644
--- a/contrib/llvm-project/libcxx/include/__memory/aligned_alloc.h
+++ b/contrib/llvm-project/libcxx/include/__memory/aligned_alloc.h
@@ -27,36 +27,34 @@ _LIBCPP_BEGIN_NAMESPACE_STD
// chances are that you want to use `__libcpp_allocate` instead.
//
// Returns the allocated memory, or `nullptr` on failure.
-inline _LIBCPP_HIDE_FROM_ABI
-void* __libcpp_aligned_alloc(std::size_t __alignment, std::size_t __size) {
+inline _LIBCPP_HIDE_FROM_ABI void* __libcpp_aligned_alloc(std::size_t __alignment, std::size_t __size) {
# if defined(_LIBCPP_MSVCRT_LIKE)
- return ::_aligned_malloc(__size, __alignment);
+ return ::_aligned_malloc(__size, __alignment);
# elif _LIBCPP_STD_VER >= 17 && !defined(_LIBCPP_HAS_NO_C11_ALIGNED_ALLOC)
- // aligned_alloc() requires that __size is a multiple of __alignment,
- // but for C++ [new.delete.general], only states "if the value of an
- // alignment argument passed to any of these functions is not a valid
- // alignment value, the behavior is undefined".
- // To handle calls such as ::operator new(1, std::align_val_t(128)), we
- // round __size up to the next multiple of __alignment.
- size_t __rounded_size = (__size + __alignment - 1) & ~(__alignment - 1);
- // Rounding up could have wrapped around to zero, so we have to add another
- // max() ternary to the actual call site to avoid succeeded in that case.
- return ::aligned_alloc(__alignment, __size > __rounded_size ? __size : __rounded_size);
+ // aligned_alloc() requires that __size is a multiple of __alignment,
+ // but for C++ [new.delete.general], only states "if the value of an
+ // alignment argument passed to any of these functions is not a valid
+ // alignment value, the behavior is undefined".
+ // To handle calls such as ::operator new(1, std::align_val_t(128)), we
+ // round __size up to the next multiple of __alignment.
+ size_t __rounded_size = (__size + __alignment - 1) & ~(__alignment - 1);
+ // Rounding up could have wrapped around to zero, so we have to add another
+ // max() ternary to the actual call site to avoid succeeded in that case.
+ return ::aligned_alloc(__alignment, __size > __rounded_size ? __size : __rounded_size);
# else
- void* __result = nullptr;
- (void)::posix_memalign(&__result, __alignment, __size);
- // If posix_memalign fails, __result is unmodified so we still return `nullptr`.
- return __result;
+ void* __result = nullptr;
+ (void)::posix_memalign(&__result, __alignment, __size);
+ // If posix_memalign fails, __result is unmodified so we still return `nullptr`.
+ return __result;
# endif
}
-inline _LIBCPP_HIDE_FROM_ABI
-void __libcpp_aligned_free(void* __ptr) {
-#if defined(_LIBCPP_MSVCRT_LIKE)
+inline _LIBCPP_HIDE_FROM_ABI void __libcpp_aligned_free(void* __ptr) {
+# if defined(_LIBCPP_MSVCRT_LIKE)
::_aligned_free(__ptr);
-#else
+# else
::free(__ptr);
-#endif
+# endif
}
#endif // !_LIBCPP_HAS_NO_LIBRARY_ALIGNED_ALLOCATION
diff --git a/contrib/llvm-project/libcxx/include/__memory/allocate_at_least.h b/contrib/llvm-project/libcxx/include/__memory/allocate_at_least.h
index 8d8ad071e2c2..05cbdee82883 100644
--- a/contrib/llvm-project/libcxx/include/__memory/allocate_at_least.h
+++ b/contrib/llvm-project/libcxx/include/__memory/allocate_at_least.h
@@ -28,8 +28,8 @@ struct allocation_result {
_LIBCPP_CTAD_SUPPORTED_FOR_TYPE(allocation_result);
template <class _Alloc>
-[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr
-allocation_result<typename allocator_traits<_Alloc>::pointer> allocate_at_least(_Alloc& __alloc, size_t __n) {
+[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr allocation_result<typename allocator_traits<_Alloc>::pointer>
+allocate_at_least(_Alloc& __alloc, size_t __n) {
if constexpr (requires { __alloc.allocate_at_least(__n); }) {
return __alloc.allocate_at_least(__n);
} else {
@@ -38,8 +38,7 @@ allocation_result<typename allocator_traits<_Alloc>::pointer> allocate_at_least(
}
template <class _Alloc>
-[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr
-auto __allocate_at_least(_Alloc& __alloc, size_t __n) {
+[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto __allocate_at_least(_Alloc& __alloc, size_t __n) {
return std::allocate_at_least(__alloc, __n);
}
#else
@@ -51,7 +50,8 @@ struct __allocation_result {
template <class _Alloc>
_LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR
-__allocation_result<typename allocator_traits<_Alloc>::pointer> __allocate_at_least(_Alloc& __alloc, size_t __n) {
+ __allocation_result<typename allocator_traits<_Alloc>::pointer>
+ __allocate_at_least(_Alloc& __alloc, size_t __n) {
return {__alloc.allocate(__n), __n};
}
diff --git a/contrib/llvm-project/libcxx/include/__memory/allocation_guard.h b/contrib/llvm-project/libcxx/include/__memory/allocation_guard.h
index c36ce15397c0..cb870af7be67 100644
--- a/contrib/llvm-project/libcxx/include/__memory/allocation_guard.h
+++ b/contrib/llvm-project/libcxx/include/__memory/allocation_guard.h
@@ -44,69 +44,61 @@ _LIBCPP_BEGIN_NAMESPACE_STD
//
// This is similar to a unique_ptr, except it's easier to use with a
// custom allocator.
-template<class _Alloc>
+template <class _Alloc>
struct __allocation_guard {
- using _Pointer = typename allocator_traits<_Alloc>::pointer;
- using _Size = typename allocator_traits<_Alloc>::size_type;
-
- template<class _AllocT> // we perform the allocator conversion inside the constructor
- _LIBCPP_HIDE_FROM_ABI
- explicit __allocation_guard(_AllocT __alloc, _Size __n)
- : __alloc_(std::move(__alloc))
- , __n_(__n)
- , __ptr_(allocator_traits<_Alloc>::allocate(__alloc_, __n_)) // initialization order is important
- { }
-
- _LIBCPP_HIDE_FROM_ABI
- ~__allocation_guard() _NOEXCEPT {
- __destroy();
- }
-
- _LIBCPP_HIDE_FROM_ABI __allocation_guard(const __allocation_guard&) = delete;
- _LIBCPP_HIDE_FROM_ABI __allocation_guard(__allocation_guard&& __other) _NOEXCEPT
- : __alloc_(std::move(__other.__alloc_))
- , __n_(__other.__n_)
- , __ptr_(__other.__ptr_) {
+ using _Pointer = typename allocator_traits<_Alloc>::pointer;
+ using _Size = typename allocator_traits<_Alloc>::size_type;
+
+ template <class _AllocT> // we perform the allocator conversion inside the constructor
+ _LIBCPP_HIDE_FROM_ABI explicit __allocation_guard(_AllocT __alloc, _Size __n)
+ : __alloc_(std::move(__alloc)),
+ __n_(__n),
+ __ptr_(allocator_traits<_Alloc>::allocate(__alloc_, __n_)) // initialization order is important
+ {}
+
+ _LIBCPP_HIDE_FROM_ABI ~__allocation_guard() _NOEXCEPT { __destroy(); }
+
+ _LIBCPP_HIDE_FROM_ABI __allocation_guard(const __allocation_guard&) = delete;
+ _LIBCPP_HIDE_FROM_ABI __allocation_guard(__allocation_guard&& __other) _NOEXCEPT
+ : __alloc_(std::move(__other.__alloc_)),
+ __n_(__other.__n_),
+ __ptr_(__other.__ptr_) {
+ __other.__ptr_ = nullptr;
+ }
+
+ _LIBCPP_HIDE_FROM_ABI __allocation_guard& operator=(const __allocation_guard& __other) = delete;
+ _LIBCPP_HIDE_FROM_ABI __allocation_guard& operator=(__allocation_guard&& __other) _NOEXCEPT {
+ if (std::addressof(__other) != this) {
+ __destroy();
+
+ __alloc_ = std::move(__other.__alloc_);
+ __n_ = __other.__n_;
+ __ptr_ = __other.__ptr_;
__other.__ptr_ = nullptr;
}
- _LIBCPP_HIDE_FROM_ABI __allocation_guard& operator=(const __allocation_guard& __other) = delete;
- _LIBCPP_HIDE_FROM_ABI __allocation_guard& operator=(__allocation_guard&& __other) _NOEXCEPT {
- if (std::addressof(__other) != this) {
- __destroy();
+ return *this;
+ }
- __alloc_ = std::move(__other.__alloc_);
- __n_ = __other.__n_;
- __ptr_ = __other.__ptr_;
- __other.__ptr_ = nullptr;
- }
-
- return *this;
- }
+ _LIBCPP_HIDE_FROM_ABI _Pointer
+ __release_ptr() _NOEXCEPT { // not called __release() because it's a keyword in objective-c++
+ _Pointer __tmp = __ptr_;
+ __ptr_ = nullptr;
+ return __tmp;
+ }
- _LIBCPP_HIDE_FROM_ABI
- _Pointer __release_ptr() _NOEXCEPT { // not called __release() because it's a keyword in objective-c++
- _Pointer __tmp = __ptr_;
- __ptr_ = nullptr;
- return __tmp;
- }
-
- _LIBCPP_HIDE_FROM_ABI
- _Pointer __get() const _NOEXCEPT {
- return __ptr_;
- }
+ _LIBCPP_HIDE_FROM_ABI _Pointer __get() const _NOEXCEPT { return __ptr_; }
private:
- _LIBCPP_HIDE_FROM_ABI
- void __destroy() _NOEXCEPT {
- if (__ptr_ != nullptr) {
- allocator_traits<_Alloc>::deallocate(__alloc_, __ptr_, __n_);
- }
+ _LIBCPP_HIDE_FROM_ABI void __destroy() _NOEXCEPT {
+ if (__ptr_ != nullptr) {
+ allocator_traits<_Alloc>::deallocate(__alloc_, __ptr_, __n_);
}
+ }
- _Alloc __alloc_;
- _Size __n_;
- _Pointer __ptr_;
+ _Alloc __alloc_;
+ _Size __n_;
+ _Pointer __ptr_;
};
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__memory/allocator.h b/contrib/llvm-project/libcxx/include/__memory/allocator.h
index 7568da799782..747ce30d8fef 100644
--- a/contrib/llvm-project/libcxx/include/__memory/allocator.h
+++ b/contrib/llvm-project/libcxx/include/__memory/allocator.h
@@ -28,35 +28,42 @@
_LIBCPP_BEGIN_NAMESPACE_STD
-template <class _Tp> class allocator;
+template <class _Tp>
+class allocator;
#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_ALLOCATOR_VOID_SPECIALIZATION)
// These specializations shouldn't be marked _LIBCPP_DEPRECATED_IN_CXX17.
// Specializing allocator<void> is deprecated, but not using it.
template <>
-class _LIBCPP_TEMPLATE_VIS allocator<void>
-{
-#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_ALLOCATOR_MEMBERS)
-public:
- _LIBCPP_DEPRECATED_IN_CXX17 typedef void* pointer;
- _LIBCPP_DEPRECATED_IN_CXX17 typedef const void* const_pointer;
- _LIBCPP_DEPRECATED_IN_CXX17 typedef void value_type;
+class _LIBCPP_TEMPLATE_VIS allocator<void> {
+# if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_ALLOCATOR_MEMBERS)
- template <class _Up> struct _LIBCPP_DEPRECATED_IN_CXX17 rebind {typedef allocator<_Up> other;};
-#endif
+public:
+ _LIBCPP_DEPRECATED_IN_CXX17 typedef void* pointer;
+ _LIBCPP_DEPRECATED_IN_CXX17 typedef const void* const_pointer;
+ _LIBCPP_DEPRECATED_IN_CXX17 typedef void value_type;
+
+ template <class _Up>
+ struct _LIBCPP_DEPRECATED_IN_CXX17 rebind {
+ typedef allocator<_Up> other;
+ };
+# endif
};
template <>
-class _LIBCPP_TEMPLATE_VIS allocator<const void>
-{
-#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_ALLOCATOR_MEMBERS)
-public:
- _LIBCPP_DEPRECATED_IN_CXX17 typedef const void* pointer;
- _LIBCPP_DEPRECATED_IN_CXX17 typedef const void* const_pointer;
- _LIBCPP_DEPRECATED_IN_CXX17 typedef const void value_type;
+class _LIBCPP_TEMPLATE_VIS allocator<const void> {
+# if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_ALLOCATOR_MEMBERS)
- template <class _Up> struct _LIBCPP_DEPRECATED_IN_CXX17 rebind {typedef allocator<_Up> other;};
-#endif
+public:
+ _LIBCPP_DEPRECATED_IN_CXX17 typedef const void* pointer;
+ _LIBCPP_DEPRECATED_IN_CXX17 typedef const void* const_pointer;
+ _LIBCPP_DEPRECATED_IN_CXX17 typedef const void value_type;
+
+ template <class _Up>
+ struct _LIBCPP_DEPRECATED_IN_CXX17 rebind {
+ typedef allocator<_Up> other;
+ };
+# endif
};
#endif
@@ -73,12 +80,11 @@ public:
// By making those __non_trivial_if base classes unique, we work around this problem and
// it is safe to start deriving from __non_trivial_if in existing classes.
template <bool _Cond, class _Unique>
-struct __non_trivial_if { };
+struct __non_trivial_if {};
template <class _Unique>
struct __non_trivial_if<true, _Unique> {
- _LIBCPP_HIDE_FROM_ABI
- _LIBCPP_CONSTEXPR __non_trivial_if() _NOEXCEPT { }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR __non_trivial_if() _NOEXCEPT {}
};
// allocator
@@ -87,186 +93,169 @@ struct __non_trivial_if<true, _Unique> {
// allocator<void> trivial in C++20.
template <class _Tp>
-class _LIBCPP_TEMPLATE_VIS allocator
- : private __non_trivial_if<!is_void<_Tp>::value, allocator<_Tp> >
-{
- static_assert(!is_volatile<_Tp>::value, "std::allocator does not support volatile types");
+class _LIBCPP_TEMPLATE_VIS allocator : private __non_trivial_if<!is_void<_Tp>::value, allocator<_Tp> > {
+ static_assert(!is_volatile<_Tp>::value, "std::allocator does not support volatile types");
+
public:
- typedef size_t size_type;
- typedef ptrdiff_t difference_type;
- typedef _Tp value_type;
- typedef true_type propagate_on_container_move_assignment;
- typedef true_type is_always_equal;
-
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 allocator() _NOEXCEPT = default;
-
- template <class _Up>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- allocator(const allocator<_Up>&) _NOEXCEPT { }
-
- _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- _Tp* allocate(size_t __n) {
- if (__n > allocator_traits<allocator>::max_size(*this))
- __throw_bad_array_new_length();
- if (__libcpp_is_constant_evaluated()) {
- return static_cast<_Tp*>(::operator new(__n * sizeof(_Tp)));
- } else {
- return static_cast<_Tp*>(std::__libcpp_allocate(__n * sizeof(_Tp), _LIBCPP_ALIGNOF(_Tp)));
- }
+ typedef size_t size_type;
+ typedef ptrdiff_t difference_type;
+ typedef _Tp value_type;
+ typedef true_type propagate_on_container_move_assignment;
+ typedef true_type is_always_equal;
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 allocator() _NOEXCEPT = default;
+
+ template <class _Up>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 allocator(const allocator<_Up>&) _NOEXCEPT {}
+
+ _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _Tp* allocate(size_t __n) {
+ if (__n > allocator_traits<allocator>::max_size(*this))
+ __throw_bad_array_new_length();
+ if (__libcpp_is_constant_evaluated()) {
+ return static_cast<_Tp*>(::operator new(__n * sizeof(_Tp)));
+ } else {
+ return static_cast<_Tp*>(std::__libcpp_allocate(__n * sizeof(_Tp), _LIBCPP_ALIGNOF(_Tp)));
}
+ }
#if _LIBCPP_STD_VER >= 23
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr
- allocation_result<_Tp*> allocate_at_least(size_t __n) {
- return {allocate(__n), __n};
- }
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr allocation_result<_Tp*> allocate_at_least(size_t __n) {
+ return {allocate(__n), __n};
+ }
#endif
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- void deallocate(_Tp* __p, size_t __n) _NOEXCEPT {
- if (__libcpp_is_constant_evaluated()) {
- ::operator delete(__p);
- } else {
- std::__libcpp_deallocate((void*)__p, __n * sizeof(_Tp), _LIBCPP_ALIGNOF(_Tp));
- }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void deallocate(_Tp* __p, size_t __n) _NOEXCEPT {
+ if (__libcpp_is_constant_evaluated()) {
+ ::operator delete(__p);
+ } else {
+ std::__libcpp_deallocate((void*)__p, __n * sizeof(_Tp), _LIBCPP_ALIGNOF(_Tp));
}
+ }
- // C++20 Removed members
+ // C++20 Removed members
#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_ALLOCATOR_MEMBERS)
- _LIBCPP_DEPRECATED_IN_CXX17 typedef _Tp* pointer;
- _LIBCPP_DEPRECATED_IN_CXX17 typedef const _Tp* const_pointer;
- _LIBCPP_DEPRECATED_IN_CXX17 typedef _Tp& reference;
- _LIBCPP_DEPRECATED_IN_CXX17 typedef const _Tp& const_reference;
-
- template <class _Up>
- struct _LIBCPP_DEPRECATED_IN_CXX17 rebind {
- typedef allocator<_Up> other;
- };
-
- _LIBCPP_DEPRECATED_IN_CXX17 _LIBCPP_HIDE_FROM_ABI
- pointer address(reference __x) const _NOEXCEPT {
- return std::addressof(__x);
- }
- _LIBCPP_DEPRECATED_IN_CXX17 _LIBCPP_HIDE_FROM_ABI
- const_pointer address(const_reference __x) const _NOEXCEPT {
- return std::addressof(__x);
- }
-
- _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_HIDE_FROM_ABI _LIBCPP_DEPRECATED_IN_CXX17
- _Tp* allocate(size_t __n, const void*) {
- return allocate(__n);
- }
-
- _LIBCPP_DEPRECATED_IN_CXX17 _LIBCPP_HIDE_FROM_ABI size_type max_size() const _NOEXCEPT {
- return size_type(~0) / sizeof(_Tp);
- }
-
- template <class _Up, class... _Args>
- _LIBCPP_DEPRECATED_IN_CXX17 _LIBCPP_HIDE_FROM_ABI
- void construct(_Up* __p, _Args&&... __args) {
- ::new ((void*)__p) _Up(std::forward<_Args>(__args)...);
- }
-
- _LIBCPP_DEPRECATED_IN_CXX17 _LIBCPP_HIDE_FROM_ABI
- void destroy(pointer __p) {
- __p->~_Tp();
- }
+ _LIBCPP_DEPRECATED_IN_CXX17 typedef _Tp* pointer;
+ _LIBCPP_DEPRECATED_IN_CXX17 typedef const _Tp* const_pointer;
+ _LIBCPP_DEPRECATED_IN_CXX17 typedef _Tp& reference;
+ _LIBCPP_DEPRECATED_IN_CXX17 typedef const _Tp& const_reference;
+
+ template <class _Up>
+ struct _LIBCPP_DEPRECATED_IN_CXX17 rebind {
+ typedef allocator<_Up> other;
+ };
+
+ _LIBCPP_DEPRECATED_IN_CXX17 _LIBCPP_HIDE_FROM_ABI pointer address(reference __x) const _NOEXCEPT {
+ return std::addressof(__x);
+ }
+ _LIBCPP_DEPRECATED_IN_CXX17 _LIBCPP_HIDE_FROM_ABI const_pointer address(const_reference __x) const _NOEXCEPT {
+ return std::addressof(__x);
+ }
+
+ _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_HIDE_FROM_ABI _LIBCPP_DEPRECATED_IN_CXX17 _Tp*
+ allocate(size_t __n, const void*) {
+ return allocate(__n);
+ }
+
+ _LIBCPP_DEPRECATED_IN_CXX17 _LIBCPP_HIDE_FROM_ABI size_type max_size() const _NOEXCEPT {
+ return size_type(~0) / sizeof(_Tp);
+ }
+
+ template <class _Up, class... _Args>
+ _LIBCPP_DEPRECATED_IN_CXX17 _LIBCPP_HIDE_FROM_ABI void construct(_Up* __p, _Args&&... __args) {
+ ::new ((void*)__p) _Up(std::forward<_Args>(__args)...);
+ }
+
+ _LIBCPP_DEPRECATED_IN_CXX17 _LIBCPP_HIDE_FROM_ABI void destroy(pointer __p) { __p->~_Tp(); }
#endif
};
template <class _Tp>
class _LIBCPP_TEMPLATE_VIS allocator<const _Tp>
- : private __non_trivial_if<!is_void<_Tp>::value, allocator<const _Tp> >
-{
- static_assert(!is_volatile<_Tp>::value, "std::allocator does not support volatile types");
+ : private __non_trivial_if<!is_void<_Tp>::value, allocator<const _Tp> > {
+ static_assert(!is_volatile<_Tp>::value, "std::allocator does not support volatile types");
+
public:
- typedef size_t size_type;
- typedef ptrdiff_t difference_type;
- typedef const _Tp value_type;
- typedef true_type propagate_on_container_move_assignment;
- typedef true_type is_always_equal;
-
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 allocator() _NOEXCEPT = default;
-
- template <class _Up>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- allocator(const allocator<_Up>&) _NOEXCEPT { }
-
- _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- const _Tp* allocate(size_t __n) {
- if (__n > allocator_traits<allocator>::max_size(*this))
- __throw_bad_array_new_length();
- if (__libcpp_is_constant_evaluated()) {
- return static_cast<const _Tp*>(::operator new(__n * sizeof(_Tp)));
- } else {
- return static_cast<const _Tp*>(std::__libcpp_allocate(__n * sizeof(_Tp), _LIBCPP_ALIGNOF(_Tp)));
- }
+ typedef size_t size_type;
+ typedef ptrdiff_t difference_type;
+ typedef const _Tp value_type;
+ typedef true_type propagate_on_container_move_assignment;
+ typedef true_type is_always_equal;
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 allocator() _NOEXCEPT = default;
+
+ template <class _Up>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 allocator(const allocator<_Up>&) _NOEXCEPT {}
+
+ _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 const _Tp* allocate(size_t __n) {
+ if (__n > allocator_traits<allocator>::max_size(*this))
+ __throw_bad_array_new_length();
+ if (__libcpp_is_constant_evaluated()) {
+ return static_cast<const _Tp*>(::operator new(__n * sizeof(_Tp)));
+ } else {
+ return static_cast<const _Tp*>(std::__libcpp_allocate(__n * sizeof(_Tp), _LIBCPP_ALIGNOF(_Tp)));
}
+ }
#if _LIBCPP_STD_VER >= 23
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr
- allocation_result<const _Tp*> allocate_at_least(size_t __n) {
- return {allocate(__n), __n};
- }
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr allocation_result<const _Tp*> allocate_at_least(size_t __n) {
+ return {allocate(__n), __n};
+ }
#endif
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- void deallocate(const _Tp* __p, size_t __n) {
- if (__libcpp_is_constant_evaluated()) {
- ::operator delete(const_cast<_Tp*>(__p));
- } else {
- std::__libcpp_deallocate((void*) const_cast<_Tp *>(__p), __n * sizeof(_Tp), _LIBCPP_ALIGNOF(_Tp));
- }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void deallocate(const _Tp* __p, size_t __n) {
+ if (__libcpp_is_constant_evaluated()) {
+ ::operator delete(const_cast<_Tp*>(__p));
+ } else {
+ std::__libcpp_deallocate((void*)const_cast<_Tp*>(__p), __n * sizeof(_Tp), _LIBCPP_ALIGNOF(_Tp));
}
+ }
- // C++20 Removed members
+ // C++20 Removed members
#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_ALLOCATOR_MEMBERS)
- _LIBCPP_DEPRECATED_IN_CXX17 typedef const _Tp* pointer;
- _LIBCPP_DEPRECATED_IN_CXX17 typedef const _Tp* const_pointer;
- _LIBCPP_DEPRECATED_IN_CXX17 typedef const _Tp& reference;
- _LIBCPP_DEPRECATED_IN_CXX17 typedef const _Tp& const_reference;
-
- template <class _Up>
- struct _LIBCPP_DEPRECATED_IN_CXX17 rebind {
- typedef allocator<_Up> other;
- };
-
- _LIBCPP_DEPRECATED_IN_CXX17 _LIBCPP_HIDE_FROM_ABI
- const_pointer address(const_reference __x) const _NOEXCEPT {
- return std::addressof(__x);
- }
-
- _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_HIDE_FROM_ABI _LIBCPP_DEPRECATED_IN_CXX17
- const _Tp* allocate(size_t __n, const void*) {
- return allocate(__n);
- }
-
- _LIBCPP_DEPRECATED_IN_CXX17 _LIBCPP_HIDE_FROM_ABI size_type max_size() const _NOEXCEPT {
- return size_type(~0) / sizeof(_Tp);
- }
-
- template <class _Up, class... _Args>
- _LIBCPP_DEPRECATED_IN_CXX17 _LIBCPP_HIDE_FROM_ABI
- void construct(_Up* __p, _Args&&... __args) {
- ::new ((void*)__p) _Up(std::forward<_Args>(__args)...);
- }
-
- _LIBCPP_DEPRECATED_IN_CXX17 _LIBCPP_HIDE_FROM_ABI
- void destroy(pointer __p) {
- __p->~_Tp();
- }
+ _LIBCPP_DEPRECATED_IN_CXX17 typedef const _Tp* pointer;
+ _LIBCPP_DEPRECATED_IN_CXX17 typedef const _Tp* const_pointer;
+ _LIBCPP_DEPRECATED_IN_CXX17 typedef const _Tp& reference;
+ _LIBCPP_DEPRECATED_IN_CXX17 typedef const _Tp& const_reference;
+
+ template <class _Up>
+ struct _LIBCPP_DEPRECATED_IN_CXX17 rebind {
+ typedef allocator<_Up> other;
+ };
+
+ _LIBCPP_DEPRECATED_IN_CXX17 _LIBCPP_HIDE_FROM_ABI const_pointer address(const_reference __x) const _NOEXCEPT {
+ return std::addressof(__x);
+ }
+
+ _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_HIDE_FROM_ABI _LIBCPP_DEPRECATED_IN_CXX17 const _Tp*
+ allocate(size_t __n, const void*) {
+ return allocate(__n);
+ }
+
+ _LIBCPP_DEPRECATED_IN_CXX17 _LIBCPP_HIDE_FROM_ABI size_type max_size() const _NOEXCEPT {
+ return size_type(~0) / sizeof(_Tp);
+ }
+
+ template <class _Up, class... _Args>
+ _LIBCPP_DEPRECATED_IN_CXX17 _LIBCPP_HIDE_FROM_ABI void construct(_Up* __p, _Args&&... __args) {
+ ::new ((void*)__p) _Up(std::forward<_Args>(__args)...);
+ }
+
+ _LIBCPP_DEPRECATED_IN_CXX17 _LIBCPP_HIDE_FROM_ABI void destroy(pointer __p) { __p->~_Tp(); }
#endif
};
template <class _Tp, class _Up>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-bool operator==(const allocator<_Tp>&, const allocator<_Up>&) _NOEXCEPT {return true;}
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool
+operator==(const allocator<_Tp>&, const allocator<_Up>&) _NOEXCEPT {
+ return true;
+}
#if _LIBCPP_STD_VER <= 17
template <class _Tp, class _Up>
-inline _LIBCPP_HIDE_FROM_ABI
-bool operator!=(const allocator<_Tp>&, const allocator<_Up>&) _NOEXCEPT {return false;}
+inline _LIBCPP_HIDE_FROM_ABI bool operator!=(const allocator<_Tp>&, const allocator<_Up>&) _NOEXCEPT {
+ return false;
+}
#endif
diff --git a/contrib/llvm-project/libcxx/include/__memory/allocator_arg_t.h b/contrib/llvm-project/libcxx/include/__memory/allocator_arg_t.h
index 09a015acdf11..7e66da740cd4 100644
--- a/contrib/llvm-project/libcxx/include/__memory/allocator_arg_t.h
+++ b/contrib/llvm-project/libcxx/include/__memory/allocator_arg_t.h
@@ -23,7 +23,9 @@
_LIBCPP_BEGIN_NAMESPACE_STD
-struct _LIBCPP_TEMPLATE_VIS allocator_arg_t { explicit allocator_arg_t() = default; };
+struct _LIBCPP_TEMPLATE_VIS allocator_arg_t {
+ explicit allocator_arg_t() = default;
+};
#if _LIBCPP_STD_VER >= 17
inline constexpr allocator_arg_t allocator_arg = allocator_arg_t();
@@ -35,42 +37,35 @@ constexpr allocator_arg_t allocator_arg = allocator_arg_t();
// allocator construction
-template <class _Tp, class _Alloc, class ..._Args>
-struct __uses_alloc_ctor_imp
-{
- typedef _LIBCPP_NODEBUG __remove_cvref_t<_Alloc> _RawAlloc;
- static const bool __ua = uses_allocator<_Tp, _RawAlloc>::value;
- static const bool __ic =
- is_constructible<_Tp, allocator_arg_t, _Alloc, _Args...>::value;
- static const int value = __ua ? 2 - __ic : 0;
+template <class _Tp, class _Alloc, class... _Args>
+struct __uses_alloc_ctor_imp {
+ typedef _LIBCPP_NODEBUG __remove_cvref_t<_Alloc> _RawAlloc;
+ static const bool __ua = uses_allocator<_Tp, _RawAlloc>::value;
+ static const bool __ic = is_constructible<_Tp, allocator_arg_t, _Alloc, _Args...>::value;
+ static const int value = __ua ? 2 - __ic : 0;
};
-template <class _Tp, class _Alloc, class ..._Args>
-struct __uses_alloc_ctor
- : integral_constant<int, __uses_alloc_ctor_imp<_Tp, _Alloc, _Args...>::value>
- {};
+template <class _Tp, class _Alloc, class... _Args>
+struct __uses_alloc_ctor : integral_constant<int, __uses_alloc_ctor_imp<_Tp, _Alloc, _Args...>::value> {};
template <class _Tp, class _Allocator, class... _Args>
-inline _LIBCPP_HIDE_FROM_ABI
-void __user_alloc_construct_impl (integral_constant<int, 0>, _Tp *__storage, const _Allocator &, _Args &&... __args )
-{
- new (__storage) _Tp (std::forward<_Args>(__args)...);
+inline _LIBCPP_HIDE_FROM_ABI void
+__user_alloc_construct_impl(integral_constant<int, 0>, _Tp* __storage, const _Allocator&, _Args&&... __args) {
+ new (__storage) _Tp(std::forward<_Args>(__args)...);
}
// FIXME: This should have a version which takes a non-const alloc.
template <class _Tp, class _Allocator, class... _Args>
-inline _LIBCPP_HIDE_FROM_ABI
-void __user_alloc_construct_impl (integral_constant<int, 1>, _Tp *__storage, const _Allocator &__a, _Args &&... __args )
-{
- new (__storage) _Tp (allocator_arg, __a, std::forward<_Args>(__args)...);
+inline _LIBCPP_HIDE_FROM_ABI void
+__user_alloc_construct_impl(integral_constant<int, 1>, _Tp* __storage, const _Allocator& __a, _Args&&... __args) {
+ new (__storage) _Tp(allocator_arg, __a, std::forward<_Args>(__args)...);
}
// FIXME: This should have a version which takes a non-const alloc.
template <class _Tp, class _Allocator, class... _Args>
-inline _LIBCPP_HIDE_FROM_ABI
-void __user_alloc_construct_impl (integral_constant<int, 2>, _Tp *__storage, const _Allocator &__a, _Args &&... __args )
-{
- new (__storage) _Tp (std::forward<_Args>(__args)..., __a);
+inline _LIBCPP_HIDE_FROM_ABI void
+__user_alloc_construct_impl(integral_constant<int, 2>, _Tp* __storage, const _Allocator& __a, _Args&&... __args) {
+ new (__storage) _Tp(std::forward<_Args>(__args)..., __a);
}
#endif // _LIBCPP_CXX03_LANG
diff --git a/contrib/llvm-project/libcxx/include/__memory/allocator_destructor.h b/contrib/llvm-project/libcxx/include/__memory/allocator_destructor.h
index ea0ad9bec674..ed3d8918f5fe 100644
--- a/contrib/llvm-project/libcxx/include/__memory/allocator_destructor.h
+++ b/contrib/llvm-project/libcxx/include/__memory/allocator_destructor.h
@@ -19,22 +19,20 @@
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _Alloc>
-class __allocator_destructor
-{
- typedef _LIBCPP_NODEBUG allocator_traits<_Alloc> __alloc_traits;
+class __allocator_destructor {
+ typedef _LIBCPP_NODEBUG allocator_traits<_Alloc> __alloc_traits;
+
public:
- typedef _LIBCPP_NODEBUG typename __alloc_traits::pointer pointer;
- typedef _LIBCPP_NODEBUG typename __alloc_traits::size_type size_type;
+ typedef _LIBCPP_NODEBUG typename __alloc_traits::pointer pointer;
+ typedef _LIBCPP_NODEBUG typename __alloc_traits::size_type size_type;
+
private:
- _Alloc& __alloc_;
- size_type __s_;
+ _Alloc& __alloc_;
+ size_type __s_;
+
public:
- _LIBCPP_HIDE_FROM_ABI __allocator_destructor(_Alloc& __a, size_type __s)
- _NOEXCEPT
- : __alloc_(__a), __s_(__s) {}
- _LIBCPP_HIDE_FROM_ABI
- void operator()(pointer __p) _NOEXCEPT
- {__alloc_traits::deallocate(__alloc_, __p, __s_);}
+ _LIBCPP_HIDE_FROM_ABI __allocator_destructor(_Alloc& __a, size_type __s) _NOEXCEPT : __alloc_(__a), __s_(__s) {}
+ _LIBCPP_HIDE_FROM_ABI void operator()(pointer __p) _NOEXCEPT { __alloc_traits::deallocate(__alloc_, __p, __s_); }
};
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__memory/allocator_traits.h b/contrib/llvm-project/libcxx/include/__memory/allocator_traits.h
index c5db3e896fad..c4482872ea81 100644
--- a/contrib/llvm-project/libcxx/include/__memory/allocator_traits.h
+++ b/contrib/llvm-project/libcxx/include/__memory/allocator_traits.h
@@ -33,318 +33,312 @@ _LIBCPP_PUSH_MACROS
_LIBCPP_BEGIN_NAMESPACE_STD
-#define _LIBCPP_ALLOCATOR_TRAITS_HAS_XXX(NAME, PROPERTY) \
- template <class _Tp, class = void> struct NAME : false_type { }; \
- template <class _Tp> struct NAME<_Tp, __void_t<typename _Tp:: PROPERTY > > : true_type { }
+#define _LIBCPP_ALLOCATOR_TRAITS_HAS_XXX(NAME, PROPERTY) \
+ template <class _Tp, class = void> \
+ struct NAME : false_type {}; \
+ template <class _Tp> \
+ struct NAME<_Tp, __void_t<typename _Tp::PROPERTY > > : true_type {}
// __pointer
_LIBCPP_ALLOCATOR_TRAITS_HAS_XXX(__has_pointer, pointer);
-template <class _Tp, class _Alloc,
+template <class _Tp,
+ class _Alloc,
class _RawAlloc = __libcpp_remove_reference_t<_Alloc>,
- bool = __has_pointer<_RawAlloc>::value>
+ bool = __has_pointer<_RawAlloc>::value>
struct __pointer {
- using type _LIBCPP_NODEBUG = typename _RawAlloc::pointer;
+ using type _LIBCPP_NODEBUG = typename _RawAlloc::pointer;
};
template <class _Tp, class _Alloc, class _RawAlloc>
struct __pointer<_Tp, _Alloc, _RawAlloc, false> {
- using type _LIBCPP_NODEBUG = _Tp*;
+ using type _LIBCPP_NODEBUG = _Tp*;
};
// __const_pointer
_LIBCPP_ALLOCATOR_TRAITS_HAS_XXX(__has_const_pointer, const_pointer);
-template <class _Tp, class _Ptr, class _Alloc,
- bool = __has_const_pointer<_Alloc>::value>
+template <class _Tp, class _Ptr, class _Alloc, bool = __has_const_pointer<_Alloc>::value>
struct __const_pointer {
- using type _LIBCPP_NODEBUG = typename _Alloc::const_pointer;
+ using type _LIBCPP_NODEBUG = typename _Alloc::const_pointer;
};
template <class _Tp, class _Ptr, class _Alloc>
struct __const_pointer<_Tp, _Ptr, _Alloc, false> {
#ifdef _LIBCPP_CXX03_LANG
- using type = typename pointer_traits<_Ptr>::template rebind<const _Tp>::other;
+ using type = typename pointer_traits<_Ptr>::template rebind<const _Tp>::other;
#else
- using type _LIBCPP_NODEBUG = typename pointer_traits<_Ptr>::template rebind<const _Tp>;
+ using type _LIBCPP_NODEBUG = typename pointer_traits<_Ptr>::template rebind<const _Tp>;
#endif
};
// __void_pointer
_LIBCPP_ALLOCATOR_TRAITS_HAS_XXX(__has_void_pointer, void_pointer);
-template <class _Ptr, class _Alloc,
- bool = __has_void_pointer<_Alloc>::value>
+template <class _Ptr, class _Alloc, bool = __has_void_pointer<_Alloc>::value>
struct __void_pointer {
- using type _LIBCPP_NODEBUG = typename _Alloc::void_pointer;
+ using type _LIBCPP_NODEBUG = typename _Alloc::void_pointer;
};
template <class _Ptr, class _Alloc>
struct __void_pointer<_Ptr, _Alloc, false> {
#ifdef _LIBCPP_CXX03_LANG
- using type _LIBCPP_NODEBUG = typename pointer_traits<_Ptr>::template rebind<void>::other;
+ using type _LIBCPP_NODEBUG = typename pointer_traits<_Ptr>::template rebind<void>::other;
#else
- using type _LIBCPP_NODEBUG = typename pointer_traits<_Ptr>::template rebind<void>;
+ using type _LIBCPP_NODEBUG = typename pointer_traits<_Ptr>::template rebind<void>;
#endif
};
// __const_void_pointer
_LIBCPP_ALLOCATOR_TRAITS_HAS_XXX(__has_const_void_pointer, const_void_pointer);
-template <class _Ptr, class _Alloc,
- bool = __has_const_void_pointer<_Alloc>::value>
+template <class _Ptr, class _Alloc, bool = __has_const_void_pointer<_Alloc>::value>
struct __const_void_pointer {
- using type _LIBCPP_NODEBUG = typename _Alloc::const_void_pointer;
+ using type _LIBCPP_NODEBUG = typename _Alloc::const_void_pointer;
};
template <class _Ptr, class _Alloc>
struct __const_void_pointer<_Ptr, _Alloc, false> {
#ifdef _LIBCPP_CXX03_LANG
- using type _LIBCPP_NODEBUG = typename pointer_traits<_Ptr>::template rebind<const void>::other;
+ using type _LIBCPP_NODEBUG = typename pointer_traits<_Ptr>::template rebind<const void>::other;
#else
- using type _LIBCPP_NODEBUG = typename pointer_traits<_Ptr>::template rebind<const void>;
+ using type _LIBCPP_NODEBUG = typename pointer_traits<_Ptr>::template rebind<const void>;
#endif
};
// __size_type
_LIBCPP_ALLOCATOR_TRAITS_HAS_XXX(__has_size_type, size_type);
template <class _Alloc, class _DiffType, bool = __has_size_type<_Alloc>::value>
-struct __size_type : make_unsigned<_DiffType> { };
+struct __size_type : make_unsigned<_DiffType> {};
template <class _Alloc, class _DiffType>
struct __size_type<_Alloc, _DiffType, true> {
- using type _LIBCPP_NODEBUG = typename _Alloc::size_type;
+ using type _LIBCPP_NODEBUG = typename _Alloc::size_type;
};
// __alloc_traits_difference_type
_LIBCPP_ALLOCATOR_TRAITS_HAS_XXX(__has_alloc_traits_difference_type, difference_type);
template <class _Alloc, class _Ptr, bool = __has_alloc_traits_difference_type<_Alloc>::value>
struct __alloc_traits_difference_type {
- using type _LIBCPP_NODEBUG = typename pointer_traits<_Ptr>::difference_type;
+ using type _LIBCPP_NODEBUG = typename pointer_traits<_Ptr>::difference_type;
};
template <class _Alloc, class _Ptr>
struct __alloc_traits_difference_type<_Alloc, _Ptr, true> {
- using type _LIBCPP_NODEBUG = typename _Alloc::difference_type;
+ using type _LIBCPP_NODEBUG = typename _Alloc::difference_type;
};
// __propagate_on_container_copy_assignment
_LIBCPP_ALLOCATOR_TRAITS_HAS_XXX(__has_propagate_on_container_copy_assignment, propagate_on_container_copy_assignment);
template <class _Alloc, bool = __has_propagate_on_container_copy_assignment<_Alloc>::value>
-struct __propagate_on_container_copy_assignment : false_type { };
+struct __propagate_on_container_copy_assignment : false_type {};
template <class _Alloc>
struct __propagate_on_container_copy_assignment<_Alloc, true> {
- using type _LIBCPP_NODEBUG = typename _Alloc::propagate_on_container_copy_assignment;
+ using type _LIBCPP_NODEBUG = typename _Alloc::propagate_on_container_copy_assignment;
};
// __propagate_on_container_move_assignment
_LIBCPP_ALLOCATOR_TRAITS_HAS_XXX(__has_propagate_on_container_move_assignment, propagate_on_container_move_assignment);
template <class _Alloc, bool = __has_propagate_on_container_move_assignment<_Alloc>::value>
-struct __propagate_on_container_move_assignment : false_type { };
+struct __propagate_on_container_move_assignment : false_type {};
template <class _Alloc>
struct __propagate_on_container_move_assignment<_Alloc, true> {
- using type _LIBCPP_NODEBUG = typename _Alloc::propagate_on_container_move_assignment;
+ using type _LIBCPP_NODEBUG = typename _Alloc::propagate_on_container_move_assignment;
};
// __propagate_on_container_swap
_LIBCPP_ALLOCATOR_TRAITS_HAS_XXX(__has_propagate_on_container_swap, propagate_on_container_swap);
template <class _Alloc, bool = __has_propagate_on_container_swap<_Alloc>::value>
-struct __propagate_on_container_swap : false_type { };
+struct __propagate_on_container_swap : false_type {};
template <class _Alloc>
struct __propagate_on_container_swap<_Alloc, true> {
- using type _LIBCPP_NODEBUG = typename _Alloc::propagate_on_container_swap;
+ using type _LIBCPP_NODEBUG = typename _Alloc::propagate_on_container_swap;
};
// __is_always_equal
_LIBCPP_ALLOCATOR_TRAITS_HAS_XXX(__has_is_always_equal, is_always_equal);
template <class _Alloc, bool = __has_is_always_equal<_Alloc>::value>
-struct __is_always_equal : is_empty<_Alloc> { };
+struct __is_always_equal : is_empty<_Alloc> {};
template <class _Alloc>
struct __is_always_equal<_Alloc, true> {
- using type _LIBCPP_NODEBUG = typename _Alloc::is_always_equal;
+ using type _LIBCPP_NODEBUG = typename _Alloc::is_always_equal;
};
// __allocator_traits_rebind
_LIBCPP_SUPPRESS_DEPRECATED_PUSH
template <class _Tp, class _Up, class = void>
-struct __has_rebind_other : false_type { };
+struct __has_rebind_other : false_type {};
template <class _Tp, class _Up>
-struct __has_rebind_other<_Tp, _Up, __void_t<typename _Tp::template rebind<_Up>::other> > : true_type { };
+struct __has_rebind_other<_Tp, _Up, __void_t<typename _Tp::template rebind<_Up>::other> > : true_type {};
template <class _Tp, class _Up, bool = __has_rebind_other<_Tp, _Up>::value>
struct __allocator_traits_rebind {
static_assert(__has_rebind_other<_Tp, _Up>::value, "This allocator has to implement rebind");
using type _LIBCPP_NODEBUG = typename _Tp::template rebind<_Up>::other;
};
-template <template <class, class...> class _Alloc, class _Tp, class ..._Args, class _Up>
+template <template <class, class...> class _Alloc, class _Tp, class... _Args, class _Up>
struct __allocator_traits_rebind<_Alloc<_Tp, _Args...>, _Up, true> {
- using type _LIBCPP_NODEBUG = typename _Alloc<_Tp, _Args...>::template rebind<_Up>::other;
+ using type _LIBCPP_NODEBUG = typename _Alloc<_Tp, _Args...>::template rebind<_Up>::other;
};
-template <template <class, class...> class _Alloc, class _Tp, class ..._Args, class _Up>
+template <template <class, class...> class _Alloc, class _Tp, class... _Args, class _Up>
struct __allocator_traits_rebind<_Alloc<_Tp, _Args...>, _Up, false> {
- using type _LIBCPP_NODEBUG = _Alloc<_Up, _Args...>;
+ using type _LIBCPP_NODEBUG = _Alloc<_Up, _Args...>;
};
_LIBCPP_SUPPRESS_DEPRECATED_POP
-template<class _Alloc, class _Tp>
+template <class _Alloc, class _Tp>
using __allocator_traits_rebind_t = typename __allocator_traits_rebind<_Alloc, _Tp>::type;
_LIBCPP_SUPPRESS_DEPRECATED_PUSH
// __has_allocate_hint
template <class _Alloc, class _SizeType, class _ConstVoidPtr, class = void>
-struct __has_allocate_hint : false_type { };
+struct __has_allocate_hint : false_type {};
template <class _Alloc, class _SizeType, class _ConstVoidPtr>
-struct __has_allocate_hint<_Alloc, _SizeType, _ConstVoidPtr, decltype(
- (void)std::declval<_Alloc>().allocate(std::declval<_SizeType>(), std::declval<_ConstVoidPtr>())
-)> : true_type { };
+struct __has_allocate_hint<
+ _Alloc,
+ _SizeType,
+ _ConstVoidPtr,
+ decltype((void)std::declval<_Alloc>().allocate(std::declval<_SizeType>(), std::declval<_ConstVoidPtr>()))>
+ : true_type {};
// __has_construct
-template <class, class _Alloc, class ..._Args>
-struct __has_construct_impl : false_type { };
+template <class, class _Alloc, class... _Args>
+struct __has_construct_impl : false_type {};
-template <class _Alloc, class ..._Args>
-struct __has_construct_impl<decltype(
- (void)std::declval<_Alloc>().construct(std::declval<_Args>()...)
-), _Alloc, _Args...> : true_type { };
+template <class _Alloc, class... _Args>
+struct __has_construct_impl<decltype((void)std::declval<_Alloc>().construct(std::declval<_Args>()...)),
+ _Alloc,
+ _Args...> : true_type {};
-template <class _Alloc, class ..._Args>
-struct __has_construct : __has_construct_impl<void, _Alloc, _Args...> { };
+template <class _Alloc, class... _Args>
+struct __has_construct : __has_construct_impl<void, _Alloc, _Args...> {};
// __has_destroy
template <class _Alloc, class _Pointer, class = void>
-struct __has_destroy : false_type { };
+struct __has_destroy : false_type {};
template <class _Alloc, class _Pointer>
-struct __has_destroy<_Alloc, _Pointer, decltype(
- (void)std::declval<_Alloc>().destroy(std::declval<_Pointer>())
-)> : true_type { };
+struct __has_destroy<_Alloc, _Pointer, decltype((void)std::declval<_Alloc>().destroy(std::declval<_Pointer>()))>
+ : true_type {};
// __has_max_size
template <class _Alloc, class = void>
-struct __has_max_size : false_type { };
+struct __has_max_size : false_type {};
template <class _Alloc>
-struct __has_max_size<_Alloc, decltype(
- (void)std::declval<_Alloc&>().max_size()
-)> : true_type { };
+struct __has_max_size<_Alloc, decltype((void)std::declval<_Alloc&>().max_size())> : true_type {};
// __has_select_on_container_copy_construction
template <class _Alloc, class = void>
-struct __has_select_on_container_copy_construction : false_type { };
+struct __has_select_on_container_copy_construction : false_type {};
template <class _Alloc>
-struct __has_select_on_container_copy_construction<_Alloc, decltype(
- (void)std::declval<_Alloc>().select_on_container_copy_construction()
-)> : true_type { };
+struct __has_select_on_container_copy_construction<
+ _Alloc,
+ decltype((void)std::declval<_Alloc>().select_on_container_copy_construction())> : true_type {};
_LIBCPP_SUPPRESS_DEPRECATED_POP
template <class _Alloc>
-struct _LIBCPP_TEMPLATE_VIS allocator_traits
-{
- using allocator_type = _Alloc;
- using value_type = typename allocator_type::value_type;
- using pointer = typename __pointer<value_type, allocator_type>::type;
- using const_pointer = typename __const_pointer<value_type, pointer, allocator_type>::type;
- using void_pointer = typename __void_pointer<pointer, allocator_type>::type;
- using const_void_pointer = typename __const_void_pointer<pointer, allocator_type>::type;
- using difference_type = typename __alloc_traits_difference_type<allocator_type, pointer>::type;
- using size_type = typename __size_type<allocator_type, difference_type>::type;
- using propagate_on_container_copy_assignment = typename __propagate_on_container_copy_assignment<allocator_type>::type;
- using propagate_on_container_move_assignment = typename __propagate_on_container_move_assignment<allocator_type>::type;
- using propagate_on_container_swap = typename __propagate_on_container_swap<allocator_type>::type;
- using is_always_equal = typename __is_always_equal<allocator_type>::type;
+struct _LIBCPP_TEMPLATE_VIS allocator_traits {
+ using allocator_type = _Alloc;
+ using value_type = typename allocator_type::value_type;
+ using pointer = typename __pointer<value_type, allocator_type>::type;
+ using const_pointer = typename __const_pointer<value_type, pointer, allocator_type>::type;
+ using void_pointer = typename __void_pointer<pointer, allocator_type>::type;
+ using const_void_pointer = typename __const_void_pointer<pointer, allocator_type>::type;
+ using difference_type = typename __alloc_traits_difference_type<allocator_type, pointer>::type;
+ using size_type = typename __size_type<allocator_type, difference_type>::type;
+ using propagate_on_container_copy_assignment =
+ typename __propagate_on_container_copy_assignment<allocator_type>::type;
+ using propagate_on_container_move_assignment =
+ typename __propagate_on_container_move_assignment<allocator_type>::type;
+ using propagate_on_container_swap = typename __propagate_on_container_swap<allocator_type>::type;
+ using is_always_equal = typename __is_always_equal<allocator_type>::type;
#ifndef _LIBCPP_CXX03_LANG
- template <class _Tp>
- using rebind_alloc = __allocator_traits_rebind_t<allocator_type, _Tp>;
- template <class _Tp>
- using rebind_traits = allocator_traits<rebind_alloc<_Tp> >;
+ template <class _Tp>
+ using rebind_alloc = __allocator_traits_rebind_t<allocator_type, _Tp>;
+ template <class _Tp>
+ using rebind_traits = allocator_traits<rebind_alloc<_Tp> >;
#else // _LIBCPP_CXX03_LANG
- template <class _Tp>
- struct rebind_alloc {
- using other = __allocator_traits_rebind_t<allocator_type, _Tp>;
- };
- template <class _Tp>
- struct rebind_traits {
- using other = allocator_traits<typename rebind_alloc<_Tp>::other>;
- };
+ template <class _Tp>
+ struct rebind_alloc {
+ using other = __allocator_traits_rebind_t<allocator_type, _Tp>;
+ };
+ template <class _Tp>
+ struct rebind_traits {
+ using other = allocator_traits<typename rebind_alloc<_Tp>::other>;
+ };
#endif // _LIBCPP_CXX03_LANG
- _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- static pointer allocate(allocator_type& __a, size_type __n) {
- return __a.allocate(__n);
- }
-
- template <class _Ap = _Alloc, class =
- __enable_if_t<__has_allocate_hint<_Ap, size_type, const_void_pointer>::value> >
- _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- static pointer allocate(allocator_type& __a, size_type __n, const_void_pointer __hint) {
- _LIBCPP_SUPPRESS_DEPRECATED_PUSH
- return __a.allocate(__n, __hint);
- _LIBCPP_SUPPRESS_DEPRECATED_POP
- }
- template <class _Ap = _Alloc, class = void, class =
- __enable_if_t<!__has_allocate_hint<_Ap, size_type, const_void_pointer>::value> >
- _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- static pointer allocate(allocator_type& __a, size_type __n, const_void_pointer) {
- return __a.allocate(__n);
- }
-
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- static void deallocate(allocator_type& __a, pointer __p, size_type __n) _NOEXCEPT {
- __a.deallocate(__p, __n);
- }
-
- template <class _Tp, class... _Args, class =
- __enable_if_t<__has_construct<allocator_type, _Tp*, _Args...>::value> >
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- static void construct(allocator_type& __a, _Tp* __p, _Args&&... __args) {
- _LIBCPP_SUPPRESS_DEPRECATED_PUSH
- __a.construct(__p, std::forward<_Args>(__args)...);
- _LIBCPP_SUPPRESS_DEPRECATED_POP
- }
- template <class _Tp, class... _Args, class = void, class =
- __enable_if_t<!__has_construct<allocator_type, _Tp*, _Args...>::value> >
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- static void construct(allocator_type&, _Tp* __p, _Args&&... __args) {
- std::__construct_at(__p, std::forward<_Args>(__args)...);
- }
-
- template <class _Tp, class =
- __enable_if_t<__has_destroy<allocator_type, _Tp*>::value> >
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- static void destroy(allocator_type& __a, _Tp* __p) {
- _LIBCPP_SUPPRESS_DEPRECATED_PUSH
- __a.destroy(__p);
- _LIBCPP_SUPPRESS_DEPRECATED_POP
- }
- template <class _Tp, class = void, class =
- __enable_if_t<!__has_destroy<allocator_type, _Tp*>::value> >
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- static void destroy(allocator_type&, _Tp* __p) {
- std::__destroy_at(__p);
- }
-
- template <class _Ap = _Alloc, class =
- __enable_if_t<__has_max_size<const _Ap>::value> >
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- static size_type max_size(const allocator_type& __a) _NOEXCEPT {
- _LIBCPP_SUPPRESS_DEPRECATED_PUSH
- return __a.max_size();
- _LIBCPP_SUPPRESS_DEPRECATED_POP
- }
- template <class _Ap = _Alloc, class = void, class =
- __enable_if_t<!__has_max_size<const _Ap>::value> >
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- static size_type max_size(const allocator_type&) _NOEXCEPT {
- return numeric_limits<size_type>::max() / sizeof(value_type);
- }
-
- template <class _Ap = _Alloc, class =
- __enable_if_t<__has_select_on_container_copy_construction<const _Ap>::value> >
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- static allocator_type select_on_container_copy_construction(const allocator_type& __a) {
- return __a.select_on_container_copy_construction();
- }
- template <class _Ap = _Alloc, class = void, class =
- __enable_if_t<!__has_select_on_container_copy_construction<const _Ap>::value> >
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- static allocator_type select_on_container_copy_construction(const allocator_type& __a) {
- return __a;
- }
+ _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 static pointer
+ allocate(allocator_type& __a, size_type __n) {
+ return __a.allocate(__n);
+ }
+
+ template <class _Ap = _Alloc, class = __enable_if_t<__has_allocate_hint<_Ap, size_type, const_void_pointer>::value> >
+ _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 static pointer
+ allocate(allocator_type& __a, size_type __n, const_void_pointer __hint) {
+ _LIBCPP_SUPPRESS_DEPRECATED_PUSH
+ return __a.allocate(__n, __hint);
+ _LIBCPP_SUPPRESS_DEPRECATED_POP
+ }
+ template <class _Ap = _Alloc,
+ class = void,
+ class = __enable_if_t<!__has_allocate_hint<_Ap, size_type, const_void_pointer>::value> >
+ _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 static pointer
+ allocate(allocator_type& __a, size_type __n, const_void_pointer) {
+ return __a.allocate(__n);
+ }
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 static void
+ deallocate(allocator_type& __a, pointer __p, size_type __n) _NOEXCEPT {
+ __a.deallocate(__p, __n);
+ }
+
+ template <class _Tp, class... _Args, class = __enable_if_t<__has_construct<allocator_type, _Tp*, _Args...>::value> >
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 static void
+ construct(allocator_type& __a, _Tp* __p, _Args&&... __args) {
+ _LIBCPP_SUPPRESS_DEPRECATED_PUSH
+ __a.construct(__p, std::forward<_Args>(__args)...);
+ _LIBCPP_SUPPRESS_DEPRECATED_POP
+ }
+ template <class _Tp,
+ class... _Args,
+ class = void,
+ class = __enable_if_t<!__has_construct<allocator_type, _Tp*, _Args...>::value> >
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 static void
+ construct(allocator_type&, _Tp* __p, _Args&&... __args) {
+ std::__construct_at(__p, std::forward<_Args>(__args)...);
+ }
+
+ template <class _Tp, class = __enable_if_t<__has_destroy<allocator_type, _Tp*>::value> >
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 static void destroy(allocator_type& __a, _Tp* __p) {
+ _LIBCPP_SUPPRESS_DEPRECATED_PUSH
+ __a.destroy(__p);
+ _LIBCPP_SUPPRESS_DEPRECATED_POP
+ }
+ template <class _Tp, class = void, class = __enable_if_t<!__has_destroy<allocator_type, _Tp*>::value> >
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 static void destroy(allocator_type&, _Tp* __p) {
+ std::__destroy_at(__p);
+ }
+
+ template <class _Ap = _Alloc, class = __enable_if_t<__has_max_size<const _Ap>::value> >
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 static size_type max_size(const allocator_type& __a) _NOEXCEPT {
+ _LIBCPP_SUPPRESS_DEPRECATED_PUSH
+ return __a.max_size();
+ _LIBCPP_SUPPRESS_DEPRECATED_POP
+ }
+ template <class _Ap = _Alloc, class = void, class = __enable_if_t<!__has_max_size<const _Ap>::value> >
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 static size_type max_size(const allocator_type&) _NOEXCEPT {
+ return numeric_limits<size_type>::max() / sizeof(value_type);
+ }
+
+ template <class _Ap = _Alloc, class = __enable_if_t<__has_select_on_container_copy_construction<const _Ap>::value> >
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 static allocator_type
+ select_on_container_copy_construction(const allocator_type& __a) {
+ return __a.select_on_container_copy_construction();
+ }
+ template <class _Ap = _Alloc,
+ class = void,
+ class = __enable_if_t<!__has_select_on_container_copy_construction<const _Ap>::value> >
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 static allocator_type
+ select_on_container_copy_construction(const allocator_type& __a) {
+ return __a;
+ }
};
#ifndef _LIBCPP_CXX03_LANG
@@ -357,45 +351,42 @@ using __rebind_alloc = typename _Traits::template rebind_alloc<_Tp>::other;
// __is_default_allocator
template <class _Tp>
-struct __is_default_allocator : false_type { };
+struct __is_default_allocator : false_type {};
-template <class> class allocator;
+template <class>
+class allocator;
template <class _Tp>
-struct __is_default_allocator<allocator<_Tp> > : true_type { };
+struct __is_default_allocator<allocator<_Tp> > : true_type {};
// __is_cpp17_move_insertable
template <class _Alloc, class = void>
-struct __is_cpp17_move_insertable
- : is_move_constructible<typename _Alloc::value_type>
-{ };
+struct __is_cpp17_move_insertable : is_move_constructible<typename _Alloc::value_type> {};
template <class _Alloc>
-struct __is_cpp17_move_insertable<_Alloc, __enable_if_t<
- !__is_default_allocator<_Alloc>::value &&
- __has_construct<_Alloc, typename _Alloc::value_type*, typename _Alloc::value_type&&>::value
-> > : true_type { };
+struct __is_cpp17_move_insertable<
+ _Alloc,
+ __enable_if_t< !__is_default_allocator<_Alloc>::value &&
+ __has_construct<_Alloc, typename _Alloc::value_type*, typename _Alloc::value_type&&>::value > >
+ : true_type {};
// __is_cpp17_copy_insertable
template <class _Alloc, class = void>
struct __is_cpp17_copy_insertable
: integral_constant<bool,
- is_copy_constructible<typename _Alloc::value_type>::value &&
- __is_cpp17_move_insertable<_Alloc>::value
- >
-{ };
+ is_copy_constructible<typename _Alloc::value_type>::value &&
+ __is_cpp17_move_insertable<_Alloc>::value > {};
template <class _Alloc>
-struct __is_cpp17_copy_insertable<_Alloc, __enable_if_t<
- !__is_default_allocator<_Alloc>::value &&
- __has_construct<_Alloc, typename _Alloc::value_type*, const typename _Alloc::value_type&>::value
-> >
- : __is_cpp17_move_insertable<_Alloc>
-{ };
+struct __is_cpp17_copy_insertable<
+ _Alloc,
+ __enable_if_t< !__is_default_allocator<_Alloc>::value &&
+ __has_construct<_Alloc, typename _Alloc::value_type*, const typename _Alloc::value_type&>::value > >
+ : __is_cpp17_move_insertable<_Alloc> {};
// ASan choices
#ifndef _LIBCPP_HAS_NO_ASAN
-# define _LIBCPP_HAS_ASAN_CONTAINER_ANNOTATIONS_FOR_ALL_ALLOCATORS 1
+# define _LIBCPP_HAS_ASAN_CONTAINER_ANNOTATIONS_FOR_ALL_ALLOCATORS 1
#endif
#ifdef _LIBCPP_HAS_ASAN_CONTAINER_ANNOTATIONS_FOR_ALL_ALLOCATORS
diff --git a/contrib/llvm-project/libcxx/include/__memory/assume_aligned.h b/contrib/llvm-project/libcxx/include/__memory/assume_aligned.h
index bce00bf02a71..c66fb49ebb3c 100644
--- a/contrib/llvm-project/libcxx/include/__memory/assume_aligned.h
+++ b/contrib/llvm-project/libcxx/include/__memory/assume_aligned.h
@@ -24,8 +24,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
template <size_t _Np, class _Tp>
_LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _Tp* __assume_aligned(_Tp* __ptr) {
- static_assert(_Np != 0 && (_Np & (_Np - 1)) == 0,
- "std::assume_aligned<N>(p) requires N to be a power of two");
+ static_assert(_Np != 0 && (_Np & (_Np - 1)) == 0, "std::assume_aligned<N>(p) requires N to be a power of two");
if (__libcpp_is_constant_evaluated()) {
return __ptr;
diff --git a/contrib/llvm-project/libcxx/include/__memory/auto_ptr.h b/contrib/llvm-project/libcxx/include/__memory/auto_ptr.h
index 00a6329c178d..752143616bb2 100644
--- a/contrib/llvm-project/libcxx/include/__memory/auto_ptr.h
+++ b/contrib/llvm-project/libcxx/include/__memory/auto_ptr.h
@@ -21,60 +21,68 @@
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _Tp>
-struct _LIBCPP_DEPRECATED_IN_CXX11 auto_ptr_ref
-{
- _Tp* __ptr_;
+struct _LIBCPP_DEPRECATED_IN_CXX11 auto_ptr_ref {
+ _Tp* __ptr_;
};
-template<class _Tp>
-class _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX11 auto_ptr
-{
+template <class _Tp>
+class _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX11 auto_ptr {
private:
- _Tp* __ptr_;
+ _Tp* __ptr_;
+
public:
- typedef _Tp element_type;
+ typedef _Tp element_type;
- _LIBCPP_HIDE_FROM_ABI explicit auto_ptr(_Tp* __p = 0) _NOEXCEPT : __ptr_(__p) {}
- _LIBCPP_HIDE_FROM_ABI auto_ptr(auto_ptr& __p) _NOEXCEPT : __ptr_(__p.release()) {}
- template<class _Up> _LIBCPP_HIDE_FROM_ABI auto_ptr(auto_ptr<_Up>& __p) _NOEXCEPT
- : __ptr_(__p.release()) {}
- _LIBCPP_HIDE_FROM_ABI auto_ptr& operator=(auto_ptr& __p) _NOEXCEPT
- {reset(__p.release()); return *this;}
- template<class _Up> _LIBCPP_HIDE_FROM_ABI auto_ptr& operator=(auto_ptr<_Up>& __p) _NOEXCEPT
- {reset(__p.release()); return *this;}
- _LIBCPP_HIDE_FROM_ABI auto_ptr& operator=(auto_ptr_ref<_Tp> __p) _NOEXCEPT
- {reset(__p.__ptr_); return *this;}
- _LIBCPP_HIDE_FROM_ABI ~auto_ptr() _NOEXCEPT {delete __ptr_;}
+ _LIBCPP_HIDE_FROM_ABI explicit auto_ptr(_Tp* __p = 0) _NOEXCEPT : __ptr_(__p) {}
+ _LIBCPP_HIDE_FROM_ABI auto_ptr(auto_ptr& __p) _NOEXCEPT : __ptr_(__p.release()) {}
+ template <class _Up>
+ _LIBCPP_HIDE_FROM_ABI auto_ptr(auto_ptr<_Up>& __p) _NOEXCEPT : __ptr_(__p.release()) {}
+ _LIBCPP_HIDE_FROM_ABI auto_ptr& operator=(auto_ptr& __p) _NOEXCEPT {
+ reset(__p.release());
+ return *this;
+ }
+ template <class _Up>
+ _LIBCPP_HIDE_FROM_ABI auto_ptr& operator=(auto_ptr<_Up>& __p) _NOEXCEPT {
+ reset(__p.release());
+ return *this;
+ }
+ _LIBCPP_HIDE_FROM_ABI auto_ptr& operator=(auto_ptr_ref<_Tp> __p) _NOEXCEPT {
+ reset(__p.__ptr_);
+ return *this;
+ }
+ _LIBCPP_HIDE_FROM_ABI ~auto_ptr() _NOEXCEPT { delete __ptr_; }
- _LIBCPP_HIDE_FROM_ABI _Tp& operator*() const _NOEXCEPT
- {return *__ptr_;}
- _LIBCPP_HIDE_FROM_ABI _Tp* operator->() const _NOEXCEPT {return __ptr_;}
- _LIBCPP_HIDE_FROM_ABI _Tp* get() const _NOEXCEPT {return __ptr_;}
- _LIBCPP_HIDE_FROM_ABI _Tp* release() _NOEXCEPT
- {
- _Tp* __t = __ptr_;
- __ptr_ = nullptr;
- return __t;
- }
- _LIBCPP_HIDE_FROM_ABI void reset(_Tp* __p = 0) _NOEXCEPT
- {
- if (__ptr_ != __p)
- delete __ptr_;
- __ptr_ = __p;
- }
+ _LIBCPP_HIDE_FROM_ABI _Tp& operator*() const _NOEXCEPT { return *__ptr_; }
+ _LIBCPP_HIDE_FROM_ABI _Tp* operator->() const _NOEXCEPT { return __ptr_; }
+ _LIBCPP_HIDE_FROM_ABI _Tp* get() const _NOEXCEPT { return __ptr_; }
+ _LIBCPP_HIDE_FROM_ABI _Tp* release() _NOEXCEPT {
+ _Tp* __t = __ptr_;
+ __ptr_ = nullptr;
+ return __t;
+ }
+ _LIBCPP_HIDE_FROM_ABI void reset(_Tp* __p = 0) _NOEXCEPT {
+ if (__ptr_ != __p)
+ delete __ptr_;
+ __ptr_ = __p;
+ }
- _LIBCPP_HIDE_FROM_ABI auto_ptr(auto_ptr_ref<_Tp> __p) _NOEXCEPT : __ptr_(__p.__ptr_) {}
- template<class _Up> _LIBCPP_HIDE_FROM_ABI operator auto_ptr_ref<_Up>() _NOEXCEPT
- {auto_ptr_ref<_Up> __t; __t.__ptr_ = release(); return __t;}
- template<class _Up> _LIBCPP_HIDE_FROM_ABI operator auto_ptr<_Up>() _NOEXCEPT
- {return auto_ptr<_Up>(release());}
+ _LIBCPP_HIDE_FROM_ABI auto_ptr(auto_ptr_ref<_Tp> __p) _NOEXCEPT : __ptr_(__p.__ptr_) {}
+ template <class _Up>
+ _LIBCPP_HIDE_FROM_ABI operator auto_ptr_ref<_Up>() _NOEXCEPT {
+ auto_ptr_ref<_Up> __t;
+ __t.__ptr_ = release();
+ return __t;
+ }
+ template <class _Up>
+ _LIBCPP_HIDE_FROM_ABI operator auto_ptr<_Up>() _NOEXCEPT {
+ return auto_ptr<_Up>(release());
+ }
};
template <>
-class _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX11 auto_ptr<void>
-{
+class _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX11 auto_ptr<void> {
public:
- typedef void element_type;
+ typedef void element_type;
};
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__memory/builtin_new_allocator.h b/contrib/llvm-project/libcxx/include/__memory/builtin_new_allocator.h
index 348712c6d8d6..c6f7f3c5ff52 100644
--- a/contrib/llvm-project/libcxx/include/__memory/builtin_new_allocator.h
+++ b/contrib/llvm-project/libcxx/include/__memory/builtin_new_allocator.h
@@ -32,10 +32,10 @@ struct __builtin_new_allocator {
: __size_(__size), __align_(__align) {}
_LIBCPP_HIDE_FROM_ABI void operator()(void* __p) const _NOEXCEPT {
- std::__libcpp_deallocate(__p, __size_, __align_);
+ std::__libcpp_deallocate(__p, __size_, __align_);
}
- private:
+ private:
size_t __size_;
size_t __align_;
};
@@ -43,25 +43,22 @@ struct __builtin_new_allocator {
typedef unique_ptr<void, __builtin_new_deleter> __holder_t;
_LIBCPP_HIDE_FROM_ABI static __holder_t __allocate_bytes(size_t __s, size_t __align) {
- return __holder_t(std::__libcpp_allocate(__s, __align),
- __builtin_new_deleter(__s, __align));
+ return __holder_t(std::__libcpp_allocate(__s, __align), __builtin_new_deleter(__s, __align));
}
- _LIBCPP_HIDE_FROM_ABI static void __deallocate_bytes(void* __p, size_t __s,
- size_t __align) _NOEXCEPT {
- std::__libcpp_deallocate(__p, __s, __align);
+ _LIBCPP_HIDE_FROM_ABI static void __deallocate_bytes(void* __p, size_t __s, size_t __align) _NOEXCEPT {
+ std::__libcpp_deallocate(__p, __s, __align);
}
template <class _Tp>
- _LIBCPP_NODEBUG _LIBCPP_ALWAYS_INLINE
- _LIBCPP_HIDE_FROM_ABI static __holder_t __allocate_type(size_t __n) {
- return __allocate_bytes(__n * sizeof(_Tp), _LIBCPP_ALIGNOF(_Tp));
+ _LIBCPP_NODEBUG _LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI static __holder_t __allocate_type(size_t __n) {
+ return __allocate_bytes(__n * sizeof(_Tp), _LIBCPP_ALIGNOF(_Tp));
}
template <class _Tp>
- _LIBCPP_NODEBUG _LIBCPP_ALWAYS_INLINE
- _LIBCPP_HIDE_FROM_ABI static void __deallocate_type(void* __p, size_t __n) _NOEXCEPT {
- __deallocate_bytes(__p, __n * sizeof(_Tp), _LIBCPP_ALIGNOF(_Tp));
+ _LIBCPP_NODEBUG _LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI static void
+ __deallocate_type(void* __p, size_t __n) _NOEXCEPT {
+ __deallocate_bytes(__p, __n * sizeof(_Tp), _LIBCPP_ALIGNOF(_Tp));
}
};
diff --git a/contrib/llvm-project/libcxx/include/__memory/compressed_pair.h b/contrib/llvm-project/libcxx/include/__memory/compressed_pair.h
index f24b2bac5664..e9faada2f0b2 100644
--- a/contrib/llvm-project/libcxx/include/__memory/compressed_pair.h
+++ b/contrib/llvm-project/libcxx/include/__memory/compressed_pair.h
@@ -42,21 +42,21 @@ struct __value_init_tag {};
template <class _Tp, int _Idx, bool _CanBeEmptyBase = is_empty<_Tp>::value && !__libcpp_is_final<_Tp>::value>
struct __compressed_pair_elem {
- using _ParamT = _Tp;
- using reference = _Tp&;
+ using _ParamT = _Tp;
+ using reference = _Tp&;
using const_reference = const _Tp&;
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR explicit __compressed_pair_elem(__default_init_tag) {}
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR explicit __compressed_pair_elem(__value_init_tag) : __value_() {}
template <class _Up, class = __enable_if_t<!is_same<__compressed_pair_elem, __decay_t<_Up> >::value> >
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR
- explicit __compressed_pair_elem(_Up&& __u) : __value_(std::forward<_Up>(__u)) {}
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR explicit __compressed_pair_elem(_Up&& __u)
+ : __value_(std::forward<_Up>(__u)) {}
#ifndef _LIBCPP_CXX03_LANG
template <class... _Args, size_t... _Indices>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
- explicit __compressed_pair_elem(piecewise_construct_t, tuple<_Args...> __args, __tuple_indices<_Indices...>)
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 explicit __compressed_pair_elem(
+ piecewise_construct_t, tuple<_Args...> __args, __tuple_indices<_Indices...>)
: __value_(std::forward<_Args>(std::get<_Indices>(__args))...) {}
#endif
@@ -69,18 +69,18 @@ private:
template <class _Tp, int _Idx>
struct __compressed_pair_elem<_Tp, _Idx, true> : private _Tp {
- using _ParamT = _Tp;
- using reference = _Tp&;
+ using _ParamT = _Tp;
+ using reference = _Tp&;
using const_reference = const _Tp&;
- using __value_type = _Tp;
+ using __value_type = _Tp;
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR explicit __compressed_pair_elem() = default;
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR explicit __compressed_pair_elem(__default_init_tag) {}
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR explicit __compressed_pair_elem(__value_init_tag) : __value_type() {}
template <class _Up, class = __enable_if_t<!is_same<__compressed_pair_elem, __decay_t<_Up> >::value> >
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR
- explicit __compressed_pair_elem(_Up&& __u) : __value_type(std::forward<_Up>(__u)) {}
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR explicit __compressed_pair_elem(_Up&& __u)
+ : __value_type(std::forward<_Up>(__u)) {}
#ifndef _LIBCPP_CXX03_LANG
template <class... _Args, size_t... _Indices>
@@ -94,74 +94,63 @@ struct __compressed_pair_elem<_Tp, _Idx, true> : private _Tp {
};
template <class _T1, class _T2>
-class __compressed_pair : private __compressed_pair_elem<_T1, 0>,
- private __compressed_pair_elem<_T2, 1> {
+class __compressed_pair : private __compressed_pair_elem<_T1, 0>, private __compressed_pair_elem<_T2, 1> {
public:
// NOTE: This static assert should never fire because __compressed_pair
// is *almost never* used in a scenario where it's possible for T1 == T2.
// (The exception is std::function where it is possible that the function
// object and the allocator have the same type).
- static_assert((!is_same<_T1, _T2>::value),
- "__compressed_pair cannot be instantiated when T1 and T2 are the same type; "
- "The current implementation is NOT ABI-compatible with the previous implementation for this configuration");
+ static_assert(
+ (!is_same<_T1, _T2>::value),
+ "__compressed_pair cannot be instantiated when T1 and T2 are the same type; "
+ "The current implementation is NOT ABI-compatible with the previous implementation for this configuration");
using _Base1 _LIBCPP_NODEBUG = __compressed_pair_elem<_T1, 0>;
using _Base2 _LIBCPP_NODEBUG = __compressed_pair_elem<_T2, 1>;
template <bool _Dummy = true,
- class = __enable_if_t<
- __dependent_type<is_default_constructible<_T1>, _Dummy>::value &&
- __dependent_type<is_default_constructible<_T2>, _Dummy>::value
- >
- >
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR
- explicit __compressed_pair() : _Base1(__value_init_tag()), _Base2(__value_init_tag()) {}
+ class = __enable_if_t< __dependent_type<is_default_constructible<_T1>, _Dummy>::value &&
+ __dependent_type<is_default_constructible<_T2>, _Dummy>::value > >
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR explicit __compressed_pair()
+ : _Base1(__value_init_tag()), _Base2(__value_init_tag()) {}
template <class _U1, class _U2>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR
- explicit __compressed_pair(_U1&& __t1, _U2&& __t2) : _Base1(std::forward<_U1>(__t1)), _Base2(std::forward<_U2>(__t2)) {}
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR explicit __compressed_pair(_U1&& __t1, _U2&& __t2)
+ : _Base1(std::forward<_U1>(__t1)), _Base2(std::forward<_U2>(__t2)) {}
#ifndef _LIBCPP_CXX03_LANG
template <class... _Args1, class... _Args2>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
- explicit __compressed_pair(piecewise_construct_t __pc, tuple<_Args1...> __first_args,
- tuple<_Args2...> __second_args)
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 explicit __compressed_pair(
+ piecewise_construct_t __pc, tuple<_Args1...> __first_args, tuple<_Args2...> __second_args)
: _Base1(__pc, std::move(__first_args), typename __make_tuple_indices<sizeof...(_Args1)>::type()),
_Base2(__pc, std::move(__second_args), typename __make_tuple_indices<sizeof...(_Args2)>::type()) {}
#endif
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
- typename _Base1::reference first() _NOEXCEPT {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 typename _Base1::reference first() _NOEXCEPT {
return static_cast<_Base1&>(*this).__get();
}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR
- typename _Base1::const_reference first() const _NOEXCEPT {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR typename _Base1::const_reference first() const _NOEXCEPT {
return static_cast<_Base1 const&>(*this).__get();
}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
- typename _Base2::reference second() _NOEXCEPT {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 typename _Base2::reference second() _NOEXCEPT {
return static_cast<_Base2&>(*this).__get();
}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR
- typename _Base2::const_reference second() const _NOEXCEPT {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR typename _Base2::const_reference second() const _NOEXCEPT {
return static_cast<_Base2 const&>(*this).__get();
}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR static
- _Base1* __get_first_base(__compressed_pair* __pair) _NOEXCEPT {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR static _Base1* __get_first_base(__compressed_pair* __pair) _NOEXCEPT {
return static_cast<_Base1*>(__pair);
}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR static
- _Base2* __get_second_base(__compressed_pair* __pair) _NOEXCEPT {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR static _Base2* __get_second_base(__compressed_pair* __pair) _NOEXCEPT {
return static_cast<_Base2*>(__pair);
}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
- void swap(__compressed_pair& __x)
- _NOEXCEPT_(__is_nothrow_swappable<_T1>::value && __is_nothrow_swappable<_T2>::value) {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 void swap(__compressed_pair& __x)
+ _NOEXCEPT_(__is_nothrow_swappable<_T1>::value&& __is_nothrow_swappable<_T2>::value) {
using std::swap;
swap(first(), __x.first());
swap(second(), __x.second());
@@ -169,9 +158,9 @@ public:
};
template <class _T1, class _T2>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
-void swap(__compressed_pair<_T1, _T2>& __x, __compressed_pair<_T1, _T2>& __y)
- _NOEXCEPT_(__is_nothrow_swappable<_T1>::value && __is_nothrow_swappable<_T2>::value) {
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 void
+swap(__compressed_pair<_T1, _T2>& __x, __compressed_pair<_T1, _T2>& __y)
+ _NOEXCEPT_(__is_nothrow_swappable<_T1>::value&& __is_nothrow_swappable<_T2>::value) {
__x.swap(__y);
}
diff --git a/contrib/llvm-project/libcxx/include/__memory/concepts.h b/contrib/llvm-project/libcxx/include/__memory/concepts.h
index 97cc3583ec96..216144aad748 100644
--- a/contrib/llvm-project/libcxx/include/__memory/concepts.h
+++ b/contrib/llvm-project/libcxx/include/__memory/concepts.h
@@ -37,8 +37,7 @@ namespace ranges {
// at the address pointed-to by the iterator, which requires an lvalue.
template <class _Ip>
concept __nothrow_input_iterator =
- input_iterator<_Ip> &&
- is_lvalue_reference_v<iter_reference_t<_Ip>> &&
+ input_iterator<_Ip> && is_lvalue_reference_v<iter_reference_t<_Ip>> &&
same_as<remove_cvref_t<iter_reference_t<_Ip>>, iter_value_t<_Ip>>;
template <class _Sp, class _Ip>
@@ -46,20 +45,14 @@ concept __nothrow_sentinel_for = sentinel_for<_Sp, _Ip>;
template <class _Rp>
concept __nothrow_input_range =
- range<_Rp> &&
- __nothrow_input_iterator<iterator_t<_Rp>> &&
- __nothrow_sentinel_for<sentinel_t<_Rp>, iterator_t<_Rp>>;
+ range<_Rp> && __nothrow_input_iterator<iterator_t<_Rp>> && __nothrow_sentinel_for<sentinel_t<_Rp>, iterator_t<_Rp>>;
template <class _Ip>
concept __nothrow_forward_iterator =
- __nothrow_input_iterator<_Ip> &&
- forward_iterator<_Ip> &&
- __nothrow_sentinel_for<_Ip, _Ip>;
+ __nothrow_input_iterator<_Ip> && forward_iterator<_Ip> && __nothrow_sentinel_for<_Ip, _Ip>;
template <class _Rp>
-concept __nothrow_forward_range =
- __nothrow_input_range<_Rp> &&
- __nothrow_forward_iterator<iterator_t<_Rp>>;
+concept __nothrow_forward_range = __nothrow_input_range<_Rp> && __nothrow_forward_iterator<iterator_t<_Rp>>;
} // namespace ranges
diff --git a/contrib/llvm-project/libcxx/include/__memory/construct_at.h b/contrib/llvm-project/libcxx/include/__memory/construct_at.h
index 6797a3862973..91d17134db01 100644
--- a/contrib/llvm-project/libcxx/include/__memory/construct_at.h
+++ b/contrib/llvm-project/libcxx/include/__memory/construct_at.h
@@ -59,71 +59,64 @@ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR _Tp* __construct_at(_Tp* __location, _Ar
// taking an array).
template <class _ForwardIterator>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-_ForwardIterator __destroy(_ForwardIterator, _ForwardIterator);
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _ForwardIterator __destroy(_ForwardIterator, _ForwardIterator);
template <class _Tp, __enable_if_t<!is_array<_Tp>::value, int> = 0>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-void __destroy_at(_Tp* __loc) {
- _LIBCPP_ASSERT_NON_NULL(__loc != nullptr, "null pointer given to destroy_at");
- __loc->~_Tp();
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __destroy_at(_Tp* __loc) {
+ _LIBCPP_ASSERT_NON_NULL(__loc != nullptr, "null pointer given to destroy_at");
+ __loc->~_Tp();
}
#if _LIBCPP_STD_VER >= 20
template <class _Tp, __enable_if_t<is_array<_Tp>::value, int> = 0>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-void __destroy_at(_Tp* __loc) {
- _LIBCPP_ASSERT_NON_NULL(__loc != nullptr, "null pointer given to destroy_at");
- std::__destroy(std::begin(*__loc), std::end(*__loc));
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __destroy_at(_Tp* __loc) {
+ _LIBCPP_ASSERT_NON_NULL(__loc != nullptr, "null pointer given to destroy_at");
+ std::__destroy(std::begin(*__loc), std::end(*__loc));
}
#endif
template <class _ForwardIterator>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-_ForwardIterator __destroy(_ForwardIterator __first, _ForwardIterator __last) {
- for (; __first != __last; ++__first)
- std::__destroy_at(std::addressof(*__first));
- return __first;
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _ForwardIterator
+__destroy(_ForwardIterator __first, _ForwardIterator __last) {
+ for (; __first != __last; ++__first)
+ std::__destroy_at(std::addressof(*__first));
+ return __first;
}
template <class _BidirectionalIterator>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-_BidirectionalIterator __reverse_destroy(_BidirectionalIterator __first, _BidirectionalIterator __last) {
- while (__last != __first) {
- --__last;
- std::__destroy_at(std::addressof(*__last));
- }
- return __last;
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _BidirectionalIterator
+__reverse_destroy(_BidirectionalIterator __first, _BidirectionalIterator __last) {
+ while (__last != __first) {
+ --__last;
+ std::__destroy_at(std::addressof(*__last));
+ }
+ return __last;
}
#if _LIBCPP_STD_VER >= 17
template <class _Tp, enable_if_t<!is_array_v<_Tp>, int> = 0>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-void destroy_at(_Tp* __loc) {
- std::__destroy_at(__loc);
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void destroy_at(_Tp* __loc) {
+ std::__destroy_at(__loc);
}
-#if _LIBCPP_STD_VER >= 20
+# if _LIBCPP_STD_VER >= 20
template <class _Tp, enable_if_t<is_array_v<_Tp>, int> = 0>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-void destroy_at(_Tp* __loc) {
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void destroy_at(_Tp* __loc) {
std::__destroy_at(__loc);
}
-#endif
+# endif
template <class _ForwardIterator>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-void destroy(_ForwardIterator __first, _ForwardIterator __last) {
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void destroy(_ForwardIterator __first, _ForwardIterator __last) {
(void)std::__destroy(std::move(__first), std::move(__last));
}
template <class _ForwardIterator, class _Size>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-_ForwardIterator destroy_n(_ForwardIterator __first, _Size __n) {
- for (; __n > 0; (void)++__first, --__n)
- std::__destroy_at(std::addressof(*__first));
- return __first;
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _ForwardIterator destroy_n(_ForwardIterator __first, _Size __n) {
+ for (; __n > 0; (void)++__first, --__n)
+ std::__destroy_at(std::addressof(*__first));
+ return __first;
}
#endif // _LIBCPP_STD_VER >= 17
diff --git a/contrib/llvm-project/libcxx/include/__memory/destruct_n.h b/contrib/llvm-project/libcxx/include/__memory/destruct_n.h
index 3a0ad9218af1..78635ad0af04 100644
--- a/contrib/llvm-project/libcxx/include/__memory/destruct_n.h
+++ b/contrib/llvm-project/libcxx/include/__memory/destruct_n.h
@@ -20,43 +20,42 @@
_LIBCPP_BEGIN_NAMESPACE_STD
-struct __destruct_n
-{
+struct __destruct_n {
private:
- size_t __size_;
+ size_t __size_;
- template <class _Tp>
- _LIBCPP_HIDE_FROM_ABI void __process(_Tp* __p, false_type) _NOEXCEPT
- {for (size_t __i = 0; __i < __size_; ++__i, ++__p) __p->~_Tp();}
+ template <class _Tp>
+ _LIBCPP_HIDE_FROM_ABI void __process(_Tp* __p, false_type) _NOEXCEPT {
+ for (size_t __i = 0; __i < __size_; ++__i, ++__p)
+ __p->~_Tp();
+ }
- template <class _Tp>
- _LIBCPP_HIDE_FROM_ABI void __process(_Tp*, true_type) _NOEXCEPT
- {}
+ template <class _Tp>
+ _LIBCPP_HIDE_FROM_ABI void __process(_Tp*, true_type) _NOEXCEPT {}
- _LIBCPP_HIDE_FROM_ABI void __incr(false_type) _NOEXCEPT
- {++__size_;}
- _LIBCPP_HIDE_FROM_ABI void __incr(true_type) _NOEXCEPT
- {}
+ _LIBCPP_HIDE_FROM_ABI void __incr(false_type) _NOEXCEPT { ++__size_; }
+ _LIBCPP_HIDE_FROM_ABI void __incr(true_type) _NOEXCEPT {}
- _LIBCPP_HIDE_FROM_ABI void __set(size_t __s, false_type) _NOEXCEPT
- {__size_ = __s;}
- _LIBCPP_HIDE_FROM_ABI void __set(size_t, true_type) _NOEXCEPT
- {}
-public:
- _LIBCPP_HIDE_FROM_ABI explicit __destruct_n(size_t __s) _NOEXCEPT
- : __size_(__s) {}
-
- template <class _Tp>
- _LIBCPP_HIDE_FROM_ABI void __incr() _NOEXCEPT
- {__incr(integral_constant<bool, is_trivially_destructible<_Tp>::value>());}
+ _LIBCPP_HIDE_FROM_ABI void __set(size_t __s, false_type) _NOEXCEPT { __size_ = __s; }
+ _LIBCPP_HIDE_FROM_ABI void __set(size_t, true_type) _NOEXCEPT {}
- template <class _Tp>
- _LIBCPP_HIDE_FROM_ABI void __set(size_t __s, _Tp*) _NOEXCEPT
- {__set(__s, integral_constant<bool, is_trivially_destructible<_Tp>::value>());}
-
- template <class _Tp>
- _LIBCPP_HIDE_FROM_ABI void operator()(_Tp* __p) _NOEXCEPT
- {__process(__p, integral_constant<bool, is_trivially_destructible<_Tp>::value>());}
+public:
+ _LIBCPP_HIDE_FROM_ABI explicit __destruct_n(size_t __s) _NOEXCEPT : __size_(__s) {}
+
+ template <class _Tp>
+ _LIBCPP_HIDE_FROM_ABI void __incr() _NOEXCEPT {
+ __incr(integral_constant<bool, is_trivially_destructible<_Tp>::value>());
+ }
+
+ template <class _Tp>
+ _LIBCPP_HIDE_FROM_ABI void __set(size_t __s, _Tp*) _NOEXCEPT {
+ __set(__s, integral_constant<bool, is_trivially_destructible<_Tp>::value>());
+ }
+
+ template <class _Tp>
+ _LIBCPP_HIDE_FROM_ABI void operator()(_Tp* __p) _NOEXCEPT {
+ __process(__p, integral_constant<bool, is_trivially_destructible<_Tp>::value>());
+ }
};
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__memory/pointer_traits.h b/contrib/llvm-project/libcxx/include/__memory/pointer_traits.h
index 7fcf3bf06110..643b7391d3d6 100644
--- a/contrib/llvm-project/libcxx/include/__memory/pointer_traits.h
+++ b/contrib/llvm-project/libcxx/include/__memory/pointer_traits.h
@@ -38,21 +38,18 @@ template <class _Ptr, bool = __has_element_type<_Ptr>::value>
struct __pointer_traits_element_type {};
template <class _Ptr>
-struct __pointer_traits_element_type<_Ptr, true>
-{
- typedef _LIBCPP_NODEBUG typename _Ptr::element_type type;
+struct __pointer_traits_element_type<_Ptr, true> {
+ typedef _LIBCPP_NODEBUG typename _Ptr::element_type type;
};
-template <template <class, class...> class _Sp, class _Tp, class ..._Args>
-struct __pointer_traits_element_type<_Sp<_Tp, _Args...>, true>
-{
- typedef _LIBCPP_NODEBUG typename _Sp<_Tp, _Args...>::element_type type;
+template <template <class, class...> class _Sp, class _Tp, class... _Args>
+struct __pointer_traits_element_type<_Sp<_Tp, _Args...>, true> {
+ typedef _LIBCPP_NODEBUG typename _Sp<_Tp, _Args...>::element_type type;
};
-template <template <class, class...> class _Sp, class _Tp, class ..._Args>
-struct __pointer_traits_element_type<_Sp<_Tp, _Args...>, false>
-{
- typedef _LIBCPP_NODEBUG _Tp type;
+template <template <class, class...> class _Sp, class _Tp, class... _Args>
+struct __pointer_traits_element_type<_Sp<_Tp, _Args...>, false> {
+ typedef _LIBCPP_NODEBUG _Tp type;
};
template <class _Tp, class = void>
@@ -62,53 +59,50 @@ template <class _Tp>
struct __has_difference_type<_Tp, __void_t<typename _Tp::difference_type> > : true_type {};
template <class _Ptr, bool = __has_difference_type<_Ptr>::value>
-struct __pointer_traits_difference_type
-{
- typedef _LIBCPP_NODEBUG ptrdiff_t type;
+struct __pointer_traits_difference_type {
+ typedef _LIBCPP_NODEBUG ptrdiff_t type;
};
template <class _Ptr>
-struct __pointer_traits_difference_type<_Ptr, true>
-{
- typedef _LIBCPP_NODEBUG typename _Ptr::difference_type type;
+struct __pointer_traits_difference_type<_Ptr, true> {
+ typedef _LIBCPP_NODEBUG typename _Ptr::difference_type type;
};
template <class _Tp, class _Up>
-struct __has_rebind
-{
+struct __has_rebind {
private:
- template <class _Xp> static false_type __test(...);
- _LIBCPP_SUPPRESS_DEPRECATED_PUSH
- template <class _Xp> static true_type __test(typename _Xp::template rebind<_Up>* = 0);
- _LIBCPP_SUPPRESS_DEPRECATED_POP
+ template <class _Xp>
+ static false_type __test(...);
+ _LIBCPP_SUPPRESS_DEPRECATED_PUSH
+ template <class _Xp>
+ static true_type __test(typename _Xp::template rebind<_Up>* = 0);
+ _LIBCPP_SUPPRESS_DEPRECATED_POP
+
public:
- static const bool value = decltype(__test<_Tp>(0))::value;
+ static const bool value = decltype(__test<_Tp>(0))::value;
};
template <class _Tp, class _Up, bool = __has_rebind<_Tp, _Up>::value>
-struct __pointer_traits_rebind
-{
+struct __pointer_traits_rebind {
#ifndef _LIBCPP_CXX03_LANG
- typedef _LIBCPP_NODEBUG typename _Tp::template rebind<_Up> type;
+ typedef _LIBCPP_NODEBUG typename _Tp::template rebind<_Up> type;
#else
- typedef _LIBCPP_NODEBUG typename _Tp::template rebind<_Up>::other type;
+ typedef _LIBCPP_NODEBUG typename _Tp::template rebind<_Up>::other type;
#endif
};
-template <template <class, class...> class _Sp, class _Tp, class ..._Args, class _Up>
-struct __pointer_traits_rebind<_Sp<_Tp, _Args...>, _Up, true>
-{
+template <template <class, class...> class _Sp, class _Tp, class... _Args, class _Up>
+struct __pointer_traits_rebind<_Sp<_Tp, _Args...>, _Up, true> {
#ifndef _LIBCPP_CXX03_LANG
- typedef _LIBCPP_NODEBUG typename _Sp<_Tp, _Args...>::template rebind<_Up> type;
+ typedef _LIBCPP_NODEBUG typename _Sp<_Tp, _Args...>::template rebind<_Up> type;
#else
- typedef _LIBCPP_NODEBUG typename _Sp<_Tp, _Args...>::template rebind<_Up>::other type;
+ typedef _LIBCPP_NODEBUG typename _Sp<_Tp, _Args...>::template rebind<_Up>::other type;
#endif
};
-template <template <class, class...> class _Sp, class _Tp, class ..._Args, class _Up>
-struct __pointer_traits_rebind<_Sp<_Tp, _Args...>, _Up, false>
-{
- typedef _Sp<_Up, _Args...> type;
+template <template <class, class...> class _Sp, class _Tp, class... _Args, class _Up>
+struct __pointer_traits_rebind<_Sp<_Tp, _Args...>, _Up, false> {
+ typedef _Sp<_Up, _Args...> type;
};
template <class _Ptr, class = void>
@@ -121,42 +115,52 @@ struct __pointer_traits_impl<_Ptr, __void_t<typename __pointer_traits_element_ty
typedef typename __pointer_traits_difference_type<pointer>::type difference_type;
#ifndef _LIBCPP_CXX03_LANG
- template <class _Up> using rebind = typename __pointer_traits_rebind<pointer, _Up>::type;
+ template <class _Up>
+ using rebind = typename __pointer_traits_rebind<pointer, _Up>::type;
#else
- template <class _Up> struct rebind
- {typedef typename __pointer_traits_rebind<pointer, _Up>::type other;};
+ template <class _Up>
+ struct rebind {
+ typedef typename __pointer_traits_rebind<pointer, _Up>::type other;
+ };
#endif // _LIBCPP_CXX03_LANG
private:
- struct __nat {};
+ struct __nat {};
+
public:
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- static pointer pointer_to(__conditional_t<is_void<element_type>::value, __nat, element_type>& __r)
- {return pointer::pointer_to(__r);}
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 static pointer
+ pointer_to(__conditional_t<is_void<element_type>::value, __nat, element_type>& __r) {
+ return pointer::pointer_to(__r);
+ }
};
template <class _Ptr>
struct _LIBCPP_TEMPLATE_VIS pointer_traits : __pointer_traits_impl<_Ptr> {};
template <class _Tp>
-struct _LIBCPP_TEMPLATE_VIS pointer_traits<_Tp*>
-{
- typedef _Tp* pointer;
- typedef _Tp element_type;
- typedef ptrdiff_t difference_type;
+struct _LIBCPP_TEMPLATE_VIS pointer_traits<_Tp*> {
+ typedef _Tp* pointer;
+ typedef _Tp element_type;
+ typedef ptrdiff_t difference_type;
#ifndef _LIBCPP_CXX03_LANG
- template <class _Up> using rebind = _Up*;
+ template <class _Up>
+ using rebind = _Up*;
#else
- template <class _Up> struct rebind {typedef _Up* other;};
+ template <class _Up>
+ struct rebind {
+ typedef _Up* other;
+ };
#endif
private:
- struct __nat {};
+ struct __nat {};
+
public:
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- static pointer pointer_to(__conditional_t<is_void<element_type>::value, __nat, element_type>& __r) _NOEXCEPT
- {return std::addressof(__r);}
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 static pointer
+ pointer_to(__conditional_t<is_void<element_type>::value, __nat, element_type>& __r) _NOEXCEPT {
+ return std::addressof(__r);
+ }
};
#ifndef _LIBCPP_CXX03_LANG
@@ -173,27 +177,23 @@ template <class _Pointer, class = void>
struct __to_address_helper;
template <class _Tp>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR
-_Tp* __to_address(_Tp* __p) _NOEXCEPT {
- static_assert(!is_function<_Tp>::value, "_Tp is a function type");
- return __p;
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR _Tp* __to_address(_Tp* __p) _NOEXCEPT {
+ static_assert(!is_function<_Tp>::value, "_Tp is a function type");
+ return __p;
}
template <class _Pointer, class = void>
struct _HasToAddress : false_type {};
template <class _Pointer>
-struct _HasToAddress<_Pointer,
- decltype((void)pointer_traits<_Pointer>::to_address(std::declval<const _Pointer&>()))
-> : true_type {};
+struct _HasToAddress<_Pointer, decltype((void)pointer_traits<_Pointer>::to_address(std::declval<const _Pointer&>())) >
+ : true_type {};
template <class _Pointer, class = void>
struct _HasArrow : false_type {};
template <class _Pointer>
-struct _HasArrow<_Pointer,
- decltype((void)std::declval<const _Pointer&>().operator->())
-> : true_type {};
+struct _HasArrow<_Pointer, decltype((void)std::declval<const _Pointer&>().operator->()) > : true_type {};
template <class _Pointer>
struct _IsFancyPointer {
@@ -201,44 +201,42 @@ struct _IsFancyPointer {
};
// enable_if is needed here to avoid instantiating checks for fancy pointers on raw pointers
-template <class _Pointer, class = __enable_if_t<
- _And<is_class<_Pointer>, _IsFancyPointer<_Pointer> >::value
-> >
+template <class _Pointer, class = __enable_if_t< _And<is_class<_Pointer>, _IsFancyPointer<_Pointer> >::value > >
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR
-__decay_t<decltype(__to_address_helper<_Pointer>::__call(std::declval<const _Pointer&>()))>
-__to_address(const _Pointer& __p) _NOEXCEPT {
- return __to_address_helper<_Pointer>::__call(__p);
+ __decay_t<decltype(__to_address_helper<_Pointer>::__call(std::declval<const _Pointer&>()))>
+ __to_address(const _Pointer& __p) _NOEXCEPT {
+ return __to_address_helper<_Pointer>::__call(__p);
}
template <class _Pointer, class>
struct __to_address_helper {
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR
- static decltype(std::__to_address(std::declval<const _Pointer&>().operator->()))
- __call(const _Pointer& __p) _NOEXCEPT {
- return std::__to_address(__p.operator->());
- }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR static decltype(std::__to_address(
+ std::declval<const _Pointer&>().operator->()))
+ __call(const _Pointer& __p) _NOEXCEPT {
+ return std::__to_address(__p.operator->());
+ }
};
template <class _Pointer>
-struct __to_address_helper<_Pointer, decltype((void)pointer_traits<_Pointer>::to_address(std::declval<const _Pointer&>()))> {
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR
- static decltype(pointer_traits<_Pointer>::to_address(std::declval<const _Pointer&>()))
- __call(const _Pointer& __p) _NOEXCEPT {
- return pointer_traits<_Pointer>::to_address(__p);
- }
+struct __to_address_helper<_Pointer,
+ decltype((void)pointer_traits<_Pointer>::to_address(std::declval<const _Pointer&>()))> {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR static decltype(pointer_traits<_Pointer>::to_address(
+ std::declval<const _Pointer&>()))
+ __call(const _Pointer& __p) _NOEXCEPT {
+ return pointer_traits<_Pointer>::to_address(__p);
+ }
};
#if _LIBCPP_STD_VER >= 20
template <class _Tp>
-inline _LIBCPP_HIDE_FROM_ABI constexpr
-auto to_address(_Tp *__p) noexcept {
- return std::__to_address(__p);
+inline _LIBCPP_HIDE_FROM_ABI constexpr auto to_address(_Tp* __p) noexcept {
+ return std::__to_address(__p);
}
template <class _Pointer>
-inline _LIBCPP_HIDE_FROM_ABI constexpr
-auto to_address(const _Pointer& __p) noexcept -> decltype(std::__to_address(__p)) {
- return std::__to_address(__p);
+inline _LIBCPP_HIDE_FROM_ABI constexpr auto to_address(const _Pointer& __p) noexcept
+ -> decltype(std::__to_address(__p)) {
+ return std::__to_address(__p);
}
#endif
diff --git a/contrib/llvm-project/libcxx/include/__memory/ranges_construct_at.h b/contrib/llvm-project/libcxx/include/__memory/ranges_construct_at.h
index b6008a7b7f03..f731e75e7bdc 100644
--- a/contrib/llvm-project/libcxx/include/__memory/ranges_construct_at.h
+++ b/contrib/llvm-project/libcxx/include/__memory/ranges_construct_at.h
@@ -41,11 +41,8 @@ namespace ranges {
namespace __construct_at {
struct __fn {
- template<class _Tp, class... _Args, class = decltype(
- ::new (std::declval<void*>()) _Tp(std::declval<_Args>()...)
- )>
- _LIBCPP_HIDE_FROM_ABI
- constexpr _Tp* operator()(_Tp* __location, _Args&& ...__args) const {
+ template <class _Tp, class... _Args, class = decltype(::new(std::declval<void*>()) _Tp(std::declval<_Args>()...))>
+ _LIBCPP_HIDE_FROM_ABI constexpr _Tp* operator()(_Tp* __location, _Args&&... __args) const {
return std::construct_at(__location, std::forward<_Args>(__args)...);
}
};
@@ -53,7 +50,7 @@ struct __fn {
} // namespace __construct_at
inline namespace __cpo {
- inline constexpr auto construct_at = __construct_at::__fn{};
+inline constexpr auto construct_at = __construct_at::__fn{};
} // namespace __cpo
// destroy_at
@@ -62,8 +59,7 @@ namespace __destroy_at {
struct __fn {
template <destructible _Tp>
- _LIBCPP_HIDE_FROM_ABI
- constexpr void operator()(_Tp* __location) const noexcept {
+ _LIBCPP_HIDE_FROM_ABI constexpr void operator()(_Tp* __location) const noexcept {
std::destroy_at(__location);
}
};
@@ -71,7 +67,7 @@ struct __fn {
} // namespace __destroy_at
inline namespace __cpo {
- inline constexpr auto destroy_at = __destroy_at::__fn{};
+inline constexpr auto destroy_at = __destroy_at::__fn{};
} // namespace __cpo
// destroy
@@ -81,15 +77,13 @@ namespace __destroy {
struct __fn {
template <__nothrow_input_iterator _InputIterator, __nothrow_sentinel_for<_InputIterator> _Sentinel>
requires destructible<iter_value_t<_InputIterator>>
- _LIBCPP_HIDE_FROM_ABI
- constexpr _InputIterator operator()(_InputIterator __first, _Sentinel __last) const noexcept {
+ _LIBCPP_HIDE_FROM_ABI constexpr _InputIterator operator()(_InputIterator __first, _Sentinel __last) const noexcept {
return std::__destroy(std::move(__first), std::move(__last));
}
template <__nothrow_input_range _InputRange>
requires destructible<range_value_t<_InputRange>>
- _LIBCPP_HIDE_FROM_ABI
- constexpr borrowed_iterator_t<_InputRange> operator()(_InputRange&& __range) const noexcept {
+ _LIBCPP_HIDE_FROM_ABI constexpr borrowed_iterator_t<_InputRange> operator()(_InputRange&& __range) const noexcept {
return (*this)(ranges::begin(__range), ranges::end(__range));
}
};
@@ -97,7 +91,7 @@ struct __fn {
} // namespace __destroy
inline namespace __cpo {
- inline constexpr auto destroy = __destroy::__fn{};
+inline constexpr auto destroy = __destroy::__fn{};
} // namespace __cpo
// destroy_n
@@ -107,8 +101,8 @@ namespace __destroy_n {
struct __fn {
template <__nothrow_input_iterator _InputIterator>
requires destructible<iter_value_t<_InputIterator>>
- _LIBCPP_HIDE_FROM_ABI
- constexpr _InputIterator operator()(_InputIterator __first, iter_difference_t<_InputIterator> __n) const noexcept {
+ _LIBCPP_HIDE_FROM_ABI constexpr _InputIterator
+ operator()(_InputIterator __first, iter_difference_t<_InputIterator> __n) const noexcept {
return std::destroy_n(std::move(__first), __n);
}
};
@@ -116,7 +110,7 @@ struct __fn {
} // namespace __destroy_n
inline namespace __cpo {
- inline constexpr auto destroy_n = __destroy_n::__fn{};
+inline constexpr auto destroy_n = __destroy_n::__fn{};
} // namespace __cpo
} // namespace ranges
diff --git a/contrib/llvm-project/libcxx/include/__memory/ranges_uninitialized_algorithms.h b/contrib/llvm-project/libcxx/include/__memory/ranges_uninitialized_algorithms.h
index 513fcf70f154..d836d00820a6 100644
--- a/contrib/llvm-project/libcxx/include/__memory/ranges_uninitialized_algorithms.h
+++ b/contrib/llvm-project/libcxx/include/__memory/ranges_uninitialized_algorithms.h
@@ -42,13 +42,11 @@ namespace ranges {
namespace __uninitialized_default_construct {
struct __fn {
- template <__nothrow_forward_iterator _ForwardIterator,
- __nothrow_sentinel_for<_ForwardIterator> _Sentinel>
+ template <__nothrow_forward_iterator _ForwardIterator, __nothrow_sentinel_for<_ForwardIterator> _Sentinel>
requires default_initializable<iter_value_t<_ForwardIterator>>
_LIBCPP_HIDE_FROM_ABI _ForwardIterator operator()(_ForwardIterator __first, _Sentinel __last) const {
using _ValueType = remove_reference_t<iter_reference_t<_ForwardIterator>>;
- return std::__uninitialized_default_construct<_ValueType>(
- std::move(__first), std::move(__last));
+ return std::__uninitialized_default_construct<_ValueType>(std::move(__first), std::move(__last));
}
template <__nothrow_forward_range _ForwardRange>
@@ -61,7 +59,7 @@ struct __fn {
} // namespace __uninitialized_default_construct
inline namespace __cpo {
- inline constexpr auto uninitialized_default_construct = __uninitialized_default_construct::__fn{};
+inline constexpr auto uninitialized_default_construct = __uninitialized_default_construct::__fn{};
} // namespace __cpo
// uninitialized_default_construct_n
@@ -71,8 +69,8 @@ namespace __uninitialized_default_construct_n {
struct __fn {
template <__nothrow_forward_iterator _ForwardIterator>
requires default_initializable<iter_value_t<_ForwardIterator>>
- _LIBCPP_HIDE_FROM_ABI _ForwardIterator operator()(_ForwardIterator __first,
- iter_difference_t<_ForwardIterator> __n) const {
+ _LIBCPP_HIDE_FROM_ABI _ForwardIterator
+ operator()(_ForwardIterator __first, iter_difference_t<_ForwardIterator> __n) const {
using _ValueType = remove_reference_t<iter_reference_t<_ForwardIterator>>;
return std::__uninitialized_default_construct_n<_ValueType>(std::move(__first), __n);
}
@@ -81,7 +79,7 @@ struct __fn {
} // namespace __uninitialized_default_construct_n
inline namespace __cpo {
- inline constexpr auto uninitialized_default_construct_n = __uninitialized_default_construct_n::__fn{};
+inline constexpr auto uninitialized_default_construct_n = __uninitialized_default_construct_n::__fn{};
} // namespace __cpo
// uninitialized_value_construct
@@ -89,13 +87,11 @@ inline namespace __cpo {
namespace __uninitialized_value_construct {
struct __fn {
- template <__nothrow_forward_iterator _ForwardIterator,
- __nothrow_sentinel_for<_ForwardIterator> _Sentinel>
+ template <__nothrow_forward_iterator _ForwardIterator, __nothrow_sentinel_for<_ForwardIterator> _Sentinel>
requires default_initializable<iter_value_t<_ForwardIterator>>
_LIBCPP_HIDE_FROM_ABI _ForwardIterator operator()(_ForwardIterator __first, _Sentinel __last) const {
using _ValueType = remove_reference_t<iter_reference_t<_ForwardIterator>>;
- return std::__uninitialized_value_construct<_ValueType>(
- std::move(__first), std::move(__last));
+ return std::__uninitialized_value_construct<_ValueType>(std::move(__first), std::move(__last));
}
template <__nothrow_forward_range _ForwardRange>
@@ -108,7 +104,7 @@ struct __fn {
} // namespace __uninitialized_value_construct
inline namespace __cpo {
- inline constexpr auto uninitialized_value_construct = __uninitialized_value_construct::__fn{};
+inline constexpr auto uninitialized_value_construct = __uninitialized_value_construct::__fn{};
} // namespace __cpo
// uninitialized_value_construct_n
@@ -118,8 +114,8 @@ namespace __uninitialized_value_construct_n {
struct __fn {
template <__nothrow_forward_iterator _ForwardIterator>
requires default_initializable<iter_value_t<_ForwardIterator>>
- _LIBCPP_HIDE_FROM_ABI _ForwardIterator operator()(_ForwardIterator __first,
- iter_difference_t<_ForwardIterator> __n) const {
+ _LIBCPP_HIDE_FROM_ABI _ForwardIterator
+ operator()(_ForwardIterator __first, iter_difference_t<_ForwardIterator> __n) const {
using _ValueType = remove_reference_t<iter_reference_t<_ForwardIterator>>;
return std::__uninitialized_value_construct_n<_ValueType>(std::move(__first), __n);
}
@@ -128,7 +124,7 @@ struct __fn {
} // namespace __uninitialized_value_construct_n
inline namespace __cpo {
- inline constexpr auto uninitialized_value_construct_n = __uninitialized_value_construct_n::__fn{};
+inline constexpr auto uninitialized_value_construct_n = __uninitialized_value_construct_n::__fn{};
} // namespace __cpo
// uninitialized_fill
@@ -136,9 +132,7 @@ inline namespace __cpo {
namespace __uninitialized_fill {
struct __fn {
- template <__nothrow_forward_iterator _ForwardIterator,
- __nothrow_sentinel_for<_ForwardIterator> _Sentinel,
- class _Tp>
+ template <__nothrow_forward_iterator _ForwardIterator, __nothrow_sentinel_for<_ForwardIterator> _Sentinel, class _Tp>
requires constructible_from<iter_value_t<_ForwardIterator>, const _Tp&>
_LIBCPP_HIDE_FROM_ABI _ForwardIterator operator()(_ForwardIterator __first, _Sentinel __last, const _Tp& __x) const {
using _ValueType = remove_reference_t<iter_reference_t<_ForwardIterator>>;
@@ -155,7 +149,7 @@ struct __fn {
} // namespace __uninitialized_fill
inline namespace __cpo {
- inline constexpr auto uninitialized_fill = __uninitialized_fill::__fn{};
+inline constexpr auto uninitialized_fill = __uninitialized_fill::__fn{};
} // namespace __cpo
// uninitialized_fill_n
@@ -165,9 +159,8 @@ namespace __uninitialized_fill_n {
struct __fn {
template <__nothrow_forward_iterator _ForwardIterator, class _Tp>
requires constructible_from<iter_value_t<_ForwardIterator>, const _Tp&>
- _LIBCPP_HIDE_FROM_ABI _ForwardIterator operator()(_ForwardIterator __first,
- iter_difference_t<_ForwardIterator> __n,
- const _Tp& __x) const {
+ _LIBCPP_HIDE_FROM_ABI _ForwardIterator
+ operator()(_ForwardIterator __first, iter_difference_t<_ForwardIterator> __n, const _Tp& __x) const {
using _ValueType = remove_reference_t<iter_reference_t<_ForwardIterator>>;
return std::__uninitialized_fill_n<_ValueType>(std::move(__first), __n, __x);
}
@@ -176,7 +169,7 @@ struct __fn {
} // namespace __uninitialized_fill_n
inline namespace __cpo {
- inline constexpr auto uninitialized_fill_n = __uninitialized_fill_n::__fn{};
+inline constexpr auto uninitialized_fill_n = __uninitialized_fill_n::__fn{};
} // namespace __cpo
// uninitialized_copy
@@ -205,16 +198,16 @@ struct __fn {
template <input_range _InputRange, __nothrow_forward_range _OutputRange>
requires constructible_from<range_value_t<_OutputRange>, range_reference_t<_InputRange>>
_LIBCPP_HIDE_FROM_ABI uninitialized_copy_result<borrowed_iterator_t<_InputRange>, borrowed_iterator_t<_OutputRange>>
- operator()( _InputRange&& __in_range, _OutputRange&& __out_range) const {
- return (*this)(ranges::begin(__in_range), ranges::end(__in_range),
- ranges::begin(__out_range), ranges::end(__out_range));
+ operator()(_InputRange&& __in_range, _OutputRange&& __out_range) const {
+ return (*this)(
+ ranges::begin(__in_range), ranges::end(__in_range), ranges::begin(__out_range), ranges::end(__out_range));
}
};
} // namespace __uninitialized_copy
inline namespace __cpo {
- inline constexpr auto uninitialized_copy = __uninitialized_copy::__fn{};
+inline constexpr auto uninitialized_copy = __uninitialized_copy::__fn{};
} // namespace __cpo
// uninitialized_copy_n
@@ -226,13 +219,15 @@ namespace __uninitialized_copy_n {
struct __fn {
template <input_iterator _InputIterator,
- __nothrow_forward_iterator _OutputIterator,
- __nothrow_sentinel_for<_OutputIterator> _Sentinel>
+ __nothrow_forward_iterator _OutputIterator,
+ __nothrow_sentinel_for<_OutputIterator> _Sentinel>
requires constructible_from<iter_value_t<_OutputIterator>, iter_reference_t<_InputIterator>>
_LIBCPP_HIDE_FROM_ABI uninitialized_copy_n_result<_InputIterator, _OutputIterator>
- operator()(_InputIterator __ifirst, iter_difference_t<_InputIterator> __n,
- _OutputIterator __ofirst, _Sentinel __olast) const {
- using _ValueType = remove_reference_t<iter_reference_t<_OutputIterator>>;
+ operator()(_InputIterator __ifirst,
+ iter_difference_t<_InputIterator> __n,
+ _OutputIterator __ofirst,
+ _Sentinel __olast) const {
+ using _ValueType = remove_reference_t<iter_reference_t<_OutputIterator>>;
auto __stop_copying = [&__olast](auto&& __out_iter) -> bool { return __out_iter == __olast; };
auto __result =
std::__uninitialized_copy_n<_ValueType>(std::move(__ifirst), __n, std::move(__ofirst), __stop_copying);
@@ -243,7 +238,7 @@ struct __fn {
} // namespace __uninitialized_copy_n
inline namespace __cpo {
- inline constexpr auto uninitialized_copy_n = __uninitialized_copy_n::__fn{};
+inline constexpr auto uninitialized_copy_n = __uninitialized_copy_n::__fn{};
} // namespace __cpo
// uninitialized_move
@@ -261,8 +256,8 @@ struct __fn {
requires constructible_from<iter_value_t<_OutputIterator>, iter_rvalue_reference_t<_InputIterator>>
_LIBCPP_HIDE_FROM_ABI uninitialized_move_result<_InputIterator, _OutputIterator>
operator()(_InputIterator __ifirst, _Sentinel1 __ilast, _OutputIterator __ofirst, _Sentinel2 __olast) const {
- using _ValueType = remove_reference_t<iter_reference_t<_OutputIterator>>;
- auto __iter_move = [](auto&& __iter) -> decltype(auto) { return ranges::iter_move(__iter); };
+ using _ValueType = remove_reference_t<iter_reference_t<_OutputIterator>>;
+ auto __iter_move = [](auto&& __iter) -> decltype(auto) { return ranges::iter_move(__iter); };
auto __stop_moving = [&__olast](auto&& __out_iter) -> bool { return __out_iter == __olast; };
auto __result = std::__uninitialized_move<_ValueType>(
std::move(__ifirst), std::move(__ilast), std::move(__ofirst), __stop_moving, __iter_move);
@@ -273,15 +268,15 @@ struct __fn {
requires constructible_from<range_value_t<_OutputRange>, range_rvalue_reference_t<_InputRange>>
_LIBCPP_HIDE_FROM_ABI uninitialized_move_result<borrowed_iterator_t<_InputRange>, borrowed_iterator_t<_OutputRange>>
operator()(_InputRange&& __in_range, _OutputRange&& __out_range) const {
- return (*this)(ranges::begin(__in_range), ranges::end(__in_range),
- ranges::begin(__out_range), ranges::end(__out_range));
+ return (*this)(
+ ranges::begin(__in_range), ranges::end(__in_range), ranges::begin(__out_range), ranges::end(__out_range));
}
};
} // namespace __uninitialized_move
inline namespace __cpo {
- inline constexpr auto uninitialized_move = __uninitialized_move::__fn{};
+inline constexpr auto uninitialized_move = __uninitialized_move::__fn{};
} // namespace __cpo
// uninitialized_move_n
@@ -293,14 +288,16 @@ namespace __uninitialized_move_n {
struct __fn {
template <input_iterator _InputIterator,
- __nothrow_forward_iterator _OutputIterator,
- __nothrow_sentinel_for<_OutputIterator> _Sentinel>
+ __nothrow_forward_iterator _OutputIterator,
+ __nothrow_sentinel_for<_OutputIterator> _Sentinel>
requires constructible_from<iter_value_t<_OutputIterator>, iter_rvalue_reference_t<_InputIterator>>
_LIBCPP_HIDE_FROM_ABI uninitialized_move_n_result<_InputIterator, _OutputIterator>
- operator()(_InputIterator __ifirst, iter_difference_t<_InputIterator> __n,
- _OutputIterator __ofirst, _Sentinel __olast) const {
- using _ValueType = remove_reference_t<iter_reference_t<_OutputIterator>>;
- auto __iter_move = [](auto&& __iter) -> decltype(auto) { return ranges::iter_move(__iter); };
+ operator()(_InputIterator __ifirst,
+ iter_difference_t<_InputIterator> __n,
+ _OutputIterator __ofirst,
+ _Sentinel __olast) const {
+ using _ValueType = remove_reference_t<iter_reference_t<_OutputIterator>>;
+ auto __iter_move = [](auto&& __iter) -> decltype(auto) { return ranges::iter_move(__iter); };
auto __stop_moving = [&__olast](auto&& __out_iter) -> bool { return __out_iter == __olast; };
auto __result = std::__uninitialized_move_n<_ValueType>(
std::move(__ifirst), __n, std::move(__ofirst), __stop_moving, __iter_move);
@@ -311,7 +308,7 @@ struct __fn {
} // namespace __uninitialized_move_n
inline namespace __cpo {
- inline constexpr auto uninitialized_move_n = __uninitialized_move_n::__fn{};
+inline constexpr auto uninitialized_move_n = __uninitialized_move_n::__fn{};
} // namespace __cpo
} // namespace ranges
diff --git a/contrib/llvm-project/libcxx/include/__memory/raw_storage_iterator.h b/contrib/llvm-project/libcxx/include/__memory/raw_storage_iterator.h
index 7aa75dca350a..33790a397c84 100644
--- a/contrib/llvm-project/libcxx/include/__memory/raw_storage_iterator.h
+++ b/contrib/llvm-project/libcxx/include/__memory/raw_storage_iterator.h
@@ -29,38 +29,50 @@ _LIBCPP_BEGIN_NAMESPACE_STD
_LIBCPP_SUPPRESS_DEPRECATED_PUSH
template <class _OutputIterator, class _Tp>
class _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX17 raw_storage_iterator
-#if _LIBCPP_STD_VER <= 14 || !defined(_LIBCPP_ABI_NO_ITERATOR_BASES)
+# if _LIBCPP_STD_VER <= 14 || !defined(_LIBCPP_ABI_NO_ITERATOR_BASES)
: public iterator<output_iterator_tag, void, void, void, void>
-#endif
+# endif
{
-_LIBCPP_SUPPRESS_DEPRECATED_POP
+ _LIBCPP_SUPPRESS_DEPRECATED_POP
+
private:
- _OutputIterator __x_;
+ _OutputIterator __x_;
+
public:
- typedef output_iterator_tag iterator_category;
- typedef void value_type;
-#if _LIBCPP_STD_VER >= 20
- typedef ptrdiff_t difference_type;
-#else
- typedef void difference_type;
-#endif
- typedef void pointer;
- typedef void reference;
+ typedef output_iterator_tag iterator_category;
+ typedef void value_type;
+# if _LIBCPP_STD_VER >= 20
+ typedef ptrdiff_t difference_type;
+# else
+ typedef void difference_type;
+# endif
+ typedef void pointer;
+ typedef void reference;
- _LIBCPP_HIDE_FROM_ABI explicit raw_storage_iterator(_OutputIterator __x) : __x_(__x) {}
- _LIBCPP_HIDE_FROM_ABI raw_storage_iterator& operator*() {return *this;}
- _LIBCPP_HIDE_FROM_ABI raw_storage_iterator& operator=(const _Tp& __element)
- {::new ((void*)std::addressof(*__x_)) _Tp(__element); return *this;}
-#if _LIBCPP_STD_VER >= 14
- _LIBCPP_HIDE_FROM_ABI raw_storage_iterator& operator=(_Tp&& __element)
- {::new ((void*)std::addressof(*__x_)) _Tp(std::move(__element)); return *this;}
-#endif
- _LIBCPP_HIDE_FROM_ABI raw_storage_iterator& operator++() {++__x_; return *this;}
- _LIBCPP_HIDE_FROM_ABI raw_storage_iterator operator++(int)
- {raw_storage_iterator __t(*this); ++__x_; return __t;}
-#if _LIBCPP_STD_VER >= 14
- _LIBCPP_HIDE_FROM_ABI _OutputIterator base() const { return __x_; }
-#endif
+ _LIBCPP_HIDE_FROM_ABI explicit raw_storage_iterator(_OutputIterator __x) : __x_(__x) {}
+ _LIBCPP_HIDE_FROM_ABI raw_storage_iterator& operator*() { return *this; }
+ _LIBCPP_HIDE_FROM_ABI raw_storage_iterator& operator=(const _Tp& __element) {
+ ::new ((void*)std::addressof(*__x_)) _Tp(__element);
+ return *this;
+ }
+# if _LIBCPP_STD_VER >= 14
+ _LIBCPP_HIDE_FROM_ABI raw_storage_iterator& operator=(_Tp&& __element) {
+ ::new ((void*)std::addressof(*__x_)) _Tp(std::move(__element));
+ return *this;
+ }
+# endif
+ _LIBCPP_HIDE_FROM_ABI raw_storage_iterator& operator++() {
+ ++__x_;
+ return *this;
+ }
+ _LIBCPP_HIDE_FROM_ABI raw_storage_iterator operator++(int) {
+ raw_storage_iterator __t(*this);
+ ++__x_;
+ return __t;
+ }
+# if _LIBCPP_STD_VER >= 14
+ _LIBCPP_HIDE_FROM_ABI _OutputIterator base() const { return __x_; }
+# endif
};
#endif // _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_RAW_STORAGE_ITERATOR)
diff --git a/contrib/llvm-project/libcxx/include/__memory/shared_ptr.h b/contrib/llvm-project/libcxx/include/__memory/shared_ptr.h
index 84db7998a147..a868093026c5 100644
--- a/contrib/llvm-project/libcxx/include/__memory/shared_ptr.h
+++ b/contrib/llvm-project/libcxx/include/__memory/shared_ptr.h
@@ -66,214 +66,175 @@ _LIBCPP_BEGIN_NAMESPACE_STD
// NOTE: Relaxed and acq/rel atomics (for increment and decrement respectively)
// should be sufficient for thread safety.
// See https://llvm.org/PR22803
-#if defined(__clang__) && __has_builtin(__atomic_add_fetch) \
- && defined(__ATOMIC_RELAXED) \
- && defined(__ATOMIC_ACQ_REL)
-# define _LIBCPP_HAS_BUILTIN_ATOMIC_SUPPORT
+#if defined(__clang__) && __has_builtin(__atomic_add_fetch) && defined(__ATOMIC_RELAXED) && defined(__ATOMIC_ACQ_REL)
+# define _LIBCPP_HAS_BUILTIN_ATOMIC_SUPPORT
#elif defined(_LIBCPP_COMPILER_GCC)
-# define _LIBCPP_HAS_BUILTIN_ATOMIC_SUPPORT
+# define _LIBCPP_HAS_BUILTIN_ATOMIC_SUPPORT
#endif
template <class _ValueType>
-inline _LIBCPP_HIDE_FROM_ABI
-_ValueType __libcpp_relaxed_load(_ValueType const* __value) {
-#if !defined(_LIBCPP_HAS_NO_THREADS) && \
- defined(__ATOMIC_RELAXED) && \
+inline _LIBCPP_HIDE_FROM_ABI _ValueType __libcpp_relaxed_load(_ValueType const* __value) {
+#if !defined(_LIBCPP_HAS_NO_THREADS) && defined(__ATOMIC_RELAXED) && \
(__has_builtin(__atomic_load_n) || defined(_LIBCPP_COMPILER_GCC))
- return __atomic_load_n(__value, __ATOMIC_RELAXED);
+ return __atomic_load_n(__value, __ATOMIC_RELAXED);
#else
- return *__value;
+ return *__value;
#endif
}
template <class _ValueType>
-inline _LIBCPP_HIDE_FROM_ABI
-_ValueType __libcpp_acquire_load(_ValueType const* __value) {
-#if !defined(_LIBCPP_HAS_NO_THREADS) && \
- defined(__ATOMIC_ACQUIRE) && \
+inline _LIBCPP_HIDE_FROM_ABI _ValueType __libcpp_acquire_load(_ValueType const* __value) {
+#if !defined(_LIBCPP_HAS_NO_THREADS) && defined(__ATOMIC_ACQUIRE) && \
(__has_builtin(__atomic_load_n) || defined(_LIBCPP_COMPILER_GCC))
- return __atomic_load_n(__value, __ATOMIC_ACQUIRE);
+ return __atomic_load_n(__value, __ATOMIC_ACQUIRE);
#else
- return *__value;
+ return *__value;
#endif
}
template <class _Tp>
-inline _LIBCPP_HIDE_FROM_ABI _Tp
-__libcpp_atomic_refcount_increment(_Tp& __t) _NOEXCEPT
-{
+inline _LIBCPP_HIDE_FROM_ABI _Tp __libcpp_atomic_refcount_increment(_Tp& __t) _NOEXCEPT {
#if defined(_LIBCPP_HAS_BUILTIN_ATOMIC_SUPPORT) && !defined(_LIBCPP_HAS_NO_THREADS)
- return __atomic_add_fetch(&__t, 1, __ATOMIC_RELAXED);
+ return __atomic_add_fetch(&__t, 1, __ATOMIC_RELAXED);
#else
- return __t += 1;
+ return __t += 1;
#endif
}
template <class _Tp>
-inline _LIBCPP_HIDE_FROM_ABI _Tp
-__libcpp_atomic_refcount_decrement(_Tp& __t) _NOEXCEPT
-{
+inline _LIBCPP_HIDE_FROM_ABI _Tp __libcpp_atomic_refcount_decrement(_Tp& __t) _NOEXCEPT {
#if defined(_LIBCPP_HAS_BUILTIN_ATOMIC_SUPPORT) && !defined(_LIBCPP_HAS_NO_THREADS)
- return __atomic_add_fetch(&__t, -1, __ATOMIC_ACQ_REL);
+ return __atomic_add_fetch(&__t, -1, __ATOMIC_ACQ_REL);
#else
- return __t -= 1;
+ return __t -= 1;
#endif
}
-class _LIBCPP_EXPORTED_FROM_ABI bad_weak_ptr
- : public std::exception
-{
+class _LIBCPP_EXPORTED_FROM_ABI bad_weak_ptr : public std::exception {
public:
- _LIBCPP_HIDE_FROM_ABI bad_weak_ptr() _NOEXCEPT = default;
- _LIBCPP_HIDE_FROM_ABI bad_weak_ptr(const bad_weak_ptr&) _NOEXCEPT = default;
- _LIBCPP_HIDE_FROM_ABI bad_weak_ptr& operator=(const bad_weak_ptr&) _NOEXCEPT = default;
- ~bad_weak_ptr() _NOEXCEPT override;
- const char* what() const _NOEXCEPT override;
+ _LIBCPP_HIDE_FROM_ABI bad_weak_ptr() _NOEXCEPT = default;
+ _LIBCPP_HIDE_FROM_ABI bad_weak_ptr(const bad_weak_ptr&) _NOEXCEPT = default;
+ _LIBCPP_HIDE_FROM_ABI bad_weak_ptr& operator=(const bad_weak_ptr&) _NOEXCEPT = default;
+ ~bad_weak_ptr() _NOEXCEPT override;
+ const char* what() const _NOEXCEPT override;
};
-_LIBCPP_NORETURN inline _LIBCPP_HIDE_FROM_ABI
-void __throw_bad_weak_ptr()
-{
+_LIBCPP_NORETURN inline _LIBCPP_HIDE_FROM_ABI void __throw_bad_weak_ptr() {
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- throw bad_weak_ptr();
+ throw bad_weak_ptr();
#else
- _LIBCPP_VERBOSE_ABORT("bad_weak_ptr was thrown in -fno-exceptions mode");
+ _LIBCPP_VERBOSE_ABORT("bad_weak_ptr was thrown in -fno-exceptions mode");
#endif
}
-template<class _Tp> class _LIBCPP_TEMPLATE_VIS weak_ptr;
+template <class _Tp>
+class _LIBCPP_TEMPLATE_VIS weak_ptr;
-class _LIBCPP_EXPORTED_FROM_ABI __shared_count
-{
- __shared_count(const __shared_count&);
- __shared_count& operator=(const __shared_count&);
+class _LIBCPP_EXPORTED_FROM_ABI __shared_count {
+ __shared_count(const __shared_count&);
+ __shared_count& operator=(const __shared_count&);
protected:
- long __shared_owners_;
- virtual ~__shared_count();
+ long __shared_owners_;
+ virtual ~__shared_count();
+
private:
- virtual void __on_zero_shared() _NOEXCEPT = 0;
+ virtual void __on_zero_shared() _NOEXCEPT = 0;
public:
- _LIBCPP_HIDE_FROM_ABI
- explicit __shared_count(long __refs = 0) _NOEXCEPT
- : __shared_owners_(__refs) {}
+ _LIBCPP_HIDE_FROM_ABI explicit __shared_count(long __refs = 0) _NOEXCEPT : __shared_owners_(__refs) {}
#if defined(_LIBCPP_SHARED_PTR_DEFINE_LEGACY_INLINE_FUNCTIONS)
- void __add_shared() noexcept;
- bool __release_shared() noexcept;
+ void __add_shared() noexcept;
+ bool __release_shared() noexcept;
#else
- _LIBCPP_HIDE_FROM_ABI
- void __add_shared() _NOEXCEPT {
- __libcpp_atomic_refcount_increment(__shared_owners_);
- }
- _LIBCPP_HIDE_FROM_ABI
- bool __release_shared() _NOEXCEPT {
- if (__libcpp_atomic_refcount_decrement(__shared_owners_) == -1) {
- __on_zero_shared();
- return true;
- }
- return false;
+ _LIBCPP_HIDE_FROM_ABI void __add_shared() _NOEXCEPT { __libcpp_atomic_refcount_increment(__shared_owners_); }
+ _LIBCPP_HIDE_FROM_ABI bool __release_shared() _NOEXCEPT {
+ if (__libcpp_atomic_refcount_decrement(__shared_owners_) == -1) {
+ __on_zero_shared();
+ return true;
}
+ return false;
+ }
#endif
- _LIBCPP_HIDE_FROM_ABI
- long use_count() const _NOEXCEPT {
- return __libcpp_relaxed_load(&__shared_owners_) + 1;
- }
+ _LIBCPP_HIDE_FROM_ABI long use_count() const _NOEXCEPT { return __libcpp_relaxed_load(&__shared_owners_) + 1; }
};
-class _LIBCPP_EXPORTED_FROM_ABI __shared_weak_count
- : private __shared_count
-{
- long __shared_weak_owners_;
+class _LIBCPP_EXPORTED_FROM_ABI __shared_weak_count : private __shared_count {
+ long __shared_weak_owners_;
public:
- _LIBCPP_HIDE_FROM_ABI
- explicit __shared_weak_count(long __refs = 0) _NOEXCEPT
- : __shared_count(__refs),
- __shared_weak_owners_(__refs) {}
+ _LIBCPP_HIDE_FROM_ABI explicit __shared_weak_count(long __refs = 0) _NOEXCEPT
+ : __shared_count(__refs),
+ __shared_weak_owners_(__refs) {}
+
protected:
- ~__shared_weak_count() override;
+ ~__shared_weak_count() override;
public:
#if defined(_LIBCPP_SHARED_PTR_DEFINE_LEGACY_INLINE_FUNCTIONS)
- void __add_shared() noexcept;
- void __add_weak() noexcept;
- void __release_shared() noexcept;
+ void __add_shared() noexcept;
+ void __add_weak() noexcept;
+ void __release_shared() noexcept;
#else
- _LIBCPP_HIDE_FROM_ABI
- void __add_shared() _NOEXCEPT {
- __shared_count::__add_shared();
- }
- _LIBCPP_HIDE_FROM_ABI
- void __add_weak() _NOEXCEPT {
- __libcpp_atomic_refcount_increment(__shared_weak_owners_);
- }
- _LIBCPP_HIDE_FROM_ABI
- void __release_shared() _NOEXCEPT {
- if (__shared_count::__release_shared())
- __release_weak();
- }
+ _LIBCPP_HIDE_FROM_ABI void __add_shared() _NOEXCEPT { __shared_count::__add_shared(); }
+ _LIBCPP_HIDE_FROM_ABI void __add_weak() _NOEXCEPT { __libcpp_atomic_refcount_increment(__shared_weak_owners_); }
+ _LIBCPP_HIDE_FROM_ABI void __release_shared() _NOEXCEPT {
+ if (__shared_count::__release_shared())
+ __release_weak();
+ }
#endif
- void __release_weak() _NOEXCEPT;
- _LIBCPP_HIDE_FROM_ABI
- long use_count() const _NOEXCEPT {return __shared_count::use_count();}
- __shared_weak_count* lock() _NOEXCEPT;
+ void __release_weak() _NOEXCEPT;
+ _LIBCPP_HIDE_FROM_ABI long use_count() const _NOEXCEPT { return __shared_count::use_count(); }
+ __shared_weak_count* lock() _NOEXCEPT;
+
+ virtual const void* __get_deleter(const type_info&) const _NOEXCEPT;
- virtual const void* __get_deleter(const type_info&) const _NOEXCEPT;
private:
- virtual void __on_zero_shared_weak() _NOEXCEPT = 0;
+ virtual void __on_zero_shared_weak() _NOEXCEPT = 0;
};
template <class _Tp, class _Dp, class _Alloc>
-class __shared_ptr_pointer
- : public __shared_weak_count
-{
- __compressed_pair<__compressed_pair<_Tp, _Dp>, _Alloc> __data_;
+class __shared_ptr_pointer : public __shared_weak_count {
+ __compressed_pair<__compressed_pair<_Tp, _Dp>, _Alloc> __data_;
+
public:
- _LIBCPP_HIDE_FROM_ABI
- __shared_ptr_pointer(_Tp __p, _Dp __d, _Alloc __a)
- : __data_(__compressed_pair<_Tp, _Dp>(__p, std::move(__d)), std::move(__a)) {}
+ _LIBCPP_HIDE_FROM_ABI __shared_ptr_pointer(_Tp __p, _Dp __d, _Alloc __a)
+ : __data_(__compressed_pair<_Tp, _Dp>(__p, std::move(__d)), std::move(__a)) {}
#ifndef _LIBCPP_HAS_NO_RTTI
- _LIBCPP_HIDE_FROM_ABI_VIRTUAL const void* __get_deleter(const type_info&) const _NOEXCEPT override;
+ _LIBCPP_HIDE_FROM_ABI_VIRTUAL const void* __get_deleter(const type_info&) const _NOEXCEPT override;
#endif
private:
- _LIBCPP_HIDE_FROM_ABI_VIRTUAL void __on_zero_shared() _NOEXCEPT override;
- _LIBCPP_HIDE_FROM_ABI_VIRTUAL void __on_zero_shared_weak() _NOEXCEPT override;
+ _LIBCPP_HIDE_FROM_ABI_VIRTUAL void __on_zero_shared() _NOEXCEPT override;
+ _LIBCPP_HIDE_FROM_ABI_VIRTUAL void __on_zero_shared_weak() _NOEXCEPT override;
};
#ifndef _LIBCPP_HAS_NO_RTTI
template <class _Tp, class _Dp, class _Alloc>
-const void*
-__shared_ptr_pointer<_Tp, _Dp, _Alloc>::__get_deleter(const type_info& __t) const _NOEXCEPT
-{
- return __t == typeid(_Dp) ? std::addressof(__data_.first().second()) : nullptr;
+const void* __shared_ptr_pointer<_Tp, _Dp, _Alloc>::__get_deleter(const type_info& __t) const _NOEXCEPT {
+ return __t == typeid(_Dp) ? std::addressof(__data_.first().second()) : nullptr;
}
#endif // _LIBCPP_HAS_NO_RTTI
template <class _Tp, class _Dp, class _Alloc>
-void
-__shared_ptr_pointer<_Tp, _Dp, _Alloc>::__on_zero_shared() _NOEXCEPT
-{
- __data_.first().second()(__data_.first().first());
- __data_.first().second().~_Dp();
+void __shared_ptr_pointer<_Tp, _Dp, _Alloc>::__on_zero_shared() _NOEXCEPT {
+ __data_.first().second()(__data_.first().first());
+ __data_.first().second().~_Dp();
}
template <class _Tp, class _Dp, class _Alloc>
-void
-__shared_ptr_pointer<_Tp, _Dp, _Alloc>::__on_zero_shared_weak() _NOEXCEPT
-{
- typedef typename __allocator_traits_rebind<_Alloc, __shared_ptr_pointer>::type _Al;
- typedef allocator_traits<_Al> _ATraits;
- typedef pointer_traits<typename _ATraits::pointer> _PTraits;
+void __shared_ptr_pointer<_Tp, _Dp, _Alloc>::__on_zero_shared_weak() _NOEXCEPT {
+ typedef typename __allocator_traits_rebind<_Alloc, __shared_ptr_pointer>::type _Al;
+ typedef allocator_traits<_Al> _ATraits;
+ typedef pointer_traits<typename _ATraits::pointer> _PTraits;
- _Al __a(__data_.second());
- __data_.second().~_Alloc();
- __a.deallocate(_PTraits::pointer_to(*this), 1);
+ _Al __a(__data_.second());
+ __data_.second().~_Alloc();
+ __a.deallocate(_PTraits::pointer_to(*this), 1);
}
// This tag is used to instantiate an allocator type. The various shared_ptr control blocks
@@ -282,110 +243,99 @@ __shared_ptr_pointer<_Tp, _Dp, _Alloc>::__on_zero_shared_weak() _NOEXCEPT
struct __for_overwrite_tag {};
template <class _Tp, class _Alloc>
-struct __shared_ptr_emplace
- : __shared_weak_count
-{
- template <class... _Args, class _Allocator = _Alloc, __enable_if_t<is_same<typename _Allocator::value_type, __for_overwrite_tag>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI
- explicit __shared_ptr_emplace(_Alloc __a, _Args&& ...)
- : __storage_(std::move(__a))
- {
- static_assert(sizeof...(_Args) == 0, "No argument should be provided to the control block when using _for_overwrite");
- ::new ((void*)__get_elem()) _Tp;
- }
-
- template <class... _Args, class _Allocator = _Alloc, __enable_if_t<!is_same<typename _Allocator::value_type, __for_overwrite_tag>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI
- explicit __shared_ptr_emplace(_Alloc __a, _Args&& ...__args)
- : __storage_(std::move(__a))
- {
- using _TpAlloc = typename __allocator_traits_rebind<_Alloc, _Tp>::type;
- _TpAlloc __tmp(*__get_alloc());
- allocator_traits<_TpAlloc>::construct(__tmp, __get_elem(), std::forward<_Args>(__args)...);
- }
-
- _LIBCPP_HIDE_FROM_ABI
- _Alloc* __get_alloc() _NOEXCEPT { return __storage_.__get_alloc(); }
-
- _LIBCPP_HIDE_FROM_ABI
- _Tp* __get_elem() _NOEXCEPT { return __storage_.__get_elem(); }
+struct __shared_ptr_emplace : __shared_weak_count {
+ template <class... _Args,
+ class _Allocator = _Alloc,
+ __enable_if_t<is_same<typename _Allocator::value_type, __for_overwrite_tag>::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI explicit __shared_ptr_emplace(_Alloc __a, _Args&&...) : __storage_(std::move(__a)) {
+ static_assert(
+ sizeof...(_Args) == 0, "No argument should be provided to the control block when using _for_overwrite");
+ ::new ((void*)__get_elem()) _Tp;
+ }
+
+ template <class... _Args,
+ class _Allocator = _Alloc,
+ __enable_if_t<!is_same<typename _Allocator::value_type, __for_overwrite_tag>::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI explicit __shared_ptr_emplace(_Alloc __a, _Args&&... __args) : __storage_(std::move(__a)) {
+ using _TpAlloc = typename __allocator_traits_rebind<_Alloc, _Tp>::type;
+ _TpAlloc __tmp(*__get_alloc());
+ allocator_traits<_TpAlloc>::construct(__tmp, __get_elem(), std::forward<_Args>(__args)...);
+ }
+
+ _LIBCPP_HIDE_FROM_ABI _Alloc* __get_alloc() _NOEXCEPT { return __storage_.__get_alloc(); }
+
+ _LIBCPP_HIDE_FROM_ABI _Tp* __get_elem() _NOEXCEPT { return __storage_.__get_elem(); }
private:
- template <class _Allocator = _Alloc, __enable_if_t<is_same<typename _Allocator::value_type, __for_overwrite_tag>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI void __on_zero_shared_impl() _NOEXCEPT {
- __get_elem()->~_Tp();
- }
-
- template <class _Allocator = _Alloc, __enable_if_t<!is_same<typename _Allocator::value_type, __for_overwrite_tag>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI void __on_zero_shared_impl() _NOEXCEPT {
- using _TpAlloc = typename __allocator_traits_rebind<_Allocator, _Tp>::type;
- _TpAlloc __tmp(*__get_alloc());
- allocator_traits<_TpAlloc>::destroy(__tmp, __get_elem());
+ template <class _Allocator = _Alloc,
+ __enable_if_t<is_same<typename _Allocator::value_type, __for_overwrite_tag>::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI void __on_zero_shared_impl() _NOEXCEPT {
+ __get_elem()->~_Tp();
+ }
+
+ template <class _Allocator = _Alloc,
+ __enable_if_t<!is_same<typename _Allocator::value_type, __for_overwrite_tag>::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI void __on_zero_shared_impl() _NOEXCEPT {
+ using _TpAlloc = typename __allocator_traits_rebind<_Allocator, _Tp>::type;
+ _TpAlloc __tmp(*__get_alloc());
+ allocator_traits<_TpAlloc>::destroy(__tmp, __get_elem());
+ }
+
+ _LIBCPP_HIDE_FROM_ABI_VIRTUAL void __on_zero_shared() _NOEXCEPT override { __on_zero_shared_impl(); }
+
+ _LIBCPP_HIDE_FROM_ABI_VIRTUAL void __on_zero_shared_weak() _NOEXCEPT override {
+ using _ControlBlockAlloc = typename __allocator_traits_rebind<_Alloc, __shared_ptr_emplace>::type;
+ using _ControlBlockPointer = typename allocator_traits<_ControlBlockAlloc>::pointer;
+ _ControlBlockAlloc __tmp(*__get_alloc());
+ __storage_.~_Storage();
+ allocator_traits<_ControlBlockAlloc>::deallocate(__tmp, pointer_traits<_ControlBlockPointer>::pointer_to(*this), 1);
+ }
+
+ // This class implements the control block for non-array shared pointers created
+ // through `std::allocate_shared` and `std::make_shared`.
+ //
+ // In previous versions of the library, we used a compressed pair to store
+ // both the _Alloc and the _Tp. This implies using EBO, which is incompatible
+ // with Allocator construction for _Tp. To allow implementing P0674 in C++20,
+ // we now use a properly aligned char buffer while making sure that we maintain
+ // the same layout that we had when we used a compressed pair.
+ using _CompressedPair = __compressed_pair<_Alloc, _Tp>;
+ struct _ALIGNAS_TYPE(_CompressedPair) _Storage {
+ char __blob_[sizeof(_CompressedPair)];
+
+ _LIBCPP_HIDE_FROM_ABI explicit _Storage(_Alloc&& __a) { ::new ((void*)__get_alloc()) _Alloc(std::move(__a)); }
+ _LIBCPP_HIDE_FROM_ABI ~_Storage() { __get_alloc()->~_Alloc(); }
+ _LIBCPP_HIDE_FROM_ABI _Alloc* __get_alloc() _NOEXCEPT {
+ _CompressedPair* __as_pair = reinterpret_cast<_CompressedPair*>(__blob_);
+ typename _CompressedPair::_Base1* __first = _CompressedPair::__get_first_base(__as_pair);
+ _Alloc* __alloc = reinterpret_cast<_Alloc*>(__first);
+ return __alloc;
}
-
- _LIBCPP_HIDE_FROM_ABI_VIRTUAL void __on_zero_shared() _NOEXCEPT override {
- __on_zero_shared_impl();
- }
-
- _LIBCPP_HIDE_FROM_ABI_VIRTUAL void __on_zero_shared_weak() _NOEXCEPT override {
- using _ControlBlockAlloc = typename __allocator_traits_rebind<_Alloc, __shared_ptr_emplace>::type;
- using _ControlBlockPointer = typename allocator_traits<_ControlBlockAlloc>::pointer;
- _ControlBlockAlloc __tmp(*__get_alloc());
- __storage_.~_Storage();
- allocator_traits<_ControlBlockAlloc>::deallocate(__tmp,
- pointer_traits<_ControlBlockPointer>::pointer_to(*this), 1);
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_NO_CFI _Tp* __get_elem() _NOEXCEPT {
+ _CompressedPair* __as_pair = reinterpret_cast<_CompressedPair*>(__blob_);
+ typename _CompressedPair::_Base2* __second = _CompressedPair::__get_second_base(__as_pair);
+ _Tp* __elem = reinterpret_cast<_Tp*>(__second);
+ return __elem;
}
+ };
- // This class implements the control block for non-array shared pointers created
- // through `std::allocate_shared` and `std::make_shared`.
- //
- // In previous versions of the library, we used a compressed pair to store
- // both the _Alloc and the _Tp. This implies using EBO, which is incompatible
- // with Allocator construction for _Tp. To allow implementing P0674 in C++20,
- // we now use a properly aligned char buffer while making sure that we maintain
- // the same layout that we had when we used a compressed pair.
- using _CompressedPair = __compressed_pair<_Alloc, _Tp>;
- struct _ALIGNAS_TYPE(_CompressedPair) _Storage {
- char __blob_[sizeof(_CompressedPair)];
-
- _LIBCPP_HIDE_FROM_ABI explicit _Storage(_Alloc&& __a) {
- ::new ((void*)__get_alloc()) _Alloc(std::move(__a));
- }
- _LIBCPP_HIDE_FROM_ABI ~_Storage() {
- __get_alloc()->~_Alloc();
- }
- _LIBCPP_HIDE_FROM_ABI _Alloc* __get_alloc() _NOEXCEPT {
- _CompressedPair *__as_pair = reinterpret_cast<_CompressedPair*>(__blob_);
- typename _CompressedPair::_Base1* __first = _CompressedPair::__get_first_base(__as_pair);
- _Alloc *__alloc = reinterpret_cast<_Alloc*>(__first);
- return __alloc;
- }
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_NO_CFI _Tp* __get_elem() _NOEXCEPT {
- _CompressedPair *__as_pair = reinterpret_cast<_CompressedPair*>(__blob_);
- typename _CompressedPair::_Base2* __second = _CompressedPair::__get_second_base(__as_pair);
- _Tp *__elem = reinterpret_cast<_Tp*>(__second);
- return __elem;
- }
- };
-
- static_assert(_LIBCPP_ALIGNOF(_Storage) == _LIBCPP_ALIGNOF(_CompressedPair), "");
- static_assert(sizeof(_Storage) == sizeof(_CompressedPair), "");
- _Storage __storage_;
+ static_assert(_LIBCPP_ALIGNOF(_Storage) == _LIBCPP_ALIGNOF(_CompressedPair), "");
+ static_assert(sizeof(_Storage) == sizeof(_CompressedPair), "");
+ _Storage __storage_;
};
struct __shared_ptr_dummy_rebind_allocator_type;
template <>
-class _LIBCPP_TEMPLATE_VIS allocator<__shared_ptr_dummy_rebind_allocator_type>
-{
+class _LIBCPP_TEMPLATE_VIS allocator<__shared_ptr_dummy_rebind_allocator_type> {
public:
- template <class _Other>
- struct rebind
- {
- typedef allocator<_Other> other;
- };
+ template <class _Other>
+ struct rebind {
+ typedef allocator<_Other> other;
+ };
};
-template<class _Tp> class _LIBCPP_TEMPLATE_VIS enable_shared_from_this;
+template <class _Tp>
+class _LIBCPP_TEMPLATE_VIS enable_shared_from_this;
// http://eel.is/c++draft/util.sharedptr#util.smartptr.shared.general-6
// A pointer type Y* is said to be compatible with a pointer type T*
@@ -395,19 +345,13 @@ template <class _Yp, class _Tp>
struct __bounded_convertible_to_unbounded : false_type {};
template <class _Up, std::size_t _Np, class _Tp>
-struct __bounded_convertible_to_unbounded<_Up[_Np], _Tp>
- : is_same<__remove_cv_t<_Tp>, _Up[]> {};
+struct __bounded_convertible_to_unbounded<_Up[_Np], _Tp> : is_same<__remove_cv_t<_Tp>, _Up[]> {};
template <class _Yp, class _Tp>
-struct __compatible_with
- : _Or<
- is_convertible<_Yp*, _Tp*>,
- __bounded_convertible_to_unbounded<_Yp, _Tp>
- > {};
+struct __compatible_with : _Or< is_convertible<_Yp*, _Tp*>, __bounded_convertible_to_unbounded<_Yp, _Tp> > {};
#else
template <class _Yp, class _Tp>
-struct __compatible_with
- : is_convertible<_Yp*, _Tp*> {};
+struct __compatible_with : is_convertible<_Yp*, _Tp*> {};
#endif // _LIBCPP_STD_VER >= 17
// Constructors that take raw pointers have a different set of "compatible" constraints
@@ -417,40 +361,32 @@ struct __compatible_with
// - If T is not an array type, then Y* is convertible to T*.
#if _LIBCPP_STD_VER >= 17
template <class _Yp, class _Tp, class = void>
-struct __raw_pointer_compatible_with : _And<
- _Not<is_array<_Tp>>,
- is_convertible<_Yp*, _Tp*>
- > {};
+struct __raw_pointer_compatible_with : _And< _Not<is_array<_Tp>>, is_convertible<_Yp*, _Tp*> > {};
template <class _Yp, class _Up, std::size_t _Np>
-struct __raw_pointer_compatible_with<_Yp, _Up[_Np], __enable_if_t<
- is_convertible<_Yp(*)[_Np], _Up(*)[_Np]>::value> >
- : true_type {};
+struct __raw_pointer_compatible_with<_Yp, _Up[_Np], __enable_if_t< is_convertible<_Yp (*)[_Np], _Up (*)[_Np]>::value> >
+ : true_type {};
template <class _Yp, class _Up>
-struct __raw_pointer_compatible_with<_Yp, _Up[], __enable_if_t<
- is_convertible<_Yp(*)[], _Up(*)[]>::value> >
- : true_type {};
+struct __raw_pointer_compatible_with<_Yp, _Up[], __enable_if_t< is_convertible<_Yp (*)[], _Up (*)[]>::value> >
+ : true_type {};
#else
template <class _Yp, class _Tp>
-struct __raw_pointer_compatible_with
- : is_convertible<_Yp*, _Tp*> {};
+struct __raw_pointer_compatible_with : is_convertible<_Yp*, _Tp*> {};
#endif // _LIBCPP_STD_VER >= 17
-
template <class _Ptr, class = void>
-struct __is_deletable : false_type { };
+struct __is_deletable : false_type {};
template <class _Ptr>
-struct __is_deletable<_Ptr, decltype(delete std::declval<_Ptr>())> : true_type { };
+struct __is_deletable<_Ptr, decltype(delete std::declval<_Ptr>())> : true_type {};
template <class _Ptr, class = void>
-struct __is_array_deletable : false_type { };
+struct __is_array_deletable : false_type {};
template <class _Ptr>
-struct __is_array_deletable<_Ptr, decltype(delete[] std::declval<_Ptr>())> : true_type { };
+struct __is_array_deletable<_Ptr, decltype(delete[] std::declval<_Ptr>())> : true_type {};
-template <class _Dp, class _Pt,
- class = decltype(std::declval<_Dp>()(std::declval<_Pt>()))>
+template <class _Dp, class _Pt, class = decltype(std::declval<_Dp>()(std::declval<_Pt>()))>
true_type __well_formed_deleter_test(int);
template <class, class>
@@ -459,12 +395,10 @@ false_type __well_formed_deleter_test(...);
template <class _Dp, class _Pt>
struct __well_formed_deleter : decltype(std::__well_formed_deleter_test<_Dp, _Pt>(0)) {};
-template<class _Dp, class _Yp, class _Tp>
-struct __shared_ptr_deleter_ctor_reqs
-{
- static const bool value = __raw_pointer_compatible_with<_Yp, _Tp>::value &&
- is_move_constructible<_Dp>::value &&
- __well_formed_deleter<_Dp, _Yp*>::value;
+template <class _Dp, class _Yp, class _Tp>
+struct __shared_ptr_deleter_ctor_reqs {
+ static const bool value = __raw_pointer_compatible_with<_Yp, _Tp>::value && is_move_constructible<_Dp>::value &&
+ __well_formed_deleter<_Dp, _Yp*>::value;
};
#if defined(_LIBCPP_ABI_ENABLE_SHARED_PTR_TRIVIAL_ABI)
@@ -473,583 +407,437 @@ struct __shared_ptr_deleter_ctor_reqs
# define _LIBCPP_SHARED_PTR_TRIVIAL_ABI
#endif
-template<class _Tp>
-class _LIBCPP_SHARED_PTR_TRIVIAL_ABI _LIBCPP_TEMPLATE_VIS shared_ptr
-{
+template <class _Tp>
+class _LIBCPP_SHARED_PTR_TRIVIAL_ABI _LIBCPP_TEMPLATE_VIS shared_ptr {
public:
#if _LIBCPP_STD_VER >= 17
- typedef weak_ptr<_Tp> weak_type;
- typedef remove_extent_t<_Tp> element_type;
+ typedef weak_ptr<_Tp> weak_type;
+ typedef remove_extent_t<_Tp> element_type;
#else
- typedef _Tp element_type;
+ typedef _Tp element_type;
#endif
private:
- element_type* __ptr_;
- __shared_weak_count* __cntrl_;
+ element_type* __ptr_;
+ __shared_weak_count* __cntrl_;
public:
- _LIBCPP_HIDE_FROM_ABI
- _LIBCPP_CONSTEXPR shared_ptr() _NOEXCEPT
- : __ptr_(nullptr),
- __cntrl_(nullptr)
- { }
-
- _LIBCPP_HIDE_FROM_ABI
- _LIBCPP_CONSTEXPR shared_ptr(nullptr_t) _NOEXCEPT
- : __ptr_(nullptr),
- __cntrl_(nullptr)
- { }
-
- template<class _Yp, class = __enable_if_t<
- _And<
- __raw_pointer_compatible_with<_Yp, _Tp>
- // In C++03 we get errors when trying to do SFINAE with the
- // delete operator, so we always pretend that it's deletable.
- // The same happens on GCC.
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR shared_ptr() _NOEXCEPT : __ptr_(nullptr), __cntrl_(nullptr) {}
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR shared_ptr(nullptr_t) _NOEXCEPT : __ptr_(nullptr), __cntrl_(nullptr) {}
+
+ template <class _Yp,
+ class = __enable_if_t< _And< __raw_pointer_compatible_with<_Yp, _Tp>
+ // In C++03 we get errors when trying to do SFINAE with the
+ // delete operator, so we always pretend that it's deletable.
+ // The same happens on GCC.
#if !defined(_LIBCPP_CXX03_LANG) && !defined(_LIBCPP_COMPILER_GCC)
- , _If<is_array<_Tp>::value, __is_array_deletable<_Yp*>, __is_deletable<_Yp*> >
+ ,
+ _If<is_array<_Tp>::value, __is_array_deletable<_Yp*>, __is_deletable<_Yp*> >
#endif
- >::value
- > >
- _LIBCPP_HIDE_FROM_ABI explicit shared_ptr(_Yp* __p) : __ptr_(__p) {
- unique_ptr<_Yp> __hold(__p);
- typedef typename __shared_ptr_default_allocator<_Yp>::type _AllocT;
- typedef __shared_ptr_pointer<_Yp*, __shared_ptr_default_delete<_Tp, _Yp>, _AllocT> _CntrlBlk;
- __cntrl_ = new _CntrlBlk(__p, __shared_ptr_default_delete<_Tp, _Yp>(), _AllocT());
- __hold.release();
- __enable_weak_this(__p, __p);
- }
-
- template<class _Yp, class _Dp, class = __enable_if_t<__shared_ptr_deleter_ctor_reqs<_Dp, _Yp, _Tp>::value> >
- _LIBCPP_HIDE_FROM_ABI
- shared_ptr(_Yp* __p, _Dp __d)
- : __ptr_(__p)
- {
+ >::value > >
+ _LIBCPP_HIDE_FROM_ABI explicit shared_ptr(_Yp* __p) : __ptr_(__p) {
+ unique_ptr<_Yp> __hold(__p);
+ typedef typename __shared_ptr_default_allocator<_Yp>::type _AllocT;
+ typedef __shared_ptr_pointer<_Yp*, __shared_ptr_default_delete<_Tp, _Yp>, _AllocT> _CntrlBlk;
+ __cntrl_ = new _CntrlBlk(__p, __shared_ptr_default_delete<_Tp, _Yp>(), _AllocT());
+ __hold.release();
+ __enable_weak_this(__p, __p);
+ }
+
+ template <class _Yp, class _Dp, class = __enable_if_t<__shared_ptr_deleter_ctor_reqs<_Dp, _Yp, _Tp>::value> >
+ _LIBCPP_HIDE_FROM_ABI shared_ptr(_Yp* __p, _Dp __d) : __ptr_(__p) {
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- try
- {
+ try {
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- typedef typename __shared_ptr_default_allocator<_Yp>::type _AllocT;
- typedef __shared_ptr_pointer<_Yp*, _Dp, _AllocT> _CntrlBlk;
+ typedef typename __shared_ptr_default_allocator<_Yp>::type _AllocT;
+ typedef __shared_ptr_pointer<_Yp*, _Dp, _AllocT> _CntrlBlk;
#ifndef _LIBCPP_CXX03_LANG
- __cntrl_ = new _CntrlBlk(__p, std::move(__d), _AllocT());
+ __cntrl_ = new _CntrlBlk(__p, std::move(__d), _AllocT());
#else
- __cntrl_ = new _CntrlBlk(__p, __d, _AllocT());
+ __cntrl_ = new _CntrlBlk(__p, __d, _AllocT());
#endif // not _LIBCPP_CXX03_LANG
- __enable_weak_this(__p, __p);
+ __enable_weak_this(__p, __p);
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- }
- catch (...)
- {
- __d(__p);
- throw;
- }
-#endif // _LIBCPP_HAS_NO_EXCEPTIONS
+ } catch (...) {
+ __d(__p);
+ throw;
}
+#endif // _LIBCPP_HAS_NO_EXCEPTIONS
+ }
- template<class _Yp, class _Dp, class _Alloc, class = __enable_if_t<__shared_ptr_deleter_ctor_reqs<_Dp, _Yp, _Tp>::value> >
- _LIBCPP_HIDE_FROM_ABI
- shared_ptr(_Yp* __p, _Dp __d, _Alloc __a)
- : __ptr_(__p)
- {
+ template <class _Yp,
+ class _Dp,
+ class _Alloc,
+ class = __enable_if_t<__shared_ptr_deleter_ctor_reqs<_Dp, _Yp, _Tp>::value> >
+ _LIBCPP_HIDE_FROM_ABI shared_ptr(_Yp* __p, _Dp __d, _Alloc __a) : __ptr_(__p) {
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- try
- {
+ try {
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- typedef __shared_ptr_pointer<_Yp*, _Dp, _Alloc> _CntrlBlk;
- typedef typename __allocator_traits_rebind<_Alloc, _CntrlBlk>::type _A2;
- typedef __allocator_destructor<_A2> _D2;
- _A2 __a2(__a);
- unique_ptr<_CntrlBlk, _D2> __hold2(__a2.allocate(1), _D2(__a2, 1));
- ::new ((void*)std::addressof(*__hold2.get()))
+ typedef __shared_ptr_pointer<_Yp*, _Dp, _Alloc> _CntrlBlk;
+ typedef typename __allocator_traits_rebind<_Alloc, _CntrlBlk>::type _A2;
+ typedef __allocator_destructor<_A2> _D2;
+ _A2 __a2(__a);
+ unique_ptr<_CntrlBlk, _D2> __hold2(__a2.allocate(1), _D2(__a2, 1));
+ ::new ((void*)std::addressof(*__hold2.get()))
#ifndef _LIBCPP_CXX03_LANG
- _CntrlBlk(__p, std::move(__d), __a);
+ _CntrlBlk(__p, std::move(__d), __a);
#else
- _CntrlBlk(__p, __d, __a);
+ _CntrlBlk(__p, __d, __a);
#endif // not _LIBCPP_CXX03_LANG
- __cntrl_ = std::addressof(*__hold2.release());
- __enable_weak_this(__p, __p);
+ __cntrl_ = std::addressof(*__hold2.release());
+ __enable_weak_this(__p, __p);
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- }
- catch (...)
- {
- __d(__p);
- throw;
- }
-#endif // _LIBCPP_HAS_NO_EXCEPTIONS
+ } catch (...) {
+ __d(__p);
+ throw;
}
+#endif // _LIBCPP_HAS_NO_EXCEPTIONS
+ }
- template<class _Dp>
- _LIBCPP_HIDE_FROM_ABI
- shared_ptr(nullptr_t __p, _Dp __d)
- : __ptr_(nullptr)
- {
+ template <class _Dp>
+ _LIBCPP_HIDE_FROM_ABI shared_ptr(nullptr_t __p, _Dp __d) : __ptr_(nullptr) {
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- try
- {
+ try {
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- typedef typename __shared_ptr_default_allocator<_Tp>::type _AllocT;
- typedef __shared_ptr_pointer<nullptr_t, _Dp, _AllocT> _CntrlBlk;
+ typedef typename __shared_ptr_default_allocator<_Tp>::type _AllocT;
+ typedef __shared_ptr_pointer<nullptr_t, _Dp, _AllocT> _CntrlBlk;
#ifndef _LIBCPP_CXX03_LANG
- __cntrl_ = new _CntrlBlk(__p, std::move(__d), _AllocT());
+ __cntrl_ = new _CntrlBlk(__p, std::move(__d), _AllocT());
#else
- __cntrl_ = new _CntrlBlk(__p, __d, _AllocT());
+ __cntrl_ = new _CntrlBlk(__p, __d, _AllocT());
#endif // not _LIBCPP_CXX03_LANG
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- }
- catch (...)
- {
- __d(__p);
- throw;
- }
-#endif // _LIBCPP_HAS_NO_EXCEPTIONS
+ } catch (...) {
+ __d(__p);
+ throw;
}
+#endif // _LIBCPP_HAS_NO_EXCEPTIONS
+ }
- template<class _Dp, class _Alloc>
- _LIBCPP_HIDE_FROM_ABI
- shared_ptr(nullptr_t __p, _Dp __d, _Alloc __a)
- : __ptr_(nullptr)
- {
+ template <class _Dp, class _Alloc>
+ _LIBCPP_HIDE_FROM_ABI shared_ptr(nullptr_t __p, _Dp __d, _Alloc __a) : __ptr_(nullptr) {
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- try
- {
+ try {
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- typedef __shared_ptr_pointer<nullptr_t, _Dp, _Alloc> _CntrlBlk;
- typedef typename __allocator_traits_rebind<_Alloc, _CntrlBlk>::type _A2;
- typedef __allocator_destructor<_A2> _D2;
- _A2 __a2(__a);
- unique_ptr<_CntrlBlk, _D2> __hold2(__a2.allocate(1), _D2(__a2, 1));
- ::new ((void*)std::addressof(*__hold2.get()))
+ typedef __shared_ptr_pointer<nullptr_t, _Dp, _Alloc> _CntrlBlk;
+ typedef typename __allocator_traits_rebind<_Alloc, _CntrlBlk>::type _A2;
+ typedef __allocator_destructor<_A2> _D2;
+ _A2 __a2(__a);
+ unique_ptr<_CntrlBlk, _D2> __hold2(__a2.allocate(1), _D2(__a2, 1));
+ ::new ((void*)std::addressof(*__hold2.get()))
#ifndef _LIBCPP_CXX03_LANG
- _CntrlBlk(__p, std::move(__d), __a);
+ _CntrlBlk(__p, std::move(__d), __a);
#else
- _CntrlBlk(__p, __d, __a);
+ _CntrlBlk(__p, __d, __a);
#endif // not _LIBCPP_CXX03_LANG
- __cntrl_ = std::addressof(*__hold2.release());
+ __cntrl_ = std::addressof(*__hold2.release());
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- }
- catch (...)
- {
- __d(__p);
- throw;
- }
-#endif // _LIBCPP_HAS_NO_EXCEPTIONS
+ } catch (...) {
+ __d(__p);
+ throw;
}
+#endif // _LIBCPP_HAS_NO_EXCEPTIONS
+ }
- template<class _Yp>
- _LIBCPP_HIDE_FROM_ABI
- shared_ptr(const shared_ptr<_Yp>& __r, element_type *__p) _NOEXCEPT
- : __ptr_(__p),
- __cntrl_(__r.__cntrl_)
- {
- if (__cntrl_)
- __cntrl_->__add_shared();
- }
+ template <class _Yp>
+ _LIBCPP_HIDE_FROM_ABI shared_ptr(const shared_ptr<_Yp>& __r, element_type* __p) _NOEXCEPT
+ : __ptr_(__p),
+ __cntrl_(__r.__cntrl_) {
+ if (__cntrl_)
+ __cntrl_->__add_shared();
+ }
// LWG-2996
// We don't backport because it is an evolutionary change.
#if _LIBCPP_STD_VER >= 20
- template <class _Yp>
- _LIBCPP_HIDE_FROM_ABI shared_ptr(shared_ptr<_Yp>&& __r, element_type* __p) noexcept
- : __ptr_(__p),
- __cntrl_(__r.__cntrl_) {
- __r.__ptr_ = nullptr;
- __r.__cntrl_ = nullptr;
- }
+ template <class _Yp>
+ _LIBCPP_HIDE_FROM_ABI shared_ptr(shared_ptr<_Yp>&& __r, element_type* __p) noexcept
+ : __ptr_(__p), __cntrl_(__r.__cntrl_) {
+ __r.__ptr_ = nullptr;
+ __r.__cntrl_ = nullptr;
+ }
#endif
- _LIBCPP_HIDE_FROM_ABI
- shared_ptr(const shared_ptr& __r) _NOEXCEPT
- : __ptr_(__r.__ptr_),
- __cntrl_(__r.__cntrl_)
- {
- if (__cntrl_)
- __cntrl_->__add_shared();
- }
+ _LIBCPP_HIDE_FROM_ABI shared_ptr(const shared_ptr& __r) _NOEXCEPT : __ptr_(__r.__ptr_), __cntrl_(__r.__cntrl_) {
+ if (__cntrl_)
+ __cntrl_->__add_shared();
+ }
- template<class _Yp, class = __enable_if_t<__compatible_with<_Yp, _Tp>::value> >
- _LIBCPP_HIDE_FROM_ABI
- shared_ptr(const shared_ptr<_Yp>& __r) _NOEXCEPT
- : __ptr_(__r.__ptr_),
- __cntrl_(__r.__cntrl_)
- {
- if (__cntrl_)
- __cntrl_->__add_shared();
- }
+ template <class _Yp, class = __enable_if_t<__compatible_with<_Yp, _Tp>::value> >
+ _LIBCPP_HIDE_FROM_ABI shared_ptr(const shared_ptr<_Yp>& __r) _NOEXCEPT : __ptr_(__r.__ptr_), __cntrl_(__r.__cntrl_) {
+ if (__cntrl_)
+ __cntrl_->__add_shared();
+ }
- _LIBCPP_HIDE_FROM_ABI
- shared_ptr(shared_ptr&& __r) _NOEXCEPT
- : __ptr_(__r.__ptr_),
- __cntrl_(__r.__cntrl_)
- {
- __r.__ptr_ = nullptr;
- __r.__cntrl_ = nullptr;
- }
+ _LIBCPP_HIDE_FROM_ABI shared_ptr(shared_ptr&& __r) _NOEXCEPT : __ptr_(__r.__ptr_), __cntrl_(__r.__cntrl_) {
+ __r.__ptr_ = nullptr;
+ __r.__cntrl_ = nullptr;
+ }
- template<class _Yp, class = __enable_if_t<__compatible_with<_Yp, _Tp>::value> >
- _LIBCPP_HIDE_FROM_ABI
- shared_ptr(shared_ptr<_Yp>&& __r) _NOEXCEPT
- : __ptr_(__r.__ptr_),
- __cntrl_(__r.__cntrl_)
- {
- __r.__ptr_ = nullptr;
- __r.__cntrl_ = nullptr;
- }
+ template <class _Yp, class = __enable_if_t<__compatible_with<_Yp, _Tp>::value> >
+ _LIBCPP_HIDE_FROM_ABI shared_ptr(shared_ptr<_Yp>&& __r) _NOEXCEPT : __ptr_(__r.__ptr_), __cntrl_(__r.__cntrl_) {
+ __r.__ptr_ = nullptr;
+ __r.__cntrl_ = nullptr;
+ }
- template<class _Yp, class = __enable_if_t<__compatible_with<_Yp, _Tp>::value> >
- _LIBCPP_HIDE_FROM_ABI
- explicit shared_ptr(const weak_ptr<_Yp>& __r)
- : __ptr_(__r.__ptr_),
- __cntrl_(__r.__cntrl_ ? __r.__cntrl_->lock() : __r.__cntrl_)
- {
- if (__cntrl_ == nullptr)
- __throw_bad_weak_ptr();
- }
+ template <class _Yp, class = __enable_if_t<__compatible_with<_Yp, _Tp>::value> >
+ _LIBCPP_HIDE_FROM_ABI explicit shared_ptr(const weak_ptr<_Yp>& __r)
+ : __ptr_(__r.__ptr_), __cntrl_(__r.__cntrl_ ? __r.__cntrl_->lock() : __r.__cntrl_) {
+ if (__cntrl_ == nullptr)
+ __throw_bad_weak_ptr();
+ }
#if _LIBCPP_STD_VER <= 14 || defined(_LIBCPP_ENABLE_CXX17_REMOVED_AUTO_PTR)
- template<class _Yp, class = __enable_if_t<is_convertible<_Yp*, element_type*>::value> >
- _LIBCPP_HIDE_FROM_ABI
- shared_ptr(auto_ptr<_Yp>&& __r)
- : __ptr_(__r.get())
- {
- typedef __shared_ptr_pointer<_Yp*, default_delete<_Yp>, allocator<_Yp> > _CntrlBlk;
- __cntrl_ = new _CntrlBlk(__r.get(), default_delete<_Yp>(), allocator<_Yp>());
- __enable_weak_this(__r.get(), __r.get());
- __r.release();
- }
+ template <class _Yp, class = __enable_if_t<is_convertible<_Yp*, element_type*>::value> >
+ _LIBCPP_HIDE_FROM_ABI shared_ptr(auto_ptr<_Yp>&& __r) : __ptr_(__r.get()) {
+ typedef __shared_ptr_pointer<_Yp*, default_delete<_Yp>, allocator<_Yp> > _CntrlBlk;
+ __cntrl_ = new _CntrlBlk(__r.get(), default_delete<_Yp>(), allocator<_Yp>());
+ __enable_weak_this(__r.get(), __r.get());
+ __r.release();
+ }
#endif
- template <class _Yp, class _Dp, class = __enable_if_t<
- !is_lvalue_reference<_Dp>::value &&
- __compatible_with<_Yp, _Tp>::value &&
- is_convertible<typename unique_ptr<_Yp, _Dp>::pointer, element_type*>::value
- > >
- _LIBCPP_HIDE_FROM_ABI
- shared_ptr(unique_ptr<_Yp, _Dp>&& __r)
- : __ptr_(__r.get())
- {
+ template <class _Yp,
+ class _Dp,
+ class = __enable_if_t< !is_lvalue_reference<_Dp>::value && __compatible_with<_Yp, _Tp>::value &&
+ is_convertible<typename unique_ptr<_Yp, _Dp>::pointer, element_type*>::value > >
+ _LIBCPP_HIDE_FROM_ABI shared_ptr(unique_ptr<_Yp, _Dp>&& __r) : __ptr_(__r.get()) {
#if _LIBCPP_STD_VER >= 14
- if (__ptr_ == nullptr)
- __cntrl_ = nullptr;
- else
+ if (__ptr_ == nullptr)
+ __cntrl_ = nullptr;
+ else
#endif
- {
- typedef typename __shared_ptr_default_allocator<_Yp>::type _AllocT;
- typedef __shared_ptr_pointer<typename unique_ptr<_Yp, _Dp>::pointer, _Dp, _AllocT> _CntrlBlk;
- __cntrl_ = new _CntrlBlk(__r.get(), std::move(__r.get_deleter()), _AllocT());
- __enable_weak_this(__r.get(), __r.get());
- }
- __r.release();
- }
-
- template <class _Yp, class _Dp, class = void, class = __enable_if_t<
- is_lvalue_reference<_Dp>::value &&
- __compatible_with<_Yp, _Tp>::value &&
- is_convertible<typename unique_ptr<_Yp, _Dp>::pointer, element_type*>::value
- > >
- _LIBCPP_HIDE_FROM_ABI
- shared_ptr(unique_ptr<_Yp, _Dp>&& __r)
- : __ptr_(__r.get())
{
+ typedef typename __shared_ptr_default_allocator<_Yp>::type _AllocT;
+ typedef __shared_ptr_pointer<typename unique_ptr<_Yp, _Dp>::pointer, _Dp, _AllocT> _CntrlBlk;
+ __cntrl_ = new _CntrlBlk(__r.get(), std::move(__r.get_deleter()), _AllocT());
+ __enable_weak_this(__r.get(), __r.get());
+ }
+ __r.release();
+ }
+
+ template <class _Yp,
+ class _Dp,
+ class = void,
+ class = __enable_if_t< is_lvalue_reference<_Dp>::value && __compatible_with<_Yp, _Tp>::value &&
+ is_convertible<typename unique_ptr<_Yp, _Dp>::pointer, element_type*>::value > >
+ _LIBCPP_HIDE_FROM_ABI shared_ptr(unique_ptr<_Yp, _Dp>&& __r) : __ptr_(__r.get()) {
#if _LIBCPP_STD_VER >= 14
- if (__ptr_ == nullptr)
- __cntrl_ = nullptr;
- else
+ if (__ptr_ == nullptr)
+ __cntrl_ = nullptr;
+ else
#endif
- {
- typedef typename __shared_ptr_default_allocator<_Yp>::type _AllocT;
- typedef __shared_ptr_pointer<typename unique_ptr<_Yp, _Dp>::pointer,
- reference_wrapper<__libcpp_remove_reference_t<_Dp> >,
- _AllocT> _CntrlBlk;
- __cntrl_ = new _CntrlBlk(__r.get(), std::ref(__r.get_deleter()), _AllocT());
- __enable_weak_this(__r.get(), __r.get());
- }
- __r.release();
- }
-
- _LIBCPP_HIDE_FROM_ABI
- ~shared_ptr()
{
- if (__cntrl_)
- __cntrl_->__release_shared();
+ typedef typename __shared_ptr_default_allocator<_Yp>::type _AllocT;
+ typedef __shared_ptr_pointer<typename unique_ptr<_Yp, _Dp>::pointer,
+ reference_wrapper<__libcpp_remove_reference_t<_Dp> >,
+ _AllocT>
+ _CntrlBlk;
+ __cntrl_ = new _CntrlBlk(__r.get(), std::ref(__r.get_deleter()), _AllocT());
+ __enable_weak_this(__r.get(), __r.get());
}
+ __r.release();
+ }
- _LIBCPP_HIDE_FROM_ABI
- shared_ptr<_Tp>& operator=(const shared_ptr& __r) _NOEXCEPT
- {
- shared_ptr(__r).swap(*this);
- return *this;
- }
+ _LIBCPP_HIDE_FROM_ABI ~shared_ptr() {
+ if (__cntrl_)
+ __cntrl_->__release_shared();
+ }
- template<class _Yp, class = __enable_if_t<__compatible_with<_Yp, _Tp>::value> >
- _LIBCPP_HIDE_FROM_ABI
- shared_ptr<_Tp>& operator=(const shared_ptr<_Yp>& __r) _NOEXCEPT
- {
- shared_ptr(__r).swap(*this);
- return *this;
- }
+ _LIBCPP_HIDE_FROM_ABI shared_ptr<_Tp>& operator=(const shared_ptr& __r) _NOEXCEPT {
+ shared_ptr(__r).swap(*this);
+ return *this;
+ }
- _LIBCPP_HIDE_FROM_ABI
- shared_ptr<_Tp>& operator=(shared_ptr&& __r) _NOEXCEPT
- {
- shared_ptr(std::move(__r)).swap(*this);
- return *this;
- }
+ template <class _Yp, class = __enable_if_t<__compatible_with<_Yp, _Tp>::value> >
+ _LIBCPP_HIDE_FROM_ABI shared_ptr<_Tp>& operator=(const shared_ptr<_Yp>& __r) _NOEXCEPT {
+ shared_ptr(__r).swap(*this);
+ return *this;
+ }
- template<class _Yp, class = __enable_if_t<__compatible_with<_Yp, _Tp>::value> >
- _LIBCPP_HIDE_FROM_ABI
- shared_ptr<_Tp>& operator=(shared_ptr<_Yp>&& __r)
- {
- shared_ptr(std::move(__r)).swap(*this);
- return *this;
- }
+ _LIBCPP_HIDE_FROM_ABI shared_ptr<_Tp>& operator=(shared_ptr&& __r) _NOEXCEPT {
+ shared_ptr(std::move(__r)).swap(*this);
+ return *this;
+ }
+
+ template <class _Yp, class = __enable_if_t<__compatible_with<_Yp, _Tp>::value> >
+ _LIBCPP_HIDE_FROM_ABI shared_ptr<_Tp>& operator=(shared_ptr<_Yp>&& __r) {
+ shared_ptr(std::move(__r)).swap(*this);
+ return *this;
+ }
#if _LIBCPP_STD_VER <= 14 || defined(_LIBCPP_ENABLE_CXX17_REMOVED_AUTO_PTR)
- template<class _Yp, class = __enable_if_t<
- !is_array<_Yp>::value &&
- is_convertible<_Yp*, typename shared_ptr<_Tp>::element_type*>::value
- > >
- _LIBCPP_HIDE_FROM_ABI
- shared_ptr<_Tp>& operator=(auto_ptr<_Yp>&& __r)
- {
- shared_ptr(std::move(__r)).swap(*this);
- return *this;
- }
+ template <class _Yp,
+ class = __enable_if_t< !is_array<_Yp>::value &&
+ is_convertible<_Yp*, typename shared_ptr<_Tp>::element_type*>::value > >
+ _LIBCPP_HIDE_FROM_ABI shared_ptr<_Tp>& operator=(auto_ptr<_Yp>&& __r) {
+ shared_ptr(std::move(__r)).swap(*this);
+ return *this;
+ }
#endif
- template <class _Yp, class _Dp, class = __enable_if_t<_And<
- __compatible_with<_Yp, _Tp>,
- is_convertible<typename unique_ptr<_Yp, _Dp>::pointer, element_type*>
- >::value> >
- _LIBCPP_HIDE_FROM_ABI
- shared_ptr<_Tp>& operator=(unique_ptr<_Yp, _Dp>&& __r)
- {
- shared_ptr(std::move(__r)).swap(*this);
- return *this;
- }
+ template <
+ class _Yp,
+ class _Dp,
+ class = __enable_if_t<_And< __compatible_with<_Yp, _Tp>,
+ is_convertible<typename unique_ptr<_Yp, _Dp>::pointer, element_type*> >::value> >
+ _LIBCPP_HIDE_FROM_ABI shared_ptr<_Tp>& operator=(unique_ptr<_Yp, _Dp>&& __r) {
+ shared_ptr(std::move(__r)).swap(*this);
+ return *this;
+ }
- _LIBCPP_HIDE_FROM_ABI
- void swap(shared_ptr& __r) _NOEXCEPT
- {
- std::swap(__ptr_, __r.__ptr_);
- std::swap(__cntrl_, __r.__cntrl_);
- }
+ _LIBCPP_HIDE_FROM_ABI void swap(shared_ptr& __r) _NOEXCEPT {
+ std::swap(__ptr_, __r.__ptr_);
+ std::swap(__cntrl_, __r.__cntrl_);
+ }
- _LIBCPP_HIDE_FROM_ABI
- void reset() _NOEXCEPT
- {
- shared_ptr().swap(*this);
- }
+ _LIBCPP_HIDE_FROM_ABI void reset() _NOEXCEPT { shared_ptr().swap(*this); }
- template<class _Yp, class = __enable_if_t<
- __raw_pointer_compatible_with<_Yp, _Tp>::value
- > >
- _LIBCPP_HIDE_FROM_ABI
- void reset(_Yp* __p)
- {
- shared_ptr(__p).swap(*this);
- }
+ template <class _Yp, class = __enable_if_t< __raw_pointer_compatible_with<_Yp, _Tp>::value > >
+ _LIBCPP_HIDE_FROM_ABI void reset(_Yp* __p) {
+ shared_ptr(__p).swap(*this);
+ }
- template<class _Yp, class _Dp, class = __enable_if_t<
- __shared_ptr_deleter_ctor_reqs<_Dp, _Yp, _Tp>::value> >
- _LIBCPP_HIDE_FROM_ABI
- void reset(_Yp* __p, _Dp __d)
- {
- shared_ptr(__p, __d).swap(*this);
- }
+ template <class _Yp, class _Dp, class = __enable_if_t< __shared_ptr_deleter_ctor_reqs<_Dp, _Yp, _Tp>::value> >
+ _LIBCPP_HIDE_FROM_ABI void reset(_Yp* __p, _Dp __d) {
+ shared_ptr(__p, __d).swap(*this);
+ }
- template<class _Yp, class _Dp, class _Alloc, class = __enable_if_t<
- __shared_ptr_deleter_ctor_reqs<_Dp, _Yp, _Tp>::value> >
- _LIBCPP_HIDE_FROM_ABI
- void reset(_Yp* __p, _Dp __d, _Alloc __a)
- {
- shared_ptr(__p, __d, __a).swap(*this);
- }
+ template <class _Yp,
+ class _Dp,
+ class _Alloc,
+ class = __enable_if_t< __shared_ptr_deleter_ctor_reqs<_Dp, _Yp, _Tp>::value> >
+ _LIBCPP_HIDE_FROM_ABI void reset(_Yp* __p, _Dp __d, _Alloc __a) {
+ shared_ptr(__p, __d, __a).swap(*this);
+ }
- _LIBCPP_HIDE_FROM_ABI
- element_type* get() const _NOEXCEPT
- {
- return __ptr_;
- }
+ _LIBCPP_HIDE_FROM_ABI element_type* get() const _NOEXCEPT { return __ptr_; }
- _LIBCPP_HIDE_FROM_ABI
- __add_lvalue_reference_t<element_type> operator*() const _NOEXCEPT
- {
- return *__ptr_;
- }
+ _LIBCPP_HIDE_FROM_ABI __add_lvalue_reference_t<element_type> operator*() const _NOEXCEPT { return *__ptr_; }
- _LIBCPP_HIDE_FROM_ABI
- element_type* operator->() const _NOEXCEPT
- {
- static_assert(!is_array<_Tp>::value,
- "std::shared_ptr<T>::operator-> is only valid when T is not an array type.");
- return __ptr_;
- }
+ _LIBCPP_HIDE_FROM_ABI element_type* operator->() const _NOEXCEPT {
+ static_assert(!is_array<_Tp>::value, "std::shared_ptr<T>::operator-> is only valid when T is not an array type.");
+ return __ptr_;
+ }
- _LIBCPP_HIDE_FROM_ABI
- long use_count() const _NOEXCEPT
- {
- return __cntrl_ ? __cntrl_->use_count() : 0;
- }
+ _LIBCPP_HIDE_FROM_ABI long use_count() const _NOEXCEPT { return __cntrl_ ? __cntrl_->use_count() : 0; }
- _LIBCPP_HIDE_FROM_ABI
- bool unique() const _NOEXCEPT
- {
- return use_count() == 1;
- }
+ _LIBCPP_HIDE_FROM_ABI bool unique() const _NOEXCEPT { return use_count() == 1; }
- _LIBCPP_HIDE_FROM_ABI
- explicit operator bool() const _NOEXCEPT
- {
- return get() != nullptr;
- }
+ _LIBCPP_HIDE_FROM_ABI explicit operator bool() const _NOEXCEPT { return get() != nullptr; }
- template <class _Up>
- _LIBCPP_HIDE_FROM_ABI
- bool owner_before(shared_ptr<_Up> const& __p) const _NOEXCEPT
- {
- return __cntrl_ < __p.__cntrl_;
- }
+ template <class _Up>
+ _LIBCPP_HIDE_FROM_ABI bool owner_before(shared_ptr<_Up> const& __p) const _NOEXCEPT {
+ return __cntrl_ < __p.__cntrl_;
+ }
- template <class _Up>
- _LIBCPP_HIDE_FROM_ABI
- bool owner_before(weak_ptr<_Up> const& __p) const _NOEXCEPT
- {
- return __cntrl_ < __p.__cntrl_;
- }
+ template <class _Up>
+ _LIBCPP_HIDE_FROM_ABI bool owner_before(weak_ptr<_Up> const& __p) const _NOEXCEPT {
+ return __cntrl_ < __p.__cntrl_;
+ }
- _LIBCPP_HIDE_FROM_ABI
- bool __owner_equivalent(const shared_ptr& __p) const
- {
- return __cntrl_ == __p.__cntrl_;
- }
+ _LIBCPP_HIDE_FROM_ABI bool __owner_equivalent(const shared_ptr& __p) const { return __cntrl_ == __p.__cntrl_; }
#if _LIBCPP_STD_VER >= 17
- _LIBCPP_HIDE_FROM_ABI
- __add_lvalue_reference_t<element_type> operator[](ptrdiff_t __i) const
- {
- static_assert(is_array<_Tp>::value,
- "std::shared_ptr<T>::operator[] is only valid when T is an array type.");
- return __ptr_[__i];
- }
+ _LIBCPP_HIDE_FROM_ABI __add_lvalue_reference_t<element_type> operator[](ptrdiff_t __i) const {
+ static_assert(is_array<_Tp>::value, "std::shared_ptr<T>::operator[] is only valid when T is an array type.");
+ return __ptr_[__i];
+ }
#endif
#ifndef _LIBCPP_HAS_NO_RTTI
- template <class _Dp>
- _LIBCPP_HIDE_FROM_ABI
- _Dp* __get_deleter() const _NOEXCEPT
- {
- return static_cast<_Dp*>(__cntrl_
- ? const_cast<void *>(__cntrl_->__get_deleter(typeid(_Dp)))
- : nullptr);
- }
+ template <class _Dp>
+ _LIBCPP_HIDE_FROM_ABI _Dp* __get_deleter() const _NOEXCEPT {
+ return static_cast<_Dp*>(__cntrl_ ? const_cast<void*>(__cntrl_->__get_deleter(typeid(_Dp))) : nullptr);
+ }
#endif // _LIBCPP_HAS_NO_RTTI
- template<class _Yp, class _CntrlBlk>
- _LIBCPP_HIDE_FROM_ABI
- static shared_ptr<_Tp> __create_with_control_block(_Yp* __p, _CntrlBlk* __cntrl) _NOEXCEPT
- {
- shared_ptr<_Tp> __r;
- __r.__ptr_ = __p;
- __r.__cntrl_ = __cntrl;
- __r.__enable_weak_this(__r.__ptr_, __r.__ptr_);
- return __r;
- }
+ template <class _Yp, class _CntrlBlk>
+ _LIBCPP_HIDE_FROM_ABI static shared_ptr<_Tp> __create_with_control_block(_Yp* __p, _CntrlBlk* __cntrl) _NOEXCEPT {
+ shared_ptr<_Tp> __r;
+ __r.__ptr_ = __p;
+ __r.__cntrl_ = __cntrl;
+ __r.__enable_weak_this(__r.__ptr_, __r.__ptr_);
+ return __r;
+ }
private:
- template <class _Yp, bool = is_function<_Yp>::value>
- struct __shared_ptr_default_allocator
- {
- typedef allocator<_Yp> type;
- };
-
- template <class _Yp>
- struct __shared_ptr_default_allocator<_Yp, true>
- {
- typedef allocator<__shared_ptr_dummy_rebind_allocator_type> type;
- };
-
- template <class _Yp, class _OrigPtr, class = __enable_if_t<
- is_convertible<_OrigPtr*, const enable_shared_from_this<_Yp>*>::value
- > >
- _LIBCPP_HIDE_FROM_ABI
- void __enable_weak_this(const enable_shared_from_this<_Yp>* __e, _OrigPtr* __ptr) _NOEXCEPT
- {
- typedef __remove_cv_t<_Yp> _RawYp;
- if (__e && __e->__weak_this_.expired())
- {
- __e->__weak_this_ = shared_ptr<_RawYp>(*this,
- const_cast<_RawYp*>(static_cast<const _Yp*>(__ptr)));
- }
+ template <class _Yp, bool = is_function<_Yp>::value>
+ struct __shared_ptr_default_allocator {
+ typedef allocator<_Yp> type;
+ };
+
+ template <class _Yp>
+ struct __shared_ptr_default_allocator<_Yp, true> {
+ typedef allocator<__shared_ptr_dummy_rebind_allocator_type> type;
+ };
+
+ template <class _Yp,
+ class _OrigPtr,
+ class = __enable_if_t< is_convertible<_OrigPtr*, const enable_shared_from_this<_Yp>*>::value > >
+ _LIBCPP_HIDE_FROM_ABI void __enable_weak_this(const enable_shared_from_this<_Yp>* __e, _OrigPtr* __ptr) _NOEXCEPT {
+ typedef __remove_cv_t<_Yp> _RawYp;
+ if (__e && __e->__weak_this_.expired()) {
+ __e->__weak_this_ = shared_ptr<_RawYp>(*this, const_cast<_RawYp*>(static_cast<const _Yp*>(__ptr)));
}
+ }
- _LIBCPP_HIDE_FROM_ABI void __enable_weak_this(...) _NOEXCEPT { }
+ _LIBCPP_HIDE_FROM_ABI void __enable_weak_this(...) _NOEXCEPT {}
- template <class, class _Yp>
- struct __shared_ptr_default_delete
- : default_delete<_Yp>
- { };
+ template <class, class _Yp>
+ struct __shared_ptr_default_delete : default_delete<_Yp> {};
- template <class _Yp, class _Un, size_t _Sz>
- struct __shared_ptr_default_delete<_Yp[_Sz], _Un>
- : default_delete<_Yp[]>
- { };
+ template <class _Yp, class _Un, size_t _Sz>
+ struct __shared_ptr_default_delete<_Yp[_Sz], _Un> : default_delete<_Yp[]> {};
- template <class _Yp, class _Un>
- struct __shared_ptr_default_delete<_Yp[], _Un>
- : default_delete<_Yp[]>
- { };
+ template <class _Yp, class _Un>
+ struct __shared_ptr_default_delete<_Yp[], _Un> : default_delete<_Yp[]> {};
- template <class _Up> friend class _LIBCPP_TEMPLATE_VIS shared_ptr;
- template <class _Up> friend class _LIBCPP_TEMPLATE_VIS weak_ptr;
+ template <class _Up>
+ friend class _LIBCPP_TEMPLATE_VIS shared_ptr;
+ template <class _Up>
+ friend class _LIBCPP_TEMPLATE_VIS weak_ptr;
};
#if _LIBCPP_STD_VER >= 17
-template<class _Tp>
+template <class _Tp>
shared_ptr(weak_ptr<_Tp>) -> shared_ptr<_Tp>;
-template<class _Tp, class _Dp>
+template <class _Tp, class _Dp>
shared_ptr(unique_ptr<_Tp, _Dp>) -> shared_ptr<_Tp>;
#endif
//
// std::allocate_shared and std::make_shared
//
-template<class _Tp, class _Alloc, class ..._Args, class = __enable_if_t<!is_array<_Tp>::value> >
-_LIBCPP_HIDE_FROM_ABI
-shared_ptr<_Tp> allocate_shared(const _Alloc& __a, _Args&& ...__args)
-{
- using _ControlBlock = __shared_ptr_emplace<_Tp, _Alloc>;
- using _ControlBlockAllocator = typename __allocator_traits_rebind<_Alloc, _ControlBlock>::type;
- __allocation_guard<_ControlBlockAllocator> __guard(__a, 1);
- ::new ((void*)std::addressof(*__guard.__get())) _ControlBlock(__a, std::forward<_Args>(__args)...);
- auto __control_block = __guard.__release_ptr();
- return shared_ptr<_Tp>::__create_with_control_block((*__control_block).__get_elem(), std::addressof(*__control_block));
+template <class _Tp, class _Alloc, class... _Args, class = __enable_if_t<!is_array<_Tp>::value> >
+_LIBCPP_HIDE_FROM_ABI shared_ptr<_Tp> allocate_shared(const _Alloc& __a, _Args&&... __args) {
+ using _ControlBlock = __shared_ptr_emplace<_Tp, _Alloc>;
+ using _ControlBlockAllocator = typename __allocator_traits_rebind<_Alloc, _ControlBlock>::type;
+ __allocation_guard<_ControlBlockAllocator> __guard(__a, 1);
+ ::new ((void*)std::addressof(*__guard.__get())) _ControlBlock(__a, std::forward<_Args>(__args)...);
+ auto __control_block = __guard.__release_ptr();
+ return shared_ptr<_Tp>::__create_with_control_block(
+ (*__control_block).__get_elem(), std::addressof(*__control_block));
}
-template<class _Tp, class ..._Args, class = __enable_if_t<!is_array<_Tp>::value> >
-_LIBCPP_HIDE_FROM_ABI
-shared_ptr<_Tp> make_shared(_Args&& ...__args)
-{
- return std::allocate_shared<_Tp>(allocator<_Tp>(), std::forward<_Args>(__args)...);
+template <class _Tp, class... _Args, class = __enable_if_t<!is_array<_Tp>::value> >
+_LIBCPP_HIDE_FROM_ABI shared_ptr<_Tp> make_shared(_Args&&... __args) {
+ return std::allocate_shared<_Tp>(allocator<_Tp>(), std::forward<_Args>(__args)...);
}
#if _LIBCPP_STD_VER >= 20
-template<class _Tp, class _Alloc, __enable_if_t<!is_array<_Tp>::value, int> = 0>
-_LIBCPP_HIDE_FROM_ABI
-shared_ptr<_Tp> allocate_shared_for_overwrite(const _Alloc& __a)
-{
- using _ForOverwriteAllocator = __allocator_traits_rebind_t<_Alloc, __for_overwrite_tag>;
- _ForOverwriteAllocator __alloc(__a);
- return std::allocate_shared<_Tp>(__alloc);
+template <class _Tp, class _Alloc, __enable_if_t<!is_array<_Tp>::value, int> = 0>
+_LIBCPP_HIDE_FROM_ABI shared_ptr<_Tp> allocate_shared_for_overwrite(const _Alloc& __a) {
+ using _ForOverwriteAllocator = __allocator_traits_rebind_t<_Alloc, __for_overwrite_tag>;
+ _ForOverwriteAllocator __alloc(__a);
+ return std::allocate_shared<_Tp>(__alloc);
}
-template<class _Tp, __enable_if_t<!is_array<_Tp>::value, int> = 0>
-_LIBCPP_HIDE_FROM_ABI
-shared_ptr<_Tp> make_shared_for_overwrite()
-{
- return std::allocate_shared_for_overwrite<_Tp>(allocator<_Tp>());
+template <class _Tp, __enable_if_t<!is_array<_Tp>::value, int> = 0>
+_LIBCPP_HIDE_FROM_ABI shared_ptr<_Tp> make_shared_for_overwrite() {
+ return std::allocate_shared_for_overwrite<_Tp>(allocator<_Tp>());
}
#endif // _LIBCPP_STD_VER >= 20
@@ -1058,191 +846,180 @@ shared_ptr<_Tp> make_shared_for_overwrite()
template <size_t _Alignment>
struct __sp_aligned_storage {
- alignas(_Alignment) char __storage[_Alignment];
+ alignas(_Alignment) char __storage[_Alignment];
};
template <class _Tp, class _Alloc>
struct __unbounded_array_control_block;
template <class _Tp, class _Alloc>
-struct __unbounded_array_control_block<_Tp[], _Alloc> : __shared_weak_count
-{
- _LIBCPP_HIDE_FROM_ABI constexpr
- _Tp* __get_data() noexcept { return __data_; }
-
- _LIBCPP_HIDE_FROM_ABI
- explicit __unbounded_array_control_block(_Alloc const& __alloc, size_t __count, _Tp const& __arg)
- : __alloc_(__alloc), __count_(__count)
- {
- std::__uninitialized_allocator_fill_n_multidimensional(__alloc_, std::begin(__data_), __count_, __arg);
- }
-
- _LIBCPP_HIDE_FROM_ABI
- explicit __unbounded_array_control_block(_Alloc const& __alloc, size_t __count)
- : __alloc_(__alloc), __count_(__count)
- {
-#if _LIBCPP_STD_VER >= 20
- if constexpr (is_same_v<typename _Alloc::value_type, __for_overwrite_tag>) {
- // We are purposefully not using an allocator-aware default construction because the spec says so.
- // There's currently no way of expressing default initialization in an allocator-aware manner anyway.
- std::uninitialized_default_construct_n(std::begin(__data_), __count_);
- } else {
- std::__uninitialized_allocator_value_construct_n_multidimensional(__alloc_, std::begin(__data_), __count_);
- }
-#else
- std::__uninitialized_allocator_value_construct_n_multidimensional(__alloc_, std::begin(__data_), __count_);
-#endif
- }
-
- // Returns the number of bytes required to store a control block followed by the given number
- // of elements of _Tp, with the whole storage being aligned to a multiple of _Tp's alignment.
- _LIBCPP_HIDE_FROM_ABI
- static constexpr size_t __bytes_for(size_t __elements) {
- // When there's 0 elements, the control block alone is enough since it holds one element.
- // Otherwise, we allocate one fewer element than requested because the control block already
- // holds one. Also, we use the bitwise formula below to ensure that we allocate enough bytes
- // for the whole allocation to be a multiple of _Tp's alignment. That formula is taken from [1].
- //
- // [1]: https://en.wikipedia.org/wiki/Data_structure_alignment#Computing_padding
- size_t __bytes = __elements == 0 ? sizeof(__unbounded_array_control_block)
- : (__elements - 1) * sizeof(_Tp) + sizeof(__unbounded_array_control_block);
- constexpr size_t __align = alignof(_Tp);
- return (__bytes + __align - 1) & ~(__align - 1);
+struct __unbounded_array_control_block<_Tp[], _Alloc> : __shared_weak_count {
+ _LIBCPP_HIDE_FROM_ABI constexpr _Tp* __get_data() noexcept { return __data_; }
+
+ _LIBCPP_HIDE_FROM_ABI explicit __unbounded_array_control_block(
+ _Alloc const& __alloc, size_t __count, _Tp const& __arg)
+ : __alloc_(__alloc), __count_(__count) {
+ std::__uninitialized_allocator_fill_n_multidimensional(__alloc_, std::begin(__data_), __count_, __arg);
+ }
+
+ _LIBCPP_HIDE_FROM_ABI explicit __unbounded_array_control_block(_Alloc const& __alloc, size_t __count)
+ : __alloc_(__alloc), __count_(__count) {
+# if _LIBCPP_STD_VER >= 20
+ if constexpr (is_same_v<typename _Alloc::value_type, __for_overwrite_tag>) {
+ // We are purposefully not using an allocator-aware default construction because the spec says so.
+ // There's currently no way of expressing default initialization in an allocator-aware manner anyway.
+ std::uninitialized_default_construct_n(std::begin(__data_), __count_);
+ } else {
+ std::__uninitialized_allocator_value_construct_n_multidimensional(__alloc_, std::begin(__data_), __count_);
}
+# else
+ std::__uninitialized_allocator_value_construct_n_multidimensional(__alloc_, std::begin(__data_), __count_);
+# endif
+ }
+
+ // Returns the number of bytes required to store a control block followed by the given number
+ // of elements of _Tp, with the whole storage being aligned to a multiple of _Tp's alignment.
+ _LIBCPP_HIDE_FROM_ABI static constexpr size_t __bytes_for(size_t __elements) {
+ // When there's 0 elements, the control block alone is enough since it holds one element.
+ // Otherwise, we allocate one fewer element than requested because the control block already
+ // holds one. Also, we use the bitwise formula below to ensure that we allocate enough bytes
+ // for the whole allocation to be a multiple of _Tp's alignment. That formula is taken from [1].
+ //
+ // [1]: https://en.wikipedia.org/wiki/Data_structure_alignment#Computing_padding
+ size_t __bytes = __elements == 0 ? sizeof(__unbounded_array_control_block)
+ : (__elements - 1) * sizeof(_Tp) + sizeof(__unbounded_array_control_block);
+ constexpr size_t __align = alignof(_Tp);
+ return (__bytes + __align - 1) & ~(__align - 1);
+ }
- _LIBCPP_HIDE_FROM_ABI_VIRTUAL
- ~__unbounded_array_control_block() override { } // can't be `= default` because of the sometimes-non-trivial union member __data_
+ _LIBCPP_HIDE_FROM_ABI_VIRTUAL
+ ~__unbounded_array_control_block() override {
+ } // can't be `= default` because of the sometimes-non-trivial union member __data_
private:
- _LIBCPP_HIDE_FROM_ABI_VIRTUAL void __on_zero_shared() _NOEXCEPT override {
-#if _LIBCPP_STD_VER >= 20
- if constexpr (is_same_v<typename _Alloc::value_type, __for_overwrite_tag>) {
- std::__reverse_destroy(__data_, __data_ + __count_);
- } else {
- __allocator_traits_rebind_t<_Alloc, _Tp> __value_alloc(__alloc_);
- std::__allocator_destroy_multidimensional(__value_alloc, __data_, __data_ + __count_);
- }
-#else
- __allocator_traits_rebind_t<_Alloc, _Tp> __value_alloc(__alloc_);
- std::__allocator_destroy_multidimensional(__value_alloc, __data_, __data_ + __count_);
-#endif
- }
-
- _LIBCPP_HIDE_FROM_ABI_VIRTUAL void __on_zero_shared_weak() _NOEXCEPT override {
- using _AlignedStorage = __sp_aligned_storage<alignof(__unbounded_array_control_block)>;
- using _StorageAlloc = __allocator_traits_rebind_t<_Alloc, _AlignedStorage>;
- using _PointerTraits = pointer_traits<typename allocator_traits<_StorageAlloc>::pointer>;
-
- _StorageAlloc __tmp(__alloc_);
- __alloc_.~_Alloc();
- size_t __size = __unbounded_array_control_block::__bytes_for(__count_);
- _AlignedStorage* __storage = reinterpret_cast<_AlignedStorage*>(this);
- allocator_traits<_StorageAlloc>::deallocate(
- __tmp, _PointerTraits::pointer_to(*__storage), __size / sizeof(_AlignedStorage));
+ _LIBCPP_HIDE_FROM_ABI_VIRTUAL void __on_zero_shared() _NOEXCEPT override {
+# if _LIBCPP_STD_VER >= 20
+ if constexpr (is_same_v<typename _Alloc::value_type, __for_overwrite_tag>) {
+ std::__reverse_destroy(__data_, __data_ + __count_);
+ } else {
+ __allocator_traits_rebind_t<_Alloc, _Tp> __value_alloc(__alloc_);
+ std::__allocator_destroy_multidimensional(__value_alloc, __data_, __data_ + __count_);
}
-
- _LIBCPP_NO_UNIQUE_ADDRESS _Alloc __alloc_;
- size_t __count_;
- union {
- _Tp __data_[1];
- };
+# else
+ __allocator_traits_rebind_t<_Alloc, _Tp> __value_alloc(__alloc_);
+ std::__allocator_destroy_multidimensional(__value_alloc, __data_, __data_ + __count_);
+# endif
+ }
+
+ _LIBCPP_HIDE_FROM_ABI_VIRTUAL void __on_zero_shared_weak() _NOEXCEPT override {
+ using _AlignedStorage = __sp_aligned_storage<alignof(__unbounded_array_control_block)>;
+ using _StorageAlloc = __allocator_traits_rebind_t<_Alloc, _AlignedStorage>;
+ using _PointerTraits = pointer_traits<typename allocator_traits<_StorageAlloc>::pointer>;
+
+ _StorageAlloc __tmp(__alloc_);
+ __alloc_.~_Alloc();
+ size_t __size = __unbounded_array_control_block::__bytes_for(__count_);
+ _AlignedStorage* __storage = reinterpret_cast<_AlignedStorage*>(this);
+ allocator_traits<_StorageAlloc>::deallocate(
+ __tmp, _PointerTraits::pointer_to(*__storage), __size / sizeof(_AlignedStorage));
+ }
+
+ _LIBCPP_NO_UNIQUE_ADDRESS _Alloc __alloc_;
+ size_t __count_;
+ union {
+ _Tp __data_[1];
+ };
};
-template<class _Array, class _Alloc, class... _Arg>
-_LIBCPP_HIDE_FROM_ABI
-shared_ptr<_Array> __allocate_shared_unbounded_array(const _Alloc& __a, size_t __n, _Arg&& ...__arg)
-{
- static_assert(__libcpp_is_unbounded_array<_Array>::value);
- // We compute the number of bytes necessary to hold the control block and the
- // array elements. Then, we allocate an array of properly-aligned dummy structs
- // large enough to hold the control block and array. This allows shifting the
- // burden of aligning memory properly from us to the allocator.
- using _ControlBlock = __unbounded_array_control_block<_Array, _Alloc>;
- using _AlignedStorage = __sp_aligned_storage<alignof(_ControlBlock)>;
- using _StorageAlloc = __allocator_traits_rebind_t<_Alloc, _AlignedStorage>;
- __allocation_guard<_StorageAlloc> __guard(__a, _ControlBlock::__bytes_for(__n) / sizeof(_AlignedStorage));
- _ControlBlock* __control_block = reinterpret_cast<_ControlBlock*>(std::addressof(*__guard.__get()));
- std::__construct_at(__control_block, __a, __n, std::forward<_Arg>(__arg)...);
- __guard.__release_ptr();
- return shared_ptr<_Array>::__create_with_control_block(__control_block->__get_data(), __control_block);
+template <class _Array, class _Alloc, class... _Arg>
+_LIBCPP_HIDE_FROM_ABI shared_ptr<_Array>
+__allocate_shared_unbounded_array(const _Alloc& __a, size_t __n, _Arg&&... __arg) {
+ static_assert(__libcpp_is_unbounded_array<_Array>::value);
+ // We compute the number of bytes necessary to hold the control block and the
+ // array elements. Then, we allocate an array of properly-aligned dummy structs
+ // large enough to hold the control block and array. This allows shifting the
+ // burden of aligning memory properly from us to the allocator.
+ using _ControlBlock = __unbounded_array_control_block<_Array, _Alloc>;
+ using _AlignedStorage = __sp_aligned_storage<alignof(_ControlBlock)>;
+ using _StorageAlloc = __allocator_traits_rebind_t<_Alloc, _AlignedStorage>;
+ __allocation_guard<_StorageAlloc> __guard(__a, _ControlBlock::__bytes_for(__n) / sizeof(_AlignedStorage));
+ _ControlBlock* __control_block = reinterpret_cast<_ControlBlock*>(std::addressof(*__guard.__get()));
+ std::__construct_at(__control_block, __a, __n, std::forward<_Arg>(__arg)...);
+ __guard.__release_ptr();
+ return shared_ptr<_Array>::__create_with_control_block(__control_block->__get_data(), __control_block);
}
template <class _Tp, class _Alloc>
struct __bounded_array_control_block;
template <class _Tp, size_t _Count, class _Alloc>
-struct __bounded_array_control_block<_Tp[_Count], _Alloc>
- : __shared_weak_count
-{
- _LIBCPP_HIDE_FROM_ABI constexpr
- _Tp* __get_data() noexcept { return __data_; }
-
- _LIBCPP_HIDE_FROM_ABI
- explicit __bounded_array_control_block(_Alloc const& __alloc, _Tp const& __arg) : __alloc_(__alloc) {
- std::__uninitialized_allocator_fill_n_multidimensional(__alloc_, std::addressof(__data_[0]), _Count, __arg);
- }
-
- _LIBCPP_HIDE_FROM_ABI
- explicit __bounded_array_control_block(_Alloc const& __alloc) : __alloc_(__alloc) {
-#if _LIBCPP_STD_VER >= 20
- if constexpr (is_same_v<typename _Alloc::value_type, __for_overwrite_tag>) {
- // We are purposefully not using an allocator-aware default construction because the spec says so.
- // There's currently no way of expressing default initialization in an allocator-aware manner anyway.
- std::uninitialized_default_construct_n(std::addressof(__data_[0]), _Count);
- } else {
- std::__uninitialized_allocator_value_construct_n_multidimensional(__alloc_, std::addressof(__data_[0]), _Count);
- }
-#else
- std::__uninitialized_allocator_value_construct_n_multidimensional(__alloc_, std::addressof(__data_[0]), _Count);
-#endif
+struct __bounded_array_control_block<_Tp[_Count], _Alloc> : __shared_weak_count {
+ _LIBCPP_HIDE_FROM_ABI constexpr _Tp* __get_data() noexcept { return __data_; }
+
+ _LIBCPP_HIDE_FROM_ABI explicit __bounded_array_control_block(_Alloc const& __alloc, _Tp const& __arg)
+ : __alloc_(__alloc) {
+ std::__uninitialized_allocator_fill_n_multidimensional(__alloc_, std::addressof(__data_[0]), _Count, __arg);
+ }
+
+ _LIBCPP_HIDE_FROM_ABI explicit __bounded_array_control_block(_Alloc const& __alloc) : __alloc_(__alloc) {
+# if _LIBCPP_STD_VER >= 20
+ if constexpr (is_same_v<typename _Alloc::value_type, __for_overwrite_tag>) {
+ // We are purposefully not using an allocator-aware default construction because the spec says so.
+ // There's currently no way of expressing default initialization in an allocator-aware manner anyway.
+ std::uninitialized_default_construct_n(std::addressof(__data_[0]), _Count);
+ } else {
+ std::__uninitialized_allocator_value_construct_n_multidimensional(__alloc_, std::addressof(__data_[0]), _Count);
}
+# else
+ std::__uninitialized_allocator_value_construct_n_multidimensional(__alloc_, std::addressof(__data_[0]), _Count);
+# endif
+ }
- _LIBCPP_HIDE_FROM_ABI_VIRTUAL
- ~__bounded_array_control_block() override { } // can't be `= default` because of the sometimes-non-trivial union member __data_
+ _LIBCPP_HIDE_FROM_ABI_VIRTUAL
+ ~__bounded_array_control_block() override {
+ } // can't be `= default` because of the sometimes-non-trivial union member __data_
private:
- _LIBCPP_HIDE_FROM_ABI_VIRTUAL void __on_zero_shared() _NOEXCEPT override {
-#if _LIBCPP_STD_VER >= 20
- if constexpr (is_same_v<typename _Alloc::value_type, __for_overwrite_tag>) {
- std::__reverse_destroy(__data_, __data_ + _Count);
- } else {
- __allocator_traits_rebind_t<_Alloc, _Tp> __value_alloc(__alloc_);
- std::__allocator_destroy_multidimensional(__value_alloc, __data_, __data_ + _Count);
- }
-#else
- __allocator_traits_rebind_t<_Alloc, _Tp> __value_alloc(__alloc_);
- std::__allocator_destroy_multidimensional(__value_alloc, __data_, __data_ + _Count);
-#endif
- }
-
- _LIBCPP_HIDE_FROM_ABI_VIRTUAL void __on_zero_shared_weak() _NOEXCEPT override {
- using _ControlBlockAlloc = __allocator_traits_rebind_t<_Alloc, __bounded_array_control_block>;
- using _PointerTraits = pointer_traits<typename allocator_traits<_ControlBlockAlloc>::pointer>;
-
- _ControlBlockAlloc __tmp(__alloc_);
- __alloc_.~_Alloc();
- allocator_traits<_ControlBlockAlloc>::deallocate(__tmp, _PointerTraits::pointer_to(*this), 1);
+ _LIBCPP_HIDE_FROM_ABI_VIRTUAL void __on_zero_shared() _NOEXCEPT override {
+# if _LIBCPP_STD_VER >= 20
+ if constexpr (is_same_v<typename _Alloc::value_type, __for_overwrite_tag>) {
+ std::__reverse_destroy(__data_, __data_ + _Count);
+ } else {
+ __allocator_traits_rebind_t<_Alloc, _Tp> __value_alloc(__alloc_);
+ std::__allocator_destroy_multidimensional(__value_alloc, __data_, __data_ + _Count);
}
-
- _LIBCPP_NO_UNIQUE_ADDRESS _Alloc __alloc_;
- union {
- _Tp __data_[_Count];
- };
+# else
+ __allocator_traits_rebind_t<_Alloc, _Tp> __value_alloc(__alloc_);
+ std::__allocator_destroy_multidimensional(__value_alloc, __data_, __data_ + _Count);
+# endif
+ }
+
+ _LIBCPP_HIDE_FROM_ABI_VIRTUAL void __on_zero_shared_weak() _NOEXCEPT override {
+ using _ControlBlockAlloc = __allocator_traits_rebind_t<_Alloc, __bounded_array_control_block>;
+ using _PointerTraits = pointer_traits<typename allocator_traits<_ControlBlockAlloc>::pointer>;
+
+ _ControlBlockAlloc __tmp(__alloc_);
+ __alloc_.~_Alloc();
+ allocator_traits<_ControlBlockAlloc>::deallocate(__tmp, _PointerTraits::pointer_to(*this), 1);
+ }
+
+ _LIBCPP_NO_UNIQUE_ADDRESS _Alloc __alloc_;
+ union {
+ _Tp __data_[_Count];
+ };
};
-template<class _Array, class _Alloc, class... _Arg>
-_LIBCPP_HIDE_FROM_ABI
-shared_ptr<_Array> __allocate_shared_bounded_array(const _Alloc& __a, _Arg&& ...__arg)
-{
- static_assert(__libcpp_is_bounded_array<_Array>::value);
- using _ControlBlock = __bounded_array_control_block<_Array, _Alloc>;
- using _ControlBlockAlloc = __allocator_traits_rebind_t<_Alloc, _ControlBlock>;
+template <class _Array, class _Alloc, class... _Arg>
+_LIBCPP_HIDE_FROM_ABI shared_ptr<_Array> __allocate_shared_bounded_array(const _Alloc& __a, _Arg&&... __arg) {
+ static_assert(__libcpp_is_bounded_array<_Array>::value);
+ using _ControlBlock = __bounded_array_control_block<_Array, _Alloc>;
+ using _ControlBlockAlloc = __allocator_traits_rebind_t<_Alloc, _ControlBlock>;
- __allocation_guard<_ControlBlockAlloc> __guard(__a, 1);
- _ControlBlock* __control_block = reinterpret_cast<_ControlBlock*>(std::addressof(*__guard.__get()));
- std::__construct_at(__control_block, __a, std::forward<_Arg>(__arg)...);
- __guard.__release_ptr();
- return shared_ptr<_Array>::__create_with_control_block(__control_block->__get_data(), __control_block);
+ __allocation_guard<_ControlBlockAlloc> __guard(__a, 1);
+ _ControlBlock* __control_block = reinterpret_cast<_ControlBlock*>(std::addressof(*__guard.__get()));
+ std::__construct_at(__control_block, __a, std::forward<_Arg>(__arg)...);
+ __guard.__release_ptr();
+ return shared_ptr<_Array>::__create_with_control_block(__control_block->__get_data(), __control_block);
}
#endif // _LIBCPP_STD_VER >= 17
@@ -1250,289 +1027,198 @@ shared_ptr<_Array> __allocate_shared_bounded_array(const _Alloc& __a, _Arg&& ...
#if _LIBCPP_STD_VER >= 20
// bounded array variants
-template<class _Tp, class _Alloc, class = __enable_if_t<is_bounded_array<_Tp>::value>>
-_LIBCPP_HIDE_FROM_ABI
-shared_ptr<_Tp> allocate_shared(const _Alloc& __a)
-{
- return std::__allocate_shared_bounded_array<_Tp>(__a);
+template <class _Tp, class _Alloc, class = __enable_if_t<is_bounded_array<_Tp>::value>>
+_LIBCPP_HIDE_FROM_ABI shared_ptr<_Tp> allocate_shared(const _Alloc& __a) {
+ return std::__allocate_shared_bounded_array<_Tp>(__a);
}
-template<class _Tp, class _Alloc, class = __enable_if_t<is_bounded_array<_Tp>::value>>
-_LIBCPP_HIDE_FROM_ABI
-shared_ptr<_Tp> allocate_shared(const _Alloc& __a, const remove_extent_t<_Tp>& __u)
-{
- return std::__allocate_shared_bounded_array<_Tp>(__a, __u);
+template <class _Tp, class _Alloc, class = __enable_if_t<is_bounded_array<_Tp>::value>>
+_LIBCPP_HIDE_FROM_ABI shared_ptr<_Tp> allocate_shared(const _Alloc& __a, const remove_extent_t<_Tp>& __u) {
+ return std::__allocate_shared_bounded_array<_Tp>(__a, __u);
}
-template<class _Tp, class _Alloc, __enable_if_t<is_bounded_array<_Tp>::value, int> = 0>
-_LIBCPP_HIDE_FROM_ABI
-shared_ptr<_Tp> allocate_shared_for_overwrite(const _Alloc& __a)
-{
- using _ForOverwriteAllocator = __allocator_traits_rebind_t<_Alloc, __for_overwrite_tag>;
- _ForOverwriteAllocator __alloc(__a);
- return std::__allocate_shared_bounded_array<_Tp>(__alloc);
+template <class _Tp, class _Alloc, __enable_if_t<is_bounded_array<_Tp>::value, int> = 0>
+_LIBCPP_HIDE_FROM_ABI shared_ptr<_Tp> allocate_shared_for_overwrite(const _Alloc& __a) {
+ using _ForOverwriteAllocator = __allocator_traits_rebind_t<_Alloc, __for_overwrite_tag>;
+ _ForOverwriteAllocator __alloc(__a);
+ return std::__allocate_shared_bounded_array<_Tp>(__alloc);
}
-template<class _Tp, class = __enable_if_t<is_bounded_array<_Tp>::value>>
-_LIBCPP_HIDE_FROM_ABI
-shared_ptr<_Tp> make_shared()
-{
- return std::__allocate_shared_bounded_array<_Tp>(allocator<_Tp>());
+template <class _Tp, class = __enable_if_t<is_bounded_array<_Tp>::value>>
+_LIBCPP_HIDE_FROM_ABI shared_ptr<_Tp> make_shared() {
+ return std::__allocate_shared_bounded_array<_Tp>(allocator<_Tp>());
}
-template<class _Tp, class = __enable_if_t<is_bounded_array<_Tp>::value>>
-_LIBCPP_HIDE_FROM_ABI
-shared_ptr<_Tp> make_shared(const remove_extent_t<_Tp>& __u)
-{
- return std::__allocate_shared_bounded_array<_Tp>(allocator<_Tp>(), __u);
+template <class _Tp, class = __enable_if_t<is_bounded_array<_Tp>::value>>
+_LIBCPP_HIDE_FROM_ABI shared_ptr<_Tp> make_shared(const remove_extent_t<_Tp>& __u) {
+ return std::__allocate_shared_bounded_array<_Tp>(allocator<_Tp>(), __u);
}
-template<class _Tp, __enable_if_t<is_bounded_array<_Tp>::value, int> = 0>
-_LIBCPP_HIDE_FROM_ABI
-shared_ptr<_Tp> make_shared_for_overwrite()
-{
- return std::__allocate_shared_bounded_array<_Tp>(allocator<__for_overwrite_tag>());
+template <class _Tp, __enable_if_t<is_bounded_array<_Tp>::value, int> = 0>
+_LIBCPP_HIDE_FROM_ABI shared_ptr<_Tp> make_shared_for_overwrite() {
+ return std::__allocate_shared_bounded_array<_Tp>(allocator<__for_overwrite_tag>());
}
// unbounded array variants
-template<class _Tp, class _Alloc, class = __enable_if_t<is_unbounded_array<_Tp>::value>>
-_LIBCPP_HIDE_FROM_ABI
-shared_ptr<_Tp> allocate_shared(const _Alloc& __a, size_t __n)
-{
- return std::__allocate_shared_unbounded_array<_Tp>(__a, __n);
+template <class _Tp, class _Alloc, class = __enable_if_t<is_unbounded_array<_Tp>::value>>
+_LIBCPP_HIDE_FROM_ABI shared_ptr<_Tp> allocate_shared(const _Alloc& __a, size_t __n) {
+ return std::__allocate_shared_unbounded_array<_Tp>(__a, __n);
}
-template<class _Tp, class _Alloc, class = __enable_if_t<is_unbounded_array<_Tp>::value>>
-_LIBCPP_HIDE_FROM_ABI
-shared_ptr<_Tp> allocate_shared(const _Alloc& __a, size_t __n, const remove_extent_t<_Tp>& __u)
-{
- return std::__allocate_shared_unbounded_array<_Tp>(__a, __n, __u);
+template <class _Tp, class _Alloc, class = __enable_if_t<is_unbounded_array<_Tp>::value>>
+_LIBCPP_HIDE_FROM_ABI shared_ptr<_Tp> allocate_shared(const _Alloc& __a, size_t __n, const remove_extent_t<_Tp>& __u) {
+ return std::__allocate_shared_unbounded_array<_Tp>(__a, __n, __u);
}
-template<class _Tp, class _Alloc, __enable_if_t<is_unbounded_array<_Tp>::value, int> = 0>
-_LIBCPP_HIDE_FROM_ABI
-shared_ptr<_Tp> allocate_shared_for_overwrite(const _Alloc& __a, size_t __n)
-{
- using _ForOverwriteAllocator = __allocator_traits_rebind_t<_Alloc, __for_overwrite_tag>;
- _ForOverwriteAllocator __alloc(__a);
- return std::__allocate_shared_unbounded_array<_Tp>(__alloc, __n);
+template <class _Tp, class _Alloc, __enable_if_t<is_unbounded_array<_Tp>::value, int> = 0>
+_LIBCPP_HIDE_FROM_ABI shared_ptr<_Tp> allocate_shared_for_overwrite(const _Alloc& __a, size_t __n) {
+ using _ForOverwriteAllocator = __allocator_traits_rebind_t<_Alloc, __for_overwrite_tag>;
+ _ForOverwriteAllocator __alloc(__a);
+ return std::__allocate_shared_unbounded_array<_Tp>(__alloc, __n);
}
-template<class _Tp, class = __enable_if_t<is_unbounded_array<_Tp>::value>>
-_LIBCPP_HIDE_FROM_ABI
-shared_ptr<_Tp> make_shared(size_t __n)
-{
- return std::__allocate_shared_unbounded_array<_Tp>(allocator<_Tp>(), __n);
+template <class _Tp, class = __enable_if_t<is_unbounded_array<_Tp>::value>>
+_LIBCPP_HIDE_FROM_ABI shared_ptr<_Tp> make_shared(size_t __n) {
+ return std::__allocate_shared_unbounded_array<_Tp>(allocator<_Tp>(), __n);
}
-template<class _Tp, class = __enable_if_t<is_unbounded_array<_Tp>::value>>
-_LIBCPP_HIDE_FROM_ABI
-shared_ptr<_Tp> make_shared(size_t __n, const remove_extent_t<_Tp>& __u)
-{
- return std::__allocate_shared_unbounded_array<_Tp>(allocator<_Tp>(), __n, __u);
+template <class _Tp, class = __enable_if_t<is_unbounded_array<_Tp>::value>>
+_LIBCPP_HIDE_FROM_ABI shared_ptr<_Tp> make_shared(size_t __n, const remove_extent_t<_Tp>& __u) {
+ return std::__allocate_shared_unbounded_array<_Tp>(allocator<_Tp>(), __n, __u);
}
-template<class _Tp, __enable_if_t<is_unbounded_array<_Tp>::value, int> = 0>
-_LIBCPP_HIDE_FROM_ABI
-shared_ptr<_Tp> make_shared_for_overwrite(size_t __n)
-{
- return std::__allocate_shared_unbounded_array<_Tp>(allocator<__for_overwrite_tag>(), __n);
+template <class _Tp, __enable_if_t<is_unbounded_array<_Tp>::value, int> = 0>
+_LIBCPP_HIDE_FROM_ABI shared_ptr<_Tp> make_shared_for_overwrite(size_t __n) {
+ return std::__allocate_shared_unbounded_array<_Tp>(allocator<__for_overwrite_tag>(), __n);
}
#endif // _LIBCPP_STD_VER >= 20
-template<class _Tp, class _Up>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator==(const shared_ptr<_Tp>& __x, const shared_ptr<_Up>& __y) _NOEXCEPT
-{
- return __x.get() == __y.get();
+template <class _Tp, class _Up>
+inline _LIBCPP_HIDE_FROM_ABI bool operator==(const shared_ptr<_Tp>& __x, const shared_ptr<_Up>& __y) _NOEXCEPT {
+ return __x.get() == __y.get();
}
#if _LIBCPP_STD_VER <= 17
-template<class _Tp, class _Up>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator!=(const shared_ptr<_Tp>& __x, const shared_ptr<_Up>& __y) _NOEXCEPT
-{
- return !(__x == __y);
-}
-
-template<class _Tp, class _Up>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator<(const shared_ptr<_Tp>& __x, const shared_ptr<_Up>& __y) _NOEXCEPT
-{
-#if _LIBCPP_STD_VER <= 11
- typedef typename common_type<_Tp*, _Up*>::type _Vp;
- return less<_Vp>()(__x.get(), __y.get());
-#else
- return less<>()(__x.get(), __y.get());
-#endif
+template <class _Tp, class _Up>
+inline _LIBCPP_HIDE_FROM_ABI bool operator!=(const shared_ptr<_Tp>& __x, const shared_ptr<_Up>& __y) _NOEXCEPT {
+ return !(__x == __y);
+}
+template <class _Tp, class _Up>
+inline _LIBCPP_HIDE_FROM_ABI bool operator<(const shared_ptr<_Tp>& __x, const shared_ptr<_Up>& __y) _NOEXCEPT {
+# if _LIBCPP_STD_VER <= 11
+ typedef typename common_type<_Tp*, _Up*>::type _Vp;
+ return less<_Vp>()(__x.get(), __y.get());
+# else
+ return less<>()(__x.get(), __y.get());
+# endif
}
-template<class _Tp, class _Up>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator>(const shared_ptr<_Tp>& __x, const shared_ptr<_Up>& __y) _NOEXCEPT
-{
- return __y < __x;
+template <class _Tp, class _Up>
+inline _LIBCPP_HIDE_FROM_ABI bool operator>(const shared_ptr<_Tp>& __x, const shared_ptr<_Up>& __y) _NOEXCEPT {
+ return __y < __x;
}
-template<class _Tp, class _Up>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator<=(const shared_ptr<_Tp>& __x, const shared_ptr<_Up>& __y) _NOEXCEPT
-{
- return !(__y < __x);
+template <class _Tp, class _Up>
+inline _LIBCPP_HIDE_FROM_ABI bool operator<=(const shared_ptr<_Tp>& __x, const shared_ptr<_Up>& __y) _NOEXCEPT {
+ return !(__y < __x);
}
-template<class _Tp, class _Up>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator>=(const shared_ptr<_Tp>& __x, const shared_ptr<_Up>& __y) _NOEXCEPT
-{
- return !(__x < __y);
+template <class _Tp, class _Up>
+inline _LIBCPP_HIDE_FROM_ABI bool operator>=(const shared_ptr<_Tp>& __x, const shared_ptr<_Up>& __y) _NOEXCEPT {
+ return !(__x < __y);
}
#endif // _LIBCPP_STD_VER <= 17
#if _LIBCPP_STD_VER >= 20
-template<class _Tp, class _Up>
-_LIBCPP_HIDE_FROM_ABI strong_ordering
-operator<=>(shared_ptr<_Tp> const& __x, shared_ptr<_Up> const& __y) noexcept
-{
- return compare_three_way()(__x.get(), __y.get());
+template <class _Tp, class _Up>
+_LIBCPP_HIDE_FROM_ABI strong_ordering operator<=>(shared_ptr<_Tp> const& __x, shared_ptr<_Up> const& __y) noexcept {
+ return compare_three_way()(__x.get(), __y.get());
}
#endif
-template<class _Tp>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator==(const shared_ptr<_Tp>& __x, nullptr_t) _NOEXCEPT
-{
- return !__x;
+template <class _Tp>
+inline _LIBCPP_HIDE_FROM_ABI bool operator==(const shared_ptr<_Tp>& __x, nullptr_t) _NOEXCEPT {
+ return !__x;
}
#if _LIBCPP_STD_VER <= 17
-template<class _Tp>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator==(nullptr_t, const shared_ptr<_Tp>& __x) _NOEXCEPT
-{
- return !__x;
+template <class _Tp>
+inline _LIBCPP_HIDE_FROM_ABI bool operator==(nullptr_t, const shared_ptr<_Tp>& __x) _NOEXCEPT {
+ return !__x;
}
-template<class _Tp>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator!=(const shared_ptr<_Tp>& __x, nullptr_t) _NOEXCEPT
-{
- return static_cast<bool>(__x);
+template <class _Tp>
+inline _LIBCPP_HIDE_FROM_ABI bool operator!=(const shared_ptr<_Tp>& __x, nullptr_t) _NOEXCEPT {
+ return static_cast<bool>(__x);
}
-template<class _Tp>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator!=(nullptr_t, const shared_ptr<_Tp>& __x) _NOEXCEPT
-{
- return static_cast<bool>(__x);
+template <class _Tp>
+inline _LIBCPP_HIDE_FROM_ABI bool operator!=(nullptr_t, const shared_ptr<_Tp>& __x) _NOEXCEPT {
+ return static_cast<bool>(__x);
}
-template<class _Tp>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator<(const shared_ptr<_Tp>& __x, nullptr_t) _NOEXCEPT
-{
- return less<_Tp*>()(__x.get(), nullptr);
+template <class _Tp>
+inline _LIBCPP_HIDE_FROM_ABI bool operator<(const shared_ptr<_Tp>& __x, nullptr_t) _NOEXCEPT {
+ return less<_Tp*>()(__x.get(), nullptr);
}
-template<class _Tp>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator<(nullptr_t, const shared_ptr<_Tp>& __x) _NOEXCEPT
-{
- return less<_Tp*>()(nullptr, __x.get());
+template <class _Tp>
+inline _LIBCPP_HIDE_FROM_ABI bool operator<(nullptr_t, const shared_ptr<_Tp>& __x) _NOEXCEPT {
+ return less<_Tp*>()(nullptr, __x.get());
}
-template<class _Tp>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator>(const shared_ptr<_Tp>& __x, nullptr_t) _NOEXCEPT
-{
- return nullptr < __x;
+template <class _Tp>
+inline _LIBCPP_HIDE_FROM_ABI bool operator>(const shared_ptr<_Tp>& __x, nullptr_t) _NOEXCEPT {
+ return nullptr < __x;
}
-template<class _Tp>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator>(nullptr_t, const shared_ptr<_Tp>& __x) _NOEXCEPT
-{
- return __x < nullptr;
+template <class _Tp>
+inline _LIBCPP_HIDE_FROM_ABI bool operator>(nullptr_t, const shared_ptr<_Tp>& __x) _NOEXCEPT {
+ return __x < nullptr;
}
-template<class _Tp>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator<=(const shared_ptr<_Tp>& __x, nullptr_t) _NOEXCEPT
-{
- return !(nullptr < __x);
+template <class _Tp>
+inline _LIBCPP_HIDE_FROM_ABI bool operator<=(const shared_ptr<_Tp>& __x, nullptr_t) _NOEXCEPT {
+ return !(nullptr < __x);
}
-template<class _Tp>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator<=(nullptr_t, const shared_ptr<_Tp>& __x) _NOEXCEPT
-{
- return !(__x < nullptr);
+template <class _Tp>
+inline _LIBCPP_HIDE_FROM_ABI bool operator<=(nullptr_t, const shared_ptr<_Tp>& __x) _NOEXCEPT {
+ return !(__x < nullptr);
}
-template<class _Tp>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator>=(const shared_ptr<_Tp>& __x, nullptr_t) _NOEXCEPT
-{
- return !(__x < nullptr);
+template <class _Tp>
+inline _LIBCPP_HIDE_FROM_ABI bool operator>=(const shared_ptr<_Tp>& __x, nullptr_t) _NOEXCEPT {
+ return !(__x < nullptr);
}
-template<class _Tp>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator>=(nullptr_t, const shared_ptr<_Tp>& __x) _NOEXCEPT
-{
- return !(nullptr < __x);
+template <class _Tp>
+inline _LIBCPP_HIDE_FROM_ABI bool operator>=(nullptr_t, const shared_ptr<_Tp>& __x) _NOEXCEPT {
+ return !(nullptr < __x);
}
#endif // _LIBCPP_STD_VER <= 17
#if _LIBCPP_STD_VER >= 20
-template<class _Tp>
-_LIBCPP_HIDE_FROM_ABI strong_ordering
-operator<=>(shared_ptr<_Tp> const& __x, nullptr_t) noexcept
-{
- return compare_three_way()(__x.get(), static_cast<typename shared_ptr<_Tp>::element_type*>(nullptr));
+template <class _Tp>
+_LIBCPP_HIDE_FROM_ABI strong_ordering operator<=>(shared_ptr<_Tp> const& __x, nullptr_t) noexcept {
+ return compare_three_way()(__x.get(), static_cast<typename shared_ptr<_Tp>::element_type*>(nullptr));
}
#endif
-template<class _Tp>
-inline _LIBCPP_HIDE_FROM_ABI
-void
-swap(shared_ptr<_Tp>& __x, shared_ptr<_Tp>& __y) _NOEXCEPT
-{
- __x.swap(__y);
+template <class _Tp>
+inline _LIBCPP_HIDE_FROM_ABI void swap(shared_ptr<_Tp>& __x, shared_ptr<_Tp>& __y) _NOEXCEPT {
+ __x.swap(__y);
}
-template<class _Tp, class _Up>
-inline _LIBCPP_HIDE_FROM_ABI
-shared_ptr<_Tp>
-static_pointer_cast(const shared_ptr<_Up>& __r) _NOEXCEPT
-{
- return shared_ptr<_Tp>(__r,
- static_cast<
- typename shared_ptr<_Tp>::element_type*>(__r.get()));
+template <class _Tp, class _Up>
+inline _LIBCPP_HIDE_FROM_ABI shared_ptr<_Tp> static_pointer_cast(const shared_ptr<_Up>& __r) _NOEXCEPT {
+ return shared_ptr<_Tp>(__r, static_cast< typename shared_ptr<_Tp>::element_type*>(__r.get()));
}
// LWG-2996
@@ -1544,14 +1230,11 @@ _LIBCPP_HIDE_FROM_ABI shared_ptr<_Tp> static_pointer_cast(shared_ptr<_Up>&& __r)
}
#endif
-template<class _Tp, class _Up>
-inline _LIBCPP_HIDE_FROM_ABI
-shared_ptr<_Tp>
-dynamic_pointer_cast(const shared_ptr<_Up>& __r) _NOEXCEPT
-{
- typedef typename shared_ptr<_Tp>::element_type _ET;
- _ET* __p = dynamic_cast<_ET*>(__r.get());
- return __p ? shared_ptr<_Tp>(__r, __p) : shared_ptr<_Tp>();
+template <class _Tp, class _Up>
+inline _LIBCPP_HIDE_FROM_ABI shared_ptr<_Tp> dynamic_pointer_cast(const shared_ptr<_Up>& __r) _NOEXCEPT {
+ typedef typename shared_ptr<_Tp>::element_type _ET;
+ _ET* __p = dynamic_cast<_ET*>(__r.get());
+ return __p ? shared_ptr<_Tp>(__r, __p) : shared_ptr<_Tp>();
}
// LWG-2996
@@ -1564,12 +1247,10 @@ _LIBCPP_HIDE_FROM_ABI shared_ptr<_Tp> dynamic_pointer_cast(shared_ptr<_Up>&& __r
}
#endif
-template<class _Tp, class _Up>
-_LIBCPP_HIDE_FROM_ABI shared_ptr<_Tp>
-const_pointer_cast(const shared_ptr<_Up>& __r) _NOEXCEPT
-{
- typedef typename shared_ptr<_Tp>::element_type _RTp;
- return shared_ptr<_Tp>(__r, const_cast<_RTp*>(__r.get()));
+template <class _Tp, class _Up>
+_LIBCPP_HIDE_FROM_ABI shared_ptr<_Tp> const_pointer_cast(const shared_ptr<_Up>& __r) _NOEXCEPT {
+ typedef typename shared_ptr<_Tp>::element_type _RTp;
+ return shared_ptr<_Tp>(__r, const_cast<_RTp*>(__r.get()));
}
// LWG-2996
@@ -1581,13 +1262,9 @@ _LIBCPP_HIDE_FROM_ABI shared_ptr<_Tp> const_pointer_cast(shared_ptr<_Up>&& __r)
}
#endif
-template<class _Tp, class _Up>
-_LIBCPP_HIDE_FROM_ABI shared_ptr<_Tp>
-reinterpret_pointer_cast(const shared_ptr<_Up>& __r) _NOEXCEPT
-{
- return shared_ptr<_Tp>(__r,
- reinterpret_cast<
- typename shared_ptr<_Tp>::element_type*>(__r.get()));
+template <class _Tp, class _Up>
+_LIBCPP_HIDE_FROM_ABI shared_ptr<_Tp> reinterpret_pointer_cast(const shared_ptr<_Up>& __r) _NOEXCEPT {
+ return shared_ptr<_Tp>(__r, reinterpret_cast< typename shared_ptr<_Tp>::element_type*>(__r.get()));
}
// LWG-2996
@@ -1601,500 +1278,382 @@ _LIBCPP_HIDE_FROM_ABI shared_ptr<_Tp> reinterpret_pointer_cast(shared_ptr<_Up>&&
#ifndef _LIBCPP_HAS_NO_RTTI
-template<class _Dp, class _Tp>
-inline _LIBCPP_HIDE_FROM_ABI
-_Dp*
-get_deleter(const shared_ptr<_Tp>& __p) _NOEXCEPT
-{
- return __p.template __get_deleter<_Dp>();
+template <class _Dp, class _Tp>
+inline _LIBCPP_HIDE_FROM_ABI _Dp* get_deleter(const shared_ptr<_Tp>& __p) _NOEXCEPT {
+ return __p.template __get_deleter<_Dp>();
}
#endif // _LIBCPP_HAS_NO_RTTI
-template<class _Tp>
-class _LIBCPP_SHARED_PTR_TRIVIAL_ABI _LIBCPP_TEMPLATE_VIS weak_ptr
-{
+template <class _Tp>
+class _LIBCPP_SHARED_PTR_TRIVIAL_ABI _LIBCPP_TEMPLATE_VIS weak_ptr {
public:
#if _LIBCPP_STD_VER >= 17
- typedef remove_extent_t<_Tp> element_type;
+ typedef remove_extent_t<_Tp> element_type;
#else
- typedef _Tp element_type;
+ typedef _Tp element_type;
#endif
private:
- element_type* __ptr_;
- __shared_weak_count* __cntrl_;
+ element_type* __ptr_;
+ __shared_weak_count* __cntrl_;
public:
- _LIBCPP_HIDE_FROM_ABI
- _LIBCPP_CONSTEXPR weak_ptr() _NOEXCEPT;
-
- template<class _Yp, __enable_if_t<__compatible_with<_Yp, _Tp>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI weak_ptr(shared_ptr<_Yp> const& __r) _NOEXCEPT;
-
- _LIBCPP_HIDE_FROM_ABI
- weak_ptr(weak_ptr const& __r) _NOEXCEPT;
-
- template<class _Yp, __enable_if_t<__compatible_with<_Yp, _Tp>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI weak_ptr(weak_ptr<_Yp> const& __r) _NOEXCEPT;
-
- _LIBCPP_HIDE_FROM_ABI
- weak_ptr(weak_ptr&& __r) _NOEXCEPT;
-
- template<class _Yp, __enable_if_t<__compatible_with<_Yp, _Tp>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI weak_ptr(weak_ptr<_Yp>&& __r) _NOEXCEPT;
-
- _LIBCPP_HIDE_FROM_ABI ~weak_ptr();
-
- _LIBCPP_HIDE_FROM_ABI
- weak_ptr& operator=(weak_ptr const& __r) _NOEXCEPT;
- template<class _Yp, __enable_if_t<__compatible_with<_Yp, _Tp>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI weak_ptr&
- operator=(weak_ptr<_Yp> const& __r) _NOEXCEPT;
-
- _LIBCPP_HIDE_FROM_ABI
- weak_ptr& operator=(weak_ptr&& __r) _NOEXCEPT;
- template<class _Yp, __enable_if_t<__compatible_with<_Yp, _Tp>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI weak_ptr&
- operator=(weak_ptr<_Yp>&& __r) _NOEXCEPT;
-
- template<class _Yp, __enable_if_t<__compatible_with<_Yp, _Tp>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI weak_ptr&
- operator=(shared_ptr<_Yp> const& __r) _NOEXCEPT;
-
- _LIBCPP_HIDE_FROM_ABI
- void swap(weak_ptr& __r) _NOEXCEPT;
- _LIBCPP_HIDE_FROM_ABI
- void reset() _NOEXCEPT;
-
- _LIBCPP_HIDE_FROM_ABI
- long use_count() const _NOEXCEPT
- {return __cntrl_ ? __cntrl_->use_count() : 0;}
- _LIBCPP_HIDE_FROM_ABI
- bool expired() const _NOEXCEPT
- {return __cntrl_ == nullptr || __cntrl_->use_count() == 0;}
- _LIBCPP_HIDE_FROM_ABI shared_ptr<_Tp> lock() const _NOEXCEPT;
- template<class _Up>
- _LIBCPP_HIDE_FROM_ABI
- bool owner_before(const shared_ptr<_Up>& __r) const _NOEXCEPT
- {return __cntrl_ < __r.__cntrl_;}
- template<class _Up>
- _LIBCPP_HIDE_FROM_ABI
- bool owner_before(const weak_ptr<_Up>& __r) const _NOEXCEPT
- {return __cntrl_ < __r.__cntrl_;}
-
- template <class _Up> friend class _LIBCPP_TEMPLATE_VIS weak_ptr;
- template <class _Up> friend class _LIBCPP_TEMPLATE_VIS shared_ptr;
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR weak_ptr() _NOEXCEPT;
+
+ template <class _Yp, __enable_if_t<__compatible_with<_Yp, _Tp>::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI weak_ptr(shared_ptr<_Yp> const& __r) _NOEXCEPT;
+
+ _LIBCPP_HIDE_FROM_ABI weak_ptr(weak_ptr const& __r) _NOEXCEPT;
+
+ template <class _Yp, __enable_if_t<__compatible_with<_Yp, _Tp>::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI weak_ptr(weak_ptr<_Yp> const& __r) _NOEXCEPT;
+
+ _LIBCPP_HIDE_FROM_ABI weak_ptr(weak_ptr&& __r) _NOEXCEPT;
+
+ template <class _Yp, __enable_if_t<__compatible_with<_Yp, _Tp>::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI weak_ptr(weak_ptr<_Yp>&& __r) _NOEXCEPT;
+
+ _LIBCPP_HIDE_FROM_ABI ~weak_ptr();
+
+ _LIBCPP_HIDE_FROM_ABI weak_ptr& operator=(weak_ptr const& __r) _NOEXCEPT;
+ template <class _Yp, __enable_if_t<__compatible_with<_Yp, _Tp>::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI weak_ptr& operator=(weak_ptr<_Yp> const& __r) _NOEXCEPT;
+
+ _LIBCPP_HIDE_FROM_ABI weak_ptr& operator=(weak_ptr&& __r) _NOEXCEPT;
+ template <class _Yp, __enable_if_t<__compatible_with<_Yp, _Tp>::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI weak_ptr& operator=(weak_ptr<_Yp>&& __r) _NOEXCEPT;
+
+ template <class _Yp, __enable_if_t<__compatible_with<_Yp, _Tp>::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI weak_ptr& operator=(shared_ptr<_Yp> const& __r) _NOEXCEPT;
+
+ _LIBCPP_HIDE_FROM_ABI void swap(weak_ptr& __r) _NOEXCEPT;
+ _LIBCPP_HIDE_FROM_ABI void reset() _NOEXCEPT;
+
+ _LIBCPP_HIDE_FROM_ABI long use_count() const _NOEXCEPT { return __cntrl_ ? __cntrl_->use_count() : 0; }
+ _LIBCPP_HIDE_FROM_ABI bool expired() const _NOEXCEPT { return __cntrl_ == nullptr || __cntrl_->use_count() == 0; }
+ _LIBCPP_HIDE_FROM_ABI shared_ptr<_Tp> lock() const _NOEXCEPT;
+ template <class _Up>
+ _LIBCPP_HIDE_FROM_ABI bool owner_before(const shared_ptr<_Up>& __r) const _NOEXCEPT {
+ return __cntrl_ < __r.__cntrl_;
+ }
+ template <class _Up>
+ _LIBCPP_HIDE_FROM_ABI bool owner_before(const weak_ptr<_Up>& __r) const _NOEXCEPT {
+ return __cntrl_ < __r.__cntrl_;
+ }
+
+ template <class _Up>
+ friend class _LIBCPP_TEMPLATE_VIS weak_ptr;
+ template <class _Up>
+ friend class _LIBCPP_TEMPLATE_VIS shared_ptr;
};
#if _LIBCPP_STD_VER >= 17
-template<class _Tp>
+template <class _Tp>
weak_ptr(shared_ptr<_Tp>) -> weak_ptr<_Tp>;
#endif
-template<class _Tp>
-inline
-_LIBCPP_CONSTEXPR
-weak_ptr<_Tp>::weak_ptr() _NOEXCEPT
- : __ptr_(nullptr),
- __cntrl_(nullptr)
-{
-}
-
-template<class _Tp>
-inline
-weak_ptr<_Tp>::weak_ptr(weak_ptr const& __r) _NOEXCEPT
- : __ptr_(__r.__ptr_),
- __cntrl_(__r.__cntrl_)
-{
- if (__cntrl_)
- __cntrl_->__add_weak();
+template <class _Tp>
+inline _LIBCPP_CONSTEXPR weak_ptr<_Tp>::weak_ptr() _NOEXCEPT : __ptr_(nullptr), __cntrl_(nullptr) {}
+
+template <class _Tp>
+inline weak_ptr<_Tp>::weak_ptr(weak_ptr const& __r) _NOEXCEPT : __ptr_(__r.__ptr_), __cntrl_(__r.__cntrl_) {
+ if (__cntrl_)
+ __cntrl_->__add_weak();
}
-template<class _Tp>
-template<class _Yp, __enable_if_t<__compatible_with<_Yp, _Tp>::value, int> >
-inline
-weak_ptr<_Tp>::weak_ptr(shared_ptr<_Yp> const& __r)
- _NOEXCEPT
- : __ptr_(__r.__ptr_),
- __cntrl_(__r.__cntrl_)
-{
- if (__cntrl_)
- __cntrl_->__add_weak();
-}
-
-template<class _Tp>
-template<class _Yp, __enable_if_t<__compatible_with<_Yp, _Tp>::value, int> >
-inline
-weak_ptr<_Tp>::weak_ptr(weak_ptr<_Yp> const& __r)
- _NOEXCEPT
- : __ptr_(nullptr),
- __cntrl_(nullptr)
-{
- shared_ptr<_Yp> __s = __r.lock();
- *this = weak_ptr<_Tp>(__s);
-}
-
-template<class _Tp>
-inline
-weak_ptr<_Tp>::weak_ptr(weak_ptr&& __r) _NOEXCEPT
- : __ptr_(__r.__ptr_),
- __cntrl_(__r.__cntrl_)
-{
- __r.__ptr_ = nullptr;
- __r.__cntrl_ = nullptr;
+template <class _Tp>
+template <class _Yp, __enable_if_t<__compatible_with<_Yp, _Tp>::value, int> >
+inline weak_ptr<_Tp>::weak_ptr(shared_ptr<_Yp> const& __r) _NOEXCEPT : __ptr_(__r.__ptr_), __cntrl_(__r.__cntrl_) {
+ if (__cntrl_)
+ __cntrl_->__add_weak();
}
-template<class _Tp>
-template<class _Yp, __enable_if_t<__compatible_with<_Yp, _Tp>::value, int> >
-inline
-weak_ptr<_Tp>::weak_ptr(weak_ptr<_Yp>&& __r)
- _NOEXCEPT
- : __ptr_(nullptr),
- __cntrl_(nullptr)
-{
- shared_ptr<_Yp> __s = __r.lock();
- *this = weak_ptr<_Tp>(__s);
- __r.reset();
+template <class _Tp>
+template <class _Yp, __enable_if_t<__compatible_with<_Yp, _Tp>::value, int> >
+inline weak_ptr<_Tp>::weak_ptr(weak_ptr<_Yp> const& __r) _NOEXCEPT : __ptr_(nullptr), __cntrl_(nullptr) {
+ shared_ptr<_Yp> __s = __r.lock();
+ *this = weak_ptr<_Tp>(__s);
}
-template<class _Tp>
-weak_ptr<_Tp>::~weak_ptr()
-{
- if (__cntrl_)
- __cntrl_->__release_weak();
+template <class _Tp>
+inline weak_ptr<_Tp>::weak_ptr(weak_ptr&& __r) _NOEXCEPT : __ptr_(__r.__ptr_), __cntrl_(__r.__cntrl_) {
+ __r.__ptr_ = nullptr;
+ __r.__cntrl_ = nullptr;
}
-template<class _Tp>
-inline
-weak_ptr<_Tp>&
-weak_ptr<_Tp>::operator=(weak_ptr const& __r) _NOEXCEPT
-{
- weak_ptr(__r).swap(*this);
- return *this;
+template <class _Tp>
+template <class _Yp, __enable_if_t<__compatible_with<_Yp, _Tp>::value, int> >
+inline weak_ptr<_Tp>::weak_ptr(weak_ptr<_Yp>&& __r) _NOEXCEPT : __ptr_(nullptr), __cntrl_(nullptr) {
+ shared_ptr<_Yp> __s = __r.lock();
+ *this = weak_ptr<_Tp>(__s);
+ __r.reset();
}
-template<class _Tp>
-template<class _Yp, __enable_if_t<__compatible_with<_Yp, _Tp>::value, int> >
-inline
-weak_ptr<_Tp>&
-weak_ptr<_Tp>::operator=(weak_ptr<_Yp> const& __r) _NOEXCEPT
-{
- weak_ptr(__r).swap(*this);
- return *this;
+template <class _Tp>
+weak_ptr<_Tp>::~weak_ptr() {
+ if (__cntrl_)
+ __cntrl_->__release_weak();
}
-template<class _Tp>
-inline
-weak_ptr<_Tp>&
-weak_ptr<_Tp>::operator=(weak_ptr&& __r) _NOEXCEPT
-{
- weak_ptr(std::move(__r)).swap(*this);
- return *this;
+template <class _Tp>
+inline weak_ptr<_Tp>& weak_ptr<_Tp>::operator=(weak_ptr const& __r) _NOEXCEPT {
+ weak_ptr(__r).swap(*this);
+ return *this;
}
-template<class _Tp>
-template<class _Yp, __enable_if_t<__compatible_with<_Yp, _Tp>::value, int> >
-inline
-weak_ptr<_Tp>&
-weak_ptr<_Tp>::operator=(weak_ptr<_Yp>&& __r) _NOEXCEPT
-{
- weak_ptr(std::move(__r)).swap(*this);
- return *this;
+template <class _Tp>
+template <class _Yp, __enable_if_t<__compatible_with<_Yp, _Tp>::value, int> >
+inline weak_ptr<_Tp>& weak_ptr<_Tp>::operator=(weak_ptr<_Yp> const& __r) _NOEXCEPT {
+ weak_ptr(__r).swap(*this);
+ return *this;
}
-template<class _Tp>
-template<class _Yp, __enable_if_t<__compatible_with<_Yp, _Tp>::value, int> >
-inline
-weak_ptr<_Tp>&
-weak_ptr<_Tp>::operator=(shared_ptr<_Yp> const& __r) _NOEXCEPT
-{
- weak_ptr(__r).swap(*this);
- return *this;
+template <class _Tp>
+inline weak_ptr<_Tp>& weak_ptr<_Tp>::operator=(weak_ptr&& __r) _NOEXCEPT {
+ weak_ptr(std::move(__r)).swap(*this);
+ return *this;
}
-template<class _Tp>
-inline
-void
-weak_ptr<_Tp>::swap(weak_ptr& __r) _NOEXCEPT
-{
- std::swap(__ptr_, __r.__ptr_);
- std::swap(__cntrl_, __r.__cntrl_);
+template <class _Tp>
+template <class _Yp, __enable_if_t<__compatible_with<_Yp, _Tp>::value, int> >
+inline weak_ptr<_Tp>& weak_ptr<_Tp>::operator=(weak_ptr<_Yp>&& __r) _NOEXCEPT {
+ weak_ptr(std::move(__r)).swap(*this);
+ return *this;
}
-template<class _Tp>
-inline _LIBCPP_HIDE_FROM_ABI
-void
-swap(weak_ptr<_Tp>& __x, weak_ptr<_Tp>& __y) _NOEXCEPT
-{
- __x.swap(__y);
+template <class _Tp>
+template <class _Yp, __enable_if_t<__compatible_with<_Yp, _Tp>::value, int> >
+inline weak_ptr<_Tp>& weak_ptr<_Tp>::operator=(shared_ptr<_Yp> const& __r) _NOEXCEPT {
+ weak_ptr(__r).swap(*this);
+ return *this;
}
-template<class _Tp>
-inline
-void
-weak_ptr<_Tp>::reset() _NOEXCEPT
-{
- weak_ptr().swap(*this);
+template <class _Tp>
+inline void weak_ptr<_Tp>::swap(weak_ptr& __r) _NOEXCEPT {
+ std::swap(__ptr_, __r.__ptr_);
+ std::swap(__cntrl_, __r.__cntrl_);
}
-template<class _Tp>
-shared_ptr<_Tp>
-weak_ptr<_Tp>::lock() const _NOEXCEPT
-{
- shared_ptr<_Tp> __r;
- __r.__cntrl_ = __cntrl_ ? __cntrl_->lock() : __cntrl_;
- if (__r.__cntrl_)
- __r.__ptr_ = __ptr_;
- return __r;
+template <class _Tp>
+inline _LIBCPP_HIDE_FROM_ABI void swap(weak_ptr<_Tp>& __x, weak_ptr<_Tp>& __y) _NOEXCEPT {
+ __x.swap(__y);
+}
+
+template <class _Tp>
+inline void weak_ptr<_Tp>::reset() _NOEXCEPT {
+ weak_ptr().swap(*this);
+}
+
+template <class _Tp>
+shared_ptr<_Tp> weak_ptr<_Tp>::lock() const _NOEXCEPT {
+ shared_ptr<_Tp> __r;
+ __r.__cntrl_ = __cntrl_ ? __cntrl_->lock() : __cntrl_;
+ if (__r.__cntrl_)
+ __r.__ptr_ = __ptr_;
+ return __r;
}
#if _LIBCPP_STD_VER >= 17
-template <class _Tp = void> struct owner_less;
+template <class _Tp = void>
+struct owner_less;
#else
-template <class _Tp> struct owner_less;
+template <class _Tp>
+struct owner_less;
#endif
-
template <class _Tp>
-struct _LIBCPP_TEMPLATE_VIS owner_less<shared_ptr<_Tp> >
- : __binary_function<shared_ptr<_Tp>, shared_ptr<_Tp>, bool>
-{
- _LIBCPP_HIDE_FROM_ABI
- bool operator()(shared_ptr<_Tp> const& __x, shared_ptr<_Tp> const& __y) const _NOEXCEPT
- {return __x.owner_before(__y);}
- _LIBCPP_HIDE_FROM_ABI
- bool operator()(shared_ptr<_Tp> const& __x, weak_ptr<_Tp> const& __y) const _NOEXCEPT
- {return __x.owner_before(__y);}
- _LIBCPP_HIDE_FROM_ABI
- bool operator()( weak_ptr<_Tp> const& __x, shared_ptr<_Tp> const& __y) const _NOEXCEPT
- {return __x.owner_before(__y);}
+struct _LIBCPP_TEMPLATE_VIS owner_less<shared_ptr<_Tp> > : __binary_function<shared_ptr<_Tp>, shared_ptr<_Tp>, bool> {
+ _LIBCPP_HIDE_FROM_ABI bool operator()(shared_ptr<_Tp> const& __x, shared_ptr<_Tp> const& __y) const _NOEXCEPT {
+ return __x.owner_before(__y);
+ }
+ _LIBCPP_HIDE_FROM_ABI bool operator()(shared_ptr<_Tp> const& __x, weak_ptr<_Tp> const& __y) const _NOEXCEPT {
+ return __x.owner_before(__y);
+ }
+ _LIBCPP_HIDE_FROM_ABI bool operator()(weak_ptr<_Tp> const& __x, shared_ptr<_Tp> const& __y) const _NOEXCEPT {
+ return __x.owner_before(__y);
+ }
};
template <class _Tp>
-struct _LIBCPP_TEMPLATE_VIS owner_less<weak_ptr<_Tp> >
- : __binary_function<weak_ptr<_Tp>, weak_ptr<_Tp>, bool>
-{
- _LIBCPP_HIDE_FROM_ABI
- bool operator()( weak_ptr<_Tp> const& __x, weak_ptr<_Tp> const& __y) const _NOEXCEPT
- {return __x.owner_before(__y);}
- _LIBCPP_HIDE_FROM_ABI
- bool operator()(shared_ptr<_Tp> const& __x, weak_ptr<_Tp> const& __y) const _NOEXCEPT
- {return __x.owner_before(__y);}
- _LIBCPP_HIDE_FROM_ABI
- bool operator()( weak_ptr<_Tp> const& __x, shared_ptr<_Tp> const& __y) const _NOEXCEPT
- {return __x.owner_before(__y);}
+struct _LIBCPP_TEMPLATE_VIS owner_less<weak_ptr<_Tp> > : __binary_function<weak_ptr<_Tp>, weak_ptr<_Tp>, bool> {
+ _LIBCPP_HIDE_FROM_ABI bool operator()(weak_ptr<_Tp> const& __x, weak_ptr<_Tp> const& __y) const _NOEXCEPT {
+ return __x.owner_before(__y);
+ }
+ _LIBCPP_HIDE_FROM_ABI bool operator()(shared_ptr<_Tp> const& __x, weak_ptr<_Tp> const& __y) const _NOEXCEPT {
+ return __x.owner_before(__y);
+ }
+ _LIBCPP_HIDE_FROM_ABI bool operator()(weak_ptr<_Tp> const& __x, shared_ptr<_Tp> const& __y) const _NOEXCEPT {
+ return __x.owner_before(__y);
+ }
};
#if _LIBCPP_STD_VER >= 17
template <>
-struct _LIBCPP_TEMPLATE_VIS owner_less<void>
-{
- template <class _Tp, class _Up>
- _LIBCPP_HIDE_FROM_ABI
- bool operator()( shared_ptr<_Tp> const& __x, shared_ptr<_Up> const& __y) const _NOEXCEPT
- {return __x.owner_before(__y);}
- template <class _Tp, class _Up>
- _LIBCPP_HIDE_FROM_ABI
- bool operator()( shared_ptr<_Tp> const& __x, weak_ptr<_Up> const& __y) const _NOEXCEPT
- {return __x.owner_before(__y);}
- template <class _Tp, class _Up>
- _LIBCPP_HIDE_FROM_ABI
- bool operator()( weak_ptr<_Tp> const& __x, shared_ptr<_Up> const& __y) const _NOEXCEPT
- {return __x.owner_before(__y);}
- template <class _Tp, class _Up>
- _LIBCPP_HIDE_FROM_ABI
- bool operator()( weak_ptr<_Tp> const& __x, weak_ptr<_Up> const& __y) const _NOEXCEPT
- {return __x.owner_before(__y);}
- typedef void is_transparent;
+struct _LIBCPP_TEMPLATE_VIS owner_less<void> {
+ template <class _Tp, class _Up>
+ _LIBCPP_HIDE_FROM_ABI bool operator()(shared_ptr<_Tp> const& __x, shared_ptr<_Up> const& __y) const _NOEXCEPT {
+ return __x.owner_before(__y);
+ }
+ template <class _Tp, class _Up>
+ _LIBCPP_HIDE_FROM_ABI bool operator()(shared_ptr<_Tp> const& __x, weak_ptr<_Up> const& __y) const _NOEXCEPT {
+ return __x.owner_before(__y);
+ }
+ template <class _Tp, class _Up>
+ _LIBCPP_HIDE_FROM_ABI bool operator()(weak_ptr<_Tp> const& __x, shared_ptr<_Up> const& __y) const _NOEXCEPT {
+ return __x.owner_before(__y);
+ }
+ template <class _Tp, class _Up>
+ _LIBCPP_HIDE_FROM_ABI bool operator()(weak_ptr<_Tp> const& __x, weak_ptr<_Up> const& __y) const _NOEXCEPT {
+ return __x.owner_before(__y);
+ }
+ typedef void is_transparent;
};
#endif
-template<class _Tp>
-class _LIBCPP_TEMPLATE_VIS enable_shared_from_this
-{
- mutable weak_ptr<_Tp> __weak_this_;
+template <class _Tp>
+class _LIBCPP_TEMPLATE_VIS enable_shared_from_this {
+ mutable weak_ptr<_Tp> __weak_this_;
+
protected:
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR
- enable_shared_from_this() _NOEXCEPT {}
- _LIBCPP_HIDE_FROM_ABI
- enable_shared_from_this(enable_shared_from_this const&) _NOEXCEPT {}
- _LIBCPP_HIDE_FROM_ABI
- enable_shared_from_this& operator=(enable_shared_from_this const&) _NOEXCEPT
- {return *this;}
- _LIBCPP_HIDE_FROM_ABI
- ~enable_shared_from_this() {}
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR enable_shared_from_this() _NOEXCEPT {}
+ _LIBCPP_HIDE_FROM_ABI enable_shared_from_this(enable_shared_from_this const&) _NOEXCEPT {}
+ _LIBCPP_HIDE_FROM_ABI enable_shared_from_this& operator=(enable_shared_from_this const&) _NOEXCEPT { return *this; }
+ _LIBCPP_HIDE_FROM_ABI ~enable_shared_from_this() {}
+
public:
- _LIBCPP_HIDE_FROM_ABI
- shared_ptr<_Tp> shared_from_this()
- {return shared_ptr<_Tp>(__weak_this_);}
- _LIBCPP_HIDE_FROM_ABI
- shared_ptr<_Tp const> shared_from_this() const
- {return shared_ptr<const _Tp>(__weak_this_);}
+ _LIBCPP_HIDE_FROM_ABI shared_ptr<_Tp> shared_from_this() { return shared_ptr<_Tp>(__weak_this_); }
+ _LIBCPP_HIDE_FROM_ABI shared_ptr<_Tp const> shared_from_this() const { return shared_ptr<const _Tp>(__weak_this_); }
#if _LIBCPP_STD_VER >= 17
- _LIBCPP_HIDE_FROM_ABI
- weak_ptr<_Tp> weak_from_this() _NOEXCEPT
- { return __weak_this_; }
+ _LIBCPP_HIDE_FROM_ABI weak_ptr<_Tp> weak_from_this() _NOEXCEPT { return __weak_this_; }
- _LIBCPP_HIDE_FROM_ABI
- weak_ptr<const _Tp> weak_from_this() const _NOEXCEPT
- { return __weak_this_; }
+ _LIBCPP_HIDE_FROM_ABI weak_ptr<const _Tp> weak_from_this() const _NOEXCEPT { return __weak_this_; }
#endif // _LIBCPP_STD_VER >= 17
- template <class _Up> friend class shared_ptr;
+ template <class _Up>
+ friend class shared_ptr;
};
-template <class _Tp> struct _LIBCPP_TEMPLATE_VIS hash;
+template <class _Tp>
+struct _LIBCPP_TEMPLATE_VIS hash;
template <class _Tp>
-struct _LIBCPP_TEMPLATE_VIS hash<shared_ptr<_Tp> >
-{
+struct _LIBCPP_TEMPLATE_VIS hash<shared_ptr<_Tp> > {
#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_BINDER_TYPEDEFS)
- _LIBCPP_DEPRECATED_IN_CXX17 typedef shared_ptr<_Tp> argument_type;
- _LIBCPP_DEPRECATED_IN_CXX17 typedef size_t result_type;
+ _LIBCPP_DEPRECATED_IN_CXX17 typedef shared_ptr<_Tp> argument_type;
+ _LIBCPP_DEPRECATED_IN_CXX17 typedef size_t result_type;
#endif
- _LIBCPP_HIDE_FROM_ABI
- size_t operator()(const shared_ptr<_Tp>& __ptr) const _NOEXCEPT
- {
- return hash<typename shared_ptr<_Tp>::element_type*>()(__ptr.get());
- }
+ _LIBCPP_HIDE_FROM_ABI size_t operator()(const shared_ptr<_Tp>& __ptr) const _NOEXCEPT {
+ return hash<typename shared_ptr<_Tp>::element_type*>()(__ptr.get());
+ }
};
-template<class _CharT, class _Traits, class _Yp>
-inline _LIBCPP_HIDE_FROM_ABI
-basic_ostream<_CharT, _Traits>&
+template <class _CharT, class _Traits, class _Yp>
+inline _LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>&
operator<<(basic_ostream<_CharT, _Traits>& __os, shared_ptr<_Yp> const& __p);
-
#if !defined(_LIBCPP_HAS_NO_THREADS)
-class _LIBCPP_EXPORTED_FROM_ABI __sp_mut
-{
- void* __lx_;
+class _LIBCPP_EXPORTED_FROM_ABI __sp_mut {
+ void* __lx_;
+
public:
- void lock() _NOEXCEPT;
- void unlock() _NOEXCEPT;
+ void lock() _NOEXCEPT;
+ void unlock() _NOEXCEPT;
private:
- _LIBCPP_CONSTEXPR __sp_mut(void*) _NOEXCEPT;
- __sp_mut(const __sp_mut&);
- __sp_mut& operator=(const __sp_mut&);
+ _LIBCPP_CONSTEXPR __sp_mut(void*) _NOEXCEPT;
+ __sp_mut(const __sp_mut&);
+ __sp_mut& operator=(const __sp_mut&);
- friend _LIBCPP_EXPORTED_FROM_ABI __sp_mut& __get_sp_mut(const void*);
+ friend _LIBCPP_EXPORTED_FROM_ABI __sp_mut& __get_sp_mut(const void*);
};
_LIBCPP_EXPORTED_FROM_ABI __sp_mut& __get_sp_mut(const void*);
template <class _Tp>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-atomic_is_lock_free(const shared_ptr<_Tp>*)
-{
- return false;
+inline _LIBCPP_HIDE_FROM_ABI bool atomic_is_lock_free(const shared_ptr<_Tp>*) {
+ return false;
}
template <class _Tp>
-_LIBCPP_HIDE_FROM_ABI shared_ptr<_Tp>
-atomic_load(const shared_ptr<_Tp>* __p)
-{
- __sp_mut& __m = std::__get_sp_mut(__p);
- __m.lock();
- shared_ptr<_Tp> __q = *__p;
- __m.unlock();
- return __q;
+_LIBCPP_HIDE_FROM_ABI shared_ptr<_Tp> atomic_load(const shared_ptr<_Tp>* __p) {
+ __sp_mut& __m = std::__get_sp_mut(__p);
+ __m.lock();
+ shared_ptr<_Tp> __q = *__p;
+ __m.unlock();
+ return __q;
}
template <class _Tp>
-inline _LIBCPP_HIDE_FROM_ABI
-shared_ptr<_Tp>
-atomic_load_explicit(const shared_ptr<_Tp>* __p, memory_order)
-{
- return std::atomic_load(__p);
+inline _LIBCPP_HIDE_FROM_ABI shared_ptr<_Tp> atomic_load_explicit(const shared_ptr<_Tp>* __p, memory_order) {
+ return std::atomic_load(__p);
}
template <class _Tp>
-_LIBCPP_HIDE_FROM_ABI void
-atomic_store(shared_ptr<_Tp>* __p, shared_ptr<_Tp> __r)
-{
- __sp_mut& __m = std::__get_sp_mut(__p);
- __m.lock();
- __p->swap(__r);
- __m.unlock();
+_LIBCPP_HIDE_FROM_ABI void atomic_store(shared_ptr<_Tp>* __p, shared_ptr<_Tp> __r) {
+ __sp_mut& __m = std::__get_sp_mut(__p);
+ __m.lock();
+ __p->swap(__r);
+ __m.unlock();
}
template <class _Tp>
-inline _LIBCPP_HIDE_FROM_ABI
-void
-atomic_store_explicit(shared_ptr<_Tp>* __p, shared_ptr<_Tp> __r, memory_order)
-{
- std::atomic_store(__p, __r);
+inline _LIBCPP_HIDE_FROM_ABI void atomic_store_explicit(shared_ptr<_Tp>* __p, shared_ptr<_Tp> __r, memory_order) {
+ std::atomic_store(__p, __r);
}
template <class _Tp>
-_LIBCPP_HIDE_FROM_ABI shared_ptr<_Tp>
-atomic_exchange(shared_ptr<_Tp>* __p, shared_ptr<_Tp> __r)
-{
- __sp_mut& __m = std::__get_sp_mut(__p);
- __m.lock();
- __p->swap(__r);
- __m.unlock();
- return __r;
+_LIBCPP_HIDE_FROM_ABI shared_ptr<_Tp> atomic_exchange(shared_ptr<_Tp>* __p, shared_ptr<_Tp> __r) {
+ __sp_mut& __m = std::__get_sp_mut(__p);
+ __m.lock();
+ __p->swap(__r);
+ __m.unlock();
+ return __r;
}
template <class _Tp>
-inline _LIBCPP_HIDE_FROM_ABI
-shared_ptr<_Tp>
-atomic_exchange_explicit(shared_ptr<_Tp>* __p, shared_ptr<_Tp> __r, memory_order)
-{
- return std::atomic_exchange(__p, __r);
+inline _LIBCPP_HIDE_FROM_ABI shared_ptr<_Tp>
+atomic_exchange_explicit(shared_ptr<_Tp>* __p, shared_ptr<_Tp> __r, memory_order) {
+ return std::atomic_exchange(__p, __r);
}
template <class _Tp>
_LIBCPP_HIDE_FROM_ABI bool
-atomic_compare_exchange_strong(shared_ptr<_Tp>* __p, shared_ptr<_Tp>* __v, shared_ptr<_Tp> __w)
-{
- shared_ptr<_Tp> __temp;
- __sp_mut& __m = std::__get_sp_mut(__p);
- __m.lock();
- if (__p->__owner_equivalent(*__v))
- {
- std::swap(__temp, *__p);
- *__p = __w;
- __m.unlock();
- return true;
- }
- std::swap(__temp, *__v);
- *__v = *__p;
+atomic_compare_exchange_strong(shared_ptr<_Tp>* __p, shared_ptr<_Tp>* __v, shared_ptr<_Tp> __w) {
+ shared_ptr<_Tp> __temp;
+ __sp_mut& __m = std::__get_sp_mut(__p);
+ __m.lock();
+ if (__p->__owner_equivalent(*__v)) {
+ std::swap(__temp, *__p);
+ *__p = __w;
__m.unlock();
- return false;
+ return true;
+ }
+ std::swap(__temp, *__v);
+ *__v = *__p;
+ __m.unlock();
+ return false;
}
template <class _Tp>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-atomic_compare_exchange_weak(shared_ptr<_Tp>* __p, shared_ptr<_Tp>* __v, shared_ptr<_Tp> __w)
-{
- return std::atomic_compare_exchange_strong(__p, __v, __w);
+inline _LIBCPP_HIDE_FROM_ABI bool
+atomic_compare_exchange_weak(shared_ptr<_Tp>* __p, shared_ptr<_Tp>* __v, shared_ptr<_Tp> __w) {
+ return std::atomic_compare_exchange_strong(__p, __v, __w);
}
template <class _Tp>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-atomic_compare_exchange_strong_explicit(shared_ptr<_Tp>* __p, shared_ptr<_Tp>* __v,
- shared_ptr<_Tp> __w, memory_order, memory_order)
-{
- return std::atomic_compare_exchange_strong(__p, __v, __w);
+inline _LIBCPP_HIDE_FROM_ABI bool atomic_compare_exchange_strong_explicit(
+ shared_ptr<_Tp>* __p, shared_ptr<_Tp>* __v, shared_ptr<_Tp> __w, memory_order, memory_order) {
+ return std::atomic_compare_exchange_strong(__p, __v, __w);
}
template <class _Tp>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-atomic_compare_exchange_weak_explicit(shared_ptr<_Tp>* __p, shared_ptr<_Tp>* __v,
- shared_ptr<_Tp> __w, memory_order, memory_order)
-{
- return std::atomic_compare_exchange_weak(__p, __v, __w);
+inline _LIBCPP_HIDE_FROM_ABI bool atomic_compare_exchange_weak_explicit(
+ shared_ptr<_Tp>* __p, shared_ptr<_Tp>* __v, shared_ptr<_Tp> __w, memory_order, memory_order) {
+ return std::atomic_compare_exchange_weak(__p, __v, __w);
}
#endif // !defined(_LIBCPP_HAS_NO_THREADS)
diff --git a/contrib/llvm-project/libcxx/include/__memory/temp_value.h b/contrib/llvm-project/libcxx/include/__memory/temp_value.h
index 3ce8b4bcbb37..4a133b3fbcf6 100644
--- a/contrib/llvm-project/libcxx/include/__memory/temp_value.h
+++ b/contrib/llvm-project/libcxx/include/__memory/temp_value.h
@@ -23,32 +23,34 @@ _LIBCPP_BEGIN_NAMESPACE_STD
template <class _Tp, class _Alloc>
struct __temp_value {
- typedef allocator_traits<_Alloc> _Traits;
+ typedef allocator_traits<_Alloc> _Traits;
#ifdef _LIBCPP_CXX03_LANG
- typename aligned_storage<sizeof(_Tp), _LIBCPP_ALIGNOF(_Tp)>::type __v;
+ typename aligned_storage<sizeof(_Tp), _LIBCPP_ALIGNOF(_Tp)>::type __v;
#else
- union { _Tp __v; };
+ union {
+ _Tp __v;
+ };
#endif
- _Alloc &__a;
+ _Alloc& __a;
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _Tp *__addr() {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _Tp* __addr() {
#ifdef _LIBCPP_CXX03_LANG
- return reinterpret_cast<_Tp*>(std::addressof(__v));
+ return reinterpret_cast<_Tp*>(std::addressof(__v));
#else
- return std::addressof(__v);
+ return std::addressof(__v);
#endif
- }
+ }
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _Tp & get() { return *__addr(); }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _Tp& get() { return *__addr(); }
- template<class... _Args>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_NO_CFI
- _LIBCPP_CONSTEXPR_SINCE_CXX20 __temp_value(_Alloc &__alloc, _Args&& ... __args) : __a(__alloc) {
- _Traits::construct(__a, __addr(), std::forward<_Args>(__args)...);
- }
+ template <class... _Args>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_NO_CFI _LIBCPP_CONSTEXPR_SINCE_CXX20 __temp_value(_Alloc& __alloc, _Args&&... __args)
+ : __a(__alloc) {
+ _Traits::construct(__a, __addr(), std::forward<_Args>(__args)...);
+ }
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 ~__temp_value() { _Traits::destroy(__a, __addr()); }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 ~__temp_value() { _Traits::destroy(__a, __addr()); }
};
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__memory/temporary_buffer.h b/contrib/llvm-project/libcxx/include/__memory/temporary_buffer.h
index 28ef5d028bec..d46bda382152 100644
--- a/contrib/llvm-project/libcxx/include/__memory/temporary_buffer.h
+++ b/contrib/llvm-project/libcxx/include/__memory/temporary_buffer.h
@@ -23,62 +23,52 @@
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _Tp>
-_LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI _LIBCPP_NO_CFI _LIBCPP_DEPRECATED_IN_CXX17
-pair<_Tp*, ptrdiff_t>
-get_temporary_buffer(ptrdiff_t __n) _NOEXCEPT
-{
- pair<_Tp*, ptrdiff_t> __r(0, 0);
- const ptrdiff_t __m = (~ptrdiff_t(0) ^
- ptrdiff_t(ptrdiff_t(1) << (sizeof(ptrdiff_t) * __CHAR_BIT__ - 1)))
- / sizeof(_Tp);
- if (__n > __m)
- __n = __m;
- while (__n > 0)
- {
+_LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI _LIBCPP_NO_CFI _LIBCPP_DEPRECATED_IN_CXX17 pair<_Tp*, ptrdiff_t>
+get_temporary_buffer(ptrdiff_t __n) _NOEXCEPT {
+ pair<_Tp*, ptrdiff_t> __r(0, 0);
+ const ptrdiff_t __m =
+ (~ptrdiff_t(0) ^ ptrdiff_t(ptrdiff_t(1) << (sizeof(ptrdiff_t) * __CHAR_BIT__ - 1))) / sizeof(_Tp);
+ if (__n > __m)
+ __n = __m;
+ while (__n > 0) {
#if !defined(_LIBCPP_HAS_NO_ALIGNED_ALLOCATION)
- if (__is_overaligned_for_new(_LIBCPP_ALIGNOF(_Tp)))
- {
- align_val_t __al = align_val_t(_LIBCPP_ALIGNOF(_Tp));
- __r.first = static_cast<_Tp*>(::operator new(
- __n * sizeof(_Tp), __al, nothrow));
- } else {
- __r.first = static_cast<_Tp*>(::operator new(
- __n * sizeof(_Tp), nothrow));
- }
+ if (__is_overaligned_for_new(_LIBCPP_ALIGNOF(_Tp))) {
+ align_val_t __al = align_val_t(_LIBCPP_ALIGNOF(_Tp));
+ __r.first = static_cast<_Tp*>(::operator new(__n * sizeof(_Tp), __al, nothrow));
+ } else {
+ __r.first = static_cast<_Tp*>(::operator new(__n * sizeof(_Tp), nothrow));
+ }
#else
- if (__is_overaligned_for_new(_LIBCPP_ALIGNOF(_Tp)))
- {
- // Since aligned operator new is unavailable, return an empty
- // buffer rather than one with invalid alignment.
- return __r;
- }
+ if (__is_overaligned_for_new(_LIBCPP_ALIGNOF(_Tp))) {
+ // Since aligned operator new is unavailable, return an empty
+ // buffer rather than one with invalid alignment.
+ return __r;
+ }
- __r.first = static_cast<_Tp*>(::operator new(__n * sizeof(_Tp), nothrow));
+ __r.first = static_cast<_Tp*>(::operator new(__n * sizeof(_Tp), nothrow));
#endif
- if (__r.first)
- {
- __r.second = __n;
- break;
- }
- __n /= 2;
+ if (__r.first) {
+ __r.second = __n;
+ break;
}
- return __r;
+ __n /= 2;
+ }
+ return __r;
}
template <class _Tp>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_DEPRECATED_IN_CXX17
-void return_temporary_buffer(_Tp* __p) _NOEXCEPT
-{
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_DEPRECATED_IN_CXX17 void return_temporary_buffer(_Tp* __p) _NOEXCEPT {
std::__libcpp_deallocate_unsized((void*)__p, _LIBCPP_ALIGNOF(_Tp));
}
-struct __return_temporary_buffer
-{
-_LIBCPP_SUPPRESS_DEPRECATED_PUSH
- template <class _Tp>
- _LIBCPP_HIDE_FROM_ABI void operator()(_Tp* __p) const {std::return_temporary_buffer(__p);}
-_LIBCPP_SUPPRESS_DEPRECATED_POP
+struct __return_temporary_buffer {
+ _LIBCPP_SUPPRESS_DEPRECATED_PUSH
+ template <class _Tp>
+ _LIBCPP_HIDE_FROM_ABI void operator()(_Tp* __p) const {
+ std::return_temporary_buffer(__p);
+ }
+ _LIBCPP_SUPPRESS_DEPRECATED_POP
};
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__memory/uninitialized_algorithms.h b/contrib/llvm-project/libcxx/include/__memory/uninitialized_algorithms.h
index b0eb7001598b..2a4ecf655be2 100644
--- a/contrib/llvm-project/libcxx/include/__memory/uninitialized_algorithms.h
+++ b/contrib/llvm-project/libcxx/include/__memory/uninitialized_algorithms.h
@@ -73,9 +73,8 @@ inline _LIBCPP_HIDE_FROM_ABI pair<_InputIterator, _ForwardIterator> __uninitiali
}
template <class _InputIterator, class _ForwardIterator>
-_LIBCPP_HIDE_FROM_ABI
-_ForwardIterator uninitialized_copy(_InputIterator __ifirst, _InputIterator __ilast,
- _ForwardIterator __ofirst) {
+_LIBCPP_HIDE_FROM_ABI _ForwardIterator
+uninitialized_copy(_InputIterator __ifirst, _InputIterator __ilast, _ForwardIterator __ofirst) {
typedef typename iterator_traits<_ForwardIterator>::value_type _ValueType;
auto __result = std::__uninitialized_copy<_ValueType>(
std::move(__ifirst), std::move(__ilast), std::move(__ofirst), __always_false());
@@ -85,8 +84,8 @@ _ForwardIterator uninitialized_copy(_InputIterator __ifirst, _InputIterator __il
// uninitialized_copy_n
template <class _ValueType, class _InputIterator, class _Size, class _ForwardIterator, class _EndPredicate>
-inline _LIBCPP_HIDE_FROM_ABI pair<_InputIterator, _ForwardIterator> __uninitialized_copy_n(
- _InputIterator __ifirst, _Size __n, _ForwardIterator __ofirst, _EndPredicate __stop_copying) {
+inline _LIBCPP_HIDE_FROM_ABI pair<_InputIterator, _ForwardIterator>
+__uninitialized_copy_n(_InputIterator __ifirst, _Size __n, _ForwardIterator __ofirst, _EndPredicate __stop_copying) {
_ForwardIterator __idx = __ofirst;
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
try {
@@ -104,8 +103,8 @@ inline _LIBCPP_HIDE_FROM_ABI pair<_InputIterator, _ForwardIterator> __uninitiali
}
template <class _InputIterator, class _Size, class _ForwardIterator>
-inline _LIBCPP_HIDE_FROM_ABI _ForwardIterator uninitialized_copy_n(_InputIterator __ifirst, _Size __n,
- _ForwardIterator __ofirst) {
+inline _LIBCPP_HIDE_FROM_ABI _ForwardIterator
+uninitialized_copy_n(_InputIterator __ifirst, _Size __n, _ForwardIterator __ofirst) {
typedef typename iterator_traits<_ForwardIterator>::value_type _ValueType;
auto __result =
std::__uninitialized_copy_n<_ValueType>(std::move(__ifirst), __n, std::move(__ofirst), __always_false());
@@ -115,67 +114,57 @@ inline _LIBCPP_HIDE_FROM_ABI _ForwardIterator uninitialized_copy_n(_InputIterato
// uninitialized_fill
template <class _ValueType, class _ForwardIterator, class _Sentinel, class _Tp>
-inline _LIBCPP_HIDE_FROM_ABI
-_ForwardIterator __uninitialized_fill(_ForwardIterator __first, _Sentinel __last, const _Tp& __x)
-{
- _ForwardIterator __idx = __first;
+inline _LIBCPP_HIDE_FROM_ABI _ForwardIterator
+__uninitialized_fill(_ForwardIterator __first, _Sentinel __last, const _Tp& __x) {
+ _ForwardIterator __idx = __first;
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- try
- {
+ try {
#endif
- for (; __idx != __last; ++__idx)
- ::new (std::__voidify(*__idx)) _ValueType(__x);
+ for (; __idx != __last; ++__idx)
+ ::new (std::__voidify(*__idx)) _ValueType(__x);
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- }
- catch (...)
- {
- std::__destroy(__first, __idx);
- throw;
- }
+ } catch (...) {
+ std::__destroy(__first, __idx);
+ throw;
+ }
#endif
- return __idx;
+ return __idx;
}
template <class _ForwardIterator, class _Tp>
-inline _LIBCPP_HIDE_FROM_ABI
-void uninitialized_fill(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __x)
-{
- typedef typename iterator_traits<_ForwardIterator>::value_type _ValueType;
- (void)std::__uninitialized_fill<_ValueType>(__first, __last, __x);
+inline _LIBCPP_HIDE_FROM_ABI void
+uninitialized_fill(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __x) {
+ typedef typename iterator_traits<_ForwardIterator>::value_type _ValueType;
+ (void)std::__uninitialized_fill<_ValueType>(__first, __last, __x);
}
// uninitialized_fill_n
template <class _ValueType, class _ForwardIterator, class _Size, class _Tp>
-inline _LIBCPP_HIDE_FROM_ABI
-_ForwardIterator __uninitialized_fill_n(_ForwardIterator __first, _Size __n, const _Tp& __x)
-{
- _ForwardIterator __idx = __first;
+inline _LIBCPP_HIDE_FROM_ABI _ForwardIterator
+__uninitialized_fill_n(_ForwardIterator __first, _Size __n, const _Tp& __x) {
+ _ForwardIterator __idx = __first;
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- try
- {
+ try {
#endif
- for (; __n > 0; ++__idx, (void) --__n)
- ::new (std::__voidify(*__idx)) _ValueType(__x);
+ for (; __n > 0; ++__idx, (void)--__n)
+ ::new (std::__voidify(*__idx)) _ValueType(__x);
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- }
- catch (...)
- {
- std::__destroy(__first, __idx);
- throw;
- }
+ } catch (...) {
+ std::__destroy(__first, __idx);
+ throw;
+ }
#endif
- return __idx;
+ return __idx;
}
template <class _ForwardIterator, class _Size, class _Tp>
-inline _LIBCPP_HIDE_FROM_ABI
-_ForwardIterator uninitialized_fill_n(_ForwardIterator __first, _Size __n, const _Tp& __x)
-{
- typedef typename iterator_traits<_ForwardIterator>::value_type _ValueType;
- return std::__uninitialized_fill_n<_ValueType>(__first, __n, __x);
+inline _LIBCPP_HIDE_FROM_ABI _ForwardIterator
+uninitialized_fill_n(_ForwardIterator __first, _Size __n, const _Tp& __x) {
+ typedef typename iterator_traits<_ForwardIterator>::value_type _ValueType;
+ return std::__uninitialized_fill_n<_ValueType>(__first, __n, __x);
}
#if _LIBCPP_STD_VER >= 17
@@ -183,115 +172,107 @@ _ForwardIterator uninitialized_fill_n(_ForwardIterator __first, _Size __n, const
// uninitialized_default_construct
template <class _ValueType, class _ForwardIterator, class _Sentinel>
-inline _LIBCPP_HIDE_FROM_ABI
-_ForwardIterator __uninitialized_default_construct(_ForwardIterator __first, _Sentinel __last) {
- auto __idx = __first;
-#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- try {
-#endif
+inline _LIBCPP_HIDE_FROM_ABI _ForwardIterator
+__uninitialized_default_construct(_ForwardIterator __first, _Sentinel __last) {
+ auto __idx = __first;
+# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
+ try {
+# endif
for (; __idx != __last; ++__idx)
- ::new (std::__voidify(*__idx)) _ValueType;
-#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- } catch (...) {
- std::__destroy(__first, __idx);
- throw;
- }
-#endif
+ ::new (std::__voidify(*__idx)) _ValueType;
+# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
+ } catch (...) {
+ std::__destroy(__first, __idx);
+ throw;
+ }
+# endif
- return __idx;
+ return __idx;
}
template <class _ForwardIterator>
-inline _LIBCPP_HIDE_FROM_ABI
-void uninitialized_default_construct(_ForwardIterator __first, _ForwardIterator __last) {
- using _ValueType = typename iterator_traits<_ForwardIterator>::value_type;
- (void)std::__uninitialized_default_construct<_ValueType>(
- std::move(__first), std::move(__last));
+inline _LIBCPP_HIDE_FROM_ABI void uninitialized_default_construct(_ForwardIterator __first, _ForwardIterator __last) {
+ using _ValueType = typename iterator_traits<_ForwardIterator>::value_type;
+ (void)std::__uninitialized_default_construct<_ValueType>(std::move(__first), std::move(__last));
}
// uninitialized_default_construct_n
template <class _ValueType, class _ForwardIterator, class _Size>
-inline _LIBCPP_HIDE_FROM_ABI
-_ForwardIterator __uninitialized_default_construct_n(_ForwardIterator __first, _Size __n) {
- auto __idx = __first;
-#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- try {
-#endif
- for (; __n > 0; ++__idx, (void) --__n)
- ::new (std::__voidify(*__idx)) _ValueType;
-#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- } catch (...) {
- std::__destroy(__first, __idx);
- throw;
- }
-#endif
+inline _LIBCPP_HIDE_FROM_ABI _ForwardIterator __uninitialized_default_construct_n(_ForwardIterator __first, _Size __n) {
+ auto __idx = __first;
+# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
+ try {
+# endif
+ for (; __n > 0; ++__idx, (void)--__n)
+ ::new (std::__voidify(*__idx)) _ValueType;
+# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
+ } catch (...) {
+ std::__destroy(__first, __idx);
+ throw;
+ }
+# endif
- return __idx;
+ return __idx;
}
template <class _ForwardIterator, class _Size>
-inline _LIBCPP_HIDE_FROM_ABI
-_ForwardIterator uninitialized_default_construct_n(_ForwardIterator __first, _Size __n) {
- using _ValueType = typename iterator_traits<_ForwardIterator>::value_type;
- return std::__uninitialized_default_construct_n<_ValueType>(std::move(__first), __n);
+inline _LIBCPP_HIDE_FROM_ABI _ForwardIterator uninitialized_default_construct_n(_ForwardIterator __first, _Size __n) {
+ using _ValueType = typename iterator_traits<_ForwardIterator>::value_type;
+ return std::__uninitialized_default_construct_n<_ValueType>(std::move(__first), __n);
}
// uninitialized_value_construct
template <class _ValueType, class _ForwardIterator, class _Sentinel>
-inline _LIBCPP_HIDE_FROM_ABI
-_ForwardIterator __uninitialized_value_construct(_ForwardIterator __first, _Sentinel __last) {
- auto __idx = __first;
-#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- try {
-#endif
+inline _LIBCPP_HIDE_FROM_ABI _ForwardIterator
+__uninitialized_value_construct(_ForwardIterator __first, _Sentinel __last) {
+ auto __idx = __first;
+# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
+ try {
+# endif
for (; __idx != __last; ++__idx)
- ::new (std::__voidify(*__idx)) _ValueType();
-#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- } catch (...) {
- std::__destroy(__first, __idx);
- throw;
- }
-#endif
+ ::new (std::__voidify(*__idx)) _ValueType();
+# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
+ } catch (...) {
+ std::__destroy(__first, __idx);
+ throw;
+ }
+# endif
- return __idx;
+ return __idx;
}
template <class _ForwardIterator>
-inline _LIBCPP_HIDE_FROM_ABI
-void uninitialized_value_construct(_ForwardIterator __first, _ForwardIterator __last) {
- using _ValueType = typename iterator_traits<_ForwardIterator>::value_type;
- (void)std::__uninitialized_value_construct<_ValueType>(
- std::move(__first), std::move(__last));
+inline _LIBCPP_HIDE_FROM_ABI void uninitialized_value_construct(_ForwardIterator __first, _ForwardIterator __last) {
+ using _ValueType = typename iterator_traits<_ForwardIterator>::value_type;
+ (void)std::__uninitialized_value_construct<_ValueType>(std::move(__first), std::move(__last));
}
// uninitialized_value_construct_n
template <class _ValueType, class _ForwardIterator, class _Size>
-inline _LIBCPP_HIDE_FROM_ABI
-_ForwardIterator __uninitialized_value_construct_n(_ForwardIterator __first, _Size __n) {
- auto __idx = __first;
-#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- try {
-#endif
- for (; __n > 0; ++__idx, (void) --__n)
- ::new (std::__voidify(*__idx)) _ValueType();
-#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- } catch (...) {
- std::__destroy(__first, __idx);
- throw;
- }
-#endif
+inline _LIBCPP_HIDE_FROM_ABI _ForwardIterator __uninitialized_value_construct_n(_ForwardIterator __first, _Size __n) {
+ auto __idx = __first;
+# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
+ try {
+# endif
+ for (; __n > 0; ++__idx, (void)--__n)
+ ::new (std::__voidify(*__idx)) _ValueType();
+# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
+ } catch (...) {
+ std::__destroy(__first, __idx);
+ throw;
+ }
+# endif
- return __idx;
+ return __idx;
}
template <class _ForwardIterator, class _Size>
-inline _LIBCPP_HIDE_FROM_ABI
-_ForwardIterator uninitialized_value_construct_n(_ForwardIterator __first, _Size __n) {
- using _ValueType = typename iterator_traits<_ForwardIterator>::value_type;
- return std::__uninitialized_value_construct_n<_ValueType>(std::move(__first), __n);
+inline _LIBCPP_HIDE_FROM_ABI _ForwardIterator uninitialized_value_construct_n(_ForwardIterator __first, _Size __n) {
+ using _ValueType = typename iterator_traits<_ForwardIterator>::value_type;
+ return std::__uninitialized_value_construct_n<_ValueType>(std::move(__first), __n);
}
// uninitialized_move
@@ -309,25 +290,25 @@ inline _LIBCPP_HIDE_FROM_ABI pair<_InputIterator, _ForwardIterator> __uninitiali
_EndPredicate __stop_moving,
_IterMove __iter_move) {
auto __idx = __ofirst;
-#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
+# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
try {
-#endif
+# endif
for (; __ifirst != __ilast && !__stop_moving(__idx); ++__idx, (void)++__ifirst) {
::new (std::__voidify(*__idx)) _ValueType(__iter_move(__ifirst));
}
-#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
+# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
} catch (...) {
std::__destroy(__ofirst, __idx);
throw;
}
-#endif
+# endif
return {std::move(__ifirst), std::move(__idx)};
}
template <class _InputIterator, class _ForwardIterator>
-inline _LIBCPP_HIDE_FROM_ABI _ForwardIterator uninitialized_move(_InputIterator __ifirst, _InputIterator __ilast,
- _ForwardIterator __ofirst) {
+inline _LIBCPP_HIDE_FROM_ABI _ForwardIterator
+uninitialized_move(_InputIterator __ifirst, _InputIterator __ilast, _ForwardIterator __ofirst) {
using _ValueType = typename iterator_traits<_ForwardIterator>::value_type;
auto __iter_move = [](auto&& __iter) -> decltype(auto) { return std::move(*__iter); };
@@ -347,17 +328,17 @@ template <class _ValueType,
inline _LIBCPP_HIDE_FROM_ABI pair<_InputIterator, _ForwardIterator> __uninitialized_move_n(
_InputIterator __ifirst, _Size __n, _ForwardIterator __ofirst, _EndPredicate __stop_moving, _IterMove __iter_move) {
auto __idx = __ofirst;
-#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
+# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
try {
-#endif
+# endif
for (; __n > 0 && !__stop_moving(__idx); ++__idx, (void)++__ifirst, --__n)
::new (std::__voidify(*__idx)) _ValueType(__iter_move(__ifirst));
-#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
+# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
} catch (...) {
std::__destroy(__ofirst, __idx);
throw;
}
-#endif
+# endif
return {std::move(__ifirst), std::move(__idx)};
}
@@ -379,35 +360,35 @@ uninitialized_move_n(_InputIterator __ifirst, _Size __n, _ForwardIterator __ofir
//
// This function assumes that destructors do not throw, and that the allocator is bound to
// the correct type.
-template<class _Alloc, class _BidirIter, class = __enable_if_t<
- __has_bidirectional_iterator_category<_BidirIter>::value
->>
-_LIBCPP_HIDE_FROM_ABI
-constexpr void __allocator_destroy_multidimensional(_Alloc& __alloc, _BidirIter __first, _BidirIter __last) noexcept {
- using _ValueType = typename iterator_traits<_BidirIter>::value_type;
- static_assert(is_same_v<typename allocator_traits<_Alloc>::value_type, _ValueType>,
- "The allocator should already be rebound to the correct type");
-
- if (__first == __last)
- return;
-
- if constexpr (is_array_v<_ValueType>) {
- static_assert(!__libcpp_is_unbounded_array<_ValueType>::value,
- "arrays of unbounded arrays don't exist, but if they did we would mess up here");
-
- using _Element = remove_extent_t<_ValueType>;
- __allocator_traits_rebind_t<_Alloc, _Element> __elem_alloc(__alloc);
- do {
- --__last;
- decltype(auto) __array = *__last;
- std::__allocator_destroy_multidimensional(__elem_alloc, __array, __array + extent_v<_ValueType>);
- } while (__last != __first);
- } else {
- do {
- --__last;
- allocator_traits<_Alloc>::destroy(__alloc, std::addressof(*__last));
- } while (__last != __first);
- }
+template <class _Alloc,
+ class _BidirIter,
+ class = __enable_if_t< __has_bidirectional_iterator_category<_BidirIter>::value >>
+_LIBCPP_HIDE_FROM_ABI constexpr void
+__allocator_destroy_multidimensional(_Alloc& __alloc, _BidirIter __first, _BidirIter __last) noexcept {
+ using _ValueType = typename iterator_traits<_BidirIter>::value_type;
+ static_assert(is_same_v<typename allocator_traits<_Alloc>::value_type, _ValueType>,
+ "The allocator should already be rebound to the correct type");
+
+ if (__first == __last)
+ return;
+
+ if constexpr (is_array_v<_ValueType>) {
+ static_assert(!__libcpp_is_unbounded_array<_ValueType>::value,
+ "arrays of unbounded arrays don't exist, but if they did we would mess up here");
+
+ using _Element = remove_extent_t<_ValueType>;
+ __allocator_traits_rebind_t<_Alloc, _Element> __elem_alloc(__alloc);
+ do {
+ --__last;
+ decltype(auto) __array = *__last;
+ std::__allocator_destroy_multidimensional(__elem_alloc, __array, __array + extent_v<_ValueType>);
+ } while (__last != __first);
+ } else {
+ do {
+ --__last;
+ allocator_traits<_Alloc>::destroy(__alloc, std::addressof(*__last));
+ } while (__last != __first);
+ }
}
// Constructs the object at the given location using the allocator's construct method.
@@ -417,30 +398,29 @@ constexpr void __allocator_destroy_multidimensional(_Alloc& __alloc, _BidirIter
// elements are destroyed in reverse order of initialization using allocator destruction.
//
// This function assumes that the allocator is bound to the correct type.
-template<class _Alloc, class _Tp>
-_LIBCPP_HIDE_FROM_ABI
-constexpr void __allocator_construct_at_multidimensional(_Alloc& __alloc, _Tp* __loc) {
- static_assert(is_same_v<typename allocator_traits<_Alloc>::value_type, _Tp>,
- "The allocator should already be rebound to the correct type");
-
- if constexpr (is_array_v<_Tp>) {
- using _Element = remove_extent_t<_Tp>;
- __allocator_traits_rebind_t<_Alloc, _Element> __elem_alloc(__alloc);
- size_t __i = 0;
- _Tp& __array = *__loc;
-
- // If an exception is thrown, destroy what we have constructed so far in reverse order.
- auto __guard = std::__make_exception_guard([&]() {
- std::__allocator_destroy_multidimensional(__elem_alloc, __array, __array + __i);
- });
-
- for (; __i != extent_v<_Tp>; ++__i) {
- std::__allocator_construct_at_multidimensional(__elem_alloc, std::addressof(__array[__i]));
- }
- __guard.__complete();
- } else {
- allocator_traits<_Alloc>::construct(__alloc, __loc);
+template <class _Alloc, class _Tp>
+_LIBCPP_HIDE_FROM_ABI constexpr void __allocator_construct_at_multidimensional(_Alloc& __alloc, _Tp* __loc) {
+ static_assert(is_same_v<typename allocator_traits<_Alloc>::value_type, _Tp>,
+ "The allocator should already be rebound to the correct type");
+
+ if constexpr (is_array_v<_Tp>) {
+ using _Element = remove_extent_t<_Tp>;
+ __allocator_traits_rebind_t<_Alloc, _Element> __elem_alloc(__alloc);
+ size_t __i = 0;
+ _Tp& __array = *__loc;
+
+ // If an exception is thrown, destroy what we have constructed so far in reverse order.
+ auto __guard = std::__make_exception_guard([&]() {
+ std::__allocator_destroy_multidimensional(__elem_alloc, __array, __array + __i);
+ });
+
+ for (; __i != extent_v<_Tp>; ++__i) {
+ std::__allocator_construct_at_multidimensional(__elem_alloc, std::addressof(__array[__i]));
}
+ __guard.__complete();
+ } else {
+ allocator_traits<_Alloc>::construct(__alloc, __loc);
+ }
}
// Constructs the object at the given location using the allocator's construct method, passing along
@@ -453,33 +433,33 @@ constexpr void __allocator_construct_at_multidimensional(_Alloc& __alloc, _Tp* _
// destruction.
//
// This function assumes that the allocator is bound to the correct type.
-template<class _Alloc, class _Tp, class _Arg>
-_LIBCPP_HIDE_FROM_ABI
-constexpr void __allocator_construct_at_multidimensional(_Alloc& __alloc, _Tp* __loc, _Arg const& __arg) {
- static_assert(is_same_v<typename allocator_traits<_Alloc>::value_type, _Tp>,
- "The allocator should already be rebound to the correct type");
-
- if constexpr (is_array_v<_Tp>) {
- static_assert(is_array_v<_Arg>,
- "Provided non-array initialization argument to __allocator_construct_at_multidimensional when "
- "trying to construct an array.");
-
- using _Element = remove_extent_t<_Tp>;
- __allocator_traits_rebind_t<_Alloc, _Element> __elem_alloc(__alloc);
- size_t __i = 0;
- _Tp& __array = *__loc;
-
- // If an exception is thrown, destroy what we have constructed so far in reverse order.
- auto __guard = std::__make_exception_guard([&]() {
- std::__allocator_destroy_multidimensional(__elem_alloc, __array, __array + __i);
- });
- for (; __i != extent_v<_Tp>; ++__i) {
- std::__allocator_construct_at_multidimensional(__elem_alloc, std::addressof(__array[__i]), __arg[__i]);
- }
- __guard.__complete();
- } else {
- allocator_traits<_Alloc>::construct(__alloc, __loc, __arg);
+template <class _Alloc, class _Tp, class _Arg>
+_LIBCPP_HIDE_FROM_ABI constexpr void
+__allocator_construct_at_multidimensional(_Alloc& __alloc, _Tp* __loc, _Arg const& __arg) {
+ static_assert(is_same_v<typename allocator_traits<_Alloc>::value_type, _Tp>,
+ "The allocator should already be rebound to the correct type");
+
+ if constexpr (is_array_v<_Tp>) {
+ static_assert(is_array_v<_Arg>,
+ "Provided non-array initialization argument to __allocator_construct_at_multidimensional when "
+ "trying to construct an array.");
+
+ using _Element = remove_extent_t<_Tp>;
+ __allocator_traits_rebind_t<_Alloc, _Element> __elem_alloc(__alloc);
+ size_t __i = 0;
+ _Tp& __array = *__loc;
+
+ // If an exception is thrown, destroy what we have constructed so far in reverse order.
+ auto __guard = std::__make_exception_guard([&]() {
+ std::__allocator_destroy_multidimensional(__elem_alloc, __array, __array + __i);
+ });
+ for (; __i != extent_v<_Tp>; ++__i) {
+ std::__allocator_construct_at_multidimensional(__elem_alloc, std::addressof(__array[__i]), __arg[__i]);
}
+ __guard.__complete();
+ } else {
+ allocator_traits<_Alloc>::construct(__alloc, __loc, __arg);
+ }
}
// Given a range starting at it and containing n elements, initializes each element in the
@@ -489,19 +469,23 @@ constexpr void __allocator_construct_at_multidimensional(_Alloc& __alloc, _Tp* _
// If an exception is thrown, the initialized elements are destroyed in reverse order of
// initialization using allocator_traits destruction. If the elements in the range are C-style
// arrays, they are initialized element-wise using allocator construction, and recursively so.
-template<class _Alloc, class _BidirIter, class _Tp, class _Size = typename iterator_traits<_BidirIter>::difference_type>
+template <class _Alloc,
+ class _BidirIter,
+ class _Tp,
+ class _Size = typename iterator_traits<_BidirIter>::difference_type>
_LIBCPP_HIDE_FROM_ABI constexpr void
__uninitialized_allocator_fill_n_multidimensional(_Alloc& __alloc, _BidirIter __it, _Size __n, _Tp const& __value) {
- using _ValueType = typename iterator_traits<_BidirIter>::value_type;
- __allocator_traits_rebind_t<_Alloc, _ValueType> __value_alloc(__alloc);
- _BidirIter __begin = __it;
+ using _ValueType = typename iterator_traits<_BidirIter>::value_type;
+ __allocator_traits_rebind_t<_Alloc, _ValueType> __value_alloc(__alloc);
+ _BidirIter __begin = __it;
- // If an exception is thrown, destroy what we have constructed so far in reverse order.
- auto __guard = std::__make_exception_guard([&]() { std::__allocator_destroy_multidimensional(__value_alloc, __begin, __it); });
- for (; __n != 0; --__n, ++__it) {
- std::__allocator_construct_at_multidimensional(__value_alloc, std::addressof(*__it), __value);
- }
- __guard.__complete();
+ // If an exception is thrown, destroy what we have constructed so far in reverse order.
+ auto __guard =
+ std::__make_exception_guard([&]() { std::__allocator_destroy_multidimensional(__value_alloc, __begin, __it); });
+ for (; __n != 0; --__n, ++__it) {
+ std::__allocator_construct_at_multidimensional(__value_alloc, std::addressof(*__it), __value);
+ }
+ __guard.__complete();
}
// Same as __uninitialized_allocator_fill_n_multidimensional, but doesn't pass any initialization argument
@@ -509,16 +493,17 @@ __uninitialized_allocator_fill_n_multidimensional(_Alloc& __alloc, _BidirIter __
template <class _Alloc, class _BidirIter, class _Size = typename iterator_traits<_BidirIter>::difference_type>
_LIBCPP_HIDE_FROM_ABI constexpr void
__uninitialized_allocator_value_construct_n_multidimensional(_Alloc& __alloc, _BidirIter __it, _Size __n) {
- using _ValueType = typename iterator_traits<_BidirIter>::value_type;
- __allocator_traits_rebind_t<_Alloc, _ValueType> __value_alloc(__alloc);
- _BidirIter __begin = __it;
+ using _ValueType = typename iterator_traits<_BidirIter>::value_type;
+ __allocator_traits_rebind_t<_Alloc, _ValueType> __value_alloc(__alloc);
+ _BidirIter __begin = __it;
- // If an exception is thrown, destroy what we have constructed so far in reverse order.
- auto __guard = std::__make_exception_guard([&]() { std::__allocator_destroy_multidimensional(__value_alloc, __begin, __it); });
- for (; __n != 0; --__n, ++__it) {
- std::__allocator_construct_at_multidimensional(__value_alloc, std::addressof(*__it));
- }
- __guard.__complete();
+ // If an exception is thrown, destroy what we have constructed so far in reverse order.
+ auto __guard =
+ std::__make_exception_guard([&]() { std::__allocator_destroy_multidimensional(__value_alloc, __begin, __it); });
+ for (; __n != 0; --__n, ++__it) {
+ std::__allocator_construct_at_multidimensional(__value_alloc, std::addressof(*__it));
+ }
+ __guard.__complete();
}
#endif // _LIBCPP_STD_VER >= 17
@@ -528,7 +513,7 @@ template <class _Alloc, class _Iter, class _Sent>
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void
__allocator_destroy(_Alloc& __alloc, _Iter __first, _Sent __last) {
for (; __first != __last; ++__first)
- allocator_traits<_Alloc>::destroy(__alloc, std::__to_address(__first));
+ allocator_traits<_Alloc>::destroy(__alloc, std::__to_address(__first));
}
template <class _Alloc, class _Iter>
@@ -598,10 +583,12 @@ __uninitialized_allocator_copy_impl(_Alloc&, _In* __first1, _In* __last1, _Out*
}
template <class _Alloc, class _Iter1, class _Sent1, class _Iter2>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _Iter2 __uninitialized_allocator_copy(_Alloc& __alloc, _Iter1 __first1, _Sent1 __last1, _Iter2 __first2) {
- auto __unwrapped_range = std::__unwrap_range(__first1, __last1);
- auto __result = std::__uninitialized_allocator_copy_impl(__alloc, __unwrapped_range.first, __unwrapped_range.second, std::__unwrap_iter(__first2));
- return std::__rewrap_iter(__first2, __result);
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _Iter2
+__uninitialized_allocator_copy(_Alloc& __alloc, _Iter1 __first1, _Sent1 __last1, _Iter2 __first2) {
+ auto __unwrapped_range = std::__unwrap_range(__first1, __last1);
+ auto __result = std::__uninitialized_allocator_copy_impl(
+ __alloc, __unwrapped_range.first, __unwrapped_range.second, std::__unwrap_iter(__first2));
+ return std::__rewrap_iter(__first2, __result);
}
// Move-construct the elements [__first1, __last1) into [__first2, __first2 + N)
@@ -610,8 +597,8 @@ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _Iter2 __uninitialized_alloc
// Otherwise try to copy all elements. If an exception is thrown the already copied
// elements are destroyed in reverse order of their construction.
template <class _Alloc, class _Iter1, class _Sent1, class _Iter2>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _Iter2 __uninitialized_allocator_move_if_noexcept(
- _Alloc& __alloc, _Iter1 __first1, _Sent1 __last1, _Iter2 __first2) {
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _Iter2
+__uninitialized_allocator_move_if_noexcept(_Alloc& __alloc, _Iter1 __first1, _Sent1 __last1, _Iter2 __first2) {
static_assert(__is_cpp17_move_insertable<_Alloc>::value,
"The specified type does not meet the requirements of Cpp17MoveInsertable");
auto __destruct_first = __first2;
diff --git a/contrib/llvm-project/libcxx/include/__memory/unique_ptr.h b/contrib/llvm-project/libcxx/include/__memory/unique_ptr.h
index 32e4942a834c..7bf5e3c5e4e6 100644
--- a/contrib/llvm-project/libcxx/include/__memory/unique_ptr.h
+++ b/contrib/llvm-project/libcxx/include/__memory/unique_ptr.h
@@ -51,16 +51,14 @@ _LIBCPP_BEGIN_NAMESPACE_STD
template <class _Tp>
struct _LIBCPP_TEMPLATE_VIS default_delete {
- static_assert(!is_function<_Tp>::value,
- "default_delete cannot be instantiated for function types");
+ static_assert(!is_function<_Tp>::value, "default_delete cannot be instantiated for function types");
#ifndef _LIBCPP_CXX03_LANG
_LIBCPP_HIDE_FROM_ABI constexpr default_delete() _NOEXCEPT = default;
#else
_LIBCPP_HIDE_FROM_ABI default_delete() {}
#endif
template <class _Up, __enable_if_t<is_convertible<_Up*, _Tp*>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 default_delete(
- const default_delete<_Up>&) _NOEXCEPT {}
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 default_delete(const default_delete<_Up>&) _NOEXCEPT {}
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 void operator()(_Tp* __ptr) const _NOEXCEPT {
static_assert(sizeof(_Tp) >= 0, "cannot delete an incomplete type");
@@ -73,8 +71,7 @@ template <class _Tp>
struct _LIBCPP_TEMPLATE_VIS default_delete<_Tp[]> {
private:
template <class _Up>
- struct _EnableIfConvertible
- : enable_if<is_convertible<_Up(*)[], _Tp(*)[]>::value> {};
+ struct _EnableIfConvertible : enable_if<is_convertible<_Up (*)[], _Tp (*)[]>::value> {};
public:
#ifndef _LIBCPP_CXX03_LANG
@@ -130,65 +127,52 @@ public:
typedef _Dp deleter_type;
typedef _LIBCPP_NODEBUG typename __pointer<_Tp, deleter_type>::type pointer;
- static_assert(!is_rvalue_reference<deleter_type>::value,
- "the specified deleter type cannot be an rvalue reference");
+ static_assert(!is_rvalue_reference<deleter_type>::value, "the specified deleter type cannot be an rvalue reference");
private:
__compressed_pair<pointer, deleter_type> __ptr_;
- struct __nat { int __for_bool_; };
+ struct __nat {
+ int __for_bool_;
+ };
typedef _LIBCPP_NODEBUG __unique_ptr_deleter_sfinae<_Dp> _DeleterSFINAE;
template <bool _Dummy>
- using _LValRefType _LIBCPP_NODEBUG =
- typename __dependent_type<_DeleterSFINAE, _Dummy>::__lval_ref_type;
+ using _LValRefType _LIBCPP_NODEBUG = typename __dependent_type<_DeleterSFINAE, _Dummy>::__lval_ref_type;
template <bool _Dummy>
- using _GoodRValRefType _LIBCPP_NODEBUG =
- typename __dependent_type<_DeleterSFINAE, _Dummy>::__good_rval_ref_type;
+ using _GoodRValRefType _LIBCPP_NODEBUG = typename __dependent_type<_DeleterSFINAE, _Dummy>::__good_rval_ref_type;
template <bool _Dummy>
- using _BadRValRefType _LIBCPP_NODEBUG =
- typename __dependent_type<_DeleterSFINAE, _Dummy>::__bad_rval_ref_type;
+ using _BadRValRefType _LIBCPP_NODEBUG = typename __dependent_type<_DeleterSFINAE, _Dummy>::__bad_rval_ref_type;
- template <bool _Dummy, class _Deleter = typename __dependent_type<
- __type_identity<deleter_type>, _Dummy>::type>
+ template <bool _Dummy, class _Deleter = typename __dependent_type< __type_identity<deleter_type>, _Dummy>::type>
using _EnableIfDeleterDefaultConstructible _LIBCPP_NODEBUG =
- __enable_if_t<is_default_constructible<_Deleter>::value &&
- !is_pointer<_Deleter>::value>;
+ __enable_if_t<is_default_constructible<_Deleter>::value && !is_pointer<_Deleter>::value>;
template <class _ArgType>
- using _EnableIfDeleterConstructible _LIBCPP_NODEBUG =
- __enable_if_t<is_constructible<deleter_type, _ArgType>::value>;
+ using _EnableIfDeleterConstructible _LIBCPP_NODEBUG = __enable_if_t<is_constructible<deleter_type, _ArgType>::value>;
template <class _UPtr, class _Up>
- using _EnableIfMoveConvertible _LIBCPP_NODEBUG = __enable_if_t<
- is_convertible<typename _UPtr::pointer, pointer>::value &&
- !is_array<_Up>::value
- >;
+ using _EnableIfMoveConvertible _LIBCPP_NODEBUG =
+ __enable_if_t< is_convertible<typename _UPtr::pointer, pointer>::value && !is_array<_Up>::value >;
template <class _UDel>
- using _EnableIfDeleterConvertible _LIBCPP_NODEBUG = __enable_if_t<
- (is_reference<_Dp>::value && is_same<_Dp, _UDel>::value) ||
- (!is_reference<_Dp>::value && is_convertible<_UDel, _Dp>::value)
- >;
+ using _EnableIfDeleterConvertible _LIBCPP_NODEBUG =
+ __enable_if_t< (is_reference<_Dp>::value && is_same<_Dp, _UDel>::value) ||
+ (!is_reference<_Dp>::value && is_convertible<_UDel, _Dp>::value) >;
template <class _UDel>
- using _EnableIfDeleterAssignable = __enable_if_t<
- is_assignable<_Dp&, _UDel&&>::value
- >;
+ using _EnableIfDeleterAssignable = __enable_if_t< is_assignable<_Dp&, _UDel&&>::value >;
public:
- template <bool _Dummy = true,
- class = _EnableIfDeleterDefaultConstructible<_Dummy> >
- _LIBCPP_HIDE_FROM_ABI
- _LIBCPP_CONSTEXPR unique_ptr() _NOEXCEPT : __ptr_(__value_init_tag(), __value_init_tag()) {}
+ template <bool _Dummy = true, class = _EnableIfDeleterDefaultConstructible<_Dummy> >
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR unique_ptr() _NOEXCEPT : __ptr_(__value_init_tag(), __value_init_tag()) {}
- template <bool _Dummy = true,
- class = _EnableIfDeleterDefaultConstructible<_Dummy> >
- _LIBCPP_HIDE_FROM_ABI
- _LIBCPP_CONSTEXPR unique_ptr(nullptr_t) _NOEXCEPT : __ptr_(__value_init_tag(), __value_init_tag()) {}
+ template <bool _Dummy = true, class = _EnableIfDeleterDefaultConstructible<_Dummy> >
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR unique_ptr(nullptr_t) _NOEXCEPT
+ : __ptr_(__value_init_tag(), __value_init_tag()) {}
template <bool _Dummy = true, class = _EnableIfDeleterDefaultConstructible<_Dummy> >
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 explicit unique_ptr(pointer __p) _NOEXCEPT
@@ -199,16 +183,13 @@ public:
: __ptr_(__p, __d) {}
template <bool _Dummy = true, class = _EnableIfDeleterConstructible<_GoodRValRefType<_Dummy> > >
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23
- unique_ptr(pointer __p, _GoodRValRefType<_Dummy> __d) _NOEXCEPT : __ptr_(__p, std::move(__d)) {
- static_assert(!is_reference<deleter_type>::value,
- "rvalue deleter bound to reference");
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 unique_ptr(pointer __p, _GoodRValRefType<_Dummy> __d) _NOEXCEPT
+ : __ptr_(__p, std::move(__d)) {
+ static_assert(!is_reference<deleter_type>::value, "rvalue deleter bound to reference");
}
- template <bool _Dummy = true,
- class = _EnableIfDeleterConstructible<_BadRValRefType<_Dummy> > >
- _LIBCPP_HIDE_FROM_ABI
- unique_ptr(pointer __p, _BadRValRefType<_Dummy> __d) = delete;
+ template <bool _Dummy = true, class = _EnableIfDeleterConstructible<_BadRValRefType<_Dummy> > >
+ _LIBCPP_HIDE_FROM_ABI unique_ptr(pointer __p, _BadRValRefType<_Dummy> __d) = delete;
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 unique_ptr(unique_ptr&& __u) _NOEXCEPT
: __ptr_(__u.release(), std::forward<deleter_type>(__u.get_deleter())) {}
@@ -221,11 +202,9 @@ public:
: __ptr_(__u.release(), std::forward<_Ep>(__u.get_deleter())) {}
#if _LIBCPP_STD_VER <= 14 || defined(_LIBCPP_ENABLE_CXX17_REMOVED_AUTO_PTR)
- template <class _Up, __enable_if_t<is_convertible<_Up*, _Tp*>::value &&
- is_same<_Dp, default_delete<_Tp> >::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI
- unique_ptr(auto_ptr<_Up>&& __p) _NOEXCEPT
- : __ptr_(__p.release(), __value_init_tag()) {}
+ template <class _Up,
+ __enable_if_t<is_convertible<_Up*, _Tp*>::value && is_same<_Dp, default_delete<_Tp> >::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI unique_ptr(auto_ptr<_Up>&& __p) _NOEXCEPT : __ptr_(__p.release(), __value_init_tag()) {}
#endif
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 unique_ptr& operator=(unique_ptr&& __u) _NOEXCEPT {
@@ -245,18 +224,16 @@ public:
}
#if _LIBCPP_STD_VER <= 14 || defined(_LIBCPP_ENABLE_CXX17_REMOVED_AUTO_PTR)
- template <class _Up, __enable_if_t<is_convertible<_Up*, _Tp*>::value &&
- is_same<_Dp, default_delete<_Tp> >::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI
- unique_ptr&
- operator=(auto_ptr<_Up> __p) {
+ template <class _Up,
+ __enable_if_t<is_convertible<_Up*, _Tp*>::value && is_same<_Dp, default_delete<_Tp> >::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI unique_ptr& operator=(auto_ptr<_Up> __p) {
reset(__p.release());
return *this;
}
#endif
#ifdef _LIBCPP_CXX03_LANG
- unique_ptr(unique_ptr const&) = delete;
+ unique_ptr(unique_ptr const&) = delete;
unique_ptr& operator=(unique_ptr const&) = delete;
#endif
@@ -270,13 +247,9 @@ public:
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 __add_lvalue_reference_t<_Tp> operator*() const {
return *__ptr_.first();
}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 pointer operator->() const _NOEXCEPT {
- return __ptr_.first();
- }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 pointer operator->() const _NOEXCEPT { return __ptr_.first(); }
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 pointer get() const _NOEXCEPT { return __ptr_.first(); }
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 deleter_type& get_deleter() _NOEXCEPT {
- return __ptr_.second();
- }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 deleter_type& get_deleter() _NOEXCEPT { return __ptr_.second(); }
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 const deleter_type& get_deleter() const _NOEXCEPT {
return __ptr_.second();
}
@@ -285,24 +258,21 @@ public:
}
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 pointer release() _NOEXCEPT {
- pointer __t = __ptr_.first();
+ pointer __t = __ptr_.first();
__ptr_.first() = pointer();
return __t;
}
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 void reset(pointer __p = pointer()) _NOEXCEPT {
- pointer __tmp = __ptr_.first();
+ pointer __tmp = __ptr_.first();
__ptr_.first() = __p;
if (__tmp)
__ptr_.second()(__tmp);
}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 void swap(unique_ptr& __u) _NOEXCEPT {
- __ptr_.swap(__u.__ptr_);
- }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 void swap(unique_ptr& __u) _NOEXCEPT { __ptr_.swap(__u.__ptr_); }
};
-
template <class _Tp, class _Dp>
class _LIBCPP_UNIQUE_PTR_TRIVIAL_ABI _LIBCPP_TEMPLATE_VIS unique_ptr<_Tp[], _Dp> {
public:
@@ -319,71 +289,52 @@ private:
template <class _FromElem>
struct _CheckArrayPointerConversion<_FromElem*>
: integral_constant<bool,
- is_same<_FromElem*, pointer>::value ||
- (is_same<pointer, element_type*>::value &&
- is_convertible<_FromElem(*)[], element_type(*)[]>::value)
- >
- {};
+ is_same<_FromElem*, pointer>::value ||
+ (is_same<pointer, element_type*>::value &&
+ is_convertible<_FromElem (*)[], element_type (*)[]>::value) > {};
typedef __unique_ptr_deleter_sfinae<_Dp> _DeleterSFINAE;
template <bool _Dummy>
- using _LValRefType _LIBCPP_NODEBUG =
- typename __dependent_type<_DeleterSFINAE, _Dummy>::__lval_ref_type;
+ using _LValRefType _LIBCPP_NODEBUG = typename __dependent_type<_DeleterSFINAE, _Dummy>::__lval_ref_type;
template <bool _Dummy>
- using _GoodRValRefType _LIBCPP_NODEBUG =
- typename __dependent_type<_DeleterSFINAE, _Dummy>::__good_rval_ref_type;
+ using _GoodRValRefType _LIBCPP_NODEBUG = typename __dependent_type<_DeleterSFINAE, _Dummy>::__good_rval_ref_type;
template <bool _Dummy>
- using _BadRValRefType _LIBCPP_NODEBUG =
- typename __dependent_type<_DeleterSFINAE, _Dummy>::__bad_rval_ref_type;
+ using _BadRValRefType _LIBCPP_NODEBUG = typename __dependent_type<_DeleterSFINAE, _Dummy>::__bad_rval_ref_type;
- template <bool _Dummy, class _Deleter = typename __dependent_type<
- __type_identity<deleter_type>, _Dummy>::type>
+ template <bool _Dummy, class _Deleter = typename __dependent_type< __type_identity<deleter_type>, _Dummy>::type>
using _EnableIfDeleterDefaultConstructible _LIBCPP_NODEBUG =
- __enable_if_t<is_default_constructible<_Deleter>::value &&
- !is_pointer<_Deleter>::value>;
+ __enable_if_t<is_default_constructible<_Deleter>::value && !is_pointer<_Deleter>::value>;
template <class _ArgType>
- using _EnableIfDeleterConstructible _LIBCPP_NODEBUG =
- __enable_if_t<is_constructible<deleter_type, _ArgType>::value>;
+ using _EnableIfDeleterConstructible _LIBCPP_NODEBUG = __enable_if_t<is_constructible<deleter_type, _ArgType>::value>;
template <class _Pp>
- using _EnableIfPointerConvertible _LIBCPP_NODEBUG = __enable_if_t<
- _CheckArrayPointerConversion<_Pp>::value
- >;
-
- template <class _UPtr, class _Up,
- class _ElemT = typename _UPtr::element_type>
- using _EnableIfMoveConvertible _LIBCPP_NODEBUG = __enable_if_t<
- is_array<_Up>::value &&
- is_same<pointer, element_type*>::value &&
- is_same<typename _UPtr::pointer, _ElemT*>::value &&
- is_convertible<_ElemT(*)[], element_type(*)[]>::value
- >;
+ using _EnableIfPointerConvertible _LIBCPP_NODEBUG = __enable_if_t< _CheckArrayPointerConversion<_Pp>::value >;
+
+ template <class _UPtr, class _Up, class _ElemT = typename _UPtr::element_type>
+ using _EnableIfMoveConvertible _LIBCPP_NODEBUG =
+ __enable_if_t< is_array<_Up>::value && is_same<pointer, element_type*>::value &&
+ is_same<typename _UPtr::pointer, _ElemT*>::value &&
+ is_convertible<_ElemT (*)[], element_type (*)[]>::value >;
template <class _UDel>
- using _EnableIfDeleterConvertible _LIBCPP_NODEBUG = __enable_if_t<
- (is_reference<_Dp>::value && is_same<_Dp, _UDel>::value) ||
- (!is_reference<_Dp>::value && is_convertible<_UDel, _Dp>::value)
- >;
+ using _EnableIfDeleterConvertible _LIBCPP_NODEBUG =
+ __enable_if_t< (is_reference<_Dp>::value && is_same<_Dp, _UDel>::value) ||
+ (!is_reference<_Dp>::value && is_convertible<_UDel, _Dp>::value) >;
template <class _UDel>
- using _EnableIfDeleterAssignable _LIBCPP_NODEBUG = __enable_if_t<
- is_assignable<_Dp&, _UDel&&>::value
- >;
+ using _EnableIfDeleterAssignable _LIBCPP_NODEBUG = __enable_if_t< is_assignable<_Dp&, _UDel&&>::value >;
public:
- template <bool _Dummy = true,
- class = _EnableIfDeleterDefaultConstructible<_Dummy> >
- _LIBCPP_HIDE_FROM_ABI
- _LIBCPP_CONSTEXPR unique_ptr() _NOEXCEPT : __ptr_(__value_init_tag(), __value_init_tag()) {}
+ template <bool _Dummy = true, class = _EnableIfDeleterDefaultConstructible<_Dummy> >
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR unique_ptr() _NOEXCEPT : __ptr_(__value_init_tag(), __value_init_tag()) {}
- template <bool _Dummy = true,
- class = _EnableIfDeleterDefaultConstructible<_Dummy> >
- _LIBCPP_HIDE_FROM_ABI
- _LIBCPP_CONSTEXPR unique_ptr(nullptr_t) _NOEXCEPT : __ptr_(__value_init_tag(), __value_init_tag()) {}
+ template <bool _Dummy = true, class = _EnableIfDeleterDefaultConstructible<_Dummy> >
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR unique_ptr(nullptr_t) _NOEXCEPT
+ : __ptr_(__value_init_tag(), __value_init_tag()) {}
template <class _Pp,
bool _Dummy = true,
@@ -409,22 +360,20 @@ public:
class = _EnableIfPointerConvertible<_Pp> >
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 unique_ptr(_Pp __p, _GoodRValRefType<_Dummy> __d) _NOEXCEPT
: __ptr_(__p, std::move(__d)) {
- static_assert(!is_reference<deleter_type>::value,
- "rvalue deleter bound to reference");
+ static_assert(!is_reference<deleter_type>::value, "rvalue deleter bound to reference");
}
template <bool _Dummy = true, class = _EnableIfDeleterConstructible<_GoodRValRefType<_Dummy> > >
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 unique_ptr(nullptr_t, _GoodRValRefType<_Dummy> __d) _NOEXCEPT
: __ptr_(nullptr, std::move(__d)) {
- static_assert(!is_reference<deleter_type>::value,
- "rvalue deleter bound to reference");
+ static_assert(!is_reference<deleter_type>::value, "rvalue deleter bound to reference");
}
- template <class _Pp, bool _Dummy = true,
- class = _EnableIfDeleterConstructible<_BadRValRefType<_Dummy> >,
- class = _EnableIfPointerConvertible<_Pp> >
- _LIBCPP_HIDE_FROM_ABI
- unique_ptr(_Pp __p, _BadRValRefType<_Dummy> __d) = delete;
+ template <class _Pp,
+ bool _Dummy = true,
+ class = _EnableIfDeleterConstructible<_BadRValRefType<_Dummy> >,
+ class = _EnableIfPointerConvertible<_Pp> >
+ _LIBCPP_HIDE_FROM_ABI unique_ptr(_Pp __p, _BadRValRefType<_Dummy> __d) = delete;
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 unique_ptr(unique_ptr&& __u) _NOEXCEPT
: __ptr_(__u.release(), std::forward<deleter_type>(__u.get_deleter())) {}
@@ -453,9 +402,10 @@ public:
}
#ifdef _LIBCPP_CXX03_LANG
- unique_ptr(unique_ptr const&) = delete;
+ unique_ptr(unique_ptr const&) = delete;
unique_ptr& operator=(unique_ptr const&) = delete;
#endif
+
public:
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 ~unique_ptr() { reset(); }
@@ -464,15 +414,12 @@ public:
return *this;
}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 __add_lvalue_reference_t<_Tp>
- operator[](size_t __i) const {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 __add_lvalue_reference_t<_Tp> operator[](size_t __i) const {
return __ptr_.first()[__i];
}
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 pointer get() const _NOEXCEPT { return __ptr_.first(); }
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 deleter_type& get_deleter() _NOEXCEPT {
- return __ptr_.second();
- }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 deleter_type& get_deleter() _NOEXCEPT { return __ptr_.second(); }
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 const deleter_type& get_deleter() const _NOEXCEPT {
return __ptr_.second();
@@ -482,36 +429,32 @@ public:
}
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 pointer release() _NOEXCEPT {
- pointer __t = __ptr_.first();
+ pointer __t = __ptr_.first();
__ptr_.first() = pointer();
return __t;
}
template <class _Pp, __enable_if_t<_CheckArrayPointerConversion<_Pp>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23
- void reset(_Pp __p) _NOEXCEPT {
- pointer __tmp = __ptr_.first();
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 void reset(_Pp __p) _NOEXCEPT {
+ pointer __tmp = __ptr_.first();
__ptr_.first() = __p;
if (__tmp)
__ptr_.second()(__tmp);
}
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 void reset(nullptr_t = nullptr) _NOEXCEPT {
- pointer __tmp = __ptr_.first();
+ pointer __tmp = __ptr_.first();
__ptr_.first() = nullptr;
if (__tmp)
__ptr_.second()(__tmp);
}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 void swap(unique_ptr& __u) _NOEXCEPT {
- __ptr_.swap(__u.__ptr_);
- }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 void swap(unique_ptr& __u) _NOEXCEPT { __ptr_.swap(__u.__ptr_); }
};
template <class _Tp, class _Dp, __enable_if_t<__is_swappable<_Dp>::value, int> = 0>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23
- void
- swap(unique_ptr<_Tp, _Dp>& __x, unique_ptr<_Tp, _Dp>& __y) _NOEXCEPT {
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 void
+swap(unique_ptr<_Tp, _Dp>& __x, unique_ptr<_Tp, _Dp>& __y) _NOEXCEPT {
__x.swap(__y);
}
@@ -523,47 +466,41 @@ operator==(const unique_ptr<_T1, _D1>& __x, const unique_ptr<_T2, _D2>& __y) {
#if _LIBCPP_STD_VER <= 17
template <class _T1, class _D1, class _T2, class _D2>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator!=(const unique_ptr<_T1, _D1>& __x, const unique_ptr<_T2, _D2>& __y) {return !(__x == __y);}
+inline _LIBCPP_HIDE_FROM_ABI bool operator!=(const unique_ptr<_T1, _D1>& __x, const unique_ptr<_T2, _D2>& __y) {
+ return !(__x == __y);
+}
#endif
template <class _T1, class _D1, class _T2, class _D2>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator< (const unique_ptr<_T1, _D1>& __x, const unique_ptr<_T2, _D2>& __y)
-{
- typedef typename unique_ptr<_T1, _D1>::pointer _P1;
- typedef typename unique_ptr<_T2, _D2>::pointer _P2;
- typedef typename common_type<_P1, _P2>::type _Vp;
- return less<_Vp>()(__x.get(), __y.get());
+inline _LIBCPP_HIDE_FROM_ABI bool operator<(const unique_ptr<_T1, _D1>& __x, const unique_ptr<_T2, _D2>& __y) {
+ typedef typename unique_ptr<_T1, _D1>::pointer _P1;
+ typedef typename unique_ptr<_T2, _D2>::pointer _P2;
+ typedef typename common_type<_P1, _P2>::type _Vp;
+ return less<_Vp>()(__x.get(), __y.get());
}
template <class _T1, class _D1, class _T2, class _D2>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator> (const unique_ptr<_T1, _D1>& __x, const unique_ptr<_T2, _D2>& __y) {return __y < __x;}
+inline _LIBCPP_HIDE_FROM_ABI bool operator>(const unique_ptr<_T1, _D1>& __x, const unique_ptr<_T2, _D2>& __y) {
+ return __y < __x;
+}
template <class _T1, class _D1, class _T2, class _D2>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator<=(const unique_ptr<_T1, _D1>& __x, const unique_ptr<_T2, _D2>& __y) {return !(__y < __x);}
+inline _LIBCPP_HIDE_FROM_ABI bool operator<=(const unique_ptr<_T1, _D1>& __x, const unique_ptr<_T2, _D2>& __y) {
+ return !(__y < __x);
+}
template <class _T1, class _D1, class _T2, class _D2>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator>=(const unique_ptr<_T1, _D1>& __x, const unique_ptr<_T2, _D2>& __y) {return !(__x < __y);}
-
+inline _LIBCPP_HIDE_FROM_ABI bool operator>=(const unique_ptr<_T1, _D1>& __x, const unique_ptr<_T2, _D2>& __y) {
+ return !(__x < __y);
+}
#if _LIBCPP_STD_VER >= 20
template <class _T1, class _D1, class _T2, class _D2>
-requires three_way_comparable_with<typename unique_ptr<_T1, _D1>::pointer,
- typename unique_ptr<_T2, _D2>::pointer>
+ requires three_way_comparable_with<typename unique_ptr<_T1, _D1>::pointer, typename unique_ptr<_T2, _D2>::pointer>
_LIBCPP_HIDE_FROM_ABI
-compare_three_way_result_t<typename unique_ptr<_T1, _D1>::pointer,
- typename unique_ptr<_T2, _D2>::pointer>
-operator<=>(const unique_ptr<_T1, _D1>& __x, const unique_ptr<_T2, _D2>& __y) {
- return compare_three_way()(__x.get(), __y.get());
+ compare_three_way_result_t<typename unique_ptr<_T1, _D1>::pointer, typename unique_ptr<_T2, _D2>::pointer>
+ operator<=>(const unique_ptr<_T1, _D1>& __x, const unique_ptr<_T2, _D2>& __y) {
+ return compare_three_way()(__x.get(), __y.get());
}
#endif
@@ -575,108 +512,87 @@ operator==(const unique_ptr<_T1, _D1>& __x, nullptr_t) _NOEXCEPT {
#if _LIBCPP_STD_VER <= 17
template <class _T1, class _D1>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator==(nullptr_t, const unique_ptr<_T1, _D1>& __x) _NOEXCEPT
-{
- return !__x;
+inline _LIBCPP_HIDE_FROM_ABI bool operator==(nullptr_t, const unique_ptr<_T1, _D1>& __x) _NOEXCEPT {
+ return !__x;
}
template <class _T1, class _D1>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator!=(const unique_ptr<_T1, _D1>& __x, nullptr_t) _NOEXCEPT
-{
- return static_cast<bool>(__x);
+inline _LIBCPP_HIDE_FROM_ABI bool operator!=(const unique_ptr<_T1, _D1>& __x, nullptr_t) _NOEXCEPT {
+ return static_cast<bool>(__x);
}
template <class _T1, class _D1>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator!=(nullptr_t, const unique_ptr<_T1, _D1>& __x) _NOEXCEPT
-{
- return static_cast<bool>(__x);
+inline _LIBCPP_HIDE_FROM_ABI bool operator!=(nullptr_t, const unique_ptr<_T1, _D1>& __x) _NOEXCEPT {
+ return static_cast<bool>(__x);
}
#endif // _LIBCPP_STD_VER <= 17
template <class _T1, class _D1>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bool
-operator<(const unique_ptr<_T1, _D1>& __x, nullptr_t) {
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bool operator<(const unique_ptr<_T1, _D1>& __x, nullptr_t) {
typedef typename unique_ptr<_T1, _D1>::pointer _P1;
return less<_P1>()(__x.get(), nullptr);
}
template <class _T1, class _D1>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bool
-operator<(nullptr_t, const unique_ptr<_T1, _D1>& __x) {
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bool operator<(nullptr_t, const unique_ptr<_T1, _D1>& __x) {
typedef typename unique_ptr<_T1, _D1>::pointer _P1;
return less<_P1>()(nullptr, __x.get());
}
template <class _T1, class _D1>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bool
-operator>(const unique_ptr<_T1, _D1>& __x, nullptr_t) {
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bool operator>(const unique_ptr<_T1, _D1>& __x, nullptr_t) {
return nullptr < __x;
}
template <class _T1, class _D1>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bool
-operator>(nullptr_t, const unique_ptr<_T1, _D1>& __x) {
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bool operator>(nullptr_t, const unique_ptr<_T1, _D1>& __x) {
return __x < nullptr;
}
template <class _T1, class _D1>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bool
-operator<=(const unique_ptr<_T1, _D1>& __x, nullptr_t) {
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bool operator<=(const unique_ptr<_T1, _D1>& __x, nullptr_t) {
return !(nullptr < __x);
}
template <class _T1, class _D1>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bool
-operator<=(nullptr_t, const unique_ptr<_T1, _D1>& __x) {
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bool operator<=(nullptr_t, const unique_ptr<_T1, _D1>& __x) {
return !(__x < nullptr);
}
template <class _T1, class _D1>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bool
-operator>=(const unique_ptr<_T1, _D1>& __x, nullptr_t) {
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bool operator>=(const unique_ptr<_T1, _D1>& __x, nullptr_t) {
return !(__x < nullptr);
}
template <class _T1, class _D1>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bool
-operator>=(nullptr_t, const unique_ptr<_T1, _D1>& __x) {
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bool operator>=(nullptr_t, const unique_ptr<_T1, _D1>& __x) {
return !(nullptr < __x);
}
#if _LIBCPP_STD_VER >= 20
template <class _T1, class _D1>
- requires three_way_comparable<
- typename unique_ptr<_T1, _D1>::pointer> _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23
- compare_three_way_result_t<typename unique_ptr<_T1, _D1>::pointer>
+ requires three_way_comparable< typename unique_ptr<_T1, _D1>::pointer>
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 compare_three_way_result_t<typename unique_ptr<_T1, _D1>::pointer>
operator<=>(const unique_ptr<_T1, _D1>& __x, nullptr_t) {
- return compare_three_way()(__x.get(), static_cast<typename unique_ptr<_T1, _D1>::pointer>(nullptr));
+ return compare_three_way()(__x.get(), static_cast<typename unique_ptr<_T1, _D1>::pointer>(nullptr));
}
#endif
#if _LIBCPP_STD_VER >= 14
-template<class _Tp>
-struct __unique_if
-{
- typedef unique_ptr<_Tp> __unique_single;
+template <class _Tp>
+struct __unique_if {
+ typedef unique_ptr<_Tp> __unique_single;
};
-template<class _Tp>
-struct __unique_if<_Tp[]>
-{
- typedef unique_ptr<_Tp[]> __unique_array_unknown_bound;
+template <class _Tp>
+struct __unique_if<_Tp[]> {
+ typedef unique_ptr<_Tp[]> __unique_array_unknown_bound;
};
-template<class _Tp, size_t _Np>
-struct __unique_if<_Tp[_Np]>
-{
- typedef void __unique_array_known_bound;
+template <class _Tp, size_t _Np>
+struct __unique_if<_Tp[_Np]> {
+ typedef void __unique_array_known_bound;
};
template <class _Tp, class... _Args>
@@ -692,9 +608,8 @@ make_unique(size_t __n) {
return unique_ptr<_Tp>(new _Up[__n]());
}
-template<class _Tp, class... _Args>
- typename __unique_if<_Tp>::__unique_array_known_bound
- make_unique(_Args&&...) = delete;
+template <class _Tp, class... _Args>
+typename __unique_if<_Tp>::__unique_array_known_bound make_unique(_Args&&...) = delete;
#endif // _LIBCPP_STD_VER >= 14
@@ -712,32 +627,30 @@ make_unique_for_overwrite(size_t __n) {
return unique_ptr<_Tp>(new __remove_extent_t<_Tp>[__n]);
}
-template<class _Tp, class... _Args>
+template <class _Tp, class... _Args>
typename __unique_if<_Tp>::__unique_array_known_bound make_unique_for_overwrite(_Args&&...) = delete;
#endif // _LIBCPP_STD_VER >= 20
-template <class _Tp> struct _LIBCPP_TEMPLATE_VIS hash;
+template <class _Tp>
+struct _LIBCPP_TEMPLATE_VIS hash;
template <class _Tp, class _Dp>
#ifdef _LIBCPP_CXX03_LANG
struct _LIBCPP_TEMPLATE_VIS hash<unique_ptr<_Tp, _Dp> >
#else
-struct _LIBCPP_TEMPLATE_VIS hash<__enable_hash_helper<
- unique_ptr<_Tp, _Dp>, typename unique_ptr<_Tp, _Dp>::pointer> >
+struct _LIBCPP_TEMPLATE_VIS hash<__enable_hash_helper< unique_ptr<_Tp, _Dp>, typename unique_ptr<_Tp, _Dp>::pointer> >
#endif
{
#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_BINDER_TYPEDEFS)
- _LIBCPP_DEPRECATED_IN_CXX17 typedef unique_ptr<_Tp, _Dp> argument_type;
- _LIBCPP_DEPRECATED_IN_CXX17 typedef size_t result_type;
+ _LIBCPP_DEPRECATED_IN_CXX17 typedef unique_ptr<_Tp, _Dp> argument_type;
+ _LIBCPP_DEPRECATED_IN_CXX17 typedef size_t result_type;
#endif
- _LIBCPP_HIDE_FROM_ABI
- size_t operator()(const unique_ptr<_Tp, _Dp>& __ptr) const
- {
- typedef typename unique_ptr<_Tp, _Dp>::pointer pointer;
- return hash<pointer>()(__ptr.get());
- }
+ _LIBCPP_HIDE_FROM_ABI size_t operator()(const unique_ptr<_Tp, _Dp>& __ptr) const {
+ typedef typename unique_ptr<_Tp, _Dp>::pointer pointer;
+ return hash<pointer>()(__ptr.get());
+ }
};
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__memory/uses_allocator.h b/contrib/llvm-project/libcxx/include/__memory/uses_allocator.h
index f82ac1796383..84310c3fa567 100644
--- a/contrib/llvm-project/libcxx/include/__memory/uses_allocator.h
+++ b/contrib/llvm-project/libcxx/include/__memory/uses_allocator.h
@@ -21,33 +21,26 @@
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _Tp>
-struct __has_allocator_type
-{
+struct __has_allocator_type {
private:
- template <class _Up> static false_type __test(...);
- template <class _Up> static true_type __test(typename _Up::allocator_type* = 0);
+ template <class _Up>
+ static false_type __test(...);
+ template <class _Up>
+ static true_type __test(typename _Up::allocator_type* = 0);
+
public:
- static const bool value = decltype(__test<_Tp>(0))::value;
+ static const bool value = decltype(__test<_Tp>(0))::value;
};
template <class _Tp, class _Alloc, bool = __has_allocator_type<_Tp>::value>
-struct __uses_allocator
- : public integral_constant<bool,
- is_convertible<_Alloc, typename _Tp::allocator_type>::value>
-{
+struct __uses_allocator : public integral_constant<bool, is_convertible<_Alloc, typename _Tp::allocator_type>::value> {
};
template <class _Tp, class _Alloc>
-struct __uses_allocator<_Tp, _Alloc, false>
- : public false_type
-{
-};
+struct __uses_allocator<_Tp, _Alloc, false> : public false_type {};
template <class _Tp, class _Alloc>
-struct _LIBCPP_TEMPLATE_VIS uses_allocator
- : public __uses_allocator<_Tp, _Alloc>
-{
-};
+struct _LIBCPP_TEMPLATE_VIS uses_allocator : public __uses_allocator<_Tp, _Alloc> {};
#if _LIBCPP_STD_VER >= 17
template <class _Tp, class _Alloc>
diff --git a/contrib/llvm-project/libcxx/include/__node_handle b/contrib/llvm-project/libcxx/include/__node_handle
index e680fe542c6d..24d2624c3739 100644
--- a/contrib/llvm-project/libcxx/include/__node_handle
+++ b/contrib/llvm-project/libcxx/include/__node_handle
@@ -79,175 +79,125 @@ _LIBCPP_BEGIN_NAMESPACE_STD
template <class _NodeType, class _Alloc>
struct __generic_container_node_destructor;
-template <class _NodeType, class _Alloc,
- template <class, class> class _MapOrSetSpecifics>
+template <class _NodeType, class _Alloc, template <class, class> class _MapOrSetSpecifics>
class _LIBCPP_TEMPLATE_VIS __basic_node_handle
- : public _MapOrSetSpecifics<
- _NodeType,
- __basic_node_handle<_NodeType, _Alloc, _MapOrSetSpecifics>>
-{
- template <class _Tp, class _Compare, class _Allocator>
- friend class __tree;
- template <class _Tp, class _Hash, class _Equal, class _Allocator>
- friend class __hash_table;
- friend struct _MapOrSetSpecifics<
- _NodeType, __basic_node_handle<_NodeType, _Alloc, _MapOrSetSpecifics>>;
-
- typedef allocator_traits<_Alloc> __alloc_traits;
- typedef __rebind_pointer_t<typename __alloc_traits::void_pointer,
- _NodeType>
- __node_pointer_type;
+ : public _MapOrSetSpecifics< _NodeType, __basic_node_handle<_NodeType, _Alloc, _MapOrSetSpecifics>> {
+ template <class _Tp, class _Compare, class _Allocator>
+ friend class __tree;
+ template <class _Tp, class _Hash, class _Equal, class _Allocator>
+ friend class __hash_table;
+ friend struct _MapOrSetSpecifics< _NodeType, __basic_node_handle<_NodeType, _Alloc, _MapOrSetSpecifics>>;
+
+ typedef allocator_traits<_Alloc> __alloc_traits;
+ typedef __rebind_pointer_t<typename __alloc_traits::void_pointer, _NodeType> __node_pointer_type;
public:
- typedef _Alloc allocator_type;
+ typedef _Alloc allocator_type;
private:
- __node_pointer_type __ptr_ = nullptr;
- optional<allocator_type> __alloc_;
-
- _LIBCPP_HIDE_FROM_ABI
- void __release_ptr()
- {
- __ptr_ = nullptr;
- __alloc_ = std::nullopt;
- }
+ __node_pointer_type __ptr_ = nullptr;
+ optional<allocator_type> __alloc_;
- _LIBCPP_HIDE_FROM_ABI
- void __destroy_node_pointer()
- {
- if (__ptr_ != nullptr)
- {
- typedef typename __allocator_traits_rebind<
- allocator_type, _NodeType>::type __node_alloc_type;
- __node_alloc_type __alloc(*__alloc_);
- __generic_container_node_destructor<_NodeType, __node_alloc_type>(
- __alloc, true)(__ptr_);
- __ptr_ = nullptr;
- }
- }
+ _LIBCPP_HIDE_FROM_ABI void __release_ptr() {
+ __ptr_ = nullptr;
+ __alloc_ = std::nullopt;
+ }
- _LIBCPP_HIDE_FROM_ABI
- __basic_node_handle(__node_pointer_type __ptr,
- allocator_type const& __alloc)
- : __ptr_(__ptr), __alloc_(__alloc)
- {
+ _LIBCPP_HIDE_FROM_ABI void __destroy_node_pointer() {
+ if (__ptr_ != nullptr) {
+ typedef typename __allocator_traits_rebind< allocator_type, _NodeType>::type __node_alloc_type;
+ __node_alloc_type __alloc(*__alloc_);
+ __generic_container_node_destructor<_NodeType, __node_alloc_type>(__alloc, true)(__ptr_);
+ __ptr_ = nullptr;
}
+ }
+
+ _LIBCPP_HIDE_FROM_ABI __basic_node_handle(__node_pointer_type __ptr, allocator_type const& __alloc)
+ : __ptr_(__ptr), __alloc_(__alloc) {}
public:
- _LIBCPP_HIDE_FROM_ABI
- __basic_node_handle() = default;
-
- _LIBCPP_HIDE_FROM_ABI
- __basic_node_handle(__basic_node_handle&& __other) noexcept
- : __ptr_(__other.__ptr_),
- __alloc_(std::move(__other.__alloc_))
- {
- __other.__ptr_ = nullptr;
- __other.__alloc_ = std::nullopt;
- }
+ _LIBCPP_HIDE_FROM_ABI __basic_node_handle() = default;
- _LIBCPP_HIDE_FROM_ABI
- __basic_node_handle& operator=(__basic_node_handle&& __other)
- {
- _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(
- __alloc_ == std::nullopt ||
- __alloc_traits::propagate_on_container_move_assignment::value ||
+ _LIBCPP_HIDE_FROM_ABI __basic_node_handle(__basic_node_handle&& __other) noexcept
+ : __ptr_(__other.__ptr_), __alloc_(std::move(__other.__alloc_)) {
+ __other.__ptr_ = nullptr;
+ __other.__alloc_ = std::nullopt;
+ }
+
+ _LIBCPP_HIDE_FROM_ABI __basic_node_handle& operator=(__basic_node_handle&& __other) {
+ _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(
+ __alloc_ == std::nullopt || __alloc_traits::propagate_on_container_move_assignment::value ||
__alloc_ == __other.__alloc_,
- "node_type with incompatible allocator passed to "
- "node_type::operator=(node_type&&)");
+ "node_type with incompatible allocator passed to "
+ "node_type::operator=(node_type&&)");
- __destroy_node_pointer();
- __ptr_ = __other.__ptr_;
+ __destroy_node_pointer();
+ __ptr_ = __other.__ptr_;
- if (__alloc_traits::propagate_on_container_move_assignment::value ||
- __alloc_ == std::nullopt)
- __alloc_ = std::move(__other.__alloc_);
+ if (__alloc_traits::propagate_on_container_move_assignment::value || __alloc_ == std::nullopt)
+ __alloc_ = std::move(__other.__alloc_);
- __other.__ptr_ = nullptr;
- __other.__alloc_ = std::nullopt;
+ __other.__ptr_ = nullptr;
+ __other.__alloc_ = std::nullopt;
- return *this;
- }
+ return *this;
+ }
- _LIBCPP_HIDE_FROM_ABI
- allocator_type get_allocator() const { return *__alloc_; }
-
- _LIBCPP_HIDE_FROM_ABI
- explicit operator bool() const { return __ptr_ != nullptr; }
-
- _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_HIDE_FROM_ABI
- bool empty() const { return __ptr_ == nullptr; }
-
- _LIBCPP_HIDE_FROM_ABI
- void swap(__basic_node_handle& __other) noexcept(
- __alloc_traits::propagate_on_container_swap::value ||
- __alloc_traits::is_always_equal::value)
- {
- using std::swap;
- swap(__ptr_, __other.__ptr_);
- if (__alloc_traits::propagate_on_container_swap::value ||
- __alloc_ == std::nullopt || __other.__alloc_ == std::nullopt)
- swap(__alloc_, __other.__alloc_);
- }
+ _LIBCPP_HIDE_FROM_ABI allocator_type get_allocator() const { return *__alloc_; }
- _LIBCPP_HIDE_FROM_ABI
- friend void swap(__basic_node_handle& __a, __basic_node_handle& __b)
- noexcept(noexcept(__a.swap(__b))) { __a.swap(__b); }
+ _LIBCPP_HIDE_FROM_ABI explicit operator bool() const { return __ptr_ != nullptr; }
- _LIBCPP_HIDE_FROM_ABI
- ~__basic_node_handle()
- {
- __destroy_node_pointer();
- }
+ _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_HIDE_FROM_ABI bool empty() const { return __ptr_ == nullptr; }
+
+ _LIBCPP_HIDE_FROM_ABI void swap(__basic_node_handle& __other) noexcept(
+ __alloc_traits::propagate_on_container_swap::value || __alloc_traits::is_always_equal::value) {
+ using std::swap;
+ swap(__ptr_, __other.__ptr_);
+ if (__alloc_traits::propagate_on_container_swap::value || __alloc_ == std::nullopt ||
+ __other.__alloc_ == std::nullopt)
+ swap(__alloc_, __other.__alloc_);
+ }
+
+ _LIBCPP_HIDE_FROM_ABI friend void
+ swap(__basic_node_handle& __a, __basic_node_handle& __b) noexcept(noexcept(__a.swap(__b))) {
+ __a.swap(__b);
+ }
+
+ _LIBCPP_HIDE_FROM_ABI ~__basic_node_handle() { __destroy_node_pointer(); }
};
template <class _NodeType, class _Derived>
-struct __set_node_handle_specifics
-{
- typedef typename _NodeType::__node_value_type value_type;
-
- _LIBCPP_HIDE_FROM_ABI
- value_type& value() const
- {
- return static_cast<_Derived const*>(this)->__ptr_->__get_value();
- }
+struct __set_node_handle_specifics {
+ typedef typename _NodeType::__node_value_type value_type;
+
+ _LIBCPP_HIDE_FROM_ABI value_type& value() const { return static_cast<_Derived const*>(this)->__ptr_->__get_value(); }
};
template <class _NodeType, class _Derived>
-struct __map_node_handle_specifics
-{
- typedef typename _NodeType::__node_value_type::key_type key_type;
- typedef typename _NodeType::__node_value_type::mapped_type mapped_type;
-
- _LIBCPP_HIDE_FROM_ABI
- key_type& key() const
- {
- return static_cast<_Derived const*>(this)->
- __ptr_->__get_value().__ref().first;
- }
+struct __map_node_handle_specifics {
+ typedef typename _NodeType::__node_value_type::key_type key_type;
+ typedef typename _NodeType::__node_value_type::mapped_type mapped_type;
- _LIBCPP_HIDE_FROM_ABI
- mapped_type& mapped() const
- {
- return static_cast<_Derived const*>(this)->
- __ptr_->__get_value().__ref().second;
- }
+ _LIBCPP_HIDE_FROM_ABI key_type& key() const {
+ return static_cast<_Derived const*>(this)->__ptr_->__get_value().__ref().first;
+ }
+
+ _LIBCPP_HIDE_FROM_ABI mapped_type& mapped() const {
+ return static_cast<_Derived const*>(this)->__ptr_->__get_value().__ref().second;
+ }
};
template <class _NodeType, class _Alloc>
-using __set_node_handle =
- __basic_node_handle< _NodeType, _Alloc, __set_node_handle_specifics>;
+using __set_node_handle = __basic_node_handle< _NodeType, _Alloc, __set_node_handle_specifics>;
template <class _NodeType, class _Alloc>
-using __map_node_handle =
- __basic_node_handle< _NodeType, _Alloc, __map_node_handle_specifics>;
+using __map_node_handle = __basic_node_handle< _NodeType, _Alloc, __map_node_handle_specifics>;
template <class _Iterator, class _NodeType>
-struct _LIBCPP_TEMPLATE_VIS __insert_return_type
-{
- _Iterator position;
- bool inserted;
- _NodeType node;
+struct _LIBCPP_TEMPLATE_VIS __insert_return_type {
+ _Iterator position;
+ bool inserted;
+ _NodeType node;
};
#endif // _LIBCPP_STD_VER >= 17
@@ -256,4 +206,4 @@ _LIBCPP_END_NAMESPACE_STD
_LIBCPP_POP_MACROS
-#endif // _LIBCPP___NODE_HANDLE
+#endif // _LIBCPP___NODE_HANDLE
diff --git a/contrib/llvm-project/libcxx/include/__numeric/accumulate.h b/contrib/llvm-project/libcxx/include/__numeric/accumulate.h
index 1ab6c4b616db..fedc1c46dfd0 100644
--- a/contrib/llvm-project/libcxx/include/__numeric/accumulate.h
+++ b/contrib/llvm-project/libcxx/include/__numeric/accumulate.h
@@ -23,31 +23,27 @@ _LIBCPP_PUSH_MACROS
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _InputIterator, class _Tp>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-_Tp
-accumulate(_InputIterator __first, _InputIterator __last, _Tp __init)
-{
- for (; __first != __last; ++__first)
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _Tp
+accumulate(_InputIterator __first, _InputIterator __last, _Tp __init) {
+ for (; __first != __last; ++__first)
#if _LIBCPP_STD_VER >= 20
- __init = std::move(__init) + *__first;
+ __init = std::move(__init) + *__first;
#else
- __init = __init + *__first;
+ __init = __init + *__first;
#endif
- return __init;
+ return __init;
}
template <class _InputIterator, class _Tp, class _BinaryOperation>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-_Tp
-accumulate(_InputIterator __first, _InputIterator __last, _Tp __init, _BinaryOperation __binary_op)
-{
- for (; __first != __last; ++__first)
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _Tp
+accumulate(_InputIterator __first, _InputIterator __last, _Tp __init, _BinaryOperation __binary_op) {
+ for (; __first != __last; ++__first)
#if _LIBCPP_STD_VER >= 20
- __init = __binary_op(std::move(__init), *__first);
+ __init = __binary_op(std::move(__init), *__first);
#else
- __init = __binary_op(__init, *__first);
+ __init = __binary_op(__init, *__first);
#endif
- return __init;
+ return __init;
}
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__numeric/adjacent_difference.h b/contrib/llvm-project/libcxx/include/__numeric/adjacent_difference.h
index 31ffe9c04a1d..62b53342d9a4 100644
--- a/contrib/llvm-project/libcxx/include/__numeric/adjacent_difference.h
+++ b/contrib/llvm-project/libcxx/include/__numeric/adjacent_difference.h
@@ -24,50 +24,41 @@ _LIBCPP_PUSH_MACROS
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _InputIterator, class _OutputIterator>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-_OutputIterator
-adjacent_difference(_InputIterator __first, _InputIterator __last, _OutputIterator __result)
-{
- if (__first != __last)
- {
- typename iterator_traits<_InputIterator>::value_type __acc(*__first);
- *__result = __acc;
- for (++__first, (void) ++__result; __first != __last; ++__first, (void) ++__result)
- {
- typename iterator_traits<_InputIterator>::value_type __val(*__first);
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _OutputIterator
+adjacent_difference(_InputIterator __first, _InputIterator __last, _OutputIterator __result) {
+ if (__first != __last) {
+ typename iterator_traits<_InputIterator>::value_type __acc(*__first);
+ *__result = __acc;
+ for (++__first, (void)++__result; __first != __last; ++__first, (void)++__result) {
+ typename iterator_traits<_InputIterator>::value_type __val(*__first);
#if _LIBCPP_STD_VER >= 20
- *__result = __val - std::move(__acc);
+ *__result = __val - std::move(__acc);
#else
- *__result = __val - __acc;
+ *__result = __val - __acc;
#endif
- __acc = std::move(__val);
- }
+ __acc = std::move(__val);
}
- return __result;
+ }
+ return __result;
}
template <class _InputIterator, class _OutputIterator, class _BinaryOperation>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-_OutputIterator
-adjacent_difference(_InputIterator __first, _InputIterator __last, _OutputIterator __result,
- _BinaryOperation __binary_op)
-{
- if (__first != __last)
- {
- typename iterator_traits<_InputIterator>::value_type __acc(*__first);
- *__result = __acc;
- for (++__first, (void) ++__result; __first != __last; ++__first, (void) ++__result)
- {
- typename iterator_traits<_InputIterator>::value_type __val(*__first);
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _OutputIterator adjacent_difference(
+ _InputIterator __first, _InputIterator __last, _OutputIterator __result, _BinaryOperation __binary_op) {
+ if (__first != __last) {
+ typename iterator_traits<_InputIterator>::value_type __acc(*__first);
+ *__result = __acc;
+ for (++__first, (void)++__result; __first != __last; ++__first, (void)++__result) {
+ typename iterator_traits<_InputIterator>::value_type __val(*__first);
#if _LIBCPP_STD_VER >= 20
- *__result = __binary_op(__val, std::move(__acc));
+ *__result = __binary_op(__val, std::move(__acc));
#else
- *__result = __binary_op(__val, __acc);
+ *__result = __binary_op(__val, __acc);
#endif
- __acc = std::move(__val);
- }
+ __acc = std::move(__val);
}
- return __result;
+ }
+ return __result;
}
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__numeric/exclusive_scan.h b/contrib/llvm-project/libcxx/include/__numeric/exclusive_scan.h
index 8b4a5c820dd9..af85b477dfe6 100644
--- a/contrib/llvm-project/libcxx/include/__numeric/exclusive_scan.h
+++ b/contrib/llvm-project/libcxx/include/__numeric/exclusive_scan.h
@@ -37,7 +37,7 @@ exclusive_scan(_InputIterator __first, _InputIterator __last, _OutputIterator __
if (__first == __last)
break;
__init = std::move(__tmp);
- __tmp = __b(__init, *__first);
+ __tmp = __b(__init, *__first);
}
}
return __result;
diff --git a/contrib/llvm-project/libcxx/include/__numeric/gcd_lcm.h b/contrib/llvm-project/libcxx/include/__numeric/gcd_lcm.h
index 693be704af29..3e9c244f25c2 100644
--- a/contrib/llvm-project/libcxx/include/__numeric/gcd_lcm.h
+++ b/contrib/llvm-project/libcxx/include/__numeric/gcd_lcm.h
@@ -30,65 +30,55 @@ _LIBCPP_BEGIN_NAMESPACE_STD
#if _LIBCPP_STD_VER >= 17
-template <typename _Result, typename _Source, bool _IsSigned = is_signed<_Source>::value> struct __ct_abs;
+template <typename _Result, typename _Source, bool _IsSigned = is_signed<_Source>::value>
+struct __ct_abs;
template <typename _Result, typename _Source>
struct __ct_abs<_Result, _Source, true> {
- _LIBCPP_CONSTEXPR _LIBCPP_HIDE_FROM_ABI
- _Result operator()(_Source __t) const noexcept
- {
- if (__t >= 0) return __t;
- if (__t == numeric_limits<_Source>::min()) return -static_cast<_Result>(__t);
- return -__t;
- }
+ _LIBCPP_CONSTEXPR _LIBCPP_HIDE_FROM_ABI _Result operator()(_Source __t) const noexcept {
+ if (__t >= 0)
+ return __t;
+ if (__t == numeric_limits<_Source>::min())
+ return -static_cast<_Result>(__t);
+ return -__t;
+ }
};
template <typename _Result, typename _Source>
struct __ct_abs<_Result, _Source, false> {
- _LIBCPP_CONSTEXPR _LIBCPP_HIDE_FROM_ABI
- _Result operator()(_Source __t) const noexcept { return __t; }
+ _LIBCPP_CONSTEXPR _LIBCPP_HIDE_FROM_ABI _Result operator()(_Source __t) const noexcept { return __t; }
};
-
-template<class _Tp>
-_LIBCPP_CONSTEXPR _LIBCPP_HIDDEN
-_Tp __gcd(_Tp __m, _Tp __n)
-{
- static_assert((!is_signed<_Tp>::value), "");
- return __n == 0 ? __m : std::__gcd<_Tp>(__n, __m % __n);
+template <class _Tp>
+_LIBCPP_CONSTEXPR _LIBCPP_HIDDEN _Tp __gcd(_Tp __m, _Tp __n) {
+ static_assert((!is_signed<_Tp>::value), "");
+ return __n == 0 ? __m : std::__gcd<_Tp>(__n, __m % __n);
}
-template<class _Tp, class _Up>
-_LIBCPP_CONSTEXPR _LIBCPP_HIDE_FROM_ABI
-common_type_t<_Tp,_Up>
-gcd(_Tp __m, _Up __n)
-{
- static_assert((is_integral<_Tp>::value && is_integral<_Up>::value), "Arguments to gcd must be integer types");
- static_assert((!is_same<__remove_cv_t<_Tp>, bool>::value), "First argument to gcd cannot be bool" );
- static_assert((!is_same<__remove_cv_t<_Up>, bool>::value), "Second argument to gcd cannot be bool" );
- using _Rp = common_type_t<_Tp,_Up>;
- using _Wp = make_unsigned_t<_Rp>;
- return static_cast<_Rp>(std::__gcd(
- static_cast<_Wp>(__ct_abs<_Rp, _Tp>()(__m)),
- static_cast<_Wp>(__ct_abs<_Rp, _Up>()(__n))));
+template <class _Tp, class _Up>
+_LIBCPP_CONSTEXPR _LIBCPP_HIDE_FROM_ABI common_type_t<_Tp, _Up> gcd(_Tp __m, _Up __n) {
+ static_assert((is_integral<_Tp>::value && is_integral<_Up>::value), "Arguments to gcd must be integer types");
+ static_assert((!is_same<__remove_cv_t<_Tp>, bool>::value), "First argument to gcd cannot be bool");
+ static_assert((!is_same<__remove_cv_t<_Up>, bool>::value), "Second argument to gcd cannot be bool");
+ using _Rp = common_type_t<_Tp, _Up>;
+ using _Wp = make_unsigned_t<_Rp>;
+ return static_cast<_Rp>(
+ std::__gcd(static_cast<_Wp>(__ct_abs<_Rp, _Tp>()(__m)), static_cast<_Wp>(__ct_abs<_Rp, _Up>()(__n))));
}
-template<class _Tp, class _Up>
-_LIBCPP_CONSTEXPR _LIBCPP_HIDE_FROM_ABI
-common_type_t<_Tp,_Up>
-lcm(_Tp __m, _Up __n)
-{
- static_assert((is_integral<_Tp>::value && is_integral<_Up>::value), "Arguments to lcm must be integer types");
- static_assert((!is_same<__remove_cv_t<_Tp>, bool>::value), "First argument to lcm cannot be bool" );
- static_assert((!is_same<__remove_cv_t<_Up>, bool>::value), "Second argument to lcm cannot be bool" );
- if (__m == 0 || __n == 0)
- return 0;
-
- using _Rp = common_type_t<_Tp,_Up>;
- _Rp __val1 = __ct_abs<_Rp, _Tp>()(__m) / std::gcd(__m, __n);
- _Rp __val2 = __ct_abs<_Rp, _Up>()(__n);
- _LIBCPP_ASSERT_UNCATEGORIZED((numeric_limits<_Rp>::max() / __val1 > __val2), "Overflow in lcm");
- return __val1 * __val2;
+template <class _Tp, class _Up>
+_LIBCPP_CONSTEXPR _LIBCPP_HIDE_FROM_ABI common_type_t<_Tp, _Up> lcm(_Tp __m, _Up __n) {
+ static_assert((is_integral<_Tp>::value && is_integral<_Up>::value), "Arguments to lcm must be integer types");
+ static_assert((!is_same<__remove_cv_t<_Tp>, bool>::value), "First argument to lcm cannot be bool");
+ static_assert((!is_same<__remove_cv_t<_Up>, bool>::value), "Second argument to lcm cannot be bool");
+ if (__m == 0 || __n == 0)
+ return 0;
+
+ using _Rp = common_type_t<_Tp, _Up>;
+ _Rp __val1 = __ct_abs<_Rp, _Tp>()(__m) / std::gcd(__m, __n);
+ _Rp __val2 = __ct_abs<_Rp, _Up>()(__n);
+ _LIBCPP_ASSERT_UNCATEGORIZED((numeric_limits<_Rp>::max() / __val1 > __val2), "Overflow in lcm");
+ return __val1 * __val2;
}
#endif // _LIBCPP_STD_VER
diff --git a/contrib/llvm-project/libcxx/include/__numeric/inclusive_scan.h b/contrib/llvm-project/libcxx/include/__numeric/inclusive_scan.h
index 162b9e688433..d714f102d74e 100644
--- a/contrib/llvm-project/libcxx/include/__numeric/inclusive_scan.h
+++ b/contrib/llvm-project/libcxx/include/__numeric/inclusive_scan.h
@@ -27,7 +27,7 @@ template <class _InputIterator, class _OutputIterator, class _Tp, class _BinaryO
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _OutputIterator
inclusive_scan(_InputIterator __first, _InputIterator __last, _OutputIterator __result, _BinaryOp __b, _Tp __init) {
for (; __first != __last; ++__first, (void)++__result) {
- __init = __b(__init, *__first);
+ __init = __b(__init, *__first);
*__result = __init;
}
return __result;
@@ -38,7 +38,7 @@ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _OutputIterator
inclusive_scan(_InputIterator __first, _InputIterator __last, _OutputIterator __result, _BinaryOp __b) {
if (__first != __last) {
typename iterator_traits<_InputIterator>::value_type __init = *__first;
- *__result++ = __init;
+ *__result++ = __init;
if (++__first != __last)
return std::inclusive_scan(__first, __last, __result, __b, __init);
}
@@ -47,9 +47,8 @@ inclusive_scan(_InputIterator __first, _InputIterator __last, _OutputIterator __
}
template <class _InputIterator, class _OutputIterator>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _OutputIterator inclusive_scan(_InputIterator __first,
- _InputIterator __last,
- _OutputIterator __result) {
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _OutputIterator
+inclusive_scan(_InputIterator __first, _InputIterator __last, _OutputIterator __result) {
return std::inclusive_scan(__first, __last, __result, std::plus<>());
}
diff --git a/contrib/llvm-project/libcxx/include/__numeric/inner_product.h b/contrib/llvm-project/libcxx/include/__numeric/inner_product.h
index 48f2ea348987..0deab3d421b7 100644
--- a/contrib/llvm-project/libcxx/include/__numeric/inner_product.h
+++ b/contrib/llvm-project/libcxx/include/__numeric/inner_product.h
@@ -23,32 +23,32 @@ _LIBCPP_PUSH_MACROS
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _InputIterator1, class _InputIterator2, class _Tp>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-_Tp
-inner_product(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2, _Tp __init)
-{
- for (; __first1 != __last1; ++__first1, (void) ++__first2)
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _Tp
+inner_product(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2, _Tp __init) {
+ for (; __first1 != __last1; ++__first1, (void)++__first2)
#if _LIBCPP_STD_VER >= 20
- __init = std::move(__init) + *__first1 * *__first2;
+ __init = std::move(__init) + *__first1 * *__first2;
#else
- __init = __init + *__first1 * *__first2;
+ __init = __init + *__first1 * *__first2;
#endif
- return __init;
+ return __init;
}
template <class _InputIterator1, class _InputIterator2, class _Tp, class _BinaryOperation1, class _BinaryOperation2>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-_Tp
-inner_product(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2,
- _Tp __init, _BinaryOperation1 __binary_op1, _BinaryOperation2 __binary_op2)
-{
- for (; __first1 != __last1; ++__first1, (void) ++__first2)
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _Tp inner_product(
+ _InputIterator1 __first1,
+ _InputIterator1 __last1,
+ _InputIterator2 __first2,
+ _Tp __init,
+ _BinaryOperation1 __binary_op1,
+ _BinaryOperation2 __binary_op2) {
+ for (; __first1 != __last1; ++__first1, (void)++__first2)
#if _LIBCPP_STD_VER >= 20
- __init = __binary_op1(std::move(__init), __binary_op2(*__first1, *__first2));
+ __init = __binary_op1(std::move(__init), __binary_op2(*__first1, *__first2));
#else
- __init = __binary_op1(__init, __binary_op2(*__first1, *__first2));
+ __init = __binary_op1(__init, __binary_op2(*__first1, *__first2));
#endif
- return __init;
+ return __init;
}
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__numeric/iota.h b/contrib/llvm-project/libcxx/include/__numeric/iota.h
index 473ca969d8ec..27bd84e395a3 100644
--- a/contrib/llvm-project/libcxx/include/__numeric/iota.h
+++ b/contrib/llvm-project/libcxx/include/__numeric/iota.h
@@ -19,12 +19,10 @@
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _ForwardIterator, class _Tp>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-void
-iota(_ForwardIterator __first, _ForwardIterator __last, _Tp __value)
-{
- for (; __first != __last; ++__first, (void) ++__value)
- *__first = __value;
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void
+iota(_ForwardIterator __first, _ForwardIterator __last, _Tp __value) {
+ for (; __first != __last; ++__first, (void)++__value)
+ *__first = __value;
}
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__numeric/midpoint.h b/contrib/llvm-project/libcxx/include/__numeric/midpoint.h
index c92e450767c9..5d715c21d8ea 100644
--- a/contrib/llvm-project/libcxx/include/__numeric/midpoint.h
+++ b/contrib/llvm-project/libcxx/include/__numeric/midpoint.h
@@ -35,55 +35,46 @@ _LIBCPP_BEGIN_NAMESPACE_STD
#if _LIBCPP_STD_VER >= 20
template <class _Tp>
-_LIBCPP_HIDE_FROM_ABI constexpr
-enable_if_t<is_integral_v<_Tp> && !is_same_v<bool, _Tp> && !is_null_pointer_v<_Tp>, _Tp>
-midpoint(_Tp __a, _Tp __b) noexcept
-_LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK
-{
- using _Up = make_unsigned_t<_Tp>;
- constexpr _Up __bitshift = numeric_limits<_Up>::digits - 1;
+_LIBCPP_HIDE_FROM_ABI constexpr enable_if_t<is_integral_v<_Tp> && !is_same_v<bool, _Tp> && !is_null_pointer_v<_Tp>, _Tp>
+midpoint(_Tp __a, _Tp __b) noexcept _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK {
+ using _Up = make_unsigned_t<_Tp>;
+ constexpr _Up __bitshift = numeric_limits<_Up>::digits - 1;
- _Up __diff = _Up(__b) - _Up(__a);
- _Up __sign_bit = __b < __a;
+ _Up __diff = _Up(__b) - _Up(__a);
+ _Up __sign_bit = __b < __a;
- _Up __half_diff = (__diff / 2) + (__sign_bit << __bitshift) + (__sign_bit & __diff);
+ _Up __half_diff = (__diff / 2) + (__sign_bit << __bitshift) + (__sign_bit & __diff);
- return __a + __half_diff;
+ return __a + __half_diff;
}
-
-template <class _TPtr>
-_LIBCPP_HIDE_FROM_ABI constexpr
-enable_if_t<is_pointer_v<_TPtr>
- && is_object_v<remove_pointer_t<_TPtr>>
- && ! is_void_v<remove_pointer_t<_TPtr>>
- && (sizeof(remove_pointer_t<_TPtr>) > 0), _TPtr>
-midpoint(_TPtr __a, _TPtr __b) noexcept
-{
- return __a + std::midpoint(ptrdiff_t(0), __b - __a);
+template <class _Tp, enable_if_t<is_object_v<_Tp> && !is_void_v<_Tp> && (sizeof(_Tp) > 0), int> = 0>
+_LIBCPP_HIDE_FROM_ABI constexpr _Tp* midpoint(_Tp* __a, _Tp* __b) noexcept {
+ return __a + std::midpoint(ptrdiff_t(0), __b - __a);
}
-
template <typename _Tp>
_LIBCPP_HIDE_FROM_ABI constexpr int __sign(_Tp __val) {
- return (_Tp(0) < __val) - (__val < _Tp(0));
+ return (_Tp(0) < __val) - (__val < _Tp(0));
}
template <typename _Fp>
-_LIBCPP_HIDE_FROM_ABI constexpr _Fp __fp_abs(_Fp __f) { return __f >= 0 ? __f : -__f; }
+_LIBCPP_HIDE_FROM_ABI constexpr _Fp __fp_abs(_Fp __f) {
+ return __f >= 0 ? __f : -__f;
+}
template <class _Fp>
-_LIBCPP_HIDE_FROM_ABI constexpr
-enable_if_t<is_floating_point_v<_Fp>, _Fp>
-midpoint(_Fp __a, _Fp __b) noexcept
-{
- constexpr _Fp __lo = numeric_limits<_Fp>::min()*2;
- constexpr _Fp __hi = numeric_limits<_Fp>::max()/2;
- return std::__fp_abs(__a) <= __hi && std::__fp_abs(__b) <= __hi ? // typical case: overflow is impossible
- (__a + __b)/2 : // always correctly rounded
- std::__fp_abs(__a) < __lo ? __a + __b/2 : // not safe to halve a
- std::__fp_abs(__b) < __lo ? __a/2 + __b : // not safe to halve b
- __a/2 + __b/2; // otherwise correctly rounded
+_LIBCPP_HIDE_FROM_ABI constexpr enable_if_t<is_floating_point_v<_Fp>, _Fp> midpoint(_Fp __a, _Fp __b) noexcept {
+ constexpr _Fp __lo = numeric_limits<_Fp>::min() * 2;
+ constexpr _Fp __hi = numeric_limits<_Fp>::max() / 2;
+ return std::__fp_abs(__a) <= __hi && std::__fp_abs(__b) <= __hi
+ ? // typical case: overflow is impossible
+ (__a + __b) / 2
+ : // always correctly rounded
+ std::__fp_abs(__a) < __lo ? __a + __b / 2 : // not safe to halve a
+ std::__fp_abs(__b) < __lo ? __a / 2 + __b
+ : // not safe to halve b
+ __a / 2 + __b / 2; // otherwise correctly rounded
}
#endif // _LIBCPP_STD_VER >= 20
diff --git a/contrib/llvm-project/libcxx/include/__numeric/partial_sum.h b/contrib/llvm-project/libcxx/include/__numeric/partial_sum.h
index 49afcbb746f5..7c3cf7fb20b0 100644
--- a/contrib/llvm-project/libcxx/include/__numeric/partial_sum.h
+++ b/contrib/llvm-project/libcxx/include/__numeric/partial_sum.h
@@ -24,48 +24,39 @@ _LIBCPP_PUSH_MACROS
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _InputIterator, class _OutputIterator>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-_OutputIterator
-partial_sum(_InputIterator __first, _InputIterator __last, _OutputIterator __result)
-{
- if (__first != __last)
- {
- typename iterator_traits<_InputIterator>::value_type __t(*__first);
- *__result = __t;
- for (++__first, (void) ++__result; __first != __last; ++__first, (void) ++__result)
- {
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _OutputIterator
+partial_sum(_InputIterator __first, _InputIterator __last, _OutputIterator __result) {
+ if (__first != __last) {
+ typename iterator_traits<_InputIterator>::value_type __t(*__first);
+ *__result = __t;
+ for (++__first, (void)++__result; __first != __last; ++__first, (void)++__result) {
#if _LIBCPP_STD_VER >= 20
- __t = std::move(__t) + *__first;
+ __t = std::move(__t) + *__first;
#else
- __t = __t + *__first;
+ __t = __t + *__first;
#endif
- *__result = __t;
- }
+ *__result = __t;
}
- return __result;
+ }
+ return __result;
}
template <class _InputIterator, class _OutputIterator, class _BinaryOperation>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-_OutputIterator
-partial_sum(_InputIterator __first, _InputIterator __last, _OutputIterator __result,
- _BinaryOperation __binary_op)
-{
- if (__first != __last)
- {
- typename iterator_traits<_InputIterator>::value_type __t(*__first);
- *__result = __t;
- for (++__first, (void) ++__result; __first != __last; ++__first, (void) ++__result)
- {
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _OutputIterator
+partial_sum(_InputIterator __first, _InputIterator __last, _OutputIterator __result, _BinaryOperation __binary_op) {
+ if (__first != __last) {
+ typename iterator_traits<_InputIterator>::value_type __t(*__first);
+ *__result = __t;
+ for (++__first, (void)++__result; __first != __last; ++__first, (void)++__result) {
#if _LIBCPP_STD_VER >= 20
- __t = __binary_op(std::move(__t), *__first);
+ __t = __binary_op(std::move(__t), *__first);
#else
- __t = __binary_op(__t, *__first);
+ __t = __binary_op(__t, *__first);
#endif
- *__result = __t;
- }
+ *__result = __t;
}
- return __result;
+ }
+ return __result;
}
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__numeric/reduce.h b/contrib/llvm-project/libcxx/include/__numeric/reduce.h
index eb53053c26a6..1aeefce132b2 100644
--- a/contrib/llvm-project/libcxx/include/__numeric/reduce.h
+++ b/contrib/llvm-project/libcxx/include/__numeric/reduce.h
@@ -23,16 +23,16 @@ _LIBCPP_BEGIN_NAMESPACE_STD
#if _LIBCPP_STD_VER >= 17
template <class _InputIterator, class _Tp, class _BinaryOp>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _Tp reduce(_InputIterator __first, _InputIterator __last,
- _Tp __init, _BinaryOp __b) {
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _Tp
+reduce(_InputIterator __first, _InputIterator __last, _Tp __init, _BinaryOp __b) {
for (; __first != __last; ++__first)
__init = __b(std::move(__init), *__first);
return __init;
}
template <class _InputIterator, class _Tp>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _Tp reduce(_InputIterator __first, _InputIterator __last,
- _Tp __init) {
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _Tp
+reduce(_InputIterator __first, _InputIterator __last, _Tp __init) {
return std::reduce(__first, __last, __init, std::plus<>());
}
diff --git a/contrib/llvm-project/libcxx/include/__numeric/transform_exclusive_scan.h b/contrib/llvm-project/libcxx/include/__numeric/transform_exclusive_scan.h
index b8d7bd2c4463..fb88aa52cd10 100644
--- a/contrib/llvm-project/libcxx/include/__numeric/transform_exclusive_scan.h
+++ b/contrib/llvm-project/libcxx/include/__numeric/transform_exclusive_scan.h
@@ -20,26 +20,19 @@ _LIBCPP_BEGIN_NAMESPACE_STD
#if _LIBCPP_STD_VER >= 17
-template <class _InputIterator, class _OutputIterator, class _Tp,
- class _BinaryOp, class _UnaryOp>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-_OutputIterator
-transform_exclusive_scan(_InputIterator __first, _InputIterator __last,
- _OutputIterator __result, _Tp __init,
- _BinaryOp __b, _UnaryOp __u)
-{
- if (__first != __last)
- {
- _Tp __saved = __init;
- do
- {
- __init = __b(__init, __u(*__first));
- *__result = __saved;
- __saved = __init;
- ++__result;
- } while (++__first != __last);
- }
- return __result;
+template <class _InputIterator, class _OutputIterator, class _Tp, class _BinaryOp, class _UnaryOp>
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _OutputIterator transform_exclusive_scan(
+ _InputIterator __first, _InputIterator __last, _OutputIterator __result, _Tp __init, _BinaryOp __b, _UnaryOp __u) {
+ if (__first != __last) {
+ _Tp __saved = __init;
+ do {
+ __init = __b(__init, __u(*__first));
+ *__result = __saved;
+ __saved = __init;
+ ++__result;
+ } while (++__first != __last);
+ }
+ return __result;
}
#endif // _LIBCPP_STD_VER >= 17
diff --git a/contrib/llvm-project/libcxx/include/__numeric/transform_inclusive_scan.h b/contrib/llvm-project/libcxx/include/__numeric/transform_inclusive_scan.h
index e1b818ca58e0..2eab1a142439 100644
--- a/contrib/llvm-project/libcxx/include/__numeric/transform_inclusive_scan.h
+++ b/contrib/llvm-project/libcxx/include/__numeric/transform_inclusive_scan.h
@@ -22,33 +22,27 @@ _LIBCPP_BEGIN_NAMESPACE_STD
#if _LIBCPP_STD_VER >= 17
template <class _InputIterator, class _OutputIterator, class _Tp, class _BinaryOp, class _UnaryOp>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-_OutputIterator
-transform_inclusive_scan(_InputIterator __first, _InputIterator __last,
- _OutputIterator __result, _BinaryOp __b, _UnaryOp __u, _Tp __init)
-{
- for (; __first != __last; ++__first, (void) ++__result) {
- __init = __b(__init, __u(*__first));
- *__result = __init;
- }
-
- return __result;
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _OutputIterator transform_inclusive_scan(
+ _InputIterator __first, _InputIterator __last, _OutputIterator __result, _BinaryOp __b, _UnaryOp __u, _Tp __init) {
+ for (; __first != __last; ++__first, (void)++__result) {
+ __init = __b(__init, __u(*__first));
+ *__result = __init;
+ }
+
+ return __result;
}
template <class _InputIterator, class _OutputIterator, class _BinaryOp, class _UnaryOp>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-_OutputIterator
-transform_inclusive_scan(_InputIterator __first, _InputIterator __last,
- _OutputIterator __result, _BinaryOp __b, _UnaryOp __u)
-{
- if (__first != __last) {
- typename iterator_traits<_InputIterator>::value_type __init = __u(*__first);
- *__result++ = __init;
- if (++__first != __last)
- return std::transform_inclusive_scan(__first, __last, __result, __b, __u, __init);
- }
-
- return __result;
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _OutputIterator transform_inclusive_scan(
+ _InputIterator __first, _InputIterator __last, _OutputIterator __result, _BinaryOp __b, _UnaryOp __u) {
+ if (__first != __last) {
+ typename iterator_traits<_InputIterator>::value_type __init = __u(*__first);
+ *__result++ = __init;
+ if (++__first != __last)
+ return std::transform_inclusive_scan(__first, __last, __result, __b, __u, __init);
+ }
+
+ return __result;
}
#endif // _LIBCPP_STD_VER >= 17
diff --git a/contrib/llvm-project/libcxx/include/__numeric/transform_reduce.h b/contrib/llvm-project/libcxx/include/__numeric/transform_reduce.h
index 04d02b6c6a6b..6c0a81e5e4b0 100644
--- a/contrib/llvm-project/libcxx/include/__numeric/transform_reduce.h
+++ b/contrib/llvm-project/libcxx/include/__numeric/transform_reduce.h
@@ -22,30 +22,30 @@ _LIBCPP_BEGIN_NAMESPACE_STD
#if _LIBCPP_STD_VER >= 17
template <class _InputIterator, class _Tp, class _BinaryOp, class _UnaryOp>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _Tp transform_reduce(_InputIterator __first,
- _InputIterator __last, _Tp __init,
- _BinaryOp __b, _UnaryOp __u) {
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _Tp
+transform_reduce(_InputIterator __first, _InputIterator __last, _Tp __init, _BinaryOp __b, _UnaryOp __u) {
for (; __first != __last; ++__first)
__init = __b(std::move(__init), __u(*__first));
return __init;
}
template <class _InputIterator1, class _InputIterator2, class _Tp, class _BinaryOp1, class _BinaryOp2>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _Tp transform_reduce(_InputIterator1 __first1,
- _InputIterator1 __last1,
- _InputIterator2 __first2, _Tp __init,
- _BinaryOp1 __b1, _BinaryOp2 __b2) {
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _Tp transform_reduce(
+ _InputIterator1 __first1,
+ _InputIterator1 __last1,
+ _InputIterator2 __first2,
+ _Tp __init,
+ _BinaryOp1 __b1,
+ _BinaryOp2 __b2) {
for (; __first1 != __last1; ++__first1, (void)++__first2)
__init = __b1(std::move(__init), __b2(*__first1, *__first2));
return __init;
}
template <class _InputIterator1, class _InputIterator2, class _Tp>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _Tp transform_reduce(_InputIterator1 __first1,
- _InputIterator1 __last1,
- _InputIterator2 __first2, _Tp __init) {
- return std::transform_reduce(__first1, __last1, __first2, std::move(__init), std::plus<>(),
- std::multiplies<>());
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _Tp
+transform_reduce(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2, _Tp __init) {
+ return std::transform_reduce(__first1, __last1, __first2, std::move(__init), std::plus<>(), std::multiplies<>());
}
#endif
diff --git a/contrib/llvm-project/libcxx/include/__random/bernoulli_distribution.h b/contrib/llvm-project/libcxx/include/__random/bernoulli_distribution.h
index 565dc0369387..4f33dca132d1 100644
--- a/contrib/llvm-project/libcxx/include/__random/bernoulli_distribution.h
+++ b/contrib/llvm-project/libcxx/include/__random/bernoulli_distribution.h
@@ -23,119 +23,97 @@ _LIBCPP_PUSH_MACROS
_LIBCPP_BEGIN_NAMESPACE_STD
-class _LIBCPP_TEMPLATE_VIS bernoulli_distribution
-{
+class _LIBCPP_TEMPLATE_VIS bernoulli_distribution {
public:
- // types
- typedef bool result_type;
+ // types
+ typedef bool result_type;
- class _LIBCPP_TEMPLATE_VIS param_type
- {
- double __p_;
- public:
- typedef bernoulli_distribution distribution_type;
+ class _LIBCPP_TEMPLATE_VIS param_type {
+ double __p_;
- _LIBCPP_HIDE_FROM_ABI
- explicit param_type(double __p = 0.5) : __p_(__p) {}
+ public:
+ typedef bernoulli_distribution distribution_type;
- _LIBCPP_HIDE_FROM_ABI
- double p() const {return __p_;}
+ _LIBCPP_HIDE_FROM_ABI explicit param_type(double __p = 0.5) : __p_(__p) {}
- friend _LIBCPP_HIDE_FROM_ABI
- bool operator==(const param_type& __x, const param_type& __y)
- {return __x.__p_ == __y.__p_;}
- friend _LIBCPP_HIDE_FROM_ABI
- bool operator!=(const param_type& __x, const param_type& __y)
- {return !(__x == __y);}
- };
+ _LIBCPP_HIDE_FROM_ABI double p() const { return __p_; }
+
+ friend _LIBCPP_HIDE_FROM_ABI bool operator==(const param_type& __x, const param_type& __y) {
+ return __x.__p_ == __y.__p_;
+ }
+ friend _LIBCPP_HIDE_FROM_ABI bool operator!=(const param_type& __x, const param_type& __y) { return !(__x == __y); }
+ };
private:
- param_type __p_;
+ param_type __p_;
public:
- // constructors and reset functions
+ // constructors and reset functions
#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI
- bernoulli_distribution() : bernoulli_distribution(0.5) {}
- _LIBCPP_HIDE_FROM_ABI
- explicit bernoulli_distribution(double __p) : __p_(param_type(__p)) {}
+ _LIBCPP_HIDE_FROM_ABI bernoulli_distribution() : bernoulli_distribution(0.5) {}
+ _LIBCPP_HIDE_FROM_ABI explicit bernoulli_distribution(double __p) : __p_(param_type(__p)) {}
#else
- _LIBCPP_HIDE_FROM_ABI
- explicit bernoulli_distribution(double __p = 0.5) : __p_(param_type(__p)) {}
+ _LIBCPP_HIDE_FROM_ABI explicit bernoulli_distribution(double __p = 0.5) : __p_(param_type(__p)) {}
#endif
- _LIBCPP_HIDE_FROM_ABI
- explicit bernoulli_distribution(const param_type& __p) : __p_(__p) {}
- _LIBCPP_HIDE_FROM_ABI
- void reset() {}
-
- // generating functions
- template<class _URNG>
- _LIBCPP_HIDE_FROM_ABI
- result_type operator()(_URNG& __g)
- {return (*this)(__g, __p_);}
- template<class _URNG> _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g, const param_type& __p);
-
- // property functions
- _LIBCPP_HIDE_FROM_ABI
- double p() const {return __p_.p();}
-
- _LIBCPP_HIDE_FROM_ABI
- param_type param() const {return __p_;}
- _LIBCPP_HIDE_FROM_ABI
- void param(const param_type& __p) {__p_ = __p;}
-
- _LIBCPP_HIDE_FROM_ABI
- result_type min() const {return false;}
- _LIBCPP_HIDE_FROM_ABI
- result_type max() const {return true;}
-
- friend _LIBCPP_HIDE_FROM_ABI
- bool operator==(const bernoulli_distribution& __x,
- const bernoulli_distribution& __y)
- {return __x.__p_ == __y.__p_;}
- friend _LIBCPP_HIDE_FROM_ABI
- bool operator!=(const bernoulli_distribution& __x,
- const bernoulli_distribution& __y)
- {return !(__x == __y);}
+ _LIBCPP_HIDE_FROM_ABI explicit bernoulli_distribution(const param_type& __p) : __p_(__p) {}
+ _LIBCPP_HIDE_FROM_ABI void reset() {}
+
+ // generating functions
+ template <class _URNG>
+ _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g) {
+ return (*this)(__g, __p_);
+ }
+ template <class _URNG>
+ _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g, const param_type& __p);
+
+ // property functions
+ _LIBCPP_HIDE_FROM_ABI double p() const { return __p_.p(); }
+
+ _LIBCPP_HIDE_FROM_ABI param_type param() const { return __p_; }
+ _LIBCPP_HIDE_FROM_ABI void param(const param_type& __p) { __p_ = __p; }
+
+ _LIBCPP_HIDE_FROM_ABI result_type min() const { return false; }
+ _LIBCPP_HIDE_FROM_ABI result_type max() const { return true; }
+
+ friend _LIBCPP_HIDE_FROM_ABI bool operator==(const bernoulli_distribution& __x, const bernoulli_distribution& __y) {
+ return __x.__p_ == __y.__p_;
+ }
+ friend _LIBCPP_HIDE_FROM_ABI bool operator!=(const bernoulli_distribution& __x, const bernoulli_distribution& __y) {
+ return !(__x == __y);
+ }
};
-template<class _URNG>
-inline
-bernoulli_distribution::result_type
-bernoulli_distribution::operator()(_URNG& __g, const param_type& __p)
-{
- static_assert(__libcpp_random_is_valid_urng<_URNG>::value, "");
- uniform_real_distribution<double> __gen;
- return __gen(__g) < __p.p();
+template <class _URNG>
+inline bernoulli_distribution::result_type bernoulli_distribution::operator()(_URNG& __g, const param_type& __p) {
+ static_assert(__libcpp_random_is_valid_urng<_URNG>::value, "");
+ uniform_real_distribution<double> __gen;
+ return __gen(__g) < __p.p();
}
template <class _CharT, class _Traits>
_LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>&
-operator<<(basic_ostream<_CharT, _Traits>& __os, const bernoulli_distribution& __x)
-{
- __save_flags<_CharT, _Traits> __lx(__os);
- typedef basic_ostream<_CharT, _Traits> _OStream;
- __os.flags(_OStream::dec | _OStream::left | _OStream::fixed |
- _OStream::scientific);
- _CharT __sp = __os.widen(' ');
- __os.fill(__sp);
- return __os << __x.p();
+operator<<(basic_ostream<_CharT, _Traits>& __os, const bernoulli_distribution& __x) {
+ __save_flags<_CharT, _Traits> __lx(__os);
+ typedef basic_ostream<_CharT, _Traits> _OStream;
+ __os.flags(_OStream::dec | _OStream::left | _OStream::fixed | _OStream::scientific);
+ _CharT __sp = __os.widen(' ');
+ __os.fill(__sp);
+ return __os << __x.p();
}
template <class _CharT, class _Traits>
_LIBCPP_HIDE_FROM_ABI basic_istream<_CharT, _Traits>&
-operator>>(basic_istream<_CharT, _Traits>& __is, bernoulli_distribution& __x)
-{
- typedef bernoulli_distribution _Eng;
- typedef typename _Eng::param_type param_type;
- __save_flags<_CharT, _Traits> __lx(__is);
- typedef basic_istream<_CharT, _Traits> _Istream;
- __is.flags(_Istream::dec | _Istream::skipws);
- double __p;
- __is >> __p;
- if (!__is.fail())
- __x.param(param_type(__p));
- return __is;
+operator>>(basic_istream<_CharT, _Traits>& __is, bernoulli_distribution& __x) {
+ typedef bernoulli_distribution _Eng;
+ typedef typename _Eng::param_type param_type;
+ __save_flags<_CharT, _Traits> __lx(__is);
+ typedef basic_istream<_CharT, _Traits> _Istream;
+ __is.flags(_Istream::dec | _Istream::skipws);
+ double __p;
+ __is >> __p;
+ if (!__is.fail())
+ __x.param(param_type(__p));
+ return __is;
}
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__random/binomial_distribution.h b/contrib/llvm-project/libcxx/include/__random/binomial_distribution.h
index 03661b19bebf..e8774bb8d67e 100644
--- a/contrib/llvm-project/libcxx/include/__random/binomial_distribution.h
+++ b/contrib/llvm-project/libcxx/include/__random/binomial_distribution.h
@@ -24,98 +24,81 @@ _LIBCPP_PUSH_MACROS
_LIBCPP_BEGIN_NAMESPACE_STD
-template<class _IntType = int>
-class _LIBCPP_TEMPLATE_VIS binomial_distribution
-{
- static_assert(__libcpp_random_is_valid_inttype<_IntType>::value, "IntType must be a supported integer type");
+template <class _IntType = int>
+class _LIBCPP_TEMPLATE_VIS binomial_distribution {
+ static_assert(__libcpp_random_is_valid_inttype<_IntType>::value, "IntType must be a supported integer type");
+
public:
- // types
- typedef _IntType result_type;
-
- class _LIBCPP_TEMPLATE_VIS param_type
- {
- result_type __t_;
- double __p_;
- double __pr_;
- double __odds_ratio_;
- result_type __r0_;
- public:
- typedef binomial_distribution distribution_type;
-
- _LIBCPP_HIDE_FROM_ABI explicit param_type(result_type __t = 1, double __p = 0.5);
-
- _LIBCPP_HIDE_FROM_ABI
- result_type t() const {return __t_;}
- _LIBCPP_HIDE_FROM_ABI
- double p() const {return __p_;}
-
- friend _LIBCPP_HIDE_FROM_ABI
- bool operator==(const param_type& __x, const param_type& __y)
- {return __x.__t_ == __y.__t_ && __x.__p_ == __y.__p_;}
- friend _LIBCPP_HIDE_FROM_ABI
- bool operator!=(const param_type& __x, const param_type& __y)
- {return !(__x == __y);}
-
- friend class binomial_distribution;
- };
+ // types
+ typedef _IntType result_type;
+
+ class _LIBCPP_TEMPLATE_VIS param_type {
+ result_type __t_;
+ double __p_;
+ double __pr_;
+ double __odds_ratio_;
+ result_type __r0_;
+
+ public:
+ typedef binomial_distribution distribution_type;
+
+ _LIBCPP_HIDE_FROM_ABI explicit param_type(result_type __t = 1, double __p = 0.5);
+
+ _LIBCPP_HIDE_FROM_ABI result_type t() const { return __t_; }
+ _LIBCPP_HIDE_FROM_ABI double p() const { return __p_; }
+
+ friend _LIBCPP_HIDE_FROM_ABI bool operator==(const param_type& __x, const param_type& __y) {
+ return __x.__t_ == __y.__t_ && __x.__p_ == __y.__p_;
+ }
+ friend _LIBCPP_HIDE_FROM_ABI bool operator!=(const param_type& __x, const param_type& __y) { return !(__x == __y); }
+
+ friend class binomial_distribution;
+ };
private:
- param_type __p_;
+ param_type __p_;
public:
- // constructors and reset functions
+ // constructors and reset functions
#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI
- binomial_distribution() : binomial_distribution(1) {}
- _LIBCPP_HIDE_FROM_ABI
- explicit binomial_distribution(result_type __t, double __p = 0.5)
- : __p_(param_type(__t, __p)) {}
+ _LIBCPP_HIDE_FROM_ABI binomial_distribution() : binomial_distribution(1) {}
+ _LIBCPP_HIDE_FROM_ABI explicit binomial_distribution(result_type __t, double __p = 0.5)
+ : __p_(param_type(__t, __p)) {}
#else
- _LIBCPP_HIDE_FROM_ABI
- explicit binomial_distribution(result_type __t = 1, double __p = 0.5)
- : __p_(param_type(__t, __p)) {}
+ _LIBCPP_HIDE_FROM_ABI explicit binomial_distribution(result_type __t = 1, double __p = 0.5)
+ : __p_(param_type(__t, __p)) {}
#endif
- _LIBCPP_HIDE_FROM_ABI
- explicit binomial_distribution(const param_type& __p) : __p_(__p) {}
- _LIBCPP_HIDE_FROM_ABI
- void reset() {}
-
- // generating functions
- template<class _URNG>
- _LIBCPP_HIDE_FROM_ABI
- result_type operator()(_URNG& __g)
- {return (*this)(__g, __p_);}
- template<class _URNG>
- _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g, const param_type& __p);
-
- // property functions
- _LIBCPP_HIDE_FROM_ABI
- result_type t() const {return __p_.t();}
- _LIBCPP_HIDE_FROM_ABI
- double p() const {return __p_.p();}
-
- _LIBCPP_HIDE_FROM_ABI
- param_type param() const {return __p_;}
- _LIBCPP_HIDE_FROM_ABI
- void param(const param_type& __p) {__p_ = __p;}
-
- _LIBCPP_HIDE_FROM_ABI
- result_type min() const {return 0;}
- _LIBCPP_HIDE_FROM_ABI
- result_type max() const {return t();}
-
- friend _LIBCPP_HIDE_FROM_ABI
- bool operator==(const binomial_distribution& __x,
- const binomial_distribution& __y)
- {return __x.__p_ == __y.__p_;}
- friend _LIBCPP_HIDE_FROM_ABI
- bool operator!=(const binomial_distribution& __x,
- const binomial_distribution& __y)
- {return !(__x == __y);}
+ _LIBCPP_HIDE_FROM_ABI explicit binomial_distribution(const param_type& __p) : __p_(__p) {}
+ _LIBCPP_HIDE_FROM_ABI void reset() {}
+
+ // generating functions
+ template <class _URNG>
+ _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g) {
+ return (*this)(__g, __p_);
+ }
+ template <class _URNG>
+ _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g, const param_type& __p);
+
+ // property functions
+ _LIBCPP_HIDE_FROM_ABI result_type t() const { return __p_.t(); }
+ _LIBCPP_HIDE_FROM_ABI double p() const { return __p_.p(); }
+
+ _LIBCPP_HIDE_FROM_ABI param_type param() const { return __p_; }
+ _LIBCPP_HIDE_FROM_ABI void param(const param_type& __p) { __p_ = __p; }
+
+ _LIBCPP_HIDE_FROM_ABI result_type min() const { return 0; }
+ _LIBCPP_HIDE_FROM_ABI result_type max() const { return t(); }
+
+ friend _LIBCPP_HIDE_FROM_ABI bool operator==(const binomial_distribution& __x, const binomial_distribution& __y) {
+ return __x.__p_ == __y.__p_;
+ }
+ friend _LIBCPP_HIDE_FROM_ABI bool operator!=(const binomial_distribution& __x, const binomial_distribution& __y) {
+ return !(__x == __y);
+ }
};
#ifndef _LIBCPP_MSVCRT_LIKE
-extern "C" double lgamma_r(double, int *);
+extern "C" double lgamma_r(double, int*);
#endif
inline _LIBCPP_HIDE_FROM_ABI double __libcpp_lgamma(double __d) {
@@ -127,99 +110,85 @@ inline _LIBCPP_HIDE_FROM_ABI double __libcpp_lgamma(double __d) {
#endif
}
-template<class _IntType>
-binomial_distribution<_IntType>::param_type::param_type(result_type __t, double __p)
- : __t_(__t), __p_(__p)
-{
- if (0 < __p_ && __p_ < 1)
- {
- __r0_ = static_cast<result_type>((__t_ + 1) * __p_);
- __pr_ = std::exp(std::__libcpp_lgamma(__t_ + 1.) -
- std::__libcpp_lgamma(__r0_ + 1.) -
- std::__libcpp_lgamma(__t_ - __r0_ + 1.) + __r0_ * std::log(__p_) +
- (__t_ - __r0_) * std::log(1 - __p_));
- __odds_ratio_ = __p_ / (1 - __p_);
- }
+template <class _IntType>
+binomial_distribution<_IntType>::param_type::param_type(result_type __t, double __p) : __t_(__t), __p_(__p) {
+ if (0 < __p_ && __p_ < 1) {
+ __r0_ = static_cast<result_type>((__t_ + 1) * __p_);
+ __pr_ = std::exp(
+ std::__libcpp_lgamma(__t_ + 1.) - std::__libcpp_lgamma(__r0_ + 1.) - std::__libcpp_lgamma(__t_ - __r0_ + 1.) +
+ __r0_ * std::log(__p_) + (__t_ - __r0_) * std::log(1 - __p_));
+ __odds_ratio_ = __p_ / (1 - __p_);
+ }
}
// Reference: Kemp, C.D. (1986). `A modal method for generating binomial
// variables', Commun. Statist. - Theor. Meth. 15(3), 805-813.
-template<class _IntType>
-template<class _URNG>
-_IntType
-binomial_distribution<_IntType>::operator()(_URNG& __g, const param_type& __pr)
-{
- static_assert(__libcpp_random_is_valid_urng<_URNG>::value, "");
- if (__pr.__t_ == 0 || __pr.__p_ == 0)
- return 0;
- if (__pr.__p_ == 1)
- return __pr.__t_;
- uniform_real_distribution<double> __gen;
- double __u = __gen(__g) - __pr.__pr_;
- if (__u < 0)
- return __pr.__r0_;
- double __pu = __pr.__pr_;
- double __pd = __pu;
- result_type __ru = __pr.__r0_;
- result_type __rd = __ru;
- while (true)
- {
- bool __break = true;
- if (__rd >= 1)
- {
- __pd *= __rd / (__pr.__odds_ratio_ * (__pr.__t_ - __rd + 1));
- __u -= __pd;
- __break = false;
- if (__u < 0)
- return __rd - 1;
- }
- if ( __rd != 0 )
- --__rd;
- ++__ru;
- if (__ru <= __pr.__t_)
- {
- __pu *= (__pr.__t_ - __ru + 1) * __pr.__odds_ratio_ / __ru;
- __u -= __pu;
- __break = false;
- if (__u < 0)
- return __ru;
- }
- if (__break)
- return 0;
+template <class _IntType>
+template <class _URNG>
+_IntType binomial_distribution<_IntType>::operator()(_URNG& __g, const param_type& __pr) {
+ static_assert(__libcpp_random_is_valid_urng<_URNG>::value, "");
+ if (__pr.__t_ == 0 || __pr.__p_ == 0)
+ return 0;
+ if (__pr.__p_ == 1)
+ return __pr.__t_;
+ uniform_real_distribution<double> __gen;
+ double __u = __gen(__g) - __pr.__pr_;
+ if (__u < 0)
+ return __pr.__r0_;
+ double __pu = __pr.__pr_;
+ double __pd = __pu;
+ result_type __ru = __pr.__r0_;
+ result_type __rd = __ru;
+ while (true) {
+ bool __break = true;
+ if (__rd >= 1) {
+ __pd *= __rd / (__pr.__odds_ratio_ * (__pr.__t_ - __rd + 1));
+ __u -= __pd;
+ __break = false;
+ if (__u < 0)
+ return __rd - 1;
+ }
+ if (__rd != 0)
+ --__rd;
+ ++__ru;
+ if (__ru <= __pr.__t_) {
+ __pu *= (__pr.__t_ - __ru + 1) * __pr.__odds_ratio_ / __ru;
+ __u -= __pu;
+ __break = false;
+ if (__u < 0)
+ return __ru;
}
+ if (__break)
+ return 0;
+ }
}
template <class _CharT, class _Traits, class _IntType>
_LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>&
-operator<<(basic_ostream<_CharT, _Traits>& __os,
- const binomial_distribution<_IntType>& __x)
-{
- __save_flags<_CharT, _Traits> __lx(__os);
- typedef basic_ostream<_CharT, _Traits> _OStream;
- __os.flags(_OStream::dec | _OStream::left | _OStream::fixed |
- _OStream::scientific);
- _CharT __sp = __os.widen(' ');
- __os.fill(__sp);
- return __os << __x.t() << __sp << __x.p();
+operator<<(basic_ostream<_CharT, _Traits>& __os, const binomial_distribution<_IntType>& __x) {
+ __save_flags<_CharT, _Traits> __lx(__os);
+ typedef basic_ostream<_CharT, _Traits> _OStream;
+ __os.flags(_OStream::dec | _OStream::left | _OStream::fixed | _OStream::scientific);
+ _CharT __sp = __os.widen(' ');
+ __os.fill(__sp);
+ return __os << __x.t() << __sp << __x.p();
}
template <class _CharT, class _Traits, class _IntType>
_LIBCPP_HIDE_FROM_ABI basic_istream<_CharT, _Traits>&
-operator>>(basic_istream<_CharT, _Traits>& __is,
- binomial_distribution<_IntType>& __x)
-{
- typedef binomial_distribution<_IntType> _Eng;
- typedef typename _Eng::result_type result_type;
- typedef typename _Eng::param_type param_type;
- __save_flags<_CharT, _Traits> __lx(__is);
- typedef basic_istream<_CharT, _Traits> _Istream;
- __is.flags(_Istream::dec | _Istream::skipws);
- result_type __t;
- double __p;
- __is >> __t >> __p;
- if (!__is.fail())
- __x.param(param_type(__t, __p));
- return __is;
+operator>>(basic_istream<_CharT, _Traits>& __is, binomial_distribution<_IntType>& __x) {
+ typedef binomial_distribution<_IntType> _Eng;
+ typedef typename _Eng::result_type result_type;
+ typedef typename _Eng::param_type param_type;
+ __save_flags<_CharT, _Traits> __lx(__is);
+ typedef basic_istream<_CharT, _Traits> _Istream;
+ __is.flags(_Istream::dec | _Istream::skipws);
+ result_type __t;
+ double __p;
+ __is >> __t >> __p;
+ if (!__is.fail())
+ __x.param(param_type(__t, __p));
+ return __is;
}
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__random/cauchy_distribution.h b/contrib/llvm-project/libcxx/include/__random/cauchy_distribution.h
index 44d7e0e27c14..bd341427a152 100644
--- a/contrib/llvm-project/libcxx/include/__random/cauchy_distribution.h
+++ b/contrib/llvm-project/libcxx/include/__random/cauchy_distribution.h
@@ -25,139 +25,111 @@ _LIBCPP_PUSH_MACROS
_LIBCPP_BEGIN_NAMESPACE_STD
-template<class _RealType = double>
-class _LIBCPP_TEMPLATE_VIS cauchy_distribution
-{
+template <class _RealType = double>
+class _LIBCPP_TEMPLATE_VIS cauchy_distribution {
static_assert(__libcpp_random_is_valid_realtype<_RealType>::value,
"RealType must be a supported floating-point type");
public:
- // types
- typedef _RealType result_type;
-
- class _LIBCPP_TEMPLATE_VIS param_type
- {
- result_type __a_;
- result_type __b_;
- public:
- typedef cauchy_distribution distribution_type;
-
- _LIBCPP_HIDE_FROM_ABI
- explicit param_type(result_type __a = 0, result_type __b = 1)
- : __a_(__a), __b_(__b) {}
-
- _LIBCPP_HIDE_FROM_ABI
- result_type a() const {return __a_;}
- _LIBCPP_HIDE_FROM_ABI
- result_type b() const {return __b_;}
-
- friend _LIBCPP_HIDE_FROM_ABI
- bool operator==(const param_type& __x, const param_type& __y)
- {return __x.__a_ == __y.__a_ && __x.__b_ == __y.__b_;}
- friend _LIBCPP_HIDE_FROM_ABI
- bool operator!=(const param_type& __x, const param_type& __y)
- {return !(__x == __y);}
- };
+ // types
+ typedef _RealType result_type;
+
+ class _LIBCPP_TEMPLATE_VIS param_type {
+ result_type __a_;
+ result_type __b_;
+
+ public:
+ typedef cauchy_distribution distribution_type;
+
+ _LIBCPP_HIDE_FROM_ABI explicit param_type(result_type __a = 0, result_type __b = 1) : __a_(__a), __b_(__b) {}
+
+ _LIBCPP_HIDE_FROM_ABI result_type a() const { return __a_; }
+ _LIBCPP_HIDE_FROM_ABI result_type b() const { return __b_; }
+
+ friend _LIBCPP_HIDE_FROM_ABI bool operator==(const param_type& __x, const param_type& __y) {
+ return __x.__a_ == __y.__a_ && __x.__b_ == __y.__b_;
+ }
+ friend _LIBCPP_HIDE_FROM_ABI bool operator!=(const param_type& __x, const param_type& __y) { return !(__x == __y); }
+ };
private:
- param_type __p_;
+ param_type __p_;
public:
- // constructor and reset functions
+ // constructor and reset functions
#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI
- cauchy_distribution() : cauchy_distribution(0) {}
- _LIBCPP_HIDE_FROM_ABI
- explicit cauchy_distribution(result_type __a, result_type __b = 1)
- : __p_(param_type(__a, __b)) {}
+ _LIBCPP_HIDE_FROM_ABI cauchy_distribution() : cauchy_distribution(0) {}
+ _LIBCPP_HIDE_FROM_ABI explicit cauchy_distribution(result_type __a, result_type __b = 1)
+ : __p_(param_type(__a, __b)) {}
#else
- _LIBCPP_HIDE_FROM_ABI
- explicit cauchy_distribution(result_type __a = 0, result_type __b = 1)
- : __p_(param_type(__a, __b)) {}
+ _LIBCPP_HIDE_FROM_ABI explicit cauchy_distribution(result_type __a = 0, result_type __b = 1)
+ : __p_(param_type(__a, __b)) {}
#endif
- _LIBCPP_HIDE_FROM_ABI
- explicit cauchy_distribution(const param_type& __p)
- : __p_(__p) {}
- _LIBCPP_HIDE_FROM_ABI
- void reset() {}
-
- // generating functions
- template<class _URNG>
- _LIBCPP_HIDE_FROM_ABI
- result_type operator()(_URNG& __g)
- {return (*this)(__g, __p_);}
- template<class _URNG> _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g, const param_type& __p);
-
- // property functions
- _LIBCPP_HIDE_FROM_ABI
- result_type a() const {return __p_.a();}
- _LIBCPP_HIDE_FROM_ABI
- result_type b() const {return __p_.b();}
-
- _LIBCPP_HIDE_FROM_ABI
- param_type param() const {return __p_;}
- _LIBCPP_HIDE_FROM_ABI
- void param(const param_type& __p) {__p_ = __p;}
-
- _LIBCPP_HIDE_FROM_ABI
- result_type min() const {return -numeric_limits<result_type>::infinity();}
- _LIBCPP_HIDE_FROM_ABI
- result_type max() const {return numeric_limits<result_type>::infinity();}
-
- friend _LIBCPP_HIDE_FROM_ABI
- bool operator==(const cauchy_distribution& __x,
- const cauchy_distribution& __y)
- {return __x.__p_ == __y.__p_;}
- friend _LIBCPP_HIDE_FROM_ABI
- bool operator!=(const cauchy_distribution& __x,
- const cauchy_distribution& __y)
- {return !(__x == __y);}
+ _LIBCPP_HIDE_FROM_ABI explicit cauchy_distribution(const param_type& __p) : __p_(__p) {}
+ _LIBCPP_HIDE_FROM_ABI void reset() {}
+
+ // generating functions
+ template <class _URNG>
+ _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g) {
+ return (*this)(__g, __p_);
+ }
+ template <class _URNG>
+ _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g, const param_type& __p);
+
+ // property functions
+ _LIBCPP_HIDE_FROM_ABI result_type a() const { return __p_.a(); }
+ _LIBCPP_HIDE_FROM_ABI result_type b() const { return __p_.b(); }
+
+ _LIBCPP_HIDE_FROM_ABI param_type param() const { return __p_; }
+ _LIBCPP_HIDE_FROM_ABI void param(const param_type& __p) { __p_ = __p; }
+
+ _LIBCPP_HIDE_FROM_ABI result_type min() const { return -numeric_limits<result_type>::infinity(); }
+ _LIBCPP_HIDE_FROM_ABI result_type max() const { return numeric_limits<result_type>::infinity(); }
+
+ friend _LIBCPP_HIDE_FROM_ABI bool operator==(const cauchy_distribution& __x, const cauchy_distribution& __y) {
+ return __x.__p_ == __y.__p_;
+ }
+ friend _LIBCPP_HIDE_FROM_ABI bool operator!=(const cauchy_distribution& __x, const cauchy_distribution& __y) {
+ return !(__x == __y);
+ }
};
template <class _RealType>
-template<class _URNG>
-inline
-_RealType
-cauchy_distribution<_RealType>::operator()(_URNG& __g, const param_type& __p)
-{
- static_assert(__libcpp_random_is_valid_urng<_URNG>::value, "");
- uniform_real_distribution<result_type> __gen;
- // purposefully let tan arg get as close to pi/2 as it wants, tan will return a finite
- return __p.a() + __p.b() * std::tan(3.1415926535897932384626433832795 * __gen(__g));
+template <class _URNG>
+inline _RealType cauchy_distribution<_RealType>::operator()(_URNG& __g, const param_type& __p) {
+ static_assert(__libcpp_random_is_valid_urng<_URNG>::value, "");
+ uniform_real_distribution<result_type> __gen;
+ // purposefully let tan arg get as close to pi/2 as it wants, tan will return a finite
+ return __p.a() + __p.b() * std::tan(3.1415926535897932384626433832795 * __gen(__g));
}
template <class _CharT, class _Traits, class _RT>
_LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>&
-operator<<(basic_ostream<_CharT, _Traits>& __os,
- const cauchy_distribution<_RT>& __x)
-{
- __save_flags<_CharT, _Traits> __lx(__os);
- typedef basic_ostream<_CharT, _Traits> _OStream;
- __os.flags(_OStream::dec | _OStream::left | _OStream::fixed |
- _OStream::scientific);
- _CharT __sp = __os.widen(' ');
- __os.fill(__sp);
- __os << __x.a() << __sp << __x.b();
- return __os;
+operator<<(basic_ostream<_CharT, _Traits>& __os, const cauchy_distribution<_RT>& __x) {
+ __save_flags<_CharT, _Traits> __lx(__os);
+ typedef basic_ostream<_CharT, _Traits> _OStream;
+ __os.flags(_OStream::dec | _OStream::left | _OStream::fixed | _OStream::scientific);
+ _CharT __sp = __os.widen(' ');
+ __os.fill(__sp);
+ __os << __x.a() << __sp << __x.b();
+ return __os;
}
template <class _CharT, class _Traits, class _RT>
_LIBCPP_HIDE_FROM_ABI basic_istream<_CharT, _Traits>&
-operator>>(basic_istream<_CharT, _Traits>& __is,
- cauchy_distribution<_RT>& __x)
-{
- typedef cauchy_distribution<_RT> _Eng;
- typedef typename _Eng::result_type result_type;
- typedef typename _Eng::param_type param_type;
- __save_flags<_CharT, _Traits> __lx(__is);
- typedef basic_istream<_CharT, _Traits> _Istream;
- __is.flags(_Istream::dec | _Istream::skipws);
- result_type __a;
- result_type __b;
- __is >> __a >> __b;
- if (!__is.fail())
- __x.param(param_type(__a, __b));
- return __is;
+operator>>(basic_istream<_CharT, _Traits>& __is, cauchy_distribution<_RT>& __x) {
+ typedef cauchy_distribution<_RT> _Eng;
+ typedef typename _Eng::result_type result_type;
+ typedef typename _Eng::param_type param_type;
+ __save_flags<_CharT, _Traits> __lx(__is);
+ typedef basic_istream<_CharT, _Traits> _Istream;
+ __is.flags(_Istream::dec | _Istream::skipws);
+ result_type __a;
+ result_type __b;
+ __is >> __a >> __b;
+ if (!__is.fail())
+ __x.param(param_type(__a, __b));
+ return __is;
}
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__random/chi_squared_distribution.h b/contrib/llvm-project/libcxx/include/__random/chi_squared_distribution.h
index ce17a283d495..efa96dcdaafb 100644
--- a/contrib/llvm-project/libcxx/include/__random/chi_squared_distribution.h
+++ b/contrib/llvm-project/libcxx/include/__random/chi_squared_distribution.h
@@ -24,121 +24,98 @@ _LIBCPP_PUSH_MACROS
_LIBCPP_BEGIN_NAMESPACE_STD
-template<class _RealType = double>
-class _LIBCPP_TEMPLATE_VIS chi_squared_distribution
-{
+template <class _RealType = double>
+class _LIBCPP_TEMPLATE_VIS chi_squared_distribution {
static_assert(__libcpp_random_is_valid_realtype<_RealType>::value,
"RealType must be a supported floating-point type");
public:
- // types
- typedef _RealType result_type;
+ // types
+ typedef _RealType result_type;
- class _LIBCPP_TEMPLATE_VIS param_type
- {
- result_type __n_;
- public:
- typedef chi_squared_distribution distribution_type;
+ class _LIBCPP_TEMPLATE_VIS param_type {
+ result_type __n_;
- _LIBCPP_HIDE_FROM_ABI
- explicit param_type(result_type __n = 1) : __n_(__n) {}
+ public:
+ typedef chi_squared_distribution distribution_type;
- _LIBCPP_HIDE_FROM_ABI
- result_type n() const {return __n_;}
+ _LIBCPP_HIDE_FROM_ABI explicit param_type(result_type __n = 1) : __n_(__n) {}
- friend _LIBCPP_HIDE_FROM_ABI
- bool operator==(const param_type& __x, const param_type& __y)
- {return __x.__n_ == __y.__n_;}
- friend _LIBCPP_HIDE_FROM_ABI
- bool operator!=(const param_type& __x, const param_type& __y)
- {return !(__x == __y);}
- };
+ _LIBCPP_HIDE_FROM_ABI result_type n() const { return __n_; }
+
+ friend _LIBCPP_HIDE_FROM_ABI bool operator==(const param_type& __x, const param_type& __y) {
+ return __x.__n_ == __y.__n_;
+ }
+ friend _LIBCPP_HIDE_FROM_ABI bool operator!=(const param_type& __x, const param_type& __y) { return !(__x == __y); }
+ };
private:
- param_type __p_;
+ param_type __p_;
public:
- // constructor and reset functions
+ // constructor and reset functions
#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI
- chi_squared_distribution() : chi_squared_distribution(1) {}
- _LIBCPP_HIDE_FROM_ABI
- explicit chi_squared_distribution(result_type __n)
- : __p_(param_type(__n)) {}
+ _LIBCPP_HIDE_FROM_ABI chi_squared_distribution() : chi_squared_distribution(1) {}
+ _LIBCPP_HIDE_FROM_ABI explicit chi_squared_distribution(result_type __n) : __p_(param_type(__n)) {}
#else
- _LIBCPP_HIDE_FROM_ABI
- explicit chi_squared_distribution(result_type __n = 1)
- : __p_(param_type(__n)) {}
+ _LIBCPP_HIDE_FROM_ABI explicit chi_squared_distribution(result_type __n = 1) : __p_(param_type(__n)) {}
#endif
- _LIBCPP_HIDE_FROM_ABI
- explicit chi_squared_distribution(const param_type& __p)
- : __p_(__p) {}
- _LIBCPP_HIDE_FROM_ABI
- void reset() {}
-
- // generating functions
- template<class _URNG>
- _LIBCPP_HIDE_FROM_ABI
- result_type operator()(_URNG& __g)
- {return (*this)(__g, __p_);}
- template<class _URNG>
- _LIBCPP_HIDE_FROM_ABI
- result_type operator()(_URNG& __g, const param_type& __p)
- {return gamma_distribution<result_type>(__p.n() / 2, 2)(__g);}
-
- // property functions
- _LIBCPP_HIDE_FROM_ABI
- result_type n() const {return __p_.n();}
-
- _LIBCPP_HIDE_FROM_ABI
- param_type param() const {return __p_;}
- _LIBCPP_HIDE_FROM_ABI
- void param(const param_type& __p) {__p_ = __p;}
-
- _LIBCPP_HIDE_FROM_ABI
- result_type min() const {return 0;}
- _LIBCPP_HIDE_FROM_ABI
- result_type max() const {return numeric_limits<result_type>::infinity();}
-
- friend _LIBCPP_HIDE_FROM_ABI
- bool operator==(const chi_squared_distribution& __x,
- const chi_squared_distribution& __y)
- {return __x.__p_ == __y.__p_;}
- friend _LIBCPP_HIDE_FROM_ABI
- bool operator!=(const chi_squared_distribution& __x,
- const chi_squared_distribution& __y)
- {return !(__x == __y);}
+ _LIBCPP_HIDE_FROM_ABI explicit chi_squared_distribution(const param_type& __p) : __p_(__p) {}
+ _LIBCPP_HIDE_FROM_ABI void reset() {}
+
+ // generating functions
+ template <class _URNG>
+ _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g) {
+ return (*this)(__g, __p_);
+ }
+ template <class _URNG>
+ _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g, const param_type& __p) {
+ return gamma_distribution<result_type>(__p.n() / 2, 2)(__g);
+ }
+
+ // property functions
+ _LIBCPP_HIDE_FROM_ABI result_type n() const { return __p_.n(); }
+
+ _LIBCPP_HIDE_FROM_ABI param_type param() const { return __p_; }
+ _LIBCPP_HIDE_FROM_ABI void param(const param_type& __p) { __p_ = __p; }
+
+ _LIBCPP_HIDE_FROM_ABI result_type min() const { return 0; }
+ _LIBCPP_HIDE_FROM_ABI result_type max() const { return numeric_limits<result_type>::infinity(); }
+
+ friend _LIBCPP_HIDE_FROM_ABI bool
+ operator==(const chi_squared_distribution& __x, const chi_squared_distribution& __y) {
+ return __x.__p_ == __y.__p_;
+ }
+ friend _LIBCPP_HIDE_FROM_ABI bool
+ operator!=(const chi_squared_distribution& __x, const chi_squared_distribution& __y) {
+ return !(__x == __y);
+ }
};
template <class _CharT, class _Traits, class _RT>
_LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>&
-operator<<(basic_ostream<_CharT, _Traits>& __os,
- const chi_squared_distribution<_RT>& __x)
-{
- __save_flags<_CharT, _Traits> __lx(__os);
- typedef basic_ostream<_CharT, _Traits> _OStream;
- __os.flags(_OStream::dec | _OStream::left | _OStream::fixed |
- _OStream::scientific);
- __os << __x.n();
- return __os;
+operator<<(basic_ostream<_CharT, _Traits>& __os, const chi_squared_distribution<_RT>& __x) {
+ __save_flags<_CharT, _Traits> __lx(__os);
+ typedef basic_ostream<_CharT, _Traits> _OStream;
+ __os.flags(_OStream::dec | _OStream::left | _OStream::fixed | _OStream::scientific);
+ __os << __x.n();
+ return __os;
}
template <class _CharT, class _Traits, class _RT>
_LIBCPP_HIDE_FROM_ABI basic_istream<_CharT, _Traits>&
-operator>>(basic_istream<_CharT, _Traits>& __is,
- chi_squared_distribution<_RT>& __x)
-{
- typedef chi_squared_distribution<_RT> _Eng;
- typedef typename _Eng::result_type result_type;
- typedef typename _Eng::param_type param_type;
- __save_flags<_CharT, _Traits> __lx(__is);
- typedef basic_istream<_CharT, _Traits> _Istream;
- __is.flags(_Istream::dec | _Istream::skipws);
- result_type __n;
- __is >> __n;
- if (!__is.fail())
- __x.param(param_type(__n));
- return __is;
+operator>>(basic_istream<_CharT, _Traits>& __is, chi_squared_distribution<_RT>& __x) {
+ typedef chi_squared_distribution<_RT> _Eng;
+ typedef typename _Eng::result_type result_type;
+ typedef typename _Eng::param_type param_type;
+ __save_flags<_CharT, _Traits> __lx(__is);
+ typedef basic_istream<_CharT, _Traits> _Istream;
+ __is.flags(_Istream::dec | _Istream::skipws);
+ result_type __n;
+ __is >> __n;
+ if (!__is.fail())
+ __x.param(param_type(__n));
+ return __is;
}
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__random/clamp_to_integral.h b/contrib/llvm-project/libcxx/include/__random/clamp_to_integral.h
index 07515e871a63..d9bfd31b7f01 100644
--- a/contrib/llvm-project/libcxx/include/__random/clamp_to_integral.h
+++ b/contrib/llvm-project/libcxx/include/__random/clamp_to_integral.h
@@ -22,17 +22,18 @@ _LIBCPP_PUSH_MACROS
_LIBCPP_BEGIN_NAMESPACE_STD
-template <class _IntT, class _FloatT,
- bool _FloatBigger = (numeric_limits<_FloatT>::digits > numeric_limits<_IntT>::digits),
- int _Bits = (numeric_limits<_IntT>::digits - numeric_limits<_FloatT>::digits)>
-_LIBCPP_HIDE_FROM_ABI
-_LIBCPP_CONSTEXPR _IntT __max_representable_int_for_float() _NOEXCEPT {
+template <class _IntT,
+ class _FloatT,
+ bool _FloatBigger = (numeric_limits<_FloatT>::digits > numeric_limits<_IntT>::digits),
+ int _Bits = (numeric_limits<_IntT>::digits - numeric_limits<_FloatT>::digits)>
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR _IntT __max_representable_int_for_float() _NOEXCEPT {
static_assert(is_floating_point<_FloatT>::value, "must be a floating point type");
static_assert(is_integral<_IntT>::value, "must be an integral type");
static_assert(numeric_limits<_FloatT>::radix == 2, "FloatT has incorrect radix");
- static_assert((_IsSame<_FloatT, float>::value || _IsSame<_FloatT, double>::value
- || _IsSame<_FloatT,long double>::value), "unsupported floating point type");
- return _FloatBigger ? numeric_limits<_IntT>::max() : (numeric_limits<_IntT>::max() >> _Bits << _Bits);
+ static_assert(
+ (_IsSame<_FloatT, float>::value || _IsSame<_FloatT, double>::value || _IsSame<_FloatT, long double>::value),
+ "unsupported floating point type");
+ return _FloatBigger ? numeric_limits<_IntT>::max() : (numeric_limits<_IntT>::max() >> _Bits << _Bits);
}
// Convert a floating point number to the specified integral type after
@@ -40,9 +41,8 @@ _LIBCPP_CONSTEXPR _IntT __max_representable_int_for_float() _NOEXCEPT {
//
// The behavior is undefined if `__r` is NaN.
template <class _IntT, class _RealT>
-_LIBCPP_HIDE_FROM_ABI
-_IntT __clamp_to_integral(_RealT __r) _NOEXCEPT {
- using _Lim = numeric_limits<_IntT>;
+_LIBCPP_HIDE_FROM_ABI _IntT __clamp_to_integral(_RealT __r) _NOEXCEPT {
+ using _Lim = numeric_limits<_IntT>;
const _IntT __max_val = __max_representable_int_for_float<_IntT, _RealT>();
if (__r >= ::nextafter(static_cast<_RealT>(__max_val), INFINITY)) {
return _Lim::max();
diff --git a/contrib/llvm-project/libcxx/include/__random/discard_block_engine.h b/contrib/llvm-project/libcxx/include/__random/discard_block_engine.h
index 8ce5a1cf2cb2..9279fb66f694 100644
--- a/contrib/llvm-project/libcxx/include/__random/discard_block_engine.h
+++ b/contrib/llvm-project/libcxx/include/__random/discard_block_engine.h
@@ -27,172 +27,142 @@ _LIBCPP_PUSH_MACROS
_LIBCPP_BEGIN_NAMESPACE_STD
-template<class _Engine, size_t __p, size_t __r>
-class _LIBCPP_TEMPLATE_VIS discard_block_engine
-{
- _Engine __e_;
- int __n_;
-
- static_assert( 0 < __r, "discard_block_engine invalid parameters");
- static_assert(__r <= __p, "discard_block_engine invalid parameters");
+template <class _Engine, size_t __p, size_t __r>
+class _LIBCPP_TEMPLATE_VIS discard_block_engine {
+ _Engine __e_;
+ int __n_;
+
+ static_assert(0 < __r, "discard_block_engine invalid parameters");
+ static_assert(__r <= __p, "discard_block_engine invalid parameters");
#ifndef _LIBCPP_CXX03_LANG // numeric_limits::max() is not constexpr in C++03
- static_assert(__r <= numeric_limits<int>::max(), "discard_block_engine invalid parameters");
+ static_assert(__r <= numeric_limits<int>::max(), "discard_block_engine invalid parameters");
#endif
+
public:
- // types
- typedef typename _Engine::result_type result_type;
+ // types
+ typedef typename _Engine::result_type result_type;
- // engine characteristics
- static _LIBCPP_CONSTEXPR const size_t block_size = __p;
- static _LIBCPP_CONSTEXPR const size_t used_block = __r;
+ // engine characteristics
+ static _LIBCPP_CONSTEXPR const size_t block_size = __p;
+ static _LIBCPP_CONSTEXPR const size_t used_block = __r;
#ifdef _LIBCPP_CXX03_LANG
- static const result_type _Min = _Engine::_Min;
- static const result_type _Max = _Engine::_Max;
+ static const result_type _Min = _Engine::_Min;
+ static const result_type _Max = _Engine::_Max;
#else
- static _LIBCPP_CONSTEXPR const result_type _Min = _Engine::min();
- static _LIBCPP_CONSTEXPR const result_type _Max = _Engine::max();
+ static _LIBCPP_CONSTEXPR const result_type _Min = _Engine::min();
+ static _LIBCPP_CONSTEXPR const result_type _Max = _Engine::max();
#endif
- _LIBCPP_HIDE_FROM_ABI
- static _LIBCPP_CONSTEXPR result_type min() { return _Engine::min(); }
- _LIBCPP_HIDE_FROM_ABI
- static _LIBCPP_CONSTEXPR result_type max() { return _Engine::max(); }
-
- // constructors and seeding functions
- _LIBCPP_HIDE_FROM_ABI
- discard_block_engine() : __n_(0) {}
- _LIBCPP_HIDE_FROM_ABI
- explicit discard_block_engine(const _Engine& __e)
- : __e_(__e), __n_(0) {}
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR result_type min() { return _Engine::min(); }
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR result_type max() { return _Engine::max(); }
+
+ // constructors and seeding functions
+ _LIBCPP_HIDE_FROM_ABI discard_block_engine() : __n_(0) {}
+ _LIBCPP_HIDE_FROM_ABI explicit discard_block_engine(const _Engine& __e) : __e_(__e), __n_(0) {}
#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI
- explicit discard_block_engine(_Engine&& __e)
- : __e_(std::move(__e)), __n_(0) {}
+ _LIBCPP_HIDE_FROM_ABI explicit discard_block_engine(_Engine&& __e) : __e_(std::move(__e)), __n_(0) {}
#endif // _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI
- explicit discard_block_engine(result_type __sd) : __e_(__sd), __n_(0) {}
- template<class _Sseq, __enable_if_t<__is_seed_sequence<_Sseq, discard_block_engine>::value &&
- !is_convertible<_Sseq, _Engine>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI
- explicit discard_block_engine(_Sseq& __q)
- : __e_(__q), __n_(0) {}
- _LIBCPP_HIDE_FROM_ABI
- void seed() {__e_.seed(); __n_ = 0;}
- _LIBCPP_HIDE_FROM_ABI
- void seed(result_type __sd) {__e_.seed(__sd); __n_ = 0;}
- template<class _Sseq, __enable_if_t<__is_seed_sequence<_Sseq, discard_block_engine>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI
- void
- seed(_Sseq& __q) {__e_.seed(__q); __n_ = 0;}
-
- // generating functions
- _LIBCPP_HIDE_FROM_ABI result_type operator()();
- _LIBCPP_HIDE_FROM_ABI
- void discard(unsigned long long __z) {for (; __z; --__z) operator()();}
-
- // property functions
- _LIBCPP_HIDE_FROM_ABI
- const _Engine& base() const _NOEXCEPT {return __e_;}
-
- template<class _Eng, size_t _Pp, size_t _Rp>
- friend
- bool
- operator==(
- const discard_block_engine<_Eng, _Pp, _Rp>& __x,
- const discard_block_engine<_Eng, _Pp, _Rp>& __y);
-
- template<class _Eng, size_t _Pp, size_t _Rp>
- friend
- bool
- operator!=(
- const discard_block_engine<_Eng, _Pp, _Rp>& __x,
- const discard_block_engine<_Eng, _Pp, _Rp>& __y);
-
- template <class _CharT, class _Traits,
- class _Eng, size_t _Pp, size_t _Rp>
- friend
- basic_ostream<_CharT, _Traits>&
- operator<<(basic_ostream<_CharT, _Traits>& __os,
- const discard_block_engine<_Eng, _Pp, _Rp>& __x);
-
- template <class _CharT, class _Traits,
- class _Eng, size_t _Pp, size_t _Rp>
- friend
- basic_istream<_CharT, _Traits>&
- operator>>(basic_istream<_CharT, _Traits>& __is,
- discard_block_engine<_Eng, _Pp, _Rp>& __x);
+ _LIBCPP_HIDE_FROM_ABI explicit discard_block_engine(result_type __sd) : __e_(__sd), __n_(0) {}
+ template <
+ class _Sseq,
+ __enable_if_t<__is_seed_sequence<_Sseq, discard_block_engine>::value && !is_convertible<_Sseq, _Engine>::value,
+ int> = 0>
+ _LIBCPP_HIDE_FROM_ABI explicit discard_block_engine(_Sseq& __q) : __e_(__q), __n_(0) {}
+ _LIBCPP_HIDE_FROM_ABI void seed() {
+ __e_.seed();
+ __n_ = 0;
+ }
+ _LIBCPP_HIDE_FROM_ABI void seed(result_type __sd) {
+ __e_.seed(__sd);
+ __n_ = 0;
+ }
+ template <class _Sseq, __enable_if_t<__is_seed_sequence<_Sseq, discard_block_engine>::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI void seed(_Sseq& __q) {
+ __e_.seed(__q);
+ __n_ = 0;
+ }
+
+ // generating functions
+ _LIBCPP_HIDE_FROM_ABI result_type operator()();
+ _LIBCPP_HIDE_FROM_ABI void discard(unsigned long long __z) {
+ for (; __z; --__z)
+ operator()();
+ }
+
+ // property functions
+ _LIBCPP_HIDE_FROM_ABI const _Engine& base() const _NOEXCEPT { return __e_; }
+
+ template <class _Eng, size_t _Pp, size_t _Rp>
+ friend bool
+ operator==(const discard_block_engine<_Eng, _Pp, _Rp>& __x, const discard_block_engine<_Eng, _Pp, _Rp>& __y);
+
+ template <class _Eng, size_t _Pp, size_t _Rp>
+ friend bool
+ operator!=(const discard_block_engine<_Eng, _Pp, _Rp>& __x, const discard_block_engine<_Eng, _Pp, _Rp>& __y);
+
+ template <class _CharT, class _Traits, class _Eng, size_t _Pp, size_t _Rp>
+ friend basic_ostream<_CharT, _Traits>&
+ operator<<(basic_ostream<_CharT, _Traits>& __os, const discard_block_engine<_Eng, _Pp, _Rp>& __x);
+
+ template <class _CharT, class _Traits, class _Eng, size_t _Pp, size_t _Rp>
+ friend basic_istream<_CharT, _Traits>&
+ operator>>(basic_istream<_CharT, _Traits>& __is, discard_block_engine<_Eng, _Pp, _Rp>& __x);
};
-template<class _Engine, size_t __p, size_t __r>
- _LIBCPP_CONSTEXPR const size_t discard_block_engine<_Engine, __p, __r>::block_size;
-
-template<class _Engine, size_t __p, size_t __r>
- _LIBCPP_CONSTEXPR const size_t discard_block_engine<_Engine, __p, __r>::used_block;
-
-template<class _Engine, size_t __p, size_t __r>
-typename discard_block_engine<_Engine, __p, __r>::result_type
-discard_block_engine<_Engine, __p, __r>::operator()()
-{
- if (__n_ >= static_cast<int>(__r))
- {
- __e_.discard(__p - __r);
- __n_ = 0;
- }
- ++__n_;
- return __e_();
+template <class _Engine, size_t __p, size_t __r>
+_LIBCPP_CONSTEXPR const size_t discard_block_engine<_Engine, __p, __r>::block_size;
+
+template <class _Engine, size_t __p, size_t __r>
+_LIBCPP_CONSTEXPR const size_t discard_block_engine<_Engine, __p, __r>::used_block;
+
+template <class _Engine, size_t __p, size_t __r>
+typename discard_block_engine<_Engine, __p, __r>::result_type discard_block_engine<_Engine, __p, __r>::operator()() {
+ if (__n_ >= static_cast<int>(__r)) {
+ __e_.discard(__p - __r);
+ __n_ = 0;
+ }
+ ++__n_;
+ return __e_();
}
-template<class _Eng, size_t _Pp, size_t _Rp>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator==(const discard_block_engine<_Eng, _Pp, _Rp>& __x,
- const discard_block_engine<_Eng, _Pp, _Rp>& __y)
-{
- return __x.__n_ == __y.__n_ && __x.__e_ == __y.__e_;
+template <class _Eng, size_t _Pp, size_t _Rp>
+inline _LIBCPP_HIDE_FROM_ABI bool
+operator==(const discard_block_engine<_Eng, _Pp, _Rp>& __x, const discard_block_engine<_Eng, _Pp, _Rp>& __y) {
+ return __x.__n_ == __y.__n_ && __x.__e_ == __y.__e_;
}
-template<class _Eng, size_t _Pp, size_t _Rp>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator!=(const discard_block_engine<_Eng, _Pp, _Rp>& __x,
- const discard_block_engine<_Eng, _Pp, _Rp>& __y)
-{
- return !(__x == __y);
+template <class _Eng, size_t _Pp, size_t _Rp>
+inline _LIBCPP_HIDE_FROM_ABI bool
+operator!=(const discard_block_engine<_Eng, _Pp, _Rp>& __x, const discard_block_engine<_Eng, _Pp, _Rp>& __y) {
+ return !(__x == __y);
}
-template <class _CharT, class _Traits,
- class _Eng, size_t _Pp, size_t _Rp>
+template <class _CharT, class _Traits, class _Eng, size_t _Pp, size_t _Rp>
_LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>&
-operator<<(basic_ostream<_CharT, _Traits>& __os,
- const discard_block_engine<_Eng, _Pp, _Rp>& __x)
-{
- __save_flags<_CharT, _Traits> __lx(__os);
- typedef basic_ostream<_CharT, _Traits> _Ostream;
- __os.flags(_Ostream::dec | _Ostream::left);
- _CharT __sp = __os.widen(' ');
- __os.fill(__sp);
- return __os << __x.__e_ << __sp << __x.__n_;
+operator<<(basic_ostream<_CharT, _Traits>& __os, const discard_block_engine<_Eng, _Pp, _Rp>& __x) {
+ __save_flags<_CharT, _Traits> __lx(__os);
+ typedef basic_ostream<_CharT, _Traits> _Ostream;
+ __os.flags(_Ostream::dec | _Ostream::left);
+ _CharT __sp = __os.widen(' ');
+ __os.fill(__sp);
+ return __os << __x.__e_ << __sp << __x.__n_;
}
-template <class _CharT, class _Traits,
- class _Eng, size_t _Pp, size_t _Rp>
+template <class _CharT, class _Traits, class _Eng, size_t _Pp, size_t _Rp>
_LIBCPP_HIDE_FROM_ABI basic_istream<_CharT, _Traits>&
-operator>>(basic_istream<_CharT, _Traits>& __is,
- discard_block_engine<_Eng, _Pp, _Rp>& __x)
-{
- __save_flags<_CharT, _Traits> __lx(__is);
- typedef basic_istream<_CharT, _Traits> _Istream;
- __is.flags(_Istream::dec | _Istream::skipws);
- _Eng __e;
- int __n;
- __is >> __e >> __n;
- if (!__is.fail())
- {
- __x.__e_ = __e;
- __x.__n_ = __n;
- }
- return __is;
+operator>>(basic_istream<_CharT, _Traits>& __is, discard_block_engine<_Eng, _Pp, _Rp>& __x) {
+ __save_flags<_CharT, _Traits> __lx(__is);
+ typedef basic_istream<_CharT, _Traits> _Istream;
+ __is.flags(_Istream::dec | _Istream::skipws);
+ _Eng __e;
+ int __n;
+ __is >> __e >> __n;
+ if (!__is.fail()) {
+ __x.__e_ = __e;
+ __x.__n_ = __n;
+ }
+ return __is;
}
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__random/discrete_distribution.h b/contrib/llvm-project/libcxx/include/__random/discrete_distribution.h
index 9f0bc3591439..bb72dd6cb507 100644
--- a/contrib/llvm-project/libcxx/include/__random/discrete_distribution.h
+++ b/contrib/llvm-project/libcxx/include/__random/discrete_distribution.h
@@ -27,234 +27,182 @@ _LIBCPP_PUSH_MACROS
_LIBCPP_BEGIN_NAMESPACE_STD
-template<class _IntType = int>
-class _LIBCPP_TEMPLATE_VIS discrete_distribution
-{
- static_assert(__libcpp_random_is_valid_inttype<_IntType>::value, "IntType must be a supported integer type");
+template <class _IntType = int>
+class _LIBCPP_TEMPLATE_VIS discrete_distribution {
+ static_assert(__libcpp_random_is_valid_inttype<_IntType>::value, "IntType must be a supported integer type");
+
public:
- // types
- typedef _IntType result_type;
-
- class _LIBCPP_TEMPLATE_VIS param_type
- {
- vector<double> __p_;
- public:
- typedef discrete_distribution distribution_type;
-
- _LIBCPP_HIDE_FROM_ABI
- param_type() {}
- template<class _InputIterator>
- _LIBCPP_HIDE_FROM_ABI
- param_type(_InputIterator __f, _InputIterator __l)
- : __p_(__f, __l) {__init();}
+ // types
+ typedef _IntType result_type;
+
+ class _LIBCPP_TEMPLATE_VIS param_type {
+ vector<double> __p_;
+
+ public:
+ typedef discrete_distribution distribution_type;
+
+ _LIBCPP_HIDE_FROM_ABI param_type() {}
+ template <class _InputIterator>
+ _LIBCPP_HIDE_FROM_ABI param_type(_InputIterator __f, _InputIterator __l) : __p_(__f, __l) {
+ __init();
+ }
#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI
- param_type(initializer_list<double> __wl)
- : __p_(__wl.begin(), __wl.end()) {__init();}
+ _LIBCPP_HIDE_FROM_ABI param_type(initializer_list<double> __wl) : __p_(__wl.begin(), __wl.end()) { __init(); }
#endif // _LIBCPP_CXX03_LANG
- template<class _UnaryOperation>
- _LIBCPP_HIDE_FROM_ABI param_type(size_t __nw, double __xmin, double __xmax,
- _UnaryOperation __fw);
+ template <class _UnaryOperation>
+ _LIBCPP_HIDE_FROM_ABI param_type(size_t __nw, double __xmin, double __xmax, _UnaryOperation __fw);
- _LIBCPP_HIDE_FROM_ABI vector<double> probabilities() const;
+ _LIBCPP_HIDE_FROM_ABI vector<double> probabilities() const;
- friend _LIBCPP_HIDE_FROM_ABI
- bool operator==(const param_type& __x, const param_type& __y)
- {return __x.__p_ == __y.__p_;}
- friend _LIBCPP_HIDE_FROM_ABI
- bool operator!=(const param_type& __x, const param_type& __y)
- {return !(__x == __y);}
+ friend _LIBCPP_HIDE_FROM_ABI bool operator==(const param_type& __x, const param_type& __y) {
+ return __x.__p_ == __y.__p_;
+ }
+ friend _LIBCPP_HIDE_FROM_ABI bool operator!=(const param_type& __x, const param_type& __y) { return !(__x == __y); }
- private:
- _LIBCPP_HIDE_FROM_ABI void __init();
+ private:
+ _LIBCPP_HIDE_FROM_ABI void __init();
- friend class discrete_distribution;
+ friend class discrete_distribution;
- template <class _CharT, class _Traits, class _IT>
- friend
- basic_ostream<_CharT, _Traits>&
- operator<<(basic_ostream<_CharT, _Traits>& __os,
- const discrete_distribution<_IT>& __x);
+ template <class _CharT, class _Traits, class _IT>
+ friend basic_ostream<_CharT, _Traits>&
+ operator<<(basic_ostream<_CharT, _Traits>& __os, const discrete_distribution<_IT>& __x);
- template <class _CharT, class _Traits, class _IT>
- friend
- basic_istream<_CharT, _Traits>&
- operator>>(basic_istream<_CharT, _Traits>& __is,
- discrete_distribution<_IT>& __x);
- };
+ template <class _CharT, class _Traits, class _IT>
+ friend basic_istream<_CharT, _Traits>&
+ operator>>(basic_istream<_CharT, _Traits>& __is, discrete_distribution<_IT>& __x);
+ };
private:
- param_type __p_;
+ param_type __p_;
public:
- // constructor and reset functions
- _LIBCPP_HIDE_FROM_ABI
- discrete_distribution() {}
- template<class _InputIterator>
- _LIBCPP_HIDE_FROM_ABI
- discrete_distribution(_InputIterator __f, _InputIterator __l)
- : __p_(__f, __l) {}
+ // constructor and reset functions
+ _LIBCPP_HIDE_FROM_ABI discrete_distribution() {}
+ template <class _InputIterator>
+ _LIBCPP_HIDE_FROM_ABI discrete_distribution(_InputIterator __f, _InputIterator __l) : __p_(__f, __l) {}
#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI
- discrete_distribution(initializer_list<double> __wl)
- : __p_(__wl) {}
+ _LIBCPP_HIDE_FROM_ABI discrete_distribution(initializer_list<double> __wl) : __p_(__wl) {}
#endif // _LIBCPP_CXX03_LANG
- template<class _UnaryOperation>
- _LIBCPP_HIDE_FROM_ABI
- discrete_distribution(size_t __nw, double __xmin, double __xmax,
- _UnaryOperation __fw)
- : __p_(__nw, __xmin, __xmax, __fw) {}
- _LIBCPP_HIDE_FROM_ABI
- explicit discrete_distribution(const param_type& __p)
- : __p_(__p) {}
- _LIBCPP_HIDE_FROM_ABI
- void reset() {}
-
- // generating functions
- template<class _URNG>
- _LIBCPP_HIDE_FROM_ABI
- result_type operator()(_URNG& __g)
- {return (*this)(__g, __p_);}
- template<class _URNG>
- _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g, const param_type& __p);
-
- // property functions
- _LIBCPP_HIDE_FROM_ABI
- vector<double> probabilities() const {return __p_.probabilities();}
-
- _LIBCPP_HIDE_FROM_ABI
- param_type param() const {return __p_;}
- _LIBCPP_HIDE_FROM_ABI
- void param(const param_type& __p) {__p_ = __p;}
-
- _LIBCPP_HIDE_FROM_ABI
- result_type min() const {return 0;}
- _LIBCPP_HIDE_FROM_ABI
- result_type max() const {return __p_.__p_.size();}
-
- friend _LIBCPP_HIDE_FROM_ABI
- bool operator==(const discrete_distribution& __x,
- const discrete_distribution& __y)
- {return __x.__p_ == __y.__p_;}
- friend _LIBCPP_HIDE_FROM_ABI
- bool operator!=(const discrete_distribution& __x,
- const discrete_distribution& __y)
- {return !(__x == __y);}
-
- template <class _CharT, class _Traits, class _IT>
- friend
- basic_ostream<_CharT, _Traits>&
- operator<<(basic_ostream<_CharT, _Traits>& __os,
- const discrete_distribution<_IT>& __x);
-
- template <class _CharT, class _Traits, class _IT>
- friend
- basic_istream<_CharT, _Traits>&
- operator>>(basic_istream<_CharT, _Traits>& __is,
- discrete_distribution<_IT>& __x);
+ template <class _UnaryOperation>
+ _LIBCPP_HIDE_FROM_ABI discrete_distribution(size_t __nw, double __xmin, double __xmax, _UnaryOperation __fw)
+ : __p_(__nw, __xmin, __xmax, __fw) {}
+ _LIBCPP_HIDE_FROM_ABI explicit discrete_distribution(const param_type& __p) : __p_(__p) {}
+ _LIBCPP_HIDE_FROM_ABI void reset() {}
+
+ // generating functions
+ template <class _URNG>
+ _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g) {
+ return (*this)(__g, __p_);
+ }
+ template <class _URNG>
+ _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g, const param_type& __p);
+
+ // property functions
+ _LIBCPP_HIDE_FROM_ABI vector<double> probabilities() const { return __p_.probabilities(); }
+
+ _LIBCPP_HIDE_FROM_ABI param_type param() const { return __p_; }
+ _LIBCPP_HIDE_FROM_ABI void param(const param_type& __p) { __p_ = __p; }
+
+ _LIBCPP_HIDE_FROM_ABI result_type min() const { return 0; }
+ _LIBCPP_HIDE_FROM_ABI result_type max() const { return __p_.__p_.size(); }
+
+ friend _LIBCPP_HIDE_FROM_ABI bool operator==(const discrete_distribution& __x, const discrete_distribution& __y) {
+ return __x.__p_ == __y.__p_;
+ }
+ friend _LIBCPP_HIDE_FROM_ABI bool operator!=(const discrete_distribution& __x, const discrete_distribution& __y) {
+ return !(__x == __y);
+ }
+
+ template <class _CharT, class _Traits, class _IT>
+ friend basic_ostream<_CharT, _Traits>&
+ operator<<(basic_ostream<_CharT, _Traits>& __os, const discrete_distribution<_IT>& __x);
+
+ template <class _CharT, class _Traits, class _IT>
+ friend basic_istream<_CharT, _Traits>&
+ operator>>(basic_istream<_CharT, _Traits>& __is, discrete_distribution<_IT>& __x);
};
-template<class _IntType>
-template<class _UnaryOperation>
-discrete_distribution<_IntType>::param_type::param_type(size_t __nw,
- double __xmin,
- double __xmax,
- _UnaryOperation __fw)
-{
- if (__nw > 1)
- {
- __p_.reserve(__nw - 1);
- double __d = (__xmax - __xmin) / __nw;
- double __d2 = __d / 2;
- for (size_t __k = 0; __k < __nw; ++__k)
- __p_.push_back(__fw(__xmin + __k * __d + __d2));
- __init();
- }
+template <class _IntType>
+template <class _UnaryOperation>
+discrete_distribution<_IntType>::param_type::param_type(
+ size_t __nw, double __xmin, double __xmax, _UnaryOperation __fw) {
+ if (__nw > 1) {
+ __p_.reserve(__nw - 1);
+ double __d = (__xmax - __xmin) / __nw;
+ double __d2 = __d / 2;
+ for (size_t __k = 0; __k < __nw; ++__k)
+ __p_.push_back(__fw(__xmin + __k * __d + __d2));
+ __init();
+ }
}
-template<class _IntType>
-void
-discrete_distribution<_IntType>::param_type::__init()
-{
- if (!__p_.empty())
- {
- if (__p_.size() > 1)
- {
- double __s = std::accumulate(__p_.begin(), __p_.end(), 0.0);
- for (vector<double>::iterator __i = __p_.begin(), __e = __p_.end(); __i < __e; ++__i)
- *__i /= __s;
- vector<double> __t(__p_.size() - 1);
- std::partial_sum(__p_.begin(), __p_.end() - 1, __t.begin());
- swap(__p_, __t);
- }
- else
- {
- __p_.clear();
- __p_.shrink_to_fit();
- }
+template <class _IntType>
+void discrete_distribution<_IntType>::param_type::__init() {
+ if (!__p_.empty()) {
+ if (__p_.size() > 1) {
+ double __s = std::accumulate(__p_.begin(), __p_.end(), 0.0);
+ for (vector<double>::iterator __i = __p_.begin(), __e = __p_.end(); __i < __e; ++__i)
+ *__i /= __s;
+ vector<double> __t(__p_.size() - 1);
+ std::partial_sum(__p_.begin(), __p_.end() - 1, __t.begin());
+ swap(__p_, __t);
+ } else {
+ __p_.clear();
+ __p_.shrink_to_fit();
}
+ }
}
-template<class _IntType>
-vector<double>
-discrete_distribution<_IntType>::param_type::probabilities() const
-{
- size_t __n = __p_.size();
- vector<double> __p(__n+1);
- std::adjacent_difference(__p_.begin(), __p_.end(), __p.begin());
- if (__n > 0)
- __p[__n] = 1 - __p_[__n-1];
- else
- __p[0] = 1;
- return __p;
+template <class _IntType>
+vector<double> discrete_distribution<_IntType>::param_type::probabilities() const {
+ size_t __n = __p_.size();
+ vector<double> __p(__n + 1);
+ std::adjacent_difference(__p_.begin(), __p_.end(), __p.begin());
+ if (__n > 0)
+ __p[__n] = 1 - __p_[__n - 1];
+ else
+ __p[0] = 1;
+ return __p;
}
-template<class _IntType>
-template<class _URNG>
-_IntType
-discrete_distribution<_IntType>::operator()(_URNG& __g, const param_type& __p)
-{
- static_assert(__libcpp_random_is_valid_urng<_URNG>::value, "");
- uniform_real_distribution<double> __gen;
- return static_cast<_IntType>(
- std::upper_bound(__p.__p_.begin(), __p.__p_.end(), __gen(__g)) -
- __p.__p_.begin());
+template <class _IntType>
+template <class _URNG>
+_IntType discrete_distribution<_IntType>::operator()(_URNG& __g, const param_type& __p) {
+ static_assert(__libcpp_random_is_valid_urng<_URNG>::value, "");
+ uniform_real_distribution<double> __gen;
+ return static_cast<_IntType>(std::upper_bound(__p.__p_.begin(), __p.__p_.end(), __gen(__g)) - __p.__p_.begin());
}
template <class _CharT, class _Traits, class _IT>
_LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>&
-operator<<(basic_ostream<_CharT, _Traits>& __os,
- const discrete_distribution<_IT>& __x)
-{
- __save_flags<_CharT, _Traits> __lx(__os);
- typedef basic_ostream<_CharT, _Traits> _OStream;
- __os.flags(_OStream::dec | _OStream::left | _OStream::fixed |
- _OStream::scientific);
- _CharT __sp = __os.widen(' ');
- __os.fill(__sp);
- size_t __n = __x.__p_.__p_.size();
- __os << __n;
- for (size_t __i = 0; __i < __n; ++__i)
- __os << __sp << __x.__p_.__p_[__i];
- return __os;
+operator<<(basic_ostream<_CharT, _Traits>& __os, const discrete_distribution<_IT>& __x) {
+ __save_flags<_CharT, _Traits> __lx(__os);
+ typedef basic_ostream<_CharT, _Traits> _OStream;
+ __os.flags(_OStream::dec | _OStream::left | _OStream::fixed | _OStream::scientific);
+ _CharT __sp = __os.widen(' ');
+ __os.fill(__sp);
+ size_t __n = __x.__p_.__p_.size();
+ __os << __n;
+ for (size_t __i = 0; __i < __n; ++__i)
+ __os << __sp << __x.__p_.__p_[__i];
+ return __os;
}
template <class _CharT, class _Traits, class _IT>
_LIBCPP_HIDE_FROM_ABI basic_istream<_CharT, _Traits>&
-operator>>(basic_istream<_CharT, _Traits>& __is,
- discrete_distribution<_IT>& __x)
-{
- __save_flags<_CharT, _Traits> __lx(__is);
- typedef basic_istream<_CharT, _Traits> _Istream;
- __is.flags(_Istream::dec | _Istream::skipws);
- size_t __n;
- __is >> __n;
- vector<double> __p(__n);
- for (size_t __i = 0; __i < __n; ++__i)
- __is >> __p[__i];
- if (!__is.fail())
- swap(__x.__p_.__p_, __p);
- return __is;
+operator>>(basic_istream<_CharT, _Traits>& __is, discrete_distribution<_IT>& __x) {
+ __save_flags<_CharT, _Traits> __lx(__is);
+ typedef basic_istream<_CharT, _Traits> _Istream;
+ __is.flags(_Istream::dec | _Istream::skipws);
+ size_t __n;
+ __is >> __n;
+ vector<double> __p(__n);
+ for (size_t __i = 0; __i < __n; ++__i)
+ __is >> __p[__i];
+ if (!__is.fail())
+ swap(__x.__p_.__p_, __p);
+ return __is;
}
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__random/exponential_distribution.h b/contrib/llvm-project/libcxx/include/__random/exponential_distribution.h
index e9df4de90e74..e0e38841172f 100644
--- a/contrib/llvm-project/libcxx/include/__random/exponential_distribution.h
+++ b/contrib/llvm-project/libcxx/include/__random/exponential_distribution.h
@@ -26,132 +26,103 @@ _LIBCPP_PUSH_MACROS
_LIBCPP_BEGIN_NAMESPACE_STD
-template<class _RealType = double>
-class _LIBCPP_TEMPLATE_VIS exponential_distribution
-{
+template <class _RealType = double>
+class _LIBCPP_TEMPLATE_VIS exponential_distribution {
static_assert(__libcpp_random_is_valid_realtype<_RealType>::value,
"RealType must be a supported floating-point type");
public:
- // types
- typedef _RealType result_type;
+ // types
+ typedef _RealType result_type;
- class _LIBCPP_TEMPLATE_VIS param_type
- {
- result_type __lambda_;
- public:
- typedef exponential_distribution distribution_type;
+ class _LIBCPP_TEMPLATE_VIS param_type {
+ result_type __lambda_;
- _LIBCPP_HIDE_FROM_ABI
- explicit param_type(result_type __lambda = 1) : __lambda_(__lambda) {}
+ public:
+ typedef exponential_distribution distribution_type;
- _LIBCPP_HIDE_FROM_ABI
- result_type lambda() const {return __lambda_;}
+ _LIBCPP_HIDE_FROM_ABI explicit param_type(result_type __lambda = 1) : __lambda_(__lambda) {}
- friend _LIBCPP_HIDE_FROM_ABI
- bool operator==(const param_type& __x, const param_type& __y)
- {return __x.__lambda_ == __y.__lambda_;}
- friend _LIBCPP_HIDE_FROM_ABI
- bool operator!=(const param_type& __x, const param_type& __y)
- {return !(__x == __y);}
- };
+ _LIBCPP_HIDE_FROM_ABI result_type lambda() const { return __lambda_; }
+
+ friend _LIBCPP_HIDE_FROM_ABI bool operator==(const param_type& __x, const param_type& __y) {
+ return __x.__lambda_ == __y.__lambda_;
+ }
+ friend _LIBCPP_HIDE_FROM_ABI bool operator!=(const param_type& __x, const param_type& __y) { return !(__x == __y); }
+ };
private:
- param_type __p_;
+ param_type __p_;
public:
- // constructors and reset functions
+ // constructors and reset functions
#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI
- exponential_distribution() : exponential_distribution(1) {}
- _LIBCPP_HIDE_FROM_ABI
- explicit exponential_distribution(result_type __lambda)
- : __p_(param_type(__lambda)) {}
+ _LIBCPP_HIDE_FROM_ABI exponential_distribution() : exponential_distribution(1) {}
+ _LIBCPP_HIDE_FROM_ABI explicit exponential_distribution(result_type __lambda) : __p_(param_type(__lambda)) {}
#else
- _LIBCPP_HIDE_FROM_ABI
- explicit exponential_distribution(result_type __lambda = 1)
- : __p_(param_type(__lambda)) {}
+ _LIBCPP_HIDE_FROM_ABI explicit exponential_distribution(result_type __lambda = 1) : __p_(param_type(__lambda)) {}
#endif
- _LIBCPP_HIDE_FROM_ABI
- explicit exponential_distribution(const param_type& __p) : __p_(__p) {}
- _LIBCPP_HIDE_FROM_ABI
- void reset() {}
-
- // generating functions
- template<class _URNG>
- _LIBCPP_HIDE_FROM_ABI
- result_type operator()(_URNG& __g)
- {return (*this)(__g, __p_);}
- template<class _URNG>
- _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g, const param_type& __p);
-
- // property functions
- _LIBCPP_HIDE_FROM_ABI
- result_type lambda() const {return __p_.lambda();}
-
- _LIBCPP_HIDE_FROM_ABI
- param_type param() const {return __p_;}
- _LIBCPP_HIDE_FROM_ABI
- void param(const param_type& __p) {__p_ = __p;}
-
- _LIBCPP_HIDE_FROM_ABI
- result_type min() const {return 0;}
- _LIBCPP_HIDE_FROM_ABI
- result_type max() const {return numeric_limits<result_type>::infinity();}
-
- friend _LIBCPP_HIDE_FROM_ABI
- bool operator==(const exponential_distribution& __x,
- const exponential_distribution& __y)
- {return __x.__p_ == __y.__p_;}
- friend _LIBCPP_HIDE_FROM_ABI
- bool operator!=(const exponential_distribution& __x,
- const exponential_distribution& __y)
- {return !(__x == __y);}
+ _LIBCPP_HIDE_FROM_ABI explicit exponential_distribution(const param_type& __p) : __p_(__p) {}
+ _LIBCPP_HIDE_FROM_ABI void reset() {}
+
+ // generating functions
+ template <class _URNG>
+ _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g) {
+ return (*this)(__g, __p_);
+ }
+ template <class _URNG>
+ _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g, const param_type& __p);
+
+ // property functions
+ _LIBCPP_HIDE_FROM_ABI result_type lambda() const { return __p_.lambda(); }
+
+ _LIBCPP_HIDE_FROM_ABI param_type param() const { return __p_; }
+ _LIBCPP_HIDE_FROM_ABI void param(const param_type& __p) { __p_ = __p; }
+
+ _LIBCPP_HIDE_FROM_ABI result_type min() const { return 0; }
+ _LIBCPP_HIDE_FROM_ABI result_type max() const { return numeric_limits<result_type>::infinity(); }
+
+ friend _LIBCPP_HIDE_FROM_ABI bool
+ operator==(const exponential_distribution& __x, const exponential_distribution& __y) {
+ return __x.__p_ == __y.__p_;
+ }
+ friend _LIBCPP_HIDE_FROM_ABI bool
+ operator!=(const exponential_distribution& __x, const exponential_distribution& __y) {
+ return !(__x == __y);
+ }
};
template <class _RealType>
-template<class _URNG>
-_RealType
-exponential_distribution<_RealType>::operator()(_URNG& __g, const param_type& __p)
-{
- static_assert(__libcpp_random_is_valid_urng<_URNG>::value, "");
- return -std::log
- (
- result_type(1) -
- std::generate_canonical<result_type,
- numeric_limits<result_type>::digits>(__g)
- )
- / __p.lambda();
+template <class _URNG>
+_RealType exponential_distribution<_RealType>::operator()(_URNG& __g, const param_type& __p) {
+ static_assert(__libcpp_random_is_valid_urng<_URNG>::value, "");
+ return -std::log(result_type(1) - std::generate_canonical<result_type, numeric_limits<result_type>::digits>(__g)) /
+ __p.lambda();
}
template <class _CharT, class _Traits, class _RealType>
_LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>&
-operator<<(basic_ostream<_CharT, _Traits>& __os,
- const exponential_distribution<_RealType>& __x)
-{
- __save_flags<_CharT, _Traits> __lx(__os);
- typedef basic_ostream<_CharT, _Traits> _OStream;
- __os.flags(_OStream::dec | _OStream::left | _OStream::fixed |
- _OStream::scientific);
- return __os << __x.lambda();
+operator<<(basic_ostream<_CharT, _Traits>& __os, const exponential_distribution<_RealType>& __x) {
+ __save_flags<_CharT, _Traits> __lx(__os);
+ typedef basic_ostream<_CharT, _Traits> _OStream;
+ __os.flags(_OStream::dec | _OStream::left | _OStream::fixed | _OStream::scientific);
+ return __os << __x.lambda();
}
template <class _CharT, class _Traits, class _RealType>
_LIBCPP_HIDE_FROM_ABI basic_istream<_CharT, _Traits>&
-operator>>(basic_istream<_CharT, _Traits>& __is,
- exponential_distribution<_RealType>& __x)
-{
- typedef exponential_distribution<_RealType> _Eng;
- typedef typename _Eng::result_type result_type;
- typedef typename _Eng::param_type param_type;
- __save_flags<_CharT, _Traits> __lx(__is);
- typedef basic_istream<_CharT, _Traits> _Istream;
- __is.flags(_Istream::dec | _Istream::skipws);
- result_type __lambda;
- __is >> __lambda;
- if (!__is.fail())
- __x.param(param_type(__lambda));
- return __is;
+operator>>(basic_istream<_CharT, _Traits>& __is, exponential_distribution<_RealType>& __x) {
+ typedef exponential_distribution<_RealType> _Eng;
+ typedef typename _Eng::result_type result_type;
+ typedef typename _Eng::param_type param_type;
+ __save_flags<_CharT, _Traits> __lx(__is);
+ typedef basic_istream<_CharT, _Traits> _Istream;
+ __is.flags(_Istream::dec | _Istream::skipws);
+ result_type __lambda;
+ __is >> __lambda;
+ if (!__is.fail())
+ __x.param(param_type(__lambda));
+ return __is;
}
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__random/extreme_value_distribution.h b/contrib/llvm-project/libcxx/include/__random/extreme_value_distribution.h
index f8f18ebf7896..5505f93274f5 100644
--- a/contrib/llvm-project/libcxx/include/__random/extreme_value_distribution.h
+++ b/contrib/llvm-project/libcxx/include/__random/extreme_value_distribution.h
@@ -25,139 +25,111 @@ _LIBCPP_PUSH_MACROS
_LIBCPP_BEGIN_NAMESPACE_STD
-template<class _RealType = double>
-class _LIBCPP_TEMPLATE_VIS extreme_value_distribution
-{
+template <class _RealType = double>
+class _LIBCPP_TEMPLATE_VIS extreme_value_distribution {
static_assert(__libcpp_random_is_valid_realtype<_RealType>::value,
"RealType must be a supported floating-point type");
public:
- // types
- typedef _RealType result_type;
-
- class _LIBCPP_TEMPLATE_VIS param_type
- {
- result_type __a_;
- result_type __b_;
- public:
- typedef extreme_value_distribution distribution_type;
-
- _LIBCPP_HIDE_FROM_ABI
- explicit param_type(result_type __a = 0, result_type __b = 1)
- : __a_(__a), __b_(__b) {}
-
- _LIBCPP_HIDE_FROM_ABI
- result_type a() const {return __a_;}
- _LIBCPP_HIDE_FROM_ABI
- result_type b() const {return __b_;}
-
- friend _LIBCPP_HIDE_FROM_ABI
- bool operator==(const param_type& __x, const param_type& __y)
- {return __x.__a_ == __y.__a_ && __x.__b_ == __y.__b_;}
- friend _LIBCPP_HIDE_FROM_ABI
- bool operator!=(const param_type& __x, const param_type& __y)
- {return !(__x == __y);}
- };
+ // types
+ typedef _RealType result_type;
+
+ class _LIBCPP_TEMPLATE_VIS param_type {
+ result_type __a_;
+ result_type __b_;
+
+ public:
+ typedef extreme_value_distribution distribution_type;
+
+ _LIBCPP_HIDE_FROM_ABI explicit param_type(result_type __a = 0, result_type __b = 1) : __a_(__a), __b_(__b) {}
+
+ _LIBCPP_HIDE_FROM_ABI result_type a() const { return __a_; }
+ _LIBCPP_HIDE_FROM_ABI result_type b() const { return __b_; }
+
+ friend _LIBCPP_HIDE_FROM_ABI bool operator==(const param_type& __x, const param_type& __y) {
+ return __x.__a_ == __y.__a_ && __x.__b_ == __y.__b_;
+ }
+ friend _LIBCPP_HIDE_FROM_ABI bool operator!=(const param_type& __x, const param_type& __y) { return !(__x == __y); }
+ };
private:
- param_type __p_;
+ param_type __p_;
public:
- // constructor and reset functions
+ // constructor and reset functions
#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI
- extreme_value_distribution() : extreme_value_distribution(0) {}
- _LIBCPP_HIDE_FROM_ABI
- explicit extreme_value_distribution(result_type __a, result_type __b = 1)
- : __p_(param_type(__a, __b)) {}
+ _LIBCPP_HIDE_FROM_ABI extreme_value_distribution() : extreme_value_distribution(0) {}
+ _LIBCPP_HIDE_FROM_ABI explicit extreme_value_distribution(result_type __a, result_type __b = 1)
+ : __p_(param_type(__a, __b)) {}
#else
- _LIBCPP_HIDE_FROM_ABI
- explicit extreme_value_distribution(result_type __a = 0,
- result_type __b = 1)
- : __p_(param_type(__a, __b)) {}
+ _LIBCPP_HIDE_FROM_ABI explicit extreme_value_distribution(result_type __a = 0, result_type __b = 1)
+ : __p_(param_type(__a, __b)) {}
#endif
- _LIBCPP_HIDE_FROM_ABI
- explicit extreme_value_distribution(const param_type& __p)
- : __p_(__p) {}
- _LIBCPP_HIDE_FROM_ABI
- void reset() {}
-
- // generating functions
- template<class _URNG>
- _LIBCPP_HIDE_FROM_ABI
- result_type operator()(_URNG& __g)
- {return (*this)(__g, __p_);}
- template<class _URNG>
- _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g, const param_type& __p);
-
- // property functions
- _LIBCPP_HIDE_FROM_ABI
- result_type a() const {return __p_.a();}
- _LIBCPP_HIDE_FROM_ABI
- result_type b() const {return __p_.b();}
-
- _LIBCPP_HIDE_FROM_ABI
- param_type param() const {return __p_;}
- _LIBCPP_HIDE_FROM_ABI
- void param(const param_type& __p) {__p_ = __p;}
-
- _LIBCPP_HIDE_FROM_ABI
- result_type min() const {return -numeric_limits<result_type>::infinity();}
- _LIBCPP_HIDE_FROM_ABI
- result_type max() const {return numeric_limits<result_type>::infinity();}
-
- friend _LIBCPP_HIDE_FROM_ABI
- bool operator==(const extreme_value_distribution& __x,
- const extreme_value_distribution& __y)
- {return __x.__p_ == __y.__p_;}
- friend _LIBCPP_HIDE_FROM_ABI
- bool operator!=(const extreme_value_distribution& __x,
- const extreme_value_distribution& __y)
- {return !(__x == __y);}
+ _LIBCPP_HIDE_FROM_ABI explicit extreme_value_distribution(const param_type& __p) : __p_(__p) {}
+ _LIBCPP_HIDE_FROM_ABI void reset() {}
+
+ // generating functions
+ template <class _URNG>
+ _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g) {
+ return (*this)(__g, __p_);
+ }
+ template <class _URNG>
+ _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g, const param_type& __p);
+
+ // property functions
+ _LIBCPP_HIDE_FROM_ABI result_type a() const { return __p_.a(); }
+ _LIBCPP_HIDE_FROM_ABI result_type b() const { return __p_.b(); }
+
+ _LIBCPP_HIDE_FROM_ABI param_type param() const { return __p_; }
+ _LIBCPP_HIDE_FROM_ABI void param(const param_type& __p) { __p_ = __p; }
+
+ _LIBCPP_HIDE_FROM_ABI result_type min() const { return -numeric_limits<result_type>::infinity(); }
+ _LIBCPP_HIDE_FROM_ABI result_type max() const { return numeric_limits<result_type>::infinity(); }
+
+ friend _LIBCPP_HIDE_FROM_ABI bool
+ operator==(const extreme_value_distribution& __x, const extreme_value_distribution& __y) {
+ return __x.__p_ == __y.__p_;
+ }
+ friend _LIBCPP_HIDE_FROM_ABI bool
+ operator!=(const extreme_value_distribution& __x, const extreme_value_distribution& __y) {
+ return !(__x == __y);
+ }
};
-template<class _RealType>
-template<class _URNG>
-_RealType
-extreme_value_distribution<_RealType>::operator()(_URNG& __g, const param_type& __p)
-{
- static_assert(__libcpp_random_is_valid_urng<_URNG>::value, "");
- return __p.a() - __p.b() *
- std::log(-std::log(1-uniform_real_distribution<result_type>()(__g)));
+template <class _RealType>
+template <class _URNG>
+_RealType extreme_value_distribution<_RealType>::operator()(_URNG& __g, const param_type& __p) {
+ static_assert(__libcpp_random_is_valid_urng<_URNG>::value, "");
+ return __p.a() - __p.b() * std::log(-std::log(1 - uniform_real_distribution<result_type>()(__g)));
}
template <class _CharT, class _Traits, class _RT>
_LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>&
-operator<<(basic_ostream<_CharT, _Traits>& __os,
- const extreme_value_distribution<_RT>& __x)
-{
- __save_flags<_CharT, _Traits> __lx(__os);
- typedef basic_ostream<_CharT, _Traits> _OStream;
- __os.flags(_OStream::dec | _OStream::left | _OStream::fixed |
- _OStream::scientific);
- _CharT __sp = __os.widen(' ');
- __os.fill(__sp);
- __os << __x.a() << __sp << __x.b();
- return __os;
+operator<<(basic_ostream<_CharT, _Traits>& __os, const extreme_value_distribution<_RT>& __x) {
+ __save_flags<_CharT, _Traits> __lx(__os);
+ typedef basic_ostream<_CharT, _Traits> _OStream;
+ __os.flags(_OStream::dec | _OStream::left | _OStream::fixed | _OStream::scientific);
+ _CharT __sp = __os.widen(' ');
+ __os.fill(__sp);
+ __os << __x.a() << __sp << __x.b();
+ return __os;
}
template <class _CharT, class _Traits, class _RT>
_LIBCPP_HIDE_FROM_ABI basic_istream<_CharT, _Traits>&
-operator>>(basic_istream<_CharT, _Traits>& __is,
- extreme_value_distribution<_RT>& __x)
-{
- typedef extreme_value_distribution<_RT> _Eng;
- typedef typename _Eng::result_type result_type;
- typedef typename _Eng::param_type param_type;
- __save_flags<_CharT, _Traits> __lx(__is);
- typedef basic_istream<_CharT, _Traits> _Istream;
- __is.flags(_Istream::dec | _Istream::skipws);
- result_type __a;
- result_type __b;
- __is >> __a >> __b;
- if (!__is.fail())
- __x.param(param_type(__a, __b));
- return __is;
+operator>>(basic_istream<_CharT, _Traits>& __is, extreme_value_distribution<_RT>& __x) {
+ typedef extreme_value_distribution<_RT> _Eng;
+ typedef typename _Eng::result_type result_type;
+ typedef typename _Eng::param_type param_type;
+ __save_flags<_CharT, _Traits> __lx(__is);
+ typedef basic_istream<_CharT, _Traits> _Istream;
+ __is.flags(_Istream::dec | _Istream::skipws);
+ result_type __a;
+ result_type __b;
+ __is >> __a >> __b;
+ if (!__is.fail())
+ __x.param(param_type(__a, __b));
+ return __is;
}
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__random/fisher_f_distribution.h b/contrib/llvm-project/libcxx/include/__random/fisher_f_distribution.h
index 8da689a3b0f4..cd170b3af388 100644
--- a/contrib/llvm-project/libcxx/include/__random/fisher_f_distribution.h
+++ b/contrib/llvm-project/libcxx/include/__random/fisher_f_distribution.h
@@ -24,139 +24,111 @@ _LIBCPP_PUSH_MACROS
_LIBCPP_BEGIN_NAMESPACE_STD
-template<class _RealType = double>
-class _LIBCPP_TEMPLATE_VIS fisher_f_distribution
-{
+template <class _RealType = double>
+class _LIBCPP_TEMPLATE_VIS fisher_f_distribution {
static_assert(__libcpp_random_is_valid_realtype<_RealType>::value,
"RealType must be a supported floating-point type");
public:
- // types
- typedef _RealType result_type;
-
- class _LIBCPP_TEMPLATE_VIS param_type
- {
- result_type __m_;
- result_type __n_;
- public:
- typedef fisher_f_distribution distribution_type;
-
- _LIBCPP_HIDE_FROM_ABI
- explicit param_type(result_type __m = 1, result_type __n = 1)
- : __m_(__m), __n_(__n) {}
-
- _LIBCPP_HIDE_FROM_ABI
- result_type m() const {return __m_;}
- _LIBCPP_HIDE_FROM_ABI
- result_type n() const {return __n_;}
-
- friend _LIBCPP_HIDE_FROM_ABI
- bool operator==(const param_type& __x, const param_type& __y)
- {return __x.__m_ == __y.__m_ && __x.__n_ == __y.__n_;}
- friend _LIBCPP_HIDE_FROM_ABI
- bool operator!=(const param_type& __x, const param_type& __y)
- {return !(__x == __y);}
- };
+ // types
+ typedef _RealType result_type;
+
+ class _LIBCPP_TEMPLATE_VIS param_type {
+ result_type __m_;
+ result_type __n_;
+
+ public:
+ typedef fisher_f_distribution distribution_type;
+
+ _LIBCPP_HIDE_FROM_ABI explicit param_type(result_type __m = 1, result_type __n = 1) : __m_(__m), __n_(__n) {}
+
+ _LIBCPP_HIDE_FROM_ABI result_type m() const { return __m_; }
+ _LIBCPP_HIDE_FROM_ABI result_type n() const { return __n_; }
+
+ friend _LIBCPP_HIDE_FROM_ABI bool operator==(const param_type& __x, const param_type& __y) {
+ return __x.__m_ == __y.__m_ && __x.__n_ == __y.__n_;
+ }
+ friend _LIBCPP_HIDE_FROM_ABI bool operator!=(const param_type& __x, const param_type& __y) { return !(__x == __y); }
+ };
private:
- param_type __p_;
+ param_type __p_;
public:
- // constructor and reset functions
+ // constructor and reset functions
#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI
- fisher_f_distribution() : fisher_f_distribution(1) {}
- _LIBCPP_HIDE_FROM_ABI
- explicit fisher_f_distribution(result_type __m, result_type __n = 1)
- : __p_(param_type(__m, __n)) {}
+ _LIBCPP_HIDE_FROM_ABI fisher_f_distribution() : fisher_f_distribution(1) {}
+ _LIBCPP_HIDE_FROM_ABI explicit fisher_f_distribution(result_type __m, result_type __n = 1)
+ : __p_(param_type(__m, __n)) {}
#else
- _LIBCPP_HIDE_FROM_ABI
- explicit fisher_f_distribution(result_type __m = 1, result_type __n = 1)
- : __p_(param_type(__m, __n)) {}
+ _LIBCPP_HIDE_FROM_ABI explicit fisher_f_distribution(result_type __m = 1, result_type __n = 1)
+ : __p_(param_type(__m, __n)) {}
#endif
- _LIBCPP_HIDE_FROM_ABI
- explicit fisher_f_distribution(const param_type& __p)
- : __p_(__p) {}
- _LIBCPP_HIDE_FROM_ABI
- void reset() {}
-
- // generating functions
- template<class _URNG>
- _LIBCPP_HIDE_FROM_ABI
- result_type operator()(_URNG& __g)
- {return (*this)(__g, __p_);}
- template<class _URNG>
- _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g, const param_type& __p);
-
- // property functions
- _LIBCPP_HIDE_FROM_ABI
- result_type m() const {return __p_.m();}
- _LIBCPP_HIDE_FROM_ABI
- result_type n() const {return __p_.n();}
-
- _LIBCPP_HIDE_FROM_ABI
- param_type param() const {return __p_;}
- _LIBCPP_HIDE_FROM_ABI
- void param(const param_type& __p) {__p_ = __p;}
-
- _LIBCPP_HIDE_FROM_ABI
- result_type min() const {return 0;}
- _LIBCPP_HIDE_FROM_ABI
- result_type max() const {return numeric_limits<result_type>::infinity();}
-
- friend _LIBCPP_HIDE_FROM_ABI
- bool operator==(const fisher_f_distribution& __x,
- const fisher_f_distribution& __y)
- {return __x.__p_ == __y.__p_;}
- friend _LIBCPP_HIDE_FROM_ABI
- bool operator!=(const fisher_f_distribution& __x,
- const fisher_f_distribution& __y)
- {return !(__x == __y);}
+ _LIBCPP_HIDE_FROM_ABI explicit fisher_f_distribution(const param_type& __p) : __p_(__p) {}
+ _LIBCPP_HIDE_FROM_ABI void reset() {}
+
+ // generating functions
+ template <class _URNG>
+ _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g) {
+ return (*this)(__g, __p_);
+ }
+ template <class _URNG>
+ _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g, const param_type& __p);
+
+ // property functions
+ _LIBCPP_HIDE_FROM_ABI result_type m() const { return __p_.m(); }
+ _LIBCPP_HIDE_FROM_ABI result_type n() const { return __p_.n(); }
+
+ _LIBCPP_HIDE_FROM_ABI param_type param() const { return __p_; }
+ _LIBCPP_HIDE_FROM_ABI void param(const param_type& __p) { __p_ = __p; }
+
+ _LIBCPP_HIDE_FROM_ABI result_type min() const { return 0; }
+ _LIBCPP_HIDE_FROM_ABI result_type max() const { return numeric_limits<result_type>::infinity(); }
+
+ friend _LIBCPP_HIDE_FROM_ABI bool operator==(const fisher_f_distribution& __x, const fisher_f_distribution& __y) {
+ return __x.__p_ == __y.__p_;
+ }
+ friend _LIBCPP_HIDE_FROM_ABI bool operator!=(const fisher_f_distribution& __x, const fisher_f_distribution& __y) {
+ return !(__x == __y);
+ }
};
template <class _RealType>
-template<class _URNG>
-_RealType
-fisher_f_distribution<_RealType>::operator()(_URNG& __g, const param_type& __p)
-{
- static_assert(__libcpp_random_is_valid_urng<_URNG>::value, "");
- gamma_distribution<result_type> __gdm(__p.m() * result_type(.5));
- gamma_distribution<result_type> __gdn(__p.n() * result_type(.5));
- return __p.n() * __gdm(__g) / (__p.m() * __gdn(__g));
+template <class _URNG>
+_RealType fisher_f_distribution<_RealType>::operator()(_URNG& __g, const param_type& __p) {
+ static_assert(__libcpp_random_is_valid_urng<_URNG>::value, "");
+ gamma_distribution<result_type> __gdm(__p.m() * result_type(.5));
+ gamma_distribution<result_type> __gdn(__p.n() * result_type(.5));
+ return __p.n() * __gdm(__g) / (__p.m() * __gdn(__g));
}
template <class _CharT, class _Traits, class _RT>
_LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>&
-operator<<(basic_ostream<_CharT, _Traits>& __os,
- const fisher_f_distribution<_RT>& __x)
-{
- __save_flags<_CharT, _Traits> __lx(__os);
- typedef basic_ostream<_CharT, _Traits> _OStream;
- __os.flags(_OStream::dec | _OStream::left | _OStream::fixed |
- _OStream::scientific);
- _CharT __sp = __os.widen(' ');
- __os.fill(__sp);
- __os << __x.m() << __sp << __x.n();
- return __os;
+operator<<(basic_ostream<_CharT, _Traits>& __os, const fisher_f_distribution<_RT>& __x) {
+ __save_flags<_CharT, _Traits> __lx(__os);
+ typedef basic_ostream<_CharT, _Traits> _OStream;
+ __os.flags(_OStream::dec | _OStream::left | _OStream::fixed | _OStream::scientific);
+ _CharT __sp = __os.widen(' ');
+ __os.fill(__sp);
+ __os << __x.m() << __sp << __x.n();
+ return __os;
}
template <class _CharT, class _Traits, class _RT>
_LIBCPP_HIDE_FROM_ABI basic_istream<_CharT, _Traits>&
-operator>>(basic_istream<_CharT, _Traits>& __is,
- fisher_f_distribution<_RT>& __x)
-{
- typedef fisher_f_distribution<_RT> _Eng;
- typedef typename _Eng::result_type result_type;
- typedef typename _Eng::param_type param_type;
- __save_flags<_CharT, _Traits> __lx(__is);
- typedef basic_istream<_CharT, _Traits> _Istream;
- __is.flags(_Istream::dec | _Istream::skipws);
- result_type __m;
- result_type __n;
- __is >> __m >> __n;
- if (!__is.fail())
- __x.param(param_type(__m, __n));
- return __is;
+operator>>(basic_istream<_CharT, _Traits>& __is, fisher_f_distribution<_RT>& __x) {
+ typedef fisher_f_distribution<_RT> _Eng;
+ typedef typename _Eng::result_type result_type;
+ typedef typename _Eng::param_type param_type;
+ __save_flags<_CharT, _Traits> __lx(__is);
+ typedef basic_istream<_CharT, _Traits> _Istream;
+ __is.flags(_Istream::dec | _Istream::skipws);
+ result_type __m;
+ result_type __n;
+ __is >> __m >> __n;
+ if (!__is.fail())
+ __x.param(param_type(__m, __n));
+ return __is;
}
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__random/gamma_distribution.h b/contrib/llvm-project/libcxx/include/__random/gamma_distribution.h
index bdf8e141ece7..986e42c1c7f5 100644
--- a/contrib/llvm-project/libcxx/include/__random/gamma_distribution.h
+++ b/contrib/llvm-project/libcxx/include/__random/gamma_distribution.h
@@ -26,190 +26,152 @@ _LIBCPP_PUSH_MACROS
_LIBCPP_BEGIN_NAMESPACE_STD
-template<class _RealType = double>
-class _LIBCPP_TEMPLATE_VIS gamma_distribution
-{
+template <class _RealType = double>
+class _LIBCPP_TEMPLATE_VIS gamma_distribution {
static_assert(__libcpp_random_is_valid_realtype<_RealType>::value,
"RealType must be a supported floating-point type");
public:
- // types
- typedef _RealType result_type;
-
- class _LIBCPP_TEMPLATE_VIS param_type
- {
- result_type __alpha_;
- result_type __beta_;
- public:
- typedef gamma_distribution distribution_type;
-
- _LIBCPP_HIDE_FROM_ABI
- explicit param_type(result_type __alpha = 1, result_type __beta = 1)
- : __alpha_(__alpha), __beta_(__beta) {}
-
- _LIBCPP_HIDE_FROM_ABI
- result_type alpha() const {return __alpha_;}
- _LIBCPP_HIDE_FROM_ABI
- result_type beta() const {return __beta_;}
-
- friend _LIBCPP_HIDE_FROM_ABI
- bool operator==(const param_type& __x, const param_type& __y)
- {return __x.__alpha_ == __y.__alpha_ && __x.__beta_ == __y.__beta_;}
- friend _LIBCPP_HIDE_FROM_ABI
- bool operator!=(const param_type& __x, const param_type& __y)
- {return !(__x == __y);}
- };
+ // types
+ typedef _RealType result_type;
+
+ class _LIBCPP_TEMPLATE_VIS param_type {
+ result_type __alpha_;
+ result_type __beta_;
+
+ public:
+ typedef gamma_distribution distribution_type;
+
+ _LIBCPP_HIDE_FROM_ABI explicit param_type(result_type __alpha = 1, result_type __beta = 1)
+ : __alpha_(__alpha), __beta_(__beta) {}
+
+ _LIBCPP_HIDE_FROM_ABI result_type alpha() const { return __alpha_; }
+ _LIBCPP_HIDE_FROM_ABI result_type beta() const { return __beta_; }
+
+ friend _LIBCPP_HIDE_FROM_ABI bool operator==(const param_type& __x, const param_type& __y) {
+ return __x.__alpha_ == __y.__alpha_ && __x.__beta_ == __y.__beta_;
+ }
+ friend _LIBCPP_HIDE_FROM_ABI bool operator!=(const param_type& __x, const param_type& __y) { return !(__x == __y); }
+ };
private:
- param_type __p_;
+ param_type __p_;
public:
- // constructors and reset functions
+ // constructors and reset functions
#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI
- gamma_distribution() : gamma_distribution(1) {}
- _LIBCPP_HIDE_FROM_ABI
- explicit gamma_distribution(result_type __alpha, result_type __beta = 1)
- : __p_(param_type(__alpha, __beta)) {}
+ _LIBCPP_HIDE_FROM_ABI gamma_distribution() : gamma_distribution(1) {}
+ _LIBCPP_HIDE_FROM_ABI explicit gamma_distribution(result_type __alpha, result_type __beta = 1)
+ : __p_(param_type(__alpha, __beta)) {}
#else
- _LIBCPP_HIDE_FROM_ABI
- explicit gamma_distribution(result_type __alpha = 1,
- result_type __beta = 1)
- : __p_(param_type(__alpha, __beta)) {}
+ _LIBCPP_HIDE_FROM_ABI explicit gamma_distribution(result_type __alpha = 1, result_type __beta = 1)
+ : __p_(param_type(__alpha, __beta)) {}
#endif
- _LIBCPP_HIDE_FROM_ABI
- explicit gamma_distribution(const param_type& __p)
- : __p_(__p) {}
- _LIBCPP_HIDE_FROM_ABI
- void reset() {}
-
- // generating functions
- template<class _URNG>
- _LIBCPP_HIDE_FROM_ABI
- result_type operator()(_URNG& __g)
- {return (*this)(__g, __p_);}
- template<class _URNG>
- _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g, const param_type& __p);
-
- // property functions
- _LIBCPP_HIDE_FROM_ABI
- result_type alpha() const {return __p_.alpha();}
- _LIBCPP_HIDE_FROM_ABI
- result_type beta() const {return __p_.beta();}
-
- _LIBCPP_HIDE_FROM_ABI
- param_type param() const {return __p_;}
- _LIBCPP_HIDE_FROM_ABI
- void param(const param_type& __p) {__p_ = __p;}
-
- _LIBCPP_HIDE_FROM_ABI
- result_type min() const {return 0;}
- _LIBCPP_HIDE_FROM_ABI
- result_type max() const {return numeric_limits<result_type>::infinity();}
-
- friend _LIBCPP_HIDE_FROM_ABI
- bool operator==(const gamma_distribution& __x,
- const gamma_distribution& __y)
- {return __x.__p_ == __y.__p_;}
- friend _LIBCPP_HIDE_FROM_ABI
- bool operator!=(const gamma_distribution& __x,
- const gamma_distribution& __y)
- {return !(__x == __y);}
+ _LIBCPP_HIDE_FROM_ABI explicit gamma_distribution(const param_type& __p) : __p_(__p) {}
+ _LIBCPP_HIDE_FROM_ABI void reset() {}
+
+ // generating functions
+ template <class _URNG>
+ _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g) {
+ return (*this)(__g, __p_);
+ }
+ template <class _URNG>
+ _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g, const param_type& __p);
+
+ // property functions
+ _LIBCPP_HIDE_FROM_ABI result_type alpha() const { return __p_.alpha(); }
+ _LIBCPP_HIDE_FROM_ABI result_type beta() const { return __p_.beta(); }
+
+ _LIBCPP_HIDE_FROM_ABI param_type param() const { return __p_; }
+ _LIBCPP_HIDE_FROM_ABI void param(const param_type& __p) { __p_ = __p; }
+
+ _LIBCPP_HIDE_FROM_ABI result_type min() const { return 0; }
+ _LIBCPP_HIDE_FROM_ABI result_type max() const { return numeric_limits<result_type>::infinity(); }
+
+ friend _LIBCPP_HIDE_FROM_ABI bool operator==(const gamma_distribution& __x, const gamma_distribution& __y) {
+ return __x.__p_ == __y.__p_;
+ }
+ friend _LIBCPP_HIDE_FROM_ABI bool operator!=(const gamma_distribution& __x, const gamma_distribution& __y) {
+ return !(__x == __y);
+ }
};
template <class _RealType>
-template<class _URNG>
-_RealType
-gamma_distribution<_RealType>::operator()(_URNG& __g, const param_type& __p)
-{
- static_assert(__libcpp_random_is_valid_urng<_URNG>::value, "");
- result_type __a = __p.alpha();
- uniform_real_distribution<result_type> __gen(0, 1);
- exponential_distribution<result_type> __egen;
- result_type __x;
- if (__a == 1)
- __x = __egen(__g);
- else if (__a > 1)
- {
- const result_type __b = __a - 1;
- const result_type __c = 3 * __a - result_type(0.75);
- while (true)
- {
- const result_type __u = __gen(__g);
- const result_type __v = __gen(__g);
- const result_type __w = __u * (1 - __u);
- if (__w != 0)
- {
- const result_type __y = std::sqrt(__c / __w) *
- (__u - result_type(0.5));
- __x = __b + __y;
- if (__x >= 0)
- {
- const result_type __z = 64 * __w * __w * __w * __v * __v;
- if (__z <= 1 - 2 * __y * __y / __x)
- break;
- if (std::log(__z) <= 2 * (__b * std::log(__x / __b) - __y))
- break;
- }
- }
+template <class _URNG>
+_RealType gamma_distribution<_RealType>::operator()(_URNG& __g, const param_type& __p) {
+ static_assert(__libcpp_random_is_valid_urng<_URNG>::value, "");
+ result_type __a = __p.alpha();
+ uniform_real_distribution<result_type> __gen(0, 1);
+ exponential_distribution<result_type> __egen;
+ result_type __x;
+ if (__a == 1)
+ __x = __egen(__g);
+ else if (__a > 1) {
+ const result_type __b = __a - 1;
+ const result_type __c = 3 * __a - result_type(0.75);
+ while (true) {
+ const result_type __u = __gen(__g);
+ const result_type __v = __gen(__g);
+ const result_type __w = __u * (1 - __u);
+ if (__w != 0) {
+ const result_type __y = std::sqrt(__c / __w) * (__u - result_type(0.5));
+ __x = __b + __y;
+ if (__x >= 0) {
+ const result_type __z = 64 * __w * __w * __w * __v * __v;
+ if (__z <= 1 - 2 * __y * __y / __x)
+ break;
+ if (std::log(__z) <= 2 * (__b * std::log(__x / __b) - __y))
+ break;
}
+ }
}
- else // __a < 1
- {
- while (true)
- {
- const result_type __u = __gen(__g);
- const result_type __es = __egen(__g);
- if (__u <= 1 - __a)
- {
- __x = std::pow(__u, 1 / __a);
- if (__x <= __es)
- break;
- }
- else
- {
- const result_type __e = -std::log((1-__u)/__a);
- __x = std::pow(1 - __a + __a * __e, 1 / __a);
- if (__x <= __e + __es)
- break;
- }
- }
+ } else // __a < 1
+ {
+ while (true) {
+ const result_type __u = __gen(__g);
+ const result_type __es = __egen(__g);
+ if (__u <= 1 - __a) {
+ __x = std::pow(__u, 1 / __a);
+ if (__x <= __es)
+ break;
+ } else {
+ const result_type __e = -std::log((1 - __u) / __a);
+ __x = std::pow(1 - __a + __a * __e, 1 / __a);
+ if (__x <= __e + __es)
+ break;
+ }
}
- return __x * __p.beta();
+ }
+ return __x * __p.beta();
}
template <class _CharT, class _Traits, class _RT>
_LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>&
-operator<<(basic_ostream<_CharT, _Traits>& __os,
- const gamma_distribution<_RT>& __x)
-{
- __save_flags<_CharT, _Traits> __lx(__os);
- typedef basic_ostream<_CharT, _Traits> _OStream;
- __os.flags(_OStream::dec | _OStream::left | _OStream::fixed |
- _OStream::scientific);
- _CharT __sp = __os.widen(' ');
- __os.fill(__sp);
- __os << __x.alpha() << __sp << __x.beta();
- return __os;
+operator<<(basic_ostream<_CharT, _Traits>& __os, const gamma_distribution<_RT>& __x) {
+ __save_flags<_CharT, _Traits> __lx(__os);
+ typedef basic_ostream<_CharT, _Traits> _OStream;
+ __os.flags(_OStream::dec | _OStream::left | _OStream::fixed | _OStream::scientific);
+ _CharT __sp = __os.widen(' ');
+ __os.fill(__sp);
+ __os << __x.alpha() << __sp << __x.beta();
+ return __os;
}
template <class _CharT, class _Traits, class _RT>
_LIBCPP_HIDE_FROM_ABI basic_istream<_CharT, _Traits>&
-operator>>(basic_istream<_CharT, _Traits>& __is,
- gamma_distribution<_RT>& __x)
-{
- typedef gamma_distribution<_RT> _Eng;
- typedef typename _Eng::result_type result_type;
- typedef typename _Eng::param_type param_type;
- __save_flags<_CharT, _Traits> __lx(__is);
- typedef basic_istream<_CharT, _Traits> _Istream;
- __is.flags(_Istream::dec | _Istream::skipws);
- result_type __alpha;
- result_type __beta;
- __is >> __alpha >> __beta;
- if (!__is.fail())
- __x.param(param_type(__alpha, __beta));
- return __is;
+operator>>(basic_istream<_CharT, _Traits>& __is, gamma_distribution<_RT>& __x) {
+ typedef gamma_distribution<_RT> _Eng;
+ typedef typename _Eng::result_type result_type;
+ typedef typename _Eng::param_type param_type;
+ __save_flags<_CharT, _Traits> __lx(__is);
+ typedef basic_istream<_CharT, _Traits> _Istream;
+ __is.flags(_Istream::dec | _Istream::skipws);
+ result_type __alpha;
+ result_type __beta;
+ __is >> __alpha >> __beta;
+ if (!__is.fail())
+ __x.param(param_type(__alpha, __beta));
+ return __is;
}
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__random/generate_canonical.h b/contrib/llvm-project/libcxx/include/__random/generate_canonical.h
index 5f0aa6fd850b..738de1517e28 100644
--- a/contrib/llvm-project/libcxx/include/__random/generate_canonical.h
+++ b/contrib/llvm-project/libcxx/include/__random/generate_canonical.h
@@ -26,24 +26,22 @@ _LIBCPP_BEGIN_NAMESPACE_STD
// generate_canonical
-template<class _RealType, size_t __bits, class _URNG>
-_LIBCPP_HIDE_FROM_ABI _RealType
-generate_canonical(_URNG& __g)
-{
- const size_t __dt = numeric_limits<_RealType>::digits;
- const size_t __b = __dt < __bits ? __dt : __bits;
+template <class _RealType, size_t __bits, class _URNG>
+_LIBCPP_HIDE_FROM_ABI _RealType generate_canonical(_URNG& __g) {
+ const size_t __dt = numeric_limits<_RealType>::digits;
+ const size_t __b = __dt < __bits ? __dt : __bits;
#ifdef _LIBCPP_CXX03_LANG
- const size_t __log_r = __log2<uint64_t, _URNG::_Max - _URNG::_Min + uint64_t(1)>::value;
+ const size_t __log_r = __log2<uint64_t, _URNG::_Max - _URNG::_Min + uint64_t(1)>::value;
#else
- const size_t __log_r = __log2<uint64_t, _URNG::max() - _URNG::min() + uint64_t(1)>::value;
+ const size_t __log_r = __log2<uint64_t, _URNG::max() - _URNG::min() + uint64_t(1)>::value;
#endif
- const size_t __k = __b / __log_r + (__b % __log_r != 0) + (__b == 0);
- const _RealType __rp = static_cast<_RealType>(_URNG::max() - _URNG::min()) + _RealType(1);
- _RealType __base = __rp;
- _RealType __sp = __g() - _URNG::min();
- for (size_t __i = 1; __i < __k; ++__i, __base *= __rp)
- __sp += (__g() - _URNG::min()) * __base;
- return __sp / __base;
+ const size_t __k = __b / __log_r + (__b % __log_r != 0) + (__b == 0);
+ const _RealType __rp = static_cast<_RealType>(_URNG::max() - _URNG::min()) + _RealType(1);
+ _RealType __base = __rp;
+ _RealType __sp = __g() - _URNG::min();
+ for (size_t __i = 1; __i < __k; ++__i, __base *= __rp)
+ __sp += (__g() - _URNG::min()) * __base;
+ return __sp / __base;
}
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__random/geometric_distribution.h b/contrib/llvm-project/libcxx/include/__random/geometric_distribution.h
index 263193aebed6..cecd7e57cfa6 100644
--- a/contrib/llvm-project/libcxx/include/__random/geometric_distribution.h
+++ b/contrib/llvm-project/libcxx/include/__random/geometric_distribution.h
@@ -24,116 +24,93 @@ _LIBCPP_PUSH_MACROS
_LIBCPP_BEGIN_NAMESPACE_STD
-template<class _IntType = int>
-class _LIBCPP_TEMPLATE_VIS geometric_distribution
-{
- static_assert(__libcpp_random_is_valid_inttype<_IntType>::value, "IntType must be a supported integer type");
+template <class _IntType = int>
+class _LIBCPP_TEMPLATE_VIS geometric_distribution {
+ static_assert(__libcpp_random_is_valid_inttype<_IntType>::value, "IntType must be a supported integer type");
+
public:
- // types
- typedef _IntType result_type;
+ // types
+ typedef _IntType result_type;
+
+ class _LIBCPP_TEMPLATE_VIS param_type {
+ double __p_;
- class _LIBCPP_TEMPLATE_VIS param_type
- {
- double __p_;
- public:
- typedef geometric_distribution distribution_type;
+ public:
+ typedef geometric_distribution distribution_type;
- _LIBCPP_HIDE_FROM_ABI
- explicit param_type(double __p = 0.5) : __p_(__p) {}
+ _LIBCPP_HIDE_FROM_ABI explicit param_type(double __p = 0.5) : __p_(__p) {}
- _LIBCPP_HIDE_FROM_ABI
- double p() const {return __p_;}
+ _LIBCPP_HIDE_FROM_ABI double p() const { return __p_; }
- friend _LIBCPP_HIDE_FROM_ABI
- bool operator==(const param_type& __x, const param_type& __y)
- {return __x.__p_ == __y.__p_;}
- friend _LIBCPP_HIDE_FROM_ABI
- bool operator!=(const param_type& __x, const param_type& __y)
- {return !(__x == __y);}
- };
+ friend _LIBCPP_HIDE_FROM_ABI bool operator==(const param_type& __x, const param_type& __y) {
+ return __x.__p_ == __y.__p_;
+ }
+ friend _LIBCPP_HIDE_FROM_ABI bool operator!=(const param_type& __x, const param_type& __y) { return !(__x == __y); }
+ };
private:
- param_type __p_;
+ param_type __p_;
public:
- // constructors and reset functions
+ // constructors and reset functions
#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI
- geometric_distribution() : geometric_distribution(0.5) {}
- _LIBCPP_HIDE_FROM_ABI
- explicit geometric_distribution(double __p)
- : __p_(__p) {}
+ _LIBCPP_HIDE_FROM_ABI geometric_distribution() : geometric_distribution(0.5) {}
+ _LIBCPP_HIDE_FROM_ABI explicit geometric_distribution(double __p) : __p_(__p) {}
#else
- _LIBCPP_HIDE_FROM_ABI
- explicit geometric_distribution(double __p = 0.5)
- : __p_(__p) {}
+ _LIBCPP_HIDE_FROM_ABI explicit geometric_distribution(double __p = 0.5) : __p_(__p) {}
#endif
- _LIBCPP_HIDE_FROM_ABI
- explicit geometric_distribution(const param_type& __p) : __p_(__p) {}
- _LIBCPP_HIDE_FROM_ABI
- void reset() {}
-
- // generating functions
- template<class _URNG>
- _LIBCPP_HIDE_FROM_ABI
- result_type operator()(_URNG& __g)
- {return (*this)(__g, __p_);}
- template<class _URNG>
- _LIBCPP_HIDE_FROM_ABI
- result_type operator()(_URNG& __g, const param_type& __p)
- {return negative_binomial_distribution<result_type>(1, __p.p())(__g);}
-
- // property functions
- _LIBCPP_HIDE_FROM_ABI
- double p() const {return __p_.p();}
-
- _LIBCPP_HIDE_FROM_ABI
- param_type param() const {return __p_;}
- _LIBCPP_HIDE_FROM_ABI
- void param(const param_type& __p) {__p_ = __p;}
-
- _LIBCPP_HIDE_FROM_ABI
- result_type min() const {return 0;}
- _LIBCPP_HIDE_FROM_ABI
- result_type max() const {return numeric_limits<result_type>::max();}
-
- friend _LIBCPP_HIDE_FROM_ABI
- bool operator==(const geometric_distribution& __x,
- const geometric_distribution& __y)
- {return __x.__p_ == __y.__p_;}
- friend _LIBCPP_HIDE_FROM_ABI
- bool operator!=(const geometric_distribution& __x,
- const geometric_distribution& __y)
- {return !(__x == __y);}
+ _LIBCPP_HIDE_FROM_ABI explicit geometric_distribution(const param_type& __p) : __p_(__p) {}
+ _LIBCPP_HIDE_FROM_ABI void reset() {}
+
+ // generating functions
+ template <class _URNG>
+ _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g) {
+ return (*this)(__g, __p_);
+ }
+ template <class _URNG>
+ _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g, const param_type& __p) {
+ return negative_binomial_distribution<result_type>(1, __p.p())(__g);
+ }
+
+ // property functions
+ _LIBCPP_HIDE_FROM_ABI double p() const { return __p_.p(); }
+
+ _LIBCPP_HIDE_FROM_ABI param_type param() const { return __p_; }
+ _LIBCPP_HIDE_FROM_ABI void param(const param_type& __p) { __p_ = __p; }
+
+ _LIBCPP_HIDE_FROM_ABI result_type min() const { return 0; }
+ _LIBCPP_HIDE_FROM_ABI result_type max() const { return numeric_limits<result_type>::max(); }
+
+ friend _LIBCPP_HIDE_FROM_ABI bool operator==(const geometric_distribution& __x, const geometric_distribution& __y) {
+ return __x.__p_ == __y.__p_;
+ }
+ friend _LIBCPP_HIDE_FROM_ABI bool operator!=(const geometric_distribution& __x, const geometric_distribution& __y) {
+ return !(__x == __y);
+ }
};
template <class _CharT, class _Traits, class _IntType>
_LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>&
-operator<<(basic_ostream<_CharT, _Traits>& __os,
- const geometric_distribution<_IntType>& __x)
-{
- __save_flags<_CharT, _Traits> __lx(__os);
- typedef basic_ostream<_CharT, _Traits> _OStream;
- __os.flags(_OStream::dec | _OStream::left | _OStream::fixed |
- _OStream::scientific);
- return __os << __x.p();
+operator<<(basic_ostream<_CharT, _Traits>& __os, const geometric_distribution<_IntType>& __x) {
+ __save_flags<_CharT, _Traits> __lx(__os);
+ typedef basic_ostream<_CharT, _Traits> _OStream;
+ __os.flags(_OStream::dec | _OStream::left | _OStream::fixed | _OStream::scientific);
+ return __os << __x.p();
}
template <class _CharT, class _Traits, class _IntType>
_LIBCPP_HIDE_FROM_ABI basic_istream<_CharT, _Traits>&
-operator>>(basic_istream<_CharT, _Traits>& __is,
- geometric_distribution<_IntType>& __x)
-{
- typedef geometric_distribution<_IntType> _Eng;
- typedef typename _Eng::param_type param_type;
- __save_flags<_CharT, _Traits> __lx(__is);
- typedef basic_istream<_CharT, _Traits> _Istream;
- __is.flags(_Istream::dec | _Istream::skipws);
- double __p;
- __is >> __p;
- if (!__is.fail())
- __x.param(param_type(__p));
- return __is;
+operator>>(basic_istream<_CharT, _Traits>& __is, geometric_distribution<_IntType>& __x) {
+ typedef geometric_distribution<_IntType> _Eng;
+ typedef typename _Eng::param_type param_type;
+ __save_flags<_CharT, _Traits> __lx(__is);
+ typedef basic_istream<_CharT, _Traits> _Istream;
+ __is.flags(_Istream::dec | _Istream::skipws);
+ double __p;
+ __is >> __p;
+ if (!__is.fail())
+ __x.param(param_type(__p));
+ return __is;
}
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__random/independent_bits_engine.h b/contrib/llvm-project/libcxx/include/__random/independent_bits_engine.h
index b81fa49d3bde..0f4a7b82b98f 100644
--- a/contrib/llvm-project/libcxx/include/__random/independent_bits_engine.h
+++ b/contrib/llvm-project/libcxx/include/__random/independent_bits_engine.h
@@ -30,225 +30,172 @@ _LIBCPP_PUSH_MACROS
_LIBCPP_BEGIN_NAMESPACE_STD
-template<class _Engine, size_t __w, class _UIntType>
-class _LIBCPP_TEMPLATE_VIS independent_bits_engine
-{
- template <class _UInt, _UInt _R0, size_t _Wp, size_t _Mp>
- class __get_n
- {
- static _LIBCPP_CONSTEXPR const size_t _Dt = numeric_limits<_UInt>::digits;
- static _LIBCPP_CONSTEXPR const size_t _Np = _Wp / _Mp + (_Wp % _Mp != 0);
- static _LIBCPP_CONSTEXPR const size_t _W0 = _Wp / _Np;
- static _LIBCPP_CONSTEXPR const _UInt _Y0 = _W0 >= _Dt ? 0 : (_R0 >> _W0) << _W0;
- public:
- static _LIBCPP_CONSTEXPR const size_t value = _R0 - _Y0 > _Y0 / _Np ? _Np + 1 : _Np;
- };
+template <class _Engine, size_t __w, class _UIntType>
+class _LIBCPP_TEMPLATE_VIS independent_bits_engine {
+ template <class _UInt, _UInt _R0, size_t _Wp, size_t _Mp>
+ class __get_n {
+ static _LIBCPP_CONSTEXPR const size_t _Dt = numeric_limits<_UInt>::digits;
+ static _LIBCPP_CONSTEXPR const size_t _Np = _Wp / _Mp + (_Wp % _Mp != 0);
+ static _LIBCPP_CONSTEXPR const size_t _W0 = _Wp / _Np;
+ static _LIBCPP_CONSTEXPR const _UInt _Y0 = _W0 >= _Dt ? 0 : (_R0 >> _W0) << _W0;
+
+ public:
+ static _LIBCPP_CONSTEXPR const size_t value = _R0 - _Y0 > _Y0 / _Np ? _Np + 1 : _Np;
+ };
+
public:
- // types
- typedef _UIntType result_type;
+ // types
+ typedef _UIntType result_type;
private:
- _Engine __e_;
+ _Engine __e_;
- static _LIBCPP_CONSTEXPR const result_type _Dt = numeric_limits<result_type>::digits;
- static_assert( 0 < __w, "independent_bits_engine invalid parameters");
- static_assert(__w <= _Dt, "independent_bits_engine invalid parameters");
+ static _LIBCPP_CONSTEXPR const result_type _Dt = numeric_limits<result_type>::digits;
+ static_assert(0 < __w, "independent_bits_engine invalid parameters");
+ static_assert(__w <= _Dt, "independent_bits_engine invalid parameters");
- typedef typename _Engine::result_type _Engine_result_type;
- typedef __conditional_t<sizeof(_Engine_result_type) <= sizeof(result_type), result_type, _Engine_result_type>
- _Working_result_type;
+ typedef typename _Engine::result_type _Engine_result_type;
+ typedef __conditional_t<sizeof(_Engine_result_type) <= sizeof(result_type), result_type, _Engine_result_type>
+ _Working_result_type;
#ifdef _LIBCPP_CXX03_LANG
- static const _Working_result_type _Rp = _Engine::_Max - _Engine::_Min
- + _Working_result_type(1);
+ static const _Working_result_type _Rp = _Engine::_Max - _Engine::_Min + _Working_result_type(1);
#else
- static _LIBCPP_CONSTEXPR const _Working_result_type _Rp = _Engine::max() - _Engine::min()
- + _Working_result_type(1);
+ static _LIBCPP_CONSTEXPR const _Working_result_type _Rp = _Engine::max() - _Engine::min() + _Working_result_type(1);
#endif
- static _LIBCPP_CONSTEXPR const size_t __m = __log2<_Working_result_type, _Rp>::value;
- static _LIBCPP_CONSTEXPR const size_t __n = __get_n<_Working_result_type, _Rp, __w, __m>::value;
- static _LIBCPP_CONSTEXPR const size_t __w0 = __w / __n;
- static _LIBCPP_CONSTEXPR const size_t __n0 = __n - __w % __n;
- static _LIBCPP_CONSTEXPR const size_t _WDt = numeric_limits<_Working_result_type>::digits;
- static _LIBCPP_CONSTEXPR const size_t _EDt = numeric_limits<_Engine_result_type>::digits;
- static _LIBCPP_CONSTEXPR const _Working_result_type __y0 = __w0 >= _WDt ? 0 :
- (_Rp >> __w0) << __w0;
- static _LIBCPP_CONSTEXPR const _Working_result_type __y1 = __w0 >= _WDt - 1 ? 0 :
- (_Rp >> (__w0+1)) << (__w0+1);
- static _LIBCPP_CONSTEXPR const _Engine_result_type __mask0 = __w0 > 0 ?
- _Engine_result_type(~0) >> (_EDt - __w0) :
- _Engine_result_type(0);
- static _LIBCPP_CONSTEXPR const _Engine_result_type __mask1 = __w0 < _EDt - 1 ?
- _Engine_result_type(~0) >> (_EDt - (__w0 + 1)) :
- _Engine_result_type(~0);
+ static _LIBCPP_CONSTEXPR const size_t __m = __log2<_Working_result_type, _Rp>::value;
+ static _LIBCPP_CONSTEXPR const size_t __n = __get_n<_Working_result_type, _Rp, __w, __m>::value;
+ static _LIBCPP_CONSTEXPR const size_t __w0 = __w / __n;
+ static _LIBCPP_CONSTEXPR const size_t __n0 = __n - __w % __n;
+ static _LIBCPP_CONSTEXPR const size_t _WDt = numeric_limits<_Working_result_type>::digits;
+ static _LIBCPP_CONSTEXPR const size_t _EDt = numeric_limits<_Engine_result_type>::digits;
+ static _LIBCPP_CONSTEXPR const _Working_result_type __y0 = __w0 >= _WDt ? 0 : (_Rp >> __w0) << __w0;
+ static _LIBCPP_CONSTEXPR const _Working_result_type __y1 = __w0 >= _WDt - 1 ? 0 : (_Rp >> (__w0 + 1)) << (__w0 + 1);
+ static _LIBCPP_CONSTEXPR const
+ _Engine_result_type __mask0 = __w0 > 0 ? _Engine_result_type(~0) >> (_EDt - __w0) : _Engine_result_type(0);
+ static _LIBCPP_CONSTEXPR const _Engine_result_type __mask1 =
+ __w0 < _EDt - 1 ? _Engine_result_type(~0) >> (_EDt - (__w0 + 1)) : _Engine_result_type(~0);
+
public:
- static _LIBCPP_CONSTEXPR const result_type _Min = 0;
- static _LIBCPP_CONSTEXPR const result_type _Max = __w == _Dt ? result_type(~0) :
- (result_type(1) << __w) - result_type(1);
- static_assert(_Min < _Max, "independent_bits_engine invalid parameters");
-
- // engine characteristics
- _LIBCPP_HIDE_FROM_ABI
- static _LIBCPP_CONSTEXPR result_type min() { return _Min; }
- _LIBCPP_HIDE_FROM_ABI
- static _LIBCPP_CONSTEXPR result_type max() { return _Max; }
-
- // constructors and seeding functions
- _LIBCPP_HIDE_FROM_ABI
- independent_bits_engine() {}
- _LIBCPP_HIDE_FROM_ABI
- explicit independent_bits_engine(const _Engine& __e)
- : __e_(__e) {}
+ static _LIBCPP_CONSTEXPR const result_type _Min = 0;
+ static _LIBCPP_CONSTEXPR const result_type _Max =
+ __w == _Dt ? result_type(~0) : (result_type(1) << __w) - result_type(1);
+ static_assert(_Min < _Max, "independent_bits_engine invalid parameters");
+
+ // engine characteristics
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR result_type min() { return _Min; }
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR result_type max() { return _Max; }
+
+ // constructors and seeding functions
+ _LIBCPP_HIDE_FROM_ABI independent_bits_engine() {}
+ _LIBCPP_HIDE_FROM_ABI explicit independent_bits_engine(const _Engine& __e) : __e_(__e) {}
#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI
- explicit independent_bits_engine(_Engine&& __e)
- : __e_(std::move(__e)) {}
+ _LIBCPP_HIDE_FROM_ABI explicit independent_bits_engine(_Engine&& __e) : __e_(std::move(__e)) {}
#endif // _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI
- explicit independent_bits_engine(result_type __sd) : __e_(__sd) {}
- template<class _Sseq, __enable_if_t<__is_seed_sequence<_Sseq, independent_bits_engine>::value &&
- !is_convertible<_Sseq, _Engine>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI
- explicit independent_bits_engine(_Sseq& __q)
- : __e_(__q) {}
- _LIBCPP_HIDE_FROM_ABI
- void seed() {__e_.seed();}
- _LIBCPP_HIDE_FROM_ABI
- void seed(result_type __sd) {__e_.seed(__sd);}
- template<class _Sseq, __enable_if_t<__is_seed_sequence<_Sseq, independent_bits_engine>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI
- void
- seed(_Sseq& __q) {__e_.seed(__q);}
-
- // generating functions
- _LIBCPP_HIDE_FROM_ABI
- result_type operator()() {return __eval(integral_constant<bool, _Rp != 0>());}
- _LIBCPP_HIDE_FROM_ABI
- void discard(unsigned long long __z) {for (; __z; --__z) operator()();}
-
- // property functions
- _LIBCPP_HIDE_FROM_ABI
- const _Engine& base() const _NOEXCEPT {return __e_;}
-
- template<class _Eng, size_t _Wp, class _UInt>
- friend
- bool
- operator==(
- const independent_bits_engine<_Eng, _Wp, _UInt>& __x,
- const independent_bits_engine<_Eng, _Wp, _UInt>& __y);
-
- template<class _Eng, size_t _Wp, class _UInt>
- friend
- bool
- operator!=(
- const independent_bits_engine<_Eng, _Wp, _UInt>& __x,
- const independent_bits_engine<_Eng, _Wp, _UInt>& __y);
-
- template <class _CharT, class _Traits,
- class _Eng, size_t _Wp, class _UInt>
- friend
- basic_ostream<_CharT, _Traits>&
- operator<<(basic_ostream<_CharT, _Traits>& __os,
- const independent_bits_engine<_Eng, _Wp, _UInt>& __x);
-
- template <class _CharT, class _Traits,
- class _Eng, size_t _Wp, class _UInt>
- friend
- basic_istream<_CharT, _Traits>&
- operator>>(basic_istream<_CharT, _Traits>& __is,
- independent_bits_engine<_Eng, _Wp, _UInt>& __x);
+ _LIBCPP_HIDE_FROM_ABI explicit independent_bits_engine(result_type __sd) : __e_(__sd) {}
+ template <
+ class _Sseq,
+ __enable_if_t<__is_seed_sequence<_Sseq, independent_bits_engine>::value && !is_convertible<_Sseq, _Engine>::value,
+ int> = 0>
+ _LIBCPP_HIDE_FROM_ABI explicit independent_bits_engine(_Sseq& __q) : __e_(__q) {}
+ _LIBCPP_HIDE_FROM_ABI void seed() { __e_.seed(); }
+ _LIBCPP_HIDE_FROM_ABI void seed(result_type __sd) { __e_.seed(__sd); }
+ template <class _Sseq, __enable_if_t<__is_seed_sequence<_Sseq, independent_bits_engine>::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI void seed(_Sseq& __q) {
+ __e_.seed(__q);
+ }
+
+ // generating functions
+ _LIBCPP_HIDE_FROM_ABI result_type operator()() { return __eval(integral_constant<bool, _Rp != 0>()); }
+ _LIBCPP_HIDE_FROM_ABI void discard(unsigned long long __z) {
+ for (; __z; --__z)
+ operator()();
+ }
+
+ // property functions
+ _LIBCPP_HIDE_FROM_ABI const _Engine& base() const _NOEXCEPT { return __e_; }
+
+ template <class _Eng, size_t _Wp, class _UInt>
+ friend bool operator==(const independent_bits_engine<_Eng, _Wp, _UInt>& __x,
+ const independent_bits_engine<_Eng, _Wp, _UInt>& __y);
+
+ template <class _Eng, size_t _Wp, class _UInt>
+ friend bool operator!=(const independent_bits_engine<_Eng, _Wp, _UInt>& __x,
+ const independent_bits_engine<_Eng, _Wp, _UInt>& __y);
+
+ template <class _CharT, class _Traits, class _Eng, size_t _Wp, class _UInt>
+ friend basic_ostream<_CharT, _Traits>&
+ operator<<(basic_ostream<_CharT, _Traits>& __os, const independent_bits_engine<_Eng, _Wp, _UInt>& __x);
+
+ template <class _CharT, class _Traits, class _Eng, size_t _Wp, class _UInt>
+ friend basic_istream<_CharT, _Traits>&
+ operator>>(basic_istream<_CharT, _Traits>& __is, independent_bits_engine<_Eng, _Wp, _UInt>& __x);
private:
- _LIBCPP_HIDE_FROM_ABI
- result_type __eval(false_type);
- _LIBCPP_HIDE_FROM_ABI result_type __eval(true_type);
-
- template <size_t __count, __enable_if_t<__count < _Dt, int> = 0>
- _LIBCPP_HIDE_FROM_ABI
- static
- result_type
- __lshift(result_type __x) {return __x << __count;}
-
- template <size_t __count, __enable_if_t<(__count >= _Dt), int> = 0>
- _LIBCPP_HIDE_FROM_ABI
- static
- result_type
- __lshift(result_type) {return result_type(0);}
+ _LIBCPP_HIDE_FROM_ABI result_type __eval(false_type);
+ _LIBCPP_HIDE_FROM_ABI result_type __eval(true_type);
+
+ template <size_t __count,
+ __enable_if_t<__count< _Dt, int> = 0> _LIBCPP_HIDE_FROM_ABI static result_type __lshift(result_type __x) {
+ return __x << __count;
+ }
+
+ template <size_t __count, __enable_if_t<(__count >= _Dt), int> = 0>
+ _LIBCPP_HIDE_FROM_ABI static result_type __lshift(result_type) {
+ return result_type(0);
+ }
};
-template<class _Engine, size_t __w, class _UIntType>
-inline
-_UIntType
-independent_bits_engine<_Engine, __w, _UIntType>::__eval(false_type)
-{
- return static_cast<result_type>(__e_() & __mask0);
+template <class _Engine, size_t __w, class _UIntType>
+inline _UIntType independent_bits_engine<_Engine, __w, _UIntType>::__eval(false_type) {
+ return static_cast<result_type>(__e_() & __mask0);
}
-template<class _Engine, size_t __w, class _UIntType>
-_UIntType
-independent_bits_engine<_Engine, __w, _UIntType>::__eval(true_type)
-{
- result_type __sp = 0;
- for (size_t __k = 0; __k < __n0; ++__k)
- {
- _Engine_result_type __u;
- do
- {
- __u = __e_() - _Engine::min();
- } while (__u >= __y0);
- __sp = static_cast<result_type>(__lshift<__w0>(__sp) + (__u & __mask0));
- }
- for (size_t __k = __n0; __k < __n; ++__k)
- {
- _Engine_result_type __u;
- do
- {
- __u = __e_() - _Engine::min();
- } while (__u >= __y1);
- __sp = static_cast<result_type>(__lshift<__w0+1>(__sp) + (__u & __mask1));
- }
- return __sp;
+template <class _Engine, size_t __w, class _UIntType>
+_UIntType independent_bits_engine<_Engine, __w, _UIntType>::__eval(true_type) {
+ result_type __sp = 0;
+ for (size_t __k = 0; __k < __n0; ++__k) {
+ _Engine_result_type __u;
+ do {
+ __u = __e_() - _Engine::min();
+ } while (__u >= __y0);
+ __sp = static_cast<result_type>(__lshift<__w0>(__sp) + (__u & __mask0));
+ }
+ for (size_t __k = __n0; __k < __n; ++__k) {
+ _Engine_result_type __u;
+ do {
+ __u = __e_() - _Engine::min();
+ } while (__u >= __y1);
+ __sp = static_cast<result_type>(__lshift<__w0 + 1>(__sp) + (__u & __mask1));
+ }
+ return __sp;
}
-template<class _Eng, size_t _Wp, class _UInt>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator==(
- const independent_bits_engine<_Eng, _Wp, _UInt>& __x,
- const independent_bits_engine<_Eng, _Wp, _UInt>& __y)
-{
- return __x.base() == __y.base();
+template <class _Eng, size_t _Wp, class _UInt>
+inline _LIBCPP_HIDE_FROM_ABI bool
+operator==(const independent_bits_engine<_Eng, _Wp, _UInt>& __x, const independent_bits_engine<_Eng, _Wp, _UInt>& __y) {
+ return __x.base() == __y.base();
}
-template<class _Eng, size_t _Wp, class _UInt>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator!=(
- const independent_bits_engine<_Eng, _Wp, _UInt>& __x,
- const independent_bits_engine<_Eng, _Wp, _UInt>& __y)
-{
- return !(__x == __y);
+template <class _Eng, size_t _Wp, class _UInt>
+inline _LIBCPP_HIDE_FROM_ABI bool
+operator!=(const independent_bits_engine<_Eng, _Wp, _UInt>& __x, const independent_bits_engine<_Eng, _Wp, _UInt>& __y) {
+ return !(__x == __y);
}
-template <class _CharT, class _Traits,
- class _Eng, size_t _Wp, class _UInt>
+template <class _CharT, class _Traits, class _Eng, size_t _Wp, class _UInt>
_LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>&
-operator<<(basic_ostream<_CharT, _Traits>& __os,
- const independent_bits_engine<_Eng, _Wp, _UInt>& __x)
-{
- return __os << __x.base();
+operator<<(basic_ostream<_CharT, _Traits>& __os, const independent_bits_engine<_Eng, _Wp, _UInt>& __x) {
+ return __os << __x.base();
}
-template <class _CharT, class _Traits,
- class _Eng, size_t _Wp, class _UInt>
+template <class _CharT, class _Traits, class _Eng, size_t _Wp, class _UInt>
_LIBCPP_HIDE_FROM_ABI basic_istream<_CharT, _Traits>&
-operator>>(basic_istream<_CharT, _Traits>& __is,
- independent_bits_engine<_Eng, _Wp, _UInt>& __x)
-{
- _Eng __e;
- __is >> __e;
- if (!__is.fail())
- __x.__e_ = __e;
- return __is;
+operator>>(basic_istream<_CharT, _Traits>& __is, independent_bits_engine<_Eng, _Wp, _UInt>& __x) {
+ _Eng __e;
+ __is >> __e;
+ if (!__is.fail())
+ __x.__e_ = __e;
+ return __is;
}
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__random/is_seed_sequence.h b/contrib/llvm-project/libcxx/include/__random/is_seed_sequence.h
index 06621c3cee0d..c7171cff2eda 100644
--- a/contrib/llvm-project/libcxx/include/__random/is_seed_sequence.h
+++ b/contrib/llvm-project/libcxx/include/__random/is_seed_sequence.h
@@ -21,11 +21,9 @@
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _Sseq, class _Engine>
-struct __is_seed_sequence
-{
- static _LIBCPP_CONSTEXPR const bool value =
- !is_convertible<_Sseq, typename _Engine::result_type>::value &&
- !is_same<__remove_cv_t<_Sseq>, _Engine>::value;
+struct __is_seed_sequence {
+ static _LIBCPP_CONSTEXPR const bool value =
+ !is_convertible<_Sseq, typename _Engine::result_type>::value && !is_same<__remove_cv_t<_Sseq>, _Engine>::value;
};
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__random/is_valid.h b/contrib/llvm-project/libcxx/include/__random/is_valid.h
index bde4733099d6..a3e0f143ae86 100644
--- a/contrib/llvm-project/libcxx/include/__random/is_valid.h
+++ b/contrib/llvm-project/libcxx/include/__random/is_valid.h
@@ -43,22 +43,35 @@ struct __libcpp_random_is_valid_realtype<long double> : true_type {};
// cv-unqualified and is one of short, int, long, long long, unsigned short,
// unsigned int, unsigned long, or unsigned long long.
-template<class> struct __libcpp_random_is_valid_inttype : false_type {};
-template<> struct __libcpp_random_is_valid_inttype<int8_t> : true_type {}; // extension
-template<> struct __libcpp_random_is_valid_inttype<short> : true_type {};
-template<> struct __libcpp_random_is_valid_inttype<int> : true_type {};
-template<> struct __libcpp_random_is_valid_inttype<long> : true_type {};
-template<> struct __libcpp_random_is_valid_inttype<long long> : true_type {};
-template<> struct __libcpp_random_is_valid_inttype<uint8_t> : true_type {}; // extension
-template<> struct __libcpp_random_is_valid_inttype<unsigned short> : true_type {};
-template<> struct __libcpp_random_is_valid_inttype<unsigned int> : true_type {};
-template<> struct __libcpp_random_is_valid_inttype<unsigned long> : true_type {};
-template<> struct __libcpp_random_is_valid_inttype<unsigned long long> : true_type {};
+template <class>
+struct __libcpp_random_is_valid_inttype : false_type {};
+template <>
+struct __libcpp_random_is_valid_inttype<int8_t> : true_type {}; // extension
+template <>
+struct __libcpp_random_is_valid_inttype<short> : true_type {};
+template <>
+struct __libcpp_random_is_valid_inttype<int> : true_type {};
+template <>
+struct __libcpp_random_is_valid_inttype<long> : true_type {};
+template <>
+struct __libcpp_random_is_valid_inttype<long long> : true_type {};
+template <>
+struct __libcpp_random_is_valid_inttype<uint8_t> : true_type {}; // extension
+template <>
+struct __libcpp_random_is_valid_inttype<unsigned short> : true_type {};
+template <>
+struct __libcpp_random_is_valid_inttype<unsigned int> : true_type {};
+template <>
+struct __libcpp_random_is_valid_inttype<unsigned long> : true_type {};
+template <>
+struct __libcpp_random_is_valid_inttype<unsigned long long> : true_type {};
#ifndef _LIBCPP_HAS_NO_INT128
-template<> struct __libcpp_random_is_valid_inttype<__int128_t> : true_type {}; // extension
-template<> struct __libcpp_random_is_valid_inttype<__uint128_t> : true_type {}; // extension
-#endif // _LIBCPP_HAS_NO_INT128
+template <>
+struct __libcpp_random_is_valid_inttype<__int128_t> : true_type {}; // extension
+template <>
+struct __libcpp_random_is_valid_inttype<__uint128_t> : true_type {}; // extension
+#endif // _LIBCPP_HAS_NO_INT128
// [rand.req.urng]/3:
// A class G meets the uniform random bit generator requirements if G models
@@ -68,11 +81,13 @@ template<> struct __libcpp_random_is_valid_inttype<__uint128_t> : true_type {};
// (In particular, reject URNGs with signed result_types; our distributions cannot
// handle such generator types.)
-template<class, class = void> struct __libcpp_random_is_valid_urng : false_type {};
-template<class _Gp> struct __libcpp_random_is_valid_urng<_Gp, __enable_if_t<
- is_unsigned<typename _Gp::result_type>::value &&
- _IsSame<decltype(std::declval<_Gp&>()()), typename _Gp::result_type>::value
-> > : true_type {};
+template <class, class = void>
+struct __libcpp_random_is_valid_urng : false_type {};
+template <class _Gp>
+struct __libcpp_random_is_valid_urng<
+ _Gp,
+ __enable_if_t< is_unsigned<typename _Gp::result_type>::value &&
+ _IsSame<decltype(std::declval<_Gp&>()()), typename _Gp::result_type>::value > > : true_type {};
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__random/linear_congruential_engine.h b/contrib/llvm-project/libcxx/include/__random/linear_congruential_engine.h
index 9a4013ec8550..51f6b248d8f9 100644
--- a/contrib/llvm-project/libcxx/include/__random/linear_congruential_engine.h
+++ b/contrib/llvm-project/libcxx/include/__random/linear_congruential_engine.h
@@ -26,367 +26,298 @@ _LIBCPP_PUSH_MACROS
_LIBCPP_BEGIN_NAMESPACE_STD
-template <unsigned long long __a, unsigned long long __c,
- unsigned long long __m, unsigned long long _Mp,
- bool _MightOverflow = (__a != 0 && __m != 0 && __m-1 > (_Mp-__c)/__a),
- bool _OverflowOK = ((__m | (__m-1)) > __m), // m = 2^n
- bool _SchrageOK = (__a != 0 && __m != 0 && __m % __a <= __m / __a)> // r <= q
-struct __lce_alg_picker
-{
- static_assert(__a != 0 || __m != 0 || !_MightOverflow || _OverflowOK || _SchrageOK,
- "The current values of a, c, and m cannot generate a number "
- "within bounds of linear_congruential_engine.");
-
- static _LIBCPP_CONSTEXPR const bool __use_schrage = _MightOverflow &&
- !_OverflowOK &&
- _SchrageOK;
+template <unsigned long long __a,
+ unsigned long long __c,
+ unsigned long long __m,
+ unsigned long long _Mp,
+ bool _MightOverflow = (__a != 0 && __m != 0 && __m - 1 > (_Mp - __c) / __a),
+ bool _OverflowOK = ((__m | (__m - 1)) > __m), // m = 2^n
+ bool _SchrageOK = (__a != 0 && __m != 0 && __m % __a <= __m / __a)> // r <= q
+struct __lce_alg_picker {
+ static_assert(__a != 0 || __m != 0 || !_MightOverflow || _OverflowOK || _SchrageOK,
+ "The current values of a, c, and m cannot generate a number "
+ "within bounds of linear_congruential_engine.");
+
+ static _LIBCPP_CONSTEXPR const bool __use_schrage = _MightOverflow && !_OverflowOK && _SchrageOK;
};
-template <unsigned long long __a, unsigned long long __c,
- unsigned long long __m, unsigned long long _Mp,
+template <unsigned long long __a,
+ unsigned long long __c,
+ unsigned long long __m,
+ unsigned long long _Mp,
bool _UseSchrage = __lce_alg_picker<__a, __c, __m, _Mp>::__use_schrage>
struct __lce_ta;
// 64
template <unsigned long long __a, unsigned long long __c, unsigned long long __m>
-struct __lce_ta<__a, __c, __m, (unsigned long long)(~0), true>
-{
- typedef unsigned long long result_type;
- _LIBCPP_HIDE_FROM_ABI
- static result_type next(result_type __x)
- {
- // Schrage's algorithm
- const result_type __q = __m / __a;
- const result_type __r = __m % __a;
- const result_type __t0 = __a * (__x % __q);
- const result_type __t1 = __r * (__x / __q);
- __x = __t0 + (__t0 < __t1) * __m - __t1;
- __x += __c - (__x >= __m - __c) * __m;
- return __x;
- }
+struct __lce_ta<__a, __c, __m, (unsigned long long)(~0), true> {
+ typedef unsigned long long result_type;
+ _LIBCPP_HIDE_FROM_ABI static result_type next(result_type __x) {
+ // Schrage's algorithm
+ const result_type __q = __m / __a;
+ const result_type __r = __m % __a;
+ const result_type __t0 = __a * (__x % __q);
+ const result_type __t1 = __r * (__x / __q);
+ __x = __t0 + (__t0 < __t1) * __m - __t1;
+ __x += __c - (__x >= __m - __c) * __m;
+ return __x;
+ }
};
template <unsigned long long __a, unsigned long long __m>
-struct __lce_ta<__a, 0, __m, (unsigned long long)(~0), true>
-{
- typedef unsigned long long result_type;
- _LIBCPP_HIDE_FROM_ABI
- static result_type next(result_type __x)
- {
- // Schrage's algorithm
- const result_type __q = __m / __a;
- const result_type __r = __m % __a;
- const result_type __t0 = __a * (__x % __q);
- const result_type __t1 = __r * (__x / __q);
- __x = __t0 + (__t0 < __t1) * __m - __t1;
- return __x;
- }
+struct __lce_ta<__a, 0, __m, (unsigned long long)(~0), true> {
+ typedef unsigned long long result_type;
+ _LIBCPP_HIDE_FROM_ABI static result_type next(result_type __x) {
+ // Schrage's algorithm
+ const result_type __q = __m / __a;
+ const result_type __r = __m % __a;
+ const result_type __t0 = __a * (__x % __q);
+ const result_type __t1 = __r * (__x / __q);
+ __x = __t0 + (__t0 < __t1) * __m - __t1;
+ return __x;
+ }
};
template <unsigned long long __a, unsigned long long __c, unsigned long long __m>
-struct __lce_ta<__a, __c, __m, (unsigned long long)(~0), false>
-{
- typedef unsigned long long result_type;
- _LIBCPP_HIDE_FROM_ABI
- static result_type next(result_type __x)
- {
- return (__a * __x + __c) % __m;
- }
+struct __lce_ta<__a, __c, __m, (unsigned long long)(~0), false> {
+ typedef unsigned long long result_type;
+ _LIBCPP_HIDE_FROM_ABI static result_type next(result_type __x) { return (__a * __x + __c) % __m; }
};
template <unsigned long long __a, unsigned long long __c>
-struct __lce_ta<__a, __c, 0, (unsigned long long)(~0), false>
-{
- typedef unsigned long long result_type;
- _LIBCPP_HIDE_FROM_ABI
- static result_type next(result_type __x)
- {
- return __a * __x + __c;
- }
+struct __lce_ta<__a, __c, 0, (unsigned long long)(~0), false> {
+ typedef unsigned long long result_type;
+ _LIBCPP_HIDE_FROM_ABI static result_type next(result_type __x) { return __a * __x + __c; }
};
// 32
template <unsigned long long _Ap, unsigned long long _Cp, unsigned long long _Mp>
-struct __lce_ta<_Ap, _Cp, _Mp, unsigned(~0), true>
-{
- typedef unsigned result_type;
- _LIBCPP_HIDE_FROM_ABI
- static result_type next(result_type __x)
- {
- const result_type __a = static_cast<result_type>(_Ap);
- const result_type __c = static_cast<result_type>(_Cp);
- const result_type __m = static_cast<result_type>(_Mp);
- // Schrage's algorithm
- const result_type __q = __m / __a;
- const result_type __r = __m % __a;
- const result_type __t0 = __a * (__x % __q);
- const result_type __t1 = __r * (__x / __q);
- __x = __t0 + (__t0 < __t1) * __m - __t1;
- __x += __c - (__x >= __m - __c) * __m;
- return __x;
- }
+struct __lce_ta<_Ap, _Cp, _Mp, unsigned(~0), true> {
+ typedef unsigned result_type;
+ _LIBCPP_HIDE_FROM_ABI static result_type next(result_type __x) {
+ const result_type __a = static_cast<result_type>(_Ap);
+ const result_type __c = static_cast<result_type>(_Cp);
+ const result_type __m = static_cast<result_type>(_Mp);
+ // Schrage's algorithm
+ const result_type __q = __m / __a;
+ const result_type __r = __m % __a;
+ const result_type __t0 = __a * (__x % __q);
+ const result_type __t1 = __r * (__x / __q);
+ __x = __t0 + (__t0 < __t1) * __m - __t1;
+ __x += __c - (__x >= __m - __c) * __m;
+ return __x;
+ }
};
template <unsigned long long _Ap, unsigned long long _Mp>
-struct __lce_ta<_Ap, 0, _Mp, unsigned(~0), true>
-{
- typedef unsigned result_type;
- _LIBCPP_HIDE_FROM_ABI
- static result_type next(result_type __x)
- {
- const result_type __a = static_cast<result_type>(_Ap);
- const result_type __m = static_cast<result_type>(_Mp);
- // Schrage's algorithm
- const result_type __q = __m / __a;
- const result_type __r = __m % __a;
- const result_type __t0 = __a * (__x % __q);
- const result_type __t1 = __r * (__x / __q);
- __x = __t0 + (__t0 < __t1) * __m - __t1;
- return __x;
- }
+struct __lce_ta<_Ap, 0, _Mp, unsigned(~0), true> {
+ typedef unsigned result_type;
+ _LIBCPP_HIDE_FROM_ABI static result_type next(result_type __x) {
+ const result_type __a = static_cast<result_type>(_Ap);
+ const result_type __m = static_cast<result_type>(_Mp);
+ // Schrage's algorithm
+ const result_type __q = __m / __a;
+ const result_type __r = __m % __a;
+ const result_type __t0 = __a * (__x % __q);
+ const result_type __t1 = __r * (__x / __q);
+ __x = __t0 + (__t0 < __t1) * __m - __t1;
+ return __x;
+ }
};
template <unsigned long long _Ap, unsigned long long _Cp, unsigned long long _Mp>
-struct __lce_ta<_Ap, _Cp, _Mp, unsigned(~0), false>
-{
- typedef unsigned result_type;
- _LIBCPP_HIDE_FROM_ABI
- static result_type next(result_type __x)
- {
- const result_type __a = static_cast<result_type>(_Ap);
- const result_type __c = static_cast<result_type>(_Cp);
- const result_type __m = static_cast<result_type>(_Mp);
- return (__a * __x + __c) % __m;
- }
+struct __lce_ta<_Ap, _Cp, _Mp, unsigned(~0), false> {
+ typedef unsigned result_type;
+ _LIBCPP_HIDE_FROM_ABI static result_type next(result_type __x) {
+ const result_type __a = static_cast<result_type>(_Ap);
+ const result_type __c = static_cast<result_type>(_Cp);
+ const result_type __m = static_cast<result_type>(_Mp);
+ return (__a * __x + __c) % __m;
+ }
};
template <unsigned long long _Ap, unsigned long long _Cp>
-struct __lce_ta<_Ap, _Cp, 0, unsigned(~0), false>
-{
- typedef unsigned result_type;
- _LIBCPP_HIDE_FROM_ABI
- static result_type next(result_type __x)
- {
- const result_type __a = static_cast<result_type>(_Ap);
- const result_type __c = static_cast<result_type>(_Cp);
- return __a * __x + __c;
- }
+struct __lce_ta<_Ap, _Cp, 0, unsigned(~0), false> {
+ typedef unsigned result_type;
+ _LIBCPP_HIDE_FROM_ABI static result_type next(result_type __x) {
+ const result_type __a = static_cast<result_type>(_Ap);
+ const result_type __c = static_cast<result_type>(_Cp);
+ return __a * __x + __c;
+ }
};
// 16
template <unsigned long long __a, unsigned long long __c, unsigned long long __m, bool __b>
-struct __lce_ta<__a, __c, __m, (unsigned short)(~0), __b>
-{
- typedef unsigned short result_type;
- _LIBCPP_HIDE_FROM_ABI
- static result_type next(result_type __x)
- {
- return static_cast<result_type>(__lce_ta<__a, __c, __m, unsigned(~0)>::next(__x));
- }
+struct __lce_ta<__a, __c, __m, (unsigned short)(~0), __b> {
+ typedef unsigned short result_type;
+ _LIBCPP_HIDE_FROM_ABI static result_type next(result_type __x) {
+ return static_cast<result_type>(__lce_ta<__a, __c, __m, unsigned(~0)>::next(__x));
+ }
};
template <class _UIntType, _UIntType __a, _UIntType __c, _UIntType __m>
class _LIBCPP_TEMPLATE_VIS linear_congruential_engine;
-template <class _CharT, class _Traits,
- class _Up, _Up _Ap, _Up _Cp, _Up _Np>
-_LIBCPP_HIDE_FROM_ABI
-basic_ostream<_CharT, _Traits>&
-operator<<(basic_ostream<_CharT, _Traits>& __os,
- const linear_congruential_engine<_Up, _Ap, _Cp, _Np>&);
+template <class _CharT, class _Traits, class _Up, _Up _Ap, _Up _Cp, _Up _Np>
+_LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>&
+operator<<(basic_ostream<_CharT, _Traits>& __os, const linear_congruential_engine<_Up, _Ap, _Cp, _Np>&);
-template <class _CharT, class _Traits,
- class _Up, _Up _Ap, _Up _Cp, _Up _Np>
+template <class _CharT, class _Traits, class _Up, _Up _Ap, _Up _Cp, _Up _Np>
_LIBCPP_HIDE_FROM_ABI basic_istream<_CharT, _Traits>&
-operator>>(basic_istream<_CharT, _Traits>& __is,
- linear_congruential_engine<_Up, _Ap, _Cp, _Np>& __x);
+operator>>(basic_istream<_CharT, _Traits>& __is, linear_congruential_engine<_Up, _Ap, _Cp, _Np>& __x);
template <class _UIntType, _UIntType __a, _UIntType __c, _UIntType __m>
-class _LIBCPP_TEMPLATE_VIS linear_congruential_engine
-{
+class _LIBCPP_TEMPLATE_VIS linear_congruential_engine {
public:
- // types
- typedef _UIntType result_type;
+ // types
+ typedef _UIntType result_type;
private:
- result_type __x_;
+ result_type __x_;
- static _LIBCPP_CONSTEXPR const result_type _Mp = result_type(~0);
+ static _LIBCPP_CONSTEXPR const result_type _Mp = result_type(~0);
+
+ static_assert(__m == 0 || __a < __m, "linear_congruential_engine invalid parameters");
+ static_assert(__m == 0 || __c < __m, "linear_congruential_engine invalid parameters");
+ static_assert(is_unsigned<_UIntType>::value, "_UIntType must be unsigned type");
- static_assert(__m == 0 || __a < __m, "linear_congruential_engine invalid parameters");
- static_assert(__m == 0 || __c < __m, "linear_congruential_engine invalid parameters");
- static_assert(is_unsigned<_UIntType>::value, "_UIntType must be unsigned type");
public:
- static _LIBCPP_CONSTEXPR const result_type _Min = __c == 0u ? 1u : 0u;
- static _LIBCPP_CONSTEXPR const result_type _Max = __m - _UIntType(1u);
- static_assert(_Min < _Max, "linear_congruential_engine invalid parameters");
-
- // engine characteristics
- static _LIBCPP_CONSTEXPR const result_type multiplier = __a;
- static _LIBCPP_CONSTEXPR const result_type increment = __c;
- static _LIBCPP_CONSTEXPR const result_type modulus = __m;
- _LIBCPP_HIDE_FROM_ABI
- static _LIBCPP_CONSTEXPR result_type min() {return _Min;}
- _LIBCPP_HIDE_FROM_ABI
- static _LIBCPP_CONSTEXPR result_type max() {return _Max;}
- static _LIBCPP_CONSTEXPR const result_type default_seed = 1u;
-
- // constructors and seeding functions
+ static _LIBCPP_CONSTEXPR const result_type _Min = __c == 0u ? 1u : 0u;
+ static _LIBCPP_CONSTEXPR const result_type _Max = __m - _UIntType(1u);
+ static_assert(_Min < _Max, "linear_congruential_engine invalid parameters");
+
+ // engine characteristics
+ static _LIBCPP_CONSTEXPR const result_type multiplier = __a;
+ static _LIBCPP_CONSTEXPR const result_type increment = __c;
+ static _LIBCPP_CONSTEXPR const result_type modulus = __m;
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR result_type min() { return _Min; }
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR result_type max() { return _Max; }
+ static _LIBCPP_CONSTEXPR const result_type default_seed = 1u;
+
+ // constructors and seeding functions
#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI
- linear_congruential_engine() : linear_congruential_engine(default_seed) {}
- _LIBCPP_HIDE_FROM_ABI
- explicit linear_congruential_engine(result_type __s) { seed(__s); }
+ _LIBCPP_HIDE_FROM_ABI linear_congruential_engine() : linear_congruential_engine(default_seed) {}
+ _LIBCPP_HIDE_FROM_ABI explicit linear_congruential_engine(result_type __s) { seed(__s); }
#else
- _LIBCPP_HIDE_FROM_ABI
- explicit linear_congruential_engine(result_type __s = default_seed) {
- seed(__s);
- }
+ _LIBCPP_HIDE_FROM_ABI explicit linear_congruential_engine(result_type __s = default_seed) { seed(__s); }
#endif
- template<class _Sseq, __enable_if_t<__is_seed_sequence<_Sseq, linear_congruential_engine>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI
- explicit linear_congruential_engine(_Sseq& __q)
- {seed(__q);}
- _LIBCPP_HIDE_FROM_ABI
- void seed(result_type __s = default_seed)
- {seed(integral_constant<bool, __m == 0>(),
- integral_constant<bool, __c == 0>(), __s);}
- template<class _Sseq, __enable_if_t<__is_seed_sequence<_Sseq, linear_congruential_engine>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI
- void
- seed(_Sseq& __q)
- {__seed(__q, integral_constant<unsigned,
- 1 + (__m == 0 ? (sizeof(result_type) * __CHAR_BIT__ - 1)/32
- : (__m > 0x100000000ull))>());}
-
- // generating functions
- _LIBCPP_HIDE_FROM_ABI
- result_type operator()()
- {return __x_ = static_cast<result_type>(__lce_ta<__a, __c, __m, _Mp>::next(__x_));}
- _LIBCPP_HIDE_FROM_ABI
- void discard(unsigned long long __z) {for (; __z; --__z) operator()();}
-
- friend _LIBCPP_HIDE_FROM_ABI
- bool operator==(const linear_congruential_engine& __x,
- const linear_congruential_engine& __y)
- {return __x.__x_ == __y.__x_;}
- friend _LIBCPP_HIDE_FROM_ABI
- bool operator!=(const linear_congruential_engine& __x,
- const linear_congruential_engine& __y)
- {return !(__x == __y);}
+ template <class _Sseq, __enable_if_t<__is_seed_sequence<_Sseq, linear_congruential_engine>::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI explicit linear_congruential_engine(_Sseq& __q) {
+ seed(__q);
+ }
+ _LIBCPP_HIDE_FROM_ABI void seed(result_type __s = default_seed) {
+ seed(integral_constant<bool, __m == 0>(), integral_constant<bool, __c == 0>(), __s);
+ }
+ template <class _Sseq, __enable_if_t<__is_seed_sequence<_Sseq, linear_congruential_engine>::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI void seed(_Sseq& __q) {
+ __seed(
+ __q,
+ integral_constant<unsigned,
+ 1 + (__m == 0 ? (sizeof(result_type) * __CHAR_BIT__ - 1) / 32 : (__m > 0x100000000ull))>());
+ }
+
+ // generating functions
+ _LIBCPP_HIDE_FROM_ABI result_type operator()() {
+ return __x_ = static_cast<result_type>(__lce_ta<__a, __c, __m, _Mp>::next(__x_));
+ }
+ _LIBCPP_HIDE_FROM_ABI void discard(unsigned long long __z) {
+ for (; __z; --__z)
+ operator()();
+ }
+
+ friend _LIBCPP_HIDE_FROM_ABI bool
+ operator==(const linear_congruential_engine& __x, const linear_congruential_engine& __y) {
+ return __x.__x_ == __y.__x_;
+ }
+ friend _LIBCPP_HIDE_FROM_ABI bool
+ operator!=(const linear_congruential_engine& __x, const linear_congruential_engine& __y) {
+ return !(__x == __y);
+ }
private:
-
- _LIBCPP_HIDE_FROM_ABI
- void seed(true_type, true_type, result_type __s) {__x_ = __s == 0 ? 1 : __s;}
- _LIBCPP_HIDE_FROM_ABI
- void seed(true_type, false_type, result_type __s) {__x_ = __s;}
- _LIBCPP_HIDE_FROM_ABI
- void seed(false_type, true_type, result_type __s) {__x_ = __s % __m == 0 ?
- 1 : __s % __m;}
- _LIBCPP_HIDE_FROM_ABI
- void seed(false_type, false_type, result_type __s) {__x_ = __s % __m;}
-
- template<class _Sseq>
- _LIBCPP_HIDE_FROM_ABI void __seed(_Sseq& __q, integral_constant<unsigned, 1>);
- template<class _Sseq>
- _LIBCPP_HIDE_FROM_ABI void __seed(_Sseq& __q, integral_constant<unsigned, 2>);
-
- template <class _CharT, class _Traits,
- class _Up, _Up _Ap, _Up _Cp, _Up _Np>
- friend
- basic_ostream<_CharT, _Traits>&
- operator<<(basic_ostream<_CharT, _Traits>& __os,
- const linear_congruential_engine<_Up, _Ap, _Cp, _Np>&);
-
- template <class _CharT, class _Traits,
- class _Up, _Up _Ap, _Up _Cp, _Up _Np>
- friend
- basic_istream<_CharT, _Traits>&
- operator>>(basic_istream<_CharT, _Traits>& __is,
- linear_congruential_engine<_Up, _Ap, _Cp, _Np>& __x);
+ _LIBCPP_HIDE_FROM_ABI void seed(true_type, true_type, result_type __s) { __x_ = __s == 0 ? 1 : __s; }
+ _LIBCPP_HIDE_FROM_ABI void seed(true_type, false_type, result_type __s) { __x_ = __s; }
+ _LIBCPP_HIDE_FROM_ABI void seed(false_type, true_type, result_type __s) { __x_ = __s % __m == 0 ? 1 : __s % __m; }
+ _LIBCPP_HIDE_FROM_ABI void seed(false_type, false_type, result_type __s) { __x_ = __s % __m; }
+
+ template <class _Sseq>
+ _LIBCPP_HIDE_FROM_ABI void __seed(_Sseq& __q, integral_constant<unsigned, 1>);
+ template <class _Sseq>
+ _LIBCPP_HIDE_FROM_ABI void __seed(_Sseq& __q, integral_constant<unsigned, 2>);
+
+ template <class _CharT, class _Traits, class _Up, _Up _Ap, _Up _Cp, _Up _Np>
+ friend basic_ostream<_CharT, _Traits>&
+ operator<<(basic_ostream<_CharT, _Traits>& __os, const linear_congruential_engine<_Up, _Ap, _Cp, _Np>&);
+
+ template <class _CharT, class _Traits, class _Up, _Up _Ap, _Up _Cp, _Up _Np>
+ friend basic_istream<_CharT, _Traits>&
+ operator>>(basic_istream<_CharT, _Traits>& __is, linear_congruential_engine<_Up, _Ap, _Cp, _Np>& __x);
};
template <class _UIntType, _UIntType __a, _UIntType __c, _UIntType __m>
- _LIBCPP_CONSTEXPR const typename linear_congruential_engine<_UIntType, __a, __c, __m>::result_type
+_LIBCPP_CONSTEXPR const typename linear_congruential_engine<_UIntType, __a, __c, __m>::result_type
linear_congruential_engine<_UIntType, __a, __c, __m>::multiplier;
template <class _UIntType, _UIntType __a, _UIntType __c, _UIntType __m>
- _LIBCPP_CONSTEXPR const typename linear_congruential_engine<_UIntType, __a, __c, __m>::result_type
+_LIBCPP_CONSTEXPR const typename linear_congruential_engine<_UIntType, __a, __c, __m>::result_type
linear_congruential_engine<_UIntType, __a, __c, __m>::increment;
template <class _UIntType, _UIntType __a, _UIntType __c, _UIntType __m>
- _LIBCPP_CONSTEXPR const typename linear_congruential_engine<_UIntType, __a, __c, __m>::result_type
+_LIBCPP_CONSTEXPR const typename linear_congruential_engine<_UIntType, __a, __c, __m>::result_type
linear_congruential_engine<_UIntType, __a, __c, __m>::modulus;
template <class _UIntType, _UIntType __a, _UIntType __c, _UIntType __m>
- _LIBCPP_CONSTEXPR const typename linear_congruential_engine<_UIntType, __a, __c, __m>::result_type
+_LIBCPP_CONSTEXPR const typename linear_congruential_engine<_UIntType, __a, __c, __m>::result_type
linear_congruential_engine<_UIntType, __a, __c, __m>::default_seed;
template <class _UIntType, _UIntType __a, _UIntType __c, _UIntType __m>
-template<class _Sseq>
-void
-linear_congruential_engine<_UIntType, __a, __c, __m>::__seed(_Sseq& __q,
- integral_constant<unsigned, 1>)
-{
- const unsigned __k = 1;
- uint32_t __ar[__k+3];
- __q.generate(__ar, __ar + __k + 3);
- result_type __s = static_cast<result_type>(__ar[3] % __m);
- __x_ = __c == 0 && __s == 0 ? result_type(1) : __s;
+template <class _Sseq>
+void linear_congruential_engine<_UIntType, __a, __c, __m>::__seed(_Sseq& __q, integral_constant<unsigned, 1>) {
+ const unsigned __k = 1;
+ uint32_t __ar[__k + 3];
+ __q.generate(__ar, __ar + __k + 3);
+ result_type __s = static_cast<result_type>(__ar[3] % __m);
+ __x_ = __c == 0 && __s == 0 ? result_type(1) : __s;
}
template <class _UIntType, _UIntType __a, _UIntType __c, _UIntType __m>
-template<class _Sseq>
-void
-linear_congruential_engine<_UIntType, __a, __c, __m>::__seed(_Sseq& __q,
- integral_constant<unsigned, 2>)
-{
- const unsigned __k = 2;
- uint32_t __ar[__k+3];
- __q.generate(__ar, __ar + __k + 3);
- result_type __s = static_cast<result_type>((__ar[3] +
- ((uint64_t)__ar[4] << 32)) % __m);
- __x_ = __c == 0 && __s == 0 ? result_type(1) : __s;
+template <class _Sseq>
+void linear_congruential_engine<_UIntType, __a, __c, __m>::__seed(_Sseq& __q, integral_constant<unsigned, 2>) {
+ const unsigned __k = 2;
+ uint32_t __ar[__k + 3];
+ __q.generate(__ar, __ar + __k + 3);
+ result_type __s = static_cast<result_type>((__ar[3] + ((uint64_t)__ar[4] << 32)) % __m);
+ __x_ = __c == 0 && __s == 0 ? result_type(1) : __s;
}
-template <class _CharT, class _Traits,
- class _UIntType, _UIntType __a, _UIntType __c, _UIntType __m>
-inline _LIBCPP_HIDE_FROM_ABI
-basic_ostream<_CharT, _Traits>&
-operator<<(basic_ostream<_CharT, _Traits>& __os,
- const linear_congruential_engine<_UIntType, __a, __c, __m>& __x)
-{
- __save_flags<_CharT, _Traits> __lx(__os);
- typedef basic_ostream<_CharT, _Traits> _Ostream;
- __os.flags(_Ostream::dec | _Ostream::left);
- __os.fill(__os.widen(' '));
- return __os << __x.__x_;
+template <class _CharT, class _Traits, class _UIntType, _UIntType __a, _UIntType __c, _UIntType __m>
+inline _LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>&
+operator<<(basic_ostream<_CharT, _Traits>& __os, const linear_congruential_engine<_UIntType, __a, __c, __m>& __x) {
+ __save_flags<_CharT, _Traits> __lx(__os);
+ typedef basic_ostream<_CharT, _Traits> _Ostream;
+ __os.flags(_Ostream::dec | _Ostream::left);
+ __os.fill(__os.widen(' '));
+ return __os << __x.__x_;
}
-template <class _CharT, class _Traits,
- class _UIntType, _UIntType __a, _UIntType __c, _UIntType __m>
+template <class _CharT, class _Traits, class _UIntType, _UIntType __a, _UIntType __c, _UIntType __m>
_LIBCPP_HIDE_FROM_ABI basic_istream<_CharT, _Traits>&
-operator>>(basic_istream<_CharT, _Traits>& __is,
- linear_congruential_engine<_UIntType, __a, __c, __m>& __x)
-{
- __save_flags<_CharT, _Traits> __lx(__is);
- typedef basic_istream<_CharT, _Traits> _Istream;
- __is.flags(_Istream::dec | _Istream::skipws);
- _UIntType __t;
- __is >> __t;
- if (!__is.fail())
- __x.__x_ = __t;
- return __is;
+operator>>(basic_istream<_CharT, _Traits>& __is, linear_congruential_engine<_UIntType, __a, __c, __m>& __x) {
+ __save_flags<_CharT, _Traits> __lx(__is);
+ typedef basic_istream<_CharT, _Traits> _Istream;
+ __is.flags(_Istream::dec | _Istream::skipws);
+ _UIntType __t;
+ __is >> __t;
+ if (!__is.fail())
+ __x.__x_ = __t;
+ return __is;
}
-typedef linear_congruential_engine<uint_fast32_t, 16807, 0, 2147483647>
- minstd_rand0;
-typedef linear_congruential_engine<uint_fast32_t, 48271, 0, 2147483647>
- minstd_rand;
+typedef linear_congruential_engine<uint_fast32_t, 16807, 0, 2147483647> minstd_rand0;
+typedef linear_congruential_engine<uint_fast32_t, 48271, 0, 2147483647> minstd_rand;
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__random/log2.h b/contrib/llvm-project/libcxx/include/__random/log2.h
index 4ccd1ddc9bf2..74b4889c6402 100644
--- a/contrib/llvm-project/libcxx/include/__random/log2.h
+++ b/contrib/llvm-project/libcxx/include/__random/log2.h
@@ -23,47 +23,42 @@ template <class _UIntType, _UIntType _Xp, size_t _Rp>
struct __log2_imp;
template <unsigned long long _Xp, size_t _Rp>
-struct __log2_imp<unsigned long long, _Xp, _Rp>
-{
- static const size_t value = _Xp & ((unsigned long long)(1) << _Rp) ? _Rp
- : __log2_imp<unsigned long long, _Xp, _Rp - 1>::value;
+struct __log2_imp<unsigned long long, _Xp, _Rp> {
+ static const size_t value =
+ _Xp & ((unsigned long long)(1) << _Rp) ? _Rp : __log2_imp<unsigned long long, _Xp, _Rp - 1>::value;
};
template <unsigned long long _Xp>
-struct __log2_imp<unsigned long long, _Xp, 0>
-{
- static const size_t value = 0;
+struct __log2_imp<unsigned long long, _Xp, 0> {
+ static const size_t value = 0;
};
template <size_t _Rp>
-struct __log2_imp<unsigned long long, 0, _Rp>
-{
- static const size_t value = _Rp + 1;
+struct __log2_imp<unsigned long long, 0, _Rp> {
+ static const size_t value = _Rp + 1;
};
#ifndef _LIBCPP_HAS_NO_INT128
template <__uint128_t _Xp, size_t _Rp>
-struct __log2_imp<__uint128_t, _Xp, _Rp>
-{
- static const size_t value = (_Xp >> 64)
- ? (64 + __log2_imp<unsigned long long, (_Xp >> 64), 63>::value)
- : __log2_imp<unsigned long long, _Xp, 63>::value;
+struct __log2_imp<__uint128_t, _Xp, _Rp> {
+ static const size_t value =
+ (_Xp >> 64) ? (64 + __log2_imp<unsigned long long, (_Xp >> 64), 63>::value)
+ : __log2_imp<unsigned long long, _Xp, 63>::value;
};
#endif // _LIBCPP_HAS_NO_INT128
template <class _UIntType, _UIntType _Xp>
-struct __log2
-{
- static const size_t value = __log2_imp<
+struct __log2 {
+ static const size_t value = __log2_imp<
#ifndef _LIBCPP_HAS_NO_INT128
- __conditional_t<sizeof(_UIntType) <= sizeof(unsigned long long), unsigned long long, __uint128_t>,
+ __conditional_t<sizeof(_UIntType) <= sizeof(unsigned long long), unsigned long long, __uint128_t>,
#else
- unsigned long long,
+ unsigned long long,
#endif // _LIBCPP_HAS_NO_INT128
- _Xp,
- sizeof(_UIntType) * __CHAR_BIT__ - 1>::value;
+ _Xp,
+ sizeof(_UIntType) * __CHAR_BIT__ - 1>::value;
};
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__random/lognormal_distribution.h b/contrib/llvm-project/libcxx/include/__random/lognormal_distribution.h
index 47db56ee4529..d8724f8bc5ce 100644
--- a/contrib/llvm-project/libcxx/include/__random/lognormal_distribution.h
+++ b/contrib/llvm-project/libcxx/include/__random/lognormal_distribution.h
@@ -25,137 +25,98 @@ _LIBCPP_PUSH_MACROS
_LIBCPP_BEGIN_NAMESPACE_STD
-template<class _RealType = double>
-class _LIBCPP_TEMPLATE_VIS lognormal_distribution
-{
+template <class _RealType = double>
+class _LIBCPP_TEMPLATE_VIS lognormal_distribution {
static_assert(__libcpp_random_is_valid_realtype<_RealType>::value,
"RealType must be a supported floating-point type");
public:
- // types
- typedef _RealType result_type;
-
- class _LIBCPP_TEMPLATE_VIS param_type
- {
- result_type __m_;
- result_type __s_;
- public:
- typedef lognormal_distribution distribution_type;
-
- _LIBCPP_HIDE_FROM_ABI
- explicit param_type(result_type __m = 0, result_type __s = 1)
- : __m_(__m), __s_(__s) {}
-
- _LIBCPP_HIDE_FROM_ABI
- result_type m() const {return __m_;}
- _LIBCPP_HIDE_FROM_ABI
- result_type s() const {return __s_;}
-
- friend _LIBCPP_HIDE_FROM_ABI
- bool operator==(const param_type& __x, const param_type& __y)
- {return __x.__m_ == __y.__m_ && __x.__s_ == __y.__s_;}
- friend _LIBCPP_HIDE_FROM_ABI
- bool operator!=(const param_type& __x, const param_type& __y)
- {return !(__x == __y);}
- };
+ // types
+ typedef _RealType result_type;
+
+ class _LIBCPP_TEMPLATE_VIS param_type {
+ result_type __m_;
+ result_type __s_;
+
+ public:
+ typedef lognormal_distribution distribution_type;
+
+ _LIBCPP_HIDE_FROM_ABI explicit param_type(result_type __m = 0, result_type __s = 1) : __m_(__m), __s_(__s) {}
+
+ _LIBCPP_HIDE_FROM_ABI result_type m() const { return __m_; }
+ _LIBCPP_HIDE_FROM_ABI result_type s() const { return __s_; }
+
+ friend _LIBCPP_HIDE_FROM_ABI bool operator==(const param_type& __x, const param_type& __y) {
+ return __x.__m_ == __y.__m_ && __x.__s_ == __y.__s_;
+ }
+ friend _LIBCPP_HIDE_FROM_ABI bool operator!=(const param_type& __x, const param_type& __y) { return !(__x == __y); }
+ };
private:
- normal_distribution<result_type> __nd_;
+ normal_distribution<result_type> __nd_;
public:
- // constructor and reset functions
+ // constructor and reset functions
#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI
- lognormal_distribution() : lognormal_distribution(0) {}
- _LIBCPP_HIDE_FROM_ABI
- explicit lognormal_distribution(result_type __m, result_type __s = 1)
- : __nd_(__m, __s) {}
+ _LIBCPP_HIDE_FROM_ABI lognormal_distribution() : lognormal_distribution(0) {}
+ _LIBCPP_HIDE_FROM_ABI explicit lognormal_distribution(result_type __m, result_type __s = 1) : __nd_(__m, __s) {}
#else
- _LIBCPP_HIDE_FROM_ABI
- explicit lognormal_distribution(result_type __m = 0,
- result_type __s = 1)
- : __nd_(__m, __s) {}
+ _LIBCPP_HIDE_FROM_ABI explicit lognormal_distribution(result_type __m = 0, result_type __s = 1) : __nd_(__m, __s) {}
#endif
- _LIBCPP_HIDE_FROM_ABI
- explicit lognormal_distribution(const param_type& __p)
- : __nd_(__p.m(), __p.s()) {}
- _LIBCPP_HIDE_FROM_ABI
- void reset() {__nd_.reset();}
-
- // generating functions
- template<class _URNG>
- _LIBCPP_HIDE_FROM_ABI
- result_type operator()(_URNG& __g)
- {
- return std::exp(__nd_(__g));
- }
-
- template<class _URNG>
- _LIBCPP_HIDE_FROM_ABI
- result_type operator()(_URNG& __g, const param_type& __p)
- {
- typename normal_distribution<result_type>::param_type __pn(__p.m(), __p.s());
- return std::exp(__nd_(__g, __pn));
- }
-
- // property functions
- _LIBCPP_HIDE_FROM_ABI
- result_type m() const {return __nd_.mean();}
- _LIBCPP_HIDE_FROM_ABI
- result_type s() const {return __nd_.stddev();}
-
- _LIBCPP_HIDE_FROM_ABI
- param_type param() const {return param_type(__nd_.mean(), __nd_.stddev());}
- _LIBCPP_HIDE_FROM_ABI
- void param(const param_type& __p)
- {
- typename normal_distribution<result_type>::param_type __pn(__p.m(), __p.s());
- __nd_.param(__pn);
- }
-
- _LIBCPP_HIDE_FROM_ABI
- result_type min() const {return 0;}
- _LIBCPP_HIDE_FROM_ABI
- result_type max() const {return numeric_limits<result_type>::infinity();}
-
- friend _LIBCPP_HIDE_FROM_ABI
- bool operator==(const lognormal_distribution& __x,
- const lognormal_distribution& __y)
- {return __x.__nd_ == __y.__nd_;}
- friend _LIBCPP_HIDE_FROM_ABI
- bool operator!=(const lognormal_distribution& __x,
- const lognormal_distribution& __y)
- {return !(__x == __y);}
-
- template <class _CharT, class _Traits, class _RT>
- friend
- basic_ostream<_CharT, _Traits>&
- operator<<(basic_ostream<_CharT, _Traits>& __os,
- const lognormal_distribution<_RT>& __x);
-
- template <class _CharT, class _Traits, class _RT>
- friend
- basic_istream<_CharT, _Traits>&
- operator>>(basic_istream<_CharT, _Traits>& __is,
- lognormal_distribution<_RT>& __x);
+ _LIBCPP_HIDE_FROM_ABI explicit lognormal_distribution(const param_type& __p) : __nd_(__p.m(), __p.s()) {}
+ _LIBCPP_HIDE_FROM_ABI void reset() { __nd_.reset(); }
+
+ // generating functions
+ template <class _URNG>
+ _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g) {
+ return std::exp(__nd_(__g));
+ }
+
+ template <class _URNG>
+ _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g, const param_type& __p) {
+ typename normal_distribution<result_type>::param_type __pn(__p.m(), __p.s());
+ return std::exp(__nd_(__g, __pn));
+ }
+
+ // property functions
+ _LIBCPP_HIDE_FROM_ABI result_type m() const { return __nd_.mean(); }
+ _LIBCPP_HIDE_FROM_ABI result_type s() const { return __nd_.stddev(); }
+
+ _LIBCPP_HIDE_FROM_ABI param_type param() const { return param_type(__nd_.mean(), __nd_.stddev()); }
+ _LIBCPP_HIDE_FROM_ABI void param(const param_type& __p) {
+ typename normal_distribution<result_type>::param_type __pn(__p.m(), __p.s());
+ __nd_.param(__pn);
+ }
+
+ _LIBCPP_HIDE_FROM_ABI result_type min() const { return 0; }
+ _LIBCPP_HIDE_FROM_ABI result_type max() const { return numeric_limits<result_type>::infinity(); }
+
+ friend _LIBCPP_HIDE_FROM_ABI bool operator==(const lognormal_distribution& __x, const lognormal_distribution& __y) {
+ return __x.__nd_ == __y.__nd_;
+ }
+ friend _LIBCPP_HIDE_FROM_ABI bool operator!=(const lognormal_distribution& __x, const lognormal_distribution& __y) {
+ return !(__x == __y);
+ }
+
+ template <class _CharT, class _Traits, class _RT>
+ friend basic_ostream<_CharT, _Traits>&
+ operator<<(basic_ostream<_CharT, _Traits>& __os, const lognormal_distribution<_RT>& __x);
+
+ template <class _CharT, class _Traits, class _RT>
+ friend basic_istream<_CharT, _Traits>&
+ operator>>(basic_istream<_CharT, _Traits>& __is, lognormal_distribution<_RT>& __x);
};
template <class _CharT, class _Traits, class _RT>
-inline _LIBCPP_HIDE_FROM_ABI
-basic_ostream<_CharT, _Traits>&
-operator<<(basic_ostream<_CharT, _Traits>& __os,
- const lognormal_distribution<_RT>& __x)
-{
- return __os << __x.__nd_;
+inline _LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>&
+operator<<(basic_ostream<_CharT, _Traits>& __os, const lognormal_distribution<_RT>& __x) {
+ return __os << __x.__nd_;
}
template <class _CharT, class _Traits, class _RT>
-inline _LIBCPP_HIDE_FROM_ABI
-basic_istream<_CharT, _Traits>&
-operator>>(basic_istream<_CharT, _Traits>& __is,
- lognormal_distribution<_RT>& __x)
-{
- return __is >> __x.__nd_;
+inline _LIBCPP_HIDE_FROM_ABI basic_istream<_CharT, _Traits>&
+operator>>(basic_istream<_CharT, _Traits>& __is, lognormal_distribution<_RT>& __x) {
+ return __is >> __x.__nd_;
}
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__random/mersenne_twister_engine.h b/contrib/llvm-project/libcxx/include/__random/mersenne_twister_engine.h
index abc5ec255bc6..65280d7c5505 100644
--- a/contrib/llvm-project/libcxx/include/__random/mersenne_twister_engine.h
+++ b/contrib/llvm-project/libcxx/include/__random/mersenne_twister_engine.h
@@ -27,483 +27,885 @@ _LIBCPP_PUSH_MACROS
_LIBCPP_BEGIN_NAMESPACE_STD
-template <class _UIntType, size_t __w, size_t __n, size_t __m, size_t __r,
- _UIntType __a, size_t __u, _UIntType __d, size_t __s,
- _UIntType __b, size_t __t, _UIntType __c, size_t __l, _UIntType __f>
+template <class _UIntType,
+ size_t __w,
+ size_t __n,
+ size_t __m,
+ size_t __r,
+ _UIntType __a,
+ size_t __u,
+ _UIntType __d,
+ size_t __s,
+ _UIntType __b,
+ size_t __t,
+ _UIntType __c,
+ size_t __l,
+ _UIntType __f>
class _LIBCPP_TEMPLATE_VIS mersenne_twister_engine;
-template <class _UInt, size_t _Wp, size_t _Np, size_t _Mp, size_t _Rp,
- _UInt _Ap, size_t _Up, _UInt _Dp, size_t _Sp,
- _UInt _Bp, size_t _Tp, _UInt _Cp, size_t _Lp, _UInt _Fp>
+template <class _UInt,
+ size_t _Wp,
+ size_t _Np,
+ size_t _Mp,
+ size_t _Rp,
+ _UInt _Ap,
+ size_t _Up,
+ _UInt _Dp,
+ size_t _Sp,
+ _UInt _Bp,
+ size_t _Tp,
+ _UInt _Cp,
+ size_t _Lp,
+ _UInt _Fp>
_LIBCPP_HIDE_FROM_ABI bool
-operator==(const mersenne_twister_engine<_UInt, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp,
- _Bp, _Tp, _Cp, _Lp, _Fp>& __x,
- const mersenne_twister_engine<_UInt, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp,
- _Bp, _Tp, _Cp, _Lp, _Fp>& __y);
-
-template <class _UInt, size_t _Wp, size_t _Np, size_t _Mp, size_t _Rp,
- _UInt _Ap, size_t _Up, _UInt _Dp, size_t _Sp,
- _UInt _Bp, size_t _Tp, _UInt _Cp, size_t _Lp, _UInt _Fp>
-_LIBCPP_HIDE_FROM_ABI
-bool
-operator!=(const mersenne_twister_engine<_UInt, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp,
- _Bp, _Tp, _Cp, _Lp, _Fp>& __x,
- const mersenne_twister_engine<_UInt, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp,
- _Bp, _Tp, _Cp, _Lp, _Fp>& __y);
-
-template <class _CharT, class _Traits,
- class _UInt, size_t _Wp, size_t _Np, size_t _Mp, size_t _Rp,
- _UInt _Ap, size_t _Up, _UInt _Dp, size_t _Sp,
- _UInt _Bp, size_t _Tp, _UInt _Cp, size_t _Lp, _UInt _Fp>
+operator==(const mersenne_twister_engine<_UInt, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp, _Bp, _Tp, _Cp, _Lp, _Fp>& __x,
+ const mersenne_twister_engine<_UInt, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp, _Bp, _Tp, _Cp, _Lp, _Fp>& __y);
+
+template <class _UInt,
+ size_t _Wp,
+ size_t _Np,
+ size_t _Mp,
+ size_t _Rp,
+ _UInt _Ap,
+ size_t _Up,
+ _UInt _Dp,
+ size_t _Sp,
+ _UInt _Bp,
+ size_t _Tp,
+ _UInt _Cp,
+ size_t _Lp,
+ _UInt _Fp>
+_LIBCPP_HIDE_FROM_ABI bool
+operator!=(const mersenne_twister_engine<_UInt, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp, _Bp, _Tp, _Cp, _Lp, _Fp>& __x,
+ const mersenne_twister_engine<_UInt, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp, _Bp, _Tp, _Cp, _Lp, _Fp>& __y);
+
+template <class _CharT,
+ class _Traits,
+ class _UInt,
+ size_t _Wp,
+ size_t _Np,
+ size_t _Mp,
+ size_t _Rp,
+ _UInt _Ap,
+ size_t _Up,
+ _UInt _Dp,
+ size_t _Sp,
+ _UInt _Bp,
+ size_t _Tp,
+ _UInt _Cp,
+ size_t _Lp,
+ _UInt _Fp>
_LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>&
operator<<(basic_ostream<_CharT, _Traits>& __os,
- const mersenne_twister_engine<_UInt, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp,
- _Bp, _Tp, _Cp, _Lp, _Fp>& __x);
-
-template <class _CharT, class _Traits,
- class _UInt, size_t _Wp, size_t _Np, size_t _Mp, size_t _Rp,
- _UInt _Ap, size_t _Up, _UInt _Dp, size_t _Sp,
- _UInt _Bp, size_t _Tp, _UInt _Cp, size_t _Lp, _UInt _Fp>
+ const mersenne_twister_engine<_UInt, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp, _Bp, _Tp, _Cp, _Lp, _Fp>& __x);
+
+template <class _CharT,
+ class _Traits,
+ class _UInt,
+ size_t _Wp,
+ size_t _Np,
+ size_t _Mp,
+ size_t _Rp,
+ _UInt _Ap,
+ size_t _Up,
+ _UInt _Dp,
+ size_t _Sp,
+ _UInt _Bp,
+ size_t _Tp,
+ _UInt _Cp,
+ size_t _Lp,
+ _UInt _Fp>
_LIBCPP_HIDE_FROM_ABI basic_istream<_CharT, _Traits>&
operator>>(basic_istream<_CharT, _Traits>& __is,
- mersenne_twister_engine<_UInt, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp,
- _Bp, _Tp, _Cp, _Lp, _Fp>& __x);
-
-template <class _UIntType, size_t __w, size_t __n, size_t __m, size_t __r,
- _UIntType __a, size_t __u, _UIntType __d, size_t __s,
- _UIntType __b, size_t __t, _UIntType __c, size_t __l, _UIntType __f>
-class _LIBCPP_TEMPLATE_VIS mersenne_twister_engine
-{
+ mersenne_twister_engine<_UInt, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp, _Bp, _Tp, _Cp, _Lp, _Fp>& __x);
+
+template <class _UIntType,
+ size_t __w,
+ size_t __n,
+ size_t __m,
+ size_t __r,
+ _UIntType __a,
+ size_t __u,
+ _UIntType __d,
+ size_t __s,
+ _UIntType __b,
+ size_t __t,
+ _UIntType __c,
+ size_t __l,
+ _UIntType __f>
+class _LIBCPP_TEMPLATE_VIS mersenne_twister_engine {
public:
- // types
- typedef _UIntType result_type;
+ // types
+ typedef _UIntType result_type;
private:
- result_type __x_[__n];
- size_t __i_;
-
- static_assert( 0 < __m, "mersenne_twister_engine invalid parameters");
- static_assert(__m <= __n, "mersenne_twister_engine invalid parameters");
- static _LIBCPP_CONSTEXPR const result_type _Dt = numeric_limits<result_type>::digits;
- static_assert(__w <= _Dt, "mersenne_twister_engine invalid parameters");
- static_assert( 2 <= __w, "mersenne_twister_engine invalid parameters");
- static_assert(__r <= __w, "mersenne_twister_engine invalid parameters");
- static_assert(__u <= __w, "mersenne_twister_engine invalid parameters");
- static_assert(__s <= __w, "mersenne_twister_engine invalid parameters");
- static_assert(__t <= __w, "mersenne_twister_engine invalid parameters");
- static_assert(__l <= __w, "mersenne_twister_engine invalid parameters");
+ result_type __x_[__n];
+ size_t __i_;
+
+ static_assert(0 < __m, "mersenne_twister_engine invalid parameters");
+ static_assert(__m <= __n, "mersenne_twister_engine invalid parameters");
+ static _LIBCPP_CONSTEXPR const result_type _Dt = numeric_limits<result_type>::digits;
+ static_assert(__w <= _Dt, "mersenne_twister_engine invalid parameters");
+ static_assert(2 <= __w, "mersenne_twister_engine invalid parameters");
+ static_assert(__r <= __w, "mersenne_twister_engine invalid parameters");
+ static_assert(__u <= __w, "mersenne_twister_engine invalid parameters");
+ static_assert(__s <= __w, "mersenne_twister_engine invalid parameters");
+ static_assert(__t <= __w, "mersenne_twister_engine invalid parameters");
+ static_assert(__l <= __w, "mersenne_twister_engine invalid parameters");
+
public:
- static _LIBCPP_CONSTEXPR const result_type _Min = 0;
- static _LIBCPP_CONSTEXPR const result_type _Max = __w == _Dt ? result_type(~0) :
- (result_type(1) << __w) - result_type(1);
- static_assert(_Min < _Max, "mersenne_twister_engine invalid parameters");
- static_assert(__a <= _Max, "mersenne_twister_engine invalid parameters");
- static_assert(__b <= _Max, "mersenne_twister_engine invalid parameters");
- static_assert(__c <= _Max, "mersenne_twister_engine invalid parameters");
- static_assert(__d <= _Max, "mersenne_twister_engine invalid parameters");
- static_assert(__f <= _Max, "mersenne_twister_engine invalid parameters");
-
- // engine characteristics
- static _LIBCPP_CONSTEXPR const size_t word_size = __w;
- static _LIBCPP_CONSTEXPR const size_t state_size = __n;
- static _LIBCPP_CONSTEXPR const size_t shift_size = __m;
- static _LIBCPP_CONSTEXPR const size_t mask_bits = __r;
- static _LIBCPP_CONSTEXPR const result_type xor_mask = __a;
- static _LIBCPP_CONSTEXPR const size_t tempering_u = __u;
- static _LIBCPP_CONSTEXPR const result_type tempering_d = __d;
- static _LIBCPP_CONSTEXPR const size_t tempering_s = __s;
- static _LIBCPP_CONSTEXPR const result_type tempering_b = __b;
- static _LIBCPP_CONSTEXPR const size_t tempering_t = __t;
- static _LIBCPP_CONSTEXPR const result_type tempering_c = __c;
- static _LIBCPP_CONSTEXPR const size_t tempering_l = __l;
- static _LIBCPP_CONSTEXPR const result_type initialization_multiplier = __f;
- _LIBCPP_HIDE_FROM_ABI
- static _LIBCPP_CONSTEXPR result_type min() { return _Min; }
- _LIBCPP_HIDE_FROM_ABI
- static _LIBCPP_CONSTEXPR result_type max() { return _Max; }
- static _LIBCPP_CONSTEXPR const result_type default_seed = 5489u;
-
- // constructors and seeding functions
+ static _LIBCPP_CONSTEXPR const result_type _Min = 0;
+ static _LIBCPP_CONSTEXPR const result_type _Max =
+ __w == _Dt ? result_type(~0) : (result_type(1) << __w) - result_type(1);
+ static_assert(_Min < _Max, "mersenne_twister_engine invalid parameters");
+ static_assert(__a <= _Max, "mersenne_twister_engine invalid parameters");
+ static_assert(__b <= _Max, "mersenne_twister_engine invalid parameters");
+ static_assert(__c <= _Max, "mersenne_twister_engine invalid parameters");
+ static_assert(__d <= _Max, "mersenne_twister_engine invalid parameters");
+ static_assert(__f <= _Max, "mersenne_twister_engine invalid parameters");
+
+ // engine characteristics
+ static _LIBCPP_CONSTEXPR const size_t word_size = __w;
+ static _LIBCPP_CONSTEXPR const size_t state_size = __n;
+ static _LIBCPP_CONSTEXPR const size_t shift_size = __m;
+ static _LIBCPP_CONSTEXPR const size_t mask_bits = __r;
+ static _LIBCPP_CONSTEXPR const result_type xor_mask = __a;
+ static _LIBCPP_CONSTEXPR const size_t tempering_u = __u;
+ static _LIBCPP_CONSTEXPR const result_type tempering_d = __d;
+ static _LIBCPP_CONSTEXPR const size_t tempering_s = __s;
+ static _LIBCPP_CONSTEXPR const result_type tempering_b = __b;
+ static _LIBCPP_CONSTEXPR const size_t tempering_t = __t;
+ static _LIBCPP_CONSTEXPR const result_type tempering_c = __c;
+ static _LIBCPP_CONSTEXPR const size_t tempering_l = __l;
+ static _LIBCPP_CONSTEXPR const result_type initialization_multiplier = __f;
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR result_type min() { return _Min; }
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR result_type max() { return _Max; }
+ static _LIBCPP_CONSTEXPR const result_type default_seed = 5489u;
+
+ // constructors and seeding functions
#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI
- mersenne_twister_engine() : mersenne_twister_engine(default_seed) {}
- _LIBCPP_HIDE_FROM_ABI
- explicit mersenne_twister_engine(result_type __sd) { seed(__sd); }
+ _LIBCPP_HIDE_FROM_ABI mersenne_twister_engine() : mersenne_twister_engine(default_seed) {}
+ _LIBCPP_HIDE_FROM_ABI explicit mersenne_twister_engine(result_type __sd) { seed(__sd); }
#else
- _LIBCPP_HIDE_FROM_ABI
- explicit mersenne_twister_engine(result_type __sd = default_seed) {
- seed(__sd);
- }
+ _LIBCPP_HIDE_FROM_ABI explicit mersenne_twister_engine(result_type __sd = default_seed) { seed(__sd); }
#endif
- template<class _Sseq, __enable_if_t<__is_seed_sequence<_Sseq, mersenne_twister_engine>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI
- explicit mersenne_twister_engine(_Sseq& __q)
- {seed(__q);}
- _LIBCPP_HIDE_FROM_ABI void seed(result_type __sd = default_seed);
- template<class _Sseq, __enable_if_t<__is_seed_sequence<_Sseq, mersenne_twister_engine>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI
- void
- seed(_Sseq& __q)
- {__seed(__q, integral_constant<unsigned, 1 + (__w - 1) / 32>());}
-
- // generating functions
- _LIBCPP_HIDE_FROM_ABI result_type operator()();
- _LIBCPP_HIDE_FROM_ABI
- void discard(unsigned long long __z) {for (; __z; --__z) operator()();}
-
- template <class _UInt, size_t _Wp, size_t _Np, size_t _Mp, size_t _Rp,
- _UInt _Ap, size_t _Up, _UInt _Dp, size_t _Sp,
- _UInt _Bp, size_t _Tp, _UInt _Cp, size_t _Lp, _UInt _Fp>
- friend
- bool
- operator==(const mersenne_twister_engine<_UInt, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp,
- _Bp, _Tp, _Cp, _Lp, _Fp>& __x,
- const mersenne_twister_engine<_UInt, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp,
- _Bp, _Tp, _Cp, _Lp, _Fp>& __y);
-
- template <class _UInt, size_t _Wp, size_t _Np, size_t _Mp, size_t _Rp,
- _UInt _Ap, size_t _Up, _UInt _Dp, size_t _Sp,
- _UInt _Bp, size_t _Tp, _UInt _Cp, size_t _Lp, _UInt _Fp>
- friend
- bool
- operator!=(const mersenne_twister_engine<_UInt, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp,
- _Bp, _Tp, _Cp, _Lp, _Fp>& __x,
- const mersenne_twister_engine<_UInt, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp,
- _Bp, _Tp, _Cp, _Lp, _Fp>& __y);
-
- template <class _CharT, class _Traits,
- class _UInt, size_t _Wp, size_t _Np, size_t _Mp, size_t _Rp,
- _UInt _Ap, size_t _Up, _UInt _Dp, size_t _Sp,
- _UInt _Bp, size_t _Tp, _UInt _Cp, size_t _Lp, _UInt _Fp>
- friend
- basic_ostream<_CharT, _Traits>&
- operator<<(basic_ostream<_CharT, _Traits>& __os,
- const mersenne_twister_engine<_UInt, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp,
- _Bp, _Tp, _Cp, _Lp, _Fp>& __x);
-
- template <class _CharT, class _Traits,
- class _UInt, size_t _Wp, size_t _Np, size_t _Mp, size_t _Rp,
- _UInt _Ap, size_t _Up, _UInt _Dp, size_t _Sp,
- _UInt _Bp, size_t _Tp, _UInt _Cp, size_t _Lp, _UInt _Fp>
- friend
- basic_istream<_CharT, _Traits>&
- operator>>(basic_istream<_CharT, _Traits>& __is,
- mersenne_twister_engine<_UInt, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp,
- _Bp, _Tp, _Cp, _Lp, _Fp>& __x);
-private:
+ template <class _Sseq, __enable_if_t<__is_seed_sequence<_Sseq, mersenne_twister_engine>::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI explicit mersenne_twister_engine(_Sseq& __q) {
+ seed(__q);
+ }
+ _LIBCPP_HIDE_FROM_ABI void seed(result_type __sd = default_seed);
+ template <class _Sseq, __enable_if_t<__is_seed_sequence<_Sseq, mersenne_twister_engine>::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI void seed(_Sseq& __q) {
+ __seed(__q, integral_constant<unsigned, 1 + (__w - 1) / 32>());
+ }
+
+ // generating functions
+ _LIBCPP_HIDE_FROM_ABI result_type operator()();
+ _LIBCPP_HIDE_FROM_ABI void discard(unsigned long long __z) {
+ for (; __z; --__z)
+ operator()();
+ }
+
+ template <class _UInt,
+ size_t _Wp,
+ size_t _Np,
+ size_t _Mp,
+ size_t _Rp,
+ _UInt _Ap,
+ size_t _Up,
+ _UInt _Dp,
+ size_t _Sp,
+ _UInt _Bp,
+ size_t _Tp,
+ _UInt _Cp,
+ size_t _Lp,
+ _UInt _Fp>
+ friend bool operator==(
+ const mersenne_twister_engine<_UInt, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp, _Bp, _Tp, _Cp, _Lp, _Fp>& __x,
+ const mersenne_twister_engine<_UInt, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp, _Bp, _Tp, _Cp, _Lp, _Fp>& __y);
+
+ template <class _UInt,
+ size_t _Wp,
+ size_t _Np,
+ size_t _Mp,
+ size_t _Rp,
+ _UInt _Ap,
+ size_t _Up,
+ _UInt _Dp,
+ size_t _Sp,
+ _UInt _Bp,
+ size_t _Tp,
+ _UInt _Cp,
+ size_t _Lp,
+ _UInt _Fp>
+ friend bool operator!=(
+ const mersenne_twister_engine<_UInt, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp, _Bp, _Tp, _Cp, _Lp, _Fp>& __x,
+ const mersenne_twister_engine<_UInt, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp, _Bp, _Tp, _Cp, _Lp, _Fp>& __y);
+
+ template <class _CharT,
+ class _Traits,
+ class _UInt,
+ size_t _Wp,
+ size_t _Np,
+ size_t _Mp,
+ size_t _Rp,
+ _UInt _Ap,
+ size_t _Up,
+ _UInt _Dp,
+ size_t _Sp,
+ _UInt _Bp,
+ size_t _Tp,
+ _UInt _Cp,
+ size_t _Lp,
+ _UInt _Fp>
+ friend basic_ostream<_CharT, _Traits>& operator<<(
+ basic_ostream<_CharT, _Traits>& __os,
+ const mersenne_twister_engine<_UInt, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp, _Bp, _Tp, _Cp, _Lp, _Fp>& __x);
+
+ template <class _CharT,
+ class _Traits,
+ class _UInt,
+ size_t _Wp,
+ size_t _Np,
+ size_t _Mp,
+ size_t _Rp,
+ _UInt _Ap,
+ size_t _Up,
+ _UInt _Dp,
+ size_t _Sp,
+ _UInt _Bp,
+ size_t _Tp,
+ _UInt _Cp,
+ size_t _Lp,
+ _UInt _Fp>
+ friend basic_istream<_CharT, _Traits>&
+ operator>>(basic_istream<_CharT, _Traits>& __is,
+ mersenne_twister_engine<_UInt, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp, _Bp, _Tp, _Cp, _Lp, _Fp>& __x);
- template<class _Sseq>
- _LIBCPP_HIDE_FROM_ABI void __seed(_Sseq& __q, integral_constant<unsigned, 1>);
- template<class _Sseq>
- _LIBCPP_HIDE_FROM_ABI void __seed(_Sseq& __q, integral_constant<unsigned, 2>);
-
- template <size_t __count, __enable_if_t<__count < __w, int> = 0>
- _LIBCPP_HIDE_FROM_ABI
- static
- result_type
- __lshift(result_type __x) {return (__x << __count) & _Max;}
-
- template <size_t __count, __enable_if_t<(__count >= __w), int> = 0>
- _LIBCPP_HIDE_FROM_ABI
- static
- result_type
- __lshift(result_type) {return result_type(0);}
-
- template <size_t __count, __enable_if_t<__count < _Dt, int> = 0>
- _LIBCPP_HIDE_FROM_ABI
- static
- result_type
- __rshift(result_type __x) {return __x >> __count;}
-
- template <size_t __count, __enable_if_t<(__count >= _Dt), int> = 0>
- _LIBCPP_HIDE_FROM_ABI
- static
- result_type
- __rshift(result_type) {return result_type(0);}
+private:
+ template <class _Sseq>
+ _LIBCPP_HIDE_FROM_ABI void __seed(_Sseq& __q, integral_constant<unsigned, 1>);
+ template <class _Sseq>
+ _LIBCPP_HIDE_FROM_ABI void __seed(_Sseq& __q, integral_constant<unsigned, 2>);
+
+ template <size_t __count,
+ __enable_if_t<__count< __w, int> = 0> _LIBCPP_HIDE_FROM_ABI static result_type __lshift(result_type __x) {
+ return (__x << __count) & _Max;
+ }
+
+ template <size_t __count, __enable_if_t<(__count >= __w), int> = 0>
+ _LIBCPP_HIDE_FROM_ABI static result_type __lshift(result_type) {
+ return result_type(0);
+ }
+
+ template <size_t __count,
+ __enable_if_t<__count< _Dt, int> = 0> _LIBCPP_HIDE_FROM_ABI static result_type __rshift(result_type __x) {
+ return __x >> __count;
+ }
+
+ template <size_t __count, __enable_if_t<(__count >= _Dt), int> = 0>
+ _LIBCPP_HIDE_FROM_ABI static result_type __rshift(result_type) {
+ return result_type(0);
+ }
};
-template <class _UIntType, size_t __w, size_t __n, size_t __m, size_t __r,
- _UIntType __a, size_t __u, _UIntType __d, size_t __s,
- _UIntType __b, size_t __t, _UIntType __c, size_t __l, _UIntType __f>
- _LIBCPP_CONSTEXPR const size_t
+template <class _UIntType,
+ size_t __w,
+ size_t __n,
+ size_t __m,
+ size_t __r,
+ _UIntType __a,
+ size_t __u,
+ _UIntType __d,
+ size_t __s,
+ _UIntType __b,
+ size_t __t,
+ _UIntType __c,
+ size_t __l,
+ _UIntType __f>
+_LIBCPP_CONSTEXPR const size_t
mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, __s, __b, __t, __c, __l, __f>::word_size;
-template <class _UIntType, size_t __w, size_t __n, size_t __m, size_t __r,
- _UIntType __a, size_t __u, _UIntType __d, size_t __s,
- _UIntType __b, size_t __t, _UIntType __c, size_t __l, _UIntType __f>
- _LIBCPP_CONSTEXPR const size_t
+template <class _UIntType,
+ size_t __w,
+ size_t __n,
+ size_t __m,
+ size_t __r,
+ _UIntType __a,
+ size_t __u,
+ _UIntType __d,
+ size_t __s,
+ _UIntType __b,
+ size_t __t,
+ _UIntType __c,
+ size_t __l,
+ _UIntType __f>
+_LIBCPP_CONSTEXPR const size_t
mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, __s, __b, __t, __c, __l, __f>::state_size;
-template <class _UIntType, size_t __w, size_t __n, size_t __m, size_t __r,
- _UIntType __a, size_t __u, _UIntType __d, size_t __s,
- _UIntType __b, size_t __t, _UIntType __c, size_t __l, _UIntType __f>
- _LIBCPP_CONSTEXPR const size_t
+template <class _UIntType,
+ size_t __w,
+ size_t __n,
+ size_t __m,
+ size_t __r,
+ _UIntType __a,
+ size_t __u,
+ _UIntType __d,
+ size_t __s,
+ _UIntType __b,
+ size_t __t,
+ _UIntType __c,
+ size_t __l,
+ _UIntType __f>
+_LIBCPP_CONSTEXPR const size_t
mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, __s, __b, __t, __c, __l, __f>::shift_size;
-template <class _UIntType, size_t __w, size_t __n, size_t __m, size_t __r,
- _UIntType __a, size_t __u, _UIntType __d, size_t __s,
- _UIntType __b, size_t __t, _UIntType __c, size_t __l, _UIntType __f>
- _LIBCPP_CONSTEXPR const size_t
+template <class _UIntType,
+ size_t __w,
+ size_t __n,
+ size_t __m,
+ size_t __r,
+ _UIntType __a,
+ size_t __u,
+ _UIntType __d,
+ size_t __s,
+ _UIntType __b,
+ size_t __t,
+ _UIntType __c,
+ size_t __l,
+ _UIntType __f>
+_LIBCPP_CONSTEXPR const size_t
mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, __s, __b, __t, __c, __l, __f>::mask_bits;
-template <class _UIntType, size_t __w, size_t __n, size_t __m, size_t __r,
- _UIntType __a, size_t __u, _UIntType __d, size_t __s,
- _UIntType __b, size_t __t, _UIntType __c, size_t __l, _UIntType __f>
- _LIBCPP_CONSTEXPR const typename mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, __s, __b, __t, __c, __l, __f>::result_type
+template <class _UIntType,
+ size_t __w,
+ size_t __n,
+ size_t __m,
+ size_t __r,
+ _UIntType __a,
+ size_t __u,
+ _UIntType __d,
+ size_t __s,
+ _UIntType __b,
+ size_t __t,
+ _UIntType __c,
+ size_t __l,
+ _UIntType __f>
+_LIBCPP_CONSTEXPR const typename mersenne_twister_engine<
+ _UIntType,
+ __w,
+ __n,
+ __m,
+ __r,
+ __a,
+ __u,
+ __d,
+ __s,
+ __b,
+ __t,
+ __c,
+ __l,
+ __f>::result_type
mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, __s, __b, __t, __c, __l, __f>::xor_mask;
-template <class _UIntType, size_t __w, size_t __n, size_t __m, size_t __r,
- _UIntType __a, size_t __u, _UIntType __d, size_t __s,
- _UIntType __b, size_t __t, _UIntType __c, size_t __l, _UIntType __f>
- _LIBCPP_CONSTEXPR const size_t
+template <class _UIntType,
+ size_t __w,
+ size_t __n,
+ size_t __m,
+ size_t __r,
+ _UIntType __a,
+ size_t __u,
+ _UIntType __d,
+ size_t __s,
+ _UIntType __b,
+ size_t __t,
+ _UIntType __c,
+ size_t __l,
+ _UIntType __f>
+_LIBCPP_CONSTEXPR const size_t
mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, __s, __b, __t, __c, __l, __f>::tempering_u;
-template <class _UIntType, size_t __w, size_t __n, size_t __m, size_t __r,
- _UIntType __a, size_t __u, _UIntType __d, size_t __s,
- _UIntType __b, size_t __t, _UIntType __c, size_t __l, _UIntType __f>
- _LIBCPP_CONSTEXPR const typename mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, __s, __b, __t, __c, __l, __f>::result_type
+template <class _UIntType,
+ size_t __w,
+ size_t __n,
+ size_t __m,
+ size_t __r,
+ _UIntType __a,
+ size_t __u,
+ _UIntType __d,
+ size_t __s,
+ _UIntType __b,
+ size_t __t,
+ _UIntType __c,
+ size_t __l,
+ _UIntType __f>
+_LIBCPP_CONSTEXPR const typename mersenne_twister_engine<
+ _UIntType,
+ __w,
+ __n,
+ __m,
+ __r,
+ __a,
+ __u,
+ __d,
+ __s,
+ __b,
+ __t,
+ __c,
+ __l,
+ __f>::result_type
mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, __s, __b, __t, __c, __l, __f>::tempering_d;
-template <class _UIntType, size_t __w, size_t __n, size_t __m, size_t __r,
- _UIntType __a, size_t __u, _UIntType __d, size_t __s,
- _UIntType __b, size_t __t, _UIntType __c, size_t __l, _UIntType __f>
- _LIBCPP_CONSTEXPR const size_t
+template <class _UIntType,
+ size_t __w,
+ size_t __n,
+ size_t __m,
+ size_t __r,
+ _UIntType __a,
+ size_t __u,
+ _UIntType __d,
+ size_t __s,
+ _UIntType __b,
+ size_t __t,
+ _UIntType __c,
+ size_t __l,
+ _UIntType __f>
+_LIBCPP_CONSTEXPR const size_t
mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, __s, __b, __t, __c, __l, __f>::tempering_s;
-template <class _UIntType, size_t __w, size_t __n, size_t __m, size_t __r,
- _UIntType __a, size_t __u, _UIntType __d, size_t __s,
- _UIntType __b, size_t __t, _UIntType __c, size_t __l, _UIntType __f>
- _LIBCPP_CONSTEXPR const typename mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, __s, __b, __t, __c, __l, __f>::result_type
+template <class _UIntType,
+ size_t __w,
+ size_t __n,
+ size_t __m,
+ size_t __r,
+ _UIntType __a,
+ size_t __u,
+ _UIntType __d,
+ size_t __s,
+ _UIntType __b,
+ size_t __t,
+ _UIntType __c,
+ size_t __l,
+ _UIntType __f>
+_LIBCPP_CONSTEXPR const typename mersenne_twister_engine<
+ _UIntType,
+ __w,
+ __n,
+ __m,
+ __r,
+ __a,
+ __u,
+ __d,
+ __s,
+ __b,
+ __t,
+ __c,
+ __l,
+ __f>::result_type
mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, __s, __b, __t, __c, __l, __f>::tempering_b;
-template <class _UIntType, size_t __w, size_t __n, size_t __m, size_t __r,
- _UIntType __a, size_t __u, _UIntType __d, size_t __s,
- _UIntType __b, size_t __t, _UIntType __c, size_t __l, _UIntType __f>
- _LIBCPP_CONSTEXPR const size_t
+template <class _UIntType,
+ size_t __w,
+ size_t __n,
+ size_t __m,
+ size_t __r,
+ _UIntType __a,
+ size_t __u,
+ _UIntType __d,
+ size_t __s,
+ _UIntType __b,
+ size_t __t,
+ _UIntType __c,
+ size_t __l,
+ _UIntType __f>
+_LIBCPP_CONSTEXPR const size_t
mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, __s, __b, __t, __c, __l, __f>::tempering_t;
-template <class _UIntType, size_t __w, size_t __n, size_t __m, size_t __r,
- _UIntType __a, size_t __u, _UIntType __d, size_t __s,
- _UIntType __b, size_t __t, _UIntType __c, size_t __l, _UIntType __f>
- _LIBCPP_CONSTEXPR const typename mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, __s, __b, __t, __c, __l, __f>::result_type
+template <class _UIntType,
+ size_t __w,
+ size_t __n,
+ size_t __m,
+ size_t __r,
+ _UIntType __a,
+ size_t __u,
+ _UIntType __d,
+ size_t __s,
+ _UIntType __b,
+ size_t __t,
+ _UIntType __c,
+ size_t __l,
+ _UIntType __f>
+_LIBCPP_CONSTEXPR const typename mersenne_twister_engine<
+ _UIntType,
+ __w,
+ __n,
+ __m,
+ __r,
+ __a,
+ __u,
+ __d,
+ __s,
+ __b,
+ __t,
+ __c,
+ __l,
+ __f>::result_type
mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, __s, __b, __t, __c, __l, __f>::tempering_c;
-template <class _UIntType, size_t __w, size_t __n, size_t __m, size_t __r,
- _UIntType __a, size_t __u, _UIntType __d, size_t __s,
- _UIntType __b, size_t __t, _UIntType __c, size_t __l, _UIntType __f>
- _LIBCPP_CONSTEXPR const size_t
+template <class _UIntType,
+ size_t __w,
+ size_t __n,
+ size_t __m,
+ size_t __r,
+ _UIntType __a,
+ size_t __u,
+ _UIntType __d,
+ size_t __s,
+ _UIntType __b,
+ size_t __t,
+ _UIntType __c,
+ size_t __l,
+ _UIntType __f>
+_LIBCPP_CONSTEXPR const size_t
mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, __s, __b, __t, __c, __l, __f>::tempering_l;
-template <class _UIntType, size_t __w, size_t __n, size_t __m, size_t __r,
- _UIntType __a, size_t __u, _UIntType __d, size_t __s,
- _UIntType __b, size_t __t, _UIntType __c, size_t __l, _UIntType __f>
- _LIBCPP_CONSTEXPR const typename mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, __s, __b, __t, __c, __l, __f>::result_type
- mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, __s, __b, __t, __c, __l, __f>::initialization_multiplier;
-
-template <class _UIntType, size_t __w, size_t __n, size_t __m, size_t __r,
- _UIntType __a, size_t __u, _UIntType __d, size_t __s,
- _UIntType __b, size_t __t, _UIntType __c, size_t __l, _UIntType __f>
- _LIBCPP_CONSTEXPR const typename mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, __s, __b, __t, __c, __l, __f>::result_type
+template <class _UIntType,
+ size_t __w,
+ size_t __n,
+ size_t __m,
+ size_t __r,
+ _UIntType __a,
+ size_t __u,
+ _UIntType __d,
+ size_t __s,
+ _UIntType __b,
+ size_t __t,
+ _UIntType __c,
+ size_t __l,
+ _UIntType __f>
+_LIBCPP_CONSTEXPR const typename mersenne_twister_engine<
+ _UIntType,
+ __w,
+ __n,
+ __m,
+ __r,
+ __a,
+ __u,
+ __d,
+ __s,
+ __b,
+ __t,
+ __c,
+ __l,
+ __f>::result_type
+ mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, __s, __b, __t, __c, __l, __f>::
+ initialization_multiplier;
+
+template <class _UIntType,
+ size_t __w,
+ size_t __n,
+ size_t __m,
+ size_t __r,
+ _UIntType __a,
+ size_t __u,
+ _UIntType __d,
+ size_t __s,
+ _UIntType __b,
+ size_t __t,
+ _UIntType __c,
+ size_t __l,
+ _UIntType __f>
+_LIBCPP_CONSTEXPR const typename mersenne_twister_engine<
+ _UIntType,
+ __w,
+ __n,
+ __m,
+ __r,
+ __a,
+ __u,
+ __d,
+ __s,
+ __b,
+ __t,
+ __c,
+ __l,
+ __f>::result_type
mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, __s, __b, __t, __c, __l, __f>::default_seed;
-template <class _UIntType, size_t __w, size_t __n, size_t __m, size_t __r,
- _UIntType __a, size_t __u, _UIntType __d, size_t __s,
- _UIntType __b, size_t __t, _UIntType __c, size_t __l, _UIntType __f>
-void
-mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, __s, __b,
- __t, __c, __l, __f>::seed(result_type __sd)
- _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK
-{ // __w >= 2
- __x_[0] = __sd & _Max;
- for (size_t __i = 1; __i < __n; ++__i)
- __x_[__i] = (__f * (__x_[__i-1] ^ __rshift<__w - 2>(__x_[__i-1])) + __i) & _Max;
- __i_ = 0;
+template <class _UIntType,
+ size_t __w,
+ size_t __n,
+ size_t __m,
+ size_t __r,
+ _UIntType __a,
+ size_t __u,
+ _UIntType __d,
+ size_t __s,
+ _UIntType __b,
+ size_t __t,
+ _UIntType __c,
+ size_t __l,
+ _UIntType __f>
+void mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, __s, __b, __t, __c, __l, __f>::seed(
+ result_type __sd) _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK { // __w >= 2
+ __x_[0] = __sd & _Max;
+ for (size_t __i = 1; __i < __n; ++__i)
+ __x_[__i] = (__f * (__x_[__i - 1] ^ __rshift<__w - 2>(__x_[__i - 1])) + __i) & _Max;
+ __i_ = 0;
}
-template <class _UIntType, size_t __w, size_t __n, size_t __m, size_t __r,
- _UIntType __a, size_t __u, _UIntType __d, size_t __s,
- _UIntType __b, size_t __t, _UIntType __c, size_t __l, _UIntType __f>
-template<class _Sseq>
-void
-mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, __s, __b,
- __t, __c, __l, __f>::__seed(_Sseq& __q, integral_constant<unsigned, 1>)
-{
- const unsigned __k = 1;
- uint32_t __ar[__n * __k];
- __q.generate(__ar, __ar + __n * __k);
- for (size_t __i = 0; __i < __n; ++__i)
- __x_[__i] = static_cast<result_type>(__ar[__i] & _Max);
- const result_type __mask = __r == _Dt ? result_type(~0) :
- (result_type(1) << __r) - result_type(1);
- __i_ = 0;
- if ((__x_[0] & ~__mask) == 0)
- {
- for (size_t __i = 1; __i < __n; ++__i)
- if (__x_[__i] != 0)
- return;
- __x_[0] = result_type(1) << (__w - 1);
- }
+template <class _UIntType,
+ size_t __w,
+ size_t __n,
+ size_t __m,
+ size_t __r,
+ _UIntType __a,
+ size_t __u,
+ _UIntType __d,
+ size_t __s,
+ _UIntType __b,
+ size_t __t,
+ _UIntType __c,
+ size_t __l,
+ _UIntType __f>
+template <class _Sseq>
+void mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, __s, __b, __t, __c, __l, __f>::__seed(
+ _Sseq& __q, integral_constant<unsigned, 1>) {
+ const unsigned __k = 1;
+ uint32_t __ar[__n * __k];
+ __q.generate(__ar, __ar + __n * __k);
+ for (size_t __i = 0; __i < __n; ++__i)
+ __x_[__i] = static_cast<result_type>(__ar[__i] & _Max);
+ const result_type __mask = __r == _Dt ? result_type(~0) : (result_type(1) << __r) - result_type(1);
+ __i_ = 0;
+ if ((__x_[0] & ~__mask) == 0) {
+ for (size_t __i = 1; __i < __n; ++__i)
+ if (__x_[__i] != 0)
+ return;
+ __x_[0] = result_type(1) << (__w - 1);
+ }
}
-template <class _UIntType, size_t __w, size_t __n, size_t __m, size_t __r,
- _UIntType __a, size_t __u, _UIntType __d, size_t __s,
- _UIntType __b, size_t __t, _UIntType __c, size_t __l, _UIntType __f>
-template<class _Sseq>
-void
-mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, __s, __b,
- __t, __c, __l, __f>::__seed(_Sseq& __q, integral_constant<unsigned, 2>)
-{
- const unsigned __k = 2;
- uint32_t __ar[__n * __k];
- __q.generate(__ar, __ar + __n * __k);
- for (size_t __i = 0; __i < __n; ++__i)
- __x_[__i] = static_cast<result_type>(
- (__ar[2 * __i] + ((uint64_t)__ar[2 * __i + 1] << 32)) & _Max);
- const result_type __mask = __r == _Dt ? result_type(~0) :
- (result_type(1) << __r) - result_type(1);
- __i_ = 0;
- if ((__x_[0] & ~__mask) == 0)
- {
- for (size_t __i = 1; __i < __n; ++__i)
- if (__x_[__i] != 0)
- return;
- __x_[0] = result_type(1) << (__w - 1);
- }
+template <class _UIntType,
+ size_t __w,
+ size_t __n,
+ size_t __m,
+ size_t __r,
+ _UIntType __a,
+ size_t __u,
+ _UIntType __d,
+ size_t __s,
+ _UIntType __b,
+ size_t __t,
+ _UIntType __c,
+ size_t __l,
+ _UIntType __f>
+template <class _Sseq>
+void mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, __s, __b, __t, __c, __l, __f>::__seed(
+ _Sseq& __q, integral_constant<unsigned, 2>) {
+ const unsigned __k = 2;
+ uint32_t __ar[__n * __k];
+ __q.generate(__ar, __ar + __n * __k);
+ for (size_t __i = 0; __i < __n; ++__i)
+ __x_[__i] = static_cast<result_type>((__ar[2 * __i] + ((uint64_t)__ar[2 * __i + 1] << 32)) & _Max);
+ const result_type __mask = __r == _Dt ? result_type(~0) : (result_type(1) << __r) - result_type(1);
+ __i_ = 0;
+ if ((__x_[0] & ~__mask) == 0) {
+ for (size_t __i = 1; __i < __n; ++__i)
+ if (__x_[__i] != 0)
+ return;
+ __x_[0] = result_type(1) << (__w - 1);
+ }
}
-template <class _UIntType, size_t __w, size_t __n, size_t __m, size_t __r,
- _UIntType __a, size_t __u, _UIntType __d, size_t __s,
- _UIntType __b, size_t __t, _UIntType __c, size_t __l, _UIntType __f>
+template <class _UIntType,
+ size_t __w,
+ size_t __n,
+ size_t __m,
+ size_t __r,
+ _UIntType __a,
+ size_t __u,
+ _UIntType __d,
+ size_t __s,
+ _UIntType __b,
+ size_t __t,
+ _UIntType __c,
+ size_t __l,
+ _UIntType __f>
_UIntType
-mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, __s, __b,
- __t, __c, __l, __f>::operator()()
-{
- const size_t __j = (__i_ + 1) % __n;
- const result_type __mask = __r == _Dt ? result_type(~0) :
- (result_type(1) << __r) - result_type(1);
- const result_type __yp = (__x_[__i_] & ~__mask) | (__x_[__j] & __mask);
- const size_t __k = (__i_ + __m) % __n;
- __x_[__i_] = __x_[__k] ^ __rshift<1>(__yp) ^ (__a * (__yp & 1));
- result_type __z = __x_[__i_] ^ (__rshift<__u>(__x_[__i_]) & __d);
- __i_ = __j;
- __z ^= __lshift<__s>(__z) & __b;
- __z ^= __lshift<__t>(__z) & __c;
- return __z ^ __rshift<__l>(__z);
+mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, __s, __b, __t, __c, __l, __f>::operator()() {
+ const size_t __j = (__i_ + 1) % __n;
+ const result_type __mask = __r == _Dt ? result_type(~0) : (result_type(1) << __r) - result_type(1);
+ const result_type __yp = (__x_[__i_] & ~__mask) | (__x_[__j] & __mask);
+ const size_t __k = (__i_ + __m) % __n;
+ __x_[__i_] = __x_[__k] ^ __rshift<1>(__yp) ^ (__a * (__yp & 1));
+ result_type __z = __x_[__i_] ^ (__rshift<__u>(__x_[__i_]) & __d);
+ __i_ = __j;
+ __z ^= __lshift<__s>(__z) & __b;
+ __z ^= __lshift<__t>(__z) & __c;
+ return __z ^ __rshift<__l>(__z);
}
-template <class _UInt, size_t _Wp, size_t _Np, size_t _Mp, size_t _Rp,
- _UInt _Ap, size_t _Up, _UInt _Dp, size_t _Sp,
- _UInt _Bp, size_t _Tp, _UInt _Cp, size_t _Lp, _UInt _Fp>
+template <class _UInt,
+ size_t _Wp,
+ size_t _Np,
+ size_t _Mp,
+ size_t _Rp,
+ _UInt _Ap,
+ size_t _Up,
+ _UInt _Dp,
+ size_t _Sp,
+ _UInt _Bp,
+ size_t _Tp,
+ _UInt _Cp,
+ size_t _Lp,
+ _UInt _Fp>
_LIBCPP_HIDE_FROM_ABI bool
-operator==(const mersenne_twister_engine<_UInt, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp,
- _Bp, _Tp, _Cp, _Lp, _Fp>& __x,
- const mersenne_twister_engine<_UInt, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp,
- _Bp, _Tp, _Cp, _Lp, _Fp>& __y)
-{
- if (__x.__i_ == __y.__i_)
- return std::equal(__x.__x_, __x.__x_ + _Np, __y.__x_);
- if (__x.__i_ == 0 || __y.__i_ == 0)
- {
- size_t __j = std::min(_Np - __x.__i_, _Np - __y.__i_);
- if (!std::equal(__x.__x_ + __x.__i_, __x.__x_ + __x.__i_ + __j,
- __y.__x_ + __y.__i_))
- return false;
- if (__x.__i_ == 0)
- return std::equal(__x.__x_ + __j, __x.__x_ + _Np, __y.__x_);
- return std::equal(__x.__x_, __x.__x_ + (_Np - __j), __y.__x_ + __j);
- }
- if (__x.__i_ < __y.__i_)
- {
- size_t __j = _Np - __y.__i_;
- if (!std::equal(__x.__x_ + __x.__i_, __x.__x_ + (__x.__i_ + __j),
- __y.__x_ + __y.__i_))
- return false;
- if (!std::equal(__x.__x_ + (__x.__i_ + __j), __x.__x_ + _Np,
- __y.__x_))
- return false;
- return std::equal(__x.__x_, __x.__x_ + __x.__i_,
- __y.__x_ + (_Np - (__x.__i_ + __j)));
- }
- size_t __j = _Np - __x.__i_;
- if (!std::equal(__y.__x_ + __y.__i_, __y.__x_ + (__y.__i_ + __j),
- __x.__x_ + __x.__i_))
- return false;
- if (!std::equal(__y.__x_ + (__y.__i_ + __j), __y.__x_ + _Np,
- __x.__x_))
- return false;
- return std::equal(__y.__x_, __y.__x_ + __y.__i_,
- __x.__x_ + (_Np - (__y.__i_ + __j)));
+operator==(const mersenne_twister_engine<_UInt, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp, _Bp, _Tp, _Cp, _Lp, _Fp>& __x,
+ const mersenne_twister_engine<_UInt, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp, _Bp, _Tp, _Cp, _Lp, _Fp>& __y) {
+ if (__x.__i_ == __y.__i_)
+ return std::equal(__x.__x_, __x.__x_ + _Np, __y.__x_);
+ if (__x.__i_ == 0 || __y.__i_ == 0) {
+ size_t __j = std::min(_Np - __x.__i_, _Np - __y.__i_);
+ if (!std::equal(__x.__x_ + __x.__i_, __x.__x_ + __x.__i_ + __j, __y.__x_ + __y.__i_))
+ return false;
+ if (__x.__i_ == 0)
+ return std::equal(__x.__x_ + __j, __x.__x_ + _Np, __y.__x_);
+ return std::equal(__x.__x_, __x.__x_ + (_Np - __j), __y.__x_ + __j);
+ }
+ if (__x.__i_ < __y.__i_) {
+ size_t __j = _Np - __y.__i_;
+ if (!std::equal(__x.__x_ + __x.__i_, __x.__x_ + (__x.__i_ + __j), __y.__x_ + __y.__i_))
+ return false;
+ if (!std::equal(__x.__x_ + (__x.__i_ + __j), __x.__x_ + _Np, __y.__x_))
+ return false;
+ return std::equal(__x.__x_, __x.__x_ + __x.__i_, __y.__x_ + (_Np - (__x.__i_ + __j)));
+ }
+ size_t __j = _Np - __x.__i_;
+ if (!std::equal(__y.__x_ + __y.__i_, __y.__x_ + (__y.__i_ + __j), __x.__x_ + __x.__i_))
+ return false;
+ if (!std::equal(__y.__x_ + (__y.__i_ + __j), __y.__x_ + _Np, __x.__x_))
+ return false;
+ return std::equal(__y.__x_, __y.__x_ + __y.__i_, __x.__x_ + (_Np - (__y.__i_ + __j)));
}
-template <class _UInt, size_t _Wp, size_t _Np, size_t _Mp, size_t _Rp,
- _UInt _Ap, size_t _Up, _UInt _Dp, size_t _Sp,
- _UInt _Bp, size_t _Tp, _UInt _Cp, size_t _Lp, _UInt _Fp>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator!=(const mersenne_twister_engine<_UInt, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp,
- _Bp, _Tp, _Cp, _Lp, _Fp>& __x,
- const mersenne_twister_engine<_UInt, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp,
- _Bp, _Tp, _Cp, _Lp, _Fp>& __y)
-{
- return !(__x == __y);
+template <class _UInt,
+ size_t _Wp,
+ size_t _Np,
+ size_t _Mp,
+ size_t _Rp,
+ _UInt _Ap,
+ size_t _Up,
+ _UInt _Dp,
+ size_t _Sp,
+ _UInt _Bp,
+ size_t _Tp,
+ _UInt _Cp,
+ size_t _Lp,
+ _UInt _Fp>
+inline _LIBCPP_HIDE_FROM_ABI bool
+operator!=(const mersenne_twister_engine<_UInt, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp, _Bp, _Tp, _Cp, _Lp, _Fp>& __x,
+ const mersenne_twister_engine<_UInt, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp, _Bp, _Tp, _Cp, _Lp, _Fp>& __y) {
+ return !(__x == __y);
}
-template <class _CharT, class _Traits,
- class _UInt, size_t _Wp, size_t _Np, size_t _Mp, size_t _Rp,
- _UInt _Ap, size_t _Up, _UInt _Dp, size_t _Sp,
- _UInt _Bp, size_t _Tp, _UInt _Cp, size_t _Lp, _UInt _Fp>
+template <class _CharT,
+ class _Traits,
+ class _UInt,
+ size_t _Wp,
+ size_t _Np,
+ size_t _Mp,
+ size_t _Rp,
+ _UInt _Ap,
+ size_t _Up,
+ _UInt _Dp,
+ size_t _Sp,
+ _UInt _Bp,
+ size_t _Tp,
+ _UInt _Cp,
+ size_t _Lp,
+ _UInt _Fp>
_LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>&
operator<<(basic_ostream<_CharT, _Traits>& __os,
- const mersenne_twister_engine<_UInt, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp,
- _Bp, _Tp, _Cp, _Lp, _Fp>& __x)
-{
- __save_flags<_CharT, _Traits> __lx(__os);
- typedef basic_ostream<_CharT, _Traits> _Ostream;
- __os.flags(_Ostream::dec | _Ostream::left);
- _CharT __sp = __os.widen(' ');
- __os.fill(__sp);
- __os << __x.__x_[__x.__i_];
- for (size_t __j = __x.__i_ + 1; __j < _Np; ++__j)
- __os << __sp << __x.__x_[__j];
- for (size_t __j = 0; __j < __x.__i_; ++__j)
- __os << __sp << __x.__x_[__j];
- return __os;
+ const mersenne_twister_engine<_UInt, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp, _Bp, _Tp, _Cp, _Lp, _Fp>& __x) {
+ __save_flags<_CharT, _Traits> __lx(__os);
+ typedef basic_ostream<_CharT, _Traits> _Ostream;
+ __os.flags(_Ostream::dec | _Ostream::left);
+ _CharT __sp = __os.widen(' ');
+ __os.fill(__sp);
+ __os << __x.__x_[__x.__i_];
+ for (size_t __j = __x.__i_ + 1; __j < _Np; ++__j)
+ __os << __sp << __x.__x_[__j];
+ for (size_t __j = 0; __j < __x.__i_; ++__j)
+ __os << __sp << __x.__x_[__j];
+ return __os;
}
-template <class _CharT, class _Traits,
- class _UInt, size_t _Wp, size_t _Np, size_t _Mp, size_t _Rp,
- _UInt _Ap, size_t _Up, _UInt _Dp, size_t _Sp,
- _UInt _Bp, size_t _Tp, _UInt _Cp, size_t _Lp, _UInt _Fp>
+template <class _CharT,
+ class _Traits,
+ class _UInt,
+ size_t _Wp,
+ size_t _Np,
+ size_t _Mp,
+ size_t _Rp,
+ _UInt _Ap,
+ size_t _Up,
+ _UInt _Dp,
+ size_t _Sp,
+ _UInt _Bp,
+ size_t _Tp,
+ _UInt _Cp,
+ size_t _Lp,
+ _UInt _Fp>
_LIBCPP_HIDE_FROM_ABI basic_istream<_CharT, _Traits>&
operator>>(basic_istream<_CharT, _Traits>& __is,
- mersenne_twister_engine<_UInt, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp,
- _Bp, _Tp, _Cp, _Lp, _Fp>& __x)
-{
- __save_flags<_CharT, _Traits> __lx(__is);
- typedef basic_istream<_CharT, _Traits> _Istream;
- __is.flags(_Istream::dec | _Istream::skipws);
- _UInt __t[_Np];
+ mersenne_twister_engine<_UInt, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp, _Bp, _Tp, _Cp, _Lp, _Fp>& __x) {
+ __save_flags<_CharT, _Traits> __lx(__is);
+ typedef basic_istream<_CharT, _Traits> _Istream;
+ __is.flags(_Istream::dec | _Istream::skipws);
+ _UInt __t[_Np];
+ for (size_t __i = 0; __i < _Np; ++__i)
+ __is >> __t[__i];
+ if (!__is.fail()) {
for (size_t __i = 0; __i < _Np; ++__i)
- __is >> __t[__i];
- if (!__is.fail())
- {
- for (size_t __i = 0; __i < _Np; ++__i)
- __x.__x_[__i] = __t[__i];
- __x.__i_ = 0;
- }
- return __is;
+ __x.__x_[__i] = __t[__i];
+ __x.__i_ = 0;
+ }
+ return __is;
}
-typedef mersenne_twister_engine<uint_fast32_t, 32, 624, 397, 31,
- 0x9908b0df, 11, 0xffffffff,
- 7, 0x9d2c5680,
- 15, 0xefc60000,
- 18, 1812433253> mt19937;
-typedef mersenne_twister_engine<uint_fast64_t, 64, 312, 156, 31,
- 0xb5026f5aa96619e9ULL, 29, 0x5555555555555555ULL,
- 17, 0x71d67fffeda60000ULL,
- 37, 0xfff7eee000000000ULL,
- 43, 6364136223846793005ULL> mt19937_64;
+typedef mersenne_twister_engine<
+ uint_fast32_t,
+ 32,
+ 624,
+ 397,
+ 31,
+ 0x9908b0df,
+ 11,
+ 0xffffffff,
+ 7,
+ 0x9d2c5680,
+ 15,
+ 0xefc60000,
+ 18,
+ 1812433253>
+ mt19937;
+typedef mersenne_twister_engine<
+ uint_fast64_t,
+ 64,
+ 312,
+ 156,
+ 31,
+ 0xb5026f5aa96619e9ULL,
+ 29,
+ 0x5555555555555555ULL,
+ 17,
+ 0x71d67fffeda60000ULL,
+ 37,
+ 0xfff7eee000000000ULL,
+ 43,
+ 6364136223846793005ULL>
+ mt19937_64;
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__random/negative_binomial_distribution.h b/contrib/llvm-project/libcxx/include/__random/negative_binomial_distribution.h
index 57b7a71de21e..580c74d46440 100644
--- a/contrib/llvm-project/libcxx/include/__random/negative_binomial_distribution.h
+++ b/contrib/llvm-project/libcxx/include/__random/negative_binomial_distribution.h
@@ -26,156 +26,128 @@ _LIBCPP_PUSH_MACROS
_LIBCPP_BEGIN_NAMESPACE_STD
-template<class _IntType = int>
-class _LIBCPP_TEMPLATE_VIS negative_binomial_distribution
-{
- static_assert(__libcpp_random_is_valid_inttype<_IntType>::value, "IntType must be a supported integer type");
+template <class _IntType = int>
+class _LIBCPP_TEMPLATE_VIS negative_binomial_distribution {
+ static_assert(__libcpp_random_is_valid_inttype<_IntType>::value, "IntType must be a supported integer type");
+
public:
- // types
- typedef _IntType result_type;
-
- class _LIBCPP_TEMPLATE_VIS param_type
- {
- result_type __k_;
- double __p_;
- public:
- typedef negative_binomial_distribution distribution_type;
-
- _LIBCPP_HIDE_FROM_ABI
- explicit param_type(result_type __k = 1, double __p = 0.5)
- : __k_(__k), __p_(__p) {}
-
- _LIBCPP_HIDE_FROM_ABI
- result_type k() const {return __k_;}
- _LIBCPP_HIDE_FROM_ABI
- double p() const {return __p_;}
-
- friend _LIBCPP_HIDE_FROM_ABI
- bool operator==(const param_type& __x, const param_type& __y)
- {return __x.__k_ == __y.__k_ && __x.__p_ == __y.__p_;}
- friend _LIBCPP_HIDE_FROM_ABI
- bool operator!=(const param_type& __x, const param_type& __y)
- {return !(__x == __y);}
- };
+ // types
+ typedef _IntType result_type;
+
+ class _LIBCPP_TEMPLATE_VIS param_type {
+ result_type __k_;
+ double __p_;
+
+ public:
+ typedef negative_binomial_distribution distribution_type;
+
+ _LIBCPP_HIDE_FROM_ABI explicit param_type(result_type __k = 1, double __p = 0.5) : __k_(__k), __p_(__p) {}
+
+ _LIBCPP_HIDE_FROM_ABI result_type k() const { return __k_; }
+ _LIBCPP_HIDE_FROM_ABI double p() const { return __p_; }
+
+ friend _LIBCPP_HIDE_FROM_ABI bool operator==(const param_type& __x, const param_type& __y) {
+ return __x.__k_ == __y.__k_ && __x.__p_ == __y.__p_;
+ }
+ friend _LIBCPP_HIDE_FROM_ABI bool operator!=(const param_type& __x, const param_type& __y) { return !(__x == __y); }
+ };
private:
- param_type __p_;
+ param_type __p_;
public:
- // constructor and reset functions
+ // constructor and reset functions
#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI
- negative_binomial_distribution() : negative_binomial_distribution(1) {}
- _LIBCPP_HIDE_FROM_ABI
- explicit negative_binomial_distribution(result_type __k, double __p = 0.5)
- : __p_(__k, __p) {}
+ _LIBCPP_HIDE_FROM_ABI negative_binomial_distribution() : negative_binomial_distribution(1) {}
+ _LIBCPP_HIDE_FROM_ABI explicit negative_binomial_distribution(result_type __k, double __p = 0.5) : __p_(__k, __p) {}
#else
- _LIBCPP_HIDE_FROM_ABI
- explicit negative_binomial_distribution(result_type __k = 1,
- double __p = 0.5)
- : __p_(__k, __p) {}
+ _LIBCPP_HIDE_FROM_ABI explicit negative_binomial_distribution(result_type __k = 1, double __p = 0.5)
+ : __p_(__k, __p) {}
#endif
- _LIBCPP_HIDE_FROM_ABI
- explicit negative_binomial_distribution(const param_type& __p) : __p_(__p) {}
- _LIBCPP_HIDE_FROM_ABI
- void reset() {}
-
- // generating functions
- template<class _URNG>
- _LIBCPP_HIDE_FROM_ABI
- result_type operator()(_URNG& __g)
- {return (*this)(__g, __p_);}
- template<class _URNG>
- _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g, const param_type& __p);
-
- // property functions
- _LIBCPP_HIDE_FROM_ABI
- result_type k() const {return __p_.k();}
- _LIBCPP_HIDE_FROM_ABI
- double p() const {return __p_.p();}
-
- _LIBCPP_HIDE_FROM_ABI
- param_type param() const {return __p_;}
- _LIBCPP_HIDE_FROM_ABI
- void param(const param_type& __p) {__p_ = __p;}
-
- _LIBCPP_HIDE_FROM_ABI
- result_type min() const {return 0;}
- _LIBCPP_HIDE_FROM_ABI
- result_type max() const {return numeric_limits<result_type>::max();}
-
- friend _LIBCPP_HIDE_FROM_ABI
- bool operator==(const negative_binomial_distribution& __x,
- const negative_binomial_distribution& __y)
- {return __x.__p_ == __y.__p_;}
- friend _LIBCPP_HIDE_FROM_ABI
- bool operator!=(const negative_binomial_distribution& __x,
- const negative_binomial_distribution& __y)
- {return !(__x == __y);}
+ _LIBCPP_HIDE_FROM_ABI explicit negative_binomial_distribution(const param_type& __p) : __p_(__p) {}
+ _LIBCPP_HIDE_FROM_ABI void reset() {}
+
+ // generating functions
+ template <class _URNG>
+ _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g) {
+ return (*this)(__g, __p_);
+ }
+ template <class _URNG>
+ _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g, const param_type& __p);
+
+ // property functions
+ _LIBCPP_HIDE_FROM_ABI result_type k() const { return __p_.k(); }
+ _LIBCPP_HIDE_FROM_ABI double p() const { return __p_.p(); }
+
+ _LIBCPP_HIDE_FROM_ABI param_type param() const { return __p_; }
+ _LIBCPP_HIDE_FROM_ABI void param(const param_type& __p) { __p_ = __p; }
+
+ _LIBCPP_HIDE_FROM_ABI result_type min() const { return 0; }
+ _LIBCPP_HIDE_FROM_ABI result_type max() const { return numeric_limits<result_type>::max(); }
+
+ friend _LIBCPP_HIDE_FROM_ABI bool
+ operator==(const negative_binomial_distribution& __x, const negative_binomial_distribution& __y) {
+ return __x.__p_ == __y.__p_;
+ }
+ friend _LIBCPP_HIDE_FROM_ABI bool
+ operator!=(const negative_binomial_distribution& __x, const negative_binomial_distribution& __y) {
+ return !(__x == __y);
+ }
};
template <class _IntType>
-template<class _URNG>
-_IntType
-negative_binomial_distribution<_IntType>::operator()(_URNG& __urng, const param_type& __pr)
-{
- static_assert(__libcpp_random_is_valid_urng<_URNG>::value, "");
- result_type __k = __pr.k();
- double __p = __pr.p();
- // When the number of bits in _IntType is small, we are too likely to
- // overflow __f below to use this technique.
- if (__k <= 21 * __p && sizeof(_IntType) > 1)
- {
- bernoulli_distribution __gen(__p);
- result_type __f = 0;
- result_type __s = 0;
- while (__s < __k)
- {
- if (__gen(__urng))
- ++__s;
- else
- ++__f;
- }
- _LIBCPP_ASSERT_UNCATEGORIZED(__f >= 0,
- "std::negative_binomial_distribution should never produce negative values. "
- "This is almost certainly a signed integer overflow issue on __f.");
- return __f;
+template <class _URNG>
+_IntType negative_binomial_distribution<_IntType>::operator()(_URNG& __urng, const param_type& __pr) {
+ static_assert(__libcpp_random_is_valid_urng<_URNG>::value, "");
+ result_type __k = __pr.k();
+ double __p = __pr.p();
+ // When the number of bits in _IntType is small, we are too likely to
+ // overflow __f below to use this technique.
+ if (__k <= 21 * __p && sizeof(_IntType) > 1) {
+ bernoulli_distribution __gen(__p);
+ result_type __f = 0;
+ result_type __s = 0;
+ while (__s < __k) {
+ if (__gen(__urng))
+ ++__s;
+ else
+ ++__f;
}
- return poisson_distribution<result_type>(gamma_distribution<double>
- (__k, (1-__p)/__p)(__urng))(__urng);
+ _LIBCPP_ASSERT_UNCATEGORIZED(
+ __f >= 0,
+ "std::negative_binomial_distribution should never produce negative values. "
+ "This is almost certainly a signed integer overflow issue on __f.");
+ return __f;
+ }
+ return poisson_distribution<result_type>(gamma_distribution<double>(__k, (1 - __p) / __p)(__urng))(__urng);
}
template <class _CharT, class _Traits, class _IntType>
_LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>&
-operator<<(basic_ostream<_CharT, _Traits>& __os,
- const negative_binomial_distribution<_IntType>& __x)
-{
- __save_flags<_CharT, _Traits> __lx(__os);
- typedef basic_ostream<_CharT, _Traits> _OStream;
- __os.flags(_OStream::dec | _OStream::left | _OStream::fixed |
- _OStream::scientific);
- _CharT __sp = __os.widen(' ');
- __os.fill(__sp);
- return __os << __x.k() << __sp << __x.p();
+operator<<(basic_ostream<_CharT, _Traits>& __os, const negative_binomial_distribution<_IntType>& __x) {
+ __save_flags<_CharT, _Traits> __lx(__os);
+ typedef basic_ostream<_CharT, _Traits> _OStream;
+ __os.flags(_OStream::dec | _OStream::left | _OStream::fixed | _OStream::scientific);
+ _CharT __sp = __os.widen(' ');
+ __os.fill(__sp);
+ return __os << __x.k() << __sp << __x.p();
}
template <class _CharT, class _Traits, class _IntType>
_LIBCPP_HIDE_FROM_ABI basic_istream<_CharT, _Traits>&
-operator>>(basic_istream<_CharT, _Traits>& __is,
- negative_binomial_distribution<_IntType>& __x)
-{
- typedef negative_binomial_distribution<_IntType> _Eng;
- typedef typename _Eng::result_type result_type;
- typedef typename _Eng::param_type param_type;
- __save_flags<_CharT, _Traits> __lx(__is);
- typedef basic_istream<_CharT, _Traits> _Istream;
- __is.flags(_Istream::dec | _Istream::skipws);
- result_type __k;
- double __p;
- __is >> __k >> __p;
- if (!__is.fail())
- __x.param(param_type(__k, __p));
- return __is;
+operator>>(basic_istream<_CharT, _Traits>& __is, negative_binomial_distribution<_IntType>& __x) {
+ typedef negative_binomial_distribution<_IntType> _Eng;
+ typedef typename _Eng::result_type result_type;
+ typedef typename _Eng::param_type param_type;
+ __save_flags<_CharT, _Traits> __lx(__is);
+ typedef basic_istream<_CharT, _Traits> _Istream;
+ __is.flags(_Istream::dec | _Istream::skipws);
+ result_type __k;
+ double __p;
+ __is >> __k >> __p;
+ if (!__is.fail())
+ __x.param(param_type(__k, __p));
+ return __is;
}
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__random/normal_distribution.h b/contrib/llvm-project/libcxx/include/__random/normal_distribution.h
index 9d68ea6118fd..889f189e4161 100644
--- a/contrib/llvm-project/libcxx/include/__random/normal_distribution.h
+++ b/contrib/llvm-project/libcxx/include/__random/normal_distribution.h
@@ -25,186 +25,148 @@ _LIBCPP_PUSH_MACROS
_LIBCPP_BEGIN_NAMESPACE_STD
-template<class _RealType = double>
-class _LIBCPP_TEMPLATE_VIS normal_distribution
-{
+template <class _RealType = double>
+class _LIBCPP_TEMPLATE_VIS normal_distribution {
static_assert(__libcpp_random_is_valid_realtype<_RealType>::value,
"RealType must be a supported floating-point type");
public:
- // types
- typedef _RealType result_type;
-
- class _LIBCPP_TEMPLATE_VIS param_type
- {
- result_type __mean_;
- result_type __stddev_;
- public:
- typedef normal_distribution distribution_type;
-
- _LIBCPP_HIDE_FROM_ABI
- explicit param_type(result_type __mean = 0, result_type __stddev = 1)
- : __mean_(__mean), __stddev_(__stddev) {}
-
- _LIBCPP_HIDE_FROM_ABI
- result_type mean() const {return __mean_;}
- _LIBCPP_HIDE_FROM_ABI
- result_type stddev() const {return __stddev_;}
-
- friend _LIBCPP_HIDE_FROM_ABI
- bool operator==(const param_type& __x, const param_type& __y)
- {return __x.__mean_ == __y.__mean_ && __x.__stddev_ == __y.__stddev_;}
- friend _LIBCPP_HIDE_FROM_ABI
- bool operator!=(const param_type& __x, const param_type& __y)
- {return !(__x == __y);}
- };
+ // types
+ typedef _RealType result_type;
+
+ class _LIBCPP_TEMPLATE_VIS param_type {
+ result_type __mean_;
+ result_type __stddev_;
+
+ public:
+ typedef normal_distribution distribution_type;
+
+ _LIBCPP_HIDE_FROM_ABI explicit param_type(result_type __mean = 0, result_type __stddev = 1)
+ : __mean_(__mean), __stddev_(__stddev) {}
+
+ _LIBCPP_HIDE_FROM_ABI result_type mean() const { return __mean_; }
+ _LIBCPP_HIDE_FROM_ABI result_type stddev() const { return __stddev_; }
+
+ friend _LIBCPP_HIDE_FROM_ABI bool operator==(const param_type& __x, const param_type& __y) {
+ return __x.__mean_ == __y.__mean_ && __x.__stddev_ == __y.__stddev_;
+ }
+ friend _LIBCPP_HIDE_FROM_ABI bool operator!=(const param_type& __x, const param_type& __y) { return !(__x == __y); }
+ };
private:
- param_type __p_;
- result_type __v_;
- bool __v_hot_;
+ param_type __p_;
+ result_type __v_;
+ bool __v_hot_;
public:
- // constructors and reset functions
+ // constructors and reset functions
#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI
- normal_distribution() : normal_distribution(0) {}
- _LIBCPP_HIDE_FROM_ABI
- explicit normal_distribution(result_type __mean, result_type __stddev = 1)
- : __p_(param_type(__mean, __stddev)), __v_hot_(false) {}
+ _LIBCPP_HIDE_FROM_ABI normal_distribution() : normal_distribution(0) {}
+ _LIBCPP_HIDE_FROM_ABI explicit normal_distribution(result_type __mean, result_type __stddev = 1)
+ : __p_(param_type(__mean, __stddev)), __v_hot_(false) {}
#else
- _LIBCPP_HIDE_FROM_ABI
- explicit normal_distribution(result_type __mean = 0,
- result_type __stddev = 1)
- : __p_(param_type(__mean, __stddev)), __v_hot_(false) {}
+ _LIBCPP_HIDE_FROM_ABI explicit normal_distribution(result_type __mean = 0, result_type __stddev = 1)
+ : __p_(param_type(__mean, __stddev)), __v_hot_(false) {}
#endif
- _LIBCPP_HIDE_FROM_ABI
- explicit normal_distribution(const param_type& __p)
- : __p_(__p), __v_hot_(false) {}
- _LIBCPP_HIDE_FROM_ABI
- void reset() {__v_hot_ = false;}
-
- // generating functions
- template<class _URNG>
- _LIBCPP_HIDE_FROM_ABI
- result_type operator()(_URNG& __g)
- {return (*this)(__g, __p_);}
- template<class _URNG>
- _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g, const param_type& __p);
-
- // property functions
- _LIBCPP_HIDE_FROM_ABI
- result_type mean() const {return __p_.mean();}
- _LIBCPP_HIDE_FROM_ABI
- result_type stddev() const {return __p_.stddev();}
-
- _LIBCPP_HIDE_FROM_ABI
- param_type param() const {return __p_;}
- _LIBCPP_HIDE_FROM_ABI
- void param(const param_type& __p) {__p_ = __p;}
-
- _LIBCPP_HIDE_FROM_ABI
- result_type min() const {return -numeric_limits<result_type>::infinity();}
- _LIBCPP_HIDE_FROM_ABI
- result_type max() const {return numeric_limits<result_type>::infinity();}
-
- friend _LIBCPP_HIDE_FROM_ABI
- bool operator==(const normal_distribution& __x,
- const normal_distribution& __y)
- {return __x.__p_ == __y.__p_ && __x.__v_hot_ == __y.__v_hot_ &&
- (!__x.__v_hot_ || __x.__v_ == __y.__v_);}
- friend _LIBCPP_HIDE_FROM_ABI
- bool operator!=(const normal_distribution& __x,
- const normal_distribution& __y)
- {return !(__x == __y);}
-
- template <class _CharT, class _Traits, class _RT>
- friend
- basic_ostream<_CharT, _Traits>&
- operator<<(basic_ostream<_CharT, _Traits>& __os,
- const normal_distribution<_RT>& __x);
-
- template <class _CharT, class _Traits, class _RT>
- friend
- basic_istream<_CharT, _Traits>&
- operator>>(basic_istream<_CharT, _Traits>& __is,
- normal_distribution<_RT>& __x);
+ _LIBCPP_HIDE_FROM_ABI explicit normal_distribution(const param_type& __p) : __p_(__p), __v_hot_(false) {}
+ _LIBCPP_HIDE_FROM_ABI void reset() { __v_hot_ = false; }
+
+ // generating functions
+ template <class _URNG>
+ _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g) {
+ return (*this)(__g, __p_);
+ }
+ template <class _URNG>
+ _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g, const param_type& __p);
+
+ // property functions
+ _LIBCPP_HIDE_FROM_ABI result_type mean() const { return __p_.mean(); }
+ _LIBCPP_HIDE_FROM_ABI result_type stddev() const { return __p_.stddev(); }
+
+ _LIBCPP_HIDE_FROM_ABI param_type param() const { return __p_; }
+ _LIBCPP_HIDE_FROM_ABI void param(const param_type& __p) { __p_ = __p; }
+
+ _LIBCPP_HIDE_FROM_ABI result_type min() const { return -numeric_limits<result_type>::infinity(); }
+ _LIBCPP_HIDE_FROM_ABI result_type max() const { return numeric_limits<result_type>::infinity(); }
+
+ friend _LIBCPP_HIDE_FROM_ABI bool operator==(const normal_distribution& __x, const normal_distribution& __y) {
+ return __x.__p_ == __y.__p_ && __x.__v_hot_ == __y.__v_hot_ && (!__x.__v_hot_ || __x.__v_ == __y.__v_);
+ }
+ friend _LIBCPP_HIDE_FROM_ABI bool operator!=(const normal_distribution& __x, const normal_distribution& __y) {
+ return !(__x == __y);
+ }
+
+ template <class _CharT, class _Traits, class _RT>
+ friend basic_ostream<_CharT, _Traits>&
+ operator<<(basic_ostream<_CharT, _Traits>& __os, const normal_distribution<_RT>& __x);
+
+ template <class _CharT, class _Traits, class _RT>
+ friend basic_istream<_CharT, _Traits>&
+ operator>>(basic_istream<_CharT, _Traits>& __is, normal_distribution<_RT>& __x);
};
template <class _RealType>
-template<class _URNG>
-_RealType
-normal_distribution<_RealType>::operator()(_URNG& __g, const param_type& __p)
-{
- static_assert(__libcpp_random_is_valid_urng<_URNG>::value, "");
- result_type __up;
- if (__v_hot_)
- {
- __v_hot_ = false;
- __up = __v_;
- }
- else
- {
- uniform_real_distribution<result_type> __uni(-1, 1);
- result_type __u;
- result_type __v;
- result_type __s;
- do
- {
- __u = __uni(__g);
- __v = __uni(__g);
- __s = __u * __u + __v * __v;
- } while (__s > 1 || __s == 0);
- result_type __fp = std::sqrt(-2 * std::log(__s) / __s);
- __v_ = __v * __fp;
- __v_hot_ = true;
- __up = __u * __fp;
- }
- return __up * __p.stddev() + __p.mean();
+template <class _URNG>
+_RealType normal_distribution<_RealType>::operator()(_URNG& __g, const param_type& __p) {
+ static_assert(__libcpp_random_is_valid_urng<_URNG>::value, "");
+ result_type __up;
+ if (__v_hot_) {
+ __v_hot_ = false;
+ __up = __v_;
+ } else {
+ uniform_real_distribution<result_type> __uni(-1, 1);
+ result_type __u;
+ result_type __v;
+ result_type __s;
+ do {
+ __u = __uni(__g);
+ __v = __uni(__g);
+ __s = __u * __u + __v * __v;
+ } while (__s > 1 || __s == 0);
+ result_type __fp = std::sqrt(-2 * std::log(__s) / __s);
+ __v_ = __v * __fp;
+ __v_hot_ = true;
+ __up = __u * __fp;
+ }
+ return __up * __p.stddev() + __p.mean();
}
template <class _CharT, class _Traits, class _RT>
_LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>&
-operator<<(basic_ostream<_CharT, _Traits>& __os,
- const normal_distribution<_RT>& __x)
-{
- __save_flags<_CharT, _Traits> __lx(__os);
- typedef basic_ostream<_CharT, _Traits> _OStream;
- __os.flags(_OStream::dec | _OStream::left | _OStream::fixed |
- _OStream::scientific);
- _CharT __sp = __os.widen(' ');
- __os.fill(__sp);
- __os << __x.mean() << __sp << __x.stddev() << __sp << __x.__v_hot_;
- if (__x.__v_hot_)
- __os << __sp << __x.__v_;
- return __os;
+operator<<(basic_ostream<_CharT, _Traits>& __os, const normal_distribution<_RT>& __x) {
+ __save_flags<_CharT, _Traits> __lx(__os);
+ typedef basic_ostream<_CharT, _Traits> _OStream;
+ __os.flags(_OStream::dec | _OStream::left | _OStream::fixed | _OStream::scientific);
+ _CharT __sp = __os.widen(' ');
+ __os.fill(__sp);
+ __os << __x.mean() << __sp << __x.stddev() << __sp << __x.__v_hot_;
+ if (__x.__v_hot_)
+ __os << __sp << __x.__v_;
+ return __os;
}
template <class _CharT, class _Traits, class _RT>
_LIBCPP_HIDE_FROM_ABI basic_istream<_CharT, _Traits>&
-operator>>(basic_istream<_CharT, _Traits>& __is,
- normal_distribution<_RT>& __x)
-{
- typedef normal_distribution<_RT> _Eng;
- typedef typename _Eng::result_type result_type;
- typedef typename _Eng::param_type param_type;
- __save_flags<_CharT, _Traits> __lx(__is);
- typedef basic_istream<_CharT, _Traits> _Istream;
- __is.flags(_Istream::dec | _Istream::skipws);
- result_type __mean;
- result_type __stddev;
- result_type __vp = 0;
- bool __v_hot = false;
- __is >> __mean >> __stddev >> __v_hot;
- if (__v_hot)
- __is >> __vp;
- if (!__is.fail())
- {
- __x.param(param_type(__mean, __stddev));
- __x.__v_hot_ = __v_hot;
- __x.__v_ = __vp;
- }
- return __is;
+operator>>(basic_istream<_CharT, _Traits>& __is, normal_distribution<_RT>& __x) {
+ typedef normal_distribution<_RT> _Eng;
+ typedef typename _Eng::result_type result_type;
+ typedef typename _Eng::param_type param_type;
+ __save_flags<_CharT, _Traits> __lx(__is);
+ typedef basic_istream<_CharT, _Traits> _Istream;
+ __is.flags(_Istream::dec | _Istream::skipws);
+ result_type __mean;
+ result_type __stddev;
+ result_type __vp = 0;
+ bool __v_hot = false;
+ __is >> __mean >> __stddev >> __v_hot;
+ if (__v_hot)
+ __is >> __vp;
+ if (!__is.fail()) {
+ __x.param(param_type(__mean, __stddev));
+ __x.__v_hot_ = __v_hot;
+ __x.__v_ = __vp;
+ }
+ return __is;
}
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__random/piecewise_constant_distribution.h b/contrib/llvm-project/libcxx/include/__random/piecewise_constant_distribution.h
index 3a60e5533d77..e19380f97c35 100644
--- a/contrib/llvm-project/libcxx/include/__random/piecewise_constant_distribution.h
+++ b/contrib/llvm-project/libcxx/include/__random/piecewise_constant_distribution.h
@@ -26,333 +26,273 @@ _LIBCPP_PUSH_MACROS
_LIBCPP_BEGIN_NAMESPACE_STD
-template<class _RealType = double>
-class _LIBCPP_TEMPLATE_VIS piecewise_constant_distribution
-{
+template <class _RealType = double>
+class _LIBCPP_TEMPLATE_VIS piecewise_constant_distribution {
static_assert(__libcpp_random_is_valid_realtype<_RealType>::value,
"RealType must be a supported floating-point type");
public:
- // types
- typedef _RealType result_type;
-
- class _LIBCPP_TEMPLATE_VIS param_type
- {
- vector<result_type> __b_;
- vector<result_type> __densities_;
- vector<result_type> __areas_;
- public:
- typedef piecewise_constant_distribution distribution_type;
-
- _LIBCPP_HIDE_FROM_ABI param_type();
- template<class _InputIteratorB, class _InputIteratorW>
- _LIBCPP_HIDE_FROM_ABI param_type(_InputIteratorB __f_b, _InputIteratorB __l_b,
- _InputIteratorW __f_w);
-#ifndef _LIBCPP_CXX03_LANG
- template<class _UnaryOperation>
- _LIBCPP_HIDE_FROM_ABI param_type(initializer_list<result_type> __bl, _UnaryOperation __fw);
-#endif // _LIBCPP_CXX03_LANG
- template<class _UnaryOperation>
- _LIBCPP_HIDE_FROM_ABI param_type(size_t __nw, result_type __xmin, result_type __xmax,
- _UnaryOperation __fw);
- _LIBCPP_HIDE_FROM_ABI param_type(param_type const&) = default;
- _LIBCPP_HIDE_FROM_ABI param_type & operator=(const param_type& __rhs);
-
- _LIBCPP_HIDE_FROM_ABI
- vector<result_type> intervals() const {return __b_;}
- _LIBCPP_HIDE_FROM_ABI
- vector<result_type> densities() const {return __densities_;}
-
- friend _LIBCPP_HIDE_FROM_ABI
- bool operator==(const param_type& __x, const param_type& __y)
- {return __x.__densities_ == __y.__densities_ && __x.__b_ == __y.__b_;}
- friend _LIBCPP_HIDE_FROM_ABI
- bool operator!=(const param_type& __x, const param_type& __y)
- {return !(__x == __y);}
-
- private:
- _LIBCPP_HIDE_FROM_ABI void __init();
-
- friend class piecewise_constant_distribution;
-
- template <class _CharT, class _Traits, class _RT>
- friend
- basic_ostream<_CharT, _Traits>&
- operator<<(basic_ostream<_CharT, _Traits>& __os,
- const piecewise_constant_distribution<_RT>& __x);
-
- template <class _CharT, class _Traits, class _RT>
- friend
- basic_istream<_CharT, _Traits>&
- operator>>(basic_istream<_CharT, _Traits>& __is,
- piecewise_constant_distribution<_RT>& __x);
- };
+ // types
+ typedef _RealType result_type;
-private:
- param_type __p_;
+ class _LIBCPP_TEMPLATE_VIS param_type {
+ vector<result_type> __b_;
+ vector<result_type> __densities_;
+ vector<result_type> __areas_;
-public:
- // constructor and reset functions
- _LIBCPP_HIDE_FROM_ABI
- piecewise_constant_distribution() {}
- template<class _InputIteratorB, class _InputIteratorW>
- _LIBCPP_HIDE_FROM_ABI
- piecewise_constant_distribution(_InputIteratorB __f_b,
- _InputIteratorB __l_b,
- _InputIteratorW __f_w)
- : __p_(__f_b, __l_b, __f_w) {}
+ public:
+ typedef piecewise_constant_distribution distribution_type;
+ _LIBCPP_HIDE_FROM_ABI param_type();
+ template <class _InputIteratorB, class _InputIteratorW>
+ _LIBCPP_HIDE_FROM_ABI param_type(_InputIteratorB __f_b, _InputIteratorB __l_b, _InputIteratorW __f_w);
#ifndef _LIBCPP_CXX03_LANG
- template<class _UnaryOperation>
- _LIBCPP_HIDE_FROM_ABI
- piecewise_constant_distribution(initializer_list<result_type> __bl,
- _UnaryOperation __fw)
- : __p_(__bl, __fw) {}
+ template <class _UnaryOperation>
+ _LIBCPP_HIDE_FROM_ABI param_type(initializer_list<result_type> __bl, _UnaryOperation __fw);
#endif // _LIBCPP_CXX03_LANG
+ template <class _UnaryOperation>
+ _LIBCPP_HIDE_FROM_ABI param_type(size_t __nw, result_type __xmin, result_type __xmax, _UnaryOperation __fw);
+ _LIBCPP_HIDE_FROM_ABI param_type(param_type const&) = default;
+ _LIBCPP_HIDE_FROM_ABI param_type& operator=(const param_type& __rhs);
+
+ _LIBCPP_HIDE_FROM_ABI vector<result_type> intervals() const { return __b_; }
+ _LIBCPP_HIDE_FROM_ABI vector<result_type> densities() const { return __densities_; }
+
+ friend _LIBCPP_HIDE_FROM_ABI bool operator==(const param_type& __x, const param_type& __y) {
+ return __x.__densities_ == __y.__densities_ && __x.__b_ == __y.__b_;
+ }
+ friend _LIBCPP_HIDE_FROM_ABI bool operator!=(const param_type& __x, const param_type& __y) { return !(__x == __y); }
- template<class _UnaryOperation>
- _LIBCPP_HIDE_FROM_ABI
- piecewise_constant_distribution(size_t __nw, result_type __xmin,
- result_type __xmax, _UnaryOperation __fw)
- : __p_(__nw, __xmin, __xmax, __fw) {}
-
- _LIBCPP_HIDE_FROM_ABI
- explicit piecewise_constant_distribution(const param_type& __p)
- : __p_(__p) {}
-
- _LIBCPP_HIDE_FROM_ABI
- void reset() {}
-
- // generating functions
- template<class _URNG>
- _LIBCPP_HIDE_FROM_ABI
- result_type operator()(_URNG& __g)
- {return (*this)(__g, __p_);}
- template<class _URNG>
- _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g, const param_type& __p);
-
- // property functions
- _LIBCPP_HIDE_FROM_ABI
- vector<result_type> intervals() const {return __p_.intervals();}
- _LIBCPP_HIDE_FROM_ABI
- vector<result_type> densities() const {return __p_.densities();}
-
- _LIBCPP_HIDE_FROM_ABI
- param_type param() const {return __p_;}
- _LIBCPP_HIDE_FROM_ABI
- void param(const param_type& __p) {__p_ = __p;}
-
- _LIBCPP_HIDE_FROM_ABI
- result_type min() const {return __p_.__b_.front();}
- _LIBCPP_HIDE_FROM_ABI
- result_type max() const {return __p_.__b_.back();}
-
- friend _LIBCPP_HIDE_FROM_ABI
- bool operator==(const piecewise_constant_distribution& __x,
- const piecewise_constant_distribution& __y)
- {return __x.__p_ == __y.__p_;}
- friend _LIBCPP_HIDE_FROM_ABI
- bool operator!=(const piecewise_constant_distribution& __x,
- const piecewise_constant_distribution& __y)
- {return !(__x == __y);}
+ private:
+ _LIBCPP_HIDE_FROM_ABI void __init();
+
+ friend class piecewise_constant_distribution;
template <class _CharT, class _Traits, class _RT>
- friend
- basic_ostream<_CharT, _Traits>&
- operator<<(basic_ostream<_CharT, _Traits>& __os,
- const piecewise_constant_distribution<_RT>& __x);
+ friend basic_ostream<_CharT, _Traits>&
+ operator<<(basic_ostream<_CharT, _Traits>& __os, const piecewise_constant_distribution<_RT>& __x);
template <class _CharT, class _Traits, class _RT>
- friend
- basic_istream<_CharT, _Traits>&
- operator>>(basic_istream<_CharT, _Traits>& __is,
- piecewise_constant_distribution<_RT>& __x);
+ friend basic_istream<_CharT, _Traits>&
+ operator>>(basic_istream<_CharT, _Traits>& __is, piecewise_constant_distribution<_RT>& __x);
+ };
+
+private:
+ param_type __p_;
+
+public:
+ // constructor and reset functions
+ _LIBCPP_HIDE_FROM_ABI piecewise_constant_distribution() {}
+ template <class _InputIteratorB, class _InputIteratorW>
+ _LIBCPP_HIDE_FROM_ABI
+ piecewise_constant_distribution(_InputIteratorB __f_b, _InputIteratorB __l_b, _InputIteratorW __f_w)
+ : __p_(__f_b, __l_b, __f_w) {}
+
+#ifndef _LIBCPP_CXX03_LANG
+ template <class _UnaryOperation>
+ _LIBCPP_HIDE_FROM_ABI piecewise_constant_distribution(initializer_list<result_type> __bl, _UnaryOperation __fw)
+ : __p_(__bl, __fw) {}
+#endif // _LIBCPP_CXX03_LANG
+
+ template <class _UnaryOperation>
+ _LIBCPP_HIDE_FROM_ABI
+ piecewise_constant_distribution(size_t __nw, result_type __xmin, result_type __xmax, _UnaryOperation __fw)
+ : __p_(__nw, __xmin, __xmax, __fw) {}
+
+ _LIBCPP_HIDE_FROM_ABI explicit piecewise_constant_distribution(const param_type& __p) : __p_(__p) {}
+
+ _LIBCPP_HIDE_FROM_ABI void reset() {}
+
+ // generating functions
+ template <class _URNG>
+ _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g) {
+ return (*this)(__g, __p_);
+ }
+ template <class _URNG>
+ _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g, const param_type& __p);
+
+ // property functions
+ _LIBCPP_HIDE_FROM_ABI vector<result_type> intervals() const { return __p_.intervals(); }
+ _LIBCPP_HIDE_FROM_ABI vector<result_type> densities() const { return __p_.densities(); }
+
+ _LIBCPP_HIDE_FROM_ABI param_type param() const { return __p_; }
+ _LIBCPP_HIDE_FROM_ABI void param(const param_type& __p) { __p_ = __p; }
+
+ _LIBCPP_HIDE_FROM_ABI result_type min() const { return __p_.__b_.front(); }
+ _LIBCPP_HIDE_FROM_ABI result_type max() const { return __p_.__b_.back(); }
+
+ friend _LIBCPP_HIDE_FROM_ABI bool
+ operator==(const piecewise_constant_distribution& __x, const piecewise_constant_distribution& __y) {
+ return __x.__p_ == __y.__p_;
+ }
+ friend _LIBCPP_HIDE_FROM_ABI bool
+ operator!=(const piecewise_constant_distribution& __x, const piecewise_constant_distribution& __y) {
+ return !(__x == __y);
+ }
+
+ template <class _CharT, class _Traits, class _RT>
+ friend basic_ostream<_CharT, _Traits>&
+ operator<<(basic_ostream<_CharT, _Traits>& __os, const piecewise_constant_distribution<_RT>& __x);
+
+ template <class _CharT, class _Traits, class _RT>
+ friend basic_istream<_CharT, _Traits>&
+ operator>>(basic_istream<_CharT, _Traits>& __is, piecewise_constant_distribution<_RT>& __x);
};
-template<class _RealType>
-typename piecewise_constant_distribution<_RealType>::param_type &
-piecewise_constant_distribution<_RealType>::param_type::operator=
- (const param_type& __rhs)
-{
-// These can throw
- __b_.reserve (__rhs.__b_.size ());
- __densities_.reserve(__rhs.__densities_.size());
- __areas_.reserve (__rhs.__areas_.size());
-
-// These can not throw
- __b_ = __rhs.__b_;
- __densities_ = __rhs.__densities_;
- __areas_ = __rhs.__areas_;
- return *this;
+template <class _RealType>
+typename piecewise_constant_distribution<_RealType>::param_type&
+piecewise_constant_distribution<_RealType>::param_type::operator=(const param_type& __rhs) {
+ // These can throw
+ __b_.reserve(__rhs.__b_.size());
+ __densities_.reserve(__rhs.__densities_.size());
+ __areas_.reserve(__rhs.__areas_.size());
+
+ // These can not throw
+ __b_ = __rhs.__b_;
+ __densities_ = __rhs.__densities_;
+ __areas_ = __rhs.__areas_;
+ return *this;
}
-template<class _RealType>
-void
-piecewise_constant_distribution<_RealType>::param_type::__init()
-{
- // __densities_ contains non-normalized areas
- result_type __total_area = std::accumulate(__densities_.begin(),
- __densities_.end(),
- result_type());
- for (size_t __i = 0; __i < __densities_.size(); ++__i)
- __densities_[__i] /= __total_area;
- // __densities_ contains normalized areas
- __areas_.assign(__densities_.size(), result_type());
- std::partial_sum(__densities_.begin(), __densities_.end() - 1,
- __areas_.begin() + 1);
- // __areas_ contains partial sums of normalized areas: [0, __densities_ - 1]
- __densities_.back() = 1 - __areas_.back(); // correct round off error
- for (size_t __i = 0; __i < __densities_.size(); ++__i)
- __densities_[__i] /= (__b_[__i+1] - __b_[__i]);
- // __densities_ now contains __densities_
+template <class _RealType>
+void piecewise_constant_distribution<_RealType>::param_type::__init() {
+ // __densities_ contains non-normalized areas
+ result_type __total_area = std::accumulate(__densities_.begin(), __densities_.end(), result_type());
+ for (size_t __i = 0; __i < __densities_.size(); ++__i)
+ __densities_[__i] /= __total_area;
+ // __densities_ contains normalized areas
+ __areas_.assign(__densities_.size(), result_type());
+ std::partial_sum(__densities_.begin(), __densities_.end() - 1, __areas_.begin() + 1);
+ // __areas_ contains partial sums of normalized areas: [0, __densities_ - 1]
+ __densities_.back() = 1 - __areas_.back(); // correct round off error
+ for (size_t __i = 0; __i < __densities_.size(); ++__i)
+ __densities_[__i] /= (__b_[__i + 1] - __b_[__i]);
+ // __densities_ now contains __densities_
}
-template<class _RealType>
-piecewise_constant_distribution<_RealType>::param_type::param_type()
- : __b_(2),
- __densities_(1, 1.0),
- __areas_(1, 0.0)
-{
- __b_[1] = 1;
+template <class _RealType>
+piecewise_constant_distribution<_RealType>::param_type::param_type() : __b_(2), __densities_(1, 1.0), __areas_(1, 0.0) {
+ __b_[1] = 1;
}
-template<class _RealType>
-template<class _InputIteratorB, class _InputIteratorW>
+template <class _RealType>
+template <class _InputIteratorB, class _InputIteratorW>
piecewise_constant_distribution<_RealType>::param_type::param_type(
- _InputIteratorB __f_b, _InputIteratorB __l_b, _InputIteratorW __f_w)
- : __b_(__f_b, __l_b)
-{
- if (__b_.size() < 2)
- {
- __b_.resize(2);
- __b_[0] = 0;
- __b_[1] = 1;
- __densities_.assign(1, 1.0);
- __areas_.assign(1, 0.0);
- }
- else
- {
- __densities_.reserve(__b_.size() - 1);
- for (size_t __i = 0; __i < __b_.size() - 1; ++__i, ++__f_w)
- __densities_.push_back(*__f_w);
- __init();
- }
+ _InputIteratorB __f_b, _InputIteratorB __l_b, _InputIteratorW __f_w)
+ : __b_(__f_b, __l_b) {
+ if (__b_.size() < 2) {
+ __b_.resize(2);
+ __b_[0] = 0;
+ __b_[1] = 1;
+ __densities_.assign(1, 1.0);
+ __areas_.assign(1, 0.0);
+ } else {
+ __densities_.reserve(__b_.size() - 1);
+ for (size_t __i = 0; __i < __b_.size() - 1; ++__i, ++__f_w)
+ __densities_.push_back(*__f_w);
+ __init();
+ }
}
#ifndef _LIBCPP_CXX03_LANG
-template<class _RealType>
-template<class _UnaryOperation>
+template <class _RealType>
+template <class _UnaryOperation>
piecewise_constant_distribution<_RealType>::param_type::param_type(
- initializer_list<result_type> __bl, _UnaryOperation __fw)
- : __b_(__bl.begin(), __bl.end())
-{
- if (__b_.size() < 2)
- {
- __b_.resize(2);
- __b_[0] = 0;
- __b_[1] = 1;
- __densities_.assign(1, 1.0);
- __areas_.assign(1, 0.0);
- }
- else
- {
- __densities_.reserve(__b_.size() - 1);
- for (size_t __i = 0; __i < __b_.size() - 1; ++__i)
- __densities_.push_back(__fw((__b_[__i+1] + __b_[__i])*.5));
- __init();
- }
+ initializer_list<result_type> __bl, _UnaryOperation __fw)
+ : __b_(__bl.begin(), __bl.end()) {
+ if (__b_.size() < 2) {
+ __b_.resize(2);
+ __b_[0] = 0;
+ __b_[1] = 1;
+ __densities_.assign(1, 1.0);
+ __areas_.assign(1, 0.0);
+ } else {
+ __densities_.reserve(__b_.size() - 1);
+ for (size_t __i = 0; __i < __b_.size() - 1; ++__i)
+ __densities_.push_back(__fw((__b_[__i + 1] + __b_[__i]) * .5));
+ __init();
+ }
}
#endif // _LIBCPP_CXX03_LANG
-template<class _RealType>
-template<class _UnaryOperation>
+template <class _RealType>
+template <class _UnaryOperation>
piecewise_constant_distribution<_RealType>::param_type::param_type(
- size_t __nw, result_type __xmin, result_type __xmax, _UnaryOperation __fw)
- : __b_(__nw == 0 ? 2 : __nw + 1)
-{
- size_t __n = __b_.size() - 1;
- result_type __d = (__xmax - __xmin) / __n;
- __densities_.reserve(__n);
- for (size_t __i = 0; __i < __n; ++__i)
- {
- __b_[__i] = __xmin + __i * __d;
- __densities_.push_back(__fw(__b_[__i] + __d*.5));
- }
- __b_[__n] = __xmax;
- __init();
+ size_t __nw, result_type __xmin, result_type __xmax, _UnaryOperation __fw)
+ : __b_(__nw == 0 ? 2 : __nw + 1) {
+ size_t __n = __b_.size() - 1;
+ result_type __d = (__xmax - __xmin) / __n;
+ __densities_.reserve(__n);
+ for (size_t __i = 0; __i < __n; ++__i) {
+ __b_[__i] = __xmin + __i * __d;
+ __densities_.push_back(__fw(__b_[__i] + __d * .5));
+ }
+ __b_[__n] = __xmax;
+ __init();
}
-template<class _RealType>
-template<class _URNG>
-_RealType
-piecewise_constant_distribution<_RealType>::operator()(_URNG& __g, const param_type& __p)
-{
- static_assert(__libcpp_random_is_valid_urng<_URNG>::value, "");
- typedef uniform_real_distribution<result_type> _Gen;
- result_type __u = _Gen()(__g);
- ptrdiff_t __k = std::upper_bound(__p.__areas_.begin(), __p.__areas_.end(),
- __u) - __p.__areas_.begin() - 1;
- return (__u - __p.__areas_[__k]) / __p.__densities_[__k] + __p.__b_[__k];
+template <class _RealType>
+template <class _URNG>
+_RealType piecewise_constant_distribution<_RealType>::operator()(_URNG& __g, const param_type& __p) {
+ static_assert(__libcpp_random_is_valid_urng<_URNG>::value, "");
+ typedef uniform_real_distribution<result_type> _Gen;
+ result_type __u = _Gen()(__g);
+ ptrdiff_t __k = std::upper_bound(__p.__areas_.begin(), __p.__areas_.end(), __u) - __p.__areas_.begin() - 1;
+ return (__u - __p.__areas_[__k]) / __p.__densities_[__k] + __p.__b_[__k];
}
template <class _CharT, class _Traits, class _RT>
_LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>&
-operator<<(basic_ostream<_CharT, _Traits>& __os,
- const piecewise_constant_distribution<_RT>& __x)
-{
- __save_flags<_CharT, _Traits> __lx(__os);
- typedef basic_ostream<_CharT, _Traits> _OStream;
- __os.flags(_OStream::dec | _OStream::left | _OStream::fixed |
- _OStream::scientific);
- _CharT __sp = __os.widen(' ');
- __os.fill(__sp);
- size_t __n = __x.__p_.__b_.size();
- __os << __n;
- for (size_t __i = 0; __i < __n; ++__i)
- __os << __sp << __x.__p_.__b_[__i];
- __n = __x.__p_.__densities_.size();
- __os << __sp << __n;
- for (size_t __i = 0; __i < __n; ++__i)
- __os << __sp << __x.__p_.__densities_[__i];
- __n = __x.__p_.__areas_.size();
- __os << __sp << __n;
- for (size_t __i = 0; __i < __n; ++__i)
- __os << __sp << __x.__p_.__areas_[__i];
- return __os;
+operator<<(basic_ostream<_CharT, _Traits>& __os, const piecewise_constant_distribution<_RT>& __x) {
+ __save_flags<_CharT, _Traits> __lx(__os);
+ typedef basic_ostream<_CharT, _Traits> _OStream;
+ __os.flags(_OStream::dec | _OStream::left | _OStream::fixed | _OStream::scientific);
+ _CharT __sp = __os.widen(' ');
+ __os.fill(__sp);
+ size_t __n = __x.__p_.__b_.size();
+ __os << __n;
+ for (size_t __i = 0; __i < __n; ++__i)
+ __os << __sp << __x.__p_.__b_[__i];
+ __n = __x.__p_.__densities_.size();
+ __os << __sp << __n;
+ for (size_t __i = 0; __i < __n; ++__i)
+ __os << __sp << __x.__p_.__densities_[__i];
+ __n = __x.__p_.__areas_.size();
+ __os << __sp << __n;
+ for (size_t __i = 0; __i < __n; ++__i)
+ __os << __sp << __x.__p_.__areas_[__i];
+ return __os;
}
template <class _CharT, class _Traits, class _RT>
_LIBCPP_HIDE_FROM_ABI basic_istream<_CharT, _Traits>&
-operator>>(basic_istream<_CharT, _Traits>& __is,
- piecewise_constant_distribution<_RT>& __x)
-{
- typedef piecewise_constant_distribution<_RT> _Eng;
- typedef typename _Eng::result_type result_type;
- __save_flags<_CharT, _Traits> __lx(__is);
- typedef basic_istream<_CharT, _Traits> _Istream;
- __is.flags(_Istream::dec | _Istream::skipws);
- size_t __n;
- __is >> __n;
- vector<result_type> __b(__n);
- for (size_t __i = 0; __i < __n; ++__i)
- __is >> __b[__i];
- __is >> __n;
- vector<result_type> __densities(__n);
- for (size_t __i = 0; __i < __n; ++__i)
- __is >> __densities[__i];
- __is >> __n;
- vector<result_type> __areas(__n);
- for (size_t __i = 0; __i < __n; ++__i)
- __is >> __areas[__i];
- if (!__is.fail())
- {
- swap(__x.__p_.__b_, __b);
- swap(__x.__p_.__densities_, __densities);
- swap(__x.__p_.__areas_, __areas);
- }
- return __is;
+operator>>(basic_istream<_CharT, _Traits>& __is, piecewise_constant_distribution<_RT>& __x) {
+ typedef piecewise_constant_distribution<_RT> _Eng;
+ typedef typename _Eng::result_type result_type;
+ __save_flags<_CharT, _Traits> __lx(__is);
+ typedef basic_istream<_CharT, _Traits> _Istream;
+ __is.flags(_Istream::dec | _Istream::skipws);
+ size_t __n;
+ __is >> __n;
+ vector<result_type> __b(__n);
+ for (size_t __i = 0; __i < __n; ++__i)
+ __is >> __b[__i];
+ __is >> __n;
+ vector<result_type> __densities(__n);
+ for (size_t __i = 0; __i < __n; ++__i)
+ __is >> __densities[__i];
+ __is >> __n;
+ vector<result_type> __areas(__n);
+ for (size_t __i = 0; __i < __n; ++__i)
+ __is >> __areas[__i];
+ if (!__is.fail()) {
+ swap(__x.__p_.__b_, __b);
+ swap(__x.__p_.__densities_, __densities);
+ swap(__x.__p_.__areas_, __areas);
+ }
+ return __is;
}
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__random/piecewise_linear_distribution.h b/contrib/llvm-project/libcxx/include/__random/piecewise_linear_distribution.h
index 895f0f2dfe94..43769dc825e6 100644
--- a/contrib/llvm-project/libcxx/include/__random/piecewise_linear_distribution.h
+++ b/contrib/llvm-project/libcxx/include/__random/piecewise_linear_distribution.h
@@ -26,349 +26,286 @@ _LIBCPP_PUSH_MACROS
_LIBCPP_BEGIN_NAMESPACE_STD
-template<class _RealType = double>
-class _LIBCPP_TEMPLATE_VIS piecewise_linear_distribution
-{
+template <class _RealType = double>
+class _LIBCPP_TEMPLATE_VIS piecewise_linear_distribution {
static_assert(__libcpp_random_is_valid_realtype<_RealType>::value,
"RealType must be a supported floating-point type");
public:
- // types
- typedef _RealType result_type;
-
- class _LIBCPP_TEMPLATE_VIS param_type
- {
- vector<result_type> __b_;
- vector<result_type> __densities_;
- vector<result_type> __areas_;
- public:
- typedef piecewise_linear_distribution distribution_type;
-
- _LIBCPP_HIDE_FROM_ABI param_type();
- template<class _InputIteratorB, class _InputIteratorW>
- _LIBCPP_HIDE_FROM_ABI param_type(_InputIteratorB __f_b, _InputIteratorB __l_b,
- _InputIteratorW __f_w);
-#ifndef _LIBCPP_CXX03_LANG
- template<class _UnaryOperation>
- _LIBCPP_HIDE_FROM_ABI param_type(initializer_list<result_type> __bl, _UnaryOperation __fw);
-#endif // _LIBCPP_CXX03_LANG
- template<class _UnaryOperation>
- _LIBCPP_HIDE_FROM_ABI param_type(size_t __nw, result_type __xmin, result_type __xmax,
- _UnaryOperation __fw);
- _LIBCPP_HIDE_FROM_ABI param_type(param_type const&) = default;
- _LIBCPP_HIDE_FROM_ABI param_type & operator=(const param_type& __rhs);
-
- _LIBCPP_HIDE_FROM_ABI
- vector<result_type> intervals() const {return __b_;}
- _LIBCPP_HIDE_FROM_ABI
- vector<result_type> densities() const {return __densities_;}
-
- friend _LIBCPP_HIDE_FROM_ABI
- bool operator==(const param_type& __x, const param_type& __y)
- {return __x.__densities_ == __y.__densities_ && __x.__b_ == __y.__b_;}
- friend _LIBCPP_HIDE_FROM_ABI
- bool operator!=(const param_type& __x, const param_type& __y)
- {return !(__x == __y);}
-
- private:
- _LIBCPP_HIDE_FROM_ABI void __init();
-
- friend class piecewise_linear_distribution;
-
- template <class _CharT, class _Traits, class _RT>
- friend
- basic_ostream<_CharT, _Traits>&
- operator<<(basic_ostream<_CharT, _Traits>& __os,
- const piecewise_linear_distribution<_RT>& __x);
-
- template <class _CharT, class _Traits, class _RT>
- friend
- basic_istream<_CharT, _Traits>&
- operator>>(basic_istream<_CharT, _Traits>& __is,
- piecewise_linear_distribution<_RT>& __x);
- };
+ // types
+ typedef _RealType result_type;
-private:
- param_type __p_;
+ class _LIBCPP_TEMPLATE_VIS param_type {
+ vector<result_type> __b_;
+ vector<result_type> __densities_;
+ vector<result_type> __areas_;
-public:
- // constructor and reset functions
- _LIBCPP_HIDE_FROM_ABI
- piecewise_linear_distribution() {}
- template<class _InputIteratorB, class _InputIteratorW>
- _LIBCPP_HIDE_FROM_ABI
- piecewise_linear_distribution(_InputIteratorB __f_b,
- _InputIteratorB __l_b,
- _InputIteratorW __f_w)
- : __p_(__f_b, __l_b, __f_w) {}
+ public:
+ typedef piecewise_linear_distribution distribution_type;
+ _LIBCPP_HIDE_FROM_ABI param_type();
+ template <class _InputIteratorB, class _InputIteratorW>
+ _LIBCPP_HIDE_FROM_ABI param_type(_InputIteratorB __f_b, _InputIteratorB __l_b, _InputIteratorW __f_w);
#ifndef _LIBCPP_CXX03_LANG
- template<class _UnaryOperation>
- _LIBCPP_HIDE_FROM_ABI
- piecewise_linear_distribution(initializer_list<result_type> __bl,
- _UnaryOperation __fw)
- : __p_(__bl, __fw) {}
+ template <class _UnaryOperation>
+ _LIBCPP_HIDE_FROM_ABI param_type(initializer_list<result_type> __bl, _UnaryOperation __fw);
#endif // _LIBCPP_CXX03_LANG
+ template <class _UnaryOperation>
+ _LIBCPP_HIDE_FROM_ABI param_type(size_t __nw, result_type __xmin, result_type __xmax, _UnaryOperation __fw);
+ _LIBCPP_HIDE_FROM_ABI param_type(param_type const&) = default;
+ _LIBCPP_HIDE_FROM_ABI param_type& operator=(const param_type& __rhs);
- template<class _UnaryOperation>
- _LIBCPP_HIDE_FROM_ABI
- piecewise_linear_distribution(size_t __nw, result_type __xmin,
- result_type __xmax, _UnaryOperation __fw)
- : __p_(__nw, __xmin, __xmax, __fw) {}
-
- _LIBCPP_HIDE_FROM_ABI
- explicit piecewise_linear_distribution(const param_type& __p)
- : __p_(__p) {}
-
- _LIBCPP_HIDE_FROM_ABI
- void reset() {}
-
- // generating functions
- template<class _URNG>
- _LIBCPP_HIDE_FROM_ABI
- result_type operator()(_URNG& __g)
- {return (*this)(__g, __p_);}
- template<class _URNG>
- _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g, const param_type& __p);
-
- // property functions
- _LIBCPP_HIDE_FROM_ABI
- vector<result_type> intervals() const {return __p_.intervals();}
- _LIBCPP_HIDE_FROM_ABI
- vector<result_type> densities() const {return __p_.densities();}
-
- _LIBCPP_HIDE_FROM_ABI
- param_type param() const {return __p_;}
- _LIBCPP_HIDE_FROM_ABI
- void param(const param_type& __p) {__p_ = __p;}
-
- _LIBCPP_HIDE_FROM_ABI
- result_type min() const {return __p_.__b_.front();}
- _LIBCPP_HIDE_FROM_ABI
- result_type max() const {return __p_.__b_.back();}
-
- friend _LIBCPP_HIDE_FROM_ABI
- bool operator==(const piecewise_linear_distribution& __x,
- const piecewise_linear_distribution& __y)
- {return __x.__p_ == __y.__p_;}
- friend _LIBCPP_HIDE_FROM_ABI
- bool operator!=(const piecewise_linear_distribution& __x,
- const piecewise_linear_distribution& __y)
- {return !(__x == __y);}
+ _LIBCPP_HIDE_FROM_ABI vector<result_type> intervals() const { return __b_; }
+ _LIBCPP_HIDE_FROM_ABI vector<result_type> densities() const { return __densities_; }
+
+ friend _LIBCPP_HIDE_FROM_ABI bool operator==(const param_type& __x, const param_type& __y) {
+ return __x.__densities_ == __y.__densities_ && __x.__b_ == __y.__b_;
+ }
+ friend _LIBCPP_HIDE_FROM_ABI bool operator!=(const param_type& __x, const param_type& __y) { return !(__x == __y); }
+
+ private:
+ _LIBCPP_HIDE_FROM_ABI void __init();
+
+ friend class piecewise_linear_distribution;
template <class _CharT, class _Traits, class _RT>
- friend
- basic_ostream<_CharT, _Traits>&
- operator<<(basic_ostream<_CharT, _Traits>& __os,
- const piecewise_linear_distribution<_RT>& __x);
+ friend basic_ostream<_CharT, _Traits>&
+ operator<<(basic_ostream<_CharT, _Traits>& __os, const piecewise_linear_distribution<_RT>& __x);
template <class _CharT, class _Traits, class _RT>
- friend
- basic_istream<_CharT, _Traits>&
- operator>>(basic_istream<_CharT, _Traits>& __is,
- piecewise_linear_distribution<_RT>& __x);
+ friend basic_istream<_CharT, _Traits>&
+ operator>>(basic_istream<_CharT, _Traits>& __is, piecewise_linear_distribution<_RT>& __x);
+ };
+
+private:
+ param_type __p_;
+
+public:
+ // constructor and reset functions
+ _LIBCPP_HIDE_FROM_ABI piecewise_linear_distribution() {}
+ template <class _InputIteratorB, class _InputIteratorW>
+ _LIBCPP_HIDE_FROM_ABI
+ piecewise_linear_distribution(_InputIteratorB __f_b, _InputIteratorB __l_b, _InputIteratorW __f_w)
+ : __p_(__f_b, __l_b, __f_w) {}
+
+#ifndef _LIBCPP_CXX03_LANG
+ template <class _UnaryOperation>
+ _LIBCPP_HIDE_FROM_ABI piecewise_linear_distribution(initializer_list<result_type> __bl, _UnaryOperation __fw)
+ : __p_(__bl, __fw) {}
+#endif // _LIBCPP_CXX03_LANG
+
+ template <class _UnaryOperation>
+ _LIBCPP_HIDE_FROM_ABI
+ piecewise_linear_distribution(size_t __nw, result_type __xmin, result_type __xmax, _UnaryOperation __fw)
+ : __p_(__nw, __xmin, __xmax, __fw) {}
+
+ _LIBCPP_HIDE_FROM_ABI explicit piecewise_linear_distribution(const param_type& __p) : __p_(__p) {}
+
+ _LIBCPP_HIDE_FROM_ABI void reset() {}
+
+ // generating functions
+ template <class _URNG>
+ _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g) {
+ return (*this)(__g, __p_);
+ }
+ template <class _URNG>
+ _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g, const param_type& __p);
+
+ // property functions
+ _LIBCPP_HIDE_FROM_ABI vector<result_type> intervals() const { return __p_.intervals(); }
+ _LIBCPP_HIDE_FROM_ABI vector<result_type> densities() const { return __p_.densities(); }
+
+ _LIBCPP_HIDE_FROM_ABI param_type param() const { return __p_; }
+ _LIBCPP_HIDE_FROM_ABI void param(const param_type& __p) { __p_ = __p; }
+
+ _LIBCPP_HIDE_FROM_ABI result_type min() const { return __p_.__b_.front(); }
+ _LIBCPP_HIDE_FROM_ABI result_type max() const { return __p_.__b_.back(); }
+
+ friend _LIBCPP_HIDE_FROM_ABI bool
+ operator==(const piecewise_linear_distribution& __x, const piecewise_linear_distribution& __y) {
+ return __x.__p_ == __y.__p_;
+ }
+ friend _LIBCPP_HIDE_FROM_ABI bool
+ operator!=(const piecewise_linear_distribution& __x, const piecewise_linear_distribution& __y) {
+ return !(__x == __y);
+ }
+
+ template <class _CharT, class _Traits, class _RT>
+ friend basic_ostream<_CharT, _Traits>&
+ operator<<(basic_ostream<_CharT, _Traits>& __os, const piecewise_linear_distribution<_RT>& __x);
+
+ template <class _CharT, class _Traits, class _RT>
+ friend basic_istream<_CharT, _Traits>&
+ operator>>(basic_istream<_CharT, _Traits>& __is, piecewise_linear_distribution<_RT>& __x);
};
-template<class _RealType>
-typename piecewise_linear_distribution<_RealType>::param_type &
-piecewise_linear_distribution<_RealType>::param_type::operator=
- (const param_type& __rhs)
-{
-// These can throw
- __b_.reserve (__rhs.__b_.size ());
- __densities_.reserve(__rhs.__densities_.size());
- __areas_.reserve (__rhs.__areas_.size());
-
-// These can not throw
- __b_ = __rhs.__b_;
- __densities_ = __rhs.__densities_;
- __areas_ = __rhs.__areas_;
- return *this;
+template <class _RealType>
+typename piecewise_linear_distribution<_RealType>::param_type&
+piecewise_linear_distribution<_RealType>::param_type::operator=(const param_type& __rhs) {
+ // These can throw
+ __b_.reserve(__rhs.__b_.size());
+ __densities_.reserve(__rhs.__densities_.size());
+ __areas_.reserve(__rhs.__areas_.size());
+
+ // These can not throw
+ __b_ = __rhs.__b_;
+ __densities_ = __rhs.__densities_;
+ __areas_ = __rhs.__areas_;
+ return *this;
}
-
-template<class _RealType>
-void
-piecewise_linear_distribution<_RealType>::param_type::__init()
-{
- __areas_.assign(__densities_.size() - 1, result_type());
- result_type __sp = 0;
- for (size_t __i = 0; __i < __areas_.size(); ++__i)
- {
- __areas_[__i] = (__densities_[__i+1] + __densities_[__i]) *
- (__b_[__i+1] - __b_[__i]) * .5;
- __sp += __areas_[__i];
- }
- for (size_t __i = __areas_.size(); __i > 1;)
- {
- --__i;
- __areas_[__i] = __areas_[__i-1] / __sp;
- }
- __areas_[0] = 0;
- for (size_t __i = 1; __i < __areas_.size(); ++__i)
- __areas_[__i] += __areas_[__i-1];
- for (size_t __i = 0; __i < __densities_.size(); ++__i)
- __densities_[__i] /= __sp;
+template <class _RealType>
+void piecewise_linear_distribution<_RealType>::param_type::__init() {
+ __areas_.assign(__densities_.size() - 1, result_type());
+ result_type __sp = 0;
+ for (size_t __i = 0; __i < __areas_.size(); ++__i) {
+ __areas_[__i] = (__densities_[__i + 1] + __densities_[__i]) * (__b_[__i + 1] - __b_[__i]) * .5;
+ __sp += __areas_[__i];
+ }
+ for (size_t __i = __areas_.size(); __i > 1;) {
+ --__i;
+ __areas_[__i] = __areas_[__i - 1] / __sp;
+ }
+ __areas_[0] = 0;
+ for (size_t __i = 1; __i < __areas_.size(); ++__i)
+ __areas_[__i] += __areas_[__i - 1];
+ for (size_t __i = 0; __i < __densities_.size(); ++__i)
+ __densities_[__i] /= __sp;
}
-template<class _RealType>
-piecewise_linear_distribution<_RealType>::param_type::param_type()
- : __b_(2),
- __densities_(2, 1.0),
- __areas_(1, 0.0)
-{
- __b_[1] = 1;
+template <class _RealType>
+piecewise_linear_distribution<_RealType>::param_type::param_type() : __b_(2), __densities_(2, 1.0), __areas_(1, 0.0) {
+ __b_[1] = 1;
}
-template<class _RealType>
-template<class _InputIteratorB, class _InputIteratorW>
+template <class _RealType>
+template <class _InputIteratorB, class _InputIteratorW>
piecewise_linear_distribution<_RealType>::param_type::param_type(
- _InputIteratorB __f_b, _InputIteratorB __l_b, _InputIteratorW __f_w)
- : __b_(__f_b, __l_b)
-{
- if (__b_.size() < 2)
- {
- __b_.resize(2);
- __b_[0] = 0;
- __b_[1] = 1;
- __densities_.assign(2, 1.0);
- __areas_.assign(1, 0.0);
- }
- else
- {
- __densities_.reserve(__b_.size());
- for (size_t __i = 0; __i < __b_.size(); ++__i, ++__f_w)
- __densities_.push_back(*__f_w);
- __init();
- }
+ _InputIteratorB __f_b, _InputIteratorB __l_b, _InputIteratorW __f_w)
+ : __b_(__f_b, __l_b) {
+ if (__b_.size() < 2) {
+ __b_.resize(2);
+ __b_[0] = 0;
+ __b_[1] = 1;
+ __densities_.assign(2, 1.0);
+ __areas_.assign(1, 0.0);
+ } else {
+ __densities_.reserve(__b_.size());
+ for (size_t __i = 0; __i < __b_.size(); ++__i, ++__f_w)
+ __densities_.push_back(*__f_w);
+ __init();
+ }
}
#ifndef _LIBCPP_CXX03_LANG
-template<class _RealType>
-template<class _UnaryOperation>
+template <class _RealType>
+template <class _UnaryOperation>
piecewise_linear_distribution<_RealType>::param_type::param_type(
- initializer_list<result_type> __bl, _UnaryOperation __fw)
- : __b_(__bl.begin(), __bl.end())
-{
- if (__b_.size() < 2)
- {
- __b_.resize(2);
- __b_[0] = 0;
- __b_[1] = 1;
- __densities_.assign(2, 1.0);
- __areas_.assign(1, 0.0);
- }
- else
- {
- __densities_.reserve(__b_.size());
- for (size_t __i = 0; __i < __b_.size(); ++__i)
- __densities_.push_back(__fw(__b_[__i]));
- __init();
- }
+ initializer_list<result_type> __bl, _UnaryOperation __fw)
+ : __b_(__bl.begin(), __bl.end()) {
+ if (__b_.size() < 2) {
+ __b_.resize(2);
+ __b_[0] = 0;
+ __b_[1] = 1;
+ __densities_.assign(2, 1.0);
+ __areas_.assign(1, 0.0);
+ } else {
+ __densities_.reserve(__b_.size());
+ for (size_t __i = 0; __i < __b_.size(); ++__i)
+ __densities_.push_back(__fw(__b_[__i]));
+ __init();
+ }
}
#endif // _LIBCPP_CXX03_LANG
-template<class _RealType>
-template<class _UnaryOperation>
+template <class _RealType>
+template <class _UnaryOperation>
piecewise_linear_distribution<_RealType>::param_type::param_type(
- size_t __nw, result_type __xmin, result_type __xmax, _UnaryOperation __fw)
- : __b_(__nw == 0 ? 2 : __nw + 1)
-{
- size_t __n = __b_.size() - 1;
- result_type __d = (__xmax - __xmin) / __n;
- __densities_.reserve(__b_.size());
- for (size_t __i = 0; __i < __n; ++__i)
- {
- __b_[__i] = __xmin + __i * __d;
- __densities_.push_back(__fw(__b_[__i]));
- }
- __b_[__n] = __xmax;
- __densities_.push_back(__fw(__b_[__n]));
- __init();
+ size_t __nw, result_type __xmin, result_type __xmax, _UnaryOperation __fw)
+ : __b_(__nw == 0 ? 2 : __nw + 1) {
+ size_t __n = __b_.size() - 1;
+ result_type __d = (__xmax - __xmin) / __n;
+ __densities_.reserve(__b_.size());
+ for (size_t __i = 0; __i < __n; ++__i) {
+ __b_[__i] = __xmin + __i * __d;
+ __densities_.push_back(__fw(__b_[__i]));
+ }
+ __b_[__n] = __xmax;
+ __densities_.push_back(__fw(__b_[__n]));
+ __init();
}
-template<class _RealType>
-template<class _URNG>
-_RealType
-piecewise_linear_distribution<_RealType>::operator()(_URNG& __g, const param_type& __p)
-{
- static_assert(__libcpp_random_is_valid_urng<_URNG>::value, "");
- typedef uniform_real_distribution<result_type> _Gen;
- result_type __u = _Gen()(__g);
- ptrdiff_t __k = std::upper_bound(__p.__areas_.begin(), __p.__areas_.end(),
- __u) - __p.__areas_.begin() - 1;
- __u -= __p.__areas_[__k];
- const result_type __dk = __p.__densities_[__k];
- const result_type __dk1 = __p.__densities_[__k+1];
- const result_type __deltad = __dk1 - __dk;
- const result_type __bk = __p.__b_[__k];
- if (__deltad == 0)
- return __u / __dk + __bk;
- const result_type __bk1 = __p.__b_[__k+1];
- const result_type __deltab = __bk1 - __bk;
- return (__bk * __dk1 - __bk1 * __dk +
- std::sqrt(__deltab * (__deltab * __dk * __dk + 2 * __deltad * __u))) /
- __deltad;
+template <class _RealType>
+template <class _URNG>
+_RealType piecewise_linear_distribution<_RealType>::operator()(_URNG& __g, const param_type& __p) {
+ static_assert(__libcpp_random_is_valid_urng<_URNG>::value, "");
+ typedef uniform_real_distribution<result_type> _Gen;
+ result_type __u = _Gen()(__g);
+ ptrdiff_t __k = std::upper_bound(__p.__areas_.begin(), __p.__areas_.end(), __u) - __p.__areas_.begin() - 1;
+ __u -= __p.__areas_[__k];
+ const result_type __dk = __p.__densities_[__k];
+ const result_type __dk1 = __p.__densities_[__k + 1];
+ const result_type __deltad = __dk1 - __dk;
+ const result_type __bk = __p.__b_[__k];
+ if (__deltad == 0)
+ return __u / __dk + __bk;
+ const result_type __bk1 = __p.__b_[__k + 1];
+ const result_type __deltab = __bk1 - __bk;
+ return (__bk * __dk1 - __bk1 * __dk + std::sqrt(__deltab * (__deltab * __dk * __dk + 2 * __deltad * __u))) / __deltad;
}
template <class _CharT, class _Traits, class _RT>
_LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>&
-operator<<(basic_ostream<_CharT, _Traits>& __os,
- const piecewise_linear_distribution<_RT>& __x)
-{
- __save_flags<_CharT, _Traits> __lx(__os);
- typedef basic_ostream<_CharT, _Traits> _OStream;
- __os.flags(_OStream::dec | _OStream::left | _OStream::fixed |
- _OStream::scientific);
- _CharT __sp = __os.widen(' ');
- __os.fill(__sp);
- size_t __n = __x.__p_.__b_.size();
- __os << __n;
- for (size_t __i = 0; __i < __n; ++__i)
- __os << __sp << __x.__p_.__b_[__i];
- __n = __x.__p_.__densities_.size();
- __os << __sp << __n;
- for (size_t __i = 0; __i < __n; ++__i)
- __os << __sp << __x.__p_.__densities_[__i];
- __n = __x.__p_.__areas_.size();
- __os << __sp << __n;
- for (size_t __i = 0; __i < __n; ++__i)
- __os << __sp << __x.__p_.__areas_[__i];
- return __os;
+operator<<(basic_ostream<_CharT, _Traits>& __os, const piecewise_linear_distribution<_RT>& __x) {
+ __save_flags<_CharT, _Traits> __lx(__os);
+ typedef basic_ostream<_CharT, _Traits> _OStream;
+ __os.flags(_OStream::dec | _OStream::left | _OStream::fixed | _OStream::scientific);
+ _CharT __sp = __os.widen(' ');
+ __os.fill(__sp);
+ size_t __n = __x.__p_.__b_.size();
+ __os << __n;
+ for (size_t __i = 0; __i < __n; ++__i)
+ __os << __sp << __x.__p_.__b_[__i];
+ __n = __x.__p_.__densities_.size();
+ __os << __sp << __n;
+ for (size_t __i = 0; __i < __n; ++__i)
+ __os << __sp << __x.__p_.__densities_[__i];
+ __n = __x.__p_.__areas_.size();
+ __os << __sp << __n;
+ for (size_t __i = 0; __i < __n; ++__i)
+ __os << __sp << __x.__p_.__areas_[__i];
+ return __os;
}
template <class _CharT, class _Traits, class _RT>
_LIBCPP_HIDE_FROM_ABI basic_istream<_CharT, _Traits>&
-operator>>(basic_istream<_CharT, _Traits>& __is,
- piecewise_linear_distribution<_RT>& __x)
-{
- typedef piecewise_linear_distribution<_RT> _Eng;
- typedef typename _Eng::result_type result_type;
- __save_flags<_CharT, _Traits> __lx(__is);
- typedef basic_istream<_CharT, _Traits> _Istream;
- __is.flags(_Istream::dec | _Istream::skipws);
- size_t __n;
- __is >> __n;
- vector<result_type> __b(__n);
- for (size_t __i = 0; __i < __n; ++__i)
- __is >> __b[__i];
- __is >> __n;
- vector<result_type> __densities(__n);
- for (size_t __i = 0; __i < __n; ++__i)
- __is >> __densities[__i];
- __is >> __n;
- vector<result_type> __areas(__n);
- for (size_t __i = 0; __i < __n; ++__i)
- __is >> __areas[__i];
- if (!__is.fail())
- {
- swap(__x.__p_.__b_, __b);
- swap(__x.__p_.__densities_, __densities);
- swap(__x.__p_.__areas_, __areas);
- }
- return __is;
+operator>>(basic_istream<_CharT, _Traits>& __is, piecewise_linear_distribution<_RT>& __x) {
+ typedef piecewise_linear_distribution<_RT> _Eng;
+ typedef typename _Eng::result_type result_type;
+ __save_flags<_CharT, _Traits> __lx(__is);
+ typedef basic_istream<_CharT, _Traits> _Istream;
+ __is.flags(_Istream::dec | _Istream::skipws);
+ size_t __n;
+ __is >> __n;
+ vector<result_type> __b(__n);
+ for (size_t __i = 0; __i < __n; ++__i)
+ __is >> __b[__i];
+ __is >> __n;
+ vector<result_type> __densities(__n);
+ for (size_t __i = 0; __i < __n; ++__i)
+ __is >> __densities[__i];
+ __is >> __n;
+ vector<result_type> __areas(__n);
+ for (size_t __i = 0; __i < __n; ++__i)
+ __is >> __areas[__i];
+ if (!__is.fail()) {
+ swap(__x.__p_.__b_, __b);
+ swap(__x.__p_.__densities_, __densities);
+ swap(__x.__p_.__areas_, __areas);
+ }
+ return __is;
}
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__random/poisson_distribution.h b/contrib/llvm-project/libcxx/include/__random/poisson_distribution.h
index 12641addf494..61a092ef9dd4 100644
--- a/contrib/llvm-project/libcxx/include/__random/poisson_distribution.h
+++ b/contrib/llvm-project/libcxx/include/__random/poisson_distribution.h
@@ -28,250 +28,210 @@ _LIBCPP_PUSH_MACROS
_LIBCPP_BEGIN_NAMESPACE_STD
-template<class _IntType = int>
-class _LIBCPP_TEMPLATE_VIS poisson_distribution
-{
- static_assert(__libcpp_random_is_valid_inttype<_IntType>::value, "IntType must be a supported integer type");
-public:
- // types
- typedef _IntType result_type;
-
- class _LIBCPP_TEMPLATE_VIS param_type
- {
- double __mean_;
- double __s_;
- double __d_;
- double __l_;
- double __omega_;
- double __c0_;
- double __c1_;
- double __c2_;
- double __c3_;
- double __c_;
-
- public:
- typedef poisson_distribution distribution_type;
-
- _LIBCPP_HIDE_FROM_ABI explicit param_type(double __mean = 1.0);
+template <class _IntType = int>
+class _LIBCPP_TEMPLATE_VIS poisson_distribution {
+ static_assert(__libcpp_random_is_valid_inttype<_IntType>::value, "IntType must be a supported integer type");
- _LIBCPP_HIDE_FROM_ABI
- double mean() const {return __mean_;}
-
- friend _LIBCPP_HIDE_FROM_ABI
- bool operator==(const param_type& __x, const param_type& __y)
- {return __x.__mean_ == __y.__mean_;}
- friend _LIBCPP_HIDE_FROM_ABI
- bool operator!=(const param_type& __x, const param_type& __y)
- {return !(__x == __y);}
+public:
+ // types
+ typedef _IntType result_type;
+
+ class _LIBCPP_TEMPLATE_VIS param_type {
+ double __mean_;
+ double __s_;
+ double __d_;
+ double __l_;
+ double __omega_;
+ double __c0_;
+ double __c1_;
+ double __c2_;
+ double __c3_;
+ double __c_;
+
+ public:
+ typedef poisson_distribution distribution_type;
+
+ _LIBCPP_HIDE_FROM_ABI explicit param_type(double __mean = 1.0);
+
+ _LIBCPP_HIDE_FROM_ABI double mean() const { return __mean_; }
+
+ friend _LIBCPP_HIDE_FROM_ABI bool operator==(const param_type& __x, const param_type& __y) {
+ return __x.__mean_ == __y.__mean_;
+ }
+ friend _LIBCPP_HIDE_FROM_ABI bool operator!=(const param_type& __x, const param_type& __y) { return !(__x == __y); }
- friend class poisson_distribution;
- };
+ friend class poisson_distribution;
+ };
private:
- param_type __p_;
+ param_type __p_;
public:
- // constructors and reset functions
+ // constructors and reset functions
#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI
- poisson_distribution() : poisson_distribution(1.0) {}
- _LIBCPP_HIDE_FROM_ABI
- explicit poisson_distribution(double __mean)
- : __p_(__mean) {}
+ _LIBCPP_HIDE_FROM_ABI poisson_distribution() : poisson_distribution(1.0) {}
+ _LIBCPP_HIDE_FROM_ABI explicit poisson_distribution(double __mean) : __p_(__mean) {}
#else
- _LIBCPP_HIDE_FROM_ABI
- explicit poisson_distribution(double __mean = 1.0)
- : __p_(__mean) {}
+ _LIBCPP_HIDE_FROM_ABI explicit poisson_distribution(double __mean = 1.0) : __p_(__mean) {}
#endif
- _LIBCPP_HIDE_FROM_ABI
- explicit poisson_distribution(const param_type& __p) : __p_(__p) {}
- _LIBCPP_HIDE_FROM_ABI
- void reset() {}
-
- // generating functions
- template<class _URNG>
- _LIBCPP_HIDE_FROM_ABI
- result_type operator()(_URNG& __g)
- {return (*this)(__g, __p_);}
- template<class _URNG>
- _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g, const param_type& __p);
-
- // property functions
- _LIBCPP_HIDE_FROM_ABI
- double mean() const {return __p_.mean();}
-
- _LIBCPP_HIDE_FROM_ABI
- param_type param() const {return __p_;}
- _LIBCPP_HIDE_FROM_ABI
- void param(const param_type& __p) {__p_ = __p;}
-
- _LIBCPP_HIDE_FROM_ABI
- result_type min() const {return 0;}
- _LIBCPP_HIDE_FROM_ABI
- result_type max() const {return numeric_limits<result_type>::max();}
-
- friend _LIBCPP_HIDE_FROM_ABI
- bool operator==(const poisson_distribution& __x,
- const poisson_distribution& __y)
- {return __x.__p_ == __y.__p_;}
- friend _LIBCPP_HIDE_FROM_ABI
- bool operator!=(const poisson_distribution& __x,
- const poisson_distribution& __y)
- {return !(__x == __y);}
+ _LIBCPP_HIDE_FROM_ABI explicit poisson_distribution(const param_type& __p) : __p_(__p) {}
+ _LIBCPP_HIDE_FROM_ABI void reset() {}
+
+ // generating functions
+ template <class _URNG>
+ _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g) {
+ return (*this)(__g, __p_);
+ }
+ template <class _URNG>
+ _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g, const param_type& __p);
+
+ // property functions
+ _LIBCPP_HIDE_FROM_ABI double mean() const { return __p_.mean(); }
+
+ _LIBCPP_HIDE_FROM_ABI param_type param() const { return __p_; }
+ _LIBCPP_HIDE_FROM_ABI void param(const param_type& __p) { __p_ = __p; }
+
+ _LIBCPP_HIDE_FROM_ABI result_type min() const { return 0; }
+ _LIBCPP_HIDE_FROM_ABI result_type max() const { return numeric_limits<result_type>::max(); }
+
+ friend _LIBCPP_HIDE_FROM_ABI bool operator==(const poisson_distribution& __x, const poisson_distribution& __y) {
+ return __x.__p_ == __y.__p_;
+ }
+ friend _LIBCPP_HIDE_FROM_ABI bool operator!=(const poisson_distribution& __x, const poisson_distribution& __y) {
+ return !(__x == __y);
+ }
};
-template<class _IntType>
+template <class _IntType>
poisson_distribution<_IntType>::param_type::param_type(double __mean)
// According to the standard `inf` is a valid input, but it causes the
// distribution to hang, so we replace it with the maximum representable
// mean.
- : __mean_(isinf(__mean) ? numeric_limits<double>::max() : __mean)
-{
- if (__mean_ < 10)
- {
- __s_ = 0;
- __d_ = 0;
- __l_ = std::exp(-__mean_);
- __omega_ = 0;
- __c3_ = 0;
- __c2_ = 0;
- __c1_ = 0;
- __c0_ = 0;
- __c_ = 0;
- }
- else
- {
- __s_ = std::sqrt(__mean_);
- __d_ = 6 * __mean_ * __mean_;
- __l_ = std::trunc(__mean_ - 1.1484);
- __omega_ = .3989423 / __s_;
- double __b1 = .4166667E-1 / __mean_;
- double __b2 = .3 * __b1 * __b1;
- __c3_ = .1428571 * __b1 * __b2;
- __c2_ = __b2 - 15. * __c3_;
- __c1_ = __b1 - 6. * __b2 + 45. * __c3_;
- __c0_ = 1. - __b1 + 3. * __b2 - 15. * __c3_;
- __c_ = .1069 / __mean_;
- }
+ : __mean_(isinf(__mean) ? numeric_limits<double>::max() : __mean) {
+ if (__mean_ < 10) {
+ __s_ = 0;
+ __d_ = 0;
+ __l_ = std::exp(-__mean_);
+ __omega_ = 0;
+ __c3_ = 0;
+ __c2_ = 0;
+ __c1_ = 0;
+ __c0_ = 0;
+ __c_ = 0;
+ } else {
+ __s_ = std::sqrt(__mean_);
+ __d_ = 6 * __mean_ * __mean_;
+ __l_ = std::trunc(__mean_ - 1.1484);
+ __omega_ = .3989423 / __s_;
+ double __b1 = .4166667E-1 / __mean_;
+ double __b2 = .3 * __b1 * __b1;
+ __c3_ = .1428571 * __b1 * __b2;
+ __c2_ = __b2 - 15. * __c3_;
+ __c1_ = __b1 - 6. * __b2 + 45. * __c3_;
+ __c0_ = 1. - __b1 + 3. * __b2 - 15. * __c3_;
+ __c_ = .1069 / __mean_;
+ }
}
template <class _IntType>
-template<class _URNG>
-_IntType
-poisson_distribution<_IntType>::operator()(_URNG& __urng, const param_type& __pr)
-{
- static_assert(__libcpp_random_is_valid_urng<_URNG>::value, "");
- double __tx;
- uniform_real_distribution<double> __urd;
- if (__pr.__mean_ < 10)
- {
- __tx = 0;
- for (double __p = __urd(__urng); __p > __pr.__l_; ++__tx)
- __p *= __urd(__urng);
+template <class _URNG>
+_IntType poisson_distribution<_IntType>::operator()(_URNG& __urng, const param_type& __pr) {
+ static_assert(__libcpp_random_is_valid_urng<_URNG>::value, "");
+ double __tx;
+ uniform_real_distribution<double> __urd;
+ if (__pr.__mean_ < 10) {
+ __tx = 0;
+ for (double __p = __urd(__urng); __p > __pr.__l_; ++__tx)
+ __p *= __urd(__urng);
+ } else {
+ double __difmuk;
+ double __g = __pr.__mean_ + __pr.__s_ * normal_distribution<double>()(__urng);
+ double __u;
+ if (__g > 0) {
+ __tx = std::trunc(__g);
+ if (__tx >= __pr.__l_)
+ return std::__clamp_to_integral<result_type>(__tx);
+ __difmuk = __pr.__mean_ - __tx;
+ __u = __urd(__urng);
+ if (__pr.__d_ * __u >= __difmuk * __difmuk * __difmuk)
+ return std::__clamp_to_integral<result_type>(__tx);
}
- else
- {
- double __difmuk;
- double __g = __pr.__mean_ + __pr.__s_ * normal_distribution<double>()(__urng);
- double __u;
- if (__g > 0)
- {
- __tx = std::trunc(__g);
- if (__tx >= __pr.__l_)
- return std::__clamp_to_integral<result_type>(__tx);
- __difmuk = __pr.__mean_ - __tx;
- __u = __urd(__urng);
- if (__pr.__d_ * __u >= __difmuk * __difmuk * __difmuk)
- return std::__clamp_to_integral<result_type>(__tx);
- }
- exponential_distribution<double> __edist;
- for (bool __using_exp_dist = false; true; __using_exp_dist = true)
- {
- double __e;
- if (__using_exp_dist || __g <= 0)
- {
- double __t;
- do
- {
- __e = __edist(__urng);
- __u = __urd(__urng);
- __u += __u - 1;
- __t = 1.8 + (__u < 0 ? -__e : __e);
- } while (__t <= -.6744);
- __tx = std::trunc(__pr.__mean_ + __pr.__s_ * __t);
- __difmuk = __pr.__mean_ - __tx;
- __using_exp_dist = true;
- }
- double __px;
- double __py;
- if (__tx < 10 && __tx >= 0)
- {
- const double __fac[] = {1, 1, 2, 6, 24, 120, 720, 5040,
- 40320, 362880};
- __px = -__pr.__mean_;
- __py = std::pow(__pr.__mean_, (double)__tx) / __fac[static_cast<int>(__tx)];
- }
- else
- {
- double __del = .8333333E-1 / __tx;
- __del -= 4.8 * __del * __del * __del;
- double __v = __difmuk / __tx;
- if (std::abs(__v) > 0.25)
- __px = __tx * std::log(1 + __v) - __difmuk - __del;
- else
- __px = __tx * __v * __v * (((((((.1250060 * __v + -.1384794) *
- __v + .1421878) * __v + -.1661269) * __v + .2000118) *
- __v + -.2500068) * __v + .3333333) * __v + -.5) - __del;
- __py = .3989423 / std::sqrt(__tx);
- }
- double __r = (0.5 - __difmuk) / __pr.__s_;
- double __r2 = __r * __r;
- double __fx = -0.5 * __r2;
- double __fy = __pr.__omega_ * (((__pr.__c3_ * __r2 + __pr.__c2_) *
- __r2 + __pr.__c1_) * __r2 + __pr.__c0_);
- if (__using_exp_dist)
- {
- if (__pr.__c_ * std::abs(__u) <= __py * std::exp(__px + __e) -
- __fy * std::exp(__fx + __e))
- break;
- }
- else
- {
- if (__fy - __u * __fy <= __py * std::exp(__px - __fx))
- break;
- }
- }
+ exponential_distribution<double> __edist;
+ for (bool __using_exp_dist = false; true; __using_exp_dist = true) {
+ double __e;
+ if (__using_exp_dist || __g <= 0) {
+ double __t;
+ do {
+ __e = __edist(__urng);
+ __u = __urd(__urng);
+ __u += __u - 1;
+ __t = 1.8 + (__u < 0 ? -__e : __e);
+ } while (__t <= -.6744);
+ __tx = std::trunc(__pr.__mean_ + __pr.__s_ * __t);
+ __difmuk = __pr.__mean_ - __tx;
+ __using_exp_dist = true;
+ }
+ double __px;
+ double __py;
+ if (__tx < 10 && __tx >= 0) {
+ const double __fac[] = {1, 1, 2, 6, 24, 120, 720, 5040, 40320, 362880};
+ __px = -__pr.__mean_;
+ __py = std::pow(__pr.__mean_, (double)__tx) / __fac[static_cast<int>(__tx)];
+ } else {
+ double __del = .8333333E-1 / __tx;
+ __del -= 4.8 * __del * __del * __del;
+ double __v = __difmuk / __tx;
+ if (std::abs(__v) > 0.25)
+ __px = __tx * std::log(1 + __v) - __difmuk - __del;
+ else
+ __px = __tx * __v * __v *
+ (((((((.1250060 * __v + -.1384794) * __v + .1421878) * __v + -.1661269) * __v + .2000118) * __v +
+ -.2500068) *
+ __v +
+ .3333333) *
+ __v +
+ -.5) -
+ __del;
+ __py = .3989423 / std::sqrt(__tx);
+ }
+ double __r = (0.5 - __difmuk) / __pr.__s_;
+ double __r2 = __r * __r;
+ double __fx = -0.5 * __r2;
+ double __fy = __pr.__omega_ * (((__pr.__c3_ * __r2 + __pr.__c2_) * __r2 + __pr.__c1_) * __r2 + __pr.__c0_);
+ if (__using_exp_dist) {
+ if (__pr.__c_ * std::abs(__u) <= __py * std::exp(__px + __e) - __fy * std::exp(__fx + __e))
+ break;
+ } else {
+ if (__fy - __u * __fy <= __py * std::exp(__px - __fx))
+ break;
+ }
}
- return std::__clamp_to_integral<result_type>(__tx);
+ }
+ return std::__clamp_to_integral<result_type>(__tx);
}
template <class _CharT, class _Traits, class _IntType>
_LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>&
-operator<<(basic_ostream<_CharT, _Traits>& __os,
- const poisson_distribution<_IntType>& __x)
-{
- __save_flags<_CharT, _Traits> __lx(__os);
- typedef basic_ostream<_CharT, _Traits> _OStream;
- __os.flags(_OStream::dec | _OStream::left | _OStream::fixed |
- _OStream::scientific);
- return __os << __x.mean();
+operator<<(basic_ostream<_CharT, _Traits>& __os, const poisson_distribution<_IntType>& __x) {
+ __save_flags<_CharT, _Traits> __lx(__os);
+ typedef basic_ostream<_CharT, _Traits> _OStream;
+ __os.flags(_OStream::dec | _OStream::left | _OStream::fixed | _OStream::scientific);
+ return __os << __x.mean();
}
template <class _CharT, class _Traits, class _IntType>
_LIBCPP_HIDE_FROM_ABI basic_istream<_CharT, _Traits>&
-operator>>(basic_istream<_CharT, _Traits>& __is,
- poisson_distribution<_IntType>& __x)
-{
- typedef poisson_distribution<_IntType> _Eng;
- typedef typename _Eng::param_type param_type;
- __save_flags<_CharT, _Traits> __lx(__is);
- typedef basic_istream<_CharT, _Traits> _Istream;
- __is.flags(_Istream::dec | _Istream::skipws);
- double __mean;
- __is >> __mean;
- if (!__is.fail())
- __x.param(param_type(__mean));
- return __is;
+operator>>(basic_istream<_CharT, _Traits>& __is, poisson_distribution<_IntType>& __x) {
+ typedef poisson_distribution<_IntType> _Eng;
+ typedef typename _Eng::param_type param_type;
+ __save_flags<_CharT, _Traits> __lx(__is);
+ typedef basic_istream<_CharT, _Traits> _Istream;
+ __is.flags(_Istream::dec | _Istream::skipws);
+ double __mean;
+ __is >> __mean;
+ if (!__is.fail())
+ __x.param(param_type(__mean));
+ return __is;
}
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__random/random_device.h b/contrib/llvm-project/libcxx/include/__random/random_device.h
index ad75165b7474..52407943d2ec 100644
--- a/contrib/llvm-project/libcxx/include/__random/random_device.h
+++ b/contrib/llvm-project/libcxx/include/__random/random_device.h
@@ -23,56 +23,53 @@ _LIBCPP_BEGIN_NAMESPACE_STD
#if !defined(_LIBCPP_HAS_NO_RANDOM_DEVICE)
-class _LIBCPP_EXPORTED_FROM_ABI random_device
-{
-#ifdef _LIBCPP_USING_DEV_RANDOM
- int __f_;
-#elif !defined(_LIBCPP_ABI_NO_RANDOM_DEVICE_COMPATIBILITY_LAYOUT)
- _LIBCPP_DIAGNOSTIC_PUSH
- _LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Wunused-private-field")
-
- // Apple platforms used to use the `_LIBCPP_USING_DEV_RANDOM` code path, and now
- // use `arc4random()` as of this comment. In order to avoid breaking the ABI, we
- // retain the same layout as before.
-# if defined(__APPLE__)
- int __padding_; // padding to fake the `__f_` field above
-# endif
-
- // ... vendors can add workarounds here if they switch to a different representation ...
-
- _LIBCPP_DIAGNOSTIC_POP
-#endif
+class _LIBCPP_EXPORTED_FROM_ABI random_device {
+# ifdef _LIBCPP_USING_DEV_RANDOM
+ int __f_;
+# elif !defined(_LIBCPP_ABI_NO_RANDOM_DEVICE_COMPATIBILITY_LAYOUT)
+ _LIBCPP_DIAGNOSTIC_PUSH
+ _LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Wunused-private-field")
+
+ // Apple platforms used to use the `_LIBCPP_USING_DEV_RANDOM` code path, and now
+ // use `arc4random()` as of this comment. In order to avoid breaking the ABI, we
+ // retain the same layout as before.
+# if defined(__APPLE__)
+ int __padding_; // padding to fake the `__f_` field above
+# endif
+
+ // ... vendors can add workarounds here if they switch to a different representation ...
+
+ _LIBCPP_DIAGNOSTIC_POP
+# endif
public:
- // types
- typedef unsigned result_type;
-
- // generator characteristics
- static _LIBCPP_CONSTEXPR const result_type _Min = 0;
- static _LIBCPP_CONSTEXPR const result_type _Max = 0xFFFFFFFFu;
-
- _LIBCPP_HIDE_FROM_ABI
- static _LIBCPP_CONSTEXPR result_type min() { return _Min;}
- _LIBCPP_HIDE_FROM_ABI
- static _LIBCPP_CONSTEXPR result_type max() { return _Max;}
-
- // constructors
-#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI random_device() : random_device("/dev/urandom") {}
- explicit random_device(const string& __token);
-#else
- explicit random_device(const string& __token = "/dev/urandom");
-#endif
- ~random_device();
+ // types
+ typedef unsigned result_type;
+
+ // generator characteristics
+ static _LIBCPP_CONSTEXPR const result_type _Min = 0;
+ static _LIBCPP_CONSTEXPR const result_type _Max = 0xFFFFFFFFu;
+
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR result_type min() { return _Min; }
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR result_type max() { return _Max; }
+
+ // constructors
+# ifndef _LIBCPP_CXX03_LANG
+ _LIBCPP_HIDE_FROM_ABI random_device() : random_device("/dev/urandom") {}
+ explicit random_device(const string& __token);
+# else
+ explicit random_device(const string& __token = "/dev/urandom");
+# endif
+ ~random_device();
- // generating functions
- result_type operator()();
+ // generating functions
+ result_type operator()();
- // property functions
- double entropy() const _NOEXCEPT;
+ // property functions
+ double entropy() const _NOEXCEPT;
- random_device(const random_device&) = delete;
- void operator=(const random_device&) = delete;
+ random_device(const random_device&) = delete;
+ void operator=(const random_device&) = delete;
};
#endif // !_LIBCPP_HAS_NO_RANDOM_DEVICE
diff --git a/contrib/llvm-project/libcxx/include/__random/ranlux.h b/contrib/llvm-project/libcxx/include/__random/ranlux.h
index e44cece39dfc..952afde91b10 100644
--- a/contrib/llvm-project/libcxx/include/__random/ranlux.h
+++ b/contrib/llvm-project/libcxx/include/__random/ranlux.h
@@ -21,7 +21,7 @@
_LIBCPP_BEGIN_NAMESPACE_STD
typedef subtract_with_carry_engine<uint_fast32_t, 24, 10, 24> ranlux24_base;
-typedef subtract_with_carry_engine<uint_fast64_t, 48, 5, 12> ranlux48_base;
+typedef subtract_with_carry_engine<uint_fast64_t, 48, 5, 12> ranlux48_base;
typedef discard_block_engine<ranlux24_base, 223, 23> ranlux24;
typedef discard_block_engine<ranlux48_base, 389, 11> ranlux48;
diff --git a/contrib/llvm-project/libcxx/include/__random/seed_seq.h b/contrib/llvm-project/libcxx/include/__random/seed_seq.h
index 7ae9f492c8af..17a7de02fbd3 100644
--- a/contrib/llvm-project/libcxx/include/__random/seed_seq.h
+++ b/contrib/llvm-project/libcxx/include/__random/seed_seq.h
@@ -27,149 +27,130 @@ _LIBCPP_PUSH_MACROS
_LIBCPP_BEGIN_NAMESPACE_STD
-class _LIBCPP_TEMPLATE_VIS seed_seq
-{
+class _LIBCPP_TEMPLATE_VIS seed_seq {
public:
- // types
- typedef uint32_t result_type;
+ // types
+ typedef uint32_t result_type;
- // constructors
- _LIBCPP_HIDE_FROM_ABI
- seed_seq() _NOEXCEPT {}
+ // constructors
+ _LIBCPP_HIDE_FROM_ABI seed_seq() _NOEXCEPT {}
#ifndef _LIBCPP_CXX03_LANG
- template<class _Tp, __enable_if_t<is_integral<_Tp>::value>* = nullptr>
- _LIBCPP_HIDE_FROM_ABI
- seed_seq(initializer_list<_Tp> __il) {
- __init(__il.begin(), __il.end());
- }
+ template <class _Tp, __enable_if_t<is_integral<_Tp>::value>* = nullptr>
+ _LIBCPP_HIDE_FROM_ABI seed_seq(initializer_list<_Tp> __il) {
+ __init(__il.begin(), __il.end());
+ }
#endif // _LIBCPP_CXX03_LANG
- template<class _InputIterator>
- _LIBCPP_HIDE_FROM_ABI
- seed_seq(_InputIterator __first, _InputIterator __last) {
- static_assert(is_integral<typename iterator_traits<_InputIterator>::value_type>::value,
- "Mandates: iterator_traits<InputIterator>::value_type is an integer type");
- __init(__first, __last);
- }
+ template <class _InputIterator>
+ _LIBCPP_HIDE_FROM_ABI seed_seq(_InputIterator __first, _InputIterator __last) {
+ static_assert(is_integral<typename iterator_traits<_InputIterator>::value_type>::value,
+ "Mandates: iterator_traits<InputIterator>::value_type is an integer type");
+ __init(__first, __last);
+ }
- // generating functions
- template<class _RandomAccessIterator>
- _LIBCPP_HIDE_FROM_ABI void generate(_RandomAccessIterator __first, _RandomAccessIterator __last);
+ // generating functions
+ template <class _RandomAccessIterator>
+ _LIBCPP_HIDE_FROM_ABI void generate(_RandomAccessIterator __first, _RandomAccessIterator __last);
- // property functions
- _LIBCPP_HIDE_FROM_ABI
- size_t size() const _NOEXCEPT {return __v_.size();}
- template<class _OutputIterator>
- _LIBCPP_HIDE_FROM_ABI
- void param(_OutputIterator __dest) const
- {std::copy(__v_.begin(), __v_.end(), __dest);}
+ // property functions
+ _LIBCPP_HIDE_FROM_ABI size_t size() const _NOEXCEPT { return __v_.size(); }
+ template <class _OutputIterator>
+ _LIBCPP_HIDE_FROM_ABI void param(_OutputIterator __dest) const {
+ std::copy(__v_.begin(), __v_.end(), __dest);
+ }
- seed_seq(const seed_seq&) = delete;
- void operator=(const seed_seq&) = delete;
+ seed_seq(const seed_seq&) = delete;
+ void operator=(const seed_seq&) = delete;
- _LIBCPP_HIDE_FROM_ABI
- static result_type _Tp(result_type __x) {return __x ^ (__x >> 27);}
+ _LIBCPP_HIDE_FROM_ABI static result_type _Tp(result_type __x) { return __x ^ (__x >> 27); }
private:
- template<class _InputIterator>
- _LIBCPP_HIDE_FROM_ABI void __init(_InputIterator __first, _InputIterator __last);
+ template <class _InputIterator>
+ _LIBCPP_HIDE_FROM_ABI void __init(_InputIterator __first, _InputIterator __last);
- vector<result_type> __v_;
+ vector<result_type> __v_;
};
-template<class _InputIterator>
-void
-seed_seq::__init(_InputIterator __first, _InputIterator __last)
-{
- for (_InputIterator __s = __first; __s != __last; ++__s)
- __v_.push_back(*__s & 0xFFFFFFFF);
+template <class _InputIterator>
+void seed_seq::__init(_InputIterator __first, _InputIterator __last) {
+ for (_InputIterator __s = __first; __s != __last; ++__s)
+ __v_.push_back(*__s & 0xFFFFFFFF);
}
-template<class _RandomAccessIterator>
-void
-seed_seq::generate(_RandomAccessIterator __first, _RandomAccessIterator __last)
-{
- if (__first != __last)
+template <class _RandomAccessIterator>
+void seed_seq::generate(_RandomAccessIterator __first, _RandomAccessIterator __last) {
+ if (__first != __last) {
+ std::fill(__first, __last, 0x8b8b8b8b);
+ const size_t __n = static_cast<size_t>(__last - __first);
+ const size_t __s = __v_.size();
+ const size_t __t = (__n >= 623) ? 11 : (__n >= 68) ? 7 : (__n >= 39) ? 5 : (__n >= 7) ? 3 : (__n - 1) / 2;
+ const size_t __p = (__n - __t) / 2;
+ const size_t __q = __p + __t;
+ const size_t __m = std::max(__s + 1, __n);
+ // __k = 0;
{
- std::fill(__first, __last, 0x8b8b8b8b);
- const size_t __n = static_cast<size_t>(__last - __first);
- const size_t __s = __v_.size();
- const size_t __t = (__n >= 623) ? 11
- : (__n >= 68) ? 7
- : (__n >= 39) ? 5
- : (__n >= 7) ? 3
- : (__n - 1) / 2;
- const size_t __p = (__n - __t) / 2;
- const size_t __q = __p + __t;
- const size_t __m = std::max(__s + 1, __n);
- // __k = 0;
- {
- result_type __r = 1664525 * _Tp(__first[0] ^ __first[__p]
- ^ __first[__n - 1]);
- __first[__p] += __r;
- __r += __s;
- __first[__q] += __r;
- __first[0] = __r;
- }
- // Initialize indexing terms used with if statements as an optimization to
- // avoid calculating modulo n on every loop iteration for each term.
- size_t __kmodn = 0; // __k % __n
- size_t __k1modn = __n - 1; // (__k - 1) % __n
- size_t __kpmodn = __p % __n; // (__k + __p) % __n
- size_t __kqmodn = __q % __n; // (__k + __q) % __n
-
- for (size_t __k = 1; __k <= __s; ++__k)
- {
- if (++__kmodn == __n)
- __kmodn = 0;
- if (++__k1modn == __n)
- __k1modn = 0;
- if (++__kpmodn == __n)
- __kpmodn = 0;
- if (++__kqmodn == __n)
- __kqmodn = 0;
-
- result_type __r = 1664525 * _Tp(__first[__kmodn] ^ __first[__kpmodn] ^ __first[__k1modn]);
- __first[__kpmodn] += __r;
- __r += __kmodn + __v_[__k - 1];
- __first[__kqmodn] += __r;
- __first[__kmodn] = __r;
- }
- for (size_t __k = __s + 1; __k < __m; ++__k)
- {
- if (++__kmodn == __n)
- __kmodn = 0;
- if (++__k1modn == __n)
- __k1modn = 0;
- if (++__kpmodn == __n)
- __kpmodn = 0;
- if (++__kqmodn == __n)
- __kqmodn = 0;
-
- result_type __r = 1664525 * _Tp(__first[__kmodn] ^ __first[__kpmodn] ^ __first[__k1modn]);
- __first[__kpmodn] += __r;
- __r += __kmodn;
- __first[__kqmodn] += __r;
- __first[__kmodn] = __r;
- }
- for (size_t __k = __m; __k < __m + __n; ++__k)
- {
- if (++__kmodn == __n)
- __kmodn = 0;
- if (++__k1modn == __n)
- __k1modn = 0;
- if (++__kpmodn == __n)
- __kpmodn = 0;
- if (++__kqmodn == __n)
- __kqmodn = 0;
-
- result_type __r = 1566083941 * _Tp(__first[__kmodn] + __first[__kpmodn] + __first[__k1modn]);
- __first[__kpmodn] ^= __r;
- __r -= __kmodn;
- __first[__kqmodn] ^= __r;
- __first[__kmodn] = __r;
- }
+ result_type __r = 1664525 * _Tp(__first[0] ^ __first[__p] ^ __first[__n - 1]);
+ __first[__p] += __r;
+ __r += __s;
+ __first[__q] += __r;
+ __first[0] = __r;
+ }
+ // Initialize indexing terms used with if statements as an optimization to
+ // avoid calculating modulo n on every loop iteration for each term.
+ size_t __kmodn = 0; // __k % __n
+ size_t __k1modn = __n - 1; // (__k - 1) % __n
+ size_t __kpmodn = __p % __n; // (__k + __p) % __n
+ size_t __kqmodn = __q % __n; // (__k + __q) % __n
+
+ for (size_t __k = 1; __k <= __s; ++__k) {
+ if (++__kmodn == __n)
+ __kmodn = 0;
+ if (++__k1modn == __n)
+ __k1modn = 0;
+ if (++__kpmodn == __n)
+ __kpmodn = 0;
+ if (++__kqmodn == __n)
+ __kqmodn = 0;
+
+ result_type __r = 1664525 * _Tp(__first[__kmodn] ^ __first[__kpmodn] ^ __first[__k1modn]);
+ __first[__kpmodn] += __r;
+ __r += __kmodn + __v_[__k - 1];
+ __first[__kqmodn] += __r;
+ __first[__kmodn] = __r;
+ }
+ for (size_t __k = __s + 1; __k < __m; ++__k) {
+ if (++__kmodn == __n)
+ __kmodn = 0;
+ if (++__k1modn == __n)
+ __k1modn = 0;
+ if (++__kpmodn == __n)
+ __kpmodn = 0;
+ if (++__kqmodn == __n)
+ __kqmodn = 0;
+
+ result_type __r = 1664525 * _Tp(__first[__kmodn] ^ __first[__kpmodn] ^ __first[__k1modn]);
+ __first[__kpmodn] += __r;
+ __r += __kmodn;
+ __first[__kqmodn] += __r;
+ __first[__kmodn] = __r;
+ }
+ for (size_t __k = __m; __k < __m + __n; ++__k) {
+ if (++__kmodn == __n)
+ __kmodn = 0;
+ if (++__k1modn == __n)
+ __k1modn = 0;
+ if (++__kpmodn == __n)
+ __kpmodn = 0;
+ if (++__kqmodn == __n)
+ __kqmodn = 0;
+
+ result_type __r = 1566083941 * _Tp(__first[__kmodn] + __first[__kpmodn] + __first[__k1modn]);
+ __first[__kpmodn] ^= __r;
+ __r -= __kmodn;
+ __first[__kqmodn] ^= __r;
+ __first[__kmodn] = __r;
}
+ }
}
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__random/shuffle_order_engine.h b/contrib/llvm-project/libcxx/include/__random/shuffle_order_engine.h
index 4836dee48926..f54ed17e3838 100644
--- a/contrib/llvm-project/libcxx/include/__random/shuffle_order_engine.h
+++ b/contrib/llvm-project/libcxx/include/__random/shuffle_order_engine.h
@@ -30,240 +30,197 @@ _LIBCPP_PUSH_MACROS
_LIBCPP_BEGIN_NAMESPACE_STD
template <uint64_t _Xp, uint64_t _Yp>
-struct __ugcd
-{
- static _LIBCPP_CONSTEXPR const uint64_t value = __ugcd<_Yp, _Xp % _Yp>::value;
+struct __ugcd {
+ static _LIBCPP_CONSTEXPR const uint64_t value = __ugcd<_Yp, _Xp % _Yp>::value;
};
template <uint64_t _Xp>
-struct __ugcd<_Xp, 0>
-{
- static _LIBCPP_CONSTEXPR const uint64_t value = _Xp;
+struct __ugcd<_Xp, 0> {
+ static _LIBCPP_CONSTEXPR const uint64_t value = _Xp;
};
template <uint64_t _Np, uint64_t _Dp>
-class __uratio
-{
- static_assert(_Dp != 0, "__uratio divide by 0");
- static _LIBCPP_CONSTEXPR const uint64_t __gcd = __ugcd<_Np, _Dp>::value;
+class __uratio {
+ static_assert(_Dp != 0, "__uratio divide by 0");
+ static _LIBCPP_CONSTEXPR const uint64_t __gcd = __ugcd<_Np, _Dp>::value;
+
public:
- static _LIBCPP_CONSTEXPR const uint64_t num = _Np / __gcd;
- static _LIBCPP_CONSTEXPR const uint64_t den = _Dp / __gcd;
+ static _LIBCPP_CONSTEXPR const uint64_t num = _Np / __gcd;
+ static _LIBCPP_CONSTEXPR const uint64_t den = _Dp / __gcd;
- typedef __uratio<num, den> type;
+ typedef __uratio<num, den> type;
};
-template<class _Engine, size_t __k>
-class _LIBCPP_TEMPLATE_VIS shuffle_order_engine
-{
- static_assert(0 < __k, "shuffle_order_engine invalid parameters");
+template <class _Engine, size_t __k>
+class _LIBCPP_TEMPLATE_VIS shuffle_order_engine {
+ static_assert(0 < __k, "shuffle_order_engine invalid parameters");
+
public:
- // types
- typedef typename _Engine::result_type result_type;
+ // types
+ typedef typename _Engine::result_type result_type;
private:
- _Engine __e_;
- result_type __v_[__k];
- result_type __y_;
+ _Engine __e_;
+ result_type __v_[__k];
+ result_type __y_;
public:
- // engine characteristics
- static _LIBCPP_CONSTEXPR const size_t table_size = __k;
+ // engine characteristics
+ static _LIBCPP_CONSTEXPR const size_t table_size = __k;
#ifdef _LIBCPP_CXX03_LANG
- static const result_type _Min = _Engine::_Min;
- static const result_type _Max = _Engine::_Max;
+ static const result_type _Min = _Engine::_Min;
+ static const result_type _Max = _Engine::_Max;
#else
- static _LIBCPP_CONSTEXPR const result_type _Min = _Engine::min();
- static _LIBCPP_CONSTEXPR const result_type _Max = _Engine::max();
+ static _LIBCPP_CONSTEXPR const result_type _Min = _Engine::min();
+ static _LIBCPP_CONSTEXPR const result_type _Max = _Engine::max();
#endif
- static_assert(_Min < _Max, "shuffle_order_engine invalid parameters");
- _LIBCPP_HIDE_FROM_ABI
- static _LIBCPP_CONSTEXPR result_type min() { return _Min; }
- _LIBCPP_HIDE_FROM_ABI
- static _LIBCPP_CONSTEXPR result_type max() { return _Max; }
-
- static _LIBCPP_CONSTEXPR const unsigned long long _Rp = _Max - _Min + 1ull;
-
- // constructors and seeding functions
- _LIBCPP_HIDE_FROM_ABI
- shuffle_order_engine() {__init();}
- _LIBCPP_HIDE_FROM_ABI
- explicit shuffle_order_engine(const _Engine& __e)
- : __e_(__e) {__init();}
+ static_assert(_Min < _Max, "shuffle_order_engine invalid parameters");
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR result_type min() { return _Min; }
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR result_type max() { return _Max; }
+
+ static _LIBCPP_CONSTEXPR const unsigned long long _Rp = _Max - _Min + 1ull;
+
+ // constructors and seeding functions
+ _LIBCPP_HIDE_FROM_ABI shuffle_order_engine() { __init(); }
+ _LIBCPP_HIDE_FROM_ABI explicit shuffle_order_engine(const _Engine& __e) : __e_(__e) { __init(); }
#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI
- explicit shuffle_order_engine(_Engine&& __e)
- : __e_(std::move(__e)) {__init();}
+ _LIBCPP_HIDE_FROM_ABI explicit shuffle_order_engine(_Engine&& __e) : __e_(std::move(__e)) { __init(); }
#endif // _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI
- explicit shuffle_order_engine(result_type __sd) : __e_(__sd) {__init();}
- template<class _Sseq, __enable_if_t<__is_seed_sequence<_Sseq, shuffle_order_engine>::value &&
- !is_convertible<_Sseq, _Engine>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI
- explicit shuffle_order_engine(_Sseq& __q)
- : __e_(__q) {__init();}
- _LIBCPP_HIDE_FROM_ABI
- void seed() {__e_.seed(); __init();}
- _LIBCPP_HIDE_FROM_ABI
- void seed(result_type __sd) {__e_.seed(__sd); __init();}
- template<class _Sseq, __enable_if_t<__is_seed_sequence<_Sseq, shuffle_order_engine>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI
- void
- seed(_Sseq& __q) {__e_.seed(__q); __init();}
-
- // generating functions
- _LIBCPP_HIDE_FROM_ABI
- result_type operator()() {return __eval(integral_constant<bool, _Rp != 0>());}
- _LIBCPP_HIDE_FROM_ABI
- void discard(unsigned long long __z) {for (; __z; --__z) operator()();}
-
- // property functions
- _LIBCPP_HIDE_FROM_ABI
- const _Engine& base() const _NOEXCEPT {return __e_;}
+ _LIBCPP_HIDE_FROM_ABI explicit shuffle_order_engine(result_type __sd) : __e_(__sd) { __init(); }
+ template <
+ class _Sseq,
+ __enable_if_t<__is_seed_sequence<_Sseq, shuffle_order_engine>::value && !is_convertible<_Sseq, _Engine>::value,
+ int> = 0>
+ _LIBCPP_HIDE_FROM_ABI explicit shuffle_order_engine(_Sseq& __q) : __e_(__q) {
+ __init();
+ }
+ _LIBCPP_HIDE_FROM_ABI void seed() {
+ __e_.seed();
+ __init();
+ }
+ _LIBCPP_HIDE_FROM_ABI void seed(result_type __sd) {
+ __e_.seed(__sd);
+ __init();
+ }
+ template <class _Sseq, __enable_if_t<__is_seed_sequence<_Sseq, shuffle_order_engine>::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI void seed(_Sseq& __q) {
+ __e_.seed(__q);
+ __init();
+ }
+
+ // generating functions
+ _LIBCPP_HIDE_FROM_ABI result_type operator()() { return __eval(integral_constant<bool, _Rp != 0>()); }
+ _LIBCPP_HIDE_FROM_ABI void discard(unsigned long long __z) {
+ for (; __z; --__z)
+ operator()();
+ }
+
+ // property functions
+ _LIBCPP_HIDE_FROM_ABI const _Engine& base() const _NOEXCEPT { return __e_; }
private:
- template<class _Eng, size_t _Kp>
- friend
- bool
- operator==(
- const shuffle_order_engine<_Eng, _Kp>& __x,
- const shuffle_order_engine<_Eng, _Kp>& __y);
-
- template<class _Eng, size_t _Kp>
- friend
- bool
- operator!=(
- const shuffle_order_engine<_Eng, _Kp>& __x,
- const shuffle_order_engine<_Eng, _Kp>& __y);
-
- template <class _CharT, class _Traits,
- class _Eng, size_t _Kp>
- friend
- basic_ostream<_CharT, _Traits>&
- operator<<(basic_ostream<_CharT, _Traits>& __os,
- const shuffle_order_engine<_Eng, _Kp>& __x);
-
- template <class _CharT, class _Traits,
- class _Eng, size_t _Kp>
- friend
- basic_istream<_CharT, _Traits>&
- operator>>(basic_istream<_CharT, _Traits>& __is,
- shuffle_order_engine<_Eng, _Kp>& __x);
-
- _LIBCPP_HIDE_FROM_ABI
- void __init()
- {
- for (size_t __i = 0; __i < __k; ++__i)
- __v_[__i] = __e_();
- __y_ = __e_();
- }
-
- _LIBCPP_HIDE_FROM_ABI
- result_type __eval(false_type) {return __eval2(integral_constant<bool, __k & 1>());}
- _LIBCPP_HIDE_FROM_ABI
- result_type __eval(true_type) {return __eval(__uratio<__k, _Rp>());}
-
- _LIBCPP_HIDE_FROM_ABI
- result_type __eval2(false_type) {return __eval(__uratio<__k/2, 0x8000000000000000ull>());}
- _LIBCPP_HIDE_FROM_ABI
- result_type __eval2(true_type) {return __evalf<__k, 0>();}
-
- template <uint64_t _Np, uint64_t _Dp, __enable_if_t<(__uratio<_Np, _Dp>::num > 0xFFFFFFFFFFFFFFFFull / (_Max - _Min)), int> = 0>
- _LIBCPP_HIDE_FROM_ABI
- result_type
- __eval(__uratio<_Np, _Dp>)
- {return __evalf<__uratio<_Np, _Dp>::num, __uratio<_Np, _Dp>::den>();}
-
- template <uint64_t _Np, uint64_t _Dp, __enable_if_t<__uratio<_Np, _Dp>::num <= 0xFFFFFFFFFFFFFFFFull / (_Max - _Min), int> = 0>
- _LIBCPP_HIDE_FROM_ABI
- result_type
- __eval(__uratio<_Np, _Dp>)
- {
- const size_t __j = static_cast<size_t>(__uratio<_Np, _Dp>::num * (__y_ - _Min)
- / __uratio<_Np, _Dp>::den);
- __y_ = __v_[__j];
- __v_[__j] = __e_();
- return __y_;
- }
-
- template <uint64_t __n, uint64_t __d>
- _LIBCPP_HIDE_FROM_ABI
- result_type __evalf()
- {
- const double __fp = __d == 0 ?
- __n / (2. * 0x8000000000000000ull) :
- __n / (double)__d;
- const size_t __j = static_cast<size_t>(__fp * (__y_ - _Min));
- __y_ = __v_[__j];
- __v_[__j] = __e_();
- return __y_;
- }
+ template <class _Eng, size_t _Kp>
+ friend bool operator==(const shuffle_order_engine<_Eng, _Kp>& __x, const shuffle_order_engine<_Eng, _Kp>& __y);
+
+ template <class _Eng, size_t _Kp>
+ friend bool operator!=(const shuffle_order_engine<_Eng, _Kp>& __x, const shuffle_order_engine<_Eng, _Kp>& __y);
+
+ template <class _CharT, class _Traits, class _Eng, size_t _Kp>
+ friend basic_ostream<_CharT, _Traits>&
+ operator<<(basic_ostream<_CharT, _Traits>& __os, const shuffle_order_engine<_Eng, _Kp>& __x);
+
+ template <class _CharT, class _Traits, class _Eng, size_t _Kp>
+ friend basic_istream<_CharT, _Traits>&
+ operator>>(basic_istream<_CharT, _Traits>& __is, shuffle_order_engine<_Eng, _Kp>& __x);
+
+ _LIBCPP_HIDE_FROM_ABI void __init() {
+ for (size_t __i = 0; __i < __k; ++__i)
+ __v_[__i] = __e_();
+ __y_ = __e_();
+ }
+
+ _LIBCPP_HIDE_FROM_ABI result_type __eval(false_type) { return __eval2(integral_constant<bool, __k & 1>()); }
+ _LIBCPP_HIDE_FROM_ABI result_type __eval(true_type) { return __eval(__uratio<__k, _Rp>()); }
+
+ _LIBCPP_HIDE_FROM_ABI result_type __eval2(false_type) { return __eval(__uratio<__k / 2, 0x8000000000000000ull>()); }
+ _LIBCPP_HIDE_FROM_ABI result_type __eval2(true_type) { return __evalf<__k, 0>(); }
+
+ template <uint64_t _Np,
+ uint64_t _Dp,
+ __enable_if_t<(__uratio<_Np, _Dp>::num > 0xFFFFFFFFFFFFFFFFull / (_Max - _Min)), int> = 0>
+ _LIBCPP_HIDE_FROM_ABI result_type __eval(__uratio<_Np, _Dp>) {
+ return __evalf<__uratio<_Np, _Dp>::num, __uratio<_Np, _Dp>::den>();
+ }
+
+ template <uint64_t _Np,
+ uint64_t _Dp,
+ __enable_if_t<__uratio<_Np, _Dp>::num <= 0xFFFFFFFFFFFFFFFFull / (_Max - _Min), int> = 0>
+ _LIBCPP_HIDE_FROM_ABI result_type __eval(__uratio<_Np, _Dp>) {
+ const size_t __j = static_cast<size_t>(__uratio<_Np, _Dp>::num * (__y_ - _Min) / __uratio<_Np, _Dp>::den);
+ __y_ = __v_[__j];
+ __v_[__j] = __e_();
+ return __y_;
+ }
+
+ template <uint64_t __n, uint64_t __d>
+ _LIBCPP_HIDE_FROM_ABI result_type __evalf() {
+ const double __fp = __d == 0 ? __n / (2. * 0x8000000000000000ull) : __n / (double)__d;
+ const size_t __j = static_cast<size_t>(__fp * (__y_ - _Min));
+ __y_ = __v_[__j];
+ __v_[__j] = __e_();
+ return __y_;
+ }
};
-template<class _Engine, size_t __k>
- _LIBCPP_CONSTEXPR const size_t shuffle_order_engine<_Engine, __k>::table_size;
+template <class _Engine, size_t __k>
+_LIBCPP_CONSTEXPR const size_t shuffle_order_engine<_Engine, __k>::table_size;
-template<class _Eng, size_t _Kp>
+template <class _Eng, size_t _Kp>
_LIBCPP_HIDE_FROM_ABI bool
-operator==(
- const shuffle_order_engine<_Eng, _Kp>& __x,
- const shuffle_order_engine<_Eng, _Kp>& __y)
-{
- return __x.__y_ == __y.__y_ && std::equal(__x.__v_, __x.__v_ + _Kp, __y.__v_) &&
- __x.__e_ == __y.__e_;
+operator==(const shuffle_order_engine<_Eng, _Kp>& __x, const shuffle_order_engine<_Eng, _Kp>& __y) {
+ return __x.__y_ == __y.__y_ && std::equal(__x.__v_, __x.__v_ + _Kp, __y.__v_) && __x.__e_ == __y.__e_;
}
-template<class _Eng, size_t _Kp>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator!=(
- const shuffle_order_engine<_Eng, _Kp>& __x,
- const shuffle_order_engine<_Eng, _Kp>& __y)
-{
- return !(__x == __y);
+template <class _Eng, size_t _Kp>
+inline _LIBCPP_HIDE_FROM_ABI bool
+operator!=(const shuffle_order_engine<_Eng, _Kp>& __x, const shuffle_order_engine<_Eng, _Kp>& __y) {
+ return !(__x == __y);
}
-template <class _CharT, class _Traits,
- class _Eng, size_t _Kp>
+template <class _CharT, class _Traits, class _Eng, size_t _Kp>
_LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>&
-operator<<(basic_ostream<_CharT, _Traits>& __os,
- const shuffle_order_engine<_Eng, _Kp>& __x)
-{
- __save_flags<_CharT, _Traits> __lx(__os);
- typedef basic_ostream<_CharT, _Traits> _Ostream;
- __os.flags(_Ostream::dec | _Ostream::left);
- _CharT __sp = __os.widen(' ');
- __os.fill(__sp);
- __os << __x.__e_ << __sp << __x.__v_[0];
- for (size_t __i = 1; __i < _Kp; ++__i)
- __os << __sp << __x.__v_[__i];
- return __os << __sp << __x.__y_;
+operator<<(basic_ostream<_CharT, _Traits>& __os, const shuffle_order_engine<_Eng, _Kp>& __x) {
+ __save_flags<_CharT, _Traits> __lx(__os);
+ typedef basic_ostream<_CharT, _Traits> _Ostream;
+ __os.flags(_Ostream::dec | _Ostream::left);
+ _CharT __sp = __os.widen(' ');
+ __os.fill(__sp);
+ __os << __x.__e_ << __sp << __x.__v_[0];
+ for (size_t __i = 1; __i < _Kp; ++__i)
+ __os << __sp << __x.__v_[__i];
+ return __os << __sp << __x.__y_;
}
-template <class _CharT, class _Traits,
- class _Eng, size_t _Kp>
+template <class _CharT, class _Traits, class _Eng, size_t _Kp>
_LIBCPP_HIDE_FROM_ABI basic_istream<_CharT, _Traits>&
-operator>>(basic_istream<_CharT, _Traits>& __is,
- shuffle_order_engine<_Eng, _Kp>& __x)
-{
- typedef typename shuffle_order_engine<_Eng, _Kp>::result_type result_type;
- __save_flags<_CharT, _Traits> __lx(__is);
- typedef basic_istream<_CharT, _Traits> _Istream;
- __is.flags(_Istream::dec | _Istream::skipws);
- _Eng __e;
- result_type __vp[_Kp+1];
- __is >> __e;
- for (size_t __i = 0; __i < _Kp+1; ++__i)
- __is >> __vp[__i];
- if (!__is.fail())
- {
- __x.__e_ = __e;
- for (size_t __i = 0; __i < _Kp; ++__i)
- __x.__v_[__i] = __vp[__i];
- __x.__y_ = __vp[_Kp];
- }
- return __is;
+operator>>(basic_istream<_CharT, _Traits>& __is, shuffle_order_engine<_Eng, _Kp>& __x) {
+ typedef typename shuffle_order_engine<_Eng, _Kp>::result_type result_type;
+ __save_flags<_CharT, _Traits> __lx(__is);
+ typedef basic_istream<_CharT, _Traits> _Istream;
+ __is.flags(_Istream::dec | _Istream::skipws);
+ _Eng __e;
+ result_type __vp[_Kp + 1];
+ __is >> __e;
+ for (size_t __i = 0; __i < _Kp + 1; ++__i)
+ __is >> __vp[__i];
+ if (!__is.fail()) {
+ __x.__e_ = __e;
+ for (size_t __i = 0; __i < _Kp; ++__i)
+ __x.__v_[__i] = __vp[__i];
+ __x.__y_ = __vp[_Kp];
+ }
+ return __is;
}
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__random/student_t_distribution.h b/contrib/llvm-project/libcxx/include/__random/student_t_distribution.h
index 0879a411c0c5..110a856ee658 100644
--- a/contrib/llvm-project/libcxx/include/__random/student_t_distribution.h
+++ b/contrib/llvm-project/libcxx/include/__random/student_t_distribution.h
@@ -26,130 +26,103 @@ _LIBCPP_PUSH_MACROS
_LIBCPP_BEGIN_NAMESPACE_STD
-template<class _RealType = double>
-class _LIBCPP_TEMPLATE_VIS student_t_distribution
-{
+template <class _RealType = double>
+class _LIBCPP_TEMPLATE_VIS student_t_distribution {
static_assert(__libcpp_random_is_valid_realtype<_RealType>::value,
"RealType must be a supported floating-point type");
public:
- // types
- typedef _RealType result_type;
+ // types
+ typedef _RealType result_type;
- class _LIBCPP_TEMPLATE_VIS param_type
- {
- result_type __n_;
- public:
- typedef student_t_distribution distribution_type;
+ class _LIBCPP_TEMPLATE_VIS param_type {
+ result_type __n_;
- _LIBCPP_HIDE_FROM_ABI
- explicit param_type(result_type __n = 1) : __n_(__n) {}
+ public:
+ typedef student_t_distribution distribution_type;
- _LIBCPP_HIDE_FROM_ABI
- result_type n() const {return __n_;}
+ _LIBCPP_HIDE_FROM_ABI explicit param_type(result_type __n = 1) : __n_(__n) {}
- friend _LIBCPP_HIDE_FROM_ABI
- bool operator==(const param_type& __x, const param_type& __y)
- {return __x.__n_ == __y.__n_;}
- friend _LIBCPP_HIDE_FROM_ABI
- bool operator!=(const param_type& __x, const param_type& __y)
- {return !(__x == __y);}
- };
+ _LIBCPP_HIDE_FROM_ABI result_type n() const { return __n_; }
+
+ friend _LIBCPP_HIDE_FROM_ABI bool operator==(const param_type& __x, const param_type& __y) {
+ return __x.__n_ == __y.__n_;
+ }
+ friend _LIBCPP_HIDE_FROM_ABI bool operator!=(const param_type& __x, const param_type& __y) { return !(__x == __y); }
+ };
private:
- param_type __p_;
- normal_distribution<result_type> __nd_;
+ param_type __p_;
+ normal_distribution<result_type> __nd_;
public:
- // constructor and reset functions
+ // constructor and reset functions
#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI
- student_t_distribution() : student_t_distribution(1) {}
- _LIBCPP_HIDE_FROM_ABI
- explicit student_t_distribution(result_type __n)
- : __p_(param_type(__n)) {}
+ _LIBCPP_HIDE_FROM_ABI student_t_distribution() : student_t_distribution(1) {}
+ _LIBCPP_HIDE_FROM_ABI explicit student_t_distribution(result_type __n) : __p_(param_type(__n)) {}
#else
- _LIBCPP_HIDE_FROM_ABI
- explicit student_t_distribution(result_type __n = 1)
- : __p_(param_type(__n)) {}
+ _LIBCPP_HIDE_FROM_ABI explicit student_t_distribution(result_type __n = 1) : __p_(param_type(__n)) {}
#endif
- _LIBCPP_HIDE_FROM_ABI
- explicit student_t_distribution(const param_type& __p)
- : __p_(__p) {}
- _LIBCPP_HIDE_FROM_ABI
- void reset() {__nd_.reset();}
-
- // generating functions
- template<class _URNG>
- _LIBCPP_HIDE_FROM_ABI
- result_type operator()(_URNG& __g)
- {return (*this)(__g, __p_);}
- template<class _URNG>
- _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g, const param_type& __p);
-
- // property functions
- _LIBCPP_HIDE_FROM_ABI
- result_type n() const {return __p_.n();}
-
- _LIBCPP_HIDE_FROM_ABI
- param_type param() const {return __p_;}
- _LIBCPP_HIDE_FROM_ABI
- void param(const param_type& __p) {__p_ = __p;}
-
- _LIBCPP_HIDE_FROM_ABI
- result_type min() const {return -numeric_limits<result_type>::infinity();}
- _LIBCPP_HIDE_FROM_ABI
- result_type max() const {return numeric_limits<result_type>::infinity();}
-
- friend _LIBCPP_HIDE_FROM_ABI
- bool operator==(const student_t_distribution& __x,
- const student_t_distribution& __y)
- {return __x.__p_ == __y.__p_;}
- friend _LIBCPP_HIDE_FROM_ABI
- bool operator!=(const student_t_distribution& __x,
- const student_t_distribution& __y)
- {return !(__x == __y);}
+ _LIBCPP_HIDE_FROM_ABI explicit student_t_distribution(const param_type& __p) : __p_(__p) {}
+ _LIBCPP_HIDE_FROM_ABI void reset() { __nd_.reset(); }
+
+ // generating functions
+ template <class _URNG>
+ _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g) {
+ return (*this)(__g, __p_);
+ }
+ template <class _URNG>
+ _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g, const param_type& __p);
+
+ // property functions
+ _LIBCPP_HIDE_FROM_ABI result_type n() const { return __p_.n(); }
+
+ _LIBCPP_HIDE_FROM_ABI param_type param() const { return __p_; }
+ _LIBCPP_HIDE_FROM_ABI void param(const param_type& __p) { __p_ = __p; }
+
+ _LIBCPP_HIDE_FROM_ABI result_type min() const { return -numeric_limits<result_type>::infinity(); }
+ _LIBCPP_HIDE_FROM_ABI result_type max() const { return numeric_limits<result_type>::infinity(); }
+
+ friend _LIBCPP_HIDE_FROM_ABI bool operator==(const student_t_distribution& __x, const student_t_distribution& __y) {
+ return __x.__p_ == __y.__p_;
+ }
+ friend _LIBCPP_HIDE_FROM_ABI bool operator!=(const student_t_distribution& __x, const student_t_distribution& __y) {
+ return !(__x == __y);
+ }
};
template <class _RealType>
-template<class _URNG>
-_RealType
-student_t_distribution<_RealType>::operator()(_URNG& __g, const param_type& __p)
-{
- static_assert(__libcpp_random_is_valid_urng<_URNG>::value, "");
- gamma_distribution<result_type> __gd(__p.n() * .5, 2);
- return __nd_(__g) * std::sqrt(__p.n()/__gd(__g));
+template <class _URNG>
+_RealType student_t_distribution<_RealType>::operator()(_URNG& __g, const param_type& __p) {
+ static_assert(__libcpp_random_is_valid_urng<_URNG>::value, "");
+ gamma_distribution<result_type> __gd(__p.n() * .5, 2);
+ return __nd_(__g) * std::sqrt(__p.n() / __gd(__g));
}
template <class _CharT, class _Traits, class _RT>
_LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>&
-operator<<(basic_ostream<_CharT, _Traits>& __os,
- const student_t_distribution<_RT>& __x)
-{
- __save_flags<_CharT, _Traits> __lx(__os);
- typedef basic_ostream<_CharT, _Traits> _OStream;
- __os.flags(_OStream::dec | _OStream::left | _OStream::fixed |
- _OStream::scientific);
- __os << __x.n();
- return __os;
+operator<<(basic_ostream<_CharT, _Traits>& __os, const student_t_distribution<_RT>& __x) {
+ __save_flags<_CharT, _Traits> __lx(__os);
+ typedef basic_ostream<_CharT, _Traits> _OStream;
+ __os.flags(_OStream::dec | _OStream::left | _OStream::fixed | _OStream::scientific);
+ __os << __x.n();
+ return __os;
}
template <class _CharT, class _Traits, class _RT>
_LIBCPP_HIDE_FROM_ABI basic_istream<_CharT, _Traits>&
-operator>>(basic_istream<_CharT, _Traits>& __is,
- student_t_distribution<_RT>& __x)
-{
- typedef student_t_distribution<_RT> _Eng;
- typedef typename _Eng::result_type result_type;
- typedef typename _Eng::param_type param_type;
- __save_flags<_CharT, _Traits> __lx(__is);
- typedef basic_istream<_CharT, _Traits> _Istream;
- __is.flags(_Istream::dec | _Istream::skipws);
- result_type __n;
- __is >> __n;
- if (!__is.fail())
- __x.param(param_type(__n));
- return __is;
+operator>>(basic_istream<_CharT, _Traits>& __is, student_t_distribution<_RT>& __x) {
+ typedef student_t_distribution<_RT> _Eng;
+ typedef typename _Eng::result_type result_type;
+ typedef typename _Eng::param_type param_type;
+ __save_flags<_CharT, _Traits> __lx(__is);
+ typedef basic_istream<_CharT, _Traits> _Istream;
+ __is.flags(_Istream::dec | _Istream::skipws);
+ result_type __n;
+ __is >> __n;
+ if (!__is.fail())
+ __x.param(param_type(__n));
+ return __is;
}
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__random/subtract_with_carry_engine.h b/contrib/llvm-project/libcxx/include/__random/subtract_with_carry_engine.h
index fe2a66800adc..ec25fed49f94 100644
--- a/contrib/llvm-project/libcxx/include/__random/subtract_with_carry_engine.h
+++ b/contrib/llvm-project/libcxx/include/__random/subtract_with_carry_engine.h
@@ -28,315 +28,245 @@ _LIBCPP_PUSH_MACROS
_LIBCPP_BEGIN_NAMESPACE_STD
-template<class _UIntType, size_t __w, size_t __s, size_t __r>
+template <class _UIntType, size_t __w, size_t __s, size_t __r>
class _LIBCPP_TEMPLATE_VIS subtract_with_carry_engine;
-template<class _UInt, size_t _Wp, size_t _Sp, size_t _Rp>
-_LIBCPP_HIDE_FROM_ABI bool
-operator==(
- const subtract_with_carry_engine<_UInt, _Wp, _Sp, _Rp>& __x,
- const subtract_with_carry_engine<_UInt, _Wp, _Sp, _Rp>& __y);
-
-template<class _UInt, size_t _Wp, size_t _Sp, size_t _Rp>
-_LIBCPP_HIDE_FROM_ABI
-bool
-operator!=(
- const subtract_with_carry_engine<_UInt, _Wp, _Sp, _Rp>& __x,
- const subtract_with_carry_engine<_UInt, _Wp, _Sp, _Rp>& __y);
-
-template <class _CharT, class _Traits,
- class _UInt, size_t _Wp, size_t _Sp, size_t _Rp>
+template <class _UInt, size_t _Wp, size_t _Sp, size_t _Rp>
+_LIBCPP_HIDE_FROM_ABI bool operator==(const subtract_with_carry_engine<_UInt, _Wp, _Sp, _Rp>& __x,
+ const subtract_with_carry_engine<_UInt, _Wp, _Sp, _Rp>& __y);
+
+template <class _UInt, size_t _Wp, size_t _Sp, size_t _Rp>
+_LIBCPP_HIDE_FROM_ABI bool operator!=(const subtract_with_carry_engine<_UInt, _Wp, _Sp, _Rp>& __x,
+ const subtract_with_carry_engine<_UInt, _Wp, _Sp, _Rp>& __y);
+
+template <class _CharT, class _Traits, class _UInt, size_t _Wp, size_t _Sp, size_t _Rp>
_LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>&
-operator<<(basic_ostream<_CharT, _Traits>& __os,
- const subtract_with_carry_engine<_UInt, _Wp, _Sp, _Rp>& __x);
+operator<<(basic_ostream<_CharT, _Traits>& __os, const subtract_with_carry_engine<_UInt, _Wp, _Sp, _Rp>& __x);
-template <class _CharT, class _Traits,
- class _UInt, size_t _Wp, size_t _Sp, size_t _Rp>
+template <class _CharT, class _Traits, class _UInt, size_t _Wp, size_t _Sp, size_t _Rp>
_LIBCPP_HIDE_FROM_ABI basic_istream<_CharT, _Traits>&
-operator>>(basic_istream<_CharT, _Traits>& __is,
- subtract_with_carry_engine<_UInt, _Wp, _Sp, _Rp>& __x);
+operator>>(basic_istream<_CharT, _Traits>& __is, subtract_with_carry_engine<_UInt, _Wp, _Sp, _Rp>& __x);
-template<class _UIntType, size_t __w, size_t __s, size_t __r>
-class _LIBCPP_TEMPLATE_VIS subtract_with_carry_engine
-{
+template <class _UIntType, size_t __w, size_t __s, size_t __r>
+class _LIBCPP_TEMPLATE_VIS subtract_with_carry_engine {
public:
- // types
- typedef _UIntType result_type;
+ // types
+ typedef _UIntType result_type;
private:
- result_type __x_[__r];
- result_type __c_;
- size_t __i_;
-
- static _LIBCPP_CONSTEXPR const result_type _Dt = numeric_limits<result_type>::digits;
- static_assert( 0 < __w, "subtract_with_carry_engine invalid parameters");
- static_assert(__w <= _Dt, "subtract_with_carry_engine invalid parameters");
- static_assert( 0 < __s, "subtract_with_carry_engine invalid parameters");
- static_assert(__s < __r, "subtract_with_carry_engine invalid parameters");
+ result_type __x_[__r];
+ result_type __c_;
+ size_t __i_;
+
+ static _LIBCPP_CONSTEXPR const result_type _Dt = numeric_limits<result_type>::digits;
+ static_assert(0 < __w, "subtract_with_carry_engine invalid parameters");
+ static_assert(__w <= _Dt, "subtract_with_carry_engine invalid parameters");
+ static_assert(0 < __s, "subtract_with_carry_engine invalid parameters");
+ static_assert(__s < __r, "subtract_with_carry_engine invalid parameters");
+
public:
- static _LIBCPP_CONSTEXPR const result_type _Min = 0;
- static _LIBCPP_CONSTEXPR const result_type _Max = __w == _Dt ? result_type(~0) :
- (result_type(1) << __w) - result_type(1);
- static_assert(_Min < _Max, "subtract_with_carry_engine invalid parameters");
-
- // engine characteristics
- static _LIBCPP_CONSTEXPR const size_t word_size = __w;
- static _LIBCPP_CONSTEXPR const size_t short_lag = __s;
- static _LIBCPP_CONSTEXPR const size_t long_lag = __r;
- _LIBCPP_HIDE_FROM_ABI
- static _LIBCPP_CONSTEXPR result_type min() { return _Min; }
- _LIBCPP_HIDE_FROM_ABI
- static _LIBCPP_CONSTEXPR result_type max() { return _Max; }
- static _LIBCPP_CONSTEXPR const result_type default_seed = 19780503u;
-
- // constructors and seeding functions
+ static _LIBCPP_CONSTEXPR const result_type _Min = 0;
+ static _LIBCPP_CONSTEXPR const result_type _Max =
+ __w == _Dt ? result_type(~0) : (result_type(1) << __w) - result_type(1);
+ static_assert(_Min < _Max, "subtract_with_carry_engine invalid parameters");
+
+ // engine characteristics
+ static _LIBCPP_CONSTEXPR const size_t word_size = __w;
+ static _LIBCPP_CONSTEXPR const size_t short_lag = __s;
+ static _LIBCPP_CONSTEXPR const size_t long_lag = __r;
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR result_type min() { return _Min; }
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR result_type max() { return _Max; }
+ static _LIBCPP_CONSTEXPR const result_type default_seed = 19780503u;
+
+ // constructors and seeding functions
#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI
- subtract_with_carry_engine() : subtract_with_carry_engine(default_seed) {}
- _LIBCPP_HIDE_FROM_ABI
- explicit subtract_with_carry_engine(result_type __sd) { seed(__sd); }
+ _LIBCPP_HIDE_FROM_ABI subtract_with_carry_engine() : subtract_with_carry_engine(default_seed) {}
+ _LIBCPP_HIDE_FROM_ABI explicit subtract_with_carry_engine(result_type __sd) { seed(__sd); }
#else
- _LIBCPP_HIDE_FROM_ABI
- explicit subtract_with_carry_engine(result_type __sd = default_seed) {
- seed(__sd);
- }
+ _LIBCPP_HIDE_FROM_ABI explicit subtract_with_carry_engine(result_type __sd = default_seed) { seed(__sd); }
#endif
- template<class _Sseq, __enable_if_t<__is_seed_sequence<_Sseq, subtract_with_carry_engine>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI
- explicit subtract_with_carry_engine(_Sseq& __q)
- {seed(__q);}
- _LIBCPP_HIDE_FROM_ABI
- void seed(result_type __sd = default_seed)
- {seed(__sd, integral_constant<unsigned, 1 + (__w - 1) / 32>());}
- template<class _Sseq, __enable_if_t<__is_seed_sequence<_Sseq, subtract_with_carry_engine>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI
- void
- seed(_Sseq& __q)
- {__seed(__q, integral_constant<unsigned, 1 + (__w - 1) / 32>());}
-
- // generating functions
- _LIBCPP_HIDE_FROM_ABI result_type operator()();
- _LIBCPP_HIDE_FROM_ABI
- void discard(unsigned long long __z) {for (; __z; --__z) operator()();}
-
- template<class _UInt, size_t _Wp, size_t _Sp, size_t _Rp>
- friend
- bool
- operator==(
- const subtract_with_carry_engine<_UInt, _Wp, _Sp, _Rp>& __x,
- const subtract_with_carry_engine<_UInt, _Wp, _Sp, _Rp>& __y);
-
- template<class _UInt, size_t _Wp, size_t _Sp, size_t _Rp>
- friend
- bool
- operator!=(
- const subtract_with_carry_engine<_UInt, _Wp, _Sp, _Rp>& __x,
- const subtract_with_carry_engine<_UInt, _Wp, _Sp, _Rp>& __y);
-
- template <class _CharT, class _Traits,
- class _UInt, size_t _Wp, size_t _Sp, size_t _Rp>
- friend
- basic_ostream<_CharT, _Traits>&
- operator<<(basic_ostream<_CharT, _Traits>& __os,
- const subtract_with_carry_engine<_UInt, _Wp, _Sp, _Rp>& __x);
-
- template <class _CharT, class _Traits,
- class _UInt, size_t _Wp, size_t _Sp, size_t _Rp>
- friend
- basic_istream<_CharT, _Traits>&
- operator>>(basic_istream<_CharT, _Traits>& __is,
- subtract_with_carry_engine<_UInt, _Wp, _Sp, _Rp>& __x);
+ template <class _Sseq, __enable_if_t<__is_seed_sequence<_Sseq, subtract_with_carry_engine>::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI explicit subtract_with_carry_engine(_Sseq& __q) {
+ seed(__q);
+ }
+ _LIBCPP_HIDE_FROM_ABI void seed(result_type __sd = default_seed) {
+ seed(__sd, integral_constant<unsigned, 1 + (__w - 1) / 32>());
+ }
+ template <class _Sseq, __enable_if_t<__is_seed_sequence<_Sseq, subtract_with_carry_engine>::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI void seed(_Sseq& __q) {
+ __seed(__q, integral_constant<unsigned, 1 + (__w - 1) / 32>());
+ }
+
+ // generating functions
+ _LIBCPP_HIDE_FROM_ABI result_type operator()();
+ _LIBCPP_HIDE_FROM_ABI void discard(unsigned long long __z) {
+ for (; __z; --__z)
+ operator()();
+ }
+
+ template <class _UInt, size_t _Wp, size_t _Sp, size_t _Rp>
+ friend bool operator==(const subtract_with_carry_engine<_UInt, _Wp, _Sp, _Rp>& __x,
+ const subtract_with_carry_engine<_UInt, _Wp, _Sp, _Rp>& __y);
+
+ template <class _UInt, size_t _Wp, size_t _Sp, size_t _Rp>
+ friend bool operator!=(const subtract_with_carry_engine<_UInt, _Wp, _Sp, _Rp>& __x,
+ const subtract_with_carry_engine<_UInt, _Wp, _Sp, _Rp>& __y);
+
+ template <class _CharT, class _Traits, class _UInt, size_t _Wp, size_t _Sp, size_t _Rp>
+ friend basic_ostream<_CharT, _Traits>&
+ operator<<(basic_ostream<_CharT, _Traits>& __os, const subtract_with_carry_engine<_UInt, _Wp, _Sp, _Rp>& __x);
+
+ template <class _CharT, class _Traits, class _UInt, size_t _Wp, size_t _Sp, size_t _Rp>
+ friend basic_istream<_CharT, _Traits>&
+ operator>>(basic_istream<_CharT, _Traits>& __is, subtract_with_carry_engine<_UInt, _Wp, _Sp, _Rp>& __x);
private:
-
- _LIBCPP_HIDE_FROM_ABI void seed(result_type __sd, integral_constant<unsigned, 1>);
- _LIBCPP_HIDE_FROM_ABI void seed(result_type __sd, integral_constant<unsigned, 2>);
- template<class _Sseq>
- _LIBCPP_HIDE_FROM_ABI void __seed(_Sseq& __q, integral_constant<unsigned, 1>);
- template<class _Sseq>
- _LIBCPP_HIDE_FROM_ABI void __seed(_Sseq& __q, integral_constant<unsigned, 2>);
+ _LIBCPP_HIDE_FROM_ABI void seed(result_type __sd, integral_constant<unsigned, 1>);
+ _LIBCPP_HIDE_FROM_ABI void seed(result_type __sd, integral_constant<unsigned, 2>);
+ template <class _Sseq>
+ _LIBCPP_HIDE_FROM_ABI void __seed(_Sseq& __q, integral_constant<unsigned, 1>);
+ template <class _Sseq>
+ _LIBCPP_HIDE_FROM_ABI void __seed(_Sseq& __q, integral_constant<unsigned, 2>);
};
-template<class _UIntType, size_t __w, size_t __s, size_t __r>
- _LIBCPP_CONSTEXPR const size_t subtract_with_carry_engine<_UIntType, __w, __s, __r>::word_size;
+template <class _UIntType, size_t __w, size_t __s, size_t __r>
+_LIBCPP_CONSTEXPR const size_t subtract_with_carry_engine<_UIntType, __w, __s, __r>::word_size;
-template<class _UIntType, size_t __w, size_t __s, size_t __r>
- _LIBCPP_CONSTEXPR const size_t subtract_with_carry_engine<_UIntType, __w, __s, __r>::short_lag;
+template <class _UIntType, size_t __w, size_t __s, size_t __r>
+_LIBCPP_CONSTEXPR const size_t subtract_with_carry_engine<_UIntType, __w, __s, __r>::short_lag;
-template<class _UIntType, size_t __w, size_t __s, size_t __r>
- _LIBCPP_CONSTEXPR const size_t subtract_with_carry_engine<_UIntType, __w, __s, __r>::long_lag;
+template <class _UIntType, size_t __w, size_t __s, size_t __r>
+_LIBCPP_CONSTEXPR const size_t subtract_with_carry_engine<_UIntType, __w, __s, __r>::long_lag;
-template<class _UIntType, size_t __w, size_t __s, size_t __r>
- _LIBCPP_CONSTEXPR const typename subtract_with_carry_engine<_UIntType, __w, __s, __r>::result_type
+template <class _UIntType, size_t __w, size_t __s, size_t __r>
+_LIBCPP_CONSTEXPR const typename subtract_with_carry_engine<_UIntType, __w, __s, __r>::result_type
subtract_with_carry_engine<_UIntType, __w, __s, __r>::default_seed;
-template<class _UIntType, size_t __w, size_t __s, size_t __r>
-void
-subtract_with_carry_engine<_UIntType, __w, __s, __r>::seed(result_type __sd,
- integral_constant<unsigned, 1>)
-{
- linear_congruential_engine<result_type, 40014u, 0u, 2147483563u>
- __e(__sd == 0u ? default_seed : __sd);
- for (size_t __i = 0; __i < __r; ++__i)
- __x_[__i] = static_cast<result_type>(__e() & _Max);
- __c_ = __x_[__r-1] == 0;
- __i_ = 0;
+template <class _UIntType, size_t __w, size_t __s, size_t __r>
+void subtract_with_carry_engine<_UIntType, __w, __s, __r>::seed(result_type __sd, integral_constant<unsigned, 1>) {
+ linear_congruential_engine<result_type, 40014u, 0u, 2147483563u> __e(__sd == 0u ? default_seed : __sd);
+ for (size_t __i = 0; __i < __r; ++__i)
+ __x_[__i] = static_cast<result_type>(__e() & _Max);
+ __c_ = __x_[__r - 1] == 0;
+ __i_ = 0;
}
-template<class _UIntType, size_t __w, size_t __s, size_t __r>
-void
-subtract_with_carry_engine<_UIntType, __w, __s, __r>::seed(result_type __sd,
- integral_constant<unsigned, 2>)
-{
- linear_congruential_engine<result_type, 40014u, 0u, 2147483563u>
- __e(__sd == 0u ? default_seed : __sd);
- for (size_t __i = 0; __i < __r; ++__i)
- {
- result_type __e0 = __e();
- __x_[__i] = static_cast<result_type>(
- (__e0 + ((uint64_t)__e() << 32)) & _Max);
- }
- __c_ = __x_[__r-1] == 0;
- __i_ = 0;
+template <class _UIntType, size_t __w, size_t __s, size_t __r>
+void subtract_with_carry_engine<_UIntType, __w, __s, __r>::seed(result_type __sd, integral_constant<unsigned, 2>) {
+ linear_congruential_engine<result_type, 40014u, 0u, 2147483563u> __e(__sd == 0u ? default_seed : __sd);
+ for (size_t __i = 0; __i < __r; ++__i) {
+ result_type __e0 = __e();
+ __x_[__i] = static_cast<result_type>((__e0 + ((uint64_t)__e() << 32)) & _Max);
+ }
+ __c_ = __x_[__r - 1] == 0;
+ __i_ = 0;
}
-template<class _UIntType, size_t __w, size_t __s, size_t __r>
-template<class _Sseq>
-void
-subtract_with_carry_engine<_UIntType, __w, __s, __r>::__seed(_Sseq& __q,
- integral_constant<unsigned, 1>)
-{
- const unsigned __k = 1;
- uint32_t __ar[__r * __k];
- __q.generate(__ar, __ar + __r * __k);
- for (size_t __i = 0; __i < __r; ++__i)
- __x_[__i] = static_cast<result_type>(__ar[__i] & _Max);
- __c_ = __x_[__r-1] == 0;
- __i_ = 0;
+template <class _UIntType, size_t __w, size_t __s, size_t __r>
+template <class _Sseq>
+void subtract_with_carry_engine<_UIntType, __w, __s, __r>::__seed(_Sseq& __q, integral_constant<unsigned, 1>) {
+ const unsigned __k = 1;
+ uint32_t __ar[__r * __k];
+ __q.generate(__ar, __ar + __r * __k);
+ for (size_t __i = 0; __i < __r; ++__i)
+ __x_[__i] = static_cast<result_type>(__ar[__i] & _Max);
+ __c_ = __x_[__r - 1] == 0;
+ __i_ = 0;
}
-template<class _UIntType, size_t __w, size_t __s, size_t __r>
-template<class _Sseq>
-void
-subtract_with_carry_engine<_UIntType, __w, __s, __r>::__seed(_Sseq& __q,
- integral_constant<unsigned, 2>)
-{
- const unsigned __k = 2;
- uint32_t __ar[__r * __k];
- __q.generate(__ar, __ar + __r * __k);
- for (size_t __i = 0; __i < __r; ++__i)
- __x_[__i] = static_cast<result_type>(
- (__ar[2 * __i] + ((uint64_t)__ar[2 * __i + 1] << 32)) & _Max);
- __c_ = __x_[__r-1] == 0;
- __i_ = 0;
+template <class _UIntType, size_t __w, size_t __s, size_t __r>
+template <class _Sseq>
+void subtract_with_carry_engine<_UIntType, __w, __s, __r>::__seed(_Sseq& __q, integral_constant<unsigned, 2>) {
+ const unsigned __k = 2;
+ uint32_t __ar[__r * __k];
+ __q.generate(__ar, __ar + __r * __k);
+ for (size_t __i = 0; __i < __r; ++__i)
+ __x_[__i] = static_cast<result_type>((__ar[2 * __i] + ((uint64_t)__ar[2 * __i + 1] << 32)) & _Max);
+ __c_ = __x_[__r - 1] == 0;
+ __i_ = 0;
}
-template<class _UIntType, size_t __w, size_t __s, size_t __r>
-_UIntType
-subtract_with_carry_engine<_UIntType, __w, __s, __r>::operator()()
-{
- const result_type& __xs = __x_[(__i_ + (__r - __s)) % __r];
- result_type& __xr = __x_[__i_];
- result_type __new_c = __c_ == 0 ? __xs < __xr : __xs != 0 ? __xs <= __xr : 1;
- __xr = (__xs - __xr - __c_) & _Max;
- __c_ = __new_c;
- __i_ = (__i_ + 1) % __r;
- return __xr;
+template <class _UIntType, size_t __w, size_t __s, size_t __r>
+_UIntType subtract_with_carry_engine<_UIntType, __w, __s, __r>::operator()() {
+ const result_type& __xs = __x_[(__i_ + (__r - __s)) % __r];
+ result_type& __xr = __x_[__i_];
+ result_type __new_c = __c_ == 0 ? __xs < __xr : __xs != 0 ? __xs <= __xr : 1;
+ __xr = (__xs - __xr - __c_) & _Max;
+ __c_ = __new_c;
+ __i_ = (__i_ + 1) % __r;
+ return __xr;
}
-template<class _UInt, size_t _Wp, size_t _Sp, size_t _Rp>
-_LIBCPP_HIDE_FROM_ABI bool
-operator==(
- const subtract_with_carry_engine<_UInt, _Wp, _Sp, _Rp>& __x,
- const subtract_with_carry_engine<_UInt, _Wp, _Sp, _Rp>& __y)
-{
- if (__x.__c_ != __y.__c_)
- return false;
- if (__x.__i_ == __y.__i_)
- return std::equal(__x.__x_, __x.__x_ + _Rp, __y.__x_);
- if (__x.__i_ == 0 || __y.__i_ == 0)
- {
- size_t __j = std::min(_Rp - __x.__i_, _Rp - __y.__i_);
- if (!std::equal(__x.__x_ + __x.__i_, __x.__x_ + __x.__i_ + __j,
- __y.__x_ + __y.__i_))
- return false;
- if (__x.__i_ == 0)
- return std::equal(__x.__x_ + __j, __x.__x_ + _Rp, __y.__x_);
- return std::equal(__x.__x_, __x.__x_ + (_Rp - __j), __y.__x_ + __j);
- }
- if (__x.__i_ < __y.__i_)
- {
- size_t __j = _Rp - __y.__i_;
- if (!std::equal(__x.__x_ + __x.__i_, __x.__x_ + (__x.__i_ + __j),
- __y.__x_ + __y.__i_))
- return false;
- if (!std::equal(__x.__x_ + (__x.__i_ + __j), __x.__x_ + _Rp,
- __y.__x_))
- return false;
- return std::equal(__x.__x_, __x.__x_ + __x.__i_,
- __y.__x_ + (_Rp - (__x.__i_ + __j)));
- }
- size_t __j = _Rp - __x.__i_;
- if (!std::equal(__y.__x_ + __y.__i_, __y.__x_ + (__y.__i_ + __j),
- __x.__x_ + __x.__i_))
- return false;
- if (!std::equal(__y.__x_ + (__y.__i_ + __j), __y.__x_ + _Rp,
- __x.__x_))
- return false;
- return std::equal(__y.__x_, __y.__x_ + __y.__i_,
- __x.__x_ + (_Rp - (__y.__i_ + __j)));
+template <class _UInt, size_t _Wp, size_t _Sp, size_t _Rp>
+_LIBCPP_HIDE_FROM_ABI bool operator==(const subtract_with_carry_engine<_UInt, _Wp, _Sp, _Rp>& __x,
+ const subtract_with_carry_engine<_UInt, _Wp, _Sp, _Rp>& __y) {
+ if (__x.__c_ != __y.__c_)
+ return false;
+ if (__x.__i_ == __y.__i_)
+ return std::equal(__x.__x_, __x.__x_ + _Rp, __y.__x_);
+ if (__x.__i_ == 0 || __y.__i_ == 0) {
+ size_t __j = std::min(_Rp - __x.__i_, _Rp - __y.__i_);
+ if (!std::equal(__x.__x_ + __x.__i_, __x.__x_ + __x.__i_ + __j, __y.__x_ + __y.__i_))
+ return false;
+ if (__x.__i_ == 0)
+ return std::equal(__x.__x_ + __j, __x.__x_ + _Rp, __y.__x_);
+ return std::equal(__x.__x_, __x.__x_ + (_Rp - __j), __y.__x_ + __j);
+ }
+ if (__x.__i_ < __y.__i_) {
+ size_t __j = _Rp - __y.__i_;
+ if (!std::equal(__x.__x_ + __x.__i_, __x.__x_ + (__x.__i_ + __j), __y.__x_ + __y.__i_))
+ return false;
+ if (!std::equal(__x.__x_ + (__x.__i_ + __j), __x.__x_ + _Rp, __y.__x_))
+ return false;
+ return std::equal(__x.__x_, __x.__x_ + __x.__i_, __y.__x_ + (_Rp - (__x.__i_ + __j)));
+ }
+ size_t __j = _Rp - __x.__i_;
+ if (!std::equal(__y.__x_ + __y.__i_, __y.__x_ + (__y.__i_ + __j), __x.__x_ + __x.__i_))
+ return false;
+ if (!std::equal(__y.__x_ + (__y.__i_ + __j), __y.__x_ + _Rp, __x.__x_))
+ return false;
+ return std::equal(__y.__x_, __y.__x_ + __y.__i_, __x.__x_ + (_Rp - (__y.__i_ + __j)));
}
-template<class _UInt, size_t _Wp, size_t _Sp, size_t _Rp>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator!=(
- const subtract_with_carry_engine<_UInt, _Wp, _Sp, _Rp>& __x,
- const subtract_with_carry_engine<_UInt, _Wp, _Sp, _Rp>& __y)
-{
- return !(__x == __y);
+template <class _UInt, size_t _Wp, size_t _Sp, size_t _Rp>
+inline _LIBCPP_HIDE_FROM_ABI bool operator!=(const subtract_with_carry_engine<_UInt, _Wp, _Sp, _Rp>& __x,
+ const subtract_with_carry_engine<_UInt, _Wp, _Sp, _Rp>& __y) {
+ return !(__x == __y);
}
-template <class _CharT, class _Traits,
- class _UInt, size_t _Wp, size_t _Sp, size_t _Rp>
+template <class _CharT, class _Traits, class _UInt, size_t _Wp, size_t _Sp, size_t _Rp>
_LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>&
-operator<<(basic_ostream<_CharT, _Traits>& __os,
- const subtract_with_carry_engine<_UInt, _Wp, _Sp, _Rp>& __x)
-{
- __save_flags<_CharT, _Traits> __lx(__os);
- typedef basic_ostream<_CharT, _Traits> _Ostream;
- __os.flags(_Ostream::dec | _Ostream::left);
- _CharT __sp = __os.widen(' ');
- __os.fill(__sp);
- __os << __x.__x_[__x.__i_];
- for (size_t __j = __x.__i_ + 1; __j < _Rp; ++__j)
- __os << __sp << __x.__x_[__j];
- for (size_t __j = 0; __j < __x.__i_; ++__j)
- __os << __sp << __x.__x_[__j];
- __os << __sp << __x.__c_;
- return __os;
+operator<<(basic_ostream<_CharT, _Traits>& __os, const subtract_with_carry_engine<_UInt, _Wp, _Sp, _Rp>& __x) {
+ __save_flags<_CharT, _Traits> __lx(__os);
+ typedef basic_ostream<_CharT, _Traits> _Ostream;
+ __os.flags(_Ostream::dec | _Ostream::left);
+ _CharT __sp = __os.widen(' ');
+ __os.fill(__sp);
+ __os << __x.__x_[__x.__i_];
+ for (size_t __j = __x.__i_ + 1; __j < _Rp; ++__j)
+ __os << __sp << __x.__x_[__j];
+ for (size_t __j = 0; __j < __x.__i_; ++__j)
+ __os << __sp << __x.__x_[__j];
+ __os << __sp << __x.__c_;
+ return __os;
}
-template <class _CharT, class _Traits,
- class _UInt, size_t _Wp, size_t _Sp, size_t _Rp>
+template <class _CharT, class _Traits, class _UInt, size_t _Wp, size_t _Sp, size_t _Rp>
_LIBCPP_HIDE_FROM_ABI basic_istream<_CharT, _Traits>&
-operator>>(basic_istream<_CharT, _Traits>& __is,
- subtract_with_carry_engine<_UInt, _Wp, _Sp, _Rp>& __x)
-{
- __save_flags<_CharT, _Traits> __lx(__is);
- typedef basic_istream<_CharT, _Traits> _Istream;
- __is.flags(_Istream::dec | _Istream::skipws);
- _UInt __t[_Rp+1];
- for (size_t __i = 0; __i < _Rp+1; ++__i)
- __is >> __t[__i];
- if (!__is.fail())
- {
- for (size_t __i = 0; __i < _Rp; ++__i)
- __x.__x_[__i] = __t[__i];
- __x.__c_ = __t[_Rp];
- __x.__i_ = 0;
- }
- return __is;
+operator>>(basic_istream<_CharT, _Traits>& __is, subtract_with_carry_engine<_UInt, _Wp, _Sp, _Rp>& __x) {
+ __save_flags<_CharT, _Traits> __lx(__is);
+ typedef basic_istream<_CharT, _Traits> _Istream;
+ __is.flags(_Istream::dec | _Istream::skipws);
+ _UInt __t[_Rp + 1];
+ for (size_t __i = 0; __i < _Rp + 1; ++__i)
+ __is >> __t[__i];
+ if (!__is.fail()) {
+ for (size_t __i = 0; __i < _Rp; ++__i)
+ __x.__x_[__i] = __t[__i];
+ __x.__c_ = __t[_Rp];
+ __x.__i_ = 0;
+ }
+ return __is;
}
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__random/uniform_int_distribution.h b/contrib/llvm-project/libcxx/include/__random/uniform_int_distribution.h
index 3a2b95c035b3..4e3ca3efe568 100644
--- a/contrib/llvm-project/libcxx/include/__random/uniform_int_distribution.h
+++ b/contrib/llvm-project/libcxx/include/__random/uniform_int_distribution.h
@@ -29,263 +29,232 @@ _LIBCPP_PUSH_MACROS
_LIBCPP_BEGIN_NAMESPACE_STD
-template<class _Engine, class _UIntType>
-class __independent_bits_engine
-{
+template <class _Engine, class _UIntType>
+class __independent_bits_engine {
public:
- // types
- typedef _UIntType result_type;
+ // types
+ typedef _UIntType result_type;
private:
- typedef typename _Engine::result_type _Engine_result_type;
- typedef __conditional_t<sizeof(_Engine_result_type) <= sizeof(result_type), result_type, _Engine_result_type>
- _Working_result_type;
-
- _Engine& __e_;
- size_t __w_;
- size_t __w0_;
- size_t __n_;
- size_t __n0_;
- _Working_result_type __y0_;
- _Working_result_type __y1_;
- _Engine_result_type __mask0_;
- _Engine_result_type __mask1_;
+ typedef typename _Engine::result_type _Engine_result_type;
+ typedef __conditional_t<sizeof(_Engine_result_type) <= sizeof(result_type), result_type, _Engine_result_type>
+ _Working_result_type;
+
+ _Engine& __e_;
+ size_t __w_;
+ size_t __w0_;
+ size_t __n_;
+ size_t __n0_;
+ _Working_result_type __y0_;
+ _Working_result_type __y1_;
+ _Engine_result_type __mask0_;
+ _Engine_result_type __mask1_;
#ifdef _LIBCPP_CXX03_LANG
- static const _Working_result_type _Rp = _Engine::_Max - _Engine::_Min
- + _Working_result_type(1);
+ static const _Working_result_type _Rp = _Engine::_Max - _Engine::_Min + _Working_result_type(1);
#else
- static _LIBCPP_CONSTEXPR const _Working_result_type _Rp = _Engine::max() - _Engine::min()
- + _Working_result_type(1);
+ static _LIBCPP_CONSTEXPR const _Working_result_type _Rp = _Engine::max() - _Engine::min() + _Working_result_type(1);
#endif
- static _LIBCPP_CONSTEXPR const size_t __m = __log2<_Working_result_type, _Rp>::value;
- static _LIBCPP_CONSTEXPR const size_t _WDt = numeric_limits<_Working_result_type>::digits;
- static _LIBCPP_CONSTEXPR const size_t _EDt = numeric_limits<_Engine_result_type>::digits;
+ static _LIBCPP_CONSTEXPR const size_t __m = __log2<_Working_result_type, _Rp>::value;
+ static _LIBCPP_CONSTEXPR const size_t _WDt = numeric_limits<_Working_result_type>::digits;
+ static _LIBCPP_CONSTEXPR const size_t _EDt = numeric_limits<_Engine_result_type>::digits;
public:
- // constructors and seeding functions
- _LIBCPP_HIDE_FROM_ABI __independent_bits_engine(_Engine& __e, size_t __w);
+ // constructors and seeding functions
+ _LIBCPP_HIDE_FROM_ABI __independent_bits_engine(_Engine& __e, size_t __w);
- // generating functions
- _LIBCPP_HIDE_FROM_ABI result_type operator()() {return __eval(integral_constant<bool, _Rp != 0>());}
+ // generating functions
+ _LIBCPP_HIDE_FROM_ABI result_type operator()() { return __eval(integral_constant<bool, _Rp != 0>()); }
private:
- _LIBCPP_HIDE_FROM_ABI result_type __eval(false_type);
- _LIBCPP_HIDE_FROM_ABI result_type __eval(true_type);
+ _LIBCPP_HIDE_FROM_ABI result_type __eval(false_type);
+ _LIBCPP_HIDE_FROM_ABI result_type __eval(true_type);
};
-template<class _Engine, class _UIntType>
-__independent_bits_engine<_Engine, _UIntType>
- ::__independent_bits_engine(_Engine& __e, size_t __w)
- : __e_(__e),
- __w_(__w)
-{
- __n_ = __w_ / __m + (__w_ % __m != 0);
+template <class _Engine, class _UIntType>
+__independent_bits_engine<_Engine, _UIntType>::__independent_bits_engine(_Engine& __e, size_t __w)
+ : __e_(__e), __w_(__w) {
+ __n_ = __w_ / __m + (__w_ % __m != 0);
+ __w0_ = __w_ / __n_;
+ if (_Rp == 0)
+ __y0_ = _Rp;
+ else if (__w0_ < _WDt)
+ __y0_ = (_Rp >> __w0_) << __w0_;
+ else
+ __y0_ = 0;
+ if (_Rp - __y0_ > __y0_ / __n_) {
+ ++__n_;
__w0_ = __w_ / __n_;
- if (_Rp == 0)
- __y0_ = _Rp;
- else if (__w0_ < _WDt)
- __y0_ = (_Rp >> __w0_) << __w0_;
+ if (__w0_ < _WDt)
+ __y0_ = (_Rp >> __w0_) << __w0_;
else
- __y0_ = 0;
- if (_Rp - __y0_ > __y0_ / __n_)
- {
- ++__n_;
- __w0_ = __w_ / __n_;
- if (__w0_ < _WDt)
- __y0_ = (_Rp >> __w0_) << __w0_;
- else
- __y0_ = 0;
- }
- __n0_ = __n_ - __w_ % __n_;
- if (__w0_ < _WDt - 1)
- __y1_ = (_Rp >> (__w0_ + 1)) << (__w0_ + 1);
- else
- __y1_ = 0;
- __mask0_ = __w0_ > 0 ? _Engine_result_type(~0) >> (_EDt - __w0_) :
- _Engine_result_type(0);
- __mask1_ = __w0_ < _EDt - 1 ?
- _Engine_result_type(~0) >> (_EDt - (__w0_ + 1)) :
- _Engine_result_type(~0);
+ __y0_ = 0;
+ }
+ __n0_ = __n_ - __w_ % __n_;
+ if (__w0_ < _WDt - 1)
+ __y1_ = (_Rp >> (__w0_ + 1)) << (__w0_ + 1);
+ else
+ __y1_ = 0;
+ __mask0_ = __w0_ > 0 ? _Engine_result_type(~0) >> (_EDt - __w0_) : _Engine_result_type(0);
+ __mask1_ = __w0_ < _EDt - 1 ? _Engine_result_type(~0) >> (_EDt - (__w0_ + 1)) : _Engine_result_type(~0);
}
-template<class _Engine, class _UIntType>
-inline
-_UIntType
-__independent_bits_engine<_Engine, _UIntType>::__eval(false_type)
-{
- return static_cast<result_type>(__e_() & __mask0_);
+template <class _Engine, class _UIntType>
+inline _UIntType __independent_bits_engine<_Engine, _UIntType>::__eval(false_type) {
+ return static_cast<result_type>(__e_() & __mask0_);
}
-template<class _Engine, class _UIntType>
-_UIntType
-__independent_bits_engine<_Engine, _UIntType>::__eval(true_type)
-{
- const size_t __w_rt = numeric_limits<result_type>::digits;
- result_type __sp = 0;
- for (size_t __k = 0; __k < __n0_; ++__k)
- {
- _Engine_result_type __u;
- do
- {
- __u = __e_() - _Engine::min();
- } while (__u >= __y0_);
- if (__w0_ < __w_rt)
- __sp <<= __w0_;
- else
- __sp = 0;
- __sp += __u & __mask0_;
- }
- for (size_t __k = __n0_; __k < __n_; ++__k)
- {
- _Engine_result_type __u;
- do
- {
- __u = __e_() - _Engine::min();
- } while (__u >= __y1_);
- if (__w0_ < __w_rt - 1)
- __sp <<= __w0_ + 1;
- else
- __sp = 0;
- __sp += __u & __mask1_;
- }
- return __sp;
+template <class _Engine, class _UIntType>
+_UIntType __independent_bits_engine<_Engine, _UIntType>::__eval(true_type) {
+ const size_t __w_rt = numeric_limits<result_type>::digits;
+ result_type __sp = 0;
+ for (size_t __k = 0; __k < __n0_; ++__k) {
+ _Engine_result_type __u;
+ do {
+ __u = __e_() - _Engine::min();
+ } while (__u >= __y0_);
+ if (__w0_ < __w_rt)
+ __sp <<= __w0_;
+ else
+ __sp = 0;
+ __sp += __u & __mask0_;
+ }
+ for (size_t __k = __n0_; __k < __n_; ++__k) {
+ _Engine_result_type __u;
+ do {
+ __u = __e_() - _Engine::min();
+ } while (__u >= __y1_);
+ if (__w0_ < __w_rt - 1)
+ __sp <<= __w0_ + 1;
+ else
+ __sp = 0;
+ __sp += __u & __mask1_;
+ }
+ return __sp;
}
-template<class _IntType = int>
-class uniform_int_distribution
-{
- static_assert(__libcpp_random_is_valid_inttype<_IntType>::value, "IntType must be a supported integer type");
+template <class _IntType = int>
+class uniform_int_distribution {
+ static_assert(__libcpp_random_is_valid_inttype<_IntType>::value, "IntType must be a supported integer type");
+
public:
- // types
- typedef _IntType result_type;
-
- class param_type
- {
- result_type __a_;
- result_type __b_;
- public:
- typedef uniform_int_distribution distribution_type;
-
- _LIBCPP_HIDE_FROM_ABI explicit param_type(result_type __a = 0,
- result_type __b = numeric_limits<result_type>::max())
- : __a_(__a), __b_(__b) {}
-
- _LIBCPP_HIDE_FROM_ABI result_type a() const {return __a_;}
- _LIBCPP_HIDE_FROM_ABI result_type b() const {return __b_;}
-
- _LIBCPP_HIDE_FROM_ABI
- friend bool operator==(const param_type& __x, const param_type& __y)
- {return __x.__a_ == __y.__a_ && __x.__b_ == __y.__b_;}
- _LIBCPP_HIDE_FROM_ABI
- friend bool operator!=(const param_type& __x, const param_type& __y)
- {return !(__x == __y);}
- };
+ // types
+ typedef _IntType result_type;
+
+ class param_type {
+ result_type __a_;
+ result_type __b_;
+
+ public:
+ typedef uniform_int_distribution distribution_type;
+
+ _LIBCPP_HIDE_FROM_ABI explicit param_type(result_type __a = 0, result_type __b = numeric_limits<result_type>::max())
+ : __a_(__a), __b_(__b) {}
+
+ _LIBCPP_HIDE_FROM_ABI result_type a() const { return __a_; }
+ _LIBCPP_HIDE_FROM_ABI result_type b() const { return __b_; }
+
+ _LIBCPP_HIDE_FROM_ABI friend bool operator==(const param_type& __x, const param_type& __y) {
+ return __x.__a_ == __y.__a_ && __x.__b_ == __y.__b_;
+ }
+ _LIBCPP_HIDE_FROM_ABI friend bool operator!=(const param_type& __x, const param_type& __y) { return !(__x == __y); }
+ };
private:
- param_type __p_;
+ param_type __p_;
public:
- // constructors and reset functions
+ // constructors and reset functions
#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI uniform_int_distribution() : uniform_int_distribution(0) {}
- _LIBCPP_HIDE_FROM_ABI explicit uniform_int_distribution(
- result_type __a, result_type __b = numeric_limits<result_type>::max())
- : __p_(param_type(__a, __b)) {}
+ _LIBCPP_HIDE_FROM_ABI uniform_int_distribution() : uniform_int_distribution(0) {}
+ _LIBCPP_HIDE_FROM_ABI explicit uniform_int_distribution(
+ result_type __a, result_type __b = numeric_limits<result_type>::max())
+ : __p_(param_type(__a, __b)) {}
#else
- explicit uniform_int_distribution(
- result_type __a = 0,
- result_type __b = numeric_limits<result_type>::max())
- : __p_(param_type(__a, __b)) {}
+ explicit uniform_int_distribution(result_type __a = 0, result_type __b = numeric_limits<result_type>::max())
+ : __p_(param_type(__a, __b)) {}
#endif
- _LIBCPP_HIDE_FROM_ABI explicit uniform_int_distribution(const param_type& __p) : __p_(__p) {}
- _LIBCPP_HIDE_FROM_ABI void reset() {}
-
- // generating functions
- template<class _URNG>
- _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g)
- {return (*this)(__g, __p_);}
- template<class _URNG>
- _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g, const param_type& __p);
-
- // property functions
- _LIBCPP_HIDE_FROM_ABI result_type a() const {return __p_.a();}
- _LIBCPP_HIDE_FROM_ABI result_type b() const {return __p_.b();}
-
- _LIBCPP_HIDE_FROM_ABI param_type param() const {return __p_;}
- _LIBCPP_HIDE_FROM_ABI void param(const param_type& __p) {__p_ = __p;}
-
- _LIBCPP_HIDE_FROM_ABI result_type min() const {return a();}
- _LIBCPP_HIDE_FROM_ABI result_type max() const {return b();}
-
- _LIBCPP_HIDE_FROM_ABI
- friend bool operator==(const uniform_int_distribution& __x,
- const uniform_int_distribution& __y)
- {return __x.__p_ == __y.__p_;}
- _LIBCPP_HIDE_FROM_ABI
- friend bool operator!=(const uniform_int_distribution& __x,
- const uniform_int_distribution& __y)
- {return !(__x == __y);}
+ _LIBCPP_HIDE_FROM_ABI explicit uniform_int_distribution(const param_type& __p) : __p_(__p) {}
+ _LIBCPP_HIDE_FROM_ABI void reset() {}
+
+ // generating functions
+ template <class _URNG>
+ _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g) {
+ return (*this)(__g, __p_);
+ }
+ template <class _URNG>
+ _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g, const param_type& __p);
+
+ // property functions
+ _LIBCPP_HIDE_FROM_ABI result_type a() const { return __p_.a(); }
+ _LIBCPP_HIDE_FROM_ABI result_type b() const { return __p_.b(); }
+
+ _LIBCPP_HIDE_FROM_ABI param_type param() const { return __p_; }
+ _LIBCPP_HIDE_FROM_ABI void param(const param_type& __p) { __p_ = __p; }
+
+ _LIBCPP_HIDE_FROM_ABI result_type min() const { return a(); }
+ _LIBCPP_HIDE_FROM_ABI result_type max() const { return b(); }
+
+ _LIBCPP_HIDE_FROM_ABI friend bool
+ operator==(const uniform_int_distribution& __x, const uniform_int_distribution& __y) {
+ return __x.__p_ == __y.__p_;
+ }
+ _LIBCPP_HIDE_FROM_ABI friend bool
+ operator!=(const uniform_int_distribution& __x, const uniform_int_distribution& __y) {
+ return !(__x == __y);
+ }
};
-template<class _IntType>
-template<class _URNG>
-typename uniform_int_distribution<_IntType>::result_type
-uniform_int_distribution<_IntType>::operator()(_URNG& __g, const param_type& __p)
-_LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK
-{
- static_assert(__libcpp_random_is_valid_urng<_URNG>::value, "");
- typedef __conditional_t<sizeof(result_type) <= sizeof(uint32_t), uint32_t, __make_unsigned_t<result_type> >
- _UIntType;
- const _UIntType __rp = _UIntType(__p.b()) - _UIntType(__p.a()) + _UIntType(1);
- if (__rp == 1)
- return __p.a();
- const size_t __dt = numeric_limits<_UIntType>::digits;
- typedef __independent_bits_engine<_URNG, _UIntType> _Eng;
- if (__rp == 0)
- return static_cast<result_type>(_Eng(__g, __dt)());
- size_t __w = __dt - std::__countl_zero(__rp) - 1;
- if ((__rp & (numeric_limits<_UIntType>::max() >> (__dt - __w))) != 0)
- ++__w;
- _Eng __e(__g, __w);
- _UIntType __u;
- do
- {
- __u = __e();
- } while (__u >= __rp);
- return static_cast<result_type>(__u + __p.a());
+template <class _IntType>
+template <class _URNG>
+typename uniform_int_distribution<_IntType>::result_type uniform_int_distribution<_IntType>::operator()(
+ _URNG& __g, const param_type& __p) _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK {
+ static_assert(__libcpp_random_is_valid_urng<_URNG>::value, "");
+ typedef __conditional_t<sizeof(result_type) <= sizeof(uint32_t), uint32_t, __make_unsigned_t<result_type> > _UIntType;
+ const _UIntType __rp = _UIntType(__p.b()) - _UIntType(__p.a()) + _UIntType(1);
+ if (__rp == 1)
+ return __p.a();
+ const size_t __dt = numeric_limits<_UIntType>::digits;
+ typedef __independent_bits_engine<_URNG, _UIntType> _Eng;
+ if (__rp == 0)
+ return static_cast<result_type>(_Eng(__g, __dt)());
+ size_t __w = __dt - std::__countl_zero(__rp) - 1;
+ if ((__rp & (numeric_limits<_UIntType>::max() >> (__dt - __w))) != 0)
+ ++__w;
+ _Eng __e(__g, __w);
+ _UIntType __u;
+ do {
+ __u = __e();
+ } while (__u >= __rp);
+ return static_cast<result_type>(__u + __p.a());
}
template <class _CharT, class _Traits, class _IT>
_LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>&
-operator<<(basic_ostream<_CharT, _Traits>& __os,
- const uniform_int_distribution<_IT>& __x)
-{
- __save_flags<_CharT, _Traits> __lx(__os);
- typedef basic_ostream<_CharT, _Traits> _Ostream;
- __os.flags(_Ostream::dec | _Ostream::left);
- _CharT __sp = __os.widen(' ');
- __os.fill(__sp);
- return __os << __x.a() << __sp << __x.b();
+operator<<(basic_ostream<_CharT, _Traits>& __os, const uniform_int_distribution<_IT>& __x) {
+ __save_flags<_CharT, _Traits> __lx(__os);
+ typedef basic_ostream<_CharT, _Traits> _Ostream;
+ __os.flags(_Ostream::dec | _Ostream::left);
+ _CharT __sp = __os.widen(' ');
+ __os.fill(__sp);
+ return __os << __x.a() << __sp << __x.b();
}
template <class _CharT, class _Traits, class _IT>
_LIBCPP_HIDE_FROM_ABI basic_istream<_CharT, _Traits>&
-operator>>(basic_istream<_CharT, _Traits>& __is,
- uniform_int_distribution<_IT>& __x)
-{
- typedef uniform_int_distribution<_IT> _Eng;
- typedef typename _Eng::result_type result_type;
- typedef typename _Eng::param_type param_type;
- __save_flags<_CharT, _Traits> __lx(__is);
- typedef basic_istream<_CharT, _Traits> _Istream;
- __is.flags(_Istream::dec | _Istream::skipws);
- result_type __a;
- result_type __b;
- __is >> __a >> __b;
- if (!__is.fail())
- __x.param(param_type(__a, __b));
- return __is;
+operator>>(basic_istream<_CharT, _Traits>& __is, uniform_int_distribution<_IT>& __x) {
+ typedef uniform_int_distribution<_IT> _Eng;
+ typedef typename _Eng::result_type result_type;
+ typedef typename _Eng::param_type param_type;
+ __save_flags<_CharT, _Traits> __lx(__is);
+ typedef basic_istream<_CharT, _Traits> _Istream;
+ __is.flags(_Istream::dec | _Istream::skipws);
+ result_type __a;
+ result_type __b;
+ __is >> __a >> __b;
+ if (!__is.fail())
+ __x.param(param_type(__a, __b));
+ return __is;
}
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__random/uniform_random_bit_generator.h b/contrib/llvm-project/libcxx/include/__random/uniform_random_bit_generator.h
index ddb3158eead9..4076f19b2cb2 100644
--- a/contrib/llvm-project/libcxx/include/__random/uniform_random_bit_generator.h
+++ b/contrib/llvm-project/libcxx/include/__random/uniform_random_bit_generator.h
@@ -28,14 +28,12 @@ _LIBCPP_BEGIN_NAMESPACE_STD
#if _LIBCPP_STD_VER >= 20
// [rand.req.urng]
-template<class _Gen>
-concept uniform_random_bit_generator =
- invocable<_Gen&> && unsigned_integral<invoke_result_t<_Gen&>> &&
- requires {
- { _Gen::min() } -> same_as<invoke_result_t<_Gen&>>;
- { _Gen::max() } -> same_as<invoke_result_t<_Gen&>>;
- requires bool_constant<(_Gen::min() < _Gen::max())>::value;
- };
+template <class _Gen>
+concept uniform_random_bit_generator = invocable<_Gen&> && unsigned_integral<invoke_result_t<_Gen&>> && requires {
+ { _Gen::min() } -> same_as<invoke_result_t<_Gen&>>;
+ { _Gen::max() } -> same_as<invoke_result_t<_Gen&>>;
+ requires bool_constant<(_Gen::min() < _Gen::max())>::value;
+};
#endif // _LIBCPP_STD_VER >= 20
diff --git a/contrib/llvm-project/libcxx/include/__random/uniform_real_distribution.h b/contrib/llvm-project/libcxx/include/__random/uniform_real_distribution.h
index 28b6e9181c5f..250cb8bab58c 100644
--- a/contrib/llvm-project/libcxx/include/__random/uniform_real_distribution.h
+++ b/contrib/llvm-project/libcxx/include/__random/uniform_real_distribution.h
@@ -24,137 +24,111 @@ _LIBCPP_PUSH_MACROS
_LIBCPP_BEGIN_NAMESPACE_STD
-template<class _RealType = double>
-class _LIBCPP_TEMPLATE_VIS uniform_real_distribution
-{
+template <class _RealType = double>
+class _LIBCPP_TEMPLATE_VIS uniform_real_distribution {
static_assert(__libcpp_random_is_valid_realtype<_RealType>::value,
"RealType must be a supported floating-point type");
public:
- // types
- typedef _RealType result_type;
-
- class _LIBCPP_TEMPLATE_VIS param_type
- {
- result_type __a_;
- result_type __b_;
- public:
- typedef uniform_real_distribution distribution_type;
-
- _LIBCPP_HIDE_FROM_ABI
- explicit param_type(result_type __a = 0,
- result_type __b = 1)
- : __a_(__a), __b_(__b) {}
-
- _LIBCPP_HIDE_FROM_ABI
- result_type a() const {return __a_;}
- _LIBCPP_HIDE_FROM_ABI
- result_type b() const {return __b_;}
-
- friend _LIBCPP_HIDE_FROM_ABI
- bool operator==(const param_type& __x, const param_type& __y)
- {return __x.__a_ == __y.__a_ && __x.__b_ == __y.__b_;}
- friend _LIBCPP_HIDE_FROM_ABI
- bool operator!=(const param_type& __x, const param_type& __y)
- {return !(__x == __y);}
- };
+ // types
+ typedef _RealType result_type;
+
+ class _LIBCPP_TEMPLATE_VIS param_type {
+ result_type __a_;
+ result_type __b_;
+
+ public:
+ typedef uniform_real_distribution distribution_type;
+
+ _LIBCPP_HIDE_FROM_ABI explicit param_type(result_type __a = 0, result_type __b = 1) : __a_(__a), __b_(__b) {}
+
+ _LIBCPP_HIDE_FROM_ABI result_type a() const { return __a_; }
+ _LIBCPP_HIDE_FROM_ABI result_type b() const { return __b_; }
+
+ friend _LIBCPP_HIDE_FROM_ABI bool operator==(const param_type& __x, const param_type& __y) {
+ return __x.__a_ == __y.__a_ && __x.__b_ == __y.__b_;
+ }
+ friend _LIBCPP_HIDE_FROM_ABI bool operator!=(const param_type& __x, const param_type& __y) { return !(__x == __y); }
+ };
private:
- param_type __p_;
+ param_type __p_;
public:
- // constructors and reset functions
+ // constructors and reset functions
#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI
- uniform_real_distribution() : uniform_real_distribution(0) {}
- _LIBCPP_HIDE_FROM_ABI explicit uniform_real_distribution(result_type __a, result_type __b = 1)
- : __p_(param_type(__a, __b)) {}
+ _LIBCPP_HIDE_FROM_ABI uniform_real_distribution() : uniform_real_distribution(0) {}
+ _LIBCPP_HIDE_FROM_ABI explicit uniform_real_distribution(result_type __a, result_type __b = 1)
+ : __p_(param_type(__a, __b)) {}
#else
- _LIBCPP_HIDE_FROM_ABI
- explicit uniform_real_distribution(result_type __a = 0, result_type __b = 1)
- : __p_(param_type(__a, __b)) {}
+ _LIBCPP_HIDE_FROM_ABI explicit uniform_real_distribution(result_type __a = 0, result_type __b = 1)
+ : __p_(param_type(__a, __b)) {}
#endif
- _LIBCPP_HIDE_FROM_ABI
- explicit uniform_real_distribution(const param_type& __p) : __p_(__p) {}
- _LIBCPP_HIDE_FROM_ABI
- void reset() {}
-
- // generating functions
- template<class _URNG>
- _LIBCPP_HIDE_FROM_ABI
- result_type operator()(_URNG& __g)
- {return (*this)(__g, __p_);}
- template<class _URNG> _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g, const param_type& __p);
-
- // property functions
- _LIBCPP_HIDE_FROM_ABI
- result_type a() const {return __p_.a();}
- _LIBCPP_HIDE_FROM_ABI
- result_type b() const {return __p_.b();}
-
- _LIBCPP_HIDE_FROM_ABI
- param_type param() const {return __p_;}
- _LIBCPP_HIDE_FROM_ABI
- void param(const param_type& __p) {__p_ = __p;}
-
- _LIBCPP_HIDE_FROM_ABI
- result_type min() const {return a();}
- _LIBCPP_HIDE_FROM_ABI
- result_type max() const {return b();}
-
- friend _LIBCPP_HIDE_FROM_ABI
- bool operator==(const uniform_real_distribution& __x,
- const uniform_real_distribution& __y)
- {return __x.__p_ == __y.__p_;}
- friend _LIBCPP_HIDE_FROM_ABI
- bool operator!=(const uniform_real_distribution& __x,
- const uniform_real_distribution& __y)
- {return !(__x == __y);}
+ _LIBCPP_HIDE_FROM_ABI explicit uniform_real_distribution(const param_type& __p) : __p_(__p) {}
+ _LIBCPP_HIDE_FROM_ABI void reset() {}
+
+ // generating functions
+ template <class _URNG>
+ _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g) {
+ return (*this)(__g, __p_);
+ }
+ template <class _URNG>
+ _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g, const param_type& __p);
+
+ // property functions
+ _LIBCPP_HIDE_FROM_ABI result_type a() const { return __p_.a(); }
+ _LIBCPP_HIDE_FROM_ABI result_type b() const { return __p_.b(); }
+
+ _LIBCPP_HIDE_FROM_ABI param_type param() const { return __p_; }
+ _LIBCPP_HIDE_FROM_ABI void param(const param_type& __p) { __p_ = __p; }
+
+ _LIBCPP_HIDE_FROM_ABI result_type min() const { return a(); }
+ _LIBCPP_HIDE_FROM_ABI result_type max() const { return b(); }
+
+ friend _LIBCPP_HIDE_FROM_ABI bool
+ operator==(const uniform_real_distribution& __x, const uniform_real_distribution& __y) {
+ return __x.__p_ == __y.__p_;
+ }
+ friend _LIBCPP_HIDE_FROM_ABI bool
+ operator!=(const uniform_real_distribution& __x, const uniform_real_distribution& __y) {
+ return !(__x == __y);
+ }
};
-template<class _RealType>
-template<class _URNG>
-inline
-typename uniform_real_distribution<_RealType>::result_type
-uniform_real_distribution<_RealType>::operator()(_URNG& __g, const param_type& __p)
-{
- static_assert(__libcpp_random_is_valid_urng<_URNG>::value, "");
- return (__p.b() - __p.a())
- * std::generate_canonical<_RealType, numeric_limits<_RealType>::digits>(__g)
- + __p.a();
+template <class _RealType>
+template <class _URNG>
+inline typename uniform_real_distribution<_RealType>::result_type
+uniform_real_distribution<_RealType>::operator()(_URNG& __g, const param_type& __p) {
+ static_assert(__libcpp_random_is_valid_urng<_URNG>::value, "");
+ return (__p.b() - __p.a()) * std::generate_canonical<_RealType, numeric_limits<_RealType>::digits>(__g) + __p.a();
}
template <class _CharT, class _Traits, class _RT>
_LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>&
-operator<<(basic_ostream<_CharT, _Traits>& __os,
- const uniform_real_distribution<_RT>& __x)
-{
- __save_flags<_CharT, _Traits> __lx(__os);
- typedef basic_ostream<_CharT, _Traits> _OStream;
- __os.flags(_OStream::dec | _OStream::left | _OStream::fixed |
- _OStream::scientific);
- _CharT __sp = __os.widen(' ');
- __os.fill(__sp);
- return __os << __x.a() << __sp << __x.b();
+operator<<(basic_ostream<_CharT, _Traits>& __os, const uniform_real_distribution<_RT>& __x) {
+ __save_flags<_CharT, _Traits> __lx(__os);
+ typedef basic_ostream<_CharT, _Traits> _OStream;
+ __os.flags(_OStream::dec | _OStream::left | _OStream::fixed | _OStream::scientific);
+ _CharT __sp = __os.widen(' ');
+ __os.fill(__sp);
+ return __os << __x.a() << __sp << __x.b();
}
template <class _CharT, class _Traits, class _RT>
_LIBCPP_HIDE_FROM_ABI basic_istream<_CharT, _Traits>&
-operator>>(basic_istream<_CharT, _Traits>& __is,
- uniform_real_distribution<_RT>& __x)
-{
- typedef uniform_real_distribution<_RT> _Eng;
- typedef typename _Eng::result_type result_type;
- typedef typename _Eng::param_type param_type;
- __save_flags<_CharT, _Traits> __lx(__is);
- typedef basic_istream<_CharT, _Traits> _Istream;
- __is.flags(_Istream::dec | _Istream::skipws);
- result_type __a;
- result_type __b;
- __is >> __a >> __b;
- if (!__is.fail())
- __x.param(param_type(__a, __b));
- return __is;
+operator>>(basic_istream<_CharT, _Traits>& __is, uniform_real_distribution<_RT>& __x) {
+ typedef uniform_real_distribution<_RT> _Eng;
+ typedef typename _Eng::result_type result_type;
+ typedef typename _Eng::param_type param_type;
+ __save_flags<_CharT, _Traits> __lx(__is);
+ typedef basic_istream<_CharT, _Traits> _Istream;
+ __is.flags(_Istream::dec | _Istream::skipws);
+ result_type __a;
+ result_type __b;
+ __is >> __a >> __b;
+ if (!__is.fail())
+ __x.param(param_type(__a, __b));
+ return __is;
}
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__random/weibull_distribution.h b/contrib/llvm-project/libcxx/include/__random/weibull_distribution.h
index 996799281031..aa3d63c8e866 100644
--- a/contrib/llvm-project/libcxx/include/__random/weibull_distribution.h
+++ b/contrib/llvm-project/libcxx/include/__random/weibull_distribution.h
@@ -25,131 +25,104 @@ _LIBCPP_PUSH_MACROS
_LIBCPP_BEGIN_NAMESPACE_STD
-template<class _RealType = double>
-class _LIBCPP_TEMPLATE_VIS weibull_distribution
-{
+template <class _RealType = double>
+class _LIBCPP_TEMPLATE_VIS weibull_distribution {
static_assert(__libcpp_random_is_valid_realtype<_RealType>::value,
"RealType must be a supported floating-point type");
public:
- // types
- typedef _RealType result_type;
-
- class _LIBCPP_TEMPLATE_VIS param_type
- {
- result_type __a_;
- result_type __b_;
- public:
- typedef weibull_distribution distribution_type;
-
- _LIBCPP_HIDE_FROM_ABI
- explicit param_type(result_type __a = 1, result_type __b = 1)
- : __a_(__a), __b_(__b) {}
-
- _LIBCPP_HIDE_FROM_ABI
- result_type a() const {return __a_;}
- _LIBCPP_HIDE_FROM_ABI
- result_type b() const {return __b_;}
-
- friend _LIBCPP_HIDE_FROM_ABI
- bool operator==(const param_type& __x, const param_type& __y)
- {return __x.__a_ == __y.__a_ && __x.__b_ == __y.__b_;}
- friend _LIBCPP_HIDE_FROM_ABI
- bool operator!=(const param_type& __x, const param_type& __y)
- {return !(__x == __y);}
- };
+ // types
+ typedef _RealType result_type;
+
+ class _LIBCPP_TEMPLATE_VIS param_type {
+ result_type __a_;
+ result_type __b_;
+
+ public:
+ typedef weibull_distribution distribution_type;
+
+ _LIBCPP_HIDE_FROM_ABI explicit param_type(result_type __a = 1, result_type __b = 1) : __a_(__a), __b_(__b) {}
+
+ _LIBCPP_HIDE_FROM_ABI result_type a() const { return __a_; }
+ _LIBCPP_HIDE_FROM_ABI result_type b() const { return __b_; }
+
+ friend _LIBCPP_HIDE_FROM_ABI bool operator==(const param_type& __x, const param_type& __y) {
+ return __x.__a_ == __y.__a_ && __x.__b_ == __y.__b_;
+ }
+ friend _LIBCPP_HIDE_FROM_ABI bool operator!=(const param_type& __x, const param_type& __y) { return !(__x == __y); }
+ };
private:
- param_type __p_;
+ param_type __p_;
public:
- // constructor and reset functions
+ // constructor and reset functions
#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI
- weibull_distribution() : weibull_distribution(1) {}
- _LIBCPP_HIDE_FROM_ABI
- explicit weibull_distribution(result_type __a, result_type __b = 1)
- : __p_(param_type(__a, __b)) {}
+ _LIBCPP_HIDE_FROM_ABI weibull_distribution() : weibull_distribution(1) {}
+ _LIBCPP_HIDE_FROM_ABI explicit weibull_distribution(result_type __a, result_type __b = 1)
+ : __p_(param_type(__a, __b)) {}
#else
- _LIBCPP_HIDE_FROM_ABI
- explicit weibull_distribution(result_type __a = 1, result_type __b = 1)
- : __p_(param_type(__a, __b)) {}
+ _LIBCPP_HIDE_FROM_ABI explicit weibull_distribution(result_type __a = 1, result_type __b = 1)
+ : __p_(param_type(__a, __b)) {}
#endif
- _LIBCPP_HIDE_FROM_ABI
- explicit weibull_distribution(const param_type& __p)
- : __p_(__p) {}
- _LIBCPP_HIDE_FROM_ABI
- void reset() {}
-
- // generating functions
- template<class _URNG>
- _LIBCPP_HIDE_FROM_ABI
- result_type operator()(_URNG& __g)
- {return (*this)(__g, __p_);}
- template<class _URNG>
- _LIBCPP_HIDE_FROM_ABI
- result_type operator()(_URNG& __g, const param_type& __p)
- {return __p.b() *
- std::pow(exponential_distribution<result_type>()(__g), 1/__p.a());}
-
- // property functions
- _LIBCPP_HIDE_FROM_ABI
- result_type a() const {return __p_.a();}
- _LIBCPP_HIDE_FROM_ABI
- result_type b() const {return __p_.b();}
-
- _LIBCPP_HIDE_FROM_ABI
- param_type param() const {return __p_;}
- _LIBCPP_HIDE_FROM_ABI
- void param(const param_type& __p) {__p_ = __p;}
-
- _LIBCPP_HIDE_FROM_ABI
- result_type min() const {return 0;}
- _LIBCPP_HIDE_FROM_ABI
- result_type max() const {return numeric_limits<result_type>::infinity();}
-
- friend _LIBCPP_HIDE_FROM_ABI
- bool operator==(const weibull_distribution& __x,
- const weibull_distribution& __y)
- {return __x.__p_ == __y.__p_;}
- friend _LIBCPP_HIDE_FROM_ABI
- bool operator!=(const weibull_distribution& __x,
- const weibull_distribution& __y)
- {return !(__x == __y);}
+ _LIBCPP_HIDE_FROM_ABI explicit weibull_distribution(const param_type& __p) : __p_(__p) {}
+ _LIBCPP_HIDE_FROM_ABI void reset() {}
+
+ // generating functions
+ template <class _URNG>
+ _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g) {
+ return (*this)(__g, __p_);
+ }
+ template <class _URNG>
+ _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g, const param_type& __p) {
+ return __p.b() * std::pow(exponential_distribution<result_type>()(__g), 1 / __p.a());
+ }
+
+ // property functions
+ _LIBCPP_HIDE_FROM_ABI result_type a() const { return __p_.a(); }
+ _LIBCPP_HIDE_FROM_ABI result_type b() const { return __p_.b(); }
+
+ _LIBCPP_HIDE_FROM_ABI param_type param() const { return __p_; }
+ _LIBCPP_HIDE_FROM_ABI void param(const param_type& __p) { __p_ = __p; }
+
+ _LIBCPP_HIDE_FROM_ABI result_type min() const { return 0; }
+ _LIBCPP_HIDE_FROM_ABI result_type max() const { return numeric_limits<result_type>::infinity(); }
+
+ friend _LIBCPP_HIDE_FROM_ABI bool operator==(const weibull_distribution& __x, const weibull_distribution& __y) {
+ return __x.__p_ == __y.__p_;
+ }
+ friend _LIBCPP_HIDE_FROM_ABI bool operator!=(const weibull_distribution& __x, const weibull_distribution& __y) {
+ return !(__x == __y);
+ }
};
template <class _CharT, class _Traits, class _RT>
_LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>&
-operator<<(basic_ostream<_CharT, _Traits>& __os,
- const weibull_distribution<_RT>& __x)
-{
- __save_flags<_CharT, _Traits> __lx(__os);
- typedef basic_ostream<_CharT, _Traits> _OStream;
- __os.flags(_OStream::dec | _OStream::left | _OStream::fixed |
- _OStream::scientific);
- _CharT __sp = __os.widen(' ');
- __os.fill(__sp);
- __os << __x.a() << __sp << __x.b();
- return __os;
+operator<<(basic_ostream<_CharT, _Traits>& __os, const weibull_distribution<_RT>& __x) {
+ __save_flags<_CharT, _Traits> __lx(__os);
+ typedef basic_ostream<_CharT, _Traits> _OStream;
+ __os.flags(_OStream::dec | _OStream::left | _OStream::fixed | _OStream::scientific);
+ _CharT __sp = __os.widen(' ');
+ __os.fill(__sp);
+ __os << __x.a() << __sp << __x.b();
+ return __os;
}
template <class _CharT, class _Traits, class _RT>
_LIBCPP_HIDE_FROM_ABI basic_istream<_CharT, _Traits>&
-operator>>(basic_istream<_CharT, _Traits>& __is,
- weibull_distribution<_RT>& __x)
-{
- typedef weibull_distribution<_RT> _Eng;
- typedef typename _Eng::result_type result_type;
- typedef typename _Eng::param_type param_type;
- __save_flags<_CharT, _Traits> __lx(__is);
- typedef basic_istream<_CharT, _Traits> _Istream;
- __is.flags(_Istream::dec | _Istream::skipws);
- result_type __a;
- result_type __b;
- __is >> __a >> __b;
- if (!__is.fail())
- __x.param(param_type(__a, __b));
- return __is;
+operator>>(basic_istream<_CharT, _Traits>& __is, weibull_distribution<_RT>& __x) {
+ typedef weibull_distribution<_RT> _Eng;
+ typedef typename _Eng::result_type result_type;
+ typedef typename _Eng::param_type param_type;
+ __save_flags<_CharT, _Traits> __lx(__is);
+ typedef basic_istream<_CharT, _Traits> _Istream;
+ __is.flags(_Istream::dec | _Istream::skipws);
+ result_type __a;
+ result_type __b;
+ __is >> __a >> __b;
+ if (!__is.fail())
+ __x.param(param_type(__a, __b));
+ return __is;
}
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__ranges/access.h b/contrib/llvm-project/libcxx/include/__ranges/access.h
index 502bd5e951c4..263fdd637fd9 100644
--- a/contrib/llvm-project/libcxx/include/__ranges/access.h
+++ b/contrib/llvm-project/libcxx/include/__ranges/access.h
@@ -32,138 +32,121 @@ _LIBCPP_BEGIN_NAMESPACE_STD
#if _LIBCPP_STD_VER >= 20
namespace ranges {
- template <class _Tp>
- concept __can_borrow =
- is_lvalue_reference_v<_Tp> || enable_borrowed_range<remove_cvref_t<_Tp>>;
+template <class _Tp>
+concept __can_borrow = is_lvalue_reference_v<_Tp> || enable_borrowed_range<remove_cvref_t<_Tp>>;
} // namespace ranges
// [range.access.begin]
namespace ranges {
namespace __begin {
- template <class _Tp>
- concept __member_begin =
- __can_borrow<_Tp> &&
- __workaround_52970<_Tp> &&
- requires(_Tp&& __t) {
- { _LIBCPP_AUTO_CAST(__t.begin()) } -> input_or_output_iterator;
- };
+template <class _Tp>
+concept __member_begin = __can_borrow<_Tp> && __workaround_52970<_Tp> && requires(_Tp&& __t) {
+ { _LIBCPP_AUTO_CAST(__t.begin()) } -> input_or_output_iterator;
+};
- void begin(auto&) = delete;
- void begin(const auto&) = delete;
+void begin(auto&) = delete;
+void begin(const auto&) = delete;
- template <class _Tp>
- concept __unqualified_begin =
- !__member_begin<_Tp> &&
- __can_borrow<_Tp> &&
- __class_or_enum<remove_cvref_t<_Tp>> &&
- requires(_Tp && __t) {
+template <class _Tp>
+concept __unqualified_begin =
+ !__member_begin<_Tp> && __can_borrow<_Tp> && __class_or_enum<remove_cvref_t<_Tp>> && requires(_Tp&& __t) {
{ _LIBCPP_AUTO_CAST(begin(__t)) } -> input_or_output_iterator;
};
- struct __fn {
- template <class _Tp>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp (&__t)[]) const noexcept
- requires (sizeof(_Tp) >= 0) // Disallow incomplete element types.
- {
- return __t + 0;
- }
-
- template <class _Tp, size_t _Np>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp (&__t)[_Np]) const noexcept
- requires (sizeof(_Tp) >= 0) // Disallow incomplete element types.
- {
- return __t + 0;
- }
-
- template <class _Tp>
- requires __member_begin<_Tp>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t) const
- noexcept(noexcept(_LIBCPP_AUTO_CAST(__t.begin())))
- {
- return _LIBCPP_AUTO_CAST(__t.begin());
- }
-
- template <class _Tp>
- requires __unqualified_begin<_Tp>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t) const
- noexcept(noexcept(_LIBCPP_AUTO_CAST(begin(__t))))
- {
- return _LIBCPP_AUTO_CAST(begin(__t));
- }
-
- void operator()(auto&&) const = delete;
- };
+struct __fn {
+ template <class _Tp>
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp (&__t)[]) const noexcept
+ requires(sizeof(_Tp) >= 0) // Disallow incomplete element types.
+ {
+ return __t + 0;
+ }
+
+ template <class _Tp, size_t _Np>
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp (&__t)[_Np]) const noexcept
+ requires(sizeof(_Tp) >= 0) // Disallow incomplete element types.
+ {
+ return __t + 0;
+ }
+
+ template <class _Tp>
+ requires __member_begin<_Tp>
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t) const
+ noexcept(noexcept(_LIBCPP_AUTO_CAST(__t.begin()))) {
+ return _LIBCPP_AUTO_CAST(__t.begin());
+ }
+
+ template <class _Tp>
+ requires __unqualified_begin<_Tp>
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t) const
+ noexcept(noexcept(_LIBCPP_AUTO_CAST(begin(__t)))) {
+ return _LIBCPP_AUTO_CAST(begin(__t));
+ }
+
+ void operator()(auto&&) const = delete;
+};
} // namespace __begin
inline namespace __cpo {
- inline constexpr auto begin = __begin::__fn{};
+inline constexpr auto begin = __begin::__fn{};
} // namespace __cpo
} // namespace ranges
// [range.range]
namespace ranges {
- template <class _Tp>
- using iterator_t = decltype(ranges::begin(std::declval<_Tp&>()));
+template <class _Tp>
+using iterator_t = decltype(ranges::begin(std::declval<_Tp&>()));
} // namespace ranges
// [range.access.end]
namespace ranges {
namespace __end {
- template <class _Tp>
- concept __member_end =
- __can_borrow<_Tp> &&
- __workaround_52970<_Tp> &&
- requires(_Tp&& __t) {
+template <class _Tp>
+concept __member_end = __can_borrow<_Tp> && __workaround_52970<_Tp> && requires(_Tp&& __t) {
+ typename iterator_t<_Tp>;
+ { _LIBCPP_AUTO_CAST(__t.end()) } -> sentinel_for<iterator_t<_Tp>>;
+};
+
+void end(auto&) = delete;
+void end(const auto&) = delete;
+
+template <class _Tp>
+concept __unqualified_end =
+ !__member_end<_Tp> && __can_borrow<_Tp> && __class_or_enum<remove_cvref_t<_Tp>> && requires(_Tp&& __t) {
typename iterator_t<_Tp>;
- { _LIBCPP_AUTO_CAST(__t.end()) } -> sentinel_for<iterator_t<_Tp>>;
+ { _LIBCPP_AUTO_CAST(end(__t)) } -> sentinel_for<iterator_t<_Tp>>;
};
- void end(auto&) = delete;
- void end(const auto&) = delete;
+struct __fn {
+ template <class _Tp, size_t _Np>
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp (&__t)[_Np]) const noexcept
+ requires(sizeof(_Tp) >= 0) // Disallow incomplete element types.
+ {
+ return __t + _Np;
+ }
template <class _Tp>
- concept __unqualified_end =
- !__member_end<_Tp> &&
- __can_borrow<_Tp> &&
- __class_or_enum<remove_cvref_t<_Tp>> &&
- requires(_Tp && __t) {
- typename iterator_t<_Tp>;
- { _LIBCPP_AUTO_CAST(end(__t)) } -> sentinel_for<iterator_t<_Tp>>;
- };
+ requires __member_end<_Tp>
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t) const
+ noexcept(noexcept(_LIBCPP_AUTO_CAST(__t.end()))) {
+ return _LIBCPP_AUTO_CAST(__t.end());
+ }
- struct __fn {
- template <class _Tp, size_t _Np>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp (&__t)[_Np]) const noexcept
- requires (sizeof(_Tp) >= 0) // Disallow incomplete element types.
- {
- return __t + _Np;
- }
-
- template <class _Tp>
- requires __member_end<_Tp>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t) const
- noexcept(noexcept(_LIBCPP_AUTO_CAST(__t.end())))
- {
- return _LIBCPP_AUTO_CAST(__t.end());
- }
-
- template <class _Tp>
- requires __unqualified_end<_Tp>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t) const
- noexcept(noexcept(_LIBCPP_AUTO_CAST(end(__t))))
- {
- return _LIBCPP_AUTO_CAST(end(__t));
- }
-
- void operator()(auto&&) const = delete;
- };
+ template <class _Tp>
+ requires __unqualified_end<_Tp>
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t) const
+ noexcept(noexcept(_LIBCPP_AUTO_CAST(end(__t)))) {
+ return _LIBCPP_AUTO_CAST(end(__t));
+ }
+
+ void operator()(auto&&) const = delete;
+};
} // namespace __end
inline namespace __cpo {
- inline constexpr auto end = __end::__fn{};
+inline constexpr auto end = __end::__fn{};
} // namespace __cpo
} // namespace ranges
@@ -171,27 +154,27 @@ inline namespace __cpo {
namespace ranges {
namespace __cbegin {
- struct __fn {
- template <class _Tp>
- requires is_lvalue_reference_v<_Tp&&>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI
- constexpr auto operator()(_Tp&& __t) const
+struct __fn {
+ template <class _Tp>
+ requires is_lvalue_reference_v<_Tp&&>
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t) const
noexcept(noexcept(ranges::begin(static_cast<const remove_reference_t<_Tp>&>(__t))))
- -> decltype( ranges::begin(static_cast<const remove_reference_t<_Tp>&>(__t)))
- { return ranges::begin(static_cast<const remove_reference_t<_Tp>&>(__t)); }
+ -> decltype(ranges::begin(static_cast<const remove_reference_t<_Tp>&>(__t))) {
+ return ranges::begin(static_cast<const remove_reference_t<_Tp>&>(__t));
+ }
- template <class _Tp>
- requires is_rvalue_reference_v<_Tp&&>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI
- constexpr auto operator()(_Tp&& __t) const
+ template <class _Tp>
+ requires is_rvalue_reference_v<_Tp&&>
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t) const
noexcept(noexcept(ranges::begin(static_cast<const _Tp&&>(__t))))
- -> decltype( ranges::begin(static_cast<const _Tp&&>(__t)))
- { return ranges::begin(static_cast<const _Tp&&>(__t)); }
- };
+ -> decltype(ranges::begin(static_cast<const _Tp&&>(__t))) {
+ return ranges::begin(static_cast<const _Tp&&>(__t));
+ }
+};
} // namespace __cbegin
inline namespace __cpo {
- inline constexpr auto cbegin = __cbegin::__fn{};
+inline constexpr auto cbegin = __cbegin::__fn{};
} // namespace __cpo
} // namespace ranges
@@ -199,27 +182,27 @@ inline namespace __cpo {
namespace ranges {
namespace __cend {
- struct __fn {
- template <class _Tp>
- requires is_lvalue_reference_v<_Tp&&>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI
- constexpr auto operator()(_Tp&& __t) const
+struct __fn {
+ template <class _Tp>
+ requires is_lvalue_reference_v<_Tp&&>
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t) const
noexcept(noexcept(ranges::end(static_cast<const remove_reference_t<_Tp>&>(__t))))
- -> decltype( ranges::end(static_cast<const remove_reference_t<_Tp>&>(__t)))
- { return ranges::end(static_cast<const remove_reference_t<_Tp>&>(__t)); }
+ -> decltype(ranges::end(static_cast<const remove_reference_t<_Tp>&>(__t))) {
+ return ranges::end(static_cast<const remove_reference_t<_Tp>&>(__t));
+ }
- template <class _Tp>
- requires is_rvalue_reference_v<_Tp&&>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI
- constexpr auto operator()(_Tp&& __t) const
+ template <class _Tp>
+ requires is_rvalue_reference_v<_Tp&&>
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t) const
noexcept(noexcept(ranges::end(static_cast<const _Tp&&>(__t))))
- -> decltype( ranges::end(static_cast<const _Tp&&>(__t)))
- { return ranges::end(static_cast<const _Tp&&>(__t)); }
- };
+ -> decltype(ranges::end(static_cast<const _Tp&&>(__t))) {
+ return ranges::end(static_cast<const _Tp&&>(__t));
+ }
+};
} // namespace __cend
inline namespace __cpo {
- inline constexpr auto cend = __cend::__fn{};
+inline constexpr auto cend = __cend::__fn{};
} // namespace __cpo
} // namespace ranges
diff --git a/contrib/llvm-project/libcxx/include/__ranges/all.h b/contrib/llvm-project/libcxx/include/__ranges/all.h
index 2c88f51b6644..b735bdc7166c 100644
--- a/contrib/llvm-project/libcxx/include/__ranges/all.h
+++ b/contrib/llvm-project/libcxx/include/__ranges/all.h
@@ -36,45 +36,38 @@ _LIBCPP_BEGIN_NAMESPACE_STD
namespace ranges::views {
namespace __all {
- struct __fn : __range_adaptor_closure<__fn> {
- template<class _Tp>
- requires ranges::view<decay_t<_Tp>>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI
- constexpr auto operator()(_Tp&& __t) const
+struct __fn : __range_adaptor_closure<__fn> {
+ template <class _Tp>
+ requires ranges::view<decay_t<_Tp>>
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t) const
noexcept(noexcept(_LIBCPP_AUTO_CAST(std::forward<_Tp>(__t))))
- -> decltype(_LIBCPP_AUTO_CAST(std::forward<_Tp>(__t)))
- {
- return _LIBCPP_AUTO_CAST(std::forward<_Tp>(__t));
- }
+ -> decltype(_LIBCPP_AUTO_CAST(std::forward<_Tp>(__t))) {
+ return _LIBCPP_AUTO_CAST(std::forward<_Tp>(__t));
+ }
- template<class _Tp>
- requires (!ranges::view<decay_t<_Tp>>) &&
- requires (_Tp&& __t) { ranges::ref_view{std::forward<_Tp>(__t)}; }
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI
- constexpr auto operator()(_Tp&& __t) const
- noexcept(noexcept(ranges::ref_view{std::forward<_Tp>(__t)}))
- {
- return ranges::ref_view{std::forward<_Tp>(__t)};
- }
+ template <class _Tp>
+ requires(!ranges::view<decay_t<_Tp>>) && requires(_Tp&& __t) { ranges::ref_view{std::forward<_Tp>(__t)}; }
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t) const
+ noexcept(noexcept(ranges::ref_view{std::forward<_Tp>(__t)})) {
+ return ranges::ref_view{std::forward<_Tp>(__t)};
+ }
- template<class _Tp>
- requires (!ranges::view<decay_t<_Tp>> &&
- !requires (_Tp&& __t) { ranges::ref_view{std::forward<_Tp>(__t)}; } &&
- requires (_Tp&& __t) { ranges::owning_view{std::forward<_Tp>(__t)}; })
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI
- constexpr auto operator()(_Tp&& __t) const
- noexcept(noexcept(ranges::owning_view{std::forward<_Tp>(__t)}))
- {
- return ranges::owning_view{std::forward<_Tp>(__t)};
- }
- };
+ template <class _Tp>
+ requires(
+ !ranges::view<decay_t<_Tp>> && !requires(_Tp&& __t) { ranges::ref_view{std::forward<_Tp>(__t)}; } &&
+ requires(_Tp&& __t) { ranges::owning_view{std::forward<_Tp>(__t)}; })
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t) const
+ noexcept(noexcept(ranges::owning_view{std::forward<_Tp>(__t)})) {
+ return ranges::owning_view{std::forward<_Tp>(__t)};
+ }
+};
} // namespace __all
inline namespace __cpo {
- inline constexpr auto all = __all::__fn{};
+inline constexpr auto all = __all::__fn{};
} // namespace __cpo
-template<ranges::viewable_range _Range>
+template <ranges::viewable_range _Range>
using all_t = decltype(views::all(std::declval<_Range>()));
} // namespace ranges::views
diff --git a/contrib/llvm-project/libcxx/include/__ranges/common_view.h b/contrib/llvm-project/libcxx/include/__ranges/common_view.h
index f4cd18074904..4b5b04c9894b 100644
--- a/contrib/llvm-project/libcxx/include/__ranges/common_view.h
+++ b/contrib/llvm-project/libcxx/include/__ranges/common_view.h
@@ -38,96 +38,99 @@ _LIBCPP_BEGIN_NAMESPACE_STD
namespace ranges {
-template<view _View>
- requires (!common_range<_View> && copyable<iterator_t<_View>>)
+template <view _View>
+ requires(!common_range<_View> && copyable<iterator_t<_View>>)
class common_view : public view_interface<common_view<_View>> {
_View __base_ = _View();
public:
- _LIBCPP_HIDE_FROM_ABI
- common_view() requires default_initializable<_View> = default;
+ _LIBCPP_HIDE_FROM_ABI common_view()
+ requires default_initializable<_View>
+ = default;
- _LIBCPP_HIDE_FROM_ABI
- constexpr explicit common_view(_View __v) : __base_(std::move(__v)) { }
+ _LIBCPP_HIDE_FROM_ABI constexpr explicit common_view(_View __v) : __base_(std::move(__v)) {}
- _LIBCPP_HIDE_FROM_ABI
- constexpr _View base() const& requires copy_constructible<_View> { return __base_; }
+ _LIBCPP_HIDE_FROM_ABI constexpr _View base() const&
+ requires copy_constructible<_View>
+ {
+ return __base_;
+ }
- _LIBCPP_HIDE_FROM_ABI
- constexpr _View base() && { return std::move(__base_); }
+ _LIBCPP_HIDE_FROM_ABI constexpr _View base() && { return std::move(__base_); }
- _LIBCPP_HIDE_FROM_ABI
- constexpr auto begin() {
+ _LIBCPP_HIDE_FROM_ABI constexpr auto begin() {
if constexpr (random_access_range<_View> && sized_range<_View>)
return ranges::begin(__base_);
else
return common_iterator<iterator_t<_View>, sentinel_t<_View>>(ranges::begin(__base_));
}
- _LIBCPP_HIDE_FROM_ABI
- constexpr auto begin() const requires range<const _View> {
+ _LIBCPP_HIDE_FROM_ABI constexpr auto begin() const
+ requires range<const _View>
+ {
if constexpr (random_access_range<const _View> && sized_range<const _View>)
return ranges::begin(__base_);
else
return common_iterator<iterator_t<const _View>, sentinel_t<const _View>>(ranges::begin(__base_));
}
- _LIBCPP_HIDE_FROM_ABI
- constexpr auto end() {
+ _LIBCPP_HIDE_FROM_ABI constexpr auto end() {
if constexpr (random_access_range<_View> && sized_range<_View>)
return ranges::begin(__base_) + ranges::size(__base_);
else
return common_iterator<iterator_t<_View>, sentinel_t<_View>>(ranges::end(__base_));
}
- _LIBCPP_HIDE_FROM_ABI
- constexpr auto end() const requires range<const _View> {
+ _LIBCPP_HIDE_FROM_ABI constexpr auto end() const
+ requires range<const _View>
+ {
if constexpr (random_access_range<const _View> && sized_range<const _View>)
return ranges::begin(__base_) + ranges::size(__base_);
else
return common_iterator<iterator_t<const _View>, sentinel_t<const _View>>(ranges::end(__base_));
}
- _LIBCPP_HIDE_FROM_ABI
- constexpr auto size() requires sized_range<_View> {
+ _LIBCPP_HIDE_FROM_ABI constexpr auto size()
+ requires sized_range<_View>
+ {
return ranges::size(__base_);
}
- _LIBCPP_HIDE_FROM_ABI
- constexpr auto size() const requires sized_range<const _View> {
+ _LIBCPP_HIDE_FROM_ABI constexpr auto size() const
+ requires sized_range<const _View>
+ {
return ranges::size(__base_);
}
};
-template<class _Range>
-common_view(_Range&&)
- -> common_view<views::all_t<_Range>>;
+template <class _Range>
+common_view(_Range&&) -> common_view<views::all_t<_Range>>;
-template<class _View>
+template <class _View>
inline constexpr bool enable_borrowed_range<common_view<_View>> = enable_borrowed_range<_View>;
namespace views {
namespace __common {
- struct __fn : __range_adaptor_closure<__fn> {
- template<class _Range>
- requires common_range<_Range>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI
- constexpr auto operator()(_Range&& __range) const
+struct __fn : __range_adaptor_closure<__fn> {
+ template <class _Range>
+ requires common_range<_Range>
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Range&& __range) const
noexcept(noexcept(views::all(std::forward<_Range>(__range))))
- -> decltype( views::all(std::forward<_Range>(__range)))
- { return views::all(std::forward<_Range>(__range)); }
+ -> decltype(views::all(std::forward<_Range>(__range))) {
+ return views::all(std::forward<_Range>(__range));
+ }
- template<class _Range>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI
- constexpr auto operator()(_Range&& __range) const
+ template <class _Range>
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Range&& __range) const
noexcept(noexcept(common_view{std::forward<_Range>(__range)}))
- -> decltype( common_view{std::forward<_Range>(__range)})
- { return common_view{std::forward<_Range>(__range)}; }
- };
+ -> decltype(common_view{std::forward<_Range>(__range)}) {
+ return common_view{std::forward<_Range>(__range)};
+ }
+};
} // namespace __common
inline namespace __cpo {
- inline constexpr auto common = __common::__fn{};
+inline constexpr auto common = __common::__fn{};
} // namespace __cpo
} // namespace views
} // namespace ranges
diff --git a/contrib/llvm-project/libcxx/include/__ranges/concepts.h b/contrib/llvm-project/libcxx/include/__ranges/concepts.h
index b87a71460610..674a3f359ff9 100644
--- a/contrib/llvm-project/libcxx/include/__ranges/concepts.h
+++ b/contrib/llvm-project/libcxx/include/__ranges/concepts.h
@@ -41,100 +41,92 @@ _LIBCPP_BEGIN_NAMESPACE_STD
namespace ranges {
- // [range.range]
+// [range.range]
- template <class _Tp>
- concept range = requires(_Tp& __t) {
- ranges::begin(__t); // sometimes equality-preserving
- ranges::end(__t);
- };
+template <class _Tp>
+concept range = requires(_Tp& __t) {
+ ranges::begin(__t); // sometimes equality-preserving
+ ranges::end(__t);
+};
- template <class _Tp>
- concept input_range = range<_Tp> && input_iterator<iterator_t<_Tp>>;
+template <class _Tp>
+concept input_range = range<_Tp> && input_iterator<iterator_t<_Tp>>;
- template<class _Range>
- concept borrowed_range = range<_Range> &&
- (is_lvalue_reference_v<_Range> || enable_borrowed_range<remove_cvref_t<_Range>>);
+template <class _Range>
+concept borrowed_range =
+ range<_Range> && (is_lvalue_reference_v<_Range> || enable_borrowed_range<remove_cvref_t<_Range>>);
- // `iterator_t` defined in <__ranges/access.h>
+// `iterator_t` defined in <__ranges/access.h>
- template <range _Rp>
- using sentinel_t = decltype(ranges::end(std::declval<_Rp&>()));
+template <range _Rp>
+using sentinel_t = decltype(ranges::end(std::declval<_Rp&>()));
- template <range _Rp>
- using range_difference_t = iter_difference_t<iterator_t<_Rp>>;
+template <range _Rp>
+using range_difference_t = iter_difference_t<iterator_t<_Rp>>;
- template <range _Rp>
- using range_value_t = iter_value_t<iterator_t<_Rp>>;
+template <range _Rp>
+using range_value_t = iter_value_t<iterator_t<_Rp>>;
- template <range _Rp>
- using range_reference_t = iter_reference_t<iterator_t<_Rp>>;
+template <range _Rp>
+using range_reference_t = iter_reference_t<iterator_t<_Rp>>;
- template <range _Rp>
- using range_rvalue_reference_t = iter_rvalue_reference_t<iterator_t<_Rp>>;
+template <range _Rp>
+using range_rvalue_reference_t = iter_rvalue_reference_t<iterator_t<_Rp>>;
- template <range _Rp>
- using range_common_reference_t = iter_common_reference_t<iterator_t<_Rp>>;
+template <range _Rp>
+using range_common_reference_t = iter_common_reference_t<iterator_t<_Rp>>;
- // [range.sized]
- template <class _Tp>
- concept sized_range = range<_Tp> && requires(_Tp& __t) { ranges::size(__t); };
+// [range.sized]
+template <class _Tp>
+concept sized_range = range<_Tp> && requires(_Tp& __t) { ranges::size(__t); };
- template<sized_range _Rp>
- using range_size_t = decltype(ranges::size(std::declval<_Rp&>()));
+template <sized_range _Rp>
+using range_size_t = decltype(ranges::size(std::declval<_Rp&>()));
- // `disable_sized_range` defined in `<__ranges/size.h>`
+// `disable_sized_range` defined in `<__ranges/size.h>`
- // [range.view], views
+// [range.view], views
- // `enable_view` defined in <__ranges/enable_view.h>
- // `view_base` defined in <__ranges/enable_view.h>
+// `enable_view` defined in <__ranges/enable_view.h>
+// `view_base` defined in <__ranges/enable_view.h>
- template <class _Tp>
- concept view =
- range<_Tp> &&
- movable<_Tp> &&
- enable_view<_Tp>;
+template <class _Tp>
+concept view = range<_Tp> && movable<_Tp> && enable_view<_Tp>;
- template <class _Range>
- concept __simple_view =
- view<_Range> && range<const _Range> &&
- same_as<iterator_t<_Range>, iterator_t<const _Range>> &&
+template <class _Range>
+concept __simple_view =
+ view<_Range> && range<const _Range> && same_as<iterator_t<_Range>, iterator_t<const _Range>> &&
same_as<sentinel_t<_Range>, sentinel_t<const _Range>>;
- // [range.refinements], other range refinements
- template <class _Rp, class _Tp>
- concept output_range = range<_Rp> && output_iterator<iterator_t<_Rp>, _Tp>;
+// [range.refinements], other range refinements
+template <class _Rp, class _Tp>
+concept output_range = range<_Rp> && output_iterator<iterator_t<_Rp>, _Tp>;
- template <class _Tp>
- concept forward_range = input_range<_Tp> && forward_iterator<iterator_t<_Tp>>;
+template <class _Tp>
+concept forward_range = input_range<_Tp> && forward_iterator<iterator_t<_Tp>>;
- template <class _Tp>
- concept bidirectional_range = forward_range<_Tp> && bidirectional_iterator<iterator_t<_Tp>>;
+template <class _Tp>
+concept bidirectional_range = forward_range<_Tp> && bidirectional_iterator<iterator_t<_Tp>>;
- template <class _Tp>
- concept random_access_range =
- bidirectional_range<_Tp> && random_access_iterator<iterator_t<_Tp>>;
+template <class _Tp>
+concept random_access_range = bidirectional_range<_Tp> && random_access_iterator<iterator_t<_Tp>>;
- template<class _Tp>
- concept contiguous_range =
- random_access_range<_Tp> &&
- contiguous_iterator<iterator_t<_Tp>> &&
- requires(_Tp& __t) {
- { ranges::data(__t) } -> same_as<add_pointer_t<range_reference_t<_Tp>>>;
- };
+template <class _Tp>
+concept contiguous_range = random_access_range<_Tp> && contiguous_iterator<iterator_t<_Tp>> && requires(_Tp& __t) {
+ { ranges::data(__t) } -> same_as<add_pointer_t<range_reference_t<_Tp>>>;
+};
- template <class _Tp>
- concept common_range = range<_Tp> && same_as<iterator_t<_Tp>, sentinel_t<_Tp>>;
+template <class _Tp>
+concept common_range = range<_Tp> && same_as<iterator_t<_Tp>, sentinel_t<_Tp>>;
- template <class _Tp>
- inline constexpr bool __is_std_initializer_list = false;
+template <class _Tp>
+inline constexpr bool __is_std_initializer_list = false;
- template <class _Ep>
- inline constexpr bool __is_std_initializer_list<initializer_list<_Ep>> = true;
+template <class _Ep>
+inline constexpr bool __is_std_initializer_list<initializer_list<_Ep>> = true;
- template <class _Tp>
- concept viewable_range =
+template <class _Tp>
+concept viewable_range =
range<_Tp> &&
((view<remove_cvref_t<_Tp>> && constructible_from<remove_cvref_t<_Tp>, _Tp>) ||
(!view<remove_cvref_t<_Tp>> &&
diff --git a/contrib/llvm-project/libcxx/include/__ranges/counted.h b/contrib/llvm-project/libcxx/include/__ranges/counted.h
index 882f90b1ed82..337634895766 100644
--- a/contrib/llvm-project/libcxx/include/__ranges/counted.h
+++ b/contrib/llvm-project/libcxx/include/__ranges/counted.h
@@ -37,41 +37,43 @@ namespace ranges::views {
namespace __counted {
- struct __fn {
- template<contiguous_iterator _It>
- _LIBCPP_HIDE_FROM_ABI
- static constexpr auto __go(_It __it, iter_difference_t<_It> __count)
- noexcept(noexcept(span(std::to_address(__it), static_cast<size_t>(__count))))
- // Deliberately omit return-type SFINAE, because to_address is not SFINAE-friendly
- { return span(std::to_address(__it), static_cast<size_t>(__count)); }
-
- template<random_access_iterator _It>
- _LIBCPP_HIDE_FROM_ABI
- static constexpr auto __go(_It __it, iter_difference_t<_It> __count)
- noexcept(noexcept(subrange(__it, __it + __count)))
- -> decltype( subrange(__it, __it + __count))
- { return subrange(__it, __it + __count); }
-
- template<class _It>
- _LIBCPP_HIDE_FROM_ABI
- static constexpr auto __go(_It __it, iter_difference_t<_It> __count)
- noexcept(noexcept(subrange(counted_iterator(std::move(__it), __count), default_sentinel)))
- -> decltype( subrange(counted_iterator(std::move(__it), __count), default_sentinel))
- { return subrange(counted_iterator(std::move(__it), __count), default_sentinel); }
-
- template<class _It, convertible_to<iter_difference_t<_It>> _Diff>
- requires input_or_output_iterator<decay_t<_It>>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI
- constexpr auto operator()(_It&& __it, _Diff&& __count) const
+struct __fn {
+ template <contiguous_iterator _It>
+ _LIBCPP_HIDE_FROM_ABI static constexpr auto
+ __go(_It __it,
+ iter_difference_t<_It> __count) noexcept(noexcept(span(std::to_address(__it), static_cast<size_t>(__count))))
+ // Deliberately omit return-type SFINAE, because to_address is not SFINAE-friendly
+ {
+ return span(std::to_address(__it), static_cast<size_t>(__count));
+ }
+
+ template <random_access_iterator _It>
+ _LIBCPP_HIDE_FROM_ABI static constexpr auto
+ __go(_It __it, iter_difference_t<_It> __count) noexcept(noexcept(subrange(__it, __it + __count)))
+ -> decltype(subrange(__it, __it + __count)) {
+ return subrange(__it, __it + __count);
+ }
+
+ template <class _It>
+ _LIBCPP_HIDE_FROM_ABI static constexpr auto __go(_It __it, iter_difference_t<_It> __count) noexcept(
+ noexcept(subrange(counted_iterator(std::move(__it), __count), default_sentinel)))
+ -> decltype(subrange(counted_iterator(std::move(__it), __count), default_sentinel)) {
+ return subrange(counted_iterator(std::move(__it), __count), default_sentinel);
+ }
+
+ template <class _It, convertible_to<iter_difference_t<_It>> _Diff>
+ requires input_or_output_iterator<decay_t<_It>>
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_It&& __it, _Diff&& __count) const
noexcept(noexcept(__go(std::forward<_It>(__it), std::forward<_Diff>(__count))))
- -> decltype( __go(std::forward<_It>(__it), std::forward<_Diff>(__count)))
- { return __go(std::forward<_It>(__it), std::forward<_Diff>(__count)); }
- };
+ -> decltype(__go(std::forward<_It>(__it), std::forward<_Diff>(__count))) {
+ return __go(std::forward<_It>(__it), std::forward<_Diff>(__count));
+ }
+};
} // namespace __counted
inline namespace __cpo {
- inline constexpr auto counted = __counted::__fn{};
+inline constexpr auto counted = __counted::__fn{};
} // namespace __cpo
} // namespace ranges::views
diff --git a/contrib/llvm-project/libcxx/include/__ranges/data.h b/contrib/llvm-project/libcxx/include/__ranges/data.h
index 6c099085af34..18002bb52cc8 100644
--- a/contrib/llvm-project/libcxx/include/__ranges/data.h
+++ b/contrib/llvm-project/libcxx/include/__ranges/data.h
@@ -36,44 +36,35 @@ _LIBCPP_BEGIN_NAMESPACE_STD
namespace ranges {
namespace __data {
- template <class _Tp>
- concept __ptr_to_object = is_pointer_v<_Tp> && is_object_v<remove_pointer_t<_Tp>>;
-
- template <class _Tp>
- concept __member_data =
- __can_borrow<_Tp> &&
- __workaround_52970<_Tp> &&
- requires(_Tp&& __t) {
- { _LIBCPP_AUTO_CAST(__t.data()) } -> __ptr_to_object;
- };
-
- template <class _Tp>
- concept __ranges_begin_invocable =
- !__member_data<_Tp> &&
- __can_borrow<_Tp> &&
- requires(_Tp&& __t) {
- { ranges::begin(__t) } -> contiguous_iterator;
- };
-
- struct __fn {
- template <__member_data _Tp>
- _LIBCPP_HIDE_FROM_ABI
- constexpr auto operator()(_Tp&& __t) const
- noexcept(noexcept(__t.data())) {
- return __t.data();
- }
-
- template<__ranges_begin_invocable _Tp>
- _LIBCPP_HIDE_FROM_ABI
- constexpr auto operator()(_Tp&& __t) const
- noexcept(noexcept(std::to_address(ranges::begin(__t)))) {
- return std::to_address(ranges::begin(__t));
- }
- };
+template <class _Tp>
+concept __ptr_to_object = is_pointer_v<_Tp> && is_object_v<remove_pointer_t<_Tp>>;
+
+template <class _Tp>
+concept __member_data = __can_borrow<_Tp> && __workaround_52970<_Tp> && requires(_Tp&& __t) {
+ { _LIBCPP_AUTO_CAST(__t.data()) } -> __ptr_to_object;
+};
+
+template <class _Tp>
+concept __ranges_begin_invocable = !__member_data<_Tp> && __can_borrow<_Tp> && requires(_Tp&& __t) {
+ { ranges::begin(__t) } -> contiguous_iterator;
+};
+
+struct __fn {
+ template <__member_data _Tp>
+ _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t) const noexcept(noexcept(__t.data())) {
+ return __t.data();
+ }
+
+ template <__ranges_begin_invocable _Tp>
+ _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t) const
+ noexcept(noexcept(std::to_address(ranges::begin(__t)))) {
+ return std::to_address(ranges::begin(__t));
+ }
+};
} // namespace __data
inline namespace __cpo {
- inline constexpr auto data = __data::__fn{};
+inline constexpr auto data = __data::__fn{};
} // namespace __cpo
} // namespace ranges
@@ -81,27 +72,27 @@ inline namespace __cpo {
namespace ranges {
namespace __cdata {
- struct __fn {
- template <class _Tp>
- requires is_lvalue_reference_v<_Tp&&>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI
- constexpr auto operator()(_Tp&& __t) const
+struct __fn {
+ template <class _Tp>
+ requires is_lvalue_reference_v<_Tp&&>
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t) const
noexcept(noexcept(ranges::data(static_cast<const remove_reference_t<_Tp>&>(__t))))
- -> decltype( ranges::data(static_cast<const remove_reference_t<_Tp>&>(__t)))
- { return ranges::data(static_cast<const remove_reference_t<_Tp>&>(__t)); }
+ -> decltype(ranges::data(static_cast<const remove_reference_t<_Tp>&>(__t))) {
+ return ranges::data(static_cast<const remove_reference_t<_Tp>&>(__t));
+ }
- template <class _Tp>
- requires is_rvalue_reference_v<_Tp&&>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI
- constexpr auto operator()(_Tp&& __t) const
+ template <class _Tp>
+ requires is_rvalue_reference_v<_Tp&&>
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t) const
noexcept(noexcept(ranges::data(static_cast<const _Tp&&>(__t))))
- -> decltype( ranges::data(static_cast<const _Tp&&>(__t)))
- { return ranges::data(static_cast<const _Tp&&>(__t)); }
- };
+ -> decltype(ranges::data(static_cast<const _Tp&&>(__t))) {
+ return ranges::data(static_cast<const _Tp&&>(__t));
+ }
+};
} // namespace __cdata
inline namespace __cpo {
- inline constexpr auto cdata = __cdata::__fn{};
+inline constexpr auto cdata = __cdata::__fn{};
} // namespace __cpo
} // namespace ranges
diff --git a/contrib/llvm-project/libcxx/include/__ranges/drop_view.h b/contrib/llvm-project/libcxx/include/__ranges/drop_view.h
index f10476f0011e..2b89c6877a78 100644
--- a/contrib/llvm-project/libcxx/include/__ranges/drop_view.h
+++ b/contrib/llvm-project/libcxx/include/__ranges/drop_view.h
@@ -56,89 +56,91 @@ _LIBCPP_BEGIN_NAMESPACE_STD
#if _LIBCPP_STD_VER >= 20
namespace ranges {
- template<view _View>
- class drop_view
- : public view_interface<drop_view<_View>>
- {
- // We cache begin() whenever ranges::next is not guaranteed O(1) to provide an
- // amortized O(1) begin() method. If this is an input_range, then we cannot cache
- // begin because begin is not equality preserving.
- // Note: drop_view<input-range>::begin() is still trivially amortized O(1) because
- // one can't call begin() on it more than once.
- static constexpr bool _UseCache = forward_range<_View> && !(random_access_range<_View> && sized_range<_View>);
- using _Cache = _If<_UseCache, __non_propagating_cache<iterator_t<_View>>, __empty_cache>;
- _LIBCPP_NO_UNIQUE_ADDRESS _Cache __cached_begin_ = _Cache();
- range_difference_t<_View> __count_ = 0;
- _View __base_ = _View();
+template <view _View>
+class drop_view : public view_interface<drop_view<_View>> {
+ // We cache begin() whenever ranges::next is not guaranteed O(1) to provide an
+ // amortized O(1) begin() method. If this is an input_range, then we cannot cache
+ // begin because begin is not equality preserving.
+ // Note: drop_view<input-range>::begin() is still trivially amortized O(1) because
+ // one can't call begin() on it more than once.
+ static constexpr bool _UseCache = forward_range<_View> && !(random_access_range<_View> && sized_range<_View>);
+ using _Cache = _If<_UseCache, __non_propagating_cache<iterator_t<_View>>, __empty_cache>;
+ _LIBCPP_NO_UNIQUE_ADDRESS _Cache __cached_begin_ = _Cache();
+ range_difference_t<_View> __count_ = 0;
+ _View __base_ = _View();
public:
- _LIBCPP_HIDE_FROM_ABI drop_view() requires default_initializable<_View> = default;
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr _LIBCPP_EXPLICIT_SINCE_CXX23 drop_view(_View __base, range_difference_t<_View> __count)
- : __count_(__count)
- , __base_(std::move(__base))
- {
- _LIBCPP_ASSERT_UNCATEGORIZED(__count_ >= 0, "count must be greater than or equal to zero.");
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr _View base() const& requires copy_constructible<_View> { return __base_; }
- _LIBCPP_HIDE_FROM_ABI constexpr _View base() && { return std::move(__base_); }
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr auto begin()
- requires (!(__simple_view<_View> &&
- random_access_range<const _View> && sized_range<const _View>))
- {
- if constexpr (_UseCache)
- if (__cached_begin_.__has_value())
- return *__cached_begin_;
-
- auto __tmp = ranges::next(ranges::begin(__base_), __count_, ranges::end(__base_));
- if constexpr (_UseCache)
- __cached_begin_.__emplace(__tmp);
- return __tmp;
- }
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr auto begin() const
- requires random_access_range<const _View> && sized_range<const _View>
- {
- return ranges::next(ranges::begin(__base_), __count_, ranges::end(__base_));
- }
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr auto end()
- requires (!__simple_view<_View>)
- { return ranges::end(__base_); }
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr auto end() const
- requires range<const _View>
- { return ranges::end(__base_); }
-
- _LIBCPP_HIDE_FROM_ABI
- static constexpr auto __size(auto& __self) {
- const auto __s = ranges::size(__self.__base_);
- const auto __c = static_cast<decltype(__s)>(__self.__count_);
- return __s < __c ? 0 : __s - __c;
- }
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr auto size()
- requires sized_range<_View>
- { return __size(*this); }
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr auto size() const
- requires sized_range<const _View>
- { return __size(*this); }
- };
-
-template<class _Range>
+ _LIBCPP_HIDE_FROM_ABI drop_view()
+ requires default_initializable<_View>
+ = default;
+
+ _LIBCPP_HIDE_FROM_ABI constexpr _LIBCPP_EXPLICIT_SINCE_CXX23
+ drop_view(_View __base, range_difference_t<_View> __count)
+ : __count_(__count), __base_(std::move(__base)) {
+ _LIBCPP_ASSERT_UNCATEGORIZED(__count_ >= 0, "count must be greater than or equal to zero.");
+ }
+
+ _LIBCPP_HIDE_FROM_ABI constexpr _View base() const&
+ requires copy_constructible<_View>
+ {
+ return __base_;
+ }
+ _LIBCPP_HIDE_FROM_ABI constexpr _View base() && { return std::move(__base_); }
+
+ _LIBCPP_HIDE_FROM_ABI constexpr auto begin()
+ requires(!(__simple_view<_View> && random_access_range<const _View> && sized_range<const _View>))
+ {
+ if constexpr (_UseCache)
+ if (__cached_begin_.__has_value())
+ return *__cached_begin_;
+
+ auto __tmp = ranges::next(ranges::begin(__base_), __count_, ranges::end(__base_));
+ if constexpr (_UseCache)
+ __cached_begin_.__emplace(__tmp);
+ return __tmp;
+ }
+
+ _LIBCPP_HIDE_FROM_ABI constexpr auto begin() const
+ requires random_access_range<const _View> && sized_range<const _View>
+ {
+ return ranges::next(ranges::begin(__base_), __count_, ranges::end(__base_));
+ }
+
+ _LIBCPP_HIDE_FROM_ABI constexpr auto end()
+ requires(!__simple_view<_View>)
+ {
+ return ranges::end(__base_);
+ }
+
+ _LIBCPP_HIDE_FROM_ABI constexpr auto end() const
+ requires range<const _View>
+ {
+ return ranges::end(__base_);
+ }
+
+ _LIBCPP_HIDE_FROM_ABI static constexpr auto __size(auto& __self) {
+ const auto __s = ranges::size(__self.__base_);
+ const auto __c = static_cast<decltype(__s)>(__self.__count_);
+ return __s < __c ? 0 : __s - __c;
+ }
+
+ _LIBCPP_HIDE_FROM_ABI constexpr auto size()
+ requires sized_range<_View>
+ {
+ return __size(*this);
+ }
+
+ _LIBCPP_HIDE_FROM_ABI constexpr auto size() const
+ requires sized_range<const _View>
+ {
+ return __size(*this);
+ }
+};
+
+template <class _Range>
drop_view(_Range&&, range_difference_t<_Range>) -> drop_view<views::all_t<_Range>>;
-template<class _Tp>
+template <class _Tp>
inline constexpr bool enable_borrowed_range<drop_view<_Tp>> = enable_borrowed_range<_Tp>;
namespace views {
@@ -203,72 +205,55 @@ struct __fn {
// [range.drop.overview]: the `empty_view` case.
template <class _Range, convertible_to<range_difference_t<_Range>> _Np>
requires __is_empty_view<remove_cvref_t<_Range>>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI
- constexpr auto operator()(_Range&& __range, _Np&&) const
- noexcept(noexcept(_LIBCPP_AUTO_CAST(std::forward<_Range>(__range))))
- -> decltype( _LIBCPP_AUTO_CAST(std::forward<_Range>(__range)))
- { return _LIBCPP_AUTO_CAST(std::forward<_Range>(__range)); }
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Range&& __range, _Np&&) const
+ noexcept(noexcept(_LIBCPP_AUTO_CAST(std::forward<_Range>(__range))))
+ -> decltype(_LIBCPP_AUTO_CAST(std::forward<_Range>(__range))) {
+ return _LIBCPP_AUTO_CAST(std::forward<_Range>(__range));
+ }
// [range.drop.overview]: the `span | basic_string_view | iota_view | subrange (StoreSize == false)` case.
template <class _Range,
convertible_to<range_difference_t<_Range>> _Np,
class _RawRange = remove_cvref_t<_Range>,
- class _Dist = range_difference_t<_Range>>
- requires (!__is_empty_view<_RawRange> &&
- random_access_range<_RawRange> &&
- sized_range<_RawRange> &&
- __is_passthrough_specialization<_RawRange>)
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI
- constexpr auto operator()(_Range&& __rng, _Np&& __n) const
- noexcept(noexcept(__passthrough_type_t<_RawRange>(
- ranges::begin(__rng) + std::min<_Dist>(ranges::distance(__rng), std::forward<_Np>(__n)),
- ranges::end(__rng)
- )))
- -> decltype( __passthrough_type_t<_RawRange>(
- // Note: deliberately not forwarding `__rng` to guard against double moves.
- ranges::begin(__rng) + std::min<_Dist>(ranges::distance(__rng), std::forward<_Np>(__n)),
- ranges::end(__rng)
- ))
- { return __passthrough_type_t<_RawRange>(
- ranges::begin(__rng) + std::min<_Dist>(ranges::distance(__rng), std::forward<_Np>(__n)),
- ranges::end(__rng)
- ); }
+ class _Dist = range_difference_t<_Range>>
+ requires(!__is_empty_view<_RawRange> && random_access_range<_RawRange> && sized_range<_RawRange> &&
+ __is_passthrough_specialization<_RawRange>)
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Range&& __rng, _Np&& __n) const
+ noexcept(noexcept(__passthrough_type_t<_RawRange>(
+ ranges::begin(__rng) + std::min<_Dist>(ranges::distance(__rng), std::forward<_Np>(__n)), ranges::end(__rng))))
+ -> decltype(__passthrough_type_t<_RawRange>(
+ // Note: deliberately not forwarding `__rng` to guard against double moves.
+ ranges::begin(__rng) + std::min<_Dist>(ranges::distance(__rng), std::forward<_Np>(__n)),
+ ranges::end(__rng))) {
+ return __passthrough_type_t<_RawRange>(
+ ranges::begin(__rng) + std::min<_Dist>(ranges::distance(__rng), std::forward<_Np>(__n)), ranges::end(__rng));
+ }
// [range.drop.overview]: the `subrange (StoreSize == true)` case.
template <class _Range,
convertible_to<range_difference_t<_Range>> _Np,
class _RawRange = remove_cvref_t<_Range>,
- class _Dist = range_difference_t<_Range>>
- requires (!__is_empty_view<_RawRange> &&
- random_access_range<_RawRange> &&
- sized_range<_RawRange> &&
- __is_subrange_specialization_with_store_size<_RawRange>)
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI
- constexpr auto operator()(_Range&& __rng, _Np&& __n) const
- noexcept(noexcept(_RawRange(
- ranges::begin(__rng) + std::min<_Dist>(ranges::distance(__rng), std::forward<_Np>(__n)),
- ranges::end(__rng),
- std::__to_unsigned_like(ranges::distance(__rng) -
- std::min<_Dist>(ranges::distance(__rng), std::forward<_Np>(__n)))
- )))
- -> decltype( _RawRange(
- // Note: deliberately not forwarding `__rng` to guard against double moves.
- ranges::begin(__rng) + std::min<_Dist>(ranges::distance(__rng), std::forward<_Np>(__n)),
- ranges::end(__rng),
- std::__to_unsigned_like(ranges::distance(__rng) -
- std::min<_Dist>(ranges::distance(__rng), std::forward<_Np>(__n)))
- ))
- {
- // Introducing local variables avoids calculating `min` and `distance` twice (at the cost of diverging from the
- // expression used in the `noexcept` clause and the return statement).
- auto __dist = ranges::distance(__rng);
- auto __clamped = std::min<_Dist>(__dist, std::forward<_Np>(__n));
- return _RawRange(
- ranges::begin(__rng) + __clamped,
- ranges::end(__rng),
- std::__to_unsigned_like(__dist - __clamped)
- );}
-// clang-format off
+ class _Dist = range_difference_t<_Range>>
+ requires(!__is_empty_view<_RawRange> && random_access_range<_RawRange> && sized_range<_RawRange> &&
+ __is_subrange_specialization_with_store_size<_RawRange>)
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Range&& __rng, _Np&& __n) const noexcept(noexcept(
+ _RawRange(ranges::begin(__rng) + std::min<_Dist>(ranges::distance(__rng), std::forward<_Np>(__n)),
+ ranges::end(__rng),
+ std::__to_unsigned_like(ranges::distance(__rng) -
+ std::min<_Dist>(ranges::distance(__rng), std::forward<_Np>(__n))))))
+ -> decltype(_RawRange(
+ // Note: deliberately not forwarding `__rng` to guard against double moves.
+ ranges::begin(__rng) + std::min<_Dist>(ranges::distance(__rng), std::forward<_Np>(__n)),
+ ranges::end(__rng),
+ std::__to_unsigned_like(ranges::distance(__rng) -
+ std::min<_Dist>(ranges::distance(__rng), std::forward<_Np>(__n))))) {
+ // Introducing local variables avoids calculating `min` and `distance` twice (at the cost of diverging from the
+ // expression used in the `noexcept` clause and the return statement).
+ auto __dist = ranges::distance(__rng);
+ auto __clamped = std::min<_Dist>(__dist, std::forward<_Np>(__n));
+ return _RawRange(ranges::begin(__rng) + __clamped, ranges::end(__rng), std::__to_unsigned_like(__dist - __clamped));
+ }
+ // clang-format off
#if _LIBCPP_STD_VER >= 23
// [range.drop.overview]: the `repeat_view` "_RawRange models sized_range" case.
template <class _Range,
@@ -293,42 +278,38 @@ struct __fn {
-> decltype( _LIBCPP_AUTO_CAST(std::forward<_Range>(__range)))
{ return _LIBCPP_AUTO_CAST(std::forward<_Range>(__range)); }
#endif
-// clang-format on
+ // clang-format on
// [range.drop.overview]: the "otherwise" case.
- template <class _Range, convertible_to<range_difference_t<_Range>> _Np,
- class _RawRange = remove_cvref_t<_Range>>
- // Note: without specifically excluding the other cases, GCC sees this overload as ambiguous with the other
- // overloads.
- requires (!(__is_empty_view<_RawRange> ||
-#if _LIBCPP_STD_VER >= 23
- __is_repeat_specialization<_RawRange> ||
-#endif
- (__is_subrange_specialization_with_store_size<_RawRange> &&
- sized_range<_RawRange> &&
- random_access_range<_RawRange>) ||
- (__is_passthrough_specialization<_RawRange> &&
- sized_range<_RawRange> &&
- random_access_range<_RawRange>)
- ))
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI
- constexpr auto operator()(_Range&& __range, _Np&& __n) const
- noexcept(noexcept(drop_view(std::forward<_Range>(__range), std::forward<_Np>(__n))))
- -> decltype( drop_view(std::forward<_Range>(__range), std::forward<_Np>(__n)))
- { return drop_view(std::forward<_Range>(__range), std::forward<_Np>(__n)); }
+ template <class _Range, convertible_to<range_difference_t<_Range>> _Np, class _RawRange = remove_cvref_t<_Range>>
+ // Note: without specifically excluding the other cases, GCC sees this overload as ambiguous with the other
+ // overloads.
+ requires(
+ !(__is_empty_view<_RawRange> ||
+# if _LIBCPP_STD_VER >= 23
+ __is_repeat_specialization<_RawRange> ||
+# endif
+ (__is_subrange_specialization_with_store_size<_RawRange> && sized_range<_RawRange> &&
+ random_access_range<_RawRange>) ||
+ (__is_passthrough_specialization<_RawRange> && sized_range<_RawRange> && random_access_range<_RawRange>)))
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Range&& __range, _Np&& __n) const
+ noexcept(noexcept(drop_view(std::forward<_Range>(__range), std::forward<_Np>(__n))))
+ -> decltype(drop_view(std::forward<_Range>(__range), std::forward<_Np>(__n))) {
+ return drop_view(std::forward<_Range>(__range), std::forward<_Np>(__n));
+ }
template <class _Np>
requires constructible_from<decay_t<_Np>, _Np>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI
- constexpr auto operator()(_Np&& __n) const
- noexcept(is_nothrow_constructible_v<decay_t<_Np>, _Np>)
- { return __range_adaptor_closure_t(std::__bind_back(*this, std::forward<_Np>(__n))); }
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Np&& __n) const
+ noexcept(is_nothrow_constructible_v<decay_t<_Np>, _Np>) {
+ return __range_adaptor_closure_t(std::__bind_back(*this, std::forward<_Np>(__n)));
+ }
};
} // namespace __drop
inline namespace __cpo {
- inline constexpr auto drop = __drop::__fn{};
+inline constexpr auto drop = __drop::__fn{};
} // namespace __cpo
} // namespace views
diff --git a/contrib/llvm-project/libcxx/include/__ranges/empty.h b/contrib/llvm-project/libcxx/include/__ranges/empty.h
index 64996f4a6f7b..acd55dae224c 100644
--- a/contrib/llvm-project/libcxx/include/__ranges/empty.h
+++ b/contrib/llvm-project/libcxx/include/__ranges/empty.h
@@ -28,50 +28,39 @@ _LIBCPP_BEGIN_NAMESPACE_STD
namespace ranges {
namespace __empty {
- template <class _Tp>
- concept __member_empty =
- __workaround_52970<_Tp> &&
- requires(_Tp&& __t) {
- bool(__t.empty());
- };
-
- template<class _Tp>
- concept __can_invoke_size =
- !__member_empty<_Tp> &&
- requires(_Tp&& __t) { ranges::size(__t); };
-
- template <class _Tp>
- concept __can_compare_begin_end =
- !__member_empty<_Tp> &&
- !__can_invoke_size<_Tp> &&
- requires(_Tp&& __t) {
- bool(ranges::begin(__t) == ranges::end(__t));
- { ranges::begin(__t) } -> forward_iterator;
- };
-
- struct __fn {
- template <__member_empty _Tp>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool operator()(_Tp&& __t) const
- noexcept(noexcept(bool(__t.empty()))) {
- return bool(__t.empty());
- }
-
- template <__can_invoke_size _Tp>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool operator()(_Tp&& __t) const
- noexcept(noexcept(ranges::size(__t))) {
- return ranges::size(__t) == 0;
- }
-
- template<__can_compare_begin_end _Tp>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool operator()(_Tp&& __t) const
- noexcept(noexcept(bool(ranges::begin(__t) == ranges::end(__t)))) {
- return ranges::begin(__t) == ranges::end(__t);
- }
- };
+template <class _Tp>
+concept __member_empty = __workaround_52970<_Tp> && requires(_Tp&& __t) { bool(__t.empty()); };
+
+template <class _Tp>
+concept __can_invoke_size = !__member_empty<_Tp> && requires(_Tp&& __t) { ranges::size(__t); };
+
+template <class _Tp>
+concept __can_compare_begin_end = !__member_empty<_Tp> && !__can_invoke_size<_Tp> && requires(_Tp&& __t) {
+ bool(ranges::begin(__t) == ranges::end(__t));
+ { ranges::begin(__t) } -> forward_iterator;
+};
+
+struct __fn {
+ template <__member_empty _Tp>
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool operator()(_Tp&& __t) const noexcept(noexcept(bool(__t.empty()))) {
+ return bool(__t.empty());
+ }
+
+ template <__can_invoke_size _Tp>
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool operator()(_Tp&& __t) const noexcept(noexcept(ranges::size(__t))) {
+ return ranges::size(__t) == 0;
+ }
+
+ template <__can_compare_begin_end _Tp>
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool operator()(_Tp&& __t) const
+ noexcept(noexcept(bool(ranges::begin(__t) == ranges::end(__t)))) {
+ return ranges::begin(__t) == ranges::end(__t);
+ }
+};
} // namespace __empty
inline namespace __cpo {
- inline constexpr auto empty = __empty::__fn{};
+inline constexpr auto empty = __empty::__fn{};
} // namespace __cpo
} // namespace ranges
diff --git a/contrib/llvm-project/libcxx/include/__ranges/empty_view.h b/contrib/llvm-project/libcxx/include/__ranges/empty_view.h
index bb445b4e6f94..6c04b0200c35 100644
--- a/contrib/llvm-project/libcxx/include/__ranges/empty_view.h
+++ b/contrib/llvm-project/libcxx/include/__ranges/empty_view.h
@@ -25,26 +25,26 @@ _LIBCPP_BEGIN_NAMESPACE_STD
#if _LIBCPP_STD_VER >= 20
namespace ranges {
- template<class _Tp>
- requires is_object_v<_Tp>
- class empty_view : public view_interface<empty_view<_Tp>> {
- public:
- _LIBCPP_HIDE_FROM_ABI static constexpr _Tp* begin() noexcept { return nullptr; }
- _LIBCPP_HIDE_FROM_ABI static constexpr _Tp* end() noexcept { return nullptr; }
- _LIBCPP_HIDE_FROM_ABI static constexpr _Tp* data() noexcept { return nullptr; }
- _LIBCPP_HIDE_FROM_ABI static constexpr size_t size() noexcept { return 0; }
- _LIBCPP_HIDE_FROM_ABI static constexpr bool empty() noexcept { return true; }
- };
-
- template<class _Tp>
- inline constexpr bool enable_borrowed_range<empty_view<_Tp>> = true;
-
- namespace views {
-
- template <class _Tp>
- inline constexpr empty_view<_Tp> empty{};
-
- } // namespace views
+template <class _Tp>
+ requires is_object_v<_Tp>
+class empty_view : public view_interface<empty_view<_Tp>> {
+public:
+ _LIBCPP_HIDE_FROM_ABI static constexpr _Tp* begin() noexcept { return nullptr; }
+ _LIBCPP_HIDE_FROM_ABI static constexpr _Tp* end() noexcept { return nullptr; }
+ _LIBCPP_HIDE_FROM_ABI static constexpr _Tp* data() noexcept { return nullptr; }
+ _LIBCPP_HIDE_FROM_ABI static constexpr size_t size() noexcept { return 0; }
+ _LIBCPP_HIDE_FROM_ABI static constexpr bool empty() noexcept { return true; }
+};
+
+template <class _Tp>
+inline constexpr bool enable_borrowed_range<empty_view<_Tp>> = true;
+
+namespace views {
+
+template <class _Tp>
+inline constexpr empty_view<_Tp> empty{};
+
+} // namespace views
} // namespace ranges
#endif // _LIBCPP_STD_VER >= 20
diff --git a/contrib/llvm-project/libcxx/include/__ranges/enable_view.h b/contrib/llvm-project/libcxx/include/__ranges/enable_view.h
index 0c1dff3821ea..f570926eb67c 100644
--- a/contrib/llvm-project/libcxx/include/__ranges/enable_view.h
+++ b/contrib/llvm-project/libcxx/include/__ranges/enable_view.h
@@ -27,19 +27,20 @@ _LIBCPP_BEGIN_NAMESPACE_STD
namespace ranges {
-struct view_base { };
+struct view_base {};
-template<class _Derived>
+template <class _Derived>
requires is_class_v<_Derived> && same_as<_Derived, remove_cv_t<_Derived>>
class view_interface;
-template<class _Op, class _Yp>
+template <class _Op, class _Yp>
requires is_convertible_v<_Op*, view_interface<_Yp>*>
void __is_derived_from_view_interface(const _Op*, const view_interface<_Yp>*);
template <class _Tp>
-inline constexpr bool enable_view = derived_from<_Tp, view_base> ||
- requires { ranges::__is_derived_from_view_interface((_Tp*)nullptr, (_Tp*)nullptr); };
+inline constexpr bool enable_view = derived_from<_Tp, view_base> || requires {
+ ranges::__is_derived_from_view_interface((_Tp*)nullptr, (_Tp*)nullptr);
+};
} // namespace ranges
diff --git a/contrib/llvm-project/libcxx/include/__ranges/filter_view.h b/contrib/llvm-project/libcxx/include/__ranges/filter_view.h
index 1cef94ca6744..08d50ab01104 100644
--- a/contrib/llvm-project/libcxx/include/__ranges/filter_view.h
+++ b/contrib/llvm-project/libcxx/include/__ranges/filter_view.h
@@ -49,212 +49,199 @@ _LIBCPP_BEGIN_NAMESPACE_STD
#if _LIBCPP_STD_VER >= 20
namespace ranges {
- template<input_range _View, indirect_unary_predicate<iterator_t<_View>> _Pred>
- requires view<_View> && is_object_v<_Pred>
- class filter_view : public view_interface<filter_view<_View, _Pred>> {
- _LIBCPP_NO_UNIQUE_ADDRESS _View __base_ = _View();
- _LIBCPP_NO_UNIQUE_ADDRESS __movable_box<_Pred> __pred_;
-
- // We cache the result of begin() to allow providing an amortized O(1) begin() whenever
- // the underlying range is at least a forward_range.
- static constexpr bool _UseCache = forward_range<_View>;
- using _Cache = _If<_UseCache, __non_propagating_cache<iterator_t<_View>>, __empty_cache>;
- _LIBCPP_NO_UNIQUE_ADDRESS _Cache __cached_begin_ = _Cache();
-
- class __iterator;
- class __sentinel;
-
- public:
- _LIBCPP_HIDE_FROM_ABI
- filter_view() requires default_initializable<_View> && default_initializable<_Pred> = default;
-
- _LIBCPP_HIDE_FROM_ABI constexpr _LIBCPP_EXPLICIT_SINCE_CXX23 filter_view(_View __base, _Pred __pred)
- : __base_(std::move(__base)), __pred_(in_place, std::move(__pred)) {}
-
- template<class _Vp = _View>
- _LIBCPP_HIDE_FROM_ABI
- constexpr _View base() const& requires copy_constructible<_Vp> { return __base_; }
- _LIBCPP_HIDE_FROM_ABI
- constexpr _View base() && { return std::move(__base_); }
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr _Pred const& pred() const { return *__pred_; }
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr __iterator begin() {
- _LIBCPP_ASSERT_UNCATEGORIZED(
- __pred_.__has_value(),
- "Trying to call begin() on a filter_view that does not have a valid predicate.");
- if constexpr (_UseCache) {
- if (!__cached_begin_.__has_value()) {
- __cached_begin_.__emplace(ranges::find_if(__base_, std::ref(*__pred_)));
- }
- return {*this, *__cached_begin_};
- } else {
- return {*this, ranges::find_if(__base_, std::ref(*__pred_))};
+template <input_range _View, indirect_unary_predicate<iterator_t<_View>> _Pred>
+ requires view<_View> && is_object_v<_Pred>
+class filter_view : public view_interface<filter_view<_View, _Pred>> {
+ _LIBCPP_NO_UNIQUE_ADDRESS _View __base_ = _View();
+ _LIBCPP_NO_UNIQUE_ADDRESS __movable_box<_Pred> __pred_;
+
+ // We cache the result of begin() to allow providing an amortized O(1) begin() whenever
+ // the underlying range is at least a forward_range.
+ static constexpr bool _UseCache = forward_range<_View>;
+ using _Cache = _If<_UseCache, __non_propagating_cache<iterator_t<_View>>, __empty_cache>;
+ _LIBCPP_NO_UNIQUE_ADDRESS _Cache __cached_begin_ = _Cache();
+
+ class __iterator;
+ class __sentinel;
+
+public:
+ _LIBCPP_HIDE_FROM_ABI filter_view()
+ requires default_initializable<_View> && default_initializable<_Pred>
+ = default;
+
+ _LIBCPP_HIDE_FROM_ABI constexpr _LIBCPP_EXPLICIT_SINCE_CXX23 filter_view(_View __base, _Pred __pred)
+ : __base_(std::move(__base)), __pred_(in_place, std::move(__pred)) {}
+
+ template <class _Vp = _View>
+ _LIBCPP_HIDE_FROM_ABI constexpr _View base() const&
+ requires copy_constructible<_Vp>
+ {
+ return __base_;
+ }
+ _LIBCPP_HIDE_FROM_ABI constexpr _View base() && { return std::move(__base_); }
+
+ _LIBCPP_HIDE_FROM_ABI constexpr _Pred const& pred() const { return *__pred_; }
+
+ _LIBCPP_HIDE_FROM_ABI constexpr __iterator begin() {
+ _LIBCPP_ASSERT_UNCATEGORIZED(
+ __pred_.__has_value(), "Trying to call begin() on a filter_view that does not have a valid predicate.");
+ if constexpr (_UseCache) {
+ if (!__cached_begin_.__has_value()) {
+ __cached_begin_.__emplace(ranges::find_if(__base_, std::ref(*__pred_)));
}
+ return {*this, *__cached_begin_};
+ } else {
+ return {*this, ranges::find_if(__base_, std::ref(*__pred_))};
}
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr auto end() {
- if constexpr (common_range<_View>)
- return __iterator{*this, ranges::end(__base_)};
- else
- return __sentinel{*this};
- }
- };
-
- template<class _Range, class _Pred>
- filter_view(_Range&&, _Pred) -> filter_view<views::all_t<_Range>, _Pred>;
-
- template<class _View>
- struct __filter_iterator_category { };
-
- template<forward_range _View>
- struct __filter_iterator_category<_View> {
- using _Cat = typename iterator_traits<iterator_t<_View>>::iterator_category;
- using iterator_category =
- _If<derived_from<_Cat, bidirectional_iterator_tag>, bidirectional_iterator_tag,
- _If<derived_from<_Cat, forward_iterator_tag>, forward_iterator_tag,
- /* else */ _Cat
- >>;
- };
-
- template<input_range _View, indirect_unary_predicate<iterator_t<_View>> _Pred>
- requires view<_View> && is_object_v<_Pred>
- class filter_view<_View, _Pred>::__iterator : public __filter_iterator_category<_View> {
-
- public:
- _LIBCPP_NO_UNIQUE_ADDRESS iterator_t<_View> __current_ = iterator_t<_View>();
- _LIBCPP_NO_UNIQUE_ADDRESS filter_view* __parent_ = nullptr;
-
- using iterator_concept =
- _If<bidirectional_range<_View>, bidirectional_iterator_tag,
- _If<forward_range<_View>, forward_iterator_tag,
- /* else */ input_iterator_tag
- >>;
- // using iterator_category = inherited;
- using value_type = range_value_t<_View>;
- using difference_type = range_difference_t<_View>;
-
- _LIBCPP_HIDE_FROM_ABI
- __iterator() requires default_initializable<iterator_t<_View>> = default;
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr __iterator(filter_view& __parent, iterator_t<_View> __current)
- : __current_(std::move(__current)), __parent_(std::addressof(__parent))
- { }
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr iterator_t<_View> const& base() const& noexcept { return __current_; }
- _LIBCPP_HIDE_FROM_ABI
- constexpr iterator_t<_View> base() && { return std::move(__current_); }
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr range_reference_t<_View> operator*() const { return *__current_; }
- _LIBCPP_HIDE_FROM_ABI
- constexpr iterator_t<_View> operator->() const
- requires __has_arrow<iterator_t<_View>> && copyable<iterator_t<_View>>
- {
- return __current_;
- }
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr __iterator& operator++() {
- __current_ = ranges::find_if(std::move(++__current_), ranges::end(__parent_->__base_),
- std::ref(*__parent_->__pred_));
- return *this;
- }
- _LIBCPP_HIDE_FROM_ABI
- constexpr void operator++(int) { ++*this; }
- _LIBCPP_HIDE_FROM_ABI
- constexpr __iterator operator++(int) requires forward_range<_View> {
- auto __tmp = *this;
- ++*this;
- return __tmp;
- }
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr __iterator& operator--() requires bidirectional_range<_View> {
- do {
- --__current_;
- } while (!std::invoke(*__parent_->__pred_, *__current_));
- return *this;
- }
- _LIBCPP_HIDE_FROM_ABI
- constexpr __iterator operator--(int) requires bidirectional_range<_View> {
- auto __tmp = *this;
- --*this;
- return __tmp;
- }
-
- _LIBCPP_HIDE_FROM_ABI
- friend constexpr bool operator==(__iterator const& __x, __iterator const& __y)
- requires equality_comparable<iterator_t<_View>>
- {
- return __x.__current_ == __y.__current_;
- }
-
- _LIBCPP_HIDE_FROM_ABI
- friend constexpr range_rvalue_reference_t<_View> iter_move(__iterator const& __it)
- noexcept(noexcept(ranges::iter_move(__it.__current_)))
- {
- return ranges::iter_move(__it.__current_);
- }
-
- _LIBCPP_HIDE_FROM_ABI
- friend constexpr void iter_swap(__iterator const& __x, __iterator const& __y)
- noexcept(noexcept(ranges::iter_swap(__x.__current_, __y.__current_)))
- requires indirectly_swappable<iterator_t<_View>>
- {
- return ranges::iter_swap(__x.__current_, __y.__current_);
- }
- };
-
- template<input_range _View, indirect_unary_predicate<iterator_t<_View>> _Pred>
- requires view<_View> && is_object_v<_Pred>
- class filter_view<_View, _Pred>::__sentinel {
- public:
- sentinel_t<_View> __end_ = sentinel_t<_View>();
-
- _LIBCPP_HIDE_FROM_ABI
- __sentinel() = default;
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr explicit __sentinel(filter_view& __parent)
- : __end_(ranges::end(__parent.__base_))
- { }
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr sentinel_t<_View> base() const { return __end_; }
-
- _LIBCPP_HIDE_FROM_ABI friend constexpr bool
- operator==(__iterator const& __x, __sentinel const& __y) {
- return __x.__current_ == __y.__end_;
- }
- };
+ }
+
+ _LIBCPP_HIDE_FROM_ABI constexpr auto end() {
+ if constexpr (common_range<_View>)
+ return __iterator{*this, ranges::end(__base_)};
+ else
+ return __sentinel{*this};
+ }
+};
+
+template <class _Range, class _Pred>
+filter_view(_Range&&, _Pred) -> filter_view<views::all_t<_Range>, _Pred>;
+
+template <class _View>
+struct __filter_iterator_category {};
+
+template <forward_range _View>
+struct __filter_iterator_category<_View> {
+ using _Cat = typename iterator_traits<iterator_t<_View>>::iterator_category;
+ using iterator_category =
+ _If<derived_from<_Cat, bidirectional_iterator_tag>,
+ bidirectional_iterator_tag,
+ _If<derived_from<_Cat, forward_iterator_tag>,
+ forward_iterator_tag,
+ /* else */ _Cat >>;
+};
+
+template <input_range _View, indirect_unary_predicate<iterator_t<_View>> _Pred>
+ requires view<_View> && is_object_v<_Pred>
+class filter_view<_View, _Pred>::__iterator : public __filter_iterator_category<_View> {
+public:
+ _LIBCPP_NO_UNIQUE_ADDRESS iterator_t<_View> __current_ = iterator_t<_View>();
+ _LIBCPP_NO_UNIQUE_ADDRESS filter_view* __parent_ = nullptr;
+
+ using iterator_concept =
+ _If<bidirectional_range<_View>,
+ bidirectional_iterator_tag,
+ _If<forward_range<_View>,
+ forward_iterator_tag,
+ /* else */ input_iterator_tag >>;
+ // using iterator_category = inherited;
+ using value_type = range_value_t<_View>;
+ using difference_type = range_difference_t<_View>;
+
+ _LIBCPP_HIDE_FROM_ABI __iterator()
+ requires default_initializable<iterator_t<_View>>
+ = default;
+
+ _LIBCPP_HIDE_FROM_ABI constexpr __iterator(filter_view& __parent, iterator_t<_View> __current)
+ : __current_(std::move(__current)), __parent_(std::addressof(__parent)) {}
+
+ _LIBCPP_HIDE_FROM_ABI constexpr iterator_t<_View> const& base() const& noexcept { return __current_; }
+ _LIBCPP_HIDE_FROM_ABI constexpr iterator_t<_View> base() && { return std::move(__current_); }
+
+ _LIBCPP_HIDE_FROM_ABI constexpr range_reference_t<_View> operator*() const { return *__current_; }
+ _LIBCPP_HIDE_FROM_ABI constexpr iterator_t<_View> operator->() const
+ requires __has_arrow<iterator_t<_View>> && copyable<iterator_t<_View>>
+ {
+ return __current_;
+ }
+
+ _LIBCPP_HIDE_FROM_ABI constexpr __iterator& operator++() {
+ __current_ =
+ ranges::find_if(std::move(++__current_), ranges::end(__parent_->__base_), std::ref(*__parent_->__pred_));
+ return *this;
+ }
+ _LIBCPP_HIDE_FROM_ABI constexpr void operator++(int) { ++*this; }
+ _LIBCPP_HIDE_FROM_ABI constexpr __iterator operator++(int)
+ requires forward_range<_View>
+ {
+ auto __tmp = *this;
+ ++*this;
+ return __tmp;
+ }
+
+ _LIBCPP_HIDE_FROM_ABI constexpr __iterator& operator--()
+ requires bidirectional_range<_View>
+ {
+ do {
+ --__current_;
+ } while (!std::invoke(*__parent_->__pred_, *__current_));
+ return *this;
+ }
+ _LIBCPP_HIDE_FROM_ABI constexpr __iterator operator--(int)
+ requires bidirectional_range<_View>
+ {
+ auto __tmp = *this;
+ --*this;
+ return __tmp;
+ }
+
+ _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator==(__iterator const& __x, __iterator const& __y)
+ requires equality_comparable<iterator_t<_View>>
+ {
+ return __x.__current_ == __y.__current_;
+ }
+
+ _LIBCPP_HIDE_FROM_ABI friend constexpr range_rvalue_reference_t<_View>
+ iter_move(__iterator const& __it) noexcept(noexcept(ranges::iter_move(__it.__current_))) {
+ return ranges::iter_move(__it.__current_);
+ }
+
+ _LIBCPP_HIDE_FROM_ABI friend constexpr void
+ iter_swap(__iterator const& __x,
+ __iterator const& __y) noexcept(noexcept(ranges::iter_swap(__x.__current_, __y.__current_)))
+ requires indirectly_swappable<iterator_t<_View>>
+ {
+ return ranges::iter_swap(__x.__current_, __y.__current_);
+ }
+};
+
+template <input_range _View, indirect_unary_predicate<iterator_t<_View>> _Pred>
+ requires view<_View> && is_object_v<_Pred>
+class filter_view<_View, _Pred>::__sentinel {
+public:
+ sentinel_t<_View> __end_ = sentinel_t<_View>();
+
+ _LIBCPP_HIDE_FROM_ABI __sentinel() = default;
+
+ _LIBCPP_HIDE_FROM_ABI constexpr explicit __sentinel(filter_view& __parent) : __end_(ranges::end(__parent.__base_)) {}
+
+ _LIBCPP_HIDE_FROM_ABI constexpr sentinel_t<_View> base() const { return __end_; }
+
+ _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator==(__iterator const& __x, __sentinel const& __y) {
+ return __x.__current_ == __y.__end_;
+ }
+};
namespace views {
namespace __filter {
- struct __fn {
- template<class _Range, class _Pred>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI
- constexpr auto operator()(_Range&& __range, _Pred&& __pred) const
+struct __fn {
+ template <class _Range, class _Pred>
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Range&& __range, _Pred&& __pred) const
noexcept(noexcept(filter_view(std::forward<_Range>(__range), std::forward<_Pred>(__pred))))
- -> decltype( filter_view(std::forward<_Range>(__range), std::forward<_Pred>(__pred)))
- { return filter_view(std::forward<_Range>(__range), std::forward<_Pred>(__pred)); }
-
- template<class _Pred>
- requires constructible_from<decay_t<_Pred>, _Pred>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI
- constexpr auto operator()(_Pred&& __pred) const
- noexcept(is_nothrow_constructible_v<decay_t<_Pred>, _Pred>)
- { return __range_adaptor_closure_t(std::__bind_back(*this, std::forward<_Pred>(__pred))); }
- };
+ -> decltype(filter_view(std::forward<_Range>(__range), std::forward<_Pred>(__pred))) {
+ return filter_view(std::forward<_Range>(__range), std::forward<_Pred>(__pred));
+ }
+
+ template <class _Pred>
+ requires constructible_from<decay_t<_Pred>, _Pred>
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Pred&& __pred) const
+ noexcept(is_nothrow_constructible_v<decay_t<_Pred>, _Pred>) {
+ return __range_adaptor_closure_t(std::__bind_back(*this, std::forward<_Pred>(__pred)));
+ }
+};
} // namespace __filter
inline namespace __cpo {
- inline constexpr auto filter = __filter::__fn{};
+inline constexpr auto filter = __filter::__fn{};
} // namespace __cpo
} // namespace views
diff --git a/contrib/llvm-project/libcxx/include/__ranges/iota_view.h b/contrib/llvm-project/libcxx/include/__ranges/iota_view.h
index ccf0c7a8e8d5..c6c9618cfe6c 100644
--- a/contrib/llvm-project/libcxx/include/__ranges/iota_view.h
+++ b/contrib/llvm-project/libcxx/include/__ranges/iota_view.h
@@ -46,36 +46,39 @@ _LIBCPP_BEGIN_NAMESPACE_STD
#if _LIBCPP_STD_VER >= 20
namespace ranges {
- template<class _Int>
- struct __get_wider_signed {
- consteval static auto __call() {
- if constexpr (sizeof(_Int) < sizeof(short)) return type_identity<short>{};
- else if constexpr (sizeof(_Int) < sizeof(int)) return type_identity<int>{};
- else if constexpr (sizeof(_Int) < sizeof(long)) return type_identity<long>{};
- else return type_identity<long long>{};
-
- static_assert(sizeof(_Int) <= sizeof(long long),
- "Found integer-like type that is bigger than largest integer like type.");
- }
-
- using type = typename decltype(__call())::type;
- };
-
- template<class _Start>
- using _IotaDiffT = typename _If<
- (!integral<_Start> || sizeof(iter_difference_t<_Start>) > sizeof(_Start)),
- type_identity<iter_difference_t<_Start>>,
- __get_wider_signed<_Start>
- >::type;
-
- template<class _Iter>
- concept __decrementable = incrementable<_Iter> && requires(_Iter __i) {
- { --__i } -> same_as<_Iter&>;
- { __i-- } -> same_as<_Iter>;
- };
-
- template<class _Iter>
- concept __advanceable =
+template <class _Int>
+struct __get_wider_signed {
+ consteval static auto __call() {
+ if constexpr (sizeof(_Int) < sizeof(short))
+ return type_identity<short>{};
+ else if constexpr (sizeof(_Int) < sizeof(int))
+ return type_identity<int>{};
+ else if constexpr (sizeof(_Int) < sizeof(long))
+ return type_identity<long>{};
+ else
+ return type_identity<long long>{};
+
+ static_assert(
+ sizeof(_Int) <= sizeof(long long), "Found integer-like type that is bigger than largest integer like type.");
+ }
+
+ using type = typename decltype(__call())::type;
+};
+
+template <class _Start>
+using _IotaDiffT =
+ typename _If< (!integral<_Start> || sizeof(iter_difference_t<_Start>) > sizeof(_Start)),
+ type_identity<iter_difference_t<_Start>>,
+ __get_wider_signed<_Start> >::type;
+
+template <class _Iter>
+concept __decrementable = incrementable<_Iter> && requires(_Iter __i) {
+ { --__i } -> same_as<_Iter&>;
+ { __i-- } -> same_as<_Iter>;
+};
+
+template <class _Iter>
+concept __advanceable =
__decrementable<_Iter> && totally_ordered<_Iter> &&
requires(_Iter __i, const _Iter __j, const _IotaDiffT<_Iter> __n) {
{ __i += __n } -> same_as<_Iter&>;
@@ -86,322 +89,304 @@ namespace ranges {
{ __j - __j } -> convertible_to<_IotaDiffT<_Iter>>;
};
- template<class>
- struct __iota_iterator_category {};
+template <class>
+struct __iota_iterator_category {};
- template<incrementable _Tp>
- struct __iota_iterator_category<_Tp> {
- using iterator_category = input_iterator_tag;
- };
+template <incrementable _Tp>
+struct __iota_iterator_category<_Tp> {
+ using iterator_category = input_iterator_tag;
+};
- template <weakly_incrementable _Start, semiregular _BoundSentinel = unreachable_sentinel_t>
- requires __weakly_equality_comparable_with<_Start, _BoundSentinel> && copyable<_Start>
- class iota_view : public view_interface<iota_view<_Start, _BoundSentinel>> {
- struct __iterator : public __iota_iterator_category<_Start> {
- friend class iota_view;
+template <weakly_incrementable _Start, semiregular _BoundSentinel = unreachable_sentinel_t>
+ requires __weakly_equality_comparable_with<_Start, _BoundSentinel> && copyable<_Start>
+class iota_view : public view_interface<iota_view<_Start, _BoundSentinel>> {
+ struct __iterator : public __iota_iterator_category<_Start> {
+ friend class iota_view;
- using iterator_concept =
- _If<__advanceable<_Start>, random_access_iterator_tag,
- _If<__decrementable<_Start>, bidirectional_iterator_tag,
- _If<incrementable<_Start>, forward_iterator_tag,
- /*Else*/ input_iterator_tag>>>;
+ using iterator_concept =
+ _If<__advanceable<_Start>,
+ random_access_iterator_tag,
+ _If<__decrementable<_Start>,
+ bidirectional_iterator_tag,
+ _If<incrementable<_Start>,
+ forward_iterator_tag,
+ /*Else*/ input_iterator_tag>>>;
- using value_type = _Start;
- using difference_type = _IotaDiffT<_Start>;
+ using value_type = _Start;
+ using difference_type = _IotaDiffT<_Start>;
- _Start __value_ = _Start();
+ _Start __value_ = _Start();
- _LIBCPP_HIDE_FROM_ABI
- __iterator() requires default_initializable<_Start> = default;
+ _LIBCPP_HIDE_FROM_ABI __iterator()
+ requires default_initializable<_Start>
+ = default;
- _LIBCPP_HIDE_FROM_ABI
- constexpr explicit __iterator(_Start __value) : __value_(std::move(__value)) {}
+ _LIBCPP_HIDE_FROM_ABI constexpr explicit __iterator(_Start __value) : __value_(std::move(__value)) {}
- _LIBCPP_HIDE_FROM_ABI
- constexpr _Start operator*() const noexcept(is_nothrow_copy_constructible_v<_Start>) {
- return __value_;
- }
+ _LIBCPP_HIDE_FROM_ABI constexpr _Start operator*() const noexcept(is_nothrow_copy_constructible_v<_Start>) {
+ return __value_;
+ }
- _LIBCPP_HIDE_FROM_ABI
- constexpr __iterator& operator++() {
- ++__value_;
- return *this;
- }
+ _LIBCPP_HIDE_FROM_ABI constexpr __iterator& operator++() {
+ ++__value_;
+ return *this;
+ }
- _LIBCPP_HIDE_FROM_ABI
- constexpr void operator++(int) { ++*this; }
+ _LIBCPP_HIDE_FROM_ABI constexpr void operator++(int) { ++*this; }
- _LIBCPP_HIDE_FROM_ABI
- constexpr __iterator operator++(int) requires incrementable<_Start> {
- auto __tmp = *this;
- ++*this;
- return __tmp;
- }
+ _LIBCPP_HIDE_FROM_ABI constexpr __iterator operator++(int)
+ requires incrementable<_Start>
+ {
+ auto __tmp = *this;
+ ++*this;
+ return __tmp;
+ }
- _LIBCPP_HIDE_FROM_ABI
- constexpr __iterator& operator--() requires __decrementable<_Start> {
- --__value_;
- return *this;
- }
+ _LIBCPP_HIDE_FROM_ABI constexpr __iterator& operator--()
+ requires __decrementable<_Start>
+ {
+ --__value_;
+ return *this;
+ }
- _LIBCPP_HIDE_FROM_ABI
- constexpr __iterator operator--(int) requires __decrementable<_Start> {
- auto __tmp = *this;
- --*this;
- return __tmp;
- }
+ _LIBCPP_HIDE_FROM_ABI constexpr __iterator operator--(int)
+ requires __decrementable<_Start>
+ {
+ auto __tmp = *this;
+ --*this;
+ return __tmp;
+ }
- _LIBCPP_HIDE_FROM_ABI
- constexpr __iterator& operator+=(difference_type __n)
- requires __advanceable<_Start>
- {
- if constexpr (__integer_like<_Start> && !__signed_integer_like<_Start>) {
- if (__n >= difference_type(0)) {
- __value_ += static_cast<_Start>(__n);
- } else {
- __value_ -= static_cast<_Start>(-__n);
- }
+ _LIBCPP_HIDE_FROM_ABI constexpr __iterator& operator+=(difference_type __n)
+ requires __advanceable<_Start>
+ {
+ if constexpr (__integer_like<_Start> && !__signed_integer_like<_Start>) {
+ if (__n >= difference_type(0)) {
+ __value_ += static_cast<_Start>(__n);
} else {
- __value_ += __n;
+ __value_ -= static_cast<_Start>(-__n);
}
- return *this;
+ } else {
+ __value_ += __n;
}
+ return *this;
+ }
- _LIBCPP_HIDE_FROM_ABI
- constexpr __iterator& operator-=(difference_type __n)
- requires __advanceable<_Start>
- {
- if constexpr (__integer_like<_Start> && !__signed_integer_like<_Start>) {
- if (__n >= difference_type(0)) {
- __value_ -= static_cast<_Start>(__n);
- } else {
- __value_ += static_cast<_Start>(-__n);
- }
+ _LIBCPP_HIDE_FROM_ABI constexpr __iterator& operator-=(difference_type __n)
+ requires __advanceable<_Start>
+ {
+ if constexpr (__integer_like<_Start> && !__signed_integer_like<_Start>) {
+ if (__n >= difference_type(0)) {
+ __value_ -= static_cast<_Start>(__n);
} else {
- __value_ -= __n;
+ __value_ += static_cast<_Start>(-__n);
}
- return *this;
+ } else {
+ __value_ -= __n;
}
+ return *this;
+ }
- _LIBCPP_HIDE_FROM_ABI
- constexpr _Start operator[](difference_type __n) const
- requires __advanceable<_Start>
- {
- return _Start(__value_ + __n);
- }
+ _LIBCPP_HIDE_FROM_ABI constexpr _Start operator[](difference_type __n) const
+ requires __advanceable<_Start>
+ {
+ return _Start(__value_ + __n);
+ }
- _LIBCPP_HIDE_FROM_ABI
- friend constexpr bool operator==(const __iterator& __x, const __iterator& __y)
- requires equality_comparable<_Start>
- {
- return __x.__value_ == __y.__value_;
- }
+ _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator==(const __iterator& __x, const __iterator& __y)
+ requires equality_comparable<_Start>
+ {
+ return __x.__value_ == __y.__value_;
+ }
- _LIBCPP_HIDE_FROM_ABI
- friend constexpr bool operator<(const __iterator& __x, const __iterator& __y)
- requires totally_ordered<_Start>
- {
- return __x.__value_ < __y.__value_;
- }
+ _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator<(const __iterator& __x, const __iterator& __y)
+ requires totally_ordered<_Start>
+ {
+ return __x.__value_ < __y.__value_;
+ }
- _LIBCPP_HIDE_FROM_ABI
- friend constexpr bool operator>(const __iterator& __x, const __iterator& __y)
- requires totally_ordered<_Start>
- {
- return __y < __x;
- }
+ _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator>(const __iterator& __x, const __iterator& __y)
+ requires totally_ordered<_Start>
+ {
+ return __y < __x;
+ }
- _LIBCPP_HIDE_FROM_ABI
- friend constexpr bool operator<=(const __iterator& __x, const __iterator& __y)
- requires totally_ordered<_Start>
- {
- return !(__y < __x);
- }
+ _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator<=(const __iterator& __x, const __iterator& __y)
+ requires totally_ordered<_Start>
+ {
+ return !(__y < __x);
+ }
- _LIBCPP_HIDE_FROM_ABI
- friend constexpr bool operator>=(const __iterator& __x, const __iterator& __y)
- requires totally_ordered<_Start>
- {
- return !(__x < __y);
- }
+ _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator>=(const __iterator& __x, const __iterator& __y)
+ requires totally_ordered<_Start>
+ {
+ return !(__x < __y);
+ }
- _LIBCPP_HIDE_FROM_ABI
- friend constexpr auto operator<=>(const __iterator& __x, const __iterator& __y)
- requires totally_ordered<_Start> && three_way_comparable<_Start>
- {
- return __x.__value_ <=> __y.__value_;
- }
+ _LIBCPP_HIDE_FROM_ABI friend constexpr auto operator<=>(const __iterator& __x, const __iterator& __y)
+ requires totally_ordered<_Start> && three_way_comparable<_Start>
+ {
+ return __x.__value_ <=> __y.__value_;
+ }
- _LIBCPP_HIDE_FROM_ABI
- friend constexpr __iterator operator+(__iterator __i, difference_type __n)
- requires __advanceable<_Start>
- {
- __i += __n;
- return __i;
- }
+ _LIBCPP_HIDE_FROM_ABI friend constexpr __iterator operator+(__iterator __i, difference_type __n)
+ requires __advanceable<_Start>
+ {
+ __i += __n;
+ return __i;
+ }
- _LIBCPP_HIDE_FROM_ABI
- friend constexpr __iterator operator+(difference_type __n, __iterator __i)
- requires __advanceable<_Start>
- {
- return __i + __n;
- }
+ _LIBCPP_HIDE_FROM_ABI friend constexpr __iterator operator+(difference_type __n, __iterator __i)
+ requires __advanceable<_Start>
+ {
+ return __i + __n;
+ }
- _LIBCPP_HIDE_FROM_ABI
- friend constexpr __iterator operator-(__iterator __i, difference_type __n)
- requires __advanceable<_Start>
- {
- __i -= __n;
- return __i;
- }
+ _LIBCPP_HIDE_FROM_ABI friend constexpr __iterator operator-(__iterator __i, difference_type __n)
+ requires __advanceable<_Start>
+ {
+ __i -= __n;
+ return __i;
+ }
- _LIBCPP_HIDE_FROM_ABI
- friend constexpr difference_type operator-(const __iterator& __x, const __iterator& __y)
- requires __advanceable<_Start>
- {
- if constexpr (__integer_like<_Start>) {
- if constexpr (__signed_integer_like<_Start>) {
- return difference_type(difference_type(__x.__value_) - difference_type(__y.__value_));
- }
- if (__y.__value_ > __x.__value_) {
- return difference_type(-difference_type(__y.__value_ - __x.__value_));
- }
- return difference_type(__x.__value_ - __y.__value_);
+ _LIBCPP_HIDE_FROM_ABI friend constexpr difference_type operator-(const __iterator& __x, const __iterator& __y)
+ requires __advanceable<_Start>
+ {
+ if constexpr (__integer_like<_Start>) {
+ if constexpr (__signed_integer_like<_Start>) {
+ return difference_type(difference_type(__x.__value_) - difference_type(__y.__value_));
}
- return __x.__value_ - __y.__value_;
- }
- };
-
- struct __sentinel {
- friend class iota_view;
-
- private:
- _BoundSentinel __bound_sentinel_ = _BoundSentinel();
-
- public:
- _LIBCPP_HIDE_FROM_ABI
- __sentinel() = default;
- _LIBCPP_HIDE_FROM_ABI constexpr explicit __sentinel(_BoundSentinel __bound_sentinel)
- : __bound_sentinel_(std::move(__bound_sentinel)) {}
-
- _LIBCPP_HIDE_FROM_ABI
- friend constexpr bool operator==(const __iterator& __x, const __sentinel& __y) {
- return __x.__value_ == __y.__bound_sentinel_;
+ if (__y.__value_ > __x.__value_) {
+ return difference_type(-difference_type(__y.__value_ - __x.__value_));
+ }
+ return difference_type(__x.__value_ - __y.__value_);
}
+ return __x.__value_ - __y.__value_;
+ }
+ };
- _LIBCPP_HIDE_FROM_ABI
- friend constexpr iter_difference_t<_Start> operator-(const __iterator& __x, const __sentinel& __y)
- requires sized_sentinel_for<_BoundSentinel, _Start>
- {
- return __x.__value_ - __y.__bound_sentinel_;
- }
+ struct __sentinel {
+ friend class iota_view;
- _LIBCPP_HIDE_FROM_ABI
- friend constexpr iter_difference_t<_Start> operator-(const __sentinel& __x, const __iterator& __y)
- requires sized_sentinel_for<_BoundSentinel, _Start>
- {
- return -(__y - __x);
- }
- };
-
- _Start __value_ = _Start();
+ private:
_BoundSentinel __bound_sentinel_ = _BoundSentinel();
public:
- _LIBCPP_HIDE_FROM_ABI
- iota_view() requires default_initializable<_Start> = default;
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr explicit iota_view(_Start __value) : __value_(std::move(__value)) { }
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr _LIBCPP_EXPLICIT_SINCE_CXX23 iota_view(type_identity_t<_Start> __value, type_identity_t<_BoundSentinel> __bound_sentinel)
- : __value_(std::move(__value)), __bound_sentinel_(std::move(__bound_sentinel)) {
- // Validate the precondition if possible.
- if constexpr (totally_ordered_with<_Start, _BoundSentinel>) {
- _LIBCPP_ASSERT_UNCATEGORIZED(ranges::less_equal()(__value_, __bound_sentinel_),
- "Precondition violated: value is greater than bound.");
- }
- }
+ _LIBCPP_HIDE_FROM_ABI __sentinel() = default;
+ _LIBCPP_HIDE_FROM_ABI constexpr explicit __sentinel(_BoundSentinel __bound_sentinel)
+ : __bound_sentinel_(std::move(__bound_sentinel)) {}
- _LIBCPP_HIDE_FROM_ABI
- constexpr _LIBCPP_EXPLICIT_SINCE_CXX23 iota_view(__iterator __first, __iterator __last)
- requires same_as<_Start, _BoundSentinel>
- : iota_view(std::move(__first.__value_), std::move(__last.__value_)) {}
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr _LIBCPP_EXPLICIT_SINCE_CXX23 iota_view(__iterator __first, _BoundSentinel __last)
- requires same_as<_BoundSentinel, unreachable_sentinel_t>
- : iota_view(std::move(__first.__value_), std::move(__last)) {}
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr _LIBCPP_EXPLICIT_SINCE_CXX23 iota_view(__iterator __first, __sentinel __last)
- requires(!same_as<_Start, _BoundSentinel> && !same_as<_BoundSentinel, unreachable_sentinel_t>)
- : iota_view(std::move(__first.__value_), std::move(__last.__bound_sentinel_)) {}
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr __iterator begin() const { return __iterator{__value_}; }
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr auto end() const {
- if constexpr (same_as<_BoundSentinel, unreachable_sentinel_t>)
- return unreachable_sentinel;
- else
- return __sentinel{__bound_sentinel_};
+ _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator==(const __iterator& __x, const __sentinel& __y) {
+ return __x.__value_ == __y.__bound_sentinel_;
}
- _LIBCPP_HIDE_FROM_ABI
- constexpr __iterator end() const
- requires same_as<_Start, _BoundSentinel>
+ _LIBCPP_HIDE_FROM_ABI friend constexpr iter_difference_t<_Start>
+ operator-(const __iterator& __x, const __sentinel& __y)
+ requires sized_sentinel_for<_BoundSentinel, _Start>
{
- return __iterator{__bound_sentinel_};
+ return __x.__value_ - __y.__bound_sentinel_;
}
- _LIBCPP_HIDE_FROM_ABI
- constexpr auto size() const
- requires(same_as<_Start, _BoundSentinel> && __advanceable<_Start>) ||
- (integral<_Start> && integral<_BoundSentinel>) || sized_sentinel_for<_BoundSentinel, _Start>
+ _LIBCPP_HIDE_FROM_ABI friend constexpr iter_difference_t<_Start>
+ operator-(const __sentinel& __x, const __iterator& __y)
+ requires sized_sentinel_for<_BoundSentinel, _Start>
{
- if constexpr (__integer_like<_Start> && __integer_like<_BoundSentinel>) {
- return (__value_ < 0)
- ? ((__bound_sentinel_ < 0)
- ? std::__to_unsigned_like(-__value_) - std::__to_unsigned_like(-__bound_sentinel_)
- : std::__to_unsigned_like(__bound_sentinel_) + std::__to_unsigned_like(-__value_))
- : std::__to_unsigned_like(__bound_sentinel_) - std::__to_unsigned_like(__value_);
- } else {
- return std::__to_unsigned_like(__bound_sentinel_ - __value_);
- }
+ return -(__y - __x);
}
};
- template <class _Start, class _BoundSentinel>
- requires(!__integer_like<_Start> || !__integer_like<_BoundSentinel> ||
- (__signed_integer_like<_Start> == __signed_integer_like<_BoundSentinel>))
- iota_view(_Start, _BoundSentinel) -> iota_view<_Start, _BoundSentinel>;
+ _Start __value_ = _Start();
+ _BoundSentinel __bound_sentinel_ = _BoundSentinel();
- template <class _Start, class _BoundSentinel>
- inline constexpr bool enable_borrowed_range<iota_view<_Start, _BoundSentinel>> = true;
-
- namespace views {
- namespace __iota {
- struct __fn {
- template<class _Start>
- _LIBCPP_HIDE_FROM_ABI
- constexpr auto operator()(_Start&& __start) const
+public:
+ _LIBCPP_HIDE_FROM_ABI iota_view()
+ requires default_initializable<_Start>
+ = default;
+
+ _LIBCPP_HIDE_FROM_ABI constexpr explicit iota_view(_Start __value) : __value_(std::move(__value)) {}
+
+ _LIBCPP_HIDE_FROM_ABI constexpr _LIBCPP_EXPLICIT_SINCE_CXX23
+ iota_view(type_identity_t<_Start> __value, type_identity_t<_BoundSentinel> __bound_sentinel)
+ : __value_(std::move(__value)), __bound_sentinel_(std::move(__bound_sentinel)) {
+ // Validate the precondition if possible.
+ if constexpr (totally_ordered_with<_Start, _BoundSentinel>) {
+ _LIBCPP_ASSERT_UNCATEGORIZED(
+ ranges::less_equal()(__value_, __bound_sentinel_), "Precondition violated: value is greater than bound.");
+ }
+ }
+
+ _LIBCPP_HIDE_FROM_ABI constexpr _LIBCPP_EXPLICIT_SINCE_CXX23 iota_view(__iterator __first, __iterator __last)
+ requires same_as<_Start, _BoundSentinel>
+ : iota_view(std::move(__first.__value_), std::move(__last.__value_)) {}
+
+ _LIBCPP_HIDE_FROM_ABI constexpr _LIBCPP_EXPLICIT_SINCE_CXX23 iota_view(__iterator __first, _BoundSentinel __last)
+ requires same_as<_BoundSentinel, unreachable_sentinel_t>
+ : iota_view(std::move(__first.__value_), std::move(__last)) {}
+
+ _LIBCPP_HIDE_FROM_ABI constexpr _LIBCPP_EXPLICIT_SINCE_CXX23 iota_view(__iterator __first, __sentinel __last)
+ requires(!same_as<_Start, _BoundSentinel> && !same_as<_BoundSentinel, unreachable_sentinel_t>)
+ : iota_view(std::move(__first.__value_), std::move(__last.__bound_sentinel_)) {}
+
+ _LIBCPP_HIDE_FROM_ABI constexpr __iterator begin() const { return __iterator{__value_}; }
+
+ _LIBCPP_HIDE_FROM_ABI constexpr auto end() const {
+ if constexpr (same_as<_BoundSentinel, unreachable_sentinel_t>)
+ return unreachable_sentinel;
+ else
+ return __sentinel{__bound_sentinel_};
+ }
+
+ _LIBCPP_HIDE_FROM_ABI constexpr __iterator end() const
+ requires same_as<_Start, _BoundSentinel>
+ {
+ return __iterator{__bound_sentinel_};
+ }
+
+ _LIBCPP_HIDE_FROM_ABI constexpr auto size() const
+ requires(same_as<_Start, _BoundSentinel> && __advanceable<_Start>) ||
+ (integral<_Start> && integral<_BoundSentinel>) || sized_sentinel_for<_BoundSentinel, _Start>
+ {
+ if constexpr (__integer_like<_Start> && __integer_like<_BoundSentinel>) {
+ return (__value_ < 0)
+ ? ((__bound_sentinel_ < 0)
+ ? std::__to_unsigned_like(-__value_) - std::__to_unsigned_like(-__bound_sentinel_)
+ : std::__to_unsigned_like(__bound_sentinel_) + std::__to_unsigned_like(-__value_))
+ : std::__to_unsigned_like(__bound_sentinel_) - std::__to_unsigned_like(__value_);
+ } else {
+ return std::__to_unsigned_like(__bound_sentinel_ - __value_);
+ }
+ }
+};
+
+template <class _Start, class _BoundSentinel>
+ requires(!__integer_like<_Start> || !__integer_like<_BoundSentinel> ||
+ (__signed_integer_like<_Start> == __signed_integer_like<_BoundSentinel>))
+iota_view(_Start, _BoundSentinel) -> iota_view<_Start, _BoundSentinel>;
+
+template <class _Start, class _BoundSentinel>
+inline constexpr bool enable_borrowed_range<iota_view<_Start, _BoundSentinel>> = true;
+
+namespace views {
+namespace __iota {
+struct __fn {
+ template <class _Start>
+ _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Start&& __start) const
noexcept(noexcept(ranges::iota_view(std::forward<_Start>(__start))))
- -> decltype( ranges::iota_view(std::forward<_Start>(__start)))
- { return ranges::iota_view(std::forward<_Start>(__start)); }
-
- template <class _Start, class _BoundSentinel>
- _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Start&& __start, _BoundSentinel&& __bound_sentinel) const
- noexcept(noexcept(ranges::iota_view(std::forward<_Start>(__start), std::forward<_BoundSentinel>(__bound_sentinel))))
- -> decltype( ranges::iota_view(std::forward<_Start>(__start), std::forward<_BoundSentinel>(__bound_sentinel)))
- { return ranges::iota_view(std::forward<_Start>(__start), std::forward<_BoundSentinel>(__bound_sentinel)); }
- };
+ -> decltype(ranges::iota_view(std::forward<_Start>(__start))) {
+ return ranges::iota_view(std::forward<_Start>(__start));
+ }
+
+ template <class _Start, class _BoundSentinel>
+ _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Start&& __start, _BoundSentinel&& __bound_sentinel) const noexcept(
+ noexcept(ranges::iota_view(std::forward<_Start>(__start), std::forward<_BoundSentinel>(__bound_sentinel))))
+ -> decltype(ranges::iota_view(std::forward<_Start>(__start), std::forward<_BoundSentinel>(__bound_sentinel))) {
+ return ranges::iota_view(std::forward<_Start>(__start), std::forward<_BoundSentinel>(__bound_sentinel));
+ }
+};
} // namespace __iota
inline namespace __cpo {
- inline constexpr auto iota = __iota::__fn{};
+inline constexpr auto iota = __iota::__fn{};
} // namespace __cpo
} // namespace views
} // namespace ranges
diff --git a/contrib/llvm-project/libcxx/include/__ranges/istream_view.h b/contrib/llvm-project/libcxx/include/__ranges/istream_view.h
index 71af102c3320..cd7096d35c2c 100644
--- a/contrib/llvm-project/libcxx/include/__ranges/istream_view.h
+++ b/contrib/llvm-project/libcxx/include/__ranges/istream_view.h
@@ -66,8 +66,7 @@ public:
using difference_type = ptrdiff_t;
using value_type = _Val;
- _LIBCPP_HIDE_FROM_ABI constexpr explicit __iterator(
- basic_istream_view<_Val, _CharT, _Traits>& __parent) noexcept
+ _LIBCPP_HIDE_FROM_ABI constexpr explicit __iterator(basic_istream_view<_Val, _CharT, _Traits>& __parent) noexcept
: __parent_(std::addressof(__parent)) {}
__iterator(const __iterator&) = delete;
diff --git a/contrib/llvm-project/libcxx/include/__ranges/join_view.h b/contrib/llvm-project/libcxx/include/__ranges/join_view.h
index f80beda33b11..22473059133f 100644
--- a/contrib/llvm-project/libcxx/include/__ranges/join_view.h
+++ b/contrib/llvm-project/libcxx/include/__ranges/join_view.h
@@ -46,389 +46,334 @@ _LIBCPP_BEGIN_NAMESPACE_STD
#if _LIBCPP_STD_VER >= 20
namespace ranges {
- template<class>
- struct __join_view_iterator_category {};
-
- template<class _View>
- requires is_reference_v<range_reference_t<_View>> &&
- forward_range<_View> &&
- forward_range<range_reference_t<_View>>
- struct __join_view_iterator_category<_View> {
- using _OuterC = typename iterator_traits<iterator_t<_View>>::iterator_category;
- using _InnerC = typename iterator_traits<iterator_t<range_reference_t<_View>>>::iterator_category;
-
- using iterator_category = _If<
- derived_from<_OuterC, bidirectional_iterator_tag> && derived_from<_InnerC, bidirectional_iterator_tag> &&
- common_range<range_reference_t<_View>>,
- bidirectional_iterator_tag,
- _If<
- derived_from<_OuterC, forward_iterator_tag> && derived_from<_InnerC, forward_iterator_tag>,
- forward_iterator_tag,
- input_iterator_tag
- >
- >;
- };
-
- template<input_range _View>
- requires view<_View> && input_range<range_reference_t<_View>>
- class join_view
- : public view_interface<join_view<_View>> {
- private:
- using _InnerRange = range_reference_t<_View>;
-
- template<bool> struct __iterator;
-
- template<bool> struct __sentinel;
-
- template <class>
- friend struct std::__segmented_iterator_traits;
-
- _LIBCPP_NO_UNIQUE_ADDRESS _View __base_ = _View();
-
- static constexpr bool _UseOuterCache = !forward_range<_View>;
- using _OuterCache = _If<_UseOuterCache, __non_propagating_cache<iterator_t<_View>>, __empty_cache>;
- _LIBCPP_NO_UNIQUE_ADDRESS _OuterCache __outer_;
-
- static constexpr bool _UseInnerCache = !is_reference_v<_InnerRange>;
- using _InnerCache = _If<_UseInnerCache, __non_propagating_cache<remove_cvref_t<_InnerRange>>, __empty_cache>;
- _LIBCPP_NO_UNIQUE_ADDRESS _InnerCache __inner_;
-
- public:
- _LIBCPP_HIDE_FROM_ABI
- join_view() requires default_initializable<_View> = default;
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr explicit join_view(_View __base)
- : __base_(std::move(__base)) {}
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr _View base() const& requires copy_constructible<_View> { return __base_; }
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr _View base() && { return std::move(__base_); }
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr auto begin() {
- if constexpr (forward_range<_View>) {
- constexpr bool __use_const = __simple_view<_View> &&
- is_reference_v<range_reference_t<_View>>;
- return __iterator<__use_const>{*this, ranges::begin(__base_)};
- } else {
- __outer_.__emplace(ranges::begin(__base_));
- return __iterator<false>{*this};
- }
- }
+template <class>
+struct __join_view_iterator_category {};
+
+template <class _View>
+ requires is_reference_v<range_reference_t<_View>> && forward_range<_View> && forward_range<range_reference_t<_View>>
+struct __join_view_iterator_category<_View> {
+ using _OuterC = typename iterator_traits<iterator_t<_View>>::iterator_category;
+ using _InnerC = typename iterator_traits<iterator_t<range_reference_t<_View>>>::iterator_category;
+
+ using iterator_category =
+ _If< derived_from<_OuterC, bidirectional_iterator_tag> && derived_from<_InnerC, bidirectional_iterator_tag> &&
+ common_range<range_reference_t<_View>>,
+ bidirectional_iterator_tag,
+ _If< derived_from<_OuterC, forward_iterator_tag> && derived_from<_InnerC, forward_iterator_tag>,
+ forward_iterator_tag,
+ input_iterator_tag > >;
+};
- template<class _V2 = _View>
- _LIBCPP_HIDE_FROM_ABI
- constexpr auto begin() const
- requires forward_range<const _V2> &&
- is_reference_v<range_reference_t<const _V2>> &&
- input_range<range_reference_t<const _V2>>
- {
- return __iterator<true>{*this, ranges::begin(__base_)};
- }
+template <input_range _View>
+ requires view<_View> && input_range<range_reference_t<_View>>
+class join_view : public view_interface<join_view<_View>> {
+private:
+ using _InnerRange = range_reference_t<_View>;
- _LIBCPP_HIDE_FROM_ABI
- constexpr auto end() {
- if constexpr (forward_range<_View> &&
- is_reference_v<_InnerRange> &&
- forward_range<_InnerRange> &&
- common_range<_View> &&
- common_range<_InnerRange>)
- return __iterator<__simple_view<_View>>{*this, ranges::end(__base_)};
- else
- return __sentinel<__simple_view<_View>>{*this};
+ template <bool>
+ struct __iterator;
+
+ template <bool>
+ struct __sentinel;
+
+ template <class>
+ friend struct std::__segmented_iterator_traits;
+
+ _LIBCPP_NO_UNIQUE_ADDRESS _View __base_ = _View();
+
+ static constexpr bool _UseOuterCache = !forward_range<_View>;
+ using _OuterCache = _If<_UseOuterCache, __non_propagating_cache<iterator_t<_View>>, __empty_cache>;
+ _LIBCPP_NO_UNIQUE_ADDRESS _OuterCache __outer_;
+
+ static constexpr bool _UseInnerCache = !is_reference_v<_InnerRange>;
+ using _InnerCache = _If<_UseInnerCache, __non_propagating_cache<remove_cvref_t<_InnerRange>>, __empty_cache>;
+ _LIBCPP_NO_UNIQUE_ADDRESS _InnerCache __inner_;
+
+public:
+ _LIBCPP_HIDE_FROM_ABI join_view()
+ requires default_initializable<_View>
+ = default;
+
+ _LIBCPP_HIDE_FROM_ABI constexpr explicit join_view(_View __base) : __base_(std::move(__base)) {}
+
+ _LIBCPP_HIDE_FROM_ABI constexpr _View base() const&
+ requires copy_constructible<_View>
+ {
+ return __base_;
+ }
+
+ _LIBCPP_HIDE_FROM_ABI constexpr _View base() && { return std::move(__base_); }
+
+ _LIBCPP_HIDE_FROM_ABI constexpr auto begin() {
+ if constexpr (forward_range<_View>) {
+ constexpr bool __use_const = __simple_view<_View> && is_reference_v<range_reference_t<_View>>;
+ return __iterator<__use_const>{*this, ranges::begin(__base_)};
+ } else {
+ __outer_.__emplace(ranges::begin(__base_));
+ return __iterator<false>{*this};
}
+ }
+
+ template <class _V2 = _View>
+ _LIBCPP_HIDE_FROM_ABI constexpr auto begin() const
+ requires forward_range<const _V2> && is_reference_v<range_reference_t<const _V2>> &&
+ input_range<range_reference_t<const _V2>>
+ {
+ return __iterator<true>{*this, ranges::begin(__base_)};
+ }
+
+ _LIBCPP_HIDE_FROM_ABI constexpr auto end() {
+ if constexpr (forward_range<_View> && is_reference_v<_InnerRange> && forward_range<_InnerRange> &&
+ common_range<_View> && common_range<_InnerRange>)
+ return __iterator<__simple_view<_View>>{*this, ranges::end(__base_)};
+ else
+ return __sentinel<__simple_view<_View>>{*this};
+ }
- template<class _V2 = _View>
- _LIBCPP_HIDE_FROM_ABI
- constexpr auto end() const
- requires forward_range<const _V2> &&
- is_reference_v<range_reference_t<const _V2>> &&
- input_range<range_reference_t<const _V2>>
- {
- using _ConstInnerRange = range_reference_t<const _View>;
- if constexpr (forward_range<_ConstInnerRange> &&
- common_range<const _View> &&
- common_range<_ConstInnerRange>) {
- return __iterator<true>{*this, ranges::end(__base_)};
- } else {
- return __sentinel<true>{*this};
- }
+ template <class _V2 = _View>
+ _LIBCPP_HIDE_FROM_ABI constexpr auto end() const
+ requires forward_range<const _V2> && is_reference_v<range_reference_t<const _V2>> &&
+ input_range<range_reference_t<const _V2>>
+ {
+ using _ConstInnerRange = range_reference_t<const _View>;
+ if constexpr (forward_range<_ConstInnerRange> && common_range<const _View> && common_range<_ConstInnerRange>) {
+ return __iterator<true>{*this, ranges::end(__base_)};
+ } else {
+ return __sentinel<true>{*this};
}
- };
-
- template<input_range _View>
- requires view<_View> && input_range<range_reference_t<_View>>
- template<bool _Const>
- struct join_view<_View>::__sentinel {
- private:
- template <bool>
- friend struct __sentinel;
-
- using _Parent = __maybe_const<_Const, join_view>;
- using _Base = __maybe_const<_Const, _View>;
- sentinel_t<_Base> __end_ = sentinel_t<_Base>();
-
- public:
- _LIBCPP_HIDE_FROM_ABI
- __sentinel() = default;
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr explicit __sentinel(_Parent& __parent)
- : __end_(ranges::end(__parent.__base_)) {}
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr __sentinel(__sentinel<!_Const> __s)
- requires _Const && convertible_to<sentinel_t<_View>, sentinel_t<_Base>>
+ }
+};
+
+template <input_range _View>
+ requires view<_View> && input_range<range_reference_t<_View>>
+template <bool _Const>
+struct join_view<_View>::__sentinel {
+private:
+ template <bool>
+ friend struct __sentinel;
+
+ using _Parent = __maybe_const<_Const, join_view>;
+ using _Base = __maybe_const<_Const, _View>;
+ sentinel_t<_Base> __end_ = sentinel_t<_Base>();
+
+public:
+ _LIBCPP_HIDE_FROM_ABI __sentinel() = default;
+
+ _LIBCPP_HIDE_FROM_ABI constexpr explicit __sentinel(_Parent& __parent) : __end_(ranges::end(__parent.__base_)) {}
+
+ _LIBCPP_HIDE_FROM_ABI constexpr __sentinel(__sentinel<!_Const> __s)
+ requires _Const && convertible_to<sentinel_t<_View>, sentinel_t<_Base>>
: __end_(std::move(__s.__end_)) {}
- template<bool _OtherConst>
- requires sentinel_for<sentinel_t<_Base>, iterator_t<__maybe_const<_OtherConst, _View>>>
- _LIBCPP_HIDE_FROM_ABI
- friend constexpr bool operator==(const __iterator<_OtherConst>& __x, const __sentinel& __y) {
- return __x.__get_outer() == __y.__end_;
- }
- };
-
- // https://reviews.llvm.org/D142811#inline-1383022
- // To simplify the segmented iterator traits specialization,
- // make the iterator `final`
- template<input_range _View>
- requires view<_View> && input_range<range_reference_t<_View>>
- template<bool _Const>
- struct join_view<_View>::__iterator final
- : public __join_view_iterator_category<__maybe_const<_Const, _View>> {
- friend join_view;
-
- template <class>
- friend struct std::__segmented_iterator_traits;
-
- static constexpr bool __is_join_view_iterator = true;
-
- private:
- using _Parent = __maybe_const<_Const, join_view<_View>>;
- using _Base = __maybe_const<_Const, _View>;
- using _Outer = iterator_t<_Base>;
- using _Inner = iterator_t<range_reference_t<_Base>>;
- using _InnerRange = range_reference_t<_View>;
-
- static_assert(!_Const || forward_range<_Base>, "Const can only be true when Base models forward_range.");
-
- static constexpr bool __ref_is_glvalue = is_reference_v<range_reference_t<_Base>>;
-
- static constexpr bool _OuterPresent = forward_range<_Base>;
- using _OuterType = _If<_OuterPresent, _Outer, std::__empty>;
- _LIBCPP_NO_UNIQUE_ADDRESS _OuterType __outer_ = _OuterType();
-
- optional<_Inner> __inner_;
- _Parent* __parent_ = nullptr;
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr void __satisfy() {
- for (; __get_outer() != ranges::end(__parent_->__base_); ++__get_outer()) {
- auto&& __inner = [this]() -> auto&& {
- if constexpr (__ref_is_glvalue)
- return *__get_outer();
- else
- return __parent_->__inner_.__emplace_from([&]() -> decltype(auto) { return *__get_outer(); });
- }();
- __inner_ = ranges::begin(__inner);
- if (*__inner_ != ranges::end(__inner))
- return;
- }
+ template <bool _OtherConst>
+ requires sentinel_for<sentinel_t<_Base>, iterator_t<__maybe_const<_OtherConst, _View>>>
+ _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator==(const __iterator<_OtherConst>& __x, const __sentinel& __y) {
+ return __x.__get_outer() == __y.__end_;
+ }
+};
- if constexpr (__ref_is_glvalue)
- __inner_.reset();
- }
+// https://reviews.llvm.org/D142811#inline-1383022
+// To simplify the segmented iterator traits specialization,
+// make the iterator `final`
+template <input_range _View>
+ requires view<_View> && input_range<range_reference_t<_View>>
+template <bool _Const>
+struct join_view<_View>::__iterator final : public __join_view_iterator_category<__maybe_const<_Const, _View>> {
+ friend join_view;
- _LIBCPP_HIDE_FROM_ABI constexpr _Outer& __get_outer() {
- if constexpr (forward_range<_Base>) {
- return __outer_;
- } else {
- return *__parent_->__outer_;
- }
- }
+ template <class>
+ friend struct std::__segmented_iterator_traits;
- _LIBCPP_HIDE_FROM_ABI constexpr const _Outer& __get_outer() const {
- if constexpr (forward_range<_Base>) {
- return __outer_;
- } else {
- return *__parent_->__outer_;
- }
- }
+ static constexpr bool __is_join_view_iterator = true;
- _LIBCPP_HIDE_FROM_ABI constexpr __iterator(_Parent& __parent, _Outer __outer)
- requires forward_range<_Base>
- : __outer_(std::move(__outer)), __parent_(std::addressof(__parent)) {
- __satisfy();
- }
+private:
+ using _Parent = __maybe_const<_Const, join_view<_View>>;
+ using _Base = __maybe_const<_Const, _View>;
+ using _Outer = iterator_t<_Base>;
+ using _Inner = iterator_t<range_reference_t<_Base>>;
+ using _InnerRange = range_reference_t<_View>;
- _LIBCPP_HIDE_FROM_ABI constexpr explicit __iterator(_Parent& __parent)
- requires(!forward_range<_Base>)
- : __parent_(std::addressof(__parent)) {
- __satisfy();
- }
+ static_assert(!_Const || forward_range<_Base>, "Const can only be true when Base models forward_range.");
- _LIBCPP_HIDE_FROM_ABI constexpr __iterator(_Parent* __parent, _Outer __outer, _Inner __inner)
- requires forward_range<_Base>
- : __outer_(std::move(__outer)), __inner_(std::move(__inner)), __parent_(__parent) {}
-
- public:
- using iterator_concept = _If<
- __ref_is_glvalue && bidirectional_range<_Base> && bidirectional_range<range_reference_t<_Base>> &&
- common_range<range_reference_t<_Base>>,
- bidirectional_iterator_tag,
- _If<
- __ref_is_glvalue && forward_range<_Base> && forward_range<range_reference_t<_Base>>,
- forward_iterator_tag,
- input_iterator_tag
- >
- >;
-
- using value_type = range_value_t<range_reference_t<_Base>>;
-
- using difference_type = common_type_t<
- range_difference_t<_Base>, range_difference_t<range_reference_t<_Base>>>;
-
- _LIBCPP_HIDE_FROM_ABI __iterator() = default;
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr __iterator(__iterator<!_Const> __i)
- requires _Const &&
- convertible_to<iterator_t<_View>, _Outer> &&
- convertible_to<iterator_t<_InnerRange>, _Inner>
- : __outer_(std::move(__i.__outer_))
- , __inner_(std::move(__i.__inner_))
- , __parent_(__i.__parent_) {}
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr decltype(auto) operator*() const {
- return **__inner_;
- }
+ static constexpr bool __ref_is_glvalue = is_reference_v<range_reference_t<_Base>>;
- _LIBCPP_HIDE_FROM_ABI
- constexpr _Inner operator->() const
- requires __has_arrow<_Inner> && copyable<_Inner>
- {
- return *__inner_;
- }
+ static constexpr bool _OuterPresent = forward_range<_Base>;
+ using _OuterType = _If<_OuterPresent, _Outer, std::__empty>;
+ _LIBCPP_NO_UNIQUE_ADDRESS _OuterType __outer_ = _OuterType();
- _LIBCPP_HIDE_FROM_ABI
- constexpr __iterator& operator++() {
- auto __get_inner_range = [&]() -> decltype(auto) {
+ optional<_Inner> __inner_;
+ _Parent* __parent_ = nullptr;
+
+ _LIBCPP_HIDE_FROM_ABI constexpr void __satisfy() {
+ for (; __get_outer() != ranges::end(__parent_->__base_); ++__get_outer()) {
+ auto&& __inner = [this]() -> auto&& {
if constexpr (__ref_is_glvalue)
return *__get_outer();
else
- return *__parent_->__inner_;
- };
- if (++*__inner_ == ranges::end(std::__as_lvalue(__get_inner_range()))) {
- ++__get_outer();
- __satisfy();
- }
- return *this;
+ return __parent_->__inner_.__emplace_from([&]() -> decltype(auto) { return *__get_outer(); });
+ }();
+ __inner_ = ranges::begin(__inner);
+ if (*__inner_ != ranges::end(__inner))
+ return;
}
- _LIBCPP_HIDE_FROM_ABI
- constexpr void operator++(int) {
- ++*this;
- }
+ if constexpr (__ref_is_glvalue)
+ __inner_.reset();
+ }
- _LIBCPP_HIDE_FROM_ABI
- constexpr __iterator operator++(int)
- requires __ref_is_glvalue &&
- forward_range<_Base> &&
- forward_range<range_reference_t<_Base>>
- {
- auto __tmp = *this;
- ++*this;
- return __tmp;
+ _LIBCPP_HIDE_FROM_ABI constexpr _Outer& __get_outer() {
+ if constexpr (forward_range<_Base>) {
+ return __outer_;
+ } else {
+ return *__parent_->__outer_;
}
+ }
- _LIBCPP_HIDE_FROM_ABI
- constexpr __iterator& operator--()
- requires __ref_is_glvalue &&
- bidirectional_range<_Base> &&
- bidirectional_range<range_reference_t<_Base>> &&
- common_range<range_reference_t<_Base>>
- {
- if (__outer_ == ranges::end(__parent_->__base_))
- __inner_ = ranges::end(std::__as_lvalue(*--__outer_));
-
- // Skip empty inner ranges when going backwards.
- while (*__inner_ == ranges::begin(std::__as_lvalue(*__outer_))) {
- __inner_ = ranges::end(std::__as_lvalue(*--__outer_));
- }
-
- --*__inner_;
- return *this;
+ _LIBCPP_HIDE_FROM_ABI constexpr const _Outer& __get_outer() const {
+ if constexpr (forward_range<_Base>) {
+ return __outer_;
+ } else {
+ return *__parent_->__outer_;
}
+ }
- _LIBCPP_HIDE_FROM_ABI
- constexpr __iterator operator--(int)
- requires __ref_is_glvalue &&
- bidirectional_range<_Base> &&
- bidirectional_range<range_reference_t<_Base>> &&
- common_range<range_reference_t<_Base>>
- {
- auto __tmp = *this;
- --*this;
- return __tmp;
- }
+ _LIBCPP_HIDE_FROM_ABI constexpr __iterator(_Parent& __parent, _Outer __outer)
+ requires forward_range<_Base>
+ : __outer_(std::move(__outer)), __parent_(std::addressof(__parent)) {
+ __satisfy();
+ }
- _LIBCPP_HIDE_FROM_ABI
- friend constexpr bool operator==(const __iterator& __x, const __iterator& __y)
- requires __ref_is_glvalue &&
- forward_range<_Base> &&
- equality_comparable<iterator_t<range_reference_t<_Base>>>
- {
- return __x.__outer_ == __y.__outer_ && __x.__inner_ == __y.__inner_;
- }
+ _LIBCPP_HIDE_FROM_ABI constexpr explicit __iterator(_Parent& __parent)
+ requires(!forward_range<_Base>)
+ : __parent_(std::addressof(__parent)) {
+ __satisfy();
+ }
+
+ _LIBCPP_HIDE_FROM_ABI constexpr __iterator(_Parent* __parent, _Outer __outer, _Inner __inner)
+ requires forward_range<_Base>
+ : __outer_(std::move(__outer)), __inner_(std::move(__inner)), __parent_(__parent) {}
- _LIBCPP_HIDE_FROM_ABI
- friend constexpr decltype(auto) iter_move(const __iterator& __i)
- noexcept(noexcept(ranges::iter_move(*__i.__inner_)))
- {
- return ranges::iter_move(*__i.__inner_);
+public:
+ using iterator_concept =
+ _If< __ref_is_glvalue && bidirectional_range<_Base> && bidirectional_range<range_reference_t<_Base>> &&
+ common_range<range_reference_t<_Base>>,
+ bidirectional_iterator_tag,
+ _If< __ref_is_glvalue && forward_range<_Base> && forward_range<range_reference_t<_Base>>,
+ forward_iterator_tag,
+ input_iterator_tag > >;
+
+ using value_type = range_value_t<range_reference_t<_Base>>;
+
+ using difference_type = common_type_t< range_difference_t<_Base>, range_difference_t<range_reference_t<_Base>>>;
+
+ _LIBCPP_HIDE_FROM_ABI __iterator() = default;
+
+ _LIBCPP_HIDE_FROM_ABI constexpr __iterator(__iterator<!_Const> __i)
+ requires _Const && convertible_to<iterator_t<_View>, _Outer> && convertible_to<iterator_t<_InnerRange>, _Inner>
+ : __outer_(std::move(__i.__outer_)), __inner_(std::move(__i.__inner_)), __parent_(__i.__parent_) {}
+
+ _LIBCPP_HIDE_FROM_ABI constexpr decltype(auto) operator*() const { return **__inner_; }
+
+ _LIBCPP_HIDE_FROM_ABI constexpr _Inner operator->() const
+ requires __has_arrow<_Inner> && copyable<_Inner>
+ {
+ return *__inner_;
+ }
+
+ _LIBCPP_HIDE_FROM_ABI constexpr __iterator& operator++() {
+ auto __get_inner_range = [&]() -> decltype(auto) {
+ if constexpr (__ref_is_glvalue)
+ return *__get_outer();
+ else
+ return *__parent_->__inner_;
+ };
+ if (++*__inner_ == ranges::end(std::__as_lvalue(__get_inner_range()))) {
+ ++__get_outer();
+ __satisfy();
}
+ return *this;
+ }
+
+ _LIBCPP_HIDE_FROM_ABI constexpr void operator++(int) { ++*this; }
+
+ _LIBCPP_HIDE_FROM_ABI constexpr __iterator operator++(int)
+ requires __ref_is_glvalue && forward_range<_Base> && forward_range<range_reference_t<_Base>>
+ {
+ auto __tmp = *this;
+ ++*this;
+ return __tmp;
+ }
- _LIBCPP_HIDE_FROM_ABI
- friend constexpr void iter_swap(const __iterator& __x, const __iterator& __y)
- noexcept(noexcept(ranges::iter_swap(*__x.__inner_, *__y.__inner_)))
- requires indirectly_swappable<_Inner>
- {
- return ranges::iter_swap(*__x.__inner_, *__y.__inner_);
+ _LIBCPP_HIDE_FROM_ABI constexpr __iterator& operator--()
+ requires __ref_is_glvalue && bidirectional_range<_Base> && bidirectional_range<range_reference_t<_Base>> &&
+ common_range<range_reference_t<_Base>>
+ {
+ if (__outer_ == ranges::end(__parent_->__base_))
+ __inner_ = ranges::end(std::__as_lvalue(*--__outer_));
+
+ // Skip empty inner ranges when going backwards.
+ while (*__inner_ == ranges::begin(std::__as_lvalue(*__outer_))) {
+ __inner_ = ranges::end(std::__as_lvalue(*--__outer_));
}
- };
- template<class _Range>
- explicit join_view(_Range&&) -> join_view<views::all_t<_Range>>;
+ --*__inner_;
+ return *this;
+ }
+
+ _LIBCPP_HIDE_FROM_ABI constexpr __iterator operator--(int)
+ requires __ref_is_glvalue && bidirectional_range<_Base> && bidirectional_range<range_reference_t<_Base>> &&
+ common_range<range_reference_t<_Base>>
+ {
+ auto __tmp = *this;
+ --*this;
+ return __tmp;
+ }
+
+ _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator==(const __iterator& __x, const __iterator& __y)
+ requires __ref_is_glvalue && forward_range<_Base> && equality_comparable<iterator_t<range_reference_t<_Base>>>
+ {
+ return __x.__outer_ == __y.__outer_ && __x.__inner_ == __y.__inner_;
+ }
+
+ _LIBCPP_HIDE_FROM_ABI friend constexpr decltype(auto)
+ iter_move(const __iterator& __i) noexcept(noexcept(ranges::iter_move(*__i.__inner_))) {
+ return ranges::iter_move(*__i.__inner_);
+ }
+
+ _LIBCPP_HIDE_FROM_ABI friend constexpr void
+ iter_swap(const __iterator& __x,
+ const __iterator& __y) noexcept(noexcept(ranges::iter_swap(*__x.__inner_, *__y.__inner_)))
+ requires indirectly_swappable<_Inner>
+ {
+ return ranges::iter_swap(*__x.__inner_, *__y.__inner_);
+ }
+};
+
+template <class _Range>
+explicit join_view(_Range&&) -> join_view<views::all_t<_Range>>;
namespace views {
namespace __join_view {
struct __fn : __range_adaptor_closure<__fn> {
- template<class _Range>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI
- constexpr auto operator()(_Range&& __range) const
- noexcept(noexcept(join_view<all_t<_Range&&>>(std::forward<_Range>(__range))))
- -> decltype( join_view<all_t<_Range&&>>(std::forward<_Range>(__range)))
- { return join_view<all_t<_Range&&>>(std::forward<_Range>(__range)); }
+ template <class _Range>
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Range&& __range) const
+ noexcept(noexcept(join_view<all_t<_Range&&>>(std::forward<_Range>(__range))))
+ -> decltype(join_view<all_t<_Range&&>>(std::forward<_Range>(__range))) {
+ return join_view<all_t<_Range&&>>(std::forward<_Range>(__range));
+ }
};
} // namespace __join_view
inline namespace __cpo {
- inline constexpr auto join = __join_view::__fn{};
+inline constexpr auto join = __join_view::__fn{};
} // namespace __cpo
} // namespace views
} // namespace ranges
template <class _JoinViewIterator>
- requires(_JoinViewIterator::__is_join_view_iterator &&
- ranges::common_range<typename _JoinViewIterator::_Parent> &&
+ requires(_JoinViewIterator::__is_join_view_iterator && ranges::common_range<typename _JoinViewIterator::_Parent> &&
__has_random_access_iterator_category<typename _JoinViewIterator::_Outer>::value &&
__has_random_access_iterator_category<typename _JoinViewIterator::_Inner>::value)
struct __segmented_iterator_traits<_JoinViewIterator> {
-
using __segment_iterator =
_LIBCPP_NODEBUG __iterator_with_data<typename _JoinViewIterator::_Outer, typename _JoinViewIterator::_Parent*>;
using __local_iterator = typename _JoinViewIterator::_Inner;
@@ -436,33 +381,33 @@ struct __segmented_iterator_traits<_JoinViewIterator> {
// TODO: Would it make sense to enable the optimization for other iterator types?
static constexpr _LIBCPP_HIDE_FROM_ABI __segment_iterator __segment(_JoinViewIterator __iter) {
- if (ranges::empty(__iter.__parent_->__base_))
- return {};
- if (!__iter.__inner_.has_value())
- return __segment_iterator(--__iter.__outer_, __iter.__parent_);
- return __segment_iterator(__iter.__outer_, __iter.__parent_);
+ if (ranges::empty(__iter.__parent_->__base_))
+ return {};
+ if (!__iter.__inner_.has_value())
+ return __segment_iterator(--__iter.__outer_, __iter.__parent_);
+ return __segment_iterator(__iter.__outer_, __iter.__parent_);
}
static constexpr _LIBCPP_HIDE_FROM_ABI __local_iterator __local(_JoinViewIterator __iter) {
- if (ranges::empty(__iter.__parent_->__base_))
- return {};
- if (!__iter.__inner_.has_value())
- return ranges::end(*--__iter.__outer_);
- return *__iter.__inner_;
+ if (ranges::empty(__iter.__parent_->__base_))
+ return {};
+ if (!__iter.__inner_.has_value())
+ return ranges::end(*--__iter.__outer_);
+ return *__iter.__inner_;
}
static constexpr _LIBCPP_HIDE_FROM_ABI __local_iterator __begin(__segment_iterator __iter) {
- return ranges::begin(*__iter.__get_iter());
+ return ranges::begin(*__iter.__get_iter());
}
static constexpr _LIBCPP_HIDE_FROM_ABI __local_iterator __end(__segment_iterator __iter) {
- return ranges::end(*__iter.__get_iter());
+ return ranges::end(*__iter.__get_iter());
}
static constexpr _LIBCPP_HIDE_FROM_ABI _JoinViewIterator
__compose(__segment_iterator __seg_iter, __local_iterator __local_iter) {
- return _JoinViewIterator(
- std::move(__seg_iter).__get_data(), std::move(__seg_iter).__get_iter(), std::move(__local_iter));
+ return _JoinViewIterator(
+ std::move(__seg_iter).__get_data(), std::move(__seg_iter).__get_iter(), std::move(__local_iter));
}
};
diff --git a/contrib/llvm-project/libcxx/include/__ranges/lazy_split_view.h b/contrib/llvm-project/libcxx/include/__ranges/lazy_split_view.h
index 8ed4bcfdeb56..e96398b14b58 100644
--- a/contrib/llvm-project/libcxx/include/__ranges/lazy_split_view.h
+++ b/contrib/llvm-project/libcxx/include/__ranges/lazy_split_view.h
@@ -53,73 +53,73 @@ _LIBCPP_BEGIN_NAMESPACE_STD
namespace ranges {
-template <auto> struct __require_constant;
+template <auto>
+struct __require_constant;
template <class _Range>
-concept __tiny_range =
- sized_range<_Range> &&
- requires { typename __require_constant<remove_reference_t<_Range>::size()>; } &&
- (remove_reference_t<_Range>::size() <= 1);
+concept __tiny_range = sized_range<_Range> && requires {
+ typename __require_constant<remove_reference_t<_Range>::size()>;
+} && (remove_reference_t<_Range>::size() <= 1);
template <input_range _View, forward_range _Pattern>
requires view<_View> && view<_Pattern> &&
indirectly_comparable<iterator_t<_View>, iterator_t<_Pattern>, ranges::equal_to> &&
(forward_range<_View> || __tiny_range<_Pattern>)
class lazy_split_view : public view_interface<lazy_split_view<_View, _Pattern>> {
-
- _LIBCPP_NO_UNIQUE_ADDRESS _View __base_ = _View();
+ _LIBCPP_NO_UNIQUE_ADDRESS _View __base_ = _View();
_LIBCPP_NO_UNIQUE_ADDRESS _Pattern __pattern_ = _Pattern();
using _MaybeCurrent = _If<!forward_range<_View>, __non_propagating_cache<iterator_t<_View>>, __empty_cache>;
_LIBCPP_NO_UNIQUE_ADDRESS _MaybeCurrent __current_ = _MaybeCurrent();
- template <bool> struct __outer_iterator;
- template <bool> struct __inner_iterator;
+ template <bool>
+ struct __outer_iterator;
+ template <bool>
+ struct __inner_iterator;
public:
- _LIBCPP_HIDE_FROM_ABI
- lazy_split_view()
- requires default_initializable<_View> && default_initializable<_Pattern> = default;
+ _LIBCPP_HIDE_FROM_ABI lazy_split_view()
+ requires default_initializable<_View> && default_initializable<_Pattern>
+ = default;
- _LIBCPP_HIDE_FROM_ABI
- constexpr _LIBCPP_EXPLICIT_SINCE_CXX23 lazy_split_view(_View __base, _Pattern __pattern)
- : __base_(std::move(__base)), __pattern_(std::move(__pattern)) {}
+ _LIBCPP_HIDE_FROM_ABI constexpr _LIBCPP_EXPLICIT_SINCE_CXX23 lazy_split_view(_View __base, _Pattern __pattern)
+ : __base_(std::move(__base)), __pattern_(std::move(__pattern)) {}
template <input_range _Range>
requires constructible_from<_View, views::all_t<_Range>> &&
- constructible_from<_Pattern, single_view<range_value_t<_Range>>>
- _LIBCPP_HIDE_FROM_ABI
- constexpr _LIBCPP_EXPLICIT_SINCE_CXX23 lazy_split_view(_Range&& __r, range_value_t<_Range> __e)
- : __base_(views::all(std::forward<_Range>(__r)))
- , __pattern_(views::single(std::move(__e))) {}
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr _View base() const& requires copy_constructible<_View> { return __base_; }
- _LIBCPP_HIDE_FROM_ABI
- constexpr _View base() && { return std::move(__base_); }
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr auto begin() {
+ constructible_from<_Pattern, single_view<range_value_t<_Range>>>
+ _LIBCPP_HIDE_FROM_ABI constexpr _LIBCPP_EXPLICIT_SINCE_CXX23 lazy_split_view(_Range&& __r, range_value_t<_Range> __e)
+ : __base_(views::all(std::forward<_Range>(__r))), __pattern_(views::single(std::move(__e))) {}
+
+ _LIBCPP_HIDE_FROM_ABI constexpr _View base() const&
+ requires copy_constructible<_View>
+ {
+ return __base_;
+ }
+ _LIBCPP_HIDE_FROM_ABI constexpr _View base() && { return std::move(__base_); }
+
+ _LIBCPP_HIDE_FROM_ABI constexpr auto begin() {
if constexpr (forward_range<_View>) {
- return __outer_iterator<__simple_view<_View> && __simple_view<_Pattern>>{*this, ranges::begin(__base_)};
+ return __outer_iterator < __simple_view<_View> && __simple_view < _Pattern >> {*this, ranges::begin(__base_)};
} else {
__current_.__emplace(ranges::begin(__base_));
return __outer_iterator<false>{*this};
}
}
- _LIBCPP_HIDE_FROM_ABI
- constexpr auto begin() const requires forward_range<_View> && forward_range<const _View> {
+ _LIBCPP_HIDE_FROM_ABI constexpr auto begin() const
+ requires forward_range<_View> && forward_range<const _View>
+ {
return __outer_iterator<true>{*this, ranges::begin(__base_)};
}
- _LIBCPP_HIDE_FROM_ABI
- constexpr auto end() requires forward_range<_View> && common_range<_View> {
- return __outer_iterator<__simple_view<_View> && __simple_view<_Pattern>>{*this, ranges::end(__base_)};
+ _LIBCPP_HIDE_FROM_ABI constexpr auto end()
+ requires forward_range<_View> && common_range<_View>
+ {
+ return __outer_iterator < __simple_view<_View> && __simple_view < _Pattern >> {*this, ranges::end(__base_)};
}
- _LIBCPP_HIDE_FROM_ABI
- constexpr auto end() const {
+ _LIBCPP_HIDE_FROM_ABI constexpr auto end() const {
if constexpr (forward_range<_View> && forward_range<const _View> && common_range<const _View>) {
return __outer_iterator<true>{*this, ranges::end(__base_)};
} else {
@@ -128,7 +128,6 @@ public:
}
private:
-
template <class>
struct __outer_iterator_category {};
@@ -145,15 +144,14 @@ private:
friend __outer_iterator<true>;
using _Parent = __maybe_const<_Const, lazy_split_view>;
- using _Base = __maybe_const<_Const, _View>;
+ using _Base = __maybe_const<_Const, _View>;
- _Parent* __parent_ = nullptr;
- using _MaybeCurrent = _If<forward_range<_View>, iterator_t<_Base>, __empty_cache>;
+ _Parent* __parent_ = nullptr;
+ using _MaybeCurrent = _If<forward_range<_View>, iterator_t<_Base>, __empty_cache>;
_LIBCPP_NO_UNIQUE_ADDRESS _MaybeCurrent __current_ = _MaybeCurrent();
- bool __trailing_empty_ = false;
+ bool __trailing_empty_ = false;
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI
- constexpr auto& __current() noexcept {
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto& __current() noexcept {
if constexpr (forward_range<_View>) {
return __current_;
} else {
@@ -161,8 +159,7 @@ private:
}
}
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI
- constexpr const auto& __current() const noexcept {
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr const auto& __current() const noexcept {
if constexpr (forward_range<_View>) {
return __current_;
} else {
@@ -172,56 +169,42 @@ private:
// Workaround for the GCC issue that doesn't allow calling `__parent_->__base_` from friend functions (because
// `__base_` is private).
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI
- constexpr auto& __parent_base() const noexcept {
- return __parent_->__base_;
- }
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto& __parent_base() const noexcept { return __parent_->__base_; }
public:
// using iterator_category = inherited;
using iterator_concept = conditional_t<forward_range<_Base>, forward_iterator_tag, input_iterator_tag>;
- using difference_type = range_difference_t<_Base>;
+ using difference_type = range_difference_t<_Base>;
struct value_type : view_interface<value_type> {
private:
__outer_iterator __i_ = __outer_iterator();
public:
- _LIBCPP_HIDE_FROM_ABI
- value_type() = default;
- _LIBCPP_HIDE_FROM_ABI
- constexpr explicit value_type(__outer_iterator __i)
- : __i_(std::move(__i)) {}
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr __inner_iterator<_Const> begin() const { return __inner_iterator<_Const>{__i_}; }
- _LIBCPP_HIDE_FROM_ABI
- constexpr default_sentinel_t end() const noexcept { return default_sentinel; }
+ _LIBCPP_HIDE_FROM_ABI value_type() = default;
+ _LIBCPP_HIDE_FROM_ABI constexpr explicit value_type(__outer_iterator __i) : __i_(std::move(__i)) {}
+
+ _LIBCPP_HIDE_FROM_ABI constexpr __inner_iterator<_Const> begin() const { return __inner_iterator<_Const>{__i_}; }
+ _LIBCPP_HIDE_FROM_ABI constexpr default_sentinel_t end() const noexcept { return default_sentinel; }
};
- _LIBCPP_HIDE_FROM_ABI
- __outer_iterator() = default;
+ _LIBCPP_HIDE_FROM_ABI __outer_iterator() = default;
- _LIBCPP_HIDE_FROM_ABI
- constexpr explicit __outer_iterator(_Parent& __parent)
- requires (!forward_range<_Base>)
- : __parent_(std::addressof(__parent)) {}
+ _LIBCPP_HIDE_FROM_ABI constexpr explicit __outer_iterator(_Parent& __parent)
+ requires(!forward_range<_Base>)
+ : __parent_(std::addressof(__parent)) {}
- _LIBCPP_HIDE_FROM_ABI
- constexpr __outer_iterator(_Parent& __parent, iterator_t<_Base> __current)
+ _LIBCPP_HIDE_FROM_ABI constexpr __outer_iterator(_Parent& __parent, iterator_t<_Base> __current)
requires forward_range<_Base>
- : __parent_(std::addressof(__parent)), __current_(std::move(__current)) {}
+ : __parent_(std::addressof(__parent)), __current_(std::move(__current)) {}
- _LIBCPP_HIDE_FROM_ABI
- constexpr __outer_iterator(__outer_iterator<!_Const> __i)
+ _LIBCPP_HIDE_FROM_ABI constexpr __outer_iterator(__outer_iterator<!_Const> __i)
requires _Const && convertible_to<iterator_t<_View>, iterator_t<_Base>>
- : __parent_(__i.__parent_), __current_(std::move(__i.__current_)) {}
+ : __parent_(__i.__parent_), __current_(std::move(__i.__current_)) {}
- _LIBCPP_HIDE_FROM_ABI
- constexpr value_type operator*() const { return value_type{*this}; }
+ _LIBCPP_HIDE_FROM_ABI constexpr value_type operator*() const { return value_type{*this}; }
- _LIBCPP_HIDE_FROM_ABI
- constexpr __outer_iterator& operator++() {
+ _LIBCPP_HIDE_FROM_ABI constexpr __outer_iterator& operator++() {
const auto __end = ranges::end(__parent_->__base_);
if (__current() == __end) {
__trailing_empty_ = false;
@@ -260,8 +243,7 @@ private:
return *this;
}
- _LIBCPP_HIDE_FROM_ABI
- constexpr decltype(auto) operator++(int) {
+ _LIBCPP_HIDE_FROM_ABI constexpr decltype(auto) operator++(int) {
if constexpr (forward_range<_Base>) {
auto __tmp = *this;
++*this;
@@ -272,14 +254,13 @@ private:
}
}
- _LIBCPP_HIDE_FROM_ABI
- friend constexpr bool operator==(const __outer_iterator& __x, const __outer_iterator& __y)
- requires forward_range<_Base> {
+ _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator==(const __outer_iterator& __x, const __outer_iterator& __y)
+ requires forward_range<_Base>
+ {
return __x.__current_ == __y.__current_ && __x.__trailing_empty_ == __y.__trailing_empty_;
}
- _LIBCPP_HIDE_FROM_ABI
- friend constexpr bool operator==(const __outer_iterator& __x, default_sentinel_t) {
+ _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator==(const __outer_iterator& __x, default_sentinel_t) {
_LIBCPP_ASSERT_NON_NULL(__x.__parent_ != nullptr, "Cannot call comparison on a default-constructed iterator.");
return __x.__current() == ranges::end(__x.__parent_base()) && !__x.__trailing_empty_;
}
@@ -290,11 +271,10 @@ private:
template <forward_range _Tp>
struct __inner_iterator_category<_Tp> {
- using iterator_category = _If<
- derived_from<typename iterator_traits<iterator_t<_Tp>>::iterator_category, forward_iterator_tag>,
- forward_iterator_tag,
- typename iterator_traits<iterator_t<_Tp>>::iterator_category
- >;
+ using iterator_category =
+ _If< derived_from<typename iterator_traits<iterator_t<_Tp>>::iterator_category, forward_iterator_tag>,
+ forward_iterator_tag,
+ typename iterator_traits<iterator_t<_Tp>>::iterator_category >;
};
template <bool _Const>
@@ -303,18 +283,17 @@ private:
using _Base = __maybe_const<_Const, _View>;
// Workaround for a GCC issue.
static constexpr bool _OuterConst = _Const;
- __outer_iterator<_Const> __i_ = __outer_iterator<_OuterConst>();
- bool __incremented_ = false;
+ __outer_iterator<_Const> __i_ = __outer_iterator<_OuterConst>();
+ bool __incremented_ = false;
// Note: these private functions are necessary because GCC doesn't allow calls to private members of `__i_` from
// free functions that are friends of `inner-iterator`.
- _LIBCPP_HIDE_FROM_ABI
- constexpr bool __is_done() const {
+ _LIBCPP_HIDE_FROM_ABI constexpr bool __is_done() const {
_LIBCPP_ASSERT_NON_NULL(__i_.__parent_ != nullptr, "Cannot call comparison on a default-constructed iterator.");
auto [__pcur, __pend] = ranges::subrange{__i_.__parent_->__pattern_};
- auto __end = ranges::end(__i_.__parent_->__base_);
+ auto __end = ranges::end(__i_.__parent_->__base_);
if constexpr (__tiny_range<_Pattern>) {
const auto& __cur = __i_.__current();
@@ -343,40 +322,32 @@ private:
}
}
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI
- constexpr auto& __outer_current() noexcept {
- return __i_.__current();
- }
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto& __outer_current() noexcept { return __i_.__current(); }
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI
- constexpr const auto& __outer_current() const noexcept {
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr const auto& __outer_current() const noexcept {
return __i_.__current();
}
public:
// using iterator_category = inherited;
using iterator_concept = typename __outer_iterator<_Const>::iterator_concept;
- using value_type = range_value_t<_Base>;
- using difference_type = range_difference_t<_Base>;
+ using value_type = range_value_t<_Base>;
+ using difference_type = range_difference_t<_Base>;
- _LIBCPP_HIDE_FROM_ABI
- __inner_iterator() = default;
+ _LIBCPP_HIDE_FROM_ABI __inner_iterator() = default;
- _LIBCPP_HIDE_FROM_ABI
- constexpr explicit __inner_iterator(__outer_iterator<_Const> __i)
- : __i_(std::move(__i)) {}
+ _LIBCPP_HIDE_FROM_ABI constexpr explicit __inner_iterator(__outer_iterator<_Const> __i) : __i_(std::move(__i)) {}
- _LIBCPP_HIDE_FROM_ABI
- constexpr const iterator_t<_Base>& base() const& noexcept { return __i_.__current(); }
- _LIBCPP_HIDE_FROM_ABI
- constexpr iterator_t<_Base> base() &&
- requires forward_range<_View> { return std::move(__i_.__current()); }
+ _LIBCPP_HIDE_FROM_ABI constexpr const iterator_t<_Base>& base() const& noexcept { return __i_.__current(); }
+ _LIBCPP_HIDE_FROM_ABI constexpr iterator_t<_Base> base() &&
+ requires forward_range<_View>
+ {
+ return std::move(__i_.__current());
+ }
- _LIBCPP_HIDE_FROM_ABI
- constexpr decltype(auto) operator*() const { return *__i_.__current(); }
+ _LIBCPP_HIDE_FROM_ABI constexpr decltype(auto) operator*() const { return *__i_.__current(); }
- _LIBCPP_HIDE_FROM_ABI
- constexpr __inner_iterator& operator++() {
+ _LIBCPP_HIDE_FROM_ABI constexpr __inner_iterator& operator++() {
__incremented_ = true;
if constexpr (!forward_range<_Base>) {
@@ -389,8 +360,7 @@ private:
return *this;
}
- _LIBCPP_HIDE_FROM_ABI
- constexpr decltype(auto) operator++(int) {
+ _LIBCPP_HIDE_FROM_ABI constexpr decltype(auto) operator++(int) {
if constexpr (forward_range<_Base>) {
auto __tmp = *this;
++*this;
@@ -401,31 +371,29 @@ private:
}
}
- _LIBCPP_HIDE_FROM_ABI
- friend constexpr bool operator==(const __inner_iterator& __x, const __inner_iterator& __y)
- requires forward_range<_Base> {
+ _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator==(const __inner_iterator& __x, const __inner_iterator& __y)
+ requires forward_range<_Base>
+ {
return __x.__outer_current() == __y.__outer_current();
}
- _LIBCPP_HIDE_FROM_ABI
- friend constexpr bool operator==(const __inner_iterator& __x, default_sentinel_t) {
+ _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator==(const __inner_iterator& __x, default_sentinel_t) {
return __x.__is_done();
}
- _LIBCPP_HIDE_FROM_ABI
- friend constexpr decltype(auto) iter_move(const __inner_iterator& __i)
- noexcept(noexcept(ranges::iter_move(__i.__outer_current()))) {
+ _LIBCPP_HIDE_FROM_ABI friend constexpr decltype(auto)
+ iter_move(const __inner_iterator& __i) noexcept(noexcept(ranges::iter_move(__i.__outer_current()))) {
return ranges::iter_move(__i.__outer_current());
}
- _LIBCPP_HIDE_FROM_ABI
- friend constexpr void iter_swap(const __inner_iterator& __x, const __inner_iterator& __y)
- noexcept(noexcept(ranges::iter_swap(__x.__outer_current(), __y.__outer_current())))
- requires indirectly_swappable<iterator_t<_Base>> {
+ _LIBCPP_HIDE_FROM_ABI friend constexpr void iter_swap(
+ const __inner_iterator& __x,
+ const __inner_iterator& __y) noexcept(noexcept(ranges::iter_swap(__x.__outer_current(), __y.__outer_current())))
+ requires indirectly_swappable<iterator_t<_Base>>
+ {
ranges::iter_swap(__x.__outer_current(), __y.__outer_current());
}
};
-
};
template <class _Range, class _Pattern>
@@ -433,22 +401,21 @@ lazy_split_view(_Range&&, _Pattern&&) -> lazy_split_view<views::all_t<_Range>, v
template <input_range _Range>
lazy_split_view(_Range&&, range_value_t<_Range>)
- -> lazy_split_view<views::all_t<_Range>, single_view<range_value_t<_Range>>>;
+ -> lazy_split_view<views::all_t<_Range>, single_view<range_value_t<_Range>>>;
namespace views {
namespace __lazy_split_view {
struct __fn {
template <class _Range, class _Pattern>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI
- constexpr auto operator()(_Range&& __range, _Pattern&& __pattern) const
- noexcept(noexcept(lazy_split_view(std::forward<_Range>(__range), std::forward<_Pattern>(__pattern))))
- -> decltype( lazy_split_view(std::forward<_Range>(__range), std::forward<_Pattern>(__pattern)))
- { return lazy_split_view(std::forward<_Range>(__range), std::forward<_Pattern>(__pattern)); }
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Range&& __range, _Pattern&& __pattern) const
+ noexcept(noexcept(lazy_split_view(std::forward<_Range>(__range), std::forward<_Pattern>(__pattern))))
+ -> decltype(lazy_split_view(std::forward<_Range>(__range), std::forward<_Pattern>(__pattern))) {
+ return lazy_split_view(std::forward<_Range>(__range), std::forward<_Pattern>(__pattern));
+ }
template <class _Pattern>
requires constructible_from<decay_t<_Pattern>, _Pattern>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI
- constexpr auto operator()(_Pattern&& __pattern) const
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Pattern&& __pattern) const
noexcept(is_nothrow_constructible_v<decay_t<_Pattern>, _Pattern>) {
return __range_adaptor_closure_t(std::__bind_back(*this, std::forward<_Pattern>(__pattern)));
}
@@ -456,7 +423,7 @@ struct __fn {
} // namespace __lazy_split_view
inline namespace __cpo {
- inline constexpr auto lazy_split = __lazy_split_view::__fn{};
+inline constexpr auto lazy_split = __lazy_split_view::__fn{};
} // namespace __cpo
} // namespace views
diff --git a/contrib/llvm-project/libcxx/include/__ranges/non_propagating_cache.h b/contrib/llvm-project/libcxx/include/__ranges/non_propagating_cache.h
index f5223962049c..b2de2d2ae1cb 100644
--- a/contrib/llvm-project/libcxx/include/__ranges/non_propagating_cache.h
+++ b/contrib/llvm-project/libcxx/include/__ranges/non_propagating_cache.h
@@ -26,85 +26,74 @@ _LIBCPP_BEGIN_NAMESPACE_STD
#if _LIBCPP_STD_VER >= 20
namespace ranges {
- // __non_propagating_cache is a helper type that allows storing an optional value in it,
- // but which does not copy the source's value when it is copy constructed/assigned to,
- // and which resets the source's value when it is moved-from.
- //
- // This type is used as an implementation detail of some views that need to cache the
- // result of `begin()` in order to provide an amortized O(1) begin() method. Typically,
- // we don't want to propagate the value of the cache upon copy because the cached iterator
- // may refer to internal details of the source view.
- template<class _Tp>
- requires is_object_v<_Tp>
- class _LIBCPP_TEMPLATE_VIS __non_propagating_cache {
- struct __from_tag { };
- struct __forward_tag { };
-
- // This helper class is needed to perform copy and move elision when
- // constructing the contained type from an iterator.
- struct __wrapper {
- template <class... _Args>
- _LIBCPP_HIDE_FROM_ABI constexpr explicit __wrapper(__forward_tag, _Args&&... __args)
- : __t_(std::forward<_Args>(__args)...) {}
- template <class _Fn>
- _LIBCPP_HIDE_FROM_ABI constexpr explicit __wrapper(__from_tag, _Fn const& __f) : __t_(__f()) {}
- _Tp __t_;
- };
-
- optional<__wrapper> __value_ = nullopt;
-
- public:
- _LIBCPP_HIDE_FROM_ABI __non_propagating_cache() = default;
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr __non_propagating_cache(__non_propagating_cache const&) noexcept
- : __value_(nullopt)
- { }
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr __non_propagating_cache(__non_propagating_cache&& __other) noexcept
- : __value_(nullopt)
- {
- __other.__value_.reset();
- }
+// __non_propagating_cache is a helper type that allows storing an optional value in it,
+// but which does not copy the source's value when it is copy constructed/assigned to,
+// and which resets the source's value when it is moved-from.
+//
+// This type is used as an implementation detail of some views that need to cache the
+// result of `begin()` in order to provide an amortized O(1) begin() method. Typically,
+// we don't want to propagate the value of the cache upon copy because the cached iterator
+// may refer to internal details of the source view.
+template <class _Tp>
+ requires is_object_v<_Tp>
+class _LIBCPP_TEMPLATE_VIS __non_propagating_cache {
+ struct __from_tag {};
+ struct __forward_tag {};
+
+ // This helper class is needed to perform copy and move elision when
+ // constructing the contained type from an iterator.
+ struct __wrapper {
+ template <class... _Args>
+ _LIBCPP_HIDE_FROM_ABI constexpr explicit __wrapper(__forward_tag, _Args&&... __args)
+ : __t_(std::forward<_Args>(__args)...) {}
+ template <class _Fn>
+ _LIBCPP_HIDE_FROM_ABI constexpr explicit __wrapper(__from_tag, _Fn const& __f) : __t_(__f()) {}
+ _Tp __t_;
+ };
- _LIBCPP_HIDE_FROM_ABI
- constexpr __non_propagating_cache& operator=(__non_propagating_cache const& __other) noexcept {
- if (this != std::addressof(__other)) {
- __value_.reset();
- }
- return *this;
- }
+ optional<__wrapper> __value_ = nullopt;
+
+public:
+ _LIBCPP_HIDE_FROM_ABI __non_propagating_cache() = default;
+
+ _LIBCPP_HIDE_FROM_ABI constexpr __non_propagating_cache(__non_propagating_cache const&) noexcept
+ : __value_(nullopt) {}
- _LIBCPP_HIDE_FROM_ABI
- constexpr __non_propagating_cache& operator=(__non_propagating_cache&& __other) noexcept {
+ _LIBCPP_HIDE_FROM_ABI constexpr __non_propagating_cache(__non_propagating_cache&& __other) noexcept
+ : __value_(nullopt) {
+ __other.__value_.reset();
+ }
+
+ _LIBCPP_HIDE_FROM_ABI constexpr __non_propagating_cache& operator=(__non_propagating_cache const& __other) noexcept {
+ if (this != std::addressof(__other)) {
__value_.reset();
- __other.__value_.reset();
- return *this;
}
+ return *this;
+ }
- _LIBCPP_HIDE_FROM_ABI
- constexpr _Tp& operator*() { return __value_->__t_; }
- _LIBCPP_HIDE_FROM_ABI
- constexpr _Tp const& operator*() const { return __value_->__t_; }
+ _LIBCPP_HIDE_FROM_ABI constexpr __non_propagating_cache& operator=(__non_propagating_cache&& __other) noexcept {
+ __value_.reset();
+ __other.__value_.reset();
+ return *this;
+ }
- _LIBCPP_HIDE_FROM_ABI
- constexpr bool __has_value() const { return __value_.has_value(); }
+ _LIBCPP_HIDE_FROM_ABI constexpr _Tp& operator*() { return __value_->__t_; }
+ _LIBCPP_HIDE_FROM_ABI constexpr _Tp const& operator*() const { return __value_->__t_; }
- template<class _Fn>
- _LIBCPP_HIDE_FROM_ABI
- constexpr _Tp& __emplace_from(_Fn const& __f) {
- return __value_.emplace(__from_tag{}, __f).__t_;
- }
+ _LIBCPP_HIDE_FROM_ABI constexpr bool __has_value() const { return __value_.has_value(); }
- template<class ..._Args>
- _LIBCPP_HIDE_FROM_ABI
- constexpr _Tp& __emplace(_Args&& ...__args) {
- return __value_.emplace(__forward_tag{}, std::forward<_Args>(__args)...).__t_;
- }
- };
+ template <class _Fn>
+ _LIBCPP_HIDE_FROM_ABI constexpr _Tp& __emplace_from(_Fn const& __f) {
+ return __value_.emplace(__from_tag{}, __f).__t_;
+ }
+
+ template <class... _Args>
+ _LIBCPP_HIDE_FROM_ABI constexpr _Tp& __emplace(_Args&&... __args) {
+ return __value_.emplace(__forward_tag{}, std::forward<_Args>(__args)...).__t_;
+ }
+};
- struct __empty_cache { };
+struct __empty_cache {};
} // namespace ranges
#endif // _LIBCPP_STD_VER >= 20
diff --git a/contrib/llvm-project/libcxx/include/__ranges/owning_view.h b/contrib/llvm-project/libcxx/include/__ranges/owning_view.h
index c846de899b3f..254bdb432911 100644
--- a/contrib/llvm-project/libcxx/include/__ranges/owning_view.h
+++ b/contrib/llvm-project/libcxx/include/__ranges/owning_view.h
@@ -35,47 +35,75 @@ _LIBCPP_BEGIN_NAMESPACE_STD
#if _LIBCPP_STD_VER >= 20
namespace ranges {
- template<range _Rp>
- requires movable<_Rp> && (!__is_std_initializer_list<remove_cvref_t<_Rp>>)
- class owning_view : public view_interface<owning_view<_Rp>> {
- _Rp __r_ = _Rp();
+template <range _Rp>
+ requires movable<_Rp> && (!__is_std_initializer_list<remove_cvref_t<_Rp>>)
+class owning_view : public view_interface<owning_view<_Rp>> {
+ _Rp __r_ = _Rp();
public:
- _LIBCPP_HIDE_FROM_ABI owning_view() requires default_initializable<_Rp> = default;
- _LIBCPP_HIDE_FROM_ABI constexpr owning_view(_Rp&& __r) : __r_(std::move(__r)) {}
-
- _LIBCPP_HIDE_FROM_ABI owning_view(owning_view&&) = default;
- _LIBCPP_HIDE_FROM_ABI owning_view& operator=(owning_view&&) = default;
-
- _LIBCPP_HIDE_FROM_ABI constexpr _Rp& base() & noexcept { return __r_; }
- _LIBCPP_HIDE_FROM_ABI constexpr const _Rp& base() const& noexcept { return __r_; }
- _LIBCPP_HIDE_FROM_ABI constexpr _Rp&& base() && noexcept { return std::move(__r_); }
- _LIBCPP_HIDE_FROM_ABI constexpr const _Rp&& base() const&& noexcept { return std::move(__r_); }
-
- _LIBCPP_HIDE_FROM_ABI constexpr iterator_t<_Rp> begin() { return ranges::begin(__r_); }
- _LIBCPP_HIDE_FROM_ABI constexpr sentinel_t<_Rp> end() { return ranges::end(__r_); }
- _LIBCPP_HIDE_FROM_ABI constexpr auto begin() const requires range<const _Rp> { return ranges::begin(__r_); }
- _LIBCPP_HIDE_FROM_ABI constexpr auto end() const requires range<const _Rp> { return ranges::end(__r_); }
-
- _LIBCPP_HIDE_FROM_ABI constexpr bool empty() requires requires { ranges::empty(__r_); }
- { return ranges::empty(__r_); }
- _LIBCPP_HIDE_FROM_ABI constexpr bool empty() const requires requires { ranges::empty(__r_); }
- { return ranges::empty(__r_); }
-
- _LIBCPP_HIDE_FROM_ABI constexpr auto size() requires sized_range<_Rp>
- { return ranges::size(__r_); }
- _LIBCPP_HIDE_FROM_ABI constexpr auto size() const requires sized_range<const _Rp>
- { return ranges::size(__r_); }
-
- _LIBCPP_HIDE_FROM_ABI constexpr auto data() requires contiguous_range<_Rp>
- { return ranges::data(__r_); }
- _LIBCPP_HIDE_FROM_ABI constexpr auto data() const requires contiguous_range<const _Rp>
- { return ranges::data(__r_); }
- };
- _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(owning_view);
-
- template<class _Tp>
- inline constexpr bool enable_borrowed_range<owning_view<_Tp>> = enable_borrowed_range<_Tp>;
+ _LIBCPP_HIDE_FROM_ABI owning_view()
+ requires default_initializable<_Rp>
+ = default;
+ _LIBCPP_HIDE_FROM_ABI constexpr owning_view(_Rp&& __r) : __r_(std::move(__r)) {}
+
+ _LIBCPP_HIDE_FROM_ABI owning_view(owning_view&&) = default;
+ _LIBCPP_HIDE_FROM_ABI owning_view& operator=(owning_view&&) = default;
+
+ _LIBCPP_HIDE_FROM_ABI constexpr _Rp& base() & noexcept { return __r_; }
+ _LIBCPP_HIDE_FROM_ABI constexpr const _Rp& base() const& noexcept { return __r_; }
+ _LIBCPP_HIDE_FROM_ABI constexpr _Rp&& base() && noexcept { return std::move(__r_); }
+ _LIBCPP_HIDE_FROM_ABI constexpr const _Rp&& base() const&& noexcept { return std::move(__r_); }
+
+ _LIBCPP_HIDE_FROM_ABI constexpr iterator_t<_Rp> begin() { return ranges::begin(__r_); }
+ _LIBCPP_HIDE_FROM_ABI constexpr sentinel_t<_Rp> end() { return ranges::end(__r_); }
+ _LIBCPP_HIDE_FROM_ABI constexpr auto begin() const
+ requires range<const _Rp>
+ {
+ return ranges::begin(__r_);
+ }
+ _LIBCPP_HIDE_FROM_ABI constexpr auto end() const
+ requires range<const _Rp>
+ {
+ return ranges::end(__r_);
+ }
+
+ _LIBCPP_HIDE_FROM_ABI constexpr bool empty()
+ requires requires { ranges::empty(__r_); }
+ {
+ return ranges::empty(__r_);
+ }
+ _LIBCPP_HIDE_FROM_ABI constexpr bool empty() const
+ requires requires { ranges::empty(__r_); }
+ {
+ return ranges::empty(__r_);
+ }
+
+ _LIBCPP_HIDE_FROM_ABI constexpr auto size()
+ requires sized_range<_Rp>
+ {
+ return ranges::size(__r_);
+ }
+ _LIBCPP_HIDE_FROM_ABI constexpr auto size() const
+ requires sized_range<const _Rp>
+ {
+ return ranges::size(__r_);
+ }
+
+ _LIBCPP_HIDE_FROM_ABI constexpr auto data()
+ requires contiguous_range<_Rp>
+ {
+ return ranges::data(__r_);
+ }
+ _LIBCPP_HIDE_FROM_ABI constexpr auto data() const
+ requires contiguous_range<const _Rp>
+ {
+ return ranges::data(__r_);
+ }
+};
+_LIBCPP_CTAD_SUPPORTED_FOR_TYPE(owning_view);
+
+template <class _Tp>
+inline constexpr bool enable_borrowed_range<owning_view<_Tp>> = enable_borrowed_range<_Tp>;
} // namespace ranges
diff --git a/contrib/llvm-project/libcxx/include/__ranges/range_adaptor.h b/contrib/llvm-project/libcxx/include/__ranges/range_adaptor.h
index 2688e4cd0437..726b7eda019e 100644
--- a/contrib/llvm-project/libcxx/include/__ranges/range_adaptor.h
+++ b/contrib/llvm-project/libcxx/include/__ranges/range_adaptor.h
@@ -47,7 +47,7 @@ struct __range_adaptor_closure;
// i.e. something that can be called via the `x | f` notation.
template <class _Fn>
struct __range_adaptor_closure_t : _Fn, __range_adaptor_closure<__range_adaptor_closure_t<_Fn>> {
- _LIBCPP_HIDE_FROM_ABI constexpr explicit __range_adaptor_closure_t(_Fn&& __f) : _Fn(std::move(__f)) { }
+ _LIBCPP_HIDE_FROM_ABI constexpr explicit __range_adaptor_closure_t(_Fn&& __f) : _Fn(std::move(__f)) {}
};
_LIBCPP_CTAD_SUPPORTED_FOR_TYPE(__range_adaptor_closure_t);
@@ -56,23 +56,21 @@ concept _RangeAdaptorClosure = derived_from<remove_cvref_t<_Tp>, __range_adaptor
template <class _Tp>
struct __range_adaptor_closure {
- template <ranges::viewable_range _View, _RangeAdaptorClosure _Closure>
- requires same_as<_Tp, remove_cvref_t<_Closure>> &&
- invocable<_Closure, _View>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI
- friend constexpr decltype(auto) operator|(_View&& __view, _Closure&& __closure)
- noexcept(is_nothrow_invocable_v<_Closure, _View>)
- { return std::invoke(std::forward<_Closure>(__closure), std::forward<_View>(__view)); }
+ template <ranges::viewable_range _View, _RangeAdaptorClosure _Closure>
+ requires same_as<_Tp, remove_cvref_t<_Closure>> && invocable<_Closure, _View>
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI friend constexpr decltype(auto)
+ operator|(_View&& __view, _Closure&& __closure) noexcept(is_nothrow_invocable_v<_Closure, _View>) {
+ return std::invoke(std::forward<_Closure>(__closure), std::forward<_View>(__view));
+ }
- template <_RangeAdaptorClosure _Closure, _RangeAdaptorClosure _OtherClosure>
- requires same_as<_Tp, remove_cvref_t<_Closure>> &&
- constructible_from<decay_t<_Closure>, _Closure> &&
- constructible_from<decay_t<_OtherClosure>, _OtherClosure>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI
- friend constexpr auto operator|(_Closure&& __c1, _OtherClosure&& __c2)
- noexcept(is_nothrow_constructible_v<decay_t<_Closure>, _Closure> &&
- is_nothrow_constructible_v<decay_t<_OtherClosure>, _OtherClosure>)
- { return __range_adaptor_closure_t(std::__compose(std::forward<_OtherClosure>(__c2), std::forward<_Closure>(__c1))); }
+ template <_RangeAdaptorClosure _Closure, _RangeAdaptorClosure _OtherClosure>
+ requires same_as<_Tp, remove_cvref_t<_Closure>> && constructible_from<decay_t<_Closure>, _Closure> &&
+ constructible_from<decay_t<_OtherClosure>, _OtherClosure>
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI friend constexpr auto operator|(_Closure&& __c1, _OtherClosure&& __c2) noexcept(
+ is_nothrow_constructible_v<decay_t<_Closure>, _Closure> &&
+ is_nothrow_constructible_v<decay_t<_OtherClosure>, _OtherClosure>) {
+ return __range_adaptor_closure_t(std::__compose(std::forward<_OtherClosure>(__c2), std::forward<_Closure>(__c1)));
+ }
};
#endif // _LIBCPP_STD_VER >= 20
diff --git a/contrib/llvm-project/libcxx/include/__ranges/rbegin.h b/contrib/llvm-project/libcxx/include/__ranges/rbegin.h
index 1ceb1116d695..7111201ae7d6 100644
--- a/contrib/llvm-project/libcxx/include/__ranges/rbegin.h
+++ b/contrib/llvm-project/libcxx/include/__ranges/rbegin.h
@@ -36,57 +36,44 @@ _LIBCPP_BEGIN_NAMESPACE_STD
namespace ranges {
namespace __rbegin {
template <class _Tp>
-concept __member_rbegin =
- __can_borrow<_Tp> &&
- __workaround_52970<_Tp> &&
- requires(_Tp&& __t) {
- { _LIBCPP_AUTO_CAST(__t.rbegin()) } -> input_or_output_iterator;
- };
-
-void rbegin(auto&) = delete;
+concept __member_rbegin = __can_borrow<_Tp> && __workaround_52970<_Tp> && requires(_Tp&& __t) {
+ { _LIBCPP_AUTO_CAST(__t.rbegin()) } -> input_or_output_iterator;
+};
+
+void rbegin(auto&) = delete;
void rbegin(const auto&) = delete;
template <class _Tp>
concept __unqualified_rbegin =
- !__member_rbegin<_Tp> &&
- __can_borrow<_Tp> &&
- __class_or_enum<remove_cvref_t<_Tp>> &&
- requires(_Tp&& __t) {
- { _LIBCPP_AUTO_CAST(rbegin(__t)) } -> input_or_output_iterator;
- };
+ !__member_rbegin<_Tp> && __can_borrow<_Tp> && __class_or_enum<remove_cvref_t<_Tp>> && requires(_Tp&& __t) {
+ { _LIBCPP_AUTO_CAST(rbegin(__t)) } -> input_or_output_iterator;
+ };
template <class _Tp>
concept __can_reverse =
- __can_borrow<_Tp> &&
- !__member_rbegin<_Tp> &&
- !__unqualified_rbegin<_Tp> &&
- requires(_Tp&& __t) {
- { ranges::begin(__t) } -> same_as<decltype(ranges::end(__t))>;
- { ranges::begin(__t) } -> bidirectional_iterator;
- };
+ __can_borrow<_Tp> && !__member_rbegin<_Tp> && !__unqualified_rbegin<_Tp> && requires(_Tp&& __t) {
+ { ranges::begin(__t) } -> same_as<decltype(ranges::end(__t))>;
+ { ranges::begin(__t) } -> bidirectional_iterator;
+ };
struct __fn {
template <class _Tp>
requires __member_rbegin<_Tp>
[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t) const
- noexcept(noexcept(_LIBCPP_AUTO_CAST(__t.rbegin())))
- {
+ noexcept(noexcept(_LIBCPP_AUTO_CAST(__t.rbegin()))) {
return _LIBCPP_AUTO_CAST(__t.rbegin());
}
template <class _Tp>
requires __unqualified_rbegin<_Tp>
[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t) const
- noexcept(noexcept(_LIBCPP_AUTO_CAST(rbegin(__t))))
- {
+ noexcept(noexcept(_LIBCPP_AUTO_CAST(rbegin(__t)))) {
return _LIBCPP_AUTO_CAST(rbegin(__t));
}
template <class _Tp>
requires __can_reverse<_Tp>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t) const
- noexcept(noexcept(ranges::end(__t)))
- {
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t) const noexcept(noexcept(ranges::end(__t))) {
return std::make_reverse_iterator(ranges::end(__t));
}
@@ -95,7 +82,7 @@ struct __fn {
} // namespace __rbegin
inline namespace __cpo {
- inline constexpr auto rbegin = __rbegin::__fn{};
+inline constexpr auto rbegin = __rbegin::__fn{};
} // namespace __cpo
} // namespace ranges
@@ -106,24 +93,24 @@ namespace __crbegin {
struct __fn {
template <class _Tp>
requires is_lvalue_reference_v<_Tp&&>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI
- constexpr auto operator()(_Tp&& __t) const
- noexcept(noexcept(ranges::rbegin(static_cast<const remove_reference_t<_Tp>&>(__t))))
- -> decltype( ranges::rbegin(static_cast<const remove_reference_t<_Tp>&>(__t)))
- { return ranges::rbegin(static_cast<const remove_reference_t<_Tp>&>(__t)); }
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t) const
+ noexcept(noexcept(ranges::rbegin(static_cast<const remove_reference_t<_Tp>&>(__t))))
+ -> decltype(ranges::rbegin(static_cast<const remove_reference_t<_Tp>&>(__t))) {
+ return ranges::rbegin(static_cast<const remove_reference_t<_Tp>&>(__t));
+ }
template <class _Tp>
requires is_rvalue_reference_v<_Tp&&>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI
- constexpr auto operator()(_Tp&& __t) const
- noexcept(noexcept(ranges::rbegin(static_cast<const _Tp&&>(__t))))
- -> decltype( ranges::rbegin(static_cast<const _Tp&&>(__t)))
- { return ranges::rbegin(static_cast<const _Tp&&>(__t)); }
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t) const
+ noexcept(noexcept(ranges::rbegin(static_cast<const _Tp&&>(__t))))
+ -> decltype(ranges::rbegin(static_cast<const _Tp&&>(__t))) {
+ return ranges::rbegin(static_cast<const _Tp&&>(__t));
+ }
};
} // namespace __crbegin
inline namespace __cpo {
- inline constexpr auto crbegin = __crbegin::__fn{};
+inline constexpr auto crbegin = __crbegin::__fn{};
} // namespace __cpo
} // namespace ranges
diff --git a/contrib/llvm-project/libcxx/include/__ranges/ref_view.h b/contrib/llvm-project/libcxx/include/__ranges/ref_view.h
index be32b8124202..6213332a542a 100644
--- a/contrib/llvm-project/libcxx/include/__ranges/ref_view.h
+++ b/contrib/llvm-project/libcxx/include/__ranges/ref_view.h
@@ -37,49 +37,49 @@ _LIBCPP_BEGIN_NAMESPACE_STD
#if _LIBCPP_STD_VER >= 20
namespace ranges {
- template<range _Range>
- requires is_object_v<_Range>
- class ref_view : public view_interface<ref_view<_Range>> {
- _Range *__range_;
+template <range _Range>
+ requires is_object_v<_Range>
+class ref_view : public view_interface<ref_view<_Range>> {
+ _Range* __range_;
- static void __fun(_Range&);
- static void __fun(_Range&&) = delete;
+ static void __fun(_Range&);
+ static void __fun(_Range&&) = delete;
public:
- template<class _Tp>
- requires __different_from<_Tp, ref_view> &&
- convertible_to<_Tp, _Range&> && requires { __fun(std::declval<_Tp>()); }
- _LIBCPP_HIDE_FROM_ABI
- constexpr ref_view(_Tp&& __t)
- : __range_(std::addressof(static_cast<_Range&>(std::forward<_Tp>(__t))))
- {}
-
- _LIBCPP_HIDE_FROM_ABI constexpr _Range& base() const { return *__range_; }
-
- _LIBCPP_HIDE_FROM_ABI constexpr iterator_t<_Range> begin() const { return ranges::begin(*__range_); }
- _LIBCPP_HIDE_FROM_ABI constexpr sentinel_t<_Range> end() const { return ranges::end(*__range_); }
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr bool empty() const
- requires requires { ranges::empty(*__range_); }
- { return ranges::empty(*__range_); }
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr auto size() const
- requires sized_range<_Range>
- { return ranges::size(*__range_); }
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr auto data() const
- requires contiguous_range<_Range>
- { return ranges::data(*__range_); }
- };
-
- template<class _Range>
- ref_view(_Range&) -> ref_view<_Range>;
-
- template<class _Tp>
- inline constexpr bool enable_borrowed_range<ref_view<_Tp>> = true;
+ template <class _Tp>
+ requires __different_from<_Tp, ref_view> && convertible_to<_Tp, _Range&> && requires { __fun(std::declval<_Tp>()); }
+ _LIBCPP_HIDE_FROM_ABI constexpr ref_view(_Tp&& __t)
+ : __range_(std::addressof(static_cast<_Range&>(std::forward<_Tp>(__t)))) {}
+
+ _LIBCPP_HIDE_FROM_ABI constexpr _Range& base() const { return *__range_; }
+
+ _LIBCPP_HIDE_FROM_ABI constexpr iterator_t<_Range> begin() const { return ranges::begin(*__range_); }
+ _LIBCPP_HIDE_FROM_ABI constexpr sentinel_t<_Range> end() const { return ranges::end(*__range_); }
+
+ _LIBCPP_HIDE_FROM_ABI constexpr bool empty() const
+ requires requires { ranges::empty(*__range_); }
+ {
+ return ranges::empty(*__range_);
+ }
+
+ _LIBCPP_HIDE_FROM_ABI constexpr auto size() const
+ requires sized_range<_Range>
+ {
+ return ranges::size(*__range_);
+ }
+
+ _LIBCPP_HIDE_FROM_ABI constexpr auto data() const
+ requires contiguous_range<_Range>
+ {
+ return ranges::data(*__range_);
+ }
+};
+
+template <class _Range>
+ref_view(_Range&) -> ref_view<_Range>;
+
+template <class _Tp>
+inline constexpr bool enable_borrowed_range<ref_view<_Tp>> = true;
} // namespace ranges
#endif // _LIBCPP_STD_VER >= 20
diff --git a/contrib/llvm-project/libcxx/include/__ranges/rend.h b/contrib/llvm-project/libcxx/include/__ranges/rend.h
index 7ee574ccfa67..58d98aafd264 100644
--- a/contrib/llvm-project/libcxx/include/__ranges/rend.h
+++ b/contrib/llvm-project/libcxx/include/__ranges/rend.h
@@ -37,60 +37,47 @@ _LIBCPP_BEGIN_NAMESPACE_STD
namespace ranges {
namespace __rend {
template <class _Tp>
-concept __member_rend =
- __can_borrow<_Tp> &&
- __workaround_52970<_Tp> &&
- requires(_Tp&& __t) {
- ranges::rbegin(__t);
- { _LIBCPP_AUTO_CAST(__t.rend()) } -> sentinel_for<decltype(ranges::rbegin(__t))>;
- };
-
-void rend(auto&) = delete;
+concept __member_rend = __can_borrow<_Tp> && __workaround_52970<_Tp> && requires(_Tp&& __t) {
+ ranges::rbegin(__t);
+ { _LIBCPP_AUTO_CAST(__t.rend()) } -> sentinel_for<decltype(ranges::rbegin(__t))>;
+};
+
+void rend(auto&) = delete;
void rend(const auto&) = delete;
template <class _Tp>
concept __unqualified_rend =
- !__member_rend<_Tp> &&
- __can_borrow<_Tp> &&
- __class_or_enum<remove_cvref_t<_Tp>> &&
- requires(_Tp&& __t) {
- ranges::rbegin(__t);
- { _LIBCPP_AUTO_CAST(rend(__t)) } -> sentinel_for<decltype(ranges::rbegin(__t))>;
- };
+ !__member_rend<_Tp> && __can_borrow<_Tp> && __class_or_enum<remove_cvref_t<_Tp>> && requires(_Tp&& __t) {
+ ranges::rbegin(__t);
+ { _LIBCPP_AUTO_CAST(rend(__t)) } -> sentinel_for<decltype(ranges::rbegin(__t))>;
+ };
template <class _Tp>
-concept __can_reverse =
- __can_borrow<_Tp> &&
- !__member_rend<_Tp> &&
- !__unqualified_rend<_Tp> &&
- requires(_Tp&& __t) {
- { ranges::begin(__t) } -> same_as<decltype(ranges::end(__t))>;
- { ranges::begin(__t) } -> bidirectional_iterator;
- };
+concept __can_reverse = __can_borrow<_Tp> && !__member_rend<_Tp> && !__unqualified_rend<_Tp> && requires(_Tp&& __t) {
+ { ranges::begin(__t) } -> same_as<decltype(ranges::end(__t))>;
+ { ranges::begin(__t) } -> bidirectional_iterator;
+};
class __fn {
public:
template <class _Tp>
requires __member_rend<_Tp>
[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t) const
- noexcept(noexcept(_LIBCPP_AUTO_CAST(__t.rend())))
- {
+ noexcept(noexcept(_LIBCPP_AUTO_CAST(__t.rend()))) {
return _LIBCPP_AUTO_CAST(__t.rend());
}
template <class _Tp>
requires __unqualified_rend<_Tp>
[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t) const
- noexcept(noexcept(_LIBCPP_AUTO_CAST(rend(__t))))
- {
+ noexcept(noexcept(_LIBCPP_AUTO_CAST(rend(__t)))) {
return _LIBCPP_AUTO_CAST(rend(__t));
}
template <class _Tp>
requires __can_reverse<_Tp>
[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t) const
- noexcept(noexcept(ranges::begin(__t)))
- {
+ noexcept(noexcept(ranges::begin(__t))) {
return std::make_reverse_iterator(ranges::begin(__t));
}
@@ -99,7 +86,7 @@ public:
} // namespace __rend
inline namespace __cpo {
- inline constexpr auto rend = __rend::__fn{};
+inline constexpr auto rend = __rend::__fn{};
} // namespace __cpo
} // namespace ranges
@@ -110,24 +97,24 @@ namespace __crend {
struct __fn {
template <class _Tp>
requires is_lvalue_reference_v<_Tp&&>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI
- constexpr auto operator()(_Tp&& __t) const
- noexcept(noexcept(ranges::rend(static_cast<const remove_reference_t<_Tp>&>(__t))))
- -> decltype( ranges::rend(static_cast<const remove_reference_t<_Tp>&>(__t)))
- { return ranges::rend(static_cast<const remove_reference_t<_Tp>&>(__t)); }
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t) const
+ noexcept(noexcept(ranges::rend(static_cast<const remove_reference_t<_Tp>&>(__t))))
+ -> decltype(ranges::rend(static_cast<const remove_reference_t<_Tp>&>(__t))) {
+ return ranges::rend(static_cast<const remove_reference_t<_Tp>&>(__t));
+ }
template <class _Tp>
requires is_rvalue_reference_v<_Tp&&>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI
- constexpr auto operator()(_Tp&& __t) const
- noexcept(noexcept(ranges::rend(static_cast<const _Tp&&>(__t))))
- -> decltype( ranges::rend(static_cast<const _Tp&&>(__t)))
- { return ranges::rend(static_cast<const _Tp&&>(__t)); }
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t) const
+ noexcept(noexcept(ranges::rend(static_cast<const _Tp&&>(__t))))
+ -> decltype(ranges::rend(static_cast<const _Tp&&>(__t))) {
+ return ranges::rend(static_cast<const _Tp&&>(__t));
+ }
};
} // namespace __crend
inline namespace __cpo {
- inline constexpr auto crend = __crend::__fn{};
+inline constexpr auto crend = __crend::__fn{};
} // namespace __cpo
} // namespace ranges
diff --git a/contrib/llvm-project/libcxx/include/__ranges/reverse_view.h b/contrib/llvm-project/libcxx/include/__ranges/reverse_view.h
index 01d1b97b3ce2..f7846259810c 100644
--- a/contrib/llvm-project/libcxx/include/__ranges/reverse_view.h
+++ b/contrib/llvm-project/libcxx/include/__ranges/reverse_view.h
@@ -38,151 +38,158 @@ _LIBCPP_BEGIN_NAMESPACE_STD
#if _LIBCPP_STD_VER >= 20
namespace ranges {
- template<view _View>
- requires bidirectional_range<_View>
- class reverse_view : public view_interface<reverse_view<_View>> {
- // We cache begin() whenever ranges::next is not guaranteed O(1) to provide an
- // amortized O(1) begin() method.
- static constexpr bool _UseCache = !random_access_range<_View> && !common_range<_View>;
- using _Cache = _If<_UseCache, __non_propagating_cache<reverse_iterator<iterator_t<_View>>>, __empty_cache>;
- _LIBCPP_NO_UNIQUE_ADDRESS _Cache __cached_begin_ = _Cache();
- _LIBCPP_NO_UNIQUE_ADDRESS _View __base_ = _View();
-
- public:
- _LIBCPP_HIDE_FROM_ABI
- reverse_view() requires default_initializable<_View> = default;
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr explicit reverse_view(_View __view) : __base_(std::move(__view)) {}
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr _View base() const& requires copy_constructible<_View> { return __base_; }
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr _View base() && { return std::move(__base_); }
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr reverse_iterator<iterator_t<_View>> begin() {
- if constexpr (_UseCache)
- if (__cached_begin_.__has_value())
- return *__cached_begin_;
-
- auto __tmp = std::make_reverse_iterator(ranges::next(ranges::begin(__base_), ranges::end(__base_)));
- if constexpr (_UseCache)
- __cached_begin_.__emplace(__tmp);
- return __tmp;
- }
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr reverse_iterator<iterator_t<_View>> begin() requires common_range<_View> {
- return std::make_reverse_iterator(ranges::end(__base_));
- }
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr auto begin() const requires common_range<const _View> {
- return std::make_reverse_iterator(ranges::end(__base_));
- }
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr reverse_iterator<iterator_t<_View>> end() {
- return std::make_reverse_iterator(ranges::begin(__base_));
- }
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr auto end() const requires common_range<const _View> {
- return std::make_reverse_iterator(ranges::begin(__base_));
- }
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr auto size() requires sized_range<_View> {
- return ranges::size(__base_);
- }
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr auto size() const requires sized_range<const _View> {
- return ranges::size(__base_);
- }
- };
-
- template<class _Range>
- reverse_view(_Range&&) -> reverse_view<views::all_t<_Range>>;
-
- template<class _Tp>
- inline constexpr bool enable_borrowed_range<reverse_view<_Tp>> = enable_borrowed_range<_Tp>;
-
- namespace views {
- namespace __reverse {
- template<class _Tp>
- inline constexpr bool __is_reverse_view = false;
-
- template<class _Tp>
- inline constexpr bool __is_reverse_view<reverse_view<_Tp>> = true;
-
- template<class _Tp>
- inline constexpr bool __is_sized_reverse_subrange = false;
-
- template<class _Iter>
- inline constexpr bool __is_sized_reverse_subrange<subrange<reverse_iterator<_Iter>, reverse_iterator<_Iter>, subrange_kind::sized>> = true;
-
- template<class _Tp>
- inline constexpr bool __is_unsized_reverse_subrange = false;
-
- template<class _Iter, subrange_kind _Kind>
- inline constexpr bool __is_unsized_reverse_subrange<subrange<reverse_iterator<_Iter>, reverse_iterator<_Iter>, _Kind>> = _Kind == subrange_kind::unsized;
-
- template<class _Tp>
- struct __unwrapped_reverse_subrange {
- using type = void; // avoid SFINAE-ing out the overload below -- let the concept requirements do it for better diagnostics
- };
-
- template<class _Iter, subrange_kind _Kind>
- struct __unwrapped_reverse_subrange<subrange<reverse_iterator<_Iter>, reverse_iterator<_Iter>, _Kind>> {
- using type = subrange<_Iter, _Iter, _Kind>;
- };
-
- struct __fn : __range_adaptor_closure<__fn> {
- template<class _Range>
- requires __is_reverse_view<remove_cvref_t<_Range>>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI
- constexpr auto operator()(_Range&& __range) const
- noexcept(noexcept(std::forward<_Range>(__range).base()))
- -> decltype( std::forward<_Range>(__range).base())
- { return std::forward<_Range>(__range).base(); }
-
- template<class _Range,
- class _UnwrappedSubrange = typename __unwrapped_reverse_subrange<remove_cvref_t<_Range>>::type>
- requires __is_sized_reverse_subrange<remove_cvref_t<_Range>>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI
- constexpr auto operator()(_Range&& __range) const
- noexcept(noexcept(_UnwrappedSubrange(__range.end().base(), __range.begin().base(), __range.size())))
- -> decltype( _UnwrappedSubrange(__range.end().base(), __range.begin().base(), __range.size()))
- { return _UnwrappedSubrange(__range.end().base(), __range.begin().base(), __range.size()); }
-
- template<class _Range,
- class _UnwrappedSubrange = typename __unwrapped_reverse_subrange<remove_cvref_t<_Range>>::type>
- requires __is_unsized_reverse_subrange<remove_cvref_t<_Range>>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI
- constexpr auto operator()(_Range&& __range) const
- noexcept(noexcept(_UnwrappedSubrange(__range.end().base(), __range.begin().base())))
- -> decltype( _UnwrappedSubrange(__range.end().base(), __range.begin().base()))
- { return _UnwrappedSubrange(__range.end().base(), __range.begin().base()); }
-
- template<class _Range>
- requires (!__is_reverse_view<remove_cvref_t<_Range>> &&
- !__is_sized_reverse_subrange<remove_cvref_t<_Range>> &&
- !__is_unsized_reverse_subrange<remove_cvref_t<_Range>>)
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI
- constexpr auto operator()(_Range&& __range) const
- noexcept(noexcept(reverse_view{std::forward<_Range>(__range)}))
- -> decltype( reverse_view{std::forward<_Range>(__range)})
- { return reverse_view{std::forward<_Range>(__range)}; }
- };
- } // namespace __reverse
-
- inline namespace __cpo {
- inline constexpr auto reverse = __reverse::__fn{};
- } // namespace __cpo
- } // namespace views
+template <view _View>
+ requires bidirectional_range<_View>
+class reverse_view : public view_interface<reverse_view<_View>> {
+ // We cache begin() whenever ranges::next is not guaranteed O(1) to provide an
+ // amortized O(1) begin() method.
+ static constexpr bool _UseCache = !random_access_range<_View> && !common_range<_View>;
+ using _Cache = _If<_UseCache, __non_propagating_cache<reverse_iterator<iterator_t<_View>>>, __empty_cache>;
+ _LIBCPP_NO_UNIQUE_ADDRESS _Cache __cached_begin_ = _Cache();
+ _LIBCPP_NO_UNIQUE_ADDRESS _View __base_ = _View();
+
+public:
+ _LIBCPP_HIDE_FROM_ABI reverse_view()
+ requires default_initializable<_View>
+ = default;
+
+ _LIBCPP_HIDE_FROM_ABI constexpr explicit reverse_view(_View __view) : __base_(std::move(__view)) {}
+
+ _LIBCPP_HIDE_FROM_ABI constexpr _View base() const&
+ requires copy_constructible<_View>
+ {
+ return __base_;
+ }
+
+ _LIBCPP_HIDE_FROM_ABI constexpr _View base() && { return std::move(__base_); }
+
+ _LIBCPP_HIDE_FROM_ABI constexpr reverse_iterator<iterator_t<_View>> begin() {
+ if constexpr (_UseCache)
+ if (__cached_begin_.__has_value())
+ return *__cached_begin_;
+
+ auto __tmp = std::make_reverse_iterator(ranges::next(ranges::begin(__base_), ranges::end(__base_)));
+ if constexpr (_UseCache)
+ __cached_begin_.__emplace(__tmp);
+ return __tmp;
+ }
+
+ _LIBCPP_HIDE_FROM_ABI constexpr reverse_iterator<iterator_t<_View>> begin()
+ requires common_range<_View>
+ {
+ return std::make_reverse_iterator(ranges::end(__base_));
+ }
+
+ _LIBCPP_HIDE_FROM_ABI constexpr auto begin() const
+ requires common_range<const _View>
+ {
+ return std::make_reverse_iterator(ranges::end(__base_));
+ }
+
+ _LIBCPP_HIDE_FROM_ABI constexpr reverse_iterator<iterator_t<_View>> end() {
+ return std::make_reverse_iterator(ranges::begin(__base_));
+ }
+
+ _LIBCPP_HIDE_FROM_ABI constexpr auto end() const
+ requires common_range<const _View>
+ {
+ return std::make_reverse_iterator(ranges::begin(__base_));
+ }
+
+ _LIBCPP_HIDE_FROM_ABI constexpr auto size()
+ requires sized_range<_View>
+ {
+ return ranges::size(__base_);
+ }
+
+ _LIBCPP_HIDE_FROM_ABI constexpr auto size() const
+ requires sized_range<const _View>
+ {
+ return ranges::size(__base_);
+ }
+};
+
+template <class _Range>
+reverse_view(_Range&&) -> reverse_view<views::all_t<_Range>>;
+
+template <class _Tp>
+inline constexpr bool enable_borrowed_range<reverse_view<_Tp>> = enable_borrowed_range<_Tp>;
+
+namespace views {
+namespace __reverse {
+template <class _Tp>
+inline constexpr bool __is_reverse_view = false;
+
+template <class _Tp>
+inline constexpr bool __is_reverse_view<reverse_view<_Tp>> = true;
+
+template <class _Tp>
+inline constexpr bool __is_sized_reverse_subrange = false;
+
+template <class _Iter>
+inline constexpr bool
+ __is_sized_reverse_subrange<subrange<reverse_iterator<_Iter>, reverse_iterator<_Iter>, subrange_kind::sized>> =
+ true;
+
+template <class _Tp>
+inline constexpr bool __is_unsized_reverse_subrange = false;
+
+template <class _Iter, subrange_kind _Kind>
+inline constexpr bool __is_unsized_reverse_subrange<subrange<reverse_iterator<_Iter>, reverse_iterator<_Iter>, _Kind>> =
+ _Kind == subrange_kind::unsized;
+
+template <class _Tp>
+struct __unwrapped_reverse_subrange {
+ using type =
+ void; // avoid SFINAE-ing out the overload below -- let the concept requirements do it for better diagnostics
+};
+
+template <class _Iter, subrange_kind _Kind>
+struct __unwrapped_reverse_subrange<subrange<reverse_iterator<_Iter>, reverse_iterator<_Iter>, _Kind>> {
+ using type = subrange<_Iter, _Iter, _Kind>;
+};
+
+struct __fn : __range_adaptor_closure<__fn> {
+ template <class _Range>
+ requires __is_reverse_view<remove_cvref_t<_Range>>
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Range&& __range) const
+ noexcept(noexcept(std::forward<_Range>(__range).base())) -> decltype(std::forward<_Range>(__range).base()) {
+ return std::forward<_Range>(__range).base();
+ }
+
+ template <class _Range,
+ class _UnwrappedSubrange = typename __unwrapped_reverse_subrange<remove_cvref_t<_Range>>::type>
+ requires __is_sized_reverse_subrange<remove_cvref_t<_Range>>
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Range&& __range) const
+ noexcept(noexcept(_UnwrappedSubrange(__range.end().base(), __range.begin().base(), __range.size())))
+ -> decltype(_UnwrappedSubrange(__range.end().base(), __range.begin().base(), __range.size())) {
+ return _UnwrappedSubrange(__range.end().base(), __range.begin().base(), __range.size());
+ }
+
+ template <class _Range,
+ class _UnwrappedSubrange = typename __unwrapped_reverse_subrange<remove_cvref_t<_Range>>::type>
+ requires __is_unsized_reverse_subrange<remove_cvref_t<_Range>>
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Range&& __range) const
+ noexcept(noexcept(_UnwrappedSubrange(__range.end().base(), __range.begin().base())))
+ -> decltype(_UnwrappedSubrange(__range.end().base(), __range.begin().base())) {
+ return _UnwrappedSubrange(__range.end().base(), __range.begin().base());
+ }
+
+ template <class _Range>
+ requires(!__is_reverse_view<remove_cvref_t<_Range>> && !__is_sized_reverse_subrange<remove_cvref_t<_Range>> &&
+ !__is_unsized_reverse_subrange<remove_cvref_t<_Range>>)
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Range&& __range) const
+ noexcept(noexcept(reverse_view{std::forward<_Range>(__range)}))
+ -> decltype(reverse_view{std::forward<_Range>(__range)}) {
+ return reverse_view{std::forward<_Range>(__range)};
+ }
+};
+} // namespace __reverse
+
+inline namespace __cpo {
+inline constexpr auto reverse = __reverse::__fn{};
+} // namespace __cpo
+} // namespace views
} // namespace ranges
#endif // _LIBCPP_STD_VER >= 20
diff --git a/contrib/llvm-project/libcxx/include/__ranges/single_view.h b/contrib/llvm-project/libcxx/include/__ranges/single_view.h
index 5724e2d1b6d5..b0b2c1d9f3c0 100644
--- a/contrib/llvm-project/libcxx/include/__ranges/single_view.h
+++ b/contrib/llvm-project/libcxx/include/__ranges/single_view.h
@@ -74,24 +74,24 @@ public:
_LIBCPP_HIDE_FROM_ABI constexpr const _Tp* data() const noexcept { return __value_.operator->(); }
};
-template<class _Tp>
+template <class _Tp>
single_view(_Tp) -> single_view<_Tp>;
namespace views {
namespace __single_view {
struct __fn : __range_adaptor_closure<__fn> {
- template<class _Range>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI
- constexpr auto operator()(_Range&& __range) const
- noexcept(noexcept(single_view<decay_t<_Range&&>>(std::forward<_Range>(__range))))
- -> decltype( single_view<decay_t<_Range&&>>(std::forward<_Range>(__range)))
- { return single_view<decay_t<_Range&&>>(std::forward<_Range>(__range)); }
+ template <class _Range>
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Range&& __range) const
+ noexcept(noexcept(single_view<decay_t<_Range&&>>(std::forward<_Range>(__range))))
+ -> decltype(single_view<decay_t<_Range&&>>(std::forward<_Range>(__range))) {
+ return single_view<decay_t<_Range&&>>(std::forward<_Range>(__range));
+ }
};
} // namespace __single_view
inline namespace __cpo {
- inline constexpr auto single = __single_view::__fn{};
+inline constexpr auto single = __single_view::__fn{};
} // namespace __cpo
} // namespace views
diff --git a/contrib/llvm-project/libcxx/include/__ranges/size.h b/contrib/llvm-project/libcxx/include/__ranges/size.h
index f22dd1ff7b79..14e21aae6bf1 100644
--- a/contrib/llvm-project/libcxx/include/__ranges/size.h
+++ b/contrib/llvm-project/libcxx/include/__ranges/size.h
@@ -33,49 +33,39 @@ _LIBCPP_BEGIN_NAMESPACE_STD
#if _LIBCPP_STD_VER >= 20
namespace ranges {
- template<class>
- inline constexpr bool disable_sized_range = false;
+template <class>
+inline constexpr bool disable_sized_range = false;
} // namespace ranges
// [range.prim.size]
namespace ranges {
namespace __size {
-void size(auto&) = delete;
+void size(auto&) = delete;
void size(const auto&) = delete;
template <class _Tp>
concept __size_enabled = !disable_sized_range<remove_cvref_t<_Tp>>;
template <class _Tp>
-concept __member_size =
- __size_enabled<_Tp> &&
- __workaround_52970<_Tp> &&
- requires(_Tp&& __t) {
- { _LIBCPP_AUTO_CAST(__t.size()) } -> __integer_like;
- };
+concept __member_size = __size_enabled<_Tp> && __workaround_52970<_Tp> && requires(_Tp&& __t) {
+ { _LIBCPP_AUTO_CAST(__t.size()) } -> __integer_like;
+};
template <class _Tp>
concept __unqualified_size =
- __size_enabled<_Tp> &&
- !__member_size<_Tp> &&
- __class_or_enum<remove_cvref_t<_Tp>> &&
- requires(_Tp&& __t) {
- { _LIBCPP_AUTO_CAST(size(__t)) } -> __integer_like;
- };
+ __size_enabled<_Tp> && !__member_size<_Tp> && __class_or_enum<remove_cvref_t<_Tp>> && requires(_Tp&& __t) {
+ { _LIBCPP_AUTO_CAST(size(__t)) } -> __integer_like;
+ };
template <class _Tp>
concept __difference =
- !__member_size<_Tp> &&
- !__unqualified_size<_Tp> &&
- __class_or_enum<remove_cvref_t<_Tp>> &&
- requires(_Tp&& __t) {
- { ranges::begin(__t) } -> forward_iterator;
- { ranges::end(__t) } -> sized_sentinel_for<decltype(ranges::begin(std::declval<_Tp>()))>;
- };
+ !__member_size<_Tp> && !__unqualified_size<_Tp> && __class_or_enum<remove_cvref_t<_Tp>> && requires(_Tp&& __t) {
+ { ranges::begin(__t) } -> forward_iterator;
+ { ranges::end(__t) } -> sized_sentinel_for<decltype(ranges::begin(std::declval<_Tp>()))>;
+ };
struct __fn {
-
// `[range.prim.size]`: the array case (for rvalues).
template <class _Tp, size_t _Sz>
[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr size_t operator()(_Tp (&&)[_Sz]) const noexcept {
@@ -105,16 +95,16 @@ struct __fn {
// [range.prim.size]: the `to-unsigned-like` case.
template <__difference _Tp>
[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t) const
- noexcept(noexcept(std::__to_unsigned_like(ranges::end(__t) - ranges::begin(__t))))
- -> decltype( std::__to_unsigned_like(ranges::end(__t) - ranges::begin(__t)))
- { return std::__to_unsigned_like(ranges::end(__t) - ranges::begin(__t));
+ noexcept(noexcept(std::__to_unsigned_like(ranges::end(__t) - ranges::begin(__t))))
+ -> decltype(std::__to_unsigned_like(ranges::end(__t) - ranges::begin(__t))) {
+ return std::__to_unsigned_like(ranges::end(__t) - ranges::begin(__t));
}
};
} // namespace __size
inline namespace __cpo {
- inline constexpr auto size = __size::__fn{};
+inline constexpr auto size = __size::__fn{};
} // namespace __cpo
} // namespace ranges
@@ -123,10 +113,10 @@ inline namespace __cpo {
namespace ranges {
namespace __ssize {
struct __fn {
- template<class _Tp>
- requires requires (_Tp&& __t) { ranges::size(__t); }
+ template <class _Tp>
+ requires requires(_Tp&& __t) { ranges::size(__t); }
[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr integral auto operator()(_Tp&& __t) const
- noexcept(noexcept(ranges::size(__t))) {
+ noexcept(noexcept(ranges::size(__t))) {
using _Signed = make_signed_t<decltype(ranges::size(__t))>;
if constexpr (sizeof(ptrdiff_t) > sizeof(_Signed))
return static_cast<ptrdiff_t>(ranges::size(__t));
@@ -137,7 +127,7 @@ struct __fn {
} // namespace __ssize
inline namespace __cpo {
- inline constexpr auto ssize = __ssize::__fn{};
+inline constexpr auto ssize = __ssize::__fn{};
} // namespace __cpo
} // namespace ranges
diff --git a/contrib/llvm-project/libcxx/include/__ranges/subrange.h b/contrib/llvm-project/libcxx/include/__ranges/subrange.h
index 75f9284a582f..a41978275b78 100644
--- a/contrib/llvm-project/libcxx/include/__ranges/subrange.h
+++ b/contrib/llvm-project/libcxx/include/__ranges/subrange.h
@@ -54,208 +54,188 @@ _LIBCPP_BEGIN_NAMESPACE_STD
#if _LIBCPP_STD_VER >= 20
namespace ranges {
- template<class _From, class _To>
- concept __uses_nonqualification_pointer_conversion =
+template <class _From, class _To>
+concept __uses_nonqualification_pointer_conversion =
is_pointer_v<_From> && is_pointer_v<_To> &&
- !convertible_to<remove_pointer_t<_From>(*)[], remove_pointer_t<_To>(*)[]>;
-
- template<class _From, class _To>
- concept __convertible_to_non_slicing =
- convertible_to<_From, _To> &&
- !__uses_nonqualification_pointer_conversion<decay_t<_From>, decay_t<_To>>;
-
- template<class _Pair, class _Iter, class _Sent>
- concept __pair_like_convertible_from =
- !range<_Pair> && __pair_like<_Pair> &&
- constructible_from<_Pair, _Iter, _Sent> &&
- __convertible_to_non_slicing<_Iter, tuple_element_t<0, _Pair>> &&
- convertible_to<_Sent, tuple_element_t<1, _Pair>>;
-
- template<input_or_output_iterator _Iter, sentinel_for<_Iter> _Sent = _Iter,
- subrange_kind _Kind = sized_sentinel_for<_Sent, _Iter>
- ? subrange_kind::sized
- : subrange_kind::unsized>
- requires (_Kind == subrange_kind::sized || !sized_sentinel_for<_Sent, _Iter>)
- class _LIBCPP_TEMPLATE_VIS subrange
- : public view_interface<subrange<_Iter, _Sent, _Kind>>
- {
- public:
- // Note: this is an internal implementation detail that is public only for internal usage.
- static constexpr bool _StoreSize = (_Kind == subrange_kind::sized && !sized_sentinel_for<_Sent, _Iter>);
-
- private:
- static constexpr bool _MustProvideSizeAtConstruction = !_StoreSize; // just to improve compiler diagnostics
- struct _Empty { _LIBCPP_HIDE_FROM_ABI constexpr _Empty(auto) noexcept { } };
- using _Size = conditional_t<_StoreSize, make_unsigned_t<iter_difference_t<_Iter>>, _Empty>;
- _LIBCPP_NO_UNIQUE_ADDRESS _Iter __begin_ = _Iter();
- _LIBCPP_NO_UNIQUE_ADDRESS _Sent __end_ = _Sent();
- _LIBCPP_NO_UNIQUE_ADDRESS _Size __size_ = 0;
-
- public:
- _LIBCPP_HIDE_FROM_ABI
- subrange() requires default_initializable<_Iter> = default;
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr subrange(__convertible_to_non_slicing<_Iter> auto __iter, _Sent __sent)
- requires _MustProvideSizeAtConstruction
- : __begin_(std::move(__iter)), __end_(std::move(__sent))
- { }
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr subrange(__convertible_to_non_slicing<_Iter> auto __iter, _Sent __sent,
- make_unsigned_t<iter_difference_t<_Iter>> __n)
- requires (_Kind == subrange_kind::sized)
- : __begin_(std::move(__iter)), __end_(std::move(__sent)), __size_(__n)
- {
- if constexpr (sized_sentinel_for<_Sent, _Iter>)
- _LIBCPP_ASSERT_UNCATEGORIZED((__end_ - __begin_) == static_cast<iter_difference_t<_Iter>>(__n),
- "std::ranges::subrange was passed an invalid size hint");
- }
+ !convertible_to<remove_pointer_t<_From> (*)[], remove_pointer_t<_To> (*)[]>;
+
+template <class _From, class _To>
+concept __convertible_to_non_slicing =
+ convertible_to<_From, _To> && !__uses_nonqualification_pointer_conversion<decay_t<_From>, decay_t<_To>>;
+
+template <class _Pair, class _Iter, class _Sent>
+concept __pair_like_convertible_from =
+ !range<_Pair> && __pair_like<_Pair> && constructible_from<_Pair, _Iter, _Sent> &&
+ __convertible_to_non_slicing<_Iter, tuple_element_t<0, _Pair>> && convertible_to<_Sent, tuple_element_t<1, _Pair>>;
+
+template <input_or_output_iterator _Iter,
+ sentinel_for<_Iter> _Sent = _Iter,
+ subrange_kind _Kind = sized_sentinel_for<_Sent, _Iter> ? subrange_kind::sized : subrange_kind::unsized>
+ requires(_Kind == subrange_kind::sized || !sized_sentinel_for<_Sent, _Iter>)
+class _LIBCPP_TEMPLATE_VIS subrange : public view_interface<subrange<_Iter, _Sent, _Kind>> {
+public:
+ // Note: this is an internal implementation detail that is public only for internal usage.
+ static constexpr bool _StoreSize = (_Kind == subrange_kind::sized && !sized_sentinel_for<_Sent, _Iter>);
+
+private:
+ static constexpr bool _MustProvideSizeAtConstruction = !_StoreSize; // just to improve compiler diagnostics
+ struct _Empty {
+ _LIBCPP_HIDE_FROM_ABI constexpr _Empty(auto) noexcept {}
+ };
+ using _Size = conditional_t<_StoreSize, make_unsigned_t<iter_difference_t<_Iter>>, _Empty>;
+ _LIBCPP_NO_UNIQUE_ADDRESS _Iter __begin_ = _Iter();
+ _LIBCPP_NO_UNIQUE_ADDRESS _Sent __end_ = _Sent();
+ _LIBCPP_NO_UNIQUE_ADDRESS _Size __size_ = 0;
+
+public:
+ _LIBCPP_HIDE_FROM_ABI subrange()
+ requires default_initializable<_Iter>
+ = default;
+
+ _LIBCPP_HIDE_FROM_ABI constexpr subrange(__convertible_to_non_slicing<_Iter> auto __iter, _Sent __sent)
+ requires _MustProvideSizeAtConstruction
+ : __begin_(std::move(__iter)), __end_(std::move(__sent)) {}
+
+ _LIBCPP_HIDE_FROM_ABI constexpr subrange(
+ __convertible_to_non_slicing<_Iter> auto __iter, _Sent __sent, make_unsigned_t<iter_difference_t<_Iter>> __n)
+ requires(_Kind == subrange_kind::sized)
+ : __begin_(std::move(__iter)), __end_(std::move(__sent)), __size_(__n) {
+ if constexpr (sized_sentinel_for<_Sent, _Iter>)
+ _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS((__end_ - __begin_) == static_cast<iter_difference_t<_Iter>>(__n),
+ "std::ranges::subrange was passed an invalid size hint");
+ }
- template<__different_from<subrange> _Range>
- requires borrowed_range<_Range> &&
- __convertible_to_non_slicing<iterator_t<_Range>, _Iter> &&
- convertible_to<sentinel_t<_Range>, _Sent>
- _LIBCPP_HIDE_FROM_ABI
- constexpr subrange(_Range&& __range)
- requires (!_StoreSize)
- : subrange(ranges::begin(__range), ranges::end(__range))
- { }
-
- template<__different_from<subrange> _Range>
- requires borrowed_range<_Range> &&
- __convertible_to_non_slicing<iterator_t<_Range>, _Iter> &&
- convertible_to<sentinel_t<_Range>, _Sent>
- _LIBCPP_HIDE_FROM_ABI
- constexpr subrange(_Range&& __range)
- requires _StoreSize && sized_range<_Range>
- : subrange(__range, ranges::size(__range))
- { }
-
- template<borrowed_range _Range>
- requires __convertible_to_non_slicing<iterator_t<_Range>, _Iter> &&
- convertible_to<sentinel_t<_Range>, _Sent>
- _LIBCPP_HIDE_FROM_ABI
- constexpr subrange(_Range&& __range, make_unsigned_t<iter_difference_t<_Iter>> __n)
- requires (_Kind == subrange_kind::sized)
- : subrange(ranges::begin(__range), ranges::end(__range), __n)
- { }
-
- template<__different_from<subrange> _Pair>
- requires __pair_like_convertible_from<_Pair, const _Iter&, const _Sent&>
- _LIBCPP_HIDE_FROM_ABI
- constexpr operator _Pair() const {
- return _Pair(__begin_, __end_);
- }
+ template <__different_from<subrange> _Range>
+ requires borrowed_range<_Range> && __convertible_to_non_slicing<iterator_t<_Range>, _Iter> &&
+ convertible_to<sentinel_t<_Range>, _Sent>
+ _LIBCPP_HIDE_FROM_ABI constexpr subrange(_Range&& __range)
+ requires(!_StoreSize)
+ : subrange(ranges::begin(__range), ranges::end(__range)) {}
+
+ template <__different_from<subrange> _Range>
+ requires borrowed_range<_Range> && __convertible_to_non_slicing<iterator_t<_Range>, _Iter> &&
+ convertible_to<sentinel_t<_Range>, _Sent>
+ _LIBCPP_HIDE_FROM_ABI constexpr subrange(_Range&& __range)
+ requires _StoreSize && sized_range<_Range>
+ : subrange(__range, ranges::size(__range)) {}
+
+ template <borrowed_range _Range>
+ requires __convertible_to_non_slicing<iterator_t<_Range>, _Iter> &&
+ convertible_to<sentinel_t<_Range>, _Sent>
+ _LIBCPP_HIDE_FROM_ABI constexpr subrange(_Range&& __range, make_unsigned_t<iter_difference_t<_Iter>> __n)
+ requires(_Kind == subrange_kind::sized)
+ : subrange(ranges::begin(__range), ranges::end(__range), __n) {}
+
+ template <__different_from<subrange> _Pair>
+ requires __pair_like_convertible_from<_Pair, const _Iter&, const _Sent&>
+ _LIBCPP_HIDE_FROM_ABI constexpr operator _Pair() const {
+ return _Pair(__begin_, __end_);
+ }
- _LIBCPP_HIDE_FROM_ABI
- constexpr _Iter begin() const requires copyable<_Iter> {
- return __begin_;
- }
+ _LIBCPP_HIDE_FROM_ABI constexpr _Iter begin() const
+ requires copyable<_Iter>
+ {
+ return __begin_;
+ }
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _Iter begin() requires (!copyable<_Iter>) {
- return std::move(__begin_);
- }
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _Iter begin()
+ requires(!copyable<_Iter>)
+ {
+ return std::move(__begin_);
+ }
- _LIBCPP_HIDE_FROM_ABI
- constexpr _Sent end() const {
- return __end_;
- }
+ _LIBCPP_HIDE_FROM_ABI constexpr _Sent end() const { return __end_; }
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool empty() const {
- return __begin_ == __end_;
- }
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool empty() const { return __begin_ == __end_; }
- _LIBCPP_HIDE_FROM_ABI
- constexpr make_unsigned_t<iter_difference_t<_Iter>> size() const
- requires (_Kind == subrange_kind::sized)
- {
- if constexpr (_StoreSize)
- return __size_;
- else
- return std::__to_unsigned_like(__end_ - __begin_);
- }
+ _LIBCPP_HIDE_FROM_ABI constexpr make_unsigned_t<iter_difference_t<_Iter>> size() const
+ requires(_Kind == subrange_kind::sized)
+ {
+ if constexpr (_StoreSize)
+ return __size_;
+ else
+ return std::__to_unsigned_like(__end_ - __begin_);
+ }
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr subrange next(iter_difference_t<_Iter> __n = 1) const&
- requires forward_iterator<_Iter>
- {
- auto __tmp = *this;
- __tmp.advance(__n);
- return __tmp;
- }
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr subrange next(iter_difference_t<_Iter> __n = 1) const&
+ requires forward_iterator<_Iter>
+ {
+ auto __tmp = *this;
+ __tmp.advance(__n);
+ return __tmp;
+ }
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr subrange next(iter_difference_t<_Iter> __n = 1) && {
- advance(__n);
- return std::move(*this);
- }
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr subrange next(iter_difference_t<_Iter> __n = 1) && {
+ advance(__n);
+ return std::move(*this);
+ }
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr subrange prev(iter_difference_t<_Iter> __n = 1) const
- requires bidirectional_iterator<_Iter>
- {
- auto __tmp = *this;
- __tmp.advance(-__n);
- return __tmp;
- }
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr subrange prev(iter_difference_t<_Iter> __n = 1) const
+ requires bidirectional_iterator<_Iter>
+ {
+ auto __tmp = *this;
+ __tmp.advance(-__n);
+ return __tmp;
+ }
- _LIBCPP_HIDE_FROM_ABI
- constexpr subrange& advance(iter_difference_t<_Iter> __n) {
- if constexpr (bidirectional_iterator<_Iter>) {
- if (__n < 0) {
- ranges::advance(__begin_, __n);
- if constexpr (_StoreSize)
- __size_ += std::__to_unsigned_like(-__n);
- return *this;
- }
+ _LIBCPP_HIDE_FROM_ABI constexpr subrange& advance(iter_difference_t<_Iter> __n) {
+ if constexpr (bidirectional_iterator<_Iter>) {
+ if (__n < 0) {
+ ranges::advance(__begin_, __n);
+ if constexpr (_StoreSize)
+ __size_ += std::__to_unsigned_like(-__n);
+ return *this;
}
-
- auto __d = __n - ranges::advance(__begin_, __n, __end_);
- if constexpr (_StoreSize)
- __size_ -= std::__to_unsigned_like(__d);
- return *this;
}
- };
-
- template<input_or_output_iterator _Iter, sentinel_for<_Iter> _Sent>
- subrange(_Iter, _Sent) -> subrange<_Iter, _Sent>;
- template<input_or_output_iterator _Iter, sentinel_for<_Iter> _Sent>
- subrange(_Iter, _Sent, make_unsigned_t<iter_difference_t<_Iter>>)
- -> subrange<_Iter, _Sent, subrange_kind::sized>;
+ auto __d = __n - ranges::advance(__begin_, __n, __end_);
+ if constexpr (_StoreSize)
+ __size_ -= std::__to_unsigned_like(__d);
+ return *this;
+ }
+};
- template<borrowed_range _Range>
- subrange(_Range&&) -> subrange<iterator_t<_Range>, sentinel_t<_Range>,
- (sized_range<_Range> || sized_sentinel_for<sentinel_t<_Range>, iterator_t<_Range>>)
- ? subrange_kind::sized : subrange_kind::unsized>;
+template <input_or_output_iterator _Iter, sentinel_for<_Iter> _Sent>
+subrange(_Iter, _Sent) -> subrange<_Iter, _Sent>;
- template<borrowed_range _Range>
- subrange(_Range&&, make_unsigned_t<range_difference_t<_Range>>)
- -> subrange<iterator_t<_Range>, sentinel_t<_Range>, subrange_kind::sized>;
+template <input_or_output_iterator _Iter, sentinel_for<_Iter> _Sent>
+subrange(_Iter, _Sent, make_unsigned_t<iter_difference_t<_Iter>>) -> subrange<_Iter, _Sent, subrange_kind::sized>;
- template<size_t _Index, class _Iter, class _Sent, subrange_kind _Kind>
- requires ((_Index == 0 && copyable<_Iter>) || _Index == 1)
- _LIBCPP_HIDE_FROM_ABI
- constexpr auto get(const subrange<_Iter, _Sent, _Kind>& __subrange) {
- if constexpr (_Index == 0)
- return __subrange.begin();
- else
- return __subrange.end();
- }
+template <borrowed_range _Range>
+subrange(_Range&&)
+ -> subrange<iterator_t<_Range>,
+ sentinel_t<_Range>,
+ (sized_range<_Range> || sized_sentinel_for<sentinel_t<_Range>, iterator_t<_Range>>)
+ ? subrange_kind::sized
+ : subrange_kind::unsized>;
- template<size_t _Index, class _Iter, class _Sent, subrange_kind _Kind>
- requires (_Index < 2)
- _LIBCPP_HIDE_FROM_ABI
- constexpr auto get(subrange<_Iter, _Sent, _Kind>&& __subrange) {
- if constexpr (_Index == 0)
- return __subrange.begin();
- else
- return __subrange.end();
- }
-
- template<class _Ip, class _Sp, subrange_kind _Kp>
- inline constexpr bool enable_borrowed_range<subrange<_Ip, _Sp, _Kp>> = true;
+template <borrowed_range _Range>
+subrange(_Range&&, make_unsigned_t<range_difference_t<_Range>>)
+ -> subrange<iterator_t<_Range>, sentinel_t<_Range>, subrange_kind::sized>;
- template<range _Rp>
- using borrowed_subrange_t = _If<borrowed_range<_Rp>, subrange<iterator_t<_Rp>>, dangling>;
+template <size_t _Index, class _Iter, class _Sent, subrange_kind _Kind>
+ requires((_Index == 0 && copyable<_Iter>) || _Index == 1)
+_LIBCPP_HIDE_FROM_ABI constexpr auto get(const subrange<_Iter, _Sent, _Kind>& __subrange) {
+ if constexpr (_Index == 0)
+ return __subrange.begin();
+ else
+ return __subrange.end();
+}
+
+template <size_t _Index, class _Iter, class _Sent, subrange_kind _Kind>
+ requires(_Index < 2)
+_LIBCPP_HIDE_FROM_ABI constexpr auto get(subrange<_Iter, _Sent, _Kind>&& __subrange) {
+ if constexpr (_Index == 0)
+ return __subrange.begin();
+ else
+ return __subrange.end();
+}
+
+template <class _Ip, class _Sp, subrange_kind _Kp>
+inline constexpr bool enable_borrowed_range<subrange<_Ip, _Sp, _Kp>> = true;
+
+template <range _Rp>
+using borrowed_subrange_t = _If<borrowed_range<_Rp>, subrange<iterator_t<_Rp>>, dangling>;
} // namespace ranges
// [range.subrange.general]
@@ -264,25 +244,25 @@ using ranges::get;
// [ranges.syn]
-template<class _Ip, class _Sp, ranges::subrange_kind _Kp>
+template <class _Ip, class _Sp, ranges::subrange_kind _Kp>
struct tuple_size<ranges::subrange<_Ip, _Sp, _Kp>> : integral_constant<size_t, 2> {};
-template<class _Ip, class _Sp, ranges::subrange_kind _Kp>
+template <class _Ip, class _Sp, ranges::subrange_kind _Kp>
struct tuple_element<0, ranges::subrange<_Ip, _Sp, _Kp>> {
using type = _Ip;
};
-template<class _Ip, class _Sp, ranges::subrange_kind _Kp>
+template <class _Ip, class _Sp, ranges::subrange_kind _Kp>
struct tuple_element<1, ranges::subrange<_Ip, _Sp, _Kp>> {
using type = _Sp;
};
-template<class _Ip, class _Sp, ranges::subrange_kind _Kp>
+template <class _Ip, class _Sp, ranges::subrange_kind _Kp>
struct tuple_element<0, const ranges::subrange<_Ip, _Sp, _Kp>> {
using type = _Ip;
};
-template<class _Ip, class _Sp, ranges::subrange_kind _Kp>
+template <class _Ip, class _Sp, ranges::subrange_kind _Kp>
struct tuple_element<1, const ranges::subrange<_Ip, _Sp, _Kp>> {
using type = _Sp;
};
diff --git a/contrib/llvm-project/libcxx/include/__ranges/take_view.h b/contrib/llvm-project/libcxx/include/__ranges/take_view.h
index 518375d684ab..83ed5ca0ebd3 100644
--- a/contrib/llvm-project/libcxx/include/__ranges/take_view.h
+++ b/contrib/llvm-project/libcxx/include/__ranges/take_view.h
@@ -57,37 +57,42 @@ _LIBCPP_BEGIN_NAMESPACE_STD
namespace ranges {
-template<view _View>
+template <view _View>
class take_view : public view_interface<take_view<_View>> {
_LIBCPP_NO_UNIQUE_ADDRESS _View __base_ = _View();
- range_difference_t<_View> __count_ = 0;
+ range_difference_t<_View> __count_ = 0;
- template<bool> class __sentinel;
+ template <bool>
+ class __sentinel;
public:
- _LIBCPP_HIDE_FROM_ABI
- take_view() requires default_initializable<_View> = default;
+ _LIBCPP_HIDE_FROM_ABI take_view()
+ requires default_initializable<_View>
+ = default;
- _LIBCPP_HIDE_FROM_ABI
- constexpr _LIBCPP_EXPLICIT_SINCE_CXX23 take_view(_View __base, range_difference_t<_View> __count)
+ _LIBCPP_HIDE_FROM_ABI constexpr _LIBCPP_EXPLICIT_SINCE_CXX23
+ take_view(_View __base, range_difference_t<_View> __count)
: __base_(std::move(__base)), __count_(__count) {
_LIBCPP_ASSERT_UNCATEGORIZED(__count >= 0, "count has to be greater than or equal to zero");
}
- _LIBCPP_HIDE_FROM_ABI
- constexpr _View base() const& requires copy_constructible<_View> { return __base_; }
+ _LIBCPP_HIDE_FROM_ABI constexpr _View base() const&
+ requires copy_constructible<_View>
+ {
+ return __base_;
+ }
- _LIBCPP_HIDE_FROM_ABI
- constexpr _View base() && { return std::move(__base_); }
+ _LIBCPP_HIDE_FROM_ABI constexpr _View base() && { return std::move(__base_); }
- _LIBCPP_HIDE_FROM_ABI
- constexpr auto begin() requires (!__simple_view<_View>) {
+ _LIBCPP_HIDE_FROM_ABI constexpr auto begin()
+ requires(!__simple_view<_View>)
+ {
if constexpr (sized_range<_View>) {
if constexpr (random_access_range<_View>) {
return ranges::begin(__base_);
} else {
using _DifferenceT = range_difference_t<_View>;
- auto __size = size();
+ auto __size = size();
return counted_iterator(ranges::begin(__base_), static_cast<_DifferenceT>(__size));
}
} else {
@@ -95,14 +100,15 @@ public:
}
}
- _LIBCPP_HIDE_FROM_ABI
- constexpr auto begin() const requires range<const _View> {
+ _LIBCPP_HIDE_FROM_ABI constexpr auto begin() const
+ requires range<const _View>
+ {
if constexpr (sized_range<const _View>) {
if constexpr (random_access_range<const _View>) {
return ranges::begin(__base_);
} else {
using _DifferenceT = range_difference_t<const _View>;
- auto __size = size();
+ auto __size = size();
return counted_iterator(ranges::begin(__base_), static_cast<_DifferenceT>(__size));
}
} else {
@@ -110,8 +116,9 @@ public:
}
}
- _LIBCPP_HIDE_FROM_ABI
- constexpr auto end() requires (!__simple_view<_View>) {
+ _LIBCPP_HIDE_FROM_ABI constexpr auto end()
+ requires(!__simple_view<_View>)
+ {
if constexpr (sized_range<_View>) {
if constexpr (random_access_range<_View>) {
return ranges::begin(__base_) + size();
@@ -123,8 +130,9 @@ public:
}
}
- _LIBCPP_HIDE_FROM_ABI
- constexpr auto end() const requires range<const _View> {
+ _LIBCPP_HIDE_FROM_ABI constexpr auto end() const
+ requires range<const _View>
+ {
if constexpr (sized_range<const _View>) {
if constexpr (random_access_range<const _View>) {
return ranges::begin(__base_) + size();
@@ -136,47 +144,44 @@ public:
}
}
- _LIBCPP_HIDE_FROM_ABI
- constexpr auto size() requires sized_range<_View> {
+ _LIBCPP_HIDE_FROM_ABI constexpr auto size()
+ requires sized_range<_View>
+ {
auto __n = ranges::size(__base_);
return ranges::min(__n, static_cast<decltype(__n)>(__count_));
}
- _LIBCPP_HIDE_FROM_ABI
- constexpr auto size() const requires sized_range<const _View> {
+ _LIBCPP_HIDE_FROM_ABI constexpr auto size() const
+ requires sized_range<const _View>
+ {
auto __n = ranges::size(__base_);
return ranges::min(__n, static_cast<decltype(__n)>(__count_));
}
};
-template<view _View>
-template<bool _Const>
+template <view _View>
+template <bool _Const>
class take_view<_View>::__sentinel {
using _Base = __maybe_const<_Const, _View>;
- template<bool _OtherConst>
- using _Iter = counted_iterator<iterator_t<__maybe_const<_OtherConst, _View>>>;
+ template <bool _OtherConst>
+ using _Iter = counted_iterator<iterator_t<__maybe_const<_OtherConst, _View>>>;
_LIBCPP_NO_UNIQUE_ADDRESS sentinel_t<_Base> __end_ = sentinel_t<_Base>();
- template<bool>
+ template <bool>
friend class take_view<_View>::__sentinel;
public:
- _LIBCPP_HIDE_FROM_ABI
- __sentinel() = default;
+ _LIBCPP_HIDE_FROM_ABI __sentinel() = default;
- _LIBCPP_HIDE_FROM_ABI
- constexpr explicit __sentinel(sentinel_t<_Base> __end) : __end_(std::move(__end)) {}
+ _LIBCPP_HIDE_FROM_ABI constexpr explicit __sentinel(sentinel_t<_Base> __end) : __end_(std::move(__end)) {}
- _LIBCPP_HIDE_FROM_ABI
- constexpr __sentinel(__sentinel<!_Const> __s)
+ _LIBCPP_HIDE_FROM_ABI constexpr __sentinel(__sentinel<!_Const> __s)
requires _Const && convertible_to<sentinel_t<_View>, sentinel_t<_Base>>
- : __end_(std::move(__s.__end_)) {}
+ : __end_(std::move(__s.__end_)) {}
- _LIBCPP_HIDE_FROM_ABI
- constexpr sentinel_t<_Base> base() const { return __end_; }
+ _LIBCPP_HIDE_FROM_ABI constexpr sentinel_t<_Base> base() const { return __end_; }
- _LIBCPP_HIDE_FROM_ABI
- friend constexpr bool operator==(const _Iter<_Const>& __lhs, const __sentinel& __rhs) {
+ _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator==(const _Iter<_Const>& __lhs, const __sentinel& __rhs) {
return __lhs.count() == 0 || __lhs.base() == __rhs.__end_;
}
@@ -187,10 +192,10 @@ public:
}
};
-template<class _Range>
+template <class _Range>
take_view(_Range&&, range_difference_t<_Range>) -> take_view<views::all_t<_Range>>;
-template<class _Tp>
+template <class _Tp>
inline constexpr bool enable_borrowed_range<take_view<_Tp>> = enable_borrowed_range<_Tp>;
namespace views {
@@ -234,7 +239,7 @@ struct __passthrough_type<basic_string_view<_CharT, _Traits>> {
};
template <class _Iter, class _Sent, subrange_kind _Kind>
- requires requires{typename subrange<_Iter>;}
+ requires requires { typename subrange<_Iter>; }
struct __passthrough_type<subrange<_Iter, _Sent, _Kind>> {
using type = subrange<_Iter>;
};
@@ -246,42 +251,36 @@ struct __fn {
// [range.take.overview]: the `empty_view` case.
template <class _Range, convertible_to<range_difference_t<_Range>> _Np>
requires __is_empty_view<remove_cvref_t<_Range>>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI
- constexpr auto operator()(_Range&& __range, _Np&&) const
- noexcept(noexcept(_LIBCPP_AUTO_CAST(std::forward<_Range>(__range))))
- -> decltype( _LIBCPP_AUTO_CAST(std::forward<_Range>(__range)))
- { return _LIBCPP_AUTO_CAST(std::forward<_Range>(__range)); }
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Range&& __range, _Np&&) const
+ noexcept(noexcept(_LIBCPP_AUTO_CAST(std::forward<_Range>(__range))))
+ -> decltype(_LIBCPP_AUTO_CAST(std::forward<_Range>(__range))) {
+ return _LIBCPP_AUTO_CAST(std::forward<_Range>(__range));
+ }
// [range.take.overview]: the `span | basic_string_view | subrange` case.
template <class _Range,
convertible_to<range_difference_t<_Range>> _Np,
class _RawRange = remove_cvref_t<_Range>,
- class _Dist = range_difference_t<_Range>>
- requires (!__is_empty_view<_RawRange> &&
- random_access_range<_RawRange> &&
- sized_range<_RawRange> &&
- __is_passthrough_specialization<_RawRange>)
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI
- constexpr auto operator()(_Range&& __rng, _Np&& __n) const
- noexcept(noexcept(__passthrough_type_t<_RawRange>(
- ranges::begin(__rng),
- ranges::begin(__rng) + std::min<_Dist>(ranges::distance(__rng), std::forward<_Np>(__n))
- )))
- -> decltype( __passthrough_type_t<_RawRange>(
- // Note: deliberately not forwarding `__rng` to guard against double moves.
- ranges::begin(__rng),
- ranges::begin(__rng) + std::min<_Dist>(ranges::distance(__rng), std::forward<_Np>(__n))
- ))
- { return __passthrough_type_t<_RawRange>(
- ranges::begin(__rng),
- ranges::begin(__rng) + std::min<_Dist>(ranges::distance(__rng), std::forward<_Np>(__n))
- ); }
+ class _Dist = range_difference_t<_Range>>
+ requires(!__is_empty_view<_RawRange> && random_access_range<_RawRange> && sized_range<_RawRange> &&
+ __is_passthrough_specialization<_RawRange>)
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto
+ operator()(_Range&& __rng, _Np&& __n) const noexcept(noexcept(__passthrough_type_t<_RawRange>(
+ ranges::begin(__rng), ranges::begin(__rng) + std::min<_Dist>(ranges::distance(__rng), std::forward<_Np>(__n)))))
+ -> decltype(__passthrough_type_t<_RawRange>(
+ // Note: deliberately not forwarding `__rng` to guard against double moves.
+ ranges::begin(__rng),
+ ranges::begin(__rng) + std::min<_Dist>(ranges::distance(__rng), std::forward<_Np>(__n)))) {
+ return __passthrough_type_t<_RawRange>(
+ ranges::begin(__rng), ranges::begin(__rng) + std::min<_Dist>(ranges::distance(__rng), std::forward<_Np>(__n)));
+ }
// [range.take.overview]: the `iota_view` case.
+ // clang-format off
template <class _Range,
convertible_to<range_difference_t<_Range>> _Np,
class _RawRange = remove_cvref_t<_Range>,
- class _Dist = range_difference_t<_Range>>
+ class _Dist = range_difference_t<_Range>>
requires (!__is_empty_view<_RawRange> &&
random_access_range<_RawRange> &&
sized_range<_RawRange> &&
@@ -290,18 +289,18 @@ struct __fn {
constexpr auto operator()(_Range&& __rng, _Np&& __n) const
noexcept(noexcept(ranges::iota_view(
*ranges::begin(__rng),
- *ranges::begin(__rng) + std::min<_Dist>(ranges::distance(__rng), std::forward<_Np>(__n))
+ *(ranges::begin(__rng) + std::min<_Dist>(ranges::distance(__rng), std::forward<_Np>(__n)))
)))
-> decltype( ranges::iota_view(
// Note: deliberately not forwarding `__rng` to guard against double moves.
*ranges::begin(__rng),
- *ranges::begin(__rng) + std::min<_Dist>(ranges::distance(__rng), std::forward<_Np>(__n))
+ *(ranges::begin(__rng) + std::min<_Dist>(ranges::distance(__rng), std::forward<_Np>(__n)))
))
{ return ranges::iota_view(
*ranges::begin(__rng),
- *ranges::begin(__rng) + std::min<_Dist>(ranges::distance(__rng), std::forward<_Np>(__n))
+ *(ranges::begin(__rng) + std::min<_Dist>(ranges::distance(__rng), std::forward<_Np>(__n)))
); }
-// clang-format off
+
#if _LIBCPP_STD_VER >= 23
// [range.take.overview]: the `repeat_view` "_RawRange models sized_range" case.
template <class _Range,
@@ -325,42 +324,37 @@ struct __fn {
-> decltype( views::repeat(*__range.__value_, static_cast<_Dist>(__n)))
{ return views::repeat(*__range.__value_, static_cast<_Dist>(__n)); }
#endif
-// clang-format on
+ // clang-format on
// [range.take.overview]: the "otherwise" case.
- template <class _Range, convertible_to<range_difference_t<_Range>> _Np,
- class _RawRange = remove_cvref_t<_Range>>
- // Note: without specifically excluding the other cases, GCC sees this overload as ambiguous with the other
- // overloads.
- requires (!(__is_empty_view<_RawRange> ||
-#if _LIBCPP_STD_VER >= 23
- __is_repeat_specialization<_RawRange> ||
-#endif
- (__is_iota_specialization<_RawRange> &&
- sized_range<_RawRange> &&
- random_access_range<_RawRange>) ||
- (__is_passthrough_specialization<_RawRange> &&
- sized_range<_RawRange> &&
- random_access_range<_RawRange>)
- ))
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI
- constexpr auto operator()(_Range&& __range, _Np&& __n) const
- noexcept(noexcept(take_view(std::forward<_Range>(__range), std::forward<_Np>(__n))))
- -> decltype( take_view(std::forward<_Range>(__range), std::forward<_Np>(__n)))
- { return take_view(std::forward<_Range>(__range), std::forward<_Np>(__n)); }
+ template <class _Range, convertible_to<range_difference_t<_Range>> _Np, class _RawRange = remove_cvref_t<_Range>>
+ // Note: without specifically excluding the other cases, GCC sees this overload as ambiguous with the other
+ // overloads.
+ requires(!(__is_empty_view<_RawRange> ||
+# if _LIBCPP_STD_VER >= 23
+ __is_repeat_specialization<_RawRange> ||
+# endif
+ (__is_iota_specialization<_RawRange> && sized_range<_RawRange> && random_access_range<_RawRange>) ||
+ (__is_passthrough_specialization<_RawRange> && sized_range<_RawRange> &&
+ random_access_range<_RawRange>)))
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Range&& __range, _Np&& __n) const
+ noexcept(noexcept(take_view(std::forward<_Range>(__range), std::forward<_Np>(__n))))
+ -> decltype(take_view(std::forward<_Range>(__range), std::forward<_Np>(__n))) {
+ return take_view(std::forward<_Range>(__range), std::forward<_Np>(__n));
+ }
template <class _Np>
requires constructible_from<decay_t<_Np>, _Np>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI
- constexpr auto operator()(_Np&& __n) const
- noexcept(is_nothrow_constructible_v<decay_t<_Np>, _Np>)
- { return __range_adaptor_closure_t(std::__bind_back(*this, std::forward<_Np>(__n))); }
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Np&& __n) const
+ noexcept(is_nothrow_constructible_v<decay_t<_Np>, _Np>) {
+ return __range_adaptor_closure_t(std::__bind_back(*this, std::forward<_Np>(__n)));
+ }
};
} // namespace __take
inline namespace __cpo {
- inline constexpr auto take = __take::__fn{};
+inline constexpr auto take = __take::__fn{};
} // namespace __cpo
} // namespace views
diff --git a/contrib/llvm-project/libcxx/include/__ranges/transform_view.h b/contrib/llvm-project/libcxx/include/__ranges/transform_view.h
index 3678f9d64f7b..55c6ce587bd6 100644
--- a/contrib/llvm-project/libcxx/include/__ranges/transform_view.h
+++ b/contrib/llvm-project/libcxx/include/__ranges/transform_view.h
@@ -53,15 +53,13 @@ _LIBCPP_BEGIN_NAMESPACE_STD
namespace ranges {
-template<class _Fn, class _View>
-concept __regular_invocable_with_range_ref =
- regular_invocable<_Fn, range_reference_t<_View>>;
+template <class _Fn, class _View>
+concept __regular_invocable_with_range_ref = regular_invocable<_Fn, range_reference_t<_View>>;
-template<class _View, class _Fn>
+template <class _View, class _Fn>
concept __transform_view_constraints =
- view<_View> && is_object_v<_Fn> &&
- regular_invocable<_Fn&, range_reference_t<_View>> &&
- __can_reference<invoke_result_t<_Fn&, range_reference_t<_View>>>;
+ view<_View> && is_object_v<_Fn> && regular_invocable<_Fn&, range_reference_t<_View>> &&
+ __can_reference<invoke_result_t<_Fn&, range_reference_t<_View>>>;
# if _LIBCPP_STD_VER >= 23
template <input_range _View, move_constructible _Fn>
@@ -70,100 +68,99 @@ template <input_range _View, copy_constructible _Fn>
# endif
requires __transform_view_constraints<_View, _Fn>
class transform_view : public view_interface<transform_view<_View, _Fn>> {
- template<bool> class __iterator;
- template<bool> class __sentinel;
+ template <bool>
+ class __iterator;
+ template <bool>
+ class __sentinel;
_LIBCPP_NO_UNIQUE_ADDRESS __movable_box<_Fn> __func_;
_LIBCPP_NO_UNIQUE_ADDRESS _View __base_ = _View();
public:
- _LIBCPP_HIDE_FROM_ABI
- transform_view()
- requires default_initializable<_View> && default_initializable<_Fn> = default;
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr _LIBCPP_EXPLICIT_SINCE_CXX23 transform_view(_View __base, _Fn __func)
- : __func_(std::in_place, std::move(__func)), __base_(std::move(__base)) {}
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr _View base() const& requires copy_constructible<_View> { return __base_; }
- _LIBCPP_HIDE_FROM_ABI
- constexpr _View base() && { return std::move(__base_); }
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr __iterator<false> begin() {
- return __iterator<false>{*this, ranges::begin(__base_)};
+ _LIBCPP_HIDE_FROM_ABI transform_view()
+ requires default_initializable<_View> && default_initializable<_Fn>
+ = default;
+
+ _LIBCPP_HIDE_FROM_ABI constexpr _LIBCPP_EXPLICIT_SINCE_CXX23 transform_view(_View __base, _Fn __func)
+ : __func_(std::in_place, std::move(__func)), __base_(std::move(__base)) {}
+
+ _LIBCPP_HIDE_FROM_ABI constexpr _View base() const&
+ requires copy_constructible<_View>
+ {
+ return __base_;
}
- _LIBCPP_HIDE_FROM_ABI
- constexpr __iterator<true> begin() const
- requires range<const _View> &&
- __regular_invocable_with_range_ref<const _Fn&, const _View>
+ _LIBCPP_HIDE_FROM_ABI constexpr _View base() && { return std::move(__base_); }
+
+ _LIBCPP_HIDE_FROM_ABI constexpr __iterator<false> begin() { return __iterator<false>{*this, ranges::begin(__base_)}; }
+ _LIBCPP_HIDE_FROM_ABI constexpr __iterator<true> begin() const
+ requires range<const _View> && __regular_invocable_with_range_ref<const _Fn&, const _View>
{
return __iterator<true>(*this, ranges::begin(__base_));
}
- _LIBCPP_HIDE_FROM_ABI
- constexpr __sentinel<false> end() {
- return __sentinel<false>(ranges::end(__base_));
- }
- _LIBCPP_HIDE_FROM_ABI
- constexpr __iterator<false> end()
+ _LIBCPP_HIDE_FROM_ABI constexpr __sentinel<false> end() { return __sentinel<false>(ranges::end(__base_)); }
+ _LIBCPP_HIDE_FROM_ABI constexpr __iterator<false> end()
requires common_range<_View>
{
return __iterator<false>(*this, ranges::end(__base_));
}
- _LIBCPP_HIDE_FROM_ABI
- constexpr __sentinel<true> end() const
- requires range<const _View> &&
- __regular_invocable_with_range_ref<const _Fn&, const _View>
+ _LIBCPP_HIDE_FROM_ABI constexpr __sentinel<true> end() const
+ requires range<const _View> && __regular_invocable_with_range_ref<const _Fn&, const _View>
{
return __sentinel<true>(ranges::end(__base_));
}
- _LIBCPP_HIDE_FROM_ABI
- constexpr __iterator<true> end() const
- requires common_range<const _View> &&
- __regular_invocable_with_range_ref<const _Fn&, const _View>
+ _LIBCPP_HIDE_FROM_ABI constexpr __iterator<true> end() const
+ requires common_range<const _View> && __regular_invocable_with_range_ref<const _Fn&, const _View>
{
return __iterator<true>(*this, ranges::end(__base_));
}
- _LIBCPP_HIDE_FROM_ABI
- constexpr auto size() requires sized_range<_View> { return ranges::size(__base_); }
- _LIBCPP_HIDE_FROM_ABI
- constexpr auto size() const requires sized_range<const _View> { return ranges::size(__base_); }
+ _LIBCPP_HIDE_FROM_ABI constexpr auto size()
+ requires sized_range<_View>
+ {
+ return ranges::size(__base_);
+ }
+ _LIBCPP_HIDE_FROM_ABI constexpr auto size() const
+ requires sized_range<const _View>
+ {
+ return ranges::size(__base_);
+ }
};
-template<class _Range, class _Fn>
+template <class _Range, class _Fn>
transform_view(_Range&&, _Fn) -> transform_view<views::all_t<_Range>, _Fn>;
-template<class _View>
-struct __transform_view_iterator_concept { using type = input_iterator_tag; };
+template <class _View>
+struct __transform_view_iterator_concept {
+ using type = input_iterator_tag;
+};
-template<random_access_range _View>
-struct __transform_view_iterator_concept<_View> { using type = random_access_iterator_tag; };
+template <random_access_range _View>
+struct __transform_view_iterator_concept<_View> {
+ using type = random_access_iterator_tag;
+};
-template<bidirectional_range _View>
-struct __transform_view_iterator_concept<_View> { using type = bidirectional_iterator_tag; };
+template <bidirectional_range _View>
+struct __transform_view_iterator_concept<_View> {
+ using type = bidirectional_iterator_tag;
+};
-template<forward_range _View>
-struct __transform_view_iterator_concept<_View> { using type = forward_iterator_tag; };
+template <forward_range _View>
+struct __transform_view_iterator_concept<_View> {
+ using type = forward_iterator_tag;
+};
-template<class, class>
+template <class, class>
struct __transform_view_iterator_category_base {};
-template<forward_range _View, class _Fn>
+template <forward_range _View, class _Fn>
struct __transform_view_iterator_category_base<_View, _Fn> {
using _Cat = typename iterator_traits<iterator_t<_View>>::iterator_category;
- using iterator_category = conditional_t<
- is_reference_v<invoke_result_t<_Fn&, range_reference_t<_View>>>,
- conditional_t<
- derived_from<_Cat, contiguous_iterator_tag>,
- random_access_iterator_tag,
- _Cat
- >,
- input_iterator_tag
- >;
+ using iterator_category =
+ conditional_t< is_reference_v<invoke_result_t<_Fn&, range_reference_t<_View>>>,
+ conditional_t< derived_from<_Cat, contiguous_iterator_tag>, random_access_iterator_tag, _Cat >,
+ input_iterator_tag >;
};
# if _LIBCPP_STD_VER >= 23
@@ -176,66 +173,54 @@ template <bool _Const>
class transform_view<_View, _Fn>::__iterator : public __transform_view_iterator_category_base<_View, _Fn> {
using _Parent = __maybe_const<_Const, transform_view>;
- using _Base = __maybe_const<_Const, _View>;
+ using _Base = __maybe_const<_Const, _View>;
- _Parent *__parent_ = nullptr;
+ _Parent* __parent_ = nullptr;
- template<bool>
+ template <bool>
friend class transform_view<_View, _Fn>::__iterator;
- template<bool>
+ template <bool>
friend class transform_view<_View, _Fn>::__sentinel;
public:
iterator_t<_Base> __current_ = iterator_t<_Base>();
using iterator_concept = typename __transform_view_iterator_concept<_View>::type;
- using value_type = remove_cvref_t<invoke_result_t<_Fn&, range_reference_t<_Base>>>;
- using difference_type = range_difference_t<_Base>;
+ using value_type = remove_cvref_t<invoke_result_t<_Fn&, range_reference_t<_Base>>>;
+ using difference_type = range_difference_t<_Base>;
- _LIBCPP_HIDE_FROM_ABI
- __iterator() requires default_initializable<iterator_t<_Base>> = default;
+ _LIBCPP_HIDE_FROM_ABI __iterator()
+ requires default_initializable<iterator_t<_Base>>
+ = default;
- _LIBCPP_HIDE_FROM_ABI
- constexpr __iterator(_Parent& __parent, iterator_t<_Base> __current)
- : __parent_(std::addressof(__parent)), __current_(std::move(__current)) {}
+ _LIBCPP_HIDE_FROM_ABI constexpr __iterator(_Parent& __parent, iterator_t<_Base> __current)
+ : __parent_(std::addressof(__parent)), __current_(std::move(__current)) {}
// Note: `__i` should always be `__iterator<false>`, but directly using
// `__iterator<false>` is ill-formed when `_Const` is false
// (see http://wg21.link/class.copy.ctor#5).
- _LIBCPP_HIDE_FROM_ABI
- constexpr __iterator(__iterator<!_Const> __i)
+ _LIBCPP_HIDE_FROM_ABI constexpr __iterator(__iterator<!_Const> __i)
requires _Const && convertible_to<iterator_t<_View>, iterator_t<_Base>>
- : __parent_(__i.__parent_), __current_(std::move(__i.__current_)) {}
+ : __parent_(__i.__parent_), __current_(std::move(__i.__current_)) {}
- _LIBCPP_HIDE_FROM_ABI
- constexpr const iterator_t<_Base>& base() const& noexcept {
- return __current_;
- }
+ _LIBCPP_HIDE_FROM_ABI constexpr const iterator_t<_Base>& base() const& noexcept { return __current_; }
- _LIBCPP_HIDE_FROM_ABI
- constexpr iterator_t<_Base> base() && {
- return std::move(__current_);
- }
+ _LIBCPP_HIDE_FROM_ABI constexpr iterator_t<_Base> base() && { return std::move(__current_); }
- _LIBCPP_HIDE_FROM_ABI
- constexpr decltype(auto) operator*() const
- noexcept(noexcept(std::invoke(*__parent_->__func_, *__current_)))
- {
+ _LIBCPP_HIDE_FROM_ABI constexpr decltype(auto) operator*() const
+ noexcept(noexcept(std::invoke(*__parent_->__func_, *__current_))) {
return std::invoke(*__parent_->__func_, *__current_);
}
- _LIBCPP_HIDE_FROM_ABI
- constexpr __iterator& operator++() {
+ _LIBCPP_HIDE_FROM_ABI constexpr __iterator& operator++() {
++__current_;
return *this;
}
- _LIBCPP_HIDE_FROM_ABI
- constexpr void operator++(int) { ++__current_; }
+ _LIBCPP_HIDE_FROM_ABI constexpr void operator++(int) { ++__current_; }
- _LIBCPP_HIDE_FROM_ABI
- constexpr __iterator operator++(int)
+ _LIBCPP_HIDE_FROM_ABI constexpr __iterator operator++(int)
requires forward_range<_Base>
{
auto __tmp = *this;
@@ -243,16 +228,14 @@ public:
return __tmp;
}
- _LIBCPP_HIDE_FROM_ABI
- constexpr __iterator& operator--()
+ _LIBCPP_HIDE_FROM_ABI constexpr __iterator& operator--()
requires bidirectional_range<_Base>
{
--__current_;
return *this;
}
- _LIBCPP_HIDE_FROM_ABI
- constexpr __iterator operator--(int)
+ _LIBCPP_HIDE_FROM_ABI constexpr __iterator operator--(int)
requires bidirectional_range<_Base>
{
auto __tmp = *this;
@@ -260,104 +243,88 @@ public:
return __tmp;
}
- _LIBCPP_HIDE_FROM_ABI
- constexpr __iterator& operator+=(difference_type __n)
+ _LIBCPP_HIDE_FROM_ABI constexpr __iterator& operator+=(difference_type __n)
requires random_access_range<_Base>
{
__current_ += __n;
return *this;
}
- _LIBCPP_HIDE_FROM_ABI
- constexpr __iterator& operator-=(difference_type __n)
+ _LIBCPP_HIDE_FROM_ABI constexpr __iterator& operator-=(difference_type __n)
requires random_access_range<_Base>
{
__current_ -= __n;
return *this;
}
- _LIBCPP_HIDE_FROM_ABI
- constexpr decltype(auto) operator[](difference_type __n) const
- noexcept(noexcept(std::invoke(*__parent_->__func_, __current_[__n])))
+ _LIBCPP_HIDE_FROM_ABI constexpr decltype(auto) operator[](difference_type __n) const
+ noexcept(noexcept(std::invoke(*__parent_->__func_, __current_[__n])))
requires random_access_range<_Base>
{
return std::invoke(*__parent_->__func_, __current_[__n]);
}
- _LIBCPP_HIDE_FROM_ABI
- friend constexpr bool operator==(const __iterator& __x, const __iterator& __y)
+ _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator==(const __iterator& __x, const __iterator& __y)
requires equality_comparable<iterator_t<_Base>>
{
return __x.__current_ == __y.__current_;
}
- _LIBCPP_HIDE_FROM_ABI
- friend constexpr bool operator<(const __iterator& __x, const __iterator& __y)
+ _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator<(const __iterator& __x, const __iterator& __y)
requires random_access_range<_Base>
{
return __x.__current_ < __y.__current_;
}
- _LIBCPP_HIDE_FROM_ABI
- friend constexpr bool operator>(const __iterator& __x, const __iterator& __y)
+ _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator>(const __iterator& __x, const __iterator& __y)
requires random_access_range<_Base>
{
return __x.__current_ > __y.__current_;
}
- _LIBCPP_HIDE_FROM_ABI
- friend constexpr bool operator<=(const __iterator& __x, const __iterator& __y)
+ _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator<=(const __iterator& __x, const __iterator& __y)
requires random_access_range<_Base>
{
return __x.__current_ <= __y.__current_;
}
- _LIBCPP_HIDE_FROM_ABI
- friend constexpr bool operator>=(const __iterator& __x, const __iterator& __y)
+ _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator>=(const __iterator& __x, const __iterator& __y)
requires random_access_range<_Base>
{
return __x.__current_ >= __y.__current_;
}
- _LIBCPP_HIDE_FROM_ABI
- friend constexpr auto operator<=>(const __iterator& __x, const __iterator& __y)
+ _LIBCPP_HIDE_FROM_ABI friend constexpr auto operator<=>(const __iterator& __x, const __iterator& __y)
requires random_access_range<_Base> && three_way_comparable<iterator_t<_Base>>
{
return __x.__current_ <=> __y.__current_;
}
- _LIBCPP_HIDE_FROM_ABI
- friend constexpr __iterator operator+(__iterator __i, difference_type __n)
+ _LIBCPP_HIDE_FROM_ABI friend constexpr __iterator operator+(__iterator __i, difference_type __n)
requires random_access_range<_Base>
{
return __iterator{*__i.__parent_, __i.__current_ + __n};
}
- _LIBCPP_HIDE_FROM_ABI
- friend constexpr __iterator operator+(difference_type __n, __iterator __i)
+ _LIBCPP_HIDE_FROM_ABI friend constexpr __iterator operator+(difference_type __n, __iterator __i)
requires random_access_range<_Base>
{
return __iterator{*__i.__parent_, __i.__current_ + __n};
}
- _LIBCPP_HIDE_FROM_ABI
- friend constexpr __iterator operator-(__iterator __i, difference_type __n)
+ _LIBCPP_HIDE_FROM_ABI friend constexpr __iterator operator-(__iterator __i, difference_type __n)
requires random_access_range<_Base>
{
return __iterator{*__i.__parent_, __i.__current_ - __n};
}
- _LIBCPP_HIDE_FROM_ABI
- friend constexpr difference_type operator-(const __iterator& __x, const __iterator& __y)
+ _LIBCPP_HIDE_FROM_ABI friend constexpr difference_type operator-(const __iterator& __x, const __iterator& __y)
requires sized_sentinel_for<iterator_t<_Base>, iterator_t<_Base>>
{
return __x.__current_ - __y.__current_;
}
- _LIBCPP_HIDE_FROM_ABI
- friend constexpr decltype(auto) iter_move(const __iterator& __i)
- noexcept(noexcept(*__i))
- {
+ _LIBCPP_HIDE_FROM_ABI friend constexpr decltype(auto) iter_move(const __iterator& __i) noexcept(noexcept(*__i)) {
if constexpr (is_lvalue_reference_v<decltype(*__i)>)
return std::move(*__i);
else
@@ -374,53 +341,46 @@ template <input_range _View, copy_constructible _Fn>
template <bool _Const>
class transform_view<_View, _Fn>::__sentinel {
using _Parent = __maybe_const<_Const, transform_view>;
- using _Base = __maybe_const<_Const, _View>;
+ using _Base = __maybe_const<_Const, _View>;
sentinel_t<_Base> __end_ = sentinel_t<_Base>();
- template<bool>
+ template <bool>
friend class transform_view<_View, _Fn>::__iterator;
- template<bool>
+ template <bool>
friend class transform_view<_View, _Fn>::__sentinel;
public:
- _LIBCPP_HIDE_FROM_ABI
- __sentinel() = default;
+ _LIBCPP_HIDE_FROM_ABI __sentinel() = default;
- _LIBCPP_HIDE_FROM_ABI
- constexpr explicit __sentinel(sentinel_t<_Base> __end) : __end_(__end) {}
+ _LIBCPP_HIDE_FROM_ABI constexpr explicit __sentinel(sentinel_t<_Base> __end) : __end_(__end) {}
// Note: `__i` should always be `__sentinel<false>`, but directly using
// `__sentinel<false>` is ill-formed when `_Const` is false
// (see http://wg21.link/class.copy.ctor#5).
- _LIBCPP_HIDE_FROM_ABI
- constexpr __sentinel(__sentinel<!_Const> __i)
+ _LIBCPP_HIDE_FROM_ABI constexpr __sentinel(__sentinel<!_Const> __i)
requires _Const && convertible_to<sentinel_t<_View>, sentinel_t<_Base>>
- : __end_(std::move(__i.__end_)) {}
+ : __end_(std::move(__i.__end_)) {}
- _LIBCPP_HIDE_FROM_ABI
- constexpr sentinel_t<_Base> base() const { return __end_; }
+ _LIBCPP_HIDE_FROM_ABI constexpr sentinel_t<_Base> base() const { return __end_; }
- template<bool _OtherConst>
+ template <bool _OtherConst>
requires sentinel_for<sentinel_t<_Base>, iterator_t<__maybe_const<_OtherConst, _View>>>
- _LIBCPP_HIDE_FROM_ABI
- friend constexpr bool operator==(const __iterator<_OtherConst>& __x, const __sentinel& __y) {
+ _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator==(const __iterator<_OtherConst>& __x, const __sentinel& __y) {
return __x.__current_ == __y.__end_;
}
- template<bool _OtherConst>
+ template <bool _OtherConst>
requires sized_sentinel_for<sentinel_t<_Base>, iterator_t<__maybe_const<_OtherConst, _View>>>
- _LIBCPP_HIDE_FROM_ABI
- friend constexpr range_difference_t<__maybe_const<_OtherConst, _View>>
+ _LIBCPP_HIDE_FROM_ABI friend constexpr range_difference_t<__maybe_const<_OtherConst, _View>>
operator-(const __iterator<_OtherConst>& __x, const __sentinel& __y) {
return __x.__current_ - __y.__end_;
}
- template<bool _OtherConst>
+ template <bool _OtherConst>
requires sized_sentinel_for<sentinel_t<_Base>, iterator_t<__maybe_const<_OtherConst, _View>>>
- _LIBCPP_HIDE_FROM_ABI
- friend constexpr range_difference_t<__maybe_const<_OtherConst, _View>>
+ _LIBCPP_HIDE_FROM_ABI friend constexpr range_difference_t<__maybe_const<_OtherConst, _View>>
operator-(const __sentinel& __x, const __iterator<_OtherConst>& __y) {
return __x.__end_ - __y.__current_;
}
@@ -428,25 +388,25 @@ public:
namespace views {
namespace __transform {
- struct __fn {
- template<class _Range, class _Fn>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI
- constexpr auto operator()(_Range&& __range, _Fn&& __f) const
+struct __fn {
+ template <class _Range, class _Fn>
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Range&& __range, _Fn&& __f) const
noexcept(noexcept(transform_view(std::forward<_Range>(__range), std::forward<_Fn>(__f))))
- -> decltype( transform_view(std::forward<_Range>(__range), std::forward<_Fn>(__f)))
- { return transform_view(std::forward<_Range>(__range), std::forward<_Fn>(__f)); }
-
- template<class _Fn>
- requires constructible_from<decay_t<_Fn>, _Fn>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI
- constexpr auto operator()(_Fn&& __f) const
- noexcept(is_nothrow_constructible_v<decay_t<_Fn>, _Fn>)
- { return __range_adaptor_closure_t(std::__bind_back(*this, std::forward<_Fn>(__f))); }
- };
+ -> decltype(transform_view(std::forward<_Range>(__range), std::forward<_Fn>(__f))) {
+ return transform_view(std::forward<_Range>(__range), std::forward<_Fn>(__f));
+ }
+
+ template <class _Fn>
+ requires constructible_from<decay_t<_Fn>, _Fn>
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Fn&& __f) const
+ noexcept(is_nothrow_constructible_v<decay_t<_Fn>, _Fn>) {
+ return __range_adaptor_closure_t(std::__bind_back(*this, std::forward<_Fn>(__f)));
+ }
+};
} // namespace __transform
inline namespace __cpo {
- inline constexpr auto transform = __transform::__fn{};
+inline constexpr auto transform = __transform::__fn{};
} // namespace __cpo
} // namespace views
diff --git a/contrib/llvm-project/libcxx/include/__ranges/view_interface.h b/contrib/llvm-project/libcxx/include/__ranges/view_interface.h
index e548355d29a4..84dd1c316de3 100644
--- a/contrib/llvm-project/libcxx/include/__ranges/view_interface.h
+++ b/contrib/llvm-project/libcxx/include/__ranges/view_interface.h
@@ -35,135 +35,119 @@ _LIBCPP_BEGIN_NAMESPACE_STD
namespace ranges {
-template<class _Derived>
+template <class _Derived>
requires is_class_v<_Derived> && same_as<_Derived, remove_cv_t<_Derived>>
class view_interface {
- _LIBCPP_HIDE_FROM_ABI
- constexpr _Derived& __derived() noexcept {
+ _LIBCPP_HIDE_FROM_ABI constexpr _Derived& __derived() noexcept {
static_assert(sizeof(_Derived) && derived_from<_Derived, view_interface> && view<_Derived>);
return static_cast<_Derived&>(*this);
}
- _LIBCPP_HIDE_FROM_ABI
- constexpr _Derived const& __derived() const noexcept {
+ _LIBCPP_HIDE_FROM_ABI constexpr _Derived const& __derived() const noexcept {
static_assert(sizeof(_Derived) && derived_from<_Derived, view_interface> && view<_Derived>);
return static_cast<_Derived const&>(*this);
}
public:
- template<class _D2 = _Derived>
+ template <class _D2 = _Derived>
[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool empty()
requires forward_range<_D2>
{
return ranges::begin(__derived()) == ranges::end(__derived());
}
- template<class _D2 = _Derived>
+ template <class _D2 = _Derived>
[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool empty() const
requires forward_range<const _D2>
{
return ranges::begin(__derived()) == ranges::end(__derived());
}
- template<class _D2 = _Derived>
- _LIBCPP_HIDE_FROM_ABI
- constexpr explicit operator bool()
- requires requires (_D2& __t) { ranges::empty(__t); }
+ template <class _D2 = _Derived>
+ _LIBCPP_HIDE_FROM_ABI constexpr explicit operator bool()
+ requires requires(_D2& __t) { ranges::empty(__t); }
{
return !ranges::empty(__derived());
}
- template<class _D2 = _Derived>
- _LIBCPP_HIDE_FROM_ABI
- constexpr explicit operator bool() const
- requires requires (const _D2& __t) { ranges::empty(__t); }
+ template <class _D2 = _Derived>
+ _LIBCPP_HIDE_FROM_ABI constexpr explicit operator bool() const
+ requires requires(const _D2& __t) { ranges::empty(__t); }
{
return !ranges::empty(__derived());
}
- template<class _D2 = _Derived>
- _LIBCPP_HIDE_FROM_ABI
- constexpr auto data()
+ template <class _D2 = _Derived>
+ _LIBCPP_HIDE_FROM_ABI constexpr auto data()
requires contiguous_iterator<iterator_t<_D2>>
{
return std::to_address(ranges::begin(__derived()));
}
- template<class _D2 = _Derived>
- _LIBCPP_HIDE_FROM_ABI
- constexpr auto data() const
+ template <class _D2 = _Derived>
+ _LIBCPP_HIDE_FROM_ABI constexpr auto data() const
requires range<const _D2> && contiguous_iterator<iterator_t<const _D2>>
{
return std::to_address(ranges::begin(__derived()));
}
- template<class _D2 = _Derived>
- _LIBCPP_HIDE_FROM_ABI
- constexpr auto size()
+ template <class _D2 = _Derived>
+ _LIBCPP_HIDE_FROM_ABI constexpr auto size()
requires forward_range<_D2> && sized_sentinel_for<sentinel_t<_D2>, iterator_t<_D2>>
{
return std::__to_unsigned_like(ranges::end(__derived()) - ranges::begin(__derived()));
}
- template<class _D2 = _Derived>
- _LIBCPP_HIDE_FROM_ABI
- constexpr auto size() const
+ template <class _D2 = _Derived>
+ _LIBCPP_HIDE_FROM_ABI constexpr auto size() const
requires forward_range<const _D2> && sized_sentinel_for<sentinel_t<const _D2>, iterator_t<const _D2>>
{
return std::__to_unsigned_like(ranges::end(__derived()) - ranges::begin(__derived()));
}
- template<class _D2 = _Derived>
- _LIBCPP_HIDE_FROM_ABI
- constexpr decltype(auto) front()
+ template <class _D2 = _Derived>
+ _LIBCPP_HIDE_FROM_ABI constexpr decltype(auto) front()
requires forward_range<_D2>
{
- _LIBCPP_ASSERT_UNCATEGORIZED(!empty(),
- "Precondition `!empty()` not satisfied. `.front()` called on an empty view.");
+ _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
+ !empty(), "Precondition `!empty()` not satisfied. `.front()` called on an empty view.");
return *ranges::begin(__derived());
}
- template<class _D2 = _Derived>
- _LIBCPP_HIDE_FROM_ABI
- constexpr decltype(auto) front() const
+ template <class _D2 = _Derived>
+ _LIBCPP_HIDE_FROM_ABI constexpr decltype(auto) front() const
requires forward_range<const _D2>
{
- _LIBCPP_ASSERT_UNCATEGORIZED(!empty(),
- "Precondition `!empty()` not satisfied. `.front()` called on an empty view.");
+ _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
+ !empty(), "Precondition `!empty()` not satisfied. `.front()` called on an empty view.");
return *ranges::begin(__derived());
}
- template<class _D2 = _Derived>
- _LIBCPP_HIDE_FROM_ABI
- constexpr decltype(auto) back()
+ template <class _D2 = _Derived>
+ _LIBCPP_HIDE_FROM_ABI constexpr decltype(auto) back()
requires bidirectional_range<_D2> && common_range<_D2>
{
- _LIBCPP_ASSERT_UNCATEGORIZED(!empty(),
- "Precondition `!empty()` not satisfied. `.back()` called on an empty view.");
+ _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
+ !empty(), "Precondition `!empty()` not satisfied. `.back()` called on an empty view.");
return *ranges::prev(ranges::end(__derived()));
}
- template<class _D2 = _Derived>
- _LIBCPP_HIDE_FROM_ABI
- constexpr decltype(auto) back() const
+ template <class _D2 = _Derived>
+ _LIBCPP_HIDE_FROM_ABI constexpr decltype(auto) back() const
requires bidirectional_range<const _D2> && common_range<const _D2>
{
- _LIBCPP_ASSERT_UNCATEGORIZED(!empty(),
- "Precondition `!empty()` not satisfied. `.back()` called on an empty view.");
+ _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
+ !empty(), "Precondition `!empty()` not satisfied. `.back()` called on an empty view.");
return *ranges::prev(ranges::end(__derived()));
}
- template<random_access_range _RARange = _Derived>
- _LIBCPP_HIDE_FROM_ABI
- constexpr decltype(auto) operator[](range_difference_t<_RARange> __index)
- {
+ template <random_access_range _RARange = _Derived>
+ _LIBCPP_HIDE_FROM_ABI constexpr decltype(auto) operator[](range_difference_t<_RARange> __index) {
return ranges::begin(__derived())[__index];
}
- template<random_access_range _RARange = const _Derived>
- _LIBCPP_HIDE_FROM_ABI
- constexpr decltype(auto) operator[](range_difference_t<_RARange> __index) const
- {
+ template <random_access_range _RARange = const _Derived>
+ _LIBCPP_HIDE_FROM_ABI constexpr decltype(auto) operator[](range_difference_t<_RARange> __index) const {
return ranges::begin(__derived())[__index];
}
};
diff --git a/contrib/llvm-project/libcxx/include/__ranges/views.h b/contrib/llvm-project/libcxx/include/__ranges/views.h
index 906c4e46c343..a4de2a5e52a9 100644
--- a/contrib/llvm-project/libcxx/include/__ranges/views.h
+++ b/contrib/llvm-project/libcxx/include/__ranges/views.h
@@ -22,7 +22,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
namespace ranges {
-namespace views { }
+namespace views {}
} // namespace ranges
diff --git a/contrib/llvm-project/libcxx/include/__ranges/zip_view.h b/contrib/llvm-project/libcxx/include/__ranges/zip_view.h
index 2fd1fb30475a..4898c0afc87a 100644
--- a/contrib/llvm-project/libcxx/include/__ranges/zip_view.h
+++ b/contrib/llvm-project/libcxx/include/__ranges/zip_view.h
@@ -52,9 +52,10 @@ _LIBCPP_BEGIN_NAMESPACE_STD
namespace ranges {
template <class... _Ranges>
-concept __zip_is_common = (sizeof...(_Ranges) == 1 && (common_range<_Ranges> && ...)) ||
- (!(bidirectional_range<_Ranges> && ...) && (common_range<_Ranges> && ...)) ||
- ((random_access_range<_Ranges> && ...) && (sized_range<_Ranges> && ...));
+concept __zip_is_common =
+ (sizeof...(_Ranges) == 1 && (common_range<_Ranges> && ...)) ||
+ (!(bidirectional_range<_Ranges> && ...) && (common_range<_Ranges> && ...)) ||
+ ((random_access_range<_Ranges> && ...) && (sized_range<_Ranges> && ...));
template <typename _Tp, typename _Up>
auto __tuple_or_pair_test() -> pair<_Tp, _Up>;
@@ -87,31 +88,39 @@ _LIBCPP_HIDE_FROM_ABI constexpr void __tuple_for_each(_Fun&& __f, _Tuple&& __tup
template <class _Fun, class _Tuple1, class _Tuple2, size_t... _Indices>
_LIBCPP_HIDE_FROM_ABI constexpr __tuple_or_pair<
- invoke_result_t<_Fun&, typename tuple_element<_Indices, remove_cvref_t<_Tuple1>>::type,
+ invoke_result_t<_Fun&,
+ typename tuple_element<_Indices, remove_cvref_t<_Tuple1>>::type,
typename tuple_element<_Indices, remove_cvref_t<_Tuple2>>::type>...>
__tuple_zip_transform(_Fun&& __f, _Tuple1&& __tuple1, _Tuple2&& __tuple2, index_sequence<_Indices...>) {
- return {std::invoke(__f, std::get<_Indices>(std::forward<_Tuple1>(__tuple1)),
+ return {std::invoke(__f,
+ std::get<_Indices>(std::forward<_Tuple1>(__tuple1)),
std::get<_Indices>(std::forward<_Tuple2>(__tuple2)))...};
}
template <class _Fun, class _Tuple1, class _Tuple2>
_LIBCPP_HIDE_FROM_ABI constexpr auto __tuple_zip_transform(_Fun&& __f, _Tuple1&& __tuple1, _Tuple2&& __tuple2) {
- return ranges::__tuple_zip_transform(__f, std::forward<_Tuple1>(__tuple1), std::forward<_Tuple2>(__tuple2),
- std::make_index_sequence<tuple_size<remove_cvref_t<_Tuple1>>::value>());
+ return ranges::__tuple_zip_transform(
+ __f,
+ std::forward<_Tuple1>(__tuple1),
+ std::forward<_Tuple2>(__tuple2),
+ std::make_index_sequence<tuple_size<remove_cvref_t<_Tuple1>>::value>());
}
template <class _Fun, class _Tuple1, class _Tuple2, size_t... _Indices>
-_LIBCPP_HIDE_FROM_ABI constexpr void __tuple_zip_for_each(_Fun&& __f, _Tuple1&& __tuple1, _Tuple2&& __tuple2,
- index_sequence<_Indices...>) {
- (std::invoke(__f, std::get<_Indices>(std::forward<_Tuple1>(__tuple1)),
- std::get<_Indices>(std::forward<_Tuple2>(__tuple2))),
+_LIBCPP_HIDE_FROM_ABI constexpr void
+__tuple_zip_for_each(_Fun&& __f, _Tuple1&& __tuple1, _Tuple2&& __tuple2, index_sequence<_Indices...>) {
+ (std::invoke(
+ __f, std::get<_Indices>(std::forward<_Tuple1>(__tuple1)), std::get<_Indices>(std::forward<_Tuple2>(__tuple2))),
...);
}
template <class _Fun, class _Tuple1, class _Tuple2>
_LIBCPP_HIDE_FROM_ABI constexpr auto __tuple_zip_for_each(_Fun&& __f, _Tuple1&& __tuple1, _Tuple2&& __tuple2) {
- return ranges::__tuple_zip_for_each(__f, std::forward<_Tuple1>(__tuple1), std::forward<_Tuple2>(__tuple2),
- std::make_index_sequence<tuple_size<remove_cvref_t<_Tuple1>>::value>());
+ return ranges::__tuple_zip_for_each(
+ __f,
+ std::forward<_Tuple1>(__tuple1),
+ std::forward<_Tuple2>(__tuple2),
+ std::make_index_sequence<tuple_size<remove_cvref_t<_Tuple1>>::value>());
}
template <class _Tuple1, class _Tuple2>
@@ -130,7 +139,6 @@ _LIBCPP_HIDE_FROM_ABI constexpr _Tp __abs(_Tp __t) {
template <input_range... _Views>
requires(view<_Views> && ...) && (sizeof...(_Views) > 0)
class zip_view : public view_interface<zip_view<_Views...>> {
-
_LIBCPP_NO_UNIQUE_ADDRESS tuple<_Views...> __views_;
template <bool>
@@ -140,27 +148,25 @@ class zip_view : public view_interface<zip_view<_Views...>> {
class __sentinel;
public:
- _LIBCPP_HIDE_FROM_ABI
- zip_view() = default;
+ _LIBCPP_HIDE_FROM_ABI zip_view() = default;
- _LIBCPP_HIDE_FROM_ABI
- constexpr explicit zip_view(_Views... __views) : __views_(std::move(__views)...) {}
+ _LIBCPP_HIDE_FROM_ABI constexpr explicit zip_view(_Views... __views) : __views_(std::move(__views)...) {}
- _LIBCPP_HIDE_FROM_ABI
- constexpr auto begin()
- requires(!(__simple_view<_Views> && ...)) {
+ _LIBCPP_HIDE_FROM_ABI constexpr auto begin()
+ requires(!(__simple_view<_Views> && ...))
+ {
return __iterator<false>(ranges::__tuple_transform(ranges::begin, __views_));
}
- _LIBCPP_HIDE_FROM_ABI
- constexpr auto begin() const
- requires(range<const _Views> && ...) {
+ _LIBCPP_HIDE_FROM_ABI constexpr auto begin() const
+ requires(range<const _Views> && ...)
+ {
return __iterator<true>(ranges::__tuple_transform(ranges::begin, __views_));
}
- _LIBCPP_HIDE_FROM_ABI
- constexpr auto end()
- requires(!(__simple_view<_Views> && ...)) {
+ _LIBCPP_HIDE_FROM_ABI constexpr auto end()
+ requires(!(__simple_view<_Views> && ...))
+ {
if constexpr (!__zip_is_common<_Views...>) {
return __sentinel<false>(ranges::__tuple_transform(ranges::end, __views_));
} else if constexpr ((random_access_range<_Views> && ...)) {
@@ -170,9 +176,9 @@ public:
}
}
- _LIBCPP_HIDE_FROM_ABI
- constexpr auto end() const
- requires(range<const _Views> && ...) {
+ _LIBCPP_HIDE_FROM_ABI constexpr auto end() const
+ requires(range<const _Views> && ...)
+ {
if constexpr (!__zip_is_common<const _Views...>) {
return __sentinel<true>(ranges::__tuple_transform(ranges::end, __views_));
} else if constexpr ((random_access_range<const _Views> && ...)) {
@@ -182,9 +188,9 @@ public:
}
}
- _LIBCPP_HIDE_FROM_ABI
- constexpr auto size()
- requires(sized_range<_Views> && ...) {
+ _LIBCPP_HIDE_FROM_ABI constexpr auto size()
+ requires(sized_range<_Views> && ...)
+ {
return std::apply(
[](auto... __sizes) {
using _CT = make_unsigned_t<common_type_t<decltype(__sizes)...>>;
@@ -193,9 +199,9 @@ public:
ranges::__tuple_transform(ranges::size, __views_));
}
- _LIBCPP_HIDE_FROM_ABI
- constexpr auto size() const
- requires(sized_range<const _Views> && ...) {
+ _LIBCPP_HIDE_FROM_ABI constexpr auto size() const
+ requires(sized_range<const _Views> && ...)
+ {
return std::apply(
[](auto... __sizes) {
using _CT = make_unsigned_t<common_type_t<decltype(__sizes)...>>;
@@ -243,11 +249,10 @@ template <input_range... _Views>
requires(view<_Views> && ...) && (sizeof...(_Views) > 0)
template <bool _Const>
class zip_view<_Views...>::__iterator : public __zip_view_iterator_category_base<_Const, _Views...> {
-
__tuple_or_pair<iterator_t<__maybe_const<_Const, _Views>>...> __current_;
- _LIBCPP_HIDE_FROM_ABI
- constexpr explicit __iterator(__tuple_or_pair<iterator_t<__maybe_const<_Const, _Views>>...> __current)
+ _LIBCPP_HIDE_FROM_ABI constexpr explicit __iterator(
+ __tuple_or_pair<iterator_t<__maybe_const<_Const, _Views>>...> __current)
: __current_(std::move(__current)) {}
template <bool>
@@ -260,78 +265,73 @@ class zip_view<_Views...>::__iterator : public __zip_view_iterator_category_base
public:
using iterator_concept = decltype(__get_zip_view_iterator_tag<_Const, _Views...>());
- using value_type = __tuple_or_pair<range_value_t<__maybe_const<_Const, _Views>>...>;
- using difference_type = common_type_t<range_difference_t<__maybe_const<_Const, _Views>>...>;
+ using value_type = __tuple_or_pair<range_value_t<__maybe_const<_Const, _Views>>...>;
+ using difference_type = common_type_t<range_difference_t<__maybe_const<_Const, _Views>>...>;
- _LIBCPP_HIDE_FROM_ABI
- __iterator() = default;
+ _LIBCPP_HIDE_FROM_ABI __iterator() = default;
- _LIBCPP_HIDE_FROM_ABI
- constexpr __iterator(__iterator<!_Const> __i)
+ _LIBCPP_HIDE_FROM_ABI constexpr __iterator(__iterator<!_Const> __i)
requires _Const && (convertible_to<iterator_t<_Views>, iterator_t<__maybe_const<_Const, _Views>>> && ...)
- : __current_(std::move(__i.__current_)) {}
+ : __current_(std::move(__i.__current_)) {}
- _LIBCPP_HIDE_FROM_ABI
- constexpr auto operator*() const {
+ _LIBCPP_HIDE_FROM_ABI constexpr auto operator*() const {
return ranges::__tuple_transform([](auto& __i) -> decltype(auto) { return *__i; }, __current_);
}
- _LIBCPP_HIDE_FROM_ABI
- constexpr __iterator& operator++() {
+ _LIBCPP_HIDE_FROM_ABI constexpr __iterator& operator++() {
ranges::__tuple_for_each([](auto& __i) { ++__i; }, __current_);
return *this;
}
- _LIBCPP_HIDE_FROM_ABI
- constexpr void operator++(int) { ++*this; }
+ _LIBCPP_HIDE_FROM_ABI constexpr void operator++(int) { ++*this; }
- _LIBCPP_HIDE_FROM_ABI
- constexpr __iterator operator++(int)
- requires __zip_all_forward<_Const, _Views...> {
+ _LIBCPP_HIDE_FROM_ABI constexpr __iterator operator++(int)
+ requires __zip_all_forward<_Const, _Views...>
+ {
auto __tmp = *this;
++*this;
return __tmp;
}
- _LIBCPP_HIDE_FROM_ABI
- constexpr __iterator& operator--()
- requires __zip_all_bidirectional<_Const, _Views...> {
+ _LIBCPP_HIDE_FROM_ABI constexpr __iterator& operator--()
+ requires __zip_all_bidirectional<_Const, _Views...>
+ {
ranges::__tuple_for_each([](auto& __i) { --__i; }, __current_);
return *this;
}
- _LIBCPP_HIDE_FROM_ABI
- constexpr __iterator operator--(int)
- requires __zip_all_bidirectional<_Const, _Views...> {
+ _LIBCPP_HIDE_FROM_ABI constexpr __iterator operator--(int)
+ requires __zip_all_bidirectional<_Const, _Views...>
+ {
auto __tmp = *this;
--*this;
return __tmp;
}
- _LIBCPP_HIDE_FROM_ABI
- constexpr __iterator& operator+=(difference_type __x)
- requires __zip_all_random_access<_Const, _Views...> {
+ _LIBCPP_HIDE_FROM_ABI constexpr __iterator& operator+=(difference_type __x)
+ requires __zip_all_random_access<_Const, _Views...>
+ {
ranges::__tuple_for_each([&]<class _Iter>(_Iter& __i) { __i += iter_difference_t<_Iter>(__x); }, __current_);
return *this;
}
- _LIBCPP_HIDE_FROM_ABI
- constexpr __iterator& operator-=(difference_type __x)
- requires __zip_all_random_access<_Const, _Views...> {
+ _LIBCPP_HIDE_FROM_ABI constexpr __iterator& operator-=(difference_type __x)
+ requires __zip_all_random_access<_Const, _Views...>
+ {
ranges::__tuple_for_each([&]<class _Iter>(_Iter& __i) { __i -= iter_difference_t<_Iter>(__x); }, __current_);
return *this;
}
- _LIBCPP_HIDE_FROM_ABI
- constexpr auto operator[](difference_type __n) const
- requires __zip_all_random_access<_Const, _Views...> {
+ _LIBCPP_HIDE_FROM_ABI constexpr auto operator[](difference_type __n) const
+ requires __zip_all_random_access<_Const, _Views...>
+ {
return ranges::__tuple_transform(
[&]<class _Iter>(_Iter& __i) -> decltype(auto) { return __i[iter_difference_t<_Iter>(__n)]; }, __current_);
}
- _LIBCPP_HIDE_FROM_ABI
- friend constexpr bool operator==(const __iterator& __x, const __iterator& __y)
- requires(equality_comparable<iterator_t<__maybe_const<_Const, _Views>>> && ...) {
+ _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator==(const __iterator& __x, const __iterator& __y)
+ requires(equality_comparable<iterator_t<__maybe_const<_Const, _Views>>> && ...)
+ {
if constexpr (__zip_all_bidirectional<_Const, _Views...>) {
return __x.__current_ == __y.__current_;
} else {
@@ -339,85 +339,85 @@ public:
}
}
- _LIBCPP_HIDE_FROM_ABI
- friend constexpr bool operator<(const __iterator& __x, const __iterator& __y)
- requires __zip_all_random_access<_Const, _Views...> {
+ _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator<(const __iterator& __x, const __iterator& __y)
+ requires __zip_all_random_access<_Const, _Views...>
+ {
return __x.__current_ < __y.__current_;
}
- _LIBCPP_HIDE_FROM_ABI
- friend constexpr bool operator>(const __iterator& __x, const __iterator& __y)
- requires __zip_all_random_access<_Const, _Views...> {
+ _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator>(const __iterator& __x, const __iterator& __y)
+ requires __zip_all_random_access<_Const, _Views...>
+ {
return __y < __x;
}
- _LIBCPP_HIDE_FROM_ABI
- friend constexpr bool operator<=(const __iterator& __x, const __iterator& __y)
- requires __zip_all_random_access<_Const, _Views...> {
+ _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator<=(const __iterator& __x, const __iterator& __y)
+ requires __zip_all_random_access<_Const, _Views...>
+ {
return !(__y < __x);
}
- _LIBCPP_HIDE_FROM_ABI
- friend constexpr bool operator>=(const __iterator& __x, const __iterator& __y)
- requires __zip_all_random_access<_Const, _Views...> {
+ _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator>=(const __iterator& __x, const __iterator& __y)
+ requires __zip_all_random_access<_Const, _Views...>
+ {
return !(__x < __y);
}
- _LIBCPP_HIDE_FROM_ABI
- friend constexpr auto operator<=>(const __iterator& __x, const __iterator& __y)
+ _LIBCPP_HIDE_FROM_ABI friend constexpr auto operator<=>(const __iterator& __x, const __iterator& __y)
requires __zip_all_random_access<_Const, _Views...> &&
- (three_way_comparable<iterator_t<__maybe_const<_Const, _Views>>> && ...) {
+ (three_way_comparable<iterator_t<__maybe_const<_Const, _Views>>> && ...)
+ {
return __x.__current_ <=> __y.__current_;
}
- _LIBCPP_HIDE_FROM_ABI
- friend constexpr __iterator operator+(const __iterator& __i, difference_type __n)
- requires __zip_all_random_access<_Const, _Views...> {
+ _LIBCPP_HIDE_FROM_ABI friend constexpr __iterator operator+(const __iterator& __i, difference_type __n)
+ requires __zip_all_random_access<_Const, _Views...>
+ {
auto __r = __i;
__r += __n;
return __r;
}
- _LIBCPP_HIDE_FROM_ABI
- friend constexpr __iterator operator+(difference_type __n, const __iterator& __i)
- requires __zip_all_random_access<_Const, _Views...> {
+ _LIBCPP_HIDE_FROM_ABI friend constexpr __iterator operator+(difference_type __n, const __iterator& __i)
+ requires __zip_all_random_access<_Const, _Views...>
+ {
return __i + __n;
}
- _LIBCPP_HIDE_FROM_ABI
- friend constexpr __iterator operator-(const __iterator& __i, difference_type __n)
- requires __zip_all_random_access<_Const, _Views...> {
+ _LIBCPP_HIDE_FROM_ABI friend constexpr __iterator operator-(const __iterator& __i, difference_type __n)
+ requires __zip_all_random_access<_Const, _Views...>
+ {
auto __r = __i;
__r -= __n;
return __r;
}
- _LIBCPP_HIDE_FROM_ABI
- friend constexpr difference_type operator-(const __iterator& __x, const __iterator& __y)
+ _LIBCPP_HIDE_FROM_ABI friend constexpr difference_type operator-(const __iterator& __x, const __iterator& __y)
requires(sized_sentinel_for<iterator_t<__maybe_const<_Const, _Views>>, iterator_t<__maybe_const<_Const, _Views>>> &&
- ...) {
+ ...)
+ {
const auto __diffs = ranges::__tuple_zip_transform(minus<>(), __x.__current_, __y.__current_);
return std::apply(
[](auto... __ds) {
- return ranges::min({difference_type(__ds)...},
- [](auto __a, auto __b) { return ranges::__abs(__a) < ranges::__abs(__b); });
+ return ranges::min({difference_type(__ds)...}, [](auto __a, auto __b) {
+ return ranges::__abs(__a) < ranges::__abs(__b);
+ });
},
__diffs);
}
- _LIBCPP_HIDE_FROM_ABI
- friend constexpr auto iter_move(const __iterator& __i) noexcept(
+ _LIBCPP_HIDE_FROM_ABI friend constexpr auto iter_move(const __iterator& __i) noexcept(
(noexcept(ranges::iter_move(std::declval<const iterator_t<__maybe_const<_Const, _Views>>&>())) && ...) &&
(is_nothrow_move_constructible_v<range_rvalue_reference_t<__maybe_const<_Const, _Views>>> && ...)) {
return ranges::__tuple_transform(ranges::iter_move, __i.__current_);
}
- _LIBCPP_HIDE_FROM_ABI
- friend constexpr void iter_swap(const __iterator& __l, const __iterator& __r) noexcept(
+ _LIBCPP_HIDE_FROM_ABI friend constexpr void iter_swap(const __iterator& __l, const __iterator& __r) noexcept(
(noexcept(ranges::iter_swap(std::declval<const iterator_t<__maybe_const<_Const, _Views>>&>(),
std::declval<const iterator_t<__maybe_const<_Const, _Views>>&>())) &&
...))
- requires(indirectly_swappable<iterator_t<__maybe_const<_Const, _Views>>> && ...) {
+ requires(indirectly_swappable<iterator_t<__maybe_const<_Const, _Views>>> && ...)
+ {
ranges::__tuple_zip_for_each(ranges::iter_swap, __l.__current_, __r.__current_);
}
};
@@ -426,11 +426,11 @@ template <input_range... _Views>
requires(view<_Views> && ...) && (sizeof...(_Views) > 0)
template <bool _Const>
class zip_view<_Views...>::__sentinel {
-
__tuple_or_pair<sentinel_t<__maybe_const<_Const, _Views>>...> __end_;
- _LIBCPP_HIDE_FROM_ABI
- constexpr explicit __sentinel(__tuple_or_pair<sentinel_t<__maybe_const<_Const, _Views>>...> __end) : __end_(__end) {}
+ _LIBCPP_HIDE_FROM_ABI constexpr explicit __sentinel(
+ __tuple_or_pair<sentinel_t<__maybe_const<_Const, _Views>>...> __end)
+ : __end_(__end) {}
friend class zip_view<_Views...>;
@@ -442,13 +442,11 @@ class zip_view<_Views...>::__sentinel {
}
public:
- _LIBCPP_HIDE_FROM_ABI
- __sentinel() = default;
+ _LIBCPP_HIDE_FROM_ABI __sentinel() = default;
- _LIBCPP_HIDE_FROM_ABI
- constexpr __sentinel(__sentinel<!_Const> __i)
+ _LIBCPP_HIDE_FROM_ABI constexpr __sentinel(__sentinel<!_Const> __i)
requires _Const && (convertible_to<sentinel_t<_Views>, sentinel_t<__maybe_const<_Const, _Views>>> && ...)
- : __end_(std::move(__i.__end_)) {}
+ : __end_(std::move(__i.__end_)) {}
template <bool _OtherConst>
requires(sentinel_for<sentinel_t<__maybe_const<_Const, _Views>>, iterator_t<__maybe_const<_OtherConst, _Views>>> &&
@@ -467,8 +465,9 @@ public:
return std::apply(
[](auto... __ds) {
using _Diff = common_type_t<range_difference_t<__maybe_const<_OtherConst, _Views>>...>;
- return ranges::min({_Diff(__ds)...},
- [](auto __a, auto __b) { return ranges::__abs(__a) < ranges::__abs(__b); });
+ return ranges::min({_Diff(__ds)...}, [](auto __a, auto __b) {
+ return ranges::__abs(__a) < ranges::__abs(__b);
+ });
},
__diffs);
}
@@ -502,7 +501,7 @@ struct __fn {
} // namespace __zip
inline namespace __cpo {
- inline constexpr auto zip = __zip::__fn{};
+inline constexpr auto zip = __zip::__fn{};
} // namespace __cpo
} // namespace views
} // namespace ranges
diff --git a/contrib/llvm-project/libcxx/include/__split_buffer b/contrib/llvm-project/libcxx/include/__split_buffer
index 07dedba5e801..aaf955685d2d 100644
--- a/contrib/llvm-project/libcxx/include/__split_buffer
+++ b/contrib/llvm-project/libcxx/include/__split_buffer
@@ -43,7 +43,6 @@
_LIBCPP_PUSH_MACROS
#include <__undef_macros>
-
_LIBCPP_BEGIN_NAMESPACE_STD
// __split_buffer allocates a contiguous chunk of memory and stores objects in the range [__begin_, __end_).
@@ -51,8 +50,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
// it to grow both in the front and back without having to move the data.
template <class _Tp, class _Allocator = allocator<_Tp> >
-struct __split_buffer
-{
+struct __split_buffer {
public:
using value_type = _Tp;
using allocator_type = _Allocator;
@@ -75,7 +73,7 @@ public:
using __alloc_ref = __add_lvalue_reference_t<allocator_type>;
using __alloc_const_ref = __add_lvalue_reference_t<allocator_type>;
- __split_buffer(const __split_buffer&) = delete;
+ __split_buffer(const __split_buffer&) = delete;
__split_buffer& operator=(const __split_buffer&) = delete;
_LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI __split_buffer()
@@ -161,20 +159,19 @@ public:
_LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __construct_at_end(size_type __n, const_reference __x);
template <class _InputIter, __enable_if_t<__has_exactly_input_iterator_category<_InputIter>::value, int> = 0>
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI
- void __construct_at_end(_InputIter __first, _InputIter __last);
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __construct_at_end(_InputIter __first, _InputIter __last);
template <class _ForwardIterator, __enable_if_t<__has_forward_iterator_category<_ForwardIterator>::value, int> = 0>
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI
- void __construct_at_end(_ForwardIterator __first, _ForwardIterator __last);
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void
+ __construct_at_end(_ForwardIterator __first, _ForwardIterator __last);
template <class _Iterator, class _Sentinel>
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI
- void __construct_at_end_with_sentinel(_Iterator __first, _Sentinel __last);
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void
+ __construct_at_end_with_sentinel(_Iterator __first, _Sentinel __last);
template <class _Iterator>
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI
- void __construct_at_end_with_size(_Iterator __first, size_type __n);
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void
+ __construct_at_end_with_size(_Iterator __first, size_type __n);
_LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __destruct_at_begin(pointer __new_begin) {
__destruct_at_begin(__new_begin, is_trivially_destructible<value_type>());
@@ -221,29 +218,23 @@ private:
};
template <class _Tp, class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-bool
-__split_buffer<_Tp, _Allocator>::__invariants() const
-{
- if (__first_ == nullptr)
- {
- if (__begin_ != nullptr)
- return false;
- if (__end_ != nullptr)
- return false;
- if (__end_cap() != nullptr)
- return false;
- }
- else
- {
- if (__begin_ < __first_)
- return false;
- if (__end_ < __begin_)
- return false;
- if (__end_cap() < __end_)
- return false;
- }
- return true;
+_LIBCPP_CONSTEXPR_SINCE_CXX20 bool __split_buffer<_Tp, _Allocator>::__invariants() const {
+ if (__first_ == nullptr) {
+ if (__begin_ != nullptr)
+ return false;
+ if (__end_ != nullptr)
+ return false;
+ if (__end_cap() != nullptr)
+ return false;
+ } else {
+ if (__begin_ < __first_)
+ return false;
+ if (__end_ < __begin_)
+ return false;
+ if (__end_cap() < __end_)
+ return false;
+ }
+ return true;
}
// Default constructs __n objects starting at __end_
@@ -252,14 +243,11 @@ __split_buffer<_Tp, _Allocator>::__invariants() const
// Precondition: size() + __n <= capacity()
// Postcondition: size() == size() + __n
template <class _Tp, class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-void
-__split_buffer<_Tp, _Allocator>::__construct_at_end(size_type __n)
-{
- _ConstructTransaction __tx(&this->__end_, __n);
- for (; __tx.__pos_ != __tx.__end_; ++__tx.__pos_) {
- __alloc_traits::construct(this->__alloc(), std::__to_address(__tx.__pos_));
- }
+_LIBCPP_CONSTEXPR_SINCE_CXX20 void __split_buffer<_Tp, _Allocator>::__construct_at_end(size_type __n) {
+ _ConstructTransaction __tx(&this->__end_, __n);
+ for (; __tx.__pos_ != __tx.__end_; ++__tx.__pos_) {
+ __alloc_traits::construct(this->__alloc(), std::__to_address(__tx.__pos_));
+ }
}
// Copy constructs __n objects starting at __end_ from __x
@@ -269,413 +257,315 @@ __split_buffer<_Tp, _Allocator>::__construct_at_end(size_type __n)
// Postcondition: size() == old size() + __n
// Postcondition: [i] == __x for all i in [size() - __n, __n)
template <class _Tp, class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-void
-__split_buffer<_Tp, _Allocator>::__construct_at_end(size_type __n, const_reference __x)
-{
- _ConstructTransaction __tx(&this->__end_, __n);
- for (; __tx.__pos_ != __tx.__end_; ++__tx.__pos_) {
- __alloc_traits::construct(this->__alloc(),
- std::__to_address(__tx.__pos_), __x);
- }
+_LIBCPP_CONSTEXPR_SINCE_CXX20 void
+__split_buffer<_Tp, _Allocator>::__construct_at_end(size_type __n, const_reference __x) {
+ _ConstructTransaction __tx(&this->__end_, __n);
+ for (; __tx.__pos_ != __tx.__end_; ++__tx.__pos_) {
+ __alloc_traits::construct(this->__alloc(), std::__to_address(__tx.__pos_), __x);
+ }
}
template <class _Tp, class _Allocator>
template <class _InputIter, __enable_if_t<__has_exactly_input_iterator_category<_InputIter>::value, int> >
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-void __split_buffer<_Tp, _Allocator>::__construct_at_end(_InputIter __first, _InputIter __last)
-{
+_LIBCPP_CONSTEXPR_SINCE_CXX20 void
+__split_buffer<_Tp, _Allocator>::__construct_at_end(_InputIter __first, _InputIter __last) {
__construct_at_end_with_sentinel(__first, __last);
}
template <class _Tp, class _Allocator>
template <class _Iterator, class _Sentinel>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-void __split_buffer<_Tp, _Allocator>::__construct_at_end_with_sentinel(_Iterator __first, _Sentinel __last) {
- __alloc_rr& __a = this->__alloc();
- for (; __first != __last; ++__first)
- {
- if (__end_ == __end_cap())
- {
- size_type __old_cap = __end_cap() - __first_;
- size_type __new_cap = std::max<size_type>(2 * __old_cap, 8);
- __split_buffer __buf(__new_cap, 0, __a);
- for (pointer __p = __begin_; __p != __end_; ++__p, (void) ++__buf.__end_)
- __alloc_traits::construct(__buf.__alloc(),
- std::__to_address(__buf.__end_), std::move(*__p));
- swap(__buf);
- }
- __alloc_traits::construct(__a, std::__to_address(this->__end_), *__first);
- ++this->__end_;
+_LIBCPP_CONSTEXPR_SINCE_CXX20 void
+__split_buffer<_Tp, _Allocator>::__construct_at_end_with_sentinel(_Iterator __first, _Sentinel __last) {
+ __alloc_rr& __a = this->__alloc();
+ for (; __first != __last; ++__first) {
+ if (__end_ == __end_cap()) {
+ size_type __old_cap = __end_cap() - __first_;
+ size_type __new_cap = std::max<size_type>(2 * __old_cap, 8);
+ __split_buffer __buf(__new_cap, 0, __a);
+ for (pointer __p = __begin_; __p != __end_; ++__p, (void)++__buf.__end_)
+ __alloc_traits::construct(__buf.__alloc(), std::__to_address(__buf.__end_), std::move(*__p));
+ swap(__buf);
}
+ __alloc_traits::construct(__a, std::__to_address(this->__end_), *__first);
+ ++this->__end_;
+ }
}
template <class _Tp, class _Allocator>
template <class _ForwardIterator, __enable_if_t<__has_forward_iterator_category<_ForwardIterator>::value, int> >
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-void __split_buffer<_Tp, _Allocator>::__construct_at_end(_ForwardIterator __first, _ForwardIterator __last)
-{
+_LIBCPP_CONSTEXPR_SINCE_CXX20 void
+__split_buffer<_Tp, _Allocator>::__construct_at_end(_ForwardIterator __first, _ForwardIterator __last) {
__construct_at_end_with_size(__first, std::distance(__first, __last));
}
template <class _Tp, class _Allocator>
template <class _ForwardIterator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-void __split_buffer<_Tp, _Allocator>::__construct_at_end_with_size(_ForwardIterator __first, size_type __n) {
- _ConstructTransaction __tx(&this->__end_, __n);
- for (; __tx.__pos_ != __tx.__end_; ++__tx.__pos_, (void) ++__first) {
- __alloc_traits::construct(this->__alloc(),
- std::__to_address(__tx.__pos_), *__first);
- }
+_LIBCPP_CONSTEXPR_SINCE_CXX20 void
+__split_buffer<_Tp, _Allocator>::__construct_at_end_with_size(_ForwardIterator __first, size_type __n) {
+ _ConstructTransaction __tx(&this->__end_, __n);
+ for (; __tx.__pos_ != __tx.__end_; ++__tx.__pos_, (void)++__first) {
+ __alloc_traits::construct(this->__alloc(), std::__to_address(__tx.__pos_), *__first);
+ }
}
template <class _Tp, class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-inline
-void
-__split_buffer<_Tp, _Allocator>::__destruct_at_begin(pointer __new_begin, false_type)
-{
- while (__begin_ != __new_begin)
- __alloc_traits::destroy(__alloc(), std::__to_address(__begin_++));
+_LIBCPP_CONSTEXPR_SINCE_CXX20 inline void
+__split_buffer<_Tp, _Allocator>::__destruct_at_begin(pointer __new_begin, false_type) {
+ while (__begin_ != __new_begin)
+ __alloc_traits::destroy(__alloc(), std::__to_address(__begin_++));
}
template <class _Tp, class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-inline
-void
-__split_buffer<_Tp, _Allocator>::__destruct_at_begin(pointer __new_begin, true_type)
-{
- __begin_ = __new_begin;
+_LIBCPP_CONSTEXPR_SINCE_CXX20 inline void
+__split_buffer<_Tp, _Allocator>::__destruct_at_begin(pointer __new_begin, true_type) {
+ __begin_ = __new_begin;
}
template <class _Tp, class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-inline _LIBCPP_HIDE_FROM_ABI
-void
-__split_buffer<_Tp, _Allocator>::__destruct_at_end(pointer __new_last, false_type) _NOEXCEPT
-{
- while (__new_last != __end_)
- __alloc_traits::destroy(__alloc(), std::__to_address(--__end_));
+_LIBCPP_CONSTEXPR_SINCE_CXX20 inline _LIBCPP_HIDE_FROM_ABI void
+__split_buffer<_Tp, _Allocator>::__destruct_at_end(pointer __new_last, false_type) _NOEXCEPT {
+ while (__new_last != __end_)
+ __alloc_traits::destroy(__alloc(), std::__to_address(--__end_));
}
template <class _Tp, class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-inline _LIBCPP_HIDE_FROM_ABI
-void
-__split_buffer<_Tp, _Allocator>::__destruct_at_end(pointer __new_last, true_type) _NOEXCEPT
-{
- __end_ = __new_last;
+_LIBCPP_CONSTEXPR_SINCE_CXX20 inline _LIBCPP_HIDE_FROM_ABI void
+__split_buffer<_Tp, _Allocator>::__destruct_at_end(pointer __new_last, true_type) _NOEXCEPT {
+ __end_ = __new_last;
}
template <class _Tp, class _Allocator>
_LIBCPP_CONSTEXPR_SINCE_CXX20
__split_buffer<_Tp, _Allocator>::__split_buffer(size_type __cap, size_type __start, __alloc_rr& __a)
- : __end_cap_(nullptr, __a)
-{
- if (__cap == 0) {
- __first_ = nullptr;
- } else {
- auto __allocation = std::__allocate_at_least(__alloc(), __cap);
- __first_ = __allocation.ptr;
- __cap = __allocation.count;
- }
- __begin_ = __end_ = __first_ + __start;
- __end_cap() = __first_ + __cap;
+ : __end_cap_(nullptr, __a) {
+ if (__cap == 0) {
+ __first_ = nullptr;
+ } else {
+ auto __allocation = std::__allocate_at_least(__alloc(), __cap);
+ __first_ = __allocation.ptr;
+ __cap = __allocation.count;
+ }
+ __begin_ = __end_ = __first_ + __start;
+ __end_cap() = __first_ + __cap;
}
template <class _Tp, class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-__split_buffer<_Tp, _Allocator>::~__split_buffer()
-{
- clear();
- if (__first_)
- __alloc_traits::deallocate(__alloc(), __first_, capacity());
+_LIBCPP_CONSTEXPR_SINCE_CXX20 __split_buffer<_Tp, _Allocator>::~__split_buffer() {
+ clear();
+ if (__first_)
+ __alloc_traits::deallocate(__alloc(), __first_, capacity());
}
template <class _Tp, class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-__split_buffer<_Tp, _Allocator>::__split_buffer(__split_buffer&& __c)
+_LIBCPP_CONSTEXPR_SINCE_CXX20 __split_buffer<_Tp, _Allocator>::__split_buffer(__split_buffer&& __c)
_NOEXCEPT_(is_nothrow_move_constructible<allocator_type>::value)
: __first_(std::move(__c.__first_)),
__begin_(std::move(__c.__begin_)),
__end_(std::move(__c.__end_)),
- __end_cap_(std::move(__c.__end_cap_))
-{
- __c.__first_ = nullptr;
- __c.__begin_ = nullptr;
- __c.__end_ = nullptr;
- __c.__end_cap() = nullptr;
+ __end_cap_(std::move(__c.__end_cap_)) {
+ __c.__first_ = nullptr;
+ __c.__begin_ = nullptr;
+ __c.__end_ = nullptr;
+ __c.__end_cap() = nullptr;
}
template <class _Tp, class _Allocator>
_LIBCPP_CONSTEXPR_SINCE_CXX20
__split_buffer<_Tp, _Allocator>::__split_buffer(__split_buffer&& __c, const __alloc_rr& __a)
- : __end_cap_(nullptr, __a)
-{
- if (__a == __c.__alloc())
- {
- __first_ = __c.__first_;
- __begin_ = __c.__begin_;
- __end_ = __c.__end_;
- __end_cap() = __c.__end_cap();
- __c.__first_ = nullptr;
- __c.__begin_ = nullptr;
- __c.__end_ = nullptr;
- __c.__end_cap() = nullptr;
- }
- else
- {
- auto __allocation = std::__allocate_at_least(__alloc(), __c.size());
- __first_ = __allocation.ptr;
- __begin_ = __end_ = __first_;
- __end_cap() = __first_ + __allocation.count;
- typedef move_iterator<iterator> _Ip;
- __construct_at_end(_Ip(__c.begin()), _Ip(__c.end()));
- }
+ : __end_cap_(nullptr, __a) {
+ if (__a == __c.__alloc()) {
+ __first_ = __c.__first_;
+ __begin_ = __c.__begin_;
+ __end_ = __c.__end_;
+ __end_cap() = __c.__end_cap();
+ __c.__first_ = nullptr;
+ __c.__begin_ = nullptr;
+ __c.__end_ = nullptr;
+ __c.__end_cap() = nullptr;
+ } else {
+ auto __allocation = std::__allocate_at_least(__alloc(), __c.size());
+ __first_ = __allocation.ptr;
+ __begin_ = __end_ = __first_;
+ __end_cap() = __first_ + __allocation.count;
+ typedef move_iterator<iterator> _Ip;
+ __construct_at_end(_Ip(__c.begin()), _Ip(__c.end()));
+ }
}
template <class _Tp, class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-__split_buffer<_Tp, _Allocator>&
+_LIBCPP_CONSTEXPR_SINCE_CXX20 __split_buffer<_Tp, _Allocator>&
__split_buffer<_Tp, _Allocator>::operator=(__split_buffer&& __c)
_NOEXCEPT_((__alloc_traits::propagate_on_container_move_assignment::value &&
is_nothrow_move_assignable<allocator_type>::value) ||
- !__alloc_traits::propagate_on_container_move_assignment::value)
-{
- clear();
- shrink_to_fit();
- __first_ = __c.__first_;
- __begin_ = __c.__begin_;
- __end_ = __c.__end_;
- __end_cap() = __c.__end_cap();
- __move_assign_alloc(__c,
- integral_constant<bool,
- __alloc_traits::propagate_on_container_move_assignment::value>());
- __c.__first_ = __c.__begin_ = __c.__end_ = __c.__end_cap() = nullptr;
- return *this;
+ !__alloc_traits::propagate_on_container_move_assignment::value) {
+ clear();
+ shrink_to_fit();
+ __first_ = __c.__first_;
+ __begin_ = __c.__begin_;
+ __end_ = __c.__end_;
+ __end_cap() = __c.__end_cap();
+ __move_assign_alloc(__c, integral_constant<bool, __alloc_traits::propagate_on_container_move_assignment::value>());
+ __c.__first_ = __c.__begin_ = __c.__end_ = __c.__end_cap() = nullptr;
+ return *this;
}
template <class _Tp, class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-void
-__split_buffer<_Tp, _Allocator>::swap(__split_buffer& __x)
- _NOEXCEPT_(!__alloc_traits::propagate_on_container_swap::value||
- __is_nothrow_swappable<__alloc_rr>::value)
-{
- std::swap(__first_, __x.__first_);
- std::swap(__begin_, __x.__begin_);
- std::swap(__end_, __x.__end_);
- std::swap(__end_cap(), __x.__end_cap());
- std::__swap_allocator(__alloc(), __x.__alloc());
+_LIBCPP_CONSTEXPR_SINCE_CXX20 void __split_buffer<_Tp, _Allocator>::swap(__split_buffer& __x)
+ _NOEXCEPT_(!__alloc_traits::propagate_on_container_swap::value || __is_nothrow_swappable<__alloc_rr>::value) {
+ std::swap(__first_, __x.__first_);
+ std::swap(__begin_, __x.__begin_);
+ std::swap(__end_, __x.__end_);
+ std::swap(__end_cap(), __x.__end_cap());
+ std::__swap_allocator(__alloc(), __x.__alloc());
}
template <class _Tp, class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-void
-__split_buffer<_Tp, _Allocator>::reserve(size_type __n)
-{
- if (__n < capacity())
- {
- __split_buffer<value_type, __alloc_rr&> __t(__n, 0, __alloc());
- __t.__construct_at_end(move_iterator<pointer>(__begin_),
- move_iterator<pointer>(__end_));
- std::swap(__first_, __t.__first_);
- std::swap(__begin_, __t.__begin_);
- std::swap(__end_, __t.__end_);
- std::swap(__end_cap(), __t.__end_cap());
- }
+_LIBCPP_CONSTEXPR_SINCE_CXX20 void __split_buffer<_Tp, _Allocator>::reserve(size_type __n) {
+ if (__n < capacity()) {
+ __split_buffer<value_type, __alloc_rr&> __t(__n, 0, __alloc());
+ __t.__construct_at_end(move_iterator<pointer>(__begin_), move_iterator<pointer>(__end_));
+ std::swap(__first_, __t.__first_);
+ std::swap(__begin_, __t.__begin_);
+ std::swap(__end_, __t.__end_);
+ std::swap(__end_cap(), __t.__end_cap());
+ }
}
template <class _Tp, class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-void
-__split_buffer<_Tp, _Allocator>::shrink_to_fit() _NOEXCEPT
-{
- if (capacity() > size())
- {
+_LIBCPP_CONSTEXPR_SINCE_CXX20 void __split_buffer<_Tp, _Allocator>::shrink_to_fit() _NOEXCEPT {
+ if (capacity() > size()) {
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- try
- {
+ try {
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- __split_buffer<value_type, __alloc_rr&> __t(size(), 0, __alloc());
- __t.__construct_at_end(move_iterator<pointer>(__begin_),
- move_iterator<pointer>(__end_));
- __t.__end_ = __t.__begin_ + (__end_ - __begin_);
- std::swap(__first_, __t.__first_);
- std::swap(__begin_, __t.__begin_);
- std::swap(__end_, __t.__end_);
- std::swap(__end_cap(), __t.__end_cap());
+ __split_buffer<value_type, __alloc_rr&> __t(size(), 0, __alloc());
+ __t.__construct_at_end(move_iterator<pointer>(__begin_), move_iterator<pointer>(__end_));
+ __t.__end_ = __t.__begin_ + (__end_ - __begin_);
+ std::swap(__first_, __t.__first_);
+ std::swap(__begin_, __t.__begin_);
+ std::swap(__end_, __t.__end_);
+ std::swap(__end_cap(), __t.__end_cap());
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- }
- catch (...)
- {
- }
-#endif // _LIBCPP_HAS_NO_EXCEPTIONS
+ } catch (...) {
}
+#endif // _LIBCPP_HAS_NO_EXCEPTIONS
+ }
}
template <class _Tp, class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-void
-__split_buffer<_Tp, _Allocator>::push_front(const_reference __x)
-{
- if (__begin_ == __first_)
- {
- if (__end_ < __end_cap())
- {
- difference_type __d = __end_cap() - __end_;
- __d = (__d + 1) / 2;
- __begin_ = std::move_backward(__begin_, __end_, __end_ + __d);
- __end_ += __d;
- }
- else
- {
- size_type __c = std::max<size_type>(2 * static_cast<size_t>(__end_cap() - __first_), 1);
- __split_buffer<value_type, __alloc_rr&> __t(__c, (__c + 3) / 4, __alloc());
- __t.__construct_at_end(move_iterator<pointer>(__begin_),
- move_iterator<pointer>(__end_));
- std::swap(__first_, __t.__first_);
- std::swap(__begin_, __t.__begin_);
- std::swap(__end_, __t.__end_);
- std::swap(__end_cap(), __t.__end_cap());
- }
+_LIBCPP_CONSTEXPR_SINCE_CXX20 void __split_buffer<_Tp, _Allocator>::push_front(const_reference __x) {
+ if (__begin_ == __first_) {
+ if (__end_ < __end_cap()) {
+ difference_type __d = __end_cap() - __end_;
+ __d = (__d + 1) / 2;
+ __begin_ = std::move_backward(__begin_, __end_, __end_ + __d);
+ __end_ += __d;
+ } else {
+ size_type __c = std::max<size_type>(2 * static_cast<size_t>(__end_cap() - __first_), 1);
+ __split_buffer<value_type, __alloc_rr&> __t(__c, (__c + 3) / 4, __alloc());
+ __t.__construct_at_end(move_iterator<pointer>(__begin_), move_iterator<pointer>(__end_));
+ std::swap(__first_, __t.__first_);
+ std::swap(__begin_, __t.__begin_);
+ std::swap(__end_, __t.__end_);
+ std::swap(__end_cap(), __t.__end_cap());
}
- __alloc_traits::construct(__alloc(), std::__to_address(__begin_-1), __x);
- --__begin_;
+ }
+ __alloc_traits::construct(__alloc(), std::__to_address(__begin_ - 1), __x);
+ --__begin_;
}
template <class _Tp, class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-void
-__split_buffer<_Tp, _Allocator>::push_front(value_type&& __x)
-{
- if (__begin_ == __first_)
- {
- if (__end_ < __end_cap())
- {
- difference_type __d = __end_cap() - __end_;
- __d = (__d + 1) / 2;
- __begin_ = std::move_backward(__begin_, __end_, __end_ + __d);
- __end_ += __d;
- }
- else
- {
- size_type __c = std::max<size_type>(2 * static_cast<size_t>(__end_cap() - __first_), 1);
- __split_buffer<value_type, __alloc_rr&> __t(__c, (__c + 3) / 4, __alloc());
- __t.__construct_at_end(move_iterator<pointer>(__begin_),
- move_iterator<pointer>(__end_));
- std::swap(__first_, __t.__first_);
- std::swap(__begin_, __t.__begin_);
- std::swap(__end_, __t.__end_);
- std::swap(__end_cap(), __t.__end_cap());
- }
+_LIBCPP_CONSTEXPR_SINCE_CXX20 void __split_buffer<_Tp, _Allocator>::push_front(value_type&& __x) {
+ if (__begin_ == __first_) {
+ if (__end_ < __end_cap()) {
+ difference_type __d = __end_cap() - __end_;
+ __d = (__d + 1) / 2;
+ __begin_ = std::move_backward(__begin_, __end_, __end_ + __d);
+ __end_ += __d;
+ } else {
+ size_type __c = std::max<size_type>(2 * static_cast<size_t>(__end_cap() - __first_), 1);
+ __split_buffer<value_type, __alloc_rr&> __t(__c, (__c + 3) / 4, __alloc());
+ __t.__construct_at_end(move_iterator<pointer>(__begin_), move_iterator<pointer>(__end_));
+ std::swap(__first_, __t.__first_);
+ std::swap(__begin_, __t.__begin_);
+ std::swap(__end_, __t.__end_);
+ std::swap(__end_cap(), __t.__end_cap());
}
- __alloc_traits::construct(__alloc(), std::__to_address(__begin_-1),
- std::move(__x));
- --__begin_;
+ }
+ __alloc_traits::construct(__alloc(), std::__to_address(__begin_ - 1), std::move(__x));
+ --__begin_;
}
template <class _Tp, class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-inline _LIBCPP_HIDE_FROM_ABI
-void
-__split_buffer<_Tp, _Allocator>::push_back(const_reference __x)
-{
- if (__end_ == __end_cap())
- {
- if (__begin_ > __first_)
- {
- difference_type __d = __begin_ - __first_;
- __d = (__d + 1) / 2;
- __end_ = std::move(__begin_, __end_, __begin_ - __d);
- __begin_ -= __d;
- }
- else
- {
- size_type __c = std::max<size_type>(2 * static_cast<size_t>(__end_cap() - __first_), 1);
- __split_buffer<value_type, __alloc_rr&> __t(__c, __c / 4, __alloc());
- __t.__construct_at_end(move_iterator<pointer>(__begin_),
- move_iterator<pointer>(__end_));
- std::swap(__first_, __t.__first_);
- std::swap(__begin_, __t.__begin_);
- std::swap(__end_, __t.__end_);
- std::swap(__end_cap(), __t.__end_cap());
- }
+_LIBCPP_CONSTEXPR_SINCE_CXX20 inline _LIBCPP_HIDE_FROM_ABI void
+__split_buffer<_Tp, _Allocator>::push_back(const_reference __x) {
+ if (__end_ == __end_cap()) {
+ if (__begin_ > __first_) {
+ difference_type __d = __begin_ - __first_;
+ __d = (__d + 1) / 2;
+ __end_ = std::move(__begin_, __end_, __begin_ - __d);
+ __begin_ -= __d;
+ } else {
+ size_type __c = std::max<size_type>(2 * static_cast<size_t>(__end_cap() - __first_), 1);
+ __split_buffer<value_type, __alloc_rr&> __t(__c, __c / 4, __alloc());
+ __t.__construct_at_end(move_iterator<pointer>(__begin_), move_iterator<pointer>(__end_));
+ std::swap(__first_, __t.__first_);
+ std::swap(__begin_, __t.__begin_);
+ std::swap(__end_, __t.__end_);
+ std::swap(__end_cap(), __t.__end_cap());
}
- __alloc_traits::construct(__alloc(), std::__to_address(__end_), __x);
- ++__end_;
+ }
+ __alloc_traits::construct(__alloc(), std::__to_address(__end_), __x);
+ ++__end_;
}
template <class _Tp, class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-void
-__split_buffer<_Tp, _Allocator>::push_back(value_type&& __x)
-{
- if (__end_ == __end_cap())
- {
- if (__begin_ > __first_)
- {
- difference_type __d = __begin_ - __first_;
- __d = (__d + 1) / 2;
- __end_ = std::move(__begin_, __end_, __begin_ - __d);
- __begin_ -= __d;
- }
- else
- {
- size_type __c = std::max<size_type>(2 * static_cast<size_t>(__end_cap() - __first_), 1);
- __split_buffer<value_type, __alloc_rr&> __t(__c, __c / 4, __alloc());
- __t.__construct_at_end(move_iterator<pointer>(__begin_),
- move_iterator<pointer>(__end_));
- std::swap(__first_, __t.__first_);
- std::swap(__begin_, __t.__begin_);
- std::swap(__end_, __t.__end_);
- std::swap(__end_cap(), __t.__end_cap());
- }
+_LIBCPP_CONSTEXPR_SINCE_CXX20 void __split_buffer<_Tp, _Allocator>::push_back(value_type&& __x) {
+ if (__end_ == __end_cap()) {
+ if (__begin_ > __first_) {
+ difference_type __d = __begin_ - __first_;
+ __d = (__d + 1) / 2;
+ __end_ = std::move(__begin_, __end_, __begin_ - __d);
+ __begin_ -= __d;
+ } else {
+ size_type __c = std::max<size_type>(2 * static_cast<size_t>(__end_cap() - __first_), 1);
+ __split_buffer<value_type, __alloc_rr&> __t(__c, __c / 4, __alloc());
+ __t.__construct_at_end(move_iterator<pointer>(__begin_), move_iterator<pointer>(__end_));
+ std::swap(__first_, __t.__first_);
+ std::swap(__begin_, __t.__begin_);
+ std::swap(__end_, __t.__end_);
+ std::swap(__end_cap(), __t.__end_cap());
}
- __alloc_traits::construct(__alloc(), std::__to_address(__end_),
- std::move(__x));
- ++__end_;
+ }
+ __alloc_traits::construct(__alloc(), std::__to_address(__end_), std::move(__x));
+ ++__end_;
}
template <class _Tp, class _Allocator>
template <class... _Args>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-void
-__split_buffer<_Tp, _Allocator>::emplace_back(_Args&&... __args)
-{
- if (__end_ == __end_cap())
- {
- if (__begin_ > __first_)
- {
- difference_type __d = __begin_ - __first_;
- __d = (__d + 1) / 2;
- __end_ = std::move(__begin_, __end_, __begin_ - __d);
- __begin_ -= __d;
- }
- else
- {
- size_type __c = std::max<size_type>(2 * static_cast<size_t>(__end_cap() - __first_), 1);
- __split_buffer<value_type, __alloc_rr&> __t(__c, __c / 4, __alloc());
- __t.__construct_at_end(move_iterator<pointer>(__begin_),
- move_iterator<pointer>(__end_));
- std::swap(__first_, __t.__first_);
- std::swap(__begin_, __t.__begin_);
- std::swap(__end_, __t.__end_);
- std::swap(__end_cap(), __t.__end_cap());
- }
+_LIBCPP_CONSTEXPR_SINCE_CXX20 void __split_buffer<_Tp, _Allocator>::emplace_back(_Args&&... __args) {
+ if (__end_ == __end_cap()) {
+ if (__begin_ > __first_) {
+ difference_type __d = __begin_ - __first_;
+ __d = (__d + 1) / 2;
+ __end_ = std::move(__begin_, __end_, __begin_ - __d);
+ __begin_ -= __d;
+ } else {
+ size_type __c = std::max<size_type>(2 * static_cast<size_t>(__end_cap() - __first_), 1);
+ __split_buffer<value_type, __alloc_rr&> __t(__c, __c / 4, __alloc());
+ __t.__construct_at_end(move_iterator<pointer>(__begin_), move_iterator<pointer>(__end_));
+ std::swap(__first_, __t.__first_);
+ std::swap(__begin_, __t.__begin_);
+ std::swap(__end_, __t.__end_);
+ std::swap(__end_cap(), __t.__end_cap());
}
- __alloc_traits::construct(__alloc(), std::__to_address(__end_),
- std::forward<_Args>(__args)...);
- ++__end_;
+ }
+ __alloc_traits::construct(__alloc(), std::__to_address(__end_), std::forward<_Args>(__args)...);
+ ++__end_;
}
template <class _Tp, class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-inline _LIBCPP_HIDE_FROM_ABI
-void
-swap(__split_buffer<_Tp, _Allocator>& __x, __split_buffer<_Tp, _Allocator>& __y)
- _NOEXCEPT_(_NOEXCEPT_(__x.swap(__y)))
-{
- __x.swap(__y);
+_LIBCPP_CONSTEXPR_SINCE_CXX20 inline _LIBCPP_HIDE_FROM_ABI void
+swap(__split_buffer<_Tp, _Allocator>& __x, __split_buffer<_Tp, _Allocator>& __y) _NOEXCEPT_(_NOEXCEPT_(__x.swap(__y))) {
+ __x.swap(__y);
}
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__string/char_traits.h b/contrib/llvm-project/libcxx/include/__string/char_traits.h
index 9ec78dc3936d..e3563c57fea0 100644
--- a/contrib/llvm-project/libcxx/include/__string/char_traits.h
+++ b/contrib/llvm-project/libcxx/include/__string/char_traits.h
@@ -27,7 +27,7 @@
#include <iosfwd>
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
-# include <cwchar> // for wmemcpy
+# include <cwchar> // for wmemcpy
#endif
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
@@ -78,210 +78,220 @@ exposition-only to document what members a char_traits specialization should pro
//
#if !defined(_LIBCPP_CHAR_TRAITS_REMOVE_BASE_SPECIALIZATION)
template <class _CharT>
-struct _LIBCPP_DEPRECATED_("char_traits<T> for T not equal to char, wchar_t, char8_t, char16_t or char32_t is non-standard and is provided for a temporary period. It will be removed in LLVM 19, so please migrate off of it.")
- char_traits
-{
- using char_type = _CharT;
- using int_type = int;
- using off_type = streamoff;
- using pos_type = streampos;
- using state_type = mbstate_t;
-
- static inline void _LIBCPP_CONSTEXPR_SINCE_CXX17 _LIBCPP_HIDE_FROM_ABI
- assign(char_type& __c1, const char_type& __c2) _NOEXCEPT {__c1 = __c2;}
- static inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool eq(char_type __c1, char_type __c2) _NOEXCEPT
- {return __c1 == __c2;}
- static inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool lt(char_type __c1, char_type __c2) _NOEXCEPT
- {return __c1 < __c2;}
-
- static _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
- int compare(const char_type* __s1, const char_type* __s2, size_t __n) {
- for (; __n; --__n, ++__s1, ++__s2)
- {
- if (lt(*__s1, *__s2))
- return -1;
- if (lt(*__s2, *__s1))
- return 1;
- }
- return 0;
- }
- _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR_SINCE_CXX17
- size_t length(const char_type* __s) {
- size_t __len = 0;
- for (; !eq(*__s, char_type(0)); ++__s)
- ++__len;
- return __len;
- }
- _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR_SINCE_CXX17
- const char_type* find(const char_type* __s, size_t __n, const char_type& __a) {
- for (; __n; --__n)
- {
- if (eq(*__s, __a))
- return __s;
- ++__s;
- }
- return nullptr;
+struct _LIBCPP_DEPRECATED_(
+ "char_traits<T> for T not equal to char, wchar_t, char8_t, char16_t or char32_t is non-standard and is provided "
+ "for a temporary period. It will be removed in LLVM 19, so please migrate off of it.") char_traits {
+ using char_type = _CharT;
+ using int_type = int;
+ using off_type = streamoff;
+ using pos_type = streampos;
+ using state_type = mbstate_t;
+
+ static inline void _LIBCPP_CONSTEXPR_SINCE_CXX17 _LIBCPP_HIDE_FROM_ABI
+ assign(char_type& __c1, const char_type& __c2) _NOEXCEPT {
+ __c1 = __c2;
+ }
+ static inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool eq(char_type __c1, char_type __c2) _NOEXCEPT {
+ return __c1 == __c2;
+ }
+ static inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool lt(char_type __c1, char_type __c2) _NOEXCEPT {
+ return __c1 < __c2;
+ }
+
+ static _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 int
+ compare(const char_type* __s1, const char_type* __s2, size_t __n) {
+ for (; __n; --__n, ++__s1, ++__s2) {
+ if (lt(*__s1, *__s2))
+ return -1;
+ if (lt(*__s2, *__s1))
+ return 1;
}
- static _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- char_type* move(char_type* __s1, const char_type* __s2, size_t __n) {
- if (__n == 0) return __s1;
- char_type* __r = __s1;
- if (__s1 < __s2)
- {
- for (; __n; --__n, ++__s1, ++__s2)
- assign(*__s1, *__s2);
- }
- else if (__s2 < __s1)
- {
- __s1 += __n;
- __s2 += __n;
- for (; __n; --__n)
- assign(*--__s1, *--__s2);
- }
- return __r;
+ return 0;
+ }
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR_SINCE_CXX17 size_t length(const char_type* __s) {
+ size_t __len = 0;
+ for (; !eq(*__s, char_type(0)); ++__s)
+ ++__len;
+ return __len;
+ }
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR_SINCE_CXX17 const char_type*
+ find(const char_type* __s, size_t __n, const char_type& __a) {
+ for (; __n; --__n) {
+ if (eq(*__s, __a))
+ return __s;
+ ++__s;
}
- _LIBCPP_HIDE_FROM_ABI
- static _LIBCPP_CONSTEXPR_SINCE_CXX20
- char_type* copy(char_type* __s1, const char_type* __s2, size_t __n) {
- _LIBCPP_ASSERT_NON_OVERLAPPING_RANGES(!std::__is_pointer_in_range(__s1, __s1 + __n, __s2),
- "char_traits::copy: source and destination ranges overlap");
- char_type* __r = __s1;
+ return nullptr;
+ }
+ static _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 char_type*
+ move(char_type* __s1, const char_type* __s2, size_t __n) {
+ if (__n == 0)
+ return __s1;
+ char_type* __r = __s1;
+ if (__s1 < __s2) {
for (; __n; --__n, ++__s1, ++__s2)
assign(*__s1, *__s2);
- return __r;
- }
- _LIBCPP_HIDE_FROM_ABI
- static _LIBCPP_CONSTEXPR_SINCE_CXX20
- char_type* assign(char_type* __s, size_t __n, char_type __a) {
- char_type* __r = __s;
- for (; __n; --__n, ++__s)
- assign(*__s, __a);
- return __r;
+ } else if (__s2 < __s1) {
+ __s1 += __n;
+ __s2 += __n;
+ for (; __n; --__n)
+ assign(*--__s1, *--__s2);
}
+ return __r;
+ }
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR_SINCE_CXX20 char_type*
+ copy(char_type* __s1, const char_type* __s2, size_t __n) {
+ _LIBCPP_ASSERT_NON_OVERLAPPING_RANGES(!std::__is_pointer_in_range(__s1, __s1 + __n, __s2),
+ "char_traits::copy: source and destination ranges overlap");
+ char_type* __r = __s1;
+ for (; __n; --__n, ++__s1, ++__s2)
+ assign(*__s1, *__s2);
+ return __r;
+ }
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR_SINCE_CXX20 char_type*
+ assign(char_type* __s, size_t __n, char_type __a) {
+ char_type* __r = __s;
+ for (; __n; --__n, ++__s)
+ assign(*__s, __a);
+ return __r;
+ }
- static inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR int_type not_eof(int_type __c) _NOEXCEPT
- {return eq_int_type(__c, eof()) ? ~eof() : __c;}
- static inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR char_type to_char_type(int_type __c) _NOEXCEPT
- {return char_type(__c);}
- static inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR int_type to_int_type(char_type __c) _NOEXCEPT
- {return int_type(__c);}
- static inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool eq_int_type(int_type __c1, int_type __c2) _NOEXCEPT
- {return __c1 == __c2;}
- static inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR int_type eof() _NOEXCEPT
- {return int_type(EOF);}
+ static inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR int_type not_eof(int_type __c) _NOEXCEPT {
+ return eq_int_type(__c, eof()) ? ~eof() : __c;
+ }
+ static inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR char_type to_char_type(int_type __c) _NOEXCEPT {
+ return char_type(__c);
+ }
+ static inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR int_type to_int_type(char_type __c) _NOEXCEPT {
+ return int_type(__c);
+ }
+ static inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool eq_int_type(int_type __c1, int_type __c2) _NOEXCEPT {
+ return __c1 == __c2;
+ }
+ static inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR int_type eof() _NOEXCEPT { return int_type(EOF); }
};
#endif // !defined(_LIBCPP_CHAR_TRAITS_REMOVE_BASE_SPECIALIZATION)
// char_traits<char>
template <>
-struct _LIBCPP_TEMPLATE_VIS char_traits<char>
-{
- using char_type = char;
- using int_type = int;
- using off_type = streamoff;
- using pos_type = streampos;
- using state_type = mbstate_t;
+struct _LIBCPP_TEMPLATE_VIS char_traits<char> {
+ using char_type = char;
+ using int_type = int;
+ using off_type = streamoff;
+ using pos_type = streampos;
+ using state_type = mbstate_t;
#if _LIBCPP_STD_VER >= 20
- using comparison_category = strong_ordering;
+ using comparison_category = strong_ordering;
#endif
- static inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
- void assign(char_type& __c1, const char_type& __c2) _NOEXCEPT {__c1 = __c2;}
+ static inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 void
+ assign(char_type& __c1, const char_type& __c2) _NOEXCEPT {
+ __c1 = __c2;
+ }
- // TODO: Make this _LIBCPP_HIDE_FROM_ABI
- static inline _LIBCPP_HIDDEN _LIBCPP_CONSTEXPR bool eq(char_type __c1, char_type __c2) _NOEXCEPT
- {return __c1 == __c2;}
- static inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool lt(char_type __c1, char_type __c2) _NOEXCEPT
- {return (unsigned char)__c1 < (unsigned char)__c2;}
+ // TODO: Make this _LIBCPP_HIDE_FROM_ABI
+ static inline _LIBCPP_HIDDEN _LIBCPP_CONSTEXPR bool eq(char_type __c1, char_type __c2) _NOEXCEPT {
+ return __c1 == __c2;
+ }
+ static inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool lt(char_type __c1, char_type __c2) _NOEXCEPT {
+ return (unsigned char)__c1 < (unsigned char)__c2;
+ }
- // __constexpr_memcmp requires a trivially lexicographically comparable type, but char is not when char is a signed type
- static _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 int
- compare(const char_type* __lhs, const char_type* __rhs, size_t __count) _NOEXCEPT {
- if (__libcpp_is_constant_evaluated()) {
+ // __constexpr_memcmp requires a trivially lexicographically comparable type, but char is not when char is a signed
+ // type
+ static _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 int
+ compare(const char_type* __lhs, const char_type* __rhs, size_t __count) _NOEXCEPT {
+ if (__libcpp_is_constant_evaluated()) {
#ifdef _LIBCPP_COMPILER_CLANG_BASED
- return __builtin_memcmp(__lhs, __rhs, __count);
+ return __builtin_memcmp(__lhs, __rhs, __count);
#else
- while (__count != 0) {
- if (lt(*__lhs, *__rhs))
- return -1;
- if (lt(*__rhs, *__lhs))
- return 1;
-
- __count -= sizeof(char_type);
- ++__lhs;
- ++__rhs;
- }
- return 0;
-#endif // _LIBCPP_COMPILER_CLANG_BASED
- } else {
- return __builtin_memcmp(__lhs, __rhs, __count);
+ while (__count != 0) {
+ if (lt(*__lhs, *__rhs))
+ return -1;
+ if (lt(*__rhs, *__lhs))
+ return 1;
+
+ __count -= sizeof(char_type);
+ ++__lhs;
+ ++__rhs;
}
+ return 0;
+#endif // _LIBCPP_COMPILER_CLANG_BASED
+ } else {
+ return __builtin_memcmp(__lhs, __rhs, __count);
}
+ }
- static inline _LIBCPP_HIDE_FROM_ABI size_t _LIBCPP_CONSTEXPR_SINCE_CXX17 length(const char_type* __s) _NOEXCEPT {
- return std::__constexpr_strlen(__s);
- }
+ static inline _LIBCPP_HIDE_FROM_ABI size_t _LIBCPP_CONSTEXPR_SINCE_CXX17 length(const char_type* __s) _NOEXCEPT {
+ return std::__constexpr_strlen(__s);
+ }
- static _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
- const char_type* find(const char_type* __s, size_t __n, const char_type& __a) _NOEXCEPT {
- if (__n == 0)
- return nullptr;
- return std::__constexpr_memchr(__s, __a, __n);
- }
+ static _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 const char_type*
+ find(const char_type* __s, size_t __n, const char_type& __a) _NOEXCEPT {
+ if (__n == 0)
+ return nullptr;
+ return std::__constexpr_memchr(__s, __a, __n);
+ }
- static inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- char_type* move(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT {
- return std::__constexpr_memmove(__s1, __s2, __element_count(__n));
- }
+ static inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 char_type*
+ move(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT {
+ return std::__constexpr_memmove(__s1, __s2, __element_count(__n));
+ }
- static inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- char_type* copy(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT {
- _LIBCPP_ASSERT_NON_OVERLAPPING_RANGES(!std::__is_pointer_in_range(__s1, __s1 + __n, __s2),
- "char_traits::copy: source and destination ranges overlap");
- std::copy_n(__s2, __n, __s1);
- return __s1;
- }
+ static inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 char_type*
+ copy(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT {
+ _LIBCPP_ASSERT_NON_OVERLAPPING_RANGES(!std::__is_pointer_in_range(__s1, __s1 + __n, __s2),
+ "char_traits::copy: source and destination ranges overlap");
+ std::copy_n(__s2, __n, __s1);
+ return __s1;
+ }
- static inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- char_type* assign(char_type* __s, size_t __n, char_type __a) _NOEXCEPT {
- std::fill_n(__s, __n, __a);
- return __s;
- }
+ static inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 char_type*
+ assign(char_type* __s, size_t __n, char_type __a) _NOEXCEPT {
+ std::fill_n(__s, __n, __a);
+ return __s;
+ }
- static inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR int_type not_eof(int_type __c) _NOEXCEPT
- {return eq_int_type(__c, eof()) ? ~eof() : __c;}
- static inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR char_type to_char_type(int_type __c) _NOEXCEPT
- {return char_type(__c);}
- static inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR int_type to_int_type(char_type __c) _NOEXCEPT
- {return int_type((unsigned char)__c);}
- static inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool eq_int_type(int_type __c1, int_type __c2) _NOEXCEPT
- {return __c1 == __c2;}
- static inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR int_type eof() _NOEXCEPT
- {return int_type(EOF);}
+ static inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR int_type not_eof(int_type __c) _NOEXCEPT {
+ return eq_int_type(__c, eof()) ? ~eof() : __c;
+ }
+ static inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR char_type to_char_type(int_type __c) _NOEXCEPT {
+ return char_type(__c);
+ }
+ static inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR int_type to_int_type(char_type __c) _NOEXCEPT {
+ return int_type((unsigned char)__c);
+ }
+ static inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool eq_int_type(int_type __c1, int_type __c2) _NOEXCEPT {
+ return __c1 == __c2;
+ }
+ static inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR int_type eof() _NOEXCEPT { return int_type(EOF); }
};
// char_traits<wchar_t>
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
template <>
-struct _LIBCPP_TEMPLATE_VIS char_traits<wchar_t>
-{
- using char_type = wchar_t;
- using int_type = wint_t;
- using off_type = streamoff;
- using pos_type = streampos;
- using state_type = mbstate_t;
-#if _LIBCPP_STD_VER >= 20
- using comparison_category = strong_ordering;
-#endif
-
- static inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
- void assign(char_type& __c1, const char_type& __c2) _NOEXCEPT {__c1 = __c2;}
- static inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool eq(char_type __c1, char_type __c2) _NOEXCEPT
- {return __c1 == __c2;}
- static inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool lt(char_type __c1, char_type __c2) _NOEXCEPT
- {return __c1 < __c2;}
+struct _LIBCPP_TEMPLATE_VIS char_traits<wchar_t> {
+ using char_type = wchar_t;
+ using int_type = wint_t;
+ using off_type = streamoff;
+ using pos_type = streampos;
+ using state_type = mbstate_t;
+# if _LIBCPP_STD_VER >= 20
+ using comparison_category = strong_ordering;
+# endif
+
+ static inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 void
+ assign(char_type& __c1, const char_type& __c2) _NOEXCEPT {
+ __c1 = __c2;
+ }
+ static inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool eq(char_type __c1, char_type __c2) _NOEXCEPT {
+ return __c1 == __c2;
+ }
+ static inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool lt(char_type __c1, char_type __c2) _NOEXCEPT {
+ return __c1 < __c2;
+ }
static _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 int
compare(const char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT {
@@ -294,341 +304,325 @@ struct _LIBCPP_TEMPLATE_VIS char_traits<wchar_t>
return std::__constexpr_wcslen(__s);
}
- static _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
- const char_type* find(const char_type* __s, size_t __n, const char_type& __a) _NOEXCEPT {
+ static _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 const char_type*
+ find(const char_type* __s, size_t __n, const char_type& __a) _NOEXCEPT {
if (__n == 0)
- return nullptr;
+ return nullptr;
return std::__constexpr_wmemchr(__s, __a, __n);
}
- static inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- char_type* move(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT {
- return std::__constexpr_memmove(__s1, __s2, __element_count(__n));
- }
+ static inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 char_type*
+ move(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT {
+ return std::__constexpr_memmove(__s1, __s2, __element_count(__n));
+ }
- static inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- char_type* copy(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT {
- _LIBCPP_ASSERT_NON_OVERLAPPING_RANGES(!std::__is_pointer_in_range(__s1, __s1 + __n, __s2),
- "char_traits::copy: source and destination ranges overlap");
- std::copy_n(__s2, __n, __s1);
- return __s1;
- }
+ static inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 char_type*
+ copy(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT {
+ _LIBCPP_ASSERT_NON_OVERLAPPING_RANGES(!std::__is_pointer_in_range(__s1, __s1 + __n, __s2),
+ "char_traits::copy: source and destination ranges overlap");
+ std::copy_n(__s2, __n, __s1);
+ return __s1;
+ }
- static inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- char_type* assign(char_type* __s, size_t __n, char_type __a) _NOEXCEPT {
- std::fill_n(__s, __n, __a);
- return __s;
- }
+ static inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 char_type*
+ assign(char_type* __s, size_t __n, char_type __a) _NOEXCEPT {
+ std::fill_n(__s, __n, __a);
+ return __s;
+ }
- static inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR int_type not_eof(int_type __c) _NOEXCEPT
- {return eq_int_type(__c, eof()) ? ~eof() : __c;}
- static inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR char_type to_char_type(int_type __c) _NOEXCEPT
- {return char_type(__c);}
- static inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR int_type to_int_type(char_type __c) _NOEXCEPT
- {return int_type(__c);}
- static inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool eq_int_type(int_type __c1, int_type __c2) _NOEXCEPT
- {return __c1 == __c2;}
- static inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR int_type eof() _NOEXCEPT
- {return int_type(WEOF);}
+ static inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR int_type not_eof(int_type __c) _NOEXCEPT {
+ return eq_int_type(__c, eof()) ? ~eof() : __c;
+ }
+ static inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR char_type to_char_type(int_type __c) _NOEXCEPT {
+ return char_type(__c);
+ }
+ static inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR int_type to_int_type(char_type __c) _NOEXCEPT {
+ return int_type(__c);
+ }
+ static inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool eq_int_type(int_type __c1, int_type __c2) _NOEXCEPT {
+ return __c1 == __c2;
+ }
+ static inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR int_type eof() _NOEXCEPT { return int_type(WEOF); }
};
#endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS
#ifndef _LIBCPP_HAS_NO_CHAR8_T
template <>
-struct _LIBCPP_TEMPLATE_VIS char_traits<char8_t>
-{
- using char_type = char8_t;
- using int_type = unsigned int;
- using off_type = streamoff;
- using pos_type = u8streampos;
- using state_type = mbstate_t;
-#if _LIBCPP_STD_VER >= 20
- using comparison_category = strong_ordering;
-#endif
-
- static inline _LIBCPP_HIDE_FROM_ABI constexpr void assign(char_type& __c1, const char_type& __c2) noexcept
- {__c1 = __c2;}
- static inline _LIBCPP_HIDE_FROM_ABI constexpr bool eq(char_type __c1, char_type __c2) noexcept
- {return __c1 == __c2;}
- static inline _LIBCPP_HIDE_FROM_ABI constexpr bool lt(char_type __c1, char_type __c2) noexcept
- {return __c1 < __c2;}
+struct _LIBCPP_TEMPLATE_VIS char_traits<char8_t> {
+ using char_type = char8_t;
+ using int_type = unsigned int;
+ using off_type = streamoff;
+ using pos_type = u8streampos;
+ using state_type = mbstate_t;
+# if _LIBCPP_STD_VER >= 20
+ using comparison_category = strong_ordering;
+# endif
+
+ static inline _LIBCPP_HIDE_FROM_ABI constexpr void assign(char_type& __c1, const char_type& __c2) noexcept {
+ __c1 = __c2;
+ }
+ static inline _LIBCPP_HIDE_FROM_ABI constexpr bool eq(char_type __c1, char_type __c2) noexcept {
+ return __c1 == __c2;
+ }
+ static inline _LIBCPP_HIDE_FROM_ABI constexpr bool lt(char_type __c1, char_type __c2) noexcept { return __c1 < __c2; }
static _LIBCPP_HIDE_FROM_ABI constexpr int
compare(const char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT {
- return std::__constexpr_memcmp(__s1, __s2, __element_count(__n));
+ return std::__constexpr_memcmp(__s1, __s2, __element_count(__n));
}
- static _LIBCPP_HIDE_FROM_ABI constexpr
- size_t length(const char_type* __s) _NOEXCEPT;
+ static _LIBCPP_HIDE_FROM_ABI constexpr size_t length(const char_type* __s) _NOEXCEPT;
- _LIBCPP_HIDE_FROM_ABI static constexpr
- const char_type* find(const char_type* __s, size_t __n, const char_type& __a) _NOEXCEPT;
+ _LIBCPP_HIDE_FROM_ABI static constexpr const char_type*
+ find(const char_type* __s, size_t __n, const char_type& __a) _NOEXCEPT;
- static _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- char_type* move(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT {
- return std::__constexpr_memmove(__s1, __s2, __element_count(__n));
- }
+ static _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 char_type*
+ move(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT {
+ return std::__constexpr_memmove(__s1, __s2, __element_count(__n));
+ }
- static _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- char_type* copy(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT {
- _LIBCPP_ASSERT_NON_OVERLAPPING_RANGES(!std::__is_pointer_in_range(__s1, __s1 + __n, __s2),
- "char_traits::copy: source and destination ranges overlap");
- std::copy_n(__s2, __n, __s1);
- return __s1;
- }
+ static _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 char_type*
+ copy(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT {
+ _LIBCPP_ASSERT_NON_OVERLAPPING_RANGES(!std::__is_pointer_in_range(__s1, __s1 + __n, __s2),
+ "char_traits::copy: source and destination ranges overlap");
+ std::copy_n(__s2, __n, __s1);
+ return __s1;
+ }
- static _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- char_type* assign(char_type* __s, size_t __n, char_type __a) _NOEXCEPT {
- std::fill_n(__s, __n, __a);
- return __s;
- }
+ static _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 char_type*
+ assign(char_type* __s, size_t __n, char_type __a) _NOEXCEPT {
+ std::fill_n(__s, __n, __a);
+ return __s;
+ }
- static inline _LIBCPP_HIDE_FROM_ABI constexpr int_type not_eof(int_type __c) noexcept
- {return eq_int_type(__c, eof()) ? ~eof() : __c;}
- static inline _LIBCPP_HIDE_FROM_ABI constexpr char_type to_char_type(int_type __c) noexcept
- {return char_type(__c);}
- static inline _LIBCPP_HIDE_FROM_ABI constexpr int_type to_int_type(char_type __c) noexcept
- {return int_type(__c);}
- static inline _LIBCPP_HIDE_FROM_ABI constexpr bool eq_int_type(int_type __c1, int_type __c2) noexcept
- {return __c1 == __c2;}
- static inline _LIBCPP_HIDE_FROM_ABI constexpr int_type eof() noexcept
- {return int_type(EOF);}
+ static inline _LIBCPP_HIDE_FROM_ABI constexpr int_type not_eof(int_type __c) noexcept {
+ return eq_int_type(__c, eof()) ? ~eof() : __c;
+ }
+ static inline _LIBCPP_HIDE_FROM_ABI constexpr char_type to_char_type(int_type __c) noexcept { return char_type(__c); }
+ static inline _LIBCPP_HIDE_FROM_ABI constexpr int_type to_int_type(char_type __c) noexcept { return int_type(__c); }
+ static inline _LIBCPP_HIDE_FROM_ABI constexpr bool eq_int_type(int_type __c1, int_type __c2) noexcept {
+ return __c1 == __c2;
+ }
+ static inline _LIBCPP_HIDE_FROM_ABI constexpr int_type eof() noexcept { return int_type(EOF); }
};
// TODO use '__builtin_strlen' if it ever supports char8_t ??
-inline constexpr
-size_t
-char_traits<char8_t>::length(const char_type* __s) _NOEXCEPT
-{
- size_t __len = 0;
- for (; !eq(*__s, char_type(0)); ++__s)
- ++__len;
- return __len;
+inline constexpr size_t char_traits<char8_t>::length(const char_type* __s) _NOEXCEPT {
+ size_t __len = 0;
+ for (; !eq(*__s, char_type(0)); ++__s)
+ ++__len;
+ return __len;
}
// TODO use '__builtin_char_memchr' if it ever supports char8_t ??
-inline constexpr
-const char8_t*
-char_traits<char8_t>::find(const char_type* __s, size_t __n, const char_type& __a) _NOEXCEPT
-{
- for (; __n; --__n)
- {
- if (eq(*__s, __a))
- return __s;
- ++__s;
- }
- return nullptr;
+inline constexpr const char8_t*
+char_traits<char8_t>::find(const char_type* __s, size_t __n, const char_type& __a) _NOEXCEPT {
+ for (; __n; --__n) {
+ if (eq(*__s, __a))
+ return __s;
+ ++__s;
+ }
+ return nullptr;
}
#endif // _LIBCPP_HAS_NO_CHAR8_T
template <>
-struct _LIBCPP_TEMPLATE_VIS char_traits<char16_t>
-{
- using char_type = char16_t;
- using int_type = uint_least16_t;
- using off_type = streamoff;
- using pos_type = u16streampos;
- using state_type = mbstate_t;
+struct _LIBCPP_TEMPLATE_VIS char_traits<char16_t> {
+ using char_type = char16_t;
+ using int_type = uint_least16_t;
+ using off_type = streamoff;
+ using pos_type = u16streampos;
+ using state_type = mbstate_t;
#if _LIBCPP_STD_VER >= 20
- using comparison_category = strong_ordering;
+ using comparison_category = strong_ordering;
#endif
- static inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
- void assign(char_type& __c1, const char_type& __c2) _NOEXCEPT {__c1 = __c2;}
- static inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool eq(char_type __c1, char_type __c2) _NOEXCEPT
- {return __c1 == __c2;}
- static inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool lt(char_type __c1, char_type __c2) _NOEXCEPT
- {return __c1 < __c2;}
-
- _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR_SINCE_CXX17
- int compare(const char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT;
- _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR_SINCE_CXX17
- size_t length(const char_type* __s) _NOEXCEPT;
- _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR_SINCE_CXX17
- const char_type* find(const char_type* __s, size_t __n, const char_type& __a) _NOEXCEPT;
-
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- static char_type* move(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT {
- return std::__constexpr_memmove(__s1, __s2, __element_count(__n));
- }
+ static inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 void
+ assign(char_type& __c1, const char_type& __c2) _NOEXCEPT {
+ __c1 = __c2;
+ }
+ static inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool eq(char_type __c1, char_type __c2) _NOEXCEPT {
+ return __c1 == __c2;
+ }
+ static inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool lt(char_type __c1, char_type __c2) _NOEXCEPT {
+ return __c1 < __c2;
+ }
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- static char_type* copy(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT {
- _LIBCPP_ASSERT_NON_OVERLAPPING_RANGES(!std::__is_pointer_in_range(__s1, __s1 + __n, __s2),
- "char_traits::copy: source and destination ranges overlap");
- std::copy_n(__s2, __n, __s1);
- return __s1;
- }
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR_SINCE_CXX17 int
+ compare(const char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT;
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR_SINCE_CXX17 size_t length(const char_type* __s) _NOEXCEPT;
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR_SINCE_CXX17 const char_type*
+ find(const char_type* __s, size_t __n, const char_type& __a) _NOEXCEPT;
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- static char_type* assign(char_type* __s, size_t __n, char_type __a) _NOEXCEPT {
- std::fill_n(__s, __n, __a);
- return __s;
- }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 static char_type*
+ move(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT {
+ return std::__constexpr_memmove(__s1, __s2, __element_count(__n));
+ }
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 static char_type*
+ copy(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT {
+ _LIBCPP_ASSERT_NON_OVERLAPPING_RANGES(!std::__is_pointer_in_range(__s1, __s1 + __n, __s2),
+ "char_traits::copy: source and destination ranges overlap");
+ std::copy_n(__s2, __n, __s1);
+ return __s1;
+ }
- static inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR int_type not_eof(int_type __c) _NOEXCEPT
- {return eq_int_type(__c, eof()) ? ~eof() : __c;}
- static inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR char_type to_char_type(int_type __c) _NOEXCEPT
- {return char_type(__c);}
- static inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR int_type to_int_type(char_type __c) _NOEXCEPT
- {return int_type(__c);}
- static inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool eq_int_type(int_type __c1, int_type __c2) _NOEXCEPT
- {return __c1 == __c2;}
- static inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR int_type eof() _NOEXCEPT
- {return int_type(0xFFFF);}
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 static char_type*
+ assign(char_type* __s, size_t __n, char_type __a) _NOEXCEPT {
+ std::fill_n(__s, __n, __a);
+ return __s;
+ }
+
+ static inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR int_type not_eof(int_type __c) _NOEXCEPT {
+ return eq_int_type(__c, eof()) ? ~eof() : __c;
+ }
+ static inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR char_type to_char_type(int_type __c) _NOEXCEPT {
+ return char_type(__c);
+ }
+ static inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR int_type to_int_type(char_type __c) _NOEXCEPT {
+ return int_type(__c);
+ }
+ static inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool eq_int_type(int_type __c1, int_type __c2) _NOEXCEPT {
+ return __c1 == __c2;
+ }
+ static inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR int_type eof() _NOEXCEPT { return int_type(0xFFFF); }
};
-inline _LIBCPP_CONSTEXPR_SINCE_CXX17
-int
-char_traits<char16_t>::compare(const char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT
-{
- for (; __n; --__n, ++__s1, ++__s2)
- {
- if (lt(*__s1, *__s2))
- return -1;
- if (lt(*__s2, *__s1))
- return 1;
- }
- return 0;
+inline _LIBCPP_CONSTEXPR_SINCE_CXX17 int
+char_traits<char16_t>::compare(const char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT {
+ for (; __n; --__n, ++__s1, ++__s2) {
+ if (lt(*__s1, *__s2))
+ return -1;
+ if (lt(*__s2, *__s1))
+ return 1;
+ }
+ return 0;
}
-inline _LIBCPP_CONSTEXPR_SINCE_CXX17
-size_t
-char_traits<char16_t>::length(const char_type* __s) _NOEXCEPT
-{
- size_t __len = 0;
- for (; !eq(*__s, char_type(0)); ++__s)
- ++__len;
- return __len;
+inline _LIBCPP_CONSTEXPR_SINCE_CXX17 size_t char_traits<char16_t>::length(const char_type* __s) _NOEXCEPT {
+ size_t __len = 0;
+ for (; !eq(*__s, char_type(0)); ++__s)
+ ++__len;
+ return __len;
}
-inline _LIBCPP_CONSTEXPR_SINCE_CXX17
-const char16_t*
-char_traits<char16_t>::find(const char_type* __s, size_t __n, const char_type& __a) _NOEXCEPT
-{
- for (; __n; --__n)
- {
- if (eq(*__s, __a))
- return __s;
- ++__s;
- }
- return nullptr;
+inline _LIBCPP_CONSTEXPR_SINCE_CXX17 const char16_t*
+char_traits<char16_t>::find(const char_type* __s, size_t __n, const char_type& __a) _NOEXCEPT {
+ for (; __n; --__n) {
+ if (eq(*__s, __a))
+ return __s;
+ ++__s;
+ }
+ return nullptr;
}
template <>
-struct _LIBCPP_TEMPLATE_VIS char_traits<char32_t>
-{
- using char_type = char32_t;
- using int_type = uint_least32_t;
- using off_type = streamoff;
- using pos_type = u32streampos;
- using state_type = mbstate_t;
+struct _LIBCPP_TEMPLATE_VIS char_traits<char32_t> {
+ using char_type = char32_t;
+ using int_type = uint_least32_t;
+ using off_type = streamoff;
+ using pos_type = u32streampos;
+ using state_type = mbstate_t;
#if _LIBCPP_STD_VER >= 20
- using comparison_category = strong_ordering;
+ using comparison_category = strong_ordering;
#endif
- static inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
- void assign(char_type& __c1, const char_type& __c2) _NOEXCEPT {__c1 = __c2;}
- static inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool eq(char_type __c1, char_type __c2) _NOEXCEPT
- {return __c1 == __c2;}
- static inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool lt(char_type __c1, char_type __c2) _NOEXCEPT
- {return __c1 < __c2;}
-
- _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR_SINCE_CXX17
- int compare(const char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT;
- _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR_SINCE_CXX17
- size_t length(const char_type* __s) _NOEXCEPT;
- _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR_SINCE_CXX17
- const char_type* find(const char_type* __s, size_t __n, const char_type& __a) _NOEXCEPT;
-
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- static char_type* move(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT {
- return std::__constexpr_memmove(__s1, __s2, __element_count(__n));
- }
+ static inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 void
+ assign(char_type& __c1, const char_type& __c2) _NOEXCEPT {
+ __c1 = __c2;
+ }
+ static inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool eq(char_type __c1, char_type __c2) _NOEXCEPT {
+ return __c1 == __c2;
+ }
+ static inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool lt(char_type __c1, char_type __c2) _NOEXCEPT {
+ return __c1 < __c2;
+ }
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- static char_type* copy(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT {
- std::copy_n(__s2, __n, __s1);
- return __s1;
- }
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR_SINCE_CXX17 int
+ compare(const char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT;
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR_SINCE_CXX17 size_t length(const char_type* __s) _NOEXCEPT;
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR_SINCE_CXX17 const char_type*
+ find(const char_type* __s, size_t __n, const char_type& __a) _NOEXCEPT;
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- static char_type* assign(char_type* __s, size_t __n, char_type __a) _NOEXCEPT {
- std::fill_n(__s, __n, __a);
- return __s;
- }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 static char_type*
+ move(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT {
+ return std::__constexpr_memmove(__s1, __s2, __element_count(__n));
+ }
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 static char_type*
+ copy(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT {
+ std::copy_n(__s2, __n, __s1);
+ return __s1;
+ }
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 static char_type*
+ assign(char_type* __s, size_t __n, char_type __a) _NOEXCEPT {
+ std::fill_n(__s, __n, __a);
+ return __s;
+ }
- static inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR int_type not_eof(int_type __c) _NOEXCEPT
- {return eq_int_type(__c, eof()) ? ~eof() : __c;}
- static inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR char_type to_char_type(int_type __c) _NOEXCEPT
- {return char_type(__c);}
- static inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR int_type to_int_type(char_type __c) _NOEXCEPT
- {return int_type(__c);}
- static inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool eq_int_type(int_type __c1, int_type __c2) _NOEXCEPT
- {return __c1 == __c2;}
- static inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR int_type eof() _NOEXCEPT
- {return int_type(0xFFFFFFFF);}
+ static inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR int_type not_eof(int_type __c) _NOEXCEPT {
+ return eq_int_type(__c, eof()) ? ~eof() : __c;
+ }
+ static inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR char_type to_char_type(int_type __c) _NOEXCEPT {
+ return char_type(__c);
+ }
+ static inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR int_type to_int_type(char_type __c) _NOEXCEPT {
+ return int_type(__c);
+ }
+ static inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool eq_int_type(int_type __c1, int_type __c2) _NOEXCEPT {
+ return __c1 == __c2;
+ }
+ static inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR int_type eof() _NOEXCEPT { return int_type(0xFFFFFFFF); }
};
-inline _LIBCPP_CONSTEXPR_SINCE_CXX17
-int
-char_traits<char32_t>::compare(const char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT
-{
- for (; __n; --__n, ++__s1, ++__s2)
- {
- if (lt(*__s1, *__s2))
- return -1;
- if (lt(*__s2, *__s1))
- return 1;
- }
- return 0;
+inline _LIBCPP_CONSTEXPR_SINCE_CXX17 int
+char_traits<char32_t>::compare(const char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT {
+ for (; __n; --__n, ++__s1, ++__s2) {
+ if (lt(*__s1, *__s2))
+ return -1;
+ if (lt(*__s2, *__s1))
+ return 1;
+ }
+ return 0;
}
-inline _LIBCPP_CONSTEXPR_SINCE_CXX17
-size_t
-char_traits<char32_t>::length(const char_type* __s) _NOEXCEPT
-{
- size_t __len = 0;
- for (; !eq(*__s, char_type(0)); ++__s)
- ++__len;
- return __len;
+inline _LIBCPP_CONSTEXPR_SINCE_CXX17 size_t char_traits<char32_t>::length(const char_type* __s) _NOEXCEPT {
+ size_t __len = 0;
+ for (; !eq(*__s, char_type(0)); ++__s)
+ ++__len;
+ return __len;
}
-inline _LIBCPP_CONSTEXPR_SINCE_CXX17
-const char32_t*
-char_traits<char32_t>::find(const char_type* __s, size_t __n, const char_type& __a) _NOEXCEPT
-{
- for (; __n; --__n)
- {
- if (eq(*__s, __a))
- return __s;
- ++__s;
- }
- return nullptr;
+inline _LIBCPP_CONSTEXPR_SINCE_CXX17 const char32_t*
+char_traits<char32_t>::find(const char_type* __s, size_t __n, const char_type& __a) _NOEXCEPT {
+ for (; __n; --__n) {
+ if (eq(*__s, __a))
+ return __s;
+ ++__s;
+ }
+ return nullptr;
}
// helper fns for basic_string and string_view
// __str_find
-template<class _CharT, class _SizeT, class _Traits, _SizeT __npos>
+template <class _CharT, class _SizeT, class _Traits, _SizeT __npos>
inline _SizeT _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
-__str_find(const _CharT *__p, _SizeT __sz,
- _CharT __c, _SizeT __pos) _NOEXCEPT
-{
- if (__pos >= __sz)
- return __npos;
- const _CharT* __r = _Traits::find(__p + __pos, __sz - __pos, __c);
- if (__r == nullptr)
- return __npos;
- return static_cast<_SizeT>(__r - __p);
+__str_find(const _CharT* __p, _SizeT __sz, _CharT __c, _SizeT __pos) _NOEXCEPT {
+ if (__pos >= __sz)
+ return __npos;
+ const _CharT* __r = _Traits::find(__p + __pos, __sz - __pos, __c);
+ if (__r == nullptr)
+ return __npos;
+ return static_cast<_SizeT>(__r - __p);
}
template <class _CharT, class _Traits>
-_LIBCPP_HIDE_FROM_ABI inline _LIBCPP_CONSTEXPR_SINCE_CXX14 const _CharT *
-__search_substring(const _CharT *__first1, const _CharT *__last1,
- const _CharT *__first2, const _CharT *__last2) _NOEXCEPT {
+_LIBCPP_HIDE_FROM_ABI inline _LIBCPP_CONSTEXPR_SINCE_CXX14 const _CharT* __search_substring(
+ const _CharT* __first1, const _CharT* __last1, const _CharT* __first2, const _CharT* __last2) _NOEXCEPT {
// Take advantage of knowing source and pattern lengths.
// Stop short when source is smaller than pattern.
const ptrdiff_t __len2 = __last2 - __first2;
@@ -664,173 +658,140 @@ __search_substring(const _CharT *__first1, const _CharT *__last1,
}
}
-template<class _CharT, class _SizeT, class _Traits, _SizeT __npos>
+template <class _CharT, class _SizeT, class _Traits, _SizeT __npos>
inline _SizeT _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
-__str_find(const _CharT *__p, _SizeT __sz,
- const _CharT* __s, _SizeT __pos, _SizeT __n) _NOEXCEPT
-{
- if (__pos > __sz)
- return __npos;
+__str_find(const _CharT* __p, _SizeT __sz, const _CharT* __s, _SizeT __pos, _SizeT __n) _NOEXCEPT {
+ if (__pos > __sz)
+ return __npos;
- if (__n == 0) // There is nothing to search, just return __pos.
- return __pos;
+ if (__n == 0) // There is nothing to search, just return __pos.
+ return __pos;
- const _CharT *__r = std::__search_substring<_CharT, _Traits>(
- __p + __pos, __p + __sz, __s, __s + __n);
+ const _CharT* __r = std::__search_substring<_CharT, _Traits>(__p + __pos, __p + __sz, __s, __s + __n);
- if (__r == __p + __sz)
- return __npos;
- return static_cast<_SizeT>(__r - __p);
+ if (__r == __p + __sz)
+ return __npos;
+ return static_cast<_SizeT>(__r - __p);
}
-
// __str_rfind
-template<class _CharT, class _SizeT, class _Traits, _SizeT __npos>
+template <class _CharT, class _SizeT, class _Traits, _SizeT __npos>
inline _SizeT _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
-__str_rfind(const _CharT *__p, _SizeT __sz,
- _CharT __c, _SizeT __pos) _NOEXCEPT
-{
- if (__sz < 1)
- return __npos;
- if (__pos < __sz)
- ++__pos;
- else
- __pos = __sz;
- for (const _CharT* __ps = __p + __pos; __ps != __p;)
- {
- if (_Traits::eq(*--__ps, __c))
- return static_cast<_SizeT>(__ps - __p);
- }
+__str_rfind(const _CharT* __p, _SizeT __sz, _CharT __c, _SizeT __pos) _NOEXCEPT {
+ if (__sz < 1)
return __npos;
+ if (__pos < __sz)
+ ++__pos;
+ else
+ __pos = __sz;
+ for (const _CharT* __ps = __p + __pos; __ps != __p;) {
+ if (_Traits::eq(*--__ps, __c))
+ return static_cast<_SizeT>(__ps - __p);
+ }
+ return __npos;
}
-template<class _CharT, class _SizeT, class _Traits, _SizeT __npos>
+template <class _CharT, class _SizeT, class _Traits, _SizeT __npos>
inline _SizeT _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
-__str_rfind(const _CharT *__p, _SizeT __sz,
- const _CharT* __s, _SizeT __pos, _SizeT __n) _NOEXCEPT
-{
- __pos = std::min(__pos, __sz);
- if (__n < __sz - __pos)
- __pos += __n;
- else
- __pos = __sz;
- const _CharT* __r = std::__find_end_classic(__p, __p + __pos, __s, __s + __n, _Traits::eq);
- if (__n > 0 && __r == __p + __pos)
- return __npos;
- return static_cast<_SizeT>(__r - __p);
+__str_rfind(const _CharT* __p, _SizeT __sz, const _CharT* __s, _SizeT __pos, _SizeT __n) _NOEXCEPT {
+ __pos = std::min(__pos, __sz);
+ if (__n < __sz - __pos)
+ __pos += __n;
+ else
+ __pos = __sz;
+ const _CharT* __r = std::__find_end_classic(__p, __p + __pos, __s, __s + __n, _Traits::eq);
+ if (__n > 0 && __r == __p + __pos)
+ return __npos;
+ return static_cast<_SizeT>(__r - __p);
}
// __str_find_first_of
-template<class _CharT, class _SizeT, class _Traits, _SizeT __npos>
+template <class _CharT, class _SizeT, class _Traits, _SizeT __npos>
inline _SizeT _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
-__str_find_first_of(const _CharT *__p, _SizeT __sz,
- const _CharT* __s, _SizeT __pos, _SizeT __n) _NOEXCEPT
-{
- if (__pos >= __sz || __n == 0)
- return __npos;
- const _CharT* __r = std::__find_first_of_ce
- (__p + __pos, __p + __sz, __s, __s + __n, _Traits::eq );
- if (__r == __p + __sz)
- return __npos;
- return static_cast<_SizeT>(__r - __p);
+__str_find_first_of(const _CharT* __p, _SizeT __sz, const _CharT* __s, _SizeT __pos, _SizeT __n) _NOEXCEPT {
+ if (__pos >= __sz || __n == 0)
+ return __npos;
+ const _CharT* __r = std::__find_first_of_ce(__p + __pos, __p + __sz, __s, __s + __n, _Traits::eq);
+ if (__r == __p + __sz)
+ return __npos;
+ return static_cast<_SizeT>(__r - __p);
}
-
// __str_find_last_of
-template<class _CharT, class _SizeT, class _Traits, _SizeT __npos>
+template <class _CharT, class _SizeT, class _Traits, _SizeT __npos>
inline _SizeT _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
-__str_find_last_of(const _CharT *__p, _SizeT __sz,
- const _CharT* __s, _SizeT __pos, _SizeT __n) _NOEXCEPT
- {
- if (__n != 0)
- {
- if (__pos < __sz)
- ++__pos;
- else
- __pos = __sz;
- for (const _CharT* __ps = __p + __pos; __ps != __p;)
- {
- const _CharT* __r = _Traits::find(__s, __n, *--__ps);
- if (__r)
- return static_cast<_SizeT>(__ps - __p);
- }
+__str_find_last_of(const _CharT* __p, _SizeT __sz, const _CharT* __s, _SizeT __pos, _SizeT __n) _NOEXCEPT {
+ if (__n != 0) {
+ if (__pos < __sz)
+ ++__pos;
+ else
+ __pos = __sz;
+ for (const _CharT* __ps = __p + __pos; __ps != __p;) {
+ const _CharT* __r = _Traits::find(__s, __n, *--__ps);
+ if (__r)
+ return static_cast<_SizeT>(__ps - __p);
}
- return __npos;
+ }
+ return __npos;
}
-
// __str_find_first_not_of
-template<class _CharT, class _SizeT, class _Traits, _SizeT __npos>
+template <class _CharT, class _SizeT, class _Traits, _SizeT __npos>
inline _SizeT _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
-__str_find_first_not_of(const _CharT *__p, _SizeT __sz,
- const _CharT* __s, _SizeT __pos, _SizeT __n) _NOEXCEPT
-{
- if (__pos < __sz)
- {
- const _CharT* __pe = __p + __sz;
- for (const _CharT* __ps = __p + __pos; __ps != __pe; ++__ps)
- if (_Traits::find(__s, __n, *__ps) == nullptr)
- return static_cast<_SizeT>(__ps - __p);
- }
- return __npos;
+__str_find_first_not_of(const _CharT* __p, _SizeT __sz, const _CharT* __s, _SizeT __pos, _SizeT __n) _NOEXCEPT {
+ if (__pos < __sz) {
+ const _CharT* __pe = __p + __sz;
+ for (const _CharT* __ps = __p + __pos; __ps != __pe; ++__ps)
+ if (_Traits::find(__s, __n, *__ps) == nullptr)
+ return static_cast<_SizeT>(__ps - __p);
+ }
+ return __npos;
}
-
-template<class _CharT, class _SizeT, class _Traits, _SizeT __npos>
+template <class _CharT, class _SizeT, class _Traits, _SizeT __npos>
inline _SizeT _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
-__str_find_first_not_of(const _CharT *__p, _SizeT __sz,
- _CharT __c, _SizeT __pos) _NOEXCEPT
-{
- if (__pos < __sz)
- {
- const _CharT* __pe = __p + __sz;
- for (const _CharT* __ps = __p + __pos; __ps != __pe; ++__ps)
- if (!_Traits::eq(*__ps, __c))
- return static_cast<_SizeT>(__ps - __p);
- }
- return __npos;
+__str_find_first_not_of(const _CharT* __p, _SizeT __sz, _CharT __c, _SizeT __pos) _NOEXCEPT {
+ if (__pos < __sz) {
+ const _CharT* __pe = __p + __sz;
+ for (const _CharT* __ps = __p + __pos; __ps != __pe; ++__ps)
+ if (!_Traits::eq(*__ps, __c))
+ return static_cast<_SizeT>(__ps - __p);
+ }
+ return __npos;
}
-
// __str_find_last_not_of
-template<class _CharT, class _SizeT, class _Traits, _SizeT __npos>
+template <class _CharT, class _SizeT, class _Traits, _SizeT __npos>
inline _SizeT _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
-__str_find_last_not_of(const _CharT *__p, _SizeT __sz,
- const _CharT* __s, _SizeT __pos, _SizeT __n) _NOEXCEPT
-{
- if (__pos < __sz)
- ++__pos;
- else
- __pos = __sz;
- for (const _CharT* __ps = __p + __pos; __ps != __p;)
- if (_Traits::find(__s, __n, *--__ps) == nullptr)
- return static_cast<_SizeT>(__ps - __p);
- return __npos;
+__str_find_last_not_of(const _CharT* __p, _SizeT __sz, const _CharT* __s, _SizeT __pos, _SizeT __n) _NOEXCEPT {
+ if (__pos < __sz)
+ ++__pos;
+ else
+ __pos = __sz;
+ for (const _CharT* __ps = __p + __pos; __ps != __p;)
+ if (_Traits::find(__s, __n, *--__ps) == nullptr)
+ return static_cast<_SizeT>(__ps - __p);
+ return __npos;
}
-
-template<class _CharT, class _SizeT, class _Traits, _SizeT __npos>
+template <class _CharT, class _SizeT, class _Traits, _SizeT __npos>
inline _SizeT _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
-__str_find_last_not_of(const _CharT *__p, _SizeT __sz,
- _CharT __c, _SizeT __pos) _NOEXCEPT
-{
- if (__pos < __sz)
- ++__pos;
- else
- __pos = __sz;
- for (const _CharT* __ps = __p + __pos; __ps != __p;)
- if (!_Traits::eq(*--__ps, __c))
- return static_cast<_SizeT>(__ps - __p);
- return __npos;
+__str_find_last_not_of(const _CharT* __p, _SizeT __sz, _CharT __c, _SizeT __pos) _NOEXCEPT {
+ if (__pos < __sz)
+ ++__pos;
+ else
+ __pos = __sz;
+ for (const _CharT* __ps = __p + __pos; __ps != __p;)
+ if (!_Traits::eq(*--__ps, __c))
+ return static_cast<_SizeT>(__ps - __p);
+ return __npos;
}
-template<class _Ptr>
-inline _LIBCPP_HIDE_FROM_ABI
-size_t __do_string_hash(_Ptr __p, _Ptr __e)
-{
- typedef typename iterator_traits<_Ptr>::value_type value_type;
- return __murmur2_or_cityhash<size_t>()(__p, (__e-__p)*sizeof(value_type));
+template <class _Ptr>
+inline _LIBCPP_HIDE_FROM_ABI size_t __do_string_hash(_Ptr __p, _Ptr __e) {
+ typedef typename iterator_traits<_Ptr>::value_type value_type;
+ return __murmur2_or_cityhash<size_t>()(__p, (__e - __p) * sizeof(value_type));
}
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__system_error/errc.h b/contrib/llvm-project/libcxx/include/__system_error/errc.h
index f939c99f7ed6..a14ec56070c4 100644
--- a/contrib/llvm-project/libcxx/include/__system_error/errc.h
+++ b/contrib/llvm-project/libcxx/include/__system_error/errc.h
@@ -113,107 +113,105 @@ _LIBCPP_BEGIN_NAMESPACE_STD
// Some error codes are not present on all platforms, so we provide equivalents
// for them:
-//enum class errc
-_LIBCPP_DECLARE_STRONG_ENUM(errc)
-{
- address_family_not_supported = EAFNOSUPPORT,
- address_in_use = EADDRINUSE,
- address_not_available = EADDRNOTAVAIL,
- already_connected = EISCONN,
- argument_list_too_long = E2BIG,
- argument_out_of_domain = EDOM,
- bad_address = EFAULT,
- bad_file_descriptor = EBADF,
- bad_message = EBADMSG,
- broken_pipe = EPIPE,
- connection_aborted = ECONNABORTED,
- connection_already_in_progress = EALREADY,
- connection_refused = ECONNREFUSED,
- connection_reset = ECONNRESET,
- cross_device_link = EXDEV,
- destination_address_required = EDESTADDRREQ,
- device_or_resource_busy = EBUSY,
- directory_not_empty = ENOTEMPTY,
- executable_format_error = ENOEXEC,
- file_exists = EEXIST,
- file_too_large = EFBIG,
- filename_too_long = ENAMETOOLONG,
- function_not_supported = ENOSYS,
- host_unreachable = EHOSTUNREACH,
- identifier_removed = EIDRM,
- illegal_byte_sequence = EILSEQ,
- inappropriate_io_control_operation = ENOTTY,
+// enum class errc
+_LIBCPP_DECLARE_STRONG_ENUM(errc){
+ address_family_not_supported = EAFNOSUPPORT,
+ address_in_use = EADDRINUSE,
+ address_not_available = EADDRNOTAVAIL,
+ already_connected = EISCONN,
+ argument_list_too_long = E2BIG,
+ argument_out_of_domain = EDOM,
+ bad_address = EFAULT,
+ bad_file_descriptor = EBADF,
+ bad_message = EBADMSG,
+ broken_pipe = EPIPE,
+ connection_aborted = ECONNABORTED,
+ connection_already_in_progress = EALREADY,
+ connection_refused = ECONNREFUSED,
+ connection_reset = ECONNRESET,
+ cross_device_link = EXDEV,
+ destination_address_required = EDESTADDRREQ,
+ device_or_resource_busy = EBUSY,
+ directory_not_empty = ENOTEMPTY,
+ executable_format_error = ENOEXEC,
+ file_exists = EEXIST,
+ file_too_large = EFBIG,
+ filename_too_long = ENAMETOOLONG,
+ function_not_supported = ENOSYS,
+ host_unreachable = EHOSTUNREACH,
+ identifier_removed = EIDRM,
+ illegal_byte_sequence = EILSEQ,
+ inappropriate_io_control_operation = ENOTTY,
#ifdef EINTEGRITY
- integrity_check_failed = EINTEGRITY,
+ integrity_check_failed = EINTEGRITY,
#endif
- interrupted = EINTR,
- invalid_argument = EINVAL,
- invalid_seek = ESPIPE,
- io_error = EIO,
- is_a_directory = EISDIR,
- message_size = EMSGSIZE,
- network_down = ENETDOWN,
- network_reset = ENETRESET,
- network_unreachable = ENETUNREACH,
- no_buffer_space = ENOBUFS,
- no_child_process = ECHILD,
- no_link = ENOLINK,
- no_lock_available = ENOLCK,
+ interrupted = EINTR,
+ invalid_argument = EINVAL,
+ invalid_seek = ESPIPE,
+ io_error = EIO,
+ is_a_directory = EISDIR,
+ message_size = EMSGSIZE,
+ network_down = ENETDOWN,
+ network_reset = ENETRESET,
+ network_unreachable = ENETUNREACH,
+ no_buffer_space = ENOBUFS,
+ no_child_process = ECHILD,
+ no_link = ENOLINK,
+ no_lock_available = ENOLCK,
#ifdef ENODATA
- no_message_available = ENODATA,
+ no_message_available = ENODATA,
#else
- no_message_available = ENOMSG,
+ no_message_available = ENOMSG,
#endif
- no_message = ENOMSG,
- no_protocol_option = ENOPROTOOPT,
- no_space_on_device = ENOSPC,
+ no_message = ENOMSG,
+ no_protocol_option = ENOPROTOOPT,
+ no_space_on_device = ENOSPC,
#ifdef ENOSR
- no_stream_resources = ENOSR,
+ no_stream_resources = ENOSR,
#else
- no_stream_resources = ENOMEM,
+ no_stream_resources = ENOMEM,
#endif
- no_such_device_or_address = ENXIO,
- no_such_device = ENODEV,
- no_such_file_or_directory = ENOENT,
- no_such_process = ESRCH,
- not_a_directory = ENOTDIR,
- not_a_socket = ENOTSOCK,
+ no_such_device_or_address = ENXIO,
+ no_such_device = ENODEV,
+ no_such_file_or_directory = ENOENT,
+ no_such_process = ESRCH,
+ not_a_directory = ENOTDIR,
+ not_a_socket = ENOTSOCK,
#ifdef ENOSTR
- not_a_stream = ENOSTR,
+ not_a_stream = ENOSTR,
#else
- not_a_stream = EINVAL,
+ not_a_stream = EINVAL,
#endif
- not_connected = ENOTCONN,
- not_enough_memory = ENOMEM,
- not_supported = ENOTSUP,
- operation_canceled = ECANCELED,
- operation_in_progress = EINPROGRESS,
- operation_not_permitted = EPERM,
- operation_not_supported = EOPNOTSUPP,
- operation_would_block = EWOULDBLOCK,
- owner_dead = EOWNERDEAD,
- permission_denied = EACCES,
- protocol_error = EPROTO,
- protocol_not_supported = EPROTONOSUPPORT,
- read_only_file_system = EROFS,
- resource_deadlock_would_occur = EDEADLK,
- resource_unavailable_try_again = EAGAIN,
- result_out_of_range = ERANGE,
- state_not_recoverable = ENOTRECOVERABLE,
+ not_connected = ENOTCONN,
+ not_enough_memory = ENOMEM,
+ not_supported = ENOTSUP,
+ operation_canceled = ECANCELED,
+ operation_in_progress = EINPROGRESS,
+ operation_not_permitted = EPERM,
+ operation_not_supported = EOPNOTSUPP,
+ operation_would_block = EWOULDBLOCK,
+ owner_dead = EOWNERDEAD,
+ permission_denied = EACCES,
+ protocol_error = EPROTO,
+ protocol_not_supported = EPROTONOSUPPORT,
+ read_only_file_system = EROFS,
+ resource_deadlock_would_occur = EDEADLK,
+ resource_unavailable_try_again = EAGAIN,
+ result_out_of_range = ERANGE,
+ state_not_recoverable = ENOTRECOVERABLE,
#ifdef ETIME
- stream_timeout = ETIME,
+ stream_timeout = ETIME,
#else
- stream_timeout = ETIMEDOUT,
+ stream_timeout = ETIMEDOUT,
#endif
- text_file_busy = ETXTBSY,
- timed_out = ETIMEDOUT,
- too_many_files_open_in_system = ENFILE,
- too_many_files_open = EMFILE,
- too_many_links = EMLINK,
- too_many_symbolic_link_levels = ELOOP,
- value_too_large = EOVERFLOW,
- wrong_protocol_type = EPROTOTYPE
-};
+ text_file_busy = ETXTBSY,
+ timed_out = ETIMEDOUT,
+ too_many_files_open_in_system = ENFILE,
+ too_many_files_open = EMFILE,
+ too_many_links = EMLINK,
+ too_many_symbolic_link_levels = ELOOP,
+ value_too_large = EOVERFLOW,
+ wrong_protocol_type = EPROTOTYPE};
_LIBCPP_DECLARE_STRONG_ENUM_EPILOG(errc)
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__thread/formatter.h b/contrib/llvm-project/libcxx/include/__thread/formatter.h
index 0e3a11c514e1..0454864ce939 100644
--- a/contrib/llvm-project/libcxx/include/__thread/formatter.h
+++ b/contrib/llvm-project/libcxx/include/__thread/formatter.h
@@ -31,47 +31,47 @@
_LIBCPP_BEGIN_NAMESPACE_STD
-#ifndef _LIBCPP_HAS_NO_THREADS
+# ifndef _LIBCPP_HAS_NO_THREADS
template <__fmt_char_type _CharT>
struct _LIBCPP_TEMPLATE_VIS formatter<__thread_id, _CharT> {
- public:
- template <class _ParseContext>
- _LIBCPP_HIDE_FROM_ABI constexpr typename _ParseContext::iterator parse(_ParseContext& __ctx) {
- return __parser_.__parse(__ctx, __format_spec::__fields_fill_align_width);
- }
+public:
+ template <class _ParseContext>
+ _LIBCPP_HIDE_FROM_ABI constexpr typename _ParseContext::iterator parse(_ParseContext& __ctx) {
+ return __parser_.__parse(__ctx, __format_spec::__fields_fill_align_width);
+ }
- template <class _FormatContext>
- _LIBCPP_HIDE_FROM_ABI typename _FormatContext::iterator format(__thread_id __id, _FormatContext& __ctx) const {
- // In __threading_support __libcpp_thread_id is either a
- // unsigned long long or a pthread_t.
- //
- // The type of pthread_t is left unspecified in POSIX so it can be any
- // type. The most logical types are an integral or pointer.
- // On Linux systems pthread_t is an unsigned long long.
- // On Apple systems pthread_t is a pointer type.
- //
- // Note the output should match what the stream operator does. Since
- // the ostream operator has been shipped years before this formatter
- // was added to the Standard, this formatter does what the stream
- // operator does. This may require platform specific changes.
+ template <class _FormatContext>
+ _LIBCPP_HIDE_FROM_ABI typename _FormatContext::iterator format(__thread_id __id, _FormatContext& __ctx) const {
+ // In __threading_support __libcpp_thread_id is either a
+ // unsigned long long or a pthread_t.
+ //
+ // The type of pthread_t is left unspecified in POSIX so it can be any
+ // type. The most logical types are an integral or pointer.
+ // On Linux systems pthread_t is an unsigned long long.
+ // On Apple systems pthread_t is a pointer type.
+ //
+ // Note the output should match what the stream operator does. Since
+ // the ostream operator has been shipped years before this formatter
+ // was added to the Standard, this formatter does what the stream
+ // operator does. This may require platform specific changes.
- using _Tp = decltype(__get_underlying_id(__id));
- using _Cp = conditional_t<integral<_Tp>, _Tp, conditional_t<is_pointer_v<_Tp>, uintptr_t, void>>;
- static_assert(!is_same_v<_Cp, void>, "unsupported thread::id type, please file a bug report");
+ using _Tp = decltype(__get_underlying_id(__id));
+ using _Cp = conditional_t<integral<_Tp>, _Tp, conditional_t<is_pointer_v<_Tp>, uintptr_t, void>>;
+ static_assert(!is_same_v<_Cp, void>, "unsupported thread::id type, please file a bug report");
- __format_spec::__parsed_specifications<_CharT> __specs = __parser_.__get_parsed_std_specifications(__ctx);
- if constexpr (is_pointer_v<_Tp>) {
- __specs.__std_.__alternate_form_ = true;
- __specs.__std_.__type_ = __format_spec::__type::__hexadecimal_lower_case;
- }
- return __formatter::__format_integer(reinterpret_cast<_Cp>(__get_underlying_id(__id)), __ctx, __specs);
+ __format_spec::__parsed_specifications<_CharT> __specs = __parser_.__get_parsed_std_specifications(__ctx);
+ if constexpr (is_pointer_v<_Tp>) {
+ __specs.__std_.__alternate_form_ = true;
+ __specs.__std_.__type_ = __format_spec::__type::__hexadecimal_lower_case;
}
+ return __formatter::__format_integer(reinterpret_cast<_Cp>(__get_underlying_id(__id)), __ctx, __specs);
+ }
- __format_spec::__parser<_CharT> __parser_{.__alignment_ = __format_spec::__alignment::__right};
+ __format_spec::__parser<_CharT> __parser_{.__alignment_ = __format_spec::__alignment::__right};
};
-#endif // !_LIBCPP_HAS_NO_THREADS
+# endif // !_LIBCPP_HAS_NO_THREADS
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__thread/poll_with_backoff.h b/contrib/llvm-project/libcxx/include/__thread/poll_with_backoff.h
index d027a2779d8e..0a2eef9a52d2 100644
--- a/contrib/llvm-project/libcxx/include/__thread/poll_with_backoff.h
+++ b/contrib/llvm-project/libcxx/include/__thread/poll_with_backoff.h
@@ -34,23 +34,23 @@ static _LIBCPP_CONSTEXPR const int __libcpp_polling_count = 64;
//
// - __max_elapsed is the maximum duration to try polling for. If the maximum duration is exceeded,
// the polling loop will return false to report a timeout.
-template<class _Fn, class _BFn>
-_LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI
-bool __libcpp_thread_poll_with_backoff(_Fn&& __f, _BFn&& __bf, chrono::nanoseconds __max_elapsed = chrono::nanoseconds::zero()) {
- auto const __start = chrono::high_resolution_clock::now();
- for (int __count = 0;;) {
- if (__f())
- return true; // _Fn completion means success
- if (__count < __libcpp_polling_count) {
- __count += 1;
- continue;
- }
- chrono::nanoseconds const __elapsed = chrono::high_resolution_clock::now() - __start;
- if (__max_elapsed != chrono::nanoseconds::zero() && __max_elapsed < __elapsed)
- return false; // timeout failure
- if (__bf(__elapsed))
- return false; // _BFn completion means failure
+template <class _Fn, class _BFn>
+_LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI bool __libcpp_thread_poll_with_backoff(
+ _Fn&& __f, _BFn&& __bf, chrono::nanoseconds __max_elapsed = chrono::nanoseconds::zero()) {
+ auto const __start = chrono::high_resolution_clock::now();
+ for (int __count = 0;;) {
+ if (__f())
+ return true; // _Fn completion means success
+ if (__count < __libcpp_polling_count) {
+ __count += 1;
+ continue;
}
+ chrono::nanoseconds const __elapsed = chrono::high_resolution_clock::now() - __start;
+ if (__max_elapsed != chrono::nanoseconds::zero() && __max_elapsed < __elapsed)
+ return false; // timeout failure
+ if (__bf(__elapsed))
+ return false; // _BFn completion means failure
+ }
}
// A trivial backoff policy that always immediately returns the control to
@@ -60,10 +60,7 @@ bool __libcpp_thread_poll_with_backoff(_Fn&& __f, _BFn&& __bf, chrono::nanosecon
// so this should most likely only be used on single-threaded systems where there
// are no other threads to compete with.
struct __spinning_backoff_policy {
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR
- bool operator()(chrono::nanoseconds const&) const {
- return false;
- }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool operator()(chrono::nanoseconds const&) const { return false; }
};
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__thread/this_thread.h b/contrib/llvm-project/libcxx/include/__thread/this_thread.h
index 6b79aee9531f..6fb42533aab7 100644
--- a/contrib/llvm-project/libcxx/include/__thread/this_thread.h
+++ b/contrib/llvm-project/libcxx/include/__thread/this_thread.h
@@ -27,56 +27,43 @@ _LIBCPP_PUSH_MACROS
_LIBCPP_BEGIN_NAMESPACE_STD
-namespace this_thread
-{
+namespace this_thread {
_LIBCPP_EXPORTED_FROM_ABI void sleep_for(const chrono::nanoseconds& __ns);
template <class _Rep, class _Period>
-_LIBCPP_HIDE_FROM_ABI void
-sleep_for(const chrono::duration<_Rep, _Period>& __d)
-{
- if (__d > chrono::duration<_Rep, _Period>::zero())
- {
- // The standard guarantees a 64bit signed integer resolution for nanoseconds,
- // so use INT64_MAX / 1e9 as cut-off point. Use a constant to avoid <climits>
- // and issues with long double folding on PowerPC with GCC.
- _LIBCPP_CONSTEXPR chrono::duration<long double> __max =
- chrono::duration<long double>(9223372036.0L);
- chrono::nanoseconds __ns;
- if (__d < __max)
- {
- __ns = chrono::duration_cast<chrono::nanoseconds>(__d);
- if (__ns < __d)
- ++__ns;
- }
- else
- __ns = chrono::nanoseconds::max();
- this_thread::sleep_for(__ns);
- }
+_LIBCPP_HIDE_FROM_ABI void sleep_for(const chrono::duration<_Rep, _Period>& __d) {
+ if (__d > chrono::duration<_Rep, _Period>::zero()) {
+ // The standard guarantees a 64bit signed integer resolution for nanoseconds,
+ // so use INT64_MAX / 1e9 as cut-off point. Use a constant to avoid <climits>
+ // and issues with long double folding on PowerPC with GCC.
+ _LIBCPP_CONSTEXPR chrono::duration<long double> __max = chrono::duration<long double>(9223372036.0L);
+ chrono::nanoseconds __ns;
+ if (__d < __max) {
+ __ns = chrono::duration_cast<chrono::nanoseconds>(__d);
+ if (__ns < __d)
+ ++__ns;
+ } else
+ __ns = chrono::nanoseconds::max();
+ this_thread::sleep_for(__ns);
+ }
}
template <class _Clock, class _Duration>
-_LIBCPP_HIDE_FROM_ABI void
-sleep_until(const chrono::time_point<_Clock, _Duration>& __t)
-{
- mutex __mut;
- condition_variable __cv;
- unique_lock<mutex> __lk(__mut);
- while (_Clock::now() < __t)
- __cv.wait_until(__lk, __t);
+_LIBCPP_HIDE_FROM_ABI void sleep_until(const chrono::time_point<_Clock, _Duration>& __t) {
+ mutex __mut;
+ condition_variable __cv;
+ unique_lock<mutex> __lk(__mut);
+ while (_Clock::now() < __t)
+ __cv.wait_until(__lk, __t);
}
template <class _Duration>
-inline _LIBCPP_HIDE_FROM_ABI
-void
-sleep_until(const chrono::time_point<chrono::steady_clock, _Duration>& __t)
-{
- this_thread::sleep_for(__t - chrono::steady_clock::now());
+inline _LIBCPP_HIDE_FROM_ABI void sleep_until(const chrono::time_point<chrono::steady_clock, _Duration>& __t) {
+ this_thread::sleep_for(__t - chrono::steady_clock::now());
}
-inline _LIBCPP_HIDE_FROM_ABI
-void yield() _NOEXCEPT {__libcpp_thread_yield();}
+inline _LIBCPP_HIDE_FROM_ABI void yield() _NOEXCEPT { __libcpp_thread_yield(); }
} // namespace this_thread
diff --git a/contrib/llvm-project/libcxx/include/__thread/thread.h b/contrib/llvm-project/libcxx/include/__thread/thread.h
index ee37a0320d69..f3300752ac9e 100644
--- a/contrib/llvm-project/libcxx/include/__thread/thread.h
+++ b/contrib/llvm-project/libcxx/include/__thread/thread.h
@@ -34,262 +34,220 @@
_LIBCPP_BEGIN_NAMESPACE_STD
-template <class _Tp> class __thread_specific_ptr;
+template <class _Tp>
+class __thread_specific_ptr;
class _LIBCPP_EXPORTED_FROM_ABI __thread_struct;
class _LIBCPP_HIDDEN __thread_struct_imp;
class __assoc_sub_state;
_LIBCPP_EXPORTED_FROM_ABI __thread_specific_ptr<__thread_struct>& __thread_local_data();
-class _LIBCPP_EXPORTED_FROM_ABI __thread_struct
-{
- __thread_struct_imp* __p_;
+class _LIBCPP_EXPORTED_FROM_ABI __thread_struct {
+ __thread_struct_imp* __p_;
+
+ __thread_struct(const __thread_struct&);
+ __thread_struct& operator=(const __thread_struct&);
- __thread_struct(const __thread_struct&);
- __thread_struct& operator=(const __thread_struct&);
public:
- __thread_struct();
- ~__thread_struct();
+ __thread_struct();
+ ~__thread_struct();
- void notify_all_at_thread_exit(condition_variable*, mutex*);
- void __make_ready_at_thread_exit(__assoc_sub_state*);
+ void notify_all_at_thread_exit(condition_variable*, mutex*);
+ void __make_ready_at_thread_exit(__assoc_sub_state*);
};
template <class _Tp>
-class __thread_specific_ptr
-{
- __libcpp_tls_key __key_;
+class __thread_specific_ptr {
+ __libcpp_tls_key __key_;
- // Only __thread_local_data() may construct a __thread_specific_ptr
- // and only with _Tp == __thread_struct.
- static_assert((is_same<_Tp, __thread_struct>::value), "");
- __thread_specific_ptr();
- friend _LIBCPP_EXPORTED_FROM_ABI __thread_specific_ptr<__thread_struct>& __thread_local_data();
+ // Only __thread_local_data() may construct a __thread_specific_ptr
+ // and only with _Tp == __thread_struct.
+ static_assert((is_same<_Tp, __thread_struct>::value), "");
+ __thread_specific_ptr();
+ friend _LIBCPP_EXPORTED_FROM_ABI __thread_specific_ptr<__thread_struct>& __thread_local_data();
- __thread_specific_ptr(const __thread_specific_ptr&);
- __thread_specific_ptr& operator=(const __thread_specific_ptr&);
+ __thread_specific_ptr(const __thread_specific_ptr&);
+ __thread_specific_ptr& operator=(const __thread_specific_ptr&);
- _LIBCPP_HIDDEN static void _LIBCPP_TLS_DESTRUCTOR_CC __at_thread_exit(void*);
+ _LIBCPP_HIDDEN static void _LIBCPP_TLS_DESTRUCTOR_CC __at_thread_exit(void*);
public:
- typedef _Tp* pointer;
+ typedef _Tp* pointer;
- ~__thread_specific_ptr();
+ ~__thread_specific_ptr();
- _LIBCPP_HIDE_FROM_ABI
- pointer get() const {return static_cast<_Tp*>(__libcpp_tls_get(__key_));}
- _LIBCPP_HIDE_FROM_ABI
- pointer operator*() const {return *get();}
- _LIBCPP_HIDE_FROM_ABI
- pointer operator->() const {return get();}
- void set_pointer(pointer __p);
+ _LIBCPP_HIDE_FROM_ABI pointer get() const { return static_cast<_Tp*>(__libcpp_tls_get(__key_)); }
+ _LIBCPP_HIDE_FROM_ABI pointer operator*() const { return *get(); }
+ _LIBCPP_HIDE_FROM_ABI pointer operator->() const { return get(); }
+ void set_pointer(pointer __p);
};
template <class _Tp>
-void _LIBCPP_TLS_DESTRUCTOR_CC
-__thread_specific_ptr<_Tp>::__at_thread_exit(void* __p)
-{
- delete static_cast<pointer>(__p);
+void _LIBCPP_TLS_DESTRUCTOR_CC __thread_specific_ptr<_Tp>::__at_thread_exit(void* __p) {
+ delete static_cast<pointer>(__p);
}
template <class _Tp>
-__thread_specific_ptr<_Tp>::__thread_specific_ptr()
-{
- int __ec =
- __libcpp_tls_create(&__key_, &__thread_specific_ptr::__at_thread_exit);
+__thread_specific_ptr<_Tp>::__thread_specific_ptr() {
+ int __ec = __libcpp_tls_create(&__key_, &__thread_specific_ptr::__at_thread_exit);
if (__ec)
__throw_system_error(__ec, "__thread_specific_ptr construction failed");
}
template <class _Tp>
-__thread_specific_ptr<_Tp>::~__thread_specific_ptr()
-{
- // __thread_specific_ptr is only created with a static storage duration
- // so this destructor is only invoked during program termination. Invoking
- // pthread_key_delete(__key_) may prevent other threads from deleting their
- // thread local data. For this reason we leak the key.
+__thread_specific_ptr<_Tp>::~__thread_specific_ptr() {
+ // __thread_specific_ptr is only created with a static storage duration
+ // so this destructor is only invoked during program termination. Invoking
+ // pthread_key_delete(__key_) may prevent other threads from deleting their
+ // thread local data. For this reason we leak the key.
}
template <class _Tp>
-void
-__thread_specific_ptr<_Tp>::set_pointer(pointer __p)
-{
- _LIBCPP_ASSERT_UNCATEGORIZED(get() == nullptr,
- "Attempting to overwrite thread local data");
- std::__libcpp_tls_set(__key_, __p);
+void __thread_specific_ptr<_Tp>::set_pointer(pointer __p) {
+ _LIBCPP_ASSERT_UNCATEGORIZED(get() == nullptr, "Attempting to overwrite thread local data");
+ std::__libcpp_tls_set(__key_, __p);
}
-template<>
-struct _LIBCPP_TEMPLATE_VIS hash<__thread_id>
- : public __unary_function<__thread_id, size_t>
-{
- _LIBCPP_HIDE_FROM_ABI
- size_t operator()(__thread_id __v) const _NOEXCEPT
- {
- return hash<__libcpp_thread_id>()(__v.__id_);
- }
+template <>
+struct _LIBCPP_TEMPLATE_VIS hash<__thread_id> : public __unary_function<__thread_id, size_t> {
+ _LIBCPP_HIDE_FROM_ABI size_t operator()(__thread_id __v) const _NOEXCEPT {
+ return hash<__libcpp_thread_id>()(__v.__id_);
+ }
};
#ifndef _LIBCPP_HAS_NO_LOCALIZATION
template <class _CharT, class _Traits>
_LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>&
operator<<(basic_ostream<_CharT, _Traits>& __os, __thread_id __id) {
- // [thread.thread.id]/9
- // Effects: Inserts the text representation for charT of id into out.
- //
- // [thread.thread.id]/2
- // The text representation for the character type charT of an
- // object of type thread::id is an unspecified sequence of charT
- // such that, for two objects of type thread::id x and y, if
- // x == y is true, the thread::id objects have the same text
- // representation, and if x != y is true, the thread::id objects
- // have distinct text representations.
- //
- // Since various flags in the output stream can affect how the
- // thread id is represented (e.g. numpunct or showbase), we
- // use a temporary stream instead and just output the thread
- // id representation as a string.
-
- basic_ostringstream<_CharT, _Traits> __sstr;
- __sstr.imbue(locale::classic());
- __sstr << __id.__id_;
- return __os << __sstr.str();
+ // [thread.thread.id]/9
+ // Effects: Inserts the text representation for charT of id into out.
+ //
+ // [thread.thread.id]/2
+ // The text representation for the character type charT of an
+ // object of type thread::id is an unspecified sequence of charT
+ // such that, for two objects of type thread::id x and y, if
+ // x == y is true, the thread::id objects have the same text
+ // representation, and if x != y is true, the thread::id objects
+ // have distinct text representations.
+ //
+ // Since various flags in the output stream can affect how the
+ // thread id is represented (e.g. numpunct or showbase), we
+ // use a temporary stream instead and just output the thread
+ // id representation as a string.
+
+ basic_ostringstream<_CharT, _Traits> __sstr;
+ __sstr.imbue(locale::classic());
+ __sstr << __id.__id_;
+ return __os << __sstr.str();
}
#endif // _LIBCPP_HAS_NO_LOCALIZATION
-class _LIBCPP_EXPORTED_FROM_ABI thread
-{
- __libcpp_thread_t __t_;
+class _LIBCPP_EXPORTED_FROM_ABI thread {
+ __libcpp_thread_t __t_;
+
+ thread(const thread&);
+ thread& operator=(const thread&);
- thread(const thread&);
- thread& operator=(const thread&);
public:
- typedef __thread_id id;
- typedef __libcpp_thread_t native_handle_type;
+ typedef __thread_id id;
+ typedef __libcpp_thread_t native_handle_type;
- _LIBCPP_HIDE_FROM_ABI
- thread() _NOEXCEPT : __t_(_LIBCPP_NULL_THREAD) {}
+ _LIBCPP_HIDE_FROM_ABI thread() _NOEXCEPT : __t_(_LIBCPP_NULL_THREAD) {}
#ifndef _LIBCPP_CXX03_LANG
- template <class _Fp, class ..._Args,
- class = __enable_if_t<!is_same<__remove_cvref_t<_Fp>, thread>::value> >
- _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
- explicit thread(_Fp&& __f, _Args&&... __args);
-#else // _LIBCPP_CXX03_LANG
- template <class _Fp>
- _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
- explicit thread(_Fp __f);
+ template <class _Fp, class... _Args, class = __enable_if_t<!is_same<__remove_cvref_t<_Fp>, thread>::value> >
+ _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS explicit thread(_Fp&& __f, _Args&&... __args);
+#else // _LIBCPP_CXX03_LANG
+ template <class _Fp>
+ _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS explicit thread(_Fp __f);
#endif
- ~thread();
-
- _LIBCPP_HIDE_FROM_ABI
- thread(thread&& __t) _NOEXCEPT : __t_(__t.__t_) {
- __t.__t_ = _LIBCPP_NULL_THREAD;
- }
-
- _LIBCPP_HIDE_FROM_ABI
- thread& operator=(thread&& __t) _NOEXCEPT {
- if (!__libcpp_thread_isnull(&__t_))
- terminate();
- __t_ = __t.__t_;
- __t.__t_ = _LIBCPP_NULL_THREAD;
- return *this;
- }
-
- _LIBCPP_HIDE_FROM_ABI
- void swap(thread& __t) _NOEXCEPT {std::swap(__t_, __t.__t_);}
-
- _LIBCPP_HIDE_FROM_ABI
- bool joinable() const _NOEXCEPT {return !__libcpp_thread_isnull(&__t_);}
- void join();
- void detach();
- _LIBCPP_HIDE_FROM_ABI
- id get_id() const _NOEXCEPT {return __libcpp_thread_get_id(&__t_);}
- _LIBCPP_HIDE_FROM_ABI
- native_handle_type native_handle() _NOEXCEPT {return __t_;}
-
- static unsigned hardware_concurrency() _NOEXCEPT;
+ ~thread();
+
+ _LIBCPP_HIDE_FROM_ABI thread(thread&& __t) _NOEXCEPT : __t_(__t.__t_) { __t.__t_ = _LIBCPP_NULL_THREAD; }
+
+ _LIBCPP_HIDE_FROM_ABI thread& operator=(thread&& __t) _NOEXCEPT {
+ if (!__libcpp_thread_isnull(&__t_))
+ terminate();
+ __t_ = __t.__t_;
+ __t.__t_ = _LIBCPP_NULL_THREAD;
+ return *this;
+ }
+
+ _LIBCPP_HIDE_FROM_ABI void swap(thread& __t) _NOEXCEPT { std::swap(__t_, __t.__t_); }
+
+ _LIBCPP_HIDE_FROM_ABI bool joinable() const _NOEXCEPT { return !__libcpp_thread_isnull(&__t_); }
+ void join();
+ void detach();
+ _LIBCPP_HIDE_FROM_ABI id get_id() const _NOEXCEPT { return __libcpp_thread_get_id(&__t_); }
+ _LIBCPP_HIDE_FROM_ABI native_handle_type native_handle() _NOEXCEPT { return __t_; }
+
+ static unsigned hardware_concurrency() _NOEXCEPT;
};
#ifndef _LIBCPP_CXX03_LANG
-template <class _TSp, class _Fp, class ..._Args, size_t ..._Indices>
-inline _LIBCPP_HIDE_FROM_ABI
-void
-__thread_execute(tuple<_TSp, _Fp, _Args...>& __t, __tuple_indices<_Indices...>)
-{
- std::__invoke(std::move(std::get<1>(__t)), std::move(std::get<_Indices>(__t))...);
+template <class _TSp, class _Fp, class... _Args, size_t... _Indices>
+inline _LIBCPP_HIDE_FROM_ABI void __thread_execute(tuple<_TSp, _Fp, _Args...>& __t, __tuple_indices<_Indices...>) {
+ std::__invoke(std::move(std::get<1>(__t)), std::move(std::get<_Indices>(__t))...);
}
template <class _Fp>
-_LIBCPP_HIDE_FROM_ABI
-void* __thread_proxy(void* __vp)
-{
- // _Fp = tuple< unique_ptr<__thread_struct>, Functor, Args...>
- unique_ptr<_Fp> __p(static_cast<_Fp*>(__vp));
- __thread_local_data().set_pointer(std::get<0>(*__p.get()).release());
- typedef typename __make_tuple_indices<tuple_size<_Fp>::value, 2>::type _Index;
- std::__thread_execute(*__p.get(), _Index());
- return nullptr;
+_LIBCPP_HIDE_FROM_ABI void* __thread_proxy(void* __vp) {
+ // _Fp = tuple< unique_ptr<__thread_struct>, Functor, Args...>
+ unique_ptr<_Fp> __p(static_cast<_Fp*>(__vp));
+ __thread_local_data().set_pointer(std::get<0>(*__p.get()).release());
+ typedef typename __make_tuple_indices<tuple_size<_Fp>::value, 2>::type _Index;
+ std::__thread_execute(*__p.get(), _Index());
+ return nullptr;
}
-template <class _Fp, class ..._Args,
- class
- >
-thread::thread(_Fp&& __f, _Args&&... __args)
-{
- typedef unique_ptr<__thread_struct> _TSPtr;
- _TSPtr __tsp(new __thread_struct);
- typedef tuple<_TSPtr, __decay_t<_Fp>, __decay_t<_Args>...> _Gp;
- unique_ptr<_Gp> __p(
- new _Gp(std::move(__tsp),
- std::forward<_Fp>(__f),
- std::forward<_Args>(__args)...));
- int __ec = std::__libcpp_thread_create(&__t_, &__thread_proxy<_Gp>, __p.get());
- if (__ec == 0)
- __p.release();
- else
- __throw_system_error(__ec, "thread constructor failed");
+template <class _Fp, class... _Args, class >
+thread::thread(_Fp&& __f, _Args&&... __args) {
+ typedef unique_ptr<__thread_struct> _TSPtr;
+ _TSPtr __tsp(new __thread_struct);
+ typedef tuple<_TSPtr, __decay_t<_Fp>, __decay_t<_Args>...> _Gp;
+ unique_ptr<_Gp> __p(new _Gp(std::move(__tsp), std::forward<_Fp>(__f), std::forward<_Args>(__args)...));
+ int __ec = std::__libcpp_thread_create(&__t_, &__thread_proxy<_Gp>, __p.get());
+ if (__ec == 0)
+ __p.release();
+ else
+ __throw_system_error(__ec, "thread constructor failed");
}
-#else // _LIBCPP_CXX03_LANG
+#else // _LIBCPP_CXX03_LANG
template <class _Fp>
struct __thread_invoke_pair {
- // This type is used to pass memory for thread local storage and a functor
- // to a newly created thread because std::pair doesn't work with
- // std::unique_ptr in C++03.
- _LIBCPP_HIDE_FROM_ABI __thread_invoke_pair(_Fp& __f) : __tsp_(new __thread_struct), __fn_(__f) {}
- unique_ptr<__thread_struct> __tsp_;
- _Fp __fn_;
+ // This type is used to pass memory for thread local storage and a functor
+ // to a newly created thread because std::pair doesn't work with
+ // std::unique_ptr in C++03.
+ _LIBCPP_HIDE_FROM_ABI __thread_invoke_pair(_Fp& __f) : __tsp_(new __thread_struct), __fn_(__f) {}
+ unique_ptr<__thread_struct> __tsp_;
+ _Fp __fn_;
};
template <class _Fp>
-_LIBCPP_HIDE_FROM_ABI void* __thread_proxy_cxx03(void* __vp)
-{
- unique_ptr<_Fp> __p(static_cast<_Fp*>(__vp));
- __thread_local_data().set_pointer(__p->__tsp_.release());
- (__p->__fn_)();
- return nullptr;
+_LIBCPP_HIDE_FROM_ABI void* __thread_proxy_cxx03(void* __vp) {
+ unique_ptr<_Fp> __p(static_cast<_Fp*>(__vp));
+ __thread_local_data().set_pointer(__p->__tsp_.release());
+ (__p->__fn_)();
+ return nullptr;
}
template <class _Fp>
-thread::thread(_Fp __f)
-{
-
- typedef __thread_invoke_pair<_Fp> _InvokePair;
- typedef unique_ptr<_InvokePair> _PairPtr;
- _PairPtr __pp(new _InvokePair(__f));
- int __ec = std::__libcpp_thread_create(&__t_, &__thread_proxy_cxx03<_InvokePair>, __pp.get());
- if (__ec == 0)
- __pp.release();
- else
- __throw_system_error(__ec, "thread constructor failed");
+thread::thread(_Fp __f) {
+ typedef __thread_invoke_pair<_Fp> _InvokePair;
+ typedef unique_ptr<_InvokePair> _PairPtr;
+ _PairPtr __pp(new _InvokePair(__f));
+ int __ec = std::__libcpp_thread_create(&__t_, &__thread_proxy_cxx03<_InvokePair>, __pp.get());
+ if (__ec == 0)
+ __pp.release();
+ else
+ __throw_system_error(__ec, "thread constructor failed");
}
#endif // _LIBCPP_CXX03_LANG
-inline _LIBCPP_HIDE_FROM_ABI
-void swap(thread& __x, thread& __y) _NOEXCEPT {__x.swap(__y);}
+inline _LIBCPP_HIDE_FROM_ABI void swap(thread& __x, thread& __y) _NOEXCEPT { __x.swap(__y); }
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__thread/timed_backoff_policy.h b/contrib/llvm-project/libcxx/include/__thread/timed_backoff_policy.h
index 456cfcc3d986..525f52b34914 100644
--- a/contrib/llvm-project/libcxx/include/__thread/timed_backoff_policy.h
+++ b/contrib/llvm-project/libcxx/include/__thread/timed_backoff_policy.h
@@ -17,25 +17,23 @@
# include <__chrono/duration.h>
# include <__threading_support>
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
+# if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+# pragma GCC system_header
+# endif
_LIBCPP_BEGIN_NAMESPACE_STD
struct __libcpp_timed_backoff_policy {
- _LIBCPP_HIDE_FROM_ABI
- bool operator()(chrono::nanoseconds __elapsed) const
- {
- if(__elapsed > chrono::milliseconds(128))
- __libcpp_thread_sleep_for(chrono::milliseconds(8));
- else if(__elapsed > chrono::microseconds(64))
- __libcpp_thread_sleep_for(__elapsed / 2);
- else if(__elapsed > chrono::microseconds(4))
- __libcpp_thread_yield();
- else
- {} // poll
- return false;
+ _LIBCPP_HIDE_FROM_ABI bool operator()(chrono::nanoseconds __elapsed) const {
+ if (__elapsed > chrono::milliseconds(128))
+ __libcpp_thread_sleep_for(chrono::milliseconds(8));
+ else if (__elapsed > chrono::microseconds(64))
+ __libcpp_thread_sleep_for(__elapsed / 2);
+ else if (__elapsed > chrono::microseconds(4))
+ __libcpp_thread_yield();
+ else {
+ } // poll
+ return false;
}
};
diff --git a/contrib/llvm-project/libcxx/include/__threading_support b/contrib/llvm-project/libcxx/include/__threading_support
index 3af1a778ecf7..ea6db4a3d59c 100644
--- a/contrib/llvm-project/libcxx/include/__threading_support
+++ b/contrib/llvm-project/libcxx/include/__threading_support
@@ -19,7 +19,7 @@
#include <errno.h>
#ifdef __MVS__
-# include <__support/ibm/nanosleep.h>
+# include <__support/ibm/nanosleep.h>
#endif
#ifndef _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER
@@ -27,29 +27,29 @@
#endif
#if defined(_LIBCPP_HAS_THREAD_API_EXTERNAL)
-# include <__external_threading>
+# include <__external_threading>
#elif !defined(_LIBCPP_HAS_NO_THREADS)
-#if defined(_LIBCPP_HAS_THREAD_API_PTHREAD)
+# if defined(_LIBCPP_HAS_THREAD_API_PTHREAD)
// Some platforms require <bits/atomic_wide_counter.h> in order for
// PTHREAD_COND_INITIALIZER to be expanded. Normally that would come
// in via <pthread.h>, but it's a non-modular header on those platforms,
// so libc++'s <math.h> usually absorbs atomic_wide_counter.h into the
// module with <math.h> and makes atomic_wide_counter.h invisible.
// Include <math.h> here to work around that.
-# include <math.h>
+# include <math.h>
-# include <pthread.h>
-# include <sched.h>
-#elif defined(_LIBCPP_HAS_THREAD_API_C11)
-# include <threads.h>
-#endif
+# include <pthread.h>
+# include <sched.h>
+# elif defined(_LIBCPP_HAS_THREAD_API_C11)
+# include <threads.h>
+# endif
-#if defined(_LIBCPP_HAS_THREAD_API_WIN32)
-#define _LIBCPP_THREAD_ABI_VISIBILITY _LIBCPP_EXPORTED_FROM_ABI
-#else
-#define _LIBCPP_THREAD_ABI_VISIBILITY inline _LIBCPP_HIDE_FROM_ABI
-#endif
+# if defined(_LIBCPP_HAS_THREAD_API_WIN32)
+# define _LIBCPP_THREAD_ABI_VISIBILITY _LIBCPP_EXPORTED_FROM_ABI
+# else
+# define _LIBCPP_THREAD_ABI_VISIBILITY inline _LIBCPP_HIDE_FROM_ABI
+# endif
typedef ::timespec __libcpp_timespec_t;
#endif // !defined(_LIBCPP_HAS_NO_THREADS)
@@ -58,128 +58,127 @@ _LIBCPP_BEGIN_NAMESPACE_STD
#if !defined(_LIBCPP_HAS_NO_THREADS)
-#if defined(_LIBCPP_HAS_THREAD_API_PTHREAD)
+# if defined(_LIBCPP_HAS_THREAD_API_PTHREAD)
// Mutex
typedef pthread_mutex_t __libcpp_mutex_t;
-#define _LIBCPP_MUTEX_INITIALIZER PTHREAD_MUTEX_INITIALIZER
+# define _LIBCPP_MUTEX_INITIALIZER PTHREAD_MUTEX_INITIALIZER
typedef pthread_mutex_t __libcpp_recursive_mutex_t;
// Condition Variable
typedef pthread_cond_t __libcpp_condvar_t;
-#define _LIBCPP_CONDVAR_INITIALIZER PTHREAD_COND_INITIALIZER
+# define _LIBCPP_CONDVAR_INITIALIZER PTHREAD_COND_INITIALIZER
// Execute once
typedef pthread_once_t __libcpp_exec_once_flag;
-#define _LIBCPP_EXEC_ONCE_INITIALIZER PTHREAD_ONCE_INIT
+# define _LIBCPP_EXEC_ONCE_INITIALIZER PTHREAD_ONCE_INIT
// Thread id
-#if defined(__MVS__)
- typedef unsigned long long __libcpp_thread_id;
-#else
- typedef pthread_t __libcpp_thread_id;
-#endif
+# if defined(__MVS__)
+typedef unsigned long long __libcpp_thread_id;
+# else
+typedef pthread_t __libcpp_thread_id;
+# endif
// Thread
-#define _LIBCPP_NULL_THREAD ((__libcpp_thread_t()))
+# define _LIBCPP_NULL_THREAD ((__libcpp_thread_t()))
typedef pthread_t __libcpp_thread_t;
// Thread Local Storage
typedef pthread_key_t __libcpp_tls_key;
-#define _LIBCPP_TLS_DESTRUCTOR_CC
-#elif defined(_LIBCPP_HAS_THREAD_API_C11)
+# define _LIBCPP_TLS_DESTRUCTOR_CC
+# elif defined(_LIBCPP_HAS_THREAD_API_C11)
// Mutex
typedef mtx_t __libcpp_mutex_t;
// mtx_t is a struct so using {} for initialization is valid.
-#define _LIBCPP_MUTEX_INITIALIZER {}
+# define _LIBCPP_MUTEX_INITIALIZER \
+ {}
typedef mtx_t __libcpp_recursive_mutex_t;
// Condition Variable
typedef cnd_t __libcpp_condvar_t;
// cnd_t is a struct so using {} for initialization is valid.
-#define _LIBCPP_CONDVAR_INITIALIZER {}
+# define _LIBCPP_CONDVAR_INITIALIZER \
+ {}
// Execute once
typedef ::once_flag __libcpp_exec_once_flag;
-#define _LIBCPP_EXEC_ONCE_INITIALIZER ONCE_FLAG_INIT
+# define _LIBCPP_EXEC_ONCE_INITIALIZER ONCE_FLAG_INIT
// Thread id
typedef thrd_t __libcpp_thread_id;
// Thread
-#define _LIBCPP_NULL_THREAD 0U
+# define _LIBCPP_NULL_THREAD 0U
typedef thrd_t __libcpp_thread_t;
// Thread Local Storage
typedef tss_t __libcpp_tls_key;
-#define _LIBCPP_TLS_DESTRUCTOR_CC
-#elif !defined(_LIBCPP_HAS_THREAD_API_EXTERNAL)
+# define _LIBCPP_TLS_DESTRUCTOR_CC
+# elif !defined(_LIBCPP_HAS_THREAD_API_EXTERNAL)
// Mutex
typedef void* __libcpp_mutex_t;
-#define _LIBCPP_MUTEX_INITIALIZER 0
+# define _LIBCPP_MUTEX_INITIALIZER 0
-#if defined(_M_IX86) || defined(__i386__) || defined(_M_ARM) || defined(__arm__)
+# if defined(_M_IX86) || defined(__i386__) || defined(_M_ARM) || defined(__arm__)
typedef void* __libcpp_recursive_mutex_t[6];
-#elif defined(_M_AMD64) || defined(__x86_64__) || defined(_M_ARM64) || defined(__aarch64__)
+# elif defined(_M_AMD64) || defined(__x86_64__) || defined(_M_ARM64) || defined(__aarch64__)
typedef void* __libcpp_recursive_mutex_t[5];
-#else
-# error Unsupported architecture
-#endif
+# else
+# error Unsupported architecture
+# endif
// Condition Variable
typedef void* __libcpp_condvar_t;
-#define _LIBCPP_CONDVAR_INITIALIZER 0
+# define _LIBCPP_CONDVAR_INITIALIZER 0
// Execute Once
typedef void* __libcpp_exec_once_flag;
-#define _LIBCPP_EXEC_ONCE_INITIALIZER 0
+# define _LIBCPP_EXEC_ONCE_INITIALIZER 0
// Thread ID
typedef long __libcpp_thread_id;
// Thread
-#define _LIBCPP_NULL_THREAD 0U
+# define _LIBCPP_NULL_THREAD 0U
typedef void* __libcpp_thread_t;
// Thread Local Storage
typedef long __libcpp_tls_key;
-#define _LIBCPP_TLS_DESTRUCTOR_CC __stdcall
-#endif // !defined(_LIBCPP_HAS_THREAD_API_PTHREAD) && !defined(_LIBCPP_HAS_THREAD_API_EXTERNAL)
+# define _LIBCPP_TLS_DESTRUCTOR_CC __stdcall
+# endif // !defined(_LIBCPP_HAS_THREAD_API_PTHREAD) && !defined(_LIBCPP_HAS_THREAD_API_EXTERNAL)
-#if !defined(_LIBCPP_HAS_THREAD_API_EXTERNAL)
+# if !defined(_LIBCPP_HAS_THREAD_API_EXTERNAL)
// Mutex
_LIBCPP_THREAD_ABI_VISIBILITY
-int __libcpp_recursive_mutex_init(__libcpp_recursive_mutex_t *__m);
+int __libcpp_recursive_mutex_init(__libcpp_recursive_mutex_t* __m);
-_LIBCPP_THREAD_ABI_VISIBILITY _LIBCPP_NO_THREAD_SAFETY_ANALYSIS
-int __libcpp_recursive_mutex_lock(__libcpp_recursive_mutex_t *__m);
+_LIBCPP_THREAD_ABI_VISIBILITY _LIBCPP_NO_THREAD_SAFETY_ANALYSIS int
+__libcpp_recursive_mutex_lock(__libcpp_recursive_mutex_t* __m);
-_LIBCPP_THREAD_ABI_VISIBILITY _LIBCPP_NO_THREAD_SAFETY_ANALYSIS
-bool __libcpp_recursive_mutex_trylock(__libcpp_recursive_mutex_t *__m);
+_LIBCPP_THREAD_ABI_VISIBILITY _LIBCPP_NO_THREAD_SAFETY_ANALYSIS bool
+__libcpp_recursive_mutex_trylock(__libcpp_recursive_mutex_t* __m);
-_LIBCPP_THREAD_ABI_VISIBILITY _LIBCPP_NO_THREAD_SAFETY_ANALYSIS
-int __libcpp_recursive_mutex_unlock(__libcpp_recursive_mutex_t *__m);
+_LIBCPP_THREAD_ABI_VISIBILITY _LIBCPP_NO_THREAD_SAFETY_ANALYSIS int
+__libcpp_recursive_mutex_unlock(__libcpp_recursive_mutex_t* __m);
_LIBCPP_THREAD_ABI_VISIBILITY
-int __libcpp_recursive_mutex_destroy(__libcpp_recursive_mutex_t *__m);
+int __libcpp_recursive_mutex_destroy(__libcpp_recursive_mutex_t* __m);
-_LIBCPP_THREAD_ABI_VISIBILITY _LIBCPP_NO_THREAD_SAFETY_ANALYSIS
-int __libcpp_mutex_lock(__libcpp_mutex_t *__m);
+_LIBCPP_THREAD_ABI_VISIBILITY _LIBCPP_NO_THREAD_SAFETY_ANALYSIS int __libcpp_mutex_lock(__libcpp_mutex_t* __m);
-_LIBCPP_THREAD_ABI_VISIBILITY _LIBCPP_NO_THREAD_SAFETY_ANALYSIS
-bool __libcpp_mutex_trylock(__libcpp_mutex_t *__m);
+_LIBCPP_THREAD_ABI_VISIBILITY _LIBCPP_NO_THREAD_SAFETY_ANALYSIS bool __libcpp_mutex_trylock(__libcpp_mutex_t* __m);
-_LIBCPP_THREAD_ABI_VISIBILITY _LIBCPP_NO_THREAD_SAFETY_ANALYSIS
-int __libcpp_mutex_unlock(__libcpp_mutex_t *__m);
+_LIBCPP_THREAD_ABI_VISIBILITY _LIBCPP_NO_THREAD_SAFETY_ANALYSIS int __libcpp_mutex_unlock(__libcpp_mutex_t* __m);
_LIBCPP_THREAD_ABI_VISIBILITY
-int __libcpp_mutex_destroy(__libcpp_mutex_t *__m);
+int __libcpp_mutex_destroy(__libcpp_mutex_t* __m);
// Condition variable
_LIBCPP_THREAD_ABI_VISIBILITY
@@ -188,20 +187,18 @@ int __libcpp_condvar_signal(__libcpp_condvar_t* __cv);
_LIBCPP_THREAD_ABI_VISIBILITY
int __libcpp_condvar_broadcast(__libcpp_condvar_t* __cv);
-_LIBCPP_THREAD_ABI_VISIBILITY _LIBCPP_NO_THREAD_SAFETY_ANALYSIS
-int __libcpp_condvar_wait(__libcpp_condvar_t* __cv, __libcpp_mutex_t* __m);
+_LIBCPP_THREAD_ABI_VISIBILITY _LIBCPP_NO_THREAD_SAFETY_ANALYSIS int
+__libcpp_condvar_wait(__libcpp_condvar_t* __cv, __libcpp_mutex_t* __m);
-_LIBCPP_THREAD_ABI_VISIBILITY _LIBCPP_NO_THREAD_SAFETY_ANALYSIS
-int __libcpp_condvar_timedwait(__libcpp_condvar_t *__cv, __libcpp_mutex_t *__m,
- __libcpp_timespec_t *__ts);
+_LIBCPP_THREAD_ABI_VISIBILITY _LIBCPP_NO_THREAD_SAFETY_ANALYSIS int
+__libcpp_condvar_timedwait(__libcpp_condvar_t* __cv, __libcpp_mutex_t* __m, __libcpp_timespec_t* __ts);
_LIBCPP_THREAD_ABI_VISIBILITY
int __libcpp_condvar_destroy(__libcpp_condvar_t* __cv);
// Execute once
_LIBCPP_THREAD_ABI_VISIBILITY
-int __libcpp_execute_once(__libcpp_exec_once_flag *__flag,
- void (*__init_routine)());
+int __libcpp_execute_once(__libcpp_exec_once_flag* __flag, void (*__init_routine)());
// Thread id
_LIBCPP_THREAD_ABI_VISIBILITY
@@ -212,23 +209,22 @@ bool __libcpp_thread_id_less(__libcpp_thread_id __t1, __libcpp_thread_id __t2);
// Thread
_LIBCPP_THREAD_ABI_VISIBILITY
-bool __libcpp_thread_isnull(const __libcpp_thread_t *__t);
+bool __libcpp_thread_isnull(const __libcpp_thread_t* __t);
_LIBCPP_THREAD_ABI_VISIBILITY
-int __libcpp_thread_create(__libcpp_thread_t *__t, void *(*__func)(void *),
- void *__arg);
+int __libcpp_thread_create(__libcpp_thread_t* __t, void* (*__func)(void*), void* __arg);
_LIBCPP_THREAD_ABI_VISIBILITY
__libcpp_thread_id __libcpp_thread_get_current_id();
_LIBCPP_THREAD_ABI_VISIBILITY
-__libcpp_thread_id __libcpp_thread_get_id(const __libcpp_thread_t *__t);
+__libcpp_thread_id __libcpp_thread_get_id(const __libcpp_thread_t* __t);
_LIBCPP_THREAD_ABI_VISIBILITY
-int __libcpp_thread_join(__libcpp_thread_t *__t);
+int __libcpp_thread_join(__libcpp_thread_t* __t);
_LIBCPP_THREAD_ABI_VISIBILITY
-int __libcpp_thread_detach(__libcpp_thread_t *__t);
+int __libcpp_thread_detach(__libcpp_thread_t* __t);
_LIBCPP_THREAD_ABI_VISIBILITY
void __libcpp_thread_yield();
@@ -238,21 +234,19 @@ void __libcpp_thread_sleep_for(const chrono::nanoseconds& __ns);
// Thread local storage
_LIBCPP_THREAD_ABI_VISIBILITY
-int __libcpp_tls_create(__libcpp_tls_key* __key,
- void(_LIBCPP_TLS_DESTRUCTOR_CC* __at_exit)(void*));
+int __libcpp_tls_create(__libcpp_tls_key* __key, void(_LIBCPP_TLS_DESTRUCTOR_CC* __at_exit)(void*));
_LIBCPP_THREAD_ABI_VISIBILITY
-void *__libcpp_tls_get(__libcpp_tls_key __key);
+void* __libcpp_tls_get(__libcpp_tls_key __key);
_LIBCPP_THREAD_ABI_VISIBILITY
-int __libcpp_tls_set(__libcpp_tls_key __key, void *__p);
+int __libcpp_tls_set(__libcpp_tls_key __key, void* __p);
-#endif // !defined(_LIBCPP_HAS_THREAD_API_EXTERNAL)
+# endif // !defined(_LIBCPP_HAS_THREAD_API_EXTERNAL)
-#if defined(_LIBCPP_HAS_THREAD_API_PTHREAD)
+# if defined(_LIBCPP_HAS_THREAD_API_PTHREAD)
-int __libcpp_recursive_mutex_init(__libcpp_recursive_mutex_t *__m)
-{
+int __libcpp_recursive_mutex_init(__libcpp_recursive_mutex_t* __m) {
pthread_mutexattr_t __attr;
int __ec = pthread_mutexattr_init(&__attr);
if (__ec)
@@ -275,313 +269,185 @@ int __libcpp_recursive_mutex_init(__libcpp_recursive_mutex_t *__m)
return 0;
}
-int __libcpp_recursive_mutex_lock(__libcpp_recursive_mutex_t *__m)
-{
- return pthread_mutex_lock(__m);
-}
+int __libcpp_recursive_mutex_lock(__libcpp_recursive_mutex_t* __m) { return pthread_mutex_lock(__m); }
-bool __libcpp_recursive_mutex_trylock(__libcpp_recursive_mutex_t *__m)
-{
- return pthread_mutex_trylock(__m) == 0;
-}
+bool __libcpp_recursive_mutex_trylock(__libcpp_recursive_mutex_t* __m) { return pthread_mutex_trylock(__m) == 0; }
-int __libcpp_recursive_mutex_unlock(__libcpp_recursive_mutex_t *__m)
-{
- return pthread_mutex_unlock(__m);
-}
+int __libcpp_recursive_mutex_unlock(__libcpp_recursive_mutex_t* __m) { return pthread_mutex_unlock(__m); }
-int __libcpp_recursive_mutex_destroy(__libcpp_recursive_mutex_t *__m)
-{
- return pthread_mutex_destroy(__m);
-}
+int __libcpp_recursive_mutex_destroy(__libcpp_recursive_mutex_t* __m) { return pthread_mutex_destroy(__m); }
-int __libcpp_mutex_lock(__libcpp_mutex_t *__m)
-{
- return pthread_mutex_lock(__m);
-}
+int __libcpp_mutex_lock(__libcpp_mutex_t* __m) { return pthread_mutex_lock(__m); }
-bool __libcpp_mutex_trylock(__libcpp_mutex_t *__m)
-{
- return pthread_mutex_trylock(__m) == 0;
-}
+bool __libcpp_mutex_trylock(__libcpp_mutex_t* __m) { return pthread_mutex_trylock(__m) == 0; }
-int __libcpp_mutex_unlock(__libcpp_mutex_t *__m)
-{
- return pthread_mutex_unlock(__m);
-}
+int __libcpp_mutex_unlock(__libcpp_mutex_t* __m) { return pthread_mutex_unlock(__m); }
-int __libcpp_mutex_destroy(__libcpp_mutex_t *__m)
-{
- return pthread_mutex_destroy(__m);
-}
+int __libcpp_mutex_destroy(__libcpp_mutex_t* __m) { return pthread_mutex_destroy(__m); }
// Condition Variable
-int __libcpp_condvar_signal(__libcpp_condvar_t *__cv)
-{
- return pthread_cond_signal(__cv);
-}
+int __libcpp_condvar_signal(__libcpp_condvar_t* __cv) { return pthread_cond_signal(__cv); }
-int __libcpp_condvar_broadcast(__libcpp_condvar_t *__cv)
-{
- return pthread_cond_broadcast(__cv);
-}
+int __libcpp_condvar_broadcast(__libcpp_condvar_t* __cv) { return pthread_cond_broadcast(__cv); }
-int __libcpp_condvar_wait(__libcpp_condvar_t *__cv, __libcpp_mutex_t *__m)
-{
- return pthread_cond_wait(__cv, __m);
-}
+int __libcpp_condvar_wait(__libcpp_condvar_t* __cv, __libcpp_mutex_t* __m) { return pthread_cond_wait(__cv, __m); }
-int __libcpp_condvar_timedwait(__libcpp_condvar_t *__cv, __libcpp_mutex_t *__m,
- __libcpp_timespec_t *__ts)
-{
+int __libcpp_condvar_timedwait(__libcpp_condvar_t* __cv, __libcpp_mutex_t* __m, __libcpp_timespec_t* __ts) {
return pthread_cond_timedwait(__cv, __m, __ts);
}
-int __libcpp_condvar_destroy(__libcpp_condvar_t *__cv)
-{
- return pthread_cond_destroy(__cv);
-}
+int __libcpp_condvar_destroy(__libcpp_condvar_t* __cv) { return pthread_cond_destroy(__cv); }
// Execute once
-int __libcpp_execute_once(__libcpp_exec_once_flag *__flag,
- void (*__init_routine)()) {
+int __libcpp_execute_once(__libcpp_exec_once_flag* __flag, void (*__init_routine)()) {
return pthread_once(__flag, __init_routine);
}
// Thread id
// Returns non-zero if the thread ids are equal, otherwise 0
-bool __libcpp_thread_id_equal(__libcpp_thread_id __t1, __libcpp_thread_id __t2)
-{
- return __t1 == __t2;
-}
+bool __libcpp_thread_id_equal(__libcpp_thread_id __t1, __libcpp_thread_id __t2) { return __t1 == __t2; }
// Returns non-zero if t1 < t2, otherwise 0
-bool __libcpp_thread_id_less(__libcpp_thread_id __t1, __libcpp_thread_id __t2)
-{
- return __t1 < __t2;
-}
+bool __libcpp_thread_id_less(__libcpp_thread_id __t1, __libcpp_thread_id __t2) { return __t1 < __t2; }
// Thread
-bool __libcpp_thread_isnull(const __libcpp_thread_t *__t) {
- return __libcpp_thread_get_id(__t) == 0;
-}
+bool __libcpp_thread_isnull(const __libcpp_thread_t* __t) { return __libcpp_thread_get_id(__t) == 0; }
-int __libcpp_thread_create(__libcpp_thread_t *__t, void *(*__func)(void *),
- void *__arg)
-{
+int __libcpp_thread_create(__libcpp_thread_t* __t, void* (*__func)(void*), void* __arg) {
return pthread_create(__t, nullptr, __func, __arg);
}
-__libcpp_thread_id __libcpp_thread_get_current_id()
-{
+__libcpp_thread_id __libcpp_thread_get_current_id() {
const __libcpp_thread_t __current_thread = pthread_self();
return __libcpp_thread_get_id(&__current_thread);
}
-__libcpp_thread_id __libcpp_thread_get_id(const __libcpp_thread_t *__t)
-{
-#if defined(__MVS__)
+__libcpp_thread_id __libcpp_thread_get_id(const __libcpp_thread_t* __t) {
+# if defined(__MVS__)
return __t->__;
-#else
+# else
return *__t;
-#endif
+# endif
}
-int __libcpp_thread_join(__libcpp_thread_t *__t)
-{
- return pthread_join(*__t, nullptr);
-}
+int __libcpp_thread_join(__libcpp_thread_t* __t) { return pthread_join(*__t, nullptr); }
-int __libcpp_thread_detach(__libcpp_thread_t *__t)
-{
- return pthread_detach(*__t);
-}
+int __libcpp_thread_detach(__libcpp_thread_t* __t) { return pthread_detach(*__t); }
-void __libcpp_thread_yield()
-{
- sched_yield();
-}
+void __libcpp_thread_yield() { sched_yield(); }
-void __libcpp_thread_sleep_for(const chrono::nanoseconds& __ns)
-{
- __libcpp_timespec_t __ts = std::__convert_to_timespec<__libcpp_timespec_t>(__ns);
- while (nanosleep(&__ts, &__ts) == -1 && errno == EINTR);
+void __libcpp_thread_sleep_for(const chrono::nanoseconds& __ns) {
+ __libcpp_timespec_t __ts = std::__convert_to_timespec<__libcpp_timespec_t>(__ns);
+ while (nanosleep(&__ts, &__ts) == -1 && errno == EINTR)
+ ;
}
// Thread local storage
-int __libcpp_tls_create(__libcpp_tls_key *__key, void (*__at_exit)(void *))
-{
+int __libcpp_tls_create(__libcpp_tls_key* __key, void (*__at_exit)(void*)) {
return pthread_key_create(__key, __at_exit);
}
-void *__libcpp_tls_get(__libcpp_tls_key __key)
-{
- return pthread_getspecific(__key);
-}
+void* __libcpp_tls_get(__libcpp_tls_key __key) { return pthread_getspecific(__key); }
-int __libcpp_tls_set(__libcpp_tls_key __key, void *__p)
-{
- return pthread_setspecific(__key, __p);
-}
+int __libcpp_tls_set(__libcpp_tls_key __key, void* __p) { return pthread_setspecific(__key, __p); }
-#elif defined(_LIBCPP_HAS_THREAD_API_C11)
+# elif defined(_LIBCPP_HAS_THREAD_API_C11)
-int __libcpp_recursive_mutex_init(__libcpp_recursive_mutex_t *__m)
-{
+int __libcpp_recursive_mutex_init(__libcpp_recursive_mutex_t* __m) {
return mtx_init(__m, mtx_plain | mtx_recursive) == thrd_success ? 0 : EINVAL;
}
-int __libcpp_recursive_mutex_lock(__libcpp_recursive_mutex_t *__m)
-{
+int __libcpp_recursive_mutex_lock(__libcpp_recursive_mutex_t* __m) {
return mtx_lock(__m) == thrd_success ? 0 : EINVAL;
}
-bool __libcpp_recursive_mutex_trylock(__libcpp_recursive_mutex_t *__m)
-{
- return mtx_trylock(__m) == thrd_success;
-}
+bool __libcpp_recursive_mutex_trylock(__libcpp_recursive_mutex_t* __m) { return mtx_trylock(__m) == thrd_success; }
-int __libcpp_recursive_mutex_unlock(__libcpp_recursive_mutex_t *__m)
-{
+int __libcpp_recursive_mutex_unlock(__libcpp_recursive_mutex_t* __m) {
return mtx_unlock(__m) == thrd_success ? 0 : EINVAL;
}
-int __libcpp_recursive_mutex_destroy(__libcpp_recursive_mutex_t *__m)
-{
+int __libcpp_recursive_mutex_destroy(__libcpp_recursive_mutex_t* __m) {
mtx_destroy(__m);
return 0;
}
-int __libcpp_mutex_lock(__libcpp_mutex_t *__m)
-{
- return mtx_lock(__m) == thrd_success ? 0 : EINVAL;
-}
+int __libcpp_mutex_lock(__libcpp_mutex_t* __m) { return mtx_lock(__m) == thrd_success ? 0 : EINVAL; }
-bool __libcpp_mutex_trylock(__libcpp_mutex_t *__m)
-{
- return mtx_trylock(__m) == thrd_success;
-}
+bool __libcpp_mutex_trylock(__libcpp_mutex_t* __m) { return mtx_trylock(__m) == thrd_success; }
-int __libcpp_mutex_unlock(__libcpp_mutex_t *__m)
-{
- return mtx_unlock(__m) == thrd_success ? 0 : EINVAL;
-}
+int __libcpp_mutex_unlock(__libcpp_mutex_t* __m) { return mtx_unlock(__m) == thrd_success ? 0 : EINVAL; }
-int __libcpp_mutex_destroy(__libcpp_mutex_t *__m)
-{
+int __libcpp_mutex_destroy(__libcpp_mutex_t* __m) {
mtx_destroy(__m);
return 0;
}
// Condition Variable
-int __libcpp_condvar_signal(__libcpp_condvar_t *__cv)
-{
- return cnd_signal(__cv) == thrd_success ? 0 : EINVAL;
-}
+int __libcpp_condvar_signal(__libcpp_condvar_t* __cv) { return cnd_signal(__cv) == thrd_success ? 0 : EINVAL; }
-int __libcpp_condvar_broadcast(__libcpp_condvar_t *__cv)
-{
- return cnd_broadcast(__cv) == thrd_success ? 0 : EINVAL;
-}
+int __libcpp_condvar_broadcast(__libcpp_condvar_t* __cv) { return cnd_broadcast(__cv) == thrd_success ? 0 : EINVAL; }
-int __libcpp_condvar_wait(__libcpp_condvar_t *__cv, __libcpp_mutex_t *__m)
-{
+int __libcpp_condvar_wait(__libcpp_condvar_t* __cv, __libcpp_mutex_t* __m) {
return cnd_wait(__cv, __m) == thrd_success ? 0 : EINVAL;
}
-int __libcpp_condvar_timedwait(__libcpp_condvar_t *__cv, __libcpp_mutex_t *__m,
- timespec *__ts)
-{
+int __libcpp_condvar_timedwait(__libcpp_condvar_t* __cv, __libcpp_mutex_t* __m, timespec* __ts) {
int __ec = cnd_timedwait(__cv, __m, __ts);
return __ec == thrd_timedout ? ETIMEDOUT : __ec;
}
-int __libcpp_condvar_destroy(__libcpp_condvar_t *__cv)
-{
+int __libcpp_condvar_destroy(__libcpp_condvar_t* __cv) {
cnd_destroy(__cv);
return 0;
}
// Execute once
-int __libcpp_execute_once(__libcpp_exec_once_flag *flag,
- void (*init_routine)(void)) {
+int __libcpp_execute_once(__libcpp_exec_once_flag* flag, void (*init_routine)(void)) {
::call_once(flag, init_routine);
return 0;
}
// Thread id
// Returns non-zero if the thread ids are equal, otherwise 0
-bool __libcpp_thread_id_equal(__libcpp_thread_id t1, __libcpp_thread_id t2)
-{
- return thrd_equal(t1, t2) != 0;
-}
+bool __libcpp_thread_id_equal(__libcpp_thread_id t1, __libcpp_thread_id t2) { return thrd_equal(t1, t2) != 0; }
// Returns non-zero if t1 < t2, otherwise 0
-bool __libcpp_thread_id_less(__libcpp_thread_id t1, __libcpp_thread_id t2)
-{
- return t1 < t2;
-}
+bool __libcpp_thread_id_less(__libcpp_thread_id t1, __libcpp_thread_id t2) { return t1 < t2; }
// Thread
-bool __libcpp_thread_isnull(const __libcpp_thread_t *__t) {
- return __libcpp_thread_get_id(__t) == 0;
-}
+bool __libcpp_thread_isnull(const __libcpp_thread_t* __t) { return __libcpp_thread_get_id(__t) == 0; }
-int __libcpp_thread_create(__libcpp_thread_t *__t, void *(*__func)(void *),
- void *__arg)
-{
+int __libcpp_thread_create(__libcpp_thread_t* __t, void* (*__func)(void*), void* __arg) {
int __ec = thrd_create(__t, reinterpret_cast<thrd_start_t>(__func), __arg);
return __ec == thrd_nomem ? ENOMEM : __ec;
}
-__libcpp_thread_id __libcpp_thread_get_current_id()
-{
- return thrd_current();
-}
+__libcpp_thread_id __libcpp_thread_get_current_id() { return thrd_current(); }
-__libcpp_thread_id __libcpp_thread_get_id(const __libcpp_thread_t *__t)
-{
- return *__t;
-}
+__libcpp_thread_id __libcpp_thread_get_id(const __libcpp_thread_t* __t) { return *__t; }
-int __libcpp_thread_join(__libcpp_thread_t *__t)
-{
- return thrd_join(*__t, nullptr) == thrd_success ? 0 : EINVAL;
-}
+int __libcpp_thread_join(__libcpp_thread_t* __t) { return thrd_join(*__t, nullptr) == thrd_success ? 0 : EINVAL; }
-int __libcpp_thread_detach(__libcpp_thread_t *__t)
-{
- return thrd_detach(*__t) == thrd_success ? 0 : EINVAL;
-}
+int __libcpp_thread_detach(__libcpp_thread_t* __t) { return thrd_detach(*__t) == thrd_success ? 0 : EINVAL; }
-void __libcpp_thread_yield()
-{
- thrd_yield();
-}
+void __libcpp_thread_yield() { thrd_yield(); }
-void __libcpp_thread_sleep_for(const chrono::nanoseconds& __ns)
-{
- __libcpp_timespec_t __ts = std::__convert_to_timespec<__libcpp_timespec_t>(__ns);
+void __libcpp_thread_sleep_for(const chrono::nanoseconds& __ns) {
+ __libcpp_timespec_t __ts = std::__convert_to_timespec<__libcpp_timespec_t>(__ns);
thrd_sleep(&__ts, nullptr);
}
// Thread local storage
-int __libcpp_tls_create(__libcpp_tls_key *__key, void (*__at_exit)(void *))
-{
+int __libcpp_tls_create(__libcpp_tls_key* __key, void (*__at_exit)(void*)) {
return tss_create(__key, __at_exit) == thrd_success ? 0 : EINVAL;
}
-void *__libcpp_tls_get(__libcpp_tls_key __key)
-{
- return tss_get(__key);
-}
+void* __libcpp_tls_get(__libcpp_tls_key __key) { return tss_get(__key); }
-int __libcpp_tls_set(__libcpp_tls_key __key, void *__p)
-{
- return tss_set(__key, __p) == thrd_success ? 0 : EINVAL;
-}
+int __libcpp_tls_set(__libcpp_tls_key __key, void* __p) { return tss_set(__key, __p) == thrd_success ? 0 : EINVAL; }
-#endif
+# endif
#endif // !_LIBCPP_HAS_NO_THREADS
diff --git a/contrib/llvm-project/libcxx/include/__tree b/contrib/llvm-project/libcxx/include/__tree
index d76cccb21c18..2dcc3c614d36 100644
--- a/contrib/llvm-project/libcxx/include/__tree
+++ b/contrib/llvm-project/libcxx/include/__tree
@@ -49,30 +49,40 @@
_LIBCPP_PUSH_MACROS
#include <__undef_macros>
-
_LIBCPP_BEGIN_NAMESPACE_STD
-template <class, class, class, class> class _LIBCPP_TEMPLATE_VIS map;
-template <class, class, class, class> class _LIBCPP_TEMPLATE_VIS multimap;
-template <class, class, class> class _LIBCPP_TEMPLATE_VIS set;
-template <class, class, class> class _LIBCPP_TEMPLATE_VIS multiset;
+template <class, class, class, class>
+class _LIBCPP_TEMPLATE_VIS map;
+template <class, class, class, class>
+class _LIBCPP_TEMPLATE_VIS multimap;
+template <class, class, class>
+class _LIBCPP_TEMPLATE_VIS set;
+template <class, class, class>
+class _LIBCPP_TEMPLATE_VIS multiset;
-template <class _Tp, class _Compare, class _Allocator> class __tree;
+template <class _Tp, class _Compare, class _Allocator>
+class __tree;
template <class _Tp, class _NodePtr, class _DiffType>
- class _LIBCPP_TEMPLATE_VIS __tree_iterator;
+class _LIBCPP_TEMPLATE_VIS __tree_iterator;
template <class _Tp, class _ConstNodePtr, class _DiffType>
- class _LIBCPP_TEMPLATE_VIS __tree_const_iterator;
+class _LIBCPP_TEMPLATE_VIS __tree_const_iterator;
-template <class _Pointer> class __tree_end_node;
-template <class _VoidPtr> class __tree_node_base;
-template <class _Tp, class _VoidPtr> class __tree_node;
+template <class _Pointer>
+class __tree_end_node;
+template <class _VoidPtr>
+class __tree_node_base;
+template <class _Tp, class _VoidPtr>
+class __tree_node;
template <class _Key, class _Value>
struct __value_type;
-template <class _Allocator> class __map_node_destructor;
-template <class _TreeIterator> class _LIBCPP_TEMPLATE_VIS __map_iterator;
-template <class _TreeIterator> class _LIBCPP_TEMPLATE_VIS __map_const_iterator;
+template <class _Allocator>
+class __map_node_destructor;
+template <class _TreeIterator>
+class _LIBCPP_TEMPLATE_VIS __map_iterator;
+template <class _TreeIterator>
+class _LIBCPP_TEMPLATE_VIS __map_const_iterator;
/*
@@ -98,198 +108,167 @@ __root, have a non-null __parent_ field.
// Returns: true if __x is a left child of its parent, else false
// Precondition: __x != nullptr.
template <class _NodePtr>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-__tree_is_left_child(_NodePtr __x) _NOEXCEPT
-{
- return __x == __x->__parent_->__left_;
+inline _LIBCPP_HIDE_FROM_ABI bool __tree_is_left_child(_NodePtr __x) _NOEXCEPT {
+ return __x == __x->__parent_->__left_;
}
// Determines if the subtree rooted at __x is a proper red black subtree. If
// __x is a proper subtree, returns the black height (null counts as 1). If
// __x is an improper subtree, returns 0.
template <class _NodePtr>
-unsigned
-__tree_sub_invariant(_NodePtr __x)
-{
- if (__x == nullptr)
- return 1;
- // parent consistency checked by caller
- // check __x->__left_ consistency
- if (__x->__left_ != nullptr && __x->__left_->__parent_ != __x)
- return 0;
- // check __x->__right_ consistency
- if (__x->__right_ != nullptr && __x->__right_->__parent_ != __x)
- return 0;
- // check __x->__left_ != __x->__right_ unless both are nullptr
- if (__x->__left_ == __x->__right_ && __x->__left_ != nullptr)
- return 0;
- // If this is red, neither child can be red
- if (!__x->__is_black_)
- {
- if (__x->__left_ && !__x->__left_->__is_black_)
- return 0;
- if (__x->__right_ && !__x->__right_->__is_black_)
- return 0;
- }
- unsigned __h = std::__tree_sub_invariant(__x->__left_);
- if (__h == 0)
- return 0; // invalid left subtree
- if (__h != std::__tree_sub_invariant(__x->__right_))
- return 0; // invalid or different height right subtree
- return __h + __x->__is_black_; // return black height of this node
+unsigned __tree_sub_invariant(_NodePtr __x) {
+ if (__x == nullptr)
+ return 1;
+ // parent consistency checked by caller
+ // check __x->__left_ consistency
+ if (__x->__left_ != nullptr && __x->__left_->__parent_ != __x)
+ return 0;
+ // check __x->__right_ consistency
+ if (__x->__right_ != nullptr && __x->__right_->__parent_ != __x)
+ return 0;
+ // check __x->__left_ != __x->__right_ unless both are nullptr
+ if (__x->__left_ == __x->__right_ && __x->__left_ != nullptr)
+ return 0;
+ // If this is red, neither child can be red
+ if (!__x->__is_black_) {
+ if (__x->__left_ && !__x->__left_->__is_black_)
+ return 0;
+ if (__x->__right_ && !__x->__right_->__is_black_)
+ return 0;
+ }
+ unsigned __h = std::__tree_sub_invariant(__x->__left_);
+ if (__h == 0)
+ return 0; // invalid left subtree
+ if (__h != std::__tree_sub_invariant(__x->__right_))
+ return 0; // invalid or different height right subtree
+ return __h + __x->__is_black_; // return black height of this node
}
// Determines if the red black tree rooted at __root is a proper red black tree.
// __root == nullptr is a proper tree. Returns true is __root is a proper
// red black tree, else returns false.
template <class _NodePtr>
-_LIBCPP_HIDE_FROM_ABI bool
-__tree_invariant(_NodePtr __root)
-{
- if (__root == nullptr)
- return true;
- // check __x->__parent_ consistency
- if (__root->__parent_ == nullptr)
- return false;
- if (!std::__tree_is_left_child(__root))
- return false;
- // root must be black
- if (!__root->__is_black_)
- return false;
- // do normal node checks
- return std::__tree_sub_invariant(__root) != 0;
+_LIBCPP_HIDE_FROM_ABI bool __tree_invariant(_NodePtr __root) {
+ if (__root == nullptr)
+ return true;
+ // check __x->__parent_ consistency
+ if (__root->__parent_ == nullptr)
+ return false;
+ if (!std::__tree_is_left_child(__root))
+ return false;
+ // root must be black
+ if (!__root->__is_black_)
+ return false;
+ // do normal node checks
+ return std::__tree_sub_invariant(__root) != 0;
}
// Returns: pointer to the left-most node under __x.
template <class _NodePtr>
-inline _LIBCPP_HIDE_FROM_ABI
-_NodePtr
-__tree_min(_NodePtr __x) _NOEXCEPT
-{
- _LIBCPP_ASSERT_INTERNAL(__x != nullptr, "Root node shouldn't be null");
- while (__x->__left_ != nullptr)
- __x = __x->__left_;
- return __x;
+inline _LIBCPP_HIDE_FROM_ABI _NodePtr __tree_min(_NodePtr __x) _NOEXCEPT {
+ _LIBCPP_ASSERT_INTERNAL(__x != nullptr, "Root node shouldn't be null");
+ while (__x->__left_ != nullptr)
+ __x = __x->__left_;
+ return __x;
}
// Returns: pointer to the right-most node under __x.
template <class _NodePtr>
-inline _LIBCPP_HIDE_FROM_ABI
-_NodePtr
-__tree_max(_NodePtr __x) _NOEXCEPT
-{
- _LIBCPP_ASSERT_INTERNAL(__x != nullptr, "Root node shouldn't be null");
- while (__x->__right_ != nullptr)
- __x = __x->__right_;
- return __x;
+inline _LIBCPP_HIDE_FROM_ABI _NodePtr __tree_max(_NodePtr __x) _NOEXCEPT {
+ _LIBCPP_ASSERT_INTERNAL(__x != nullptr, "Root node shouldn't be null");
+ while (__x->__right_ != nullptr)
+ __x = __x->__right_;
+ return __x;
}
// Returns: pointer to the next in-order node after __x.
template <class _NodePtr>
-_LIBCPP_HIDE_FROM_ABI _NodePtr
-__tree_next(_NodePtr __x) _NOEXCEPT
-{
- _LIBCPP_ASSERT_INTERNAL(__x != nullptr, "node shouldn't be null");
- if (__x->__right_ != nullptr)
- return std::__tree_min(__x->__right_);
- while (!std::__tree_is_left_child(__x))
- __x = __x->__parent_unsafe();
- return __x->__parent_unsafe();
+_LIBCPP_HIDE_FROM_ABI _NodePtr __tree_next(_NodePtr __x) _NOEXCEPT {
+ _LIBCPP_ASSERT_INTERNAL(__x != nullptr, "node shouldn't be null");
+ if (__x->__right_ != nullptr)
+ return std::__tree_min(__x->__right_);
+ while (!std::__tree_is_left_child(__x))
+ __x = __x->__parent_unsafe();
+ return __x->__parent_unsafe();
}
template <class _EndNodePtr, class _NodePtr>
-inline _LIBCPP_HIDE_FROM_ABI
-_EndNodePtr
-__tree_next_iter(_NodePtr __x) _NOEXCEPT
-{
- _LIBCPP_ASSERT_INTERNAL(__x != nullptr, "node shouldn't be null");
- if (__x->__right_ != nullptr)
- return static_cast<_EndNodePtr>(std::__tree_min(__x->__right_));
- while (!std::__tree_is_left_child(__x))
- __x = __x->__parent_unsafe();
- return static_cast<_EndNodePtr>(__x->__parent_);
+inline _LIBCPP_HIDE_FROM_ABI _EndNodePtr __tree_next_iter(_NodePtr __x) _NOEXCEPT {
+ _LIBCPP_ASSERT_INTERNAL(__x != nullptr, "node shouldn't be null");
+ if (__x->__right_ != nullptr)
+ return static_cast<_EndNodePtr>(std::__tree_min(__x->__right_));
+ while (!std::__tree_is_left_child(__x))
+ __x = __x->__parent_unsafe();
+ return static_cast<_EndNodePtr>(__x->__parent_);
}
// Returns: pointer to the previous in-order node before __x.
// Note: __x may be the end node.
template <class _NodePtr, class _EndNodePtr>
-inline _LIBCPP_HIDE_FROM_ABI
-_NodePtr
-__tree_prev_iter(_EndNodePtr __x) _NOEXCEPT
-{
- _LIBCPP_ASSERT_INTERNAL(__x != nullptr, "node shouldn't be null");
- if (__x->__left_ != nullptr)
- return std::__tree_max(__x->__left_);
- _NodePtr __xx = static_cast<_NodePtr>(__x);
- while (std::__tree_is_left_child(__xx))
- __xx = __xx->__parent_unsafe();
- return __xx->__parent_unsafe();
+inline _LIBCPP_HIDE_FROM_ABI _NodePtr __tree_prev_iter(_EndNodePtr __x) _NOEXCEPT {
+ _LIBCPP_ASSERT_INTERNAL(__x != nullptr, "node shouldn't be null");
+ if (__x->__left_ != nullptr)
+ return std::__tree_max(__x->__left_);
+ _NodePtr __xx = static_cast<_NodePtr>(__x);
+ while (std::__tree_is_left_child(__xx))
+ __xx = __xx->__parent_unsafe();
+ return __xx->__parent_unsafe();
}
// Returns: pointer to a node which has no children
template <class _NodePtr>
-_LIBCPP_HIDE_FROM_ABI _NodePtr
-__tree_leaf(_NodePtr __x) _NOEXCEPT
-{
- _LIBCPP_ASSERT_INTERNAL(__x != nullptr, "node shouldn't be null");
- while (true)
- {
- if (__x->__left_ != nullptr)
- {
- __x = __x->__left_;
- continue;
- }
- if (__x->__right_ != nullptr)
- {
- __x = __x->__right_;
- continue;
- }
- break;
- }
- return __x;
+_LIBCPP_HIDE_FROM_ABI _NodePtr __tree_leaf(_NodePtr __x) _NOEXCEPT {
+ _LIBCPP_ASSERT_INTERNAL(__x != nullptr, "node shouldn't be null");
+ while (true) {
+ if (__x->__left_ != nullptr) {
+ __x = __x->__left_;
+ continue;
+ }
+ if (__x->__right_ != nullptr) {
+ __x = __x->__right_;
+ continue;
+ }
+ break;
+ }
+ return __x;
}
// Effects: Makes __x->__right_ the subtree root with __x as its left child
// while preserving in-order order.
template <class _NodePtr>
-_LIBCPP_HIDE_FROM_ABI void
-__tree_left_rotate(_NodePtr __x) _NOEXCEPT
-{
- _LIBCPP_ASSERT_INTERNAL(__x != nullptr, "node shouldn't be null");
- _LIBCPP_ASSERT_INTERNAL(__x->__right_ != nullptr, "node should have a right child");
- _NodePtr __y = __x->__right_;
- __x->__right_ = __y->__left_;
- if (__x->__right_ != nullptr)
- __x->__right_->__set_parent(__x);
- __y->__parent_ = __x->__parent_;
- if (std::__tree_is_left_child(__x))
- __x->__parent_->__left_ = __y;
- else
- __x->__parent_unsafe()->__right_ = __y;
- __y->__left_ = __x;
- __x->__set_parent(__y);
+_LIBCPP_HIDE_FROM_ABI void __tree_left_rotate(_NodePtr __x) _NOEXCEPT {
+ _LIBCPP_ASSERT_INTERNAL(__x != nullptr, "node shouldn't be null");
+ _LIBCPP_ASSERT_INTERNAL(__x->__right_ != nullptr, "node should have a right child");
+ _NodePtr __y = __x->__right_;
+ __x->__right_ = __y->__left_;
+ if (__x->__right_ != nullptr)
+ __x->__right_->__set_parent(__x);
+ __y->__parent_ = __x->__parent_;
+ if (std::__tree_is_left_child(__x))
+ __x->__parent_->__left_ = __y;
+ else
+ __x->__parent_unsafe()->__right_ = __y;
+ __y->__left_ = __x;
+ __x->__set_parent(__y);
}
// Effects: Makes __x->__left_ the subtree root with __x as its right child
// while preserving in-order order.
template <class _NodePtr>
-_LIBCPP_HIDE_FROM_ABI void
-__tree_right_rotate(_NodePtr __x) _NOEXCEPT
-{
- _LIBCPP_ASSERT_INTERNAL(__x != nullptr, "node shouldn't be null");
- _LIBCPP_ASSERT_INTERNAL(__x->__left_ != nullptr, "node should have a left child");
- _NodePtr __y = __x->__left_;
- __x->__left_ = __y->__right_;
- if (__x->__left_ != nullptr)
- __x->__left_->__set_parent(__x);
- __y->__parent_ = __x->__parent_;
- if (std::__tree_is_left_child(__x))
- __x->__parent_->__left_ = __y;
- else
- __x->__parent_unsafe()->__right_ = __y;
- __y->__right_ = __x;
- __x->__set_parent(__y);
+_LIBCPP_HIDE_FROM_ABI void __tree_right_rotate(_NodePtr __x) _NOEXCEPT {
+ _LIBCPP_ASSERT_INTERNAL(__x != nullptr, "node shouldn't be null");
+ _LIBCPP_ASSERT_INTERNAL(__x->__left_ != nullptr, "node should have a left child");
+ _NodePtr __y = __x->__left_;
+ __x->__left_ = __y->__right_;
+ if (__x->__left_ != nullptr)
+ __x->__left_->__set_parent(__x);
+ __y->__parent_ = __x->__parent_;
+ if (std::__tree_is_left_child(__x))
+ __x->__parent_->__left_ = __y;
+ else
+ __x->__parent_unsafe()->__right_ = __y;
+ __y->__right_ = __x;
+ __x->__set_parent(__y);
}
// Effects: Rebalances __root after attaching __x to a leaf.
@@ -300,68 +279,54 @@ __tree_right_rotate(_NodePtr __x) _NOEXCEPT
// Postcondition: __tree_invariant(end_node->__left_) == true. end_node->__left_
// may be different than the value passed in as __root.
template <class _NodePtr>
-_LIBCPP_HIDE_FROM_ABI void
-__tree_balance_after_insert(_NodePtr __root, _NodePtr __x) _NOEXCEPT
-{
- _LIBCPP_ASSERT_INTERNAL(__root != nullptr, "Root of the tree shouldn't be null");
- _LIBCPP_ASSERT_INTERNAL(__x != nullptr, "Can't attach null node to a leaf");
- __x->__is_black_ = __x == __root;
- while (__x != __root && !__x->__parent_unsafe()->__is_black_)
- {
- // __x->__parent_ != __root because __x->__parent_->__is_black == false
- if (std::__tree_is_left_child(__x->__parent_unsafe()))
- {
- _NodePtr __y = __x->__parent_unsafe()->__parent_unsafe()->__right_;
- if (__y != nullptr && !__y->__is_black_)
- {
- __x = __x->__parent_unsafe();
- __x->__is_black_ = true;
- __x = __x->__parent_unsafe();
- __x->__is_black_ = __x == __root;
- __y->__is_black_ = true;
- }
- else
- {
- if (!std::__tree_is_left_child(__x))
- {
- __x = __x->__parent_unsafe();
- std::__tree_left_rotate(__x);
- }
- __x = __x->__parent_unsafe();
- __x->__is_black_ = true;
- __x = __x->__parent_unsafe();
- __x->__is_black_ = false;
- std::__tree_right_rotate(__x);
- break;
- }
+_LIBCPP_HIDE_FROM_ABI void __tree_balance_after_insert(_NodePtr __root, _NodePtr __x) _NOEXCEPT {
+ _LIBCPP_ASSERT_INTERNAL(__root != nullptr, "Root of the tree shouldn't be null");
+ _LIBCPP_ASSERT_INTERNAL(__x != nullptr, "Can't attach null node to a leaf");
+ __x->__is_black_ = __x == __root;
+ while (__x != __root && !__x->__parent_unsafe()->__is_black_) {
+ // __x->__parent_ != __root because __x->__parent_->__is_black == false
+ if (std::__tree_is_left_child(__x->__parent_unsafe())) {
+ _NodePtr __y = __x->__parent_unsafe()->__parent_unsafe()->__right_;
+ if (__y != nullptr && !__y->__is_black_) {
+ __x = __x->__parent_unsafe();
+ __x->__is_black_ = true;
+ __x = __x->__parent_unsafe();
+ __x->__is_black_ = __x == __root;
+ __y->__is_black_ = true;
+ } else {
+ if (!std::__tree_is_left_child(__x)) {
+ __x = __x->__parent_unsafe();
+ std::__tree_left_rotate(__x);
}
- else
- {
- _NodePtr __y = __x->__parent_unsafe()->__parent_->__left_;
- if (__y != nullptr && !__y->__is_black_)
- {
- __x = __x->__parent_unsafe();
- __x->__is_black_ = true;
- __x = __x->__parent_unsafe();
- __x->__is_black_ = __x == __root;
- __y->__is_black_ = true;
- }
- else
- {
- if (std::__tree_is_left_child(__x))
- {
- __x = __x->__parent_unsafe();
- std::__tree_right_rotate(__x);
- }
- __x = __x->__parent_unsafe();
- __x->__is_black_ = true;
- __x = __x->__parent_unsafe();
- __x->__is_black_ = false;
- std::__tree_left_rotate(__x);
- break;
- }
+ __x = __x->__parent_unsafe();
+ __x->__is_black_ = true;
+ __x = __x->__parent_unsafe();
+ __x->__is_black_ = false;
+ std::__tree_right_rotate(__x);
+ break;
+ }
+ } else {
+ _NodePtr __y = __x->__parent_unsafe()->__parent_->__left_;
+ if (__y != nullptr && !__y->__is_black_) {
+ __x = __x->__parent_unsafe();
+ __x->__is_black_ = true;
+ __x = __x->__parent_unsafe();
+ __x->__is_black_ = __x == __root;
+ __y->__is_black_ = true;
+ } else {
+ if (std::__tree_is_left_child(__x)) {
+ __x = __x->__parent_unsafe();
+ std::__tree_right_rotate(__x);
}
+ __x = __x->__parent_unsafe();
+ __x->__is_black_ = true;
+ __x = __x->__parent_unsafe();
+ __x->__is_black_ = false;
+ std::__tree_left_rotate(__x);
+ break;
+ }
}
+ }
}
// Precondition: __z == __root or == a direct or indirect child of __root.
@@ -370,205 +335,178 @@ __tree_balance_after_insert(_NodePtr __root, _NodePtr __x) _NOEXCEPT
// nor any of its children refer to __z. end_node->__left_
// may be different than the value passed in as __root.
template <class _NodePtr>
-_LIBCPP_HIDE_FROM_ABI void
-__tree_remove(_NodePtr __root, _NodePtr __z) _NOEXCEPT
-{
- _LIBCPP_ASSERT_INTERNAL(__root != nullptr, "Root node should not be null");
- _LIBCPP_ASSERT_INTERNAL(__z != nullptr, "The node to remove should not be null");
- _LIBCPP_ASSERT_INTERNAL(std::__tree_invariant(__root), "The tree invariants should hold");
- // __z will be removed from the tree. Client still needs to destruct/deallocate it
- // __y is either __z, or if __z has two children, __tree_next(__z).
- // __y will have at most one child.
- // __y will be the initial hole in the tree (make the hole at a leaf)
- _NodePtr __y = (__z->__left_ == nullptr || __z->__right_ == nullptr) ?
- __z : std::__tree_next(__z);
- // __x is __y's possibly null single child
- _NodePtr __x = __y->__left_ != nullptr ? __y->__left_ : __y->__right_;
- // __w is __x's possibly null uncle (will become __x's sibling)
- _NodePtr __w = nullptr;
- // link __x to __y's parent, and find __w
- if (__x != nullptr)
- __x->__parent_ = __y->__parent_;
- if (std::__tree_is_left_child(__y))
- {
- __y->__parent_->__left_ = __x;
- if (__y != __root)
- __w = __y->__parent_unsafe()->__right_;
- else
- __root = __x; // __w == nullptr
- }
+_LIBCPP_HIDE_FROM_ABI void __tree_remove(_NodePtr __root, _NodePtr __z) _NOEXCEPT {
+ _LIBCPP_ASSERT_INTERNAL(__root != nullptr, "Root node should not be null");
+ _LIBCPP_ASSERT_INTERNAL(__z != nullptr, "The node to remove should not be null");
+ _LIBCPP_ASSERT_INTERNAL(std::__tree_invariant(__root), "The tree invariants should hold");
+ // __z will be removed from the tree. Client still needs to destruct/deallocate it
+ // __y is either __z, or if __z has two children, __tree_next(__z).
+ // __y will have at most one child.
+ // __y will be the initial hole in the tree (make the hole at a leaf)
+ _NodePtr __y = (__z->__left_ == nullptr || __z->__right_ == nullptr) ? __z : std::__tree_next(__z);
+ // __x is __y's possibly null single child
+ _NodePtr __x = __y->__left_ != nullptr ? __y->__left_ : __y->__right_;
+ // __w is __x's possibly null uncle (will become __x's sibling)
+ _NodePtr __w = nullptr;
+ // link __x to __y's parent, and find __w
+ if (__x != nullptr)
+ __x->__parent_ = __y->__parent_;
+ if (std::__tree_is_left_child(__y)) {
+ __y->__parent_->__left_ = __x;
+ if (__y != __root)
+ __w = __y->__parent_unsafe()->__right_;
else
- {
- __y->__parent_unsafe()->__right_ = __x;
- // __y can't be root if it is a right child
- __w = __y->__parent_->__left_;
- }
- bool __removed_black = __y->__is_black_;
- // If we didn't remove __z, do so now by splicing in __y for __z,
- // but copy __z's color. This does not impact __x or __w.
- if (__y != __z)
- {
- // __z->__left_ != nulptr but __z->__right_ might == __x == nullptr
- __y->__parent_ = __z->__parent_;
- if (std::__tree_is_left_child(__z))
- __y->__parent_->__left_ = __y;
- else
- __y->__parent_unsafe()->__right_ = __y;
- __y->__left_ = __z->__left_;
- __y->__left_->__set_parent(__y);
- __y->__right_ = __z->__right_;
- if (__y->__right_ != nullptr)
- __y->__right_->__set_parent(__y);
- __y->__is_black_ = __z->__is_black_;
- if (__root == __z)
- __root = __y;
- }
- // There is no need to rebalance if we removed a red, or if we removed
- // the last node.
- if (__removed_black && __root != nullptr)
- {
- // Rebalance:
- // __x has an implicit black color (transferred from the removed __y)
- // associated with it, no matter what its color is.
- // If __x is __root (in which case it can't be null), it is supposed
- // to be black anyway, and if it is doubly black, then the double
- // can just be ignored.
- // If __x is red (in which case it can't be null), then it can absorb
- // the implicit black just by setting its color to black.
- // Since __y was black and only had one child (which __x points to), __x
- // is either red with no children, else null, otherwise __y would have
- // different black heights under left and right pointers.
- // if (__x == __root || __x != nullptr && !__x->__is_black_)
- if (__x != nullptr)
- __x->__is_black_ = true;
- else
+ __root = __x; // __w == nullptr
+ } else {
+ __y->__parent_unsafe()->__right_ = __x;
+ // __y can't be root if it is a right child
+ __w = __y->__parent_->__left_;
+ }
+ bool __removed_black = __y->__is_black_;
+ // If we didn't remove __z, do so now by splicing in __y for __z,
+ // but copy __z's color. This does not impact __x or __w.
+ if (__y != __z) {
+ // __z->__left_ != nulptr but __z->__right_ might == __x == nullptr
+ __y->__parent_ = __z->__parent_;
+ if (std::__tree_is_left_child(__z))
+ __y->__parent_->__left_ = __y;
+ else
+ __y->__parent_unsafe()->__right_ = __y;
+ __y->__left_ = __z->__left_;
+ __y->__left_->__set_parent(__y);
+ __y->__right_ = __z->__right_;
+ if (__y->__right_ != nullptr)
+ __y->__right_->__set_parent(__y);
+ __y->__is_black_ = __z->__is_black_;
+ if (__root == __z)
+ __root = __y;
+ }
+ // There is no need to rebalance if we removed a red, or if we removed
+ // the last node.
+ if (__removed_black && __root != nullptr) {
+ // Rebalance:
+ // __x has an implicit black color (transferred from the removed __y)
+ // associated with it, no matter what its color is.
+ // If __x is __root (in which case it can't be null), it is supposed
+ // to be black anyway, and if it is doubly black, then the double
+ // can just be ignored.
+ // If __x is red (in which case it can't be null), then it can absorb
+ // the implicit black just by setting its color to black.
+ // Since __y was black and only had one child (which __x points to), __x
+ // is either red with no children, else null, otherwise __y would have
+ // different black heights under left and right pointers.
+ // if (__x == __root || __x != nullptr && !__x->__is_black_)
+ if (__x != nullptr)
+ __x->__is_black_ = true;
+ else {
+ // Else __x isn't root, and is "doubly black", even though it may
+ // be null. __w can not be null here, else the parent would
+ // see a black height >= 2 on the __x side and a black height
+ // of 1 on the __w side (__w must be a non-null black or a red
+ // with a non-null black child).
+ while (true) {
+ if (!std::__tree_is_left_child(__w)) // if x is left child
{
- // Else __x isn't root, and is "doubly black", even though it may
- // be null. __w can not be null here, else the parent would
- // see a black height >= 2 on the __x side and a black height
- // of 1 on the __w side (__w must be a non-null black or a red
- // with a non-null black child).
- while (true)
- {
- if (!std::__tree_is_left_child(__w)) // if x is left child
- {
- if (!__w->__is_black_)
- {
- __w->__is_black_ = true;
- __w->__parent_unsafe()->__is_black_ = false;
- std::__tree_left_rotate(__w->__parent_unsafe());
- // __x is still valid
- // reset __root only if necessary
- if (__root == __w->__left_)
- __root = __w;
- // reset sibling, and it still can't be null
- __w = __w->__left_->__right_;
- }
- // __w->__is_black_ is now true, __w may have null children
- if ((__w->__left_ == nullptr || __w->__left_->__is_black_) &&
- (__w->__right_ == nullptr || __w->__right_->__is_black_))
- {
- __w->__is_black_ = false;
- __x = __w->__parent_unsafe();
- // __x can no longer be null
- if (__x == __root || !__x->__is_black_)
- {
- __x->__is_black_ = true;
- break;
- }
- // reset sibling, and it still can't be null
- __w = std::__tree_is_left_child(__x) ?
- __x->__parent_unsafe()->__right_ :
- __x->__parent_->__left_;
- // continue;
- }
- else // __w has a red child
- {
- if (__w->__right_ == nullptr || __w->__right_->__is_black_)
- {
- // __w left child is non-null and red
- __w->__left_->__is_black_ = true;
- __w->__is_black_ = false;
- std::__tree_right_rotate(__w);
- // __w is known not to be root, so root hasn't changed
- // reset sibling, and it still can't be null
- __w = __w->__parent_unsafe();
- }
- // __w has a right red child, left child may be null
- __w->__is_black_ = __w->__parent_unsafe()->__is_black_;
- __w->__parent_unsafe()->__is_black_ = true;
- __w->__right_->__is_black_ = true;
- std::__tree_left_rotate(__w->__parent_unsafe());
- break;
- }
- }
- else
- {
- if (!__w->__is_black_)
- {
- __w->__is_black_ = true;
- __w->__parent_unsafe()->__is_black_ = false;
- std::__tree_right_rotate(__w->__parent_unsafe());
- // __x is still valid
- // reset __root only if necessary
- if (__root == __w->__right_)
- __root = __w;
- // reset sibling, and it still can't be null
- __w = __w->__right_->__left_;
- }
- // __w->__is_black_ is now true, __w may have null children
- if ((__w->__left_ == nullptr || __w->__left_->__is_black_) &&
- (__w->__right_ == nullptr || __w->__right_->__is_black_))
- {
- __w->__is_black_ = false;
- __x = __w->__parent_unsafe();
- // __x can no longer be null
- if (!__x->__is_black_ || __x == __root)
- {
- __x->__is_black_ = true;
- break;
- }
- // reset sibling, and it still can't be null
- __w = std::__tree_is_left_child(__x) ?
- __x->__parent_unsafe()->__right_ :
- __x->__parent_->__left_;
- // continue;
- }
- else // __w has a red child
- {
- if (__w->__left_ == nullptr || __w->__left_->__is_black_)
- {
- // __w right child is non-null and red
- __w->__right_->__is_black_ = true;
- __w->__is_black_ = false;
- std::__tree_left_rotate(__w);
- // __w is known not to be root, so root hasn't changed
- // reset sibling, and it still can't be null
- __w = __w->__parent_unsafe();
- }
- // __w has a left red child, right child may be null
- __w->__is_black_ = __w->__parent_unsafe()->__is_black_;
- __w->__parent_unsafe()->__is_black_ = true;
- __w->__left_->__is_black_ = true;
- std::__tree_right_rotate(__w->__parent_unsafe());
- break;
- }
- }
+ if (!__w->__is_black_) {
+ __w->__is_black_ = true;
+ __w->__parent_unsafe()->__is_black_ = false;
+ std::__tree_left_rotate(__w->__parent_unsafe());
+ // __x is still valid
+ // reset __root only if necessary
+ if (__root == __w->__left_)
+ __root = __w;
+ // reset sibling, and it still can't be null
+ __w = __w->__left_->__right_;
+ }
+ // __w->__is_black_ is now true, __w may have null children
+ if ((__w->__left_ == nullptr || __w->__left_->__is_black_) &&
+ (__w->__right_ == nullptr || __w->__right_->__is_black_)) {
+ __w->__is_black_ = false;
+ __x = __w->__parent_unsafe();
+ // __x can no longer be null
+ if (__x == __root || !__x->__is_black_) {
+ __x->__is_black_ = true;
+ break;
}
+ // reset sibling, and it still can't be null
+ __w = std::__tree_is_left_child(__x) ? __x->__parent_unsafe()->__right_ : __x->__parent_->__left_;
+ // continue;
+ } else // __w has a red child
+ {
+ if (__w->__right_ == nullptr || __w->__right_->__is_black_) {
+ // __w left child is non-null and red
+ __w->__left_->__is_black_ = true;
+ __w->__is_black_ = false;
+ std::__tree_right_rotate(__w);
+ // __w is known not to be root, so root hasn't changed
+ // reset sibling, and it still can't be null
+ __w = __w->__parent_unsafe();
+ }
+ // __w has a right red child, left child may be null
+ __w->__is_black_ = __w->__parent_unsafe()->__is_black_;
+ __w->__parent_unsafe()->__is_black_ = true;
+ __w->__right_->__is_black_ = true;
+ std::__tree_left_rotate(__w->__parent_unsafe());
+ break;
+ }
+ } else {
+ if (!__w->__is_black_) {
+ __w->__is_black_ = true;
+ __w->__parent_unsafe()->__is_black_ = false;
+ std::__tree_right_rotate(__w->__parent_unsafe());
+ // __x is still valid
+ // reset __root only if necessary
+ if (__root == __w->__right_)
+ __root = __w;
+ // reset sibling, and it still can't be null
+ __w = __w->__right_->__left_;
+ }
+ // __w->__is_black_ is now true, __w may have null children
+ if ((__w->__left_ == nullptr || __w->__left_->__is_black_) &&
+ (__w->__right_ == nullptr || __w->__right_->__is_black_)) {
+ __w->__is_black_ = false;
+ __x = __w->__parent_unsafe();
+ // __x can no longer be null
+ if (!__x->__is_black_ || __x == __root) {
+ __x->__is_black_ = true;
+ break;
+ }
+ // reset sibling, and it still can't be null
+ __w = std::__tree_is_left_child(__x) ? __x->__parent_unsafe()->__right_ : __x->__parent_->__left_;
+ // continue;
+ } else // __w has a red child
+ {
+ if (__w->__left_ == nullptr || __w->__left_->__is_black_) {
+ // __w right child is non-null and red
+ __w->__right_->__is_black_ = true;
+ __w->__is_black_ = false;
+ std::__tree_left_rotate(__w);
+ // __w is known not to be root, so root hasn't changed
+ // reset sibling, and it still can't be null
+ __w = __w->__parent_unsafe();
+ }
+ // __w has a left red child, right child may be null
+ __w->__is_black_ = __w->__parent_unsafe()->__is_black_;
+ __w->__parent_unsafe()->__is_black_ = true;
+ __w->__left_->__is_black_ = true;
+ std::__tree_right_rotate(__w->__parent_unsafe());
+ break;
+ }
}
+ }
}
+ }
}
// node traits
-
template <class _Tp>
struct __is_tree_value_type_imp : false_type {};
template <class _Key, class _Value>
struct __is_tree_value_type_imp<__value_type<_Key, _Value> > : true_type {};
-template <class ..._Args>
+template <class... _Args>
struct __is_tree_value_type : false_type {};
template <class _One>
@@ -581,81 +519,57 @@ struct __tree_key_value_types {
typedef _Tp __container_value_type;
static const bool __is_map = false;
- _LIBCPP_HIDE_FROM_ABI
- static key_type const& __get_key(_Tp const& __v) {
- return __v;
- }
- _LIBCPP_HIDE_FROM_ABI
- static __container_value_type const& __get_value(__node_value_type const& __v) {
- return __v;
- }
- _LIBCPP_HIDE_FROM_ABI
- static __container_value_type* __get_ptr(__node_value_type& __n) {
- return std::addressof(__n);
- }
- _LIBCPP_HIDE_FROM_ABI
- static __container_value_type&& __move(__node_value_type& __v) {
- return std::move(__v);
- }
+ _LIBCPP_HIDE_FROM_ABI static key_type const& __get_key(_Tp const& __v) { return __v; }
+ _LIBCPP_HIDE_FROM_ABI static __container_value_type const& __get_value(__node_value_type const& __v) { return __v; }
+ _LIBCPP_HIDE_FROM_ABI static __container_value_type* __get_ptr(__node_value_type& __n) { return std::addressof(__n); }
+ _LIBCPP_HIDE_FROM_ABI static __container_value_type&& __move(__node_value_type& __v) { return std::move(__v); }
};
template <class _Key, class _Tp>
struct __tree_key_value_types<__value_type<_Key, _Tp> > {
- typedef _Key key_type;
- typedef _Tp mapped_type;
- typedef __value_type<_Key, _Tp> __node_value_type;
- typedef pair<const _Key, _Tp> __container_value_type;
- typedef __container_value_type __map_value_type;
+ typedef _Key key_type;
+ typedef _Tp mapped_type;
+ typedef __value_type<_Key, _Tp> __node_value_type;
+ typedef pair<const _Key, _Tp> __container_value_type;
+ typedef __container_value_type __map_value_type;
static const bool __is_map = true;
- _LIBCPP_HIDE_FROM_ABI
- static key_type const&
- __get_key(__node_value_type const& __t) {
+ _LIBCPP_HIDE_FROM_ABI static key_type const& __get_key(__node_value_type const& __t) {
return __t.__get_value().first;
}
template <class _Up, __enable_if_t<__is_same_uncvref<_Up, __container_value_type>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI
- static key_type const&
- __get_key(_Up& __t) {
+ _LIBCPP_HIDE_FROM_ABI static key_type const& __get_key(_Up& __t) {
return __t.first;
}
- _LIBCPP_HIDE_FROM_ABI
- static __container_value_type const&
- __get_value(__node_value_type const& __t) {
+ _LIBCPP_HIDE_FROM_ABI static __container_value_type const& __get_value(__node_value_type const& __t) {
return __t.__get_value();
}
template <class _Up>
- _LIBCPP_HIDE_FROM_ABI
- static __enable_if_t<__is_same_uncvref<_Up, __container_value_type>::value, __container_value_type const&>
+ _LIBCPP_HIDE_FROM_ABI static __enable_if_t<__is_same_uncvref<_Up, __container_value_type>::value,
+ __container_value_type const&>
__get_value(_Up& __t) {
return __t;
}
- _LIBCPP_HIDE_FROM_ABI
- static __container_value_type* __get_ptr(__node_value_type& __n) {
+ _LIBCPP_HIDE_FROM_ABI static __container_value_type* __get_ptr(__node_value_type& __n) {
return std::addressof(__n.__get_value());
}
- _LIBCPP_HIDE_FROM_ABI
- static pair<key_type&&, mapped_type&&> __move(__node_value_type& __v) {
- return __v.__move();
- }
+ _LIBCPP_HIDE_FROM_ABI static pair<key_type&&, mapped_type&&> __move(__node_value_type& __v) { return __v.__move(); }
};
template <class _VoidPtr>
struct __tree_node_base_types {
- typedef _VoidPtr __void_pointer;
+ typedef _VoidPtr __void_pointer;
- typedef __tree_node_base<__void_pointer> __node_base_type;
- typedef __rebind_pointer_t<_VoidPtr, __node_base_type>
- __node_base_pointer;
+ typedef __tree_node_base<__void_pointer> __node_base_type;
+ typedef __rebind_pointer_t<_VoidPtr, __node_base_type> __node_base_pointer;
- typedef __tree_end_node<__node_base_pointer> __end_node_type;
- typedef __rebind_pointer_t<_VoidPtr, __end_node_type>
- __end_node_pointer;
+ typedef __tree_end_node<__node_base_pointer> __end_node_type;
+ typedef __rebind_pointer_t<_VoidPtr, __end_node_type> __end_node_pointer;
#if defined(_LIBCPP_ABI_TREE_REMOVE_NODE_POINTER_UB)
typedef __end_node_pointer __parent_pointer;
#else
@@ -665,20 +579,17 @@ struct __tree_node_base_types {
private:
static_assert((is_same<typename pointer_traits<_VoidPtr>::element_type, void>::value),
- "_VoidPtr does not point to unqualified void type");
+ "_VoidPtr does not point to unqualified void type");
};
-template <class _Tp, class _AllocPtr, class _KVTypes = __tree_key_value_types<_Tp>,
- bool = _KVTypes::__is_map>
+template <class _Tp, class _AllocPtr, class _KVTypes = __tree_key_value_types<_Tp>, bool = _KVTypes::__is_map>
struct __tree_map_pointer_types {};
template <class _Tp, class _AllocPtr, class _KVTypes>
struct __tree_map_pointer_types<_Tp, _AllocPtr, _KVTypes, true> {
- typedef typename _KVTypes::__map_value_type _Mv;
- typedef __rebind_pointer_t<_AllocPtr, _Mv>
- __map_value_type_pointer;
- typedef __rebind_pointer_t<_AllocPtr, const _Mv>
- __const_map_value_type_pointer;
+ typedef typename _KVTypes::__map_value_type _Mv;
+ typedef __rebind_pointer_t<_AllocPtr, _Mv> __map_value_type_pointer;
+ typedef __rebind_pointer_t<_AllocPtr, const _Mv> __const_map_value_type_pointer;
};
template <class _NodePtr, class _NodeT = typename pointer_traits<_NodePtr>::element_type>
@@ -686,911 +597,773 @@ struct __tree_node_types;
template <class _NodePtr, class _Tp, class _VoidPtr>
struct __tree_node_types<_NodePtr, __tree_node<_Tp, _VoidPtr> >
- : public __tree_node_base_types<_VoidPtr>,
- __tree_key_value_types<_Tp>,
- __tree_map_pointer_types<_Tp, _VoidPtr>
-{
+ : public __tree_node_base_types<_VoidPtr>, __tree_key_value_types<_Tp>, __tree_map_pointer_types<_Tp, _VoidPtr> {
typedef __tree_node_base_types<_VoidPtr> __base;
- typedef __tree_key_value_types<_Tp> __key_base;
+ typedef __tree_key_value_types<_Tp> __key_base;
typedef __tree_map_pointer_types<_Tp, _VoidPtr> __map_pointer_base;
-public:
- typedef typename pointer_traits<_NodePtr>::element_type __node_type;
- typedef _NodePtr __node_pointer;
+public:
+ typedef typename pointer_traits<_NodePtr>::element_type __node_type;
+ typedef _NodePtr __node_pointer;
- typedef _Tp __node_value_type;
- typedef __rebind_pointer_t<_VoidPtr, __node_value_type>
- __node_value_type_pointer;
- typedef __rebind_pointer_t<_VoidPtr, const __node_value_type>
- __const_node_value_type_pointer;
+ typedef _Tp __node_value_type;
+ typedef __rebind_pointer_t<_VoidPtr, __node_value_type> __node_value_type_pointer;
+ typedef __rebind_pointer_t<_VoidPtr, const __node_value_type> __const_node_value_type_pointer;
#if defined(_LIBCPP_ABI_TREE_REMOVE_NODE_POINTER_UB)
typedef typename __base::__end_node_pointer __iter_pointer;
#else
typedef __conditional_t< is_pointer<__node_pointer>::value, typename __base::__end_node_pointer, __node_pointer>
__iter_pointer;
#endif
+
private:
- static_assert(!is_const<__node_type>::value,
- "_NodePtr should never be a pointer to const");
- static_assert((is_same<__rebind_pointer_t<_VoidPtr, __node_type>,
- _NodePtr>::value), "_VoidPtr does not rebind to _NodePtr.");
+ static_assert(!is_const<__node_type>::value, "_NodePtr should never be a pointer to const");
+ static_assert((is_same<__rebind_pointer_t<_VoidPtr, __node_type>, _NodePtr>::value),
+ "_VoidPtr does not rebind to _NodePtr.");
};
template <class _ValueTp, class _VoidPtr>
struct __make_tree_node_types {
- typedef __rebind_pointer_t<_VoidPtr, __tree_node<_ValueTp, _VoidPtr> >
- _NodePtr;
+ typedef __rebind_pointer_t<_VoidPtr, __tree_node<_ValueTp, _VoidPtr> > _NodePtr;
typedef __tree_node_types<_NodePtr> type;
};
// node
template <class _Pointer>
-class __tree_end_node
-{
+class __tree_end_node {
public:
- typedef _Pointer pointer;
- pointer __left_;
+ typedef _Pointer pointer;
+ pointer __left_;
- _LIBCPP_HIDE_FROM_ABI
- __tree_end_node() _NOEXCEPT : __left_() {}
+ _LIBCPP_HIDE_FROM_ABI __tree_end_node() _NOEXCEPT : __left_() {}
};
template <class _VoidPtr>
-class _LIBCPP_STANDALONE_DEBUG __tree_node_base
- : public __tree_node_base_types<_VoidPtr>::__end_node_type
-{
- typedef __tree_node_base_types<_VoidPtr> _NodeBaseTypes;
+class _LIBCPP_STANDALONE_DEBUG __tree_node_base : public __tree_node_base_types<_VoidPtr>::__end_node_type {
+ typedef __tree_node_base_types<_VoidPtr> _NodeBaseTypes;
public:
- typedef typename _NodeBaseTypes::__node_base_pointer pointer;
- typedef typename _NodeBaseTypes::__parent_pointer __parent_pointer;
+ typedef typename _NodeBaseTypes::__node_base_pointer pointer;
+ typedef typename _NodeBaseTypes::__parent_pointer __parent_pointer;
- pointer __right_;
- __parent_pointer __parent_;
- bool __is_black_;
+ pointer __right_;
+ __parent_pointer __parent_;
+ bool __is_black_;
- _LIBCPP_HIDE_FROM_ABI
- pointer __parent_unsafe() const { return static_cast<pointer>(__parent_);}
+ _LIBCPP_HIDE_FROM_ABI pointer __parent_unsafe() const { return static_cast<pointer>(__parent_); }
- _LIBCPP_HIDE_FROM_ABI
- void __set_parent(pointer __p) {
- __parent_ = static_cast<__parent_pointer>(__p);
- }
+ _LIBCPP_HIDE_FROM_ABI void __set_parent(pointer __p) { __parent_ = static_cast<__parent_pointer>(__p); }
private:
- ~__tree_node_base() = delete;
- __tree_node_base(__tree_node_base const&) = delete;
+ ~__tree_node_base() = delete;
+ __tree_node_base(__tree_node_base const&) = delete;
__tree_node_base& operator=(__tree_node_base const&) = delete;
};
template <class _Tp, class _VoidPtr>
-class _LIBCPP_STANDALONE_DEBUG __tree_node
- : public __tree_node_base<_VoidPtr>
-{
+class _LIBCPP_STANDALONE_DEBUG __tree_node : public __tree_node_base<_VoidPtr> {
public:
- typedef _Tp __node_value_type;
+ typedef _Tp __node_value_type;
- __node_value_type __value_;
+ __node_value_type __value_;
- _LIBCPP_HIDE_FROM_ABI _Tp& __get_value() { return __value_; }
+ _LIBCPP_HIDE_FROM_ABI _Tp& __get_value() { return __value_; }
private:
- ~__tree_node() = delete;
- __tree_node(__tree_node const&) = delete;
+ ~__tree_node() = delete;
+ __tree_node(__tree_node const&) = delete;
__tree_node& operator=(__tree_node const&) = delete;
};
-
template <class _Allocator>
-class __tree_node_destructor
-{
- typedef _Allocator allocator_type;
- typedef allocator_traits<allocator_type> __alloc_traits;
+class __tree_node_destructor {
+ typedef _Allocator allocator_type;
+ typedef allocator_traits<allocator_type> __alloc_traits;
public:
- typedef typename __alloc_traits::pointer pointer;
-private:
- typedef __tree_node_types<pointer> _NodeTypes;
- allocator_type& __na_;
+ typedef typename __alloc_traits::pointer pointer;
+private:
+ typedef __tree_node_types<pointer> _NodeTypes;
+ allocator_type& __na_;
public:
- bool __value_constructed;
+ bool __value_constructed;
+ _LIBCPP_HIDE_FROM_ABI __tree_node_destructor(const __tree_node_destructor&) = default;
+ __tree_node_destructor& operator=(const __tree_node_destructor&) = delete;
- _LIBCPP_HIDE_FROM_ABI __tree_node_destructor(const __tree_node_destructor &) = default;
- __tree_node_destructor& operator=(const __tree_node_destructor&) = delete;
+ _LIBCPP_HIDE_FROM_ABI explicit __tree_node_destructor(allocator_type& __na, bool __val = false) _NOEXCEPT
+ : __na_(__na),
+ __value_constructed(__val) {}
- _LIBCPP_HIDE_FROM_ABI
- explicit __tree_node_destructor(allocator_type& __na, bool __val = false) _NOEXCEPT
- : __na_(__na),
- __value_constructed(__val)
- {}
-
- _LIBCPP_HIDE_FROM_ABI
- void operator()(pointer __p) _NOEXCEPT
- {
- if (__value_constructed)
- __alloc_traits::destroy(__na_, _NodeTypes::__get_ptr(__p->__value_));
- if (__p)
- __alloc_traits::deallocate(__na_, __p, 1);
- }
+ _LIBCPP_HIDE_FROM_ABI void operator()(pointer __p) _NOEXCEPT {
+ if (__value_constructed)
+ __alloc_traits::destroy(__na_, _NodeTypes::__get_ptr(__p->__value_));
+ if (__p)
+ __alloc_traits::deallocate(__na_, __p, 1);
+ }
- template <class> friend class __map_node_destructor;
+ template <class>
+ friend class __map_node_destructor;
};
#if _LIBCPP_STD_VER >= 17
template <class _NodeType, class _Alloc>
struct __generic_container_node_destructor;
template <class _Tp, class _VoidPtr, class _Alloc>
-struct __generic_container_node_destructor<__tree_node<_Tp, _VoidPtr>, _Alloc>
- : __tree_node_destructor<_Alloc>
-{
- using __tree_node_destructor<_Alloc>::__tree_node_destructor;
+struct __generic_container_node_destructor<__tree_node<_Tp, _VoidPtr>, _Alloc> : __tree_node_destructor<_Alloc> {
+ using __tree_node_destructor<_Alloc>::__tree_node_destructor;
};
#endif
template <class _Tp, class _NodePtr, class _DiffType>
-class _LIBCPP_TEMPLATE_VIS __tree_iterator
-{
- typedef __tree_node_types<_NodePtr> _NodeTypes;
- typedef _NodePtr __node_pointer;
- typedef typename _NodeTypes::__node_base_pointer __node_base_pointer;
- typedef typename _NodeTypes::__end_node_pointer __end_node_pointer;
- typedef typename _NodeTypes::__iter_pointer __iter_pointer;
- typedef pointer_traits<__node_pointer> __pointer_traits;
+class _LIBCPP_TEMPLATE_VIS __tree_iterator {
+ typedef __tree_node_types<_NodePtr> _NodeTypes;
+ typedef _NodePtr __node_pointer;
+ typedef typename _NodeTypes::__node_base_pointer __node_base_pointer;
+ typedef typename _NodeTypes::__end_node_pointer __end_node_pointer;
+ typedef typename _NodeTypes::__iter_pointer __iter_pointer;
+ typedef pointer_traits<__node_pointer> __pointer_traits;
- __iter_pointer __ptr_;
+ __iter_pointer __ptr_;
public:
- typedef bidirectional_iterator_tag iterator_category;
- typedef _Tp value_type;
- typedef _DiffType difference_type;
- typedef value_type& reference;
- typedef typename _NodeTypes::__node_value_type_pointer pointer;
+ typedef bidirectional_iterator_tag iterator_category;
+ typedef _Tp value_type;
+ typedef _DiffType difference_type;
+ typedef value_type& reference;
+ typedef typename _NodeTypes::__node_value_type_pointer pointer;
- _LIBCPP_HIDE_FROM_ABI __tree_iterator() _NOEXCEPT
+ _LIBCPP_HIDE_FROM_ABI __tree_iterator() _NOEXCEPT
#if _LIBCPP_STD_VER >= 14
- : __ptr_(nullptr)
+ : __ptr_(nullptr)
#endif
- {}
-
- _LIBCPP_HIDE_FROM_ABI reference operator*() const
- {return __get_np()->__value_;}
- _LIBCPP_HIDE_FROM_ABI pointer operator->() const
- {return pointer_traits<pointer>::pointer_to(__get_np()->__value_);}
-
- _LIBCPP_HIDE_FROM_ABI
- __tree_iterator& operator++() {
- __ptr_ = static_cast<__iter_pointer>(
- std::__tree_next_iter<__end_node_pointer>(static_cast<__node_base_pointer>(__ptr_)));
- return *this;
- }
- _LIBCPP_HIDE_FROM_ABI
- __tree_iterator operator++(int)
- {__tree_iterator __t(*this); ++(*this); return __t;}
-
- _LIBCPP_HIDE_FROM_ABI
- __tree_iterator& operator--() {
- __ptr_ = static_cast<__iter_pointer>(std::__tree_prev_iter<__node_base_pointer>(
- static_cast<__end_node_pointer>(__ptr_)));
- return *this;
- }
- _LIBCPP_HIDE_FROM_ABI
- __tree_iterator operator--(int)
- {__tree_iterator __t(*this); --(*this); return __t;}
+ {
+ }
+
+ _LIBCPP_HIDE_FROM_ABI reference operator*() const { return __get_np()->__value_; }
+ _LIBCPP_HIDE_FROM_ABI pointer operator->() const { return pointer_traits<pointer>::pointer_to(__get_np()->__value_); }
+
+ _LIBCPP_HIDE_FROM_ABI __tree_iterator& operator++() {
+ __ptr_ = static_cast<__iter_pointer>(
+ std::__tree_next_iter<__end_node_pointer>(static_cast<__node_base_pointer>(__ptr_)));
+ return *this;
+ }
+ _LIBCPP_HIDE_FROM_ABI __tree_iterator operator++(int) {
+ __tree_iterator __t(*this);
+ ++(*this);
+ return __t;
+ }
- friend _LIBCPP_HIDE_FROM_ABI
- bool operator==(const __tree_iterator& __x, const __tree_iterator& __y)
- {return __x.__ptr_ == __y.__ptr_;}
- friend _LIBCPP_HIDE_FROM_ABI
- bool operator!=(const __tree_iterator& __x, const __tree_iterator& __y)
- {return !(__x == __y);}
+ _LIBCPP_HIDE_FROM_ABI __tree_iterator& operator--() {
+ __ptr_ = static_cast<__iter_pointer>(
+ std::__tree_prev_iter<__node_base_pointer>(static_cast<__end_node_pointer>(__ptr_)));
+ return *this;
+ }
+ _LIBCPP_HIDE_FROM_ABI __tree_iterator operator--(int) {
+ __tree_iterator __t(*this);
+ --(*this);
+ return __t;
+ }
+
+ friend _LIBCPP_HIDE_FROM_ABI bool operator==(const __tree_iterator& __x, const __tree_iterator& __y) {
+ return __x.__ptr_ == __y.__ptr_;
+ }
+ friend _LIBCPP_HIDE_FROM_ABI bool operator!=(const __tree_iterator& __x, const __tree_iterator& __y) {
+ return !(__x == __y);
+ }
private:
- _LIBCPP_HIDE_FROM_ABI
- explicit __tree_iterator(__node_pointer __p) _NOEXCEPT : __ptr_(__p) {}
- _LIBCPP_HIDE_FROM_ABI
- explicit __tree_iterator(__end_node_pointer __p) _NOEXCEPT : __ptr_(__p) {}
- _LIBCPP_HIDE_FROM_ABI
- __node_pointer __get_np() const { return static_cast<__node_pointer>(__ptr_); }
- template <class, class, class> friend class __tree;
- template <class, class, class> friend class _LIBCPP_TEMPLATE_VIS __tree_const_iterator;
- template <class> friend class _LIBCPP_TEMPLATE_VIS __map_iterator;
- template <class, class, class, class> friend class _LIBCPP_TEMPLATE_VIS map;
- template <class, class, class, class> friend class _LIBCPP_TEMPLATE_VIS multimap;
- template <class, class, class> friend class _LIBCPP_TEMPLATE_VIS set;
- template <class, class, class> friend class _LIBCPP_TEMPLATE_VIS multiset;
+ _LIBCPP_HIDE_FROM_ABI explicit __tree_iterator(__node_pointer __p) _NOEXCEPT : __ptr_(__p) {}
+ _LIBCPP_HIDE_FROM_ABI explicit __tree_iterator(__end_node_pointer __p) _NOEXCEPT : __ptr_(__p) {}
+ _LIBCPP_HIDE_FROM_ABI __node_pointer __get_np() const { return static_cast<__node_pointer>(__ptr_); }
+ template <class, class, class>
+ friend class __tree;
+ template <class, class, class>
+ friend class _LIBCPP_TEMPLATE_VIS __tree_const_iterator;
+ template <class>
+ friend class _LIBCPP_TEMPLATE_VIS __map_iterator;
+ template <class, class, class, class>
+ friend class _LIBCPP_TEMPLATE_VIS map;
+ template <class, class, class, class>
+ friend class _LIBCPP_TEMPLATE_VIS multimap;
+ template <class, class, class>
+ friend class _LIBCPP_TEMPLATE_VIS set;
+ template <class, class, class>
+ friend class _LIBCPP_TEMPLATE_VIS multiset;
};
template <class _Tp, class _NodePtr, class _DiffType>
-class _LIBCPP_TEMPLATE_VIS __tree_const_iterator
-{
- typedef __tree_node_types<_NodePtr> _NodeTypes;
- typedef typename _NodeTypes::__node_pointer __node_pointer;
- typedef typename _NodeTypes::__node_base_pointer __node_base_pointer;
- typedef typename _NodeTypes::__end_node_pointer __end_node_pointer;
- typedef typename _NodeTypes::__iter_pointer __iter_pointer;
- typedef pointer_traits<__node_pointer> __pointer_traits;
+class _LIBCPP_TEMPLATE_VIS __tree_const_iterator {
+ typedef __tree_node_types<_NodePtr> _NodeTypes;
+ typedef typename _NodeTypes::__node_pointer __node_pointer;
+ typedef typename _NodeTypes::__node_base_pointer __node_base_pointer;
+ typedef typename _NodeTypes::__end_node_pointer __end_node_pointer;
+ typedef typename _NodeTypes::__iter_pointer __iter_pointer;
+ typedef pointer_traits<__node_pointer> __pointer_traits;
- __iter_pointer __ptr_;
+ __iter_pointer __ptr_;
public:
- typedef bidirectional_iterator_tag iterator_category;
- typedef _Tp value_type;
- typedef _DiffType difference_type;
- typedef const value_type& reference;
- typedef typename _NodeTypes::__const_node_value_type_pointer pointer;
+ typedef bidirectional_iterator_tag iterator_category;
+ typedef _Tp value_type;
+ typedef _DiffType difference_type;
+ typedef const value_type& reference;
+ typedef typename _NodeTypes::__const_node_value_type_pointer pointer;
- _LIBCPP_HIDE_FROM_ABI __tree_const_iterator() _NOEXCEPT
+ _LIBCPP_HIDE_FROM_ABI __tree_const_iterator() _NOEXCEPT
#if _LIBCPP_STD_VER >= 14
- : __ptr_(nullptr)
+ : __ptr_(nullptr)
#endif
- {}
+ {
+ }
private:
- typedef __tree_iterator<value_type, __node_pointer, difference_type>
- __non_const_iterator;
+ typedef __tree_iterator<value_type, __node_pointer, difference_type> __non_const_iterator;
+
public:
- _LIBCPP_HIDE_FROM_ABI
- __tree_const_iterator(__non_const_iterator __p) _NOEXCEPT
- : __ptr_(__p.__ptr_) {}
-
- _LIBCPP_HIDE_FROM_ABI reference operator*() const
- {return __get_np()->__value_;}
- _LIBCPP_HIDE_FROM_ABI pointer operator->() const
- {return pointer_traits<pointer>::pointer_to(__get_np()->__value_);}
-
- _LIBCPP_HIDE_FROM_ABI
- __tree_const_iterator& operator++() {
- __ptr_ = static_cast<__iter_pointer>(
- std::__tree_next_iter<__end_node_pointer>(static_cast<__node_base_pointer>(__ptr_)));
- return *this;
- }
+ _LIBCPP_HIDE_FROM_ABI __tree_const_iterator(__non_const_iterator __p) _NOEXCEPT : __ptr_(__p.__ptr_) {}
- _LIBCPP_HIDE_FROM_ABI
- __tree_const_iterator operator++(int)
- {__tree_const_iterator __t(*this); ++(*this); return __t;}
+ _LIBCPP_HIDE_FROM_ABI reference operator*() const { return __get_np()->__value_; }
+ _LIBCPP_HIDE_FROM_ABI pointer operator->() const { return pointer_traits<pointer>::pointer_to(__get_np()->__value_); }
- _LIBCPP_HIDE_FROM_ABI
- __tree_const_iterator& operator--() {
- __ptr_ = static_cast<__iter_pointer>(std::__tree_prev_iter<__node_base_pointer>(
- static_cast<__end_node_pointer>(__ptr_)));
- return *this;
- }
+ _LIBCPP_HIDE_FROM_ABI __tree_const_iterator& operator++() {
+ __ptr_ = static_cast<__iter_pointer>(
+ std::__tree_next_iter<__end_node_pointer>(static_cast<__node_base_pointer>(__ptr_)));
+ return *this;
+ }
- _LIBCPP_HIDE_FROM_ABI
- __tree_const_iterator operator--(int)
- {__tree_const_iterator __t(*this); --(*this); return __t;}
+ _LIBCPP_HIDE_FROM_ABI __tree_const_iterator operator++(int) {
+ __tree_const_iterator __t(*this);
+ ++(*this);
+ return __t;
+ }
- friend _LIBCPP_HIDE_FROM_ABI
- bool operator==(const __tree_const_iterator& __x, const __tree_const_iterator& __y)
- {return __x.__ptr_ == __y.__ptr_;}
- friend _LIBCPP_HIDE_FROM_ABI
- bool operator!=(const __tree_const_iterator& __x, const __tree_const_iterator& __y)
- {return !(__x == __y);}
+ _LIBCPP_HIDE_FROM_ABI __tree_const_iterator& operator--() {
+ __ptr_ = static_cast<__iter_pointer>(
+ std::__tree_prev_iter<__node_base_pointer>(static_cast<__end_node_pointer>(__ptr_)));
+ return *this;
+ }
-private:
- _LIBCPP_HIDE_FROM_ABI
- explicit __tree_const_iterator(__node_pointer __p) _NOEXCEPT
- : __ptr_(__p) {}
- _LIBCPP_HIDE_FROM_ABI
- explicit __tree_const_iterator(__end_node_pointer __p) _NOEXCEPT
- : __ptr_(__p) {}
- _LIBCPP_HIDE_FROM_ABI
- __node_pointer __get_np() const { return static_cast<__node_pointer>(__ptr_); }
-
- template <class, class, class> friend class __tree;
- template <class, class, class, class> friend class _LIBCPP_TEMPLATE_VIS map;
- template <class, class, class, class> friend class _LIBCPP_TEMPLATE_VIS multimap;
- template <class, class, class> friend class _LIBCPP_TEMPLATE_VIS set;
- template <class, class, class> friend class _LIBCPP_TEMPLATE_VIS multiset;
- template <class> friend class _LIBCPP_TEMPLATE_VIS __map_const_iterator;
+ _LIBCPP_HIDE_FROM_ABI __tree_const_iterator operator--(int) {
+ __tree_const_iterator __t(*this);
+ --(*this);
+ return __t;
+ }
+
+ friend _LIBCPP_HIDE_FROM_ABI bool operator==(const __tree_const_iterator& __x, const __tree_const_iterator& __y) {
+ return __x.__ptr_ == __y.__ptr_;
+ }
+ friend _LIBCPP_HIDE_FROM_ABI bool operator!=(const __tree_const_iterator& __x, const __tree_const_iterator& __y) {
+ return !(__x == __y);
+ }
+private:
+ _LIBCPP_HIDE_FROM_ABI explicit __tree_const_iterator(__node_pointer __p) _NOEXCEPT : __ptr_(__p) {}
+ _LIBCPP_HIDE_FROM_ABI explicit __tree_const_iterator(__end_node_pointer __p) _NOEXCEPT : __ptr_(__p) {}
+ _LIBCPP_HIDE_FROM_ABI __node_pointer __get_np() const { return static_cast<__node_pointer>(__ptr_); }
+
+ template <class, class, class>
+ friend class __tree;
+ template <class, class, class, class>
+ friend class _LIBCPP_TEMPLATE_VIS map;
+ template <class, class, class, class>
+ friend class _LIBCPP_TEMPLATE_VIS multimap;
+ template <class, class, class>
+ friend class _LIBCPP_TEMPLATE_VIS set;
+ template <class, class, class>
+ friend class _LIBCPP_TEMPLATE_VIS multiset;
+ template <class>
+ friend class _LIBCPP_TEMPLATE_VIS __map_const_iterator;
};
-template<class _Tp, class _Compare>
+template <class _Tp, class _Compare>
#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_DIAGNOSE_WARNING(!__invokable<_Compare const&, _Tp const&, _Tp const&>::value,
- "the specified comparator type does not provide a viable const call operator")
+_LIBCPP_DIAGNOSE_WARNING(!__invokable<_Compare const&, _Tp const&, _Tp const&>::value,
+ "the specified comparator type does not provide a viable const call operator")
#endif
int __diagnose_non_const_comparator();
template <class _Tp, class _Compare, class _Allocator>
-class __tree
-{
+class __tree {
public:
- typedef _Tp value_type;
- typedef _Compare value_compare;
- typedef _Allocator allocator_type;
+ typedef _Tp value_type;
+ typedef _Compare value_compare;
+ typedef _Allocator allocator_type;
private:
- typedef allocator_traits<allocator_type> __alloc_traits;
- typedef typename __make_tree_node_types<value_type,
- typename __alloc_traits::void_pointer>::type
- _NodeTypes;
- typedef typename _NodeTypes::key_type key_type;
+ typedef allocator_traits<allocator_type> __alloc_traits;
+ typedef typename __make_tree_node_types<value_type, typename __alloc_traits::void_pointer>::type _NodeTypes;
+ typedef typename _NodeTypes::key_type key_type;
+
public:
- typedef typename _NodeTypes::__node_value_type __node_value_type;
- typedef typename _NodeTypes::__container_value_type __container_value_type;
+ typedef typename _NodeTypes::__node_value_type __node_value_type;
+ typedef typename _NodeTypes::__container_value_type __container_value_type;
- typedef typename __alloc_traits::pointer pointer;
- typedef typename __alloc_traits::const_pointer const_pointer;
- typedef typename __alloc_traits::size_type size_type;
- typedef typename __alloc_traits::difference_type difference_type;
+ typedef typename __alloc_traits::pointer pointer;
+ typedef typename __alloc_traits::const_pointer const_pointer;
+ typedef typename __alloc_traits::size_type size_type;
+ typedef typename __alloc_traits::difference_type difference_type;
public:
- typedef typename _NodeTypes::__void_pointer __void_pointer;
+ typedef typename _NodeTypes::__void_pointer __void_pointer;
- typedef typename _NodeTypes::__node_type __node;
- typedef typename _NodeTypes::__node_pointer __node_pointer;
+ typedef typename _NodeTypes::__node_type __node;
+ typedef typename _NodeTypes::__node_pointer __node_pointer;
- typedef typename _NodeTypes::__node_base_type __node_base;
- typedef typename _NodeTypes::__node_base_pointer __node_base_pointer;
+ typedef typename _NodeTypes::__node_base_type __node_base;
+ typedef typename _NodeTypes::__node_base_pointer __node_base_pointer;
- typedef typename _NodeTypes::__end_node_type __end_node_t;
- typedef typename _NodeTypes::__end_node_pointer __end_node_ptr;
+ typedef typename _NodeTypes::__end_node_type __end_node_t;
+ typedef typename _NodeTypes::__end_node_pointer __end_node_ptr;
- typedef typename _NodeTypes::__parent_pointer __parent_pointer;
- typedef typename _NodeTypes::__iter_pointer __iter_pointer;
+ typedef typename _NodeTypes::__parent_pointer __parent_pointer;
+ typedef typename _NodeTypes::__iter_pointer __iter_pointer;
- typedef __rebind_alloc<__alloc_traits, __node> __node_allocator;
- typedef allocator_traits<__node_allocator> __node_traits;
+ typedef __rebind_alloc<__alloc_traits, __node> __node_allocator;
+ typedef allocator_traits<__node_allocator> __node_traits;
private:
- // check for sane allocator pointer rebinding semantics. Rebinding the
- // allocator for a new pointer type should be exactly the same as rebinding
- // the pointer using 'pointer_traits'.
- static_assert((is_same<__node_pointer, typename __node_traits::pointer>::value),
- "Allocator does not rebind pointers in a sane manner.");
- typedef __rebind_alloc<__node_traits, __node_base> __node_base_allocator;
- typedef allocator_traits<__node_base_allocator> __node_base_traits;
- static_assert((is_same<__node_base_pointer, typename __node_base_traits::pointer>::value),
- "Allocator does not rebind pointers in a sane manner.");
+ // check for sane allocator pointer rebinding semantics. Rebinding the
+ // allocator for a new pointer type should be exactly the same as rebinding
+ // the pointer using 'pointer_traits'.
+ static_assert((is_same<__node_pointer, typename __node_traits::pointer>::value),
+ "Allocator does not rebind pointers in a sane manner.");
+ typedef __rebind_alloc<__node_traits, __node_base> __node_base_allocator;
+ typedef allocator_traits<__node_base_allocator> __node_base_traits;
+ static_assert((is_same<__node_base_pointer, typename __node_base_traits::pointer>::value),
+ "Allocator does not rebind pointers in a sane manner.");
private:
- __iter_pointer __begin_node_;
- __compressed_pair<__end_node_t, __node_allocator> __pair1_;
- __compressed_pair<size_type, value_compare> __pair3_;
+ __iter_pointer __begin_node_;
+ __compressed_pair<__end_node_t, __node_allocator> __pair1_;
+ __compressed_pair<size_type, value_compare> __pair3_;
public:
- _LIBCPP_HIDE_FROM_ABI
- __iter_pointer __end_node() _NOEXCEPT
- {
- return static_cast<__iter_pointer>(
- pointer_traits<__end_node_ptr>::pointer_to(__pair1_.first())
- );
- }
- _LIBCPP_HIDE_FROM_ABI
- __iter_pointer __end_node() const _NOEXCEPT
- {
- return static_cast<__iter_pointer>(
- pointer_traits<__end_node_ptr>::pointer_to(
- const_cast<__end_node_t&>(__pair1_.first())
- )
- );
- }
- _LIBCPP_HIDE_FROM_ABI
- __node_allocator& __node_alloc() _NOEXCEPT {return __pair1_.second();}
+ _LIBCPP_HIDE_FROM_ABI __iter_pointer __end_node() _NOEXCEPT {
+ return static_cast<__iter_pointer>(pointer_traits<__end_node_ptr>::pointer_to(__pair1_.first()));
+ }
+ _LIBCPP_HIDE_FROM_ABI __iter_pointer __end_node() const _NOEXCEPT {
+ return static_cast<__iter_pointer>(
+ pointer_traits<__end_node_ptr>::pointer_to(const_cast<__end_node_t&>(__pair1_.first())));
+ }
+ _LIBCPP_HIDE_FROM_ABI __node_allocator& __node_alloc() _NOEXCEPT { return __pair1_.second(); }
+
private:
- _LIBCPP_HIDE_FROM_ABI
- const __node_allocator& __node_alloc() const _NOEXCEPT
- {return __pair1_.second();}
- _LIBCPP_HIDE_FROM_ABI
- __iter_pointer& __begin_node() _NOEXCEPT {return __begin_node_;}
- _LIBCPP_HIDE_FROM_ABI
- const __iter_pointer& __begin_node() const _NOEXCEPT {return __begin_node_;}
+ _LIBCPP_HIDE_FROM_ABI const __node_allocator& __node_alloc() const _NOEXCEPT { return __pair1_.second(); }
+ _LIBCPP_HIDE_FROM_ABI __iter_pointer& __begin_node() _NOEXCEPT { return __begin_node_; }
+ _LIBCPP_HIDE_FROM_ABI const __iter_pointer& __begin_node() const _NOEXCEPT { return __begin_node_; }
+
public:
- _LIBCPP_HIDE_FROM_ABI
- allocator_type __alloc() const _NOEXCEPT
- {return allocator_type(__node_alloc());}
+ _LIBCPP_HIDE_FROM_ABI allocator_type __alloc() const _NOEXCEPT { return allocator_type(__node_alloc()); }
+
private:
- _LIBCPP_HIDE_FROM_ABI
- size_type& size() _NOEXCEPT {return __pair3_.first();}
+ _LIBCPP_HIDE_FROM_ABI size_type& size() _NOEXCEPT { return __pair3_.first(); }
+
public:
- _LIBCPP_HIDE_FROM_ABI
- const size_type& size() const _NOEXCEPT {return __pair3_.first();}
- _LIBCPP_HIDE_FROM_ABI
- value_compare& value_comp() _NOEXCEPT {return __pair3_.second();}
- _LIBCPP_HIDE_FROM_ABI
- const value_compare& value_comp() const _NOEXCEPT
- {return __pair3_.second();}
+ _LIBCPP_HIDE_FROM_ABI const size_type& size() const _NOEXCEPT { return __pair3_.first(); }
+ _LIBCPP_HIDE_FROM_ABI value_compare& value_comp() _NOEXCEPT { return __pair3_.second(); }
+ _LIBCPP_HIDE_FROM_ABI const value_compare& value_comp() const _NOEXCEPT { return __pair3_.second(); }
+
public:
+ _LIBCPP_HIDE_FROM_ABI __node_pointer __root() const _NOEXCEPT {
+ return static_cast<__node_pointer>(__end_node()->__left_);
+ }
- _LIBCPP_HIDE_FROM_ABI
- __node_pointer __root() const _NOEXCEPT
- {return static_cast<__node_pointer>(__end_node()->__left_);}
+ _LIBCPP_HIDE_FROM_ABI __node_base_pointer* __root_ptr() const _NOEXCEPT {
+ return std::addressof(__end_node()->__left_);
+ }
- _LIBCPP_HIDE_FROM_ABI __node_base_pointer* __root_ptr() const _NOEXCEPT {
- return std::addressof(__end_node()->__left_);
- }
+ typedef __tree_iterator<value_type, __node_pointer, difference_type> iterator;
+ typedef __tree_const_iterator<value_type, __node_pointer, difference_type> const_iterator;
+
+ _LIBCPP_HIDE_FROM_ABI explicit __tree(const value_compare& __comp) _NOEXCEPT_(
+ is_nothrow_default_constructible<__node_allocator>::value&& is_nothrow_copy_constructible<value_compare>::value);
+ _LIBCPP_HIDE_FROM_ABI explicit __tree(const allocator_type& __a);
+ _LIBCPP_HIDE_FROM_ABI __tree(const value_compare& __comp, const allocator_type& __a);
+ _LIBCPP_HIDE_FROM_ABI __tree(const __tree& __t);
+ _LIBCPP_HIDE_FROM_ABI __tree& operator=(const __tree& __t);
+ template <class _ForwardIterator>
+ _LIBCPP_HIDE_FROM_ABI void __assign_unique(_ForwardIterator __first, _ForwardIterator __last);
+ template <class _InputIterator>
+ _LIBCPP_HIDE_FROM_ABI void __assign_multi(_InputIterator __first, _InputIterator __last);
+ _LIBCPP_HIDE_FROM_ABI __tree(__tree&& __t) _NOEXCEPT_(
+ is_nothrow_move_constructible<__node_allocator>::value&& is_nothrow_move_constructible<value_compare>::value);
+ _LIBCPP_HIDE_FROM_ABI __tree(__tree&& __t, const allocator_type& __a);
+ _LIBCPP_HIDE_FROM_ABI __tree& operator=(__tree&& __t) _NOEXCEPT_(
+ __node_traits::propagate_on_container_move_assignment::value&& is_nothrow_move_assignable<value_compare>::value&&
+ is_nothrow_move_assignable<__node_allocator>::value);
+ _LIBCPP_HIDE_FROM_ABI ~__tree();
+
+ _LIBCPP_HIDE_FROM_ABI iterator begin() _NOEXCEPT { return iterator(__begin_node()); }
+ _LIBCPP_HIDE_FROM_ABI const_iterator begin() const _NOEXCEPT { return const_iterator(__begin_node()); }
+ _LIBCPP_HIDE_FROM_ABI iterator end() _NOEXCEPT { return iterator(__end_node()); }
+ _LIBCPP_HIDE_FROM_ABI const_iterator end() const _NOEXCEPT { return const_iterator(__end_node()); }
+
+ _LIBCPP_HIDE_FROM_ABI size_type max_size() const _NOEXCEPT {
+ return std::min<size_type>(__node_traits::max_size(__node_alloc()), numeric_limits<difference_type >::max());
+ }
+
+ _LIBCPP_HIDE_FROM_ABI void clear() _NOEXCEPT;
- typedef __tree_iterator<value_type, __node_pointer, difference_type> iterator;
- typedef __tree_const_iterator<value_type, __node_pointer, difference_type> const_iterator;
-
- _LIBCPP_HIDE_FROM_ABI explicit __tree(const value_compare& __comp)
- _NOEXCEPT_(
- is_nothrow_default_constructible<__node_allocator>::value &&
- is_nothrow_copy_constructible<value_compare>::value);
- _LIBCPP_HIDE_FROM_ABI explicit __tree(const allocator_type& __a);
- _LIBCPP_HIDE_FROM_ABI __tree(const value_compare& __comp, const allocator_type& __a);
- _LIBCPP_HIDE_FROM_ABI __tree(const __tree& __t);
- _LIBCPP_HIDE_FROM_ABI __tree& operator=(const __tree& __t);
- template <class _ForwardIterator>
- _LIBCPP_HIDE_FROM_ABI void __assign_unique(_ForwardIterator __first, _ForwardIterator __last);
- template <class _InputIterator>
- _LIBCPP_HIDE_FROM_ABI void __assign_multi(_InputIterator __first, _InputIterator __last);
- _LIBCPP_HIDE_FROM_ABI __tree(__tree&& __t)
- _NOEXCEPT_(
- is_nothrow_move_constructible<__node_allocator>::value &&
- is_nothrow_move_constructible<value_compare>::value);
- _LIBCPP_HIDE_FROM_ABI __tree(__tree&& __t, const allocator_type& __a);
- _LIBCPP_HIDE_FROM_ABI __tree& operator=(__tree&& __t)
- _NOEXCEPT_(
- __node_traits::propagate_on_container_move_assignment::value &&
- is_nothrow_move_assignable<value_compare>::value &&
- is_nothrow_move_assignable<__node_allocator>::value);
- _LIBCPP_HIDE_FROM_ABI ~__tree();
-
- _LIBCPP_HIDE_FROM_ABI
- iterator begin() _NOEXCEPT {return iterator(__begin_node());}
- _LIBCPP_HIDE_FROM_ABI
- const_iterator begin() const _NOEXCEPT {return const_iterator(__begin_node());}
- _LIBCPP_HIDE_FROM_ABI
- iterator end() _NOEXCEPT {return iterator(__end_node());}
- _LIBCPP_HIDE_FROM_ABI
- const_iterator end() const _NOEXCEPT {return const_iterator(__end_node());}
-
- _LIBCPP_HIDE_FROM_ABI
- size_type max_size() const _NOEXCEPT
- {return std::min<size_type>(
- __node_traits::max_size(__node_alloc()),
- numeric_limits<difference_type >::max());}
-
- _LIBCPP_HIDE_FROM_ABI void clear() _NOEXCEPT;
-
- _LIBCPP_HIDE_FROM_ABI void swap(__tree& __t)
+ _LIBCPP_HIDE_FROM_ABI void swap(__tree& __t)
#if _LIBCPP_STD_VER <= 11
- _NOEXCEPT_(
- __is_nothrow_swappable<value_compare>::value
- && (!__node_traits::propagate_on_container_swap::value ||
- __is_nothrow_swappable<__node_allocator>::value)
- );
+ _NOEXCEPT_(__is_nothrow_swappable<value_compare>::value &&
+ (!__node_traits::propagate_on_container_swap::value ||
+ __is_nothrow_swappable<__node_allocator>::value));
#else
- _NOEXCEPT_(__is_nothrow_swappable<value_compare>::value);
+ _NOEXCEPT_(__is_nothrow_swappable<value_compare>::value);
#endif
- template <class _Key, class ..._Args>
- _LIBCPP_HIDE_FROM_ABI pair<iterator, bool>
- __emplace_unique_key_args(_Key const&, _Args&&... __args);
- template <class _Key, class ..._Args>
- _LIBCPP_HIDE_FROM_ABI pair<iterator, bool>
- __emplace_hint_unique_key_args(const_iterator, _Key const&, _Args&&...);
-
- template <class... _Args>
- _LIBCPP_HIDE_FROM_ABI pair<iterator, bool> __emplace_unique_impl(_Args&&... __args);
+ template <class _Key, class... _Args>
+ _LIBCPP_HIDE_FROM_ABI pair<iterator, bool> __emplace_unique_key_args(_Key const&, _Args&&... __args);
+ template <class _Key, class... _Args>
+ _LIBCPP_HIDE_FROM_ABI pair<iterator, bool> __emplace_hint_unique_key_args(const_iterator, _Key const&, _Args&&...);
- template <class... _Args>
- _LIBCPP_HIDE_FROM_ABI iterator __emplace_hint_unique_impl(const_iterator __p, _Args&&... __args);
+ template <class... _Args>
+ _LIBCPP_HIDE_FROM_ABI pair<iterator, bool> __emplace_unique_impl(_Args&&... __args);
- template <class... _Args>
- _LIBCPP_HIDE_FROM_ABI iterator __emplace_multi(_Args&&... __args);
+ template <class... _Args>
+ _LIBCPP_HIDE_FROM_ABI iterator __emplace_hint_unique_impl(const_iterator __p, _Args&&... __args);
- template <class... _Args>
- _LIBCPP_HIDE_FROM_ABI iterator __emplace_hint_multi(const_iterator __p, _Args&&... __args);
+ template <class... _Args>
+ _LIBCPP_HIDE_FROM_ABI iterator __emplace_multi(_Args&&... __args);
- template <class _Pp>
- _LIBCPP_HIDE_FROM_ABI
- pair<iterator, bool> __emplace_unique(_Pp&& __x) {
- return __emplace_unique_extract_key(std::forward<_Pp>(__x),
- __can_extract_key<_Pp, key_type>());
- }
+ template <class... _Args>
+ _LIBCPP_HIDE_FROM_ABI iterator __emplace_hint_multi(const_iterator __p, _Args&&... __args);
- template <class _First, class _Second,
- __enable_if_t<__can_extract_map_key<_First, key_type, __container_value_type>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI
- pair<iterator, bool>
- __emplace_unique(_First&& __f, _Second&& __s) {
- return __emplace_unique_key_args(__f, std::forward<_First>(__f),
- std::forward<_Second>(__s));
- }
+ template <class _Pp>
+ _LIBCPP_HIDE_FROM_ABI pair<iterator, bool> __emplace_unique(_Pp&& __x) {
+ return __emplace_unique_extract_key(std::forward<_Pp>(__x), __can_extract_key<_Pp, key_type>());
+ }
- template <class... _Args>
- _LIBCPP_HIDE_FROM_ABI
- pair<iterator, bool> __emplace_unique(_Args&&... __args) {
- return __emplace_unique_impl(std::forward<_Args>(__args)...);
- }
+ template <class _First,
+ class _Second,
+ __enable_if_t<__can_extract_map_key<_First, key_type, __container_value_type>::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI pair<iterator, bool> __emplace_unique(_First&& __f, _Second&& __s) {
+ return __emplace_unique_key_args(__f, std::forward<_First>(__f), std::forward<_Second>(__s));
+ }
- template <class _Pp>
- _LIBCPP_HIDE_FROM_ABI
- pair<iterator, bool>
- __emplace_unique_extract_key(_Pp&& __x, __extract_key_fail_tag) {
- return __emplace_unique_impl(std::forward<_Pp>(__x));
- }
+ template <class... _Args>
+ _LIBCPP_HIDE_FROM_ABI pair<iterator, bool> __emplace_unique(_Args&&... __args) {
+ return __emplace_unique_impl(std::forward<_Args>(__args)...);
+ }
- template <class _Pp>
- _LIBCPP_HIDE_FROM_ABI
- pair<iterator, bool>
- __emplace_unique_extract_key(_Pp&& __x, __extract_key_self_tag) {
- return __emplace_unique_key_args(__x, std::forward<_Pp>(__x));
- }
+ template <class _Pp>
+ _LIBCPP_HIDE_FROM_ABI pair<iterator, bool> __emplace_unique_extract_key(_Pp&& __x, __extract_key_fail_tag) {
+ return __emplace_unique_impl(std::forward<_Pp>(__x));
+ }
- template <class _Pp>
- _LIBCPP_HIDE_FROM_ABI
- pair<iterator, bool>
- __emplace_unique_extract_key(_Pp&& __x, __extract_key_first_tag) {
- return __emplace_unique_key_args(__x.first, std::forward<_Pp>(__x));
- }
+ template <class _Pp>
+ _LIBCPP_HIDE_FROM_ABI pair<iterator, bool> __emplace_unique_extract_key(_Pp&& __x, __extract_key_self_tag) {
+ return __emplace_unique_key_args(__x, std::forward<_Pp>(__x));
+ }
- template <class _Pp>
- _LIBCPP_HIDE_FROM_ABI
- iterator __emplace_hint_unique(const_iterator __p, _Pp&& __x) {
- return __emplace_hint_unique_extract_key(__p, std::forward<_Pp>(__x),
- __can_extract_key<_Pp, key_type>());
- }
+ template <class _Pp>
+ _LIBCPP_HIDE_FROM_ABI pair<iterator, bool> __emplace_unique_extract_key(_Pp&& __x, __extract_key_first_tag) {
+ return __emplace_unique_key_args(__x.first, std::forward<_Pp>(__x));
+ }
- template <class _First, class _Second,
- __enable_if_t<__can_extract_map_key<_First, key_type, __container_value_type>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI
- iterator
- __emplace_hint_unique(const_iterator __p, _First&& __f, _Second&& __s) {
- return __emplace_hint_unique_key_args(__p, __f,
- std::forward<_First>(__f),
- std::forward<_Second>(__s)).first;
- }
+ template <class _Pp>
+ _LIBCPP_HIDE_FROM_ABI iterator __emplace_hint_unique(const_iterator __p, _Pp&& __x) {
+ return __emplace_hint_unique_extract_key(__p, std::forward<_Pp>(__x), __can_extract_key<_Pp, key_type>());
+ }
- template <class... _Args>
- _LIBCPP_HIDE_FROM_ABI
- iterator __emplace_hint_unique(const_iterator __p, _Args&&... __args) {
- return __emplace_hint_unique_impl(__p, std::forward<_Args>(__args)...);
- }
+ template <class _First,
+ class _Second,
+ __enable_if_t<__can_extract_map_key<_First, key_type, __container_value_type>::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI iterator __emplace_hint_unique(const_iterator __p, _First&& __f, _Second&& __s) {
+ return __emplace_hint_unique_key_args(__p, __f, std::forward<_First>(__f), std::forward<_Second>(__s)).first;
+ }
- template <class _Pp>
- _LIBCPP_HIDE_FROM_ABI
- iterator
- __emplace_hint_unique_extract_key(const_iterator __p, _Pp&& __x, __extract_key_fail_tag) {
- return __emplace_hint_unique_impl(__p, std::forward<_Pp>(__x));
- }
+ template <class... _Args>
+ _LIBCPP_HIDE_FROM_ABI iterator __emplace_hint_unique(const_iterator __p, _Args&&... __args) {
+ return __emplace_hint_unique_impl(__p, std::forward<_Args>(__args)...);
+ }
- template <class _Pp>
- _LIBCPP_HIDE_FROM_ABI
- iterator
- __emplace_hint_unique_extract_key(const_iterator __p, _Pp&& __x, __extract_key_self_tag) {
- return __emplace_hint_unique_key_args(__p, __x, std::forward<_Pp>(__x)).first;
- }
+ template <class _Pp>
+ _LIBCPP_HIDE_FROM_ABI iterator
+ __emplace_hint_unique_extract_key(const_iterator __p, _Pp&& __x, __extract_key_fail_tag) {
+ return __emplace_hint_unique_impl(__p, std::forward<_Pp>(__x));
+ }
- template <class _Pp>
- _LIBCPP_HIDE_FROM_ABI
- iterator
- __emplace_hint_unique_extract_key(const_iterator __p, _Pp&& __x, __extract_key_first_tag) {
- return __emplace_hint_unique_key_args(__p, __x.first, std::forward<_Pp>(__x)).first;
- }
+ template <class _Pp>
+ _LIBCPP_HIDE_FROM_ABI iterator
+ __emplace_hint_unique_extract_key(const_iterator __p, _Pp&& __x, __extract_key_self_tag) {
+ return __emplace_hint_unique_key_args(__p, __x, std::forward<_Pp>(__x)).first;
+ }
- _LIBCPP_HIDE_FROM_ABI
- pair<iterator, bool> __insert_unique(const __container_value_type& __v) {
- return __emplace_unique_key_args(_NodeTypes::__get_key(__v), __v);
- }
+ template <class _Pp>
+ _LIBCPP_HIDE_FROM_ABI iterator
+ __emplace_hint_unique_extract_key(const_iterator __p, _Pp&& __x, __extract_key_first_tag) {
+ return __emplace_hint_unique_key_args(__p, __x.first, std::forward<_Pp>(__x)).first;
+ }
- _LIBCPP_HIDE_FROM_ABI
- iterator __insert_unique(const_iterator __p, const __container_value_type& __v) {
- return __emplace_hint_unique_key_args(__p, _NodeTypes::__get_key(__v), __v).first;
- }
+ _LIBCPP_HIDE_FROM_ABI pair<iterator, bool> __insert_unique(const __container_value_type& __v) {
+ return __emplace_unique_key_args(_NodeTypes::__get_key(__v), __v);
+ }
- _LIBCPP_HIDE_FROM_ABI
- pair<iterator, bool> __insert_unique(__container_value_type&& __v) {
- return __emplace_unique_key_args(_NodeTypes::__get_key(__v), std::move(__v));
- }
+ _LIBCPP_HIDE_FROM_ABI iterator __insert_unique(const_iterator __p, const __container_value_type& __v) {
+ return __emplace_hint_unique_key_args(__p, _NodeTypes::__get_key(__v), __v).first;
+ }
- _LIBCPP_HIDE_FROM_ABI
- iterator __insert_unique(const_iterator __p, __container_value_type&& __v) {
- return __emplace_hint_unique_key_args(__p, _NodeTypes::__get_key(__v), std::move(__v)).first;
- }
+ _LIBCPP_HIDE_FROM_ABI pair<iterator, bool> __insert_unique(__container_value_type&& __v) {
+ return __emplace_unique_key_args(_NodeTypes::__get_key(__v), std::move(__v));
+ }
- template <class _Vp,
- class = __enable_if_t<!is_same<__remove_const_ref_t<_Vp>, __container_value_type>::value> >
- _LIBCPP_HIDE_FROM_ABI
- pair<iterator, bool> __insert_unique(_Vp&& __v) {
- return __emplace_unique(std::forward<_Vp>(__v));
- }
+ _LIBCPP_HIDE_FROM_ABI iterator __insert_unique(const_iterator __p, __container_value_type&& __v) {
+ return __emplace_hint_unique_key_args(__p, _NodeTypes::__get_key(__v), std::move(__v)).first;
+ }
- template <class _Vp,
- class = __enable_if_t<!is_same<__remove_const_ref_t<_Vp>, __container_value_type>::value> >
- _LIBCPP_HIDE_FROM_ABI
- iterator __insert_unique(const_iterator __p, _Vp&& __v) {
- return __emplace_hint_unique(__p, std::forward<_Vp>(__v));
- }
+ template <class _Vp, class = __enable_if_t<!is_same<__remove_const_ref_t<_Vp>, __container_value_type>::value> >
+ _LIBCPP_HIDE_FROM_ABI pair<iterator, bool> __insert_unique(_Vp&& __v) {
+ return __emplace_unique(std::forward<_Vp>(__v));
+ }
- _LIBCPP_HIDE_FROM_ABI
- iterator __insert_multi(__container_value_type&& __v) {
- return __emplace_multi(std::move(__v));
- }
+ template <class _Vp, class = __enable_if_t<!is_same<__remove_const_ref_t<_Vp>, __container_value_type>::value> >
+ _LIBCPP_HIDE_FROM_ABI iterator __insert_unique(const_iterator __p, _Vp&& __v) {
+ return __emplace_hint_unique(__p, std::forward<_Vp>(__v));
+ }
- _LIBCPP_HIDE_FROM_ABI
- iterator __insert_multi(const_iterator __p, __container_value_type&& __v) {
- return __emplace_hint_multi(__p, std::move(__v));
- }
+ _LIBCPP_HIDE_FROM_ABI iterator __insert_multi(__container_value_type&& __v) {
+ return __emplace_multi(std::move(__v));
+ }
- template <class _Vp>
- _LIBCPP_HIDE_FROM_ABI
- iterator __insert_multi(_Vp&& __v) {
- return __emplace_multi(std::forward<_Vp>(__v));
- }
+ _LIBCPP_HIDE_FROM_ABI iterator __insert_multi(const_iterator __p, __container_value_type&& __v) {
+ return __emplace_hint_multi(__p, std::move(__v));
+ }
- template <class _Vp>
- _LIBCPP_HIDE_FROM_ABI
- iterator __insert_multi(const_iterator __p, _Vp&& __v) {
- return __emplace_hint_multi(__p, std::forward<_Vp>(__v));
- }
+ template <class _Vp>
+ _LIBCPP_HIDE_FROM_ABI iterator __insert_multi(_Vp&& __v) {
+ return __emplace_multi(std::forward<_Vp>(__v));
+ }
- _LIBCPP_HIDE_FROM_ABI
- pair<iterator, bool> __node_assign_unique(const __container_value_type& __v, __node_pointer __dest);
+ template <class _Vp>
+ _LIBCPP_HIDE_FROM_ABI iterator __insert_multi(const_iterator __p, _Vp&& __v) {
+ return __emplace_hint_multi(__p, std::forward<_Vp>(__v));
+ }
- _LIBCPP_HIDE_FROM_ABI
- iterator __node_insert_multi(__node_pointer __nd);
- _LIBCPP_HIDE_FROM_ABI
- iterator __node_insert_multi(const_iterator __p, __node_pointer __nd);
+ _LIBCPP_HIDE_FROM_ABI pair<iterator, bool>
+ __node_assign_unique(const __container_value_type& __v, __node_pointer __dest);
+ _LIBCPP_HIDE_FROM_ABI iterator __node_insert_multi(__node_pointer __nd);
+ _LIBCPP_HIDE_FROM_ABI iterator __node_insert_multi(const_iterator __p, __node_pointer __nd);
- _LIBCPP_HIDE_FROM_ABI iterator
- __remove_node_pointer(__node_pointer) _NOEXCEPT;
+ _LIBCPP_HIDE_FROM_ABI iterator __remove_node_pointer(__node_pointer) _NOEXCEPT;
#if _LIBCPP_STD_VER >= 17
- template <class _NodeHandle, class _InsertReturnType>
- _LIBCPP_HIDE_FROM_ABI
- _InsertReturnType __node_handle_insert_unique(_NodeHandle&&);
- template <class _NodeHandle>
- _LIBCPP_HIDE_FROM_ABI
- iterator __node_handle_insert_unique(const_iterator, _NodeHandle&&);
- template <class _Tree>
- _LIBCPP_HIDE_FROM_ABI
- void __node_handle_merge_unique(_Tree& __source);
-
- template <class _NodeHandle>
- _LIBCPP_HIDE_FROM_ABI
- iterator __node_handle_insert_multi(_NodeHandle&&);
- template <class _NodeHandle>
- _LIBCPP_HIDE_FROM_ABI
- iterator __node_handle_insert_multi(const_iterator, _NodeHandle&&);
- template <class _Tree>
- _LIBCPP_HIDE_FROM_ABI
- void __node_handle_merge_multi(_Tree& __source);
-
-
- template <class _NodeHandle>
- _LIBCPP_HIDE_FROM_ABI
- _NodeHandle __node_handle_extract(key_type const&);
- template <class _NodeHandle>
- _LIBCPP_HIDE_FROM_ABI
- _NodeHandle __node_handle_extract(const_iterator);
+ template <class _NodeHandle, class _InsertReturnType>
+ _LIBCPP_HIDE_FROM_ABI _InsertReturnType __node_handle_insert_unique(_NodeHandle&&);
+ template <class _NodeHandle>
+ _LIBCPP_HIDE_FROM_ABI iterator __node_handle_insert_unique(const_iterator, _NodeHandle&&);
+ template <class _Tree>
+ _LIBCPP_HIDE_FROM_ABI void __node_handle_merge_unique(_Tree& __source);
+
+ template <class _NodeHandle>
+ _LIBCPP_HIDE_FROM_ABI iterator __node_handle_insert_multi(_NodeHandle&&);
+ template <class _NodeHandle>
+ _LIBCPP_HIDE_FROM_ABI iterator __node_handle_insert_multi(const_iterator, _NodeHandle&&);
+ template <class _Tree>
+ _LIBCPP_HIDE_FROM_ABI void __node_handle_merge_multi(_Tree& __source);
+
+ template <class _NodeHandle>
+ _LIBCPP_HIDE_FROM_ABI _NodeHandle __node_handle_extract(key_type const&);
+ template <class _NodeHandle>
+ _LIBCPP_HIDE_FROM_ABI _NodeHandle __node_handle_extract(const_iterator);
#endif
- _LIBCPP_HIDE_FROM_ABI iterator erase(const_iterator __p);
- _LIBCPP_HIDE_FROM_ABI iterator erase(const_iterator __f, const_iterator __l);
- template <class _Key>
- _LIBCPP_HIDE_FROM_ABI size_type __erase_unique(const _Key& __k);
- template <class _Key>
- _LIBCPP_HIDE_FROM_ABI size_type __erase_multi(const _Key& __k);
-
- _LIBCPP_HIDE_FROM_ABI void __insert_node_at(__parent_pointer __parent,
- __node_base_pointer& __child,
- __node_base_pointer __new_node) _NOEXCEPT;
-
- template <class _Key>
- _LIBCPP_HIDE_FROM_ABI iterator find(const _Key& __v);
- template <class _Key>
- _LIBCPP_HIDE_FROM_ABI const_iterator find(const _Key& __v) const;
-
- template <class _Key>
- _LIBCPP_HIDE_FROM_ABI size_type __count_unique(const _Key& __k) const;
- template <class _Key>
- _LIBCPP_HIDE_FROM_ABI size_type __count_multi(const _Key& __k) const;
-
- template <class _Key>
- _LIBCPP_HIDE_FROM_ABI
- iterator lower_bound(const _Key& __v)
- {return __lower_bound(__v, __root(), __end_node());}
- template <class _Key>
- _LIBCPP_HIDE_FROM_ABI iterator __lower_bound(const _Key& __v,
- __node_pointer __root,
- __iter_pointer __result);
- template <class _Key>
- _LIBCPP_HIDE_FROM_ABI
- const_iterator lower_bound(const _Key& __v) const
- {return __lower_bound(__v, __root(), __end_node());}
- template <class _Key>
- _LIBCPP_HIDE_FROM_ABI const_iterator __lower_bound(const _Key& __v,
- __node_pointer __root,
- __iter_pointer __result) const;
- template <class _Key>
- _LIBCPP_HIDE_FROM_ABI
- iterator upper_bound(const _Key& __v)
- {return __upper_bound(__v, __root(), __end_node());}
- template <class _Key>
- _LIBCPP_HIDE_FROM_ABI iterator __upper_bound(const _Key& __v,
- __node_pointer __root,
- __iter_pointer __result);
- template <class _Key>
- _LIBCPP_HIDE_FROM_ABI
- const_iterator upper_bound(const _Key& __v) const
- {return __upper_bound(__v, __root(), __end_node());}
- template <class _Key>
- _LIBCPP_HIDE_FROM_ABI const_iterator __upper_bound(const _Key& __v,
- __node_pointer __root,
- __iter_pointer __result) const;
- template <class _Key>
- _LIBCPP_HIDE_FROM_ABI pair<iterator, iterator>
- __equal_range_unique(const _Key& __k);
- template <class _Key>
- _LIBCPP_HIDE_FROM_ABI pair<const_iterator, const_iterator>
- __equal_range_unique(const _Key& __k) const;
-
- template <class _Key>
- _LIBCPP_HIDE_FROM_ABI pair<iterator, iterator>
- __equal_range_multi(const _Key& __k);
- template <class _Key>
- _LIBCPP_HIDE_FROM_ABI pair<const_iterator, const_iterator>
- __equal_range_multi(const _Key& __k) const;
-
- typedef __tree_node_destructor<__node_allocator> _Dp;
- typedef unique_ptr<__node, _Dp> __node_holder;
-
- _LIBCPP_HIDE_FROM_ABI __node_holder remove(const_iterator __p) _NOEXCEPT;
+ _LIBCPP_HIDE_FROM_ABI iterator erase(const_iterator __p);
+ _LIBCPP_HIDE_FROM_ABI iterator erase(const_iterator __f, const_iterator __l);
+ template <class _Key>
+ _LIBCPP_HIDE_FROM_ABI size_type __erase_unique(const _Key& __k);
+ template <class _Key>
+ _LIBCPP_HIDE_FROM_ABI size_type __erase_multi(const _Key& __k);
+
+ _LIBCPP_HIDE_FROM_ABI void
+ __insert_node_at(__parent_pointer __parent, __node_base_pointer& __child, __node_base_pointer __new_node) _NOEXCEPT;
+
+ template <class _Key>
+ _LIBCPP_HIDE_FROM_ABI iterator find(const _Key& __v);
+ template <class _Key>
+ _LIBCPP_HIDE_FROM_ABI const_iterator find(const _Key& __v) const;
+
+ template <class _Key>
+ _LIBCPP_HIDE_FROM_ABI size_type __count_unique(const _Key& __k) const;
+ template <class _Key>
+ _LIBCPP_HIDE_FROM_ABI size_type __count_multi(const _Key& __k) const;
+
+ template <class _Key>
+ _LIBCPP_HIDE_FROM_ABI iterator lower_bound(const _Key& __v) {
+ return __lower_bound(__v, __root(), __end_node());
+ }
+ template <class _Key>
+ _LIBCPP_HIDE_FROM_ABI iterator __lower_bound(const _Key& __v, __node_pointer __root, __iter_pointer __result);
+ template <class _Key>
+ _LIBCPP_HIDE_FROM_ABI const_iterator lower_bound(const _Key& __v) const {
+ return __lower_bound(__v, __root(), __end_node());
+ }
+ template <class _Key>
+ _LIBCPP_HIDE_FROM_ABI const_iterator
+ __lower_bound(const _Key& __v, __node_pointer __root, __iter_pointer __result) const;
+ template <class _Key>
+ _LIBCPP_HIDE_FROM_ABI iterator upper_bound(const _Key& __v) {
+ return __upper_bound(__v, __root(), __end_node());
+ }
+ template <class _Key>
+ _LIBCPP_HIDE_FROM_ABI iterator __upper_bound(const _Key& __v, __node_pointer __root, __iter_pointer __result);
+ template <class _Key>
+ _LIBCPP_HIDE_FROM_ABI const_iterator upper_bound(const _Key& __v) const {
+ return __upper_bound(__v, __root(), __end_node());
+ }
+ template <class _Key>
+ _LIBCPP_HIDE_FROM_ABI const_iterator
+ __upper_bound(const _Key& __v, __node_pointer __root, __iter_pointer __result) const;
+ template <class _Key>
+ _LIBCPP_HIDE_FROM_ABI pair<iterator, iterator> __equal_range_unique(const _Key& __k);
+ template <class _Key>
+ _LIBCPP_HIDE_FROM_ABI pair<const_iterator, const_iterator> __equal_range_unique(const _Key& __k) const;
+
+ template <class _Key>
+ _LIBCPP_HIDE_FROM_ABI pair<iterator, iterator> __equal_range_multi(const _Key& __k);
+ template <class _Key>
+ _LIBCPP_HIDE_FROM_ABI pair<const_iterator, const_iterator> __equal_range_multi(const _Key& __k) const;
+
+ typedef __tree_node_destructor<__node_allocator> _Dp;
+ typedef unique_ptr<__node, _Dp> __node_holder;
+
+ _LIBCPP_HIDE_FROM_ABI __node_holder remove(const_iterator __p) _NOEXCEPT;
+
private:
- _LIBCPP_HIDE_FROM_ABI __node_base_pointer& __find_leaf_low(__parent_pointer& __parent, const key_type& __v);
- _LIBCPP_HIDE_FROM_ABI __node_base_pointer& __find_leaf_high(__parent_pointer& __parent, const key_type& __v);
- _LIBCPP_HIDE_FROM_ABI __node_base_pointer&
- __find_leaf(const_iterator __hint, __parent_pointer& __parent, const key_type& __v);
- // FIXME: Make this function const qualified. Unfortunately doing so
- // breaks existing code which uses non-const callable comparators.
- template <class _Key>
- _LIBCPP_HIDE_FROM_ABI __node_base_pointer& __find_equal(__parent_pointer& __parent, const _Key& __v);
- template <class _Key>
- _LIBCPP_HIDE_FROM_ABI __node_base_pointer&
- __find_equal(__parent_pointer& __parent, const _Key& __v) const {
- return const_cast<__tree*>(this)->__find_equal(__parent, __v);
- }
- template <class _Key>
- _LIBCPP_HIDE_FROM_ABI __node_base_pointer&
- __find_equal(const_iterator __hint, __parent_pointer& __parent,
- __node_base_pointer& __dummy,
- const _Key& __v);
+ _LIBCPP_HIDE_FROM_ABI __node_base_pointer& __find_leaf_low(__parent_pointer& __parent, const key_type& __v);
+ _LIBCPP_HIDE_FROM_ABI __node_base_pointer& __find_leaf_high(__parent_pointer& __parent, const key_type& __v);
+ _LIBCPP_HIDE_FROM_ABI __node_base_pointer&
+ __find_leaf(const_iterator __hint, __parent_pointer& __parent, const key_type& __v);
+ // FIXME: Make this function const qualified. Unfortunately doing so
+ // breaks existing code which uses non-const callable comparators.
+ template <class _Key>
+ _LIBCPP_HIDE_FROM_ABI __node_base_pointer& __find_equal(__parent_pointer& __parent, const _Key& __v);
+ template <class _Key>
+ _LIBCPP_HIDE_FROM_ABI __node_base_pointer& __find_equal(__parent_pointer& __parent, const _Key& __v) const {
+ return const_cast<__tree*>(this)->__find_equal(__parent, __v);
+ }
+ template <class _Key>
+ _LIBCPP_HIDE_FROM_ABI __node_base_pointer&
+ __find_equal(const_iterator __hint, __parent_pointer& __parent, __node_base_pointer& __dummy, const _Key& __v);
- template <class ..._Args>
- _LIBCPP_HIDE_FROM_ABI __node_holder __construct_node(_Args&& ...__args);
+ template <class... _Args>
+ _LIBCPP_HIDE_FROM_ABI __node_holder __construct_node(_Args&&... __args);
- // TODO: Make this _LIBCPP_HIDE_FROM_ABI
- _LIBCPP_HIDDEN void destroy(__node_pointer __nd) _NOEXCEPT;
+ // TODO: Make this _LIBCPP_HIDE_FROM_ABI
+ _LIBCPP_HIDDEN void destroy(__node_pointer __nd) _NOEXCEPT;
- _LIBCPP_HIDE_FROM_ABI
- void __copy_assign_alloc(const __tree& __t)
- {__copy_assign_alloc(__t, integral_constant<bool,
- __node_traits::propagate_on_container_copy_assignment::value>());}
+ _LIBCPP_HIDE_FROM_ABI void __copy_assign_alloc(const __tree& __t) {
+ __copy_assign_alloc(__t, integral_constant<bool, __node_traits::propagate_on_container_copy_assignment::value>());
+ }
- _LIBCPP_HIDE_FROM_ABI
- void __copy_assign_alloc(const __tree& __t, true_type)
- {
- if (__node_alloc() != __t.__node_alloc())
- clear();
- __node_alloc() = __t.__node_alloc();
- }
- _LIBCPP_HIDE_FROM_ABI
- void __copy_assign_alloc(const __tree&, false_type) {}
-
- _LIBCPP_HIDE_FROM_ABI void __move_assign(__tree& __t, false_type);
- _LIBCPP_HIDE_FROM_ABI void __move_assign(__tree& __t, true_type)
- _NOEXCEPT_(is_nothrow_move_assignable<value_compare>::value &&
- is_nothrow_move_assignable<__node_allocator>::value);
-
- _LIBCPP_HIDE_FROM_ABI
- void __move_assign_alloc(__tree& __t)
- _NOEXCEPT_(
- !__node_traits::propagate_on_container_move_assignment::value ||
- is_nothrow_move_assignable<__node_allocator>::value)
- {__move_assign_alloc(__t, integral_constant<bool,
- __node_traits::propagate_on_container_move_assignment::value>());}
-
- _LIBCPP_HIDE_FROM_ABI
- void __move_assign_alloc(__tree& __t, true_type)
- _NOEXCEPT_(is_nothrow_move_assignable<__node_allocator>::value)
- {__node_alloc() = std::move(__t.__node_alloc());}
- _LIBCPP_HIDE_FROM_ABI
- void __move_assign_alloc(__tree&, false_type) _NOEXCEPT {}
-
- struct _DetachedTreeCache {
- _LIBCPP_HIDE_FROM_ABI
- explicit _DetachedTreeCache(__tree *__t) _NOEXCEPT : __t_(__t),
- __cache_root_(__detach_from_tree(__t)) {
- __advance();
- }
+ _LIBCPP_HIDE_FROM_ABI void __copy_assign_alloc(const __tree& __t, true_type) {
+ if (__node_alloc() != __t.__node_alloc())
+ clear();
+ __node_alloc() = __t.__node_alloc();
+ }
+ _LIBCPP_HIDE_FROM_ABI void __copy_assign_alloc(const __tree&, false_type) {}
- _LIBCPP_HIDE_FROM_ABI
- __node_pointer __get() const _NOEXCEPT {
- return __cache_elem_;
- }
+ _LIBCPP_HIDE_FROM_ABI void __move_assign(__tree& __t, false_type);
+ _LIBCPP_HIDE_FROM_ABI void __move_assign(__tree& __t, true_type) _NOEXCEPT_(
+ is_nothrow_move_assignable<value_compare>::value&& is_nothrow_move_assignable<__node_allocator>::value);
- _LIBCPP_HIDE_FROM_ABI
- void __advance() _NOEXCEPT {
- __cache_elem_ = __cache_root_;
- if (__cache_root_) {
- __cache_root_ = __detach_next(__cache_root_);
- }
- }
+ _LIBCPP_HIDE_FROM_ABI void __move_assign_alloc(__tree& __t)
+ _NOEXCEPT_(!__node_traits::propagate_on_container_move_assignment::value ||
+ is_nothrow_move_assignable<__node_allocator>::value) {
+ __move_assign_alloc(__t, integral_constant<bool, __node_traits::propagate_on_container_move_assignment::value>());
+ }
- _LIBCPP_HIDE_FROM_ABI
- ~_DetachedTreeCache() {
- __t_->destroy(__cache_elem_);
- if (__cache_root_) {
- while (__cache_root_->__parent_ != nullptr)
- __cache_root_ = static_cast<__node_pointer>(__cache_root_->__parent_);
- __t_->destroy(__cache_root_);
- }
+ _LIBCPP_HIDE_FROM_ABI void __move_assign_alloc(__tree& __t, true_type)
+ _NOEXCEPT_(is_nothrow_move_assignable<__node_allocator>::value) {
+ __node_alloc() = std::move(__t.__node_alloc());
+ }
+ _LIBCPP_HIDE_FROM_ABI void __move_assign_alloc(__tree&, false_type) _NOEXCEPT {}
+
+ struct _DetachedTreeCache {
+ _LIBCPP_HIDE_FROM_ABI explicit _DetachedTreeCache(__tree* __t) _NOEXCEPT
+ : __t_(__t),
+ __cache_root_(__detach_from_tree(__t)) {
+ __advance();
+ }
+
+ _LIBCPP_HIDE_FROM_ABI __node_pointer __get() const _NOEXCEPT { return __cache_elem_; }
+
+ _LIBCPP_HIDE_FROM_ABI void __advance() _NOEXCEPT {
+ __cache_elem_ = __cache_root_;
+ if (__cache_root_) {
+ __cache_root_ = __detach_next(__cache_root_);
}
+ }
- _DetachedTreeCache(_DetachedTreeCache const&) = delete;
- _DetachedTreeCache& operator=(_DetachedTreeCache const&) = delete;
+ _LIBCPP_HIDE_FROM_ABI ~_DetachedTreeCache() {
+ __t_->destroy(__cache_elem_);
+ if (__cache_root_) {
+ while (__cache_root_->__parent_ != nullptr)
+ __cache_root_ = static_cast<__node_pointer>(__cache_root_->__parent_);
+ __t_->destroy(__cache_root_);
+ }
+ }
- private:
- _LIBCPP_HIDE_FROM_ABI
- static __node_pointer __detach_from_tree(__tree *__t) _NOEXCEPT;
- _LIBCPP_HIDE_FROM_ABI
- static __node_pointer __detach_next(__node_pointer) _NOEXCEPT;
+ _DetachedTreeCache(_DetachedTreeCache const&) = delete;
+ _DetachedTreeCache& operator=(_DetachedTreeCache const&) = delete;
- __tree *__t_;
- __node_pointer __cache_root_;
- __node_pointer __cache_elem_;
- };
+ private:
+ _LIBCPP_HIDE_FROM_ABI static __node_pointer __detach_from_tree(__tree* __t) _NOEXCEPT;
+ _LIBCPP_HIDE_FROM_ABI static __node_pointer __detach_next(__node_pointer) _NOEXCEPT;
+ __tree* __t_;
+ __node_pointer __cache_root_;
+ __node_pointer __cache_elem_;
+ };
- template <class, class, class, class> friend class _LIBCPP_TEMPLATE_VIS map;
- template <class, class, class, class> friend class _LIBCPP_TEMPLATE_VIS multimap;
+ template <class, class, class, class>
+ friend class _LIBCPP_TEMPLATE_VIS map;
+ template <class, class, class, class>
+ friend class _LIBCPP_TEMPLATE_VIS multimap;
};
template <class _Tp, class _Compare, class _Allocator>
-__tree<_Tp, _Compare, _Allocator>::__tree(const value_compare& __comp)
- _NOEXCEPT_(
- is_nothrow_default_constructible<__node_allocator>::value &&
- is_nothrow_copy_constructible<value_compare>::value)
- : __pair3_(0, __comp)
-{
- __begin_node() = __end_node();
+__tree<_Tp, _Compare, _Allocator>::__tree(const value_compare& __comp) _NOEXCEPT_(
+ is_nothrow_default_constructible<__node_allocator>::value&& is_nothrow_copy_constructible<value_compare>::value)
+ : __pair3_(0, __comp) {
+ __begin_node() = __end_node();
}
template <class _Tp, class _Compare, class _Allocator>
__tree<_Tp, _Compare, _Allocator>::__tree(const allocator_type& __a)
: __begin_node_(__iter_pointer()),
__pair1_(__default_init_tag(), __node_allocator(__a)),
- __pair3_(0, __default_init_tag())
-{
- __begin_node() = __end_node();
+ __pair3_(0, __default_init_tag()) {
+ __begin_node() = __end_node();
}
template <class _Tp, class _Compare, class _Allocator>
-__tree<_Tp, _Compare, _Allocator>::__tree(const value_compare& __comp,
- const allocator_type& __a)
- : __begin_node_(__iter_pointer()),
- __pair1_(__default_init_tag(), __node_allocator(__a)),
- __pair3_(0, __comp)
-{
- __begin_node() = __end_node();
+__tree<_Tp, _Compare, _Allocator>::__tree(const value_compare& __comp, const allocator_type& __a)
+ : __begin_node_(__iter_pointer()), __pair1_(__default_init_tag(), __node_allocator(__a)), __pair3_(0, __comp) {
+ __begin_node() = __end_node();
}
// Precondition: size() != 0
template <class _Tp, class _Compare, class _Allocator>
typename __tree<_Tp, _Compare, _Allocator>::__node_pointer
-__tree<_Tp, _Compare, _Allocator>::_DetachedTreeCache::__detach_from_tree(__tree *__t) _NOEXCEPT
-{
- __node_pointer __cache = static_cast<__node_pointer>(__t->__begin_node());
- __t->__begin_node() = __t->__end_node();
- __t->__end_node()->__left_->__parent_ = nullptr;
- __t->__end_node()->__left_ = nullptr;
- __t->size() = 0;
- // __cache->__left_ == nullptr
- if (__cache->__right_ != nullptr)
- __cache = static_cast<__node_pointer>(__cache->__right_);
- // __cache->__left_ == nullptr
- // __cache->__right_ == nullptr
- return __cache;
+__tree<_Tp, _Compare, _Allocator>::_DetachedTreeCache::__detach_from_tree(__tree* __t) _NOEXCEPT {
+ __node_pointer __cache = static_cast<__node_pointer>(__t->__begin_node());
+ __t->__begin_node() = __t->__end_node();
+ __t->__end_node()->__left_->__parent_ = nullptr;
+ __t->__end_node()->__left_ = nullptr;
+ __t->size() = 0;
+ // __cache->__left_ == nullptr
+ if (__cache->__right_ != nullptr)
+ __cache = static_cast<__node_pointer>(__cache->__right_);
+ // __cache->__left_ == nullptr
+ // __cache->__right_ == nullptr
+ return __cache;
}
// Precondition: __cache != nullptr
@@ -1599,259 +1372,214 @@ __tree<_Tp, _Compare, _Allocator>::_DetachedTreeCache::__detach_from_tree(__tree
// This is no longer a red-black tree
template <class _Tp, class _Compare, class _Allocator>
typename __tree<_Tp, _Compare, _Allocator>::__node_pointer
-__tree<_Tp, _Compare, _Allocator>::_DetachedTreeCache::__detach_next(__node_pointer __cache) _NOEXCEPT
-{
- if (__cache->__parent_ == nullptr)
- return nullptr;
- if (std::__tree_is_left_child(static_cast<__node_base_pointer>(__cache)))
- {
- __cache->__parent_->__left_ = nullptr;
- __cache = static_cast<__node_pointer>(__cache->__parent_);
- if (__cache->__right_ == nullptr)
- return __cache;
- return static_cast<__node_pointer>(std::__tree_leaf(__cache->__right_));
- }
- // __cache is right child
- __cache->__parent_unsafe()->__right_ = nullptr;
- __cache = static_cast<__node_pointer>(__cache->__parent_);
- if (__cache->__left_ == nullptr)
- return __cache;
- return static_cast<__node_pointer>(std::__tree_leaf(__cache->__left_));
+__tree<_Tp, _Compare, _Allocator>::_DetachedTreeCache::__detach_next(__node_pointer __cache) _NOEXCEPT {
+ if (__cache->__parent_ == nullptr)
+ return nullptr;
+ if (std::__tree_is_left_child(static_cast<__node_base_pointer>(__cache))) {
+ __cache->__parent_->__left_ = nullptr;
+ __cache = static_cast<__node_pointer>(__cache->__parent_);
+ if (__cache->__right_ == nullptr)
+ return __cache;
+ return static_cast<__node_pointer>(std::__tree_leaf(__cache->__right_));
+ }
+ // __cache is right child
+ __cache->__parent_unsafe()->__right_ = nullptr;
+ __cache = static_cast<__node_pointer>(__cache->__parent_);
+ if (__cache->__left_ == nullptr)
+ return __cache;
+ return static_cast<__node_pointer>(std::__tree_leaf(__cache->__left_));
}
template <class _Tp, class _Compare, class _Allocator>
-__tree<_Tp, _Compare, _Allocator>&
-__tree<_Tp, _Compare, _Allocator>::operator=(const __tree& __t)
-{
- if (this != std::addressof(__t))
- {
- value_comp() = __t.value_comp();
- __copy_assign_alloc(__t);
- __assign_multi(__t.begin(), __t.end());
- }
- return *this;
+__tree<_Tp, _Compare, _Allocator>& __tree<_Tp, _Compare, _Allocator>::operator=(const __tree& __t) {
+ if (this != std::addressof(__t)) {
+ value_comp() = __t.value_comp();
+ __copy_assign_alloc(__t);
+ __assign_multi(__t.begin(), __t.end());
+ }
+ return *this;
}
template <class _Tp, class _Compare, class _Allocator>
template <class _ForwardIterator>
-void
-__tree<_Tp, _Compare, _Allocator>::__assign_unique(_ForwardIterator __first, _ForwardIterator __last)
-{
- typedef iterator_traits<_ForwardIterator> _ITraits;
- typedef typename _ITraits::value_type _ItValueType;
- static_assert((is_same<_ItValueType, __container_value_type>::value),
- "__assign_unique may only be called with the containers value type");
- static_assert(__has_forward_iterator_category<_ForwardIterator>::value,
- "__assign_unique requires a forward iterator");
- if (size() != 0)
- {
- _DetachedTreeCache __cache(this);
- for (; __cache.__get() != nullptr && __first != __last; ++__first) {
- if (__node_assign_unique(*__first, __cache.__get()).second)
- __cache.__advance();
- }
+void __tree<_Tp, _Compare, _Allocator>::__assign_unique(_ForwardIterator __first, _ForwardIterator __last) {
+ typedef iterator_traits<_ForwardIterator> _ITraits;
+ typedef typename _ITraits::value_type _ItValueType;
+ static_assert((is_same<_ItValueType, __container_value_type>::value),
+ "__assign_unique may only be called with the containers value type");
+ static_assert(
+ __has_forward_iterator_category<_ForwardIterator>::value, "__assign_unique requires a forward iterator");
+ if (size() != 0) {
+ _DetachedTreeCache __cache(this);
+ for (; __cache.__get() != nullptr && __first != __last; ++__first) {
+ if (__node_assign_unique(*__first, __cache.__get()).second)
+ __cache.__advance();
}
- for (; __first != __last; ++__first)
- __insert_unique(*__first);
+ }
+ for (; __first != __last; ++__first)
+ __insert_unique(*__first);
}
template <class _Tp, class _Compare, class _Allocator>
template <class _InputIterator>
-void
-__tree<_Tp, _Compare, _Allocator>::__assign_multi(_InputIterator __first, _InputIterator __last)
-{
- typedef iterator_traits<_InputIterator> _ITraits;
- typedef typename _ITraits::value_type _ItValueType;
- static_assert((is_same<_ItValueType, __container_value_type>::value ||
- is_same<_ItValueType, __node_value_type>::value),
- "__assign_multi may only be called with the containers value type"
- " or the nodes value type");
- if (size() != 0)
- {
- _DetachedTreeCache __cache(this);
- for (; __cache.__get() && __first != __last; ++__first) {
- __cache.__get()->__value_ = *__first;
- __node_insert_multi(__cache.__get());
- __cache.__advance();
- }
+void __tree<_Tp, _Compare, _Allocator>::__assign_multi(_InputIterator __first, _InputIterator __last) {
+ typedef iterator_traits<_InputIterator> _ITraits;
+ typedef typename _ITraits::value_type _ItValueType;
+ static_assert(
+ (is_same<_ItValueType, __container_value_type>::value || is_same<_ItValueType, __node_value_type>::value),
+ "__assign_multi may only be called with the containers value type"
+ " or the nodes value type");
+ if (size() != 0) {
+ _DetachedTreeCache __cache(this);
+ for (; __cache.__get() && __first != __last; ++__first) {
+ __cache.__get()->__value_ = *__first;
+ __node_insert_multi(__cache.__get());
+ __cache.__advance();
}
- for (; __first != __last; ++__first)
- __insert_multi(_NodeTypes::__get_value(*__first));
+ }
+ for (; __first != __last; ++__first)
+ __insert_multi(_NodeTypes::__get_value(*__first));
}
template <class _Tp, class _Compare, class _Allocator>
__tree<_Tp, _Compare, _Allocator>::__tree(const __tree& __t)
: __begin_node_(__iter_pointer()),
__pair1_(__default_init_tag(), __node_traits::select_on_container_copy_construction(__t.__node_alloc())),
- __pair3_(0, __t.value_comp())
-{
- __begin_node() = __end_node();
+ __pair3_(0, __t.value_comp()) {
+ __begin_node() = __end_node();
}
template <class _Tp, class _Compare, class _Allocator>
-__tree<_Tp, _Compare, _Allocator>::__tree(__tree&& __t)
- _NOEXCEPT_(
- is_nothrow_move_constructible<__node_allocator>::value &&
- is_nothrow_move_constructible<value_compare>::value)
+__tree<_Tp, _Compare, _Allocator>::__tree(__tree&& __t) _NOEXCEPT_(
+ is_nothrow_move_constructible<__node_allocator>::value&& is_nothrow_move_constructible<value_compare>::value)
: __begin_node_(std::move(__t.__begin_node_)),
__pair1_(std::move(__t.__pair1_)),
- __pair3_(std::move(__t.__pair3_))
-{
- if (size() == 0)
- __begin_node() = __end_node();
- else
- {
- __end_node()->__left_->__parent_ = static_cast<__parent_pointer>(__end_node());
- __t.__begin_node() = __t.__end_node();
- __t.__end_node()->__left_ = nullptr;
- __t.size() = 0;
- }
+ __pair3_(std::move(__t.__pair3_)) {
+ if (size() == 0)
+ __begin_node() = __end_node();
+ else {
+ __end_node()->__left_->__parent_ = static_cast<__parent_pointer>(__end_node());
+ __t.__begin_node() = __t.__end_node();
+ __t.__end_node()->__left_ = nullptr;
+ __t.size() = 0;
+ }
}
template <class _Tp, class _Compare, class _Allocator>
__tree<_Tp, _Compare, _Allocator>::__tree(__tree&& __t, const allocator_type& __a)
- : __pair1_(__default_init_tag(), __node_allocator(__a)),
- __pair3_(0, std::move(__t.value_comp()))
-{
- if (__a == __t.__alloc())
- {
- if (__t.size() == 0)
- __begin_node() = __end_node();
- else
- {
- __begin_node() = __t.__begin_node();
- __end_node()->__left_ = __t.__end_node()->__left_;
- __end_node()->__left_->__parent_ = static_cast<__parent_pointer>(__end_node());
- size() = __t.size();
- __t.__begin_node() = __t.__end_node();
- __t.__end_node()->__left_ = nullptr;
- __t.size() = 0;
- }
- }
- else
- {
- __begin_node() = __end_node();
- }
+ : __pair1_(__default_init_tag(), __node_allocator(__a)), __pair3_(0, std::move(__t.value_comp())) {
+ if (__a == __t.__alloc()) {
+ if (__t.size() == 0)
+ __begin_node() = __end_node();
+ else {
+ __begin_node() = __t.__begin_node();
+ __end_node()->__left_ = __t.__end_node()->__left_;
+ __end_node()->__left_->__parent_ = static_cast<__parent_pointer>(__end_node());
+ size() = __t.size();
+ __t.__begin_node() = __t.__end_node();
+ __t.__end_node()->__left_ = nullptr;
+ __t.size() = 0;
+ }
+ } else {
+ __begin_node() = __end_node();
+ }
}
template <class _Tp, class _Compare, class _Allocator>
-void
-__tree<_Tp, _Compare, _Allocator>::__move_assign(__tree& __t, true_type)
- _NOEXCEPT_(is_nothrow_move_assignable<value_compare>::value &&
- is_nothrow_move_assignable<__node_allocator>::value)
-{
- destroy(static_cast<__node_pointer>(__end_node()->__left_));
- __begin_node_ = __t.__begin_node_;
- __pair1_.first() = __t.__pair1_.first();
- __move_assign_alloc(__t);
- __pair3_ = std::move(__t.__pair3_);
- if (size() == 0)
- __begin_node() = __end_node();
- else
- {
- __end_node()->__left_->__parent_ = static_cast<__parent_pointer>(__end_node());
- __t.__begin_node() = __t.__end_node();
- __t.__end_node()->__left_ = nullptr;
- __t.size() = 0;
- }
+void __tree<_Tp, _Compare, _Allocator>::__move_assign(__tree& __t, true_type)
+ _NOEXCEPT_(is_nothrow_move_assignable<value_compare>::value&& is_nothrow_move_assignable<__node_allocator>::value) {
+ destroy(static_cast<__node_pointer>(__end_node()->__left_));
+ __begin_node_ = __t.__begin_node_;
+ __pair1_.first() = __t.__pair1_.first();
+ __move_assign_alloc(__t);
+ __pair3_ = std::move(__t.__pair3_);
+ if (size() == 0)
+ __begin_node() = __end_node();
+ else {
+ __end_node()->__left_->__parent_ = static_cast<__parent_pointer>(__end_node());
+ __t.__begin_node() = __t.__end_node();
+ __t.__end_node()->__left_ = nullptr;
+ __t.size() = 0;
+ }
}
template <class _Tp, class _Compare, class _Allocator>
-void
-__tree<_Tp, _Compare, _Allocator>::__move_assign(__tree& __t, false_type)
-{
- if (__node_alloc() == __t.__node_alloc())
- __move_assign(__t, true_type());
- else
- {
- value_comp() = std::move(__t.value_comp());
- const_iterator __e = end();
- if (size() != 0)
- {
- _DetachedTreeCache __cache(this);
- while (__cache.__get() != nullptr && __t.size() != 0) {
- __cache.__get()->__value_ = std::move(__t.remove(__t.begin())->__value_);
- __node_insert_multi(__cache.__get());
- __cache.__advance();
- }
- }
- while (__t.size() != 0)
- __insert_multi(__e, _NodeTypes::__move(__t.remove(__t.begin())->__value_));
+void __tree<_Tp, _Compare, _Allocator>::__move_assign(__tree& __t, false_type) {
+ if (__node_alloc() == __t.__node_alloc())
+ __move_assign(__t, true_type());
+ else {
+ value_comp() = std::move(__t.value_comp());
+ const_iterator __e = end();
+ if (size() != 0) {
+ _DetachedTreeCache __cache(this);
+ while (__cache.__get() != nullptr && __t.size() != 0) {
+ __cache.__get()->__value_ = std::move(__t.remove(__t.begin())->__value_);
+ __node_insert_multi(__cache.__get());
+ __cache.__advance();
+ }
}
+ while (__t.size() != 0)
+ __insert_multi(__e, _NodeTypes::__move(__t.remove(__t.begin())->__value_));
+ }
}
template <class _Tp, class _Compare, class _Allocator>
-__tree<_Tp, _Compare, _Allocator>&
-__tree<_Tp, _Compare, _Allocator>::operator=(__tree&& __t)
- _NOEXCEPT_(
- __node_traits::propagate_on_container_move_assignment::value &&
- is_nothrow_move_assignable<value_compare>::value &&
+__tree<_Tp, _Compare, _Allocator>& __tree<_Tp, _Compare, _Allocator>::operator=(__tree&& __t) _NOEXCEPT_(
+ __node_traits::propagate_on_container_move_assignment::value&& is_nothrow_move_assignable<value_compare>::value&&
is_nothrow_move_assignable<__node_allocator>::value)
{
- __move_assign(__t, integral_constant<bool,
- __node_traits::propagate_on_container_move_assignment::value>());
- return *this;
+ __move_assign(__t, integral_constant<bool, __node_traits::propagate_on_container_move_assignment::value>());
+ return *this;
}
template <class _Tp, class _Compare, class _Allocator>
-__tree<_Tp, _Compare, _Allocator>::~__tree()
-{
- static_assert((is_copy_constructible<value_compare>::value),
- "Comparator must be copy-constructible.");
+__tree<_Tp, _Compare, _Allocator>::~__tree() {
+ static_assert((is_copy_constructible<value_compare>::value), "Comparator must be copy-constructible.");
destroy(__root());
}
template <class _Tp, class _Compare, class _Allocator>
-void
-__tree<_Tp, _Compare, _Allocator>::destroy(__node_pointer __nd) _NOEXCEPT
-{
- if (__nd != nullptr)
- {
- destroy(static_cast<__node_pointer>(__nd->__left_));
- destroy(static_cast<__node_pointer>(__nd->__right_));
- __node_allocator& __na = __node_alloc();
- __node_traits::destroy(__na, _NodeTypes::__get_ptr(__nd->__value_));
- __node_traits::deallocate(__na, __nd, 1);
- }
+void __tree<_Tp, _Compare, _Allocator>::destroy(__node_pointer __nd) _NOEXCEPT {
+ if (__nd != nullptr) {
+ destroy(static_cast<__node_pointer>(__nd->__left_));
+ destroy(static_cast<__node_pointer>(__nd->__right_));
+ __node_allocator& __na = __node_alloc();
+ __node_traits::destroy(__na, _NodeTypes::__get_ptr(__nd->__value_));
+ __node_traits::deallocate(__na, __nd, 1);
+ }
}
template <class _Tp, class _Compare, class _Allocator>
-void
-__tree<_Tp, _Compare, _Allocator>::swap(__tree& __t)
+void __tree<_Tp, _Compare, _Allocator>::swap(__tree& __t)
#if _LIBCPP_STD_VER <= 11
- _NOEXCEPT_(
- __is_nothrow_swappable<value_compare>::value
- && (!__node_traits::propagate_on_container_swap::value ||
- __is_nothrow_swappable<__node_allocator>::value)
- )
+ _NOEXCEPT_(__is_nothrow_swappable<value_compare>::value &&
+ (!__node_traits::propagate_on_container_swap::value || __is_nothrow_swappable<__node_allocator>::value))
#else
- _NOEXCEPT_(__is_nothrow_swappable<value_compare>::value)
+ _NOEXCEPT_(__is_nothrow_swappable<value_compare>::value)
#endif
{
- using std::swap;
- swap(__begin_node_, __t.__begin_node_);
- swap(__pair1_.first(), __t.__pair1_.first());
- std::__swap_allocator(__node_alloc(), __t.__node_alloc());
- __pair3_.swap(__t.__pair3_);
- if (size() == 0)
- __begin_node() = __end_node();
- else
- __end_node()->__left_->__parent_ = static_cast<__parent_pointer>(__end_node());
- if (__t.size() == 0)
- __t.__begin_node() = __t.__end_node();
- else
- __t.__end_node()->__left_->__parent_ = static_cast<__parent_pointer>(__t.__end_node());
+ using std::swap;
+ swap(__begin_node_, __t.__begin_node_);
+ swap(__pair1_.first(), __t.__pair1_.first());
+ std::__swap_allocator(__node_alloc(), __t.__node_alloc());
+ __pair3_.swap(__t.__pair3_);
+ if (size() == 0)
+ __begin_node() = __end_node();
+ else
+ __end_node()->__left_->__parent_ = static_cast<__parent_pointer>(__end_node());
+ if (__t.size() == 0)
+ __t.__begin_node() = __t.__end_node();
+ else
+ __t.__end_node()->__left_->__parent_ = static_cast<__parent_pointer>(__t.__end_node());
}
template <class _Tp, class _Compare, class _Allocator>
-void
-__tree<_Tp, _Compare, _Allocator>::clear() _NOEXCEPT
-{
- destroy(__root());
- size() = 0;
- __begin_node() = __end_node();
- __end_node()->__left_ = nullptr;
+void __tree<_Tp, _Compare, _Allocator>::clear() _NOEXCEPT {
+ destroy(__root());
+ size() = 0;
+ __begin_node() = __end_node();
+ __end_node()->__left_ = nullptr;
}
// Find lower_bound place to insert
@@ -1859,38 +1587,29 @@ __tree<_Tp, _Compare, _Allocator>::clear() _NOEXCEPT
// Return reference to null leaf
template <class _Tp, class _Compare, class _Allocator>
typename __tree<_Tp, _Compare, _Allocator>::__node_base_pointer&
-__tree<_Tp, _Compare, _Allocator>::__find_leaf_low(__parent_pointer& __parent,
- const key_type& __v)
-{
- __node_pointer __nd = __root();
- if (__nd != nullptr)
- {
- while (true)
- {
- if (value_comp()(__nd->__value_, __v))
- {
- if (__nd->__right_ != nullptr)
- __nd = static_cast<__node_pointer>(__nd->__right_);
- else
- {
- __parent = static_cast<__parent_pointer>(__nd);
- return __nd->__right_;
- }
- }
- else
- {
- if (__nd->__left_ != nullptr)
- __nd = static_cast<__node_pointer>(__nd->__left_);
- else
- {
- __parent = static_cast<__parent_pointer>(__nd);
- return __parent->__left_;
- }
- }
+__tree<_Tp, _Compare, _Allocator>::__find_leaf_low(__parent_pointer& __parent, const key_type& __v) {
+ __node_pointer __nd = __root();
+ if (__nd != nullptr) {
+ while (true) {
+ if (value_comp()(__nd->__value_, __v)) {
+ if (__nd->__right_ != nullptr)
+ __nd = static_cast<__node_pointer>(__nd->__right_);
+ else {
+ __parent = static_cast<__parent_pointer>(__nd);
+ return __nd->__right_;
}
+ } else {
+ if (__nd->__left_ != nullptr)
+ __nd = static_cast<__node_pointer>(__nd->__left_);
+ else {
+ __parent = static_cast<__parent_pointer>(__nd);
+ return __parent->__left_;
+ }
+ }
}
- __parent = static_cast<__parent_pointer>(__end_node());
- return __parent->__left_;
+ }
+ __parent = static_cast<__parent_pointer>(__end_node());
+ return __parent->__left_;
}
// Find upper_bound place to insert
@@ -1898,38 +1617,29 @@ __tree<_Tp, _Compare, _Allocator>::__find_leaf_low(__parent_pointer& __parent,
// Return reference to null leaf
template <class _Tp, class _Compare, class _Allocator>
typename __tree<_Tp, _Compare, _Allocator>::__node_base_pointer&
-__tree<_Tp, _Compare, _Allocator>::__find_leaf_high(__parent_pointer& __parent,
- const key_type& __v)
-{
- __node_pointer __nd = __root();
- if (__nd != nullptr)
- {
- while (true)
- {
- if (value_comp()(__v, __nd->__value_))
- {
- if (__nd->__left_ != nullptr)
- __nd = static_cast<__node_pointer>(__nd->__left_);
- else
- {
- __parent = static_cast<__parent_pointer>(__nd);
- return __parent->__left_;
- }
- }
- else
- {
- if (__nd->__right_ != nullptr)
- __nd = static_cast<__node_pointer>(__nd->__right_);
- else
- {
- __parent = static_cast<__parent_pointer>(__nd);
- return __nd->__right_;
- }
- }
+__tree<_Tp, _Compare, _Allocator>::__find_leaf_high(__parent_pointer& __parent, const key_type& __v) {
+ __node_pointer __nd = __root();
+ if (__nd != nullptr) {
+ while (true) {
+ if (value_comp()(__v, __nd->__value_)) {
+ if (__nd->__left_ != nullptr)
+ __nd = static_cast<__node_pointer>(__nd->__left_);
+ else {
+ __parent = static_cast<__parent_pointer>(__nd);
+ return __parent->__left_;
+ }
+ } else {
+ if (__nd->__right_ != nullptr)
+ __nd = static_cast<__node_pointer>(__nd->__right_);
+ else {
+ __parent = static_cast<__parent_pointer>(__nd);
+ return __nd->__right_;
}
+ }
}
- __parent = static_cast<__parent_pointer>(__end_node());
- return __parent->__left_;
+ }
+ __parent = static_cast<__parent_pointer>(__end_node());
+ return __parent->__left_;
}
// Find leaf place to insert closest to __hint
@@ -1940,33 +1650,26 @@ __tree<_Tp, _Compare, _Allocator>::__find_leaf_high(__parent_pointer& __parent,
// Return reference to null leaf
template <class _Tp, class _Compare, class _Allocator>
typename __tree<_Tp, _Compare, _Allocator>::__node_base_pointer&
-__tree<_Tp, _Compare, _Allocator>::__find_leaf(const_iterator __hint,
- __parent_pointer& __parent,
- const key_type& __v)
-{
- if (__hint == end() || !value_comp()(*__hint, __v)) // check before
- {
- // __v <= *__hint
- const_iterator __prior = __hint;
- if (__prior == begin() || !value_comp()(__v, *--__prior))
- {
- // *prev(__hint) <= __v <= *__hint
- if (__hint.__ptr_->__left_ == nullptr)
- {
- __parent = static_cast<__parent_pointer>(__hint.__ptr_);
- return __parent->__left_;
- }
- else
- {
- __parent = static_cast<__parent_pointer>(__prior.__ptr_);
- return static_cast<__node_base_pointer>(__prior.__ptr_)->__right_;
- }
- }
- // __v < *prev(__hint)
- return __find_leaf_high(__parent, __v);
+__tree<_Tp, _Compare, _Allocator>::__find_leaf(const_iterator __hint, __parent_pointer& __parent, const key_type& __v) {
+ if (__hint == end() || !value_comp()(*__hint, __v)) // check before
+ {
+ // __v <= *__hint
+ const_iterator __prior = __hint;
+ if (__prior == begin() || !value_comp()(__v, *--__prior)) {
+ // *prev(__hint) <= __v <= *__hint
+ if (__hint.__ptr_->__left_ == nullptr) {
+ __parent = static_cast<__parent_pointer>(__hint.__ptr_);
+ return __parent->__left_;
+ } else {
+ __parent = static_cast<__parent_pointer>(__prior.__ptr_);
+ return static_cast<__node_base_pointer>(__prior.__ptr_)->__right_;
+ }
}
- // else __v > *__hint
- return __find_leaf_low(__parent, __v);
+ // __v < *prev(__hint)
+ return __find_leaf_high(__parent, __v);
+ }
+ // else __v > *__hint
+ return __find_leaf_low(__parent, __v);
}
// Find place to insert if __v doesn't exist
@@ -1976,44 +1679,35 @@ __tree<_Tp, _Compare, _Allocator>::__find_leaf(const_iterator __hint,
template <class _Tp, class _Compare, class _Allocator>
template <class _Key>
typename __tree<_Tp, _Compare, _Allocator>::__node_base_pointer&
-__tree<_Tp, _Compare, _Allocator>::__find_equal(__parent_pointer& __parent,
- const _Key& __v)
-{
- __node_pointer __nd = __root();
- __node_base_pointer* __nd_ptr = __root_ptr();
- if (__nd != nullptr)
- {
- while (true)
- {
- if (value_comp()(__v, __nd->__value_))
- {
- if (__nd->__left_ != nullptr) {
- __nd_ptr = std::addressof(__nd->__left_);
- __nd = static_cast<__node_pointer>(__nd->__left_);
- } else {
- __parent = static_cast<__parent_pointer>(__nd);
- return __parent->__left_;
- }
- }
- else if (value_comp()(__nd->__value_, __v))
- {
- if (__nd->__right_ != nullptr) {
- __nd_ptr = std::addressof(__nd->__right_);
- __nd = static_cast<__node_pointer>(__nd->__right_);
- } else {
- __parent = static_cast<__parent_pointer>(__nd);
- return __nd->__right_;
- }
- }
- else
- {
- __parent = static_cast<__parent_pointer>(__nd);
- return *__nd_ptr;
- }
+__tree<_Tp, _Compare, _Allocator>::__find_equal(__parent_pointer& __parent, const _Key& __v) {
+ __node_pointer __nd = __root();
+ __node_base_pointer* __nd_ptr = __root_ptr();
+ if (__nd != nullptr) {
+ while (true) {
+ if (value_comp()(__v, __nd->__value_)) {
+ if (__nd->__left_ != nullptr) {
+ __nd_ptr = std::addressof(__nd->__left_);
+ __nd = static_cast<__node_pointer>(__nd->__left_);
+ } else {
+ __parent = static_cast<__parent_pointer>(__nd);
+ return __parent->__left_;
+ }
+ } else if (value_comp()(__nd->__value_, __v)) {
+ if (__nd->__right_ != nullptr) {
+ __nd_ptr = std::addressof(__nd->__right_);
+ __nd = static_cast<__node_pointer>(__nd->__right_);
+ } else {
+ __parent = static_cast<__parent_pointer>(__nd);
+ return __nd->__right_;
}
+ } else {
+ __parent = static_cast<__parent_pointer>(__nd);
+ return *__nd_ptr;
+ }
}
- __parent = static_cast<__parent_pointer>(__end_node());
- return __parent->__left_;
+ }
+ __parent = static_cast<__parent_pointer>(__end_node());
+ return __parent->__left_;
}
// Find place to insert if __v doesn't exist
@@ -2025,731 +1719,584 @@ __tree<_Tp, _Compare, _Allocator>::__find_equal(__parent_pointer& __parent,
// If __v exists, set parent to node of __v and return reference to node of __v
template <class _Tp, class _Compare, class _Allocator>
template <class _Key>
-typename __tree<_Tp, _Compare, _Allocator>::__node_base_pointer&
-__tree<_Tp, _Compare, _Allocator>::__find_equal(const_iterator __hint,
- __parent_pointer& __parent,
- __node_base_pointer& __dummy,
- const _Key& __v)
-{
- if (__hint == end() || value_comp()(__v, *__hint)) // check before
- {
- // __v < *__hint
- const_iterator __prior = __hint;
- if (__prior == begin() || value_comp()(*--__prior, __v))
- {
- // *prev(__hint) < __v < *__hint
- if (__hint.__ptr_->__left_ == nullptr)
- {
- __parent = static_cast<__parent_pointer>(__hint.__ptr_);
- return __parent->__left_;
- }
- else
- {
- __parent = static_cast<__parent_pointer>(__prior.__ptr_);
- return static_cast<__node_base_pointer>(__prior.__ptr_)->__right_;
- }
- }
- // __v <= *prev(__hint)
- return __find_equal(__parent, __v);
+typename __tree<_Tp, _Compare, _Allocator>::__node_base_pointer& __tree<_Tp, _Compare, _Allocator>::__find_equal(
+ const_iterator __hint, __parent_pointer& __parent, __node_base_pointer& __dummy, const _Key& __v) {
+ if (__hint == end() || value_comp()(__v, *__hint)) // check before
+ {
+ // __v < *__hint
+ const_iterator __prior = __hint;
+ if (__prior == begin() || value_comp()(*--__prior, __v)) {
+ // *prev(__hint) < __v < *__hint
+ if (__hint.__ptr_->__left_ == nullptr) {
+ __parent = static_cast<__parent_pointer>(__hint.__ptr_);
+ return __parent->__left_;
+ } else {
+ __parent = static_cast<__parent_pointer>(__prior.__ptr_);
+ return static_cast<__node_base_pointer>(__prior.__ptr_)->__right_;
+ }
}
- else if (value_comp()(*__hint, __v)) // check after
- {
- // *__hint < __v
- const_iterator __next = std::next(__hint);
- if (__next == end() || value_comp()(__v, *__next))
- {
- // *__hint < __v < *std::next(__hint)
- if (__hint.__get_np()->__right_ == nullptr)
- {
- __parent = static_cast<__parent_pointer>(__hint.__ptr_);
- return static_cast<__node_base_pointer>(__hint.__ptr_)->__right_;
- }
- else
- {
- __parent = static_cast<__parent_pointer>(__next.__ptr_);
- return __parent->__left_;
- }
- }
- // *next(__hint) <= __v
- return __find_equal(__parent, __v);
+ // __v <= *prev(__hint)
+ return __find_equal(__parent, __v);
+ } else if (value_comp()(*__hint, __v)) // check after
+ {
+ // *__hint < __v
+ const_iterator __next = std::next(__hint);
+ if (__next == end() || value_comp()(__v, *__next)) {
+ // *__hint < __v < *std::next(__hint)
+ if (__hint.__get_np()->__right_ == nullptr) {
+ __parent = static_cast<__parent_pointer>(__hint.__ptr_);
+ return static_cast<__node_base_pointer>(__hint.__ptr_)->__right_;
+ } else {
+ __parent = static_cast<__parent_pointer>(__next.__ptr_);
+ return __parent->__left_;
+ }
}
- // else __v == *__hint
- __parent = static_cast<__parent_pointer>(__hint.__ptr_);
- __dummy = static_cast<__node_base_pointer>(__hint.__ptr_);
- return __dummy;
+ // *next(__hint) <= __v
+ return __find_equal(__parent, __v);
+ }
+ // else __v == *__hint
+ __parent = static_cast<__parent_pointer>(__hint.__ptr_);
+ __dummy = static_cast<__node_base_pointer>(__hint.__ptr_);
+ return __dummy;
}
template <class _Tp, class _Compare, class _Allocator>
void __tree<_Tp, _Compare, _Allocator>::__insert_node_at(
- __parent_pointer __parent, __node_base_pointer& __child,
- __node_base_pointer __new_node) _NOEXCEPT
-{
- __new_node->__left_ = nullptr;
- __new_node->__right_ = nullptr;
- __new_node->__parent_ = __parent;
- // __new_node->__is_black_ is initialized in __tree_balance_after_insert
- __child = __new_node;
- if (__begin_node()->__left_ != nullptr)
- __begin_node() = static_cast<__iter_pointer>(__begin_node()->__left_);
- std::__tree_balance_after_insert(__end_node()->__left_, __child);
- ++size();
+ __parent_pointer __parent, __node_base_pointer& __child, __node_base_pointer __new_node) _NOEXCEPT {
+ __new_node->__left_ = nullptr;
+ __new_node->__right_ = nullptr;
+ __new_node->__parent_ = __parent;
+ // __new_node->__is_black_ is initialized in __tree_balance_after_insert
+ __child = __new_node;
+ if (__begin_node()->__left_ != nullptr)
+ __begin_node() = static_cast<__iter_pointer>(__begin_node()->__left_);
+ std::__tree_balance_after_insert(__end_node()->__left_, __child);
+ ++size();
}
template <class _Tp, class _Compare, class _Allocator>
template <class _Key, class... _Args>
pair<typename __tree<_Tp, _Compare, _Allocator>::iterator, bool>
-__tree<_Tp, _Compare, _Allocator>::__emplace_unique_key_args(_Key const& __k, _Args&&... __args)
-{
- __parent_pointer __parent;
- __node_base_pointer& __child = __find_equal(__parent, __k);
- __node_pointer __r = static_cast<__node_pointer>(__child);
- bool __inserted = false;
- if (__child == nullptr)
- {
- __node_holder __h = __construct_node(std::forward<_Args>(__args)...);
- __insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__h.get()));
- __r = __h.release();
- __inserted = true;
- }
- return pair<iterator, bool>(iterator(__r), __inserted);
+__tree<_Tp, _Compare, _Allocator>::__emplace_unique_key_args(_Key const& __k, _Args&&... __args) {
+ __parent_pointer __parent;
+ __node_base_pointer& __child = __find_equal(__parent, __k);
+ __node_pointer __r = static_cast<__node_pointer>(__child);
+ bool __inserted = false;
+ if (__child == nullptr) {
+ __node_holder __h = __construct_node(std::forward<_Args>(__args)...);
+ __insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__h.get()));
+ __r = __h.release();
+ __inserted = true;
+ }
+ return pair<iterator, bool>(iterator(__r), __inserted);
}
template <class _Tp, class _Compare, class _Allocator>
template <class _Key, class... _Args>
pair<typename __tree<_Tp, _Compare, _Allocator>::iterator, bool>
__tree<_Tp, _Compare, _Allocator>::__emplace_hint_unique_key_args(
- const_iterator __p, _Key const& __k, _Args&&... __args)
-{
- __parent_pointer __parent;
- __node_base_pointer __dummy;
- __node_base_pointer& __child = __find_equal(__p, __parent, __dummy, __k);
- __node_pointer __r = static_cast<__node_pointer>(__child);
- bool __inserted = false;
- if (__child == nullptr)
- {
- __node_holder __h = __construct_node(std::forward<_Args>(__args)...);
- __insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__h.get()));
- __r = __h.release();
- __inserted = true;
- }
- return pair<iterator, bool>(iterator(__r), __inserted);
+ const_iterator __p, _Key const& __k, _Args&&... __args) {
+ __parent_pointer __parent;
+ __node_base_pointer __dummy;
+ __node_base_pointer& __child = __find_equal(__p, __parent, __dummy, __k);
+ __node_pointer __r = static_cast<__node_pointer>(__child);
+ bool __inserted = false;
+ if (__child == nullptr) {
+ __node_holder __h = __construct_node(std::forward<_Args>(__args)...);
+ __insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__h.get()));
+ __r = __h.release();
+ __inserted = true;
+ }
+ return pair<iterator, bool>(iterator(__r), __inserted);
}
template <class _Tp, class _Compare, class _Allocator>
-template <class ..._Args>
+template <class... _Args>
typename __tree<_Tp, _Compare, _Allocator>::__node_holder
-__tree<_Tp, _Compare, _Allocator>::__construct_node(_Args&& ...__args)
-{
- static_assert(!__is_tree_value_type<_Args...>::value,
- "Cannot construct from __value_type");
- __node_allocator& __na = __node_alloc();
- __node_holder __h(__node_traits::allocate(__na, 1), _Dp(__na));
- __node_traits::construct(__na, _NodeTypes::__get_ptr(__h->__value_), std::forward<_Args>(__args)...);
- __h.get_deleter().__value_constructed = true;
- return __h;
+__tree<_Tp, _Compare, _Allocator>::__construct_node(_Args&&... __args) {
+ static_assert(!__is_tree_value_type<_Args...>::value, "Cannot construct from __value_type");
+ __node_allocator& __na = __node_alloc();
+ __node_holder __h(__node_traits::allocate(__na, 1), _Dp(__na));
+ __node_traits::construct(__na, _NodeTypes::__get_ptr(__h->__value_), std::forward<_Args>(__args)...);
+ __h.get_deleter().__value_constructed = true;
+ return __h;
}
-
template <class _Tp, class _Compare, class _Allocator>
template <class... _Args>
pair<typename __tree<_Tp, _Compare, _Allocator>::iterator, bool>
-__tree<_Tp, _Compare, _Allocator>::__emplace_unique_impl(_Args&&... __args)
-{
- __node_holder __h = __construct_node(std::forward<_Args>(__args)...);
- __parent_pointer __parent;
- __node_base_pointer& __child = __find_equal(__parent, __h->__value_);
- __node_pointer __r = static_cast<__node_pointer>(__child);
- bool __inserted = false;
- if (__child == nullptr)
- {
- __insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__h.get()));
- __r = __h.release();
- __inserted = true;
- }
- return pair<iterator, bool>(iterator(__r), __inserted);
+__tree<_Tp, _Compare, _Allocator>::__emplace_unique_impl(_Args&&... __args) {
+ __node_holder __h = __construct_node(std::forward<_Args>(__args)...);
+ __parent_pointer __parent;
+ __node_base_pointer& __child = __find_equal(__parent, __h->__value_);
+ __node_pointer __r = static_cast<__node_pointer>(__child);
+ bool __inserted = false;
+ if (__child == nullptr) {
+ __insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__h.get()));
+ __r = __h.release();
+ __inserted = true;
+ }
+ return pair<iterator, bool>(iterator(__r), __inserted);
}
template <class _Tp, class _Compare, class _Allocator>
template <class... _Args>
typename __tree<_Tp, _Compare, _Allocator>::iterator
-__tree<_Tp, _Compare, _Allocator>::__emplace_hint_unique_impl(const_iterator __p, _Args&&... __args)
-{
- __node_holder __h = __construct_node(std::forward<_Args>(__args)...);
- __parent_pointer __parent;
- __node_base_pointer __dummy;
- __node_base_pointer& __child = __find_equal(__p, __parent, __dummy, __h->__value_);
- __node_pointer __r = static_cast<__node_pointer>(__child);
- if (__child == nullptr)
- {
- __insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__h.get()));
- __r = __h.release();
- }
- return iterator(__r);
+__tree<_Tp, _Compare, _Allocator>::__emplace_hint_unique_impl(const_iterator __p, _Args&&... __args) {
+ __node_holder __h = __construct_node(std::forward<_Args>(__args)...);
+ __parent_pointer __parent;
+ __node_base_pointer __dummy;
+ __node_base_pointer& __child = __find_equal(__p, __parent, __dummy, __h->__value_);
+ __node_pointer __r = static_cast<__node_pointer>(__child);
+ if (__child == nullptr) {
+ __insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__h.get()));
+ __r = __h.release();
+ }
+ return iterator(__r);
}
template <class _Tp, class _Compare, class _Allocator>
template <class... _Args>
typename __tree<_Tp, _Compare, _Allocator>::iterator
-__tree<_Tp, _Compare, _Allocator>::__emplace_multi(_Args&&... __args)
-{
- __node_holder __h = __construct_node(std::forward<_Args>(__args)...);
- __parent_pointer __parent;
- __node_base_pointer& __child = __find_leaf_high(__parent, _NodeTypes::__get_key(__h->__value_));
- __insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__h.get()));
- return iterator(static_cast<__node_pointer>(__h.release()));
+__tree<_Tp, _Compare, _Allocator>::__emplace_multi(_Args&&... __args) {
+ __node_holder __h = __construct_node(std::forward<_Args>(__args)...);
+ __parent_pointer __parent;
+ __node_base_pointer& __child = __find_leaf_high(__parent, _NodeTypes::__get_key(__h->__value_));
+ __insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__h.get()));
+ return iterator(static_cast<__node_pointer>(__h.release()));
}
template <class _Tp, class _Compare, class _Allocator>
template <class... _Args>
typename __tree<_Tp, _Compare, _Allocator>::iterator
-__tree<_Tp, _Compare, _Allocator>::__emplace_hint_multi(const_iterator __p,
- _Args&&... __args)
-{
- __node_holder __h = __construct_node(std::forward<_Args>(__args)...);
- __parent_pointer __parent;
- __node_base_pointer& __child = __find_leaf(__p, __parent, _NodeTypes::__get_key(__h->__value_));
- __insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__h.get()));
- return iterator(static_cast<__node_pointer>(__h.release()));
+__tree<_Tp, _Compare, _Allocator>::__emplace_hint_multi(const_iterator __p, _Args&&... __args) {
+ __node_holder __h = __construct_node(std::forward<_Args>(__args)...);
+ __parent_pointer __parent;
+ __node_base_pointer& __child = __find_leaf(__p, __parent, _NodeTypes::__get_key(__h->__value_));
+ __insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__h.get()));
+ return iterator(static_cast<__node_pointer>(__h.release()));
}
template <class _Tp, class _Compare, class _Allocator>
pair<typename __tree<_Tp, _Compare, _Allocator>::iterator, bool>
-__tree<_Tp, _Compare, _Allocator>::__node_assign_unique(const __container_value_type& __v, __node_pointer __nd)
-{
- __parent_pointer __parent;
- __node_base_pointer& __child = __find_equal(__parent, _NodeTypes::__get_key(__v));
- __node_pointer __r = static_cast<__node_pointer>(__child);
- bool __inserted = false;
- if (__child == nullptr)
- {
- __nd->__value_ = __v;
- __insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__nd));
- __r = __nd;
- __inserted = true;
- }
- return pair<iterator, bool>(iterator(__r), __inserted);
+__tree<_Tp, _Compare, _Allocator>::__node_assign_unique(const __container_value_type& __v, __node_pointer __nd) {
+ __parent_pointer __parent;
+ __node_base_pointer& __child = __find_equal(__parent, _NodeTypes::__get_key(__v));
+ __node_pointer __r = static_cast<__node_pointer>(__child);
+ bool __inserted = false;
+ if (__child == nullptr) {
+ __nd->__value_ = __v;
+ __insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__nd));
+ __r = __nd;
+ __inserted = true;
+ }
+ return pair<iterator, bool>(iterator(__r), __inserted);
}
-
template <class _Tp, class _Compare, class _Allocator>
typename __tree<_Tp, _Compare, _Allocator>::iterator
-__tree<_Tp, _Compare, _Allocator>::__node_insert_multi(__node_pointer __nd)
-{
- __parent_pointer __parent;
- __node_base_pointer& __child = __find_leaf_high(__parent, _NodeTypes::__get_key(__nd->__value_));
- __insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__nd));
- return iterator(__nd);
+__tree<_Tp, _Compare, _Allocator>::__node_insert_multi(__node_pointer __nd) {
+ __parent_pointer __parent;
+ __node_base_pointer& __child = __find_leaf_high(__parent, _NodeTypes::__get_key(__nd->__value_));
+ __insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__nd));
+ return iterator(__nd);
}
template <class _Tp, class _Compare, class _Allocator>
typename __tree<_Tp, _Compare, _Allocator>::iterator
-__tree<_Tp, _Compare, _Allocator>::__node_insert_multi(const_iterator __p,
- __node_pointer __nd)
-{
- __parent_pointer __parent;
- __node_base_pointer& __child = __find_leaf(__p, __parent, _NodeTypes::__get_key(__nd->__value_));
- __insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__nd));
- return iterator(__nd);
+__tree<_Tp, _Compare, _Allocator>::__node_insert_multi(const_iterator __p, __node_pointer __nd) {
+ __parent_pointer __parent;
+ __node_base_pointer& __child = __find_leaf(__p, __parent, _NodeTypes::__get_key(__nd->__value_));
+ __insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__nd));
+ return iterator(__nd);
}
template <class _Tp, class _Compare, class _Allocator>
typename __tree<_Tp, _Compare, _Allocator>::iterator
-__tree<_Tp, _Compare, _Allocator>::__remove_node_pointer(__node_pointer __ptr) _NOEXCEPT
-{
- iterator __r(__ptr);
- ++__r;
- if (__begin_node() == __ptr)
- __begin_node() = __r.__ptr_;
- --size();
- std::__tree_remove(__end_node()->__left_,
- static_cast<__node_base_pointer>(__ptr));
- return __r;
+__tree<_Tp, _Compare, _Allocator>::__remove_node_pointer(__node_pointer __ptr) _NOEXCEPT {
+ iterator __r(__ptr);
+ ++__r;
+ if (__begin_node() == __ptr)
+ __begin_node() = __r.__ptr_;
+ --size();
+ std::__tree_remove(__end_node()->__left_, static_cast<__node_base_pointer>(__ptr));
+ return __r;
}
#if _LIBCPP_STD_VER >= 17
template <class _Tp, class _Compare, class _Allocator>
template <class _NodeHandle, class _InsertReturnType>
-_LIBCPP_HIDE_FROM_ABI
-_InsertReturnType
-__tree<_Tp, _Compare, _Allocator>::__node_handle_insert_unique(
- _NodeHandle&& __nh)
-{
- if (__nh.empty())
- return _InsertReturnType{end(), false, _NodeHandle()};
+_LIBCPP_HIDE_FROM_ABI _InsertReturnType
+__tree<_Tp, _Compare, _Allocator>::__node_handle_insert_unique(_NodeHandle&& __nh) {
+ if (__nh.empty())
+ return _InsertReturnType{end(), false, _NodeHandle()};
- __node_pointer __ptr = __nh.__ptr_;
- __parent_pointer __parent;
- __node_base_pointer& __child = __find_equal(__parent,
- __ptr->__value_);
- if (__child != nullptr)
- return _InsertReturnType{
- iterator(static_cast<__node_pointer>(__child)),
- false, std::move(__nh)};
+ __node_pointer __ptr = __nh.__ptr_;
+ __parent_pointer __parent;
+ __node_base_pointer& __child = __find_equal(__parent, __ptr->__value_);
+ if (__child != nullptr)
+ return _InsertReturnType{iterator(static_cast<__node_pointer>(__child)), false, std::move(__nh)};
- __insert_node_at(__parent, __child,
- static_cast<__node_base_pointer>(__ptr));
- __nh.__release_ptr();
- return _InsertReturnType{iterator(__ptr), true, _NodeHandle()};
+ __insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__ptr));
+ __nh.__release_ptr();
+ return _InsertReturnType{iterator(__ptr), true, _NodeHandle()};
}
template <class _Tp, class _Compare, class _Allocator>
template <class _NodeHandle>
-_LIBCPP_HIDE_FROM_ABI
-typename __tree<_Tp, _Compare, _Allocator>::iterator
-__tree<_Tp, _Compare, _Allocator>::__node_handle_insert_unique(
- const_iterator __hint, _NodeHandle&& __nh)
-{
- if (__nh.empty())
- return end();
+_LIBCPP_HIDE_FROM_ABI typename __tree<_Tp, _Compare, _Allocator>::iterator
+__tree<_Tp, _Compare, _Allocator>::__node_handle_insert_unique(const_iterator __hint, _NodeHandle&& __nh) {
+ if (__nh.empty())
+ return end();
- __node_pointer __ptr = __nh.__ptr_;
- __parent_pointer __parent;
- __node_base_pointer __dummy;
- __node_base_pointer& __child = __find_equal(__hint, __parent, __dummy,
- __ptr->__value_);
- __node_pointer __r = static_cast<__node_pointer>(__child);
- if (__child == nullptr)
- {
- __insert_node_at(__parent, __child,
- static_cast<__node_base_pointer>(__ptr));
- __r = __ptr;
- __nh.__release_ptr();
- }
- return iterator(__r);
+ __node_pointer __ptr = __nh.__ptr_;
+ __parent_pointer __parent;
+ __node_base_pointer __dummy;
+ __node_base_pointer& __child = __find_equal(__hint, __parent, __dummy, __ptr->__value_);
+ __node_pointer __r = static_cast<__node_pointer>(__child);
+ if (__child == nullptr) {
+ __insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__ptr));
+ __r = __ptr;
+ __nh.__release_ptr();
+ }
+ return iterator(__r);
}
template <class _Tp, class _Compare, class _Allocator>
template <class _NodeHandle>
-_LIBCPP_HIDE_FROM_ABI
-_NodeHandle
-__tree<_Tp, _Compare, _Allocator>::__node_handle_extract(key_type const& __key)
-{
- iterator __it = find(__key);
- if (__it == end())
- return _NodeHandle();
- return __node_handle_extract<_NodeHandle>(__it);
+_LIBCPP_HIDE_FROM_ABI _NodeHandle __tree<_Tp, _Compare, _Allocator>::__node_handle_extract(key_type const& __key) {
+ iterator __it = find(__key);
+ if (__it == end())
+ return _NodeHandle();
+ return __node_handle_extract<_NodeHandle>(__it);
}
template <class _Tp, class _Compare, class _Allocator>
template <class _NodeHandle>
-_LIBCPP_HIDE_FROM_ABI
-_NodeHandle
-__tree<_Tp, _Compare, _Allocator>::__node_handle_extract(const_iterator __p)
-{
- __node_pointer __np = __p.__get_np();
- __remove_node_pointer(__np);
- return _NodeHandle(__np, __alloc());
+_LIBCPP_HIDE_FROM_ABI _NodeHandle __tree<_Tp, _Compare, _Allocator>::__node_handle_extract(const_iterator __p) {
+ __node_pointer __np = __p.__get_np();
+ __remove_node_pointer(__np);
+ return _NodeHandle(__np, __alloc());
}
template <class _Tp, class _Compare, class _Allocator>
template <class _Tree>
-_LIBCPP_HIDE_FROM_ABI
-void
-__tree<_Tp, _Compare, _Allocator>::__node_handle_merge_unique(_Tree& __source)
-{
- static_assert(is_same<typename _Tree::__node_pointer, __node_pointer>::value, "");
-
- for (typename _Tree::iterator __i = __source.begin();
- __i != __source.end();)
- {
- __node_pointer __src_ptr = __i.__get_np();
- __parent_pointer __parent;
- __node_base_pointer& __child =
- __find_equal(__parent, _NodeTypes::__get_key(__src_ptr->__value_));
- ++__i;
- if (__child != nullptr)
- continue;
- __source.__remove_node_pointer(__src_ptr);
- __insert_node_at(__parent, __child,
- static_cast<__node_base_pointer>(__src_ptr));
- }
+_LIBCPP_HIDE_FROM_ABI void __tree<_Tp, _Compare, _Allocator>::__node_handle_merge_unique(_Tree& __source) {
+ static_assert(is_same<typename _Tree::__node_pointer, __node_pointer>::value, "");
+
+ for (typename _Tree::iterator __i = __source.begin(); __i != __source.end();) {
+ __node_pointer __src_ptr = __i.__get_np();
+ __parent_pointer __parent;
+ __node_base_pointer& __child = __find_equal(__parent, _NodeTypes::__get_key(__src_ptr->__value_));
+ ++__i;
+ if (__child != nullptr)
+ continue;
+ __source.__remove_node_pointer(__src_ptr);
+ __insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__src_ptr));
+ }
}
template <class _Tp, class _Compare, class _Allocator>
template <class _NodeHandle>
-_LIBCPP_HIDE_FROM_ABI
-typename __tree<_Tp, _Compare, _Allocator>::iterator
-__tree<_Tp, _Compare, _Allocator>::__node_handle_insert_multi(_NodeHandle&& __nh)
-{
- if (__nh.empty())
- return end();
- __node_pointer __ptr = __nh.__ptr_;
- __parent_pointer __parent;
- __node_base_pointer& __child = __find_leaf_high(
- __parent, _NodeTypes::__get_key(__ptr->__value_));
- __insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__ptr));
- __nh.__release_ptr();
- return iterator(__ptr);
+_LIBCPP_HIDE_FROM_ABI typename __tree<_Tp, _Compare, _Allocator>::iterator
+__tree<_Tp, _Compare, _Allocator>::__node_handle_insert_multi(_NodeHandle&& __nh) {
+ if (__nh.empty())
+ return end();
+ __node_pointer __ptr = __nh.__ptr_;
+ __parent_pointer __parent;
+ __node_base_pointer& __child = __find_leaf_high(__parent, _NodeTypes::__get_key(__ptr->__value_));
+ __insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__ptr));
+ __nh.__release_ptr();
+ return iterator(__ptr);
}
template <class _Tp, class _Compare, class _Allocator>
template <class _NodeHandle>
-_LIBCPP_HIDE_FROM_ABI
-typename __tree<_Tp, _Compare, _Allocator>::iterator
-__tree<_Tp, _Compare, _Allocator>::__node_handle_insert_multi(
- const_iterator __hint, _NodeHandle&& __nh)
-{
- if (__nh.empty())
- return end();
+_LIBCPP_HIDE_FROM_ABI typename __tree<_Tp, _Compare, _Allocator>::iterator
+__tree<_Tp, _Compare, _Allocator>::__node_handle_insert_multi(const_iterator __hint, _NodeHandle&& __nh) {
+ if (__nh.empty())
+ return end();
- __node_pointer __ptr = __nh.__ptr_;
- __parent_pointer __parent;
- __node_base_pointer& __child = __find_leaf(__hint, __parent,
- _NodeTypes::__get_key(__ptr->__value_));
- __insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__ptr));
- __nh.__release_ptr();
- return iterator(__ptr);
+ __node_pointer __ptr = __nh.__ptr_;
+ __parent_pointer __parent;
+ __node_base_pointer& __child = __find_leaf(__hint, __parent, _NodeTypes::__get_key(__ptr->__value_));
+ __insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__ptr));
+ __nh.__release_ptr();
+ return iterator(__ptr);
}
template <class _Tp, class _Compare, class _Allocator>
template <class _Tree>
-_LIBCPP_HIDE_FROM_ABI
-void
-__tree<_Tp, _Compare, _Allocator>::__node_handle_merge_multi(_Tree& __source)
-{
- static_assert(is_same<typename _Tree::__node_pointer, __node_pointer>::value, "");
-
- for (typename _Tree::iterator __i = __source.begin();
- __i != __source.end();)
- {
- __node_pointer __src_ptr = __i.__get_np();
- __parent_pointer __parent;
- __node_base_pointer& __child = __find_leaf_high(
- __parent, _NodeTypes::__get_key(__src_ptr->__value_));
- ++__i;
- __source.__remove_node_pointer(__src_ptr);
- __insert_node_at(__parent, __child,
- static_cast<__node_base_pointer>(__src_ptr));
- }
+_LIBCPP_HIDE_FROM_ABI void __tree<_Tp, _Compare, _Allocator>::__node_handle_merge_multi(_Tree& __source) {
+ static_assert(is_same<typename _Tree::__node_pointer, __node_pointer>::value, "");
+
+ for (typename _Tree::iterator __i = __source.begin(); __i != __source.end();) {
+ __node_pointer __src_ptr = __i.__get_np();
+ __parent_pointer __parent;
+ __node_base_pointer& __child = __find_leaf_high(__parent, _NodeTypes::__get_key(__src_ptr->__value_));
+ ++__i;
+ __source.__remove_node_pointer(__src_ptr);
+ __insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__src_ptr));
+ }
}
#endif // _LIBCPP_STD_VER >= 17
template <class _Tp, class _Compare, class _Allocator>
-typename __tree<_Tp, _Compare, _Allocator>::iterator
-__tree<_Tp, _Compare, _Allocator>::erase(const_iterator __p)
-{
- __node_pointer __np = __p.__get_np();
- iterator __r = __remove_node_pointer(__np);
- __node_allocator& __na = __node_alloc();
- __node_traits::destroy(__na, _NodeTypes::__get_ptr(
- const_cast<__node_value_type&>(*__p)));
- __node_traits::deallocate(__na, __np, 1);
- return __r;
+typename __tree<_Tp, _Compare, _Allocator>::iterator __tree<_Tp, _Compare, _Allocator>::erase(const_iterator __p) {
+ __node_pointer __np = __p.__get_np();
+ iterator __r = __remove_node_pointer(__np);
+ __node_allocator& __na = __node_alloc();
+ __node_traits::destroy(__na, _NodeTypes::__get_ptr(const_cast<__node_value_type&>(*__p)));
+ __node_traits::deallocate(__na, __np, 1);
+ return __r;
}
template <class _Tp, class _Compare, class _Allocator>
typename __tree<_Tp, _Compare, _Allocator>::iterator
-__tree<_Tp, _Compare, _Allocator>::erase(const_iterator __f, const_iterator __l)
-{
- while (__f != __l)
- __f = erase(__f);
- return iterator(__l.__ptr_);
+__tree<_Tp, _Compare, _Allocator>::erase(const_iterator __f, const_iterator __l) {
+ while (__f != __l)
+ __f = erase(__f);
+ return iterator(__l.__ptr_);
}
template <class _Tp, class _Compare, class _Allocator>
template <class _Key>
typename __tree<_Tp, _Compare, _Allocator>::size_type
-__tree<_Tp, _Compare, _Allocator>::__erase_unique(const _Key& __k)
-{
- iterator __i = find(__k);
- if (__i == end())
- return 0;
- erase(__i);
- return 1;
+__tree<_Tp, _Compare, _Allocator>::__erase_unique(const _Key& __k) {
+ iterator __i = find(__k);
+ if (__i == end())
+ return 0;
+ erase(__i);
+ return 1;
}
template <class _Tp, class _Compare, class _Allocator>
template <class _Key>
typename __tree<_Tp, _Compare, _Allocator>::size_type
-__tree<_Tp, _Compare, _Allocator>::__erase_multi(const _Key& __k)
-{
- pair<iterator, iterator> __p = __equal_range_multi(__k);
- size_type __r = 0;
- for (; __p.first != __p.second; ++__r)
- __p.first = erase(__p.first);
- return __r;
+__tree<_Tp, _Compare, _Allocator>::__erase_multi(const _Key& __k) {
+ pair<iterator, iterator> __p = __equal_range_multi(__k);
+ size_type __r = 0;
+ for (; __p.first != __p.second; ++__r)
+ __p.first = erase(__p.first);
+ return __r;
}
template <class _Tp, class _Compare, class _Allocator>
template <class _Key>
-typename __tree<_Tp, _Compare, _Allocator>::iterator
-__tree<_Tp, _Compare, _Allocator>::find(const _Key& __v)
-{
- iterator __p = __lower_bound(__v, __root(), __end_node());
- if (__p != end() && !value_comp()(__v, *__p))
- return __p;
- return end();
+typename __tree<_Tp, _Compare, _Allocator>::iterator __tree<_Tp, _Compare, _Allocator>::find(const _Key& __v) {
+ iterator __p = __lower_bound(__v, __root(), __end_node());
+ if (__p != end() && !value_comp()(__v, *__p))
+ return __p;
+ return end();
}
template <class _Tp, class _Compare, class _Allocator>
template <class _Key>
typename __tree<_Tp, _Compare, _Allocator>::const_iterator
-__tree<_Tp, _Compare, _Allocator>::find(const _Key& __v) const
-{
- const_iterator __p = __lower_bound(__v, __root(), __end_node());
- if (__p != end() && !value_comp()(__v, *__p))
- return __p;
- return end();
+__tree<_Tp, _Compare, _Allocator>::find(const _Key& __v) const {
+ const_iterator __p = __lower_bound(__v, __root(), __end_node());
+ if (__p != end() && !value_comp()(__v, *__p))
+ return __p;
+ return end();
}
template <class _Tp, class _Compare, class _Allocator>
template <class _Key>
typename __tree<_Tp, _Compare, _Allocator>::size_type
-__tree<_Tp, _Compare, _Allocator>::__count_unique(const _Key& __k) const
-{
- __node_pointer __rt = __root();
- while (__rt != nullptr)
- {
- if (value_comp()(__k, __rt->__value_))
- {
- __rt = static_cast<__node_pointer>(__rt->__left_);
- }
- else if (value_comp()(__rt->__value_, __k))
- __rt = static_cast<__node_pointer>(__rt->__right_);
- else
- return 1;
- }
- return 0;
+__tree<_Tp, _Compare, _Allocator>::__count_unique(const _Key& __k) const {
+ __node_pointer __rt = __root();
+ while (__rt != nullptr) {
+ if (value_comp()(__k, __rt->__value_)) {
+ __rt = static_cast<__node_pointer>(__rt->__left_);
+ } else if (value_comp()(__rt->__value_, __k))
+ __rt = static_cast<__node_pointer>(__rt->__right_);
+ else
+ return 1;
+ }
+ return 0;
}
template <class _Tp, class _Compare, class _Allocator>
template <class _Key>
typename __tree<_Tp, _Compare, _Allocator>::size_type
-__tree<_Tp, _Compare, _Allocator>::__count_multi(const _Key& __k) const
-{
- __iter_pointer __result = __end_node();
- __node_pointer __rt = __root();
- while (__rt != nullptr)
- {
- if (value_comp()(__k, __rt->__value_))
- {
- __result = static_cast<__iter_pointer>(__rt);
- __rt = static_cast<__node_pointer>(__rt->__left_);
- }
- else if (value_comp()(__rt->__value_, __k))
- __rt = static_cast<__node_pointer>(__rt->__right_);
- else
- return std::distance(
- __lower_bound(__k, static_cast<__node_pointer>(__rt->__left_), static_cast<__iter_pointer>(__rt)),
- __upper_bound(__k, static_cast<__node_pointer>(__rt->__right_), __result)
- );
- }
- return 0;
+__tree<_Tp, _Compare, _Allocator>::__count_multi(const _Key& __k) const {
+ __iter_pointer __result = __end_node();
+ __node_pointer __rt = __root();
+ while (__rt != nullptr) {
+ if (value_comp()(__k, __rt->__value_)) {
+ __result = static_cast<__iter_pointer>(__rt);
+ __rt = static_cast<__node_pointer>(__rt->__left_);
+ } else if (value_comp()(__rt->__value_, __k))
+ __rt = static_cast<__node_pointer>(__rt->__right_);
+ else
+ return std::distance(
+ __lower_bound(__k, static_cast<__node_pointer>(__rt->__left_), static_cast<__iter_pointer>(__rt)),
+ __upper_bound(__k, static_cast<__node_pointer>(__rt->__right_), __result));
+ }
+ return 0;
}
template <class _Tp, class _Compare, class _Allocator>
template <class _Key>
typename __tree<_Tp, _Compare, _Allocator>::iterator
-__tree<_Tp, _Compare, _Allocator>::__lower_bound(const _Key& __v,
- __node_pointer __root,
- __iter_pointer __result)
-{
- while (__root != nullptr)
- {
- if (!value_comp()(__root->__value_, __v))
- {
- __result = static_cast<__iter_pointer>(__root);
- __root = static_cast<__node_pointer>(__root->__left_);
- }
- else
- __root = static_cast<__node_pointer>(__root->__right_);
- }
- return iterator(__result);
+__tree<_Tp, _Compare, _Allocator>::__lower_bound(const _Key& __v, __node_pointer __root, __iter_pointer __result) {
+ while (__root != nullptr) {
+ if (!value_comp()(__root->__value_, __v)) {
+ __result = static_cast<__iter_pointer>(__root);
+ __root = static_cast<__node_pointer>(__root->__left_);
+ } else
+ __root = static_cast<__node_pointer>(__root->__right_);
+ }
+ return iterator(__result);
}
template <class _Tp, class _Compare, class _Allocator>
template <class _Key>
-typename __tree<_Tp, _Compare, _Allocator>::const_iterator
-__tree<_Tp, _Compare, _Allocator>::__lower_bound(const _Key& __v,
- __node_pointer __root,
- __iter_pointer __result) const
-{
- while (__root != nullptr)
- {
- if (!value_comp()(__root->__value_, __v))
- {
- __result = static_cast<__iter_pointer>(__root);
- __root = static_cast<__node_pointer>(__root->__left_);
- }
- else
- __root = static_cast<__node_pointer>(__root->__right_);
- }
- return const_iterator(__result);
+typename __tree<_Tp, _Compare, _Allocator>::const_iterator __tree<_Tp, _Compare, _Allocator>::__lower_bound(
+ const _Key& __v, __node_pointer __root, __iter_pointer __result) const {
+ while (__root != nullptr) {
+ if (!value_comp()(__root->__value_, __v)) {
+ __result = static_cast<__iter_pointer>(__root);
+ __root = static_cast<__node_pointer>(__root->__left_);
+ } else
+ __root = static_cast<__node_pointer>(__root->__right_);
+ }
+ return const_iterator(__result);
}
template <class _Tp, class _Compare, class _Allocator>
template <class _Key>
typename __tree<_Tp, _Compare, _Allocator>::iterator
-__tree<_Tp, _Compare, _Allocator>::__upper_bound(const _Key& __v,
- __node_pointer __root,
- __iter_pointer __result)
-{
- while (__root != nullptr)
- {
- if (value_comp()(__v, __root->__value_))
- {
- __result = static_cast<__iter_pointer>(__root);
- __root = static_cast<__node_pointer>(__root->__left_);
- }
- else
- __root = static_cast<__node_pointer>(__root->__right_);
- }
- return iterator(__result);
+__tree<_Tp, _Compare, _Allocator>::__upper_bound(const _Key& __v, __node_pointer __root, __iter_pointer __result) {
+ while (__root != nullptr) {
+ if (value_comp()(__v, __root->__value_)) {
+ __result = static_cast<__iter_pointer>(__root);
+ __root = static_cast<__node_pointer>(__root->__left_);
+ } else
+ __root = static_cast<__node_pointer>(__root->__right_);
+ }
+ return iterator(__result);
}
template <class _Tp, class _Compare, class _Allocator>
template <class _Key>
-typename __tree<_Tp, _Compare, _Allocator>::const_iterator
-__tree<_Tp, _Compare, _Allocator>::__upper_bound(const _Key& __v,
- __node_pointer __root,
- __iter_pointer __result) const
-{
- while (__root != nullptr)
- {
- if (value_comp()(__v, __root->__value_))
- {
- __result = static_cast<__iter_pointer>(__root);
- __root = static_cast<__node_pointer>(__root->__left_);
- }
- else
- __root = static_cast<__node_pointer>(__root->__right_);
- }
- return const_iterator(__result);
+typename __tree<_Tp, _Compare, _Allocator>::const_iterator __tree<_Tp, _Compare, _Allocator>::__upper_bound(
+ const _Key& __v, __node_pointer __root, __iter_pointer __result) const {
+ while (__root != nullptr) {
+ if (value_comp()(__v, __root->__value_)) {
+ __result = static_cast<__iter_pointer>(__root);
+ __root = static_cast<__node_pointer>(__root->__left_);
+ } else
+ __root = static_cast<__node_pointer>(__root->__right_);
+ }
+ return const_iterator(__result);
}
template <class _Tp, class _Compare, class _Allocator>
template <class _Key>
-pair<typename __tree<_Tp, _Compare, _Allocator>::iterator,
- typename __tree<_Tp, _Compare, _Allocator>::iterator>
-__tree<_Tp, _Compare, _Allocator>::__equal_range_unique(const _Key& __k)
-{
- typedef pair<iterator, iterator> _Pp;
- __iter_pointer __result = __end_node();
- __node_pointer __rt = __root();
- while (__rt != nullptr)
- {
- if (value_comp()(__k, __rt->__value_))
- {
- __result = static_cast<__iter_pointer>(__rt);
- __rt = static_cast<__node_pointer>(__rt->__left_);
- }
- else if (value_comp()(__rt->__value_, __k))
- __rt = static_cast<__node_pointer>(__rt->__right_);
- else
- return _Pp(iterator(__rt),
- iterator(
- __rt->__right_ != nullptr ?
- static_cast<__iter_pointer>(std::__tree_min(__rt->__right_))
- : __result));
- }
- return _Pp(iterator(__result), iterator(__result));
+pair<typename __tree<_Tp, _Compare, _Allocator>::iterator, typename __tree<_Tp, _Compare, _Allocator>::iterator>
+__tree<_Tp, _Compare, _Allocator>::__equal_range_unique(const _Key& __k) {
+ typedef pair<iterator, iterator> _Pp;
+ __iter_pointer __result = __end_node();
+ __node_pointer __rt = __root();
+ while (__rt != nullptr) {
+ if (value_comp()(__k, __rt->__value_)) {
+ __result = static_cast<__iter_pointer>(__rt);
+ __rt = static_cast<__node_pointer>(__rt->__left_);
+ } else if (value_comp()(__rt->__value_, __k))
+ __rt = static_cast<__node_pointer>(__rt->__right_);
+ else
+ return _Pp(iterator(__rt),
+ iterator(__rt->__right_ != nullptr ? static_cast<__iter_pointer>(std::__tree_min(__rt->__right_))
+ : __result));
+ }
+ return _Pp(iterator(__result), iterator(__result));
}
template <class _Tp, class _Compare, class _Allocator>
template <class _Key>
pair<typename __tree<_Tp, _Compare, _Allocator>::const_iterator,
typename __tree<_Tp, _Compare, _Allocator>::const_iterator>
-__tree<_Tp, _Compare, _Allocator>::__equal_range_unique(const _Key& __k) const
-{
- typedef pair<const_iterator, const_iterator> _Pp;
- __iter_pointer __result = __end_node();
- __node_pointer __rt = __root();
- while (__rt != nullptr)
- {
- if (value_comp()(__k, __rt->__value_))
- {
- __result = static_cast<__iter_pointer>(__rt);
- __rt = static_cast<__node_pointer>(__rt->__left_);
- }
- else if (value_comp()(__rt->__value_, __k))
- __rt = static_cast<__node_pointer>(__rt->__right_);
- else
- return _Pp(const_iterator(__rt),
- const_iterator(
- __rt->__right_ != nullptr ?
- static_cast<__iter_pointer>(std::__tree_min(__rt->__right_))
- : __result));
- }
- return _Pp(const_iterator(__result), const_iterator(__result));
+__tree<_Tp, _Compare, _Allocator>::__equal_range_unique(const _Key& __k) const {
+ typedef pair<const_iterator, const_iterator> _Pp;
+ __iter_pointer __result = __end_node();
+ __node_pointer __rt = __root();
+ while (__rt != nullptr) {
+ if (value_comp()(__k, __rt->__value_)) {
+ __result = static_cast<__iter_pointer>(__rt);
+ __rt = static_cast<__node_pointer>(__rt->__left_);
+ } else if (value_comp()(__rt->__value_, __k))
+ __rt = static_cast<__node_pointer>(__rt->__right_);
+ else
+ return _Pp(
+ const_iterator(__rt),
+ const_iterator(
+ __rt->__right_ != nullptr ? static_cast<__iter_pointer>(std::__tree_min(__rt->__right_)) : __result));
+ }
+ return _Pp(const_iterator(__result), const_iterator(__result));
}
template <class _Tp, class _Compare, class _Allocator>
template <class _Key>
-pair<typename __tree<_Tp, _Compare, _Allocator>::iterator,
- typename __tree<_Tp, _Compare, _Allocator>::iterator>
-__tree<_Tp, _Compare, _Allocator>::__equal_range_multi(const _Key& __k)
-{
- typedef pair<iterator, iterator> _Pp;
- __iter_pointer __result = __end_node();
- __node_pointer __rt = __root();
- while (__rt != nullptr)
- {
- if (value_comp()(__k, __rt->__value_))
- {
- __result = static_cast<__iter_pointer>(__rt);
- __rt = static_cast<__node_pointer>(__rt->__left_);
- }
- else if (value_comp()(__rt->__value_, __k))
- __rt = static_cast<__node_pointer>(__rt->__right_);
- else
- return _Pp(__lower_bound(__k, static_cast<__node_pointer>(__rt->__left_), static_cast<__iter_pointer>(__rt)),
- __upper_bound(__k, static_cast<__node_pointer>(__rt->__right_), __result));
- }
- return _Pp(iterator(__result), iterator(__result));
+pair<typename __tree<_Tp, _Compare, _Allocator>::iterator, typename __tree<_Tp, _Compare, _Allocator>::iterator>
+__tree<_Tp, _Compare, _Allocator>::__equal_range_multi(const _Key& __k) {
+ typedef pair<iterator, iterator> _Pp;
+ __iter_pointer __result = __end_node();
+ __node_pointer __rt = __root();
+ while (__rt != nullptr) {
+ if (value_comp()(__k, __rt->__value_)) {
+ __result = static_cast<__iter_pointer>(__rt);
+ __rt = static_cast<__node_pointer>(__rt->__left_);
+ } else if (value_comp()(__rt->__value_, __k))
+ __rt = static_cast<__node_pointer>(__rt->__right_);
+ else
+ return _Pp(__lower_bound(__k, static_cast<__node_pointer>(__rt->__left_), static_cast<__iter_pointer>(__rt)),
+ __upper_bound(__k, static_cast<__node_pointer>(__rt->__right_), __result));
+ }
+ return _Pp(iterator(__result), iterator(__result));
}
template <class _Tp, class _Compare, class _Allocator>
template <class _Key>
pair<typename __tree<_Tp, _Compare, _Allocator>::const_iterator,
typename __tree<_Tp, _Compare, _Allocator>::const_iterator>
-__tree<_Tp, _Compare, _Allocator>::__equal_range_multi(const _Key& __k) const
-{
- typedef pair<const_iterator, const_iterator> _Pp;
- __iter_pointer __result = __end_node();
- __node_pointer __rt = __root();
- while (__rt != nullptr)
- {
- if (value_comp()(__k, __rt->__value_))
- {
- __result = static_cast<__iter_pointer>(__rt);
- __rt = static_cast<__node_pointer>(__rt->__left_);
- }
- else if (value_comp()(__rt->__value_, __k))
- __rt = static_cast<__node_pointer>(__rt->__right_);
- else
- return _Pp(__lower_bound(__k, static_cast<__node_pointer>(__rt->__left_), static_cast<__iter_pointer>(__rt)),
- __upper_bound(__k, static_cast<__node_pointer>(__rt->__right_), __result));
- }
- return _Pp(const_iterator(__result), const_iterator(__result));
+__tree<_Tp, _Compare, _Allocator>::__equal_range_multi(const _Key& __k) const {
+ typedef pair<const_iterator, const_iterator> _Pp;
+ __iter_pointer __result = __end_node();
+ __node_pointer __rt = __root();
+ while (__rt != nullptr) {
+ if (value_comp()(__k, __rt->__value_)) {
+ __result = static_cast<__iter_pointer>(__rt);
+ __rt = static_cast<__node_pointer>(__rt->__left_);
+ } else if (value_comp()(__rt->__value_, __k))
+ __rt = static_cast<__node_pointer>(__rt->__right_);
+ else
+ return _Pp(__lower_bound(__k, static_cast<__node_pointer>(__rt->__left_), static_cast<__iter_pointer>(__rt)),
+ __upper_bound(__k, static_cast<__node_pointer>(__rt->__right_), __result));
+ }
+ return _Pp(const_iterator(__result), const_iterator(__result));
}
template <class _Tp, class _Compare, class _Allocator>
typename __tree<_Tp, _Compare, _Allocator>::__node_holder
-__tree<_Tp, _Compare, _Allocator>::remove(const_iterator __p) _NOEXCEPT
-{
- __node_pointer __np = __p.__get_np();
- if (__begin_node() == __p.__ptr_)
- {
- if (__np->__right_ != nullptr)
- __begin_node() = static_cast<__iter_pointer>(__np->__right_);
- else
- __begin_node() = static_cast<__iter_pointer>(__np->__parent_);
- }
- --size();
- std::__tree_remove(__end_node()->__left_,
- static_cast<__node_base_pointer>(__np));
- return __node_holder(__np, _Dp(__node_alloc(), true));
+__tree<_Tp, _Compare, _Allocator>::remove(const_iterator __p) _NOEXCEPT {
+ __node_pointer __np = __p.__get_np();
+ if (__begin_node() == __p.__ptr_) {
+ if (__np->__right_ != nullptr)
+ __begin_node() = static_cast<__iter_pointer>(__np->__right_);
+ else
+ __begin_node() = static_cast<__iter_pointer>(__np->__parent_);
+ }
+ --size();
+ std::__tree_remove(__end_node()->__left_, static_cast<__node_base_pointer>(__np));
+ return __node_holder(__np, _Dp(__node_alloc(), true));
}
template <class _Tp, class _Compare, class _Allocator>
-inline _LIBCPP_HIDE_FROM_ABI
-void
-swap(__tree<_Tp, _Compare, _Allocator>& __x,
- __tree<_Tp, _Compare, _Allocator>& __y)
- _NOEXCEPT_(_NOEXCEPT_(__x.swap(__y)))
-{
- __x.swap(__y);
+inline _LIBCPP_HIDE_FROM_ABI void swap(__tree<_Tp, _Compare, _Allocator>& __x, __tree<_Tp, _Compare, _Allocator>& __y)
+ _NOEXCEPT_(_NOEXCEPT_(__x.swap(__y))) {
+ __x.swap(__y);
}
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__tuple/make_tuple_types.h b/contrib/llvm-project/libcxx/include/__tuple/make_tuple_types.h
index aee2bde89c7f..43161b17cfa3 100644
--- a/contrib/llvm-project/libcxx/include/__tuple/make_tuple_types.h
+++ b/contrib/llvm-project/libcxx/include/__tuple/make_tuple_types.h
@@ -37,14 +37,14 @@ _LIBCPP_BEGIN_NAMESPACE_STD
template <class _TupleTypes, class _TupleIndices>
struct __make_tuple_types_flat;
-template <template <class...> class _Tuple, class ..._Types, size_t ..._Idx>
+template <template <class...> class _Tuple, class... _Types, size_t... _Idx>
struct __make_tuple_types_flat<_Tuple<_Types...>, __tuple_indices<_Idx...>> {
// Specialization for pair, tuple, and __tuple_types
template <class _Tp>
using __apply_quals _LIBCPP_NODEBUG = __tuple_types<__apply_cv_t<_Tp, __type_pack_element<_Idx, _Types...>>...>;
};
-template <class _Vt, size_t _Np, size_t ..._Idx>
+template <class _Vt, size_t _Np, size_t... _Idx>
struct __make_tuple_types_flat<array<_Vt, _Np>, __tuple_indices<_Idx...>> {
template <size_t>
using __value_type = _Vt;
@@ -52,23 +52,23 @@ struct __make_tuple_types_flat<array<_Vt, _Np>, __tuple_indices<_Idx...>> {
using __apply_quals = __tuple_types<__apply_cv_t<_Tp, __value_type<_Idx>>...>;
};
-template <class _Tp, size_t _Ep = tuple_size<__libcpp_remove_reference_t<_Tp> >::value,
- size_t _Sp = 0,
+template <class _Tp,
+ size_t _Ep = tuple_size<__libcpp_remove_reference_t<_Tp> >::value,
+ size_t _Sp = 0,
bool _SameSize = (_Ep == tuple_size<__libcpp_remove_reference_t<_Tp> >::value)>
-struct __make_tuple_types
-{
- static_assert(_Sp <= _Ep, "__make_tuple_types input error");
- using _RawTp = __remove_cv_t<__libcpp_remove_reference_t<_Tp> >;
- using _Maker = __make_tuple_types_flat<_RawTp, typename __make_tuple_indices<_Ep, _Sp>::type>;
- using type = typename _Maker::template __apply_quals<_Tp>;
+struct __make_tuple_types {
+ static_assert(_Sp <= _Ep, "__make_tuple_types input error");
+ using _RawTp = __remove_cv_t<__libcpp_remove_reference_t<_Tp> >;
+ using _Maker = __make_tuple_types_flat<_RawTp, typename __make_tuple_indices<_Ep, _Sp>::type>;
+ using type = typename _Maker::template __apply_quals<_Tp>;
};
-template <class ..._Types, size_t _Ep>
+template <class... _Types, size_t _Ep>
struct __make_tuple_types<tuple<_Types...>, _Ep, 0, true> {
typedef _LIBCPP_NODEBUG __tuple_types<_Types...> type;
};
-template <class ..._Types, size_t _Ep>
+template <class... _Types, size_t _Ep>
struct __make_tuple_types<__tuple_types<_Types...>, _Ep, 0, true> {
typedef _LIBCPP_NODEBUG __tuple_types<_Types...> type;
};
diff --git a/contrib/llvm-project/libcxx/include/__tuple/sfinae_helpers.h b/contrib/llvm-project/libcxx/include/__tuple/sfinae_helpers.h
index 2fffac9efda1..b57f2a4c2e75 100644
--- a/contrib/llvm-project/libcxx/include/__tuple/sfinae_helpers.h
+++ b/contrib/llvm-project/libcxx/include/__tuple/sfinae_helpers.h
@@ -34,17 +34,16 @@ _LIBCPP_BEGIN_NAMESPACE_STD
#ifndef _LIBCPP_CXX03_LANG
-template <bool ..._Preds>
+template <bool... _Preds>
struct __all_dummy;
-template <bool ..._Pred>
+template <bool... _Pred>
struct __all : _IsSame<__all_dummy<_Pred...>, __all_dummy<((void)_Pred, true)...>> {};
struct __tuple_sfinae_base {
- template <template <class, class...> class _Trait,
- class ..._LArgs, class ..._RArgs>
+ template <template <class, class...> class _Trait, class... _LArgs, class... _RArgs>
static auto __do_test(__tuple_types<_LArgs...>, __tuple_types<_RArgs...>)
- -> __all<__enable_if_t<_Trait<_LArgs, _RArgs>::value, bool>{true}...>;
+ -> __all<__enable_if_t<_Trait<_LArgs, _RArgs>::value, bool>{true}...>;
template <template <class...> class>
static auto __do_test(...) -> false_type;
@@ -58,66 +57,63 @@ struct __tuple_sfinae_base {
// __tuple_convertible
-template <class _Tp, class _Up, bool = __tuple_like_ext<__libcpp_remove_reference_t<_Tp> >::value,
- bool = __tuple_like_ext<_Up>::value>
-struct __tuple_convertible
- : public false_type {};
+template <class _Tp,
+ class _Up,
+ bool = __tuple_like_ext<__libcpp_remove_reference_t<_Tp> >::value,
+ bool = __tuple_like_ext<_Up>::value>
+struct __tuple_convertible : public false_type {};
template <class _Tp, class _Up>
struct __tuple_convertible<_Tp, _Up, true, true>
- : public __tuple_sfinae_base::__convertible<
- typename __make_tuple_types<_Tp>::type
- , typename __make_tuple_types<_Up>::type
- >
-{};
+ : public __tuple_sfinae_base::__convertible< typename __make_tuple_types<_Tp>::type,
+ typename __make_tuple_types<_Up>::type > {};
// __tuple_constructible
-template <class _Tp, class _Up, bool = __tuple_like_ext<__libcpp_remove_reference_t<_Tp> >::value,
- bool = __tuple_like_ext<_Up>::value>
-struct __tuple_constructible
- : public false_type {};
+template <class _Tp,
+ class _Up,
+ bool = __tuple_like_ext<__libcpp_remove_reference_t<_Tp> >::value,
+ bool = __tuple_like_ext<_Up>::value>
+struct __tuple_constructible : public false_type {};
template <class _Tp, class _Up>
struct __tuple_constructible<_Tp, _Up, true, true>
- : public __tuple_sfinae_base::__constructible<
- typename __make_tuple_types<_Tp>::type
- , typename __make_tuple_types<_Up>::type
- >
-{};
+ : public __tuple_sfinae_base::__constructible< typename __make_tuple_types<_Tp>::type,
+ typename __make_tuple_types<_Up>::type > {};
// __tuple_assignable
-template <class _Tp, class _Up, bool = __tuple_like_ext<__libcpp_remove_reference_t<_Tp> >::value,
- bool = __tuple_like_ext<_Up>::value>
-struct __tuple_assignable
- : public false_type {};
+template <class _Tp,
+ class _Up,
+ bool = __tuple_like_ext<__libcpp_remove_reference_t<_Tp> >::value,
+ bool = __tuple_like_ext<_Up>::value>
+struct __tuple_assignable : public false_type {};
template <class _Tp, class _Up>
struct __tuple_assignable<_Tp, _Up, true, true>
- : public __tuple_sfinae_base::__assignable<
- typename __make_tuple_types<_Tp>::type
- , typename __make_tuple_types<_Up&>::type
- >
-{};
+ : public __tuple_sfinae_base::__assignable< typename __make_tuple_types<_Tp>::type,
+ typename __make_tuple_types<_Up&>::type > {};
-
-template <size_t _Ip, class ..._Tp>
-struct _LIBCPP_TEMPLATE_VIS tuple_element<_Ip, tuple<_Tp...> >
-{
- typedef _LIBCPP_NODEBUG typename tuple_element<_Ip, __tuple_types<_Tp...> >::type type;
+template <size_t _Ip, class... _Tp>
+struct _LIBCPP_TEMPLATE_VIS tuple_element<_Ip, tuple<_Tp...> > {
+ typedef _LIBCPP_NODEBUG typename tuple_element<_Ip, __tuple_types<_Tp...> >::type type;
};
struct _LIBCPP_EXPORTED_FROM_ABI __check_tuple_constructor_fail {
-
- static _LIBCPP_HIDE_FROM_ABI constexpr bool __enable_explicit_default() { return false; }
- static _LIBCPP_HIDE_FROM_ABI constexpr bool __enable_implicit_default() { return false; }
- template <class ...>
- static _LIBCPP_HIDE_FROM_ABI constexpr bool __enable_explicit() { return false; }
- template <class ...>
- static _LIBCPP_HIDE_FROM_ABI constexpr bool __enable_implicit() { return false; }
- template <class ...>
- static _LIBCPP_HIDE_FROM_ABI constexpr bool __enable_assign() { return false; }
+ static _LIBCPP_HIDE_FROM_ABI constexpr bool __enable_explicit_default() { return false; }
+ static _LIBCPP_HIDE_FROM_ABI constexpr bool __enable_implicit_default() { return false; }
+ template <class...>
+ static _LIBCPP_HIDE_FROM_ABI constexpr bool __enable_explicit() {
+ return false;
+ }
+ template <class...>
+ static _LIBCPP_HIDE_FROM_ABI constexpr bool __enable_implicit() {
+ return false;
+ }
+ template <class...>
+ static _LIBCPP_HIDE_FROM_ABI constexpr bool __enable_assign() {
+ return false;
+ }
};
#endif // !defined(_LIBCPP_CXX03_LANG)
@@ -127,54 +123,54 @@ template <bool _CanCopy, bool _CanMove>
struct __sfinae_ctor_base {};
template <>
struct __sfinae_ctor_base<false, false> {
- __sfinae_ctor_base() = default;
- __sfinae_ctor_base(__sfinae_ctor_base const&) = delete;
- __sfinae_ctor_base(__sfinae_ctor_base &&) = delete;
+ __sfinae_ctor_base() = default;
+ __sfinae_ctor_base(__sfinae_ctor_base const&) = delete;
+ __sfinae_ctor_base(__sfinae_ctor_base&&) = delete;
__sfinae_ctor_base& operator=(__sfinae_ctor_base const&) = default;
- __sfinae_ctor_base& operator=(__sfinae_ctor_base&&) = default;
+ __sfinae_ctor_base& operator=(__sfinae_ctor_base&&) = default;
};
template <>
struct __sfinae_ctor_base<true, false> {
- __sfinae_ctor_base() = default;
- __sfinae_ctor_base(__sfinae_ctor_base const&) = default;
- __sfinae_ctor_base(__sfinae_ctor_base &&) = delete;
+ __sfinae_ctor_base() = default;
+ __sfinae_ctor_base(__sfinae_ctor_base const&) = default;
+ __sfinae_ctor_base(__sfinae_ctor_base&&) = delete;
__sfinae_ctor_base& operator=(__sfinae_ctor_base const&) = default;
- __sfinae_ctor_base& operator=(__sfinae_ctor_base&&) = default;
+ __sfinae_ctor_base& operator=(__sfinae_ctor_base&&) = default;
};
template <>
struct __sfinae_ctor_base<false, true> {
- __sfinae_ctor_base() = default;
- __sfinae_ctor_base(__sfinae_ctor_base const&) = delete;
- __sfinae_ctor_base(__sfinae_ctor_base &&) = default;
+ __sfinae_ctor_base() = default;
+ __sfinae_ctor_base(__sfinae_ctor_base const&) = delete;
+ __sfinae_ctor_base(__sfinae_ctor_base&&) = default;
__sfinae_ctor_base& operator=(__sfinae_ctor_base const&) = default;
- __sfinae_ctor_base& operator=(__sfinae_ctor_base&&) = default;
+ __sfinae_ctor_base& operator=(__sfinae_ctor_base&&) = default;
};
template <bool _CanCopy, bool _CanMove>
struct __sfinae_assign_base {};
template <>
struct __sfinae_assign_base<false, false> {
- __sfinae_assign_base() = default;
- __sfinae_assign_base(__sfinae_assign_base const&) = default;
- __sfinae_assign_base(__sfinae_assign_base &&) = default;
+ __sfinae_assign_base() = default;
+ __sfinae_assign_base(__sfinae_assign_base const&) = default;
+ __sfinae_assign_base(__sfinae_assign_base&&) = default;
__sfinae_assign_base& operator=(__sfinae_assign_base const&) = delete;
- __sfinae_assign_base& operator=(__sfinae_assign_base&&) = delete;
+ __sfinae_assign_base& operator=(__sfinae_assign_base&&) = delete;
};
template <>
struct __sfinae_assign_base<true, false> {
- __sfinae_assign_base() = default;
- __sfinae_assign_base(__sfinae_assign_base const&) = default;
- __sfinae_assign_base(__sfinae_assign_base &&) = default;
+ __sfinae_assign_base() = default;
+ __sfinae_assign_base(__sfinae_assign_base const&) = default;
+ __sfinae_assign_base(__sfinae_assign_base&&) = default;
__sfinae_assign_base& operator=(__sfinae_assign_base const&) = default;
- __sfinae_assign_base& operator=(__sfinae_assign_base&&) = delete;
+ __sfinae_assign_base& operator=(__sfinae_assign_base&&) = delete;
};
template <>
struct __sfinae_assign_base<false, true> {
- __sfinae_assign_base() = default;
- __sfinae_assign_base(__sfinae_assign_base const&) = default;
- __sfinae_assign_base(__sfinae_assign_base &&) = default;
+ __sfinae_assign_base() = default;
+ __sfinae_assign_base(__sfinae_assign_base const&) = default;
+ __sfinae_assign_base(__sfinae_assign_base&&) = default;
__sfinae_assign_base& operator=(__sfinae_assign_base const&) = delete;
- __sfinae_assign_base& operator=(__sfinae_assign_base&&) = default;
+ __sfinae_assign_base& operator=(__sfinae_assign_base&&) = default;
};
#endif // _LIBCPP_STD_VER >= 17
diff --git a/contrib/llvm-project/libcxx/include/__tuple/tuple_element.h b/contrib/llvm-project/libcxx/include/__tuple/tuple_element.h
index 478dd089d46c..2b9ac6696ca4 100644
--- a/contrib/llvm-project/libcxx/include/__tuple/tuple_element.h
+++ b/contrib/llvm-project/libcxx/include/__tuple/tuple_element.h
@@ -23,68 +23,62 @@
_LIBCPP_BEGIN_NAMESPACE_STD
-template <size_t _Ip, class _Tp> struct _LIBCPP_TEMPLATE_VIS tuple_element;
+template <size_t _Ip, class _Tp>
+struct _LIBCPP_TEMPLATE_VIS tuple_element;
template <size_t _Ip, class _Tp>
-struct _LIBCPP_TEMPLATE_VIS tuple_element<_Ip, const _Tp>
-{
- typedef _LIBCPP_NODEBUG typename add_const<typename tuple_element<_Ip, _Tp>::type>::type type;
+struct _LIBCPP_TEMPLATE_VIS tuple_element<_Ip, const _Tp> {
+ typedef _LIBCPP_NODEBUG typename add_const<typename tuple_element<_Ip, _Tp>::type>::type type;
};
template <size_t _Ip, class _Tp>
-struct _LIBCPP_TEMPLATE_VIS tuple_element<_Ip, volatile _Tp>
-{
- typedef _LIBCPP_NODEBUG typename add_volatile<typename tuple_element<_Ip, _Tp>::type>::type type;
+struct _LIBCPP_TEMPLATE_VIS tuple_element<_Ip, volatile _Tp> {
+ typedef _LIBCPP_NODEBUG typename add_volatile<typename tuple_element<_Ip, _Tp>::type>::type type;
};
template <size_t _Ip, class _Tp>
-struct _LIBCPP_TEMPLATE_VIS tuple_element<_Ip, const volatile _Tp>
-{
- typedef _LIBCPP_NODEBUG typename add_cv<typename tuple_element<_Ip, _Tp>::type>::type type;
+struct _LIBCPP_TEMPLATE_VIS tuple_element<_Ip, const volatile _Tp> {
+ typedef _LIBCPP_NODEBUG typename add_cv<typename tuple_element<_Ip, _Tp>::type>::type type;
};
#ifndef _LIBCPP_CXX03_LANG
-#if !__has_builtin(__type_pack_element)
+# if !__has_builtin(__type_pack_element)
namespace __indexer_detail {
template <size_t _Idx, class _Tp>
-struct __indexed { using type _LIBCPP_NODEBUG = _Tp; };
+struct __indexed {
+ using type _LIBCPP_NODEBUG = _Tp;
+};
-template <class _Types, class _Indexes> struct __indexer;
+template <class _Types, class _Indexes>
+struct __indexer;
-template <class ..._Types, size_t ..._Idx>
-struct __indexer<__tuple_types<_Types...>, __tuple_indices<_Idx...>>
- : __indexed<_Idx, _Types>...
-{};
+template <class... _Types, size_t... _Idx>
+struct __indexer<__tuple_types<_Types...>, __tuple_indices<_Idx...>> : __indexed<_Idx, _Types>... {};
template <size_t _Idx, class _Tp>
__indexed<_Idx, _Tp> __at_index(__indexed<_Idx, _Tp> const&);
} // namespace __indexer_detail
-template <size_t _Idx, class ..._Types>
-using __type_pack_element _LIBCPP_NODEBUG = typename decltype(
- __indexer_detail::__at_index<_Idx>(
- __indexer_detail::__indexer<
- __tuple_types<_Types...>,
- typename __make_tuple_indices<sizeof...(_Types)>::type
- >{})
- )::type;
-#endif
+template <size_t _Idx, class... _Types>
+using __type_pack_element _LIBCPP_NODEBUG = typename decltype(__indexer_detail::__at_index<_Idx>(
+ __indexer_detail::__indexer< __tuple_types<_Types...>,
+ typename __make_tuple_indices<sizeof...(_Types)>::type >{}))::type;
+# endif
-template <size_t _Ip, class ..._Types>
-struct _LIBCPP_TEMPLATE_VIS tuple_element<_Ip, __tuple_types<_Types...> >
-{
- static_assert(_Ip < sizeof...(_Types), "tuple_element index out of range");
- typedef _LIBCPP_NODEBUG __type_pack_element<_Ip, _Types...> type;
+template <size_t _Ip, class... _Types>
+struct _LIBCPP_TEMPLATE_VIS tuple_element<_Ip, __tuple_types<_Types...> > {
+ static_assert(_Ip < sizeof...(_Types), "tuple_element index out of range");
+ typedef _LIBCPP_NODEBUG __type_pack_element<_Ip, _Types...> type;
};
-#if _LIBCPP_STD_VER >= 14
-template <size_t _Ip, class ..._Tp>
-using tuple_element_t _LIBCPP_NODEBUG = typename tuple_element <_Ip, _Tp...>::type;
-#endif
+# if _LIBCPP_STD_VER >= 14
+template <size_t _Ip, class... _Tp>
+using tuple_element_t _LIBCPP_NODEBUG = typename tuple_element<_Ip, _Tp...>::type;
+# endif
#endif // _LIBCPP_CXX03_LANG
diff --git a/contrib/llvm-project/libcxx/include/__tuple/tuple_indices.h b/contrib/llvm-project/libcxx/include/__tuple/tuple_indices.h
index 18666d5948c9..501e711255ec 100644
--- a/contrib/llvm-project/libcxx/include/__tuple/tuple_indices.h
+++ b/contrib/llvm-project/libcxx/include/__tuple/tuple_indices.h
@@ -21,13 +21,13 @@
_LIBCPP_BEGIN_NAMESPACE_STD
-template <size_t...> struct __tuple_indices {};
+template <size_t...>
+struct __tuple_indices {};
template <size_t _Ep, size_t _Sp = 0>
-struct __make_tuple_indices
-{
- static_assert(_Sp <= _Ep, "__make_tuple_indices input error");
- typedef __make_indices_imp<_Ep, _Sp> type;
+struct __make_tuple_indices {
+ static_assert(_Sp <= _Ep, "__make_tuple_indices input error");
+ typedef __make_indices_imp<_Ep, _Sp> type;
};
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__tuple/tuple_like_ext.h b/contrib/llvm-project/libcxx/include/__tuple/tuple_like_ext.h
index 36f5c4896ffe..0cc21e0b75fd 100644
--- a/contrib/llvm-project/libcxx/include/__tuple/tuple_like_ext.h
+++ b/contrib/llvm-project/libcxx/include/__tuple/tuple_like_ext.h
@@ -23,21 +23,29 @@
_LIBCPP_BEGIN_NAMESPACE_STD
-template <class _Tp> struct __tuple_like_ext : false_type {};
+template <class _Tp>
+struct __tuple_like_ext : false_type {};
-template <class _Tp> struct __tuple_like_ext<const _Tp> : public __tuple_like_ext<_Tp> {};
-template <class _Tp> struct __tuple_like_ext<volatile _Tp> : public __tuple_like_ext<_Tp> {};
-template <class _Tp> struct __tuple_like_ext<const volatile _Tp> : public __tuple_like_ext<_Tp> {};
+template <class _Tp>
+struct __tuple_like_ext<const _Tp> : public __tuple_like_ext<_Tp> {};
+template <class _Tp>
+struct __tuple_like_ext<volatile _Tp> : public __tuple_like_ext<_Tp> {};
+template <class _Tp>
+struct __tuple_like_ext<const volatile _Tp> : public __tuple_like_ext<_Tp> {};
#ifndef _LIBCPP_CXX03_LANG
-template <class... _Tp> struct __tuple_like_ext<tuple<_Tp...> > : true_type {};
+template <class... _Tp>
+struct __tuple_like_ext<tuple<_Tp...> > : true_type {};
#endif
-template <class _T1, class _T2> struct __tuple_like_ext<pair<_T1, _T2> > : true_type {};
+template <class _T1, class _T2>
+struct __tuple_like_ext<pair<_T1, _T2> > : true_type {};
-template <class _Tp, size_t _Size> struct __tuple_like_ext<array<_Tp, _Size> > : true_type {};
+template <class _Tp, size_t _Size>
+struct __tuple_like_ext<array<_Tp, _Size> > : true_type {};
-template <class... _Tp> struct __tuple_like_ext<__tuple_types<_Tp...> > : true_type {};
+template <class... _Tp>
+struct __tuple_like_ext<__tuple_types<_Tp...> > : true_type {};
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__tuple/tuple_size.h b/contrib/llvm-project/libcxx/include/__tuple/tuple_size.h
index 26f9d9725d31..b8320106fb26 100644
--- a/contrib/llvm-project/libcxx/include/__tuple/tuple_size.h
+++ b/contrib/llvm-project/libcxx/include/__tuple/tuple_size.h
@@ -22,51 +22,46 @@
_LIBCPP_BEGIN_NAMESPACE_STD
-template <class _Tp> struct _LIBCPP_TEMPLATE_VIS tuple_size;
+template <class _Tp>
+struct _LIBCPP_TEMPLATE_VIS tuple_size;
#if !defined(_LIBCPP_CXX03_LANG)
template <class _Tp, class...>
using __enable_if_tuple_size_imp = _Tp;
template <class _Tp>
-struct _LIBCPP_TEMPLATE_VIS tuple_size<__enable_if_tuple_size_imp<
- const _Tp,
- __enable_if_t<!is_volatile<_Tp>::value>,
- integral_constant<size_t, sizeof(tuple_size<_Tp>)>>>
+struct _LIBCPP_TEMPLATE_VIS tuple_size<__enable_if_tuple_size_imp< const _Tp,
+ __enable_if_t<!is_volatile<_Tp>::value>,
+ integral_constant<size_t, sizeof(tuple_size<_Tp>)>>>
: public integral_constant<size_t, tuple_size<_Tp>::value> {};
template <class _Tp>
-struct _LIBCPP_TEMPLATE_VIS tuple_size<__enable_if_tuple_size_imp<
- volatile _Tp,
- __enable_if_t<!is_const<_Tp>::value>,
- integral_constant<size_t, sizeof(tuple_size<_Tp>)>>>
+struct _LIBCPP_TEMPLATE_VIS tuple_size<__enable_if_tuple_size_imp< volatile _Tp,
+ __enable_if_t<!is_const<_Tp>::value>,
+ integral_constant<size_t, sizeof(tuple_size<_Tp>)>>>
: public integral_constant<size_t, tuple_size<_Tp>::value> {};
template <class _Tp>
-struct _LIBCPP_TEMPLATE_VIS tuple_size<__enable_if_tuple_size_imp<
- const volatile _Tp,
- integral_constant<size_t, sizeof(tuple_size<_Tp>)>>>
+struct _LIBCPP_TEMPLATE_VIS
+ tuple_size<__enable_if_tuple_size_imp< const volatile _Tp, integral_constant<size_t, sizeof(tuple_size<_Tp>)>>>
: public integral_constant<size_t, tuple_size<_Tp>::value> {};
#else
-template <class _Tp> struct _LIBCPP_TEMPLATE_VIS tuple_size<const _Tp> : public tuple_size<_Tp> {};
-template <class _Tp> struct _LIBCPP_TEMPLATE_VIS tuple_size<volatile _Tp> : public tuple_size<_Tp> {};
-template <class _Tp> struct _LIBCPP_TEMPLATE_VIS tuple_size<const volatile _Tp> : public tuple_size<_Tp> {};
+template <class _Tp>
+struct _LIBCPP_TEMPLATE_VIS tuple_size<const _Tp> : public tuple_size<_Tp> {};
+template <class _Tp>
+struct _LIBCPP_TEMPLATE_VIS tuple_size<volatile _Tp> : public tuple_size<_Tp> {};
+template <class _Tp>
+struct _LIBCPP_TEMPLATE_VIS tuple_size<const volatile _Tp> : public tuple_size<_Tp> {};
#endif
#ifndef _LIBCPP_CXX03_LANG
-template <class ..._Tp>
-struct _LIBCPP_TEMPLATE_VIS tuple_size<tuple<_Tp...> >
- : public integral_constant<size_t, sizeof...(_Tp)>
-{
-};
-
-template <class ..._Tp>
-struct _LIBCPP_TEMPLATE_VIS tuple_size<__tuple_types<_Tp...> >
- : public integral_constant<size_t, sizeof...(_Tp)>
-{
-};
+template <class... _Tp>
+struct _LIBCPP_TEMPLATE_VIS tuple_size<tuple<_Tp...> > : public integral_constant<size_t, sizeof...(_Tp)> {};
+
+template <class... _Tp>
+struct _LIBCPP_TEMPLATE_VIS tuple_size<__tuple_types<_Tp...> > : public integral_constant<size_t, sizeof...(_Tp)> {};
#endif // _LIBCPP_CXX03_LANG
diff --git a/contrib/llvm-project/libcxx/include/__tuple/tuple_types.h b/contrib/llvm-project/libcxx/include/__tuple/tuple_types.h
index c5be81cce801..7e1256cf8790 100644
--- a/contrib/llvm-project/libcxx/include/__tuple/tuple_types.h
+++ b/contrib/llvm-project/libcxx/include/__tuple/tuple_types.h
@@ -17,7 +17,8 @@
_LIBCPP_BEGIN_NAMESPACE_STD
-template <class ..._Tp> struct __tuple_types {};
+template <class... _Tp>
+struct __tuple_types {};
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__type_traits/datasizeof.h b/contrib/llvm-project/libcxx/include/__type_traits/datasizeof.h
index 5688e3293a69..3a8b15160107 100644
--- a/contrib/llvm-project/libcxx/include/__type_traits/datasizeof.h
+++ b/contrib/llvm-project/libcxx/include/__type_traits/datasizeof.h
@@ -28,13 +28,17 @@ _LIBCPP_BEGIN_NAMESPACE_STD
template <class _Tp>
struct __libcpp_datasizeof {
-#if __has_cpp_attribute(__no_unique_address__)
+#if __has_extension(datasizeof)
+ static const size_t value = __datasizeof(_Tp);
+#else
+// NOLINTNEXTLINE(readability-redundant-preprocessor) This is https://llvm.org/PR64825
+# if __has_cpp_attribute(__no_unique_address__)
template <class = char>
struct _FirstPaddingByte {
[[__no_unique_address__]] _Tp __v_;
char __first_padding_byte_;
};
-#else
+# else
template <bool = __libcpp_is_final<_Tp>::value || !is_class<_Tp>::value>
struct _FirstPaddingByte : _Tp {
char __first_padding_byte_;
@@ -45,7 +49,7 @@ struct __libcpp_datasizeof {
_Tp __v_;
char __first_padding_byte_;
};
-#endif
+# endif // __has_cpp_attribute(__no_unique_address__)
// _FirstPaddingByte<> is sometimes non-standard layout. Using `offsetof` is UB in that case, but GCC and Clang allow
// the use as an extension.
@@ -53,6 +57,7 @@ struct __libcpp_datasizeof {
_LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Winvalid-offsetof")
static const size_t value = offsetof(_FirstPaddingByte<>, __first_padding_byte_);
_LIBCPP_DIAGNOSTIC_POP
+#endif // __has_extension(datasizeof)
};
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__utility/as_const.h b/contrib/llvm-project/libcxx/include/__utility/as_const.h
index b5c6091ecfed..b7ad95125944 100644
--- a/contrib/llvm-project/libcxx/include/__utility/as_const.h
+++ b/contrib/llvm-project/libcxx/include/__utility/as_const.h
@@ -22,7 +22,9 @@ _LIBCPP_BEGIN_NAMESPACE_STD
#if _LIBCPP_STD_VER >= 17
template <class _Tp>
-_LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr add_const_t<_Tp>& as_const(_Tp& __t) noexcept { return __t; }
+_LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr add_const_t<_Tp>& as_const(_Tp& __t) noexcept {
+ return __t;
+}
template <class _Tp>
void as_const(const _Tp&&) = delete;
diff --git a/contrib/llvm-project/libcxx/include/__utility/cmp.h b/contrib/llvm-project/libcxx/include/__utility/cmp.h
index 5c62d2bfa073..5f88f4b32703 100644
--- a/contrib/llvm-project/libcxx/include/__utility/cmp.h
+++ b/contrib/llvm-project/libcxx/include/__utility/cmp.h
@@ -29,24 +29,29 @@ _LIBCPP_PUSH_MACROS
_LIBCPP_BEGIN_NAMESPACE_STD
#if _LIBCPP_STD_VER >= 20
-template<class _Tp, class... _Up>
+template <class _Tp, class... _Up>
struct _IsSameAsAny : _Or<_IsSame<_Tp, _Up>...> {};
-template<class _Tp>
-concept __is_safe_integral_cmp = is_integral_v<_Tp> &&
- !_IsSameAsAny<_Tp, bool, char, char16_t, char32_t
-#ifndef _LIBCPP_HAS_NO_CHAR8_T
- , char8_t
-#endif
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
- , wchar_t
-#endif
- >::value;
-
-template<__is_safe_integral_cmp _Tp, __is_safe_integral_cmp _Up>
-_LIBCPP_HIDE_FROM_ABI constexpr
-bool cmp_equal(_Tp __t, _Up __u) noexcept
-{
+template <class _Tp>
+concept __is_safe_integral_cmp =
+ is_integral_v<_Tp> &&
+ !_IsSameAsAny<_Tp,
+ bool,
+ char,
+ char16_t,
+ char32_t
+# ifndef _LIBCPP_HAS_NO_CHAR8_T
+ ,
+ char8_t
+# endif
+# ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+ ,
+ wchar_t
+# endif
+ >::value;
+
+template <__is_safe_integral_cmp _Tp, __is_safe_integral_cmp _Up>
+_LIBCPP_HIDE_FROM_ABI constexpr bool cmp_equal(_Tp __t, _Up __u) noexcept {
if constexpr (is_signed_v<_Tp> == is_signed_v<_Up>)
return __t == __u;
else if constexpr (is_signed_v<_Tp>)
@@ -55,17 +60,13 @@ bool cmp_equal(_Tp __t, _Up __u) noexcept
return __u < 0 ? false : __t == make_unsigned_t<_Up>(__u);
}
-template<__is_safe_integral_cmp _Tp, __is_safe_integral_cmp _Up>
-_LIBCPP_HIDE_FROM_ABI constexpr
-bool cmp_not_equal(_Tp __t, _Up __u) noexcept
-{
+template <__is_safe_integral_cmp _Tp, __is_safe_integral_cmp _Up>
+_LIBCPP_HIDE_FROM_ABI constexpr bool cmp_not_equal(_Tp __t, _Up __u) noexcept {
return !std::cmp_equal(__t, __u);
}
-template<__is_safe_integral_cmp _Tp, __is_safe_integral_cmp _Up>
-_LIBCPP_HIDE_FROM_ABI constexpr
-bool cmp_less(_Tp __t, _Up __u) noexcept
-{
+template <__is_safe_integral_cmp _Tp, __is_safe_integral_cmp _Up>
+_LIBCPP_HIDE_FROM_ABI constexpr bool cmp_less(_Tp __t, _Up __u) noexcept {
if constexpr (is_signed_v<_Tp> == is_signed_v<_Up>)
return __t < __u;
else if constexpr (is_signed_v<_Tp>)
@@ -74,31 +75,23 @@ bool cmp_less(_Tp __t, _Up __u) noexcept
return __u < 0 ? false : __t < make_unsigned_t<_Up>(__u);
}
-template<__is_safe_integral_cmp _Tp, __is_safe_integral_cmp _Up>
-_LIBCPP_HIDE_FROM_ABI constexpr
-bool cmp_greater(_Tp __t, _Up __u) noexcept
-{
+template <__is_safe_integral_cmp _Tp, __is_safe_integral_cmp _Up>
+_LIBCPP_HIDE_FROM_ABI constexpr bool cmp_greater(_Tp __t, _Up __u) noexcept {
return std::cmp_less(__u, __t);
}
-template<__is_safe_integral_cmp _Tp, __is_safe_integral_cmp _Up>
-_LIBCPP_HIDE_FROM_ABI constexpr
-bool cmp_less_equal(_Tp __t, _Up __u) noexcept
-{
+template <__is_safe_integral_cmp _Tp, __is_safe_integral_cmp _Up>
+_LIBCPP_HIDE_FROM_ABI constexpr bool cmp_less_equal(_Tp __t, _Up __u) noexcept {
return !std::cmp_greater(__t, __u);
}
-template<__is_safe_integral_cmp _Tp, __is_safe_integral_cmp _Up>
-_LIBCPP_HIDE_FROM_ABI constexpr
-bool cmp_greater_equal(_Tp __t, _Up __u) noexcept
-{
+template <__is_safe_integral_cmp _Tp, __is_safe_integral_cmp _Up>
+_LIBCPP_HIDE_FROM_ABI constexpr bool cmp_greater_equal(_Tp __t, _Up __u) noexcept {
return !std::cmp_less(__t, __u);
}
-template<__is_safe_integral_cmp _Tp, __is_safe_integral_cmp _Up>
-_LIBCPP_HIDE_FROM_ABI constexpr
-bool in_range(_Up __u) noexcept
-{
+template <__is_safe_integral_cmp _Tp, __is_safe_integral_cmp _Up>
+_LIBCPP_HIDE_FROM_ABI constexpr bool in_range(_Up __u) noexcept {
return std::cmp_less_equal(__u, numeric_limits<_Tp>::max()) &&
std::cmp_greater_equal(__u, numeric_limits<_Tp>::min());
}
diff --git a/contrib/llvm-project/libcxx/include/__utility/convert_to_integral.h b/contrib/llvm-project/libcxx/include/__utility/convert_to_integral.h
index 2f61db6112d1..f1fcdd98010c 100644
--- a/contrib/llvm-project/libcxx/include/__utility/convert_to_integral.h
+++ b/contrib/llvm-project/libcxx/include/__utility/convert_to_integral.h
@@ -21,51 +21,47 @@
_LIBCPP_BEGIN_NAMESPACE_STD
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR
-int __convert_to_integral(int __val) { return __val; }
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR int __convert_to_integral(int __val) { return __val; }
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR
-unsigned __convert_to_integral(unsigned __val) { return __val; }
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR unsigned __convert_to_integral(unsigned __val) { return __val; }
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR
-long __convert_to_integral(long __val) { return __val; }
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR long __convert_to_integral(long __val) { return __val; }
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR
-unsigned long __convert_to_integral(unsigned long __val) { return __val; }
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR unsigned long __convert_to_integral(unsigned long __val) {
+ return __val;
+}
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR
-long long __convert_to_integral(long long __val) { return __val; }
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR long long __convert_to_integral(long long __val) { return __val; }
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR
-unsigned long long __convert_to_integral(unsigned long long __val) {return __val; }
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR unsigned long long __convert_to_integral(unsigned long long __val) {
+ return __val;
+}
-template<typename _Fp, __enable_if_t<is_floating_point<_Fp>::value, int> = 0>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR
-long long
- __convert_to_integral(_Fp __val) { return __val; }
+template <typename _Fp, __enable_if_t<is_floating_point<_Fp>::value, int> = 0>
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR long long __convert_to_integral(_Fp __val) {
+ return __val;
+}
#ifndef _LIBCPP_HAS_NO_INT128
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR
-__int128_t __convert_to_integral(__int128_t __val) { return __val; }
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR __int128_t __convert_to_integral(__int128_t __val) { return __val; }
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR
-__uint128_t __convert_to_integral(__uint128_t __val) { return __val; }
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR __uint128_t __convert_to_integral(__uint128_t __val) { return __val; }
#endif
template <class _Tp, bool = is_enum<_Tp>::value>
-struct __sfinae_underlying_type
-{
- typedef typename underlying_type<_Tp>::type type;
- typedef decltype(((type)1) + 0) __promoted_type;
+struct __sfinae_underlying_type {
+ typedef typename underlying_type<_Tp>::type type;
+ typedef decltype(((type)1) + 0) __promoted_type;
};
template <class _Tp>
struct __sfinae_underlying_type<_Tp, false> {};
template <class _Tp>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR
-typename __sfinae_underlying_type<_Tp>::__promoted_type
-__convert_to_integral(_Tp __val) { return __val; }
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR typename __sfinae_underlying_type<_Tp>::__promoted_type
+__convert_to_integral(_Tp __val) {
+ return __val;
+}
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__utility/exchange.h b/contrib/llvm-project/libcxx/include/__utility/exchange.h
index 819549a9dcb4..72312c06b588 100644
--- a/contrib/llvm-project/libcxx/include/__utility/exchange.h
+++ b/contrib/llvm-project/libcxx/include/__utility/exchange.h
@@ -25,14 +25,12 @@ _LIBCPP_PUSH_MACROS
_LIBCPP_BEGIN_NAMESPACE_STD
#if _LIBCPP_STD_VER >= 14
-template<class _T1, class _T2 = _T1>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-_T1 exchange(_T1& __obj, _T2&& __new_value)
- noexcept(is_nothrow_move_constructible<_T1>::value && is_nothrow_assignable<_T1&, _T2>::value)
-{
- _T1 __old_value = std::move(__obj);
- __obj = std::forward<_T2>(__new_value);
- return __old_value;
+template <class _T1, class _T2 = _T1>
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _T1 exchange(_T1& __obj, _T2&& __new_value) noexcept(
+ is_nothrow_move_constructible<_T1>::value && is_nothrow_assignable<_T1&, _T2>::value) {
+ _T1 __old_value = std::move(__obj);
+ __obj = std::forward<_T2>(__new_value);
+ return __old_value;
}
#endif // _LIBCPP_STD_VER >= 14
diff --git a/contrib/llvm-project/libcxx/include/__utility/in_place.h b/contrib/llvm-project/libcxx/include/__utility/in_place.h
index 5b878529fb21..fa7a2f4bfd4a 100644
--- a/contrib/llvm-project/libcxx/include/__utility/in_place.h
+++ b/contrib/llvm-project/libcxx/include/__utility/in_place.h
@@ -40,14 +40,18 @@ struct _LIBCPP_TEMPLATE_VIS in_place_index_t {
template <size_t _Idx>
inline constexpr in_place_index_t<_Idx> in_place_index{};
-template <class _Tp> struct __is_inplace_type_imp : false_type {};
-template <class _Tp> struct __is_inplace_type_imp<in_place_type_t<_Tp>> : true_type {};
+template <class _Tp>
+struct __is_inplace_type_imp : false_type {};
+template <class _Tp>
+struct __is_inplace_type_imp<in_place_type_t<_Tp>> : true_type {};
template <class _Tp>
using __is_inplace_type = __is_inplace_type_imp<__remove_cvref_t<_Tp>>;
-template <class _Tp> struct __is_inplace_index_imp : false_type {};
-template <size_t _Idx> struct __is_inplace_index_imp<in_place_index_t<_Idx>> : true_type {};
+template <class _Tp>
+struct __is_inplace_index_imp : false_type {};
+template <size_t _Idx>
+struct __is_inplace_index_imp<in_place_index_t<_Idx>> : true_type {};
template <class _Tp>
using __is_inplace_index = __is_inplace_index_imp<__remove_cvref_t<_Tp>>;
diff --git a/contrib/llvm-project/libcxx/include/__utility/integer_sequence.h b/contrib/llvm-project/libcxx/include/__utility/integer_sequence.h
index bae8c241ef5a..e63f3f265b7d 100644
--- a/contrib/llvm-project/libcxx/include/__utility/integer_sequence.h
+++ b/contrib/llvm-project/libcxx/include/__utility/integer_sequence.h
@@ -19,7 +19,8 @@
_LIBCPP_BEGIN_NAMESPACE_STD
-template <size_t...> struct __tuple_indices;
+template <size_t...>
+struct __tuple_indices;
template <class _IdxType, _IdxType... _Values>
struct __integer_sequence {
@@ -34,22 +35,28 @@ struct __integer_sequence {
namespace __detail {
-template<typename _Tp, size_t ..._Extra> struct __repeat;
-template<typename _Tp, _Tp ..._Np, size_t ..._Extra> struct __repeat<__integer_sequence<_Tp, _Np...>, _Extra...> {
- typedef _LIBCPP_NODEBUG __integer_sequence<_Tp,
- _Np...,
- sizeof...(_Np) + _Np...,
- 2 * sizeof...(_Np) + _Np...,
- 3 * sizeof...(_Np) + _Np...,
- 4 * sizeof...(_Np) + _Np...,
- 5 * sizeof...(_Np) + _Np...,
- 6 * sizeof...(_Np) + _Np...,
- 7 * sizeof...(_Np) + _Np...,
- _Extra...> type;
+template <typename _Tp, size_t... _Extra>
+struct __repeat;
+template <typename _Tp, _Tp... _Np, size_t... _Extra>
+struct __repeat<__integer_sequence<_Tp, _Np...>, _Extra...> {
+ typedef _LIBCPP_NODEBUG __integer_sequence<
+ _Tp,
+ _Np...,
+ sizeof...(_Np) + _Np...,
+ 2 * sizeof...(_Np) + _Np...,
+ 3 * sizeof...(_Np) + _Np...,
+ 4 * sizeof...(_Np) + _Np...,
+ 5 * sizeof...(_Np) + _Np...,
+ 6 * sizeof...(_Np) + _Np...,
+ 7 * sizeof...(_Np) + _Np...,
+ _Extra...>
+ type;
};
-template<size_t _Np> struct __parity;
-template<size_t _Np> struct __make : __parity<_Np % 8>::template __pmake<_Np> {};
+template <size_t _Np>
+struct __parity;
+template <size_t _Np>
+struct __make : __parity<_Np % 8>::template __pmake<_Np> {};
// clang-format off
template<> struct __make<0> { typedef __integer_sequence<size_t> type; };
@@ -71,80 +78,71 @@ template<> struct __parity<6> { template<size_t _Np> struct __pmake : __repeat<t
template<> struct __parity<7> { template<size_t _Np> struct __pmake : __repeat<typename __make<_Np / 8>::type, _Np - 7, _Np - 6, _Np - 5, _Np - 4, _Np - 3, _Np - 2, _Np - 1> {}; };
// clang-format on
-} // namespace detail
+} // namespace __detail
#endif
#if __has_builtin(__make_integer_seq)
template <size_t _Ep, size_t _Sp>
using __make_indices_imp =
- typename __make_integer_seq<__integer_sequence, size_t, _Ep - _Sp>::template
- __to_tuple_indices<_Sp>;
+ typename __make_integer_seq<__integer_sequence, size_t, _Ep - _Sp>::template __to_tuple_indices<_Sp>;
#else
template <size_t _Ep, size_t _Sp>
-using __make_indices_imp =
- typename __detail::__make<_Ep - _Sp>::type::template __to_tuple_indices<_Sp>;
+using __make_indices_imp = typename __detail::__make<_Ep - _Sp>::type::template __to_tuple_indices<_Sp>;
#endif
#if _LIBCPP_STD_VER >= 14
-template<class _Tp, _Tp... _Ip>
-struct _LIBCPP_TEMPLATE_VIS integer_sequence
-{
- typedef _Tp value_type;
- static_assert( is_integral<_Tp>::value,
- "std::integer_sequence can only be instantiated with an integral type" );
- static
- _LIBCPP_HIDE_FROM_ABI
- constexpr
- size_t
- size() noexcept { return sizeof...(_Ip); }
+template <class _Tp, _Tp... _Ip>
+struct _LIBCPP_TEMPLATE_VIS integer_sequence {
+ typedef _Tp value_type;
+ static_assert(is_integral<_Tp>::value, "std::integer_sequence can only be instantiated with an integral type");
+ static _LIBCPP_HIDE_FROM_ABI constexpr size_t size() noexcept { return sizeof...(_Ip); }
};
-template<size_t... _Ip>
- using index_sequence = integer_sequence<size_t, _Ip...>;
+template <size_t... _Ip>
+using index_sequence = integer_sequence<size_t, _Ip...>;
-#if __has_builtin(__make_integer_seq) && !defined(_LIBCPP_TESTING_FALLBACK_MAKE_INTEGER_SEQUENCE)
+# if __has_builtin(__make_integer_seq) && !defined(_LIBCPP_TESTING_FALLBACK_MAKE_INTEGER_SEQUENCE)
template <class _Tp, _Tp _Ep>
using __make_integer_sequence _LIBCPP_NODEBUG = __make_integer_seq<integer_sequence, _Tp, _Ep>;
-#else
+# else
-template<typename _Tp, _Tp _Np> using __make_integer_sequence_unchecked _LIBCPP_NODEBUG =
- typename __detail::__make<_Np>::type::template __convert<integer_sequence, _Tp>;
+template <typename _Tp, _Tp _Np>
+using __make_integer_sequence_unchecked _LIBCPP_NODEBUG =
+ typename __detail::__make<_Np>::type::template __convert<integer_sequence, _Tp>;
template <class _Tp, _Tp _Ep>
-struct __make_integer_sequence_checked
-{
- static_assert(is_integral<_Tp>::value,
- "std::make_integer_sequence can only be instantiated with an integral type" );
- static_assert(0 <= _Ep, "std::make_integer_sequence must have a non-negative sequence length");
- // Workaround GCC bug by preventing bad installations when 0 <= _Ep
- // https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68929
- typedef _LIBCPP_NODEBUG __make_integer_sequence_unchecked<_Tp, 0 <= _Ep ? _Ep : 0> type;
+struct __make_integer_sequence_checked {
+ static_assert(is_integral<_Tp>::value, "std::make_integer_sequence can only be instantiated with an integral type");
+ static_assert(0 <= _Ep, "std::make_integer_sequence must have a non-negative sequence length");
+ // Workaround GCC bug by preventing bad installations when 0 <= _Ep
+ // https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68929
+ typedef _LIBCPP_NODEBUG __make_integer_sequence_unchecked<_Tp, 0 <= _Ep ? _Ep : 0> type;
};
template <class _Tp, _Tp _Ep>
using __make_integer_sequence _LIBCPP_NODEBUG = typename __make_integer_sequence_checked<_Tp, _Ep>::type;
-#endif
+# endif
-template<class _Tp, _Tp _Np>
- using make_integer_sequence = __make_integer_sequence<_Tp, _Np>;
+template <class _Tp, _Tp _Np>
+using make_integer_sequence = __make_integer_sequence<_Tp, _Np>;
-template<size_t _Np>
- using make_index_sequence = make_integer_sequence<size_t, _Np>;
+template <size_t _Np>
+using make_index_sequence = make_integer_sequence<size_t, _Np>;
-template<class... _Tp>
- using index_sequence_for = make_index_sequence<sizeof...(_Tp)>;
+template <class... _Tp>
+using index_sequence_for = make_index_sequence<sizeof...(_Tp)>;
# if _LIBCPP_STD_VER >= 20
// Executes __func for every element in an index_sequence.
template <size_t... _Index, class _Function>
_LIBCPP_HIDE_FROM_ABI constexpr void __for_each_index_sequence(index_sequence<_Index...>, _Function __func) {
- (__func.template operator()<_Index>(), ...);
+ (__func.template operator()<_Index>(), ...);
}
# endif // _LIBCPP_STD_VER >= 20
diff --git a/contrib/llvm-project/libcxx/include/__utility/is_pointer_in_range.h b/contrib/llvm-project/libcxx/include/__utility/is_pointer_in_range.h
index e859562e7457..68cdfea6f945 100644
--- a/contrib/llvm-project/libcxx/include/__utility/is_pointer_in_range.h
+++ b/contrib/llvm-project/libcxx/include/__utility/is_pointer_in_range.h
@@ -35,7 +35,7 @@ template <class _Tp, class _Up, __enable_if_t<__is_less_than_comparable<const _T
_LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI _LIBCPP_NO_SANITIZE("address") bool __is_pointer_in_range(
const _Tp* __begin, const _Tp* __end, const _Up* __ptr) {
if (__libcpp_is_constant_evaluated()) {
- _LIBCPP_ASSERT_UNCATEGORIZED(__builtin_constant_p(__begin <= __end), "__begin and __end do not form a range");
+ _LIBCPP_ASSERT_VALID_INPUT_RANGE(__builtin_constant_p(__begin <= __end), "__begin and __end do not form a range");
// If this is not a constant during constant evaluation we know that __ptr is not part of the allocation where
// [__begin, __end) is.
diff --git a/contrib/llvm-project/libcxx/include/__utility/pair.h b/contrib/llvm-project/libcxx/include/__utility/pair.h
index 535344eb1e2d..2f4908ceddce 100644
--- a/contrib/llvm-project/libcxx/include/__utility/pair.h
+++ b/contrib/llvm-project/libcxx/include/__utility/pair.h
@@ -63,8 +63,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
template <class, class>
struct __non_trivially_copyable_base {
- _LIBCPP_CONSTEXPR _LIBCPP_HIDE_FROM_ABI
- __non_trivially_copyable_base() _NOEXCEPT {}
+ _LIBCPP_CONSTEXPR _LIBCPP_HIDE_FROM_ABI __non_trivially_copyable_base() _NOEXCEPT {}
_LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
__non_trivially_copyable_base(__non_trivially_copyable_base const&) _NOEXCEPT {}
};
@@ -80,799 +79,658 @@ struct __is_specialization_of_subrange<ranges::subrange<_Iter, _Sent, _Kind>> :
template <class _T1, class _T2>
struct _LIBCPP_TEMPLATE_VIS pair
#if defined(_LIBCPP_DEPRECATED_ABI_DISABLE_PAIR_TRIVIAL_COPY_CTOR)
-: private __non_trivially_copyable_base<_T1, _T2>
+ : private __non_trivially_copyable_base<_T1, _T2>
#endif
{
- using first_type = _T1;
- using second_type = _T2;
+ using first_type = _T1;
+ using second_type = _T2;
- _T1 first;
- _T2 second;
+ _T1 first;
+ _T2 second;
- _LIBCPP_HIDE_FROM_ABI pair(pair const&) = default;
- _LIBCPP_HIDE_FROM_ABI pair(pair&&) = default;
+ _LIBCPP_HIDE_FROM_ABI pair(pair const&) = default;
+ _LIBCPP_HIDE_FROM_ABI pair(pair&&) = default;
#ifdef _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI
- pair() : first(), second() {}
+ _LIBCPP_HIDE_FROM_ABI pair() : first(), second() {}
+
+ _LIBCPP_HIDE_FROM_ABI pair(_T1 const& __t1, _T2 const& __t2) : first(__t1), second(__t2) {}
+
+ template <class _U1, class _U2>
+ _LIBCPP_HIDE_FROM_ABI pair(const pair<_U1, _U2>& __p) : first(__p.first), second(__p.second) {}
+
+ _LIBCPP_HIDE_FROM_ABI pair& operator=(pair const& __p) {
+ first = __p.first;
+ second = __p.second;
+ return *this;
+ }
+
+ // Extension: This is provided in C++03 because it allows properly handling the
+ // assignment to a pair containing references, which would be a hard
+ // error otherwise.
+ template <class _U1,
+ class _U2,
+ class = __enable_if_t< is_assignable<first_type&, _U1 const&>::value &&
+ is_assignable<second_type&, _U2 const&>::value > >
+ _LIBCPP_HIDE_FROM_ABI pair& operator=(pair<_U1, _U2> const& __p) {
+ first = __p.first;
+ second = __p.second;
+ return *this;
+ }
+#else
+ struct _CheckArgs {
+ template <int&...>
+ static _LIBCPP_HIDE_FROM_ABI constexpr bool __enable_explicit_default() {
+ return is_default_constructible<_T1>::value && is_default_constructible<_T2>::value &&
+ !__enable_implicit_default<>();
+ }
- _LIBCPP_HIDE_FROM_ABI
- pair(_T1 const& __t1, _T2 const& __t2) : first(__t1), second(__t2) {}
+ template <int&...>
+ static _LIBCPP_HIDE_FROM_ABI constexpr bool __enable_implicit_default() {
+ return __is_implicitly_default_constructible<_T1>::value && __is_implicitly_default_constructible<_T2>::value;
+ }
template <class _U1, class _U2>
- _LIBCPP_HIDE_FROM_ABI
- pair(const pair<_U1, _U2>& __p) : first(__p.first), second(__p.second) {}
-
- _LIBCPP_HIDE_FROM_ABI
- pair& operator=(pair const& __p) {
- first = __p.first;
- second = __p.second;
- return *this;
+ static _LIBCPP_HIDE_FROM_ABI constexpr bool __is_pair_constructible() {
+ return is_constructible<first_type, _U1>::value && is_constructible<second_type, _U2>::value;
}
- // Extension: This is provided in C++03 because it allows properly handling the
- // assignment to a pair containing references, which would be a hard
- // error otherwise.
- template <class _U1, class _U2, class = __enable_if_t<
- is_assignable<first_type&, _U1 const&>::value &&
- is_assignable<second_type&, _U2 const&>::value
- > >
- _LIBCPP_HIDE_FROM_ABI
- pair& operator=(pair<_U1, _U2> const& __p) {
- first = __p.first;
- second = __p.second;
- return *this;
+ template <class _U1, class _U2>
+ static _LIBCPP_HIDE_FROM_ABI constexpr bool __is_implicit() {
+ return is_convertible<_U1, first_type>::value && is_convertible<_U2, second_type>::value;
}
-#else
- struct _CheckArgs {
- template <int&...>
- static _LIBCPP_HIDE_FROM_ABI constexpr bool __enable_explicit_default() {
- return is_default_constructible<_T1>::value
- && is_default_constructible<_T2>::value
- && !__enable_implicit_default<>();
- }
-
- template <int&...>
- static _LIBCPP_HIDE_FROM_ABI constexpr bool __enable_implicit_default() {
- return __is_implicitly_default_constructible<_T1>::value
- && __is_implicitly_default_constructible<_T2>::value;
- }
-
- template <class _U1, class _U2>
- static _LIBCPP_HIDE_FROM_ABI constexpr bool __is_pair_constructible() {
- return is_constructible<first_type, _U1>::value
- && is_constructible<second_type, _U2>::value;
- }
-
- template <class _U1, class _U2>
- static _LIBCPP_HIDE_FROM_ABI constexpr bool __is_implicit() {
- return is_convertible<_U1, first_type>::value
- && is_convertible<_U2, second_type>::value;
- }
-
- template <class _U1, class _U2>
- static _LIBCPP_HIDE_FROM_ABI constexpr bool __enable_explicit() {
- return __is_pair_constructible<_U1, _U2>() && !__is_implicit<_U1, _U2>();
- }
-
- template <class _U1, class _U2>
- static _LIBCPP_HIDE_FROM_ABI constexpr bool __enable_implicit() {
- return __is_pair_constructible<_U1, _U2>() && __is_implicit<_U1, _U2>();
- }
- };
-
- template <bool _MaybeEnable>
- using _CheckArgsDep _LIBCPP_NODEBUG = typename conditional<
- _MaybeEnable, _CheckArgs, __check_tuple_constructor_fail>::type;
-
- template<bool _Dummy = true, __enable_if_t<_CheckArgsDep<_Dummy>::__enable_explicit_default(), int> = 0>
- explicit _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR
- pair() _NOEXCEPT_(is_nothrow_default_constructible<first_type>::value &&
- is_nothrow_default_constructible<second_type>::value)
- : first(), second() {}
-
- template<bool _Dummy = true, __enable_if_t<_CheckArgsDep<_Dummy>::__enable_implicit_default(), int> = 0>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR
- pair() _NOEXCEPT_(is_nothrow_default_constructible<first_type>::value &&
- is_nothrow_default_constructible<second_type>::value)
- : first(), second() {}
-
- template <bool _Dummy = true,
- __enable_if_t<_CheckArgsDep<_Dummy>::template __enable_explicit<_T1 const&, _T2 const&>(), int> = 0>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
- explicit pair(_T1 const& __t1, _T2 const& __t2)
- _NOEXCEPT_(is_nothrow_copy_constructible<first_type>::value &&
- is_nothrow_copy_constructible<second_type>::value)
- : first(__t1), second(__t2) {}
-
- template<bool _Dummy = true,
- __enable_if_t<_CheckArgsDep<_Dummy>::template __enable_implicit<_T1 const&, _T2 const&>(), int> = 0>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
- pair(_T1 const& __t1, _T2 const& __t2)
- _NOEXCEPT_(is_nothrow_copy_constructible<first_type>::value &&
- is_nothrow_copy_constructible<second_type>::value)
- : first(__t1), second(__t2) {}
-
- template <
-#if _LIBCPP_STD_VER >= 23 // http://wg21.link/P1951
- class _U1 = _T1, class _U2 = _T2,
-#else
- class _U1, class _U2,
-#endif
- __enable_if_t<_CheckArgs::template __enable_explicit<_U1, _U2>(), int> = 0
- >
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
- explicit pair(_U1&& __u1, _U2&& __u2)
- _NOEXCEPT_((is_nothrow_constructible<first_type, _U1>::value &&
- is_nothrow_constructible<second_type, _U2>::value))
- : first(std::forward<_U1>(__u1)), second(std::forward<_U2>(__u2)) {}
-
- template <
-#if _LIBCPP_STD_VER >= 23 // http://wg21.link/P1951
- class _U1 = _T1, class _U2 = _T2,
-#else
- class _U1, class _U2,
-#endif
- __enable_if_t<_CheckArgs::template __enable_implicit<_U1, _U2>(), int> = 0
- >
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
- pair(_U1&& __u1, _U2&& __u2)
- _NOEXCEPT_((is_nothrow_constructible<first_type, _U1>::value &&
- is_nothrow_constructible<second_type, _U2>::value))
- : first(std::forward<_U1>(__u1)), second(std::forward<_U2>(__u2)) {}
-
-#if _LIBCPP_STD_VER >= 23
- template<class _U1, class _U2, __enable_if_t<
- _CheckArgs::template __is_pair_constructible<_U1&, _U2&>()
- >* = nullptr>
- _LIBCPP_HIDE_FROM_ABI constexpr
- explicit(!_CheckArgs::template __is_implicit<_U1&, _U2&>()) pair(pair<_U1, _U2>& __p)
- noexcept((is_nothrow_constructible<first_type, _U1&>::value &&
- is_nothrow_constructible<second_type, _U2&>::value))
- : first(__p.first), second(__p.second) {}
-#endif
- template<class _U1, class _U2, __enable_if_t<_CheckArgs::template __enable_explicit<_U1 const&, _U2 const&>(), int> = 0>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
- explicit pair(pair<_U1, _U2> const& __p)
- _NOEXCEPT_((is_nothrow_constructible<first_type, _U1 const&>::value &&
- is_nothrow_constructible<second_type, _U2 const&>::value))
- : first(__p.first), second(__p.second) {}
-
- template<class _U1, class _U2, __enable_if_t<_CheckArgs::template __enable_implicit<_U1 const&, _U2 const&>(), int> = 0>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
- pair(pair<_U1, _U2> const& __p)
- _NOEXCEPT_((is_nothrow_constructible<first_type, _U1 const&>::value &&
- is_nothrow_constructible<second_type, _U2 const&>::value))
- : first(__p.first), second(__p.second) {}
-
- template<class _U1, class _U2, __enable_if_t<_CheckArgs::template __enable_explicit<_U1, _U2>(), int> = 0>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
- explicit pair(pair<_U1, _U2>&&__p)
- _NOEXCEPT_((is_nothrow_constructible<first_type, _U1&&>::value &&
- is_nothrow_constructible<second_type, _U2&&>::value))
- : first(std::forward<_U1>(__p.first)), second(std::forward<_U2>(__p.second)) {}
-
- template<class _U1, class _U2, __enable_if_t<_CheckArgs::template __enable_implicit<_U1, _U2>(), int> = 0>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
- pair(pair<_U1, _U2>&& __p)
- _NOEXCEPT_((is_nothrow_constructible<first_type, _U1&&>::value &&
- is_nothrow_constructible<second_type, _U2&&>::value))
- : first(std::forward<_U1>(__p.first)), second(std::forward<_U2>(__p.second)) {}
-
-#if _LIBCPP_STD_VER >= 23
- template<class _U1, class _U2, __enable_if_t<
- _CheckArgs::template __is_pair_constructible<const _U1&&, const _U2&&>()
- >* = nullptr>
- _LIBCPP_HIDE_FROM_ABI constexpr
- explicit(!_CheckArgs::template __is_implicit<const _U1&&, const _U2&&>())
- pair(const pair<_U1, _U2>&& __p)
- noexcept(is_nothrow_constructible<first_type, const _U1&&>::value &&
- is_nothrow_constructible<second_type, const _U2&&>::value)
- : first(std::move(__p.first)), second(std::move(__p.second)) {}
-#endif
+ template <class _U1, class _U2>
+ static _LIBCPP_HIDE_FROM_ABI constexpr bool __enable_explicit() {
+ return __is_pair_constructible<_U1, _U2>() && !__is_implicit<_U1, _U2>();
+ }
-# if _LIBCPP_STD_VER >= 23
- // This is a workaround for http://llvm.org/PR60710. We should be able to remove it once Clang is fixed.
- template <class _PairLike>
- _LIBCPP_HIDE_FROM_ABI static constexpr bool __pair_like_explicit_wknd() {
- if constexpr (__pair_like<_PairLike>) {
- return !is_convertible_v<decltype(std::get<0>(std::declval<_PairLike&&>())), first_type> ||
- !is_convertible_v<decltype(std::get<1>(std::declval<_PairLike&&>())), second_type>;
- }
- return false;
+ template <class _U1, class _U2>
+ static _LIBCPP_HIDE_FROM_ABI constexpr bool __enable_implicit() {
+ return __is_pair_constructible<_U1, _U2>() && __is_implicit<_U1, _U2>();
}
+ };
+
+ template <bool _MaybeEnable>
+ using _CheckArgsDep _LIBCPP_NODEBUG =
+ typename conditional< _MaybeEnable, _CheckArgs, __check_tuple_constructor_fail>::type;
+
+ template <bool _Dummy = true, __enable_if_t<_CheckArgsDep<_Dummy>::__enable_explicit_default(), int> = 0>
+ explicit _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR pair() _NOEXCEPT_(
+ is_nothrow_default_constructible<first_type>::value&& is_nothrow_default_constructible<second_type>::value)
+ : first(), second() {}
+
+ template <bool _Dummy = true, __enable_if_t<_CheckArgsDep<_Dummy>::__enable_implicit_default(), int> = 0>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR pair() _NOEXCEPT_(
+ is_nothrow_default_constructible<first_type>::value&& is_nothrow_default_constructible<second_type>::value)
+ : first(), second() {}
+
+ template <bool _Dummy = true,
+ __enable_if_t<_CheckArgsDep<_Dummy>::template __enable_explicit<_T1 const&, _T2 const&>(), int> = 0>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 explicit pair(_T1 const& __t1, _T2 const& __t2)
+ _NOEXCEPT_(is_nothrow_copy_constructible<first_type>::value&& is_nothrow_copy_constructible<second_type>::value)
+ : first(__t1), second(__t2) {}
+
+ template <bool _Dummy = true,
+ __enable_if_t<_CheckArgsDep<_Dummy>::template __enable_implicit<_T1 const&, _T2 const&>(), int> = 0>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair(_T1 const& __t1, _T2 const& __t2)
+ _NOEXCEPT_(is_nothrow_copy_constructible<first_type>::value&& is_nothrow_copy_constructible<second_type>::value)
+ : first(__t1), second(__t2) {}
+
+ template <
+# if _LIBCPP_STD_VER >= 23 // http://wg21.link/P1951
+ class _U1 = _T1,
+ class _U2 = _T2,
+# else
+ class _U1,
+ class _U2,
+# endif
+ __enable_if_t<_CheckArgs::template __enable_explicit<_U1, _U2>(), int> = 0 >
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 explicit pair(_U1&& __u1, _U2&& __u2)
+ _NOEXCEPT_((is_nothrow_constructible<first_type, _U1>::value &&
+ is_nothrow_constructible<second_type, _U2>::value))
+ : first(std::forward<_U1>(__u1)), second(std::forward<_U2>(__u2)) {
+ }
+
+ template <
+# if _LIBCPP_STD_VER >= 23 // http://wg21.link/P1951
+ class _U1 = _T1,
+ class _U2 = _T2,
+# else
+ class _U1,
+ class _U2,
+# endif
+ __enable_if_t<_CheckArgs::template __enable_implicit<_U1, _U2>(), int> = 0 >
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair(_U1&& __u1, _U2&& __u2)
+ _NOEXCEPT_((is_nothrow_constructible<first_type, _U1>::value &&
+ is_nothrow_constructible<second_type, _U2>::value))
+ : first(std::forward<_U1>(__u1)), second(std::forward<_U2>(__u2)) {
+ }
- template <__pair_like _PairLike>
- requires(!__is_specialization_of_subrange<remove_cvref_t<_PairLike>>::value &&
- is_constructible_v<first_type, decltype(std::get<0>(std::declval<_PairLike&&>()))> &&
- is_constructible_v<second_type, decltype(std::get<1>(std::declval<_PairLike&&>()))>)
- _LIBCPP_HIDE_FROM_ABI constexpr explicit(__pair_like_explicit_wknd<_PairLike>())
- pair(_PairLike&& __p)
- : first(std::get<0>(std::forward<_PairLike>(__p))), second(std::get<1>(std::forward<_PairLike>(__p))) {}
+# if _LIBCPP_STD_VER >= 23
+ template <class _U1,
+ class _U2,
+ __enable_if_t< _CheckArgs::template __is_pair_constructible<_U1&, _U2&>() >* = nullptr>
+ _LIBCPP_HIDE_FROM_ABI constexpr explicit(!_CheckArgs::template __is_implicit<_U1&, _U2&>())
+ pair(pair<_U1, _U2>& __p) noexcept((is_nothrow_constructible<first_type, _U1&>::value &&
+ is_nothrow_constructible<second_type, _U2&>::value))
+ : first(__p.first), second(__p.second) {}
# endif
- template <class... _Args1, class... _Args2>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- pair(piecewise_construct_t __pc,
- tuple<_Args1...> __first_args, tuple<_Args2...> __second_args)
- _NOEXCEPT_((is_nothrow_constructible<first_type, _Args1...>::value &&
- is_nothrow_constructible<second_type, _Args2...>::value))
- : pair(__pc, __first_args, __second_args,
- typename __make_tuple_indices<sizeof...(_Args1)>::type(),
- typename __make_tuple_indices<sizeof...(_Args2) >::type()) {}
-
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- pair& operator=(__conditional_t<
- is_copy_assignable<first_type>::value &&
- is_copy_assignable<second_type>::value,
- pair, __nat> const& __p)
- _NOEXCEPT_(is_nothrow_copy_assignable<first_type>::value &&
- is_nothrow_copy_assignable<second_type>::value)
- {
- first = __p.first;
- second = __p.second;
- return *this;
- }
+ template <class _U1,
+ class _U2,
+ __enable_if_t<_CheckArgs::template __enable_explicit<_U1 const&, _U2 const&>(), int> = 0>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 explicit pair(pair<_U1, _U2> const& __p)
+ _NOEXCEPT_((is_nothrow_constructible<first_type, _U1 const&>::value &&
+ is_nothrow_constructible<second_type, _U2 const&>::value))
+ : first(__p.first), second(__p.second) {}
+
+ template <class _U1,
+ class _U2,
+ __enable_if_t<_CheckArgs::template __enable_implicit<_U1 const&, _U2 const&>(), int> = 0>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair(pair<_U1, _U2> const& __p)
+ _NOEXCEPT_((is_nothrow_constructible<first_type, _U1 const&>::value &&
+ is_nothrow_constructible<second_type, _U2 const&>::value))
+ : first(__p.first), second(__p.second) {}
+
+ template <class _U1, class _U2, __enable_if_t<_CheckArgs::template __enable_explicit<_U1, _U2>(), int> = 0>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 explicit pair(pair<_U1, _U2>&& __p)
+ _NOEXCEPT_((is_nothrow_constructible<first_type, _U1&&>::value &&
+ is_nothrow_constructible<second_type, _U2&&>::value))
+ : first(std::forward<_U1>(__p.first)), second(std::forward<_U2>(__p.second)) {}
+
+ template <class _U1, class _U2, __enable_if_t<_CheckArgs::template __enable_implicit<_U1, _U2>(), int> = 0>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair(pair<_U1, _U2>&& __p)
+ _NOEXCEPT_((is_nothrow_constructible<first_type, _U1&&>::value &&
+ is_nothrow_constructible<second_type, _U2&&>::value))
+ : first(std::forward<_U1>(__p.first)), second(std::forward<_U2>(__p.second)) {}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- pair& operator=(__conditional_t<
- is_move_assignable<first_type>::value &&
- is_move_assignable<second_type>::value,
- pair, __nat>&& __p)
- _NOEXCEPT_(is_nothrow_move_assignable<first_type>::value &&
- is_nothrow_move_assignable<second_type>::value)
- {
- first = std::forward<first_type>(__p.first);
- second = std::forward<second_type>(__p.second);
- return *this;
- }
+# if _LIBCPP_STD_VER >= 23
+ template <class _U1,
+ class _U2,
+ __enable_if_t< _CheckArgs::template __is_pair_constructible<const _U1&&, const _U2&&>() >* = nullptr>
+ _LIBCPP_HIDE_FROM_ABI constexpr explicit(!_CheckArgs::template __is_implicit<const _U1&&, const _U2&&>())
+ pair(const pair<_U1, _U2>&& __p) noexcept(is_nothrow_constructible<first_type, const _U1&&>::value &&
+ is_nothrow_constructible<second_type, const _U2&&>::value)
+ : first(std::move(__p.first)), second(std::move(__p.second)) {}
+# endif
- template <class _U1, class _U2, __enable_if_t<
- is_assignable<first_type&, _U1 const&>::value &&
- is_assignable<second_type&, _U2 const&>::value
- >* = nullptr>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- pair& operator=(pair<_U1, _U2> const& __p) {
- first = __p.first;
- second = __p.second;
- return *this;
+# if _LIBCPP_STD_VER >= 23
+ // This is a workaround for http://llvm.org/PR60710. We should be able to remove it once Clang is fixed.
+ template <class _PairLike>
+ _LIBCPP_HIDE_FROM_ABI static constexpr bool __pair_like_explicit_wknd() {
+ if constexpr (__pair_like<_PairLike>) {
+ return !is_convertible_v<decltype(std::get<0>(std::declval<_PairLike&&>())), first_type> ||
+ !is_convertible_v<decltype(std::get<1>(std::declval<_PairLike&&>())), second_type>;
}
+ return false;
+ }
+
+ template <__pair_like _PairLike>
+ requires(!__is_specialization_of_subrange<remove_cvref_t<_PairLike>>::value &&
+ is_constructible_v<first_type, decltype(std::get<0>(std::declval<_PairLike &&>()))> &&
+ is_constructible_v<second_type, decltype(std::get<1>(std::declval<_PairLike &&>()))>)
+ _LIBCPP_HIDE_FROM_ABI constexpr explicit(__pair_like_explicit_wknd<_PairLike>()) pair(_PairLike&& __p)
+ : first(std::get<0>(std::forward<_PairLike>(__p))), second(std::get<1>(std::forward<_PairLike>(__p))) {}
+# endif
- template <class _U1, class _U2, __enable_if_t<
- is_assignable<first_type&, _U1>::value &&
- is_assignable<second_type&, _U2>::value
- >* = nullptr>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- pair& operator=(pair<_U1, _U2>&& __p) {
- first = std::forward<_U1>(__p.first);
- second = std::forward<_U2>(__p.second);
- return *this;
- }
+ template <class... _Args1, class... _Args2>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
+ pair(piecewise_construct_t __pc, tuple<_Args1...> __first_args, tuple<_Args2...> __second_args)
+ _NOEXCEPT_((is_nothrow_constructible<first_type, _Args1...>::value &&
+ is_nothrow_constructible<second_type, _Args2...>::value))
+ : pair(__pc,
+ __first_args,
+ __second_args,
+ typename __make_tuple_indices<sizeof...(_Args1)>::type(),
+ typename __make_tuple_indices<sizeof...(_Args2) >::type()) {}
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 pair&
+ operator=(__conditional_t< is_copy_assignable<first_type>::value && is_copy_assignable<second_type>::value,
+ pair,
+ __nat> const& __p)
+ _NOEXCEPT_(is_nothrow_copy_assignable<first_type>::value&& is_nothrow_copy_assignable<second_type>::value) {
+ first = __p.first;
+ second = __p.second;
+ return *this;
+ }
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 pair& operator=(
+ __conditional_t< is_move_assignable<first_type>::value && is_move_assignable<second_type>::value, pair, __nat>&&
+ __p)
+ _NOEXCEPT_(is_nothrow_move_assignable<first_type>::value&& is_nothrow_move_assignable<second_type>::value) {
+ first = std::forward<first_type>(__p.first);
+ second = std::forward<second_type>(__p.second);
+ return *this;
+ }
+
+ template <class _U1,
+ class _U2,
+ __enable_if_t< is_assignable<first_type&, _U1 const&>::value &&
+ is_assignable<second_type&, _U2 const&>::value >* = nullptr>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 pair& operator=(pair<_U1, _U2> const& __p) {
+ first = __p.first;
+ second = __p.second;
+ return *this;
+ }
+
+ template <
+ class _U1,
+ class _U2,
+ __enable_if_t< is_assignable<first_type&, _U1>::value && is_assignable<second_type&, _U2>::value >* = nullptr>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 pair& operator=(pair<_U1, _U2>&& __p) {
+ first = std::forward<_U1>(__p.first);
+ second = std::forward<_U2>(__p.second);
+ return *this;
+ }
# if _LIBCPP_STD_VER >= 23
- _LIBCPP_HIDE_FROM_ABI constexpr
- const pair& operator=(pair const& __p) const
- noexcept(is_nothrow_copy_assignable_v<const first_type> &&
- is_nothrow_copy_assignable_v<const second_type>)
- requires(is_copy_assignable_v<const first_type> &&
- is_copy_assignable_v<const second_type>) {
- first = __p.first;
- second = __p.second;
- return *this;
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr
- const pair& operator=(pair&& __p) const
+ _LIBCPP_HIDE_FROM_ABI constexpr const pair& operator=(pair const& __p) const
+ noexcept(is_nothrow_copy_assignable_v<const first_type> && is_nothrow_copy_assignable_v<const second_type>)
+ requires(is_copy_assignable_v<const first_type> && is_copy_assignable_v<const second_type>)
+ {
+ first = __p.first;
+ second = __p.second;
+ return *this;
+ }
+
+ _LIBCPP_HIDE_FROM_ABI constexpr const pair& operator=(pair&& __p) const
noexcept(is_nothrow_assignable_v<const first_type&, first_type> &&
is_nothrow_assignable_v<const second_type&, second_type>)
- requires(is_assignable_v<const first_type&, first_type> &&
- is_assignable_v<const second_type&, second_type>) {
- first = std::forward<first_type>(__p.first);
- second = std::forward<second_type>(__p.second);
- return *this;
- }
-
- template<class _U1, class _U2>
- _LIBCPP_HIDE_FROM_ABI constexpr
- const pair& operator=(const pair<_U1, _U2>& __p) const
- requires(is_assignable_v<const first_type&, const _U1&> &&
- is_assignable_v<const second_type&, const _U2&>) {
- first = __p.first;
- second = __p.second;
- return *this;
- }
-
- template<class _U1, class _U2>
- _LIBCPP_HIDE_FROM_ABI constexpr
- const pair& operator=(pair<_U1, _U2>&& __p) const
- requires(is_assignable_v<const first_type&, _U1> &&
- is_assignable_v<const second_type&, _U2>) {
- first = std::forward<_U1>(__p.first);
- second = std::forward<_U2>(__p.second);
- return *this;
- }
-
- template <__pair_like _PairLike>
- requires(__different_from<_PairLike, pair> &&
- !__is_specialization_of_subrange<remove_cvref_t<_PairLike>>::value &&
- is_assignable_v<first_type&, decltype(std::get<0>(std::declval<_PairLike>()))> &&
- is_assignable_v<second_type&, decltype(std::get<1>(std::declval<_PairLike>()))>)
- _LIBCPP_HIDE_FROM_ABI constexpr pair& operator=(_PairLike&& __p) {
- first = std::get<0>(std::forward<_PairLike>(__p));
- second = std::get<1>(std::forward<_PairLike>(__p));
- return *this;
- }
-
- template <__pair_like _PairLike>
- requires(__different_from<_PairLike, pair> &&
- !__is_specialization_of_subrange<remove_cvref_t<_PairLike>>::value &&
- is_assignable_v<first_type const&, decltype(std::get<0>(std::declval<_PairLike>()))> &&
- is_assignable_v<second_type const&, decltype(std::get<1>(std::declval<_PairLike>()))>)
- _LIBCPP_HIDE_FROM_ABI constexpr pair const& operator=(_PairLike&& __p) const {
- first = std::get<0>(std::forward<_PairLike>(__p));
- second = std::get<1>(std::forward<_PairLike>(__p));
- return *this;
- }
+ requires(is_assignable_v<const first_type&, first_type> && is_assignable_v<const second_type&, second_type>)
+ {
+ first = std::forward<first_type>(__p.first);
+ second = std::forward<second_type>(__p.second);
+ return *this;
+ }
+
+ template <class _U1, class _U2>
+ _LIBCPP_HIDE_FROM_ABI constexpr const pair& operator=(const pair<_U1, _U2>& __p) const
+ requires(is_assignable_v<const first_type&, const _U1&> && is_assignable_v<const second_type&, const _U2&>)
+ {
+ first = __p.first;
+ second = __p.second;
+ return *this;
+ }
+
+ template <class _U1, class _U2>
+ _LIBCPP_HIDE_FROM_ABI constexpr const pair& operator=(pair<_U1, _U2>&& __p) const
+ requires(is_assignable_v<const first_type&, _U1> && is_assignable_v<const second_type&, _U2>)
+ {
+ first = std::forward<_U1>(__p.first);
+ second = std::forward<_U2>(__p.second);
+ return *this;
+ }
+
+ template <__pair_like _PairLike>
+ requires(__different_from<_PairLike, pair> && !__is_specialization_of_subrange<remove_cvref_t<_PairLike>>::value &&
+ is_assignable_v<first_type&, decltype(std::get<0>(std::declval<_PairLike>()))> &&
+ is_assignable_v<second_type&, decltype(std::get<1>(std::declval<_PairLike>()))>)
+ _LIBCPP_HIDE_FROM_ABI constexpr pair& operator=(_PairLike&& __p) {
+ first = std::get<0>(std::forward<_PairLike>(__p));
+ second = std::get<1>(std::forward<_PairLike>(__p));
+ return *this;
+ }
+
+ template <__pair_like _PairLike>
+ requires(__different_from<_PairLike, pair> && !__is_specialization_of_subrange<remove_cvref_t<_PairLike>>::value &&
+ is_assignable_v<first_type const&, decltype(std::get<0>(std::declval<_PairLike>()))> &&
+ is_assignable_v<second_type const&, decltype(std::get<1>(std::declval<_PairLike>()))>)
+ _LIBCPP_HIDE_FROM_ABI constexpr pair const& operator=(_PairLike&& __p) const {
+ first = std::get<0>(std::forward<_PairLike>(__p));
+ second = std::get<1>(std::forward<_PairLike>(__p));
+ return *this;
+ }
# endif // _LIBCPP_STD_VER >= 23
- // Prior to C++23, we provide an approximation of constructors and assignment operators from
- // pair-like types. This was historically provided as an extension.
-#if _LIBCPP_STD_VER < 23
- // from std::tuple
- template<class _U1, class _U2, __enable_if_t<
- is_convertible<_U1 const&, _T1>::value &&
- is_convertible<_U2 const&, _T2>::value
- >* = nullptr>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
- pair(tuple<_U1, _U2> const& __p)
- : first(std::get<0>(__p)),
- second(std::get<1>(__p)) {}
-
- template<class _U1, class _U2, __enable_if_t<
- is_constructible<_T1, _U1 const&>::value &&
- is_constructible<_T2, _U2 const&>::value &&
- !(is_convertible<_U1 const&, _T1>::value &&
- is_convertible<_U2 const&, _T2>::value)
- >* = nullptr>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
- explicit
- pair(tuple<_U1, _U2> const& __p)
- : first(std::get<0>(__p)),
- second(std::get<1>(__p)) {}
-
- template<class _U1, class _U2, __enable_if_t<
- is_convertible<_U1, _T1>::value &&
- is_convertible<_U2, _T2>::value
- >* = nullptr>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
- pair(tuple<_U1, _U2>&& __p)
- : first(std::get<0>(std::move(__p))),
- second(std::get<1>(std::move(__p))) {}
-
- template<class _U1, class _U2, __enable_if_t<
- is_constructible<_T1, _U1>::value &&
- is_constructible<_T2, _U2>::value &&
- !(is_convertible<_U1, _T1>::value &&
- is_convertible<_U2, _T2>::value)
- >* = nullptr>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
- explicit
- pair(tuple<_U1, _U2>&& __p)
- : first(std::get<0>(std::move(__p))),
- second(std::get<1>(std::move(__p))) {}
-
-
- template<class _U1, class _U2, __enable_if_t<
- is_assignable<_T1&, _U1 const&>::value &&
- is_assignable<_T2&, _U2 const&>::value
- >* = nullptr>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
- pair& operator=(tuple<_U1, _U2> const& __p) {
- first = std::get<0>(__p);
- second = std::get<1>(__p);
- return *this;
- }
-
- template<class _U1, class _U2, __enable_if_t<
- is_assignable<_T1&, _U1&&>::value &&
- is_assignable<_T2&, _U2&&>::value
- >* = nullptr>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
- pair& operator=(tuple<_U1, _U2>&& __p) {
- first = std::get<0>(std::move(__p));
- second = std::get<1>(std::move(__p));
- return *this;
- }
-
- // from std::array
- template<class _Up, __enable_if_t<
- is_convertible<_Up const&, _T1>::value &&
- is_convertible<_Up const&, _T2>::value
- >* = nullptr>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
- pair(array<_Up, 2> const& __p)
- : first(__p[0]),
- second(__p[1]) {}
-
- template<class _Up, __enable_if_t<
- is_constructible<_T1, _Up const&>::value &&
- is_constructible<_T2, _Up const&>::value &&
- !(is_convertible<_Up const&, _T1>::value &&
- is_convertible<_Up const&, _T2>::value)
- >* = nullptr>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
- explicit
- pair(array<_Up, 2> const& __p)
- : first(__p[0]),
- second(__p[1]) {}
-
- template<class _Up, __enable_if_t<
- is_convertible<_Up, _T1>::value &&
- is_convertible<_Up, _T2>::value
- >* = nullptr>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
- pair(array<_Up, 2>&& __p)
- : first(std::move(__p)[0]),
- second(std::move(__p)[1]) {}
-
- template<class _Up, __enable_if_t<
- is_constructible<_T1, _Up>::value &&
- is_constructible<_T2, _Up>::value &&
- !(is_convertible<_Up, _T1>::value &&
- is_convertible<_Up, _T2>::value)
- >* = nullptr>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
- explicit
- pair(array<_Up, 2>&& __p)
- : first(std::move(__p)[0]),
- second(std::move(__p)[1]) {}
-
-
- template<class _Up, __enable_if_t<
- is_assignable<_T1&, _Up const&>::value &&
- is_assignable<_T2&, _Up const&>::value
- >* = nullptr>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
- pair& operator=(array<_Up, 2> const& __p) {
- first = std::get<0>(__p);
- second = std::get<1>(__p);
- return *this;
- }
-
- template<class _Up, __enable_if_t<
- is_assignable<_T1&, _Up>::value &&
- is_assignable<_T2&, _Up>::value
- >* = nullptr>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
- pair& operator=(array<_Up, 2>&& __p) {
- first = std::get<0>(std::move(__p));
- second = std::get<1>(std::move(__p));
- return *this;
- }
-#endif // _LIBCPP_STD_VER < 23
-#endif // _LIBCPP_CXX03_LANG
-
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- void
- swap(pair& __p) _NOEXCEPT_(__is_nothrow_swappable<first_type>::value &&
- __is_nothrow_swappable<second_type>::value)
- {
- using std::swap;
- swap(first, __p.first);
- swap(second, __p.second);
- }
+ // Prior to C++23, we provide an approximation of constructors and assignment operators from
+ // pair-like types. This was historically provided as an extension.
+# if _LIBCPP_STD_VER < 23
+ // from std::tuple
+ template <
+ class _U1,
+ class _U2,
+ __enable_if_t< is_convertible<_U1 const&, _T1>::value && is_convertible<_U2 const&, _T2>::value >* = nullptr>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair(tuple<_U1, _U2> const& __p)
+ : first(std::get<0>(__p)), second(std::get<1>(__p)) {}
+
+ template <
+ class _U1,
+ class _U2,
+ __enable_if_t< is_constructible<_T1, _U1 const&>::value && is_constructible<_T2, _U2 const&>::value &&
+ !(is_convertible<_U1 const&, _T1>::value && is_convertible<_U2 const&, _T2>::value) >* = nullptr>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 explicit pair(tuple<_U1, _U2> const& __p)
+ : first(std::get<0>(__p)), second(std::get<1>(__p)) {}
+
+ template <class _U1,
+ class _U2,
+ __enable_if_t< is_convertible<_U1, _T1>::value && is_convertible<_U2, _T2>::value >* = nullptr>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair(tuple<_U1, _U2>&& __p)
+ : first(std::get<0>(std::move(__p))), second(std::get<1>(std::move(__p))) {}
+
+ template <class _U1,
+ class _U2,
+ __enable_if_t< is_constructible<_T1, _U1>::value && is_constructible<_T2, _U2>::value &&
+ !(is_convertible<_U1, _T1>::value && is_convertible<_U2, _T2>::value) >* = nullptr>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 explicit pair(tuple<_U1, _U2>&& __p)
+ : first(std::get<0>(std::move(__p))), second(std::get<1>(std::move(__p))) {}
+
+ template <
+ class _U1,
+ class _U2,
+ __enable_if_t< is_assignable<_T1&, _U1 const&>::value && is_assignable<_T2&, _U2 const&>::value >* = nullptr>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair& operator=(tuple<_U1, _U2> const& __p) {
+ first = std::get<0>(__p);
+ second = std::get<1>(__p);
+ return *this;
+ }
+
+ template <class _U1,
+ class _U2,
+ __enable_if_t< is_assignable<_T1&, _U1&&>::value && is_assignable<_T2&, _U2&&>::value >* = nullptr>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair& operator=(tuple<_U1, _U2>&& __p) {
+ first = std::get<0>(std::move(__p));
+ second = std::get<1>(std::move(__p));
+ return *this;
+ }
+
+ // from std::array
+ template <
+ class _Up,
+ __enable_if_t< is_convertible<_Up const&, _T1>::value && is_convertible<_Up const&, _T2>::value >* = nullptr>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair(array<_Up, 2> const& __p) : first(__p[0]), second(__p[1]) {}
+
+ template <
+ class _Up,
+ __enable_if_t< is_constructible<_T1, _Up const&>::value && is_constructible<_T2, _Up const&>::value &&
+ !(is_convertible<_Up const&, _T1>::value && is_convertible<_Up const&, _T2>::value) >* = nullptr>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 explicit pair(array<_Up, 2> const& __p)
+ : first(__p[0]), second(__p[1]) {}
+
+ template <class _Up, __enable_if_t< is_convertible<_Up, _T1>::value && is_convertible<_Up, _T2>::value >* = nullptr>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair(array<_Up, 2>&& __p)
+ : first(std::move(__p)[0]), second(std::move(__p)[1]) {}
+
+ template <class _Up,
+ __enable_if_t< is_constructible<_T1, _Up>::value && is_constructible<_T2, _Up>::value &&
+ !(is_convertible<_Up, _T1>::value && is_convertible<_Up, _T2>::value) >* = nullptr>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 explicit pair(array<_Up, 2>&& __p)
+ : first(std::move(__p)[0]), second(std::move(__p)[1]) {}
+
+ template <
+ class _Up,
+ __enable_if_t< is_assignable<_T1&, _Up const&>::value && is_assignable<_T2&, _Up const&>::value >* = nullptr>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair& operator=(array<_Up, 2> const& __p) {
+ first = std::get<0>(__p);
+ second = std::get<1>(__p);
+ return *this;
+ }
+
+ template <class _Up, __enable_if_t< is_assignable<_T1&, _Up>::value && is_assignable<_T2&, _Up>::value >* = nullptr>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair& operator=(array<_Up, 2>&& __p) {
+ first = std::get<0>(std::move(__p));
+ second = std::get<1>(std::move(__p));
+ return *this;
+ }
+# endif // _LIBCPP_STD_VER < 23
+#endif // _LIBCPP_CXX03_LANG
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void swap(pair& __p)
+ _NOEXCEPT_(__is_nothrow_swappable<first_type>::value&& __is_nothrow_swappable<second_type>::value) {
+ using std::swap;
+ swap(first, __p.first);
+ swap(second, __p.second);
+ }
#if _LIBCPP_STD_VER >= 23
- _LIBCPP_HIDE_FROM_ABI constexpr
- void swap(const pair& __p) const
- noexcept(__is_nothrow_swappable<const first_type>::value &&
- __is_nothrow_swappable<const second_type>::value)
- {
- using std::swap;
- swap(first, __p.first);
- swap(second, __p.second);
- }
+ _LIBCPP_HIDE_FROM_ABI constexpr void swap(const pair& __p) const
+ noexcept(__is_nothrow_swappable<const first_type>::value && __is_nothrow_swappable<const second_type>::value) {
+ using std::swap;
+ swap(first, __p.first);
+ swap(second, __p.second);
+ }
#endif
-private:
+private:
#ifndef _LIBCPP_CXX03_LANG
- template <class... _Args1, class... _Args2, size_t... _I1, size_t... _I2>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- pair(piecewise_construct_t,
- tuple<_Args1...>& __first_args, tuple<_Args2...>& __second_args,
- __tuple_indices<_I1...>, __tuple_indices<_I2...>);
+ template <class... _Args1, class... _Args2, size_t... _I1, size_t... _I2>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
+ pair(piecewise_construct_t,
+ tuple<_Args1...>& __first_args,
+ tuple<_Args2...>& __second_args,
+ __tuple_indices<_I1...>,
+ __tuple_indices<_I2...>);
#endif
};
#if _LIBCPP_STD_VER >= 17
-template<class _T1, class _T2>
+template <class _T1, class _T2>
pair(_T1, _T2) -> pair<_T1, _T2>;
#endif
// [pairs.spec], specialized algorithms
template <class _T1, class _T2, class _U1, class _U2>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
-bool
-operator==(const pair<_T1,_T2>& __x, const pair<_U1,_U2>& __y)
-{
- return __x.first == __y.first && __x.second == __y.second;
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 bool
+operator==(const pair<_T1, _T2>& __x, const pair<_U1, _U2>& __y) {
+ return __x.first == __y.first && __x.second == __y.second;
}
#if _LIBCPP_STD_VER >= 20
template <class _T1, class _T2, class _U1, class _U2>
-_LIBCPP_HIDE_FROM_ABI constexpr
-common_comparison_category_t<
- __synth_three_way_result<_T1, _U1>,
- __synth_three_way_result<_T2, _U2> >
-operator<=>(const pair<_T1,_T2>& __x, const pair<_U1,_U2>& __y)
-{
- if (auto __c = std::__synth_three_way(__x.first, __y.first); __c != 0) {
- return __c;
- }
- return std::__synth_three_way(__x.second, __y.second);
+_LIBCPP_HIDE_FROM_ABI constexpr common_comparison_category_t< __synth_three_way_result<_T1, _U1>,
+ __synth_three_way_result<_T2, _U2> >
+operator<=>(const pair<_T1, _T2>& __x, const pair<_U1, _U2>& __y) {
+ if (auto __c = std::__synth_three_way(__x.first, __y.first); __c != 0) {
+ return __c;
+ }
+ return std::__synth_three_way(__x.second, __y.second);
}
#else // _LIBCPP_STD_VER >= 20
template <class _T1, class _T2, class _U1, class _U2>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
-bool
-operator!=(const pair<_T1,_T2>& __x, const pair<_U1,_U2>& __y)
-{
- return !(__x == __y);
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 bool
+operator!=(const pair<_T1, _T2>& __x, const pair<_U1, _U2>& __y) {
+ return !(__x == __y);
}
template <class _T1, class _T2, class _U1, class _U2>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
-bool
-operator< (const pair<_T1,_T2>& __x, const pair<_U1,_U2>& __y)
-{
- return __x.first < __y.first || (!(__y.first < __x.first) && __x.second < __y.second);
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 bool
+operator<(const pair<_T1, _T2>& __x, const pair<_U1, _U2>& __y) {
+ return __x.first < __y.first || (!(__y.first < __x.first) && __x.second < __y.second);
}
template <class _T1, class _T2, class _U1, class _U2>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
-bool
-operator> (const pair<_T1,_T2>& __x, const pair<_U1,_U2>& __y)
-{
- return __y < __x;
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 bool
+operator>(const pair<_T1, _T2>& __x, const pair<_U1, _U2>& __y) {
+ return __y < __x;
}
template <class _T1, class _T2, class _U1, class _U2>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
-bool
-operator>=(const pair<_T1,_T2>& __x, const pair<_U1,_U2>& __y)
-{
- return !(__x < __y);
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 bool
+operator>=(const pair<_T1, _T2>& __x, const pair<_U1, _U2>& __y) {
+ return !(__x < __y);
}
template <class _T1, class _T2, class _U1, class _U2>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
-bool
-operator<=(const pair<_T1,_T2>& __x, const pair<_U1,_U2>& __y)
-{
- return !(__y < __x);
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 bool
+operator<=(const pair<_T1, _T2>& __x, const pair<_U1, _U2>& __y) {
+ return !(__y < __x);
}
#endif // _LIBCPP_STD_VER >= 20
#if _LIBCPP_STD_VER >= 23
-template <class _T1, class _T2, class _U1, class _U2, template<class> class _TQual, template<class> class _UQual>
- requires requires { typename pair<common_reference_t<_TQual<_T1>, _UQual<_U1>>,
- common_reference_t<_TQual<_T2>, _UQual<_U2>>>; }
+template <class _T1, class _T2, class _U1, class _U2, template <class> class _TQual, template <class> class _UQual>
+ requires requires {
+ typename pair<common_reference_t<_TQual<_T1>, _UQual<_U1>>, common_reference_t<_TQual<_T2>, _UQual<_U2>>>;
+ }
struct basic_common_reference<pair<_T1, _T2>, pair<_U1, _U2>, _TQual, _UQual> {
- using type = pair<common_reference_t<_TQual<_T1>, _UQual<_U1>>,
- common_reference_t<_TQual<_T2>, _UQual<_U2>>>;
+ using type = pair<common_reference_t<_TQual<_T1>, _UQual<_U1>>, common_reference_t<_TQual<_T2>, _UQual<_U2>>>;
};
template <class _T1, class _T2, class _U1, class _U2>
- requires requires { typename pair<common_type_t<_T1, _U1>, common_type_t<_T2, _U2>>; }
+ requires requires { typename pair<common_type_t<_T1, _U1>, common_type_t<_T2, _U2>>; }
struct common_type<pair<_T1, _T2>, pair<_U1, _U2>> {
- using type = pair<common_type_t<_T1, _U1>, common_type_t<_T2, _U2>>;
+ using type = pair<common_type_t<_T1, _U1>, common_type_t<_T2, _U2>>;
};
#endif // _LIBCPP_STD_VER >= 23
template <class _T1, class _T2, __enable_if_t<__is_swappable<_T1>::value && __is_swappable<_T2>::value, int> = 0>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-void
-swap(pair<_T1, _T2>& __x, pair<_T1, _T2>& __y)
- _NOEXCEPT_((__is_nothrow_swappable<_T1>::value &&
- __is_nothrow_swappable<_T2>::value))
-{
- __x.swap(__y);
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void swap(pair<_T1, _T2>& __x, pair<_T1, _T2>& __y)
+ _NOEXCEPT_((__is_nothrow_swappable<_T1>::value && __is_nothrow_swappable<_T2>::value)) {
+ __x.swap(__y);
}
#if _LIBCPP_STD_VER >= 23
template <class _T1, class _T2>
- requires (__is_swappable<const _T1>::value &&
- __is_swappable<const _T2>::value)
-_LIBCPP_HIDE_FROM_ABI constexpr
-void swap(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
- noexcept(noexcept(__x.swap(__y)))
-{
- __x.swap(__y);
+ requires(__is_swappable<const _T1>::value && __is_swappable<const _T2>::value)
+_LIBCPP_HIDE_FROM_ABI constexpr void
+swap(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) noexcept(noexcept(__x.swap(__y))) {
+ __x.swap(__y);
}
#endif
template <class _T1, class _T2>
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
-pair<typename __unwrap_ref_decay<_T1>::type, typename __unwrap_ref_decay<_T2>::type>
-make_pair(_T1&& __t1, _T2&& __t2)
-{
- return pair<typename __unwrap_ref_decay<_T1>::type, typename __unwrap_ref_decay<_T2>::type>
- (std::forward<_T1>(__t1), std::forward<_T2>(__t2));
+ pair<typename __unwrap_ref_decay<_T1>::type, typename __unwrap_ref_decay<_T2>::type>
+ make_pair(_T1&& __t1, _T2&& __t2) {
+ return pair<typename __unwrap_ref_decay<_T1>::type, typename __unwrap_ref_decay<_T2>::type>(
+ std::forward<_T1>(__t1), std::forward<_T2>(__t2));
}
template <class _T1, class _T2>
- struct _LIBCPP_TEMPLATE_VIS tuple_size<pair<_T1, _T2> >
- : public integral_constant<size_t, 2> {};
+struct _LIBCPP_TEMPLATE_VIS tuple_size<pair<_T1, _T2> > : public integral_constant<size_t, 2> {};
template <size_t _Ip, class _T1, class _T2>
-struct _LIBCPP_TEMPLATE_VIS tuple_element<_Ip, pair<_T1, _T2> >
-{
- static_assert(_Ip < 2, "Index out of bounds in std::tuple_element<std::pair<T1, T2>>");
+struct _LIBCPP_TEMPLATE_VIS tuple_element<_Ip, pair<_T1, _T2> > {
+ static_assert(_Ip < 2, "Index out of bounds in std::tuple_element<std::pair<T1, T2>>");
};
template <class _T1, class _T2>
-struct _LIBCPP_TEMPLATE_VIS tuple_element<0, pair<_T1, _T2> >
-{
- using type _LIBCPP_NODEBUG = _T1;
+struct _LIBCPP_TEMPLATE_VIS tuple_element<0, pair<_T1, _T2> > {
+ using type _LIBCPP_NODEBUG = _T1;
};
template <class _T1, class _T2>
-struct _LIBCPP_TEMPLATE_VIS tuple_element<1, pair<_T1, _T2> >
-{
- using type _LIBCPP_NODEBUG = _T2;
+struct _LIBCPP_TEMPLATE_VIS tuple_element<1, pair<_T1, _T2> > {
+ using type _LIBCPP_NODEBUG = _T2;
};
-template <size_t _Ip> struct __get_pair;
+template <size_t _Ip>
+struct __get_pair;
template <>
-struct __get_pair<0>
-{
- template <class _T1, class _T2>
- static
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
- _T1&
- get(pair<_T1, _T2>& __p) _NOEXCEPT {return __p.first;}
-
- template <class _T1, class _T2>
- static
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
- const _T1&
- get(const pair<_T1, _T2>& __p) _NOEXCEPT {return __p.first;}
-
- template <class _T1, class _T2>
- static
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
- _T1&&
- get(pair<_T1, _T2>&& __p) _NOEXCEPT {return std::forward<_T1>(__p.first);}
-
- template <class _T1, class _T2>
- static
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
- const _T1&&
- get(const pair<_T1, _T2>&& __p) _NOEXCEPT {return std::forward<const _T1>(__p.first);}
+struct __get_pair<0> {
+ template <class _T1, class _T2>
+ static _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _T1& get(pair<_T1, _T2>& __p) _NOEXCEPT {
+ return __p.first;
+ }
+
+ template <class _T1, class _T2>
+ static _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 const _T1& get(const pair<_T1, _T2>& __p) _NOEXCEPT {
+ return __p.first;
+ }
+
+ template <class _T1, class _T2>
+ static _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _T1&& get(pair<_T1, _T2>&& __p) _NOEXCEPT {
+ return std::forward<_T1>(__p.first);
+ }
+
+ template <class _T1, class _T2>
+ static _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 const _T1&& get(const pair<_T1, _T2>&& __p) _NOEXCEPT {
+ return std::forward<const _T1>(__p.first);
+ }
};
template <>
-struct __get_pair<1>
-{
- template <class _T1, class _T2>
- static
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
- _T2&
- get(pair<_T1, _T2>& __p) _NOEXCEPT {return __p.second;}
-
- template <class _T1, class _T2>
- static
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
- const _T2&
- get(const pair<_T1, _T2>& __p) _NOEXCEPT {return __p.second;}
-
- template <class _T1, class _T2>
- static
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
- _T2&&
- get(pair<_T1, _T2>&& __p) _NOEXCEPT {return std::forward<_T2>(__p.second);}
-
- template <class _T1, class _T2>
- static
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
- const _T2&&
- get(const pair<_T1, _T2>&& __p) _NOEXCEPT {return std::forward<const _T2>(__p.second);}
+struct __get_pair<1> {
+ template <class _T1, class _T2>
+ static _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _T2& get(pair<_T1, _T2>& __p) _NOEXCEPT {
+ return __p.second;
+ }
+
+ template <class _T1, class _T2>
+ static _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 const _T2& get(const pair<_T1, _T2>& __p) _NOEXCEPT {
+ return __p.second;
+ }
+
+ template <class _T1, class _T2>
+ static _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _T2&& get(pair<_T1, _T2>&& __p) _NOEXCEPT {
+ return std::forward<_T2>(__p.second);
+ }
+
+ template <class _T1, class _T2>
+ static _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 const _T2&& get(const pair<_T1, _T2>&& __p) _NOEXCEPT {
+ return std::forward<const _T2>(__p.second);
+ }
};
template <size_t _Ip, class _T1, class _T2>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
-typename tuple_element<_Ip, pair<_T1, _T2> >::type&
-get(pair<_T1, _T2>& __p) _NOEXCEPT
-{
- return __get_pair<_Ip>::get(__p);
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 typename tuple_element<_Ip, pair<_T1, _T2> >::type&
+get(pair<_T1, _T2>& __p) _NOEXCEPT {
+ return __get_pair<_Ip>::get(__p);
}
template <size_t _Ip, class _T1, class _T2>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
-const typename tuple_element<_Ip, pair<_T1, _T2> >::type&
-get(const pair<_T1, _T2>& __p) _NOEXCEPT
-{
- return __get_pair<_Ip>::get(__p);
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 const typename tuple_element<_Ip, pair<_T1, _T2> >::type&
+get(const pair<_T1, _T2>& __p) _NOEXCEPT {
+ return __get_pair<_Ip>::get(__p);
}
template <size_t _Ip, class _T1, class _T2>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
-typename tuple_element<_Ip, pair<_T1, _T2> >::type&&
-get(pair<_T1, _T2>&& __p) _NOEXCEPT
-{
- return __get_pair<_Ip>::get(std::move(__p));
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 typename tuple_element<_Ip, pair<_T1, _T2> >::type&&
+get(pair<_T1, _T2>&& __p) _NOEXCEPT {
+ return __get_pair<_Ip>::get(std::move(__p));
}
template <size_t _Ip, class _T1, class _T2>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
-const typename tuple_element<_Ip, pair<_T1, _T2> >::type&&
-get(const pair<_T1, _T2>&& __p) _NOEXCEPT
-{
- return __get_pair<_Ip>::get(std::move(__p));
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 const typename tuple_element<_Ip, pair<_T1, _T2> >::type&&
+get(const pair<_T1, _T2>&& __p) _NOEXCEPT {
+ return __get_pair<_Ip>::get(std::move(__p));
}
#if _LIBCPP_STD_VER >= 14
template <class _T1, class _T2>
-inline _LIBCPP_HIDE_FROM_ABI
-constexpr _T1 & get(pair<_T1, _T2>& __p) _NOEXCEPT
-{
- return __get_pair<0>::get(__p);
+inline _LIBCPP_HIDE_FROM_ABI constexpr _T1& get(pair<_T1, _T2>& __p) _NOEXCEPT {
+ return __get_pair<0>::get(__p);
}
template <class _T1, class _T2>
-inline _LIBCPP_HIDE_FROM_ABI
-constexpr _T1 const & get(pair<_T1, _T2> const& __p) _NOEXCEPT
-{
- return __get_pair<0>::get(__p);
+inline _LIBCPP_HIDE_FROM_ABI constexpr _T1 const& get(pair<_T1, _T2> const& __p) _NOEXCEPT {
+ return __get_pair<0>::get(__p);
}
template <class _T1, class _T2>
-inline _LIBCPP_HIDE_FROM_ABI
-constexpr _T1 && get(pair<_T1, _T2>&& __p) _NOEXCEPT
-{
- return __get_pair<0>::get(std::move(__p));
+inline _LIBCPP_HIDE_FROM_ABI constexpr _T1&& get(pair<_T1, _T2>&& __p) _NOEXCEPT {
+ return __get_pair<0>::get(std::move(__p));
}
template <class _T1, class _T2>
-inline _LIBCPP_HIDE_FROM_ABI
-constexpr _T1 const && get(pair<_T1, _T2> const&& __p) _NOEXCEPT
-{
- return __get_pair<0>::get(std::move(__p));
+inline _LIBCPP_HIDE_FROM_ABI constexpr _T1 const&& get(pair<_T1, _T2> const&& __p) _NOEXCEPT {
+ return __get_pair<0>::get(std::move(__p));
}
template <class _T1, class _T2>
-inline _LIBCPP_HIDE_FROM_ABI
-constexpr _T1 & get(pair<_T2, _T1>& __p) _NOEXCEPT
-{
- return __get_pair<1>::get(__p);
+inline _LIBCPP_HIDE_FROM_ABI constexpr _T1& get(pair<_T2, _T1>& __p) _NOEXCEPT {
+ return __get_pair<1>::get(__p);
}
template <class _T1, class _T2>
-inline _LIBCPP_HIDE_FROM_ABI
-constexpr _T1 const & get(pair<_T2, _T1> const& __p) _NOEXCEPT
-{
- return __get_pair<1>::get(__p);
+inline _LIBCPP_HIDE_FROM_ABI constexpr _T1 const& get(pair<_T2, _T1> const& __p) _NOEXCEPT {
+ return __get_pair<1>::get(__p);
}
template <class _T1, class _T2>
-inline _LIBCPP_HIDE_FROM_ABI
-constexpr _T1 && get(pair<_T2, _T1>&& __p) _NOEXCEPT
-{
- return __get_pair<1>::get(std::move(__p));
+inline _LIBCPP_HIDE_FROM_ABI constexpr _T1&& get(pair<_T2, _T1>&& __p) _NOEXCEPT {
+ return __get_pair<1>::get(std::move(__p));
}
template <class _T1, class _T2>
-inline _LIBCPP_HIDE_FROM_ABI
-constexpr _T1 const && get(pair<_T2, _T1> const&& __p) _NOEXCEPT
-{
- return __get_pair<1>::get(std::move(__p));
+inline _LIBCPP_HIDE_FROM_ABI constexpr _T1 const&& get(pair<_T2, _T1> const&& __p) _NOEXCEPT {
+ return __get_pair<1>::get(std::move(__p));
}
#endif // _LIBCPP_STD_VER >= 14
diff --git a/contrib/llvm-project/libcxx/include/__utility/piecewise_construct.h b/contrib/llvm-project/libcxx/include/__utility/piecewise_construct.h
index ad86badb66c8..52b19d791e10 100644
--- a/contrib/llvm-project/libcxx/include/__utility/piecewise_construct.h
+++ b/contrib/llvm-project/libcxx/include/__utility/piecewise_construct.h
@@ -17,7 +17,9 @@
_LIBCPP_BEGIN_NAMESPACE_STD
-struct _LIBCPP_TEMPLATE_VIS piecewise_construct_t { explicit piecewise_construct_t() = default; };
+struct _LIBCPP_TEMPLATE_VIS piecewise_construct_t {
+ explicit piecewise_construct_t() = default;
+};
#if _LIBCPP_STD_VER >= 17
inline constexpr piecewise_construct_t piecewise_construct = piecewise_construct_t();
diff --git a/contrib/llvm-project/libcxx/include/__utility/priority_tag.h b/contrib/llvm-project/libcxx/include/__utility/priority_tag.h
index e51ba6bfcc05..a159ce7f1afb 100644
--- a/contrib/llvm-project/libcxx/include/__utility/priority_tag.h
+++ b/contrib/llvm-project/libcxx/include/__utility/priority_tag.h
@@ -18,8 +18,10 @@
_LIBCPP_BEGIN_NAMESPACE_STD
-template<size_t _Ip> struct __priority_tag : __priority_tag<_Ip - 1> {};
-template<> struct __priority_tag<0> {};
+template <size_t _Ip>
+struct __priority_tag : __priority_tag<_Ip - 1> {};
+template <>
+struct __priority_tag<0> {};
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__utility/rel_ops.h b/contrib/llvm-project/libcxx/include/__utility/rel_ops.h
index de9fb20b8d52..ee8657196d98 100644
--- a/contrib/llvm-project/libcxx/include/__utility/rel_ops.h
+++ b/contrib/llvm-project/libcxx/include/__utility/rel_ops.h
@@ -17,39 +17,26 @@
_LIBCPP_BEGIN_NAMESPACE_STD
-namespace rel_ops
-{
-
-template<class _Tp>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator!=(const _Tp& __x, const _Tp& __y)
-{
- return !(__x == __y);
+namespace rel_ops {
+
+template <class _Tp>
+inline _LIBCPP_HIDE_FROM_ABI bool operator!=(const _Tp& __x, const _Tp& __y) {
+ return !(__x == __y);
}
-template<class _Tp>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator> (const _Tp& __x, const _Tp& __y)
-{
- return __y < __x;
+template <class _Tp>
+inline _LIBCPP_HIDE_FROM_ABI bool operator>(const _Tp& __x, const _Tp& __y) {
+ return __y < __x;
}
-template<class _Tp>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator<=(const _Tp& __x, const _Tp& __y)
-{
- return !(__y < __x);
+template <class _Tp>
+inline _LIBCPP_HIDE_FROM_ABI bool operator<=(const _Tp& __x, const _Tp& __y) {
+ return !(__y < __x);
}
-template<class _Tp>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator>=(const _Tp& __x, const _Tp& __y)
-{
- return !(__x < __y);
+template <class _Tp>
+inline _LIBCPP_HIDE_FROM_ABI bool operator>=(const _Tp& __x, const _Tp& __y) {
+ return !(__x < __y);
}
} // namespace rel_ops
diff --git a/contrib/llvm-project/libcxx/include/__utility/to_underlying.h b/contrib/llvm-project/libcxx/include/__utility/to_underlying.h
index 114e088c1692..5fdf0f255e57 100644
--- a/contrib/llvm-project/libcxx/include/__utility/to_underlying.h
+++ b/contrib/llvm-project/libcxx/include/__utility/to_underlying.h
@@ -21,16 +21,14 @@ _LIBCPP_BEGIN_NAMESPACE_STD
#ifndef _LIBCPP_CXX03_LANG
template <class _Tp>
-_LIBCPP_HIDE_FROM_ABI constexpr typename underlying_type<_Tp>::type
-__to_underlying(_Tp __val) noexcept {
+_LIBCPP_HIDE_FROM_ABI constexpr typename underlying_type<_Tp>::type __to_underlying(_Tp __val) noexcept {
return static_cast<typename underlying_type<_Tp>::type>(__val);
}
#endif // !_LIBCPP_CXX03_LANG
#if _LIBCPP_STD_VER >= 23
template <class _Tp>
-_LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr underlying_type_t<_Tp>
-to_underlying(_Tp __val) noexcept {
+_LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr underlying_type_t<_Tp> to_underlying(_Tp __val) noexcept {
return std::__to_underlying(__val);
}
#endif
diff --git a/contrib/llvm-project/libcxx/include/__utility/unreachable.h b/contrib/llvm-project/libcxx/include/__utility/unreachable.h
index 4a21b74b1973..49334decc8f6 100644
--- a/contrib/llvm-project/libcxx/include/__utility/unreachable.h
+++ b/contrib/llvm-project/libcxx/include/__utility/unreachable.h
@@ -19,8 +19,8 @@
_LIBCPP_BEGIN_NAMESPACE_STD
_LIBCPP_NORETURN _LIBCPP_HIDE_FROM_ABI inline void __libcpp_unreachable() {
- _LIBCPP_ASSERT_UNCATEGORIZED(false, "std::unreachable() was reached");
- __builtin_unreachable();
+ _LIBCPP_ASSERT_UNCATEGORIZED(false, "std::unreachable() was reached");
+ __builtin_unreachable();
}
#if _LIBCPP_STD_VER >= 23
diff --git a/contrib/llvm-project/libcxx/include/__variant/monostate.h b/contrib/llvm-project/libcxx/include/__variant/monostate.h
index 2944e41ac704..16f156609eb7 100644
--- a/contrib/llvm-project/libcxx/include/__variant/monostate.h
+++ b/contrib/llvm-project/libcxx/include/__variant/monostate.h
@@ -50,7 +50,7 @@ _LIBCPP_HIDE_FROM_ABI inline constexpr bool operator>=(monostate, monostate) noe
template <>
struct _LIBCPP_TEMPLATE_VIS hash<monostate> {
using argument_type = monostate;
- using result_type = size_t;
+ using result_type = size_t;
inline _LIBCPP_HIDE_FROM_ABI result_type operator()(const argument_type&) const _NOEXCEPT {
return 66740831; // return a fundamentally attractive random value.
diff --git a/contrib/llvm-project/libcxx/include/__verbose_abort b/contrib/llvm-project/libcxx/include/__verbose_abort
index 54c691670607..259c70dda8fe 100644
--- a/contrib/llvm-project/libcxx/include/__verbose_abort
+++ b/contrib/llvm-project/libcxx/include/__verbose_abort
@@ -21,8 +21,8 @@ _LIBCPP_BEGIN_NAMESPACE_STD
// This function should never be called directly from the code -- it should only be called through
// the _LIBCPP_VERBOSE_ABORT macro.
-_LIBCPP_NORETURN _LIBCPP_AVAILABILITY_VERBOSE_ABORT _LIBCPP_OVERRIDABLE_FUNC_VIS _LIBCPP_ATTRIBUTE_FORMAT(__printf__, 1, 2)
-void __libcpp_verbose_abort(const char *__format, ...);
+_LIBCPP_NORETURN _LIBCPP_AVAILABILITY_VERBOSE_ABORT _LIBCPP_OVERRIDABLE_FUNC_VIS
+ _LIBCPP_ATTRIBUTE_FORMAT(__printf__, 1, 2) void __libcpp_verbose_abort(const char* __format, ...);
// _LIBCPP_VERBOSE_ABORT(format, args...)
//
diff --git a/contrib/llvm-project/libcxx/include/algorithm b/contrib/llvm-project/libcxx/include/algorithm
index 627e7d20213f..1176602a2b69 100644
--- a/contrib/llvm-project/libcxx/include/algorithm
+++ b/contrib/llvm-project/libcxx/include/algorithm
@@ -42,6 +42,9 @@ namespace ranges {
template <class I>
struct in_found_result; // since C++20
+ template <class I, class T>
+ struct in_value_result; // since C++23
+
template<forward_iterator I, sentinel_for<I> S, class Proj = identity,
indirect_strict_weak_order<projected<I, Proj>> Comp = ranges::less> // since C++20
constexpr I min_element(I first, S last, Comp comp = {}, Proj proj = {});
@@ -226,6 +229,14 @@ namespace ranges {
template<class I1, class I2>
using copy_backward_result = in_out_result<I1, I2>; // since C++20
+ template<input_iterator I, sentinel_for<I> S, class T, class Proj = identity>
+ requires indirect_binary_predicate<ranges::equal_to, projected<I, Proj>, const T*>
+ constexpr bool ranges::contains(I first, S last, const T& value, Proj proj = {}); // since C++23
+
+ template<input_range R, class T, class Proj = identity>
+ requires indirect_binary_predicate<ranges::equal_to, projected<iterator_t<R>, Proj>, const T*>
+ constexpr bool ranges::contains(R&& r, const T& value, Proj proj = {}); // since C++23
+
template<input_iterator I, sentinel_for<I> S, weakly_incrementable O>
requires indirectly_copyable<I, O>
constexpr ranges::copy_result<I, O> ranges::copy(I first, S last, O result); // since C++20
@@ -873,6 +884,23 @@ namespace ranges {
ranges::search_n(R&& r, range_difference_t<R> count,
const T& value, Pred pred = {}, Proj proj = {}); // since C++20
+ template<input_iterator I, sentinel_for<I> S, class T,
+ indirectly-binary-left-foldable<T, I> F>
+ constexpr auto ranges::fold_left(I first, S last, T init, F f); // since C++23
+
+ template<input_range R, class T, indirectly-binary-left-foldable<T, iterator_t<R>> F>
+ constexpr auto fold_left(R&& r, T init, F f); // since C++23
+
+ template<class I, class T>
+ using fold_left_with_iter_result = in_value_result<I, T>; // since C++23
+
+ template<input_iterator I, sentinel_for<I> S, class T,
+ indirectly-binary-left-foldable<T, I> F>
+ constexpr see below fold_left_with_iter(I first, S last, T init, F f); // since C++23
+
+ template<input_range R, class T, indirectly-binary-left-foldable<T, iterator_t<R>> F>
+ constexpr see below fold_left_with_iter(R&& r, T init, F f); // since C++23
+
template<forward_iterator I1, sentinel_for<I1> S1, forward_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>
@@ -1778,6 +1806,7 @@ template <class BidirectionalIterator, class Compare>
#include <__algorithm/find_first_of.h>
#include <__algorithm/find_if.h>
#include <__algorithm/find_if_not.h>
+#include <__algorithm/fold.h>
#include <__algorithm/for_each.h>
#include <__algorithm/for_each_n.h>
#include <__algorithm/generate.h>
@@ -1845,6 +1874,7 @@ template <class BidirectionalIterator, class Compare>
#include <__algorithm/ranges_any_of.h>
#include <__algorithm/ranges_binary_search.h>
#include <__algorithm/ranges_clamp.h>
+#include <__algorithm/ranges_contains.h>
#include <__algorithm/ranges_copy.h>
#include <__algorithm/ranges_copy_backward.h>
#include <__algorithm/ranges_copy_if.h>
diff --git a/contrib/llvm-project/libcxx/include/any b/contrib/llvm-project/libcxx/include/any
index 7dcffc46a60d..b9e0a8d94550 100644
--- a/contrib/llvm-project/libcxx/include/any
+++ b/contrib/llvm-project/libcxx/include/any
@@ -118,10 +118,9 @@ _LIBCPP_PUSH_MACROS
#include <__undef_macros>
namespace std {
-class _LIBCPP_EXPORTED_FROM_ABI _LIBCPP_AVAILABILITY_BAD_ANY_CAST bad_any_cast : public bad_cast
-{
+class _LIBCPP_EXPORTED_FROM_ABI _LIBCPP_AVAILABILITY_BAD_ANY_CAST bad_any_cast : public bad_cast {
public:
- const char* what() const _NOEXCEPT override;
+ const char* what() const _NOEXCEPT override;
};
} // namespace std
@@ -129,580 +128,465 @@ _LIBCPP_BEGIN_NAMESPACE_STD
#if _LIBCPP_STD_VER >= 17
-_LIBCPP_NORETURN inline _LIBCPP_HIDE_FROM_ABI
-_LIBCPP_AVAILABILITY_THROW_BAD_ANY_CAST
-void __throw_bad_any_cast()
-{
-#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- throw bad_any_cast();
-#else
- _LIBCPP_VERBOSE_ABORT("bad_any_cast was thrown in -fno-exceptions mode");
-#endif
+_LIBCPP_NORETURN inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_THROW_BAD_ANY_CAST void __throw_bad_any_cast() {
+# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
+ throw bad_any_cast();
+# else
+ _LIBCPP_VERBOSE_ABORT("bad_any_cast was thrown in -fno-exceptions mode");
+# endif
}
// Forward declarations
class _LIBCPP_TEMPLATE_VIS any;
template <class _ValueType>
-_LIBCPP_HIDE_FROM_ABI
-add_pointer_t<add_const_t<_ValueType>>
-any_cast(any const *) _NOEXCEPT;
+_LIBCPP_HIDE_FROM_ABI add_pointer_t<add_const_t<_ValueType>> any_cast(any const*) _NOEXCEPT;
template <class _ValueType>
-_LIBCPP_HIDE_FROM_ABI
-add_pointer_t<_ValueType> any_cast(any *) _NOEXCEPT;
-
-namespace __any_imp
-{
- _LIBCPP_SUPPRESS_DEPRECATED_PUSH
- using _Buffer = aligned_storage_t<3*sizeof(void*), alignof(void*)>;
- _LIBCPP_SUPPRESS_DEPRECATED_POP
-
- template <class _Tp>
- using _IsSmallObject = integral_constant<bool
- , sizeof(_Tp) <= sizeof(_Buffer)
- && alignof(_Buffer) % alignof(_Tp) == 0
- && is_nothrow_move_constructible<_Tp>::value
- >;
-
- enum class _Action {
- _Destroy,
- _Copy,
- _Move,
- _Get,
- _TypeInfo
- };
+_LIBCPP_HIDE_FROM_ABI add_pointer_t<_ValueType> any_cast(any*) _NOEXCEPT;
- template <class _Tp> struct _SmallHandler;
- template <class _Tp> struct _LargeHandler;
+namespace __any_imp {
+_LIBCPP_SUPPRESS_DEPRECATED_PUSH
+using _Buffer = aligned_storage_t<3 * sizeof(void*), alignof(void*)>;
+_LIBCPP_SUPPRESS_DEPRECATED_POP
- template <class _Tp>
- struct _LIBCPP_TEMPLATE_VIS __unique_typeinfo { static constexpr int __id = 0; };
- template <class _Tp> constexpr int __unique_typeinfo<_Tp>::__id;
+template <class _Tp>
+using _IsSmallObject =
+ integral_constant<bool,
+ sizeof(_Tp) <= sizeof(_Buffer) && alignof(_Buffer) % alignof(_Tp) == 0 &&
+ is_nothrow_move_constructible<_Tp>::value >;
- template <class _Tp>
- inline _LIBCPP_HIDE_FROM_ABI
- constexpr const void* __get_fallback_typeid() {
- return &__unique_typeinfo<remove_cv_t<remove_reference_t<_Tp>>>::__id;
- }
+enum class _Action { _Destroy, _Copy, _Move, _Get, _TypeInfo };
- template <class _Tp>
- inline _LIBCPP_HIDE_FROM_ABI
- bool __compare_typeid(type_info const* __id, const void* __fallback_id)
- {
-#if !defined(_LIBCPP_HAS_NO_RTTI)
- if (__id && *__id == typeid(_Tp))
- return true;
-#endif
- return !__id && __fallback_id == __any_imp::__get_fallback_typeid<_Tp>();
- }
+template <class _Tp>
+struct _SmallHandler;
+template <class _Tp>
+struct _LargeHandler;
+
+template <class _Tp>
+struct _LIBCPP_TEMPLATE_VIS __unique_typeinfo {
+ static constexpr int __id = 0;
+};
+template <class _Tp>
+constexpr int __unique_typeinfo<_Tp>::__id;
+
+template <class _Tp>
+inline _LIBCPP_HIDE_FROM_ABI constexpr const void* __get_fallback_typeid() {
+ return &__unique_typeinfo<remove_cv_t<remove_reference_t<_Tp>>>::__id;
+}
- template <class _Tp>
- using _Handler = conditional_t<
- _IsSmallObject<_Tp>::value, _SmallHandler<_Tp>, _LargeHandler<_Tp>>;
+template <class _Tp>
+inline _LIBCPP_HIDE_FROM_ABI bool __compare_typeid(type_info const* __id, const void* __fallback_id) {
+# if !defined(_LIBCPP_HAS_NO_RTTI)
+ if (__id && *__id == typeid(_Tp))
+ return true;
+# endif
+ return !__id && __fallback_id == __any_imp::__get_fallback_typeid<_Tp>();
+}
+
+template <class _Tp>
+using _Handler = conditional_t< _IsSmallObject<_Tp>::value, _SmallHandler<_Tp>, _LargeHandler<_Tp>>;
} // namespace __any_imp
-class _LIBCPP_TEMPLATE_VIS any
-{
+class _LIBCPP_TEMPLATE_VIS any {
public:
// construct/destruct
- _LIBCPP_HIDE_FROM_ABI
- constexpr any() _NOEXCEPT : __h_(nullptr) {}
+ _LIBCPP_HIDE_FROM_ABI constexpr any() _NOEXCEPT : __h_(nullptr) {}
- _LIBCPP_HIDE_FROM_ABI
- any(any const & __other) : __h_(nullptr)
- {
- if (__other.__h_) __other.__call(_Action::_Copy, this);
+ _LIBCPP_HIDE_FROM_ABI any(any const& __other) : __h_(nullptr) {
+ if (__other.__h_)
+ __other.__call(_Action::_Copy, this);
}
- _LIBCPP_HIDE_FROM_ABI
- any(any && __other) _NOEXCEPT : __h_(nullptr)
- {
- if (__other.__h_) __other.__call(_Action::_Move, this);
+ _LIBCPP_HIDE_FROM_ABI any(any&& __other) _NOEXCEPT : __h_(nullptr) {
+ if (__other.__h_)
+ __other.__call(_Action::_Move, this);
}
- template <
- class _ValueType
- , class _Tp = decay_t<_ValueType>
- , class = enable_if_t<
- !is_same<_Tp, any>::value &&
- !__is_inplace_type<_ValueType>::value &&
- is_copy_constructible<_Tp>::value>
- >
- _LIBCPP_HIDE_FROM_ABI
- any(_ValueType && __value);
-
- template <class _ValueType, class ..._Args,
- class _Tp = decay_t<_ValueType>,
- class = enable_if_t<
- is_constructible<_Tp, _Args...>::value &&
- is_copy_constructible<_Tp>::value
- >
- >
- _LIBCPP_HIDE_FROM_ABI
- explicit any(in_place_type_t<_ValueType>, _Args&&... __args);
-
- template <class _ValueType, class _Up, class ..._Args,
- class _Tp = decay_t<_ValueType>,
- class = enable_if_t<
- is_constructible<_Tp, initializer_list<_Up>&, _Args...>::value &&
- is_copy_constructible<_Tp>::value>
- >
- _LIBCPP_HIDE_FROM_ABI
- explicit any(in_place_type_t<_ValueType>, initializer_list<_Up>, _Args&&... __args);
-
- _LIBCPP_HIDE_FROM_ABI
- ~any() { this->reset(); }
+ template < class _ValueType,
+ class _Tp = decay_t<_ValueType>,
+ class = enable_if_t< !is_same<_Tp, any>::value && !__is_inplace_type<_ValueType>::value &&
+ is_copy_constructible<_Tp>::value> >
+ _LIBCPP_HIDE_FROM_ABI any(_ValueType&& __value);
+
+ template <class _ValueType,
+ class... _Args,
+ class _Tp = decay_t<_ValueType>,
+ class = enable_if_t< is_constructible<_Tp, _Args...>::value && is_copy_constructible<_Tp>::value > >
+ _LIBCPP_HIDE_FROM_ABI explicit any(in_place_type_t<_ValueType>, _Args&&... __args);
+
+ template <class _ValueType,
+ class _Up,
+ class... _Args,
+ class _Tp = decay_t<_ValueType>,
+ class = enable_if_t< is_constructible<_Tp, initializer_list<_Up>&, _Args...>::value &&
+ is_copy_constructible<_Tp>::value> >
+ _LIBCPP_HIDE_FROM_ABI explicit any(in_place_type_t<_ValueType>, initializer_list<_Up>, _Args&&... __args);
+
+ _LIBCPP_HIDE_FROM_ABI ~any() { this->reset(); }
// assignments
- _LIBCPP_HIDE_FROM_ABI
- any & operator=(any const & __rhs) {
+ _LIBCPP_HIDE_FROM_ABI any& operator=(any const& __rhs) {
any(__rhs).swap(*this);
return *this;
}
- _LIBCPP_HIDE_FROM_ABI
- any & operator=(any && __rhs) _NOEXCEPT {
+ _LIBCPP_HIDE_FROM_ABI any& operator=(any&& __rhs) _NOEXCEPT {
any(std::move(__rhs)).swap(*this);
return *this;
}
- template <
- class _ValueType
- , class _Tp = decay_t<_ValueType>
- , class = enable_if_t<
- !is_same<_Tp, any>::value
- && is_copy_constructible<_Tp>::value>
- >
- _LIBCPP_HIDE_FROM_ABI
- any & operator=(_ValueType && __rhs);
-
- template <class _ValueType, class ..._Args,
- class _Tp = decay_t<_ValueType>,
- class = enable_if_t<
- is_constructible<_Tp, _Args...>::value &&
- is_copy_constructible<_Tp>::value>
- >
- _LIBCPP_HIDE_FROM_ABI
- _Tp& emplace(_Args&&...);
-
- template <class _ValueType, class _Up, class ..._Args,
- class _Tp = decay_t<_ValueType>,
- class = enable_if_t<
- is_constructible<_Tp, initializer_list<_Up>&, _Args...>::value &&
- is_copy_constructible<_Tp>::value>
- >
- _LIBCPP_HIDE_FROM_ABI
- _Tp& emplace(initializer_list<_Up>, _Args&&...);
+ template < class _ValueType,
+ class _Tp = decay_t<_ValueType>,
+ class = enable_if_t< !is_same<_Tp, any>::value && is_copy_constructible<_Tp>::value> >
+ _LIBCPP_HIDE_FROM_ABI any& operator=(_ValueType&& __rhs);
+
+ template <class _ValueType,
+ class... _Args,
+ class _Tp = decay_t<_ValueType>,
+ class = enable_if_t< is_constructible<_Tp, _Args...>::value && is_copy_constructible<_Tp>::value> >
+ _LIBCPP_HIDE_FROM_ABI _Tp& emplace(_Args&&...);
+
+ template <class _ValueType,
+ class _Up,
+ class... _Args,
+ class _Tp = decay_t<_ValueType>,
+ class = enable_if_t< is_constructible<_Tp, initializer_list<_Up>&, _Args...>::value &&
+ is_copy_constructible<_Tp>::value> >
+ _LIBCPP_HIDE_FROM_ABI _Tp& emplace(initializer_list<_Up>, _Args&&...);
// 6.3.3 any modifiers
- _LIBCPP_HIDE_FROM_ABI
- void reset() _NOEXCEPT { if (__h_) this->__call(_Action::_Destroy); }
+ _LIBCPP_HIDE_FROM_ABI void reset() _NOEXCEPT {
+ if (__h_)
+ this->__call(_Action::_Destroy);
+ }
- _LIBCPP_HIDE_FROM_ABI
- void swap(any & __rhs) _NOEXCEPT;
+ _LIBCPP_HIDE_FROM_ABI void swap(any& __rhs) _NOEXCEPT;
// 6.3.4 any observers
- _LIBCPP_HIDE_FROM_ABI
- bool has_value() const _NOEXCEPT { return __h_ != nullptr; }
+ _LIBCPP_HIDE_FROM_ABI bool has_value() const _NOEXCEPT { return __h_ != nullptr; }
-#if !defined(_LIBCPP_HAS_NO_RTTI)
- _LIBCPP_HIDE_FROM_ABI
- const type_info & type() const _NOEXCEPT {
+# if !defined(_LIBCPP_HAS_NO_RTTI)
+ _LIBCPP_HIDE_FROM_ABI const type_info& type() const _NOEXCEPT {
if (__h_) {
- return *static_cast<type_info const *>(this->__call(_Action::_TypeInfo));
+ return *static_cast<type_info const*>(this->__call(_Action::_TypeInfo));
} else {
- return typeid(void);
+ return typeid(void);
}
}
-#endif
+# endif
private:
- typedef __any_imp::_Action _Action;
- using _HandleFuncPtr = void* (*)(_Action, any const *, any *, const type_info *,
- const void* __fallback_info);
-
- union _Storage {
- _LIBCPP_HIDE_FROM_ABI constexpr _Storage() : __ptr(nullptr) {}
- void * __ptr;
- __any_imp::_Buffer __buf;
- };
-
- _LIBCPP_HIDE_FROM_ABI
- void * __call(_Action __a, any * __other = nullptr,
- type_info const * __info = nullptr,
- const void* __fallback_info = nullptr) const
- {
- return __h_(__a, this, __other, __info, __fallback_info);
- }
+ typedef __any_imp::_Action _Action;
+ using _HandleFuncPtr = void* (*)(_Action, any const*, any*, const type_info*, const void* __fallback_info);
- _LIBCPP_HIDE_FROM_ABI
- void * __call(_Action __a, any * __other = nullptr,
- type_info const * __info = nullptr,
- const void* __fallback_info = nullptr)
- {
- return __h_(__a, this, __other, __info, __fallback_info);
- }
+ union _Storage {
+ _LIBCPP_HIDE_FROM_ABI constexpr _Storage() : __ptr(nullptr) {}
+ void* __ptr;
+ __any_imp::_Buffer __buf;
+ };
- template <class>
- friend struct __any_imp::_SmallHandler;
- template <class>
- friend struct __any_imp::_LargeHandler;
+ _LIBCPP_HIDE_FROM_ABI void*
+ __call(_Action __a, any* __other = nullptr, type_info const* __info = nullptr, const void* __fallback_info = nullptr)
+ const {
+ return __h_(__a, this, __other, __info, __fallback_info);
+ }
- template <class _ValueType>
- friend add_pointer_t<add_const_t<_ValueType>>
- any_cast(any const *) _NOEXCEPT;
+ _LIBCPP_HIDE_FROM_ABI void* __call(
+ _Action __a, any* __other = nullptr, type_info const* __info = nullptr, const void* __fallback_info = nullptr) {
+ return __h_(__a, this, __other, __info, __fallback_info);
+ }
- template <class _ValueType>
- friend add_pointer_t<_ValueType>
- any_cast(any *) _NOEXCEPT;
+ template <class>
+ friend struct __any_imp::_SmallHandler;
+ template <class>
+ friend struct __any_imp::_LargeHandler;
- _HandleFuncPtr __h_ = nullptr;
- _Storage __s_;
-};
+ template <class _ValueType>
+ friend add_pointer_t<add_const_t<_ValueType>> any_cast(any const*) _NOEXCEPT;
-namespace __any_imp
-{
- template <class _Tp>
- struct _LIBCPP_TEMPLATE_VIS _SmallHandler
- {
- _LIBCPP_HIDE_FROM_ABI
- static void* __handle(_Action __act, any const * __this, any * __other,
- type_info const * __info, const void* __fallback_info)
- {
- switch (__act)
- {
- case _Action::_Destroy:
- __destroy(const_cast<any &>(*__this));
- return nullptr;
- case _Action::_Copy:
- __copy(*__this, *__other);
- return nullptr;
- case _Action::_Move:
- __move(const_cast<any &>(*__this), *__other);
- return nullptr;
- case _Action::_Get:
- return __get(const_cast<any &>(*__this), __info, __fallback_info);
- case _Action::_TypeInfo:
- return __type_info();
- }
- __libcpp_unreachable();
- }
+ template <class _ValueType>
+ friend add_pointer_t<_ValueType> any_cast(any*) _NOEXCEPT;
- template <class ..._Args>
- _LIBCPP_HIDE_FROM_ABI
- static _Tp& __create(any & __dest, _Args&&... __args) {
- typedef allocator<_Tp> _Alloc;
- typedef allocator_traits<_Alloc> _ATraits;
- _Alloc __a;
- _Tp * __ret = static_cast<_Tp*>(static_cast<void*>(&__dest.__s_.__buf));
- _ATraits::construct(__a, __ret, std::forward<_Args>(__args)...);
- __dest.__h_ = &_SmallHandler::__handle;
- return *__ret;
- }
+ _HandleFuncPtr __h_ = nullptr;
+ _Storage __s_;
+};
- private:
- _LIBCPP_HIDE_FROM_ABI
- static void __destroy(any & __this) {
- typedef allocator<_Tp> _Alloc;
- typedef allocator_traits<_Alloc> _ATraits;
- _Alloc __a;
- _Tp * __p = static_cast<_Tp *>(static_cast<void*>(&__this.__s_.__buf));
- _ATraits::destroy(__a, __p);
- __this.__h_ = nullptr;
+namespace __any_imp {
+template <class _Tp>
+struct _LIBCPP_TEMPLATE_VIS _SmallHandler {
+ _LIBCPP_HIDE_FROM_ABI static void*
+ __handle(_Action __act, any const* __this, any* __other, type_info const* __info, const void* __fallback_info) {
+ switch (__act) {
+ case _Action::_Destroy:
+ __destroy(const_cast<any&>(*__this));
+ return nullptr;
+ case _Action::_Copy:
+ __copy(*__this, *__other);
+ return nullptr;
+ case _Action::_Move:
+ __move(const_cast<any&>(*__this), *__other);
+ return nullptr;
+ case _Action::_Get:
+ return __get(const_cast<any&>(*__this), __info, __fallback_info);
+ case _Action::_TypeInfo:
+ return __type_info();
}
+ __libcpp_unreachable();
+ }
- _LIBCPP_HIDE_FROM_ABI
- static void __copy(any const & __this, any & __dest) {
- _SmallHandler::__create(__dest, *static_cast<_Tp const *>(
- static_cast<void const *>(&__this.__s_.__buf)));
- }
+ template <class... _Args>
+ _LIBCPP_HIDE_FROM_ABI static _Tp& __create(any& __dest, _Args&&... __args) {
+ typedef allocator<_Tp> _Alloc;
+ typedef allocator_traits<_Alloc> _ATraits;
+ _Alloc __a;
+ _Tp* __ret = static_cast<_Tp*>(static_cast<void*>(&__dest.__s_.__buf));
+ _ATraits::construct(__a, __ret, std::forward<_Args>(__args)...);
+ __dest.__h_ = &_SmallHandler::__handle;
+ return *__ret;
+ }
- _LIBCPP_HIDE_FROM_ABI
- static void __move(any & __this, any & __dest) {
- _SmallHandler::__create(__dest, std::move(
- *static_cast<_Tp*>(static_cast<void*>(&__this.__s_.__buf))));
- __destroy(__this);
- }
+private:
+ _LIBCPP_HIDE_FROM_ABI static void __destroy(any& __this) {
+ typedef allocator<_Tp> _Alloc;
+ typedef allocator_traits<_Alloc> _ATraits;
+ _Alloc __a;
+ _Tp* __p = static_cast<_Tp*>(static_cast<void*>(&__this.__s_.__buf));
+ _ATraits::destroy(__a, __p);
+ __this.__h_ = nullptr;
+ }
- _LIBCPP_HIDE_FROM_ABI
- static void* __get(any & __this,
- type_info const * __info,
- const void* __fallback_id)
- {
- if (__any_imp::__compare_typeid<_Tp>(__info, __fallback_id))
- return static_cast<void*>(&__this.__s_.__buf);
- return nullptr;
- }
+ _LIBCPP_HIDE_FROM_ABI static void __copy(any const& __this, any& __dest) {
+ _SmallHandler::__create(__dest, *static_cast<_Tp const*>(static_cast<void const*>(&__this.__s_.__buf)));
+ }
- _LIBCPP_HIDE_FROM_ABI
- static void* __type_info()
- {
-#if !defined(_LIBCPP_HAS_NO_RTTI)
- return const_cast<void*>(static_cast<void const *>(&typeid(_Tp)));
-#else
- return nullptr;
-#endif
- }
- };
+ _LIBCPP_HIDE_FROM_ABI static void __move(any& __this, any& __dest) {
+ _SmallHandler::__create(__dest, std::move(*static_cast<_Tp*>(static_cast<void*>(&__this.__s_.__buf))));
+ __destroy(__this);
+ }
- template <class _Tp>
- struct _LIBCPP_TEMPLATE_VIS _LargeHandler
- {
- _LIBCPP_HIDE_FROM_ABI
- static void* __handle(_Action __act, any const * __this,
- any * __other, type_info const * __info,
- void const* __fallback_info)
- {
- switch (__act)
- {
- case _Action::_Destroy:
- __destroy(const_cast<any &>(*__this));
- return nullptr;
- case _Action::_Copy:
- __copy(*__this, *__other);
- return nullptr;
- case _Action::_Move:
- __move(const_cast<any &>(*__this), *__other);
- return nullptr;
- case _Action::_Get:
- return __get(const_cast<any &>(*__this), __info, __fallback_info);
- case _Action::_TypeInfo:
- return __type_info();
- }
- __libcpp_unreachable();
- }
+ _LIBCPP_HIDE_FROM_ABI static void* __get(any& __this, type_info const* __info, const void* __fallback_id) {
+ if (__any_imp::__compare_typeid<_Tp>(__info, __fallback_id))
+ return static_cast<void*>(&__this.__s_.__buf);
+ return nullptr;
+ }
- template <class ..._Args>
- _LIBCPP_HIDE_FROM_ABI
- static _Tp& __create(any & __dest, _Args&&... __args) {
- typedef allocator<_Tp> _Alloc;
- typedef allocator_traits<_Alloc> _ATraits;
- typedef __allocator_destructor<_Alloc> _Dp;
- _Alloc __a;
- unique_ptr<_Tp, _Dp> __hold(_ATraits::allocate(__a, 1), _Dp(__a, 1));
- _Tp * __ret = __hold.get();
- _ATraits::construct(__a, __ret, std::forward<_Args>(__args)...);
- __dest.__s_.__ptr = __hold.release();
- __dest.__h_ = &_LargeHandler::__handle;
- return *__ret;
- }
+ _LIBCPP_HIDE_FROM_ABI static void* __type_info() {
+# if !defined(_LIBCPP_HAS_NO_RTTI)
+ return const_cast<void*>(static_cast<void const*>(&typeid(_Tp)));
+# else
+ return nullptr;
+# endif
+ }
+};
- private:
-
- _LIBCPP_HIDE_FROM_ABI
- static void __destroy(any & __this){
- typedef allocator<_Tp> _Alloc;
- typedef allocator_traits<_Alloc> _ATraits;
- _Alloc __a;
- _Tp * __p = static_cast<_Tp *>(__this.__s_.__ptr);
- _ATraits::destroy(__a, __p);
- _ATraits::deallocate(__a, __p, 1);
- __this.__h_ = nullptr;
+template <class _Tp>
+struct _LIBCPP_TEMPLATE_VIS _LargeHandler {
+ _LIBCPP_HIDE_FROM_ABI static void*
+ __handle(_Action __act, any const* __this, any* __other, type_info const* __info, void const* __fallback_info) {
+ switch (__act) {
+ case _Action::_Destroy:
+ __destroy(const_cast<any&>(*__this));
+ return nullptr;
+ case _Action::_Copy:
+ __copy(*__this, *__other);
+ return nullptr;
+ case _Action::_Move:
+ __move(const_cast<any&>(*__this), *__other);
+ return nullptr;
+ case _Action::_Get:
+ return __get(const_cast<any&>(*__this), __info, __fallback_info);
+ case _Action::_TypeInfo:
+ return __type_info();
}
+ __libcpp_unreachable();
+ }
- _LIBCPP_HIDE_FROM_ABI
- static void __copy(any const & __this, any & __dest) {
- _LargeHandler::__create(__dest, *static_cast<_Tp const *>(__this.__s_.__ptr));
- }
+ template <class... _Args>
+ _LIBCPP_HIDE_FROM_ABI static _Tp& __create(any& __dest, _Args&&... __args) {
+ typedef allocator<_Tp> _Alloc;
+ typedef allocator_traits<_Alloc> _ATraits;
+ typedef __allocator_destructor<_Alloc> _Dp;
+ _Alloc __a;
+ unique_ptr<_Tp, _Dp> __hold(_ATraits::allocate(__a, 1), _Dp(__a, 1));
+ _Tp* __ret = __hold.get();
+ _ATraits::construct(__a, __ret, std::forward<_Args>(__args)...);
+ __dest.__s_.__ptr = __hold.release();
+ __dest.__h_ = &_LargeHandler::__handle;
+ return *__ret;
+ }
- _LIBCPP_HIDE_FROM_ABI
- static void __move(any & __this, any & __dest) {
- __dest.__s_.__ptr = __this.__s_.__ptr;
- __dest.__h_ = &_LargeHandler::__handle;
- __this.__h_ = nullptr;
- }
+private:
+ _LIBCPP_HIDE_FROM_ABI static void __destroy(any& __this) {
+ typedef allocator<_Tp> _Alloc;
+ typedef allocator_traits<_Alloc> _ATraits;
+ _Alloc __a;
+ _Tp* __p = static_cast<_Tp*>(__this.__s_.__ptr);
+ _ATraits::destroy(__a, __p);
+ _ATraits::deallocate(__a, __p, 1);
+ __this.__h_ = nullptr;
+ }
- _LIBCPP_HIDE_FROM_ABI
- static void* __get(any & __this, type_info const * __info,
- void const* __fallback_info)
- {
- if (__any_imp::__compare_typeid<_Tp>(__info, __fallback_info))
- return static_cast<void*>(__this.__s_.__ptr);
- return nullptr;
+ _LIBCPP_HIDE_FROM_ABI static void __copy(any const& __this, any& __dest) {
+ _LargeHandler::__create(__dest, *static_cast<_Tp const*>(__this.__s_.__ptr));
+ }
- }
+ _LIBCPP_HIDE_FROM_ABI static void __move(any& __this, any& __dest) {
+ __dest.__s_.__ptr = __this.__s_.__ptr;
+ __dest.__h_ = &_LargeHandler::__handle;
+ __this.__h_ = nullptr;
+ }
- _LIBCPP_HIDE_FROM_ABI
- static void* __type_info()
- {
-#if !defined(_LIBCPP_HAS_NO_RTTI)
- return const_cast<void*>(static_cast<void const *>(&typeid(_Tp)));
-#else
- return nullptr;
-#endif
- }
- };
+ _LIBCPP_HIDE_FROM_ABI static void* __get(any& __this, type_info const* __info, void const* __fallback_info) {
+ if (__any_imp::__compare_typeid<_Tp>(__info, __fallback_info))
+ return static_cast<void*>(__this.__s_.__ptr);
+ return nullptr;
+ }
-} // namespace __any_imp
+ _LIBCPP_HIDE_FROM_ABI static void* __type_info() {
+# if !defined(_LIBCPP_HAS_NO_RTTI)
+ return const_cast<void*>(static_cast<void const*>(&typeid(_Tp)));
+# else
+ return nullptr;
+# endif
+ }
+};
+} // namespace __any_imp
template <class _ValueType, class _Tp, class>
-any::any(_ValueType && __v) : __h_(nullptr)
-{
+any::any(_ValueType&& __v) : __h_(nullptr) {
__any_imp::_Handler<_Tp>::__create(*this, std::forward<_ValueType>(__v));
}
-template <class _ValueType, class ..._Args, class _Tp, class>
+template <class _ValueType, class... _Args, class _Tp, class>
any::any(in_place_type_t<_ValueType>, _Args&&... __args) {
__any_imp::_Handler<_Tp>::__create(*this, std::forward<_Args>(__args)...);
}
-template <class _ValueType, class _Up, class ..._Args, class _Tp, class>
+template <class _ValueType, class _Up, class... _Args, class _Tp, class>
any::any(in_place_type_t<_ValueType>, initializer_list<_Up> __il, _Args&&... __args) {
__any_imp::_Handler<_Tp>::__create(*this, __il, std::forward<_Args>(__args)...);
}
template <class _ValueType, class, class>
-inline _LIBCPP_HIDE_FROM_ABI
-any & any::operator=(_ValueType && __v)
-{
+inline _LIBCPP_HIDE_FROM_ABI any& any::operator=(_ValueType&& __v) {
any(std::forward<_ValueType>(__v)).swap(*this);
return *this;
}
-template <class _ValueType, class ..._Args, class _Tp, class>
-inline _LIBCPP_HIDE_FROM_ABI
-_Tp& any::emplace(_Args&&... __args) {
+template <class _ValueType, class... _Args, class _Tp, class>
+inline _LIBCPP_HIDE_FROM_ABI _Tp& any::emplace(_Args&&... __args) {
reset();
return __any_imp::_Handler<_Tp>::__create(*this, std::forward<_Args>(__args)...);
}
-template <class _ValueType, class _Up, class ..._Args, class _Tp, class>
-inline _LIBCPP_HIDE_FROM_ABI
-_Tp& any::emplace(initializer_list<_Up> __il, _Args&&... __args) {
+template <class _ValueType, class _Up, class... _Args, class _Tp, class>
+inline _LIBCPP_HIDE_FROM_ABI _Tp& any::emplace(initializer_list<_Up> __il, _Args&&... __args) {
reset();
return __any_imp::_Handler<_Tp>::__create(*this, __il, std::forward<_Args>(__args)...);
}
-inline _LIBCPP_HIDE_FROM_ABI
-void any::swap(any & __rhs) _NOEXCEPT
-{
- if (this == &__rhs)
- return;
- if (__h_ && __rhs.__h_) {
- any __tmp;
- __rhs.__call(_Action::_Move, &__tmp);
- this->__call(_Action::_Move, &__rhs);
- __tmp.__call(_Action::_Move, this);
- }
- else if (__h_) {
- this->__call(_Action::_Move, &__rhs);
- }
- else if (__rhs.__h_) {
- __rhs.__call(_Action::_Move, this);
- }
+inline _LIBCPP_HIDE_FROM_ABI void any::swap(any& __rhs) _NOEXCEPT {
+ if (this == &__rhs)
+ return;
+ if (__h_ && __rhs.__h_) {
+ any __tmp;
+ __rhs.__call(_Action::_Move, &__tmp);
+ this->__call(_Action::_Move, &__rhs);
+ __tmp.__call(_Action::_Move, this);
+ } else if (__h_) {
+ this->__call(_Action::_Move, &__rhs);
+ } else if (__rhs.__h_) {
+ __rhs.__call(_Action::_Move, this);
+ }
}
// 6.4 Non-member functions
-inline _LIBCPP_HIDE_FROM_ABI
-void swap(any & __lhs, any & __rhs) _NOEXCEPT
-{
- __lhs.swap(__rhs);
-}
+inline _LIBCPP_HIDE_FROM_ABI void swap(any& __lhs, any& __rhs) _NOEXCEPT { __lhs.swap(__rhs); }
-template <class _Tp, class ..._Args>
-inline _LIBCPP_HIDE_FROM_ABI
-any make_any(_Args&&... __args) {
- return any(in_place_type<_Tp>, std::forward<_Args>(__args)...);
+template <class _Tp, class... _Args>
+inline _LIBCPP_HIDE_FROM_ABI any make_any(_Args&&... __args) {
+ return any(in_place_type<_Tp>, std::forward<_Args>(__args)...);
}
-template <class _Tp, class _Up, class ..._Args>
-inline _LIBCPP_HIDE_FROM_ABI
-any make_any(initializer_list<_Up> __il, _Args&&... __args) {
- return any(in_place_type<_Tp>, __il, std::forward<_Args>(__args)...);
+template <class _Tp, class _Up, class... _Args>
+inline _LIBCPP_HIDE_FROM_ABI any make_any(initializer_list<_Up> __il, _Args&&... __args) {
+ return any(in_place_type<_Tp>, __il, std::forward<_Args>(__args)...);
}
template <class _ValueType>
-inline _LIBCPP_HIDE_FROM_ABI
-_LIBCPP_AVAILABILITY_THROW_BAD_ANY_CAST
-_ValueType any_cast(any const & __v)
-{
- using _RawValueType = __remove_cvref_t<_ValueType>;
- static_assert(is_constructible<_ValueType, _RawValueType const &>::value,
- "ValueType is required to be a const lvalue reference "
- "or a CopyConstructible type");
- auto __tmp = std::any_cast<add_const_t<_RawValueType>>(&__v);
- if (__tmp == nullptr)
- __throw_bad_any_cast();
- return static_cast<_ValueType>(*__tmp);
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_THROW_BAD_ANY_CAST _ValueType any_cast(any const& __v) {
+ using _RawValueType = __remove_cvref_t<_ValueType>;
+ static_assert(is_constructible<_ValueType, _RawValueType const&>::value,
+ "ValueType is required to be a const lvalue reference "
+ "or a CopyConstructible type");
+ auto __tmp = std::any_cast<add_const_t<_RawValueType>>(&__v);
+ if (__tmp == nullptr)
+ __throw_bad_any_cast();
+ return static_cast<_ValueType>(*__tmp);
}
template <class _ValueType>
-inline _LIBCPP_HIDE_FROM_ABI
-_LIBCPP_AVAILABILITY_THROW_BAD_ANY_CAST
-_ValueType any_cast(any & __v)
-{
- using _RawValueType = __remove_cvref_t<_ValueType>;
- static_assert(is_constructible<_ValueType, _RawValueType &>::value,
- "ValueType is required to be an lvalue reference "
- "or a CopyConstructible type");
- auto __tmp = std::any_cast<_RawValueType>(&__v);
- if (__tmp == nullptr)
- __throw_bad_any_cast();
- return static_cast<_ValueType>(*__tmp);
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_THROW_BAD_ANY_CAST _ValueType any_cast(any& __v) {
+ using _RawValueType = __remove_cvref_t<_ValueType>;
+ static_assert(is_constructible<_ValueType, _RawValueType&>::value,
+ "ValueType is required to be an lvalue reference "
+ "or a CopyConstructible type");
+ auto __tmp = std::any_cast<_RawValueType>(&__v);
+ if (__tmp == nullptr)
+ __throw_bad_any_cast();
+ return static_cast<_ValueType>(*__tmp);
}
template <class _ValueType>
-inline _LIBCPP_HIDE_FROM_ABI
-_LIBCPP_AVAILABILITY_THROW_BAD_ANY_CAST
-_ValueType any_cast(any && __v)
-{
- using _RawValueType = __remove_cvref_t<_ValueType>;
- static_assert(is_constructible<_ValueType, _RawValueType>::value,
- "ValueType is required to be an rvalue reference "
- "or a CopyConstructible type");
- auto __tmp = std::any_cast<_RawValueType>(&__v);
- if (__tmp == nullptr)
- __throw_bad_any_cast();
- return static_cast<_ValueType>(std::move(*__tmp));
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_THROW_BAD_ANY_CAST _ValueType any_cast(any&& __v) {
+ using _RawValueType = __remove_cvref_t<_ValueType>;
+ static_assert(is_constructible<_ValueType, _RawValueType>::value,
+ "ValueType is required to be an rvalue reference "
+ "or a CopyConstructible type");
+ auto __tmp = std::any_cast<_RawValueType>(&__v);
+ if (__tmp == nullptr)
+ __throw_bad_any_cast();
+ return static_cast<_ValueType>(std::move(*__tmp));
}
template <class _ValueType>
-inline _LIBCPP_HIDE_FROM_ABI
-add_pointer_t<add_const_t<_ValueType>>
-any_cast(any const * __any) _NOEXCEPT
-{
- static_assert(!is_reference<_ValueType>::value,
- "_ValueType may not be a reference.");
- return std::any_cast<_ValueType>(const_cast<any *>(__any));
+inline _LIBCPP_HIDE_FROM_ABI add_pointer_t<add_const_t<_ValueType>> any_cast(any const* __any) _NOEXCEPT {
+ static_assert(!is_reference<_ValueType>::value, "_ValueType may not be a reference.");
+ return std::any_cast<_ValueType>(const_cast<any*>(__any));
}
template <class _RetType>
-inline _LIBCPP_HIDE_FROM_ABI
-_RetType __pointer_or_func_cast(void* __p, /*IsFunction*/false_type) noexcept {
+inline _LIBCPP_HIDE_FROM_ABI _RetType __pointer_or_func_cast(void* __p, /*IsFunction*/ false_type) noexcept {
return static_cast<_RetType>(__p);
}
template <class _RetType>
-inline _LIBCPP_HIDE_FROM_ABI
-_RetType __pointer_or_func_cast(void*, /*IsFunction*/true_type) noexcept {
+inline _LIBCPP_HIDE_FROM_ABI _RetType __pointer_or_func_cast(void*, /*IsFunction*/ true_type) noexcept {
return nullptr;
}
template <class _ValueType>
-_LIBCPP_HIDE_FROM_ABI
-add_pointer_t<_ValueType>
-any_cast(any * __any) _NOEXCEPT
-{
- using __any_imp::_Action;
- static_assert(!is_reference<_ValueType>::value,
- "_ValueType may not be a reference.");
- typedef add_pointer_t<_ValueType> _ReturnType;
- if (__any && __any->__h_) {
- void *__p = __any->__call(_Action::_Get, nullptr,
-#if !defined(_LIBCPP_HAS_NO_RTTI)
- &typeid(_ValueType),
-#else
- nullptr,
-#endif
- __any_imp::__get_fallback_typeid<_ValueType>());
- return std::__pointer_or_func_cast<_ReturnType>(
- __p, is_function<_ValueType>{});
- }
- return nullptr;
+_LIBCPP_HIDE_FROM_ABI add_pointer_t<_ValueType> any_cast(any* __any) _NOEXCEPT {
+ using __any_imp::_Action;
+ static_assert(!is_reference<_ValueType>::value, "_ValueType may not be a reference.");
+ typedef add_pointer_t<_ValueType> _ReturnType;
+ if (__any && __any->__h_) {
+ void* __p = __any->__call(
+ _Action::_Get,
+ nullptr,
+# if !defined(_LIBCPP_HAS_NO_RTTI)
+ &typeid(_ValueType),
+# else
+ nullptr,
+# endif
+ __any_imp::__get_fallback_typeid<_ValueType>());
+ return std::__pointer_or_func_cast<_ReturnType>(__p, is_function<_ValueType>{});
+ }
+ return nullptr;
}
#endif // _LIBCPP_STD_VER >= 17
diff --git a/contrib/llvm-project/libcxx/include/array b/contrib/llvm-project/libcxx/include/array
index d00bf278e635..dcb419f536dc 100644
--- a/contrib/llvm-project/libcxx/include/array
+++ b/contrib/llvm-project/libcxx/include/array
@@ -162,276 +162,251 @@ template <size_t I, class T, size_t N> const T&& get(const array<T, N>&&) noexce
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _Tp, size_t _Size>
-struct _LIBCPP_TEMPLATE_VIS array
-{
- // types:
- using __self = array;
- using value_type = _Tp;
- using reference = value_type&;
- using const_reference = const value_type&;
- using iterator = value_type*;
- using const_iterator = const value_type*;
- using pointer = value_type*;
- using const_pointer = const value_type*;
- using size_type = size_t;
- using difference_type = ptrdiff_t;
- using reverse_iterator = std::reverse_iterator<iterator>;
- using const_reverse_iterator = std::reverse_iterator<const_iterator>;
-
- _Tp __elems_[_Size];
-
- // No explicit construct/copy/destroy for aggregate type
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- void fill(const value_type& __u) {
- std::fill_n(data(), _Size, __u);
- }
-
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- void swap(array& __a) _NOEXCEPT_(__is_nothrow_swappable<_Tp>::value) {
- std::swap_ranges(data(), data() + _Size, __a.data());
- }
-
- // iterators:
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
- iterator begin() _NOEXCEPT {return iterator(data());}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
- const_iterator begin() const _NOEXCEPT {return const_iterator(data());}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
- iterator end() _NOEXCEPT {return iterator(data() + _Size);}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
- const_iterator end() const _NOEXCEPT {return const_iterator(data() + _Size);}
-
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
- reverse_iterator rbegin() _NOEXCEPT {return reverse_iterator(end());}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
- const_reverse_iterator rbegin() const _NOEXCEPT {return const_reverse_iterator(end());}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
- reverse_iterator rend() _NOEXCEPT {return reverse_iterator(begin());}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
- const_reverse_iterator rend() const _NOEXCEPT {return const_reverse_iterator(begin());}
-
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
- const_iterator cbegin() const _NOEXCEPT {return begin();}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
- const_iterator cend() const _NOEXCEPT {return end();}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
- const_reverse_iterator crbegin() const _NOEXCEPT {return rbegin();}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
- const_reverse_iterator crend() const _NOEXCEPT {return rend();}
-
- // capacity:
- _LIBCPP_HIDE_FROM_ABI
- _LIBCPP_CONSTEXPR size_type size() const _NOEXCEPT {return _Size;}
- _LIBCPP_HIDE_FROM_ABI
- _LIBCPP_CONSTEXPR size_type max_size() const _NOEXCEPT {return _Size;}
- _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_HIDE_FROM_ABI
- _LIBCPP_CONSTEXPR bool empty() const _NOEXCEPT {return _Size == 0;}
-
- // element access:
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
- reference operator[](size_type __n) _NOEXCEPT {
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__n < _Size, "out-of-bounds access in std::array<T, N>");
- return __elems_[__n];
- }
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
- const_reference operator[](size_type __n) const _NOEXCEPT {
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__n < _Size, "out-of-bounds access in std::array<T, N>");
- return __elems_[__n];
- }
-
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 reference at(size_type __n)
- {
- if (__n >= _Size)
- __throw_out_of_range("array::at");
- return __elems_[__n];
- }
-
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 const_reference at(size_type __n) const
- {
- if (__n >= _Size)
- __throw_out_of_range("array::at");
- return __elems_[__n];
- }
-
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 reference front() _NOEXCEPT {return (*this)[0];}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 const_reference front() const _NOEXCEPT {return (*this)[0];}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 reference back() _NOEXCEPT {return (*this)[_Size - 1];}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 const_reference back() const _NOEXCEPT {return (*this)[_Size - 1];}
-
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
- value_type* data() _NOEXCEPT {return __elems_;}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
- const value_type* data() const _NOEXCEPT {return __elems_;}
+struct _LIBCPP_TEMPLATE_VIS array {
+ // types:
+ using __self = array;
+ using value_type = _Tp;
+ using reference = value_type&;
+ using const_reference = const value_type&;
+ using iterator = value_type*;
+ using const_iterator = const value_type*;
+ using pointer = value_type*;
+ using const_pointer = const value_type*;
+ using size_type = size_t;
+ using difference_type = ptrdiff_t;
+ using reverse_iterator = std::reverse_iterator<iterator>;
+ using const_reverse_iterator = std::reverse_iterator<const_iterator>;
+
+ _Tp __elems_[_Size];
+
+ // No explicit construct/copy/destroy for aggregate type
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void fill(const value_type& __u) {
+ std::fill_n(data(), _Size, __u);
+ }
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void swap(array& __a)
+ _NOEXCEPT_(__is_nothrow_swappable<_Tp>::value) {
+ std::swap_ranges(data(), data() + _Size, __a.data());
+ }
+
+ // iterators:
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 iterator begin() _NOEXCEPT { return iterator(data()); }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 const_iterator begin() const _NOEXCEPT {
+ return const_iterator(data());
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 iterator end() _NOEXCEPT { return iterator(data() + _Size); }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 const_iterator end() const _NOEXCEPT {
+ return const_iterator(data() + _Size);
+ }
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 reverse_iterator rbegin() _NOEXCEPT {
+ return reverse_iterator(end());
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 const_reverse_iterator rbegin() const _NOEXCEPT {
+ return const_reverse_iterator(end());
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 reverse_iterator rend() _NOEXCEPT {
+ return reverse_iterator(begin());
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 const_reverse_iterator rend() const _NOEXCEPT {
+ return const_reverse_iterator(begin());
+ }
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 const_iterator cbegin() const _NOEXCEPT { return begin(); }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 const_iterator cend() const _NOEXCEPT { return end(); }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 const_reverse_iterator crbegin() const _NOEXCEPT {
+ return rbegin();
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 const_reverse_iterator crend() const _NOEXCEPT { return rend(); }
+
+ // capacity:
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR size_type size() const _NOEXCEPT { return _Size; }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR size_type max_size() const _NOEXCEPT { return _Size; }
+ _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool empty() const _NOEXCEPT {
+ return _Size == 0;
+ }
+
+ // element access:
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 reference operator[](size_type __n) _NOEXCEPT {
+ _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__n < _Size, "out-of-bounds access in std::array<T, N>");
+ return __elems_[__n];
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 const_reference operator[](size_type __n) const _NOEXCEPT {
+ _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__n < _Size, "out-of-bounds access in std::array<T, N>");
+ return __elems_[__n];
+ }
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 reference at(size_type __n) {
+ if (__n >= _Size)
+ __throw_out_of_range("array::at");
+ return __elems_[__n];
+ }
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 const_reference at(size_type __n) const {
+ if (__n >= _Size)
+ __throw_out_of_range("array::at");
+ return __elems_[__n];
+ }
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 reference front() _NOEXCEPT { return (*this)[0]; }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 const_reference front() const _NOEXCEPT { return (*this)[0]; }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 reference back() _NOEXCEPT { return (*this)[_Size - 1]; }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 const_reference back() const _NOEXCEPT {
+ return (*this)[_Size - 1];
+ }
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 value_type* data() _NOEXCEPT { return __elems_; }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 const value_type* data() const _NOEXCEPT { return __elems_; }
};
template <class _Tp>
-struct _LIBCPP_TEMPLATE_VIS array<_Tp, 0>
-{
- // types:
- typedef array __self;
- typedef _Tp value_type;
- typedef value_type& reference;
- typedef const value_type& const_reference;
- typedef value_type* iterator;
- typedef const value_type* const_iterator;
- typedef value_type* pointer;
- typedef const value_type* const_pointer;
- typedef size_t size_type;
- typedef ptrdiff_t difference_type;
- typedef std::reverse_iterator<iterator> reverse_iterator;
- typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
-
- typedef __conditional_t<is_const<_Tp>::value, const __empty, __empty> _EmptyType;
-
- struct _ArrayInStructT { _Tp __data_[1]; };
- _ALIGNAS_TYPE(_ArrayInStructT) _EmptyType __elems_[sizeof(_ArrayInStructT)];
-
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
- value_type* data() _NOEXCEPT {return nullptr;}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
- const value_type* data() const _NOEXCEPT {return nullptr;}
-
- // No explicit construct/copy/destroy for aggregate type
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- void fill(const value_type&) {
- static_assert(!is_const<_Tp>::value,
- "cannot fill zero-sized array of type 'const T'");
- }
-
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- void swap(array&) _NOEXCEPT {
- static_assert(!is_const<_Tp>::value,
- "cannot swap zero-sized array of type 'const T'");
- }
-
- // iterators:
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
- iterator begin() _NOEXCEPT {return iterator(data());}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
- const_iterator begin() const _NOEXCEPT {return const_iterator(data());}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
- iterator end() _NOEXCEPT {return iterator(data());}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
- const_iterator end() const _NOEXCEPT {return const_iterator(data());}
-
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
- reverse_iterator rbegin() _NOEXCEPT {return reverse_iterator(end());}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
- const_reverse_iterator rbegin() const _NOEXCEPT {return const_reverse_iterator(end());}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
- reverse_iterator rend() _NOEXCEPT {return reverse_iterator(begin());}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
- const_reverse_iterator rend() const _NOEXCEPT {return const_reverse_iterator(begin());}
-
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
- const_iterator cbegin() const _NOEXCEPT {return begin();}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
- const_iterator cend() const _NOEXCEPT {return end();}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
- const_reverse_iterator crbegin() const _NOEXCEPT {return rbegin();}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
- const_reverse_iterator crend() const _NOEXCEPT {return rend();}
-
- // capacity:
- _LIBCPP_HIDE_FROM_ABI
- _LIBCPP_CONSTEXPR size_type size() const _NOEXCEPT {return 0; }
- _LIBCPP_HIDE_FROM_ABI
- _LIBCPP_CONSTEXPR size_type max_size() const _NOEXCEPT {return 0;}
- _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_HIDE_FROM_ABI
- _LIBCPP_CONSTEXPR bool empty() const _NOEXCEPT {return true;}
-
- // element access:
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
- reference operator[](size_type) _NOEXCEPT {
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(false, "cannot call array<T, 0>::operator[] on a zero-sized array");
- __libcpp_unreachable();
- }
-
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
- const_reference operator[](size_type) const _NOEXCEPT {
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(false, "cannot call array<T, 0>::operator[] on a zero-sized array");
- __libcpp_unreachable();
- }
-
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
- reference at(size_type) {
- __throw_out_of_range("array<T, 0>::at");
- __libcpp_unreachable();
- }
-
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
- const_reference at(size_type) const {
- __throw_out_of_range("array<T, 0>::at");
- __libcpp_unreachable();
- }
-
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
- reference front() _NOEXCEPT {
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(false, "cannot call array<T, 0>::front() on a zero-sized array");
- __libcpp_unreachable();
- }
-
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
- const_reference front() const _NOEXCEPT {
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(false, "cannot call array<T, 0>::front() on a zero-sized array");
- __libcpp_unreachable();
- }
-
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
- reference back() _NOEXCEPT {
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(false, "cannot call array<T, 0>::back() on a zero-sized array");
- __libcpp_unreachable();
- }
-
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
- const_reference back() const _NOEXCEPT {
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(false, "cannot call array<T, 0>::back() on a zero-sized array");
- __libcpp_unreachable();
- }
+struct _LIBCPP_TEMPLATE_VIS array<_Tp, 0> {
+ // types:
+ typedef array __self;
+ typedef _Tp value_type;
+ typedef value_type& reference;
+ typedef const value_type& const_reference;
+ typedef value_type* iterator;
+ typedef const value_type* const_iterator;
+ typedef value_type* pointer;
+ typedef const value_type* const_pointer;
+ typedef size_t size_type;
+ typedef ptrdiff_t difference_type;
+ typedef std::reverse_iterator<iterator> reverse_iterator;
+ typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
+
+ typedef __conditional_t<is_const<_Tp>::value, const __empty, __empty> _EmptyType;
+
+ struct _ArrayInStructT {
+ _Tp __data_[1];
+ };
+ _ALIGNAS_TYPE(_ArrayInStructT) _EmptyType __elems_[sizeof(_ArrayInStructT)];
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 value_type* data() _NOEXCEPT { return nullptr; }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 const value_type* data() const _NOEXCEPT { return nullptr; }
+
+ // No explicit construct/copy/destroy for aggregate type
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void fill(const value_type&) {
+ static_assert(!is_const<_Tp>::value, "cannot fill zero-sized array of type 'const T'");
+ }
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void swap(array&) _NOEXCEPT {
+ static_assert(!is_const<_Tp>::value, "cannot swap zero-sized array of type 'const T'");
+ }
+
+ // iterators:
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 iterator begin() _NOEXCEPT { return iterator(data()); }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 const_iterator begin() const _NOEXCEPT {
+ return const_iterator(data());
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 iterator end() _NOEXCEPT { return iterator(data()); }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 const_iterator end() const _NOEXCEPT {
+ return const_iterator(data());
+ }
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 reverse_iterator rbegin() _NOEXCEPT {
+ return reverse_iterator(end());
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 const_reverse_iterator rbegin() const _NOEXCEPT {
+ return const_reverse_iterator(end());
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 reverse_iterator rend() _NOEXCEPT {
+ return reverse_iterator(begin());
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 const_reverse_iterator rend() const _NOEXCEPT {
+ return const_reverse_iterator(begin());
+ }
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 const_iterator cbegin() const _NOEXCEPT { return begin(); }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 const_iterator cend() const _NOEXCEPT { return end(); }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 const_reverse_iterator crbegin() const _NOEXCEPT {
+ return rbegin();
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 const_reverse_iterator crend() const _NOEXCEPT { return rend(); }
+
+ // capacity:
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR size_type size() const _NOEXCEPT { return 0; }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR size_type max_size() const _NOEXCEPT { return 0; }
+ _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool empty() const _NOEXCEPT { return true; }
+
+ // element access:
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 reference operator[](size_type) _NOEXCEPT {
+ _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(false, "cannot call array<T, 0>::operator[] on a zero-sized array");
+ __libcpp_unreachable();
+ }
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 const_reference operator[](size_type) const _NOEXCEPT {
+ _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(false, "cannot call array<T, 0>::operator[] on a zero-sized array");
+ __libcpp_unreachable();
+ }
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 reference at(size_type) {
+ __throw_out_of_range("array<T, 0>::at");
+ __libcpp_unreachable();
+ }
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 const_reference at(size_type) const {
+ __throw_out_of_range("array<T, 0>::at");
+ __libcpp_unreachable();
+ }
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 reference front() _NOEXCEPT {
+ _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(false, "cannot call array<T, 0>::front() on a zero-sized array");
+ __libcpp_unreachable();
+ }
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 const_reference front() const _NOEXCEPT {
+ _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(false, "cannot call array<T, 0>::front() on a zero-sized array");
+ __libcpp_unreachable();
+ }
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 reference back() _NOEXCEPT {
+ _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(false, "cannot call array<T, 0>::back() on a zero-sized array");
+ __libcpp_unreachable();
+ }
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 const_reference back() const _NOEXCEPT {
+ _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(false, "cannot call array<T, 0>::back() on a zero-sized array");
+ __libcpp_unreachable();
+ }
};
-
#if _LIBCPP_STD_VER >= 17
-template<class _Tp, class... _Args,
- class = enable_if_t<__all<_IsSame<_Tp, _Args>::value...>::value>
- >
-array(_Tp, _Args...)
- -> array<_Tp, 1 + sizeof...(_Args)>;
+template <class _Tp, class... _Args, class = enable_if_t<__all<_IsSame<_Tp, _Args>::value...>::value> >
+array(_Tp, _Args...) -> array<_Tp, 1 + sizeof...(_Args)>;
#endif
template <class _Tp, size_t _Size>
-inline _LIBCPP_HIDE_FROM_ABI
-_LIBCPP_CONSTEXPR_SINCE_CXX20 bool
-operator==(const array<_Tp, _Size>& __x, const array<_Tp, _Size>& __y)
-{
- return std::equal(__x.begin(), __x.end(), __y.begin());
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool
+operator==(const array<_Tp, _Size>& __x, const array<_Tp, _Size>& __y) {
+ return std::equal(__x.begin(), __x.end(), __y.begin());
}
#if _LIBCPP_STD_VER <= 17
template <class _Tp, size_t _Size>
inline _LIBCPP_HIDE_FROM_ABI bool operator!=(const array<_Tp, _Size>& __x, const array<_Tp, _Size>& __y) {
- return !(__x == __y);
+ return !(__x == __y);
}
template <class _Tp, size_t _Size>
inline _LIBCPP_HIDE_FROM_ABI bool operator<(const array<_Tp, _Size>& __x, const array<_Tp, _Size>& __y) {
- return std::lexicographical_compare(__x.begin(), __x.end(), __y.begin(), __y.end());
+ return std::lexicographical_compare(__x.begin(), __x.end(), __y.begin(), __y.end());
}
template <class _Tp, size_t _Size>
inline _LIBCPP_HIDE_FROM_ABI bool operator>(const array<_Tp, _Size>& __x, const array<_Tp, _Size>& __y) {
- return __y < __x;
+ return __y < __x;
}
template <class _Tp, size_t _Size>
inline _LIBCPP_HIDE_FROM_ABI bool operator<=(const array<_Tp, _Size>& __x, const array<_Tp, _Size>& __y) {
- return !(__y < __x);
+ return !(__y < __x);
}
template <class _Tp, size_t _Size>
inline _LIBCPP_HIDE_FROM_ABI bool operator>=(const array<_Tp, _Size>& __x, const array<_Tp, _Size>& __y) {
- return !(__x < __y);
+ return !(__x < __y);
}
#else // _LIBCPP_STD_VER <= 17
@@ -439,66 +414,49 @@ inline _LIBCPP_HIDE_FROM_ABI bool operator>=(const array<_Tp, _Size>& __x, const
template <class _Tp, size_t _Size>
_LIBCPP_HIDE_FROM_ABI constexpr __synth_three_way_result<_Tp>
operator<=>(const array<_Tp, _Size>& __x, const array<_Tp, _Size>& __y) {
- return std::lexicographical_compare_three_way(
- __x.begin(), __x.end(), __y.begin(), __y.end(), std::__synth_three_way<_Tp, _Tp>);
+ return std::lexicographical_compare_three_way(
+ __x.begin(), __x.end(), __y.begin(), __y.end(), std::__synth_three_way<_Tp, _Tp>);
}
#endif // _LIBCPP_STD_VER <= 17
template <class _Tp, size_t _Size, __enable_if_t<_Size == 0 || __is_swappable<_Tp>::value, int> = 0>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-void
-swap(array<_Tp, _Size>& __x, array<_Tp, _Size>& __y)
- _NOEXCEPT_(noexcept(__x.swap(__y)))
-{
- __x.swap(__y);
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void swap(array<_Tp, _Size>& __x, array<_Tp, _Size>& __y)
+ _NOEXCEPT_(noexcept(__x.swap(__y))) {
+ __x.swap(__y);
}
template <class _Tp, size_t _Size>
-struct _LIBCPP_TEMPLATE_VIS tuple_size<array<_Tp, _Size> >
- : public integral_constant<size_t, _Size> {};
+struct _LIBCPP_TEMPLATE_VIS tuple_size<array<_Tp, _Size> > : public integral_constant<size_t, _Size> {};
template <size_t _Ip, class _Tp, size_t _Size>
-struct _LIBCPP_TEMPLATE_VIS tuple_element<_Ip, array<_Tp, _Size> >
-{
- static_assert(_Ip < _Size, "Index out of bounds in std::tuple_element<> (std::array)");
- typedef _Tp type;
+struct _LIBCPP_TEMPLATE_VIS tuple_element<_Ip, array<_Tp, _Size> > {
+ static_assert(_Ip < _Size, "Index out of bounds in std::tuple_element<> (std::array)");
+ typedef _Tp type;
};
template <size_t _Ip, class _Tp, size_t _Size>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
-_Tp&
-get(array<_Tp, _Size>& __a) _NOEXCEPT
-{
- static_assert(_Ip < _Size, "Index out of bounds in std::get<> (std::array)");
- return __a.__elems_[_Ip];
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _Tp& get(array<_Tp, _Size>& __a) _NOEXCEPT {
+ static_assert(_Ip < _Size, "Index out of bounds in std::get<> (std::array)");
+ return __a.__elems_[_Ip];
}
template <size_t _Ip, class _Tp, size_t _Size>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
-const _Tp&
-get(const array<_Tp, _Size>& __a) _NOEXCEPT
-{
- static_assert(_Ip < _Size, "Index out of bounds in std::get<> (const std::array)");
- return __a.__elems_[_Ip];
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 const _Tp& get(const array<_Tp, _Size>& __a) _NOEXCEPT {
+ static_assert(_Ip < _Size, "Index out of bounds in std::get<> (const std::array)");
+ return __a.__elems_[_Ip];
}
template <size_t _Ip, class _Tp, size_t _Size>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
-_Tp&&
-get(array<_Tp, _Size>&& __a) _NOEXCEPT
-{
- static_assert(_Ip < _Size, "Index out of bounds in std::get<> (std::array &&)");
- return std::move(__a.__elems_[_Ip]);
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _Tp&& get(array<_Tp, _Size>&& __a) _NOEXCEPT {
+ static_assert(_Ip < _Size, "Index out of bounds in std::get<> (std::array &&)");
+ return std::move(__a.__elems_[_Ip]);
}
template <size_t _Ip, class _Tp, size_t _Size>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
-const _Tp&&
-get(const array<_Tp, _Size>&& __a) _NOEXCEPT
-{
- static_assert(_Ip < _Size, "Index out of bounds in std::get<> (const std::array &&)");
- return std::move(__a.__elems_[_Ip]);
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 const _Tp&& get(const array<_Tp, _Size>&& __a) _NOEXCEPT {
+ static_assert(_Ip < _Size, "Index out of bounds in std::get<> (const std::array &&)");
+ return std::move(__a.__elems_[_Ip]);
}
#if _LIBCPP_STD_VER >= 20
@@ -511,33 +469,24 @@ __to_array_lvalue_impl(_Tp (&__arr)[_Size], index_sequence<_Index...>) {
template <typename _Tp, size_t _Size, size_t... _Index>
_LIBCPP_HIDE_FROM_ABI constexpr array<remove_cv_t<_Tp>, _Size>
-__to_array_rvalue_impl(_Tp(&&__arr)[_Size], index_sequence<_Index...>) {
+__to_array_rvalue_impl(_Tp (&&__arr)[_Size], index_sequence<_Index...>) {
return {{std::move(__arr[_Index])...}};
}
template <typename _Tp, size_t _Size>
_LIBCPP_HIDE_FROM_ABI constexpr array<remove_cv_t<_Tp>, _Size>
to_array(_Tp (&__arr)[_Size]) noexcept(is_nothrow_constructible_v<_Tp, _Tp&>) {
- static_assert(
- !is_array_v<_Tp>,
- "[array.creation]/1: to_array does not accept multidimensional arrays.");
- static_assert(
- is_constructible_v<_Tp, _Tp&>,
- "[array.creation]/1: to_array requires copy constructible elements.");
+ static_assert(!is_array_v<_Tp>, "[array.creation]/1: to_array does not accept multidimensional arrays.");
+ static_assert(is_constructible_v<_Tp, _Tp&>, "[array.creation]/1: to_array requires copy constructible elements.");
return std::__to_array_lvalue_impl(__arr, make_index_sequence<_Size>());
}
template <typename _Tp, size_t _Size>
_LIBCPP_HIDE_FROM_ABI constexpr array<remove_cv_t<_Tp>, _Size>
-to_array(_Tp(&&__arr)[_Size]) noexcept(is_nothrow_move_constructible_v<_Tp>) {
- static_assert(
- !is_array_v<_Tp>,
- "[array.creation]/4: to_array does not accept multidimensional arrays.");
- static_assert(
- is_move_constructible_v<_Tp>,
- "[array.creation]/4: to_array requires move constructible elements.");
- return std::__to_array_rvalue_impl(std::move(__arr),
- make_index_sequence<_Size>());
+to_array(_Tp (&&__arr)[_Size]) noexcept(is_nothrow_move_constructible_v<_Tp>) {
+ static_assert(!is_array_v<_Tp>, "[array.creation]/4: to_array does not accept multidimensional arrays.");
+ static_assert(is_move_constructible_v<_Tp>, "[array.creation]/4: to_array requires move constructible elements.");
+ return std::__to_array_rvalue_impl(std::move(__arr), make_index_sequence<_Size>());
}
#endif // _LIBCPP_STD_VER >= 20
diff --git a/contrib/llvm-project/libcxx/include/barrier b/contrib/llvm-project/libcxx/include/barrier
index dff650b75d1f..fcfc96cb0484 100644
--- a/contrib/llvm-project/libcxx/include/barrier
+++ b/contrib/llvm-project/libcxx/include/barrier
@@ -64,7 +64,7 @@ namespace std
#endif
#ifdef _LIBCPP_HAS_NO_THREADS
-# error "<barrier> is not supported since libc++ has been configured without support for threads."
+# error "<barrier> is not supported since libc++ has been configured without support for threads."
#endif
_LIBCPP_PUSH_MACROS
@@ -74,15 +74,11 @@ _LIBCPP_PUSH_MACROS
_LIBCPP_BEGIN_NAMESPACE_STD
-struct __empty_completion
-{
- inline _LIBCPP_HIDE_FROM_ABI
- void operator()() noexcept
- {
- }
+struct __empty_completion {
+ inline _LIBCPP_HIDE_FROM_ABI void operator()() noexcept {}
};
-#ifndef _LIBCPP_HAS_NO_TREE_BARRIER
+# ifndef _LIBCPP_HAS_NO_TREE_BARRIER
/*
@@ -102,73 +98,61 @@ using __barrier_phase_t = uint8_t;
class __barrier_algorithm_base;
-_LIBCPP_AVAILABILITY_SYNC _LIBCPP_EXPORTED_FROM_ABI
-__barrier_algorithm_base* __construct_barrier_algorithm_base(ptrdiff_t& __expected);
+_LIBCPP_AVAILABILITY_SYNC _LIBCPP_EXPORTED_FROM_ABI __barrier_algorithm_base*
+__construct_barrier_algorithm_base(ptrdiff_t& __expected);
-_LIBCPP_AVAILABILITY_SYNC _LIBCPP_EXPORTED_FROM_ABI
-bool __arrive_barrier_algorithm_base(__barrier_algorithm_base* __barrier,
- __barrier_phase_t __old_phase);
+_LIBCPP_AVAILABILITY_SYNC _LIBCPP_EXPORTED_FROM_ABI bool
+__arrive_barrier_algorithm_base(__barrier_algorithm_base* __barrier, __barrier_phase_t __old_phase);
-_LIBCPP_AVAILABILITY_SYNC _LIBCPP_EXPORTED_FROM_ABI
-void __destroy_barrier_algorithm_base(__barrier_algorithm_base* __barrier);
+_LIBCPP_AVAILABILITY_SYNC _LIBCPP_EXPORTED_FROM_ABI void
+__destroy_barrier_algorithm_base(__barrier_algorithm_base* __barrier);
-template<class _CompletionF>
+template <class _CompletionF>
class __barrier_base {
- ptrdiff_t __expected_;
- unique_ptr<__barrier_algorithm_base,
- void (*)(__barrier_algorithm_base*)> __base_;
- __atomic_base<ptrdiff_t> __expected_adjustment_;
- _CompletionF __completion_;
- __atomic_base<__barrier_phase_t> __phase_;
+ ptrdiff_t __expected_;
+ unique_ptr<__barrier_algorithm_base, void (*)(__barrier_algorithm_base*)> __base_;
+ __atomic_base<ptrdiff_t> __expected_adjustment_;
+ _CompletionF __completion_;
+ __atomic_base<__barrier_phase_t> __phase_;
public:
- using arrival_token = __barrier_phase_t;
-
- static _LIBCPP_HIDE_FROM_ABI constexpr ptrdiff_t max() noexcept {
- return numeric_limits<ptrdiff_t>::max();
- }
-
- _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI
- __barrier_base(ptrdiff_t __expected, _CompletionF __completion = _CompletionF())
- : __expected_(__expected), __base_(std::__construct_barrier_algorithm_base(this->__expected_),
- &__destroy_barrier_algorithm_base),
- __expected_adjustment_(0), __completion_(std::move(__completion)), __phase_(0)
- {
- }
- [[__nodiscard__]] _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI
- arrival_token arrive(ptrdiff_t __update)
- {
- _LIBCPP_ASSERT_UNCATEGORIZED(
- __update <= __expected_, "update is greater than the expected count for the current barrier phase");
-
- auto const __old_phase = __phase_.load(memory_order_relaxed);
- for(; __update; --__update)
- if(__arrive_barrier_algorithm_base(__base_.get(), __old_phase)) {
- __completion_();
- __expected_ += __expected_adjustment_.load(memory_order_relaxed);
- __expected_adjustment_.store(0, memory_order_relaxed);
- __phase_.store(__old_phase + 2, memory_order_release);
- __phase_.notify_all();
- }
- return __old_phase;
- }
- _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI
- void wait(arrival_token&& __old_phase) const
- {
- auto const __test_fn = [this, __old_phase]() -> bool {
- return __phase_.load(memory_order_acquire) != __old_phase;
- };
- std::__libcpp_thread_poll_with_backoff(__test_fn, __libcpp_timed_backoff_policy());
- }
- _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI
- void arrive_and_drop()
- {
- __expected_adjustment_.fetch_sub(1, memory_order_relaxed);
- (void)arrive(1);
- }
+ using arrival_token = __barrier_phase_t;
+
+ static _LIBCPP_HIDE_FROM_ABI constexpr ptrdiff_t max() noexcept { return numeric_limits<ptrdiff_t>::max(); }
+
+ _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI
+ __barrier_base(ptrdiff_t __expected, _CompletionF __completion = _CompletionF())
+ : __expected_(__expected),
+ __base_(std::__construct_barrier_algorithm_base(this->__expected_), &__destroy_barrier_algorithm_base),
+ __expected_adjustment_(0),
+ __completion_(std::move(__completion)),
+ __phase_(0) {}
+ [[__nodiscard__]] _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI arrival_token arrive(ptrdiff_t __update) {
+ _LIBCPP_ASSERT_UNCATEGORIZED(
+ __update <= __expected_, "update is greater than the expected count for the current barrier phase");
+
+ auto const __old_phase = __phase_.load(memory_order_relaxed);
+ for (; __update; --__update)
+ if (__arrive_barrier_algorithm_base(__base_.get(), __old_phase)) {
+ __completion_();
+ __expected_ += __expected_adjustment_.load(memory_order_relaxed);
+ __expected_adjustment_.store(0, memory_order_relaxed);
+ __phase_.store(__old_phase + 2, memory_order_release);
+ __phase_.notify_all();
+ }
+ return __old_phase;
+ }
+ _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI void wait(arrival_token&& __old_phase) const {
+ auto const __test_fn = [this, __old_phase]() -> bool { return __phase_.load(memory_order_acquire) != __old_phase; };
+ std::__libcpp_thread_poll_with_backoff(__test_fn, __libcpp_timed_backoff_policy());
+ }
+ _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI void arrive_and_drop() {
+ __expected_adjustment_.fetch_sub(1, memory_order_relaxed);
+ (void)arrive(1);
+ }
};
-#else
+# else
/*
@@ -183,167 +167,127 @@ Two versions of this algorithm are provided:
*/
-template<class _CompletionF>
+template <class _CompletionF>
class __barrier_base {
+ __atomic_base<ptrdiff_t> __expected;
+ __atomic_base<ptrdiff_t> __arrived;
+ _CompletionF __completion;
+ __atomic_base<bool> __phase;
- __atomic_base<ptrdiff_t> __expected;
- __atomic_base<ptrdiff_t> __arrived;
- _CompletionF __completion;
- __atomic_base<bool> __phase;
public:
- using arrival_token = bool;
+ using arrival_token = bool;
- static constexpr ptrdiff_t max() noexcept {
- return numeric_limits<ptrdiff_t>::max();
- }
+ static constexpr ptrdiff_t max() noexcept { return numeric_limits<ptrdiff_t>::max(); }
- _LIBCPP_HIDE_FROM_ABI
- __barrier_base(ptrdiff_t __expected, _CompletionF __completion = _CompletionF())
- : __expected(__expected), __arrived(__expected), __completion(std::move(__completion)), __phase(false)
- {
- }
- [[nodiscard]] _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI
- arrival_token arrive(ptrdiff_t update)
- {
- auto const __old_phase = __phase.load(memory_order_relaxed);
- auto const __result = __arrived.fetch_sub(update, memory_order_acq_rel) - update;
- auto const new_expected = __expected.load(memory_order_relaxed);
-
- _LIBCPP_ASSERT_UNCATEGORIZED(
- update <= new_expected, "update is greater than the expected count for the current barrier phase");
-
- if (0 == __result) {
- __completion();
- __arrived.store(new_expected, memory_order_relaxed);
- __phase.store(!__old_phase, memory_order_release);
- __phase.notify_all();
- }
- return __old_phase;
- }
- _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI
- void wait(arrival_token&& __old_phase) const
- {
- __phase.wait(__old_phase, memory_order_acquire);
- }
- _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI
- void arrive_and_drop()
- {
- __expected.fetch_sub(1, memory_order_relaxed);
- (void)arrive(1);
+ _LIBCPP_HIDE_FROM_ABI __barrier_base(ptrdiff_t __expected, _CompletionF __completion = _CompletionF())
+ : __expected(__expected), __arrived(__expected), __completion(std::move(__completion)), __phase(false) {}
+ [[nodiscard]] _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI arrival_token arrive(ptrdiff_t update) {
+ auto const __old_phase = __phase.load(memory_order_relaxed);
+ auto const __result = __arrived.fetch_sub(update, memory_order_acq_rel) - update;
+ auto const new_expected = __expected.load(memory_order_relaxed);
+
+ _LIBCPP_ASSERT_UNCATEGORIZED(
+ update <= new_expected, "update is greater than the expected count for the current barrier phase");
+
+ if (0 == __result) {
+ __completion();
+ __arrived.store(new_expected, memory_order_relaxed);
+ __phase.store(!__old_phase, memory_order_release);
+ __phase.notify_all();
}
+ return __old_phase;
+ }
+ _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI void wait(arrival_token&& __old_phase) const {
+ __phase.wait(__old_phase, memory_order_acquire);
+ }
+ _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI void arrive_and_drop() {
+ __expected.fetch_sub(1, memory_order_relaxed);
+ (void)arrive(1);
+ }
};
-template<>
+template <>
class __barrier_base<__empty_completion> {
+ static constexpr uint64_t __expected_unit = 1ull;
+ static constexpr uint64_t __arrived_unit = 1ull << 32;
+ static constexpr uint64_t __expected_mask = __arrived_unit - 1;
+ static constexpr uint64_t __phase_bit = 1ull << 63;
+ static constexpr uint64_t __arrived_mask = (__phase_bit - 1) & ~__expected_mask;
- static constexpr uint64_t __expected_unit = 1ull;
- static constexpr uint64_t __arrived_unit = 1ull << 32;
- static constexpr uint64_t __expected_mask = __arrived_unit - 1;
- static constexpr uint64_t __phase_bit = 1ull << 63;
- static constexpr uint64_t __arrived_mask = (__phase_bit - 1) & ~__expected_mask;
+ __atomic_base<uint64_t> __phase_arrived_expected;
- __atomic_base<uint64_t> __phase_arrived_expected;
-
- static _LIBCPP_HIDE_FROM_ABI
- constexpr uint64_t __init(ptrdiff_t __count) _NOEXCEPT
- {
- return ((uint64_t(1u << 31) - __count) << 32)
- | (uint64_t(1u << 31) - __count);
- }
+ static _LIBCPP_HIDE_FROM_ABI constexpr uint64_t __init(ptrdiff_t __count) _NOEXCEPT {
+ return ((uint64_t(1u << 31) - __count) << 32) | (uint64_t(1u << 31) - __count);
+ }
public:
- using arrival_token = uint64_t;
+ using arrival_token = uint64_t;
- static constexpr ptrdiff_t max() noexcept {
- return ptrdiff_t(1u << 31) - 1;
- }
+ static constexpr ptrdiff_t max() noexcept { return ptrdiff_t(1u << 31) - 1; }
- _LIBCPP_HIDE_FROM_ABI
- explicit inline __barrier_base(ptrdiff_t __count, __empty_completion = __empty_completion())
- : __phase_arrived_expected(__init(__count))
- {
- }
- [[nodiscard]] inline _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI
- arrival_token arrive(ptrdiff_t update)
- {
- auto const __inc = __arrived_unit * update;
- auto const __old = __phase_arrived_expected.fetch_add(__inc, memory_order_acq_rel);
-
- _LIBCPP_ASSERT_UNCATEGORIZED(
- update <= __old, "update is greater than the expected count for the current barrier phase");
-
- if ((__old ^ (__old + __inc)) & __phase_bit) {
- __phase_arrived_expected.fetch_add((__old & __expected_mask) << 32, memory_order_relaxed);
- __phase_arrived_expected.notify_all();
- }
- return __old & __phase_bit;
- }
- inline _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI
- void wait(arrival_token&& __phase) const
- {
- auto const __test_fn = [=]() -> bool {
- uint64_t const __current = __phase_arrived_expected.load(memory_order_acquire);
- return ((__current & __phase_bit) != __phase);
- };
- __libcpp_thread_poll_with_backoff(__test_fn, __libcpp_timed_backoff_policy());
- }
- inline _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI
- void arrive_and_drop()
- {
- __phase_arrived_expected.fetch_add(__expected_unit, memory_order_relaxed);
- (void)arrive(1);
+ _LIBCPP_HIDE_FROM_ABI explicit inline __barrier_base(ptrdiff_t __count, __empty_completion = __empty_completion())
+ : __phase_arrived_expected(__init(__count)) {}
+ [[nodiscard]] inline _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI arrival_token arrive(ptrdiff_t update) {
+ auto const __inc = __arrived_unit * update;
+ auto const __old = __phase_arrived_expected.fetch_add(__inc, memory_order_acq_rel);
+
+ _LIBCPP_ASSERT_UNCATEGORIZED(
+ update <= __old, "update is greater than the expected count for the current barrier phase");
+
+ if ((__old ^ (__old + __inc)) & __phase_bit) {
+ __phase_arrived_expected.fetch_add((__old & __expected_mask) << 32, memory_order_relaxed);
+ __phase_arrived_expected.notify_all();
}
+ return __old & __phase_bit;
+ }
+ inline _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI void wait(arrival_token&& __phase) const {
+ auto const __test_fn = [=]() -> bool {
+ uint64_t const __current = __phase_arrived_expected.load(memory_order_acquire);
+ return ((__current & __phase_bit) != __phase);
+ };
+ __libcpp_thread_poll_with_backoff(__test_fn, __libcpp_timed_backoff_policy());
+ }
+ inline _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI void arrive_and_drop() {
+ __phase_arrived_expected.fetch_add(__expected_unit, memory_order_relaxed);
+ (void)arrive(1);
+ }
};
-#endif // !_LIBCPP_HAS_NO_TREE_BARRIER
+# endif // !_LIBCPP_HAS_NO_TREE_BARRIER
-template<class _CompletionF = __empty_completion>
+template <class _CompletionF = __empty_completion>
class barrier {
+ __barrier_base<_CompletionF> __b_;
- __barrier_base<_CompletionF> __b_;
public:
- using arrival_token = typename __barrier_base<_CompletionF>::arrival_token;
-
- static _LIBCPP_HIDE_FROM_ABI constexpr ptrdiff_t max() noexcept {
- return __barrier_base<_CompletionF>::max();
- }
-
- _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI
- explicit barrier(ptrdiff_t __count, _CompletionF __completion = _CompletionF())
- : __b_(__count, std::move(__completion)) {
- _LIBCPP_ASSERT_UNCATEGORIZED(
- __count >= 0,
- "barrier::barrier(ptrdiff_t, CompletionFunction): barrier cannot be initialized with a negative value");
- _LIBCPP_ASSERT_UNCATEGORIZED(
- __count <= max(),
- "barrier::barrier(ptrdiff_t, CompletionFunction): barrier cannot be initialized with "
- "a value greater than max()");
- }
-
- barrier(barrier const&) = delete;
- barrier& operator=(barrier const&) = delete;
-
- [[__nodiscard__]] _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI
- arrival_token arrive(ptrdiff_t __update = 1)
- {
- _LIBCPP_ASSERT_UNCATEGORIZED(__update > 0, "barrier:arrive must be called with a value greater than 0");
- return __b_.arrive(__update);
- }
- _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI
- void wait(arrival_token&& __phase) const
- {
- __b_.wait(std::move(__phase));
- }
- _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI
- void arrive_and_wait()
- {
- wait(arrive());
- }
- _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI
- void arrive_and_drop()
- {
- __b_.arrive_and_drop();
- }
+ using arrival_token = typename __barrier_base<_CompletionF>::arrival_token;
+
+ static _LIBCPP_HIDE_FROM_ABI constexpr ptrdiff_t max() noexcept { return __barrier_base<_CompletionF>::max(); }
+
+ _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI explicit barrier(
+ ptrdiff_t __count, _CompletionF __completion = _CompletionF())
+ : __b_(__count, std::move(__completion)) {
+ _LIBCPP_ASSERT_UNCATEGORIZED(
+ __count >= 0,
+ "barrier::barrier(ptrdiff_t, CompletionFunction): barrier cannot be initialized with a negative value");
+ _LIBCPP_ASSERT_UNCATEGORIZED(
+ __count <= max(),
+ "barrier::barrier(ptrdiff_t, CompletionFunction): barrier cannot be initialized with "
+ "a value greater than max()");
+ }
+
+ barrier(barrier const&) = delete;
+ barrier& operator=(barrier const&) = delete;
+
+ [[__nodiscard__]] _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI arrival_token arrive(ptrdiff_t __update = 1) {
+ _LIBCPP_ASSERT_UNCATEGORIZED(__update > 0, "barrier:arrive must be called with a value greater than 0");
+ return __b_.arrive(__update);
+ }
+ _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI void wait(arrival_token&& __phase) const {
+ __b_.wait(std::move(__phase));
+ }
+ _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI void arrive_and_wait() { wait(arrive()); }
+ _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI void arrive_and_drop() { __b_.arrive_and_drop(); }
};
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/bitset b/contrib/llvm-project/libcxx/include/bitset
index d33015dc6b87..308c58995dc3 100644
--- a/contrib/llvm-project/libcxx/include/bitset
+++ b/contrib/llvm-project/libcxx/include/bitset
@@ -154,1012 +154,796 @@ template <size_t N> struct hash<std::bitset<N>>;
_LIBCPP_PUSH_MACROS
#include <__undef_macros>
-
_LIBCPP_BEGIN_NAMESPACE_STD
template <size_t _N_words, size_t _Size>
class __bitset;
template <size_t _N_words, size_t _Size>
-struct __has_storage_type<__bitset<_N_words, _Size> >
-{
- static const bool value = true;
+struct __has_storage_type<__bitset<_N_words, _Size> > {
+ static const bool value = true;
};
template <size_t _N_words, size_t _Size>
-class __bitset
-{
+class __bitset {
public:
- typedef ptrdiff_t difference_type;
- typedef size_t size_type;
- typedef size_type __storage_type;
+ typedef ptrdiff_t difference_type;
+ typedef size_t size_type;
+ typedef size_type __storage_type;
+
protected:
- typedef __bitset __self;
- typedef __storage_type* __storage_pointer;
- typedef const __storage_type* __const_storage_pointer;
- static const unsigned __bits_per_word = static_cast<unsigned>(sizeof(__storage_type) * CHAR_BIT);
-
- friend class __bit_reference<__bitset>;
- friend class __bit_const_reference<__bitset>;
- friend class __bit_iterator<__bitset, false>;
- friend class __bit_iterator<__bitset, true>;
- friend struct __bit_array<__bitset>;
-
- __storage_type __first_[_N_words];
-
- typedef __bit_reference<__bitset> reference;
- typedef __bit_const_reference<__bitset> const_reference;
- typedef __bit_iterator<__bitset, false> iterator;
- typedef __bit_iterator<__bitset, true> const_iterator;
-
- _LIBCPP_HIDE_FROM_ABI
- _LIBCPP_CONSTEXPR __bitset() _NOEXCEPT;
- _LIBCPP_HIDE_FROM_ABI
- explicit _LIBCPP_CONSTEXPR __bitset(unsigned long long __v) _NOEXCEPT;
-
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 reference __make_ref(size_t __pos) _NOEXCEPT
- {return reference(__first_ + __pos / __bits_per_word, __storage_type(1) << __pos % __bits_per_word);}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR const_reference __make_ref(size_t __pos) const _NOEXCEPT
- {return const_reference(__first_ + __pos / __bits_per_word, __storage_type(1) << __pos % __bits_per_word);}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 iterator __make_iter(size_t __pos) _NOEXCEPT
- {return iterator(__first_ + __pos / __bits_per_word, __pos % __bits_per_word);}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 const_iterator __make_iter(size_t __pos) const _NOEXCEPT
- {return const_iterator(__first_ + __pos / __bits_per_word, __pos % __bits_per_word);}
-
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23
- void operator&=(const __bitset& __v) _NOEXCEPT;
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23
- void operator|=(const __bitset& __v) _NOEXCEPT;
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23
- void operator^=(const __bitset& __v) _NOEXCEPT;
-
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 void flip() _NOEXCEPT;
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 unsigned long to_ulong() const
- {return to_ulong(integral_constant<bool, _Size < sizeof(unsigned long) * CHAR_BIT>());}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 unsigned long long to_ullong() const
- {return to_ullong(integral_constant<bool, _Size < sizeof(unsigned long long) * CHAR_BIT>());}
-
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bool all() const _NOEXCEPT;
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bool any() const _NOEXCEPT;
- _LIBCPP_HIDE_FROM_ABI
- size_t __hash_code() const _NOEXCEPT;
+ typedef __bitset __self;
+ typedef __storage_type* __storage_pointer;
+ typedef const __storage_type* __const_storage_pointer;
+ static const unsigned __bits_per_word = static_cast<unsigned>(sizeof(__storage_type) * CHAR_BIT);
+
+ friend class __bit_reference<__bitset>;
+ friend class __bit_const_reference<__bitset>;
+ friend class __bit_iterator<__bitset, false>;
+ friend class __bit_iterator<__bitset, true>;
+ friend struct __bit_array<__bitset>;
+
+ __storage_type __first_[_N_words];
+
+ typedef __bit_reference<__bitset> reference;
+ typedef __bit_const_reference<__bitset> const_reference;
+ typedef __bit_iterator<__bitset, false> iterator;
+ typedef __bit_iterator<__bitset, true> const_iterator;
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR __bitset() _NOEXCEPT;
+ _LIBCPP_HIDE_FROM_ABI explicit _LIBCPP_CONSTEXPR __bitset(unsigned long long __v) _NOEXCEPT;
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 reference __make_ref(size_t __pos) _NOEXCEPT {
+ return reference(__first_ + __pos / __bits_per_word, __storage_type(1) << __pos % __bits_per_word);
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR const_reference __make_ref(size_t __pos) const _NOEXCEPT {
+ return const_reference(__first_ + __pos / __bits_per_word, __storage_type(1) << __pos % __bits_per_word);
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 iterator __make_iter(size_t __pos) _NOEXCEPT {
+ return iterator(__first_ + __pos / __bits_per_word, __pos % __bits_per_word);
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 const_iterator __make_iter(size_t __pos) const _NOEXCEPT {
+ return const_iterator(__first_ + __pos / __bits_per_word, __pos % __bits_per_word);
+ }
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 void operator&=(const __bitset& __v) _NOEXCEPT;
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 void operator|=(const __bitset& __v) _NOEXCEPT;
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 void operator^=(const __bitset& __v) _NOEXCEPT;
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 void flip() _NOEXCEPT;
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 unsigned long to_ulong() const {
+ return to_ulong(integral_constant < bool, _Size< sizeof(unsigned long) * CHAR_BIT>());
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 unsigned long long to_ullong() const {
+ return to_ullong(integral_constant < bool, _Size< sizeof(unsigned long long) * CHAR_BIT>());
+ }
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bool all() const _NOEXCEPT;
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bool any() const _NOEXCEPT;
+ _LIBCPP_HIDE_FROM_ABI size_t __hash_code() const _NOEXCEPT;
+
private:
#ifdef _LIBCPP_CXX03_LANG
- void __init(unsigned long long __v, false_type) _NOEXCEPT;
- _LIBCPP_HIDE_FROM_ABI
- void __init(unsigned long long __v, true_type) _NOEXCEPT;
+ void __init(unsigned long long __v, false_type) _NOEXCEPT;
+ _LIBCPP_HIDE_FROM_ABI void __init(unsigned long long __v, true_type) _NOEXCEPT;
#endif // _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23
- unsigned long to_ulong(false_type) const;
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23
- unsigned long to_ulong(true_type) const;
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23
- unsigned long long to_ullong(false_type) const;
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23
- unsigned long long to_ullong(true_type) const;
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23
- unsigned long long to_ullong(true_type, false_type) const;
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23
- unsigned long long to_ullong(true_type, true_type) const;
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 unsigned long to_ulong(false_type) const;
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 unsigned long to_ulong(true_type) const;
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 unsigned long long to_ullong(false_type) const;
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 unsigned long long to_ullong(true_type) const;
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 unsigned long long to_ullong(true_type, false_type) const;
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 unsigned long long to_ullong(true_type, true_type) const;
};
template <size_t _N_words, size_t _Size>
-inline
-_LIBCPP_CONSTEXPR
-__bitset<_N_words, _Size>::__bitset() _NOEXCEPT
+inline _LIBCPP_CONSTEXPR __bitset<_N_words, _Size>::__bitset() _NOEXCEPT
#ifndef _LIBCPP_CXX03_LANG
: __first_{0}
#endif
{
#ifdef _LIBCPP_CXX03_LANG
- std::fill_n(__first_, _N_words, __storage_type(0));
+ std::fill_n(__first_, _N_words, __storage_type(0));
#endif
}
#ifdef _LIBCPP_CXX03_LANG
template <size_t _N_words, size_t _Size>
-void
-__bitset<_N_words, _Size>::__init(unsigned long long __v, false_type) _NOEXCEPT
-{
- __storage_type __t[sizeof(unsigned long long) / sizeof(__storage_type)];
- size_t __sz = _Size;
- for (size_t __i = 0; __i < sizeof(__t)/sizeof(__t[0]); ++__i, __v >>= __bits_per_word, __sz -= __bits_per_word )
- if ( __sz < __bits_per_word)
- __t[__i] = static_cast<__storage_type>(__v) & ( 1ULL << __sz ) - 1;
- else
- __t[__i] = static_cast<__storage_type>(__v);
-
- std::copy(__t, __t + sizeof(__t)/sizeof(__t[0]), __first_);
- std::fill(__first_ + sizeof(__t)/sizeof(__t[0]), __first_ + sizeof(__first_)/sizeof(__first_[0]),
- __storage_type(0));
+void __bitset<_N_words, _Size>::__init(unsigned long long __v, false_type) _NOEXCEPT {
+ __storage_type __t[sizeof(unsigned long long) / sizeof(__storage_type)];
+ size_t __sz = _Size;
+ for (size_t __i = 0; __i < sizeof(__t) / sizeof(__t[0]); ++__i, __v >>= __bits_per_word, __sz -= __bits_per_word)
+ if (__sz < __bits_per_word)
+ __t[__i] = static_cast<__storage_type>(__v) & (1ULL << __sz) - 1;
+ else
+ __t[__i] = static_cast<__storage_type>(__v);
+
+ std::copy(__t, __t + sizeof(__t) / sizeof(__t[0]), __first_);
+ std::fill(
+ __first_ + sizeof(__t) / sizeof(__t[0]), __first_ + sizeof(__first_) / sizeof(__first_[0]), __storage_type(0));
}
template <size_t _N_words, size_t _Size>
-inline _LIBCPP_HIDE_FROM_ABI
-void
-__bitset<_N_words, _Size>::__init(unsigned long long __v, true_type) _NOEXCEPT
-{
- __first_[0] = __v;
- if (_Size < __bits_per_word)
- __first_[0] &= ( 1ULL << _Size ) - 1;
+inline _LIBCPP_HIDE_FROM_ABI void __bitset<_N_words, _Size>::__init(unsigned long long __v, true_type) _NOEXCEPT {
+ __first_[0] = __v;
+ if (_Size < __bits_per_word)
+ __first_[0] &= (1ULL << _Size) - 1;
- std::fill(__first_ + 1, __first_ + sizeof(__first_)/sizeof(__first_[0]), __storage_type(0));
+ std::fill(__first_ + 1, __first_ + sizeof(__first_) / sizeof(__first_[0]), __storage_type(0));
}
#endif // _LIBCPP_CXX03_LANG
template <size_t _N_words, size_t _Size>
-inline
-_LIBCPP_CONSTEXPR
-__bitset<_N_words, _Size>::__bitset(unsigned long long __v) _NOEXCEPT
+inline _LIBCPP_CONSTEXPR __bitset<_N_words, _Size>::__bitset(unsigned long long __v) _NOEXCEPT
#ifndef _LIBCPP_CXX03_LANG
-#if __SIZEOF_SIZE_T__ == 8
+# if __SIZEOF_SIZE_T__ == 8
: __first_{__v}
-#elif __SIZEOF_SIZE_T__ == 4
+# elif __SIZEOF_SIZE_T__ == 4
: __first_{static_cast<__storage_type>(__v),
- _Size >= 2 * __bits_per_word ? static_cast<__storage_type>(__v >> __bits_per_word)
- : static_cast<__storage_type>((__v >> __bits_per_word) & (__storage_type(1) << (_Size - __bits_per_word)) - 1)}
-#else
-#error This constructor has not been ported to this platform
-#endif
+ _Size >= 2 * __bits_per_word
+ ? static_cast<__storage_type>(__v >> __bits_per_word)
+ : static_cast<__storage_type>((__v >> __bits_per_word) &
+ (__storage_type(1) << (_Size - __bits_per_word)) - 1)}
+# else
+# error This constructor has not been ported to this platform
+# endif
#endif
{
#ifdef _LIBCPP_CXX03_LANG
- __init(__v, integral_constant<bool, sizeof(unsigned long long) == sizeof(__storage_type)>());
+ __init(__v, integral_constant<bool, sizeof(unsigned long long) == sizeof(__storage_type)>());
#endif
}
template <size_t _N_words, size_t _Size>
-inline
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 void
-__bitset<_N_words, _Size>::operator&=(const __bitset& __v) _NOEXCEPT
-{
- for (size_type __i = 0; __i < _N_words; ++__i)
- __first_[__i] &= __v.__first_[__i];
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 void
+__bitset<_N_words, _Size>::operator&=(const __bitset& __v) _NOEXCEPT {
+ for (size_type __i = 0; __i < _N_words; ++__i)
+ __first_[__i] &= __v.__first_[__i];
}
template <size_t _N_words, size_t _Size>
-inline
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 void
-__bitset<_N_words, _Size>::operator|=(const __bitset& __v) _NOEXCEPT
-{
- for (size_type __i = 0; __i < _N_words; ++__i)
- __first_[__i] |= __v.__first_[__i];
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 void
+__bitset<_N_words, _Size>::operator|=(const __bitset& __v) _NOEXCEPT {
+ for (size_type __i = 0; __i < _N_words; ++__i)
+ __first_[__i] |= __v.__first_[__i];
}
template <size_t _N_words, size_t _Size>
-inline
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 void
-__bitset<_N_words, _Size>::operator^=(const __bitset& __v) _NOEXCEPT
-{
- for (size_type __i = 0; __i < _N_words; ++__i)
- __first_[__i] ^= __v.__first_[__i];
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 void
+__bitset<_N_words, _Size>::operator^=(const __bitset& __v) _NOEXCEPT {
+ for (size_type __i = 0; __i < _N_words; ++__i)
+ __first_[__i] ^= __v.__first_[__i];
}
template <size_t _N_words, size_t _Size>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 void
-__bitset<_N_words, _Size>::flip() _NOEXCEPT
-{
- // do middle whole words
- size_type __n = _Size;
- __storage_pointer __p = __first_;
- for (; __n >= __bits_per_word; ++__p, __n -= __bits_per_word)
- *__p = ~*__p;
- // do last partial word
- if (__n > 0)
- {
- __storage_type __m = ~__storage_type(0) >> (__bits_per_word - __n);
- __storage_type __b = *__p & __m;
- *__p &= ~__m;
- *__p |= ~__b & __m;
- }
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 void __bitset<_N_words, _Size>::flip() _NOEXCEPT {
+ // do middle whole words
+ size_type __n = _Size;
+ __storage_pointer __p = __first_;
+ for (; __n >= __bits_per_word; ++__p, __n -= __bits_per_word)
+ *__p = ~*__p;
+ // do last partial word
+ if (__n > 0) {
+ __storage_type __m = ~__storage_type(0) >> (__bits_per_word - __n);
+ __storage_type __b = *__p & __m;
+ *__p &= ~__m;
+ *__p |= ~__b & __m;
+ }
}
template <size_t _N_words, size_t _Size>
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 unsigned long
-__bitset<_N_words, _Size>::to_ulong(false_type) const
-{
- const_iterator __e = __make_iter(_Size);
- const_iterator __i = std::find(__make_iter(sizeof(unsigned long) * CHAR_BIT), __e, true);
- if (__i != __e)
- __throw_overflow_error("bitset to_ulong overflow error");
+__bitset<_N_words, _Size>::to_ulong(false_type) const {
+ const_iterator __e = __make_iter(_Size);
+ const_iterator __i = std::find(__make_iter(sizeof(unsigned long) * CHAR_BIT), __e, true);
+ if (__i != __e)
+ __throw_overflow_error("bitset to_ulong overflow error");
- return __first_[0];
+ return __first_[0];
}
template <size_t _N_words, size_t _Size>
-inline
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 unsigned long
-__bitset<_N_words, _Size>::to_ulong(true_type) const
-{
- return __first_[0];
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 unsigned long
+__bitset<_N_words, _Size>::to_ulong(true_type) const {
+ return __first_[0];
}
template <size_t _N_words, size_t _Size>
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 unsigned long long
-__bitset<_N_words, _Size>::to_ullong(false_type) const
-{
- const_iterator __e = __make_iter(_Size);
- const_iterator __i = std::find(__make_iter(sizeof(unsigned long long) * CHAR_BIT), __e, true);
- if (__i != __e)
- __throw_overflow_error("bitset to_ullong overflow error");
+__bitset<_N_words, _Size>::to_ullong(false_type) const {
+ const_iterator __e = __make_iter(_Size);
+ const_iterator __i = std::find(__make_iter(sizeof(unsigned long long) * CHAR_BIT), __e, true);
+ if (__i != __e)
+ __throw_overflow_error("bitset to_ullong overflow error");
- return to_ullong(true_type());
+ return to_ullong(true_type());
}
template <size_t _N_words, size_t _Size>
-inline
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 unsigned long long
-__bitset<_N_words, _Size>::to_ullong(true_type) const
-{
- return to_ullong(true_type(), integral_constant<bool, sizeof(__storage_type) < sizeof(unsigned long long)>());
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 unsigned long long
+__bitset<_N_words, _Size>::to_ullong(true_type) const {
+ return to_ullong(true_type(), integral_constant<bool, sizeof(__storage_type) < sizeof(unsigned long long)>());
}
template <size_t _N_words, size_t _Size>
-inline
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 unsigned long long
-__bitset<_N_words, _Size>::to_ullong(true_type, false_type) const
-{
- return __first_[0];
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 unsigned long long
+__bitset<_N_words, _Size>::to_ullong(true_type, false_type) const {
+ return __first_[0];
}
template <size_t _N_words, size_t _Size>
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 unsigned long long
-__bitset<_N_words, _Size>::to_ullong(true_type, true_type) const
-{
- unsigned long long __r = __first_[0];
- for (size_t __i = 1; __i < sizeof(unsigned long long) / sizeof(__storage_type); ++__i)
- __r |= static_cast<unsigned long long>(__first_[__i]) << (sizeof(__storage_type) * CHAR_BIT);
- return __r;
+__bitset<_N_words, _Size>::to_ullong(true_type, true_type) const {
+ unsigned long long __r = __first_[0];
+ for (size_t __i = 1; __i < sizeof(unsigned long long) / sizeof(__storage_type); ++__i)
+ __r |= static_cast<unsigned long long>(__first_[__i]) << (sizeof(__storage_type) * CHAR_BIT);
+ return __r;
}
template <size_t _N_words, size_t _Size>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bool
-__bitset<_N_words, _Size>::all() const _NOEXCEPT
-{
- // do middle whole words
- size_type __n = _Size;
- __const_storage_pointer __p = __first_;
- for (; __n >= __bits_per_word; ++__p, __n -= __bits_per_word)
- if (~*__p)
- return false;
- // do last partial word
- if (__n > 0)
- {
- __storage_type __m = ~__storage_type(0) >> (__bits_per_word - __n);
- if (~*__p & __m)
- return false;
- }
- return true;
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bool __bitset<_N_words, _Size>::all() const _NOEXCEPT {
+ // do middle whole words
+ size_type __n = _Size;
+ __const_storage_pointer __p = __first_;
+ for (; __n >= __bits_per_word; ++__p, __n -= __bits_per_word)
+ if (~*__p)
+ return false;
+ // do last partial word
+ if (__n > 0) {
+ __storage_type __m = ~__storage_type(0) >> (__bits_per_word - __n);
+ if (~*__p & __m)
+ return false;
+ }
+ return true;
}
template <size_t _N_words, size_t _Size>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bool
-__bitset<_N_words, _Size>::any() const _NOEXCEPT
-{
- // do middle whole words
- size_type __n = _Size;
- __const_storage_pointer __p = __first_;
- for (; __n >= __bits_per_word; ++__p, __n -= __bits_per_word)
- if (*__p)
- return true;
- // do last partial word
- if (__n > 0)
- {
- __storage_type __m = ~__storage_type(0) >> (__bits_per_word - __n);
- if (*__p & __m)
- return true;
- }
- return false;
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bool __bitset<_N_words, _Size>::any() const _NOEXCEPT {
+ // do middle whole words
+ size_type __n = _Size;
+ __const_storage_pointer __p = __first_;
+ for (; __n >= __bits_per_word; ++__p, __n -= __bits_per_word)
+ if (*__p)
+ return true;
+ // do last partial word
+ if (__n > 0) {
+ __storage_type __m = ~__storage_type(0) >> (__bits_per_word - __n);
+ if (*__p & __m)
+ return true;
+ }
+ return false;
}
template <size_t _N_words, size_t _Size>
-inline
-size_t
-__bitset<_N_words, _Size>::__hash_code() const _NOEXCEPT
-{
- size_t __h = 0;
- for (size_type __i = 0; __i < _N_words; ++__i)
- __h ^= __first_[__i];
- return __h;
+inline size_t __bitset<_N_words, _Size>::__hash_code() const _NOEXCEPT {
+ size_t __h = 0;
+ for (size_type __i = 0; __i < _N_words; ++__i)
+ __h ^= __first_[__i];
+ return __h;
}
template <size_t _Size>
-class __bitset<1, _Size>
-{
+class __bitset<1, _Size> {
public:
- typedef ptrdiff_t difference_type;
- typedef size_t size_type;
- typedef size_type __storage_type;
+ typedef ptrdiff_t difference_type;
+ typedef size_t size_type;
+ typedef size_type __storage_type;
+
protected:
- typedef __bitset __self;
- typedef __storage_type* __storage_pointer;
- typedef const __storage_type* __const_storage_pointer;
- static const unsigned __bits_per_word = static_cast<unsigned>(sizeof(__storage_type) * CHAR_BIT);
-
- friend class __bit_reference<__bitset>;
- friend class __bit_const_reference<__bitset>;
- friend class __bit_iterator<__bitset, false>;
- friend class __bit_iterator<__bitset, true>;
- friend struct __bit_array<__bitset>;
-
- __storage_type __first_;
-
- typedef __bit_reference<__bitset> reference;
- typedef __bit_const_reference<__bitset> const_reference;
- typedef __bit_iterator<__bitset, false> iterator;
- typedef __bit_iterator<__bitset, true> const_iterator;
-
- _LIBCPP_HIDE_FROM_ABI
- _LIBCPP_CONSTEXPR __bitset() _NOEXCEPT;
- _LIBCPP_HIDE_FROM_ABI
- explicit _LIBCPP_CONSTEXPR __bitset(unsigned long long __v) _NOEXCEPT;
-
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 reference __make_ref(size_t __pos) _NOEXCEPT
- {return reference(&__first_, __storage_type(1) << __pos);}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR const_reference __make_ref(size_t __pos) const _NOEXCEPT
- {return const_reference(&__first_, __storage_type(1) << __pos);}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 iterator __make_iter(size_t __pos) _NOEXCEPT
- {return iterator(&__first_ + __pos / __bits_per_word, __pos % __bits_per_word);}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 const_iterator __make_iter(size_t __pos) const _NOEXCEPT
- {return const_iterator(&__first_ + __pos / __bits_per_word, __pos % __bits_per_word);}
-
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23
- void operator&=(const __bitset& __v) _NOEXCEPT;
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23
- void operator|=(const __bitset& __v) _NOEXCEPT;
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23
- void operator^=(const __bitset& __v) _NOEXCEPT;
-
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23
- void flip() _NOEXCEPT;
-
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23
- unsigned long to_ulong() const;
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23
- unsigned long long to_ullong() const;
-
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23
- bool all() const _NOEXCEPT;
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23
- bool any() const _NOEXCEPT;
-
- _LIBCPP_HIDE_FROM_ABI
- size_t __hash_code() const _NOEXCEPT;
+ typedef __bitset __self;
+ typedef __storage_type* __storage_pointer;
+ typedef const __storage_type* __const_storage_pointer;
+ static const unsigned __bits_per_word = static_cast<unsigned>(sizeof(__storage_type) * CHAR_BIT);
+
+ friend class __bit_reference<__bitset>;
+ friend class __bit_const_reference<__bitset>;
+ friend class __bit_iterator<__bitset, false>;
+ friend class __bit_iterator<__bitset, true>;
+ friend struct __bit_array<__bitset>;
+
+ __storage_type __first_;
+
+ typedef __bit_reference<__bitset> reference;
+ typedef __bit_const_reference<__bitset> const_reference;
+ typedef __bit_iterator<__bitset, false> iterator;
+ typedef __bit_iterator<__bitset, true> const_iterator;
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR __bitset() _NOEXCEPT;
+ _LIBCPP_HIDE_FROM_ABI explicit _LIBCPP_CONSTEXPR __bitset(unsigned long long __v) _NOEXCEPT;
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 reference __make_ref(size_t __pos) _NOEXCEPT {
+ return reference(&__first_, __storage_type(1) << __pos);
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR const_reference __make_ref(size_t __pos) const _NOEXCEPT {
+ return const_reference(&__first_, __storage_type(1) << __pos);
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 iterator __make_iter(size_t __pos) _NOEXCEPT {
+ return iterator(&__first_ + __pos / __bits_per_word, __pos % __bits_per_word);
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 const_iterator __make_iter(size_t __pos) const _NOEXCEPT {
+ return const_iterator(&__first_ + __pos / __bits_per_word, __pos % __bits_per_word);
+ }
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 void operator&=(const __bitset& __v) _NOEXCEPT;
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 void operator|=(const __bitset& __v) _NOEXCEPT;
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 void operator^=(const __bitset& __v) _NOEXCEPT;
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 void flip() _NOEXCEPT;
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 unsigned long to_ulong() const;
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 unsigned long long to_ullong() const;
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bool all() const _NOEXCEPT;
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bool any() const _NOEXCEPT;
+
+ _LIBCPP_HIDE_FROM_ABI size_t __hash_code() const _NOEXCEPT;
};
template <size_t _Size>
-inline
-_LIBCPP_CONSTEXPR
-__bitset<1, _Size>::__bitset() _NOEXCEPT
- : __first_(0)
-{
-}
+inline _LIBCPP_CONSTEXPR __bitset<1, _Size>::__bitset() _NOEXCEPT : __first_(0) {}
template <size_t _Size>
-inline
-_LIBCPP_CONSTEXPR
-__bitset<1, _Size>::__bitset(unsigned long long __v) _NOEXCEPT
- : __first_(
- _Size == __bits_per_word ? static_cast<__storage_type>(__v)
- : static_cast<__storage_type>(__v) & ((__storage_type(1) << _Size) - 1)
- )
-{
-}
+inline _LIBCPP_CONSTEXPR __bitset<1, _Size>::__bitset(unsigned long long __v) _NOEXCEPT
+ : __first_(_Size == __bits_per_word ? static_cast<__storage_type>(__v)
+ : static_cast<__storage_type>(__v) & ((__storage_type(1) << _Size) - 1)) {}
template <size_t _Size>
-inline
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 void
-__bitset<1, _Size>::operator&=(const __bitset& __v) _NOEXCEPT
-{
- __first_ &= __v.__first_;
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 void
+__bitset<1, _Size>::operator&=(const __bitset& __v) _NOEXCEPT {
+ __first_ &= __v.__first_;
}
template <size_t _Size>
-inline
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 void
-__bitset<1, _Size>::operator|=(const __bitset& __v) _NOEXCEPT
-{
- __first_ |= __v.__first_;
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 void
+__bitset<1, _Size>::operator|=(const __bitset& __v) _NOEXCEPT {
+ __first_ |= __v.__first_;
}
template <size_t _Size>
-inline
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 void
-__bitset<1, _Size>::operator^=(const __bitset& __v) _NOEXCEPT
-{
- __first_ ^= __v.__first_;
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 void
+__bitset<1, _Size>::operator^=(const __bitset& __v) _NOEXCEPT {
+ __first_ ^= __v.__first_;
}
template <size_t _Size>
-inline
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 void
-__bitset<1, _Size>::flip() _NOEXCEPT
-{
- __storage_type __m = ~__storage_type(0) >> (__bits_per_word - _Size);
- __first_ = ~__first_;
- __first_ &= __m;
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 void __bitset<1, _Size>::flip() _NOEXCEPT {
+ __storage_type __m = ~__storage_type(0) >> (__bits_per_word - _Size);
+ __first_ = ~__first_;
+ __first_ &= __m;
}
template <size_t _Size>
-inline
-_LIBCPP_CONSTEXPR_SINCE_CXX23 unsigned long
-__bitset<1, _Size>::to_ulong() const
-{
- return __first_;
+inline _LIBCPP_CONSTEXPR_SINCE_CXX23 unsigned long __bitset<1, _Size>::to_ulong() const {
+ return __first_;
}
template <size_t _Size>
-inline
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 unsigned long long
-__bitset<1, _Size>::to_ullong() const
-{
- return __first_;
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 unsigned long long __bitset<1, _Size>::to_ullong() const {
+ return __first_;
}
template <size_t _Size>
-inline
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bool
-__bitset<1, _Size>::all() const _NOEXCEPT
-{
- __storage_type __m = ~__storage_type(0) >> (__bits_per_word - _Size);
- return !(~__first_ & __m);
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bool __bitset<1, _Size>::all() const _NOEXCEPT {
+ __storage_type __m = ~__storage_type(0) >> (__bits_per_word - _Size);
+ return !(~__first_ & __m);
}
template <size_t _Size>
-inline
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bool
-__bitset<1, _Size>::any() const _NOEXCEPT
-{
- __storage_type __m = ~__storage_type(0) >> (__bits_per_word - _Size);
- return __first_ & __m;
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bool __bitset<1, _Size>::any() const _NOEXCEPT {
+ __storage_type __m = ~__storage_type(0) >> (__bits_per_word - _Size);
+ return __first_ & __m;
}
template <size_t _Size>
-inline
-size_t
-__bitset<1, _Size>::__hash_code() const _NOEXCEPT
-{
- return __first_;
+inline size_t __bitset<1, _Size>::__hash_code() const _NOEXCEPT {
+ return __first_;
}
template <>
-class __bitset<0, 0>
-{
+class __bitset<0, 0> {
public:
- typedef ptrdiff_t difference_type;
- typedef size_t size_type;
- typedef size_type __storage_type;
+ typedef ptrdiff_t difference_type;
+ typedef size_t size_type;
+ typedef size_type __storage_type;
+
protected:
- typedef __bitset __self;
- typedef __storage_type* __storage_pointer;
- typedef const __storage_type* __const_storage_pointer;
- static const unsigned __bits_per_word = static_cast<unsigned>(sizeof(__storage_type) * CHAR_BIT);
-
- friend class __bit_reference<__bitset>;
- friend class __bit_const_reference<__bitset>;
- friend class __bit_iterator<__bitset, false>;
- friend class __bit_iterator<__bitset, true>;
- friend struct __bit_array<__bitset>;
-
- typedef __bit_reference<__bitset> reference;
- typedef __bit_const_reference<__bitset> const_reference;
- typedef __bit_iterator<__bitset, false> iterator;
- typedef __bit_iterator<__bitset, true> const_iterator;
-
- _LIBCPP_HIDE_FROM_ABI
- _LIBCPP_CONSTEXPR __bitset() _NOEXCEPT;
- _LIBCPP_HIDE_FROM_ABI
- explicit _LIBCPP_CONSTEXPR __bitset(unsigned long long) _NOEXCEPT;
-
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 reference __make_ref(size_t) _NOEXCEPT
- {return reference(nullptr, 1);}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR const_reference __make_ref(size_t) const _NOEXCEPT
- {return const_reference(nullptr, 1);}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 iterator __make_iter(size_t) _NOEXCEPT
- {return iterator(nullptr, 0);}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 const_iterator __make_iter(size_t) const _NOEXCEPT
- {return const_iterator(nullptr, 0);}
-
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 void operator&=(const __bitset&) _NOEXCEPT {}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 void operator|=(const __bitset&) _NOEXCEPT {}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 void operator^=(const __bitset&) _NOEXCEPT {}
-
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 void flip() _NOEXCEPT {}
-
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 unsigned long to_ulong() const {return 0;}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 unsigned long long to_ullong() const {return 0;}
-
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bool all() const _NOEXCEPT {return true;}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bool any() const _NOEXCEPT {return false;}
-
- _LIBCPP_HIDE_FROM_ABI size_t __hash_code() const _NOEXCEPT {return 0;}
+ typedef __bitset __self;
+ typedef __storage_type* __storage_pointer;
+ typedef const __storage_type* __const_storage_pointer;
+ static const unsigned __bits_per_word = static_cast<unsigned>(sizeof(__storage_type) * CHAR_BIT);
+
+ friend class __bit_reference<__bitset>;
+ friend class __bit_const_reference<__bitset>;
+ friend class __bit_iterator<__bitset, false>;
+ friend class __bit_iterator<__bitset, true>;
+ friend struct __bit_array<__bitset>;
+
+ typedef __bit_reference<__bitset> reference;
+ typedef __bit_const_reference<__bitset> const_reference;
+ typedef __bit_iterator<__bitset, false> iterator;
+ typedef __bit_iterator<__bitset, true> const_iterator;
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR __bitset() _NOEXCEPT;
+ _LIBCPP_HIDE_FROM_ABI explicit _LIBCPP_CONSTEXPR __bitset(unsigned long long) _NOEXCEPT;
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 reference __make_ref(size_t) _NOEXCEPT {
+ return reference(nullptr, 1);
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR const_reference __make_ref(size_t) const _NOEXCEPT {
+ return const_reference(nullptr, 1);
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 iterator __make_iter(size_t) _NOEXCEPT {
+ return iterator(nullptr, 0);
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 const_iterator __make_iter(size_t) const _NOEXCEPT {
+ return const_iterator(nullptr, 0);
+ }
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 void operator&=(const __bitset&) _NOEXCEPT {}
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 void operator|=(const __bitset&) _NOEXCEPT {}
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 void operator^=(const __bitset&) _NOEXCEPT {}
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 void flip() _NOEXCEPT {}
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 unsigned long to_ulong() const { return 0; }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 unsigned long long to_ullong() const { return 0; }
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bool all() const _NOEXCEPT { return true; }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bool any() const _NOEXCEPT { return false; }
+
+ _LIBCPP_HIDE_FROM_ABI size_t __hash_code() const _NOEXCEPT { return 0; }
};
-inline
-_LIBCPP_CONSTEXPR
-__bitset<0, 0>::__bitset() _NOEXCEPT
-{
-}
+inline _LIBCPP_CONSTEXPR __bitset<0, 0>::__bitset() _NOEXCEPT {}
-inline
-_LIBCPP_CONSTEXPR
-__bitset<0, 0>::__bitset(unsigned long long) _NOEXCEPT
-{
-}
+inline _LIBCPP_CONSTEXPR __bitset<0, 0>::__bitset(unsigned long long) _NOEXCEPT {}
-template <size_t _Size> class _LIBCPP_TEMPLATE_VIS bitset;
-template <size_t _Size> struct hash<bitset<_Size> >;
+template <size_t _Size>
+class _LIBCPP_TEMPLATE_VIS bitset;
+template <size_t _Size>
+struct hash<bitset<_Size> >;
template <size_t _Size>
class _LIBCPP_TEMPLATE_VIS bitset
- : private __bitset<_Size == 0 ? 0 : (_Size - 1) / (sizeof(size_t) * CHAR_BIT) + 1, _Size>
-{
+ : private __bitset<_Size == 0 ? 0 : (_Size - 1) / (sizeof(size_t) * CHAR_BIT) + 1, _Size> {
public:
- static const unsigned __n_words = _Size == 0 ? 0 : (_Size - 1) / (sizeof(size_t) * CHAR_BIT) + 1;
- typedef __bitset<__n_words, _Size> base;
+ static const unsigned __n_words = _Size == 0 ? 0 : (_Size - 1) / (sizeof(size_t) * CHAR_BIT) + 1;
+ typedef __bitset<__n_words, _Size> base;
public:
- typedef typename base::reference reference;
- typedef typename base::const_reference const_reference;
-
- // 23.3.5.1 constructors:
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bitset() _NOEXCEPT {}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR
- bitset(unsigned long long __v) _NOEXCEPT : base(__v) {}
- template <class _CharT, class = __enable_if_t<_IsCharLikeType<_CharT>::value> >
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 explicit bitset(
- const _CharT* __str,
-# if _LIBCPP_STD_VER >= 26
- typename basic_string_view<_CharT>::size_type __n = basic_string_view<_CharT>::npos,
-# else
- typename basic_string<_CharT>::size_type __n = basic_string<_CharT>::npos,
-# endif
- _CharT __zero = _CharT('0'),
- _CharT __one = _CharT('1')) {
-
- size_t __rlen = std::min(__n, char_traits<_CharT>::length(__str));
- __init_from_string_view(basic_string_view<_CharT>(__str, __rlen), __zero, __one);
- }
+ typedef typename base::reference reference;
+ typedef typename base::const_reference const_reference;
+
+ // 23.3.5.1 constructors:
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bitset() _NOEXCEPT {}
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bitset(unsigned long long __v) _NOEXCEPT : base(__v) {}
+ template <class _CharT, class = __enable_if_t<_IsCharLikeType<_CharT>::value> >
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 explicit bitset(
+ const _CharT* __str,
#if _LIBCPP_STD_VER >= 26
- template <class _CharT, class _Traits>
- _LIBCPP_HIDE_FROM_ABI constexpr explicit bitset(
- basic_string_view<_CharT, _Traits> __str,
- typename basic_string_view<_CharT, _Traits>::size_type __pos = 0,
- typename basic_string_view<_CharT, _Traits>::size_type __n = basic_string_view<_CharT, _Traits>::npos,
- _CharT __zero = _CharT('0'),
- _CharT __one = _CharT('1')) {
- if (__pos > __str.size())
- __throw_out_of_range("bitset string pos out of range");
-
- size_t __rlen = std::min(__n, __str.size() - __pos);
- __init_from_string_view(basic_string_view<_CharT, _Traits>(__str.data() + __pos, __rlen), __zero, __one);
- }
+ typename basic_string_view<_CharT>::size_type __n = basic_string_view<_CharT>::npos,
+#else
+ typename basic_string<_CharT>::size_type __n = basic_string<_CharT>::npos,
#endif
- template <class _CharT, class _Traits, class _Allocator>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 explicit bitset(
- const basic_string<_CharT, _Traits, _Allocator>& __str,
- typename basic_string<_CharT, _Traits, _Allocator>::size_type __pos = 0,
- typename basic_string<_CharT, _Traits, _Allocator>::size_type __n =
- basic_string<_CharT, _Traits, _Allocator>::npos,
- _CharT __zero = _CharT('0'),
- _CharT __one = _CharT('1')) {
- if (__pos > __str.size())
- std::__throw_out_of_range("bitset string pos out of range");
-
- size_t __rlen = std::min(__n, __str.size() - __pos);
- __init_from_string_view(basic_string_view<_CharT, _Traits>(__str.data() + __pos, __rlen), __zero, __one);
- }
-
- // 23.3.5.2 bitset operations:
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23
- bitset& operator&=(const bitset& __rhs) _NOEXCEPT;
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23
- bitset& operator|=(const bitset& __rhs) _NOEXCEPT;
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23
- bitset& operator^=(const bitset& __rhs) _NOEXCEPT;
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23
- bitset& operator<<=(size_t __pos) _NOEXCEPT;
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23
- bitset& operator>>=(size_t __pos) _NOEXCEPT;
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23
- bitset& set() _NOEXCEPT;
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23
- bitset& set(size_t __pos, bool __val = true);
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23
- bitset& reset() _NOEXCEPT;
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23
- bitset& reset(size_t __pos);
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23
- bitset operator~() const _NOEXCEPT;
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23
- bitset& flip() _NOEXCEPT;
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23
- bitset& flip(size_t __pos);
+ _CharT __zero = _CharT('0'),
+ _CharT __one = _CharT('1')) {
- // element access:
+ size_t __rlen = std::min(__n, char_traits<_CharT>::length(__str));
+ __init_from_string_view(basic_string_view<_CharT>(__str, __rlen), __zero, __one);
+ }
+#if _LIBCPP_STD_VER >= 26
+ template <class _CharT, class _Traits>
+ _LIBCPP_HIDE_FROM_ABI constexpr explicit bitset(
+ basic_string_view<_CharT, _Traits> __str,
+ typename basic_string_view<_CharT, _Traits>::size_type __pos = 0,
+ typename basic_string_view<_CharT, _Traits>::size_type __n = basic_string_view<_CharT, _Traits>::npos,
+ _CharT __zero = _CharT('0'),
+ _CharT __one = _CharT('1')) {
+ if (__pos > __str.size())
+ __throw_out_of_range("bitset string pos out of range");
+
+ size_t __rlen = std::min(__n, __str.size() - __pos);
+ __init_from_string_view(basic_string_view<_CharT, _Traits>(__str.data() + __pos, __rlen), __zero, __one);
+ }
+#endif
+ template <class _CharT, class _Traits, class _Allocator>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 explicit bitset(
+ const basic_string<_CharT, _Traits, _Allocator>& __str,
+ typename basic_string<_CharT, _Traits, _Allocator>::size_type __pos = 0,
+ typename basic_string<_CharT, _Traits, _Allocator>::size_type __n =
+ basic_string<_CharT, _Traits, _Allocator>::npos,
+ _CharT __zero = _CharT('0'),
+ _CharT __one = _CharT('1')) {
+ if (__pos > __str.size())
+ std::__throw_out_of_range("bitset string pos out of range");
+
+ size_t __rlen = std::min(__n, __str.size() - __pos);
+ __init_from_string_view(basic_string_view<_CharT, _Traits>(__str.data() + __pos, __rlen), __zero, __one);
+ }
+
+ // 23.3.5.2 bitset operations:
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bitset& operator&=(const bitset& __rhs) _NOEXCEPT;
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bitset& operator|=(const bitset& __rhs) _NOEXCEPT;
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bitset& operator^=(const bitset& __rhs) _NOEXCEPT;
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bitset& operator<<=(size_t __pos) _NOEXCEPT;
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bitset& operator>>=(size_t __pos) _NOEXCEPT;
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bitset& set() _NOEXCEPT;
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bitset& set(size_t __pos, bool __val = true);
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bitset& reset() _NOEXCEPT;
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bitset& reset(size_t __pos);
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bitset operator~() const _NOEXCEPT;
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bitset& flip() _NOEXCEPT;
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bitset& flip(size_t __pos);
+
+ // element access:
#ifdef _LIBCPP_ABI_BITSET_VECTOR_BOOL_CONST_SUBSCRIPT_RETURN_BOOL
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool operator[](size_t __p) const {return base::__make_ref(__p);}
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool operator[](size_t __p) const { return base::__make_ref(__p); }
#else
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR const_reference operator[](size_t __p) const {return base::__make_ref(__p);}
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR const_reference operator[](size_t __p) const { return base::__make_ref(__p); }
#endif
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 reference operator[](size_t __p) {return base::__make_ref(__p);}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23
- unsigned long to_ulong() const;
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23
- unsigned long long to_ullong() const;
- template <class _CharT, class _Traits, class _Allocator>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23
- basic_string<_CharT, _Traits, _Allocator> to_string(_CharT __zero = _CharT('0'),
- _CharT __one = _CharT('1')) const;
- template <class _CharT, class _Traits>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23
- basic_string<_CharT, _Traits, allocator<_CharT> > to_string(_CharT __zero = _CharT('0'),
- _CharT __one = _CharT('1')) const;
- template <class _CharT>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23
- basic_string<_CharT, char_traits<_CharT>, allocator<_CharT> > to_string(_CharT __zero = _CharT('0'),
- _CharT __one = _CharT('1')) const;
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23
- basic_string<char, char_traits<char>, allocator<char> > to_string(char __zero = '0',
- char __one = '1') const;
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23
- size_t count() const _NOEXCEPT;
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR size_t size() const _NOEXCEPT {return _Size;}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23
- bool operator==(const bitset& __rhs) const _NOEXCEPT;
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 reference operator[](size_t __p) { return base::__make_ref(__p); }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 unsigned long to_ulong() const;
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 unsigned long long to_ullong() const;
+ template <class _CharT, class _Traits, class _Allocator>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 basic_string<_CharT, _Traits, _Allocator>
+ to_string(_CharT __zero = _CharT('0'), _CharT __one = _CharT('1')) const;
+ template <class _CharT, class _Traits>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 basic_string<_CharT, _Traits, allocator<_CharT> >
+ to_string(_CharT __zero = _CharT('0'), _CharT __one = _CharT('1')) const;
+ template <class _CharT>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 basic_string<_CharT, char_traits<_CharT>, allocator<_CharT> >
+ to_string(_CharT __zero = _CharT('0'), _CharT __one = _CharT('1')) const;
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 basic_string<char, char_traits<char>, allocator<char> >
+ to_string(char __zero = '0', char __one = '1') const;
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 size_t count() const _NOEXCEPT;
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR size_t size() const _NOEXCEPT { return _Size; }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bool operator==(const bitset& __rhs) const _NOEXCEPT;
#if _LIBCPP_STD_VER <= 17
- _LIBCPP_HIDE_FROM_ABI
- bool operator!=(const bitset& __rhs) const _NOEXCEPT;
+ _LIBCPP_HIDE_FROM_ABI bool operator!=(const bitset& __rhs) const _NOEXCEPT;
#endif
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23
- bool test(size_t __pos) const;
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23
- bool all() const _NOEXCEPT;
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23
- bool any() const _NOEXCEPT;
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bool none() const _NOEXCEPT {return !any();}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23
- bitset operator<<(size_t __pos) const _NOEXCEPT;
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23
- bitset operator>>(size_t __pos) const _NOEXCEPT;
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bool test(size_t __pos) const;
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bool all() const _NOEXCEPT;
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bool any() const _NOEXCEPT;
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bool none() const _NOEXCEPT { return !any(); }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bitset operator<<(size_t __pos) const _NOEXCEPT;
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bitset operator>>(size_t __pos) const _NOEXCEPT;
private:
- template <class _CharT, class _Traits>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 void
- __init_from_string_view(basic_string_view<_CharT, _Traits> __str, _CharT __zero, _CharT __one) {
-
- for (size_t __i = 0; __i < __str.size(); ++__i)
- if (!_Traits::eq(__str[__i], __zero) && !_Traits::eq(__str[__i], __one))
- std::__throw_invalid_argument("bitset string ctor has invalid argument");
-
- size_t __mp = std::min(__str.size(), _Size);
- size_t __i = 0;
- for (; __i < __mp; ++__i) {
- _CharT __c = __str[__mp - 1 - __i];
- (*this)[__i] = _Traits::eq(__c, __one);
- }
- std::fill(base::__make_iter(__i), base::__make_iter(_Size), false);
+ template <class _CharT, class _Traits>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 void
+ __init_from_string_view(basic_string_view<_CharT, _Traits> __str, _CharT __zero, _CharT __one) {
+ for (size_t __i = 0; __i < __str.size(); ++__i)
+ if (!_Traits::eq(__str[__i], __zero) && !_Traits::eq(__str[__i], __one))
+ std::__throw_invalid_argument("bitset string ctor has invalid argument");
+
+ size_t __mp = std::min(__str.size(), _Size);
+ size_t __i = 0;
+ for (; __i < __mp; ++__i) {
+ _CharT __c = __str[__mp - 1 - __i];
+ (*this)[__i] = _Traits::eq(__c, __one);
}
+ std::fill(base::__make_iter(__i), base::__make_iter(_Size), false);
+ }
- _LIBCPP_HIDE_FROM_ABI
- size_t __hash_code() const _NOEXCEPT {return base::__hash_code();}
+ _LIBCPP_HIDE_FROM_ABI size_t __hash_code() const _NOEXCEPT { return base::__hash_code(); }
- friend struct hash<bitset>;
+ friend struct hash<bitset>;
};
template <size_t _Size>
-inline
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23
-bitset<_Size>&
-bitset<_Size>::operator&=(const bitset& __rhs) _NOEXCEPT
-{
- base::operator&=(__rhs);
- return *this;
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bitset<_Size>&
+bitset<_Size>::operator&=(const bitset& __rhs) _NOEXCEPT {
+ base::operator&=(__rhs);
+ return *this;
}
template <size_t _Size>
-inline
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23
-bitset<_Size>&
-bitset<_Size>::operator|=(const bitset& __rhs) _NOEXCEPT
-{
- base::operator|=(__rhs);
- return *this;
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bitset<_Size>&
+bitset<_Size>::operator|=(const bitset& __rhs) _NOEXCEPT {
+ base::operator|=(__rhs);
+ return *this;
}
template <size_t _Size>
-inline
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23
-bitset<_Size>&
-bitset<_Size>::operator^=(const bitset& __rhs) _NOEXCEPT
-{
- base::operator^=(__rhs);
- return *this;
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bitset<_Size>&
+bitset<_Size>::operator^=(const bitset& __rhs) _NOEXCEPT {
+ base::operator^=(__rhs);
+ return *this;
}
template <size_t _Size>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23
-bitset<_Size>&
-bitset<_Size>::operator<<=(size_t __pos) _NOEXCEPT
-{
- __pos = std::min(__pos, _Size);
- std::copy_backward(base::__make_iter(0), base::__make_iter(_Size - __pos), base::__make_iter(_Size));
- std::fill_n(base::__make_iter(0), __pos, false);
- return *this;
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bitset<_Size>& bitset<_Size>::operator<<=(size_t __pos) _NOEXCEPT {
+ __pos = std::min(__pos, _Size);
+ std::copy_backward(base::__make_iter(0), base::__make_iter(_Size - __pos), base::__make_iter(_Size));
+ std::fill_n(base::__make_iter(0), __pos, false);
+ return *this;
}
template <size_t _Size>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23
-bitset<_Size>&
-bitset<_Size>::operator>>=(size_t __pos) _NOEXCEPT
-{
- __pos = std::min(__pos, _Size);
- std::copy(base::__make_iter(__pos), base::__make_iter(_Size), base::__make_iter(0));
- std::fill_n(base::__make_iter(_Size - __pos), __pos, false);
- return *this;
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bitset<_Size>& bitset<_Size>::operator>>=(size_t __pos) _NOEXCEPT {
+ __pos = std::min(__pos, _Size);
+ std::copy(base::__make_iter(__pos), base::__make_iter(_Size), base::__make_iter(0));
+ std::fill_n(base::__make_iter(_Size - __pos), __pos, false);
+ return *this;
}
template <size_t _Size>
-inline
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23
-bitset<_Size>&
-bitset<_Size>::set() _NOEXCEPT
-{
- std::fill_n(base::__make_iter(0), _Size, true);
- return *this;
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bitset<_Size>& bitset<_Size>::set() _NOEXCEPT {
+ std::fill_n(base::__make_iter(0), _Size, true);
+ return *this;
}
template <size_t _Size>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23
-bitset<_Size>&
-bitset<_Size>::set(size_t __pos, bool __val)
-{
- if (__pos >= _Size)
- __throw_out_of_range("bitset set argument out of range");
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bitset<_Size>& bitset<_Size>::set(size_t __pos, bool __val) {
+ if (__pos >= _Size)
+ __throw_out_of_range("bitset set argument out of range");
- (*this)[__pos] = __val;
- return *this;
+ (*this)[__pos] = __val;
+ return *this;
}
template <size_t _Size>
-inline
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23
-bitset<_Size>&
-bitset<_Size>::reset() _NOEXCEPT
-{
- std::fill_n(base::__make_iter(0), _Size, false);
- return *this;
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bitset<_Size>& bitset<_Size>::reset() _NOEXCEPT {
+ std::fill_n(base::__make_iter(0), _Size, false);
+ return *this;
}
template <size_t _Size>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23
-bitset<_Size>&
-bitset<_Size>::reset(size_t __pos)
-{
- if (__pos >= _Size)
- __throw_out_of_range("bitset reset argument out of range");
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bitset<_Size>& bitset<_Size>::reset(size_t __pos) {
+ if (__pos >= _Size)
+ __throw_out_of_range("bitset reset argument out of range");
- (*this)[__pos] = false;
- return *this;
+ (*this)[__pos] = false;
+ return *this;
}
template <size_t _Size>
-inline
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23
-bitset<_Size>
-bitset<_Size>::operator~() const _NOEXCEPT
-{
- bitset __x(*this);
- __x.flip();
- return __x;
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bitset<_Size> bitset<_Size>::operator~() const _NOEXCEPT {
+ bitset __x(*this);
+ __x.flip();
+ return __x;
}
template <size_t _Size>
-inline
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23
-bitset<_Size>&
-bitset<_Size>::flip() _NOEXCEPT
-{
- base::flip();
- return *this;
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bitset<_Size>& bitset<_Size>::flip() _NOEXCEPT {
+ base::flip();
+ return *this;
}
template <size_t _Size>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23
-bitset<_Size>&
-bitset<_Size>::flip(size_t __pos)
-{
- if (__pos >= _Size)
- __throw_out_of_range("bitset flip argument out of range");
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bitset<_Size>& bitset<_Size>::flip(size_t __pos) {
+ if (__pos >= _Size)
+ __throw_out_of_range("bitset flip argument out of range");
- reference __r = base::__make_ref(__pos);
- __r = ~__r;
- return *this;
+ reference __r = base::__make_ref(__pos);
+ __r = ~__r;
+ return *this;
}
template <size_t _Size>
-inline
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23
-unsigned long
-bitset<_Size>::to_ulong() const
-{
- return base::to_ulong();
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 unsigned long bitset<_Size>::to_ulong() const {
+ return base::to_ulong();
}
template <size_t _Size>
-inline
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23
-unsigned long long
-bitset<_Size>::to_ullong() const
-{
- return base::to_ullong();
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 unsigned long long bitset<_Size>::to_ullong() const {
+ return base::to_ullong();
}
template <size_t _Size>
template <class _CharT, class _Traits, class _Allocator>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23
-basic_string<_CharT, _Traits, _Allocator>
-bitset<_Size>::to_string(_CharT __zero, _CharT __one) const
-{
- basic_string<_CharT, _Traits, _Allocator> __r(_Size, __zero);
- for (size_t __i = 0; __i != _Size; ++__i)
- {
- if ((*this)[__i])
- __r[_Size - 1 - __i] = __one;
- }
- return __r;
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 basic_string<_CharT, _Traits, _Allocator>
+bitset<_Size>::to_string(_CharT __zero, _CharT __one) const {
+ basic_string<_CharT, _Traits, _Allocator> __r(_Size, __zero);
+ for (size_t __i = 0; __i != _Size; ++__i) {
+ if ((*this)[__i])
+ __r[_Size - 1 - __i] = __one;
+ }
+ return __r;
}
template <size_t _Size>
template <class _CharT, class _Traits>
-inline
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23
-basic_string<_CharT, _Traits, allocator<_CharT> >
-bitset<_Size>::to_string(_CharT __zero, _CharT __one) const
-{
- return to_string<_CharT, _Traits, allocator<_CharT> >(__zero, __one);
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 basic_string<_CharT, _Traits, allocator<_CharT> >
+bitset<_Size>::to_string(_CharT __zero, _CharT __one) const {
+ return to_string<_CharT, _Traits, allocator<_CharT> >(__zero, __one);
}
template <size_t _Size>
template <class _CharT>
-inline
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23
-basic_string<_CharT, char_traits<_CharT>, allocator<_CharT> >
-bitset<_Size>::to_string(_CharT __zero, _CharT __one) const
-{
- return to_string<_CharT, char_traits<_CharT>, allocator<_CharT> >(__zero, __one);
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 basic_string<_CharT, char_traits<_CharT>, allocator<_CharT> >
+bitset<_Size>::to_string(_CharT __zero, _CharT __one) const {
+ return to_string<_CharT, char_traits<_CharT>, allocator<_CharT> >(__zero, __one);
}
template <size_t _Size>
-inline
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23
-basic_string<char, char_traits<char>, allocator<char> >
-bitset<_Size>::to_string(char __zero, char __one) const
-{
- return to_string<char, char_traits<char>, allocator<char> >(__zero, __one);
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 basic_string<char, char_traits<char>, allocator<char> >
+bitset<_Size>::to_string(char __zero, char __one) const {
+ return to_string<char, char_traits<char>, allocator<char> >(__zero, __one);
}
template <size_t _Size>
-inline
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23
-size_t
-bitset<_Size>::count() const _NOEXCEPT
-{
- return static_cast<size_t>(std::count(base::__make_iter(0), base::__make_iter(_Size), true));
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 size_t bitset<_Size>::count() const _NOEXCEPT {
+ return static_cast<size_t>(std::count(base::__make_iter(0), base::__make_iter(_Size), true));
}
template <size_t _Size>
-inline
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23
-bool
-bitset<_Size>::operator==(const bitset& __rhs) const _NOEXCEPT
-{
- return std::equal(base::__make_iter(0), base::__make_iter(_Size), __rhs.__make_iter(0));
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bool
+bitset<_Size>::operator==(const bitset& __rhs) const _NOEXCEPT {
+ return std::equal(base::__make_iter(0), base::__make_iter(_Size), __rhs.__make_iter(0));
}
#if _LIBCPP_STD_VER <= 17
template <size_t _Size>
-inline
-_LIBCPP_HIDE_FROM_ABI
-bool
-bitset<_Size>::operator!=(const bitset& __rhs) const _NOEXCEPT
-{
- return !(*this == __rhs);
+inline _LIBCPP_HIDE_FROM_ABI bool bitset<_Size>::operator!=(const bitset& __rhs) const _NOEXCEPT {
+ return !(*this == __rhs);
}
#endif
template <size_t _Size>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23
-bool
-bitset<_Size>::test(size_t __pos) const
-{
- if (__pos >= _Size)
- __throw_out_of_range("bitset test argument out of range");
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bool bitset<_Size>::test(size_t __pos) const {
+ if (__pos >= _Size)
+ __throw_out_of_range("bitset test argument out of range");
- return (*this)[__pos];
+ return (*this)[__pos];
}
template <size_t _Size>
-inline
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23
-bool
-bitset<_Size>::all() const _NOEXCEPT
-{
- return base::all();
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bool bitset<_Size>::all() const _NOEXCEPT {
+ return base::all();
}
template <size_t _Size>
-inline
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23
-bool
-bitset<_Size>::any() const _NOEXCEPT
-{
- return base::any();
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bool bitset<_Size>::any() const _NOEXCEPT {
+ return base::any();
}
template <size_t _Size>
-inline
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23
-bitset<_Size>
-bitset<_Size>::operator<<(size_t __pos) const _NOEXCEPT
-{
- bitset __r = *this;
- __r <<= __pos;
- return __r;
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bitset<_Size>
+bitset<_Size>::operator<<(size_t __pos) const _NOEXCEPT {
+ bitset __r = *this;
+ __r <<= __pos;
+ return __r;
}
template <size_t _Size>
-inline
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23
-bitset<_Size>
-bitset<_Size>::operator>>(size_t __pos) const _NOEXCEPT
-{
- bitset __r = *this;
- __r >>= __pos;
- return __r;
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bitset<_Size>
+bitset<_Size>::operator>>(size_t __pos) const _NOEXCEPT {
+ bitset __r = *this;
+ __r >>= __pos;
+ return __r;
}
template <size_t _Size>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23
-bitset<_Size>
-operator&(const bitset<_Size>& __x, const bitset<_Size>& __y) _NOEXCEPT
-{
- bitset<_Size> __r = __x;
- __r &= __y;
- return __r;
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bitset<_Size>
+operator&(const bitset<_Size>& __x, const bitset<_Size>& __y) _NOEXCEPT {
+ bitset<_Size> __r = __x;
+ __r &= __y;
+ return __r;
}
template <size_t _Size>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23
-bitset<_Size>
-operator|(const bitset<_Size>& __x, const bitset<_Size>& __y) _NOEXCEPT
-{
- bitset<_Size> __r = __x;
- __r |= __y;
- return __r;
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bitset<_Size>
+operator|(const bitset<_Size>& __x, const bitset<_Size>& __y) _NOEXCEPT {
+ bitset<_Size> __r = __x;
+ __r |= __y;
+ return __r;
}
template <size_t _Size>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23
-bitset<_Size>
-operator^(const bitset<_Size>& __x, const bitset<_Size>& __y) _NOEXCEPT
-{
- bitset<_Size> __r = __x;
- __r ^= __y;
- return __r;
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bitset<_Size>
+operator^(const bitset<_Size>& __x, const bitset<_Size>& __y) _NOEXCEPT {
+ bitset<_Size> __r = __x;
+ __r ^= __y;
+ return __r;
}
template <size_t _Size>
-struct _LIBCPP_TEMPLATE_VIS hash<bitset<_Size> >
- : public __unary_function<bitset<_Size>, size_t>
-{
- _LIBCPP_HIDE_FROM_ABI
- size_t operator()(const bitset<_Size>& __bs) const _NOEXCEPT
- {return __bs.__hash_code();}
+struct _LIBCPP_TEMPLATE_VIS hash<bitset<_Size> > : public __unary_function<bitset<_Size>, size_t> {
+ _LIBCPP_HIDE_FROM_ABI size_t operator()(const bitset<_Size>& __bs) const _NOEXCEPT { return __bs.__hash_code(); }
};
template <class _CharT, class _Traits, size_t _Size>
diff --git a/contrib/llvm-project/libcxx/include/cctype b/contrib/llvm-project/libcxx/include/cctype
index 867e7d5b0b35..32be6f38e5f8 100644
--- a/contrib/llvm-project/libcxx/include/cctype
+++ b/contrib/llvm-project/libcxx/include/cctype
@@ -53,62 +53,61 @@ int toupper(int c);
_LIBCPP_BEGIN_NAMESPACE_STD
#ifdef isalnum
-#undef isalnum
+# undef isalnum
#endif
#ifdef isalpha
-#undef isalpha
+# undef isalpha
#endif
#ifdef isblank
-#undef isblank
+# undef isblank
#endif
#ifdef iscntrl
-#undef iscntrl
+# undef iscntrl
#endif
#ifdef isdigit
-#undef isdigit
+# undef isdigit
#endif
#ifdef isgraph
-#undef isgraph
+# undef isgraph
#endif
#ifdef islower
-#undef islower
+# undef islower
#endif
#ifdef isprint
-#undef isprint
+# undef isprint
#endif
#ifdef ispunct
-#undef ispunct
+# undef ispunct
#endif
#ifdef isspace
-#undef isspace
+# undef isspace
#endif
#ifdef isupper
-#undef isupper
+# undef isupper
#endif
#ifdef isxdigit
-#undef isxdigit
+# undef isxdigit
#endif
#ifdef tolower
-#undef tolower
+# undef tolower
#endif
#ifdef toupper
-#undef toupper
+# undef toupper
#endif
-
using ::isalnum _LIBCPP_USING_IF_EXISTS;
using ::isalpha _LIBCPP_USING_IF_EXISTS;
using ::isblank _LIBCPP_USING_IF_EXISTS;
diff --git a/contrib/llvm-project/libcxx/include/cmath b/contrib/llvm-project/libcxx/include/cmath
index e8a2acf078cd..798ddb4963b0 100644
--- a/contrib/llvm-project/libcxx/include/cmath
+++ b/contrib/llvm-project/libcxx/include/cmath
@@ -546,126 +546,109 @@ using ::tgammal _LIBCPP_USING_IF_EXISTS;
using ::truncl _LIBCPP_USING_IF_EXISTS;
#if _LIBCPP_STD_VER >= 17
-inline _LIBCPP_HIDE_FROM_ABI float hypot( float __x, float __y, float __z ) { return sqrt(__x*__x + __y*__y + __z*__z); }
-inline _LIBCPP_HIDE_FROM_ABI double hypot( double __x, double __y, double __z ) { return sqrt(__x*__x + __y*__y + __z*__z); }
-inline _LIBCPP_HIDE_FROM_ABI long double hypot( long double __x, long double __y, long double __z ) { return sqrt(__x*__x + __y*__y + __z*__z); }
+inline _LIBCPP_HIDE_FROM_ABI float hypot(float __x, float __y, float __z) {
+ return sqrt(__x * __x + __y * __y + __z * __z);
+}
+inline _LIBCPP_HIDE_FROM_ABI double hypot(double __x, double __y, double __z) {
+ return sqrt(__x * __x + __y * __y + __z * __z);
+}
+inline _LIBCPP_HIDE_FROM_ABI long double hypot(long double __x, long double __y, long double __z) {
+ return sqrt(__x * __x + __y * __y + __z * __z);
+}
template <class _A1, class _A2, class _A3>
inline _LIBCPP_HIDE_FROM_ABI
-typename enable_if_t
-<
- is_arithmetic<_A1>::value &&
- is_arithmetic<_A2>::value &&
- is_arithmetic<_A3>::value,
- __promote<_A1, _A2, _A3>
->::type
-hypot(_A1 __lcpp_x, _A2 __lcpp_y, _A3 __lcpp_z) _NOEXCEPT
-{
- typedef typename __promote<_A1, _A2, _A3>::type __result_type;
- static_assert((!(is_same<_A1, __result_type>::value &&
- is_same<_A2, __result_type>::value &&
- is_same<_A3, __result_type>::value)), "");
- return std::hypot((__result_type)__lcpp_x, (__result_type)__lcpp_y, (__result_type)__lcpp_z);
+ typename enable_if_t< is_arithmetic<_A1>::value && is_arithmetic<_A2>::value && is_arithmetic<_A3>::value,
+ __promote<_A1, _A2, _A3> >::type
+ hypot(_A1 __lcpp_x, _A2 __lcpp_y, _A3 __lcpp_z) _NOEXCEPT {
+ typedef typename __promote<_A1, _A2, _A3>::type __result_type;
+ static_assert((!(is_same<_A1, __result_type>::value && is_same<_A2, __result_type>::value &&
+ is_same<_A3, __result_type>::value)),
+ "");
+ return std::hypot((__result_type)__lcpp_x, (__result_type)__lcpp_y, (__result_type)__lcpp_z);
}
#endif
template <class _A1, __enable_if_t<is_floating_point<_A1>::value, int> = 0>
-_LIBCPP_HIDE_FROM_ABI
-_LIBCPP_CONSTEXPR bool
-__constexpr_isnan(_A1 __lcpp_x) _NOEXCEPT
-{
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool __constexpr_isnan(_A1 __lcpp_x) _NOEXCEPT {
#if __has_builtin(__builtin_isnan)
- return __builtin_isnan(__lcpp_x);
+ return __builtin_isnan(__lcpp_x);
#else
- return isnan(__lcpp_x);
+ return isnan(__lcpp_x);
#endif
}
template <class _A1, __enable_if_t<!is_floating_point<_A1>::value, int> = 0>
-_LIBCPP_HIDE_FROM_ABI
-_LIBCPP_CONSTEXPR bool
-__constexpr_isnan(_A1 __lcpp_x) _NOEXCEPT
-{
- return std::isnan(__lcpp_x);
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool __constexpr_isnan(_A1 __lcpp_x) _NOEXCEPT {
+ return std::isnan(__lcpp_x);
}
template <class _A1, __enable_if_t<is_floating_point<_A1>::value, int> = 0>
-_LIBCPP_HIDE_FROM_ABI
-_LIBCPP_CONSTEXPR bool
-__constexpr_isinf(_A1 __lcpp_x) _NOEXCEPT
-{
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool __constexpr_isinf(_A1 __lcpp_x) _NOEXCEPT {
#if __has_builtin(__builtin_isinf)
- return __builtin_isinf(__lcpp_x);
+ return __builtin_isinf(__lcpp_x);
#else
- return isinf(__lcpp_x);
+ return isinf(__lcpp_x);
#endif
}
template <class _A1, __enable_if_t<!is_floating_point<_A1>::value, int> = 0>
-_LIBCPP_HIDE_FROM_ABI
-_LIBCPP_CONSTEXPR bool
-__constexpr_isinf(_A1 __lcpp_x) _NOEXCEPT
-{
- return std::isinf(__lcpp_x);
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool __constexpr_isinf(_A1 __lcpp_x) _NOEXCEPT {
+ return std::isinf(__lcpp_x);
}
template <class _A1, __enable_if_t<is_floating_point<_A1>::value, int> = 0>
-_LIBCPP_HIDE_FROM_ABI
-_LIBCPP_CONSTEXPR bool
-__constexpr_isfinite(_A1 __lcpp_x) _NOEXCEPT
-{
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool __constexpr_isfinite(_A1 __lcpp_x) _NOEXCEPT {
#if __has_builtin(__builtin_isfinite)
- return __builtin_isfinite(__lcpp_x);
+ return __builtin_isfinite(__lcpp_x);
#else
- return isfinite(__lcpp_x);
+ return isfinite(__lcpp_x);
#endif
}
template <class _A1, __enable_if_t<!is_floating_point<_A1>::value, int> = 0>
-_LIBCPP_HIDE_FROM_ABI
-_LIBCPP_CONSTEXPR bool
-__constexpr_isfinite(_A1 __lcpp_x) _NOEXCEPT
-{
- return __builtin_isfinite(__lcpp_x);
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool __constexpr_isfinite(_A1 __lcpp_x) _NOEXCEPT {
+ return __builtin_isfinite(__lcpp_x);
}
_LIBCPP_CONSTEXPR inline _LIBCPP_HIDE_FROM_ABI float __constexpr_copysign(float __x, float __y) _NOEXCEPT {
- return __builtin_copysignf(__x, __y);
+ return __builtin_copysignf(__x, __y);
}
_LIBCPP_CONSTEXPR inline _LIBCPP_HIDE_FROM_ABI double __constexpr_copysign(double __x, double __y) _NOEXCEPT {
- return __builtin_copysign(__x, __y);
+ return __builtin_copysign(__x, __y);
}
_LIBCPP_CONSTEXPR inline _LIBCPP_HIDE_FROM_ABI long double
__constexpr_copysign(long double __x, long double __y) _NOEXCEPT {
- return __builtin_copysignl(__x, __y);
+ return __builtin_copysignl(__x, __y);
}
-template <class _A1, class _A2, __enable_if_t<std::is_arithmetic<_A1>::value && std::is_arithmetic<_A2>::value, int> = 0>
-_LIBCPP_CONSTEXPR inline _LIBCPP_HIDE_FROM_ABI
- typename __promote<_A1, _A2>::type
- __constexpr_copysign(_A1 __x, _A2 __y) _NOEXCEPT {
- typedef typename std::__promote<_A1, _A2>::type __result_type;
- static_assert((!(std::_IsSame<_A1, __result_type>::value && std::_IsSame<_A2, __result_type>::value)), "");
- return __builtin_copysign((__result_type)__x, (__result_type)__y);
+template <class _A1,
+ class _A2,
+ __enable_if_t<std::is_arithmetic<_A1>::value && std::is_arithmetic<_A2>::value, int> = 0>
+_LIBCPP_CONSTEXPR inline _LIBCPP_HIDE_FROM_ABI typename __promote<_A1, _A2>::type
+__constexpr_copysign(_A1 __x, _A2 __y) _NOEXCEPT {
+ typedef typename std::__promote<_A1, _A2>::type __result_type;
+ static_assert((!(std::_IsSame<_A1, __result_type>::value && std::_IsSame<_A2, __result_type>::value)), "");
+ return __builtin_copysign((__result_type)__x, (__result_type)__y);
}
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR float __constexpr_fabs(float __x) _NOEXCEPT {
- return __builtin_fabsf(__x);
+ return __builtin_fabsf(__x);
}
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR double __constexpr_fabs(double __x) _NOEXCEPT {
- return __builtin_fabs(__x);
+ return __builtin_fabs(__x);
}
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR long double __constexpr_fabs(long double __x) _NOEXCEPT {
- return __builtin_fabsl(__x);
+ return __builtin_fabsl(__x);
}
template <class _Tp, __enable_if_t<is_integral<_Tp>::value, int> = 0>
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR double __constexpr_fabs(_Tp __x) _NOEXCEPT {
- return __builtin_fabs(static_cast<double>(__x));
+ return __builtin_fabs(static_cast<double>(__x));
}
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 float __constexpr_fmax(float __x, float __y) _NOEXCEPT {
@@ -730,7 +713,7 @@ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _Tp __constexpr_logb(_Tp __x
if (std::__constexpr_isnan(__x))
return numeric_limits<_Tp>::quiet_NaN();
- __x = std::__constexpr_fabs(__x);
+ __x = std::__constexpr_fabs(__x);
unsigned long long __exp = 0;
while (__x >= numeric_limits<_Tp>::radix) {
__x /= numeric_limits<_Tp>::radix;
@@ -785,44 +768,40 @@ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _Tp __constexpr_scalbn(_Tp _
#if _LIBCPP_STD_VER >= 20
template <typename _Fp>
-_LIBCPP_HIDE_FROM_ABI constexpr
-_Fp __lerp(_Fp __a, _Fp __b, _Fp __t) noexcept {
- if ((__a <= 0 && __b >= 0) || (__a >= 0 && __b <= 0))
- return __t * __b + (1 - __t) * __a;
-
- if (__t == 1) return __b;
- const _Fp __x = __a + __t * (__b - __a);
- if ((__t > 1) == (__b > __a))
- return __b < __x ? __x : __b;
- else
- return __x < __b ? __x : __b;
+_LIBCPP_HIDE_FROM_ABI constexpr _Fp __lerp(_Fp __a, _Fp __b, _Fp __t) noexcept {
+ if ((__a <= 0 && __b >= 0) || (__a >= 0 && __b <= 0))
+ return __t * __b + (1 - __t) * __a;
+
+ if (__t == 1)
+ return __b;
+ const _Fp __x = __a + __t * (__b - __a);
+ if ((__t > 1) == (__b > __a))
+ return __b < __x ? __x : __b;
+ else
+ return __x < __b ? __x : __b;
}
-_LIBCPP_HIDE_FROM_ABI inline constexpr float
-lerp(float __a, float __b, float __t) _NOEXCEPT { return __lerp(__a, __b, __t); }
+_LIBCPP_HIDE_FROM_ABI inline constexpr float lerp(float __a, float __b, float __t) _NOEXCEPT {
+ return __lerp(__a, __b, __t);
+}
-_LIBCPP_HIDE_FROM_ABI inline constexpr double
-lerp(double __a, double __b, double __t) _NOEXCEPT { return __lerp(__a, __b, __t); }
+_LIBCPP_HIDE_FROM_ABI inline constexpr double lerp(double __a, double __b, double __t) _NOEXCEPT {
+ return __lerp(__a, __b, __t);
+}
-_LIBCPP_HIDE_FROM_ABI inline constexpr long double
-lerp(long double __a, long double __b, long double __t) _NOEXCEPT { return __lerp(__a, __b, __t); }
+_LIBCPP_HIDE_FROM_ABI inline constexpr long double lerp(long double __a, long double __b, long double __t) _NOEXCEPT {
+ return __lerp(__a, __b, __t);
+}
template <class _A1, class _A2, class _A3>
-inline _LIBCPP_HIDE_FROM_ABI
-constexpr typename enable_if_t
-<
- is_arithmetic<_A1>::value &&
- is_arithmetic<_A2>::value &&
- is_arithmetic<_A3>::value,
- __promote<_A1, _A2, _A3>
->::type
-lerp(_A1 __a, _A2 __b, _A3 __t) noexcept
-{
- typedef typename __promote<_A1, _A2, _A3>::type __result_type;
- static_assert(!(_IsSame<_A1, __result_type>::value &&
- _IsSame<_A2, __result_type>::value &&
- _IsSame<_A3, __result_type>::value));
- return std::__lerp((__result_type)__a, (__result_type)__b, (__result_type)__t);
+inline _LIBCPP_HIDE_FROM_ABI constexpr
+ typename enable_if_t< is_arithmetic<_A1>::value && is_arithmetic<_A2>::value && is_arithmetic<_A3>::value,
+ __promote<_A1, _A2, _A3> >::type
+ lerp(_A1 __a, _A2 __b, _A3 __t) noexcept {
+ typedef typename __promote<_A1, _A2, _A3>::type __result_type;
+ static_assert(!(
+ _IsSame<_A1, __result_type>::value && _IsSame<_A2, __result_type>::value && _IsSame<_A3, __result_type>::value));
+ return std::__lerp((__result_type)__a, (__result_type)__b, (__result_type)__t);
}
#endif // _LIBCPP_STD_VER >= 20
diff --git a/contrib/llvm-project/libcxx/include/codecvt b/contrib/llvm-project/libcxx/include/codecvt
index 35d2c27d8ab9..504dd71f3004 100644
--- a/contrib/llvm-project/libcxx/include/codecvt
+++ b/contrib/llvm-project/libcxx/include/codecvt
@@ -67,489 +67,511 @@ class codecvt_utf8_utf16
_LIBCPP_BEGIN_NAMESPACE_STD
-enum _LIBCPP_DEPRECATED_IN_CXX17 codecvt_mode
-{
- consume_header = 4,
- generate_header = 2,
- little_endian = 1
-};
+enum _LIBCPP_DEPRECATED_IN_CXX17 codecvt_mode { consume_header = 4, generate_header = 2, little_endian = 1 };
// codecvt_utf8
-template <class _Elem> class __codecvt_utf8;
+template <class _Elem>
+class __codecvt_utf8;
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+# ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
template <>
-class _LIBCPP_EXPORTED_FROM_ABI __codecvt_utf8<wchar_t>
- : public codecvt<wchar_t, char, mbstate_t>
-{
- unsigned long __maxcode_;
-_LIBCPP_SUPPRESS_DEPRECATED_PUSH
- codecvt_mode __mode_;
-_LIBCPP_SUPPRESS_DEPRECATED_POP
+class _LIBCPP_EXPORTED_FROM_ABI __codecvt_utf8<wchar_t> : public codecvt<wchar_t, char, mbstate_t> {
+ unsigned long __maxcode_;
+ _LIBCPP_SUPPRESS_DEPRECATED_PUSH
+ codecvt_mode __mode_;
+ _LIBCPP_SUPPRESS_DEPRECATED_POP
+
public:
- typedef wchar_t intern_type;
- typedef char extern_type;
- typedef mbstate_t state_type;
+ typedef wchar_t intern_type;
+ typedef char extern_type;
+ typedef mbstate_t state_type;
+
+ _LIBCPP_SUPPRESS_DEPRECATED_PUSH
+ _LIBCPP_HIDE_FROM_ABI explicit __codecvt_utf8(size_t __refs, unsigned long __maxcode, codecvt_mode __mode)
+ : codecvt<wchar_t, char, mbstate_t>(__refs), __maxcode_(__maxcode), __mode_(__mode) {}
+ _LIBCPP_SUPPRESS_DEPRECATED_POP
-_LIBCPP_SUPPRESS_DEPRECATED_PUSH
- _LIBCPP_HIDE_FROM_ABI
- explicit __codecvt_utf8(size_t __refs, unsigned long __maxcode,
- codecvt_mode __mode)
- : codecvt<wchar_t, char, mbstate_t>(__refs), __maxcode_(__maxcode),
- __mode_(__mode) {}
-_LIBCPP_SUPPRESS_DEPRECATED_POP
protected:
- result do_out(state_type& __st,
- const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt,
- extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const override;
- result do_in(state_type& __st,
- const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt,
- intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const override;
- result do_unshift(state_type& __st,
- extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const override;
- int do_encoding() const _NOEXCEPT override;
- bool do_always_noconv() const _NOEXCEPT override;
- int do_length(state_type&, const extern_type* __frm, const extern_type* __end, size_t __mx) const override;
- int do_max_length() const _NOEXCEPT override;
+ result do_out(state_type& __st,
+ const intern_type* __frm,
+ const intern_type* __frm_end,
+ const intern_type*& __frm_nxt,
+ extern_type* __to,
+ extern_type* __to_end,
+ extern_type*& __to_nxt) const override;
+ result do_in(state_type& __st,
+ const extern_type* __frm,
+ const extern_type* __frm_end,
+ const extern_type*& __frm_nxt,
+ intern_type* __to,
+ intern_type* __to_end,
+ intern_type*& __to_nxt) const override;
+ result do_unshift(state_type& __st, extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const override;
+ int do_encoding() const _NOEXCEPT override;
+ bool do_always_noconv() const _NOEXCEPT override;
+ int do_length(state_type&, const extern_type* __frm, const extern_type* __end, size_t __mx) const override;
+ int do_max_length() const _NOEXCEPT override;
};
-#endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS
+# endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS
_LIBCPP_SUPPRESS_DEPRECATED_PUSH
template <>
-class _LIBCPP_EXPORTED_FROM_ABI __codecvt_utf8<char16_t>
- : public codecvt<char16_t, char, mbstate_t>
-{
- unsigned long __maxcode_;
- codecvt_mode __mode_;
+class _LIBCPP_EXPORTED_FROM_ABI __codecvt_utf8<char16_t> : public codecvt<char16_t, char, mbstate_t> {
+ unsigned long __maxcode_;
+ codecvt_mode __mode_;
+
public:
- typedef char16_t intern_type;
- typedef char extern_type;
- typedef mbstate_t state_type;
-
- _LIBCPP_HIDE_FROM_ABI
- explicit __codecvt_utf8(size_t __refs, unsigned long __maxcode,
- codecvt_mode __mode)
- : codecvt<char16_t, char, mbstate_t>(__refs), __maxcode_(__maxcode),
- __mode_(__mode) {}
-_LIBCPP_SUPPRESS_DEPRECATED_POP
+ typedef char16_t intern_type;
+ typedef char extern_type;
+ typedef mbstate_t state_type;
+
+ _LIBCPP_HIDE_FROM_ABI explicit __codecvt_utf8(size_t __refs, unsigned long __maxcode, codecvt_mode __mode)
+ : codecvt<char16_t, char, mbstate_t>(__refs), __maxcode_(__maxcode), __mode_(__mode) {}
+ _LIBCPP_SUPPRESS_DEPRECATED_POP
protected:
- result do_out(state_type& __st,
- const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt,
- extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const override;
- result do_in(state_type& __st,
- const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt,
- intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const override;
- result do_unshift(state_type& __st,
- extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const override;
- int do_encoding() const _NOEXCEPT override;
- bool do_always_noconv() const _NOEXCEPT override;
- int do_length(state_type&, const extern_type* __frm, const extern_type* __end, size_t __mx) const override;
- int do_max_length() const _NOEXCEPT override;
+ result do_out(state_type& __st,
+ const intern_type* __frm,
+ const intern_type* __frm_end,
+ const intern_type*& __frm_nxt,
+ extern_type* __to,
+ extern_type* __to_end,
+ extern_type*& __to_nxt) const override;
+ result do_in(state_type& __st,
+ const extern_type* __frm,
+ const extern_type* __frm_end,
+ const extern_type*& __frm_nxt,
+ intern_type* __to,
+ intern_type* __to_end,
+ intern_type*& __to_nxt) const override;
+ result do_unshift(state_type& __st, extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const override;
+ int do_encoding() const _NOEXCEPT override;
+ bool do_always_noconv() const _NOEXCEPT override;
+ int do_length(state_type&, const extern_type* __frm, const extern_type* __end, size_t __mx) const override;
+ int do_max_length() const _NOEXCEPT override;
};
_LIBCPP_SUPPRESS_DEPRECATED_PUSH
template <>
-class _LIBCPP_EXPORTED_FROM_ABI __codecvt_utf8<char32_t>
- : public codecvt<char32_t, char, mbstate_t>
-{
- unsigned long __maxcode_;
- codecvt_mode __mode_;
+class _LIBCPP_EXPORTED_FROM_ABI __codecvt_utf8<char32_t> : public codecvt<char32_t, char, mbstate_t> {
+ unsigned long __maxcode_;
+ codecvt_mode __mode_;
+
public:
- typedef char32_t intern_type;
- typedef char extern_type;
- typedef mbstate_t state_type;
-
- _LIBCPP_HIDE_FROM_ABI
- explicit __codecvt_utf8(size_t __refs, unsigned long __maxcode,
- codecvt_mode __mode)
- : codecvt<char32_t, char, mbstate_t>(__refs), __maxcode_(__maxcode),
- __mode_(__mode) {}
-_LIBCPP_SUPPRESS_DEPRECATED_POP
+ typedef char32_t intern_type;
+ typedef char extern_type;
+ typedef mbstate_t state_type;
+
+ _LIBCPP_HIDE_FROM_ABI explicit __codecvt_utf8(size_t __refs, unsigned long __maxcode, codecvt_mode __mode)
+ : codecvt<char32_t, char, mbstate_t>(__refs), __maxcode_(__maxcode), __mode_(__mode) {}
+ _LIBCPP_SUPPRESS_DEPRECATED_POP
protected:
- result do_out(state_type& __st,
- const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt,
- extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const override;
- result do_in(state_type& __st,
- const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt,
- intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const override;
- result do_unshift(state_type& __st,
- extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const override;
- int do_encoding() const _NOEXCEPT override;
- bool do_always_noconv() const _NOEXCEPT override;
- int do_length(state_type&, const extern_type* __frm, const extern_type* __end, size_t __mx) const override;
- int do_max_length() const _NOEXCEPT override;
+ result do_out(state_type& __st,
+ const intern_type* __frm,
+ const intern_type* __frm_end,
+ const intern_type*& __frm_nxt,
+ extern_type* __to,
+ extern_type* __to_end,
+ extern_type*& __to_nxt) const override;
+ result do_in(state_type& __st,
+ const extern_type* __frm,
+ const extern_type* __frm_end,
+ const extern_type*& __frm_nxt,
+ intern_type* __to,
+ intern_type* __to_end,
+ intern_type*& __to_nxt) const override;
+ result do_unshift(state_type& __st, extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const override;
+ int do_encoding() const _NOEXCEPT override;
+ bool do_always_noconv() const _NOEXCEPT override;
+ int do_length(state_type&, const extern_type* __frm, const extern_type* __end, size_t __mx) const override;
+ int do_max_length() const _NOEXCEPT override;
};
_LIBCPP_SUPPRESS_DEPRECATED_PUSH
-template <class _Elem, unsigned long _Maxcode = 0x10ffff,
- codecvt_mode _Mode = (codecvt_mode)0>
-class _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX17 codecvt_utf8
- : public __codecvt_utf8<_Elem>
-{
+template <class _Elem, unsigned long _Maxcode = 0x10ffff, codecvt_mode _Mode = (codecvt_mode)0>
+class _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX17 codecvt_utf8 : public __codecvt_utf8<_Elem> {
public:
- _LIBCPP_HIDE_FROM_ABI
- explicit codecvt_utf8(size_t __refs = 0)
- : __codecvt_utf8<_Elem>(__refs, _Maxcode, _Mode) {}
+ _LIBCPP_HIDE_FROM_ABI explicit codecvt_utf8(size_t __refs = 0) : __codecvt_utf8<_Elem>(__refs, _Maxcode, _Mode) {}
- _LIBCPP_HIDE_FROM_ABI
- ~codecvt_utf8() {}
+ _LIBCPP_HIDE_FROM_ABI ~codecvt_utf8() {}
};
_LIBCPP_SUPPRESS_DEPRECATED_POP
// codecvt_utf16
-template <class _Elem, bool _LittleEndian> class __codecvt_utf16;
+template <class _Elem, bool _LittleEndian>
+class __codecvt_utf16;
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+# ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
template <>
-class _LIBCPP_EXPORTED_FROM_ABI __codecvt_utf16<wchar_t, false>
- : public codecvt<wchar_t, char, mbstate_t>
-{
- unsigned long __maxcode_;
-_LIBCPP_SUPPRESS_DEPRECATED_PUSH
- codecvt_mode __mode_;
-_LIBCPP_SUPPRESS_DEPRECATED_POP
+class _LIBCPP_EXPORTED_FROM_ABI __codecvt_utf16<wchar_t, false> : public codecvt<wchar_t, char, mbstate_t> {
+ unsigned long __maxcode_;
+ _LIBCPP_SUPPRESS_DEPRECATED_PUSH
+ codecvt_mode __mode_;
+ _LIBCPP_SUPPRESS_DEPRECATED_POP
+
public:
- typedef wchar_t intern_type;
- typedef char extern_type;
- typedef mbstate_t state_type;
+ typedef wchar_t intern_type;
+ typedef char extern_type;
+ typedef mbstate_t state_type;
+
+ _LIBCPP_SUPPRESS_DEPRECATED_PUSH
+ _LIBCPP_HIDE_FROM_ABI explicit __codecvt_utf16(size_t __refs, unsigned long __maxcode, codecvt_mode __mode)
+ : codecvt<wchar_t, char, mbstate_t>(__refs), __maxcode_(__maxcode), __mode_(__mode) {}
+ _LIBCPP_SUPPRESS_DEPRECATED_POP
-_LIBCPP_SUPPRESS_DEPRECATED_PUSH
- _LIBCPP_HIDE_FROM_ABI
- explicit __codecvt_utf16(size_t __refs, unsigned long __maxcode,
- codecvt_mode __mode)
- : codecvt<wchar_t, char, mbstate_t>(__refs), __maxcode_(__maxcode),
- __mode_(__mode) {}
-_LIBCPP_SUPPRESS_DEPRECATED_POP
protected:
- result do_out(state_type& __st,
- const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt,
- extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const override;
- result do_in(state_type& __st,
- const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt,
- intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const override;
- result do_unshift(state_type& __st,
- extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const override;
- int do_encoding() const _NOEXCEPT override;
- bool do_always_noconv() const _NOEXCEPT override;
- int do_length(state_type&, const extern_type* __frm, const extern_type* __end,
- size_t __mx) const override;
- int do_max_length() const _NOEXCEPT override;
+ result do_out(state_type& __st,
+ const intern_type* __frm,
+ const intern_type* __frm_end,
+ const intern_type*& __frm_nxt,
+ extern_type* __to,
+ extern_type* __to_end,
+ extern_type*& __to_nxt) const override;
+ result do_in(state_type& __st,
+ const extern_type* __frm,
+ const extern_type* __frm_end,
+ const extern_type*& __frm_nxt,
+ intern_type* __to,
+ intern_type* __to_end,
+ intern_type*& __to_nxt) const override;
+ result do_unshift(state_type& __st, extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const override;
+ int do_encoding() const _NOEXCEPT override;
+ bool do_always_noconv() const _NOEXCEPT override;
+ int do_length(state_type&, const extern_type* __frm, const extern_type* __end, size_t __mx) const override;
+ int do_max_length() const _NOEXCEPT override;
};
template <>
-class _LIBCPP_EXPORTED_FROM_ABI __codecvt_utf16<wchar_t, true>
- : public codecvt<wchar_t, char, mbstate_t>
-{
- unsigned long __maxcode_;
-_LIBCPP_SUPPRESS_DEPRECATED_PUSH
- codecvt_mode __mode_;
-_LIBCPP_SUPPRESS_DEPRECATED_POP
+class _LIBCPP_EXPORTED_FROM_ABI __codecvt_utf16<wchar_t, true> : public codecvt<wchar_t, char, mbstate_t> {
+ unsigned long __maxcode_;
+ _LIBCPP_SUPPRESS_DEPRECATED_PUSH
+ codecvt_mode __mode_;
+ _LIBCPP_SUPPRESS_DEPRECATED_POP
+
public:
- typedef wchar_t intern_type;
- typedef char extern_type;
- typedef mbstate_t state_type;
+ typedef wchar_t intern_type;
+ typedef char extern_type;
+ typedef mbstate_t state_type;
+
+ _LIBCPP_SUPPRESS_DEPRECATED_PUSH
+ _LIBCPP_HIDE_FROM_ABI explicit __codecvt_utf16(size_t __refs, unsigned long __maxcode, codecvt_mode __mode)
+ : codecvt<wchar_t, char, mbstate_t>(__refs), __maxcode_(__maxcode), __mode_(__mode) {}
+ _LIBCPP_SUPPRESS_DEPRECATED_POP
-_LIBCPP_SUPPRESS_DEPRECATED_PUSH
- _LIBCPP_HIDE_FROM_ABI
- explicit __codecvt_utf16(size_t __refs, unsigned long __maxcode,
- codecvt_mode __mode)
- : codecvt<wchar_t, char, mbstate_t>(__refs), __maxcode_(__maxcode),
- __mode_(__mode) {}
-_LIBCPP_SUPPRESS_DEPRECATED_POP
protected:
- result do_out(state_type& __st,
- const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt,
- extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const override;
- result do_in(state_type& __st,
- const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt,
- intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const override;
- result do_unshift(state_type& __st,
- extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const override;
- int do_encoding() const _NOEXCEPT override;
- bool do_always_noconv() const _NOEXCEPT override;
- int do_length(state_type&, const extern_type* __frm, const extern_type* __end, size_t __mx) const override;
- int do_max_length() const _NOEXCEPT override;
+ result do_out(state_type& __st,
+ const intern_type* __frm,
+ const intern_type* __frm_end,
+ const intern_type*& __frm_nxt,
+ extern_type* __to,
+ extern_type* __to_end,
+ extern_type*& __to_nxt) const override;
+ result do_in(state_type& __st,
+ const extern_type* __frm,
+ const extern_type* __frm_end,
+ const extern_type*& __frm_nxt,
+ intern_type* __to,
+ intern_type* __to_end,
+ intern_type*& __to_nxt) const override;
+ result do_unshift(state_type& __st, extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const override;
+ int do_encoding() const _NOEXCEPT override;
+ bool do_always_noconv() const _NOEXCEPT override;
+ int do_length(state_type&, const extern_type* __frm, const extern_type* __end, size_t __mx) const override;
+ int do_max_length() const _NOEXCEPT override;
};
-#endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS
+# endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS
_LIBCPP_SUPPRESS_DEPRECATED_PUSH
template <>
-class _LIBCPP_EXPORTED_FROM_ABI __codecvt_utf16<char16_t, false>
- : public codecvt<char16_t, char, mbstate_t>
-{
- unsigned long __maxcode_;
- codecvt_mode __mode_;
+class _LIBCPP_EXPORTED_FROM_ABI __codecvt_utf16<char16_t, false> : public codecvt<char16_t, char, mbstate_t> {
+ unsigned long __maxcode_;
+ codecvt_mode __mode_;
+
public:
- typedef char16_t intern_type;
- typedef char extern_type;
- typedef mbstate_t state_type;
-
- _LIBCPP_HIDE_FROM_ABI
- explicit __codecvt_utf16(size_t __refs, unsigned long __maxcode,
- codecvt_mode __mode)
- : codecvt<char16_t, char, mbstate_t>(__refs), __maxcode_(__maxcode),
- __mode_(__mode) {}
-_LIBCPP_SUPPRESS_DEPRECATED_POP
+ typedef char16_t intern_type;
+ typedef char extern_type;
+ typedef mbstate_t state_type;
+
+ _LIBCPP_HIDE_FROM_ABI explicit __codecvt_utf16(size_t __refs, unsigned long __maxcode, codecvt_mode __mode)
+ : codecvt<char16_t, char, mbstate_t>(__refs), __maxcode_(__maxcode), __mode_(__mode) {}
+ _LIBCPP_SUPPRESS_DEPRECATED_POP
protected:
- result do_out(state_type& __st,
- const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt,
- extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const override;
- result do_in(state_type& __st,
- const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt,
- intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const override;
- result do_unshift(state_type& __st,
- extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const override;
- int do_encoding() const _NOEXCEPT override;
- bool do_always_noconv() const _NOEXCEPT override;
- int do_length(state_type&, const extern_type* __frm, const extern_type* __end, size_t __mx) const override;
- int do_max_length() const _NOEXCEPT override;
+ result do_out(state_type& __st,
+ const intern_type* __frm,
+ const intern_type* __frm_end,
+ const intern_type*& __frm_nxt,
+ extern_type* __to,
+ extern_type* __to_end,
+ extern_type*& __to_nxt) const override;
+ result do_in(state_type& __st,
+ const extern_type* __frm,
+ const extern_type* __frm_end,
+ const extern_type*& __frm_nxt,
+ intern_type* __to,
+ intern_type* __to_end,
+ intern_type*& __to_nxt) const override;
+ result do_unshift(state_type& __st, extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const override;
+ int do_encoding() const _NOEXCEPT override;
+ bool do_always_noconv() const _NOEXCEPT override;
+ int do_length(state_type&, const extern_type* __frm, const extern_type* __end, size_t __mx) const override;
+ int do_max_length() const _NOEXCEPT override;
};
_LIBCPP_SUPPRESS_DEPRECATED_PUSH
template <>
-class _LIBCPP_EXPORTED_FROM_ABI __codecvt_utf16<char16_t, true>
- : public codecvt<char16_t, char, mbstate_t>
-{
- unsigned long __maxcode_;
- codecvt_mode __mode_;
+class _LIBCPP_EXPORTED_FROM_ABI __codecvt_utf16<char16_t, true> : public codecvt<char16_t, char, mbstate_t> {
+ unsigned long __maxcode_;
+ codecvt_mode __mode_;
+
public:
- typedef char16_t intern_type;
- typedef char extern_type;
- typedef mbstate_t state_type;
-
- _LIBCPP_HIDE_FROM_ABI
- explicit __codecvt_utf16(size_t __refs, unsigned long __maxcode,
- codecvt_mode __mode)
- : codecvt<char16_t, char, mbstate_t>(__refs), __maxcode_(__maxcode),
- __mode_(__mode) {}
-_LIBCPP_SUPPRESS_DEPRECATED_POP
+ typedef char16_t intern_type;
+ typedef char extern_type;
+ typedef mbstate_t state_type;
+
+ _LIBCPP_HIDE_FROM_ABI explicit __codecvt_utf16(size_t __refs, unsigned long __maxcode, codecvt_mode __mode)
+ : codecvt<char16_t, char, mbstate_t>(__refs), __maxcode_(__maxcode), __mode_(__mode) {}
+ _LIBCPP_SUPPRESS_DEPRECATED_POP
protected:
- result do_out(state_type& __st,
- const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt,
- extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const override;
- result do_in(state_type& __st,
- const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt,
- intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const override;
- result do_unshift(state_type& __st,
- extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const override;
- int do_encoding() const _NOEXCEPT override;
- bool do_always_noconv() const _NOEXCEPT override;
- int do_length(state_type&, const extern_type* __frm, const extern_type* __end, size_t __mx) const override;
- int do_max_length() const _NOEXCEPT override;
+ result do_out(state_type& __st,
+ const intern_type* __frm,
+ const intern_type* __frm_end,
+ const intern_type*& __frm_nxt,
+ extern_type* __to,
+ extern_type* __to_end,
+ extern_type*& __to_nxt) const override;
+ result do_in(state_type& __st,
+ const extern_type* __frm,
+ const extern_type* __frm_end,
+ const extern_type*& __frm_nxt,
+ intern_type* __to,
+ intern_type* __to_end,
+ intern_type*& __to_nxt) const override;
+ result do_unshift(state_type& __st, extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const override;
+ int do_encoding() const _NOEXCEPT override;
+ bool do_always_noconv() const _NOEXCEPT override;
+ int do_length(state_type&, const extern_type* __frm, const extern_type* __end, size_t __mx) const override;
+ int do_max_length() const _NOEXCEPT override;
};
_LIBCPP_SUPPRESS_DEPRECATED_PUSH
template <>
-class _LIBCPP_EXPORTED_FROM_ABI __codecvt_utf16<char32_t, false>
- : public codecvt<char32_t, char, mbstate_t>
-{
- unsigned long __maxcode_;
- codecvt_mode __mode_;
+class _LIBCPP_EXPORTED_FROM_ABI __codecvt_utf16<char32_t, false> : public codecvt<char32_t, char, mbstate_t> {
+ unsigned long __maxcode_;
+ codecvt_mode __mode_;
+
public:
- typedef char32_t intern_type;
- typedef char extern_type;
- typedef mbstate_t state_type;
-
- _LIBCPP_HIDE_FROM_ABI
- explicit __codecvt_utf16(size_t __refs, unsigned long __maxcode,
- codecvt_mode __mode)
- : codecvt<char32_t, char, mbstate_t>(__refs), __maxcode_(__maxcode),
- __mode_(__mode) {}
-_LIBCPP_SUPPRESS_DEPRECATED_POP
+ typedef char32_t intern_type;
+ typedef char extern_type;
+ typedef mbstate_t state_type;
+
+ _LIBCPP_HIDE_FROM_ABI explicit __codecvt_utf16(size_t __refs, unsigned long __maxcode, codecvt_mode __mode)
+ : codecvt<char32_t, char, mbstate_t>(__refs), __maxcode_(__maxcode), __mode_(__mode) {}
+ _LIBCPP_SUPPRESS_DEPRECATED_POP
protected:
- result do_out(state_type& __st,
- const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt,
- extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const override;
- result do_in(state_type& __st,
- const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt,
- intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const override;
- result do_unshift(state_type& __st,
- extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const override;
- int do_encoding() const _NOEXCEPT override;
- bool do_always_noconv() const _NOEXCEPT override;
- int do_length(state_type&, const extern_type* __frm, const extern_type* __end, size_t __mx) const override;
- int do_max_length() const _NOEXCEPT override;
+ result do_out(state_type& __st,
+ const intern_type* __frm,
+ const intern_type* __frm_end,
+ const intern_type*& __frm_nxt,
+ extern_type* __to,
+ extern_type* __to_end,
+ extern_type*& __to_nxt) const override;
+ result do_in(state_type& __st,
+ const extern_type* __frm,
+ const extern_type* __frm_end,
+ const extern_type*& __frm_nxt,
+ intern_type* __to,
+ intern_type* __to_end,
+ intern_type*& __to_nxt) const override;
+ result do_unshift(state_type& __st, extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const override;
+ int do_encoding() const _NOEXCEPT override;
+ bool do_always_noconv() const _NOEXCEPT override;
+ int do_length(state_type&, const extern_type* __frm, const extern_type* __end, size_t __mx) const override;
+ int do_max_length() const _NOEXCEPT override;
};
_LIBCPP_SUPPRESS_DEPRECATED_PUSH
template <>
-class _LIBCPP_EXPORTED_FROM_ABI __codecvt_utf16<char32_t, true>
- : public codecvt<char32_t, char, mbstate_t>
-{
- unsigned long __maxcode_;
- codecvt_mode __mode_;
+class _LIBCPP_EXPORTED_FROM_ABI __codecvt_utf16<char32_t, true> : public codecvt<char32_t, char, mbstate_t> {
+ unsigned long __maxcode_;
+ codecvt_mode __mode_;
+
public:
- typedef char32_t intern_type;
- typedef char extern_type;
- typedef mbstate_t state_type;
-
- _LIBCPP_HIDE_FROM_ABI
- explicit __codecvt_utf16(size_t __refs, unsigned long __maxcode,
- codecvt_mode __mode)
- : codecvt<char32_t, char, mbstate_t>(__refs), __maxcode_(__maxcode),
- __mode_(__mode) {}
-_LIBCPP_SUPPRESS_DEPRECATED_POP
+ typedef char32_t intern_type;
+ typedef char extern_type;
+ typedef mbstate_t state_type;
+
+ _LIBCPP_HIDE_FROM_ABI explicit __codecvt_utf16(size_t __refs, unsigned long __maxcode, codecvt_mode __mode)
+ : codecvt<char32_t, char, mbstate_t>(__refs), __maxcode_(__maxcode), __mode_(__mode) {}
+ _LIBCPP_SUPPRESS_DEPRECATED_POP
protected:
- result do_out(state_type& __st,
- const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt,
- extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const override;
- result do_in(state_type& __st,
- const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt,
- intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const override;
- result do_unshift(state_type& __st,
- extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const override;
- int do_encoding() const _NOEXCEPT override;
- bool do_always_noconv() const _NOEXCEPT override;
- int do_length(state_type&, const extern_type* __frm, const extern_type* __end, size_t __mx) const override;
- int do_max_length() const _NOEXCEPT override;
+ result do_out(state_type& __st,
+ const intern_type* __frm,
+ const intern_type* __frm_end,
+ const intern_type*& __frm_nxt,
+ extern_type* __to,
+ extern_type* __to_end,
+ extern_type*& __to_nxt) const override;
+ result do_in(state_type& __st,
+ const extern_type* __frm,
+ const extern_type* __frm_end,
+ const extern_type*& __frm_nxt,
+ intern_type* __to,
+ intern_type* __to_end,
+ intern_type*& __to_nxt) const override;
+ result do_unshift(state_type& __st, extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const override;
+ int do_encoding() const _NOEXCEPT override;
+ bool do_always_noconv() const _NOEXCEPT override;
+ int do_length(state_type&, const extern_type* __frm, const extern_type* __end, size_t __mx) const override;
+ int do_max_length() const _NOEXCEPT override;
};
_LIBCPP_SUPPRESS_DEPRECATED_PUSH
-template <class _Elem, unsigned long _Maxcode = 0x10ffff,
- codecvt_mode _Mode = (codecvt_mode)0>
+template <class _Elem, unsigned long _Maxcode = 0x10ffff, codecvt_mode _Mode = (codecvt_mode)0>
class _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX17 codecvt_utf16
- : public __codecvt_utf16<_Elem, _Mode & little_endian>
-{
+ : public __codecvt_utf16<_Elem, _Mode & little_endian> {
public:
- _LIBCPP_HIDE_FROM_ABI
- explicit codecvt_utf16(size_t __refs = 0)
- : __codecvt_utf16<_Elem, _Mode & little_endian>(__refs, _Maxcode, _Mode) {}
+ _LIBCPP_HIDE_FROM_ABI explicit codecvt_utf16(size_t __refs = 0)
+ : __codecvt_utf16<_Elem, _Mode & little_endian>(__refs, _Maxcode, _Mode) {}
- _LIBCPP_HIDE_FROM_ABI
- ~codecvt_utf16() {}
+ _LIBCPP_HIDE_FROM_ABI ~codecvt_utf16() {}
};
_LIBCPP_SUPPRESS_DEPRECATED_POP
// codecvt_utf8_utf16
-template <class _Elem> class __codecvt_utf8_utf16;
+template <class _Elem>
+class __codecvt_utf8_utf16;
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+# ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
template <>
-class _LIBCPP_EXPORTED_FROM_ABI __codecvt_utf8_utf16<wchar_t>
- : public codecvt<wchar_t, char, mbstate_t>
-{
- unsigned long __maxcode_;
-_LIBCPP_SUPPRESS_DEPRECATED_PUSH
- codecvt_mode __mode_;
-_LIBCPP_SUPPRESS_DEPRECATED_POP
+class _LIBCPP_EXPORTED_FROM_ABI __codecvt_utf8_utf16<wchar_t> : public codecvt<wchar_t, char, mbstate_t> {
+ unsigned long __maxcode_;
+ _LIBCPP_SUPPRESS_DEPRECATED_PUSH
+ codecvt_mode __mode_;
+ _LIBCPP_SUPPRESS_DEPRECATED_POP
+
public:
- typedef wchar_t intern_type;
- typedef char extern_type;
- typedef mbstate_t state_type;
+ typedef wchar_t intern_type;
+ typedef char extern_type;
+ typedef mbstate_t state_type;
+
+ _LIBCPP_SUPPRESS_DEPRECATED_PUSH
+ _LIBCPP_HIDE_FROM_ABI explicit __codecvt_utf8_utf16(size_t __refs, unsigned long __maxcode, codecvt_mode __mode)
+ : codecvt<wchar_t, char, mbstate_t>(__refs), __maxcode_(__maxcode), __mode_(__mode) {}
+ _LIBCPP_SUPPRESS_DEPRECATED_POP
-_LIBCPP_SUPPRESS_DEPRECATED_PUSH
- _LIBCPP_HIDE_FROM_ABI
- explicit __codecvt_utf8_utf16(size_t __refs, unsigned long __maxcode,
- codecvt_mode __mode)
- : codecvt<wchar_t, char, mbstate_t>(__refs), __maxcode_(__maxcode),
- __mode_(__mode) {}
-_LIBCPP_SUPPRESS_DEPRECATED_POP
protected:
- result do_out(state_type& __st,
- const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt,
- extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const override;
- result do_in(state_type& __st,
- const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt,
- intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const override;
- result do_unshift(state_type& __st,
- extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const override;
- int do_encoding() const _NOEXCEPT override;
- bool do_always_noconv() const _NOEXCEPT override;
- int do_length(state_type&, const extern_type* __frm, const extern_type* __end, size_t __mx) const override;
- int do_max_length() const _NOEXCEPT override;
+ result do_out(state_type& __st,
+ const intern_type* __frm,
+ const intern_type* __frm_end,
+ const intern_type*& __frm_nxt,
+ extern_type* __to,
+ extern_type* __to_end,
+ extern_type*& __to_nxt) const override;
+ result do_in(state_type& __st,
+ const extern_type* __frm,
+ const extern_type* __frm_end,
+ const extern_type*& __frm_nxt,
+ intern_type* __to,
+ intern_type* __to_end,
+ intern_type*& __to_nxt) const override;
+ result do_unshift(state_type& __st, extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const override;
+ int do_encoding() const _NOEXCEPT override;
+ bool do_always_noconv() const _NOEXCEPT override;
+ int do_length(state_type&, const extern_type* __frm, const extern_type* __end, size_t __mx) const override;
+ int do_max_length() const _NOEXCEPT override;
};
-#endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS
+# endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS
_LIBCPP_SUPPRESS_DEPRECATED_PUSH
template <>
-class _LIBCPP_EXPORTED_FROM_ABI __codecvt_utf8_utf16<char32_t>
- : public codecvt<char32_t, char, mbstate_t>
-{
- unsigned long __maxcode_;
- codecvt_mode __mode_;
+class _LIBCPP_EXPORTED_FROM_ABI __codecvt_utf8_utf16<char32_t> : public codecvt<char32_t, char, mbstate_t> {
+ unsigned long __maxcode_;
+ codecvt_mode __mode_;
+
public:
- typedef char32_t intern_type;
- typedef char extern_type;
- typedef mbstate_t state_type;
-
- _LIBCPP_HIDE_FROM_ABI
- explicit __codecvt_utf8_utf16(size_t __refs, unsigned long __maxcode,
- codecvt_mode __mode)
- : codecvt<char32_t, char, mbstate_t>(__refs), __maxcode_(__maxcode),
- __mode_(__mode) {}
-_LIBCPP_SUPPRESS_DEPRECATED_POP
+ typedef char32_t intern_type;
+ typedef char extern_type;
+ typedef mbstate_t state_type;
+
+ _LIBCPP_HIDE_FROM_ABI explicit __codecvt_utf8_utf16(size_t __refs, unsigned long __maxcode, codecvt_mode __mode)
+ : codecvt<char32_t, char, mbstate_t>(__refs), __maxcode_(__maxcode), __mode_(__mode) {}
+ _LIBCPP_SUPPRESS_DEPRECATED_POP
protected:
- result do_out(state_type& __st,
- const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt,
- extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const override;
- result do_in(state_type& __st,
- const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt,
- intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const override;
- result do_unshift(state_type& __st,
- extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const override;
- int do_encoding() const _NOEXCEPT override;
- bool do_always_noconv() const _NOEXCEPT override;
- int do_length(state_type&, const extern_type* __frm, const extern_type* __end, size_t __mx) const override;
- int do_max_length() const _NOEXCEPT override;
+ result do_out(state_type& __st,
+ const intern_type* __frm,
+ const intern_type* __frm_end,
+ const intern_type*& __frm_nxt,
+ extern_type* __to,
+ extern_type* __to_end,
+ extern_type*& __to_nxt) const override;
+ result do_in(state_type& __st,
+ const extern_type* __frm,
+ const extern_type* __frm_end,
+ const extern_type*& __frm_nxt,
+ intern_type* __to,
+ intern_type* __to_end,
+ intern_type*& __to_nxt) const override;
+ result do_unshift(state_type& __st, extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const override;
+ int do_encoding() const _NOEXCEPT override;
+ bool do_always_noconv() const _NOEXCEPT override;
+ int do_length(state_type&, const extern_type* __frm, const extern_type* __end, size_t __mx) const override;
+ int do_max_length() const _NOEXCEPT override;
};
_LIBCPP_SUPPRESS_DEPRECATED_PUSH
template <>
-class _LIBCPP_EXPORTED_FROM_ABI __codecvt_utf8_utf16<char16_t>
- : public codecvt<char16_t, char, mbstate_t>
-{
- unsigned long __maxcode_;
- codecvt_mode __mode_;
+class _LIBCPP_EXPORTED_FROM_ABI __codecvt_utf8_utf16<char16_t> : public codecvt<char16_t, char, mbstate_t> {
+ unsigned long __maxcode_;
+ codecvt_mode __mode_;
+
public:
- typedef char16_t intern_type;
- typedef char extern_type;
- typedef mbstate_t state_type;
-
- _LIBCPP_HIDE_FROM_ABI
- explicit __codecvt_utf8_utf16(size_t __refs, unsigned long __maxcode,
- codecvt_mode __mode)
- : codecvt<char16_t, char, mbstate_t>(__refs), __maxcode_(__maxcode),
- __mode_(__mode) {}
-_LIBCPP_SUPPRESS_DEPRECATED_POP
+ typedef char16_t intern_type;
+ typedef char extern_type;
+ typedef mbstate_t state_type;
+
+ _LIBCPP_HIDE_FROM_ABI explicit __codecvt_utf8_utf16(size_t __refs, unsigned long __maxcode, codecvt_mode __mode)
+ : codecvt<char16_t, char, mbstate_t>(__refs), __maxcode_(__maxcode), __mode_(__mode) {}
+ _LIBCPP_SUPPRESS_DEPRECATED_POP
protected:
- result do_out(state_type& __st,
- const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt,
- extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const override;
- result do_in(state_type& __st,
- const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt,
- intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const override;
- result do_unshift(state_type& __st,
- extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const override;
- int do_encoding() const _NOEXCEPT override;
- bool do_always_noconv() const _NOEXCEPT override;
- int do_length(state_type&, const extern_type* __frm, const extern_type* __end, size_t __mx) const override;
- int do_max_length() const _NOEXCEPT override;
+ result do_out(state_type& __st,
+ const intern_type* __frm,
+ const intern_type* __frm_end,
+ const intern_type*& __frm_nxt,
+ extern_type* __to,
+ extern_type* __to_end,
+ extern_type*& __to_nxt) const override;
+ result do_in(state_type& __st,
+ const extern_type* __frm,
+ const extern_type* __frm_end,
+ const extern_type*& __frm_nxt,
+ intern_type* __to,
+ intern_type* __to_end,
+ intern_type*& __to_nxt) const override;
+ result do_unshift(state_type& __st, extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const override;
+ int do_encoding() const _NOEXCEPT override;
+ bool do_always_noconv() const _NOEXCEPT override;
+ int do_length(state_type&, const extern_type* __frm, const extern_type* __end, size_t __mx) const override;
+ int do_max_length() const _NOEXCEPT override;
};
_LIBCPP_SUPPRESS_DEPRECATED_PUSH
-template <class _Elem, unsigned long _Maxcode = 0x10ffff,
- codecvt_mode _Mode = (codecvt_mode)0>
-class _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX17 codecvt_utf8_utf16
- : public __codecvt_utf8_utf16<_Elem>
-{
+template <class _Elem, unsigned long _Maxcode = 0x10ffff, codecvt_mode _Mode = (codecvt_mode)0>
+class _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX17 codecvt_utf8_utf16 : public __codecvt_utf8_utf16<_Elem> {
public:
- _LIBCPP_HIDE_FROM_ABI
- explicit codecvt_utf8_utf16(size_t __refs = 0)
- : __codecvt_utf8_utf16<_Elem>(__refs, _Maxcode, _Mode) {}
+ _LIBCPP_HIDE_FROM_ABI explicit codecvt_utf8_utf16(size_t __refs = 0)
+ : __codecvt_utf8_utf16<_Elem>(__refs, _Maxcode, _Mode) {}
- _LIBCPP_HIDE_FROM_ABI
- ~codecvt_utf8_utf16() {}
+ _LIBCPP_HIDE_FROM_ABI ~codecvt_utf8_utf16() {}
};
_LIBCPP_SUPPRESS_DEPRECATED_POP
diff --git a/contrib/llvm-project/libcxx/include/complex b/contrib/llvm-project/libcxx/include/complex
index 44579b1ad528..02b9db8c516d 100644
--- a/contrib/llvm-project/libcxx/include/complex
+++ b/contrib/llvm-project/libcxx/include/complex
@@ -237,7 +237,7 @@ template<class T> complex<T> tanh (const complex<T>&);
#include <version>
#if !defined(_LIBCPP_HAS_NO_LOCALIZATION)
-# include <sstream> // for std::basic_ostringstream
+# include <sstream> // for std::basic_ostringstream
#endif
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
@@ -246,1295 +246,1138 @@ template<class T> complex<T> tanh (const complex<T>&);
_LIBCPP_BEGIN_NAMESPACE_STD
-template<class _Tp> class _LIBCPP_TEMPLATE_VIS complex;
+template <class _Tp>
+class _LIBCPP_TEMPLATE_VIS complex;
-template<class _Tp> _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex<_Tp> operator*(const complex<_Tp>& __z, const complex<_Tp>& __w);
-template<class _Tp> _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex<_Tp> operator/(const complex<_Tp>& __x, const complex<_Tp>& __y);
+template <class _Tp>
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex<_Tp>
+operator*(const complex<_Tp>& __z, const complex<_Tp>& __w);
+template <class _Tp>
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex<_Tp>
+operator/(const complex<_Tp>& __x, const complex<_Tp>& __y);
-template<class _Tp>
-class _LIBCPP_TEMPLATE_VIS complex
-{
+template <class _Tp>
+class _LIBCPP_TEMPLATE_VIS complex {
public:
- typedef _Tp value_type;
+ typedef _Tp value_type;
+
private:
- value_type __re_;
- value_type __im_;
+ value_type __re_;
+ value_type __im_;
+
public:
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
- complex(const value_type& __re = value_type(), const value_type& __im = value_type())
- : __re_(__re), __im_(__im) {}
- template<class _Xp> _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
- complex(const complex<_Xp>& __c)
- : __re_(__c.real()), __im_(__c.imag()) {}
-
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 value_type real() const {return __re_;}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 value_type imag() const {return __im_;}
-
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void real(value_type __re) {__re_ = __re;}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void imag(value_type __im) {__im_ = __im;}
-
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator= (const value_type& __re)
- {__re_ = __re; __im_ = value_type(); return *this;}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator+=(const value_type& __re) {__re_ += __re; return *this;}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator-=(const value_type& __re) {__re_ -= __re; return *this;}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator*=(const value_type& __re) {__re_ *= __re; __im_ *= __re; return *this;}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator/=(const value_type& __re) {__re_ /= __re; __im_ /= __re; return *this;}
-
- template<class _Xp> _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator= (const complex<_Xp>& __c)
- {
- __re_ = __c.real();
- __im_ = __c.imag();
- return *this;
- }
- template<class _Xp> _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator+=(const complex<_Xp>& __c)
- {
- __re_ += __c.real();
- __im_ += __c.imag();
- return *this;
- }
- template<class _Xp> _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator-=(const complex<_Xp>& __c)
- {
- __re_ -= __c.real();
- __im_ -= __c.imag();
- return *this;
- }
- template<class _Xp> _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator*=(const complex<_Xp>& __c)
- {
- *this = *this * complex(__c.real(), __c.imag());
- return *this;
- }
- template<class _Xp> _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator/=(const complex<_Xp>& __c)
- {
- *this = *this / complex(__c.real(), __c.imag());
- return *this;
- }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
+ complex(const value_type& __re = value_type(), const value_type& __im = value_type())
+ : __re_(__re), __im_(__im) {}
+ template <class _Xp>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 complex(const complex<_Xp>& __c)
+ : __re_(__c.real()), __im_(__c.imag()) {}
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 value_type real() const { return __re_; }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 value_type imag() const { return __im_; }
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void real(value_type __re) { __re_ = __re; }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void imag(value_type __im) { __im_ = __im; }
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator=(const value_type& __re) {
+ __re_ = __re;
+ __im_ = value_type();
+ return *this;
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator+=(const value_type& __re) {
+ __re_ += __re;
+ return *this;
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator-=(const value_type& __re) {
+ __re_ -= __re;
+ return *this;
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator*=(const value_type& __re) {
+ __re_ *= __re;
+ __im_ *= __re;
+ return *this;
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator/=(const value_type& __re) {
+ __re_ /= __re;
+ __im_ /= __re;
+ return *this;
+ }
+
+ template <class _Xp>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator=(const complex<_Xp>& __c) {
+ __re_ = __c.real();
+ __im_ = __c.imag();
+ return *this;
+ }
+ template <class _Xp>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator+=(const complex<_Xp>& __c) {
+ __re_ += __c.real();
+ __im_ += __c.imag();
+ return *this;
+ }
+ template <class _Xp>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator-=(const complex<_Xp>& __c) {
+ __re_ -= __c.real();
+ __im_ -= __c.imag();
+ return *this;
+ }
+ template <class _Xp>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator*=(const complex<_Xp>& __c) {
+ *this = *this * complex(__c.real(), __c.imag());
+ return *this;
+ }
+ template <class _Xp>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator/=(const complex<_Xp>& __c) {
+ *this = *this / complex(__c.real(), __c.imag());
+ return *this;
+ }
};
-template<> class _LIBCPP_TEMPLATE_VIS complex<double>;
-template<> class _LIBCPP_TEMPLATE_VIS complex<long double>;
+template <>
+class _LIBCPP_TEMPLATE_VIS complex<double>;
+template <>
+class _LIBCPP_TEMPLATE_VIS complex<long double>;
-template<>
-class _LIBCPP_TEMPLATE_VIS complex<float>
-{
- float __re_;
- float __im_;
-public:
- typedef float value_type;
+template <>
+class _LIBCPP_TEMPLATE_VIS complex<float> {
+ float __re_;
+ float __im_;
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR complex(float __re = 0.0f, float __im = 0.0f)
- : __re_(__re), __im_(__im) {}
- _LIBCPP_HIDE_FROM_ABI
- explicit _LIBCPP_CONSTEXPR complex(const complex<double>& __c);
- _LIBCPP_HIDE_FROM_ABI
- explicit _LIBCPP_CONSTEXPR complex(const complex<long double>& __c);
-
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR float real() const {return __re_;}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR float imag() const {return __im_;}
-
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void real(value_type __re) {__re_ = __re;}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void imag(value_type __im) {__im_ = __im;}
-
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator= (float __re)
- {__re_ = __re; __im_ = value_type(); return *this;}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator+=(float __re) {__re_ += __re; return *this;}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator-=(float __re) {__re_ -= __re; return *this;}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator*=(float __re) {__re_ *= __re; __im_ *= __re; return *this;}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator/=(float __re) {__re_ /= __re; __im_ /= __re; return *this;}
-
- template<class _Xp> _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator= (const complex<_Xp>& __c)
- {
- __re_ = __c.real();
- __im_ = __c.imag();
- return *this;
- }
- template<class _Xp> _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator+=(const complex<_Xp>& __c)
- {
- __re_ += __c.real();
- __im_ += __c.imag();
- return *this;
- }
- template<class _Xp> _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator-=(const complex<_Xp>& __c)
- {
- __re_ -= __c.real();
- __im_ -= __c.imag();
- return *this;
- }
- template<class _Xp> _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator*=(const complex<_Xp>& __c)
- {
- *this = *this * complex(__c.real(), __c.imag());
- return *this;
- }
- template<class _Xp> _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator/=(const complex<_Xp>& __c)
- {
- *this = *this / complex(__c.real(), __c.imag());
- return *this;
- }
+public:
+ typedef float value_type;
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR complex(float __re = 0.0f, float __im = 0.0f) : __re_(__re), __im_(__im) {}
+ _LIBCPP_HIDE_FROM_ABI explicit _LIBCPP_CONSTEXPR complex(const complex<double>& __c);
+ _LIBCPP_HIDE_FROM_ABI explicit _LIBCPP_CONSTEXPR complex(const complex<long double>& __c);
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR float real() const { return __re_; }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR float imag() const { return __im_; }
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void real(value_type __re) { __re_ = __re; }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void imag(value_type __im) { __im_ = __im; }
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator=(float __re) {
+ __re_ = __re;
+ __im_ = value_type();
+ return *this;
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator+=(float __re) {
+ __re_ += __re;
+ return *this;
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator-=(float __re) {
+ __re_ -= __re;
+ return *this;
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator*=(float __re) {
+ __re_ *= __re;
+ __im_ *= __re;
+ return *this;
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator/=(float __re) {
+ __re_ /= __re;
+ __im_ /= __re;
+ return *this;
+ }
+
+ template <class _Xp>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator=(const complex<_Xp>& __c) {
+ __re_ = __c.real();
+ __im_ = __c.imag();
+ return *this;
+ }
+ template <class _Xp>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator+=(const complex<_Xp>& __c) {
+ __re_ += __c.real();
+ __im_ += __c.imag();
+ return *this;
+ }
+ template <class _Xp>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator-=(const complex<_Xp>& __c) {
+ __re_ -= __c.real();
+ __im_ -= __c.imag();
+ return *this;
+ }
+ template <class _Xp>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator*=(const complex<_Xp>& __c) {
+ *this = *this * complex(__c.real(), __c.imag());
+ return *this;
+ }
+ template <class _Xp>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator/=(const complex<_Xp>& __c) {
+ *this = *this / complex(__c.real(), __c.imag());
+ return *this;
+ }
};
-template<>
-class _LIBCPP_TEMPLATE_VIS complex<double>
-{
- double __re_;
- double __im_;
-public:
- typedef double value_type;
+template <>
+class _LIBCPP_TEMPLATE_VIS complex<double> {
+ double __re_;
+ double __im_;
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR complex(double __re = 0.0, double __im = 0.0)
- : __re_(__re), __im_(__im) {}
- _LIBCPP_HIDE_FROM_ABI
- _LIBCPP_CONSTEXPR complex(const complex<float>& __c);
- _LIBCPP_HIDE_FROM_ABI
- explicit _LIBCPP_CONSTEXPR complex(const complex<long double>& __c);
-
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR double real() const {return __re_;}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR double imag() const {return __im_;}
-
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void real(value_type __re) {__re_ = __re;}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void imag(value_type __im) {__im_ = __im;}
-
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator= (double __re)
- {__re_ = __re; __im_ = value_type(); return *this;}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator+=(double __re) {__re_ += __re; return *this;}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator-=(double __re) {__re_ -= __re; return *this;}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator*=(double __re) {__re_ *= __re; __im_ *= __re; return *this;}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator/=(double __re) {__re_ /= __re; __im_ /= __re; return *this;}
-
- template<class _Xp> _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator= (const complex<_Xp>& __c)
- {
- __re_ = __c.real();
- __im_ = __c.imag();
- return *this;
- }
- template<class _Xp> _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator+=(const complex<_Xp>& __c)
- {
- __re_ += __c.real();
- __im_ += __c.imag();
- return *this;
- }
- template<class _Xp> _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator-=(const complex<_Xp>& __c)
- {
- __re_ -= __c.real();
- __im_ -= __c.imag();
- return *this;
- }
- template<class _Xp> _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator*=(const complex<_Xp>& __c)
- {
- *this = *this * complex(__c.real(), __c.imag());
- return *this;
- }
- template<class _Xp> _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator/=(const complex<_Xp>& __c)
- {
- *this = *this / complex(__c.real(), __c.imag());
- return *this;
- }
+public:
+ typedef double value_type;
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR complex(double __re = 0.0, double __im = 0.0) : __re_(__re), __im_(__im) {}
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR complex(const complex<float>& __c);
+ _LIBCPP_HIDE_FROM_ABI explicit _LIBCPP_CONSTEXPR complex(const complex<long double>& __c);
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR double real() const { return __re_; }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR double imag() const { return __im_; }
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void real(value_type __re) { __re_ = __re; }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void imag(value_type __im) { __im_ = __im; }
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator=(double __re) {
+ __re_ = __re;
+ __im_ = value_type();
+ return *this;
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator+=(double __re) {
+ __re_ += __re;
+ return *this;
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator-=(double __re) {
+ __re_ -= __re;
+ return *this;
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator*=(double __re) {
+ __re_ *= __re;
+ __im_ *= __re;
+ return *this;
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator/=(double __re) {
+ __re_ /= __re;
+ __im_ /= __re;
+ return *this;
+ }
+
+ template <class _Xp>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator=(const complex<_Xp>& __c) {
+ __re_ = __c.real();
+ __im_ = __c.imag();
+ return *this;
+ }
+ template <class _Xp>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator+=(const complex<_Xp>& __c) {
+ __re_ += __c.real();
+ __im_ += __c.imag();
+ return *this;
+ }
+ template <class _Xp>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator-=(const complex<_Xp>& __c) {
+ __re_ -= __c.real();
+ __im_ -= __c.imag();
+ return *this;
+ }
+ template <class _Xp>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator*=(const complex<_Xp>& __c) {
+ *this = *this * complex(__c.real(), __c.imag());
+ return *this;
+ }
+ template <class _Xp>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator/=(const complex<_Xp>& __c) {
+ *this = *this / complex(__c.real(), __c.imag());
+ return *this;
+ }
};
-template<>
-class _LIBCPP_TEMPLATE_VIS complex<long double>
-{
- long double __re_;
- long double __im_;
-public:
- typedef long double value_type;
+template <>
+class _LIBCPP_TEMPLATE_VIS complex<long double> {
+ long double __re_;
+ long double __im_;
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR complex(long double __re = 0.0L, long double __im = 0.0L)
- : __re_(__re), __im_(__im) {}
- _LIBCPP_HIDE_FROM_ABI
- _LIBCPP_CONSTEXPR complex(const complex<float>& __c);
- _LIBCPP_HIDE_FROM_ABI
- _LIBCPP_CONSTEXPR complex(const complex<double>& __c);
-
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR long double real() const {return __re_;}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR long double imag() const {return __im_;}
-
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void real(value_type __re) {__re_ = __re;}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void imag(value_type __im) {__im_ = __im;}
-
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator= (long double __re)
- {__re_ = __re; __im_ = value_type(); return *this;}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator+=(long double __re) {__re_ += __re; return *this;}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator-=(long double __re) {__re_ -= __re; return *this;}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator*=(long double __re) {__re_ *= __re; __im_ *= __re; return *this;}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator/=(long double __re) {__re_ /= __re; __im_ /= __re; return *this;}
-
- template<class _Xp> _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator= (const complex<_Xp>& __c)
- {
- __re_ = __c.real();
- __im_ = __c.imag();
- return *this;
- }
- template<class _Xp> _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator+=(const complex<_Xp>& __c)
- {
- __re_ += __c.real();
- __im_ += __c.imag();
- return *this;
- }
- template<class _Xp> _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator-=(const complex<_Xp>& __c)
- {
- __re_ -= __c.real();
- __im_ -= __c.imag();
- return *this;
- }
- template<class _Xp> _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator*=(const complex<_Xp>& __c)
- {
- *this = *this * complex(__c.real(), __c.imag());
- return *this;
- }
- template<class _Xp> _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator/=(const complex<_Xp>& __c)
- {
- *this = *this / complex(__c.real(), __c.imag());
- return *this;
- }
+public:
+ typedef long double value_type;
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR complex(long double __re = 0.0L, long double __im = 0.0L)
+ : __re_(__re), __im_(__im) {}
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR complex(const complex<float>& __c);
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR complex(const complex<double>& __c);
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR long double real() const { return __re_; }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR long double imag() const { return __im_; }
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void real(value_type __re) { __re_ = __re; }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void imag(value_type __im) { __im_ = __im; }
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator=(long double __re) {
+ __re_ = __re;
+ __im_ = value_type();
+ return *this;
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator+=(long double __re) {
+ __re_ += __re;
+ return *this;
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator-=(long double __re) {
+ __re_ -= __re;
+ return *this;
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator*=(long double __re) {
+ __re_ *= __re;
+ __im_ *= __re;
+ return *this;
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator/=(long double __re) {
+ __re_ /= __re;
+ __im_ /= __re;
+ return *this;
+ }
+
+ template <class _Xp>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator=(const complex<_Xp>& __c) {
+ __re_ = __c.real();
+ __im_ = __c.imag();
+ return *this;
+ }
+ template <class _Xp>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator+=(const complex<_Xp>& __c) {
+ __re_ += __c.real();
+ __im_ += __c.imag();
+ return *this;
+ }
+ template <class _Xp>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator-=(const complex<_Xp>& __c) {
+ __re_ -= __c.real();
+ __im_ -= __c.imag();
+ return *this;
+ }
+ template <class _Xp>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator*=(const complex<_Xp>& __c) {
+ *this = *this * complex(__c.real(), __c.imag());
+ return *this;
+ }
+ template <class _Xp>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator/=(const complex<_Xp>& __c) {
+ *this = *this / complex(__c.real(), __c.imag());
+ return *this;
+ }
};
-inline
-_LIBCPP_CONSTEXPR
-complex<float>::complex(const complex<double>& __c)
- : __re_(__c.real()), __im_(__c.imag()) {}
+inline _LIBCPP_CONSTEXPR complex<float>::complex(const complex<double>& __c) : __re_(__c.real()), __im_(__c.imag()) {}
-inline
-_LIBCPP_CONSTEXPR
-complex<float>::complex(const complex<long double>& __c)
+inline _LIBCPP_CONSTEXPR complex<float>::complex(const complex<long double>& __c)
: __re_(__c.real()), __im_(__c.imag()) {}
-inline
-_LIBCPP_CONSTEXPR
-complex<double>::complex(const complex<float>& __c)
- : __re_(__c.real()), __im_(__c.imag()) {}
+inline _LIBCPP_CONSTEXPR complex<double>::complex(const complex<float>& __c) : __re_(__c.real()), __im_(__c.imag()) {}
-inline
-_LIBCPP_CONSTEXPR
-complex<double>::complex(const complex<long double>& __c)
+inline _LIBCPP_CONSTEXPR complex<double>::complex(const complex<long double>& __c)
: __re_(__c.real()), __im_(__c.imag()) {}
-inline
-_LIBCPP_CONSTEXPR
-complex<long double>::complex(const complex<float>& __c)
+inline _LIBCPP_CONSTEXPR complex<long double>::complex(const complex<float>& __c)
: __re_(__c.real()), __im_(__c.imag()) {}
-inline
-_LIBCPP_CONSTEXPR
-complex<long double>::complex(const complex<double>& __c)
+inline _LIBCPP_CONSTEXPR complex<long double>::complex(const complex<double>& __c)
: __re_(__c.real()), __im_(__c.imag()) {}
// 26.3.6 operators:
-template<class _Tp>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-complex<_Tp>
-operator+(const complex<_Tp>& __x, const complex<_Tp>& __y)
-{
- complex<_Tp> __t(__x);
- __t += __y;
- return __t;
+template <class _Tp>
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex<_Tp>
+operator+(const complex<_Tp>& __x, const complex<_Tp>& __y) {
+ complex<_Tp> __t(__x);
+ __t += __y;
+ return __t;
}
-template<class _Tp>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-complex<_Tp>
-operator+(const complex<_Tp>& __x, const _Tp& __y)
-{
- complex<_Tp> __t(__x);
- __t += __y;
- return __t;
+template <class _Tp>
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex<_Tp>
+operator+(const complex<_Tp>& __x, const _Tp& __y) {
+ complex<_Tp> __t(__x);
+ __t += __y;
+ return __t;
}
-template<class _Tp>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-complex<_Tp>
-operator+(const _Tp& __x, const complex<_Tp>& __y)
-{
- complex<_Tp> __t(__y);
- __t += __x;
- return __t;
+template <class _Tp>
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex<_Tp>
+operator+(const _Tp& __x, const complex<_Tp>& __y) {
+ complex<_Tp> __t(__y);
+ __t += __x;
+ return __t;
}
-template<class _Tp>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-complex<_Tp>
-operator-(const complex<_Tp>& __x, const complex<_Tp>& __y)
-{
- complex<_Tp> __t(__x);
- __t -= __y;
- return __t;
+template <class _Tp>
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex<_Tp>
+operator-(const complex<_Tp>& __x, const complex<_Tp>& __y) {
+ complex<_Tp> __t(__x);
+ __t -= __y;
+ return __t;
}
-template<class _Tp>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-complex<_Tp>
-operator-(const complex<_Tp>& __x, const _Tp& __y)
-{
- complex<_Tp> __t(__x);
- __t -= __y;
- return __t;
+template <class _Tp>
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex<_Tp>
+operator-(const complex<_Tp>& __x, const _Tp& __y) {
+ complex<_Tp> __t(__x);
+ __t -= __y;
+ return __t;
}
-template<class _Tp>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-complex<_Tp>
-operator-(const _Tp& __x, const complex<_Tp>& __y)
-{
- complex<_Tp> __t(-__y);
- __t += __x;
- return __t;
+template <class _Tp>
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex<_Tp>
+operator-(const _Tp& __x, const complex<_Tp>& __y) {
+ complex<_Tp> __t(-__y);
+ __t += __x;
+ return __t;
}
-template<class _Tp>
+template <class _Tp>
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex<_Tp>
-operator*(const complex<_Tp>& __z, const complex<_Tp>& __w)
-{
- _Tp __a = __z.real();
- _Tp __b = __z.imag();
- _Tp __c = __w.real();
- _Tp __d = __w.imag();
-
- // Avoid floating point operations that are invalid during constant evaluation
- if (__libcpp_is_constant_evaluated()) {
- bool __z_zero = __a == _Tp(0) && __b == _Tp(0);
- bool __w_zero = __c == _Tp(0) && __d == _Tp(0);
- bool __z_inf = std::__constexpr_isinf(__a) || std::__constexpr_isinf(__b);
- bool __w_inf = std::__constexpr_isinf(__c) || std::__constexpr_isinf(__d);
- bool __z_nan = !__z_inf && (
- (std::__constexpr_isnan(__a) && std::__constexpr_isnan(__b))
- || (std::__constexpr_isnan(__a) && __b == _Tp(0))
- || (__a == _Tp(0) && std::__constexpr_isnan(__b))
- );
- bool __w_nan = !__w_inf && (
- (std::__constexpr_isnan(__c) && std::__constexpr_isnan(__d))
- || (std::__constexpr_isnan(__c) && __d == _Tp(0))
- || (__c == _Tp(0) && std::__constexpr_isnan(__d))
- );
- if (__z_nan || __w_nan) {
- return complex<_Tp>(_Tp(numeric_limits<_Tp>::quiet_NaN()), _Tp(0));
- }
- if (__z_inf || __w_inf) {
- if (__z_zero || __w_zero) {
- return complex<_Tp>(_Tp(numeric_limits<_Tp>::quiet_NaN()), _Tp(0));
- }
- return complex<_Tp>(_Tp(numeric_limits<_Tp>::infinity()), _Tp(numeric_limits<_Tp>::infinity()));
- }
- bool __z_nonzero_nan = !__z_inf && !__z_nan && (std::__constexpr_isnan(__a) || std::__constexpr_isnan(__b));
- bool __w_nonzero_nan = !__w_inf && !__w_nan && (std::__constexpr_isnan(__c) || std::__constexpr_isnan(__d));
- if (__z_nonzero_nan || __w_nonzero_nan) {
- return complex<_Tp>(_Tp(numeric_limits<_Tp>::quiet_NaN()), _Tp(0));
- }
+operator*(const complex<_Tp>& __z, const complex<_Tp>& __w) {
+ _Tp __a = __z.real();
+ _Tp __b = __z.imag();
+ _Tp __c = __w.real();
+ _Tp __d = __w.imag();
+
+ // Avoid floating point operations that are invalid during constant evaluation
+ if (__libcpp_is_constant_evaluated()) {
+ bool __z_zero = __a == _Tp(0) && __b == _Tp(0);
+ bool __w_zero = __c == _Tp(0) && __d == _Tp(0);
+ bool __z_inf = std::__constexpr_isinf(__a) || std::__constexpr_isinf(__b);
+ bool __w_inf = std::__constexpr_isinf(__c) || std::__constexpr_isinf(__d);
+ bool __z_nan =
+ !__z_inf && ((std::__constexpr_isnan(__a) && std::__constexpr_isnan(__b)) ||
+ (std::__constexpr_isnan(__a) && __b == _Tp(0)) || (__a == _Tp(0) && std::__constexpr_isnan(__b)));
+ bool __w_nan =
+ !__w_inf && ((std::__constexpr_isnan(__c) && std::__constexpr_isnan(__d)) ||
+ (std::__constexpr_isnan(__c) && __d == _Tp(0)) || (__c == _Tp(0) && std::__constexpr_isnan(__d)));
+ if (__z_nan || __w_nan) {
+ return complex<_Tp>(_Tp(numeric_limits<_Tp>::quiet_NaN()), _Tp(0));
}
-
- _Tp __ac = __a * __c;
- _Tp __bd = __b * __d;
- _Tp __ad = __a * __d;
- _Tp __bc = __b * __c;
- _Tp __x = __ac - __bd;
- _Tp __y = __ad + __bc;
- if (std::__constexpr_isnan(__x) && std::__constexpr_isnan(__y))
- {
- bool __recalc = false;
- if (std::__constexpr_isinf(__a) || std::__constexpr_isinf(__b))
- {
- __a = std::__constexpr_copysign(std::__constexpr_isinf(__a) ? _Tp(1) : _Tp(0), __a);
- __b = std::__constexpr_copysign(std::__constexpr_isinf(__b) ? _Tp(1) : _Tp(0), __b);
- if (std::__constexpr_isnan(__c))
- __c = std::__constexpr_copysign(_Tp(0), __c);
- if (std::__constexpr_isnan(__d))
- __d = std::__constexpr_copysign(_Tp(0), __d);
- __recalc = true;
- }
- if (std::__constexpr_isinf(__c) || std::__constexpr_isinf(__d))
- {
- __c = std::__constexpr_copysign(std::__constexpr_isinf(__c) ? _Tp(1) : _Tp(0), __c);
- __d = std::__constexpr_copysign(std::__constexpr_isinf(__d) ? _Tp(1) : _Tp(0), __d);
- if (std::__constexpr_isnan(__a))
- __a = std::__constexpr_copysign(_Tp(0), __a);
- if (std::__constexpr_isnan(__b))
- __b = std::__constexpr_copysign(_Tp(0), __b);
- __recalc = true;
- }
- if (!__recalc && (std::__constexpr_isinf(__ac) || std::__constexpr_isinf(__bd) ||
- std::__constexpr_isinf(__ad) || std::__constexpr_isinf(__bc)))
- {
- if (std::__constexpr_isnan(__a))
- __a = std::__constexpr_copysign(_Tp(0), __a);
- if (std::__constexpr_isnan(__b))
- __b = std::__constexpr_copysign(_Tp(0), __b);
- if (std::__constexpr_isnan(__c))
- __c = std::__constexpr_copysign(_Tp(0), __c);
- if (std::__constexpr_isnan(__d))
- __d = std::__constexpr_copysign(_Tp(0), __d);
- __recalc = true;
- }
- if (__recalc)
- {
- __x = _Tp(INFINITY) * (__a * __c - __b * __d);
- __y = _Tp(INFINITY) * (__a * __d + __b * __c);
- }
+ if (__z_inf || __w_inf) {
+ if (__z_zero || __w_zero) {
+ return complex<_Tp>(_Tp(numeric_limits<_Tp>::quiet_NaN()), _Tp(0));
+ }
+ return complex<_Tp>(_Tp(numeric_limits<_Tp>::infinity()), _Tp(numeric_limits<_Tp>::infinity()));
+ }
+ bool __z_nonzero_nan = !__z_inf && !__z_nan && (std::__constexpr_isnan(__a) || std::__constexpr_isnan(__b));
+ bool __w_nonzero_nan = !__w_inf && !__w_nan && (std::__constexpr_isnan(__c) || std::__constexpr_isnan(__d));
+ if (__z_nonzero_nan || __w_nonzero_nan) {
+ return complex<_Tp>(_Tp(numeric_limits<_Tp>::quiet_NaN()), _Tp(0));
}
- return complex<_Tp>(__x, __y);
+ }
+
+ _Tp __ac = __a * __c;
+ _Tp __bd = __b * __d;
+ _Tp __ad = __a * __d;
+ _Tp __bc = __b * __c;
+ _Tp __x = __ac - __bd;
+ _Tp __y = __ad + __bc;
+ if (std::__constexpr_isnan(__x) && std::__constexpr_isnan(__y)) {
+ bool __recalc = false;
+ if (std::__constexpr_isinf(__a) || std::__constexpr_isinf(__b)) {
+ __a = std::__constexpr_copysign(std::__constexpr_isinf(__a) ? _Tp(1) : _Tp(0), __a);
+ __b = std::__constexpr_copysign(std::__constexpr_isinf(__b) ? _Tp(1) : _Tp(0), __b);
+ if (std::__constexpr_isnan(__c))
+ __c = std::__constexpr_copysign(_Tp(0), __c);
+ if (std::__constexpr_isnan(__d))
+ __d = std::__constexpr_copysign(_Tp(0), __d);
+ __recalc = true;
+ }
+ if (std::__constexpr_isinf(__c) || std::__constexpr_isinf(__d)) {
+ __c = std::__constexpr_copysign(std::__constexpr_isinf(__c) ? _Tp(1) : _Tp(0), __c);
+ __d = std::__constexpr_copysign(std::__constexpr_isinf(__d) ? _Tp(1) : _Tp(0), __d);
+ if (std::__constexpr_isnan(__a))
+ __a = std::__constexpr_copysign(_Tp(0), __a);
+ if (std::__constexpr_isnan(__b))
+ __b = std::__constexpr_copysign(_Tp(0), __b);
+ __recalc = true;
+ }
+ if (!__recalc && (std::__constexpr_isinf(__ac) || std::__constexpr_isinf(__bd) || std::__constexpr_isinf(__ad) ||
+ std::__constexpr_isinf(__bc))) {
+ if (std::__constexpr_isnan(__a))
+ __a = std::__constexpr_copysign(_Tp(0), __a);
+ if (std::__constexpr_isnan(__b))
+ __b = std::__constexpr_copysign(_Tp(0), __b);
+ if (std::__constexpr_isnan(__c))
+ __c = std::__constexpr_copysign(_Tp(0), __c);
+ if (std::__constexpr_isnan(__d))
+ __d = std::__constexpr_copysign(_Tp(0), __d);
+ __recalc = true;
+ }
+ if (__recalc) {
+ __x = _Tp(INFINITY) * (__a * __c - __b * __d);
+ __y = _Tp(INFINITY) * (__a * __d + __b * __c);
+ }
+ }
+ return complex<_Tp>(__x, __y);
}
-template<class _Tp>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-complex<_Tp>
-operator*(const complex<_Tp>& __x, const _Tp& __y)
-{
- complex<_Tp> __t(__x);
- __t *= __y;
- return __t;
+template <class _Tp>
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex<_Tp>
+operator*(const complex<_Tp>& __x, const _Tp& __y) {
+ complex<_Tp> __t(__x);
+ __t *= __y;
+ return __t;
}
-template<class _Tp>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-complex<_Tp>
-operator*(const _Tp& __x, const complex<_Tp>& __y)
-{
- complex<_Tp> __t(__y);
- __t *= __x;
- return __t;
+template <class _Tp>
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex<_Tp>
+operator*(const _Tp& __x, const complex<_Tp>& __y) {
+ complex<_Tp> __t(__y);
+ __t *= __x;
+ return __t;
}
-template<class _Tp>
+template <class _Tp>
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex<_Tp>
-operator/(const complex<_Tp>& __z, const complex<_Tp>& __w)
-{
- int __ilogbw = 0;
- _Tp __a = __z.real();
- _Tp __b = __z.imag();
- _Tp __c = __w.real();
- _Tp __d = __w.imag();
- _Tp __logbw = std::__constexpr_logb(std::__constexpr_fmax(std::__constexpr_fabs(__c), std::__constexpr_fabs(__d)));
- if (std::__constexpr_isfinite(__logbw))
- {
- __ilogbw = static_cast<int>(__logbw);
- __c = std::__constexpr_scalbn(__c, -__ilogbw);
- __d = std::__constexpr_scalbn(__d, -__ilogbw);
+operator/(const complex<_Tp>& __z, const complex<_Tp>& __w) {
+ int __ilogbw = 0;
+ _Tp __a = __z.real();
+ _Tp __b = __z.imag();
+ _Tp __c = __w.real();
+ _Tp __d = __w.imag();
+ _Tp __logbw = std::__constexpr_logb(std::__constexpr_fmax(std::__constexpr_fabs(__c), std::__constexpr_fabs(__d)));
+ if (std::__constexpr_isfinite(__logbw)) {
+ __ilogbw = static_cast<int>(__logbw);
+ __c = std::__constexpr_scalbn(__c, -__ilogbw);
+ __d = std::__constexpr_scalbn(__d, -__ilogbw);
+ }
+
+ // Avoid floating point operations that are invalid during constant evaluation
+ if (__libcpp_is_constant_evaluated()) {
+ bool __z_zero = __a == _Tp(0) && __b == _Tp(0);
+ bool __w_zero = __c == _Tp(0) && __d == _Tp(0);
+ bool __z_inf = std::__constexpr_isinf(__a) || std::__constexpr_isinf(__b);
+ bool __w_inf = std::__constexpr_isinf(__c) || std::__constexpr_isinf(__d);
+ bool __z_nan =
+ !__z_inf && ((std::__constexpr_isnan(__a) && std::__constexpr_isnan(__b)) ||
+ (std::__constexpr_isnan(__a) && __b == _Tp(0)) || (__a == _Tp(0) && std::__constexpr_isnan(__b)));
+ bool __w_nan =
+ !__w_inf && ((std::__constexpr_isnan(__c) && std::__constexpr_isnan(__d)) ||
+ (std::__constexpr_isnan(__c) && __d == _Tp(0)) || (__c == _Tp(0) && std::__constexpr_isnan(__d)));
+ if ((__z_nan || __w_nan) || (__z_inf && __w_inf)) {
+ return complex<_Tp>(_Tp(numeric_limits<_Tp>::quiet_NaN()), _Tp(0));
}
-
- // Avoid floating point operations that are invalid during constant evaluation
- if (__libcpp_is_constant_evaluated()) {
- bool __z_zero = __a == _Tp(0) && __b == _Tp(0);
- bool __w_zero = __c == _Tp(0) && __d == _Tp(0);
- bool __z_inf = std::__constexpr_isinf(__a) || std::__constexpr_isinf(__b);
- bool __w_inf = std::__constexpr_isinf(__c) || std::__constexpr_isinf(__d);
- bool __z_nan = !__z_inf && (
- (std::__constexpr_isnan(__a) && std::__constexpr_isnan(__b))
- || (std::__constexpr_isnan(__a) && __b == _Tp(0))
- || (__a == _Tp(0) && std::__constexpr_isnan(__b))
- );
- bool __w_nan = !__w_inf && (
- (std::__constexpr_isnan(__c) && std::__constexpr_isnan(__d))
- || (std::__constexpr_isnan(__c) && __d == _Tp(0))
- || (__c == _Tp(0) && std::__constexpr_isnan(__d))
- );
- if ((__z_nan || __w_nan) || (__z_inf && __w_inf)) {
- return complex<_Tp>(_Tp(numeric_limits<_Tp>::quiet_NaN()), _Tp(0));
- }
- bool __z_nonzero_nan = !__z_inf && !__z_nan && (std::__constexpr_isnan(__a) || std::__constexpr_isnan(__b));
- bool __w_nonzero_nan = !__w_inf && !__w_nan && (std::__constexpr_isnan(__c) || std::__constexpr_isnan(__d));
- if (__z_nonzero_nan || __w_nonzero_nan) {
- if (__w_zero) {
- return complex<_Tp>(_Tp(numeric_limits<_Tp>::infinity()), _Tp(numeric_limits<_Tp>::infinity()));
- }
- return complex<_Tp>(_Tp(numeric_limits<_Tp>::quiet_NaN()), _Tp(0));
- }
- if (__w_inf) {
- return complex<_Tp>(_Tp(0), _Tp(0));
- }
- if (__z_inf) {
- return complex<_Tp>(_Tp(numeric_limits<_Tp>::infinity()), _Tp(numeric_limits<_Tp>::infinity()));
- }
- if (__w_zero) {
- if (__z_zero) {
- return complex<_Tp>(_Tp(numeric_limits<_Tp>::quiet_NaN()), _Tp(0));
- }
- return complex<_Tp>(_Tp(numeric_limits<_Tp>::infinity()), _Tp(numeric_limits<_Tp>::infinity()));
- }
+ bool __z_nonzero_nan = !__z_inf && !__z_nan && (std::__constexpr_isnan(__a) || std::__constexpr_isnan(__b));
+ bool __w_nonzero_nan = !__w_inf && !__w_nan && (std::__constexpr_isnan(__c) || std::__constexpr_isnan(__d));
+ if (__z_nonzero_nan || __w_nonzero_nan) {
+ if (__w_zero) {
+ return complex<_Tp>(_Tp(numeric_limits<_Tp>::infinity()), _Tp(numeric_limits<_Tp>::infinity()));
+ }
+ return complex<_Tp>(_Tp(numeric_limits<_Tp>::quiet_NaN()), _Tp(0));
}
-
- _Tp __denom = __c * __c + __d * __d;
- _Tp __x = std::__constexpr_scalbn((__a * __c + __b * __d) / __denom, -__ilogbw);
- _Tp __y = std::__constexpr_scalbn((__b * __c - __a * __d) / __denom, -__ilogbw);
- if (std::__constexpr_isnan(__x) && std::__constexpr_isnan(__y))
- {
- if ((__denom == _Tp(0)) && (!std::__constexpr_isnan(__a) || !std::__constexpr_isnan(__b)))
- {
- __x = std::__constexpr_copysign(_Tp(INFINITY), __c) * __a;
- __y = std::__constexpr_copysign(_Tp(INFINITY), __c) * __b;
- } else if ((std::__constexpr_isinf(__a) || std::__constexpr_isinf(__b)) && std::__constexpr_isfinite(__c) &&
- std::__constexpr_isfinite(__d)) {
- __a = std::__constexpr_copysign(std::__constexpr_isinf(__a) ? _Tp(1) : _Tp(0), __a);
- __b = std::__constexpr_copysign(std::__constexpr_isinf(__b) ? _Tp(1) : _Tp(0), __b);
- __x = _Tp(INFINITY) * (__a * __c + __b * __d);
- __y = _Tp(INFINITY) * (__b * __c - __a * __d);
- } else if (std::__constexpr_isinf(__logbw) && __logbw > _Tp(0) && std::__constexpr_isfinite(__a) &&
- std::__constexpr_isfinite(__b)) {
- __c = std::__constexpr_copysign(std::__constexpr_isinf(__c) ? _Tp(1) : _Tp(0), __c);
- __d = std::__constexpr_copysign(std::__constexpr_isinf(__d) ? _Tp(1) : _Tp(0), __d);
- __x = _Tp(0) * (__a * __c + __b * __d);
- __y = _Tp(0) * (__b * __c - __a * __d);
- }
+ if (__w_inf) {
+ return complex<_Tp>(_Tp(0), _Tp(0));
+ }
+ if (__z_inf) {
+ return complex<_Tp>(_Tp(numeric_limits<_Tp>::infinity()), _Tp(numeric_limits<_Tp>::infinity()));
+ }
+ if (__w_zero) {
+ if (__z_zero) {
+ return complex<_Tp>(_Tp(numeric_limits<_Tp>::quiet_NaN()), _Tp(0));
+ }
+ return complex<_Tp>(_Tp(numeric_limits<_Tp>::infinity()), _Tp(numeric_limits<_Tp>::infinity()));
}
- return complex<_Tp>(__x, __y);
+ }
+
+ _Tp __denom = __c * __c + __d * __d;
+ _Tp __x = std::__constexpr_scalbn((__a * __c + __b * __d) / __denom, -__ilogbw);
+ _Tp __y = std::__constexpr_scalbn((__b * __c - __a * __d) / __denom, -__ilogbw);
+ if (std::__constexpr_isnan(__x) && std::__constexpr_isnan(__y)) {
+ if ((__denom == _Tp(0)) && (!std::__constexpr_isnan(__a) || !std::__constexpr_isnan(__b))) {
+ __x = std::__constexpr_copysign(_Tp(INFINITY), __c) * __a;
+ __y = std::__constexpr_copysign(_Tp(INFINITY), __c) * __b;
+ } else if ((std::__constexpr_isinf(__a) || std::__constexpr_isinf(__b)) && std::__constexpr_isfinite(__c) &&
+ std::__constexpr_isfinite(__d)) {
+ __a = std::__constexpr_copysign(std::__constexpr_isinf(__a) ? _Tp(1) : _Tp(0), __a);
+ __b = std::__constexpr_copysign(std::__constexpr_isinf(__b) ? _Tp(1) : _Tp(0), __b);
+ __x = _Tp(INFINITY) * (__a * __c + __b * __d);
+ __y = _Tp(INFINITY) * (__b * __c - __a * __d);
+ } else if (std::__constexpr_isinf(__logbw) && __logbw > _Tp(0) && std::__constexpr_isfinite(__a) &&
+ std::__constexpr_isfinite(__b)) {
+ __c = std::__constexpr_copysign(std::__constexpr_isinf(__c) ? _Tp(1) : _Tp(0), __c);
+ __d = std::__constexpr_copysign(std::__constexpr_isinf(__d) ? _Tp(1) : _Tp(0), __d);
+ __x = _Tp(0) * (__a * __c + __b * __d);
+ __y = _Tp(0) * (__b * __c - __a * __d);
+ }
+ }
+ return complex<_Tp>(__x, __y);
}
-template<class _Tp>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-complex<_Tp>
-operator/(const complex<_Tp>& __x, const _Tp& __y)
-{
- return complex<_Tp>(__x.real() / __y, __x.imag() / __y);
+template <class _Tp>
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex<_Tp>
+operator/(const complex<_Tp>& __x, const _Tp& __y) {
+ return complex<_Tp>(__x.real() / __y, __x.imag() / __y);
}
-template<class _Tp>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-complex<_Tp>
-operator/(const _Tp& __x, const complex<_Tp>& __y)
-{
- complex<_Tp> __t(__x);
- __t /= __y;
- return __t;
+template <class _Tp>
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex<_Tp>
+operator/(const _Tp& __x, const complex<_Tp>& __y) {
+ complex<_Tp> __t(__x);
+ __t /= __y;
+ return __t;
}
-template<class _Tp>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-complex<_Tp>
-operator+(const complex<_Tp>& __x)
-{
- return __x;
+template <class _Tp>
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex<_Tp> operator+(const complex<_Tp>& __x) {
+ return __x;
}
-template<class _Tp>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-complex<_Tp>
-operator-(const complex<_Tp>& __x)
-{
- return complex<_Tp>(-__x.real(), -__x.imag());
+template <class _Tp>
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex<_Tp> operator-(const complex<_Tp>& __x) {
+ return complex<_Tp>(-__x.real(), -__x.imag());
}
-template<class _Tp>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
-bool
-operator==(const complex<_Tp>& __x, const complex<_Tp>& __y)
-{
- return __x.real() == __y.real() && __x.imag() == __y.imag();
+template <class _Tp>
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 bool
+operator==(const complex<_Tp>& __x, const complex<_Tp>& __y) {
+ return __x.real() == __y.real() && __x.imag() == __y.imag();
}
-template<class _Tp>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
-bool
-operator==(const complex<_Tp>& __x, const _Tp& __y)
-{
- return __x.real() == __y && __x.imag() == 0;
+template <class _Tp>
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 bool operator==(const complex<_Tp>& __x, const _Tp& __y) {
+ return __x.real() == __y && __x.imag() == 0;
}
#if _LIBCPP_STD_VER <= 17
-template<class _Tp>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
-bool
-operator==(const _Tp& __x, const complex<_Tp>& __y)
-{
- return __x == __y.real() && 0 == __y.imag();
+template <class _Tp>
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 bool operator==(const _Tp& __x, const complex<_Tp>& __y) {
+ return __x == __y.real() && 0 == __y.imag();
}
-template<class _Tp>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
-bool
-operator!=(const complex<_Tp>& __x, const complex<_Tp>& __y)
-{
- return !(__x == __y);
+template <class _Tp>
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 bool
+operator!=(const complex<_Tp>& __x, const complex<_Tp>& __y) {
+ return !(__x == __y);
}
-template<class _Tp>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
-bool
-operator!=(const complex<_Tp>& __x, const _Tp& __y)
-{
- return !(__x == __y);
+template <class _Tp>
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 bool operator!=(const complex<_Tp>& __x, const _Tp& __y) {
+ return !(__x == __y);
}
-template<class _Tp>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
-bool
-operator!=(const _Tp& __x, const complex<_Tp>& __y)
-{
- return !(__x == __y);
+template <class _Tp>
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 bool operator!=(const _Tp& __x, const complex<_Tp>& __y) {
+ return !(__x == __y);
}
#endif
// 26.3.7 values:
-template <class _Tp, bool = is_integral<_Tp>::value,
- bool = is_floating_point<_Tp>::value
- >
+template <class _Tp, bool = is_integral<_Tp>::value, bool = is_floating_point<_Tp>::value >
struct __libcpp_complex_overload_traits {};
// Integral Types
template <class _Tp>
-struct __libcpp_complex_overload_traits<_Tp, true, false>
-{
- typedef double _ValueType;
- typedef complex<double> _ComplexType;
+struct __libcpp_complex_overload_traits<_Tp, true, false> {
+ typedef double _ValueType;
+ typedef complex<double> _ComplexType;
};
// Floating point types
template <class _Tp>
-struct __libcpp_complex_overload_traits<_Tp, false, true>
-{
- typedef _Tp _ValueType;
- typedef complex<_Tp> _ComplexType;
+struct __libcpp_complex_overload_traits<_Tp, false, true> {
+ typedef _Tp _ValueType;
+ typedef complex<_Tp> _ComplexType;
};
// real
-template<class _Tp>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
-_Tp
-real(const complex<_Tp>& __c)
-{
- return __c.real();
+template <class _Tp>
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _Tp real(const complex<_Tp>& __c) {
+ return __c.real();
}
template <class _Tp>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
-typename __libcpp_complex_overload_traits<_Tp>::_ValueType
-real(_Tp __re)
-{
- return __re;
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 typename __libcpp_complex_overload_traits<_Tp>::_ValueType
+real(_Tp __re) {
+ return __re;
}
// imag
-template<class _Tp>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
-_Tp
-imag(const complex<_Tp>& __c)
-{
- return __c.imag();
+template <class _Tp>
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _Tp imag(const complex<_Tp>& __c) {
+ return __c.imag();
}
template <class _Tp>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
-typename __libcpp_complex_overload_traits<_Tp>::_ValueType
-imag(_Tp)
-{
- return 0;
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 typename __libcpp_complex_overload_traits<_Tp>::_ValueType
+imag(_Tp) {
+ return 0;
}
// abs
-template<class _Tp>
-inline _LIBCPP_HIDE_FROM_ABI
-_Tp
-abs(const complex<_Tp>& __c)
-{
- return std::hypot(__c.real(), __c.imag());
+template <class _Tp>
+inline _LIBCPP_HIDE_FROM_ABI _Tp abs(const complex<_Tp>& __c) {
+ return std::hypot(__c.real(), __c.imag());
}
// arg
-template<class _Tp>
-inline _LIBCPP_HIDE_FROM_ABI
-_Tp
-arg(const complex<_Tp>& __c)
-{
- return std::atan2(__c.imag(), __c.real());
+template <class _Tp>
+inline _LIBCPP_HIDE_FROM_ABI _Tp arg(const complex<_Tp>& __c) {
+ return std::atan2(__c.imag(), __c.real());
}
template <class _Tp, __enable_if_t<is_same<_Tp, long double>::value, int> = 0>
-inline _LIBCPP_HIDE_FROM_ABI
-long double
-arg(_Tp __re)
-{
- return std::atan2l(0.L, __re);
+inline _LIBCPP_HIDE_FROM_ABI long double arg(_Tp __re) {
+ return std::atan2l(0.L, __re);
}
-template<class _Tp, __enable_if_t<is_integral<_Tp>::value || is_same<_Tp, double>::value, int> = 0>
-inline _LIBCPP_HIDE_FROM_ABI
-double
-arg(_Tp __re)
-{
- return std::atan2(0., __re);
+template <class _Tp, __enable_if_t<is_integral<_Tp>::value || is_same<_Tp, double>::value, int> = 0>
+inline _LIBCPP_HIDE_FROM_ABI double arg(_Tp __re) {
+ return std::atan2(0., __re);
}
template <class _Tp, __enable_if_t<is_same<_Tp, float>::value, int> = 0>
-inline _LIBCPP_HIDE_FROM_ABI
-float
-arg(_Tp __re)
-{
- return std::atan2f(0.F, __re);
+inline _LIBCPP_HIDE_FROM_ABI float arg(_Tp __re) {
+ return std::atan2f(0.F, __re);
}
// norm
-template<class _Tp>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-_Tp
-norm(const complex<_Tp>& __c)
-{
- if (std::__constexpr_isinf(__c.real()))
- return std::abs(__c.real());
- if (std::__constexpr_isinf(__c.imag()))
- return std::abs(__c.imag());
- return __c.real() * __c.real() + __c.imag() * __c.imag();
+template <class _Tp>
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _Tp norm(const complex<_Tp>& __c) {
+ if (std::__constexpr_isinf(__c.real()))
+ return std::abs(__c.real());
+ if (std::__constexpr_isinf(__c.imag()))
+ return std::abs(__c.imag());
+ return __c.real() * __c.real() + __c.imag() * __c.imag();
}
template <class _Tp>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-typename __libcpp_complex_overload_traits<_Tp>::_ValueType
-norm(_Tp __re)
-{
- typedef typename __libcpp_complex_overload_traits<_Tp>::_ValueType _ValueType;
- return static_cast<_ValueType>(__re) * __re;
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 typename __libcpp_complex_overload_traits<_Tp>::_ValueType
+norm(_Tp __re) {
+ typedef typename __libcpp_complex_overload_traits<_Tp>::_ValueType _ValueType;
+ return static_cast<_ValueType>(__re) * __re;
}
// conj
-template<class _Tp>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-complex<_Tp>
-conj(const complex<_Tp>& __c)
-{
- return complex<_Tp>(__c.real(), -__c.imag());
+template <class _Tp>
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex<_Tp> conj(const complex<_Tp>& __c) {
+ return complex<_Tp>(__c.real(), -__c.imag());
}
template <class _Tp>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-typename __libcpp_complex_overload_traits<_Tp>::_ComplexType
-conj(_Tp __re)
-{
- typedef typename __libcpp_complex_overload_traits<_Tp>::_ComplexType _ComplexType;
- return _ComplexType(__re);
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 typename __libcpp_complex_overload_traits<_Tp>::_ComplexType
+conj(_Tp __re) {
+ typedef typename __libcpp_complex_overload_traits<_Tp>::_ComplexType _ComplexType;
+ return _ComplexType(__re);
}
-
-
// proj
-template<class _Tp>
-inline _LIBCPP_HIDE_FROM_ABI
-complex<_Tp>
-proj(const complex<_Tp>& __c)
-{
- complex<_Tp> __r = __c;
- if (std::__constexpr_isinf(__c.real()) || std::__constexpr_isinf(__c.imag()))
- __r = complex<_Tp>(INFINITY, std::copysign(_Tp(0), __c.imag()));
- return __r;
+template <class _Tp>
+inline _LIBCPP_HIDE_FROM_ABI complex<_Tp> proj(const complex<_Tp>& __c) {
+ complex<_Tp> __r = __c;
+ if (std::__constexpr_isinf(__c.real()) || std::__constexpr_isinf(__c.imag()))
+ __r = complex<_Tp>(INFINITY, std::copysign(_Tp(0), __c.imag()));
+ return __r;
}
template <class _Tp, __enable_if_t<is_floating_point<_Tp>::value, int> = 0>
-inline _LIBCPP_HIDE_FROM_ABI
-typename __libcpp_complex_overload_traits<_Tp>::_ComplexType
-proj(_Tp __re)
-{
- if (std::__constexpr_isinf(__re))
- __re = std::abs(__re);
- return complex<_Tp>(__re);
+inline _LIBCPP_HIDE_FROM_ABI typename __libcpp_complex_overload_traits<_Tp>::_ComplexType proj(_Tp __re) {
+ if (std::__constexpr_isinf(__re))
+ __re = std::abs(__re);
+ return complex<_Tp>(__re);
}
template <class _Tp, __enable_if_t<is_integral<_Tp>::value, int> = 0>
-inline _LIBCPP_HIDE_FROM_ABI
-typename __libcpp_complex_overload_traits<_Tp>::_ComplexType
-proj(_Tp __re)
-{
- typedef typename __libcpp_complex_overload_traits<_Tp>::_ComplexType _ComplexType;
- return _ComplexType(__re);
+inline _LIBCPP_HIDE_FROM_ABI typename __libcpp_complex_overload_traits<_Tp>::_ComplexType proj(_Tp __re) {
+ typedef typename __libcpp_complex_overload_traits<_Tp>::_ComplexType _ComplexType;
+ return _ComplexType(__re);
}
// polar
-template<class _Tp>
-_LIBCPP_HIDE_FROM_ABI complex<_Tp>
-polar(const _Tp& __rho, const _Tp& __theta = _Tp())
-{
- if (std::__constexpr_isnan(__rho) || std::signbit(__rho))
- return complex<_Tp>(_Tp(NAN), _Tp(NAN));
- if (std::__constexpr_isnan(__theta))
- {
- if (std::__constexpr_isinf(__rho))
- return complex<_Tp>(__rho, __theta);
- return complex<_Tp>(__theta, __theta);
- }
- if (std::__constexpr_isinf(__theta))
- {
- if (std::__constexpr_isinf(__rho))
- return complex<_Tp>(__rho, _Tp(NAN));
- return complex<_Tp>(_Tp(NAN), _Tp(NAN));
- }
- _Tp __x = __rho * std::cos(__theta);
- if (std::__constexpr_isnan(__x))
- __x = 0;
- _Tp __y = __rho * std::sin(__theta);
- if (std::__constexpr_isnan(__y))
- __y = 0;
- return complex<_Tp>(__x, __y);
+template <class _Tp>
+_LIBCPP_HIDE_FROM_ABI complex<_Tp> polar(const _Tp& __rho, const _Tp& __theta = _Tp()) {
+ if (std::__constexpr_isnan(__rho) || std::signbit(__rho))
+ return complex<_Tp>(_Tp(NAN), _Tp(NAN));
+ if (std::__constexpr_isnan(__theta)) {
+ if (std::__constexpr_isinf(__rho))
+ return complex<_Tp>(__rho, __theta);
+ return complex<_Tp>(__theta, __theta);
+ }
+ if (std::__constexpr_isinf(__theta)) {
+ if (std::__constexpr_isinf(__rho))
+ return complex<_Tp>(__rho, _Tp(NAN));
+ return complex<_Tp>(_Tp(NAN), _Tp(NAN));
+ }
+ _Tp __x = __rho * std::cos(__theta);
+ if (std::__constexpr_isnan(__x))
+ __x = 0;
+ _Tp __y = __rho * std::sin(__theta);
+ if (std::__constexpr_isnan(__y))
+ __y = 0;
+ return complex<_Tp>(__x, __y);
}
// log
-template<class _Tp>
-inline _LIBCPP_HIDE_FROM_ABI
-complex<_Tp>
-log(const complex<_Tp>& __x)
-{
- return complex<_Tp>(std::log(std::abs(__x)), std::arg(__x));
+template <class _Tp>
+inline _LIBCPP_HIDE_FROM_ABI complex<_Tp> log(const complex<_Tp>& __x) {
+ return complex<_Tp>(std::log(std::abs(__x)), std::arg(__x));
}
// log10
-template<class _Tp>
-inline _LIBCPP_HIDE_FROM_ABI
-complex<_Tp>
-log10(const complex<_Tp>& __x)
-{
- return std::log(__x) / std::log(_Tp(10));
+template <class _Tp>
+inline _LIBCPP_HIDE_FROM_ABI complex<_Tp> log10(const complex<_Tp>& __x) {
+ return std::log(__x) / std::log(_Tp(10));
}
// sqrt
-template<class _Tp>
-_LIBCPP_HIDE_FROM_ABI complex<_Tp>
-sqrt(const complex<_Tp>& __x)
-{
- if (std::__constexpr_isinf(__x.imag()))
- return complex<_Tp>(_Tp(INFINITY), __x.imag());
- if (std::__constexpr_isinf(__x.real()))
- {
- if (__x.real() > _Tp(0))
- return complex<_Tp>(__x.real(), std::__constexpr_isnan(__x.imag()) ? __x.imag() : std::copysign(_Tp(0), __x.imag()));
- return complex<_Tp>(std::__constexpr_isnan(__x.imag()) ? __x.imag() : _Tp(0), std::copysign(__x.real(), __x.imag()));
- }
- return std::polar(std::sqrt(std::abs(__x)), std::arg(__x) / _Tp(2));
+template <class _Tp>
+_LIBCPP_HIDE_FROM_ABI complex<_Tp> sqrt(const complex<_Tp>& __x) {
+ if (std::__constexpr_isinf(__x.imag()))
+ return complex<_Tp>(_Tp(INFINITY), __x.imag());
+ if (std::__constexpr_isinf(__x.real())) {
+ if (__x.real() > _Tp(0))
+ return complex<_Tp>(
+ __x.real(), std::__constexpr_isnan(__x.imag()) ? __x.imag() : std::copysign(_Tp(0), __x.imag()));
+ return complex<_Tp>(
+ std::__constexpr_isnan(__x.imag()) ? __x.imag() : _Tp(0), std::copysign(__x.real(), __x.imag()));
+ }
+ return std::polar(std::sqrt(std::abs(__x)), std::arg(__x) / _Tp(2));
}
// exp
-template<class _Tp>
-_LIBCPP_HIDE_FROM_ABI complex<_Tp>
-exp(const complex<_Tp>& __x)
-{
- _Tp __i = __x.imag();
- if (__i == 0) {
- return complex<_Tp>(std::exp(__x.real()), std::copysign(_Tp(0), __x.imag()));
- }
- if (std::__constexpr_isinf(__x.real()))
- {
- if (__x.real() < _Tp(0))
- {
- if (!std::__constexpr_isfinite(__i))
- __i = _Tp(1);
- }
- else if (__i == 0 || !std::__constexpr_isfinite(__i))
- {
- if (std::__constexpr_isinf(__i))
- __i = _Tp(NAN);
- return complex<_Tp>(__x.real(), __i);
- }
+template <class _Tp>
+_LIBCPP_HIDE_FROM_ABI complex<_Tp> exp(const complex<_Tp>& __x) {
+ _Tp __i = __x.imag();
+ if (__i == 0) {
+ return complex<_Tp>(std::exp(__x.real()), std::copysign(_Tp(0), __x.imag()));
+ }
+ if (std::__constexpr_isinf(__x.real())) {
+ if (__x.real() < _Tp(0)) {
+ if (!std::__constexpr_isfinite(__i))
+ __i = _Tp(1);
+ } else if (__i == 0 || !std::__constexpr_isfinite(__i)) {
+ if (std::__constexpr_isinf(__i))
+ __i = _Tp(NAN);
+ return complex<_Tp>(__x.real(), __i);
}
- _Tp __e = std::exp(__x.real());
- return complex<_Tp>(__e * std::cos(__i), __e * std::sin(__i));
+ }
+ _Tp __e = std::exp(__x.real());
+ return complex<_Tp>(__e * std::cos(__i), __e * std::sin(__i));
}
// pow
-template<class _Tp>
-inline _LIBCPP_HIDE_FROM_ABI
-complex<_Tp>
-pow(const complex<_Tp>& __x, const complex<_Tp>& __y)
-{
- return std::exp(__y * std::log(__x));
+template <class _Tp>
+inline _LIBCPP_HIDE_FROM_ABI complex<_Tp> pow(const complex<_Tp>& __x, const complex<_Tp>& __y) {
+ return std::exp(__y * std::log(__x));
}
-template<class _Tp, class _Up>
-inline _LIBCPP_HIDE_FROM_ABI
-complex<typename __promote<_Tp, _Up>::type>
-pow(const complex<_Tp>& __x, const complex<_Up>& __y)
-{
- typedef complex<typename __promote<_Tp, _Up>::type> result_type;
- return std::pow(result_type(__x), result_type(__y));
+template <class _Tp, class _Up>
+inline _LIBCPP_HIDE_FROM_ABI complex<typename __promote<_Tp, _Up>::type>
+pow(const complex<_Tp>& __x, const complex<_Up>& __y) {
+ typedef complex<typename __promote<_Tp, _Up>::type> result_type;
+ return std::pow(result_type(__x), result_type(__y));
}
-template<class _Tp, class _Up, __enable_if_t<is_arithmetic<_Up>::value, int> = 0>
-inline _LIBCPP_HIDE_FROM_ABI
-complex<typename __promote<_Tp, _Up>::type>
-pow(const complex<_Tp>& __x, const _Up& __y)
-{
- typedef complex<typename __promote<_Tp, _Up>::type> result_type;
- return std::pow(result_type(__x), result_type(__y));
+template <class _Tp, class _Up, __enable_if_t<is_arithmetic<_Up>::value, int> = 0>
+inline _LIBCPP_HIDE_FROM_ABI complex<typename __promote<_Tp, _Up>::type> pow(const complex<_Tp>& __x, const _Up& __y) {
+ typedef complex<typename __promote<_Tp, _Up>::type> result_type;
+ return std::pow(result_type(__x), result_type(__y));
}
-template<class _Tp, class _Up, __enable_if_t<is_arithmetic<_Tp>::value, int> = 0>
-inline _LIBCPP_HIDE_FROM_ABI
-complex<typename __promote<_Tp, _Up>::type>
-pow(const _Tp& __x, const complex<_Up>& __y)
-{
- typedef complex<typename __promote<_Tp, _Up>::type> result_type;
- return std::pow(result_type(__x), result_type(__y));
+template <class _Tp, class _Up, __enable_if_t<is_arithmetic<_Tp>::value, int> = 0>
+inline _LIBCPP_HIDE_FROM_ABI complex<typename __promote<_Tp, _Up>::type> pow(const _Tp& __x, const complex<_Up>& __y) {
+ typedef complex<typename __promote<_Tp, _Up>::type> result_type;
+ return std::pow(result_type(__x), result_type(__y));
}
// __sqr, computes pow(x, 2)
-template<class _Tp>
-inline _LIBCPP_HIDE_FROM_ABI
-complex<_Tp>
-__sqr(const complex<_Tp>& __x)
-{
- return complex<_Tp>((__x.real() - __x.imag()) * (__x.real() + __x.imag()),
- _Tp(2) * __x.real() * __x.imag());
+template <class _Tp>
+inline _LIBCPP_HIDE_FROM_ABI complex<_Tp> __sqr(const complex<_Tp>& __x) {
+ return complex<_Tp>((__x.real() - __x.imag()) * (__x.real() + __x.imag()), _Tp(2) * __x.real() * __x.imag());
}
// asinh
-template<class _Tp>
-_LIBCPP_HIDE_FROM_ABI complex<_Tp>
-asinh(const complex<_Tp>& __x)
-{
- const _Tp __pi(atan2(+0., -0.));
- if (std::__constexpr_isinf(__x.real()))
- {
- if (std::__constexpr_isnan(__x.imag()))
- return __x;
- if (std::__constexpr_isinf(__x.imag()))
- return complex<_Tp>(__x.real(), std::copysign(__pi * _Tp(0.25), __x.imag()));
- return complex<_Tp>(__x.real(), std::copysign(_Tp(0), __x.imag()));
- }
- if (std::__constexpr_isnan(__x.real()))
- {
- if (std::__constexpr_isinf(__x.imag()))
- return complex<_Tp>(__x.imag(), __x.real());
- if (__x.imag() == 0)
- return __x;
- return complex<_Tp>(__x.real(), __x.real());
- }
+template <class _Tp>
+_LIBCPP_HIDE_FROM_ABI complex<_Tp> asinh(const complex<_Tp>& __x) {
+ const _Tp __pi(atan2(+0., -0.));
+ if (std::__constexpr_isinf(__x.real())) {
+ if (std::__constexpr_isnan(__x.imag()))
+ return __x;
+ if (std::__constexpr_isinf(__x.imag()))
+ return complex<_Tp>(__x.real(), std::copysign(__pi * _Tp(0.25), __x.imag()));
+ return complex<_Tp>(__x.real(), std::copysign(_Tp(0), __x.imag()));
+ }
+ if (std::__constexpr_isnan(__x.real())) {
if (std::__constexpr_isinf(__x.imag()))
- return complex<_Tp>(std::copysign(__x.imag(), __x.real()), std::copysign(__pi/_Tp(2), __x.imag()));
- complex<_Tp> __z = std::log(__x + std::sqrt(std::__sqr(__x) + _Tp(1)));
- return complex<_Tp>(std::copysign(__z.real(), __x.real()), std::copysign(__z.imag(), __x.imag()));
+ return complex<_Tp>(__x.imag(), __x.real());
+ if (__x.imag() == 0)
+ return __x;
+ return complex<_Tp>(__x.real(), __x.real());
+ }
+ if (std::__constexpr_isinf(__x.imag()))
+ return complex<_Tp>(std::copysign(__x.imag(), __x.real()), std::copysign(__pi / _Tp(2), __x.imag()));
+ complex<_Tp> __z = std::log(__x + std::sqrt(std::__sqr(__x) + _Tp(1)));
+ return complex<_Tp>(std::copysign(__z.real(), __x.real()), std::copysign(__z.imag(), __x.imag()));
}
// acosh
-template<class _Tp>
-_LIBCPP_HIDE_FROM_ABI complex<_Tp>
-acosh(const complex<_Tp>& __x)
-{
- const _Tp __pi(atan2(+0., -0.));
- if (std::__constexpr_isinf(__x.real()))
- {
- if (std::__constexpr_isnan(__x.imag()))
- return complex<_Tp>(std::abs(__x.real()), __x.imag());
- if (std::__constexpr_isinf(__x.imag()))
- {
- if (__x.real() > 0)
- return complex<_Tp>(__x.real(), std::copysign(__pi * _Tp(0.25), __x.imag()));
- else
- return complex<_Tp>(-__x.real(), std::copysign(__pi * _Tp(0.75), __x.imag()));
- }
- if (__x.real() < 0)
- return complex<_Tp>(-__x.real(), std::copysign(__pi, __x.imag()));
- return complex<_Tp>(__x.real(), std::copysign(_Tp(0), __x.imag()));
- }
- if (std::__constexpr_isnan(__x.real()))
- {
- if (std::__constexpr_isinf(__x.imag()))
- return complex<_Tp>(std::abs(__x.imag()), __x.real());
- return complex<_Tp>(__x.real(), __x.real());
+template <class _Tp>
+_LIBCPP_HIDE_FROM_ABI complex<_Tp> acosh(const complex<_Tp>& __x) {
+ const _Tp __pi(atan2(+0., -0.));
+ if (std::__constexpr_isinf(__x.real())) {
+ if (std::__constexpr_isnan(__x.imag()))
+ return complex<_Tp>(std::abs(__x.real()), __x.imag());
+ if (std::__constexpr_isinf(__x.imag())) {
+ if (__x.real() > 0)
+ return complex<_Tp>(__x.real(), std::copysign(__pi * _Tp(0.25), __x.imag()));
+ else
+ return complex<_Tp>(-__x.real(), std::copysign(__pi * _Tp(0.75), __x.imag()));
}
+ if (__x.real() < 0)
+ return complex<_Tp>(-__x.real(), std::copysign(__pi, __x.imag()));
+ return complex<_Tp>(__x.real(), std::copysign(_Tp(0), __x.imag()));
+ }
+ if (std::__constexpr_isnan(__x.real())) {
if (std::__constexpr_isinf(__x.imag()))
- return complex<_Tp>(std::abs(__x.imag()), std::copysign(__pi/_Tp(2), __x.imag()));
- complex<_Tp> __z = std::log(__x + std::sqrt(std::__sqr(__x) - _Tp(1)));
- return complex<_Tp>(std::copysign(__z.real(), _Tp(0)), std::copysign(__z.imag(), __x.imag()));
+ return complex<_Tp>(std::abs(__x.imag()), __x.real());
+ return complex<_Tp>(__x.real(), __x.real());
+ }
+ if (std::__constexpr_isinf(__x.imag()))
+ return complex<_Tp>(std::abs(__x.imag()), std::copysign(__pi / _Tp(2), __x.imag()));
+ complex<_Tp> __z = std::log(__x + std::sqrt(std::__sqr(__x) - _Tp(1)));
+ return complex<_Tp>(std::copysign(__z.real(), _Tp(0)), std::copysign(__z.imag(), __x.imag()));
}
// atanh
-template<class _Tp>
-_LIBCPP_HIDE_FROM_ABI complex<_Tp>
-atanh(const complex<_Tp>& __x)
-{
- const _Tp __pi(atan2(+0., -0.));
- if (std::__constexpr_isinf(__x.imag()))
- {
- return complex<_Tp>(std::copysign(_Tp(0), __x.real()), std::copysign(__pi/_Tp(2), __x.imag()));
- }
- if (std::__constexpr_isnan(__x.imag()))
- {
- if (std::__constexpr_isinf(__x.real()) || __x.real() == 0)
- return complex<_Tp>(std::copysign(_Tp(0), __x.real()), __x.imag());
- return complex<_Tp>(__x.imag(), __x.imag());
- }
- if (std::__constexpr_isnan(__x.real()))
- {
- return complex<_Tp>(__x.real(), __x.real());
- }
- if (std::__constexpr_isinf(__x.real()))
- {
- return complex<_Tp>(std::copysign(_Tp(0), __x.real()), std::copysign(__pi/_Tp(2), __x.imag()));
- }
- if (std::abs(__x.real()) == _Tp(1) && __x.imag() == _Tp(0))
- {
- return complex<_Tp>(std::copysign(_Tp(INFINITY), __x.real()), std::copysign(_Tp(0), __x.imag()));
- }
- complex<_Tp> __z = std::log((_Tp(1) + __x) / (_Tp(1) - __x)) / _Tp(2);
- return complex<_Tp>(std::copysign(__z.real(), __x.real()), std::copysign(__z.imag(), __x.imag()));
+template <class _Tp>
+_LIBCPP_HIDE_FROM_ABI complex<_Tp> atanh(const complex<_Tp>& __x) {
+ const _Tp __pi(atan2(+0., -0.));
+ if (std::__constexpr_isinf(__x.imag())) {
+ return complex<_Tp>(std::copysign(_Tp(0), __x.real()), std::copysign(__pi / _Tp(2), __x.imag()));
+ }
+ if (std::__constexpr_isnan(__x.imag())) {
+ if (std::__constexpr_isinf(__x.real()) || __x.real() == 0)
+ return complex<_Tp>(std::copysign(_Tp(0), __x.real()), __x.imag());
+ return complex<_Tp>(__x.imag(), __x.imag());
+ }
+ if (std::__constexpr_isnan(__x.real())) {
+ return complex<_Tp>(__x.real(), __x.real());
+ }
+ if (std::__constexpr_isinf(__x.real())) {
+ return complex<_Tp>(std::copysign(_Tp(0), __x.real()), std::copysign(__pi / _Tp(2), __x.imag()));
+ }
+ if (std::abs(__x.real()) == _Tp(1) && __x.imag() == _Tp(0)) {
+ return complex<_Tp>(std::copysign(_Tp(INFINITY), __x.real()), std::copysign(_Tp(0), __x.imag()));
+ }
+ complex<_Tp> __z = std::log((_Tp(1) + __x) / (_Tp(1) - __x)) / _Tp(2);
+ return complex<_Tp>(std::copysign(__z.real(), __x.real()), std::copysign(__z.imag(), __x.imag()));
}
// sinh
-template<class _Tp>
-_LIBCPP_HIDE_FROM_ABI complex<_Tp>
-sinh(const complex<_Tp>& __x)
-{
- if (std::__constexpr_isinf(__x.real()) && !std::__constexpr_isfinite(__x.imag()))
- return complex<_Tp>(__x.real(), _Tp(NAN));
- if (__x.real() == 0 && !std::__constexpr_isfinite(__x.imag()))
- return complex<_Tp>(__x.real(), _Tp(NAN));
- if (__x.imag() == 0 && !std::__constexpr_isfinite(__x.real()))
- return __x;
- return complex<_Tp>(std::sinh(__x.real()) * std::cos(__x.imag()), std::cosh(__x.real()) * std::sin(__x.imag()));
+template <class _Tp>
+_LIBCPP_HIDE_FROM_ABI complex<_Tp> sinh(const complex<_Tp>& __x) {
+ if (std::__constexpr_isinf(__x.real()) && !std::__constexpr_isfinite(__x.imag()))
+ return complex<_Tp>(__x.real(), _Tp(NAN));
+ if (__x.real() == 0 && !std::__constexpr_isfinite(__x.imag()))
+ return complex<_Tp>(__x.real(), _Tp(NAN));
+ if (__x.imag() == 0 && !std::__constexpr_isfinite(__x.real()))
+ return __x;
+ return complex<_Tp>(std::sinh(__x.real()) * std::cos(__x.imag()), std::cosh(__x.real()) * std::sin(__x.imag()));
}
// cosh
-template<class _Tp>
-_LIBCPP_HIDE_FROM_ABI complex<_Tp>
-cosh(const complex<_Tp>& __x)
-{
- if (std::__constexpr_isinf(__x.real()) && !std::__constexpr_isfinite(__x.imag()))
- return complex<_Tp>(std::abs(__x.real()), _Tp(NAN));
- if (__x.real() == 0 && !std::__constexpr_isfinite(__x.imag()))
- return complex<_Tp>(_Tp(NAN), __x.real());
- if (__x.real() == 0 && __x.imag() == 0)
- return complex<_Tp>(_Tp(1), __x.imag());
- if (__x.imag() == 0 && !std::__constexpr_isfinite(__x.real()))
- return complex<_Tp>(std::abs(__x.real()), __x.imag());
- return complex<_Tp>(std::cosh(__x.real()) * std::cos(__x.imag()), std::sinh(__x.real()) * std::sin(__x.imag()));
+template <class _Tp>
+_LIBCPP_HIDE_FROM_ABI complex<_Tp> cosh(const complex<_Tp>& __x) {
+ if (std::__constexpr_isinf(__x.real()) && !std::__constexpr_isfinite(__x.imag()))
+ return complex<_Tp>(std::abs(__x.real()), _Tp(NAN));
+ if (__x.real() == 0 && !std::__constexpr_isfinite(__x.imag()))
+ return complex<_Tp>(_Tp(NAN), __x.real());
+ if (__x.real() == 0 && __x.imag() == 0)
+ return complex<_Tp>(_Tp(1), __x.imag());
+ if (__x.imag() == 0 && !std::__constexpr_isfinite(__x.real()))
+ return complex<_Tp>(std::abs(__x.real()), __x.imag());
+ return complex<_Tp>(std::cosh(__x.real()) * std::cos(__x.imag()), std::sinh(__x.real()) * std::sin(__x.imag()));
}
// tanh
-template<class _Tp>
-_LIBCPP_HIDE_FROM_ABI complex<_Tp>
-tanh(const complex<_Tp>& __x)
-{
- if (std::__constexpr_isinf(__x.real()))
- {
- if (!std::__constexpr_isfinite(__x.imag()))
- return complex<_Tp>(std::copysign(_Tp(1), __x.real()), _Tp(0));
- return complex<_Tp>(std::copysign(_Tp(1), __x.real()), std::copysign(_Tp(0), std::sin(_Tp(2) * __x.imag())));
- }
- if (std::__constexpr_isnan(__x.real()) && __x.imag() == 0)
- return __x;
- _Tp __2r(_Tp(2) * __x.real());
- _Tp __2i(_Tp(2) * __x.imag());
- _Tp __d(std::cosh(__2r) + std::cos(__2i));
- _Tp __2rsh(std::sinh(__2r));
- if (std::__constexpr_isinf(__2rsh) && std::__constexpr_isinf(__d))
- return complex<_Tp>(__2rsh > _Tp(0) ? _Tp(1) : _Tp(-1),
- __2i > _Tp(0) ? _Tp(0) : _Tp(-0.));
- return complex<_Tp>(__2rsh/__d, std::sin(__2i)/__d);
+template <class _Tp>
+_LIBCPP_HIDE_FROM_ABI complex<_Tp> tanh(const complex<_Tp>& __x) {
+ if (std::__constexpr_isinf(__x.real())) {
+ if (!std::__constexpr_isfinite(__x.imag()))
+ return complex<_Tp>(std::copysign(_Tp(1), __x.real()), _Tp(0));
+ return complex<_Tp>(std::copysign(_Tp(1), __x.real()), std::copysign(_Tp(0), std::sin(_Tp(2) * __x.imag())));
+ }
+ if (std::__constexpr_isnan(__x.real()) && __x.imag() == 0)
+ return __x;
+ _Tp __2r(_Tp(2) * __x.real());
+ _Tp __2i(_Tp(2) * __x.imag());
+ _Tp __d(std::cosh(__2r) + std::cos(__2i));
+ _Tp __2rsh(std::sinh(__2r));
+ if (std::__constexpr_isinf(__2rsh) && std::__constexpr_isinf(__d))
+ return complex<_Tp>(__2rsh > _Tp(0) ? _Tp(1) : _Tp(-1), __2i > _Tp(0) ? _Tp(0) : _Tp(-0.));
+ return complex<_Tp>(__2rsh / __d, std::sin(__2i) / __d);
}
// asin
-template<class _Tp>
-_LIBCPP_HIDE_FROM_ABI complex<_Tp>
-asin(const complex<_Tp>& __x)
-{
- complex<_Tp> __z = std::asinh(complex<_Tp>(-__x.imag(), __x.real()));
- return complex<_Tp>(__z.imag(), -__z.real());
+template <class _Tp>
+_LIBCPP_HIDE_FROM_ABI complex<_Tp> asin(const complex<_Tp>& __x) {
+ complex<_Tp> __z = std::asinh(complex<_Tp>(-__x.imag(), __x.real()));
+ return complex<_Tp>(__z.imag(), -__z.real());
}
// acos
-template<class _Tp>
-_LIBCPP_HIDE_FROM_ABI complex<_Tp>
-acos(const complex<_Tp>& __x)
-{
- const _Tp __pi(atan2(+0., -0.));
- if (std::__constexpr_isinf(__x.real()))
- {
- if (std::__constexpr_isnan(__x.imag()))
- return complex<_Tp>(__x.imag(), __x.real());
- if (std::__constexpr_isinf(__x.imag()))
- {
- if (__x.real() < _Tp(0))
- return complex<_Tp>(_Tp(0.75) * __pi, -__x.imag());
- return complex<_Tp>(_Tp(0.25) * __pi, -__x.imag());
- }
- if (__x.real() < _Tp(0))
- return complex<_Tp>(__pi, std::signbit(__x.imag()) ? -__x.real() : __x.real());
- return complex<_Tp>(_Tp(0), std::signbit(__x.imag()) ? __x.real() : -__x.real());
- }
- if (std::__constexpr_isnan(__x.real()))
- {
- if (std::__constexpr_isinf(__x.imag()))
- return complex<_Tp>(__x.real(), -__x.imag());
- return complex<_Tp>(__x.real(), __x.real());
+template <class _Tp>
+_LIBCPP_HIDE_FROM_ABI complex<_Tp> acos(const complex<_Tp>& __x) {
+ const _Tp __pi(atan2(+0., -0.));
+ if (std::__constexpr_isinf(__x.real())) {
+ if (std::__constexpr_isnan(__x.imag()))
+ return complex<_Tp>(__x.imag(), __x.real());
+ if (std::__constexpr_isinf(__x.imag())) {
+ if (__x.real() < _Tp(0))
+ return complex<_Tp>(_Tp(0.75) * __pi, -__x.imag());
+ return complex<_Tp>(_Tp(0.25) * __pi, -__x.imag());
}
+ if (__x.real() < _Tp(0))
+ return complex<_Tp>(__pi, std::signbit(__x.imag()) ? -__x.real() : __x.real());
+ return complex<_Tp>(_Tp(0), std::signbit(__x.imag()) ? __x.real() : -__x.real());
+ }
+ if (std::__constexpr_isnan(__x.real())) {
if (std::__constexpr_isinf(__x.imag()))
- return complex<_Tp>(__pi/_Tp(2), -__x.imag());
- if (__x.real() == 0 && (__x.imag() == 0 || std::isnan(__x.imag())))
- return complex<_Tp>(__pi/_Tp(2), -__x.imag());
- complex<_Tp> __z = std::log(__x + std::sqrt(std::__sqr(__x) - _Tp(1)));
- if (std::signbit(__x.imag()))
- return complex<_Tp>(std::abs(__z.imag()), std::abs(__z.real()));
- return complex<_Tp>(std::abs(__z.imag()), -std::abs(__z.real()));
+ return complex<_Tp>(__x.real(), -__x.imag());
+ return complex<_Tp>(__x.real(), __x.real());
+ }
+ if (std::__constexpr_isinf(__x.imag()))
+ return complex<_Tp>(__pi / _Tp(2), -__x.imag());
+ if (__x.real() == 0 && (__x.imag() == 0 || std::isnan(__x.imag())))
+ return complex<_Tp>(__pi / _Tp(2), -__x.imag());
+ complex<_Tp> __z = std::log(__x + std::sqrt(std::__sqr(__x) - _Tp(1)));
+ if (std::signbit(__x.imag()))
+ return complex<_Tp>(std::abs(__z.imag()), std::abs(__z.real()));
+ return complex<_Tp>(std::abs(__z.imag()), -std::abs(__z.real()));
}
// atan
-template<class _Tp>
-_LIBCPP_HIDE_FROM_ABI complex<_Tp>
-atan(const complex<_Tp>& __x)
-{
- complex<_Tp> __z = std::atanh(complex<_Tp>(-__x.imag(), __x.real()));
- return complex<_Tp>(__z.imag(), -__z.real());
+template <class _Tp>
+_LIBCPP_HIDE_FROM_ABI complex<_Tp> atan(const complex<_Tp>& __x) {
+ complex<_Tp> __z = std::atanh(complex<_Tp>(-__x.imag(), __x.real()));
+ return complex<_Tp>(__z.imag(), -__z.real());
}
// sin
-template<class _Tp>
-_LIBCPP_HIDE_FROM_ABI complex<_Tp>
-sin(const complex<_Tp>& __x)
-{
- complex<_Tp> __z = std::sinh(complex<_Tp>(-__x.imag(), __x.real()));
- return complex<_Tp>(__z.imag(), -__z.real());
+template <class _Tp>
+_LIBCPP_HIDE_FROM_ABI complex<_Tp> sin(const complex<_Tp>& __x) {
+ complex<_Tp> __z = std::sinh(complex<_Tp>(-__x.imag(), __x.real()));
+ return complex<_Tp>(__z.imag(), -__z.real());
}
// cos
-template<class _Tp>
-inline _LIBCPP_HIDE_FROM_ABI
-complex<_Tp>
-cos(const complex<_Tp>& __x)
-{
- return std::cosh(complex<_Tp>(-__x.imag(), __x.real()));
+template <class _Tp>
+inline _LIBCPP_HIDE_FROM_ABI complex<_Tp> cos(const complex<_Tp>& __x) {
+ return std::cosh(complex<_Tp>(-__x.imag(), __x.real()));
}
// tan
-template<class _Tp>
-_LIBCPP_HIDE_FROM_ABI complex<_Tp>
-tan(const complex<_Tp>& __x)
-{
- complex<_Tp> __z = std::tanh(complex<_Tp>(-__x.imag(), __x.real()));
- return complex<_Tp>(__z.imag(), -__z.real());
+template <class _Tp>
+_LIBCPP_HIDE_FROM_ABI complex<_Tp> tan(const complex<_Tp>& __x) {
+ complex<_Tp> __z = std::tanh(complex<_Tp>(-__x.imag(), __x.real()));
+ return complex<_Tp>(__z.imag(), -__z.real());
}
#if !defined(_LIBCPP_HAS_NO_LOCALIZATION)
-template<class _Tp, class _CharT, class _Traits>
+template <class _Tp, class _CharT, class _Traits>
_LIBCPP_HIDE_FROM_ABI basic_istream<_CharT, _Traits>&
-operator>>(basic_istream<_CharT, _Traits>& __is, complex<_Tp>& __x)
-{
- if (__is.good())
- {
+operator>>(basic_istream<_CharT, _Traits>& __is, complex<_Tp>& __x) {
+ if (__is.good()) {
+ std::ws(__is);
+ if (__is.peek() == _CharT('(')) {
+ __is.get();
+ _Tp __r;
+ __is >> __r;
+ if (!__is.fail()) {
std::ws(__is);
- if (__is.peek() == _CharT('('))
- {
- __is.get();
- _Tp __r;
- __is >> __r;
- if (!__is.fail())
- {
- std::ws(__is);
- _CharT __c = __is.peek();
- if (__c == _CharT(','))
- {
- __is.get();
- _Tp __i;
- __is >> __i;
- if (!__is.fail())
- {
- std::ws(__is);
- __c = __is.peek();
- if (__c == _CharT(')'))
- {
- __is.get();
- __x = complex<_Tp>(__r, __i);
- }
- else
- __is.setstate(__is.failbit);
- }
- else
- __is.setstate(__is.failbit);
- }
- else if (__c == _CharT(')'))
- {
- __is.get();
- __x = complex<_Tp>(__r, _Tp(0));
- }
- else
- __is.setstate(__is.failbit);
- }
- else
- __is.setstate(__is.failbit);
- }
- else
- {
- _Tp __r;
- __is >> __r;
- if (!__is.fail())
- __x = complex<_Tp>(__r, _Tp(0));
- else
- __is.setstate(__is.failbit);
- }
- }
- else
+ _CharT __c = __is.peek();
+ if (__c == _CharT(',')) {
+ __is.get();
+ _Tp __i;
+ __is >> __i;
+ if (!__is.fail()) {
+ std::ws(__is);
+ __c = __is.peek();
+ if (__c == _CharT(')')) {
+ __is.get();
+ __x = complex<_Tp>(__r, __i);
+ } else
+ __is.setstate(__is.failbit);
+ } else
+ __is.setstate(__is.failbit);
+ } else if (__c == _CharT(')')) {
+ __is.get();
+ __x = complex<_Tp>(__r, _Tp(0));
+ } else
+ __is.setstate(__is.failbit);
+ } else
__is.setstate(__is.failbit);
- return __is;
+ } else {
+ _Tp __r;
+ __is >> __r;
+ if (!__is.fail())
+ __x = complex<_Tp>(__r, _Tp(0));
+ else
+ __is.setstate(__is.failbit);
+ }
+ } else
+ __is.setstate(__is.failbit);
+ return __is;
}
-template<class _Tp, class _CharT, class _Traits>
+template <class _Tp, class _CharT, class _Traits>
_LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>&
-operator<<(basic_ostream<_CharT, _Traits>& __os, const complex<_Tp>& __x)
-{
- basic_ostringstream<_CharT, _Traits> __s;
- __s.flags(__os.flags());
- __s.imbue(__os.getloc());
- __s.precision(__os.precision());
- __s << '(' << __x.real() << ',' << __x.imag() << ')';
- return __os << __s.str();
+operator<<(basic_ostream<_CharT, _Traits>& __os, const complex<_Tp>& __x) {
+ basic_ostringstream<_CharT, _Traits> __s;
+ __s.flags(__os.flags());
+ __s.imbue(__os.getloc());
+ __s.precision(__os.precision());
+ __s << '(' << __x.real() << ',' << __x.imag() << ')';
+ return __os << __s.str();
}
#endif // !_LIBCPP_HAS_NO_LOCALIZATION
#if _LIBCPP_STD_VER >= 14
// Literal suffix for complex number literals [complex.literals]
-inline namespace literals
-{
- inline namespace complex_literals
- {
- _LIBCPP_HIDE_FROM_ABI inline constexpr complex<long double> operator""il(long double __im)
- {
- return { 0.0l, __im };
- }
+inline namespace literals {
+inline namespace complex_literals {
+_LIBCPP_HIDE_FROM_ABI inline constexpr complex<long double> operator""il(long double __im) { return {0.0l, __im}; }
- _LIBCPP_HIDE_FROM_ABI inline constexpr complex<long double> operator""il(unsigned long long __im)
- {
- return { 0.0l, static_cast<long double>(__im) };
- }
-
-
- _LIBCPP_HIDE_FROM_ABI inline constexpr complex<double> operator""i(long double __im)
- {
- return { 0.0, static_cast<double>(__im) };
- }
+_LIBCPP_HIDE_FROM_ABI inline constexpr complex<long double> operator""il(unsigned long long __im) {
+ return {0.0l, static_cast<long double>(__im)};
+}
- _LIBCPP_HIDE_FROM_ABI inline constexpr complex<double> operator""i(unsigned long long __im)
- {
- return { 0.0, static_cast<double>(__im) };
- }
+_LIBCPP_HIDE_FROM_ABI inline constexpr complex<double> operator""i(long double __im) {
+ return {0.0, static_cast<double>(__im)};
+}
+_LIBCPP_HIDE_FROM_ABI inline constexpr complex<double> operator""i(unsigned long long __im) {
+ return {0.0, static_cast<double>(__im)};
+}
- _LIBCPP_HIDE_FROM_ABI inline constexpr complex<float> operator""if(long double __im)
- {
- return { 0.0f, static_cast<float>(__im) };
- }
+_LIBCPP_HIDE_FROM_ABI inline constexpr complex<float> operator""if(long double __im) {
+ return {0.0f, static_cast<float>(__im)};
+}
- _LIBCPP_HIDE_FROM_ABI inline constexpr complex<float> operator""if(unsigned long long __im)
- {
- return { 0.0f, static_cast<float>(__im) };
- }
- } // namespace complex_literals
+_LIBCPP_HIDE_FROM_ABI inline constexpr complex<float> operator""if(unsigned long long __im) {
+ return {0.0f, static_cast<float>(__im)};
+}
+} // namespace complex_literals
} // namespace literals
#endif
diff --git a/contrib/llvm-project/libcxx/include/condition_variable b/contrib/llvm-project/libcxx/include/condition_variable
index 4109ee52c125..cf7a570b6cb6 100644
--- a/contrib/llvm-project/libcxx/include/condition_variable
+++ b/contrib/llvm-project/libcxx/include/condition_variable
@@ -143,192 +143,147 @@ public:
_LIBCPP_BEGIN_NAMESPACE_STD
-class _LIBCPP_EXPORTED_FROM_ABI condition_variable_any
-{
- condition_variable __cv_;
- shared_ptr<mutex> __mut_;
+class _LIBCPP_EXPORTED_FROM_ABI condition_variable_any {
+ condition_variable __cv_;
+ shared_ptr<mutex> __mut_;
+
public:
- _LIBCPP_HIDE_FROM_ABI
- condition_variable_any();
+ _LIBCPP_HIDE_FROM_ABI condition_variable_any();
- _LIBCPP_HIDE_FROM_ABI
- void notify_one() _NOEXCEPT;
- _LIBCPP_HIDE_FROM_ABI
- void notify_all() _NOEXCEPT;
+ _LIBCPP_HIDE_FROM_ABI void notify_one() _NOEXCEPT;
+ _LIBCPP_HIDE_FROM_ABI void notify_all() _NOEXCEPT;
- template <class _Lock>
- _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
- void wait(_Lock& __lock);
- template <class _Lock, class _Predicate>
- _LIBCPP_HIDE_FROM_ABI
- void wait(_Lock& __lock, _Predicate __pred);
+ template <class _Lock>
+ _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS void wait(_Lock& __lock);
+ template <class _Lock, class _Predicate>
+ _LIBCPP_HIDE_FROM_ABI void wait(_Lock& __lock, _Predicate __pred);
- template <class _Lock, class _Clock, class _Duration>
- _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
- cv_status
- wait_until(_Lock& __lock,
- const chrono::time_point<_Clock, _Duration>& __t);
+ template <class _Lock, class _Clock, class _Duration>
+ _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS cv_status
+ wait_until(_Lock& __lock, const chrono::time_point<_Clock, _Duration>& __t);
- template <class _Lock, class _Clock, class _Duration, class _Predicate>
- bool
- _LIBCPP_HIDE_FROM_ABI
- wait_until(_Lock& __lock,
- const chrono::time_point<_Clock, _Duration>& __t,
- _Predicate __pred);
+ template <class _Lock, class _Clock, class _Duration, class _Predicate>
+ bool _LIBCPP_HIDE_FROM_ABI
+ wait_until(_Lock& __lock, const chrono::time_point<_Clock, _Duration>& __t, _Predicate __pred);
- template <class _Lock, class _Rep, class _Period>
- cv_status
- _LIBCPP_HIDE_FROM_ABI
- wait_for(_Lock& __lock,
- const chrono::duration<_Rep, _Period>& __d);
+ template <class _Lock, class _Rep, class _Period>
+ cv_status _LIBCPP_HIDE_FROM_ABI wait_for(_Lock& __lock, const chrono::duration<_Rep, _Period>& __d);
- template <class _Lock, class _Rep, class _Period, class _Predicate>
- bool
- _LIBCPP_HIDE_FROM_ABI
- wait_for(_Lock& __lock,
- const chrono::duration<_Rep, _Period>& __d,
- _Predicate __pred);
+ template <class _Lock, class _Rep, class _Period, class _Predicate>
+ bool _LIBCPP_HIDE_FROM_ABI wait_for(_Lock& __lock, const chrono::duration<_Rep, _Period>& __d, _Predicate __pred);
-#if _LIBCPP_STD_VER >= 20 && !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_STOP_TOKEN)
+# if _LIBCPP_STD_VER >= 20 && !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_STOP_TOKEN)
- template <class _Lock, class _Predicate>
- _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI bool wait(_Lock& __lock, stop_token __stoken, _Predicate __pred);
+ template <class _Lock, class _Predicate>
+ _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI bool wait(_Lock& __lock, stop_token __stoken, _Predicate __pred);
- template <class _Lock, class _Clock, class _Duration, class _Predicate>
- _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI bool wait_until(_Lock& __lock, stop_token __stoken,
- const chrono::time_point<_Clock, _Duration>& __abs_time, _Predicate __pred);
+ template <class _Lock, class _Clock, class _Duration, class _Predicate>
+ _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI bool wait_until(
+ _Lock& __lock, stop_token __stoken, const chrono::time_point<_Clock, _Duration>& __abs_time, _Predicate __pred);
- template <class _Lock, class _Rep, class _Period, class _Predicate>
- _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI bool wait_for(_Lock& __lock, stop_token __stoken,
- const chrono::duration<_Rep, _Period>& __rel_time, _Predicate __pred);
+ template <class _Lock, class _Rep, class _Period, class _Predicate>
+ _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI bool
+ wait_for(_Lock& __lock, stop_token __stoken, const chrono::duration<_Rep, _Period>& __rel_time, _Predicate __pred);
-#endif // _LIBCPP_STD_VER >= 20 && !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_STOP_TOKEN)
+# endif // _LIBCPP_STD_VER >= 20 && !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_STOP_TOKEN)
};
-inline
-condition_variable_any::condition_variable_any()
- : __mut_(make_shared<mutex>()) {}
+inline condition_variable_any::condition_variable_any() : __mut_(make_shared<mutex>()) {}
-inline
-void
-condition_variable_any::notify_one() _NOEXCEPT
-{
- {lock_guard<mutex> __lx(*__mut_);}
- __cv_.notify_one();
+inline void condition_variable_any::notify_one() _NOEXCEPT {
+ { lock_guard<mutex> __lx(*__mut_); }
+ __cv_.notify_one();
}
-inline
-void
-condition_variable_any::notify_all() _NOEXCEPT
-{
- {lock_guard<mutex> __lx(*__mut_);}
- __cv_.notify_all();
+inline void condition_variable_any::notify_all() _NOEXCEPT {
+ { lock_guard<mutex> __lx(*__mut_); }
+ __cv_.notify_all();
}
-struct __lock_external
-{
- template <class _Lock>
- _LIBCPP_HIDE_FROM_ABI void operator()(_Lock* __m) {__m->lock();}
+struct __lock_external {
+ template <class _Lock>
+ _LIBCPP_HIDE_FROM_ABI void operator()(_Lock* __m) {
+ __m->lock();
+ }
};
template <class _Lock>
-void
-condition_variable_any::wait(_Lock& __lock)
-{
- shared_ptr<mutex> __mut = __mut_;
- unique_lock<mutex> __lk(*__mut);
- __lock.unlock();
- unique_ptr<_Lock, __lock_external> __lxx(&__lock);
- lock_guard<unique_lock<mutex> > __lx(__lk, adopt_lock_t());
- __cv_.wait(__lk);
-} // __mut_.unlock(), __lock.lock()
+void condition_variable_any::wait(_Lock& __lock) {
+ shared_ptr<mutex> __mut = __mut_;
+ unique_lock<mutex> __lk(*__mut);
+ __lock.unlock();
+ unique_ptr<_Lock, __lock_external> __lxx(&__lock);
+ lock_guard<unique_lock<mutex> > __lx(__lk, adopt_lock_t());
+ __cv_.wait(__lk);
+} // __mut_.unlock(), __lock.lock()
template <class _Lock, class _Predicate>
-inline
-void
-condition_variable_any::wait(_Lock& __lock, _Predicate __pred)
-{
- while (!__pred())
- wait(__lock);
+inline void condition_variable_any::wait(_Lock& __lock, _Predicate __pred) {
+ while (!__pred())
+ wait(__lock);
}
template <class _Lock, class _Clock, class _Duration>
-cv_status
-condition_variable_any::wait_until(_Lock& __lock,
- const chrono::time_point<_Clock, _Duration>& __t)
-{
- shared_ptr<mutex> __mut = __mut_;
- unique_lock<mutex> __lk(*__mut);
- __lock.unlock();
- unique_ptr<_Lock, __lock_external> __lxx(&__lock);
- lock_guard<unique_lock<mutex> > __lx(__lk, adopt_lock_t());
- return __cv_.wait_until(__lk, __t);
-} // __mut_.unlock(), __lock.lock()
+cv_status condition_variable_any::wait_until(_Lock& __lock, const chrono::time_point<_Clock, _Duration>& __t) {
+ shared_ptr<mutex> __mut = __mut_;
+ unique_lock<mutex> __lk(*__mut);
+ __lock.unlock();
+ unique_ptr<_Lock, __lock_external> __lxx(&__lock);
+ lock_guard<unique_lock<mutex> > __lx(__lk, adopt_lock_t());
+ return __cv_.wait_until(__lk, __t);
+} // __mut_.unlock(), __lock.lock()
template <class _Lock, class _Clock, class _Duration, class _Predicate>
-inline
-bool
-condition_variable_any::wait_until(_Lock& __lock,
- const chrono::time_point<_Clock, _Duration>& __t,
- _Predicate __pred)
-{
- while (!__pred())
- if (wait_until(__lock, __t) == cv_status::timeout)
- return __pred();
- return true;
+inline bool
+condition_variable_any::wait_until(_Lock& __lock, const chrono::time_point<_Clock, _Duration>& __t, _Predicate __pred) {
+ while (!__pred())
+ if (wait_until(__lock, __t) == cv_status::timeout)
+ return __pred();
+ return true;
}
template <class _Lock, class _Rep, class _Period>
-inline
-cv_status
-condition_variable_any::wait_for(_Lock& __lock,
- const chrono::duration<_Rep, _Period>& __d)
-{
- return wait_until(__lock, chrono::steady_clock::now() + __d);
+inline cv_status condition_variable_any::wait_for(_Lock& __lock, const chrono::duration<_Rep, _Period>& __d) {
+ return wait_until(__lock, chrono::steady_clock::now() + __d);
}
template <class _Lock, class _Rep, class _Period, class _Predicate>
-inline
-bool
-condition_variable_any::wait_for(_Lock& __lock,
- const chrono::duration<_Rep, _Period>& __d,
- _Predicate __pred)
-{
- return wait_until(__lock, chrono::steady_clock::now() + __d,
- std::move(__pred));
+inline bool
+condition_variable_any::wait_for(_Lock& __lock, const chrono::duration<_Rep, _Period>& __d, _Predicate __pred) {
+ return wait_until(__lock, chrono::steady_clock::now() + __d, std::move(__pred));
}
-#if _LIBCPP_STD_VER >= 20 && !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_STOP_TOKEN)
+# if _LIBCPP_STD_VER >= 20 && !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_STOP_TOKEN)
template <class _Lock, class _Predicate>
bool condition_variable_any::wait(_Lock& __lock, stop_token __stoken, _Predicate __pred) {
- while (!__stoken.stop_requested()) {
- if (__pred())
- return true;
- wait(__lock);
- }
- return __pred();
+ while (!__stoken.stop_requested()) {
+ if (__pred())
+ return true;
+ wait(__lock);
+ }
+ return __pred();
}
template <class _Lock, class _Clock, class _Duration, class _Predicate>
bool condition_variable_any::wait_until(
_Lock& __lock, stop_token __stoken, const chrono::time_point<_Clock, _Duration>& __abs_time, _Predicate __pred) {
- while (!__stoken.stop_requested()) {
- if (__pred())
- return true;
- if (wait_until(__lock, __abs_time) == cv_status::timeout)
- return __pred();
- }
- return __pred();
+ while (!__stoken.stop_requested()) {
+ if (__pred())
+ return true;
+ if (wait_until(__lock, __abs_time) == cv_status::timeout)
+ return __pred();
+ }
+ return __pred();
}
template <class _Lock, class _Rep, class _Period, class _Predicate>
bool condition_variable_any::wait_for(
_Lock& __lock, stop_token __stoken, const chrono::duration<_Rep, _Period>& __rel_time, _Predicate __pred) {
- return wait_until(__lock, std::move(__stoken), chrono::steady_clock::now() + __rel_time, std::move(__pred));
+ return wait_until(__lock, std::move(__stoken), chrono::steady_clock::now() + __rel_time, std::move(__pred));
}
-#endif // _LIBCPP_STD_VER >= 20 && !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_STOP_TOKEN)
+# endif // _LIBCPP_STD_VER >= 20 && !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_STOP_TOKEN)
_LIBCPP_EXPORTED_FROM_ABI void notify_all_at_thread_exit(condition_variable&, unique_lock<mutex>);
diff --git a/contrib/llvm-project/libcxx/include/cstddef b/contrib/llvm-project/libcxx/include/cstddef
index 24be0fe78058..1d7bac24c81e 100644
--- a/contrib/llvm-project/libcxx/include/cstddef
+++ b/contrib/llvm-project/libcxx/include/cstddef
@@ -67,49 +67,39 @@ using ::max_align_t _LIBCPP_USING_IF_EXISTS;
_LIBCPP_END_NAMESPACE_STD
#if _LIBCPP_STD_VER >= 17
-namespace std // purposefully not versioned
+namespace std // purposefully not versioned
{
enum class byte : unsigned char {};
-_LIBCPP_HIDE_FROM_ABI inline constexpr byte operator| (byte __lhs, byte __rhs) noexcept
-{
- return static_cast<byte>(
- static_cast<unsigned char>(
- static_cast<unsigned int>(__lhs) | static_cast<unsigned int>(__rhs)
- ));
+_LIBCPP_HIDE_FROM_ABI inline constexpr byte operator|(byte __lhs, byte __rhs) noexcept {
+ return static_cast<byte>(
+ static_cast<unsigned char>(static_cast<unsigned int>(__lhs) | static_cast<unsigned int>(__rhs)));
}
-_LIBCPP_HIDE_FROM_ABI inline constexpr byte& operator|=(byte& __lhs, byte __rhs) noexcept
-{ return __lhs = __lhs | __rhs; }
+_LIBCPP_HIDE_FROM_ABI inline constexpr byte& operator|=(byte& __lhs, byte __rhs) noexcept {
+ return __lhs = __lhs | __rhs;
+}
-_LIBCPP_HIDE_FROM_ABI inline constexpr byte operator& (byte __lhs, byte __rhs) noexcept
-{
- return static_cast<byte>(
- static_cast<unsigned char>(
- static_cast<unsigned int>(__lhs) & static_cast<unsigned int>(__rhs)
- ));
+_LIBCPP_HIDE_FROM_ABI inline constexpr byte operator&(byte __lhs, byte __rhs) noexcept {
+ return static_cast<byte>(
+ static_cast<unsigned char>(static_cast<unsigned int>(__lhs) & static_cast<unsigned int>(__rhs)));
}
-_LIBCPP_HIDE_FROM_ABI inline constexpr byte& operator&=(byte& __lhs, byte __rhs) noexcept
-{ return __lhs = __lhs & __rhs; }
+_LIBCPP_HIDE_FROM_ABI inline constexpr byte& operator&=(byte& __lhs, byte __rhs) noexcept {
+ return __lhs = __lhs & __rhs;
+}
-_LIBCPP_HIDE_FROM_ABI inline constexpr byte operator^ (byte __lhs, byte __rhs) noexcept
-{
- return static_cast<byte>(
- static_cast<unsigned char>(
- static_cast<unsigned int>(__lhs) ^ static_cast<unsigned int>(__rhs)
- ));
+_LIBCPP_HIDE_FROM_ABI inline constexpr byte operator^(byte __lhs, byte __rhs) noexcept {
+ return static_cast<byte>(
+ static_cast<unsigned char>(static_cast<unsigned int>(__lhs) ^ static_cast<unsigned int>(__rhs)));
}
-_LIBCPP_HIDE_FROM_ABI inline constexpr byte& operator^=(byte& __lhs, byte __rhs) noexcept
-{ return __lhs = __lhs ^ __rhs; }
+_LIBCPP_HIDE_FROM_ABI inline constexpr byte& operator^=(byte& __lhs, byte __rhs) noexcept {
+ return __lhs = __lhs ^ __rhs;
+}
-_LIBCPP_HIDE_FROM_ABI inline constexpr byte operator~ (byte __b) noexcept
-{
- return static_cast<byte>(
- static_cast<unsigned char>(
- ~static_cast<unsigned int>(__b)
- ));
+_LIBCPP_HIDE_FROM_ABI inline constexpr byte operator~(byte __b) noexcept {
+ return static_cast<byte>(static_cast<unsigned char>(~static_cast<unsigned int>(__b)));
}
template <class _Integer, __enable_if_t<is_integral<_Integer>::value, int> = 0>
diff --git a/contrib/llvm-project/libcxx/include/ctype.h b/contrib/llvm-project/libcxx/include/ctype.h
index 728173ed670f..448e4410c554 100644
--- a/contrib/llvm-project/libcxx/include/ctype.h
+++ b/contrib/llvm-project/libcxx/include/ctype.h
@@ -41,20 +41,20 @@ int toupper(int c);
#ifdef __cplusplus
-#undef isalnum
-#undef isalpha
-#undef isblank
-#undef iscntrl
-#undef isdigit
-#undef isgraph
-#undef islower
-#undef isprint
-#undef ispunct
-#undef isspace
-#undef isupper
-#undef isxdigit
-#undef tolower
-#undef toupper
+# undef isalnum
+# undef isalpha
+# undef isblank
+# undef iscntrl
+# undef isdigit
+# undef isgraph
+# undef islower
+# undef isprint
+# undef ispunct
+# undef isspace
+# undef isupper
+# undef isxdigit
+# undef tolower
+# undef toupper
#endif
diff --git a/contrib/llvm-project/libcxx/include/cuchar b/contrib/llvm-project/libcxx/include/cuchar
index 93e657e84b6d..03b8c7d2a88b 100644
--- a/contrib/llvm-project/libcxx/include/cuchar
+++ b/contrib/llvm-project/libcxx/include/cuchar
@@ -73,4 +73,4 @@ using ::c32rtomb _LIBCPP_USING_IF_EXISTS;
_LIBCPP_END_NAMESPACE_STD
-#endif // _LIBCPP_CUCHAR
+#endif // _LIBCPP_CUCHAR
diff --git a/contrib/llvm-project/libcxx/include/deque b/contrib/llvm-project/libcxx/include/deque
index eabcc7bd0e3c..fca8b3d6e2c7 100644
--- a/contrib/llvm-project/libcxx/include/deque
+++ b/contrib/llvm-project/libcxx/include/deque
@@ -242,182 +242,173 @@ template <class T, class Allocator, class Predicate>
_LIBCPP_PUSH_MACROS
#include <__undef_macros>
-
_LIBCPP_BEGIN_NAMESPACE_STD
-template <class _Tp, class _Allocator = allocator<_Tp> > class _LIBCPP_TEMPLATE_VIS deque;
+template <class _Tp, class _Allocator = allocator<_Tp> >
+class _LIBCPP_TEMPLATE_VIS deque;
template <class _ValueType, class _DiffType>
struct __deque_block_size {
static const _DiffType value = sizeof(_ValueType) < 256 ? 4096 / sizeof(_ValueType) : 16;
};
-template <class _ValueType, class _Pointer, class _Reference, class _MapPointer,
- class _DiffType, _DiffType _BS =
+template <class _ValueType,
+ class _Pointer,
+ class _Reference,
+ class _MapPointer,
+ class _DiffType,
+ _DiffType _BS =
#ifdef _LIBCPP_ABI_INCOMPLETE_TYPES_IN_DEQUE
-// Keep template parameter to avoid changing all template declarations thoughout
-// this file.
- 0
+ // Keep template parameter to avoid changing all template declarations thoughout
+ // this file.
+ 0
#else
- __deque_block_size<_ValueType, _DiffType>::value
+ __deque_block_size<_ValueType, _DiffType>::value
#endif
>
-class _LIBCPP_TEMPLATE_VIS __deque_iterator
-{
- typedef _MapPointer __map_iterator;
+class _LIBCPP_TEMPLATE_VIS __deque_iterator {
+ typedef _MapPointer __map_iterator;
+
public:
- typedef _Pointer pointer;
- typedef _DiffType difference_type;
+ typedef _Pointer pointer;
+ typedef _DiffType difference_type;
+
private:
- __map_iterator __m_iter_;
- pointer __ptr_;
+ __map_iterator __m_iter_;
+ pointer __ptr_;
+
+ static const difference_type __block_size;
- static const difference_type __block_size;
public:
- typedef _ValueType value_type;
- typedef random_access_iterator_tag iterator_category;
- typedef _Reference reference;
+ typedef _ValueType value_type;
+ typedef random_access_iterator_tag iterator_category;
+ typedef _Reference reference;
- _LIBCPP_HIDE_FROM_ABI __deque_iterator() _NOEXCEPT
+ _LIBCPP_HIDE_FROM_ABI __deque_iterator() _NOEXCEPT
#if _LIBCPP_STD_VER >= 14
- : __m_iter_(nullptr), __ptr_(nullptr)
+ : __m_iter_(nullptr),
+ __ptr_(nullptr)
#endif
- {}
-
- template <class _Pp, class _Rp, class _MP, __enable_if_t<is_convertible<_Pp, pointer>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI
- __deque_iterator(const __deque_iterator<value_type, _Pp, _Rp, _MP, difference_type, _BS>& __it) _NOEXCEPT
- : __m_iter_(__it.__m_iter_), __ptr_(__it.__ptr_) {}
-
- _LIBCPP_HIDE_FROM_ABI reference operator*() const {return *__ptr_;}
- _LIBCPP_HIDE_FROM_ABI pointer operator->() const {return __ptr_;}
-
- _LIBCPP_HIDE_FROM_ABI __deque_iterator& operator++()
- {
- if (++__ptr_ - *__m_iter_ == __block_size)
- {
- ++__m_iter_;
- __ptr_ = *__m_iter_;
- }
- return *this;
- }
+ {
+ }
- _LIBCPP_HIDE_FROM_ABI __deque_iterator operator++(int)
- {
- __deque_iterator __tmp = *this;
- ++(*this);
- return __tmp;
- }
+ template <class _Pp, class _Rp, class _MP, __enable_if_t<is_convertible<_Pp, pointer>::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI
+ __deque_iterator(const __deque_iterator<value_type, _Pp, _Rp, _MP, difference_type, _BS>& __it) _NOEXCEPT
+ : __m_iter_(__it.__m_iter_),
+ __ptr_(__it.__ptr_) {}
- _LIBCPP_HIDE_FROM_ABI __deque_iterator& operator--()
- {
- if (__ptr_ == *__m_iter_)
- {
- --__m_iter_;
- __ptr_ = *__m_iter_ + __block_size;
- }
- --__ptr_;
- return *this;
- }
+ _LIBCPP_HIDE_FROM_ABI reference operator*() const { return *__ptr_; }
+ _LIBCPP_HIDE_FROM_ABI pointer operator->() const { return __ptr_; }
- _LIBCPP_HIDE_FROM_ABI __deque_iterator operator--(int)
- {
- __deque_iterator __tmp = *this;
- --(*this);
- return __tmp;
+ _LIBCPP_HIDE_FROM_ABI __deque_iterator& operator++() {
+ if (++__ptr_ - *__m_iter_ == __block_size) {
+ ++__m_iter_;
+ __ptr_ = *__m_iter_;
}
+ return *this;
+ }
- _LIBCPP_HIDE_FROM_ABI __deque_iterator& operator+=(difference_type __n)
- {
- if (__n != 0)
- {
- __n += __ptr_ - *__m_iter_;
- if (__n > 0)
- {
- __m_iter_ += __n / __block_size;
- __ptr_ = *__m_iter_ + __n % __block_size;
- }
- else // (__n < 0)
- {
- difference_type __z = __block_size - 1 - __n;
- __m_iter_ -= __z / __block_size;
- __ptr_ = *__m_iter_ + (__block_size - 1 - __z % __block_size);
- }
- }
- return *this;
- }
+ _LIBCPP_HIDE_FROM_ABI __deque_iterator operator++(int) {
+ __deque_iterator __tmp = *this;
+ ++(*this);
+ return __tmp;
+ }
- _LIBCPP_HIDE_FROM_ABI __deque_iterator& operator-=(difference_type __n)
- {
- return *this += -__n;
+ _LIBCPP_HIDE_FROM_ABI __deque_iterator& operator--() {
+ if (__ptr_ == *__m_iter_) {
+ --__m_iter_;
+ __ptr_ = *__m_iter_ + __block_size;
}
+ --__ptr_;
+ return *this;
+ }
- _LIBCPP_HIDE_FROM_ABI __deque_iterator operator+(difference_type __n) const
- {
- __deque_iterator __t(*this);
- __t += __n;
- return __t;
- }
+ _LIBCPP_HIDE_FROM_ABI __deque_iterator operator--(int) {
+ __deque_iterator __tmp = *this;
+ --(*this);
+ return __tmp;
+ }
- _LIBCPP_HIDE_FROM_ABI __deque_iterator operator-(difference_type __n) const
- {
- __deque_iterator __t(*this);
- __t -= __n;
- return __t;
+ _LIBCPP_HIDE_FROM_ABI __deque_iterator& operator+=(difference_type __n) {
+ if (__n != 0) {
+ __n += __ptr_ - *__m_iter_;
+ if (__n > 0) {
+ __m_iter_ += __n / __block_size;
+ __ptr_ = *__m_iter_ + __n % __block_size;
+ } else // (__n < 0)
+ {
+ difference_type __z = __block_size - 1 - __n;
+ __m_iter_ -= __z / __block_size;
+ __ptr_ = *__m_iter_ + (__block_size - 1 - __z % __block_size);
+ }
}
+ return *this;
+ }
- _LIBCPP_HIDE_FROM_ABI
- friend __deque_iterator operator+(difference_type __n, const __deque_iterator& __it)
- {return __it + __n;}
-
- _LIBCPP_HIDE_FROM_ABI
- friend difference_type operator-(const __deque_iterator& __x, const __deque_iterator& __y)
- {
- if (__x != __y)
- return (__x.__m_iter_ - __y.__m_iter_) * __block_size
- + (__x.__ptr_ - *__x.__m_iter_)
- - (__y.__ptr_ - *__y.__m_iter_);
- return 0;
- }
+ _LIBCPP_HIDE_FROM_ABI __deque_iterator& operator-=(difference_type __n) { return *this += -__n; }
+
+ _LIBCPP_HIDE_FROM_ABI __deque_iterator operator+(difference_type __n) const {
+ __deque_iterator __t(*this);
+ __t += __n;
+ return __t;
+ }
+
+ _LIBCPP_HIDE_FROM_ABI __deque_iterator operator-(difference_type __n) const {
+ __deque_iterator __t(*this);
+ __t -= __n;
+ return __t;
+ }
- _LIBCPP_HIDE_FROM_ABI reference operator[](difference_type __n) const
- {return *(*this + __n);}
+ _LIBCPP_HIDE_FROM_ABI friend __deque_iterator operator+(difference_type __n, const __deque_iterator& __it) {
+ return __it + __n;
+ }
- _LIBCPP_HIDE_FROM_ABI friend
- bool operator==(const __deque_iterator& __x, const __deque_iterator& __y)
- {return __x.__ptr_ == __y.__ptr_;}
+ _LIBCPP_HIDE_FROM_ABI friend difference_type operator-(const __deque_iterator& __x, const __deque_iterator& __y) {
+ if (__x != __y)
+ return (__x.__m_iter_ - __y.__m_iter_) * __block_size + (__x.__ptr_ - *__x.__m_iter_) -
+ (__y.__ptr_ - *__y.__m_iter_);
+ return 0;
+ }
- _LIBCPP_HIDE_FROM_ABI friend
- bool operator!=(const __deque_iterator& __x, const __deque_iterator& __y)
- {return !(__x == __y);}
+ _LIBCPP_HIDE_FROM_ABI reference operator[](difference_type __n) const { return *(*this + __n); }
+
+ _LIBCPP_HIDE_FROM_ABI friend bool operator==(const __deque_iterator& __x, const __deque_iterator& __y) {
+ return __x.__ptr_ == __y.__ptr_;
+ }
- _LIBCPP_HIDE_FROM_ABI friend
- bool operator<(const __deque_iterator& __x, const __deque_iterator& __y)
- {return __x.__m_iter_ < __y.__m_iter_ ||
- (__x.__m_iter_ == __y.__m_iter_ && __x.__ptr_ < __y.__ptr_);}
+ _LIBCPP_HIDE_FROM_ABI friend bool operator!=(const __deque_iterator& __x, const __deque_iterator& __y) {
+ return !(__x == __y);
+ }
+
+ _LIBCPP_HIDE_FROM_ABI friend bool operator<(const __deque_iterator& __x, const __deque_iterator& __y) {
+ return __x.__m_iter_ < __y.__m_iter_ || (__x.__m_iter_ == __y.__m_iter_ && __x.__ptr_ < __y.__ptr_);
+ }
- _LIBCPP_HIDE_FROM_ABI friend
- bool operator>(const __deque_iterator& __x, const __deque_iterator& __y)
- {return __y < __x;}
+ _LIBCPP_HIDE_FROM_ABI friend bool operator>(const __deque_iterator& __x, const __deque_iterator& __y) {
+ return __y < __x;
+ }
- _LIBCPP_HIDE_FROM_ABI friend
- bool operator<=(const __deque_iterator& __x, const __deque_iterator& __y)
- {return !(__y < __x);}
+ _LIBCPP_HIDE_FROM_ABI friend bool operator<=(const __deque_iterator& __x, const __deque_iterator& __y) {
+ return !(__y < __x);
+ }
- _LIBCPP_HIDE_FROM_ABI friend
- bool operator>=(const __deque_iterator& __x, const __deque_iterator& __y)
- {return !(__x < __y);}
+ _LIBCPP_HIDE_FROM_ABI friend bool operator>=(const __deque_iterator& __x, const __deque_iterator& __y) {
+ return !(__x < __y);
+ }
private:
- _LIBCPP_HIDE_FROM_ABI explicit __deque_iterator(__map_iterator __m, pointer __p) _NOEXCEPT
- : __m_iter_(__m), __ptr_(__p) {}
+ _LIBCPP_HIDE_FROM_ABI explicit __deque_iterator(__map_iterator __m, pointer __p) _NOEXCEPT
+ : __m_iter_(__m),
+ __ptr_(__p) {}
- template <class _Tp, class _Ap> friend class _LIBCPP_TEMPLATE_VIS deque;
- template <class _Vp, class _Pp, class _Rp, class _MP, class _Dp, _Dp>
- friend class _LIBCPP_TEMPLATE_VIS __deque_iterator;
+ template <class _Tp, class _Ap>
+ friend class _LIBCPP_TEMPLATE_VIS deque;
+ template <class _Vp, class _Pp, class _Rp, class _MP, class _Dp, _Dp>
+ friend class _LIBCPP_TEMPLATE_VIS __deque_iterator;
- template <class>
- friend struct __segmented_iterator_traits;
+ template <class>
+ friend struct __segmented_iterator_traits;
};
template <class _ValueType, class _Pointer, class _Reference, class _MapPointer, class _DiffType, _DiffType _BlockSize>
@@ -428,37 +419,34 @@ private:
public:
using __is_segmented_iterator = true_type;
- using __segment_iterator = _MapPointer;
- using __local_iterator = _Pointer;
+ using __segment_iterator = _MapPointer;
+ using __local_iterator = _Pointer;
static _LIBCPP_HIDE_FROM_ABI __segment_iterator __segment(_Iterator __iter) { return __iter.__m_iter_; }
static _LIBCPP_HIDE_FROM_ABI __local_iterator __local(_Iterator __iter) { return __iter.__ptr_; }
static _LIBCPP_HIDE_FROM_ABI __local_iterator __begin(__segment_iterator __iter) { return *__iter; }
static _LIBCPP_HIDE_FROM_ABI __local_iterator __end(__segment_iterator __iter) {
- return *__iter + _Iterator::__block_size;
+ return *__iter + _Iterator::__block_size;
}
static _LIBCPP_HIDE_FROM_ABI _Iterator __compose(__segment_iterator __segment, __local_iterator __local) {
- if (__segment && __local == __end(__segment)) {
- ++__segment;
- return _Iterator(__segment, *__segment);
- }
- return _Iterator(__segment, __local);
+ if (__segment && __local == __end(__segment)) {
+ ++__segment;
+ return _Iterator(__segment, *__segment);
+ }
+ return _Iterator(__segment, __local);
}
};
-template <class _ValueType, class _Pointer, class _Reference, class _MapPointer,
- class _DiffType, _DiffType _BlockSize>
-const _DiffType __deque_iterator<_ValueType, _Pointer, _Reference, _MapPointer,
- _DiffType, _BlockSize>::__block_size =
+template <class _ValueType, class _Pointer, class _Reference, class _MapPointer, class _DiffType, _DiffType _BlockSize>
+const _DiffType __deque_iterator<_ValueType, _Pointer, _Reference, _MapPointer, _DiffType, _BlockSize>::__block_size =
__deque_block_size<_ValueType, _DiffType>::value;
template <class _Tp, class _Allocator /*= allocator<_Tp>*/>
-class _LIBCPP_TEMPLATE_VIS deque
-{
+class _LIBCPP_TEMPLATE_VIS deque {
public:
- // types:
+ // types:
using value_type = _Tp;
@@ -503,8 +491,9 @@ public:
private:
struct __deque_block_range {
- explicit _LIBCPP_HIDE_FROM_ABI
- __deque_block_range(pointer __b, pointer __e) _NOEXCEPT : __begin_(__b), __end_(__e) {}
+ explicit _LIBCPP_HIDE_FROM_ABI __deque_block_range(pointer __b, pointer __e) _NOEXCEPT
+ : __begin_(__b),
+ __end_(__e) {}
const pointer __begin_;
const pointer __end_;
};
@@ -513,22 +502,15 @@ private:
iterator __pos_;
const iterator __end_;
- _LIBCPP_HIDE_FROM_ABI __deque_range(iterator __pos, iterator __e) _NOEXCEPT
- : __pos_(__pos), __end_(__e) {}
+ _LIBCPP_HIDE_FROM_ABI __deque_range(iterator __pos, iterator __e) _NOEXCEPT : __pos_(__pos), __end_(__e) {}
- explicit _LIBCPP_HIDE_FROM_ABI operator bool() const _NOEXCEPT {
- return __pos_ != __end_;
- }
+ explicit _LIBCPP_HIDE_FROM_ABI operator bool() const _NOEXCEPT { return __pos_ != __end_; }
- _LIBCPP_HIDE_FROM_ABI __deque_range begin() const {
- return *this;
- }
+ _LIBCPP_HIDE_FROM_ABI __deque_range begin() const { return *this; }
- _LIBCPP_HIDE_FROM_ABI __deque_range end() const {
- return __deque_range(__end_, __end_);
- }
+ _LIBCPP_HIDE_FROM_ABI __deque_range end() const { return __deque_range(__end_, __end_); }
_LIBCPP_HIDE_FROM_ABI __deque_block_range operator*() const _NOEXCEPT {
- if (__pos_.__m_iter_ == __end_.__m_iter_) {
+ if (__pos_.__m_iter_ == __end_.__m_iter_) {
return __deque_block_range(__pos_.__ptr_, __end_.__ptr_);
}
return __deque_block_range(__pos_.__ptr_, *__pos_.__m_iter_ + __block_size);
@@ -544,7 +526,6 @@ private:
return *this;
}
-
_LIBCPP_HIDE_FROM_ABI friend bool operator==(__deque_range const& __lhs, __deque_range const& __rhs) {
return __lhs.__pos_ == __rhs.__pos_;
}
@@ -555,15 +536,13 @@ private:
struct _ConstructTransaction {
_LIBCPP_HIDE_FROM_ABI _ConstructTransaction(deque* __db, __deque_block_range& __r)
- : __pos_(__r.__begin_), __end_(__r.__end_), __begin_(__r.__begin_), __base_(__db) {}
+ : __pos_(__r.__begin_), __end_(__r.__end_), __begin_(__r.__begin_), __base_(__db) {}
-
- _LIBCPP_HIDE_FROM_ABI ~_ConstructTransaction() {
- __base_->__size() += (__pos_ - __begin_);
- }
+ _LIBCPP_HIDE_FROM_ABI ~_ConstructTransaction() { __base_->__size() += (__pos_ - __begin_); }
pointer __pos_;
const pointer __end_;
+
private:
const pointer __begin_;
deque* const __base_;
@@ -576,53 +555,49 @@ private:
__compressed_pair<size_type, allocator_type> __size_;
public:
+ // construct/copy/destroy:
+ _LIBCPP_HIDE_FROM_ABI deque() _NOEXCEPT_(is_nothrow_default_constructible<allocator_type>::value)
+ : __start_(0), __size_(0, __default_init_tag()) {
+ __annotate_new(0);
+ }
- // construct/copy/destroy:
- _LIBCPP_HIDE_FROM_ABI
- deque() _NOEXCEPT_(is_nothrow_default_constructible<allocator_type>::value)
- : __start_(0), __size_(0, __default_init_tag()) {
- __annotate_new(0);
- }
-
- _LIBCPP_HIDE_FROM_ABI ~deque() {
- clear();
- __annotate_delete();
- typename __map::iterator __i = __map_.begin();
- typename __map::iterator __e = __map_.end();
- for (; __i != __e; ++__i)
- __alloc_traits::deallocate(__alloc(), *__i, __block_size);
- }
+ _LIBCPP_HIDE_FROM_ABI ~deque() {
+ clear();
+ __annotate_delete();
+ typename __map::iterator __i = __map_.begin();
+ typename __map::iterator __e = __map_.end();
+ for (; __i != __e; ++__i)
+ __alloc_traits::deallocate(__alloc(), *__i, __block_size);
+ }
- _LIBCPP_HIDE_FROM_ABI explicit deque(const allocator_type& __a)
- : __map_(__pointer_allocator(__a)), __start_(0), __size_(0, __a) {
- __annotate_new(0);
- }
+ _LIBCPP_HIDE_FROM_ABI explicit deque(const allocator_type& __a)
+ : __map_(__pointer_allocator(__a)), __start_(0), __size_(0, __a) {
+ __annotate_new(0);
+ }
- explicit _LIBCPP_HIDE_FROM_ABI deque(size_type __n);
+ explicit _LIBCPP_HIDE_FROM_ABI deque(size_type __n);
#if _LIBCPP_STD_VER >= 14
- explicit _LIBCPP_HIDE_FROM_ABI deque(size_type __n, const _Allocator& __a);
+ explicit _LIBCPP_HIDE_FROM_ABI deque(size_type __n, const _Allocator& __a);
#endif
- _LIBCPP_HIDE_FROM_ABI deque(size_type __n, const value_type& __v);
-
- template <class = __enable_if_t<__is_allocator<_Allocator>::value> >
- _LIBCPP_HIDE_FROM_ABI deque(size_type __n, const value_type& __v, const allocator_type& __a)
- : __map_(__pointer_allocator(__a)), __start_(0), __size_(0, __a)
- {
- __annotate_new(0);
- if (__n > 0)
- __append(__n, __v);
- }
+ _LIBCPP_HIDE_FROM_ABI deque(size_type __n, const value_type& __v);
+
+ template <class = __enable_if_t<__is_allocator<_Allocator>::value> >
+ _LIBCPP_HIDE_FROM_ABI deque(size_type __n, const value_type& __v, const allocator_type& __a)
+ : __map_(__pointer_allocator(__a)), __start_(0), __size_(0, __a) {
+ __annotate_new(0);
+ if (__n > 0)
+ __append(__n, __v);
+ }
- template <class _InputIter, __enable_if_t<__has_input_iterator_category<_InputIter>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI deque(_InputIter __f, _InputIter __l);
- template <class _InputIter, __enable_if_t<__has_input_iterator_category<_InputIter>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI deque(_InputIter __f, _InputIter __l, const allocator_type& __a);
+ template <class _InputIter, __enable_if_t<__has_input_iterator_category<_InputIter>::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI deque(_InputIter __f, _InputIter __l);
+ template <class _InputIter, __enable_if_t<__has_input_iterator_category<_InputIter>::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI deque(_InputIter __f, _InputIter __l, const allocator_type& __a);
#if _LIBCPP_STD_VER >= 23
template <_ContainerCompatibleRange<_Tp> _Range>
- _LIBCPP_HIDE_FROM_ABI deque(from_range_t, _Range&& __range,
- const allocator_type& __a = allocator_type())
- : __map_(__pointer_allocator(__a)), __start_(0), __size_(0, __a) {
+ _LIBCPP_HIDE_FROM_ABI deque(from_range_t, _Range&& __range, const allocator_type& __a = allocator_type())
+ : __map_(__pointer_allocator(__a)), __start_(0), __size_(0, __a) {
if constexpr (ranges::forward_range<_Range> || ranges::sized_range<_Range>) {
__append_with_size(ranges::begin(__range), ranges::distance(__range));
@@ -634,688 +609,620 @@ public:
}
#endif
- _LIBCPP_HIDE_FROM_ABI deque(const deque& __c);
- _LIBCPP_HIDE_FROM_ABI deque(const deque& __c, const __type_identity_t<allocator_type>& __a);
+ _LIBCPP_HIDE_FROM_ABI deque(const deque& __c);
+ _LIBCPP_HIDE_FROM_ABI deque(const deque& __c, const __type_identity_t<allocator_type>& __a);
- _LIBCPP_HIDE_FROM_ABI deque& operator=(const deque& __c);
+ _LIBCPP_HIDE_FROM_ABI deque& operator=(const deque& __c);
#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI deque(initializer_list<value_type> __il);
- _LIBCPP_HIDE_FROM_ABI deque(initializer_list<value_type> __il, const allocator_type& __a);
-
- _LIBCPP_HIDE_FROM_ABI
- deque& operator=(initializer_list<value_type> __il) {assign(__il); return *this;}
-
- _LIBCPP_HIDE_FROM_ABI
- deque(deque&& __c) _NOEXCEPT_(is_nothrow_move_constructible<allocator_type>::value);
- _LIBCPP_HIDE_FROM_ABI
- deque(deque&& __c, const __type_identity_t<allocator_type>& __a);
- _LIBCPP_HIDE_FROM_ABI
- deque& operator=(deque&& __c)
- _NOEXCEPT_(__alloc_traits::propagate_on_container_move_assignment::value &&
- is_nothrow_move_assignable<allocator_type>::value);
-
- _LIBCPP_HIDE_FROM_ABI
- void assign(initializer_list<value_type> __il) {assign(__il.begin(), __il.end());}
+ _LIBCPP_HIDE_FROM_ABI deque(initializer_list<value_type> __il);
+ _LIBCPP_HIDE_FROM_ABI deque(initializer_list<value_type> __il, const allocator_type& __a);
+
+ _LIBCPP_HIDE_FROM_ABI deque& operator=(initializer_list<value_type> __il) {
+ assign(__il);
+ return *this;
+ }
+
+ _LIBCPP_HIDE_FROM_ABI deque(deque&& __c) _NOEXCEPT_(is_nothrow_move_constructible<allocator_type>::value);
+ _LIBCPP_HIDE_FROM_ABI deque(deque&& __c, const __type_identity_t<allocator_type>& __a);
+ _LIBCPP_HIDE_FROM_ABI deque& operator=(deque&& __c)
+ _NOEXCEPT_(__alloc_traits::propagate_on_container_move_assignment::value&&
+ is_nothrow_move_assignable<allocator_type>::value);
+
+ _LIBCPP_HIDE_FROM_ABI void assign(initializer_list<value_type> __il) { assign(__il.begin(), __il.end()); }
#endif // _LIBCPP_CXX03_LANG
- template <class _InputIter, __enable_if_t<__has_input_iterator_category<_InputIter>::value &&
- !__has_random_access_iterator_category<_InputIter>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI void assign(_InputIter __f, _InputIter __l);
- template <class _RAIter, __enable_if_t<__has_random_access_iterator_category<_RAIter>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI void assign(_RAIter __f, _RAIter __l);
+ template <class _InputIter,
+ __enable_if_t<__has_input_iterator_category<_InputIter>::value &&
+ !__has_random_access_iterator_category<_InputIter>::value,
+ int> = 0>
+ _LIBCPP_HIDE_FROM_ABI void assign(_InputIter __f, _InputIter __l);
+ template <class _RAIter, __enable_if_t<__has_random_access_iterator_category<_RAIter>::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI void assign(_RAIter __f, _RAIter __l);
#if _LIBCPP_STD_VER >= 23
- template <_ContainerCompatibleRange<_Tp> _Range>
- _LIBCPP_HIDE_FROM_ABI
- void assign_range(_Range&& __range) {
- if constexpr (ranges::random_access_range<_Range>) {
- auto __n = static_cast<size_type>(ranges::distance(__range));
- __assign_with_size_random_access(ranges::begin(__range), __n);
+ template <_ContainerCompatibleRange<_Tp> _Range>
+ _LIBCPP_HIDE_FROM_ABI void assign_range(_Range&& __range) {
+ if constexpr (ranges::random_access_range<_Range>) {
+ auto __n = static_cast<size_type>(ranges::distance(__range));
+ __assign_with_size_random_access(ranges::begin(__range), __n);
- } else if constexpr (ranges::forward_range<_Range> || ranges::sized_range<_Range>) {
- auto __n = static_cast<size_type>(ranges::distance(__range));
- __assign_with_size(ranges::begin(__range), __n);
+ } else if constexpr (ranges::forward_range<_Range> || ranges::sized_range<_Range>) {
+ auto __n = static_cast<size_type>(ranges::distance(__range));
+ __assign_with_size(ranges::begin(__range), __n);
- } else {
- __assign_with_sentinel(ranges::begin(__range), ranges::end(__range));
- }
+ } else {
+ __assign_with_sentinel(ranges::begin(__range), ranges::end(__range));
}
+ }
#endif
- _LIBCPP_HIDE_FROM_ABI void assign(size_type __n, const value_type& __v);
+ _LIBCPP_HIDE_FROM_ABI void assign(size_type __n, const value_type& __v);
- _LIBCPP_HIDE_FROM_ABI
- allocator_type get_allocator() const _NOEXCEPT;
+ _LIBCPP_HIDE_FROM_ABI allocator_type get_allocator() const _NOEXCEPT;
_LIBCPP_HIDE_FROM_ABI allocator_type& __alloc() _NOEXCEPT { return __size_.second(); }
_LIBCPP_HIDE_FROM_ABI const allocator_type& __alloc() const _NOEXCEPT { return __size_.second(); }
// iterators:
_LIBCPP_HIDE_FROM_ABI iterator begin() _NOEXCEPT {
- __map_pointer __mp = __map_.begin() + __start_ / __block_size;
- return iterator(__mp, __map_.empty() ? 0 : *__mp + __start_ % __block_size);
+ __map_pointer __mp = __map_.begin() + __start_ / __block_size;
+ return iterator(__mp, __map_.empty() ? 0 : *__mp + __start_ % __block_size);
}
_LIBCPP_HIDE_FROM_ABI const_iterator begin() const _NOEXCEPT {
- __map_const_pointer __mp =
- static_cast<__map_const_pointer>(__map_.begin() + __start_ / __block_size);
- return const_iterator(__mp, __map_.empty() ? 0 : *__mp + __start_ % __block_size);
+ __map_const_pointer __mp = static_cast<__map_const_pointer>(__map_.begin() + __start_ / __block_size);
+ return const_iterator(__mp, __map_.empty() ? 0 : *__mp + __start_ % __block_size);
}
_LIBCPP_HIDE_FROM_ABI iterator end() _NOEXCEPT {
- size_type __p = size() + __start_;
- __map_pointer __mp = __map_.begin() + __p / __block_size;
- return iterator(__mp, __map_.empty() ? 0 : *__mp + __p % __block_size);
+ size_type __p = size() + __start_;
+ __map_pointer __mp = __map_.begin() + __p / __block_size;
+ return iterator(__mp, __map_.empty() ? 0 : *__mp + __p % __block_size);
}
_LIBCPP_HIDE_FROM_ABI const_iterator end() const _NOEXCEPT {
- size_type __p = size() + __start_;
- __map_const_pointer __mp = static_cast<__map_const_pointer>(__map_.begin() + __p / __block_size);
- return const_iterator(__mp, __map_.empty() ? 0 : *__mp + __p % __block_size);
- }
-
- _LIBCPP_HIDE_FROM_ABI
- reverse_iterator rbegin() _NOEXCEPT
- {return reverse_iterator(end());}
- _LIBCPP_HIDE_FROM_ABI
- const_reverse_iterator rbegin() const _NOEXCEPT
- {return const_reverse_iterator(end());}
- _LIBCPP_HIDE_FROM_ABI
- reverse_iterator rend() _NOEXCEPT
- {return reverse_iterator(begin());}
- _LIBCPP_HIDE_FROM_ABI
- const_reverse_iterator rend() const _NOEXCEPT
- {return const_reverse_iterator(begin());}
-
- _LIBCPP_HIDE_FROM_ABI
- const_iterator cbegin() const _NOEXCEPT
- {return begin();}
- _LIBCPP_HIDE_FROM_ABI
- const_iterator cend() const _NOEXCEPT
- {return end();}
- _LIBCPP_HIDE_FROM_ABI
- const_reverse_iterator crbegin() const _NOEXCEPT
- {return const_reverse_iterator(end());}
- _LIBCPP_HIDE_FROM_ABI
- const_reverse_iterator crend() const _NOEXCEPT
- {return const_reverse_iterator(begin());}
+ size_type __p = size() + __start_;
+ __map_const_pointer __mp = static_cast<__map_const_pointer>(__map_.begin() + __p / __block_size);
+ return const_iterator(__mp, __map_.empty() ? 0 : *__mp + __p % __block_size);
+ }
- // capacity:
- _LIBCPP_HIDE_FROM_ABI
- size_type size() const _NOEXCEPT {return __size();}
+ _LIBCPP_HIDE_FROM_ABI reverse_iterator rbegin() _NOEXCEPT { return reverse_iterator(end()); }
+ _LIBCPP_HIDE_FROM_ABI const_reverse_iterator rbegin() const _NOEXCEPT { return const_reverse_iterator(end()); }
+ _LIBCPP_HIDE_FROM_ABI reverse_iterator rend() _NOEXCEPT { return reverse_iterator(begin()); }
+ _LIBCPP_HIDE_FROM_ABI const_reverse_iterator rend() const _NOEXCEPT { return const_reverse_iterator(begin()); }
+
+ _LIBCPP_HIDE_FROM_ABI const_iterator cbegin() const _NOEXCEPT { return begin(); }
+ _LIBCPP_HIDE_FROM_ABI const_iterator cend() const _NOEXCEPT { return end(); }
+ _LIBCPP_HIDE_FROM_ABI const_reverse_iterator crbegin() const _NOEXCEPT { return const_reverse_iterator(end()); }
+ _LIBCPP_HIDE_FROM_ABI const_reverse_iterator crend() const _NOEXCEPT { return const_reverse_iterator(begin()); }
+
+ // capacity:
+ _LIBCPP_HIDE_FROM_ABI size_type size() const _NOEXCEPT { return __size(); }
_LIBCPP_HIDE_FROM_ABI size_type& __size() _NOEXCEPT { return __size_.first(); }
_LIBCPP_HIDE_FROM_ABI const size_type& __size() const _NOEXCEPT { return __size_.first(); }
- _LIBCPP_HIDE_FROM_ABI
- size_type max_size() const _NOEXCEPT
- {return std::min<size_type>(
- __alloc_traits::max_size(__alloc()),
- numeric_limits<difference_type>::max());}
- _LIBCPP_HIDE_FROM_ABI void resize(size_type __n);
- _LIBCPP_HIDE_FROM_ABI void resize(size_type __n, const value_type& __v);
- _LIBCPP_HIDE_FROM_ABI void shrink_to_fit() _NOEXCEPT;
- _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_HIDE_FROM_ABI
- bool empty() const _NOEXCEPT {return size() == 0;}
-
- // element access:
- _LIBCPP_HIDE_FROM_ABI
- reference operator[](size_type __i) _NOEXCEPT;
- _LIBCPP_HIDE_FROM_ABI
- const_reference operator[](size_type __i) const _NOEXCEPT;
- _LIBCPP_HIDE_FROM_ABI
- reference at(size_type __i);
- _LIBCPP_HIDE_FROM_ABI
- const_reference at(size_type __i) const;
- _LIBCPP_HIDE_FROM_ABI
- reference front() _NOEXCEPT;
- _LIBCPP_HIDE_FROM_ABI
- const_reference front() const _NOEXCEPT;
- _LIBCPP_HIDE_FROM_ABI
- reference back() _NOEXCEPT;
- _LIBCPP_HIDE_FROM_ABI
- const_reference back() const _NOEXCEPT;
-
- // 23.2.2.3 modifiers:
- _LIBCPP_HIDE_FROM_ABI void push_front(const value_type& __v);
- _LIBCPP_HIDE_FROM_ABI void push_back(const value_type& __v);
+ _LIBCPP_HIDE_FROM_ABI size_type max_size() const _NOEXCEPT {
+ return std::min<size_type>(__alloc_traits::max_size(__alloc()), numeric_limits<difference_type>::max());
+ }
+ _LIBCPP_HIDE_FROM_ABI void resize(size_type __n);
+ _LIBCPP_HIDE_FROM_ABI void resize(size_type __n, const value_type& __v);
+ _LIBCPP_HIDE_FROM_ABI void shrink_to_fit() _NOEXCEPT;
+ _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_HIDE_FROM_ABI bool empty() const _NOEXCEPT { return size() == 0; }
+
+ // element access:
+ _LIBCPP_HIDE_FROM_ABI reference operator[](size_type __i) _NOEXCEPT;
+ _LIBCPP_HIDE_FROM_ABI const_reference operator[](size_type __i) const _NOEXCEPT;
+ _LIBCPP_HIDE_FROM_ABI reference at(size_type __i);
+ _LIBCPP_HIDE_FROM_ABI const_reference at(size_type __i) const;
+ _LIBCPP_HIDE_FROM_ABI reference front() _NOEXCEPT;
+ _LIBCPP_HIDE_FROM_ABI const_reference front() const _NOEXCEPT;
+ _LIBCPP_HIDE_FROM_ABI reference back() _NOEXCEPT;
+ _LIBCPP_HIDE_FROM_ABI const_reference back() const _NOEXCEPT;
+
+ // 23.2.2.3 modifiers:
+ _LIBCPP_HIDE_FROM_ABI void push_front(const value_type& __v);
+ _LIBCPP_HIDE_FROM_ABI void push_back(const value_type& __v);
#ifndef _LIBCPP_CXX03_LANG
-#if _LIBCPP_STD_VER >= 17
- template <class... _Args> _LIBCPP_HIDE_FROM_ABI reference emplace_front(_Args&&... __args);
- template <class... _Args> _LIBCPP_HIDE_FROM_ABI reference emplace_back (_Args&&... __args);
-#else
- template <class... _Args> _LIBCPP_HIDE_FROM_ABI void emplace_front(_Args&&... __args);
- template <class... _Args> _LIBCPP_HIDE_FROM_ABI void emplace_back (_Args&&... __args);
-#endif
- template <class... _Args> _LIBCPP_HIDE_FROM_ABI iterator emplace(const_iterator __p, _Args&&... __args);
-
- _LIBCPP_HIDE_FROM_ABI void push_front(value_type&& __v);
- _LIBCPP_HIDE_FROM_ABI void push_back(value_type&& __v);
-
-#if _LIBCPP_STD_VER >= 23
- template <_ContainerCompatibleRange<_Tp> _Range>
- _LIBCPP_HIDE_FROM_ABI
- void prepend_range(_Range&& __range) {
- insert_range(begin(), std::forward<_Range>(__range));
- }
+# if _LIBCPP_STD_VER >= 17
+ template <class... _Args>
+ _LIBCPP_HIDE_FROM_ABI reference emplace_front(_Args&&... __args);
+ template <class... _Args>
+ _LIBCPP_HIDE_FROM_ABI reference emplace_back(_Args&&... __args);
+# else
+ template <class... _Args>
+ _LIBCPP_HIDE_FROM_ABI void emplace_front(_Args&&... __args);
+ template <class... _Args>
+ _LIBCPP_HIDE_FROM_ABI void emplace_back(_Args&&... __args);
+# endif
+ template <class... _Args>
+ _LIBCPP_HIDE_FROM_ABI iterator emplace(const_iterator __p, _Args&&... __args);
+
+ _LIBCPP_HIDE_FROM_ABI void push_front(value_type&& __v);
+ _LIBCPP_HIDE_FROM_ABI void push_back(value_type&& __v);
+
+# if _LIBCPP_STD_VER >= 23
+ template <_ContainerCompatibleRange<_Tp> _Range>
+ _LIBCPP_HIDE_FROM_ABI void prepend_range(_Range&& __range) {
+ insert_range(begin(), std::forward<_Range>(__range));
+ }
- template <_ContainerCompatibleRange<_Tp> _Range>
- _LIBCPP_HIDE_FROM_ABI
- void append_range(_Range&& __range) {
- insert_range(end(), std::forward<_Range>(__range));
- }
-#endif
+ template <_ContainerCompatibleRange<_Tp> _Range>
+ _LIBCPP_HIDE_FROM_ABI void append_range(_Range&& __range) {
+ insert_range(end(), std::forward<_Range>(__range));
+ }
+# endif
- _LIBCPP_HIDE_FROM_ABI iterator insert(const_iterator __p, value_type&& __v);
+ _LIBCPP_HIDE_FROM_ABI iterator insert(const_iterator __p, value_type&& __v);
- _LIBCPP_HIDE_FROM_ABI
- iterator insert(const_iterator __p, initializer_list<value_type> __il)
- {return insert(__p, __il.begin(), __il.end());}
+ _LIBCPP_HIDE_FROM_ABI iterator insert(const_iterator __p, initializer_list<value_type> __il) {
+ return insert(__p, __il.begin(), __il.end());
+ }
#endif // _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI iterator insert(const_iterator __p, const value_type& __v);
- _LIBCPP_HIDE_FROM_ABI iterator insert(const_iterator __p, size_type __n, const value_type& __v);
- template <class _InputIter, __enable_if_t<__has_exactly_input_iterator_category<_InputIter>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI iterator insert(const_iterator __p, _InputIter __f, _InputIter __l);
- template <class _ForwardIterator, __enable_if_t<__has_exactly_forward_iterator_category<_ForwardIterator>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI iterator insert(const_iterator __p, _ForwardIterator __f, _ForwardIterator __l);
- template <class _BiIter, __enable_if_t<__has_bidirectional_iterator_category<_BiIter>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI iterator insert(const_iterator __p, _BiIter __f, _BiIter __l);
+ _LIBCPP_HIDE_FROM_ABI iterator insert(const_iterator __p, const value_type& __v);
+ _LIBCPP_HIDE_FROM_ABI iterator insert(const_iterator __p, size_type __n, const value_type& __v);
+ template <class _InputIter, __enable_if_t<__has_exactly_input_iterator_category<_InputIter>::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI iterator insert(const_iterator __p, _InputIter __f, _InputIter __l);
+ template <class _ForwardIterator,
+ __enable_if_t<__has_exactly_forward_iterator_category<_ForwardIterator>::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI iterator insert(const_iterator __p, _ForwardIterator __f, _ForwardIterator __l);
+ template <class _BiIter, __enable_if_t<__has_bidirectional_iterator_category<_BiIter>::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI iterator insert(const_iterator __p, _BiIter __f, _BiIter __l);
#if _LIBCPP_STD_VER >= 23
- template <_ContainerCompatibleRange<_Tp> _Range>
- _LIBCPP_HIDE_FROM_ABI
- iterator insert_range(const_iterator __position, _Range&& __range) {
- if constexpr (ranges::bidirectional_range<_Range>) {
- auto __n = static_cast<size_type>(ranges::distance(__range));
- return __insert_bidirectional(__position, ranges::begin(__range), ranges::end(__range), __n);
+ template <_ContainerCompatibleRange<_Tp> _Range>
+ _LIBCPP_HIDE_FROM_ABI iterator insert_range(const_iterator __position, _Range&& __range) {
+ if constexpr (ranges::bidirectional_range<_Range>) {
+ auto __n = static_cast<size_type>(ranges::distance(__range));
+ return __insert_bidirectional(__position, ranges::begin(__range), ranges::end(__range), __n);
- } else if constexpr (ranges::forward_range<_Range> || ranges::sized_range<_Range>) {
- auto __n = static_cast<size_type>(ranges::distance(__range));
- return __insert_with_size(__position, ranges::begin(__range), __n);
+ } else if constexpr (ranges::forward_range<_Range> || ranges::sized_range<_Range>) {
+ auto __n = static_cast<size_type>(ranges::distance(__range));
+ return __insert_with_size(__position, ranges::begin(__range), __n);
- } else {
- return __insert_with_sentinel(__position, ranges::begin(__range), ranges::end(__range));
- }
+ } else {
+ return __insert_with_sentinel(__position, ranges::begin(__range), ranges::end(__range));
}
+ }
#endif
- _LIBCPP_HIDE_FROM_ABI void pop_front();
- _LIBCPP_HIDE_FROM_ABI void pop_back();
- _LIBCPP_HIDE_FROM_ABI iterator erase(const_iterator __p);
- _LIBCPP_HIDE_FROM_ABI iterator erase(const_iterator __f, const_iterator __l);
+ _LIBCPP_HIDE_FROM_ABI void pop_front();
+ _LIBCPP_HIDE_FROM_ABI void pop_back();
+ _LIBCPP_HIDE_FROM_ABI iterator erase(const_iterator __p);
+ _LIBCPP_HIDE_FROM_ABI iterator erase(const_iterator __f, const_iterator __l);
- _LIBCPP_HIDE_FROM_ABI
- void swap(deque& __c)
+ _LIBCPP_HIDE_FROM_ABI void swap(deque& __c)
#if _LIBCPP_STD_VER >= 14
- _NOEXCEPT;
+ _NOEXCEPT;
#else
- _NOEXCEPT_(!__alloc_traits::propagate_on_container_swap::value ||
- __is_nothrow_swappable<allocator_type>::value);
+ _NOEXCEPT_(!__alloc_traits::propagate_on_container_swap::value || __is_nothrow_swappable<allocator_type>::value);
#endif
- _LIBCPP_HIDE_FROM_ABI
- void clear() _NOEXCEPT;
-
- _LIBCPP_HIDE_FROM_ABI
- bool __invariants() const {
- if (!__map_.__invariants())
- return false;
- if (__map_.size() >= size_type(-1) / __block_size)
- return false;
- for (__map_const_iterator __i = __map_.begin(), __e = __map_.end();
- __i != __e; ++__i)
- if (*__i == nullptr)
- return false;
- if (__map_.size() != 0)
- {
- if (size() >= __map_.size() * __block_size)
- return false;
- if (__start_ >= __map_.size() * __block_size - size())
- return false;
- }
- else
- {
- if (size() != 0)
- return false;
- if (__start_ != 0)
- return false;
- }
- return true;
+ _LIBCPP_HIDE_FROM_ABI void clear() _NOEXCEPT;
+
+ _LIBCPP_HIDE_FROM_ABI bool __invariants() const {
+ if (!__map_.__invariants())
+ return false;
+ if (__map_.size() >= size_type(-1) / __block_size)
+ return false;
+ for (__map_const_iterator __i = __map_.begin(), __e = __map_.end(); __i != __e; ++__i)
+ if (*__i == nullptr)
+ return false;
+ if (__map_.size() != 0) {
+ if (size() >= __map_.size() * __block_size)
+ return false;
+ if (__start_ >= __map_.size() * __block_size - size())
+ return false;
+ } else {
+ if (size() != 0)
+ return false;
+ if (__start_ != 0)
+ return false;
}
+ return true;
+ }
- _LIBCPP_HIDE_FROM_ABI
- void __move_assign_alloc(deque& __c)
- _NOEXCEPT_(!__alloc_traits::propagate_on_container_move_assignment::value ||
- is_nothrow_move_assignable<allocator_type>::value)
- {__move_assign_alloc(__c, integral_constant<bool,
- __alloc_traits::propagate_on_container_move_assignment::value>());}
-
- _LIBCPP_HIDE_FROM_ABI
- void __move_assign_alloc(deque& __c, true_type)
- _NOEXCEPT_(is_nothrow_move_assignable<allocator_type>::value)
- {
- __alloc() = std::move(__c.__alloc());
- }
+ _LIBCPP_HIDE_FROM_ABI void __move_assign_alloc(deque& __c)
+ _NOEXCEPT_(!__alloc_traits::propagate_on_container_move_assignment::value ||
+ is_nothrow_move_assignable<allocator_type>::value) {
+ __move_assign_alloc(__c, integral_constant<bool, __alloc_traits::propagate_on_container_move_assignment::value>());
+ }
- _LIBCPP_HIDE_FROM_ABI
- void __move_assign_alloc(deque&, false_type) _NOEXCEPT
- {}
-
- _LIBCPP_HIDE_FROM_ABI
- void __move_assign(deque& __c)
- _NOEXCEPT_(__alloc_traits::propagate_on_container_move_assignment::value &&
- is_nothrow_move_assignable<allocator_type>::value)
- {
- __map_ = std::move(__c.__map_);
- __start_ = __c.__start_;
- __size() = __c.size();
- __move_assign_alloc(__c);
- __c.__start_ = __c.__size() = 0;
- }
+ _LIBCPP_HIDE_FROM_ABI void __move_assign_alloc(deque& __c, true_type)
+ _NOEXCEPT_(is_nothrow_move_assignable<allocator_type>::value) {
+ __alloc() = std::move(__c.__alloc());
+ }
- _LIBCPP_HIDE_FROM_ABI
- static size_type __recommend_blocks(size_type __n)
- {
- return __n / __block_size + (__n % __block_size != 0);
- }
- _LIBCPP_HIDE_FROM_ABI
- size_type __capacity() const
- {
- return __map_.size() == 0 ? 0 : __map_.size() * __block_size - 1;
- }
- _LIBCPP_HIDE_FROM_ABI
- size_type __block_count() const
- {
- return __map_.size();
- }
+ _LIBCPP_HIDE_FROM_ABI void __move_assign_alloc(deque&, false_type) _NOEXCEPT {}
- _LIBCPP_HIDE_FROM_ABI
- size_type __front_spare() const
- {
- return __start_;
- }
- _LIBCPP_HIDE_FROM_ABI
- size_type __front_spare_blocks() const {
- return __front_spare() / __block_size;
- }
- _LIBCPP_HIDE_FROM_ABI
- size_type __back_spare() const
- {
- return __capacity() - (__start_ + size());
- }
- _LIBCPP_HIDE_FROM_ABI
- size_type __back_spare_blocks() const {
- return __back_spare() / __block_size;
- }
+ _LIBCPP_HIDE_FROM_ABI void __move_assign(deque& __c)
+ _NOEXCEPT_(__alloc_traits::propagate_on_container_move_assignment::value&&
+ is_nothrow_move_assignable<allocator_type>::value) {
+ __map_ = std::move(__c.__map_);
+ __start_ = __c.__start_;
+ __size() = __c.size();
+ __move_assign_alloc(__c);
+ __c.__start_ = __c.__size() = 0;
+ }
- private:
- enum __asan_annotation_type {
- __asan_unposion,
- __asan_poison
- };
+ _LIBCPP_HIDE_FROM_ABI static size_type __recommend_blocks(size_type __n) {
+ return __n / __block_size + (__n % __block_size != 0);
+ }
+ _LIBCPP_HIDE_FROM_ABI size_type __capacity() const {
+ return __map_.size() == 0 ? 0 : __map_.size() * __block_size - 1;
+ }
+ _LIBCPP_HIDE_FROM_ABI size_type __block_count() const { return __map_.size(); }
- enum __asan_annotation_place {
- __asan_front_moved,
- __asan_back_moved,
- };
+ _LIBCPP_HIDE_FROM_ABI size_type __front_spare() const { return __start_; }
+ _LIBCPP_HIDE_FROM_ABI size_type __front_spare_blocks() const { return __front_spare() / __block_size; }
+ _LIBCPP_HIDE_FROM_ABI size_type __back_spare() const { return __capacity() - (__start_ + size()); }
+ _LIBCPP_HIDE_FROM_ABI size_type __back_spare_blocks() const { return __back_spare() / __block_size; }
-// The following functions are no-ops outside of AddressSanitizer mode.
-// We call annotations for every allocator, unless explicitly disabled.
-//
-// To disable annotations for a particular allocator, change value of
-// __asan_annotate_container_with_allocator to false.
-// For more details, see the "Using libc++" documentation page or
-// the documentation for __sanitizer_annotate_contiguous_container.
- _LIBCPP_HIDE_FROM_ABI void __annotate_double_ended_contiguous_container(
- const void* __beg,
- const void* __end,
- const void* __old_con_beg,
- const void* __old_con_end,
- const void* __new_con_beg,
- const void* __new_con_end) const {
- (void)__beg;
- (void)__end;
- (void)__old_con_beg;
- (void)__old_con_end;
- (void)__new_con_beg;
- (void)__new_con_end;
+private:
+ enum __asan_annotation_type { __asan_unposion, __asan_poison };
+
+ enum __asan_annotation_place {
+ __asan_front_moved,
+ __asan_back_moved,
+ };
+
+ // The following functions are no-ops outside of AddressSanitizer mode.
+ // We call annotations for every allocator, unless explicitly disabled.
+ //
+ // To disable annotations for a particular allocator, change value of
+ // __asan_annotate_container_with_allocator to false.
+ // For more details, see the "Using libc++" documentation page or
+ // the documentation for __sanitizer_annotate_contiguous_container.
+ _LIBCPP_HIDE_FROM_ABI void __annotate_double_ended_contiguous_container(
+ const void* __beg,
+ const void* __end,
+ const void* __old_con_beg,
+ const void* __old_con_end,
+ const void* __new_con_beg,
+ const void* __new_con_end) const {
+ (void)__beg;
+ (void)__end;
+ (void)__old_con_beg;
+ (void)__old_con_end;
+ (void)__new_con_beg;
+ (void)__new_con_end;
#ifndef _LIBCPP_HAS_NO_ASAN
- if (__beg != nullptr && __asan_annotate_container_with_allocator<_Allocator>::value)
- __sanitizer_annotate_double_ended_contiguous_container(
- __beg, __end, __old_con_beg, __old_con_end, __new_con_beg, __new_con_end);
+ if (__beg != nullptr && __asan_annotate_container_with_allocator<_Allocator>::value)
+ __sanitizer_annotate_double_ended_contiguous_container(
+ __beg, __end, __old_con_beg, __old_con_end, __new_con_beg, __new_con_end);
#endif
- }
+ }
- _LIBCPP_HIDE_FROM_ABI
- void __annotate_from_to(
- size_type __beg,
- size_type __end,
- __asan_annotation_type __annotation_type,
- __asan_annotation_place __place) const _NOEXCEPT {
- (void)__beg;
- (void)__end;
- (void)__annotation_type;
- (void)__place;
+ _LIBCPP_HIDE_FROM_ABI void __annotate_from_to(
+ size_type __beg,
+ size_type __end,
+ __asan_annotation_type __annotation_type,
+ __asan_annotation_place __place) const _NOEXCEPT {
+ (void)__beg;
+ (void)__end;
+ (void)__annotation_type;
+ (void)__place;
#ifndef _LIBCPP_HAS_NO_ASAN
- // __beg - index of the first item to annotate
- // __end - index behind the last item to annotate (so last item + 1)
- // __annotation_type - __asan_unposion or __asan_poison
- // __place - __asan_front_moved or __asan_back_moved
- // Note: All indexes in __map_
- if (__beg == __end)
- return;
- // __annotations_beg_map - first chunk which annotations we want to modify
- // __annotations_end_map - last chunk which annotations we want to modify
- // NOTE: if __end % __block_size == 0, __annotations_end_map points at the next block, which may not exist
- __map_const_iterator __annotations_beg_map = __map_.begin() + __beg / __block_size;
- __map_const_iterator __annotations_end_map = __map_.begin() + __end / __block_size;
-
- bool const __poisoning = __annotation_type == __asan_poison;
- // __old_c_beg_index - index of the first element in old container
- // __old_c_end_index - index of the end of old container (last + 1)
- // Note: may be outside the area we are annotating
- size_t __old_c_beg_index = (__poisoning && __place == __asan_front_moved) ? __beg : __start_;
- size_t __old_c_end_index = (__poisoning && __place == __asan_back_moved) ? __end : __start_ + size();
- bool const __front = __place == __asan_front_moved;
-
- if (__poisoning && empty()) {
- // Special case: we shouldn't trust __start_
- __old_c_beg_index = __beg;
- __old_c_end_index = __end;
- }
- // __old_c_beg_map - memory block (chunk) with first element
- // __old_c_end_map - memory block (chunk) with end of old container
- // Note: if __old_c_end_index % __block_size == 0, __old_c_end_map points at the next block,
- // which may not exist
- __map_const_iterator __old_c_beg_map = __map_.begin() + __old_c_beg_index / __block_size;
- __map_const_iterator __old_c_end_map = __map_.begin() + __old_c_end_index / __block_size;
-
- // One edge (front/end) of the container was moved and one was not modified.
- // __new_edge_index - index of new edge
- // __new_edge_map - memory block (chunk) with new edge, it always equals to
- // __annotations_beg_map or __annotations_end_map
- // __old_edge_map - memory block (chunk) with old edge, it always equals to
- // __old_c_beg_map or __old_c_end_map
- size_t __new_edge_index = (__poisoning ^ __front) ? __beg : __end;
- __map_const_iterator __new_edge_map = __map_.begin() + __new_edge_index / __block_size;
- __map_const_iterator __old_edge_map = __front ? __old_c_end_map : __old_c_beg_map;
-
- // We iterate over map pointers (chunks) and fully poison all memory blocks between the first and the last.
- // First and last chunk may be partially poisoned.
- // __annotate_end_map may point at not existing chunk, therefore we have to have a check for it.
- for (__map_const_iterator __map_it = __annotations_beg_map; __map_it <= __annotations_end_map; ++__map_it) {
- if (__map_it == __annotations_end_map && __end % __block_size == 0)
- // Chunk may not exist, but nothing to do here anyway
- break;
-
- // The beginning and the end of the current memory block
- const void* __mem_beg = std::__to_address(*__map_it);
- const void* __mem_end = std::__to_address(*__map_it + __block_size);
-
- // The beginning of memory-in-use in the memory block before container modification
- const void* __old_beg =
- (__map_it == __old_c_beg_map) ? std::__to_address(*__map_it + (__old_c_beg_index % __block_size)) : __mem_beg;
-
- // The end of memory-in-use in the memory block before container modification
- const void* __old_end;
- if (__map_it < __old_c_beg_map || __map_it > __old_c_end_map || (!__poisoning && empty()))
- __old_end = __old_beg;
- else
- __old_end = (__map_it == __old_c_end_map) ? std::__to_address(*__map_it + (__old_c_end_index % __block_size))
- : __mem_end;
-
- // New edge of the container in current memory block
- // If the edge is in a different chunk it points on corresponding end of the memory block
- const void* __new_edge;
- if (__map_it == __new_edge_map)
- __new_edge = std::__to_address(*__map_it + (__new_edge_index % __block_size));
- else
- __new_edge = (__poisoning ^ __front) ? __mem_beg : __mem_end;
-
- // Not modified edge of the container
- // If the edge is in a different chunk it points on corresponding end of the memory block
- const void* __old_edge;
- if (__map_it == __old_edge_map)
- __old_edge = __front ? __old_end : __old_beg;
- else
- __old_edge = __front ? __mem_end : __mem_beg;
-
- // __new_beg - the beginning of memory-in-use in the memory block after container modification
- // __new_end - the end of memory-in-use in the memory block after container modification
- const void* __new_beg = __front ? __new_edge : __old_edge;
- const void* __new_end = __front ? __old_edge : __new_edge;
-
- __annotate_double_ended_contiguous_container(__mem_beg, __mem_end, __old_beg, __old_end, __new_beg, __new_end);
- }
-#endif // !_LIBCPP_HAS_NO_ASAN
- }
+ // __beg - index of the first item to annotate
+ // __end - index behind the last item to annotate (so last item + 1)
+ // __annotation_type - __asan_unposion or __asan_poison
+ // __place - __asan_front_moved or __asan_back_moved
+ // Note: All indexes in __map_
+ if (__beg == __end)
+ return;
+ // __annotations_beg_map - first chunk which annotations we want to modify
+ // __annotations_end_map - last chunk which annotations we want to modify
+ // NOTE: if __end % __block_size == 0, __annotations_end_map points at the next block, which may not exist
+ __map_const_iterator __annotations_beg_map = __map_.begin() + __beg / __block_size;
+ __map_const_iterator __annotations_end_map = __map_.begin() + __end / __block_size;
+
+ bool const __poisoning = __annotation_type == __asan_poison;
+ // __old_c_beg_index - index of the first element in old container
+ // __old_c_end_index - index of the end of old container (last + 1)
+ // Note: may be outside the area we are annotating
+ size_t __old_c_beg_index = (__poisoning && __place == __asan_front_moved) ? __beg : __start_;
+ size_t __old_c_end_index = (__poisoning && __place == __asan_back_moved) ? __end : __start_ + size();
+ bool const __front = __place == __asan_front_moved;
+
+ if (__poisoning && empty()) {
+ // Special case: we shouldn't trust __start_
+ __old_c_beg_index = __beg;
+ __old_c_end_index = __end;
+ }
+ // __old_c_beg_map - memory block (chunk) with first element
+ // __old_c_end_map - memory block (chunk) with end of old container
+ // Note: if __old_c_end_index % __block_size == 0, __old_c_end_map points at the next block,
+ // which may not exist
+ __map_const_iterator __old_c_beg_map = __map_.begin() + __old_c_beg_index / __block_size;
+ __map_const_iterator __old_c_end_map = __map_.begin() + __old_c_end_index / __block_size;
+
+ // One edge (front/end) of the container was moved and one was not modified.
+ // __new_edge_index - index of new edge
+ // __new_edge_map - memory block (chunk) with new edge, it always equals to
+ // __annotations_beg_map or __annotations_end_map
+ // __old_edge_map - memory block (chunk) with old edge, it always equals to
+ // __old_c_beg_map or __old_c_end_map
+ size_t __new_edge_index = (__poisoning ^ __front) ? __beg : __end;
+ __map_const_iterator __new_edge_map = __map_.begin() + __new_edge_index / __block_size;
+ __map_const_iterator __old_edge_map = __front ? __old_c_end_map : __old_c_beg_map;
+
+ // We iterate over map pointers (chunks) and fully poison all memory blocks between the first and the last.
+ // First and last chunk may be partially poisoned.
+ // __annotate_end_map may point at not existing chunk, therefore we have to have a check for it.
+ for (__map_const_iterator __map_it = __annotations_beg_map; __map_it <= __annotations_end_map; ++__map_it) {
+ if (__map_it == __annotations_end_map && __end % __block_size == 0)
+ // Chunk may not exist, but nothing to do here anyway
+ break;
- _LIBCPP_HIDE_FROM_ABI
- void __annotate_new(size_type __current_size) const _NOEXCEPT {
- if (__current_size == 0)
- __annotate_from_to(0, __map_.size() * __block_size, __asan_poison, __asan_back_moved);
- else {
- __annotate_from_to(0, __start_, __asan_poison, __asan_front_moved);
- __annotate_from_to(__start_ + __current_size, __map_.size() * __block_size, __asan_poison, __asan_back_moved);
- }
+ // The beginning and the end of the current memory block
+ const void* __mem_beg = std::__to_address(*__map_it);
+ const void* __mem_end = std::__to_address(*__map_it + __block_size);
+
+ // The beginning of memory-in-use in the memory block before container modification
+ const void* __old_beg =
+ (__map_it == __old_c_beg_map) ? std::__to_address(*__map_it + (__old_c_beg_index % __block_size)) : __mem_beg;
+
+ // The end of memory-in-use in the memory block before container modification
+ const void* __old_end;
+ if (__map_it < __old_c_beg_map || __map_it > __old_c_end_map || (!__poisoning && empty()))
+ __old_end = __old_beg;
+ else
+ __old_end = (__map_it == __old_c_end_map)
+ ? std::__to_address(*__map_it + (__old_c_end_index % __block_size))
+ : __mem_end;
+
+ // New edge of the container in current memory block
+ // If the edge is in a different chunk it points on corresponding end of the memory block
+ const void* __new_edge;
+ if (__map_it == __new_edge_map)
+ __new_edge = std::__to_address(*__map_it + (__new_edge_index % __block_size));
+ else
+ __new_edge = (__poisoning ^ __front) ? __mem_beg : __mem_end;
+
+ // Not modified edge of the container
+ // If the edge is in a different chunk it points on corresponding end of the memory block
+ const void* __old_edge;
+ if (__map_it == __old_edge_map)
+ __old_edge = __front ? __old_end : __old_beg;
+ else
+ __old_edge = __front ? __mem_end : __mem_beg;
+
+ // __new_beg - the beginning of memory-in-use in the memory block after container modification
+ // __new_end - the end of memory-in-use in the memory block after container modification
+ const void* __new_beg = __front ? __new_edge : __old_edge;
+ const void* __new_end = __front ? __old_edge : __new_edge;
+
+ __annotate_double_ended_contiguous_container(__mem_beg, __mem_end, __old_beg, __old_end, __new_beg, __new_end);
}
+#endif // !_LIBCPP_HAS_NO_ASAN
+ }
- _LIBCPP_HIDE_FROM_ABI
- void __annotate_delete() const _NOEXCEPT {
- if (empty()) {
- for(size_t __i = 0; __i < __map_.size(); ++__i) {
- __annotate_whole_block(__i, __asan_unposion);
- }
- }
- else {
- __annotate_from_to(0, __start_, __asan_unposion, __asan_front_moved);
- __annotate_from_to(__start_ + size(), __map_.size() * __block_size, __asan_unposion, __asan_back_moved);
- }
+ _LIBCPP_HIDE_FROM_ABI void __annotate_new(size_type __current_size) const _NOEXCEPT {
+ (void)__current_size;
+#ifndef _LIBCPP_HAS_NO_ASAN
+ if (__current_size == 0)
+ __annotate_from_to(0, __map_.size() * __block_size, __asan_poison, __asan_back_moved);
+ else {
+ __annotate_from_to(0, __start_, __asan_poison, __asan_front_moved);
+ __annotate_from_to(__start_ + __current_size, __map_.size() * __block_size, __asan_poison, __asan_back_moved);
}
+#endif
+ }
- _LIBCPP_HIDE_FROM_ABI
- void __annotate_increase_front(size_type __n) const _NOEXCEPT {
- __annotate_from_to(__start_ - __n, __start_, __asan_unposion, __asan_front_moved);
+ _LIBCPP_HIDE_FROM_ABI void __annotate_delete() const _NOEXCEPT {
+#ifndef _LIBCPP_HAS_NO_ASAN
+ if (empty()) {
+ for (size_t __i = 0; __i < __map_.size(); ++__i) {
+ __annotate_whole_block(__i, __asan_unposion);
+ }
+ } else {
+ __annotate_from_to(0, __start_, __asan_unposion, __asan_front_moved);
+ __annotate_from_to(__start_ + size(), __map_.size() * __block_size, __asan_unposion, __asan_back_moved);
}
+#endif
+ }
- _LIBCPP_HIDE_FROM_ABI
- void __annotate_increase_back(size_type __n) const _NOEXCEPT {
- __annotate_from_to(__start_ + size(), __start_ + size() + __n, __asan_unposion, __asan_back_moved);
- }
+ _LIBCPP_HIDE_FROM_ABI void __annotate_increase_front(size_type __n) const _NOEXCEPT {
+ (void)__n;
+#ifndef _LIBCPP_HAS_NO_ASAN
+ __annotate_from_to(__start_ - __n, __start_, __asan_unposion, __asan_front_moved);
+#endif
+ }
- _LIBCPP_HIDE_FROM_ABI
- void __annotate_shrink_front(size_type __old_size, size_type __old_start) const _NOEXCEPT {
- __annotate_from_to(__old_start, __old_start + (__old_size - size()), __asan_poison, __asan_front_moved);
- }
+ _LIBCPP_HIDE_FROM_ABI void __annotate_increase_back(size_type __n) const _NOEXCEPT {
+ (void)__n;
+#ifndef _LIBCPP_HAS_NO_ASAN
+ __annotate_from_to(__start_ + size(), __start_ + size() + __n, __asan_unposion, __asan_back_moved);
+#endif
+ }
- _LIBCPP_HIDE_FROM_ABI
- void __annotate_shrink_back(size_type __old_size, size_type __old_start) const _NOEXCEPT {
- __annotate_from_to(__old_start + size(), __old_start + __old_size, __asan_poison, __asan_back_moved);
- }
+ _LIBCPP_HIDE_FROM_ABI void __annotate_shrink_front(size_type __old_size, size_type __old_start) const _NOEXCEPT {
+ (void)__old_size;
+ (void)__old_start;
+#ifndef _LIBCPP_HAS_NO_ASAN
+ __annotate_from_to(__old_start, __old_start + (__old_size - size()), __asan_poison, __asan_front_moved);
+#endif
+ }
- _LIBCPP_HIDE_FROM_ABI
- void __annotate_poison_block(const void *__beginning, const void *__end) const _NOEXCEPT {
- __annotate_double_ended_contiguous_container(__beginning, __end, __beginning, __end, __end, __end);
- }
+ _LIBCPP_HIDE_FROM_ABI void __annotate_shrink_back(size_type __old_size, size_type __old_start) const _NOEXCEPT {
+ (void)__old_size;
+ (void)__old_start;
+#ifndef _LIBCPP_HAS_NO_ASAN
+ __annotate_from_to(__old_start + size(), __old_start + __old_size, __asan_poison, __asan_back_moved);
+#endif
+ }
- _LIBCPP_HIDE_FROM_ABI
- void __annotate_whole_block(size_t __block_index, __asan_annotation_type __annotation_type) const _NOEXCEPT {
- __map_const_iterator __block_it = __map_.begin() + __block_index;
- const void* __block_start = std::__to_address(*__block_it);
- const void* __block_end = std::__to_address(*__block_it + __block_size);
-
- if(__annotation_type == __asan_poison)
- __annotate_poison_block(__block_start, __block_end);
- else {
- __annotate_double_ended_contiguous_container(
- __block_start, __block_end, __block_start, __block_start, __block_start, __block_end);
- }
+ _LIBCPP_HIDE_FROM_ABI void __annotate_poison_block(const void* __beginning, const void* __end) const _NOEXCEPT {
+ (void)__beginning;
+ (void)__end;
+#ifndef _LIBCPP_HAS_NO_ASAN
+ __annotate_double_ended_contiguous_container(__beginning, __end, __beginning, __end, __end, __end);
+#endif
+ }
+
+ _LIBCPP_HIDE_FROM_ABI void
+ __annotate_whole_block(size_t __block_index, __asan_annotation_type __annotation_type) const _NOEXCEPT {
+ (void)__block_index;
+ (void)__annotation_type;
+#ifndef _LIBCPP_HAS_NO_ASAN
+ __map_const_iterator __block_it = __map_.begin() + __block_index;
+ const void* __block_start = std::__to_address(*__block_it);
+ const void* __block_end = std::__to_address(*__block_it + __block_size);
+
+ if (__annotation_type == __asan_poison)
+ __annotate_poison_block(__block_start, __block_end);
+ else {
+ __annotate_double_ended_contiguous_container(
+ __block_start, __block_end, __block_start, __block_start, __block_start, __block_end);
}
+#endif
+ }
#if !defined(_LIBCPP_HAS_NO_ASAN)
- public:
- _LIBCPP_HIDE_FROM_ABI
- bool __verify_asan_annotations() const _NOEXCEPT {
- // This function tests deque object annotations.
- if (empty()) {
- for (__map_const_iterator __it = __map_.begin(); __it != __map_.end(); ++__it) {
- if (!__sanitizer_verify_double_ended_contiguous_container(
- std::__to_address(*__it),
- std::__to_address(*__it),
- std::__to_address(*__it),
- std::__to_address(*__it + __block_size)))
- return false;
- }
-
- return true;
- }
+public:
+ _LIBCPP_HIDE_FROM_ABI bool __verify_asan_annotations() const _NOEXCEPT {
+ // This function tests deque object annotations.
+ if (empty()) {
+ for (__map_const_iterator __it = __map_.begin(); __it != __map_.end(); ++__it) {
+ if (!__sanitizer_verify_double_ended_contiguous_container(
+ std::__to_address(*__it),
+ std::__to_address(*__it),
+ std::__to_address(*__it),
+ std::__to_address(*__it + __block_size)))
+ return false;
+ }
- size_type __end = __start_ + size();
- __map_const_iterator __first_mp = __map_.begin() + __start_ / __block_size;
- __map_const_iterator __last_mp = __map_.begin() + (__end - 1) / __block_size;
-
- // Pointers to first and after last elements
- // Those can be in different deque blocks
- const void* __p_beg = std::__to_address(*__first_mp + (__start_ % __block_size));
- const void* __p_end =
- std::__to_address(*__last_mp + ((__end % __block_size == 0) ? __block_size : __end % __block_size));
-
- for (__map_const_iterator __it = __map_.begin(); __it != __map_.end(); ++__it) {
- // Go over all blocks, find the place we are in and verify its annotations
- // Note that __p_end points *behind* the last item.
-
- // - blocks before the first block with container elements
- // - first block with items
- // - last block with items
- // - blocks after last block with ciontainer elements
-
- // Is the block before or after deque blocks that contain elements?
- if (__it < __first_mp || __it > __last_mp) {
- if (!__sanitizer_verify_double_ended_contiguous_container(
- std::__to_address(*__it),
- std::__to_address(*__it),
- std::__to_address(*__it),
- std::__to_address(*__it + __block_size)))
- return false;
- } else {
- const void* __containers_buffer_beg = (__it == __first_mp) ? __p_beg : (const void*)std::__to_address(*__it);
- const void* __containers_buffer_end =
- (__it == __last_mp) ? __p_end : (const void*)std::__to_address(*__it + __block_size);
- if (!__sanitizer_verify_double_ended_contiguous_container(
- std::__to_address(*__it),
- __containers_buffer_beg,
- __containers_buffer_end,
- std::__to_address(*__it + __block_size))) {
- return false;
- }
- }
- }
- return true;
+ return true;
}
- private:
-#endif // _LIBCPP_VERIFY_ASAN_DEQUE_ANNOTATIONS
- _LIBCPP_HIDE_FROM_ABI
- bool __maybe_remove_front_spare(bool __keep_one = true) {
- if (__front_spare_blocks() >= 2 || (!__keep_one && __front_spare_blocks())) {
- __annotate_whole_block(0, __asan_unposion);
- __alloc_traits::deallocate(__alloc(), __map_.front(),
- __block_size);
- __map_.pop_front();
- __start_ -= __block_size;
- return true;
+ size_type __end = __start_ + size();
+ __map_const_iterator __first_mp = __map_.begin() + __start_ / __block_size;
+ __map_const_iterator __last_mp = __map_.begin() + (__end - 1) / __block_size;
+
+ // Pointers to first and after last elements
+ // Those can be in different deque blocks
+ const void* __p_beg = std::__to_address(*__first_mp + (__start_ % __block_size));
+ const void* __p_end =
+ std::__to_address(*__last_mp + ((__end % __block_size == 0) ? __block_size : __end % __block_size));
+
+ for (__map_const_iterator __it = __map_.begin(); __it != __map_.end(); ++__it) {
+ // Go over all blocks, find the place we are in and verify its annotations
+ // Note that __p_end points *behind* the last item.
+
+ // - blocks before the first block with container elements
+ // - first block with items
+ // - last block with items
+ // - blocks after last block with ciontainer elements
+
+ // Is the block before or after deque blocks that contain elements?
+ if (__it < __first_mp || __it > __last_mp) {
+ if (!__sanitizer_verify_double_ended_contiguous_container(
+ std::__to_address(*__it),
+ std::__to_address(*__it),
+ std::__to_address(*__it),
+ std::__to_address(*__it + __block_size)))
+ return false;
+ } else {
+ const void* __containers_buffer_beg = (__it == __first_mp) ? __p_beg : (const void*)std::__to_address(*__it);
+ const void* __containers_buffer_end =
+ (__it == __last_mp) ? __p_end : (const void*)std::__to_address(*__it + __block_size);
+ if (!__sanitizer_verify_double_ended_contiguous_container(
+ std::__to_address(*__it),
+ __containers_buffer_beg,
+ __containers_buffer_end,
+ std::__to_address(*__it + __block_size))) {
+ return false;
+ }
}
- return false;
}
+ return true;
+ }
- _LIBCPP_HIDE_FROM_ABI
- bool __maybe_remove_back_spare(bool __keep_one = true) {
- if (__back_spare_blocks() >= 2 || (!__keep_one && __back_spare_blocks())) {
- __annotate_whole_block(__map_.size() - 1, __asan_unposion);
- __alloc_traits::deallocate(__alloc(), __map_.back(),
- __block_size);
- __map_.pop_back();
- return true;
- }
- return false;
+private:
+#endif // _LIBCPP_VERIFY_ASAN_DEQUE_ANNOTATIONS
+ _LIBCPP_HIDE_FROM_ABI bool __maybe_remove_front_spare(bool __keep_one = true) {
+ if (__front_spare_blocks() >= 2 || (!__keep_one && __front_spare_blocks())) {
+ __annotate_whole_block(0, __asan_unposion);
+ __alloc_traits::deallocate(__alloc(), __map_.front(), __block_size);
+ __map_.pop_front();
+ __start_ -= __block_size;
+ return true;
+ }
+ return false;
+ }
+
+ _LIBCPP_HIDE_FROM_ABI bool __maybe_remove_back_spare(bool __keep_one = true) {
+ if (__back_spare_blocks() >= 2 || (!__keep_one && __back_spare_blocks())) {
+ __annotate_whole_block(__map_.size() - 1, __asan_unposion);
+ __alloc_traits::deallocate(__alloc(), __map_.back(), __block_size);
+ __map_.pop_back();
+ return true;
}
+ return false;
+ }
- template <class _Iterator, class _Sentinel>
- _LIBCPP_HIDE_FROM_ABI
- void __assign_with_sentinel(_Iterator __f, _Sentinel __l);
-
- template <class _RandomAccessIterator>
- _LIBCPP_HIDE_FROM_ABI
- void __assign_with_size_random_access(_RandomAccessIterator __f, difference_type __n);
- template <class _Iterator>
- _LIBCPP_HIDE_FROM_ABI
- void __assign_with_size(_Iterator __f, difference_type __n);
-
- template <class _Iterator, class _Sentinel>
- _LIBCPP_HIDE_FROM_ABI
- iterator __insert_with_sentinel(const_iterator __p, _Iterator __f, _Sentinel __l);
-
- template <class _Iterator>
- _LIBCPP_HIDE_FROM_ABI
- iterator __insert_with_size(const_iterator __p, _Iterator __f, size_type __n);
-
- template <class _BiIter, class _Sentinel>
- _LIBCPP_HIDE_FROM_ABI
- iterator __insert_bidirectional(const_iterator __p, _BiIter __f, _Sentinel __sent, size_type __n);
- template <class _BiIter>
- _LIBCPP_HIDE_FROM_ABI
- iterator __insert_bidirectional(const_iterator __p, _BiIter __f, _BiIter __l, size_type __n);
-
- template <class _InpIter, __enable_if_t<__has_exactly_input_iterator_category<_InpIter>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI void __append(_InpIter __f, _InpIter __l);
- template <class _ForIter, __enable_if_t<__has_forward_iterator_category<_ForIter>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI void __append(_ForIter __f, _ForIter __l);
-
- template <class _InputIterator>
- _LIBCPP_HIDE_FROM_ABI void __append_with_size(_InputIterator __from, size_type __n);
- template <class _InputIterator, class _Sentinel>
- _LIBCPP_HIDE_FROM_ABI void __append_with_sentinel(_InputIterator __f, _Sentinel __l);
-
- _LIBCPP_HIDE_FROM_ABI void __append(size_type __n);
- _LIBCPP_HIDE_FROM_ABI void __append(size_type __n, const value_type& __v);
- _LIBCPP_HIDE_FROM_ABI void __erase_to_end(const_iterator __f);
- _LIBCPP_HIDE_FROM_ABI void __add_front_capacity();
- _LIBCPP_HIDE_FROM_ABI void __add_front_capacity(size_type __n);
- _LIBCPP_HIDE_FROM_ABI void __add_back_capacity();
- _LIBCPP_HIDE_FROM_ABI void __add_back_capacity(size_type __n);
- _LIBCPP_HIDE_FROM_ABI iterator __move_and_check(iterator __f, iterator __l, iterator __r,
- const_pointer& __vt);
- _LIBCPP_HIDE_FROM_ABI iterator __move_backward_and_check(iterator __f, iterator __l, iterator __r,
- const_pointer& __vt);
- _LIBCPP_HIDE_FROM_ABI void __move_construct_and_check(iterator __f, iterator __l,
- iterator __r, const_pointer& __vt);
- _LIBCPP_HIDE_FROM_ABI void __move_construct_backward_and_check(iterator __f, iterator __l,
- iterator __r, const_pointer& __vt);
-
- _LIBCPP_HIDE_FROM_ABI
- void __copy_assign_alloc(const deque& __c)
- {__copy_assign_alloc(__c, integral_constant<bool,
- __alloc_traits::propagate_on_container_copy_assignment::value>());}
-
- _LIBCPP_HIDE_FROM_ABI
- void __copy_assign_alloc(const deque& __c, true_type)
- {
- if (__alloc() != __c.__alloc())
- {
- clear();
- shrink_to_fit();
- }
- __alloc() = __c.__alloc();
- __map_.__alloc() = __c.__map_.__alloc();
- }
+ template <class _Iterator, class _Sentinel>
+ _LIBCPP_HIDE_FROM_ABI void __assign_with_sentinel(_Iterator __f, _Sentinel __l);
+
+ template <class _RandomAccessIterator>
+ _LIBCPP_HIDE_FROM_ABI void __assign_with_size_random_access(_RandomAccessIterator __f, difference_type __n);
+ template <class _Iterator>
+ _LIBCPP_HIDE_FROM_ABI void __assign_with_size(_Iterator __f, difference_type __n);
+
+ template <class _Iterator, class _Sentinel>
+ _LIBCPP_HIDE_FROM_ABI iterator __insert_with_sentinel(const_iterator __p, _Iterator __f, _Sentinel __l);
+
+ template <class _Iterator>
+ _LIBCPP_HIDE_FROM_ABI iterator __insert_with_size(const_iterator __p, _Iterator __f, size_type __n);
+
+ template <class _BiIter, class _Sentinel>
+ _LIBCPP_HIDE_FROM_ABI iterator
+ __insert_bidirectional(const_iterator __p, _BiIter __f, _Sentinel __sent, size_type __n);
+ template <class _BiIter>
+ _LIBCPP_HIDE_FROM_ABI iterator __insert_bidirectional(const_iterator __p, _BiIter __f, _BiIter __l, size_type __n);
+
+ template <class _InpIter, __enable_if_t<__has_exactly_input_iterator_category<_InpIter>::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI void __append(_InpIter __f, _InpIter __l);
+ template <class _ForIter, __enable_if_t<__has_forward_iterator_category<_ForIter>::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI void __append(_ForIter __f, _ForIter __l);
+
+ template <class _InputIterator>
+ _LIBCPP_HIDE_FROM_ABI void __append_with_size(_InputIterator __from, size_type __n);
+ template <class _InputIterator, class _Sentinel>
+ _LIBCPP_HIDE_FROM_ABI void __append_with_sentinel(_InputIterator __f, _Sentinel __l);
+
+ _LIBCPP_HIDE_FROM_ABI void __append(size_type __n);
+ _LIBCPP_HIDE_FROM_ABI void __append(size_type __n, const value_type& __v);
+ _LIBCPP_HIDE_FROM_ABI void __erase_to_end(const_iterator __f);
+ _LIBCPP_HIDE_FROM_ABI void __add_front_capacity();
+ _LIBCPP_HIDE_FROM_ABI void __add_front_capacity(size_type __n);
+ _LIBCPP_HIDE_FROM_ABI void __add_back_capacity();
+ _LIBCPP_HIDE_FROM_ABI void __add_back_capacity(size_type __n);
+ _LIBCPP_HIDE_FROM_ABI iterator __move_and_check(iterator __f, iterator __l, iterator __r, const_pointer& __vt);
+ _LIBCPP_HIDE_FROM_ABI iterator
+ __move_backward_and_check(iterator __f, iterator __l, iterator __r, const_pointer& __vt);
+ _LIBCPP_HIDE_FROM_ABI void __move_construct_and_check(iterator __f, iterator __l, iterator __r, const_pointer& __vt);
+ _LIBCPP_HIDE_FROM_ABI void
+ __move_construct_backward_and_check(iterator __f, iterator __l, iterator __r, const_pointer& __vt);
+
+ _LIBCPP_HIDE_FROM_ABI void __copy_assign_alloc(const deque& __c) {
+ __copy_assign_alloc(__c, integral_constant<bool, __alloc_traits::propagate_on_container_copy_assignment::value>());
+ }
- _LIBCPP_HIDE_FROM_ABI
- void __copy_assign_alloc(const deque&, false_type)
- {}
+ _LIBCPP_HIDE_FROM_ABI void __copy_assign_alloc(const deque& __c, true_type) {
+ if (__alloc() != __c.__alloc()) {
+ clear();
+ shrink_to_fit();
+ }
+ __alloc() = __c.__alloc();
+ __map_.__alloc() = __c.__map_.__alloc();
+ }
+
+ _LIBCPP_HIDE_FROM_ABI void __copy_assign_alloc(const deque&, false_type) {}
- _LIBCPP_HIDE_FROM_ABI void __move_assign(deque& __c, true_type)
- _NOEXCEPT_(is_nothrow_move_assignable<allocator_type>::value);
- _LIBCPP_HIDE_FROM_ABI void __move_assign(deque& __c, false_type);
+ _LIBCPP_HIDE_FROM_ABI void __move_assign(deque& __c, true_type)
+ _NOEXCEPT_(is_nothrow_move_assignable<allocator_type>::value);
+ _LIBCPP_HIDE_FROM_ABI void __move_assign(deque& __c, false_type);
};
template <class _Tp, class _Alloc>
@@ -1323,245 +1230,198 @@ _LIBCPP_CONSTEXPR const typename allocator_traits<_Alloc>::difference_type deque
__deque_block_size<value_type, difference_type>::value;
#if _LIBCPP_STD_VER >= 17
-template<class _InputIterator,
- class _Alloc = allocator<__iter_value_type<_InputIterator>>,
- class = enable_if_t<__has_input_iterator_category<_InputIterator>::value>,
- class = enable_if_t<__is_allocator<_Alloc>::value>
- >
-deque(_InputIterator, _InputIterator)
- -> deque<__iter_value_type<_InputIterator>, _Alloc>;
-
-template<class _InputIterator,
- class _Alloc,
- class = enable_if_t<__has_input_iterator_category<_InputIterator>::value>,
- class = enable_if_t<__is_allocator<_Alloc>::value>
- >
-deque(_InputIterator, _InputIterator, _Alloc)
- -> deque<__iter_value_type<_InputIterator>, _Alloc>;
+template <class _InputIterator,
+ class _Alloc = allocator<__iter_value_type<_InputIterator>>,
+ class = enable_if_t<__has_input_iterator_category<_InputIterator>::value>,
+ class = enable_if_t<__is_allocator<_Alloc>::value> >
+deque(_InputIterator, _InputIterator) -> deque<__iter_value_type<_InputIterator>, _Alloc>;
+
+template <class _InputIterator,
+ class _Alloc,
+ class = enable_if_t<__has_input_iterator_category<_InputIterator>::value>,
+ class = enable_if_t<__is_allocator<_Alloc>::value> >
+deque(_InputIterator, _InputIterator, _Alloc) -> deque<__iter_value_type<_InputIterator>, _Alloc>;
#endif
#if _LIBCPP_STD_VER >= 23
template <ranges::input_range _Range,
class _Alloc = allocator<ranges::range_value_t<_Range>>,
- class = enable_if_t<__is_allocator<_Alloc>::value>
- >
-deque(from_range_t, _Range&&, _Alloc = _Alloc())
- -> deque<ranges::range_value_t<_Range>, _Alloc>;
+ class = enable_if_t<__is_allocator<_Alloc>::value> >
+deque(from_range_t, _Range&&, _Alloc = _Alloc()) -> deque<ranges::range_value_t<_Range>, _Alloc>;
#endif
template <class _Tp, class _Allocator>
-deque<_Tp, _Allocator>::deque(size_type __n)
- : __start_(0), __size_(0, __default_init_tag())
-{
- __annotate_new(0);
- if (__n > 0)
- __append(__n);
+deque<_Tp, _Allocator>::deque(size_type __n) : __start_(0), __size_(0, __default_init_tag()) {
+ __annotate_new(0);
+ if (__n > 0)
+ __append(__n);
}
#if _LIBCPP_STD_VER >= 14
template <class _Tp, class _Allocator>
deque<_Tp, _Allocator>::deque(size_type __n, const _Allocator& __a)
- : __map_(__pointer_allocator(__a)), __start_(0), __size_(0, __a)
-{
- __annotate_new(0);
- if (__n > 0)
- __append(__n);
+ : __map_(__pointer_allocator(__a)), __start_(0), __size_(0, __a) {
+ __annotate_new(0);
+ if (__n > 0)
+ __append(__n);
}
#endif
template <class _Tp, class _Allocator>
-deque<_Tp, _Allocator>::deque(size_type __n, const value_type& __v)
- : __start_(0), __size_(0, __default_init_tag())
-{
- __annotate_new(0);
- if (__n > 0)
- __append(__n, __v);
+deque<_Tp, _Allocator>::deque(size_type __n, const value_type& __v) : __start_(0), __size_(0, __default_init_tag()) {
+ __annotate_new(0);
+ if (__n > 0)
+ __append(__n, __v);
}
template <class _Tp, class _Allocator>
template <class _InputIter, __enable_if_t<__has_input_iterator_category<_InputIter>::value, int> >
-deque<_Tp, _Allocator>::deque(_InputIter __f, _InputIter __l)
- : __start_(0), __size_(0, __default_init_tag())
-{
- __annotate_new(0);
- __append(__f, __l);
+deque<_Tp, _Allocator>::deque(_InputIter __f, _InputIter __l) : __start_(0), __size_(0, __default_init_tag()) {
+ __annotate_new(0);
+ __append(__f, __l);
}
template <class _Tp, class _Allocator>
template <class _InputIter, __enable_if_t<__has_input_iterator_category<_InputIter>::value, int> >
deque<_Tp, _Allocator>::deque(_InputIter __f, _InputIter __l, const allocator_type& __a)
- : __map_(__pointer_allocator(__a)), __start_(0), __size_(0, __a)
-{
- __annotate_new(0);
- __append(__f, __l);
+ : __map_(__pointer_allocator(__a)), __start_(0), __size_(0, __a) {
+ __annotate_new(0);
+ __append(__f, __l);
}
template <class _Tp, class _Allocator>
deque<_Tp, _Allocator>::deque(const deque& __c)
: __map_(__pointer_allocator(__alloc_traits::select_on_container_copy_construction(__c.__alloc()))),
__start_(0),
- __size_(0, __map_.__alloc())
-{
- __annotate_new(0);
- __append(__c.begin(), __c.end());
+ __size_(0, __map_.__alloc()) {
+ __annotate_new(0);
+ __append(__c.begin(), __c.end());
}
template <class _Tp, class _Allocator>
deque<_Tp, _Allocator>::deque(const deque& __c, const __type_identity_t<allocator_type>& __a)
- : __map_(__pointer_allocator(__a)), __start_(0), __size_(0, __a)
-{
- __annotate_new(0);
- __append(__c.begin(), __c.end());
+ : __map_(__pointer_allocator(__a)), __start_(0), __size_(0, __a) {
+ __annotate_new(0);
+ __append(__c.begin(), __c.end());
}
template <class _Tp, class _Allocator>
-deque<_Tp, _Allocator>&
-deque<_Tp, _Allocator>::operator=(const deque& __c)
-{
- if (this != std::addressof(__c))
- {
- __copy_assign_alloc(__c);
- assign(__c.begin(), __c.end());
- }
- return *this;
+deque<_Tp, _Allocator>& deque<_Tp, _Allocator>::operator=(const deque& __c) {
+ if (this != std::addressof(__c)) {
+ __copy_assign_alloc(__c);
+ assign(__c.begin(), __c.end());
+ }
+ return *this;
}
#ifndef _LIBCPP_CXX03_LANG
template <class _Tp, class _Allocator>
-deque<_Tp, _Allocator>::deque(initializer_list<value_type> __il)
- : __start_(0), __size_(0, __default_init_tag())
-{
- __annotate_new(0);
- __append(__il.begin(), __il.end());
+deque<_Tp, _Allocator>::deque(initializer_list<value_type> __il) : __start_(0), __size_(0, __default_init_tag()) {
+ __annotate_new(0);
+ __append(__il.begin(), __il.end());
}
template <class _Tp, class _Allocator>
deque<_Tp, _Allocator>::deque(initializer_list<value_type> __il, const allocator_type& __a)
- : __map_(__pointer_allocator(__a)), __start_(0), __size_(0, __a)
-{
- __annotate_new(0);
- __append(__il.begin(), __il.end());
+ : __map_(__pointer_allocator(__a)), __start_(0), __size_(0, __a) {
+ __annotate_new(0);
+ __append(__il.begin(), __il.end());
}
template <class _Tp, class _Allocator>
-inline
-deque<_Tp, _Allocator>::deque(deque&& __c)
- _NOEXCEPT_(is_nothrow_move_constructible<allocator_type>::value)
- : __map_(std::move(__c.__map_)), __start_(std::move(__c.__start_)), __size_(std::move(__c.__size_))
-{
+inline deque<_Tp, _Allocator>::deque(deque&& __c) _NOEXCEPT_(is_nothrow_move_constructible<allocator_type>::value)
+ : __map_(std::move(__c.__map_)), __start_(std::move(__c.__start_)), __size_(std::move(__c.__size_)) {
__c.__start_ = 0;
__c.__size() = 0;
}
template <class _Tp, class _Allocator>
-inline
-deque<_Tp, _Allocator>::deque(deque&& __c, const __type_identity_t<allocator_type>& __a)
+inline deque<_Tp, _Allocator>::deque(deque&& __c, const __type_identity_t<allocator_type>& __a)
: __map_(std::move(__c.__map_), __pointer_allocator(__a)),
__start_(std::move(__c.__start_)),
- __size_(std::move(__c.__size()), __a)
-{
- if (__a == __c.__alloc())
- {
- __c.__start_ = 0;
- __c.__size() = 0;
- }
- else
- {
- __map_.clear();
- __start_ = 0;
- __size() = 0;
- typedef move_iterator<iterator> _Ip;
- assign(_Ip(__c.begin()), _Ip(__c.end()));
- }
+ __size_(std::move(__c.__size()), __a) {
+ if (__a == __c.__alloc()) {
+ __c.__start_ = 0;
+ __c.__size() = 0;
+ } else {
+ __map_.clear();
+ __start_ = 0;
+ __size() = 0;
+ typedef move_iterator<iterator> _Ip;
+ assign(_Ip(__c.begin()), _Ip(__c.end()));
+ }
}
template <class _Tp, class _Allocator>
-inline
-deque<_Tp, _Allocator>&
-deque<_Tp, _Allocator>::operator=(deque&& __c)
- _NOEXCEPT_(__alloc_traits::propagate_on_container_move_assignment::value &&
- is_nothrow_move_assignable<allocator_type>::value)
-{
- __move_assign(__c, integral_constant<bool,
- __alloc_traits::propagate_on_container_move_assignment::value>());
- return *this;
+inline deque<_Tp, _Allocator>& deque<_Tp, _Allocator>::operator=(deque&& __c) _NOEXCEPT_(
+ __alloc_traits::propagate_on_container_move_assignment::value&& is_nothrow_move_assignable<allocator_type>::value) {
+ __move_assign(__c, integral_constant<bool, __alloc_traits::propagate_on_container_move_assignment::value>());
+ return *this;
}
template <class _Tp, class _Allocator>
-void
-deque<_Tp, _Allocator>::__move_assign(deque& __c, false_type)
-{
- if (__alloc() != __c.__alloc())
- {
- typedef move_iterator<iterator> _Ip;
- assign(_Ip(__c.begin()), _Ip(__c.end()));
- }
- else
- __move_assign(__c, true_type());
+void deque<_Tp, _Allocator>::__move_assign(deque& __c, false_type) {
+ if (__alloc() != __c.__alloc()) {
+ typedef move_iterator<iterator> _Ip;
+ assign(_Ip(__c.begin()), _Ip(__c.end()));
+ } else
+ __move_assign(__c, true_type());
}
template <class _Tp, class _Allocator>
-void
-deque<_Tp, _Allocator>::__move_assign(deque& __c, true_type)
- _NOEXCEPT_(is_nothrow_move_assignable<allocator_type>::value)
-{
- clear();
- shrink_to_fit();
- __move_assign(__c);
+void deque<_Tp, _Allocator>::__move_assign(deque& __c, true_type)
+ _NOEXCEPT_(is_nothrow_move_assignable<allocator_type>::value) {
+ clear();
+ shrink_to_fit();
+ __move_assign(__c);
}
#endif // _LIBCPP_CXX03_LANG
template <class _Tp, class _Allocator>
-template <class _InputIter, __enable_if_t<__has_input_iterator_category<_InputIter>::value &&
- !__has_random_access_iterator_category<_InputIter>::value, int> >
-void
-deque<_Tp, _Allocator>::assign(_InputIter __f, _InputIter __l)
-{
+template <class _InputIter,
+ __enable_if_t<__has_input_iterator_category<_InputIter>::value &&
+ !__has_random_access_iterator_category<_InputIter>::value,
+ int> >
+void deque<_Tp, _Allocator>::assign(_InputIter __f, _InputIter __l) {
__assign_with_sentinel(__f, __l);
}
template <class _Tp, class _Allocator>
template <class _Iterator, class _Sentinel>
-_LIBCPP_HIDE_FROM_ABI
-void deque<_Tp, _Allocator>::__assign_with_sentinel(_Iterator __f, _Sentinel __l) {
- iterator __i = begin();
- iterator __e = end();
- for (; __f != __l && __i != __e; ++__f, (void) ++__i)
- *__i = *__f;
- if (__f != __l)
- __append_with_sentinel(std::move(__f), std::move(__l));
- else
- __erase_to_end(__i);
+_LIBCPP_HIDE_FROM_ABI void deque<_Tp, _Allocator>::__assign_with_sentinel(_Iterator __f, _Sentinel __l) {
+ iterator __i = begin();
+ iterator __e = end();
+ for (; __f != __l && __i != __e; ++__f, (void)++__i)
+ *__i = *__f;
+ if (__f != __l)
+ __append_with_sentinel(std::move(__f), std::move(__l));
+ else
+ __erase_to_end(__i);
}
template <class _Tp, class _Allocator>
template <class _RAIter, __enable_if_t<__has_random_access_iterator_category<_RAIter>::value, int> >
-void
-deque<_Tp, _Allocator>::assign(_RAIter __f, _RAIter __l)
-{
+void deque<_Tp, _Allocator>::assign(_RAIter __f, _RAIter __l) {
__assign_with_size_random_access(__f, __l - __f);
}
template <class _Tp, class _Allocator>
template <class _RandomAccessIterator>
-_LIBCPP_HIDE_FROM_ABI
-void deque<_Tp, _Allocator>::__assign_with_size_random_access(_RandomAccessIterator __f, difference_type __n) {
- if (static_cast<size_type>(__n) > size())
- {
- auto __l = __f + size();
- std::copy(__f, __l, begin());
- __append_with_size(__l, __n - size());
- }
- else
- __erase_to_end(std::copy_n(__f, __n, begin()));
+_LIBCPP_HIDE_FROM_ABI void
+deque<_Tp, _Allocator>::__assign_with_size_random_access(_RandomAccessIterator __f, difference_type __n) {
+ if (static_cast<size_type>(__n) > size()) {
+ auto __l = __f + size();
+ std::copy(__f, __l, begin());
+ __append_with_size(__l, __n - size());
+ } else
+ __erase_to_end(std::copy_n(__f, __n, begin()));
}
template <class _Tp, class _Allocator>
template <class _Iterator>
-_LIBCPP_HIDE_FROM_ABI
-void deque<_Tp, _Allocator>::__assign_with_size(_Iterator __f, difference_type __n) {
+_LIBCPP_HIDE_FROM_ABI void deque<_Tp, _Allocator>::__assign_with_size(_Iterator __f, difference_type __n) {
if (static_cast<size_type>(__n) > size()) {
auto __added_size = __n - size();
@@ -1578,1351 +1438,1104 @@ void deque<_Tp, _Allocator>::__assign_with_size(_Iterator __f, difference_type _
}
template <class _Tp, class _Allocator>
-void
-deque<_Tp, _Allocator>::assign(size_type __n, const value_type& __v)
-{
- if (__n > size())
- {
- std::fill_n(begin(), size(), __v);
- __n -= size();
- __append(__n, __v);
- }
- else
- __erase_to_end(std::fill_n(begin(), __n, __v));
+void deque<_Tp, _Allocator>::assign(size_type __n, const value_type& __v) {
+ if (__n > size()) {
+ std::fill_n(begin(), size(), __v);
+ __n -= size();
+ __append(__n, __v);
+ } else
+ __erase_to_end(std::fill_n(begin(), __n, __v));
}
template <class _Tp, class _Allocator>
-inline
-_Allocator
-deque<_Tp, _Allocator>::get_allocator() const _NOEXCEPT
-{
- return __alloc();
+inline _Allocator deque<_Tp, _Allocator>::get_allocator() const _NOEXCEPT {
+ return __alloc();
}
template <class _Tp, class _Allocator>
-void
-deque<_Tp, _Allocator>::resize(size_type __n)
-{
- if (__n > size())
- __append(__n - size());
- else if (__n < size())
- __erase_to_end(begin() + __n);
+void deque<_Tp, _Allocator>::resize(size_type __n) {
+ if (__n > size())
+ __append(__n - size());
+ else if (__n < size())
+ __erase_to_end(begin() + __n);
}
template <class _Tp, class _Allocator>
-void
-deque<_Tp, _Allocator>::resize(size_type __n, const value_type& __v)
-{
- if (__n > size())
- __append(__n - size(), __v);
- else if (__n < size())
- __erase_to_end(begin() + __n);
+void deque<_Tp, _Allocator>::resize(size_type __n, const value_type& __v) {
+ if (__n > size())
+ __append(__n - size(), __v);
+ else if (__n < size())
+ __erase_to_end(begin() + __n);
}
template <class _Tp, class _Allocator>
-void
-deque<_Tp, _Allocator>::shrink_to_fit() _NOEXCEPT
-{
- allocator_type& __a = __alloc();
- if (empty())
- {
- __annotate_delete();
- while (__map_.size() > 0)
- {
- __alloc_traits::deallocate(__a, __map_.back(), __block_size);
- __map_.pop_back();
- }
- __start_ = 0;
- }
- else
- {
- __maybe_remove_front_spare(/*__keep_one=*/false);
- __maybe_remove_back_spare(/*__keep_one=*/false);
+void deque<_Tp, _Allocator>::shrink_to_fit() _NOEXCEPT {
+ allocator_type& __a = __alloc();
+ if (empty()) {
+ __annotate_delete();
+ while (__map_.size() > 0) {
+ __alloc_traits::deallocate(__a, __map_.back(), __block_size);
+ __map_.pop_back();
}
- __map_.shrink_to_fit();
+ __start_ = 0;
+ } else {
+ __maybe_remove_front_spare(/*__keep_one=*/false);
+ __maybe_remove_back_spare(/*__keep_one=*/false);
+ }
+ __map_.shrink_to_fit();
}
template <class _Tp, class _Allocator>
-inline
-typename deque<_Tp, _Allocator>::reference
-deque<_Tp, _Allocator>::operator[](size_type __i) _NOEXCEPT
-{
- size_type __p = __start_ + __i;
- return *(*(__map_.begin() + __p / __block_size) + __p % __block_size);
+inline typename deque<_Tp, _Allocator>::reference deque<_Tp, _Allocator>::operator[](size_type __i) _NOEXCEPT {
+ size_type __p = __start_ + __i;
+ return *(*(__map_.begin() + __p / __block_size) + __p % __block_size);
}
template <class _Tp, class _Allocator>
-inline
-typename deque<_Tp, _Allocator>::const_reference
-deque<_Tp, _Allocator>::operator[](size_type __i) const _NOEXCEPT
-{
- size_type __p = __start_ + __i;
- return *(*(__map_.begin() + __p / __block_size) + __p % __block_size);
+inline typename deque<_Tp, _Allocator>::const_reference
+deque<_Tp, _Allocator>::operator[](size_type __i) const _NOEXCEPT {
+ size_type __p = __start_ + __i;
+ return *(*(__map_.begin() + __p / __block_size) + __p % __block_size);
}
template <class _Tp, class _Allocator>
-inline
-typename deque<_Tp, _Allocator>::reference
-deque<_Tp, _Allocator>::at(size_type __i)
-{
- if (__i >= size())
- std::__throw_out_of_range("deque");
- size_type __p = __start_ + __i;
- return *(*(__map_.begin() + __p / __block_size) + __p % __block_size);
+inline typename deque<_Tp, _Allocator>::reference deque<_Tp, _Allocator>::at(size_type __i) {
+ if (__i >= size())
+ std::__throw_out_of_range("deque");
+ size_type __p = __start_ + __i;
+ return *(*(__map_.begin() + __p / __block_size) + __p % __block_size);
}
template <class _Tp, class _Allocator>
-inline
-typename deque<_Tp, _Allocator>::const_reference
-deque<_Tp, _Allocator>::at(size_type __i) const
-{
- if (__i >= size())
- std::__throw_out_of_range("deque");
- size_type __p = __start_ + __i;
- return *(*(__map_.begin() + __p / __block_size) + __p % __block_size);
+inline typename deque<_Tp, _Allocator>::const_reference deque<_Tp, _Allocator>::at(size_type __i) const {
+ if (__i >= size())
+ std::__throw_out_of_range("deque");
+ size_type __p = __start_ + __i;
+ return *(*(__map_.begin() + __p / __block_size) + __p % __block_size);
}
template <class _Tp, class _Allocator>
-inline
-typename deque<_Tp, _Allocator>::reference
-deque<_Tp, _Allocator>::front() _NOEXCEPT
-{
- return *(*(__map_.begin() + __start_ / __block_size)
- + __start_ % __block_size);
+inline typename deque<_Tp, _Allocator>::reference deque<_Tp, _Allocator>::front() _NOEXCEPT {
+ return *(*(__map_.begin() + __start_ / __block_size) + __start_ % __block_size);
}
template <class _Tp, class _Allocator>
-inline
-typename deque<_Tp, _Allocator>::const_reference
-deque<_Tp, _Allocator>::front() const _NOEXCEPT
-{
- return *(*(__map_.begin() + __start_ / __block_size)
- + __start_ % __block_size);
+inline typename deque<_Tp, _Allocator>::const_reference deque<_Tp, _Allocator>::front() const _NOEXCEPT {
+ return *(*(__map_.begin() + __start_ / __block_size) + __start_ % __block_size);
}
template <class _Tp, class _Allocator>
-inline
-typename deque<_Tp, _Allocator>::reference
-deque<_Tp, _Allocator>::back() _NOEXCEPT
-{
- size_type __p = size() + __start_ - 1;
- return *(*(__map_.begin() + __p / __block_size) + __p % __block_size);
+inline typename deque<_Tp, _Allocator>::reference deque<_Tp, _Allocator>::back() _NOEXCEPT {
+ size_type __p = size() + __start_ - 1;
+ return *(*(__map_.begin() + __p / __block_size) + __p % __block_size);
}
template <class _Tp, class _Allocator>
-inline
-typename deque<_Tp, _Allocator>::const_reference
-deque<_Tp, _Allocator>::back() const _NOEXCEPT
-{
- size_type __p = size() + __start_ - 1;
- return *(*(__map_.begin() + __p / __block_size) + __p % __block_size);
+inline typename deque<_Tp, _Allocator>::const_reference deque<_Tp, _Allocator>::back() const _NOEXCEPT {
+ size_type __p = size() + __start_ - 1;
+ return *(*(__map_.begin() + __p / __block_size) + __p % __block_size);
}
template <class _Tp, class _Allocator>
-void
-deque<_Tp, _Allocator>::push_back(const value_type& __v)
-{
- allocator_type& __a = __alloc();
- if (__back_spare() == 0)
- __add_back_capacity();
- // __back_spare() >= 1
- __annotate_increase_back(1);
- __alloc_traits::construct(__a, std::addressof(*end()), __v);
- ++__size();
+void deque<_Tp, _Allocator>::push_back(const value_type& __v) {
+ allocator_type& __a = __alloc();
+ if (__back_spare() == 0)
+ __add_back_capacity();
+ // __back_spare() >= 1
+ __annotate_increase_back(1);
+ __alloc_traits::construct(__a, std::addressof(*end()), __v);
+ ++__size();
}
template <class _Tp, class _Allocator>
-void
-deque<_Tp, _Allocator>::push_front(const value_type& __v)
-{
- allocator_type& __a = __alloc();
- if (__front_spare() == 0)
- __add_front_capacity();
- // __front_spare() >= 1
- __annotate_increase_front(1);
- __alloc_traits::construct(__a, std::addressof(*--begin()), __v);
- --__start_;
- ++__size();
+void deque<_Tp, _Allocator>::push_front(const value_type& __v) {
+ allocator_type& __a = __alloc();
+ if (__front_spare() == 0)
+ __add_front_capacity();
+ // __front_spare() >= 1
+ __annotate_increase_front(1);
+ __alloc_traits::construct(__a, std::addressof(*--begin()), __v);
+ --__start_;
+ ++__size();
}
#ifndef _LIBCPP_CXX03_LANG
template <class _Tp, class _Allocator>
-void
-deque<_Tp, _Allocator>::push_back(value_type&& __v)
-{
- allocator_type& __a = __alloc();
- if (__back_spare() == 0)
- __add_back_capacity();
- // __back_spare() >= 1
- __annotate_increase_back(1);
- __alloc_traits::construct(__a, std::addressof(*end()), std::move(__v));
- ++__size();
+void deque<_Tp, _Allocator>::push_back(value_type&& __v) {
+ allocator_type& __a = __alloc();
+ if (__back_spare() == 0)
+ __add_back_capacity();
+ // __back_spare() >= 1
+ __annotate_increase_back(1);
+ __alloc_traits::construct(__a, std::addressof(*end()), std::move(__v));
+ ++__size();
}
template <class _Tp, class _Allocator>
template <class... _Args>
-#if _LIBCPP_STD_VER >= 17
+# if _LIBCPP_STD_VER >= 17
typename deque<_Tp, _Allocator>::reference
-#else
+# else
void
-#endif
-deque<_Tp, _Allocator>::emplace_back(_Args&&... __args)
-{
- allocator_type& __a = __alloc();
- if (__back_spare() == 0)
- __add_back_capacity();
- // __back_spare() >= 1
- __annotate_increase_back(1);
- __alloc_traits::construct(__a, std::addressof(*end()),
- std::forward<_Args>(__args)...);
- ++__size();
-#if _LIBCPP_STD_VER >= 17
- return *--end();
-#endif
+# endif
+deque<_Tp, _Allocator>::emplace_back(_Args&&... __args) {
+ allocator_type& __a = __alloc();
+ if (__back_spare() == 0)
+ __add_back_capacity();
+ // __back_spare() >= 1
+ __annotate_increase_back(1);
+ __alloc_traits::construct(__a, std::addressof(*end()), std::forward<_Args>(__args)...);
+ ++__size();
+# if _LIBCPP_STD_VER >= 17
+ return *--end();
+# endif
}
template <class _Tp, class _Allocator>
-void
-deque<_Tp, _Allocator>::push_front(value_type&& __v)
-{
- allocator_type& __a = __alloc();
- if (__front_spare() == 0)
- __add_front_capacity();
- // __front_spare() >= 1
- __annotate_increase_front(1);
- __alloc_traits::construct(__a, std::addressof(*--begin()), std::move(__v));
- --__start_;
- ++__size();
+void deque<_Tp, _Allocator>::push_front(value_type&& __v) {
+ allocator_type& __a = __alloc();
+ if (__front_spare() == 0)
+ __add_front_capacity();
+ // __front_spare() >= 1
+ __annotate_increase_front(1);
+ __alloc_traits::construct(__a, std::addressof(*--begin()), std::move(__v));
+ --__start_;
+ ++__size();
}
-
template <class _Tp, class _Allocator>
template <class... _Args>
-#if _LIBCPP_STD_VER >= 17
+# if _LIBCPP_STD_VER >= 17
typename deque<_Tp, _Allocator>::reference
-#else
+# else
void
-#endif
-deque<_Tp, _Allocator>::emplace_front(_Args&&... __args)
-{
- allocator_type& __a = __alloc();
+# endif
+deque<_Tp, _Allocator>::emplace_front(_Args&&... __args) {
+ allocator_type& __a = __alloc();
+ if (__front_spare() == 0)
+ __add_front_capacity();
+ // __front_spare() >= 1
+ __annotate_increase_front(1);
+ __alloc_traits::construct(__a, std::addressof(*--begin()), std::forward<_Args>(__args)...);
+ --__start_;
+ ++__size();
+# if _LIBCPP_STD_VER >= 17
+ return *begin();
+# endif
+}
+
+template <class _Tp, class _Allocator>
+typename deque<_Tp, _Allocator>::iterator deque<_Tp, _Allocator>::insert(const_iterator __p, value_type&& __v) {
+ size_type __pos = __p - begin();
+ size_type __to_end = size() - __pos;
+ allocator_type& __a = __alloc();
+ if (__pos < __to_end) { // insert by shifting things backward
if (__front_spare() == 0)
- __add_front_capacity();
+ __add_front_capacity();
// __front_spare() >= 1
__annotate_increase_front(1);
- __alloc_traits::construct(__a, std::addressof(*--begin()), std::forward<_Args>(__args)...);
- --__start_;
- ++__size();
-#if _LIBCPP_STD_VER >= 17
- return *begin();
-#endif
-}
-
-template <class _Tp, class _Allocator>
-typename deque<_Tp, _Allocator>::iterator
-deque<_Tp, _Allocator>::insert(const_iterator __p, value_type&& __v)
-{
- size_type __pos = __p - begin();
- size_type __to_end = size() - __pos;
- allocator_type& __a = __alloc();
- if (__pos < __to_end)
- { // insert by shifting things backward
- if (__front_spare() == 0)
- __add_front_capacity();
- // __front_spare() >= 1
- __annotate_increase_front(1);
- if (__pos == 0)
- {
- __alloc_traits::construct(__a, std::addressof(*--begin()), std::move(__v));
- --__start_;
- ++__size();
- }
- else
- {
- iterator __b = begin();
- iterator __bm1 = std::prev(__b);
- __alloc_traits::construct(__a, std::addressof(*__bm1), std::move(*__b));
- --__start_;
- ++__size();
- if (__pos > 1)
- __b = std::move(std::next(__b), __b + __pos, __b);
- *__b = std::move(__v);
- }
- }
- else
- { // insert by shifting things forward
- if (__back_spare() == 0)
- __add_back_capacity();
- // __back_capacity >= 1
- __annotate_increase_back(1);
- size_type __de = size() - __pos;
- if (__de == 0)
- {
- __alloc_traits::construct(__a, std::addressof(*end()), std::move(__v));
- ++__size();
- }
- else
- {
- iterator __e = end();
- iterator __em1 = std::prev(__e);
- __alloc_traits::construct(__a, std::addressof(*__e), std::move(*__em1));
- ++__size();
- if (__de > 1)
- __e = std::move_backward(__e - __de, __em1, __e);
- *--__e = std::move(__v);
- }
+ if (__pos == 0) {
+ __alloc_traits::construct(__a, std::addressof(*--begin()), std::move(__v));
+ --__start_;
+ ++__size();
+ } else {
+ iterator __b = begin();
+ iterator __bm1 = std::prev(__b);
+ __alloc_traits::construct(__a, std::addressof(*__bm1), std::move(*__b));
+ --__start_;
+ ++__size();
+ if (__pos > 1)
+ __b = std::move(std::next(__b), __b + __pos, __b);
+ *__b = std::move(__v);
+ }
+ } else { // insert by shifting things forward
+ if (__back_spare() == 0)
+ __add_back_capacity();
+ // __back_capacity >= 1
+ __annotate_increase_back(1);
+ size_type __de = size() - __pos;
+ if (__de == 0) {
+ __alloc_traits::construct(__a, std::addressof(*end()), std::move(__v));
+ ++__size();
+ } else {
+ iterator __e = end();
+ iterator __em1 = std::prev(__e);
+ __alloc_traits::construct(__a, std::addressof(*__e), std::move(*__em1));
+ ++__size();
+ if (__de > 1)
+ __e = std::move_backward(__e - __de, __em1, __e);
+ *--__e = std::move(__v);
}
- return begin() + __pos;
+ }
+ return begin() + __pos;
}
template <class _Tp, class _Allocator>
template <class... _Args>
-typename deque<_Tp, _Allocator>::iterator
-deque<_Tp, _Allocator>::emplace(const_iterator __p, _Args&&... __args)
-{
- size_type __pos = __p - begin();
- size_type __to_end = size() - __pos;
- allocator_type& __a = __alloc();
- if (__pos < __to_end)
- { // insert by shifting things backward
- if (__front_spare() == 0)
- __add_front_capacity();
- // __front_spare() >= 1
- __annotate_increase_front(1);
- if (__pos == 0)
- {
- __alloc_traits::construct(__a, std::addressof(*--begin()), std::forward<_Args>(__args)...);
- --__start_;
- ++__size();
- }
- else
- {
- __temp_value<value_type, _Allocator> __tmp(__alloc(), std::forward<_Args>(__args)...);
- iterator __b = begin();
- iterator __bm1 = std::prev(__b);
- __alloc_traits::construct(__a, std::addressof(*__bm1), std::move(*__b));
- --__start_;
- ++__size();
- if (__pos > 1)
- __b = std::move(std::next(__b), __b + __pos, __b);
- *__b = std::move(__tmp.get());
- }
- }
- else
- { // insert by shifting things forward
- if (__back_spare() == 0)
- __add_back_capacity();
- // __back_capacity >= 1
- __annotate_increase_back(1);
- size_type __de = size() - __pos;
- if (__de == 0)
- {
- __alloc_traits::construct(__a, std::addressof(*end()), std::forward<_Args>(__args)...);
- ++__size();
- }
- else
- {
- __temp_value<value_type, _Allocator> __tmp(__alloc(), std::forward<_Args>(__args)...);
- iterator __e = end();
- iterator __em1 = std::prev(__e);
- __alloc_traits::construct(__a, std::addressof(*__e), std::move(*__em1));
- ++__size();
- if (__de > 1)
- __e = std::move_backward(__e - __de, __em1, __e);
- *--__e = std::move(__tmp.get());
- }
+typename deque<_Tp, _Allocator>::iterator deque<_Tp, _Allocator>::emplace(const_iterator __p, _Args&&... __args) {
+ size_type __pos = __p - begin();
+ size_type __to_end = size() - __pos;
+ allocator_type& __a = __alloc();
+ if (__pos < __to_end) { // insert by shifting things backward
+ if (__front_spare() == 0)
+ __add_front_capacity();
+ // __front_spare() >= 1
+ __annotate_increase_front(1);
+ if (__pos == 0) {
+ __alloc_traits::construct(__a, std::addressof(*--begin()), std::forward<_Args>(__args)...);
+ --__start_;
+ ++__size();
+ } else {
+ __temp_value<value_type, _Allocator> __tmp(__alloc(), std::forward<_Args>(__args)...);
+ iterator __b = begin();
+ iterator __bm1 = std::prev(__b);
+ __alloc_traits::construct(__a, std::addressof(*__bm1), std::move(*__b));
+ --__start_;
+ ++__size();
+ if (__pos > 1)
+ __b = std::move(std::next(__b), __b + __pos, __b);
+ *__b = std::move(__tmp.get());
+ }
+ } else { // insert by shifting things forward
+ if (__back_spare() == 0)
+ __add_back_capacity();
+ // __back_capacity >= 1
+ __annotate_increase_back(1);
+ size_type __de = size() - __pos;
+ if (__de == 0) {
+ __alloc_traits::construct(__a, std::addressof(*end()), std::forward<_Args>(__args)...);
+ ++__size();
+ } else {
+ __temp_value<value_type, _Allocator> __tmp(__alloc(), std::forward<_Args>(__args)...);
+ iterator __e = end();
+ iterator __em1 = std::prev(__e);
+ __alloc_traits::construct(__a, std::addressof(*__e), std::move(*__em1));
+ ++__size();
+ if (__de > 1)
+ __e = std::move_backward(__e - __de, __em1, __e);
+ *--__e = std::move(__tmp.get());
}
- return begin() + __pos;
+ }
+ return begin() + __pos;
}
#endif // _LIBCPP_CXX03_LANG
-
template <class _Tp, class _Allocator>
-typename deque<_Tp, _Allocator>::iterator
-deque<_Tp, _Allocator>::insert(const_iterator __p, const value_type& __v)
-{
- size_type __pos = __p - begin();
- size_type __to_end = size() - __pos;
- allocator_type& __a = __alloc();
- if (__pos < __to_end)
- { // insert by shifting things backward
- if (__front_spare() == 0)
- __add_front_capacity();
- // __front_spare() >= 1
- __annotate_increase_front(1);
- if (__pos == 0)
- {
- __alloc_traits::construct(__a, std::addressof(*--begin()), __v);
- --__start_;
- ++__size();
- }
- else
- {
- const_pointer __vt = pointer_traits<const_pointer>::pointer_to(__v);
- iterator __b = begin();
- iterator __bm1 = std::prev(__b);
- if (__vt == pointer_traits<const_pointer>::pointer_to(*__b))
- __vt = pointer_traits<const_pointer>::pointer_to(*__bm1);
- __alloc_traits::construct(__a, std::addressof(*__bm1), std::move(*__b));
- --__start_;
- ++__size();
- if (__pos > 1)
- __b = __move_and_check(std::next(__b), __b + __pos, __b, __vt);
- *__b = *__vt;
- }
- }
- else
- { // insert by shifting things forward
- if (__back_spare() == 0)
- __add_back_capacity();
- // __back_capacity >= 1
- __annotate_increase_back(1);
- size_type __de = size() - __pos;
- if (__de == 0)
- {
- __alloc_traits::construct(__a, std::addressof(*end()), __v);
- ++__size();
- }
- else
- {
- const_pointer __vt = pointer_traits<const_pointer>::pointer_to(__v);
- iterator __e = end();
- iterator __em1 = std::prev(__e);
- if (__vt == pointer_traits<const_pointer>::pointer_to(*__em1))
- __vt = pointer_traits<const_pointer>::pointer_to(*__e);
- __alloc_traits::construct(__a, std::addressof(*__e), std::move(*__em1));
- ++__size();
- if (__de > 1)
- __e = __move_backward_and_check(__e - __de, __em1, __e, __vt);
- *--__e = *__vt;
- }
+typename deque<_Tp, _Allocator>::iterator deque<_Tp, _Allocator>::insert(const_iterator __p, const value_type& __v) {
+ size_type __pos = __p - begin();
+ size_type __to_end = size() - __pos;
+ allocator_type& __a = __alloc();
+ if (__pos < __to_end) { // insert by shifting things backward
+ if (__front_spare() == 0)
+ __add_front_capacity();
+ // __front_spare() >= 1
+ __annotate_increase_front(1);
+ if (__pos == 0) {
+ __alloc_traits::construct(__a, std::addressof(*--begin()), __v);
+ --__start_;
+ ++__size();
+ } else {
+ const_pointer __vt = pointer_traits<const_pointer>::pointer_to(__v);
+ iterator __b = begin();
+ iterator __bm1 = std::prev(__b);
+ if (__vt == pointer_traits<const_pointer>::pointer_to(*__b))
+ __vt = pointer_traits<const_pointer>::pointer_to(*__bm1);
+ __alloc_traits::construct(__a, std::addressof(*__bm1), std::move(*__b));
+ --__start_;
+ ++__size();
+ if (__pos > 1)
+ __b = __move_and_check(std::next(__b), __b + __pos, __b, __vt);
+ *__b = *__vt;
+ }
+ } else { // insert by shifting things forward
+ if (__back_spare() == 0)
+ __add_back_capacity();
+ // __back_capacity >= 1
+ __annotate_increase_back(1);
+ size_type __de = size() - __pos;
+ if (__de == 0) {
+ __alloc_traits::construct(__a, std::addressof(*end()), __v);
+ ++__size();
+ } else {
+ const_pointer __vt = pointer_traits<const_pointer>::pointer_to(__v);
+ iterator __e = end();
+ iterator __em1 = std::prev(__e);
+ if (__vt == pointer_traits<const_pointer>::pointer_to(*__em1))
+ __vt = pointer_traits<const_pointer>::pointer_to(*__e);
+ __alloc_traits::construct(__a, std::addressof(*__e), std::move(*__em1));
+ ++__size();
+ if (__de > 1)
+ __e = __move_backward_and_check(__e - __de, __em1, __e, __vt);
+ *--__e = *__vt;
}
- return begin() + __pos;
+ }
+ return begin() + __pos;
}
template <class _Tp, class _Allocator>
typename deque<_Tp, _Allocator>::iterator
-deque<_Tp, _Allocator>::insert(const_iterator __p, size_type __n, const value_type& __v)
-{
- size_type __pos = __p - begin();
- size_type __to_end = __size() - __pos;
- allocator_type& __a = __alloc();
- if (__pos < __to_end)
- { // insert by shifting things backward
- if (__n > __front_spare())
- __add_front_capacity(__n - __front_spare());
- // __n <= __front_spare()
- __annotate_increase_front(__n);
- iterator __old_begin = begin();
- iterator __i = __old_begin;
- if (__n > __pos)
- {
- for (size_type __m = __n - __pos; __m; --__m, --__start_, ++__size())
- __alloc_traits::construct(__a, std::addressof(*--__i), __v);
- __n = __pos;
- }
- if (__n > 0)
- {
- const_pointer __vt = pointer_traits<const_pointer>::pointer_to(__v);
- iterator __obn = __old_begin + __n;
- __move_construct_backward_and_check(__old_begin, __obn, __i, __vt);
- if (__n < __pos)
- __old_begin = __move_and_check(__obn, __old_begin + __pos, __old_begin, __vt);
- std::fill_n(__old_begin, __n, *__vt);
- }
- }
- else
- { // insert by shifting things forward
- size_type __back_capacity = __back_spare();
- if (__n > __back_capacity)
- __add_back_capacity(__n - __back_capacity);
- // __n <= __back_capacity
- __annotate_increase_back(__n);
- iterator __old_end = end();
- iterator __i = __old_end;
- size_type __de = size() - __pos;
- if (__n > __de)
- {
- for (size_type __m = __n - __de; __m; --__m, (void) ++__i, ++__size())
- __alloc_traits::construct(__a, std::addressof(*__i), __v);
- __n = __de;
- }
- if (__n > 0)
- {
- const_pointer __vt = pointer_traits<const_pointer>::pointer_to(__v);
- iterator __oen = __old_end - __n;
- __move_construct_and_check(__oen, __old_end, __i, __vt);
- if (__n < __de)
- __old_end = __move_backward_and_check(__old_end - __de, __oen, __old_end, __vt);
- std::fill_n(__old_end - __n, __n, *__vt);
- }
+deque<_Tp, _Allocator>::insert(const_iterator __p, size_type __n, const value_type& __v) {
+ size_type __pos = __p - begin();
+ size_type __to_end = __size() - __pos;
+ allocator_type& __a = __alloc();
+ if (__pos < __to_end) { // insert by shifting things backward
+ if (__n > __front_spare())
+ __add_front_capacity(__n - __front_spare());
+ // __n <= __front_spare()
+ __annotate_increase_front(__n);
+ iterator __old_begin = begin();
+ iterator __i = __old_begin;
+ if (__n > __pos) {
+ for (size_type __m = __n - __pos; __m; --__m, --__start_, ++__size())
+ __alloc_traits::construct(__a, std::addressof(*--__i), __v);
+ __n = __pos;
+ }
+ if (__n > 0) {
+ const_pointer __vt = pointer_traits<const_pointer>::pointer_to(__v);
+ iterator __obn = __old_begin + __n;
+ __move_construct_backward_and_check(__old_begin, __obn, __i, __vt);
+ if (__n < __pos)
+ __old_begin = __move_and_check(__obn, __old_begin + __pos, __old_begin, __vt);
+ std::fill_n(__old_begin, __n, *__vt);
+ }
+ } else { // insert by shifting things forward
+ size_type __back_capacity = __back_spare();
+ if (__n > __back_capacity)
+ __add_back_capacity(__n - __back_capacity);
+ // __n <= __back_capacity
+ __annotate_increase_back(__n);
+ iterator __old_end = end();
+ iterator __i = __old_end;
+ size_type __de = size() - __pos;
+ if (__n > __de) {
+ for (size_type __m = __n - __de; __m; --__m, (void)++__i, ++__size())
+ __alloc_traits::construct(__a, std::addressof(*__i), __v);
+ __n = __de;
+ }
+ if (__n > 0) {
+ const_pointer __vt = pointer_traits<const_pointer>::pointer_to(__v);
+ iterator __oen = __old_end - __n;
+ __move_construct_and_check(__oen, __old_end, __i, __vt);
+ if (__n < __de)
+ __old_end = __move_backward_and_check(__old_end - __de, __oen, __old_end, __vt);
+ std::fill_n(__old_end - __n, __n, *__vt);
}
- return begin() + __pos;
+ }
+ return begin() + __pos;
}
template <class _Tp, class _Allocator>
template <class _InputIter, __enable_if_t<__has_exactly_input_iterator_category<_InputIter>::value, int> >
typename deque<_Tp, _Allocator>::iterator
-deque<_Tp, _Allocator>::insert(const_iterator __p, _InputIter __f, _InputIter __l)
-{
+deque<_Tp, _Allocator>::insert(const_iterator __p, _InputIter __f, _InputIter __l) {
return __insert_with_sentinel(__p, __f, __l);
}
template <class _Tp, class _Allocator>
template <class _Iterator, class _Sentinel>
-_LIBCPP_HIDE_FROM_ABI
-typename deque<_Tp, _Allocator>::iterator
+_LIBCPP_HIDE_FROM_ABI typename deque<_Tp, _Allocator>::iterator
deque<_Tp, _Allocator>::__insert_with_sentinel(const_iterator __p, _Iterator __f, _Sentinel __l) {
- __split_buffer<value_type, allocator_type&> __buf(__alloc());
- __buf.__construct_at_end_with_sentinel(std::move(__f), std::move(__l));
- typedef typename __split_buffer<value_type, allocator_type&>::iterator __bi;
- return insert(__p, move_iterator<__bi>(__buf.begin()), move_iterator<__bi>(__buf.end()));
+ __split_buffer<value_type, allocator_type&> __buf(__alloc());
+ __buf.__construct_at_end_with_sentinel(std::move(__f), std::move(__l));
+ typedef typename __split_buffer<value_type, allocator_type&>::iterator __bi;
+ return insert(__p, move_iterator<__bi>(__buf.begin()), move_iterator<__bi>(__buf.end()));
}
template <class _Tp, class _Allocator>
template <class _ForwardIterator, __enable_if_t<__has_exactly_forward_iterator_category<_ForwardIterator>::value, int> >
typename deque<_Tp, _Allocator>::iterator
-deque<_Tp, _Allocator>::insert(const_iterator __p, _ForwardIterator __f, _ForwardIterator __l)
-{
+deque<_Tp, _Allocator>::insert(const_iterator __p, _ForwardIterator __f, _ForwardIterator __l) {
return __insert_with_size(__p, __f, std::distance(__f, __l));
}
template <class _Tp, class _Allocator>
template <class _Iterator>
-_LIBCPP_HIDE_FROM_ABI
-typename deque<_Tp, _Allocator>::iterator
+_LIBCPP_HIDE_FROM_ABI typename deque<_Tp, _Allocator>::iterator
deque<_Tp, _Allocator>::__insert_with_size(const_iterator __p, _Iterator __f, size_type __n) {
- __split_buffer<value_type, allocator_type&> __buf(__n, 0, __alloc());
- __buf.__construct_at_end_with_size(__f, __n);
- typedef typename __split_buffer<value_type, allocator_type&>::iterator __fwd;
- return insert(__p, move_iterator<__fwd>(__buf.begin()), move_iterator<__fwd>(__buf.end()));
+ __split_buffer<value_type, allocator_type&> __buf(__n, 0, __alloc());
+ __buf.__construct_at_end_with_size(__f, __n);
+ typedef typename __split_buffer<value_type, allocator_type&>::iterator __fwd;
+ return insert(__p, move_iterator<__fwd>(__buf.begin()), move_iterator<__fwd>(__buf.end()));
}
template <class _Tp, class _Allocator>
template <class _BiIter, __enable_if_t<__has_bidirectional_iterator_category<_BiIter>::value, int> >
-typename deque<_Tp, _Allocator>::iterator
-deque<_Tp, _Allocator>::insert(const_iterator __p, _BiIter __f, _BiIter __l)
-{
+typename deque<_Tp, _Allocator>::iterator deque<_Tp, _Allocator>::insert(const_iterator __p, _BiIter __f, _BiIter __l) {
return __insert_bidirectional(__p, __f, __l, std::distance(__f, __l));
}
template <class _Tp, class _Allocator>
template <class _BiIter, class _Sentinel>
-_LIBCPP_HIDE_FROM_ABI
-typename deque<_Tp, _Allocator>::iterator
+_LIBCPP_HIDE_FROM_ABI typename deque<_Tp, _Allocator>::iterator
deque<_Tp, _Allocator>::__insert_bidirectional(const_iterator __p, _BiIter __f, _Sentinel, size_type __n) {
return __insert_bidirectional(__p, __f, std::next(__f, __n), __n);
}
template <class _Tp, class _Allocator>
template <class _BiIter>
-_LIBCPP_HIDE_FROM_ABI
-typename deque<_Tp, _Allocator>::iterator
+_LIBCPP_HIDE_FROM_ABI typename deque<_Tp, _Allocator>::iterator
deque<_Tp, _Allocator>::__insert_bidirectional(const_iterator __p, _BiIter __f, _BiIter __l, size_type __n) {
- size_type __pos = __p - begin();
- size_type __to_end = size() - __pos;
- allocator_type& __a = __alloc();
- if (__pos < __to_end)
- { // insert by shifting things backward
- if (__n > __front_spare())
- __add_front_capacity(__n - __front_spare());
- // __n <= __front_spare()
- __annotate_increase_front(__n);
- iterator __old_begin = begin();
- iterator __i = __old_begin;
- _BiIter __m = __f;
- if (__n > __pos)
- {
- __m = __pos < __n / 2 ? std::prev(__l, __pos) : std::next(__f, __n - __pos);
- for (_BiIter __j = __m; __j != __f; --__start_, ++__size())
- __alloc_traits::construct(__a, std::addressof(*--__i), *--__j);
- __n = __pos;
- }
- if (__n > 0)
- {
- iterator __obn = __old_begin + __n;
- for (iterator __j = __obn; __j != __old_begin;)
- {
- __alloc_traits::construct(__a, std::addressof(*--__i), std::move(*--__j));
- --__start_;
- ++__size();
- }
- if (__n < __pos)
- __old_begin = std::move(__obn, __old_begin + __pos, __old_begin);
- std::copy(__m, __l, __old_begin);
- }
+ size_type __pos = __p - begin();
+ size_type __to_end = size() - __pos;
+ allocator_type& __a = __alloc();
+ if (__pos < __to_end) { // insert by shifting things backward
+ if (__n > __front_spare())
+ __add_front_capacity(__n - __front_spare());
+ // __n <= __front_spare()
+ __annotate_increase_front(__n);
+ iterator __old_begin = begin();
+ iterator __i = __old_begin;
+ _BiIter __m = __f;
+ if (__n > __pos) {
+ __m = __pos < __n / 2 ? std::prev(__l, __pos) : std::next(__f, __n - __pos);
+ for (_BiIter __j = __m; __j != __f; --__start_, ++__size())
+ __alloc_traits::construct(__a, std::addressof(*--__i), *--__j);
+ __n = __pos;
+ }
+ if (__n > 0) {
+ iterator __obn = __old_begin + __n;
+ for (iterator __j = __obn; __j != __old_begin;) {
+ __alloc_traits::construct(__a, std::addressof(*--__i), std::move(*--__j));
+ --__start_;
+ ++__size();
+ }
+ if (__n < __pos)
+ __old_begin = std::move(__obn, __old_begin + __pos, __old_begin);
+ std::copy(__m, __l, __old_begin);
}
- else
- { // insert by shifting things forward
- size_type __back_capacity = __back_spare();
- if (__n > __back_capacity)
- __add_back_capacity(__n - __back_capacity);
- // __n <= __back_capacity
- __annotate_increase_back(__n);
- iterator __old_end = end();
- iterator __i = __old_end;
- _BiIter __m = __l;
- size_type __de = size() - __pos;
- if (__n > __de)
- {
- __m = __de < __n / 2 ? std::next(__f, __de) : std::prev(__l, __n - __de);
- for (_BiIter __j = __m; __j != __l; ++__i, (void) ++__j, ++__size())
- __alloc_traits::construct(__a, std::addressof(*__i), *__j);
- __n = __de;
- }
- if (__n > 0)
- {
- iterator __oen = __old_end - __n;
- for (iterator __j = __oen; __j != __old_end; ++__i, (void) ++__j, ++__size())
- __alloc_traits::construct(__a, std::addressof(*__i), std::move(*__j));
- if (__n < __de)
- __old_end = std::move_backward(__old_end - __de, __oen, __old_end);
- std::copy_backward(__f, __m, __old_end);
- }
+ } else { // insert by shifting things forward
+ size_type __back_capacity = __back_spare();
+ if (__n > __back_capacity)
+ __add_back_capacity(__n - __back_capacity);
+ // __n <= __back_capacity
+ __annotate_increase_back(__n);
+ iterator __old_end = end();
+ iterator __i = __old_end;
+ _BiIter __m = __l;
+ size_type __de = size() - __pos;
+ if (__n > __de) {
+ __m = __de < __n / 2 ? std::next(__f, __de) : std::prev(__l, __n - __de);
+ for (_BiIter __j = __m; __j != __l; ++__i, (void)++__j, ++__size())
+ __alloc_traits::construct(__a, std::addressof(*__i), *__j);
+ __n = __de;
+ }
+ if (__n > 0) {
+ iterator __oen = __old_end - __n;
+ for (iterator __j = __oen; __j != __old_end; ++__i, (void)++__j, ++__size())
+ __alloc_traits::construct(__a, std::addressof(*__i), std::move(*__j));
+ if (__n < __de)
+ __old_end = std::move_backward(__old_end - __de, __oen, __old_end);
+ std::copy_backward(__f, __m, __old_end);
}
- return begin() + __pos;
+ }
+ return begin() + __pos;
}
template <class _Tp, class _Allocator>
template <class _InpIter, __enable_if_t<__has_exactly_input_iterator_category<_InpIter>::value, int> >
-void
-deque<_Tp, _Allocator>::__append(_InpIter __f, _InpIter __l)
-{
+void deque<_Tp, _Allocator>::__append(_InpIter __f, _InpIter __l) {
__append_with_sentinel(__f, __l);
}
template <class _Tp, class _Allocator>
template <class _InputIterator, class _Sentinel>
-_LIBCPP_HIDE_FROM_ABI
-void deque<_Tp, _Allocator>::__append_with_sentinel(_InputIterator __f, _Sentinel __l) {
- for (; __f != __l; ++__f)
+_LIBCPP_HIDE_FROM_ABI void deque<_Tp, _Allocator>::__append_with_sentinel(_InputIterator __f, _Sentinel __l) {
+ for (; __f != __l; ++__f)
#ifdef _LIBCPP_CXX03_LANG
- push_back(*__f);
+ push_back(*__f);
#else
- emplace_back(*__f);
+ emplace_back(*__f);
#endif
}
template <class _Tp, class _Allocator>
template <class _ForIter, __enable_if_t<__has_forward_iterator_category<_ForIter>::value, int> >
-void
-deque<_Tp, _Allocator>::__append(_ForIter __f, _ForIter __l)
-{
- __append_with_size(__f, std::distance(__f, __l));
+void deque<_Tp, _Allocator>::__append(_ForIter __f, _ForIter __l) {
+ __append_with_size(__f, std::distance(__f, __l));
}
template <class _Tp, class _Allocator>
template <class _InputIterator>
-_LIBCPP_HIDE_FROM_ABI
-void deque<_Tp, _Allocator>::__append_with_size(_InputIterator __f, size_type __n) {
- allocator_type& __a = __alloc();
- size_type __back_capacity = __back_spare();
- if (__n > __back_capacity)
- __add_back_capacity(__n - __back_capacity);
-
- // __n <= __back_capacity
- __annotate_increase_back(__n);
- for (__deque_block_range __br : __deque_range(end(), end() + __n)) {
- _ConstructTransaction __tx(this, __br);
- for (; __tx.__pos_ != __tx.__end_; ++__tx.__pos_, (void)++__f) {
- __alloc_traits::construct(__a, std::__to_address(__tx.__pos_), *__f);
- }
+_LIBCPP_HIDE_FROM_ABI void deque<_Tp, _Allocator>::__append_with_size(_InputIterator __f, size_type __n) {
+ allocator_type& __a = __alloc();
+ size_type __back_capacity = __back_spare();
+ if (__n > __back_capacity)
+ __add_back_capacity(__n - __back_capacity);
+
+ // __n <= __back_capacity
+ __annotate_increase_back(__n);
+ for (__deque_block_range __br : __deque_range(end(), end() + __n)) {
+ _ConstructTransaction __tx(this, __br);
+ for (; __tx.__pos_ != __tx.__end_; ++__tx.__pos_, (void)++__f) {
+ __alloc_traits::construct(__a, std::__to_address(__tx.__pos_), *__f);
}
+ }
}
template <class _Tp, class _Allocator>
-void
-deque<_Tp, _Allocator>::__append(size_type __n)
-{
- allocator_type& __a = __alloc();
- size_type __back_capacity = __back_spare();
- if (__n > __back_capacity)
- __add_back_capacity(__n - __back_capacity);
- // __n <= __back_capacity
- __annotate_increase_back(__n);
- for (__deque_block_range __br : __deque_range(end(), end() + __n)) {
- _ConstructTransaction __tx(this, __br);
- for (; __tx.__pos_ != __tx.__end_; ++__tx.__pos_) {
- __alloc_traits::construct(__a, std::__to_address(__tx.__pos_));
- }
+void deque<_Tp, _Allocator>::__append(size_type __n) {
+ allocator_type& __a = __alloc();
+ size_type __back_capacity = __back_spare();
+ if (__n > __back_capacity)
+ __add_back_capacity(__n - __back_capacity);
+ // __n <= __back_capacity
+ __annotate_increase_back(__n);
+ for (__deque_block_range __br : __deque_range(end(), end() + __n)) {
+ _ConstructTransaction __tx(this, __br);
+ for (; __tx.__pos_ != __tx.__end_; ++__tx.__pos_) {
+ __alloc_traits::construct(__a, std::__to_address(__tx.__pos_));
}
+ }
}
template <class _Tp, class _Allocator>
-void
-deque<_Tp, _Allocator>::__append(size_type __n, const value_type& __v)
-{
- allocator_type& __a = __alloc();
- size_type __back_capacity = __back_spare();
- if (__n > __back_capacity)
- __add_back_capacity(__n - __back_capacity);
- // __n <= __back_capacity
- __annotate_increase_back(__n);
- for (__deque_block_range __br : __deque_range(end(), end() + __n)) {
- _ConstructTransaction __tx(this, __br);
- for (; __tx.__pos_ != __tx.__end_; ++__tx.__pos_) {
- __alloc_traits::construct(__a, std::__to_address(__tx.__pos_), __v);
- }
+void deque<_Tp, _Allocator>::__append(size_type __n, const value_type& __v) {
+ allocator_type& __a = __alloc();
+ size_type __back_capacity = __back_spare();
+ if (__n > __back_capacity)
+ __add_back_capacity(__n - __back_capacity);
+ // __n <= __back_capacity
+ __annotate_increase_back(__n);
+ for (__deque_block_range __br : __deque_range(end(), end() + __n)) {
+ _ConstructTransaction __tx(this, __br);
+ for (; __tx.__pos_ != __tx.__end_; ++__tx.__pos_) {
+ __alloc_traits::construct(__a, std::__to_address(__tx.__pos_), __v);
}
-
+ }
}
// Create front capacity for one block of elements.
// Strong guarantee. Either do it or don't touch anything.
template <class _Tp, class _Allocator>
-void
-deque<_Tp, _Allocator>::__add_front_capacity()
-{
- allocator_type& __a = __alloc();
- if (__back_spare() >= __block_size)
- {
- __start_ += __block_size;
- pointer __pt = __map_.back();
- __map_.pop_back();
- __map_.push_front(__pt);
- }
- // Else if __map_.size() < __map_.capacity() then we need to allocate 1 buffer
- else if (__map_.size() < __map_.capacity())
- { // we can put the new buffer into the map, but don't shift things around
- // until all buffers are allocated. If we throw, we don't need to fix
- // anything up (any added buffers are undetectible)
- if (__map_.__front_spare() > 0)
- __map_.push_front(__alloc_traits::allocate(__a, __block_size));
- else
- {
- __map_.push_back(__alloc_traits::allocate(__a, __block_size));
- // Done allocating, reorder capacity
- pointer __pt = __map_.back();
- __map_.pop_back();
- __map_.push_front(__pt);
- }
- __start_ = __map_.size() == 1 ?
- __block_size / 2 :
- __start_ + __block_size;
- }
- // Else need to allocate 1 buffer, *and* we need to reallocate __map_.
- else
- {
- __split_buffer<pointer, __pointer_allocator&>
- __buf(std::max<size_type>(2 * __map_.capacity(), 1),
- 0, __map_.__alloc());
-
- typedef __allocator_destructor<_Allocator> _Dp;
- unique_ptr<pointer, _Dp> __hold(
- __alloc_traits::allocate(__a, __block_size),
- _Dp(__a, __block_size));
- __buf.push_back(__hold.get());
- __hold.release();
-
- for (__map_pointer __i = __map_.begin();
- __i != __map_.end(); ++__i)
- __buf.push_back(*__i);
- std::swap(__map_.__first_, __buf.__first_);
- std::swap(__map_.__begin_, __buf.__begin_);
- std::swap(__map_.__end_, __buf.__end_);
- std::swap(__map_.__end_cap(), __buf.__end_cap());
- __start_ = __map_.size() == 1 ?
- __block_size / 2 :
- __start_ + __block_size;
- }
- __annotate_whole_block(0, __asan_poison);
+void deque<_Tp, _Allocator>::__add_front_capacity() {
+ allocator_type& __a = __alloc();
+ if (__back_spare() >= __block_size) {
+ __start_ += __block_size;
+ pointer __pt = __map_.back();
+ __map_.pop_back();
+ __map_.push_front(__pt);
+ }
+ // Else if __map_.size() < __map_.capacity() then we need to allocate 1 buffer
+ else if (__map_.size() < __map_.capacity()) { // we can put the new buffer into the map, but don't shift things around
+ // until all buffers are allocated. If we throw, we don't need to fix
+ // anything up (any added buffers are undetectible)
+ if (__map_.__front_spare() > 0)
+ __map_.push_front(__alloc_traits::allocate(__a, __block_size));
+ else {
+ __map_.push_back(__alloc_traits::allocate(__a, __block_size));
+ // Done allocating, reorder capacity
+ pointer __pt = __map_.back();
+ __map_.pop_back();
+ __map_.push_front(__pt);
+ }
+ __start_ = __map_.size() == 1 ? __block_size / 2 : __start_ + __block_size;
+ }
+ // Else need to allocate 1 buffer, *and* we need to reallocate __map_.
+ else {
+ __split_buffer<pointer, __pointer_allocator&> __buf(
+ std::max<size_type>(2 * __map_.capacity(), 1), 0, __map_.__alloc());
+
+ typedef __allocator_destructor<_Allocator> _Dp;
+ unique_ptr<pointer, _Dp> __hold(__alloc_traits::allocate(__a, __block_size), _Dp(__a, __block_size));
+ __buf.push_back(__hold.get());
+ __hold.release();
+
+ for (__map_pointer __i = __map_.begin(); __i != __map_.end(); ++__i)
+ __buf.push_back(*__i);
+ std::swap(__map_.__first_, __buf.__first_);
+ std::swap(__map_.__begin_, __buf.__begin_);
+ std::swap(__map_.__end_, __buf.__end_);
+ std::swap(__map_.__end_cap(), __buf.__end_cap());
+ __start_ = __map_.size() == 1 ? __block_size / 2 : __start_ + __block_size;
+ }
+ __annotate_whole_block(0, __asan_poison);
}
// Create front capacity for __n elements.
// Strong guarantee. Either do it or don't touch anything.
template <class _Tp, class _Allocator>
-void
-deque<_Tp, _Allocator>::__add_front_capacity(size_type __n)
-{
- allocator_type& __a = __alloc();
- size_type __nb = __recommend_blocks(__n + __map_.empty());
- // Number of unused blocks at back:
- size_type __back_capacity = __back_spare() / __block_size;
- __back_capacity = std::min(__back_capacity, __nb); // don't take more than you need
- __nb -= __back_capacity; // number of blocks need to allocate
- // If __nb == 0, then we have sufficient capacity.
- if (__nb == 0)
- {
- __start_ += __block_size * __back_capacity;
- for (; __back_capacity > 0; --__back_capacity)
- {
- pointer __pt = __map_.back();
- __map_.pop_back();
- __map_.push_front(__pt);
- }
+void deque<_Tp, _Allocator>::__add_front_capacity(size_type __n) {
+ allocator_type& __a = __alloc();
+ size_type __nb = __recommend_blocks(__n + __map_.empty());
+ // Number of unused blocks at back:
+ size_type __back_capacity = __back_spare() / __block_size;
+ __back_capacity = std::min(__back_capacity, __nb); // don't take more than you need
+ __nb -= __back_capacity; // number of blocks need to allocate
+ // If __nb == 0, then we have sufficient capacity.
+ if (__nb == 0) {
+ __start_ += __block_size * __back_capacity;
+ for (; __back_capacity > 0; --__back_capacity) {
+ pointer __pt = __map_.back();
+ __map_.pop_back();
+ __map_.push_front(__pt);
}
- // Else if __nb <= __map_.capacity() - __map_.size() then we need to allocate __nb buffers
- else if (__nb <= __map_.capacity() - __map_.size())
- { // we can put the new buffers into the map, but don't shift things around
- // until all buffers are allocated. If we throw, we don't need to fix
- // anything up (any added buffers are undetectible)
- for (; __nb > 0; --__nb, __start_ += __block_size - (__map_.size() == 1))
- {
- if (__map_.__front_spare() == 0)
- break;
- __map_.push_front(__alloc_traits::allocate(__a, __block_size));
- __annotate_whole_block(0, __asan_poison);
- }
- for (; __nb > 0; --__nb, ++__back_capacity)
- __map_.push_back(__alloc_traits::allocate(__a, __block_size));
- // Done allocating, reorder capacity
- __start_ += __back_capacity * __block_size;
- for (; __back_capacity > 0; --__back_capacity)
- {
- pointer __pt = __map_.back();
- __map_.pop_back();
- __map_.push_front(__pt);
- __annotate_whole_block(0, __asan_poison);
- }
+ }
+ // Else if __nb <= __map_.capacity() - __map_.size() then we need to allocate __nb buffers
+ else if (__nb <= __map_.capacity() -
+ __map_.size()) { // we can put the new buffers into the map, but don't shift things around
+ // until all buffers are allocated. If we throw, we don't need to fix
+ // anything up (any added buffers are undetectible)
+ for (; __nb > 0; --__nb, __start_ += __block_size - (__map_.size() == 1)) {
+ if (__map_.__front_spare() == 0)
+ break;
+ __map_.push_front(__alloc_traits::allocate(__a, __block_size));
+ __annotate_whole_block(0, __asan_poison);
+ }
+ for (; __nb > 0; --__nb, ++__back_capacity)
+ __map_.push_back(__alloc_traits::allocate(__a, __block_size));
+ // Done allocating, reorder capacity
+ __start_ += __back_capacity * __block_size;
+ for (; __back_capacity > 0; --__back_capacity) {
+ pointer __pt = __map_.back();
+ __map_.pop_back();
+ __map_.push_front(__pt);
+ __annotate_whole_block(0, __asan_poison);
}
- // Else need to allocate __nb buffers, *and* we need to reallocate __map_.
- else
- {
- size_type __ds = (__nb + __back_capacity) * __block_size - __map_.empty();
- __split_buffer<pointer, __pointer_allocator&>
- __buf(std::max<size_type>(2* __map_.capacity(),
- __nb + __map_.size()),
- 0, __map_.__alloc());
+ }
+ // Else need to allocate __nb buffers, *and* we need to reallocate __map_.
+ else {
+ size_type __ds = (__nb + __back_capacity) * __block_size - __map_.empty();
+ __split_buffer<pointer, __pointer_allocator&> __buf(
+ std::max<size_type>(2 * __map_.capacity(), __nb + __map_.size()), 0, __map_.__alloc());
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- try
- {
+ try {
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- for (; __nb > 0; --__nb) {
- __buf.push_back(__alloc_traits::allocate(__a, __block_size));
- // ASan: this is empty container, we have to poison whole block
- __annotate_poison_block(
- std::__to_address(__buf.back()),
- std::__to_address(__buf.back() + __block_size));
- }
+ for (; __nb > 0; --__nb) {
+ __buf.push_back(__alloc_traits::allocate(__a, __block_size));
+ // ASan: this is empty container, we have to poison whole block
+ __annotate_poison_block(std::__to_address(__buf.back()), std::__to_address(__buf.back() + __block_size));
+ }
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- }
- catch (...)
- {
- __annotate_delete();
- for (__map_pointer __i = __buf.begin();
- __i != __buf.end(); ++__i)
- __alloc_traits::deallocate(__a, *__i, __block_size);
- throw;
- }
-#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- for (; __back_capacity > 0; --__back_capacity)
- {
- __buf.push_back(__map_.back());
- __map_.pop_back();
- }
- for (__map_pointer __i = __map_.begin();
- __i != __map_.end(); ++__i)
- __buf.push_back(*__i);
- std::swap(__map_.__first_, __buf.__first_);
- std::swap(__map_.__begin_, __buf.__begin_);
- std::swap(__map_.__end_, __buf.__end_);
- std::swap(__map_.__end_cap(), __buf.__end_cap());
- __start_ += __ds;
+ } catch (...) {
+ __annotate_delete();
+ for (__map_pointer __i = __buf.begin(); __i != __buf.end(); ++__i)
+ __alloc_traits::deallocate(__a, *__i, __block_size);
+ throw;
}
+#endif // _LIBCPP_HAS_NO_EXCEPTIONS
+ for (; __back_capacity > 0; --__back_capacity) {
+ __buf.push_back(__map_.back());
+ __map_.pop_back();
+ }
+ for (__map_pointer __i = __map_.begin(); __i != __map_.end(); ++__i)
+ __buf.push_back(*__i);
+ std::swap(__map_.__first_, __buf.__first_);
+ std::swap(__map_.__begin_, __buf.__begin_);
+ std::swap(__map_.__end_, __buf.__end_);
+ std::swap(__map_.__end_cap(), __buf.__end_cap());
+ __start_ += __ds;
+ }
}
// Create back capacity for one block of elements.
// Strong guarantee. Either do it or don't touch anything.
template <class _Tp, class _Allocator>
-void
-deque<_Tp, _Allocator>::__add_back_capacity()
-{
- allocator_type& __a = __alloc();
- if (__front_spare() >= __block_size)
- {
- __start_ -= __block_size;
- pointer __pt = __map_.front();
- __map_.pop_front();
- __map_.push_back(__pt);
- }
- // Else if __nb <= __map_.capacity() - __map_.size() then we need to allocate __nb buffers
- else if (__map_.size() < __map_.capacity())
- { // we can put the new buffer into the map, but don't shift things around
- // until it is allocated. If we throw, we don't need to fix
- // anything up (any added buffers are undetectible)
- if (__map_.__back_spare() != 0)
- __map_.push_back(__alloc_traits::allocate(__a, __block_size));
- else
- {
- __map_.push_front(__alloc_traits::allocate(__a, __block_size));
- // Done allocating, reorder capacity
- pointer __pt = __map_.front();
- __map_.pop_front();
- __map_.push_back(__pt);
- }
- __annotate_whole_block(__map_.size() - 1, __asan_poison);
- }
- // Else need to allocate 1 buffer, *and* we need to reallocate __map_.
- else
- {
- __split_buffer<pointer, __pointer_allocator&>
- __buf(std::max<size_type>(2* __map_.capacity(), 1),
- __map_.size(),
- __map_.__alloc());
-
- typedef __allocator_destructor<_Allocator> _Dp;
- unique_ptr<pointer, _Dp> __hold(
- __alloc_traits::allocate(__a, __block_size),
- _Dp(__a, __block_size));
- __buf.push_back(__hold.get());
- __hold.release();
-
- for (__map_pointer __i = __map_.end();
- __i != __map_.begin();)
- __buf.push_front(*--__i);
- std::swap(__map_.__first_, __buf.__first_);
- std::swap(__map_.__begin_, __buf.__begin_);
- std::swap(__map_.__end_, __buf.__end_);
- std::swap(__map_.__end_cap(), __buf.__end_cap());
- __annotate_whole_block(__map_.size() - 1, __asan_poison);
- }
+void deque<_Tp, _Allocator>::__add_back_capacity() {
+ allocator_type& __a = __alloc();
+ if (__front_spare() >= __block_size) {
+ __start_ -= __block_size;
+ pointer __pt = __map_.front();
+ __map_.pop_front();
+ __map_.push_back(__pt);
+ }
+ // Else if __nb <= __map_.capacity() - __map_.size() then we need to allocate __nb buffers
+ else if (__map_.size() < __map_.capacity()) { // we can put the new buffer into the map, but don't shift things around
+ // until it is allocated. If we throw, we don't need to fix
+ // anything up (any added buffers are undetectible)
+ if (__map_.__back_spare() != 0)
+ __map_.push_back(__alloc_traits::allocate(__a, __block_size));
+ else {
+ __map_.push_front(__alloc_traits::allocate(__a, __block_size));
+ // Done allocating, reorder capacity
+ pointer __pt = __map_.front();
+ __map_.pop_front();
+ __map_.push_back(__pt);
+ }
+ __annotate_whole_block(__map_.size() - 1, __asan_poison);
+ }
+ // Else need to allocate 1 buffer, *and* we need to reallocate __map_.
+ else {
+ __split_buffer<pointer, __pointer_allocator&> __buf(
+ std::max<size_type>(2 * __map_.capacity(), 1), __map_.size(), __map_.__alloc());
+
+ typedef __allocator_destructor<_Allocator> _Dp;
+ unique_ptr<pointer, _Dp> __hold(__alloc_traits::allocate(__a, __block_size), _Dp(__a, __block_size));
+ __buf.push_back(__hold.get());
+ __hold.release();
+
+ for (__map_pointer __i = __map_.end(); __i != __map_.begin();)
+ __buf.push_front(*--__i);
+ std::swap(__map_.__first_, __buf.__first_);
+ std::swap(__map_.__begin_, __buf.__begin_);
+ std::swap(__map_.__end_, __buf.__end_);
+ std::swap(__map_.__end_cap(), __buf.__end_cap());
+ __annotate_whole_block(__map_.size() - 1, __asan_poison);
+ }
}
// Create back capacity for __n elements.
// Strong guarantee. Either do it or don't touch anything.
template <class _Tp, class _Allocator>
-void
-deque<_Tp, _Allocator>::__add_back_capacity(size_type __n)
-{
- allocator_type& __a = __alloc();
- size_type __nb = __recommend_blocks(__n + __map_.empty());
- // Number of unused blocks at front:
- size_type __front_capacity = __front_spare() / __block_size;
- __front_capacity = std::min(__front_capacity, __nb); // don't take more than you need
- __nb -= __front_capacity; // number of blocks need to allocate
- // If __nb == 0, then we have sufficient capacity.
- if (__nb == 0)
- {
- __start_ -= __block_size * __front_capacity;
- for (; __front_capacity > 0; --__front_capacity)
- {
- pointer __pt = __map_.front();
- __map_.pop_front();
- __map_.push_back(__pt);
- }
+void deque<_Tp, _Allocator>::__add_back_capacity(size_type __n) {
+ allocator_type& __a = __alloc();
+ size_type __nb = __recommend_blocks(__n + __map_.empty());
+ // Number of unused blocks at front:
+ size_type __front_capacity = __front_spare() / __block_size;
+ __front_capacity = std::min(__front_capacity, __nb); // don't take more than you need
+ __nb -= __front_capacity; // number of blocks need to allocate
+ // If __nb == 0, then we have sufficient capacity.
+ if (__nb == 0) {
+ __start_ -= __block_size * __front_capacity;
+ for (; __front_capacity > 0; --__front_capacity) {
+ pointer __pt = __map_.front();
+ __map_.pop_front();
+ __map_.push_back(__pt);
}
- // Else if __nb <= __map_.capacity() - __map_.size() then we need to allocate __nb buffers
- else if (__nb <= __map_.capacity() - __map_.size())
- { // we can put the new buffers into the map, but don't shift things around
- // until all buffers are allocated. If we throw, we don't need to fix
- // anything up (any added buffers are undetectible)
- for (; __nb > 0; --__nb)
- {
- if (__map_.__back_spare() == 0)
- break;
- __map_.push_back(__alloc_traits::allocate(__a, __block_size));
- __annotate_whole_block(__map_.size() - 1, __asan_poison);
- }
- for (; __nb > 0; --__nb, ++__front_capacity, __start_ +=
- __block_size - (__map_.size() == 1)) {
- __map_.push_front(__alloc_traits::allocate(__a, __block_size));
- __annotate_whole_block(0, __asan_poison);
- }
- // Done allocating, reorder capacity
- __start_ -= __block_size * __front_capacity;
- for (; __front_capacity > 0; --__front_capacity)
- {
- pointer __pt = __map_.front();
- __map_.pop_front();
- __map_.push_back(__pt);
- }
+ }
+ // Else if __nb <= __map_.capacity() - __map_.size() then we need to allocate __nb buffers
+ else if (__nb <= __map_.capacity() -
+ __map_.size()) { // we can put the new buffers into the map, but don't shift things around
+ // until all buffers are allocated. If we throw, we don't need to fix
+ // anything up (any added buffers are undetectible)
+ for (; __nb > 0; --__nb) {
+ if (__map_.__back_spare() == 0)
+ break;
+ __map_.push_back(__alloc_traits::allocate(__a, __block_size));
+ __annotate_whole_block(__map_.size() - 1, __asan_poison);
+ }
+ for (; __nb > 0; --__nb, ++__front_capacity, __start_ += __block_size - (__map_.size() == 1)) {
+ __map_.push_front(__alloc_traits::allocate(__a, __block_size));
+ __annotate_whole_block(0, __asan_poison);
+ }
+ // Done allocating, reorder capacity
+ __start_ -= __block_size * __front_capacity;
+ for (; __front_capacity > 0; --__front_capacity) {
+ pointer __pt = __map_.front();
+ __map_.pop_front();
+ __map_.push_back(__pt);
}
- // Else need to allocate __nb buffers, *and* we need to reallocate __map_.
- else
- {
- size_type __ds = __front_capacity * __block_size;
- __split_buffer<pointer, __pointer_allocator&>
- __buf(std::max<size_type>(2* __map_.capacity(),
- __nb + __map_.size()),
- __map_.size() - __front_capacity,
- __map_.__alloc());
+ }
+ // Else need to allocate __nb buffers, *and* we need to reallocate __map_.
+ else {
+ size_type __ds = __front_capacity * __block_size;
+ __split_buffer<pointer, __pointer_allocator&> __buf(
+ std::max<size_type>(2 * __map_.capacity(), __nb + __map_.size()),
+ __map_.size() - __front_capacity,
+ __map_.__alloc());
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- try
- {
+ try {
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- for (; __nb > 0; --__nb) {
- __buf.push_back(__alloc_traits::allocate(__a, __block_size));
- // ASan: this is an empty container, we have to poison the whole block
- __annotate_poison_block(
- std::__to_address(__buf.back()),
- std::__to_address(__buf.back() + __block_size));
- }
+ for (; __nb > 0; --__nb) {
+ __buf.push_back(__alloc_traits::allocate(__a, __block_size));
+ // ASan: this is an empty container, we have to poison the whole block
+ __annotate_poison_block(std::__to_address(__buf.back()), std::__to_address(__buf.back() + __block_size));
+ }
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- }
- catch (...)
- {
- __annotate_delete();
- for (__map_pointer __i = __buf.begin();
- __i != __buf.end(); ++__i)
- __alloc_traits::deallocate(__a, *__i, __block_size);
- throw;
- }
-#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- for (; __front_capacity > 0; --__front_capacity)
- {
- __buf.push_back(__map_.front());
- __map_.pop_front();
- }
- for (__map_pointer __i = __map_.end();
- __i != __map_.begin();)
- __buf.push_front(*--__i);
- std::swap(__map_.__first_, __buf.__first_);
- std::swap(__map_.__begin_, __buf.__begin_);
- std::swap(__map_.__end_, __buf.__end_);
- std::swap(__map_.__end_cap(), __buf.__end_cap());
- __start_ -= __ds;
+ } catch (...) {
+ __annotate_delete();
+ for (__map_pointer __i = __buf.begin(); __i != __buf.end(); ++__i)
+ __alloc_traits::deallocate(__a, *__i, __block_size);
+ throw;
}
+#endif // _LIBCPP_HAS_NO_EXCEPTIONS
+ for (; __front_capacity > 0; --__front_capacity) {
+ __buf.push_back(__map_.front());
+ __map_.pop_front();
+ }
+ for (__map_pointer __i = __map_.end(); __i != __map_.begin();)
+ __buf.push_front(*--__i);
+ std::swap(__map_.__first_, __buf.__first_);
+ std::swap(__map_.__begin_, __buf.__begin_);
+ std::swap(__map_.__end_, __buf.__end_);
+ std::swap(__map_.__end_cap(), __buf.__end_cap());
+ __start_ -= __ds;
+ }
}
template <class _Tp, class _Allocator>
-void
-deque<_Tp, _Allocator>::pop_front()
-{
- size_type __old_sz = size();
- size_type __old_start = __start_;
- allocator_type& __a = __alloc();
- __alloc_traits::destroy(__a, std::__to_address(*(__map_.begin() +
- __start_ / __block_size) +
- __start_ % __block_size));
- --__size();
- ++__start_;
- __annotate_shrink_front(__old_sz, __old_start);
- __maybe_remove_front_spare();
+void deque<_Tp, _Allocator>::pop_front() {
+ size_type __old_sz = size();
+ size_type __old_start = __start_;
+ allocator_type& __a = __alloc();
+ __alloc_traits::destroy(
+ __a, std::__to_address(*(__map_.begin() + __start_ / __block_size) + __start_ % __block_size));
+ --__size();
+ ++__start_;
+ __annotate_shrink_front(__old_sz, __old_start);
+ __maybe_remove_front_spare();
}
template <class _Tp, class _Allocator>
-void
-deque<_Tp, _Allocator>::pop_back()
-{
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(!empty(), "deque::pop_back called on an empty deque");
- size_type __old_sz = size();
- size_type __old_start = __start_;
- allocator_type& __a = __alloc();
- size_type __p = size() + __start_ - 1;
- __alloc_traits::destroy(__a, std::__to_address(*(__map_.begin() +
- __p / __block_size) +
- __p % __block_size));
- --__size();
- __annotate_shrink_back(__old_sz, __old_start);
- __maybe_remove_back_spare();
+void deque<_Tp, _Allocator>::pop_back() {
+ _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(!empty(), "deque::pop_back called on an empty deque");
+ size_type __old_sz = size();
+ size_type __old_start = __start_;
+ allocator_type& __a = __alloc();
+ size_type __p = size() + __start_ - 1;
+ __alloc_traits::destroy(__a, std::__to_address(*(__map_.begin() + __p / __block_size) + __p % __block_size));
+ --__size();
+ __annotate_shrink_back(__old_sz, __old_start);
+ __maybe_remove_back_spare();
}
// move assign [__f, __l) to [__r, __r + (__l-__f)).
// If __vt points into [__f, __l), then subtract (__f - __r) from __vt.
template <class _Tp, class _Allocator>
typename deque<_Tp, _Allocator>::iterator
-deque<_Tp, _Allocator>::__move_and_check(iterator __f, iterator __l, iterator __r,
- const_pointer& __vt)
-{
- // as if
- // for (; __f != __l; ++__f, ++__r)
- // *__r = std::move(*__f);
- difference_type __n = __l - __f;
- while (__n > 0)
- {
- pointer __fb = __f.__ptr_;
- pointer __fe = *__f.__m_iter_ + __block_size;
- difference_type __bs = __fe - __fb;
- if (__bs > __n)
- {
- __bs = __n;
- __fe = __fb + __bs;
- }
- if (__fb <= __vt && __vt < __fe)
- __vt = (const_iterator(static_cast<__map_const_pointer>(__f.__m_iter_), __vt) -= __f - __r).__ptr_;
- __r = std::move(__fb, __fe, __r);
- __n -= __bs;
- __f += __bs;
- }
- return __r;
+deque<_Tp, _Allocator>::__move_and_check(iterator __f, iterator __l, iterator __r, const_pointer& __vt) {
+ // as if
+ // for (; __f != __l; ++__f, ++__r)
+ // *__r = std::move(*__f);
+ difference_type __n = __l - __f;
+ while (__n > 0) {
+ pointer __fb = __f.__ptr_;
+ pointer __fe = *__f.__m_iter_ + __block_size;
+ difference_type __bs = __fe - __fb;
+ if (__bs > __n) {
+ __bs = __n;
+ __fe = __fb + __bs;
+ }
+ if (__fb <= __vt && __vt < __fe)
+ __vt = (const_iterator(static_cast<__map_const_pointer>(__f.__m_iter_), __vt) -= __f - __r).__ptr_;
+ __r = std::move(__fb, __fe, __r);
+ __n -= __bs;
+ __f += __bs;
+ }
+ return __r;
}
// move assign [__f, __l) to [__r - (__l-__f), __r) backwards.
// If __vt points into [__f, __l), then add (__r - __l) to __vt.
template <class _Tp, class _Allocator>
typename deque<_Tp, _Allocator>::iterator
-deque<_Tp, _Allocator>::__move_backward_and_check(iterator __f, iterator __l, iterator __r,
- const_pointer& __vt)
-{
- // as if
- // while (__f != __l)
- // *--__r = std::move(*--__l);
- difference_type __n = __l - __f;
- while (__n > 0)
- {
- --__l;
- pointer __lb = *__l.__m_iter_;
- pointer __le = __l.__ptr_ + 1;
- difference_type __bs = __le - __lb;
- if (__bs > __n)
- {
- __bs = __n;
- __lb = __le - __bs;
- }
- if (__lb <= __vt && __vt < __le)
- __vt = (const_iterator(static_cast<__map_const_pointer>(__l.__m_iter_), __vt) += __r - __l - 1).__ptr_;
- __r = std::move_backward(__lb, __le, __r);
- __n -= __bs;
- __l -= __bs - 1;
- }
- return __r;
+deque<_Tp, _Allocator>::__move_backward_and_check(iterator __f, iterator __l, iterator __r, const_pointer& __vt) {
+ // as if
+ // while (__f != __l)
+ // *--__r = std::move(*--__l);
+ difference_type __n = __l - __f;
+ while (__n > 0) {
+ --__l;
+ pointer __lb = *__l.__m_iter_;
+ pointer __le = __l.__ptr_ + 1;
+ difference_type __bs = __le - __lb;
+ if (__bs > __n) {
+ __bs = __n;
+ __lb = __le - __bs;
+ }
+ if (__lb <= __vt && __vt < __le)
+ __vt = (const_iterator(static_cast<__map_const_pointer>(__l.__m_iter_), __vt) += __r - __l - 1).__ptr_;
+ __r = std::move_backward(__lb, __le, __r);
+ __n -= __bs;
+ __l -= __bs - 1;
+ }
+ return __r;
}
// move construct [__f, __l) to [__r, __r + (__l-__f)).
// If __vt points into [__f, __l), then add (__r - __f) to __vt.
template <class _Tp, class _Allocator>
-void
-deque<_Tp, _Allocator>::__move_construct_and_check(iterator __f, iterator __l,
- iterator __r, const_pointer& __vt)
-{
- allocator_type& __a = __alloc();
- // as if
- // for (; __f != __l; ++__r, ++__f, ++__size())
- // __alloc_traits::construct(__a, std::addressof(*__r), std::move(*__f));
- difference_type __n = __l - __f;
- while (__n > 0)
- {
- pointer __fb = __f.__ptr_;
- pointer __fe = *__f.__m_iter_ + __block_size;
- difference_type __bs = __fe - __fb;
- if (__bs > __n)
- {
- __bs = __n;
- __fe = __fb + __bs;
- }
- if (__fb <= __vt && __vt < __fe)
- __vt = (const_iterator(static_cast<__map_const_pointer>(__f.__m_iter_), __vt) += __r - __f).__ptr_;
- for (; __fb != __fe; ++__fb, ++__r, ++__size())
- __alloc_traits::construct(__a, std::addressof(*__r), std::move(*__fb));
- __n -= __bs;
- __f += __bs;
- }
+void deque<_Tp, _Allocator>::__move_construct_and_check(iterator __f, iterator __l, iterator __r, const_pointer& __vt) {
+ allocator_type& __a = __alloc();
+ // as if
+ // for (; __f != __l; ++__r, ++__f, ++__size())
+ // __alloc_traits::construct(__a, std::addressof(*__r), std::move(*__f));
+ difference_type __n = __l - __f;
+ while (__n > 0) {
+ pointer __fb = __f.__ptr_;
+ pointer __fe = *__f.__m_iter_ + __block_size;
+ difference_type __bs = __fe - __fb;
+ if (__bs > __n) {
+ __bs = __n;
+ __fe = __fb + __bs;
+ }
+ if (__fb <= __vt && __vt < __fe)
+ __vt = (const_iterator(static_cast<__map_const_pointer>(__f.__m_iter_), __vt) += __r - __f).__ptr_;
+ for (; __fb != __fe; ++__fb, ++__r, ++__size())
+ __alloc_traits::construct(__a, std::addressof(*__r), std::move(*__fb));
+ __n -= __bs;
+ __f += __bs;
+ }
}
// move construct [__f, __l) to [__r - (__l-__f), __r) backwards.
// If __vt points into [__f, __l), then subtract (__l - __r) from __vt.
template <class _Tp, class _Allocator>
-void
-deque<_Tp, _Allocator>::__move_construct_backward_and_check(iterator __f, iterator __l,
- iterator __r, const_pointer& __vt)
-{
- allocator_type& __a = __alloc();
- // as if
- // for (iterator __j = __l; __j != __f;)
- // {
- // __alloc_traitsconstruct(__a, std::addressof(*--__r), std::move(*--__j));
- // --__start_;
- // ++__size();
- // }
- difference_type __n = __l - __f;
- while (__n > 0)
- {
- --__l;
- pointer __lb = *__l.__m_iter_;
- pointer __le = __l.__ptr_ + 1;
- difference_type __bs = __le - __lb;
- if (__bs > __n)
- {
- __bs = __n;
- __lb = __le - __bs;
- }
- if (__lb <= __vt && __vt < __le)
- __vt = (const_iterator(static_cast<__map_const_pointer>(__l.__m_iter_), __vt) -= __l - __r + 1).__ptr_;
- while (__le != __lb)
- {
- __alloc_traits::construct(__a, std::addressof(*--__r), std::move(*--__le));
- --__start_;
- ++__size();
- }
- __n -= __bs;
- __l -= __bs - 1;
- }
+void deque<_Tp, _Allocator>::__move_construct_backward_and_check(
+ iterator __f, iterator __l, iterator __r, const_pointer& __vt) {
+ allocator_type& __a = __alloc();
+ // as if
+ // for (iterator __j = __l; __j != __f;)
+ // {
+ // __alloc_traitsconstruct(__a, std::addressof(*--__r), std::move(*--__j));
+ // --__start_;
+ // ++__size();
+ // }
+ difference_type __n = __l - __f;
+ while (__n > 0) {
+ --__l;
+ pointer __lb = *__l.__m_iter_;
+ pointer __le = __l.__ptr_ + 1;
+ difference_type __bs = __le - __lb;
+ if (__bs > __n) {
+ __bs = __n;
+ __lb = __le - __bs;
+ }
+ if (__lb <= __vt && __vt < __le)
+ __vt = (const_iterator(static_cast<__map_const_pointer>(__l.__m_iter_), __vt) -= __l - __r + 1).__ptr_;
+ while (__le != __lb) {
+ __alloc_traits::construct(__a, std::addressof(*--__r), std::move(*--__le));
+ --__start_;
+ ++__size();
+ }
+ __n -= __bs;
+ __l -= __bs - 1;
+ }
}
template <class _Tp, class _Allocator>
-typename deque<_Tp, _Allocator>::iterator
-deque<_Tp, _Allocator>::erase(const_iterator __f)
-{
- size_type __old_sz = size();
- size_type __old_start = __start_;
- iterator __b = begin();
- difference_type __pos = __f - __b;
- iterator __p = __b + __pos;
+typename deque<_Tp, _Allocator>::iterator deque<_Tp, _Allocator>::erase(const_iterator __f) {
+ size_type __old_sz = size();
+ size_type __old_start = __start_;
+ iterator __b = begin();
+ difference_type __pos = __f - __b;
+ iterator __p = __b + __pos;
+ allocator_type& __a = __alloc();
+ if (static_cast<size_t>(__pos) <= (size() - 1) / 2) { // erase from front
+ std::move_backward(__b, __p, std::next(__p));
+ __alloc_traits::destroy(__a, std::addressof(*__b));
+ --__size();
+ ++__start_;
+ __annotate_shrink_front(__old_sz, __old_start);
+ __maybe_remove_front_spare();
+ } else { // erase from back
+ iterator __i = std::move(std::next(__p), end(), __p);
+ __alloc_traits::destroy(__a, std::addressof(*__i));
+ --__size();
+ __annotate_shrink_back(__old_sz, __old_start);
+ __maybe_remove_back_spare();
+ }
+ return begin() + __pos;
+}
+
+template <class _Tp, class _Allocator>
+typename deque<_Tp, _Allocator>::iterator deque<_Tp, _Allocator>::erase(const_iterator __f, const_iterator __l) {
+ size_type __old_sz = size();
+ size_type __old_start = __start_;
+ difference_type __n = __l - __f;
+ iterator __b = begin();
+ difference_type __pos = __f - __b;
+ iterator __p = __b + __pos;
+ if (__n > 0) {
allocator_type& __a = __alloc();
- if (static_cast<size_t>(__pos) <= (size() - 1) / 2)
- { // erase from front
- std::move_backward(__b, __p, std::next(__p));
+ if (static_cast<size_t>(__pos) <= (size() - __n) / 2) { // erase from front
+ iterator __i = std::move_backward(__b, __p, __p + __n);
+ for (; __b != __i; ++__b)
__alloc_traits::destroy(__a, std::addressof(*__b));
- --__size();
- ++__start_;
- __annotate_shrink_front(__old_sz, __old_start);
- __maybe_remove_front_spare();
- }
- else
- { // erase from back
- iterator __i = std::move(std::next(__p), end(), __p);
+ __size() -= __n;
+ __start_ += __n;
+ __annotate_shrink_front(__old_sz, __old_start);
+ while (__maybe_remove_front_spare()) {
+ }
+ } else { // erase from back
+ iterator __i = std::move(__p + __n, end(), __p);
+ for (iterator __e = end(); __i != __e; ++__i)
__alloc_traits::destroy(__a, std::addressof(*__i));
- --__size();
- __annotate_shrink_back(__old_sz, __old_start);
- __maybe_remove_back_spare();
+ __size() -= __n;
+ __annotate_shrink_back(__old_sz, __old_start);
+ while (__maybe_remove_back_spare()) {
+ }
}
- return begin() + __pos;
+ }
+ return begin() + __pos;
}
template <class _Tp, class _Allocator>
-typename deque<_Tp, _Allocator>::iterator
-deque<_Tp, _Allocator>::erase(const_iterator __f, const_iterator __l)
-{
- size_type __old_sz = size();
- size_type __old_start = __start_;
- difference_type __n = __l - __f;
- iterator __b = begin();
+void deque<_Tp, _Allocator>::__erase_to_end(const_iterator __f) {
+ size_type __old_sz = size();
+ size_type __old_start = __start_;
+ iterator __e = end();
+ difference_type __n = __e - __f;
+ if (__n > 0) {
+ allocator_type& __a = __alloc();
+ iterator __b = begin();
difference_type __pos = __f - __b;
- iterator __p = __b + __pos;
- if (__n > 0)
- {
- allocator_type& __a = __alloc();
- if (static_cast<size_t>(__pos) <= (size() - __n) / 2)
- { // erase from front
- iterator __i = std::move_backward(__b, __p, __p + __n);
- for (; __b != __i; ++__b)
- __alloc_traits::destroy(__a, std::addressof(*__b));
- __size() -= __n;
- __start_ += __n;
- __annotate_shrink_front(__old_sz, __old_start);
- while (__maybe_remove_front_spare()) {
- }
- }
- else
- { // erase from back
- iterator __i = std::move(__p + __n, end(), __p);
- for (iterator __e = end(); __i != __e; ++__i)
- __alloc_traits::destroy(__a, std::addressof(*__i));
- __size() -= __n;
- __annotate_shrink_back(__old_sz, __old_start);
- while (__maybe_remove_back_spare()) {
- }
- }
- }
- return begin() + __pos;
-}
-
-template <class _Tp, class _Allocator>
-void
-deque<_Tp, _Allocator>::__erase_to_end(const_iterator __f)
-{
- size_type __old_sz = size();
- size_type __old_start = __start_;
- iterator __e = end();
- difference_type __n = __e - __f;
- if (__n > 0)
- {
- allocator_type& __a = __alloc();
- iterator __b = begin();
- difference_type __pos = __f - __b;
- for (iterator __p = __b + __pos; __p != __e; ++__p)
- __alloc_traits::destroy(__a, std::addressof(*__p));
- __size() -= __n;
- __annotate_shrink_back(__old_sz, __old_start);
- while (__maybe_remove_back_spare()) {
- }
+ for (iterator __p = __b + __pos; __p != __e; ++__p)
+ __alloc_traits::destroy(__a, std::addressof(*__p));
+ __size() -= __n;
+ __annotate_shrink_back(__old_sz, __old_start);
+ while (__maybe_remove_back_spare()) {
}
+ }
}
template <class _Tp, class _Allocator>
-inline
-void
-deque<_Tp, _Allocator>::swap(deque& __c)
+inline void deque<_Tp, _Allocator>::swap(deque& __c)
#if _LIBCPP_STD_VER >= 14
- _NOEXCEPT
+ _NOEXCEPT
#else
- _NOEXCEPT_(!__alloc_traits::propagate_on_container_swap::value ||
- __is_nothrow_swappable<allocator_type>::value)
+ _NOEXCEPT_(!__alloc_traits::propagate_on_container_swap::value || __is_nothrow_swappable<allocator_type>::value)
#endif
{
- __map_.swap(__c.__map_);
- std::swap(__start_, __c.__start_);
- std::swap(__size(), __c.__size());
- std::__swap_allocator(__alloc(), __c.__alloc());
+ __map_.swap(__c.__map_);
+ std::swap(__start_, __c.__start_);
+ std::swap(__size(), __c.__size());
+ std::__swap_allocator(__alloc(), __c.__alloc());
}
template <class _Tp, class _Allocator>
-inline
-void
-deque<_Tp, _Allocator>::clear() _NOEXCEPT
-{
- __annotate_delete();
- allocator_type& __a = __alloc();
- for (iterator __i = begin(), __e = end(); __i != __e; ++__i)
- __alloc_traits::destroy(__a, std::addressof(*__i));
- __size() = 0;
- while (__map_.size() > 2)
- {
- __alloc_traits::deallocate(__a, __map_.front(), __block_size);
- __map_.pop_front();
- }
- switch (__map_.size())
- {
- case 1:
- __start_ = __block_size / 2;
- break;
- case 2:
- __start_ = __block_size;
- break;
- }
- __annotate_new(0);
+inline void deque<_Tp, _Allocator>::clear() _NOEXCEPT {
+ __annotate_delete();
+ allocator_type& __a = __alloc();
+ for (iterator __i = begin(), __e = end(); __i != __e; ++__i)
+ __alloc_traits::destroy(__a, std::addressof(*__i));
+ __size() = 0;
+ while (__map_.size() > 2) {
+ __alloc_traits::deallocate(__a, __map_.front(), __block_size);
+ __map_.pop_front();
+ }
+ switch (__map_.size()) {
+ case 1:
+ __start_ = __block_size / 2;
+ break;
+ case 2:
+ __start_ = __block_size;
+ break;
+ }
+ __annotate_new(0);
}
template <class _Tp, class _Allocator>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator==(const deque<_Tp, _Allocator>& __x, const deque<_Tp, _Allocator>& __y)
-{
- const typename deque<_Tp, _Allocator>::size_type __sz = __x.size();
- return __sz == __y.size() && std::equal(__x.begin(), __x.end(), __y.begin());
+inline _LIBCPP_HIDE_FROM_ABI bool operator==(const deque<_Tp, _Allocator>& __x, const deque<_Tp, _Allocator>& __y) {
+ const typename deque<_Tp, _Allocator>::size_type __sz = __x.size();
+ return __sz == __y.size() && std::equal(__x.begin(), __x.end(), __y.begin());
}
#if _LIBCPP_STD_VER <= 17
template <class _Tp, class _Allocator>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator!=(const deque<_Tp, _Allocator>& __x, const deque<_Tp, _Allocator>& __y)
-{
- return !(__x == __y);
+inline _LIBCPP_HIDE_FROM_ABI bool operator!=(const deque<_Tp, _Allocator>& __x, const deque<_Tp, _Allocator>& __y) {
+ return !(__x == __y);
}
template <class _Tp, class _Allocator>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator< (const deque<_Tp, _Allocator>& __x, const deque<_Tp, _Allocator>& __y)
-{
- return std::lexicographical_compare(__x.begin(), __x.end(), __y.begin(), __y.end());
+inline _LIBCPP_HIDE_FROM_ABI bool operator<(const deque<_Tp, _Allocator>& __x, const deque<_Tp, _Allocator>& __y) {
+ return std::lexicographical_compare(__x.begin(), __x.end(), __y.begin(), __y.end());
}
template <class _Tp, class _Allocator>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator> (const deque<_Tp, _Allocator>& __x, const deque<_Tp, _Allocator>& __y)
-{
- return __y < __x;
+inline _LIBCPP_HIDE_FROM_ABI bool operator>(const deque<_Tp, _Allocator>& __x, const deque<_Tp, _Allocator>& __y) {
+ return __y < __x;
}
template <class _Tp, class _Allocator>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator>=(const deque<_Tp, _Allocator>& __x, const deque<_Tp, _Allocator>& __y)
-{
- return !(__x < __y);
+inline _LIBCPP_HIDE_FROM_ABI bool operator>=(const deque<_Tp, _Allocator>& __x, const deque<_Tp, _Allocator>& __y) {
+ return !(__x < __y);
}
template <class _Tp, class _Allocator>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator<=(const deque<_Tp, _Allocator>& __x, const deque<_Tp, _Allocator>& __y)
-{
- return !(__y < __x);
+inline _LIBCPP_HIDE_FROM_ABI bool operator<=(const deque<_Tp, _Allocator>& __x, const deque<_Tp, _Allocator>& __y) {
+ return !(__y < __x);
}
#else // _LIBCPP_STD_VER <= 17
@@ -2930,19 +2543,16 @@ operator<=(const deque<_Tp, _Allocator>& __x, const deque<_Tp, _Allocator>& __y)
template <class _Tp, class _Allocator>
_LIBCPP_HIDE_FROM_ABI __synth_three_way_result<_Tp>
operator<=>(const deque<_Tp, _Allocator>& __x, const deque<_Tp, _Allocator>& __y) {
- return std::lexicographical_compare_three_way(
- __x.begin(), __x.end(), __y.begin(), __y.end(), std::__synth_three_way<_Tp, _Tp>);
+ return std::lexicographical_compare_three_way(
+ __x.begin(), __x.end(), __y.begin(), __y.end(), std::__synth_three_way<_Tp, _Tp>);
}
#endif // _LIBCPP_STD_VER <= 17
template <class _Tp, class _Allocator>
-inline _LIBCPP_HIDE_FROM_ABI
-void
-swap(deque<_Tp, _Allocator>& __x, deque<_Tp, _Allocator>& __y)
- _NOEXCEPT_(_NOEXCEPT_(__x.swap(__y)))
-{
- __x.swap(__y);
+inline _LIBCPP_HIDE_FROM_ABI void swap(deque<_Tp, _Allocator>& __x, deque<_Tp, _Allocator>& __y)
+ _NOEXCEPT_(_NOEXCEPT_(__x.swap(__y))) {
+ __x.swap(__y);
}
#if _LIBCPP_STD_VER >= 20
@@ -2964,10 +2574,10 @@ erase_if(deque<_Tp, _Allocator>& __c, _Predicate __pred) {
template <>
inline constexpr bool __format::__enable_insertable<std::deque<char>> = true;
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+# ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
template <>
inline constexpr bool __format::__enable_insertable<std::deque<wchar_t>> = true;
-#endif
+# endif
#endif // _LIBCPP_STD_VER >= 20
diff --git a/contrib/llvm-project/libcxx/include/errno.h b/contrib/llvm-project/libcxx/include/errno.h
index 7b02d2b47953..e657ad84ff44 100644
--- a/contrib/llvm-project/libcxx/include/errno.h
+++ b/contrib/llvm-project/libcxx/include/errno.h
@@ -34,365 +34,365 @@ Macros:
#ifdef __cplusplus
-#if !defined(EOWNERDEAD) || !defined(ENOTRECOVERABLE)
+# if !defined(EOWNERDEAD) || !defined(ENOTRECOVERABLE)
-#ifdef ELAST
+# ifdef ELAST
-static const int __elast1 = ELAST+1;
-static const int __elast2 = ELAST+2;
+static const int __elast1 = ELAST + 1;
+static const int __elast2 = ELAST + 2;
-#else
+# else
static const int __elast1 = 104;
static const int __elast2 = 105;
-#endif
+# endif
-#ifdef ENOTRECOVERABLE
+# ifdef ENOTRECOVERABLE
-#define EOWNERDEAD __elast1
+# define EOWNERDEAD __elast1
-#ifdef ELAST
-#undef ELAST
-#define ELAST EOWNERDEAD
-#endif
+# ifdef ELAST
+# undef ELAST
+# define ELAST EOWNERDEAD
+# endif
-#elif defined(EOWNERDEAD)
+# elif defined(EOWNERDEAD)
-#define ENOTRECOVERABLE __elast1
-#ifdef ELAST
-#undef ELAST
-#define ELAST ENOTRECOVERABLE
-#endif
+# define ENOTRECOVERABLE __elast1
+# ifdef ELAST
+# undef ELAST
+# define ELAST ENOTRECOVERABLE
+# endif
-#else // defined(EOWNERDEAD)
+# else // defined(EOWNERDEAD)
-#define EOWNERDEAD __elast1
-#define ENOTRECOVERABLE __elast2
-#ifdef ELAST
-#undef ELAST
-#define ELAST ENOTRECOVERABLE
-#endif
+# define EOWNERDEAD __elast1
+# define ENOTRECOVERABLE __elast2
+# ifdef ELAST
+# undef ELAST
+# define ELAST ENOTRECOVERABLE
+# endif
-#endif // defined(EOWNERDEAD)
+# endif // defined(EOWNERDEAD)
-#endif // !defined(EOWNERDEAD) || !defined(ENOTRECOVERABLE)
+# endif // !defined(EOWNERDEAD) || !defined(ENOTRECOVERABLE)
// supply errno values likely to be missing, particularly on Windows
-#ifndef EAFNOSUPPORT
-#define EAFNOSUPPORT 9901
-#endif
+# ifndef EAFNOSUPPORT
+# define EAFNOSUPPORT 9901
+# endif
-#ifndef EADDRINUSE
-#define EADDRINUSE 9902
-#endif
+# ifndef EADDRINUSE
+# define EADDRINUSE 9902
+# endif
-#ifndef EADDRNOTAVAIL
-#define EADDRNOTAVAIL 9903
-#endif
+# ifndef EADDRNOTAVAIL
+# define EADDRNOTAVAIL 9903
+# endif
-#ifndef EISCONN
-#define EISCONN 9904
-#endif
+# ifndef EISCONN
+# define EISCONN 9904
+# endif
-#ifndef EBADMSG
-#define EBADMSG 9905
-#endif
+# ifndef EBADMSG
+# define EBADMSG 9905
+# endif
-#ifndef ECONNABORTED
-#define ECONNABORTED 9906
-#endif
+# ifndef ECONNABORTED
+# define ECONNABORTED 9906
+# endif
-#ifndef EALREADY
-#define EALREADY 9907
-#endif
+# ifndef EALREADY
+# define EALREADY 9907
+# endif
-#ifndef ECONNREFUSED
-#define ECONNREFUSED 9908
-#endif
+# ifndef ECONNREFUSED
+# define ECONNREFUSED 9908
+# endif
-#ifndef ECONNRESET
-#define ECONNRESET 9909
-#endif
+# ifndef ECONNRESET
+# define ECONNRESET 9909
+# endif
-#ifndef EDESTADDRREQ
-#define EDESTADDRREQ 9910
-#endif
+# ifndef EDESTADDRREQ
+# define EDESTADDRREQ 9910
+# endif
-#ifndef EHOSTUNREACH
-#define EHOSTUNREACH 9911
-#endif
+# ifndef EHOSTUNREACH
+# define EHOSTUNREACH 9911
+# endif
-#ifndef EIDRM
-#define EIDRM 9912
-#endif
+# ifndef EIDRM
+# define EIDRM 9912
+# endif
-#ifndef EMSGSIZE
-#define EMSGSIZE 9913
-#endif
+# ifndef EMSGSIZE
+# define EMSGSIZE 9913
+# endif
-#ifndef ENETDOWN
-#define ENETDOWN 9914
-#endif
+# ifndef ENETDOWN
+# define ENETDOWN 9914
+# endif
-#ifndef ENETRESET
-#define ENETRESET 9915
-#endif
+# ifndef ENETRESET
+# define ENETRESET 9915
+# endif
-#ifndef ENETUNREACH
-#define ENETUNREACH 9916
-#endif
+# ifndef ENETUNREACH
+# define ENETUNREACH 9916
+# endif
-#ifndef ENOBUFS
-#define ENOBUFS 9917
-#endif
+# ifndef ENOBUFS
+# define ENOBUFS 9917
+# endif
-#ifndef ENOLINK
-#define ENOLINK 9918
-#endif
+# ifndef ENOLINK
+# define ENOLINK 9918
+# endif
-#ifndef ENODATA
-#define ENODATA 9919
-#endif
+# ifndef ENODATA
+# define ENODATA 9919
+# endif
-#ifndef ENOMSG
-#define ENOMSG 9920
-#endif
+# ifndef ENOMSG
+# define ENOMSG 9920
+# endif
-#ifndef ENOPROTOOPT
-#define ENOPROTOOPT 9921
-#endif
+# ifndef ENOPROTOOPT
+# define ENOPROTOOPT 9921
+# endif
-#ifndef ENOSR
-#define ENOSR 9922
-#endif
+# ifndef ENOSR
+# define ENOSR 9922
+# endif
-#ifndef ENOTSOCK
-#define ENOTSOCK 9923
-#endif
+# ifndef ENOTSOCK
+# define ENOTSOCK 9923
+# endif
-#ifndef ENOSTR
-#define ENOSTR 9924
-#endif
+# ifndef ENOSTR
+# define ENOSTR 9924
+# endif
-#ifndef ENOTCONN
-#define ENOTCONN 9925
-#endif
+# ifndef ENOTCONN
+# define ENOTCONN 9925
+# endif
-#ifndef ENOTSUP
-#define ENOTSUP 9926
-#endif
+# ifndef ENOTSUP
+# define ENOTSUP 9926
+# endif
-#ifndef ECANCELED
-#define ECANCELED 9927
-#endif
+# ifndef ECANCELED
+# define ECANCELED 9927
+# endif
-#ifndef EINPROGRESS
-#define EINPROGRESS 9928
-#endif
+# ifndef EINPROGRESS
+# define EINPROGRESS 9928
+# endif
-#ifndef EOPNOTSUPP
-#define EOPNOTSUPP 9929
-#endif
+# ifndef EOPNOTSUPP
+# define EOPNOTSUPP 9929
+# endif
-#ifndef EWOULDBLOCK
-#define EWOULDBLOCK 9930
-#endif
+# ifndef EWOULDBLOCK
+# define EWOULDBLOCK 9930
+# endif
-#ifndef EOWNERDEAD
-#define EOWNERDEAD 9931
-#endif
+# ifndef EOWNERDEAD
+# define EOWNERDEAD 9931
+# endif
-#ifndef EPROTO
-#define EPROTO 9932
-#endif
+# ifndef EPROTO
+# define EPROTO 9932
+# endif
-#ifndef EPROTONOSUPPORT
-#define EPROTONOSUPPORT 9933
-#endif
+# ifndef EPROTONOSUPPORT
+# define EPROTONOSUPPORT 9933
+# endif
-#ifndef ENOTRECOVERABLE
-#define ENOTRECOVERABLE 9934
-#endif
+# ifndef ENOTRECOVERABLE
+# define ENOTRECOVERABLE 9934
+# endif
-#ifndef ETIME
-#define ETIME 9935
-#endif
+# ifndef ETIME
+# define ETIME 9935
+# endif
-#ifndef ETXTBSY
-#define ETXTBSY 9936
-#endif
+# ifndef ETXTBSY
+# define ETXTBSY 9936
+# endif
-#ifndef ETIMEDOUT
-#define ETIMEDOUT 9938
-#endif
+# ifndef ETIMEDOUT
+# define ETIMEDOUT 9938
+# endif
-#ifndef ELOOP
-#define ELOOP 9939
-#endif
+# ifndef ELOOP
+# define ELOOP 9939
+# endif
-#ifndef EOVERFLOW
-#define EOVERFLOW 9940
-#endif
+# ifndef EOVERFLOW
+# define EOVERFLOW 9940
+# endif
-#ifndef EPROTOTYPE
-#define EPROTOTYPE 9941
-#endif
+# ifndef EPROTOTYPE
+# define EPROTOTYPE 9941
+# endif
-#ifndef ENOSYS
-#define ENOSYS 9942
-#endif
+# ifndef ENOSYS
+# define ENOSYS 9942
+# endif
-#ifndef EINVAL
-#define EINVAL 9943
-#endif
+# ifndef EINVAL
+# define EINVAL 9943
+# endif
-#ifndef ERANGE
-#define ERANGE 9944
-#endif
+# ifndef ERANGE
+# define ERANGE 9944
+# endif
-#ifndef EILSEQ
-#define EILSEQ 9945
-#endif
+# ifndef EILSEQ
+# define EILSEQ 9945
+# endif
// Windows Mobile doesn't appear to define these:
-#ifndef E2BIG
-#define E2BIG 9946
-#endif
+# ifndef E2BIG
+# define E2BIG 9946
+# endif
-#ifndef EDOM
-#define EDOM 9947
-#endif
+# ifndef EDOM
+# define EDOM 9947
+# endif
-#ifndef EFAULT
-#define EFAULT 9948
-#endif
+# ifndef EFAULT
+# define EFAULT 9948
+# endif
-#ifndef EBADF
-#define EBADF 9949
-#endif
+# ifndef EBADF
+# define EBADF 9949
+# endif
-#ifndef EPIPE
-#define EPIPE 9950
-#endif
+# ifndef EPIPE
+# define EPIPE 9950
+# endif
-#ifndef EXDEV
-#define EXDEV 9951
-#endif
+# ifndef EXDEV
+# define EXDEV 9951
+# endif
-#ifndef EBUSY
-#define EBUSY 9952
-#endif
+# ifndef EBUSY
+# define EBUSY 9952
+# endif
-#ifndef ENOTEMPTY
-#define ENOTEMPTY 9953
-#endif
+# ifndef ENOTEMPTY
+# define ENOTEMPTY 9953
+# endif
-#ifndef ENOEXEC
-#define ENOEXEC 9954
-#endif
+# ifndef ENOEXEC
+# define ENOEXEC 9954
+# endif
-#ifndef EEXIST
-#define EEXIST 9955
-#endif
+# ifndef EEXIST
+# define EEXIST 9955
+# endif
-#ifndef EFBIG
-#define EFBIG 9956
-#endif
+# ifndef EFBIG
+# define EFBIG 9956
+# endif
-#ifndef ENAMETOOLONG
-#define ENAMETOOLONG 9957
-#endif
+# ifndef ENAMETOOLONG
+# define ENAMETOOLONG 9957
+# endif
-#ifndef ENOTTY
-#define ENOTTY 9958
-#endif
+# ifndef ENOTTY
+# define ENOTTY 9958
+# endif
-#ifndef EINTR
-#define EINTR 9959
-#endif
+# ifndef EINTR
+# define EINTR 9959
+# endif
-#ifndef ESPIPE
-#define ESPIPE 9960
-#endif
+# ifndef ESPIPE
+# define ESPIPE 9960
+# endif
-#ifndef EIO
-#define EIO 9961
-#endif
+# ifndef EIO
+# define EIO 9961
+# endif
-#ifndef EISDIR
-#define EISDIR 9962
-#endif
+# ifndef EISDIR
+# define EISDIR 9962
+# endif
-#ifndef ECHILD
-#define ECHILD 9963
-#endif
+# ifndef ECHILD
+# define ECHILD 9963
+# endif
-#ifndef ENOLCK
-#define ENOLCK 9964
-#endif
+# ifndef ENOLCK
+# define ENOLCK 9964
+# endif
-#ifndef ENOSPC
-#define ENOSPC 9965
-#endif
+# ifndef ENOSPC
+# define ENOSPC 9965
+# endif
-#ifndef ENXIO
-#define ENXIO 9966
-#endif
+# ifndef ENXIO
+# define ENXIO 9966
+# endif
-#ifndef ENODEV
-#define ENODEV 9967
-#endif
+# ifndef ENODEV
+# define ENODEV 9967
+# endif
-#ifndef ENOENT
-#define ENOENT 9968
-#endif
+# ifndef ENOENT
+# define ENOENT 9968
+# endif
-#ifndef ESRCH
-#define ESRCH 9969
-#endif
+# ifndef ESRCH
+# define ESRCH 9969
+# endif
-#ifndef ENOTDIR
-#define ENOTDIR 9970
-#endif
+# ifndef ENOTDIR
+# define ENOTDIR 9970
+# endif
-#ifndef ENOMEM
-#define ENOMEM 9971
-#endif
+# ifndef ENOMEM
+# define ENOMEM 9971
+# endif
-#ifndef EPERM
-#define EPERM 9972
-#endif
+# ifndef EPERM
+# define EPERM 9972
+# endif
-#ifndef EACCES
-#define EACCES 9973
-#endif
+# ifndef EACCES
+# define EACCES 9973
+# endif
-#ifndef EROFS
-#define EROFS 9974
-#endif
+# ifndef EROFS
+# define EROFS 9974
+# endif
-#ifndef EDEADLK
-#define EDEADLK 9975
-#endif
+# ifndef EDEADLK
+# define EDEADLK 9975
+# endif
-#ifndef EAGAIN
-#define EAGAIN 9976
-#endif
+# ifndef EAGAIN
+# define EAGAIN 9976
+# endif
-#ifndef ENFILE
-#define ENFILE 9977
-#endif
+# ifndef ENFILE
+# define ENFILE 9977
+# endif
-#ifndef EMFILE
-#define EMFILE 9978
-#endif
+# ifndef EMFILE
+# define EMFILE 9978
+# endif
-#ifndef EMLINK
-#define EMLINK 9979
-#endif
+# ifndef EMLINK
+# define EMLINK 9979
+# endif
#endif // __cplusplus
diff --git a/contrib/llvm-project/libcxx/include/expected b/contrib/llvm-project/libcxx/include/expected
index 486d0a21d087..44d0ce6b00c8 100644
--- a/contrib/llvm-project/libcxx/include/expected
+++ b/contrib/llvm-project/libcxx/include/expected
@@ -51,4 +51,3 @@ namespace std {
#endif
#endif // _LIBCPP_EXPECTED
-
diff --git a/contrib/llvm-project/libcxx/include/experimental/__config b/contrib/llvm-project/libcxx/include/experimental/__config
index 8bc4f5dd141a..7b23791511ce 100644
--- a/contrib/llvm-project/libcxx/include/experimental/__config
+++ b/contrib/llvm-project/libcxx/include/experimental/__config
@@ -16,20 +16,30 @@
# pragma GCC system_header
#endif
-#define _LIBCPP_BEGIN_NAMESPACE_EXPERIMENTAL namespace std { namespace experimental {
-#define _LIBCPP_END_NAMESPACE_EXPERIMENTAL } }
+#define _LIBCPP_BEGIN_NAMESPACE_EXPERIMENTAL \
+ namespace std { \
+ namespace experimental {
+#define _LIBCPP_END_NAMESPACE_EXPERIMENTAL \
+ } \
+ }
#define _LIBCPP_BEGIN_NAMESPACE_LFTS _LIBCPP_BEGIN_NAMESPACE_EXPERIMENTAL inline namespace fundamentals_v1 {
-#define _LIBCPP_END_NAMESPACE_LFTS } } }
+#define _LIBCPP_END_NAMESPACE_LFTS \
+ } \
+ } \
+ }
#define _LIBCPP_BEGIN_NAMESPACE_LFTS_V2 _LIBCPP_BEGIN_NAMESPACE_EXPERIMENTAL inline namespace fundamentals_v2 {
-#define _LIBCPP_END_NAMESPACE_LFTS_V2 } } }
+#define _LIBCPP_END_NAMESPACE_LFTS_V2 \
+ } \
+ } \
+ }
// TODO: support more targets
#if defined(__AVX__)
-#define _LIBCPP_NATIVE_SIMD_WIDTH_IN_BYTES 32
+# define _LIBCPP_NATIVE_SIMD_WIDTH_IN_BYTES 32
#else
-#define _LIBCPP_NATIVE_SIMD_WIDTH_IN_BYTES 16
+# define _LIBCPP_NATIVE_SIMD_WIDTH_IN_BYTES 16
#endif
#endif
diff --git a/contrib/llvm-project/libcxx/include/experimental/__memory b/contrib/llvm-project/libcxx/include/experimental/__memory
index fb82922d1eb2..b9dbf541d7e4 100644
--- a/contrib/llvm-project/libcxx/include/experimental/__memory
+++ b/contrib/llvm-project/libcxx/include/experimental/__memory
@@ -25,11 +25,7 @@
_LIBCPP_BEGIN_NAMESPACE_LFTS
-template <
- class _Tp, class _Alloc
- , bool = uses_allocator<_Tp, _Alloc>::value
- , bool = __has_allocator_type<_Tp>::value
- >
+template < class _Tp, class _Alloc, bool = uses_allocator<_Tp, _Alloc>::value, bool = __has_allocator_type<_Tp>::value >
struct __lfts_uses_allocator : public false_type {};
template <class _Tp, class _Alloc>
@@ -40,79 +36,57 @@ struct __lfts_uses_allocator<_Tp, _Alloc, true, HasAlloc> : public true_type {};
template <class _Tp, class _Alloc>
struct __lfts_uses_allocator<_Tp, _Alloc, false, true>
- : public integral_constant<bool
- , is_convertible<_Alloc, typename _Tp::allocator_type>::value
- || is_same<erased_type, typename _Tp::allocator_type>::value
- >
-{};
-
-template <bool _UsesAlloc, class _Tp, class _Alloc, class ..._Args>
-struct __lfts_uses_alloc_ctor_imp
-{
- static const int value = 0;
+ : public integral_constant<bool,
+ is_convertible<_Alloc, typename _Tp::allocator_type>::value ||
+ is_same<erased_type, typename _Tp::allocator_type>::value > {};
+
+template <bool _UsesAlloc, class _Tp, class _Alloc, class... _Args>
+struct __lfts_uses_alloc_ctor_imp {
+ static const int value = 0;
};
-template <class _Tp, class _Alloc, class ..._Args>
-struct __lfts_uses_alloc_ctor_imp<true, _Tp, _Alloc, _Args...>
-{
- static const bool __ic_first
- = is_constructible<_Tp, allocator_arg_t, _Alloc, _Args...>::value;
+template <class _Tp, class _Alloc, class... _Args>
+struct __lfts_uses_alloc_ctor_imp<true, _Tp, _Alloc, _Args...> {
+ static const bool __ic_first = is_constructible<_Tp, allocator_arg_t, _Alloc, _Args...>::value;
- static const bool __ic_second =
- __conditional_t<
- __ic_first,
- false_type,
- is_constructible<_Tp, _Args..., _Alloc>
- >::value;
+ static const bool __ic_second =
+ __conditional_t< __ic_first, false_type, is_constructible<_Tp, _Args..., _Alloc> >::value;
- static_assert(__ic_first || __ic_second,
- "Request for uses allocator construction is ill-formed");
+ static_assert(__ic_first || __ic_second, "Request for uses allocator construction is ill-formed");
- static const int value = __ic_first ? 1 : 2;
+ static const int value = __ic_first ? 1 : 2;
};
-template <class _Tp, class _Alloc, class ..._Args>
+template <class _Tp, class _Alloc, class... _Args>
struct __lfts_uses_alloc_ctor
- : integral_constant<int,
- __lfts_uses_alloc_ctor_imp<
- __lfts_uses_allocator<_Tp, _Alloc>::value
- , _Tp, _Alloc, _Args...
- >::value
- >
-{};
+ : integral_constant<
+ int,
+ __lfts_uses_alloc_ctor_imp< __lfts_uses_allocator<_Tp, _Alloc>::value, _Tp, _Alloc, _Args... >::value > {};
template <class _Tp, class _Allocator, class... _Args>
-inline _LIBCPP_HIDE_FROM_ABI
-void __user_alloc_construct_impl (integral_constant<int, 0>, _Tp *__storage, const _Allocator &, _Args &&... __args )
-{
- new (__storage) _Tp (std::forward<_Args>(__args)...);
+inline _LIBCPP_HIDE_FROM_ABI void
+__user_alloc_construct_impl(integral_constant<int, 0>, _Tp* __storage, const _Allocator&, _Args&&... __args) {
+ new (__storage) _Tp(std::forward<_Args>(__args)...);
}
// FIXME: This should have a version which takes a non-const alloc.
template <class _Tp, class _Allocator, class... _Args>
-inline _LIBCPP_HIDE_FROM_ABI
-void __user_alloc_construct_impl (integral_constant<int, 1>, _Tp *__storage, const _Allocator &__a, _Args &&... __args )
-{
- new (__storage) _Tp (allocator_arg_t(), __a, std::forward<_Args>(__args)...);
+inline _LIBCPP_HIDE_FROM_ABI void
+__user_alloc_construct_impl(integral_constant<int, 1>, _Tp* __storage, const _Allocator& __a, _Args&&... __args) {
+ new (__storage) _Tp(allocator_arg_t(), __a, std::forward<_Args>(__args)...);
}
// FIXME: This should have a version which takes a non-const alloc.
template <class _Tp, class _Allocator, class... _Args>
-inline _LIBCPP_HIDE_FROM_ABI
-void __user_alloc_construct_impl (integral_constant<int, 2>, _Tp *__storage, const _Allocator &__a, _Args &&... __args )
-{
- new (__storage) _Tp (std::forward<_Args>(__args)..., __a);
+inline _LIBCPP_HIDE_FROM_ABI void
+__user_alloc_construct_impl(integral_constant<int, 2>, _Tp* __storage, const _Allocator& __a, _Args&&... __args) {
+ new (__storage) _Tp(std::forward<_Args>(__args)..., __a);
}
-template <class _Tp, class _Alloc, class ..._Args>
-inline _LIBCPP_HIDE_FROM_ABI
-void __lfts_user_alloc_construct(
- _Tp * __store, const _Alloc & __a, _Args &&... __args)
-{
- ::std::experimental::fundamentals_v1::__user_alloc_construct_impl(
- typename __lfts_uses_alloc_ctor<_Tp, _Alloc, _Args...>::type()
- , __store, __a, std::forward<_Args>(__args)...
- );
+template <class _Tp, class _Alloc, class... _Args>
+inline _LIBCPP_HIDE_FROM_ABI void __lfts_user_alloc_construct(_Tp* __store, const _Alloc& __a, _Args&&... __args) {
+ ::std::experimental::fundamentals_v1::__user_alloc_construct_impl(
+ typename __lfts_uses_alloc_ctor<_Tp, _Alloc, _Args...>::type(), __store, __a, std::forward<_Args>(__args)...);
}
_LIBCPP_END_NAMESPACE_LFTS
diff --git a/contrib/llvm-project/libcxx/include/experimental/__simd/abi_tag.h b/contrib/llvm-project/libcxx/include/experimental/__simd/abi_tag.h
deleted file mode 100644
index cec5be65ce5c..000000000000
--- a/contrib/llvm-project/libcxx/include/experimental/__simd/abi_tag.h
+++ /dev/null
@@ -1,55 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP_EXPERIMENTAL___SIMD_ABI_TAG_H
-#define _LIBCPP_EXPERIMENTAL___SIMD_ABI_TAG_H
-
-#include <cstddef>
-#include <experimental/__config>
-#include <experimental/__simd/internal_declaration.h>
-
-#if _LIBCPP_STD_VER >= 17 && defined(_LIBCPP_ENABLE_EXPERIMENTAL)
-
-_LIBCPP_BEGIN_NAMESPACE_EXPERIMENTAL
-inline namespace parallelism_v2 {
-namespace simd_abi {
-
-using scalar = __scalar;
-
-// TODO: make this platform dependent
-template <int _Np>
-using fixed_size = __vec_ext<_Np>;
-
-template <class _Tp>
-inline constexpr int max_fixed_size = 32;
-
-// TODO: make this platform dependent
-template <class _Tp>
-using compatible = __vec_ext<16 / sizeof(_Tp)>;
-
-// TODO: make this platform dependent
-template <class _Tp>
-using native = __vec_ext<_LIBCPP_NATIVE_SIMD_WIDTH_IN_BYTES / sizeof(_Tp)>;
-
-// TODO: make this platform dependent
-template <class _Tp, size_t _Np, class... _Abis>
-struct deduce {
- using type = fixed_size<_Np>;
-};
-
-// TODO: make this platform dependent
-template <class _Tp, size_t _Np, class... _Abis>
-using deduce_t = typename deduce<_Tp, _Np, _Abis...>::type;
-
-} // namespace simd_abi
-} // namespace parallelism_v2
-_LIBCPP_END_NAMESPACE_EXPERIMENTAL
-
-#endif // _LIBCPP_STD_VER >= 17 && defined(_LIBCPP_ENABLE_EXPERIMENTAL)
-#endif // _LIBCPP_EXPERIMENTAL___SIMD_ABI_TAG_H
diff --git a/contrib/llvm-project/libcxx/include/experimental/__simd/aligned_tag.h b/contrib/llvm-project/libcxx/include/experimental/__simd/aligned_tag.h
index d216a21c073f..edbb3b24931f 100644
--- a/contrib/llvm-project/libcxx/include/experimental/__simd/aligned_tag.h
+++ b/contrib/llvm-project/libcxx/include/experimental/__simd/aligned_tag.h
@@ -10,10 +10,10 @@
#ifndef _LIBCPP_EXPERIMENTAL___SIMD_ALIGNED_TAG_H
#define _LIBCPP_EXPERIMENTAL___SIMD_ALIGNED_TAG_H
-#include <__bit/bit_ceil.h>
#include <__memory/assume_aligned.h>
#include <cstddef>
#include <experimental/__config>
+#include <experimental/__simd/traits.h>
#if _LIBCPP_STD_VER >= 17 && defined(_LIBCPP_ENABLE_EXPERIMENTAL)
@@ -30,9 +30,12 @@ struct element_aligned_tag {
}
};
+template <>
+inline constexpr bool is_simd_flag_type_v<element_aligned_tag> = true;
+
struct vector_aligned_tag {
template <class _Tp, class _Up = typename _Tp::value_type>
- static constexpr size_t __alignment = std::__bit_ceil(sizeof(_Up) * _Tp::size());
+ static constexpr size_t __alignment = memory_alignment_v<_Tp, _Up>;
template <class _Tp, class _Up>
static _LIBCPP_HIDE_FROM_ABI constexpr _Up* __apply(_Up* __ptr) {
@@ -40,6 +43,9 @@ struct vector_aligned_tag {
}
};
+template <>
+inline constexpr bool is_simd_flag_type_v<vector_aligned_tag> = true;
+
template <size_t _Np>
struct overaligned_tag {
template <class _Tp, class _Up = typename _Tp::value_type>
@@ -51,6 +57,9 @@ struct overaligned_tag {
}
};
+template <size_t _Np>
+inline constexpr bool is_simd_flag_type_v<overaligned_tag<_Np>> = true;
+
inline constexpr element_aligned_tag element_aligned{};
inline constexpr vector_aligned_tag vector_aligned{};
diff --git a/contrib/llvm-project/libcxx/include/experimental/__simd/declaration.h b/contrib/llvm-project/libcxx/include/experimental/__simd/declaration.h
index 065faeaec384..7b45d035c271 100644
--- a/contrib/llvm-project/libcxx/include/experimental/__simd/declaration.h
+++ b/contrib/llvm-project/libcxx/include/experimental/__simd/declaration.h
@@ -10,13 +10,63 @@
#ifndef _LIBCPP_EXPERIMENTAL___SIMD_DECLARATION_H
#define _LIBCPP_EXPERIMENTAL___SIMD_DECLARATION_H
+#include <cstddef>
#include <experimental/__config>
-#include <experimental/__simd/abi_tag.h>
#if _LIBCPP_STD_VER >= 17 && defined(_LIBCPP_ENABLE_EXPERIMENTAL)
_LIBCPP_BEGIN_NAMESPACE_EXPERIMENTAL
inline namespace parallelism_v2 {
+namespace simd_abi {
+template <int>
+struct __vec_ext;
+struct __scalar;
+
+using scalar = __scalar;
+
+// TODO: make this platform dependent
+template <int _Np>
+using fixed_size = __vec_ext<_Np>;
+
+template <class _Tp>
+inline constexpr int max_fixed_size = 32;
+
+// TODO: make this platform dependent
+template <class _Tp>
+using compatible = __vec_ext<16 / sizeof(_Tp)>;
+
+// TODO: make this platform dependent
+template <class _Tp>
+using native = __vec_ext<_LIBCPP_NATIVE_SIMD_WIDTH_IN_BYTES / sizeof(_Tp)>;
+
+// TODO: make this platform dependent
+template <class _Tp, size_t _Np, class... _Abis>
+struct deduce {
+ using type = fixed_size<_Np>;
+};
+
+// TODO: make this platform dependent
+template <class _Tp, size_t _Np, class... _Abis>
+using deduce_t = typename deduce<_Tp, _Np, _Abis...>::type;
+
+} // namespace simd_abi
+
+template <class _Tp, class _Abi>
+struct __simd_storage;
+
+template <class _Tp, class _Abi>
+struct __mask_storage;
+
+template <class _Tp, class _Abi>
+struct __simd_operations;
+
+template <class _Tp, class _Abi>
+struct __mask_operations;
+
+struct element_aligned_tag;
+struct vector_aligned_tag;
+template <size_t>
+struct overaligned_tag;
template <class _Tp, class _Abi = simd_abi::compatible<_Tp>>
class simd;
diff --git a/contrib/llvm-project/libcxx/include/experimental/__simd/internal_declaration.h b/contrib/llvm-project/libcxx/include/experimental/__simd/internal_declaration.h
deleted file mode 100644
index 9ad1ad1ae319..000000000000
--- a/contrib/llvm-project/libcxx/include/experimental/__simd/internal_declaration.h
+++ /dev/null
@@ -1,41 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP_EXPERIMENTAL___SIMD_INTERNAL_DECLARATION_H
-#define _LIBCPP_EXPERIMENTAL___SIMD_INTERNAL_DECLARATION_H
-
-#include <experimental/__config>
-
-#if _LIBCPP_STD_VER >= 17 && defined(_LIBCPP_ENABLE_EXPERIMENTAL)
-
-_LIBCPP_BEGIN_NAMESPACE_EXPERIMENTAL
-inline namespace parallelism_v2 {
-namespace simd_abi {
-template <int>
-struct __vec_ext;
-struct __scalar;
-} // namespace simd_abi
-
-template <class _Tp, class _Abi>
-struct __simd_storage;
-
-template <class _Tp, class _Abi>
-struct __mask_storage;
-
-template <class _Tp, class _Abi>
-struct __simd_operations;
-
-template <class _Tp, class _Abi>
-struct __mask_operations;
-
-} // namespace parallelism_v2
-_LIBCPP_END_NAMESPACE_EXPERIMENTAL
-
-#endif // _LIBCPP_STD_VER >= 17 && defined(_LIBCPP_ENABLE_EXPERIMENTAL)
-#endif // _LIBCPP_EXPERIMENTAL___SIMD_INTERNAL_DECLARATION_H
diff --git a/contrib/llvm-project/libcxx/include/experimental/__simd/scalar.h b/contrib/llvm-project/libcxx/include/experimental/__simd/scalar.h
index 53fa1c29f374..5eeff4c1e82a 100644
--- a/contrib/llvm-project/libcxx/include/experimental/__simd/scalar.h
+++ b/contrib/llvm-project/libcxx/include/experimental/__simd/scalar.h
@@ -12,7 +12,7 @@
#include <cstddef>
#include <experimental/__config>
-#include <experimental/__simd/internal_declaration.h>
+#include <experimental/__simd/declaration.h>
#include <experimental/__simd/traits.h>
#if _LIBCPP_STD_VER >= 17 && defined(_LIBCPP_ENABLE_EXPERIMENTAL)
diff --git a/contrib/llvm-project/libcxx/include/experimental/__simd/simd.h b/contrib/llvm-project/libcxx/include/experimental/__simd/simd.h
index ffb328eb345b..c345811fee7f 100644
--- a/contrib/llvm-project/libcxx/include/experimental/__simd/simd.h
+++ b/contrib/llvm-project/libcxx/include/experimental/__simd/simd.h
@@ -15,9 +15,7 @@
#include <__utility/forward.h>
#include <cstddef>
#include <experimental/__config>
-#include <experimental/__simd/abi_tag.h>
#include <experimental/__simd/declaration.h>
-#include <experimental/__simd/internal_declaration.h>
#include <experimental/__simd/reference.h>
#include <experimental/__simd/traits.h>
#include <experimental/__simd/utility.h>
diff --git a/contrib/llvm-project/libcxx/include/experimental/__simd/simd_mask.h b/contrib/llvm-project/libcxx/include/experimental/__simd/simd_mask.h
index 325b8409e3b6..db03843b46e3 100644
--- a/contrib/llvm-project/libcxx/include/experimental/__simd/simd_mask.h
+++ b/contrib/llvm-project/libcxx/include/experimental/__simd/simd_mask.h
@@ -13,9 +13,7 @@
#include <__type_traits/is_same.h>
#include <cstddef>
#include <experimental/__config>
-#include <experimental/__simd/abi_tag.h>
#include <experimental/__simd/declaration.h>
-#include <experimental/__simd/internal_declaration.h>
#include <experimental/__simd/reference.h>
#include <experimental/__simd/traits.h>
diff --git a/contrib/llvm-project/libcxx/include/experimental/__simd/traits.h b/contrib/llvm-project/libcxx/include/experimental/__simd/traits.h
index 9b4abe9d0c23..ec25b4bfa7f9 100644
--- a/contrib/llvm-project/libcxx/include/experimental/__simd/traits.h
+++ b/contrib/llvm-project/libcxx/include/experimental/__simd/traits.h
@@ -10,14 +10,12 @@
#ifndef _LIBCPP_EXPERIMENTAL___SIMD_TRAITS_H
#define _LIBCPP_EXPERIMENTAL___SIMD_TRAITS_H
+#include <__bit/bit_ceil.h>
#include <__type_traits/integral_constant.h>
#include <__type_traits/is_same.h>
#include <cstddef>
#include <experimental/__config>
-#include <experimental/__simd/abi_tag.h>
-#include <experimental/__simd/aligned_tag.h>
#include <experimental/__simd/declaration.h>
-#include <experimental/__simd/internal_declaration.h>
#include <experimental/__simd/utility.h>
#if _LIBCPP_STD_VER >= 17 && defined(_LIBCPP_ENABLE_EXPERIMENTAL)
@@ -47,15 +45,6 @@ struct is_simd_mask : bool_constant<is_simd_mask_v<_Tp>> {};
template <class _Tp>
inline constexpr bool is_simd_flag_type_v = false;
-template <>
-inline constexpr bool is_simd_flag_type_v<element_aligned_tag> = true;
-
-template <>
-inline constexpr bool is_simd_flag_type_v<vector_aligned_tag> = true;
-
-template <size_t _Np>
-inline constexpr bool is_simd_flag_type_v<overaligned_tag<_Np>> = true;
-
template <class _Tp>
struct is_simd_flag_type : bool_constant<is_simd_flag_type_v<_Tp>> {};
@@ -71,7 +60,7 @@ inline constexpr size_t simd_size_v = simd_size<_Tp, _Abi>::value;
template <class _Tp,
class _Up = typename _Tp::value_type,
bool = (is_simd_v<_Tp> && __is_vectorizable_v<_Up>) || (is_simd_mask_v<_Tp> && is_same_v<_Up, bool>)>
-struct memory_alignment : integral_constant<size_t, vector_aligned_tag::__alignment<_Tp, _Up>> {};
+struct memory_alignment : integral_constant<size_t, std::__bit_ceil(sizeof(_Up) * _Tp::size())> {};
template <class _Tp, class _Up>
struct memory_alignment<_Tp, _Up, false> {};
diff --git a/contrib/llvm-project/libcxx/include/experimental/__simd/vec_ext.h b/contrib/llvm-project/libcxx/include/experimental/__simd/vec_ext.h
index baaeda6a7401..07ba032f493b 100644
--- a/contrib/llvm-project/libcxx/include/experimental/__simd/vec_ext.h
+++ b/contrib/llvm-project/libcxx/include/experimental/__simd/vec_ext.h
@@ -15,7 +15,7 @@
#include <__utility/integer_sequence.h>
#include <cstddef>
#include <experimental/__config>
-#include <experimental/__simd/internal_declaration.h>
+#include <experimental/__simd/declaration.h>
#include <experimental/__simd/traits.h>
#include <experimental/__simd/utility.h>
@@ -38,11 +38,11 @@ struct __simd_storage<_Tp, simd_abi::__vec_ext<_Np>> {
_Tp __data __attribute__((__vector_size__(std::__bit_ceil((sizeof(_Tp) * _Np)))));
_LIBCPP_HIDE_FROM_ABI _Tp __get(size_t __idx) const noexcept {
- _LIBCPP_ASSERT_UNCATEGORIZED(__idx >= 0 && __idx < _Np, "Index is out of bounds");
+ _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__idx >= 0 && __idx < _Np, "Index is out of bounds");
return __data[__idx];
}
_LIBCPP_HIDE_FROM_ABI void __set(size_t __idx, _Tp __v) noexcept {
- _LIBCPP_ASSERT_UNCATEGORIZED(__idx >= 0 && __idx < _Np, "Index is out of bounds");
+ _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__idx >= 0 && __idx < _Np, "Index is out of bounds");
__data[__idx] = __v;
}
};
diff --git a/contrib/llvm-project/libcxx/include/experimental/iterator b/contrib/llvm-project/libcxx/include/experimental/iterator
index bca7d4c182ad..5bb1dd1ada63 100644
--- a/contrib/llvm-project/libcxx/include/experimental/iterator
+++ b/contrib/llvm-project/libcxx/include/experimental/iterator
@@ -71,48 +71,45 @@ _LIBCPP_BEGIN_NAMESPACE_LFTS
template <class _Delim, class _CharT = char, class _Traits = char_traits<_CharT>>
class ostream_joiner {
public:
-
- typedef _CharT char_type;
- typedef _Traits traits_type;
- typedef basic_ostream<char_type,traits_type> ostream_type;
- typedef output_iterator_tag iterator_category;
- typedef void value_type;
- typedef void difference_type;
- typedef void pointer;
- typedef void reference;
-
- _LIBCPP_HIDE_FROM_ABI ostream_joiner(ostream_type& __os, _Delim&& __d)
- : __output_iter_(std::addressof(__os)), __delim_(std::move(__d)), __first_(true) {}
-
- _LIBCPP_HIDE_FROM_ABI ostream_joiner(ostream_type& __os, const _Delim& __d)
- : __output_iter_(std::addressof(__os)), __delim_(__d), __first_(true) {}
-
-
- template<typename _Tp>
- _LIBCPP_HIDE_FROM_ABI ostream_joiner& operator=(const _Tp& __v)
- {
- if (!__first_)
- *__output_iter_ << __delim_;
- __first_ = false;
- *__output_iter_ << __v;
- return *this;
- }
-
- _LIBCPP_HIDE_FROM_ABI ostream_joiner& operator*() _NOEXCEPT { return *this; }
- _LIBCPP_HIDE_FROM_ABI ostream_joiner& operator++() _NOEXCEPT { return *this; }
- _LIBCPP_HIDE_FROM_ABI ostream_joiner& operator++(int) _NOEXCEPT { return *this; }
+ typedef _CharT char_type;
+ typedef _Traits traits_type;
+ typedef basic_ostream<char_type, traits_type> ostream_type;
+ typedef output_iterator_tag iterator_category;
+ typedef void value_type;
+ typedef void difference_type;
+ typedef void pointer;
+ typedef void reference;
+
+ _LIBCPP_HIDE_FROM_ABI ostream_joiner(ostream_type& __os, _Delim&& __d)
+ : __output_iter_(std::addressof(__os)), __delim_(std::move(__d)), __first_(true) {}
+
+ _LIBCPP_HIDE_FROM_ABI ostream_joiner(ostream_type& __os, const _Delim& __d)
+ : __output_iter_(std::addressof(__os)), __delim_(__d), __first_(true) {}
+
+ template <typename _Tp>
+ _LIBCPP_HIDE_FROM_ABI ostream_joiner& operator=(const _Tp& __v) {
+ if (!__first_)
+ *__output_iter_ << __delim_;
+ __first_ = false;
+ *__output_iter_ << __v;
+ return *this;
+ }
+
+ _LIBCPP_HIDE_FROM_ABI ostream_joiner& operator*() _NOEXCEPT { return *this; }
+ _LIBCPP_HIDE_FROM_ABI ostream_joiner& operator++() _NOEXCEPT { return *this; }
+ _LIBCPP_HIDE_FROM_ABI ostream_joiner& operator++(int) _NOEXCEPT { return *this; }
private:
- ostream_type* __output_iter_;
- _Delim __delim_;
- bool __first_;
+ ostream_type* __output_iter_;
+ _Delim __delim_;
+ bool __first_;
};
-
template <class _CharT, class _Traits, class _Delim>
_LIBCPP_HIDE_FROM_ABI ostream_joiner<__decay_t<_Delim>, _CharT, _Traits>
-make_ostream_joiner(basic_ostream<_CharT, _Traits>& __os, _Delim && __d)
-{ return ostream_joiner<__decay_t<_Delim>, _CharT, _Traits>(__os, std::forward<_Delim>(__d)); }
+make_ostream_joiner(basic_ostream<_CharT, _Traits>& __os, _Delim&& __d) {
+ return ostream_joiner<__decay_t<_Delim>, _CharT, _Traits>(__os, std::forward<_Delim>(__d));
+}
_LIBCPP_END_NAMESPACE_LFTS
diff --git a/contrib/llvm-project/libcxx/include/experimental/propagate_const b/contrib/llvm-project/libcxx/include/experimental/propagate_const
index fd58f6637af5..06d7ba43daf1 100644
--- a/contrib/llvm-project/libcxx/include/experimental/propagate_const
+++ b/contrib/llvm-project/libcxx/include/experimental/propagate_const
@@ -146,69 +146,58 @@ template <class _Tp>
class propagate_const;
template <class _Up>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR
-const _Up& get_underlying(const propagate_const<_Up>& __pu) _NOEXCEPT;
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR const _Up& get_underlying(const propagate_const<_Up>& __pu) _NOEXCEPT;
template <class _Up>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR
-_Up& get_underlying(propagate_const<_Up>& __pu) _NOEXCEPT;
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR _Up& get_underlying(propagate_const<_Up>& __pu) _NOEXCEPT;
template <class _Tp>
-class propagate_const
-{
+class propagate_const {
public:
typedef remove_reference_t<decltype(*std::declval<_Tp&>())> element_type;
- static_assert(!is_array<_Tp>::value,
- "Instantiation of propagate_const with an array type is ill-formed.");
- static_assert(!is_reference<_Tp>::value,
- "Instantiation of propagate_const with a reference type is ill-formed.");
+ static_assert(!is_array<_Tp>::value, "Instantiation of propagate_const with an array type is ill-formed.");
+ static_assert(!is_reference<_Tp>::value, "Instantiation of propagate_const with a reference type is ill-formed.");
static_assert(!(is_pointer<_Tp>::value && is_function<__remove_pointer_t<_Tp> >::value),
- "Instantiation of propagate_const with a function-pointer type is ill-formed.");
+ "Instantiation of propagate_const with a function-pointer type is ill-formed.");
static_assert(!(is_pointer<_Tp>::value && is_same<__remove_cv_t<__remove_pointer_t<_Tp> >, void>::value),
- "Instantiation of propagate_const with a pointer to (possibly cv-qualified) void is ill-formed.");
+ "Instantiation of propagate_const with a pointer to (possibly cv-qualified) void is ill-formed.");
private:
template <class _Up>
- static _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR element_type* __get_pointer(_Up* __u)
- {
+ static _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR element_type* __get_pointer(_Up* __u) {
return __u;
}
template <class _Up>
- static _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR element_type* __get_pointer(_Up& __u)
- {
+ static _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR element_type* __get_pointer(_Up& __u) {
return __get_pointer(__u.get());
}
template <class _Up>
- static _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR const element_type* __get_pointer(const _Up* __u)
- {
+ static _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR const element_type* __get_pointer(const _Up* __u) {
return __u;
}
template <class _Up>
- static _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR const element_type* __get_pointer(const _Up& __u)
- {
+ static _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR const element_type* __get_pointer(const _Up& __u) {
return __get_pointer(__u.get());
}
template <class _Up>
- struct __is_propagate_const : false_type
- {
- };
+ struct __is_propagate_const : false_type {};
template <class _Up>
- struct __is_propagate_const<propagate_const<_Up>> : true_type
- {
- };
+ struct __is_propagate_const<propagate_const<_Up>> : true_type {};
_Tp __t_;
public:
-
- template <class _Up> friend _LIBCPP_CONSTEXPR const _Up& experimental::fundamentals_v2::get_underlying(const propagate_const<_Up>& __pu) _NOEXCEPT;
- template <class _Up> friend _LIBCPP_CONSTEXPR _Up& experimental::fundamentals_v2::get_underlying(propagate_const<_Up>& __pu) _NOEXCEPT;
+ template <class _Up>
+ friend _LIBCPP_CONSTEXPR const _Up&
+ experimental::fundamentals_v2::get_underlying(const propagate_const<_Up>& __pu) _NOEXCEPT;
+ template <class _Up>
+ friend _LIBCPP_CONSTEXPR _Up& experimental::fundamentals_v2::get_underlying(propagate_const<_Up>& __pu) _NOEXCEPT;
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR propagate_const() = default;
@@ -216,100 +205,67 @@ public:
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR propagate_const(propagate_const&&) = default;
- template <class _Up, enable_if_t<!is_convertible<_Up, _Tp>::value &&
- is_constructible<_Tp, _Up&&>::value,bool> = true>
+ template <class _Up,
+ enable_if_t<!is_convertible<_Up, _Tp>::value && is_constructible<_Tp, _Up&&>::value, bool> = true>
explicit _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR propagate_const(propagate_const<_Up>&& __pu)
- : __t_(std::move(experimental::get_underlying(__pu)))
- {
- }
+ : __t_(std::move(experimental::get_underlying(__pu))) {}
- template <class _Up, enable_if_t<is_convertible<_Up&&, _Tp>::value &&
- is_constructible<_Tp, _Up&&>::value,bool> = false>
+ template <class _Up,
+ enable_if_t<is_convertible<_Up&&, _Tp>::value && is_constructible<_Tp, _Up&&>::value, bool> = false>
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR propagate_const(propagate_const<_Up>&& __pu)
- : __t_(std::move(experimental::get_underlying(__pu)))
- {
- }
+ : __t_(std::move(experimental::get_underlying(__pu))) {}
- template <class _Up, enable_if_t<!is_convertible<_Up&&, _Tp>::value &&
- is_constructible<_Tp, _Up&&>::value &&
- !__is_propagate_const<decay_t<_Up>>::value,bool> = true>
- explicit _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR propagate_const(_Up&& __u)
- : __t_(std::forward<_Up>(__u))
- {
- }
+ template <class _Up,
+ enable_if_t<!is_convertible<_Up&&, _Tp>::value && is_constructible<_Tp, _Up&&>::value &&
+ !__is_propagate_const<decay_t<_Up>>::value,
+ bool> = true>
+ explicit _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR propagate_const(_Up&& __u) : __t_(std::forward<_Up>(__u)) {}
- template <class _Up, enable_if_t<is_convertible<_Up&&, _Tp>::value &&
- is_constructible<_Tp, _Up&&>::value &&
- !__is_propagate_const<decay_t<_Up>>::value,bool> = false>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR propagate_const(_Up&& __u)
- : __t_(std::forward<_Up>(__u))
- {
- }
+ template <class _Up,
+ enable_if_t<is_convertible<_Up&&, _Tp>::value && is_constructible<_Tp, _Up&&>::value &&
+ !__is_propagate_const<decay_t<_Up>>::value,
+ bool> = false>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR propagate_const(_Up&& __u) : __t_(std::forward<_Up>(__u)) {}
propagate_const& operator=(const propagate_const&) = delete;
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR propagate_const& operator=(propagate_const&&) = default;
template <class _Up>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR propagate_const& operator=(propagate_const<_Up>&& __pu)
- {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR propagate_const& operator=(propagate_const<_Up>&& __pu) {
__t_ = std::move(experimental::get_underlying(__pu));
return *this;
}
template <class _Up, class _Vp = enable_if_t<!__is_propagate_const<decay_t<_Up>>::value>>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR propagate_const& operator=(_Up&& __u)
- {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR propagate_const& operator=(_Up&& __u) {
__t_ = std::forward<_Up>(__u);
return *this;
}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR const element_type* get() const
- {
- return __get_pointer(__t_);
- }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR const element_type* get() const { return __get_pointer(__t_); }
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR element_type* get()
- {
- return __get_pointer(__t_);
- }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR element_type* get() { return __get_pointer(__t_); }
- _LIBCPP_HIDE_FROM_ABI explicit _LIBCPP_CONSTEXPR operator bool() const
- {
- return get() != nullptr;
- }
+ _LIBCPP_HIDE_FROM_ABI explicit _LIBCPP_CONSTEXPR operator bool() const { return get() != nullptr; }
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR const element_type* operator->() const
- {
- return get();
- }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR const element_type* operator->() const { return get(); }
- template <class _Dummy = _Tp, class _Up = enable_if_t<is_convertible<
- const _Dummy, const element_type *>::value>>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR operator const element_type *() const {
+ template <class _Dummy = _Tp, class _Up = enable_if_t<is_convertible< const _Dummy, const element_type*>::value>>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR operator const element_type*() const {
return get();
}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR const element_type& operator*() const
- {
- return *get();
- }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR const element_type& operator*() const { return *get(); }
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR element_type* operator->()
- {
- return get();
- }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR element_type* operator->() { return get(); }
- template <class _Dummy = _Tp, class _Up = enable_if_t<
- is_convertible<_Dummy, element_type *>::value>>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR operator element_type *() {
+ template <class _Dummy = _Tp, class _Up = enable_if_t< is_convertible<_Dummy, element_type*>::value>>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR operator element_type*() {
return get();
}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR element_type& operator*()
- {
- return *get();
- }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR element_type& operator*() { return *get(); }
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR void swap(propagate_const& __pt)
_NOEXCEPT_(__is_nothrow_swappable<_Tp>::value) {
@@ -318,184 +274,135 @@ public:
}
};
-
template <class _Tp>
-_LIBCPP_HIDE_FROM_ABI
-_LIBCPP_CONSTEXPR bool operator==(const propagate_const<_Tp>& __pt, nullptr_t)
-{
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool operator==(const propagate_const<_Tp>& __pt, nullptr_t) {
return experimental::get_underlying(__pt) == nullptr;
}
template <class _Tp>
-_LIBCPP_HIDE_FROM_ABI
-_LIBCPP_CONSTEXPR bool operator==(nullptr_t, const propagate_const<_Tp>& __pt)
-{
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool operator==(nullptr_t, const propagate_const<_Tp>& __pt) {
return nullptr == experimental::get_underlying(__pt);
}
template <class _Tp>
-_LIBCPP_HIDE_FROM_ABI
-_LIBCPP_CONSTEXPR bool operator!=(const propagate_const<_Tp>& __pt, nullptr_t)
-{
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool operator!=(const propagate_const<_Tp>& __pt, nullptr_t) {
return experimental::get_underlying(__pt) != nullptr;
}
template <class _Tp>
-_LIBCPP_HIDE_FROM_ABI
-_LIBCPP_CONSTEXPR bool operator!=(nullptr_t, const propagate_const<_Tp>& __pt)
-{
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool operator!=(nullptr_t, const propagate_const<_Tp>& __pt) {
return nullptr != experimental::get_underlying(__pt);
}
template <class _Tp, class _Up>
-_LIBCPP_HIDE_FROM_ABI
-_LIBCPP_CONSTEXPR bool operator==(const propagate_const<_Tp>& __pt,
- const propagate_const<_Up>& __pu)
-{
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool
+operator==(const propagate_const<_Tp>& __pt, const propagate_const<_Up>& __pu) {
return experimental::get_underlying(__pt) == experimental::get_underlying(__pu);
}
template <class _Tp, class _Up>
-_LIBCPP_HIDE_FROM_ABI
-_LIBCPP_CONSTEXPR bool operator!=(const propagate_const<_Tp>& __pt,
- const propagate_const<_Up>& __pu)
-{
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool
+operator!=(const propagate_const<_Tp>& __pt, const propagate_const<_Up>& __pu) {
return experimental::get_underlying(__pt) != experimental::get_underlying(__pu);
}
template <class _Tp, class _Up>
-_LIBCPP_HIDE_FROM_ABI
-_LIBCPP_CONSTEXPR bool operator<(const propagate_const<_Tp>& __pt,
- const propagate_const<_Up>& __pu)
-{
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool
+operator<(const propagate_const<_Tp>& __pt, const propagate_const<_Up>& __pu) {
return experimental::get_underlying(__pt) < experimental::get_underlying(__pu);
}
template <class _Tp, class _Up>
-_LIBCPP_HIDE_FROM_ABI
-_LIBCPP_CONSTEXPR bool operator>(const propagate_const<_Tp>& __pt,
- const propagate_const<_Up>& __pu)
-{
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool
+operator>(const propagate_const<_Tp>& __pt, const propagate_const<_Up>& __pu) {
return experimental::get_underlying(__pt) > experimental::get_underlying(__pu);
}
template <class _Tp, class _Up>
-_LIBCPP_HIDE_FROM_ABI
-_LIBCPP_CONSTEXPR bool operator<=(const propagate_const<_Tp>& __pt,
- const propagate_const<_Up>& __pu)
-{
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool
+operator<=(const propagate_const<_Tp>& __pt, const propagate_const<_Up>& __pu) {
return experimental::get_underlying(__pt) <= experimental::get_underlying(__pu);
}
template <class _Tp, class _Up>
-_LIBCPP_HIDE_FROM_ABI
-_LIBCPP_CONSTEXPR bool operator>=(const propagate_const<_Tp>& __pt,
- const propagate_const<_Up>& __pu)
-{
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool
+operator>=(const propagate_const<_Tp>& __pt, const propagate_const<_Up>& __pu) {
return experimental::get_underlying(__pt) >= experimental::get_underlying(__pu);
}
template <class _Tp, class _Up>
-_LIBCPP_HIDE_FROM_ABI
-_LIBCPP_CONSTEXPR bool operator==(const propagate_const<_Tp>& __pt, const _Up& __u)
-{
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool operator==(const propagate_const<_Tp>& __pt, const _Up& __u) {
return experimental::get_underlying(__pt) == __u;
}
template <class _Tp, class _Up>
-_LIBCPP_HIDE_FROM_ABI
-_LIBCPP_CONSTEXPR bool operator!=(const propagate_const<_Tp>& __pt, const _Up& __u)
-{
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool operator!=(const propagate_const<_Tp>& __pt, const _Up& __u) {
return experimental::get_underlying(__pt) != __u;
}
template <class _Tp, class _Up>
-_LIBCPP_HIDE_FROM_ABI
-_LIBCPP_CONSTEXPR bool operator<(const propagate_const<_Tp>& __pt, const _Up& __u)
-{
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool operator<(const propagate_const<_Tp>& __pt, const _Up& __u) {
return experimental::get_underlying(__pt) < __u;
}
template <class _Tp, class _Up>
-_LIBCPP_HIDE_FROM_ABI
-_LIBCPP_CONSTEXPR bool operator>(const propagate_const<_Tp>& __pt, const _Up& __u)
-{
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool operator>(const propagate_const<_Tp>& __pt, const _Up& __u) {
return experimental::get_underlying(__pt) > __u;
}
template <class _Tp, class _Up>
-_LIBCPP_HIDE_FROM_ABI
-_LIBCPP_CONSTEXPR bool operator<=(const propagate_const<_Tp>& __pt, const _Up& __u)
-{
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool operator<=(const propagate_const<_Tp>& __pt, const _Up& __u) {
return experimental::get_underlying(__pt) <= __u;
}
template <class _Tp, class _Up>
-_LIBCPP_HIDE_FROM_ABI
-_LIBCPP_CONSTEXPR bool operator>=(const propagate_const<_Tp>& __pt, const _Up& __u)
-{
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool operator>=(const propagate_const<_Tp>& __pt, const _Up& __u) {
return experimental::get_underlying(__pt) >= __u;
}
-
template <class _Tp, class _Up>
-_LIBCPP_HIDE_FROM_ABI
-_LIBCPP_CONSTEXPR bool operator==(const _Tp& __t, const propagate_const<_Up>& __pu)
-{
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool operator==(const _Tp& __t, const propagate_const<_Up>& __pu) {
return __t == experimental::get_underlying(__pu);
}
template <class _Tp, class _Up>
-_LIBCPP_HIDE_FROM_ABI
-_LIBCPP_CONSTEXPR bool operator!=(const _Tp& __t, const propagate_const<_Up>& __pu)
-{
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool operator!=(const _Tp& __t, const propagate_const<_Up>& __pu) {
return __t != experimental::get_underlying(__pu);
}
template <class _Tp, class _Up>
-_LIBCPP_HIDE_FROM_ABI
-_LIBCPP_CONSTEXPR bool operator<(const _Tp& __t, const propagate_const<_Up>& __pu)
-{
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool operator<(const _Tp& __t, const propagate_const<_Up>& __pu) {
return __t < experimental::get_underlying(__pu);
}
template <class _Tp, class _Up>
-_LIBCPP_HIDE_FROM_ABI
-_LIBCPP_CONSTEXPR bool operator>(const _Tp& __t, const propagate_const<_Up>& __pu)
-{
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool operator>(const _Tp& __t, const propagate_const<_Up>& __pu) {
return __t > experimental::get_underlying(__pu);
}
template <class _Tp, class _Up>
-_LIBCPP_HIDE_FROM_ABI
-_LIBCPP_CONSTEXPR bool operator<=(const _Tp& __t, const propagate_const<_Up>& __pu)
-{
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool operator<=(const _Tp& __t, const propagate_const<_Up>& __pu) {
return __t <= experimental::get_underlying(__pu);
}
template <class _Tp, class _Up>
-_LIBCPP_HIDE_FROM_ABI
-_LIBCPP_CONSTEXPR bool operator>=(const _Tp& __t, const propagate_const<_Up>& __pu)
-{
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool operator>=(const _Tp& __t, const propagate_const<_Up>& __pu) {
return __t >= experimental::get_underlying(__pu);
}
template <class _Tp>
-_LIBCPP_HIDE_FROM_ABI
-_LIBCPP_CONSTEXPR void swap(propagate_const<_Tp>& __pc1, propagate_const<_Tp>& __pc2) _NOEXCEPT_(__is_nothrow_swappable<_Tp>::value)
-{
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR void swap(propagate_const<_Tp>& __pc1, propagate_const<_Tp>& __pc2)
+ _NOEXCEPT_(__is_nothrow_swappable<_Tp>::value) {
__pc1.swap(__pc2);
}
template <class _Tp>
-_LIBCPP_CONSTEXPR const _Tp& get_underlying(const propagate_const<_Tp>& __pt) _NOEXCEPT
-{
+_LIBCPP_CONSTEXPR const _Tp& get_underlying(const propagate_const<_Tp>& __pt) _NOEXCEPT {
return __pt.__t_;
}
template <class _Tp>
-_LIBCPP_CONSTEXPR _Tp& get_underlying(propagate_const<_Tp>& __pt) _NOEXCEPT
-{
+_LIBCPP_CONSTEXPR _Tp& get_underlying(propagate_const<_Tp>& __pt) _NOEXCEPT {
return __pt.__t_;
}
@@ -504,91 +411,77 @@ _LIBCPP_END_NAMESPACE_LFTS_V2
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _Tp>
-struct hash<experimental::propagate_const<_Tp>>
-{
+struct hash<experimental::propagate_const<_Tp>> {
typedef size_t result_type;
typedef experimental::propagate_const<_Tp> argument_type;
- _LIBCPP_HIDE_FROM_ABI size_t operator()(const experimental::propagate_const<_Tp>& __pc1) const
- {
+ _LIBCPP_HIDE_FROM_ABI size_t operator()(const experimental::propagate_const<_Tp>& __pc1) const {
return std::hash<_Tp>()(experimental::get_underlying(__pc1));
}
};
template <class _Tp>
-struct equal_to<experimental::propagate_const<_Tp>>
-{
+struct equal_to<experimental::propagate_const<_Tp>> {
typedef experimental::propagate_const<_Tp> first_argument_type;
typedef experimental::propagate_const<_Tp> second_argument_type;
- _LIBCPP_HIDE_FROM_ABI bool operator()(const experimental::propagate_const<_Tp>& __pc1,
- const experimental::propagate_const<_Tp>& __pc2) const
- {
+ _LIBCPP_HIDE_FROM_ABI bool
+ operator()(const experimental::propagate_const<_Tp>& __pc1, const experimental::propagate_const<_Tp>& __pc2) const {
return std::equal_to<_Tp>()(experimental::get_underlying(__pc1), experimental::get_underlying(__pc2));
}
};
template <class _Tp>
-struct not_equal_to<experimental::propagate_const<_Tp>>
-{
+struct not_equal_to<experimental::propagate_const<_Tp>> {
typedef experimental::propagate_const<_Tp> first_argument_type;
typedef experimental::propagate_const<_Tp> second_argument_type;
- _LIBCPP_HIDE_FROM_ABI bool operator()(const experimental::propagate_const<_Tp>& __pc1,
- const experimental::propagate_const<_Tp>& __pc2) const
- {
+ _LIBCPP_HIDE_FROM_ABI bool
+ operator()(const experimental::propagate_const<_Tp>& __pc1, const experimental::propagate_const<_Tp>& __pc2) const {
return std::not_equal_to<_Tp>()(experimental::get_underlying(__pc1), experimental::get_underlying(__pc2));
}
};
template <class _Tp>
-struct less<experimental::propagate_const<_Tp>>
-{
+struct less<experimental::propagate_const<_Tp>> {
typedef experimental::propagate_const<_Tp> first_argument_type;
typedef experimental::propagate_const<_Tp> second_argument_type;
- _LIBCPP_HIDE_FROM_ABI bool operator()(const experimental::propagate_const<_Tp>& __pc1,
- const experimental::propagate_const<_Tp>& __pc2) const
- {
+ _LIBCPP_HIDE_FROM_ABI bool
+ operator()(const experimental::propagate_const<_Tp>& __pc1, const experimental::propagate_const<_Tp>& __pc2) const {
return std::less<_Tp>()(experimental::get_underlying(__pc1), experimental::get_underlying(__pc2));
}
};
template <class _Tp>
-struct greater<experimental::propagate_const<_Tp>>
-{
+struct greater<experimental::propagate_const<_Tp>> {
typedef experimental::propagate_const<_Tp> first_argument_type;
typedef experimental::propagate_const<_Tp> second_argument_type;
- _LIBCPP_HIDE_FROM_ABI bool operator()(const experimental::propagate_const<_Tp>& __pc1,
- const experimental::propagate_const<_Tp>& __pc2) const
- {
+ _LIBCPP_HIDE_FROM_ABI bool
+ operator()(const experimental::propagate_const<_Tp>& __pc1, const experimental::propagate_const<_Tp>& __pc2) const {
return std::greater<_Tp>()(experimental::get_underlying(__pc1), experimental::get_underlying(__pc2));
}
};
template <class _Tp>
-struct less_equal<experimental::propagate_const<_Tp>>
-{
+struct less_equal<experimental::propagate_const<_Tp>> {
typedef experimental::propagate_const<_Tp> first_argument_type;
typedef experimental::propagate_const<_Tp> second_argument_type;
- _LIBCPP_HIDE_FROM_ABI bool operator()(const experimental::propagate_const<_Tp>& __pc1,
- const experimental::propagate_const<_Tp>& __pc2) const
- {
+ _LIBCPP_HIDE_FROM_ABI bool
+ operator()(const experimental::propagate_const<_Tp>& __pc1, const experimental::propagate_const<_Tp>& __pc2) const {
return std::less_equal<_Tp>()(experimental::get_underlying(__pc1), experimental::get_underlying(__pc2));
}
};
template <class _Tp>
-struct greater_equal<experimental::propagate_const<_Tp>>
-{
+struct greater_equal<experimental::propagate_const<_Tp>> {
typedef experimental::propagate_const<_Tp> first_argument_type;
typedef experimental::propagate_const<_Tp> second_argument_type;
- _LIBCPP_HIDE_FROM_ABI bool operator()(const experimental::propagate_const<_Tp>& __pc1,
- const experimental::propagate_const<_Tp>& __pc2) const
- {
+ _LIBCPP_HIDE_FROM_ABI bool
+ operator()(const experimental::propagate_const<_Tp>& __pc1, const experimental::propagate_const<_Tp>& __pc2) const {
return std::greater_equal<_Tp>()(experimental::get_underlying(__pc1), experimental::get_underlying(__pc2));
}
};
diff --git a/contrib/llvm-project/libcxx/include/experimental/simd b/contrib/llvm-project/libcxx/include/experimental/simd
index 56858832857c..adca9faa47bb 100644
--- a/contrib/llvm-project/libcxx/include/experimental/simd
+++ b/contrib/llvm-project/libcxx/include/experimental/simd
@@ -78,7 +78,6 @@ inline namespace parallelism_v2 {
#endif
#include <experimental/__config>
-#include <experimental/__simd/abi_tag.h>
#include <experimental/__simd/aligned_tag.h>
#include <experimental/__simd/declaration.h>
#include <experimental/__simd/scalar.h>
diff --git a/contrib/llvm-project/libcxx/include/experimental/type_traits b/contrib/llvm-project/libcxx/include/experimental/type_traits
index bebd86d54da3..62f9574ec58f 100644
--- a/contrib/llvm-project/libcxx/include/experimental/type_traits
+++ b/contrib/llvm-project/libcxx/include/experimental/type_traits
@@ -73,12 +73,12 @@ inline namespace fundamentals_v1 {
#if _LIBCPP_STD_VER >= 14
-#include <initializer_list>
-#include <type_traits>
+# include <initializer_list>
+# include <type_traits>
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
+# if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+# pragma GCC system_header
+# endif
_LIBCPP_BEGIN_NAMESPACE_LFTS
@@ -104,49 +104,48 @@ using raw_invocation_type_t = typename raw_invocation_type<_Tp>::type;
*/
// 3.3.4, Detection idiom
-template <class...> using void_t = void;
+template <class...>
+using void_t = void;
struct nonesuch : private __nat { // make nonesuch "not an aggregate"
- ~nonesuch() = delete;
- nonesuch (nonesuch const&) = delete;
+ ~nonesuch() = delete;
+ nonesuch(nonesuch const&) = delete;
void operator=(nonesuch const&) = delete;
- };
+};
template <class _Default, class _AlwaysVoid, template <class...> class _Op, class... _Args>
struct _DETECTOR {
- using value_t = false_type;
- using type = _Default;
- };
+ using value_t = false_type;
+ using type = _Default;
+};
template <class _Default, template <class...> class _Op, class... _Args>
struct _DETECTOR<_Default, void_t<_Op<_Args...>>, _Op, _Args...> {
- using value_t = true_type;
- using type = _Op<_Args...>;
- };
-
+ using value_t = true_type;
+ using type = _Op<_Args...>;
+};
-template <template<class...> class _Op, class... _Args>
- using is_detected = typename _DETECTOR<nonesuch, void, _Op, _Args...>::value_t;
-template <template<class...> class _Op, class... _Args>
- using detected_t = typename _DETECTOR<nonesuch, void, _Op, _Args...>::type;
-template <template<class...> class _Op, class... _Args>
- _LIBCPP_CONSTEXPR bool is_detected_v = is_detected<_Op, _Args...>::value;
+template <template <class...> class _Op, class... _Args>
+using is_detected = typename _DETECTOR<nonesuch, void, _Op, _Args...>::value_t;
+template <template <class...> class _Op, class... _Args>
+using detected_t = typename _DETECTOR<nonesuch, void, _Op, _Args...>::type;
+template <template <class...> class _Op, class... _Args>
+_LIBCPP_CONSTEXPR bool is_detected_v = is_detected<_Op, _Args...>::value;
-template <class _Default, template<class...> class _Op, class... _Args>
- using detected_or = _DETECTOR<_Default, void, _Op, _Args...>;
-template <class _Default, template<class...> class _Op, class... _Args>
- using detected_or_t = typename detected_or<_Default, _Op, _Args...>::type;
-
-template <class _Expected, template<class...> class _Op, class... _Args>
- using is_detected_exact = is_same<_Expected, detected_t<_Op, _Args...>>;
-template <class _Expected, template<class...> class _Op, class... _Args>
- _LIBCPP_CONSTEXPR bool is_detected_exact_v = is_detected_exact<_Expected, _Op, _Args...>::value;
+template <class _Default, template <class...> class _Op, class... _Args>
+using detected_or = _DETECTOR<_Default, void, _Op, _Args...>;
+template <class _Default, template <class...> class _Op, class... _Args>
+using detected_or_t = typename detected_or<_Default, _Op, _Args...>::type;
-template <class _To, template<class...> class _Op, class... _Args>
- using is_detected_convertible = is_convertible<detected_t<_Op, _Args...>, _To>;
-template <class _To, template<class...> class _Op, class... _Args>
- _LIBCPP_CONSTEXPR bool is_detected_convertible_v = is_detected_convertible<_To, _Op, _Args...>::value;
+template <class _Expected, template <class...> class _Op, class... _Args>
+using is_detected_exact = is_same<_Expected, detected_t<_Op, _Args...>>;
+template <class _Expected, template <class...> class _Op, class... _Args>
+_LIBCPP_CONSTEXPR bool is_detected_exact_v = is_detected_exact<_Expected, _Op, _Args...>::value;
+template <class _To, template <class...> class _Op, class... _Args>
+using is_detected_convertible = is_convertible<detected_t<_Op, _Args...>, _To>;
+template <class _To, template <class...> class _Op, class... _Args>
+_LIBCPP_CONSTEXPR bool is_detected_convertible_v = is_detected_convertible<_To, _Op, _Args...>::value;
_LIBCPP_END_NAMESPACE_LFTS
diff --git a/contrib/llvm-project/libcxx/include/experimental/utility b/contrib/llvm-project/libcxx/include/experimental/utility
index 576b8be46357..c1bd9364fd51 100644
--- a/contrib/llvm-project/libcxx/include/experimental/utility
+++ b/contrib/llvm-project/libcxx/include/experimental/utility
@@ -40,7 +40,7 @@ inline namespace fundamentals_v1 {
_LIBCPP_BEGIN_NAMESPACE_LFTS
- struct _LIBCPP_TEMPLATE_VIS erased_type { };
+struct _LIBCPP_TEMPLATE_VIS erased_type {};
_LIBCPP_END_NAMESPACE_LFTS
diff --git a/contrib/llvm-project/libcxx/include/ext/__hash b/contrib/llvm-project/libcxx/include/ext/__hash
index dcfee910d21b..67f7e351756f 100644
--- a/contrib/llvm-project/libcxx/include/ext/__hash
+++ b/contrib/llvm-project/libcxx/include/ext/__hash
@@ -10,7 +10,7 @@
#ifndef _LIBCPP_EXT_HASH
#define _LIBCPP_EXT_HASH
-# pragma GCC system_header
+#pragma GCC system_header
#include <__config>
#include <cstring>
@@ -19,116 +19,66 @@
namespace __gnu_cxx {
-template <typename _Tp> struct _LIBCPP_TEMPLATE_VIS hash { };
+template <typename _Tp>
+struct _LIBCPP_TEMPLATE_VIS hash {};
-template <> struct _LIBCPP_TEMPLATE_VIS hash<const char*>
- : public std::__unary_function<const char*, size_t>
-{
- _LIBCPP_HIDE_FROM_ABI
- size_t operator()(const char *__c) const _NOEXCEPT
- {
- return std::__do_string_hash(__c, __c + strlen(__c));
- }
+template <>
+struct _LIBCPP_TEMPLATE_VIS hash<const char*> : public std::__unary_function<const char*, size_t> {
+ _LIBCPP_HIDE_FROM_ABI size_t operator()(const char* __c) const _NOEXCEPT {
+ return std::__do_string_hash(__c, __c + strlen(__c));
+ }
};
-template <> struct _LIBCPP_TEMPLATE_VIS hash<char *>
- : public std::__unary_function<char*, size_t>
-{
- _LIBCPP_HIDE_FROM_ABI
- size_t operator()(char *__c) const _NOEXCEPT
- {
- return std::__do_string_hash<const char *>(__c, __c + strlen(__c));
- }
+template <>
+struct _LIBCPP_TEMPLATE_VIS hash<char*> : public std::__unary_function<char*, size_t> {
+ _LIBCPP_HIDE_FROM_ABI size_t operator()(char* __c) const _NOEXCEPT {
+ return std::__do_string_hash<const char*>(__c, __c + strlen(__c));
+ }
};
-template <> struct _LIBCPP_TEMPLATE_VIS hash<char>
- : public std::__unary_function<char, size_t>
-{
- _LIBCPP_HIDE_FROM_ABI
- size_t operator()(char __c) const _NOEXCEPT
- {
- return __c;
- }
+template <>
+struct _LIBCPP_TEMPLATE_VIS hash<char> : public std::__unary_function<char, size_t> {
+ _LIBCPP_HIDE_FROM_ABI size_t operator()(char __c) const _NOEXCEPT { return __c; }
};
-template <> struct _LIBCPP_TEMPLATE_VIS hash<signed char>
- : public std::__unary_function<signed char, size_t>
-{
- _LIBCPP_HIDE_FROM_ABI
- size_t operator()(signed char __c) const _NOEXCEPT
- {
- return __c;
- }
+template <>
+struct _LIBCPP_TEMPLATE_VIS hash<signed char> : public std::__unary_function<signed char, size_t> {
+ _LIBCPP_HIDE_FROM_ABI size_t operator()(signed char __c) const _NOEXCEPT { return __c; }
};
-template <> struct _LIBCPP_TEMPLATE_VIS hash<unsigned char>
- : public std::__unary_function<unsigned char, size_t>
-{
- _LIBCPP_HIDE_FROM_ABI
- size_t operator()(unsigned char __c) const _NOEXCEPT
- {
- return __c;
- }
+template <>
+struct _LIBCPP_TEMPLATE_VIS hash<unsigned char> : public std::__unary_function<unsigned char, size_t> {
+ _LIBCPP_HIDE_FROM_ABI size_t operator()(unsigned char __c) const _NOEXCEPT { return __c; }
};
-template <> struct _LIBCPP_TEMPLATE_VIS hash<short>
- : public std::__unary_function<short, size_t>
-{
- _LIBCPP_HIDE_FROM_ABI
- size_t operator()(short __c) const _NOEXCEPT
- {
- return __c;
- }
+template <>
+struct _LIBCPP_TEMPLATE_VIS hash<short> : public std::__unary_function<short, size_t> {
+ _LIBCPP_HIDE_FROM_ABI size_t operator()(short __c) const _NOEXCEPT { return __c; }
};
-template <> struct _LIBCPP_TEMPLATE_VIS hash<unsigned short>
- : public std::__unary_function<unsigned short, size_t>
-{
- _LIBCPP_HIDE_FROM_ABI
- size_t operator()(unsigned short __c) const _NOEXCEPT
- {
- return __c;
- }
+template <>
+struct _LIBCPP_TEMPLATE_VIS hash<unsigned short> : public std::__unary_function<unsigned short, size_t> {
+ _LIBCPP_HIDE_FROM_ABI size_t operator()(unsigned short __c) const _NOEXCEPT { return __c; }
};
-template <> struct _LIBCPP_TEMPLATE_VIS hash<int>
- : public std::__unary_function<int, size_t>
-{
- _LIBCPP_HIDE_FROM_ABI
- size_t operator()(int __c) const _NOEXCEPT
- {
- return __c;
- }
+template <>
+struct _LIBCPP_TEMPLATE_VIS hash<int> : public std::__unary_function<int, size_t> {
+ _LIBCPP_HIDE_FROM_ABI size_t operator()(int __c) const _NOEXCEPT { return __c; }
};
-template <> struct _LIBCPP_TEMPLATE_VIS hash<unsigned int>
- : public std::__unary_function<unsigned int, size_t>
-{
- _LIBCPP_HIDE_FROM_ABI
- size_t operator()(unsigned int __c) const _NOEXCEPT
- {
- return __c;
- }
+template <>
+struct _LIBCPP_TEMPLATE_VIS hash<unsigned int> : public std::__unary_function<unsigned int, size_t> {
+ _LIBCPP_HIDE_FROM_ABI size_t operator()(unsigned int __c) const _NOEXCEPT { return __c; }
};
-template <> struct _LIBCPP_TEMPLATE_VIS hash<long>
- : public std::__unary_function<long, size_t>
-{
- _LIBCPP_HIDE_FROM_ABI
- size_t operator()(long __c) const _NOEXCEPT
- {
- return __c;
- }
+template <>
+struct _LIBCPP_TEMPLATE_VIS hash<long> : public std::__unary_function<long, size_t> {
+ _LIBCPP_HIDE_FROM_ABI size_t operator()(long __c) const _NOEXCEPT { return __c; }
};
-template <> struct _LIBCPP_TEMPLATE_VIS hash<unsigned long>
- : public std::__unary_function<unsigned long, size_t>
-{
- _LIBCPP_HIDE_FROM_ABI
- size_t operator()(unsigned long __c) const _NOEXCEPT
- {
- return __c;
- }
+template <>
+struct _LIBCPP_TEMPLATE_VIS hash<unsigned long> : public std::__unary_function<unsigned long, size_t> {
+ _LIBCPP_HIDE_FROM_ABI size_t operator()(unsigned long __c) const _NOEXCEPT { return __c; }
};
} // namespace __gnu_cxx
diff --git a/contrib/llvm-project/libcxx/include/ext/hash_map b/contrib/llvm-project/libcxx/include/ext/hash_map
index 176b59fa9ed6..7ac268d5dcbd 100644
--- a/contrib/llvm-project/libcxx/include/ext/hash_map
+++ b/contrib/llvm-project/libcxx/include/ext/hash_map
@@ -209,11 +209,11 @@ template <class Key, class T, class Hash, class Pred, class Alloc>
#include <functional>
#if defined(__DEPRECATED) && __DEPRECATED
-#if defined(_LIBCPP_WARNING)
- _LIBCPP_WARNING("Use of the header <ext/hash_map> is deprecated. Migrate to <unordered_map>")
-#else
-# warning Use of the header <ext/hash_map> is deprecated. Migrate to <unordered_map>
-#endif
+# if defined(_LIBCPP_WARNING)
+_LIBCPP_WARNING("Use of the header <ext/hash_map> is deprecated. Migrate to <unordered_map>")
+# else
+# warning Use of the header <ext/hash_map> is deprecated. Migrate to <unordered_map>
+# endif
#endif
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
@@ -222,760 +222,644 @@ template <class Key, class T, class Hash, class Pred, class Alloc>
namespace __gnu_cxx {
-template <class _Tp, class _Hash,
- bool = std::is_empty<_Hash>::value && !std::__libcpp_is_final<_Hash>::value
- >
-class __hash_map_hasher
- : private _Hash
-{
+template <class _Tp, class _Hash, bool = std::is_empty<_Hash>::value && !std::__libcpp_is_final<_Hash>::value >
+class __hash_map_hasher : private _Hash {
public:
- _LIBCPP_HIDE_FROM_ABI __hash_map_hasher() : _Hash() {}
- _LIBCPP_HIDE_FROM_ABI __hash_map_hasher(const _Hash& __h) : _Hash(__h) {}
- _LIBCPP_HIDE_FROM_ABI const _Hash& hash_function() const {return *this;}
- _LIBCPP_HIDE_FROM_ABI
- size_t operator()(const _Tp& __x) const
- {return static_cast<const _Hash&>(*this)(__x.first);}
- _LIBCPP_HIDE_FROM_ABI
- size_t operator()(const typename _Tp::first_type& __x) const
- {return static_cast<const _Hash&>(*this)(__x);}
+ _LIBCPP_HIDE_FROM_ABI __hash_map_hasher() : _Hash() {}
+ _LIBCPP_HIDE_FROM_ABI __hash_map_hasher(const _Hash& __h) : _Hash(__h) {}
+ _LIBCPP_HIDE_FROM_ABI const _Hash& hash_function() const { return *this; }
+ _LIBCPP_HIDE_FROM_ABI size_t operator()(const _Tp& __x) const { return static_cast<const _Hash&>(*this)(__x.first); }
+ _LIBCPP_HIDE_FROM_ABI size_t operator()(const typename _Tp::first_type& __x) const {
+ return static_cast<const _Hash&>(*this)(__x);
+ }
};
template <class _Tp, class _Hash>
-class __hash_map_hasher<_Tp, _Hash, false>
-{
- _Hash __hash_;
+class __hash_map_hasher<_Tp, _Hash, false> {
+ _Hash __hash_;
+
public:
- _LIBCPP_HIDE_FROM_ABI __hash_map_hasher() : __hash_() {}
- _LIBCPP_HIDE_FROM_ABI __hash_map_hasher(const _Hash& __h) : __hash_(__h) {}
- _LIBCPP_HIDE_FROM_ABI const _Hash& hash_function() const {return __hash_;}
- _LIBCPP_HIDE_FROM_ABI
- size_t operator()(const _Tp& __x) const
- {return __hash_(__x.first);}
- _LIBCPP_HIDE_FROM_ABI
- size_t operator()(const typename _Tp::first_type& __x) const
- {return __hash_(__x);}
+ _LIBCPP_HIDE_FROM_ABI __hash_map_hasher() : __hash_() {}
+ _LIBCPP_HIDE_FROM_ABI __hash_map_hasher(const _Hash& __h) : __hash_(__h) {}
+ _LIBCPP_HIDE_FROM_ABI const _Hash& hash_function() const { return __hash_; }
+ _LIBCPP_HIDE_FROM_ABI size_t operator()(const _Tp& __x) const { return __hash_(__x.first); }
+ _LIBCPP_HIDE_FROM_ABI size_t operator()(const typename _Tp::first_type& __x) const { return __hash_(__x); }
};
-template <class _Tp, class _Pred,
- bool = std::is_empty<_Pred>::value && !std::__libcpp_is_final<_Pred>::value
- >
-class __hash_map_equal
- : private _Pred
-{
+template <class _Tp, class _Pred, bool = std::is_empty<_Pred>::value && !std::__libcpp_is_final<_Pred>::value >
+class __hash_map_equal : private _Pred {
public:
- _LIBCPP_HIDE_FROM_ABI __hash_map_equal() : _Pred() {}
- _LIBCPP_HIDE_FROM_ABI __hash_map_equal(const _Pred& __p) : _Pred(__p) {}
- _LIBCPP_HIDE_FROM_ABI const _Pred& key_eq() const {return *this;}
- _LIBCPP_HIDE_FROM_ABI
- bool operator()(const _Tp& __x, const _Tp& __y) const
- {return static_cast<const _Pred&>(*this)(__x.first, __y.first);}
- _LIBCPP_HIDE_FROM_ABI
- bool operator()(const typename _Tp::first_type& __x, const _Tp& __y) const
- {return static_cast<const _Pred&>(*this)(__x, __y.first);}
- _LIBCPP_HIDE_FROM_ABI
- bool operator()(const _Tp& __x, const typename _Tp::first_type& __y) const
- {return static_cast<const _Pred&>(*this)(__x.first, __y);}
- _LIBCPP_HIDE_FROM_ABI
- bool operator()(const typename _Tp::first_type& __x,
- const typename _Tp::first_type& __y) const
- {return static_cast<const _Pred&>(*this)(__x, __y);}
+ _LIBCPP_HIDE_FROM_ABI __hash_map_equal() : _Pred() {}
+ _LIBCPP_HIDE_FROM_ABI __hash_map_equal(const _Pred& __p) : _Pred(__p) {}
+ _LIBCPP_HIDE_FROM_ABI const _Pred& key_eq() const { return *this; }
+ _LIBCPP_HIDE_FROM_ABI bool operator()(const _Tp& __x, const _Tp& __y) const {
+ return static_cast<const _Pred&>(*this)(__x.first, __y.first);
+ }
+ _LIBCPP_HIDE_FROM_ABI bool operator()(const typename _Tp::first_type& __x, const _Tp& __y) const {
+ return static_cast<const _Pred&>(*this)(__x, __y.first);
+ }
+ _LIBCPP_HIDE_FROM_ABI bool operator()(const _Tp& __x, const typename _Tp::first_type& __y) const {
+ return static_cast<const _Pred&>(*this)(__x.first, __y);
+ }
+ _LIBCPP_HIDE_FROM_ABI bool
+ operator()(const typename _Tp::first_type& __x, const typename _Tp::first_type& __y) const {
+ return static_cast<const _Pred&>(*this)(__x, __y);
+ }
};
template <class _Tp, class _Pred>
-class __hash_map_equal<_Tp, _Pred, false>
-{
- _Pred __pred_;
+class __hash_map_equal<_Tp, _Pred, false> {
+ _Pred __pred_;
+
public:
- _LIBCPP_HIDE_FROM_ABI __hash_map_equal() : __pred_() {}
- _LIBCPP_HIDE_FROM_ABI __hash_map_equal(const _Pred& __p) : __pred_(__p) {}
- _LIBCPP_HIDE_FROM_ABI const _Pred& key_eq() const {return __pred_;}
- _LIBCPP_HIDE_FROM_ABI
- bool operator()(const _Tp& __x, const _Tp& __y) const
- {return __pred_(__x.first, __y.first);}
- _LIBCPP_HIDE_FROM_ABI
- bool operator()(const typename _Tp::first_type& __x, const _Tp& __y) const
- {return __pred_(__x, __y.first);}
- _LIBCPP_HIDE_FROM_ABI
- bool operator()(const _Tp& __x, const typename _Tp::first_type& __y) const
- {return __pred_(__x.first, __y);}
- _LIBCPP_HIDE_FROM_ABI
- bool operator()(const typename _Tp::first_type& __x,
- const typename _Tp::first_type& __y) const
- {return __pred_(__x, __y);}
+ _LIBCPP_HIDE_FROM_ABI __hash_map_equal() : __pred_() {}
+ _LIBCPP_HIDE_FROM_ABI __hash_map_equal(const _Pred& __p) : __pred_(__p) {}
+ _LIBCPP_HIDE_FROM_ABI const _Pred& key_eq() const { return __pred_; }
+ _LIBCPP_HIDE_FROM_ABI bool operator()(const _Tp& __x, const _Tp& __y) const { return __pred_(__x.first, __y.first); }
+ _LIBCPP_HIDE_FROM_ABI bool operator()(const typename _Tp::first_type& __x, const _Tp& __y) const {
+ return __pred_(__x, __y.first);
+ }
+ _LIBCPP_HIDE_FROM_ABI bool operator()(const _Tp& __x, const typename _Tp::first_type& __y) const {
+ return __pred_(__x.first, __y);
+ }
+ _LIBCPP_HIDE_FROM_ABI bool
+ operator()(const typename _Tp::first_type& __x, const typename _Tp::first_type& __y) const {
+ return __pred_(__x, __y);
+ }
};
template <class _Alloc>
-class __hash_map_node_destructor
-{
- typedef _Alloc allocator_type;
- typedef std::allocator_traits<allocator_type> __alloc_traits;
- typedef typename __alloc_traits::value_type::__node_value_type value_type;
+class __hash_map_node_destructor {
+ typedef _Alloc allocator_type;
+ typedef std::allocator_traits<allocator_type> __alloc_traits;
+ typedef typename __alloc_traits::value_type::__node_value_type value_type;
+
public:
- typedef typename __alloc_traits::pointer pointer;
+ typedef typename __alloc_traits::pointer pointer;
+
private:
- typedef typename value_type::first_type first_type;
- typedef typename value_type::second_type second_type;
+ typedef typename value_type::first_type first_type;
+ typedef typename value_type::second_type second_type;
- allocator_type& __na_;
+ allocator_type& __na_;
public:
- bool __first_constructed;
- bool __second_constructed;
+ bool __first_constructed;
+ bool __second_constructed;
- _LIBCPP_HIDE_FROM_ABI __hash_map_node_destructor(__hash_map_node_destructor const&) = default;
- __hash_map_node_destructor& operator=(const __hash_map_node_destructor&) = delete;
+ _LIBCPP_HIDE_FROM_ABI __hash_map_node_destructor(__hash_map_node_destructor const&) = default;
+ __hash_map_node_destructor& operator=(const __hash_map_node_destructor&) = delete;
- _LIBCPP_HIDE_FROM_ABI
- explicit __hash_map_node_destructor(allocator_type& __na)
- : __na_(__na),
- __first_constructed(false),
- __second_constructed(false)
- {}
+ _LIBCPP_HIDE_FROM_ABI explicit __hash_map_node_destructor(allocator_type& __na)
+ : __na_(__na), __first_constructed(false), __second_constructed(false) {}
#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI
- __hash_map_node_destructor(std::__hash_node_destructor<allocator_type>&& __x)
- : __na_(__x.__na_),
- __first_constructed(__x.__value_constructed),
- __second_constructed(__x.__value_constructed)
- {
- __x.__value_constructed = false;
- }
+ _LIBCPP_HIDE_FROM_ABI __hash_map_node_destructor(std::__hash_node_destructor<allocator_type>&& __x)
+ : __na_(__x.__na_), __first_constructed(__x.__value_constructed), __second_constructed(__x.__value_constructed) {
+ __x.__value_constructed = false;
+ }
#else // _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI
- __hash_map_node_destructor(const std::__hash_node_destructor<allocator_type>& __x)
- : __na_(__x.__na_),
- __first_constructed(__x.__value_constructed),
- __second_constructed(__x.__value_constructed)
- {
- const_cast<bool&>(__x.__value_constructed) = false;
- }
+ _LIBCPP_HIDE_FROM_ABI __hash_map_node_destructor(const std::__hash_node_destructor<allocator_type>& __x)
+ : __na_(__x.__na_), __first_constructed(__x.__value_constructed), __second_constructed(__x.__value_constructed) {
+ const_cast<bool&>(__x.__value_constructed) = false;
+ }
#endif // _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI
- void operator()(pointer __p)
- {
- if (__second_constructed)
- __alloc_traits::destroy(__na_, std::addressof(__p->__get_value().second));
- if (__first_constructed)
- __alloc_traits::destroy(__na_, std::addressof(__p->__get_value().first));
- if (__p)
- __alloc_traits::deallocate(__na_, __p, 1);
- }
+ _LIBCPP_HIDE_FROM_ABI void operator()(pointer __p) {
+ if (__second_constructed)
+ __alloc_traits::destroy(__na_, std::addressof(__p->__get_value().second));
+ if (__first_constructed)
+ __alloc_traits::destroy(__na_, std::addressof(__p->__get_value().first));
+ if (__p)
+ __alloc_traits::deallocate(__na_, __p, 1);
+ }
};
template <class _HashIterator>
-class _LIBCPP_TEMPLATE_VIS __hash_map_iterator
-{
- _HashIterator __i_;
+class _LIBCPP_TEMPLATE_VIS __hash_map_iterator {
+ _HashIterator __i_;
+
+ typedef const typename _HashIterator::value_type::first_type key_type;
+ typedef typename _HashIterator::value_type::second_type mapped_type;
- typedef const typename _HashIterator::value_type::first_type key_type;
- typedef typename _HashIterator::value_type::second_type mapped_type;
public:
- typedef std::forward_iterator_tag iterator_category;
- typedef std::pair<key_type, mapped_type> value_type;
- typedef typename _HashIterator::difference_type difference_type;
- typedef value_type& reference;
- typedef std::__rebind_pointer_t<typename _HashIterator::pointer, value_type>
- pointer;
-
- _LIBCPP_HIDE_FROM_ABI __hash_map_iterator() {}
-
- _LIBCPP_HIDE_FROM_ABI __hash_map_iterator(_HashIterator __i) : __i_(__i) {}
-
- _LIBCPP_HIDE_FROM_ABI reference operator*() const {return *operator->();}
- _LIBCPP_HIDE_FROM_ABI pointer operator->() const {return (pointer)__i_.operator->();}
-
- _LIBCPP_HIDE_FROM_ABI __hash_map_iterator& operator++() {++__i_; return *this;}
- _LIBCPP_HIDE_FROM_ABI
- __hash_map_iterator operator++(int)
- {
- __hash_map_iterator __t(*this);
- ++(*this);
- return __t;
- }
-
- friend _LIBCPP_HIDE_FROM_ABI
- bool operator==(const __hash_map_iterator& __x, const __hash_map_iterator& __y)
- {return __x.__i_ == __y.__i_;}
- friend _LIBCPP_HIDE_FROM_ABI
- bool operator!=(const __hash_map_iterator& __x, const __hash_map_iterator& __y)
- {return __x.__i_ != __y.__i_;}
-
- template <class, class, class, class, class> friend class _LIBCPP_TEMPLATE_VIS hash_map;
- template <class, class, class, class, class> friend class _LIBCPP_TEMPLATE_VIS hash_multimap;
- template <class> friend class _LIBCPP_TEMPLATE_VIS __hash_const_iterator;
- template <class> friend class _LIBCPP_TEMPLATE_VIS __hash_const_local_iterator;
- template <class> friend class _LIBCPP_TEMPLATE_VIS __hash_map_const_iterator;
+ typedef std::forward_iterator_tag iterator_category;
+ typedef std::pair<key_type, mapped_type> value_type;
+ typedef typename _HashIterator::difference_type difference_type;
+ typedef value_type& reference;
+ typedef std::__rebind_pointer_t<typename _HashIterator::pointer, value_type> pointer;
+
+ _LIBCPP_HIDE_FROM_ABI __hash_map_iterator() {}
+
+ _LIBCPP_HIDE_FROM_ABI __hash_map_iterator(_HashIterator __i) : __i_(__i) {}
+
+ _LIBCPP_HIDE_FROM_ABI reference operator*() const { return *operator->(); }
+ _LIBCPP_HIDE_FROM_ABI pointer operator->() const { return (pointer)__i_.operator->(); }
+
+ _LIBCPP_HIDE_FROM_ABI __hash_map_iterator& operator++() {
+ ++__i_;
+ return *this;
+ }
+ _LIBCPP_HIDE_FROM_ABI __hash_map_iterator operator++(int) {
+ __hash_map_iterator __t(*this);
+ ++(*this);
+ return __t;
+ }
+
+ friend _LIBCPP_HIDE_FROM_ABI bool operator==(const __hash_map_iterator& __x, const __hash_map_iterator& __y) {
+ return __x.__i_ == __y.__i_;
+ }
+ friend _LIBCPP_HIDE_FROM_ABI bool operator!=(const __hash_map_iterator& __x, const __hash_map_iterator& __y) {
+ return __x.__i_ != __y.__i_;
+ }
+
+ template <class, class, class, class, class>
+ friend class _LIBCPP_TEMPLATE_VIS hash_map;
+ template <class, class, class, class, class>
+ friend class _LIBCPP_TEMPLATE_VIS hash_multimap;
+ template <class>
+ friend class _LIBCPP_TEMPLATE_VIS __hash_const_iterator;
+ template <class>
+ friend class _LIBCPP_TEMPLATE_VIS __hash_const_local_iterator;
+ template <class>
+ friend class _LIBCPP_TEMPLATE_VIS __hash_map_const_iterator;
};
template <class _HashIterator>
-class _LIBCPP_TEMPLATE_VIS __hash_map_const_iterator
-{
- _HashIterator __i_;
+class _LIBCPP_TEMPLATE_VIS __hash_map_const_iterator {
+ _HashIterator __i_;
+
+ typedef const typename _HashIterator::value_type::first_type key_type;
+ typedef typename _HashIterator::value_type::second_type mapped_type;
- typedef const typename _HashIterator::value_type::first_type key_type;
- typedef typename _HashIterator::value_type::second_type mapped_type;
public:
- typedef std::forward_iterator_tag iterator_category;
- typedef std::pair<key_type, mapped_type> value_type;
- typedef typename _HashIterator::difference_type difference_type;
- typedef const value_type& reference;
- typedef std::__rebind_pointer_t<typename _HashIterator::pointer, const value_type>
- pointer;
-
- _LIBCPP_HIDE_FROM_ABI __hash_map_const_iterator() {}
-
- _LIBCPP_HIDE_FROM_ABI
- __hash_map_const_iterator(_HashIterator __i) : __i_(__i) {}
- _LIBCPP_HIDE_FROM_ABI
- __hash_map_const_iterator(
- __hash_map_iterator<typename _HashIterator::__non_const_iterator> __i)
- : __i_(__i.__i_) {}
-
- _LIBCPP_HIDE_FROM_ABI
- reference operator*() const {return *operator->();}
- _LIBCPP_HIDE_FROM_ABI
- pointer operator->() const {return (pointer)__i_.operator->();}
-
- _LIBCPP_HIDE_FROM_ABI
- __hash_map_const_iterator& operator++() {++__i_; return *this;}
- _LIBCPP_HIDE_FROM_ABI
- __hash_map_const_iterator operator++(int)
- {
- __hash_map_const_iterator __t(*this);
- ++(*this);
- return __t;
- }
-
- friend _LIBCPP_HIDE_FROM_ABI
- bool operator==(const __hash_map_const_iterator& __x, const __hash_map_const_iterator& __y)
- {return __x.__i_ == __y.__i_;}
- friend _LIBCPP_HIDE_FROM_ABI
- bool operator!=(const __hash_map_const_iterator& __x, const __hash_map_const_iterator& __y)
- {return __x.__i_ != __y.__i_;}
-
- template <class, class, class, class, class> friend class _LIBCPP_TEMPLATE_VIS hash_map;
- template <class, class, class, class, class> friend class _LIBCPP_TEMPLATE_VIS hash_multimap;
- template <class> friend class _LIBCPP_TEMPLATE_VIS __hash_const_iterator;
- template <class> friend class _LIBCPP_TEMPLATE_VIS __hash_const_local_iterator;
+ typedef std::forward_iterator_tag iterator_category;
+ typedef std::pair<key_type, mapped_type> value_type;
+ typedef typename _HashIterator::difference_type difference_type;
+ typedef const value_type& reference;
+ typedef std::__rebind_pointer_t<typename _HashIterator::pointer, const value_type> pointer;
+
+ _LIBCPP_HIDE_FROM_ABI __hash_map_const_iterator() {}
+
+ _LIBCPP_HIDE_FROM_ABI __hash_map_const_iterator(_HashIterator __i) : __i_(__i) {}
+ _LIBCPP_HIDE_FROM_ABI __hash_map_const_iterator(__hash_map_iterator<typename _HashIterator::__non_const_iterator> __i)
+ : __i_(__i.__i_) {}
+
+ _LIBCPP_HIDE_FROM_ABI reference operator*() const { return *operator->(); }
+ _LIBCPP_HIDE_FROM_ABI pointer operator->() const { return (pointer)__i_.operator->(); }
+
+ _LIBCPP_HIDE_FROM_ABI __hash_map_const_iterator& operator++() {
+ ++__i_;
+ return *this;
+ }
+ _LIBCPP_HIDE_FROM_ABI __hash_map_const_iterator operator++(int) {
+ __hash_map_const_iterator __t(*this);
+ ++(*this);
+ return __t;
+ }
+
+ friend _LIBCPP_HIDE_FROM_ABI bool
+ operator==(const __hash_map_const_iterator& __x, const __hash_map_const_iterator& __y) {
+ return __x.__i_ == __y.__i_;
+ }
+ friend _LIBCPP_HIDE_FROM_ABI bool
+ operator!=(const __hash_map_const_iterator& __x, const __hash_map_const_iterator& __y) {
+ return __x.__i_ != __y.__i_;
+ }
+
+ template <class, class, class, class, class>
+ friend class _LIBCPP_TEMPLATE_VIS hash_map;
+ template <class, class, class, class, class>
+ friend class _LIBCPP_TEMPLATE_VIS hash_multimap;
+ template <class>
+ friend class _LIBCPP_TEMPLATE_VIS __hash_const_iterator;
+ template <class>
+ friend class _LIBCPP_TEMPLATE_VIS __hash_const_local_iterator;
};
-template <class _Key, class _Tp, class _Hash = hash<_Key>, class _Pred = std::equal_to<_Key>,
+template <class _Key,
+ class _Tp,
+ class _Hash = hash<_Key>,
+ class _Pred = std::equal_to<_Key>,
class _Alloc = std::allocator<std::pair<const _Key, _Tp> > >
-class _LIBCPP_TEMPLATE_VIS hash_map
-{
+class _LIBCPP_TEMPLATE_VIS hash_map {
public:
- // types
- typedef _Key key_type;
- typedef _Tp mapped_type;
- typedef _Tp data_type;
- typedef _Hash hasher;
- typedef _Pred key_equal;
- typedef _Alloc allocator_type;
- typedef std::pair<const key_type, mapped_type> value_type;
- typedef value_type& reference;
- typedef const value_type& const_reference;
+ // types
+ typedef _Key key_type;
+ typedef _Tp mapped_type;
+ typedef _Tp data_type;
+ typedef _Hash hasher;
+ typedef _Pred key_equal;
+ typedef _Alloc allocator_type;
+ typedef std::pair<const key_type, mapped_type> value_type;
+ typedef value_type& reference;
+ typedef const value_type& const_reference;
private:
- typedef std::pair<key_type, mapped_type> __value_type;
- typedef __hash_map_hasher<__value_type, hasher> __hasher;
- typedef __hash_map_equal<__value_type, key_equal> __key_equal;
- typedef std::__rebind_alloc<std::allocator_traits<allocator_type>, __value_type> __allocator_type;
-
- typedef std::__hash_table<__value_type, __hasher,
- __key_equal, __allocator_type> __table;
-
- __table __table_;
-
- typedef typename __table::__node_pointer __node_pointer;
- typedef typename __table::__node_const_pointer __node_const_pointer;
- typedef typename __table::__node_traits __node_traits;
- typedef typename __table::__node_allocator __node_allocator;
- typedef typename __table::__node __node;
- typedef __hash_map_node_destructor<__node_allocator> _Dp;
- typedef std::unique_ptr<__node, _Dp> __node_holder;
- typedef std::allocator_traits<allocator_type> __alloc_traits;
+ typedef std::pair<key_type, mapped_type> __value_type;
+ typedef __hash_map_hasher<__value_type, hasher> __hasher;
+ typedef __hash_map_equal<__value_type, key_equal> __key_equal;
+ typedef std::__rebind_alloc<std::allocator_traits<allocator_type>, __value_type> __allocator_type;
+
+ typedef std::__hash_table<__value_type, __hasher, __key_equal, __allocator_type> __table;
+
+ __table __table_;
+
+ typedef typename __table::__node_pointer __node_pointer;
+ typedef typename __table::__node_const_pointer __node_const_pointer;
+ typedef typename __table::__node_traits __node_traits;
+ typedef typename __table::__node_allocator __node_allocator;
+ typedef typename __table::__node __node;
+ typedef __hash_map_node_destructor<__node_allocator> _Dp;
+ typedef std::unique_ptr<__node, _Dp> __node_holder;
+ typedef std::allocator_traits<allocator_type> __alloc_traits;
+
public:
- typedef typename __alloc_traits::pointer pointer;
- typedef typename __alloc_traits::const_pointer const_pointer;
- typedef typename __alloc_traits::size_type size_type;
- typedef typename __alloc_traits::difference_type difference_type;
-
- typedef __hash_map_iterator<typename __table::iterator> iterator;
- typedef __hash_map_const_iterator<typename __table::const_iterator> const_iterator;
-
- _LIBCPP_HIDE_FROM_ABI hash_map() { }
- explicit _LIBCPP_HIDE_FROM_ABI hash_map(size_type __n, const hasher& __hf = hasher(),
- const key_equal& __eql = key_equal());
- _LIBCPP_HIDE_FROM_ABI hash_map(size_type __n, const hasher& __hf,
- const key_equal& __eql,
- const allocator_type& __a);
- template <class _InputIterator>
- _LIBCPP_HIDE_FROM_ABI hash_map(_InputIterator __first, _InputIterator __last);
- template <class _InputIterator>
- _LIBCPP_HIDE_FROM_ABI hash_map(_InputIterator __first, _InputIterator __last,
- size_type __n, const hasher& __hf = hasher(),
- const key_equal& __eql = key_equal());
- template <class _InputIterator>
- _LIBCPP_HIDE_FROM_ABI hash_map(_InputIterator __first, _InputIterator __last,
- size_type __n, const hasher& __hf,
- const key_equal& __eql,
- const allocator_type& __a);
- _LIBCPP_HIDE_FROM_ABI hash_map(const hash_map& __u);
-
- _LIBCPP_HIDE_FROM_ABI
- allocator_type get_allocator() const
- {return allocator_type(__table_.__node_alloc());}
-
- _LIBCPP_HIDE_FROM_ABI
- bool empty() const {return __table_.size() == 0;}
- _LIBCPP_HIDE_FROM_ABI
- size_type size() const {return __table_.size();}
- _LIBCPP_HIDE_FROM_ABI
- size_type max_size() const {return __table_.max_size();}
-
- _LIBCPP_HIDE_FROM_ABI
- iterator begin() {return __table_.begin();}
- _LIBCPP_HIDE_FROM_ABI
- iterator end() {return __table_.end();}
- _LIBCPP_HIDE_FROM_ABI
- const_iterator begin() const {return __table_.begin();}
- _LIBCPP_HIDE_FROM_ABI
- const_iterator end() const {return __table_.end();}
-
- _LIBCPP_HIDE_FROM_ABI
- std::pair<iterator, bool> insert(const value_type& __x)
- {return __table_.__insert_unique(__x);}
- _LIBCPP_HIDE_FROM_ABI
- iterator insert(const_iterator, const value_type& __x) {return insert(__x).first;}
- template <class _InputIterator>
- _LIBCPP_HIDE_FROM_ABI
- void insert(_InputIterator __first, _InputIterator __last);
-
- _LIBCPP_HIDE_FROM_ABI
- void erase(const_iterator __p) {__table_.erase(__p.__i_);}
- _LIBCPP_HIDE_FROM_ABI
- size_type erase(const key_type& __k) {return __table_.__erase_unique(__k);}
- _LIBCPP_HIDE_FROM_ABI
- void erase(const_iterator __first, const_iterator __last)
- {__table_.erase(__first.__i_, __last.__i_);}
- _LIBCPP_HIDE_FROM_ABI
- void clear() {__table_.clear();}
-
- _LIBCPP_HIDE_FROM_ABI
- void swap(hash_map& __u) {__table_.swap(__u.__table_);}
-
- _LIBCPP_HIDE_FROM_ABI
- hasher hash_funct() const
- {return __table_.hash_function().hash_function();}
- _LIBCPP_HIDE_FROM_ABI
- key_equal key_eq() const
- {return __table_.key_eq().key_eq();}
-
- _LIBCPP_HIDE_FROM_ABI
- iterator find(const key_type& __k) {return __table_.find(__k);}
- _LIBCPP_HIDE_FROM_ABI
- const_iterator find(const key_type& __k) const {return __table_.find(__k);}
- _LIBCPP_HIDE_FROM_ABI
- size_type count(const key_type& __k) const {return __table_.__count_unique(__k);}
- _LIBCPP_HIDE_FROM_ABI
- std::pair<iterator, iterator> equal_range(const key_type& __k)
- {return __table_.__equal_range_unique(__k);}
- _LIBCPP_HIDE_FROM_ABI
- std::pair<const_iterator, const_iterator> equal_range(const key_type& __k) const
- {return __table_.__equal_range_unique(__k);}
-
- _LIBCPP_HIDE_FROM_ABI mapped_type& operator[](const key_type& __k);
-
- _LIBCPP_HIDE_FROM_ABI
- size_type bucket_count() const {return __table_.bucket_count();}
- _LIBCPP_HIDE_FROM_ABI
- size_type max_bucket_count() const {return __table_.max_bucket_count();}
-
- _LIBCPP_HIDE_FROM_ABI
- size_type elems_in_bucket(size_type __n) const
- {return __table_.bucket_size(__n);}
-
- _LIBCPP_HIDE_FROM_ABI
- void resize(size_type __n) {__table_.__rehash_unique(__n);}
+ typedef typename __alloc_traits::pointer pointer;
+ typedef typename __alloc_traits::const_pointer const_pointer;
+ typedef typename __alloc_traits::size_type size_type;
+ typedef typename __alloc_traits::difference_type difference_type;
+
+ typedef __hash_map_iterator<typename __table::iterator> iterator;
+ typedef __hash_map_const_iterator<typename __table::const_iterator> const_iterator;
+
+ _LIBCPP_HIDE_FROM_ABI hash_map() {}
+ explicit _LIBCPP_HIDE_FROM_ABI
+ hash_map(size_type __n, const hasher& __hf = hasher(), const key_equal& __eql = key_equal());
+ _LIBCPP_HIDE_FROM_ABI hash_map(size_type __n, const hasher& __hf, const key_equal& __eql, const allocator_type& __a);
+ template <class _InputIterator>
+ _LIBCPP_HIDE_FROM_ABI hash_map(_InputIterator __first, _InputIterator __last);
+ template <class _InputIterator>
+ _LIBCPP_HIDE_FROM_ABI
+ hash_map(_InputIterator __first,
+ _InputIterator __last,
+ size_type __n,
+ const hasher& __hf = hasher(),
+ const key_equal& __eql = key_equal());
+ template <class _InputIterator>
+ _LIBCPP_HIDE_FROM_ABI
+ hash_map(_InputIterator __first,
+ _InputIterator __last,
+ size_type __n,
+ const hasher& __hf,
+ const key_equal& __eql,
+ const allocator_type& __a);
+ _LIBCPP_HIDE_FROM_ABI hash_map(const hash_map& __u);
+
+ _LIBCPP_HIDE_FROM_ABI allocator_type get_allocator() const { return allocator_type(__table_.__node_alloc()); }
+
+ _LIBCPP_HIDE_FROM_ABI bool empty() const { return __table_.size() == 0; }
+ _LIBCPP_HIDE_FROM_ABI size_type size() const { return __table_.size(); }
+ _LIBCPP_HIDE_FROM_ABI size_type max_size() const { return __table_.max_size(); }
+
+ _LIBCPP_HIDE_FROM_ABI iterator begin() { return __table_.begin(); }
+ _LIBCPP_HIDE_FROM_ABI iterator end() { return __table_.end(); }
+ _LIBCPP_HIDE_FROM_ABI const_iterator begin() const { return __table_.begin(); }
+ _LIBCPP_HIDE_FROM_ABI const_iterator end() const { return __table_.end(); }
+
+ _LIBCPP_HIDE_FROM_ABI std::pair<iterator, bool> insert(const value_type& __x) {
+ return __table_.__insert_unique(__x);
+ }
+ _LIBCPP_HIDE_FROM_ABI iterator insert(const_iterator, const value_type& __x) { return insert(__x).first; }
+ template <class _InputIterator>
+ _LIBCPP_HIDE_FROM_ABI void insert(_InputIterator __first, _InputIterator __last);
+
+ _LIBCPP_HIDE_FROM_ABI void erase(const_iterator __p) { __table_.erase(__p.__i_); }
+ _LIBCPP_HIDE_FROM_ABI size_type erase(const key_type& __k) { return __table_.__erase_unique(__k); }
+ _LIBCPP_HIDE_FROM_ABI void erase(const_iterator __first, const_iterator __last) {
+ __table_.erase(__first.__i_, __last.__i_);
+ }
+ _LIBCPP_HIDE_FROM_ABI void clear() { __table_.clear(); }
+
+ _LIBCPP_HIDE_FROM_ABI void swap(hash_map& __u) { __table_.swap(__u.__table_); }
+
+ _LIBCPP_HIDE_FROM_ABI hasher hash_funct() const { return __table_.hash_function().hash_function(); }
+ _LIBCPP_HIDE_FROM_ABI key_equal key_eq() const { return __table_.key_eq().key_eq(); }
+
+ _LIBCPP_HIDE_FROM_ABI iterator find(const key_type& __k) { return __table_.find(__k); }
+ _LIBCPP_HIDE_FROM_ABI const_iterator find(const key_type& __k) const { return __table_.find(__k); }
+ _LIBCPP_HIDE_FROM_ABI size_type count(const key_type& __k) const { return __table_.__count_unique(__k); }
+ _LIBCPP_HIDE_FROM_ABI std::pair<iterator, iterator> equal_range(const key_type& __k) {
+ return __table_.__equal_range_unique(__k);
+ }
+ _LIBCPP_HIDE_FROM_ABI std::pair<const_iterator, const_iterator> equal_range(const key_type& __k) const {
+ return __table_.__equal_range_unique(__k);
+ }
+
+ _LIBCPP_HIDE_FROM_ABI mapped_type& operator[](const key_type& __k);
+
+ _LIBCPP_HIDE_FROM_ABI size_type bucket_count() const { return __table_.bucket_count(); }
+ _LIBCPP_HIDE_FROM_ABI size_type max_bucket_count() const { return __table_.max_bucket_count(); }
+
+ _LIBCPP_HIDE_FROM_ABI size_type elems_in_bucket(size_type __n) const { return __table_.bucket_size(__n); }
+
+ _LIBCPP_HIDE_FROM_ABI void resize(size_type __n) { __table_.__rehash_unique(__n); }
private:
- _LIBCPP_HIDE_FROM_ABI __node_holder __construct_node(const key_type& __k);
+ _LIBCPP_HIDE_FROM_ABI __node_holder __construct_node(const key_type& __k);
};
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
-hash_map<_Key, _Tp, _Hash, _Pred, _Alloc>::hash_map(
- size_type __n, const hasher& __hf, const key_equal& __eql)
- : __table_(__hf, __eql)
-{
- __table_.__rehash_unique(__n);
+hash_map<_Key, _Tp, _Hash, _Pred, _Alloc>::hash_map(size_type __n, const hasher& __hf, const key_equal& __eql)
+ : __table_(__hf, __eql) {
+ __table_.__rehash_unique(__n);
}
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
hash_map<_Key, _Tp, _Hash, _Pred, _Alloc>::hash_map(
- size_type __n, const hasher& __hf, const key_equal& __eql,
- const allocator_type& __a)
- : __table_(__hf, __eql, __a)
-{
- __table_.__rehash_unique(__n);
+ size_type __n, const hasher& __hf, const key_equal& __eql, const allocator_type& __a)
+ : __table_(__hf, __eql, __a) {
+ __table_.__rehash_unique(__n);
}
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
template <class _InputIterator>
-hash_map<_Key, _Tp, _Hash, _Pred, _Alloc>::hash_map(
- _InputIterator __first, _InputIterator __last)
-{
- insert(__first, __last);
+hash_map<_Key, _Tp, _Hash, _Pred, _Alloc>::hash_map(_InputIterator __first, _InputIterator __last) {
+ insert(__first, __last);
}
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
template <class _InputIterator>
hash_map<_Key, _Tp, _Hash, _Pred, _Alloc>::hash_map(
- _InputIterator __first, _InputIterator __last, size_type __n,
- const hasher& __hf, const key_equal& __eql)
- : __table_(__hf, __eql)
-{
- __table_.__rehash_unique(__n);
- insert(__first, __last);
+ _InputIterator __first, _InputIterator __last, size_type __n, const hasher& __hf, const key_equal& __eql)
+ : __table_(__hf, __eql) {
+ __table_.__rehash_unique(__n);
+ insert(__first, __last);
}
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
template <class _InputIterator>
hash_map<_Key, _Tp, _Hash, _Pred, _Alloc>::hash_map(
- _InputIterator __first, _InputIterator __last, size_type __n,
- const hasher& __hf, const key_equal& __eql, const allocator_type& __a)
- : __table_(__hf, __eql, __a)
-{
- __table_.__rehash_unique(__n);
- insert(__first, __last);
+ _InputIterator __first,
+ _InputIterator __last,
+ size_type __n,
+ const hasher& __hf,
+ const key_equal& __eql,
+ const allocator_type& __a)
+ : __table_(__hf, __eql, __a) {
+ __table_.__rehash_unique(__n);
+ insert(__first, __last);
}
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
-hash_map<_Key, _Tp, _Hash, _Pred, _Alloc>::hash_map(
- const hash_map& __u)
- : __table_(__u.__table_)
-{
- __table_.__rehash_unique(__u.bucket_count());
- insert(__u.begin(), __u.end());
+hash_map<_Key, _Tp, _Hash, _Pred, _Alloc>::hash_map(const hash_map& __u) : __table_(__u.__table_) {
+ __table_.__rehash_unique(__u.bucket_count());
+ insert(__u.begin(), __u.end());
}
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
typename hash_map<_Key, _Tp, _Hash, _Pred, _Alloc>::__node_holder
-hash_map<_Key, _Tp, _Hash, _Pred, _Alloc>::__construct_node(const key_type& __k)
-{
- __node_allocator& __na = __table_.__node_alloc();
- __node_holder __h(__node_traits::allocate(__na, 1), _Dp(__na));
- __node_traits::construct(__na, std::addressof(__h->__get_value().first), __k);
- __h.get_deleter().__first_constructed = true;
- __node_traits::construct(__na, std::addressof(__h->__get_value().second));
- __h.get_deleter().__second_constructed = true;
- return __h;
+hash_map<_Key, _Tp, _Hash, _Pred, _Alloc>::__construct_node(const key_type& __k) {
+ __node_allocator& __na = __table_.__node_alloc();
+ __node_holder __h(__node_traits::allocate(__na, 1), _Dp(__na));
+ __node_traits::construct(__na, std::addressof(__h->__get_value().first), __k);
+ __h.get_deleter().__first_constructed = true;
+ __node_traits::construct(__na, std::addressof(__h->__get_value().second));
+ __h.get_deleter().__second_constructed = true;
+ return __h;
}
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
template <class _InputIterator>
-inline
-void
-hash_map<_Key, _Tp, _Hash, _Pred, _Alloc>::insert(_InputIterator __first,
- _InputIterator __last)
-{
- for (; __first != __last; ++__first)
- __table_.__insert_unique(*__first);
+inline void hash_map<_Key, _Tp, _Hash, _Pred, _Alloc>::insert(_InputIterator __first, _InputIterator __last) {
+ for (; __first != __last; ++__first)
+ __table_.__insert_unique(*__first);
}
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
-_Tp&
-hash_map<_Key, _Tp, _Hash, _Pred, _Alloc>::operator[](const key_type& __k)
-{
- iterator __i = find(__k);
- if (__i != end())
- return __i->second;
- __node_holder __h = __construct_node(__k);
- std::pair<iterator, bool> __r = __table_.__node_insert_unique(__h.get());
- __h.release();
- return __r.first->second;
+_Tp& hash_map<_Key, _Tp, _Hash, _Pred, _Alloc>::operator[](const key_type& __k) {
+ iterator __i = find(__k);
+ if (__i != end())
+ return __i->second;
+ __node_holder __h = __construct_node(__k);
+ std::pair<iterator, bool> __r = __table_.__node_insert_unique(__h.get());
+ __h.release();
+ return __r.first->second;
}
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
-inline _LIBCPP_HIDE_FROM_ABI
-void
-swap(hash_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
- hash_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __y)
-{
- __x.swap(__y);
+inline _LIBCPP_HIDE_FROM_ABI void
+swap(hash_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __x, hash_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __y) {
+ __x.swap(__y);
}
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
_LIBCPP_HIDE_FROM_ABI bool
-operator==(const hash_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
- const hash_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __y)
-{
- if (__x.size() != __y.size())
- return false;
- typedef typename hash_map<_Key, _Tp, _Hash, _Pred, _Alloc>::const_iterator
- const_iterator;
- for (const_iterator __i = __x.begin(), __ex = __x.end(), __ey = __y.end();
- __i != __ex; ++__i)
- {
- const_iterator __j = __y.find(__i->first);
- if (__j == __ey || !(*__i == *__j))
- return false;
- }
- return true;
+operator==(const hash_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __x, const hash_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __y) {
+ if (__x.size() != __y.size())
+ return false;
+ typedef typename hash_map<_Key, _Tp, _Hash, _Pred, _Alloc>::const_iterator const_iterator;
+ for (const_iterator __i = __x.begin(), __ex = __x.end(), __ey = __y.end(); __i != __ex; ++__i) {
+ const_iterator __j = __y.find(__i->first);
+ if (__j == __ey || !(*__i == *__j))
+ return false;
+ }
+ return true;
}
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator!=(const hash_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
- const hash_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __y)
-{
- return !(__x == __y);
+inline _LIBCPP_HIDE_FROM_ABI bool
+operator!=(const hash_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __x, const hash_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __y) {
+ return !(__x == __y);
}
-template <class _Key, class _Tp, class _Hash = hash<_Key>, class _Pred = std::equal_to<_Key>,
+template <class _Key,
+ class _Tp,
+ class _Hash = hash<_Key>,
+ class _Pred = std::equal_to<_Key>,
class _Alloc = std::allocator<std::pair<const _Key, _Tp> > >
-class _LIBCPP_TEMPLATE_VIS hash_multimap
-{
+class _LIBCPP_TEMPLATE_VIS hash_multimap {
public:
- // types
- typedef _Key key_type;
- typedef _Tp mapped_type;
- typedef _Tp data_type;
- typedef _Hash hasher;
- typedef _Pred key_equal;
- typedef _Alloc allocator_type;
- typedef std::pair<const key_type, mapped_type> value_type;
- typedef value_type& reference;
- typedef const value_type& const_reference;
+ // types
+ typedef _Key key_type;
+ typedef _Tp mapped_type;
+ typedef _Tp data_type;
+ typedef _Hash hasher;
+ typedef _Pred key_equal;
+ typedef _Alloc allocator_type;
+ typedef std::pair<const key_type, mapped_type> value_type;
+ typedef value_type& reference;
+ typedef const value_type& const_reference;
private:
- typedef std::pair<key_type, mapped_type> __value_type;
- typedef __hash_map_hasher<__value_type, hasher> __hasher;
- typedef __hash_map_equal<__value_type, key_equal> __key_equal;
- typedef std::__rebind_alloc<std::allocator_traits<allocator_type>, __value_type> __allocator_type;
-
- typedef std::__hash_table<__value_type, __hasher,
- __key_equal, __allocator_type> __table;
-
- __table __table_;
-
- typedef typename __table::__node_traits __node_traits;
- typedef typename __table::__node_allocator __node_allocator;
- typedef typename __table::__node __node;
- typedef __hash_map_node_destructor<__node_allocator> _Dp;
- typedef std::unique_ptr<__node, _Dp> __node_holder;
- typedef std::allocator_traits<allocator_type> __alloc_traits;
+ typedef std::pair<key_type, mapped_type> __value_type;
+ typedef __hash_map_hasher<__value_type, hasher> __hasher;
+ typedef __hash_map_equal<__value_type, key_equal> __key_equal;
+ typedef std::__rebind_alloc<std::allocator_traits<allocator_type>, __value_type> __allocator_type;
+
+ typedef std::__hash_table<__value_type, __hasher, __key_equal, __allocator_type> __table;
+
+ __table __table_;
+
+ typedef typename __table::__node_traits __node_traits;
+ typedef typename __table::__node_allocator __node_allocator;
+ typedef typename __table::__node __node;
+ typedef __hash_map_node_destructor<__node_allocator> _Dp;
+ typedef std::unique_ptr<__node, _Dp> __node_holder;
+ typedef std::allocator_traits<allocator_type> __alloc_traits;
+
public:
- typedef typename __alloc_traits::pointer pointer;
- typedef typename __alloc_traits::const_pointer const_pointer;
- typedef typename __alloc_traits::size_type size_type;
- typedef typename __alloc_traits::difference_type difference_type;
-
- typedef __hash_map_iterator<typename __table::iterator> iterator;
- typedef __hash_map_const_iterator<typename __table::const_iterator> const_iterator;
-
- _LIBCPP_HIDE_FROM_ABI
- hash_multimap() { }
- explicit _LIBCPP_HIDE_FROM_ABI hash_multimap(size_type __n, const hasher& __hf = hasher(),
- const key_equal& __eql = key_equal());
- _LIBCPP_HIDE_FROM_ABI hash_multimap(size_type __n, const hasher& __hf,
- const key_equal& __eql,
- const allocator_type& __a);
- template <class _InputIterator>
- _LIBCPP_HIDE_FROM_ABI hash_multimap(_InputIterator __first, _InputIterator __last);
- template <class _InputIterator>
- _LIBCPP_HIDE_FROM_ABI hash_multimap(_InputIterator __first, _InputIterator __last,
- size_type __n, const hasher& __hf = hasher(),
- const key_equal& __eql = key_equal());
- template <class _InputIterator>
- _LIBCPP_HIDE_FROM_ABI hash_multimap(_InputIterator __first, _InputIterator __last,
- size_type __n, const hasher& __hf,
- const key_equal& __eql,
- const allocator_type& __a);
- _LIBCPP_HIDE_FROM_ABI hash_multimap(const hash_multimap& __u);
-
- _LIBCPP_HIDE_FROM_ABI
- allocator_type get_allocator() const
- {return allocator_type(__table_.__node_alloc());}
-
- _LIBCPP_HIDE_FROM_ABI
- bool empty() const {return __table_.size() == 0;}
- _LIBCPP_HIDE_FROM_ABI
- size_type size() const {return __table_.size();}
- _LIBCPP_HIDE_FROM_ABI
- size_type max_size() const {return __table_.max_size();}
-
- _LIBCPP_HIDE_FROM_ABI
- iterator begin() {return __table_.begin();}
- _LIBCPP_HIDE_FROM_ABI
- iterator end() {return __table_.end();}
- _LIBCPP_HIDE_FROM_ABI
- const_iterator begin() const {return __table_.begin();}
- _LIBCPP_HIDE_FROM_ABI
- const_iterator end() const {return __table_.end();}
-
- _LIBCPP_HIDE_FROM_ABI
- iterator insert(const value_type& __x) {return __table_.__insert_multi(__x);}
- _LIBCPP_HIDE_FROM_ABI
- iterator insert(const_iterator, const value_type& __x) {return insert(__x);}
- template <class _InputIterator>
- _LIBCPP_HIDE_FROM_ABI
- void insert(_InputIterator __first, _InputIterator __last);
-
- _LIBCPP_HIDE_FROM_ABI
- void erase(const_iterator __p) {__table_.erase(__p.__i_);}
- _LIBCPP_HIDE_FROM_ABI
- size_type erase(const key_type& __k) {return __table_.__erase_multi(__k);}
- _LIBCPP_HIDE_FROM_ABI
- void erase(const_iterator __first, const_iterator __last)
- {__table_.erase(__first.__i_, __last.__i_);}
- _LIBCPP_HIDE_FROM_ABI
- void clear() {__table_.clear();}
-
- _LIBCPP_HIDE_FROM_ABI
- void swap(hash_multimap& __u) {__table_.swap(__u.__table_);}
-
- _LIBCPP_HIDE_FROM_ABI
- hasher hash_funct() const
- {return __table_.hash_function().hash_function();}
- _LIBCPP_HIDE_FROM_ABI
- key_equal key_eq() const
- {return __table_.key_eq().key_eq();}
-
- _LIBCPP_HIDE_FROM_ABI
- iterator find(const key_type& __k) {return __table_.find(__k);}
- _LIBCPP_HIDE_FROM_ABI
- const_iterator find(const key_type& __k) const {return __table_.find(__k);}
- _LIBCPP_HIDE_FROM_ABI
- size_type count(const key_type& __k) const {return __table_.__count_multi(__k);}
- _LIBCPP_HIDE_FROM_ABI
- std::pair<iterator, iterator> equal_range(const key_type& __k)
- {return __table_.__equal_range_multi(__k);}
- _LIBCPP_HIDE_FROM_ABI
- std::pair<const_iterator, const_iterator> equal_range(const key_type& __k) const
- {return __table_.__equal_range_multi(__k);}
-
- _LIBCPP_HIDE_FROM_ABI
- size_type bucket_count() const {return __table_.bucket_count();}
- _LIBCPP_HIDE_FROM_ABI
- size_type max_bucket_count() const {return __table_.max_bucket_count();}
-
- _LIBCPP_HIDE_FROM_ABI
- size_type elems_in_bucket(size_type __n) const
- {return __table_.bucket_size(__n);}
-
- _LIBCPP_HIDE_FROM_ABI
- void resize(size_type __n) {__table_.__rehash_multi(__n);}
+ typedef typename __alloc_traits::pointer pointer;
+ typedef typename __alloc_traits::const_pointer const_pointer;
+ typedef typename __alloc_traits::size_type size_type;
+ typedef typename __alloc_traits::difference_type difference_type;
+
+ typedef __hash_map_iterator<typename __table::iterator> iterator;
+ typedef __hash_map_const_iterator<typename __table::const_iterator> const_iterator;
+
+ _LIBCPP_HIDE_FROM_ABI hash_multimap() {}
+ explicit _LIBCPP_HIDE_FROM_ABI
+ hash_multimap(size_type __n, const hasher& __hf = hasher(), const key_equal& __eql = key_equal());
+ _LIBCPP_HIDE_FROM_ABI
+ hash_multimap(size_type __n, const hasher& __hf, const key_equal& __eql, const allocator_type& __a);
+ template <class _InputIterator>
+ _LIBCPP_HIDE_FROM_ABI hash_multimap(_InputIterator __first, _InputIterator __last);
+ template <class _InputIterator>
+ _LIBCPP_HIDE_FROM_ABI
+ hash_multimap(_InputIterator __first,
+ _InputIterator __last,
+ size_type __n,
+ const hasher& __hf = hasher(),
+ const key_equal& __eql = key_equal());
+ template <class _InputIterator>
+ _LIBCPP_HIDE_FROM_ABI hash_multimap(
+ _InputIterator __first,
+ _InputIterator __last,
+ size_type __n,
+ const hasher& __hf,
+ const key_equal& __eql,
+ const allocator_type& __a);
+ _LIBCPP_HIDE_FROM_ABI hash_multimap(const hash_multimap& __u);
+
+ _LIBCPP_HIDE_FROM_ABI allocator_type get_allocator() const { return allocator_type(__table_.__node_alloc()); }
+
+ _LIBCPP_HIDE_FROM_ABI bool empty() const { return __table_.size() == 0; }
+ _LIBCPP_HIDE_FROM_ABI size_type size() const { return __table_.size(); }
+ _LIBCPP_HIDE_FROM_ABI size_type max_size() const { return __table_.max_size(); }
+
+ _LIBCPP_HIDE_FROM_ABI iterator begin() { return __table_.begin(); }
+ _LIBCPP_HIDE_FROM_ABI iterator end() { return __table_.end(); }
+ _LIBCPP_HIDE_FROM_ABI const_iterator begin() const { return __table_.begin(); }
+ _LIBCPP_HIDE_FROM_ABI const_iterator end() const { return __table_.end(); }
+
+ _LIBCPP_HIDE_FROM_ABI iterator insert(const value_type& __x) { return __table_.__insert_multi(__x); }
+ _LIBCPP_HIDE_FROM_ABI iterator insert(const_iterator, const value_type& __x) { return insert(__x); }
+ template <class _InputIterator>
+ _LIBCPP_HIDE_FROM_ABI void insert(_InputIterator __first, _InputIterator __last);
+
+ _LIBCPP_HIDE_FROM_ABI void erase(const_iterator __p) { __table_.erase(__p.__i_); }
+ _LIBCPP_HIDE_FROM_ABI size_type erase(const key_type& __k) { return __table_.__erase_multi(__k); }
+ _LIBCPP_HIDE_FROM_ABI void erase(const_iterator __first, const_iterator __last) {
+ __table_.erase(__first.__i_, __last.__i_);
+ }
+ _LIBCPP_HIDE_FROM_ABI void clear() { __table_.clear(); }
+
+ _LIBCPP_HIDE_FROM_ABI void swap(hash_multimap& __u) { __table_.swap(__u.__table_); }
+
+ _LIBCPP_HIDE_FROM_ABI hasher hash_funct() const { return __table_.hash_function().hash_function(); }
+ _LIBCPP_HIDE_FROM_ABI key_equal key_eq() const { return __table_.key_eq().key_eq(); }
+
+ _LIBCPP_HIDE_FROM_ABI iterator find(const key_type& __k) { return __table_.find(__k); }
+ _LIBCPP_HIDE_FROM_ABI const_iterator find(const key_type& __k) const { return __table_.find(__k); }
+ _LIBCPP_HIDE_FROM_ABI size_type count(const key_type& __k) const { return __table_.__count_multi(__k); }
+ _LIBCPP_HIDE_FROM_ABI std::pair<iterator, iterator> equal_range(const key_type& __k) {
+ return __table_.__equal_range_multi(__k);
+ }
+ _LIBCPP_HIDE_FROM_ABI std::pair<const_iterator, const_iterator> equal_range(const key_type& __k) const {
+ return __table_.__equal_range_multi(__k);
+ }
+
+ _LIBCPP_HIDE_FROM_ABI size_type bucket_count() const { return __table_.bucket_count(); }
+ _LIBCPP_HIDE_FROM_ABI size_type max_bucket_count() const { return __table_.max_bucket_count(); }
+
+ _LIBCPP_HIDE_FROM_ABI size_type elems_in_bucket(size_type __n) const { return __table_.bucket_size(__n); }
+
+ _LIBCPP_HIDE_FROM_ABI void resize(size_type __n) { __table_.__rehash_multi(__n); }
};
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
-hash_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::hash_multimap(
- size_type __n, const hasher& __hf, const key_equal& __eql)
- : __table_(__hf, __eql)
-{
- __table_.__rehash_multi(__n);
+hash_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::hash_multimap(size_type __n, const hasher& __hf, const key_equal& __eql)
+ : __table_(__hf, __eql) {
+ __table_.__rehash_multi(__n);
}
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
hash_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::hash_multimap(
- size_type __n, const hasher& __hf, const key_equal& __eql,
- const allocator_type& __a)
- : __table_(__hf, __eql, __a)
-{
- __table_.__rehash_multi(__n);
+ size_type __n, const hasher& __hf, const key_equal& __eql, const allocator_type& __a)
+ : __table_(__hf, __eql, __a) {
+ __table_.__rehash_multi(__n);
}
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
template <class _InputIterator>
-hash_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::hash_multimap(
- _InputIterator __first, _InputIterator __last)
-{
- insert(__first, __last);
+hash_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::hash_multimap(_InputIterator __first, _InputIterator __last) {
+ insert(__first, __last);
}
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
template <class _InputIterator>
hash_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::hash_multimap(
- _InputIterator __first, _InputIterator __last, size_type __n,
- const hasher& __hf, const key_equal& __eql)
- : __table_(__hf, __eql)
-{
- __table_.__rehash_multi(__n);
- insert(__first, __last);
+ _InputIterator __first, _InputIterator __last, size_type __n, const hasher& __hf, const key_equal& __eql)
+ : __table_(__hf, __eql) {
+ __table_.__rehash_multi(__n);
+ insert(__first, __last);
}
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
template <class _InputIterator>
hash_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::hash_multimap(
- _InputIterator __first, _InputIterator __last, size_type __n,
- const hasher& __hf, const key_equal& __eql, const allocator_type& __a)
- : __table_(__hf, __eql, __a)
-{
- __table_.__rehash_multi(__n);
- insert(__first, __last);
+ _InputIterator __first,
+ _InputIterator __last,
+ size_type __n,
+ const hasher& __hf,
+ const key_equal& __eql,
+ const allocator_type& __a)
+ : __table_(__hf, __eql, __a) {
+ __table_.__rehash_multi(__n);
+ insert(__first, __last);
}
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
-hash_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::hash_multimap(
- const hash_multimap& __u)
- : __table_(__u.__table_)
-{
- __table_.__rehash_multi(__u.bucket_count());
- insert(__u.begin(), __u.end());
+hash_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::hash_multimap(const hash_multimap& __u) : __table_(__u.__table_) {
+ __table_.__rehash_multi(__u.bucket_count());
+ insert(__u.begin(), __u.end());
}
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
template <class _InputIterator>
-inline
-void
-hash_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::insert(_InputIterator __first,
- _InputIterator __last)
-{
- for (; __first != __last; ++__first)
- __table_.__insert_multi(*__first);
+inline void hash_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::insert(_InputIterator __first, _InputIterator __last) {
+ for (; __first != __last; ++__first)
+ __table_.__insert_multi(*__first);
}
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
-inline _LIBCPP_HIDE_FROM_ABI
-void
-swap(hash_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
- hash_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __y)
-{
- __x.swap(__y);
+inline _LIBCPP_HIDE_FROM_ABI void
+swap(hash_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __x, hash_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __y) {
+ __x.swap(__y);
}
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
-_LIBCPP_HIDE_FROM_ABI bool
-operator==(const hash_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
- const hash_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __y)
-{
- if (__x.size() != __y.size())
- return false;
- typedef typename hash_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::const_iterator
- const_iterator;
- typedef std::pair<const_iterator, const_iterator> _EqRng;
- for (const_iterator __i = __x.begin(), __ex = __x.end(); __i != __ex;)
- {
- _EqRng __xeq = __x.equal_range(__i->first);
- _EqRng __yeq = __y.equal_range(__i->first);
- if (std::distance(__xeq.first, __xeq.second) !=
- std::distance(__yeq.first, __yeq.second) ||
- !std::is_permutation(__xeq.first, __xeq.second, __yeq.first))
- return false;
- __i = __xeq.second;
- }
- return true;
+_LIBCPP_HIDE_FROM_ABI bool operator==(const hash_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
+ const hash_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __y) {
+ if (__x.size() != __y.size())
+ return false;
+ typedef typename hash_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::const_iterator const_iterator;
+ typedef std::pair<const_iterator, const_iterator> _EqRng;
+ for (const_iterator __i = __x.begin(), __ex = __x.end(); __i != __ex;) {
+ _EqRng __xeq = __x.equal_range(__i->first);
+ _EqRng __yeq = __y.equal_range(__i->first);
+ if (std::distance(__xeq.first, __xeq.second) != std::distance(__yeq.first, __yeq.second) ||
+ !std::is_permutation(__xeq.first, __xeq.second, __yeq.first))
+ return false;
+ __i = __xeq.second;
+ }
+ return true;
}
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator!=(const hash_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
- const hash_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __y)
-{
- return !(__x == __y);
+inline _LIBCPP_HIDE_FROM_ABI bool operator!=(const hash_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
+ const hash_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __y) {
+ return !(__x == __y);
}
} // namespace __gnu_cxx
diff --git a/contrib/llvm-project/libcxx/include/ext/hash_set b/contrib/llvm-project/libcxx/include/ext/hash_set
index 7166aa815ec7..79f0925f6f4c 100644
--- a/contrib/llvm-project/libcxx/include/ext/hash_set
+++ b/contrib/llvm-project/libcxx/include/ext/hash_set
@@ -200,11 +200,11 @@ template <class Value, class Hash, class Pred, class Alloc>
#include <functional>
#if defined(__DEPRECATED) && __DEPRECATED
-#if defined(_LIBCPP_WARNING)
- _LIBCPP_WARNING("Use of the header <ext/hash_set> is deprecated. Migrate to <unordered_set>")
-#else
-# warning Use of the header <ext/hash_set> is deprecated. Migrate to <unordered_set>
-#endif
+# if defined(_LIBCPP_WARNING)
+_LIBCPP_WARNING("Use of the header <ext/hash_set> is deprecated. Migrate to <unordered_set>")
+# else
+# warning Use of the header <ext/hash_set> is deprecated. Migrate to <unordered_set>
+# endif
#endif
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
@@ -213,451 +213,365 @@ template <class Value, class Hash, class Pred, class Alloc>
namespace __gnu_cxx {
-
-template <class _Value, class _Hash = hash<_Value>, class _Pred = std::equal_to<_Value>,
+template <class _Value,
+ class _Hash = hash<_Value>,
+ class _Pred = std::equal_to<_Value>,
class _Alloc = std::allocator<_Value> >
-class _LIBCPP_TEMPLATE_VIS hash_set
-{
+class _LIBCPP_TEMPLATE_VIS hash_set {
public:
- // types
- typedef _Value key_type;
- typedef key_type value_type;
- typedef _Hash hasher;
- typedef _Pred key_equal;
- typedef _Alloc allocator_type;
- typedef value_type& reference;
- typedef const value_type& const_reference;
+ // types
+ typedef _Value key_type;
+ typedef key_type value_type;
+ typedef _Hash hasher;
+ typedef _Pred key_equal;
+ typedef _Alloc allocator_type;
+ typedef value_type& reference;
+ typedef const value_type& const_reference;
private:
- typedef std::__hash_table<value_type, hasher, key_equal, allocator_type> __table;
+ typedef std::__hash_table<value_type, hasher, key_equal, allocator_type> __table;
- __table __table_;
+ __table __table_;
public:
- typedef typename __table::pointer pointer;
- typedef typename __table::const_pointer const_pointer;
- typedef typename __table::size_type size_type;
- typedef typename __table::difference_type difference_type;
-
- typedef typename __table::const_iterator iterator;
- typedef typename __table::const_iterator const_iterator;
-
- _LIBCPP_HIDE_FROM_ABI
- hash_set() { }
- _LIBCPP_HIDE_FROM_ABI explicit hash_set(size_type __n, const hasher& __hf = hasher(),
- const key_equal& __eql = key_equal());
- _LIBCPP_HIDE_FROM_ABI hash_set(size_type __n, const hasher& __hf, const key_equal& __eql,
- const allocator_type& __a);
- template <class _InputIterator>
- _LIBCPP_HIDE_FROM_ABI hash_set(_InputIterator __first, _InputIterator __last);
- template <class _InputIterator>
- _LIBCPP_HIDE_FROM_ABI hash_set(_InputIterator __first, _InputIterator __last,
- size_type __n, const hasher& __hf = hasher(),
- const key_equal& __eql = key_equal());
- template <class _InputIterator>
- _LIBCPP_HIDE_FROM_ABI hash_set(_InputIterator __first, _InputIterator __last,
- size_type __n, const hasher& __hf, const key_equal& __eql,
- const allocator_type& __a);
- _LIBCPP_HIDE_FROM_ABI hash_set(const hash_set& __u);
-
- _LIBCPP_HIDE_FROM_ABI
- allocator_type get_allocator() const
- {return allocator_type(__table_.__node_alloc());}
-
- _LIBCPP_HIDE_FROM_ABI
- bool empty() const {return __table_.size() == 0;}
- _LIBCPP_HIDE_FROM_ABI
- size_type size() const {return __table_.size();}
- _LIBCPP_HIDE_FROM_ABI
- size_type max_size() const {return __table_.max_size();}
-
- _LIBCPP_HIDE_FROM_ABI
- iterator begin() {return __table_.begin();}
- _LIBCPP_HIDE_FROM_ABI
- iterator end() {return __table_.end();}
- _LIBCPP_HIDE_FROM_ABI
- const_iterator begin() const {return __table_.begin();}
- _LIBCPP_HIDE_FROM_ABI
- const_iterator end() const {return __table_.end();}
-
- _LIBCPP_HIDE_FROM_ABI
- std::pair<iterator, bool> insert(const value_type& __x)
- {return __table_.__insert_unique(__x);}
- _LIBCPP_HIDE_FROM_ABI
- iterator insert(const_iterator, const value_type& __x) {return insert(__x).first;}
- template <class _InputIterator>
- _LIBCPP_HIDE_FROM_ABI
- void insert(_InputIterator __first, _InputIterator __last);
-
- _LIBCPP_HIDE_FROM_ABI
- void erase(const_iterator __p) {__table_.erase(__p);}
- _LIBCPP_HIDE_FROM_ABI
- size_type erase(const key_type& __k) {return __table_.__erase_unique(__k);}
- _LIBCPP_HIDE_FROM_ABI
- void erase(const_iterator __first, const_iterator __last)
- {__table_.erase(__first, __last);}
- _LIBCPP_HIDE_FROM_ABI
- void clear() {__table_.clear();}
-
- _LIBCPP_HIDE_FROM_ABI
- void swap(hash_set& __u) {__table_.swap(__u.__table_);}
-
- _LIBCPP_HIDE_FROM_ABI
- hasher hash_funct() const {return __table_.hash_function();}
- _LIBCPP_HIDE_FROM_ABI
- key_equal key_eq() const {return __table_.key_eq();}
-
- _LIBCPP_HIDE_FROM_ABI
- iterator find(const key_type& __k) {return __table_.find(__k);}
- _LIBCPP_HIDE_FROM_ABI
- const_iterator find(const key_type& __k) const {return __table_.find(__k);}
- _LIBCPP_HIDE_FROM_ABI
- size_type count(const key_type& __k) const {return __table_.__count_unique(__k);}
- _LIBCPP_HIDE_FROM_ABI
- std::pair<iterator, iterator> equal_range(const key_type& __k)
- {return __table_.__equal_range_unique(__k);}
- _LIBCPP_HIDE_FROM_ABI
- std::pair<const_iterator, const_iterator> equal_range(const key_type& __k) const
- {return __table_.__equal_range_unique(__k);}
-
- _LIBCPP_HIDE_FROM_ABI
- size_type bucket_count() const {return __table_.bucket_count();}
- _LIBCPP_HIDE_FROM_ABI
- size_type max_bucket_count() const {return __table_.max_bucket_count();}
-
- _LIBCPP_HIDE_FROM_ABI
- size_type elems_in_bucket(size_type __n) const {return __table_.bucket_size(__n);}
-
- _LIBCPP_HIDE_FROM_ABI
- void resize(size_type __n) {__table_.__rehash_unique(__n);}
+ typedef typename __table::pointer pointer;
+ typedef typename __table::const_pointer const_pointer;
+ typedef typename __table::size_type size_type;
+ typedef typename __table::difference_type difference_type;
+
+ typedef typename __table::const_iterator iterator;
+ typedef typename __table::const_iterator const_iterator;
+
+ _LIBCPP_HIDE_FROM_ABI hash_set() {}
+ _LIBCPP_HIDE_FROM_ABI explicit hash_set(
+ size_type __n, const hasher& __hf = hasher(), const key_equal& __eql = key_equal());
+ _LIBCPP_HIDE_FROM_ABI hash_set(size_type __n, const hasher& __hf, const key_equal& __eql, const allocator_type& __a);
+ template <class _InputIterator>
+ _LIBCPP_HIDE_FROM_ABI hash_set(_InputIterator __first, _InputIterator __last);
+ template <class _InputIterator>
+ _LIBCPP_HIDE_FROM_ABI
+ hash_set(_InputIterator __first,
+ _InputIterator __last,
+ size_type __n,
+ const hasher& __hf = hasher(),
+ const key_equal& __eql = key_equal());
+ template <class _InputIterator>
+ _LIBCPP_HIDE_FROM_ABI
+ hash_set(_InputIterator __first,
+ _InputIterator __last,
+ size_type __n,
+ const hasher& __hf,
+ const key_equal& __eql,
+ const allocator_type& __a);
+ _LIBCPP_HIDE_FROM_ABI hash_set(const hash_set& __u);
+
+ _LIBCPP_HIDE_FROM_ABI allocator_type get_allocator() const { return allocator_type(__table_.__node_alloc()); }
+
+ _LIBCPP_HIDE_FROM_ABI bool empty() const { return __table_.size() == 0; }
+ _LIBCPP_HIDE_FROM_ABI size_type size() const { return __table_.size(); }
+ _LIBCPP_HIDE_FROM_ABI size_type max_size() const { return __table_.max_size(); }
+
+ _LIBCPP_HIDE_FROM_ABI iterator begin() { return __table_.begin(); }
+ _LIBCPP_HIDE_FROM_ABI iterator end() { return __table_.end(); }
+ _LIBCPP_HIDE_FROM_ABI const_iterator begin() const { return __table_.begin(); }
+ _LIBCPP_HIDE_FROM_ABI const_iterator end() const { return __table_.end(); }
+
+ _LIBCPP_HIDE_FROM_ABI std::pair<iterator, bool> insert(const value_type& __x) {
+ return __table_.__insert_unique(__x);
+ }
+ _LIBCPP_HIDE_FROM_ABI iterator insert(const_iterator, const value_type& __x) { return insert(__x).first; }
+ template <class _InputIterator>
+ _LIBCPP_HIDE_FROM_ABI void insert(_InputIterator __first, _InputIterator __last);
+
+ _LIBCPP_HIDE_FROM_ABI void erase(const_iterator __p) { __table_.erase(__p); }
+ _LIBCPP_HIDE_FROM_ABI size_type erase(const key_type& __k) { return __table_.__erase_unique(__k); }
+ _LIBCPP_HIDE_FROM_ABI void erase(const_iterator __first, const_iterator __last) { __table_.erase(__first, __last); }
+ _LIBCPP_HIDE_FROM_ABI void clear() { __table_.clear(); }
+
+ _LIBCPP_HIDE_FROM_ABI void swap(hash_set& __u) { __table_.swap(__u.__table_); }
+
+ _LIBCPP_HIDE_FROM_ABI hasher hash_funct() const { return __table_.hash_function(); }
+ _LIBCPP_HIDE_FROM_ABI key_equal key_eq() const { return __table_.key_eq(); }
+
+ _LIBCPP_HIDE_FROM_ABI iterator find(const key_type& __k) { return __table_.find(__k); }
+ _LIBCPP_HIDE_FROM_ABI const_iterator find(const key_type& __k) const { return __table_.find(__k); }
+ _LIBCPP_HIDE_FROM_ABI size_type count(const key_type& __k) const { return __table_.__count_unique(__k); }
+ _LIBCPP_HIDE_FROM_ABI std::pair<iterator, iterator> equal_range(const key_type& __k) {
+ return __table_.__equal_range_unique(__k);
+ }
+ _LIBCPP_HIDE_FROM_ABI std::pair<const_iterator, const_iterator> equal_range(const key_type& __k) const {
+ return __table_.__equal_range_unique(__k);
+ }
+
+ _LIBCPP_HIDE_FROM_ABI size_type bucket_count() const { return __table_.bucket_count(); }
+ _LIBCPP_HIDE_FROM_ABI size_type max_bucket_count() const { return __table_.max_bucket_count(); }
+
+ _LIBCPP_HIDE_FROM_ABI size_type elems_in_bucket(size_type __n) const { return __table_.bucket_size(__n); }
+
+ _LIBCPP_HIDE_FROM_ABI void resize(size_type __n) { __table_.__rehash_unique(__n); }
};
template <class _Value, class _Hash, class _Pred, class _Alloc>
-hash_set<_Value, _Hash, _Pred, _Alloc>::hash_set(size_type __n,
- const hasher& __hf, const key_equal& __eql)
- : __table_(__hf, __eql)
-{
- __table_.__rehash_unique(__n);
+hash_set<_Value, _Hash, _Pred, _Alloc>::hash_set(size_type __n, const hasher& __hf, const key_equal& __eql)
+ : __table_(__hf, __eql) {
+ __table_.__rehash_unique(__n);
}
template <class _Value, class _Hash, class _Pred, class _Alloc>
-hash_set<_Value, _Hash, _Pred, _Alloc>::hash_set(size_type __n,
- const hasher& __hf, const key_equal& __eql, const allocator_type& __a)
- : __table_(__hf, __eql, __a)
-{
- __table_.__rehash_unique(__n);
+hash_set<_Value, _Hash, _Pred, _Alloc>::hash_set(
+ size_type __n, const hasher& __hf, const key_equal& __eql, const allocator_type& __a)
+ : __table_(__hf, __eql, __a) {
+ __table_.__rehash_unique(__n);
}
template <class _Value, class _Hash, class _Pred, class _Alloc>
template <class _InputIterator>
-hash_set<_Value, _Hash, _Pred, _Alloc>::hash_set(
- _InputIterator __first, _InputIterator __last)
-{
- insert(__first, __last);
+hash_set<_Value, _Hash, _Pred, _Alloc>::hash_set(_InputIterator __first, _InputIterator __last) {
+ insert(__first, __last);
}
template <class _Value, class _Hash, class _Pred, class _Alloc>
template <class _InputIterator>
hash_set<_Value, _Hash, _Pred, _Alloc>::hash_set(
- _InputIterator __first, _InputIterator __last, size_type __n,
- const hasher& __hf, const key_equal& __eql)
- : __table_(__hf, __eql)
-{
- __table_.__rehash_unique(__n);
- insert(__first, __last);
+ _InputIterator __first, _InputIterator __last, size_type __n, const hasher& __hf, const key_equal& __eql)
+ : __table_(__hf, __eql) {
+ __table_.__rehash_unique(__n);
+ insert(__first, __last);
}
template <class _Value, class _Hash, class _Pred, class _Alloc>
template <class _InputIterator>
hash_set<_Value, _Hash, _Pred, _Alloc>::hash_set(
- _InputIterator __first, _InputIterator __last, size_type __n,
- const hasher& __hf, const key_equal& __eql, const allocator_type& __a)
- : __table_(__hf, __eql, __a)
-{
- __table_.__rehash_unique(__n);
- insert(__first, __last);
+ _InputIterator __first,
+ _InputIterator __last,
+ size_type __n,
+ const hasher& __hf,
+ const key_equal& __eql,
+ const allocator_type& __a)
+ : __table_(__hf, __eql, __a) {
+ __table_.__rehash_unique(__n);
+ insert(__first, __last);
}
template <class _Value, class _Hash, class _Pred, class _Alloc>
-hash_set<_Value, _Hash, _Pred, _Alloc>::hash_set(
- const hash_set& __u)
- : __table_(__u.__table_)
-{
- __table_.__rehash_unique(__u.bucket_count());
- insert(__u.begin(), __u.end());
+hash_set<_Value, _Hash, _Pred, _Alloc>::hash_set(const hash_set& __u) : __table_(__u.__table_) {
+ __table_.__rehash_unique(__u.bucket_count());
+ insert(__u.begin(), __u.end());
}
template <class _Value, class _Hash, class _Pred, class _Alloc>
template <class _InputIterator>
-inline
-void
-hash_set<_Value, _Hash, _Pred, _Alloc>::insert(_InputIterator __first,
- _InputIterator __last)
-{
- for (; __first != __last; ++__first)
- __table_.__insert_unique(*__first);
+inline void hash_set<_Value, _Hash, _Pred, _Alloc>::insert(_InputIterator __first, _InputIterator __last) {
+ for (; __first != __last; ++__first)
+ __table_.__insert_unique(*__first);
}
template <class _Value, class _Hash, class _Pred, class _Alloc>
-inline _LIBCPP_HIDE_FROM_ABI
-void
-swap(hash_set<_Value, _Hash, _Pred, _Alloc>& __x,
- hash_set<_Value, _Hash, _Pred, _Alloc>& __y)
-{
- __x.swap(__y);
+inline _LIBCPP_HIDE_FROM_ABI void
+swap(hash_set<_Value, _Hash, _Pred, _Alloc>& __x, hash_set<_Value, _Hash, _Pred, _Alloc>& __y) {
+ __x.swap(__y);
}
template <class _Value, class _Hash, class _Pred, class _Alloc>
_LIBCPP_HIDE_FROM_ABI bool
-operator==(const hash_set<_Value, _Hash, _Pred, _Alloc>& __x,
- const hash_set<_Value, _Hash, _Pred, _Alloc>& __y)
-{
- if (__x.size() != __y.size())
- return false;
- typedef typename hash_set<_Value, _Hash, _Pred, _Alloc>::const_iterator
- const_iterator;
- for (const_iterator __i = __x.begin(), __ex = __x.end(), __ey = __y.end();
- __i != __ex; ++__i)
- {
- const_iterator __j = __y.find(*__i);
- if (__j == __ey || !(*__i == *__j))
- return false;
- }
- return true;
+operator==(const hash_set<_Value, _Hash, _Pred, _Alloc>& __x, const hash_set<_Value, _Hash, _Pred, _Alloc>& __y) {
+ if (__x.size() != __y.size())
+ return false;
+ typedef typename hash_set<_Value, _Hash, _Pred, _Alloc>::const_iterator const_iterator;
+ for (const_iterator __i = __x.begin(), __ex = __x.end(), __ey = __y.end(); __i != __ex; ++__i) {
+ const_iterator __j = __y.find(*__i);
+ if (__j == __ey || !(*__i == *__j))
+ return false;
+ }
+ return true;
}
template <class _Value, class _Hash, class _Pred, class _Alloc>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator!=(const hash_set<_Value, _Hash, _Pred, _Alloc>& __x,
- const hash_set<_Value, _Hash, _Pred, _Alloc>& __y)
-{
- return !(__x == __y);
+inline _LIBCPP_HIDE_FROM_ABI bool
+operator!=(const hash_set<_Value, _Hash, _Pred, _Alloc>& __x, const hash_set<_Value, _Hash, _Pred, _Alloc>& __y) {
+ return !(__x == __y);
}
-template <class _Value, class _Hash = hash<_Value>, class _Pred = std::equal_to<_Value>,
+template <class _Value,
+ class _Hash = hash<_Value>,
+ class _Pred = std::equal_to<_Value>,
class _Alloc = std::allocator<_Value> >
-class _LIBCPP_TEMPLATE_VIS hash_multiset
-{
+class _LIBCPP_TEMPLATE_VIS hash_multiset {
public:
- // types
- typedef _Value key_type;
- typedef key_type value_type;
- typedef _Hash hasher;
- typedef _Pred key_equal;
- typedef _Alloc allocator_type;
- typedef value_type& reference;
- typedef const value_type& const_reference;
+ // types
+ typedef _Value key_type;
+ typedef key_type value_type;
+ typedef _Hash hasher;
+ typedef _Pred key_equal;
+ typedef _Alloc allocator_type;
+ typedef value_type& reference;
+ typedef const value_type& const_reference;
private:
- typedef std::__hash_table<value_type, hasher, key_equal, allocator_type> __table;
+ typedef std::__hash_table<value_type, hasher, key_equal, allocator_type> __table;
- __table __table_;
+ __table __table_;
public:
- typedef typename __table::pointer pointer;
- typedef typename __table::const_pointer const_pointer;
- typedef typename __table::size_type size_type;
- typedef typename __table::difference_type difference_type;
-
- typedef typename __table::const_iterator iterator;
- typedef typename __table::const_iterator const_iterator;
-
- _LIBCPP_HIDE_FROM_ABI
- hash_multiset() { }
- explicit _LIBCPP_HIDE_FROM_ABI hash_multiset(size_type __n, const hasher& __hf = hasher(),
- const key_equal& __eql = key_equal());
- _LIBCPP_HIDE_FROM_ABI hash_multiset(size_type __n, const hasher& __hf,
- const key_equal& __eql, const allocator_type& __a);
- template <class _InputIterator>
- _LIBCPP_HIDE_FROM_ABI hash_multiset(_InputIterator __first, _InputIterator __last);
- template <class _InputIterator>
- _LIBCPP_HIDE_FROM_ABI hash_multiset(_InputIterator __first, _InputIterator __last,
- size_type __n, const hasher& __hf = hasher(),
- const key_equal& __eql = key_equal());
- template <class _InputIterator>
- _LIBCPP_HIDE_FROM_ABI hash_multiset(_InputIterator __first, _InputIterator __last,
- size_type __n , const hasher& __hf,
- const key_equal& __eql, const allocator_type& __a);
- _LIBCPP_HIDE_FROM_ABI hash_multiset(const hash_multiset& __u);
-
- _LIBCPP_HIDE_FROM_ABI
- allocator_type get_allocator() const
- {return allocator_type(__table_.__node_alloc());}
-
- _LIBCPP_HIDE_FROM_ABI
- bool empty() const {return __table_.size() == 0;}
- _LIBCPP_HIDE_FROM_ABI
- size_type size() const {return __table_.size();}
- _LIBCPP_HIDE_FROM_ABI
- size_type max_size() const {return __table_.max_size();}
-
- _LIBCPP_HIDE_FROM_ABI
- iterator begin() {return __table_.begin();}
- _LIBCPP_HIDE_FROM_ABI
- iterator end() {return __table_.end();}
- _LIBCPP_HIDE_FROM_ABI
- const_iterator begin() const {return __table_.begin();}
- _LIBCPP_HIDE_FROM_ABI
- const_iterator end() const {return __table_.end();}
-
- _LIBCPP_HIDE_FROM_ABI
- iterator insert(const value_type& __x) {return __table_.__insert_multi(__x);}
- _LIBCPP_HIDE_FROM_ABI
- iterator insert(const_iterator, const value_type& __x) {return insert(__x);}
- template <class _InputIterator>
- _LIBCPP_HIDE_FROM_ABI
- void insert(_InputIterator __first, _InputIterator __last);
-
- _LIBCPP_HIDE_FROM_ABI
- void erase(const_iterator __p) {__table_.erase(__p);}
- _LIBCPP_HIDE_FROM_ABI
- size_type erase(const key_type& __k) {return __table_.__erase_multi(__k);}
- _LIBCPP_HIDE_FROM_ABI
- void erase(const_iterator __first, const_iterator __last)
- {__table_.erase(__first, __last);}
- _LIBCPP_HIDE_FROM_ABI
- void clear() {__table_.clear();}
-
- _LIBCPP_HIDE_FROM_ABI
- void swap(hash_multiset& __u) {__table_.swap(__u.__table_);}
-
- _LIBCPP_HIDE_FROM_ABI
- hasher hash_funct() const {return __table_.hash_function();}
- _LIBCPP_HIDE_FROM_ABI
- key_equal key_eq() const {return __table_.key_eq();}
-
- _LIBCPP_HIDE_FROM_ABI
- iterator find(const key_type& __k) {return __table_.find(__k);}
- _LIBCPP_HIDE_FROM_ABI
- const_iterator find(const key_type& __k) const {return __table_.find(__k);}
- _LIBCPP_HIDE_FROM_ABI
- size_type count(const key_type& __k) const {return __table_.__count_multi(__k);}
- _LIBCPP_HIDE_FROM_ABI
- std::pair<iterator, iterator> equal_range(const key_type& __k)
- {return __table_.__equal_range_multi(__k);}
- _LIBCPP_HIDE_FROM_ABI
- std::pair<const_iterator, const_iterator> equal_range(const key_type& __k) const
- {return __table_.__equal_range_multi(__k);}
-
- _LIBCPP_HIDE_FROM_ABI
- size_type bucket_count() const {return __table_.bucket_count();}
- _LIBCPP_HIDE_FROM_ABI
- size_type max_bucket_count() const {return __table_.max_bucket_count();}
-
- _LIBCPP_HIDE_FROM_ABI
- size_type elems_in_bucket(size_type __n) const {return __table_.bucket_size(__n);}
-
- _LIBCPP_HIDE_FROM_ABI
- void resize(size_type __n) {__table_.__rehash_multi(__n);}
+ typedef typename __table::pointer pointer;
+ typedef typename __table::const_pointer const_pointer;
+ typedef typename __table::size_type size_type;
+ typedef typename __table::difference_type difference_type;
+
+ typedef typename __table::const_iterator iterator;
+ typedef typename __table::const_iterator const_iterator;
+
+ _LIBCPP_HIDE_FROM_ABI hash_multiset() {}
+ explicit _LIBCPP_HIDE_FROM_ABI
+ hash_multiset(size_type __n, const hasher& __hf = hasher(), const key_equal& __eql = key_equal());
+ _LIBCPP_HIDE_FROM_ABI
+ hash_multiset(size_type __n, const hasher& __hf, const key_equal& __eql, const allocator_type& __a);
+ template <class _InputIterator>
+ _LIBCPP_HIDE_FROM_ABI hash_multiset(_InputIterator __first, _InputIterator __last);
+ template <class _InputIterator>
+ _LIBCPP_HIDE_FROM_ABI
+ hash_multiset(_InputIterator __first,
+ _InputIterator __last,
+ size_type __n,
+ const hasher& __hf = hasher(),
+ const key_equal& __eql = key_equal());
+ template <class _InputIterator>
+ _LIBCPP_HIDE_FROM_ABI hash_multiset(
+ _InputIterator __first,
+ _InputIterator __last,
+ size_type __n,
+ const hasher& __hf,
+ const key_equal& __eql,
+ const allocator_type& __a);
+ _LIBCPP_HIDE_FROM_ABI hash_multiset(const hash_multiset& __u);
+
+ _LIBCPP_HIDE_FROM_ABI allocator_type get_allocator() const { return allocator_type(__table_.__node_alloc()); }
+
+ _LIBCPP_HIDE_FROM_ABI bool empty() const { return __table_.size() == 0; }
+ _LIBCPP_HIDE_FROM_ABI size_type size() const { return __table_.size(); }
+ _LIBCPP_HIDE_FROM_ABI size_type max_size() const { return __table_.max_size(); }
+
+ _LIBCPP_HIDE_FROM_ABI iterator begin() { return __table_.begin(); }
+ _LIBCPP_HIDE_FROM_ABI iterator end() { return __table_.end(); }
+ _LIBCPP_HIDE_FROM_ABI const_iterator begin() const { return __table_.begin(); }
+ _LIBCPP_HIDE_FROM_ABI const_iterator end() const { return __table_.end(); }
+
+ _LIBCPP_HIDE_FROM_ABI iterator insert(const value_type& __x) { return __table_.__insert_multi(__x); }
+ _LIBCPP_HIDE_FROM_ABI iterator insert(const_iterator, const value_type& __x) { return insert(__x); }
+ template <class _InputIterator>
+ _LIBCPP_HIDE_FROM_ABI void insert(_InputIterator __first, _InputIterator __last);
+
+ _LIBCPP_HIDE_FROM_ABI void erase(const_iterator __p) { __table_.erase(__p); }
+ _LIBCPP_HIDE_FROM_ABI size_type erase(const key_type& __k) { return __table_.__erase_multi(__k); }
+ _LIBCPP_HIDE_FROM_ABI void erase(const_iterator __first, const_iterator __last) { __table_.erase(__first, __last); }
+ _LIBCPP_HIDE_FROM_ABI void clear() { __table_.clear(); }
+
+ _LIBCPP_HIDE_FROM_ABI void swap(hash_multiset& __u) { __table_.swap(__u.__table_); }
+
+ _LIBCPP_HIDE_FROM_ABI hasher hash_funct() const { return __table_.hash_function(); }
+ _LIBCPP_HIDE_FROM_ABI key_equal key_eq() const { return __table_.key_eq(); }
+
+ _LIBCPP_HIDE_FROM_ABI iterator find(const key_type& __k) { return __table_.find(__k); }
+ _LIBCPP_HIDE_FROM_ABI const_iterator find(const key_type& __k) const { return __table_.find(__k); }
+ _LIBCPP_HIDE_FROM_ABI size_type count(const key_type& __k) const { return __table_.__count_multi(__k); }
+ _LIBCPP_HIDE_FROM_ABI std::pair<iterator, iterator> equal_range(const key_type& __k) {
+ return __table_.__equal_range_multi(__k);
+ }
+ _LIBCPP_HIDE_FROM_ABI std::pair<const_iterator, const_iterator> equal_range(const key_type& __k) const {
+ return __table_.__equal_range_multi(__k);
+ }
+
+ _LIBCPP_HIDE_FROM_ABI size_type bucket_count() const { return __table_.bucket_count(); }
+ _LIBCPP_HIDE_FROM_ABI size_type max_bucket_count() const { return __table_.max_bucket_count(); }
+
+ _LIBCPP_HIDE_FROM_ABI size_type elems_in_bucket(size_type __n) const { return __table_.bucket_size(__n); }
+
+ _LIBCPP_HIDE_FROM_ABI void resize(size_type __n) { __table_.__rehash_multi(__n); }
};
template <class _Value, class _Hash, class _Pred, class _Alloc>
-hash_multiset<_Value, _Hash, _Pred, _Alloc>::hash_multiset(
- size_type __n, const hasher& __hf, const key_equal& __eql)
- : __table_(__hf, __eql)
-{
- __table_.__rehash_multi(__n);
+hash_multiset<_Value, _Hash, _Pred, _Alloc>::hash_multiset(size_type __n, const hasher& __hf, const key_equal& __eql)
+ : __table_(__hf, __eql) {
+ __table_.__rehash_multi(__n);
}
template <class _Value, class _Hash, class _Pred, class _Alloc>
hash_multiset<_Value, _Hash, _Pred, _Alloc>::hash_multiset(
- size_type __n, const hasher& __hf, const key_equal& __eql,
- const allocator_type& __a)
- : __table_(__hf, __eql, __a)
-{
- __table_.__rehash_multi(__n);
+ size_type __n, const hasher& __hf, const key_equal& __eql, const allocator_type& __a)
+ : __table_(__hf, __eql, __a) {
+ __table_.__rehash_multi(__n);
}
template <class _Value, class _Hash, class _Pred, class _Alloc>
template <class _InputIterator>
-hash_multiset<_Value, _Hash, _Pred, _Alloc>::hash_multiset(
- _InputIterator __first, _InputIterator __last)
-{
- insert(__first, __last);
+hash_multiset<_Value, _Hash, _Pred, _Alloc>::hash_multiset(_InputIterator __first, _InputIterator __last) {
+ insert(__first, __last);
}
template <class _Value, class _Hash, class _Pred, class _Alloc>
template <class _InputIterator>
hash_multiset<_Value, _Hash, _Pred, _Alloc>::hash_multiset(
- _InputIterator __first, _InputIterator __last, size_type __n,
- const hasher& __hf, const key_equal& __eql)
- : __table_(__hf, __eql)
-{
- __table_.__rehash_multi(__n);
- insert(__first, __last);
+ _InputIterator __first, _InputIterator __last, size_type __n, const hasher& __hf, const key_equal& __eql)
+ : __table_(__hf, __eql) {
+ __table_.__rehash_multi(__n);
+ insert(__first, __last);
}
template <class _Value, class _Hash, class _Pred, class _Alloc>
template <class _InputIterator>
hash_multiset<_Value, _Hash, _Pred, _Alloc>::hash_multiset(
- _InputIterator __first, _InputIterator __last, size_type __n,
- const hasher& __hf, const key_equal& __eql, const allocator_type& __a)
- : __table_(__hf, __eql, __a)
-{
- __table_.__rehash_multi(__n);
- insert(__first, __last);
+ _InputIterator __first,
+ _InputIterator __last,
+ size_type __n,
+ const hasher& __hf,
+ const key_equal& __eql,
+ const allocator_type& __a)
+ : __table_(__hf, __eql, __a) {
+ __table_.__rehash_multi(__n);
+ insert(__first, __last);
}
template <class _Value, class _Hash, class _Pred, class _Alloc>
-hash_multiset<_Value, _Hash, _Pred, _Alloc>::hash_multiset(
- const hash_multiset& __u)
- : __table_(__u.__table_)
-{
- __table_.__rehash_multi(__u.bucket_count());
- insert(__u.begin(), __u.end());
+hash_multiset<_Value, _Hash, _Pred, _Alloc>::hash_multiset(const hash_multiset& __u) : __table_(__u.__table_) {
+ __table_.__rehash_multi(__u.bucket_count());
+ insert(__u.begin(), __u.end());
}
template <class _Value, class _Hash, class _Pred, class _Alloc>
template <class _InputIterator>
-inline
-void
-hash_multiset<_Value, _Hash, _Pred, _Alloc>::insert(_InputIterator __first,
- _InputIterator __last)
-{
- for (; __first != __last; ++__first)
- __table_.__insert_multi(*__first);
+inline void hash_multiset<_Value, _Hash, _Pred, _Alloc>::insert(_InputIterator __first, _InputIterator __last) {
+ for (; __first != __last; ++__first)
+ __table_.__insert_multi(*__first);
}
template <class _Value, class _Hash, class _Pred, class _Alloc>
-inline _LIBCPP_HIDE_FROM_ABI
-void
-swap(hash_multiset<_Value, _Hash, _Pred, _Alloc>& __x,
- hash_multiset<_Value, _Hash, _Pred, _Alloc>& __y)
-{
- __x.swap(__y);
+inline _LIBCPP_HIDE_FROM_ABI void
+swap(hash_multiset<_Value, _Hash, _Pred, _Alloc>& __x, hash_multiset<_Value, _Hash, _Pred, _Alloc>& __y) {
+ __x.swap(__y);
}
template <class _Value, class _Hash, class _Pred, class _Alloc>
-_LIBCPP_HIDE_FROM_ABI bool
-operator==(const hash_multiset<_Value, _Hash, _Pred, _Alloc>& __x,
- const hash_multiset<_Value, _Hash, _Pred, _Alloc>& __y)
-{
- if (__x.size() != __y.size())
- return false;
- typedef typename hash_multiset<_Value, _Hash, _Pred, _Alloc>::const_iterator
- const_iterator;
- typedef std::pair<const_iterator, const_iterator> _EqRng;
- for (const_iterator __i = __x.begin(), __ex = __x.end(); __i != __ex;)
- {
- _EqRng __xeq = __x.equal_range(*__i);
- _EqRng __yeq = __y.equal_range(*__i);
- if (std::distance(__xeq.first, __xeq.second) !=
- std::distance(__yeq.first, __yeq.second) ||
- !std::is_permutation(__xeq.first, __xeq.second, __yeq.first))
- return false;
- __i = __xeq.second;
- }
- return true;
+_LIBCPP_HIDE_FROM_ABI bool operator==(const hash_multiset<_Value, _Hash, _Pred, _Alloc>& __x,
+ const hash_multiset<_Value, _Hash, _Pred, _Alloc>& __y) {
+ if (__x.size() != __y.size())
+ return false;
+ typedef typename hash_multiset<_Value, _Hash, _Pred, _Alloc>::const_iterator const_iterator;
+ typedef std::pair<const_iterator, const_iterator> _EqRng;
+ for (const_iterator __i = __x.begin(), __ex = __x.end(); __i != __ex;) {
+ _EqRng __xeq = __x.equal_range(*__i);
+ _EqRng __yeq = __y.equal_range(*__i);
+ if (std::distance(__xeq.first, __xeq.second) != std::distance(__yeq.first, __yeq.second) ||
+ !std::is_permutation(__xeq.first, __xeq.second, __yeq.first))
+ return false;
+ __i = __xeq.second;
+ }
+ return true;
}
template <class _Value, class _Hash, class _Pred, class _Alloc>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator!=(const hash_multiset<_Value, _Hash, _Pred, _Alloc>& __x,
- const hash_multiset<_Value, _Hash, _Pred, _Alloc>& __y)
-{
- return !(__x == __y);
+inline _LIBCPP_HIDE_FROM_ABI bool operator!=(const hash_multiset<_Value, _Hash, _Pred, _Alloc>& __x,
+ const hash_multiset<_Value, _Hash, _Pred, _Alloc>& __y) {
+ return !(__x == __y);
}
} // namespace __gnu_cxx
diff --git a/contrib/llvm-project/libcxx/include/fenv.h b/contrib/llvm-project/libcxx/include/fenv.h
index 15e41568cbf7..5647f2b33955 100644
--- a/contrib/llvm-project/libcxx/include/fenv.h
+++ b/contrib/llvm-project/libcxx/include/fenv.h
@@ -10,7 +10,6 @@
#ifndef _LIBCPP_FENV_H
#define _LIBCPP_FENV_H
-
/*
fenv.h synopsis
@@ -64,52 +63,49 @@ int feupdateenv(const fenv_t* envp);
extern "C++" {
-#ifdef feclearexcept
-#undef feclearexcept
-#endif
+# ifdef feclearexcept
+# undef feclearexcept
+# endif
-#ifdef fegetexceptflag
-#undef fegetexceptflag
-#endif
+# ifdef fegetexceptflag
+# undef fegetexceptflag
+# endif
+# ifdef feraiseexcept
+# undef feraiseexcept
+# endif
-#ifdef feraiseexcept
-#undef feraiseexcept
-#endif
+# ifdef fesetexceptflag
+# undef fesetexceptflag
+# endif
-#ifdef fesetexceptflag
-#undef fesetexceptflag
-#endif
+# ifdef fetestexcept
+# undef fetestexcept
+# endif
+# ifdef fegetround
+# undef fegetround
+# endif
-#ifdef fetestexcept
-#undef fetestexcept
-#endif
+# ifdef fesetround
+# undef fesetround
+# endif
-#ifdef fegetround
-#undef fegetround
-#endif
+# ifdef fegetenv
+# undef fegetenv
+# endif
-#ifdef fesetround
-#undef fesetround
-#endif
-
-#ifdef fegetenv
-#undef fegetenv
-#endif
-
-#ifdef feholdexcept
-#undef feholdexcept
-#endif
+# ifdef feholdexcept
+# undef feholdexcept
+# endif
+# ifdef fesetenv
+# undef fesetenv
+# endif
-#ifdef fesetenv
-#undef fesetenv
-#endif
-
-#ifdef feupdateenv
-#undef feupdateenv
-#endif
+# ifdef feupdateenv
+# undef feupdateenv
+# endif
} // extern "C++"
diff --git a/contrib/llvm-project/libcxx/include/float.h b/contrib/llvm-project/libcxx/include/float.h
index 9e5f711fab83..d572866c1358 100644
--- a/contrib/llvm-project/libcxx/include/float.h
+++ b/contrib/llvm-project/libcxx/include/float.h
@@ -82,13 +82,13 @@ Macros:
#ifdef __cplusplus
-#ifndef FLT_EVAL_METHOD
-#define FLT_EVAL_METHOD __FLT_EVAL_METHOD__
-#endif
+# ifndef FLT_EVAL_METHOD
+# define FLT_EVAL_METHOD __FLT_EVAL_METHOD__
+# endif
-#ifndef DECIMAL_DIG
-#define DECIMAL_DIG __DECIMAL_DIG__
-#endif
+# ifndef DECIMAL_DIG
+# define DECIMAL_DIG __DECIMAL_DIG__
+# endif
#endif // __cplusplus
diff --git a/contrib/llvm-project/libcxx/include/forward_list b/contrib/llvm-project/libcxx/include/forward_list
index b8b793c98545..22cb0ebc2247 100644
--- a/contrib/llvm-project/libcxx/include/forward_list
+++ b/contrib/llvm-project/libcxx/include/forward_list
@@ -254,12 +254,12 @@ template <class T, class Allocator, class Predicate>
_LIBCPP_PUSH_MACROS
#include <__undef_macros>
-
_LIBCPP_BEGIN_NAMESPACE_STD
-template <class _Tp, class _VoidPtr> struct __forward_list_node;
-template <class _NodePtr> struct __forward_begin_node;
-
+template <class _Tp, class _VoidPtr>
+struct __forward_list_node;
+template <class _NodePtr>
+struct __forward_begin_node;
template <class>
struct __forward_list_node_value_type;
@@ -271,1020 +271,837 @@ struct __forward_list_node_value_type<__forward_list_node<_Tp, _VoidPtr> > {
template <class _NodePtr>
struct __forward_node_traits {
-
typedef __remove_cv_t<typename pointer_traits<_NodePtr>::element_type> __node_type;
- typedef typename __forward_list_node_value_type<__node_type>::type __node_value_type;
- typedef _NodePtr __node_pointer;
- typedef __forward_begin_node<_NodePtr> __begin_node;
- typedef __rebind_pointer_t<_NodePtr, __begin_node> __begin_node_pointer;
- typedef __rebind_pointer_t<_NodePtr, void> __void_pointer;
+ typedef typename __forward_list_node_value_type<__node_type>::type __node_value_type;
+ typedef _NodePtr __node_pointer;
+ typedef __forward_begin_node<_NodePtr> __begin_node;
+ typedef __rebind_pointer_t<_NodePtr, __begin_node> __begin_node_pointer;
+ typedef __rebind_pointer_t<_NodePtr, void> __void_pointer;
#if defined(_LIBCPP_ABI_FORWARD_LIST_REMOVE_NODE_POINTER_UB)
typedef __begin_node_pointer __iter_node_pointer;
#else
- typedef __conditional_t<is_pointer<__void_pointer>::value, __begin_node_pointer, __node_pointer>
- __iter_node_pointer;
+ typedef __conditional_t<is_pointer<__void_pointer>::value, __begin_node_pointer, __node_pointer> __iter_node_pointer;
#endif
typedef __conditional_t<is_same<__iter_node_pointer, __node_pointer>::value, __begin_node_pointer, __node_pointer>
__non_iter_node_pointer;
- _LIBCPP_HIDE_FROM_ABI
- static __iter_node_pointer __as_iter_node(__iter_node_pointer __p) {
- return __p;
- }
- _LIBCPP_HIDE_FROM_ABI
- static __iter_node_pointer __as_iter_node(__non_iter_node_pointer __p) {
- return static_cast<__iter_node_pointer>(static_cast<__void_pointer>(__p));
+ _LIBCPP_HIDE_FROM_ABI static __iter_node_pointer __as_iter_node(__iter_node_pointer __p) { return __p; }
+ _LIBCPP_HIDE_FROM_ABI static __iter_node_pointer __as_iter_node(__non_iter_node_pointer __p) {
+ return static_cast<__iter_node_pointer>(static_cast<__void_pointer>(__p));
}
};
template <class _NodePtr>
-struct __forward_begin_node
-{
- typedef _NodePtr pointer;
- typedef __rebind_pointer_t<_NodePtr, __forward_begin_node> __begin_node_pointer;
+struct __forward_begin_node {
+ typedef _NodePtr pointer;
+ typedef __rebind_pointer_t<_NodePtr, __forward_begin_node> __begin_node_pointer;
- pointer __next_;
+ pointer __next_;
- _LIBCPP_HIDE_FROM_ABI __forward_begin_node() : __next_(nullptr) {}
- _LIBCPP_HIDE_FROM_ABI explicit __forward_begin_node(pointer __n) : __next_(__n) {}
+ _LIBCPP_HIDE_FROM_ABI __forward_begin_node() : __next_(nullptr) {}
+ _LIBCPP_HIDE_FROM_ABI explicit __forward_begin_node(pointer __n) : __next_(__n) {}
- _LIBCPP_HIDE_FROM_ABI
- __begin_node_pointer __next_as_begin() const {
- return static_cast<__begin_node_pointer>(__next_);
- }
+ _LIBCPP_HIDE_FROM_ABI __begin_node_pointer __next_as_begin() const {
+ return static_cast<__begin_node_pointer>(__next_);
+ }
};
template <class _Tp, class _VoidPtr>
using __begin_node_of = __forward_begin_node<__rebind_pointer_t<_VoidPtr, __forward_list_node<_Tp, _VoidPtr> > >;
template <class _Tp, class _VoidPtr>
-struct __forward_list_node
- : public __begin_node_of<_Tp, _VoidPtr>
-{
- typedef _Tp value_type;
- typedef __begin_node_of<_Tp, _VoidPtr> _Base;
- typedef typename _Base::pointer _NodePtr;
+struct __forward_list_node : public __begin_node_of<_Tp, _VoidPtr> {
+ typedef _Tp value_type;
+ typedef __begin_node_of<_Tp, _VoidPtr> _Base;
+ typedef typename _Base::pointer _NodePtr;
- // We allow starting the lifetime of nodes without initializing the value held by the node,
- // since that is handled by the list itself in order to be allocator-aware.
+ // We allow starting the lifetime of nodes without initializing the value held by the node,
+ // since that is handled by the list itself in order to be allocator-aware.
#ifndef _LIBCPP_CXX03_LANG
+
private:
- union {
- _Tp __value_;
- };
+ union {
+ _Tp __value_;
+ };
public:
- _LIBCPP_HIDE_FROM_ABI _Tp& __get_value() { return __value_; }
+ _LIBCPP_HIDE_FROM_ABI _Tp& __get_value() { return __value_; }
#else
+
private:
- _ALIGNAS_TYPE(_Tp) char __buffer_[sizeof(_Tp)];
+ _ALIGNAS_TYPE(_Tp) char __buffer_[sizeof(_Tp)];
public:
- _LIBCPP_HIDE_FROM_ABI _Tp& __get_value() {
- return *std::__launder(reinterpret_cast<_Tp*>(&__buffer_));
- }
+ _LIBCPP_HIDE_FROM_ABI _Tp& __get_value() { return *std::__launder(reinterpret_cast<_Tp*>(&__buffer_)); }
#endif
- _LIBCPP_HIDE_FROM_ABI explicit __forward_list_node(_NodePtr __next) : _Base(__next) {}
- _LIBCPP_HIDE_FROM_ABI ~__forward_list_node() {}
+ _LIBCPP_HIDE_FROM_ABI explicit __forward_list_node(_NodePtr __next) : _Base(__next) {}
+ _LIBCPP_HIDE_FROM_ABI ~__forward_list_node() {}
};
-
-template <class _Tp, class _Alloc = allocator<_Tp> > class _LIBCPP_TEMPLATE_VIS forward_list;
-template<class _NodeConstPtr> class _LIBCPP_TEMPLATE_VIS __forward_list_const_iterator;
+template <class _Tp, class _Alloc = allocator<_Tp> >
+class _LIBCPP_TEMPLATE_VIS forward_list;
+template <class _NodeConstPtr>
+class _LIBCPP_TEMPLATE_VIS __forward_list_const_iterator;
template <class _NodePtr>
-class _LIBCPP_TEMPLATE_VIS __forward_list_iterator
-{
- typedef __forward_node_traits<_NodePtr> __traits;
- typedef typename __traits::__node_pointer __node_pointer;
- typedef typename __traits::__begin_node_pointer __begin_node_pointer;
- typedef typename __traits::__iter_node_pointer __iter_node_pointer;
- typedef typename __traits::__void_pointer __void_pointer;
-
- __iter_node_pointer __ptr_;
-
- _LIBCPP_HIDE_FROM_ABI
- __begin_node_pointer __get_begin() const {
- return static_cast<__begin_node_pointer>(
- static_cast<__void_pointer>(__ptr_));
- }
- _LIBCPP_HIDE_FROM_ABI
- __node_pointer __get_unsafe_node_pointer() const {
- return static_cast<__node_pointer>(
- static_cast<__void_pointer>(__ptr_));
- }
+class _LIBCPP_TEMPLATE_VIS __forward_list_iterator {
+ typedef __forward_node_traits<_NodePtr> __traits;
+ typedef typename __traits::__node_pointer __node_pointer;
+ typedef typename __traits::__begin_node_pointer __begin_node_pointer;
+ typedef typename __traits::__iter_node_pointer __iter_node_pointer;
+ typedef typename __traits::__void_pointer __void_pointer;
+
+ __iter_node_pointer __ptr_;
+
+ _LIBCPP_HIDE_FROM_ABI __begin_node_pointer __get_begin() const {
+ return static_cast<__begin_node_pointer>(static_cast<__void_pointer>(__ptr_));
+ }
+ _LIBCPP_HIDE_FROM_ABI __node_pointer __get_unsafe_node_pointer() const {
+ return static_cast<__node_pointer>(static_cast<__void_pointer>(__ptr_));
+ }
- _LIBCPP_HIDE_FROM_ABI
- explicit __forward_list_iterator(nullptr_t) _NOEXCEPT : __ptr_(nullptr) {}
+ _LIBCPP_HIDE_FROM_ABI explicit __forward_list_iterator(nullptr_t) _NOEXCEPT : __ptr_(nullptr) {}
- _LIBCPP_HIDE_FROM_ABI
- explicit __forward_list_iterator(__begin_node_pointer __p) _NOEXCEPT
- : __ptr_(__traits::__as_iter_node(__p)) {}
+ _LIBCPP_HIDE_FROM_ABI explicit __forward_list_iterator(__begin_node_pointer __p) _NOEXCEPT
+ : __ptr_(__traits::__as_iter_node(__p)) {}
- _LIBCPP_HIDE_FROM_ABI
- explicit __forward_list_iterator(__node_pointer __p) _NOEXCEPT
- : __ptr_(__traits::__as_iter_node(__p)) {}
+ _LIBCPP_HIDE_FROM_ABI explicit __forward_list_iterator(__node_pointer __p) _NOEXCEPT
+ : __ptr_(__traits::__as_iter_node(__p)) {}
- template<class, class> friend class _LIBCPP_TEMPLATE_VIS forward_list;
- template<class> friend class _LIBCPP_TEMPLATE_VIS __forward_list_const_iterator;
+ template <class, class>
+ friend class _LIBCPP_TEMPLATE_VIS forward_list;
+ template <class>
+ friend class _LIBCPP_TEMPLATE_VIS __forward_list_const_iterator;
public:
- typedef forward_iterator_tag iterator_category;
- typedef typename __traits::__node_value_type value_type;
- typedef value_type& reference;
- typedef typename pointer_traits<__node_pointer>::difference_type
- difference_type;
- typedef __rebind_pointer_t<__node_pointer, value_type> pointer;
-
- _LIBCPP_HIDE_FROM_ABI
- __forward_list_iterator() _NOEXCEPT : __ptr_(nullptr) {}
-
- _LIBCPP_HIDE_FROM_ABI
- reference operator*() const {return __get_unsafe_node_pointer()->__get_value();}
- _LIBCPP_HIDE_FROM_ABI
- pointer operator->() const {
- return pointer_traits<pointer>::pointer_to(__get_unsafe_node_pointer()->__get_value());
- }
+ typedef forward_iterator_tag iterator_category;
+ typedef typename __traits::__node_value_type value_type;
+ typedef value_type& reference;
+ typedef typename pointer_traits<__node_pointer>::difference_type difference_type;
+ typedef __rebind_pointer_t<__node_pointer, value_type> pointer;
- _LIBCPP_HIDE_FROM_ABI
- __forward_list_iterator& operator++()
- {
- __ptr_ = __traits::__as_iter_node(__ptr_->__next_);
- return *this;
- }
- _LIBCPP_HIDE_FROM_ABI
- __forward_list_iterator operator++(int)
- {
- __forward_list_iterator __t(*this);
- ++(*this);
- return __t;
- }
+ _LIBCPP_HIDE_FROM_ABI __forward_list_iterator() _NOEXCEPT : __ptr_(nullptr) {}
+
+ _LIBCPP_HIDE_FROM_ABI reference operator*() const { return __get_unsafe_node_pointer()->__get_value(); }
+ _LIBCPP_HIDE_FROM_ABI pointer operator->() const {
+ return pointer_traits<pointer>::pointer_to(__get_unsafe_node_pointer()->__get_value());
+ }
- friend _LIBCPP_HIDE_FROM_ABI
- bool operator==(const __forward_list_iterator& __x,
- const __forward_list_iterator& __y)
- {return __x.__ptr_ == __y.__ptr_;}
- friend _LIBCPP_HIDE_FROM_ABI
- bool operator!=(const __forward_list_iterator& __x,
- const __forward_list_iterator& __y)
- {return !(__x == __y);}
+ _LIBCPP_HIDE_FROM_ABI __forward_list_iterator& operator++() {
+ __ptr_ = __traits::__as_iter_node(__ptr_->__next_);
+ return *this;
+ }
+ _LIBCPP_HIDE_FROM_ABI __forward_list_iterator operator++(int) {
+ __forward_list_iterator __t(*this);
+ ++(*this);
+ return __t;
+ }
+
+ friend _LIBCPP_HIDE_FROM_ABI bool operator==(const __forward_list_iterator& __x, const __forward_list_iterator& __y) {
+ return __x.__ptr_ == __y.__ptr_;
+ }
+ friend _LIBCPP_HIDE_FROM_ABI bool operator!=(const __forward_list_iterator& __x, const __forward_list_iterator& __y) {
+ return !(__x == __y);
+ }
};
template <class _NodeConstPtr>
-class _LIBCPP_TEMPLATE_VIS __forward_list_const_iterator
-{
- static_assert((!is_const<typename pointer_traits<_NodeConstPtr>::element_type>::value), "");
- typedef _NodeConstPtr _NodePtr;
-
- typedef __forward_node_traits<_NodePtr> __traits;
- typedef typename __traits::__node_type __node_type;
- typedef typename __traits::__node_pointer __node_pointer;
- typedef typename __traits::__begin_node_pointer __begin_node_pointer;
- typedef typename __traits::__iter_node_pointer __iter_node_pointer;
- typedef typename __traits::__void_pointer __void_pointer;
+class _LIBCPP_TEMPLATE_VIS __forward_list_const_iterator {
+ static_assert((!is_const<typename pointer_traits<_NodeConstPtr>::element_type>::value), "");
+ typedef _NodeConstPtr _NodePtr;
- __iter_node_pointer __ptr_;
+ typedef __forward_node_traits<_NodePtr> __traits;
+ typedef typename __traits::__node_type __node_type;
+ typedef typename __traits::__node_pointer __node_pointer;
+ typedef typename __traits::__begin_node_pointer __begin_node_pointer;
+ typedef typename __traits::__iter_node_pointer __iter_node_pointer;
+ typedef typename __traits::__void_pointer __void_pointer;
- _LIBCPP_HIDE_FROM_ABI __begin_node_pointer __get_begin() const {
- return static_cast<__begin_node_pointer>(
- static_cast<__void_pointer>(__ptr_));
- }
- _LIBCPP_HIDE_FROM_ABI __node_pointer __get_unsafe_node_pointer() const {
- return static_cast<__node_pointer>(
- static_cast<__void_pointer>(__ptr_));
- }
+ __iter_node_pointer __ptr_;
- _LIBCPP_HIDE_FROM_ABI
- explicit __forward_list_const_iterator(nullptr_t) _NOEXCEPT
- : __ptr_(nullptr) {}
+ _LIBCPP_HIDE_FROM_ABI __begin_node_pointer __get_begin() const {
+ return static_cast<__begin_node_pointer>(static_cast<__void_pointer>(__ptr_));
+ }
+ _LIBCPP_HIDE_FROM_ABI __node_pointer __get_unsafe_node_pointer() const {
+ return static_cast<__node_pointer>(static_cast<__void_pointer>(__ptr_));
+ }
- _LIBCPP_HIDE_FROM_ABI
- explicit __forward_list_const_iterator(__begin_node_pointer __p) _NOEXCEPT
- : __ptr_(__traits::__as_iter_node(__p)) {}
+ _LIBCPP_HIDE_FROM_ABI explicit __forward_list_const_iterator(nullptr_t) _NOEXCEPT : __ptr_(nullptr) {}
- _LIBCPP_HIDE_FROM_ABI
- explicit __forward_list_const_iterator(__node_pointer __p) _NOEXCEPT
- : __ptr_(__traits::__as_iter_node(__p)) {}
+ _LIBCPP_HIDE_FROM_ABI explicit __forward_list_const_iterator(__begin_node_pointer __p) _NOEXCEPT
+ : __ptr_(__traits::__as_iter_node(__p)) {}
+ _LIBCPP_HIDE_FROM_ABI explicit __forward_list_const_iterator(__node_pointer __p) _NOEXCEPT
+ : __ptr_(__traits::__as_iter_node(__p)) {}
- template<class, class> friend class forward_list;
+ template <class, class>
+ friend class forward_list;
public:
- typedef forward_iterator_tag iterator_category;
- typedef typename __traits::__node_value_type value_type;
- typedef const value_type& reference;
- typedef typename pointer_traits<__node_pointer>::difference_type
- difference_type;
- typedef __rebind_pointer_t<__node_pointer, const value_type>
- pointer;
-
- _LIBCPP_HIDE_FROM_ABI
- __forward_list_const_iterator() _NOEXCEPT : __ptr_(nullptr) {}
- _LIBCPP_HIDE_FROM_ABI
- __forward_list_const_iterator(__forward_list_iterator<__node_pointer> __p) _NOEXCEPT
- : __ptr_(__p.__ptr_) {}
-
- _LIBCPP_HIDE_FROM_ABI
- reference operator*() const {return __get_unsafe_node_pointer()->__get_value();}
- _LIBCPP_HIDE_FROM_ABI
- pointer operator->() const {return pointer_traits<pointer>::pointer_to(
- __get_unsafe_node_pointer()->__get_value());}
-
- _LIBCPP_HIDE_FROM_ABI
- __forward_list_const_iterator& operator++()
- {
- __ptr_ = __traits::__as_iter_node(__ptr_->__next_);
- return *this;
- }
- _LIBCPP_HIDE_FROM_ABI
- __forward_list_const_iterator operator++(int)
- {
- __forward_list_const_iterator __t(*this);
- ++(*this);
- return __t;
- }
+ typedef forward_iterator_tag iterator_category;
+ typedef typename __traits::__node_value_type value_type;
+ typedef const value_type& reference;
+ typedef typename pointer_traits<__node_pointer>::difference_type difference_type;
+ typedef __rebind_pointer_t<__node_pointer, const value_type> pointer;
+
+ _LIBCPP_HIDE_FROM_ABI __forward_list_const_iterator() _NOEXCEPT : __ptr_(nullptr) {}
+ _LIBCPP_HIDE_FROM_ABI __forward_list_const_iterator(__forward_list_iterator<__node_pointer> __p) _NOEXCEPT
+ : __ptr_(__p.__ptr_) {}
+
+ _LIBCPP_HIDE_FROM_ABI reference operator*() const { return __get_unsafe_node_pointer()->__get_value(); }
+ _LIBCPP_HIDE_FROM_ABI pointer operator->() const {
+ return pointer_traits<pointer>::pointer_to(__get_unsafe_node_pointer()->__get_value());
+ }
- friend _LIBCPP_HIDE_FROM_ABI
- bool operator==(const __forward_list_const_iterator& __x,
- const __forward_list_const_iterator& __y)
- {return __x.__ptr_ == __y.__ptr_;}
- friend _LIBCPP_HIDE_FROM_ABI
- bool operator!=(const __forward_list_const_iterator& __x,
- const __forward_list_const_iterator& __y)
- {return !(__x == __y);}
+ _LIBCPP_HIDE_FROM_ABI __forward_list_const_iterator& operator++() {
+ __ptr_ = __traits::__as_iter_node(__ptr_->__next_);
+ return *this;
+ }
+ _LIBCPP_HIDE_FROM_ABI __forward_list_const_iterator operator++(int) {
+ __forward_list_const_iterator __t(*this);
+ ++(*this);
+ return __t;
+ }
+
+ friend _LIBCPP_HIDE_FROM_ABI bool
+ operator==(const __forward_list_const_iterator& __x, const __forward_list_const_iterator& __y) {
+ return __x.__ptr_ == __y.__ptr_;
+ }
+ friend _LIBCPP_HIDE_FROM_ABI bool
+ operator!=(const __forward_list_const_iterator& __x, const __forward_list_const_iterator& __y) {
+ return !(__x == __y);
+ }
};
template <class _Tp, class _Alloc>
-class __forward_list_base
-{
+class __forward_list_base {
protected:
- typedef _Tp value_type;
- typedef _Alloc allocator_type;
-
- typedef typename allocator_traits<allocator_type>::void_pointer void_pointer;
- typedef __forward_list_node<value_type, void_pointer> __node_type;
- typedef __begin_node_of<value_type, void_pointer> __begin_node;
- typedef __rebind_alloc<allocator_traits<allocator_type>, __node_type> __node_allocator;
- typedef allocator_traits<__node_allocator> __node_traits;
- typedef typename __node_traits::pointer __node_pointer;
-
- typedef __rebind_alloc<allocator_traits<allocator_type>, __begin_node> __begin_node_allocator;
- typedef typename allocator_traits<__begin_node_allocator>::pointer
- __begin_node_pointer;
-
- __compressed_pair<__begin_node, __node_allocator> __before_begin_;
-
- _LIBCPP_HIDE_FROM_ABI
- __begin_node_pointer __before_begin() _NOEXCEPT
- {return pointer_traits<__begin_node_pointer>::pointer_to(__before_begin_.first());}
- _LIBCPP_HIDE_FROM_ABI
- __begin_node_pointer __before_begin() const _NOEXCEPT
- {return pointer_traits<__begin_node_pointer>::pointer_to(const_cast<__begin_node&>(__before_begin_.first()));}
-
- _LIBCPP_HIDE_FROM_ABI
- __node_allocator& __alloc() _NOEXCEPT
- {return __before_begin_.second();}
- _LIBCPP_HIDE_FROM_ABI
- const __node_allocator& __alloc() const _NOEXCEPT
- {return __before_begin_.second();}
-
- typedef __forward_list_iterator<__node_pointer> iterator;
- typedef __forward_list_const_iterator<__node_pointer> const_iterator;
-
- _LIBCPP_HIDE_FROM_ABI
- __forward_list_base()
- _NOEXCEPT_(is_nothrow_default_constructible<__node_allocator>::value)
- : __before_begin_(__begin_node(), __default_init_tag()) {}
- _LIBCPP_HIDE_FROM_ABI
- explicit __forward_list_base(const allocator_type& __a)
- : __before_begin_(__begin_node(), __node_allocator(__a)) {}
- _LIBCPP_HIDE_FROM_ABI
- explicit __forward_list_base(const __node_allocator& __a)
- : __before_begin_(__begin_node(), __a) {}
+ typedef _Tp value_type;
+ typedef _Alloc allocator_type;
+
+ typedef typename allocator_traits<allocator_type>::void_pointer void_pointer;
+ typedef __forward_list_node<value_type, void_pointer> __node_type;
+ typedef __begin_node_of<value_type, void_pointer> __begin_node;
+ typedef __rebind_alloc<allocator_traits<allocator_type>, __node_type> __node_allocator;
+ typedef allocator_traits<__node_allocator> __node_traits;
+ typedef typename __node_traits::pointer __node_pointer;
+
+ typedef __rebind_alloc<allocator_traits<allocator_type>, __begin_node> __begin_node_allocator;
+ typedef typename allocator_traits<__begin_node_allocator>::pointer __begin_node_pointer;
+
+ __compressed_pair<__begin_node, __node_allocator> __before_begin_;
+
+ _LIBCPP_HIDE_FROM_ABI __begin_node_pointer __before_begin() _NOEXCEPT {
+ return pointer_traits<__begin_node_pointer>::pointer_to(__before_begin_.first());
+ }
+ _LIBCPP_HIDE_FROM_ABI __begin_node_pointer __before_begin() const _NOEXCEPT {
+ return pointer_traits<__begin_node_pointer>::pointer_to(const_cast<__begin_node&>(__before_begin_.first()));
+ }
+
+ _LIBCPP_HIDE_FROM_ABI __node_allocator& __alloc() _NOEXCEPT { return __before_begin_.second(); }
+ _LIBCPP_HIDE_FROM_ABI const __node_allocator& __alloc() const _NOEXCEPT { return __before_begin_.second(); }
+
+ typedef __forward_list_iterator<__node_pointer> iterator;
+ typedef __forward_list_const_iterator<__node_pointer> const_iterator;
+
+ _LIBCPP_HIDE_FROM_ABI __forward_list_base() _NOEXCEPT_(is_nothrow_default_constructible<__node_allocator>::value)
+ : __before_begin_(__begin_node(), __default_init_tag()) {}
+ _LIBCPP_HIDE_FROM_ABI explicit __forward_list_base(const allocator_type& __a)
+ : __before_begin_(__begin_node(), __node_allocator(__a)) {}
+ _LIBCPP_HIDE_FROM_ABI explicit __forward_list_base(const __node_allocator& __a)
+ : __before_begin_(__begin_node(), __a) {}
#ifndef _LIBCPP_CXX03_LANG
+
public:
- _LIBCPP_HIDE_FROM_ABI
- __forward_list_base(__forward_list_base&& __x)
- _NOEXCEPT_(is_nothrow_move_constructible<__node_allocator>::value);
- _LIBCPP_HIDE_FROM_ABI
- __forward_list_base(__forward_list_base&& __x, const allocator_type& __a);
+ _LIBCPP_HIDE_FROM_ABI __forward_list_base(__forward_list_base&& __x)
+ _NOEXCEPT_(is_nothrow_move_constructible<__node_allocator>::value);
+ _LIBCPP_HIDE_FROM_ABI __forward_list_base(__forward_list_base&& __x, const allocator_type& __a);
#endif // _LIBCPP_CXX03_LANG
private:
- __forward_list_base(const __forward_list_base&);
- __forward_list_base& operator=(const __forward_list_base&);
+ __forward_list_base(const __forward_list_base&);
+ __forward_list_base& operator=(const __forward_list_base&);
public:
- _LIBCPP_HIDE_FROM_ABI ~__forward_list_base();
+ _LIBCPP_HIDE_FROM_ABI ~__forward_list_base();
protected:
- _LIBCPP_HIDE_FROM_ABI
- void __copy_assign_alloc(const __forward_list_base& __x)
- {__copy_assign_alloc(__x, integral_constant<bool,
- __node_traits::propagate_on_container_copy_assignment::value>());}
-
- _LIBCPP_HIDE_FROM_ABI
- void __move_assign_alloc(__forward_list_base& __x)
- _NOEXCEPT_(!__node_traits::propagate_on_container_move_assignment::value ||
- is_nothrow_move_assignable<__node_allocator>::value)
- {__move_assign_alloc(__x, integral_constant<bool,
- __node_traits::propagate_on_container_move_assignment::value>());}
-
- template <class ..._Args>
- _LIBCPP_HIDE_FROM_ABI __node_pointer __create_node(__node_pointer __next, _Args&& ...__args) {
- __node_allocator& __a = __alloc();
- __allocation_guard<__node_allocator> __guard(__a, 1);
- // Begin the lifetime of the node itself. Note that this doesn't begin the lifetime of the value
- // held inside the node, since we need to use the allocator's construct() method for that.
- //
- // We don't use the allocator's construct() method to construct the node itself since the
- // Cpp17FooInsertable named requirements don't require the allocator's construct() method
- // to work on anything other than the value_type.
- std::__construct_at(std::addressof(*__guard.__get()), __next);
-
- // Now construct the value_type using the allocator's construct() method.
- __node_traits::construct(__a, std::addressof(__guard.__get()->__get_value()), std::forward<_Args>(__args)...);
- return __guard.__release_ptr();
- }
+ _LIBCPP_HIDE_FROM_ABI void __copy_assign_alloc(const __forward_list_base& __x) {
+ __copy_assign_alloc(__x, integral_constant<bool, __node_traits::propagate_on_container_copy_assignment::value>());
+ }
- template <class ..._Args>
- _LIBCPP_HIDE_FROM_ABI void __delete_node(__node_pointer __node) {
- // For the same reason as above, we use the allocator's destroy() method for the value_type,
- // but not for the node itself.
- __node_allocator& __a = __alloc();
- __node_traits::destroy(__a, std::addressof(__node->__get_value()));
- std::__destroy_at(std::addressof(*__node));
- __node_traits::deallocate(__a, __node, 1);
- }
+ _LIBCPP_HIDE_FROM_ABI void __move_assign_alloc(__forward_list_base& __x)
+ _NOEXCEPT_(!__node_traits::propagate_on_container_move_assignment::value ||
+ is_nothrow_move_assignable<__node_allocator>::value) {
+ __move_assign_alloc(__x, integral_constant<bool, __node_traits::propagate_on_container_move_assignment::value>());
+ }
+
+ template <class... _Args>
+ _LIBCPP_HIDE_FROM_ABI __node_pointer __create_node(__node_pointer __next, _Args&&... __args) {
+ __node_allocator& __a = __alloc();
+ __allocation_guard<__node_allocator> __guard(__a, 1);
+ // Begin the lifetime of the node itself. Note that this doesn't begin the lifetime of the value
+ // held inside the node, since we need to use the allocator's construct() method for that.
+ //
+ // We don't use the allocator's construct() method to construct the node itself since the
+ // Cpp17FooInsertable named requirements don't require the allocator's construct() method
+ // to work on anything other than the value_type.
+ std::__construct_at(std::addressof(*__guard.__get()), __next);
+
+ // Now construct the value_type using the allocator's construct() method.
+ __node_traits::construct(__a, std::addressof(__guard.__get()->__get_value()), std::forward<_Args>(__args)...);
+ return __guard.__release_ptr();
+ }
+
+ template <class... _Args>
+ _LIBCPP_HIDE_FROM_ABI void __delete_node(__node_pointer __node) {
+ // For the same reason as above, we use the allocator's destroy() method for the value_type,
+ // but not for the node itself.
+ __node_allocator& __a = __alloc();
+ __node_traits::destroy(__a, std::addressof(__node->__get_value()));
+ std::__destroy_at(std::addressof(*__node));
+ __node_traits::deallocate(__a, __node, 1);
+ }
public:
- _LIBCPP_HIDE_FROM_ABI
- void swap(__forward_list_base& __x)
+ _LIBCPP_HIDE_FROM_ABI void swap(__forward_list_base& __x)
#if _LIBCPP_STD_VER >= 14
- _NOEXCEPT;
+ _NOEXCEPT;
#else
- _NOEXCEPT_(!__node_traits::propagate_on_container_swap::value ||
- __is_nothrow_swappable<__node_allocator>::value);
+ _NOEXCEPT_(!__node_traits::propagate_on_container_swap::value || __is_nothrow_swappable<__node_allocator>::value);
#endif
+
protected:
- _LIBCPP_HIDE_FROM_ABI void clear() _NOEXCEPT;
+ _LIBCPP_HIDE_FROM_ABI void clear() _NOEXCEPT;
private:
- _LIBCPP_HIDE_FROM_ABI
- void __copy_assign_alloc(const __forward_list_base&, false_type) {}
- _LIBCPP_HIDE_FROM_ABI
- void __copy_assign_alloc(const __forward_list_base& __x, true_type)
- {
- if (__alloc() != __x.__alloc())
- clear();
- __alloc() = __x.__alloc();
- }
+ _LIBCPP_HIDE_FROM_ABI void __copy_assign_alloc(const __forward_list_base&, false_type) {}
+ _LIBCPP_HIDE_FROM_ABI void __copy_assign_alloc(const __forward_list_base& __x, true_type) {
+ if (__alloc() != __x.__alloc())
+ clear();
+ __alloc() = __x.__alloc();
+ }
- _LIBCPP_HIDE_FROM_ABI
- void __move_assign_alloc(__forward_list_base&, false_type) _NOEXCEPT
- {}
- _LIBCPP_HIDE_FROM_ABI
- void __move_assign_alloc(__forward_list_base& __x, true_type)
- _NOEXCEPT_(is_nothrow_move_assignable<__node_allocator>::value)
- {__alloc() = std::move(__x.__alloc());}
+ _LIBCPP_HIDE_FROM_ABI void __move_assign_alloc(__forward_list_base&, false_type) _NOEXCEPT {}
+ _LIBCPP_HIDE_FROM_ABI void __move_assign_alloc(__forward_list_base& __x, true_type)
+ _NOEXCEPT_(is_nothrow_move_assignable<__node_allocator>::value) {
+ __alloc() = std::move(__x.__alloc());
+ }
};
#ifndef _LIBCPP_CXX03_LANG
template <class _Tp, class _Alloc>
-inline
-__forward_list_base<_Tp, _Alloc>::__forward_list_base(__forward_list_base&& __x)
- _NOEXCEPT_(is_nothrow_move_constructible<__node_allocator>::value)
- : __before_begin_(std::move(__x.__before_begin_))
-{
- __x.__before_begin()->__next_ = nullptr;
+inline __forward_list_base<_Tp, _Alloc>::__forward_list_base(__forward_list_base&& __x)
+ _NOEXCEPT_(is_nothrow_move_constructible<__node_allocator>::value)
+ : __before_begin_(std::move(__x.__before_begin_)) {
+ __x.__before_begin()->__next_ = nullptr;
}
template <class _Tp, class _Alloc>
-inline
-__forward_list_base<_Tp, _Alloc>::__forward_list_base(__forward_list_base&& __x,
- const allocator_type& __a)
- : __before_begin_(__begin_node(), __node_allocator(__a))
-{
- if (__alloc() == __x.__alloc())
- {
- __before_begin()->__next_ = __x.__before_begin()->__next_;
- __x.__before_begin()->__next_ = nullptr;
- }
+inline __forward_list_base<_Tp, _Alloc>::__forward_list_base(__forward_list_base&& __x, const allocator_type& __a)
+ : __before_begin_(__begin_node(), __node_allocator(__a)) {
+ if (__alloc() == __x.__alloc()) {
+ __before_begin()->__next_ = __x.__before_begin()->__next_;
+ __x.__before_begin()->__next_ = nullptr;
+ }
}
#endif // _LIBCPP_CXX03_LANG
template <class _Tp, class _Alloc>
-__forward_list_base<_Tp, _Alloc>::~__forward_list_base()
-{
- clear();
+__forward_list_base<_Tp, _Alloc>::~__forward_list_base() {
+ clear();
}
template <class _Tp, class _Alloc>
-inline
-void
-__forward_list_base<_Tp, _Alloc>::swap(__forward_list_base& __x)
+inline void __forward_list_base<_Tp, _Alloc>::swap(__forward_list_base& __x)
#if _LIBCPP_STD_VER >= 14
- _NOEXCEPT
+ _NOEXCEPT
#else
- _NOEXCEPT_(!__node_traits::propagate_on_container_swap::value ||
- __is_nothrow_swappable<__node_allocator>::value)
+ _NOEXCEPT_(!__node_traits::propagate_on_container_swap::value || __is_nothrow_swappable<__node_allocator>::value)
#endif
{
- std::__swap_allocator(__alloc(), __x.__alloc(),
- integral_constant<bool, __node_traits::propagate_on_container_swap::value>());
- using std::swap;
- swap(__before_begin()->__next_, __x.__before_begin()->__next_);
+ std::__swap_allocator(
+ __alloc(), __x.__alloc(), integral_constant<bool, __node_traits::propagate_on_container_swap::value>());
+ using std::swap;
+ swap(__before_begin()->__next_, __x.__before_begin()->__next_);
}
template <class _Tp, class _Alloc>
-void
-__forward_list_base<_Tp, _Alloc>::clear() _NOEXCEPT
-{
- for (__node_pointer __p = __before_begin()->__next_; __p != nullptr;)
- {
- __node_pointer __next = __p->__next_;
- __delete_node(__p);
- __p = __next;
- }
- __before_begin()->__next_ = nullptr;
+void __forward_list_base<_Tp, _Alloc>::clear() _NOEXCEPT {
+ for (__node_pointer __p = __before_begin()->__next_; __p != nullptr;) {
+ __node_pointer __next = __p->__next_;
+ __delete_node(__p);
+ __p = __next;
+ }
+ __before_begin()->__next_ = nullptr;
}
template <class _Tp, class _Alloc /*= allocator<_Tp>*/>
-class _LIBCPP_TEMPLATE_VIS forward_list
- : private __forward_list_base<_Tp, _Alloc>
-{
- typedef __forward_list_base<_Tp, _Alloc> base;
- typedef typename base::__node_allocator __node_allocator;
- typedef typename base::__node_type __node_type;
- typedef typename base::__node_traits __node_traits;
- typedef typename base::__node_pointer __node_pointer;
- typedef typename base::__begin_node_pointer __begin_node_pointer;
+class _LIBCPP_TEMPLATE_VIS forward_list : private __forward_list_base<_Tp, _Alloc> {
+ typedef __forward_list_base<_Tp, _Alloc> base;
+ typedef typename base::__node_allocator __node_allocator;
+ typedef typename base::__node_type __node_type;
+ typedef typename base::__node_traits __node_traits;
+ typedef typename base::__node_pointer __node_pointer;
+ typedef typename base::__begin_node_pointer __begin_node_pointer;
public:
- typedef _Tp value_type;
- typedef _Alloc allocator_type;
+ typedef _Tp value_type;
+ typedef _Alloc allocator_type;
- static_assert(is_same<value_type, typename allocator_type::value_type>::value,
- "Allocator::value_type must be same type as value_type");
+ static_assert(is_same<value_type, typename allocator_type::value_type>::value,
+ "Allocator::value_type must be same type as value_type");
- static_assert(is_same<allocator_type, __rebind_alloc<allocator_traits<allocator_type>, value_type> >::value,
- "[allocator.requirements] states that rebinding an allocator to the same type should result in the "
- "original allocator");
+ static_assert(is_same<allocator_type, __rebind_alloc<allocator_traits<allocator_type>, value_type> >::value,
+ "[allocator.requirements] states that rebinding an allocator to the same type should result in the "
+ "original allocator");
- static_assert((!is_same<allocator_type, __node_allocator>::value),
- "internal allocator type must differ from user-specified "
- "type; otherwise overload resolution breaks");
+ static_assert((!is_same<allocator_type, __node_allocator>::value),
+ "internal allocator type must differ from user-specified "
+ "type; otherwise overload resolution breaks");
- typedef value_type& reference;
- typedef const value_type& const_reference;
- typedef typename allocator_traits<allocator_type>::pointer pointer;
- typedef typename allocator_traits<allocator_type>::const_pointer const_pointer;
- typedef typename allocator_traits<allocator_type>::size_type size_type;
- typedef typename allocator_traits<allocator_type>::difference_type difference_type;
+ typedef value_type& reference;
+ typedef const value_type& const_reference;
+ typedef typename allocator_traits<allocator_type>::pointer pointer;
+ typedef typename allocator_traits<allocator_type>::const_pointer const_pointer;
+ typedef typename allocator_traits<allocator_type>::size_type size_type;
+ typedef typename allocator_traits<allocator_type>::difference_type difference_type;
- typedef typename base::iterator iterator;
- typedef typename base::const_iterator const_iterator;
+ typedef typename base::iterator iterator;
+ typedef typename base::const_iterator const_iterator;
#if _LIBCPP_STD_VER >= 20
- typedef size_type __remove_return_type;
+ typedef size_type __remove_return_type;
#else
- typedef void __remove_return_type;
+ typedef void __remove_return_type;
#endif
- _LIBCPP_HIDE_FROM_ABI
- forward_list()
- _NOEXCEPT_(is_nothrow_default_constructible<__node_allocator>::value)
- {} // = default;
- _LIBCPP_HIDE_FROM_ABI
- explicit forward_list(const allocator_type& __a);
- _LIBCPP_HIDE_FROM_ABI explicit forward_list(size_type __n);
+ _LIBCPP_HIDE_FROM_ABI forward_list() _NOEXCEPT_(is_nothrow_default_constructible<__node_allocator>::value) {
+ } // = default;
+ _LIBCPP_HIDE_FROM_ABI explicit forward_list(const allocator_type& __a);
+ _LIBCPP_HIDE_FROM_ABI explicit forward_list(size_type __n);
#if _LIBCPP_STD_VER >= 14
- _LIBCPP_HIDE_FROM_ABI explicit forward_list(size_type __n, const allocator_type& __a);
+ _LIBCPP_HIDE_FROM_ABI explicit forward_list(size_type __n, const allocator_type& __a);
#endif
- _LIBCPP_HIDE_FROM_ABI forward_list(size_type __n, const value_type& __v);
+ _LIBCPP_HIDE_FROM_ABI forward_list(size_type __n, const value_type& __v);
- template <class = __enable_if_t<__is_allocator<_Alloc>::value> >
- _LIBCPP_HIDE_FROM_ABI forward_list(size_type __n, const value_type& __v, const allocator_type& __a) : base(__a)
- {
- insert_after(cbefore_begin(), __n, __v);
- }
+ template <class = __enable_if_t<__is_allocator<_Alloc>::value> >
+ _LIBCPP_HIDE_FROM_ABI forward_list(size_type __n, const value_type& __v, const allocator_type& __a) : base(__a) {
+ insert_after(cbefore_begin(), __n, __v);
+ }
- template <class _InputIterator>
- _LIBCPP_HIDE_FROM_ABI forward_list(_InputIterator __f, _InputIterator __l,
- __enable_if_t<__has_input_iterator_category<_InputIterator>::value>* = nullptr);
- template <class _InputIterator>
- _LIBCPP_HIDE_FROM_ABI forward_list(_InputIterator __f, _InputIterator __l,
- const allocator_type& __a,
- __enable_if_t<__has_input_iterator_category<_InputIterator>::value>* = nullptr);
+ template <class _InputIterator>
+ _LIBCPP_HIDE_FROM_ABI
+ forward_list(_InputIterator __f,
+ _InputIterator __l,
+ __enable_if_t<__has_input_iterator_category<_InputIterator>::value>* = nullptr);
+ template <class _InputIterator>
+ _LIBCPP_HIDE_FROM_ABI
+ forward_list(_InputIterator __f,
+ _InputIterator __l,
+ const allocator_type& __a,
+ __enable_if_t<__has_input_iterator_category<_InputIterator>::value>* = nullptr);
#if _LIBCPP_STD_VER >= 23
- template <_ContainerCompatibleRange<_Tp> _Range>
- _LIBCPP_HIDE_FROM_ABI forward_list(from_range_t, _Range&& __range,
- const allocator_type& __a = allocator_type()) : base(__a) {
- prepend_range(std::forward<_Range>(__range));
- }
+ template <_ContainerCompatibleRange<_Tp> _Range>
+ _LIBCPP_HIDE_FROM_ABI forward_list(from_range_t, _Range&& __range, const allocator_type& __a = allocator_type())
+ : base(__a) {
+ prepend_range(std::forward<_Range>(__range));
+ }
#endif
- _LIBCPP_HIDE_FROM_ABI forward_list(const forward_list& __x);
- _LIBCPP_HIDE_FROM_ABI forward_list(const forward_list& __x, const __type_identity_t<allocator_type>& __a);
+ _LIBCPP_HIDE_FROM_ABI forward_list(const forward_list& __x);
+ _LIBCPP_HIDE_FROM_ABI forward_list(const forward_list& __x, const __type_identity_t<allocator_type>& __a);
- _LIBCPP_HIDE_FROM_ABI forward_list& operator=(const forward_list& __x);
+ _LIBCPP_HIDE_FROM_ABI forward_list& operator=(const forward_list& __x);
#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI
- forward_list(forward_list&& __x)
- _NOEXCEPT_(is_nothrow_move_constructible<base>::value)
- : base(std::move(__x)) {}
- _LIBCPP_HIDE_FROM_ABI forward_list(forward_list&& __x, const __type_identity_t<allocator_type>& __a);
-
- _LIBCPP_HIDE_FROM_ABI forward_list(initializer_list<value_type> __il);
- _LIBCPP_HIDE_FROM_ABI forward_list(initializer_list<value_type> __il, const allocator_type& __a);
-
- _LIBCPP_HIDE_FROM_ABI
- forward_list& operator=(forward_list&& __x)
- _NOEXCEPT_(
- __node_traits::propagate_on_container_move_assignment::value &&
- is_nothrow_move_assignable<allocator_type>::value);
+ _LIBCPP_HIDE_FROM_ABI forward_list(forward_list&& __x) _NOEXCEPT_(is_nothrow_move_constructible<base>::value)
+ : base(std::move(__x)) {}
+ _LIBCPP_HIDE_FROM_ABI forward_list(forward_list&& __x, const __type_identity_t<allocator_type>& __a);
+
+ _LIBCPP_HIDE_FROM_ABI forward_list(initializer_list<value_type> __il);
+ _LIBCPP_HIDE_FROM_ABI forward_list(initializer_list<value_type> __il, const allocator_type& __a);
+
+ _LIBCPP_HIDE_FROM_ABI forward_list& operator=(forward_list&& __x) _NOEXCEPT_(
+ __node_traits::propagate_on_container_move_assignment::value&& is_nothrow_move_assignable<allocator_type>::value);
- _LIBCPP_HIDE_FROM_ABI
- forward_list& operator=(initializer_list<value_type> __il);
+ _LIBCPP_HIDE_FROM_ABI forward_list& operator=(initializer_list<value_type> __il);
- _LIBCPP_HIDE_FROM_ABI
- void assign(initializer_list<value_type> __il);
+ _LIBCPP_HIDE_FROM_ABI void assign(initializer_list<value_type> __il);
#endif // _LIBCPP_CXX03_LANG
- // ~forward_list() = default;
+ // ~forward_list() = default;
- template <class _InputIterator, __enable_if_t<__has_input_iterator_category<_InputIterator>::value, int> = 0>
- void
- _LIBCPP_HIDE_FROM_ABI assign(_InputIterator __f, _InputIterator __l);
+ template <class _InputIterator, __enable_if_t<__has_input_iterator_category<_InputIterator>::value, int> = 0>
+ void _LIBCPP_HIDE_FROM_ABI assign(_InputIterator __f, _InputIterator __l);
#if _LIBCPP_STD_VER >= 23
- template <_ContainerCompatibleRange<_Tp> _Range>
- _LIBCPP_HIDE_FROM_ABI
- void assign_range(_Range&& __range) {
- __assign_with_sentinel(ranges::begin(__range), ranges::end(__range));
- }
+ template <_ContainerCompatibleRange<_Tp> _Range>
+ _LIBCPP_HIDE_FROM_ABI void assign_range(_Range&& __range) {
+ __assign_with_sentinel(ranges::begin(__range), ranges::end(__range));
+ }
#endif
- _LIBCPP_HIDE_FROM_ABI void assign(size_type __n, const value_type& __v);
-
- _LIBCPP_HIDE_FROM_ABI
- allocator_type get_allocator() const _NOEXCEPT
- {return allocator_type(base::__alloc());}
-
- _LIBCPP_HIDE_FROM_ABI
- iterator begin() _NOEXCEPT
- {return iterator(base::__before_begin()->__next_);}
- _LIBCPP_HIDE_FROM_ABI
- const_iterator begin() const _NOEXCEPT
- {return const_iterator(base::__before_begin()->__next_);}
- _LIBCPP_HIDE_FROM_ABI
- iterator end() _NOEXCEPT
- {return iterator(nullptr);}
- _LIBCPP_HIDE_FROM_ABI
- const_iterator end() const _NOEXCEPT
- {return const_iterator(nullptr);}
-
- _LIBCPP_HIDE_FROM_ABI
- const_iterator cbegin() const _NOEXCEPT
- {return const_iterator(base::__before_begin()->__next_);}
- _LIBCPP_HIDE_FROM_ABI
- const_iterator cend() const _NOEXCEPT
- {return const_iterator(nullptr);}
-
- _LIBCPP_HIDE_FROM_ABI
- iterator before_begin() _NOEXCEPT
- {return iterator(base::__before_begin());}
- _LIBCPP_HIDE_FROM_ABI
- const_iterator before_begin() const _NOEXCEPT
- {return const_iterator(base::__before_begin());}
- _LIBCPP_HIDE_FROM_ABI
- const_iterator cbefore_begin() const _NOEXCEPT
- {return const_iterator(base::__before_begin());}
-
- _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_HIDE_FROM_ABI
- bool empty() const _NOEXCEPT
- {return base::__before_begin()->__next_ == nullptr;}
- _LIBCPP_HIDE_FROM_ABI
- size_type max_size() const _NOEXCEPT {
- return std::min<size_type>(
- __node_traits::max_size(base::__alloc()),
- numeric_limits<difference_type>::max());
- }
+ _LIBCPP_HIDE_FROM_ABI void assign(size_type __n, const value_type& __v);
+
+ _LIBCPP_HIDE_FROM_ABI allocator_type get_allocator() const _NOEXCEPT { return allocator_type(base::__alloc()); }
- _LIBCPP_HIDE_FROM_ABI
- reference front() {return base::__before_begin()->__next_->__get_value();}
- _LIBCPP_HIDE_FROM_ABI
- const_reference front() const {return base::__before_begin()->__next_->__get_value();}
+ _LIBCPP_HIDE_FROM_ABI iterator begin() _NOEXCEPT { return iterator(base::__before_begin()->__next_); }
+ _LIBCPP_HIDE_FROM_ABI const_iterator begin() const _NOEXCEPT {
+ return const_iterator(base::__before_begin()->__next_);
+ }
+ _LIBCPP_HIDE_FROM_ABI iterator end() _NOEXCEPT { return iterator(nullptr); }
+ _LIBCPP_HIDE_FROM_ABI const_iterator end() const _NOEXCEPT { return const_iterator(nullptr); }
+
+ _LIBCPP_HIDE_FROM_ABI const_iterator cbegin() const _NOEXCEPT {
+ return const_iterator(base::__before_begin()->__next_);
+ }
+ _LIBCPP_HIDE_FROM_ABI const_iterator cend() const _NOEXCEPT { return const_iterator(nullptr); }
+
+ _LIBCPP_HIDE_FROM_ABI iterator before_begin() _NOEXCEPT { return iterator(base::__before_begin()); }
+ _LIBCPP_HIDE_FROM_ABI const_iterator before_begin() const _NOEXCEPT { return const_iterator(base::__before_begin()); }
+ _LIBCPP_HIDE_FROM_ABI const_iterator cbefore_begin() const _NOEXCEPT {
+ return const_iterator(base::__before_begin());
+ }
+
+ _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_HIDE_FROM_ABI bool empty() const _NOEXCEPT {
+ return base::__before_begin()->__next_ == nullptr;
+ }
+ _LIBCPP_HIDE_FROM_ABI size_type max_size() const _NOEXCEPT {
+ return std::min<size_type>(__node_traits::max_size(base::__alloc()), numeric_limits<difference_type>::max());
+ }
+
+ _LIBCPP_HIDE_FROM_ABI reference front() { return base::__before_begin()->__next_->__get_value(); }
+ _LIBCPP_HIDE_FROM_ABI const_reference front() const { return base::__before_begin()->__next_->__get_value(); }
#ifndef _LIBCPP_CXX03_LANG
-#if _LIBCPP_STD_VER >= 17
- template <class... _Args>
- _LIBCPP_HIDE_FROM_ABI reference emplace_front(_Args&&... __args);
-#else
- template <class... _Args>
- _LIBCPP_HIDE_FROM_ABI void emplace_front(_Args&&... __args);
-#endif
- _LIBCPP_HIDE_FROM_ABI void push_front(value_type&& __v);
+# if _LIBCPP_STD_VER >= 17
+ template <class... _Args>
+ _LIBCPP_HIDE_FROM_ABI reference emplace_front(_Args&&... __args);
+# else
+ template <class... _Args>
+ _LIBCPP_HIDE_FROM_ABI void emplace_front(_Args&&... __args);
+# endif
+ _LIBCPP_HIDE_FROM_ABI void push_front(value_type&& __v);
#endif // _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI void push_front(const value_type& __v);
+ _LIBCPP_HIDE_FROM_ABI void push_front(const value_type& __v);
#if _LIBCPP_STD_VER >= 23
- template <_ContainerCompatibleRange<_Tp> _Range>
- _LIBCPP_HIDE_FROM_ABI
- void prepend_range(_Range&& __range) {
- insert_range_after(cbefore_begin(), std::forward<_Range>(__range));
- }
+ template <_ContainerCompatibleRange<_Tp> _Range>
+ _LIBCPP_HIDE_FROM_ABI void prepend_range(_Range&& __range) {
+ insert_range_after(cbefore_begin(), std::forward<_Range>(__range));
+ }
#endif
- _LIBCPP_HIDE_FROM_ABI void pop_front();
+ _LIBCPP_HIDE_FROM_ABI void pop_front();
#ifndef _LIBCPP_CXX03_LANG
- template <class... _Args>
- _LIBCPP_HIDE_FROM_ABI iterator emplace_after(const_iterator __p, _Args&&... __args);
+ template <class... _Args>
+ _LIBCPP_HIDE_FROM_ABI iterator emplace_after(const_iterator __p, _Args&&... __args);
- _LIBCPP_HIDE_FROM_ABI iterator insert_after(const_iterator __p, value_type&& __v);
- _LIBCPP_HIDE_FROM_ABI iterator insert_after(const_iterator __p, initializer_list<value_type> __il)
- {return insert_after(__p, __il.begin(), __il.end());}
+ _LIBCPP_HIDE_FROM_ABI iterator insert_after(const_iterator __p, value_type&& __v);
+ _LIBCPP_HIDE_FROM_ABI iterator insert_after(const_iterator __p, initializer_list<value_type> __il) {
+ return insert_after(__p, __il.begin(), __il.end());
+ }
#endif // _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI iterator insert_after(const_iterator __p, const value_type& __v);
- _LIBCPP_HIDE_FROM_ABI iterator insert_after(const_iterator __p, size_type __n, const value_type& __v);
- template <class _InputIterator, __enable_if_t<__has_input_iterator_category<_InputIterator>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI
- iterator
- insert_after(const_iterator __p, _InputIterator __f, _InputIterator __l);
+ _LIBCPP_HIDE_FROM_ABI iterator insert_after(const_iterator __p, const value_type& __v);
+ _LIBCPP_HIDE_FROM_ABI iterator insert_after(const_iterator __p, size_type __n, const value_type& __v);
+ template <class _InputIterator, __enable_if_t<__has_input_iterator_category<_InputIterator>::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI iterator insert_after(const_iterator __p, _InputIterator __f, _InputIterator __l);
#if _LIBCPP_STD_VER >= 23
- template <_ContainerCompatibleRange<_Tp> _Range>
- _LIBCPP_HIDE_FROM_ABI
- iterator insert_range_after(const_iterator __position, _Range&& __range) {
- return __insert_after_with_sentinel(__position, ranges::begin(__range), ranges::end(__range));
- }
+ template <_ContainerCompatibleRange<_Tp> _Range>
+ _LIBCPP_HIDE_FROM_ABI iterator insert_range_after(const_iterator __position, _Range&& __range) {
+ return __insert_after_with_sentinel(__position, ranges::begin(__range), ranges::end(__range));
+ }
#endif
- template <class _InputIterator, class _Sentinel>
- _LIBCPP_HIDE_FROM_ABI
- iterator __insert_after_with_sentinel(const_iterator __p, _InputIterator __f, _Sentinel __l);
+ template <class _InputIterator, class _Sentinel>
+ _LIBCPP_HIDE_FROM_ABI iterator __insert_after_with_sentinel(const_iterator __p, _InputIterator __f, _Sentinel __l);
- _LIBCPP_HIDE_FROM_ABI iterator erase_after(const_iterator __p);
- _LIBCPP_HIDE_FROM_ABI iterator erase_after(const_iterator __f, const_iterator __l);
+ _LIBCPP_HIDE_FROM_ABI iterator erase_after(const_iterator __p);
+ _LIBCPP_HIDE_FROM_ABI iterator erase_after(const_iterator __f, const_iterator __l);
- _LIBCPP_HIDE_FROM_ABI
- void swap(forward_list& __x)
+ _LIBCPP_HIDE_FROM_ABI void swap(forward_list& __x)
#if _LIBCPP_STD_VER >= 14
- _NOEXCEPT
+ _NOEXCEPT
#else
- _NOEXCEPT_(!__node_traits::propagate_on_container_swap::value ||
- __is_nothrow_swappable<__node_allocator>::value)
+ _NOEXCEPT_(!__node_traits::propagate_on_container_swap::value || __is_nothrow_swappable<__node_allocator>::value)
#endif
- {base::swap(__x);}
-
- _LIBCPP_HIDE_FROM_ABI void resize(size_type __n);
- _LIBCPP_HIDE_FROM_ABI void resize(size_type __n, const value_type& __v);
- _LIBCPP_HIDE_FROM_ABI
- void clear() _NOEXCEPT {base::clear();}
-
- _LIBCPP_HIDE_FROM_ABI
- void splice_after(const_iterator __p, forward_list&& __x);
- _LIBCPP_HIDE_FROM_ABI
- void splice_after(const_iterator __p, forward_list&& __x, const_iterator __i);
- _LIBCPP_HIDE_FROM_ABI
- void splice_after(const_iterator __p, forward_list&& __x,
- const_iterator __f, const_iterator __l);
- _LIBCPP_HIDE_FROM_ABI void splice_after(const_iterator __p, forward_list& __x);
- _LIBCPP_HIDE_FROM_ABI void splice_after(const_iterator __p, forward_list& __x, const_iterator __i);
- _LIBCPP_HIDE_FROM_ABI void splice_after(const_iterator __p, forward_list& __x,
- const_iterator __f, const_iterator __l);
- _LIBCPP_HIDE_FROM_ABI __remove_return_type remove(const value_type& __v);
- template <class _Predicate>
- _LIBCPP_HIDE_FROM_ABI __remove_return_type remove_if(_Predicate __pred);
- _LIBCPP_HIDE_FROM_ABI
- __remove_return_type unique() { return unique(__equal_to()); }
- template <class _BinaryPredicate>
- _LIBCPP_HIDE_FROM_ABI __remove_return_type unique(_BinaryPredicate __binary_pred);
+ {
+ base::swap(__x);
+ }
+
+ _LIBCPP_HIDE_FROM_ABI void resize(size_type __n);
+ _LIBCPP_HIDE_FROM_ABI void resize(size_type __n, const value_type& __v);
+ _LIBCPP_HIDE_FROM_ABI void clear() _NOEXCEPT { base::clear(); }
+
+ _LIBCPP_HIDE_FROM_ABI void splice_after(const_iterator __p, forward_list&& __x);
+ _LIBCPP_HIDE_FROM_ABI void splice_after(const_iterator __p, forward_list&& __x, const_iterator __i);
+ _LIBCPP_HIDE_FROM_ABI void
+ splice_after(const_iterator __p, forward_list&& __x, const_iterator __f, const_iterator __l);
+ _LIBCPP_HIDE_FROM_ABI void splice_after(const_iterator __p, forward_list& __x);
+ _LIBCPP_HIDE_FROM_ABI void splice_after(const_iterator __p, forward_list& __x, const_iterator __i);
+ _LIBCPP_HIDE_FROM_ABI void
+ splice_after(const_iterator __p, forward_list& __x, const_iterator __f, const_iterator __l);
+ _LIBCPP_HIDE_FROM_ABI __remove_return_type remove(const value_type& __v);
+ template <class _Predicate>
+ _LIBCPP_HIDE_FROM_ABI __remove_return_type remove_if(_Predicate __pred);
+ _LIBCPP_HIDE_FROM_ABI __remove_return_type unique() { return unique(__equal_to()); }
+ template <class _BinaryPredicate>
+ _LIBCPP_HIDE_FROM_ABI __remove_return_type unique(_BinaryPredicate __binary_pred);
#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI
- void merge(forward_list&& __x) {merge(__x, __less<>());}
- template <class _Compare>
- _LIBCPP_HIDE_FROM_ABI
- void merge(forward_list&& __x, _Compare __comp)
- {merge(__x, std::move(__comp));}
+ _LIBCPP_HIDE_FROM_ABI void merge(forward_list&& __x) { merge(__x, __less<>()); }
+ template <class _Compare>
+ _LIBCPP_HIDE_FROM_ABI void merge(forward_list&& __x, _Compare __comp) {
+ merge(__x, std::move(__comp));
+ }
#endif // _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI
- void merge(forward_list& __x) {merge(__x, __less<>());}
- template <class _Compare>
- _LIBCPP_HIDE_FROM_ABI void merge(forward_list& __x, _Compare __comp);
- _LIBCPP_HIDE_FROM_ABI
- void sort() {sort(__less<>());}
- template <class _Compare> _LIBCPP_HIDE_FROM_ABI void sort(_Compare __comp);
- _LIBCPP_HIDE_FROM_ABI void reverse() _NOEXCEPT;
+ _LIBCPP_HIDE_FROM_ABI void merge(forward_list& __x) { merge(__x, __less<>()); }
+ template <class _Compare>
+ _LIBCPP_HIDE_FROM_ABI void merge(forward_list& __x, _Compare __comp);
+ _LIBCPP_HIDE_FROM_ABI void sort() { sort(__less<>()); }
+ template <class _Compare>
+ _LIBCPP_HIDE_FROM_ABI void sort(_Compare __comp);
+ _LIBCPP_HIDE_FROM_ABI void reverse() _NOEXCEPT;
private:
-
#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI void __move_assign(forward_list& __x, true_type)
- _NOEXCEPT_(is_nothrow_move_assignable<allocator_type>::value);
- _LIBCPP_HIDE_FROM_ABI void __move_assign(forward_list& __x, false_type);
+ _LIBCPP_HIDE_FROM_ABI void __move_assign(forward_list& __x, true_type)
+ _NOEXCEPT_(is_nothrow_move_assignable<allocator_type>::value);
+ _LIBCPP_HIDE_FROM_ABI void __move_assign(forward_list& __x, false_type);
#endif // _LIBCPP_CXX03_LANG
- template <class _Iter, class _Sent>
- _LIBCPP_HIDE_FROM_ABI
- void __assign_with_sentinel(_Iter __f, _Sent __l);
+ template <class _Iter, class _Sent>
+ _LIBCPP_HIDE_FROM_ABI void __assign_with_sentinel(_Iter __f, _Sent __l);
- template <class _Compare>
- static _LIBCPP_HIDE_FROM_ABI
- __node_pointer
- __merge(__node_pointer __f1, __node_pointer __f2, _Compare& __comp);
+ template <class _Compare>
+ static _LIBCPP_HIDE_FROM_ABI __node_pointer __merge(__node_pointer __f1, __node_pointer __f2, _Compare& __comp);
- // TODO: Make this _LIBCPP_HIDE_FROM_ABI
- template <class _Compare>
- static _LIBCPP_HIDDEN
- __node_pointer
- __sort(__node_pointer __f, difference_type __sz, _Compare& __comp);
+ // TODO: Make this _LIBCPP_HIDE_FROM_ABI
+ template <class _Compare>
+ static _LIBCPP_HIDDEN __node_pointer __sort(__node_pointer __f, difference_type __sz, _Compare& __comp);
};
-
#if _LIBCPP_STD_VER >= 17
-template<class _InputIterator,
- class _Alloc = allocator<__iter_value_type<_InputIterator>>,
- class = enable_if_t<__has_input_iterator_category<_InputIterator>::value>,
- class = enable_if_t<__is_allocator<_Alloc>::value>
- >
-forward_list(_InputIterator, _InputIterator)
- -> forward_list<__iter_value_type<_InputIterator>, _Alloc>;
-
-template<class _InputIterator,
- class _Alloc,
- class = enable_if_t<__has_input_iterator_category<_InputIterator>::value>,
- class = enable_if_t<__is_allocator<_Alloc>::value>
- >
-forward_list(_InputIterator, _InputIterator, _Alloc)
- -> forward_list<__iter_value_type<_InputIterator>, _Alloc>;
+template <class _InputIterator,
+ class _Alloc = allocator<__iter_value_type<_InputIterator>>,
+ class = enable_if_t<__has_input_iterator_category<_InputIterator>::value>,
+ class = enable_if_t<__is_allocator<_Alloc>::value> >
+forward_list(_InputIterator, _InputIterator) -> forward_list<__iter_value_type<_InputIterator>, _Alloc>;
+
+template <class _InputIterator,
+ class _Alloc,
+ class = enable_if_t<__has_input_iterator_category<_InputIterator>::value>,
+ class = enable_if_t<__is_allocator<_Alloc>::value> >
+forward_list(_InputIterator, _InputIterator, _Alloc) -> forward_list<__iter_value_type<_InputIterator>, _Alloc>;
#endif
#if _LIBCPP_STD_VER >= 23
template <ranges::input_range _Range,
class _Alloc = allocator<ranges::range_value_t<_Range>>,
- class = enable_if_t<__is_allocator<_Alloc>::value>
- >
-forward_list(from_range_t, _Range&&, _Alloc = _Alloc())
- -> forward_list<ranges::range_value_t<_Range>, _Alloc>;
+ class = enable_if_t<__is_allocator<_Alloc>::value> >
+forward_list(from_range_t, _Range&&, _Alloc = _Alloc()) -> forward_list<ranges::range_value_t<_Range>, _Alloc>;
#endif
template <class _Tp, class _Alloc>
-inline
-forward_list<_Tp, _Alloc>::forward_list(const allocator_type& __a)
- : base(__a)
-{
-}
+inline forward_list<_Tp, _Alloc>::forward_list(const allocator_type& __a) : base(__a) {}
template <class _Tp, class _Alloc>
-forward_list<_Tp, _Alloc>::forward_list(size_type __n)
-{
- if (__n > 0)
- {
- for (__begin_node_pointer __p = base::__before_begin(); __n > 0; --__n,
- __p = __p->__next_as_begin())
- {
- __p->__next_ = this->__create_node(/* next = */nullptr);
- }
+forward_list<_Tp, _Alloc>::forward_list(size_type __n) {
+ if (__n > 0) {
+ for (__begin_node_pointer __p = base::__before_begin(); __n > 0; --__n, __p = __p->__next_as_begin()) {
+ __p->__next_ = this->__create_node(/* next = */ nullptr);
}
+ }
}
#if _LIBCPP_STD_VER >= 14
template <class _Tp, class _Alloc>
-forward_list<_Tp, _Alloc>::forward_list(size_type __n,
- const allocator_type& __base_alloc)
- : base ( __base_alloc )
-{
- if (__n > 0)
- {
- for (__begin_node_pointer __p = base::__before_begin(); __n > 0; --__n,
- __p = __p->__next_as_begin())
- {
- __p->__next_ = this->__create_node(/* next = */nullptr);
- }
+forward_list<_Tp, _Alloc>::forward_list(size_type __n, const allocator_type& __base_alloc) : base(__base_alloc) {
+ if (__n > 0) {
+ for (__begin_node_pointer __p = base::__before_begin(); __n > 0; --__n, __p = __p->__next_as_begin()) {
+ __p->__next_ = this->__create_node(/* next = */ nullptr);
}
+ }
}
#endif
template <class _Tp, class _Alloc>
-forward_list<_Tp, _Alloc>::forward_list(size_type __n, const value_type& __v)
-{
- insert_after(cbefore_begin(), __n, __v);
+forward_list<_Tp, _Alloc>::forward_list(size_type __n, const value_type& __v) {
+ insert_after(cbefore_begin(), __n, __v);
}
template <class _Tp, class _Alloc>
template <class _InputIterator>
-forward_list<_Tp, _Alloc>::forward_list(_InputIterator __f, _InputIterator __l,
- __enable_if_t<__has_input_iterator_category<_InputIterator>::value>*)
-{
- insert_after(cbefore_begin(), __f, __l);
+forward_list<_Tp, _Alloc>::forward_list(
+ _InputIterator __f, _InputIterator __l, __enable_if_t<__has_input_iterator_category<_InputIterator>::value>*) {
+ insert_after(cbefore_begin(), __f, __l);
}
template <class _Tp, class _Alloc>
template <class _InputIterator>
-forward_list<_Tp, _Alloc>::forward_list(_InputIterator __f, _InputIterator __l,
- const allocator_type& __a,
- __enable_if_t<__has_input_iterator_category<_InputIterator>::value>*)
- : base(__a)
-{
- insert_after(cbefore_begin(), __f, __l);
+forward_list<_Tp, _Alloc>::forward_list(
+ _InputIterator __f,
+ _InputIterator __l,
+ const allocator_type& __a,
+ __enable_if_t<__has_input_iterator_category<_InputIterator>::value>*)
+ : base(__a) {
+ insert_after(cbefore_begin(), __f, __l);
}
template <class _Tp, class _Alloc>
forward_list<_Tp, _Alloc>::forward_list(const forward_list& __x)
- : base(
- __node_traits::select_on_container_copy_construction(__x.__alloc())) {
+ : base(__node_traits::select_on_container_copy_construction(__x.__alloc())) {
insert_after(cbefore_begin(), __x.begin(), __x.end());
}
template <class _Tp, class _Alloc>
-forward_list<_Tp, _Alloc>::forward_list(const forward_list& __x,
- const __type_identity_t<allocator_type>& __a)
- : base(__a)
-{
- insert_after(cbefore_begin(), __x.begin(), __x.end());
+forward_list<_Tp, _Alloc>::forward_list(const forward_list& __x, const __type_identity_t<allocator_type>& __a)
+ : base(__a) {
+ insert_after(cbefore_begin(), __x.begin(), __x.end());
}
template <class _Tp, class _Alloc>
-forward_list<_Tp, _Alloc>&
-forward_list<_Tp, _Alloc>::operator=(const forward_list& __x)
-{
- if (this != std::addressof(__x))
- {
- base::__copy_assign_alloc(__x);
- assign(__x.begin(), __x.end());
- }
- return *this;
+forward_list<_Tp, _Alloc>& forward_list<_Tp, _Alloc>::operator=(const forward_list& __x) {
+ if (this != std::addressof(__x)) {
+ base::__copy_assign_alloc(__x);
+ assign(__x.begin(), __x.end());
+ }
+ return *this;
}
#ifndef _LIBCPP_CXX03_LANG
template <class _Tp, class _Alloc>
-forward_list<_Tp, _Alloc>::forward_list(forward_list&& __x,
- const __type_identity_t<allocator_type>& __a)
- : base(std::move(__x), __a)
-{
- if (base::__alloc() != __x.__alloc())
- {
- typedef move_iterator<iterator> _Ip;
- insert_after(cbefore_begin(), _Ip(__x.begin()), _Ip(__x.end()));
- }
+forward_list<_Tp, _Alloc>::forward_list(forward_list&& __x, const __type_identity_t<allocator_type>& __a)
+ : base(std::move(__x), __a) {
+ if (base::__alloc() != __x.__alloc()) {
+ typedef move_iterator<iterator> _Ip;
+ insert_after(cbefore_begin(), _Ip(__x.begin()), _Ip(__x.end()));
+ }
}
template <class _Tp, class _Alloc>
-forward_list<_Tp, _Alloc>::forward_list(initializer_list<value_type> __il)
-{
- insert_after(cbefore_begin(), __il.begin(), __il.end());
+forward_list<_Tp, _Alloc>::forward_list(initializer_list<value_type> __il) {
+ insert_after(cbefore_begin(), __il.begin(), __il.end());
}
template <class _Tp, class _Alloc>
-forward_list<_Tp, _Alloc>::forward_list(initializer_list<value_type> __il,
- const allocator_type& __a)
- : base(__a)
-{
- insert_after(cbefore_begin(), __il.begin(), __il.end());
+forward_list<_Tp, _Alloc>::forward_list(initializer_list<value_type> __il, const allocator_type& __a) : base(__a) {
+ insert_after(cbefore_begin(), __il.begin(), __il.end());
}
template <class _Tp, class _Alloc>
-void
-forward_list<_Tp, _Alloc>::__move_assign(forward_list& __x, true_type)
- _NOEXCEPT_(is_nothrow_move_assignable<allocator_type>::value)
-{
- clear();
- base::__move_assign_alloc(__x);
- base::__before_begin()->__next_ = __x.__before_begin()->__next_;
- __x.__before_begin()->__next_ = nullptr;
+void forward_list<_Tp, _Alloc>::__move_assign(forward_list& __x, true_type)
+ _NOEXCEPT_(is_nothrow_move_assignable<allocator_type>::value) {
+ clear();
+ base::__move_assign_alloc(__x);
+ base::__before_begin()->__next_ = __x.__before_begin()->__next_;
+ __x.__before_begin()->__next_ = nullptr;
}
template <class _Tp, class _Alloc>
-void
-forward_list<_Tp, _Alloc>::__move_assign(forward_list& __x, false_type)
-{
- if (base::__alloc() == __x.__alloc())
- __move_assign(__x, true_type());
- else
- {
- typedef move_iterator<iterator> _Ip;
- assign(_Ip(__x.begin()), _Ip(__x.end()));
- }
+void forward_list<_Tp, _Alloc>::__move_assign(forward_list& __x, false_type) {
+ if (base::__alloc() == __x.__alloc())
+ __move_assign(__x, true_type());
+ else {
+ typedef move_iterator<iterator> _Ip;
+ assign(_Ip(__x.begin()), _Ip(__x.end()));
+ }
}
template <class _Tp, class _Alloc>
-inline
-forward_list<_Tp, _Alloc>&
-forward_list<_Tp, _Alloc>::operator=(forward_list&& __x)
- _NOEXCEPT_(
- __node_traits::propagate_on_container_move_assignment::value &&
- is_nothrow_move_assignable<allocator_type>::value)
-{
- __move_assign(__x, integral_constant<bool,
- __node_traits::propagate_on_container_move_assignment::value>());
- return *this;
+inline forward_list<_Tp, _Alloc>& forward_list<_Tp, _Alloc>::operator=(forward_list&& __x) _NOEXCEPT_(
+ __node_traits::propagate_on_container_move_assignment::value&& is_nothrow_move_assignable<allocator_type>::value) {
+ __move_assign(__x, integral_constant<bool, __node_traits::propagate_on_container_move_assignment::value>());
+ return *this;
}
template <class _Tp, class _Alloc>
-inline
-forward_list<_Tp, _Alloc>&
-forward_list<_Tp, _Alloc>::operator=(initializer_list<value_type> __il)
-{
- assign(__il.begin(), __il.end());
- return *this;
+inline forward_list<_Tp, _Alloc>& forward_list<_Tp, _Alloc>::operator=(initializer_list<value_type> __il) {
+ assign(__il.begin(), __il.end());
+ return *this;
}
#endif // _LIBCPP_CXX03_LANG
template <class _Tp, class _Alloc>
template <class _InputIterator, __enable_if_t<__has_input_iterator_category<_InputIterator>::value, int> >
-void
-forward_list<_Tp, _Alloc>::assign(_InputIterator __f, _InputIterator __l)
-{
+void forward_list<_Tp, _Alloc>::assign(_InputIterator __f, _InputIterator __l) {
__assign_with_sentinel(__f, __l);
}
template <class _Tp, class _Alloc>
template <class _Iter, class _Sent>
-_LIBCPP_HIDE_FROM_ABI
-void forward_list<_Tp, _Alloc>::__assign_with_sentinel(_Iter __f, _Sent __l) {
- iterator __i = before_begin();
- iterator __j = std::next(__i);
- iterator __e = end();
- for (; __j != __e && __f != __l; ++__i, (void) ++__j, ++__f)
- *__j = *__f;
- if (__j == __e)
- __insert_after_with_sentinel(__i, std::move(__f), std::move(__l));
- else
- erase_after(__i, __e);
+_LIBCPP_HIDE_FROM_ABI void forward_list<_Tp, _Alloc>::__assign_with_sentinel(_Iter __f, _Sent __l) {
+ iterator __i = before_begin();
+ iterator __j = std::next(__i);
+ iterator __e = end();
+ for (; __j != __e && __f != __l; ++__i, (void)++__j, ++__f)
+ *__j = *__f;
+ if (__j == __e)
+ __insert_after_with_sentinel(__i, std::move(__f), std::move(__l));
+ else
+ erase_after(__i, __e);
}
template <class _Tp, class _Alloc>
-void
-forward_list<_Tp, _Alloc>::assign(size_type __n, const value_type& __v)
-{
- iterator __i = before_begin();
- iterator __j = std::next(__i);
- iterator __e = end();
- for (; __j != __e && __n > 0; --__n, ++__i, ++__j)
- *__j = __v;
- if (__j == __e)
- insert_after(__i, __n, __v);
- else
- erase_after(__i, __e);
+void forward_list<_Tp, _Alloc>::assign(size_type __n, const value_type& __v) {
+ iterator __i = before_begin();
+ iterator __j = std::next(__i);
+ iterator __e = end();
+ for (; __j != __e && __n > 0; --__n, ++__i, ++__j)
+ *__j = __v;
+ if (__j == __e)
+ insert_after(__i, __n, __v);
+ else
+ erase_after(__i, __e);
}
#ifndef _LIBCPP_CXX03_LANG
template <class _Tp, class _Alloc>
-inline
-void
-forward_list<_Tp, _Alloc>::assign(initializer_list<value_type> __il)
-{
- assign(__il.begin(), __il.end());
+inline void forward_list<_Tp, _Alloc>::assign(initializer_list<value_type> __il) {
+ assign(__il.begin(), __il.end());
}
template <class _Tp, class _Alloc>
template <class... _Args>
-#if _LIBCPP_STD_VER >= 17
+# if _LIBCPP_STD_VER >= 17
typename forward_list<_Tp, _Alloc>::reference
-#else
+# else
void
-#endif
-forward_list<_Tp, _Alloc>::emplace_front(_Args&&... __args)
-{
- base::__before_begin()->__next_ = this->__create_node(/* next = */base::__before_begin()->__next_, std::forward<_Args>(__args)...);
-#if _LIBCPP_STD_VER >= 17
- return base::__before_begin()->__next_->__get_value();
-#endif
+# endif
+forward_list<_Tp, _Alloc>::emplace_front(_Args&&... __args) {
+ base::__before_begin()->__next_ =
+ this->__create_node(/* next = */ base::__before_begin()->__next_, std::forward<_Args>(__args)...);
+# if _LIBCPP_STD_VER >= 17
+ return base::__before_begin()->__next_->__get_value();
+# endif
}
template <class _Tp, class _Alloc>
-void
-forward_list<_Tp, _Alloc>::push_front(value_type&& __v)
-{
- base::__before_begin()->__next_ = this->__create_node(/* next = */base::__before_begin()->__next_, std::move(__v));
+void forward_list<_Tp, _Alloc>::push_front(value_type&& __v) {
+ base::__before_begin()->__next_ = this->__create_node(/* next = */ base::__before_begin()->__next_, std::move(__v));
}
#endif // _LIBCPP_CXX03_LANG
template <class _Tp, class _Alloc>
-void
-forward_list<_Tp, _Alloc>::push_front(const value_type& __v)
-{
- base::__before_begin()->__next_ = this->__create_node(/* next = */base::__before_begin()->__next_, __v);
+void forward_list<_Tp, _Alloc>::push_front(const value_type& __v) {
+ base::__before_begin()->__next_ = this->__create_node(/* next = */ base::__before_begin()->__next_, __v);
}
template <class _Tp, class _Alloc>
-void
-forward_list<_Tp, _Alloc>::pop_front()
-{
- __node_pointer __p = base::__before_begin()->__next_;
- base::__before_begin()->__next_ = __p->__next_;
- this->__delete_node(__p);
+void forward_list<_Tp, _Alloc>::pop_front() {
+ __node_pointer __p = base::__before_begin()->__next_;
+ base::__before_begin()->__next_ = __p->__next_;
+ this->__delete_node(__p);
}
#ifndef _LIBCPP_CXX03_LANG
@@ -1292,544 +1109,427 @@ forward_list<_Tp, _Alloc>::pop_front()
template <class _Tp, class _Alloc>
template <class... _Args>
typename forward_list<_Tp, _Alloc>::iterator
-forward_list<_Tp, _Alloc>::emplace_after(const_iterator __p, _Args&&... __args)
-{
- __begin_node_pointer const __r = __p.__get_begin();
- __r->__next_ = this->__create_node(/* next = */__r->__next_, std::forward<_Args>(__args)...);
- return iterator(__r->__next_);
+forward_list<_Tp, _Alloc>::emplace_after(const_iterator __p, _Args&&... __args) {
+ __begin_node_pointer const __r = __p.__get_begin();
+ __r->__next_ = this->__create_node(/* next = */ __r->__next_, std::forward<_Args>(__args)...);
+ return iterator(__r->__next_);
}
template <class _Tp, class _Alloc>
typename forward_list<_Tp, _Alloc>::iterator
-forward_list<_Tp, _Alloc>::insert_after(const_iterator __p, value_type&& __v)
-{
- __begin_node_pointer const __r = __p.__get_begin();
- __r->__next_ = this->__create_node(/* next = */__r->__next_, std::move(__v));
- return iterator(__r->__next_);
+forward_list<_Tp, _Alloc>::insert_after(const_iterator __p, value_type&& __v) {
+ __begin_node_pointer const __r = __p.__get_begin();
+ __r->__next_ = this->__create_node(/* next = */ __r->__next_, std::move(__v));
+ return iterator(__r->__next_);
}
#endif // _LIBCPP_CXX03_LANG
template <class _Tp, class _Alloc>
typename forward_list<_Tp, _Alloc>::iterator
-forward_list<_Tp, _Alloc>::insert_after(const_iterator __p, const value_type& __v)
-{
- __begin_node_pointer const __r = __p.__get_begin();
- __r->__next_ = this->__create_node(/* next = */__r->__next_, __v);
- return iterator(__r->__next_);
+forward_list<_Tp, _Alloc>::insert_after(const_iterator __p, const value_type& __v) {
+ __begin_node_pointer const __r = __p.__get_begin();
+ __r->__next_ = this->__create_node(/* next = */ __r->__next_, __v);
+ return iterator(__r->__next_);
}
template <class _Tp, class _Alloc>
typename forward_list<_Tp, _Alloc>::iterator
-forward_list<_Tp, _Alloc>::insert_after(const_iterator __p, size_type __n,
- const value_type& __v)
-{
- __begin_node_pointer __r = __p.__get_begin();
- if (__n > 0)
- {
- __node_pointer __first = this->__create_node(/* next = */nullptr, __v);
- __node_pointer __last = __first;
+forward_list<_Tp, _Alloc>::insert_after(const_iterator __p, size_type __n, const value_type& __v) {
+ __begin_node_pointer __r = __p.__get_begin();
+ if (__n > 0) {
+ __node_pointer __first = this->__create_node(/* next = */ nullptr, __v);
+ __node_pointer __last = __first;
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- try
- {
+ try {
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- for (--__n; __n != 0; --__n, __last = __last->__next_)
- {
- __last->__next_ = this->__create_node(/* next = */nullptr, __v);
- }
+ for (--__n; __n != 0; --__n, __last = __last->__next_) {
+ __last->__next_ = this->__create_node(/* next = */ nullptr, __v);
+ }
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- }
- catch (...)
- {
- while (__first != nullptr)
- {
- __node_pointer __next = __first->__next_;
- this->__delete_node(__first);
- __first = __next;
- }
- throw;
- }
-#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- __last->__next_ = __r->__next_;
- __r->__next_ = __first;
- __r = static_cast<__begin_node_pointer>(__last);
+ } catch (...) {
+ while (__first != nullptr) {
+ __node_pointer __next = __first->__next_;
+ this->__delete_node(__first);
+ __first = __next;
+ }
+ throw;
}
- return iterator(__r);
+#endif // _LIBCPP_HAS_NO_EXCEPTIONS
+ __last->__next_ = __r->__next_;
+ __r->__next_ = __first;
+ __r = static_cast<__begin_node_pointer>(__last);
+ }
+ return iterator(__r);
}
template <class _Tp, class _Alloc>
template <class _InputIterator, __enable_if_t<__has_input_iterator_category<_InputIterator>::value, int> >
typename forward_list<_Tp, _Alloc>::iterator
-forward_list<_Tp, _Alloc>::insert_after(const_iterator __p,
- _InputIterator __f, _InputIterator __l)
-{
+forward_list<_Tp, _Alloc>::insert_after(const_iterator __p, _InputIterator __f, _InputIterator __l) {
return __insert_after_with_sentinel(__p, std::move(__f), std::move(__l));
}
template <class _Tp, class _Alloc>
template <class _InputIterator, class _Sentinel>
-_LIBCPP_HIDE_FROM_ABI
-typename forward_list<_Tp, _Alloc>::iterator
+_LIBCPP_HIDE_FROM_ABI typename forward_list<_Tp, _Alloc>::iterator
forward_list<_Tp, _Alloc>::__insert_after_with_sentinel(const_iterator __p, _InputIterator __f, _Sentinel __l) {
- __begin_node_pointer __r = __p.__get_begin();
+ __begin_node_pointer __r = __p.__get_begin();
- if (__f != __l)
- {
- __node_pointer __first = this->__create_node(/* next = */nullptr, *__f);
- __node_pointer __last = __first;
+ if (__f != __l) {
+ __node_pointer __first = this->__create_node(/* next = */ nullptr, *__f);
+ __node_pointer __last = __first;
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- try
- {
+ try {
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- for (++__f; __f != __l; ++__f, ((void)(__last = __last->__next_)))
- {
- __last->__next_ = this->__create_node(/* next = */nullptr, *__f);
- }
+ for (++__f; __f != __l; ++__f, ((void)(__last = __last->__next_))) {
+ __last->__next_ = this->__create_node(/* next = */ nullptr, *__f);
+ }
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- }
- catch (...)
- {
- while (__first != nullptr)
- {
- __node_pointer __next = __first->__next_;
- this->__delete_node(__first);
- __first = __next;
- }
- throw;
- }
+ } catch (...) {
+ while (__first != nullptr) {
+ __node_pointer __next = __first->__next_;
+ this->__delete_node(__first);
+ __first = __next;
+ }
+ throw;
+ }
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- __last->__next_ = __r->__next_;
- __r->__next_ = __first;
- __r = static_cast<__begin_node_pointer>(__last);
- }
+ __last->__next_ = __r->__next_;
+ __r->__next_ = __first;
+ __r = static_cast<__begin_node_pointer>(__last);
+ }
- return iterator(__r);
+ return iterator(__r);
}
template <class _Tp, class _Alloc>
-typename forward_list<_Tp, _Alloc>::iterator
-forward_list<_Tp, _Alloc>::erase_after(const_iterator __f)
-{
- __begin_node_pointer __p = __f.__get_begin();
- __node_pointer __n = __p->__next_;
- __p->__next_ = __n->__next_;
- this->__delete_node(__n);
- return iterator(__p->__next_);
+typename forward_list<_Tp, _Alloc>::iterator forward_list<_Tp, _Alloc>::erase_after(const_iterator __f) {
+ __begin_node_pointer __p = __f.__get_begin();
+ __node_pointer __n = __p->__next_;
+ __p->__next_ = __n->__next_;
+ this->__delete_node(__n);
+ return iterator(__p->__next_);
}
template <class _Tp, class _Alloc>
typename forward_list<_Tp, _Alloc>::iterator
-forward_list<_Tp, _Alloc>::erase_after(const_iterator __f, const_iterator __l)
-{
- __node_pointer __e = __l.__get_unsafe_node_pointer();
- if (__f != __l)
- {
- __begin_node_pointer __bp = __f.__get_begin();
-
- __node_pointer __n = __bp->__next_;
- if (__n != __e)
- {
- __bp->__next_ = __e;
- do
- {
- __node_pointer __tmp = __n->__next_;
- this->__delete_node(__n);
- __n = __tmp;
- } while (__n != __e);
- }
+forward_list<_Tp, _Alloc>::erase_after(const_iterator __f, const_iterator __l) {
+ __node_pointer __e = __l.__get_unsafe_node_pointer();
+ if (__f != __l) {
+ __begin_node_pointer __bp = __f.__get_begin();
+
+ __node_pointer __n = __bp->__next_;
+ if (__n != __e) {
+ __bp->__next_ = __e;
+ do {
+ __node_pointer __tmp = __n->__next_;
+ this->__delete_node(__n);
+ __n = __tmp;
+ } while (__n != __e);
}
- return iterator(__e);
+ }
+ return iterator(__e);
}
template <class _Tp, class _Alloc>
-void
-forward_list<_Tp, _Alloc>::resize(size_type __n)
-{
- size_type __sz = 0;
- iterator __p = before_begin();
- iterator __i = begin();
- iterator __e = end();
- for (; __i != __e && __sz < __n; ++__p, ++__i, ++__sz)
- ;
- if (__i != __e)
- erase_after(__p, __e);
- else
- {
- __n -= __sz;
- if (__n > 0)
- {
- for (__begin_node_pointer __ptr = __p.__get_begin(); __n > 0; --__n,
- __ptr = __ptr->__next_as_begin())
- {
- __ptr->__next_ = this->__create_node(/* next = */nullptr);
- }
- }
+void forward_list<_Tp, _Alloc>::resize(size_type __n) {
+ size_type __sz = 0;
+ iterator __p = before_begin();
+ iterator __i = begin();
+ iterator __e = end();
+ for (; __i != __e && __sz < __n; ++__p, ++__i, ++__sz)
+ ;
+ if (__i != __e)
+ erase_after(__p, __e);
+ else {
+ __n -= __sz;
+ if (__n > 0) {
+ for (__begin_node_pointer __ptr = __p.__get_begin(); __n > 0; --__n, __ptr = __ptr->__next_as_begin()) {
+ __ptr->__next_ = this->__create_node(/* next = */ nullptr);
+ }
}
+ }
}
template <class _Tp, class _Alloc>
-void
-forward_list<_Tp, _Alloc>::resize(size_type __n, const value_type& __v)
-{
- size_type __sz = 0;
- iterator __p = before_begin();
- iterator __i = begin();
- iterator __e = end();
- for (; __i != __e && __sz < __n; ++__p, ++__i, ++__sz)
- ;
- if (__i != __e)
- erase_after(__p, __e);
- else
- {
- __n -= __sz;
- if (__n > 0)
- {
- for (__begin_node_pointer __ptr = __p.__get_begin(); __n > 0; --__n,
- __ptr = __ptr->__next_as_begin())
- {
- __ptr->__next_ = this->__create_node(/* next = */nullptr, __v);
- }
- }
+void forward_list<_Tp, _Alloc>::resize(size_type __n, const value_type& __v) {
+ size_type __sz = 0;
+ iterator __p = before_begin();
+ iterator __i = begin();
+ iterator __e = end();
+ for (; __i != __e && __sz < __n; ++__p, ++__i, ++__sz)
+ ;
+ if (__i != __e)
+ erase_after(__p, __e);
+ else {
+ __n -= __sz;
+ if (__n > 0) {
+ for (__begin_node_pointer __ptr = __p.__get_begin(); __n > 0; --__n, __ptr = __ptr->__next_as_begin()) {
+ __ptr->__next_ = this->__create_node(/* next = */ nullptr, __v);
+ }
}
+ }
}
template <class _Tp, class _Alloc>
-void
-forward_list<_Tp, _Alloc>::splice_after(const_iterator __p,
- forward_list& __x)
-{
- if (!__x.empty())
- {
- if (__p.__get_begin()->__next_ != nullptr)
- {
- const_iterator __lm1 = __x.before_begin();
- while (__lm1.__get_begin()->__next_ != nullptr)
- ++__lm1;
- __lm1.__get_begin()->__next_ = __p.__get_begin()->__next_;
- }
- __p.__get_begin()->__next_ = __x.__before_begin()->__next_;
- __x.__before_begin()->__next_ = nullptr;
+void forward_list<_Tp, _Alloc>::splice_after(const_iterator __p, forward_list& __x) {
+ if (!__x.empty()) {
+ if (__p.__get_begin()->__next_ != nullptr) {
+ const_iterator __lm1 = __x.before_begin();
+ while (__lm1.__get_begin()->__next_ != nullptr)
+ ++__lm1;
+ __lm1.__get_begin()->__next_ = __p.__get_begin()->__next_;
}
+ __p.__get_begin()->__next_ = __x.__before_begin()->__next_;
+ __x.__before_begin()->__next_ = nullptr;
+ }
}
template <class _Tp, class _Alloc>
-void
-forward_list<_Tp, _Alloc>::splice_after(const_iterator __p,
- forward_list& /*__other*/,
- const_iterator __i)
-{
- const_iterator __lm1 = std::next(__i);
- if (__p != __i && __p != __lm1)
- {
- __i.__get_begin()->__next_ = __lm1.__get_begin()->__next_;
- __lm1.__get_begin()->__next_ = __p.__get_begin()->__next_;
- __p.__get_begin()->__next_ = __lm1.__get_unsafe_node_pointer();
- }
+void forward_list<_Tp, _Alloc>::splice_after(const_iterator __p, forward_list& /*__other*/, const_iterator __i) {
+ const_iterator __lm1 = std::next(__i);
+ if (__p != __i && __p != __lm1) {
+ __i.__get_begin()->__next_ = __lm1.__get_begin()->__next_;
+ __lm1.__get_begin()->__next_ = __p.__get_begin()->__next_;
+ __p.__get_begin()->__next_ = __lm1.__get_unsafe_node_pointer();
+ }
}
template <class _Tp, class _Alloc>
-void
-forward_list<_Tp, _Alloc>::splice_after(const_iterator __p,
- forward_list& /*__other*/,
- const_iterator __f, const_iterator __l)
-{
- if (__f != __l && __p != __f)
- {
- const_iterator __lm1 = __f;
- while (__lm1.__get_begin()->__next_ != __l.__get_begin())
- ++__lm1;
- if (__f != __lm1)
- {
- __lm1.__get_begin()->__next_ = __p.__get_begin()->__next_;
- __p.__get_begin()->__next_ = __f.__get_begin()->__next_;
- __f.__get_begin()->__next_ = __l.__get_unsafe_node_pointer();
- }
+void forward_list<_Tp, _Alloc>::splice_after(
+ const_iterator __p, forward_list& /*__other*/, const_iterator __f, const_iterator __l) {
+ if (__f != __l && __p != __f) {
+ const_iterator __lm1 = __f;
+ while (__lm1.__get_begin()->__next_ != __l.__get_begin())
+ ++__lm1;
+ if (__f != __lm1) {
+ __lm1.__get_begin()->__next_ = __p.__get_begin()->__next_;
+ __p.__get_begin()->__next_ = __f.__get_begin()->__next_;
+ __f.__get_begin()->__next_ = __l.__get_unsafe_node_pointer();
}
+ }
}
template <class _Tp, class _Alloc>
-inline _LIBCPP_HIDE_FROM_ABI
-void
-forward_list<_Tp, _Alloc>::splice_after(const_iterator __p,
- forward_list&& __x)
-{
- splice_after(__p, __x);
+inline _LIBCPP_HIDE_FROM_ABI void forward_list<_Tp, _Alloc>::splice_after(const_iterator __p, forward_list&& __x) {
+ splice_after(__p, __x);
}
template <class _Tp, class _Alloc>
-inline _LIBCPP_HIDE_FROM_ABI
-void
-forward_list<_Tp, _Alloc>::splice_after(const_iterator __p,
- forward_list&& __x,
- const_iterator __i)
-{
- splice_after(__p, __x, __i);
+inline _LIBCPP_HIDE_FROM_ABI void
+forward_list<_Tp, _Alloc>::splice_after(const_iterator __p, forward_list&& __x, const_iterator __i) {
+ splice_after(__p, __x, __i);
}
template <class _Tp, class _Alloc>
-inline _LIBCPP_HIDE_FROM_ABI
-void
-forward_list<_Tp, _Alloc>::splice_after(const_iterator __p,
- forward_list&& __x,
- const_iterator __f, const_iterator __l)
-{
- splice_after(__p, __x, __f, __l);
+inline _LIBCPP_HIDE_FROM_ABI void forward_list<_Tp, _Alloc>::splice_after(
+ const_iterator __p, forward_list&& __x, const_iterator __f, const_iterator __l) {
+ splice_after(__p, __x, __f, __l);
}
template <class _Tp, class _Alloc>
-typename forward_list<_Tp, _Alloc>::__remove_return_type
-forward_list<_Tp, _Alloc>::remove(const value_type& __v)
-{
- forward_list<_Tp, _Alloc> __deleted_nodes(get_allocator()); // collect the nodes we're removing
- typename forward_list<_Tp, _Alloc>::size_type __count_removed = 0;
- const iterator __e = end();
- for (iterator __i = before_begin(); __i.__get_begin()->__next_ != nullptr;)
- {
- if (__i.__get_begin()->__next_->__get_value() == __v)
- {
- ++__count_removed;
- iterator __j = std::next(__i, 2);
- for (; __j != __e && *__j == __v; ++__j)
- ++__count_removed;
- __deleted_nodes.splice_after(__deleted_nodes.before_begin(), *this, __i, __j);
- if (__j == __e)
- break;
- __i = __j;
- }
- else
- ++__i;
- }
+typename forward_list<_Tp, _Alloc>::__remove_return_type forward_list<_Tp, _Alloc>::remove(const value_type& __v) {
+ forward_list<_Tp, _Alloc> __deleted_nodes(get_allocator()); // collect the nodes we're removing
+ typename forward_list<_Tp, _Alloc>::size_type __count_removed = 0;
+ const iterator __e = end();
+ for (iterator __i = before_begin(); __i.__get_begin()->__next_ != nullptr;) {
+ if (__i.__get_begin()->__next_->__get_value() == __v) {
+ ++__count_removed;
+ iterator __j = std::next(__i, 2);
+ for (; __j != __e && *__j == __v; ++__j)
+ ++__count_removed;
+ __deleted_nodes.splice_after(__deleted_nodes.before_begin(), *this, __i, __j);
+ if (__j == __e)
+ break;
+ __i = __j;
+ } else
+ ++__i;
+ }
- return (__remove_return_type) __count_removed;
+ return (__remove_return_type)__count_removed;
}
template <class _Tp, class _Alloc>
template <class _Predicate>
-typename forward_list<_Tp, _Alloc>::__remove_return_type
-forward_list<_Tp, _Alloc>::remove_if(_Predicate __pred)
-{
- forward_list<_Tp, _Alloc> __deleted_nodes(get_allocator()); // collect the nodes we're removing
- typename forward_list<_Tp, _Alloc>::size_type __count_removed = 0;
- const iterator __e = end();
- for (iterator __i = before_begin(); __i.__get_begin()->__next_ != nullptr;)
- {
- if (__pred(__i.__get_begin()->__next_->__get_value()))
- {
- ++__count_removed;
- iterator __j = std::next(__i, 2);
- for (; __j != __e && __pred(*__j); ++__j)
- ++__count_removed;
- __deleted_nodes.splice_after(__deleted_nodes.before_begin(), *this, __i, __j);
- if (__j == __e)
- break;
- __i = __j;
- }
- else
- ++__i;
- }
+typename forward_list<_Tp, _Alloc>::__remove_return_type forward_list<_Tp, _Alloc>::remove_if(_Predicate __pred) {
+ forward_list<_Tp, _Alloc> __deleted_nodes(get_allocator()); // collect the nodes we're removing
+ typename forward_list<_Tp, _Alloc>::size_type __count_removed = 0;
+ const iterator __e = end();
+ for (iterator __i = before_begin(); __i.__get_begin()->__next_ != nullptr;) {
+ if (__pred(__i.__get_begin()->__next_->__get_value())) {
+ ++__count_removed;
+ iterator __j = std::next(__i, 2);
+ for (; __j != __e && __pred(*__j); ++__j)
+ ++__count_removed;
+ __deleted_nodes.splice_after(__deleted_nodes.before_begin(), *this, __i, __j);
+ if (__j == __e)
+ break;
+ __i = __j;
+ } else
+ ++__i;
+ }
- return (__remove_return_type) __count_removed;
+ return (__remove_return_type)__count_removed;
}
template <class _Tp, class _Alloc>
template <class _BinaryPredicate>
typename forward_list<_Tp, _Alloc>::__remove_return_type
-forward_list<_Tp, _Alloc>::unique(_BinaryPredicate __binary_pred)
-{
- forward_list<_Tp, _Alloc> __deleted_nodes(get_allocator()); // collect the nodes we're removing
- typename forward_list<_Tp, _Alloc>::size_type __count_removed = 0;
- for (iterator __i = begin(), __e = end(); __i != __e;)
- {
- iterator __j = std::next(__i);
- for (; __j != __e && __binary_pred(*__i, *__j); ++__j)
- ++__count_removed;
- if (__i.__get_begin()->__next_ != __j.__get_unsafe_node_pointer())
- __deleted_nodes.splice_after(__deleted_nodes.before_begin(), *this, __i, __j);
- __i = __j;
- }
+forward_list<_Tp, _Alloc>::unique(_BinaryPredicate __binary_pred) {
+ forward_list<_Tp, _Alloc> __deleted_nodes(get_allocator()); // collect the nodes we're removing
+ typename forward_list<_Tp, _Alloc>::size_type __count_removed = 0;
+ for (iterator __i = begin(), __e = end(); __i != __e;) {
+ iterator __j = std::next(__i);
+ for (; __j != __e && __binary_pred(*__i, *__j); ++__j)
+ ++__count_removed;
+ if (__i.__get_begin()->__next_ != __j.__get_unsafe_node_pointer())
+ __deleted_nodes.splice_after(__deleted_nodes.before_begin(), *this, __i, __j);
+ __i = __j;
+ }
- return (__remove_return_type) __count_removed;
+ return (__remove_return_type)__count_removed;
}
template <class _Tp, class _Alloc>
template <class _Compare>
-void
-forward_list<_Tp, _Alloc>::merge(forward_list& __x, _Compare __comp)
-{
- if (this != std::addressof(__x))
- {
- base::__before_begin()->__next_ = __merge(base::__before_begin()->__next_,
- __x.__before_begin()->__next_,
- __comp);
- __x.__before_begin()->__next_ = nullptr;
- }
+void forward_list<_Tp, _Alloc>::merge(forward_list& __x, _Compare __comp) {
+ if (this != std::addressof(__x)) {
+ base::__before_begin()->__next_ = __merge(base::__before_begin()->__next_, __x.__before_begin()->__next_, __comp);
+ __x.__before_begin()->__next_ = nullptr;
+ }
}
template <class _Tp, class _Alloc>
template <class _Compare>
typename forward_list<_Tp, _Alloc>::__node_pointer
-forward_list<_Tp, _Alloc>::__merge(__node_pointer __f1, __node_pointer __f2,
- _Compare& __comp)
-{
- if (__f1 == nullptr)
- return __f2;
- if (__f2 == nullptr)
- return __f1;
- __node_pointer __r;
- if (__comp(__f2->__get_value(), __f1->__get_value()))
- {
- __node_pointer __t = __f2;
- while (__t->__next_ != nullptr &&
- __comp(__t->__next_->__get_value(), __f1->__get_value()))
- __t = __t->__next_;
- __r = __f2;
- __f2 = __t->__next_;
- __t->__next_ = __f1;
+forward_list<_Tp, _Alloc>::__merge(__node_pointer __f1, __node_pointer __f2, _Compare& __comp) {
+ if (__f1 == nullptr)
+ return __f2;
+ if (__f2 == nullptr)
+ return __f1;
+ __node_pointer __r;
+ if (__comp(__f2->__get_value(), __f1->__get_value())) {
+ __node_pointer __t = __f2;
+ while (__t->__next_ != nullptr && __comp(__t->__next_->__get_value(), __f1->__get_value()))
+ __t = __t->__next_;
+ __r = __f2;
+ __f2 = __t->__next_;
+ __t->__next_ = __f1;
+ } else
+ __r = __f1;
+ __node_pointer __p = __f1;
+ __f1 = __f1->__next_;
+ while (__f1 != nullptr && __f2 != nullptr) {
+ if (__comp(__f2->__get_value(), __f1->__get_value())) {
+ __node_pointer __t = __f2;
+ while (__t->__next_ != nullptr && __comp(__t->__next_->__get_value(), __f1->__get_value()))
+ __t = __t->__next_;
+ __p->__next_ = __f2;
+ __f2 = __t->__next_;
+ __t->__next_ = __f1;
}
- else
- __r = __f1;
- __node_pointer __p = __f1;
+ __p = __f1;
__f1 = __f1->__next_;
- while (__f1 != nullptr && __f2 != nullptr)
- {
- if (__comp(__f2->__get_value(), __f1->__get_value()))
- {
- __node_pointer __t = __f2;
- while (__t->__next_ != nullptr &&
- __comp(__t->__next_->__get_value(), __f1->__get_value()))
- __t = __t->__next_;
- __p->__next_ = __f2;
- __f2 = __t->__next_;
- __t->__next_ = __f1;
- }
- __p = __f1;
- __f1 = __f1->__next_;
- }
- if (__f2 != nullptr)
- __p->__next_ = __f2;
- return __r;
+ }
+ if (__f2 != nullptr)
+ __p->__next_ = __f2;
+ return __r;
}
template <class _Tp, class _Alloc>
template <class _Compare>
-inline
-void
-forward_list<_Tp, _Alloc>::sort(_Compare __comp)
-{
- base::__before_begin()->__next_ = __sort(base::__before_begin()->__next_,
- std::distance(begin(), end()), __comp);
+inline void forward_list<_Tp, _Alloc>::sort(_Compare __comp) {
+ base::__before_begin()->__next_ = __sort(base::__before_begin()->__next_, std::distance(begin(), end()), __comp);
}
template <class _Tp, class _Alloc>
template <class _Compare>
typename forward_list<_Tp, _Alloc>::__node_pointer
-forward_list<_Tp, _Alloc>::__sort(__node_pointer __f1, difference_type __sz,
- _Compare& __comp)
-{
- switch (__sz)
- {
- case 0:
- case 1:
- return __f1;
- case 2:
- if (__comp(__f1->__next_->__get_value(), __f1->__get_value()))
- {
- __node_pointer __t = __f1->__next_;
- __t->__next_ = __f1;
- __f1->__next_ = nullptr;
- __f1 = __t;
- }
- return __f1;
+forward_list<_Tp, _Alloc>::__sort(__node_pointer __f1, difference_type __sz, _Compare& __comp) {
+ switch (__sz) {
+ case 0:
+ case 1:
+ return __f1;
+ case 2:
+ if (__comp(__f1->__next_->__get_value(), __f1->__get_value())) {
+ __node_pointer __t = __f1->__next_;
+ __t->__next_ = __f1;
+ __f1->__next_ = nullptr;
+ __f1 = __t;
}
- difference_type __sz1 = __sz / 2;
- difference_type __sz2 = __sz - __sz1;
- __node_pointer __t = std::next(iterator(__f1), __sz1 - 1).__get_unsafe_node_pointer();
- __node_pointer __f2 = __t->__next_;
- __t->__next_ = nullptr;
- return __merge(__sort(__f1, __sz1, __comp),
- __sort(__f2, __sz2, __comp), __comp);
+ return __f1;
+ }
+ difference_type __sz1 = __sz / 2;
+ difference_type __sz2 = __sz - __sz1;
+ __node_pointer __t = std::next(iterator(__f1), __sz1 - 1).__get_unsafe_node_pointer();
+ __node_pointer __f2 = __t->__next_;
+ __t->__next_ = nullptr;
+ return __merge(__sort(__f1, __sz1, __comp), __sort(__f2, __sz2, __comp), __comp);
}
template <class _Tp, class _Alloc>
-void
-forward_list<_Tp, _Alloc>::reverse() _NOEXCEPT
-{
- __node_pointer __p = base::__before_begin()->__next_;
- if (__p != nullptr)
- {
- __node_pointer __f = __p->__next_;
- __p->__next_ = nullptr;
- while (__f != nullptr)
- {
- __node_pointer __t = __f->__next_;
- __f->__next_ = __p;
- __p = __f;
- __f = __t;
- }
- base::__before_begin()->__next_ = __p;
+void forward_list<_Tp, _Alloc>::reverse() _NOEXCEPT {
+ __node_pointer __p = base::__before_begin()->__next_;
+ if (__p != nullptr) {
+ __node_pointer __f = __p->__next_;
+ __p->__next_ = nullptr;
+ while (__f != nullptr) {
+ __node_pointer __t = __f->__next_;
+ __f->__next_ = __p;
+ __p = __f;
+ __f = __t;
}
+ base::__before_begin()->__next_ = __p;
+ }
}
template <class _Tp, class _Alloc>
-_LIBCPP_HIDE_FROM_ABI
-bool operator==(const forward_list<_Tp, _Alloc>& __x,
- const forward_list<_Tp, _Alloc>& __y)
-{
- typedef forward_list<_Tp, _Alloc> _Cp;
- typedef typename _Cp::const_iterator _Ip;
- _Ip __ix = __x.begin();
- _Ip __ex = __x.end();
- _Ip __iy = __y.begin();
- _Ip __ey = __y.end();
- for (; __ix != __ex && __iy != __ey; ++__ix, ++__iy)
- if (!(*__ix == *__iy))
- return false;
- return (__ix == __ex) == (__iy == __ey);
+_LIBCPP_HIDE_FROM_ABI bool operator==(const forward_list<_Tp, _Alloc>& __x, const forward_list<_Tp, _Alloc>& __y) {
+ typedef forward_list<_Tp, _Alloc> _Cp;
+ typedef typename _Cp::const_iterator _Ip;
+ _Ip __ix = __x.begin();
+ _Ip __ex = __x.end();
+ _Ip __iy = __y.begin();
+ _Ip __ey = __y.end();
+ for (; __ix != __ex && __iy != __ey; ++__ix, ++__iy)
+ if (!(*__ix == *__iy))
+ return false;
+ return (__ix == __ex) == (__iy == __ey);
}
#if _LIBCPP_STD_VER <= 17
template <class _Tp, class _Alloc>
-inline _LIBCPP_HIDE_FROM_ABI
-bool operator!=(const forward_list<_Tp, _Alloc>& __x,
- const forward_list<_Tp, _Alloc>& __y)
-{
- return !(__x == __y);
+inline _LIBCPP_HIDE_FROM_ABI bool
+operator!=(const forward_list<_Tp, _Alloc>& __x, const forward_list<_Tp, _Alloc>& __y) {
+ return !(__x == __y);
}
template <class _Tp, class _Alloc>
-inline _LIBCPP_HIDE_FROM_ABI
-bool operator< (const forward_list<_Tp, _Alloc>& __x,
- const forward_list<_Tp, _Alloc>& __y)
-{
- return std::lexicographical_compare(__x.begin(), __x.end(),
- __y.begin(), __y.end());
+inline _LIBCPP_HIDE_FROM_ABI bool
+operator<(const forward_list<_Tp, _Alloc>& __x, const forward_list<_Tp, _Alloc>& __y) {
+ return std::lexicographical_compare(__x.begin(), __x.end(), __y.begin(), __y.end());
}
template <class _Tp, class _Alloc>
-inline _LIBCPP_HIDE_FROM_ABI
-bool operator> (const forward_list<_Tp, _Alloc>& __x,
- const forward_list<_Tp, _Alloc>& __y)
-{
- return __y < __x;
+inline _LIBCPP_HIDE_FROM_ABI bool
+operator>(const forward_list<_Tp, _Alloc>& __x, const forward_list<_Tp, _Alloc>& __y) {
+ return __y < __x;
}
template <class _Tp, class _Alloc>
-inline _LIBCPP_HIDE_FROM_ABI
-bool operator>=(const forward_list<_Tp, _Alloc>& __x,
- const forward_list<_Tp, _Alloc>& __y)
-{
- return !(__x < __y);
+inline _LIBCPP_HIDE_FROM_ABI bool
+operator>=(const forward_list<_Tp, _Alloc>& __x, const forward_list<_Tp, _Alloc>& __y) {
+ return !(__x < __y);
}
template <class _Tp, class _Alloc>
-inline _LIBCPP_HIDE_FROM_ABI
-bool operator<=(const forward_list<_Tp, _Alloc>& __x,
- const forward_list<_Tp, _Alloc>& __y)
-{
- return !(__y < __x);
+inline _LIBCPP_HIDE_FROM_ABI bool
+operator<=(const forward_list<_Tp, _Alloc>& __x, const forward_list<_Tp, _Alloc>& __y) {
+ return !(__y < __x);
}
#else // #if _LIBCPP_STD_VER <= 17
@@ -1837,33 +1537,28 @@ bool operator<=(const forward_list<_Tp, _Alloc>& __x,
template <class _Tp, class _Allocator>
_LIBCPP_HIDE_FROM_ABI __synth_three_way_result<_Tp>
operator<=>(const forward_list<_Tp, _Allocator>& __x, const forward_list<_Tp, _Allocator>& __y) {
- return std::lexicographical_compare_three_way(
- __x.begin(), __x.end(), __y.begin(), __y.end(), std::__synth_three_way<_Tp, _Tp>);
+ return std::lexicographical_compare_three_way(
+ __x.begin(), __x.end(), __y.begin(), __y.end(), std::__synth_three_way<_Tp, _Tp>);
}
#endif // #if _LIBCPP_STD_VER <= 17
template <class _Tp, class _Alloc>
-inline _LIBCPP_HIDE_FROM_ABI
-void
-swap(forward_list<_Tp, _Alloc>& __x, forward_list<_Tp, _Alloc>& __y)
- _NOEXCEPT_(_NOEXCEPT_(__x.swap(__y)))
-{
- __x.swap(__y);
+inline _LIBCPP_HIDE_FROM_ABI void swap(forward_list<_Tp, _Alloc>& __x, forward_list<_Tp, _Alloc>& __y)
+ _NOEXCEPT_(_NOEXCEPT_(__x.swap(__y))) {
+ __x.swap(__y);
}
#if _LIBCPP_STD_VER >= 20
template <class _Tp, class _Allocator, class _Predicate>
-inline _LIBCPP_HIDE_FROM_ABI
- typename forward_list<_Tp, _Allocator>::size_type
- erase_if(forward_list<_Tp, _Allocator>& __c, _Predicate __pred) {
+inline _LIBCPP_HIDE_FROM_ABI typename forward_list<_Tp, _Allocator>::size_type
+erase_if(forward_list<_Tp, _Allocator>& __c, _Predicate __pred) {
return __c.remove_if(__pred);
}
template <class _Tp, class _Allocator, class _Up>
-inline _LIBCPP_HIDE_FROM_ABI
- typename forward_list<_Tp, _Allocator>::size_type
- erase(forward_list<_Tp, _Allocator>& __c, const _Up& __v) {
+inline _LIBCPP_HIDE_FROM_ABI typename forward_list<_Tp, _Allocator>::size_type
+erase(forward_list<_Tp, _Allocator>& __c, const _Up& __v) {
return std::erase_if(__c, [&](auto& __elem) { return __elem == __v; });
}
#endif
diff --git a/contrib/llvm-project/libcxx/include/fstream b/contrib/llvm-project/libcxx/include/fstream
index 468ff42dc9bc..7a4e15b55d56 100644
--- a/contrib/llvm-project/libcxx/include/fstream
+++ b/contrib/llvm-project/libcxx/include/fstream
@@ -211,63 +211,54 @@ _LIBCPP_PUSH_MACROS
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _CharT, class _Traits>
-class _LIBCPP_TEMPLATE_VIS basic_filebuf
- : public basic_streambuf<_CharT, _Traits>
-{
+class _LIBCPP_TEMPLATE_VIS basic_filebuf : public basic_streambuf<_CharT, _Traits> {
public:
- typedef _CharT char_type;
- typedef _Traits traits_type;
- typedef typename traits_type::int_type int_type;
- typedef typename traits_type::pos_type pos_type;
- typedef typename traits_type::off_type off_type;
- typedef typename traits_type::state_type state_type;
-
- // 27.9.1.2 Constructors/destructor:
- basic_filebuf();
- basic_filebuf(basic_filebuf&& __rhs);
- ~basic_filebuf() override;
-
- // 27.9.1.3 Assign/swap:
- _LIBCPP_HIDE_FROM_ABI
- basic_filebuf& operator=(basic_filebuf&& __rhs);
- void swap(basic_filebuf& __rhs);
-
- // 27.9.1.4 Members:
- _LIBCPP_HIDE_FROM_ABI
- bool is_open() const;
- basic_filebuf* open(const char* __s, ios_base::openmode __mode);
-#ifdef _LIBCPP_HAS_OPEN_WITH_WCHAR
- basic_filebuf* open(const wchar_t* __s, ios_base::openmode __mode);
-#endif
- _LIBCPP_HIDE_FROM_ABI
- basic_filebuf* open(const string& __s, ios_base::openmode __mode);
-
-#if _LIBCPP_STD_VER >= 17
- _LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY _LIBCPP_HIDE_FROM_ABI
- basic_filebuf* open(const filesystem::path& __p, ios_base::openmode __mode) {
- return open(__p.c_str(), __mode);
- }
-#endif
- _LIBCPP_HIDE_FROM_ABI
- basic_filebuf* __open(int __fd, ios_base::openmode __mode);
- basic_filebuf* close();
+ typedef _CharT char_type;
+ typedef _Traits traits_type;
+ typedef typename traits_type::int_type int_type;
+ typedef typename traits_type::pos_type pos_type;
+ typedef typename traits_type::off_type off_type;
+ typedef typename traits_type::state_type state_type;
+
+ // 27.9.1.2 Constructors/destructor:
+ basic_filebuf();
+ basic_filebuf(basic_filebuf&& __rhs);
+ ~basic_filebuf() override;
+
+ // 27.9.1.3 Assign/swap:
+ _LIBCPP_HIDE_FROM_ABI basic_filebuf& operator=(basic_filebuf&& __rhs);
+ void swap(basic_filebuf& __rhs);
+
+ // 27.9.1.4 Members:
+ _LIBCPP_HIDE_FROM_ABI bool is_open() const;
+ basic_filebuf* open(const char* __s, ios_base::openmode __mode);
+# ifdef _LIBCPP_HAS_OPEN_WITH_WCHAR
+ basic_filebuf* open(const wchar_t* __s, ios_base::openmode __mode);
+# endif
+ _LIBCPP_HIDE_FROM_ABI basic_filebuf* open(const string& __s, ios_base::openmode __mode);
+
+# if _LIBCPP_STD_VER >= 17
+ _LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY _LIBCPP_HIDE_FROM_ABI basic_filebuf*
+ open(const filesystem::path& __p, ios_base::openmode __mode) {
+ return open(__p.c_str(), __mode);
+ }
+# endif
+ _LIBCPP_HIDE_FROM_ABI basic_filebuf* __open(int __fd, ios_base::openmode __mode);
+ basic_filebuf* close();
- _LIBCPP_HIDE_FROM_ABI
- inline static const char*
- __make_mdstring(ios_base::openmode __mode) _NOEXCEPT;
+ _LIBCPP_HIDE_FROM_ABI inline static const char* __make_mdstring(ios_base::openmode __mode) _NOEXCEPT;
- protected:
- // 27.9.1.5 Overridden virtual functions:
- int_type underflow() override;
- int_type pbackfail(int_type __c = traits_type::eof()) override;
- int_type overflow (int_type __c = traits_type::eof()) override;
- basic_streambuf<char_type, traits_type>* setbuf(char_type* __s, streamsize __n) override;
- pos_type seekoff(off_type __off, ios_base::seekdir __way,
- ios_base::openmode __wch = ios_base::in | ios_base::out) override;
- pos_type seekpos(pos_type __sp,
- ios_base::openmode __wch = ios_base::in | ios_base::out) override;
- int sync() override;
- void imbue(const locale& __loc) override;
+protected:
+ // 27.9.1.5 Overridden virtual functions:
+ int_type underflow() override;
+ int_type pbackfail(int_type __c = traits_type::eof()) override;
+ int_type overflow(int_type __c = traits_type::eof()) override;
+ basic_streambuf<char_type, traits_type>* setbuf(char_type* __s, streamsize __n) override;
+ pos_type
+ seekoff(off_type __off, ios_base::seekdir __way, ios_base::openmode __wch = ios_base::in | ios_base::out) override;
+ pos_type seekpos(pos_type __sp, ios_base::openmode __wch = ios_base::in | ios_base::out) override;
+ int sync() override;
+ void imbue(const locale& __loc) override;
private:
char* __extbuf_;
@@ -289,6 +280,8 @@ private:
bool __read_mode();
void __write_mode();
+
+ _LIBCPP_EXPORTED_FROM_ABI friend FILE* __get_ostream_file(ostream&);
};
template <class _CharT, class _Traits>
@@ -307,220 +300,173 @@ basic_filebuf<_CharT, _Traits>::basic_filebuf()
__cm_(0),
__owns_eb_(false),
__owns_ib_(false),
- __always_noconv_(false)
-{
- if (std::has_facet<codecvt<char_type, char, state_type> >(this->getloc()))
- {
- __cv_ = &std::use_facet<codecvt<char_type, char, state_type> >(this->getloc());
- __always_noconv_ = __cv_->always_noconv();
- }
- setbuf(nullptr, 4096);
+ __always_noconv_(false) {
+ if (std::has_facet<codecvt<char_type, char, state_type> >(this->getloc())) {
+ __cv_ = &std::use_facet<codecvt<char_type, char, state_type> >(this->getloc());
+ __always_noconv_ = __cv_->always_noconv();
+ }
+ setbuf(nullptr, 4096);
}
template <class _CharT, class _Traits>
-basic_filebuf<_CharT, _Traits>::basic_filebuf(basic_filebuf&& __rhs)
- : basic_streambuf<_CharT, _Traits>(__rhs)
-{
- if (__rhs.__extbuf_ == __rhs.__extbuf_min_)
- {
- __extbuf_ = __extbuf_min_;
- __extbufnext_ = __extbuf_ + (__rhs.__extbufnext_ - __rhs.__extbuf_);
- __extbufend_ = __extbuf_ + (__rhs.__extbufend_ - __rhs.__extbuf_);
- }
+basic_filebuf<_CharT, _Traits>::basic_filebuf(basic_filebuf&& __rhs) : basic_streambuf<_CharT, _Traits>(__rhs) {
+ if (__rhs.__extbuf_ == __rhs.__extbuf_min_) {
+ __extbuf_ = __extbuf_min_;
+ __extbufnext_ = __extbuf_ + (__rhs.__extbufnext_ - __rhs.__extbuf_);
+ __extbufend_ = __extbuf_ + (__rhs.__extbufend_ - __rhs.__extbuf_);
+ } else {
+ __extbuf_ = __rhs.__extbuf_;
+ __extbufnext_ = __rhs.__extbufnext_;
+ __extbufend_ = __rhs.__extbufend_;
+ }
+ __ebs_ = __rhs.__ebs_;
+ __intbuf_ = __rhs.__intbuf_;
+ __ibs_ = __rhs.__ibs_;
+ __file_ = __rhs.__file_;
+ __cv_ = __rhs.__cv_;
+ __st_ = __rhs.__st_;
+ __st_last_ = __rhs.__st_last_;
+ __om_ = __rhs.__om_;
+ __cm_ = __rhs.__cm_;
+ __owns_eb_ = __rhs.__owns_eb_;
+ __owns_ib_ = __rhs.__owns_ib_;
+ __always_noconv_ = __rhs.__always_noconv_;
+ if (__rhs.pbase()) {
+ if (__rhs.pbase() == __rhs.__intbuf_)
+ this->setp(__intbuf_, __intbuf_ + (__rhs.epptr() - __rhs.pbase()));
else
- {
- __extbuf_ = __rhs.__extbuf_;
- __extbufnext_ = __rhs.__extbufnext_;
- __extbufend_ = __rhs.__extbufend_;
- }
- __ebs_ = __rhs.__ebs_;
- __intbuf_ = __rhs.__intbuf_;
- __ibs_ = __rhs.__ibs_;
- __file_ = __rhs.__file_;
- __cv_ = __rhs.__cv_;
- __st_ = __rhs.__st_;
- __st_last_ = __rhs.__st_last_;
- __om_ = __rhs.__om_;
- __cm_ = __rhs.__cm_;
- __owns_eb_ = __rhs.__owns_eb_;
- __owns_ib_ = __rhs.__owns_ib_;
- __always_noconv_ = __rhs.__always_noconv_;
- if (__rhs.pbase())
- {
- if (__rhs.pbase() == __rhs.__intbuf_)
- this->setp(__intbuf_, __intbuf_ + (__rhs. epptr() - __rhs.pbase()));
- else
- this->setp((char_type*)__extbuf_,
- (char_type*)__extbuf_ + (__rhs. epptr() - __rhs.pbase()));
- this->__pbump(__rhs. pptr() - __rhs.pbase());
- }
- else if (__rhs.eback())
- {
- if (__rhs.eback() == __rhs.__intbuf_)
- this->setg(__intbuf_, __intbuf_ + (__rhs.gptr() - __rhs.eback()),
- __intbuf_ + (__rhs.egptr() - __rhs.eback()));
- else
- this->setg((char_type*)__extbuf_,
- (char_type*)__extbuf_ + (__rhs.gptr() - __rhs.eback()),
- (char_type*)__extbuf_ + (__rhs.egptr() - __rhs.eback()));
- }
- __rhs.__extbuf_ = nullptr;
- __rhs.__extbufnext_ = nullptr;
- __rhs.__extbufend_ = nullptr;
- __rhs.__ebs_ = 0;
- __rhs.__intbuf_ = 0;
- __rhs.__ibs_ = 0;
- __rhs.__file_ = nullptr;
- __rhs.__st_ = state_type();
- __rhs.__st_last_ = state_type();
- __rhs.__om_ = 0;
- __rhs.__cm_ = 0;
- __rhs.__owns_eb_ = false;
- __rhs.__owns_ib_ = false;
- __rhs.setg(0, 0, 0);
- __rhs.setp(0, 0);
-}
-
-template <class _CharT, class _Traits>
-inline
-basic_filebuf<_CharT, _Traits>&
-basic_filebuf<_CharT, _Traits>::operator=(basic_filebuf&& __rhs)
-{
- close();
- swap(__rhs);
- return *this;
-}
-
-template <class _CharT, class _Traits>
-basic_filebuf<_CharT, _Traits>::~basic_filebuf()
-{
-#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- try
- {
-#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- close();
-#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- }
- catch (...)
- {
- }
-#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- if (__owns_eb_)
- delete [] __extbuf_;
- if (__owns_ib_)
- delete [] __intbuf_;
-}
-
-template <class _CharT, class _Traits>
-void
-basic_filebuf<_CharT, _Traits>::swap(basic_filebuf& __rhs)
-{
- basic_streambuf<char_type, traits_type>::swap(__rhs);
- if (__extbuf_ != __extbuf_min_ && __rhs.__extbuf_ != __rhs.__extbuf_min_)
- {
- // Neither *this nor __rhs uses the small buffer, so we can simply swap the pointers.
- std::swap(__extbuf_, __rhs.__extbuf_);
- std::swap(__extbufnext_, __rhs.__extbufnext_);
- std::swap(__extbufend_, __rhs.__extbufend_);
- }
+ this->setp((char_type*)__extbuf_, (char_type*)__extbuf_ + (__rhs.epptr() - __rhs.pbase()));
+ this->__pbump(__rhs.pptr() - __rhs.pbase());
+ } else if (__rhs.eback()) {
+ if (__rhs.eback() == __rhs.__intbuf_)
+ this->setg(__intbuf_, __intbuf_ + (__rhs.gptr() - __rhs.eback()), __intbuf_ + (__rhs.egptr() - __rhs.eback()));
else
- {
- ptrdiff_t __ln = __extbufnext_ ? __extbufnext_ - __extbuf_ : 0;
- ptrdiff_t __le = __extbufend_ ? __extbufend_ - __extbuf_ : 0;
- ptrdiff_t __rn = __rhs.__extbufnext_ ? __rhs.__extbufnext_ - __rhs.__extbuf_ : 0;
- ptrdiff_t __re = __rhs.__extbufend_ ? __rhs.__extbufend_ - __rhs.__extbuf_ : 0;
- if (__extbuf_ == __extbuf_min_ && __rhs.__extbuf_ != __rhs.__extbuf_min_)
- {
- // *this uses the small buffer, but __rhs doesn't.
- __extbuf_ = __rhs.__extbuf_;
- __rhs.__extbuf_ = __rhs.__extbuf_min_;
- std::memmove(__rhs.__extbuf_min_, __extbuf_min_, sizeof(__extbuf_min_));
- }
- else if (__extbuf_ != __extbuf_min_ && __rhs.__extbuf_ == __rhs.__extbuf_min_)
- {
- // *this doesn't use the small buffer, but __rhs does.
- __rhs.__extbuf_ = __extbuf_;
- __extbuf_ = __extbuf_min_;
- std::memmove(__extbuf_min_, __rhs.__extbuf_min_, sizeof(__extbuf_min_));
- }
- else
- {
- // Both *this and __rhs use the small buffer.
- char __tmp[sizeof(__extbuf_min_)];
- std::memmove(__tmp, __extbuf_min_, sizeof(__extbuf_min_));
- std::memmove(__extbuf_min_, __rhs.__extbuf_min_, sizeof(__extbuf_min_));
- std::memmove(__rhs.__extbuf_min_, __tmp, sizeof(__extbuf_min_));
- }
- __extbufnext_ = __extbuf_ + __rn;
- __extbufend_ = __extbuf_ + __re;
- __rhs.__extbufnext_ = __rhs.__extbuf_ + __ln;
- __rhs.__extbufend_ = __rhs.__extbuf_ + __le;
- }
- std::swap(__ebs_, __rhs.__ebs_);
- std::swap(__intbuf_, __rhs.__intbuf_);
- std::swap(__ibs_, __rhs.__ibs_);
- std::swap(__file_, __rhs.__file_);
- std::swap(__cv_, __rhs.__cv_);
- std::swap(__st_, __rhs.__st_);
- std::swap(__st_last_, __rhs.__st_last_);
- std::swap(__om_, __rhs.__om_);
- std::swap(__cm_, __rhs.__cm_);
- std::swap(__owns_eb_, __rhs.__owns_eb_);
- std::swap(__owns_ib_, __rhs.__owns_ib_);
- std::swap(__always_noconv_, __rhs.__always_noconv_);
- if (this->eback() == (char_type*)__rhs.__extbuf_min_)
- {
- ptrdiff_t __n = this->gptr() - this->eback();
- ptrdiff_t __e = this->egptr() - this->eback();
- this->setg((char_type*)__extbuf_min_,
- (char_type*)__extbuf_min_ + __n,
- (char_type*)__extbuf_min_ + __e);
- }
- else if (this->pbase() == (char_type*)__rhs.__extbuf_min_)
- {
- ptrdiff_t __n = this->pptr() - this->pbase();
- ptrdiff_t __e = this->epptr() - this->pbase();
- this->setp((char_type*)__extbuf_min_,
- (char_type*)__extbuf_min_ + __e);
- this->__pbump(__n);
- }
- if (__rhs.eback() == (char_type*)__extbuf_min_)
- {
- ptrdiff_t __n = __rhs.gptr() - __rhs.eback();
- ptrdiff_t __e = __rhs.egptr() - __rhs.eback();
- __rhs.setg((char_type*)__rhs.__extbuf_min_,
- (char_type*)__rhs.__extbuf_min_ + __n,
- (char_type*)__rhs.__extbuf_min_ + __e);
- }
- else if (__rhs.pbase() == (char_type*)__extbuf_min_)
- {
- ptrdiff_t __n = __rhs.pptr() - __rhs.pbase();
- ptrdiff_t __e = __rhs.epptr() - __rhs.pbase();
- __rhs.setp((char_type*)__rhs.__extbuf_min_,
- (char_type*)__rhs.__extbuf_min_ + __e);
- __rhs.__pbump(__n);
+ this->setg((char_type*)__extbuf_,
+ (char_type*)__extbuf_ + (__rhs.gptr() - __rhs.eback()),
+ (char_type*)__extbuf_ + (__rhs.egptr() - __rhs.eback()));
+ }
+ __rhs.__extbuf_ = nullptr;
+ __rhs.__extbufnext_ = nullptr;
+ __rhs.__extbufend_ = nullptr;
+ __rhs.__ebs_ = 0;
+ __rhs.__intbuf_ = 0;
+ __rhs.__ibs_ = 0;
+ __rhs.__file_ = nullptr;
+ __rhs.__st_ = state_type();
+ __rhs.__st_last_ = state_type();
+ __rhs.__om_ = 0;
+ __rhs.__cm_ = 0;
+ __rhs.__owns_eb_ = false;
+ __rhs.__owns_ib_ = false;
+ __rhs.setg(0, 0, 0);
+ __rhs.setp(0, 0);
+}
+
+template <class _CharT, class _Traits>
+inline basic_filebuf<_CharT, _Traits>& basic_filebuf<_CharT, _Traits>::operator=(basic_filebuf&& __rhs) {
+ close();
+ swap(__rhs);
+ return *this;
+}
+
+template <class _CharT, class _Traits>
+basic_filebuf<_CharT, _Traits>::~basic_filebuf() {
+# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
+ try {
+# endif // _LIBCPP_HAS_NO_EXCEPTIONS
+ close();
+# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
+ } catch (...) {
+ }
+# endif // _LIBCPP_HAS_NO_EXCEPTIONS
+ if (__owns_eb_)
+ delete[] __extbuf_;
+ if (__owns_ib_)
+ delete[] __intbuf_;
+}
+
+template <class _CharT, class _Traits>
+void basic_filebuf<_CharT, _Traits>::swap(basic_filebuf& __rhs) {
+ basic_streambuf<char_type, traits_type>::swap(__rhs);
+ if (__extbuf_ != __extbuf_min_ && __rhs.__extbuf_ != __rhs.__extbuf_min_) {
+ // Neither *this nor __rhs uses the small buffer, so we can simply swap the pointers.
+ std::swap(__extbuf_, __rhs.__extbuf_);
+ std::swap(__extbufnext_, __rhs.__extbufnext_);
+ std::swap(__extbufend_, __rhs.__extbufend_);
+ } else {
+ ptrdiff_t __ln = __extbufnext_ ? __extbufnext_ - __extbuf_ : 0;
+ ptrdiff_t __le = __extbufend_ ? __extbufend_ - __extbuf_ : 0;
+ ptrdiff_t __rn = __rhs.__extbufnext_ ? __rhs.__extbufnext_ - __rhs.__extbuf_ : 0;
+ ptrdiff_t __re = __rhs.__extbufend_ ? __rhs.__extbufend_ - __rhs.__extbuf_ : 0;
+ if (__extbuf_ == __extbuf_min_ && __rhs.__extbuf_ != __rhs.__extbuf_min_) {
+ // *this uses the small buffer, but __rhs doesn't.
+ __extbuf_ = __rhs.__extbuf_;
+ __rhs.__extbuf_ = __rhs.__extbuf_min_;
+ std::memmove(__rhs.__extbuf_min_, __extbuf_min_, sizeof(__extbuf_min_));
+ } else if (__extbuf_ != __extbuf_min_ && __rhs.__extbuf_ == __rhs.__extbuf_min_) {
+ // *this doesn't use the small buffer, but __rhs does.
+ __rhs.__extbuf_ = __extbuf_;
+ __extbuf_ = __extbuf_min_;
+ std::memmove(__extbuf_min_, __rhs.__extbuf_min_, sizeof(__extbuf_min_));
+ } else {
+ // Both *this and __rhs use the small buffer.
+ char __tmp[sizeof(__extbuf_min_)];
+ std::memmove(__tmp, __extbuf_min_, sizeof(__extbuf_min_));
+ std::memmove(__extbuf_min_, __rhs.__extbuf_min_, sizeof(__extbuf_min_));
+ std::memmove(__rhs.__extbuf_min_, __tmp, sizeof(__extbuf_min_));
}
+ __extbufnext_ = __extbuf_ + __rn;
+ __extbufend_ = __extbuf_ + __re;
+ __rhs.__extbufnext_ = __rhs.__extbuf_ + __ln;
+ __rhs.__extbufend_ = __rhs.__extbuf_ + __le;
+ }
+ std::swap(__ebs_, __rhs.__ebs_);
+ std::swap(__intbuf_, __rhs.__intbuf_);
+ std::swap(__ibs_, __rhs.__ibs_);
+ std::swap(__file_, __rhs.__file_);
+ std::swap(__cv_, __rhs.__cv_);
+ std::swap(__st_, __rhs.__st_);
+ std::swap(__st_last_, __rhs.__st_last_);
+ std::swap(__om_, __rhs.__om_);
+ std::swap(__cm_, __rhs.__cm_);
+ std::swap(__owns_eb_, __rhs.__owns_eb_);
+ std::swap(__owns_ib_, __rhs.__owns_ib_);
+ std::swap(__always_noconv_, __rhs.__always_noconv_);
+ if (this->eback() == (char_type*)__rhs.__extbuf_min_) {
+ ptrdiff_t __n = this->gptr() - this->eback();
+ ptrdiff_t __e = this->egptr() - this->eback();
+ this->setg((char_type*)__extbuf_min_, (char_type*)__extbuf_min_ + __n, (char_type*)__extbuf_min_ + __e);
+ } else if (this->pbase() == (char_type*)__rhs.__extbuf_min_) {
+ ptrdiff_t __n = this->pptr() - this->pbase();
+ ptrdiff_t __e = this->epptr() - this->pbase();
+ this->setp((char_type*)__extbuf_min_, (char_type*)__extbuf_min_ + __e);
+ this->__pbump(__n);
+ }
+ if (__rhs.eback() == (char_type*)__extbuf_min_) {
+ ptrdiff_t __n = __rhs.gptr() - __rhs.eback();
+ ptrdiff_t __e = __rhs.egptr() - __rhs.eback();
+ __rhs.setg(
+ (char_type*)__rhs.__extbuf_min_, (char_type*)__rhs.__extbuf_min_ + __n, (char_type*)__rhs.__extbuf_min_ + __e);
+ } else if (__rhs.pbase() == (char_type*)__extbuf_min_) {
+ ptrdiff_t __n = __rhs.pptr() - __rhs.pbase();
+ ptrdiff_t __e = __rhs.epptr() - __rhs.pbase();
+ __rhs.setp((char_type*)__rhs.__extbuf_min_, (char_type*)__rhs.__extbuf_min_ + __e);
+ __rhs.__pbump(__n);
+ }
}
template <class _CharT, class _Traits>
-inline _LIBCPP_HIDE_FROM_ABI
-void
-swap(basic_filebuf<_CharT, _Traits>& __x, basic_filebuf<_CharT, _Traits>& __y)
-{
- __x.swap(__y);
+inline _LIBCPP_HIDE_FROM_ABI void swap(basic_filebuf<_CharT, _Traits>& __x, basic_filebuf<_CharT, _Traits>& __y) {
+ __x.swap(__y);
}
template <class _CharT, class _Traits>
-inline
-bool
-basic_filebuf<_CharT, _Traits>::is_open() const
-{
- return __file_ != nullptr;
+inline bool basic_filebuf<_CharT, _Traits>::is_open() const {
+ return __file_ != nullptr;
}
template <class _CharT, class _Traits>
-const char* basic_filebuf<_CharT, _Traits>::__make_mdstring(
- ios_base::openmode __mode) _NOEXCEPT {
+const char* basic_filebuf<_CharT, _Traits>::__make_mdstring(ios_base::openmode __mode) _NOEXCEPT {
switch (__mode & ~ios_base::ate) {
case ios_base::out:
case ios_base::out | ios_base::trunc:
@@ -552,7 +498,7 @@ const char* basic_filebuf<_CharT, _Traits>::__make_mdstring(
case ios_base::in | ios_base::out | ios_base::app | ios_base::binary:
case ios_base::in | ios_base::app | ios_base::binary:
return "a+b" _LIBCPP_FOPEN_CLOEXEC_MODE;
-#if _LIBCPP_STD_VER >= 23
+# if _LIBCPP_STD_VER >= 23
case ios_base::out | ios_base::noreplace:
case ios_base::out | ios_base::trunc | ios_base::noreplace:
return "wx" _LIBCPP_FOPEN_CLOEXEC_MODE;
@@ -563,7 +509,7 @@ const char* basic_filebuf<_CharT, _Traits>::__make_mdstring(
return "wbx" _LIBCPP_FOPEN_CLOEXEC_MODE;
case ios_base::in | ios_base::out | ios_base::trunc | ios_base::binary | ios_base::noreplace:
return "w+bx" _LIBCPP_FOPEN_CLOEXEC_MODE;
-#endif // _LIBCPP_STD_VER >= 23
+# endif // _LIBCPP_STD_VER >= 23
default:
return nullptr;
}
@@ -571,39 +517,34 @@ const char* basic_filebuf<_CharT, _Traits>::__make_mdstring(
}
template <class _CharT, class _Traits>
-basic_filebuf<_CharT, _Traits>*
-basic_filebuf<_CharT, _Traits>::open(const char* __s, ios_base::openmode __mode)
-{
- basic_filebuf<_CharT, _Traits>* __rt = nullptr;
- if (__file_ == nullptr)
- {
- if (const char* __mdstr = __make_mdstring(__mode)) {
- __rt = this;
- __file_ = fopen(__s, __mdstr);
- if (__file_) {
- __om_ = __mode;
- if (__mode & ios_base::ate) {
- if (fseek(__file_, 0, SEEK_END)) {
- fclose(__file_);
- __file_ = nullptr;
- __rt = nullptr;
- }
+basic_filebuf<_CharT, _Traits>* basic_filebuf<_CharT, _Traits>::open(const char* __s, ios_base::openmode __mode) {
+ basic_filebuf<_CharT, _Traits>* __rt = nullptr;
+ if (__file_ == nullptr) {
+ if (const char* __mdstr = __make_mdstring(__mode)) {
+ __rt = this;
+ __file_ = fopen(__s, __mdstr);
+ if (__file_) {
+ __om_ = __mode;
+ if (__mode & ios_base::ate) {
+ if (fseek(__file_, 0, SEEK_END)) {
+ fclose(__file_);
+ __file_ = nullptr;
+ __rt = nullptr;
}
- } else
- __rt = nullptr;
- }
+ }
+ } else
+ __rt = nullptr;
}
- return __rt;
+ }
+ return __rt;
}
template <class _CharT, class _Traits>
-inline
-basic_filebuf<_CharT, _Traits>*
-basic_filebuf<_CharT, _Traits>::__open(int __fd, ios_base::openmode __mode) {
+inline basic_filebuf<_CharT, _Traits>* basic_filebuf<_CharT, _Traits>::__open(int __fd, ios_base::openmode __mode) {
basic_filebuf<_CharT, _Traits>* __rt = nullptr;
if (__file_ == nullptr) {
if (const char* __mdstr = __make_mdstring(__mode)) {
- __rt = this;
+ __rt = this;
__file_ = fdopen(__fd, __mdstr);
if (__file_) {
__om_ = __mode;
@@ -611,7 +552,7 @@ basic_filebuf<_CharT, _Traits>::__open(int __fd, ios_base::openmode __mode) {
if (fseek(__file_, 0, SEEK_END)) {
fclose(__file_);
__file_ = nullptr;
- __rt = nullptr;
+ __rt = nullptr;
}
}
} else
@@ -621,740 +562,593 @@ basic_filebuf<_CharT, _Traits>::__open(int __fd, ios_base::openmode __mode) {
return __rt;
}
-#ifdef _LIBCPP_HAS_OPEN_WITH_WCHAR
+# ifdef _LIBCPP_HAS_OPEN_WITH_WCHAR
// This is basically the same as the char* overload except that it uses _wfopen
// and long mode strings.
template <class _CharT, class _Traits>
-basic_filebuf<_CharT, _Traits>*
-basic_filebuf<_CharT, _Traits>::open(const wchar_t* __s, ios_base::openmode __mode)
-{
- basic_filebuf<_CharT, _Traits>* __rt = nullptr;
- if (__file_ == nullptr)
- {
- __rt = this;
- const wchar_t* __mdstr;
- switch (__mode & ~ios_base::ate)
- {
- case ios_base::out:
- case ios_base::out | ios_base::trunc:
- __mdstr = L"w";
- break;
- case ios_base::out | ios_base::app:
- case ios_base::app:
- __mdstr = L"a";
- break;
- case ios_base::in:
- __mdstr = L"r";
- break;
- case ios_base::in | ios_base::out:
- __mdstr = L"r+";
- break;
- case ios_base::in | ios_base::out | ios_base::trunc:
- __mdstr = L"w+";
- break;
- case ios_base::in | ios_base::out | ios_base::app:
- case ios_base::in | ios_base::app:
- __mdstr = L"a+";
- break;
- case ios_base::out | ios_base::binary:
- case ios_base::out | ios_base::trunc | ios_base::binary:
- __mdstr = L"wb";
- break;
- case ios_base::out | ios_base::app | ios_base::binary:
- case ios_base::app | ios_base::binary:
- __mdstr = L"ab";
- break;
- case ios_base::in | ios_base::binary:
- __mdstr = L"rb";
- break;
- case ios_base::in | ios_base::out | ios_base::binary:
- __mdstr = L"r+b";
- break;
- case ios_base::in | ios_base::out | ios_base::trunc | ios_base::binary:
- __mdstr = L"w+b";
- break;
- case ios_base::in | ios_base::out | ios_base::app | ios_base::binary:
- case ios_base::in | ios_base::app | ios_base::binary:
- __mdstr = L"a+b";
- break;
-# if _LIBCPP_STD_VER >= 23
- case ios_base::out | ios_base::noreplace:
- case ios_base::out | ios_base::trunc | ios_base::noreplace:
- __mdstr = L"wx";
- break;
- case ios_base::in | ios_base::out | ios_base::trunc | ios_base::noreplace:
- __mdstr = L"w+x";
- break;
- case ios_base::out | ios_base::binary | ios_base::noreplace:
- case ios_base::out | ios_base::trunc | ios_base::binary | ios_base::noreplace:
- __mdstr = L"wbx";
- break;
- case ios_base::in | ios_base::out | ios_base::trunc | ios_base::binary | ios_base::noreplace:
- __mdstr = L"w+bx";
- break;
-# endif // _LIBCPP_STD_VER >= 23
- default:
- __rt = nullptr;
- break;
- }
- if (__rt)
- {
- __file_ = _wfopen(__s, __mdstr);
- if (__file_)
- {
- __om_ = __mode;
- if (__mode & ios_base::ate)
- {
- if (fseek(__file_, 0, SEEK_END))
- {
- fclose(__file_);
- __file_ = nullptr;
- __rt = nullptr;
- }
- }
- }
- else
- __rt = nullptr;
+basic_filebuf<_CharT, _Traits>* basic_filebuf<_CharT, _Traits>::open(const wchar_t* __s, ios_base::openmode __mode) {
+ basic_filebuf<_CharT, _Traits>* __rt = nullptr;
+ if (__file_ == nullptr) {
+ __rt = this;
+ const wchar_t* __mdstr;
+ switch (__mode & ~ios_base::ate) {
+ case ios_base::out:
+ case ios_base::out | ios_base::trunc:
+ __mdstr = L"w";
+ break;
+ case ios_base::out | ios_base::app:
+ case ios_base::app:
+ __mdstr = L"a";
+ break;
+ case ios_base::in:
+ __mdstr = L"r";
+ break;
+ case ios_base::in | ios_base::out:
+ __mdstr = L"r+";
+ break;
+ case ios_base::in | ios_base::out | ios_base::trunc:
+ __mdstr = L"w+";
+ break;
+ case ios_base::in | ios_base::out | ios_base::app:
+ case ios_base::in | ios_base::app:
+ __mdstr = L"a+";
+ break;
+ case ios_base::out | ios_base::binary:
+ case ios_base::out | ios_base::trunc | ios_base::binary:
+ __mdstr = L"wb";
+ break;
+ case ios_base::out | ios_base::app | ios_base::binary:
+ case ios_base::app | ios_base::binary:
+ __mdstr = L"ab";
+ break;
+ case ios_base::in | ios_base::binary:
+ __mdstr = L"rb";
+ break;
+ case ios_base::in | ios_base::out | ios_base::binary:
+ __mdstr = L"r+b";
+ break;
+ case ios_base::in | ios_base::out | ios_base::trunc | ios_base::binary:
+ __mdstr = L"w+b";
+ break;
+ case ios_base::in | ios_base::out | ios_base::app | ios_base::binary:
+ case ios_base::in | ios_base::app | ios_base::binary:
+ __mdstr = L"a+b";
+ break;
+# if _LIBCPP_STD_VER >= 23
+ case ios_base::out | ios_base::noreplace:
+ case ios_base::out | ios_base::trunc | ios_base::noreplace:
+ __mdstr = L"wx";
+ break;
+ case ios_base::in | ios_base::out | ios_base::trunc | ios_base::noreplace:
+ __mdstr = L"w+x";
+ break;
+ case ios_base::out | ios_base::binary | ios_base::noreplace:
+ case ios_base::out | ios_base::trunc | ios_base::binary | ios_base::noreplace:
+ __mdstr = L"wbx";
+ break;
+ case ios_base::in | ios_base::out | ios_base::trunc | ios_base::binary | ios_base::noreplace:
+ __mdstr = L"w+bx";
+ break;
+# endif // _LIBCPP_STD_VER >= 23
+ default:
+ __rt = nullptr;
+ break;
+ }
+ if (__rt) {
+ __file_ = _wfopen(__s, __mdstr);
+ if (__file_) {
+ __om_ = __mode;
+ if (__mode & ios_base::ate) {
+ if (fseek(__file_, 0, SEEK_END)) {
+ fclose(__file_);
+ __file_ = nullptr;
+ __rt = nullptr;
+ }
}
+ } else
+ __rt = nullptr;
}
- return __rt;
+ }
+ return __rt;
}
-#endif
+# endif
template <class _CharT, class _Traits>
-inline
-basic_filebuf<_CharT, _Traits>*
-basic_filebuf<_CharT, _Traits>::open(const string& __s, ios_base::openmode __mode)
-{
- return open(__s.c_str(), __mode);
+inline basic_filebuf<_CharT, _Traits>*
+basic_filebuf<_CharT, _Traits>::open(const string& __s, ios_base::openmode __mode) {
+ return open(__s.c_str(), __mode);
}
template <class _CharT, class _Traits>
-basic_filebuf<_CharT, _Traits>*
-basic_filebuf<_CharT, _Traits>::close()
-{
- basic_filebuf<_CharT, _Traits>* __rt = nullptr;
- if (__file_)
- {
- __rt = this;
- unique_ptr<FILE, int(*)(FILE*)> __h(__file_, fclose);
- if (sync())
- __rt = nullptr;
- if (fclose(__h.release()))
- __rt = nullptr;
- __file_ = nullptr;
- setbuf(0, 0);
- }
- return __rt;
+basic_filebuf<_CharT, _Traits>* basic_filebuf<_CharT, _Traits>::close() {
+ basic_filebuf<_CharT, _Traits>* __rt = nullptr;
+ if (__file_) {
+ __rt = this;
+ unique_ptr<FILE, int (*)(FILE*)> __h(__file_, fclose);
+ if (sync())
+ __rt = nullptr;
+ if (fclose(__h.release()))
+ __rt = nullptr;
+ __file_ = nullptr;
+ setbuf(0, 0);
+ }
+ return __rt;
}
template <class _CharT, class _Traits>
-typename basic_filebuf<_CharT, _Traits>::int_type
-basic_filebuf<_CharT, _Traits>::underflow()
-{
- if (__file_ == nullptr)
- return traits_type::eof();
- bool __initial = __read_mode();
- char_type __1buf;
- if (this->gptr() == nullptr)
- this->setg(&__1buf, &__1buf+1, &__1buf+1);
- const size_t __unget_sz = __initial ? 0 : std::min<size_t>((this->egptr() - this->eback()) / 2, 4);
- int_type __c = traits_type::eof();
- if (this->gptr() == this->egptr())
- {
- std::memmove(this->eback(), this->egptr() - __unget_sz, __unget_sz * sizeof(char_type));
- if (__always_noconv_)
- {
- size_t __nmemb = static_cast<size_t>(this->egptr() - this->eback() - __unget_sz);
- __nmemb = ::fread(this->eback() + __unget_sz, 1, __nmemb, __file_);
- if (__nmemb != 0)
- {
- this->setg(this->eback(),
- this->eback() + __unget_sz,
- this->eback() + __unget_sz + __nmemb);
- __c = traits_type::to_int_type(*this->gptr());
- }
- }
- else
- {
- if (__extbufend_ != __extbufnext_) {
- _LIBCPP_ASSERT_NON_NULL(__extbufnext_ != nullptr, "underflow moving from nullptr");
- _LIBCPP_ASSERT_NON_NULL(__extbuf_ != nullptr, "underflow moving into nullptr");
- std::memmove(__extbuf_, __extbufnext_, __extbufend_ - __extbufnext_);
- }
- __extbufnext_ = __extbuf_ + (__extbufend_ - __extbufnext_);
- __extbufend_ = __extbuf_ + (__extbuf_ == __extbuf_min_ ? sizeof(__extbuf_min_) : __ebs_);
- size_t __nmemb = std::min(static_cast<size_t>(__ibs_ - __unget_sz),
- static_cast<size_t>(__extbufend_ - __extbufnext_));
- codecvt_base::result __r;
- __st_last_ = __st_;
- size_t __nr = fread((void*) const_cast<char *>(__extbufnext_), 1, __nmemb, __file_);
- if (__nr != 0)
- {
- if (!__cv_)
- __throw_bad_cast();
-
- __extbufend_ = __extbufnext_ + __nr;
- char_type* __inext;
- __r = __cv_->in(__st_, __extbuf_, __extbufend_, __extbufnext_,
- this->eback() + __unget_sz,
- this->eback() + __ibs_, __inext);
- if (__r == codecvt_base::noconv)
- {
- this->setg((char_type*)__extbuf_, (char_type*)__extbuf_,
- (char_type*)const_cast<char *>(__extbufend_));
- __c = traits_type::to_int_type(*this->gptr());
- }
- else if (__inext != this->eback() + __unget_sz)
- {
- this->setg(this->eback(), this->eback() + __unget_sz, __inext);
- __c = traits_type::to_int_type(*this->gptr());
- }
- }
- }
- }
- else
+typename basic_filebuf<_CharT, _Traits>::int_type basic_filebuf<_CharT, _Traits>::underflow() {
+ if (__file_ == nullptr)
+ return traits_type::eof();
+ bool __initial = __read_mode();
+ char_type __1buf;
+ if (this->gptr() == nullptr)
+ this->setg(&__1buf, &__1buf + 1, &__1buf + 1);
+ const size_t __unget_sz = __initial ? 0 : std::min<size_t>((this->egptr() - this->eback()) / 2, 4);
+ int_type __c = traits_type::eof();
+ if (this->gptr() == this->egptr()) {
+ std::memmove(this->eback(), this->egptr() - __unget_sz, __unget_sz * sizeof(char_type));
+ if (__always_noconv_) {
+ size_t __nmemb = static_cast<size_t>(this->egptr() - this->eback() - __unget_sz);
+ __nmemb = ::fread(this->eback() + __unget_sz, 1, __nmemb, __file_);
+ if (__nmemb != 0) {
+ this->setg(this->eback(), this->eback() + __unget_sz, this->eback() + __unget_sz + __nmemb);
__c = traits_type::to_int_type(*this->gptr());
- if (this->eback() == &__1buf)
- this->setg(nullptr, nullptr, nullptr);
- return __c;
-}
-
-template <class _CharT, class _Traits>
-typename basic_filebuf<_CharT, _Traits>::int_type
-basic_filebuf<_CharT, _Traits>::pbackfail(int_type __c)
-{
- if (__file_ && this->eback() < this->gptr())
- {
- if (traits_type::eq_int_type(__c, traits_type::eof()))
- {
- this->gbump(-1);
- return traits_type::not_eof(__c);
- }
- if ((__om_ & ios_base::out) ||
- traits_type::eq(traits_type::to_char_type(__c), this->gptr()[-1]))
- {
- this->gbump(-1);
- *this->gptr() = traits_type::to_char_type(__c);
- return __c;
+ }
+ } else {
+ if (__extbufend_ != __extbufnext_) {
+ _LIBCPP_ASSERT_NON_NULL(__extbufnext_ != nullptr, "underflow moving from nullptr");
+ _LIBCPP_ASSERT_NON_NULL(__extbuf_ != nullptr, "underflow moving into nullptr");
+ std::memmove(__extbuf_, __extbufnext_, __extbufend_ - __extbufnext_);
+ }
+ __extbufnext_ = __extbuf_ + (__extbufend_ - __extbufnext_);
+ __extbufend_ = __extbuf_ + (__extbuf_ == __extbuf_min_ ? sizeof(__extbuf_min_) : __ebs_);
+ size_t __nmemb =
+ std::min(static_cast<size_t>(__ibs_ - __unget_sz), static_cast<size_t>(__extbufend_ - __extbufnext_));
+ codecvt_base::result __r;
+ __st_last_ = __st_;
+ size_t __nr = fread((void*)const_cast<char*>(__extbufnext_), 1, __nmemb, __file_);
+ if (__nr != 0) {
+ if (!__cv_)
+ __throw_bad_cast();
+
+ __extbufend_ = __extbufnext_ + __nr;
+ char_type* __inext;
+ __r = __cv_->in(
+ __st_, __extbuf_, __extbufend_, __extbufnext_, this->eback() + __unget_sz, this->eback() + __ibs_, __inext);
+ if (__r == codecvt_base::noconv) {
+ this->setg((char_type*)__extbuf_, (char_type*)__extbuf_, (char_type*)const_cast<char*>(__extbufend_));
+ __c = traits_type::to_int_type(*this->gptr());
+ } else if (__inext != this->eback() + __unget_sz) {
+ this->setg(this->eback(), this->eback() + __unget_sz, __inext);
+ __c = traits_type::to_int_type(*this->gptr());
}
+ }
}
- return traits_type::eof();
+ } else
+ __c = traits_type::to_int_type(*this->gptr());
+ if (this->eback() == &__1buf)
+ this->setg(nullptr, nullptr, nullptr);
+ return __c;
}
template <class _CharT, class _Traits>
-typename basic_filebuf<_CharT, _Traits>::int_type
-basic_filebuf<_CharT, _Traits>::overflow(int_type __c)
-{
- if (__file_ == nullptr)
- return traits_type::eof();
- __write_mode();
- char_type __1buf;
- char_type* __pb_save = this->pbase();
- char_type* __epb_save = this->epptr();
- if (!traits_type::eq_int_type(__c, traits_type::eof()))
- {
- if (this->pptr() == nullptr)
- this->setp(&__1buf, &__1buf+1);
- *this->pptr() = traits_type::to_char_type(__c);
- this->pbump(1);
+typename basic_filebuf<_CharT, _Traits>::int_type basic_filebuf<_CharT, _Traits>::pbackfail(int_type __c) {
+ if (__file_ && this->eback() < this->gptr()) {
+ if (traits_type::eq_int_type(__c, traits_type::eof())) {
+ this->gbump(-1);
+ return traits_type::not_eof(__c);
}
- if (this->pptr() != this->pbase())
- {
- if (__always_noconv_)
- {
- size_t __nmemb = static_cast<size_t>(this->pptr() - this->pbase());
- if (std::fwrite(this->pbase(), sizeof(char_type), __nmemb, __file_) != __nmemb)
- return traits_type::eof();
- }
- else
- {
- char* __extbe = __extbuf_;
- codecvt_base::result __r;
- do
- {
- if (!__cv_)
- __throw_bad_cast();
-
- const char_type* __e;
- __r = __cv_->out(__st_, this->pbase(), this->pptr(), __e,
- __extbuf_, __extbuf_ + __ebs_, __extbe);
- if (__e == this->pbase())
- return traits_type::eof();
- if (__r == codecvt_base::noconv)
- {
- size_t __nmemb = static_cast<size_t>(this->pptr() - this->pbase());
- if (std::fwrite(this->pbase(), 1, __nmemb, __file_) != __nmemb)
- return traits_type::eof();
- }
- else if (__r == codecvt_base::ok || __r == codecvt_base::partial)
- {
- size_t __nmemb = static_cast<size_t>(__extbe - __extbuf_);
- if (fwrite(__extbuf_, 1, __nmemb, __file_) != __nmemb)
- return traits_type::eof();
- if (__r == codecvt_base::partial)
- {
- this->setp(const_cast<char_type*>(__e), this->pptr());
- this->__pbump(this->epptr() - this->pbase());
- }
- }
- else
- return traits_type::eof();
- } while (__r == codecvt_base::partial);
- }
- this->setp(__pb_save, __epb_save);
+ if ((__om_ & ios_base::out) || traits_type::eq(traits_type::to_char_type(__c), this->gptr()[-1])) {
+ this->gbump(-1);
+ *this->gptr() = traits_type::to_char_type(__c);
+ return __c;
}
- return traits_type::not_eof(__c);
+ }
+ return traits_type::eof();
}
template <class _CharT, class _Traits>
-basic_streambuf<_CharT, _Traits>*
-basic_filebuf<_CharT, _Traits>::setbuf(char_type* __s, streamsize __n)
-{
- this->setg(nullptr, nullptr, nullptr);
- this->setp(nullptr, nullptr);
- if (__owns_eb_)
- delete [] __extbuf_;
- if (__owns_ib_)
- delete [] __intbuf_;
- __ebs_ = __n;
- if (__ebs_ > sizeof(__extbuf_min_))
- {
- if (__always_noconv_ && __s)
- {
- __extbuf_ = (char*)__s;
- __owns_eb_ = false;
- }
- else
- {
- __extbuf_ = new char[__ebs_];
- __owns_eb_ = true;
- }
- }
- else
- {
- __extbuf_ = __extbuf_min_;
- __ebs_ = sizeof(__extbuf_min_);
- __owns_eb_ = false;
+typename basic_filebuf<_CharT, _Traits>::int_type basic_filebuf<_CharT, _Traits>::overflow(int_type __c) {
+ if (__file_ == nullptr)
+ return traits_type::eof();
+ __write_mode();
+ char_type __1buf;
+ char_type* __pb_save = this->pbase();
+ char_type* __epb_save = this->epptr();
+ if (!traits_type::eq_int_type(__c, traits_type::eof())) {
+ if (this->pptr() == nullptr)
+ this->setp(&__1buf, &__1buf + 1);
+ *this->pptr() = traits_type::to_char_type(__c);
+ this->pbump(1);
+ }
+ if (this->pptr() != this->pbase()) {
+ if (__always_noconv_) {
+ size_t __nmemb = static_cast<size_t>(this->pptr() - this->pbase());
+ if (std::fwrite(this->pbase(), sizeof(char_type), __nmemb, __file_) != __nmemb)
+ return traits_type::eof();
+ } else {
+ char* __extbe = __extbuf_;
+ codecvt_base::result __r;
+ do {
+ if (!__cv_)
+ __throw_bad_cast();
+
+ const char_type* __e;
+ __r = __cv_->out(__st_, this->pbase(), this->pptr(), __e, __extbuf_, __extbuf_ + __ebs_, __extbe);
+ if (__e == this->pbase())
+ return traits_type::eof();
+ if (__r == codecvt_base::noconv) {
+ size_t __nmemb = static_cast<size_t>(this->pptr() - this->pbase());
+ if (std::fwrite(this->pbase(), 1, __nmemb, __file_) != __nmemb)
+ return traits_type::eof();
+ } else if (__r == codecvt_base::ok || __r == codecvt_base::partial) {
+ size_t __nmemb = static_cast<size_t>(__extbe - __extbuf_);
+ if (fwrite(__extbuf_, 1, __nmemb, __file_) != __nmemb)
+ return traits_type::eof();
+ if (__r == codecvt_base::partial) {
+ this->setp(const_cast<char_type*>(__e), this->pptr());
+ this->__pbump(this->epptr() - this->pbase());
+ }
+ } else
+ return traits_type::eof();
+ } while (__r == codecvt_base::partial);
}
- if (!__always_noconv_)
- {
- __ibs_ = max<streamsize>(__n, sizeof(__extbuf_min_));
- if (__s && __ibs_ > sizeof(__extbuf_min_))
- {
- __intbuf_ = __s;
- __owns_ib_ = false;
- }
- else
- {
- __intbuf_ = new char_type[__ibs_];
- __owns_ib_ = true;
- }
+ this->setp(__pb_save, __epb_save);
+ }
+ return traits_type::not_eof(__c);
+}
+
+template <class _CharT, class _Traits>
+basic_streambuf<_CharT, _Traits>* basic_filebuf<_CharT, _Traits>::setbuf(char_type* __s, streamsize __n) {
+ this->setg(nullptr, nullptr, nullptr);
+ this->setp(nullptr, nullptr);
+ if (__owns_eb_)
+ delete[] __extbuf_;
+ if (__owns_ib_)
+ delete[] __intbuf_;
+ __ebs_ = __n;
+ if (__ebs_ > sizeof(__extbuf_min_)) {
+ if (__always_noconv_ && __s) {
+ __extbuf_ = (char*)__s;
+ __owns_eb_ = false;
+ } else {
+ __extbuf_ = new char[__ebs_];
+ __owns_eb_ = true;
}
- else
- {
- __ibs_ = 0;
- __intbuf_ = nullptr;
- __owns_ib_ = false;
+ } else {
+ __extbuf_ = __extbuf_min_;
+ __ebs_ = sizeof(__extbuf_min_);
+ __owns_eb_ = false;
+ }
+ if (!__always_noconv_) {
+ __ibs_ = max<streamsize>(__n, sizeof(__extbuf_min_));
+ if (__s && __ibs_ > sizeof(__extbuf_min_)) {
+ __intbuf_ = __s;
+ __owns_ib_ = false;
+ } else {
+ __intbuf_ = new char_type[__ibs_];
+ __owns_ib_ = true;
}
- return this;
+ } else {
+ __ibs_ = 0;
+ __intbuf_ = nullptr;
+ __owns_ib_ = false;
+ }
+ return this;
}
template <class _CharT, class _Traits>
typename basic_filebuf<_CharT, _Traits>::pos_type
-basic_filebuf<_CharT, _Traits>::seekoff(off_type __off, ios_base::seekdir __way,
- ios_base::openmode)
-{
- if (!__cv_)
- __throw_bad_cast();
-
- int __width = __cv_->encoding();
- if (__file_ == nullptr || (__width <= 0 && __off != 0) || sync())
- return pos_type(off_type(-1));
- // __width > 0 || __off == 0
- int __whence;
- switch (__way)
- {
- case ios_base::beg:
- __whence = SEEK_SET;
- break;
- case ios_base::cur:
- __whence = SEEK_CUR;
- break;
- case ios_base::end:
- __whence = SEEK_END;
- break;
- default:
- return pos_type(off_type(-1));
- }
-#if defined(_LIBCPP_HAS_NO_OFF_T_FUNCTIONS)
- if (fseek(__file_, __width > 0 ? __width * __off : 0, __whence))
- return pos_type(off_type(-1));
- pos_type __r = ftell(__file_);
-#else
- if (::fseeko(__file_, __width > 0 ? __width * __off : 0, __whence))
- return pos_type(off_type(-1));
- pos_type __r = ftello(__file_);
-#endif
- __r.state(__st_);
- return __r;
+basic_filebuf<_CharT, _Traits>::seekoff(off_type __off, ios_base::seekdir __way, ios_base::openmode) {
+ if (!__cv_)
+ __throw_bad_cast();
+
+ int __width = __cv_->encoding();
+ if (__file_ == nullptr || (__width <= 0 && __off != 0) || sync())
+ return pos_type(off_type(-1));
+ // __width > 0 || __off == 0
+ int __whence;
+ switch (__way) {
+ case ios_base::beg:
+ __whence = SEEK_SET;
+ break;
+ case ios_base::cur:
+ __whence = SEEK_CUR;
+ break;
+ case ios_base::end:
+ __whence = SEEK_END;
+ break;
+ default:
+ return pos_type(off_type(-1));
+ }
+# if defined(_LIBCPP_HAS_NO_OFF_T_FUNCTIONS)
+ if (fseek(__file_, __width > 0 ? __width * __off : 0, __whence))
+ return pos_type(off_type(-1));
+ pos_type __r = ftell(__file_);
+# else
+ if (::fseeko(__file_, __width > 0 ? __width * __off : 0, __whence))
+ return pos_type(off_type(-1));
+ pos_type __r = ftello(__file_);
+# endif
+ __r.state(__st_);
+ return __r;
}
template <class _CharT, class _Traits>
typename basic_filebuf<_CharT, _Traits>::pos_type
-basic_filebuf<_CharT, _Traits>::seekpos(pos_type __sp, ios_base::openmode)
-{
- if (__file_ == nullptr || sync())
- return pos_type(off_type(-1));
-#if defined(_LIBCPP_HAS_NO_OFF_T_FUNCTIONS)
- if (fseek(__file_, __sp, SEEK_SET))
- return pos_type(off_type(-1));
-#else
- if (::fseeko(__file_, __sp, SEEK_SET))
- return pos_type(off_type(-1));
-#endif
- __st_ = __sp.state();
- return __sp;
-}
-
-template <class _CharT, class _Traits>
-int
-basic_filebuf<_CharT, _Traits>::sync()
-{
- if (__file_ == nullptr)
- return 0;
- if (!__cv_)
- __throw_bad_cast();
+basic_filebuf<_CharT, _Traits>::seekpos(pos_type __sp, ios_base::openmode) {
+ if (__file_ == nullptr || sync())
+ return pos_type(off_type(-1));
+# if defined(_LIBCPP_HAS_NO_OFF_T_FUNCTIONS)
+ if (fseek(__file_, __sp, SEEK_SET))
+ return pos_type(off_type(-1));
+# else
+ if (::fseeko(__file_, __sp, SEEK_SET))
+ return pos_type(off_type(-1));
+# endif
+ __st_ = __sp.state();
+ return __sp;
+}
+
+template <class _CharT, class _Traits>
+int basic_filebuf<_CharT, _Traits>::sync() {
+ if (__file_ == nullptr)
+ return 0;
+ if (!__cv_)
+ __throw_bad_cast();
- if (__cm_ & ios_base::out)
- {
- if (this->pptr() != this->pbase())
- if (overflow() == traits_type::eof())
- return -1;
- codecvt_base::result __r;
- do
- {
- char* __extbe;
- __r = __cv_->unshift(__st_, __extbuf_, __extbuf_ + __ebs_, __extbe);
- size_t __nmemb = static_cast<size_t>(__extbe - __extbuf_);
- if (fwrite(__extbuf_, 1, __nmemb, __file_) != __nmemb)
- return -1;
- } while (__r == codecvt_base::partial);
- if (__r == codecvt_base::error)
- return -1;
- if (fflush(__file_))
- return -1;
- }
- else if (__cm_ & ios_base::in)
- {
- off_type __c;
- state_type __state = __st_last_;
- bool __update_st = false;
- if (__always_noconv_)
- __c = this->egptr() - this->gptr();
- else
- {
- int __width = __cv_->encoding();
- __c = __extbufend_ - __extbufnext_;
- if (__width > 0)
- __c += __width * (this->egptr() - this->gptr());
- else
- {
- if (this->gptr() != this->egptr())
- {
- const int __off = __cv_->length(__state, __extbuf_,
- __extbufnext_,
- this->gptr() - this->eback());
- __c += __extbufnext_ - __extbuf_ - __off;
- __update_st = true;
- }
- }
+ if (__cm_ & ios_base::out) {
+ if (this->pptr() != this->pbase())
+ if (overflow() == traits_type::eof())
+ return -1;
+ codecvt_base::result __r;
+ do {
+ char* __extbe;
+ __r = __cv_->unshift(__st_, __extbuf_, __extbuf_ + __ebs_, __extbe);
+ size_t __nmemb = static_cast<size_t>(__extbe - __extbuf_);
+ if (fwrite(__extbuf_, 1, __nmemb, __file_) != __nmemb)
+ return -1;
+ } while (__r == codecvt_base::partial);
+ if (__r == codecvt_base::error)
+ return -1;
+ if (fflush(__file_))
+ return -1;
+ } else if (__cm_ & ios_base::in) {
+ off_type __c;
+ state_type __state = __st_last_;
+ bool __update_st = false;
+ if (__always_noconv_)
+ __c = this->egptr() - this->gptr();
+ else {
+ int __width = __cv_->encoding();
+ __c = __extbufend_ - __extbufnext_;
+ if (__width > 0)
+ __c += __width * (this->egptr() - this->gptr());
+ else {
+ if (this->gptr() != this->egptr()) {
+ const int __off = __cv_->length(__state, __extbuf_, __extbufnext_, this->gptr() - this->eback());
+ __c += __extbufnext_ - __extbuf_ - __off;
+ __update_st = true;
}
-#if defined(_LIBCPP_HAS_NO_OFF_T_FUNCTIONS)
- if (fseek(__file_, -__c, SEEK_CUR))
- return -1;
-#else
- if (::fseeko(__file_, -__c, SEEK_CUR))
- return -1;
-#endif
- if (__update_st)
- __st_ = __state;
- __extbufnext_ = __extbufend_ = __extbuf_;
- this->setg(nullptr, nullptr, nullptr);
- __cm_ = 0;
+ }
}
- return 0;
+# if defined(_LIBCPP_HAS_NO_OFF_T_FUNCTIONS)
+ if (fseek(__file_, -__c, SEEK_CUR))
+ return -1;
+# else
+ if (::fseeko(__file_, -__c, SEEK_CUR))
+ return -1;
+# endif
+ if (__update_st)
+ __st_ = __state;
+ __extbufnext_ = __extbufend_ = __extbuf_;
+ this->setg(nullptr, nullptr, nullptr);
+ __cm_ = 0;
+ }
+ return 0;
}
template <class _CharT, class _Traits>
-void
-basic_filebuf<_CharT, _Traits>::imbue(const locale& __loc)
-{
- sync();
- __cv_ = &std::use_facet<codecvt<char_type, char, state_type> >(__loc);
- bool __old_anc = __always_noconv_;
- __always_noconv_ = __cv_->always_noconv();
- if (__old_anc != __always_noconv_)
+void basic_filebuf<_CharT, _Traits>::imbue(const locale& __loc) {
+ sync();
+ __cv_ = &std::use_facet<codecvt<char_type, char, state_type> >(__loc);
+ bool __old_anc = __always_noconv_;
+ __always_noconv_ = __cv_->always_noconv();
+ if (__old_anc != __always_noconv_) {
+ this->setg(nullptr, nullptr, nullptr);
+ this->setp(nullptr, nullptr);
+ // invariant, char_type is char, else we couldn't get here
+ if (__always_noconv_) // need to dump __intbuf_
{
- this->setg(nullptr, nullptr, nullptr);
- this->setp(nullptr, nullptr);
- // invariant, char_type is char, else we couldn't get here
- if (__always_noconv_) // need to dump __intbuf_
- {
- if (__owns_eb_)
- delete [] __extbuf_;
- __owns_eb_ = __owns_ib_;
- __ebs_ = __ibs_;
- __extbuf_ = (char*)__intbuf_;
- __ibs_ = 0;
- __intbuf_ = nullptr;
- __owns_ib_ = false;
- }
- else // need to obtain an __intbuf_.
- { // If __extbuf_ is user-supplied, use it, else new __intbuf_
- if (!__owns_eb_ && __extbuf_ != __extbuf_min_)
- {
- __ibs_ = __ebs_;
- __intbuf_ = (char_type*)__extbuf_;
- __owns_ib_ = false;
- __extbuf_ = new char[__ebs_];
- __owns_eb_ = true;
- }
- else
- {
- __ibs_ = __ebs_;
- __intbuf_ = new char_type[__ibs_];
- __owns_ib_ = true;
- }
- }
+ if (__owns_eb_)
+ delete[] __extbuf_;
+ __owns_eb_ = __owns_ib_;
+ __ebs_ = __ibs_;
+ __extbuf_ = (char*)__intbuf_;
+ __ibs_ = 0;
+ __intbuf_ = nullptr;
+ __owns_ib_ = false;
+ } else // need to obtain an __intbuf_.
+ { // If __extbuf_ is user-supplied, use it, else new __intbuf_
+ if (!__owns_eb_ && __extbuf_ != __extbuf_min_) {
+ __ibs_ = __ebs_;
+ __intbuf_ = (char_type*)__extbuf_;
+ __owns_ib_ = false;
+ __extbuf_ = new char[__ebs_];
+ __owns_eb_ = true;
+ } else {
+ __ibs_ = __ebs_;
+ __intbuf_ = new char_type[__ibs_];
+ __owns_ib_ = true;
+ }
}
+ }
}
template <class _CharT, class _Traits>
-bool
-basic_filebuf<_CharT, _Traits>::__read_mode()
-{
- if (!(__cm_ & ios_base::in))
- {
- this->setp(nullptr, nullptr);
- if (__always_noconv_)
- this->setg((char_type*)__extbuf_,
- (char_type*)__extbuf_ + __ebs_,
- (char_type*)__extbuf_ + __ebs_);
- else
- this->setg(__intbuf_, __intbuf_ + __ibs_, __intbuf_ + __ibs_);
- __cm_ = ios_base::in;
- return true;
- }
- return false;
+bool basic_filebuf<_CharT, _Traits>::__read_mode() {
+ if (!(__cm_ & ios_base::in)) {
+ this->setp(nullptr, nullptr);
+ if (__always_noconv_)
+ this->setg((char_type*)__extbuf_, (char_type*)__extbuf_ + __ebs_, (char_type*)__extbuf_ + __ebs_);
+ else
+ this->setg(__intbuf_, __intbuf_ + __ibs_, __intbuf_ + __ibs_);
+ __cm_ = ios_base::in;
+ return true;
+ }
+ return false;
}
template <class _CharT, class _Traits>
-void
-basic_filebuf<_CharT, _Traits>::__write_mode()
-{
- if (!(__cm_ & ios_base::out))
- {
- this->setg(nullptr, nullptr, nullptr);
- if (__ebs_ > sizeof(__extbuf_min_))
- {
- if (__always_noconv_)
- this->setp((char_type*)__extbuf_,
- (char_type*)__extbuf_ + (__ebs_ - 1));
- else
- this->setp(__intbuf_, __intbuf_ + (__ibs_ - 1));
- }
- else
- this->setp(nullptr, nullptr);
- __cm_ = ios_base::out;
- }
+void basic_filebuf<_CharT, _Traits>::__write_mode() {
+ if (!(__cm_ & ios_base::out)) {
+ this->setg(nullptr, nullptr, nullptr);
+ if (__ebs_ > sizeof(__extbuf_min_)) {
+ if (__always_noconv_)
+ this->setp((char_type*)__extbuf_, (char_type*)__extbuf_ + (__ebs_ - 1));
+ else
+ this->setp(__intbuf_, __intbuf_ + (__ibs_ - 1));
+ } else
+ this->setp(nullptr, nullptr);
+ __cm_ = ios_base::out;
+ }
}
// basic_ifstream
template <class _CharT, class _Traits>
-class _LIBCPP_TEMPLATE_VIS basic_ifstream
- : public basic_istream<_CharT, _Traits>
-{
+class _LIBCPP_TEMPLATE_VIS basic_ifstream : public basic_istream<_CharT, _Traits> {
public:
- typedef _CharT char_type;
- typedef _Traits traits_type;
- typedef typename traits_type::int_type int_type;
- typedef typename traits_type::pos_type pos_type;
- typedef typename traits_type::off_type off_type;
-
- _LIBCPP_HIDE_FROM_ABI
- basic_ifstream();
- _LIBCPP_HIDE_FROM_ABI
- explicit basic_ifstream(const char* __s, ios_base::openmode __mode = ios_base::in);
-#ifdef _LIBCPP_HAS_OPEN_WITH_WCHAR
- _LIBCPP_HIDE_FROM_ABI
- explicit basic_ifstream(const wchar_t* __s, ios_base::openmode __mode = ios_base::in);
-#endif
- _LIBCPP_HIDE_FROM_ABI
- explicit basic_ifstream(const string& __s, ios_base::openmode __mode = ios_base::in);
-#if _LIBCPP_STD_VER >= 17
- _LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY _LIBCPP_HIDE_FROM_ABI
- explicit basic_ifstream(const filesystem::path& __p, ios_base::openmode __mode = ios_base::in)
+ typedef _CharT char_type;
+ typedef _Traits traits_type;
+ typedef typename traits_type::int_type int_type;
+ typedef typename traits_type::pos_type pos_type;
+ typedef typename traits_type::off_type off_type;
+
+ _LIBCPP_HIDE_FROM_ABI basic_ifstream();
+ _LIBCPP_HIDE_FROM_ABI explicit basic_ifstream(const char* __s, ios_base::openmode __mode = ios_base::in);
+# ifdef _LIBCPP_HAS_OPEN_WITH_WCHAR
+ _LIBCPP_HIDE_FROM_ABI explicit basic_ifstream(const wchar_t* __s, ios_base::openmode __mode = ios_base::in);
+# endif
+ _LIBCPP_HIDE_FROM_ABI explicit basic_ifstream(const string& __s, ios_base::openmode __mode = ios_base::in);
+# if _LIBCPP_STD_VER >= 17
+ _LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY _LIBCPP_HIDE_FROM_ABI explicit basic_ifstream(
+ const filesystem::path& __p, ios_base::openmode __mode = ios_base::in)
: basic_ifstream(__p.c_str(), __mode) {}
-#endif // _LIBCPP_STD_VER >= 17
- _LIBCPP_HIDE_FROM_ABI
- basic_ifstream(basic_ifstream&& __rhs);
- _LIBCPP_HIDE_FROM_ABI
- basic_ifstream& operator=(basic_ifstream&& __rhs);
- _LIBCPP_HIDE_FROM_ABI
- void swap(basic_ifstream& __rhs);
-
- _LIBCPP_HIDE_FROM_ABI
- basic_filebuf<char_type, traits_type>* rdbuf() const;
- _LIBCPP_HIDE_FROM_ABI
- bool is_open() const;
- void open(const char* __s, ios_base::openmode __mode = ios_base::in);
-#ifdef _LIBCPP_HAS_OPEN_WITH_WCHAR
- void open(const wchar_t* __s, ios_base::openmode __mode = ios_base::in);
-#endif
- void open(const string& __s, ios_base::openmode __mode = ios_base::in);
-#if _LIBCPP_STD_VER >= 17
- _LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY _LIBCPP_HIDE_FROM_ABI
- void open(const filesystem::path& __p,
- ios_base::openmode __mode = ios_base::in) {
- return open(__p.c_str(), __mode);
- }
-#endif // _LIBCPP_STD_VER >= 17
+# endif // _LIBCPP_STD_VER >= 17
+ _LIBCPP_HIDE_FROM_ABI basic_ifstream(basic_ifstream&& __rhs);
+ _LIBCPP_HIDE_FROM_ABI basic_ifstream& operator=(basic_ifstream&& __rhs);
+ _LIBCPP_HIDE_FROM_ABI void swap(basic_ifstream& __rhs);
+
+ _LIBCPP_HIDE_FROM_ABI basic_filebuf<char_type, traits_type>* rdbuf() const;
+ _LIBCPP_HIDE_FROM_ABI bool is_open() const;
+ void open(const char* __s, ios_base::openmode __mode = ios_base::in);
+# ifdef _LIBCPP_HAS_OPEN_WITH_WCHAR
+ void open(const wchar_t* __s, ios_base::openmode __mode = ios_base::in);
+# endif
+ void open(const string& __s, ios_base::openmode __mode = ios_base::in);
+# if _LIBCPP_STD_VER >= 17
+ _LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY _LIBCPP_HIDE_FROM_ABI void
+ open(const filesystem::path& __p, ios_base::openmode __mode = ios_base::in) {
+ return open(__p.c_str(), __mode);
+ }
+# endif // _LIBCPP_STD_VER >= 17
- _LIBCPP_HIDE_FROM_ABI
- void __open(int __fd, ios_base::openmode __mode);
- _LIBCPP_HIDE_FROM_ABI
- void close();
+ _LIBCPP_HIDE_FROM_ABI void __open(int __fd, ios_base::openmode __mode);
+ _LIBCPP_HIDE_FROM_ABI void close();
private:
- basic_filebuf<char_type, traits_type> __sb_;
+ basic_filebuf<char_type, traits_type> __sb_;
};
template <class _CharT, class _Traits>
-inline
-basic_ifstream<_CharT, _Traits>::basic_ifstream()
- : basic_istream<char_type, traits_type>(&__sb_)
-{
-}
+inline basic_ifstream<_CharT, _Traits>::basic_ifstream() : basic_istream<char_type, traits_type>(&__sb_) {}
template <class _CharT, class _Traits>
-inline
-basic_ifstream<_CharT, _Traits>::basic_ifstream(const char* __s, ios_base::openmode __mode)
- : basic_istream<char_type, traits_type>(&__sb_)
-{
- if (__sb_.open(__s, __mode | ios_base::in) == nullptr)
- this->setstate(ios_base::failbit);
+inline basic_ifstream<_CharT, _Traits>::basic_ifstream(const char* __s, ios_base::openmode __mode)
+ : basic_istream<char_type, traits_type>(&__sb_) {
+ if (__sb_.open(__s, __mode | ios_base::in) == nullptr)
+ this->setstate(ios_base::failbit);
}
-#ifdef _LIBCPP_HAS_OPEN_WITH_WCHAR
+# ifdef _LIBCPP_HAS_OPEN_WITH_WCHAR
template <class _CharT, class _Traits>
-inline
-basic_ifstream<_CharT, _Traits>::basic_ifstream(const wchar_t* __s, ios_base::openmode __mode)
- : basic_istream<char_type, traits_type>(&__sb_)
-{
- if (__sb_.open(__s, __mode | ios_base::in) == nullptr)
- this->setstate(ios_base::failbit);
+inline basic_ifstream<_CharT, _Traits>::basic_ifstream(const wchar_t* __s, ios_base::openmode __mode)
+ : basic_istream<char_type, traits_type>(&__sb_) {
+ if (__sb_.open(__s, __mode | ios_base::in) == nullptr)
+ this->setstate(ios_base::failbit);
}
-#endif
+# endif
template <class _CharT, class _Traits>
-inline
-basic_ifstream<_CharT, _Traits>::basic_ifstream(const string& __s, ios_base::openmode __mode)
- : basic_istream<char_type, traits_type>(&__sb_)
-{
- if (__sb_.open(__s, __mode | ios_base::in) == nullptr)
- this->setstate(ios_base::failbit);
+inline basic_ifstream<_CharT, _Traits>::basic_ifstream(const string& __s, ios_base::openmode __mode)
+ : basic_istream<char_type, traits_type>(&__sb_) {
+ if (__sb_.open(__s, __mode | ios_base::in) == nullptr)
+ this->setstate(ios_base::failbit);
}
template <class _CharT, class _Traits>
-inline
-basic_ifstream<_CharT, _Traits>::basic_ifstream(basic_ifstream&& __rhs)
- : basic_istream<char_type, traits_type>(std::move(__rhs)),
- __sb_(std::move(__rhs.__sb_))
-{
- this->set_rdbuf(&__sb_);
+inline basic_ifstream<_CharT, _Traits>::basic_ifstream(basic_ifstream&& __rhs)
+ : basic_istream<char_type, traits_type>(std::move(__rhs)), __sb_(std::move(__rhs.__sb_)) {
+ this->set_rdbuf(&__sb_);
}
template <class _CharT, class _Traits>
-inline
-basic_ifstream<_CharT, _Traits>&
-basic_ifstream<_CharT, _Traits>::operator=(basic_ifstream&& __rhs)
-{
- basic_istream<char_type, traits_type>::operator=(std::move(__rhs));
- __sb_ = std::move(__rhs.__sb_);
- return *this;
+inline basic_ifstream<_CharT, _Traits>& basic_ifstream<_CharT, _Traits>::operator=(basic_ifstream&& __rhs) {
+ basic_istream<char_type, traits_type>::operator=(std::move(__rhs));
+ __sb_ = std::move(__rhs.__sb_);
+ return *this;
}
template <class _CharT, class _Traits>
-inline
-void
-basic_ifstream<_CharT, _Traits>::swap(basic_ifstream& __rhs)
-{
- basic_istream<char_type, traits_type>::swap(__rhs);
- __sb_.swap(__rhs.__sb_);
+inline void basic_ifstream<_CharT, _Traits>::swap(basic_ifstream& __rhs) {
+ basic_istream<char_type, traits_type>::swap(__rhs);
+ __sb_.swap(__rhs.__sb_);
}
template <class _CharT, class _Traits>
-inline _LIBCPP_HIDE_FROM_ABI
-void
-swap(basic_ifstream<_CharT, _Traits>& __x, basic_ifstream<_CharT, _Traits>& __y)
-{
- __x.swap(__y);
+inline _LIBCPP_HIDE_FROM_ABI void swap(basic_ifstream<_CharT, _Traits>& __x, basic_ifstream<_CharT, _Traits>& __y) {
+ __x.swap(__y);
}
template <class _CharT, class _Traits>
-inline
-basic_filebuf<_CharT, _Traits>*
-basic_ifstream<_CharT, _Traits>::rdbuf() const
-{
- return const_cast<basic_filebuf<char_type, traits_type>*>(&__sb_);
+inline basic_filebuf<_CharT, _Traits>* basic_ifstream<_CharT, _Traits>::rdbuf() const {
+ return const_cast<basic_filebuf<char_type, traits_type>*>(&__sb_);
}
template <class _CharT, class _Traits>
-inline
-bool
-basic_ifstream<_CharT, _Traits>::is_open() const
-{
- return __sb_.is_open();
+inline bool basic_ifstream<_CharT, _Traits>::is_open() const {
+ return __sb_.is_open();
}
template <class _CharT, class _Traits>
-void
-basic_ifstream<_CharT, _Traits>::open(const char* __s, ios_base::openmode __mode)
-{
- if (__sb_.open(__s, __mode | ios_base::in))
- this->clear();
- else
- this->setstate(ios_base::failbit);
+void basic_ifstream<_CharT, _Traits>::open(const char* __s, ios_base::openmode __mode) {
+ if (__sb_.open(__s, __mode | ios_base::in))
+ this->clear();
+ else
+ this->setstate(ios_base::failbit);
}
-#ifdef _LIBCPP_HAS_OPEN_WITH_WCHAR
+# ifdef _LIBCPP_HAS_OPEN_WITH_WCHAR
template <class _CharT, class _Traits>
-void
-basic_ifstream<_CharT, _Traits>::open(const wchar_t* __s, ios_base::openmode __mode)
-{
- if (__sb_.open(__s, __mode | ios_base::in))
- this->clear();
- else
- this->setstate(ios_base::failbit);
+void basic_ifstream<_CharT, _Traits>::open(const wchar_t* __s, ios_base::openmode __mode) {
+ if (__sb_.open(__s, __mode | ios_base::in))
+ this->clear();
+ else
+ this->setstate(ios_base::failbit);
}
-#endif
+# endif
template <class _CharT, class _Traits>
-void
-basic_ifstream<_CharT, _Traits>::open(const string& __s, ios_base::openmode __mode)
-{
- if (__sb_.open(__s, __mode | ios_base::in))
- this->clear();
- else
- this->setstate(ios_base::failbit);
+void basic_ifstream<_CharT, _Traits>::open(const string& __s, ios_base::openmode __mode) {
+ if (__sb_.open(__s, __mode | ios_base::in))
+ this->clear();
+ else
+ this->setstate(ios_base::failbit);
}
template <class _CharT, class _Traits>
-inline
-void basic_ifstream<_CharT, _Traits>::__open(int __fd,
- ios_base::openmode __mode) {
+inline void basic_ifstream<_CharT, _Traits>::__open(int __fd, ios_base::openmode __mode) {
if (__sb_.__open(__fd, __mode | ios_base::in))
this->clear();
else
@@ -1362,200 +1156,149 @@ void basic_ifstream<_CharT, _Traits>::__open(int __fd,
}
template <class _CharT, class _Traits>
-inline
-void
-basic_ifstream<_CharT, _Traits>::close()
-{
- if (__sb_.close() == 0)
- this->setstate(ios_base::failbit);
+inline void basic_ifstream<_CharT, _Traits>::close() {
+ if (__sb_.close() == 0)
+ this->setstate(ios_base::failbit);
}
// basic_ofstream
template <class _CharT, class _Traits>
-class _LIBCPP_TEMPLATE_VIS basic_ofstream
- : public basic_ostream<_CharT, _Traits>
-{
+class _LIBCPP_TEMPLATE_VIS basic_ofstream : public basic_ostream<_CharT, _Traits> {
public:
- typedef _CharT char_type;
- typedef _Traits traits_type;
- typedef typename traits_type::int_type int_type;
- typedef typename traits_type::pos_type pos_type;
- typedef typename traits_type::off_type off_type;
-
- _LIBCPP_HIDE_FROM_ABI
- basic_ofstream();
- _LIBCPP_HIDE_FROM_ABI
- explicit basic_ofstream(const char* __s, ios_base::openmode __mode = ios_base::out);
-#ifdef _LIBCPP_HAS_OPEN_WITH_WCHAR
- _LIBCPP_HIDE_FROM_ABI
- explicit basic_ofstream(const wchar_t* __s, ios_base::openmode __mode = ios_base::out);
-#endif
- _LIBCPP_HIDE_FROM_ABI
- explicit basic_ofstream(const string& __s, ios_base::openmode __mode = ios_base::out);
-
-#if _LIBCPP_STD_VER >= 17
- _LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY _LIBCPP_HIDE_FROM_ABI
- explicit basic_ofstream(const filesystem::path& __p, ios_base::openmode __mode = ios_base::out)
+ typedef _CharT char_type;
+ typedef _Traits traits_type;
+ typedef typename traits_type::int_type int_type;
+ typedef typename traits_type::pos_type pos_type;
+ typedef typename traits_type::off_type off_type;
+
+ _LIBCPP_HIDE_FROM_ABI basic_ofstream();
+ _LIBCPP_HIDE_FROM_ABI explicit basic_ofstream(const char* __s, ios_base::openmode __mode = ios_base::out);
+# ifdef _LIBCPP_HAS_OPEN_WITH_WCHAR
+ _LIBCPP_HIDE_FROM_ABI explicit basic_ofstream(const wchar_t* __s, ios_base::openmode __mode = ios_base::out);
+# endif
+ _LIBCPP_HIDE_FROM_ABI explicit basic_ofstream(const string& __s, ios_base::openmode __mode = ios_base::out);
+
+# if _LIBCPP_STD_VER >= 17
+ _LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY _LIBCPP_HIDE_FROM_ABI explicit basic_ofstream(
+ const filesystem::path& __p, ios_base::openmode __mode = ios_base::out)
: basic_ofstream(__p.c_str(), __mode) {}
-#endif // _LIBCPP_STD_VER >= 17
-
- _LIBCPP_HIDE_FROM_ABI
- basic_ofstream(basic_ofstream&& __rhs);
- _LIBCPP_HIDE_FROM_ABI
- basic_ofstream& operator=(basic_ofstream&& __rhs);
- _LIBCPP_HIDE_FROM_ABI
- void swap(basic_ofstream& __rhs);
-
- _LIBCPP_HIDE_FROM_ABI
- basic_filebuf<char_type, traits_type>* rdbuf() const;
- _LIBCPP_HIDE_FROM_ABI
- bool is_open() const;
- void open(const char* __s, ios_base::openmode __mode = ios_base::out);
-#ifdef _LIBCPP_HAS_OPEN_WITH_WCHAR
- void open(const wchar_t* __s, ios_base::openmode __mode = ios_base::out);
-#endif
- void open(const string& __s, ios_base::openmode __mode = ios_base::out);
-
-#if _LIBCPP_STD_VER >= 17
- _LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY _LIBCPP_HIDE_FROM_ABI
- void open(const filesystem::path& __p, ios_base::openmode __mode = ios_base::out)
- { return open(__p.c_str(), __mode); }
-#endif // _LIBCPP_STD_VER >= 17
+# endif // _LIBCPP_STD_VER >= 17
+
+ _LIBCPP_HIDE_FROM_ABI basic_ofstream(basic_ofstream&& __rhs);
+ _LIBCPP_HIDE_FROM_ABI basic_ofstream& operator=(basic_ofstream&& __rhs);
+ _LIBCPP_HIDE_FROM_ABI void swap(basic_ofstream& __rhs);
+
+ _LIBCPP_HIDE_FROM_ABI basic_filebuf<char_type, traits_type>* rdbuf() const;
+ _LIBCPP_HIDE_FROM_ABI bool is_open() const;
+ void open(const char* __s, ios_base::openmode __mode = ios_base::out);
+# ifdef _LIBCPP_HAS_OPEN_WITH_WCHAR
+ void open(const wchar_t* __s, ios_base::openmode __mode = ios_base::out);
+# endif
+ void open(const string& __s, ios_base::openmode __mode = ios_base::out);
+
+# if _LIBCPP_STD_VER >= 17
+ _LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY _LIBCPP_HIDE_FROM_ABI void
+ open(const filesystem::path& __p, ios_base::openmode __mode = ios_base::out) {
+ return open(__p.c_str(), __mode);
+ }
+# endif // _LIBCPP_STD_VER >= 17
- _LIBCPP_HIDE_FROM_ABI
- void __open(int __fd, ios_base::openmode __mode);
- _LIBCPP_HIDE_FROM_ABI
- void close();
+ _LIBCPP_HIDE_FROM_ABI void __open(int __fd, ios_base::openmode __mode);
+ _LIBCPP_HIDE_FROM_ABI void close();
private:
- basic_filebuf<char_type, traits_type> __sb_;
+ basic_filebuf<char_type, traits_type> __sb_;
};
template <class _CharT, class _Traits>
-inline
-basic_ofstream<_CharT, _Traits>::basic_ofstream()
- : basic_ostream<char_type, traits_type>(&__sb_)
-{
-}
+inline basic_ofstream<_CharT, _Traits>::basic_ofstream() : basic_ostream<char_type, traits_type>(&__sb_) {}
template <class _CharT, class _Traits>
-inline
-basic_ofstream<_CharT, _Traits>::basic_ofstream(const char* __s, ios_base::openmode __mode)
- : basic_ostream<char_type, traits_type>(&__sb_)
-{
- if (__sb_.open(__s, __mode | ios_base::out) == nullptr)
- this->setstate(ios_base::failbit);
+inline basic_ofstream<_CharT, _Traits>::basic_ofstream(const char* __s, ios_base::openmode __mode)
+ : basic_ostream<char_type, traits_type>(&__sb_) {
+ if (__sb_.open(__s, __mode | ios_base::out) == nullptr)
+ this->setstate(ios_base::failbit);
}
-#ifdef _LIBCPP_HAS_OPEN_WITH_WCHAR
+# ifdef _LIBCPP_HAS_OPEN_WITH_WCHAR
template <class _CharT, class _Traits>
-inline
-basic_ofstream<_CharT, _Traits>::basic_ofstream(const wchar_t* __s, ios_base::openmode __mode)
- : basic_ostream<char_type, traits_type>(&__sb_)
-{
- if (__sb_.open(__s, __mode | ios_base::out) == nullptr)
- this->setstate(ios_base::failbit);
+inline basic_ofstream<_CharT, _Traits>::basic_ofstream(const wchar_t* __s, ios_base::openmode __mode)
+ : basic_ostream<char_type, traits_type>(&__sb_) {
+ if (__sb_.open(__s, __mode | ios_base::out) == nullptr)
+ this->setstate(ios_base::failbit);
}
-#endif
+# endif
template <class _CharT, class _Traits>
-inline
-basic_ofstream<_CharT, _Traits>::basic_ofstream(const string& __s, ios_base::openmode __mode)
- : basic_ostream<char_type, traits_type>(&__sb_)
-{
- if (__sb_.open(__s, __mode | ios_base::out) == nullptr)
- this->setstate(ios_base::failbit);
+inline basic_ofstream<_CharT, _Traits>::basic_ofstream(const string& __s, ios_base::openmode __mode)
+ : basic_ostream<char_type, traits_type>(&__sb_) {
+ if (__sb_.open(__s, __mode | ios_base::out) == nullptr)
+ this->setstate(ios_base::failbit);
}
template <class _CharT, class _Traits>
-inline
-basic_ofstream<_CharT, _Traits>::basic_ofstream(basic_ofstream&& __rhs)
- : basic_ostream<char_type, traits_type>(std::move(__rhs)),
- __sb_(std::move(__rhs.__sb_))
-{
- this->set_rdbuf(&__sb_);
+inline basic_ofstream<_CharT, _Traits>::basic_ofstream(basic_ofstream&& __rhs)
+ : basic_ostream<char_type, traits_type>(std::move(__rhs)), __sb_(std::move(__rhs.__sb_)) {
+ this->set_rdbuf(&__sb_);
}
template <class _CharT, class _Traits>
-inline
-basic_ofstream<_CharT, _Traits>&
-basic_ofstream<_CharT, _Traits>::operator=(basic_ofstream&& __rhs)
-{
- basic_ostream<char_type, traits_type>::operator=(std::move(__rhs));
- __sb_ = std::move(__rhs.__sb_);
- return *this;
+inline basic_ofstream<_CharT, _Traits>& basic_ofstream<_CharT, _Traits>::operator=(basic_ofstream&& __rhs) {
+ basic_ostream<char_type, traits_type>::operator=(std::move(__rhs));
+ __sb_ = std::move(__rhs.__sb_);
+ return *this;
}
template <class _CharT, class _Traits>
-inline
-void
-basic_ofstream<_CharT, _Traits>::swap(basic_ofstream& __rhs)
-{
- basic_ostream<char_type, traits_type>::swap(__rhs);
- __sb_.swap(__rhs.__sb_);
+inline void basic_ofstream<_CharT, _Traits>::swap(basic_ofstream& __rhs) {
+ basic_ostream<char_type, traits_type>::swap(__rhs);
+ __sb_.swap(__rhs.__sb_);
}
template <class _CharT, class _Traits>
-inline _LIBCPP_HIDE_FROM_ABI
-void
-swap(basic_ofstream<_CharT, _Traits>& __x, basic_ofstream<_CharT, _Traits>& __y)
-{
- __x.swap(__y);
+inline _LIBCPP_HIDE_FROM_ABI void swap(basic_ofstream<_CharT, _Traits>& __x, basic_ofstream<_CharT, _Traits>& __y) {
+ __x.swap(__y);
}
template <class _CharT, class _Traits>
-inline
-basic_filebuf<_CharT, _Traits>*
-basic_ofstream<_CharT, _Traits>::rdbuf() const
-{
- return const_cast<basic_filebuf<char_type, traits_type>*>(&__sb_);
+inline basic_filebuf<_CharT, _Traits>* basic_ofstream<_CharT, _Traits>::rdbuf() const {
+ return const_cast<basic_filebuf<char_type, traits_type>*>(&__sb_);
}
template <class _CharT, class _Traits>
-inline
-bool
-basic_ofstream<_CharT, _Traits>::is_open() const
-{
- return __sb_.is_open();
+inline bool basic_ofstream<_CharT, _Traits>::is_open() const {
+ return __sb_.is_open();
}
template <class _CharT, class _Traits>
-void
-basic_ofstream<_CharT, _Traits>::open(const char* __s, ios_base::openmode __mode)
-{
- if (__sb_.open(__s, __mode | ios_base::out))
- this->clear();
- else
- this->setstate(ios_base::failbit);
+void basic_ofstream<_CharT, _Traits>::open(const char* __s, ios_base::openmode __mode) {
+ if (__sb_.open(__s, __mode | ios_base::out))
+ this->clear();
+ else
+ this->setstate(ios_base::failbit);
}
-#ifdef _LIBCPP_HAS_OPEN_WITH_WCHAR
+# ifdef _LIBCPP_HAS_OPEN_WITH_WCHAR
template <class _CharT, class _Traits>
-void
-basic_ofstream<_CharT, _Traits>::open(const wchar_t* __s, ios_base::openmode __mode)
-{
- if (__sb_.open(__s, __mode | ios_base::out))
- this->clear();
- else
- this->setstate(ios_base::failbit);
+void basic_ofstream<_CharT, _Traits>::open(const wchar_t* __s, ios_base::openmode __mode) {
+ if (__sb_.open(__s, __mode | ios_base::out))
+ this->clear();
+ else
+ this->setstate(ios_base::failbit);
}
-#endif
+# endif
template <class _CharT, class _Traits>
-void
-basic_ofstream<_CharT, _Traits>::open(const string& __s, ios_base::openmode __mode)
-{
- if (__sb_.open(__s, __mode | ios_base::out))
- this->clear();
- else
- this->setstate(ios_base::failbit);
+void basic_ofstream<_CharT, _Traits>::open(const string& __s, ios_base::openmode __mode) {
+ if (__sb_.open(__s, __mode | ios_base::out))
+ this->clear();
+ else
+ this->setstate(ios_base::failbit);
}
template <class _CharT, class _Traits>
-inline
-void basic_ofstream<_CharT, _Traits>::__open(int __fd,
- ios_base::openmode __mode) {
+inline void basic_ofstream<_CharT, _Traits>::__open(int __fd, ios_base::openmode __mode) {
if (__sb_.__open(__fd, __mode | ios_base::out))
this->clear();
else
@@ -1563,210 +1306,162 @@ void basic_ofstream<_CharT, _Traits>::__open(int __fd,
}
template <class _CharT, class _Traits>
-inline
-void
-basic_ofstream<_CharT, _Traits>::close()
-{
- if (__sb_.close() == nullptr)
- this->setstate(ios_base::failbit);
+inline void basic_ofstream<_CharT, _Traits>::close() {
+ if (__sb_.close() == nullptr)
+ this->setstate(ios_base::failbit);
}
// basic_fstream
template <class _CharT, class _Traits>
-class _LIBCPP_TEMPLATE_VIS basic_fstream
- : public basic_iostream<_CharT, _Traits>
-{
+class _LIBCPP_TEMPLATE_VIS basic_fstream : public basic_iostream<_CharT, _Traits> {
public:
- typedef _CharT char_type;
- typedef _Traits traits_type;
- typedef typename traits_type::int_type int_type;
- typedef typename traits_type::pos_type pos_type;
- typedef typename traits_type::off_type off_type;
-
- _LIBCPP_HIDE_FROM_ABI
- basic_fstream();
- _LIBCPP_HIDE_FROM_ABI
- explicit basic_fstream(const char* __s, ios_base::openmode __mode = ios_base::in | ios_base::out);
-#ifdef _LIBCPP_HAS_OPEN_WITH_WCHAR
- _LIBCPP_HIDE_FROM_ABI
- explicit basic_fstream(const wchar_t* __s, ios_base::openmode __mode = ios_base::in | ios_base::out);
-#endif
- _LIBCPP_HIDE_FROM_ABI
- explicit basic_fstream(const string& __s, ios_base::openmode __mode = ios_base::in | ios_base::out);
-
-#if _LIBCPP_STD_VER >= 17
- _LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY _LIBCPP_HIDE_FROM_ABI
- explicit basic_fstream(const filesystem::path& __p, ios_base::openmode __mode = ios_base::in | ios_base::out)
+ typedef _CharT char_type;
+ typedef _Traits traits_type;
+ typedef typename traits_type::int_type int_type;
+ typedef typename traits_type::pos_type pos_type;
+ typedef typename traits_type::off_type off_type;
+
+ _LIBCPP_HIDE_FROM_ABI basic_fstream();
+ _LIBCPP_HIDE_FROM_ABI explicit basic_fstream(const char* __s,
+ ios_base::openmode __mode = ios_base::in | ios_base::out);
+# ifdef _LIBCPP_HAS_OPEN_WITH_WCHAR
+ _LIBCPP_HIDE_FROM_ABI explicit basic_fstream(const wchar_t* __s,
+ ios_base::openmode __mode = ios_base::in | ios_base::out);
+# endif
+ _LIBCPP_HIDE_FROM_ABI explicit basic_fstream(const string& __s,
+ ios_base::openmode __mode = ios_base::in | ios_base::out);
+
+# if _LIBCPP_STD_VER >= 17
+ _LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY _LIBCPP_HIDE_FROM_ABI explicit basic_fstream(
+ const filesystem::path& __p, ios_base::openmode __mode = ios_base::in | ios_base::out)
: basic_fstream(__p.c_str(), __mode) {}
-#endif // _LIBCPP_STD_VER >= 17
+# endif // _LIBCPP_STD_VER >= 17
- _LIBCPP_HIDE_FROM_ABI
- basic_fstream(basic_fstream&& __rhs);
+ _LIBCPP_HIDE_FROM_ABI basic_fstream(basic_fstream&& __rhs);
- _LIBCPP_HIDE_FROM_ABI
- basic_fstream& operator=(basic_fstream&& __rhs);
+ _LIBCPP_HIDE_FROM_ABI basic_fstream& operator=(basic_fstream&& __rhs);
- _LIBCPP_HIDE_FROM_ABI
- void swap(basic_fstream& __rhs);
+ _LIBCPP_HIDE_FROM_ABI void swap(basic_fstream& __rhs);
- _LIBCPP_HIDE_FROM_ABI
- basic_filebuf<char_type, traits_type>* rdbuf() const;
- _LIBCPP_HIDE_FROM_ABI
- bool is_open() const;
- _LIBCPP_HIDE_FROM_ABI void open(const char* __s, ios_base::openmode __mode = ios_base::in | ios_base::out);
-#ifdef _LIBCPP_HAS_OPEN_WITH_WCHAR
- void open(const wchar_t* __s, ios_base::openmode __mode = ios_base::in | ios_base::out);
-#endif
- _LIBCPP_HIDE_FROM_ABI void open(const string& __s, ios_base::openmode __mode = ios_base::in | ios_base::out);
+ _LIBCPP_HIDE_FROM_ABI basic_filebuf<char_type, traits_type>* rdbuf() const;
+ _LIBCPP_HIDE_FROM_ABI bool is_open() const;
+ _LIBCPP_HIDE_FROM_ABI void open(const char* __s, ios_base::openmode __mode = ios_base::in | ios_base::out);
+# ifdef _LIBCPP_HAS_OPEN_WITH_WCHAR
+ void open(const wchar_t* __s, ios_base::openmode __mode = ios_base::in | ios_base::out);
+# endif
+ _LIBCPP_HIDE_FROM_ABI void open(const string& __s, ios_base::openmode __mode = ios_base::in | ios_base::out);
-#if _LIBCPP_STD_VER >= 17
- _LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY _LIBCPP_HIDE_FROM_ABI
- void open(const filesystem::path& __p, ios_base::openmode __mode = ios_base::in|ios_base::out)
- { return open(__p.c_str(), __mode); }
-#endif // _LIBCPP_STD_VER >= 17
+# if _LIBCPP_STD_VER >= 17
+ _LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY _LIBCPP_HIDE_FROM_ABI void
+ open(const filesystem::path& __p, ios_base::openmode __mode = ios_base::in | ios_base::out) {
+ return open(__p.c_str(), __mode);
+ }
+# endif // _LIBCPP_STD_VER >= 17
- _LIBCPP_HIDE_FROM_ABI
- void close();
+ _LIBCPP_HIDE_FROM_ABI void close();
private:
- basic_filebuf<char_type, traits_type> __sb_;
+ basic_filebuf<char_type, traits_type> __sb_;
};
template <class _CharT, class _Traits>
-inline
-basic_fstream<_CharT, _Traits>::basic_fstream()
- : basic_iostream<char_type, traits_type>(&__sb_)
-{
-}
+inline basic_fstream<_CharT, _Traits>::basic_fstream() : basic_iostream<char_type, traits_type>(&__sb_) {}
template <class _CharT, class _Traits>
-inline
-basic_fstream<_CharT, _Traits>::basic_fstream(const char* __s, ios_base::openmode __mode)
- : basic_iostream<char_type, traits_type>(&__sb_)
-{
- if (__sb_.open(__s, __mode) == nullptr)
- this->setstate(ios_base::failbit);
+inline basic_fstream<_CharT, _Traits>::basic_fstream(const char* __s, ios_base::openmode __mode)
+ : basic_iostream<char_type, traits_type>(&__sb_) {
+ if (__sb_.open(__s, __mode) == nullptr)
+ this->setstate(ios_base::failbit);
}
-#ifdef _LIBCPP_HAS_OPEN_WITH_WCHAR
+# ifdef _LIBCPP_HAS_OPEN_WITH_WCHAR
template <class _CharT, class _Traits>
-inline
-basic_fstream<_CharT, _Traits>::basic_fstream(const wchar_t* __s, ios_base::openmode __mode)
- : basic_iostream<char_type, traits_type>(&__sb_)
-{
- if (__sb_.open(__s, __mode) == nullptr)
- this->setstate(ios_base::failbit);
+inline basic_fstream<_CharT, _Traits>::basic_fstream(const wchar_t* __s, ios_base::openmode __mode)
+ : basic_iostream<char_type, traits_type>(&__sb_) {
+ if (__sb_.open(__s, __mode) == nullptr)
+ this->setstate(ios_base::failbit);
}
-#endif
+# endif
template <class _CharT, class _Traits>
-inline
-basic_fstream<_CharT, _Traits>::basic_fstream(const string& __s, ios_base::openmode __mode)
- : basic_iostream<char_type, traits_type>(&__sb_)
-{
- if (__sb_.open(__s, __mode) == nullptr)
- this->setstate(ios_base::failbit);
+inline basic_fstream<_CharT, _Traits>::basic_fstream(const string& __s, ios_base::openmode __mode)
+ : basic_iostream<char_type, traits_type>(&__sb_) {
+ if (__sb_.open(__s, __mode) == nullptr)
+ this->setstate(ios_base::failbit);
}
template <class _CharT, class _Traits>
-inline
-basic_fstream<_CharT, _Traits>::basic_fstream(basic_fstream&& __rhs)
- : basic_iostream<char_type, traits_type>(std::move(__rhs)),
- __sb_(std::move(__rhs.__sb_))
-{
- this->set_rdbuf(&__sb_);
+inline basic_fstream<_CharT, _Traits>::basic_fstream(basic_fstream&& __rhs)
+ : basic_iostream<char_type, traits_type>(std::move(__rhs)), __sb_(std::move(__rhs.__sb_)) {
+ this->set_rdbuf(&__sb_);
}
template <class _CharT, class _Traits>
-inline
-basic_fstream<_CharT, _Traits>&
-basic_fstream<_CharT, _Traits>::operator=(basic_fstream&& __rhs)
-{
- basic_iostream<char_type, traits_type>::operator=(std::move(__rhs));
- __sb_ = std::move(__rhs.__sb_);
- return *this;
+inline basic_fstream<_CharT, _Traits>& basic_fstream<_CharT, _Traits>::operator=(basic_fstream&& __rhs) {
+ basic_iostream<char_type, traits_type>::operator=(std::move(__rhs));
+ __sb_ = std::move(__rhs.__sb_);
+ return *this;
}
template <class _CharT, class _Traits>
-inline
-void
-basic_fstream<_CharT, _Traits>::swap(basic_fstream& __rhs)
-{
- basic_iostream<char_type, traits_type>::swap(__rhs);
- __sb_.swap(__rhs.__sb_);
+inline void basic_fstream<_CharT, _Traits>::swap(basic_fstream& __rhs) {
+ basic_iostream<char_type, traits_type>::swap(__rhs);
+ __sb_.swap(__rhs.__sb_);
}
template <class _CharT, class _Traits>
-inline _LIBCPP_HIDE_FROM_ABI
-void
-swap(basic_fstream<_CharT, _Traits>& __x, basic_fstream<_CharT, _Traits>& __y)
-{
- __x.swap(__y);
+inline _LIBCPP_HIDE_FROM_ABI void swap(basic_fstream<_CharT, _Traits>& __x, basic_fstream<_CharT, _Traits>& __y) {
+ __x.swap(__y);
}
template <class _CharT, class _Traits>
-inline
-basic_filebuf<_CharT, _Traits>*
-basic_fstream<_CharT, _Traits>::rdbuf() const
-{
- return const_cast<basic_filebuf<char_type, traits_type>*>(&__sb_);
+inline basic_filebuf<_CharT, _Traits>* basic_fstream<_CharT, _Traits>::rdbuf() const {
+ return const_cast<basic_filebuf<char_type, traits_type>*>(&__sb_);
}
template <class _CharT, class _Traits>
-inline
-bool
-basic_fstream<_CharT, _Traits>::is_open() const
-{
- return __sb_.is_open();
+inline bool basic_fstream<_CharT, _Traits>::is_open() const {
+ return __sb_.is_open();
}
template <class _CharT, class _Traits>
-void
-basic_fstream<_CharT, _Traits>::open(const char* __s, ios_base::openmode __mode)
-{
- if (__sb_.open(__s, __mode))
- this->clear();
- else
- this->setstate(ios_base::failbit);
+void basic_fstream<_CharT, _Traits>::open(const char* __s, ios_base::openmode __mode) {
+ if (__sb_.open(__s, __mode))
+ this->clear();
+ else
+ this->setstate(ios_base::failbit);
}
-#ifdef _LIBCPP_HAS_OPEN_WITH_WCHAR
+# ifdef _LIBCPP_HAS_OPEN_WITH_WCHAR
template <class _CharT, class _Traits>
-void
-basic_fstream<_CharT, _Traits>::open(const wchar_t* __s, ios_base::openmode __mode)
-{
- if (__sb_.open(__s, __mode))
- this->clear();
- else
- this->setstate(ios_base::failbit);
+void basic_fstream<_CharT, _Traits>::open(const wchar_t* __s, ios_base::openmode __mode) {
+ if (__sb_.open(__s, __mode))
+ this->clear();
+ else
+ this->setstate(ios_base::failbit);
}
-#endif
+# endif
template <class _CharT, class _Traits>
-void
-basic_fstream<_CharT, _Traits>::open(const string& __s, ios_base::openmode __mode)
-{
- if (__sb_.open(__s, __mode))
- this->clear();
- else
- this->setstate(ios_base::failbit);
+void basic_fstream<_CharT, _Traits>::open(const string& __s, ios_base::openmode __mode) {
+ if (__sb_.open(__s, __mode))
+ this->clear();
+ else
+ this->setstate(ios_base::failbit);
}
template <class _CharT, class _Traits>
-inline
-void
-basic_fstream<_CharT, _Traits>::close()
-{
- if (__sb_.close() == nullptr)
- this->setstate(ios_base::failbit);
+inline void basic_fstream<_CharT, _Traits>::close() {
+ if (__sb_.close() == nullptr)
+ this->setstate(ios_base::failbit);
}
-#if _LIBCPP_AVAILABILITY_HAS_ADDITIONAL_IOSTREAM_EXPLICIT_INSTANTIATIONS_1
+# if _LIBCPP_AVAILABILITY_HAS_ADDITIONAL_IOSTREAM_EXPLICIT_INSTANTIATIONS_1
extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_ifstream<char>;
extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_ofstream<char>;
extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_filebuf<char>;
-#endif
+# endif
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/future b/contrib/llvm-project/libcxx/include/future
index ab645b7d3dcb..92ba18821069 100644
--- a/contrib/llvm-project/libcxx/include/future
+++ b/contrib/llvm-project/libcxx/include/future
@@ -397,19 +397,14 @@ template <class R, class Alloc> struct uses_allocator<packaged_task<R>, Alloc>;
#endif
#ifdef _LIBCPP_HAS_NO_THREADS
-# error "<future> is not supported since libc++ has been configured without support for threads."
+# error "<future> is not supported since libc++ has been configured without support for threads."
#endif
_LIBCPP_BEGIN_NAMESPACE_STD
-//enum class future_errc
-_LIBCPP_DECLARE_STRONG_ENUM(future_errc)
-{
- future_already_retrieved = 1,
- promise_already_satisfied,
- no_state,
- broken_promise
-};
+// enum class future_errc
+_LIBCPP_DECLARE_STRONG_ENUM(future_errc){
+ future_already_retrieved = 1, promise_already_satisfied, no_state, broken_promise};
_LIBCPP_DECLARE_STRONG_ENUM_EPILOG(future_errc)
template <>
@@ -417,1807 +412,1460 @@ struct _LIBCPP_TEMPLATE_VIS is_error_code_enum<future_errc> : public true_type {
#ifdef _LIBCPP_CXX03_LANG
template <>
-struct _LIBCPP_TEMPLATE_VIS is_error_code_enum<future_errc::__lx> : public true_type { };
+struct _LIBCPP_TEMPLATE_VIS is_error_code_enum<future_errc::__lx> : public true_type {};
#endif
-//enum class launch
-_LIBCPP_DECLARE_STRONG_ENUM(launch)
-{
- async = 1,
- deferred = 2,
- any = async | deferred
-};
+// enum class launch
+_LIBCPP_DECLARE_STRONG_ENUM(launch){async = 1, deferred = 2, any = async | deferred};
_LIBCPP_DECLARE_STRONG_ENUM_EPILOG(launch)
#ifndef _LIBCPP_CXX03_LANG
typedef underlying_type<launch>::type __launch_underlying_type;
-inline _LIBCPP_HIDE_FROM_ABI
-_LIBCPP_CONSTEXPR
-launch
-operator&(launch __x, launch __y)
-{
- return static_cast<launch>(static_cast<__launch_underlying_type>(__x) &
- static_cast<__launch_underlying_type>(__y));
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR launch operator&(launch __x, launch __y) {
+ return static_cast<launch>(static_cast<__launch_underlying_type>(__x) & static_cast<__launch_underlying_type>(__y));
}
-inline _LIBCPP_HIDE_FROM_ABI
-_LIBCPP_CONSTEXPR
-launch
-operator|(launch __x, launch __y)
-{
- return static_cast<launch>(static_cast<__launch_underlying_type>(__x) |
- static_cast<__launch_underlying_type>(__y));
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR launch operator|(launch __x, launch __y) {
+ return static_cast<launch>(static_cast<__launch_underlying_type>(__x) | static_cast<__launch_underlying_type>(__y));
}
-inline _LIBCPP_HIDE_FROM_ABI
-_LIBCPP_CONSTEXPR
-launch
-operator^(launch __x, launch __y)
-{
- return static_cast<launch>(static_cast<__launch_underlying_type>(__x) ^
- static_cast<__launch_underlying_type>(__y));
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR launch operator^(launch __x, launch __y) {
+ return static_cast<launch>(static_cast<__launch_underlying_type>(__x) ^ static_cast<__launch_underlying_type>(__y));
}
-inline _LIBCPP_HIDE_FROM_ABI
-_LIBCPP_CONSTEXPR
-launch
-operator~(launch __x)
-{
- return static_cast<launch>(~static_cast<__launch_underlying_type>(__x) & 3);
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR launch operator~(launch __x) {
+ return static_cast<launch>(~static_cast<__launch_underlying_type>(__x) & 3);
}
-inline _LIBCPP_HIDE_FROM_ABI
-launch&
-operator&=(launch& __x, launch __y)
-{
- __x = __x & __y; return __x;
+inline _LIBCPP_HIDE_FROM_ABI launch& operator&=(launch& __x, launch __y) {
+ __x = __x & __y;
+ return __x;
}
-inline _LIBCPP_HIDE_FROM_ABI
-launch&
-operator|=(launch& __x, launch __y)
-{
- __x = __x | __y; return __x;
+inline _LIBCPP_HIDE_FROM_ABI launch& operator|=(launch& __x, launch __y) {
+ __x = __x | __y;
+ return __x;
}
-inline _LIBCPP_HIDE_FROM_ABI
-launch&
-operator^=(launch& __x, launch __y)
-{
- __x = __x ^ __y; return __x;
+inline _LIBCPP_HIDE_FROM_ABI launch& operator^=(launch& __x, launch __y) {
+ __x = __x ^ __y;
+ return __x;
}
#endif // !_LIBCPP_CXX03_LANG
-//enum class future_status
-_LIBCPP_DECLARE_STRONG_ENUM(future_status)
-{
- ready,
- timeout,
- deferred
-};
+// enum class future_status
+_LIBCPP_DECLARE_STRONG_ENUM(future_status){ready, timeout, deferred};
_LIBCPP_DECLARE_STRONG_ENUM_EPILOG(future_status)
_LIBCPP_EXPORTED_FROM_ABI const error_category& future_category() _NOEXCEPT;
-inline _LIBCPP_HIDE_FROM_ABI
-error_code
-make_error_code(future_errc __e) _NOEXCEPT
-{
- return error_code(static_cast<int>(__e), future_category());
+inline _LIBCPP_HIDE_FROM_ABI error_code make_error_code(future_errc __e) _NOEXCEPT {
+ return error_code(static_cast<int>(__e), future_category());
}
-inline _LIBCPP_HIDE_FROM_ABI
-error_condition
-make_error_condition(future_errc __e) _NOEXCEPT
-{
- return error_condition(static_cast<int>(__e), future_category());
+inline _LIBCPP_HIDE_FROM_ABI error_condition make_error_condition(future_errc __e) _NOEXCEPT {
+ return error_condition(static_cast<int>(__e), future_category());
}
_LIBCPP_NORETURN inline _LIBCPP_HIDE_FROM_ABI void __throw_future_error(future_errc __ev);
class _LIBCPP_EXPORTED_FROM_ABI future_error : public logic_error {
- error_code __ec_;
+ error_code __ec_;
- future_error(error_code);
- friend void __throw_future_error(future_errc);
- template <class> friend class promise;
+ future_error(error_code);
+ friend void __throw_future_error(future_errc);
+ template <class>
+ friend class promise;
public:
#if _LIBCPP_STD_VER >= 17
- _LIBCPP_HIDE_FROM_ABI explicit future_error(future_errc __ec) : future_error(std::make_error_code(__ec)) {}
+ _LIBCPP_HIDE_FROM_ABI explicit future_error(future_errc __ec) : future_error(std::make_error_code(__ec)) {}
#endif
- _LIBCPP_HIDE_FROM_ABI
- const error_code& code() const _NOEXCEPT {return __ec_;}
+ _LIBCPP_HIDE_FROM_ABI const error_code& code() const _NOEXCEPT { return __ec_; }
- _LIBCPP_HIDE_FROM_ABI future_error(const future_error&) _NOEXCEPT = default;
- ~future_error() _NOEXCEPT override;
+ _LIBCPP_HIDE_FROM_ABI future_error(const future_error&) _NOEXCEPT = default;
+ ~future_error() _NOEXCEPT override;
};
// Declared above std::future_error
-void __throw_future_error(future_errc __ev)
-{
+void __throw_future_error(future_errc __ev) {
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- throw future_error(make_error_code(__ev));
+ throw future_error(make_error_code(__ev));
#else
- (void)__ev;
- _LIBCPP_VERBOSE_ABORT("future_error was thrown in -fno-exceptions mode");
+ (void)__ev;
+ _LIBCPP_VERBOSE_ABORT("future_error was thrown in -fno-exceptions mode");
#endif
}
class _LIBCPP_EXPORTED_FROM_ABI __assoc_sub_state : public __shared_count {
protected:
- exception_ptr __exception_;
- mutable mutex __mut_;
- mutable condition_variable __cv_;
- unsigned __state_;
+ exception_ptr __exception_;
+ mutable mutex __mut_;
+ mutable condition_variable __cv_;
+ unsigned __state_;
+
+ void __on_zero_shared() _NOEXCEPT override;
+ void __sub_wait(unique_lock<mutex>& __lk);
- void __on_zero_shared() _NOEXCEPT override;
- void __sub_wait(unique_lock<mutex>& __lk);
public:
- enum
- {
- __constructed = 1,
- __future_attached = 2,
- ready = 4,
- deferred = 8
- };
-
- _LIBCPP_HIDE_FROM_ABI
- __assoc_sub_state() : __state_(0) {}
-
- _LIBCPP_HIDE_FROM_ABI
- bool __has_value() const
- {return (__state_ & __constructed) || (__exception_ != nullptr);}
-
- _LIBCPP_HIDE_FROM_ABI
- void __attach_future() {
- lock_guard<mutex> __lk(__mut_);
- bool __has_future_attached = (__state_ & __future_attached) != 0;
- if (__has_future_attached)
- __throw_future_error(future_errc::future_already_retrieved);
- this->__add_shared();
- __state_ |= __future_attached;
- }
-
- _LIBCPP_HIDE_FROM_ABI
- void __set_deferred() {__state_ |= deferred;}
-
- void __make_ready();
- _LIBCPP_HIDE_FROM_ABI
- bool __is_ready() const {return (__state_ & ready) != 0;}
+ enum { __constructed = 1, __future_attached = 2, ready = 4, deferred = 8 };
- void set_value();
- void set_value_at_thread_exit();
+ _LIBCPP_HIDE_FROM_ABI __assoc_sub_state() : __state_(0) {}
- void set_exception(exception_ptr __p);
- void set_exception_at_thread_exit(exception_ptr __p);
+ _LIBCPP_HIDE_FROM_ABI bool __has_value() const { return (__state_ & __constructed) || (__exception_ != nullptr); }
- void copy();
+ _LIBCPP_HIDE_FROM_ABI void __attach_future() {
+ lock_guard<mutex> __lk(__mut_);
+ bool __has_future_attached = (__state_ & __future_attached) != 0;
+ if (__has_future_attached)
+ __throw_future_error(future_errc::future_already_retrieved);
+ this->__add_shared();
+ __state_ |= __future_attached;
+ }
- void wait();
- template <class _Rep, class _Period>
- future_status
- _LIBCPP_HIDE_FROM_ABI
- wait_for(const chrono::duration<_Rep, _Period>& __rel_time) const;
- template <class _Clock, class _Duration>
- _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
- future_status
- wait_until(const chrono::time_point<_Clock, _Duration>& __abs_time) const;
+ _LIBCPP_HIDE_FROM_ABI void __set_deferred() { __state_ |= deferred; }
+
+ void __make_ready();
+ _LIBCPP_HIDE_FROM_ABI bool __is_ready() const { return (__state_ & ready) != 0; }
+
+ void set_value();
+ void set_value_at_thread_exit();
- virtual void __execute();
+ void set_exception(exception_ptr __p);
+ void set_exception_at_thread_exit(exception_ptr __p);
+
+ void copy();
+
+ void wait();
+ template <class _Rep, class _Period>
+ future_status _LIBCPP_HIDE_FROM_ABI wait_for(const chrono::duration<_Rep, _Period>& __rel_time) const;
+ template <class _Clock, class _Duration>
+ _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS future_status
+ wait_until(const chrono::time_point<_Clock, _Duration>& __abs_time) const;
+
+ virtual void __execute();
};
template <class _Clock, class _Duration>
-future_status
-__assoc_sub_state::wait_until(const chrono::time_point<_Clock, _Duration>& __abs_time) const
-{
- unique_lock<mutex> __lk(__mut_);
- if (__state_ & deferred)
- return future_status::deferred;
- while (!(__state_ & ready) && _Clock::now() < __abs_time)
- __cv_.wait_until(__lk, __abs_time);
- if (__state_ & ready)
- return future_status::ready;
- return future_status::timeout;
+future_status __assoc_sub_state::wait_until(const chrono::time_point<_Clock, _Duration>& __abs_time) const {
+ unique_lock<mutex> __lk(__mut_);
+ if (__state_ & deferred)
+ return future_status::deferred;
+ while (!(__state_ & ready) && _Clock::now() < __abs_time)
+ __cv_.wait_until(__lk, __abs_time);
+ if (__state_ & ready)
+ return future_status::ready;
+ return future_status::timeout;
}
template <class _Rep, class _Period>
-inline
-future_status
-__assoc_sub_state::wait_for(const chrono::duration<_Rep, _Period>& __rel_time) const
-{
- return wait_until(chrono::steady_clock::now() + __rel_time);
+inline future_status __assoc_sub_state::wait_for(const chrono::duration<_Rep, _Period>& __rel_time) const {
+ return wait_until(chrono::steady_clock::now() + __rel_time);
}
template <class _Rp>
-class _LIBCPP_HIDDEN __assoc_state : public __assoc_sub_state
-{
- typedef __assoc_sub_state base;
-_LIBCPP_SUPPRESS_DEPRECATED_PUSH
- typedef typename aligned_storage<sizeof(_Rp), _LIBCPP_ALIGNOF(_Rp)>::type _Up;
-_LIBCPP_SUPPRESS_DEPRECATED_POP
+class _LIBCPP_HIDDEN __assoc_state : public __assoc_sub_state {
+ typedef __assoc_sub_state base;
+ _LIBCPP_SUPPRESS_DEPRECATED_PUSH
+ typedef typename aligned_storage<sizeof(_Rp), _LIBCPP_ALIGNOF(_Rp)>::type _Up;
+ _LIBCPP_SUPPRESS_DEPRECATED_POP
+
protected:
- _Up __value_;
+ _Up __value_;
- _LIBCPP_HIDE_FROM_ABI_VIRTUAL void __on_zero_shared() _NOEXCEPT override;
-public:
+ _LIBCPP_HIDE_FROM_ABI_VIRTUAL void __on_zero_shared() _NOEXCEPT override;
- template <class _Arg>
- _LIBCPP_HIDE_FROM_ABI void set_value(_Arg&& __arg);
+public:
+ template <class _Arg>
+ _LIBCPP_HIDE_FROM_ABI void set_value(_Arg&& __arg);
- template <class _Arg>
- _LIBCPP_HIDE_FROM_ABI void set_value_at_thread_exit(_Arg&& __arg);
+ template <class _Arg>
+ _LIBCPP_HIDE_FROM_ABI void set_value_at_thread_exit(_Arg&& __arg);
- _LIBCPP_HIDE_FROM_ABI _Rp move();
- _LIBCPP_HIDE_FROM_ABI __add_lvalue_reference_t<_Rp> copy();
+ _LIBCPP_HIDE_FROM_ABI _Rp move();
+ _LIBCPP_HIDE_FROM_ABI __add_lvalue_reference_t<_Rp> copy();
};
template <class _Rp>
-void
-__assoc_state<_Rp>::__on_zero_shared() _NOEXCEPT
-{
- if (this->__state_ & base::__constructed)
- reinterpret_cast<_Rp*>(&__value_)->~_Rp();
- delete this;
+void __assoc_state<_Rp>::__on_zero_shared() _NOEXCEPT {
+ if (this->__state_ & base::__constructed)
+ reinterpret_cast<_Rp*>(&__value_)->~_Rp();
+ delete this;
}
template <class _Rp>
template <class _Arg>
-void
-__assoc_state<_Rp>::set_value(_Arg&& __arg)
-{
- unique_lock<mutex> __lk(this->__mut_);
- if (this->__has_value())
- __throw_future_error(future_errc::promise_already_satisfied);
- ::new ((void*)&__value_) _Rp(std::forward<_Arg>(__arg));
- this->__state_ |= base::__constructed | base::ready;
- __cv_.notify_all();
+void __assoc_state<_Rp>::set_value(_Arg&& __arg) {
+ unique_lock<mutex> __lk(this->__mut_);
+ if (this->__has_value())
+ __throw_future_error(future_errc::promise_already_satisfied);
+ ::new ((void*)&__value_) _Rp(std::forward<_Arg>(__arg));
+ this->__state_ |= base::__constructed | base::ready;
+ __cv_.notify_all();
}
template <class _Rp>
template <class _Arg>
-void
-__assoc_state<_Rp>::set_value_at_thread_exit(_Arg&& __arg)
-{
- unique_lock<mutex> __lk(this->__mut_);
- if (this->__has_value())
- __throw_future_error(future_errc::promise_already_satisfied);
- ::new ((void*)&__value_) _Rp(std::forward<_Arg>(__arg));
- this->__state_ |= base::__constructed;
- __thread_local_data()->__make_ready_at_thread_exit(this);
+void __assoc_state<_Rp>::set_value_at_thread_exit(_Arg&& __arg) {
+ unique_lock<mutex> __lk(this->__mut_);
+ if (this->__has_value())
+ __throw_future_error(future_errc::promise_already_satisfied);
+ ::new ((void*)&__value_) _Rp(std::forward<_Arg>(__arg));
+ this->__state_ |= base::__constructed;
+ __thread_local_data()->__make_ready_at_thread_exit(this);
}
template <class _Rp>
-_Rp
-__assoc_state<_Rp>::move()
-{
- unique_lock<mutex> __lk(this->__mut_);
- this->__sub_wait(__lk);
- if (this->__exception_ != nullptr)
- std::rethrow_exception(this->__exception_);
- return std::move(*reinterpret_cast<_Rp*>(&__value_));
+_Rp __assoc_state<_Rp>::move() {
+ unique_lock<mutex> __lk(this->__mut_);
+ this->__sub_wait(__lk);
+ if (this->__exception_ != nullptr)
+ std::rethrow_exception(this->__exception_);
+ return std::move(*reinterpret_cast<_Rp*>(&__value_));
}
template <class _Rp>
-__add_lvalue_reference_t<_Rp>
-__assoc_state<_Rp>::copy()
-{
- unique_lock<mutex> __lk(this->__mut_);
- this->__sub_wait(__lk);
- if (this->__exception_ != nullptr)
- std::rethrow_exception(this->__exception_);
- return *reinterpret_cast<_Rp*>(&__value_);
+__add_lvalue_reference_t<_Rp> __assoc_state<_Rp>::copy() {
+ unique_lock<mutex> __lk(this->__mut_);
+ this->__sub_wait(__lk);
+ if (this->__exception_ != nullptr)
+ std::rethrow_exception(this->__exception_);
+ return *reinterpret_cast<_Rp*>(&__value_);
}
template <class _Rp>
-class __assoc_state<_Rp&> : public __assoc_sub_state
-{
- typedef __assoc_sub_state base;
- typedef _Rp* _Up;
+class __assoc_state<_Rp&> : public __assoc_sub_state {
+ typedef __assoc_sub_state base;
+ typedef _Rp* _Up;
+
protected:
- _Up __value_;
+ _Up __value_;
- _LIBCPP_HIDE_FROM_ABI_VIRTUAL void __on_zero_shared() _NOEXCEPT override;
-public:
+ _LIBCPP_HIDE_FROM_ABI_VIRTUAL void __on_zero_shared() _NOEXCEPT override;
- _LIBCPP_HIDE_FROM_ABI void set_value(_Rp& __arg);
- _LIBCPP_HIDE_FROM_ABI void set_value_at_thread_exit(_Rp& __arg);
+public:
+ _LIBCPP_HIDE_FROM_ABI void set_value(_Rp& __arg);
+ _LIBCPP_HIDE_FROM_ABI void set_value_at_thread_exit(_Rp& __arg);
- _LIBCPP_HIDE_FROM_ABI _Rp& copy();
+ _LIBCPP_HIDE_FROM_ABI _Rp& copy();
};
template <class _Rp>
-void
-__assoc_state<_Rp&>::__on_zero_shared() _NOEXCEPT
-{
- delete this;
+void __assoc_state<_Rp&>::__on_zero_shared() _NOEXCEPT {
+ delete this;
}
template <class _Rp>
-void
-__assoc_state<_Rp&>::set_value(_Rp& __arg)
-{
- unique_lock<mutex> __lk(this->__mut_);
- if (this->__has_value())
- __throw_future_error(future_errc::promise_already_satisfied);
- __value_ = std::addressof(__arg);
- this->__state_ |= base::__constructed | base::ready;
- __cv_.notify_all();
+void __assoc_state<_Rp&>::set_value(_Rp& __arg) {
+ unique_lock<mutex> __lk(this->__mut_);
+ if (this->__has_value())
+ __throw_future_error(future_errc::promise_already_satisfied);
+ __value_ = std::addressof(__arg);
+ this->__state_ |= base::__constructed | base::ready;
+ __cv_.notify_all();
}
template <class _Rp>
-void
-__assoc_state<_Rp&>::set_value_at_thread_exit(_Rp& __arg)
-{
- unique_lock<mutex> __lk(this->__mut_);
- if (this->__has_value())
- __throw_future_error(future_errc::promise_already_satisfied);
- __value_ = std::addressof(__arg);
- this->__state_ |= base::__constructed;
- __thread_local_data()->__make_ready_at_thread_exit(this);
+void __assoc_state<_Rp&>::set_value_at_thread_exit(_Rp& __arg) {
+ unique_lock<mutex> __lk(this->__mut_);
+ if (this->__has_value())
+ __throw_future_error(future_errc::promise_already_satisfied);
+ __value_ = std::addressof(__arg);
+ this->__state_ |= base::__constructed;
+ __thread_local_data()->__make_ready_at_thread_exit(this);
}
template <class _Rp>
-_Rp&
-__assoc_state<_Rp&>::copy()
-{
- unique_lock<mutex> __lk(this->__mut_);
- this->__sub_wait(__lk);
- if (this->__exception_ != nullptr)
- std::rethrow_exception(this->__exception_);
- return *__value_;
+_Rp& __assoc_state<_Rp&>::copy() {
+ unique_lock<mutex> __lk(this->__mut_);
+ this->__sub_wait(__lk);
+ if (this->__exception_ != nullptr)
+ std::rethrow_exception(this->__exception_);
+ return *__value_;
}
template <class _Rp, class _Alloc>
-class __assoc_state_alloc : public __assoc_state<_Rp>
-{
- typedef __assoc_state<_Rp> base;
- _Alloc __alloc_;
+class __assoc_state_alloc : public __assoc_state<_Rp> {
+ typedef __assoc_state<_Rp> base;
+ _Alloc __alloc_;
+
+ _LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual void __on_zero_shared() _NOEXCEPT;
- _LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual void __on_zero_shared() _NOEXCEPT;
public:
- _LIBCPP_HIDE_FROM_ABI
- explicit __assoc_state_alloc(const _Alloc& __a)
- : __alloc_(__a) {}
+ _LIBCPP_HIDE_FROM_ABI explicit __assoc_state_alloc(const _Alloc& __a) : __alloc_(__a) {}
};
template <class _Rp, class _Alloc>
-void
-__assoc_state_alloc<_Rp, _Alloc>::__on_zero_shared() _NOEXCEPT
-{
- if (this->__state_ & base::__constructed)
- reinterpret_cast<_Rp*>(std::addressof(this->__value_))->~_Rp();
- typedef typename __allocator_traits_rebind<_Alloc, __assoc_state_alloc>::type _Al;
- typedef allocator_traits<_Al> _ATraits;
- typedef pointer_traits<typename _ATraits::pointer> _PTraits;
- _Al __a(__alloc_);
- this->~__assoc_state_alloc();
- __a.deallocate(_PTraits::pointer_to(*this), 1);
+void __assoc_state_alloc<_Rp, _Alloc>::__on_zero_shared() _NOEXCEPT {
+ if (this->__state_ & base::__constructed)
+ reinterpret_cast<_Rp*>(std::addressof(this->__value_))->~_Rp();
+ typedef typename __allocator_traits_rebind<_Alloc, __assoc_state_alloc>::type _Al;
+ typedef allocator_traits<_Al> _ATraits;
+ typedef pointer_traits<typename _ATraits::pointer> _PTraits;
+ _Al __a(__alloc_);
+ this->~__assoc_state_alloc();
+ __a.deallocate(_PTraits::pointer_to(*this), 1);
}
template <class _Rp, class _Alloc>
-class __assoc_state_alloc<_Rp&, _Alloc> : public __assoc_state<_Rp&>
-{
- typedef __assoc_state<_Rp&> base;
- _Alloc __alloc_;
+class __assoc_state_alloc<_Rp&, _Alloc> : public __assoc_state<_Rp&> {
+ typedef __assoc_state<_Rp&> base;
+ _Alloc __alloc_;
+
+ _LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual void __on_zero_shared() _NOEXCEPT;
- _LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual void __on_zero_shared() _NOEXCEPT;
public:
- _LIBCPP_HIDE_FROM_ABI
- explicit __assoc_state_alloc(const _Alloc& __a)
- : __alloc_(__a) {}
+ _LIBCPP_HIDE_FROM_ABI explicit __assoc_state_alloc(const _Alloc& __a) : __alloc_(__a) {}
};
template <class _Rp, class _Alloc>
-void
-__assoc_state_alloc<_Rp&, _Alloc>::__on_zero_shared() _NOEXCEPT
-{
- typedef typename __allocator_traits_rebind<_Alloc, __assoc_state_alloc>::type _Al;
- typedef allocator_traits<_Al> _ATraits;
- typedef pointer_traits<typename _ATraits::pointer> _PTraits;
- _Al __a(__alloc_);
- this->~__assoc_state_alloc();
- __a.deallocate(_PTraits::pointer_to(*this), 1);
+void __assoc_state_alloc<_Rp&, _Alloc>::__on_zero_shared() _NOEXCEPT {
+ typedef typename __allocator_traits_rebind<_Alloc, __assoc_state_alloc>::type _Al;
+ typedef allocator_traits<_Al> _ATraits;
+ typedef pointer_traits<typename _ATraits::pointer> _PTraits;
+ _Al __a(__alloc_);
+ this->~__assoc_state_alloc();
+ __a.deallocate(_PTraits::pointer_to(*this), 1);
}
template <class _Alloc>
-class __assoc_sub_state_alloc : public __assoc_sub_state
-{
- typedef __assoc_sub_state base;
- _Alloc __alloc_;
+class __assoc_sub_state_alloc : public __assoc_sub_state {
+ typedef __assoc_sub_state base;
+ _Alloc __alloc_;
+
+ _LIBCPP_HIDE_FROM_ABI_VIRTUAL void __on_zero_shared() _NOEXCEPT override;
- _LIBCPP_HIDE_FROM_ABI_VIRTUAL void __on_zero_shared() _NOEXCEPT override;
public:
- _LIBCPP_HIDE_FROM_ABI
- explicit __assoc_sub_state_alloc(const _Alloc& __a)
- : __alloc_(__a) {}
+ _LIBCPP_HIDE_FROM_ABI explicit __assoc_sub_state_alloc(const _Alloc& __a) : __alloc_(__a) {}
};
template <class _Alloc>
-void
-__assoc_sub_state_alloc<_Alloc>::__on_zero_shared() _NOEXCEPT
-{
- typedef typename __allocator_traits_rebind<_Alloc, __assoc_sub_state_alloc>::type _Al;
- typedef allocator_traits<_Al> _ATraits;
- typedef pointer_traits<typename _ATraits::pointer> _PTraits;
- _Al __a(__alloc_);
- this->~__assoc_sub_state_alloc();
- __a.deallocate(_PTraits::pointer_to(*this), 1);
+void __assoc_sub_state_alloc<_Alloc>::__on_zero_shared() _NOEXCEPT {
+ typedef typename __allocator_traits_rebind<_Alloc, __assoc_sub_state_alloc>::type _Al;
+ typedef allocator_traits<_Al> _ATraits;
+ typedef pointer_traits<typename _ATraits::pointer> _PTraits;
+ _Al __a(__alloc_);
+ this->~__assoc_sub_state_alloc();
+ __a.deallocate(_PTraits::pointer_to(*this), 1);
}
template <class _Rp, class _Fp>
-class __deferred_assoc_state : public __assoc_state<_Rp>
-{
- typedef __assoc_state<_Rp> base;
+class __deferred_assoc_state : public __assoc_state<_Rp> {
+ typedef __assoc_state<_Rp> base;
- _Fp __func_;
+ _Fp __func_;
public:
- _LIBCPP_HIDE_FROM_ABI
- explicit __deferred_assoc_state(_Fp&& __f);
+ _LIBCPP_HIDE_FROM_ABI explicit __deferred_assoc_state(_Fp&& __f);
- _LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual void __execute();
+ _LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual void __execute();
};
template <class _Rp, class _Fp>
-inline
-__deferred_assoc_state<_Rp, _Fp>::__deferred_assoc_state(_Fp&& __f)
- : __func_(std::forward<_Fp>(__f))
-{
- this->__set_deferred();
+inline __deferred_assoc_state<_Rp, _Fp>::__deferred_assoc_state(_Fp&& __f) : __func_(std::forward<_Fp>(__f)) {
+ this->__set_deferred();
}
template <class _Rp, class _Fp>
-void
-__deferred_assoc_state<_Rp, _Fp>::__execute()
-{
+void __deferred_assoc_state<_Rp, _Fp>::__execute() {
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- try
- {
+ try {
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- this->set_value(__func_());
+ this->set_value(__func_());
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- }
- catch (...)
- {
- this->set_exception(current_exception());
- }
+ } catch (...) {
+ this->set_exception(current_exception());
+ }
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
}
template <class _Fp>
-class __deferred_assoc_state<void, _Fp> : public __assoc_sub_state
-{
- typedef __assoc_sub_state base;
+class __deferred_assoc_state<void, _Fp> : public __assoc_sub_state {
+ typedef __assoc_sub_state base;
- _Fp __func_;
+ _Fp __func_;
public:
- _LIBCPP_HIDE_FROM_ABI
- explicit __deferred_assoc_state(_Fp&& __f);
+ _LIBCPP_HIDE_FROM_ABI explicit __deferred_assoc_state(_Fp&& __f);
- _LIBCPP_HIDE_FROM_ABI_VIRTUAL void __execute() override;
+ _LIBCPP_HIDE_FROM_ABI_VIRTUAL void __execute() override;
};
template <class _Fp>
-inline
-__deferred_assoc_state<void, _Fp>::__deferred_assoc_state(_Fp&& __f)
- : __func_(std::forward<_Fp>(__f))
-{
- this->__set_deferred();
+inline __deferred_assoc_state<void, _Fp>::__deferred_assoc_state(_Fp&& __f) : __func_(std::forward<_Fp>(__f)) {
+ this->__set_deferred();
}
template <class _Fp>
-void
-__deferred_assoc_state<void, _Fp>::__execute()
-{
+void __deferred_assoc_state<void, _Fp>::__execute() {
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- try
- {
+ try {
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- __func_();
- this->set_value();
+ __func_();
+ this->set_value();
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- }
- catch (...)
- {
- this->set_exception(current_exception());
- }
+ } catch (...) {
+ this->set_exception(current_exception());
+ }
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
}
template <class _Rp, class _Fp>
-class __async_assoc_state : public __assoc_state<_Rp>
-{
- typedef __assoc_state<_Rp> base;
+class __async_assoc_state : public __assoc_state<_Rp> {
+ typedef __assoc_state<_Rp> base;
- _Fp __func_;
+ _Fp __func_;
+
+ _LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual void __on_zero_shared() _NOEXCEPT;
- _LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual void __on_zero_shared() _NOEXCEPT;
public:
- _LIBCPP_HIDE_FROM_ABI
- explicit __async_assoc_state(_Fp&& __f);
+ _LIBCPP_HIDE_FROM_ABI explicit __async_assoc_state(_Fp&& __f);
- _LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual void __execute();
+ _LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual void __execute();
};
template <class _Rp, class _Fp>
-inline
-__async_assoc_state<_Rp, _Fp>::__async_assoc_state(_Fp&& __f)
- : __func_(std::forward<_Fp>(__f))
-{
-}
+inline __async_assoc_state<_Rp, _Fp>::__async_assoc_state(_Fp&& __f) : __func_(std::forward<_Fp>(__f)) {}
template <class _Rp, class _Fp>
-void
-__async_assoc_state<_Rp, _Fp>::__execute()
-{
+void __async_assoc_state<_Rp, _Fp>::__execute() {
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- try
- {
+ try {
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- this->set_value(__func_());
+ this->set_value(__func_());
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- }
- catch (...)
- {
- this->set_exception(current_exception());
- }
+ } catch (...) {
+ this->set_exception(current_exception());
+ }
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
}
template <class _Rp, class _Fp>
-void
-__async_assoc_state<_Rp, _Fp>::__on_zero_shared() _NOEXCEPT
-{
- this->wait();
- base::__on_zero_shared();
+void __async_assoc_state<_Rp, _Fp>::__on_zero_shared() _NOEXCEPT {
+ this->wait();
+ base::__on_zero_shared();
}
template <class _Fp>
-class __async_assoc_state<void, _Fp> : public __assoc_sub_state
-{
- typedef __assoc_sub_state base;
+class __async_assoc_state<void, _Fp> : public __assoc_sub_state {
+ typedef __assoc_sub_state base;
+
+ _Fp __func_;
- _Fp __func_;
+ _LIBCPP_HIDE_FROM_ABI_VIRTUAL void __on_zero_shared() _NOEXCEPT override;
- _LIBCPP_HIDE_FROM_ABI_VIRTUAL void __on_zero_shared() _NOEXCEPT override;
public:
- _LIBCPP_HIDE_FROM_ABI
- explicit __async_assoc_state(_Fp&& __f);
+ _LIBCPP_HIDE_FROM_ABI explicit __async_assoc_state(_Fp&& __f);
- _LIBCPP_HIDE_FROM_ABI_VIRTUAL void __execute() override;
+ _LIBCPP_HIDE_FROM_ABI_VIRTUAL void __execute() override;
};
template <class _Fp>
-inline
-__async_assoc_state<void, _Fp>::__async_assoc_state(_Fp&& __f)
- : __func_(std::forward<_Fp>(__f))
-{
-}
+inline __async_assoc_state<void, _Fp>::__async_assoc_state(_Fp&& __f) : __func_(std::forward<_Fp>(__f)) {}
template <class _Fp>
-void
-__async_assoc_state<void, _Fp>::__execute()
-{
+void __async_assoc_state<void, _Fp>::__execute() {
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- try
- {
+ try {
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- __func_();
- this->set_value();
+ __func_();
+ this->set_value();
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- }
- catch (...)
- {
- this->set_exception(current_exception());
- }
+ } catch (...) {
+ this->set_exception(current_exception());
+ }
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
}
template <class _Fp>
-void
-__async_assoc_state<void, _Fp>::__on_zero_shared() _NOEXCEPT
-{
- this->wait();
- base::__on_zero_shared();
+void __async_assoc_state<void, _Fp>::__on_zero_shared() _NOEXCEPT {
+ this->wait();
+ base::__on_zero_shared();
}
-template <class _Rp> class _LIBCPP_TEMPLATE_VIS promise;
-template <class _Rp> class _LIBCPP_TEMPLATE_VIS shared_future;
+template <class _Rp>
+class _LIBCPP_TEMPLATE_VIS promise;
+template <class _Rp>
+class _LIBCPP_TEMPLATE_VIS shared_future;
// future
-template <class _Rp> class _LIBCPP_TEMPLATE_VIS future;
+template <class _Rp>
+class _LIBCPP_TEMPLATE_VIS future;
template <class _Rp, class _Fp>
-_LIBCPP_HIDE_FROM_ABI future<_Rp>
-__make_deferred_assoc_state(_Fp&& __f);
+_LIBCPP_HIDE_FROM_ABI future<_Rp> __make_deferred_assoc_state(_Fp&& __f);
template <class _Rp, class _Fp>
-_LIBCPP_HIDE_FROM_ABI future<_Rp>
-__make_async_assoc_state(_Fp&& __f);
+_LIBCPP_HIDE_FROM_ABI future<_Rp> __make_async_assoc_state(_Fp&& __f);
template <class _Rp>
-class _LIBCPP_TEMPLATE_VIS future
-{
- __assoc_state<_Rp>* __state_;
+class _LIBCPP_TEMPLATE_VIS future {
+ __assoc_state<_Rp>* __state_;
- explicit _LIBCPP_HIDE_FROM_ABI future(__assoc_state<_Rp>* __state);
+ explicit _LIBCPP_HIDE_FROM_ABI future(__assoc_state<_Rp>* __state);
- template <class> friend class promise;
- template <class> friend class shared_future;
+ template <class>
+ friend class promise;
+ template <class>
+ friend class shared_future;
- template <class _R1, class _Fp>
- friend future<_R1> __make_deferred_assoc_state(_Fp&& __f);
- template <class _R1, class _Fp>
- friend future<_R1> __make_async_assoc_state(_Fp&& __f);
+ template <class _R1, class _Fp>
+ friend future<_R1> __make_deferred_assoc_state(_Fp&& __f);
+ template <class _R1, class _Fp>
+ friend future<_R1> __make_async_assoc_state(_Fp&& __f);
public:
- _LIBCPP_HIDE_FROM_ABI
- future() _NOEXCEPT : __state_(nullptr) {}
- _LIBCPP_HIDE_FROM_ABI
- future(future&& __rhs) _NOEXCEPT
- : __state_(__rhs.__state_) {__rhs.__state_ = nullptr;}
- future(const future&) = delete;
- future& operator=(const future&) = delete;
- _LIBCPP_HIDE_FROM_ABI
- future& operator=(future&& __rhs) _NOEXCEPT
- {
- future(std::move(__rhs)).swap(*this);
- return *this;
- }
-
- _LIBCPP_HIDE_FROM_ABI ~future();
- _LIBCPP_HIDE_FROM_ABI
- shared_future<_Rp> share() _NOEXCEPT;
+ _LIBCPP_HIDE_FROM_ABI future() _NOEXCEPT : __state_(nullptr) {}
+ _LIBCPP_HIDE_FROM_ABI future(future&& __rhs) _NOEXCEPT : __state_(__rhs.__state_) { __rhs.__state_ = nullptr; }
+ future(const future&) = delete;
+ future& operator=(const future&) = delete;
+ _LIBCPP_HIDE_FROM_ABI future& operator=(future&& __rhs) _NOEXCEPT {
+ future(std::move(__rhs)).swap(*this);
+ return *this;
+ }
- // retrieving the value
- _LIBCPP_HIDE_FROM_ABI _Rp get();
+ _LIBCPP_HIDE_FROM_ABI ~future();
+ _LIBCPP_HIDE_FROM_ABI shared_future<_Rp> share() _NOEXCEPT;
- _LIBCPP_HIDE_FROM_ABI
- void swap(future& __rhs) _NOEXCEPT {std::swap(__state_, __rhs.__state_);}
+ // retrieving the value
+ _LIBCPP_HIDE_FROM_ABI _Rp get();
- // functions to check state
- _LIBCPP_HIDE_FROM_ABI
- bool valid() const _NOEXCEPT {return __state_ != nullptr;}
+ _LIBCPP_HIDE_FROM_ABI void swap(future& __rhs) _NOEXCEPT { std::swap(__state_, __rhs.__state_); }
- _LIBCPP_HIDE_FROM_ABI
- void wait() const {__state_->wait();}
- template <class _Rep, class _Period>
- _LIBCPP_HIDE_FROM_ABI
- future_status
- wait_for(const chrono::duration<_Rep, _Period>& __rel_time) const
- {return __state_->wait_for(__rel_time);}
- template <class _Clock, class _Duration>
- _LIBCPP_HIDE_FROM_ABI
- future_status
- wait_until(const chrono::time_point<_Clock, _Duration>& __abs_time) const
- {return __state_->wait_until(__abs_time);}
+ // functions to check state
+ _LIBCPP_HIDE_FROM_ABI bool valid() const _NOEXCEPT { return __state_ != nullptr; }
+
+ _LIBCPP_HIDE_FROM_ABI void wait() const { __state_->wait(); }
+ template <class _Rep, class _Period>
+ _LIBCPP_HIDE_FROM_ABI future_status wait_for(const chrono::duration<_Rep, _Period>& __rel_time) const {
+ return __state_->wait_for(__rel_time);
+ }
+ template <class _Clock, class _Duration>
+ _LIBCPP_HIDE_FROM_ABI future_status wait_until(const chrono::time_point<_Clock, _Duration>& __abs_time) const {
+ return __state_->wait_until(__abs_time);
+ }
};
template <class _Rp>
-future<_Rp>::future(__assoc_state<_Rp>* __state)
- : __state_(__state)
-{
- __state_->__attach_future();
+future<_Rp>::future(__assoc_state<_Rp>* __state) : __state_(__state) {
+ __state_->__attach_future();
}
-struct __release_shared_count
-{
- _LIBCPP_HIDE_FROM_ABI void operator()(__shared_count* __p) {__p->__release_shared();}
+struct __release_shared_count {
+ _LIBCPP_HIDE_FROM_ABI void operator()(__shared_count* __p) { __p->__release_shared(); }
};
template <class _Rp>
-future<_Rp>::~future()
-{
- if (__state_)
- __state_->__release_shared();
+future<_Rp>::~future() {
+ if (__state_)
+ __state_->__release_shared();
}
template <class _Rp>
-_Rp
-future<_Rp>::get()
-{
- unique_ptr<__shared_count, __release_shared_count> __guard(__state_);
- __assoc_state<_Rp>* __s = __state_;
- __state_ = nullptr;
- return __s->move();
+_Rp future<_Rp>::get() {
+ unique_ptr<__shared_count, __release_shared_count> __guard(__state_);
+ __assoc_state<_Rp>* __s = __state_;
+ __state_ = nullptr;
+ return __s->move();
}
template <class _Rp>
-class _LIBCPP_TEMPLATE_VIS future<_Rp&>
-{
- __assoc_state<_Rp&>* __state_;
+class _LIBCPP_TEMPLATE_VIS future<_Rp&> {
+ __assoc_state<_Rp&>* __state_;
- explicit _LIBCPP_HIDE_FROM_ABI future(__assoc_state<_Rp&>* __state);
+ explicit _LIBCPP_HIDE_FROM_ABI future(__assoc_state<_Rp&>* __state);
- template <class> friend class promise;
- template <class> friend class shared_future;
+ template <class>
+ friend class promise;
+ template <class>
+ friend class shared_future;
- template <class _R1, class _Fp>
- friend future<_R1> __make_deferred_assoc_state(_Fp&& __f);
- template <class _R1, class _Fp>
- friend future<_R1> __make_async_assoc_state(_Fp&& __f);
+ template <class _R1, class _Fp>
+ friend future<_R1> __make_deferred_assoc_state(_Fp&& __f);
+ template <class _R1, class _Fp>
+ friend future<_R1> __make_async_assoc_state(_Fp&& __f);
public:
- _LIBCPP_HIDE_FROM_ABI
- future() _NOEXCEPT : __state_(nullptr) {}
- _LIBCPP_HIDE_FROM_ABI
- future(future&& __rhs) _NOEXCEPT
- : __state_(__rhs.__state_) {__rhs.__state_ = nullptr;}
- future(const future&) = delete;
- future& operator=(const future&) = delete;
- _LIBCPP_HIDE_FROM_ABI
- future& operator=(future&& __rhs) _NOEXCEPT
- {
- future(std::move(__rhs)).swap(*this);
- return *this;
- }
-
- _LIBCPP_HIDE_FROM_ABI ~future();
- _LIBCPP_HIDE_FROM_ABI
- shared_future<_Rp&> share() _NOEXCEPT;
+ _LIBCPP_HIDE_FROM_ABI future() _NOEXCEPT : __state_(nullptr) {}
+ _LIBCPP_HIDE_FROM_ABI future(future&& __rhs) _NOEXCEPT : __state_(__rhs.__state_) { __rhs.__state_ = nullptr; }
+ future(const future&) = delete;
+ future& operator=(const future&) = delete;
+ _LIBCPP_HIDE_FROM_ABI future& operator=(future&& __rhs) _NOEXCEPT {
+ future(std::move(__rhs)).swap(*this);
+ return *this;
+ }
- // retrieving the value
- _LIBCPP_HIDE_FROM_ABI _Rp& get();
+ _LIBCPP_HIDE_FROM_ABI ~future();
+ _LIBCPP_HIDE_FROM_ABI shared_future<_Rp&> share() _NOEXCEPT;
- _LIBCPP_HIDE_FROM_ABI
- void swap(future& __rhs) _NOEXCEPT {std::swap(__state_, __rhs.__state_);}
+ // retrieving the value
+ _LIBCPP_HIDE_FROM_ABI _Rp& get();
- // functions to check state
- _LIBCPP_HIDE_FROM_ABI
- bool valid() const _NOEXCEPT {return __state_ != nullptr;}
+ _LIBCPP_HIDE_FROM_ABI void swap(future& __rhs) _NOEXCEPT { std::swap(__state_, __rhs.__state_); }
- _LIBCPP_HIDE_FROM_ABI
- void wait() const {__state_->wait();}
- template <class _Rep, class _Period>
- _LIBCPP_HIDE_FROM_ABI
- future_status
- wait_for(const chrono::duration<_Rep, _Period>& __rel_time) const
- {return __state_->wait_for(__rel_time);}
- template <class _Clock, class _Duration>
- _LIBCPP_HIDE_FROM_ABI
- future_status
- wait_until(const chrono::time_point<_Clock, _Duration>& __abs_time) const
- {return __state_->wait_until(__abs_time);}
+ // functions to check state
+ _LIBCPP_HIDE_FROM_ABI bool valid() const _NOEXCEPT { return __state_ != nullptr; }
+
+ _LIBCPP_HIDE_FROM_ABI void wait() const { __state_->wait(); }
+ template <class _Rep, class _Period>
+ _LIBCPP_HIDE_FROM_ABI future_status wait_for(const chrono::duration<_Rep, _Period>& __rel_time) const {
+ return __state_->wait_for(__rel_time);
+ }
+ template <class _Clock, class _Duration>
+ _LIBCPP_HIDE_FROM_ABI future_status wait_until(const chrono::time_point<_Clock, _Duration>& __abs_time) const {
+ return __state_->wait_until(__abs_time);
+ }
};
template <class _Rp>
-future<_Rp&>::future(__assoc_state<_Rp&>* __state)
- : __state_(__state)
-{
- __state_->__attach_future();
+future<_Rp&>::future(__assoc_state<_Rp&>* __state) : __state_(__state) {
+ __state_->__attach_future();
}
template <class _Rp>
-future<_Rp&>::~future()
-{
- if (__state_)
- __state_->__release_shared();
+future<_Rp&>::~future() {
+ if (__state_)
+ __state_->__release_shared();
}
template <class _Rp>
-_Rp&
-future<_Rp&>::get()
-{
- unique_ptr<__shared_count, __release_shared_count> __guard(__state_);
- __assoc_state<_Rp&>* __s = __state_;
- __state_ = nullptr;
- return __s->copy();
+_Rp& future<_Rp&>::get() {
+ unique_ptr<__shared_count, __release_shared_count> __guard(__state_);
+ __assoc_state<_Rp&>* __s = __state_;
+ __state_ = nullptr;
+ return __s->copy();
}
template <>
-class _LIBCPP_EXPORTED_FROM_ABI future<void>
-{
- __assoc_sub_state* __state_;
+class _LIBCPP_EXPORTED_FROM_ABI future<void> {
+ __assoc_sub_state* __state_;
- explicit future(__assoc_sub_state* __state);
+ explicit future(__assoc_sub_state* __state);
- template <class> friend class promise;
- template <class> friend class shared_future;
+ template <class>
+ friend class promise;
+ template <class>
+ friend class shared_future;
- template <class _R1, class _Fp>
- friend future<_R1> __make_deferred_assoc_state(_Fp&& __f);
- template <class _R1, class _Fp>
- friend future<_R1> __make_async_assoc_state(_Fp&& __f);
+ template <class _R1, class _Fp>
+ friend future<_R1> __make_deferred_assoc_state(_Fp&& __f);
+ template <class _R1, class _Fp>
+ friend future<_R1> __make_async_assoc_state(_Fp&& __f);
public:
- _LIBCPP_HIDE_FROM_ABI
- future() _NOEXCEPT : __state_(nullptr) {}
- _LIBCPP_HIDE_FROM_ABI
- future(future&& __rhs) _NOEXCEPT
- : __state_(__rhs.__state_) {__rhs.__state_ = nullptr;}
- future(const future&) = delete;
- future& operator=(const future&) = delete;
- _LIBCPP_HIDE_FROM_ABI
- future& operator=(future&& __rhs) _NOEXCEPT
- {
- future(std::move(__rhs)).swap(*this);
- return *this;
- }
+ _LIBCPP_HIDE_FROM_ABI future() _NOEXCEPT : __state_(nullptr) {}
+ _LIBCPP_HIDE_FROM_ABI future(future&& __rhs) _NOEXCEPT : __state_(__rhs.__state_) { __rhs.__state_ = nullptr; }
+ future(const future&) = delete;
+ future& operator=(const future&) = delete;
+ _LIBCPP_HIDE_FROM_ABI future& operator=(future&& __rhs) _NOEXCEPT {
+ future(std::move(__rhs)).swap(*this);
+ return *this;
+ }
- ~future();
- _LIBCPP_HIDE_FROM_ABI
- shared_future<void> share() _NOEXCEPT;
+ ~future();
+ _LIBCPP_HIDE_FROM_ABI shared_future<void> share() _NOEXCEPT;
- // retrieving the value
- void get();
+ // retrieving the value
+ void get();
- _LIBCPP_HIDE_FROM_ABI
- void swap(future& __rhs) _NOEXCEPT {std::swap(__state_, __rhs.__state_);}
+ _LIBCPP_HIDE_FROM_ABI void swap(future& __rhs) _NOEXCEPT { std::swap(__state_, __rhs.__state_); }
- // functions to check state
- _LIBCPP_HIDE_FROM_ABI
- bool valid() const _NOEXCEPT {return __state_ != nullptr;}
+ // functions to check state
+ _LIBCPP_HIDE_FROM_ABI bool valid() const _NOEXCEPT { return __state_ != nullptr; }
- _LIBCPP_HIDE_FROM_ABI
- void wait() const {__state_->wait();}
- template <class _Rep, class _Period>
- _LIBCPP_HIDE_FROM_ABI
- future_status
- wait_for(const chrono::duration<_Rep, _Period>& __rel_time) const
- {return __state_->wait_for(__rel_time);}
- template <class _Clock, class _Duration>
- _LIBCPP_HIDE_FROM_ABI
- future_status
- wait_until(const chrono::time_point<_Clock, _Duration>& __abs_time) const
- {return __state_->wait_until(__abs_time);}
+ _LIBCPP_HIDE_FROM_ABI void wait() const { __state_->wait(); }
+ template <class _Rep, class _Period>
+ _LIBCPP_HIDE_FROM_ABI future_status wait_for(const chrono::duration<_Rep, _Period>& __rel_time) const {
+ return __state_->wait_for(__rel_time);
+ }
+ template <class _Clock, class _Duration>
+ _LIBCPP_HIDE_FROM_ABI future_status wait_until(const chrono::time_point<_Clock, _Duration>& __abs_time) const {
+ return __state_->wait_until(__abs_time);
+ }
};
template <class _Rp>
-inline _LIBCPP_HIDE_FROM_ABI
-void
-swap(future<_Rp>& __x, future<_Rp>& __y) _NOEXCEPT
-{
- __x.swap(__y);
+inline _LIBCPP_HIDE_FROM_ABI void swap(future<_Rp>& __x, future<_Rp>& __y) _NOEXCEPT {
+ __x.swap(__y);
}
// promise<R>
-template <class _Callable> class packaged_task;
+template <class _Callable>
+class packaged_task;
template <class _Rp>
-class _LIBCPP_TEMPLATE_VIS promise
-{
- __assoc_state<_Rp>* __state_;
+class _LIBCPP_TEMPLATE_VIS promise {
+ __assoc_state<_Rp>* __state_;
- _LIBCPP_HIDE_FROM_ABI
- explicit promise(nullptr_t) _NOEXCEPT : __state_(nullptr) {}
+ _LIBCPP_HIDE_FROM_ABI explicit promise(nullptr_t) _NOEXCEPT : __state_(nullptr) {}
+
+ template <class>
+ friend class packaged_task;
- template <class> friend class packaged_task;
public:
- _LIBCPP_HIDE_FROM_ABI promise();
- template <class _Alloc>
- _LIBCPP_HIDE_FROM_ABI promise(allocator_arg_t, const _Alloc& __a);
- _LIBCPP_HIDE_FROM_ABI
- promise(promise&& __rhs) _NOEXCEPT
- : __state_(__rhs.__state_) {__rhs.__state_ = nullptr;}
- promise(const promise& __rhs) = delete;
- _LIBCPP_HIDE_FROM_ABI ~promise();
+ _LIBCPP_HIDE_FROM_ABI promise();
+ template <class _Alloc>
+ _LIBCPP_HIDE_FROM_ABI promise(allocator_arg_t, const _Alloc& __a);
+ _LIBCPP_HIDE_FROM_ABI promise(promise&& __rhs) _NOEXCEPT : __state_(__rhs.__state_) { __rhs.__state_ = nullptr; }
+ promise(const promise& __rhs) = delete;
+ _LIBCPP_HIDE_FROM_ABI ~promise();
+
+ // assignment
+ _LIBCPP_HIDE_FROM_ABI promise& operator=(promise&& __rhs) _NOEXCEPT {
+ promise(std::move(__rhs)).swap(*this);
+ return *this;
+ }
+ promise& operator=(const promise& __rhs) = delete;
- // assignment
- _LIBCPP_HIDE_FROM_ABI
- promise& operator=(promise&& __rhs) _NOEXCEPT
- {
- promise(std::move(__rhs)).swap(*this);
- return *this;
- }
- promise& operator=(const promise& __rhs) = delete;
+ _LIBCPP_HIDE_FROM_ABI void swap(promise& __rhs) _NOEXCEPT { std::swap(__state_, __rhs.__state_); }
- _LIBCPP_HIDE_FROM_ABI
- void swap(promise& __rhs) _NOEXCEPT {std::swap(__state_, __rhs.__state_);}
+ // retrieving the result
+ _LIBCPP_HIDE_FROM_ABI future<_Rp> get_future();
- // retrieving the result
- _LIBCPP_HIDE_FROM_ABI future<_Rp> get_future();
+ // setting the result
+ _LIBCPP_HIDE_FROM_ABI void set_value(const _Rp& __r);
+ _LIBCPP_HIDE_FROM_ABI void set_value(_Rp&& __r);
+ _LIBCPP_HIDE_FROM_ABI void set_exception(exception_ptr __p);
- // setting the result
- _LIBCPP_HIDE_FROM_ABI void set_value(const _Rp& __r);
- _LIBCPP_HIDE_FROM_ABI void set_value(_Rp&& __r);
- _LIBCPP_HIDE_FROM_ABI void set_exception(exception_ptr __p);
-
- // setting the result with deferred notification
- _LIBCPP_HIDE_FROM_ABI void set_value_at_thread_exit(const _Rp& __r);
- _LIBCPP_HIDE_FROM_ABI void set_value_at_thread_exit(_Rp&& __r);
- _LIBCPP_HIDE_FROM_ABI void set_exception_at_thread_exit(exception_ptr __p);
+ // setting the result with deferred notification
+ _LIBCPP_HIDE_FROM_ABI void set_value_at_thread_exit(const _Rp& __r);
+ _LIBCPP_HIDE_FROM_ABI void set_value_at_thread_exit(_Rp&& __r);
+ _LIBCPP_HIDE_FROM_ABI void set_exception_at_thread_exit(exception_ptr __p);
};
template <class _Rp>
-promise<_Rp>::promise()
- : __state_(new __assoc_state<_Rp>)
-{
-}
+promise<_Rp>::promise() : __state_(new __assoc_state<_Rp>) {}
template <class _Rp>
template <class _Alloc>
-promise<_Rp>::promise(allocator_arg_t, const _Alloc& __a0)
-{
- typedef __assoc_state_alloc<_Rp, _Alloc> _State;
- typedef typename __allocator_traits_rebind<_Alloc, _State>::type _A2;
- typedef __allocator_destructor<_A2> _D2;
- _A2 __a(__a0);
- unique_ptr<_State, _D2> __hold(__a.allocate(1), _D2(__a, 1));
- ::new ((void*)std::addressof(*__hold.get())) _State(__a0);
- __state_ = std::addressof(*__hold.release());
+promise<_Rp>::promise(allocator_arg_t, const _Alloc& __a0) {
+ typedef __assoc_state_alloc<_Rp, _Alloc> _State;
+ typedef typename __allocator_traits_rebind<_Alloc, _State>::type _A2;
+ typedef __allocator_destructor<_A2> _D2;
+ _A2 __a(__a0);
+ unique_ptr<_State, _D2> __hold(__a.allocate(1), _D2(__a, 1));
+ ::new ((void*)std::addressof(*__hold.get())) _State(__a0);
+ __state_ = std::addressof(*__hold.release());
}
template <class _Rp>
-promise<_Rp>::~promise()
-{
- if (__state_)
- {
- if (!__state_->__has_value() && __state_->use_count() > 1)
- __state_->set_exception(make_exception_ptr(future_error(make_error_code(future_errc::broken_promise))));
- __state_->__release_shared();
- }
+promise<_Rp>::~promise() {
+ if (__state_) {
+ if (!__state_->__has_value() && __state_->use_count() > 1)
+ __state_->set_exception(make_exception_ptr(future_error(make_error_code(future_errc::broken_promise))));
+ __state_->__release_shared();
+ }
}
template <class _Rp>
-future<_Rp>
-promise<_Rp>::get_future()
-{
- if (__state_ == nullptr)
- __throw_future_error(future_errc::no_state);
- return future<_Rp>(__state_);
+future<_Rp> promise<_Rp>::get_future() {
+ if (__state_ == nullptr)
+ __throw_future_error(future_errc::no_state);
+ return future<_Rp>(__state_);
}
template <class _Rp>
-void
-promise<_Rp>::set_value(const _Rp& __r)
-{
- if (__state_ == nullptr)
- __throw_future_error(future_errc::no_state);
- __state_->set_value(__r);
+void promise<_Rp>::set_value(const _Rp& __r) {
+ if (__state_ == nullptr)
+ __throw_future_error(future_errc::no_state);
+ __state_->set_value(__r);
}
template <class _Rp>
-void
-promise<_Rp>::set_value(_Rp&& __r)
-{
- if (__state_ == nullptr)
- __throw_future_error(future_errc::no_state);
- __state_->set_value(std::move(__r));
+void promise<_Rp>::set_value(_Rp&& __r) {
+ if (__state_ == nullptr)
+ __throw_future_error(future_errc::no_state);
+ __state_->set_value(std::move(__r));
}
template <class _Rp>
-void
-promise<_Rp>::set_exception(exception_ptr __p)
-{
- _LIBCPP_ASSERT_NON_NULL( __p != nullptr, "promise::set_exception: received nullptr" );
- if (__state_ == nullptr)
- __throw_future_error(future_errc::no_state);
- __state_->set_exception(__p);
+void promise<_Rp>::set_exception(exception_ptr __p) {
+ _LIBCPP_ASSERT_NON_NULL(__p != nullptr, "promise::set_exception: received nullptr");
+ if (__state_ == nullptr)
+ __throw_future_error(future_errc::no_state);
+ __state_->set_exception(__p);
}
template <class _Rp>
-void
-promise<_Rp>::set_value_at_thread_exit(const _Rp& __r)
-{
- if (__state_ == nullptr)
- __throw_future_error(future_errc::no_state);
- __state_->set_value_at_thread_exit(__r);
+void promise<_Rp>::set_value_at_thread_exit(const _Rp& __r) {
+ if (__state_ == nullptr)
+ __throw_future_error(future_errc::no_state);
+ __state_->set_value_at_thread_exit(__r);
}
template <class _Rp>
-void
-promise<_Rp>::set_value_at_thread_exit(_Rp&& __r)
-{
- if (__state_ == nullptr)
- __throw_future_error(future_errc::no_state);
- __state_->set_value_at_thread_exit(std::move(__r));
+void promise<_Rp>::set_value_at_thread_exit(_Rp&& __r) {
+ if (__state_ == nullptr)
+ __throw_future_error(future_errc::no_state);
+ __state_->set_value_at_thread_exit(std::move(__r));
}
template <class _Rp>
-void
-promise<_Rp>::set_exception_at_thread_exit(exception_ptr __p)
-{
- _LIBCPP_ASSERT_NON_NULL( __p != nullptr, "promise::set_exception_at_thread_exit: received nullptr" );
- if (__state_ == nullptr)
- __throw_future_error(future_errc::no_state);
- __state_->set_exception_at_thread_exit(__p);
+void promise<_Rp>::set_exception_at_thread_exit(exception_ptr __p) {
+ _LIBCPP_ASSERT_NON_NULL(__p != nullptr, "promise::set_exception_at_thread_exit: received nullptr");
+ if (__state_ == nullptr)
+ __throw_future_error(future_errc::no_state);
+ __state_->set_exception_at_thread_exit(__p);
}
// promise<R&>
template <class _Rp>
-class _LIBCPP_TEMPLATE_VIS promise<_Rp&>
-{
- __assoc_state<_Rp&>* __state_;
+class _LIBCPP_TEMPLATE_VIS promise<_Rp&> {
+ __assoc_state<_Rp&>* __state_;
- _LIBCPP_HIDE_FROM_ABI
- explicit promise(nullptr_t) _NOEXCEPT : __state_(nullptr) {}
+ _LIBCPP_HIDE_FROM_ABI explicit promise(nullptr_t) _NOEXCEPT : __state_(nullptr) {}
- template <class> friend class packaged_task;
+ template <class>
+ friend class packaged_task;
public:
- _LIBCPP_HIDE_FROM_ABI promise();
- template <class _Allocator>
- _LIBCPP_HIDE_FROM_ABI promise(allocator_arg_t, const _Allocator& __a);
- _LIBCPP_HIDE_FROM_ABI
- promise(promise&& __rhs) _NOEXCEPT
- : __state_(__rhs.__state_) {__rhs.__state_ = nullptr;}
- promise(const promise& __rhs) = delete;
- _LIBCPP_HIDE_FROM_ABI ~promise();
+ _LIBCPP_HIDE_FROM_ABI promise();
+ template <class _Allocator>
+ _LIBCPP_HIDE_FROM_ABI promise(allocator_arg_t, const _Allocator& __a);
+ _LIBCPP_HIDE_FROM_ABI promise(promise&& __rhs) _NOEXCEPT : __state_(__rhs.__state_) { __rhs.__state_ = nullptr; }
+ promise(const promise& __rhs) = delete;
+ _LIBCPP_HIDE_FROM_ABI ~promise();
+
+ // assignment
+ _LIBCPP_HIDE_FROM_ABI promise& operator=(promise&& __rhs) _NOEXCEPT {
+ promise(std::move(__rhs)).swap(*this);
+ return *this;
+ }
+ promise& operator=(const promise& __rhs) = delete;
- // assignment
- _LIBCPP_HIDE_FROM_ABI
- promise& operator=(promise&& __rhs) _NOEXCEPT
- {
- promise(std::move(__rhs)).swap(*this);
- return *this;
- }
- promise& operator=(const promise& __rhs) = delete;
+ _LIBCPP_HIDE_FROM_ABI void swap(promise& __rhs) _NOEXCEPT { std::swap(__state_, __rhs.__state_); }
- _LIBCPP_HIDE_FROM_ABI
- void swap(promise& __rhs) _NOEXCEPT {std::swap(__state_, __rhs.__state_);}
+ // retrieving the result
+ _LIBCPP_HIDE_FROM_ABI future<_Rp&> get_future();
- // retrieving the result
- _LIBCPP_HIDE_FROM_ABI future<_Rp&> get_future();
+ // setting the result
+ _LIBCPP_HIDE_FROM_ABI void set_value(_Rp& __r);
+ _LIBCPP_HIDE_FROM_ABI void set_exception(exception_ptr __p);
- // setting the result
- _LIBCPP_HIDE_FROM_ABI void set_value(_Rp& __r);
- _LIBCPP_HIDE_FROM_ABI void set_exception(exception_ptr __p);
-
- // setting the result with deferred notification
- _LIBCPP_HIDE_FROM_ABI void set_value_at_thread_exit(_Rp&);
- _LIBCPP_HIDE_FROM_ABI void set_exception_at_thread_exit(exception_ptr __p);
+ // setting the result with deferred notification
+ _LIBCPP_HIDE_FROM_ABI void set_value_at_thread_exit(_Rp&);
+ _LIBCPP_HIDE_FROM_ABI void set_exception_at_thread_exit(exception_ptr __p);
};
template <class _Rp>
-promise<_Rp&>::promise()
- : __state_(new __assoc_state<_Rp&>)
-{
-}
+promise<_Rp&>::promise() : __state_(new __assoc_state<_Rp&>) {}
template <class _Rp>
template <class _Alloc>
-promise<_Rp&>::promise(allocator_arg_t, const _Alloc& __a0)
-{
- typedef __assoc_state_alloc<_Rp&, _Alloc> _State;
- typedef typename __allocator_traits_rebind<_Alloc, _State>::type _A2;
- typedef __allocator_destructor<_A2> _D2;
- _A2 __a(__a0);
- unique_ptr<_State, _D2> __hold(__a.allocate(1), _D2(__a, 1));
- ::new ((void*)std::addressof(*__hold.get())) _State(__a0);
- __state_ = std::addressof(*__hold.release());
+promise<_Rp&>::promise(allocator_arg_t, const _Alloc& __a0) {
+ typedef __assoc_state_alloc<_Rp&, _Alloc> _State;
+ typedef typename __allocator_traits_rebind<_Alloc, _State>::type _A2;
+ typedef __allocator_destructor<_A2> _D2;
+ _A2 __a(__a0);
+ unique_ptr<_State, _D2> __hold(__a.allocate(1), _D2(__a, 1));
+ ::new ((void*)std::addressof(*__hold.get())) _State(__a0);
+ __state_ = std::addressof(*__hold.release());
}
template <class _Rp>
-promise<_Rp&>::~promise()
-{
- if (__state_)
- {
- if (!__state_->__has_value() && __state_->use_count() > 1)
- __state_->set_exception(make_exception_ptr(future_error(make_error_code(future_errc::broken_promise))));
- __state_->__release_shared();
- }
+promise<_Rp&>::~promise() {
+ if (__state_) {
+ if (!__state_->__has_value() && __state_->use_count() > 1)
+ __state_->set_exception(make_exception_ptr(future_error(make_error_code(future_errc::broken_promise))));
+ __state_->__release_shared();
+ }
}
template <class _Rp>
-future<_Rp&>
-promise<_Rp&>::get_future()
-{
- if (__state_ == nullptr)
- __throw_future_error(future_errc::no_state);
- return future<_Rp&>(__state_);
+future<_Rp&> promise<_Rp&>::get_future() {
+ if (__state_ == nullptr)
+ __throw_future_error(future_errc::no_state);
+ return future<_Rp&>(__state_);
}
template <class _Rp>
-void
-promise<_Rp&>::set_value(_Rp& __r)
-{
- if (__state_ == nullptr)
- __throw_future_error(future_errc::no_state);
- __state_->set_value(__r);
+void promise<_Rp&>::set_value(_Rp& __r) {
+ if (__state_ == nullptr)
+ __throw_future_error(future_errc::no_state);
+ __state_->set_value(__r);
}
template <class _Rp>
-void
-promise<_Rp&>::set_exception(exception_ptr __p)
-{
- _LIBCPP_ASSERT_NON_NULL( __p != nullptr, "promise::set_exception: received nullptr" );
- if (__state_ == nullptr)
- __throw_future_error(future_errc::no_state);
- __state_->set_exception(__p);
+void promise<_Rp&>::set_exception(exception_ptr __p) {
+ _LIBCPP_ASSERT_NON_NULL(__p != nullptr, "promise::set_exception: received nullptr");
+ if (__state_ == nullptr)
+ __throw_future_error(future_errc::no_state);
+ __state_->set_exception(__p);
}
template <class _Rp>
-void
-promise<_Rp&>::set_value_at_thread_exit(_Rp& __r)
-{
- if (__state_ == nullptr)
- __throw_future_error(future_errc::no_state);
- __state_->set_value_at_thread_exit(__r);
+void promise<_Rp&>::set_value_at_thread_exit(_Rp& __r) {
+ if (__state_ == nullptr)
+ __throw_future_error(future_errc::no_state);
+ __state_->set_value_at_thread_exit(__r);
}
template <class _Rp>
-void
-promise<_Rp&>::set_exception_at_thread_exit(exception_ptr __p)
-{
- _LIBCPP_ASSERT_NON_NULL( __p != nullptr, "promise::set_exception_at_thread_exit: received nullptr" );
- if (__state_ == nullptr)
- __throw_future_error(future_errc::no_state);
- __state_->set_exception_at_thread_exit(__p);
+void promise<_Rp&>::set_exception_at_thread_exit(exception_ptr __p) {
+ _LIBCPP_ASSERT_NON_NULL(__p != nullptr, "promise::set_exception_at_thread_exit: received nullptr");
+ if (__state_ == nullptr)
+ __throw_future_error(future_errc::no_state);
+ __state_->set_exception_at_thread_exit(__p);
}
// promise<void>
template <>
-class _LIBCPP_EXPORTED_FROM_ABI promise<void>
-{
- __assoc_sub_state* __state_;
+class _LIBCPP_EXPORTED_FROM_ABI promise<void> {
+ __assoc_sub_state* __state_;
- _LIBCPP_HIDE_FROM_ABI
- explicit promise(nullptr_t) _NOEXCEPT : __state_(nullptr) {}
+ _LIBCPP_HIDE_FROM_ABI explicit promise(nullptr_t) _NOEXCEPT : __state_(nullptr) {}
- template <class> friend class packaged_task;
+ template <class>
+ friend class packaged_task;
public:
- promise();
- template <class _Allocator>
- _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
- promise(allocator_arg_t, const _Allocator& __a);
- _LIBCPP_HIDE_FROM_ABI
- promise(promise&& __rhs) _NOEXCEPT
- : __state_(__rhs.__state_) {__rhs.__state_ = nullptr;}
- promise(const promise& __rhs) = delete;
- ~promise();
+ promise();
+ template <class _Allocator>
+ _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS promise(allocator_arg_t, const _Allocator& __a);
+ _LIBCPP_HIDE_FROM_ABI promise(promise&& __rhs) _NOEXCEPT : __state_(__rhs.__state_) { __rhs.__state_ = nullptr; }
+ promise(const promise& __rhs) = delete;
+ ~promise();
+
+ // assignment
+ _LIBCPP_HIDE_FROM_ABI promise& operator=(promise&& __rhs) _NOEXCEPT {
+ promise(std::move(__rhs)).swap(*this);
+ return *this;
+ }
+ promise& operator=(const promise& __rhs) = delete;
- // assignment
- _LIBCPP_HIDE_FROM_ABI
- promise& operator=(promise&& __rhs) _NOEXCEPT
- {
- promise(std::move(__rhs)).swap(*this);
- return *this;
- }
- promise& operator=(const promise& __rhs) = delete;
+ _LIBCPP_HIDE_FROM_ABI void swap(promise& __rhs) _NOEXCEPT { std::swap(__state_, __rhs.__state_); }
- _LIBCPP_HIDE_FROM_ABI
- void swap(promise& __rhs) _NOEXCEPT {std::swap(__state_, __rhs.__state_);}
+ // retrieving the result
+ future<void> get_future();
- // retrieving the result
- future<void> get_future();
-
- // setting the result
- void set_value();
- void set_exception(exception_ptr __p);
+ // setting the result
+ void set_value();
+ void set_exception(exception_ptr __p);
- // setting the result with deferred notification
- void set_value_at_thread_exit();
- void set_exception_at_thread_exit(exception_ptr __p);
+ // setting the result with deferred notification
+ void set_value_at_thread_exit();
+ void set_exception_at_thread_exit(exception_ptr __p);
};
template <class _Alloc>
-promise<void>::promise(allocator_arg_t, const _Alloc& __a0)
-{
- typedef __assoc_sub_state_alloc<_Alloc> _State;
- typedef typename __allocator_traits_rebind<_Alloc, _State>::type _A2;
- typedef __allocator_destructor<_A2> _D2;
- _A2 __a(__a0);
- unique_ptr<_State, _D2> __hold(__a.allocate(1), _D2(__a, 1));
- ::new ((void*)std::addressof(*__hold.get())) _State(__a0);
- __state_ = std::addressof(*__hold.release());
+promise<void>::promise(allocator_arg_t, const _Alloc& __a0) {
+ typedef __assoc_sub_state_alloc<_Alloc> _State;
+ typedef typename __allocator_traits_rebind<_Alloc, _State>::type _A2;
+ typedef __allocator_destructor<_A2> _D2;
+ _A2 __a(__a0);
+ unique_ptr<_State, _D2> __hold(__a.allocate(1), _D2(__a, 1));
+ ::new ((void*)std::addressof(*__hold.get())) _State(__a0);
+ __state_ = std::addressof(*__hold.release());
}
template <class _Rp>
-inline _LIBCPP_HIDE_FROM_ABI
-void
-swap(promise<_Rp>& __x, promise<_Rp>& __y) _NOEXCEPT
-{
- __x.swap(__y);
+inline _LIBCPP_HIDE_FROM_ABI void swap(promise<_Rp>& __x, promise<_Rp>& __y) _NOEXCEPT {
+ __x.swap(__y);
}
template <class _Rp, class _Alloc>
- struct _LIBCPP_TEMPLATE_VIS uses_allocator<promise<_Rp>, _Alloc>
- : public true_type {};
+struct _LIBCPP_TEMPLATE_VIS uses_allocator<promise<_Rp>, _Alloc> : public true_type {};
// packaged_task
-template<class _Fp> class __packaged_task_base;
+template <class _Fp>
+class __packaged_task_base;
+
+template <class _Rp, class... _ArgTypes>
+class __packaged_task_base<_Rp(_ArgTypes...)> {
+ __packaged_task_base(const __packaged_task_base&);
+ __packaged_task_base& operator=(const __packaged_task_base&);
-template<class _Rp, class ..._ArgTypes>
-class __packaged_task_base<_Rp(_ArgTypes...)>
-{
- __packaged_task_base(const __packaged_task_base&);
- __packaged_task_base& operator=(const __packaged_task_base&);
public:
- _LIBCPP_HIDE_FROM_ABI
- __packaged_task_base() {}
- _LIBCPP_HIDE_FROM_ABI_VIRTUAL
- virtual ~__packaged_task_base() {}
- virtual void __move_to(__packaged_task_base*) _NOEXCEPT = 0;
- virtual void destroy() = 0;
- virtual void destroy_deallocate() = 0;
- virtual _Rp operator()(_ArgTypes&& ...) = 0;
+ _LIBCPP_HIDE_FROM_ABI __packaged_task_base() {}
+ _LIBCPP_HIDE_FROM_ABI_VIRTUAL
+ virtual ~__packaged_task_base() {}
+ virtual void __move_to(__packaged_task_base*) _NOEXCEPT = 0;
+ virtual void destroy() = 0;
+ virtual void destroy_deallocate() = 0;
+ virtual _Rp operator()(_ArgTypes&&...) = 0;
};
-template<class _FD, class _Alloc, class _FB> class __packaged_task_func;
+template <class _FD, class _Alloc, class _FB>
+class __packaged_task_func;
+
+template <class _Fp, class _Alloc, class _Rp, class... _ArgTypes>
+class __packaged_task_func<_Fp, _Alloc, _Rp(_ArgTypes...)> : public __packaged_task_base<_Rp(_ArgTypes...)> {
+ __compressed_pair<_Fp, _Alloc> __f_;
-template<class _Fp, class _Alloc, class _Rp, class ..._ArgTypes>
-class __packaged_task_func<_Fp, _Alloc, _Rp(_ArgTypes...)> : public __packaged_task_base<_Rp(_ArgTypes...)>
-{
- __compressed_pair<_Fp, _Alloc> __f_;
public:
- _LIBCPP_HIDE_FROM_ABI
- explicit __packaged_task_func(const _Fp& __f) : __f_(__f, __default_init_tag()) {}
- _LIBCPP_HIDE_FROM_ABI
- explicit __packaged_task_func(_Fp&& __f) : __f_(std::move(__f), __default_init_tag()) {}
- _LIBCPP_HIDE_FROM_ABI
- __packaged_task_func(const _Fp& __f, const _Alloc& __a)
- : __f_(__f, __a) {}
- _LIBCPP_HIDE_FROM_ABI
- __packaged_task_func(_Fp&& __f, const _Alloc& __a)
- : __f_(std::move(__f), __a) {}
- _LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual void __move_to(__packaged_task_base<_Rp(_ArgTypes...)>*) _NOEXCEPT;
- _LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual void destroy();
- _LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual void destroy_deallocate();
- _LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual _Rp operator()(_ArgTypes&& ... __args);
+ _LIBCPP_HIDE_FROM_ABI explicit __packaged_task_func(const _Fp& __f) : __f_(__f, __default_init_tag()) {}
+ _LIBCPP_HIDE_FROM_ABI explicit __packaged_task_func(_Fp&& __f) : __f_(std::move(__f), __default_init_tag()) {}
+ _LIBCPP_HIDE_FROM_ABI __packaged_task_func(const _Fp& __f, const _Alloc& __a) : __f_(__f, __a) {}
+ _LIBCPP_HIDE_FROM_ABI __packaged_task_func(_Fp&& __f, const _Alloc& __a) : __f_(std::move(__f), __a) {}
+ _LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual void __move_to(__packaged_task_base<_Rp(_ArgTypes...)>*) _NOEXCEPT;
+ _LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual void destroy();
+ _LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual void destroy_deallocate();
+ _LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual _Rp operator()(_ArgTypes&&... __args);
};
-template<class _Fp, class _Alloc, class _Rp, class ..._ArgTypes>
-void
-__packaged_task_func<_Fp, _Alloc, _Rp(_ArgTypes...)>::__move_to(
- __packaged_task_base<_Rp(_ArgTypes...)>* __p) _NOEXCEPT
-{
- ::new ((void*)__p) __packaged_task_func(std::move(__f_.first()), std::move(__f_.second()));
+template <class _Fp, class _Alloc, class _Rp, class... _ArgTypes>
+void __packaged_task_func<_Fp, _Alloc, _Rp(_ArgTypes...)>::__move_to(
+ __packaged_task_base<_Rp(_ArgTypes...)>* __p) _NOEXCEPT {
+ ::new ((void*)__p) __packaged_task_func(std::move(__f_.first()), std::move(__f_.second()));
}
-template<class _Fp, class _Alloc, class _Rp, class ..._ArgTypes>
-void
-__packaged_task_func<_Fp, _Alloc, _Rp(_ArgTypes...)>::destroy()
-{
- __f_.~__compressed_pair<_Fp, _Alloc>();
+template <class _Fp, class _Alloc, class _Rp, class... _ArgTypes>
+void __packaged_task_func<_Fp, _Alloc, _Rp(_ArgTypes...)>::destroy() {
+ __f_.~__compressed_pair<_Fp, _Alloc>();
}
-template<class _Fp, class _Alloc, class _Rp, class ..._ArgTypes>
-void
-__packaged_task_func<_Fp, _Alloc, _Rp(_ArgTypes...)>::destroy_deallocate()
-{
- typedef typename __allocator_traits_rebind<_Alloc, __packaged_task_func>::type _Ap;
- typedef allocator_traits<_Ap> _ATraits;
- typedef pointer_traits<typename _ATraits::pointer> _PTraits;
- _Ap __a(__f_.second());
- __f_.~__compressed_pair<_Fp, _Alloc>();
- __a.deallocate(_PTraits::pointer_to(*this), 1);
+template <class _Fp, class _Alloc, class _Rp, class... _ArgTypes>
+void __packaged_task_func<_Fp, _Alloc, _Rp(_ArgTypes...)>::destroy_deallocate() {
+ typedef typename __allocator_traits_rebind<_Alloc, __packaged_task_func>::type _Ap;
+ typedef allocator_traits<_Ap> _ATraits;
+ typedef pointer_traits<typename _ATraits::pointer> _PTraits;
+ _Ap __a(__f_.second());
+ __f_.~__compressed_pair<_Fp, _Alloc>();
+ __a.deallocate(_PTraits::pointer_to(*this), 1);
}
-template<class _Fp, class _Alloc, class _Rp, class ..._ArgTypes>
-_Rp
-__packaged_task_func<_Fp, _Alloc, _Rp(_ArgTypes...)>::operator()(_ArgTypes&& ... __arg)
-{
- return std::__invoke(__f_.first(), std::forward<_ArgTypes>(__arg)...);
+template <class _Fp, class _Alloc, class _Rp, class... _ArgTypes>
+_Rp __packaged_task_func<_Fp, _Alloc, _Rp(_ArgTypes...)>::operator()(_ArgTypes&&... __arg) {
+ return std::__invoke(__f_.first(), std::forward<_ArgTypes>(__arg)...);
}
-template <class _Callable> class __packaged_task_function;
+template <class _Callable>
+class __packaged_task_function;
-template<class _Rp, class ..._ArgTypes>
-class __packaged_task_function<_Rp(_ArgTypes...)>
-{
- typedef __packaged_task_base<_Rp(_ArgTypes...)> __base;
+template <class _Rp, class... _ArgTypes>
+class __packaged_task_function<_Rp(_ArgTypes...)> {
+ typedef __packaged_task_base<_Rp(_ArgTypes...)> __base;
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_NO_CFI
- __base* __get_buf() { return (__base*)&__buf_; }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_NO_CFI __base* __get_buf() { return (__base*)&__buf_; }
- _LIBCPP_SUPPRESS_DEPRECATED_PUSH
- typename aligned_storage<3*sizeof(void*)>::type __buf_;
- _LIBCPP_SUPPRESS_DEPRECATED_POP
- __base* __f_;
+ _LIBCPP_SUPPRESS_DEPRECATED_PUSH
+ typename aligned_storage<3 * sizeof(void*)>::type __buf_;
+ _LIBCPP_SUPPRESS_DEPRECATED_POP
+ __base* __f_;
public:
- typedef _Rp result_type;
+ typedef _Rp result_type;
- // construct/copy/destroy:
- _LIBCPP_HIDE_FROM_ABI
- __packaged_task_function() _NOEXCEPT : __f_(nullptr) {}
- template<class _Fp>
- _LIBCPP_HIDE_FROM_ABI __packaged_task_function(_Fp&& __f);
- template<class _Fp, class _Alloc>
- _LIBCPP_HIDE_FROM_ABI __packaged_task_function(allocator_arg_t, const _Alloc& __a, _Fp&& __f);
+ // construct/copy/destroy:
+ _LIBCPP_HIDE_FROM_ABI __packaged_task_function() _NOEXCEPT : __f_(nullptr) {}
+ template <class _Fp>
+ _LIBCPP_HIDE_FROM_ABI __packaged_task_function(_Fp&& __f);
+ template <class _Fp, class _Alloc>
+ _LIBCPP_HIDE_FROM_ABI __packaged_task_function(allocator_arg_t, const _Alloc& __a, _Fp&& __f);
- _LIBCPP_HIDE_FROM_ABI __packaged_task_function(__packaged_task_function&&) _NOEXCEPT;
- _LIBCPP_HIDE_FROM_ABI __packaged_task_function& operator=(__packaged_task_function&&) _NOEXCEPT;
+ _LIBCPP_HIDE_FROM_ABI __packaged_task_function(__packaged_task_function&&) _NOEXCEPT;
+ _LIBCPP_HIDE_FROM_ABI __packaged_task_function& operator=(__packaged_task_function&&) _NOEXCEPT;
- __packaged_task_function(const __packaged_task_function&) = delete;
- __packaged_task_function& operator=(const __packaged_task_function&) = delete;
+ __packaged_task_function(const __packaged_task_function&) = delete;
+ __packaged_task_function& operator=(const __packaged_task_function&) = delete;
- _LIBCPP_HIDE_FROM_ABI ~__packaged_task_function();
+ _LIBCPP_HIDE_FROM_ABI ~__packaged_task_function();
- _LIBCPP_HIDE_FROM_ABI void swap(__packaged_task_function&) _NOEXCEPT;
+ _LIBCPP_HIDE_FROM_ABI void swap(__packaged_task_function&) _NOEXCEPT;
- _LIBCPP_HIDE_FROM_ABI
- _LIBCPP_HIDE_FROM_ABI _Rp operator()(_ArgTypes...) const;
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_HIDE_FROM_ABI _Rp operator()(_ArgTypes...) const;
};
-template<class _Rp, class ..._ArgTypes>
-__packaged_task_function<_Rp(_ArgTypes...)>::__packaged_task_function(__packaged_task_function&& __f) _NOEXCEPT
-{
- if (__f.__f_ == nullptr)
- __f_ = nullptr;
- else if (__f.__f_ == __f.__get_buf())
- {
- __f.__f_->__move_to(__get_buf());
- __f_ = (__base*)&__buf_;
- }
- else
- {
- __f_ = __f.__f_;
- __f.__f_ = nullptr;
- }
-}
-
-template<class _Rp, class ..._ArgTypes>
+template <class _Rp, class... _ArgTypes>
+__packaged_task_function<_Rp(_ArgTypes...)>::__packaged_task_function(__packaged_task_function&& __f) _NOEXCEPT {
+ if (__f.__f_ == nullptr)
+ __f_ = nullptr;
+ else if (__f.__f_ == __f.__get_buf()) {
+ __f.__f_->__move_to(__get_buf());
+ __f_ = (__base*)&__buf_;
+ } else {
+ __f_ = __f.__f_;
+ __f.__f_ = nullptr;
+ }
+}
+
+template <class _Rp, class... _ArgTypes>
template <class _Fp>
-__packaged_task_function<_Rp(_ArgTypes...)>::__packaged_task_function(_Fp&& __f)
- : __f_(nullptr)
-{
- typedef __libcpp_remove_reference_t<__decay_t<_Fp> > _FR;
- typedef __packaged_task_func<_FR, allocator<_FR>, _Rp(_ArgTypes...)> _FF;
- if (sizeof(_FF) <= sizeof(__buf_))
- {
- ::new ((void*)&__buf_) _FF(std::forward<_Fp>(__f));
- __f_ = (__base*)&__buf_;
- }
- else
- {
- typedef allocator<_FF> _Ap;
- _Ap __a;
- typedef __allocator_destructor<_Ap> _Dp;
- unique_ptr<__base, _Dp> __hold(__a.allocate(1), _Dp(__a, 1));
- ::new ((void*)__hold.get()) _FF(std::forward<_Fp>(__f), allocator<_FR>(__a));
- __f_ = __hold.release();
- }
-}
-
-template<class _Rp, class ..._ArgTypes>
+__packaged_task_function<_Rp(_ArgTypes...)>::__packaged_task_function(_Fp&& __f) : __f_(nullptr) {
+ typedef __libcpp_remove_reference_t<__decay_t<_Fp> > _FR;
+ typedef __packaged_task_func<_FR, allocator<_FR>, _Rp(_ArgTypes...)> _FF;
+ if (sizeof(_FF) <= sizeof(__buf_)) {
+ ::new ((void*)&__buf_) _FF(std::forward<_Fp>(__f));
+ __f_ = (__base*)&__buf_;
+ } else {
+ typedef allocator<_FF> _Ap;
+ _Ap __a;
+ typedef __allocator_destructor<_Ap> _Dp;
+ unique_ptr<__base, _Dp> __hold(__a.allocate(1), _Dp(__a, 1));
+ ::new ((void*)__hold.get()) _FF(std::forward<_Fp>(__f), allocator<_FR>(__a));
+ __f_ = __hold.release();
+ }
+}
+
+template <class _Rp, class... _ArgTypes>
template <class _Fp, class _Alloc>
-__packaged_task_function<_Rp(_ArgTypes...)>::__packaged_task_function(
- allocator_arg_t, const _Alloc& __a0, _Fp&& __f)
- : __f_(nullptr)
-{
- typedef __libcpp_remove_reference_t<__decay_t<_Fp> > _FR;
- typedef __packaged_task_func<_FR, _Alloc, _Rp(_ArgTypes...)> _FF;
- if (sizeof(_FF) <= sizeof(__buf_))
- {
- __f_ = (__base*)&__buf_;
- ::new ((void*)__f_) _FF(std::forward<_Fp>(__f));
- }
- else
- {
- typedef typename __allocator_traits_rebind<_Alloc, _FF>::type _Ap;
- _Ap __a(__a0);
- typedef __allocator_destructor<_Ap> _Dp;
- unique_ptr<__base, _Dp> __hold(__a.allocate(1), _Dp(__a, 1));
- ::new ((void*)std::addressof(*__hold.get()))
- _FF(std::forward<_Fp>(__f), _Alloc(__a));
- __f_ = std::addressof(*__hold.release());
- }
-}
-
-template<class _Rp, class ..._ArgTypes>
+__packaged_task_function<_Rp(_ArgTypes...)>::__packaged_task_function(allocator_arg_t, const _Alloc& __a0, _Fp&& __f)
+ : __f_(nullptr) {
+ typedef __libcpp_remove_reference_t<__decay_t<_Fp> > _FR;
+ typedef __packaged_task_func<_FR, _Alloc, _Rp(_ArgTypes...)> _FF;
+ if (sizeof(_FF) <= sizeof(__buf_)) {
+ __f_ = (__base*)&__buf_;
+ ::new ((void*)__f_) _FF(std::forward<_Fp>(__f));
+ } else {
+ typedef typename __allocator_traits_rebind<_Alloc, _FF>::type _Ap;
+ _Ap __a(__a0);
+ typedef __allocator_destructor<_Ap> _Dp;
+ unique_ptr<__base, _Dp> __hold(__a.allocate(1), _Dp(__a, 1));
+ ::new ((void*)std::addressof(*__hold.get())) _FF(std::forward<_Fp>(__f), _Alloc(__a));
+ __f_ = std::addressof(*__hold.release());
+ }
+}
+
+template <class _Rp, class... _ArgTypes>
__packaged_task_function<_Rp(_ArgTypes...)>&
-__packaged_task_function<_Rp(_ArgTypes...)>::operator=(__packaged_task_function&& __f) _NOEXCEPT
-{
- if (__f_ == __get_buf())
- __f_->destroy();
- else if (__f_)
- __f_->destroy_deallocate();
+__packaged_task_function<_Rp(_ArgTypes...)>::operator=(__packaged_task_function&& __f) _NOEXCEPT {
+ if (__f_ == __get_buf())
+ __f_->destroy();
+ else if (__f_)
+ __f_->destroy_deallocate();
+ __f_ = nullptr;
+ if (__f.__f_ == nullptr)
__f_ = nullptr;
- if (__f.__f_ == nullptr)
- __f_ = nullptr;
- else if (__f.__f_ == __f.__get_buf())
- {
- __f.__f_->__move_to(__get_buf());
- __f_ = __get_buf();
- }
- else
- {
- __f_ = __f.__f_;
- __f.__f_ = nullptr;
- }
- return *this;
+ else if (__f.__f_ == __f.__get_buf()) {
+ __f.__f_->__move_to(__get_buf());
+ __f_ = __get_buf();
+ } else {
+ __f_ = __f.__f_;
+ __f.__f_ = nullptr;
+ }
+ return *this;
}
-template<class _Rp, class ..._ArgTypes>
-__packaged_task_function<_Rp(_ArgTypes...)>::~__packaged_task_function()
-{
- if (__f_ == __get_buf())
- __f_->destroy();
- else if (__f_)
- __f_->destroy_deallocate();
+template <class _Rp, class... _ArgTypes>
+__packaged_task_function<_Rp(_ArgTypes...)>::~__packaged_task_function() {
+ if (__f_ == __get_buf())
+ __f_->destroy();
+ else if (__f_)
+ __f_->destroy_deallocate();
}
-template<class _Rp, class ..._ArgTypes>
-_LIBCPP_NO_CFI
-void
-__packaged_task_function<_Rp(_ArgTypes...)>::swap(__packaged_task_function& __f) _NOEXCEPT
-{
- if (__f_ == (__base*)&__buf_ && __f.__f_ == (__base*)&__f.__buf_)
- {
- _LIBCPP_SUPPRESS_DEPRECATED_PUSH
- typename aligned_storage<sizeof(__buf_)>::type __tempbuf;
- _LIBCPP_SUPPRESS_DEPRECATED_POP
- __base* __t = (__base*)&__tempbuf;
- __f_->__move_to(__t);
- __f_->destroy();
- __f_ = nullptr;
- __f.__f_->__move_to((__base*)&__buf_);
- __f.__f_->destroy();
- __f.__f_ = nullptr;
- __f_ = (__base*)&__buf_;
- __t->__move_to((__base*)&__f.__buf_);
- __t->destroy();
- __f.__f_ = (__base*)&__f.__buf_;
- }
- else if (__f_ == (__base*)&__buf_)
- {
- __f_->__move_to((__base*)&__f.__buf_);
- __f_->destroy();
- __f_ = __f.__f_;
- __f.__f_ = (__base*)&__f.__buf_;
- }
- else if (__f.__f_ == (__base*)&__f.__buf_)
- {
- __f.__f_->__move_to((__base*)&__buf_);
- __f.__f_->destroy();
- __f.__f_ = __f_;
- __f_ = (__base*)&__buf_;
- }
- else
- std::swap(__f_, __f.__f_);
-}
-
-template<class _Rp, class ..._ArgTypes>
-inline
-_Rp
-__packaged_task_function<_Rp(_ArgTypes...)>::operator()(_ArgTypes... __arg) const
-{
- return (*__f_)(std::forward<_ArgTypes>(__arg)...);
+template <class _Rp, class... _ArgTypes>
+_LIBCPP_NO_CFI void __packaged_task_function<_Rp(_ArgTypes...)>::swap(__packaged_task_function& __f) _NOEXCEPT {
+ if (__f_ == (__base*)&__buf_ && __f.__f_ == (__base*)&__f.__buf_) {
+ _LIBCPP_SUPPRESS_DEPRECATED_PUSH
+ typename aligned_storage<sizeof(__buf_)>::type __tempbuf;
+ _LIBCPP_SUPPRESS_DEPRECATED_POP
+ __base* __t = (__base*)&__tempbuf;
+ __f_->__move_to(__t);
+ __f_->destroy();
+ __f_ = nullptr;
+ __f.__f_->__move_to((__base*)&__buf_);
+ __f.__f_->destroy();
+ __f.__f_ = nullptr;
+ __f_ = (__base*)&__buf_;
+ __t->__move_to((__base*)&__f.__buf_);
+ __t->destroy();
+ __f.__f_ = (__base*)&__f.__buf_;
+ } else if (__f_ == (__base*)&__buf_) {
+ __f_->__move_to((__base*)&__f.__buf_);
+ __f_->destroy();
+ __f_ = __f.__f_;
+ __f.__f_ = (__base*)&__f.__buf_;
+ } else if (__f.__f_ == (__base*)&__f.__buf_) {
+ __f.__f_->__move_to((__base*)&__buf_);
+ __f.__f_->destroy();
+ __f.__f_ = __f_;
+ __f_ = (__base*)&__buf_;
+ } else
+ std::swap(__f_, __f.__f_);
}
-template<class _Rp, class ..._ArgTypes>
-class _LIBCPP_TEMPLATE_VIS packaged_task<_Rp(_ArgTypes...)>
-{
+template <class _Rp, class... _ArgTypes>
+inline _Rp __packaged_task_function<_Rp(_ArgTypes...)>::operator()(_ArgTypes... __arg) const {
+ return (*__f_)(std::forward<_ArgTypes>(__arg)...);
+}
+
+template <class _Rp, class... _ArgTypes>
+class _LIBCPP_TEMPLATE_VIS packaged_task<_Rp(_ArgTypes...)> {
public:
- typedef _Rp result_type; // extension
+ typedef _Rp result_type; // extension
private:
- __packaged_task_function<result_type(_ArgTypes...)> __f_;
- promise<result_type> __p_;
+ __packaged_task_function<result_type(_ArgTypes...)> __f_;
+ promise<result_type> __p_;
public:
- // construction and destruction
- _LIBCPP_HIDE_FROM_ABI
- packaged_task() _NOEXCEPT : __p_(nullptr) {}
- template <class _Fp,
- class = __enable_if_t<!is_same<__remove_cvref_t<_Fp>, packaged_task>::value> >
- _LIBCPP_HIDE_FROM_ABI
- explicit packaged_task(_Fp&& __f) : __f_(std::forward<_Fp>(__f)) {}
- template <class _Fp, class _Allocator,
- class = __enable_if_t<!is_same<__remove_cvref_t<_Fp>, packaged_task>::value> >
- _LIBCPP_HIDE_FROM_ABI
- packaged_task(allocator_arg_t, const _Allocator& __a, _Fp&& __f)
- : __f_(allocator_arg_t(), __a, std::forward<_Fp>(__f)),
- __p_(allocator_arg_t(), __a) {}
- // ~packaged_task() = default;
+ // construction and destruction
+ _LIBCPP_HIDE_FROM_ABI packaged_task() _NOEXCEPT : __p_(nullptr) {}
+ template <class _Fp, class = __enable_if_t<!is_same<__remove_cvref_t<_Fp>, packaged_task>::value> >
+ _LIBCPP_HIDE_FROM_ABI explicit packaged_task(_Fp&& __f) : __f_(std::forward<_Fp>(__f)) {}
+ template <class _Fp, class _Allocator, class = __enable_if_t<!is_same<__remove_cvref_t<_Fp>, packaged_task>::value> >
+ _LIBCPP_HIDE_FROM_ABI packaged_task(allocator_arg_t, const _Allocator& __a, _Fp&& __f)
+ : __f_(allocator_arg_t(), __a, std::forward<_Fp>(__f)), __p_(allocator_arg_t(), __a) {}
+ // ~packaged_task() = default;
+
+ // no copy
+ packaged_task(const packaged_task&) = delete;
+ packaged_task& operator=(const packaged_task&) = delete;
+
+ // move support
+ _LIBCPP_HIDE_FROM_ABI packaged_task(packaged_task&& __other) _NOEXCEPT
+ : __f_(std::move(__other.__f_)),
+ __p_(std::move(__other.__p_)) {}
+ _LIBCPP_HIDE_FROM_ABI packaged_task& operator=(packaged_task&& __other) _NOEXCEPT {
+ __f_ = std::move(__other.__f_);
+ __p_ = std::move(__other.__p_);
+ return *this;
+ }
+ _LIBCPP_HIDE_FROM_ABI void swap(packaged_task& __other) _NOEXCEPT {
+ __f_.swap(__other.__f_);
+ __p_.swap(__other.__p_);
+ }
- // no copy
- packaged_task(const packaged_task&) = delete;
- packaged_task& operator=(const packaged_task&) = delete;
+ _LIBCPP_HIDE_FROM_ABI bool valid() const _NOEXCEPT { return __p_.__state_ != nullptr; }
- // move support
- _LIBCPP_HIDE_FROM_ABI
- packaged_task(packaged_task&& __other) _NOEXCEPT
- : __f_(std::move(__other.__f_)), __p_(std::move(__other.__p_)) {}
- _LIBCPP_HIDE_FROM_ABI
- packaged_task& operator=(packaged_task&& __other) _NOEXCEPT
- {
- __f_ = std::move(__other.__f_);
- __p_ = std::move(__other.__p_);
- return *this;
- }
- _LIBCPP_HIDE_FROM_ABI
- void swap(packaged_task& __other) _NOEXCEPT
- {
- __f_.swap(__other.__f_);
- __p_.swap(__other.__p_);
- }
-
- _LIBCPP_HIDE_FROM_ABI
- bool valid() const _NOEXCEPT {return __p_.__state_ != nullptr;}
+ // result retrieval
+ _LIBCPP_HIDE_FROM_ABI future<result_type> get_future() { return __p_.get_future(); }
- // result retrieval
- _LIBCPP_HIDE_FROM_ABI
- future<result_type> get_future() {return __p_.get_future();}
+ // execution
+ _LIBCPP_HIDE_FROM_ABI void operator()(_ArgTypes... __args);
+ _LIBCPP_HIDE_FROM_ABI void make_ready_at_thread_exit(_ArgTypes... __args);
- // execution
- _LIBCPP_HIDE_FROM_ABI void operator()(_ArgTypes... __args);
- _LIBCPP_HIDE_FROM_ABI void make_ready_at_thread_exit(_ArgTypes... __args);
-
- _LIBCPP_HIDE_FROM_ABI void reset();
+ _LIBCPP_HIDE_FROM_ABI void reset();
};
-template<class _Rp, class ..._ArgTypes>
-void
-packaged_task<_Rp(_ArgTypes...)>::operator()(_ArgTypes... __args)
-{
- if (__p_.__state_ == nullptr)
- __throw_future_error(future_errc::no_state);
- if (__p_.__state_->__has_value())
- __throw_future_error(future_errc::promise_already_satisfied);
+template <class _Rp, class... _ArgTypes>
+void packaged_task<_Rp(_ArgTypes...)>::operator()(_ArgTypes... __args) {
+ if (__p_.__state_ == nullptr)
+ __throw_future_error(future_errc::no_state);
+ if (__p_.__state_->__has_value())
+ __throw_future_error(future_errc::promise_already_satisfied);
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- try
- {
+ try {
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- __p_.set_value(__f_(std::forward<_ArgTypes>(__args)...));
+ __p_.set_value(__f_(std::forward<_ArgTypes>(__args)...));
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- }
- catch (...)
- {
- __p_.set_exception(current_exception());
- }
+ } catch (...) {
+ __p_.set_exception(current_exception());
+ }
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
}
-template<class _Rp, class ..._ArgTypes>
-void
-packaged_task<_Rp(_ArgTypes...)>::make_ready_at_thread_exit(_ArgTypes... __args)
-{
- if (__p_.__state_ == nullptr)
- __throw_future_error(future_errc::no_state);
- if (__p_.__state_->__has_value())
- __throw_future_error(future_errc::promise_already_satisfied);
+template <class _Rp, class... _ArgTypes>
+void packaged_task<_Rp(_ArgTypes...)>::make_ready_at_thread_exit(_ArgTypes... __args) {
+ if (__p_.__state_ == nullptr)
+ __throw_future_error(future_errc::no_state);
+ if (__p_.__state_->__has_value())
+ __throw_future_error(future_errc::promise_already_satisfied);
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- try
- {
+ try {
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- __p_.set_value_at_thread_exit(__f_(std::forward<_ArgTypes>(__args)...));
+ __p_.set_value_at_thread_exit(__f_(std::forward<_ArgTypes>(__args)...));
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- }
- catch (...)
- {
- __p_.set_exception_at_thread_exit(current_exception());
- }
+ } catch (...) {
+ __p_.set_exception_at_thread_exit(current_exception());
+ }
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
}
-template<class _Rp, class ..._ArgTypes>
-void
-packaged_task<_Rp(_ArgTypes...)>::reset()
-{
- if (!valid())
- __throw_future_error(future_errc::no_state);
- __p_ = promise<result_type>();
+template <class _Rp, class... _ArgTypes>
+void packaged_task<_Rp(_ArgTypes...)>::reset() {
+ if (!valid())
+ __throw_future_error(future_errc::no_state);
+ __p_ = promise<result_type>();
}
-template<class ..._ArgTypes>
-class _LIBCPP_TEMPLATE_VIS packaged_task<void(_ArgTypes...)>
-{
+template <class... _ArgTypes>
+class _LIBCPP_TEMPLATE_VIS packaged_task<void(_ArgTypes...)> {
public:
- typedef void result_type; // extension
+ typedef void result_type; // extension
private:
- __packaged_task_function<result_type(_ArgTypes...)> __f_;
- promise<result_type> __p_;
+ __packaged_task_function<result_type(_ArgTypes...)> __f_;
+ promise<result_type> __p_;
public:
- // construction and destruction
- _LIBCPP_HIDE_FROM_ABI
- packaged_task() _NOEXCEPT : __p_(nullptr) {}
- template <class _Fp,
- class = __enable_if_t<!is_same<__remove_cvref_t<_Fp>, packaged_task>::value> >
- _LIBCPP_HIDE_FROM_ABI
- explicit packaged_task(_Fp&& __f) : __f_(std::forward<_Fp>(__f)) {}
- template <class _Fp, class _Allocator,
- class = __enable_if_t<!is_same<__remove_cvref_t<_Fp>, packaged_task>::value> >
- _LIBCPP_HIDE_FROM_ABI
- packaged_task(allocator_arg_t, const _Allocator& __a, _Fp&& __f)
- : __f_(allocator_arg_t(), __a, std::forward<_Fp>(__f)),
- __p_(allocator_arg_t(), __a) {}
- // ~packaged_task() = default;
-
- // no copy
- packaged_task(const packaged_task&) = delete;
- packaged_task& operator=(const packaged_task&) = delete;
+ // construction and destruction
+ _LIBCPP_HIDE_FROM_ABI packaged_task() _NOEXCEPT : __p_(nullptr) {}
+ template <class _Fp, class = __enable_if_t<!is_same<__remove_cvref_t<_Fp>, packaged_task>::value> >
+ _LIBCPP_HIDE_FROM_ABI explicit packaged_task(_Fp&& __f) : __f_(std::forward<_Fp>(__f)) {}
+ template <class _Fp, class _Allocator, class = __enable_if_t<!is_same<__remove_cvref_t<_Fp>, packaged_task>::value> >
+ _LIBCPP_HIDE_FROM_ABI packaged_task(allocator_arg_t, const _Allocator& __a, _Fp&& __f)
+ : __f_(allocator_arg_t(), __a, std::forward<_Fp>(__f)), __p_(allocator_arg_t(), __a) {}
+ // ~packaged_task() = default;
+
+ // no copy
+ packaged_task(const packaged_task&) = delete;
+ packaged_task& operator=(const packaged_task&) = delete;
+
+ // move support
+ _LIBCPP_HIDE_FROM_ABI packaged_task(packaged_task&& __other) _NOEXCEPT
+ : __f_(std::move(__other.__f_)),
+ __p_(std::move(__other.__p_)) {}
+ _LIBCPP_HIDE_FROM_ABI packaged_task& operator=(packaged_task&& __other) _NOEXCEPT {
+ __f_ = std::move(__other.__f_);
+ __p_ = std::move(__other.__p_);
+ return *this;
+ }
+ _LIBCPP_HIDE_FROM_ABI void swap(packaged_task& __other) _NOEXCEPT {
+ __f_.swap(__other.__f_);
+ __p_.swap(__other.__p_);
+ }
- // move support
- _LIBCPP_HIDE_FROM_ABI
- packaged_task(packaged_task&& __other) _NOEXCEPT
- : __f_(std::move(__other.__f_)), __p_(std::move(__other.__p_)) {}
- _LIBCPP_HIDE_FROM_ABI
- packaged_task& operator=(packaged_task&& __other) _NOEXCEPT
- {
- __f_ = std::move(__other.__f_);
- __p_ = std::move(__other.__p_);
- return *this;
- }
- _LIBCPP_HIDE_FROM_ABI
- void swap(packaged_task& __other) _NOEXCEPT
- {
- __f_.swap(__other.__f_);
- __p_.swap(__other.__p_);
- }
-
- _LIBCPP_HIDE_FROM_ABI
- bool valid() const _NOEXCEPT {return __p_.__state_ != nullptr;}
+ _LIBCPP_HIDE_FROM_ABI bool valid() const _NOEXCEPT { return __p_.__state_ != nullptr; }
- // result retrieval
- _LIBCPP_HIDE_FROM_ABI
- future<result_type> get_future() {return __p_.get_future();}
+ // result retrieval
+ _LIBCPP_HIDE_FROM_ABI future<result_type> get_future() { return __p_.get_future(); }
- // execution
- _LIBCPP_HIDE_FROM_ABI void operator()(_ArgTypes... __args);
- _LIBCPP_HIDE_FROM_ABI void make_ready_at_thread_exit(_ArgTypes... __args);
+ // execution
+ _LIBCPP_HIDE_FROM_ABI void operator()(_ArgTypes... __args);
+ _LIBCPP_HIDE_FROM_ABI void make_ready_at_thread_exit(_ArgTypes... __args);
- _LIBCPP_HIDE_FROM_ABI void reset();
+ _LIBCPP_HIDE_FROM_ABI void reset();
};
#if _LIBCPP_STD_VER >= 17
template <class _Rp, class... _Args>
-packaged_task(_Rp(*)(_Args...)) -> packaged_task<_Rp(_Args...)>;
+packaged_task(_Rp (*)(_Args...)) -> packaged_task<_Rp(_Args...)>;
template <class _Fp, class _Stripped = typename __strip_signature<decltype(&_Fp::operator())>::type>
packaged_task(_Fp) -> packaged_task<_Stripped>;
#endif
-template<class ..._ArgTypes>
-void
-packaged_task<void(_ArgTypes...)>::operator()(_ArgTypes... __args)
-{
- if (__p_.__state_ == nullptr)
- __throw_future_error(future_errc::no_state);
- if (__p_.__state_->__has_value())
- __throw_future_error(future_errc::promise_already_satisfied);
+template <class... _ArgTypes>
+void packaged_task<void(_ArgTypes...)>::operator()(_ArgTypes... __args) {
+ if (__p_.__state_ == nullptr)
+ __throw_future_error(future_errc::no_state);
+ if (__p_.__state_->__has_value())
+ __throw_future_error(future_errc::promise_already_satisfied);
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- try
- {
+ try {
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- __f_(std::forward<_ArgTypes>(__args)...);
- __p_.set_value();
+ __f_(std::forward<_ArgTypes>(__args)...);
+ __p_.set_value();
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- }
- catch (...)
- {
- __p_.set_exception(current_exception());
- }
+ } catch (...) {
+ __p_.set_exception(current_exception());
+ }
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
}
-template<class ..._ArgTypes>
-void
-packaged_task<void(_ArgTypes...)>::make_ready_at_thread_exit(_ArgTypes... __args)
-{
- if (__p_.__state_ == nullptr)
- __throw_future_error(future_errc::no_state);
- if (__p_.__state_->__has_value())
- __throw_future_error(future_errc::promise_already_satisfied);
+template <class... _ArgTypes>
+void packaged_task<void(_ArgTypes...)>::make_ready_at_thread_exit(_ArgTypes... __args) {
+ if (__p_.__state_ == nullptr)
+ __throw_future_error(future_errc::no_state);
+ if (__p_.__state_->__has_value())
+ __throw_future_error(future_errc::promise_already_satisfied);
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- try
- {
+ try {
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- __f_(std::forward<_ArgTypes>(__args)...);
- __p_.set_value_at_thread_exit();
+ __f_(std::forward<_ArgTypes>(__args)...);
+ __p_.set_value_at_thread_exit();
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- }
- catch (...)
- {
- __p_.set_exception_at_thread_exit(current_exception());
- }
+ } catch (...) {
+ __p_.set_exception_at_thread_exit(current_exception());
+ }
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
}
-template<class ..._ArgTypes>
-void
-packaged_task<void(_ArgTypes...)>::reset()
-{
- if (!valid())
- __throw_future_error(future_errc::no_state);
- __p_ = promise<result_type>();
+template <class... _ArgTypes>
+void packaged_task<void(_ArgTypes...)>::reset() {
+ if (!valid())
+ __throw_future_error(future_errc::no_state);
+ __p_ = promise<result_type>();
}
template <class _Rp, class... _ArgTypes>
-inline _LIBCPP_HIDE_FROM_ABI
-void
-swap(packaged_task<_Rp(_ArgTypes...)>& __x, packaged_task<_Rp(_ArgTypes...)>& __y) _NOEXCEPT
-{
- __x.swap(__y);
+inline _LIBCPP_HIDE_FROM_ABI void
+swap(packaged_task<_Rp(_ArgTypes...)>& __x, packaged_task<_Rp(_ArgTypes...)>& __y) _NOEXCEPT {
+ __x.swap(__y);
}
template <class _Callable, class _Alloc>
-struct _LIBCPP_TEMPLATE_VIS uses_allocator<packaged_task<_Callable>, _Alloc>
- : public true_type {};
+struct _LIBCPP_TEMPLATE_VIS uses_allocator<packaged_task<_Callable>, _Alloc> : public true_type {};
template <class _Rp, class _Fp>
-_LIBCPP_HIDE_FROM_ABI future<_Rp>
-__make_deferred_assoc_state(_Fp&& __f)
-{
- unique_ptr<__deferred_assoc_state<_Rp, _Fp>, __release_shared_count>
- __h(new __deferred_assoc_state<_Rp, _Fp>(std::forward<_Fp>(__f)));
- return future<_Rp>(__h.get());
+_LIBCPP_HIDE_FROM_ABI future<_Rp> __make_deferred_assoc_state(_Fp&& __f) {
+ unique_ptr<__deferred_assoc_state<_Rp, _Fp>, __release_shared_count> __h(
+ new __deferred_assoc_state<_Rp, _Fp>(std::forward<_Fp>(__f)));
+ return future<_Rp>(__h.get());
}
template <class _Rp, class _Fp>
-_LIBCPP_HIDE_FROM_ABI future<_Rp>
-__make_async_assoc_state(_Fp&& __f)
-{
- unique_ptr<__async_assoc_state<_Rp, _Fp>, __release_shared_count>
- __h(new __async_assoc_state<_Rp, _Fp>(std::forward<_Fp>(__f)));
- std::thread(&__async_assoc_state<_Rp, _Fp>::__execute, __h.get()).detach();
- return future<_Rp>(__h.get());
+_LIBCPP_HIDE_FROM_ABI future<_Rp> __make_async_assoc_state(_Fp&& __f) {
+ unique_ptr<__async_assoc_state<_Rp, _Fp>, __release_shared_count> __h(
+ new __async_assoc_state<_Rp, _Fp>(std::forward<_Fp>(__f)));
+ std::thread(&__async_assoc_state<_Rp, _Fp>::__execute, __h.get()).detach();
+ return future<_Rp>(__h.get());
}
#ifndef _LIBCPP_CXX03_LANG
template <class _Fp, class... _Args>
-class _LIBCPP_HIDDEN __async_func
-{
- tuple<_Fp, _Args...> __f_;
+class _LIBCPP_HIDDEN __async_func {
+ tuple<_Fp, _Args...> __f_;
public:
- typedef typename __invoke_of<_Fp, _Args...>::type _Rp;
+ typedef typename __invoke_of<_Fp, _Args...>::type _Rp;
- _LIBCPP_HIDE_FROM_ABI
- explicit __async_func(_Fp&& __f, _Args&&... __args)
- : __f_(std::move(__f), std::move(__args)...) {}
+ _LIBCPP_HIDE_FROM_ABI explicit __async_func(_Fp&& __f, _Args&&... __args)
+ : __f_(std::move(__f), std::move(__args)...) {}
- _LIBCPP_HIDE_FROM_ABI
- __async_func(__async_func&& __f) : __f_(std::move(__f.__f_)) {}
+ _LIBCPP_HIDE_FROM_ABI __async_func(__async_func&& __f) : __f_(std::move(__f.__f_)) {}
+
+ _LIBCPP_HIDE_FROM_ABI _Rp operator()() {
+ typedef typename __make_tuple_indices<1 + sizeof...(_Args), 1>::type _Index;
+ return __execute(_Index());
+ }
- _LIBCPP_HIDE_FROM_ABI _Rp operator()()
- {
- typedef typename __make_tuple_indices<1+sizeof...(_Args), 1>::type _Index;
- return __execute(_Index());
- }
private:
- template <size_t ..._Indices>
- _LIBCPP_HIDE_FROM_ABI _Rp
- __execute(__tuple_indices<_Indices...>)
- {
- return std::__invoke(std::move(std::get<0>(__f_)), std::move(std::get<_Indices>(__f_))...);
- }
+ template <size_t... _Indices>
+ _LIBCPP_HIDE_FROM_ABI _Rp __execute(__tuple_indices<_Indices...>) {
+ return std::__invoke(std::move(std::get<0>(__f_)), std::move(std::get<_Indices>(__f_))...);
+ }
};
-inline _LIBCPP_HIDE_FROM_ABI bool __does_policy_contain(launch __policy, launch __value )
-{ return (int(__policy) & int(__value)) != 0; }
+inline _LIBCPP_HIDE_FROM_ABI bool __does_policy_contain(launch __policy, launch __value) {
+ return (int(__policy) & int(__value)) != 0;
+}
template <class _Fp, class... _Args>
_LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_HIDE_FROM_ABI
-future<typename __invoke_of<__decay_t<_Fp>, __decay_t<_Args>...>::type>
-async(launch __policy, _Fp&& __f, _Args&&... __args)
-{
- typedef __async_func<__decay_t<_Fp>, __decay_t<_Args>...> _BF;
- typedef typename _BF::_Rp _Rp;
-
-#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- try
- {
-#endif
- if (__does_policy_contain(__policy, launch::async))
- return std::__make_async_assoc_state<_Rp>(_BF(_LIBCPP_AUTO_CAST(std::forward<_Fp>(__f)),
- _LIBCPP_AUTO_CAST(std::forward<_Args>(__args))...));
-#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- }
- catch ( ... ) { if (__policy == launch::async) throw ; }
-#endif
-
- if (__does_policy_contain(__policy, launch::deferred))
- return std::__make_deferred_assoc_state<_Rp>(_BF(_LIBCPP_AUTO_CAST(std::forward<_Fp>(__f)),
- _LIBCPP_AUTO_CAST(std::forward<_Args>(__args))...));
- return future<_Rp>{};
+ future<typename __invoke_of<__decay_t<_Fp>, __decay_t<_Args>...>::type>
+ async(launch __policy, _Fp&& __f, _Args&&... __args) {
+ typedef __async_func<__decay_t<_Fp>, __decay_t<_Args>...> _BF;
+ typedef typename _BF::_Rp _Rp;
+
+# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
+ try {
+# endif
+ if (__does_policy_contain(__policy, launch::async))
+ return std::__make_async_assoc_state<_Rp>(
+ _BF(_LIBCPP_AUTO_CAST(std::forward<_Fp>(__f)), _LIBCPP_AUTO_CAST(std::forward<_Args>(__args))...));
+# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
+ } catch (...) {
+ if (__policy == launch::async)
+ throw;
+ }
+# endif
+
+ if (__does_policy_contain(__policy, launch::deferred))
+ return std::__make_deferred_assoc_state<_Rp>(
+ _BF(_LIBCPP_AUTO_CAST(std::forward<_Fp>(__f)), _LIBCPP_AUTO_CAST(std::forward<_Args>(__args))...));
+ return future<_Rp>{};
}
template <class _Fp, class... _Args>
_LIBCPP_NODISCARD_AFTER_CXX17 inline _LIBCPP_HIDE_FROM_ABI
-future<typename __invoke_of<__decay_t<_Fp>, __decay_t<_Args>...>::type>
-async(_Fp&& __f, _Args&&... __args)
-{
- return std::async(launch::any, std::forward<_Fp>(__f),
- std::forward<_Args>(__args)...);
+ future<typename __invoke_of<__decay_t<_Fp>, __decay_t<_Args>...>::type>
+ async(_Fp&& __f, _Args&&... __args) {
+ return std::async(launch::any, std::forward<_Fp>(__f), std::forward<_Args>(__args)...);
}
#endif // C++03
@@ -2225,226 +1873,173 @@ async(_Fp&& __f, _Args&&... __args)
// shared_future
template <class _Rp>
-class _LIBCPP_TEMPLATE_VIS shared_future
-{
- __assoc_state<_Rp>* __state_;
+class _LIBCPP_TEMPLATE_VIS shared_future {
+ __assoc_state<_Rp>* __state_;
public:
- _LIBCPP_HIDE_FROM_ABI
- shared_future() _NOEXCEPT : __state_(nullptr) {}
- _LIBCPP_HIDE_FROM_ABI
- shared_future(const shared_future& __rhs) _NOEXCEPT : __state_(__rhs.__state_)
- {if (__state_) __state_->__add_shared();}
- _LIBCPP_HIDE_FROM_ABI
- shared_future(future<_Rp>&& __f) _NOEXCEPT : __state_(__f.__state_)
- {__f.__state_ = nullptr;}
- _LIBCPP_HIDE_FROM_ABI
- shared_future(shared_future&& __rhs) _NOEXCEPT : __state_(__rhs.__state_)
- {__rhs.__state_ = nullptr;}
- _LIBCPP_HIDE_FROM_ABI ~shared_future();
- _LIBCPP_HIDE_FROM_ABI shared_future& operator=(const shared_future& __rhs) _NOEXCEPT;
- _LIBCPP_HIDE_FROM_ABI
- shared_future& operator=(shared_future&& __rhs) _NOEXCEPT
- {
- shared_future(std::move(__rhs)).swap(*this);
- return *this;
- }
+ _LIBCPP_HIDE_FROM_ABI shared_future() _NOEXCEPT : __state_(nullptr) {}
+ _LIBCPP_HIDE_FROM_ABI shared_future(const shared_future& __rhs) _NOEXCEPT : __state_(__rhs.__state_) {
+ if (__state_)
+ __state_->__add_shared();
+ }
+ _LIBCPP_HIDE_FROM_ABI shared_future(future<_Rp>&& __f) _NOEXCEPT : __state_(__f.__state_) { __f.__state_ = nullptr; }
+ _LIBCPP_HIDE_FROM_ABI shared_future(shared_future&& __rhs) _NOEXCEPT : __state_(__rhs.__state_) {
+ __rhs.__state_ = nullptr;
+ }
+ _LIBCPP_HIDE_FROM_ABI ~shared_future();
+ _LIBCPP_HIDE_FROM_ABI shared_future& operator=(const shared_future& __rhs) _NOEXCEPT;
+ _LIBCPP_HIDE_FROM_ABI shared_future& operator=(shared_future&& __rhs) _NOEXCEPT {
+ shared_future(std::move(__rhs)).swap(*this);
+ return *this;
+ }
- // retrieving the value
- _LIBCPP_HIDE_FROM_ABI
- const _Rp& get() const {return __state_->copy();}
+ // retrieving the value
+ _LIBCPP_HIDE_FROM_ABI const _Rp& get() const { return __state_->copy(); }
- _LIBCPP_HIDE_FROM_ABI
- void swap(shared_future& __rhs) _NOEXCEPT {std::swap(__state_, __rhs.__state_);}
+ _LIBCPP_HIDE_FROM_ABI void swap(shared_future& __rhs) _NOEXCEPT { std::swap(__state_, __rhs.__state_); }
- // functions to check state
- _LIBCPP_HIDE_FROM_ABI
- bool valid() const _NOEXCEPT {return __state_ != nullptr;}
+ // functions to check state
+ _LIBCPP_HIDE_FROM_ABI bool valid() const _NOEXCEPT { return __state_ != nullptr; }
- _LIBCPP_HIDE_FROM_ABI
- void wait() const {__state_->wait();}
- template <class _Rep, class _Period>
- _LIBCPP_HIDE_FROM_ABI
- future_status
- wait_for(const chrono::duration<_Rep, _Period>& __rel_time) const
- {return __state_->wait_for(__rel_time);}
- template <class _Clock, class _Duration>
- _LIBCPP_HIDE_FROM_ABI
- future_status
- wait_until(const chrono::time_point<_Clock, _Duration>& __abs_time) const
- {return __state_->wait_until(__abs_time);}
+ _LIBCPP_HIDE_FROM_ABI void wait() const { __state_->wait(); }
+ template <class _Rep, class _Period>
+ _LIBCPP_HIDE_FROM_ABI future_status wait_for(const chrono::duration<_Rep, _Period>& __rel_time) const {
+ return __state_->wait_for(__rel_time);
+ }
+ template <class _Clock, class _Duration>
+ _LIBCPP_HIDE_FROM_ABI future_status wait_until(const chrono::time_point<_Clock, _Duration>& __abs_time) const {
+ return __state_->wait_until(__abs_time);
+ }
};
template <class _Rp>
-shared_future<_Rp>::~shared_future()
-{
- if (__state_)
- __state_->__release_shared();
+shared_future<_Rp>::~shared_future() {
+ if (__state_)
+ __state_->__release_shared();
}
template <class _Rp>
-shared_future<_Rp>&
-shared_future<_Rp>::operator=(const shared_future& __rhs) _NOEXCEPT
-{
- if (__rhs.__state_)
- __rhs.__state_->__add_shared();
- if (__state_)
- __state_->__release_shared();
- __state_ = __rhs.__state_;
- return *this;
+shared_future<_Rp>& shared_future<_Rp>::operator=(const shared_future& __rhs) _NOEXCEPT {
+ if (__rhs.__state_)
+ __rhs.__state_->__add_shared();
+ if (__state_)
+ __state_->__release_shared();
+ __state_ = __rhs.__state_;
+ return *this;
}
template <class _Rp>
-class _LIBCPP_TEMPLATE_VIS shared_future<_Rp&>
-{
- __assoc_state<_Rp&>* __state_;
+class _LIBCPP_TEMPLATE_VIS shared_future<_Rp&> {
+ __assoc_state<_Rp&>* __state_;
public:
- _LIBCPP_HIDE_FROM_ABI
- shared_future() _NOEXCEPT : __state_(nullptr) {}
- _LIBCPP_HIDE_FROM_ABI
- shared_future(const shared_future& __rhs) : __state_(__rhs.__state_)
- {if (__state_) __state_->__add_shared();}
- _LIBCPP_HIDE_FROM_ABI
- shared_future(future<_Rp&>&& __f) _NOEXCEPT : __state_(__f.__state_)
- {__f.__state_ = nullptr;}
- _LIBCPP_HIDE_FROM_ABI
- shared_future(shared_future&& __rhs) _NOEXCEPT : __state_(__rhs.__state_)
- {__rhs.__state_ = nullptr;}
- _LIBCPP_HIDE_FROM_ABI ~shared_future();
- _LIBCPP_HIDE_FROM_ABI shared_future& operator=(const shared_future& __rhs);
- _LIBCPP_HIDE_FROM_ABI
- shared_future& operator=(shared_future&& __rhs) _NOEXCEPT
- {
- shared_future(std::move(__rhs)).swap(*this);
- return *this;
- }
+ _LIBCPP_HIDE_FROM_ABI shared_future() _NOEXCEPT : __state_(nullptr) {}
+ _LIBCPP_HIDE_FROM_ABI shared_future(const shared_future& __rhs) : __state_(__rhs.__state_) {
+ if (__state_)
+ __state_->__add_shared();
+ }
+ _LIBCPP_HIDE_FROM_ABI shared_future(future<_Rp&>&& __f) _NOEXCEPT : __state_(__f.__state_) { __f.__state_ = nullptr; }
+ _LIBCPP_HIDE_FROM_ABI shared_future(shared_future&& __rhs) _NOEXCEPT : __state_(__rhs.__state_) {
+ __rhs.__state_ = nullptr;
+ }
+ _LIBCPP_HIDE_FROM_ABI ~shared_future();
+ _LIBCPP_HIDE_FROM_ABI shared_future& operator=(const shared_future& __rhs);
+ _LIBCPP_HIDE_FROM_ABI shared_future& operator=(shared_future&& __rhs) _NOEXCEPT {
+ shared_future(std::move(__rhs)).swap(*this);
+ return *this;
+ }
- // retrieving the value
- _LIBCPP_HIDE_FROM_ABI
- _Rp& get() const {return __state_->copy();}
+ // retrieving the value
+ _LIBCPP_HIDE_FROM_ABI _Rp& get() const { return __state_->copy(); }
- _LIBCPP_HIDE_FROM_ABI
- void swap(shared_future& __rhs) _NOEXCEPT {std::swap(__state_, __rhs.__state_);}
+ _LIBCPP_HIDE_FROM_ABI void swap(shared_future& __rhs) _NOEXCEPT { std::swap(__state_, __rhs.__state_); }
- // functions to check state
- _LIBCPP_HIDE_FROM_ABI
- bool valid() const _NOEXCEPT {return __state_ != nullptr;}
+ // functions to check state
+ _LIBCPP_HIDE_FROM_ABI bool valid() const _NOEXCEPT { return __state_ != nullptr; }
- _LIBCPP_HIDE_FROM_ABI
- void wait() const {__state_->wait();}
- template <class _Rep, class _Period>
- _LIBCPP_HIDE_FROM_ABI
- future_status
- wait_for(const chrono::duration<_Rep, _Period>& __rel_time) const
- {return __state_->wait_for(__rel_time);}
- template <class _Clock, class _Duration>
- _LIBCPP_HIDE_FROM_ABI
- future_status
- wait_until(const chrono::time_point<_Clock, _Duration>& __abs_time) const
- {return __state_->wait_until(__abs_time);}
+ _LIBCPP_HIDE_FROM_ABI void wait() const { __state_->wait(); }
+ template <class _Rep, class _Period>
+ _LIBCPP_HIDE_FROM_ABI future_status wait_for(const chrono::duration<_Rep, _Period>& __rel_time) const {
+ return __state_->wait_for(__rel_time);
+ }
+ template <class _Clock, class _Duration>
+ _LIBCPP_HIDE_FROM_ABI future_status wait_until(const chrono::time_point<_Clock, _Duration>& __abs_time) const {
+ return __state_->wait_until(__abs_time);
+ }
};
template <class _Rp>
-shared_future<_Rp&>::~shared_future()
-{
- if (__state_)
- __state_->__release_shared();
+shared_future<_Rp&>::~shared_future() {
+ if (__state_)
+ __state_->__release_shared();
}
template <class _Rp>
-shared_future<_Rp&>&
-shared_future<_Rp&>::operator=(const shared_future& __rhs)
-{
- if (__rhs.__state_)
- __rhs.__state_->__add_shared();
- if (__state_)
- __state_->__release_shared();
- __state_ = __rhs.__state_;
- return *this;
+shared_future<_Rp&>& shared_future<_Rp&>::operator=(const shared_future& __rhs) {
+ if (__rhs.__state_)
+ __rhs.__state_->__add_shared();
+ if (__state_)
+ __state_->__release_shared();
+ __state_ = __rhs.__state_;
+ return *this;
}
template <>
-class _LIBCPP_EXPORTED_FROM_ABI shared_future<void>
-{
- __assoc_sub_state* __state_;
+class _LIBCPP_EXPORTED_FROM_ABI shared_future<void> {
+ __assoc_sub_state* __state_;
public:
- _LIBCPP_HIDE_FROM_ABI
- shared_future() _NOEXCEPT : __state_(nullptr) {}
- _LIBCPP_HIDE_FROM_ABI
- shared_future(const shared_future& __rhs) : __state_(__rhs.__state_)
- {if (__state_) __state_->__add_shared();}
- _LIBCPP_HIDE_FROM_ABI
- shared_future(future<void>&& __f) _NOEXCEPT : __state_(__f.__state_)
- {__f.__state_ = nullptr;}
- _LIBCPP_HIDE_FROM_ABI
- shared_future(shared_future&& __rhs) _NOEXCEPT : __state_(__rhs.__state_)
- {__rhs.__state_ = nullptr;}
- ~shared_future();
- shared_future& operator=(const shared_future& __rhs);
- _LIBCPP_HIDE_FROM_ABI
- shared_future& operator=(shared_future&& __rhs) _NOEXCEPT
- {
- shared_future(std::move(__rhs)).swap(*this);
- return *this;
- }
+ _LIBCPP_HIDE_FROM_ABI shared_future() _NOEXCEPT : __state_(nullptr) {}
+ _LIBCPP_HIDE_FROM_ABI shared_future(const shared_future& __rhs) : __state_(__rhs.__state_) {
+ if (__state_)
+ __state_->__add_shared();
+ }
+ _LIBCPP_HIDE_FROM_ABI shared_future(future<void>&& __f) _NOEXCEPT : __state_(__f.__state_) { __f.__state_ = nullptr; }
+ _LIBCPP_HIDE_FROM_ABI shared_future(shared_future&& __rhs) _NOEXCEPT : __state_(__rhs.__state_) {
+ __rhs.__state_ = nullptr;
+ }
+ ~shared_future();
+ shared_future& operator=(const shared_future& __rhs);
+ _LIBCPP_HIDE_FROM_ABI shared_future& operator=(shared_future&& __rhs) _NOEXCEPT {
+ shared_future(std::move(__rhs)).swap(*this);
+ return *this;
+ }
- // retrieving the value
- _LIBCPP_HIDE_FROM_ABI
- void get() const {__state_->copy();}
+ // retrieving the value
+ _LIBCPP_HIDE_FROM_ABI void get() const { __state_->copy(); }
- _LIBCPP_HIDE_FROM_ABI
- void swap(shared_future& __rhs) _NOEXCEPT {std::swap(__state_, __rhs.__state_);}
+ _LIBCPP_HIDE_FROM_ABI void swap(shared_future& __rhs) _NOEXCEPT { std::swap(__state_, __rhs.__state_); }
- // functions to check state
- _LIBCPP_HIDE_FROM_ABI
- bool valid() const _NOEXCEPT {return __state_ != nullptr;}
+ // functions to check state
+ _LIBCPP_HIDE_FROM_ABI bool valid() const _NOEXCEPT { return __state_ != nullptr; }
- _LIBCPP_HIDE_FROM_ABI
- void wait() const {__state_->wait();}
- template <class _Rep, class _Period>
- _LIBCPP_HIDE_FROM_ABI
- future_status
- wait_for(const chrono::duration<_Rep, _Period>& __rel_time) const
- {return __state_->wait_for(__rel_time);}
- template <class _Clock, class _Duration>
- _LIBCPP_HIDE_FROM_ABI
- future_status
- wait_until(const chrono::time_point<_Clock, _Duration>& __abs_time) const
- {return __state_->wait_until(__abs_time);}
+ _LIBCPP_HIDE_FROM_ABI void wait() const { __state_->wait(); }
+ template <class _Rep, class _Period>
+ _LIBCPP_HIDE_FROM_ABI future_status wait_for(const chrono::duration<_Rep, _Period>& __rel_time) const {
+ return __state_->wait_for(__rel_time);
+ }
+ template <class _Clock, class _Duration>
+ _LIBCPP_HIDE_FROM_ABI future_status wait_until(const chrono::time_point<_Clock, _Duration>& __abs_time) const {
+ return __state_->wait_until(__abs_time);
+ }
};
template <class _Rp>
-inline _LIBCPP_HIDE_FROM_ABI
-void
-swap(shared_future<_Rp>& __x, shared_future<_Rp>& __y) _NOEXCEPT
-{
- __x.swap(__y);
+inline _LIBCPP_HIDE_FROM_ABI void swap(shared_future<_Rp>& __x, shared_future<_Rp>& __y) _NOEXCEPT {
+ __x.swap(__y);
}
template <class _Rp>
-inline
-shared_future<_Rp>
-future<_Rp>::share() _NOEXCEPT
-{
- return shared_future<_Rp>(std::move(*this));
+inline shared_future<_Rp> future<_Rp>::share() _NOEXCEPT {
+ return shared_future<_Rp>(std::move(*this));
}
template <class _Rp>
-inline
-shared_future<_Rp&>
-future<_Rp&>::share() _NOEXCEPT
-{
- return shared_future<_Rp&>(std::move(*this));
+inline shared_future<_Rp&> future<_Rp&>::share() _NOEXCEPT {
+ return shared_future<_Rp&>(std::move(*this));
}
-inline
-shared_future<void>
-future<void>::share() _NOEXCEPT
-{
- return shared_future<void>(std::move(*this));
-}
+inline shared_future<void> future<void>::share() _NOEXCEPT { return shared_future<void>(std::move(*this)); }
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/initializer_list b/contrib/llvm-project/libcxx/include/initializer_list
index 4954a7ee89ed..4c2a7925a57b 100644
--- a/contrib/llvm-project/libcxx/include/initializer_list
+++ b/contrib/llvm-project/libcxx/include/initializer_list
@@ -50,65 +50,46 @@ template<class E> const E* end(initializer_list<E> il) noexcept; // constexpr in
# pragma GCC system_header
#endif
-namespace std // purposefully not versioned
+namespace std // purposefully not versioned
{
#ifndef _LIBCPP_CXX03_LANG
-template<class _Ep>
-class _LIBCPP_TEMPLATE_VIS initializer_list
-{
- const _Ep* __begin_;
- size_t __size_;
-
- _LIBCPP_HIDE_FROM_ABI
- _LIBCPP_CONSTEXPR_SINCE_CXX14
- initializer_list(const _Ep* __b, size_t __s) _NOEXCEPT
- : __begin_(__b),
- __size_(__s)
- {}
+template <class _Ep>
+class _LIBCPP_TEMPLATE_VIS initializer_list {
+ const _Ep* __begin_;
+ size_t __size_;
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 initializer_list(const _Ep* __b, size_t __s) _NOEXCEPT
+ : __begin_(__b),
+ __size_(__s) {}
+
public:
- typedef _Ep value_type;
- typedef const _Ep& reference;
- typedef const _Ep& const_reference;
- typedef size_t size_type;
+ typedef _Ep value_type;
+ typedef const _Ep& reference;
+ typedef const _Ep& const_reference;
+ typedef size_t size_type;
- typedef const _Ep* iterator;
- typedef const _Ep* const_iterator;
+ typedef const _Ep* iterator;
+ typedef const _Ep* const_iterator;
- _LIBCPP_HIDE_FROM_ABI
- _LIBCPP_CONSTEXPR_SINCE_CXX14
- initializer_list() _NOEXCEPT : __begin_(nullptr), __size_(0) {}
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 initializer_list() _NOEXCEPT : __begin_(nullptr), __size_(0) {}
- _LIBCPP_HIDE_FROM_ABI
- _LIBCPP_CONSTEXPR_SINCE_CXX14
- size_t size() const _NOEXCEPT {return __size_;}
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 size_t size() const _NOEXCEPT { return __size_; }
- _LIBCPP_HIDE_FROM_ABI
- _LIBCPP_CONSTEXPR_SINCE_CXX14
- const _Ep* begin() const _NOEXCEPT {return __begin_;}
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 const _Ep* begin() const _NOEXCEPT { return __begin_; }
- _LIBCPP_HIDE_FROM_ABI
- _LIBCPP_CONSTEXPR_SINCE_CXX14
- const _Ep* end() const _NOEXCEPT {return __begin_ + __size_;}
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 const _Ep* end() const _NOEXCEPT { return __begin_ + __size_; }
};
-template<class _Ep>
-inline _LIBCPP_HIDE_FROM_ABI
-_LIBCPP_CONSTEXPR_SINCE_CXX14
-const _Ep*
-begin(initializer_list<_Ep> __il) _NOEXCEPT
-{
- return __il.begin();
+template <class _Ep>
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 const _Ep* begin(initializer_list<_Ep> __il) _NOEXCEPT {
+ return __il.begin();
}
-template<class _Ep>
-inline _LIBCPP_HIDE_FROM_ABI
-_LIBCPP_CONSTEXPR_SINCE_CXX14
-const _Ep*
-end(initializer_list<_Ep> __il) _NOEXCEPT
-{
- return __il.end();
+template <class _Ep>
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 const _Ep* end(initializer_list<_Ep> __il) _NOEXCEPT {
+ return __il.end();
}
#endif // !defined(_LIBCPP_CXX03_LANG)
diff --git a/contrib/llvm-project/libcxx/include/inttypes.h b/contrib/llvm-project/libcxx/include/inttypes.h
index b755526b8492..8664412bd52f 100644
--- a/contrib/llvm-project/libcxx/include/inttypes.h
+++ b/contrib/llvm-project/libcxx/include/inttypes.h
@@ -12,7 +12,7 @@
// is defined until an inclusion of it without _STD_TYPES_T occurs, in which
// case the header guard macro is defined.
#if !defined(_AIX) || !defined(_STD_TYPES_T)
-#define _LIBCPP_INTTYPES_H
+# define _LIBCPP_INTTYPES_H
#endif // _STD_TYPES_T
/*
@@ -245,7 +245,7 @@ uintmax_t wcstoumax(const wchar_t* restrict nptr, wchar_t** restrict endptr, int
for C++11 unless __STDC_FORMAT_MACROS is defined
*/
#if defined(__cplusplus) && !defined(__STDC_FORMAT_MACROS)
-# define __STDC_FORMAT_MACROS
+# define __STDC_FORMAT_MACROS
#endif
#if __has_include_next(<inttypes.h>)
@@ -254,10 +254,10 @@ uintmax_t wcstoumax(const wchar_t* restrict nptr, wchar_t** restrict endptr, int
#ifdef __cplusplus
-#include <stdint.h>
+# include <stdint.h>
-#undef imaxabs
-#undef imaxdiv
+# undef imaxabs
+# undef imaxdiv
#endif // __cplusplus
diff --git a/contrib/llvm-project/libcxx/include/iomanip b/contrib/llvm-project/libcxx/include/iomanip
index 157d974c6356..1b9563a24e10 100644
--- a/contrib/llvm-project/libcxx/include/iomanip
+++ b/contrib/llvm-project/libcxx/include/iomanip
@@ -55,601 +55,485 @@ _LIBCPP_BEGIN_NAMESPACE_STD
// resetiosflags
-class __iom_t1
-{
- ios_base::fmtflags __mask_;
+class __iom_t1 {
+ ios_base::fmtflags __mask_;
+
public:
- _LIBCPP_HIDE_FROM_ABI
- explicit __iom_t1(ios_base::fmtflags __m) : __mask_(__m) {}
-
- template <class _CharT, class _Traits>
- friend
- _LIBCPP_HIDE_FROM_ABI
- basic_istream<_CharT, _Traits>&
- operator>>(basic_istream<_CharT, _Traits>& __is, const __iom_t1& __x)
- {
- __is.unsetf(__x.__mask_);
- return __is;
- }
+ _LIBCPP_HIDE_FROM_ABI explicit __iom_t1(ios_base::fmtflags __m) : __mask_(__m) {}
- template <class _CharT, class _Traits>
- friend
- _LIBCPP_HIDE_FROM_ABI
- basic_ostream<_CharT, _Traits>&
- operator<<(basic_ostream<_CharT, _Traits>& __os, const __iom_t1& __x)
- {
- __os.unsetf(__x.__mask_);
- return __os;
- }
+ template <class _CharT, class _Traits>
+ friend _LIBCPP_HIDE_FROM_ABI basic_istream<_CharT, _Traits>&
+ operator>>(basic_istream<_CharT, _Traits>& __is, const __iom_t1& __x) {
+ __is.unsetf(__x.__mask_);
+ return __is;
+ }
+
+ template <class _CharT, class _Traits>
+ friend _LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>&
+ operator<<(basic_ostream<_CharT, _Traits>& __os, const __iom_t1& __x) {
+ __os.unsetf(__x.__mask_);
+ return __os;
+ }
};
-inline _LIBCPP_HIDE_FROM_ABI
-__iom_t1
-resetiosflags(ios_base::fmtflags __mask)
-{
- return __iom_t1(__mask);
-}
+inline _LIBCPP_HIDE_FROM_ABI __iom_t1 resetiosflags(ios_base::fmtflags __mask) { return __iom_t1(__mask); }
// setiosflags
-class __iom_t2
-{
- ios_base::fmtflags __mask_;
+class __iom_t2 {
+ ios_base::fmtflags __mask_;
+
public:
- _LIBCPP_HIDE_FROM_ABI
- explicit __iom_t2(ios_base::fmtflags __m) : __mask_(__m) {}
-
- template <class _CharT, class _Traits>
- friend
- _LIBCPP_HIDE_FROM_ABI
- basic_istream<_CharT, _Traits>&
- operator>>(basic_istream<_CharT, _Traits>& __is, const __iom_t2& __x)
- {
- __is.setf(__x.__mask_);
- return __is;
- }
+ _LIBCPP_HIDE_FROM_ABI explicit __iom_t2(ios_base::fmtflags __m) : __mask_(__m) {}
- template <class _CharT, class _Traits>
- friend
- _LIBCPP_HIDE_FROM_ABI
- basic_ostream<_CharT, _Traits>&
- operator<<(basic_ostream<_CharT, _Traits>& __os, const __iom_t2& __x)
- {
- __os.setf(__x.__mask_);
- return __os;
- }
+ template <class _CharT, class _Traits>
+ friend _LIBCPP_HIDE_FROM_ABI basic_istream<_CharT, _Traits>&
+ operator>>(basic_istream<_CharT, _Traits>& __is, const __iom_t2& __x) {
+ __is.setf(__x.__mask_);
+ return __is;
+ }
+
+ template <class _CharT, class _Traits>
+ friend _LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>&
+ operator<<(basic_ostream<_CharT, _Traits>& __os, const __iom_t2& __x) {
+ __os.setf(__x.__mask_);
+ return __os;
+ }
};
-inline _LIBCPP_HIDE_FROM_ABI
-__iom_t2
-setiosflags(ios_base::fmtflags __mask)
-{
- return __iom_t2(__mask);
-}
+inline _LIBCPP_HIDE_FROM_ABI __iom_t2 setiosflags(ios_base::fmtflags __mask) { return __iom_t2(__mask); }
// setbase
-class __iom_t3
-{
- int __base_;
-public:
- _LIBCPP_HIDE_FROM_ABI
- explicit __iom_t3(int __b) : __base_(__b) {}
-
- template <class _CharT, class _Traits>
- friend
- _LIBCPP_HIDE_FROM_ABI
- basic_istream<_CharT, _Traits>&
- operator>>(basic_istream<_CharT, _Traits>& __is, const __iom_t3& __x)
- {
- __is.setf(__x.__base_ == 8 ? ios_base::oct :
- __x.__base_ == 10 ? ios_base::dec :
- __x.__base_ == 16 ? ios_base::hex :
- ios_base::fmtflags(0), ios_base::basefield);
- return __is;
- }
+class __iom_t3 {
+ int __base_;
- template <class _CharT, class _Traits>
- friend
- _LIBCPP_HIDE_FROM_ABI
- basic_ostream<_CharT, _Traits>&
- operator<<(basic_ostream<_CharT, _Traits>& __os, const __iom_t3& __x)
- {
- __os.setf(__x.__base_ == 8 ? ios_base::oct :
- __x.__base_ == 10 ? ios_base::dec :
- __x.__base_ == 16 ? ios_base::hex :
- ios_base::fmtflags(0), ios_base::basefield);
- return __os;
- }
+public:
+ _LIBCPP_HIDE_FROM_ABI explicit __iom_t3(int __b) : __base_(__b) {}
+
+ template <class _CharT, class _Traits>
+ friend _LIBCPP_HIDE_FROM_ABI basic_istream<_CharT, _Traits>&
+ operator>>(basic_istream<_CharT, _Traits>& __is, const __iom_t3& __x) {
+ __is.setf(__x.__base_ == 8 ? ios_base::oct
+ : __x.__base_ == 10 ? ios_base::dec
+ : __x.__base_ == 16 ? ios_base::hex
+ : ios_base::fmtflags(0),
+ ios_base::basefield);
+ return __is;
+ }
+
+ template <class _CharT, class _Traits>
+ friend _LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>&
+ operator<<(basic_ostream<_CharT, _Traits>& __os, const __iom_t3& __x) {
+ __os.setf(__x.__base_ == 8 ? ios_base::oct
+ : __x.__base_ == 10 ? ios_base::dec
+ : __x.__base_ == 16 ? ios_base::hex
+ : ios_base::fmtflags(0),
+ ios_base::basefield);
+ return __os;
+ }
};
-inline _LIBCPP_HIDE_FROM_ABI
-__iom_t3
-setbase(int __base)
-{
- return __iom_t3(__base);
-}
+inline _LIBCPP_HIDE_FROM_ABI __iom_t3 setbase(int __base) { return __iom_t3(__base); }
// setfill
-template<class _CharT>
-class __iom_t4
-{
- _CharT __fill_;
+template <class _CharT>
+class __iom_t4 {
+ _CharT __fill_;
+
public:
- _LIBCPP_HIDE_FROM_ABI
- explicit __iom_t4(_CharT __c) : __fill_(__c) {}
-
- template <class _Traits>
- friend
- _LIBCPP_HIDE_FROM_ABI
- basic_ostream<_CharT, _Traits>&
- operator<<(basic_ostream<_CharT, _Traits>& __os, const __iom_t4& __x)
- {
- __os.fill(__x.__fill_);
- return __os;
- }
+ _LIBCPP_HIDE_FROM_ABI explicit __iom_t4(_CharT __c) : __fill_(__c) {}
+
+ template <class _Traits>
+ friend _LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>&
+ operator<<(basic_ostream<_CharT, _Traits>& __os, const __iom_t4& __x) {
+ __os.fill(__x.__fill_);
+ return __os;
+ }
};
-template<class _CharT>
-inline _LIBCPP_HIDE_FROM_ABI
-__iom_t4<_CharT>
-setfill(_CharT __c)
-{
- return __iom_t4<_CharT>(__c);
+template <class _CharT>
+inline _LIBCPP_HIDE_FROM_ABI __iom_t4<_CharT> setfill(_CharT __c) {
+ return __iom_t4<_CharT>(__c);
}
// setprecision
-class __iom_t5
-{
- int __n_;
+class __iom_t5 {
+ int __n_;
+
public:
- _LIBCPP_HIDE_FROM_ABI
- explicit __iom_t5(int __n) : __n_(__n) {}
-
- template <class _CharT, class _Traits>
- friend
- _LIBCPP_HIDE_FROM_ABI
- basic_istream<_CharT, _Traits>&
- operator>>(basic_istream<_CharT, _Traits>& __is, const __iom_t5& __x)
- {
- __is.precision(__x.__n_);
- return __is;
- }
+ _LIBCPP_HIDE_FROM_ABI explicit __iom_t5(int __n) : __n_(__n) {}
- template <class _CharT, class _Traits>
- friend
- _LIBCPP_HIDE_FROM_ABI
- basic_ostream<_CharT, _Traits>&
- operator<<(basic_ostream<_CharT, _Traits>& __os, const __iom_t5& __x)
- {
- __os.precision(__x.__n_);
- return __os;
- }
+ template <class _CharT, class _Traits>
+ friend _LIBCPP_HIDE_FROM_ABI basic_istream<_CharT, _Traits>&
+ operator>>(basic_istream<_CharT, _Traits>& __is, const __iom_t5& __x) {
+ __is.precision(__x.__n_);
+ return __is;
+ }
+
+ template <class _CharT, class _Traits>
+ friend _LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>&
+ operator<<(basic_ostream<_CharT, _Traits>& __os, const __iom_t5& __x) {
+ __os.precision(__x.__n_);
+ return __os;
+ }
};
-inline _LIBCPP_HIDE_FROM_ABI
-__iom_t5
-setprecision(int __n)
-{
- return __iom_t5(__n);
-}
+inline _LIBCPP_HIDE_FROM_ABI __iom_t5 setprecision(int __n) { return __iom_t5(__n); }
// setw
-class __iom_t6
-{
- int __n_;
+class __iom_t6 {
+ int __n_;
+
public:
- _LIBCPP_HIDE_FROM_ABI
- explicit __iom_t6(int __n) : __n_(__n) {}
-
- template <class _CharT, class _Traits>
- friend
- _LIBCPP_HIDE_FROM_ABI
- basic_istream<_CharT, _Traits>&
- operator>>(basic_istream<_CharT, _Traits>& __is, const __iom_t6& __x)
- {
- __is.width(__x.__n_);
- return __is;
- }
+ _LIBCPP_HIDE_FROM_ABI explicit __iom_t6(int __n) : __n_(__n) {}
- template <class _CharT, class _Traits>
- friend
- _LIBCPP_HIDE_FROM_ABI
- basic_ostream<_CharT, _Traits>&
- operator<<(basic_ostream<_CharT, _Traits>& __os, const __iom_t6& __x)
- {
- __os.width(__x.__n_);
- return __os;
- }
+ template <class _CharT, class _Traits>
+ friend _LIBCPP_HIDE_FROM_ABI basic_istream<_CharT, _Traits>&
+ operator>>(basic_istream<_CharT, _Traits>& __is, const __iom_t6& __x) {
+ __is.width(__x.__n_);
+ return __is;
+ }
+
+ template <class _CharT, class _Traits>
+ friend _LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>&
+ operator<<(basic_ostream<_CharT, _Traits>& __os, const __iom_t6& __x) {
+ __os.width(__x.__n_);
+ return __os;
+ }
};
-inline _LIBCPP_HIDE_FROM_ABI
-__iom_t6
-setw(int __n)
-{
- return __iom_t6(__n);
-}
+inline _LIBCPP_HIDE_FROM_ABI __iom_t6 setw(int __n) { return __iom_t6(__n); }
// get_money
-template <class _MoneyT> class __iom_t7;
+template <class _MoneyT>
+class __iom_t7;
template <class _CharT, class _Traits, class _MoneyT>
_LIBCPP_HIDE_FROM_ABI basic_istream<_CharT, _Traits>&
operator>>(basic_istream<_CharT, _Traits>& __is, const __iom_t7<_MoneyT>& __x);
template <class _MoneyT>
-class __iom_t7
-{
- _MoneyT& __mon_;
- bool __intl_;
+class __iom_t7 {
+ _MoneyT& __mon_;
+ bool __intl_;
+
public:
- _LIBCPP_HIDE_FROM_ABI
- __iom_t7(_MoneyT& __mon, bool __intl)
- : __mon_(__mon), __intl_(__intl) {}
-
- template <class _CharT, class _Traits, class _Mp>
- friend
- basic_istream<_CharT, _Traits>&
- operator>>(basic_istream<_CharT, _Traits>& __is, const __iom_t7<_Mp>& __x);
+ _LIBCPP_HIDE_FROM_ABI __iom_t7(_MoneyT& __mon, bool __intl) : __mon_(__mon), __intl_(__intl) {}
+
+ template <class _CharT, class _Traits, class _Mp>
+ friend basic_istream<_CharT, _Traits>& operator>>(basic_istream<_CharT, _Traits>& __is, const __iom_t7<_Mp>& __x);
};
template <class _CharT, class _Traits, class _MoneyT>
_LIBCPP_HIDE_FROM_ABI basic_istream<_CharT, _Traits>&
-operator>>(basic_istream<_CharT, _Traits>& __is, const __iom_t7<_MoneyT>& __x)
-{
+operator>>(basic_istream<_CharT, _Traits>& __is, const __iom_t7<_MoneyT>& __x) {
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- try
- {
+ try {
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- typename basic_istream<_CharT, _Traits>::sentry __s(__is);
- if (__s)
- {
- typedef istreambuf_iterator<_CharT, _Traits> _Ip;
- typedef money_get<_CharT, _Ip> _Fp;
- ios_base::iostate __err = ios_base::goodbit;
- const _Fp& __mf = std::use_facet<_Fp>(__is.getloc());
- __mf.get(_Ip(__is), _Ip(), __x.__intl_, __is, __err, __x.__mon_);
- __is.setstate(__err);
- }
-#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- }
- catch (...)
- {
- __is.__set_badbit_and_consider_rethrow();
+ typename basic_istream<_CharT, _Traits>::sentry __s(__is);
+ if (__s) {
+ typedef istreambuf_iterator<_CharT, _Traits> _Ip;
+ typedef money_get<_CharT, _Ip> _Fp;
+ ios_base::iostate __err = ios_base::goodbit;
+ const _Fp& __mf = std::use_facet<_Fp>(__is.getloc());
+ __mf.get(_Ip(__is), _Ip(), __x.__intl_, __is, __err, __x.__mon_);
+ __is.setstate(__err);
}
+#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
+ } catch (...) {
+ __is.__set_badbit_and_consider_rethrow();
+ }
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- return __is;
+ return __is;
}
template <class _MoneyT>
-inline _LIBCPP_HIDE_FROM_ABI
-__iom_t7<_MoneyT>
-get_money(_MoneyT& __mon, bool __intl = false)
-{
- return __iom_t7<_MoneyT>(__mon, __intl);
+inline _LIBCPP_HIDE_FROM_ABI __iom_t7<_MoneyT> get_money(_MoneyT& __mon, bool __intl = false) {
+ return __iom_t7<_MoneyT>(__mon, __intl);
}
// put_money
-template <class _MoneyT> class __iom_t8;
+template <class _MoneyT>
+class __iom_t8;
template <class _CharT, class _Traits, class _MoneyT>
_LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>&
operator<<(basic_ostream<_CharT, _Traits>& __os, const __iom_t8<_MoneyT>& __x);
template <class _MoneyT>
-class __iom_t8
-{
- const _MoneyT& __mon_;
- bool __intl_;
+class __iom_t8 {
+ const _MoneyT& __mon_;
+ bool __intl_;
+
public:
- _LIBCPP_HIDE_FROM_ABI
- __iom_t8(const _MoneyT& __mon, bool __intl)
- : __mon_(__mon), __intl_(__intl) {}
-
- template <class _CharT, class _Traits, class _Mp>
- friend
- basic_ostream<_CharT, _Traits>&
- operator<<(basic_ostream<_CharT, _Traits>& __os, const __iom_t8<_Mp>& __x);
+ _LIBCPP_HIDE_FROM_ABI __iom_t8(const _MoneyT& __mon, bool __intl) : __mon_(__mon), __intl_(__intl) {}
+
+ template <class _CharT, class _Traits, class _Mp>
+ friend basic_ostream<_CharT, _Traits>& operator<<(basic_ostream<_CharT, _Traits>& __os, const __iom_t8<_Mp>& __x);
};
template <class _CharT, class _Traits, class _MoneyT>
_LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>&
-operator<<(basic_ostream<_CharT, _Traits>& __os, const __iom_t8<_MoneyT>& __x)
-{
+operator<<(basic_ostream<_CharT, _Traits>& __os, const __iom_t8<_MoneyT>& __x) {
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- try
- {
+ try {
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- typename basic_ostream<_CharT, _Traits>::sentry __s(__os);
- if (__s)
- {
- typedef ostreambuf_iterator<_CharT, _Traits> _Op;
- typedef money_put<_CharT, _Op> _Fp;
- const _Fp& __mf = std::use_facet<_Fp>(__os.getloc());
- if (__mf.put(_Op(__os), __x.__intl_, __os, __os.fill(), __x.__mon_).failed())
- __os.setstate(ios_base::badbit);
- }
-#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- }
- catch (...)
- {
- __os.__set_badbit_and_consider_rethrow();
+ typename basic_ostream<_CharT, _Traits>::sentry __s(__os);
+ if (__s) {
+ typedef ostreambuf_iterator<_CharT, _Traits> _Op;
+ typedef money_put<_CharT, _Op> _Fp;
+ const _Fp& __mf = std::use_facet<_Fp>(__os.getloc());
+ if (__mf.put(_Op(__os), __x.__intl_, __os, __os.fill(), __x.__mon_).failed())
+ __os.setstate(ios_base::badbit);
}
+#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
+ } catch (...) {
+ __os.__set_badbit_and_consider_rethrow();
+ }
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- return __os;
+ return __os;
}
template <class _MoneyT>
-inline _LIBCPP_HIDE_FROM_ABI
-__iom_t8<_MoneyT>
-put_money(const _MoneyT& __mon, bool __intl = false)
-{
- return __iom_t8<_MoneyT>(__mon, __intl);
+inline _LIBCPP_HIDE_FROM_ABI __iom_t8<_MoneyT> put_money(const _MoneyT& __mon, bool __intl = false) {
+ return __iom_t8<_MoneyT>(__mon, __intl);
}
// get_time
-template <class _CharT> class __iom_t9;
+template <class _CharT>
+class __iom_t9;
template <class _CharT, class _Traits>
_LIBCPP_HIDE_FROM_ABI basic_istream<_CharT, _Traits>&
operator>>(basic_istream<_CharT, _Traits>& __is, const __iom_t9<_CharT>& __x);
template <class _CharT>
-class __iom_t9
-{
- tm* __tm_;
- const _CharT* __fmt_;
+class __iom_t9 {
+ tm* __tm_;
+ const _CharT* __fmt_;
+
public:
- _LIBCPP_HIDE_FROM_ABI
- __iom_t9(tm* __tm, const _CharT* __fmt)
- : __tm_(__tm), __fmt_(__fmt) {}
-
- template <class _Cp, class _Traits>
- friend
- basic_istream<_Cp, _Traits>&
- operator>>(basic_istream<_Cp, _Traits>& __is, const __iom_t9<_Cp>& __x);
+ _LIBCPP_HIDE_FROM_ABI __iom_t9(tm* __tm, const _CharT* __fmt) : __tm_(__tm), __fmt_(__fmt) {}
+
+ template <class _Cp, class _Traits>
+ friend basic_istream<_Cp, _Traits>& operator>>(basic_istream<_Cp, _Traits>& __is, const __iom_t9<_Cp>& __x);
};
template <class _CharT, class _Traits>
_LIBCPP_HIDE_FROM_ABI basic_istream<_CharT, _Traits>&
-operator>>(basic_istream<_CharT, _Traits>& __is, const __iom_t9<_CharT>& __x)
-{
+operator>>(basic_istream<_CharT, _Traits>& __is, const __iom_t9<_CharT>& __x) {
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- try
- {
+ try {
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- typename basic_istream<_CharT, _Traits>::sentry __s(__is);
- if (__s)
- {
- typedef istreambuf_iterator<_CharT, _Traits> _Ip;
- typedef time_get<_CharT, _Ip> _Fp;
- ios_base::iostate __err = ios_base::goodbit;
- const _Fp& __tf = std::use_facet<_Fp>(__is.getloc());
- __tf.get(_Ip(__is), _Ip(), __is, __err, __x.__tm_,
- __x.__fmt_, __x.__fmt_ + _Traits::length(__x.__fmt_));
- __is.setstate(__err);
- }
-#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- }
- catch (...)
- {
- __is.__set_badbit_and_consider_rethrow();
+ typename basic_istream<_CharT, _Traits>::sentry __s(__is);
+ if (__s) {
+ typedef istreambuf_iterator<_CharT, _Traits> _Ip;
+ typedef time_get<_CharT, _Ip> _Fp;
+ ios_base::iostate __err = ios_base::goodbit;
+ const _Fp& __tf = std::use_facet<_Fp>(__is.getloc());
+ __tf.get(_Ip(__is), _Ip(), __is, __err, __x.__tm_, __x.__fmt_, __x.__fmt_ + _Traits::length(__x.__fmt_));
+ __is.setstate(__err);
}
+#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
+ } catch (...) {
+ __is.__set_badbit_and_consider_rethrow();
+ }
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- return __is;
+ return __is;
}
template <class _CharT>
-inline _LIBCPP_HIDE_FROM_ABI
-__iom_t9<_CharT>
-get_time(tm* __tm, const _CharT* __fmt)
-{
- return __iom_t9<_CharT>(__tm, __fmt);
+inline _LIBCPP_HIDE_FROM_ABI __iom_t9<_CharT> get_time(tm* __tm, const _CharT* __fmt) {
+ return __iom_t9<_CharT>(__tm, __fmt);
}
// put_time
-template <class _CharT> class __iom_t10;
+template <class _CharT>
+class __iom_t10;
template <class _CharT, class _Traits>
_LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>&
operator<<(basic_ostream<_CharT, _Traits>& __os, const __iom_t10<_CharT>& __x);
template <class _CharT>
-class __iom_t10
-{
- const tm* __tm_;
- const _CharT* __fmt_;
+class __iom_t10 {
+ const tm* __tm_;
+ const _CharT* __fmt_;
+
public:
- _LIBCPP_HIDE_FROM_ABI
- __iom_t10(const tm* __tm, const _CharT* __fmt)
- : __tm_(__tm), __fmt_(__fmt) {}
-
- template <class _Cp, class _Traits>
- friend
- basic_ostream<_Cp, _Traits>&
- operator<<(basic_ostream<_Cp, _Traits>& __os, const __iom_t10<_Cp>& __x);
+ _LIBCPP_HIDE_FROM_ABI __iom_t10(const tm* __tm, const _CharT* __fmt) : __tm_(__tm), __fmt_(__fmt) {}
+
+ template <class _Cp, class _Traits>
+ friend basic_ostream<_Cp, _Traits>& operator<<(basic_ostream<_Cp, _Traits>& __os, const __iom_t10<_Cp>& __x);
};
template <class _CharT, class _Traits>
_LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>&
-operator<<(basic_ostream<_CharT, _Traits>& __os, const __iom_t10<_CharT>& __x)
-{
+operator<<(basic_ostream<_CharT, _Traits>& __os, const __iom_t10<_CharT>& __x) {
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- try
- {
+ try {
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- typename basic_ostream<_CharT, _Traits>::sentry __s(__os);
- if (__s)
- {
- typedef ostreambuf_iterator<_CharT, _Traits> _Op;
- typedef time_put<_CharT, _Op> _Fp;
- const _Fp& __tf = std::use_facet<_Fp>(__os.getloc());
- if (__tf.put(_Op(__os), __os, __os.fill(), __x.__tm_,
- __x.__fmt_, __x.__fmt_ + _Traits::length(__x.__fmt_)).failed())
- __os.setstate(ios_base::badbit);
- }
-#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- }
- catch (...)
- {
- __os.__set_badbit_and_consider_rethrow();
+ typename basic_ostream<_CharT, _Traits>::sentry __s(__os);
+ if (__s) {
+ typedef ostreambuf_iterator<_CharT, _Traits> _Op;
+ typedef time_put<_CharT, _Op> _Fp;
+ const _Fp& __tf = std::use_facet<_Fp>(__os.getloc());
+ if (__tf.put(_Op(__os), __os, __os.fill(), __x.__tm_, __x.__fmt_, __x.__fmt_ + _Traits::length(__x.__fmt_))
+ .failed())
+ __os.setstate(ios_base::badbit);
}
+#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
+ } catch (...) {
+ __os.__set_badbit_and_consider_rethrow();
+ }
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- return __os;
+ return __os;
}
template <class _CharT>
-inline _LIBCPP_HIDE_FROM_ABI
-__iom_t10<_CharT>
-put_time(const tm* __tm, const _CharT* __fmt)
-{
- return __iom_t10<_CharT>(__tm, __fmt);
+inline _LIBCPP_HIDE_FROM_ABI __iom_t10<_CharT> put_time(const tm* __tm, const _CharT* __fmt) {
+ return __iom_t10<_CharT>(__tm, __fmt);
}
template <class _CharT, class _Traits>
-_LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>&
-__quoted_output(basic_ostream<_CharT, _Traits>& __os,
- const _CharT *__first, const _CharT *__last, _CharT __delim, _CharT __escape)
-{
- basic_string<_CharT, _Traits> __str;
- __str.push_back(__delim);
- for (; __first != __last; ++__first) {
- if (_Traits::eq(*__first, __escape) || _Traits::eq(*__first, __delim))
- __str.push_back(__escape);
- __str.push_back(*__first);
- }
- __str.push_back(__delim);
- return std::__put_character_sequence(__os, __str.data(), __str.size());
+_LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>& __quoted_output(
+ basic_ostream<_CharT, _Traits>& __os,
+ const _CharT* __first,
+ const _CharT* __last,
+ _CharT __delim,
+ _CharT __escape) {
+ basic_string<_CharT, _Traits> __str;
+ __str.push_back(__delim);
+ for (; __first != __last; ++__first) {
+ if (_Traits::eq(*__first, __escape) || _Traits::eq(*__first, __delim))
+ __str.push_back(__escape);
+ __str.push_back(*__first);
+ }
+ __str.push_back(__delim);
+ return std::__put_character_sequence(__os, __str.data(), __str.size());
}
template <class _CharT, class _Traits, class _String>
_LIBCPP_HIDE_FROM_ABI basic_istream<_CharT, _Traits>&
-__quoted_input(basic_istream<_CharT, _Traits>& __is, _String& __string, _CharT __delim, _CharT __escape)
-{
- __string.clear();
- _CharT __c;
- __is >> __c;
- if (__is.fail())
- return __is;
-
- if (!_Traits::eq(__c, __delim)) {
- // no delimiter, read the whole string
- __is.unget();
- __is >> __string;
- return __is;
- }
+__quoted_input(basic_istream<_CharT, _Traits>& __is, _String& __string, _CharT __delim, _CharT __escape) {
+ __string.clear();
+ _CharT __c;
+ __is >> __c;
+ if (__is.fail())
+ return __is;
- __save_flags<_CharT, _Traits> __sf(__is);
- std::noskipws(__is);
- while (true) {
- __is >> __c;
- if (__is.fail())
- break;
- if (_Traits::eq(__c, __escape)) {
- __is >> __c;
- if (__is.fail())
- break;
- } else if (_Traits::eq(__c, __delim))
- break;
- __string.push_back(__c);
- }
+ if (!_Traits::eq(__c, __delim)) {
+ // no delimiter, read the whole string
+ __is.unget();
+ __is >> __string;
return __is;
+ }
+
+ __save_flags<_CharT, _Traits> __sf(__is);
+ std::noskipws(__is);
+ while (true) {
+ __is >> __c;
+ if (__is.fail())
+ break;
+ if (_Traits::eq(__c, __escape)) {
+ __is >> __c;
+ if (__is.fail())
+ break;
+ } else if (_Traits::eq(__c, __delim))
+ break;
+ __string.push_back(__c);
+ }
+ return __is;
}
template <class _CharT, class _Traits>
-struct _LIBCPP_HIDDEN __quoted_output_proxy
-{
- const _CharT *__first_;
- const _CharT *__last_;
- _CharT __delim_;
- _CharT __escape_;
-
- _LIBCPP_HIDE_FROM_ABI
- explicit __quoted_output_proxy(const _CharT *__f, const _CharT *__l, _CharT __d, _CharT __e)
- : __first_(__f), __last_(__l), __delim_(__d), __escape_(__e) {}
-
- template<class _T2, __enable_if_t<_IsSame<_Traits, void>::value || _IsSame<_Traits, _T2>::value>* = nullptr>
- friend _LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _T2>&
- operator<<(basic_ostream<_CharT, _T2>& __os, const __quoted_output_proxy& __p) {
- return std::__quoted_output(__os, __p.__first_, __p.__last_, __p.__delim_, __p.__escape_);
- }
+struct _LIBCPP_HIDDEN __quoted_output_proxy {
+ const _CharT* __first_;
+ const _CharT* __last_;
+ _CharT __delim_;
+ _CharT __escape_;
+
+ _LIBCPP_HIDE_FROM_ABI explicit __quoted_output_proxy(const _CharT* __f, const _CharT* __l, _CharT __d, _CharT __e)
+ : __first_(__f), __last_(__l), __delim_(__d), __escape_(__e) {}
+
+ template <class _T2, __enable_if_t<_IsSame<_Traits, void>::value || _IsSame<_Traits, _T2>::value>* = nullptr>
+ friend _LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _T2>&
+ operator<<(basic_ostream<_CharT, _T2>& __os, const __quoted_output_proxy& __p) {
+ return std::__quoted_output(__os, __p.__first_, __p.__last_, __p.__delim_, __p.__escape_);
+ }
};
template <class _CharT, class _Traits, class _Allocator>
-struct _LIBCPP_HIDDEN __quoted_proxy
-{
- basic_string<_CharT, _Traits, _Allocator>& __string_;
- _CharT __delim_;
- _CharT __escape_;
-
- _LIBCPP_HIDE_FROM_ABI
- explicit __quoted_proxy(basic_string<_CharT, _Traits, _Allocator>& __s, _CharT __d, _CharT __e)
- : __string_(__s), __delim_(__d), __escape_(__e) {}
-
- friend _LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>&
- operator<<(basic_ostream<_CharT, _Traits>& __os, const __quoted_proxy& __p) {
- return std::__quoted_output(__os, __p.__string_.data(), __p.__string_.data() + __p.__string_.size(), __p.__delim_, __p.__escape_);
- }
-
- friend _LIBCPP_HIDE_FROM_ABI basic_istream<_CharT, _Traits>&
- operator>>(basic_istream<_CharT, _Traits>& __is, const __quoted_proxy& __p) {
- return std::__quoted_input(__is, __p.__string_, __p.__delim_, __p.__escape_);
- }
+struct _LIBCPP_HIDDEN __quoted_proxy {
+ basic_string<_CharT, _Traits, _Allocator>& __string_;
+ _CharT __delim_;
+ _CharT __escape_;
+
+ _LIBCPP_HIDE_FROM_ABI explicit __quoted_proxy(basic_string<_CharT, _Traits, _Allocator>& __s, _CharT __d, _CharT __e)
+ : __string_(__s), __delim_(__d), __escape_(__e) {}
+
+ friend _LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>&
+ operator<<(basic_ostream<_CharT, _Traits>& __os, const __quoted_proxy& __p) {
+ return std::__quoted_output(
+ __os, __p.__string_.data(), __p.__string_.data() + __p.__string_.size(), __p.__delim_, __p.__escape_);
+ }
+
+ friend _LIBCPP_HIDE_FROM_ABI basic_istream<_CharT, _Traits>&
+ operator>>(basic_istream<_CharT, _Traits>& __is, const __quoted_proxy& __p) {
+ return std::__quoted_input(__is, __p.__string_, __p.__delim_, __p.__escape_);
+ }
};
template <class _CharT, class _Traits, class _Allocator>
-_LIBCPP_HIDE_FROM_ABI
-__quoted_output_proxy<_CharT, _Traits>
-__quoted(const basic_string<_CharT, _Traits, _Allocator>& __s, _CharT __delim = _CharT('"'), _CharT __escape = _CharT('\\'))
-{
- return __quoted_output_proxy<_CharT, _Traits>(__s.data(), __s.data() + __s.size(), __delim, __escape);
+_LIBCPP_HIDE_FROM_ABI __quoted_output_proxy<_CharT, _Traits>
+__quoted(const basic_string<_CharT, _Traits, _Allocator>& __s,
+ _CharT __delim = _CharT('"'),
+ _CharT __escape = _CharT('\\')) {
+ return __quoted_output_proxy<_CharT, _Traits>(__s.data(), __s.data() + __s.size(), __delim, __escape);
}
template <class _CharT, class _Traits, class _Allocator>
-_LIBCPP_HIDE_FROM_ABI
-__quoted_proxy<_CharT, _Traits, _Allocator>
-__quoted(basic_string<_CharT, _Traits, _Allocator>& __s, _CharT __delim = _CharT('"'), _CharT __escape = _CharT('\\'))
-{
- return __quoted_proxy<_CharT, _Traits, _Allocator>(__s, __delim, __escape);
+_LIBCPP_HIDE_FROM_ABI __quoted_proxy<_CharT, _Traits, _Allocator>
+__quoted(basic_string<_CharT, _Traits, _Allocator>& __s, _CharT __delim = _CharT('"'), _CharT __escape = _CharT('\\')) {
+ return __quoted_proxy<_CharT, _Traits, _Allocator>(__s, __delim, __escape);
}
#if _LIBCPP_STD_VER >= 14
template <class _CharT>
-_LIBCPP_HIDE_FROM_ABI
-auto quoted(const _CharT *__s, _CharT __delim = _CharT('"'), _CharT __escape = _CharT('\\'))
-{
- const _CharT *__end = __s;
- while (*__end) ++__end;
- return __quoted_output_proxy<_CharT, void>(__s, __end, __delim, __escape);
+_LIBCPP_HIDE_FROM_ABI auto quoted(const _CharT* __s, _CharT __delim = _CharT('"'), _CharT __escape = _CharT('\\')) {
+ const _CharT* __end = __s;
+ while (*__end)
+ ++__end;
+ return __quoted_output_proxy<_CharT, void>(__s, __end, __delim, __escape);
}
template <class _CharT, class _Traits, class _Allocator>
-_LIBCPP_HIDE_FROM_ABI
-auto quoted(const basic_string<_CharT, _Traits, _Allocator>& __s, _CharT __delim = _CharT('"'), _CharT __escape = _CharT('\\'))
-{
- return __quoted_output_proxy<_CharT, _Traits>(__s.data(), __s.data() + __s.size(), __delim, __escape);
+_LIBCPP_HIDE_FROM_ABI auto
+quoted(const basic_string<_CharT, _Traits, _Allocator>& __s,
+ _CharT __delim = _CharT('"'),
+ _CharT __escape = _CharT('\\')) {
+ return __quoted_output_proxy<_CharT, _Traits>(__s.data(), __s.data() + __s.size(), __delim, __escape);
}
template <class _CharT, class _Traits, class _Allocator>
-_LIBCPP_HIDE_FROM_ABI
-auto quoted(basic_string<_CharT, _Traits, _Allocator>& __s, _CharT __delim = _CharT('"'), _CharT __escape = _CharT('\\'))
-{
- return __quoted_proxy<_CharT, _Traits, _Allocator>(__s, __delim, __escape);
+_LIBCPP_HIDE_FROM_ABI auto
+quoted(basic_string<_CharT, _Traits, _Allocator>& __s, _CharT __delim = _CharT('"'), _CharT __escape = _CharT('\\')) {
+ return __quoted_proxy<_CharT, _Traits, _Allocator>(__s, __delim, __escape);
}
template <class _CharT, class _Traits>
-_LIBCPP_HIDE_FROM_ABI
-auto quoted(basic_string_view<_CharT, _Traits> __sv, _CharT __delim = _CharT('"'), _CharT __escape = _CharT('\\'))
-{
- return __quoted_output_proxy<_CharT, _Traits>(__sv.data(), __sv.data() + __sv.size(), __delim, __escape);
+_LIBCPP_HIDE_FROM_ABI auto
+quoted(basic_string_view<_CharT, _Traits> __sv, _CharT __delim = _CharT('"'), _CharT __escape = _CharT('\\')) {
+ return __quoted_output_proxy<_CharT, _Traits>(__sv.data(), __sv.data() + __sv.size(), __delim, __escape);
}
#endif // _LIBCPP_STD_VER >= 14
diff --git a/contrib/llvm-project/libcxx/include/ios b/contrib/llvm-project/libcxx/include/ios
index 63abebcded3c..d36f5fb2ca28 100644
--- a/contrib/llvm-project/libcxx/include/ios
+++ b/contrib/llvm-project/libcxx/include/ios
@@ -214,7 +214,7 @@ storage-class-specifier const error_category& iostream_category() noexcept;
#include <__config>
#if defined(_LIBCPP_HAS_NO_LOCALIZATION)
-# error "The iostreams library is not supported since libc++ has been configured without support for localization."
+# error "The iostreams library is not supported since libc++ has been configured without support for localization."
#endif
#include <__assert> // all public C++ headers provide the assertion handler
@@ -246,609 +246,450 @@ _LIBCPP_BEGIN_NAMESPACE_STD
typedef ptrdiff_t streamsize;
-class _LIBCPP_EXPORTED_FROM_ABI ios_base
-{
+class _LIBCPP_EXPORTED_FROM_ABI ios_base {
public:
- class _LIBCPP_EXPORTED_FROM_ABI failure;
-
- typedef unsigned int fmtflags;
- static const fmtflags boolalpha = 0x0001;
- static const fmtflags dec = 0x0002;
- static const fmtflags fixed = 0x0004;
- static const fmtflags hex = 0x0008;
- static const fmtflags internal = 0x0010;
- static const fmtflags left = 0x0020;
- static const fmtflags oct = 0x0040;
- static const fmtflags right = 0x0080;
- static const fmtflags scientific = 0x0100;
- static const fmtflags showbase = 0x0200;
- static const fmtflags showpoint = 0x0400;
- static const fmtflags showpos = 0x0800;
- static const fmtflags skipws = 0x1000;
- static const fmtflags unitbuf = 0x2000;
- static const fmtflags uppercase = 0x4000;
- static const fmtflags adjustfield = left | right | internal;
- static const fmtflags basefield = dec | oct | hex;
- static const fmtflags floatfield = scientific | fixed;
-
- typedef unsigned int iostate;
- static const iostate badbit = 0x1;
- static const iostate eofbit = 0x2;
- static const iostate failbit = 0x4;
- static const iostate goodbit = 0x0;
-
- typedef unsigned int openmode;
- static const openmode app = 0x01;
- static const openmode ate = 0x02;
- static const openmode binary = 0x04;
- static const openmode in = 0x08;
- static const openmode out = 0x10;
- static const openmode trunc = 0x20;
+ class _LIBCPP_EXPORTED_FROM_ABI failure;
+
+ typedef unsigned int fmtflags;
+ static const fmtflags boolalpha = 0x0001;
+ static const fmtflags dec = 0x0002;
+ static const fmtflags fixed = 0x0004;
+ static const fmtflags hex = 0x0008;
+ static const fmtflags internal = 0x0010;
+ static const fmtflags left = 0x0020;
+ static const fmtflags oct = 0x0040;
+ static const fmtflags right = 0x0080;
+ static const fmtflags scientific = 0x0100;
+ static const fmtflags showbase = 0x0200;
+ static const fmtflags showpoint = 0x0400;
+ static const fmtflags showpos = 0x0800;
+ static const fmtflags skipws = 0x1000;
+ static const fmtflags unitbuf = 0x2000;
+ static const fmtflags uppercase = 0x4000;
+ static const fmtflags adjustfield = left | right | internal;
+ static const fmtflags basefield = dec | oct | hex;
+ static const fmtflags floatfield = scientific | fixed;
+
+ typedef unsigned int iostate;
+ static const iostate badbit = 0x1;
+ static const iostate eofbit = 0x2;
+ static const iostate failbit = 0x4;
+ static const iostate goodbit = 0x0;
+
+ typedef unsigned int openmode;
+ static const openmode app = 0x01;
+ static const openmode ate = 0x02;
+ static const openmode binary = 0x04;
+ static const openmode in = 0x08;
+ static const openmode out = 0x10;
+ static const openmode trunc = 0x20;
#if _LIBCPP_STD_VER >= 23
- static const openmode noreplace = 0x40;
+ static const openmode noreplace = 0x40;
#endif
- enum seekdir {beg, cur, end};
+ enum seekdir { beg, cur, end };
#if _LIBCPP_STD_VER <= 14
- typedef iostate io_state;
- typedef openmode open_mode;
- typedef seekdir seek_dir;
+ typedef iostate io_state;
+ typedef openmode open_mode;
+ typedef seekdir seek_dir;
- typedef std::streamoff streamoff;
- typedef std::streampos streampos;
+ typedef std::streamoff streamoff;
+ typedef std::streampos streampos;
#endif
- class _LIBCPP_EXPORTED_FROM_ABI Init;
+ class _LIBCPP_EXPORTED_FROM_ABI Init;
- // 27.5.2.2 fmtflags state:
- _LIBCPP_HIDE_FROM_ABI fmtflags flags() const;
- _LIBCPP_HIDE_FROM_ABI fmtflags flags(fmtflags __fmtfl);
- _LIBCPP_HIDE_FROM_ABI fmtflags setf(fmtflags __fmtfl);
- _LIBCPP_HIDE_FROM_ABI fmtflags setf(fmtflags __fmtfl, fmtflags __mask);
- _LIBCPP_HIDE_FROM_ABI void unsetf(fmtflags __mask);
+ // 27.5.2.2 fmtflags state:
+ _LIBCPP_HIDE_FROM_ABI fmtflags flags() const;
+ _LIBCPP_HIDE_FROM_ABI fmtflags flags(fmtflags __fmtfl);
+ _LIBCPP_HIDE_FROM_ABI fmtflags setf(fmtflags __fmtfl);
+ _LIBCPP_HIDE_FROM_ABI fmtflags setf(fmtflags __fmtfl, fmtflags __mask);
+ _LIBCPP_HIDE_FROM_ABI void unsetf(fmtflags __mask);
- _LIBCPP_HIDE_FROM_ABI streamsize precision() const;
- _LIBCPP_HIDE_FROM_ABI streamsize precision(streamsize __prec);
- _LIBCPP_HIDE_FROM_ABI streamsize width() const;
- _LIBCPP_HIDE_FROM_ABI streamsize width(streamsize __wide);
+ _LIBCPP_HIDE_FROM_ABI streamsize precision() const;
+ _LIBCPP_HIDE_FROM_ABI streamsize precision(streamsize __prec);
+ _LIBCPP_HIDE_FROM_ABI streamsize width() const;
+ _LIBCPP_HIDE_FROM_ABI streamsize width(streamsize __wide);
- // 27.5.2.3 locales:
- locale imbue(const locale& __loc);
- locale getloc() const;
+ // 27.5.2.3 locales:
+ locale imbue(const locale& __loc);
+ locale getloc() const;
- // 27.5.2.5 storage:
- static int xalloc();
- long& iword(int __index);
- void*& pword(int __index);
+ // 27.5.2.5 storage:
+ static int xalloc();
+ long& iword(int __index);
+ void*& pword(int __index);
- // destructor
- virtual ~ios_base();
+ // destructor
+ virtual ~ios_base();
- // 27.5.2.6 callbacks;
- enum event { erase_event, imbue_event, copyfmt_event };
- typedef void (*event_callback)(event, ios_base&, int __index);
- void register_callback(event_callback __fn, int __index);
+ // 27.5.2.6 callbacks;
+ enum event { erase_event, imbue_event, copyfmt_event };
+ typedef void (*event_callback)(event, ios_base&, int __index);
+ void register_callback(event_callback __fn, int __index);
- ios_base(const ios_base&) = delete;
- ios_base& operator=(const ios_base&) = delete;
+ ios_base(const ios_base&) = delete;
+ ios_base& operator=(const ios_base&) = delete;
- static bool sync_with_stdio(bool __sync = true);
+ static bool sync_with_stdio(bool __sync = true);
- _LIBCPP_HIDE_FROM_ABI iostate rdstate() const;
- void clear(iostate __state = goodbit);
- _LIBCPP_HIDE_FROM_ABI void setstate(iostate __state);
+ _LIBCPP_HIDE_FROM_ABI iostate rdstate() const;
+ void clear(iostate __state = goodbit);
+ _LIBCPP_HIDE_FROM_ABI void setstate(iostate __state);
- _LIBCPP_HIDE_FROM_ABI bool good() const;
- _LIBCPP_HIDE_FROM_ABI bool eof() const;
- _LIBCPP_HIDE_FROM_ABI bool fail() const;
- _LIBCPP_HIDE_FROM_ABI bool bad() const;
+ _LIBCPP_HIDE_FROM_ABI bool good() const;
+ _LIBCPP_HIDE_FROM_ABI bool eof() const;
+ _LIBCPP_HIDE_FROM_ABI bool fail() const;
+ _LIBCPP_HIDE_FROM_ABI bool bad() const;
- _LIBCPP_HIDE_FROM_ABI iostate exceptions() const;
- _LIBCPP_HIDE_FROM_ABI void exceptions(iostate __iostate);
+ _LIBCPP_HIDE_FROM_ABI iostate exceptions() const;
+ _LIBCPP_HIDE_FROM_ABI void exceptions(iostate __iostate);
- void __set_badbit_and_consider_rethrow();
- void __set_failbit_and_consider_rethrow();
+ void __set_badbit_and_consider_rethrow();
+ void __set_failbit_and_consider_rethrow();
- _LIBCPP_HIDE_FROM_ABI
- void __setstate_nothrow(iostate __state)
- {
- if (__rdbuf_)
- __rdstate_ |= __state;
- else
- __rdstate_ |= __state | ios_base::badbit;
- }
+ _LIBCPP_HIDE_FROM_ABI void __setstate_nothrow(iostate __state) {
+ if (__rdbuf_)
+ __rdstate_ |= __state;
+ else
+ __rdstate_ |= __state | ios_base::badbit;
+ }
protected:
- _LIBCPP_HIDE_FROM_ABI
- ios_base() {// purposefully does no initialization
- }
-
- void init(void* __sb);
- _LIBCPP_HIDE_FROM_ABI void* rdbuf() const {return __rdbuf_;}
-
- _LIBCPP_HIDE_FROM_ABI
- void rdbuf(void* __sb)
- {
- __rdbuf_ = __sb;
- clear();
- }
-
- void __call_callbacks(event);
- void copyfmt(const ios_base&);
- void move(ios_base&);
- void swap(ios_base&) _NOEXCEPT;
-
- _LIBCPP_HIDE_FROM_ABI
- void set_rdbuf(void* __sb)
- {
- __rdbuf_ = __sb;
- }
+ _LIBCPP_HIDE_FROM_ABI ios_base() { // purposefully does no initialization
+ }
+
+ void init(void* __sb);
+ _LIBCPP_HIDE_FROM_ABI void* rdbuf() const { return __rdbuf_; }
+
+ _LIBCPP_HIDE_FROM_ABI void rdbuf(void* __sb) {
+ __rdbuf_ = __sb;
+ clear();
+ }
+
+ void __call_callbacks(event);
+ void copyfmt(const ios_base&);
+ void move(ios_base&);
+ void swap(ios_base&) _NOEXCEPT;
+
+ _LIBCPP_HIDE_FROM_ABI void set_rdbuf(void* __sb) { __rdbuf_ = __sb; }
private:
- // All data members must be scalars
- fmtflags __fmtflags_;
- streamsize __precision_;
- streamsize __width_;
- iostate __rdstate_;
- iostate __exceptions_;
- void* __rdbuf_;
- void* __loc_;
- event_callback* __fn_;
- int* __index_;
- size_t __event_size_;
- size_t __event_cap_;
+ // All data members must be scalars
+ fmtflags __fmtflags_;
+ streamsize __precision_;
+ streamsize __width_;
+ iostate __rdstate_;
+ iostate __exceptions_;
+ void* __rdbuf_;
+ void* __loc_;
+ event_callback* __fn_;
+ int* __index_;
+ size_t __event_size_;
+ size_t __event_cap_;
// TODO(EricWF): Enable this for both Clang and GCC. Currently it is only
// enabled with clang.
#if defined(_LIBCPP_HAS_C_ATOMIC_IMP) && !defined(_LIBCPP_HAS_NO_THREADS)
- static atomic<int> __xindex_;
+ static atomic<int> __xindex_;
#else
- static int __xindex_;
+ static int __xindex_;
#endif
- long* __iarray_;
- size_t __iarray_size_;
- size_t __iarray_cap_;
- void** __parray_;
- size_t __parray_size_;
- size_t __parray_cap_;
+ long* __iarray_;
+ size_t __iarray_size_;
+ size_t __iarray_cap_;
+ void** __parray_;
+ size_t __parray_size_;
+ size_t __parray_cap_;
};
-//enum class io_errc
-_LIBCPP_DECLARE_STRONG_ENUM(io_errc)
-{
- stream = 1
-};
+// enum class io_errc
+_LIBCPP_DECLARE_STRONG_ENUM(io_errc){stream = 1};
_LIBCPP_DECLARE_STRONG_ENUM_EPILOG(io_errc)
template <>
-struct _LIBCPP_TEMPLATE_VIS is_error_code_enum<io_errc> : public true_type { };
+struct _LIBCPP_TEMPLATE_VIS is_error_code_enum<io_errc> : public true_type {};
#ifdef _LIBCPP_CXX03_LANG
template <>
-struct _LIBCPP_TEMPLATE_VIS is_error_code_enum<io_errc::__lx> : public true_type { };
+struct _LIBCPP_TEMPLATE_VIS is_error_code_enum<io_errc::__lx> : public true_type {};
#endif
_LIBCPP_EXPORTED_FROM_ABI const error_category& iostream_category() _NOEXCEPT;
-inline _LIBCPP_HIDE_FROM_ABI
-error_code
-make_error_code(io_errc __e) _NOEXCEPT
-{
- return error_code(static_cast<int>(__e), iostream_category());
+inline _LIBCPP_HIDE_FROM_ABI error_code make_error_code(io_errc __e) _NOEXCEPT {
+ return error_code(static_cast<int>(__e), iostream_category());
}
-inline _LIBCPP_HIDE_FROM_ABI
-error_condition
-make_error_condition(io_errc __e) _NOEXCEPT
-{
- return error_condition(static_cast<int>(__e), iostream_category());
+inline _LIBCPP_HIDE_FROM_ABI error_condition make_error_condition(io_errc __e) _NOEXCEPT {
+ return error_condition(static_cast<int>(__e), iostream_category());
}
-class _LIBCPP_EXPORTED_FROM_ABI ios_base::failure
- : public system_error
-{
+class _LIBCPP_EXPORTED_FROM_ABI ios_base::failure : public system_error {
public:
- explicit failure(const string& __msg, const error_code& __ec = io_errc::stream);
- explicit failure(const char* __msg, const error_code& __ec = io_errc::stream);
- _LIBCPP_HIDE_FROM_ABI failure(const failure&) _NOEXCEPT = default;
- ~failure() _NOEXCEPT override;
+ explicit failure(const string& __msg, const error_code& __ec = io_errc::stream);
+ explicit failure(const char* __msg, const error_code& __ec = io_errc::stream);
+ _LIBCPP_HIDE_FROM_ABI failure(const failure&) _NOEXCEPT = default;
+ ~failure() _NOEXCEPT override;
};
-_LIBCPP_NORETURN inline _LIBCPP_HIDE_FROM_ABI
-void __throw_failure(char const* __msg) {
+_LIBCPP_NORETURN inline _LIBCPP_HIDE_FROM_ABI void __throw_failure(char const* __msg) {
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- throw ios_base::failure(__msg);
+ throw ios_base::failure(__msg);
#else
- _LIBCPP_VERBOSE_ABORT("ios_base::failure was thrown in -fno-exceptions mode with message \"%s\"", __msg);
+ _LIBCPP_VERBOSE_ABORT("ios_base::failure was thrown in -fno-exceptions mode with message \"%s\"", __msg);
#endif
}
-class _LIBCPP_EXPORTED_FROM_ABI ios_base::Init
-{
+class _LIBCPP_EXPORTED_FROM_ABI ios_base::Init {
public:
- Init();
- ~Init();
+ Init();
+ ~Init();
};
// fmtflags
-inline _LIBCPP_HIDE_FROM_ABI
-ios_base::fmtflags
-ios_base::flags() const
-{
- return __fmtflags_;
-}
+inline _LIBCPP_HIDE_FROM_ABI ios_base::fmtflags ios_base::flags() const { return __fmtflags_; }
-inline _LIBCPP_HIDE_FROM_ABI
-ios_base::fmtflags
-ios_base::flags(fmtflags __fmtfl)
-{
- fmtflags __r = __fmtflags_;
- __fmtflags_ = __fmtfl;
- return __r;
+inline _LIBCPP_HIDE_FROM_ABI ios_base::fmtflags ios_base::flags(fmtflags __fmtfl) {
+ fmtflags __r = __fmtflags_;
+ __fmtflags_ = __fmtfl;
+ return __r;
}
-inline _LIBCPP_HIDE_FROM_ABI
-ios_base::fmtflags
-ios_base::setf(fmtflags __fmtfl)
-{
- fmtflags __r = __fmtflags_;
- __fmtflags_ |= __fmtfl;
- return __r;
+inline _LIBCPP_HIDE_FROM_ABI ios_base::fmtflags ios_base::setf(fmtflags __fmtfl) {
+ fmtflags __r = __fmtflags_;
+ __fmtflags_ |= __fmtfl;
+ return __r;
}
-inline _LIBCPP_HIDE_FROM_ABI
-void
-ios_base::unsetf(fmtflags __mask)
-{
- __fmtflags_ &= ~__mask;
-}
+inline _LIBCPP_HIDE_FROM_ABI void ios_base::unsetf(fmtflags __mask) { __fmtflags_ &= ~__mask; }
-inline _LIBCPP_HIDE_FROM_ABI
-ios_base::fmtflags
-ios_base::setf(fmtflags __fmtfl, fmtflags __mask)
-{
- fmtflags __r = __fmtflags_;
- unsetf(__mask);
- __fmtflags_ |= __fmtfl & __mask;
- return __r;
+inline _LIBCPP_HIDE_FROM_ABI ios_base::fmtflags ios_base::setf(fmtflags __fmtfl, fmtflags __mask) {
+ fmtflags __r = __fmtflags_;
+ unsetf(__mask);
+ __fmtflags_ |= __fmtfl & __mask;
+ return __r;
}
// precision
-inline _LIBCPP_HIDE_FROM_ABI
-streamsize
-ios_base::precision() const
-{
- return __precision_;
-}
+inline _LIBCPP_HIDE_FROM_ABI streamsize ios_base::precision() const { return __precision_; }
-inline _LIBCPP_HIDE_FROM_ABI
-streamsize
-ios_base::precision(streamsize __prec)
-{
- streamsize __r = __precision_;
- __precision_ = __prec;
- return __r;
+inline _LIBCPP_HIDE_FROM_ABI streamsize ios_base::precision(streamsize __prec) {
+ streamsize __r = __precision_;
+ __precision_ = __prec;
+ return __r;
}
// width
-inline _LIBCPP_HIDE_FROM_ABI
-streamsize
-ios_base::width() const
-{
- return __width_;
-}
+inline _LIBCPP_HIDE_FROM_ABI streamsize ios_base::width() const { return __width_; }
-inline _LIBCPP_HIDE_FROM_ABI
-streamsize
-ios_base::width(streamsize __wide)
-{
- streamsize __r = __width_;
- __width_ = __wide;
- return __r;
+inline _LIBCPP_HIDE_FROM_ABI streamsize ios_base::width(streamsize __wide) {
+ streamsize __r = __width_;
+ __width_ = __wide;
+ return __r;
}
// iostate
-inline _LIBCPP_HIDE_FROM_ABI
-ios_base::iostate
-ios_base::rdstate() const
-{
- return __rdstate_;
-}
+inline _LIBCPP_HIDE_FROM_ABI ios_base::iostate ios_base::rdstate() const { return __rdstate_; }
-inline _LIBCPP_HIDE_FROM_ABI
-void
-ios_base::setstate(iostate __state)
-{
- clear(__rdstate_ | __state);
-}
+inline _LIBCPP_HIDE_FROM_ABI void ios_base::setstate(iostate __state) { clear(__rdstate_ | __state); }
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-ios_base::good() const
-{
- return __rdstate_ == 0;
-}
+inline _LIBCPP_HIDE_FROM_ABI bool ios_base::good() const { return __rdstate_ == 0; }
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-ios_base::eof() const
-{
- return (__rdstate_ & eofbit) != 0;
-}
+inline _LIBCPP_HIDE_FROM_ABI bool ios_base::eof() const { return (__rdstate_ & eofbit) != 0; }
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-ios_base::fail() const
-{
- return (__rdstate_ & (failbit | badbit)) != 0;
-}
+inline _LIBCPP_HIDE_FROM_ABI bool ios_base::fail() const { return (__rdstate_ & (failbit | badbit)) != 0; }
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-ios_base::bad() const
-{
- return (__rdstate_ & badbit) != 0;
-}
+inline _LIBCPP_HIDE_FROM_ABI bool ios_base::bad() const { return (__rdstate_ & badbit) != 0; }
-inline _LIBCPP_HIDE_FROM_ABI
-ios_base::iostate
-ios_base::exceptions() const
-{
- return __exceptions_;
-}
+inline _LIBCPP_HIDE_FROM_ABI ios_base::iostate ios_base::exceptions() const { return __exceptions_; }
-inline _LIBCPP_HIDE_FROM_ABI
-void
-ios_base::exceptions(iostate __iostate)
-{
- __exceptions_ = __iostate;
- clear(__rdstate_);
+inline _LIBCPP_HIDE_FROM_ABI void ios_base::exceptions(iostate __iostate) {
+ __exceptions_ = __iostate;
+ clear(__rdstate_);
}
template <class _CharT, class _Traits>
-class _LIBCPP_TEMPLATE_VIS basic_ios
- : public ios_base
-{
+class _LIBCPP_TEMPLATE_VIS basic_ios : public ios_base {
public:
- // types:
- typedef _CharT char_type;
- typedef _Traits traits_type;
+ // types:
+ typedef _CharT char_type;
+ typedef _Traits traits_type;
- typedef typename traits_type::int_type int_type;
- typedef typename traits_type::pos_type pos_type;
- typedef typename traits_type::off_type off_type;
+ typedef typename traits_type::int_type int_type;
+ typedef typename traits_type::pos_type pos_type;
+ typedef typename traits_type::off_type off_type;
- static_assert((is_same<_CharT, typename traits_type::char_type>::value),
- "traits_type::char_type must be the same type as CharT");
+ static_assert((is_same<_CharT, typename traits_type::char_type>::value),
+ "traits_type::char_type must be the same type as CharT");
#ifdef _LIBCPP_CXX03_LANG
- // Preserve the ability to compare with literal 0,
- // and implicitly convert to bool, but not implicitly convert to int.
- _LIBCPP_HIDE_FROM_ABI
- operator void*() const {return fail() ? nullptr : (void*)this;}
+ // Preserve the ability to compare with literal 0,
+ // and implicitly convert to bool, but not implicitly convert to int.
+ _LIBCPP_HIDE_FROM_ABI operator void*() const { return fail() ? nullptr : (void*)this; }
#else
- _LIBCPP_HIDE_FROM_ABI
- explicit operator bool() const {return !fail();}
+ _LIBCPP_HIDE_FROM_ABI explicit operator bool() const { return !fail(); }
#endif
- _LIBCPP_HIDE_FROM_ABI bool operator!() const {return fail();}
- _LIBCPP_HIDE_FROM_ABI iostate rdstate() const {return ios_base::rdstate();}
- _LIBCPP_HIDE_FROM_ABI void clear(iostate __state = goodbit) {ios_base::clear(__state);}
- _LIBCPP_HIDE_FROM_ABI void setstate(iostate __state) {ios_base::setstate(__state);}
- _LIBCPP_HIDE_FROM_ABI bool good() const {return ios_base::good();}
- _LIBCPP_HIDE_FROM_ABI bool eof() const {return ios_base::eof();}
- _LIBCPP_HIDE_FROM_ABI bool fail() const {return ios_base::fail();}
- _LIBCPP_HIDE_FROM_ABI bool bad() const {return ios_base::bad();}
+ _LIBCPP_HIDE_FROM_ABI bool operator!() const { return fail(); }
+ _LIBCPP_HIDE_FROM_ABI iostate rdstate() const { return ios_base::rdstate(); }
+ _LIBCPP_HIDE_FROM_ABI void clear(iostate __state = goodbit) { ios_base::clear(__state); }
+ _LIBCPP_HIDE_FROM_ABI void setstate(iostate __state) { ios_base::setstate(__state); }
+ _LIBCPP_HIDE_FROM_ABI bool good() const { return ios_base::good(); }
+ _LIBCPP_HIDE_FROM_ABI bool eof() const { return ios_base::eof(); }
+ _LIBCPP_HIDE_FROM_ABI bool fail() const { return ios_base::fail(); }
+ _LIBCPP_HIDE_FROM_ABI bool bad() const { return ios_base::bad(); }
- _LIBCPP_HIDE_FROM_ABI iostate exceptions() const {return ios_base::exceptions();}
- _LIBCPP_HIDE_FROM_ABI void exceptions(iostate __iostate) {ios_base::exceptions(__iostate);}
+ _LIBCPP_HIDE_FROM_ABI iostate exceptions() const { return ios_base::exceptions(); }
+ _LIBCPP_HIDE_FROM_ABI void exceptions(iostate __iostate) { ios_base::exceptions(__iostate); }
- // 27.5.4.1 Constructor/destructor:
- _LIBCPP_HIDE_FROM_ABI
- explicit basic_ios(basic_streambuf<char_type,traits_type>* __sb);
- ~basic_ios() override;
+ // 27.5.4.1 Constructor/destructor:
+ _LIBCPP_HIDE_FROM_ABI explicit basic_ios(basic_streambuf<char_type, traits_type>* __sb);
+ ~basic_ios() override;
- // 27.5.4.2 Members:
- _LIBCPP_HIDE_FROM_ABI
- basic_ostream<char_type, traits_type>* tie() const;
- _LIBCPP_HIDE_FROM_ABI
- basic_ostream<char_type, traits_type>* tie(basic_ostream<char_type, traits_type>* __tiestr);
+ // 27.5.4.2 Members:
+ _LIBCPP_HIDE_FROM_ABI basic_ostream<char_type, traits_type>* tie() const;
+ _LIBCPP_HIDE_FROM_ABI basic_ostream<char_type, traits_type>* tie(basic_ostream<char_type, traits_type>* __tiestr);
- _LIBCPP_HIDE_FROM_ABI
- basic_streambuf<char_type, traits_type>* rdbuf() const;
- _LIBCPP_HIDE_FROM_ABI
- basic_streambuf<char_type, traits_type>* rdbuf(basic_streambuf<char_type, traits_type>* __sb);
+ _LIBCPP_HIDE_FROM_ABI basic_streambuf<char_type, traits_type>* rdbuf() const;
+ _LIBCPP_HIDE_FROM_ABI basic_streambuf<char_type, traits_type>* rdbuf(basic_streambuf<char_type, traits_type>* __sb);
- basic_ios& copyfmt(const basic_ios& __rhs);
+ basic_ios& copyfmt(const basic_ios& __rhs);
- _LIBCPP_HIDE_FROM_ABI
- char_type fill() const;
- _LIBCPP_HIDE_FROM_ABI
- char_type fill(char_type __ch);
+ _LIBCPP_HIDE_FROM_ABI char_type fill() const;
+ _LIBCPP_HIDE_FROM_ABI char_type fill(char_type __ch);
- _LIBCPP_HIDE_FROM_ABI
- locale imbue(const locale& __loc);
+ _LIBCPP_HIDE_FROM_ABI locale imbue(const locale& __loc);
- _LIBCPP_HIDE_FROM_ABI
- char narrow(char_type __c, char __dfault) const;
- _LIBCPP_HIDE_FROM_ABI
- char_type widen(char __c) const;
+ _LIBCPP_HIDE_FROM_ABI char narrow(char_type __c, char __dfault) const;
+ _LIBCPP_HIDE_FROM_ABI char_type widen(char __c) const;
protected:
- _LIBCPP_HIDE_FROM_ABI
- basic_ios() {// purposefully does no initialization
- }
- _LIBCPP_HIDE_FROM_ABI
- void init(basic_streambuf<char_type, traits_type>* __sb);
-
- _LIBCPP_HIDE_FROM_ABI
- void move(basic_ios& __rhs);
- _LIBCPP_HIDE_FROM_ABI
- void move(basic_ios&& __rhs) {move(__rhs);}
- _LIBCPP_HIDE_FROM_ABI
- void swap(basic_ios& __rhs) _NOEXCEPT;
- _LIBCPP_HIDE_FROM_ABI
- void set_rdbuf(basic_streambuf<char_type, traits_type>* __sb);
+ _LIBCPP_HIDE_FROM_ABI basic_ios() { // purposefully does no initialization
+ }
+ _LIBCPP_HIDE_FROM_ABI void init(basic_streambuf<char_type, traits_type>* __sb);
+
+ _LIBCPP_HIDE_FROM_ABI void move(basic_ios& __rhs);
+ _LIBCPP_HIDE_FROM_ABI void move(basic_ios&& __rhs) { move(__rhs); }
+ _LIBCPP_HIDE_FROM_ABI void swap(basic_ios& __rhs) _NOEXCEPT;
+ _LIBCPP_HIDE_FROM_ABI void set_rdbuf(basic_streambuf<char_type, traits_type>* __sb);
+
private:
- basic_ostream<char_type, traits_type>* __tie_;
- mutable int_type __fill_;
+ basic_ostream<char_type, traits_type>* __tie_;
+ mutable int_type __fill_;
};
template <class _CharT, class _Traits>
-inline _LIBCPP_HIDE_FROM_ABI
-basic_ios<_CharT, _Traits>::basic_ios(basic_streambuf<char_type,traits_type>* __sb)
-{
- init(__sb);
+inline _LIBCPP_HIDE_FROM_ABI basic_ios<_CharT, _Traits>::basic_ios(basic_streambuf<char_type, traits_type>* __sb) {
+ init(__sb);
}
template <class _CharT, class _Traits>
-basic_ios<_CharT, _Traits>::~basic_ios()
-{
-}
+basic_ios<_CharT, _Traits>::~basic_ios() {}
template <class _CharT, class _Traits>
-inline _LIBCPP_HIDE_FROM_ABI
-void
-basic_ios<_CharT, _Traits>::init(basic_streambuf<char_type, traits_type>* __sb)
-{
- ios_base::init(__sb);
- __tie_ = nullptr;
- __fill_ = traits_type::eof();
+inline _LIBCPP_HIDE_FROM_ABI void basic_ios<_CharT, _Traits>::init(basic_streambuf<char_type, traits_type>* __sb) {
+ ios_base::init(__sb);
+ __tie_ = nullptr;
+ __fill_ = traits_type::eof();
}
template <class _CharT, class _Traits>
-inline _LIBCPP_HIDE_FROM_ABI
-basic_ostream<_CharT, _Traits>*
-basic_ios<_CharT, _Traits>::tie() const
-{
- return __tie_;
+inline _LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>* basic_ios<_CharT, _Traits>::tie() const {
+ return __tie_;
}
template <class _CharT, class _Traits>
-inline _LIBCPP_HIDE_FROM_ABI
-basic_ostream<_CharT, _Traits>*
-basic_ios<_CharT, _Traits>::tie(basic_ostream<char_type, traits_type>* __tiestr)
-{
- basic_ostream<char_type, traits_type>* __r = __tie_;
- __tie_ = __tiestr;
- return __r;
+inline _LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>*
+basic_ios<_CharT, _Traits>::tie(basic_ostream<char_type, traits_type>* __tiestr) {
+ basic_ostream<char_type, traits_type>* __r = __tie_;
+ __tie_ = __tiestr;
+ return __r;
}
template <class _CharT, class _Traits>
-inline _LIBCPP_HIDE_FROM_ABI
-basic_streambuf<_CharT, _Traits>*
-basic_ios<_CharT, _Traits>::rdbuf() const
-{
- return static_cast<basic_streambuf<char_type, traits_type>*>(ios_base::rdbuf());
+inline _LIBCPP_HIDE_FROM_ABI basic_streambuf<_CharT, _Traits>* basic_ios<_CharT, _Traits>::rdbuf() const {
+ return static_cast<basic_streambuf<char_type, traits_type>*>(ios_base::rdbuf());
}
template <class _CharT, class _Traits>
-inline _LIBCPP_HIDE_FROM_ABI
-basic_streambuf<_CharT, _Traits>*
-basic_ios<_CharT, _Traits>::rdbuf(basic_streambuf<char_type, traits_type>* __sb)
-{
- basic_streambuf<char_type, traits_type>* __r = rdbuf();
- ios_base::rdbuf(__sb);
- return __r;
+inline _LIBCPP_HIDE_FROM_ABI basic_streambuf<_CharT, _Traits>*
+basic_ios<_CharT, _Traits>::rdbuf(basic_streambuf<char_type, traits_type>* __sb) {
+ basic_streambuf<char_type, traits_type>* __r = rdbuf();
+ ios_base::rdbuf(__sb);
+ return __r;
}
template <class _CharT, class _Traits>
-inline _LIBCPP_HIDE_FROM_ABI
-locale
-basic_ios<_CharT, _Traits>::imbue(const locale& __loc)
-{
- locale __r = getloc();
- ios_base::imbue(__loc);
- if (rdbuf())
- rdbuf()->pubimbue(__loc);
- return __r;
+inline _LIBCPP_HIDE_FROM_ABI locale basic_ios<_CharT, _Traits>::imbue(const locale& __loc) {
+ locale __r = getloc();
+ ios_base::imbue(__loc);
+ if (rdbuf())
+ rdbuf()->pubimbue(__loc);
+ return __r;
}
template <class _CharT, class _Traits>
-inline _LIBCPP_HIDE_FROM_ABI
-char
-basic_ios<_CharT, _Traits>::narrow(char_type __c, char __dfault) const
-{
- return std::use_facet<ctype<char_type> >(getloc()).narrow(__c, __dfault);
+inline _LIBCPP_HIDE_FROM_ABI char basic_ios<_CharT, _Traits>::narrow(char_type __c, char __dfault) const {
+ return std::use_facet<ctype<char_type> >(getloc()).narrow(__c, __dfault);
}
template <class _CharT, class _Traits>
-inline _LIBCPP_HIDE_FROM_ABI
-_CharT
-basic_ios<_CharT, _Traits>::widen(char __c) const
-{
- return std::use_facet<ctype<char_type> >(getloc()).widen(__c);
+inline _LIBCPP_HIDE_FROM_ABI _CharT basic_ios<_CharT, _Traits>::widen(char __c) const {
+ return std::use_facet<ctype<char_type> >(getloc()).widen(__c);
}
template <class _CharT, class _Traits>
-inline _LIBCPP_HIDE_FROM_ABI
-_CharT
-basic_ios<_CharT, _Traits>::fill() const
-{
- if (traits_type::eq_int_type(traits_type::eof(), __fill_))
- __fill_ = widen(' ');
- return __fill_;
+inline _LIBCPP_HIDE_FROM_ABI _CharT basic_ios<_CharT, _Traits>::fill() const {
+ if (traits_type::eq_int_type(traits_type::eof(), __fill_))
+ __fill_ = widen(' ');
+ return __fill_;
}
template <class _CharT, class _Traits>
-inline _LIBCPP_HIDE_FROM_ABI
-_CharT
-basic_ios<_CharT, _Traits>::fill(char_type __ch)
-{
- if (traits_type::eq_int_type(traits_type::eof(), __fill_))
- __fill_ = widen(' ');
- char_type __r = __fill_;
- __fill_ = __ch;
- return __r;
+inline _LIBCPP_HIDE_FROM_ABI _CharT basic_ios<_CharT, _Traits>::fill(char_type __ch) {
+ if (traits_type::eq_int_type(traits_type::eof(), __fill_))
+ __fill_ = widen(' ');
+ char_type __r = __fill_;
+ __fill_ = __ch;
+ return __r;
}
template <class _CharT, class _Traits>
-basic_ios<_CharT, _Traits>&
-basic_ios<_CharT, _Traits>::copyfmt(const basic_ios& __rhs)
-{
- if (this != &__rhs)
- {
- __call_callbacks(erase_event);
- ios_base::copyfmt(__rhs);
- __tie_ = __rhs.__tie_;
- __fill_ = __rhs.__fill_;
- __call_callbacks(copyfmt_event);
- exceptions(__rhs.exceptions());
- }
- return *this;
+basic_ios<_CharT, _Traits>& basic_ios<_CharT, _Traits>::copyfmt(const basic_ios& __rhs) {
+ if (this != &__rhs) {
+ __call_callbacks(erase_event);
+ ios_base::copyfmt(__rhs);
+ __tie_ = __rhs.__tie_;
+ __fill_ = __rhs.__fill_;
+ __call_callbacks(copyfmt_event);
+ exceptions(__rhs.exceptions());
+ }
+ return *this;
}
template <class _CharT, class _Traits>
-inline _LIBCPP_HIDE_FROM_ABI
-void
-basic_ios<_CharT, _Traits>::move(basic_ios& __rhs)
-{
- ios_base::move(__rhs);
- __tie_ = __rhs.__tie_;
- __rhs.__tie_ = nullptr;
- __fill_ = __rhs.__fill_;
+inline _LIBCPP_HIDE_FROM_ABI void basic_ios<_CharT, _Traits>::move(basic_ios& __rhs) {
+ ios_base::move(__rhs);
+ __tie_ = __rhs.__tie_;
+ __rhs.__tie_ = nullptr;
+ __fill_ = __rhs.__fill_;
}
template <class _CharT, class _Traits>
-inline _LIBCPP_HIDE_FROM_ABI
-void
-basic_ios<_CharT, _Traits>::swap(basic_ios& __rhs) _NOEXCEPT
-{
- ios_base::swap(__rhs);
- std::swap(__tie_, __rhs.__tie_);
- std::swap(__fill_, __rhs.__fill_);
+inline _LIBCPP_HIDE_FROM_ABI void basic_ios<_CharT, _Traits>::swap(basic_ios& __rhs) _NOEXCEPT {
+ ios_base::swap(__rhs);
+ std::swap(__tie_, __rhs.__tie_);
+ std::swap(__fill_, __rhs.__fill_);
}
template <class _CharT, class _Traits>
-inline _LIBCPP_HIDE_FROM_ABI
-void
-basic_ios<_CharT, _Traits>::set_rdbuf(basic_streambuf<char_type, traits_type>* __sb)
-{
- ios_base::set_rdbuf(__sb);
+inline _LIBCPP_HIDE_FROM_ABI void basic_ios<_CharT, _Traits>::set_rdbuf(basic_streambuf<char_type, traits_type>* __sb) {
+ ios_base::set_rdbuf(__sb);
}
extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_ios<char>;
@@ -857,196 +698,124 @@ extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_ios<char>;
extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_ios<wchar_t>;
#endif
-_LIBCPP_HIDE_FROM_ABI inline
-ios_base&
-boolalpha(ios_base& __str)
-{
- __str.setf(ios_base::boolalpha);
- return __str;
+_LIBCPP_HIDE_FROM_ABI inline ios_base& boolalpha(ios_base& __str) {
+ __str.setf(ios_base::boolalpha);
+ return __str;
}
-_LIBCPP_HIDE_FROM_ABI inline
-ios_base&
-noboolalpha(ios_base& __str)
-{
- __str.unsetf(ios_base::boolalpha);
- return __str;
+_LIBCPP_HIDE_FROM_ABI inline ios_base& noboolalpha(ios_base& __str) {
+ __str.unsetf(ios_base::boolalpha);
+ return __str;
}
-_LIBCPP_HIDE_FROM_ABI inline
-ios_base&
-showbase(ios_base& __str)
-{
- __str.setf(ios_base::showbase);
- return __str;
+_LIBCPP_HIDE_FROM_ABI inline ios_base& showbase(ios_base& __str) {
+ __str.setf(ios_base::showbase);
+ return __str;
}
-_LIBCPP_HIDE_FROM_ABI inline
-ios_base&
-noshowbase(ios_base& __str)
-{
- __str.unsetf(ios_base::showbase);
- return __str;
+_LIBCPP_HIDE_FROM_ABI inline ios_base& noshowbase(ios_base& __str) {
+ __str.unsetf(ios_base::showbase);
+ return __str;
}
-_LIBCPP_HIDE_FROM_ABI inline
-ios_base&
-showpoint(ios_base& __str)
-{
- __str.setf(ios_base::showpoint);
- return __str;
+_LIBCPP_HIDE_FROM_ABI inline ios_base& showpoint(ios_base& __str) {
+ __str.setf(ios_base::showpoint);
+ return __str;
}
-_LIBCPP_HIDE_FROM_ABI inline
-ios_base&
-noshowpoint(ios_base& __str)
-{
- __str.unsetf(ios_base::showpoint);
- return __str;
+_LIBCPP_HIDE_FROM_ABI inline ios_base& noshowpoint(ios_base& __str) {
+ __str.unsetf(ios_base::showpoint);
+ return __str;
}
-_LIBCPP_HIDE_FROM_ABI inline
-ios_base&
-showpos(ios_base& __str)
-{
- __str.setf(ios_base::showpos);
- return __str;
+_LIBCPP_HIDE_FROM_ABI inline ios_base& showpos(ios_base& __str) {
+ __str.setf(ios_base::showpos);
+ return __str;
}
-_LIBCPP_HIDE_FROM_ABI inline
-ios_base&
-noshowpos(ios_base& __str)
-{
- __str.unsetf(ios_base::showpos);
- return __str;
+_LIBCPP_HIDE_FROM_ABI inline ios_base& noshowpos(ios_base& __str) {
+ __str.unsetf(ios_base::showpos);
+ return __str;
}
-_LIBCPP_HIDE_FROM_ABI inline
-ios_base&
-skipws(ios_base& __str)
-{
- __str.setf(ios_base::skipws);
- return __str;
+_LIBCPP_HIDE_FROM_ABI inline ios_base& skipws(ios_base& __str) {
+ __str.setf(ios_base::skipws);
+ return __str;
}
-_LIBCPP_HIDE_FROM_ABI inline
-ios_base&
-noskipws(ios_base& __str)
-{
- __str.unsetf(ios_base::skipws);
- return __str;
+_LIBCPP_HIDE_FROM_ABI inline ios_base& noskipws(ios_base& __str) {
+ __str.unsetf(ios_base::skipws);
+ return __str;
}
-_LIBCPP_HIDE_FROM_ABI inline
-ios_base&
-uppercase(ios_base& __str)
-{
- __str.setf(ios_base::uppercase);
- return __str;
+_LIBCPP_HIDE_FROM_ABI inline ios_base& uppercase(ios_base& __str) {
+ __str.setf(ios_base::uppercase);
+ return __str;
}
-_LIBCPP_HIDE_FROM_ABI inline
-ios_base&
-nouppercase(ios_base& __str)
-{
- __str.unsetf(ios_base::uppercase);
- return __str;
+_LIBCPP_HIDE_FROM_ABI inline ios_base& nouppercase(ios_base& __str) {
+ __str.unsetf(ios_base::uppercase);
+ return __str;
}
-_LIBCPP_HIDE_FROM_ABI inline
-ios_base&
-unitbuf(ios_base& __str)
-{
- __str.setf(ios_base::unitbuf);
- return __str;
+_LIBCPP_HIDE_FROM_ABI inline ios_base& unitbuf(ios_base& __str) {
+ __str.setf(ios_base::unitbuf);
+ return __str;
}
-_LIBCPP_HIDE_FROM_ABI inline
-ios_base&
-nounitbuf(ios_base& __str)
-{
- __str.unsetf(ios_base::unitbuf);
- return __str;
+_LIBCPP_HIDE_FROM_ABI inline ios_base& nounitbuf(ios_base& __str) {
+ __str.unsetf(ios_base::unitbuf);
+ return __str;
}
-_LIBCPP_HIDE_FROM_ABI inline
-ios_base&
-internal(ios_base& __str)
-{
- __str.setf(ios_base::internal, ios_base::adjustfield);
- return __str;
+_LIBCPP_HIDE_FROM_ABI inline ios_base& internal(ios_base& __str) {
+ __str.setf(ios_base::internal, ios_base::adjustfield);
+ return __str;
}
-_LIBCPP_HIDE_FROM_ABI inline
-ios_base&
-left(ios_base& __str)
-{
- __str.setf(ios_base::left, ios_base::adjustfield);
- return __str;
+_LIBCPP_HIDE_FROM_ABI inline ios_base& left(ios_base& __str) {
+ __str.setf(ios_base::left, ios_base::adjustfield);
+ return __str;
}
-_LIBCPP_HIDE_FROM_ABI inline
-ios_base&
-right(ios_base& __str)
-{
- __str.setf(ios_base::right, ios_base::adjustfield);
- return __str;
+_LIBCPP_HIDE_FROM_ABI inline ios_base& right(ios_base& __str) {
+ __str.setf(ios_base::right, ios_base::adjustfield);
+ return __str;
}
-_LIBCPP_HIDE_FROM_ABI inline
-ios_base&
-dec(ios_base& __str)
-{
- __str.setf(ios_base::dec, ios_base::basefield);
- return __str;
+_LIBCPP_HIDE_FROM_ABI inline ios_base& dec(ios_base& __str) {
+ __str.setf(ios_base::dec, ios_base::basefield);
+ return __str;
}
-_LIBCPP_HIDE_FROM_ABI inline
-ios_base&
-hex(ios_base& __str)
-{
- __str.setf(ios_base::hex, ios_base::basefield);
- return __str;
+_LIBCPP_HIDE_FROM_ABI inline ios_base& hex(ios_base& __str) {
+ __str.setf(ios_base::hex, ios_base::basefield);
+ return __str;
}
-_LIBCPP_HIDE_FROM_ABI inline
-ios_base&
-oct(ios_base& __str)
-{
- __str.setf(ios_base::oct, ios_base::basefield);
- return __str;
+_LIBCPP_HIDE_FROM_ABI inline ios_base& oct(ios_base& __str) {
+ __str.setf(ios_base::oct, ios_base::basefield);
+ return __str;
}
-_LIBCPP_HIDE_FROM_ABI inline
-ios_base&
-fixed(ios_base& __str)
-{
- __str.setf(ios_base::fixed, ios_base::floatfield);
- return __str;
+_LIBCPP_HIDE_FROM_ABI inline ios_base& fixed(ios_base& __str) {
+ __str.setf(ios_base::fixed, ios_base::floatfield);
+ return __str;
}
-_LIBCPP_HIDE_FROM_ABI inline
-ios_base&
-scientific(ios_base& __str)
-{
- __str.setf(ios_base::scientific, ios_base::floatfield);
- return __str;
+_LIBCPP_HIDE_FROM_ABI inline ios_base& scientific(ios_base& __str) {
+ __str.setf(ios_base::scientific, ios_base::floatfield);
+ return __str;
}
-_LIBCPP_HIDE_FROM_ABI inline
-ios_base&
-hexfloat(ios_base& __str)
-{
- __str.setf(ios_base::fixed | ios_base::scientific, ios_base::floatfield);
- return __str;
+_LIBCPP_HIDE_FROM_ABI inline ios_base& hexfloat(ios_base& __str) {
+ __str.setf(ios_base::fixed | ios_base::scientific, ios_base::floatfield);
+ return __str;
}
-_LIBCPP_HIDE_FROM_ABI inline
-ios_base&
-defaultfloat(ios_base& __str)
-{
- __str.unsetf(ios_base::floatfield);
- return __str;
+_LIBCPP_HIDE_FROM_ABI inline ios_base& defaultfloat(ios_base& __str) {
+ __str.unsetf(ios_base::floatfield);
+ return __str;
}
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/iosfwd b/contrib/llvm-project/libcxx/include/iosfwd
index 48fe28e896d8..e28998d00415 100644
--- a/contrib/llvm-project/libcxx/include/iosfwd
+++ b/contrib/llvm-project/libcxx/include/iosfwd
@@ -127,38 +127,39 @@ _LIBCPP_BEGIN_NAMESPACE_STD
class _LIBCPP_EXPORTED_FROM_ABI ios_base;
template <class _CharT, class _Traits = char_traits<_CharT> >
- class _LIBCPP_TEMPLATE_VIS istreambuf_iterator;
+class _LIBCPP_TEMPLATE_VIS istreambuf_iterator;
template <class _CharT, class _Traits = char_traits<_CharT> >
- class _LIBCPP_TEMPLATE_VIS ostreambuf_iterator;
+class _LIBCPP_TEMPLATE_VIS ostreambuf_iterator;
-template <class _State> class _LIBCPP_TEMPLATE_VIS fpos;
-typedef fpos<mbstate_t> streampos;
+template <class _State>
+class _LIBCPP_TEMPLATE_VIS fpos;
+typedef fpos<mbstate_t> streampos;
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
-typedef fpos<mbstate_t> wstreampos;
+typedef fpos<mbstate_t> wstreampos;
#endif
#ifndef _LIBCPP_HAS_NO_CHAR8_T
-typedef fpos<mbstate_t> u8streampos;
+typedef fpos<mbstate_t> u8streampos;
#endif
-typedef fpos<mbstate_t> u16streampos;
-typedef fpos<mbstate_t> u32streampos;
+typedef fpos<mbstate_t> u16streampos;
+typedef fpos<mbstate_t> u32streampos;
#if _LIBCPP_STD_VER >= 20
template <class _CharT, class _Traits = char_traits<_CharT>, class _Allocator = allocator<_CharT>>
class basic_syncbuf;
-using syncbuf = basic_syncbuf<char>;
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+using syncbuf = basic_syncbuf<char>;
+# ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
using wsyncbuf = basic_syncbuf<wchar_t>;
-#endif
+# endif
template <class _CharT, class _Traits = char_traits<_CharT>, class _Allocator = allocator<_CharT>>
class basic_osyncstream;
-using osyncstream = basic_osyncstream<char>;
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+using osyncstream = basic_osyncstream<char>;
+# ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
using wosyncstream = basic_osyncstream<wchar_t>;
-#endif
+# endif
#endif // _LIBCPP_STD_VER >=20
@@ -167,30 +168,24 @@ template <class _Tp, class _Alloc = allocator<_Tp> >
class _LIBCPP_TEMPLATE_VIS vector;
template <class _CharT, class _Traits>
-class __save_flags
-{
- typedef basic_ios<_CharT, _Traits> __stream_type;
- typedef typename __stream_type::fmtflags fmtflags;
+class __save_flags {
+ typedef basic_ios<_CharT, _Traits> __stream_type;
+ typedef typename __stream_type::fmtflags fmtflags;
+
+ __stream_type& __stream_;
+ fmtflags __fmtflags_;
+ _CharT __fill_;
- __stream_type& __stream_;
- fmtflags __fmtflags_;
- _CharT __fill_;
+ __save_flags(const __save_flags&);
+ __save_flags& operator=(const __save_flags&);
- __save_flags(const __save_flags&);
- __save_flags& operator=(const __save_flags&);
public:
- _LIBCPP_HIDE_FROM_ABI
- explicit __save_flags(__stream_type& __stream)
- : __stream_(__stream),
- __fmtflags_(__stream.flags()),
- __fill_(__stream.fill())
- {}
- _LIBCPP_HIDE_FROM_ABI
- ~__save_flags()
- {
- __stream_.flags(__fmtflags_);
- __stream_.fill(__fill_);
- }
+ _LIBCPP_HIDE_FROM_ABI explicit __save_flags(__stream_type& __stream)
+ : __stream_(__stream), __fmtflags_(__stream.flags()), __fill_(__stream.fill()) {}
+ _LIBCPP_HIDE_FROM_ABI ~__save_flags() {
+ __stream_.flags(__fmtflags_);
+ __stream_.fill(__fill_);
+ }
};
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/istream b/contrib/llvm-project/libcxx/include/istream
index 0351257c7df8..1c7fb992dff4 100644
--- a/contrib/llvm-project/libcxx/include/istream
+++ b/contrib/llvm-project/libcxx/include/istream
@@ -177,1464 +177,1177 @@ template <class Stream, class T>
_LIBCPP_PUSH_MACROS
#include <__undef_macros>
-
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _CharT, class _Traits>
-class _LIBCPP_TEMPLATE_VIS basic_istream
- : virtual public basic_ios<_CharT, _Traits>
-{
- streamsize __gc_;
+class _LIBCPP_TEMPLATE_VIS basic_istream : virtual public basic_ios<_CharT, _Traits> {
+ streamsize __gc_;
+
+ _LIBCPP_HIDE_FROM_ABI void __inc_gcount() {
+ if (__gc_ < numeric_limits<streamsize>::max())
+ ++__gc_;
+ }
- _LIBCPP_HIDE_FROM_ABI void __inc_gcount() {
- if (__gc_ < numeric_limits<streamsize>::max())
- ++__gc_;
- }
public:
- // types (inherited from basic_ios (27.5.4)):
- typedef _CharT char_type;
- typedef _Traits traits_type;
- typedef typename traits_type::int_type int_type;
- typedef typename traits_type::pos_type pos_type;
- typedef typename traits_type::off_type off_type;
+ // types (inherited from basic_ios (27.5.4)):
+ typedef _CharT char_type;
+ typedef _Traits traits_type;
+ typedef typename traits_type::int_type int_type;
+ typedef typename traits_type::pos_type pos_type;
+ typedef typename traits_type::off_type off_type;
+
+ // 27.7.1.1.1 Constructor/destructor:
+ inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1 explicit basic_istream(basic_streambuf<char_type, traits_type>* __sb)
+ : __gc_(0) {
+ this->init(__sb);
+ }
+ ~basic_istream() override;
- // 27.7.1.1.1 Constructor/destructor:
- inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1
- explicit basic_istream(basic_streambuf<char_type, traits_type>* __sb) : __gc_(0)
- { this->init(__sb); }
- ~basic_istream() override;
protected:
- inline _LIBCPP_HIDE_FROM_ABI
- basic_istream(basic_istream&& __rhs);
+ inline _LIBCPP_HIDE_FROM_ABI basic_istream(basic_istream&& __rhs);
- // 27.7.1.1.2 Assign/swap:
- inline _LIBCPP_HIDE_FROM_ABI
- basic_istream& operator=(basic_istream&& __rhs);
+ // 27.7.1.1.2 Assign/swap:
+ inline _LIBCPP_HIDE_FROM_ABI basic_istream& operator=(basic_istream&& __rhs);
- inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1
- void swap(basic_istream& __rhs) {
- std::swap(__gc_, __rhs.__gc_);
- basic_ios<char_type, traits_type>::swap(__rhs);
- }
+ inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1 void swap(basic_istream& __rhs) {
+ std::swap(__gc_, __rhs.__gc_);
+ basic_ios<char_type, traits_type>::swap(__rhs);
+ }
- basic_istream (const basic_istream& __rhs) = delete;
- basic_istream& operator=(const basic_istream& __rhs) = delete;
-public:
+ basic_istream(const basic_istream& __rhs) = delete;
+ basic_istream& operator=(const basic_istream& __rhs) = delete;
- // 27.7.1.1.3 Prefix/suffix:
- class _LIBCPP_TEMPLATE_VIS sentry;
-
- // 27.7.1.2 Formatted input:
- inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1
- basic_istream& operator>>(basic_istream& (*__pf)(basic_istream&))
- { return __pf(*this); }
+public:
+ // 27.7.1.1.3 Prefix/suffix:
+ class _LIBCPP_TEMPLATE_VIS sentry;
- inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1
- basic_istream& operator>>(basic_ios<char_type, traits_type>&
- (*__pf)(basic_ios<char_type, traits_type>&))
- { __pf(*this); return *this; }
-
- inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1
- basic_istream& operator>>(ios_base& (*__pf)(ios_base&))
- { __pf(*this); return *this; }
-
- basic_istream& operator>>(basic_streambuf<char_type, traits_type>* __sb);
- basic_istream& operator>>(bool& __n);
- basic_istream& operator>>(short& __n);
- basic_istream& operator>>(unsigned short& __n);
- basic_istream& operator>>(int& __n);
- basic_istream& operator>>(unsigned int& __n);
- basic_istream& operator>>(long& __n);
- basic_istream& operator>>(unsigned long& __n);
- basic_istream& operator>>(long long& __n);
- basic_istream& operator>>(unsigned long long& __n);
- basic_istream& operator>>(float& __f);
- basic_istream& operator>>(double& __f);
- basic_istream& operator>>(long double& __f);
- basic_istream& operator>>(void*& __p);
+ // 27.7.1.2 Formatted input:
+ inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1 basic_istream& operator>>(basic_istream& (*__pf)(basic_istream&)) {
+ return __pf(*this);
+ }
- // 27.7.1.3 Unformatted input:
- _LIBCPP_HIDE_FROM_ABI
- streamsize gcount() const {return __gc_;}
- int_type get();
+ inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1 basic_istream&
+ operator>>(basic_ios<char_type, traits_type>& (*__pf)(basic_ios<char_type, traits_type>&)) {
+ __pf(*this);
+ return *this;
+ }
- inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1
- basic_istream& get(char_type& __c) {
- int_type __ch = get();
- if (__ch != traits_type::eof())
- __c = traits_type::to_char_type(__ch);
- return *this;
- }
+ inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1 basic_istream& operator>>(ios_base& (*__pf)(ios_base&)) {
+ __pf(*this);
+ return *this;
+ }
+
+ basic_istream& operator>>(basic_streambuf<char_type, traits_type>* __sb);
+ basic_istream& operator>>(bool& __n);
+ basic_istream& operator>>(short& __n);
+ basic_istream& operator>>(unsigned short& __n);
+ basic_istream& operator>>(int& __n);
+ basic_istream& operator>>(unsigned int& __n);
+ basic_istream& operator>>(long& __n);
+ basic_istream& operator>>(unsigned long& __n);
+ basic_istream& operator>>(long long& __n);
+ basic_istream& operator>>(unsigned long long& __n);
+ basic_istream& operator>>(float& __f);
+ basic_istream& operator>>(double& __f);
+ basic_istream& operator>>(long double& __f);
+ basic_istream& operator>>(void*& __p);
+
+ // 27.7.1.3 Unformatted input:
+ _LIBCPP_HIDE_FROM_ABI streamsize gcount() const { return __gc_; }
+ int_type get();
+
+ inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1 basic_istream& get(char_type& __c) {
+ int_type __ch = get();
+ if (__ch != traits_type::eof())
+ __c = traits_type::to_char_type(__ch);
+ return *this;
+ }
- inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1
- basic_istream& get(char_type* __s, streamsize __n)
- { return get(__s, __n, this->widen('\n')); }
+ inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1 basic_istream& get(char_type* __s, streamsize __n) {
+ return get(__s, __n, this->widen('\n'));
+ }
- basic_istream& get(char_type* __s, streamsize __n, char_type __dlm);
+ basic_istream& get(char_type* __s, streamsize __n, char_type __dlm);
- inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1
- basic_istream& get(basic_streambuf<char_type, traits_type>& __sb)
- { return get(__sb, this->widen('\n')); }
+ inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1 basic_istream& get(basic_streambuf<char_type, traits_type>& __sb) {
+ return get(__sb, this->widen('\n'));
+ }
- basic_istream& get(basic_streambuf<char_type, traits_type>& __sb, char_type __dlm);
+ basic_istream& get(basic_streambuf<char_type, traits_type>& __sb, char_type __dlm);
- inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1
- basic_istream& getline(char_type* __s, streamsize __n)
- { return getline(__s, __n, this->widen('\n')); }
+ inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1 basic_istream& getline(char_type* __s, streamsize __n) {
+ return getline(__s, __n, this->widen('\n'));
+ }
- basic_istream& getline(char_type* __s, streamsize __n, char_type __dlm);
+ basic_istream& getline(char_type* __s, streamsize __n, char_type __dlm);
- basic_istream& ignore(streamsize __n = 1, int_type __dlm = traits_type::eof());
- int_type peek();
- basic_istream& read (char_type* __s, streamsize __n);
- streamsize readsome(char_type* __s, streamsize __n);
+ basic_istream& ignore(streamsize __n = 1, int_type __dlm = traits_type::eof());
+ int_type peek();
+ basic_istream& read(char_type* __s, streamsize __n);
+ streamsize readsome(char_type* __s, streamsize __n);
- basic_istream& putback(char_type __c);
- basic_istream& unget();
- int sync();
+ basic_istream& putback(char_type __c);
+ basic_istream& unget();
+ int sync();
- pos_type tellg();
- basic_istream& seekg(pos_type __pos);
- basic_istream& seekg(off_type __off, ios_base::seekdir __dir);
+ pos_type tellg();
+ basic_istream& seekg(pos_type __pos);
+ basic_istream& seekg(off_type __off, ios_base::seekdir __dir);
};
template <class _CharT, class _Traits>
-class _LIBCPP_TEMPLATE_VIS basic_istream<_CharT, _Traits>::sentry
-{
- bool __ok_;
+class _LIBCPP_TEMPLATE_VIS basic_istream<_CharT, _Traits>::sentry {
+ bool __ok_;
public:
- explicit sentry(basic_istream<_CharT, _Traits>& __is, bool __noskipws = false);
-// ~sentry() = default;
+ explicit sentry(basic_istream<_CharT, _Traits>& __is, bool __noskipws = false);
+ // ~sentry() = default;
- _LIBCPP_HIDE_FROM_ABI
- explicit operator bool() const {return __ok_;}
+ _LIBCPP_HIDE_FROM_ABI explicit operator bool() const { return __ok_; }
- sentry(const sentry&) = delete;
- sentry& operator=(const sentry&) = delete;
+ sentry(const sentry&) = delete;
+ sentry& operator=(const sentry&) = delete;
};
template <class _CharT, class _Traits>
-basic_istream<_CharT, _Traits>::sentry::sentry(basic_istream<_CharT, _Traits>& __is,
- bool __noskipws)
- : __ok_(false)
-{
- if (__is.good())
- {
- if (__is.tie())
- __is.tie()->flush();
- if (!__noskipws && (__is.flags() & ios_base::skipws))
- {
- typedef istreambuf_iterator<_CharT, _Traits> _Ip;
- const ctype<_CharT>& __ct = std::use_facet<ctype<_CharT> >(__is.getloc());
- _Ip __i(__is);
- _Ip __eof;
- for (; __i != __eof; ++__i)
- if (!__ct.is(__ct.space, *__i))
- break;
- if (__i == __eof)
- __is.setstate(ios_base::failbit | ios_base::eofbit);
- }
- __ok_ = __is.good();
+basic_istream<_CharT, _Traits>::sentry::sentry(basic_istream<_CharT, _Traits>& __is, bool __noskipws) : __ok_(false) {
+ if (__is.good()) {
+ if (__is.tie())
+ __is.tie()->flush();
+ if (!__noskipws && (__is.flags() & ios_base::skipws)) {
+ typedef istreambuf_iterator<_CharT, _Traits> _Ip;
+ const ctype<_CharT>& __ct = std::use_facet<ctype<_CharT> >(__is.getloc());
+ _Ip __i(__is);
+ _Ip __eof;
+ for (; __i != __eof; ++__i)
+ if (!__ct.is(__ct.space, *__i))
+ break;
+ if (__i == __eof)
+ __is.setstate(ios_base::failbit | ios_base::eofbit);
}
- else
- __is.setstate(ios_base::failbit);
+ __ok_ = __is.good();
+ } else
+ __is.setstate(ios_base::failbit);
}
template <class _CharT, class _Traits>
-basic_istream<_CharT, _Traits>::basic_istream(basic_istream&& __rhs)
- : __gc_(__rhs.__gc_)
-{
- __rhs.__gc_ = 0;
- this->move(__rhs);
+basic_istream<_CharT, _Traits>::basic_istream(basic_istream&& __rhs) : __gc_(__rhs.__gc_) {
+ __rhs.__gc_ = 0;
+ this->move(__rhs);
}
template <class _CharT, class _Traits>
-basic_istream<_CharT, _Traits>&
-basic_istream<_CharT, _Traits>::operator=(basic_istream&& __rhs)
-{
- swap(__rhs);
- return *this;
+basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>::operator=(basic_istream&& __rhs) {
+ swap(__rhs);
+ return *this;
}
template <class _CharT, class _Traits>
-basic_istream<_CharT, _Traits>::~basic_istream()
-{
-}
+basic_istream<_CharT, _Traits>::~basic_istream() {}
template <class _Tp, class _CharT, class _Traits>
-_LIBCPP_HIDE_FROM_ABI
-basic_istream<_CharT, _Traits>&
+_LIBCPP_HIDE_FROM_ABI basic_istream<_CharT, _Traits>&
__input_arithmetic(basic_istream<_CharT, _Traits>& __is, _Tp& __n) {
- ios_base::iostate __state = ios_base::goodbit;
- typename basic_istream<_CharT, _Traits>::sentry __s(__is);
- if (__s)
- {
+ ios_base::iostate __state = ios_base::goodbit;
+ typename basic_istream<_CharT, _Traits>::sentry __s(__is);
+ if (__s) {
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- try
- {
+ try {
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- typedef istreambuf_iterator<_CharT, _Traits> _Ip;
- typedef num_get<_CharT, _Ip> _Fp;
- std::use_facet<_Fp>(__is.getloc()).get(_Ip(__is), _Ip(), __is, __state, __n);
+ typedef istreambuf_iterator<_CharT, _Traits> _Ip;
+ typedef num_get<_CharT, _Ip> _Fp;
+ std::use_facet<_Fp>(__is.getloc()).get(_Ip(__is), _Ip(), __is, __state, __n);
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- }
- catch (...)
- {
- __state |= ios_base::badbit;
- __is.__setstate_nothrow(__state);
- if (__is.exceptions() & ios_base::badbit)
- {
- throw;
- }
- }
-#endif
- __is.setstate(__state);
+ } catch (...) {
+ __state |= ios_base::badbit;
+ __is.__setstate_nothrow(__state);
+ if (__is.exceptions() & ios_base::badbit) {
+ throw;
+ }
}
- return __is;
+#endif
+ __is.setstate(__state);
+ }
+ return __is;
}
template <class _CharT, class _Traits>
-basic_istream<_CharT, _Traits>&
-basic_istream<_CharT, _Traits>::operator>>(unsigned short& __n)
-{
- return std::__input_arithmetic<unsigned short>(*this, __n);
+basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>::operator>>(unsigned short& __n) {
+ return std::__input_arithmetic<unsigned short>(*this, __n);
}
template <class _CharT, class _Traits>
-basic_istream<_CharT, _Traits>&
-basic_istream<_CharT, _Traits>::operator>>(unsigned int& __n)
-{
- return std::__input_arithmetic<unsigned int>(*this, __n);
+basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>::operator>>(unsigned int& __n) {
+ return std::__input_arithmetic<unsigned int>(*this, __n);
}
template <class _CharT, class _Traits>
-basic_istream<_CharT, _Traits>&
-basic_istream<_CharT, _Traits>::operator>>(long& __n)
-{
- return std::__input_arithmetic<long>(*this, __n);
+basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>::operator>>(long& __n) {
+ return std::__input_arithmetic<long>(*this, __n);
}
template <class _CharT, class _Traits>
-basic_istream<_CharT, _Traits>&
-basic_istream<_CharT, _Traits>::operator>>(unsigned long& __n)
-{
- return std::__input_arithmetic<unsigned long>(*this, __n);
+basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>::operator>>(unsigned long& __n) {
+ return std::__input_arithmetic<unsigned long>(*this, __n);
}
template <class _CharT, class _Traits>
-basic_istream<_CharT, _Traits>&
-basic_istream<_CharT, _Traits>::operator>>(long long& __n)
-{
- return std::__input_arithmetic<long long>(*this, __n);
+basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>::operator>>(long long& __n) {
+ return std::__input_arithmetic<long long>(*this, __n);
}
template <class _CharT, class _Traits>
-basic_istream<_CharT, _Traits>&
-basic_istream<_CharT, _Traits>::operator>>(unsigned long long& __n)
-{
- return std::__input_arithmetic<unsigned long long>(*this, __n);
+basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>::operator>>(unsigned long long& __n) {
+ return std::__input_arithmetic<unsigned long long>(*this, __n);
}
template <class _CharT, class _Traits>
-basic_istream<_CharT, _Traits>&
-basic_istream<_CharT, _Traits>::operator>>(float& __n)
-{
- return std::__input_arithmetic<float>(*this, __n);
+basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>::operator>>(float& __n) {
+ return std::__input_arithmetic<float>(*this, __n);
}
template <class _CharT, class _Traits>
-basic_istream<_CharT, _Traits>&
-basic_istream<_CharT, _Traits>::operator>>(double& __n)
-{
- return std::__input_arithmetic<double>(*this, __n);
+basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>::operator>>(double& __n) {
+ return std::__input_arithmetic<double>(*this, __n);
}
template <class _CharT, class _Traits>
-basic_istream<_CharT, _Traits>&
-basic_istream<_CharT, _Traits>::operator>>(long double& __n)
-{
- return std::__input_arithmetic<long double>(*this, __n);
+basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>::operator>>(long double& __n) {
+ return std::__input_arithmetic<long double>(*this, __n);
}
template <class _CharT, class _Traits>
-basic_istream<_CharT, _Traits>&
-basic_istream<_CharT, _Traits>::operator>>(bool& __n)
-{
- return std::__input_arithmetic<bool>(*this, __n);
+basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>::operator>>(bool& __n) {
+ return std::__input_arithmetic<bool>(*this, __n);
}
template <class _CharT, class _Traits>
-basic_istream<_CharT, _Traits>&
-basic_istream<_CharT, _Traits>::operator>>(void*& __n)
-{
- return std::__input_arithmetic<void*>(*this, __n);
+basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>::operator>>(void*& __n) {
+ return std::__input_arithmetic<void*>(*this, __n);
}
template <class _Tp, class _CharT, class _Traits>
-_LIBCPP_HIDE_FROM_ABI
-basic_istream<_CharT, _Traits>&
+_LIBCPP_HIDE_FROM_ABI basic_istream<_CharT, _Traits>&
__input_arithmetic_with_numeric_limits(basic_istream<_CharT, _Traits>& __is, _Tp& __n) {
- ios_base::iostate __state = ios_base::goodbit;
- typename basic_istream<_CharT, _Traits>::sentry __s(__is);
- if (__s)
- {
+ ios_base::iostate __state = ios_base::goodbit;
+ typename basic_istream<_CharT, _Traits>::sentry __s(__is);
+ if (__s) {
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- try
- {
+ try {
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- typedef istreambuf_iterator<_CharT, _Traits> _Ip;
- typedef num_get<_CharT, _Ip> _Fp;
- long __temp;
- std::use_facet<_Fp>(__is.getloc()).get(_Ip(__is), _Ip(), __is, __state, __temp);
- if (__temp < numeric_limits<_Tp>::min())
- {
- __state |= ios_base::failbit;
- __n = numeric_limits<_Tp>::min();
- }
- else if (__temp > numeric_limits<_Tp>::max())
- {
- __state |= ios_base::failbit;
- __n = numeric_limits<_Tp>::max();
- }
- else
- {
- __n = static_cast<_Tp>(__temp);
- }
+ typedef istreambuf_iterator<_CharT, _Traits> _Ip;
+ typedef num_get<_CharT, _Ip> _Fp;
+ long __temp;
+ std::use_facet<_Fp>(__is.getloc()).get(_Ip(__is), _Ip(), __is, __state, __temp);
+ if (__temp < numeric_limits<_Tp>::min()) {
+ __state |= ios_base::failbit;
+ __n = numeric_limits<_Tp>::min();
+ } else if (__temp > numeric_limits<_Tp>::max()) {
+ __state |= ios_base::failbit;
+ __n = numeric_limits<_Tp>::max();
+ } else {
+ __n = static_cast<_Tp>(__temp);
+ }
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- }
- catch (...)
- {
- __state |= ios_base::badbit;
- __is.__setstate_nothrow(__state);
- if (__is.exceptions() & ios_base::badbit)
- {
- throw;
- }
- }
-#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- __is.setstate(__state);
+ } catch (...) {
+ __state |= ios_base::badbit;
+ __is.__setstate_nothrow(__state);
+ if (__is.exceptions() & ios_base::badbit) {
+ throw;
+ }
}
- return __is;
+#endif // _LIBCPP_HAS_NO_EXCEPTIONS
+ __is.setstate(__state);
+ }
+ return __is;
}
template <class _CharT, class _Traits>
-basic_istream<_CharT, _Traits>&
-basic_istream<_CharT, _Traits>::operator>>(short& __n)
-{
- return std::__input_arithmetic_with_numeric_limits<short>(*this, __n);
+basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>::operator>>(short& __n) {
+ return std::__input_arithmetic_with_numeric_limits<short>(*this, __n);
}
template <class _CharT, class _Traits>
-basic_istream<_CharT, _Traits>&
-basic_istream<_CharT, _Traits>::operator>>(int& __n)
-{
- return std::__input_arithmetic_with_numeric_limits<int>(*this, __n);
+basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>::operator>>(int& __n) {
+ return std::__input_arithmetic_with_numeric_limits<int>(*this, __n);
}
-template<class _CharT, class _Traits>
-_LIBCPP_HIDE_FROM_ABI
-basic_istream<_CharT, _Traits>&
-__input_c_string(basic_istream<_CharT, _Traits>& __is, _CharT* __p, size_t __n)
-{
- ios_base::iostate __state = ios_base::goodbit;
- typename basic_istream<_CharT, _Traits>::sentry __sen(__is);
- if (__sen)
- {
+template <class _CharT, class _Traits>
+_LIBCPP_HIDE_FROM_ABI basic_istream<_CharT, _Traits>&
+__input_c_string(basic_istream<_CharT, _Traits>& __is, _CharT* __p, size_t __n) {
+ ios_base::iostate __state = ios_base::goodbit;
+ typename basic_istream<_CharT, _Traits>::sentry __sen(__is);
+ if (__sen) {
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- try
- {
+ try {
#endif
- _CharT* __s = __p;
- const ctype<_CharT>& __ct = std::use_facet<ctype<_CharT> >(__is.getloc());
- while (__s != __p + (__n-1))
- {
- typename _Traits::int_type __i = __is.rdbuf()->sgetc();
- if (_Traits::eq_int_type(__i, _Traits::eof()))
- {
- __state |= ios_base::eofbit;
- break;
- }
- _CharT __ch = _Traits::to_char_type(__i);
- if (__ct.is(__ct.space, __ch))
- break;
- *__s++ = __ch;
- __is.rdbuf()->sbumpc();
- }
- *__s = _CharT();
- __is.width(0);
- if (__s == __p)
- __state |= ios_base::failbit;
-#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
+ _CharT* __s = __p;
+ const ctype<_CharT>& __ct = std::use_facet<ctype<_CharT> >(__is.getloc());
+ while (__s != __p + (__n - 1)) {
+ typename _Traits::int_type __i = __is.rdbuf()->sgetc();
+ if (_Traits::eq_int_type(__i, _Traits::eof())) {
+ __state |= ios_base::eofbit;
+ break;
}
- catch (...)
- {
- __state |= ios_base::badbit;
- __is.__setstate_nothrow(__state);
- if (__is.exceptions() & ios_base::badbit)
- {
- throw;
- }
- }
-#endif
- __is.setstate(__state);
+ _CharT __ch = _Traits::to_char_type(__i);
+ if (__ct.is(__ct.space, __ch))
+ break;
+ *__s++ = __ch;
+ __is.rdbuf()->sbumpc();
+ }
+ *__s = _CharT();
+ __is.width(0);
+ if (__s == __p)
+ __state |= ios_base::failbit;
+#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
+ } catch (...) {
+ __state |= ios_base::badbit;
+ __is.__setstate_nothrow(__state);
+ if (__is.exceptions() & ios_base::badbit) {
+ throw;
+ }
}
- return __is;
+#endif
+ __is.setstate(__state);
+ }
+ return __is;
}
#if _LIBCPP_STD_VER >= 20
-template<class _CharT, class _Traits, size_t _Np>
-inline _LIBCPP_HIDE_FROM_ABI
-basic_istream<_CharT, _Traits>&
-operator>>(basic_istream<_CharT, _Traits>& __is, _CharT (&__buf)[_Np])
-{
- size_t __n = _Np;
- if (__is.width() > 0)
- __n = std::min(size_t(__is.width()), _Np);
- return std::__input_c_string(__is, __buf, __n);
+template <class _CharT, class _Traits, size_t _Np>
+inline _LIBCPP_HIDE_FROM_ABI basic_istream<_CharT, _Traits>&
+operator>>(basic_istream<_CharT, _Traits>& __is, _CharT (&__buf)[_Np]) {
+ size_t __n = _Np;
+ if (__is.width() > 0)
+ __n = std::min(size_t(__is.width()), _Np);
+ return std::__input_c_string(__is, __buf, __n);
}
-template<class _Traits, size_t _Np>
-inline _LIBCPP_HIDE_FROM_ABI
-basic_istream<char, _Traits>&
-operator>>(basic_istream<char, _Traits>& __is, unsigned char (&__buf)[_Np])
-{
- return __is >> (char(&)[_Np])__buf;
+template <class _Traits, size_t _Np>
+inline _LIBCPP_HIDE_FROM_ABI basic_istream<char, _Traits>&
+operator>>(basic_istream<char, _Traits>& __is, unsigned char (&__buf)[_Np]) {
+ return __is >> (char(&)[_Np])__buf;
}
-template<class _Traits, size_t _Np>
-inline _LIBCPP_HIDE_FROM_ABI
-basic_istream<char, _Traits>&
-operator>>(basic_istream<char, _Traits>& __is, signed char (&__buf)[_Np])
-{
- return __is >> (char(&)[_Np])__buf;
+template <class _Traits, size_t _Np>
+inline _LIBCPP_HIDE_FROM_ABI basic_istream<char, _Traits>&
+operator>>(basic_istream<char, _Traits>& __is, signed char (&__buf)[_Np]) {
+ return __is >> (char(&)[_Np])__buf;
}
#else
-template<class _CharT, class _Traits>
-inline _LIBCPP_HIDE_FROM_ABI
-basic_istream<_CharT, _Traits>&
-operator>>(basic_istream<_CharT, _Traits>& __is, _CharT* __s)
-{
- streamsize __n = __is.width();
- if (__n <= 0)
- __n = numeric_limits<streamsize>::max() / sizeof(_CharT) - 1;
- return std::__input_c_string(__is, __s, size_t(__n));
+template <class _CharT, class _Traits>
+inline _LIBCPP_HIDE_FROM_ABI basic_istream<_CharT, _Traits>&
+operator>>(basic_istream<_CharT, _Traits>& __is, _CharT* __s) {
+ streamsize __n = __is.width();
+ if (__n <= 0)
+ __n = numeric_limits<streamsize>::max() / sizeof(_CharT) - 1;
+ return std::__input_c_string(__is, __s, size_t(__n));
}
-template<class _Traits>
-inline _LIBCPP_HIDE_FROM_ABI
-basic_istream<char, _Traits>&
-operator>>(basic_istream<char, _Traits>& __is, unsigned char* __s)
-{
- return __is >> (char*)__s;
+template <class _Traits>
+inline _LIBCPP_HIDE_FROM_ABI basic_istream<char, _Traits>&
+operator>>(basic_istream<char, _Traits>& __is, unsigned char* __s) {
+ return __is >> (char*)__s;
}
-template<class _Traits>
-inline _LIBCPP_HIDE_FROM_ABI
-basic_istream<char, _Traits>&
-operator>>(basic_istream<char, _Traits>& __is, signed char* __s)
-{
- return __is >> (char*)__s;
+template <class _Traits>
+inline _LIBCPP_HIDE_FROM_ABI basic_istream<char, _Traits>&
+operator>>(basic_istream<char, _Traits>& __is, signed char* __s) {
+ return __is >> (char*)__s;
}
#endif // _LIBCPP_STD_VER >= 20
-template<class _CharT, class _Traits>
-_LIBCPP_HIDE_FROM_ABI basic_istream<_CharT, _Traits>&
-operator>>(basic_istream<_CharT, _Traits>& __is, _CharT& __c)
-{
- ios_base::iostate __state = ios_base::goodbit;
- typename basic_istream<_CharT, _Traits>::sentry __sen(__is);
- if (__sen)
- {
+template <class _CharT, class _Traits>
+_LIBCPP_HIDE_FROM_ABI basic_istream<_CharT, _Traits>& operator>>(basic_istream<_CharT, _Traits>& __is, _CharT& __c) {
+ ios_base::iostate __state = ios_base::goodbit;
+ typename basic_istream<_CharT, _Traits>::sentry __sen(__is);
+ if (__sen) {
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- try
- {
+ try {
#endif
- typename _Traits::int_type __i = __is.rdbuf()->sbumpc();
- if (_Traits::eq_int_type(__i, _Traits::eof()))
- __state |= ios_base::eofbit | ios_base::failbit;
- else
- __c = _Traits::to_char_type(__i);
+ typename _Traits::int_type __i = __is.rdbuf()->sbumpc();
+ if (_Traits::eq_int_type(__i, _Traits::eof()))
+ __state |= ios_base::eofbit | ios_base::failbit;
+ else
+ __c = _Traits::to_char_type(__i);
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- }
- catch (...)
- {
- __state |= ios_base::badbit;
- __is.__setstate_nothrow(__state);
- if (__is.exceptions() & ios_base::badbit)
- {
- throw;
- }
- }
-#endif
- __is.setstate(__state);
+ } catch (...) {
+ __state |= ios_base::badbit;
+ __is.__setstate_nothrow(__state);
+ if (__is.exceptions() & ios_base::badbit) {
+ throw;
+ }
}
- return __is;
+#endif
+ __is.setstate(__state);
+ }
+ return __is;
}
-template<class _Traits>
-inline _LIBCPP_HIDE_FROM_ABI
-basic_istream<char, _Traits>&
-operator>>(basic_istream<char, _Traits>& __is, unsigned char& __c)
-{
- return __is >> (char&)__c;
+template <class _Traits>
+inline _LIBCPP_HIDE_FROM_ABI basic_istream<char, _Traits>&
+operator>>(basic_istream<char, _Traits>& __is, unsigned char& __c) {
+ return __is >> (char&)__c;
}
-template<class _Traits>
-inline _LIBCPP_HIDE_FROM_ABI
-basic_istream<char, _Traits>&
-operator>>(basic_istream<char, _Traits>& __is, signed char& __c)
-{
- return __is >> (char&)__c;
+template <class _Traits>
+inline _LIBCPP_HIDE_FROM_ABI basic_istream<char, _Traits>&
+operator>>(basic_istream<char, _Traits>& __is, signed char& __c) {
+ return __is >> (char&)__c;
}
-template<class _CharT, class _Traits>
+template <class _CharT, class _Traits>
basic_istream<_CharT, _Traits>&
-basic_istream<_CharT, _Traits>::operator>>(basic_streambuf<char_type, traits_type>* __sb)
-{
- ios_base::iostate __state = ios_base::goodbit;
- __gc_ = 0;
- sentry __s(*this, true);
- if (__s)
- {
- if (__sb)
- {
-#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- try
- {
-#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- while (true)
- {
- typename traits_type::int_type __i = this->rdbuf()->sgetc();
- if (traits_type::eq_int_type(__i, _Traits::eof()))
- {
- __state |= ios_base::eofbit;
- break;
- }
- if (traits_type::eq_int_type(
- __sb->sputc(traits_type::to_char_type(__i)),
- traits_type::eof()))
- break;
- __inc_gcount();
- this->rdbuf()->sbumpc();
- }
- if (__gc_ == 0)
- __state |= ios_base::failbit;
+basic_istream<_CharT, _Traits>::operator>>(basic_streambuf<char_type, traits_type>* __sb) {
+ ios_base::iostate __state = ios_base::goodbit;
+ __gc_ = 0;
+ sentry __s(*this, true);
+ if (__s) {
+ if (__sb) {
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- }
- catch (...)
- {
- __state |= ios_base::badbit;
- if (__gc_ == 0)
- __state |= ios_base::failbit;
-
- this->__setstate_nothrow(__state);
- if (this->exceptions() & ios_base::failbit || this->exceptions() & ios_base::badbit)
- {
- throw;
- }
- }
+ try {
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
+ while (true) {
+ typename traits_type::int_type __i = this->rdbuf()->sgetc();
+ if (traits_type::eq_int_type(__i, _Traits::eof())) {
+ __state |= ios_base::eofbit;
+ break;
+ }
+ if (traits_type::eq_int_type(__sb->sputc(traits_type::to_char_type(__i)), traits_type::eof()))
+ break;
+ __inc_gcount();
+ this->rdbuf()->sbumpc();
}
- else
- {
- __state |= ios_base::failbit;
+ if (__gc_ == 0)
+ __state |= ios_base::failbit;
+#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
+ } catch (...) {
+ __state |= ios_base::badbit;
+ if (__gc_ == 0)
+ __state |= ios_base::failbit;
+
+ this->__setstate_nothrow(__state);
+ if (this->exceptions() & ios_base::failbit || this->exceptions() & ios_base::badbit) {
+ throw;
}
- this->setstate(__state);
+ }
+#endif // _LIBCPP_HAS_NO_EXCEPTIONS
+ } else {
+ __state |= ios_base::failbit;
}
- return *this;
+ this->setstate(__state);
+ }
+ return *this;
}
-template<class _CharT, class _Traits>
-typename basic_istream<_CharT, _Traits>::int_type
-basic_istream<_CharT, _Traits>::get()
-{
- ios_base::iostate __state = ios_base::goodbit;
- __gc_ = 0;
- int_type __r = traits_type::eof();
- sentry __s(*this, true);
- if (__s)
- {
+template <class _CharT, class _Traits>
+typename basic_istream<_CharT, _Traits>::int_type basic_istream<_CharT, _Traits>::get() {
+ ios_base::iostate __state = ios_base::goodbit;
+ __gc_ = 0;
+ int_type __r = traits_type::eof();
+ sentry __s(*this, true);
+ if (__s) {
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- try
- {
+ try {
#endif
- __r = this->rdbuf()->sbumpc();
- if (traits_type::eq_int_type(__r, traits_type::eof()))
- __state |= ios_base::failbit | ios_base::eofbit;
- else
- __gc_ = 1;
+ __r = this->rdbuf()->sbumpc();
+ if (traits_type::eq_int_type(__r, traits_type::eof()))
+ __state |= ios_base::failbit | ios_base::eofbit;
+ else
+ __gc_ = 1;
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- }
- catch (...)
- {
- this->__setstate_nothrow(this->rdstate() | ios_base::badbit);
- if (this->exceptions() & ios_base::badbit)
- {
- throw;
- }
- }
-#endif
- this->setstate(__state);
+ } catch (...) {
+ this->__setstate_nothrow(this->rdstate() | ios_base::badbit);
+ if (this->exceptions() & ios_base::badbit) {
+ throw;
+ }
}
- return __r;
+#endif
+ this->setstate(__state);
+ }
+ return __r;
}
-template<class _CharT, class _Traits>
-basic_istream<_CharT, _Traits>&
-basic_istream<_CharT, _Traits>::get(char_type* __s, streamsize __n, char_type __dlm)
-{
- ios_base::iostate __state = ios_base::goodbit;
- __gc_ = 0;
- sentry __sen(*this, true);
- if (__sen)
- {
- if (__n > 0)
- {
-#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- try
- {
-#endif
- while (__gc_ < __n-1)
- {
- int_type __i = this->rdbuf()->sgetc();
- if (traits_type::eq_int_type(__i, traits_type::eof()))
- {
- __state |= ios_base::eofbit;
- break;
- }
- char_type __ch = traits_type::to_char_type(__i);
- if (traits_type::eq(__ch, __dlm))
- break;
- *__s++ = __ch;
- __inc_gcount();
- this->rdbuf()->sbumpc();
- }
- if (__gc_ == 0)
- __state |= ios_base::failbit;
+template <class _CharT, class _Traits>
+basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>::get(char_type* __s, streamsize __n, char_type __dlm) {
+ ios_base::iostate __state = ios_base::goodbit;
+ __gc_ = 0;
+ sentry __sen(*this, true);
+ if (__sen) {
+ if (__n > 0) {
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- }
- catch (...)
- {
- __state |= ios_base::badbit;
- this->__setstate_nothrow(__state);
- if (this->exceptions() & ios_base::badbit)
- {
- if (__n > 0)
- *__s = char_type();
- throw;
- }
- }
+ try {
#endif
+ while (__gc_ < __n - 1) {
+ int_type __i = this->rdbuf()->sgetc();
+ if (traits_type::eq_int_type(__i, traits_type::eof())) {
+ __state |= ios_base::eofbit;
+ break;
+ }
+ char_type __ch = traits_type::to_char_type(__i);
+ if (traits_type::eq(__ch, __dlm))
+ break;
+ *__s++ = __ch;
+ __inc_gcount();
+ this->rdbuf()->sbumpc();
}
- else
- {
- __state |= ios_base::failbit;
- }
-
- if (__n > 0)
+ if (__gc_ == 0)
+ __state |= ios_base::failbit;
+#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
+ } catch (...) {
+ __state |= ios_base::badbit;
+ this->__setstate_nothrow(__state);
+ if (this->exceptions() & ios_base::badbit) {
+ if (__n > 0)
*__s = char_type();
- this->setstate(__state);
+ throw;
+ }
+ }
+#endif
+ } else {
+ __state |= ios_base::failbit;
}
+
if (__n > 0)
- *__s = char_type();
- return *this;
+ *__s = char_type();
+ this->setstate(__state);
+ }
+ if (__n > 0)
+ *__s = char_type();
+ return *this;
}
-template<class _CharT, class _Traits>
+template <class _CharT, class _Traits>
basic_istream<_CharT, _Traits>&
-basic_istream<_CharT, _Traits>::get(basic_streambuf<char_type, traits_type>& __sb,
- char_type __dlm)
-{
- ios_base::iostate __state = ios_base::goodbit;
- __gc_ = 0;
- sentry __sen(*this, true);
- if (__sen)
- {
+basic_istream<_CharT, _Traits>::get(basic_streambuf<char_type, traits_type>& __sb, char_type __dlm) {
+ ios_base::iostate __state = ios_base::goodbit;
+ __gc_ = 0;
+ sentry __sen(*this, true);
+ if (__sen) {
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- try
- {
+ try {
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- while (true)
- {
- typename traits_type::int_type __i = this->rdbuf()->sgetc();
- if (traits_type::eq_int_type(__i, traits_type::eof()))
- {
- __state |= ios_base::eofbit;
- break;
- }
- char_type __ch = traits_type::to_char_type(__i);
- if (traits_type::eq(__ch, __dlm))
- break;
- if (traits_type::eq_int_type(__sb.sputc(__ch), traits_type::eof()))
- break;
- __inc_gcount();
- this->rdbuf()->sbumpc();
- }
-#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
+ while (true) {
+ typename traits_type::int_type __i = this->rdbuf()->sgetc();
+ if (traits_type::eq_int_type(__i, traits_type::eof())) {
+ __state |= ios_base::eofbit;
+ break;
}
- catch (...)
- {
- __state |= ios_base::badbit;
- // according to the spec, exceptions here are caught but not rethrown
- }
-#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- if (__gc_ == 0)
- __state |= ios_base::failbit;
- this->setstate(__state);
+ char_type __ch = traits_type::to_char_type(__i);
+ if (traits_type::eq(__ch, __dlm))
+ break;
+ if (traits_type::eq_int_type(__sb.sputc(__ch), traits_type::eof()))
+ break;
+ __inc_gcount();
+ this->rdbuf()->sbumpc();
+ }
+#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
+ } catch (...) {
+ __state |= ios_base::badbit;
+ // according to the spec, exceptions here are caught but not rethrown
}
- return *this;
+#endif // _LIBCPP_HAS_NO_EXCEPTIONS
+ if (__gc_ == 0)
+ __state |= ios_base::failbit;
+ this->setstate(__state);
+ }
+ return *this;
}
-template<class _CharT, class _Traits>
+template <class _CharT, class _Traits>
basic_istream<_CharT, _Traits>&
-basic_istream<_CharT, _Traits>::getline(char_type* __s, streamsize __n, char_type __dlm)
-{
- ios_base::iostate __state = ios_base::goodbit;
- __gc_ = 0;
- sentry __sen(*this, true);
- if (__sen)
- {
+basic_istream<_CharT, _Traits>::getline(char_type* __s, streamsize __n, char_type __dlm) {
+ ios_base::iostate __state = ios_base::goodbit;
+ __gc_ = 0;
+ sentry __sen(*this, true);
+ if (__sen) {
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- try
- {
+ try {
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- while (true)
- {
- typename traits_type::int_type __i = this->rdbuf()->sgetc();
- if (traits_type::eq_int_type(__i, traits_type::eof()))
- {
- __state |= ios_base::eofbit;
- break;
- }
- char_type __ch = traits_type::to_char_type(__i);
- if (traits_type::eq(__ch, __dlm))
- {
- this->rdbuf()->sbumpc();
- __inc_gcount();
- break;
- }
- if (__gc_ >= __n-1)
- {
- __state |= ios_base::failbit;
- break;
- }
- *__s++ = __ch;
- this->rdbuf()->sbumpc();
- __inc_gcount();
- }
-#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
+ while (true) {
+ typename traits_type::int_type __i = this->rdbuf()->sgetc();
+ if (traits_type::eq_int_type(__i, traits_type::eof())) {
+ __state |= ios_base::eofbit;
+ break;
}
- catch (...)
- {
- __state |= ios_base::badbit;
- this->__setstate_nothrow(__state);
- if (this->exceptions() & ios_base::badbit)
- {
- if (__n > 0)
- *__s = char_type();
- if (__gc_ == 0)
- __state |= ios_base::failbit;
- throw;
- }
+ char_type __ch = traits_type::to_char_type(__i);
+ if (traits_type::eq(__ch, __dlm)) {
+ this->rdbuf()->sbumpc();
+ __inc_gcount();
+ break;
}
-#endif // _LIBCPP_HAS_NO_EXCEPTIONS
+ if (__gc_ >= __n - 1) {
+ __state |= ios_base::failbit;
+ break;
+ }
+ *__s++ = __ch;
+ this->rdbuf()->sbumpc();
+ __inc_gcount();
+ }
+#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
+ } catch (...) {
+ __state |= ios_base::badbit;
+ this->__setstate_nothrow(__state);
+ if (this->exceptions() & ios_base::badbit) {
+ if (__n > 0)
+ *__s = char_type();
+ if (__gc_ == 0)
+ __state |= ios_base::failbit;
+ throw;
+ }
}
- if (__n > 0)
- *__s = char_type();
- if (__gc_ == 0)
- __state |= ios_base::failbit;
- this->setstate(__state);
- return *this;
+#endif // _LIBCPP_HAS_NO_EXCEPTIONS
+ }
+ if (__n > 0)
+ *__s = char_type();
+ if (__gc_ == 0)
+ __state |= ios_base::failbit;
+ this->setstate(__state);
+ return *this;
}
-template<class _CharT, class _Traits>
-basic_istream<_CharT, _Traits>&
-basic_istream<_CharT, _Traits>::ignore(streamsize __n, int_type __dlm)
-{
- ios_base::iostate __state = ios_base::goodbit;
- __gc_ = 0;
- sentry __sen(*this, true);
- if (__sen)
- {
+template <class _CharT, class _Traits>
+basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>::ignore(streamsize __n, int_type __dlm) {
+ ios_base::iostate __state = ios_base::goodbit;
+ __gc_ = 0;
+ sentry __sen(*this, true);
+ if (__sen) {
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- try
- {
+ try {
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- if (__n == numeric_limits<streamsize>::max())
- {
- while (true)
- {
- typename traits_type::int_type __i = this->rdbuf()->sbumpc();
- if (traits_type::eq_int_type(__i, traits_type::eof()))
- {
- __state |= ios_base::eofbit;
- break;
- }
- __inc_gcount();
- if (traits_type::eq_int_type(__i, __dlm))
- break;
- }
- }
- else
- {
- while (__gc_ < __n)
- {
- typename traits_type::int_type __i = this->rdbuf()->sbumpc();
- if (traits_type::eq_int_type(__i, traits_type::eof()))
- {
- __state |= ios_base::eofbit;
- break;
- }
- __inc_gcount();
- if (traits_type::eq_int_type(__i, __dlm))
- break;
- }
- }
-#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
+ if (__n == numeric_limits<streamsize>::max()) {
+ while (true) {
+ typename traits_type::int_type __i = this->rdbuf()->sbumpc();
+ if (traits_type::eq_int_type(__i, traits_type::eof())) {
+ __state |= ios_base::eofbit;
+ break;
+ }
+ __inc_gcount();
+ if (traits_type::eq_int_type(__i, __dlm))
+ break;
}
- catch (...)
- {
- __state |= ios_base::badbit;
- this->__setstate_nothrow(__state);
- if (this->exceptions() & ios_base::badbit)
- {
- throw;
- }
+ } else {
+ while (__gc_ < __n) {
+ typename traits_type::int_type __i = this->rdbuf()->sbumpc();
+ if (traits_type::eq_int_type(__i, traits_type::eof())) {
+ __state |= ios_base::eofbit;
+ break;
+ }
+ __inc_gcount();
+ if (traits_type::eq_int_type(__i, __dlm))
+ break;
}
-#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- this->setstate(__state);
+ }
+#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
+ } catch (...) {
+ __state |= ios_base::badbit;
+ this->__setstate_nothrow(__state);
+ if (this->exceptions() & ios_base::badbit) {
+ throw;
+ }
}
- return *this;
+#endif // _LIBCPP_HAS_NO_EXCEPTIONS
+ this->setstate(__state);
+ }
+ return *this;
}
-template<class _CharT, class _Traits>
-typename basic_istream<_CharT, _Traits>::int_type
-basic_istream<_CharT, _Traits>::peek()
-{
- ios_base::iostate __state = ios_base::goodbit;
- __gc_ = 0;
- int_type __r = traits_type::eof();
- sentry __sen(*this, true);
- if (__sen)
- {
+template <class _CharT, class _Traits>
+typename basic_istream<_CharT, _Traits>::int_type basic_istream<_CharT, _Traits>::peek() {
+ ios_base::iostate __state = ios_base::goodbit;
+ __gc_ = 0;
+ int_type __r = traits_type::eof();
+ sentry __sen(*this, true);
+ if (__sen) {
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- try
- {
+ try {
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- __r = this->rdbuf()->sgetc();
- if (traits_type::eq_int_type(__r, traits_type::eof()))
- __state |= ios_base::eofbit;
+ __r = this->rdbuf()->sgetc();
+ if (traits_type::eq_int_type(__r, traits_type::eof()))
+ __state |= ios_base::eofbit;
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- }
- catch (...)
- {
- __state |= ios_base::badbit;
- this->__setstate_nothrow(__state);
- if (this->exceptions() & ios_base::badbit)
- {
- throw;
- }
- }
-#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- this->setstate(__state);
+ } catch (...) {
+ __state |= ios_base::badbit;
+ this->__setstate_nothrow(__state);
+ if (this->exceptions() & ios_base::badbit) {
+ throw;
+ }
}
- return __r;
+#endif // _LIBCPP_HAS_NO_EXCEPTIONS
+ this->setstate(__state);
+ }
+ return __r;
}
-template<class _CharT, class _Traits>
-basic_istream<_CharT, _Traits>&
-basic_istream<_CharT, _Traits>::read(char_type* __s, streamsize __n)
-{
- ios_base::iostate __state = ios_base::goodbit;
- __gc_ = 0;
- sentry __sen(*this, true);
- if (__sen)
- {
+template <class _CharT, class _Traits>
+basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>::read(char_type* __s, streamsize __n) {
+ ios_base::iostate __state = ios_base::goodbit;
+ __gc_ = 0;
+ sentry __sen(*this, true);
+ if (__sen) {
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- try
- {
+ try {
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- __gc_ = this->rdbuf()->sgetn(__s, __n);
- if (__gc_ != __n)
- __state |= ios_base::failbit | ios_base::eofbit;
+ __gc_ = this->rdbuf()->sgetn(__s, __n);
+ if (__gc_ != __n)
+ __state |= ios_base::failbit | ios_base::eofbit;
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- }
- catch (...)
- {
- __state |= ios_base::badbit;
- this->__setstate_nothrow(__state);
- if (this->exceptions() & ios_base::badbit)
- {
- throw;
- }
- }
-#endif // _LIBCPP_HAS_NO_EXCEPTIONS
+ } catch (...) {
+ __state |= ios_base::badbit;
+ this->__setstate_nothrow(__state);
+ if (this->exceptions() & ios_base::badbit) {
+ throw;
+ }
}
- else
- {
- __state |= ios_base::failbit;
- }
- this->setstate(__state);
- return *this;
+#endif // _LIBCPP_HAS_NO_EXCEPTIONS
+ } else {
+ __state |= ios_base::failbit;
+ }
+ this->setstate(__state);
+ return *this;
}
-template<class _CharT, class _Traits>
-streamsize
-basic_istream<_CharT, _Traits>::readsome(char_type* __s, streamsize __n)
-{
- ios_base::iostate __state = ios_base::goodbit;
- __gc_ = 0;
- sentry __sen(*this, true);
- if (__sen)
- {
+template <class _CharT, class _Traits>
+streamsize basic_istream<_CharT, _Traits>::readsome(char_type* __s, streamsize __n) {
+ ios_base::iostate __state = ios_base::goodbit;
+ __gc_ = 0;
+ sentry __sen(*this, true);
+ if (__sen) {
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- try
- {
+ try {
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- streamsize __c = this->rdbuf()->in_avail();
- switch (__c)
- {
- case -1:
- __state |= ios_base::eofbit;
- break;
- case 0:
- break;
- default:
- __n = std::min(__c, __n);
- __gc_ = this->rdbuf()->sgetn(__s, __n);
- if (__gc_ != __n)
- __state |= ios_base::failbit | ios_base::eofbit;
- break;
- }
+ streamsize __c = this->rdbuf()->in_avail();
+ switch (__c) {
+ case -1:
+ __state |= ios_base::eofbit;
+ break;
+ case 0:
+ break;
+ default:
+ __n = std::min(__c, __n);
+ __gc_ = this->rdbuf()->sgetn(__s, __n);
+ if (__gc_ != __n)
+ __state |= ios_base::failbit | ios_base::eofbit;
+ break;
+ }
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- }
- catch (...)
- {
- __state |= ios_base::badbit;
- this->__setstate_nothrow(__state);
- if (this->exceptions() & ios_base::badbit)
- {
- throw;
- }
- }
-#endif // _LIBCPP_HAS_NO_EXCEPTIONS
+ } catch (...) {
+ __state |= ios_base::badbit;
+ this->__setstate_nothrow(__state);
+ if (this->exceptions() & ios_base::badbit) {
+ throw;
+ }
}
- else
- {
- __state |= ios_base::failbit;
- }
- this->setstate(__state);
- return __gc_;
+#endif // _LIBCPP_HAS_NO_EXCEPTIONS
+ } else {
+ __state |= ios_base::failbit;
+ }
+ this->setstate(__state);
+ return __gc_;
}
-template<class _CharT, class _Traits>
-basic_istream<_CharT, _Traits>&
-basic_istream<_CharT, _Traits>::putback(char_type __c)
-{
- ios_base::iostate __state = this->rdstate() & ~ios_base::eofbit;
- __gc_ = 0;
- this->clear(__state);
- sentry __sen(*this, true);
- if (__sen)
- {
+template <class _CharT, class _Traits>
+basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>::putback(char_type __c) {
+ ios_base::iostate __state = this->rdstate() & ~ios_base::eofbit;
+ __gc_ = 0;
+ this->clear(__state);
+ sentry __sen(*this, true);
+ if (__sen) {
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- try
- {
+ try {
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- if (this->rdbuf() == nullptr || this->rdbuf()->sputbackc(__c) == traits_type::eof())
- __state |= ios_base::badbit;
+ if (this->rdbuf() == nullptr || this->rdbuf()->sputbackc(__c) == traits_type::eof())
+ __state |= ios_base::badbit;
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- }
- catch (...)
- {
- __state |= ios_base::badbit;
- this->__setstate_nothrow(__state);
- if (this->exceptions() & ios_base::badbit)
- {
- throw;
- }
- }
-#endif // _LIBCPP_HAS_NO_EXCEPTIONS
+ } catch (...) {
+ __state |= ios_base::badbit;
+ this->__setstate_nothrow(__state);
+ if (this->exceptions() & ios_base::badbit) {
+ throw;
+ }
}
- else
- {
- __state |= ios_base::failbit;
- }
- this->setstate(__state);
- return *this;
+#endif // _LIBCPP_HAS_NO_EXCEPTIONS
+ } else {
+ __state |= ios_base::failbit;
+ }
+ this->setstate(__state);
+ return *this;
}
-template<class _CharT, class _Traits>
-basic_istream<_CharT, _Traits>&
-basic_istream<_CharT, _Traits>::unget()
-{
- ios_base::iostate __state = this->rdstate() & ~ios_base::eofbit;
- __gc_ = 0;
- this->clear(__state);
- sentry __sen(*this, true);
- if (__sen)
- {
+template <class _CharT, class _Traits>
+basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>::unget() {
+ ios_base::iostate __state = this->rdstate() & ~ios_base::eofbit;
+ __gc_ = 0;
+ this->clear(__state);
+ sentry __sen(*this, true);
+ if (__sen) {
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- try
- {
+ try {
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- if (this->rdbuf() == nullptr || this->rdbuf()->sungetc() == traits_type::eof())
- __state |= ios_base::badbit;
+ if (this->rdbuf() == nullptr || this->rdbuf()->sungetc() == traits_type::eof())
+ __state |= ios_base::badbit;
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- }
- catch (...)
- {
- __state |= ios_base::badbit;
- this->__setstate_nothrow(__state);
- if (this->exceptions() & ios_base::badbit)
- {
- throw;
- }
- }
-#endif // _LIBCPP_HAS_NO_EXCEPTIONS
+ } catch (...) {
+ __state |= ios_base::badbit;
+ this->__setstate_nothrow(__state);
+ if (this->exceptions() & ios_base::badbit) {
+ throw;
+ }
}
- else
- {
- __state |= ios_base::failbit;
- }
- this->setstate(__state);
- return *this;
+#endif // _LIBCPP_HAS_NO_EXCEPTIONS
+ } else {
+ __state |= ios_base::failbit;
+ }
+ this->setstate(__state);
+ return *this;
}
-template<class _CharT, class _Traits>
-int
-basic_istream<_CharT, _Traits>::sync()
-{
- ios_base::iostate __state = ios_base::goodbit;
- int __r = 0;
- sentry __sen(*this, true);
- if (__sen)
- {
+template <class _CharT, class _Traits>
+int basic_istream<_CharT, _Traits>::sync() {
+ ios_base::iostate __state = ios_base::goodbit;
+ int __r = 0;
+ sentry __sen(*this, true);
+ if (__sen) {
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- try
- {
+ try {
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- if (this->rdbuf() == nullptr)
- return -1;
- if (this->rdbuf()->pubsync() == -1)
- {
- __state |= ios_base::badbit;
- return -1;
- }
+ if (this->rdbuf() == nullptr)
+ return -1;
+ if (this->rdbuf()->pubsync() == -1) {
+ __state |= ios_base::badbit;
+ return -1;
+ }
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- }
- catch (...)
- {
- __state |= ios_base::badbit;
- this->__setstate_nothrow(__state);
- if (this->exceptions() & ios_base::badbit)
- {
- throw;
- }
- }
-#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- this->setstate(__state);
+ } catch (...) {
+ __state |= ios_base::badbit;
+ this->__setstate_nothrow(__state);
+ if (this->exceptions() & ios_base::badbit) {
+ throw;
+ }
}
- return __r;
+#endif // _LIBCPP_HAS_NO_EXCEPTIONS
+ this->setstate(__state);
+ }
+ return __r;
}
-template<class _CharT, class _Traits>
-typename basic_istream<_CharT, _Traits>::pos_type
-basic_istream<_CharT, _Traits>::tellg()
-{
- ios_base::iostate __state = ios_base::goodbit;
- pos_type __r(-1);
- sentry __sen(*this, true);
- if (__sen)
- {
+template <class _CharT, class _Traits>
+typename basic_istream<_CharT, _Traits>::pos_type basic_istream<_CharT, _Traits>::tellg() {
+ ios_base::iostate __state = ios_base::goodbit;
+ pos_type __r(-1);
+ sentry __sen(*this, true);
+ if (__sen) {
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- try
- {
+ try {
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- __r = this->rdbuf()->pubseekoff(0, ios_base::cur, ios_base::in);
+ __r = this->rdbuf()->pubseekoff(0, ios_base::cur, ios_base::in);
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- }
- catch (...)
- {
- __state |= ios_base::badbit;
- this->__setstate_nothrow(__state);
- if (this->exceptions() & ios_base::badbit)
- {
- throw;
- }
- }
-#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- this->setstate(__state);
+ } catch (...) {
+ __state |= ios_base::badbit;
+ this->__setstate_nothrow(__state);
+ if (this->exceptions() & ios_base::badbit) {
+ throw;
+ }
}
- return __r;
+#endif // _LIBCPP_HAS_NO_EXCEPTIONS
+ this->setstate(__state);
+ }
+ return __r;
}
-template<class _CharT, class _Traits>
-basic_istream<_CharT, _Traits>&
-basic_istream<_CharT, _Traits>::seekg(pos_type __pos)
-{
- ios_base::iostate __state = this->rdstate() & ~ios_base::eofbit;
- this->clear(__state);
- sentry __sen(*this, true);
- if (__sen)
- {
+template <class _CharT, class _Traits>
+basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>::seekg(pos_type __pos) {
+ ios_base::iostate __state = this->rdstate() & ~ios_base::eofbit;
+ this->clear(__state);
+ sentry __sen(*this, true);
+ if (__sen) {
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- try
- {
+ try {
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- if (this->rdbuf()->pubseekpos(__pos, ios_base::in) == pos_type(-1))
- __state |= ios_base::failbit;
+ if (this->rdbuf()->pubseekpos(__pos, ios_base::in) == pos_type(-1))
+ __state |= ios_base::failbit;
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- }
- catch (...)
- {
- __state |= ios_base::badbit;
- this->__setstate_nothrow(__state);
- if (this->exceptions() & ios_base::badbit)
- {
- throw;
- }
- }
-#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- this->setstate(__state);
+ } catch (...) {
+ __state |= ios_base::badbit;
+ this->__setstate_nothrow(__state);
+ if (this->exceptions() & ios_base::badbit) {
+ throw;
+ }
}
- return *this;
+#endif // _LIBCPP_HAS_NO_EXCEPTIONS
+ this->setstate(__state);
+ }
+ return *this;
}
-template<class _CharT, class _Traits>
-basic_istream<_CharT, _Traits>&
-basic_istream<_CharT, _Traits>::seekg(off_type __off, ios_base::seekdir __dir)
-{
- ios_base::iostate __state = this->rdstate() & ~ios_base::eofbit;
- this->clear(__state);
- sentry __sen(*this, true);
- if (__sen)
- {
+template <class _CharT, class _Traits>
+basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>::seekg(off_type __off, ios_base::seekdir __dir) {
+ ios_base::iostate __state = this->rdstate() & ~ios_base::eofbit;
+ this->clear(__state);
+ sentry __sen(*this, true);
+ if (__sen) {
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- try
- {
+ try {
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- if (this->rdbuf()->pubseekoff(__off, __dir, ios_base::in) == pos_type(-1))
- __state |= ios_base::failbit;
+ if (this->rdbuf()->pubseekoff(__off, __dir, ios_base::in) == pos_type(-1))
+ __state |= ios_base::failbit;
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- }
- catch (...)
- {
- __state |= ios_base::badbit;
- this->__setstate_nothrow(__state);
- if (this->exceptions() & ios_base::badbit)
- {
- throw;
- }
- }
-#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- this->setstate(__state);
+ } catch (...) {
+ __state |= ios_base::badbit;
+ this->__setstate_nothrow(__state);
+ if (this->exceptions() & ios_base::badbit) {
+ throw;
+ }
}
- return *this;
+#endif // _LIBCPP_HAS_NO_EXCEPTIONS
+ this->setstate(__state);
+ }
+ return *this;
}
template <class _CharT, class _Traits>
-_LIBCPP_HIDE_FROM_ABI basic_istream<_CharT, _Traits>&
-ws(basic_istream<_CharT, _Traits>& __is)
-{
- ios_base::iostate __state = ios_base::goodbit;
- typename basic_istream<_CharT, _Traits>::sentry __sen(__is, true);
- if (__sen)
- {
+_LIBCPP_HIDE_FROM_ABI basic_istream<_CharT, _Traits>& ws(basic_istream<_CharT, _Traits>& __is) {
+ ios_base::iostate __state = ios_base::goodbit;
+ typename basic_istream<_CharT, _Traits>::sentry __sen(__is, true);
+ if (__sen) {
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- try
- {
+ try {
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- const ctype<_CharT>& __ct = std::use_facet<ctype<_CharT> >(__is.getloc());
- while (true)
- {
- typename _Traits::int_type __i = __is.rdbuf()->sgetc();
- if (_Traits::eq_int_type(__i, _Traits::eof()))
- {
- __state |= ios_base::eofbit;
- break;
- }
- if (!__ct.is(__ct.space, _Traits::to_char_type(__i)))
- break;
- __is.rdbuf()->sbumpc();
- }
-#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- }
- catch (...)
- {
- __state |= ios_base::badbit;
- __is.__setstate_nothrow(__state);
- if (__is.exceptions() & ios_base::badbit)
- {
- throw;
- }
+ const ctype<_CharT>& __ct = std::use_facet<ctype<_CharT> >(__is.getloc());
+ while (true) {
+ typename _Traits::int_type __i = __is.rdbuf()->sgetc();
+ if (_Traits::eq_int_type(__i, _Traits::eof())) {
+ __state |= ios_base::eofbit;
+ break;
}
-#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- __is.setstate(__state);
+ if (!__ct.is(__ct.space, _Traits::to_char_type(__i)))
+ break;
+ __is.rdbuf()->sbumpc();
+ }
+#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
+ } catch (...) {
+ __state |= ios_base::badbit;
+ __is.__setstate_nothrow(__state);
+ if (__is.exceptions() & ios_base::badbit) {
+ throw;
+ }
}
- return __is;
+#endif // _LIBCPP_HAS_NO_EXCEPTIONS
+ __is.setstate(__state);
+ }
+ return __is;
}
template <class _Stream, class _Tp, class = void>
-struct __is_istreamable : false_type { };
+struct __is_istreamable : false_type {};
template <class _Stream, class _Tp>
-struct __is_istreamable<_Stream, _Tp, decltype(
- std::declval<_Stream>() >> std::declval<_Tp>(), void()
-)> : true_type { };
-
-template <class _Stream, class _Tp, __enable_if_t<
- _And<is_base_of<ios_base, _Stream>, __is_istreamable<_Stream&, _Tp&&> >::value, int> = 0>
-_LIBCPP_HIDE_FROM_ABI
-_Stream&& operator>>(_Stream&& __is, _Tp&& __x)
-{
- __is >> std::forward<_Tp>(__x);
- return std::move(__is);
+struct __is_istreamable<_Stream, _Tp, decltype(std::declval<_Stream>() >> std::declval<_Tp>(), void())> : true_type {};
+
+template <class _Stream,
+ class _Tp,
+ __enable_if_t< _And<is_base_of<ios_base, _Stream>, __is_istreamable<_Stream&, _Tp&&> >::value, int> = 0>
+_LIBCPP_HIDE_FROM_ABI _Stream&& operator>>(_Stream&& __is, _Tp&& __x) {
+ __is >> std::forward<_Tp>(__x);
+ return std::move(__is);
}
template <class _CharT, class _Traits>
class _LIBCPP_TEMPLATE_VIS basic_iostream
: public basic_istream<_CharT, _Traits>,
- public basic_ostream<_CharT, _Traits>
-{
+ public basic_ostream<_CharT, _Traits> {
public:
- // types:
- typedef _CharT char_type;
- typedef _Traits traits_type;
- typedef typename traits_type::int_type int_type;
- typedef typename traits_type::pos_type pos_type;
- typedef typename traits_type::off_type off_type;
+ // types:
+ typedef _CharT char_type;
+ typedef _Traits traits_type;
+ typedef typename traits_type::int_type int_type;
+ typedef typename traits_type::pos_type pos_type;
+ typedef typename traits_type::off_type off_type;
- // constructor/destructor
- inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1
- explicit basic_iostream(basic_streambuf<char_type, traits_type>* __sb)
- : basic_istream<_CharT, _Traits>(__sb)
- {}
+ // constructor/destructor
+ inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1 explicit basic_iostream(basic_streambuf<char_type, traits_type>* __sb)
+ : basic_istream<_CharT, _Traits>(__sb) {}
+
+ ~basic_iostream() override;
- ~basic_iostream() override;
protected:
- inline _LIBCPP_HIDE_FROM_ABI
- basic_iostream(basic_iostream&& __rhs);
+ inline _LIBCPP_HIDE_FROM_ABI basic_iostream(basic_iostream&& __rhs);
- // assign/swap
- inline _LIBCPP_HIDE_FROM_ABI
- basic_iostream& operator=(basic_iostream&& __rhs);
+ // assign/swap
+ inline _LIBCPP_HIDE_FROM_ABI basic_iostream& operator=(basic_iostream&& __rhs);
- inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1
- void swap(basic_iostream& __rhs)
- { basic_istream<char_type, traits_type>::swap(__rhs); }
+ inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1 void swap(basic_iostream& __rhs) {
+ basic_istream<char_type, traits_type>::swap(__rhs);
+ }
};
template <class _CharT, class _Traits>
basic_iostream<_CharT, _Traits>::basic_iostream(basic_iostream&& __rhs)
- : basic_istream<_CharT, _Traits>(std::move(__rhs))
-{
-}
+ : basic_istream<_CharT, _Traits>(std::move(__rhs)) {}
template <class _CharT, class _Traits>
-basic_iostream<_CharT, _Traits>&
-basic_iostream<_CharT, _Traits>::operator=(basic_iostream&& __rhs)
-{
- swap(__rhs);
- return *this;
+basic_iostream<_CharT, _Traits>& basic_iostream<_CharT, _Traits>::operator=(basic_iostream&& __rhs) {
+ swap(__rhs);
+ return *this;
}
template <class _CharT, class _Traits>
-basic_iostream<_CharT, _Traits>::~basic_iostream()
-{
-}
+basic_iostream<_CharT, _Traits>::~basic_iostream() {}
-template<class _CharT, class _Traits, class _Allocator>
+template <class _CharT, class _Traits, class _Allocator>
_LIBCPP_HIDE_FROM_ABI basic_istream<_CharT, _Traits>&
-operator>>(basic_istream<_CharT, _Traits>& __is,
- basic_string<_CharT, _Traits, _Allocator>& __str)
-{
- ios_base::iostate __state = ios_base::goodbit;
- typename basic_istream<_CharT, _Traits>::sentry __sen(__is);
- if (__sen)
- {
+operator>>(basic_istream<_CharT, _Traits>& __is, basic_string<_CharT, _Traits, _Allocator>& __str) {
+ ios_base::iostate __state = ios_base::goodbit;
+ typename basic_istream<_CharT, _Traits>::sentry __sen(__is);
+ if (__sen) {
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- try
- {
+ try {
#endif
- __str.clear();
- streamsize __n = __is.width();
- if (__n <= 0)
- __n = __str.max_size();
- if (__n <= 0)
- __n = numeric_limits<streamsize>::max();
- streamsize __c = 0;
- const ctype<_CharT>& __ct = std::use_facet<ctype<_CharT> >(__is.getloc());
- while (__c < __n)
- {
- typename _Traits::int_type __i = __is.rdbuf()->sgetc();
- if (_Traits::eq_int_type(__i, _Traits::eof()))
- {
- __state |= ios_base::eofbit;
- break;
- }
- _CharT __ch = _Traits::to_char_type(__i);
- if (__ct.is(__ct.space, __ch))
- break;
- __str.push_back(__ch);
- ++__c;
- __is.rdbuf()->sbumpc();
- }
- __is.width(0);
- if (__c == 0)
- __state |= ios_base::failbit;
-#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
+ __str.clear();
+ streamsize __n = __is.width();
+ if (__n <= 0)
+ __n = __str.max_size();
+ if (__n <= 0)
+ __n = numeric_limits<streamsize>::max();
+ streamsize __c = 0;
+ const ctype<_CharT>& __ct = std::use_facet<ctype<_CharT> >(__is.getloc());
+ while (__c < __n) {
+ typename _Traits::int_type __i = __is.rdbuf()->sgetc();
+ if (_Traits::eq_int_type(__i, _Traits::eof())) {
+ __state |= ios_base::eofbit;
+ break;
}
- catch (...)
- {
- __state |= ios_base::badbit;
- __is.__setstate_nothrow(__state);
- if (__is.exceptions() & ios_base::badbit)
- {
- throw;
- }
- }
-#endif
- __is.setstate(__state);
+ _CharT __ch = _Traits::to_char_type(__i);
+ if (__ct.is(__ct.space, __ch))
+ break;
+ __str.push_back(__ch);
+ ++__c;
+ __is.rdbuf()->sbumpc();
+ }
+ __is.width(0);
+ if (__c == 0)
+ __state |= ios_base::failbit;
+#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
+ } catch (...) {
+ __state |= ios_base::badbit;
+ __is.__setstate_nothrow(__state);
+ if (__is.exceptions() & ios_base::badbit) {
+ throw;
+ }
}
- return __is;
+#endif
+ __is.setstate(__state);
+ }
+ return __is;
}
-template<class _CharT, class _Traits, class _Allocator>
+template <class _CharT, class _Traits, class _Allocator>
_LIBCPP_HIDE_FROM_ABI basic_istream<_CharT, _Traits>&
-getline(basic_istream<_CharT, _Traits>& __is,
- basic_string<_CharT, _Traits, _Allocator>& __str, _CharT __dlm)
-{
- ios_base::iostate __state = ios_base::goodbit;
- typename basic_istream<_CharT, _Traits>::sentry __sen(__is, true);
- if (__sen)
- {
+getline(basic_istream<_CharT, _Traits>& __is, basic_string<_CharT, _Traits, _Allocator>& __str, _CharT __dlm) {
+ ios_base::iostate __state = ios_base::goodbit;
+ typename basic_istream<_CharT, _Traits>::sentry __sen(__is, true);
+ if (__sen) {
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- try
- {
+ try {
#endif
- __str.clear();
- streamsize __extr = 0;
- while (true)
- {
- typename _Traits::int_type __i = __is.rdbuf()->sbumpc();
- if (_Traits::eq_int_type(__i, _Traits::eof()))
- {
- __state |= ios_base::eofbit;
- break;
- }
- ++__extr;
- _CharT __ch = _Traits::to_char_type(__i);
- if (_Traits::eq(__ch, __dlm))
- break;
- __str.push_back(__ch);
- if (__str.size() == __str.max_size())
- {
- __state |= ios_base::failbit;
- break;
- }
- }
- if (__extr == 0)
- __state |= ios_base::failbit;
-#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
+ __str.clear();
+ streamsize __extr = 0;
+ while (true) {
+ typename _Traits::int_type __i = __is.rdbuf()->sbumpc();
+ if (_Traits::eq_int_type(__i, _Traits::eof())) {
+ __state |= ios_base::eofbit;
+ break;
}
- catch (...)
- {
- __state |= ios_base::badbit;
- __is.__setstate_nothrow(__state);
- if (__is.exceptions() & ios_base::badbit)
- {
- throw;
- }
+ ++__extr;
+ _CharT __ch = _Traits::to_char_type(__i);
+ if (_Traits::eq(__ch, __dlm))
+ break;
+ __str.push_back(__ch);
+ if (__str.size() == __str.max_size()) {
+ __state |= ios_base::failbit;
+ break;
}
-#endif
- __is.setstate(__state);
+ }
+ if (__extr == 0)
+ __state |= ios_base::failbit;
+#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
+ } catch (...) {
+ __state |= ios_base::badbit;
+ __is.__setstate_nothrow(__state);
+ if (__is.exceptions() & ios_base::badbit) {
+ throw;
+ }
}
- return __is;
+#endif
+ __is.setstate(__state);
+ }
+ return __is;
}
-template<class _CharT, class _Traits, class _Allocator>
-inline _LIBCPP_HIDE_FROM_ABI
-basic_istream<_CharT, _Traits>&
-getline(basic_istream<_CharT, _Traits>& __is,
- basic_string<_CharT, _Traits, _Allocator>& __str)
-{
- return std::getline(__is, __str, __is.widen('\n'));
+template <class _CharT, class _Traits, class _Allocator>
+inline _LIBCPP_HIDE_FROM_ABI basic_istream<_CharT, _Traits>&
+getline(basic_istream<_CharT, _Traits>& __is, basic_string<_CharT, _Traits, _Allocator>& __str) {
+ return std::getline(__is, __str, __is.widen('\n'));
}
-template<class _CharT, class _Traits, class _Allocator>
-inline _LIBCPP_HIDE_FROM_ABI
-basic_istream<_CharT, _Traits>&
-getline(basic_istream<_CharT, _Traits>&& __is,
- basic_string<_CharT, _Traits, _Allocator>& __str, _CharT __dlm)
-{
- return std::getline(__is, __str, __dlm);
+template <class _CharT, class _Traits, class _Allocator>
+inline _LIBCPP_HIDE_FROM_ABI basic_istream<_CharT, _Traits>&
+getline(basic_istream<_CharT, _Traits>&& __is, basic_string<_CharT, _Traits, _Allocator>& __str, _CharT __dlm) {
+ return std::getline(__is, __str, __dlm);
}
-template<class _CharT, class _Traits, class _Allocator>
-inline _LIBCPP_HIDE_FROM_ABI
-basic_istream<_CharT, _Traits>&
-getline(basic_istream<_CharT, _Traits>&& __is,
- basic_string<_CharT, _Traits, _Allocator>& __str)
-{
- return std::getline(__is, __str, __is.widen('\n'));
+template <class _CharT, class _Traits, class _Allocator>
+inline _LIBCPP_HIDE_FROM_ABI basic_istream<_CharT, _Traits>&
+getline(basic_istream<_CharT, _Traits>&& __is, basic_string<_CharT, _Traits, _Allocator>& __str) {
+ return std::getline(__is, __str, __is.widen('\n'));
}
template <class _CharT, class _Traits, size_t _Size>
_LIBCPP_HIDE_FROM_ABI basic_istream<_CharT, _Traits>&
-operator>>(basic_istream<_CharT, _Traits>& __is, bitset<_Size>& __x)
-{
- ios_base::iostate __state = ios_base::goodbit;
- typename basic_istream<_CharT, _Traits>::sentry __sen(__is);
- if (__sen)
- {
+operator>>(basic_istream<_CharT, _Traits>& __is, bitset<_Size>& __x) {
+ ios_base::iostate __state = ios_base::goodbit;
+ typename basic_istream<_CharT, _Traits>::sentry __sen(__is);
+ if (__sen) {
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- try
- {
+ try {
#endif
- basic_string<_CharT, _Traits> __str;
- const ctype<_CharT>& __ct = std::use_facet<ctype<_CharT> >(__is.getloc());
- size_t __c = 0;
- _CharT __zero = __ct.widen('0');
- _CharT __one = __ct.widen('1');
- while (__c != _Size)
- {
- typename _Traits::int_type __i = __is.rdbuf()->sgetc();
- if (_Traits::eq_int_type(__i, _Traits::eof()))
- {
- __state |= ios_base::eofbit;
- break;
- }
- _CharT __ch = _Traits::to_char_type(__i);
- if (!_Traits::eq(__ch, __zero) && !_Traits::eq(__ch, __one))
- break;
- __str.push_back(__ch);
- ++__c;
- __is.rdbuf()->sbumpc();
- }
- __x = bitset<_Size>(__str);
- if (_Size > 0 && __c == 0)
- __state |= ios_base::failbit;
-#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- }
- catch (...)
- {
- __state |= ios_base::badbit;
- __is.__setstate_nothrow(__state);
- if (__is.exceptions() & ios_base::badbit)
- {
- throw;
- }
+ basic_string<_CharT, _Traits> __str;
+ const ctype<_CharT>& __ct = std::use_facet<ctype<_CharT> >(__is.getloc());
+ size_t __c = 0;
+ _CharT __zero = __ct.widen('0');
+ _CharT __one = __ct.widen('1');
+ while (__c != _Size) {
+ typename _Traits::int_type __i = __is.rdbuf()->sgetc();
+ if (_Traits::eq_int_type(__i, _Traits::eof())) {
+ __state |= ios_base::eofbit;
+ break;
}
-#endif
- __is.setstate(__state);
+ _CharT __ch = _Traits::to_char_type(__i);
+ if (!_Traits::eq(__ch, __zero) && !_Traits::eq(__ch, __one))
+ break;
+ __str.push_back(__ch);
+ ++__c;
+ __is.rdbuf()->sbumpc();
+ }
+ __x = bitset<_Size>(__str);
+ if (_Size > 0 && __c == 0)
+ __state |= ios_base::failbit;
+#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
+ } catch (...) {
+ __state |= ios_base::badbit;
+ __is.__setstate_nothrow(__state);
+ if (__is.exceptions() & ios_base::badbit) {
+ throw;
+ }
}
- return __is;
+#endif
+ __is.setstate(__state);
+ }
+ return __is;
}
extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_istream<char>;
diff --git a/contrib/llvm-project/libcxx/include/latch b/contrib/llvm-project/libcxx/include/latch
index 0d1b3713ea62..ef52c0562a7c 100644
--- a/contrib/llvm-project/libcxx/include/latch
+++ b/contrib/llvm-project/libcxx/include/latch
@@ -55,7 +55,7 @@ namespace std
#endif
#ifdef _LIBCPP_HAS_NO_THREADS
-# error "<latch> is not supported since libc++ has been configured without support for threads."
+# error "<latch> is not supported since libc++ has been configured without support for threads."
#endif
_LIBCPP_PUSH_MACROS
@@ -65,64 +65,48 @@ _LIBCPP_PUSH_MACROS
_LIBCPP_BEGIN_NAMESPACE_STD
-class latch
-{
- __atomic_base<ptrdiff_t> __a_;
+class latch {
+ __atomic_base<ptrdiff_t> __a_;
public:
- static _LIBCPP_HIDE_FROM_ABI constexpr ptrdiff_t max() noexcept {
- return numeric_limits<ptrdiff_t>::max();
- }
-
- inline _LIBCPP_HIDE_FROM_ABI
- constexpr explicit latch(ptrdiff_t __expected) : __a_(__expected)
- {
- _LIBCPP_ASSERT_UNCATEGORIZED(__expected >= 0,
- "latch::latch(ptrdiff_t): latch cannot be "
- "initialized with a negative value");
- _LIBCPP_ASSERT_UNCATEGORIZED(__expected <= max(),
- "latch::latch(ptrdiff_t): latch cannot be "
- "initialized with a value greater than max()");
- }
-
- _LIBCPP_HIDE_FROM_ABI ~latch() = default;
- latch(const latch&) = delete;
- latch& operator=(const latch&) = delete;
-
- inline _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI
- void count_down(ptrdiff_t __update = 1)
- {
- _LIBCPP_ASSERT_UNCATEGORIZED(
- __update >= 0, "latch::count_down called with a negative value");
- auto const __old = __a_.fetch_sub(__update, memory_order_release);
- _LIBCPP_ASSERT_UNCATEGORIZED(
- __update <= __old, "latch::count_down called with a value greater "
- "than the internal counter");
- if (__old == __update)
- __a_.notify_all();
- }
- inline _LIBCPP_HIDE_FROM_ABI
- bool try_wait() const noexcept
- {
- return 0 == __a_.load(memory_order_acquire);
- }
- inline _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI
- void wait() const
- {
- __cxx_atomic_wait(&__a_.__a_, [this]() -> bool {
- return try_wait();
- });
- }
- inline _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI
- void arrive_and_wait(ptrdiff_t __update = 1)
- {
- _LIBCPP_ASSERT_UNCATEGORIZED(
- __update >= 0, "latch::arrive_and_wait called with a negative value");
- // other preconditions on __update are checked in count_down()
-
- count_down(__update);
- wait();
- }
+ static _LIBCPP_HIDE_FROM_ABI constexpr ptrdiff_t max() noexcept { return numeric_limits<ptrdiff_t>::max(); }
+
+ inline _LIBCPP_HIDE_FROM_ABI constexpr explicit latch(ptrdiff_t __expected) : __a_(__expected) {
+ _LIBCPP_ASSERT_UNCATEGORIZED(
+ __expected >= 0,
+ "latch::latch(ptrdiff_t): latch cannot be "
+ "initialized with a negative value");
+ _LIBCPP_ASSERT_UNCATEGORIZED(
+ __expected <= max(),
+ "latch::latch(ptrdiff_t): latch cannot be "
+ "initialized with a value greater than max()");
+ }
+
+ _LIBCPP_HIDE_FROM_ABI ~latch() = default;
+ latch(const latch&) = delete;
+ latch& operator=(const latch&) = delete;
+
+ inline _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI void count_down(ptrdiff_t __update = 1) {
+ _LIBCPP_ASSERT_UNCATEGORIZED(__update >= 0, "latch::count_down called with a negative value");
+ auto const __old = __a_.fetch_sub(__update, memory_order_release);
+ _LIBCPP_ASSERT_UNCATEGORIZED(
+ __update <= __old,
+ "latch::count_down called with a value greater "
+ "than the internal counter");
+ if (__old == __update)
+ __a_.notify_all();
+ }
+ inline _LIBCPP_HIDE_FROM_ABI bool try_wait() const noexcept { return 0 == __a_.load(memory_order_acquire); }
+ inline _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI void wait() const {
+ __cxx_atomic_wait(&__a_.__a_, [this]() -> bool { return try_wait(); });
+ }
+ inline _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI void arrive_and_wait(ptrdiff_t __update = 1) {
+ _LIBCPP_ASSERT_UNCATEGORIZED(__update >= 0, "latch::arrive_and_wait called with a negative value");
+ // other preconditions on __update are checked in count_down()
+
+ count_down(__update);
+ wait();
+ }
};
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/limits b/contrib/llvm-project/libcxx/include/limits
index a31593fe03e7..a240580c0132 100644
--- a/contrib/llvm-project/libcxx/include/limits
+++ b/contrib/llvm-project/libcxx/include/limits
@@ -116,716 +116,700 @@ _LIBCPP_PUSH_MACROS
#include <__undef_macros>
#include <version>
-
_LIBCPP_BEGIN_NAMESPACE_STD
-enum float_round_style
-{
- round_indeterminate = -1,
- round_toward_zero = 0,
- round_to_nearest = 1,
- round_toward_infinity = 2,
- round_toward_neg_infinity = 3
+enum float_round_style {
+ round_indeterminate = -1,
+ round_toward_zero = 0,
+ round_to_nearest = 1,
+ round_toward_infinity = 2,
+ round_toward_neg_infinity = 3
};
-enum _LIBCPP_DEPRECATED_IN_CXX23 float_denorm_style
-{
- denorm_indeterminate = -1,
- denorm_absent = 0,
- denorm_present = 1
+enum _LIBCPP_DEPRECATED_IN_CXX23 float_denorm_style {
+ denorm_indeterminate = -1,
+ denorm_absent = 0,
+ denorm_present = 1
};
template <class _Tp, bool = is_arithmetic<_Tp>::value>
-class __libcpp_numeric_limits
-{
+class __libcpp_numeric_limits {
protected:
- typedef _Tp type;
-
- static _LIBCPP_CONSTEXPR const bool is_specialized = false;
- _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type min() _NOEXCEPT {return type();}
- _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type max() _NOEXCEPT {return type();}
- _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type lowest() _NOEXCEPT {return type();}
-
- static _LIBCPP_CONSTEXPR const int digits = 0;
- static _LIBCPP_CONSTEXPR const int digits10 = 0;
- static _LIBCPP_CONSTEXPR const int max_digits10 = 0;
- static _LIBCPP_CONSTEXPR const bool is_signed = false;
- static _LIBCPP_CONSTEXPR const bool is_integer = false;
- static _LIBCPP_CONSTEXPR const bool is_exact = false;
- static _LIBCPP_CONSTEXPR const int radix = 0;
- _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type epsilon() _NOEXCEPT {return type();}
- _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type round_error() _NOEXCEPT {return type();}
-
- static _LIBCPP_CONSTEXPR const int min_exponent = 0;
- static _LIBCPP_CONSTEXPR const int min_exponent10 = 0;
- static _LIBCPP_CONSTEXPR const int max_exponent = 0;
- static _LIBCPP_CONSTEXPR const int max_exponent10 = 0;
-
- static _LIBCPP_CONSTEXPR const bool has_infinity = false;
- static _LIBCPP_CONSTEXPR const bool has_quiet_NaN = false;
- static _LIBCPP_CONSTEXPR const bool has_signaling_NaN = false;
- static _LIBCPP_DEPRECATED_IN_CXX23 _LIBCPP_CONSTEXPR const float_denorm_style has_denorm = denorm_absent;
- static _LIBCPP_DEPRECATED_IN_CXX23 _LIBCPP_CONSTEXPR const bool has_denorm_loss = false;
- _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type infinity() _NOEXCEPT {return type();}
- _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type quiet_NaN() _NOEXCEPT {return type();}
- _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type signaling_NaN() _NOEXCEPT {return type();}
- _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type denorm_min() _NOEXCEPT {return type();}
-
- static _LIBCPP_CONSTEXPR const bool is_iec559 = false;
- static _LIBCPP_CONSTEXPR const bool is_bounded = false;
- static _LIBCPP_CONSTEXPR const bool is_modulo = false;
-
- static _LIBCPP_CONSTEXPR const bool traps = false;
- static _LIBCPP_CONSTEXPR const bool tinyness_before = false;
- static _LIBCPP_CONSTEXPR const float_round_style round_style = round_toward_zero;
+ typedef _Tp type;
+
+ static _LIBCPP_CONSTEXPR const bool is_specialized = false;
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type min() _NOEXCEPT { return type(); }
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type max() _NOEXCEPT { return type(); }
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type lowest() _NOEXCEPT { return type(); }
+
+ static _LIBCPP_CONSTEXPR const int digits = 0;
+ static _LIBCPP_CONSTEXPR const int digits10 = 0;
+ static _LIBCPP_CONSTEXPR const int max_digits10 = 0;
+ static _LIBCPP_CONSTEXPR const bool is_signed = false;
+ static _LIBCPP_CONSTEXPR const bool is_integer = false;
+ static _LIBCPP_CONSTEXPR const bool is_exact = false;
+ static _LIBCPP_CONSTEXPR const int radix = 0;
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type epsilon() _NOEXCEPT { return type(); }
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type round_error() _NOEXCEPT { return type(); }
+
+ static _LIBCPP_CONSTEXPR const int min_exponent = 0;
+ static _LIBCPP_CONSTEXPR const int min_exponent10 = 0;
+ static _LIBCPP_CONSTEXPR const int max_exponent = 0;
+ static _LIBCPP_CONSTEXPR const int max_exponent10 = 0;
+
+ static _LIBCPP_CONSTEXPR const bool has_infinity = false;
+ static _LIBCPP_CONSTEXPR const bool has_quiet_NaN = false;
+ static _LIBCPP_CONSTEXPR const bool has_signaling_NaN = false;
+ static _LIBCPP_DEPRECATED_IN_CXX23 _LIBCPP_CONSTEXPR const float_denorm_style has_denorm = denorm_absent;
+ static _LIBCPP_DEPRECATED_IN_CXX23 _LIBCPP_CONSTEXPR const bool has_denorm_loss = false;
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type infinity() _NOEXCEPT { return type(); }
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type quiet_NaN() _NOEXCEPT { return type(); }
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type signaling_NaN() _NOEXCEPT { return type(); }
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type denorm_min() _NOEXCEPT { return type(); }
+
+ static _LIBCPP_CONSTEXPR const bool is_iec559 = false;
+ static _LIBCPP_CONSTEXPR const bool is_bounded = false;
+ static _LIBCPP_CONSTEXPR const bool is_modulo = false;
+
+ static _LIBCPP_CONSTEXPR const bool traps = false;
+ static _LIBCPP_CONSTEXPR const bool tinyness_before = false;
+ static _LIBCPP_CONSTEXPR const float_round_style round_style = round_toward_zero;
};
template <class _Tp, int __digits, bool _IsSigned>
-struct __libcpp_compute_min
-{
- static _LIBCPP_CONSTEXPR const _Tp value = _Tp(_Tp(1) << __digits);
+struct __libcpp_compute_min {
+ static _LIBCPP_CONSTEXPR const _Tp value = _Tp(_Tp(1) << __digits);
};
template <class _Tp, int __digits>
-struct __libcpp_compute_min<_Tp, __digits, false>
-{
- static _LIBCPP_CONSTEXPR const _Tp value = _Tp(0);
+struct __libcpp_compute_min<_Tp, __digits, false> {
+ static _LIBCPP_CONSTEXPR const _Tp value = _Tp(0);
};
template <class _Tp>
-class __libcpp_numeric_limits<_Tp, true>
-{
+class __libcpp_numeric_limits<_Tp, true> {
protected:
- typedef _Tp type;
-
- static _LIBCPP_CONSTEXPR const bool is_specialized = true;
-
- static _LIBCPP_CONSTEXPR const bool is_signed = type(-1) < type(0);
- static _LIBCPP_CONSTEXPR const int digits = static_cast<int>(sizeof(type) * __CHAR_BIT__ - is_signed);
- static _LIBCPP_CONSTEXPR const int digits10 = digits * 3 / 10;
- static _LIBCPP_CONSTEXPR const int max_digits10 = 0;
- static _LIBCPP_CONSTEXPR const type __min = __libcpp_compute_min<type, digits, is_signed>::value;
- static _LIBCPP_CONSTEXPR const type __max = is_signed ? type(type(~0) ^ __min) : type(~0);
- _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type min() _NOEXCEPT {return __min;}
- _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type max() _NOEXCEPT {return __max;}
- _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type lowest() _NOEXCEPT {return min();}
-
- static _LIBCPP_CONSTEXPR const bool is_integer = true;
- static _LIBCPP_CONSTEXPR const bool is_exact = true;
- static _LIBCPP_CONSTEXPR const int radix = 2;
- _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type epsilon() _NOEXCEPT {return type(0);}
- _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type round_error() _NOEXCEPT {return type(0);}
-
- static _LIBCPP_CONSTEXPR const int min_exponent = 0;
- static _LIBCPP_CONSTEXPR const int min_exponent10 = 0;
- static _LIBCPP_CONSTEXPR const int max_exponent = 0;
- static _LIBCPP_CONSTEXPR const int max_exponent10 = 0;
-
- static _LIBCPP_CONSTEXPR const bool has_infinity = false;
- static _LIBCPP_CONSTEXPR const bool has_quiet_NaN = false;
- static _LIBCPP_CONSTEXPR const bool has_signaling_NaN = false;
- static _LIBCPP_DEPRECATED_IN_CXX23 _LIBCPP_CONSTEXPR const float_denorm_style has_denorm = denorm_absent;
- static _LIBCPP_DEPRECATED_IN_CXX23 _LIBCPP_CONSTEXPR const bool has_denorm_loss = false;
- _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type infinity() _NOEXCEPT {return type(0);}
- _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type quiet_NaN() _NOEXCEPT {return type(0);}
- _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type signaling_NaN() _NOEXCEPT {return type(0);}
- _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type denorm_min() _NOEXCEPT {return type(0);}
-
- static _LIBCPP_CONSTEXPR const bool is_iec559 = false;
- static _LIBCPP_CONSTEXPR const bool is_bounded = true;
- static _LIBCPP_CONSTEXPR const bool is_modulo = !std::is_signed<_Tp>::value;
-
-#if defined(__i386__) || defined(__x86_64__) || defined(__pnacl__) || \
- defined(__wasm__)
- static _LIBCPP_CONSTEXPR const bool traps = true;
+ typedef _Tp type;
+
+ static _LIBCPP_CONSTEXPR const bool is_specialized = true;
+
+ static _LIBCPP_CONSTEXPR const bool is_signed = type(-1) < type(0);
+ static _LIBCPP_CONSTEXPR const int digits = static_cast<int>(sizeof(type) * __CHAR_BIT__ - is_signed);
+ static _LIBCPP_CONSTEXPR const int digits10 = digits * 3 / 10;
+ static _LIBCPP_CONSTEXPR const int max_digits10 = 0;
+ static _LIBCPP_CONSTEXPR const type __min = __libcpp_compute_min<type, digits, is_signed>::value;
+ static _LIBCPP_CONSTEXPR const type __max = is_signed ? type(type(~0) ^ __min) : type(~0);
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type min() _NOEXCEPT { return __min; }
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type max() _NOEXCEPT { return __max; }
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type lowest() _NOEXCEPT { return min(); }
+
+ static _LIBCPP_CONSTEXPR const bool is_integer = true;
+ static _LIBCPP_CONSTEXPR const bool is_exact = true;
+ static _LIBCPP_CONSTEXPR const int radix = 2;
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type epsilon() _NOEXCEPT { return type(0); }
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type round_error() _NOEXCEPT { return type(0); }
+
+ static _LIBCPP_CONSTEXPR const int min_exponent = 0;
+ static _LIBCPP_CONSTEXPR const int min_exponent10 = 0;
+ static _LIBCPP_CONSTEXPR const int max_exponent = 0;
+ static _LIBCPP_CONSTEXPR const int max_exponent10 = 0;
+
+ static _LIBCPP_CONSTEXPR const bool has_infinity = false;
+ static _LIBCPP_CONSTEXPR const bool has_quiet_NaN = false;
+ static _LIBCPP_CONSTEXPR const bool has_signaling_NaN = false;
+ static _LIBCPP_DEPRECATED_IN_CXX23 _LIBCPP_CONSTEXPR const float_denorm_style has_denorm = denorm_absent;
+ static _LIBCPP_DEPRECATED_IN_CXX23 _LIBCPP_CONSTEXPR const bool has_denorm_loss = false;
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type infinity() _NOEXCEPT { return type(0); }
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type quiet_NaN() _NOEXCEPT { return type(0); }
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type signaling_NaN() _NOEXCEPT { return type(0); }
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type denorm_min() _NOEXCEPT { return type(0); }
+
+ static _LIBCPP_CONSTEXPR const bool is_iec559 = false;
+ static _LIBCPP_CONSTEXPR const bool is_bounded = true;
+ static _LIBCPP_CONSTEXPR const bool is_modulo = !std::is_signed<_Tp>::value;
+
+#if defined(__i386__) || defined(__x86_64__) || defined(__pnacl__) || defined(__wasm__)
+ static _LIBCPP_CONSTEXPR const bool traps = true;
#else
- static _LIBCPP_CONSTEXPR const bool traps = false;
+ static _LIBCPP_CONSTEXPR const bool traps = false;
#endif
- static _LIBCPP_CONSTEXPR const bool tinyness_before = false;
- static _LIBCPP_CONSTEXPR const float_round_style round_style = round_toward_zero;
+ static _LIBCPP_CONSTEXPR const bool tinyness_before = false;
+ static _LIBCPP_CONSTEXPR const float_round_style round_style = round_toward_zero;
};
template <>
-class __libcpp_numeric_limits<bool, true>
-{
+class __libcpp_numeric_limits<bool, true> {
protected:
- typedef bool type;
-
- static _LIBCPP_CONSTEXPR const bool is_specialized = true;
-
- static _LIBCPP_CONSTEXPR const bool is_signed = false;
- static _LIBCPP_CONSTEXPR const int digits = 1;
- static _LIBCPP_CONSTEXPR const int digits10 = 0;
- static _LIBCPP_CONSTEXPR const int max_digits10 = 0;
- static _LIBCPP_CONSTEXPR const type __min = false;
- static _LIBCPP_CONSTEXPR const type __max = true;
- _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type min() _NOEXCEPT {return __min;}
- _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type max() _NOEXCEPT {return __max;}
- _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type lowest() _NOEXCEPT {return min();}
-
- static _LIBCPP_CONSTEXPR const bool is_integer = true;
- static _LIBCPP_CONSTEXPR const bool is_exact = true;
- static _LIBCPP_CONSTEXPR const int radix = 2;
- _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type epsilon() _NOEXCEPT {return type(0);}
- _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type round_error() _NOEXCEPT {return type(0);}
-
- static _LIBCPP_CONSTEXPR const int min_exponent = 0;
- static _LIBCPP_CONSTEXPR const int min_exponent10 = 0;
- static _LIBCPP_CONSTEXPR const int max_exponent = 0;
- static _LIBCPP_CONSTEXPR const int max_exponent10 = 0;
-
- static _LIBCPP_CONSTEXPR const bool has_infinity = false;
- static _LIBCPP_CONSTEXPR const bool has_quiet_NaN = false;
- static _LIBCPP_CONSTEXPR const bool has_signaling_NaN = false;
- static _LIBCPP_DEPRECATED_IN_CXX23 _LIBCPP_CONSTEXPR const float_denorm_style has_denorm = denorm_absent;
- static _LIBCPP_DEPRECATED_IN_CXX23 _LIBCPP_CONSTEXPR const bool has_denorm_loss = false;
- _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type infinity() _NOEXCEPT {return type(0);}
- _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type quiet_NaN() _NOEXCEPT {return type(0);}
- _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type signaling_NaN() _NOEXCEPT {return type(0);}
- _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type denorm_min() _NOEXCEPT {return type(0);}
-
- static _LIBCPP_CONSTEXPR const bool is_iec559 = false;
- static _LIBCPP_CONSTEXPR const bool is_bounded = true;
- static _LIBCPP_CONSTEXPR const bool is_modulo = false;
-
- static _LIBCPP_CONSTEXPR const bool traps = false;
- static _LIBCPP_CONSTEXPR const bool tinyness_before = false;
- static _LIBCPP_CONSTEXPR const float_round_style round_style = round_toward_zero;
+ typedef bool type;
+
+ static _LIBCPP_CONSTEXPR const bool is_specialized = true;
+
+ static _LIBCPP_CONSTEXPR const bool is_signed = false;
+ static _LIBCPP_CONSTEXPR const int digits = 1;
+ static _LIBCPP_CONSTEXPR const int digits10 = 0;
+ static _LIBCPP_CONSTEXPR const int max_digits10 = 0;
+ static _LIBCPP_CONSTEXPR const type __min = false;
+ static _LIBCPP_CONSTEXPR const type __max = true;
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type min() _NOEXCEPT { return __min; }
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type max() _NOEXCEPT { return __max; }
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type lowest() _NOEXCEPT { return min(); }
+
+ static _LIBCPP_CONSTEXPR const bool is_integer = true;
+ static _LIBCPP_CONSTEXPR const bool is_exact = true;
+ static _LIBCPP_CONSTEXPR const int radix = 2;
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type epsilon() _NOEXCEPT { return type(0); }
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type round_error() _NOEXCEPT { return type(0); }
+
+ static _LIBCPP_CONSTEXPR const int min_exponent = 0;
+ static _LIBCPP_CONSTEXPR const int min_exponent10 = 0;
+ static _LIBCPP_CONSTEXPR const int max_exponent = 0;
+ static _LIBCPP_CONSTEXPR const int max_exponent10 = 0;
+
+ static _LIBCPP_CONSTEXPR const bool has_infinity = false;
+ static _LIBCPP_CONSTEXPR const bool has_quiet_NaN = false;
+ static _LIBCPP_CONSTEXPR const bool has_signaling_NaN = false;
+ static _LIBCPP_DEPRECATED_IN_CXX23 _LIBCPP_CONSTEXPR const float_denorm_style has_denorm = denorm_absent;
+ static _LIBCPP_DEPRECATED_IN_CXX23 _LIBCPP_CONSTEXPR const bool has_denorm_loss = false;
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type infinity() _NOEXCEPT { return type(0); }
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type quiet_NaN() _NOEXCEPT { return type(0); }
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type signaling_NaN() _NOEXCEPT { return type(0); }
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type denorm_min() _NOEXCEPT { return type(0); }
+
+ static _LIBCPP_CONSTEXPR const bool is_iec559 = false;
+ static _LIBCPP_CONSTEXPR const bool is_bounded = true;
+ static _LIBCPP_CONSTEXPR const bool is_modulo = false;
+
+ static _LIBCPP_CONSTEXPR const bool traps = false;
+ static _LIBCPP_CONSTEXPR const bool tinyness_before = false;
+ static _LIBCPP_CONSTEXPR const float_round_style round_style = round_toward_zero;
};
template <>
-class __libcpp_numeric_limits<float, true>
-{
+class __libcpp_numeric_limits<float, true> {
protected:
- typedef float type;
-
- static _LIBCPP_CONSTEXPR const bool is_specialized = true;
-
- static _LIBCPP_CONSTEXPR const bool is_signed = true;
- static _LIBCPP_CONSTEXPR const int digits = __FLT_MANT_DIG__;
- static _LIBCPP_CONSTEXPR const int digits10 = __FLT_DIG__;
- static _LIBCPP_CONSTEXPR const int max_digits10 = 2+(digits * 30103l)/100000l;
- _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type min() _NOEXCEPT {return __FLT_MIN__;}
- _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type max() _NOEXCEPT {return __FLT_MAX__;}
- _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type lowest() _NOEXCEPT {return -max();}
-
- static _LIBCPP_CONSTEXPR const bool is_integer = false;
- static _LIBCPP_CONSTEXPR const bool is_exact = false;
- static _LIBCPP_CONSTEXPR const int radix = __FLT_RADIX__;
- _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type epsilon() _NOEXCEPT {return __FLT_EPSILON__;}
- _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type round_error() _NOEXCEPT {return 0.5F;}
-
- static _LIBCPP_CONSTEXPR const int min_exponent = __FLT_MIN_EXP__;
- static _LIBCPP_CONSTEXPR const int min_exponent10 = __FLT_MIN_10_EXP__;
- static _LIBCPP_CONSTEXPR const int max_exponent = __FLT_MAX_EXP__;
- static _LIBCPP_CONSTEXPR const int max_exponent10 = __FLT_MAX_10_EXP__;
-
- static _LIBCPP_CONSTEXPR const bool has_infinity = true;
- static _LIBCPP_CONSTEXPR const bool has_quiet_NaN = true;
- static _LIBCPP_CONSTEXPR const bool has_signaling_NaN = true;
- static _LIBCPP_DEPRECATED_IN_CXX23 _LIBCPP_CONSTEXPR const float_denorm_style has_denorm = denorm_present;
- static _LIBCPP_DEPRECATED_IN_CXX23 _LIBCPP_CONSTEXPR const bool has_denorm_loss = false;
- _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type infinity() _NOEXCEPT {return __builtin_huge_valf();}
- _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type quiet_NaN() _NOEXCEPT {return __builtin_nanf("");}
- _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type signaling_NaN() _NOEXCEPT {return __builtin_nansf("");}
- _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type denorm_min() _NOEXCEPT {return __FLT_DENORM_MIN__;}
-
- static _LIBCPP_CONSTEXPR const bool is_iec559 = true;
- static _LIBCPP_CONSTEXPR const bool is_bounded = true;
- static _LIBCPP_CONSTEXPR const bool is_modulo = false;
-
- static _LIBCPP_CONSTEXPR const bool traps = false;
+ typedef float type;
+
+ static _LIBCPP_CONSTEXPR const bool is_specialized = true;
+
+ static _LIBCPP_CONSTEXPR const bool is_signed = true;
+ static _LIBCPP_CONSTEXPR const int digits = __FLT_MANT_DIG__;
+ static _LIBCPP_CONSTEXPR const int digits10 = __FLT_DIG__;
+ static _LIBCPP_CONSTEXPR const int max_digits10 = 2 + (digits * 30103l) / 100000l;
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type min() _NOEXCEPT { return __FLT_MIN__; }
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type max() _NOEXCEPT { return __FLT_MAX__; }
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type lowest() _NOEXCEPT { return -max(); }
+
+ static _LIBCPP_CONSTEXPR const bool is_integer = false;
+ static _LIBCPP_CONSTEXPR const bool is_exact = false;
+ static _LIBCPP_CONSTEXPR const int radix = __FLT_RADIX__;
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type epsilon() _NOEXCEPT { return __FLT_EPSILON__; }
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type round_error() _NOEXCEPT { return 0.5F; }
+
+ static _LIBCPP_CONSTEXPR const int min_exponent = __FLT_MIN_EXP__;
+ static _LIBCPP_CONSTEXPR const int min_exponent10 = __FLT_MIN_10_EXP__;
+ static _LIBCPP_CONSTEXPR const int max_exponent = __FLT_MAX_EXP__;
+ static _LIBCPP_CONSTEXPR const int max_exponent10 = __FLT_MAX_10_EXP__;
+
+ static _LIBCPP_CONSTEXPR const bool has_infinity = true;
+ static _LIBCPP_CONSTEXPR const bool has_quiet_NaN = true;
+ static _LIBCPP_CONSTEXPR const bool has_signaling_NaN = true;
+ static _LIBCPP_DEPRECATED_IN_CXX23 _LIBCPP_CONSTEXPR const float_denorm_style has_denorm = denorm_present;
+ static _LIBCPP_DEPRECATED_IN_CXX23 _LIBCPP_CONSTEXPR const bool has_denorm_loss = false;
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type infinity() _NOEXCEPT { return __builtin_huge_valf(); }
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type quiet_NaN() _NOEXCEPT { return __builtin_nanf(""); }
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type signaling_NaN() _NOEXCEPT { return __builtin_nansf(""); }
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type denorm_min() _NOEXCEPT { return __FLT_DENORM_MIN__; }
+
+ static _LIBCPP_CONSTEXPR const bool is_iec559 = true;
+ static _LIBCPP_CONSTEXPR const bool is_bounded = true;
+ static _LIBCPP_CONSTEXPR const bool is_modulo = false;
+
+ static _LIBCPP_CONSTEXPR const bool traps = false;
#if (defined(__arm__) || defined(__aarch64__))
- static _LIBCPP_CONSTEXPR const bool tinyness_before = true;
+ static _LIBCPP_CONSTEXPR const bool tinyness_before = true;
#else
- static _LIBCPP_CONSTEXPR const bool tinyness_before = false;
+ static _LIBCPP_CONSTEXPR const bool tinyness_before = false;
#endif
- static _LIBCPP_CONSTEXPR const float_round_style round_style = round_to_nearest;
+ static _LIBCPP_CONSTEXPR const float_round_style round_style = round_to_nearest;
};
template <>
-class __libcpp_numeric_limits<double, true>
-{
+class __libcpp_numeric_limits<double, true> {
protected:
- typedef double type;
-
- static _LIBCPP_CONSTEXPR const bool is_specialized = true;
-
- static _LIBCPP_CONSTEXPR const bool is_signed = true;
- static _LIBCPP_CONSTEXPR const int digits = __DBL_MANT_DIG__;
- static _LIBCPP_CONSTEXPR const int digits10 = __DBL_DIG__;
- static _LIBCPP_CONSTEXPR const int max_digits10 = 2+(digits * 30103l)/100000l;
- _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type min() _NOEXCEPT {return __DBL_MIN__;}
- _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type max() _NOEXCEPT {return __DBL_MAX__;}
- _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type lowest() _NOEXCEPT {return -max();}
-
- static _LIBCPP_CONSTEXPR const bool is_integer = false;
- static _LIBCPP_CONSTEXPR const bool is_exact = false;
- static _LIBCPP_CONSTEXPR const int radix = __FLT_RADIX__;
- _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type epsilon() _NOEXCEPT {return __DBL_EPSILON__;}
- _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type round_error() _NOEXCEPT {return 0.5;}
-
- static _LIBCPP_CONSTEXPR const int min_exponent = __DBL_MIN_EXP__;
- static _LIBCPP_CONSTEXPR const int min_exponent10 = __DBL_MIN_10_EXP__;
- static _LIBCPP_CONSTEXPR const int max_exponent = __DBL_MAX_EXP__;
- static _LIBCPP_CONSTEXPR const int max_exponent10 = __DBL_MAX_10_EXP__;
-
- static _LIBCPP_CONSTEXPR const bool has_infinity = true;
- static _LIBCPP_CONSTEXPR const bool has_quiet_NaN = true;
- static _LIBCPP_CONSTEXPR const bool has_signaling_NaN = true;
- static _LIBCPP_DEPRECATED_IN_CXX23 _LIBCPP_CONSTEXPR const float_denorm_style has_denorm = denorm_present;
- static _LIBCPP_DEPRECATED_IN_CXX23 _LIBCPP_CONSTEXPR const bool has_denorm_loss = false;
- _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type infinity() _NOEXCEPT {return __builtin_huge_val();}
- _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type quiet_NaN() _NOEXCEPT {return __builtin_nan("");}
- _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type signaling_NaN() _NOEXCEPT {return __builtin_nans("");}
- _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type denorm_min() _NOEXCEPT {return __DBL_DENORM_MIN__;}
-
- static _LIBCPP_CONSTEXPR const bool is_iec559 = true;
- static _LIBCPP_CONSTEXPR const bool is_bounded = true;
- static _LIBCPP_CONSTEXPR const bool is_modulo = false;
-
- static _LIBCPP_CONSTEXPR const bool traps = false;
+ typedef double type;
+
+ static _LIBCPP_CONSTEXPR const bool is_specialized = true;
+
+ static _LIBCPP_CONSTEXPR const bool is_signed = true;
+ static _LIBCPP_CONSTEXPR const int digits = __DBL_MANT_DIG__;
+ static _LIBCPP_CONSTEXPR const int digits10 = __DBL_DIG__;
+ static _LIBCPP_CONSTEXPR const int max_digits10 = 2 + (digits * 30103l) / 100000l;
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type min() _NOEXCEPT { return __DBL_MIN__; }
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type max() _NOEXCEPT { return __DBL_MAX__; }
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type lowest() _NOEXCEPT { return -max(); }
+
+ static _LIBCPP_CONSTEXPR const bool is_integer = false;
+ static _LIBCPP_CONSTEXPR const bool is_exact = false;
+ static _LIBCPP_CONSTEXPR const int radix = __FLT_RADIX__;
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type epsilon() _NOEXCEPT { return __DBL_EPSILON__; }
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type round_error() _NOEXCEPT { return 0.5; }
+
+ static _LIBCPP_CONSTEXPR const int min_exponent = __DBL_MIN_EXP__;
+ static _LIBCPP_CONSTEXPR const int min_exponent10 = __DBL_MIN_10_EXP__;
+ static _LIBCPP_CONSTEXPR const int max_exponent = __DBL_MAX_EXP__;
+ static _LIBCPP_CONSTEXPR const int max_exponent10 = __DBL_MAX_10_EXP__;
+
+ static _LIBCPP_CONSTEXPR const bool has_infinity = true;
+ static _LIBCPP_CONSTEXPR const bool has_quiet_NaN = true;
+ static _LIBCPP_CONSTEXPR const bool has_signaling_NaN = true;
+ static _LIBCPP_DEPRECATED_IN_CXX23 _LIBCPP_CONSTEXPR const float_denorm_style has_denorm = denorm_present;
+ static _LIBCPP_DEPRECATED_IN_CXX23 _LIBCPP_CONSTEXPR const bool has_denorm_loss = false;
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type infinity() _NOEXCEPT { return __builtin_huge_val(); }
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type quiet_NaN() _NOEXCEPT { return __builtin_nan(""); }
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type signaling_NaN() _NOEXCEPT { return __builtin_nans(""); }
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type denorm_min() _NOEXCEPT { return __DBL_DENORM_MIN__; }
+
+ static _LIBCPP_CONSTEXPR const bool is_iec559 = true;
+ static _LIBCPP_CONSTEXPR const bool is_bounded = true;
+ static _LIBCPP_CONSTEXPR const bool is_modulo = false;
+
+ static _LIBCPP_CONSTEXPR const bool traps = false;
#if (defined(__arm__) || defined(__aarch64__))
- static _LIBCPP_CONSTEXPR const bool tinyness_before = true;
+ static _LIBCPP_CONSTEXPR const bool tinyness_before = true;
#else
- static _LIBCPP_CONSTEXPR const bool tinyness_before = false;
+ static _LIBCPP_CONSTEXPR const bool tinyness_before = false;
#endif
- static _LIBCPP_CONSTEXPR const float_round_style round_style = round_to_nearest;
+ static _LIBCPP_CONSTEXPR const float_round_style round_style = round_to_nearest;
};
template <>
-class __libcpp_numeric_limits<long double, true>
-{
+class __libcpp_numeric_limits<long double, true> {
protected:
- typedef long double type;
-
- static _LIBCPP_CONSTEXPR const bool is_specialized = true;
-
- static _LIBCPP_CONSTEXPR const bool is_signed = true;
- static _LIBCPP_CONSTEXPR const int digits = __LDBL_MANT_DIG__;
- static _LIBCPP_CONSTEXPR const int digits10 = __LDBL_DIG__;
- static _LIBCPP_CONSTEXPR const int max_digits10 = 2+(digits * 30103l)/100000l;
- _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type min() _NOEXCEPT {return __LDBL_MIN__;}
- _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type max() _NOEXCEPT {return __LDBL_MAX__;}
- _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type lowest() _NOEXCEPT {return -max();}
-
- static _LIBCPP_CONSTEXPR const bool is_integer = false;
- static _LIBCPP_CONSTEXPR const bool is_exact = false;
- static _LIBCPP_CONSTEXPR const int radix = __FLT_RADIX__;
- _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type epsilon() _NOEXCEPT {return __LDBL_EPSILON__;}
- _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type round_error() _NOEXCEPT {return 0.5L;}
-
- static _LIBCPP_CONSTEXPR const int min_exponent = __LDBL_MIN_EXP__;
- static _LIBCPP_CONSTEXPR const int min_exponent10 = __LDBL_MIN_10_EXP__;
- static _LIBCPP_CONSTEXPR const int max_exponent = __LDBL_MAX_EXP__;
- static _LIBCPP_CONSTEXPR const int max_exponent10 = __LDBL_MAX_10_EXP__;
-
- static _LIBCPP_CONSTEXPR const bool has_infinity = true;
- static _LIBCPP_CONSTEXPR const bool has_quiet_NaN = true;
- static _LIBCPP_CONSTEXPR const bool has_signaling_NaN = true;
- static _LIBCPP_DEPRECATED_IN_CXX23 _LIBCPP_CONSTEXPR const float_denorm_style has_denorm = denorm_present;
- static _LIBCPP_DEPRECATED_IN_CXX23 _LIBCPP_CONSTEXPR const bool has_denorm_loss = false;
- _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type infinity() _NOEXCEPT {return __builtin_huge_vall();}
- _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type quiet_NaN() _NOEXCEPT {return __builtin_nanl("");}
- _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type signaling_NaN() _NOEXCEPT {return __builtin_nansl("");}
- _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type denorm_min() _NOEXCEPT {return __LDBL_DENORM_MIN__;}
+ typedef long double type;
+
+ static _LIBCPP_CONSTEXPR const bool is_specialized = true;
+
+ static _LIBCPP_CONSTEXPR const bool is_signed = true;
+ static _LIBCPP_CONSTEXPR const int digits = __LDBL_MANT_DIG__;
+ static _LIBCPP_CONSTEXPR const int digits10 = __LDBL_DIG__;
+ static _LIBCPP_CONSTEXPR const int max_digits10 = 2 + (digits * 30103l) / 100000l;
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type min() _NOEXCEPT { return __LDBL_MIN__; }
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type max() _NOEXCEPT { return __LDBL_MAX__; }
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type lowest() _NOEXCEPT { return -max(); }
+
+ static _LIBCPP_CONSTEXPR const bool is_integer = false;
+ static _LIBCPP_CONSTEXPR const bool is_exact = false;
+ static _LIBCPP_CONSTEXPR const int radix = __FLT_RADIX__;
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type epsilon() _NOEXCEPT { return __LDBL_EPSILON__; }
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type round_error() _NOEXCEPT { return 0.5L; }
+
+ static _LIBCPP_CONSTEXPR const int min_exponent = __LDBL_MIN_EXP__;
+ static _LIBCPP_CONSTEXPR const int min_exponent10 = __LDBL_MIN_10_EXP__;
+ static _LIBCPP_CONSTEXPR const int max_exponent = __LDBL_MAX_EXP__;
+ static _LIBCPP_CONSTEXPR const int max_exponent10 = __LDBL_MAX_10_EXP__;
+
+ static _LIBCPP_CONSTEXPR const bool has_infinity = true;
+ static _LIBCPP_CONSTEXPR const bool has_quiet_NaN = true;
+ static _LIBCPP_CONSTEXPR const bool has_signaling_NaN = true;
+ static _LIBCPP_DEPRECATED_IN_CXX23 _LIBCPP_CONSTEXPR const float_denorm_style has_denorm = denorm_present;
+ static _LIBCPP_DEPRECATED_IN_CXX23 _LIBCPP_CONSTEXPR const bool has_denorm_loss = false;
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type infinity() _NOEXCEPT { return __builtin_huge_vall(); }
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type quiet_NaN() _NOEXCEPT { return __builtin_nanl(""); }
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type signaling_NaN() _NOEXCEPT { return __builtin_nansl(""); }
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type denorm_min() _NOEXCEPT { return __LDBL_DENORM_MIN__; }
#if defined(__powerpc__) && defined(__LONG_DOUBLE_IBM128__)
- static _LIBCPP_CONSTEXPR const bool is_iec559 = false;
+ static _LIBCPP_CONSTEXPR const bool is_iec559 = false;
#else
- static _LIBCPP_CONSTEXPR const bool is_iec559 = true;
+ static _LIBCPP_CONSTEXPR const bool is_iec559 = true;
#endif
- static _LIBCPP_CONSTEXPR const bool is_bounded = true;
- static _LIBCPP_CONSTEXPR const bool is_modulo = false;
+ static _LIBCPP_CONSTEXPR const bool is_bounded = true;
+ static _LIBCPP_CONSTEXPR const bool is_modulo = false;
- static _LIBCPP_CONSTEXPR const bool traps = false;
+ static _LIBCPP_CONSTEXPR const bool traps = false;
#if (defined(__arm__) || defined(__aarch64__))
- static _LIBCPP_CONSTEXPR const bool tinyness_before = true;
+ static _LIBCPP_CONSTEXPR const bool tinyness_before = true;
#else
- static _LIBCPP_CONSTEXPR const bool tinyness_before = false;
+ static _LIBCPP_CONSTEXPR const bool tinyness_before = false;
#endif
- static _LIBCPP_CONSTEXPR const float_round_style round_style = round_to_nearest;
+ static _LIBCPP_CONSTEXPR const float_round_style round_style = round_to_nearest;
};
template <class _Tp>
-class _LIBCPP_TEMPLATE_VIS numeric_limits
- : private __libcpp_numeric_limits<__remove_cv_t<_Tp> >
-{
- typedef __libcpp_numeric_limits<__remove_cv_t<_Tp> > __base;
- typedef typename __base::type type;
+class _LIBCPP_TEMPLATE_VIS numeric_limits : private __libcpp_numeric_limits<__remove_cv_t<_Tp> > {
+ typedef __libcpp_numeric_limits<__remove_cv_t<_Tp> > __base;
+ typedef typename __base::type type;
+
public:
- static _LIBCPP_CONSTEXPR const bool is_specialized = __base::is_specialized;
- _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type min() _NOEXCEPT {return __base::min();}
- _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type max() _NOEXCEPT {return __base::max();}
- _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type lowest() _NOEXCEPT {return __base::lowest();}
-
- static _LIBCPP_CONSTEXPR const int digits = __base::digits;
- static _LIBCPP_CONSTEXPR const int digits10 = __base::digits10;
- static _LIBCPP_CONSTEXPR const int max_digits10 = __base::max_digits10;
- static _LIBCPP_CONSTEXPR const bool is_signed = __base::is_signed;
- static _LIBCPP_CONSTEXPR const bool is_integer = __base::is_integer;
- static _LIBCPP_CONSTEXPR const bool is_exact = __base::is_exact;
- static _LIBCPP_CONSTEXPR const int radix = __base::radix;
- _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type epsilon() _NOEXCEPT {return __base::epsilon();}
- _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type round_error() _NOEXCEPT {return __base::round_error();}
-
- static _LIBCPP_CONSTEXPR const int min_exponent = __base::min_exponent;
- static _LIBCPP_CONSTEXPR const int min_exponent10 = __base::min_exponent10;
- static _LIBCPP_CONSTEXPR const int max_exponent = __base::max_exponent;
- static _LIBCPP_CONSTEXPR const int max_exponent10 = __base::max_exponent10;
-
- static _LIBCPP_CONSTEXPR const bool has_infinity = __base::has_infinity;
- static _LIBCPP_CONSTEXPR const bool has_quiet_NaN = __base::has_quiet_NaN;
- static _LIBCPP_CONSTEXPR const bool has_signaling_NaN = __base::has_signaling_NaN;
-_LIBCPP_SUPPRESS_DEPRECATED_PUSH
- static _LIBCPP_DEPRECATED_IN_CXX23 _LIBCPP_CONSTEXPR const float_denorm_style has_denorm = __base::has_denorm;
- static _LIBCPP_DEPRECATED_IN_CXX23 _LIBCPP_CONSTEXPR const bool has_denorm_loss = __base::has_denorm_loss;
-_LIBCPP_SUPPRESS_DEPRECATED_POP
- _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type infinity() _NOEXCEPT {return __base::infinity();}
- _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type quiet_NaN() _NOEXCEPT {return __base::quiet_NaN();}
- _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type signaling_NaN() _NOEXCEPT {return __base::signaling_NaN();}
- _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type denorm_min() _NOEXCEPT {return __base::denorm_min();}
-
- static _LIBCPP_CONSTEXPR const bool is_iec559 = __base::is_iec559;
- static _LIBCPP_CONSTEXPR const bool is_bounded = __base::is_bounded;
- static _LIBCPP_CONSTEXPR const bool is_modulo = __base::is_modulo;
-
- static _LIBCPP_CONSTEXPR const bool traps = __base::traps;
- static _LIBCPP_CONSTEXPR const bool tinyness_before = __base::tinyness_before;
- static _LIBCPP_CONSTEXPR const float_round_style round_style = __base::round_style;
+ static _LIBCPP_CONSTEXPR const bool is_specialized = __base::is_specialized;
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type min() _NOEXCEPT { return __base::min(); }
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type max() _NOEXCEPT { return __base::max(); }
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type lowest() _NOEXCEPT { return __base::lowest(); }
+
+ static _LIBCPP_CONSTEXPR const int digits = __base::digits;
+ static _LIBCPP_CONSTEXPR const int digits10 = __base::digits10;
+ static _LIBCPP_CONSTEXPR const int max_digits10 = __base::max_digits10;
+ static _LIBCPP_CONSTEXPR const bool is_signed = __base::is_signed;
+ static _LIBCPP_CONSTEXPR const bool is_integer = __base::is_integer;
+ static _LIBCPP_CONSTEXPR const bool is_exact = __base::is_exact;
+ static _LIBCPP_CONSTEXPR const int radix = __base::radix;
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type epsilon() _NOEXCEPT { return __base::epsilon(); }
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type round_error() _NOEXCEPT { return __base::round_error(); }
+
+ static _LIBCPP_CONSTEXPR const int min_exponent = __base::min_exponent;
+ static _LIBCPP_CONSTEXPR const int min_exponent10 = __base::min_exponent10;
+ static _LIBCPP_CONSTEXPR const int max_exponent = __base::max_exponent;
+ static _LIBCPP_CONSTEXPR const int max_exponent10 = __base::max_exponent10;
+
+ static _LIBCPP_CONSTEXPR const bool has_infinity = __base::has_infinity;
+ static _LIBCPP_CONSTEXPR const bool has_quiet_NaN = __base::has_quiet_NaN;
+ static _LIBCPP_CONSTEXPR const bool has_signaling_NaN = __base::has_signaling_NaN;
+ _LIBCPP_SUPPRESS_DEPRECATED_PUSH
+ static _LIBCPP_DEPRECATED_IN_CXX23 _LIBCPP_CONSTEXPR const float_denorm_style has_denorm = __base::has_denorm;
+ static _LIBCPP_DEPRECATED_IN_CXX23 _LIBCPP_CONSTEXPR const bool has_denorm_loss = __base::has_denorm_loss;
+ _LIBCPP_SUPPRESS_DEPRECATED_POP
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type infinity() _NOEXCEPT { return __base::infinity(); }
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type quiet_NaN() _NOEXCEPT { return __base::quiet_NaN(); }
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type signaling_NaN() _NOEXCEPT { return __base::signaling_NaN(); }
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type denorm_min() _NOEXCEPT { return __base::denorm_min(); }
+
+ static _LIBCPP_CONSTEXPR const bool is_iec559 = __base::is_iec559;
+ static _LIBCPP_CONSTEXPR const bool is_bounded = __base::is_bounded;
+ static _LIBCPP_CONSTEXPR const bool is_modulo = __base::is_modulo;
+
+ static _LIBCPP_CONSTEXPR const bool traps = __base::traps;
+ static _LIBCPP_CONSTEXPR const bool tinyness_before = __base::tinyness_before;
+ static _LIBCPP_CONSTEXPR const float_round_style round_style = __base::round_style;
};
template <class _Tp>
- _LIBCPP_CONSTEXPR const bool numeric_limits<_Tp>::is_specialized;
+_LIBCPP_CONSTEXPR const bool numeric_limits<_Tp>::is_specialized;
template <class _Tp>
- _LIBCPP_CONSTEXPR const int numeric_limits<_Tp>::digits;
+_LIBCPP_CONSTEXPR const int numeric_limits<_Tp>::digits;
template <class _Tp>
- _LIBCPP_CONSTEXPR const int numeric_limits<_Tp>::digits10;
+_LIBCPP_CONSTEXPR const int numeric_limits<_Tp>::digits10;
template <class _Tp>
- _LIBCPP_CONSTEXPR const int numeric_limits<_Tp>::max_digits10;
+_LIBCPP_CONSTEXPR const int numeric_limits<_Tp>::max_digits10;
template <class _Tp>
- _LIBCPP_CONSTEXPR const bool numeric_limits<_Tp>::is_signed;
+_LIBCPP_CONSTEXPR const bool numeric_limits<_Tp>::is_signed;
template <class _Tp>
- _LIBCPP_CONSTEXPR const bool numeric_limits<_Tp>::is_integer;
+_LIBCPP_CONSTEXPR const bool numeric_limits<_Tp>::is_integer;
template <class _Tp>
- _LIBCPP_CONSTEXPR const bool numeric_limits<_Tp>::is_exact;
+_LIBCPP_CONSTEXPR const bool numeric_limits<_Tp>::is_exact;
template <class _Tp>
- _LIBCPP_CONSTEXPR const int numeric_limits<_Tp>::radix;
+_LIBCPP_CONSTEXPR const int numeric_limits<_Tp>::radix;
template <class _Tp>
- _LIBCPP_CONSTEXPR const int numeric_limits<_Tp>::min_exponent;
+_LIBCPP_CONSTEXPR const int numeric_limits<_Tp>::min_exponent;
template <class _Tp>
- _LIBCPP_CONSTEXPR const int numeric_limits<_Tp>::min_exponent10;
+_LIBCPP_CONSTEXPR const int numeric_limits<_Tp>::min_exponent10;
template <class _Tp>
- _LIBCPP_CONSTEXPR const int numeric_limits<_Tp>::max_exponent;
+_LIBCPP_CONSTEXPR const int numeric_limits<_Tp>::max_exponent;
template <class _Tp>
- _LIBCPP_CONSTEXPR const int numeric_limits<_Tp>::max_exponent10;
+_LIBCPP_CONSTEXPR const int numeric_limits<_Tp>::max_exponent10;
template <class _Tp>
- _LIBCPP_CONSTEXPR const bool numeric_limits<_Tp>::has_infinity;
+_LIBCPP_CONSTEXPR const bool numeric_limits<_Tp>::has_infinity;
template <class _Tp>
- _LIBCPP_CONSTEXPR const bool numeric_limits<_Tp>::has_quiet_NaN;
+_LIBCPP_CONSTEXPR const bool numeric_limits<_Tp>::has_quiet_NaN;
template <class _Tp>
- _LIBCPP_CONSTEXPR const bool numeric_limits<_Tp>::has_signaling_NaN;
+_LIBCPP_CONSTEXPR const bool numeric_limits<_Tp>::has_signaling_NaN;
template <class _Tp>
- _LIBCPP_CONSTEXPR const float_denorm_style numeric_limits<_Tp>::has_denorm;
+_LIBCPP_CONSTEXPR const float_denorm_style numeric_limits<_Tp>::has_denorm;
template <class _Tp>
- _LIBCPP_CONSTEXPR const bool numeric_limits<_Tp>::has_denorm_loss;
+_LIBCPP_CONSTEXPR const bool numeric_limits<_Tp>::has_denorm_loss;
template <class _Tp>
- _LIBCPP_CONSTEXPR const bool numeric_limits<_Tp>::is_iec559;
+_LIBCPP_CONSTEXPR const bool numeric_limits<_Tp>::is_iec559;
template <class _Tp>
- _LIBCPP_CONSTEXPR const bool numeric_limits<_Tp>::is_bounded;
+_LIBCPP_CONSTEXPR const bool numeric_limits<_Tp>::is_bounded;
template <class _Tp>
- _LIBCPP_CONSTEXPR const bool numeric_limits<_Tp>::is_modulo;
+_LIBCPP_CONSTEXPR const bool numeric_limits<_Tp>::is_modulo;
template <class _Tp>
- _LIBCPP_CONSTEXPR const bool numeric_limits<_Tp>::traps;
+_LIBCPP_CONSTEXPR const bool numeric_limits<_Tp>::traps;
template <class _Tp>
- _LIBCPP_CONSTEXPR const bool numeric_limits<_Tp>::tinyness_before;
+_LIBCPP_CONSTEXPR const bool numeric_limits<_Tp>::tinyness_before;
template <class _Tp>
- _LIBCPP_CONSTEXPR const float_round_style numeric_limits<_Tp>::round_style;
+_LIBCPP_CONSTEXPR const float_round_style numeric_limits<_Tp>::round_style;
template <class _Tp>
-class _LIBCPP_TEMPLATE_VIS numeric_limits<const _Tp>
- : private numeric_limits<_Tp>
-{
- typedef numeric_limits<_Tp> __base;
- typedef _Tp type;
+class _LIBCPP_TEMPLATE_VIS numeric_limits<const _Tp> : private numeric_limits<_Tp> {
+ typedef numeric_limits<_Tp> __base;
+ typedef _Tp type;
+
public:
- static _LIBCPP_CONSTEXPR const bool is_specialized = __base::is_specialized;
- _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type min() _NOEXCEPT {return __base::min();}
- _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type max() _NOEXCEPT {return __base::max();}
- _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type lowest() _NOEXCEPT {return __base::lowest();}
-
- static _LIBCPP_CONSTEXPR const int digits = __base::digits;
- static _LIBCPP_CONSTEXPR const int digits10 = __base::digits10;
- static _LIBCPP_CONSTEXPR const int max_digits10 = __base::max_digits10;
- static _LIBCPP_CONSTEXPR const bool is_signed = __base::is_signed;
- static _LIBCPP_CONSTEXPR const bool is_integer = __base::is_integer;
- static _LIBCPP_CONSTEXPR const bool is_exact = __base::is_exact;
- static _LIBCPP_CONSTEXPR const int radix = __base::radix;
- _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type epsilon() _NOEXCEPT {return __base::epsilon();}
- _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type round_error() _NOEXCEPT {return __base::round_error();}
-
- static _LIBCPP_CONSTEXPR const int min_exponent = __base::min_exponent;
- static _LIBCPP_CONSTEXPR const int min_exponent10 = __base::min_exponent10;
- static _LIBCPP_CONSTEXPR const int max_exponent = __base::max_exponent;
- static _LIBCPP_CONSTEXPR const int max_exponent10 = __base::max_exponent10;
-
- static _LIBCPP_CONSTEXPR const bool has_infinity = __base::has_infinity;
- static _LIBCPP_CONSTEXPR const bool has_quiet_NaN = __base::has_quiet_NaN;
- static _LIBCPP_CONSTEXPR const bool has_signaling_NaN = __base::has_signaling_NaN;
-_LIBCPP_SUPPRESS_DEPRECATED_PUSH
- static _LIBCPP_DEPRECATED_IN_CXX23 _LIBCPP_CONSTEXPR const float_denorm_style has_denorm = __base::has_denorm;
- static _LIBCPP_DEPRECATED_IN_CXX23 _LIBCPP_CONSTEXPR const bool has_denorm_loss = __base::has_denorm_loss;
-_LIBCPP_SUPPRESS_DEPRECATED_POP
- _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type infinity() _NOEXCEPT {return __base::infinity();}
- _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type quiet_NaN() _NOEXCEPT {return __base::quiet_NaN();}
- _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type signaling_NaN() _NOEXCEPT {return __base::signaling_NaN();}
- _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type denorm_min() _NOEXCEPT {return __base::denorm_min();}
-
- static _LIBCPP_CONSTEXPR const bool is_iec559 = __base::is_iec559;
- static _LIBCPP_CONSTEXPR const bool is_bounded = __base::is_bounded;
- static _LIBCPP_CONSTEXPR const bool is_modulo = __base::is_modulo;
-
- static _LIBCPP_CONSTEXPR const bool traps = __base::traps;
- static _LIBCPP_CONSTEXPR const bool tinyness_before = __base::tinyness_before;
- static _LIBCPP_CONSTEXPR const float_round_style round_style = __base::round_style;
+ static _LIBCPP_CONSTEXPR const bool is_specialized = __base::is_specialized;
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type min() _NOEXCEPT { return __base::min(); }
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type max() _NOEXCEPT { return __base::max(); }
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type lowest() _NOEXCEPT { return __base::lowest(); }
+
+ static _LIBCPP_CONSTEXPR const int digits = __base::digits;
+ static _LIBCPP_CONSTEXPR const int digits10 = __base::digits10;
+ static _LIBCPP_CONSTEXPR const int max_digits10 = __base::max_digits10;
+ static _LIBCPP_CONSTEXPR const bool is_signed = __base::is_signed;
+ static _LIBCPP_CONSTEXPR const bool is_integer = __base::is_integer;
+ static _LIBCPP_CONSTEXPR const bool is_exact = __base::is_exact;
+ static _LIBCPP_CONSTEXPR const int radix = __base::radix;
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type epsilon() _NOEXCEPT { return __base::epsilon(); }
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type round_error() _NOEXCEPT { return __base::round_error(); }
+
+ static _LIBCPP_CONSTEXPR const int min_exponent = __base::min_exponent;
+ static _LIBCPP_CONSTEXPR const int min_exponent10 = __base::min_exponent10;
+ static _LIBCPP_CONSTEXPR const int max_exponent = __base::max_exponent;
+ static _LIBCPP_CONSTEXPR const int max_exponent10 = __base::max_exponent10;
+
+ static _LIBCPP_CONSTEXPR const bool has_infinity = __base::has_infinity;
+ static _LIBCPP_CONSTEXPR const bool has_quiet_NaN = __base::has_quiet_NaN;
+ static _LIBCPP_CONSTEXPR const bool has_signaling_NaN = __base::has_signaling_NaN;
+ _LIBCPP_SUPPRESS_DEPRECATED_PUSH
+ static _LIBCPP_DEPRECATED_IN_CXX23 _LIBCPP_CONSTEXPR const float_denorm_style has_denorm = __base::has_denorm;
+ static _LIBCPP_DEPRECATED_IN_CXX23 _LIBCPP_CONSTEXPR const bool has_denorm_loss = __base::has_denorm_loss;
+ _LIBCPP_SUPPRESS_DEPRECATED_POP
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type infinity() _NOEXCEPT { return __base::infinity(); }
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type quiet_NaN() _NOEXCEPT { return __base::quiet_NaN(); }
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type signaling_NaN() _NOEXCEPT { return __base::signaling_NaN(); }
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type denorm_min() _NOEXCEPT { return __base::denorm_min(); }
+
+ static _LIBCPP_CONSTEXPR const bool is_iec559 = __base::is_iec559;
+ static _LIBCPP_CONSTEXPR const bool is_bounded = __base::is_bounded;
+ static _LIBCPP_CONSTEXPR const bool is_modulo = __base::is_modulo;
+
+ static _LIBCPP_CONSTEXPR const bool traps = __base::traps;
+ static _LIBCPP_CONSTEXPR const bool tinyness_before = __base::tinyness_before;
+ static _LIBCPP_CONSTEXPR const float_round_style round_style = __base::round_style;
};
template <class _Tp>
- _LIBCPP_CONSTEXPR const bool numeric_limits<const _Tp>::is_specialized;
+_LIBCPP_CONSTEXPR const bool numeric_limits<const _Tp>::is_specialized;
template <class _Tp>
- _LIBCPP_CONSTEXPR const int numeric_limits<const _Tp>::digits;
+_LIBCPP_CONSTEXPR const int numeric_limits<const _Tp>::digits;
template <class _Tp>
- _LIBCPP_CONSTEXPR const int numeric_limits<const _Tp>::digits10;
+_LIBCPP_CONSTEXPR const int numeric_limits<const _Tp>::digits10;
template <class _Tp>
- _LIBCPP_CONSTEXPR const int numeric_limits<const _Tp>::max_digits10;
+_LIBCPP_CONSTEXPR const int numeric_limits<const _Tp>::max_digits10;
template <class _Tp>
- _LIBCPP_CONSTEXPR const bool numeric_limits<const _Tp>::is_signed;
+_LIBCPP_CONSTEXPR const bool numeric_limits<const _Tp>::is_signed;
template <class _Tp>
- _LIBCPP_CONSTEXPR const bool numeric_limits<const _Tp>::is_integer;
+_LIBCPP_CONSTEXPR const bool numeric_limits<const _Tp>::is_integer;
template <class _Tp>
- _LIBCPP_CONSTEXPR const bool numeric_limits<const _Tp>::is_exact;
+_LIBCPP_CONSTEXPR const bool numeric_limits<const _Tp>::is_exact;
template <class _Tp>
- _LIBCPP_CONSTEXPR const int numeric_limits<const _Tp>::radix;
+_LIBCPP_CONSTEXPR const int numeric_limits<const _Tp>::radix;
template <class _Tp>
- _LIBCPP_CONSTEXPR const int numeric_limits<const _Tp>::min_exponent;
+_LIBCPP_CONSTEXPR const int numeric_limits<const _Tp>::min_exponent;
template <class _Tp>
- _LIBCPP_CONSTEXPR const int numeric_limits<const _Tp>::min_exponent10;
+_LIBCPP_CONSTEXPR const int numeric_limits<const _Tp>::min_exponent10;
template <class _Tp>
- _LIBCPP_CONSTEXPR const int numeric_limits<const _Tp>::max_exponent;
+_LIBCPP_CONSTEXPR const int numeric_limits<const _Tp>::max_exponent;
template <class _Tp>
- _LIBCPP_CONSTEXPR const int numeric_limits<const _Tp>::max_exponent10;
+_LIBCPP_CONSTEXPR const int numeric_limits<const _Tp>::max_exponent10;
template <class _Tp>
- _LIBCPP_CONSTEXPR const bool numeric_limits<const _Tp>::has_infinity;
+_LIBCPP_CONSTEXPR const bool numeric_limits<const _Tp>::has_infinity;
template <class _Tp>
- _LIBCPP_CONSTEXPR const bool numeric_limits<const _Tp>::has_quiet_NaN;
+_LIBCPP_CONSTEXPR const bool numeric_limits<const _Tp>::has_quiet_NaN;
template <class _Tp>
- _LIBCPP_CONSTEXPR const bool numeric_limits<const _Tp>::has_signaling_NaN;
+_LIBCPP_CONSTEXPR const bool numeric_limits<const _Tp>::has_signaling_NaN;
template <class _Tp>
- _LIBCPP_CONSTEXPR const float_denorm_style numeric_limits<const _Tp>::has_denorm;
+_LIBCPP_CONSTEXPR const float_denorm_style numeric_limits<const _Tp>::has_denorm;
template <class _Tp>
- _LIBCPP_CONSTEXPR const bool numeric_limits<const _Tp>::has_denorm_loss;
+_LIBCPP_CONSTEXPR const bool numeric_limits<const _Tp>::has_denorm_loss;
template <class _Tp>
- _LIBCPP_CONSTEXPR const bool numeric_limits<const _Tp>::is_iec559;
+_LIBCPP_CONSTEXPR const bool numeric_limits<const _Tp>::is_iec559;
template <class _Tp>
- _LIBCPP_CONSTEXPR const bool numeric_limits<const _Tp>::is_bounded;
+_LIBCPP_CONSTEXPR const bool numeric_limits<const _Tp>::is_bounded;
template <class _Tp>
- _LIBCPP_CONSTEXPR const bool numeric_limits<const _Tp>::is_modulo;
+_LIBCPP_CONSTEXPR const bool numeric_limits<const _Tp>::is_modulo;
template <class _Tp>
- _LIBCPP_CONSTEXPR const bool numeric_limits<const _Tp>::traps;
+_LIBCPP_CONSTEXPR const bool numeric_limits<const _Tp>::traps;
template <class _Tp>
- _LIBCPP_CONSTEXPR const bool numeric_limits<const _Tp>::tinyness_before;
+_LIBCPP_CONSTEXPR const bool numeric_limits<const _Tp>::tinyness_before;
template <class _Tp>
- _LIBCPP_CONSTEXPR const float_round_style numeric_limits<const _Tp>::round_style;
+_LIBCPP_CONSTEXPR const float_round_style numeric_limits<const _Tp>::round_style;
template <class _Tp>
-class _LIBCPP_TEMPLATE_VIS numeric_limits<volatile _Tp>
- : private numeric_limits<_Tp>
-{
- typedef numeric_limits<_Tp> __base;
- typedef _Tp type;
+class _LIBCPP_TEMPLATE_VIS numeric_limits<volatile _Tp> : private numeric_limits<_Tp> {
+ typedef numeric_limits<_Tp> __base;
+ typedef _Tp type;
+
public:
- static _LIBCPP_CONSTEXPR const bool is_specialized = __base::is_specialized;
- _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type min() _NOEXCEPT {return __base::min();}
- _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type max() _NOEXCEPT {return __base::max();}
- _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type lowest() _NOEXCEPT {return __base::lowest();}
-
- static _LIBCPP_CONSTEXPR const int digits = __base::digits;
- static _LIBCPP_CONSTEXPR const int digits10 = __base::digits10;
- static _LIBCPP_CONSTEXPR const int max_digits10 = __base::max_digits10;
- static _LIBCPP_CONSTEXPR const bool is_signed = __base::is_signed;
- static _LIBCPP_CONSTEXPR const bool is_integer = __base::is_integer;
- static _LIBCPP_CONSTEXPR const bool is_exact = __base::is_exact;
- static _LIBCPP_CONSTEXPR const int radix = __base::radix;
- _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type epsilon() _NOEXCEPT {return __base::epsilon();}
- _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type round_error() _NOEXCEPT {return __base::round_error();}
-
- static _LIBCPP_CONSTEXPR const int min_exponent = __base::min_exponent;
- static _LIBCPP_CONSTEXPR const int min_exponent10 = __base::min_exponent10;
- static _LIBCPP_CONSTEXPR const int max_exponent = __base::max_exponent;
- static _LIBCPP_CONSTEXPR const int max_exponent10 = __base::max_exponent10;
-
- static _LIBCPP_CONSTEXPR const bool has_infinity = __base::has_infinity;
- static _LIBCPP_CONSTEXPR const bool has_quiet_NaN = __base::has_quiet_NaN;
- static _LIBCPP_CONSTEXPR const bool has_signaling_NaN = __base::has_signaling_NaN;
-_LIBCPP_SUPPRESS_DEPRECATED_PUSH
- static _LIBCPP_DEPRECATED_IN_CXX23 _LIBCPP_CONSTEXPR const float_denorm_style has_denorm = __base::has_denorm;
- static _LIBCPP_DEPRECATED_IN_CXX23 _LIBCPP_CONSTEXPR const bool has_denorm_loss = __base::has_denorm_loss;
-_LIBCPP_SUPPRESS_DEPRECATED_POP
- _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type infinity() _NOEXCEPT {return __base::infinity();}
- _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type quiet_NaN() _NOEXCEPT {return __base::quiet_NaN();}
- _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type signaling_NaN() _NOEXCEPT {return __base::signaling_NaN();}
- _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type denorm_min() _NOEXCEPT {return __base::denorm_min();}
-
- static _LIBCPP_CONSTEXPR const bool is_iec559 = __base::is_iec559;
- static _LIBCPP_CONSTEXPR const bool is_bounded = __base::is_bounded;
- static _LIBCPP_CONSTEXPR const bool is_modulo = __base::is_modulo;
-
- static _LIBCPP_CONSTEXPR const bool traps = __base::traps;
- static _LIBCPP_CONSTEXPR const bool tinyness_before = __base::tinyness_before;
- static _LIBCPP_CONSTEXPR const float_round_style round_style = __base::round_style;
+ static _LIBCPP_CONSTEXPR const bool is_specialized = __base::is_specialized;
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type min() _NOEXCEPT { return __base::min(); }
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type max() _NOEXCEPT { return __base::max(); }
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type lowest() _NOEXCEPT { return __base::lowest(); }
+
+ static _LIBCPP_CONSTEXPR const int digits = __base::digits;
+ static _LIBCPP_CONSTEXPR const int digits10 = __base::digits10;
+ static _LIBCPP_CONSTEXPR const int max_digits10 = __base::max_digits10;
+ static _LIBCPP_CONSTEXPR const bool is_signed = __base::is_signed;
+ static _LIBCPP_CONSTEXPR const bool is_integer = __base::is_integer;
+ static _LIBCPP_CONSTEXPR const bool is_exact = __base::is_exact;
+ static _LIBCPP_CONSTEXPR const int radix = __base::radix;
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type epsilon() _NOEXCEPT { return __base::epsilon(); }
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type round_error() _NOEXCEPT { return __base::round_error(); }
+
+ static _LIBCPP_CONSTEXPR const int min_exponent = __base::min_exponent;
+ static _LIBCPP_CONSTEXPR const int min_exponent10 = __base::min_exponent10;
+ static _LIBCPP_CONSTEXPR const int max_exponent = __base::max_exponent;
+ static _LIBCPP_CONSTEXPR const int max_exponent10 = __base::max_exponent10;
+
+ static _LIBCPP_CONSTEXPR const bool has_infinity = __base::has_infinity;
+ static _LIBCPP_CONSTEXPR const bool has_quiet_NaN = __base::has_quiet_NaN;
+ static _LIBCPP_CONSTEXPR const bool has_signaling_NaN = __base::has_signaling_NaN;
+ _LIBCPP_SUPPRESS_DEPRECATED_PUSH
+ static _LIBCPP_DEPRECATED_IN_CXX23 _LIBCPP_CONSTEXPR const float_denorm_style has_denorm = __base::has_denorm;
+ static _LIBCPP_DEPRECATED_IN_CXX23 _LIBCPP_CONSTEXPR const bool has_denorm_loss = __base::has_denorm_loss;
+ _LIBCPP_SUPPRESS_DEPRECATED_POP
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type infinity() _NOEXCEPT { return __base::infinity(); }
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type quiet_NaN() _NOEXCEPT { return __base::quiet_NaN(); }
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type signaling_NaN() _NOEXCEPT { return __base::signaling_NaN(); }
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type denorm_min() _NOEXCEPT { return __base::denorm_min(); }
+
+ static _LIBCPP_CONSTEXPR const bool is_iec559 = __base::is_iec559;
+ static _LIBCPP_CONSTEXPR const bool is_bounded = __base::is_bounded;
+ static _LIBCPP_CONSTEXPR const bool is_modulo = __base::is_modulo;
+
+ static _LIBCPP_CONSTEXPR const bool traps = __base::traps;
+ static _LIBCPP_CONSTEXPR const bool tinyness_before = __base::tinyness_before;
+ static _LIBCPP_CONSTEXPR const float_round_style round_style = __base::round_style;
};
template <class _Tp>
- _LIBCPP_CONSTEXPR const bool numeric_limits<volatile _Tp>::is_specialized;
+_LIBCPP_CONSTEXPR const bool numeric_limits<volatile _Tp>::is_specialized;
template <class _Tp>
- _LIBCPP_CONSTEXPR const int numeric_limits<volatile _Tp>::digits;
+_LIBCPP_CONSTEXPR const int numeric_limits<volatile _Tp>::digits;
template <class _Tp>
- _LIBCPP_CONSTEXPR const int numeric_limits<volatile _Tp>::digits10;
+_LIBCPP_CONSTEXPR const int numeric_limits<volatile _Tp>::digits10;
template <class _Tp>
- _LIBCPP_CONSTEXPR const int numeric_limits<volatile _Tp>::max_digits10;
+_LIBCPP_CONSTEXPR const int numeric_limits<volatile _Tp>::max_digits10;
template <class _Tp>
- _LIBCPP_CONSTEXPR const bool numeric_limits<volatile _Tp>::is_signed;
+_LIBCPP_CONSTEXPR const bool numeric_limits<volatile _Tp>::is_signed;
template <class _Tp>
- _LIBCPP_CONSTEXPR const bool numeric_limits<volatile _Tp>::is_integer;
+_LIBCPP_CONSTEXPR const bool numeric_limits<volatile _Tp>::is_integer;
template <class _Tp>
- _LIBCPP_CONSTEXPR const bool numeric_limits<volatile _Tp>::is_exact;
+_LIBCPP_CONSTEXPR const bool numeric_limits<volatile _Tp>::is_exact;
template <class _Tp>
- _LIBCPP_CONSTEXPR const int numeric_limits<volatile _Tp>::radix;
+_LIBCPP_CONSTEXPR const int numeric_limits<volatile _Tp>::radix;
template <class _Tp>
- _LIBCPP_CONSTEXPR const int numeric_limits<volatile _Tp>::min_exponent;
+_LIBCPP_CONSTEXPR const int numeric_limits<volatile _Tp>::min_exponent;
template <class _Tp>
- _LIBCPP_CONSTEXPR const int numeric_limits<volatile _Tp>::min_exponent10;
+_LIBCPP_CONSTEXPR const int numeric_limits<volatile _Tp>::min_exponent10;
template <class _Tp>
- _LIBCPP_CONSTEXPR const int numeric_limits<volatile _Tp>::max_exponent;
+_LIBCPP_CONSTEXPR const int numeric_limits<volatile _Tp>::max_exponent;
template <class _Tp>
- _LIBCPP_CONSTEXPR const int numeric_limits<volatile _Tp>::max_exponent10;
+_LIBCPP_CONSTEXPR const int numeric_limits<volatile _Tp>::max_exponent10;
template <class _Tp>
- _LIBCPP_CONSTEXPR const bool numeric_limits<volatile _Tp>::has_infinity;
+_LIBCPP_CONSTEXPR const bool numeric_limits<volatile _Tp>::has_infinity;
template <class _Tp>
- _LIBCPP_CONSTEXPR const bool numeric_limits<volatile _Tp>::has_quiet_NaN;
+_LIBCPP_CONSTEXPR const bool numeric_limits<volatile _Tp>::has_quiet_NaN;
template <class _Tp>
- _LIBCPP_CONSTEXPR const bool numeric_limits<volatile _Tp>::has_signaling_NaN;
+_LIBCPP_CONSTEXPR const bool numeric_limits<volatile _Tp>::has_signaling_NaN;
template <class _Tp>
- _LIBCPP_CONSTEXPR const float_denorm_style numeric_limits<volatile _Tp>::has_denorm;
+_LIBCPP_CONSTEXPR const float_denorm_style numeric_limits<volatile _Tp>::has_denorm;
template <class _Tp>
- _LIBCPP_CONSTEXPR const bool numeric_limits<volatile _Tp>::has_denorm_loss;
+_LIBCPP_CONSTEXPR const bool numeric_limits<volatile _Tp>::has_denorm_loss;
template <class _Tp>
- _LIBCPP_CONSTEXPR const bool numeric_limits<volatile _Tp>::is_iec559;
+_LIBCPP_CONSTEXPR const bool numeric_limits<volatile _Tp>::is_iec559;
template <class _Tp>
- _LIBCPP_CONSTEXPR const bool numeric_limits<volatile _Tp>::is_bounded;
+_LIBCPP_CONSTEXPR const bool numeric_limits<volatile _Tp>::is_bounded;
template <class _Tp>
- _LIBCPP_CONSTEXPR const bool numeric_limits<volatile _Tp>::is_modulo;
+_LIBCPP_CONSTEXPR const bool numeric_limits<volatile _Tp>::is_modulo;
template <class _Tp>
- _LIBCPP_CONSTEXPR const bool numeric_limits<volatile _Tp>::traps;
+_LIBCPP_CONSTEXPR const bool numeric_limits<volatile _Tp>::traps;
template <class _Tp>
- _LIBCPP_CONSTEXPR const bool numeric_limits<volatile _Tp>::tinyness_before;
+_LIBCPP_CONSTEXPR const bool numeric_limits<volatile _Tp>::tinyness_before;
template <class _Tp>
- _LIBCPP_CONSTEXPR const float_round_style numeric_limits<volatile _Tp>::round_style;
+_LIBCPP_CONSTEXPR const float_round_style numeric_limits<volatile _Tp>::round_style;
template <class _Tp>
-class _LIBCPP_TEMPLATE_VIS numeric_limits<const volatile _Tp>
- : private numeric_limits<_Tp>
-{
- typedef numeric_limits<_Tp> __base;
- typedef _Tp type;
+class _LIBCPP_TEMPLATE_VIS numeric_limits<const volatile _Tp> : private numeric_limits<_Tp> {
+ typedef numeric_limits<_Tp> __base;
+ typedef _Tp type;
+
public:
- static _LIBCPP_CONSTEXPR const bool is_specialized = __base::is_specialized;
- _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type min() _NOEXCEPT {return __base::min();}
- _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type max() _NOEXCEPT {return __base::max();}
- _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type lowest() _NOEXCEPT {return __base::lowest();}
-
- static _LIBCPP_CONSTEXPR const int digits = __base::digits;
- static _LIBCPP_CONSTEXPR const int digits10 = __base::digits10;
- static _LIBCPP_CONSTEXPR const int max_digits10 = __base::max_digits10;
- static _LIBCPP_CONSTEXPR const bool is_signed = __base::is_signed;
- static _LIBCPP_CONSTEXPR const bool is_integer = __base::is_integer;
- static _LIBCPP_CONSTEXPR const bool is_exact = __base::is_exact;
- static _LIBCPP_CONSTEXPR const int radix = __base::radix;
- _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type epsilon() _NOEXCEPT {return __base::epsilon();}
- _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type round_error() _NOEXCEPT {return __base::round_error();}
-
- static _LIBCPP_CONSTEXPR const int min_exponent = __base::min_exponent;
- static _LIBCPP_CONSTEXPR const int min_exponent10 = __base::min_exponent10;
- static _LIBCPP_CONSTEXPR const int max_exponent = __base::max_exponent;
- static _LIBCPP_CONSTEXPR const int max_exponent10 = __base::max_exponent10;
-
- static _LIBCPP_CONSTEXPR const bool has_infinity = __base::has_infinity;
- static _LIBCPP_CONSTEXPR const bool has_quiet_NaN = __base::has_quiet_NaN;
- static _LIBCPP_CONSTEXPR const bool has_signaling_NaN = __base::has_signaling_NaN;
-_LIBCPP_SUPPRESS_DEPRECATED_PUSH
- static _LIBCPP_DEPRECATED_IN_CXX23 _LIBCPP_CONSTEXPR const float_denorm_style has_denorm = __base::has_denorm;
- static _LIBCPP_DEPRECATED_IN_CXX23 _LIBCPP_CONSTEXPR const bool has_denorm_loss = __base::has_denorm_loss;
-_LIBCPP_SUPPRESS_DEPRECATED_POP
- _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type infinity() _NOEXCEPT {return __base::infinity();}
- _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type quiet_NaN() _NOEXCEPT {return __base::quiet_NaN();}
- _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type signaling_NaN() _NOEXCEPT {return __base::signaling_NaN();}
- _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type denorm_min() _NOEXCEPT {return __base::denorm_min();}
-
- static _LIBCPP_CONSTEXPR const bool is_iec559 = __base::is_iec559;
- static _LIBCPP_CONSTEXPR const bool is_bounded = __base::is_bounded;
- static _LIBCPP_CONSTEXPR const bool is_modulo = __base::is_modulo;
-
- static _LIBCPP_CONSTEXPR const bool traps = __base::traps;
- static _LIBCPP_CONSTEXPR const bool tinyness_before = __base::tinyness_before;
- static _LIBCPP_CONSTEXPR const float_round_style round_style = __base::round_style;
+ static _LIBCPP_CONSTEXPR const bool is_specialized = __base::is_specialized;
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type min() _NOEXCEPT { return __base::min(); }
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type max() _NOEXCEPT { return __base::max(); }
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type lowest() _NOEXCEPT { return __base::lowest(); }
+
+ static _LIBCPP_CONSTEXPR const int digits = __base::digits;
+ static _LIBCPP_CONSTEXPR const int digits10 = __base::digits10;
+ static _LIBCPP_CONSTEXPR const int max_digits10 = __base::max_digits10;
+ static _LIBCPP_CONSTEXPR const bool is_signed = __base::is_signed;
+ static _LIBCPP_CONSTEXPR const bool is_integer = __base::is_integer;
+ static _LIBCPP_CONSTEXPR const bool is_exact = __base::is_exact;
+ static _LIBCPP_CONSTEXPR const int radix = __base::radix;
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type epsilon() _NOEXCEPT { return __base::epsilon(); }
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type round_error() _NOEXCEPT { return __base::round_error(); }
+
+ static _LIBCPP_CONSTEXPR const int min_exponent = __base::min_exponent;
+ static _LIBCPP_CONSTEXPR const int min_exponent10 = __base::min_exponent10;
+ static _LIBCPP_CONSTEXPR const int max_exponent = __base::max_exponent;
+ static _LIBCPP_CONSTEXPR const int max_exponent10 = __base::max_exponent10;
+
+ static _LIBCPP_CONSTEXPR const bool has_infinity = __base::has_infinity;
+ static _LIBCPP_CONSTEXPR const bool has_quiet_NaN = __base::has_quiet_NaN;
+ static _LIBCPP_CONSTEXPR const bool has_signaling_NaN = __base::has_signaling_NaN;
+ _LIBCPP_SUPPRESS_DEPRECATED_PUSH
+ static _LIBCPP_DEPRECATED_IN_CXX23 _LIBCPP_CONSTEXPR const float_denorm_style has_denorm = __base::has_denorm;
+ static _LIBCPP_DEPRECATED_IN_CXX23 _LIBCPP_CONSTEXPR const bool has_denorm_loss = __base::has_denorm_loss;
+ _LIBCPP_SUPPRESS_DEPRECATED_POP
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type infinity() _NOEXCEPT { return __base::infinity(); }
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type quiet_NaN() _NOEXCEPT { return __base::quiet_NaN(); }
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type signaling_NaN() _NOEXCEPT { return __base::signaling_NaN(); }
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type denorm_min() _NOEXCEPT { return __base::denorm_min(); }
+
+ static _LIBCPP_CONSTEXPR const bool is_iec559 = __base::is_iec559;
+ static _LIBCPP_CONSTEXPR const bool is_bounded = __base::is_bounded;
+ static _LIBCPP_CONSTEXPR const bool is_modulo = __base::is_modulo;
+
+ static _LIBCPP_CONSTEXPR const bool traps = __base::traps;
+ static _LIBCPP_CONSTEXPR const bool tinyness_before = __base::tinyness_before;
+ static _LIBCPP_CONSTEXPR const float_round_style round_style = __base::round_style;
};
template <class _Tp>
- _LIBCPP_CONSTEXPR const bool numeric_limits<const volatile _Tp>::is_specialized;
+_LIBCPP_CONSTEXPR const bool numeric_limits<const volatile _Tp>::is_specialized;
template <class _Tp>
- _LIBCPP_CONSTEXPR const int numeric_limits<const volatile _Tp>::digits;
+_LIBCPP_CONSTEXPR const int numeric_limits<const volatile _Tp>::digits;
template <class _Tp>
- _LIBCPP_CONSTEXPR const int numeric_limits<const volatile _Tp>::digits10;
+_LIBCPP_CONSTEXPR const int numeric_limits<const volatile _Tp>::digits10;
template <class _Tp>
- _LIBCPP_CONSTEXPR const int numeric_limits<const volatile _Tp>::max_digits10;
+_LIBCPP_CONSTEXPR const int numeric_limits<const volatile _Tp>::max_digits10;
template <class _Tp>
- _LIBCPP_CONSTEXPR const bool numeric_limits<const volatile _Tp>::is_signed;
+_LIBCPP_CONSTEXPR const bool numeric_limits<const volatile _Tp>::is_signed;
template <class _Tp>
- _LIBCPP_CONSTEXPR const bool numeric_limits<const volatile _Tp>::is_integer;
+_LIBCPP_CONSTEXPR const bool numeric_limits<const volatile _Tp>::is_integer;
template <class _Tp>
- _LIBCPP_CONSTEXPR const bool numeric_limits<const volatile _Tp>::is_exact;
+_LIBCPP_CONSTEXPR const bool numeric_limits<const volatile _Tp>::is_exact;
template <class _Tp>
- _LIBCPP_CONSTEXPR const int numeric_limits<const volatile _Tp>::radix;
+_LIBCPP_CONSTEXPR const int numeric_limits<const volatile _Tp>::radix;
template <class _Tp>
- _LIBCPP_CONSTEXPR const int numeric_limits<const volatile _Tp>::min_exponent;
+_LIBCPP_CONSTEXPR const int numeric_limits<const volatile _Tp>::min_exponent;
template <class _Tp>
- _LIBCPP_CONSTEXPR const int numeric_limits<const volatile _Tp>::min_exponent10;
+_LIBCPP_CONSTEXPR const int numeric_limits<const volatile _Tp>::min_exponent10;
template <class _Tp>
- _LIBCPP_CONSTEXPR const int numeric_limits<const volatile _Tp>::max_exponent;
+_LIBCPP_CONSTEXPR const int numeric_limits<const volatile _Tp>::max_exponent;
template <class _Tp>
- _LIBCPP_CONSTEXPR const int numeric_limits<const volatile _Tp>::max_exponent10;
+_LIBCPP_CONSTEXPR const int numeric_limits<const volatile _Tp>::max_exponent10;
template <class _Tp>
- _LIBCPP_CONSTEXPR const bool numeric_limits<const volatile _Tp>::has_infinity;
+_LIBCPP_CONSTEXPR const bool numeric_limits<const volatile _Tp>::has_infinity;
template <class _Tp>
- _LIBCPP_CONSTEXPR const bool numeric_limits<const volatile _Tp>::has_quiet_NaN;
+_LIBCPP_CONSTEXPR const bool numeric_limits<const volatile _Tp>::has_quiet_NaN;
template <class _Tp>
- _LIBCPP_CONSTEXPR const bool numeric_limits<const volatile _Tp>::has_signaling_NaN;
+_LIBCPP_CONSTEXPR const bool numeric_limits<const volatile _Tp>::has_signaling_NaN;
template <class _Tp>
- _LIBCPP_CONSTEXPR const float_denorm_style numeric_limits<const volatile _Tp>::has_denorm;
+_LIBCPP_CONSTEXPR const float_denorm_style numeric_limits<const volatile _Tp>::has_denorm;
template <class _Tp>
- _LIBCPP_CONSTEXPR const bool numeric_limits<const volatile _Tp>::has_denorm_loss;
+_LIBCPP_CONSTEXPR const bool numeric_limits<const volatile _Tp>::has_denorm_loss;
template <class _Tp>
- _LIBCPP_CONSTEXPR const bool numeric_limits<const volatile _Tp>::is_iec559;
+_LIBCPP_CONSTEXPR const bool numeric_limits<const volatile _Tp>::is_iec559;
template <class _Tp>
- _LIBCPP_CONSTEXPR const bool numeric_limits<const volatile _Tp>::is_bounded;
+_LIBCPP_CONSTEXPR const bool numeric_limits<const volatile _Tp>::is_bounded;
template <class _Tp>
- _LIBCPP_CONSTEXPR const bool numeric_limits<const volatile _Tp>::is_modulo;
+_LIBCPP_CONSTEXPR const bool numeric_limits<const volatile _Tp>::is_modulo;
template <class _Tp>
- _LIBCPP_CONSTEXPR const bool numeric_limits<const volatile _Tp>::traps;
+_LIBCPP_CONSTEXPR const bool numeric_limits<const volatile _Tp>::traps;
template <class _Tp>
- _LIBCPP_CONSTEXPR const bool numeric_limits<const volatile _Tp>::tinyness_before;
+_LIBCPP_CONSTEXPR const bool numeric_limits<const volatile _Tp>::tinyness_before;
template <class _Tp>
- _LIBCPP_CONSTEXPR const float_round_style numeric_limits<const volatile _Tp>::round_style;
+_LIBCPP_CONSTEXPR const float_round_style numeric_limits<const volatile _Tp>::round_style;
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/list b/contrib/llvm-project/libcxx/include/list
index 922843ad571d..7fea48744569 100644
--- a/contrib/llvm-project/libcxx/include/list
+++ b/contrib/llvm-project/libcxx/include/list
@@ -261,18 +261,17 @@ template <class T, class Allocator, class Predicate>
_LIBCPP_PUSH_MACROS
#include <__undef_macros>
-
_LIBCPP_BEGIN_NAMESPACE_STD
-template <class _Tp, class _VoidPtr> struct __list_node;
-template <class _Tp, class _VoidPtr> struct __list_node_base;
+template <class _Tp, class _VoidPtr>
+struct __list_node;
+template <class _Tp, class _VoidPtr>
+struct __list_node_base;
template <class _Tp, class _VoidPtr>
struct __list_node_pointer_traits {
- typedef __rebind_pointer_t<_VoidPtr, __list_node<_Tp, _VoidPtr> >
- __node_pointer;
- typedef __rebind_pointer_t<_VoidPtr, __list_node_base<_Tp, _VoidPtr> >
- __base_pointer;
+ typedef __rebind_pointer_t<_VoidPtr, __list_node<_Tp, _VoidPtr> > __node_pointer;
+ typedef __rebind_pointer_t<_VoidPtr, __list_node_base<_Tp, _VoidPtr> > __base_pointer;
#if defined(_LIBCPP_ABI_LIST_REMOVE_NODE_POINTER_UB)
typedef __base_pointer __link_pointer;
@@ -283,432 +282,339 @@ struct __list_node_pointer_traits {
typedef __conditional_t<is_same<__link_pointer, __node_pointer>::value, __base_pointer, __node_pointer>
__non_link_pointer;
- static _LIBCPP_HIDE_FROM_ABI
- __link_pointer __unsafe_link_pointer_cast(__link_pointer __p) {
- return __p;
- }
+ static _LIBCPP_HIDE_FROM_ABI __link_pointer __unsafe_link_pointer_cast(__link_pointer __p) { return __p; }
- static _LIBCPP_HIDE_FROM_ABI
- __link_pointer __unsafe_link_pointer_cast(__non_link_pointer __p) {
- return static_cast<__link_pointer>(static_cast<_VoidPtr>(__p));
+ static _LIBCPP_HIDE_FROM_ABI __link_pointer __unsafe_link_pointer_cast(__non_link_pointer __p) {
+ return static_cast<__link_pointer>(static_cast<_VoidPtr>(__p));
}
-
};
template <class _Tp, class _VoidPtr>
-struct __list_node_base
-{
- typedef __list_node_pointer_traits<_Tp, _VoidPtr> _NodeTraits;
- typedef typename _NodeTraits::__node_pointer __node_pointer;
- typedef typename _NodeTraits::__base_pointer __base_pointer;
- typedef typename _NodeTraits::__link_pointer __link_pointer;
+struct __list_node_base {
+ typedef __list_node_pointer_traits<_Tp, _VoidPtr> _NodeTraits;
+ typedef typename _NodeTraits::__node_pointer __node_pointer;
+ typedef typename _NodeTraits::__base_pointer __base_pointer;
+ typedef typename _NodeTraits::__link_pointer __link_pointer;
- __link_pointer __prev_;
- __link_pointer __next_;
+ __link_pointer __prev_;
+ __link_pointer __next_;
- _LIBCPP_HIDE_FROM_ABI
- __list_node_base() : __prev_(_NodeTraits::__unsafe_link_pointer_cast(__self())),
- __next_(_NodeTraits::__unsafe_link_pointer_cast(__self())) {}
+ _LIBCPP_HIDE_FROM_ABI __list_node_base()
+ : __prev_(_NodeTraits::__unsafe_link_pointer_cast(__self())),
+ __next_(_NodeTraits::__unsafe_link_pointer_cast(__self())) {}
- _LIBCPP_HIDE_FROM_ABI explicit __list_node_base(__link_pointer __prev, __link_pointer __next)
- : __prev_(__prev), __next_(__next) {}
+ _LIBCPP_HIDE_FROM_ABI explicit __list_node_base(__link_pointer __prev, __link_pointer __next)
+ : __prev_(__prev), __next_(__next) {}
- _LIBCPP_HIDE_FROM_ABI
- __base_pointer __self() {
- return pointer_traits<__base_pointer>::pointer_to(*this);
- }
+ _LIBCPP_HIDE_FROM_ABI __base_pointer __self() { return pointer_traits<__base_pointer>::pointer_to(*this); }
- _LIBCPP_HIDE_FROM_ABI
- __node_pointer __as_node() {
- return static_cast<__node_pointer>(__self());
- }
+ _LIBCPP_HIDE_FROM_ABI __node_pointer __as_node() { return static_cast<__node_pointer>(__self()); }
};
template <class _Tp, class _VoidPtr>
-struct __list_node
- : public __list_node_base<_Tp, _VoidPtr>
-{
- // We allow starting the lifetime of nodes without initializing the value held by the node,
- // since that is handled by the list itself in order to be allocator-aware.
+struct __list_node : public __list_node_base<_Tp, _VoidPtr> {
+ // We allow starting the lifetime of nodes without initializing the value held by the node,
+ // since that is handled by the list itself in order to be allocator-aware.
#ifndef _LIBCPP_CXX03_LANG
+
private:
- union {
- _Tp __value_;
- };
+ union {
+ _Tp __value_;
+ };
public:
- _LIBCPP_HIDE_FROM_ABI _Tp& __get_value() { return __value_; }
+ _LIBCPP_HIDE_FROM_ABI _Tp& __get_value() { return __value_; }
#else
+
private:
- _ALIGNAS_TYPE(_Tp) char __buffer_[sizeof(_Tp)];
+ _ALIGNAS_TYPE(_Tp) char __buffer_[sizeof(_Tp)];
public:
- _LIBCPP_HIDE_FROM_ABI _Tp& __get_value() {
- return *std::__launder(reinterpret_cast<_Tp*>(&__buffer_));
- }
+ _LIBCPP_HIDE_FROM_ABI _Tp& __get_value() { return *std::__launder(reinterpret_cast<_Tp*>(&__buffer_)); }
#endif
- typedef __list_node_base<_Tp, _VoidPtr> __base;
- typedef typename __base::__link_pointer __link_pointer;
+ typedef __list_node_base<_Tp, _VoidPtr> __base;
+ typedef typename __base::__link_pointer __link_pointer;
- _LIBCPP_HIDE_FROM_ABI explicit __list_node(__link_pointer __prev, __link_pointer __next) : __base(__prev, __next) {}
- _LIBCPP_HIDE_FROM_ABI ~__list_node() {}
+ _LIBCPP_HIDE_FROM_ABI explicit __list_node(__link_pointer __prev, __link_pointer __next) : __base(__prev, __next) {}
+ _LIBCPP_HIDE_FROM_ABI ~__list_node() {}
- _LIBCPP_HIDE_FROM_ABI
- __link_pointer __as_link() {
- return static_cast<__link_pointer>(__base::__self());
- }
+ _LIBCPP_HIDE_FROM_ABI __link_pointer __as_link() { return static_cast<__link_pointer>(__base::__self()); }
};
-template <class _Tp, class _Alloc = allocator<_Tp> > class _LIBCPP_TEMPLATE_VIS list;
-template <class _Tp, class _Alloc> class __list_imp;
-template <class _Tp, class _VoidPtr> class _LIBCPP_TEMPLATE_VIS __list_const_iterator;
+template <class _Tp, class _Alloc = allocator<_Tp> >
+class _LIBCPP_TEMPLATE_VIS list;
+template <class _Tp, class _Alloc>
+class __list_imp;
+template <class _Tp, class _VoidPtr>
+class _LIBCPP_TEMPLATE_VIS __list_const_iterator;
template <class _Tp, class _VoidPtr>
-class _LIBCPP_TEMPLATE_VIS __list_iterator
-{
- typedef __list_node_pointer_traits<_Tp, _VoidPtr> _NodeTraits;
- typedef typename _NodeTraits::__link_pointer __link_pointer;
+class _LIBCPP_TEMPLATE_VIS __list_iterator {
+ typedef __list_node_pointer_traits<_Tp, _VoidPtr> _NodeTraits;
+ typedef typename _NodeTraits::__link_pointer __link_pointer;
- __link_pointer __ptr_;
+ __link_pointer __ptr_;
- _LIBCPP_HIDE_FROM_ABI
- explicit __list_iterator(__link_pointer __p) _NOEXCEPT
- : __ptr_(__p)
- {
- }
+ _LIBCPP_HIDE_FROM_ABI explicit __list_iterator(__link_pointer __p) _NOEXCEPT : __ptr_(__p) {}
+
+ template <class, class>
+ friend class list;
+ template <class, class>
+ friend class __list_imp;
+ template <class, class>
+ friend class __list_const_iterator;
- template<class, class> friend class list;
- template<class, class> friend class __list_imp;
- template<class, class> friend class __list_const_iterator;
public:
- typedef bidirectional_iterator_tag iterator_category;
- typedef _Tp value_type;
- typedef value_type& reference;
- typedef __rebind_pointer_t<_VoidPtr, value_type> pointer;
- typedef typename pointer_traits<pointer>::difference_type difference_type;
-
- _LIBCPP_HIDE_FROM_ABI
- __list_iterator() _NOEXCEPT : __ptr_(nullptr)
- {
- }
+ typedef bidirectional_iterator_tag iterator_category;
+ typedef _Tp value_type;
+ typedef value_type& reference;
+ typedef __rebind_pointer_t<_VoidPtr, value_type> pointer;
+ typedef typename pointer_traits<pointer>::difference_type difference_type;
- _LIBCPP_HIDE_FROM_ABI
- reference operator*() const
- {
- return __ptr_->__as_node()->__get_value();
- }
- _LIBCPP_HIDE_FROM_ABI
- pointer operator->() const
- {
- return pointer_traits<pointer>::pointer_to(__ptr_->__as_node()->__get_value());
- }
+ _LIBCPP_HIDE_FROM_ABI __list_iterator() _NOEXCEPT : __ptr_(nullptr) {}
- _LIBCPP_HIDE_FROM_ABI
- __list_iterator& operator++()
- {
- __ptr_ = __ptr_->__next_;
- return *this;
- }
- _LIBCPP_HIDE_FROM_ABI
- __list_iterator operator++(int) {__list_iterator __t(*this); ++(*this); return __t;}
-
- _LIBCPP_HIDE_FROM_ABI
- __list_iterator& operator--()
- {
- __ptr_ = __ptr_->__prev_;
- return *this;
- }
- _LIBCPP_HIDE_FROM_ABI
- __list_iterator operator--(int) {__list_iterator __t(*this); --(*this); return __t;}
+ _LIBCPP_HIDE_FROM_ABI reference operator*() const { return __ptr_->__as_node()->__get_value(); }
+ _LIBCPP_HIDE_FROM_ABI pointer operator->() const {
+ return pointer_traits<pointer>::pointer_to(__ptr_->__as_node()->__get_value());
+ }
- friend _LIBCPP_HIDE_FROM_ABI
- bool operator==(const __list_iterator& __x, const __list_iterator& __y)
- {
- return __x.__ptr_ == __y.__ptr_;
- }
- friend _LIBCPP_HIDE_FROM_ABI
- bool operator!=(const __list_iterator& __x, const __list_iterator& __y)
- {return !(__x == __y);}
+ _LIBCPP_HIDE_FROM_ABI __list_iterator& operator++() {
+ __ptr_ = __ptr_->__next_;
+ return *this;
+ }
+ _LIBCPP_HIDE_FROM_ABI __list_iterator operator++(int) {
+ __list_iterator __t(*this);
+ ++(*this);
+ return __t;
+ }
+
+ _LIBCPP_HIDE_FROM_ABI __list_iterator& operator--() {
+ __ptr_ = __ptr_->__prev_;
+ return *this;
+ }
+ _LIBCPP_HIDE_FROM_ABI __list_iterator operator--(int) {
+ __list_iterator __t(*this);
+ --(*this);
+ return __t;
+ }
+
+ friend _LIBCPP_HIDE_FROM_ABI bool operator==(const __list_iterator& __x, const __list_iterator& __y) {
+ return __x.__ptr_ == __y.__ptr_;
+ }
+ friend _LIBCPP_HIDE_FROM_ABI bool operator!=(const __list_iterator& __x, const __list_iterator& __y) {
+ return !(__x == __y);
+ }
};
template <class _Tp, class _VoidPtr>
-class _LIBCPP_TEMPLATE_VIS __list_const_iterator
-{
- typedef __list_node_pointer_traits<_Tp, _VoidPtr> _NodeTraits;
- typedef typename _NodeTraits::__link_pointer __link_pointer;
+class _LIBCPP_TEMPLATE_VIS __list_const_iterator {
+ typedef __list_node_pointer_traits<_Tp, _VoidPtr> _NodeTraits;
+ typedef typename _NodeTraits::__link_pointer __link_pointer;
- __link_pointer __ptr_;
+ __link_pointer __ptr_;
- _LIBCPP_HIDE_FROM_ABI
- explicit __list_const_iterator(__link_pointer __p) _NOEXCEPT
- : __ptr_(__p)
- {
- }
+ _LIBCPP_HIDE_FROM_ABI explicit __list_const_iterator(__link_pointer __p) _NOEXCEPT : __ptr_(__p) {}
+
+ template <class, class>
+ friend class list;
+ template <class, class>
+ friend class __list_imp;
- template<class, class> friend class list;
- template<class, class> friend class __list_imp;
public:
- typedef bidirectional_iterator_tag iterator_category;
- typedef _Tp value_type;
- typedef const value_type& reference;
- typedef __rebind_pointer_t<_VoidPtr, const value_type> pointer;
- typedef typename pointer_traits<pointer>::difference_type difference_type;
-
- _LIBCPP_HIDE_FROM_ABI
- __list_const_iterator() _NOEXCEPT : __ptr_(nullptr)
- {
- }
- _LIBCPP_HIDE_FROM_ABI
- __list_const_iterator(const __list_iterator<_Tp, _VoidPtr>& __p) _NOEXCEPT
- : __ptr_(__p.__ptr_)
- {
- }
+ typedef bidirectional_iterator_tag iterator_category;
+ typedef _Tp value_type;
+ typedef const value_type& reference;
+ typedef __rebind_pointer_t<_VoidPtr, const value_type> pointer;
+ typedef typename pointer_traits<pointer>::difference_type difference_type;
+
+ _LIBCPP_HIDE_FROM_ABI __list_const_iterator() _NOEXCEPT : __ptr_(nullptr) {}
+ _LIBCPP_HIDE_FROM_ABI __list_const_iterator(const __list_iterator<_Tp, _VoidPtr>& __p) _NOEXCEPT
+ : __ptr_(__p.__ptr_) {}
+
+ _LIBCPP_HIDE_FROM_ABI reference operator*() const { return __ptr_->__as_node()->__get_value(); }
+ _LIBCPP_HIDE_FROM_ABI pointer operator->() const {
+ return pointer_traits<pointer>::pointer_to(__ptr_->__as_node()->__get_value());
+ }
- _LIBCPP_HIDE_FROM_ABI
- reference operator*() const
- {
- return __ptr_->__as_node()->__get_value();
- }
- _LIBCPP_HIDE_FROM_ABI
- pointer operator->() const
- {
- return pointer_traits<pointer>::pointer_to(__ptr_->__as_node()->__get_value());
- }
+ _LIBCPP_HIDE_FROM_ABI __list_const_iterator& operator++() {
+ __ptr_ = __ptr_->__next_;
+ return *this;
+ }
+ _LIBCPP_HIDE_FROM_ABI __list_const_iterator operator++(int) {
+ __list_const_iterator __t(*this);
+ ++(*this);
+ return __t;
+ }
- _LIBCPP_HIDE_FROM_ABI
- __list_const_iterator& operator++()
- {
- __ptr_ = __ptr_->__next_;
- return *this;
- }
- _LIBCPP_HIDE_FROM_ABI
- __list_const_iterator operator++(int) {__list_const_iterator __t(*this); ++(*this); return __t;}
-
- _LIBCPP_HIDE_FROM_ABI
- __list_const_iterator& operator--()
- {
- __ptr_ = __ptr_->__prev_;
- return *this;
- }
- _LIBCPP_HIDE_FROM_ABI
- __list_const_iterator operator--(int) {__list_const_iterator __t(*this); --(*this); return __t;}
+ _LIBCPP_HIDE_FROM_ABI __list_const_iterator& operator--() {
+ __ptr_ = __ptr_->__prev_;
+ return *this;
+ }
+ _LIBCPP_HIDE_FROM_ABI __list_const_iterator operator--(int) {
+ __list_const_iterator __t(*this);
+ --(*this);
+ return __t;
+ }
- friend _LIBCPP_HIDE_FROM_ABI
- bool operator==(const __list_const_iterator& __x, const __list_const_iterator& __y)
- {
- return __x.__ptr_ == __y.__ptr_;
- }
- friend _LIBCPP_HIDE_FROM_ABI
- bool operator!=(const __list_const_iterator& __x, const __list_const_iterator& __y)
- {return !(__x == __y);}
+ friend _LIBCPP_HIDE_FROM_ABI bool operator==(const __list_const_iterator& __x, const __list_const_iterator& __y) {
+ return __x.__ptr_ == __y.__ptr_;
+ }
+ friend _LIBCPP_HIDE_FROM_ABI bool operator!=(const __list_const_iterator& __x, const __list_const_iterator& __y) {
+ return !(__x == __y);
+ }
};
template <class _Tp, class _Alloc>
-class __list_imp
-{
- __list_imp(const __list_imp&);
- __list_imp& operator=(const __list_imp&);
+class __list_imp {
+ __list_imp(const __list_imp&);
+ __list_imp& operator=(const __list_imp&);
+
public:
- typedef _Alloc allocator_type;
- typedef allocator_traits<allocator_type> __alloc_traits;
- typedef typename __alloc_traits::size_type size_type;
+ typedef _Alloc allocator_type;
+ typedef allocator_traits<allocator_type> __alloc_traits;
+ typedef typename __alloc_traits::size_type size_type;
+
protected:
- typedef _Tp value_type;
- typedef typename __alloc_traits::void_pointer __void_pointer;
- typedef __list_iterator<value_type, __void_pointer> iterator;
- typedef __list_const_iterator<value_type, __void_pointer> const_iterator;
- typedef __list_node_base<value_type, __void_pointer> __node_base;
- typedef __list_node<value_type, __void_pointer> __node_type;
- typedef __rebind_alloc<__alloc_traits, __node_type> __node_allocator;
- typedef allocator_traits<__node_allocator> __node_alloc_traits;
- typedef typename __node_alloc_traits::pointer __node_pointer;
- typedef typename __node_alloc_traits::pointer __node_const_pointer;
- typedef __list_node_pointer_traits<value_type, __void_pointer> __node_pointer_traits;
- typedef typename __node_pointer_traits::__link_pointer __link_pointer;
- typedef __link_pointer __link_const_pointer;
- typedef typename __alloc_traits::pointer pointer;
- typedef typename __alloc_traits::const_pointer const_pointer;
- typedef typename __alloc_traits::difference_type difference_type;
-
- typedef __rebind_alloc<__alloc_traits, __node_base> __node_base_allocator;
- typedef typename allocator_traits<__node_base_allocator>::pointer __node_base_pointer;
- static_assert((!is_same<allocator_type, __node_allocator>::value),
- "internal allocator type must differ from user-specified "
- "type; otherwise overload resolution breaks");
-
- __node_base __end_;
- __compressed_pair<size_type, __node_allocator> __size_alloc_;
-
- _LIBCPP_HIDE_FROM_ABI
- __link_pointer __end_as_link() const _NOEXCEPT {
- return __node_pointer_traits::__unsafe_link_pointer_cast(
- const_cast<__node_base&>(__end_).__self());
- }
+ typedef _Tp value_type;
+ typedef typename __alloc_traits::void_pointer __void_pointer;
+ typedef __list_iterator<value_type, __void_pointer> iterator;
+ typedef __list_const_iterator<value_type, __void_pointer> const_iterator;
+ typedef __list_node_base<value_type, __void_pointer> __node_base;
+ typedef __list_node<value_type, __void_pointer> __node_type;
+ typedef __rebind_alloc<__alloc_traits, __node_type> __node_allocator;
+ typedef allocator_traits<__node_allocator> __node_alloc_traits;
+ typedef typename __node_alloc_traits::pointer __node_pointer;
+ typedef typename __node_alloc_traits::pointer __node_const_pointer;
+ typedef __list_node_pointer_traits<value_type, __void_pointer> __node_pointer_traits;
+ typedef typename __node_pointer_traits::__link_pointer __link_pointer;
+ typedef __link_pointer __link_const_pointer;
+ typedef typename __alloc_traits::pointer pointer;
+ typedef typename __alloc_traits::const_pointer const_pointer;
+ typedef typename __alloc_traits::difference_type difference_type;
+
+ typedef __rebind_alloc<__alloc_traits, __node_base> __node_base_allocator;
+ typedef typename allocator_traits<__node_base_allocator>::pointer __node_base_pointer;
+ static_assert((!is_same<allocator_type, __node_allocator>::value),
+ "internal allocator type must differ from user-specified "
+ "type; otherwise overload resolution breaks");
+
+ __node_base __end_;
+ __compressed_pair<size_type, __node_allocator> __size_alloc_;
+
+ _LIBCPP_HIDE_FROM_ABI __link_pointer __end_as_link() const _NOEXCEPT {
+ return __node_pointer_traits::__unsafe_link_pointer_cast(const_cast<__node_base&>(__end_).__self());
+ }
- _LIBCPP_HIDE_FROM_ABI
- size_type& __sz() _NOEXCEPT {return __size_alloc_.first();}
- _LIBCPP_HIDE_FROM_ABI
- const size_type& __sz() const _NOEXCEPT
- {return __size_alloc_.first();}
- _LIBCPP_HIDE_FROM_ABI
- __node_allocator& __node_alloc() _NOEXCEPT
- {return __size_alloc_.second();}
- _LIBCPP_HIDE_FROM_ABI
- const __node_allocator& __node_alloc() const _NOEXCEPT
- {return __size_alloc_.second();}
-
- _LIBCPP_HIDE_FROM_ABI
- size_type __node_alloc_max_size() const _NOEXCEPT {
- return __node_alloc_traits::max_size(__node_alloc());
- }
- _LIBCPP_HIDE_FROM_ABI
- static void __unlink_nodes(__link_pointer __f, __link_pointer __l) _NOEXCEPT;
-
- _LIBCPP_HIDE_FROM_ABI
- __list_imp()
- _NOEXCEPT_(is_nothrow_default_constructible<__node_allocator>::value);
- _LIBCPP_HIDE_FROM_ABI
- __list_imp(const allocator_type& __a);
- _LIBCPP_HIDE_FROM_ABI
- __list_imp(const __node_allocator& __a);
+ _LIBCPP_HIDE_FROM_ABI size_type& __sz() _NOEXCEPT { return __size_alloc_.first(); }
+ _LIBCPP_HIDE_FROM_ABI const size_type& __sz() const _NOEXCEPT { return __size_alloc_.first(); }
+ _LIBCPP_HIDE_FROM_ABI __node_allocator& __node_alloc() _NOEXCEPT { return __size_alloc_.second(); }
+ _LIBCPP_HIDE_FROM_ABI const __node_allocator& __node_alloc() const _NOEXCEPT { return __size_alloc_.second(); }
+
+ _LIBCPP_HIDE_FROM_ABI size_type __node_alloc_max_size() const _NOEXCEPT {
+ return __node_alloc_traits::max_size(__node_alloc());
+ }
+ _LIBCPP_HIDE_FROM_ABI static void __unlink_nodes(__link_pointer __f, __link_pointer __l) _NOEXCEPT;
+
+ _LIBCPP_HIDE_FROM_ABI __list_imp() _NOEXCEPT_(is_nothrow_default_constructible<__node_allocator>::value);
+ _LIBCPP_HIDE_FROM_ABI __list_imp(const allocator_type& __a);
+ _LIBCPP_HIDE_FROM_ABI __list_imp(const __node_allocator& __a);
#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI __list_imp(__node_allocator&& __a) _NOEXCEPT;
+ _LIBCPP_HIDE_FROM_ABI __list_imp(__node_allocator&& __a) _NOEXCEPT;
#endif
- _LIBCPP_HIDE_FROM_ABI ~__list_imp();
- _LIBCPP_HIDE_FROM_ABI void clear() _NOEXCEPT;
- _LIBCPP_HIDE_FROM_ABI
- bool empty() const _NOEXCEPT {return __sz() == 0;}
-
- _LIBCPP_HIDE_FROM_ABI
- iterator begin() _NOEXCEPT
- {
- return iterator(__end_.__next_);
- }
- _LIBCPP_HIDE_FROM_ABI
- const_iterator begin() const _NOEXCEPT
- {
- return const_iterator(__end_.__next_);
- }
- _LIBCPP_HIDE_FROM_ABI
- iterator end() _NOEXCEPT
- {
- return iterator(__end_as_link());
- }
- _LIBCPP_HIDE_FROM_ABI
- const_iterator end() const _NOEXCEPT
- {
- return const_iterator(__end_as_link());
- }
+ _LIBCPP_HIDE_FROM_ABI ~__list_imp();
+ _LIBCPP_HIDE_FROM_ABI void clear() _NOEXCEPT;
+ _LIBCPP_HIDE_FROM_ABI bool empty() const _NOEXCEPT { return __sz() == 0; }
+
+ _LIBCPP_HIDE_FROM_ABI iterator begin() _NOEXCEPT { return iterator(__end_.__next_); }
+ _LIBCPP_HIDE_FROM_ABI const_iterator begin() const _NOEXCEPT { return const_iterator(__end_.__next_); }
+ _LIBCPP_HIDE_FROM_ABI iterator end() _NOEXCEPT { return iterator(__end_as_link()); }
+ _LIBCPP_HIDE_FROM_ABI const_iterator end() const _NOEXCEPT { return const_iterator(__end_as_link()); }
- _LIBCPP_HIDE_FROM_ABI void swap(__list_imp& __c)
+ _LIBCPP_HIDE_FROM_ABI void swap(__list_imp& __c)
#if _LIBCPP_STD_VER >= 14
- _NOEXCEPT;
+ _NOEXCEPT;
#else
- _NOEXCEPT_(!__alloc_traits::propagate_on_container_swap::value ||
- __is_nothrow_swappable<allocator_type>::value);
+ _NOEXCEPT_(!__alloc_traits::propagate_on_container_swap::value || __is_nothrow_swappable<allocator_type>::value);
#endif
- _LIBCPP_HIDE_FROM_ABI
- void __copy_assign_alloc(const __list_imp& __c)
- {__copy_assign_alloc(__c, integral_constant<bool,
- __node_alloc_traits::propagate_on_container_copy_assignment::value>());}
-
- _LIBCPP_HIDE_FROM_ABI
- void __move_assign_alloc(__list_imp& __c)
- _NOEXCEPT_(
- !__node_alloc_traits::propagate_on_container_move_assignment::value ||
- is_nothrow_move_assignable<__node_allocator>::value)
- {__move_assign_alloc(__c, integral_constant<bool,
- __node_alloc_traits::propagate_on_container_move_assignment::value>());}
-
- template <class ..._Args>
- _LIBCPP_HIDE_FROM_ABI __node_pointer __create_node(__link_pointer __prev, __link_pointer __next, _Args&& ...__args) {
- __node_allocator& __alloc = __node_alloc();
- __allocation_guard<__node_allocator> __guard(__alloc, 1);
- // Begin the lifetime of the node itself. Note that this doesn't begin the lifetime of the value
- // held inside the node, since we need to use the allocator's construct() method for that.
- //
- // We don't use the allocator's construct() method to construct the node itself since the
- // Cpp17FooInsertable named requirements don't require the allocator's construct() method
- // to work on anything other than the value_type.
- std::__construct_at(std::addressof(*__guard.__get()), __prev, __next);
-
- // Now construct the value_type using the allocator's construct() method.
- __node_alloc_traits::construct(__alloc, std::addressof(__guard.__get()->__get_value()), std::forward<_Args>(__args)...);
- return __guard.__release_ptr();
- }
+ _LIBCPP_HIDE_FROM_ABI void __copy_assign_alloc(const __list_imp& __c) {
+ __copy_assign_alloc(
+ __c, integral_constant<bool, __node_alloc_traits::propagate_on_container_copy_assignment::value>());
+ }
- template <class ..._Args>
- _LIBCPP_HIDE_FROM_ABI void __delete_node(__node_pointer __node) {
- // For the same reason as above, we use the allocator's destroy() method for the value_type,
- // but not for the node itself.
- __node_allocator& __alloc = __node_alloc();
- __node_alloc_traits::destroy(__alloc, std::addressof(__node->__get_value()));
- std::__destroy_at(std::addressof(*__node));
- __node_alloc_traits::deallocate(__alloc, __node, 1);
- }
+ _LIBCPP_HIDE_FROM_ABI void __move_assign_alloc(__list_imp& __c)
+ _NOEXCEPT_(!__node_alloc_traits::propagate_on_container_move_assignment::value ||
+ is_nothrow_move_assignable<__node_allocator>::value) {
+ __move_assign_alloc(
+ __c, integral_constant<bool, __node_alloc_traits::propagate_on_container_move_assignment::value>());
+ }
+
+ template <class... _Args>
+ _LIBCPP_HIDE_FROM_ABI __node_pointer __create_node(__link_pointer __prev, __link_pointer __next, _Args&&... __args) {
+ __node_allocator& __alloc = __node_alloc();
+ __allocation_guard<__node_allocator> __guard(__alloc, 1);
+ // Begin the lifetime of the node itself. Note that this doesn't begin the lifetime of the value
+ // held inside the node, since we need to use the allocator's construct() method for that.
+ //
+ // We don't use the allocator's construct() method to construct the node itself since the
+ // Cpp17FooInsertable named requirements don't require the allocator's construct() method
+ // to work on anything other than the value_type.
+ std::__construct_at(std::addressof(*__guard.__get()), __prev, __next);
+
+ // Now construct the value_type using the allocator's construct() method.
+ __node_alloc_traits::construct(
+ __alloc, std::addressof(__guard.__get()->__get_value()), std::forward<_Args>(__args)...);
+ return __guard.__release_ptr();
+ }
+
+ template <class... _Args>
+ _LIBCPP_HIDE_FROM_ABI void __delete_node(__node_pointer __node) {
+ // For the same reason as above, we use the allocator's destroy() method for the value_type,
+ // but not for the node itself.
+ __node_allocator& __alloc = __node_alloc();
+ __node_alloc_traits::destroy(__alloc, std::addressof(__node->__get_value()));
+ std::__destroy_at(std::addressof(*__node));
+ __node_alloc_traits::deallocate(__alloc, __node, 1);
+ }
private:
- _LIBCPP_HIDE_FROM_ABI
- void __copy_assign_alloc(const __list_imp& __c, true_type)
- {
- if (__node_alloc() != __c.__node_alloc())
- clear();
- __node_alloc() = __c.__node_alloc();
- }
-
- _LIBCPP_HIDE_FROM_ABI
- void __copy_assign_alloc(const __list_imp&, false_type)
- {}
-
- _LIBCPP_HIDE_FROM_ABI
- void __move_assign_alloc(__list_imp& __c, true_type)
- _NOEXCEPT_(is_nothrow_move_assignable<__node_allocator>::value)
- {
- __node_alloc() = std::move(__c.__node_alloc());
- }
-
- _LIBCPP_HIDE_FROM_ABI
- void __move_assign_alloc(__list_imp&, false_type)
- _NOEXCEPT
- {}
+ _LIBCPP_HIDE_FROM_ABI void __copy_assign_alloc(const __list_imp& __c, true_type) {
+ if (__node_alloc() != __c.__node_alloc())
+ clear();
+ __node_alloc() = __c.__node_alloc();
+ }
+
+ _LIBCPP_HIDE_FROM_ABI void __copy_assign_alloc(const __list_imp&, false_type) {}
+
+ _LIBCPP_HIDE_FROM_ABI void __move_assign_alloc(__list_imp& __c, true_type)
+ _NOEXCEPT_(is_nothrow_move_assignable<__node_allocator>::value) {
+ __node_alloc() = std::move(__c.__node_alloc());
+ }
+
+ _LIBCPP_HIDE_FROM_ABI void __move_assign_alloc(__list_imp&, false_type) _NOEXCEPT {}
};
// Unlink nodes [__f, __l]
template <class _Tp, class _Alloc>
-inline
-void
-__list_imp<_Tp, _Alloc>::__unlink_nodes(__link_pointer __f, __link_pointer __l)
- _NOEXCEPT
-{
- __f->__prev_->__next_ = __l->__next_;
- __l->__next_->__prev_ = __f->__prev_;
+inline void __list_imp<_Tp, _Alloc>::__unlink_nodes(__link_pointer __f, __link_pointer __l) _NOEXCEPT {
+ __f->__prev_->__next_ = __l->__next_;
+ __l->__next_->__prev_ = __f->__prev_;
}
template <class _Tp, class _Alloc>
-inline
-__list_imp<_Tp, _Alloc>::__list_imp()
- _NOEXCEPT_(is_nothrow_default_constructible<__node_allocator>::value)
- : __size_alloc_(0, __default_init_tag())
-{
-}
+inline __list_imp<_Tp, _Alloc>::__list_imp() _NOEXCEPT_(is_nothrow_default_constructible<__node_allocator>::value)
+ : __size_alloc_(0, __default_init_tag()) {}
template <class _Tp, class _Alloc>
-inline
-__list_imp<_Tp, _Alloc>::__list_imp(const allocator_type& __a)
- : __size_alloc_(0, __node_allocator(__a))
-{
-}
+inline __list_imp<_Tp, _Alloc>::__list_imp(const allocator_type& __a) : __size_alloc_(0, __node_allocator(__a)) {}
template <class _Tp, class _Alloc>
-inline __list_imp<_Tp, _Alloc>::__list_imp(const __node_allocator& __a)
- : __size_alloc_(0, __a) {}
+inline __list_imp<_Tp, _Alloc>::__list_imp(const __node_allocator& __a) : __size_alloc_(0, __a) {}
#ifndef _LIBCPP_CXX03_LANG
template <class _Tp, class _Alloc>
-inline __list_imp<_Tp, _Alloc>::__list_imp(__node_allocator&& __a) _NOEXCEPT
- : __size_alloc_(0, std::move(__a)) {}
+inline __list_imp<_Tp, _Alloc>::__list_imp(__node_allocator&& __a) _NOEXCEPT : __size_alloc_(0, std::move(__a)) {}
#endif
template <class _Tp, class _Alloc>
@@ -717,1330 +623,1077 @@ __list_imp<_Tp, _Alloc>::~__list_imp() {
}
template <class _Tp, class _Alloc>
-void
-__list_imp<_Tp, _Alloc>::clear() _NOEXCEPT
-{
- if (!empty())
- {
- __link_pointer __f = __end_.__next_;
- __link_pointer __l = __end_as_link();
- __unlink_nodes(__f, __l->__prev_);
- __sz() = 0;
- while (__f != __l)
- {
- __node_pointer __np = __f->__as_node();
- __f = __f->__next_;
- __delete_node(__np);
- }
+void __list_imp<_Tp, _Alloc>::clear() _NOEXCEPT {
+ if (!empty()) {
+ __link_pointer __f = __end_.__next_;
+ __link_pointer __l = __end_as_link();
+ __unlink_nodes(__f, __l->__prev_);
+ __sz() = 0;
+ while (__f != __l) {
+ __node_pointer __np = __f->__as_node();
+ __f = __f->__next_;
+ __delete_node(__np);
}
+ }
}
template <class _Tp, class _Alloc>
-void
-__list_imp<_Tp, _Alloc>::swap(__list_imp& __c)
+void __list_imp<_Tp, _Alloc>::swap(__list_imp& __c)
#if _LIBCPP_STD_VER >= 14
- _NOEXCEPT
+ _NOEXCEPT
#else
- _NOEXCEPT_(!__alloc_traits::propagate_on_container_swap::value ||
- __is_nothrow_swappable<allocator_type>::value)
+ _NOEXCEPT_(!__alloc_traits::propagate_on_container_swap::value || __is_nothrow_swappable<allocator_type>::value)
#endif
{
- _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(__alloc_traits::propagate_on_container_swap::value ||
- this->__node_alloc() == __c.__node_alloc(),
- "list::swap: Either propagate_on_container_swap must be true"
- " or the allocators must compare equal");
- using std::swap;
- std::__swap_allocator(__node_alloc(), __c.__node_alloc());
- swap(__sz(), __c.__sz());
- swap(__end_, __c.__end_);
- if (__sz() == 0)
- __end_.__next_ = __end_.__prev_ = __end_as_link();
- else
- __end_.__prev_->__next_ = __end_.__next_->__prev_ = __end_as_link();
- if (__c.__sz() == 0)
- __c.__end_.__next_ = __c.__end_.__prev_ = __c.__end_as_link();
- else
- __c.__end_.__prev_->__next_ = __c.__end_.__next_->__prev_ = __c.__end_as_link();
+ _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(
+ __alloc_traits::propagate_on_container_swap::value || this->__node_alloc() == __c.__node_alloc(),
+ "list::swap: Either propagate_on_container_swap must be true"
+ " or the allocators must compare equal");
+ using std::swap;
+ std::__swap_allocator(__node_alloc(), __c.__node_alloc());
+ swap(__sz(), __c.__sz());
+ swap(__end_, __c.__end_);
+ if (__sz() == 0)
+ __end_.__next_ = __end_.__prev_ = __end_as_link();
+ else
+ __end_.__prev_->__next_ = __end_.__next_->__prev_ = __end_as_link();
+ if (__c.__sz() == 0)
+ __c.__end_.__next_ = __c.__end_.__prev_ = __c.__end_as_link();
+ else
+ __c.__end_.__prev_->__next_ = __c.__end_.__next_->__prev_ = __c.__end_as_link();
}
template <class _Tp, class _Alloc /*= allocator<_Tp>*/>
-class _LIBCPP_TEMPLATE_VIS list
- : private __list_imp<_Tp, _Alloc>
-{
- typedef __list_imp<_Tp, _Alloc> base;
- typedef typename base::__node_type __node_type;
- typedef typename base::__node_allocator __node_allocator;
- typedef typename base::__node_pointer __node_pointer;
- typedef typename base::__node_alloc_traits __node_alloc_traits;
- typedef typename base::__node_base __node_base;
- typedef typename base::__node_base_pointer __node_base_pointer;
- typedef typename base::__link_pointer __link_pointer;
+class _LIBCPP_TEMPLATE_VIS list : private __list_imp<_Tp, _Alloc> {
+ typedef __list_imp<_Tp, _Alloc> base;
+ typedef typename base::__node_type __node_type;
+ typedef typename base::__node_allocator __node_allocator;
+ typedef typename base::__node_pointer __node_pointer;
+ typedef typename base::__node_alloc_traits __node_alloc_traits;
+ typedef typename base::__node_base __node_base;
+ typedef typename base::__node_base_pointer __node_base_pointer;
+ typedef typename base::__link_pointer __link_pointer;
public:
- typedef _Tp value_type;
- typedef _Alloc allocator_type;
- static_assert((is_same<value_type, typename allocator_type::value_type>::value),
- "Allocator::value_type must be same type as value_type");
- typedef value_type& reference;
- typedef const value_type& const_reference;
- typedef typename base::pointer pointer;
- typedef typename base::const_pointer const_pointer;
- typedef typename base::size_type size_type;
- typedef typename base::difference_type difference_type;
- typedef typename base::iterator iterator;
- typedef typename base::const_iterator const_iterator;
- typedef std::reverse_iterator<iterator> reverse_iterator;
- typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
+ typedef _Tp value_type;
+ typedef _Alloc allocator_type;
+ static_assert((is_same<value_type, typename allocator_type::value_type>::value),
+ "Allocator::value_type must be same type as value_type");
+ typedef value_type& reference;
+ typedef const value_type& const_reference;
+ typedef typename base::pointer pointer;
+ typedef typename base::const_pointer const_pointer;
+ typedef typename base::size_type size_type;
+ typedef typename base::difference_type difference_type;
+ typedef typename base::iterator iterator;
+ typedef typename base::const_iterator const_iterator;
+ typedef std::reverse_iterator<iterator> reverse_iterator;
+ typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
#if _LIBCPP_STD_VER >= 20
- typedef size_type __remove_return_type;
+ typedef size_type __remove_return_type;
#else
- typedef void __remove_return_type;
+ typedef void __remove_return_type;
#endif
- static_assert(is_same<allocator_type, __rebind_alloc<allocator_traits<allocator_type>, value_type> >::value,
- "[allocator.requirements] states that rebinding an allocator to the same type should result in the "
- "original allocator");
+ static_assert(is_same<allocator_type, __rebind_alloc<allocator_traits<allocator_type>, value_type> >::value,
+ "[allocator.requirements] states that rebinding an allocator to the same type should result in the "
+ "original allocator");
- _LIBCPP_HIDE_FROM_ABI
- list()
- _NOEXCEPT_(is_nothrow_default_constructible<__node_allocator>::value)
- {
- }
- _LIBCPP_HIDE_FROM_ABI
- explicit list(const allocator_type& __a) : base(__a)
- {
- }
- _LIBCPP_HIDE_FROM_ABI explicit list(size_type __n);
+ _LIBCPP_HIDE_FROM_ABI list() _NOEXCEPT_(is_nothrow_default_constructible<__node_allocator>::value) {}
+ _LIBCPP_HIDE_FROM_ABI explicit list(const allocator_type& __a) : base(__a) {}
+ _LIBCPP_HIDE_FROM_ABI explicit list(size_type __n);
#if _LIBCPP_STD_VER >= 14
- _LIBCPP_HIDE_FROM_ABI explicit list(size_type __n, const allocator_type& __a);
+ _LIBCPP_HIDE_FROM_ABI explicit list(size_type __n, const allocator_type& __a);
#endif
- _LIBCPP_HIDE_FROM_ABI list(size_type __n, const value_type& __x);
- template <class = __enable_if_t<__is_allocator<_Alloc>::value> >
- _LIBCPP_HIDE_FROM_ABI list(size_type __n, const value_type& __x, const allocator_type& __a) : base(__a)
- {
- for (; __n > 0; --__n)
- push_back(__x);
- }
+ _LIBCPP_HIDE_FROM_ABI list(size_type __n, const value_type& __x);
+ template <class = __enable_if_t<__is_allocator<_Alloc>::value> >
+ _LIBCPP_HIDE_FROM_ABI list(size_type __n, const value_type& __x, const allocator_type& __a) : base(__a) {
+ for (; __n > 0; --__n)
+ push_back(__x);
+ }
- template <class _InpIter>
- _LIBCPP_HIDE_FROM_ABI list(_InpIter __f, _InpIter __l,
- __enable_if_t<__has_input_iterator_category<_InpIter>::value>* = 0);
- template <class _InpIter>
- _LIBCPP_HIDE_FROM_ABI list(_InpIter __f, _InpIter __l, const allocator_type& __a,
- __enable_if_t<__has_input_iterator_category<_InpIter>::value>* = 0);
+ template <class _InpIter>
+ _LIBCPP_HIDE_FROM_ABI
+ list(_InpIter __f, _InpIter __l, __enable_if_t<__has_input_iterator_category<_InpIter>::value>* = 0);
+ template <class _InpIter>
+ _LIBCPP_HIDE_FROM_ABI
+ list(_InpIter __f,
+ _InpIter __l,
+ const allocator_type& __a,
+ __enable_if_t<__has_input_iterator_category<_InpIter>::value>* = 0);
#if _LIBCPP_STD_VER >= 23
- template <_ContainerCompatibleRange<_Tp> _Range>
- _LIBCPP_HIDE_FROM_ABI list(from_range_t, _Range&& __range,
- const allocator_type& __a = allocator_type()) : base(__a) {
- prepend_range(std::forward<_Range>(__range));
- }
+ template <_ContainerCompatibleRange<_Tp> _Range>
+ _LIBCPP_HIDE_FROM_ABI list(from_range_t, _Range&& __range, const allocator_type& __a = allocator_type()) : base(__a) {
+ prepend_range(std::forward<_Range>(__range));
+ }
#endif
- _LIBCPP_HIDE_FROM_ABI list(const list& __c);
- _LIBCPP_HIDE_FROM_ABI list(const list& __c, const __type_identity_t<allocator_type>& __a);
- _LIBCPP_HIDE_FROM_ABI
- list& operator=(const list& __c);
+ _LIBCPP_HIDE_FROM_ABI list(const list& __c);
+ _LIBCPP_HIDE_FROM_ABI list(const list& __c, const __type_identity_t<allocator_type>& __a);
+ _LIBCPP_HIDE_FROM_ABI list& operator=(const list& __c);
#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI list(initializer_list<value_type> __il);
- _LIBCPP_HIDE_FROM_ABI list(initializer_list<value_type> __il, const allocator_type& __a);
-
- _LIBCPP_HIDE_FROM_ABI
- list(list&& __c)
- _NOEXCEPT_(is_nothrow_move_constructible<__node_allocator>::value);
- _LIBCPP_HIDE_FROM_ABI
- list(list&& __c, const __type_identity_t<allocator_type>& __a);
- _LIBCPP_HIDE_FROM_ABI
- list& operator=(list&& __c)
- _NOEXCEPT_(
- __node_alloc_traits::propagate_on_container_move_assignment::value &&
- is_nothrow_move_assignable<__node_allocator>::value);
-
- _LIBCPP_HIDE_FROM_ABI
- list& operator=(initializer_list<value_type> __il)
- {assign(__il.begin(), __il.end()); return *this;}
-
- _LIBCPP_HIDE_FROM_ABI
- void assign(initializer_list<value_type> __il)
- {assign(__il.begin(), __il.end());}
+ _LIBCPP_HIDE_FROM_ABI list(initializer_list<value_type> __il);
+ _LIBCPP_HIDE_FROM_ABI list(initializer_list<value_type> __il, const allocator_type& __a);
+
+ _LIBCPP_HIDE_FROM_ABI list(list&& __c) _NOEXCEPT_(is_nothrow_move_constructible<__node_allocator>::value);
+ _LIBCPP_HIDE_FROM_ABI list(list&& __c, const __type_identity_t<allocator_type>& __a);
+ _LIBCPP_HIDE_FROM_ABI list& operator=(list&& __c)
+ _NOEXCEPT_(__node_alloc_traits::propagate_on_container_move_assignment::value&&
+ is_nothrow_move_assignable<__node_allocator>::value);
+
+ _LIBCPP_HIDE_FROM_ABI list& operator=(initializer_list<value_type> __il) {
+ assign(__il.begin(), __il.end());
+ return *this;
+ }
+
+ _LIBCPP_HIDE_FROM_ABI void assign(initializer_list<value_type> __il) { assign(__il.begin(), __il.end()); }
#endif // _LIBCPP_CXX03_LANG
- template <class _InpIter>
- _LIBCPP_HIDE_FROM_ABI void assign(_InpIter __f, _InpIter __l,
- __enable_if_t<__has_input_iterator_category<_InpIter>::value>* = 0);
+ template <class _InpIter>
+ _LIBCPP_HIDE_FROM_ABI void
+ assign(_InpIter __f, _InpIter __l, __enable_if_t<__has_input_iterator_category<_InpIter>::value>* = 0);
#if _LIBCPP_STD_VER >= 23
- template <_ContainerCompatibleRange<_Tp> _Range>
- _LIBCPP_HIDE_FROM_ABI
- void assign_range(_Range&& __range) {
- __assign_with_sentinel(ranges::begin(__range), ranges::end(__range));
- }
+ template <_ContainerCompatibleRange<_Tp> _Range>
+ _LIBCPP_HIDE_FROM_ABI void assign_range(_Range&& __range) {
+ __assign_with_sentinel(ranges::begin(__range), ranges::end(__range));
+ }
#endif
- _LIBCPP_HIDE_FROM_ABI void assign(size_type __n, const value_type& __x);
-
- _LIBCPP_HIDE_FROM_ABI
- allocator_type get_allocator() const _NOEXCEPT;
-
- _LIBCPP_HIDE_FROM_ABI
- size_type size() const _NOEXCEPT {return base::__sz();}
- _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_HIDE_FROM_ABI
- bool empty() const _NOEXCEPT {return base::empty();}
- _LIBCPP_HIDE_FROM_ABI
- size_type max_size() const _NOEXCEPT
- {
- return std::min<size_type>(
- base::__node_alloc_max_size(),
- numeric_limits<difference_type >::max());
- }
-
- _LIBCPP_HIDE_FROM_ABI
- iterator begin() _NOEXCEPT {return base::begin();}
- _LIBCPP_HIDE_FROM_ABI
- const_iterator begin() const _NOEXCEPT {return base::begin();}
- _LIBCPP_HIDE_FROM_ABI
- iterator end() _NOEXCEPT {return base::end();}
- _LIBCPP_HIDE_FROM_ABI
- const_iterator end() const _NOEXCEPT {return base::end();}
- _LIBCPP_HIDE_FROM_ABI
- const_iterator cbegin() const _NOEXCEPT {return base::begin();}
- _LIBCPP_HIDE_FROM_ABI
- const_iterator cend() const _NOEXCEPT {return base::end();}
-
- _LIBCPP_HIDE_FROM_ABI
- reverse_iterator rbegin() _NOEXCEPT
- {return reverse_iterator(end());}
- _LIBCPP_HIDE_FROM_ABI
- const_reverse_iterator rbegin() const _NOEXCEPT
- {return const_reverse_iterator(end());}
- _LIBCPP_HIDE_FROM_ABI
- reverse_iterator rend() _NOEXCEPT
- {return reverse_iterator(begin());}
- _LIBCPP_HIDE_FROM_ABI
- const_reverse_iterator rend() const _NOEXCEPT
- {return const_reverse_iterator(begin());}
- _LIBCPP_HIDE_FROM_ABI
- const_reverse_iterator crbegin() const _NOEXCEPT
- {return const_reverse_iterator(end());}
- _LIBCPP_HIDE_FROM_ABI
- const_reverse_iterator crend() const _NOEXCEPT
- {return const_reverse_iterator(begin());}
-
- _LIBCPP_HIDE_FROM_ABI
- reference front()
- {
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(!empty(), "list::front called on empty list");
- return base::__end_.__next_->__as_node()->__get_value();
- }
- _LIBCPP_HIDE_FROM_ABI
- const_reference front() const
- {
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(!empty(), "list::front called on empty list");
- return base::__end_.__next_->__as_node()->__get_value();
- }
- _LIBCPP_HIDE_FROM_ABI
- reference back()
- {
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(!empty(), "list::back called on empty list");
- return base::__end_.__prev_->__as_node()->__get_value();
- }
- _LIBCPP_HIDE_FROM_ABI
- const_reference back() const
- {
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(!empty(), "list::back called on empty list");
- return base::__end_.__prev_->__as_node()->__get_value();
- }
+ _LIBCPP_HIDE_FROM_ABI void assign(size_type __n, const value_type& __x);
-#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI void push_front(value_type&& __x);
- _LIBCPP_HIDE_FROM_ABI void push_back(value_type&& __x);
+ _LIBCPP_HIDE_FROM_ABI allocator_type get_allocator() const _NOEXCEPT;
-#if _LIBCPP_STD_VER >= 23
- template <_ContainerCompatibleRange<_Tp> _Range>
- _LIBCPP_HIDE_FROM_ABI
- void prepend_range(_Range&& __range) {
- insert_range(begin(), std::forward<_Range>(__range));
- }
+ _LIBCPP_HIDE_FROM_ABI size_type size() const _NOEXCEPT { return base::__sz(); }
+ _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_HIDE_FROM_ABI bool empty() const _NOEXCEPT { return base::empty(); }
+ _LIBCPP_HIDE_FROM_ABI size_type max_size() const _NOEXCEPT {
+ return std::min<size_type>(base::__node_alloc_max_size(), numeric_limits<difference_type >::max());
+ }
- template <_ContainerCompatibleRange<_Tp> _Range>
- _LIBCPP_HIDE_FROM_ABI
- void append_range(_Range&& __range) {
- insert_range(end(), std::forward<_Range>(__range));
- }
-#endif
+ _LIBCPP_HIDE_FROM_ABI iterator begin() _NOEXCEPT { return base::begin(); }
+ _LIBCPP_HIDE_FROM_ABI const_iterator begin() const _NOEXCEPT { return base::begin(); }
+ _LIBCPP_HIDE_FROM_ABI iterator end() _NOEXCEPT { return base::end(); }
+ _LIBCPP_HIDE_FROM_ABI const_iterator end() const _NOEXCEPT { return base::end(); }
+ _LIBCPP_HIDE_FROM_ABI const_iterator cbegin() const _NOEXCEPT { return base::begin(); }
+ _LIBCPP_HIDE_FROM_ABI const_iterator cend() const _NOEXCEPT { return base::end(); }
+
+ _LIBCPP_HIDE_FROM_ABI reverse_iterator rbegin() _NOEXCEPT { return reverse_iterator(end()); }
+ _LIBCPP_HIDE_FROM_ABI const_reverse_iterator rbegin() const _NOEXCEPT { return const_reverse_iterator(end()); }
+ _LIBCPP_HIDE_FROM_ABI reverse_iterator rend() _NOEXCEPT { return reverse_iterator(begin()); }
+ _LIBCPP_HIDE_FROM_ABI const_reverse_iterator rend() const _NOEXCEPT { return const_reverse_iterator(begin()); }
+ _LIBCPP_HIDE_FROM_ABI const_reverse_iterator crbegin() const _NOEXCEPT { return const_reverse_iterator(end()); }
+ _LIBCPP_HIDE_FROM_ABI const_reverse_iterator crend() const _NOEXCEPT { return const_reverse_iterator(begin()); }
+
+ _LIBCPP_HIDE_FROM_ABI reference front() {
+ _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(!empty(), "list::front called on empty list");
+ return base::__end_.__next_->__as_node()->__get_value();
+ }
+ _LIBCPP_HIDE_FROM_ABI const_reference front() const {
+ _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(!empty(), "list::front called on empty list");
+ return base::__end_.__next_->__as_node()->__get_value();
+ }
+ _LIBCPP_HIDE_FROM_ABI reference back() {
+ _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(!empty(), "list::back called on empty list");
+ return base::__end_.__prev_->__as_node()->__get_value();
+ }
+ _LIBCPP_HIDE_FROM_ABI const_reference back() const {
+ _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(!empty(), "list::back called on empty list");
+ return base::__end_.__prev_->__as_node()->__get_value();
+ }
- template <class... _Args>
-#if _LIBCPP_STD_VER >= 17
- _LIBCPP_HIDE_FROM_ABI reference emplace_front(_Args&&... __args);
-#else
- _LIBCPP_HIDE_FROM_ABI void emplace_front(_Args&&... __args);
-#endif
- template <class... _Args>
-#if _LIBCPP_STD_VER >= 17
- _LIBCPP_HIDE_FROM_ABI reference emplace_back(_Args&&... __args);
-#else
- _LIBCPP_HIDE_FROM_ABI void emplace_back(_Args&&... __args);
-#endif
- template <class... _Args>
- _LIBCPP_HIDE_FROM_ABI iterator emplace(const_iterator __p, _Args&&... __args);
+#ifndef _LIBCPP_CXX03_LANG
+ _LIBCPP_HIDE_FROM_ABI void push_front(value_type&& __x);
+ _LIBCPP_HIDE_FROM_ABI void push_back(value_type&& __x);
- _LIBCPP_HIDE_FROM_ABI iterator insert(const_iterator __p, value_type&& __x);
+# if _LIBCPP_STD_VER >= 23
+ template <_ContainerCompatibleRange<_Tp> _Range>
+ _LIBCPP_HIDE_FROM_ABI void prepend_range(_Range&& __range) {
+ insert_range(begin(), std::forward<_Range>(__range));
+ }
- _LIBCPP_HIDE_FROM_ABI
- iterator insert(const_iterator __p, initializer_list<value_type> __il)
- {return insert(__p, __il.begin(), __il.end());}
+ template <_ContainerCompatibleRange<_Tp> _Range>
+ _LIBCPP_HIDE_FROM_ABI void append_range(_Range&& __range) {
+ insert_range(end(), std::forward<_Range>(__range));
+ }
+# endif
+
+ template <class... _Args>
+# if _LIBCPP_STD_VER >= 17
+ _LIBCPP_HIDE_FROM_ABI reference emplace_front(_Args&&... __args);
+# else
+ _LIBCPP_HIDE_FROM_ABI void emplace_front(_Args&&... __args);
+# endif
+ template <class... _Args>
+# if _LIBCPP_STD_VER >= 17
+ _LIBCPP_HIDE_FROM_ABI reference emplace_back(_Args&&... __args);
+# else
+ _LIBCPP_HIDE_FROM_ABI void emplace_back(_Args&&... __args);
+# endif
+ template <class... _Args>
+ _LIBCPP_HIDE_FROM_ABI iterator emplace(const_iterator __p, _Args&&... __args);
+
+ _LIBCPP_HIDE_FROM_ABI iterator insert(const_iterator __p, value_type&& __x);
+
+ _LIBCPP_HIDE_FROM_ABI iterator insert(const_iterator __p, initializer_list<value_type> __il) {
+ return insert(__p, __il.begin(), __il.end());
+ }
#endif // _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI void push_front(const value_type& __x);
- _LIBCPP_HIDE_FROM_ABI void push_back(const value_type& __x);
+ _LIBCPP_HIDE_FROM_ABI void push_front(const value_type& __x);
+ _LIBCPP_HIDE_FROM_ABI void push_back(const value_type& __x);
#ifndef _LIBCPP_CXX03_LANG
- template <class _Arg>
- _LIBCPP_HIDE_FROM_ABI
- void __emplace_back(_Arg&& __arg) { emplace_back(std::forward<_Arg>(__arg)); }
+ template <class _Arg>
+ _LIBCPP_HIDE_FROM_ABI void __emplace_back(_Arg&& __arg) {
+ emplace_back(std::forward<_Arg>(__arg));
+ }
#else
- _LIBCPP_HIDE_FROM_ABI
- void __emplace_back(value_type const& __arg) { push_back(__arg); }
+ _LIBCPP_HIDE_FROM_ABI void __emplace_back(value_type const& __arg) { push_back(__arg); }
#endif
- _LIBCPP_HIDE_FROM_ABI iterator insert(const_iterator __p, const value_type& __x);
- _LIBCPP_HIDE_FROM_ABI iterator insert(const_iterator __p, size_type __n, const value_type& __x);
- template <class _InpIter>
- _LIBCPP_HIDE_FROM_ABI iterator insert(const_iterator __p, _InpIter __f, _InpIter __l,
- __enable_if_t<__has_input_iterator_category<_InpIter>::value>* = 0);
+ _LIBCPP_HIDE_FROM_ABI iterator insert(const_iterator __p, const value_type& __x);
+ _LIBCPP_HIDE_FROM_ABI iterator insert(const_iterator __p, size_type __n, const value_type& __x);
+ template <class _InpIter>
+ _LIBCPP_HIDE_FROM_ABI iterator
+ insert(const_iterator __p,
+ _InpIter __f,
+ _InpIter __l,
+ __enable_if_t<__has_input_iterator_category<_InpIter>::value>* = 0);
#if _LIBCPP_STD_VER >= 23
- template <_ContainerCompatibleRange<_Tp> _Range>
- _LIBCPP_HIDE_FROM_ABI
- iterator insert_range(const_iterator __position, _Range&& __range) {
- return __insert_with_sentinel(__position, ranges::begin(__range), ranges::end(__range));
- }
+ template <_ContainerCompatibleRange<_Tp> _Range>
+ _LIBCPP_HIDE_FROM_ABI iterator insert_range(const_iterator __position, _Range&& __range) {
+ return __insert_with_sentinel(__position, ranges::begin(__range), ranges::end(__range));
+ }
#endif
- _LIBCPP_HIDE_FROM_ABI
- void swap(list& __c)
+ _LIBCPP_HIDE_FROM_ABI void swap(list& __c)
#if _LIBCPP_STD_VER >= 14
- _NOEXCEPT
+ _NOEXCEPT
#else
- _NOEXCEPT_(!__node_alloc_traits::propagate_on_container_swap::value ||
- __is_nothrow_swappable<__node_allocator>::value)
+ _NOEXCEPT_(!__node_alloc_traits::propagate_on_container_swap::value ||
+ __is_nothrow_swappable<__node_allocator>::value)
#endif
- {base::swap(__c);}
- _LIBCPP_HIDE_FROM_ABI
- void clear() _NOEXCEPT {base::clear();}
+ {
+ base::swap(__c);
+ }
+ _LIBCPP_HIDE_FROM_ABI void clear() _NOEXCEPT { base::clear(); }
- _LIBCPP_HIDE_FROM_ABI void pop_front();
- _LIBCPP_HIDE_FROM_ABI void pop_back();
+ _LIBCPP_HIDE_FROM_ABI void pop_front();
+ _LIBCPP_HIDE_FROM_ABI void pop_back();
- _LIBCPP_HIDE_FROM_ABI iterator erase(const_iterator __p);
- _LIBCPP_HIDE_FROM_ABI iterator erase(const_iterator __f, const_iterator __l);
+ _LIBCPP_HIDE_FROM_ABI iterator erase(const_iterator __p);
+ _LIBCPP_HIDE_FROM_ABI iterator erase(const_iterator __f, const_iterator __l);
- _LIBCPP_HIDE_FROM_ABI void resize(size_type __n);
- _LIBCPP_HIDE_FROM_ABI void resize(size_type __n, const value_type& __x);
+ _LIBCPP_HIDE_FROM_ABI void resize(size_type __n);
+ _LIBCPP_HIDE_FROM_ABI void resize(size_type __n, const value_type& __x);
- _LIBCPP_HIDE_FROM_ABI void splice(const_iterator __p, list& __c);
+ _LIBCPP_HIDE_FROM_ABI void splice(const_iterator __p, list& __c);
#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI
- void splice(const_iterator __p, list&& __c) {splice(__p, __c);}
- _LIBCPP_HIDE_FROM_ABI
- void splice(const_iterator __p, list&& __c, const_iterator __i)
- {splice(__p, __c, __i);}
- _LIBCPP_HIDE_FROM_ABI
- void splice(const_iterator __p, list&& __c, const_iterator __f, const_iterator __l)
- {splice(__p, __c, __f, __l);}
+ _LIBCPP_HIDE_FROM_ABI void splice(const_iterator __p, list&& __c) { splice(__p, __c); }
+ _LIBCPP_HIDE_FROM_ABI void splice(const_iterator __p, list&& __c, const_iterator __i) { splice(__p, __c, __i); }
+ _LIBCPP_HIDE_FROM_ABI void splice(const_iterator __p, list&& __c, const_iterator __f, const_iterator __l) {
+ splice(__p, __c, __f, __l);
+ }
#endif
- _LIBCPP_HIDE_FROM_ABI void splice(const_iterator __p, list& __c, const_iterator __i);
- _LIBCPP_HIDE_FROM_ABI void splice(const_iterator __p, list& __c, const_iterator __f, const_iterator __l);
-
- _LIBCPP_HIDE_FROM_ABI __remove_return_type remove(const value_type& __x);
- template <class _Pred>
- _LIBCPP_HIDE_FROM_ABI __remove_return_type remove_if(_Pred __pred);
- _LIBCPP_HIDE_FROM_ABI
- __remove_return_type unique() { return unique(__equal_to()); }
- template <class _BinaryPred>
- _LIBCPP_HIDE_FROM_ABI __remove_return_type unique(_BinaryPred __binary_pred);
- _LIBCPP_HIDE_FROM_ABI
- void merge(list& __c);
+ _LIBCPP_HIDE_FROM_ABI void splice(const_iterator __p, list& __c, const_iterator __i);
+ _LIBCPP_HIDE_FROM_ABI void splice(const_iterator __p, list& __c, const_iterator __f, const_iterator __l);
+
+ _LIBCPP_HIDE_FROM_ABI __remove_return_type remove(const value_type& __x);
+ template <class _Pred>
+ _LIBCPP_HIDE_FROM_ABI __remove_return_type remove_if(_Pred __pred);
+ _LIBCPP_HIDE_FROM_ABI __remove_return_type unique() { return unique(__equal_to()); }
+ template <class _BinaryPred>
+ _LIBCPP_HIDE_FROM_ABI __remove_return_type unique(_BinaryPred __binary_pred);
+ _LIBCPP_HIDE_FROM_ABI void merge(list& __c);
#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI
- void merge(list&& __c) {merge(__c);}
+ _LIBCPP_HIDE_FROM_ABI void merge(list&& __c) { merge(__c); }
- template <class _Comp>
- _LIBCPP_HIDE_FROM_ABI
- void merge(list&& __c, _Comp __comp) {merge(__c, __comp);}
+ template <class _Comp>
+ _LIBCPP_HIDE_FROM_ABI void merge(list&& __c, _Comp __comp) {
+ merge(__c, __comp);
+ }
#endif
- template <class _Comp>
- _LIBCPP_HIDE_FROM_ABI void merge(list& __c, _Comp __comp);
+ template <class _Comp>
+ _LIBCPP_HIDE_FROM_ABI void merge(list& __c, _Comp __comp);
- _LIBCPP_HIDE_FROM_ABI
- void sort();
- template <class _Comp>
- _LIBCPP_HIDE_FROM_ABI
- void sort(_Comp __comp);
+ _LIBCPP_HIDE_FROM_ABI void sort();
+ template <class _Comp>
+ _LIBCPP_HIDE_FROM_ABI void sort(_Comp __comp);
- _LIBCPP_HIDE_FROM_ABI void reverse() _NOEXCEPT;
+ _LIBCPP_HIDE_FROM_ABI void reverse() _NOEXCEPT;
- _LIBCPP_HIDE_FROM_ABI bool __invariants() const;
+ _LIBCPP_HIDE_FROM_ABI bool __invariants() const;
private:
- template <class _Iterator, class _Sentinel>
- _LIBCPP_HIDE_FROM_ABI
- void __assign_with_sentinel(_Iterator __f, _Sentinel __l);
-
- template <class _Iterator, class _Sentinel>
- _LIBCPP_HIDE_FROM_ABI
- iterator __insert_with_sentinel(const_iterator __p, _Iterator __f, _Sentinel __l);
-
- _LIBCPP_HIDE_FROM_ABI
- static void __link_nodes (__link_pointer __p, __link_pointer __f, __link_pointer __l);
- _LIBCPP_HIDE_FROM_ABI
- void __link_nodes_at_front(__link_pointer __f, __link_pointer __l);
- _LIBCPP_HIDE_FROM_ABI
- void __link_nodes_at_back (__link_pointer __f, __link_pointer __l);
- _LIBCPP_HIDE_FROM_ABI iterator __iterator(size_type __n);
- // TODO: Make this _LIBCPP_HIDE_FROM_ABI
- template <class _Comp>
- _LIBCPP_HIDDEN static iterator __sort(iterator __f1, iterator __e2, size_type __n, _Comp& __comp);
-
- _LIBCPP_HIDE_FROM_ABI void __move_assign(list& __c, true_type)
- _NOEXCEPT_(is_nothrow_move_assignable<__node_allocator>::value);
- _LIBCPP_HIDE_FROM_ABI void __move_assign(list& __c, false_type);
+ template <class _Iterator, class _Sentinel>
+ _LIBCPP_HIDE_FROM_ABI void __assign_with_sentinel(_Iterator __f, _Sentinel __l);
+
+ template <class _Iterator, class _Sentinel>
+ _LIBCPP_HIDE_FROM_ABI iterator __insert_with_sentinel(const_iterator __p, _Iterator __f, _Sentinel __l);
+
+ _LIBCPP_HIDE_FROM_ABI static void __link_nodes(__link_pointer __p, __link_pointer __f, __link_pointer __l);
+ _LIBCPP_HIDE_FROM_ABI void __link_nodes_at_front(__link_pointer __f, __link_pointer __l);
+ _LIBCPP_HIDE_FROM_ABI void __link_nodes_at_back(__link_pointer __f, __link_pointer __l);
+ _LIBCPP_HIDE_FROM_ABI iterator __iterator(size_type __n);
+ // TODO: Make this _LIBCPP_HIDE_FROM_ABI
+ template <class _Comp>
+ _LIBCPP_HIDDEN static iterator __sort(iterator __f1, iterator __e2, size_type __n, _Comp& __comp);
+
+ _LIBCPP_HIDE_FROM_ABI void __move_assign(list& __c, true_type)
+ _NOEXCEPT_(is_nothrow_move_assignable<__node_allocator>::value);
+ _LIBCPP_HIDE_FROM_ABI void __move_assign(list& __c, false_type);
};
#if _LIBCPP_STD_VER >= 17
-template<class _InputIterator,
- class _Alloc = allocator<__iter_value_type<_InputIterator>>,
- class = enable_if_t<__has_input_iterator_category<_InputIterator>::value>,
- class = enable_if_t<__is_allocator<_Alloc>::value>
- >
-list(_InputIterator, _InputIterator)
- -> list<__iter_value_type<_InputIterator>, _Alloc>;
-
-template<class _InputIterator,
- class _Alloc,
- class = enable_if_t<__has_input_iterator_category<_InputIterator>::value>,
- class = enable_if_t<__is_allocator<_Alloc>::value>
- >
-list(_InputIterator, _InputIterator, _Alloc)
- -> list<__iter_value_type<_InputIterator>, _Alloc>;
+template <class _InputIterator,
+ class _Alloc = allocator<__iter_value_type<_InputIterator>>,
+ class = enable_if_t<__has_input_iterator_category<_InputIterator>::value>,
+ class = enable_if_t<__is_allocator<_Alloc>::value> >
+list(_InputIterator, _InputIterator) -> list<__iter_value_type<_InputIterator>, _Alloc>;
+
+template <class _InputIterator,
+ class _Alloc,
+ class = enable_if_t<__has_input_iterator_category<_InputIterator>::value>,
+ class = enable_if_t<__is_allocator<_Alloc>::value> >
+list(_InputIterator, _InputIterator, _Alloc) -> list<__iter_value_type<_InputIterator>, _Alloc>;
#endif
#if _LIBCPP_STD_VER >= 23
template <ranges::input_range _Range,
class _Alloc = allocator<ranges::range_value_t<_Range>>,
- class = enable_if_t<__is_allocator<_Alloc>::value>
- >
-list(from_range_t, _Range&&, _Alloc = _Alloc())
- -> list<ranges::range_value_t<_Range>, _Alloc>;
+ class = enable_if_t<__is_allocator<_Alloc>::value> >
+list(from_range_t, _Range&&, _Alloc = _Alloc()) -> list<ranges::range_value_t<_Range>, _Alloc>;
#endif
// Link in nodes [__f, __l] just prior to __p
template <class _Tp, class _Alloc>
-inline
-void
-list<_Tp, _Alloc>::__link_nodes(__link_pointer __p, __link_pointer __f, __link_pointer __l)
-{
- __p->__prev_->__next_ = __f;
- __f->__prev_ = __p->__prev_;
- __p->__prev_ = __l;
- __l->__next_ = __p;
+inline void list<_Tp, _Alloc>::__link_nodes(__link_pointer __p, __link_pointer __f, __link_pointer __l) {
+ __p->__prev_->__next_ = __f;
+ __f->__prev_ = __p->__prev_;
+ __p->__prev_ = __l;
+ __l->__next_ = __p;
}
// Link in nodes [__f, __l] at the front of the list
template <class _Tp, class _Alloc>
-inline
-void
-list<_Tp, _Alloc>::__link_nodes_at_front(__link_pointer __f, __link_pointer __l)
-{
- __f->__prev_ = base::__end_as_link();
- __l->__next_ = base::__end_.__next_;
- __l->__next_->__prev_ = __l;
- base::__end_.__next_ = __f;
+inline void list<_Tp, _Alloc>::__link_nodes_at_front(__link_pointer __f, __link_pointer __l) {
+ __f->__prev_ = base::__end_as_link();
+ __l->__next_ = base::__end_.__next_;
+ __l->__next_->__prev_ = __l;
+ base::__end_.__next_ = __f;
}
// Link in nodes [__f, __l] at the back of the list
template <class _Tp, class _Alloc>
-inline
-void
-list<_Tp, _Alloc>::__link_nodes_at_back(__link_pointer __f, __link_pointer __l)
-{
- __l->__next_ = base::__end_as_link();
- __f->__prev_ = base::__end_.__prev_;
- __f->__prev_->__next_ = __f;
- base::__end_.__prev_ = __l;
+inline void list<_Tp, _Alloc>::__link_nodes_at_back(__link_pointer __f, __link_pointer __l) {
+ __l->__next_ = base::__end_as_link();
+ __f->__prev_ = base::__end_.__prev_;
+ __f->__prev_->__next_ = __f;
+ base::__end_.__prev_ = __l;
}
-
template <class _Tp, class _Alloc>
-inline
-typename list<_Tp, _Alloc>::iterator
-list<_Tp, _Alloc>::__iterator(size_type __n)
-{
- return __n <= base::__sz() / 2 ? std::next(begin(), __n)
- : std::prev(end(), base::__sz() - __n);
+inline typename list<_Tp, _Alloc>::iterator list<_Tp, _Alloc>::__iterator(size_type __n) {
+ return __n <= base::__sz() / 2 ? std::next(begin(), __n) : std::prev(end(), base::__sz() - __n);
}
template <class _Tp, class _Alloc>
-list<_Tp, _Alloc>::list(size_type __n)
-{
- for (; __n > 0; --__n)
+list<_Tp, _Alloc>::list(size_type __n) {
+ for (; __n > 0; --__n)
#ifndef _LIBCPP_CXX03_LANG
- emplace_back();
+ emplace_back();
#else
- push_back(value_type());
+ push_back(value_type());
#endif
}
#if _LIBCPP_STD_VER >= 14
template <class _Tp, class _Alloc>
-list<_Tp, _Alloc>::list(size_type __n, const allocator_type& __a) : base(__a)
-{
- for (; __n > 0; --__n)
- emplace_back();
+list<_Tp, _Alloc>::list(size_type __n, const allocator_type& __a) : base(__a) {
+ for (; __n > 0; --__n)
+ emplace_back();
}
#endif
template <class _Tp, class _Alloc>
-list<_Tp, _Alloc>::list(size_type __n, const value_type& __x)
-{
- for (; __n > 0; --__n)
- push_back(__x);
+list<_Tp, _Alloc>::list(size_type __n, const value_type& __x) {
+ for (; __n > 0; --__n)
+ push_back(__x);
}
template <class _Tp, class _Alloc>
template <class _InpIter>
-list<_Tp, _Alloc>::list(_InpIter __f, _InpIter __l,
- __enable_if_t<__has_input_iterator_category<_InpIter>::value>*)
-{
- for (; __f != __l; ++__f)
- __emplace_back(*__f);
+list<_Tp, _Alloc>::list(_InpIter __f, _InpIter __l, __enable_if_t<__has_input_iterator_category<_InpIter>::value>*) {
+ for (; __f != __l; ++__f)
+ __emplace_back(*__f);
}
template <class _Tp, class _Alloc>
template <class _InpIter>
-list<_Tp, _Alloc>::list(_InpIter __f, _InpIter __l, const allocator_type& __a,
+list<_Tp, _Alloc>::list(_InpIter __f,
+ _InpIter __l,
+ const allocator_type& __a,
__enable_if_t<__has_input_iterator_category<_InpIter>::value>*)
- : base(__a)
-{
- for (; __f != __l; ++__f)
- __emplace_back(*__f);
+ : base(__a) {
+ for (; __f != __l; ++__f)
+ __emplace_back(*__f);
}
template <class _Tp, class _Alloc>
list<_Tp, _Alloc>::list(const list& __c)
- : base(__node_alloc_traits::select_on_container_copy_construction(
- __c.__node_alloc())) {
- for (const_iterator __i = __c.begin(), __e = __c.end(); __i != __e; ++__i)
- push_back(*__i);
+ : base(__node_alloc_traits::select_on_container_copy_construction(__c.__node_alloc())) {
+ for (const_iterator __i = __c.begin(), __e = __c.end(); __i != __e; ++__i)
+ push_back(*__i);
}
template <class _Tp, class _Alloc>
-list<_Tp, _Alloc>::list(const list& __c, const __type_identity_t<allocator_type>& __a)
- : base(__a)
-{
- for (const_iterator __i = __c.begin(), __e = __c.end(); __i != __e; ++__i)
- push_back(*__i);
+list<_Tp, _Alloc>::list(const list& __c, const __type_identity_t<allocator_type>& __a) : base(__a) {
+ for (const_iterator __i = __c.begin(), __e = __c.end(); __i != __e; ++__i)
+ push_back(*__i);
}
#ifndef _LIBCPP_CXX03_LANG
template <class _Tp, class _Alloc>
-list<_Tp, _Alloc>::list(initializer_list<value_type> __il, const allocator_type& __a)
- : base(__a)
-{
- for (typename initializer_list<value_type>::const_iterator __i = __il.begin(),
- __e = __il.end(); __i != __e; ++__i)
- push_back(*__i);
+list<_Tp, _Alloc>::list(initializer_list<value_type> __il, const allocator_type& __a) : base(__a) {
+ for (typename initializer_list<value_type>::const_iterator __i = __il.begin(), __e = __il.end(); __i != __e; ++__i)
+ push_back(*__i);
}
template <class _Tp, class _Alloc>
-list<_Tp, _Alloc>::list(initializer_list<value_type> __il)
-{
- for (typename initializer_list<value_type>::const_iterator __i = __il.begin(),
- __e = __il.end(); __i != __e; ++__i)
- push_back(*__i);
+list<_Tp, _Alloc>::list(initializer_list<value_type> __il) {
+ for (typename initializer_list<value_type>::const_iterator __i = __il.begin(), __e = __il.end(); __i != __e; ++__i)
+ push_back(*__i);
}
template <class _Tp, class _Alloc>
-inline list<_Tp, _Alloc>::list(list&& __c)
- _NOEXCEPT_(is_nothrow_move_constructible<__node_allocator>::value)
- : base(std::move(__c.__node_alloc())) {
- splice(end(), __c);
+inline list<_Tp, _Alloc>::list(list&& __c) _NOEXCEPT_(is_nothrow_move_constructible<__node_allocator>::value)
+ : base(std::move(__c.__node_alloc())) {
+ splice(end(), __c);
}
template <class _Tp, class _Alloc>
-inline
-list<_Tp, _Alloc>::list(list&& __c, const __type_identity_t<allocator_type>& __a)
- : base(__a)
-{
- if (__a == __c.get_allocator())
- splice(end(), __c);
- else
- {
- typedef move_iterator<iterator> _Ip;
- assign(_Ip(__c.begin()), _Ip(__c.end()));
- }
+inline list<_Tp, _Alloc>::list(list&& __c, const __type_identity_t<allocator_type>& __a) : base(__a) {
+ if (__a == __c.get_allocator())
+ splice(end(), __c);
+ else {
+ typedef move_iterator<iterator> _Ip;
+ assign(_Ip(__c.begin()), _Ip(__c.end()));
+ }
}
template <class _Tp, class _Alloc>
-inline
-list<_Tp, _Alloc>&
-list<_Tp, _Alloc>::operator=(list&& __c)
- _NOEXCEPT_(
- __node_alloc_traits::propagate_on_container_move_assignment::value &&
- is_nothrow_move_assignable<__node_allocator>::value)
-{
- __move_assign(__c, integral_constant<bool,
- __node_alloc_traits::propagate_on_container_move_assignment::value>());
- return *this;
+inline list<_Tp, _Alloc>& list<_Tp, _Alloc>::operator=(list&& __c)
+ _NOEXCEPT_(__node_alloc_traits::propagate_on_container_move_assignment::value&&
+ is_nothrow_move_assignable<__node_allocator>::value) {
+ __move_assign(__c, integral_constant<bool, __node_alloc_traits::propagate_on_container_move_assignment::value>());
+ return *this;
}
template <class _Tp, class _Alloc>
-void
-list<_Tp, _Alloc>::__move_assign(list& __c, false_type)
-{
- if (base::__node_alloc() != __c.__node_alloc())
- {
- typedef move_iterator<iterator> _Ip;
- assign(_Ip(__c.begin()), _Ip(__c.end()));
- }
- else
- __move_assign(__c, true_type());
+void list<_Tp, _Alloc>::__move_assign(list& __c, false_type) {
+ if (base::__node_alloc() != __c.__node_alloc()) {
+ typedef move_iterator<iterator> _Ip;
+ assign(_Ip(__c.begin()), _Ip(__c.end()));
+ } else
+ __move_assign(__c, true_type());
}
template <class _Tp, class _Alloc>
-void
-list<_Tp, _Alloc>::__move_assign(list& __c, true_type)
- _NOEXCEPT_(is_nothrow_move_assignable<__node_allocator>::value)
-{
- clear();
- base::__move_assign_alloc(__c);
- splice(end(), __c);
+void list<_Tp, _Alloc>::__move_assign(list& __c, true_type)
+ _NOEXCEPT_(is_nothrow_move_assignable<__node_allocator>::value) {
+ clear();
+ base::__move_assign_alloc(__c);
+ splice(end(), __c);
}
#endif // _LIBCPP_CXX03_LANG
template <class _Tp, class _Alloc>
-inline
-list<_Tp, _Alloc>&
-list<_Tp, _Alloc>::operator=(const list& __c)
-{
- if (this != std::addressof(__c))
- {
- base::__copy_assign_alloc(__c);
- assign(__c.begin(), __c.end());
- }
- return *this;
+inline list<_Tp, _Alloc>& list<_Tp, _Alloc>::operator=(const list& __c) {
+ if (this != std::addressof(__c)) {
+ base::__copy_assign_alloc(__c);
+ assign(__c.begin(), __c.end());
+ }
+ return *this;
}
template <class _Tp, class _Alloc>
template <class _InpIter>
-void
-list<_Tp, _Alloc>::assign(_InpIter __f, _InpIter __l,
- __enable_if_t<__has_input_iterator_category<_InpIter>::value>*)
-{
+void list<_Tp, _Alloc>::assign(
+ _InpIter __f, _InpIter __l, __enable_if_t<__has_input_iterator_category<_InpIter>::value>*) {
__assign_with_sentinel(__f, __l);
}
template <class _Tp, class _Alloc>
template <class _Iterator, class _Sentinel>
-_LIBCPP_HIDE_FROM_ABI
-void list<_Tp, _Alloc>::__assign_with_sentinel(_Iterator __f, _Sentinel __l) {
- iterator __i = begin();
- iterator __e = end();
- for (; __f != __l && __i != __e; ++__f, (void) ++__i)
- *__i = *__f;
- if (__i == __e)
- __insert_with_sentinel(__e, std::move(__f), std::move(__l));
- else
- erase(__i, __e);
+_LIBCPP_HIDE_FROM_ABI void list<_Tp, _Alloc>::__assign_with_sentinel(_Iterator __f, _Sentinel __l) {
+ iterator __i = begin();
+ iterator __e = end();
+ for (; __f != __l && __i != __e; ++__f, (void)++__i)
+ *__i = *__f;
+ if (__i == __e)
+ __insert_with_sentinel(__e, std::move(__f), std::move(__l));
+ else
+ erase(__i, __e);
}
template <class _Tp, class _Alloc>
-void
-list<_Tp, _Alloc>::assign(size_type __n, const value_type& __x)
-{
- iterator __i = begin();
- iterator __e = end();
- for (; __n > 0 && __i != __e; --__n, (void) ++__i)
- *__i = __x;
- if (__i == __e)
- insert(__e, __n, __x);
- else
- erase(__i, __e);
+void list<_Tp, _Alloc>::assign(size_type __n, const value_type& __x) {
+ iterator __i = begin();
+ iterator __e = end();
+ for (; __n > 0 && __i != __e; --__n, (void)++__i)
+ *__i = __x;
+ if (__i == __e)
+ insert(__e, __n, __x);
+ else
+ erase(__i, __e);
}
template <class _Tp, class _Alloc>
-inline
-_Alloc
-list<_Tp, _Alloc>::get_allocator() const _NOEXCEPT
-{
- return allocator_type(base::__node_alloc());
+inline _Alloc list<_Tp, _Alloc>::get_allocator() const _NOEXCEPT {
+ return allocator_type(base::__node_alloc());
}
template <class _Tp, class _Alloc>
-typename list<_Tp, _Alloc>::iterator
-list<_Tp, _Alloc>::insert(const_iterator __p, const value_type& __x)
-{
- __node_pointer __node = this->__create_node(/* prev = */nullptr, /* next = */nullptr, __x);
- __link_nodes(__p.__ptr_, __node->__as_link(), __node->__as_link());
- ++base::__sz();
- return iterator(__node->__as_link());
+typename list<_Tp, _Alloc>::iterator list<_Tp, _Alloc>::insert(const_iterator __p, const value_type& __x) {
+ __node_pointer __node = this->__create_node(/* prev = */ nullptr, /* next = */ nullptr, __x);
+ __link_nodes(__p.__ptr_, __node->__as_link(), __node->__as_link());
+ ++base::__sz();
+ return iterator(__node->__as_link());
}
template <class _Tp, class _Alloc>
typename list<_Tp, _Alloc>::iterator
-list<_Tp, _Alloc>::insert(const_iterator __p, size_type __n, const value_type& __x)
-{
- iterator __r(__p.__ptr_);
- if (__n > 0)
- {
- size_type __ds = 0;
- __node_pointer __node = this->__create_node(/* prev = */nullptr, /* next = */nullptr, __x);
- ++__ds;
- __r = iterator(__node->__as_link());
- iterator __e = __r;
+list<_Tp, _Alloc>::insert(const_iterator __p, size_type __n, const value_type& __x) {
+ iterator __r(__p.__ptr_);
+ if (__n > 0) {
+ size_type __ds = 0;
+ __node_pointer __node = this->__create_node(/* prev = */ nullptr, /* next = */ nullptr, __x);
+ ++__ds;
+ __r = iterator(__node->__as_link());
+ iterator __e = __r;
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- try
- {
+ try {
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- for (--__n; __n != 0; --__n, (void) ++__e, ++__ds)
- {
- __e.__ptr_->__next_ = this->__create_node(/* prev = */__e.__ptr_, /* next = */nullptr, __x)->__as_link();
- }
+ for (--__n; __n != 0; --__n, (void)++__e, ++__ds) {
+ __e.__ptr_->__next_ = this->__create_node(/* prev = */ __e.__ptr_, /* next = */ nullptr, __x)->__as_link();
+ }
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- }
- catch (...)
- {
- while (true)
- {
- __link_pointer __prev = __e.__ptr_->__prev_;
- __node_pointer __current = __e.__ptr_->__as_node();
- this->__delete_node(__current);
- if (__prev == 0)
- break;
- __e = iterator(__prev);
- }
- throw;
- }
-#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- __link_nodes(__p.__ptr_, __r.__ptr_, __e.__ptr_);
- base::__sz() += __ds;
+ } catch (...) {
+ while (true) {
+ __link_pointer __prev = __e.__ptr_->__prev_;
+ __node_pointer __current = __e.__ptr_->__as_node();
+ this->__delete_node(__current);
+ if (__prev == 0)
+ break;
+ __e = iterator(__prev);
+ }
+ throw;
}
- return __r;
+#endif // _LIBCPP_HAS_NO_EXCEPTIONS
+ __link_nodes(__p.__ptr_, __r.__ptr_, __e.__ptr_);
+ base::__sz() += __ds;
+ }
+ return __r;
}
template <class _Tp, class _Alloc>
template <class _InpIter>
-typename list<_Tp, _Alloc>::iterator
-list<_Tp, _Alloc>::insert(const_iterator __p, _InpIter __f, _InpIter __l,
- __enable_if_t<__has_input_iterator_category<_InpIter>::value>*)
-{
- return __insert_with_sentinel(__p, __f, __l);
+typename list<_Tp, _Alloc>::iterator list<_Tp, _Alloc>::insert(
+ const_iterator __p, _InpIter __f, _InpIter __l, __enable_if_t<__has_input_iterator_category<_InpIter>::value>*) {
+ return __insert_with_sentinel(__p, __f, __l);
}
template <class _Tp, class _Alloc>
template <class _Iterator, class _Sentinel>
-_LIBCPP_HIDE_FROM_ABI
-typename list<_Tp, _Alloc>::iterator
+_LIBCPP_HIDE_FROM_ABI typename list<_Tp, _Alloc>::iterator
list<_Tp, _Alloc>::__insert_with_sentinel(const_iterator __p, _Iterator __f, _Sentinel __l) {
- iterator __r(__p.__ptr_);
- if (__f != __l)
- {
- size_type __ds = 0;
- __node_pointer __node = this->__create_node(/* prev = */nullptr, /* next = */nullptr, *__f);
- ++__ds;
- __r = iterator(__node->__as_link());
- iterator __e = __r;
+ iterator __r(__p.__ptr_);
+ if (__f != __l) {
+ size_type __ds = 0;
+ __node_pointer __node = this->__create_node(/* prev = */ nullptr, /* next = */ nullptr, *__f);
+ ++__ds;
+ __r = iterator(__node->__as_link());
+ iterator __e = __r;
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- try
- {
+ try {
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- for (++__f; __f != __l; ++__f, (void) ++__e, ++__ds)
- {
- __e.__ptr_->__next_ = this->__create_node(/* prev = */__e.__ptr_, /* next = */nullptr, *__f)->__as_link();
- }
+ for (++__f; __f != __l; ++__f, (void)++__e, ++__ds) {
+ __e.__ptr_->__next_ = this->__create_node(/* prev = */ __e.__ptr_, /* next = */ nullptr, *__f)->__as_link();
+ }
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- }
- catch (...)
- {
- while (true)
- {
- __link_pointer __prev = __e.__ptr_->__prev_;
- __node_pointer __current = __e.__ptr_->__as_node();
- this->__delete_node(__current);
- if (__prev == 0)
- break;
- __e = iterator(__prev);
- }
- throw;
- }
-#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- __link_nodes(__p.__ptr_, __r.__ptr_, __e.__ptr_);
- base::__sz() += __ds;
+ } catch (...) {
+ while (true) {
+ __link_pointer __prev = __e.__ptr_->__prev_;
+ __node_pointer __current = __e.__ptr_->__as_node();
+ this->__delete_node(__current);
+ if (__prev == 0)
+ break;
+ __e = iterator(__prev);
+ }
+ throw;
}
- return __r;
+#endif // _LIBCPP_HAS_NO_EXCEPTIONS
+ __link_nodes(__p.__ptr_, __r.__ptr_, __e.__ptr_);
+ base::__sz() += __ds;
+ }
+ return __r;
}
template <class _Tp, class _Alloc>
-void
-list<_Tp, _Alloc>::push_front(const value_type& __x)
-{
- __node_pointer __node = this->__create_node(/* prev = */nullptr, /* next = */nullptr, __x);
- __link_pointer __nl = __node->__as_link();
- __link_nodes_at_front(__nl, __nl);
- ++base::__sz();
+void list<_Tp, _Alloc>::push_front(const value_type& __x) {
+ __node_pointer __node = this->__create_node(/* prev = */ nullptr, /* next = */ nullptr, __x);
+ __link_pointer __nl = __node->__as_link();
+ __link_nodes_at_front(__nl, __nl);
+ ++base::__sz();
}
template <class _Tp, class _Alloc>
-void
-list<_Tp, _Alloc>::push_back(const value_type& __x)
-{
- __node_pointer __node = this->__create_node(/* prev = */nullptr, /* next = */nullptr, __x);
- __link_pointer __nl = __node->__as_link();
- __link_nodes_at_back(__nl, __nl);
- ++base::__sz();
+void list<_Tp, _Alloc>::push_back(const value_type& __x) {
+ __node_pointer __node = this->__create_node(/* prev = */ nullptr, /* next = */ nullptr, __x);
+ __link_pointer __nl = __node->__as_link();
+ __link_nodes_at_back(__nl, __nl);
+ ++base::__sz();
}
#ifndef _LIBCPP_CXX03_LANG
template <class _Tp, class _Alloc>
-void
-list<_Tp, _Alloc>::push_front(value_type&& __x)
-{
- __node_pointer __node = this->__create_node(/* prev = */nullptr, /* next = */nullptr, std::move(__x));
- __link_pointer __nl = __node->__as_link();
- __link_nodes_at_front(__nl, __nl);
- ++base::__sz();
+void list<_Tp, _Alloc>::push_front(value_type&& __x) {
+ __node_pointer __node = this->__create_node(/* prev = */ nullptr, /* next = */ nullptr, std::move(__x));
+ __link_pointer __nl = __node->__as_link();
+ __link_nodes_at_front(__nl, __nl);
+ ++base::__sz();
}
template <class _Tp, class _Alloc>
-void
-list<_Tp, _Alloc>::push_back(value_type&& __x)
-{
- __node_pointer __node = this->__create_node(/* prev = */nullptr, /* next = */nullptr, std::move(__x));
- __link_pointer __nl = __node->__as_link();
- __link_nodes_at_back(__nl, __nl);
- ++base::__sz();
+void list<_Tp, _Alloc>::push_back(value_type&& __x) {
+ __node_pointer __node = this->__create_node(/* prev = */ nullptr, /* next = */ nullptr, std::move(__x));
+ __link_pointer __nl = __node->__as_link();
+ __link_nodes_at_back(__nl, __nl);
+ ++base::__sz();
}
template <class _Tp, class _Alloc>
template <class... _Args>
-#if _LIBCPP_STD_VER >= 17
+# if _LIBCPP_STD_VER >= 17
typename list<_Tp, _Alloc>::reference
-#else
+# else
void
-#endif
-list<_Tp, _Alloc>::emplace_front(_Args&&... __args)
-{
- __node_pointer __node = this->__create_node(/* prev = */nullptr, /* next = */nullptr, std::forward<_Args>(__args)...);
- __link_pointer __nl = __node->__as_link();
- __link_nodes_at_front(__nl, __nl);
- ++base::__sz();
-#if _LIBCPP_STD_VER >= 17
- return __node->__get_value();
-#endif
+# endif
+list<_Tp, _Alloc>::emplace_front(_Args&&... __args) {
+ __node_pointer __node =
+ this->__create_node(/* prev = */ nullptr, /* next = */ nullptr, std::forward<_Args>(__args)...);
+ __link_pointer __nl = __node->__as_link();
+ __link_nodes_at_front(__nl, __nl);
+ ++base::__sz();
+# if _LIBCPP_STD_VER >= 17
+ return __node->__get_value();
+# endif
}
template <class _Tp, class _Alloc>
template <class... _Args>
-#if _LIBCPP_STD_VER >= 17
+# if _LIBCPP_STD_VER >= 17
typename list<_Tp, _Alloc>::reference
-#else
+# else
void
-#endif
-list<_Tp, _Alloc>::emplace_back(_Args&&... __args)
-{
- __node_pointer __node = this->__create_node(/* prev = */nullptr, /* next = */nullptr, std::forward<_Args>(__args)...);
- __link_pointer __nl = __node->__as_link();
- __link_nodes_at_back(__nl, __nl);
- ++base::__sz();
-#if _LIBCPP_STD_VER >= 17
- return __node->__get_value();
-#endif
+# endif
+list<_Tp, _Alloc>::emplace_back(_Args&&... __args) {
+ __node_pointer __node =
+ this->__create_node(/* prev = */ nullptr, /* next = */ nullptr, std::forward<_Args>(__args)...);
+ __link_pointer __nl = __node->__as_link();
+ __link_nodes_at_back(__nl, __nl);
+ ++base::__sz();
+# if _LIBCPP_STD_VER >= 17
+ return __node->__get_value();
+# endif
}
template <class _Tp, class _Alloc>
template <class... _Args>
-typename list<_Tp, _Alloc>::iterator
-list<_Tp, _Alloc>::emplace(const_iterator __p, _Args&&... __args)
-{
- __node_pointer __node = this->__create_node(/* prev = */nullptr, /* next = */nullptr, std::forward<_Args>(__args)...);
- __link_pointer __nl = __node->__as_link();
- __link_nodes(__p.__ptr_, __nl, __nl);
- ++base::__sz();
- return iterator(__nl);
+typename list<_Tp, _Alloc>::iterator list<_Tp, _Alloc>::emplace(const_iterator __p, _Args&&... __args) {
+ __node_pointer __node =
+ this->__create_node(/* prev = */ nullptr, /* next = */ nullptr, std::forward<_Args>(__args)...);
+ __link_pointer __nl = __node->__as_link();
+ __link_nodes(__p.__ptr_, __nl, __nl);
+ ++base::__sz();
+ return iterator(__nl);
}
template <class _Tp, class _Alloc>
-typename list<_Tp, _Alloc>::iterator
-list<_Tp, _Alloc>::insert(const_iterator __p, value_type&& __x)
-{
- __node_pointer __node = this->__create_node(/* prev = */nullptr, /* next = */nullptr, std::move(__x));
- __link_pointer __nl = __node->__as_link();
- __link_nodes(__p.__ptr_, __nl, __nl);
- ++base::__sz();
- return iterator(__nl);
+typename list<_Tp, _Alloc>::iterator list<_Tp, _Alloc>::insert(const_iterator __p, value_type&& __x) {
+ __node_pointer __node = this->__create_node(/* prev = */ nullptr, /* next = */ nullptr, std::move(__x));
+ __link_pointer __nl = __node->__as_link();
+ __link_nodes(__p.__ptr_, __nl, __nl);
+ ++base::__sz();
+ return iterator(__nl);
}
#endif // _LIBCPP_CXX03_LANG
template <class _Tp, class _Alloc>
-void
-list<_Tp, _Alloc>::pop_front()
-{
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(!empty(), "list::pop_front() called with empty list");
- __link_pointer __n = base::__end_.__next_;
- base::__unlink_nodes(__n, __n);
- --base::__sz();
- this->__delete_node(__n->__as_node());
+void list<_Tp, _Alloc>::pop_front() {
+ _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(!empty(), "list::pop_front() called with empty list");
+ __link_pointer __n = base::__end_.__next_;
+ base::__unlink_nodes(__n, __n);
+ --base::__sz();
+ this->__delete_node(__n->__as_node());
}
template <class _Tp, class _Alloc>
-void
-list<_Tp, _Alloc>::pop_back()
-{
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(!empty(), "list::pop_back() called on an empty list");
- __link_pointer __n = base::__end_.__prev_;
- base::__unlink_nodes(__n, __n);
- --base::__sz();
- this->__delete_node(__n->__as_node());
+void list<_Tp, _Alloc>::pop_back() {
+ _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(!empty(), "list::pop_back() called on an empty list");
+ __link_pointer __n = base::__end_.__prev_;
+ base::__unlink_nodes(__n, __n);
+ --base::__sz();
+ this->__delete_node(__n->__as_node());
}
template <class _Tp, class _Alloc>
-typename list<_Tp, _Alloc>::iterator
-list<_Tp, _Alloc>::erase(const_iterator __p)
-{
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__p != end(),
- "list::erase(iterator) called with a non-dereferenceable iterator");
- __link_pointer __n = __p.__ptr_;
- __link_pointer __r = __n->__next_;
- base::__unlink_nodes(__n, __n);
- --base::__sz();
- this->__delete_node(__n->__as_node());
- return iterator(__r);
+typename list<_Tp, _Alloc>::iterator list<_Tp, _Alloc>::erase(const_iterator __p) {
+ _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__p != end(), "list::erase(iterator) called with a non-dereferenceable iterator");
+ __link_pointer __n = __p.__ptr_;
+ __link_pointer __r = __n->__next_;
+ base::__unlink_nodes(__n, __n);
+ --base::__sz();
+ this->__delete_node(__n->__as_node());
+ return iterator(__r);
}
template <class _Tp, class _Alloc>
-typename list<_Tp, _Alloc>::iterator
-list<_Tp, _Alloc>::erase(const_iterator __f, const_iterator __l)
-{
- if (__f != __l)
- {
- base::__unlink_nodes(__f.__ptr_, __l.__ptr_->__prev_);
- while (__f != __l)
- {
- __link_pointer __n = __f.__ptr_;
- ++__f;
- --base::__sz();
- this->__delete_node(__n->__as_node());
- }
+typename list<_Tp, _Alloc>::iterator list<_Tp, _Alloc>::erase(const_iterator __f, const_iterator __l) {
+ if (__f != __l) {
+ base::__unlink_nodes(__f.__ptr_, __l.__ptr_->__prev_);
+ while (__f != __l) {
+ __link_pointer __n = __f.__ptr_;
+ ++__f;
+ --base::__sz();
+ this->__delete_node(__n->__as_node());
}
- return iterator(__l.__ptr_);
+ }
+ return iterator(__l.__ptr_);
}
template <class _Tp, class _Alloc>
-void
-list<_Tp, _Alloc>::resize(size_type __n)
-{
- if (__n < base::__sz())
- erase(__iterator(__n), end());
- else if (__n > base::__sz())
- {
- __n -= base::__sz();
- size_type __ds = 0;
- __node_pointer __node = this->__create_node(/* prev = */nullptr, /* next = */nullptr);
- ++__ds;
- iterator __r = iterator(__node->__as_link());
- iterator __e = __r;
+void list<_Tp, _Alloc>::resize(size_type __n) {
+ if (__n < base::__sz())
+ erase(__iterator(__n), end());
+ else if (__n > base::__sz()) {
+ __n -= base::__sz();
+ size_type __ds = 0;
+ __node_pointer __node = this->__create_node(/* prev = */ nullptr, /* next = */ nullptr);
+ ++__ds;
+ iterator __r = iterator(__node->__as_link());
+ iterator __e = __r;
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- try
- {
+ try {
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- for (--__n; __n != 0; --__n, (void) ++__e, ++__ds)
- {
- __e.__ptr_->__next_ = this->__create_node(/* prev = */__e.__ptr_, /* next = */nullptr)->__as_link();
- }
+ for (--__n; __n != 0; --__n, (void)++__e, ++__ds) {
+ __e.__ptr_->__next_ = this->__create_node(/* prev = */ __e.__ptr_, /* next = */ nullptr)->__as_link();
+ }
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- }
- catch (...)
- {
- while (true)
- {
- __link_pointer __prev = __e.__ptr_->__prev_;
- __node_pointer __current = __e.__ptr_->__as_node();
- this->__delete_node(__current);
- if (__prev == 0)
- break;
- __e = iterator(__prev);
- }
- throw;
- }
-#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- __link_nodes_at_back(__r.__ptr_, __e.__ptr_);
- base::__sz() += __ds;
+ } catch (...) {
+ while (true) {
+ __link_pointer __prev = __e.__ptr_->__prev_;
+ __node_pointer __current = __e.__ptr_->__as_node();
+ this->__delete_node(__current);
+ if (__prev == 0)
+ break;
+ __e = iterator(__prev);
+ }
+ throw;
}
+#endif // _LIBCPP_HAS_NO_EXCEPTIONS
+ __link_nodes_at_back(__r.__ptr_, __e.__ptr_);
+ base::__sz() += __ds;
+ }
}
template <class _Tp, class _Alloc>
-void
-list<_Tp, _Alloc>::resize(size_type __n, const value_type& __x)
-{
- if (__n < base::__sz())
- erase(__iterator(__n), end());
- else if (__n > base::__sz())
- {
- __n -= base::__sz();
- size_type __ds = 0;
- __node_pointer __node = this->__create_node(/* prev = */nullptr, /* next = */nullptr, __x);
- ++__ds;
- __link_pointer __nl = __node->__as_link();
- iterator __r = iterator(__nl);
- iterator __e = __r;
+void list<_Tp, _Alloc>::resize(size_type __n, const value_type& __x) {
+ if (__n < base::__sz())
+ erase(__iterator(__n), end());
+ else if (__n > base::__sz()) {
+ __n -= base::__sz();
+ size_type __ds = 0;
+ __node_pointer __node = this->__create_node(/* prev = */ nullptr, /* next = */ nullptr, __x);
+ ++__ds;
+ __link_pointer __nl = __node->__as_link();
+ iterator __r = iterator(__nl);
+ iterator __e = __r;
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- try
- {
+ try {
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- for (--__n; __n != 0; --__n, (void) ++__e, ++__ds)
- {
- __e.__ptr_->__next_ = this->__create_node(/* prev = */__e.__ptr_, /* next = */nullptr, __x)->__as_link();
- }
+ for (--__n; __n != 0; --__n, (void)++__e, ++__ds) {
+ __e.__ptr_->__next_ = this->__create_node(/* prev = */ __e.__ptr_, /* next = */ nullptr, __x)->__as_link();
+ }
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- }
- catch (...)
- {
- while (true)
- {
- __link_pointer __prev = __e.__ptr_->__prev_;
- __node_pointer __current = __e.__ptr_->__as_node();
- this->__delete_node(__current);
- if (__prev == 0)
- break;
- __e = iterator(__prev);
- }
- throw;
- }
-#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- __link_nodes(base::__end_as_link(), __r.__ptr_, __e.__ptr_);
- base::__sz() += __ds;
+ } catch (...) {
+ while (true) {
+ __link_pointer __prev = __e.__ptr_->__prev_;
+ __node_pointer __current = __e.__ptr_->__as_node();
+ this->__delete_node(__current);
+ if (__prev == 0)
+ break;
+ __e = iterator(__prev);
+ }
+ throw;
}
+#endif // _LIBCPP_HAS_NO_EXCEPTIONS
+ __link_nodes(base::__end_as_link(), __r.__ptr_, __e.__ptr_);
+ base::__sz() += __ds;
+ }
}
template <class _Tp, class _Alloc>
-void
-list<_Tp, _Alloc>::splice(const_iterator __p, list& __c)
-{
- _LIBCPP_ASSERT_VALID_INPUT_RANGE(this != std::addressof(__c),
- "list::splice(iterator, list) called with this == &list");
- if (!__c.empty())
- {
- __link_pointer __f = __c.__end_.__next_;
- __link_pointer __l = __c.__end_.__prev_;
- base::__unlink_nodes(__f, __l);
- __link_nodes(__p.__ptr_, __f, __l);
- base::__sz() += __c.__sz();
- __c.__sz() = 0;
- }
+void list<_Tp, _Alloc>::splice(const_iterator __p, list& __c) {
+ _LIBCPP_ASSERT_VALID_INPUT_RANGE(
+ this != std::addressof(__c), "list::splice(iterator, list) called with this == &list");
+ if (!__c.empty()) {
+ __link_pointer __f = __c.__end_.__next_;
+ __link_pointer __l = __c.__end_.__prev_;
+ base::__unlink_nodes(__f, __l);
+ __link_nodes(__p.__ptr_, __f, __l);
+ base::__sz() += __c.__sz();
+ __c.__sz() = 0;
+ }
}
template <class _Tp, class _Alloc>
-void
-list<_Tp, _Alloc>::splice(const_iterator __p, list& __c, const_iterator __i)
-{
- if (__p.__ptr_ != __i.__ptr_ && __p.__ptr_ != __i.__ptr_->__next_)
- {
- __link_pointer __f = __i.__ptr_;
- base::__unlink_nodes(__f, __f);
- __link_nodes(__p.__ptr_, __f, __f);
- --__c.__sz();
- ++base::__sz();
- }
+void list<_Tp, _Alloc>::splice(const_iterator __p, list& __c, const_iterator __i) {
+ if (__p.__ptr_ != __i.__ptr_ && __p.__ptr_ != __i.__ptr_->__next_) {
+ __link_pointer __f = __i.__ptr_;
+ base::__unlink_nodes(__f, __f);
+ __link_nodes(__p.__ptr_, __f, __f);
+ --__c.__sz();
+ ++base::__sz();
+ }
}
template <class _Tp, class _Alloc>
-void
-list<_Tp, _Alloc>::splice(const_iterator __p, list& __c, const_iterator __f, const_iterator __l)
-{
- if (__f != __l)
- {
- __link_pointer __first = __f.__ptr_;
- --__l;
- __link_pointer __last = __l.__ptr_;
- if (this != std::addressof(__c))
- {
- size_type __s = std::distance(__f, __l) + 1;
- __c.__sz() -= __s;
- base::__sz() += __s;
- }
- base::__unlink_nodes(__first, __last);
- __link_nodes(__p.__ptr_, __first, __last);
+void list<_Tp, _Alloc>::splice(const_iterator __p, list& __c, const_iterator __f, const_iterator __l) {
+ if (__f != __l) {
+ __link_pointer __first = __f.__ptr_;
+ --__l;
+ __link_pointer __last = __l.__ptr_;
+ if (this != std::addressof(__c)) {
+ size_type __s = std::distance(__f, __l) + 1;
+ __c.__sz() -= __s;
+ base::__sz() += __s;
}
+ base::__unlink_nodes(__first, __last);
+ __link_nodes(__p.__ptr_, __first, __last);
+ }
}
template <class _Tp, class _Alloc>
-typename list<_Tp, _Alloc>::__remove_return_type
-list<_Tp, _Alloc>::remove(const value_type& __x)
-{
- list<_Tp, _Alloc> __deleted_nodes(get_allocator()); // collect the nodes we're removing
- for (const_iterator __i = begin(), __e = end(); __i != __e;)
- {
- if (*__i == __x)
- {
- const_iterator __j = std::next(__i);
- for (; __j != __e && *__j == __x; ++__j)
- ;
- __deleted_nodes.splice(__deleted_nodes.end(), *this, __i, __j);
- __i = __j;
- if (__i != __e)
- ++__i;
- }
- else
- ++__i;
- }
+typename list<_Tp, _Alloc>::__remove_return_type list<_Tp, _Alloc>::remove(const value_type& __x) {
+ list<_Tp, _Alloc> __deleted_nodes(get_allocator()); // collect the nodes we're removing
+ for (const_iterator __i = begin(), __e = end(); __i != __e;) {
+ if (*__i == __x) {
+ const_iterator __j = std::next(__i);
+ for (; __j != __e && *__j == __x; ++__j)
+ ;
+ __deleted_nodes.splice(__deleted_nodes.end(), *this, __i, __j);
+ __i = __j;
+ if (__i != __e)
+ ++__i;
+ } else
+ ++__i;
+ }
- return (__remove_return_type) __deleted_nodes.size();
+ return (__remove_return_type)__deleted_nodes.size();
}
template <class _Tp, class _Alloc>
template <class _Pred>
-typename list<_Tp, _Alloc>::__remove_return_type
-list<_Tp, _Alloc>::remove_if(_Pred __pred)
-{
- list<_Tp, _Alloc> __deleted_nodes(get_allocator()); // collect the nodes we're removing
- for (iterator __i = begin(), __e = end(); __i != __e;)
- {
- if (__pred(*__i))
- {
- iterator __j = std::next(__i);
- for (; __j != __e && __pred(*__j); ++__j)
- ;
- __deleted_nodes.splice(__deleted_nodes.end(), *this, __i, __j);
- __i = __j;
- if (__i != __e)
- ++__i;
- }
- else
- ++__i;
- }
+typename list<_Tp, _Alloc>::__remove_return_type list<_Tp, _Alloc>::remove_if(_Pred __pred) {
+ list<_Tp, _Alloc> __deleted_nodes(get_allocator()); // collect the nodes we're removing
+ for (iterator __i = begin(), __e = end(); __i != __e;) {
+ if (__pred(*__i)) {
+ iterator __j = std::next(__i);
+ for (; __j != __e && __pred(*__j); ++__j)
+ ;
+ __deleted_nodes.splice(__deleted_nodes.end(), *this, __i, __j);
+ __i = __j;
+ if (__i != __e)
+ ++__i;
+ } else
+ ++__i;
+ }
- return (__remove_return_type) __deleted_nodes.size();
+ return (__remove_return_type)__deleted_nodes.size();
}
template <class _Tp, class _Alloc>
template <class _BinaryPred>
-typename list<_Tp, _Alloc>::__remove_return_type
-list<_Tp, _Alloc>::unique(_BinaryPred __binary_pred)
-{
- list<_Tp, _Alloc> __deleted_nodes(get_allocator()); // collect the nodes we're removing
- for (iterator __i = begin(), __e = end(); __i != __e;)
- {
- iterator __j = std::next(__i);
- for (; __j != __e && __binary_pred(*__i, *__j); ++__j)
- ;
- if (++__i != __j) {
- __deleted_nodes.splice(__deleted_nodes.end(), *this, __i, __j);
- __i = __j;
- }
+typename list<_Tp, _Alloc>::__remove_return_type list<_Tp, _Alloc>::unique(_BinaryPred __binary_pred) {
+ list<_Tp, _Alloc> __deleted_nodes(get_allocator()); // collect the nodes we're removing
+ for (iterator __i = begin(), __e = end(); __i != __e;) {
+ iterator __j = std::next(__i);
+ for (; __j != __e && __binary_pred(*__i, *__j); ++__j)
+ ;
+ if (++__i != __j) {
+ __deleted_nodes.splice(__deleted_nodes.end(), *this, __i, __j);
+ __i = __j;
}
+ }
- return (__remove_return_type) __deleted_nodes.size();
+ return (__remove_return_type)__deleted_nodes.size();
}
template <class _Tp, class _Alloc>
-inline
-void
-list<_Tp, _Alloc>::merge(list& __c)
-{
- merge(__c, __less<>());
+inline void list<_Tp, _Alloc>::merge(list& __c) {
+ merge(__c, __less<>());
}
template <class _Tp, class _Alloc>
template <class _Comp>
-void
-list<_Tp, _Alloc>::merge(list& __c, _Comp __comp)
-{
- if (this != std::addressof(__c))
- {
- iterator __f1 = begin();
- iterator __e1 = end();
- iterator __f2 = __c.begin();
- iterator __e2 = __c.end();
- while (__f1 != __e1 && __f2 != __e2)
- {
- if (__comp(*__f2, *__f1))
- {
- size_type __ds = 1;
- iterator __m2 = std::next(__f2);
- for (; __m2 != __e2 && __comp(*__m2, *__f1); ++__m2, (void) ++__ds)
- ;
- base::__sz() += __ds;
- __c.__sz() -= __ds;
- __link_pointer __f = __f2.__ptr_;
- __link_pointer __l = __m2.__ptr_->__prev_;
- __f2 = __m2;
- base::__unlink_nodes(__f, __l);
- __m2 = std::next(__f1);
- __link_nodes(__f1.__ptr_, __f, __l);
- __f1 = __m2;
- }
- else
- ++__f1;
- }
- splice(__e1, __c);
+void list<_Tp, _Alloc>::merge(list& __c, _Comp __comp) {
+ if (this != std::addressof(__c)) {
+ iterator __f1 = begin();
+ iterator __e1 = end();
+ iterator __f2 = __c.begin();
+ iterator __e2 = __c.end();
+ while (__f1 != __e1 && __f2 != __e2) {
+ if (__comp(*__f2, *__f1)) {
+ size_type __ds = 1;
+ iterator __m2 = std::next(__f2);
+ for (; __m2 != __e2 && __comp(*__m2, *__f1); ++__m2, (void)++__ds)
+ ;
+ base::__sz() += __ds;
+ __c.__sz() -= __ds;
+ __link_pointer __f = __f2.__ptr_;
+ __link_pointer __l = __m2.__ptr_->__prev_;
+ __f2 = __m2;
+ base::__unlink_nodes(__f, __l);
+ __m2 = std::next(__f1);
+ __link_nodes(__f1.__ptr_, __f, __l);
+ __f1 = __m2;
+ } else
+ ++__f1;
}
+ splice(__e1, __c);
+ }
}
template <class _Tp, class _Alloc>
-inline
-void
-list<_Tp, _Alloc>::sort()
-{
- sort(__less<>());
+inline void list<_Tp, _Alloc>::sort() {
+ sort(__less<>());
}
template <class _Tp, class _Alloc>
template <class _Comp>
-inline
-void
-list<_Tp, _Alloc>::sort(_Comp __comp)
-{
- __sort(begin(), end(), base::__sz(), __comp);
+inline void list<_Tp, _Alloc>::sort(_Comp __comp) {
+ __sort(begin(), end(), base::__sz(), __comp);
}
template <class _Tp, class _Alloc>
template <class _Comp>
typename list<_Tp, _Alloc>::iterator
-list<_Tp, _Alloc>::__sort(iterator __f1, iterator __e2, size_type __n, _Comp& __comp)
-{
- switch (__n)
- {
- case 0:
- case 1:
- return __f1;
- case 2:
- if (__comp(*--__e2, *__f1))
- {
- __link_pointer __f = __e2.__ptr_;
- base::__unlink_nodes(__f, __f);
- __link_nodes(__f1.__ptr_, __f, __f);
- return __e2;
- }
- return __f1;
+list<_Tp, _Alloc>::__sort(iterator __f1, iterator __e2, size_type __n, _Comp& __comp) {
+ switch (__n) {
+ case 0:
+ case 1:
+ return __f1;
+ case 2:
+ if (__comp(*--__e2, *__f1)) {
+ __link_pointer __f = __e2.__ptr_;
+ base::__unlink_nodes(__f, __f);
+ __link_nodes(__f1.__ptr_, __f, __f);
+ return __e2;
}
- size_type __n2 = __n / 2;
- iterator __e1 = std::next(__f1, __n2);
- iterator __r = __f1 = __sort(__f1, __e1, __n2, __comp);
- iterator __f2 = __e1 = __sort(__e1, __e2, __n - __n2, __comp);
- if (__comp(*__f2, *__f1))
- {
- iterator __m2 = std::next(__f2);
- for (; __m2 != __e2 && __comp(*__m2, *__f1); ++__m2)
- ;
- __link_pointer __f = __f2.__ptr_;
- __link_pointer __l = __m2.__ptr_->__prev_;
- __r = __f2;
- __e1 = __f2 = __m2;
- base::__unlink_nodes(__f, __l);
- __m2 = std::next(__f1);
- __link_nodes(__f1.__ptr_, __f, __l);
- __f1 = __m2;
- }
- else
- ++__f1;
- while (__f1 != __e1 && __f2 != __e2)
- {
- if (__comp(*__f2, *__f1))
- {
- iterator __m2 = std::next(__f2);
- for (; __m2 != __e2 && __comp(*__m2, *__f1); ++__m2)
- ;
- __link_pointer __f = __f2.__ptr_;
- __link_pointer __l = __m2.__ptr_->__prev_;
- if (__e1 == __f2)
- __e1 = __m2;
- __f2 = __m2;
- base::__unlink_nodes(__f, __l);
- __m2 = std::next(__f1);
- __link_nodes(__f1.__ptr_, __f, __l);
- __f1 = __m2;
- }
- else
- ++__f1;
- }
- return __r;
+ return __f1;
+ }
+ size_type __n2 = __n / 2;
+ iterator __e1 = std::next(__f1, __n2);
+ iterator __r = __f1 = __sort(__f1, __e1, __n2, __comp);
+ iterator __f2 = __e1 = __sort(__e1, __e2, __n - __n2, __comp);
+ if (__comp(*__f2, *__f1)) {
+ iterator __m2 = std::next(__f2);
+ for (; __m2 != __e2 && __comp(*__m2, *__f1); ++__m2)
+ ;
+ __link_pointer __f = __f2.__ptr_;
+ __link_pointer __l = __m2.__ptr_->__prev_;
+ __r = __f2;
+ __e1 = __f2 = __m2;
+ base::__unlink_nodes(__f, __l);
+ __m2 = std::next(__f1);
+ __link_nodes(__f1.__ptr_, __f, __l);
+ __f1 = __m2;
+ } else
+ ++__f1;
+ while (__f1 != __e1 && __f2 != __e2) {
+ if (__comp(*__f2, *__f1)) {
+ iterator __m2 = std::next(__f2);
+ for (; __m2 != __e2 && __comp(*__m2, *__f1); ++__m2)
+ ;
+ __link_pointer __f = __f2.__ptr_;
+ __link_pointer __l = __m2.__ptr_->__prev_;
+ if (__e1 == __f2)
+ __e1 = __m2;
+ __f2 = __m2;
+ base::__unlink_nodes(__f, __l);
+ __m2 = std::next(__f1);
+ __link_nodes(__f1.__ptr_, __f, __l);
+ __f1 = __m2;
+ } else
+ ++__f1;
+ }
+ return __r;
}
template <class _Tp, class _Alloc>
-void
-list<_Tp, _Alloc>::reverse() _NOEXCEPT
-{
- if (base::__sz() > 1)
- {
- iterator __e = end();
- for (iterator __i = begin(); __i.__ptr_ != __e.__ptr_;)
- {
- std::swap(__i.__ptr_->__prev_, __i.__ptr_->__next_);
- __i.__ptr_ = __i.__ptr_->__prev_;
- }
- std::swap(__e.__ptr_->__prev_, __e.__ptr_->__next_);
+void list<_Tp, _Alloc>::reverse() _NOEXCEPT {
+ if (base::__sz() > 1) {
+ iterator __e = end();
+ for (iterator __i = begin(); __i.__ptr_ != __e.__ptr_;) {
+ std::swap(__i.__ptr_->__prev_, __i.__ptr_->__next_);
+ __i.__ptr_ = __i.__ptr_->__prev_;
}
+ std::swap(__e.__ptr_->__prev_, __e.__ptr_->__next_);
+ }
}
template <class _Tp, class _Alloc>
-bool
-list<_Tp, _Alloc>::__invariants() const
-{
- return size() == std::distance(begin(), end());
+bool list<_Tp, _Alloc>::__invariants() const {
+ return size() == std::distance(begin(), end());
}
template <class _Tp, class _Alloc>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator==(const list<_Tp, _Alloc>& __x, const list<_Tp, _Alloc>& __y)
-{
- return __x.size() == __y.size() && std::equal(__x.begin(), __x.end(), __y.begin());
+inline _LIBCPP_HIDE_FROM_ABI bool operator==(const list<_Tp, _Alloc>& __x, const list<_Tp, _Alloc>& __y) {
+ return __x.size() == __y.size() && std::equal(__x.begin(), __x.end(), __y.begin());
}
#if _LIBCPP_STD_VER <= 17
template <class _Tp, class _Alloc>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator< (const list<_Tp, _Alloc>& __x, const list<_Tp, _Alloc>& __y)
-{
- return std::lexicographical_compare(__x.begin(), __x.end(), __y.begin(), __y.end());
+inline _LIBCPP_HIDE_FROM_ABI bool operator<(const list<_Tp, _Alloc>& __x, const list<_Tp, _Alloc>& __y) {
+ return std::lexicographical_compare(__x.begin(), __x.end(), __y.begin(), __y.end());
}
template <class _Tp, class _Alloc>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator!=(const list<_Tp, _Alloc>& __x, const list<_Tp, _Alloc>& __y)
-{
- return !(__x == __y);
+inline _LIBCPP_HIDE_FROM_ABI bool operator!=(const list<_Tp, _Alloc>& __x, const list<_Tp, _Alloc>& __y) {
+ return !(__x == __y);
}
template <class _Tp, class _Alloc>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator> (const list<_Tp, _Alloc>& __x, const list<_Tp, _Alloc>& __y)
-{
- return __y < __x;
+inline _LIBCPP_HIDE_FROM_ABI bool operator>(const list<_Tp, _Alloc>& __x, const list<_Tp, _Alloc>& __y) {
+ return __y < __x;
}
template <class _Tp, class _Alloc>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator>=(const list<_Tp, _Alloc>& __x, const list<_Tp, _Alloc>& __y)
-{
- return !(__x < __y);
+inline _LIBCPP_HIDE_FROM_ABI bool operator>=(const list<_Tp, _Alloc>& __x, const list<_Tp, _Alloc>& __y) {
+ return !(__x < __y);
}
template <class _Tp, class _Alloc>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator<=(const list<_Tp, _Alloc>& __x, const list<_Tp, _Alloc>& __y)
-{
- return !(__y < __x);
+inline _LIBCPP_HIDE_FROM_ABI bool operator<=(const list<_Tp, _Alloc>& __x, const list<_Tp, _Alloc>& __y) {
+ return !(__y < __x);
}
#else // _LIBCPP_STD_VER <= 17
@@ -2048,19 +1701,16 @@ operator<=(const list<_Tp, _Alloc>& __x, const list<_Tp, _Alloc>& __y)
template <class _Tp, class _Allocator>
_LIBCPP_HIDE_FROM_ABI __synth_three_way_result<_Tp>
operator<=>(const list<_Tp, _Allocator>& __x, const list<_Tp, _Allocator>& __y) {
- return std::lexicographical_compare_three_way(
- __x.begin(), __x.end(), __y.begin(), __y.end(), std::__synth_three_way<_Tp, _Tp>);
+ return std::lexicographical_compare_three_way(
+ __x.begin(), __x.end(), __y.begin(), __y.end(), std::__synth_three_way<_Tp, _Tp>);
}
#endif // _LIBCPP_STD_VER <= 17
template <class _Tp, class _Alloc>
-inline _LIBCPP_HIDE_FROM_ABI
-void
-swap(list<_Tp, _Alloc>& __x, list<_Tp, _Alloc>& __y)
- _NOEXCEPT_(_NOEXCEPT_(__x.swap(__y)))
-{
- __x.swap(__y);
+inline _LIBCPP_HIDE_FROM_ABI void swap(list<_Tp, _Alloc>& __x, list<_Tp, _Alloc>& __y)
+ _NOEXCEPT_(_NOEXCEPT_(__x.swap(__y))) {
+ __x.swap(__y);
}
#if _LIBCPP_STD_VER >= 20
@@ -2078,10 +1728,10 @@ erase(list<_Tp, _Allocator>& __c, const _Up& __v) {
template <>
inline constexpr bool __format::__enable_insertable<std::list<char>> = true;
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+# ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
template <>
inline constexpr bool __format::__enable_insertable<std::list<wchar_t>> = true;
-#endif
+# endif
#endif // _LIBCPP_STD_VER >= 20
diff --git a/contrib/llvm-project/libcxx/include/locale b/contrib/llvm-project/libcxx/include/locale
index 56fa8db91d2b..70d22ff95e1e 100644
--- a/contrib/llvm-project/libcxx/include/locale
+++ b/contrib/llvm-project/libcxx/include/locale
@@ -236,7 +236,6 @@ template <class charT> class messages_byname;
_LIBCPP_PUSH_MACROS
#include <__undef_macros>
-
_LIBCPP_BEGIN_NAMESPACE_STD
#if defined(__APPLE__) || defined(__FreeBSD__)
@@ -245,9 +244,9 @@ _LIBCPP_BEGIN_NAMESPACE_STD
# define _LIBCPP_GET_C_LOCALE LC_C_LOCALE
#else
# define _LIBCPP_GET_C_LOCALE __cloc()
- // Get the C locale object
- _LIBCPP_EXPORTED_FROM_ABI locale_t __cloc();
-#define __cloc_defined
+// Get the C locale object
+_LIBCPP_EXPORTED_FROM_ABI locale_t __cloc();
+# define __cloc_defined
#endif
// __scan_keyword
@@ -269,204 +268,201 @@ _LIBCPP_BEGIN_NAMESPACE_STD
// If the input is "a", the first keyword matches and eofbit is set.
// If the input is "abc", no match is found and "ab" are consumed.
template <class _InputIterator, class _ForwardIterator, class _Ctype>
-_LIBCPP_HIDE_FROM_ABI
-_ForwardIterator
-__scan_keyword(_InputIterator& __b, _InputIterator __e,
- _ForwardIterator __kb, _ForwardIterator __ke,
- const _Ctype& __ct, ios_base::iostate& __err,
- bool __case_sensitive = true)
-{
- typedef typename iterator_traits<_InputIterator>::value_type _CharT;
- size_t __nkw = static_cast<size_t>(std::distance(__kb, __ke));
- const unsigned char __doesnt_match = '\0';
- const unsigned char __might_match = '\1';
- const unsigned char __does_match = '\2';
- unsigned char __statbuf[100];
- unsigned char* __status = __statbuf;
- unique_ptr<unsigned char, void(*)(void*)> __stat_hold(nullptr, free);
- if (__nkw > sizeof(__statbuf))
- {
- __status = (unsigned char*)malloc(__nkw);
- if (__status == nullptr)
- __throw_bad_alloc();
- __stat_hold.reset(__status);
- }
- size_t __n_might_match = __nkw; // At this point, any keyword might match
- size_t __n_does_match = 0; // but none of them definitely do
- // Initialize all statuses to __might_match, except for "" keywords are __does_match
- unsigned char* __st = __status;
- for (_ForwardIterator __ky = __kb; __ky != __ke; ++__ky, (void) ++__st)
- {
- if (!__ky->empty())
- *__st = __might_match;
- else
- {
+_LIBCPP_HIDE_FROM_ABI _ForwardIterator __scan_keyword(
+ _InputIterator& __b,
+ _InputIterator __e,
+ _ForwardIterator __kb,
+ _ForwardIterator __ke,
+ const _Ctype& __ct,
+ ios_base::iostate& __err,
+ bool __case_sensitive = true) {
+ typedef typename iterator_traits<_InputIterator>::value_type _CharT;
+ size_t __nkw = static_cast<size_t>(std::distance(__kb, __ke));
+ const unsigned char __doesnt_match = '\0';
+ const unsigned char __might_match = '\1';
+ const unsigned char __does_match = '\2';
+ unsigned char __statbuf[100];
+ unsigned char* __status = __statbuf;
+ unique_ptr<unsigned char, void (*)(void*)> __stat_hold(nullptr, free);
+ if (__nkw > sizeof(__statbuf)) {
+ __status = (unsigned char*)malloc(__nkw);
+ if (__status == nullptr)
+ __throw_bad_alloc();
+ __stat_hold.reset(__status);
+ }
+ size_t __n_might_match = __nkw; // At this point, any keyword might match
+ size_t __n_does_match = 0; // but none of them definitely do
+ // Initialize all statuses to __might_match, except for "" keywords are __does_match
+ unsigned char* __st = __status;
+ for (_ForwardIterator __ky = __kb; __ky != __ke; ++__ky, (void)++__st) {
+ if (!__ky->empty())
+ *__st = __might_match;
+ else {
+ *__st = __does_match;
+ --__n_might_match;
+ ++__n_does_match;
+ }
+ }
+ // While there might be a match, test keywords against the next CharT
+ for (size_t __indx = 0; __b != __e && __n_might_match > 0; ++__indx) {
+ // Peek at the next CharT but don't consume it
+ _CharT __c = *__b;
+ if (!__case_sensitive)
+ __c = __ct.toupper(__c);
+ bool __consume = false;
+ // For each keyword which might match, see if the __indx character is __c
+ // If a match if found, consume __c
+ // If a match is found, and that is the last character in the keyword,
+ // then that keyword matches.
+ // If the keyword doesn't match this character, then change the keyword
+ // to doesn't match
+ __st = __status;
+ for (_ForwardIterator __ky = __kb; __ky != __ke; ++__ky, (void)++__st) {
+ if (*__st == __might_match) {
+ _CharT __kc = (*__ky)[__indx];
+ if (!__case_sensitive)
+ __kc = __ct.toupper(__kc);
+ if (__c == __kc) {
+ __consume = true;
+ if (__ky->size() == __indx + 1) {
*__st = __does_match;
--__n_might_match;
++__n_does_match;
+ }
+ } else {
+ *__st = __doesnt_match;
+ --__n_might_match;
}
- }
- // While there might be a match, test keywords against the next CharT
- for (size_t __indx = 0; __b != __e && __n_might_match > 0; ++__indx)
- {
- // Peek at the next CharT but don't consume it
- _CharT __c = *__b;
- if (!__case_sensitive)
- __c = __ct.toupper(__c);
- bool __consume = false;
- // For each keyword which might match, see if the __indx character is __c
- // If a match if found, consume __c
- // If a match is found, and that is the last character in the keyword,
- // then that keyword matches.
- // If the keyword doesn't match this character, then change the keyword
- // to doesn't match
+ }
+ }
+ // consume if we matched a character
+ if (__consume) {
+ ++__b;
+ // If we consumed a character and there might be a matched keyword that
+ // was marked matched on a previous iteration, then such keywords
+ // which are now marked as not matching.
+ if (__n_might_match + __n_does_match > 1) {
__st = __status;
- for (_ForwardIterator __ky = __kb; __ky != __ke; ++__ky, (void) ++__st)
- {
- if (*__st == __might_match)
- {
- _CharT __kc = (*__ky)[__indx];
- if (!__case_sensitive)
- __kc = __ct.toupper(__kc);
- if (__c == __kc)
- {
- __consume = true;
- if (__ky->size() == __indx+1)
- {
- *__st = __does_match;
- --__n_might_match;
- ++__n_does_match;
- }
- }
- else
- {
- *__st = __doesnt_match;
- --__n_might_match;
- }
- }
- }
- // consume if we matched a character
- if (__consume)
- {
- ++__b;
- // If we consumed a character and there might be a matched keyword that
- // was marked matched on a previous iteration, then such keywords
- // which are now marked as not matching.
- if (__n_might_match + __n_does_match > 1)
- {
- __st = __status;
- for (_ForwardIterator __ky = __kb; __ky != __ke; ++__ky, (void) ++__st)
- {
- if (*__st == __does_match && __ky->size() != __indx+1)
- {
- *__st = __doesnt_match;
- --__n_does_match;
- }
- }
- }
+ for (_ForwardIterator __ky = __kb; __ky != __ke; ++__ky, (void)++__st) {
+ if (*__st == __does_match && __ky->size() != __indx + 1) {
+ *__st = __doesnt_match;
+ --__n_does_match;
+ }
}
- }
- // We've exited the loop because we hit eof and/or we have no more "might matches".
- if (__b == __e)
- __err |= ios_base::eofbit;
- // Return the first matching result
- for (__st = __status; __kb != __ke; ++__kb, (void) ++__st)
- if (*__st == __does_match)
- break;
- if (__kb == __ke)
- __err |= ios_base::failbit;
- return __kb;
-}
-
-struct _LIBCPP_EXPORTED_FROM_ABI __num_get_base
-{
- static const int __num_get_buf_sz = 40;
-
- static int __get_base(ios_base&);
- static const char __src[33];
+ }
+ }
+ }
+ // We've exited the loop because we hit eof and/or we have no more "might matches".
+ if (__b == __e)
+ __err |= ios_base::eofbit;
+ // Return the first matching result
+ for (__st = __status; __kb != __ke; ++__kb, (void)++__st)
+ if (*__st == __does_match)
+ break;
+ if (__kb == __ke)
+ __err |= ios_base::failbit;
+ return __kb;
+}
+
+struct _LIBCPP_EXPORTED_FROM_ABI __num_get_base {
+ static const int __num_get_buf_sz = 40;
+
+ static int __get_base(ios_base&);
+ static const char __src[33];
};
-_LIBCPP_EXPORTED_FROM_ABI void __check_grouping(const string& __grouping, unsigned* __g, unsigned* __g_end,
- ios_base::iostate& __err);
+_LIBCPP_EXPORTED_FROM_ABI void
+__check_grouping(const string& __grouping, unsigned* __g, unsigned* __g_end, ios_base::iostate& __err);
template <class _CharT>
-struct __num_get
- : protected __num_get_base
-{
- static string __stage2_float_prep(ios_base& __iob, _CharT* __atoms, _CharT& __decimal_point,
- _CharT& __thousands_sep);
-
- static int __stage2_float_loop(_CharT __ct, bool& __in_units, char& __exp,
- char* __a, char*& __a_end,
- _CharT __decimal_point, _CharT __thousands_sep,
- const string& __grouping, unsigned* __g,
- unsigned*& __g_end, unsigned& __dc, _CharT* __atoms);
+struct __num_get : protected __num_get_base {
+ static string __stage2_float_prep(ios_base& __iob, _CharT* __atoms, _CharT& __decimal_point, _CharT& __thousands_sep);
+
+ static int __stage2_float_loop(
+ _CharT __ct,
+ bool& __in_units,
+ char& __exp,
+ char* __a,
+ char*& __a_end,
+ _CharT __decimal_point,
+ _CharT __thousands_sep,
+ const string& __grouping,
+ unsigned* __g,
+ unsigned*& __g_end,
+ unsigned& __dc,
+ _CharT* __atoms);
#ifndef _LIBCPP_ABI_OPTIMIZED_LOCALE_NUM_GET
- static string __stage2_int_prep(ios_base& __iob, _CharT* __atoms, _CharT& __thousands_sep);
- static int __stage2_int_loop(_CharT __ct, int __base, char* __a, char*& __a_end,
- unsigned& __dc, _CharT __thousands_sep, const string& __grouping,
- unsigned* __g, unsigned*& __g_end, _CharT* __atoms);
+ static string __stage2_int_prep(ios_base& __iob, _CharT* __atoms, _CharT& __thousands_sep);
+ static int __stage2_int_loop(
+ _CharT __ct,
+ int __base,
+ char* __a,
+ char*& __a_end,
+ unsigned& __dc,
+ _CharT __thousands_sep,
+ const string& __grouping,
+ unsigned* __g,
+ unsigned*& __g_end,
+ _CharT* __atoms);
#else
- static string __stage2_int_prep(ios_base& __iob, _CharT& __thousands_sep)
- {
- locale __loc = __iob.getloc();
- const numpunct<_CharT>& __np = use_facet<numpunct<_CharT> >(__loc);
- __thousands_sep = __np.thousands_sep();
- return __np.grouping();
- }
-
- const _CharT* __do_widen(ios_base& __iob, _CharT* __atoms) const
- {
- return __do_widen_p(__iob, __atoms);
- }
-
+ static string __stage2_int_prep(ios_base& __iob, _CharT& __thousands_sep) {
+ locale __loc = __iob.getloc();
+ const numpunct<_CharT>& __np = use_facet<numpunct<_CharT> >(__loc);
+ __thousands_sep = __np.thousands_sep();
+ return __np.grouping();
+ }
+
+ const _CharT* __do_widen(ios_base& __iob, _CharT* __atoms) const { return __do_widen_p(__iob, __atoms); }
+
+ static int __stage2_int_loop(
+ _CharT __ct,
+ int __base,
+ char* __a,
+ char*& __a_end,
+ unsigned& __dc,
+ _CharT __thousands_sep,
+ const string& __grouping,
+ unsigned* __g,
+ unsigned*& __g_end,
+ const _CharT* __atoms);
- static int __stage2_int_loop(_CharT __ct, int __base, char* __a, char*& __a_end,
- unsigned& __dc, _CharT __thousands_sep, const string& __grouping,
- unsigned* __g, unsigned*& __g_end, const _CharT* __atoms);
private:
- template<typename _Tp>
- const _Tp* __do_widen_p(ios_base& __iob, _Tp* __atoms) const
- {
- locale __loc = __iob.getloc();
- use_facet<ctype<_Tp> >(__loc).widen(__src, __src + 26, __atoms);
- return __atoms;
- }
-
- const char* __do_widen_p(ios_base& __iob, char* __atoms) const
- {
- (void)__iob;
- (void)__atoms;
- return __src;
- }
+ template <typename _Tp>
+ const _Tp* __do_widen_p(ios_base& __iob, _Tp* __atoms) const {
+ locale __loc = __iob.getloc();
+ use_facet<ctype<_Tp> >(__loc).widen(__src, __src + 26, __atoms);
+ return __atoms;
+ }
+
+ const char* __do_widen_p(ios_base& __iob, char* __atoms) const {
+ (void)__iob;
+ (void)__atoms;
+ return __src;
+ }
#endif
};
#ifndef _LIBCPP_ABI_OPTIMIZED_LOCALE_NUM_GET
template <class _CharT>
-string
-__num_get<_CharT>::__stage2_int_prep(ios_base& __iob, _CharT* __atoms, _CharT& __thousands_sep)
-{
- locale __loc = __iob.getloc();
- std::use_facet<ctype<_CharT> >(__loc).widen(__src, __src + 26, __atoms);
- const numpunct<_CharT>& __np = std::use_facet<numpunct<_CharT> >(__loc);
- __thousands_sep = __np.thousands_sep();
- return __np.grouping();
+string __num_get<_CharT>::__stage2_int_prep(ios_base& __iob, _CharT* __atoms, _CharT& __thousands_sep) {
+ locale __loc = __iob.getloc();
+ std::use_facet<ctype<_CharT> >(__loc).widen(__src, __src + 26, __atoms);
+ const numpunct<_CharT>& __np = std::use_facet<numpunct<_CharT> >(__loc);
+ __thousands_sep = __np.thousands_sep();
+ return __np.grouping();
}
#endif
template <class _CharT>
-string
-__num_get<_CharT>::__stage2_float_prep(ios_base& __iob, _CharT* __atoms, _CharT& __decimal_point,
- _CharT& __thousands_sep)
-{
- locale __loc = __iob.getloc();
- std::use_facet<ctype<_CharT> >(__loc).widen(__src, __src + 32, __atoms);
- const numpunct<_CharT>& __np = std::use_facet<numpunct<_CharT> >(__loc);
- __decimal_point = __np.decimal_point();
- __thousands_sep = __np.thousands_sep();
- return __np.grouping();
+string __num_get<_CharT>::__stage2_float_prep(
+ ios_base& __iob, _CharT* __atoms, _CharT& __decimal_point, _CharT& __thousands_sep) {
+ locale __loc = __iob.getloc();
+ std::use_facet<ctype<_CharT> >(__loc).widen(__src, __src + 32, __atoms);
+ const numpunct<_CharT>& __np = std::use_facet<numpunct<_CharT> >(__loc);
+ __decimal_point = __np.decimal_point();
+ __thousands_sep = __np.thousands_sep();
+ return __np.grouping();
}
template <class _CharT>
@@ -482,104 +478,100 @@ __num_get<_CharT>::__stage2_int_loop(_CharT __ct, int __base, char* __a, char*&
#endif
{
- if (__a_end == __a && (__ct == __atoms[24] || __ct == __atoms[25]))
- {
- *__a_end++ = __ct == __atoms[24] ? '+' : '-';
- __dc = 0;
- return 0;
- }
- if (__grouping.size() != 0 && __ct == __thousands_sep)
- {
- if (__g_end-__g < __num_get_buf_sz)
- {
- *__g_end++ = __dc;
- __dc = 0;
- }
- return 0;
- }
- ptrdiff_t __f = std::find(__atoms, __atoms + 26, __ct) - __atoms;
- if (__f >= 24)
- return -1;
- switch (__base)
- {
- case 8:
- case 10:
- if (__f >= __base)
- return -1;
- break;
- case 16:
- if (__f < 22)
- break;
- if (__a_end != __a && __a_end - __a <= 2 && __a_end[-1] == '0')
- {
- __dc = 0;
- *__a_end++ = __src[__f];
- return 0;
- }
- return -1;
+ if (__a_end == __a && (__ct == __atoms[24] || __ct == __atoms[25])) {
+ *__a_end++ = __ct == __atoms[24] ? '+' : '-';
+ __dc = 0;
+ return 0;
+ }
+ if (__grouping.size() != 0 && __ct == __thousands_sep) {
+ if (__g_end - __g < __num_get_buf_sz) {
+ *__g_end++ = __dc;
+ __dc = 0;
}
- *__a_end++ = __src[__f];
- ++__dc;
return 0;
+ }
+ ptrdiff_t __f = std::find(__atoms, __atoms + 26, __ct) - __atoms;
+ if (__f >= 24)
+ return -1;
+ switch (__base) {
+ case 8:
+ case 10:
+ if (__f >= __base)
+ return -1;
+ break;
+ case 16:
+ if (__f < 22)
+ break;
+ if (__a_end != __a && __a_end - __a <= 2 && __a_end[-1] == '0') {
+ __dc = 0;
+ *__a_end++ = __src[__f];
+ return 0;
+ }
+ return -1;
+ }
+ *__a_end++ = __src[__f];
+ ++__dc;
+ return 0;
}
template <class _CharT>
-int
-__num_get<_CharT>::__stage2_float_loop(_CharT __ct, bool& __in_units, char& __exp, char* __a, char*& __a_end,
- _CharT __decimal_point, _CharT __thousands_sep, const string& __grouping,
- unsigned* __g, unsigned*& __g_end, unsigned& __dc, _CharT* __atoms)
-{
- if (__ct == __decimal_point)
- {
- if (!__in_units)
- return -1;
- __in_units = false;
- *__a_end++ = '.';
- if (__grouping.size() != 0 && __g_end-__g < __num_get_buf_sz)
- *__g_end++ = __dc;
- return 0;
- }
- if (__ct == __thousands_sep && __grouping.size() != 0)
- {
- if (!__in_units)
- return -1;
- if (__g_end-__g < __num_get_buf_sz)
- {
- *__g_end++ = __dc;
- __dc = 0;
- }
- return 0;
+int __num_get<_CharT>::__stage2_float_loop(
+ _CharT __ct,
+ bool& __in_units,
+ char& __exp,
+ char* __a,
+ char*& __a_end,
+ _CharT __decimal_point,
+ _CharT __thousands_sep,
+ const string& __grouping,
+ unsigned* __g,
+ unsigned*& __g_end,
+ unsigned& __dc,
+ _CharT* __atoms) {
+ if (__ct == __decimal_point) {
+ if (!__in_units)
+ return -1;
+ __in_units = false;
+ *__a_end++ = '.';
+ if (__grouping.size() != 0 && __g_end - __g < __num_get_buf_sz)
+ *__g_end++ = __dc;
+ return 0;
+ }
+ if (__ct == __thousands_sep && __grouping.size() != 0) {
+ if (!__in_units)
+ return -1;
+ if (__g_end - __g < __num_get_buf_sz) {
+ *__g_end++ = __dc;
+ __dc = 0;
}
- ptrdiff_t __f = std::find(__atoms, __atoms + 32, __ct) - __atoms;
- if (__f >= 32)
- return -1;
- char __x = __src[__f];
- if (__x == '-' || __x == '+')
- {
- if (__a_end == __a || (std::toupper(__a_end[-1]) == std::toupper(__exp)))
- {
- *__a_end++ = __x;
- return 0;
- }
- return -1;
+ return 0;
+ }
+ ptrdiff_t __f = std::find(__atoms, __atoms + 32, __ct) - __atoms;
+ if (__f >= 32)
+ return -1;
+ char __x = __src[__f];
+ if (__x == '-' || __x == '+') {
+ if (__a_end == __a || (std::toupper(__a_end[-1]) == std::toupper(__exp))) {
+ *__a_end++ = __x;
+ return 0;
}
- if (__x == 'x' || __x == 'X')
- __exp = 'P';
- else if (std::toupper(__x) == __exp)
- {
- __exp = std::tolower(__exp);
- if (__in_units)
- {
- __in_units = false;
- if (__grouping.size() != 0 && __g_end-__g < __num_get_buf_sz)
- *__g_end++ = __dc;
- }
+ return -1;
+ }
+ if (__x == 'x' || __x == 'X')
+ __exp = 'P';
+ else if (std::toupper(__x) == __exp) {
+ __exp = std::tolower(__exp);
+ if (__in_units) {
+ __in_units = false;
+ if (__grouping.size() != 0 && __g_end - __g < __num_get_buf_sz)
+ *__g_end++ = __dc;
}
- *__a_end++ = __x;
- if (__f >= 22)
- return 0;
- ++__dc;
+ }
+ *__a_end++ = __x;
+ if (__f >= 22)
return 0;
+ ++__dc;
+ return 0;
}
extern template struct _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS __num_get<char>;
@@ -588,537 +580,452 @@ extern template struct _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS __num_get<wchar_t>;
#endif
template <class _CharT, class _InputIterator = istreambuf_iterator<_CharT> >
-class _LIBCPP_TEMPLATE_VIS num_get
- : public locale::facet,
- private __num_get<_CharT>
-{
+class _LIBCPP_TEMPLATE_VIS num_get : public locale::facet, private __num_get<_CharT> {
public:
- typedef _CharT char_type;
- typedef _InputIterator iter_type;
-
- _LIBCPP_HIDE_FROM_ABI
- explicit num_get(size_t __refs = 0)
- : locale::facet(__refs) {}
-
- _LIBCPP_HIDE_FROM_ABI
- iter_type get(iter_type __b, iter_type __e, ios_base& __iob,
- ios_base::iostate& __err, bool& __v) const
- {
- return do_get(__b, __e, __iob, __err, __v);
- }
-
- _LIBCPP_HIDE_FROM_ABI
- iter_type get(iter_type __b, iter_type __e, ios_base& __iob,
- ios_base::iostate& __err, long& __v) const
- {
- return do_get(__b, __e, __iob, __err, __v);
- }
-
- _LIBCPP_HIDE_FROM_ABI
- iter_type get(iter_type __b, iter_type __e, ios_base& __iob,
- ios_base::iostate& __err, long long& __v) const
- {
- return do_get(__b, __e, __iob, __err, __v);
- }
-
- _LIBCPP_HIDE_FROM_ABI
- iter_type get(iter_type __b, iter_type __e, ios_base& __iob,
- ios_base::iostate& __err, unsigned short& __v) const
- {
- return do_get(__b, __e, __iob, __err, __v);
- }
-
- _LIBCPP_HIDE_FROM_ABI
- iter_type get(iter_type __b, iter_type __e, ios_base& __iob,
- ios_base::iostate& __err, unsigned int& __v) const
- {
- return do_get(__b, __e, __iob, __err, __v);
- }
-
- _LIBCPP_HIDE_FROM_ABI
- iter_type get(iter_type __b, iter_type __e, ios_base& __iob,
- ios_base::iostate& __err, unsigned long& __v) const
- {
- return do_get(__b, __e, __iob, __err, __v);
- }
-
- _LIBCPP_HIDE_FROM_ABI
- iter_type get(iter_type __b, iter_type __e, ios_base& __iob,
- ios_base::iostate& __err, unsigned long long& __v) const
- {
- return do_get(__b, __e, __iob, __err, __v);
- }
-
- _LIBCPP_HIDE_FROM_ABI
- iter_type get(iter_type __b, iter_type __e, ios_base& __iob,
- ios_base::iostate& __err, float& __v) const
- {
- return do_get(__b, __e, __iob, __err, __v);
- }
-
- _LIBCPP_HIDE_FROM_ABI
- iter_type get(iter_type __b, iter_type __e, ios_base& __iob,
- ios_base::iostate& __err, double& __v) const
- {
- return do_get(__b, __e, __iob, __err, __v);
- }
-
- _LIBCPP_HIDE_FROM_ABI
- iter_type get(iter_type __b, iter_type __e, ios_base& __iob,
- ios_base::iostate& __err, long double& __v) const
- {
- return do_get(__b, __e, __iob, __err, __v);
- }
-
- _LIBCPP_HIDE_FROM_ABI
- iter_type get(iter_type __b, iter_type __e, ios_base& __iob,
- ios_base::iostate& __err, void*& __v) const
- {
- return do_get(__b, __e, __iob, __err, __v);
- }
-
- static locale::id id;
+ typedef _CharT char_type;
+ typedef _InputIterator iter_type;
+
+ _LIBCPP_HIDE_FROM_ABI explicit num_get(size_t __refs = 0) : locale::facet(__refs) {}
+
+ _LIBCPP_HIDE_FROM_ABI iter_type
+ get(iter_type __b, iter_type __e, ios_base& __iob, ios_base::iostate& __err, bool& __v) const {
+ return do_get(__b, __e, __iob, __err, __v);
+ }
+
+ _LIBCPP_HIDE_FROM_ABI iter_type
+ get(iter_type __b, iter_type __e, ios_base& __iob, ios_base::iostate& __err, long& __v) const {
+ return do_get(__b, __e, __iob, __err, __v);
+ }
+
+ _LIBCPP_HIDE_FROM_ABI iter_type
+ get(iter_type __b, iter_type __e, ios_base& __iob, ios_base::iostate& __err, long long& __v) const {
+ return do_get(__b, __e, __iob, __err, __v);
+ }
+
+ _LIBCPP_HIDE_FROM_ABI iter_type
+ get(iter_type __b, iter_type __e, ios_base& __iob, ios_base::iostate& __err, unsigned short& __v) const {
+ return do_get(__b, __e, __iob, __err, __v);
+ }
+
+ _LIBCPP_HIDE_FROM_ABI iter_type
+ get(iter_type __b, iter_type __e, ios_base& __iob, ios_base::iostate& __err, unsigned int& __v) const {
+ return do_get(__b, __e, __iob, __err, __v);
+ }
+
+ _LIBCPP_HIDE_FROM_ABI iter_type
+ get(iter_type __b, iter_type __e, ios_base& __iob, ios_base::iostate& __err, unsigned long& __v) const {
+ return do_get(__b, __e, __iob, __err, __v);
+ }
+
+ _LIBCPP_HIDE_FROM_ABI iter_type
+ get(iter_type __b, iter_type __e, ios_base& __iob, ios_base::iostate& __err, unsigned long long& __v) const {
+ return do_get(__b, __e, __iob, __err, __v);
+ }
+
+ _LIBCPP_HIDE_FROM_ABI iter_type
+ get(iter_type __b, iter_type __e, ios_base& __iob, ios_base::iostate& __err, float& __v) const {
+ return do_get(__b, __e, __iob, __err, __v);
+ }
+
+ _LIBCPP_HIDE_FROM_ABI iter_type
+ get(iter_type __b, iter_type __e, ios_base& __iob, ios_base::iostate& __err, double& __v) const {
+ return do_get(__b, __e, __iob, __err, __v);
+ }
+
+ _LIBCPP_HIDE_FROM_ABI iter_type
+ get(iter_type __b, iter_type __e, ios_base& __iob, ios_base::iostate& __err, long double& __v) const {
+ return do_get(__b, __e, __iob, __err, __v);
+ }
+
+ _LIBCPP_HIDE_FROM_ABI iter_type
+ get(iter_type __b, iter_type __e, ios_base& __iob, ios_base::iostate& __err, void*& __v) const {
+ return do_get(__b, __e, __iob, __err, __v);
+ }
+
+ static locale::id id;
protected:
- _LIBCPP_HIDE_FROM_ABI_VIRTUAL ~num_get() override {}
+ _LIBCPP_HIDE_FROM_ABI_VIRTUAL ~num_get() override {}
- template <class _Fp>
- _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
- iter_type __do_get_floating_point
- (iter_type __b, iter_type __e, ios_base& __iob,
- ios_base::iostate& __err, _Fp& __v) const;
+ template <class _Fp>
+ _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS iter_type
+ __do_get_floating_point(iter_type __b, iter_type __e, ios_base& __iob, ios_base::iostate& __err, _Fp& __v) const;
- template <class _Signed>
- _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
- iter_type __do_get_signed
- (iter_type __b, iter_type __e, ios_base& __iob,
- ios_base::iostate& __err, _Signed& __v) const;
+ template <class _Signed>
+ _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS iter_type
+ __do_get_signed(iter_type __b, iter_type __e, ios_base& __iob, ios_base::iostate& __err, _Signed& __v) const;
- template <class _Unsigned>
- _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
- iter_type __do_get_unsigned
- (iter_type __b, iter_type __e, ios_base& __iob,
- ios_base::iostate& __err, _Unsigned& __v) const;
+ template <class _Unsigned>
+ _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS iter_type
+ __do_get_unsigned(iter_type __b, iter_type __e, ios_base& __iob, ios_base::iostate& __err, _Unsigned& __v) const;
+ virtual iter_type do_get(iter_type __b, iter_type __e, ios_base& __iob, ios_base::iostate& __err, bool& __v) const;
- virtual iter_type do_get(iter_type __b, iter_type __e, ios_base& __iob,
- ios_base::iostate& __err, bool& __v) const;
+ virtual iter_type do_get(iter_type __b, iter_type __e, ios_base& __iob, ios_base::iostate& __err, long& __v) const {
+ return this->__do_get_signed(__b, __e, __iob, __err, __v);
+ }
- virtual iter_type do_get(iter_type __b, iter_type __e, ios_base& __iob,
- ios_base::iostate& __err, long& __v) const
- { return this->__do_get_signed ( __b, __e, __iob, __err, __v ); }
+ virtual iter_type
+ do_get(iter_type __b, iter_type __e, ios_base& __iob, ios_base::iostate& __err, long long& __v) const {
+ return this->__do_get_signed(__b, __e, __iob, __err, __v);
+ }
- virtual iter_type do_get(iter_type __b, iter_type __e, ios_base& __iob,
- ios_base::iostate& __err, long long& __v) const
- { return this->__do_get_signed ( __b, __e, __iob, __err, __v ); }
+ virtual iter_type
+ do_get(iter_type __b, iter_type __e, ios_base& __iob, ios_base::iostate& __err, unsigned short& __v) const {
+ return this->__do_get_unsigned(__b, __e, __iob, __err, __v);
+ }
- virtual iter_type do_get(iter_type __b, iter_type __e, ios_base& __iob,
- ios_base::iostate& __err, unsigned short& __v) const
- { return this->__do_get_unsigned ( __b, __e, __iob, __err, __v ); }
+ virtual iter_type
+ do_get(iter_type __b, iter_type __e, ios_base& __iob, ios_base::iostate& __err, unsigned int& __v) const {
+ return this->__do_get_unsigned(__b, __e, __iob, __err, __v);
+ }
- virtual iter_type do_get(iter_type __b, iter_type __e, ios_base& __iob,
- ios_base::iostate& __err, unsigned int& __v) const
- { return this->__do_get_unsigned ( __b, __e, __iob, __err, __v ); }
+ virtual iter_type
+ do_get(iter_type __b, iter_type __e, ios_base& __iob, ios_base::iostate& __err, unsigned long& __v) const {
+ return this->__do_get_unsigned(__b, __e, __iob, __err, __v);
+ }
- virtual iter_type do_get(iter_type __b, iter_type __e, ios_base& __iob,
- ios_base::iostate& __err, unsigned long& __v) const
- { return this->__do_get_unsigned ( __b, __e, __iob, __err, __v ); }
+ virtual iter_type
+ do_get(iter_type __b, iter_type __e, ios_base& __iob, ios_base::iostate& __err, unsigned long long& __v) const {
+ return this->__do_get_unsigned(__b, __e, __iob, __err, __v);
+ }
- virtual iter_type do_get(iter_type __b, iter_type __e, ios_base& __iob,
- ios_base::iostate& __err, unsigned long long& __v) const
- { return this->__do_get_unsigned ( __b, __e, __iob, __err, __v ); }
+ virtual iter_type do_get(iter_type __b, iter_type __e, ios_base& __iob, ios_base::iostate& __err, float& __v) const {
+ return this->__do_get_floating_point(__b, __e, __iob, __err, __v);
+ }
- virtual iter_type do_get(iter_type __b, iter_type __e, ios_base& __iob,
- ios_base::iostate& __err, float& __v) const
- { return this->__do_get_floating_point ( __b, __e, __iob, __err, __v ); }
+ virtual iter_type do_get(iter_type __b, iter_type __e, ios_base& __iob, ios_base::iostate& __err, double& __v) const {
+ return this->__do_get_floating_point(__b, __e, __iob, __err, __v);
+ }
- virtual iter_type do_get(iter_type __b, iter_type __e, ios_base& __iob,
- ios_base::iostate& __err, double& __v) const
- { return this->__do_get_floating_point ( __b, __e, __iob, __err, __v ); }
+ virtual iter_type
+ do_get(iter_type __b, iter_type __e, ios_base& __iob, ios_base::iostate& __err, long double& __v) const {
+ return this->__do_get_floating_point(__b, __e, __iob, __err, __v);
+ }
- virtual iter_type do_get(iter_type __b, iter_type __e, ios_base& __iob,
- ios_base::iostate& __err, long double& __v) const
- { return this->__do_get_floating_point ( __b, __e, __iob, __err, __v ); }
-
- virtual iter_type do_get(iter_type __b, iter_type __e, ios_base& __iob,
- ios_base::iostate& __err, void*& __v) const;
+ virtual iter_type do_get(iter_type __b, iter_type __e, ios_base& __iob, ios_base::iostate& __err, void*& __v) const;
};
template <class _CharT, class _InputIterator>
-locale::id
-num_get<_CharT, _InputIterator>::id;
+locale::id num_get<_CharT, _InputIterator>::id;
template <class _Tp>
_LIBCPP_HIDE_FROM_ABI _Tp
-__num_get_signed_integral(const char* __a, const char* __a_end,
- ios_base::iostate& __err, int __base)
-{
- if (__a != __a_end)
- {
- __libcpp_remove_reference_t<decltype(errno)> __save_errno = errno;
- errno = 0;
- char *__p2;
- long long __ll = strtoll_l(__a, &__p2, __base, _LIBCPP_GET_C_LOCALE);
- __libcpp_remove_reference_t<decltype(errno)> __current_errno = errno;
- if (__current_errno == 0)
- errno = __save_errno;
- if (__p2 != __a_end)
- {
- __err = ios_base::failbit;
- return 0;
- }
- else if (__current_errno == ERANGE ||
- __ll < numeric_limits<_Tp>::min() ||
- numeric_limits<_Tp>::max() < __ll)
- {
- __err = ios_base::failbit;
- if (__ll > 0)
- return numeric_limits<_Tp>::max();
- else
- return numeric_limits<_Tp>::min();
- }
- return static_cast<_Tp>(__ll);
- }
- __err = ios_base::failbit;
- return 0;
+__num_get_signed_integral(const char* __a, const char* __a_end, ios_base::iostate& __err, int __base) {
+ if (__a != __a_end) {
+ __libcpp_remove_reference_t<decltype(errno)> __save_errno = errno;
+ errno = 0;
+ char* __p2;
+ long long __ll = strtoll_l(__a, &__p2, __base, _LIBCPP_GET_C_LOCALE);
+ __libcpp_remove_reference_t<decltype(errno)> __current_errno = errno;
+ if (__current_errno == 0)
+ errno = __save_errno;
+ if (__p2 != __a_end) {
+ __err = ios_base::failbit;
+ return 0;
+ } else if (__current_errno == ERANGE || __ll < numeric_limits<_Tp>::min() || numeric_limits<_Tp>::max() < __ll) {
+ __err = ios_base::failbit;
+ if (__ll > 0)
+ return numeric_limits<_Tp>::max();
+ else
+ return numeric_limits<_Tp>::min();
+ }
+ return static_cast<_Tp>(__ll);
+ }
+ __err = ios_base::failbit;
+ return 0;
}
template <class _Tp>
_LIBCPP_HIDE_FROM_ABI _Tp
-__num_get_unsigned_integral(const char* __a, const char* __a_end,
- ios_base::iostate& __err, int __base)
-{
- if (__a != __a_end)
- {
- const bool __negate = *__a == '-';
- if (__negate && ++__a == __a_end) {
- __err = ios_base::failbit;
- return 0;
- }
- __libcpp_remove_reference_t<decltype(errno)> __save_errno = errno;
- errno = 0;
- char *__p2;
- unsigned long long __ll = strtoull_l(__a, &__p2, __base, _LIBCPP_GET_C_LOCALE);
- __libcpp_remove_reference_t<decltype(errno)> __current_errno = errno;
- if (__current_errno == 0)
- errno = __save_errno;
- if (__p2 != __a_end)
- {
- __err = ios_base::failbit;
- return 0;
- }
- else if (__current_errno == ERANGE || numeric_limits<_Tp>::max() < __ll)
- {
- __err = ios_base::failbit;
- return numeric_limits<_Tp>::max();
- }
- _Tp __res = static_cast<_Tp>(__ll);
- if (__negate) __res = -__res;
- return __res;
- }
- __err = ios_base::failbit;
- return 0;
+__num_get_unsigned_integral(const char* __a, const char* __a_end, ios_base::iostate& __err, int __base) {
+ if (__a != __a_end) {
+ const bool __negate = *__a == '-';
+ if (__negate && ++__a == __a_end) {
+ __err = ios_base::failbit;
+ return 0;
+ }
+ __libcpp_remove_reference_t<decltype(errno)> __save_errno = errno;
+ errno = 0;
+ char* __p2;
+ unsigned long long __ll = strtoull_l(__a, &__p2, __base, _LIBCPP_GET_C_LOCALE);
+ __libcpp_remove_reference_t<decltype(errno)> __current_errno = errno;
+ if (__current_errno == 0)
+ errno = __save_errno;
+ if (__p2 != __a_end) {
+ __err = ios_base::failbit;
+ return 0;
+ } else if (__current_errno == ERANGE || numeric_limits<_Tp>::max() < __ll) {
+ __err = ios_base::failbit;
+ return numeric_limits<_Tp>::max();
+ }
+ _Tp __res = static_cast<_Tp>(__ll);
+ if (__negate)
+ __res = -__res;
+ return __res;
+ }
+ __err = ios_base::failbit;
+ return 0;
}
template <class _Tp>
-_LIBCPP_HIDE_FROM_ABI
-_Tp __do_strtod(const char* __a, char** __p2);
+_LIBCPP_HIDE_FROM_ABI _Tp __do_strtod(const char* __a, char** __p2);
template <>
-inline _LIBCPP_HIDE_FROM_ABI
-float __do_strtod<float>(const char* __a, char** __p2) {
- return strtof_l(__a, __p2, _LIBCPP_GET_C_LOCALE);
+inline _LIBCPP_HIDE_FROM_ABI float __do_strtod<float>(const char* __a, char** __p2) {
+ return strtof_l(__a, __p2, _LIBCPP_GET_C_LOCALE);
}
template <>
-inline _LIBCPP_HIDE_FROM_ABI
-double __do_strtod<double>(const char* __a, char** __p2) {
- return strtod_l(__a, __p2, _LIBCPP_GET_C_LOCALE);
+inline _LIBCPP_HIDE_FROM_ABI double __do_strtod<double>(const char* __a, char** __p2) {
+ return strtod_l(__a, __p2, _LIBCPP_GET_C_LOCALE);
}
template <>
-inline _LIBCPP_HIDE_FROM_ABI
-long double __do_strtod<long double>(const char* __a, char** __p2) {
- return strtold_l(__a, __p2, _LIBCPP_GET_C_LOCALE);
+inline _LIBCPP_HIDE_FROM_ABI long double __do_strtod<long double>(const char* __a, char** __p2) {
+ return strtold_l(__a, __p2, _LIBCPP_GET_C_LOCALE);
}
template <class _Tp>
-_LIBCPP_HIDE_FROM_ABI
-_Tp
-__num_get_float(const char* __a, const char* __a_end, ios_base::iostate& __err)
-{
- if (__a != __a_end)
- {
- __libcpp_remove_reference_t<decltype(errno)> __save_errno = errno;
- errno = 0;
- char *__p2;
- _Tp __ld = std::__do_strtod<_Tp>(__a, &__p2);
- __libcpp_remove_reference_t<decltype(errno)> __current_errno = errno;
- if (__current_errno == 0)
- errno = __save_errno;
- if (__p2 != __a_end)
- {
- __err = ios_base::failbit;
- return 0;
- }
- else if (__current_errno == ERANGE)
- __err = ios_base::failbit;
- return __ld;
- }
- __err = ios_base::failbit;
- return 0;
+_LIBCPP_HIDE_FROM_ABI _Tp __num_get_float(const char* __a, const char* __a_end, ios_base::iostate& __err) {
+ if (__a != __a_end) {
+ __libcpp_remove_reference_t<decltype(errno)> __save_errno = errno;
+ errno = 0;
+ char* __p2;
+ _Tp __ld = std::__do_strtod<_Tp>(__a, &__p2);
+ __libcpp_remove_reference_t<decltype(errno)> __current_errno = errno;
+ if (__current_errno == 0)
+ errno = __save_errno;
+ if (__p2 != __a_end) {
+ __err = ios_base::failbit;
+ return 0;
+ } else if (__current_errno == ERANGE)
+ __err = ios_base::failbit;
+ return __ld;
+ }
+ __err = ios_base::failbit;
+ return 0;
}
template <class _CharT, class _InputIterator>
-_InputIterator
-num_get<_CharT, _InputIterator>::do_get(iter_type __b, iter_type __e,
- ios_base& __iob,
- ios_base::iostate& __err,
- bool& __v) const
-{
- if ((__iob.flags() & ios_base::boolalpha) == 0)
- {
- long __lv = -1;
- __b = do_get(__b, __e, __iob, __err, __lv);
- switch (__lv)
- {
- case 0:
- __v = false;
- break;
- case 1:
- __v = true;
- break;
- default:
- __v = true;
- __err = ios_base::failbit;
- break;
- }
- return __b;
+_InputIterator num_get<_CharT, _InputIterator>::do_get(
+ iter_type __b, iter_type __e, ios_base& __iob, ios_base::iostate& __err, bool& __v) const {
+ if ((__iob.flags() & ios_base::boolalpha) == 0) {
+ long __lv = -1;
+ __b = do_get(__b, __e, __iob, __err, __lv);
+ switch (__lv) {
+ case 0:
+ __v = false;
+ break;
+ case 1:
+ __v = true;
+ break;
+ default:
+ __v = true;
+ __err = ios_base::failbit;
+ break;
}
- const ctype<_CharT>& __ct = std::use_facet<ctype<_CharT> >(__iob.getloc());
- const numpunct<_CharT>& __np = std::use_facet<numpunct<_CharT> >(__iob.getloc());
- typedef typename numpunct<_CharT>::string_type string_type;
- const string_type __names[2] = {__np.truename(), __np.falsename()};
- const string_type* __i = std::__scan_keyword(__b, __e, __names, __names+2,
- __ct, __err);
- __v = __i == __names;
return __b;
+ }
+ const ctype<_CharT>& __ct = std::use_facet<ctype<_CharT> >(__iob.getloc());
+ const numpunct<_CharT>& __np = std::use_facet<numpunct<_CharT> >(__iob.getloc());
+ typedef typename numpunct<_CharT>::string_type string_type;
+ const string_type __names[2] = {__np.truename(), __np.falsename()};
+ const string_type* __i = std::__scan_keyword(__b, __e, __names, __names + 2, __ct, __err);
+ __v = __i == __names;
+ return __b;
}
// signed
template <class _CharT, class _InputIterator>
template <class _Signed>
-_InputIterator
-num_get<_CharT, _InputIterator>::__do_get_signed(iter_type __b, iter_type __e,
- ios_base& __iob,
- ios_base::iostate& __err,
- _Signed& __v) const
-{
- // Stage 1
- int __base = this->__get_base(__iob);
- // Stage 2
- char_type __thousands_sep;
- const int __atoms_size = 26;
+_InputIterator num_get<_CharT, _InputIterator>::__do_get_signed(
+ iter_type __b, iter_type __e, ios_base& __iob, ios_base::iostate& __err, _Signed& __v) const {
+ // Stage 1
+ int __base = this->__get_base(__iob);
+ // Stage 2
+ char_type __thousands_sep;
+ const int __atoms_size = 26;
#ifdef _LIBCPP_ABI_OPTIMIZED_LOCALE_NUM_GET
- char_type __atoms1[__atoms_size];
- const char_type *__atoms = this->__do_widen(__iob, __atoms1);
- string __grouping = this->__stage2_int_prep(__iob, __thousands_sep);
+ char_type __atoms1[__atoms_size];
+ const char_type* __atoms = this->__do_widen(__iob, __atoms1);
+ string __grouping = this->__stage2_int_prep(__iob, __thousands_sep);
#else
- char_type __atoms[__atoms_size];
- string __grouping = this->__stage2_int_prep(__iob, __atoms, __thousands_sep);
+ char_type __atoms[__atoms_size];
+ string __grouping = this->__stage2_int_prep(__iob, __atoms, __thousands_sep);
#endif
- string __buf;
- __buf.resize(__buf.capacity());
- char* __a = &__buf[0];
- char* __a_end = __a;
- unsigned __g[__num_get_base::__num_get_buf_sz];
- unsigned* __g_end = __g;
- unsigned __dc = 0;
- for (; __b != __e; ++__b)
- {
- if (__a_end == __a + __buf.size())
- {
- size_t __tmp = __buf.size();
- __buf.resize(2*__buf.size());
- __buf.resize(__buf.capacity());
- __a = &__buf[0];
- __a_end = __a + __tmp;
- }
- if (this->__stage2_int_loop(*__b, __base, __a, __a_end, __dc,
- __thousands_sep, __grouping, __g, __g_end,
- __atoms))
- break;
- }
- if (__grouping.size() != 0 && __g_end-__g < __num_get_base::__num_get_buf_sz)
- *__g_end++ = __dc;
- // Stage 3
- __v = std::__num_get_signed_integral<_Signed>(__a, __a_end, __err, __base);
- // Digit grouping checked
- __check_grouping(__grouping, __g, __g_end, __err);
- // EOF checked
- if (__b == __e)
- __err |= ios_base::eofbit;
- return __b;
+ string __buf;
+ __buf.resize(__buf.capacity());
+ char* __a = &__buf[0];
+ char* __a_end = __a;
+ unsigned __g[__num_get_base::__num_get_buf_sz];
+ unsigned* __g_end = __g;
+ unsigned __dc = 0;
+ for (; __b != __e; ++__b) {
+ if (__a_end == __a + __buf.size()) {
+ size_t __tmp = __buf.size();
+ __buf.resize(2 * __buf.size());
+ __buf.resize(__buf.capacity());
+ __a = &__buf[0];
+ __a_end = __a + __tmp;
+ }
+ if (this->__stage2_int_loop(*__b, __base, __a, __a_end, __dc, __thousands_sep, __grouping, __g, __g_end, __atoms))
+ break;
+ }
+ if (__grouping.size() != 0 && __g_end - __g < __num_get_base::__num_get_buf_sz)
+ *__g_end++ = __dc;
+ // Stage 3
+ __v = std::__num_get_signed_integral<_Signed>(__a, __a_end, __err, __base);
+ // Digit grouping checked
+ __check_grouping(__grouping, __g, __g_end, __err);
+ // EOF checked
+ if (__b == __e)
+ __err |= ios_base::eofbit;
+ return __b;
}
// unsigned
template <class _CharT, class _InputIterator>
template <class _Unsigned>
-_InputIterator
-num_get<_CharT, _InputIterator>::__do_get_unsigned(iter_type __b, iter_type __e,
- ios_base& __iob,
- ios_base::iostate& __err,
- _Unsigned& __v) const
-{
- // Stage 1
- int __base = this->__get_base(__iob);
- // Stage 2
- char_type __thousands_sep;
- const int __atoms_size = 26;
+_InputIterator num_get<_CharT, _InputIterator>::__do_get_unsigned(
+ iter_type __b, iter_type __e, ios_base& __iob, ios_base::iostate& __err, _Unsigned& __v) const {
+ // Stage 1
+ int __base = this->__get_base(__iob);
+ // Stage 2
+ char_type __thousands_sep;
+ const int __atoms_size = 26;
#ifdef _LIBCPP_ABI_OPTIMIZED_LOCALE_NUM_GET
- char_type __atoms1[__atoms_size];
- const char_type *__atoms = this->__do_widen(__iob, __atoms1);
- string __grouping = this->__stage2_int_prep(__iob, __thousands_sep);
+ char_type __atoms1[__atoms_size];
+ const char_type* __atoms = this->__do_widen(__iob, __atoms1);
+ string __grouping = this->__stage2_int_prep(__iob, __thousands_sep);
#else
- char_type __atoms[__atoms_size];
- string __grouping = this->__stage2_int_prep(__iob, __atoms, __thousands_sep);
+ char_type __atoms[__atoms_size];
+ string __grouping = this->__stage2_int_prep(__iob, __atoms, __thousands_sep);
#endif
- string __buf;
- __buf.resize(__buf.capacity());
- char* __a = &__buf[0];
- char* __a_end = __a;
- unsigned __g[__num_get_base::__num_get_buf_sz];
- unsigned* __g_end = __g;
- unsigned __dc = 0;
- for (; __b != __e; ++__b)
- {
- if (__a_end == __a + __buf.size())
- {
- size_t __tmp = __buf.size();
- __buf.resize(2*__buf.size());
- __buf.resize(__buf.capacity());
- __a = &__buf[0];
- __a_end = __a + __tmp;
- }
- if (this->__stage2_int_loop(*__b, __base, __a, __a_end, __dc,
- __thousands_sep, __grouping, __g, __g_end,
- __atoms))
- break;
- }
- if (__grouping.size() != 0 && __g_end-__g < __num_get_base::__num_get_buf_sz)
- *__g_end++ = __dc;
- // Stage 3
- __v = std::__num_get_unsigned_integral<_Unsigned>(__a, __a_end, __err, __base);
- // Digit grouping checked
- __check_grouping(__grouping, __g, __g_end, __err);
- // EOF checked
- if (__b == __e)
- __err |= ios_base::eofbit;
- return __b;
+ string __buf;
+ __buf.resize(__buf.capacity());
+ char* __a = &__buf[0];
+ char* __a_end = __a;
+ unsigned __g[__num_get_base::__num_get_buf_sz];
+ unsigned* __g_end = __g;
+ unsigned __dc = 0;
+ for (; __b != __e; ++__b) {
+ if (__a_end == __a + __buf.size()) {
+ size_t __tmp = __buf.size();
+ __buf.resize(2 * __buf.size());
+ __buf.resize(__buf.capacity());
+ __a = &__buf[0];
+ __a_end = __a + __tmp;
+ }
+ if (this->__stage2_int_loop(*__b, __base, __a, __a_end, __dc, __thousands_sep, __grouping, __g, __g_end, __atoms))
+ break;
+ }
+ if (__grouping.size() != 0 && __g_end - __g < __num_get_base::__num_get_buf_sz)
+ *__g_end++ = __dc;
+ // Stage 3
+ __v = std::__num_get_unsigned_integral<_Unsigned>(__a, __a_end, __err, __base);
+ // Digit grouping checked
+ __check_grouping(__grouping, __g, __g_end, __err);
+ // EOF checked
+ if (__b == __e)
+ __err |= ios_base::eofbit;
+ return __b;
}
// floating point
template <class _CharT, class _InputIterator>
template <class _Fp>
-_InputIterator
-num_get<_CharT, _InputIterator>::__do_get_floating_point(iter_type __b, iter_type __e,
- ios_base& __iob,
- ios_base::iostate& __err,
- _Fp& __v) const
-{
- // Stage 1, nothing to do
- // Stage 2
- char_type __atoms[32];
- char_type __decimal_point;
- char_type __thousands_sep;
- string __grouping = this->__stage2_float_prep(__iob, __atoms,
- __decimal_point,
- __thousands_sep);
- string __buf;
- __buf.resize(__buf.capacity());
- char* __a = &__buf[0];
- char* __a_end = __a;
- unsigned __g[__num_get_base::__num_get_buf_sz];
- unsigned* __g_end = __g;
- unsigned __dc = 0;
- bool __in_units = true;
- char __exp = 'E';
- for (; __b != __e; ++__b)
- {
- if (__a_end == __a + __buf.size())
- {
- size_t __tmp = __buf.size();
- __buf.resize(2*__buf.size());
- __buf.resize(__buf.capacity());
- __a = &__buf[0];
- __a_end = __a + __tmp;
- }
- if (this->__stage2_float_loop(*__b, __in_units, __exp, __a, __a_end,
- __decimal_point, __thousands_sep,
- __grouping, __g, __g_end,
- __dc, __atoms))
- break;
- }
- if (__grouping.size() != 0 && __in_units && __g_end-__g < __num_get_base::__num_get_buf_sz)
- *__g_end++ = __dc;
- // Stage 3
- __v = std::__num_get_float<_Fp>(__a, __a_end, __err);
- // Digit grouping checked
- __check_grouping(__grouping, __g, __g_end, __err);
- // EOF checked
- if (__b == __e)
- __err |= ios_base::eofbit;
- return __b;
+_InputIterator num_get<_CharT, _InputIterator>::__do_get_floating_point(
+ iter_type __b, iter_type __e, ios_base& __iob, ios_base::iostate& __err, _Fp& __v) const {
+ // Stage 1, nothing to do
+ // Stage 2
+ char_type __atoms[32];
+ char_type __decimal_point;
+ char_type __thousands_sep;
+ string __grouping = this->__stage2_float_prep(__iob, __atoms, __decimal_point, __thousands_sep);
+ string __buf;
+ __buf.resize(__buf.capacity());
+ char* __a = &__buf[0];
+ char* __a_end = __a;
+ unsigned __g[__num_get_base::__num_get_buf_sz];
+ unsigned* __g_end = __g;
+ unsigned __dc = 0;
+ bool __in_units = true;
+ char __exp = 'E';
+ for (; __b != __e; ++__b) {
+ if (__a_end == __a + __buf.size()) {
+ size_t __tmp = __buf.size();
+ __buf.resize(2 * __buf.size());
+ __buf.resize(__buf.capacity());
+ __a = &__buf[0];
+ __a_end = __a + __tmp;
+ }
+ if (this->__stage2_float_loop(
+ *__b,
+ __in_units,
+ __exp,
+ __a,
+ __a_end,
+ __decimal_point,
+ __thousands_sep,
+ __grouping,
+ __g,
+ __g_end,
+ __dc,
+ __atoms))
+ break;
+ }
+ if (__grouping.size() != 0 && __in_units && __g_end - __g < __num_get_base::__num_get_buf_sz)
+ *__g_end++ = __dc;
+ // Stage 3
+ __v = std::__num_get_float<_Fp>(__a, __a_end, __err);
+ // Digit grouping checked
+ __check_grouping(__grouping, __g, __g_end, __err);
+ // EOF checked
+ if (__b == __e)
+ __err |= ios_base::eofbit;
+ return __b;
}
template <class _CharT, class _InputIterator>
-_InputIterator
-num_get<_CharT, _InputIterator>::do_get(iter_type __b, iter_type __e,
- ios_base& __iob,
- ios_base::iostate& __err,
- void*& __v) const
-{
- // Stage 1
- int __base = 16;
- // Stage 2
- char_type __atoms[26];
- char_type __thousands_sep = char_type();
- string __grouping;
- std::use_facet<ctype<_CharT> >(__iob.getloc()).widen(__num_get_base::__src,
- __num_get_base::__src + 26, __atoms);
- string __buf;
- __buf.resize(__buf.capacity());
- char* __a = &__buf[0];
- char* __a_end = __a;
- unsigned __g[__num_get_base::__num_get_buf_sz];
- unsigned* __g_end = __g;
- unsigned __dc = 0;
- for (; __b != __e; ++__b)
- {
- if (__a_end == __a + __buf.size())
- {
- size_t __tmp = __buf.size();
- __buf.resize(2*__buf.size());
- __buf.resize(__buf.capacity());
- __a = &__buf[0];
- __a_end = __a + __tmp;
- }
- if (this->__stage2_int_loop(*__b, __base, __a, __a_end, __dc,
- __thousands_sep, __grouping,
- __g, __g_end, __atoms))
- break;
- }
- // Stage 3
- __buf.resize(__a_end - __a);
- if (__libcpp_sscanf_l(__buf.c_str(), _LIBCPP_GET_C_LOCALE, "%p", &__v) != 1)
- __err = ios_base::failbit;
- // EOF checked
- if (__b == __e)
- __err |= ios_base::eofbit;
- return __b;
+_InputIterator num_get<_CharT, _InputIterator>::do_get(
+ iter_type __b, iter_type __e, ios_base& __iob, ios_base::iostate& __err, void*& __v) const {
+ // Stage 1
+ int __base = 16;
+ // Stage 2
+ char_type __atoms[26];
+ char_type __thousands_sep = char_type();
+ string __grouping;
+ std::use_facet<ctype<_CharT> >(__iob.getloc()).widen(__num_get_base::__src, __num_get_base::__src + 26, __atoms);
+ string __buf;
+ __buf.resize(__buf.capacity());
+ char* __a = &__buf[0];
+ char* __a_end = __a;
+ unsigned __g[__num_get_base::__num_get_buf_sz];
+ unsigned* __g_end = __g;
+ unsigned __dc = 0;
+ for (; __b != __e; ++__b) {
+ if (__a_end == __a + __buf.size()) {
+ size_t __tmp = __buf.size();
+ __buf.resize(2 * __buf.size());
+ __buf.resize(__buf.capacity());
+ __a = &__buf[0];
+ __a_end = __a + __tmp;
+ }
+ if (this->__stage2_int_loop(*__b, __base, __a, __a_end, __dc, __thousands_sep, __grouping, __g, __g_end, __atoms))
+ break;
+ }
+ // Stage 3
+ __buf.resize(__a_end - __a);
+ if (__libcpp_sscanf_l(__buf.c_str(), _LIBCPP_GET_C_LOCALE, "%p", &__v) != 1)
+ __err = ios_base::failbit;
+ // EOF checked
+ if (__b == __e)
+ __err |= ios_base::eofbit;
+ return __b;
}
extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS num_get<char>;
@@ -1126,151 +1033,117 @@ extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS num_get<char>;
extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS num_get<wchar_t>;
#endif
-struct _LIBCPP_EXPORTED_FROM_ABI __num_put_base
-{
+struct _LIBCPP_EXPORTED_FROM_ABI __num_put_base {
protected:
- static void __format_int(char* __fmt, const char* __len, bool __signd,
- ios_base::fmtflags __flags);
- static bool __format_float(char* __fmt, const char* __len,
- ios_base::fmtflags __flags);
- static char* __identify_padding(char* __nb, char* __ne,
- const ios_base& __iob);
+ static void __format_int(char* __fmt, const char* __len, bool __signd, ios_base::fmtflags __flags);
+ static bool __format_float(char* __fmt, const char* __len, ios_base::fmtflags __flags);
+ static char* __identify_padding(char* __nb, char* __ne, const ios_base& __iob);
};
template <class _CharT>
-struct __num_put
- : protected __num_put_base
-{
- static void __widen_and_group_int(char* __nb, char* __np, char* __ne,
- _CharT* __ob, _CharT*& __op, _CharT*& __oe,
- const locale& __loc);
- static void __widen_and_group_float(char* __nb, char* __np, char* __ne,
- _CharT* __ob, _CharT*& __op, _CharT*& __oe,
- const locale& __loc);
+struct __num_put : protected __num_put_base {
+ static void __widen_and_group_int(
+ char* __nb, char* __np, char* __ne, _CharT* __ob, _CharT*& __op, _CharT*& __oe, const locale& __loc);
+ static void __widen_and_group_float(
+ char* __nb, char* __np, char* __ne, _CharT* __ob, _CharT*& __op, _CharT*& __oe, const locale& __loc);
};
template <class _CharT>
-void
-__num_put<_CharT>::__widen_and_group_int(char* __nb, char* __np, char* __ne,
- _CharT* __ob, _CharT*& __op, _CharT*& __oe,
- const locale& __loc)
-{
- const ctype<_CharT>& __ct = std::use_facet<ctype<_CharT> > (__loc);
- const numpunct<_CharT>& __npt = std::use_facet<numpunct<_CharT> >(__loc);
- string __grouping = __npt.grouping();
- if (__grouping.empty())
- {
- __ct.widen(__nb, __ne, __ob);
- __oe = __ob + (__ne - __nb);
- }
- else
- {
- __oe = __ob;
- char* __nf = __nb;
- if (*__nf == '-' || *__nf == '+')
- *__oe++ = __ct.widen(*__nf++);
- if (__ne - __nf >= 2 && __nf[0] == '0' && (__nf[1] == 'x' ||
- __nf[1] == 'X'))
- {
- *__oe++ = __ct.widen(*__nf++);
- *__oe++ = __ct.widen(*__nf++);
- }
- std::reverse(__nf, __ne);
- _CharT __thousands_sep = __npt.thousands_sep();
- unsigned __dc = 0;
- unsigned __dg = 0;
- for (char* __p = __nf; __p < __ne; ++__p)
- {
- if (static_cast<unsigned>(__grouping[__dg]) > 0 &&
- __dc == static_cast<unsigned>(__grouping[__dg]))
- {
- *__oe++ = __thousands_sep;
- __dc = 0;
- if (__dg < __grouping.size()-1)
- ++__dg;
- }
- *__oe++ = __ct.widen(*__p);
- ++__dc;
- }
- std::reverse(__ob + (__nf - __nb), __oe);
- }
- if (__np == __ne)
- __op = __oe;
- else
- __op = __ob + (__np - __nb);
+void __num_put<_CharT>::__widen_and_group_int(
+ char* __nb, char* __np, char* __ne, _CharT* __ob, _CharT*& __op, _CharT*& __oe, const locale& __loc) {
+ const ctype<_CharT>& __ct = std::use_facet<ctype<_CharT> >(__loc);
+ const numpunct<_CharT>& __npt = std::use_facet<numpunct<_CharT> >(__loc);
+ string __grouping = __npt.grouping();
+ if (__grouping.empty()) {
+ __ct.widen(__nb, __ne, __ob);
+ __oe = __ob + (__ne - __nb);
+ } else {
+ __oe = __ob;
+ char* __nf = __nb;
+ if (*__nf == '-' || *__nf == '+')
+ *__oe++ = __ct.widen(*__nf++);
+ if (__ne - __nf >= 2 && __nf[0] == '0' && (__nf[1] == 'x' || __nf[1] == 'X')) {
+ *__oe++ = __ct.widen(*__nf++);
+ *__oe++ = __ct.widen(*__nf++);
+ }
+ std::reverse(__nf, __ne);
+ _CharT __thousands_sep = __npt.thousands_sep();
+ unsigned __dc = 0;
+ unsigned __dg = 0;
+ for (char* __p = __nf; __p < __ne; ++__p) {
+ if (static_cast<unsigned>(__grouping[__dg]) > 0 && __dc == static_cast<unsigned>(__grouping[__dg])) {
+ *__oe++ = __thousands_sep;
+ __dc = 0;
+ if (__dg < __grouping.size() - 1)
+ ++__dg;
+ }
+ *__oe++ = __ct.widen(*__p);
+ ++__dc;
+ }
+ std::reverse(__ob + (__nf - __nb), __oe);
+ }
+ if (__np == __ne)
+ __op = __oe;
+ else
+ __op = __ob + (__np - __nb);
}
template <class _CharT>
-void
-__num_put<_CharT>::__widen_and_group_float(char* __nb, char* __np, char* __ne,
- _CharT* __ob, _CharT*& __op, _CharT*& __oe,
- const locale& __loc)
-{
- const ctype<_CharT>& __ct = std::use_facet<ctype<_CharT> > (__loc);
- const numpunct<_CharT>& __npt = std::use_facet<numpunct<_CharT> >(__loc);
- string __grouping = __npt.grouping();
- __oe = __ob;
- char* __nf = __nb;
- if (*__nf == '-' || *__nf == '+')
- *__oe++ = __ct.widen(*__nf++);
- char* __ns;
- if (__ne - __nf >= 2 && __nf[0] == '0' && (__nf[1] == 'x' ||
- __nf[1] == 'X'))
- {
- *__oe++ = __ct.widen(*__nf++);
- *__oe++ = __ct.widen(*__nf++);
- for (__ns = __nf; __ns < __ne; ++__ns)
- if (!isxdigit_l(*__ns, _LIBCPP_GET_C_LOCALE))
- break;
- }
- else
- {
- for (__ns = __nf; __ns < __ne; ++__ns)
- if (!isdigit_l(*__ns, _LIBCPP_GET_C_LOCALE))
- break;
- }
- if (__grouping.empty())
- {
- __ct.widen(__nf, __ns, __oe);
- __oe += __ns - __nf;
- }
- else
- {
- std::reverse(__nf, __ns);
- _CharT __thousands_sep = __npt.thousands_sep();
- unsigned __dc = 0;
- unsigned __dg = 0;
- for (char* __p = __nf; __p < __ns; ++__p)
- {
- if (__grouping[__dg] > 0 && __dc == static_cast<unsigned>(__grouping[__dg]))
- {
- *__oe++ = __thousands_sep;
- __dc = 0;
- if (__dg < __grouping.size()-1)
- ++__dg;
- }
- *__oe++ = __ct.widen(*__p);
- ++__dc;
- }
- std::reverse(__ob + (__nf - __nb), __oe);
- }
- for (__nf = __ns; __nf < __ne; ++__nf)
- {
- if (*__nf == '.')
- {
- *__oe++ = __npt.decimal_point();
- ++__nf;
- break;
- }
- else
- *__oe++ = __ct.widen(*__nf);
- }
- __ct.widen(__nf, __ne, __oe);
- __oe += __ne - __nf;
- if (__np == __ne)
- __op = __oe;
- else
- __op = __ob + (__np - __nb);
+void __num_put<_CharT>::__widen_and_group_float(
+ char* __nb, char* __np, char* __ne, _CharT* __ob, _CharT*& __op, _CharT*& __oe, const locale& __loc) {
+ const ctype<_CharT>& __ct = std::use_facet<ctype<_CharT> >(__loc);
+ const numpunct<_CharT>& __npt = std::use_facet<numpunct<_CharT> >(__loc);
+ string __grouping = __npt.grouping();
+ __oe = __ob;
+ char* __nf = __nb;
+ if (*__nf == '-' || *__nf == '+')
+ *__oe++ = __ct.widen(*__nf++);
+ char* __ns;
+ if (__ne - __nf >= 2 && __nf[0] == '0' && (__nf[1] == 'x' || __nf[1] == 'X')) {
+ *__oe++ = __ct.widen(*__nf++);
+ *__oe++ = __ct.widen(*__nf++);
+ for (__ns = __nf; __ns < __ne; ++__ns)
+ if (!isxdigit_l(*__ns, _LIBCPP_GET_C_LOCALE))
+ break;
+ } else {
+ for (__ns = __nf; __ns < __ne; ++__ns)
+ if (!isdigit_l(*__ns, _LIBCPP_GET_C_LOCALE))
+ break;
+ }
+ if (__grouping.empty()) {
+ __ct.widen(__nf, __ns, __oe);
+ __oe += __ns - __nf;
+ } else {
+ std::reverse(__nf, __ns);
+ _CharT __thousands_sep = __npt.thousands_sep();
+ unsigned __dc = 0;
+ unsigned __dg = 0;
+ for (char* __p = __nf; __p < __ns; ++__p) {
+ if (__grouping[__dg] > 0 && __dc == static_cast<unsigned>(__grouping[__dg])) {
+ *__oe++ = __thousands_sep;
+ __dc = 0;
+ if (__dg < __grouping.size() - 1)
+ ++__dg;
+ }
+ *__oe++ = __ct.widen(*__p);
+ ++__dc;
+ }
+ std::reverse(__ob + (__nf - __nb), __oe);
+ }
+ for (__nf = __ns; __nf < __ne; ++__nf) {
+ if (*__nf == '.') {
+ *__oe++ = __npt.decimal_point();
+ ++__nf;
+ break;
+ } else
+ *__oe++ = __ct.widen(*__nf);
+ }
+ __ct.widen(__nf, __ne, __oe);
+ __oe += __ne - __nf;
+ if (__np == __ne)
+ __op = __oe;
+ else
+ __op = __ob + (__np - __nb);
}
extern template struct _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS __num_put<char>;
@@ -1279,363 +1152,285 @@ extern template struct _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS __num_put<wchar_t>;
#endif
template <class _CharT, class _OutputIterator = ostreambuf_iterator<_CharT> >
-class _LIBCPP_TEMPLATE_VIS num_put
- : public locale::facet,
- private __num_put<_CharT>
-{
+class _LIBCPP_TEMPLATE_VIS num_put : public locale::facet, private __num_put<_CharT> {
public:
- typedef _CharT char_type;
- typedef _OutputIterator iter_type;
-
- _LIBCPP_HIDE_FROM_ABI
- explicit num_put(size_t __refs = 0)
- : locale::facet(__refs) {}
-
- _LIBCPP_HIDE_FROM_ABI
- iter_type put(iter_type __s, ios_base& __iob, char_type __fl,
- bool __v) const
- {
- return do_put(__s, __iob, __fl, __v);
- }
+ typedef _CharT char_type;
+ typedef _OutputIterator iter_type;
- _LIBCPP_HIDE_FROM_ABI
- iter_type put(iter_type __s, ios_base& __iob, char_type __fl,
- long __v) const
- {
- return do_put(__s, __iob, __fl, __v);
- }
+ _LIBCPP_HIDE_FROM_ABI explicit num_put(size_t __refs = 0) : locale::facet(__refs) {}
- _LIBCPP_HIDE_FROM_ABI
- iter_type put(iter_type __s, ios_base& __iob, char_type __fl,
- long long __v) const
- {
- return do_put(__s, __iob, __fl, __v);
- }
+ _LIBCPP_HIDE_FROM_ABI iter_type put(iter_type __s, ios_base& __iob, char_type __fl, bool __v) const {
+ return do_put(__s, __iob, __fl, __v);
+ }
- _LIBCPP_HIDE_FROM_ABI
- iter_type put(iter_type __s, ios_base& __iob, char_type __fl,
- unsigned long __v) const
- {
- return do_put(__s, __iob, __fl, __v);
- }
+ _LIBCPP_HIDE_FROM_ABI iter_type put(iter_type __s, ios_base& __iob, char_type __fl, long __v) const {
+ return do_put(__s, __iob, __fl, __v);
+ }
- _LIBCPP_HIDE_FROM_ABI
- iter_type put(iter_type __s, ios_base& __iob, char_type __fl,
- unsigned long long __v) const
- {
- return do_put(__s, __iob, __fl, __v);
- }
+ _LIBCPP_HIDE_FROM_ABI iter_type put(iter_type __s, ios_base& __iob, char_type __fl, long long __v) const {
+ return do_put(__s, __iob, __fl, __v);
+ }
- _LIBCPP_HIDE_FROM_ABI
- iter_type put(iter_type __s, ios_base& __iob, char_type __fl,
- double __v) const
- {
- return do_put(__s, __iob, __fl, __v);
- }
+ _LIBCPP_HIDE_FROM_ABI iter_type put(iter_type __s, ios_base& __iob, char_type __fl, unsigned long __v) const {
+ return do_put(__s, __iob, __fl, __v);
+ }
- _LIBCPP_HIDE_FROM_ABI
- iter_type put(iter_type __s, ios_base& __iob, char_type __fl,
- long double __v) const
- {
- return do_put(__s, __iob, __fl, __v);
- }
+ _LIBCPP_HIDE_FROM_ABI iter_type put(iter_type __s, ios_base& __iob, char_type __fl, unsigned long long __v) const {
+ return do_put(__s, __iob, __fl, __v);
+ }
- _LIBCPP_HIDE_FROM_ABI
- iter_type put(iter_type __s, ios_base& __iob, char_type __fl,
- const void* __v) const
- {
- return do_put(__s, __iob, __fl, __v);
- }
+ _LIBCPP_HIDE_FROM_ABI iter_type put(iter_type __s, ios_base& __iob, char_type __fl, double __v) const {
+ return do_put(__s, __iob, __fl, __v);
+ }
+
+ _LIBCPP_HIDE_FROM_ABI iter_type put(iter_type __s, ios_base& __iob, char_type __fl, long double __v) const {
+ return do_put(__s, __iob, __fl, __v);
+ }
- static locale::id id;
+ _LIBCPP_HIDE_FROM_ABI iter_type put(iter_type __s, ios_base& __iob, char_type __fl, const void* __v) const {
+ return do_put(__s, __iob, __fl, __v);
+ }
+
+ static locale::id id;
protected:
- _LIBCPP_HIDE_FROM_ABI_VIRTUAL ~num_put() override {}
-
- virtual iter_type do_put(iter_type __s, ios_base& __iob, char_type __fl,
- bool __v) const;
- virtual iter_type do_put(iter_type __s, ios_base& __iob, char_type __fl,
- long __v) const;
- virtual iter_type do_put(iter_type __s, ios_base& __iob, char_type __fl,
- long long __v) const;
- virtual iter_type do_put(iter_type __s, ios_base& __iob, char_type __fl,
- unsigned long) const;
- virtual iter_type do_put(iter_type __s, ios_base& __iob, char_type __fl,
- unsigned long long) const;
- virtual iter_type do_put(iter_type __s, ios_base& __iob, char_type __fl,
- double __v) const;
- virtual iter_type do_put(iter_type __s, ios_base& __iob, char_type __fl,
- long double __v) const;
- virtual iter_type do_put(iter_type __s, ios_base& __iob, char_type __fl,
- const void* __v) const;
-
- template <class _Integral>
- _LIBCPP_HIDE_FROM_ABI inline
- _OutputIterator __do_put_integral(iter_type __s, ios_base& __iob,
- char_type __fl, _Integral __v,
- char const* __len) const;
-
- template <class _Float>
- _LIBCPP_HIDE_FROM_ABI inline
- _OutputIterator __do_put_floating_point(iter_type __s, ios_base& __iob,
- char_type __fl, _Float __v,
- char const* __len) const;
+ _LIBCPP_HIDE_FROM_ABI_VIRTUAL ~num_put() override {}
+
+ virtual iter_type do_put(iter_type __s, ios_base& __iob, char_type __fl, bool __v) const;
+ virtual iter_type do_put(iter_type __s, ios_base& __iob, char_type __fl, long __v) const;
+ virtual iter_type do_put(iter_type __s, ios_base& __iob, char_type __fl, long long __v) const;
+ virtual iter_type do_put(iter_type __s, ios_base& __iob, char_type __fl, unsigned long) const;
+ virtual iter_type do_put(iter_type __s, ios_base& __iob, char_type __fl, unsigned long long) const;
+ virtual iter_type do_put(iter_type __s, ios_base& __iob, char_type __fl, double __v) const;
+ virtual iter_type do_put(iter_type __s, ios_base& __iob, char_type __fl, long double __v) const;
+ virtual iter_type do_put(iter_type __s, ios_base& __iob, char_type __fl, const void* __v) const;
+
+ template <class _Integral>
+ _LIBCPP_HIDE_FROM_ABI inline _OutputIterator
+ __do_put_integral(iter_type __s, ios_base& __iob, char_type __fl, _Integral __v, char const* __len) const;
+
+ template <class _Float>
+ _LIBCPP_HIDE_FROM_ABI inline _OutputIterator
+ __do_put_floating_point(iter_type __s, ios_base& __iob, char_type __fl, _Float __v, char const* __len) const;
};
template <class _CharT, class _OutputIterator>
-locale::id
-num_put<_CharT, _OutputIterator>::id;
+locale::id num_put<_CharT, _OutputIterator>::id;
template <class _CharT, class _OutputIterator>
-_LIBCPP_HIDE_FROM_ABI
-_OutputIterator
-__pad_and_output(_OutputIterator __s,
- const _CharT* __ob, const _CharT* __op, const _CharT* __oe,
- ios_base& __iob, _CharT __fl)
-{
- streamsize __sz = __oe - __ob;
- streamsize __ns = __iob.width();
- if (__ns > __sz)
- __ns -= __sz;
- else
- __ns = 0;
- for (;__ob < __op; ++__ob, ++__s)
- *__s = *__ob;
- for (; __ns; --__ns, ++__s)
- *__s = __fl;
- for (; __ob < __oe; ++__ob, ++__s)
- *__s = *__ob;
- __iob.width(0);
- return __s;
+_LIBCPP_HIDE_FROM_ABI _OutputIterator __pad_and_output(
+ _OutputIterator __s, const _CharT* __ob, const _CharT* __op, const _CharT* __oe, ios_base& __iob, _CharT __fl) {
+ streamsize __sz = __oe - __ob;
+ streamsize __ns = __iob.width();
+ if (__ns > __sz)
+ __ns -= __sz;
+ else
+ __ns = 0;
+ for (; __ob < __op; ++__ob, ++__s)
+ *__s = *__ob;
+ for (; __ns; --__ns, ++__s)
+ *__s = __fl;
+ for (; __ob < __oe; ++__ob, ++__s)
+ *__s = *__ob;
+ __iob.width(0);
+ return __s;
}
template <class _CharT, class _Traits>
-_LIBCPP_HIDE_FROM_ABI
-ostreambuf_iterator<_CharT, _Traits>
-__pad_and_output(ostreambuf_iterator<_CharT, _Traits> __s,
- const _CharT* __ob, const _CharT* __op, const _CharT* __oe,
- ios_base& __iob, _CharT __fl)
-{
- if (__s.__sbuf_ == nullptr)
- return __s;
- streamsize __sz = __oe - __ob;
- streamsize __ns = __iob.width();
- if (__ns > __sz)
- __ns -= __sz;
- else
- __ns = 0;
- streamsize __np = __op - __ob;
- if (__np > 0)
- {
- if (__s.__sbuf_->sputn(__ob, __np) != __np)
- {
- __s.__sbuf_ = nullptr;
- return __s;
- }
- }
- if (__ns > 0)
- {
- basic_string<_CharT, _Traits> __sp(__ns, __fl);
- if (__s.__sbuf_->sputn(__sp.data(), __ns) != __ns)
- {
- __s.__sbuf_ = nullptr;
- return __s;
- }
- }
- __np = __oe - __op;
- if (__np > 0)
- {
- if (__s.__sbuf_->sputn(__op, __np) != __np)
- {
- __s.__sbuf_ = nullptr;
- return __s;
- }
- }
- __iob.width(0);
+_LIBCPP_HIDE_FROM_ABI ostreambuf_iterator<_CharT, _Traits> __pad_and_output(
+ ostreambuf_iterator<_CharT, _Traits> __s,
+ const _CharT* __ob,
+ const _CharT* __op,
+ const _CharT* __oe,
+ ios_base& __iob,
+ _CharT __fl) {
+ if (__s.__sbuf_ == nullptr)
return __s;
+ streamsize __sz = __oe - __ob;
+ streamsize __ns = __iob.width();
+ if (__ns > __sz)
+ __ns -= __sz;
+ else
+ __ns = 0;
+ streamsize __np = __op - __ob;
+ if (__np > 0) {
+ if (__s.__sbuf_->sputn(__ob, __np) != __np) {
+ __s.__sbuf_ = nullptr;
+ return __s;
+ }
+ }
+ if (__ns > 0) {
+ basic_string<_CharT, _Traits> __sp(__ns, __fl);
+ if (__s.__sbuf_->sputn(__sp.data(), __ns) != __ns) {
+ __s.__sbuf_ = nullptr;
+ return __s;
+ }
+ }
+ __np = __oe - __op;
+ if (__np > 0) {
+ if (__s.__sbuf_->sputn(__op, __np) != __np) {
+ __s.__sbuf_ = nullptr;
+ return __s;
+ }
+ }
+ __iob.width(0);
+ return __s;
}
template <class _CharT, class _OutputIterator>
_OutputIterator
-num_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base& __iob,
- char_type __fl, bool __v) const
-{
- if ((__iob.flags() & ios_base::boolalpha) == 0)
- return do_put(__s, __iob, __fl, (unsigned long)__v);
- const numpunct<char_type>& __np = std::use_facet<numpunct<char_type> >(__iob.getloc());
- typedef typename numpunct<char_type>::string_type string_type;
- string_type __nm = __v ? __np.truename() : __np.falsename();
- for (typename string_type::iterator __i = __nm.begin(); __i != __nm.end(); ++__i, ++__s)
- *__s = *__i;
- return __s;
+num_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base& __iob, char_type __fl, bool __v) const {
+ if ((__iob.flags() & ios_base::boolalpha) == 0)
+ return do_put(__s, __iob, __fl, (unsigned long)__v);
+ const numpunct<char_type>& __np = std::use_facet<numpunct<char_type> >(__iob.getloc());
+ typedef typename numpunct<char_type>::string_type string_type;
+ string_type __nm = __v ? __np.truename() : __np.falsename();
+ for (typename string_type::iterator __i = __nm.begin(); __i != __nm.end(); ++__i, ++__s)
+ *__s = *__i;
+ return __s;
}
template <class _CharT, class _OutputIterator>
template <class _Integral>
-_LIBCPP_HIDE_FROM_ABI inline
-_OutputIterator
-num_put<_CharT, _OutputIterator>::__do_put_integral(iter_type __s, ios_base& __iob,
- char_type __fl, _Integral __v,
- char const* __len) const
-{
- // Stage 1 - Get number in narrow char
- char __fmt[8] = {'%', 0};
- this->__format_int(__fmt+1, __len, is_signed<_Integral>::value, __iob.flags());
- // Worst case is octal, with showbase enabled. Note that octal is always
- // printed as an unsigned value.
- using _Unsigned = typename make_unsigned<_Integral>::type;
- _LIBCPP_CONSTEXPR const unsigned __nbuf
- = (numeric_limits<_Unsigned>::digits / 3) // 1 char per 3 bits
- + ((numeric_limits<_Unsigned>::digits % 3) != 0) // round up
- + 2; // base prefix + terminating null character
- char __nar[__nbuf];
- _LIBCPP_DIAGNOSTIC_PUSH
- _LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Wformat-nonliteral")
- _LIBCPP_GCC_DIAGNOSTIC_IGNORED("-Wformat-nonliteral")
- int __nc = __libcpp_snprintf_l(__nar, sizeof(__nar), _LIBCPP_GET_C_LOCALE, __fmt, __v);
- _LIBCPP_DIAGNOSTIC_POP
- char* __ne = __nar + __nc;
- char* __np = this->__identify_padding(__nar, __ne, __iob);
- // Stage 2 - Widen __nar while adding thousands separators
- char_type __o[2*(__nbuf-1) - 1];
- char_type* __op; // pad here
- char_type* __oe; // end of output
- this->__widen_and_group_int(__nar, __np, __ne, __o, __op, __oe, __iob.getloc());
- // [__o, __oe) contains thousands_sep'd wide number
- // Stage 3 & 4
- return std::__pad_and_output(__s, __o, __op, __oe, __iob, __fl);
+_LIBCPP_HIDE_FROM_ABI inline _OutputIterator num_put<_CharT, _OutputIterator>::__do_put_integral(
+ iter_type __s, ios_base& __iob, char_type __fl, _Integral __v, char const* __len) const {
+ // Stage 1 - Get number in narrow char
+ char __fmt[8] = {'%', 0};
+ this->__format_int(__fmt + 1, __len, is_signed<_Integral>::value, __iob.flags());
+ // Worst case is octal, with showbase enabled. Note that octal is always
+ // printed as an unsigned value.
+ using _Unsigned = typename make_unsigned<_Integral>::type;
+ _LIBCPP_CONSTEXPR const unsigned __nbuf =
+ (numeric_limits<_Unsigned>::digits / 3) // 1 char per 3 bits
+ + ((numeric_limits<_Unsigned>::digits % 3) != 0) // round up
+ + 2; // base prefix + terminating null character
+ char __nar[__nbuf];
+ _LIBCPP_DIAGNOSTIC_PUSH
+ _LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Wformat-nonliteral")
+ _LIBCPP_GCC_DIAGNOSTIC_IGNORED("-Wformat-nonliteral")
+ int __nc = __libcpp_snprintf_l(__nar, sizeof(__nar), _LIBCPP_GET_C_LOCALE, __fmt, __v);
+ _LIBCPP_DIAGNOSTIC_POP
+ char* __ne = __nar + __nc;
+ char* __np = this->__identify_padding(__nar, __ne, __iob);
+ // Stage 2 - Widen __nar while adding thousands separators
+ char_type __o[2 * (__nbuf - 1) - 1];
+ char_type* __op; // pad here
+ char_type* __oe; // end of output
+ this->__widen_and_group_int(__nar, __np, __ne, __o, __op, __oe, __iob.getloc());
+ // [__o, __oe) contains thousands_sep'd wide number
+ // Stage 3 & 4
+ return std::__pad_and_output(__s, __o, __op, __oe, __iob, __fl);
}
template <class _CharT, class _OutputIterator>
_OutputIterator
-num_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base& __iob,
- char_type __fl, long __v) const
-{
- return this->__do_put_integral(__s, __iob, __fl, __v, "l");
+num_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base& __iob, char_type __fl, long __v) const {
+ return this->__do_put_integral(__s, __iob, __fl, __v, "l");
}
template <class _CharT, class _OutputIterator>
_OutputIterator
-num_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base& __iob,
- char_type __fl, long long __v) const
-{
- return this->__do_put_integral(__s, __iob, __fl, __v, "ll");
+num_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base& __iob, char_type __fl, long long __v) const {
+ return this->__do_put_integral(__s, __iob, __fl, __v, "ll");
}
template <class _CharT, class _OutputIterator>
_OutputIterator
-num_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base& __iob,
- char_type __fl, unsigned long __v) const
-{
- return this->__do_put_integral(__s, __iob, __fl, __v, "l");
+num_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base& __iob, char_type __fl, unsigned long __v) const {
+ return this->__do_put_integral(__s, __iob, __fl, __v, "l");
}
template <class _CharT, class _OutputIterator>
_OutputIterator
-num_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base& __iob,
- char_type __fl, unsigned long long __v) const
-{
- return this->__do_put_integral(__s, __iob, __fl, __v, "ll");
+num_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base& __iob, char_type __fl, unsigned long long __v) const {
+ return this->__do_put_integral(__s, __iob, __fl, __v, "ll");
}
template <class _CharT, class _OutputIterator>
template <class _Float>
-_LIBCPP_HIDE_FROM_ABI inline
-_OutputIterator
-num_put<_CharT, _OutputIterator>::__do_put_floating_point(iter_type __s, ios_base& __iob,
- char_type __fl, _Float __v,
- char const* __len) const
-{
- // Stage 1 - Get number in narrow char
- char __fmt[8] = {'%', 0};
- bool __specify_precision = this->__format_float(__fmt+1, __len, __iob.flags());
- const unsigned __nbuf = 30;
- char __nar[__nbuf];
- char* __nb = __nar;
- int __nc;
- _LIBCPP_DIAGNOSTIC_PUSH
- _LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Wformat-nonliteral")
- _LIBCPP_GCC_DIAGNOSTIC_IGNORED("-Wformat-nonliteral")
+_LIBCPP_HIDE_FROM_ABI inline _OutputIterator num_put<_CharT, _OutputIterator>::__do_put_floating_point(
+ iter_type __s, ios_base& __iob, char_type __fl, _Float __v, char const* __len) const {
+ // Stage 1 - Get number in narrow char
+ char __fmt[8] = {'%', 0};
+ bool __specify_precision = this->__format_float(__fmt + 1, __len, __iob.flags());
+ const unsigned __nbuf = 30;
+ char __nar[__nbuf];
+ char* __nb = __nar;
+ int __nc;
+ _LIBCPP_DIAGNOSTIC_PUSH
+ _LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Wformat-nonliteral")
+ _LIBCPP_GCC_DIAGNOSTIC_IGNORED("-Wformat-nonliteral")
+ if (__specify_precision)
+ __nc = __libcpp_snprintf_l(__nb, __nbuf, _LIBCPP_GET_C_LOCALE, __fmt, (int)__iob.precision(), __v);
+ else
+ __nc = __libcpp_snprintf_l(__nb, __nbuf, _LIBCPP_GET_C_LOCALE, __fmt, __v);
+ unique_ptr<char, void (*)(void*)> __nbh(nullptr, free);
+ if (__nc > static_cast<int>(__nbuf - 1)) {
if (__specify_precision)
- __nc = __libcpp_snprintf_l(__nb, __nbuf, _LIBCPP_GET_C_LOCALE, __fmt,
- (int)__iob.precision(), __v);
+ __nc = __libcpp_asprintf_l(&__nb, _LIBCPP_GET_C_LOCALE, __fmt, (int)__iob.precision(), __v);
else
- __nc = __libcpp_snprintf_l(__nb, __nbuf, _LIBCPP_GET_C_LOCALE, __fmt, __v);
- unique_ptr<char, void(*)(void*)> __nbh(nullptr, free);
- if (__nc > static_cast<int>(__nbuf-1))
- {
- if (__specify_precision)
- __nc = __libcpp_asprintf_l(&__nb, _LIBCPP_GET_C_LOCALE, __fmt, (int)__iob.precision(), __v);
- else
- __nc = __libcpp_asprintf_l(&__nb, _LIBCPP_GET_C_LOCALE, __fmt, __v);
- if (__nc == -1)
- __throw_bad_alloc();
- __nbh.reset(__nb);
- }
- _LIBCPP_DIAGNOSTIC_POP
- char* __ne = __nb + __nc;
- char* __np = this->__identify_padding(__nb, __ne, __iob);
- // Stage 2 - Widen __nar while adding thousands separators
- char_type __o[2*(__nbuf-1) - 1];
- char_type* __ob = __o;
- unique_ptr<char_type, void(*)(void*)> __obh(0, free);
- if (__nb != __nar)
- {
- __ob = (char_type*)malloc(2*static_cast<size_t>(__nc)*sizeof(char_type));
- if (__ob == 0)
- __throw_bad_alloc();
- __obh.reset(__ob);
- }
- char_type* __op; // pad here
- char_type* __oe; // end of output
- this->__widen_and_group_float(__nb, __np, __ne, __ob, __op, __oe, __iob.getloc());
- // [__o, __oe) contains thousands_sep'd wide number
- // Stage 3 & 4
- __s = std::__pad_and_output(__s, __ob, __op, __oe, __iob, __fl);
- return __s;
+ __nc = __libcpp_asprintf_l(&__nb, _LIBCPP_GET_C_LOCALE, __fmt, __v);
+ if (__nc == -1)
+ __throw_bad_alloc();
+ __nbh.reset(__nb);
+ }
+ _LIBCPP_DIAGNOSTIC_POP
+ char* __ne = __nb + __nc;
+ char* __np = this->__identify_padding(__nb, __ne, __iob);
+ // Stage 2 - Widen __nar while adding thousands separators
+ char_type __o[2 * (__nbuf - 1) - 1];
+ char_type* __ob = __o;
+ unique_ptr<char_type, void (*)(void*)> __obh(0, free);
+ if (__nb != __nar) {
+ __ob = (char_type*)malloc(2 * static_cast<size_t>(__nc) * sizeof(char_type));
+ if (__ob == 0)
+ __throw_bad_alloc();
+ __obh.reset(__ob);
+ }
+ char_type* __op; // pad here
+ char_type* __oe; // end of output
+ this->__widen_and_group_float(__nb, __np, __ne, __ob, __op, __oe, __iob.getloc());
+ // [__o, __oe) contains thousands_sep'd wide number
+ // Stage 3 & 4
+ __s = std::__pad_and_output(__s, __ob, __op, __oe, __iob, __fl);
+ return __s;
}
template <class _CharT, class _OutputIterator>
_OutputIterator
-num_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base& __iob,
- char_type __fl, double __v) const
-{
- return this->__do_put_floating_point(__s, __iob, __fl, __v, "");
+num_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base& __iob, char_type __fl, double __v) const {
+ return this->__do_put_floating_point(__s, __iob, __fl, __v, "");
}
template <class _CharT, class _OutputIterator>
_OutputIterator
-num_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base& __iob,
- char_type __fl, long double __v) const
-{
- return this->__do_put_floating_point(__s, __iob, __fl, __v, "L");
+num_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base& __iob, char_type __fl, long double __v) const {
+ return this->__do_put_floating_point(__s, __iob, __fl, __v, "L");
}
template <class _CharT, class _OutputIterator>
_OutputIterator
-num_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base& __iob,
- char_type __fl, const void* __v) const
-{
- // Stage 1 - Get pointer in narrow char
- const unsigned __nbuf = 20;
- char __nar[__nbuf];
- int __nc = __libcpp_snprintf_l(__nar, sizeof(__nar), _LIBCPP_GET_C_LOCALE, "%p", __v);
- char* __ne = __nar + __nc;
- char* __np = this->__identify_padding(__nar, __ne, __iob);
- // Stage 2 - Widen __nar
- char_type __o[2*(__nbuf-1) - 1];
- char_type* __op; // pad here
- char_type* __oe; // end of output
- const ctype<char_type>& __ct = std::use_facet<ctype<char_type> >(__iob.getloc());
- __ct.widen(__nar, __ne, __o);
- __oe = __o + (__ne - __nar);
- if (__np == __ne)
- __op = __oe;
- else
- __op = __o + (__np - __nar);
- // [__o, __oe) contains wide number
- // Stage 3 & 4
- return std::__pad_and_output(__s, __o, __op, __oe, __iob, __fl);
+num_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base& __iob, char_type __fl, const void* __v) const {
+ // Stage 1 - Get pointer in narrow char
+ const unsigned __nbuf = 20;
+ char __nar[__nbuf];
+ int __nc = __libcpp_snprintf_l(__nar, sizeof(__nar), _LIBCPP_GET_C_LOCALE, "%p", __v);
+ char* __ne = __nar + __nc;
+ char* __np = this->__identify_padding(__nar, __ne, __iob);
+ // Stage 2 - Widen __nar
+ char_type __o[2 * (__nbuf - 1) - 1];
+ char_type* __op; // pad here
+ char_type* __oe; // end of output
+ const ctype<char_type>& __ct = std::use_facet<ctype<char_type> >(__iob.getloc());
+ __ct.widen(__nar, __ne, __o);
+ __oe = __o + (__ne - __nar);
+ if (__np == __ne)
+ __op = __oe;
+ else
+ __op = __o + (__np - __nar);
+ // [__o, __oe) contains wide number
+ // Stage 3 & 4
+ return std::__pad_and_output(__s, __o, __op, __oe, __iob, __fl);
}
extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS num_put<char>;
@@ -1644,687 +1439,534 @@ extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS num_put<wchar_t>;
#endif
template <class _CharT, class _InputIterator>
-_LIBCPP_HIDE_FROM_ABI
-int
-__get_up_to_n_digits(_InputIterator& __b, _InputIterator __e,
- ios_base::iostate& __err, const ctype<_CharT>& __ct, int __n)
-{
- // Precondition: __n >= 1
- if (__b == __e)
- {
- __err |= ios_base::eofbit | ios_base::failbit;
- return 0;
- }
- // get first digit
- _CharT __c = *__b;
+_LIBCPP_HIDE_FROM_ABI int __get_up_to_n_digits(
+ _InputIterator& __b, _InputIterator __e, ios_base::iostate& __err, const ctype<_CharT>& __ct, int __n) {
+ // Precondition: __n >= 1
+ if (__b == __e) {
+ __err |= ios_base::eofbit | ios_base::failbit;
+ return 0;
+ }
+ // get first digit
+ _CharT __c = *__b;
+ if (!__ct.is(ctype_base::digit, __c)) {
+ __err |= ios_base::failbit;
+ return 0;
+ }
+ int __r = __ct.narrow(__c, 0) - '0';
+ for (++__b, (void)--__n; __b != __e && __n > 0; ++__b, (void)--__n) {
+ // get next digit
+ __c = *__b;
if (!__ct.is(ctype_base::digit, __c))
- {
- __err |= ios_base::failbit;
- return 0;
- }
- int __r = __ct.narrow(__c, 0) - '0';
- for (++__b, (void) --__n; __b != __e && __n > 0; ++__b, (void) --__n)
- {
- // get next digit
- __c = *__b;
- if (!__ct.is(ctype_base::digit, __c))
- return __r;
- __r = __r * 10 + __ct.narrow(__c, 0) - '0';
- }
- if (__b == __e)
- __err |= ios_base::eofbit;
- return __r;
+ return __r;
+ __r = __r * 10 + __ct.narrow(__c, 0) - '0';
+ }
+ if (__b == __e)
+ __err |= ios_base::eofbit;
+ return __r;
}
-class _LIBCPP_EXPORTED_FROM_ABI time_base
-{
+class _LIBCPP_EXPORTED_FROM_ABI time_base {
public:
- enum dateorder {no_order, dmy, mdy, ymd, ydm};
+ enum dateorder { no_order, dmy, mdy, ymd, ydm };
};
template <class _CharT>
-class _LIBCPP_TEMPLATE_VIS __time_get_c_storage
-{
+class _LIBCPP_TEMPLATE_VIS __time_get_c_storage {
protected:
- typedef basic_string<_CharT> string_type;
-
- virtual const string_type* __weeks() const;
- virtual const string_type* __months() const;
- virtual const string_type* __am_pm() const;
- virtual const string_type& __c() const;
- virtual const string_type& __r() const;
- virtual const string_type& __x() const;
- virtual const string_type& __X() const;
-
- _LIBCPP_HIDE_FROM_ABI
- ~__time_get_c_storage() {}
+ typedef basic_string<_CharT> string_type;
+
+ virtual const string_type* __weeks() const;
+ virtual const string_type* __months() const;
+ virtual const string_type* __am_pm() const;
+ virtual const string_type& __c() const;
+ virtual const string_type& __r() const;
+ virtual const string_type& __x() const;
+ virtual const string_type& __X() const;
+
+ _LIBCPP_HIDE_FROM_ABI ~__time_get_c_storage() {}
};
-template <> _LIBCPP_EXPORTED_FROM_ABI const string* __time_get_c_storage<char>::__weeks() const;
-template <> _LIBCPP_EXPORTED_FROM_ABI const string* __time_get_c_storage<char>::__months() const;
-template <> _LIBCPP_EXPORTED_FROM_ABI const string* __time_get_c_storage<char>::__am_pm() const;
-template <> _LIBCPP_EXPORTED_FROM_ABI const string& __time_get_c_storage<char>::__c() const;
-template <> _LIBCPP_EXPORTED_FROM_ABI const string& __time_get_c_storage<char>::__r() const;
-template <> _LIBCPP_EXPORTED_FROM_ABI const string& __time_get_c_storage<char>::__x() const;
-template <> _LIBCPP_EXPORTED_FROM_ABI const string& __time_get_c_storage<char>::__X() const;
+template <>
+_LIBCPP_EXPORTED_FROM_ABI const string* __time_get_c_storage<char>::__weeks() const;
+template <>
+_LIBCPP_EXPORTED_FROM_ABI const string* __time_get_c_storage<char>::__months() const;
+template <>
+_LIBCPP_EXPORTED_FROM_ABI const string* __time_get_c_storage<char>::__am_pm() const;
+template <>
+_LIBCPP_EXPORTED_FROM_ABI const string& __time_get_c_storage<char>::__c() const;
+template <>
+_LIBCPP_EXPORTED_FROM_ABI const string& __time_get_c_storage<char>::__r() const;
+template <>
+_LIBCPP_EXPORTED_FROM_ABI const string& __time_get_c_storage<char>::__x() const;
+template <>
+_LIBCPP_EXPORTED_FROM_ABI const string& __time_get_c_storage<char>::__X() const;
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
-template <> _LIBCPP_EXPORTED_FROM_ABI const wstring* __time_get_c_storage<wchar_t>::__weeks() const;
-template <> _LIBCPP_EXPORTED_FROM_ABI const wstring* __time_get_c_storage<wchar_t>::__months() const;
-template <> _LIBCPP_EXPORTED_FROM_ABI const wstring* __time_get_c_storage<wchar_t>::__am_pm() const;
-template <> _LIBCPP_EXPORTED_FROM_ABI const wstring& __time_get_c_storage<wchar_t>::__c() const;
-template <> _LIBCPP_EXPORTED_FROM_ABI const wstring& __time_get_c_storage<wchar_t>::__r() const;
-template <> _LIBCPP_EXPORTED_FROM_ABI const wstring& __time_get_c_storage<wchar_t>::__x() const;
-template <> _LIBCPP_EXPORTED_FROM_ABI const wstring& __time_get_c_storage<wchar_t>::__X() const;
+template <>
+_LIBCPP_EXPORTED_FROM_ABI const wstring* __time_get_c_storage<wchar_t>::__weeks() const;
+template <>
+_LIBCPP_EXPORTED_FROM_ABI const wstring* __time_get_c_storage<wchar_t>::__months() const;
+template <>
+_LIBCPP_EXPORTED_FROM_ABI const wstring* __time_get_c_storage<wchar_t>::__am_pm() const;
+template <>
+_LIBCPP_EXPORTED_FROM_ABI const wstring& __time_get_c_storage<wchar_t>::__c() const;
+template <>
+_LIBCPP_EXPORTED_FROM_ABI const wstring& __time_get_c_storage<wchar_t>::__r() const;
+template <>
+_LIBCPP_EXPORTED_FROM_ABI const wstring& __time_get_c_storage<wchar_t>::__x() const;
+template <>
+_LIBCPP_EXPORTED_FROM_ABI const wstring& __time_get_c_storage<wchar_t>::__X() const;
#endif
template <class _CharT, class _InputIterator = istreambuf_iterator<_CharT> >
-class _LIBCPP_TEMPLATE_VIS time_get
- : public locale::facet,
- public time_base,
- private __time_get_c_storage<_CharT>
-{
+class _LIBCPP_TEMPLATE_VIS time_get : public locale::facet, public time_base, private __time_get_c_storage<_CharT> {
public:
- typedef _CharT char_type;
- typedef _InputIterator iter_type;
- typedef time_base::dateorder dateorder;
- typedef basic_string<char_type> string_type;
-
- _LIBCPP_HIDE_FROM_ABI
- explicit time_get(size_t __refs = 0)
- : locale::facet(__refs) {}
-
- _LIBCPP_HIDE_FROM_ABI
- dateorder date_order() const
- {
- return this->do_date_order();
- }
-
- _LIBCPP_HIDE_FROM_ABI
- iter_type get_time(iter_type __b, iter_type __e, ios_base& __iob,
- ios_base::iostate& __err, tm* __tm) const
- {
- return do_get_time(__b, __e, __iob, __err, __tm);
- }
-
- _LIBCPP_HIDE_FROM_ABI
- iter_type get_date(iter_type __b, iter_type __e, ios_base& __iob,
- ios_base::iostate& __err, tm* __tm) const
- {
- return do_get_date(__b, __e, __iob, __err, __tm);
- }
-
- _LIBCPP_HIDE_FROM_ABI
- iter_type get_weekday(iter_type __b, iter_type __e, ios_base& __iob,
- ios_base::iostate& __err, tm* __tm) const
- {
- return do_get_weekday(__b, __e, __iob, __err, __tm);
- }
-
- _LIBCPP_HIDE_FROM_ABI
- iter_type get_monthname(iter_type __b, iter_type __e, ios_base& __iob,
- ios_base::iostate& __err, tm* __tm) const
- {
- return do_get_monthname(__b, __e, __iob, __err, __tm);
- }
-
- _LIBCPP_HIDE_FROM_ABI
- iter_type get_year(iter_type __b, iter_type __e, ios_base& __iob,
- ios_base::iostate& __err, tm* __tm) const
- {
- return do_get_year(__b, __e, __iob, __err, __tm);
- }
-
- _LIBCPP_HIDE_FROM_ABI
- iter_type get(iter_type __b, iter_type __e, ios_base& __iob,
- ios_base::iostate& __err, tm *__tm,
- char __fmt, char __mod = 0) const
- {
- return do_get(__b, __e, __iob, __err, __tm, __fmt, __mod);
- }
-
- iter_type get(iter_type __b, iter_type __e, ios_base& __iob,
- ios_base::iostate& __err, tm* __tm,
- const char_type* __fmtb, const char_type* __fmte) const;
-
- static locale::id id;
+ typedef _CharT char_type;
+ typedef _InputIterator iter_type;
+ typedef time_base::dateorder dateorder;
+ typedef basic_string<char_type> string_type;
+
+ _LIBCPP_HIDE_FROM_ABI explicit time_get(size_t __refs = 0) : locale::facet(__refs) {}
+
+ _LIBCPP_HIDE_FROM_ABI dateorder date_order() const { return this->do_date_order(); }
+
+ _LIBCPP_HIDE_FROM_ABI iter_type
+ get_time(iter_type __b, iter_type __e, ios_base& __iob, ios_base::iostate& __err, tm* __tm) const {
+ return do_get_time(__b, __e, __iob, __err, __tm);
+ }
+
+ _LIBCPP_HIDE_FROM_ABI iter_type
+ get_date(iter_type __b, iter_type __e, ios_base& __iob, ios_base::iostate& __err, tm* __tm) const {
+ return do_get_date(__b, __e, __iob, __err, __tm);
+ }
+
+ _LIBCPP_HIDE_FROM_ABI iter_type
+ get_weekday(iter_type __b, iter_type __e, ios_base& __iob, ios_base::iostate& __err, tm* __tm) const {
+ return do_get_weekday(__b, __e, __iob, __err, __tm);
+ }
+
+ _LIBCPP_HIDE_FROM_ABI iter_type
+ get_monthname(iter_type __b, iter_type __e, ios_base& __iob, ios_base::iostate& __err, tm* __tm) const {
+ return do_get_monthname(__b, __e, __iob, __err, __tm);
+ }
+
+ _LIBCPP_HIDE_FROM_ABI iter_type
+ get_year(iter_type __b, iter_type __e, ios_base& __iob, ios_base::iostate& __err, tm* __tm) const {
+ return do_get_year(__b, __e, __iob, __err, __tm);
+ }
+
+ _LIBCPP_HIDE_FROM_ABI iter_type
+ get(iter_type __b, iter_type __e, ios_base& __iob, ios_base::iostate& __err, tm* __tm, char __fmt, char __mod = 0)
+ const {
+ return do_get(__b, __e, __iob, __err, __tm, __fmt, __mod);
+ }
+
+ iter_type
+ get(iter_type __b,
+ iter_type __e,
+ ios_base& __iob,
+ ios_base::iostate& __err,
+ tm* __tm,
+ const char_type* __fmtb,
+ const char_type* __fmte) const;
+
+ static locale::id id;
protected:
- _LIBCPP_HIDE_FROM_ABI_VIRTUAL ~time_get() override {}
-
- virtual dateorder do_date_order() const;
- virtual iter_type do_get_time(iter_type __b, iter_type __e, ios_base& __iob,
- ios_base::iostate& __err, tm* __tm) const;
- virtual iter_type do_get_date(iter_type __b, iter_type __e, ios_base& __iob,
- ios_base::iostate& __err, tm* __tm) const;
- virtual iter_type do_get_weekday(iter_type __b, iter_type __e, ios_base& __iob,
- ios_base::iostate& __err, tm* __tm) const;
- virtual iter_type do_get_monthname(iter_type __b, iter_type __e, ios_base& __iob,
- ios_base::iostate& __err, tm* __tm) const;
- virtual iter_type do_get_year(iter_type __b, iter_type __e, ios_base& __iob,
- ios_base::iostate& __err, tm* __tm) const;
- virtual iter_type do_get(iter_type __b, iter_type __e, ios_base& __iob,
- ios_base::iostate& __err, tm* __tm,
- char __fmt, char __mod) const;
+ _LIBCPP_HIDE_FROM_ABI_VIRTUAL ~time_get() override {}
+
+ virtual dateorder do_date_order() const;
+ virtual iter_type
+ do_get_time(iter_type __b, iter_type __e, ios_base& __iob, ios_base::iostate& __err, tm* __tm) const;
+ virtual iter_type
+ do_get_date(iter_type __b, iter_type __e, ios_base& __iob, ios_base::iostate& __err, tm* __tm) const;
+ virtual iter_type
+ do_get_weekday(iter_type __b, iter_type __e, ios_base& __iob, ios_base::iostate& __err, tm* __tm) const;
+ virtual iter_type
+ do_get_monthname(iter_type __b, iter_type __e, ios_base& __iob, ios_base::iostate& __err, tm* __tm) const;
+ virtual iter_type
+ do_get_year(iter_type __b, iter_type __e, ios_base& __iob, ios_base::iostate& __err, tm* __tm) const;
+ virtual iter_type do_get(
+ iter_type __b, iter_type __e, ios_base& __iob, ios_base::iostate& __err, tm* __tm, char __fmt, char __mod) const;
+
private:
- void __get_white_space(iter_type& __b, iter_type __e,
- ios_base::iostate& __err, const ctype<char_type>& __ct) const;
- void __get_percent(iter_type& __b, iter_type __e, ios_base::iostate& __err,
- const ctype<char_type>& __ct) const;
-
- void __get_weekdayname(int& __m,
- iter_type& __b, iter_type __e,
- ios_base::iostate& __err,
- const ctype<char_type>& __ct) const;
- void __get_monthname(int& __m,
- iter_type& __b, iter_type __e,
- ios_base::iostate& __err,
- const ctype<char_type>& __ct) const;
- void __get_day(int& __d,
- iter_type& __b, iter_type __e,
- ios_base::iostate& __err,
- const ctype<char_type>& __ct) const;
- void __get_month(int& __m,
- iter_type& __b, iter_type __e,
- ios_base::iostate& __err,
- const ctype<char_type>& __ct) const;
- void __get_year(int& __y,
- iter_type& __b, iter_type __e,
- ios_base::iostate& __err,
- const ctype<char_type>& __ct) const;
- void __get_year4(int& __y,
- iter_type& __b, iter_type __e,
- ios_base::iostate& __err,
- const ctype<char_type>& __ct) const;
- void __get_hour(int& __d,
- iter_type& __b, iter_type __e,
- ios_base::iostate& __err,
- const ctype<char_type>& __ct) const;
- void __get_12_hour(int& __h,
- iter_type& __b, iter_type __e,
- ios_base::iostate& __err,
- const ctype<char_type>& __ct) const;
- void __get_am_pm(int& __h,
- iter_type& __b, iter_type __e,
- ios_base::iostate& __err,
- const ctype<char_type>& __ct) const;
- void __get_minute(int& __m,
- iter_type& __b, iter_type __e,
- ios_base::iostate& __err,
- const ctype<char_type>& __ct) const;
- void __get_second(int& __s,
- iter_type& __b, iter_type __e,
- ios_base::iostate& __err,
- const ctype<char_type>& __ct) const;
- void __get_weekday(int& __w,
- iter_type& __b, iter_type __e,
- ios_base::iostate& __err,
- const ctype<char_type>& __ct) const;
- void __get_day_year_num(int& __w,
- iter_type& __b, iter_type __e,
- ios_base::iostate& __err,
- const ctype<char_type>& __ct) const;
+ void __get_white_space(iter_type& __b, iter_type __e, ios_base::iostate& __err, const ctype<char_type>& __ct) const;
+ void __get_percent(iter_type& __b, iter_type __e, ios_base::iostate& __err, const ctype<char_type>& __ct) const;
+
+ void __get_weekdayname(
+ int& __m, iter_type& __b, iter_type __e, ios_base::iostate& __err, const ctype<char_type>& __ct) const;
+ void __get_monthname(
+ int& __m, iter_type& __b, iter_type __e, ios_base::iostate& __err, const ctype<char_type>& __ct) const;
+ void __get_day(int& __d, iter_type& __b, iter_type __e, ios_base::iostate& __err, const ctype<char_type>& __ct) const;
+ void
+ __get_month(int& __m, iter_type& __b, iter_type __e, ios_base::iostate& __err, const ctype<char_type>& __ct) const;
+ void
+ __get_year(int& __y, iter_type& __b, iter_type __e, ios_base::iostate& __err, const ctype<char_type>& __ct) const;
+ void
+ __get_year4(int& __y, iter_type& __b, iter_type __e, ios_base::iostate& __err, const ctype<char_type>& __ct) const;
+ void
+ __get_hour(int& __d, iter_type& __b, iter_type __e, ios_base::iostate& __err, const ctype<char_type>& __ct) const;
+ void
+ __get_12_hour(int& __h, iter_type& __b, iter_type __e, ios_base::iostate& __err, const ctype<char_type>& __ct) const;
+ void
+ __get_am_pm(int& __h, iter_type& __b, iter_type __e, ios_base::iostate& __err, const ctype<char_type>& __ct) const;
+ void
+ __get_minute(int& __m, iter_type& __b, iter_type __e, ios_base::iostate& __err, const ctype<char_type>& __ct) const;
+ void
+ __get_second(int& __s, iter_type& __b, iter_type __e, ios_base::iostate& __err, const ctype<char_type>& __ct) const;
+ void
+ __get_weekday(int& __w, iter_type& __b, iter_type __e, ios_base::iostate& __err, const ctype<char_type>& __ct) const;
+ void __get_day_year_num(
+ int& __w, iter_type& __b, iter_type __e, ios_base::iostate& __err, const ctype<char_type>& __ct) const;
};
template <class _CharT, class _InputIterator>
-locale::id
-time_get<_CharT, _InputIterator>::id;
+locale::id time_get<_CharT, _InputIterator>::id;
// time_get primitives
template <class _CharT, class _InputIterator>
-void
-time_get<_CharT, _InputIterator>::__get_weekdayname(int& __w,
- iter_type& __b, iter_type __e,
- ios_base::iostate& __err,
- const ctype<char_type>& __ct) const
-{
- // Note: ignoring case comes from the POSIX strptime spec
- const string_type* __wk = this->__weeks();
- ptrdiff_t __i = std::__scan_keyword(__b, __e, __wk, __wk+14, __ct, __err, false) - __wk;
- if (__i < 14)
- __w = __i % 7;
+void time_get<_CharT, _InputIterator>::__get_weekdayname(
+ int& __w, iter_type& __b, iter_type __e, ios_base::iostate& __err, const ctype<char_type>& __ct) const {
+ // Note: ignoring case comes from the POSIX strptime spec
+ const string_type* __wk = this->__weeks();
+ ptrdiff_t __i = std::__scan_keyword(__b, __e, __wk, __wk + 14, __ct, __err, false) - __wk;
+ if (__i < 14)
+ __w = __i % 7;
}
template <class _CharT, class _InputIterator>
-void
-time_get<_CharT, _InputIterator>::__get_monthname(int& __m,
- iter_type& __b, iter_type __e,
- ios_base::iostate& __err,
- const ctype<char_type>& __ct) const
-{
- // Note: ignoring case comes from the POSIX strptime spec
- const string_type* __month = this->__months();
- ptrdiff_t __i = std::__scan_keyword(__b, __e, __month, __month+24, __ct, __err, false) - __month;
- if (__i < 24)
- __m = __i % 12;
+void time_get<_CharT, _InputIterator>::__get_monthname(
+ int& __m, iter_type& __b, iter_type __e, ios_base::iostate& __err, const ctype<char_type>& __ct) const {
+ // Note: ignoring case comes from the POSIX strptime spec
+ const string_type* __month = this->__months();
+ ptrdiff_t __i = std::__scan_keyword(__b, __e, __month, __month + 24, __ct, __err, false) - __month;
+ if (__i < 24)
+ __m = __i % 12;
}
template <class _CharT, class _InputIterator>
-void
-time_get<_CharT, _InputIterator>::__get_day(int& __d,
- iter_type& __b, iter_type __e,
- ios_base::iostate& __err,
- const ctype<char_type>& __ct) const
-{
- int __t = std::__get_up_to_n_digits(__b, __e, __err, __ct, 2);
- if (!(__err & ios_base::failbit) && 1 <= __t && __t <= 31)
- __d = __t;
- else
- __err |= ios_base::failbit;
+void time_get<_CharT, _InputIterator>::__get_day(
+ int& __d, iter_type& __b, iter_type __e, ios_base::iostate& __err, const ctype<char_type>& __ct) const {
+ int __t = std::__get_up_to_n_digits(__b, __e, __err, __ct, 2);
+ if (!(__err & ios_base::failbit) && 1 <= __t && __t <= 31)
+ __d = __t;
+ else
+ __err |= ios_base::failbit;
}
template <class _CharT, class _InputIterator>
-void
-time_get<_CharT, _InputIterator>::__get_month(int& __m,
- iter_type& __b, iter_type __e,
- ios_base::iostate& __err,
- const ctype<char_type>& __ct) const
-{
- int __t = std::__get_up_to_n_digits(__b, __e, __err, __ct, 2) - 1;
- if (!(__err & ios_base::failbit) && 0 <= __t && __t <= 11)
- __m = __t;
- else
- __err |= ios_base::failbit;
+void time_get<_CharT, _InputIterator>::__get_month(
+ int& __m, iter_type& __b, iter_type __e, ios_base::iostate& __err, const ctype<char_type>& __ct) const {
+ int __t = std::__get_up_to_n_digits(__b, __e, __err, __ct, 2) - 1;
+ if (!(__err & ios_base::failbit) && 0 <= __t && __t <= 11)
+ __m = __t;
+ else
+ __err |= ios_base::failbit;
}
template <class _CharT, class _InputIterator>
-void
-time_get<_CharT, _InputIterator>::__get_year(int& __y,
- iter_type& __b, iter_type __e,
- ios_base::iostate& __err,
- const ctype<char_type>& __ct) const
-{
- int __t = std::__get_up_to_n_digits(__b, __e, __err, __ct, 4);
- if (!(__err & ios_base::failbit))
- {
- if (__t < 69)
- __t += 2000;
- else if (69 <= __t && __t <= 99)
- __t += 1900;
- __y = __t - 1900;
- }
+void time_get<_CharT, _InputIterator>::__get_year(
+ int& __y, iter_type& __b, iter_type __e, ios_base::iostate& __err, const ctype<char_type>& __ct) const {
+ int __t = std::__get_up_to_n_digits(__b, __e, __err, __ct, 4);
+ if (!(__err & ios_base::failbit)) {
+ if (__t < 69)
+ __t += 2000;
+ else if (69 <= __t && __t <= 99)
+ __t += 1900;
+ __y = __t - 1900;
+ }
}
template <class _CharT, class _InputIterator>
-void
-time_get<_CharT, _InputIterator>::__get_year4(int& __y,
- iter_type& __b, iter_type __e,
- ios_base::iostate& __err,
- const ctype<char_type>& __ct) const
-{
- int __t = std::__get_up_to_n_digits(__b, __e, __err, __ct, 4);
- if (!(__err & ios_base::failbit))
- __y = __t - 1900;
+void time_get<_CharT, _InputIterator>::__get_year4(
+ int& __y, iter_type& __b, iter_type __e, ios_base::iostate& __err, const ctype<char_type>& __ct) const {
+ int __t = std::__get_up_to_n_digits(__b, __e, __err, __ct, 4);
+ if (!(__err & ios_base::failbit))
+ __y = __t - 1900;
}
template <class _CharT, class _InputIterator>
-void
-time_get<_CharT, _InputIterator>::__get_hour(int& __h,
- iter_type& __b, iter_type __e,
- ios_base::iostate& __err,
- const ctype<char_type>& __ct) const
-{
- int __t = std::__get_up_to_n_digits(__b, __e, __err, __ct, 2);
- if (!(__err & ios_base::failbit) && __t <= 23)
- __h = __t;
- else
- __err |= ios_base::failbit;
+void time_get<_CharT, _InputIterator>::__get_hour(
+ int& __h, iter_type& __b, iter_type __e, ios_base::iostate& __err, const ctype<char_type>& __ct) const {
+ int __t = std::__get_up_to_n_digits(__b, __e, __err, __ct, 2);
+ if (!(__err & ios_base::failbit) && __t <= 23)
+ __h = __t;
+ else
+ __err |= ios_base::failbit;
}
template <class _CharT, class _InputIterator>
-void
-time_get<_CharT, _InputIterator>::__get_12_hour(int& __h,
- iter_type& __b, iter_type __e,
- ios_base::iostate& __err,
- const ctype<char_type>& __ct) const
-{
- int __t = std::__get_up_to_n_digits(__b, __e, __err, __ct, 2);
- if (!(__err & ios_base::failbit) && 1 <= __t && __t <= 12)
- __h = __t;
- else
- __err |= ios_base::failbit;
+void time_get<_CharT, _InputIterator>::__get_12_hour(
+ int& __h, iter_type& __b, iter_type __e, ios_base::iostate& __err, const ctype<char_type>& __ct) const {
+ int __t = std::__get_up_to_n_digits(__b, __e, __err, __ct, 2);
+ if (!(__err & ios_base::failbit) && 1 <= __t && __t <= 12)
+ __h = __t;
+ else
+ __err |= ios_base::failbit;
}
template <class _CharT, class _InputIterator>
-void
-time_get<_CharT, _InputIterator>::__get_minute(int& __m,
- iter_type& __b, iter_type __e,
- ios_base::iostate& __err,
- const ctype<char_type>& __ct) const
-{
- int __t = std::__get_up_to_n_digits(__b, __e, __err, __ct, 2);
- if (!(__err & ios_base::failbit) && __t <= 59)
- __m = __t;
- else
- __err |= ios_base::failbit;
+void time_get<_CharT, _InputIterator>::__get_minute(
+ int& __m, iter_type& __b, iter_type __e, ios_base::iostate& __err, const ctype<char_type>& __ct) const {
+ int __t = std::__get_up_to_n_digits(__b, __e, __err, __ct, 2);
+ if (!(__err & ios_base::failbit) && __t <= 59)
+ __m = __t;
+ else
+ __err |= ios_base::failbit;
}
template <class _CharT, class _InputIterator>
-void
-time_get<_CharT, _InputIterator>::__get_second(int& __s,
- iter_type& __b, iter_type __e,
- ios_base::iostate& __err,
- const ctype<char_type>& __ct) const
-{
- int __t = std::__get_up_to_n_digits(__b, __e, __err, __ct, 2);
- if (!(__err & ios_base::failbit) && __t <= 60)
- __s = __t;
- else
- __err |= ios_base::failbit;
+void time_get<_CharT, _InputIterator>::__get_second(
+ int& __s, iter_type& __b, iter_type __e, ios_base::iostate& __err, const ctype<char_type>& __ct) const {
+ int __t = std::__get_up_to_n_digits(__b, __e, __err, __ct, 2);
+ if (!(__err & ios_base::failbit) && __t <= 60)
+ __s = __t;
+ else
+ __err |= ios_base::failbit;
}
template <class _CharT, class _InputIterator>
-void
-time_get<_CharT, _InputIterator>::__get_weekday(int& __w,
- iter_type& __b, iter_type __e,
- ios_base::iostate& __err,
- const ctype<char_type>& __ct) const
-{
- int __t = std::__get_up_to_n_digits(__b, __e, __err, __ct, 1);
- if (!(__err & ios_base::failbit) && __t <= 6)
- __w = __t;
- else
- __err |= ios_base::failbit;
+void time_get<_CharT, _InputIterator>::__get_weekday(
+ int& __w, iter_type& __b, iter_type __e, ios_base::iostate& __err, const ctype<char_type>& __ct) const {
+ int __t = std::__get_up_to_n_digits(__b, __e, __err, __ct, 1);
+ if (!(__err & ios_base::failbit) && __t <= 6)
+ __w = __t;
+ else
+ __err |= ios_base::failbit;
}
template <class _CharT, class _InputIterator>
-void
-time_get<_CharT, _InputIterator>::__get_day_year_num(int& __d,
- iter_type& __b, iter_type __e,
- ios_base::iostate& __err,
- const ctype<char_type>& __ct) const
-{
- int __t = std::__get_up_to_n_digits(__b, __e, __err, __ct, 3);
- if (!(__err & ios_base::failbit) && __t <= 365)
- __d = __t;
- else
- __err |= ios_base::failbit;
+void time_get<_CharT, _InputIterator>::__get_day_year_num(
+ int& __d, iter_type& __b, iter_type __e, ios_base::iostate& __err, const ctype<char_type>& __ct) const {
+ int __t = std::__get_up_to_n_digits(__b, __e, __err, __ct, 3);
+ if (!(__err & ios_base::failbit) && __t <= 365)
+ __d = __t;
+ else
+ __err |= ios_base::failbit;
}
template <class _CharT, class _InputIterator>
-void
-time_get<_CharT, _InputIterator>::__get_white_space(iter_type& __b, iter_type __e,
- ios_base::iostate& __err,
- const ctype<char_type>& __ct) const
-{
- for (; __b != __e && __ct.is(ctype_base::space, *__b); ++__b)
- ;
- if (__b == __e)
- __err |= ios_base::eofbit;
+void time_get<_CharT, _InputIterator>::__get_white_space(
+ iter_type& __b, iter_type __e, ios_base::iostate& __err, const ctype<char_type>& __ct) const {
+ for (; __b != __e && __ct.is(ctype_base::space, *__b); ++__b)
+ ;
+ if (__b == __e)
+ __err |= ios_base::eofbit;
}
template <class _CharT, class _InputIterator>
-void
-time_get<_CharT, _InputIterator>::__get_am_pm(int& __h,
- iter_type& __b, iter_type __e,
- ios_base::iostate& __err,
- const ctype<char_type>& __ct) const
-{
- const string_type* __ap = this->__am_pm();
- if (__ap[0].size() + __ap[1].size() == 0)
- {
- __err |= ios_base::failbit;
- return;
- }
- ptrdiff_t __i = std::__scan_keyword(__b, __e, __ap, __ap+2, __ct, __err, false) - __ap;
- if (__i == 0 && __h == 12)
- __h = 0;
- else if (__i == 1 && __h < 12)
- __h += 12;
+void time_get<_CharT, _InputIterator>::__get_am_pm(
+ int& __h, iter_type& __b, iter_type __e, ios_base::iostate& __err, const ctype<char_type>& __ct) const {
+ const string_type* __ap = this->__am_pm();
+ if (__ap[0].size() + __ap[1].size() == 0) {
+ __err |= ios_base::failbit;
+ return;
+ }
+ ptrdiff_t __i = std::__scan_keyword(__b, __e, __ap, __ap + 2, __ct, __err, false) - __ap;
+ if (__i == 0 && __h == 12)
+ __h = 0;
+ else if (__i == 1 && __h < 12)
+ __h += 12;
}
template <class _CharT, class _InputIterator>
-void
-time_get<_CharT, _InputIterator>::__get_percent(iter_type& __b, iter_type __e,
- ios_base::iostate& __err,
- const ctype<char_type>& __ct) const
-{
- if (__b == __e)
- {
- __err |= ios_base::eofbit | ios_base::failbit;
- return;
- }
- if (__ct.narrow(*__b, 0) != '%')
- __err |= ios_base::failbit;
- else if(++__b == __e)
- __err |= ios_base::eofbit;
+void time_get<_CharT, _InputIterator>::__get_percent(
+ iter_type& __b, iter_type __e, ios_base::iostate& __err, const ctype<char_type>& __ct) const {
+ if (__b == __e) {
+ __err |= ios_base::eofbit | ios_base::failbit;
+ return;
+ }
+ if (__ct.narrow(*__b, 0) != '%')
+ __err |= ios_base::failbit;
+ else if (++__b == __e)
+ __err |= ios_base::eofbit;
}
// time_get end primitives
template <class _CharT, class _InputIterator>
-_InputIterator
-time_get<_CharT, _InputIterator>::get(iter_type __b, iter_type __e,
- ios_base& __iob,
- ios_base::iostate& __err, tm* __tm,
- const char_type* __fmtb, const char_type* __fmte) const
-{
- const ctype<char_type>& __ct = std::use_facet<ctype<char_type> >(__iob.getloc());
- __err = ios_base::goodbit;
- while (__fmtb != __fmte && __err == ios_base::goodbit)
- {
- if (__b == __e)
- {
- __err = ios_base::failbit;
- break;
- }
- if (__ct.narrow(*__fmtb, 0) == '%')
- {
- if (++__fmtb == __fmte)
- {
- __err = ios_base::failbit;
- break;
- }
- char __cmd = __ct.narrow(*__fmtb, 0);
- char __opt = '\0';
- if (__cmd == 'E' || __cmd == '0')
- {
- if (++__fmtb == __fmte)
- {
- __err = ios_base::failbit;
- break;
- }
- __opt = __cmd;
- __cmd = __ct.narrow(*__fmtb, 0);
- }
- __b = do_get(__b, __e, __iob, __err, __tm, __cmd, __opt);
- ++__fmtb;
- }
- else if (__ct.is(ctype_base::space, *__fmtb))
- {
- for (++__fmtb; __fmtb != __fmte && __ct.is(ctype_base::space, *__fmtb); ++__fmtb)
- ;
- for ( ; __b != __e && __ct.is(ctype_base::space, *__b); ++__b)
- ;
- }
- else if (__ct.toupper(*__b) == __ct.toupper(*__fmtb))
- {
- ++__b;
- ++__fmtb;
- }
- else
- __err = ios_base::failbit;
+_InputIterator time_get<_CharT, _InputIterator>::get(
+ iter_type __b,
+ iter_type __e,
+ ios_base& __iob,
+ ios_base::iostate& __err,
+ tm* __tm,
+ const char_type* __fmtb,
+ const char_type* __fmte) const {
+ const ctype<char_type>& __ct = std::use_facet<ctype<char_type> >(__iob.getloc());
+ __err = ios_base::goodbit;
+ while (__fmtb != __fmte && __err == ios_base::goodbit) {
+ if (__b == __e) {
+ __err = ios_base::failbit;
+ break;
}
- if (__b == __e)
- __err |= ios_base::eofbit;
- return __b;
+ if (__ct.narrow(*__fmtb, 0) == '%') {
+ if (++__fmtb == __fmte) {
+ __err = ios_base::failbit;
+ break;
+ }
+ char __cmd = __ct.narrow(*__fmtb, 0);
+ char __opt = '\0';
+ if (__cmd == 'E' || __cmd == '0') {
+ if (++__fmtb == __fmte) {
+ __err = ios_base::failbit;
+ break;
+ }
+ __opt = __cmd;
+ __cmd = __ct.narrow(*__fmtb, 0);
+ }
+ __b = do_get(__b, __e, __iob, __err, __tm, __cmd, __opt);
+ ++__fmtb;
+ } else if (__ct.is(ctype_base::space, *__fmtb)) {
+ for (++__fmtb; __fmtb != __fmte && __ct.is(ctype_base::space, *__fmtb); ++__fmtb)
+ ;
+ for (; __b != __e && __ct.is(ctype_base::space, *__b); ++__b)
+ ;
+ } else if (__ct.toupper(*__b) == __ct.toupper(*__fmtb)) {
+ ++__b;
+ ++__fmtb;
+ } else
+ __err = ios_base::failbit;
+ }
+ if (__b == __e)
+ __err |= ios_base::eofbit;
+ return __b;
}
template <class _CharT, class _InputIterator>
-typename time_get<_CharT, _InputIterator>::dateorder
-time_get<_CharT, _InputIterator>::do_date_order() const
-{
- return mdy;
+typename time_get<_CharT, _InputIterator>::dateorder time_get<_CharT, _InputIterator>::do_date_order() const {
+ return mdy;
}
template <class _CharT, class _InputIterator>
-_InputIterator
-time_get<_CharT, _InputIterator>::do_get_time(iter_type __b, iter_type __e,
- ios_base& __iob,
- ios_base::iostate& __err,
- tm* __tm) const
-{
- const char_type __fmt[] = {'%', 'H', ':', '%', 'M', ':', '%', 'S'};
- return get(__b, __e, __iob, __err, __tm, __fmt, __fmt + sizeof(__fmt)/sizeof(__fmt[0]));
+_InputIterator time_get<_CharT, _InputIterator>::do_get_time(
+ iter_type __b, iter_type __e, ios_base& __iob, ios_base::iostate& __err, tm* __tm) const {
+ const char_type __fmt[] = {'%', 'H', ':', '%', 'M', ':', '%', 'S'};
+ return get(__b, __e, __iob, __err, __tm, __fmt, __fmt + sizeof(__fmt) / sizeof(__fmt[0]));
}
template <class _CharT, class _InputIterator>
-_InputIterator
-time_get<_CharT, _InputIterator>::do_get_date(iter_type __b, iter_type __e,
- ios_base& __iob,
- ios_base::iostate& __err,
- tm* __tm) const
-{
- const string_type& __fmt = this->__x();
- return get(__b, __e, __iob, __err, __tm, __fmt.data(), __fmt.data() + __fmt.size());
+_InputIterator time_get<_CharT, _InputIterator>::do_get_date(
+ iter_type __b, iter_type __e, ios_base& __iob, ios_base::iostate& __err, tm* __tm) const {
+ const string_type& __fmt = this->__x();
+ return get(__b, __e, __iob, __err, __tm, __fmt.data(), __fmt.data() + __fmt.size());
}
template <class _CharT, class _InputIterator>
-_InputIterator
-time_get<_CharT, _InputIterator>::do_get_weekday(iter_type __b, iter_type __e,
- ios_base& __iob,
- ios_base::iostate& __err,
- tm* __tm) const
-{
- const ctype<char_type>& __ct = std::use_facet<ctype<char_type> >(__iob.getloc());
- __get_weekdayname(__tm->tm_wday, __b, __e, __err, __ct);
- return __b;
+_InputIterator time_get<_CharT, _InputIterator>::do_get_weekday(
+ iter_type __b, iter_type __e, ios_base& __iob, ios_base::iostate& __err, tm* __tm) const {
+ const ctype<char_type>& __ct = std::use_facet<ctype<char_type> >(__iob.getloc());
+ __get_weekdayname(__tm->tm_wday, __b, __e, __err, __ct);
+ return __b;
}
template <class _CharT, class _InputIterator>
-_InputIterator
-time_get<_CharT, _InputIterator>::do_get_monthname(iter_type __b, iter_type __e,
- ios_base& __iob,
- ios_base::iostate& __err,
- tm* __tm) const
-{
- const ctype<char_type>& __ct = std::use_facet<ctype<char_type> >(__iob.getloc());
- __get_monthname(__tm->tm_mon, __b, __e, __err, __ct);
- return __b;
+_InputIterator time_get<_CharT, _InputIterator>::do_get_monthname(
+ iter_type __b, iter_type __e, ios_base& __iob, ios_base::iostate& __err, tm* __tm) const {
+ const ctype<char_type>& __ct = std::use_facet<ctype<char_type> >(__iob.getloc());
+ __get_monthname(__tm->tm_mon, __b, __e, __err, __ct);
+ return __b;
}
template <class _CharT, class _InputIterator>
-_InputIterator
-time_get<_CharT, _InputIterator>::do_get_year(iter_type __b, iter_type __e,
- ios_base& __iob,
- ios_base::iostate& __err,
- tm* __tm) const
-{
- const ctype<char_type>& __ct = std::use_facet<ctype<char_type> >(__iob.getloc());
- __get_year(__tm->tm_year, __b, __e, __err, __ct);
- return __b;
+_InputIterator time_get<_CharT, _InputIterator>::do_get_year(
+ iter_type __b, iter_type __e, ios_base& __iob, ios_base::iostate& __err, tm* __tm) const {
+ const ctype<char_type>& __ct = std::use_facet<ctype<char_type> >(__iob.getloc());
+ __get_year(__tm->tm_year, __b, __e, __err, __ct);
+ return __b;
}
template <class _CharT, class _InputIterator>
-_InputIterator
-time_get<_CharT, _InputIterator>::do_get(iter_type __b, iter_type __e,
- ios_base& __iob,
- ios_base::iostate& __err, tm* __tm,
- char __fmt, char) const
-{
- __err = ios_base::goodbit;
- const ctype<char_type>& __ct = std::use_facet<ctype<char_type> >(__iob.getloc());
- switch (__fmt)
- {
- case 'a':
- case 'A':
- __get_weekdayname(__tm->tm_wday, __b, __e, __err, __ct);
- break;
- case 'b':
- case 'B':
- case 'h':
- __get_monthname(__tm->tm_mon, __b, __e, __err, __ct);
- break;
- case 'c':
- {
- const string_type& __fm = this->__c();
- __b = get(__b, __e, __iob, __err, __tm, __fm.data(), __fm.data() + __fm.size());
- }
- break;
- case 'd':
- case 'e':
- __get_day(__tm->tm_mday, __b, __e, __err, __ct);
- break;
- case 'D':
- {
- const char_type __fm[] = {'%', 'm', '/', '%', 'd', '/', '%', 'y'};
- __b = get(__b, __e, __iob, __err, __tm, __fm, __fm + sizeof(__fm)/sizeof(__fm[0]));
- }
- break;
- case 'F':
- {
- const char_type __fm[] = {'%', 'Y', '-', '%', 'm', '-', '%', 'd'};
- __b = get(__b, __e, __iob, __err, __tm, __fm, __fm + sizeof(__fm)/sizeof(__fm[0]));
- }
- break;
- case 'H':
- __get_hour(__tm->tm_hour, __b, __e, __err, __ct);
- break;
- case 'I':
- __get_12_hour(__tm->tm_hour, __b, __e, __err, __ct);
- break;
- case 'j':
- __get_day_year_num(__tm->tm_yday, __b, __e, __err, __ct);
- break;
- case 'm':
- __get_month(__tm->tm_mon, __b, __e, __err, __ct);
- break;
- case 'M':
- __get_minute(__tm->tm_min, __b, __e, __err, __ct);
- break;
- case 'n':
- case 't':
- __get_white_space(__b, __e, __err, __ct);
- break;
- case 'p':
- __get_am_pm(__tm->tm_hour, __b, __e, __err, __ct);
- break;
- case 'r':
- {
- const char_type __fm[] = {'%', 'I', ':', '%', 'M', ':', '%', 'S', ' ', '%', 'p'};
- __b = get(__b, __e, __iob, __err, __tm, __fm, __fm + sizeof(__fm)/sizeof(__fm[0]));
- }
- break;
- case 'R':
- {
- const char_type __fm[] = {'%', 'H', ':', '%', 'M'};
- __b = get(__b, __e, __iob, __err, __tm, __fm, __fm + sizeof(__fm)/sizeof(__fm[0]));
- }
- break;
- case 'S':
- __get_second(__tm->tm_sec, __b, __e, __err, __ct);
- break;
- case 'T':
- {
- const char_type __fm[] = {'%', 'H', ':', '%', 'M', ':', '%', 'S'};
- __b = get(__b, __e, __iob, __err, __tm, __fm, __fm + sizeof(__fm)/sizeof(__fm[0]));
- }
- break;
- case 'w':
- __get_weekday(__tm->tm_wday, __b, __e, __err, __ct);
- break;
- case 'x':
- return do_get_date(__b, __e, __iob, __err, __tm);
- case 'X':
- {
- const string_type& __fm = this->__X();
- __b = get(__b, __e, __iob, __err, __tm, __fm.data(), __fm.data() + __fm.size());
- }
- break;
- case 'y':
- __get_year(__tm->tm_year, __b, __e, __err, __ct);
- break;
- case 'Y':
- __get_year4(__tm->tm_year, __b, __e, __err, __ct);
- break;
- case '%':
- __get_percent(__b, __e, __err, __ct);
- break;
- default:
- __err |= ios_base::failbit;
- }
- return __b;
+_InputIterator time_get<_CharT, _InputIterator>::do_get(
+ iter_type __b, iter_type __e, ios_base& __iob, ios_base::iostate& __err, tm* __tm, char __fmt, char) const {
+ __err = ios_base::goodbit;
+ const ctype<char_type>& __ct = std::use_facet<ctype<char_type> >(__iob.getloc());
+ switch (__fmt) {
+ case 'a':
+ case 'A':
+ __get_weekdayname(__tm->tm_wday, __b, __e, __err, __ct);
+ break;
+ case 'b':
+ case 'B':
+ case 'h':
+ __get_monthname(__tm->tm_mon, __b, __e, __err, __ct);
+ break;
+ case 'c': {
+ const string_type& __fm = this->__c();
+ __b = get(__b, __e, __iob, __err, __tm, __fm.data(), __fm.data() + __fm.size());
+ } break;
+ case 'd':
+ case 'e':
+ __get_day(__tm->tm_mday, __b, __e, __err, __ct);
+ break;
+ case 'D': {
+ const char_type __fm[] = {'%', 'm', '/', '%', 'd', '/', '%', 'y'};
+ __b = get(__b, __e, __iob, __err, __tm, __fm, __fm + sizeof(__fm) / sizeof(__fm[0]));
+ } break;
+ case 'F': {
+ const char_type __fm[] = {'%', 'Y', '-', '%', 'm', '-', '%', 'd'};
+ __b = get(__b, __e, __iob, __err, __tm, __fm, __fm + sizeof(__fm) / sizeof(__fm[0]));
+ } break;
+ case 'H':
+ __get_hour(__tm->tm_hour, __b, __e, __err, __ct);
+ break;
+ case 'I':
+ __get_12_hour(__tm->tm_hour, __b, __e, __err, __ct);
+ break;
+ case 'j':
+ __get_day_year_num(__tm->tm_yday, __b, __e, __err, __ct);
+ break;
+ case 'm':
+ __get_month(__tm->tm_mon, __b, __e, __err, __ct);
+ break;
+ case 'M':
+ __get_minute(__tm->tm_min, __b, __e, __err, __ct);
+ break;
+ case 'n':
+ case 't':
+ __get_white_space(__b, __e, __err, __ct);
+ break;
+ case 'p':
+ __get_am_pm(__tm->tm_hour, __b, __e, __err, __ct);
+ break;
+ case 'r': {
+ const char_type __fm[] = {'%', 'I', ':', '%', 'M', ':', '%', 'S', ' ', '%', 'p'};
+ __b = get(__b, __e, __iob, __err, __tm, __fm, __fm + sizeof(__fm) / sizeof(__fm[0]));
+ } break;
+ case 'R': {
+ const char_type __fm[] = {'%', 'H', ':', '%', 'M'};
+ __b = get(__b, __e, __iob, __err, __tm, __fm, __fm + sizeof(__fm) / sizeof(__fm[0]));
+ } break;
+ case 'S':
+ __get_second(__tm->tm_sec, __b, __e, __err, __ct);
+ break;
+ case 'T': {
+ const char_type __fm[] = {'%', 'H', ':', '%', 'M', ':', '%', 'S'};
+ __b = get(__b, __e, __iob, __err, __tm, __fm, __fm + sizeof(__fm) / sizeof(__fm[0]));
+ } break;
+ case 'w':
+ __get_weekday(__tm->tm_wday, __b, __e, __err, __ct);
+ break;
+ case 'x':
+ return do_get_date(__b, __e, __iob, __err, __tm);
+ case 'X': {
+ const string_type& __fm = this->__X();
+ __b = get(__b, __e, __iob, __err, __tm, __fm.data(), __fm.data() + __fm.size());
+ } break;
+ case 'y':
+ __get_year(__tm->tm_year, __b, __e, __err, __ct);
+ break;
+ case 'Y':
+ __get_year4(__tm->tm_year, __b, __e, __err, __ct);
+ break;
+ case '%':
+ __get_percent(__b, __e, __err, __ct);
+ break;
+ default:
+ __err |= ios_base::failbit;
+ }
+ return __b;
}
extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS time_get<char>;
@@ -2332,55 +1974,59 @@ extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS time_get<char>;
extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS time_get<wchar_t>;
#endif
-class _LIBCPP_EXPORTED_FROM_ABI __time_get
-{
+class _LIBCPP_EXPORTED_FROM_ABI __time_get {
protected:
- locale_t __loc_;
+ locale_t __loc_;
- __time_get(const char* __nm);
- __time_get(const string& __nm);
- ~__time_get();
+ __time_get(const char* __nm);
+ __time_get(const string& __nm);
+ ~__time_get();
};
template <class _CharT>
-class _LIBCPP_TEMPLATE_VIS __time_get_storage
- : public __time_get
-{
+class _LIBCPP_TEMPLATE_VIS __time_get_storage : public __time_get {
protected:
- typedef basic_string<_CharT> string_type;
+ typedef basic_string<_CharT> string_type;
- string_type __weeks_[14];
- string_type __months_[24];
- string_type __am_pm_[2];
- string_type __c_;
- string_type __r_;
- string_type __x_;
- string_type __X_;
+ string_type __weeks_[14];
+ string_type __months_[24];
+ string_type __am_pm_[2];
+ string_type __c_;
+ string_type __r_;
+ string_type __x_;
+ string_type __X_;
- explicit __time_get_storage(const char* __nm);
- explicit __time_get_storage(const string& __nm);
+ explicit __time_get_storage(const char* __nm);
+ explicit __time_get_storage(const string& __nm);
- _LIBCPP_HIDE_FROM_ABI ~__time_get_storage() {}
+ _LIBCPP_HIDE_FROM_ABI ~__time_get_storage() {}
- time_base::dateorder __do_date_order() const;
+ time_base::dateorder __do_date_order() const;
private:
- void init(const ctype<_CharT>&);
- string_type __analyze(char __fmt, const ctype<_CharT>&);
+ void init(const ctype<_CharT>&);
+ string_type __analyze(char __fmt, const ctype<_CharT>&);
};
-#define _LIBCPP_TIME_GET_STORAGE_EXPLICIT_INSTANTIATION(_CharT) \
-template <> _LIBCPP_EXPORTED_FROM_ABI time_base::dateorder __time_get_storage<_CharT>::__do_date_order() const; \
-template <> _LIBCPP_EXPORTED_FROM_ABI __time_get_storage<_CharT>::__time_get_storage(const char*); \
-template <> _LIBCPP_EXPORTED_FROM_ABI __time_get_storage<_CharT>::__time_get_storage(const string&); \
-template <> _LIBCPP_EXPORTED_FROM_ABI void __time_get_storage<_CharT>::init(const ctype<_CharT>&); \
-template <> _LIBCPP_EXPORTED_FROM_ABI __time_get_storage<_CharT>::string_type __time_get_storage<_CharT>::__analyze(char, const ctype<_CharT>&); \
-extern template _LIBCPP_EXPORTED_FROM_ABI time_base::dateorder __time_get_storage<_CharT>::__do_date_order() const; \
-extern template _LIBCPP_EXPORTED_FROM_ABI __time_get_storage<_CharT>::__time_get_storage(const char*); \
-extern template _LIBCPP_EXPORTED_FROM_ABI __time_get_storage<_CharT>::__time_get_storage(const string&); \
-extern template _LIBCPP_EXPORTED_FROM_ABI void __time_get_storage<_CharT>::init(const ctype<_CharT>&); \
-extern template _LIBCPP_EXPORTED_FROM_ABI __time_get_storage<_CharT>::string_type __time_get_storage<_CharT>::__analyze(char, const ctype<_CharT>&); \
-/**/
+#define _LIBCPP_TIME_GET_STORAGE_EXPLICIT_INSTANTIATION(_CharT) \
+ template <> \
+ _LIBCPP_EXPORTED_FROM_ABI time_base::dateorder __time_get_storage<_CharT>::__do_date_order() const; \
+ template <> \
+ _LIBCPP_EXPORTED_FROM_ABI __time_get_storage<_CharT>::__time_get_storage(const char*); \
+ template <> \
+ _LIBCPP_EXPORTED_FROM_ABI __time_get_storage<_CharT>::__time_get_storage(const string&); \
+ template <> \
+ _LIBCPP_EXPORTED_FROM_ABI void __time_get_storage<_CharT>::init(const ctype<_CharT>&); \
+ template <> \
+ _LIBCPP_EXPORTED_FROM_ABI __time_get_storage<_CharT>::string_type __time_get_storage<_CharT>::__analyze( \
+ char, const ctype<_CharT>&); \
+ extern template _LIBCPP_EXPORTED_FROM_ABI time_base::dateorder __time_get_storage<_CharT>::__do_date_order() const; \
+ extern template _LIBCPP_EXPORTED_FROM_ABI __time_get_storage<_CharT>::__time_get_storage(const char*); \
+ extern template _LIBCPP_EXPORTED_FROM_ABI __time_get_storage<_CharT>::__time_get_storage(const string&); \
+ extern template _LIBCPP_EXPORTED_FROM_ABI void __time_get_storage<_CharT>::init(const ctype<_CharT>&); \
+ extern template _LIBCPP_EXPORTED_FROM_ABI __time_get_storage<_CharT>::string_type \
+ __time_get_storage<_CharT>::__analyze(char, const ctype<_CharT>&); \
+ /**/
_LIBCPP_TIME_GET_STORAGE_EXPLICIT_INSTANTIATION(char)
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
@@ -2391,35 +2037,31 @@ _LIBCPP_TIME_GET_STORAGE_EXPLICIT_INSTANTIATION(wchar_t)
template <class _CharT, class _InputIterator = istreambuf_iterator<_CharT> >
class _LIBCPP_TEMPLATE_VIS time_get_byname
: public time_get<_CharT, _InputIterator>,
- private __time_get_storage<_CharT>
-{
+ private __time_get_storage<_CharT> {
public:
- typedef time_base::dateorder dateorder;
- typedef _InputIterator iter_type;
- typedef _CharT char_type;
- typedef basic_string<char_type> string_type;
-
- _LIBCPP_HIDE_FROM_ABI
- explicit time_get_byname(const char* __nm, size_t __refs = 0)
- : time_get<_CharT, _InputIterator>(__refs),
- __time_get_storage<_CharT>(__nm) {}
- _LIBCPP_HIDE_FROM_ABI
- explicit time_get_byname(const string& __nm, size_t __refs = 0)
- : time_get<_CharT, _InputIterator>(__refs),
- __time_get_storage<_CharT>(__nm) {}
+ typedef time_base::dateorder dateorder;
+ typedef _InputIterator iter_type;
+ typedef _CharT char_type;
+ typedef basic_string<char_type> string_type;
+
+ _LIBCPP_HIDE_FROM_ABI explicit time_get_byname(const char* __nm, size_t __refs = 0)
+ : time_get<_CharT, _InputIterator>(__refs), __time_get_storage<_CharT>(__nm) {}
+ _LIBCPP_HIDE_FROM_ABI explicit time_get_byname(const string& __nm, size_t __refs = 0)
+ : time_get<_CharT, _InputIterator>(__refs), __time_get_storage<_CharT>(__nm) {}
protected:
- _LIBCPP_HIDE_FROM_ABI_VIRTUAL ~time_get_byname() override {}
+ _LIBCPP_HIDE_FROM_ABI_VIRTUAL ~time_get_byname() override {}
+
+ _LIBCPP_HIDE_FROM_ABI_VIRTUAL dateorder do_date_order() const override { return this->__do_date_order(); }
- _LIBCPP_HIDE_FROM_ABI_VIRTUAL dateorder do_date_order() const override {return this->__do_date_order();}
private:
- _LIBCPP_HIDE_FROM_ABI_VIRTUAL const string_type* __weeks() const override {return this->__weeks_;}
- _LIBCPP_HIDE_FROM_ABI_VIRTUAL const string_type* __months() const override {return this->__months_;}
- _LIBCPP_HIDE_FROM_ABI_VIRTUAL const string_type* __am_pm() const override {return this->__am_pm_;}
- _LIBCPP_HIDE_FROM_ABI_VIRTUAL const string_type& __c() const override {return this->__c_;}
- _LIBCPP_HIDE_FROM_ABI_VIRTUAL const string_type& __r() const override {return this->__r_;}
- _LIBCPP_HIDE_FROM_ABI_VIRTUAL const string_type& __x() const override {return this->__x_;}
- _LIBCPP_HIDE_FROM_ABI_VIRTUAL const string_type& __X() const override {return this->__X_;}
+ _LIBCPP_HIDE_FROM_ABI_VIRTUAL const string_type* __weeks() const override { return this->__weeks_; }
+ _LIBCPP_HIDE_FROM_ABI_VIRTUAL const string_type* __months() const override { return this->__months_; }
+ _LIBCPP_HIDE_FROM_ABI_VIRTUAL const string_type* __am_pm() const override { return this->__am_pm_; }
+ _LIBCPP_HIDE_FROM_ABI_VIRTUAL const string_type& __c() const override { return this->__c_; }
+ _LIBCPP_HIDE_FROM_ABI_VIRTUAL const string_type& __r() const override { return this->__r_; }
+ _LIBCPP_HIDE_FROM_ABI_VIRTUAL const string_type& __x() const override { return this->__x_; }
+ _LIBCPP_HIDE_FROM_ABI_VIRTUAL const string_type& __X() const override { return this->__X_; }
};
extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS time_get_byname<char>;
@@ -2427,115 +2069,88 @@ extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS time_get_byname<char>;
extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS time_get_byname<wchar_t>;
#endif
-class _LIBCPP_EXPORTED_FROM_ABI __time_put
-{
- locale_t __loc_;
+class _LIBCPP_EXPORTED_FROM_ABI __time_put {
+ locale_t __loc_;
+
protected:
- _LIBCPP_HIDE_FROM_ABI __time_put() : __loc_(_LIBCPP_GET_C_LOCALE) {}
- __time_put(const char* __nm);
- __time_put(const string& __nm);
- ~__time_put();
- void __do_put(char* __nb, char*& __ne, const tm* __tm,
- char __fmt, char __mod) const;
+ _LIBCPP_HIDE_FROM_ABI __time_put() : __loc_(_LIBCPP_GET_C_LOCALE) {}
+ __time_put(const char* __nm);
+ __time_put(const string& __nm);
+ ~__time_put();
+ void __do_put(char* __nb, char*& __ne, const tm* __tm, char __fmt, char __mod) const;
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
- void __do_put(wchar_t* __wb, wchar_t*& __we, const tm* __tm,
- char __fmt, char __mod) const;
+ void __do_put(wchar_t* __wb, wchar_t*& __we, const tm* __tm, char __fmt, char __mod) const;
#endif
};
template <class _CharT, class _OutputIterator = ostreambuf_iterator<_CharT> >
-class _LIBCPP_TEMPLATE_VIS time_put
- : public locale::facet,
- private __time_put
-{
+class _LIBCPP_TEMPLATE_VIS time_put : public locale::facet, private __time_put {
public:
- typedef _CharT char_type;
- typedef _OutputIterator iter_type;
+ typedef _CharT char_type;
+ typedef _OutputIterator iter_type;
- _LIBCPP_HIDE_FROM_ABI
- explicit time_put(size_t __refs = 0)
- : locale::facet(__refs) {}
+ _LIBCPP_HIDE_FROM_ABI explicit time_put(size_t __refs = 0) : locale::facet(__refs) {}
- iter_type put(iter_type __s, ios_base& __iob, char_type __fl, const tm* __tm,
- const char_type* __pb, const char_type* __pe) const;
+ iter_type
+ put(iter_type __s, ios_base& __iob, char_type __fl, const tm* __tm, const char_type* __pb, const char_type* __pe)
+ const;
- _LIBCPP_HIDE_FROM_ABI
- iter_type put(iter_type __s, ios_base& __iob, char_type __fl,
- const tm* __tm, char __fmt, char __mod = 0) const
- {
- return do_put(__s, __iob, __fl, __tm, __fmt, __mod);
- }
+ _LIBCPP_HIDE_FROM_ABI iter_type
+ put(iter_type __s, ios_base& __iob, char_type __fl, const tm* __tm, char __fmt, char __mod = 0) const {
+ return do_put(__s, __iob, __fl, __tm, __fmt, __mod);
+ }
- static locale::id id;
+ static locale::id id;
protected:
- _LIBCPP_HIDE_FROM_ABI_VIRTUAL ~time_put() override {}
- virtual iter_type do_put(iter_type __s, ios_base&, char_type, const tm* __tm,
- char __fmt, char __mod) const;
-
- _LIBCPP_HIDE_FROM_ABI
- explicit time_put(const char* __nm, size_t __refs)
- : locale::facet(__refs),
- __time_put(__nm) {}
- _LIBCPP_HIDE_FROM_ABI
- explicit time_put(const string& __nm, size_t __refs)
- : locale::facet(__refs),
- __time_put(__nm) {}
+ _LIBCPP_HIDE_FROM_ABI_VIRTUAL ~time_put() override {}
+ virtual iter_type do_put(iter_type __s, ios_base&, char_type, const tm* __tm, char __fmt, char __mod) const;
+
+ _LIBCPP_HIDE_FROM_ABI explicit time_put(const char* __nm, size_t __refs) : locale::facet(__refs), __time_put(__nm) {}
+ _LIBCPP_HIDE_FROM_ABI explicit time_put(const string& __nm, size_t __refs)
+ : locale::facet(__refs), __time_put(__nm) {}
};
template <class _CharT, class _OutputIterator>
-locale::id
-time_put<_CharT, _OutputIterator>::id;
+locale::id time_put<_CharT, _OutputIterator>::id;
template <class _CharT, class _OutputIterator>
-_OutputIterator
-time_put<_CharT, _OutputIterator>::put(iter_type __s, ios_base& __iob,
- char_type __fl, const tm* __tm,
- const char_type* __pb,
- const char_type* __pe) const
-{
- const ctype<char_type>& __ct = std::use_facet<ctype<char_type> >(__iob.getloc());
- for (; __pb != __pe; ++__pb)
- {
- if (__ct.narrow(*__pb, 0) == '%')
- {
- if (++__pb == __pe)
- {
- *__s++ = __pb[-1];
- break;
- }
- char __mod = 0;
- char __fmt = __ct.narrow(*__pb, 0);
- if (__fmt == 'E' || __fmt == 'O')
- {
- if (++__pb == __pe)
- {
- *__s++ = __pb[-2];
- *__s++ = __pb[-1];
- break;
- }
- __mod = __fmt;
- __fmt = __ct.narrow(*__pb, 0);
- }
- __s = do_put(__s, __iob, __fl, __tm, __fmt, __mod);
+_OutputIterator time_put<_CharT, _OutputIterator>::put(
+ iter_type __s, ios_base& __iob, char_type __fl, const tm* __tm, const char_type* __pb, const char_type* __pe)
+ const {
+ const ctype<char_type>& __ct = std::use_facet<ctype<char_type> >(__iob.getloc());
+ for (; __pb != __pe; ++__pb) {
+ if (__ct.narrow(*__pb, 0) == '%') {
+ if (++__pb == __pe) {
+ *__s++ = __pb[-1];
+ break;
+ }
+ char __mod = 0;
+ char __fmt = __ct.narrow(*__pb, 0);
+ if (__fmt == 'E' || __fmt == 'O') {
+ if (++__pb == __pe) {
+ *__s++ = __pb[-2];
+ *__s++ = __pb[-1];
+ break;
}
- else
- *__s++ = *__pb;
- }
- return __s;
+ __mod = __fmt;
+ __fmt = __ct.narrow(*__pb, 0);
+ }
+ __s = do_put(__s, __iob, __fl, __tm, __fmt, __mod);
+ } else
+ *__s++ = *__pb;
+ }
+ return __s;
}
template <class _CharT, class _OutputIterator>
-_OutputIterator
-time_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base&,
- char_type, const tm* __tm,
- char __fmt, char __mod) const
-{
- char_type __nar[100];
- char_type* __nb = __nar;
- char_type* __ne = __nb + 100;
- __do_put(__nb, __ne, __tm, __fmt, __mod);
- return std::copy(__nb, __ne, __s);
+_OutputIterator time_put<_CharT, _OutputIterator>::do_put(
+ iter_type __s, ios_base&, char_type, const tm* __tm, char __fmt, char __mod) const {
+ char_type __nar[100];
+ char_type* __nb = __nar;
+ char_type* __ne = __nb + 100;
+ __do_put(__nb, __ne, __tm, __fmt, __mod);
+ return std::copy(__nb, __ne, __s);
}
extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS time_put<char>;
@@ -2544,20 +2159,16 @@ extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS time_put<wchar_t>;
#endif
template <class _CharT, class _OutputIterator = ostreambuf_iterator<_CharT> >
-class _LIBCPP_TEMPLATE_VIS time_put_byname
- : public time_put<_CharT, _OutputIterator>
-{
+class _LIBCPP_TEMPLATE_VIS time_put_byname : public time_put<_CharT, _OutputIterator> {
public:
- _LIBCPP_HIDE_FROM_ABI
- explicit time_put_byname(const char* __nm, size_t __refs = 0)
- : time_put<_CharT, _OutputIterator>(__nm, __refs) {}
+ _LIBCPP_HIDE_FROM_ABI explicit time_put_byname(const char* __nm, size_t __refs = 0)
+ : time_put<_CharT, _OutputIterator>(__nm, __refs) {}
- _LIBCPP_HIDE_FROM_ABI
- explicit time_put_byname(const string& __nm, size_t __refs = 0)
- : time_put<_CharT, _OutputIterator>(__nm, __refs) {}
+ _LIBCPP_HIDE_FROM_ABI explicit time_put_byname(const string& __nm, size_t __refs = 0)
+ : time_put<_CharT, _OutputIterator>(__nm, __refs) {}
protected:
- _LIBCPP_HIDE_FROM_ABI_VIRTUAL ~time_put_byname() override {}
+ _LIBCPP_HIDE_FROM_ABI_VIRTUAL ~time_put_byname() override {}
};
extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS time_put_byname<char>;
@@ -2567,66 +2178,64 @@ extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS time_put_byname<wchar_t>;
// money_base
-class _LIBCPP_EXPORTED_FROM_ABI money_base
-{
+class _LIBCPP_EXPORTED_FROM_ABI money_base {
public:
- enum part {none, space, symbol, sign, value};
- struct pattern {char field[4];};
+ enum part { none, space, symbol, sign, value };
+ struct pattern {
+ char field[4];
+ };
- _LIBCPP_HIDE_FROM_ABI money_base() {}
+ _LIBCPP_HIDE_FROM_ABI money_base() {}
};
// moneypunct
template <class _CharT, bool _International = false>
-class _LIBCPP_TEMPLATE_VIS moneypunct
- : public locale::facet,
- public money_base
-{
+class _LIBCPP_TEMPLATE_VIS moneypunct : public locale::facet, public money_base {
public:
- typedef _CharT char_type;
- typedef basic_string<char_type> string_type;
-
- _LIBCPP_HIDE_FROM_ABI
- explicit moneypunct(size_t __refs = 0)
- : locale::facet(__refs) {}
-
- _LIBCPP_HIDE_FROM_ABI char_type decimal_point() const {return do_decimal_point();}
- _LIBCPP_HIDE_FROM_ABI char_type thousands_sep() const {return do_thousands_sep();}
- _LIBCPP_HIDE_FROM_ABI string grouping() const {return do_grouping();}
- _LIBCPP_HIDE_FROM_ABI string_type curr_symbol() const {return do_curr_symbol();}
- _LIBCPP_HIDE_FROM_ABI string_type positive_sign() const {return do_positive_sign();}
- _LIBCPP_HIDE_FROM_ABI string_type negative_sign() const {return do_negative_sign();}
- _LIBCPP_HIDE_FROM_ABI int frac_digits() const {return do_frac_digits();}
- _LIBCPP_HIDE_FROM_ABI pattern pos_format() const {return do_pos_format();}
- _LIBCPP_HIDE_FROM_ABI pattern neg_format() const {return do_neg_format();}
-
- static locale::id id;
- static const bool intl = _International;
+ typedef _CharT char_type;
+ typedef basic_string<char_type> string_type;
+
+ _LIBCPP_HIDE_FROM_ABI explicit moneypunct(size_t __refs = 0) : locale::facet(__refs) {}
+
+ _LIBCPP_HIDE_FROM_ABI char_type decimal_point() const { return do_decimal_point(); }
+ _LIBCPP_HIDE_FROM_ABI char_type thousands_sep() const { return do_thousands_sep(); }
+ _LIBCPP_HIDE_FROM_ABI string grouping() const { return do_grouping(); }
+ _LIBCPP_HIDE_FROM_ABI string_type curr_symbol() const { return do_curr_symbol(); }
+ _LIBCPP_HIDE_FROM_ABI string_type positive_sign() const { return do_positive_sign(); }
+ _LIBCPP_HIDE_FROM_ABI string_type negative_sign() const { return do_negative_sign(); }
+ _LIBCPP_HIDE_FROM_ABI int frac_digits() const { return do_frac_digits(); }
+ _LIBCPP_HIDE_FROM_ABI pattern pos_format() const { return do_pos_format(); }
+ _LIBCPP_HIDE_FROM_ABI pattern neg_format() const { return do_neg_format(); }
+
+ static locale::id id;
+ static const bool intl = _International;
protected:
- _LIBCPP_HIDE_FROM_ABI_VIRTUAL ~moneypunct() override {}
-
- virtual char_type do_decimal_point() const {return numeric_limits<char_type>::max();}
- virtual char_type do_thousands_sep() const {return numeric_limits<char_type>::max();}
- virtual string do_grouping() const {return string();}
- virtual string_type do_curr_symbol() const {return string_type();}
- virtual string_type do_positive_sign() const {return string_type();}
- virtual string_type do_negative_sign() const {return string_type(1, '-');}
- virtual int do_frac_digits() const {return 0;}
- virtual pattern do_pos_format() const
- {pattern __p = {{symbol, sign, none, value}}; return __p;}
- virtual pattern do_neg_format() const
- {pattern __p = {{symbol, sign, none, value}}; return __p;}
+ _LIBCPP_HIDE_FROM_ABI_VIRTUAL ~moneypunct() override {}
+
+ virtual char_type do_decimal_point() const { return numeric_limits<char_type>::max(); }
+ virtual char_type do_thousands_sep() const { return numeric_limits<char_type>::max(); }
+ virtual string do_grouping() const { return string(); }
+ virtual string_type do_curr_symbol() const { return string_type(); }
+ virtual string_type do_positive_sign() const { return string_type(); }
+ virtual string_type do_negative_sign() const { return string_type(1, '-'); }
+ virtual int do_frac_digits() const { return 0; }
+ virtual pattern do_pos_format() const {
+ pattern __p = {{symbol, sign, none, value}};
+ return __p;
+ }
+ virtual pattern do_neg_format() const {
+ pattern __p = {{symbol, sign, none, value}};
+ return __p;
+ }
};
template <class _CharT, bool _International>
-locale::id
-moneypunct<_CharT, _International>::id;
+locale::id moneypunct<_CharT, _International>::id;
template <class _CharT, bool _International>
-const bool
-moneypunct<_CharT, _International>::intl;
+const bool moneypunct<_CharT, _International>::intl;
extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS moneypunct<char, false>;
extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS moneypunct<char, true>;
@@ -2638,57 +2247,61 @@ extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS moneypunct<wchar_t, true>
// moneypunct_byname
template <class _CharT, bool _International = false>
-class _LIBCPP_TEMPLATE_VIS moneypunct_byname
- : public moneypunct<_CharT, _International>
-{
+class _LIBCPP_TEMPLATE_VIS moneypunct_byname : public moneypunct<_CharT, _International> {
public:
- typedef money_base::pattern pattern;
- typedef _CharT char_type;
- typedef basic_string<char_type> string_type;
+ typedef money_base::pattern pattern;
+ typedef _CharT char_type;
+ typedef basic_string<char_type> string_type;
- _LIBCPP_HIDE_FROM_ABI
- explicit moneypunct_byname(const char* __nm, size_t __refs = 0)
- : moneypunct<_CharT, _International>(__refs) {init(__nm);}
+ _LIBCPP_HIDE_FROM_ABI explicit moneypunct_byname(const char* __nm, size_t __refs = 0)
+ : moneypunct<_CharT, _International>(__refs) {
+ init(__nm);
+ }
- _LIBCPP_HIDE_FROM_ABI
- explicit moneypunct_byname(const string& __nm, size_t __refs = 0)
- : moneypunct<_CharT, _International>(__refs) {init(__nm.c_str());}
+ _LIBCPP_HIDE_FROM_ABI explicit moneypunct_byname(const string& __nm, size_t __refs = 0)
+ : moneypunct<_CharT, _International>(__refs) {
+ init(__nm.c_str());
+ }
protected:
- _LIBCPP_HIDE_FROM_ABI_VIRTUAL ~moneypunct_byname() override {}
-
- char_type do_decimal_point() const override {return __decimal_point_;}
- char_type do_thousands_sep() const override {return __thousands_sep_;}
- string do_grouping() const override {return __grouping_;}
- string_type do_curr_symbol() const override {return __curr_symbol_;}
- string_type do_positive_sign() const override {return __positive_sign_;}
- string_type do_negative_sign() const override {return __negative_sign_;}
- int do_frac_digits() const override {return __frac_digits_;}
- pattern do_pos_format() const override {return __pos_format_;}
- pattern do_neg_format() const override {return __neg_format_;}
+ _LIBCPP_HIDE_FROM_ABI_VIRTUAL ~moneypunct_byname() override {}
+
+ char_type do_decimal_point() const override { return __decimal_point_; }
+ char_type do_thousands_sep() const override { return __thousands_sep_; }
+ string do_grouping() const override { return __grouping_; }
+ string_type do_curr_symbol() const override { return __curr_symbol_; }
+ string_type do_positive_sign() const override { return __positive_sign_; }
+ string_type do_negative_sign() const override { return __negative_sign_; }
+ int do_frac_digits() const override { return __frac_digits_; }
+ pattern do_pos_format() const override { return __pos_format_; }
+ pattern do_neg_format() const override { return __neg_format_; }
private:
- char_type __decimal_point_;
- char_type __thousands_sep_;
- string __grouping_;
- string_type __curr_symbol_;
- string_type __positive_sign_;
- string_type __negative_sign_;
- int __frac_digits_;
- pattern __pos_format_;
- pattern __neg_format_;
-
- void init(const char*);
+ char_type __decimal_point_;
+ char_type __thousands_sep_;
+ string __grouping_;
+ string_type __curr_symbol_;
+ string_type __positive_sign_;
+ string_type __negative_sign_;
+ int __frac_digits_;
+ pattern __pos_format_;
+ pattern __neg_format_;
+
+ void init(const char*);
};
-template<> _LIBCPP_EXPORTED_FROM_ABI void moneypunct_byname<char, false>::init(const char*);
-template<> _LIBCPP_EXPORTED_FROM_ABI void moneypunct_byname<char, true>::init(const char*);
+template <>
+_LIBCPP_EXPORTED_FROM_ABI void moneypunct_byname<char, false>::init(const char*);
+template <>
+_LIBCPP_EXPORTED_FROM_ABI void moneypunct_byname<char, true>::init(const char*);
extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS moneypunct_byname<char, false>;
extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS moneypunct_byname<char, true>;
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
-template<> _LIBCPP_EXPORTED_FROM_ABI void moneypunct_byname<wchar_t, false>::init(const char*);
-template<> _LIBCPP_EXPORTED_FROM_ABI void moneypunct_byname<wchar_t, true>::init(const char*);
+template <>
+_LIBCPP_EXPORTED_FROM_ABI void moneypunct_byname<wchar_t, false>::init(const char*);
+template <>
+_LIBCPP_EXPORTED_FROM_ABI void moneypunct_byname<wchar_t, true>::init(const char*);
extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS moneypunct_byname<wchar_t, false>;
extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS moneypunct_byname<wchar_t, true>;
#endif
@@ -2696,55 +2309,59 @@ extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS moneypunct_byname<wchar_t
// money_get
template <class _CharT>
-class __money_get
-{
+class __money_get {
protected:
- typedef _CharT char_type;
- typedef basic_string<char_type> string_type;
-
- _LIBCPP_HIDE_FROM_ABI __money_get() {}
-
- static void __gather_info(bool __intl, const locale& __loc,
- money_base::pattern& __pat, char_type& __dp,
- char_type& __ts, string& __grp,
- string_type& __sym, string_type& __psn,
- string_type& __nsn, int& __fd);
+ typedef _CharT char_type;
+ typedef basic_string<char_type> string_type;
+
+ _LIBCPP_HIDE_FROM_ABI __money_get() {}
+
+ static void __gather_info(
+ bool __intl,
+ const locale& __loc,
+ money_base::pattern& __pat,
+ char_type& __dp,
+ char_type& __ts,
+ string& __grp,
+ string_type& __sym,
+ string_type& __psn,
+ string_type& __nsn,
+ int& __fd);
};
template <class _CharT>
-void
-__money_get<_CharT>::__gather_info(bool __intl, const locale& __loc,
- money_base::pattern& __pat, char_type& __dp,
- char_type& __ts, string& __grp,
- string_type& __sym, string_type& __psn,
- string_type& __nsn, int& __fd)
-{
- if (__intl)
- {
- const moneypunct<char_type, true>& __mp =
- std::use_facet<moneypunct<char_type, true> >(__loc);
- __pat = __mp.neg_format();
- __nsn = __mp.negative_sign();
- __psn = __mp.positive_sign();
- __dp = __mp.decimal_point();
- __ts = __mp.thousands_sep();
- __grp = __mp.grouping();
- __sym = __mp.curr_symbol();
- __fd = __mp.frac_digits();
- }
- else
- {
- const moneypunct<char_type, false>& __mp =
- std::use_facet<moneypunct<char_type, false> >(__loc);
- __pat = __mp.neg_format();
- __nsn = __mp.negative_sign();
- __psn = __mp.positive_sign();
- __dp = __mp.decimal_point();
- __ts = __mp.thousands_sep();
- __grp = __mp.grouping();
- __sym = __mp.curr_symbol();
- __fd = __mp.frac_digits();
- }
+void __money_get<_CharT>::__gather_info(
+ bool __intl,
+ const locale& __loc,
+ money_base::pattern& __pat,
+ char_type& __dp,
+ char_type& __ts,
+ string& __grp,
+ string_type& __sym,
+ string_type& __psn,
+ string_type& __nsn,
+ int& __fd) {
+ if (__intl) {
+ const moneypunct<char_type, true>& __mp = std::use_facet<moneypunct<char_type, true> >(__loc);
+ __pat = __mp.neg_format();
+ __nsn = __mp.negative_sign();
+ __psn = __mp.positive_sign();
+ __dp = __mp.decimal_point();
+ __ts = __mp.thousands_sep();
+ __grp = __mp.grouping();
+ __sym = __mp.curr_symbol();
+ __fd = __mp.frac_digits();
+ } else {
+ const moneypunct<char_type, false>& __mp = std::use_facet<moneypunct<char_type, false> >(__loc);
+ __pat = __mp.neg_format();
+ __nsn = __mp.negative_sign();
+ __psn = __mp.positive_sign();
+ __dp = __mp.decimal_point();
+ __ts = __mp.thousands_sep();
+ __grp = __mp.grouping();
+ __sym = __mp.curr_symbol();
+ __fd = __mp.frac_digits();
+ }
}
extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS __money_get<char>;
@@ -2753,365 +2370,308 @@ extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS __money_get<wchar_t>;
#endif
template <class _CharT, class _InputIterator = istreambuf_iterator<_CharT> >
-class _LIBCPP_TEMPLATE_VIS money_get
- : public locale::facet,
- private __money_get<_CharT>
-{
+class _LIBCPP_TEMPLATE_VIS money_get : public locale::facet, private __money_get<_CharT> {
public:
- typedef _CharT char_type;
- typedef _InputIterator iter_type;
- typedef basic_string<char_type> string_type;
-
- _LIBCPP_HIDE_FROM_ABI
- explicit money_get(size_t __refs = 0)
- : locale::facet(__refs) {}
-
- _LIBCPP_HIDE_FROM_ABI
- iter_type get(iter_type __b, iter_type __e, bool __intl, ios_base& __iob,
- ios_base::iostate& __err, long double& __v) const
- {
- return do_get(__b, __e, __intl, __iob, __err, __v);
- }
+ typedef _CharT char_type;
+ typedef _InputIterator iter_type;
+ typedef basic_string<char_type> string_type;
- _LIBCPP_HIDE_FROM_ABI
- iter_type get(iter_type __b, iter_type __e, bool __intl, ios_base& __iob,
- ios_base::iostate& __err, string_type& __v) const
- {
- return do_get(__b, __e, __intl, __iob, __err, __v);
- }
+ _LIBCPP_HIDE_FROM_ABI explicit money_get(size_t __refs = 0) : locale::facet(__refs) {}
+
+ _LIBCPP_HIDE_FROM_ABI iter_type
+ get(iter_type __b, iter_type __e, bool __intl, ios_base& __iob, ios_base::iostate& __err, long double& __v) const {
+ return do_get(__b, __e, __intl, __iob, __err, __v);
+ }
+
+ _LIBCPP_HIDE_FROM_ABI iter_type
+ get(iter_type __b, iter_type __e, bool __intl, ios_base& __iob, ios_base::iostate& __err, string_type& __v) const {
+ return do_get(__b, __e, __intl, __iob, __err, __v);
+ }
- static locale::id id;
+ static locale::id id;
protected:
- _LIBCPP_HIDE_FROM_ABI_VIRTUAL ~money_get() override {}
+ _LIBCPP_HIDE_FROM_ABI_VIRTUAL ~money_get() override {}
- virtual iter_type do_get(iter_type __b, iter_type __e, bool __intl,
- ios_base& __iob, ios_base::iostate& __err,
- long double& __v) const;
- virtual iter_type do_get(iter_type __b, iter_type __e, bool __intl,
- ios_base& __iob, ios_base::iostate& __err,
- string_type& __v) const;
+ virtual iter_type
+ do_get(iter_type __b, iter_type __e, bool __intl, ios_base& __iob, ios_base::iostate& __err, long double& __v) const;
+ virtual iter_type
+ do_get(iter_type __b, iter_type __e, bool __intl, ios_base& __iob, ios_base::iostate& __err, string_type& __v) const;
private:
- static bool __do_get(iter_type& __b, iter_type __e,
- bool __intl, const locale& __loc,
- ios_base::fmtflags __flags, ios_base::iostate& __err,
- bool& __neg, const ctype<char_type>& __ct,
- unique_ptr<char_type, void(*)(void*)>& __wb,
- char_type*& __wn, char_type* __we);
+ static bool __do_get(
+ iter_type& __b,
+ iter_type __e,
+ bool __intl,
+ const locale& __loc,
+ ios_base::fmtflags __flags,
+ ios_base::iostate& __err,
+ bool& __neg,
+ const ctype<char_type>& __ct,
+ unique_ptr<char_type, void (*)(void*)>& __wb,
+ char_type*& __wn,
+ char_type* __we);
};
template <class _CharT, class _InputIterator>
-locale::id
-money_get<_CharT, _InputIterator>::id;
+locale::id money_get<_CharT, _InputIterator>::id;
_LIBCPP_EXPORTED_FROM_ABI void __do_nothing(void*);
template <class _Tp>
-_LIBCPP_HIDE_FROM_ABI
-void
-__double_or_nothing(unique_ptr<_Tp, void(*)(void*)>& __b, _Tp*& __n, _Tp*& __e)
-{
- bool __owns = __b.get_deleter() != __do_nothing;
- size_t __cur_cap = static_cast<size_t>(__e-__b.get()) * sizeof(_Tp);
- size_t __new_cap = __cur_cap < numeric_limits<size_t>::max() / 2 ?
- 2 * __cur_cap : numeric_limits<size_t>::max();
- if (__new_cap == 0)
- __new_cap = sizeof(_Tp);
- size_t __n_off = static_cast<size_t>(__n - __b.get());
- _Tp* __t = (_Tp*)std::realloc(__owns ? __b.get() : 0, __new_cap);
- if (__t == 0)
- __throw_bad_alloc();
- if (__owns)
- __b.release();
- __b = unique_ptr<_Tp, void(*)(void*)>(__t, free);
- __new_cap /= sizeof(_Tp);
- __n = __b.get() + __n_off;
- __e = __b.get() + __new_cap;
+_LIBCPP_HIDE_FROM_ABI void __double_or_nothing(unique_ptr<_Tp, void (*)(void*)>& __b, _Tp*& __n, _Tp*& __e) {
+ bool __owns = __b.get_deleter() != __do_nothing;
+ size_t __cur_cap = static_cast<size_t>(__e - __b.get()) * sizeof(_Tp);
+ size_t __new_cap = __cur_cap < numeric_limits<size_t>::max() / 2 ? 2 * __cur_cap : numeric_limits<size_t>::max();
+ if (__new_cap == 0)
+ __new_cap = sizeof(_Tp);
+ size_t __n_off = static_cast<size_t>(__n - __b.get());
+ _Tp* __t = (_Tp*)std::realloc(__owns ? __b.get() : 0, __new_cap);
+ if (__t == 0)
+ __throw_bad_alloc();
+ if (__owns)
+ __b.release();
+ __b = unique_ptr<_Tp, void (*)(void*)>(__t, free);
+ __new_cap /= sizeof(_Tp);
+ __n = __b.get() + __n_off;
+ __e = __b.get() + __new_cap;
}
// true == success
template <class _CharT, class _InputIterator>
-bool
-money_get<_CharT, _InputIterator>::__do_get(iter_type& __b, iter_type __e,
- bool __intl, const locale& __loc,
- ios_base::fmtflags __flags,
- ios_base::iostate& __err,
- bool& __neg,
- const ctype<char_type>& __ct,
- unique_ptr<char_type, void(*)(void*)>& __wb,
- char_type*& __wn, char_type* __we)
-{
- if (__b == __e) {
+bool money_get<_CharT, _InputIterator>::__do_get(
+ iter_type& __b,
+ iter_type __e,
+ bool __intl,
+ const locale& __loc,
+ ios_base::fmtflags __flags,
+ ios_base::iostate& __err,
+ bool& __neg,
+ const ctype<char_type>& __ct,
+ unique_ptr<char_type, void (*)(void*)>& __wb,
+ char_type*& __wn,
+ char_type* __we) {
+ if (__b == __e) {
+ __err |= ios_base::failbit;
+ return false;
+ }
+ const unsigned __bz = 100;
+ unsigned __gbuf[__bz];
+ unique_ptr<unsigned, void (*)(void*)> __gb(__gbuf, __do_nothing);
+ unsigned* __gn = __gb.get();
+ unsigned* __ge = __gn + __bz;
+ money_base::pattern __pat;
+ char_type __dp;
+ char_type __ts;
+ string __grp;
+ string_type __sym;
+ string_type __psn;
+ string_type __nsn;
+ // Capture the spaces read into money_base::{space,none} so they
+ // can be compared to initial spaces in __sym.
+ string_type __spaces;
+ int __fd;
+ __money_get<_CharT>::__gather_info(__intl, __loc, __pat, __dp, __ts, __grp, __sym, __psn, __nsn, __fd);
+ const string_type* __trailing_sign = 0;
+ __wn = __wb.get();
+ for (unsigned __p = 0; __p < 4 && __b != __e; ++__p) {
+ switch (__pat.field[__p]) {
+ case money_base::space:
+ if (__p != 3) {
+ if (__ct.is(ctype_base::space, *__b))
+ __spaces.push_back(*__b++);
+ else {
+ __err |= ios_base::failbit;
+ return false;
+ }
+ }
+ _LIBCPP_FALLTHROUGH();
+ case money_base::none:
+ if (__p != 3) {
+ while (__b != __e && __ct.is(ctype_base::space, *__b))
+ __spaces.push_back(*__b++);
+ }
+ break;
+ case money_base::sign:
+ if (__psn.size() > 0 && *__b == __psn[0]) {
+ ++__b;
+ __neg = false;
+ if (__psn.size() > 1)
+ __trailing_sign = &__psn;
+ break;
+ }
+ if (__nsn.size() > 0 && *__b == __nsn[0]) {
+ ++__b;
+ __neg = true;
+ if (__nsn.size() > 1)
+ __trailing_sign = &__nsn;
+ break;
+ }
+ if (__psn.size() > 0 && __nsn.size() > 0) { // sign is required
__err |= ios_base::failbit;
return false;
- }
- const unsigned __bz = 100;
- unsigned __gbuf[__bz];
- unique_ptr<unsigned, void(*)(void*)> __gb(__gbuf, __do_nothing);
- unsigned* __gn = __gb.get();
- unsigned* __ge = __gn + __bz;
- money_base::pattern __pat;
- char_type __dp;
- char_type __ts;
- string __grp;
- string_type __sym;
- string_type __psn;
- string_type __nsn;
- // Capture the spaces read into money_base::{space,none} so they
- // can be compared to initial spaces in __sym.
- string_type __spaces;
- int __fd;
- __money_get<_CharT>::__gather_info(__intl, __loc, __pat, __dp, __ts, __grp,
- __sym, __psn, __nsn, __fd);
- const string_type* __trailing_sign = 0;
- __wn = __wb.get();
- for (unsigned __p = 0; __p < 4 && __b != __e; ++__p)
- {
- switch (__pat.field[__p])
- {
- case money_base::space:
- if (__p != 3)
- {
- if (__ct.is(ctype_base::space, *__b))
- __spaces.push_back(*__b++);
- else
- {
- __err |= ios_base::failbit;
- return false;
- }
- }
- _LIBCPP_FALLTHROUGH();
- case money_base::none:
- if (__p != 3)
- {
- while (__b != __e && __ct.is(ctype_base::space, *__b))
- __spaces.push_back(*__b++);
- }
- break;
- case money_base::sign:
- if (__psn.size() > 0 && *__b == __psn[0])
- {
- ++__b;
- __neg = false;
- if (__psn.size() > 1)
- __trailing_sign = &__psn;
- break;
- }
- if (__nsn.size() > 0 && *__b == __nsn[0])
- {
- ++__b;
- __neg = true;
- if (__nsn.size() > 1)
- __trailing_sign = &__nsn;
- break;
- }
- if (__psn.size() > 0 && __nsn.size() > 0)
- { // sign is required
- __err |= ios_base::failbit;
- return false;
- }
- if (__psn.size() == 0 && __nsn.size() == 0)
- // locale has no way of specifying a sign. Use the initial value of __neg as a default
- break;
- __neg = (__nsn.size() == 0);
- break;
- case money_base::symbol:
- {
- bool __more_needed = __trailing_sign ||
- (__p < 2) ||
- (__p == 2 && __pat.field[3] != static_cast<char>(money_base::none));
- bool __sb = (__flags & ios_base::showbase) != 0;
- if (__sb || __more_needed)
- {
- typename string_type::const_iterator __sym_space_end = __sym.begin();
- if (__p > 0 && (__pat.field[__p - 1] == money_base::none ||
- __pat.field[__p - 1] == money_base::space)) {
- // Match spaces we've already read against spaces at
- // the beginning of __sym.
- while (__sym_space_end != __sym.end() &&
- __ct.is(ctype_base::space, *__sym_space_end))
- ++__sym_space_end;
- const size_t __num_spaces = __sym_space_end - __sym.begin();
- if (__num_spaces > __spaces.size() ||
- !std::equal(__spaces.end() - __num_spaces, __spaces.end(),
- __sym.begin())) {
- // No match. Put __sym_space_end back at the
- // beginning of __sym, which will prevent a
- // match in the next loop.
- __sym_space_end = __sym.begin();
- }
- }
- typename string_type::const_iterator __sym_curr_char = __sym_space_end;
- while (__sym_curr_char != __sym.end() && __b != __e &&
- *__b == *__sym_curr_char) {
- ++__b;
- ++__sym_curr_char;
- }
- if (__sb && __sym_curr_char != __sym.end())
- {
- __err |= ios_base::failbit;
- return false;
- }
- }
- }
- break;
- case money_base::value:
- {
- unsigned __ng = 0;
- for (; __b != __e; ++__b)
- {
- char_type __c = *__b;
- if (__ct.is(ctype_base::digit, __c))
- {
- if (__wn == __we)
- std::__double_or_nothing(__wb, __wn, __we);
- *__wn++ = __c;
- ++__ng;
- }
- else if (__grp.size() > 0 && __ng > 0 && __c == __ts)
- {
- if (__gn == __ge)
- std::__double_or_nothing(__gb, __gn, __ge);
- *__gn++ = __ng;
- __ng = 0;
- }
- else
- break;
- }
- if (__gb.get() != __gn && __ng > 0)
- {
- if (__gn == __ge)
- std::__double_or_nothing(__gb, __gn, __ge);
- *__gn++ = __ng;
- }
- if (__fd > 0)
- {
- if (__b == __e || *__b != __dp)
- {
- __err |= ios_base::failbit;
- return false;
- }
- for (++__b; __fd > 0; --__fd, ++__b)
- {
- if (__b == __e || !__ct.is(ctype_base::digit, *__b))
- {
- __err |= ios_base::failbit;
- return false;
- }
- if (__wn == __we)
- std::__double_or_nothing(__wb, __wn, __we);
- *__wn++ = *__b;
- }
- }
- if (__wn == __wb.get())
- {
- __err |= ios_base::failbit;
- return false;
- }
- }
- break;
+ }
+ if (__psn.size() == 0 && __nsn.size() == 0)
+ // locale has no way of specifying a sign. Use the initial value of __neg as a default
+ break;
+ __neg = (__nsn.size() == 0);
+ break;
+ case money_base::symbol: {
+ bool __more_needed =
+ __trailing_sign || (__p < 2) || (__p == 2 && __pat.field[3] != static_cast<char>(money_base::none));
+ bool __sb = (__flags & ios_base::showbase) != 0;
+ if (__sb || __more_needed) {
+ typename string_type::const_iterator __sym_space_end = __sym.begin();
+ if (__p > 0 && (__pat.field[__p - 1] == money_base::none || __pat.field[__p - 1] == money_base::space)) {
+ // Match spaces we've already read against spaces at
+ // the beginning of __sym.
+ while (__sym_space_end != __sym.end() && __ct.is(ctype_base::space, *__sym_space_end))
+ ++__sym_space_end;
+ const size_t __num_spaces = __sym_space_end - __sym.begin();
+ if (__num_spaces > __spaces.size() ||
+ !std::equal(__spaces.end() - __num_spaces, __spaces.end(), __sym.begin())) {
+ // No match. Put __sym_space_end back at the
+ // beginning of __sym, which will prevent a
+ // match in the next loop.
+ __sym_space_end = __sym.begin();
+ }
}
- }
- if (__trailing_sign)
- {
- for (unsigned __i = 1; __i < __trailing_sign->size(); ++__i, ++__b)
- {
- if (__b == __e || *__b != (*__trailing_sign)[__i])
- {
- __err |= ios_base::failbit;
- return false;
- }
+ typename string_type::const_iterator __sym_curr_char = __sym_space_end;
+ while (__sym_curr_char != __sym.end() && __b != __e && *__b == *__sym_curr_char) {
+ ++__b;
+ ++__sym_curr_char;
}
- }
- if (__gb.get() != __gn)
- {
- ios_base::iostate __et = ios_base::goodbit;
- __check_grouping(__grp, __gb.get(), __gn, __et);
- if (__et)
- {
+ if (__sb && __sym_curr_char != __sym.end()) {
+ __err |= ios_base::failbit;
+ return false;
+ }
+ }
+ } break;
+ case money_base::value: {
+ unsigned __ng = 0;
+ for (; __b != __e; ++__b) {
+ char_type __c = *__b;
+ if (__ct.is(ctype_base::digit, __c)) {
+ if (__wn == __we)
+ std::__double_or_nothing(__wb, __wn, __we);
+ *__wn++ = __c;
+ ++__ng;
+ } else if (__grp.size() > 0 && __ng > 0 && __c == __ts) {
+ if (__gn == __ge)
+ std::__double_or_nothing(__gb, __gn, __ge);
+ *__gn++ = __ng;
+ __ng = 0;
+ } else
+ break;
+ }
+ if (__gb.get() != __gn && __ng > 0) {
+ if (__gn == __ge)
+ std::__double_or_nothing(__gb, __gn, __ge);
+ *__gn++ = __ng;
+ }
+ if (__fd > 0) {
+ if (__b == __e || *__b != __dp) {
+ __err |= ios_base::failbit;
+ return false;
+ }
+ for (++__b; __fd > 0; --__fd, ++__b) {
+ if (__b == __e || !__ct.is(ctype_base::digit, *__b)) {
__err |= ios_base::failbit;
return false;
+ }
+ if (__wn == __we)
+ std::__double_or_nothing(__wb, __wn, __we);
+ *__wn++ = *__b;
}
+ }
+ if (__wn == __wb.get()) {
+ __err |= ios_base::failbit;
+ return false;
+ }
+ } break;
}
- return true;
+ }
+ if (__trailing_sign) {
+ for (unsigned __i = 1; __i < __trailing_sign->size(); ++__i, ++__b) {
+ if (__b == __e || *__b != (*__trailing_sign)[__i]) {
+ __err |= ios_base::failbit;
+ return false;
+ }
+ }
+ }
+ if (__gb.get() != __gn) {
+ ios_base::iostate __et = ios_base::goodbit;
+ __check_grouping(__grp, __gb.get(), __gn, __et);
+ if (__et) {
+ __err |= ios_base::failbit;
+ return false;
+ }
+ }
+ return true;
}
template <class _CharT, class _InputIterator>
-_InputIterator
-money_get<_CharT, _InputIterator>::do_get(iter_type __b, iter_type __e,
- bool __intl, ios_base& __iob,
- ios_base::iostate& __err,
- long double& __v) const
-{
- const int __bz = 100;
- char_type __wbuf[__bz];
- unique_ptr<char_type, void(*)(void*)> __wb(__wbuf, __do_nothing);
- char_type* __wn;
- char_type* __we = __wbuf + __bz;
- locale __loc = __iob.getloc();
- const ctype<char_type>& __ct = std::use_facet<ctype<char_type> >(__loc);
- bool __neg = false;
- if (__do_get(__b, __e, __intl, __loc, __iob.flags(), __err, __neg, __ct,
- __wb, __wn, __we))
- {
- const char __src[] = "0123456789";
- char_type __atoms[sizeof(__src)-1];
- __ct.widen(__src, __src + (sizeof(__src)-1), __atoms);
- char __nbuf[__bz];
- char* __nc = __nbuf;
- unique_ptr<char, void(*)(void*)> __h(nullptr, free);
- if (__wn - __wb.get() > __bz-2)
- {
- __h.reset((char*)malloc(static_cast<size_t>(__wn - __wb.get() + 2)));
- if (__h.get() == nullptr)
- __throw_bad_alloc();
- __nc = __h.get();
- }
- if (__neg)
- *__nc++ = '-';
- for (const char_type* __w = __wb.get(); __w < __wn; ++__w, ++__nc)
- *__nc = __src[std::find(__atoms, std::end(__atoms), *__w) - __atoms];
- *__nc = char();
- if (sscanf(__nbuf, "%Lf", &__v) != 1)
- __throw_runtime_error("money_get error");
+_InputIterator money_get<_CharT, _InputIterator>::do_get(
+ iter_type __b, iter_type __e, bool __intl, ios_base& __iob, ios_base::iostate& __err, long double& __v) const {
+ const int __bz = 100;
+ char_type __wbuf[__bz];
+ unique_ptr<char_type, void (*)(void*)> __wb(__wbuf, __do_nothing);
+ char_type* __wn;
+ char_type* __we = __wbuf + __bz;
+ locale __loc = __iob.getloc();
+ const ctype<char_type>& __ct = std::use_facet<ctype<char_type> >(__loc);
+ bool __neg = false;
+ if (__do_get(__b, __e, __intl, __loc, __iob.flags(), __err, __neg, __ct, __wb, __wn, __we)) {
+ const char __src[] = "0123456789";
+ char_type __atoms[sizeof(__src) - 1];
+ __ct.widen(__src, __src + (sizeof(__src) - 1), __atoms);
+ char __nbuf[__bz];
+ char* __nc = __nbuf;
+ unique_ptr<char, void (*)(void*)> __h(nullptr, free);
+ if (__wn - __wb.get() > __bz - 2) {
+ __h.reset((char*)malloc(static_cast<size_t>(__wn - __wb.get() + 2)));
+ if (__h.get() == nullptr)
+ __throw_bad_alloc();
+ __nc = __h.get();
}
- if (__b == __e)
- __err |= ios_base::eofbit;
- return __b;
+ if (__neg)
+ *__nc++ = '-';
+ for (const char_type* __w = __wb.get(); __w < __wn; ++__w, ++__nc)
+ *__nc = __src[std::find(__atoms, std::end(__atoms), *__w) - __atoms];
+ *__nc = char();
+ if (sscanf(__nbuf, "%Lf", &__v) != 1)
+ __throw_runtime_error("money_get error");
+ }
+ if (__b == __e)
+ __err |= ios_base::eofbit;
+ return __b;
}
template <class _CharT, class _InputIterator>
-_InputIterator
-money_get<_CharT, _InputIterator>::do_get(iter_type __b, iter_type __e,
- bool __intl, ios_base& __iob,
- ios_base::iostate& __err,
- string_type& __v) const
-{
- const int __bz = 100;
- char_type __wbuf[__bz];
- unique_ptr<char_type, void(*)(void*)> __wb(__wbuf, __do_nothing);
- char_type* __wn;
- char_type* __we = __wbuf + __bz;
- locale __loc = __iob.getloc();
- const ctype<char_type>& __ct = std::use_facet<ctype<char_type> >(__loc);
- bool __neg = false;
- if (__do_get(__b, __e, __intl, __loc, __iob.flags(), __err, __neg, __ct,
- __wb, __wn, __we))
- {
- __v.clear();
- if (__neg)
- __v.push_back(__ct.widen('-'));
- char_type __z = __ct.widen('0');
- char_type* __w;
- for (__w = __wb.get(); __w < __wn-1; ++__w)
- if (*__w != __z)
- break;
- __v.append(__w, __wn);
- }
- if (__b == __e)
- __err |= ios_base::eofbit;
- return __b;
+_InputIterator money_get<_CharT, _InputIterator>::do_get(
+ iter_type __b, iter_type __e, bool __intl, ios_base& __iob, ios_base::iostate& __err, string_type& __v) const {
+ const int __bz = 100;
+ char_type __wbuf[__bz];
+ unique_ptr<char_type, void (*)(void*)> __wb(__wbuf, __do_nothing);
+ char_type* __wn;
+ char_type* __we = __wbuf + __bz;
+ locale __loc = __iob.getloc();
+ const ctype<char_type>& __ct = std::use_facet<ctype<char_type> >(__loc);
+ bool __neg = false;
+ if (__do_get(__b, __e, __intl, __loc, __iob.flags(), __err, __neg, __ct, __wb, __wn, __we)) {
+ __v.clear();
+ if (__neg)
+ __v.push_back(__ct.widen('-'));
+ char_type __z = __ct.widen('0');
+ char_type* __w;
+ for (__w = __wb.get(); __w < __wn - 1; ++__w)
+ if (*__w != __z)
+ break;
+ __v.append(__w, __wn);
+ }
+ if (__b == __e)
+ __err |= ios_base::eofbit;
+ return __b;
}
extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS money_get<char>;
@@ -3122,173 +2682,174 @@ extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS money_get<wchar_t>;
// money_put
template <class _CharT>
-class __money_put
-{
+class __money_put {
protected:
- typedef _CharT char_type;
- typedef basic_string<char_type> string_type;
-
- _LIBCPP_HIDE_FROM_ABI __money_put() {}
-
- static void __gather_info(bool __intl, bool __neg, const locale& __loc,
- money_base::pattern& __pat, char_type& __dp,
- char_type& __ts, string& __grp,
- string_type& __sym, string_type& __sn,
- int& __fd);
- static void __format(char_type* __mb, char_type*& __mi, char_type*& __me,
- ios_base::fmtflags __flags,
- const char_type* __db, const char_type* __de,
- const ctype<char_type>& __ct, bool __neg,
- const money_base::pattern& __pat, char_type __dp,
- char_type __ts, const string& __grp,
- const string_type& __sym, const string_type& __sn,
- int __fd);
+ typedef _CharT char_type;
+ typedef basic_string<char_type> string_type;
+
+ _LIBCPP_HIDE_FROM_ABI __money_put() {}
+
+ static void __gather_info(
+ bool __intl,
+ bool __neg,
+ const locale& __loc,
+ money_base::pattern& __pat,
+ char_type& __dp,
+ char_type& __ts,
+ string& __grp,
+ string_type& __sym,
+ string_type& __sn,
+ int& __fd);
+ static void __format(
+ char_type* __mb,
+ char_type*& __mi,
+ char_type*& __me,
+ ios_base::fmtflags __flags,
+ const char_type* __db,
+ const char_type* __de,
+ const ctype<char_type>& __ct,
+ bool __neg,
+ const money_base::pattern& __pat,
+ char_type __dp,
+ char_type __ts,
+ const string& __grp,
+ const string_type& __sym,
+ const string_type& __sn,
+ int __fd);
};
template <class _CharT>
-void
-__money_put<_CharT>::__gather_info(bool __intl, bool __neg, const locale& __loc,
- money_base::pattern& __pat, char_type& __dp,
- char_type& __ts, string& __grp,
- string_type& __sym, string_type& __sn,
- int& __fd)
-{
- if (__intl)
- {
- const moneypunct<char_type, true>& __mp =
- std::use_facet<moneypunct<char_type, true> >(__loc);
- if (__neg)
- {
- __pat = __mp.neg_format();
- __sn = __mp.negative_sign();
- }
- else
- {
- __pat = __mp.pos_format();
- __sn = __mp.positive_sign();
- }
- __dp = __mp.decimal_point();
- __ts = __mp.thousands_sep();
- __grp = __mp.grouping();
- __sym = __mp.curr_symbol();
- __fd = __mp.frac_digits();
- }
- else
- {
- const moneypunct<char_type, false>& __mp =
- std::use_facet<moneypunct<char_type, false> >(__loc);
- if (__neg)
- {
- __pat = __mp.neg_format();
- __sn = __mp.negative_sign();
- }
- else
- {
- __pat = __mp.pos_format();
- __sn = __mp.positive_sign();
- }
- __dp = __mp.decimal_point();
- __ts = __mp.thousands_sep();
- __grp = __mp.grouping();
- __sym = __mp.curr_symbol();
- __fd = __mp.frac_digits();
- }
+void __money_put<_CharT>::__gather_info(
+ bool __intl,
+ bool __neg,
+ const locale& __loc,
+ money_base::pattern& __pat,
+ char_type& __dp,
+ char_type& __ts,
+ string& __grp,
+ string_type& __sym,
+ string_type& __sn,
+ int& __fd) {
+ if (__intl) {
+ const moneypunct<char_type, true>& __mp = std::use_facet<moneypunct<char_type, true> >(__loc);
+ if (__neg) {
+ __pat = __mp.neg_format();
+ __sn = __mp.negative_sign();
+ } else {
+ __pat = __mp.pos_format();
+ __sn = __mp.positive_sign();
+ }
+ __dp = __mp.decimal_point();
+ __ts = __mp.thousands_sep();
+ __grp = __mp.grouping();
+ __sym = __mp.curr_symbol();
+ __fd = __mp.frac_digits();
+ } else {
+ const moneypunct<char_type, false>& __mp = std::use_facet<moneypunct<char_type, false> >(__loc);
+ if (__neg) {
+ __pat = __mp.neg_format();
+ __sn = __mp.negative_sign();
+ } else {
+ __pat = __mp.pos_format();
+ __sn = __mp.positive_sign();
+ }
+ __dp = __mp.decimal_point();
+ __ts = __mp.thousands_sep();
+ __grp = __mp.grouping();
+ __sym = __mp.curr_symbol();
+ __fd = __mp.frac_digits();
+ }
}
template <class _CharT>
-void
-__money_put<_CharT>::__format(char_type* __mb, char_type*& __mi, char_type*& __me,
- ios_base::fmtflags __flags,
- const char_type* __db, const char_type* __de,
- const ctype<char_type>& __ct, bool __neg,
- const money_base::pattern& __pat, char_type __dp,
- char_type __ts, const string& __grp,
- const string_type& __sym, const string_type& __sn,
- int __fd)
-{
- __me = __mb;
- for (char __p : __pat.field)
- {
- switch (__p)
- {
- case money_base::none:
- __mi = __me;
- break;
- case money_base::space:
- __mi = __me;
- *__me++ = __ct.widen(' ');
- break;
- case money_base::sign:
- if (!__sn.empty())
- *__me++ = __sn[0];
- break;
- case money_base::symbol:
- if (!__sym.empty() && (__flags & ios_base::showbase))
- __me = std::copy(__sym.begin(), __sym.end(), __me);
- break;
- case money_base::value:
- {
- // remember start of value so we can reverse it
- char_type* __t = __me;
- // find beginning of digits
- if (__neg)
- ++__db;
- // find end of digits
- const char_type* __d;
- for (__d = __db; __d < __de; ++__d)
- if (!__ct.is(ctype_base::digit, *__d))
- break;
- // print fractional part
- if (__fd > 0)
- {
- int __f;
- for (__f = __fd; __d > __db && __f > 0; --__f)
- *__me++ = *--__d;
- char_type __z = __f > 0 ? __ct.widen('0') : char_type();
- for (; __f > 0; --__f)
- *__me++ = __z;
- *__me++ = __dp;
- }
- // print units part
- if (__d == __db)
- {
- *__me++ = __ct.widen('0');
- }
- else
- {
- unsigned __ng = 0;
- unsigned __ig = 0;
- unsigned __gl = __grp.empty() ? numeric_limits<unsigned>::max()
- : static_cast<unsigned>(__grp[__ig]);
- while (__d != __db)
- {
- if (__ng == __gl)
- {
- *__me++ = __ts;
- __ng = 0;
- if (++__ig < __grp.size())
- __gl = __grp[__ig] == numeric_limits<char>::max() ?
- numeric_limits<unsigned>::max() :
- static_cast<unsigned>(__grp[__ig]);
- }
- *__me++ = *--__d;
- ++__ng;
- }
- }
- // reverse it
- std::reverse(__t, __me);
- }
- break;
+void __money_put<_CharT>::__format(
+ char_type* __mb,
+ char_type*& __mi,
+ char_type*& __me,
+ ios_base::fmtflags __flags,
+ const char_type* __db,
+ const char_type* __de,
+ const ctype<char_type>& __ct,
+ bool __neg,
+ const money_base::pattern& __pat,
+ char_type __dp,
+ char_type __ts,
+ const string& __grp,
+ const string_type& __sym,
+ const string_type& __sn,
+ int __fd) {
+ __me = __mb;
+ for (char __p : __pat.field) {
+ switch (__p) {
+ case money_base::none:
+ __mi = __me;
+ break;
+ case money_base::space:
+ __mi = __me;
+ *__me++ = __ct.widen(' ');
+ break;
+ case money_base::sign:
+ if (!__sn.empty())
+ *__me++ = __sn[0];
+ break;
+ case money_base::symbol:
+ if (!__sym.empty() && (__flags & ios_base::showbase))
+ __me = std::copy(__sym.begin(), __sym.end(), __me);
+ break;
+ case money_base::value: {
+ // remember start of value so we can reverse it
+ char_type* __t = __me;
+ // find beginning of digits
+ if (__neg)
+ ++__db;
+ // find end of digits
+ const char_type* __d;
+ for (__d = __db; __d < __de; ++__d)
+ if (!__ct.is(ctype_base::digit, *__d))
+ break;
+ // print fractional part
+ if (__fd > 0) {
+ int __f;
+ for (__f = __fd; __d > __db && __f > 0; --__f)
+ *__me++ = *--__d;
+ char_type __z = __f > 0 ? __ct.widen('0') : char_type();
+ for (; __f > 0; --__f)
+ *__me++ = __z;
+ *__me++ = __dp;
+ }
+ // print units part
+ if (__d == __db) {
+ *__me++ = __ct.widen('0');
+ } else {
+ unsigned __ng = 0;
+ unsigned __ig = 0;
+ unsigned __gl = __grp.empty() ? numeric_limits<unsigned>::max() : static_cast<unsigned>(__grp[__ig]);
+ while (__d != __db) {
+ if (__ng == __gl) {
+ *__me++ = __ts;
+ __ng = 0;
+ if (++__ig < __grp.size())
+ __gl = __grp[__ig] == numeric_limits<char>::max()
+ ? numeric_limits<unsigned>::max()
+ : static_cast<unsigned>(__grp[__ig]);
+ }
+ *__me++ = *--__d;
+ ++__ng;
}
- }
- // print rest of sign, if any
- if (__sn.size() > 1)
- __me = std::copy(__sn.begin()+1, __sn.end(), __me);
- // set alignment
- if ((__flags & ios_base::adjustfield) == ios_base::left)
- __mi = __me;
- else if ((__flags & ios_base::adjustfield) != ios_base::internal)
- __mi = __mb;
+ }
+ // reverse it
+ std::reverse(__t, __me);
+ } break;
+ }
+ }
+ // print rest of sign, if any
+ if (__sn.size() > 1)
+ __me = std::copy(__sn.begin() + 1, __sn.end(), __me);
+ // set alignment
+ if ((__flags & ios_base::adjustfield) == ios_base::left)
+ __mi = __me;
+ else if ((__flags & ios_base::adjustfield) != ios_base::internal)
+ __mi = __mb;
}
extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS __money_put<char>;
@@ -3297,152 +2858,144 @@ extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS __money_put<wchar_t>;
#endif
template <class _CharT, class _OutputIterator = ostreambuf_iterator<_CharT> >
-class _LIBCPP_TEMPLATE_VIS money_put
- : public locale::facet,
- private __money_put<_CharT>
-{
+class _LIBCPP_TEMPLATE_VIS money_put : public locale::facet, private __money_put<_CharT> {
public:
- typedef _CharT char_type;
- typedef _OutputIterator iter_type;
- typedef basic_string<char_type> string_type;
-
- _LIBCPP_HIDE_FROM_ABI
- explicit money_put(size_t __refs = 0)
- : locale::facet(__refs) {}
-
- _LIBCPP_HIDE_FROM_ABI
- iter_type put(iter_type __s, bool __intl, ios_base& __iob, char_type __fl,
- long double __units) const
- {
- return do_put(__s, __intl, __iob, __fl, __units);
- }
+ typedef _CharT char_type;
+ typedef _OutputIterator iter_type;
+ typedef basic_string<char_type> string_type;
- _LIBCPP_HIDE_FROM_ABI
- iter_type put(iter_type __s, bool __intl, ios_base& __iob, char_type __fl,
- const string_type& __digits) const
- {
- return do_put(__s, __intl, __iob, __fl, __digits);
- }
+ _LIBCPP_HIDE_FROM_ABI explicit money_put(size_t __refs = 0) : locale::facet(__refs) {}
- static locale::id id;
+ _LIBCPP_HIDE_FROM_ABI iter_type
+ put(iter_type __s, bool __intl, ios_base& __iob, char_type __fl, long double __units) const {
+ return do_put(__s, __intl, __iob, __fl, __units);
+ }
+
+ _LIBCPP_HIDE_FROM_ABI iter_type
+ put(iter_type __s, bool __intl, ios_base& __iob, char_type __fl, const string_type& __digits) const {
+ return do_put(__s, __intl, __iob, __fl, __digits);
+ }
+
+ static locale::id id;
protected:
- _LIBCPP_HIDE_FROM_ABI_VIRTUAL ~money_put() override {}
+ _LIBCPP_HIDE_FROM_ABI_VIRTUAL ~money_put() override {}
- virtual iter_type do_put(iter_type __s, bool __intl, ios_base& __iob,
- char_type __fl, long double __units) const;
- virtual iter_type do_put(iter_type __s, bool __intl, ios_base& __iob,
- char_type __fl, const string_type& __digits) const;
+ virtual iter_type do_put(iter_type __s, bool __intl, ios_base& __iob, char_type __fl, long double __units) const;
+ virtual iter_type
+ do_put(iter_type __s, bool __intl, ios_base& __iob, char_type __fl, const string_type& __digits) const;
};
template <class _CharT, class _OutputIterator>
-locale::id
-money_put<_CharT, _OutputIterator>::id;
+locale::id money_put<_CharT, _OutputIterator>::id;
template <class _CharT, class _OutputIterator>
-_OutputIterator
-money_put<_CharT, _OutputIterator>::do_put(iter_type __s, bool __intl,
- ios_base& __iob, char_type __fl,
- long double __units) const
-{
- // convert to char
- const size_t __bs = 100;
- char __buf[__bs];
- char* __bb = __buf;
- char_type __digits[__bs];
- char_type* __db = __digits;
- int __n = snprintf(__bb, __bs, "%.0Lf", __units);
- unique_ptr<char, void(*)(void*)> __hn(nullptr, free);
- unique_ptr<char_type, void(*)(void*)> __hd(0, free);
- // secure memory for digit storage
- if (static_cast<size_t>(__n) > __bs-1)
- {
- __n = __libcpp_asprintf_l(&__bb, _LIBCPP_GET_C_LOCALE, "%.0Lf", __units);
- if (__n == -1)
- __throw_bad_alloc();
- __hn.reset(__bb);
- __hd.reset((char_type*)malloc(static_cast<size_t>(__n) * sizeof(char_type)));
- if (__hd == nullptr)
- __throw_bad_alloc();
- __db = __hd.get();
- }
- // gather info
- locale __loc = __iob.getloc();
- const ctype<char_type>& __ct = std::use_facet<ctype<char_type> >(__loc);
- __ct.widen(__bb, __bb + __n, __db);
- bool __neg = __n > 0 && __bb[0] == '-';
- money_base::pattern __pat;
- char_type __dp;
- char_type __ts;
- string __grp;
- string_type __sym;
- string_type __sn;
- int __fd;
- this->__gather_info(__intl, __neg, __loc, __pat, __dp, __ts, __grp, __sym, __sn, __fd);
- // secure memory for formatting
- char_type __mbuf[__bs];
- char_type* __mb = __mbuf;
- unique_ptr<char_type, void(*)(void*)> __hw(0, free);
- size_t __exn = __n > __fd ?
- (static_cast<size_t>(__n) - static_cast<size_t>(__fd)) * 2 +
- __sn.size() + __sym.size() + static_cast<size_t>(__fd) + 1
- : __sn.size() + __sym.size() + static_cast<size_t>(__fd) + 2;
- if (__exn > __bs)
- {
- __hw.reset((char_type*)malloc(__exn * sizeof(char_type)));
- __mb = __hw.get();
- if (__mb == 0)
- __throw_bad_alloc();
- }
- // format
- char_type* __mi;
- char_type* __me;
- this->__format(__mb, __mi, __me, __iob.flags(),
- __db, __db + __n, __ct,
- __neg, __pat, __dp, __ts, __grp, __sym, __sn, __fd);
- return std::__pad_and_output(__s, __mb, __mi, __me, __iob, __fl);
+_OutputIterator money_put<_CharT, _OutputIterator>::do_put(
+ iter_type __s, bool __intl, ios_base& __iob, char_type __fl, long double __units) const {
+ // convert to char
+ const size_t __bs = 100;
+ char __buf[__bs];
+ char* __bb = __buf;
+ char_type __digits[__bs];
+ char_type* __db = __digits;
+ int __n = snprintf(__bb, __bs, "%.0Lf", __units);
+ unique_ptr<char, void (*)(void*)> __hn(nullptr, free);
+ unique_ptr<char_type, void (*)(void*)> __hd(0, free);
+ // secure memory for digit storage
+ if (static_cast<size_t>(__n) > __bs - 1) {
+ __n = __libcpp_asprintf_l(&__bb, _LIBCPP_GET_C_LOCALE, "%.0Lf", __units);
+ if (__n == -1)
+ __throw_bad_alloc();
+ __hn.reset(__bb);
+ __hd.reset((char_type*)malloc(static_cast<size_t>(__n) * sizeof(char_type)));
+ if (__hd == nullptr)
+ __throw_bad_alloc();
+ __db = __hd.get();
+ }
+ // gather info
+ locale __loc = __iob.getloc();
+ const ctype<char_type>& __ct = std::use_facet<ctype<char_type> >(__loc);
+ __ct.widen(__bb, __bb + __n, __db);
+ bool __neg = __n > 0 && __bb[0] == '-';
+ money_base::pattern __pat;
+ char_type __dp;
+ char_type __ts;
+ string __grp;
+ string_type __sym;
+ string_type __sn;
+ int __fd;
+ this->__gather_info(__intl, __neg, __loc, __pat, __dp, __ts, __grp, __sym, __sn, __fd);
+ // secure memory for formatting
+ char_type __mbuf[__bs];
+ char_type* __mb = __mbuf;
+ unique_ptr<char_type, void (*)(void*)> __hw(0, free);
+ size_t __exn = __n > __fd ? (static_cast<size_t>(__n) - static_cast<size_t>(__fd)) * 2 + __sn.size() + __sym.size() +
+ static_cast<size_t>(__fd) + 1
+ : __sn.size() + __sym.size() + static_cast<size_t>(__fd) + 2;
+ if (__exn > __bs) {
+ __hw.reset((char_type*)malloc(__exn * sizeof(char_type)));
+ __mb = __hw.get();
+ if (__mb == 0)
+ __throw_bad_alloc();
+ }
+ // format
+ char_type* __mi;
+ char_type* __me;
+ this->__format(
+ __mb, __mi, __me, __iob.flags(), __db, __db + __n, __ct, __neg, __pat, __dp, __ts, __grp, __sym, __sn, __fd);
+ return std::__pad_and_output(__s, __mb, __mi, __me, __iob, __fl);
}
template <class _CharT, class _OutputIterator>
-_OutputIterator
-money_put<_CharT, _OutputIterator>::do_put(iter_type __s, bool __intl,
- ios_base& __iob, char_type __fl,
- const string_type& __digits) const
-{
- // gather info
- locale __loc = __iob.getloc();
- const ctype<char_type>& __ct = std::use_facet<ctype<char_type> >(__loc);
- bool __neg = __digits.size() > 0 && __digits[0] == __ct.widen('-');
- money_base::pattern __pat;
- char_type __dp;
- char_type __ts;
- string __grp;
- string_type __sym;
- string_type __sn;
- int __fd;
- this->__gather_info(__intl, __neg, __loc, __pat, __dp, __ts, __grp, __sym, __sn, __fd);
- // secure memory for formatting
- char_type __mbuf[100];
- char_type* __mb = __mbuf;
- unique_ptr<char_type, void(*)(void*)> __h(0, free);
- size_t __exn = static_cast<int>(__digits.size()) > __fd ?
- (__digits.size() - static_cast<size_t>(__fd)) * 2 +
- __sn.size() + __sym.size() + static_cast<size_t>(__fd) + 1
- : __sn.size() + __sym.size() + static_cast<size_t>(__fd) + 2;
- if (__exn > 100)
- {
- __h.reset((char_type*)malloc(__exn * sizeof(char_type)));
- __mb = __h.get();
- if (__mb == 0)
- __throw_bad_alloc();
- }
- // format
- char_type* __mi;
- char_type* __me;
- this->__format(__mb, __mi, __me, __iob.flags(),
- __digits.data(), __digits.data() + __digits.size(), __ct,
- __neg, __pat, __dp, __ts, __grp, __sym, __sn, __fd);
- return std::__pad_and_output(__s, __mb, __mi, __me, __iob, __fl);
+_OutputIterator money_put<_CharT, _OutputIterator>::do_put(
+ iter_type __s, bool __intl, ios_base& __iob, char_type __fl, const string_type& __digits) const {
+ // gather info
+ locale __loc = __iob.getloc();
+ const ctype<char_type>& __ct = std::use_facet<ctype<char_type> >(__loc);
+ bool __neg = __digits.size() > 0 && __digits[0] == __ct.widen('-');
+ money_base::pattern __pat;
+ char_type __dp;
+ char_type __ts;
+ string __grp;
+ string_type __sym;
+ string_type __sn;
+ int __fd;
+ this->__gather_info(__intl, __neg, __loc, __pat, __dp, __ts, __grp, __sym, __sn, __fd);
+ // secure memory for formatting
+ char_type __mbuf[100];
+ char_type* __mb = __mbuf;
+ unique_ptr<char_type, void (*)(void*)> __h(0, free);
+ size_t __exn =
+ static_cast<int>(__digits.size()) > __fd
+ ? (__digits.size() - static_cast<size_t>(__fd)) * 2 + __sn.size() + __sym.size() + static_cast<size_t>(__fd) +
+ 1
+ : __sn.size() + __sym.size() + static_cast<size_t>(__fd) + 2;
+ if (__exn > 100) {
+ __h.reset((char_type*)malloc(__exn * sizeof(char_type)));
+ __mb = __h.get();
+ if (__mb == 0)
+ __throw_bad_alloc();
+ }
+ // format
+ char_type* __mi;
+ char_type* __me;
+ this->__format(
+ __mb,
+ __mi,
+ __me,
+ __iob.flags(),
+ __digits.data(),
+ __digits.data() + __digits.size(),
+ __ct,
+ __neg,
+ __pat,
+ __dp,
+ __ts,
+ __grp,
+ __sym,
+ __sn,
+ __fd);
+ return std::__pad_and_output(__s, __mb, __mi, __me, __iob, __fl);
}
extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS money_put<char>;
@@ -3452,106 +3005,81 @@ extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS money_put<wchar_t>;
// messages
-class _LIBCPP_EXPORTED_FROM_ABI messages_base
-{
+class _LIBCPP_EXPORTED_FROM_ABI messages_base {
public:
- typedef intptr_t catalog;
+ typedef intptr_t catalog;
- _LIBCPP_HIDE_FROM_ABI messages_base() {}
+ _LIBCPP_HIDE_FROM_ABI messages_base() {}
};
template <class _CharT>
-class _LIBCPP_TEMPLATE_VIS messages
- : public locale::facet,
- public messages_base
-{
+class _LIBCPP_TEMPLATE_VIS messages : public locale::facet, public messages_base {
public:
- typedef _CharT char_type;
- typedef basic_string<_CharT> string_type;
+ typedef _CharT char_type;
+ typedef basic_string<_CharT> string_type;
- _LIBCPP_HIDE_FROM_ABI
- explicit messages(size_t __refs = 0)
- : locale::facet(__refs) {}
+ _LIBCPP_HIDE_FROM_ABI explicit messages(size_t __refs = 0) : locale::facet(__refs) {}
- _LIBCPP_HIDE_FROM_ABI
- catalog open(const basic_string<char>& __nm, const locale& __loc) const
- {
- return do_open(__nm, __loc);
- }
+ _LIBCPP_HIDE_FROM_ABI catalog open(const basic_string<char>& __nm, const locale& __loc) const {
+ return do_open(__nm, __loc);
+ }
- _LIBCPP_HIDE_FROM_ABI
- string_type get(catalog __c, int __set, int __msgid,
- const string_type& __dflt) const
- {
- return do_get(__c, __set, __msgid, __dflt);
- }
+ _LIBCPP_HIDE_FROM_ABI string_type get(catalog __c, int __set, int __msgid, const string_type& __dflt) const {
+ return do_get(__c, __set, __msgid, __dflt);
+ }
- _LIBCPP_HIDE_FROM_ABI
- void close(catalog __c) const
- {
- do_close(__c);
- }
+ _LIBCPP_HIDE_FROM_ABI void close(catalog __c) const { do_close(__c); }
- static locale::id id;
+ static locale::id id;
protected:
- _LIBCPP_HIDE_FROM_ABI_VIRTUAL ~messages() override {}
+ _LIBCPP_HIDE_FROM_ABI_VIRTUAL ~messages() override {}
- virtual catalog do_open(const basic_string<char>&, const locale&) const;
- virtual string_type do_get(catalog, int __set, int __msgid,
- const string_type& __dflt) const;
- virtual void do_close(catalog) const;
+ virtual catalog do_open(const basic_string<char>&, const locale&) const;
+ virtual string_type do_get(catalog, int __set, int __msgid, const string_type& __dflt) const;
+ virtual void do_close(catalog) const;
};
template <class _CharT>
-locale::id
-messages<_CharT>::id;
+locale::id messages<_CharT>::id;
template <class _CharT>
-typename messages<_CharT>::catalog
-messages<_CharT>::do_open(const basic_string<char>& __nm, const locale&) const
-{
+typename messages<_CharT>::catalog messages<_CharT>::do_open(const basic_string<char>& __nm, const locale&) const {
#ifdef _LIBCPP_HAS_CATOPEN
- return (catalog)catopen(__nm.c_str(), NL_CAT_LOCALE);
-#else // !_LIBCPP_HAS_CATOPEN
- (void)__nm;
- return -1;
+ return (catalog)catopen(__nm.c_str(), NL_CAT_LOCALE);
+#else // !_LIBCPP_HAS_CATOPEN
+ (void)__nm;
+ return -1;
#endif // _LIBCPP_HAS_CATOPEN
}
template <class _CharT>
typename messages<_CharT>::string_type
-messages<_CharT>::do_get(catalog __c, int __set, int __msgid,
- const string_type& __dflt) const
-{
+messages<_CharT>::do_get(catalog __c, int __set, int __msgid, const string_type& __dflt) const {
#ifdef _LIBCPP_HAS_CATOPEN
- string __ndflt;
- __narrow_to_utf8<sizeof(char_type)*__CHAR_BIT__>()(std::back_inserter(__ndflt),
- __dflt.c_str(),
- __dflt.c_str() + __dflt.size());
- nl_catd __cat = (nl_catd)__c;
- static_assert(sizeof(catalog) >= sizeof(nl_catd), "Unexpected nl_catd type");
- char* __n = catgets(__cat, __set, __msgid, __ndflt.c_str());
- string_type __w;
- __widen_from_utf8<sizeof(char_type)*__CHAR_BIT__>()(std::back_inserter(__w),
- __n, __n + std::strlen(__n));
- return __w;
-#else // !_LIBCPP_HAS_CATOPEN
- (void)__c;
- (void)__set;
- (void)__msgid;
- return __dflt;
+ string __ndflt;
+ __narrow_to_utf8<sizeof(char_type) * __CHAR_BIT__>()(
+ std::back_inserter(__ndflt), __dflt.c_str(), __dflt.c_str() + __dflt.size());
+ nl_catd __cat = (nl_catd)__c;
+ static_assert(sizeof(catalog) >= sizeof(nl_catd), "Unexpected nl_catd type");
+ char* __n = catgets(__cat, __set, __msgid, __ndflt.c_str());
+ string_type __w;
+ __widen_from_utf8<sizeof(char_type) * __CHAR_BIT__>()(std::back_inserter(__w), __n, __n + std::strlen(__n));
+ return __w;
+#else // !_LIBCPP_HAS_CATOPEN
+ (void)__c;
+ (void)__set;
+ (void)__msgid;
+ return __dflt;
#endif // _LIBCPP_HAS_CATOPEN
}
template <class _CharT>
-void
-messages<_CharT>::do_close(catalog __c) const
-{
+void messages<_CharT>::do_close(catalog __c) const {
#ifdef _LIBCPP_HAS_CATOPEN
- catclose((nl_catd)__c);
-#else // !_LIBCPP_HAS_CATOPEN
- (void)__c;
+ catclose((nl_catd)__c);
+#else // !_LIBCPP_HAS_CATOPEN
+ (void)__c;
#endif // _LIBCPP_HAS_CATOPEN
}
@@ -3561,23 +3089,17 @@ extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS messages<wchar_t>;
#endif
template <class _CharT>
-class _LIBCPP_TEMPLATE_VIS messages_byname
- : public messages<_CharT>
-{
+class _LIBCPP_TEMPLATE_VIS messages_byname : public messages<_CharT> {
public:
- typedef messages_base::catalog catalog;
- typedef basic_string<_CharT> string_type;
+ typedef messages_base::catalog catalog;
+ typedef basic_string<_CharT> string_type;
- _LIBCPP_HIDE_FROM_ABI
- explicit messages_byname(const char*, size_t __refs = 0)
- : messages<_CharT>(__refs) {}
+ _LIBCPP_HIDE_FROM_ABI explicit messages_byname(const char*, size_t __refs = 0) : messages<_CharT>(__refs) {}
- _LIBCPP_HIDE_FROM_ABI
- explicit messages_byname(const string&, size_t __refs = 0)
- : messages<_CharT>(__refs) {}
+ _LIBCPP_HIDE_FROM_ABI explicit messages_byname(const string&, size_t __refs = 0) : messages<_CharT>(__refs) {}
protected:
- _LIBCPP_HIDE_FROM_ABI_VIRTUAL ~messages_byname() override {}
+ _LIBCPP_HIDE_FROM_ABI_VIRTUAL ~messages_byname() override {}
};
extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS messages_byname<char>;
@@ -3585,359 +3107,291 @@ extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS messages_byname<char>;
extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS messages_byname<wchar_t>;
#endif
-template<class _Codecvt, class _Elem = wchar_t,
- class _WideAlloc = allocator<_Elem>,
- class _ByteAlloc = allocator<char> >
-class _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX17 wstring_convert
-{
+template <class _Codecvt,
+ class _Elem = wchar_t,
+ class _WideAlloc = allocator<_Elem>,
+ class _ByteAlloc = allocator<char> >
+class _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX17 wstring_convert {
public:
- typedef basic_string<char, char_traits<char>, _ByteAlloc> byte_string;
- typedef basic_string<_Elem, char_traits<_Elem>, _WideAlloc> wide_string;
- typedef typename _Codecvt::state_type state_type;
- typedef typename wide_string::traits_type::int_type int_type;
+ typedef basic_string<char, char_traits<char>, _ByteAlloc> byte_string;
+ typedef basic_string<_Elem, char_traits<_Elem>, _WideAlloc> wide_string;
+ typedef typename _Codecvt::state_type state_type;
+ typedef typename wide_string::traits_type::int_type int_type;
private:
- byte_string __byte_err_string_;
- wide_string __wide_err_string_;
- _Codecvt* __cvtptr_;
- state_type __cvtstate_;
- size_t __cvtcount_;
-
- wstring_convert(const wstring_convert& __wc);
- wstring_convert& operator=(const wstring_convert& __wc);
+ byte_string __byte_err_string_;
+ wide_string __wide_err_string_;
+ _Codecvt* __cvtptr_;
+ state_type __cvtstate_;
+ size_t __cvtcount_;
+
+ wstring_convert(const wstring_convert& __wc);
+ wstring_convert& operator=(const wstring_convert& __wc);
+
public:
#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI
- wstring_convert() : wstring_convert(new _Codecvt) {}
- _LIBCPP_HIDE_FROM_ABI
- explicit wstring_convert(_Codecvt* __pcvt);
+ _LIBCPP_HIDE_FROM_ABI wstring_convert() : wstring_convert(new _Codecvt) {}
+ _LIBCPP_HIDE_FROM_ABI explicit wstring_convert(_Codecvt* __pcvt);
#else
- _LIBCPP_HIDE_FROM_ABI
- _LIBCPP_EXPLICIT_SINCE_CXX14
- wstring_convert(_Codecvt* __pcvt = new _Codecvt);
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_EXPLICIT_SINCE_CXX14 wstring_convert(_Codecvt* __pcvt = new _Codecvt);
#endif
- _LIBCPP_HIDE_FROM_ABI
- wstring_convert(_Codecvt* __pcvt, state_type __state);
- _LIBCPP_EXPLICIT_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI wstring_convert(const byte_string& __byte_err,
- const wide_string& __wide_err = wide_string());
+ _LIBCPP_HIDE_FROM_ABI wstring_convert(_Codecvt* __pcvt, state_type __state);
+ _LIBCPP_EXPLICIT_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
+ wstring_convert(const byte_string& __byte_err, const wide_string& __wide_err = wide_string());
#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI
- wstring_convert(wstring_convert&& __wc);
+ _LIBCPP_HIDE_FROM_ABI wstring_convert(wstring_convert&& __wc);
#endif
- _LIBCPP_HIDE_FROM_ABI ~wstring_convert();
-
- _LIBCPP_HIDE_FROM_ABI
- wide_string from_bytes(char __byte)
- {return from_bytes(&__byte, &__byte+1);}
- _LIBCPP_HIDE_FROM_ABI
- wide_string from_bytes(const char* __ptr)
- {return from_bytes(__ptr, __ptr + char_traits<char>::length(__ptr));}
- _LIBCPP_HIDE_FROM_ABI
- wide_string from_bytes(const byte_string& __str)
- {return from_bytes(__str.data(), __str.data() + __str.size());}
- _LIBCPP_HIDE_FROM_ABI wide_string from_bytes(const char* __first, const char* __last);
-
- _LIBCPP_HIDE_FROM_ABI
- byte_string to_bytes(_Elem __wchar)
- {return to_bytes(&__wchar, &__wchar+1);}
- _LIBCPP_HIDE_FROM_ABI
- byte_string to_bytes(const _Elem* __wptr)
- {return to_bytes(__wptr, __wptr + char_traits<_Elem>::length(__wptr));}
- _LIBCPP_HIDE_FROM_ABI
- byte_string to_bytes(const wide_string& __wstr)
- {return to_bytes(__wstr.data(), __wstr.data() + __wstr.size());}
- _LIBCPP_HIDE_FROM_ABI byte_string to_bytes(const _Elem* __first, const _Elem* __last);
-
- _LIBCPP_HIDE_FROM_ABI
- size_t converted() const _NOEXCEPT {return __cvtcount_;}
- _LIBCPP_HIDE_FROM_ABI
- state_type state() const {return __cvtstate_;}
+ _LIBCPP_HIDE_FROM_ABI ~wstring_convert();
+
+ _LIBCPP_HIDE_FROM_ABI wide_string from_bytes(char __byte) { return from_bytes(&__byte, &__byte + 1); }
+ _LIBCPP_HIDE_FROM_ABI wide_string from_bytes(const char* __ptr) {
+ return from_bytes(__ptr, __ptr + char_traits<char>::length(__ptr));
+ }
+ _LIBCPP_HIDE_FROM_ABI wide_string from_bytes(const byte_string& __str) {
+ return from_bytes(__str.data(), __str.data() + __str.size());
+ }
+ _LIBCPP_HIDE_FROM_ABI wide_string from_bytes(const char* __first, const char* __last);
+
+ _LIBCPP_HIDE_FROM_ABI byte_string to_bytes(_Elem __wchar) { return to_bytes(&__wchar, &__wchar + 1); }
+ _LIBCPP_HIDE_FROM_ABI byte_string to_bytes(const _Elem* __wptr) {
+ return to_bytes(__wptr, __wptr + char_traits<_Elem>::length(__wptr));
+ }
+ _LIBCPP_HIDE_FROM_ABI byte_string to_bytes(const wide_string& __wstr) {
+ return to_bytes(__wstr.data(), __wstr.data() + __wstr.size());
+ }
+ _LIBCPP_HIDE_FROM_ABI byte_string to_bytes(const _Elem* __first, const _Elem* __last);
+
+ _LIBCPP_HIDE_FROM_ABI size_t converted() const _NOEXCEPT { return __cvtcount_; }
+ _LIBCPP_HIDE_FROM_ABI state_type state() const { return __cvtstate_; }
};
_LIBCPP_SUPPRESS_DEPRECATED_PUSH
-template<class _Codecvt, class _Elem, class _WideAlloc, class _ByteAlloc>
-inline
-wstring_convert<_Codecvt, _Elem, _WideAlloc, _ByteAlloc>::
- wstring_convert(_Codecvt* __pcvt)
- : __cvtptr_(__pcvt), __cvtstate_(), __cvtcount_(0)
-{
-}
+template <class _Codecvt, class _Elem, class _WideAlloc, class _ByteAlloc>
+inline wstring_convert<_Codecvt, _Elem, _WideAlloc, _ByteAlloc>::wstring_convert(_Codecvt* __pcvt)
+ : __cvtptr_(__pcvt), __cvtstate_(), __cvtcount_(0) {}
_LIBCPP_SUPPRESS_DEPRECATED_POP
-template<class _Codecvt, class _Elem, class _WideAlloc, class _ByteAlloc>
-inline
-wstring_convert<_Codecvt, _Elem, _WideAlloc, _ByteAlloc>::
- wstring_convert(_Codecvt* __pcvt, state_type __state)
- : __cvtptr_(__pcvt), __cvtstate_(__state), __cvtcount_(0)
-{
-}
+template <class _Codecvt, class _Elem, class _WideAlloc, class _ByteAlloc>
+inline wstring_convert<_Codecvt, _Elem, _WideAlloc, _ByteAlloc>::wstring_convert(_Codecvt* __pcvt, state_type __state)
+ : __cvtptr_(__pcvt), __cvtstate_(__state), __cvtcount_(0) {}
-template<class _Codecvt, class _Elem, class _WideAlloc, class _ByteAlloc>
-wstring_convert<_Codecvt, _Elem, _WideAlloc, _ByteAlloc>::
- wstring_convert(const byte_string& __byte_err, const wide_string& __wide_err)
- : __byte_err_string_(__byte_err), __wide_err_string_(__wide_err),
- __cvtstate_(), __cvtcount_(0)
-{
- __cvtptr_ = new _Codecvt;
+template <class _Codecvt, class _Elem, class _WideAlloc, class _ByteAlloc>
+wstring_convert<_Codecvt, _Elem, _WideAlloc, _ByteAlloc>::wstring_convert(
+ const byte_string& __byte_err, const wide_string& __wide_err)
+ : __byte_err_string_(__byte_err), __wide_err_string_(__wide_err), __cvtstate_(), __cvtcount_(0) {
+ __cvtptr_ = new _Codecvt;
}
#ifndef _LIBCPP_CXX03_LANG
-template<class _Codecvt, class _Elem, class _WideAlloc, class _ByteAlloc>
-inline
-wstring_convert<_Codecvt, _Elem, _WideAlloc, _ByteAlloc>::
- wstring_convert(wstring_convert&& __wc)
- : __byte_err_string_(std::move(__wc.__byte_err_string_)),
- __wide_err_string_(std::move(__wc.__wide_err_string_)),
- __cvtptr_(__wc.__cvtptr_),
- __cvtstate_(__wc.__cvtstate_), __cvtcount_(__wc.__cvtcount_)
-{
- __wc.__cvtptr_ = nullptr;
+template <class _Codecvt, class _Elem, class _WideAlloc, class _ByteAlloc>
+inline wstring_convert<_Codecvt, _Elem, _WideAlloc, _ByteAlloc>::wstring_convert(wstring_convert&& __wc)
+ : __byte_err_string_(std::move(__wc.__byte_err_string_)),
+ __wide_err_string_(std::move(__wc.__wide_err_string_)),
+ __cvtptr_(__wc.__cvtptr_),
+ __cvtstate_(__wc.__cvtstate_),
+ __cvtcount_(__wc.__cvtcount_) {
+ __wc.__cvtptr_ = nullptr;
}
#endif // _LIBCPP_CXX03_LANG
_LIBCPP_SUPPRESS_DEPRECATED_PUSH
-template<class _Codecvt, class _Elem, class _WideAlloc, class _ByteAlloc>
-wstring_convert<_Codecvt, _Elem, _WideAlloc, _ByteAlloc>::~wstring_convert()
-{
- delete __cvtptr_;
+template <class _Codecvt, class _Elem, class _WideAlloc, class _ByteAlloc>
+wstring_convert<_Codecvt, _Elem, _WideAlloc, _ByteAlloc>::~wstring_convert() {
+ delete __cvtptr_;
}
-template<class _Codecvt, class _Elem, class _WideAlloc, class _ByteAlloc>
+template <class _Codecvt, class _Elem, class _WideAlloc, class _ByteAlloc>
typename wstring_convert<_Codecvt, _Elem, _WideAlloc, _ByteAlloc>::wide_string
-wstring_convert<_Codecvt, _Elem, _WideAlloc, _ByteAlloc>::
- from_bytes(const char* __frm, const char* __frm_end)
-{
-_LIBCPP_SUPPRESS_DEPRECATED_POP
- __cvtcount_ = 0;
- if (__cvtptr_ != nullptr)
- {
- wide_string __ws(2*(__frm_end - __frm), _Elem());
- if (__frm != __frm_end)
- __ws.resize(__ws.capacity());
- codecvt_base::result __r = codecvt_base::ok;
- state_type __st = __cvtstate_;
- if (__frm != __frm_end)
- {
- _Elem* __to = &__ws[0];
- _Elem* __to_end = __to + __ws.size();
- const char* __frm_nxt;
- do
- {
- _Elem* __to_nxt;
- __r = __cvtptr_->in(__st, __frm, __frm_end, __frm_nxt,
- __to, __to_end, __to_nxt);
- __cvtcount_ += __frm_nxt - __frm;
- if (__frm_nxt == __frm)
- {
- __r = codecvt_base::error;
- }
- else if (__r == codecvt_base::noconv)
- {
- __ws.resize(__to - &__ws[0]);
- // This only gets executed if _Elem is char
- __ws.append((const _Elem*)__frm, (const _Elem*)__frm_end);
- __frm = __frm_nxt;
- __r = codecvt_base::ok;
- }
- else if (__r == codecvt_base::ok)
- {
- __ws.resize(__to_nxt - &__ws[0]);
- __frm = __frm_nxt;
- }
- else if (__r == codecvt_base::partial)
- {
- ptrdiff_t __s = __to_nxt - &__ws[0];
- __ws.resize(2 * __s);
- __to = &__ws[0] + __s;
- __to_end = &__ws[0] + __ws.size();
- __frm = __frm_nxt;
- }
- } while (__r == codecvt_base::partial && __frm_nxt < __frm_end);
+wstring_convert<_Codecvt, _Elem, _WideAlloc, _ByteAlloc>::from_bytes(const char* __frm, const char* __frm_end) {
+ _LIBCPP_SUPPRESS_DEPRECATED_POP
+ __cvtcount_ = 0;
+ if (__cvtptr_ != nullptr) {
+ wide_string __ws(2 * (__frm_end - __frm), _Elem());
+ if (__frm != __frm_end)
+ __ws.resize(__ws.capacity());
+ codecvt_base::result __r = codecvt_base::ok;
+ state_type __st = __cvtstate_;
+ if (__frm != __frm_end) {
+ _Elem* __to = &__ws[0];
+ _Elem* __to_end = __to + __ws.size();
+ const char* __frm_nxt;
+ do {
+ _Elem* __to_nxt;
+ __r = __cvtptr_->in(__st, __frm, __frm_end, __frm_nxt, __to, __to_end, __to_nxt);
+ __cvtcount_ += __frm_nxt - __frm;
+ if (__frm_nxt == __frm) {
+ __r = codecvt_base::error;
+ } else if (__r == codecvt_base::noconv) {
+ __ws.resize(__to - &__ws[0]);
+ // This only gets executed if _Elem is char
+ __ws.append((const _Elem*)__frm, (const _Elem*)__frm_end);
+ __frm = __frm_nxt;
+ __r = codecvt_base::ok;
+ } else if (__r == codecvt_base::ok) {
+ __ws.resize(__to_nxt - &__ws[0]);
+ __frm = __frm_nxt;
+ } else if (__r == codecvt_base::partial) {
+ ptrdiff_t __s = __to_nxt - &__ws[0];
+ __ws.resize(2 * __s);
+ __to = &__ws[0] + __s;
+ __to_end = &__ws[0] + __ws.size();
+ __frm = __frm_nxt;
}
- if (__r == codecvt_base::ok)
- return __ws;
+ } while (__r == codecvt_base::partial && __frm_nxt < __frm_end);
}
+ if (__r == codecvt_base::ok)
+ return __ws;
+ }
- if (__wide_err_string_.empty())
- __throw_range_error("wstring_convert: from_bytes error");
+ if (__wide_err_string_.empty())
+ __throw_range_error("wstring_convert: from_bytes error");
- return __wide_err_string_;
+ return __wide_err_string_;
}
-template<class _Codecvt, class _Elem, class _WideAlloc, class _ByteAlloc>
+template <class _Codecvt, class _Elem, class _WideAlloc, class _ByteAlloc>
typename wstring_convert<_Codecvt, _Elem, _WideAlloc, _ByteAlloc>::byte_string
-wstring_convert<_Codecvt, _Elem, _WideAlloc, _ByteAlloc>::
- to_bytes(const _Elem* __frm, const _Elem* __frm_end)
-{
- __cvtcount_ = 0;
- if (__cvtptr_ != nullptr)
- {
- byte_string __bs(2*(__frm_end - __frm), char());
- if (__frm != __frm_end)
- __bs.resize(__bs.capacity());
- codecvt_base::result __r = codecvt_base::ok;
- state_type __st = __cvtstate_;
- if (__frm != __frm_end)
- {
- char* __to = &__bs[0];
- char* __to_end = __to + __bs.size();
- const _Elem* __frm_nxt;
- do
- {
- char* __to_nxt;
- __r = __cvtptr_->out(__st, __frm, __frm_end, __frm_nxt,
- __to, __to_end, __to_nxt);
- __cvtcount_ += __frm_nxt - __frm;
- if (__frm_nxt == __frm)
- {
- __r = codecvt_base::error;
- }
- else if (__r == codecvt_base::noconv)
- {
- __bs.resize(__to - &__bs[0]);
- // This only gets executed if _Elem is char
- __bs.append((const char*)__frm, (const char*)__frm_end);
- __frm = __frm_nxt;
- __r = codecvt_base::ok;
- }
- else if (__r == codecvt_base::ok)
- {
- __bs.resize(__to_nxt - &__bs[0]);
- __frm = __frm_nxt;
- }
- else if (__r == codecvt_base::partial)
- {
- ptrdiff_t __s = __to_nxt - &__bs[0];
- __bs.resize(2 * __s);
- __to = &__bs[0] + __s;
- __to_end = &__bs[0] + __bs.size();
- __frm = __frm_nxt;
- }
- } while (__r == codecvt_base::partial && __frm_nxt < __frm_end);
+wstring_convert<_Codecvt, _Elem, _WideAlloc, _ByteAlloc>::to_bytes(const _Elem* __frm, const _Elem* __frm_end) {
+ __cvtcount_ = 0;
+ if (__cvtptr_ != nullptr) {
+ byte_string __bs(2 * (__frm_end - __frm), char());
+ if (__frm != __frm_end)
+ __bs.resize(__bs.capacity());
+ codecvt_base::result __r = codecvt_base::ok;
+ state_type __st = __cvtstate_;
+ if (__frm != __frm_end) {
+ char* __to = &__bs[0];
+ char* __to_end = __to + __bs.size();
+ const _Elem* __frm_nxt;
+ do {
+ char* __to_nxt;
+ __r = __cvtptr_->out(__st, __frm, __frm_end, __frm_nxt, __to, __to_end, __to_nxt);
+ __cvtcount_ += __frm_nxt - __frm;
+ if (__frm_nxt == __frm) {
+ __r = codecvt_base::error;
+ } else if (__r == codecvt_base::noconv) {
+ __bs.resize(__to - &__bs[0]);
+ // This only gets executed if _Elem is char
+ __bs.append((const char*)__frm, (const char*)__frm_end);
+ __frm = __frm_nxt;
+ __r = codecvt_base::ok;
+ } else if (__r == codecvt_base::ok) {
+ __bs.resize(__to_nxt - &__bs[0]);
+ __frm = __frm_nxt;
+ } else if (__r == codecvt_base::partial) {
+ ptrdiff_t __s = __to_nxt - &__bs[0];
+ __bs.resize(2 * __s);
+ __to = &__bs[0] + __s;
+ __to_end = &__bs[0] + __bs.size();
+ __frm = __frm_nxt;
}
- if (__r == codecvt_base::ok)
- {
- size_t __s = __bs.size();
- __bs.resize(__bs.capacity());
- char* __to = &__bs[0] + __s;
- char* __to_end = __to + __bs.size();
- do
- {
- char* __to_nxt;
- __r = __cvtptr_->unshift(__st, __to, __to_end, __to_nxt);
- if (__r == codecvt_base::noconv)
- {
- __bs.resize(__to - &__bs[0]);
- __r = codecvt_base::ok;
- }
- else if (__r == codecvt_base::ok)
- {
- __bs.resize(__to_nxt - &__bs[0]);
- }
- else if (__r == codecvt_base::partial)
- {
- ptrdiff_t __sp = __to_nxt - &__bs[0];
- __bs.resize(2 * __sp);
- __to = &__bs[0] + __sp;
- __to_end = &__bs[0] + __bs.size();
- }
- } while (__r == codecvt_base::partial);
- if (__r == codecvt_base::ok)
- return __bs;
+ } while (__r == codecvt_base::partial && __frm_nxt < __frm_end);
+ }
+ if (__r == codecvt_base::ok) {
+ size_t __s = __bs.size();
+ __bs.resize(__bs.capacity());
+ char* __to = &__bs[0] + __s;
+ char* __to_end = __to + __bs.size();
+ do {
+ char* __to_nxt;
+ __r = __cvtptr_->unshift(__st, __to, __to_end, __to_nxt);
+ if (__r == codecvt_base::noconv) {
+ __bs.resize(__to - &__bs[0]);
+ __r = codecvt_base::ok;
+ } else if (__r == codecvt_base::ok) {
+ __bs.resize(__to_nxt - &__bs[0]);
+ } else if (__r == codecvt_base::partial) {
+ ptrdiff_t __sp = __to_nxt - &__bs[0];
+ __bs.resize(2 * __sp);
+ __to = &__bs[0] + __sp;
+ __to_end = &__bs[0] + __bs.size();
}
+ } while (__r == codecvt_base::partial);
+ if (__r == codecvt_base::ok)
+ return __bs;
}
+ }
- if (__byte_err_string_.empty())
- __throw_range_error("wstring_convert: to_bytes error");
+ if (__byte_err_string_.empty())
+ __throw_range_error("wstring_convert: to_bytes error");
- return __byte_err_string_;
+ return __byte_err_string_;
}
template <class _Codecvt, class _Elem = wchar_t, class _Tr = char_traits<_Elem> >
-class _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX17 wbuffer_convert
- : public basic_streambuf<_Elem, _Tr>
-{
+class _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX17 wbuffer_convert : public basic_streambuf<_Elem, _Tr> {
public:
- // types:
- typedef _Elem char_type;
- typedef _Tr traits_type;
- typedef typename traits_type::int_type int_type;
- typedef typename traits_type::pos_type pos_type;
- typedef typename traits_type::off_type off_type;
- typedef typename _Codecvt::state_type state_type;
+ // types:
+ typedef _Elem char_type;
+ typedef _Tr traits_type;
+ typedef typename traits_type::int_type int_type;
+ typedef typename traits_type::pos_type pos_type;
+ typedef typename traits_type::off_type off_type;
+ typedef typename _Codecvt::state_type state_type;
private:
- char* __extbuf_;
- const char* __extbufnext_;
- const char* __extbufend_;
- char __extbuf_min_[8];
- size_t __ebs_;
- char_type* __intbuf_;
- size_t __ibs_;
- streambuf* __bufptr_;
- _Codecvt* __cv_;
- state_type __st_;
- ios_base::openmode __cm_;
- bool __owns_eb_;
- bool __owns_ib_;
- bool __always_noconv_;
-
- wbuffer_convert(const wbuffer_convert&);
- wbuffer_convert& operator=(const wbuffer_convert&);
+ char* __extbuf_;
+ const char* __extbufnext_;
+ const char* __extbufend_;
+ char __extbuf_min_[8];
+ size_t __ebs_;
+ char_type* __intbuf_;
+ size_t __ibs_;
+ streambuf* __bufptr_;
+ _Codecvt* __cv_;
+ state_type __st_;
+ ios_base::openmode __cm_;
+ bool __owns_eb_;
+ bool __owns_ib_;
+ bool __always_noconv_;
+
+ wbuffer_convert(const wbuffer_convert&);
+ wbuffer_convert& operator=(const wbuffer_convert&);
public:
#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI wbuffer_convert() : wbuffer_convert(nullptr) {}
- explicit _LIBCPP_HIDE_FROM_ABI wbuffer_convert(streambuf* __bytebuf,
- _Codecvt* __pcvt = new _Codecvt,
- state_type __state = state_type());
+ _LIBCPP_HIDE_FROM_ABI wbuffer_convert() : wbuffer_convert(nullptr) {}
+ explicit _LIBCPP_HIDE_FROM_ABI
+ wbuffer_convert(streambuf* __bytebuf, _Codecvt* __pcvt = new _Codecvt, state_type __state = state_type());
#else
- _LIBCPP_EXPLICIT_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
- wbuffer_convert(streambuf* __bytebuf = nullptr,
- _Codecvt* __pcvt = new _Codecvt,
- state_type __state = state_type());
+ _LIBCPP_EXPLICIT_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
+ wbuffer_convert(streambuf* __bytebuf = nullptr, _Codecvt* __pcvt = new _Codecvt, state_type __state = state_type());
#endif
- _LIBCPP_HIDE_FROM_ABI ~wbuffer_convert();
+ _LIBCPP_HIDE_FROM_ABI ~wbuffer_convert();
- _LIBCPP_HIDE_FROM_ABI
- streambuf* rdbuf() const {return __bufptr_;}
- _LIBCPP_HIDE_FROM_ABI
- streambuf* rdbuf(streambuf* __bytebuf)
- {
- streambuf* __r = __bufptr_;
- __bufptr_ = __bytebuf;
- return __r;
- }
+ _LIBCPP_HIDE_FROM_ABI streambuf* rdbuf() const { return __bufptr_; }
+ _LIBCPP_HIDE_FROM_ABI streambuf* rdbuf(streambuf* __bytebuf) {
+ streambuf* __r = __bufptr_;
+ __bufptr_ = __bytebuf;
+ return __r;
+ }
- _LIBCPP_HIDE_FROM_ABI
- state_type state() const {return __st_;}
+ _LIBCPP_HIDE_FROM_ABI state_type state() const { return __st_; }
protected:
- _LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual int_type underflow();
- _LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual int_type pbackfail(int_type __c = traits_type::eof());
- _LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual int_type overflow (int_type __c = traits_type::eof());
- _LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual basic_streambuf<char_type, traits_type>* setbuf(char_type* __s,
- streamsize __n);
- _LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual pos_type seekoff(off_type __off, ios_base::seekdir __way,
- ios_base::openmode __wch = ios_base::in | ios_base::out);
- _LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual pos_type seekpos(pos_type __sp,
- ios_base::openmode __wch = ios_base::in | ios_base::out);
- _LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual int sync();
+ _LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual int_type underflow();
+ _LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual int_type pbackfail(int_type __c = traits_type::eof());
+ _LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual int_type overflow(int_type __c = traits_type::eof());
+ _LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual basic_streambuf<char_type, traits_type>* setbuf(char_type* __s, streamsize __n);
+ _LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual pos_type
+ seekoff(off_type __off, ios_base::seekdir __way, ios_base::openmode __wch = ios_base::in | ios_base::out);
+ _LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual pos_type
+ seekpos(pos_type __sp, ios_base::openmode __wch = ios_base::in | ios_base::out);
+ _LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual int sync();
private:
- _LIBCPP_HIDE_FROM_ABI_VIRTUAL bool __read_mode();
- _LIBCPP_HIDE_FROM_ABI_VIRTUAL void __write_mode();
- _LIBCPP_HIDE_FROM_ABI_VIRTUAL wbuffer_convert* __close();
+ _LIBCPP_HIDE_FROM_ABI_VIRTUAL bool __read_mode();
+ _LIBCPP_HIDE_FROM_ABI_VIRTUAL void __write_mode();
+ _LIBCPP_HIDE_FROM_ABI_VIRTUAL wbuffer_convert* __close();
};
_LIBCPP_SUPPRESS_DEPRECATED_PUSH
template <class _Codecvt, class _Elem, class _Tr>
-wbuffer_convert<_Codecvt, _Elem, _Tr>::
- wbuffer_convert(streambuf* __bytebuf, _Codecvt* __pcvt, state_type __state)
+wbuffer_convert<_Codecvt, _Elem, _Tr>::wbuffer_convert(streambuf* __bytebuf, _Codecvt* __pcvt, state_type __state)
: __extbuf_(nullptr),
__extbufnext_(nullptr),
__extbufend_(nullptr),
@@ -3950,389 +3404,310 @@ wbuffer_convert<_Codecvt, _Elem, _Tr>::
__cm_(0),
__owns_eb_(false),
__owns_ib_(false),
- __always_noconv_(__cv_ ? __cv_->always_noconv() : false)
-{
- setbuf(0, 4096);
+ __always_noconv_(__cv_ ? __cv_->always_noconv() : false) {
+ setbuf(0, 4096);
}
template <class _Codecvt, class _Elem, class _Tr>
-wbuffer_convert<_Codecvt, _Elem, _Tr>::~wbuffer_convert()
-{
- __close();
- delete __cv_;
- if (__owns_eb_)
- delete [] __extbuf_;
- if (__owns_ib_)
- delete [] __intbuf_;
+wbuffer_convert<_Codecvt, _Elem, _Tr>::~wbuffer_convert() {
+ __close();
+ delete __cv_;
+ if (__owns_eb_)
+ delete[] __extbuf_;
+ if (__owns_ib_)
+ delete[] __intbuf_;
}
template <class _Codecvt, class _Elem, class _Tr>
-typename wbuffer_convert<_Codecvt, _Elem, _Tr>::int_type
-wbuffer_convert<_Codecvt, _Elem, _Tr>::underflow()
-{
-_LIBCPP_SUPPRESS_DEPRECATED_POP
- if (__cv_ == 0 || __bufptr_ == 0)
- return traits_type::eof();
- bool __initial = __read_mode();
- char_type __1buf;
- if (this->gptr() == 0)
- this->setg(&__1buf, &__1buf+1, &__1buf+1);
- const size_t __unget_sz = __initial ? 0 : std::min<size_t>((this->egptr() - this->eback()) / 2, 4);
- int_type __c = traits_type::eof();
- if (this->gptr() == this->egptr())
- {
- std::memmove(this->eback(), this->egptr() - __unget_sz, __unget_sz * sizeof(char_type));
- if (__always_noconv_)
- {
- streamsize __nmemb = static_cast<streamsize>(this->egptr() - this->eback() - __unget_sz);
- __nmemb = __bufptr_->sgetn((char*)this->eback() + __unget_sz, __nmemb);
- if (__nmemb != 0)
- {
- this->setg(this->eback(),
- this->eback() + __unget_sz,
- this->eback() + __unget_sz + __nmemb);
- __c = *this->gptr();
- }
- }
- else
- {
- if (__extbufend_ != __extbufnext_) {
- _LIBCPP_ASSERT_NON_NULL(__extbufnext_ != nullptr, "underflow moving from nullptr");
- _LIBCPP_ASSERT_NON_NULL(__extbuf_ != nullptr, "underflow moving into nullptr");
- std::memmove(__extbuf_, __extbufnext_, __extbufend_ - __extbufnext_);
- }
- __extbufnext_ = __extbuf_ + (__extbufend_ - __extbufnext_);
- __extbufend_ = __extbuf_ + (__extbuf_ == __extbuf_min_ ? sizeof(__extbuf_min_) : __ebs_);
- streamsize __nmemb = std::min(static_cast<streamsize>(this->egptr() - this->eback() - __unget_sz),
- static_cast<streamsize>(__extbufend_ - __extbufnext_));
- codecvt_base::result __r;
- // FIXME: Do we ever need to restore the state here?
- //state_type __svs = __st_;
- streamsize __nr = __bufptr_->sgetn(const_cast<char*>(__extbufnext_), __nmemb);
- if (__nr != 0)
- {
- __extbufend_ = __extbufnext_ + __nr;
- char_type* __inext;
- __r = __cv_->in(__st_, __extbuf_, __extbufend_, __extbufnext_,
- this->eback() + __unget_sz,
- this->egptr(), __inext);
- if (__r == codecvt_base::noconv)
- {
- this->setg((char_type*)__extbuf_, (char_type*)__extbuf_,
- (char_type*) const_cast<char *>(__extbufend_));
- __c = *this->gptr();
- }
- else if (__inext != this->eback() + __unget_sz)
- {
- this->setg(this->eback(), this->eback() + __unget_sz, __inext);
- __c = *this->gptr();
- }
- }
+typename wbuffer_convert<_Codecvt, _Elem, _Tr>::int_type wbuffer_convert<_Codecvt, _Elem, _Tr>::underflow() {
+ _LIBCPP_SUPPRESS_DEPRECATED_POP
+ if (__cv_ == 0 || __bufptr_ == 0)
+ return traits_type::eof();
+ bool __initial = __read_mode();
+ char_type __1buf;
+ if (this->gptr() == 0)
+ this->setg(&__1buf, &__1buf + 1, &__1buf + 1);
+ const size_t __unget_sz = __initial ? 0 : std::min<size_t>((this->egptr() - this->eback()) / 2, 4);
+ int_type __c = traits_type::eof();
+ if (this->gptr() == this->egptr()) {
+ std::memmove(this->eback(), this->egptr() - __unget_sz, __unget_sz * sizeof(char_type));
+ if (__always_noconv_) {
+ streamsize __nmemb = static_cast<streamsize>(this->egptr() - this->eback() - __unget_sz);
+ __nmemb = __bufptr_->sgetn((char*)this->eback() + __unget_sz, __nmemb);
+ if (__nmemb != 0) {
+ this->setg(this->eback(), this->eback() + __unget_sz, this->eback() + __unget_sz + __nmemb);
+ __c = *this->gptr();
+ }
+ } else {
+ if (__extbufend_ != __extbufnext_) {
+ _LIBCPP_ASSERT_NON_NULL(__extbufnext_ != nullptr, "underflow moving from nullptr");
+ _LIBCPP_ASSERT_NON_NULL(__extbuf_ != nullptr, "underflow moving into nullptr");
+ std::memmove(__extbuf_, __extbufnext_, __extbufend_ - __extbufnext_);
+ }
+ __extbufnext_ = __extbuf_ + (__extbufend_ - __extbufnext_);
+ __extbufend_ = __extbuf_ + (__extbuf_ == __extbuf_min_ ? sizeof(__extbuf_min_) : __ebs_);
+ streamsize __nmemb = std::min(static_cast<streamsize>(this->egptr() - this->eback() - __unget_sz),
+ static_cast<streamsize>(__extbufend_ - __extbufnext_));
+ codecvt_base::result __r;
+ // FIXME: Do we ever need to restore the state here?
+ // state_type __svs = __st_;
+ streamsize __nr = __bufptr_->sgetn(const_cast<char*>(__extbufnext_), __nmemb);
+ if (__nr != 0) {
+ __extbufend_ = __extbufnext_ + __nr;
+ char_type* __inext;
+ __r = __cv_->in(
+ __st_, __extbuf_, __extbufend_, __extbufnext_, this->eback() + __unget_sz, this->egptr(), __inext);
+ if (__r == codecvt_base::noconv) {
+ this->setg((char_type*)__extbuf_, (char_type*)__extbuf_, (char_type*)const_cast<char*>(__extbufend_));
+ __c = *this->gptr();
+ } else if (__inext != this->eback() + __unget_sz) {
+ this->setg(this->eback(), this->eback() + __unget_sz, __inext);
+ __c = *this->gptr();
}
+ }
}
- else
- __c = *this->gptr();
- if (this->eback() == &__1buf)
- this->setg(0, 0, 0);
- return __c;
+ } else
+ __c = *this->gptr();
+ if (this->eback() == &__1buf)
+ this->setg(0, 0, 0);
+ return __c;
}
_LIBCPP_SUPPRESS_DEPRECATED_PUSH
template <class _Codecvt, class _Elem, class _Tr>
typename wbuffer_convert<_Codecvt, _Elem, _Tr>::int_type
-wbuffer_convert<_Codecvt, _Elem, _Tr>::pbackfail(int_type __c)
-{
-_LIBCPP_SUPPRESS_DEPRECATED_POP
- if (__cv_ != 0 && __bufptr_ != 0 && this->eback() < this->gptr())
- {
- if (traits_type::eq_int_type(__c, traits_type::eof()))
- {
- this->gbump(-1);
- return traits_type::not_eof(__c);
- }
- if (traits_type::eq(traits_type::to_char_type(__c), this->gptr()[-1]))
- {
- this->gbump(-1);
- *this->gptr() = traits_type::to_char_type(__c);
- return __c;
- }
+wbuffer_convert<_Codecvt, _Elem, _Tr>::pbackfail(int_type __c) {
+ _LIBCPP_SUPPRESS_DEPRECATED_POP
+ if (__cv_ != 0 && __bufptr_ != 0 && this->eback() < this->gptr()) {
+ if (traits_type::eq_int_type(__c, traits_type::eof())) {
+ this->gbump(-1);
+ return traits_type::not_eof(__c);
}
- return traits_type::eof();
+ if (traits_type::eq(traits_type::to_char_type(__c), this->gptr()[-1])) {
+ this->gbump(-1);
+ *this->gptr() = traits_type::to_char_type(__c);
+ return __c;
+ }
+ }
+ return traits_type::eof();
}
_LIBCPP_SUPPRESS_DEPRECATED_PUSH
template <class _Codecvt, class _Elem, class _Tr>
-typename wbuffer_convert<_Codecvt, _Elem, _Tr>::int_type
-wbuffer_convert<_Codecvt, _Elem, _Tr>::overflow(int_type __c)
-{
-_LIBCPP_SUPPRESS_DEPRECATED_POP
- if (__cv_ == 0 || __bufptr_ == 0)
+typename wbuffer_convert<_Codecvt, _Elem, _Tr>::int_type wbuffer_convert<_Codecvt, _Elem, _Tr>::overflow(int_type __c) {
+ _LIBCPP_SUPPRESS_DEPRECATED_POP
+ if (__cv_ == 0 || __bufptr_ == 0)
+ return traits_type::eof();
+ __write_mode();
+ char_type __1buf;
+ char_type* __pb_save = this->pbase();
+ char_type* __epb_save = this->epptr();
+ if (!traits_type::eq_int_type(__c, traits_type::eof())) {
+ if (this->pptr() == 0)
+ this->setp(&__1buf, &__1buf + 1);
+ *this->pptr() = traits_type::to_char_type(__c);
+ this->pbump(1);
+ }
+ if (this->pptr() != this->pbase()) {
+ if (__always_noconv_) {
+ streamsize __nmemb = static_cast<streamsize>(this->pptr() - this->pbase());
+ if (__bufptr_->sputn((const char*)this->pbase(), __nmemb) != __nmemb)
return traits_type::eof();
- __write_mode();
- char_type __1buf;
- char_type* __pb_save = this->pbase();
- char_type* __epb_save = this->epptr();
- if (!traits_type::eq_int_type(__c, traits_type::eof()))
- {
- if (this->pptr() == 0)
- this->setp(&__1buf, &__1buf+1);
- *this->pptr() = traits_type::to_char_type(__c);
- this->pbump(1);
- }
- if (this->pptr() != this->pbase())
- {
- if (__always_noconv_)
- {
- streamsize __nmemb = static_cast<streamsize>(this->pptr() - this->pbase());
- if (__bufptr_->sputn((const char*)this->pbase(), __nmemb) != __nmemb)
- return traits_type::eof();
- }
- else
- {
- char* __extbe = __extbuf_;
- codecvt_base::result __r;
- do
- {
- const char_type* __e;
- __r = __cv_->out(__st_, this->pbase(), this->pptr(), __e,
- __extbuf_, __extbuf_ + __ebs_, __extbe);
- if (__e == this->pbase())
- return traits_type::eof();
- if (__r == codecvt_base::noconv)
- {
- streamsize __nmemb = static_cast<size_t>(this->pptr() - this->pbase());
- if (__bufptr_->sputn((const char*)this->pbase(), __nmemb) != __nmemb)
- return traits_type::eof();
- }
- else if (__r == codecvt_base::ok || __r == codecvt_base::partial)
- {
- streamsize __nmemb = static_cast<size_t>(__extbe - __extbuf_);
- if (__bufptr_->sputn(__extbuf_, __nmemb) != __nmemb)
- return traits_type::eof();
- if (__r == codecvt_base::partial)
- {
- this->setp(const_cast<char_type *>(__e), this->pptr());
- this->__pbump(this->epptr() - this->pbase());
- }
- }
- else
- return traits_type::eof();
- } while (__r == codecvt_base::partial);
- }
- this->setp(__pb_save, __epb_save);
- }
- return traits_type::not_eof(__c);
+ } else {
+ char* __extbe = __extbuf_;
+ codecvt_base::result __r;
+ do {
+ const char_type* __e;
+ __r = __cv_->out(__st_, this->pbase(), this->pptr(), __e, __extbuf_, __extbuf_ + __ebs_, __extbe);
+ if (__e == this->pbase())
+ return traits_type::eof();
+ if (__r == codecvt_base::noconv) {
+ streamsize __nmemb = static_cast<size_t>(this->pptr() - this->pbase());
+ if (__bufptr_->sputn((const char*)this->pbase(), __nmemb) != __nmemb)
+ return traits_type::eof();
+ } else if (__r == codecvt_base::ok || __r == codecvt_base::partial) {
+ streamsize __nmemb = static_cast<size_t>(__extbe - __extbuf_);
+ if (__bufptr_->sputn(__extbuf_, __nmemb) != __nmemb)
+ return traits_type::eof();
+ if (__r == codecvt_base::partial) {
+ this->setp(const_cast<char_type*>(__e), this->pptr());
+ this->__pbump(this->epptr() - this->pbase());
+ }
+ } else
+ return traits_type::eof();
+ } while (__r == codecvt_base::partial);
+ }
+ this->setp(__pb_save, __epb_save);
+ }
+ return traits_type::not_eof(__c);
}
_LIBCPP_SUPPRESS_DEPRECATED_PUSH
template <class _Codecvt, class _Elem, class _Tr>
-basic_streambuf<_Elem, _Tr>*
-wbuffer_convert<_Codecvt, _Elem, _Tr>::setbuf(char_type* __s, streamsize __n)
-{
-_LIBCPP_SUPPRESS_DEPRECATED_POP
- this->setg(0, 0, 0);
- this->setp(0, 0);
- if (__owns_eb_)
- delete [] __extbuf_;
- if (__owns_ib_)
- delete [] __intbuf_;
- __ebs_ = __n;
- if (__ebs_ > sizeof(__extbuf_min_))
- {
- if (__always_noconv_ && __s)
- {
- __extbuf_ = (char*)__s;
- __owns_eb_ = false;
- }
- else
- {
- __extbuf_ = new char[__ebs_];
- __owns_eb_ = true;
- }
- }
- else
- {
- __extbuf_ = __extbuf_min_;
- __ebs_ = sizeof(__extbuf_min_);
- __owns_eb_ = false;
- }
- if (!__always_noconv_)
- {
- __ibs_ = max<streamsize>(__n, sizeof(__extbuf_min_));
- if (__s && __ibs_ >= sizeof(__extbuf_min_))
- {
- __intbuf_ = __s;
- __owns_ib_ = false;
- }
- else
- {
- __intbuf_ = new char_type[__ibs_];
- __owns_ib_ = true;
- }
- }
- else
- {
- __ibs_ = 0;
- __intbuf_ = 0;
- __owns_ib_ = false;
- }
- return this;
+basic_streambuf<_Elem, _Tr>* wbuffer_convert<_Codecvt, _Elem, _Tr>::setbuf(char_type* __s, streamsize __n) {
+ _LIBCPP_SUPPRESS_DEPRECATED_POP
+ this->setg(0, 0, 0);
+ this->setp(0, 0);
+ if (__owns_eb_)
+ delete[] __extbuf_;
+ if (__owns_ib_)
+ delete[] __intbuf_;
+ __ebs_ = __n;
+ if (__ebs_ > sizeof(__extbuf_min_)) {
+ if (__always_noconv_ && __s) {
+ __extbuf_ = (char*)__s;
+ __owns_eb_ = false;
+ } else {
+ __extbuf_ = new char[__ebs_];
+ __owns_eb_ = true;
+ }
+ } else {
+ __extbuf_ = __extbuf_min_;
+ __ebs_ = sizeof(__extbuf_min_);
+ __owns_eb_ = false;
+ }
+ if (!__always_noconv_) {
+ __ibs_ = max<streamsize>(__n, sizeof(__extbuf_min_));
+ if (__s && __ibs_ >= sizeof(__extbuf_min_)) {
+ __intbuf_ = __s;
+ __owns_ib_ = false;
+ } else {
+ __intbuf_ = new char_type[__ibs_];
+ __owns_ib_ = true;
+ }
+ } else {
+ __ibs_ = 0;
+ __intbuf_ = 0;
+ __owns_ib_ = false;
+ }
+ return this;
}
_LIBCPP_SUPPRESS_DEPRECATED_PUSH
template <class _Codecvt, class _Elem, class _Tr>
typename wbuffer_convert<_Codecvt, _Elem, _Tr>::pos_type
-wbuffer_convert<_Codecvt, _Elem, _Tr>::seekoff(off_type __off, ios_base::seekdir __way,
- ios_base::openmode __om)
-{
- int __width = __cv_->encoding();
- if (__cv_ == 0 || __bufptr_ == 0 || (__width <= 0 && __off != 0) || sync())
- return pos_type(off_type(-1));
- // __width > 0 || __off == 0, now check __way
- if (__way != ios_base::beg && __way != ios_base::cur && __way != ios_base::end)
- return pos_type(off_type(-1));
- pos_type __r = __bufptr_->pubseekoff(__width * __off, __way, __om);
- __r.state(__st_);
- return __r;
+wbuffer_convert<_Codecvt, _Elem, _Tr>::seekoff(off_type __off, ios_base::seekdir __way, ios_base::openmode __om) {
+ int __width = __cv_->encoding();
+ if (__cv_ == 0 || __bufptr_ == 0 || (__width <= 0 && __off != 0) || sync())
+ return pos_type(off_type(-1));
+ // __width > 0 || __off == 0, now check __way
+ if (__way != ios_base::beg && __way != ios_base::cur && __way != ios_base::end)
+ return pos_type(off_type(-1));
+ pos_type __r = __bufptr_->pubseekoff(__width * __off, __way, __om);
+ __r.state(__st_);
+ return __r;
}
template <class _Codecvt, class _Elem, class _Tr>
typename wbuffer_convert<_Codecvt, _Elem, _Tr>::pos_type
-wbuffer_convert<_Codecvt, _Elem, _Tr>::seekpos(pos_type __sp, ios_base::openmode __wch)
-{
- if (__cv_ == 0 || __bufptr_ == 0 || sync())
- return pos_type(off_type(-1));
- if (__bufptr_->pubseekpos(__sp, __wch) == pos_type(off_type(-1)))
- return pos_type(off_type(-1));
- return __sp;
+wbuffer_convert<_Codecvt, _Elem, _Tr>::seekpos(pos_type __sp, ios_base::openmode __wch) {
+ if (__cv_ == 0 || __bufptr_ == 0 || sync())
+ return pos_type(off_type(-1));
+ if (__bufptr_->pubseekpos(__sp, __wch) == pos_type(off_type(-1)))
+ return pos_type(off_type(-1));
+ return __sp;
}
template <class _Codecvt, class _Elem, class _Tr>
-int
-wbuffer_convert<_Codecvt, _Elem, _Tr>::sync()
-{
-_LIBCPP_SUPPRESS_DEPRECATED_POP
- if (__cv_ == 0 || __bufptr_ == 0)
- return 0;
- if (__cm_ & ios_base::out)
- {
- if (this->pptr() != this->pbase())
- if (overflow() == traits_type::eof())
- return -1;
- codecvt_base::result __r;
- do
- {
- char* __extbe;
- __r = __cv_->unshift(__st_, __extbuf_, __extbuf_ + __ebs_, __extbe);
- streamsize __nmemb = static_cast<streamsize>(__extbe - __extbuf_);
- if (__bufptr_->sputn(__extbuf_, __nmemb) != __nmemb)
- return -1;
- } while (__r == codecvt_base::partial);
- if (__r == codecvt_base::error)
- return -1;
- if (__bufptr_->pubsync())
- return -1;
- }
- else if (__cm_ & ios_base::in)
- {
- off_type __c;
- if (__always_noconv_)
- __c = this->egptr() - this->gptr();
- else
- {
- int __width = __cv_->encoding();
- __c = __extbufend_ - __extbufnext_;
- if (__width > 0)
- __c += __width * (this->egptr() - this->gptr());
- else
- {
- if (this->gptr() != this->egptr())
- {
- std::reverse(this->gptr(), this->egptr());
- codecvt_base::result __r;
- const char_type* __e = this->gptr();
- char* __extbe;
- do
- {
- __r = __cv_->out(__st_, __e, this->egptr(), __e,
- __extbuf_, __extbuf_ + __ebs_, __extbe);
- switch (__r)
- {
- case codecvt_base::noconv:
- __c += this->egptr() - this->gptr();
- break;
- case codecvt_base::ok:
- case codecvt_base::partial:
- __c += __extbe - __extbuf_;
- break;
- default:
- return -1;
- }
- } while (__r == codecvt_base::partial);
- }
+int wbuffer_convert<_Codecvt, _Elem, _Tr>::sync() {
+ _LIBCPP_SUPPRESS_DEPRECATED_POP
+ if (__cv_ == 0 || __bufptr_ == 0)
+ return 0;
+ if (__cm_ & ios_base::out) {
+ if (this->pptr() != this->pbase())
+ if (overflow() == traits_type::eof())
+ return -1;
+ codecvt_base::result __r;
+ do {
+ char* __extbe;
+ __r = __cv_->unshift(__st_, __extbuf_, __extbuf_ + __ebs_, __extbe);
+ streamsize __nmemb = static_cast<streamsize>(__extbe - __extbuf_);
+ if (__bufptr_->sputn(__extbuf_, __nmemb) != __nmemb)
+ return -1;
+ } while (__r == codecvt_base::partial);
+ if (__r == codecvt_base::error)
+ return -1;
+ if (__bufptr_->pubsync())
+ return -1;
+ } else if (__cm_ & ios_base::in) {
+ off_type __c;
+ if (__always_noconv_)
+ __c = this->egptr() - this->gptr();
+ else {
+ int __width = __cv_->encoding();
+ __c = __extbufend_ - __extbufnext_;
+ if (__width > 0)
+ __c += __width * (this->egptr() - this->gptr());
+ else {
+ if (this->gptr() != this->egptr()) {
+ std::reverse(this->gptr(), this->egptr());
+ codecvt_base::result __r;
+ const char_type* __e = this->gptr();
+ char* __extbe;
+ do {
+ __r = __cv_->out(__st_, __e, this->egptr(), __e, __extbuf_, __extbuf_ + __ebs_, __extbe);
+ switch (__r) {
+ case codecvt_base::noconv:
+ __c += this->egptr() - this->gptr();
+ break;
+ case codecvt_base::ok:
+ case codecvt_base::partial:
+ __c += __extbe - __extbuf_;
+ break;
+ default:
+ return -1;
}
+ } while (__r == codecvt_base::partial);
}
- if (__bufptr_->pubseekoff(-__c, ios_base::cur, __cm_) == pos_type(off_type(-1)))
- return -1;
- this->setg(0, 0, 0);
- __cm_ = 0;
+ }
}
- return 0;
+ if (__bufptr_->pubseekoff(-__c, ios_base::cur, __cm_) == pos_type(off_type(-1)))
+ return -1;
+ this->setg(0, 0, 0);
+ __cm_ = 0;
+ }
+ return 0;
}
_LIBCPP_SUPPRESS_DEPRECATED_PUSH
template <class _Codecvt, class _Elem, class _Tr>
-bool
-wbuffer_convert<_Codecvt, _Elem, _Tr>::__read_mode()
-{
- if (!(__cm_ & ios_base::in))
- {
- this->setp(0, 0);
- if (__always_noconv_)
- this->setg((char_type*)__extbuf_,
- (char_type*)__extbuf_ + __ebs_,
- (char_type*)__extbuf_ + __ebs_);
- else
- this->setg(__intbuf_, __intbuf_ + __ibs_, __intbuf_ + __ibs_);
- __cm_ = ios_base::in;
- return true;
- }
- return false;
+bool wbuffer_convert<_Codecvt, _Elem, _Tr>::__read_mode() {
+ if (!(__cm_ & ios_base::in)) {
+ this->setp(0, 0);
+ if (__always_noconv_)
+ this->setg((char_type*)__extbuf_, (char_type*)__extbuf_ + __ebs_, (char_type*)__extbuf_ + __ebs_);
+ else
+ this->setg(__intbuf_, __intbuf_ + __ibs_, __intbuf_ + __ibs_);
+ __cm_ = ios_base::in;
+ return true;
+ }
+ return false;
}
template <class _Codecvt, class _Elem, class _Tr>
-void
-wbuffer_convert<_Codecvt, _Elem, _Tr>::__write_mode()
-{
- if (!(__cm_ & ios_base::out))
- {
- this->setg(0, 0, 0);
- if (__ebs_ > sizeof(__extbuf_min_))
- {
- if (__always_noconv_)
- this->setp((char_type*)__extbuf_,
- (char_type*)__extbuf_ + (__ebs_ - 1));
- else
- this->setp(__intbuf_, __intbuf_ + (__ibs_ - 1));
- }
- else
- this->setp(0, 0);
- __cm_ = ios_base::out;
- }
+void wbuffer_convert<_Codecvt, _Elem, _Tr>::__write_mode() {
+ if (!(__cm_ & ios_base::out)) {
+ this->setg(0, 0, 0);
+ if (__ebs_ > sizeof(__extbuf_min_)) {
+ if (__always_noconv_)
+ this->setp((char_type*)__extbuf_, (char_type*)__extbuf_ + (__ebs_ - 1));
+ else
+ this->setp(__intbuf_, __intbuf_ + (__ibs_ - 1));
+ } else
+ this->setp(0, 0);
+ __cm_ = ios_base::out;
+ }
}
template <class _Codecvt, class _Elem, class _Tr>
-wbuffer_convert<_Codecvt, _Elem, _Tr>*
-wbuffer_convert<_Codecvt, _Elem, _Tr>::__close()
-{
- wbuffer_convert* __rt = nullptr;
- if (__cv_ != nullptr && __bufptr_ != nullptr)
- {
- __rt = this;
- if ((__cm_ & ios_base::out) && sync())
- __rt = nullptr;
- }
- return __rt;
+wbuffer_convert<_Codecvt, _Elem, _Tr>* wbuffer_convert<_Codecvt, _Elem, _Tr>::__close() {
+ wbuffer_convert* __rt = nullptr;
+ if (__cv_ != nullptr && __bufptr_ != nullptr) {
+ __rt = this;
+ if ((__cm_ & ios_base::out) && sync())
+ __rt = nullptr;
+ }
+ return __rt;
}
_LIBCPP_SUPPRESS_DEPRECATED_POP
diff --git a/contrib/llvm-project/libcxx/include/locale.h b/contrib/llvm-project/libcxx/include/locale.h
index 3fb812035a52..20910fa2f97e 100644
--- a/contrib/llvm-project/libcxx/include/locale.h
+++ b/contrib/llvm-project/libcxx/include/locale.h
@@ -36,7 +36,7 @@ Functions:
#include <__config>
#if defined(_LIBCPP_HAS_NO_LOCALIZATION)
-# error "<locale.h> is not supported since libc++ has been configured without support for localization."
+# error "<locale.h> is not supported since libc++ has been configured without support for localization."
#endif
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
diff --git a/contrib/llvm-project/libcxx/include/map b/contrib/llvm-project/libcxx/include/map
index 82a296f9cb8d..f122f2ebb15b 100644
--- a/contrib/llvm-project/libcxx/include/map
+++ b/contrib/llvm-project/libcxx/include/map
@@ -619,266 +619,220 @@ erase_if(multimap<Key, T, Compare, Allocator>& c, Predicate pred); // C++20
_LIBCPP_BEGIN_NAMESPACE_STD
-template <class _Key, class _CP, class _Compare,
+template <class _Key,
+ class _CP,
+ class _Compare,
bool = is_empty<_Compare>::value && !__libcpp_is_final<_Compare>::value>
-class __map_value_compare
- : private _Compare
-{
+class __map_value_compare : private _Compare {
public:
- _LIBCPP_HIDE_FROM_ABI
- __map_value_compare()
- _NOEXCEPT_(is_nothrow_default_constructible<_Compare>::value)
- : _Compare() {}
- _LIBCPP_HIDE_FROM_ABI
- __map_value_compare(_Compare __c)
- _NOEXCEPT_(is_nothrow_copy_constructible<_Compare>::value)
- : _Compare(__c) {}
- _LIBCPP_HIDE_FROM_ABI
- const _Compare& key_comp() const _NOEXCEPT {return *this;}
- _LIBCPP_HIDE_FROM_ABI
- bool operator()(const _CP& __x, const _CP& __y) const
- {return static_cast<const _Compare&>(*this)(__x.__get_value().first, __y.__get_value().first);}
- _LIBCPP_HIDE_FROM_ABI
- bool operator()(const _CP& __x, const _Key& __y) const
- {return static_cast<const _Compare&>(*this)(__x.__get_value().first, __y);}
- _LIBCPP_HIDE_FROM_ABI
- bool operator()(const _Key& __x, const _CP& __y) const
- {return static_cast<const _Compare&>(*this)(__x, __y.__get_value().first);}
- _LIBCPP_HIDE_FROM_ABI void swap(__map_value_compare& __y)
- _NOEXCEPT_(__is_nothrow_swappable<_Compare>::value)
- {
- using std::swap;
- swap(static_cast<_Compare&>(*this), static_cast<_Compare&>(__y));
- }
+ _LIBCPP_HIDE_FROM_ABI __map_value_compare() _NOEXCEPT_(is_nothrow_default_constructible<_Compare>::value)
+ : _Compare() {}
+ _LIBCPP_HIDE_FROM_ABI __map_value_compare(_Compare __c) _NOEXCEPT_(is_nothrow_copy_constructible<_Compare>::value)
+ : _Compare(__c) {}
+ _LIBCPP_HIDE_FROM_ABI const _Compare& key_comp() const _NOEXCEPT { return *this; }
+ _LIBCPP_HIDE_FROM_ABI bool operator()(const _CP& __x, const _CP& __y) const {
+ return static_cast<const _Compare&>(*this)(__x.__get_value().first, __y.__get_value().first);
+ }
+ _LIBCPP_HIDE_FROM_ABI bool operator()(const _CP& __x, const _Key& __y) const {
+ return static_cast<const _Compare&>(*this)(__x.__get_value().first, __y);
+ }
+ _LIBCPP_HIDE_FROM_ABI bool operator()(const _Key& __x, const _CP& __y) const {
+ return static_cast<const _Compare&>(*this)(__x, __y.__get_value().first);
+ }
+ _LIBCPP_HIDE_FROM_ABI void swap(__map_value_compare& __y) _NOEXCEPT_(__is_nothrow_swappable<_Compare>::value) {
+ using std::swap;
+ swap(static_cast<_Compare&>(*this), static_cast<_Compare&>(__y));
+ }
#if _LIBCPP_STD_VER >= 14
- template <typename _K2>
- _LIBCPP_HIDE_FROM_ABI
- bool operator()(const _K2& __x, const _CP& __y) const
- {return static_cast<const _Compare&>(*this)(__x, __y.__get_value().first);}
-
- template <typename _K2>
- _LIBCPP_HIDE_FROM_ABI
- bool operator()(const _CP& __x, const _K2& __y) const
- {return static_cast<const _Compare&>(*this)(__x.__get_value().first, __y);}
+ template <typename _K2>
+ _LIBCPP_HIDE_FROM_ABI bool operator()(const _K2& __x, const _CP& __y) const {
+ return static_cast<const _Compare&>(*this)(__x, __y.__get_value().first);
+ }
+
+ template <typename _K2>
+ _LIBCPP_HIDE_FROM_ABI bool operator()(const _CP& __x, const _K2& __y) const {
+ return static_cast<const _Compare&>(*this)(__x.__get_value().first, __y);
+ }
#endif
};
template <class _Key, class _CP, class _Compare>
-class __map_value_compare<_Key, _CP, _Compare, false>
-{
- _Compare __comp_;
+class __map_value_compare<_Key, _CP, _Compare, false> {
+ _Compare __comp_;
public:
- _LIBCPP_HIDE_FROM_ABI
- __map_value_compare()
- _NOEXCEPT_(is_nothrow_default_constructible<_Compare>::value)
- : __comp_() {}
- _LIBCPP_HIDE_FROM_ABI
- __map_value_compare(_Compare __c)
- _NOEXCEPT_(is_nothrow_copy_constructible<_Compare>::value)
- : __comp_(__c) {}
- _LIBCPP_HIDE_FROM_ABI
- const _Compare& key_comp() const _NOEXCEPT {return __comp_;}
-
- _LIBCPP_HIDE_FROM_ABI
- bool operator()(const _CP& __x, const _CP& __y) const
- {return __comp_(__x.__get_value().first, __y.__get_value().first);}
- _LIBCPP_HIDE_FROM_ABI
- bool operator()(const _CP& __x, const _Key& __y) const
- {return __comp_(__x.__get_value().first, __y);}
- _LIBCPP_HIDE_FROM_ABI
- bool operator()(const _Key& __x, const _CP& __y) const
- {return __comp_(__x, __y.__get_value().first);}
- void swap(__map_value_compare& __y)
- _NOEXCEPT_(__is_nothrow_swappable<_Compare>::value)
- {
- using std::swap;
- swap(__comp_, __y.__comp_);
- }
+ _LIBCPP_HIDE_FROM_ABI __map_value_compare() _NOEXCEPT_(is_nothrow_default_constructible<_Compare>::value)
+ : __comp_() {}
+ _LIBCPP_HIDE_FROM_ABI __map_value_compare(_Compare __c) _NOEXCEPT_(is_nothrow_copy_constructible<_Compare>::value)
+ : __comp_(__c) {}
+ _LIBCPP_HIDE_FROM_ABI const _Compare& key_comp() const _NOEXCEPT { return __comp_; }
+
+ _LIBCPP_HIDE_FROM_ABI bool operator()(const _CP& __x, const _CP& __y) const {
+ return __comp_(__x.__get_value().first, __y.__get_value().first);
+ }
+ _LIBCPP_HIDE_FROM_ABI bool operator()(const _CP& __x, const _Key& __y) const {
+ return __comp_(__x.__get_value().first, __y);
+ }
+ _LIBCPP_HIDE_FROM_ABI bool operator()(const _Key& __x, const _CP& __y) const {
+ return __comp_(__x, __y.__get_value().first);
+ }
+ void swap(__map_value_compare& __y) _NOEXCEPT_(__is_nothrow_swappable<_Compare>::value) {
+ using std::swap;
+ swap(__comp_, __y.__comp_);
+ }
#if _LIBCPP_STD_VER >= 14
- template <typename _K2>
- _LIBCPP_HIDE_FROM_ABI
- bool operator()(const _K2& __x, const _CP& __y) const
- {return __comp_(__x, __y.__get_value().first);}
-
- template <typename _K2>
- _LIBCPP_HIDE_FROM_ABI
- bool operator()(const _CP& __x, const _K2& __y) const
- {return __comp_(__x.__get_value().first, __y);}
+ template <typename _K2>
+ _LIBCPP_HIDE_FROM_ABI bool operator()(const _K2& __x, const _CP& __y) const {
+ return __comp_(__x, __y.__get_value().first);
+ }
+
+ template <typename _K2>
+ _LIBCPP_HIDE_FROM_ABI bool operator()(const _CP& __x, const _K2& __y) const {
+ return __comp_(__x.__get_value().first, __y);
+ }
#endif
};
template <class _Key, class _CP, class _Compare, bool __b>
-inline _LIBCPP_HIDE_FROM_ABI
-void
-swap(__map_value_compare<_Key, _CP, _Compare, __b>& __x,
- __map_value_compare<_Key, _CP, _Compare, __b>& __y)
- _NOEXCEPT_(_NOEXCEPT_(__x.swap(__y)))
-{
- __x.swap(__y);
+inline _LIBCPP_HIDE_FROM_ABI void
+swap(__map_value_compare<_Key, _CP, _Compare, __b>& __x, __map_value_compare<_Key, _CP, _Compare, __b>& __y)
+ _NOEXCEPT_(_NOEXCEPT_(__x.swap(__y))) {
+ __x.swap(__y);
}
template <class _Allocator>
-class __map_node_destructor
-{
- typedef _Allocator allocator_type;
- typedef allocator_traits<allocator_type> __alloc_traits;
+class __map_node_destructor {
+ typedef _Allocator allocator_type;
+ typedef allocator_traits<allocator_type> __alloc_traits;
public:
- typedef typename __alloc_traits::pointer pointer;
+ typedef typename __alloc_traits::pointer pointer;
private:
- allocator_type& __na_;
+ allocator_type& __na_;
- __map_node_destructor& operator=(const __map_node_destructor&);
+ __map_node_destructor& operator=(const __map_node_destructor&);
public:
- bool __first_constructed;
- bool __second_constructed;
+ bool __first_constructed;
+ bool __second_constructed;
- _LIBCPP_HIDE_FROM_ABI
- explicit __map_node_destructor(allocator_type& __na) _NOEXCEPT
- : __na_(__na),
- __first_constructed(false),
- __second_constructed(false)
- {}
+ _LIBCPP_HIDE_FROM_ABI explicit __map_node_destructor(allocator_type& __na) _NOEXCEPT
+ : __na_(__na),
+ __first_constructed(false),
+ __second_constructed(false) {}
#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI
- __map_node_destructor(__tree_node_destructor<allocator_type>&& __x) _NOEXCEPT
- : __na_(__x.__na_),
- __first_constructed(__x.__value_constructed),
- __second_constructed(__x.__value_constructed)
- {
- __x.__value_constructed = false;
- }
+ _LIBCPP_HIDE_FROM_ABI __map_node_destructor(__tree_node_destructor<allocator_type>&& __x) _NOEXCEPT
+ : __na_(__x.__na_),
+ __first_constructed(__x.__value_constructed),
+ __second_constructed(__x.__value_constructed) {
+ __x.__value_constructed = false;
+ }
#endif // _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI
- void operator()(pointer __p) _NOEXCEPT
- {
- if (__second_constructed)
- __alloc_traits::destroy(__na_, std::addressof(__p->__value_.__get_value().second));
- if (__first_constructed)
- __alloc_traits::destroy(__na_, std::addressof(__p->__value_.__get_value().first));
- if (__p)
- __alloc_traits::deallocate(__na_, __p, 1);
- }
+ _LIBCPP_HIDE_FROM_ABI void operator()(pointer __p) _NOEXCEPT {
+ if (__second_constructed)
+ __alloc_traits::destroy(__na_, std::addressof(__p->__value_.__get_value().second));
+ if (__first_constructed)
+ __alloc_traits::destroy(__na_, std::addressof(__p->__value_.__get_value().first));
+ if (__p)
+ __alloc_traits::deallocate(__na_, __p, 1);
+ }
};
template <class _Key, class _Tp, class _Compare, class _Allocator>
- class map;
+class map;
template <class _Key, class _Tp, class _Compare, class _Allocator>
- class multimap;
-template <class _TreeIterator> class __map_const_iterator;
+class multimap;
+template <class _TreeIterator>
+class __map_const_iterator;
#ifndef _LIBCPP_CXX03_LANG
template <class _Key, class _Tp>
-struct _LIBCPP_STANDALONE_DEBUG __value_type
-{
- typedef _Key key_type;
- typedef _Tp mapped_type;
- typedef pair<const key_type, mapped_type> value_type;
- typedef pair<key_type&, mapped_type&> __nc_ref_pair_type;
- typedef pair<key_type&&, mapped_type&&> __nc_rref_pair_type;
+struct _LIBCPP_STANDALONE_DEBUG __value_type {
+ typedef _Key key_type;
+ typedef _Tp mapped_type;
+ typedef pair<const key_type, mapped_type> value_type;
+ typedef pair<key_type&, mapped_type&> __nc_ref_pair_type;
+ typedef pair<key_type&&, mapped_type&&> __nc_rref_pair_type;
private:
- value_type __cc_;
+ value_type __cc_;
public:
- _LIBCPP_HIDE_FROM_ABI
- value_type& __get_value()
- {
-#if _LIBCPP_STD_VER >= 17
- return *std::launder(std::addressof(__cc_));
-#else
- return __cc_;
-#endif
- }
-
- _LIBCPP_HIDE_FROM_ABI
- const value_type& __get_value() const
- {
-#if _LIBCPP_STD_VER >= 17
- return *std::launder(std::addressof(__cc_));
-#else
- return __cc_;
-#endif
- }
-
- _LIBCPP_HIDE_FROM_ABI
- __nc_ref_pair_type __ref()
- {
- value_type& __v = __get_value();
- return __nc_ref_pair_type(const_cast<key_type&>(__v.first), __v.second);
- }
-
- _LIBCPP_HIDE_FROM_ABI
- __nc_rref_pair_type __move()
- {
- value_type& __v = __get_value();
- return __nc_rref_pair_type(
- std::move(const_cast<key_type&>(__v.first)),
- std::move(__v.second));
- }
-
- _LIBCPP_HIDE_FROM_ABI
- __value_type& operator=(const __value_type& __v)
- {
- __ref() = __v.__get_value();
- return *this;
- }
-
- _LIBCPP_HIDE_FROM_ABI
- __value_type& operator=(__value_type&& __v)
- {
- __ref() = __v.__move();
- return *this;
- }
-
- template <class _ValueTp,
- class = __enable_if_t<__is_same_uncvref<_ValueTp, value_type>::value>
- >
- _LIBCPP_HIDE_FROM_ABI
- __value_type& operator=(_ValueTp&& __v)
- {
- __ref() = std::forward<_ValueTp>(__v);
- return *this;
- }
+ _LIBCPP_HIDE_FROM_ABI value_type& __get_value() {
+# if _LIBCPP_STD_VER >= 17
+ return *std::launder(std::addressof(__cc_));
+# else
+ return __cc_;
+# endif
+ }
+
+ _LIBCPP_HIDE_FROM_ABI const value_type& __get_value() const {
+# if _LIBCPP_STD_VER >= 17
+ return *std::launder(std::addressof(__cc_));
+# else
+ return __cc_;
+# endif
+ }
+
+ _LIBCPP_HIDE_FROM_ABI __nc_ref_pair_type __ref() {
+ value_type& __v = __get_value();
+ return __nc_ref_pair_type(const_cast<key_type&>(__v.first), __v.second);
+ }
+
+ _LIBCPP_HIDE_FROM_ABI __nc_rref_pair_type __move() {
+ value_type& __v = __get_value();
+ return __nc_rref_pair_type(std::move(const_cast<key_type&>(__v.first)), std::move(__v.second));
+ }
+
+ _LIBCPP_HIDE_FROM_ABI __value_type& operator=(const __value_type& __v) {
+ __ref() = __v.__get_value();
+ return *this;
+ }
+
+ _LIBCPP_HIDE_FROM_ABI __value_type& operator=(__value_type&& __v) {
+ __ref() = __v.__move();
+ return *this;
+ }
+
+ template <class _ValueTp, class = __enable_if_t<__is_same_uncvref<_ValueTp, value_type>::value> >
+ _LIBCPP_HIDE_FROM_ABI __value_type& operator=(_ValueTp&& __v) {
+ __ref() = std::forward<_ValueTp>(__v);
+ return *this;
+ }
private:
- __value_type() = delete;
- ~__value_type() = delete;
- __value_type(const __value_type&) = delete;
- __value_type(__value_type&&) = delete;
+ __value_type() = delete;
+ ~__value_type() = delete;
+ __value_type(const __value_type&) = delete;
+ __value_type(__value_type&&) = delete;
};
#else
template <class _Key, class _Tp>
-struct __value_type
-{
- typedef _Key key_type;
- typedef _Tp mapped_type;
- typedef pair<const key_type, mapped_type> value_type;
+struct __value_type {
+ typedef _Key key_type;
+ typedef _Tp mapped_type;
+ typedef pair<const key_type, mapped_type> value_type;
private:
- value_type __cc_;
+ value_type __cc_;
public:
- _LIBCPP_HIDE_FROM_ABI
- value_type& __get_value() { return __cc_; }
- _LIBCPP_HIDE_FROM_ABI
- const value_type& __get_value() const { return __cc_; }
+ _LIBCPP_HIDE_FROM_ABI value_type& __get_value() { return __cc_; }
+ _LIBCPP_HIDE_FROM_ABI const value_type& __get_value() const { return __cc_; }
private:
- __value_type();
- __value_type(__value_type const&);
- __value_type& operator=(__value_type const&);
- ~__value_type();
+ __value_type();
+ __value_type(__value_type const&);
+ __value_type& operator=(__value_type const&);
+ ~__value_type();
};
#endif // _LIBCPP_CXX03_LANG
@@ -887,937 +841,778 @@ template <class _Tp>
struct __extract_key_value_types;
template <class _Key, class _Tp>
-struct __extract_key_value_types<__value_type<_Key, _Tp> >
-{
+struct __extract_key_value_types<__value_type<_Key, _Tp> > {
typedef _Key const __key_type;
- typedef _Tp __mapped_type;
+ typedef _Tp __mapped_type;
};
template <class _TreeIterator>
-class _LIBCPP_TEMPLATE_VIS __map_iterator
-{
- typedef typename _TreeIterator::_NodeTypes _NodeTypes;
- typedef typename _TreeIterator::__pointer_traits __pointer_traits;
+class _LIBCPP_TEMPLATE_VIS __map_iterator {
+ typedef typename _TreeIterator::_NodeTypes _NodeTypes;
+ typedef typename _TreeIterator::__pointer_traits __pointer_traits;
- _TreeIterator __i_;
+ _TreeIterator __i_;
public:
- typedef bidirectional_iterator_tag iterator_category;
- typedef typename _NodeTypes::__map_value_type value_type;
- typedef typename _TreeIterator::difference_type difference_type;
- typedef value_type& reference;
- typedef typename _NodeTypes::__map_value_type_pointer pointer;
-
- _LIBCPP_HIDE_FROM_ABI
- __map_iterator() _NOEXCEPT {}
-
- _LIBCPP_HIDE_FROM_ABI
- __map_iterator(_TreeIterator __i) _NOEXCEPT : __i_(__i) {}
-
- _LIBCPP_HIDE_FROM_ABI
- reference operator*() const {return __i_->__get_value();}
- _LIBCPP_HIDE_FROM_ABI
- pointer operator->() const {return pointer_traits<pointer>::pointer_to(__i_->__get_value());}
-
- _LIBCPP_HIDE_FROM_ABI
- __map_iterator& operator++() {++__i_; return *this;}
- _LIBCPP_HIDE_FROM_ABI
- __map_iterator operator++(int)
- {
- __map_iterator __t(*this);
- ++(*this);
- return __t;
- }
-
- _LIBCPP_HIDE_FROM_ABI
- __map_iterator& operator--() {--__i_; return *this;}
- _LIBCPP_HIDE_FROM_ABI
- __map_iterator operator--(int)
- {
- __map_iterator __t(*this);
- --(*this);
- return __t;
- }
-
- friend _LIBCPP_HIDE_FROM_ABI
- bool operator==(const __map_iterator& __x, const __map_iterator& __y)
- {return __x.__i_ == __y.__i_;}
- friend
- _LIBCPP_HIDE_FROM_ABI
- bool operator!=(const __map_iterator& __x, const __map_iterator& __y)
- {return __x.__i_ != __y.__i_;}
-
- template <class, class, class, class> friend class _LIBCPP_TEMPLATE_VIS map;
- template <class, class, class, class> friend class _LIBCPP_TEMPLATE_VIS multimap;
- template <class> friend class _LIBCPP_TEMPLATE_VIS __map_const_iterator;
+ typedef bidirectional_iterator_tag iterator_category;
+ typedef typename _NodeTypes::__map_value_type value_type;
+ typedef typename _TreeIterator::difference_type difference_type;
+ typedef value_type& reference;
+ typedef typename _NodeTypes::__map_value_type_pointer pointer;
+
+ _LIBCPP_HIDE_FROM_ABI __map_iterator() _NOEXCEPT {}
+
+ _LIBCPP_HIDE_FROM_ABI __map_iterator(_TreeIterator __i) _NOEXCEPT : __i_(__i) {}
+
+ _LIBCPP_HIDE_FROM_ABI reference operator*() const { return __i_->__get_value(); }
+ _LIBCPP_HIDE_FROM_ABI pointer operator->() const { return pointer_traits<pointer>::pointer_to(__i_->__get_value()); }
+
+ _LIBCPP_HIDE_FROM_ABI __map_iterator& operator++() {
+ ++__i_;
+ return *this;
+ }
+ _LIBCPP_HIDE_FROM_ABI __map_iterator operator++(int) {
+ __map_iterator __t(*this);
+ ++(*this);
+ return __t;
+ }
+
+ _LIBCPP_HIDE_FROM_ABI __map_iterator& operator--() {
+ --__i_;
+ return *this;
+ }
+ _LIBCPP_HIDE_FROM_ABI __map_iterator operator--(int) {
+ __map_iterator __t(*this);
+ --(*this);
+ return __t;
+ }
+
+ friend _LIBCPP_HIDE_FROM_ABI bool operator==(const __map_iterator& __x, const __map_iterator& __y) {
+ return __x.__i_ == __y.__i_;
+ }
+ friend _LIBCPP_HIDE_FROM_ABI bool operator!=(const __map_iterator& __x, const __map_iterator& __y) {
+ return __x.__i_ != __y.__i_;
+ }
+
+ template <class, class, class, class>
+ friend class _LIBCPP_TEMPLATE_VIS map;
+ template <class, class, class, class>
+ friend class _LIBCPP_TEMPLATE_VIS multimap;
+ template <class>
+ friend class _LIBCPP_TEMPLATE_VIS __map_const_iterator;
};
template <class _TreeIterator>
-class _LIBCPP_TEMPLATE_VIS __map_const_iterator
-{
- typedef typename _TreeIterator::_NodeTypes _NodeTypes;
- typedef typename _TreeIterator::__pointer_traits __pointer_traits;
+class _LIBCPP_TEMPLATE_VIS __map_const_iterator {
+ typedef typename _TreeIterator::_NodeTypes _NodeTypes;
+ typedef typename _TreeIterator::__pointer_traits __pointer_traits;
- _TreeIterator __i_;
+ _TreeIterator __i_;
public:
- typedef bidirectional_iterator_tag iterator_category;
- typedef typename _NodeTypes::__map_value_type value_type;
- typedef typename _TreeIterator::difference_type difference_type;
- typedef const value_type& reference;
- typedef typename _NodeTypes::__const_map_value_type_pointer pointer;
-
- _LIBCPP_HIDE_FROM_ABI
- __map_const_iterator() _NOEXCEPT {}
-
- _LIBCPP_HIDE_FROM_ABI
- __map_const_iterator(_TreeIterator __i) _NOEXCEPT : __i_(__i) {}
- _LIBCPP_HIDE_FROM_ABI
- __map_const_iterator(__map_iterator<
- typename _TreeIterator::__non_const_iterator> __i) _NOEXCEPT
- : __i_(__i.__i_) {}
-
- _LIBCPP_HIDE_FROM_ABI
- reference operator*() const {return __i_->__get_value();}
- _LIBCPP_HIDE_FROM_ABI
- pointer operator->() const {return pointer_traits<pointer>::pointer_to(__i_->__get_value());}
-
- _LIBCPP_HIDE_FROM_ABI
- __map_const_iterator& operator++() {++__i_; return *this;}
- _LIBCPP_HIDE_FROM_ABI
- __map_const_iterator operator++(int)
- {
- __map_const_iterator __t(*this);
- ++(*this);
- return __t;
- }
-
- _LIBCPP_HIDE_FROM_ABI
- __map_const_iterator& operator--() {--__i_; return *this;}
- _LIBCPP_HIDE_FROM_ABI
- __map_const_iterator operator--(int)
- {
- __map_const_iterator __t(*this);
- --(*this);
- return __t;
- }
-
- friend _LIBCPP_HIDE_FROM_ABI
- bool operator==(const __map_const_iterator& __x, const __map_const_iterator& __y)
- {return __x.__i_ == __y.__i_;}
- friend _LIBCPP_HIDE_FROM_ABI
- bool operator!=(const __map_const_iterator& __x, const __map_const_iterator& __y)
- {return __x.__i_ != __y.__i_;}
-
- template <class, class, class, class> friend class _LIBCPP_TEMPLATE_VIS map;
- template <class, class, class, class> friend class _LIBCPP_TEMPLATE_VIS multimap;
- template <class, class, class> friend class _LIBCPP_TEMPLATE_VIS __tree_const_iterator;
+ typedef bidirectional_iterator_tag iterator_category;
+ typedef typename _NodeTypes::__map_value_type value_type;
+ typedef typename _TreeIterator::difference_type difference_type;
+ typedef const value_type& reference;
+ typedef typename _NodeTypes::__const_map_value_type_pointer pointer;
+
+ _LIBCPP_HIDE_FROM_ABI __map_const_iterator() _NOEXCEPT {}
+
+ _LIBCPP_HIDE_FROM_ABI __map_const_iterator(_TreeIterator __i) _NOEXCEPT : __i_(__i) {}
+ _LIBCPP_HIDE_FROM_ABI
+ __map_const_iterator(__map_iterator< typename _TreeIterator::__non_const_iterator> __i) _NOEXCEPT : __i_(__i.__i_) {}
+
+ _LIBCPP_HIDE_FROM_ABI reference operator*() const { return __i_->__get_value(); }
+ _LIBCPP_HIDE_FROM_ABI pointer operator->() const { return pointer_traits<pointer>::pointer_to(__i_->__get_value()); }
+
+ _LIBCPP_HIDE_FROM_ABI __map_const_iterator& operator++() {
+ ++__i_;
+ return *this;
+ }
+ _LIBCPP_HIDE_FROM_ABI __map_const_iterator operator++(int) {
+ __map_const_iterator __t(*this);
+ ++(*this);
+ return __t;
+ }
+
+ _LIBCPP_HIDE_FROM_ABI __map_const_iterator& operator--() {
+ --__i_;
+ return *this;
+ }
+ _LIBCPP_HIDE_FROM_ABI __map_const_iterator operator--(int) {
+ __map_const_iterator __t(*this);
+ --(*this);
+ return __t;
+ }
+
+ friend _LIBCPP_HIDE_FROM_ABI bool operator==(const __map_const_iterator& __x, const __map_const_iterator& __y) {
+ return __x.__i_ == __y.__i_;
+ }
+ friend _LIBCPP_HIDE_FROM_ABI bool operator!=(const __map_const_iterator& __x, const __map_const_iterator& __y) {
+ return __x.__i_ != __y.__i_;
+ }
+
+ template <class, class, class, class>
+ friend class _LIBCPP_TEMPLATE_VIS map;
+ template <class, class, class, class>
+ friend class _LIBCPP_TEMPLATE_VIS multimap;
+ template <class, class, class>
+ friend class _LIBCPP_TEMPLATE_VIS __tree_const_iterator;
};
-template <class _Key, class _Tp, class _Compare = less<_Key>,
- class _Allocator = allocator<pair<const _Key, _Tp> > >
-class _LIBCPP_TEMPLATE_VIS map
-{
+template <class _Key, class _Tp, class _Compare = less<_Key>, class _Allocator = allocator<pair<const _Key, _Tp> > >
+class _LIBCPP_TEMPLATE_VIS map {
public:
- // types:
- typedef _Key key_type;
- typedef _Tp mapped_type;
- typedef pair<const key_type, mapped_type> value_type;
- typedef __type_identity_t<_Compare> key_compare;
- typedef __type_identity_t<_Allocator> allocator_type;
- typedef value_type& reference;
- typedef const value_type& const_reference;
+ // types:
+ typedef _Key key_type;
+ typedef _Tp mapped_type;
+ typedef pair<const key_type, mapped_type> value_type;
+ typedef __type_identity_t<_Compare> key_compare;
+ typedef __type_identity_t<_Allocator> allocator_type;
+ typedef value_type& reference;
+ typedef const value_type& const_reference;
- static_assert((is_same<typename allocator_type::value_type, value_type>::value),
- "Allocator::value_type must be same type as value_type");
+ static_assert((is_same<typename allocator_type::value_type, value_type>::value),
+ "Allocator::value_type must be same type as value_type");
- class _LIBCPP_TEMPLATE_VIS value_compare
- : public __binary_function<value_type, value_type, bool>
- {
- friend class map;
- protected:
- key_compare comp;
+ class _LIBCPP_TEMPLATE_VIS value_compare : public __binary_function<value_type, value_type, bool> {
+ friend class map;
- _LIBCPP_HIDE_FROM_ABI value_compare(key_compare __c) : comp(__c) {}
- public:
- _LIBCPP_HIDE_FROM_ABI
- bool operator()(const value_type& __x, const value_type& __y) const
- {return comp(__x.first, __y.first);}
- };
+ protected:
+ key_compare comp;
-private:
+ _LIBCPP_HIDE_FROM_ABI value_compare(key_compare __c) : comp(__c) {}
- typedef std::__value_type<key_type, mapped_type> __value_type;
- typedef __map_value_compare<key_type, __value_type, key_compare> __vc;
- typedef __rebind_alloc<allocator_traits<allocator_type>, __value_type> __allocator_type;
- typedef __tree<__value_type, __vc, __allocator_type> __base;
- typedef typename __base::__node_traits __node_traits;
- typedef allocator_traits<allocator_type> __alloc_traits;
+ public:
+ _LIBCPP_HIDE_FROM_ABI bool operator()(const value_type& __x, const value_type& __y) const {
+ return comp(__x.first, __y.first);
+ }
+ };
- static_assert(is_same<allocator_type, __rebind_alloc<__alloc_traits, value_type> >::value,
- "[allocator.requirements] states that rebinding an allocator to the same type should result in the "
- "original allocator");
+private:
+ typedef std::__value_type<key_type, mapped_type> __value_type;
+ typedef __map_value_compare<key_type, __value_type, key_compare> __vc;
+ typedef __rebind_alloc<allocator_traits<allocator_type>, __value_type> __allocator_type;
+ typedef __tree<__value_type, __vc, __allocator_type> __base;
+ typedef typename __base::__node_traits __node_traits;
+ typedef allocator_traits<allocator_type> __alloc_traits;
- __base __tree_;
+ static_assert(is_same<allocator_type, __rebind_alloc<__alloc_traits, value_type> >::value,
+ "[allocator.requirements] states that rebinding an allocator to the same type should result in the "
+ "original allocator");
+
+ __base __tree_;
public:
- typedef typename __alloc_traits::pointer pointer;
- typedef typename __alloc_traits::const_pointer const_pointer;
- typedef typename __alloc_traits::size_type size_type;
- typedef typename __alloc_traits::difference_type difference_type;
- typedef __map_iterator<typename __base::iterator> iterator;
- typedef __map_const_iterator<typename __base::const_iterator> const_iterator;
- typedef std::reverse_iterator<iterator> reverse_iterator;
- typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
+ typedef typename __alloc_traits::pointer pointer;
+ typedef typename __alloc_traits::const_pointer const_pointer;
+ typedef typename __alloc_traits::size_type size_type;
+ typedef typename __alloc_traits::difference_type difference_type;
+ typedef __map_iterator<typename __base::iterator> iterator;
+ typedef __map_const_iterator<typename __base::const_iterator> const_iterator;
+ typedef std::reverse_iterator<iterator> reverse_iterator;
+ typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
#if _LIBCPP_STD_VER >= 17
- typedef __map_node_handle<typename __base::__node, allocator_type> node_type;
- typedef __insert_return_type<iterator, node_type> insert_return_type;
+ typedef __map_node_handle<typename __base::__node, allocator_type> node_type;
+ typedef __insert_return_type<iterator, node_type> insert_return_type;
#endif
- template <class _Key2, class _Value2, class _Comp2, class _Alloc2>
- friend class _LIBCPP_TEMPLATE_VIS map;
- template <class _Key2, class _Value2, class _Comp2, class _Alloc2>
- friend class _LIBCPP_TEMPLATE_VIS multimap;
+ template <class _Key2, class _Value2, class _Comp2, class _Alloc2>
+ friend class _LIBCPP_TEMPLATE_VIS map;
+ template <class _Key2, class _Value2, class _Comp2, class _Alloc2>
+ friend class _LIBCPP_TEMPLATE_VIS multimap;
- _LIBCPP_HIDE_FROM_ABI
- map()
- _NOEXCEPT_(
- is_nothrow_default_constructible<allocator_type>::value &&
- is_nothrow_default_constructible<key_compare>::value &&
- is_nothrow_copy_constructible<key_compare>::value)
- : __tree_(__vc(key_compare())) {}
+ _LIBCPP_HIDE_FROM_ABI map() _NOEXCEPT_(
+ is_nothrow_default_constructible<allocator_type>::value&& is_nothrow_default_constructible<key_compare>::value&&
+ is_nothrow_copy_constructible<key_compare>::value)
+ : __tree_(__vc(key_compare())) {}
- _LIBCPP_HIDE_FROM_ABI
- explicit map(const key_compare& __comp)
- _NOEXCEPT_(
- is_nothrow_default_constructible<allocator_type>::value &&
- is_nothrow_copy_constructible<key_compare>::value)
- : __tree_(__vc(__comp)) {}
-
- _LIBCPP_HIDE_FROM_ABI
- explicit map(const key_compare& __comp, const allocator_type& __a)
- : __tree_(__vc(__comp), typename __base::allocator_type(__a)) {}
-
- template <class _InputIterator>
- _LIBCPP_HIDE_FROM_ABI
- map(_InputIterator __f, _InputIterator __l,
- const key_compare& __comp = key_compare())
- : __tree_(__vc(__comp))
- {
- insert(__f, __l);
- }
-
- template <class _InputIterator>
- _LIBCPP_HIDE_FROM_ABI
- map(_InputIterator __f, _InputIterator __l,
- const key_compare& __comp, const allocator_type& __a)
- : __tree_(__vc(__comp), typename __base::allocator_type(__a))
- {
- insert(__f, __l);
- }
+ _LIBCPP_HIDE_FROM_ABI explicit map(const key_compare& __comp) _NOEXCEPT_(
+ is_nothrow_default_constructible<allocator_type>::value&& is_nothrow_copy_constructible<key_compare>::value)
+ : __tree_(__vc(__comp)) {}
+
+ _LIBCPP_HIDE_FROM_ABI explicit map(const key_compare& __comp, const allocator_type& __a)
+ : __tree_(__vc(__comp), typename __base::allocator_type(__a)) {}
+
+ template <class _InputIterator>
+ _LIBCPP_HIDE_FROM_ABI map(_InputIterator __f, _InputIterator __l, const key_compare& __comp = key_compare())
+ : __tree_(__vc(__comp)) {
+ insert(__f, __l);
+ }
+
+ template <class _InputIterator>
+ _LIBCPP_HIDE_FROM_ABI
+ map(_InputIterator __f, _InputIterator __l, const key_compare& __comp, const allocator_type& __a)
+ : __tree_(__vc(__comp), typename __base::allocator_type(__a)) {
+ insert(__f, __l);
+ }
#if _LIBCPP_STD_VER >= 23
- template <_ContainerCompatibleRange<value_type> _Range>
- _LIBCPP_HIDE_FROM_ABI
- map(from_range_t, _Range&& __range, const key_compare& __comp = key_compare(),
- const allocator_type& __a = allocator_type())
+ template <_ContainerCompatibleRange<value_type> _Range>
+ _LIBCPP_HIDE_FROM_ABI
+ map(from_range_t,
+ _Range&& __range,
+ const key_compare& __comp = key_compare(),
+ const allocator_type& __a = allocator_type())
: __tree_(__vc(__comp), typename __base::allocator_type(__a)) {
- insert_range(std::forward<_Range>(__range));
- }
+ insert_range(std::forward<_Range>(__range));
+ }
#endif
#if _LIBCPP_STD_VER >= 14
- template <class _InputIterator>
- _LIBCPP_HIDE_FROM_ABI
- map(_InputIterator __f, _InputIterator __l, const allocator_type& __a)
- : map(__f, __l, key_compare(), __a) {}
+ template <class _InputIterator>
+ _LIBCPP_HIDE_FROM_ABI map(_InputIterator __f, _InputIterator __l, const allocator_type& __a)
+ : map(__f, __l, key_compare(), __a) {}
#endif
#if _LIBCPP_STD_VER >= 23
- template <_ContainerCompatibleRange<value_type> _Range>
- _LIBCPP_HIDE_FROM_ABI
- map(from_range_t, _Range&& __range, const allocator_type& __a)
+ template <_ContainerCompatibleRange<value_type> _Range>
+ _LIBCPP_HIDE_FROM_ABI map(from_range_t, _Range&& __range, const allocator_type& __a)
: map(from_range, std::forward<_Range>(__range), key_compare(), __a) {}
#endif
- _LIBCPP_HIDE_FROM_ABI
- map(const map& __m)
- : __tree_(__m.__tree_)
- {
- insert(__m.begin(), __m.end());
- }
+ _LIBCPP_HIDE_FROM_ABI map(const map& __m) : __tree_(__m.__tree_) { insert(__m.begin(), __m.end()); }
- _LIBCPP_HIDE_FROM_ABI
- map& operator=(const map& __m)
- {
+ _LIBCPP_HIDE_FROM_ABI map& operator=(const map& __m) {
#ifndef _LIBCPP_CXX03_LANG
- __tree_ = __m.__tree_;
+ __tree_ = __m.__tree_;
#else
- if (this != std::addressof(__m)) {
- __tree_.clear();
- __tree_.value_comp() = __m.__tree_.value_comp();
- __tree_.__copy_assign_alloc(__m.__tree_);
- insert(__m.begin(), __m.end());
- }
+ if (this != std::addressof(__m)) {
+ __tree_.clear();
+ __tree_.value_comp() = __m.__tree_.value_comp();
+ __tree_.__copy_assign_alloc(__m.__tree_);
+ insert(__m.begin(), __m.end());
+ }
#endif
- return *this;
- }
+ return *this;
+ }
#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI
- map(map&& __m)
- _NOEXCEPT_(is_nothrow_move_constructible<__base>::value)
- : __tree_(std::move(__m.__tree_))
- {
- }
-
- _LIBCPP_HIDE_FROM_ABI map(map&& __m, const allocator_type& __a);
-
- _LIBCPP_HIDE_FROM_ABI
- map& operator=(map&& __m)
- _NOEXCEPT_(is_nothrow_move_assignable<__base>::value)
- {
- __tree_ = std::move(__m.__tree_);
- return *this;
- }
-
- _LIBCPP_HIDE_FROM_ABI
- map(initializer_list<value_type> __il, const key_compare& __comp = key_compare())
- : __tree_(__vc(__comp))
- {
- insert(__il.begin(), __il.end());
- }
-
- _LIBCPP_HIDE_FROM_ABI
- map(initializer_list<value_type> __il, const key_compare& __comp, const allocator_type& __a)
- : __tree_(__vc(__comp), typename __base::allocator_type(__a))
- {
- insert(__il.begin(), __il.end());
- }
+ _LIBCPP_HIDE_FROM_ABI map(map&& __m) _NOEXCEPT_(is_nothrow_move_constructible<__base>::value)
+ : __tree_(std::move(__m.__tree_)) {}
-#if _LIBCPP_STD_VER >= 14
- _LIBCPP_HIDE_FROM_ABI
- map(initializer_list<value_type> __il, const allocator_type& __a)
- : map(__il, key_compare(), __a) {}
-#endif
+ _LIBCPP_HIDE_FROM_ABI map(map&& __m, const allocator_type& __a);
+
+ _LIBCPP_HIDE_FROM_ABI map& operator=(map&& __m) _NOEXCEPT_(is_nothrow_move_assignable<__base>::value) {
+ __tree_ = std::move(__m.__tree_);
+ return *this;
+ }
+
+ _LIBCPP_HIDE_FROM_ABI map(initializer_list<value_type> __il, const key_compare& __comp = key_compare())
+ : __tree_(__vc(__comp)) {
+ insert(__il.begin(), __il.end());
+ }
+
+ _LIBCPP_HIDE_FROM_ABI map(initializer_list<value_type> __il, const key_compare& __comp, const allocator_type& __a)
+ : __tree_(__vc(__comp), typename __base::allocator_type(__a)) {
+ insert(__il.begin(), __il.end());
+ }
+
+# if _LIBCPP_STD_VER >= 14
+ _LIBCPP_HIDE_FROM_ABI map(initializer_list<value_type> __il, const allocator_type& __a)
+ : map(__il, key_compare(), __a) {}
+# endif
- _LIBCPP_HIDE_FROM_ABI
- map& operator=(initializer_list<value_type> __il)
- {
- __tree_.__assign_unique(__il.begin(), __il.end());
- return *this;
- }
+ _LIBCPP_HIDE_FROM_ABI map& operator=(initializer_list<value_type> __il) {
+ __tree_.__assign_unique(__il.begin(), __il.end());
+ return *this;
+ }
#endif // _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI
- explicit map(const allocator_type& __a)
- : __tree_(typename __base::allocator_type(__a))
- {
- }
-
- _LIBCPP_HIDE_FROM_ABI
- map(const map& __m, const allocator_type& __a)
- : __tree_(__m.__tree_.value_comp(), typename __base::allocator_type(__a))
- {
- insert(__m.begin(), __m.end());
- }
-
- _LIBCPP_HIDE_FROM_ABI
- ~map() {
- static_assert(sizeof(__diagnose_non_const_comparator<_Key, _Compare>()), "");
- }
+ _LIBCPP_HIDE_FROM_ABI explicit map(const allocator_type& __a) : __tree_(typename __base::allocator_type(__a)) {}
- _LIBCPP_HIDE_FROM_ABI
- iterator begin() _NOEXCEPT {return __tree_.begin();}
- _LIBCPP_HIDE_FROM_ABI
- const_iterator begin() const _NOEXCEPT {return __tree_.begin();}
- _LIBCPP_HIDE_FROM_ABI
- iterator end() _NOEXCEPT {return __tree_.end();}
- _LIBCPP_HIDE_FROM_ABI
- const_iterator end() const _NOEXCEPT {return __tree_.end();}
-
- _LIBCPP_HIDE_FROM_ABI
- reverse_iterator rbegin() _NOEXCEPT {return reverse_iterator(end());}
- _LIBCPP_HIDE_FROM_ABI
- const_reverse_iterator rbegin() const _NOEXCEPT
- {return const_reverse_iterator(end());}
- _LIBCPP_HIDE_FROM_ABI
- reverse_iterator rend() _NOEXCEPT
- {return reverse_iterator(begin());}
- _LIBCPP_HIDE_FROM_ABI
- const_reverse_iterator rend() const _NOEXCEPT
- {return const_reverse_iterator(begin());}
-
- _LIBCPP_HIDE_FROM_ABI
- const_iterator cbegin() const _NOEXCEPT {return begin();}
- _LIBCPP_HIDE_FROM_ABI
- const_iterator cend() const _NOEXCEPT {return end();}
- _LIBCPP_HIDE_FROM_ABI
- const_reverse_iterator crbegin() const _NOEXCEPT {return rbegin();}
- _LIBCPP_HIDE_FROM_ABI
- const_reverse_iterator crend() const _NOEXCEPT {return rend();}
-
- _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_HIDE_FROM_ABI
- bool empty() const _NOEXCEPT {return __tree_.size() == 0;}
- _LIBCPP_HIDE_FROM_ABI
- size_type size() const _NOEXCEPT {return __tree_.size();}
- _LIBCPP_HIDE_FROM_ABI
- size_type max_size() const _NOEXCEPT {return __tree_.max_size();}
-
- _LIBCPP_HIDE_FROM_ABI mapped_type& operator[](const key_type& __k);
-#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI mapped_type& operator[](key_type&& __k);
-#endif
+ _LIBCPP_HIDE_FROM_ABI map(const map& __m, const allocator_type& __a)
+ : __tree_(__m.__tree_.value_comp(), typename __base::allocator_type(__a)) {
+ insert(__m.begin(), __m.end());
+ }
+
+ _LIBCPP_HIDE_FROM_ABI ~map() { static_assert(sizeof(__diagnose_non_const_comparator<_Key, _Compare>()), ""); }
+
+ _LIBCPP_HIDE_FROM_ABI iterator begin() _NOEXCEPT { return __tree_.begin(); }
+ _LIBCPP_HIDE_FROM_ABI const_iterator begin() const _NOEXCEPT { return __tree_.begin(); }
+ _LIBCPP_HIDE_FROM_ABI iterator end() _NOEXCEPT { return __tree_.end(); }
+ _LIBCPP_HIDE_FROM_ABI const_iterator end() const _NOEXCEPT { return __tree_.end(); }
+
+ _LIBCPP_HIDE_FROM_ABI reverse_iterator rbegin() _NOEXCEPT { return reverse_iterator(end()); }
+ _LIBCPP_HIDE_FROM_ABI const_reverse_iterator rbegin() const _NOEXCEPT { return const_reverse_iterator(end()); }
+ _LIBCPP_HIDE_FROM_ABI reverse_iterator rend() _NOEXCEPT { return reverse_iterator(begin()); }
+ _LIBCPP_HIDE_FROM_ABI const_reverse_iterator rend() const _NOEXCEPT { return const_reverse_iterator(begin()); }
- _LIBCPP_HIDE_FROM_ABI mapped_type& at(const key_type& __k);
- _LIBCPP_HIDE_FROM_ABI const mapped_type& at(const key_type& __k) const;
+ _LIBCPP_HIDE_FROM_ABI const_iterator cbegin() const _NOEXCEPT { return begin(); }
+ _LIBCPP_HIDE_FROM_ABI const_iterator cend() const _NOEXCEPT { return end(); }
+ _LIBCPP_HIDE_FROM_ABI const_reverse_iterator crbegin() const _NOEXCEPT { return rbegin(); }
+ _LIBCPP_HIDE_FROM_ABI const_reverse_iterator crend() const _NOEXCEPT { return rend(); }
- _LIBCPP_HIDE_FROM_ABI
- allocator_type get_allocator() const _NOEXCEPT {return allocator_type(__tree_.__alloc());}
- _LIBCPP_HIDE_FROM_ABI
- key_compare key_comp() const {return __tree_.value_comp().key_comp();}
- _LIBCPP_HIDE_FROM_ABI
- value_compare value_comp() const {return value_compare(__tree_.value_comp().key_comp());}
+ _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_HIDE_FROM_ABI bool empty() const _NOEXCEPT { return __tree_.size() == 0; }
+ _LIBCPP_HIDE_FROM_ABI size_type size() const _NOEXCEPT { return __tree_.size(); }
+ _LIBCPP_HIDE_FROM_ABI size_type max_size() const _NOEXCEPT { return __tree_.max_size(); }
+ _LIBCPP_HIDE_FROM_ABI mapped_type& operator[](const key_type& __k);
#ifndef _LIBCPP_CXX03_LANG
- template <class ..._Args>
- _LIBCPP_HIDE_FROM_ABI
- pair<iterator, bool> emplace(_Args&& ...__args) {
- return __tree_.__emplace_unique(std::forward<_Args>(__args)...);
- }
+ _LIBCPP_HIDE_FROM_ABI mapped_type& operator[](key_type&& __k);
+#endif
- template <class ..._Args>
- _LIBCPP_HIDE_FROM_ABI
- iterator emplace_hint(const_iterator __p, _Args&& ...__args) {
- return __tree_.__emplace_hint_unique(__p.__i_, std::forward<_Args>(__args)...);
- }
+ _LIBCPP_HIDE_FROM_ABI mapped_type& at(const key_type& __k);
+ _LIBCPP_HIDE_FROM_ABI const mapped_type& at(const key_type& __k) const;
- template <class _Pp,
- class = __enable_if_t<is_constructible<value_type, _Pp>::value> >
- _LIBCPP_HIDE_FROM_ABI
- pair<iterator, bool> insert(_Pp&& __p)
- {return __tree_.__insert_unique(std::forward<_Pp>(__p));}
+ _LIBCPP_HIDE_FROM_ABI allocator_type get_allocator() const _NOEXCEPT { return allocator_type(__tree_.__alloc()); }
+ _LIBCPP_HIDE_FROM_ABI key_compare key_comp() const { return __tree_.value_comp().key_comp(); }
+ _LIBCPP_HIDE_FROM_ABI value_compare value_comp() const { return value_compare(__tree_.value_comp().key_comp()); }
- template <class _Pp,
- class = __enable_if_t<is_constructible<value_type, _Pp>::value> >
- _LIBCPP_HIDE_FROM_ABI
- iterator insert(const_iterator __pos, _Pp&& __p)
- {return __tree_.__insert_unique(__pos.__i_, std::forward<_Pp>(__p));}
+#ifndef _LIBCPP_CXX03_LANG
+ template <class... _Args>
+ _LIBCPP_HIDE_FROM_ABI pair<iterator, bool> emplace(_Args&&... __args) {
+ return __tree_.__emplace_unique(std::forward<_Args>(__args)...);
+ }
+
+ template <class... _Args>
+ _LIBCPP_HIDE_FROM_ABI iterator emplace_hint(const_iterator __p, _Args&&... __args) {
+ return __tree_.__emplace_hint_unique(__p.__i_, std::forward<_Args>(__args)...);
+ }
+
+ template <class _Pp, class = __enable_if_t<is_constructible<value_type, _Pp>::value> >
+ _LIBCPP_HIDE_FROM_ABI pair<iterator, bool> insert(_Pp&& __p) {
+ return __tree_.__insert_unique(std::forward<_Pp>(__p));
+ }
+
+ template <class _Pp, class = __enable_if_t<is_constructible<value_type, _Pp>::value> >
+ _LIBCPP_HIDE_FROM_ABI iterator insert(const_iterator __pos, _Pp&& __p) {
+ return __tree_.__insert_unique(__pos.__i_, std::forward<_Pp>(__p));
+ }
#endif // _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI
- pair<iterator, bool>
- insert(const value_type& __v) {return __tree_.__insert_unique(__v);}
+ _LIBCPP_HIDE_FROM_ABI pair<iterator, bool> insert(const value_type& __v) { return __tree_.__insert_unique(__v); }
- _LIBCPP_HIDE_FROM_ABI
- iterator
- insert(const_iterator __p, const value_type& __v)
- {return __tree_.__insert_unique(__p.__i_, __v);}
+ _LIBCPP_HIDE_FROM_ABI iterator insert(const_iterator __p, const value_type& __v) {
+ return __tree_.__insert_unique(__p.__i_, __v);
+ }
#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI
- pair<iterator, bool>
- insert(value_type&& __v) {return __tree_.__insert_unique(std::move(__v));}
+ _LIBCPP_HIDE_FROM_ABI pair<iterator, bool> insert(value_type&& __v) {
+ return __tree_.__insert_unique(std::move(__v));
+ }
- _LIBCPP_HIDE_FROM_ABI
- iterator insert(const_iterator __p, value_type&& __v)
- {return __tree_.__insert_unique(__p.__i_, std::move(__v));}
+ _LIBCPP_HIDE_FROM_ABI iterator insert(const_iterator __p, value_type&& __v) {
+ return __tree_.__insert_unique(__p.__i_, std::move(__v));
+ }
- _LIBCPP_HIDE_FROM_ABI
- void insert(initializer_list<value_type> __il)
- {insert(__il.begin(), __il.end());}
+ _LIBCPP_HIDE_FROM_ABI void insert(initializer_list<value_type> __il) { insert(__il.begin(), __il.end()); }
#endif
- template <class _InputIterator>
- _LIBCPP_HIDE_FROM_ABI
- void insert(_InputIterator __f, _InputIterator __l)
- {
- for (const_iterator __e = cend(); __f != __l; ++__f)
- insert(__e.__i_, *__f);
- }
+ template <class _InputIterator>
+ _LIBCPP_HIDE_FROM_ABI void insert(_InputIterator __f, _InputIterator __l) {
+ for (const_iterator __e = cend(); __f != __l; ++__f)
+ insert(__e.__i_, *__f);
+ }
#if _LIBCPP_STD_VER >= 23
- template <_ContainerCompatibleRange<value_type> _Range>
- _LIBCPP_HIDE_FROM_ABI
- void insert_range(_Range&& __range) {
- const_iterator __end = cend();
- for (auto&& __element : __range) {
- insert(__end.__i_, std::forward<decltype(__element)>(__element));
- }
+ template <_ContainerCompatibleRange<value_type> _Range>
+ _LIBCPP_HIDE_FROM_ABI void insert_range(_Range&& __range) {
+ const_iterator __end = cend();
+ for (auto&& __element : __range) {
+ insert(__end.__i_, std::forward<decltype(__element)>(__element));
}
+ }
#endif
#if _LIBCPP_STD_VER >= 17
- template <class... _Args>
- _LIBCPP_HIDE_FROM_ABI
- pair<iterator, bool> try_emplace(const key_type& __k, _Args&&... __args)
- {
- return __tree_.__emplace_unique_key_args(__k,
- std::piecewise_construct,
- std::forward_as_tuple(__k),
- std::forward_as_tuple(std::forward<_Args>(__args)...));
- }
-
- template <class... _Args>
- _LIBCPP_HIDE_FROM_ABI
- pair<iterator, bool> try_emplace(key_type&& __k, _Args&&... __args)
- {
- return __tree_.__emplace_unique_key_args(__k,
- std::piecewise_construct,
- std::forward_as_tuple(std::move(__k)),
- std::forward_as_tuple(std::forward<_Args>(__args)...));
- }
+ template <class... _Args>
+ _LIBCPP_HIDE_FROM_ABI pair<iterator, bool> try_emplace(const key_type& __k, _Args&&... __args) {
+ return __tree_.__emplace_unique_key_args(
+ __k,
+ std::piecewise_construct,
+ std::forward_as_tuple(__k),
+ std::forward_as_tuple(std::forward<_Args>(__args)...));
+ }
- template <class... _Args>
- _LIBCPP_HIDE_FROM_ABI
- iterator try_emplace(const_iterator __h, const key_type& __k, _Args&&... __args)
- {
- return __tree_.__emplace_hint_unique_key_args(__h.__i_, __k,
+ template <class... _Args>
+ _LIBCPP_HIDE_FROM_ABI pair<iterator, bool> try_emplace(key_type&& __k, _Args&&... __args) {
+ return __tree_.__emplace_unique_key_args(
+ __k,
+ std::piecewise_construct,
+ std::forward_as_tuple(std::move(__k)),
+ std::forward_as_tuple(std::forward<_Args>(__args)...));
+ }
+
+ template <class... _Args>
+ _LIBCPP_HIDE_FROM_ABI iterator try_emplace(const_iterator __h, const key_type& __k, _Args&&... __args) {
+ return __tree_
+ .__emplace_hint_unique_key_args(
+ __h.__i_,
+ __k,
std::piecewise_construct,
std::forward_as_tuple(__k),
- std::forward_as_tuple(std::forward<_Args>(__args)...)).first;
- }
-
- template <class... _Args>
- _LIBCPP_HIDE_FROM_ABI
- iterator try_emplace(const_iterator __h, key_type&& __k, _Args&&... __args)
- {
- return __tree_.__emplace_hint_unique_key_args(__h.__i_, __k,
+ std::forward_as_tuple(std::forward<_Args>(__args)...))
+ .first;
+ }
+
+ template <class... _Args>
+ _LIBCPP_HIDE_FROM_ABI iterator try_emplace(const_iterator __h, key_type&& __k, _Args&&... __args) {
+ return __tree_
+ .__emplace_hint_unique_key_args(
+ __h.__i_,
+ __k,
std::piecewise_construct,
std::forward_as_tuple(std::move(__k)),
- std::forward_as_tuple(std::forward<_Args>(__args)...)).first;
- }
-
- template <class _Vp>
- _LIBCPP_HIDE_FROM_ABI
- pair<iterator, bool> insert_or_assign(const key_type& __k, _Vp&& __v)
- {
- iterator __p = lower_bound(__k);
- if ( __p != end() && !key_comp()(__k, __p->first))
- {
- __p->second = std::forward<_Vp>(__v);
- return std::make_pair(__p, false);
- }
- return std::make_pair(emplace_hint(__p, __k, std::forward<_Vp>(__v)), true);
+ std::forward_as_tuple(std::forward<_Args>(__args)...))
+ .first;
+ }
+
+ template <class _Vp>
+ _LIBCPP_HIDE_FROM_ABI pair<iterator, bool> insert_or_assign(const key_type& __k, _Vp&& __v) {
+ iterator __p = lower_bound(__k);
+ if (__p != end() && !key_comp()(__k, __p->first)) {
+ __p->second = std::forward<_Vp>(__v);
+ return std::make_pair(__p, false);
}
-
- template <class _Vp>
- _LIBCPP_HIDE_FROM_ABI
- pair<iterator, bool> insert_or_assign(key_type&& __k, _Vp&& __v)
- {
- iterator __p = lower_bound(__k);
- if ( __p != end() && !key_comp()(__k, __p->first))
- {
- __p->second = std::forward<_Vp>(__v);
- return std::make_pair(__p, false);
- }
- return std::make_pair(emplace_hint(__p, std::move(__k), std::forward<_Vp>(__v)), true);
+ return std::make_pair(emplace_hint(__p, __k, std::forward<_Vp>(__v)), true);
+ }
+
+ template <class _Vp>
+ _LIBCPP_HIDE_FROM_ABI pair<iterator, bool> insert_or_assign(key_type&& __k, _Vp&& __v) {
+ iterator __p = lower_bound(__k);
+ if (__p != end() && !key_comp()(__k, __p->first)) {
+ __p->second = std::forward<_Vp>(__v);
+ return std::make_pair(__p, false);
}
+ return std::make_pair(emplace_hint(__p, std::move(__k), std::forward<_Vp>(__v)), true);
+ }
- template <class _Vp>
- _LIBCPP_HIDE_FROM_ABI iterator insert_or_assign(const_iterator __h,
- const key_type& __k,
- _Vp&& __v) {
- auto [__r, __inserted] = __tree_.__emplace_hint_unique_key_args(
- __h.__i_, __k, __k, std::forward<_Vp>(__v));
+ template <class _Vp>
+ _LIBCPP_HIDE_FROM_ABI iterator insert_or_assign(const_iterator __h, const key_type& __k, _Vp&& __v) {
+ auto [__r, __inserted] = __tree_.__emplace_hint_unique_key_args(__h.__i_, __k, __k, std::forward<_Vp>(__v));
- if (!__inserted)
- __r->__get_value().second = std::forward<_Vp>(__v);
+ if (!__inserted)
+ __r->__get_value().second = std::forward<_Vp>(__v);
- return __r;
- }
+ return __r;
+ }
- template <class _Vp>
- _LIBCPP_HIDE_FROM_ABI iterator insert_or_assign(const_iterator __h,
- key_type&& __k,
- _Vp&& __v) {
- auto [__r, __inserted] = __tree_.__emplace_hint_unique_key_args(
- __h.__i_, __k, std::move(__k), std::forward<_Vp>(__v));
+ template <class _Vp>
+ _LIBCPP_HIDE_FROM_ABI iterator insert_or_assign(const_iterator __h, key_type&& __k, _Vp&& __v) {
+ auto [__r, __inserted] =
+ __tree_.__emplace_hint_unique_key_args(__h.__i_, __k, std::move(__k), std::forward<_Vp>(__v));
- if (!__inserted)
- __r->__get_value().second = std::forward<_Vp>(__v);
+ if (!__inserted)
+ __r->__get_value().second = std::forward<_Vp>(__v);
- return __r;
- }
+ return __r;
+ }
#endif // _LIBCPP_STD_VER >= 17
- _LIBCPP_HIDE_FROM_ABI
- iterator erase(const_iterator __p) {return __tree_.erase(__p.__i_);}
- _LIBCPP_HIDE_FROM_ABI
- iterator erase(iterator __p) {return __tree_.erase(__p.__i_);}
- _LIBCPP_HIDE_FROM_ABI
- size_type erase(const key_type& __k)
- {return __tree_.__erase_unique(__k);}
- _LIBCPP_HIDE_FROM_ABI
- iterator erase(const_iterator __f, const_iterator __l)
- {return __tree_.erase(__f.__i_, __l.__i_);}
- _LIBCPP_HIDE_FROM_ABI
- void clear() _NOEXCEPT {__tree_.clear();}
+ _LIBCPP_HIDE_FROM_ABI iterator erase(const_iterator __p) { return __tree_.erase(__p.__i_); }
+ _LIBCPP_HIDE_FROM_ABI iterator erase(iterator __p) { return __tree_.erase(__p.__i_); }
+ _LIBCPP_HIDE_FROM_ABI size_type erase(const key_type& __k) { return __tree_.__erase_unique(__k); }
+ _LIBCPP_HIDE_FROM_ABI iterator erase(const_iterator __f, const_iterator __l) {
+ return __tree_.erase(__f.__i_, __l.__i_);
+ }
+ _LIBCPP_HIDE_FROM_ABI void clear() _NOEXCEPT { __tree_.clear(); }
#if _LIBCPP_STD_VER >= 17
- _LIBCPP_HIDE_FROM_ABI
- insert_return_type insert(node_type&& __nh)
- {
- _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(__nh.empty() || __nh.get_allocator() == get_allocator(),
- "node_type with incompatible allocator passed to map::insert()");
- return __tree_.template __node_handle_insert_unique<
- node_type, insert_return_type>(std::move(__nh));
- }
- _LIBCPP_HIDE_FROM_ABI
- iterator insert(const_iterator __hint, node_type&& __nh)
- {
- _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(__nh.empty() || __nh.get_allocator() == get_allocator(),
- "node_type with incompatible allocator passed to map::insert()");
- return __tree_.template __node_handle_insert_unique<node_type>(
- __hint.__i_, std::move(__nh));
- }
- _LIBCPP_HIDE_FROM_ABI
- node_type extract(key_type const& __key)
- {
- return __tree_.template __node_handle_extract<node_type>(__key);
- }
- _LIBCPP_HIDE_FROM_ABI
- node_type extract(const_iterator __it)
- {
- return __tree_.template __node_handle_extract<node_type>(__it.__i_);
- }
- template <class _Compare2>
- _LIBCPP_HIDE_FROM_ABI
- void merge(map<key_type, mapped_type, _Compare2, allocator_type>& __source)
- {
- _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(__source.get_allocator() == get_allocator(),
- "merging container with incompatible allocator");
- __tree_.__node_handle_merge_unique(__source.__tree_);
- }
- template <class _Compare2>
- _LIBCPP_HIDE_FROM_ABI
- void merge(map<key_type, mapped_type, _Compare2, allocator_type>&& __source)
- {
- _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(__source.get_allocator() == get_allocator(),
- "merging container with incompatible allocator");
- __tree_.__node_handle_merge_unique(__source.__tree_);
- }
- template <class _Compare2>
- _LIBCPP_HIDE_FROM_ABI
- void merge(multimap<key_type, mapped_type, _Compare2, allocator_type>& __source)
- {
- _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(__source.get_allocator() == get_allocator(),
- "merging container with incompatible allocator");
- __tree_.__node_handle_merge_unique(__source.__tree_);
- }
- template <class _Compare2>
- _LIBCPP_HIDE_FROM_ABI
- void merge(multimap<key_type, mapped_type, _Compare2, allocator_type>&& __source)
- {
- _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(__source.get_allocator() == get_allocator(),
- "merging container with incompatible allocator");
- __tree_.__node_handle_merge_unique(__source.__tree_);
- }
+ _LIBCPP_HIDE_FROM_ABI insert_return_type insert(node_type&& __nh) {
+ _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(__nh.empty() || __nh.get_allocator() == get_allocator(),
+ "node_type with incompatible allocator passed to map::insert()");
+ return __tree_.template __node_handle_insert_unique< node_type, insert_return_type>(std::move(__nh));
+ }
+ _LIBCPP_HIDE_FROM_ABI iterator insert(const_iterator __hint, node_type&& __nh) {
+ _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(__nh.empty() || __nh.get_allocator() == get_allocator(),
+ "node_type with incompatible allocator passed to map::insert()");
+ return __tree_.template __node_handle_insert_unique<node_type>(__hint.__i_, std::move(__nh));
+ }
+ _LIBCPP_HIDE_FROM_ABI node_type extract(key_type const& __key) {
+ return __tree_.template __node_handle_extract<node_type>(__key);
+ }
+ _LIBCPP_HIDE_FROM_ABI node_type extract(const_iterator __it) {
+ return __tree_.template __node_handle_extract<node_type>(__it.__i_);
+ }
+ template <class _Compare2>
+ _LIBCPP_HIDE_FROM_ABI void merge(map<key_type, mapped_type, _Compare2, allocator_type>& __source) {
+ _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(
+ __source.get_allocator() == get_allocator(), "merging container with incompatible allocator");
+ __tree_.__node_handle_merge_unique(__source.__tree_);
+ }
+ template <class _Compare2>
+ _LIBCPP_HIDE_FROM_ABI void merge(map<key_type, mapped_type, _Compare2, allocator_type>&& __source) {
+ _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(
+ __source.get_allocator() == get_allocator(), "merging container with incompatible allocator");
+ __tree_.__node_handle_merge_unique(__source.__tree_);
+ }
+ template <class _Compare2>
+ _LIBCPP_HIDE_FROM_ABI void merge(multimap<key_type, mapped_type, _Compare2, allocator_type>& __source) {
+ _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(
+ __source.get_allocator() == get_allocator(), "merging container with incompatible allocator");
+ __tree_.__node_handle_merge_unique(__source.__tree_);
+ }
+ template <class _Compare2>
+ _LIBCPP_HIDE_FROM_ABI void merge(multimap<key_type, mapped_type, _Compare2, allocator_type>&& __source) {
+ _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(
+ __source.get_allocator() == get_allocator(), "merging container with incompatible allocator");
+ __tree_.__node_handle_merge_unique(__source.__tree_);
+ }
#endif
- _LIBCPP_HIDE_FROM_ABI
- void swap(map& __m)
- _NOEXCEPT_(__is_nothrow_swappable<__base>::value)
- {__tree_.swap(__m.__tree_);}
+ _LIBCPP_HIDE_FROM_ABI void swap(map& __m) _NOEXCEPT_(__is_nothrow_swappable<__base>::value) {
+ __tree_.swap(__m.__tree_);
+ }
- _LIBCPP_HIDE_FROM_ABI
- iterator find(const key_type& __k) {return __tree_.find(__k);}
- _LIBCPP_HIDE_FROM_ABI
- const_iterator find(const key_type& __k) const {return __tree_.find(__k);}
+ _LIBCPP_HIDE_FROM_ABI iterator find(const key_type& __k) { return __tree_.find(__k); }
+ _LIBCPP_HIDE_FROM_ABI const_iterator find(const key_type& __k) const { return __tree_.find(__k); }
#if _LIBCPP_STD_VER >= 14
- template <typename _K2, enable_if_t<__is_transparent<_Compare, _K2>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI
- iterator
- find(const _K2& __k) {return __tree_.find(__k);}
- template <typename _K2, enable_if_t<__is_transparent<_Compare, _K2>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI
- const_iterator
- find(const _K2& __k) const {return __tree_.find(__k);}
+ template <typename _K2, enable_if_t<__is_transparent<_Compare, _K2>::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI iterator find(const _K2& __k) {
+ return __tree_.find(__k);
+ }
+ template <typename _K2, enable_if_t<__is_transparent<_Compare, _K2>::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI const_iterator find(const _K2& __k) const {
+ return __tree_.find(__k);
+ }
#endif
- _LIBCPP_HIDE_FROM_ABI
- size_type count(const key_type& __k) const
- {return __tree_.__count_unique(__k);}
+ _LIBCPP_HIDE_FROM_ABI size_type count(const key_type& __k) const { return __tree_.__count_unique(__k); }
#if _LIBCPP_STD_VER >= 14
- template <typename _K2, enable_if_t<__is_transparent<_Compare, _K2>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI
- size_type
- count(const _K2& __k) const {return __tree_.__count_multi(__k);}
+ template <typename _K2, enable_if_t<__is_transparent<_Compare, _K2>::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI size_type count(const _K2& __k) const {
+ return __tree_.__count_multi(__k);
+ }
#endif
#if _LIBCPP_STD_VER >= 20
- _LIBCPP_HIDE_FROM_ABI
- bool contains(const key_type& __k) const {return find(__k) != end();}
- template <typename _K2, enable_if_t<__is_transparent<_Compare, _K2>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI
- bool
- contains(const _K2& __k) const { return find(__k) != end(); }
+ _LIBCPP_HIDE_FROM_ABI bool contains(const key_type& __k) const { return find(__k) != end(); }
+ template <typename _K2, enable_if_t<__is_transparent<_Compare, _K2>::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI bool contains(const _K2& __k) const {
+ return find(__k) != end();
+ }
#endif // _LIBCPP_STD_VER >= 20
- _LIBCPP_HIDE_FROM_ABI
- iterator lower_bound(const key_type& __k)
- {return __tree_.lower_bound(__k);}
- _LIBCPP_HIDE_FROM_ABI
- const_iterator lower_bound(const key_type& __k) const
- {return __tree_.lower_bound(__k);}
+ _LIBCPP_HIDE_FROM_ABI iterator lower_bound(const key_type& __k) { return __tree_.lower_bound(__k); }
+ _LIBCPP_HIDE_FROM_ABI const_iterator lower_bound(const key_type& __k) const { return __tree_.lower_bound(__k); }
#if _LIBCPP_STD_VER >= 14
- template <typename _K2, enable_if_t<__is_transparent<_Compare, _K2>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI
- iterator
- lower_bound(const _K2& __k) {return __tree_.lower_bound(__k);}
-
- template <typename _K2, enable_if_t<__is_transparent<_Compare, _K2>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI
- const_iterator
- lower_bound(const _K2& __k) const {return __tree_.lower_bound(__k);}
+ template <typename _K2, enable_if_t<__is_transparent<_Compare, _K2>::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI iterator lower_bound(const _K2& __k) {
+ return __tree_.lower_bound(__k);
+ }
+
+ template <typename _K2, enable_if_t<__is_transparent<_Compare, _K2>::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI const_iterator lower_bound(const _K2& __k) const {
+ return __tree_.lower_bound(__k);
+ }
#endif
- _LIBCPP_HIDE_FROM_ABI
- iterator upper_bound(const key_type& __k)
- {return __tree_.upper_bound(__k);}
- _LIBCPP_HIDE_FROM_ABI
- const_iterator upper_bound(const key_type& __k) const
- {return __tree_.upper_bound(__k);}
+ _LIBCPP_HIDE_FROM_ABI iterator upper_bound(const key_type& __k) { return __tree_.upper_bound(__k); }
+ _LIBCPP_HIDE_FROM_ABI const_iterator upper_bound(const key_type& __k) const { return __tree_.upper_bound(__k); }
#if _LIBCPP_STD_VER >= 14
- template <typename _K2, enable_if_t<__is_transparent<_Compare, _K2>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI
- iterator
- upper_bound(const _K2& __k) {return __tree_.upper_bound(__k);}
- template <typename _K2, enable_if_t<__is_transparent<_Compare, _K2>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI
- const_iterator
- upper_bound(const _K2& __k) const {return __tree_.upper_bound(__k);}
+ template <typename _K2, enable_if_t<__is_transparent<_Compare, _K2>::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI iterator upper_bound(const _K2& __k) {
+ return __tree_.upper_bound(__k);
+ }
+ template <typename _K2, enable_if_t<__is_transparent<_Compare, _K2>::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI const_iterator upper_bound(const _K2& __k) const {
+ return __tree_.upper_bound(__k);
+ }
#endif
- _LIBCPP_HIDE_FROM_ABI
- pair<iterator,iterator> equal_range(const key_type& __k)
- {return __tree_.__equal_range_unique(__k);}
- _LIBCPP_HIDE_FROM_ABI
- pair<const_iterator,const_iterator> equal_range(const key_type& __k) const
- {return __tree_.__equal_range_unique(__k);}
+ _LIBCPP_HIDE_FROM_ABI pair<iterator, iterator> equal_range(const key_type& __k) {
+ return __tree_.__equal_range_unique(__k);
+ }
+ _LIBCPP_HIDE_FROM_ABI pair<const_iterator, const_iterator> equal_range(const key_type& __k) const {
+ return __tree_.__equal_range_unique(__k);
+ }
#if _LIBCPP_STD_VER >= 14
- template <typename _K2, enable_if_t<__is_transparent<_Compare, _K2>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI
- pair<iterator,iterator>
- equal_range(const _K2& __k) {return __tree_.__equal_range_multi(__k);}
- template <typename _K2, enable_if_t<__is_transparent<_Compare, _K2>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI
- pair<const_iterator,const_iterator>
- equal_range(const _K2& __k) const {return __tree_.__equal_range_multi(__k);}
+ template <typename _K2, enable_if_t<__is_transparent<_Compare, _K2>::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI pair<iterator, iterator> equal_range(const _K2& __k) {
+ return __tree_.__equal_range_multi(__k);
+ }
+ template <typename _K2, enable_if_t<__is_transparent<_Compare, _K2>::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI pair<const_iterator, const_iterator> equal_range(const _K2& __k) const {
+ return __tree_.__equal_range_multi(__k);
+ }
#endif
private:
- typedef typename __base::__node __node;
- typedef typename __base::__node_allocator __node_allocator;
- typedef typename __base::__node_pointer __node_pointer;
- typedef typename __base::__node_base_pointer __node_base_pointer;
- typedef typename __base::__parent_pointer __parent_pointer;
+ typedef typename __base::__node __node;
+ typedef typename __base::__node_allocator __node_allocator;
+ typedef typename __base::__node_pointer __node_pointer;
+ typedef typename __base::__node_base_pointer __node_base_pointer;
+ typedef typename __base::__parent_pointer __parent_pointer;
- typedef __map_node_destructor<__node_allocator> _Dp;
- typedef unique_ptr<__node, _Dp> __node_holder;
+ typedef __map_node_destructor<__node_allocator> _Dp;
+ typedef unique_ptr<__node, _Dp> __node_holder;
#ifdef _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI __node_holder __construct_node_with_key(const key_type& __k);
+ _LIBCPP_HIDE_FROM_ABI __node_holder __construct_node_with_key(const key_type& __k);
#endif
};
#if _LIBCPP_STD_VER >= 17
-template<class _InputIterator, class _Compare = less<__iter_key_type<_InputIterator>>,
- class _Allocator = allocator<__iter_to_alloc_type<_InputIterator>>,
- class = enable_if_t<__has_input_iterator_category<_InputIterator>::value, void>,
- class = enable_if_t<!__is_allocator<_Compare>::value, void>,
- class = enable_if_t<__is_allocator<_Allocator>::value, void>>
+template <class _InputIterator,
+ class _Compare = less<__iter_key_type<_InputIterator>>,
+ class _Allocator = allocator<__iter_to_alloc_type<_InputIterator>>,
+ class = enable_if_t<__has_input_iterator_category<_InputIterator>::value, void>,
+ class = enable_if_t<!__is_allocator<_Compare>::value, void>,
+ class = enable_if_t<__is_allocator<_Allocator>::value, void>>
map(_InputIterator, _InputIterator, _Compare = _Compare(), _Allocator = _Allocator())
- -> map<__iter_key_type<_InputIterator>, __iter_mapped_type<_InputIterator>, _Compare, _Allocator>;
+ -> map<__iter_key_type<_InputIterator>, __iter_mapped_type<_InputIterator>, _Compare, _Allocator>;
-#if _LIBCPP_STD_VER >= 23
-template <ranges::input_range _Range, class _Compare = less<__range_key_type<_Range>>,
+# if _LIBCPP_STD_VER >= 23
+template <ranges::input_range _Range,
+ class _Compare = less<__range_key_type<_Range>>,
class _Allocator = allocator<__range_to_alloc_type<_Range>>,
- class = enable_if_t<!__is_allocator<_Compare>::value, void>,
- class = enable_if_t<__is_allocator<_Allocator>::value, void>>
+ class = enable_if_t<!__is_allocator<_Compare>::value, void>,
+ class = enable_if_t<__is_allocator<_Allocator>::value, void>>
map(from_range_t, _Range&&, _Compare = _Compare(), _Allocator = _Allocator())
- -> map<__range_key_type<_Range>, __range_mapped_type<_Range>, _Compare, _Allocator>;
-#endif
-
-template<class _Key, class _Tp, class _Compare = less<remove_const_t<_Key>>,
- class _Allocator = allocator<pair<const _Key, _Tp>>,
- class = enable_if_t<!__is_allocator<_Compare>::value, void>,
- class = enable_if_t<__is_allocator<_Allocator>::value, void>>
+ -> map<__range_key_type<_Range>, __range_mapped_type<_Range>, _Compare, _Allocator>;
+# endif
+
+template <class _Key,
+ class _Tp,
+ class _Compare = less<remove_const_t<_Key>>,
+ class _Allocator = allocator<pair<const _Key, _Tp>>,
+ class = enable_if_t<!__is_allocator<_Compare>::value, void>,
+ class = enable_if_t<__is_allocator<_Allocator>::value, void>>
map(initializer_list<pair<_Key, _Tp>>, _Compare = _Compare(), _Allocator = _Allocator())
- -> map<remove_const_t<_Key>, _Tp, _Compare, _Allocator>;
+ -> map<remove_const_t<_Key>, _Tp, _Compare, _Allocator>;
-template<class _InputIterator, class _Allocator,
- class = enable_if_t<__has_input_iterator_category<_InputIterator>::value, void>,
- class = enable_if_t<__is_allocator<_Allocator>::value, void>>
+template <class _InputIterator,
+ class _Allocator,
+ class = enable_if_t<__has_input_iterator_category<_InputIterator>::value, void>,
+ class = enable_if_t<__is_allocator<_Allocator>::value, void>>
map(_InputIterator, _InputIterator, _Allocator)
- -> map<__iter_key_type<_InputIterator>, __iter_mapped_type<_InputIterator>,
- less<__iter_key_type<_InputIterator>>, _Allocator>;
+ -> map<__iter_key_type<_InputIterator>,
+ __iter_mapped_type<_InputIterator>,
+ less<__iter_key_type<_InputIterator>>,
+ _Allocator>;
-#if _LIBCPP_STD_VER >= 23
-template <ranges::input_range _Range, class _Allocator,
- class = enable_if_t<__is_allocator<_Allocator>::value, void>>
+# if _LIBCPP_STD_VER >= 23
+template <ranges::input_range _Range, class _Allocator, class = enable_if_t<__is_allocator<_Allocator>::value, void>>
map(from_range_t, _Range&&, _Allocator)
- -> map<__range_key_type<_Range>, __range_mapped_type<_Range>, less<__range_key_type<_Range>>, _Allocator>;
-#endif
+ -> map<__range_key_type<_Range>, __range_mapped_type<_Range>, less<__range_key_type<_Range>>, _Allocator>;
+# endif
-template<class _Key, class _Tp, class _Allocator,
- class = enable_if_t<__is_allocator<_Allocator>::value, void>>
+template <class _Key, class _Tp, class _Allocator, class = enable_if_t<__is_allocator<_Allocator>::value, void>>
map(initializer_list<pair<_Key, _Tp>>, _Allocator)
- -> map<remove_const_t<_Key>, _Tp, less<remove_const_t<_Key>>, _Allocator>;
+ -> map<remove_const_t<_Key>, _Tp, less<remove_const_t<_Key>>, _Allocator>;
#endif
#ifndef _LIBCPP_CXX03_LANG
template <class _Key, class _Tp, class _Compare, class _Allocator>
map<_Key, _Tp, _Compare, _Allocator>::map(map&& __m, const allocator_type& __a)
- : __tree_(std::move(__m.__tree_), typename __base::allocator_type(__a))
-{
- if (__a != __m.get_allocator())
- {
- const_iterator __e = cend();
- while (!__m.empty())
- __tree_.__insert_unique(__e.__i_,
- __m.__tree_.remove(__m.begin().__i_)->__value_.__move());
- }
+ : __tree_(std::move(__m.__tree_), typename __base::allocator_type(__a)) {
+ if (__a != __m.get_allocator()) {
+ const_iterator __e = cend();
+ while (!__m.empty())
+ __tree_.__insert_unique(__e.__i_, __m.__tree_.remove(__m.begin().__i_)->__value_.__move());
+ }
}
template <class _Key, class _Tp, class _Compare, class _Allocator>
-_Tp&
-map<_Key, _Tp, _Compare, _Allocator>::operator[](const key_type& __k)
-{
- return __tree_.__emplace_unique_key_args(__k,
- std::piecewise_construct,
- std::forward_as_tuple(__k),
- std::forward_as_tuple()).first->__get_value().second;
+_Tp& map<_Key, _Tp, _Compare, _Allocator>::operator[](const key_type& __k) {
+ return __tree_
+ .__emplace_unique_key_args(__k, std::piecewise_construct, std::forward_as_tuple(__k), std::forward_as_tuple())
+ .first->__get_value()
+ .second;
}
template <class _Key, class _Tp, class _Compare, class _Allocator>
-_Tp&
-map<_Key, _Tp, _Compare, _Allocator>::operator[](key_type&& __k)
-{
- // TODO investigate this clang-tidy warning.
- // NOLINTNEXTLINE(bugprone-use-after-move)
- return __tree_.__emplace_unique_key_args(__k,
- std::piecewise_construct,
- std::forward_as_tuple(std::move(__k)),
- std::forward_as_tuple()).first->__get_value().second;
+_Tp& map<_Key, _Tp, _Compare, _Allocator>::operator[](key_type&& __k) {
+ // TODO investigate this clang-tidy warning.
+ // NOLINTBEGIN(bugprone-use-after-move)
+ return __tree_
+ .__emplace_unique_key_args(
+ __k, std::piecewise_construct, std::forward_as_tuple(std::move(__k)), std::forward_as_tuple())
+ .first->__get_value()
+ .second;
+ // NOLINTEND(bugprone-use-after-move)
}
#else // _LIBCPP_CXX03_LANG
template <class _Key, class _Tp, class _Compare, class _Allocator>
typename map<_Key, _Tp, _Compare, _Allocator>::__node_holder
-map<_Key, _Tp, _Compare, _Allocator>::__construct_node_with_key(const key_type& __k)
-{
- __node_allocator& __na = __tree_.__node_alloc();
- __node_holder __h(__node_traits::allocate(__na, 1), _Dp(__na));
- __node_traits::construct(__na, std::addressof(__h->__value_.__get_value().first), __k);
- __h.get_deleter().__first_constructed = true;
- __node_traits::construct(__na, std::addressof(__h->__value_.__get_value().second));
- __h.get_deleter().__second_constructed = true;
- return __h;
+map<_Key, _Tp, _Compare, _Allocator>::__construct_node_with_key(const key_type& __k) {
+ __node_allocator& __na = __tree_.__node_alloc();
+ __node_holder __h(__node_traits::allocate(__na, 1), _Dp(__na));
+ __node_traits::construct(__na, std::addressof(__h->__value_.__get_value().first), __k);
+ __h.get_deleter().__first_constructed = true;
+ __node_traits::construct(__na, std::addressof(__h->__value_.__get_value().second));
+ __h.get_deleter().__second_constructed = true;
+ return __h;
}
template <class _Key, class _Tp, class _Compare, class _Allocator>
-_Tp&
-map<_Key, _Tp, _Compare, _Allocator>::operator[](const key_type& __k)
-{
- __parent_pointer __parent;
- __node_base_pointer& __child = __tree_.__find_equal(__parent, __k);
- __node_pointer __r = static_cast<__node_pointer>(__child);
- if (__child == nullptr)
- {
- __node_holder __h = __construct_node_with_key(__k);
- __tree_.__insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__h.get()));
- __r = __h.release();
- }
- return __r->__value_.__get_value().second;
+_Tp& map<_Key, _Tp, _Compare, _Allocator>::operator[](const key_type& __k) {
+ __parent_pointer __parent;
+ __node_base_pointer& __child = __tree_.__find_equal(__parent, __k);
+ __node_pointer __r = static_cast<__node_pointer>(__child);
+ if (__child == nullptr) {
+ __node_holder __h = __construct_node_with_key(__k);
+ __tree_.__insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__h.get()));
+ __r = __h.release();
+ }
+ return __r->__value_.__get_value().second;
}
#endif // _LIBCPP_CXX03_LANG
template <class _Key, class _Tp, class _Compare, class _Allocator>
-_Tp&
-map<_Key, _Tp, _Compare, _Allocator>::at(const key_type& __k)
-{
- __parent_pointer __parent;
- __node_base_pointer& __child = __tree_.__find_equal(__parent, __k);
- if (__child == nullptr)
- __throw_out_of_range("map::at: key not found");
- return static_cast<__node_pointer>(__child)->__value_.__get_value().second;
+_Tp& map<_Key, _Tp, _Compare, _Allocator>::at(const key_type& __k) {
+ __parent_pointer __parent;
+ __node_base_pointer& __child = __tree_.__find_equal(__parent, __k);
+ if (__child == nullptr)
+ __throw_out_of_range("map::at: key not found");
+ return static_cast<__node_pointer>(__child)->__value_.__get_value().second;
}
template <class _Key, class _Tp, class _Compare, class _Allocator>
-const _Tp&
-map<_Key, _Tp, _Compare, _Allocator>::at(const key_type& __k) const
-{
- __parent_pointer __parent;
- __node_base_pointer __child = __tree_.__find_equal(__parent, __k);
- if (__child == nullptr)
- __throw_out_of_range("map::at: key not found");
- return static_cast<__node_pointer>(__child)->__value_.__get_value().second;
+const _Tp& map<_Key, _Tp, _Compare, _Allocator>::at(const key_type& __k) const {
+ __parent_pointer __parent;
+ __node_base_pointer __child = __tree_.__find_equal(__parent, __k);
+ if (__child == nullptr)
+ __throw_out_of_range("map::at: key not found");
+ return static_cast<__node_pointer>(__child)->__value_.__get_value().second;
}
-
template <class _Key, class _Tp, class _Compare, class _Allocator>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator==(const map<_Key, _Tp, _Compare, _Allocator>& __x,
- const map<_Key, _Tp, _Compare, _Allocator>& __y)
-{
- return __x.size() == __y.size() && std::equal(__x.begin(), __x.end(), __y.begin());
+inline _LIBCPP_HIDE_FROM_ABI bool
+operator==(const map<_Key, _Tp, _Compare, _Allocator>& __x, const map<_Key, _Tp, _Compare, _Allocator>& __y) {
+ return __x.size() == __y.size() && std::equal(__x.begin(), __x.end(), __y.begin());
}
#if _LIBCPP_STD_VER <= 17
template <class _Key, class _Tp, class _Compare, class _Allocator>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator< (const map<_Key, _Tp, _Compare, _Allocator>& __x,
- const map<_Key, _Tp, _Compare, _Allocator>& __y)
-{
- return std::lexicographical_compare(__x.begin(), __x.end(), __y.begin(), __y.end());
+inline _LIBCPP_HIDE_FROM_ABI bool
+operator<(const map<_Key, _Tp, _Compare, _Allocator>& __x, const map<_Key, _Tp, _Compare, _Allocator>& __y) {
+ return std::lexicographical_compare(__x.begin(), __x.end(), __y.begin(), __y.end());
}
template <class _Key, class _Tp, class _Compare, class _Allocator>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator!=(const map<_Key, _Tp, _Compare, _Allocator>& __x,
- const map<_Key, _Tp, _Compare, _Allocator>& __y)
-{
- return !(__x == __y);
+inline _LIBCPP_HIDE_FROM_ABI bool
+operator!=(const map<_Key, _Tp, _Compare, _Allocator>& __x, const map<_Key, _Tp, _Compare, _Allocator>& __y) {
+ return !(__x == __y);
}
template <class _Key, class _Tp, class _Compare, class _Allocator>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator> (const map<_Key, _Tp, _Compare, _Allocator>& __x,
- const map<_Key, _Tp, _Compare, _Allocator>& __y)
-{
- return __y < __x;
+inline _LIBCPP_HIDE_FROM_ABI bool
+operator>(const map<_Key, _Tp, _Compare, _Allocator>& __x, const map<_Key, _Tp, _Compare, _Allocator>& __y) {
+ return __y < __x;
}
template <class _Key, class _Tp, class _Compare, class _Allocator>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator>=(const map<_Key, _Tp, _Compare, _Allocator>& __x,
- const map<_Key, _Tp, _Compare, _Allocator>& __y)
-{
- return !(__x < __y);
+inline _LIBCPP_HIDE_FROM_ABI bool
+operator>=(const map<_Key, _Tp, _Compare, _Allocator>& __x, const map<_Key, _Tp, _Compare, _Allocator>& __y) {
+ return !(__x < __y);
}
template <class _Key, class _Tp, class _Compare, class _Allocator>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator<=(const map<_Key, _Tp, _Compare, _Allocator>& __x,
- const map<_Key, _Tp, _Compare, _Allocator>& __y)
-{
- return !(__y < __x);
+inline _LIBCPP_HIDE_FROM_ABI bool
+operator<=(const map<_Key, _Tp, _Compare, _Allocator>& __x, const map<_Key, _Tp, _Compare, _Allocator>& __y) {
+ return !(__y < __x);
}
#else // #if _LIBCPP_STD_VER <= 17
@@ -1825,654 +1620,519 @@ operator<=(const map<_Key, _Tp, _Compare, _Allocator>& __x,
template <class _Key, class _Tp, class _Compare, class _Allocator>
_LIBCPP_HIDE_FROM_ABI __synth_three_way_result<pair<const _Key, _Tp>>
operator<=>(const map<_Key, _Tp, _Compare, _Allocator>& __x, const map<_Key, _Tp, _Compare, _Allocator>& __y) {
- return std::lexicographical_compare_three_way(
- __x.begin(),
- __x.end(),
- __y.begin(),
- __y.end(),
- std::__synth_three_way<pair<const _Key, _Tp>, pair<const _Key, _Tp>>);
+ return std::lexicographical_compare_three_way(
+ __x.begin(),
+ __x.end(),
+ __y.begin(),
+ __y.end(),
+ std::__synth_three_way<pair<const _Key, _Tp>, pair<const _Key, _Tp>>);
}
#endif // #if _LIBCPP_STD_VER <= 17
template <class _Key, class _Tp, class _Compare, class _Allocator>
-inline _LIBCPP_HIDE_FROM_ABI
-void
-swap(map<_Key, _Tp, _Compare, _Allocator>& __x,
- map<_Key, _Tp, _Compare, _Allocator>& __y)
- _NOEXCEPT_(_NOEXCEPT_(__x.swap(__y)))
-{
- __x.swap(__y);
+inline _LIBCPP_HIDE_FROM_ABI void
+swap(map<_Key, _Tp, _Compare, _Allocator>& __x, map<_Key, _Tp, _Compare, _Allocator>& __y)
+ _NOEXCEPT_(_NOEXCEPT_(__x.swap(__y))) {
+ __x.swap(__y);
}
#if _LIBCPP_STD_VER >= 20
-template <class _Key, class _Tp, class _Compare, class _Allocator,
- class _Predicate>
-inline _LIBCPP_HIDE_FROM_ABI
- typename map<_Key, _Tp, _Compare, _Allocator>::size_type
- erase_if(map<_Key, _Tp, _Compare, _Allocator>& __c, _Predicate __pred) {
+template <class _Key, class _Tp, class _Compare, class _Allocator, class _Predicate>
+inline _LIBCPP_HIDE_FROM_ABI typename map<_Key, _Tp, _Compare, _Allocator>::size_type
+erase_if(map<_Key, _Tp, _Compare, _Allocator>& __c, _Predicate __pred) {
return std::__libcpp_erase_if_container(__c, __pred);
}
#endif
-
-template <class _Key, class _Tp, class _Compare = less<_Key>,
- class _Allocator = allocator<pair<const _Key, _Tp> > >
-class _LIBCPP_TEMPLATE_VIS multimap
-{
+template <class _Key, class _Tp, class _Compare = less<_Key>, class _Allocator = allocator<pair<const _Key, _Tp> > >
+class _LIBCPP_TEMPLATE_VIS multimap {
public:
- // types:
- typedef _Key key_type;
- typedef _Tp mapped_type;
- typedef pair<const key_type, mapped_type> value_type;
- typedef __type_identity_t<_Compare> key_compare;
- typedef __type_identity_t<_Allocator> allocator_type;
- typedef value_type& reference;
- typedef const value_type& const_reference;
+ // types:
+ typedef _Key key_type;
+ typedef _Tp mapped_type;
+ typedef pair<const key_type, mapped_type> value_type;
+ typedef __type_identity_t<_Compare> key_compare;
+ typedef __type_identity_t<_Allocator> allocator_type;
+ typedef value_type& reference;
+ typedef const value_type& const_reference;
- static_assert((is_same<typename allocator_type::value_type, value_type>::value),
- "Allocator::value_type must be same type as value_type");
+ static_assert((is_same<typename allocator_type::value_type, value_type>::value),
+ "Allocator::value_type must be same type as value_type");
- class _LIBCPP_TEMPLATE_VIS value_compare
- : public __binary_function<value_type, value_type, bool>
- {
- friend class multimap;
- protected:
- key_compare comp;
+ class _LIBCPP_TEMPLATE_VIS value_compare : public __binary_function<value_type, value_type, bool> {
+ friend class multimap;
- _LIBCPP_HIDE_FROM_ABI
- value_compare(key_compare __c) : comp(__c) {}
- public:
- _LIBCPP_HIDE_FROM_ABI
- bool operator()(const value_type& __x, const value_type& __y) const
- {return comp(__x.first, __y.first);}
- };
+ protected:
+ key_compare comp;
-private:
+ _LIBCPP_HIDE_FROM_ABI value_compare(key_compare __c) : comp(__c) {}
- typedef std::__value_type<key_type, mapped_type> __value_type;
- typedef __map_value_compare<key_type, __value_type, key_compare> __vc;
- typedef __rebind_alloc<allocator_traits<allocator_type>, __value_type> __allocator_type;
- typedef __tree<__value_type, __vc, __allocator_type> __base;
- typedef typename __base::__node_traits __node_traits;
- typedef allocator_traits<allocator_type> __alloc_traits;
+ public:
+ _LIBCPP_HIDE_FROM_ABI bool operator()(const value_type& __x, const value_type& __y) const {
+ return comp(__x.first, __y.first);
+ }
+ };
+
+private:
+ typedef std::__value_type<key_type, mapped_type> __value_type;
+ typedef __map_value_compare<key_type, __value_type, key_compare> __vc;
+ typedef __rebind_alloc<allocator_traits<allocator_type>, __value_type> __allocator_type;
+ typedef __tree<__value_type, __vc, __allocator_type> __base;
+ typedef typename __base::__node_traits __node_traits;
+ typedef allocator_traits<allocator_type> __alloc_traits;
- static_assert(is_same<allocator_type, __rebind_alloc<__alloc_traits, value_type> >::value,
- "[allocator.requirements] states that rebinding an allocator to the same type should result in the "
- "original allocator");
+ static_assert(is_same<allocator_type, __rebind_alloc<__alloc_traits, value_type> >::value,
+ "[allocator.requirements] states that rebinding an allocator to the same type should result in the "
+ "original allocator");
- __base __tree_;
+ __base __tree_;
public:
- typedef typename __alloc_traits::pointer pointer;
- typedef typename __alloc_traits::const_pointer const_pointer;
- typedef typename __alloc_traits::size_type size_type;
- typedef typename __alloc_traits::difference_type difference_type;
- typedef __map_iterator<typename __base::iterator> iterator;
- typedef __map_const_iterator<typename __base::const_iterator> const_iterator;
- typedef std::reverse_iterator<iterator> reverse_iterator;
- typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
+ typedef typename __alloc_traits::pointer pointer;
+ typedef typename __alloc_traits::const_pointer const_pointer;
+ typedef typename __alloc_traits::size_type size_type;
+ typedef typename __alloc_traits::difference_type difference_type;
+ typedef __map_iterator<typename __base::iterator> iterator;
+ typedef __map_const_iterator<typename __base::const_iterator> const_iterator;
+ typedef std::reverse_iterator<iterator> reverse_iterator;
+ typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
#if _LIBCPP_STD_VER >= 17
- typedef __map_node_handle<typename __base::__node, allocator_type> node_type;
+ typedef __map_node_handle<typename __base::__node, allocator_type> node_type;
#endif
- template <class _Key2, class _Value2, class _Comp2, class _Alloc2>
- friend class _LIBCPP_TEMPLATE_VIS map;
- template <class _Key2, class _Value2, class _Comp2, class _Alloc2>
- friend class _LIBCPP_TEMPLATE_VIS multimap;
+ template <class _Key2, class _Value2, class _Comp2, class _Alloc2>
+ friend class _LIBCPP_TEMPLATE_VIS map;
+ template <class _Key2, class _Value2, class _Comp2, class _Alloc2>
+ friend class _LIBCPP_TEMPLATE_VIS multimap;
- _LIBCPP_HIDE_FROM_ABI
- multimap()
- _NOEXCEPT_(
- is_nothrow_default_constructible<allocator_type>::value &&
- is_nothrow_default_constructible<key_compare>::value &&
- is_nothrow_copy_constructible<key_compare>::value)
- : __tree_(__vc(key_compare())) {}
+ _LIBCPP_HIDE_FROM_ABI multimap() _NOEXCEPT_(
+ is_nothrow_default_constructible<allocator_type>::value&& is_nothrow_default_constructible<key_compare>::value&&
+ is_nothrow_copy_constructible<key_compare>::value)
+ : __tree_(__vc(key_compare())) {}
- _LIBCPP_HIDE_FROM_ABI
- explicit multimap(const key_compare& __comp)
- _NOEXCEPT_(
- is_nothrow_default_constructible<allocator_type>::value &&
- is_nothrow_copy_constructible<key_compare>::value)
- : __tree_(__vc(__comp)) {}
-
- _LIBCPP_HIDE_FROM_ABI
- explicit multimap(const key_compare& __comp, const allocator_type& __a)
- : __tree_(__vc(__comp), typename __base::allocator_type(__a)) {}
-
- template <class _InputIterator>
- _LIBCPP_HIDE_FROM_ABI
- multimap(_InputIterator __f, _InputIterator __l,
- const key_compare& __comp = key_compare())
- : __tree_(__vc(__comp))
- {
- insert(__f, __l);
- }
-
- template <class _InputIterator>
- _LIBCPP_HIDE_FROM_ABI
- multimap(_InputIterator __f, _InputIterator __l,
- const key_compare& __comp, const allocator_type& __a)
- : __tree_(__vc(__comp), typename __base::allocator_type(__a))
- {
- insert(__f, __l);
- }
+ _LIBCPP_HIDE_FROM_ABI explicit multimap(const key_compare& __comp) _NOEXCEPT_(
+ is_nothrow_default_constructible<allocator_type>::value&& is_nothrow_copy_constructible<key_compare>::value)
+ : __tree_(__vc(__comp)) {}
+
+ _LIBCPP_HIDE_FROM_ABI explicit multimap(const key_compare& __comp, const allocator_type& __a)
+ : __tree_(__vc(__comp), typename __base::allocator_type(__a)) {}
+
+ template <class _InputIterator>
+ _LIBCPP_HIDE_FROM_ABI multimap(_InputIterator __f, _InputIterator __l, const key_compare& __comp = key_compare())
+ : __tree_(__vc(__comp)) {
+ insert(__f, __l);
+ }
+
+ template <class _InputIterator>
+ _LIBCPP_HIDE_FROM_ABI
+ multimap(_InputIterator __f, _InputIterator __l, const key_compare& __comp, const allocator_type& __a)
+ : __tree_(__vc(__comp), typename __base::allocator_type(__a)) {
+ insert(__f, __l);
+ }
#if _LIBCPP_STD_VER >= 23
- template <_ContainerCompatibleRange<value_type> _Range>
- _LIBCPP_HIDE_FROM_ABI
- multimap(from_range_t, _Range&& __range, const key_compare& __comp = key_compare(),
- const allocator_type& __a = allocator_type())
+ template <_ContainerCompatibleRange<value_type> _Range>
+ _LIBCPP_HIDE_FROM_ABI
+ multimap(from_range_t,
+ _Range&& __range,
+ const key_compare& __comp = key_compare(),
+ const allocator_type& __a = allocator_type())
: __tree_(__vc(__comp), typename __base::allocator_type(__a)) {
- insert_range(std::forward<_Range>(__range));
- }
+ insert_range(std::forward<_Range>(__range));
+ }
#endif
#if _LIBCPP_STD_VER >= 14
- template <class _InputIterator>
- _LIBCPP_HIDE_FROM_ABI
- multimap(_InputIterator __f, _InputIterator __l, const allocator_type& __a)
- : multimap(__f, __l, key_compare(), __a) {}
+ template <class _InputIterator>
+ _LIBCPP_HIDE_FROM_ABI multimap(_InputIterator __f, _InputIterator __l, const allocator_type& __a)
+ : multimap(__f, __l, key_compare(), __a) {}
#endif
#if _LIBCPP_STD_VER >= 23
- template <_ContainerCompatibleRange<value_type> _Range>
- _LIBCPP_HIDE_FROM_ABI
- multimap(from_range_t, _Range&& __range, const allocator_type& __a)
+ template <_ContainerCompatibleRange<value_type> _Range>
+ _LIBCPP_HIDE_FROM_ABI multimap(from_range_t, _Range&& __range, const allocator_type& __a)
: multimap(from_range, std::forward<_Range>(__range), key_compare(), __a) {}
#endif
- _LIBCPP_HIDE_FROM_ABI
- multimap(const multimap& __m)
- : __tree_(__m.__tree_.value_comp(),
- __alloc_traits::select_on_container_copy_construction(__m.__tree_.__alloc()))
- {
- insert(__m.begin(), __m.end());
- }
-
- _LIBCPP_HIDE_FROM_ABI
- multimap& operator=(const multimap& __m)
- {
+ _LIBCPP_HIDE_FROM_ABI multimap(const multimap& __m)
+ : __tree_(__m.__tree_.value_comp(),
+ __alloc_traits::select_on_container_copy_construction(__m.__tree_.__alloc())) {
+ insert(__m.begin(), __m.end());
+ }
+
+ _LIBCPP_HIDE_FROM_ABI multimap& operator=(const multimap& __m) {
#ifndef _LIBCPP_CXX03_LANG
- __tree_ = __m.__tree_;
+ __tree_ = __m.__tree_;
#else
- if (this != std::addressof(__m)) {
- __tree_.clear();
- __tree_.value_comp() = __m.__tree_.value_comp();
- __tree_.__copy_assign_alloc(__m.__tree_);
- insert(__m.begin(), __m.end());
- }
+ if (this != std::addressof(__m)) {
+ __tree_.clear();
+ __tree_.value_comp() = __m.__tree_.value_comp();
+ __tree_.__copy_assign_alloc(__m.__tree_);
+ insert(__m.begin(), __m.end());
+ }
#endif
- return *this;
- }
+ return *this;
+ }
#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI
- multimap(multimap&& __m)
- _NOEXCEPT_(is_nothrow_move_constructible<__base>::value)
- : __tree_(std::move(__m.__tree_))
- {
- }
-
- _LIBCPP_HIDE_FROM_ABI multimap(multimap&& __m, const allocator_type& __a);
-
- _LIBCPP_HIDE_FROM_ABI
- multimap& operator=(multimap&& __m)
- _NOEXCEPT_(is_nothrow_move_assignable<__base>::value)
- {
- __tree_ = std::move(__m.__tree_);
- return *this;
- }
-
- _LIBCPP_HIDE_FROM_ABI
- multimap(initializer_list<value_type> __il, const key_compare& __comp = key_compare())
- : __tree_(__vc(__comp))
- {
- insert(__il.begin(), __il.end());
- }
-
- _LIBCPP_HIDE_FROM_ABI
- multimap(initializer_list<value_type> __il, const key_compare& __comp, const allocator_type& __a)
- : __tree_(__vc(__comp), typename __base::allocator_type(__a))
- {
- insert(__il.begin(), __il.end());
- }
+ _LIBCPP_HIDE_FROM_ABI multimap(multimap&& __m) _NOEXCEPT_(is_nothrow_move_constructible<__base>::value)
+ : __tree_(std::move(__m.__tree_)) {}
-#if _LIBCPP_STD_VER >= 14
- _LIBCPP_HIDE_FROM_ABI
- multimap(initializer_list<value_type> __il, const allocator_type& __a)
- : multimap(__il, key_compare(), __a) {}
-#endif
+ _LIBCPP_HIDE_FROM_ABI multimap(multimap&& __m, const allocator_type& __a);
- _LIBCPP_HIDE_FROM_ABI
- multimap& operator=(initializer_list<value_type> __il)
- {
- __tree_.__assign_multi(__il.begin(), __il.end());
- return *this;
- }
+ _LIBCPP_HIDE_FROM_ABI multimap& operator=(multimap&& __m) _NOEXCEPT_(is_nothrow_move_assignable<__base>::value) {
+ __tree_ = std::move(__m.__tree_);
+ return *this;
+ }
+
+ _LIBCPP_HIDE_FROM_ABI multimap(initializer_list<value_type> __il, const key_compare& __comp = key_compare())
+ : __tree_(__vc(__comp)) {
+ insert(__il.begin(), __il.end());
+ }
+
+ _LIBCPP_HIDE_FROM_ABI
+ multimap(initializer_list<value_type> __il, const key_compare& __comp, const allocator_type& __a)
+ : __tree_(__vc(__comp), typename __base::allocator_type(__a)) {
+ insert(__il.begin(), __il.end());
+ }
+
+# if _LIBCPP_STD_VER >= 14
+ _LIBCPP_HIDE_FROM_ABI multimap(initializer_list<value_type> __il, const allocator_type& __a)
+ : multimap(__il, key_compare(), __a) {}
+# endif
+
+ _LIBCPP_HIDE_FROM_ABI multimap& operator=(initializer_list<value_type> __il) {
+ __tree_.__assign_multi(__il.begin(), __il.end());
+ return *this;
+ }
#endif // _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI
- explicit multimap(const allocator_type& __a)
- : __tree_(typename __base::allocator_type(__a))
- {
- }
-
- _LIBCPP_HIDE_FROM_ABI
- multimap(const multimap& __m, const allocator_type& __a)
- : __tree_(__m.__tree_.value_comp(), typename __base::allocator_type(__a))
- {
- insert(__m.begin(), __m.end());
- }
-
- _LIBCPP_HIDE_FROM_ABI
- ~multimap() {
- static_assert(sizeof(__diagnose_non_const_comparator<_Key, _Compare>()), "");
- }
+ _LIBCPP_HIDE_FROM_ABI explicit multimap(const allocator_type& __a) : __tree_(typename __base::allocator_type(__a)) {}
- _LIBCPP_HIDE_FROM_ABI
- iterator begin() _NOEXCEPT {return __tree_.begin();}
- _LIBCPP_HIDE_FROM_ABI
- const_iterator begin() const _NOEXCEPT {return __tree_.begin();}
- _LIBCPP_HIDE_FROM_ABI
- iterator end() _NOEXCEPT {return __tree_.end();}
- _LIBCPP_HIDE_FROM_ABI
- const_iterator end() const _NOEXCEPT {return __tree_.end();}
-
- _LIBCPP_HIDE_FROM_ABI
- reverse_iterator rbegin() _NOEXCEPT {return reverse_iterator(end());}
- _LIBCPP_HIDE_FROM_ABI
- const_reverse_iterator rbegin() const _NOEXCEPT
- {return const_reverse_iterator(end());}
- _LIBCPP_HIDE_FROM_ABI
- reverse_iterator rend() _NOEXCEPT {return reverse_iterator(begin());}
- _LIBCPP_HIDE_FROM_ABI
- const_reverse_iterator rend() const _NOEXCEPT
- {return const_reverse_iterator(begin());}
-
- _LIBCPP_HIDE_FROM_ABI
- const_iterator cbegin() const _NOEXCEPT {return begin();}
- _LIBCPP_HIDE_FROM_ABI
- const_iterator cend() const _NOEXCEPT {return end();}
- _LIBCPP_HIDE_FROM_ABI
- const_reverse_iterator crbegin() const _NOEXCEPT {return rbegin();}
- _LIBCPP_HIDE_FROM_ABI
- const_reverse_iterator crend() const _NOEXCEPT {return rend();}
-
- _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_HIDE_FROM_ABI
- bool empty() const _NOEXCEPT {return __tree_.size() == 0;}
- _LIBCPP_HIDE_FROM_ABI
- size_type size() const _NOEXCEPT {return __tree_.size();}
- _LIBCPP_HIDE_FROM_ABI
- size_type max_size() const _NOEXCEPT {return __tree_.max_size();}
-
- _LIBCPP_HIDE_FROM_ABI
- allocator_type get_allocator() const _NOEXCEPT {return allocator_type(__tree_.__alloc());}
- _LIBCPP_HIDE_FROM_ABI
- key_compare key_comp() const {return __tree_.value_comp().key_comp();}
- _LIBCPP_HIDE_FROM_ABI
- value_compare value_comp() const
- {return value_compare(__tree_.value_comp().key_comp());}
+ _LIBCPP_HIDE_FROM_ABI multimap(const multimap& __m, const allocator_type& __a)
+ : __tree_(__m.__tree_.value_comp(), typename __base::allocator_type(__a)) {
+ insert(__m.begin(), __m.end());
+ }
-#ifndef _LIBCPP_CXX03_LANG
+ _LIBCPP_HIDE_FROM_ABI ~multimap() { static_assert(sizeof(__diagnose_non_const_comparator<_Key, _Compare>()), ""); }
- template <class ..._Args>
- _LIBCPP_HIDE_FROM_ABI
- iterator emplace(_Args&& ...__args) {
- return __tree_.__emplace_multi(std::forward<_Args>(__args)...);
- }
+ _LIBCPP_HIDE_FROM_ABI iterator begin() _NOEXCEPT { return __tree_.begin(); }
+ _LIBCPP_HIDE_FROM_ABI const_iterator begin() const _NOEXCEPT { return __tree_.begin(); }
+ _LIBCPP_HIDE_FROM_ABI iterator end() _NOEXCEPT { return __tree_.end(); }
+ _LIBCPP_HIDE_FROM_ABI const_iterator end() const _NOEXCEPT { return __tree_.end(); }
- template <class ..._Args>
- _LIBCPP_HIDE_FROM_ABI
- iterator emplace_hint(const_iterator __p, _Args&& ...__args) {
- return __tree_.__emplace_hint_multi(__p.__i_, std::forward<_Args>(__args)...);
- }
+ _LIBCPP_HIDE_FROM_ABI reverse_iterator rbegin() _NOEXCEPT { return reverse_iterator(end()); }
+ _LIBCPP_HIDE_FROM_ABI const_reverse_iterator rbegin() const _NOEXCEPT { return const_reverse_iterator(end()); }
+ _LIBCPP_HIDE_FROM_ABI reverse_iterator rend() _NOEXCEPT { return reverse_iterator(begin()); }
+ _LIBCPP_HIDE_FROM_ABI const_reverse_iterator rend() const _NOEXCEPT { return const_reverse_iterator(begin()); }
+
+ _LIBCPP_HIDE_FROM_ABI const_iterator cbegin() const _NOEXCEPT { return begin(); }
+ _LIBCPP_HIDE_FROM_ABI const_iterator cend() const _NOEXCEPT { return end(); }
+ _LIBCPP_HIDE_FROM_ABI const_reverse_iterator crbegin() const _NOEXCEPT { return rbegin(); }
+ _LIBCPP_HIDE_FROM_ABI const_reverse_iterator crend() const _NOEXCEPT { return rend(); }
+
+ _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_HIDE_FROM_ABI bool empty() const _NOEXCEPT { return __tree_.size() == 0; }
+ _LIBCPP_HIDE_FROM_ABI size_type size() const _NOEXCEPT { return __tree_.size(); }
+ _LIBCPP_HIDE_FROM_ABI size_type max_size() const _NOEXCEPT { return __tree_.max_size(); }
+
+ _LIBCPP_HIDE_FROM_ABI allocator_type get_allocator() const _NOEXCEPT { return allocator_type(__tree_.__alloc()); }
+ _LIBCPP_HIDE_FROM_ABI key_compare key_comp() const { return __tree_.value_comp().key_comp(); }
+ _LIBCPP_HIDE_FROM_ABI value_compare value_comp() const { return value_compare(__tree_.value_comp().key_comp()); }
- template <class _Pp,
- class = __enable_if_t<is_constructible<value_type, _Pp>::value>>
- _LIBCPP_HIDE_FROM_ABI
- iterator insert(_Pp&& __p)
- {return __tree_.__insert_multi(std::forward<_Pp>(__p));}
+#ifndef _LIBCPP_CXX03_LANG
+
+ template <class... _Args>
+ _LIBCPP_HIDE_FROM_ABI iterator emplace(_Args&&... __args) {
+ return __tree_.__emplace_multi(std::forward<_Args>(__args)...);
+ }
- template <class _Pp,
- class = __enable_if_t<is_constructible<value_type, _Pp>::value>>
- _LIBCPP_HIDE_FROM_ABI
- iterator insert(const_iterator __pos, _Pp&& __p)
- {return __tree_.__insert_multi(__pos.__i_, std::forward<_Pp>(__p));}
+ template <class... _Args>
+ _LIBCPP_HIDE_FROM_ABI iterator emplace_hint(const_iterator __p, _Args&&... __args) {
+ return __tree_.__emplace_hint_multi(__p.__i_, std::forward<_Args>(__args)...);
+ }
- _LIBCPP_HIDE_FROM_ABI
- iterator insert(value_type&& __v)
- {return __tree_.__insert_multi(std::move(__v));}
+ template <class _Pp, class = __enable_if_t<is_constructible<value_type, _Pp>::value>>
+ _LIBCPP_HIDE_FROM_ABI iterator insert(_Pp&& __p) {
+ return __tree_.__insert_multi(std::forward<_Pp>(__p));
+ }
- _LIBCPP_HIDE_FROM_ABI
- iterator insert(const_iterator __p, value_type&& __v)
- {return __tree_.__insert_multi(__p.__i_, std::move(__v));}
+ template <class _Pp, class = __enable_if_t<is_constructible<value_type, _Pp>::value>>
+ _LIBCPP_HIDE_FROM_ABI iterator insert(const_iterator __pos, _Pp&& __p) {
+ return __tree_.__insert_multi(__pos.__i_, std::forward<_Pp>(__p));
+ }
+ _LIBCPP_HIDE_FROM_ABI iterator insert(value_type&& __v) { return __tree_.__insert_multi(std::move(__v)); }
- _LIBCPP_HIDE_FROM_ABI
- void insert(initializer_list<value_type> __il)
- {insert(__il.begin(), __il.end());}
+ _LIBCPP_HIDE_FROM_ABI iterator insert(const_iterator __p, value_type&& __v) {
+ return __tree_.__insert_multi(__p.__i_, std::move(__v));
+ }
+
+ _LIBCPP_HIDE_FROM_ABI void insert(initializer_list<value_type> __il) { insert(__il.begin(), __il.end()); }
#endif // _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI
- iterator insert(const value_type& __v) {return __tree_.__insert_multi(__v);}
+ _LIBCPP_HIDE_FROM_ABI iterator insert(const value_type& __v) { return __tree_.__insert_multi(__v); }
- _LIBCPP_HIDE_FROM_ABI
- iterator insert(const_iterator __p, const value_type& __v)
- {return __tree_.__insert_multi(__p.__i_, __v);}
+ _LIBCPP_HIDE_FROM_ABI iterator insert(const_iterator __p, const value_type& __v) {
+ return __tree_.__insert_multi(__p.__i_, __v);
+ }
- template <class _InputIterator>
- _LIBCPP_HIDE_FROM_ABI
- void insert(_InputIterator __f, _InputIterator __l)
- {
- for (const_iterator __e = cend(); __f != __l; ++__f)
- __tree_.__insert_multi(__e.__i_, *__f);
- }
+ template <class _InputIterator>
+ _LIBCPP_HIDE_FROM_ABI void insert(_InputIterator __f, _InputIterator __l) {
+ for (const_iterator __e = cend(); __f != __l; ++__f)
+ __tree_.__insert_multi(__e.__i_, *__f);
+ }
#if _LIBCPP_STD_VER >= 23
- template <_ContainerCompatibleRange<value_type> _Range>
- _LIBCPP_HIDE_FROM_ABI
- void insert_range(_Range&& __range) {
- const_iterator __end = cend();
- for (auto&& __element : __range) {
- __tree_.__insert_multi(__end.__i_, std::forward<decltype(__element)>(__element));
- }
+ template <_ContainerCompatibleRange<value_type> _Range>
+ _LIBCPP_HIDE_FROM_ABI void insert_range(_Range&& __range) {
+ const_iterator __end = cend();
+ for (auto&& __element : __range) {
+ __tree_.__insert_multi(__end.__i_, std::forward<decltype(__element)>(__element));
}
+ }
#endif
- _LIBCPP_HIDE_FROM_ABI
- iterator erase(const_iterator __p) {return __tree_.erase(__p.__i_);}
- _LIBCPP_HIDE_FROM_ABI
- iterator erase(iterator __p) {return __tree_.erase(__p.__i_);}
- _LIBCPP_HIDE_FROM_ABI
- size_type erase(const key_type& __k) {return __tree_.__erase_multi(__k);}
- _LIBCPP_HIDE_FROM_ABI
- iterator erase(const_iterator __f, const_iterator __l)
- {return __tree_.erase(__f.__i_, __l.__i_);}
+ _LIBCPP_HIDE_FROM_ABI iterator erase(const_iterator __p) { return __tree_.erase(__p.__i_); }
+ _LIBCPP_HIDE_FROM_ABI iterator erase(iterator __p) { return __tree_.erase(__p.__i_); }
+ _LIBCPP_HIDE_FROM_ABI size_type erase(const key_type& __k) { return __tree_.__erase_multi(__k); }
+ _LIBCPP_HIDE_FROM_ABI iterator erase(const_iterator __f, const_iterator __l) {
+ return __tree_.erase(__f.__i_, __l.__i_);
+ }
#if _LIBCPP_STD_VER >= 17
- _LIBCPP_HIDE_FROM_ABI
- iterator insert(node_type&& __nh)
- {
- _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(__nh.empty() || __nh.get_allocator() == get_allocator(),
- "node_type with incompatible allocator passed to multimap::insert()");
- return __tree_.template __node_handle_insert_multi<node_type>(
- std::move(__nh));
- }
- _LIBCPP_HIDE_FROM_ABI
- iterator insert(const_iterator __hint, node_type&& __nh)
- {
- _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(__nh.empty() || __nh.get_allocator() == get_allocator(),
- "node_type with incompatible allocator passed to multimap::insert()");
- return __tree_.template __node_handle_insert_multi<node_type>(
- __hint.__i_, std::move(__nh));
- }
- _LIBCPP_HIDE_FROM_ABI
- node_type extract(key_type const& __key)
- {
- return __tree_.template __node_handle_extract<node_type>(__key);
- }
- _LIBCPP_HIDE_FROM_ABI
- node_type extract(const_iterator __it)
- {
- return __tree_.template __node_handle_extract<node_type>(
- __it.__i_);
- }
- template <class _Compare2>
- _LIBCPP_HIDE_FROM_ABI
- void merge(multimap<key_type, mapped_type, _Compare2, allocator_type>& __source)
- {
- _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(__source.get_allocator() == get_allocator(),
- "merging container with incompatible allocator");
- return __tree_.__node_handle_merge_multi(__source.__tree_);
- }
- template <class _Compare2>
- _LIBCPP_HIDE_FROM_ABI
- void merge(multimap<key_type, mapped_type, _Compare2, allocator_type>&& __source)
- {
- _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(__source.get_allocator() == get_allocator(),
- "merging container with incompatible allocator");
- return __tree_.__node_handle_merge_multi(__source.__tree_);
- }
- template <class _Compare2>
- _LIBCPP_HIDE_FROM_ABI
- void merge(map<key_type, mapped_type, _Compare2, allocator_type>& __source)
- {
- _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(__source.get_allocator() == get_allocator(),
- "merging container with incompatible allocator");
- return __tree_.__node_handle_merge_multi(__source.__tree_);
- }
- template <class _Compare2>
- _LIBCPP_HIDE_FROM_ABI
- void merge(map<key_type, mapped_type, _Compare2, allocator_type>&& __source)
- {
- _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(__source.get_allocator() == get_allocator(),
- "merging container with incompatible allocator");
- return __tree_.__node_handle_merge_multi(__source.__tree_);
- }
+ _LIBCPP_HIDE_FROM_ABI iterator insert(node_type&& __nh) {
+ _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(__nh.empty() || __nh.get_allocator() == get_allocator(),
+ "node_type with incompatible allocator passed to multimap::insert()");
+ return __tree_.template __node_handle_insert_multi<node_type>(std::move(__nh));
+ }
+ _LIBCPP_HIDE_FROM_ABI iterator insert(const_iterator __hint, node_type&& __nh) {
+ _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(__nh.empty() || __nh.get_allocator() == get_allocator(),
+ "node_type with incompatible allocator passed to multimap::insert()");
+ return __tree_.template __node_handle_insert_multi<node_type>(__hint.__i_, std::move(__nh));
+ }
+ _LIBCPP_HIDE_FROM_ABI node_type extract(key_type const& __key) {
+ return __tree_.template __node_handle_extract<node_type>(__key);
+ }
+ _LIBCPP_HIDE_FROM_ABI node_type extract(const_iterator __it) {
+ return __tree_.template __node_handle_extract<node_type>(__it.__i_);
+ }
+ template <class _Compare2>
+ _LIBCPP_HIDE_FROM_ABI void merge(multimap<key_type, mapped_type, _Compare2, allocator_type>& __source) {
+ _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(
+ __source.get_allocator() == get_allocator(), "merging container with incompatible allocator");
+ return __tree_.__node_handle_merge_multi(__source.__tree_);
+ }
+ template <class _Compare2>
+ _LIBCPP_HIDE_FROM_ABI void merge(multimap<key_type, mapped_type, _Compare2, allocator_type>&& __source) {
+ _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(
+ __source.get_allocator() == get_allocator(), "merging container with incompatible allocator");
+ return __tree_.__node_handle_merge_multi(__source.__tree_);
+ }
+ template <class _Compare2>
+ _LIBCPP_HIDE_FROM_ABI void merge(map<key_type, mapped_type, _Compare2, allocator_type>& __source) {
+ _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(
+ __source.get_allocator() == get_allocator(), "merging container with incompatible allocator");
+ return __tree_.__node_handle_merge_multi(__source.__tree_);
+ }
+ template <class _Compare2>
+ _LIBCPP_HIDE_FROM_ABI void merge(map<key_type, mapped_type, _Compare2, allocator_type>&& __source) {
+ _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(
+ __source.get_allocator() == get_allocator(), "merging container with incompatible allocator");
+ return __tree_.__node_handle_merge_multi(__source.__tree_);
+ }
#endif
- _LIBCPP_HIDE_FROM_ABI
- void clear() _NOEXCEPT {__tree_.clear();}
+ _LIBCPP_HIDE_FROM_ABI void clear() _NOEXCEPT { __tree_.clear(); }
- _LIBCPP_HIDE_FROM_ABI
- void swap(multimap& __m)
- _NOEXCEPT_(__is_nothrow_swappable<__base>::value)
- {__tree_.swap(__m.__tree_);}
+ _LIBCPP_HIDE_FROM_ABI void swap(multimap& __m) _NOEXCEPT_(__is_nothrow_swappable<__base>::value) {
+ __tree_.swap(__m.__tree_);
+ }
- _LIBCPP_HIDE_FROM_ABI
- iterator find(const key_type& __k) {return __tree_.find(__k);}
- _LIBCPP_HIDE_FROM_ABI
- const_iterator find(const key_type& __k) const {return __tree_.find(__k);}
+ _LIBCPP_HIDE_FROM_ABI iterator find(const key_type& __k) { return __tree_.find(__k); }
+ _LIBCPP_HIDE_FROM_ABI const_iterator find(const key_type& __k) const { return __tree_.find(__k); }
#if _LIBCPP_STD_VER >= 14
- template <typename _K2, enable_if_t<__is_transparent<_Compare, _K2>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI
- iterator
- find(const _K2& __k) {return __tree_.find(__k);}
- template <typename _K2, enable_if_t<__is_transparent<_Compare, _K2>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI
- const_iterator
- find(const _K2& __k) const {return __tree_.find(__k);}
+ template <typename _K2, enable_if_t<__is_transparent<_Compare, _K2>::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI iterator find(const _K2& __k) {
+ return __tree_.find(__k);
+ }
+ template <typename _K2, enable_if_t<__is_transparent<_Compare, _K2>::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI const_iterator find(const _K2& __k) const {
+ return __tree_.find(__k);
+ }
#endif
- _LIBCPP_HIDE_FROM_ABI
- size_type count(const key_type& __k) const
- {return __tree_.__count_multi(__k);}
+ _LIBCPP_HIDE_FROM_ABI size_type count(const key_type& __k) const { return __tree_.__count_multi(__k); }
#if _LIBCPP_STD_VER >= 14
- template <typename _K2, enable_if_t<__is_transparent<_Compare, _K2>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI
- size_type
- count(const _K2& __k) const {return __tree_.__count_multi(__k);}
+ template <typename _K2, enable_if_t<__is_transparent<_Compare, _K2>::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI size_type count(const _K2& __k) const {
+ return __tree_.__count_multi(__k);
+ }
#endif
#if _LIBCPP_STD_VER >= 20
- _LIBCPP_HIDE_FROM_ABI
- bool contains(const key_type& __k) const {return find(__k) != end();}
- template <typename _K2, enable_if_t<__is_transparent<_Compare, _K2>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI
- bool
- contains(const _K2& __k) const { return find(__k) != end(); }
+ _LIBCPP_HIDE_FROM_ABI bool contains(const key_type& __k) const { return find(__k) != end(); }
+ template <typename _K2, enable_if_t<__is_transparent<_Compare, _K2>::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI bool contains(const _K2& __k) const {
+ return find(__k) != end();
+ }
#endif // _LIBCPP_STD_VER >= 20
- _LIBCPP_HIDE_FROM_ABI
- iterator lower_bound(const key_type& __k)
- {return __tree_.lower_bound(__k);}
- _LIBCPP_HIDE_FROM_ABI
- const_iterator lower_bound(const key_type& __k) const
- {return __tree_.lower_bound(__k);}
+ _LIBCPP_HIDE_FROM_ABI iterator lower_bound(const key_type& __k) { return __tree_.lower_bound(__k); }
+ _LIBCPP_HIDE_FROM_ABI const_iterator lower_bound(const key_type& __k) const { return __tree_.lower_bound(__k); }
#if _LIBCPP_STD_VER >= 14
- template <typename _K2, enable_if_t<__is_transparent<_Compare, _K2>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI
- iterator
- lower_bound(const _K2& __k) {return __tree_.lower_bound(__k);}
-
- template <typename _K2, enable_if_t<__is_transparent<_Compare, _K2>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI
- const_iterator
- lower_bound(const _K2& __k) const {return __tree_.lower_bound(__k);}
+ template <typename _K2, enable_if_t<__is_transparent<_Compare, _K2>::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI iterator lower_bound(const _K2& __k) {
+ return __tree_.lower_bound(__k);
+ }
+
+ template <typename _K2, enable_if_t<__is_transparent<_Compare, _K2>::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI const_iterator lower_bound(const _K2& __k) const {
+ return __tree_.lower_bound(__k);
+ }
#endif
- _LIBCPP_HIDE_FROM_ABI
- iterator upper_bound(const key_type& __k)
- {return __tree_.upper_bound(__k);}
- _LIBCPP_HIDE_FROM_ABI
- const_iterator upper_bound(const key_type& __k) const
- {return __tree_.upper_bound(__k);}
+ _LIBCPP_HIDE_FROM_ABI iterator upper_bound(const key_type& __k) { return __tree_.upper_bound(__k); }
+ _LIBCPP_HIDE_FROM_ABI const_iterator upper_bound(const key_type& __k) const { return __tree_.upper_bound(__k); }
#if _LIBCPP_STD_VER >= 14
- template <typename _K2, enable_if_t<__is_transparent<_Compare, _K2>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI
- iterator
- upper_bound(const _K2& __k) {return __tree_.upper_bound(__k);}
- template <typename _K2, enable_if_t<__is_transparent<_Compare, _K2>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI
- const_iterator
- upper_bound(const _K2& __k) const {return __tree_.upper_bound(__k);}
+ template <typename _K2, enable_if_t<__is_transparent<_Compare, _K2>::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI iterator upper_bound(const _K2& __k) {
+ return __tree_.upper_bound(__k);
+ }
+ template <typename _K2, enable_if_t<__is_transparent<_Compare, _K2>::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI const_iterator upper_bound(const _K2& __k) const {
+ return __tree_.upper_bound(__k);
+ }
#endif
- _LIBCPP_HIDE_FROM_ABI
- pair<iterator,iterator> equal_range(const key_type& __k)
- {return __tree_.__equal_range_multi(__k);}
- _LIBCPP_HIDE_FROM_ABI
- pair<const_iterator,const_iterator> equal_range(const key_type& __k) const
- {return __tree_.__equal_range_multi(__k);}
+ _LIBCPP_HIDE_FROM_ABI pair<iterator, iterator> equal_range(const key_type& __k) {
+ return __tree_.__equal_range_multi(__k);
+ }
+ _LIBCPP_HIDE_FROM_ABI pair<const_iterator, const_iterator> equal_range(const key_type& __k) const {
+ return __tree_.__equal_range_multi(__k);
+ }
#if _LIBCPP_STD_VER >= 14
- template <typename _K2, enable_if_t<__is_transparent<_Compare, _K2>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI
- pair<iterator,iterator>
- equal_range(const _K2& __k) {return __tree_.__equal_range_multi(__k);}
- template <typename _K2, enable_if_t<__is_transparent<_Compare, _K2>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI
- pair<const_iterator,const_iterator>
- equal_range(const _K2& __k) const {return __tree_.__equal_range_multi(__k);}
+ template <typename _K2, enable_if_t<__is_transparent<_Compare, _K2>::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI pair<iterator, iterator> equal_range(const _K2& __k) {
+ return __tree_.__equal_range_multi(__k);
+ }
+ template <typename _K2, enable_if_t<__is_transparent<_Compare, _K2>::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI pair<const_iterator, const_iterator> equal_range(const _K2& __k) const {
+ return __tree_.__equal_range_multi(__k);
+ }
#endif
private:
- typedef typename __base::__node __node;
- typedef typename __base::__node_allocator __node_allocator;
- typedef typename __base::__node_pointer __node_pointer;
+ typedef typename __base::__node __node;
+ typedef typename __base::__node_allocator __node_allocator;
+ typedef typename __base::__node_pointer __node_pointer;
- typedef __map_node_destructor<__node_allocator> _Dp;
- typedef unique_ptr<__node, _Dp> __node_holder;
+ typedef __map_node_destructor<__node_allocator> _Dp;
+ typedef unique_ptr<__node, _Dp> __node_holder;
};
#if _LIBCPP_STD_VER >= 17
-template<class _InputIterator, class _Compare = less<__iter_key_type<_InputIterator>>,
- class _Allocator = allocator<__iter_to_alloc_type<_InputIterator>>,
- class = enable_if_t<__has_input_iterator_category<_InputIterator>::value, void>,
- class = enable_if_t<!__is_allocator<_Compare>::value, void>,
- class = enable_if_t<__is_allocator<_Allocator>::value, void>>
+template <class _InputIterator,
+ class _Compare = less<__iter_key_type<_InputIterator>>,
+ class _Allocator = allocator<__iter_to_alloc_type<_InputIterator>>,
+ class = enable_if_t<__has_input_iterator_category<_InputIterator>::value, void>,
+ class = enable_if_t<!__is_allocator<_Compare>::value, void>,
+ class = enable_if_t<__is_allocator<_Allocator>::value, void>>
multimap(_InputIterator, _InputIterator, _Compare = _Compare(), _Allocator = _Allocator())
- -> multimap<__iter_key_type<_InputIterator>, __iter_mapped_type<_InputIterator>, _Compare, _Allocator>;
+ -> multimap<__iter_key_type<_InputIterator>, __iter_mapped_type<_InputIterator>, _Compare, _Allocator>;
-#if _LIBCPP_STD_VER >= 23
-template <ranges::input_range _Range, class _Compare = less<__range_key_type<_Range>>,
+# if _LIBCPP_STD_VER >= 23
+template <ranges::input_range _Range,
+ class _Compare = less<__range_key_type<_Range>>,
class _Allocator = allocator<__range_to_alloc_type<_Range>>,
- class = enable_if_t<!__is_allocator<_Compare>::value, void>,
- class = enable_if_t<__is_allocator<_Allocator>::value, void>>
+ class = enable_if_t<!__is_allocator<_Compare>::value, void>,
+ class = enable_if_t<__is_allocator<_Allocator>::value, void>>
multimap(from_range_t, _Range&&, _Compare = _Compare(), _Allocator = _Allocator())
- -> multimap<__range_key_type<_Range>, __range_mapped_type<_Range>, _Compare, _Allocator>;
-#endif
-
-template<class _Key, class _Tp, class _Compare = less<remove_const_t<_Key>>,
- class _Allocator = allocator<pair<const _Key, _Tp>>,
- class = enable_if_t<!__is_allocator<_Compare>::value, void>,
- class = enable_if_t<__is_allocator<_Allocator>::value, void>>
+ -> multimap<__range_key_type<_Range>, __range_mapped_type<_Range>, _Compare, _Allocator>;
+# endif
+
+template <class _Key,
+ class _Tp,
+ class _Compare = less<remove_const_t<_Key>>,
+ class _Allocator = allocator<pair<const _Key, _Tp>>,
+ class = enable_if_t<!__is_allocator<_Compare>::value, void>,
+ class = enable_if_t<__is_allocator<_Allocator>::value, void>>
multimap(initializer_list<pair<_Key, _Tp>>, _Compare = _Compare(), _Allocator = _Allocator())
- -> multimap<remove_const_t<_Key>, _Tp, _Compare, _Allocator>;
+ -> multimap<remove_const_t<_Key>, _Tp, _Compare, _Allocator>;
-template<class _InputIterator, class _Allocator,
- class = enable_if_t<__has_input_iterator_category<_InputIterator>::value, void>,
- class = enable_if_t<__is_allocator<_Allocator>::value, void>>
+template <class _InputIterator,
+ class _Allocator,
+ class = enable_if_t<__has_input_iterator_category<_InputIterator>::value, void>,
+ class = enable_if_t<__is_allocator<_Allocator>::value, void>>
multimap(_InputIterator, _InputIterator, _Allocator)
- -> multimap<__iter_key_type<_InputIterator>, __iter_mapped_type<_InputIterator>,
- less<__iter_key_type<_InputIterator>>, _Allocator>;
+ -> multimap<__iter_key_type<_InputIterator>,
+ __iter_mapped_type<_InputIterator>,
+ less<__iter_key_type<_InputIterator>>,
+ _Allocator>;
-#if _LIBCPP_STD_VER >= 23
-template <ranges::input_range _Range, class _Allocator,
- class = enable_if_t<__is_allocator<_Allocator>::value, void>>
+# if _LIBCPP_STD_VER >= 23
+template <ranges::input_range _Range, class _Allocator, class = enable_if_t<__is_allocator<_Allocator>::value, void>>
multimap(from_range_t, _Range&&, _Allocator)
- -> multimap<__range_key_type<_Range>, __range_mapped_type<_Range>, less<__range_key_type<_Range>>, _Allocator>;
-#endif
+ -> multimap<__range_key_type<_Range>, __range_mapped_type<_Range>, less<__range_key_type<_Range>>, _Allocator>;
+# endif
-template<class _Key, class _Tp, class _Allocator,
- class = enable_if_t<__is_allocator<_Allocator>::value, void>>
+template <class _Key, class _Tp, class _Allocator, class = enable_if_t<__is_allocator<_Allocator>::value, void>>
multimap(initializer_list<pair<_Key, _Tp>>, _Allocator)
- -> multimap<remove_const_t<_Key>, _Tp, less<remove_const_t<_Key>>, _Allocator>;
+ -> multimap<remove_const_t<_Key>, _Tp, less<remove_const_t<_Key>>, _Allocator>;
#endif
#ifndef _LIBCPP_CXX03_LANG
template <class _Key, class _Tp, class _Compare, class _Allocator>
multimap<_Key, _Tp, _Compare, _Allocator>::multimap(multimap&& __m, const allocator_type& __a)
- : __tree_(std::move(__m.__tree_), typename __base::allocator_type(__a))
-{
- if (__a != __m.get_allocator())
- {
- const_iterator __e = cend();
- while (!__m.empty())
- __tree_.__insert_multi(__e.__i_,
- std::move(__m.__tree_.remove(__m.begin().__i_)->__value_.__move()));
- }
+ : __tree_(std::move(__m.__tree_), typename __base::allocator_type(__a)) {
+ if (__a != __m.get_allocator()) {
+ const_iterator __e = cend();
+ while (!__m.empty())
+ __tree_.__insert_multi(__e.__i_, std::move(__m.__tree_.remove(__m.begin().__i_)->__value_.__move()));
+ }
}
#endif
template <class _Key, class _Tp, class _Compare, class _Allocator>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator==(const multimap<_Key, _Tp, _Compare, _Allocator>& __x,
- const multimap<_Key, _Tp, _Compare, _Allocator>& __y)
-{
- return __x.size() == __y.size() && std::equal(__x.begin(), __x.end(), __y.begin());
+inline _LIBCPP_HIDE_FROM_ABI bool
+operator==(const multimap<_Key, _Tp, _Compare, _Allocator>& __x, const multimap<_Key, _Tp, _Compare, _Allocator>& __y) {
+ return __x.size() == __y.size() && std::equal(__x.begin(), __x.end(), __y.begin());
}
#if _LIBCPP_STD_VER <= 17
template <class _Key, class _Tp, class _Compare, class _Allocator>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator< (const multimap<_Key, _Tp, _Compare, _Allocator>& __x,
- const multimap<_Key, _Tp, _Compare, _Allocator>& __y)
-{
- return std::lexicographical_compare(__x.begin(), __x.end(), __y.begin(), __y.end());
+inline _LIBCPP_HIDE_FROM_ABI bool
+operator<(const multimap<_Key, _Tp, _Compare, _Allocator>& __x, const multimap<_Key, _Tp, _Compare, _Allocator>& __y) {
+ return std::lexicographical_compare(__x.begin(), __x.end(), __y.begin(), __y.end());
}
template <class _Key, class _Tp, class _Compare, class _Allocator>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator!=(const multimap<_Key, _Tp, _Compare, _Allocator>& __x,
- const multimap<_Key, _Tp, _Compare, _Allocator>& __y)
-{
- return !(__x == __y);
+inline _LIBCPP_HIDE_FROM_ABI bool
+operator!=(const multimap<_Key, _Tp, _Compare, _Allocator>& __x, const multimap<_Key, _Tp, _Compare, _Allocator>& __y) {
+ return !(__x == __y);
}
template <class _Key, class _Tp, class _Compare, class _Allocator>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator> (const multimap<_Key, _Tp, _Compare, _Allocator>& __x,
- const multimap<_Key, _Tp, _Compare, _Allocator>& __y)
-{
- return __y < __x;
+inline _LIBCPP_HIDE_FROM_ABI bool
+operator>(const multimap<_Key, _Tp, _Compare, _Allocator>& __x, const multimap<_Key, _Tp, _Compare, _Allocator>& __y) {
+ return __y < __x;
}
template <class _Key, class _Tp, class _Compare, class _Allocator>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator>=(const multimap<_Key, _Tp, _Compare, _Allocator>& __x,
- const multimap<_Key, _Tp, _Compare, _Allocator>& __y)
-{
- return !(__x < __y);
+inline _LIBCPP_HIDE_FROM_ABI bool
+operator>=(const multimap<_Key, _Tp, _Compare, _Allocator>& __x, const multimap<_Key, _Tp, _Compare, _Allocator>& __y) {
+ return !(__x < __y);
}
template <class _Key, class _Tp, class _Compare, class _Allocator>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator<=(const multimap<_Key, _Tp, _Compare, _Allocator>& __x,
- const multimap<_Key, _Tp, _Compare, _Allocator>& __y)
-{
- return !(__y < __x);
+inline _LIBCPP_HIDE_FROM_ABI bool
+operator<=(const multimap<_Key, _Tp, _Compare, _Allocator>& __x, const multimap<_Key, _Tp, _Compare, _Allocator>& __y) {
+ return !(__y < __x);
}
#else // #if _LIBCPP_STD_VER <= 17
@@ -2481,33 +2141,27 @@ template <class _Key, class _Tp, class _Compare, class _Allocator>
_LIBCPP_HIDE_FROM_ABI __synth_three_way_result<pair<const _Key, _Tp>>
operator<=>(const multimap<_Key, _Tp, _Compare, _Allocator>& __x,
const multimap<_Key, _Tp, _Compare, _Allocator>& __y) {
- return std::lexicographical_compare_three_way(
- __x.begin(),
- __x.end(),
- __y.begin(),
- __y.end(),
- std::__synth_three_way<pair<const _Key, _Tp>, pair<const _Key, _Tp>>);
+ return std::lexicographical_compare_three_way(
+ __x.begin(),
+ __x.end(),
+ __y.begin(),
+ __y.end(),
+ std::__synth_three_way<pair<const _Key, _Tp>, pair<const _Key, _Tp>>);
}
#endif // #if _LIBCPP_STD_VER <= 17
template <class _Key, class _Tp, class _Compare, class _Allocator>
-inline _LIBCPP_HIDE_FROM_ABI
-void
-swap(multimap<_Key, _Tp, _Compare, _Allocator>& __x,
- multimap<_Key, _Tp, _Compare, _Allocator>& __y)
- _NOEXCEPT_(_NOEXCEPT_(__x.swap(__y)))
-{
- __x.swap(__y);
+inline _LIBCPP_HIDE_FROM_ABI void
+swap(multimap<_Key, _Tp, _Compare, _Allocator>& __x, multimap<_Key, _Tp, _Compare, _Allocator>& __y)
+ _NOEXCEPT_(_NOEXCEPT_(__x.swap(__y))) {
+ __x.swap(__y);
}
#if _LIBCPP_STD_VER >= 20
-template <class _Key, class _Tp, class _Compare, class _Allocator,
- class _Predicate>
-inline _LIBCPP_HIDE_FROM_ABI
- typename multimap<_Key, _Tp, _Compare, _Allocator>::size_type
- erase_if(multimap<_Key, _Tp, _Compare, _Allocator>& __c,
- _Predicate __pred) {
+template <class _Key, class _Tp, class _Compare, class _Allocator, class _Predicate>
+inline _LIBCPP_HIDE_FROM_ABI typename multimap<_Key, _Tp, _Compare, _Allocator>::size_type
+erase_if(multimap<_Key, _Tp, _Compare, _Allocator>& __c, _Predicate __pred) {
return std::__libcpp_erase_if_container(__c, __pred);
}
#endif
@@ -2518,10 +2172,12 @@ _LIBCPP_END_NAMESPACE_STD
_LIBCPP_BEGIN_NAMESPACE_STD
namespace pmr {
template <class _KeyT, class _ValueT, class _CompareT = std::less<_KeyT>>
-using map _LIBCPP_AVAILABILITY_PMR = std::map<_KeyT, _ValueT, _CompareT, polymorphic_allocator<std::pair<const _KeyT, _ValueT>>>;
+using map _LIBCPP_AVAILABILITY_PMR =
+ std::map<_KeyT, _ValueT, _CompareT, polymorphic_allocator<std::pair<const _KeyT, _ValueT>>>;
template <class _KeyT, class _ValueT, class _CompareT = std::less<_KeyT>>
-using multimap _LIBCPP_AVAILABILITY_PMR = std::multimap<_KeyT, _ValueT, _CompareT, polymorphic_allocator<std::pair<const _KeyT, _ValueT>>>;
+using multimap _LIBCPP_AVAILABILITY_PMR =
+ std::multimap<_KeyT, _ValueT, _CompareT, polymorphic_allocator<std::pair<const _KeyT, _ValueT>>>;
} // namespace pmr
_LIBCPP_END_NAMESPACE_STD
#endif
diff --git a/contrib/llvm-project/libcxx/include/math.h b/contrib/llvm-project/libcxx/include/math.h
index b068ea388f09..05989734c26c 100644
--- a/contrib/llvm-project/libcxx/include/math.h
+++ b/contrib/llvm-project/libcxx/include/math.h
@@ -8,7 +8,7 @@
//===----------------------------------------------------------------------===//
#ifndef _LIBCPP_MATH_H
-#define _LIBCPP_MATH_H
+# define _LIBCPP_MATH_H
/*
math.h synopsis
@@ -291,17 +291,17 @@ long double truncl(long double x);
*/
-#include <__config>
+# include <__config>
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
+# if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+# pragma GCC system_header
+# endif
# if __has_include_next(<math.h>)
# include_next <math.h>
# endif
-#ifdef __cplusplus
+# ifdef __cplusplus
// We support including .h headers inside 'extern "C"' contexts, so switch
// back to C++ linkage before including these C++ headers.
@@ -355,30 +355,29 @@ extern "C++" {
# undef isunordered
# endif
-#include <__math/abs.h>
-#include <__math/copysign.h>
-#include <__math/error_functions.h>
-#include <__math/exponential_functions.h>
-#include <__math/fdim.h>
-#include <__math/fma.h>
-#include <__math/gamma.h>
-#include <__math/hyperbolic_functions.h>
-#include <__math/hypot.h>
-#include <__math/inverse_hyperbolic_functions.h>
-#include <__math/inverse_trigonometric_functions.h>
-#include <__math/logarithms.h>
-#include <__math/min_max.h>
-#include <__math/modulo.h>
-#include <__math/remainder.h>
-#include <__math/roots.h>
-#include <__math/rounding_functions.h>
-#include <__math/traits.h>
-#include <__math/trigonometric_functions.h>
-#include <__type_traits/enable_if.h>
-#include <__type_traits/is_floating_point.h>
-#include <__type_traits/is_integral.h>
-#include <stdlib.h>
-
+# include <__math/abs.h>
+# include <__math/copysign.h>
+# include <__math/error_functions.h>
+# include <__math/exponential_functions.h>
+# include <__math/fdim.h>
+# include <__math/fma.h>
+# include <__math/gamma.h>
+# include <__math/hyperbolic_functions.h>
+# include <__math/hypot.h>
+# include <__math/inverse_hyperbolic_functions.h>
+# include <__math/inverse_trigonometric_functions.h>
+# include <__math/logarithms.h>
+# include <__math/min_max.h>
+# include <__math/modulo.h>
+# include <__math/remainder.h>
+# include <__math/roots.h>
+# include <__math/rounding_functions.h>
+# include <__math/traits.h>
+# include <__math/trigonometric_functions.h>
+# include <__type_traits/enable_if.h>
+# include <__type_traits/is_floating_point.h>
+# include <__type_traits/is_integral.h>
+# include <stdlib.h>
// fpclassify relies on implementation-defined constants, so we can't move it to a detail header
_LIBCPP_BEGIN_NAMESPACE_STD
@@ -416,7 +415,7 @@ using std::__math::fpclassify;
using std::__math::signbit;
// The MSVC runtime already provides these functions as templates
-#ifndef _LIBCPP_MSVCRT
+# ifndef _LIBCPP_MSVCRT
using std::__math::isfinite;
using std::__math::isgreater;
using std::__math::isgreaterequal;
@@ -427,7 +426,7 @@ using std::__math::islessgreater;
using std::__math::isnan;
using std::__math::isnormal;
using std::__math::isunordered;
-#endif // _LIBCPP_MSVCRT
+# endif // _LIBCPP_MSVCRT
// abs
//
@@ -442,13 +441,13 @@ using std::__math::isunordered;
// templates. Functions are preferred over function templates during overload resolution, which means that our overload
// will only be selected when the C library doesn't provide one.
-using std::__math::acosh;
using std::__math::acos;
-using std::__math::asinh;
+using std::__math::acosh;
using std::__math::asin;
-using std::__math::atanh;
+using std::__math::asinh;
using std::__math::atan;
using std::__math::atan2;
+using std::__math::atanh;
using std::__math::cbrt;
using std::__math::ceil;
using std::__math::copysign;
@@ -473,13 +472,13 @@ using std::__math::ldexp;
using std::__math::lgamma;
using std::__math::llrint;
using std::__math::llround;
-using std::__math::lrint;
-using std::__math::lround;
using std::__math::log;
using std::__math::log10;
using std::__math::log1p;
using std::__math::log2;
using std::__math::logb;
+using std::__math::lrint;
+using std::__math::lround;
using std::__math::modf;
using std::__math::nearbyint;
using std::__math::nextafter;
@@ -502,7 +501,7 @@ using std::__math::trunc;
} // extern "C++"
-#endif // __cplusplus
+# endif // __cplusplus
#else // _LIBCPP_MATH_H
@@ -514,8 +513,8 @@ using std::__math::trunc;
//
// and receive the definitions of mathematical constants, even if <math.h>
// has previously been included.
-#if defined(_LIBCPP_MSVCRT) && defined(_USE_MATH_DEFINES)
-#include_next <math.h>
-#endif
+# if defined(_LIBCPP_MSVCRT) && defined(_USE_MATH_DEFINES)
+# include_next <math.h>
+# endif
#endif // _LIBCPP_MATH_H
diff --git a/contrib/llvm-project/libcxx/include/module.modulemap.in b/contrib/llvm-project/libcxx/include/module.modulemap.in
index 5f57a8a2b1bf..d10670d4faaf 100644
--- a/contrib/llvm-project/libcxx/include/module.modulemap.in
+++ b/contrib/llvm-project/libcxx/include/module.modulemap.in
@@ -530,10 +530,8 @@ module std_experimental [system] {
export *
}
module simd {
- module abi_tag { private header "experimental/__simd/abi_tag.h" }
module aligned_tag { private header "experimental/__simd/aligned_tag.h" }
module declaration { private header "experimental/__simd/declaration.h" }
- module internal_declaration { private header "experimental/__simd/internal_declaration.h" }
module reference { private header "experimental/__simd/reference.h" }
module scalar { private header "experimental/__simd/scalar.h" }
module simd { private header "experimental/__simd/simd.h" }
@@ -666,6 +664,7 @@ module std_private_algorithm_find_first_of [system
module std_private_algorithm_find_if [system] { header "__algorithm/find_if.h" }
module std_private_algorithm_find_if_not [system] { header "__algorithm/find_if_not.h" }
module std_private_algorithm_find_segment_if [system] { header "__algorithm/find_segment_if.h" }
+module std_private_algorithm_fold [system] { header "__algorithm/fold.h" }
module std_private_algorithm_for_each [system] { header "__algorithm/for_each.h" }
module std_private_algorithm_for_each_n [system] { header "__algorithm/for_each_n.h" }
module std_private_algorithm_for_each_segment [system] { header "__algorithm/for_each_segment.h" }
@@ -787,6 +786,7 @@ module std_private_algorithm_ranges_clamp [system
header "__algorithm/ranges_clamp.h"
export std_private_functional_ranges_operations
}
+module std_private_algorithm_ranges_contains [system] { header "__algorithm/ranges_contains.h" }
module std_private_algorithm_ranges_copy [system] {
header "__algorithm/ranges_copy.h"
export std_private_algorithm_in_out_result
diff --git a/contrib/llvm-project/libcxx/include/mutex b/contrib/llvm-project/libcxx/include/mutex
index a15e61de04c9..a16ef589c697 100644
--- a/contrib/llvm-project/libcxx/include/mutex
+++ b/contrib/llvm-project/libcxx/include/mutex
@@ -203,7 +203,7 @@ template<class Callable, class ...Args>
#include <cstddef>
#include <limits>
#ifndef _LIBCPP_CXX03_LANG
-# include <tuple>
+# include <tuple>
#endif
#include <version>
@@ -214,347 +214,300 @@ template<class Callable, class ...Args>
_LIBCPP_PUSH_MACROS
#include <__undef_macros>
-
_LIBCPP_BEGIN_NAMESPACE_STD
#ifndef _LIBCPP_HAS_NO_THREADS
-class _LIBCPP_EXPORTED_FROM_ABI recursive_mutex
-{
- __libcpp_recursive_mutex_t __m_;
+class _LIBCPP_EXPORTED_FROM_ABI recursive_mutex {
+ __libcpp_recursive_mutex_t __m_;
public:
- recursive_mutex();
- ~recursive_mutex();
+ recursive_mutex();
+ ~recursive_mutex();
- recursive_mutex(const recursive_mutex&) = delete;
- recursive_mutex& operator=(const recursive_mutex&) = delete;
+ recursive_mutex(const recursive_mutex&) = delete;
+ recursive_mutex& operator=(const recursive_mutex&) = delete;
- void lock();
- bool try_lock() _NOEXCEPT;
- void unlock() _NOEXCEPT;
+ void lock();
+ bool try_lock() _NOEXCEPT;
+ void unlock() _NOEXCEPT;
- typedef __libcpp_recursive_mutex_t* native_handle_type;
+ typedef __libcpp_recursive_mutex_t* native_handle_type;
- _LIBCPP_HIDE_FROM_ABI
- native_handle_type native_handle() {return &__m_;}
+ _LIBCPP_HIDE_FROM_ABI native_handle_type native_handle() { return &__m_; }
};
-class _LIBCPP_EXPORTED_FROM_ABI timed_mutex
-{
- mutex __m_;
- condition_variable __cv_;
- bool __locked_;
+class _LIBCPP_EXPORTED_FROM_ABI timed_mutex {
+ mutex __m_;
+ condition_variable __cv_;
+ bool __locked_;
+
public:
- timed_mutex();
- ~timed_mutex();
+ timed_mutex();
+ ~timed_mutex();
- timed_mutex(const timed_mutex&) = delete;
- timed_mutex& operator=(const timed_mutex&) = delete;
+ timed_mutex(const timed_mutex&) = delete;
+ timed_mutex& operator=(const timed_mutex&) = delete;
public:
- void lock();
- bool try_lock() _NOEXCEPT;
- template <class _Rep, class _Period>
- _LIBCPP_HIDE_FROM_ABI
- bool try_lock_for(const chrono::duration<_Rep, _Period>& __d)
- {return try_lock_until(chrono::steady_clock::now() + __d);}
- template <class _Clock, class _Duration>
- _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
- bool try_lock_until(const chrono::time_point<_Clock, _Duration>& __t);
- void unlock() _NOEXCEPT;
+ void lock();
+ bool try_lock() _NOEXCEPT;
+ template <class _Rep, class _Period>
+ _LIBCPP_HIDE_FROM_ABI bool try_lock_for(const chrono::duration<_Rep, _Period>& __d) {
+ return try_lock_until(chrono::steady_clock::now() + __d);
+ }
+ template <class _Clock, class _Duration>
+ _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS bool
+ try_lock_until(const chrono::time_point<_Clock, _Duration>& __t);
+ void unlock() _NOEXCEPT;
};
template <class _Clock, class _Duration>
-bool
-timed_mutex::try_lock_until(const chrono::time_point<_Clock, _Duration>& __t)
-{
- using namespace chrono;
- unique_lock<mutex> __lk(__m_);
- bool __no_timeout = _Clock::now() < __t;
- while (__no_timeout && __locked_)
- __no_timeout = __cv_.wait_until(__lk, __t) == cv_status::no_timeout;
- if (!__locked_)
- {
- __locked_ = true;
- return true;
- }
- return false;
+bool timed_mutex::try_lock_until(const chrono::time_point<_Clock, _Duration>& __t) {
+ using namespace chrono;
+ unique_lock<mutex> __lk(__m_);
+ bool __no_timeout = _Clock::now() < __t;
+ while (__no_timeout && __locked_)
+ __no_timeout = __cv_.wait_until(__lk, __t) == cv_status::no_timeout;
+ if (!__locked_) {
+ __locked_ = true;
+ return true;
+ }
+ return false;
}
-class _LIBCPP_EXPORTED_FROM_ABI recursive_timed_mutex
-{
- mutex __m_;
- condition_variable __cv_;
- size_t __count_;
- __thread_id __id_;
-public:
- recursive_timed_mutex();
- ~recursive_timed_mutex();
-
- recursive_timed_mutex(const recursive_timed_mutex&) = delete;
- recursive_timed_mutex& operator=(const recursive_timed_mutex&) = delete;
+class _LIBCPP_EXPORTED_FROM_ABI recursive_timed_mutex {
+ mutex __m_;
+ condition_variable __cv_;
+ size_t __count_;
+ __thread_id __id_;
- void lock();
- bool try_lock() _NOEXCEPT;
- template <class _Rep, class _Period>
- _LIBCPP_HIDE_FROM_ABI
- bool try_lock_for(const chrono::duration<_Rep, _Period>& __d)
- {return try_lock_until(chrono::steady_clock::now() + __d);}
- template <class _Clock, class _Duration>
- _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
- bool try_lock_until(const chrono::time_point<_Clock, _Duration>& __t);
- void unlock() _NOEXCEPT;
+public:
+ recursive_timed_mutex();
+ ~recursive_timed_mutex();
+
+ recursive_timed_mutex(const recursive_timed_mutex&) = delete;
+ recursive_timed_mutex& operator=(const recursive_timed_mutex&) = delete;
+
+ void lock();
+ bool try_lock() _NOEXCEPT;
+ template <class _Rep, class _Period>
+ _LIBCPP_HIDE_FROM_ABI bool try_lock_for(const chrono::duration<_Rep, _Period>& __d) {
+ return try_lock_until(chrono::steady_clock::now() + __d);
+ }
+ template <class _Clock, class _Duration>
+ _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS bool
+ try_lock_until(const chrono::time_point<_Clock, _Duration>& __t);
+ void unlock() _NOEXCEPT;
};
template <class _Clock, class _Duration>
-bool
-recursive_timed_mutex::try_lock_until(const chrono::time_point<_Clock, _Duration>& __t)
-{
- using namespace chrono;
- __thread_id __id = this_thread::get_id();
- unique_lock<mutex> __lk(__m_);
- if (__id == __id_)
- {
- if (__count_ == numeric_limits<size_t>::max())
- return false;
- ++__count_;
- return true;
- }
- bool __no_timeout = _Clock::now() < __t;
- while (__no_timeout && __count_ != 0)
- __no_timeout = __cv_.wait_until(__lk, __t) == cv_status::no_timeout;
- if (__count_ == 0)
- {
- __count_ = 1;
- __id_ = __id;
- return true;
- }
- return false;
+bool recursive_timed_mutex::try_lock_until(const chrono::time_point<_Clock, _Duration>& __t) {
+ using namespace chrono;
+ __thread_id __id = this_thread::get_id();
+ unique_lock<mutex> __lk(__m_);
+ if (__id == __id_) {
+ if (__count_ == numeric_limits<size_t>::max())
+ return false;
+ ++__count_;
+ return true;
+ }
+ bool __no_timeout = _Clock::now() < __t;
+ while (__no_timeout && __count_ != 0)
+ __no_timeout = __cv_.wait_until(__lk, __t) == cv_status::no_timeout;
+ if (__count_ == 0) {
+ __count_ = 1;
+ __id_ = __id;
+ return true;
+ }
+ return false;
}
template <class _L0, class _L1>
-_LIBCPP_HIDE_FROM_ABI int
-try_lock(_L0& __l0, _L1& __l1)
-{
- unique_lock<_L0> __u0(__l0, try_to_lock_t());
- if (__u0.owns_lock())
- {
- if (__l1.try_lock())
- {
- __u0.release();
- return -1;
- }
- else
- return 1;
- }
- return 0;
+_LIBCPP_HIDE_FROM_ABI int try_lock(_L0& __l0, _L1& __l1) {
+ unique_lock<_L0> __u0(__l0, try_to_lock_t());
+ if (__u0.owns_lock()) {
+ if (__l1.try_lock()) {
+ __u0.release();
+ return -1;
+ } else
+ return 1;
+ }
+ return 0;
}
-#ifndef _LIBCPP_CXX03_LANG
+# ifndef _LIBCPP_CXX03_LANG
template <class _L0, class _L1, class _L2, class... _L3>
-_LIBCPP_HIDE_FROM_ABI int
-try_lock(_L0& __l0, _L1& __l1, _L2& __l2, _L3&... __l3)
-{
- int __r = 0;
- unique_lock<_L0> __u0(__l0, try_to_lock);
- if (__u0.owns_lock())
- {
- __r = std::try_lock(__l1, __l2, __l3...);
- if (__r == -1)
- __u0.release();
- else
- ++__r;
- }
- return __r;
+_LIBCPP_HIDE_FROM_ABI int try_lock(_L0& __l0, _L1& __l1, _L2& __l2, _L3&... __l3) {
+ int __r = 0;
+ unique_lock<_L0> __u0(__l0, try_to_lock);
+ if (__u0.owns_lock()) {
+ __r = std::try_lock(__l1, __l2, __l3...);
+ if (__r == -1)
+ __u0.release();
+ else
+ ++__r;
+ }
+ return __r;
}
-#endif // _LIBCPP_CXX03_LANG
+# endif // _LIBCPP_CXX03_LANG
template <class _L0, class _L1>
-_LIBCPP_HIDE_FROM_ABI void
-lock(_L0& __l0, _L1& __l1)
-{
- while (true)
+_LIBCPP_HIDE_FROM_ABI void lock(_L0& __l0, _L1& __l1) {
+ while (true) {
{
- {
- unique_lock<_L0> __u0(__l0);
- if (__l1.try_lock())
- {
- __u0.release();
- break;
- }
- }
- __libcpp_thread_yield();
- {
- unique_lock<_L1> __u1(__l1);
- if (__l0.try_lock())
- {
- __u1.release();
- break;
- }
- }
- __libcpp_thread_yield();
+ unique_lock<_L0> __u0(__l0);
+ if (__l1.try_lock()) {
+ __u0.release();
+ break;
+ }
}
+ __libcpp_thread_yield();
+ {
+ unique_lock<_L1> __u1(__l1);
+ if (__l0.try_lock()) {
+ __u1.release();
+ break;
+ }
+ }
+ __libcpp_thread_yield();
+ }
}
-#ifndef _LIBCPP_CXX03_LANG
+# ifndef _LIBCPP_CXX03_LANG
-template <class _L0, class _L1, class _L2, class ..._L3>
-void
-__lock_first(int __i, _L0& __l0, _L1& __l1, _L2& __l2, _L3& ...__l3)
-{
- while (true)
- {
- switch (__i)
- {
- case 0:
- {
- unique_lock<_L0> __u0(__l0);
- __i = std::try_lock(__l1, __l2, __l3...);
- if (__i == -1)
- {
- __u0.release();
- return;
- }
- }
- ++__i;
- __libcpp_thread_yield();
- break;
- case 1:
- {
- unique_lock<_L1> __u1(__l1);
- __i = std::try_lock(__l2, __l3..., __l0);
- if (__i == -1)
- {
- __u1.release();
- return;
- }
- }
- if (__i == sizeof...(_L3) + 1)
- __i = 0;
- else
- __i += 2;
- __libcpp_thread_yield();
- break;
- default:
- std::__lock_first(__i - 2, __l2, __l3..., __l0, __l1);
- return;
- }
+template <class _L0, class _L1, class _L2, class... _L3>
+void __lock_first(int __i, _L0& __l0, _L1& __l1, _L2& __l2, _L3&... __l3) {
+ while (true) {
+ switch (__i) {
+ case 0: {
+ unique_lock<_L0> __u0(__l0);
+ __i = std::try_lock(__l1, __l2, __l3...);
+ if (__i == -1) {
+ __u0.release();
+ return;
+ }
+ }
+ ++__i;
+ __libcpp_thread_yield();
+ break;
+ case 1: {
+ unique_lock<_L1> __u1(__l1);
+ __i = std::try_lock(__l2, __l3..., __l0);
+ if (__i == -1) {
+ __u1.release();
+ return;
+ }
+ }
+ if (__i == sizeof...(_L3) + 1)
+ __i = 0;
+ else
+ __i += 2;
+ __libcpp_thread_yield();
+ break;
+ default:
+ std::__lock_first(__i - 2, __l2, __l3..., __l0, __l1);
+ return;
}
+ }
}
-template <class _L0, class _L1, class _L2, class ..._L3>
-inline _LIBCPP_HIDE_FROM_ABI
-void
-lock(_L0& __l0, _L1& __l1, _L2& __l2, _L3& ...__l3)
-{
- std::__lock_first(0, __l0, __l1, __l2, __l3...);
+template <class _L0, class _L1, class _L2, class... _L3>
+inline _LIBCPP_HIDE_FROM_ABI void lock(_L0& __l0, _L1& __l1, _L2& __l2, _L3&... __l3) {
+ std::__lock_first(0, __l0, __l1, __l2, __l3...);
}
template <class _L0>
-inline _LIBCPP_HIDE_FROM_ABI
-void __unlock(_L0& __l0) {
- __l0.unlock();
+inline _LIBCPP_HIDE_FROM_ABI void __unlock(_L0& __l0) {
+ __l0.unlock();
}
template <class _L0, class _L1>
-inline _LIBCPP_HIDE_FROM_ABI
-void __unlock(_L0& __l0, _L1& __l1) {
- __l0.unlock();
- __l1.unlock();
+inline _LIBCPP_HIDE_FROM_ABI void __unlock(_L0& __l0, _L1& __l1) {
+ __l0.unlock();
+ __l1.unlock();
}
-template <class _L0, class _L1, class _L2, class ..._L3>
-inline _LIBCPP_HIDE_FROM_ABI
-void __unlock(_L0& __l0, _L1& __l1, _L2& __l2, _L3&... __l3) {
- __l0.unlock();
- __l1.unlock();
- std::__unlock(__l2, __l3...);
+template <class _L0, class _L1, class _L2, class... _L3>
+inline _LIBCPP_HIDE_FROM_ABI void __unlock(_L0& __l0, _L1& __l1, _L2& __l2, _L3&... __l3) {
+ __l0.unlock();
+ __l1.unlock();
+ std::__unlock(__l2, __l3...);
}
-#endif // _LIBCPP_CXX03_LANG
+# endif // _LIBCPP_CXX03_LANG
-#if _LIBCPP_STD_VER >= 17
-template <class ..._Mutexes>
+# if _LIBCPP_STD_VER >= 17
+template <class... _Mutexes>
class _LIBCPP_TEMPLATE_VIS scoped_lock;
template <>
class _LIBCPP_TEMPLATE_VIS scoped_lock<> {
public:
- explicit scoped_lock() {}
- ~scoped_lock() = default;
+ explicit scoped_lock() {}
+ ~scoped_lock() = default;
- _LIBCPP_HIDE_FROM_ABI
- explicit scoped_lock(adopt_lock_t) {}
+ _LIBCPP_HIDE_FROM_ABI explicit scoped_lock(adopt_lock_t) {}
- scoped_lock(scoped_lock const&) = delete;
- scoped_lock& operator=(scoped_lock const&) = delete;
+ scoped_lock(scoped_lock const&) = delete;
+ scoped_lock& operator=(scoped_lock const&) = delete;
};
template <class _Mutex>
class _LIBCPP_TEMPLATE_VIS _LIBCPP_THREAD_SAFETY_ANNOTATION(scoped_lockable) scoped_lock<_Mutex> {
public:
- typedef _Mutex mutex_type;
+ typedef _Mutex mutex_type;
+
private:
- mutex_type& __m_;
+ mutex_type& __m_;
+
public:
- explicit scoped_lock(mutex_type & __m) _LIBCPP_THREAD_SAFETY_ANNOTATION(acquire_capability(__m))
- : __m_(__m) {__m_.lock();}
+ explicit scoped_lock(mutex_type& __m) _LIBCPP_THREAD_SAFETY_ANNOTATION(acquire_capability(__m)) : __m_(__m) {
+ __m_.lock();
+ }
- ~scoped_lock() _LIBCPP_THREAD_SAFETY_ANNOTATION(release_capability()) {__m_.unlock();}
+ ~scoped_lock() _LIBCPP_THREAD_SAFETY_ANNOTATION(release_capability()) { __m_.unlock(); }
- _LIBCPP_HIDE_FROM_ABI
- explicit scoped_lock(adopt_lock_t, mutex_type& __m) _LIBCPP_THREAD_SAFETY_ANNOTATION(requires_capability(__m))
- : __m_(__m) {}
+ _LIBCPP_HIDE_FROM_ABI explicit scoped_lock(adopt_lock_t, mutex_type& __m)
+ _LIBCPP_THREAD_SAFETY_ANNOTATION(requires_capability(__m))
+ : __m_(__m) {}
- scoped_lock(scoped_lock const&) = delete;
- scoped_lock& operator=(scoped_lock const&) = delete;
+ scoped_lock(scoped_lock const&) = delete;
+ scoped_lock& operator=(scoped_lock const&) = delete;
};
-template <class ..._MArgs>
-class _LIBCPP_TEMPLATE_VIS scoped_lock
-{
- static_assert(sizeof...(_MArgs) > 1, "At least 2 lock types required");
- typedef tuple<_MArgs&...> _MutexTuple;
+template <class... _MArgs>
+class _LIBCPP_TEMPLATE_VIS scoped_lock {
+ static_assert(sizeof...(_MArgs) > 1, "At least 2 lock types required");
+ typedef tuple<_MArgs&...> _MutexTuple;
public:
- _LIBCPP_HIDE_FROM_ABI
- explicit scoped_lock(_MArgs&... __margs)
- : __t_(__margs...)
- {
- std::lock(__margs...);
- }
+ _LIBCPP_HIDE_FROM_ABI explicit scoped_lock(_MArgs&... __margs) : __t_(__margs...) { std::lock(__margs...); }
- _LIBCPP_HIDE_FROM_ABI
- scoped_lock(adopt_lock_t, _MArgs&... __margs)
- : __t_(__margs...)
- {
- }
+ _LIBCPP_HIDE_FROM_ABI scoped_lock(adopt_lock_t, _MArgs&... __margs) : __t_(__margs...) {}
- _LIBCPP_HIDE_FROM_ABI
- ~scoped_lock() {
- typedef typename __make_tuple_indices<sizeof...(_MArgs)>::type _Indices;
- __unlock_unpack(_Indices{}, __t_);
- }
+ _LIBCPP_HIDE_FROM_ABI ~scoped_lock() {
+ typedef typename __make_tuple_indices<sizeof...(_MArgs)>::type _Indices;
+ __unlock_unpack(_Indices{}, __t_);
+ }
- scoped_lock(scoped_lock const&) = delete;
- scoped_lock& operator=(scoped_lock const&) = delete;
+ scoped_lock(scoped_lock const&) = delete;
+ scoped_lock& operator=(scoped_lock const&) = delete;
private:
- template <size_t ..._Indx>
- _LIBCPP_HIDE_FROM_ABI
- static void __unlock_unpack(__tuple_indices<_Indx...>, _MutexTuple& __mt) {
- std::__unlock(std::get<_Indx>(__mt)...);
- }
+ template <size_t... _Indx>
+ _LIBCPP_HIDE_FROM_ABI static void __unlock_unpack(__tuple_indices<_Indx...>, _MutexTuple& __mt) {
+ std::__unlock(std::get<_Indx>(__mt)...);
+ }
- _MutexTuple __t_;
+ _MutexTuple __t_;
};
_LIBCPP_CTAD_SUPPORTED_FOR_TYPE(scoped_lock);
-#endif // _LIBCPP_STD_VER >= 17
-#endif // !_LIBCPP_HAS_NO_THREADS
+# endif // _LIBCPP_STD_VER >= 17
+#endif // !_LIBCPP_HAS_NO_THREADS
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/new b/contrib/llvm-project/libcxx/include/new
index 18f397219c14..136adc41c24b 100644
--- a/contrib/llvm-project/libcxx/include/new
+++ b/contrib/llvm-project/libcxx/include/new
@@ -97,54 +97,50 @@ void operator delete[](void* ptr, void*) noexcept;
#include <version>
#if defined(_LIBCPP_ABI_VCRUNTIME)
-#include <new.h>
+# include <new.h>
#endif
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
#endif
-#if !defined(__cpp_sized_deallocation) || __cpp_sized_deallocation < 201309L
-#define _LIBCPP_HAS_NO_LANGUAGE_SIZED_DEALLOCATION
+#if !defined(__cpp_sized_deallocation) || __cpp_sized_deallocation < 201309L
+# define _LIBCPP_HAS_NO_LANGUAGE_SIZED_DEALLOCATION
#endif
-#if !defined(_LIBCPP_BUILDING_LIBRARY) && _LIBCPP_STD_VER < 14 && \
- defined(_LIBCPP_HAS_NO_LANGUAGE_SIZED_DEALLOCATION)
-# define _LIBCPP_HAS_NO_LIBRARY_SIZED_DEALLOCATION
+#if !defined(_LIBCPP_BUILDING_LIBRARY) && _LIBCPP_STD_VER < 14 && defined(_LIBCPP_HAS_NO_LANGUAGE_SIZED_DEALLOCATION)
+# define _LIBCPP_HAS_NO_LIBRARY_SIZED_DEALLOCATION
#endif
-#if defined(_LIBCPP_HAS_NO_LIBRARY_SIZED_DEALLOCATION) || \
- defined(_LIBCPP_HAS_NO_LANGUAGE_SIZED_DEALLOCATION)
-# define _LIBCPP_HAS_NO_SIZED_DEALLOCATION
+#if defined(_LIBCPP_HAS_NO_LIBRARY_SIZED_DEALLOCATION) || defined(_LIBCPP_HAS_NO_LANGUAGE_SIZED_DEALLOCATION)
+# define _LIBCPP_HAS_NO_SIZED_DEALLOCATION
#endif
-namespace std // purposefully not using versioning namespace
+namespace std // purposefully not using versioning namespace
{
#if !defined(_LIBCPP_ABI_VCRUNTIME)
-struct _LIBCPP_EXPORTED_FROM_ABI nothrow_t { explicit nothrow_t() = default; };
+struct _LIBCPP_EXPORTED_FROM_ABI nothrow_t {
+ explicit nothrow_t() = default;
+};
extern _LIBCPP_EXPORTED_FROM_ABI const nothrow_t nothrow;
-class _LIBCPP_EXPORTED_FROM_ABI bad_alloc
- : public exception
-{
+class _LIBCPP_EXPORTED_FROM_ABI bad_alloc : public exception {
public:
- bad_alloc() _NOEXCEPT;
- _LIBCPP_HIDE_FROM_ABI bad_alloc(const bad_alloc&) _NOEXCEPT = default;
- _LIBCPP_HIDE_FROM_ABI bad_alloc& operator=(const bad_alloc&) _NOEXCEPT = default;
- ~bad_alloc() _NOEXCEPT override;
- const char* what() const _NOEXCEPT override;
+ bad_alloc() _NOEXCEPT;
+ _LIBCPP_HIDE_FROM_ABI bad_alloc(const bad_alloc&) _NOEXCEPT = default;
+ _LIBCPP_HIDE_FROM_ABI bad_alloc& operator=(const bad_alloc&) _NOEXCEPT = default;
+ ~bad_alloc() _NOEXCEPT override;
+ const char* what() const _NOEXCEPT override;
};
-class _LIBCPP_EXPORTED_FROM_ABI bad_array_new_length
- : public bad_alloc
-{
+class _LIBCPP_EXPORTED_FROM_ABI bad_array_new_length : public bad_alloc {
public:
- bad_array_new_length() _NOEXCEPT;
- _LIBCPP_HIDE_FROM_ABI bad_array_new_length(const bad_array_new_length&) _NOEXCEPT = default;
- _LIBCPP_HIDE_FROM_ABI bad_array_new_length& operator=(const bad_array_new_length&) _NOEXCEPT = default;
- ~bad_array_new_length() _NOEXCEPT override;
- const char* what() const _NOEXCEPT override;
+ bad_array_new_length() _NOEXCEPT;
+ _LIBCPP_HIDE_FROM_ABI bad_array_new_length(const bad_array_new_length&) _NOEXCEPT = default;
+ _LIBCPP_HIDE_FROM_ABI bad_array_new_length& operator=(const bad_array_new_length&) _NOEXCEPT = default;
+ ~bad_array_new_length() _NOEXCEPT override;
+ const char* what() const _NOEXCEPT override;
};
typedef void (*new_handler)();
@@ -171,25 +167,22 @@ public:
};
#endif // defined(_LIBCPP_ABI_VCRUNTIME) && defined(_HAS_EXCEPTIONS) && _HAS_EXCEPTIONS == 0
-_LIBCPP_NORETURN _LIBCPP_EXPORTED_FROM_ABI void __throw_bad_alloc(); // not in C++ spec
+_LIBCPP_NORETURN _LIBCPP_EXPORTED_FROM_ABI void __throw_bad_alloc(); // not in C++ spec
-_LIBCPP_NORETURN inline _LIBCPP_HIDE_FROM_ABI
-void __throw_bad_array_new_length()
-{
+_LIBCPP_NORETURN inline _LIBCPP_HIDE_FROM_ABI void __throw_bad_array_new_length() {
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- throw bad_array_new_length();
+ throw bad_array_new_length();
#else
- _LIBCPP_VERBOSE_ABORT("bad_array_new_length was thrown in -fno-exceptions mode");
+ _LIBCPP_VERBOSE_ABORT("bad_array_new_length was thrown in -fno-exceptions mode");
#endif
}
-#if !defined(_LIBCPP_HAS_NO_LIBRARY_ALIGNED_ALLOCATION) && \
- !defined(_LIBCPP_ABI_VCRUNTIME)
-#ifndef _LIBCPP_CXX03_LANG
-enum class align_val_t : size_t { };
-#else
+#if !defined(_LIBCPP_HAS_NO_LIBRARY_ALIGNED_ALLOCATION) && !defined(_LIBCPP_ABI_VCRUNTIME)
+# ifndef _LIBCPP_CXX03_LANG
+enum class align_val_t : size_t {};
+# else
enum align_val_t { __zero = 0, __max = (size_t)-1 };
-#endif
+# endif
#endif
#if _LIBCPP_STD_VER >= 20
@@ -204,51 +197,61 @@ inline constexpr destroying_delete_t destroying_delete{};
} // namespace std
#if defined(_LIBCPP_CXX03_LANG)
-#define _THROW_BAD_ALLOC throw(std::bad_alloc)
+# define _THROW_BAD_ALLOC throw(std::bad_alloc)
#else
-#define _THROW_BAD_ALLOC
+# define _THROW_BAD_ALLOC
#endif
#if !defined(_LIBCPP_ABI_VCRUNTIME)
_LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_OVERRIDABLE_FUNC_VIS void* operator new(std::size_t __sz) _THROW_BAD_ALLOC;
-_LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_OVERRIDABLE_FUNC_VIS void* operator new(std::size_t __sz, const std::nothrow_t&) _NOEXCEPT _LIBCPP_NOALIAS;
-_LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete(void* __p) _NOEXCEPT;
-_LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete(void* __p, const std::nothrow_t&) _NOEXCEPT;
-#ifndef _LIBCPP_HAS_NO_LIBRARY_SIZED_DEALLOCATION
+_LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_OVERRIDABLE_FUNC_VIS void*
+operator new(std::size_t __sz, const std::nothrow_t&) _NOEXCEPT _LIBCPP_NOALIAS;
+_LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete(void* __p) _NOEXCEPT;
+_LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete(void* __p, const std::nothrow_t&) _NOEXCEPT;
+# ifndef _LIBCPP_HAS_NO_LIBRARY_SIZED_DEALLOCATION
_LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete(void* __p, std::size_t __sz) _NOEXCEPT;
-#endif
+# endif
_LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_OVERRIDABLE_FUNC_VIS void* operator new[](std::size_t __sz) _THROW_BAD_ALLOC;
-_LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_OVERRIDABLE_FUNC_VIS void* operator new[](std::size_t __sz, const std::nothrow_t&) _NOEXCEPT _LIBCPP_NOALIAS;
-_LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete[](void* __p) _NOEXCEPT;
-_LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete[](void* __p, const std::nothrow_t&) _NOEXCEPT;
-#ifndef _LIBCPP_HAS_NO_LIBRARY_SIZED_DEALLOCATION
+_LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_OVERRIDABLE_FUNC_VIS void*
+operator new[](std::size_t __sz, const std::nothrow_t&) _NOEXCEPT _LIBCPP_NOALIAS;
+_LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete[](void* __p) _NOEXCEPT;
+_LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete[](void* __p, const std::nothrow_t&) _NOEXCEPT;
+# ifndef _LIBCPP_HAS_NO_LIBRARY_SIZED_DEALLOCATION
_LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete[](void* __p, std::size_t __sz) _NOEXCEPT;
-#endif
-
-#ifndef _LIBCPP_HAS_NO_LIBRARY_ALIGNED_ALLOCATION
-_LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_OVERRIDABLE_FUNC_VIS void* operator new(std::size_t __sz, std::align_val_t) _THROW_BAD_ALLOC;
-_LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_OVERRIDABLE_FUNC_VIS void* operator new(std::size_t __sz, std::align_val_t, const std::nothrow_t&) _NOEXCEPT _LIBCPP_NOALIAS;
-_LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete(void* __p, std::align_val_t) _NOEXCEPT;
-_LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete(void* __p, std::align_val_t, const std::nothrow_t&) _NOEXCEPT;
-#ifndef _LIBCPP_HAS_NO_LIBRARY_SIZED_DEALLOCATION
+# endif
+
+# ifndef _LIBCPP_HAS_NO_LIBRARY_ALIGNED_ALLOCATION
+_LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_OVERRIDABLE_FUNC_VIS void*
+operator new(std::size_t __sz, std::align_val_t) _THROW_BAD_ALLOC;
+_LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_OVERRIDABLE_FUNC_VIS void*
+operator new(std::size_t __sz, std::align_val_t, const std::nothrow_t&) _NOEXCEPT _LIBCPP_NOALIAS;
+_LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete(void* __p, std::align_val_t) _NOEXCEPT;
+_LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete(void* __p, std::align_val_t, const std::nothrow_t&) _NOEXCEPT;
+# ifndef _LIBCPP_HAS_NO_LIBRARY_SIZED_DEALLOCATION
_LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete(void* __p, std::size_t __sz, std::align_val_t) _NOEXCEPT;
-#endif
-
-_LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_OVERRIDABLE_FUNC_VIS void* operator new[](std::size_t __sz, std::align_val_t) _THROW_BAD_ALLOC;
-_LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_OVERRIDABLE_FUNC_VIS void* operator new[](std::size_t __sz, std::align_val_t, const std::nothrow_t&) _NOEXCEPT _LIBCPP_NOALIAS;
-_LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete[](void* __p, std::align_val_t) _NOEXCEPT;
-_LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete[](void* __p, std::align_val_t, const std::nothrow_t&) _NOEXCEPT;
-#ifndef _LIBCPP_HAS_NO_LIBRARY_SIZED_DEALLOCATION
+# endif
+
+_LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_OVERRIDABLE_FUNC_VIS void*
+operator new[](std::size_t __sz, std::align_val_t) _THROW_BAD_ALLOC;
+_LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_OVERRIDABLE_FUNC_VIS void*
+operator new[](std::size_t __sz, std::align_val_t, const std::nothrow_t&) _NOEXCEPT _LIBCPP_NOALIAS;
+_LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete[](void* __p, std::align_val_t) _NOEXCEPT;
+_LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete[](void* __p, std::align_val_t, const std::nothrow_t&) _NOEXCEPT;
+# ifndef _LIBCPP_HAS_NO_LIBRARY_SIZED_DEALLOCATION
_LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete[](void* __p, std::size_t __sz, std::align_val_t) _NOEXCEPT;
-#endif
-#endif
+# endif
+# endif
-_LIBCPP_NODISCARD_AFTER_CXX17 inline _LIBCPP_HIDE_FROM_ABI void* operator new (std::size_t, void* __p) _NOEXCEPT {return __p;}
-_LIBCPP_NODISCARD_AFTER_CXX17 inline _LIBCPP_HIDE_FROM_ABI void* operator new[](std::size_t, void* __p) _NOEXCEPT {return __p;}
-inline _LIBCPP_HIDE_FROM_ABI void operator delete (void*, void*) _NOEXCEPT {}
-inline _LIBCPP_HIDE_FROM_ABI void operator delete[](void*, void*) _NOEXCEPT {}
+_LIBCPP_NODISCARD_AFTER_CXX17 inline _LIBCPP_HIDE_FROM_ABI void* operator new(std::size_t, void* __p) _NOEXCEPT {
+ return __p;
+}
+_LIBCPP_NODISCARD_AFTER_CXX17 inline _LIBCPP_HIDE_FROM_ABI void* operator new[](std::size_t, void* __p) _NOEXCEPT {
+ return __p;
+}
+inline _LIBCPP_HIDE_FROM_ABI void operator delete(void*, void*) _NOEXCEPT {}
+inline _LIBCPP_HIDE_FROM_ABI void operator delete[](void*, void*) _NOEXCEPT {}
#endif // !_LIBCPP_ABI_VCRUNTIME
@@ -262,9 +265,8 @@ _LIBCPP_CONSTEXPR inline _LIBCPP_HIDE_FROM_ABI bool __is_overaligned_for_new(siz
#endif
}
-template <class ..._Args>
-_LIBCPP_HIDE_FROM_ABI
-void* __libcpp_operator_new(_Args ...__args) {
+template <class... _Args>
+_LIBCPP_HIDE_FROM_ABI void* __libcpp_operator_new(_Args... __args) {
#if __has_builtin(__builtin_operator_new) && __has_builtin(__builtin_operator_delete)
return __builtin_operator_new(__args...);
#else
@@ -272,9 +274,8 @@ void* __libcpp_operator_new(_Args ...__args) {
#endif
}
-template <class ..._Args>
-_LIBCPP_HIDE_FROM_ABI
-void __libcpp_operator_delete(_Args ...__args) {
+template <class... _Args>
+_LIBCPP_HIDE_FROM_ABI void __libcpp_operator_delete(_Args... __args) {
#if __has_builtin(__builtin_operator_new) && __has_builtin(__builtin_operator_delete)
__builtin_operator_delete(__args...);
#else
@@ -282,8 +283,7 @@ void __libcpp_operator_delete(_Args ...__args) {
#endif
}
-inline _LIBCPP_HIDE_FROM_ABI
-void *__libcpp_allocate(size_t __size, size_t __align) {
+inline _LIBCPP_HIDE_FROM_ABI void* __libcpp_allocate(size_t __size, size_t __align) {
#ifndef _LIBCPP_HAS_NO_ALIGNED_ALLOCATION
if (__is_overaligned_for_new(__align)) {
const align_val_t __align_val = static_cast<align_val_t>(__align);
@@ -295,9 +295,8 @@ void *__libcpp_allocate(size_t __size, size_t __align) {
return __libcpp_operator_new(__size);
}
-template <class ..._Args>
-_LIBCPP_HIDE_FROM_ABI
-void __do_deallocate_handle_size(void *__ptr, size_t __size, _Args ...__args) {
+template <class... _Args>
+_LIBCPP_HIDE_FROM_ABI void __do_deallocate_handle_size(void* __ptr, size_t __size, _Args... __args) {
#ifdef _LIBCPP_HAS_NO_SIZED_DEALLOCATION
(void)__size;
return std::__libcpp_operator_delete(__ptr, __args...);
@@ -306,61 +305,56 @@ void __do_deallocate_handle_size(void *__ptr, size_t __size, _Args ...__args) {
#endif
}
-inline _LIBCPP_HIDE_FROM_ABI
-void __libcpp_deallocate(void* __ptr, size_t __size, size_t __align) {
+inline _LIBCPP_HIDE_FROM_ABI void __libcpp_deallocate(void* __ptr, size_t __size, size_t __align) {
#if defined(_LIBCPP_HAS_NO_ALIGNED_ALLOCATION)
- (void)__align;
- return __do_deallocate_handle_size(__ptr, __size);
+ (void)__align;
+ return __do_deallocate_handle_size(__ptr, __size);
#else
- if (__is_overaligned_for_new(__align)) {
- const align_val_t __align_val = static_cast<align_val_t>(__align);
- return __do_deallocate_handle_size(__ptr, __size, __align_val);
- } else {
- return __do_deallocate_handle_size(__ptr, __size);
- }
+ if (__is_overaligned_for_new(__align)) {
+ const align_val_t __align_val = static_cast<align_val_t>(__align);
+ return __do_deallocate_handle_size(__ptr, __size, __align_val);
+ } else {
+ return __do_deallocate_handle_size(__ptr, __size);
+ }
#endif
}
inline _LIBCPP_HIDE_FROM_ABI void __libcpp_deallocate_unsized(void* __ptr, size_t __align) {
#if defined(_LIBCPP_HAS_NO_ALIGNED_ALLOCATION)
- (void)__align;
- return __libcpp_operator_delete(__ptr);
+ (void)__align;
+ return __libcpp_operator_delete(__ptr);
#else
- if (__is_overaligned_for_new(__align)) {
- const align_val_t __align_val = static_cast<align_val_t>(__align);
- return __libcpp_operator_delete(__ptr, __align_val);
- } else {
- return __libcpp_operator_delete(__ptr);
- }
+ if (__is_overaligned_for_new(__align)) {
+ const align_val_t __align_val = static_cast<align_val_t>(__align);
+ return __libcpp_operator_delete(__ptr, __align_val);
+ } else {
+ return __libcpp_operator_delete(__ptr);
+ }
#endif
}
template <class _Tp>
-_LIBCPP_NODISCARD_AFTER_CXX17 inline _LIBCPP_HIDE_FROM_ABI
-_LIBCPP_CONSTEXPR _Tp* __launder(_Tp* __p) _NOEXCEPT
-{
- static_assert (!(is_function<_Tp>::value), "can't launder functions" );
- static_assert (!(is_same<void, __remove_cv_t<_Tp> >::value), "can't launder cv-void" );
- return __builtin_launder(__p);
+_LIBCPP_NODISCARD_AFTER_CXX17 inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR _Tp* __launder(_Tp* __p) _NOEXCEPT {
+ static_assert(!(is_function<_Tp>::value), "can't launder functions");
+ static_assert(!(is_same<void, __remove_cv_t<_Tp> >::value), "can't launder cv-void");
+ return __builtin_launder(__p);
}
#if _LIBCPP_STD_VER >= 17
template <class _Tp>
-_LIBCPP_NODISCARD_AFTER_CXX17 inline _LIBCPP_HIDE_FROM_ABI
-constexpr _Tp* launder(_Tp* __p) noexcept
-{
- return std::__launder(__p);
+_LIBCPP_NODISCARD_AFTER_CXX17 inline _LIBCPP_HIDE_FROM_ABI constexpr _Tp* launder(_Tp* __p) noexcept {
+ return std::__launder(__p);
}
#endif
#if _LIBCPP_STD_VER >= 17
-#if defined(__GCC_DESTRUCTIVE_SIZE) && defined(__GCC_CONSTRUCTIVE_SIZE)
+# if defined(__GCC_DESTRUCTIVE_SIZE) && defined(__GCC_CONSTRUCTIVE_SIZE)
-inline constexpr size_t hardware_destructive_interference_size = __GCC_DESTRUCTIVE_SIZE;
+inline constexpr size_t hardware_destructive_interference_size = __GCC_DESTRUCTIVE_SIZE;
inline constexpr size_t hardware_constructive_interference_size = __GCC_CONSTRUCTIVE_SIZE;
-#endif // defined(__GCC_DESTRUCTIVE_SIZE) && defined(__GCC_CONSTRUCTIVE_SIZE)
+# endif // defined(__GCC_DESTRUCTIVE_SIZE) && defined(__GCC_CONSTRUCTIVE_SIZE)
#endif // _LIBCPP_STD_VER >= 17
diff --git a/contrib/llvm-project/libcxx/include/numbers b/contrib/llvm-project/libcxx/include/numbers
index ec9eea5df37e..0d834c6b863f 100644
--- a/contrib/llvm-project/libcxx/include/numbers
+++ b/contrib/llvm-project/libcxx/include/numbers
@@ -65,9 +65,9 @@ namespace std::numbers {
#if _LIBCPP_STD_VER >= 20
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
+# if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+# pragma GCC system_header
+# endif
_LIBCPP_BEGIN_NAMESPACE_STD
@@ -77,38 +77,65 @@ template <class _Tp>
inline constexpr bool __false = false;
template <class _Tp>
-struct __illformed
-{
- static_assert(__false<_Tp>, "A program that instantiates a primary template of a mathematical constant variable template is ill-formed.");
+struct __illformed {
+ static_assert(
+ __false<_Tp>,
+ "A program that instantiates a primary template of a mathematical constant variable template is ill-formed.");
};
-template <class _Tp> inline constexpr _Tp e_v = __illformed<_Tp>{};
-template <class _Tp> inline constexpr _Tp log2e_v = __illformed<_Tp>{};
-template <class _Tp> inline constexpr _Tp log10e_v = __illformed<_Tp>{};
-template <class _Tp> inline constexpr _Tp pi_v = __illformed<_Tp>{};
-template <class _Tp> inline constexpr _Tp inv_pi_v = __illformed<_Tp>{};
-template <class _Tp> inline constexpr _Tp inv_sqrtpi_v = __illformed<_Tp>{};
-template <class _Tp> inline constexpr _Tp ln2_v = __illformed<_Tp>{};
-template <class _Tp> inline constexpr _Tp ln10_v = __illformed<_Tp>{};
-template <class _Tp> inline constexpr _Tp sqrt2_v = __illformed<_Tp>{};
-template <class _Tp> inline constexpr _Tp sqrt3_v = __illformed<_Tp>{};
-template <class _Tp> inline constexpr _Tp inv_sqrt3_v = __illformed<_Tp>{};
-template <class _Tp> inline constexpr _Tp egamma_v = __illformed<_Tp>{};
-template <class _Tp> inline constexpr _Tp phi_v = __illformed<_Tp>{};
-
-template <floating_point _Tp> inline constexpr _Tp e_v<_Tp> = 2.718281828459045235360287471352662;
-template <floating_point _Tp> inline constexpr _Tp log2e_v<_Tp> = 1.442695040888963407359924681001892;
-template <floating_point _Tp> inline constexpr _Tp log10e_v<_Tp> = 0.434294481903251827651128918916605;
-template <floating_point _Tp> inline constexpr _Tp pi_v<_Tp> = 3.141592653589793238462643383279502;
-template <floating_point _Tp> inline constexpr _Tp inv_pi_v<_Tp> = 0.318309886183790671537767526745028;
-template <floating_point _Tp> inline constexpr _Tp inv_sqrtpi_v<_Tp> = 0.564189583547756286948079451560772;
-template <floating_point _Tp> inline constexpr _Tp ln2_v<_Tp> = 0.693147180559945309417232121458176;
-template <floating_point _Tp> inline constexpr _Tp ln10_v<_Tp> = 2.302585092994045684017991454684364;
-template <floating_point _Tp> inline constexpr _Tp sqrt2_v<_Tp> = 1.414213562373095048801688724209698;
-template <floating_point _Tp> inline constexpr _Tp sqrt3_v<_Tp> = 1.732050807568877293527446341505872;
-template <floating_point _Tp> inline constexpr _Tp inv_sqrt3_v<_Tp> = 0.577350269189625764509148780501957;
-template <floating_point _Tp> inline constexpr _Tp egamma_v<_Tp> = 0.577215664901532860606512090082402;
-template <floating_point _Tp> inline constexpr _Tp phi_v<_Tp> = 1.618033988749894848204586834365638;
+template <class _Tp>
+inline constexpr _Tp e_v = __illformed<_Tp>{};
+template <class _Tp>
+inline constexpr _Tp log2e_v = __illformed<_Tp>{};
+template <class _Tp>
+inline constexpr _Tp log10e_v = __illformed<_Tp>{};
+template <class _Tp>
+inline constexpr _Tp pi_v = __illformed<_Tp>{};
+template <class _Tp>
+inline constexpr _Tp inv_pi_v = __illformed<_Tp>{};
+template <class _Tp>
+inline constexpr _Tp inv_sqrtpi_v = __illformed<_Tp>{};
+template <class _Tp>
+inline constexpr _Tp ln2_v = __illformed<_Tp>{};
+template <class _Tp>
+inline constexpr _Tp ln10_v = __illformed<_Tp>{};
+template <class _Tp>
+inline constexpr _Tp sqrt2_v = __illformed<_Tp>{};
+template <class _Tp>
+inline constexpr _Tp sqrt3_v = __illformed<_Tp>{};
+template <class _Tp>
+inline constexpr _Tp inv_sqrt3_v = __illformed<_Tp>{};
+template <class _Tp>
+inline constexpr _Tp egamma_v = __illformed<_Tp>{};
+template <class _Tp>
+inline constexpr _Tp phi_v = __illformed<_Tp>{};
+
+template <floating_point _Tp>
+inline constexpr _Tp e_v<_Tp> = 2.718281828459045235360287471352662;
+template <floating_point _Tp>
+inline constexpr _Tp log2e_v<_Tp> = 1.442695040888963407359924681001892;
+template <floating_point _Tp>
+inline constexpr _Tp log10e_v<_Tp> = 0.434294481903251827651128918916605;
+template <floating_point _Tp>
+inline constexpr _Tp pi_v<_Tp> = 3.141592653589793238462643383279502;
+template <floating_point _Tp>
+inline constexpr _Tp inv_pi_v<_Tp> = 0.318309886183790671537767526745028;
+template <floating_point _Tp>
+inline constexpr _Tp inv_sqrtpi_v<_Tp> = 0.564189583547756286948079451560772;
+template <floating_point _Tp>
+inline constexpr _Tp ln2_v<_Tp> = 0.693147180559945309417232121458176;
+template <floating_point _Tp>
+inline constexpr _Tp ln10_v<_Tp> = 2.302585092994045684017991454684364;
+template <floating_point _Tp>
+inline constexpr _Tp sqrt2_v<_Tp> = 1.414213562373095048801688724209698;
+template <floating_point _Tp>
+inline constexpr _Tp sqrt3_v<_Tp> = 1.732050807568877293527446341505872;
+template <floating_point _Tp>
+inline constexpr _Tp inv_sqrt3_v<_Tp> = 0.577350269189625764509148780501957;
+template <floating_point _Tp>
+inline constexpr _Tp egamma_v<_Tp> = 0.577215664901532860606512090082402;
+template <floating_point _Tp>
+inline constexpr _Tp phi_v<_Tp> = 1.618033988749894848204586834365638;
inline constexpr double e = e_v<double>;
inline constexpr double log2e = log2e_v<double>;
diff --git a/contrib/llvm-project/libcxx/include/optional b/contrib/llvm-project/libcxx/include/optional
index 3f505b2a8fac..73da0a8a5a7c 100644
--- a/contrib/llvm-project/libcxx/include/optional
+++ b/contrib/llvm-project/libcxx/include/optional
@@ -242,19 +242,17 @@ namespace std {
_LIBCPP_PUSH_MACROS
#include <__undef_macros>
-namespace std // purposefully not using versioning namespace
+namespace std // purposefully not using versioning namespace
{
-class _LIBCPP_EXPORTED_FROM_ABI _LIBCPP_AVAILABILITY_BAD_OPTIONAL_ACCESS bad_optional_access
- : public exception
-{
+class _LIBCPP_EXPORTED_FROM_ABI _LIBCPP_AVAILABILITY_BAD_OPTIONAL_ACCESS bad_optional_access : public exception {
public:
- _LIBCPP_HIDE_FROM_ABI bad_optional_access() _NOEXCEPT = default;
- _LIBCPP_HIDE_FROM_ABI bad_optional_access(const bad_optional_access&) _NOEXCEPT = default;
- _LIBCPP_HIDE_FROM_ABI bad_optional_access& operator=(const bad_optional_access&) _NOEXCEPT = default;
- // Get the key function ~bad_optional_access() into the dylib
- ~bad_optional_access() _NOEXCEPT override;
- const char* what() const _NOEXCEPT override;
+ _LIBCPP_HIDE_FROM_ABI bad_optional_access() _NOEXCEPT = default;
+ _LIBCPP_HIDE_FROM_ABI bad_optional_access(const bad_optional_access&) _NOEXCEPT = default;
+ _LIBCPP_HIDE_FROM_ABI bad_optional_access& operator=(const bad_optional_access&) _NOEXCEPT = default;
+ // Get the key function ~bad_optional_access() into the dylib
+ ~bad_optional_access() _NOEXCEPT override;
+ const char* what() const _NOEXCEPT override;
};
} // namespace std
@@ -263,21 +261,20 @@ public:
_LIBCPP_BEGIN_NAMESPACE_STD
-_LIBCPP_NORETURN
-inline _LIBCPP_HIDE_FROM_ABI
-_LIBCPP_AVAILABILITY_THROW_BAD_OPTIONAL_ACCESS
-void __throw_bad_optional_access() {
-#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- throw bad_optional_access();
-#else
- _LIBCPP_VERBOSE_ABORT("bad_optional_access was thrown in -fno-exceptions mode");
-#endif
+_LIBCPP_NORETURN inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_THROW_BAD_OPTIONAL_ACCESS void
+__throw_bad_optional_access() {
+# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
+ throw bad_optional_access();
+# else
+ _LIBCPP_VERBOSE_ABORT("bad_optional_access was thrown in -fno-exceptions mode");
+# endif
}
-struct nullopt_t
-{
- struct __secret_tag { explicit __secret_tag() = default; };
- _LIBCPP_HIDE_FROM_ABI constexpr explicit nullopt_t(__secret_tag, __secret_tag) noexcept {}
+struct nullopt_t {
+ struct __secret_tag {
+ explicit __secret_tag() = default;
+ };
+ _LIBCPP_HIDE_FROM_ABI constexpr explicit nullopt_t(__secret_tag, __secret_tag) noexcept {}
};
inline constexpr nullopt_t nullopt{nullopt_t::__secret_tag{}, nullopt_t::__secret_tag{}};
@@ -288,398 +285,287 @@ template <class _Tp, bool = is_trivially_destructible<_Tp>::value>
struct __optional_destruct_base;
template <class _Tp>
-struct __optional_destruct_base<_Tp, false>
-{
- typedef _Tp value_type;
- static_assert(is_object_v<value_type>,
- "instantiation of optional with a non-object type is undefined behavior");
- union
- {
- char __null_state_;
- value_type __val_;
- };
- bool __engaged_;
+struct __optional_destruct_base<_Tp, false> {
+ typedef _Tp value_type;
+ static_assert(is_object_v<value_type>, "instantiation of optional with a non-object type is undefined behavior");
+ union {
+ char __null_state_;
+ value_type __val_;
+ };
+ bool __engaged_;
- _LIBCPP_HIDE_FROM_ABI
- _LIBCPP_CONSTEXPR_SINCE_CXX20 ~__optional_destruct_base()
- {
- if (__engaged_)
- __val_.~value_type();
- }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 ~__optional_destruct_base() {
+ if (__engaged_)
+ __val_.~value_type();
+ }
- _LIBCPP_HIDE_FROM_ABI
- constexpr __optional_destruct_base() noexcept
- : __null_state_(),
- __engaged_(false) {}
+ _LIBCPP_HIDE_FROM_ABI constexpr __optional_destruct_base() noexcept : __null_state_(), __engaged_(false) {}
- template <class... _Args>
- _LIBCPP_HIDE_FROM_ABI
- constexpr explicit __optional_destruct_base(in_place_t, _Args&&... __args)
- : __val_(std::forward<_Args>(__args)...),
- __engaged_(true) {}
+ template <class... _Args>
+ _LIBCPP_HIDE_FROM_ABI constexpr explicit __optional_destruct_base(in_place_t, _Args&&... __args)
+ : __val_(std::forward<_Args>(__args)...), __engaged_(true) {}
-#if _LIBCPP_STD_VER >= 23
+# if _LIBCPP_STD_VER >= 23
template <class _Fp, class... _Args>
- _LIBCPP_HIDE_FROM_ABI
- constexpr __optional_destruct_base(__optional_construct_from_invoke_tag, _Fp&& __f, _Args&&... __args)
+ _LIBCPP_HIDE_FROM_ABI constexpr __optional_destruct_base(
+ __optional_construct_from_invoke_tag, _Fp&& __f, _Args&&... __args)
: __val_(std::invoke(std::forward<_Fp>(__f), std::forward<_Args>(__args)...)), __engaged_(true) {}
-#endif
+# endif
- _LIBCPP_HIDE_FROM_ABI
- _LIBCPP_CONSTEXPR_SINCE_CXX20 void reset() noexcept
- {
- if (__engaged_)
- {
- __val_.~value_type();
- __engaged_ = false;
- }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void reset() noexcept {
+ if (__engaged_) {
+ __val_.~value_type();
+ __engaged_ = false;
}
+ }
};
template <class _Tp>
-struct __optional_destruct_base<_Tp, true>
-{
- typedef _Tp value_type;
- static_assert(is_object_v<value_type>,
- "instantiation of optional with a non-object type is undefined behavior");
- union
- {
- char __null_state_;
- value_type __val_;
- };
- bool __engaged_;
+struct __optional_destruct_base<_Tp, true> {
+ typedef _Tp value_type;
+ static_assert(is_object_v<value_type>, "instantiation of optional with a non-object type is undefined behavior");
+ union {
+ char __null_state_;
+ value_type __val_;
+ };
+ bool __engaged_;
- _LIBCPP_HIDE_FROM_ABI
- constexpr __optional_destruct_base() noexcept
- : __null_state_(),
- __engaged_(false) {}
+ _LIBCPP_HIDE_FROM_ABI constexpr __optional_destruct_base() noexcept : __null_state_(), __engaged_(false) {}
- template <class... _Args>
- _LIBCPP_HIDE_FROM_ABI
- constexpr explicit __optional_destruct_base(in_place_t, _Args&&... __args)
- : __val_(std::forward<_Args>(__args)...),
- __engaged_(true) {}
+ template <class... _Args>
+ _LIBCPP_HIDE_FROM_ABI constexpr explicit __optional_destruct_base(in_place_t, _Args&&... __args)
+ : __val_(std::forward<_Args>(__args)...), __engaged_(true) {}
-#if _LIBCPP_STD_VER >= 23
+# if _LIBCPP_STD_VER >= 23
template <class _Fp, class... _Args>
- _LIBCPP_HIDE_FROM_ABI
- constexpr __optional_destruct_base(__optional_construct_from_invoke_tag, _Fp&& __f, _Args&&... __args)
+ _LIBCPP_HIDE_FROM_ABI constexpr __optional_destruct_base(
+ __optional_construct_from_invoke_tag, _Fp&& __f, _Args&&... __args)
: __val_(std::invoke(std::forward<_Fp>(__f), std::forward<_Args>(__args)...)), __engaged_(true) {}
-#endif
+# endif
- _LIBCPP_HIDE_FROM_ABI
- _LIBCPP_CONSTEXPR_SINCE_CXX20 void reset() noexcept
- {
- if (__engaged_)
- {
- __engaged_ = false;
- }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void reset() noexcept {
+ if (__engaged_) {
+ __engaged_ = false;
}
+ }
};
template <class _Tp, bool = is_reference<_Tp>::value>
-struct __optional_storage_base : __optional_destruct_base<_Tp>
-{
- using __base = __optional_destruct_base<_Tp>;
- using value_type = _Tp;
- using __base::__base;
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr bool has_value() const noexcept
- {
- return this->__engaged_;
- }
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr value_type& __get() & noexcept
- {
- return this->__val_;
- }
- _LIBCPP_HIDE_FROM_ABI
- constexpr const value_type& __get() const& noexcept
- {
- return this->__val_;
- }
- _LIBCPP_HIDE_FROM_ABI
- constexpr value_type&& __get() && noexcept
- {
- return std::move(this->__val_);
- }
- _LIBCPP_HIDE_FROM_ABI
- constexpr const value_type&& __get() const&& noexcept
- {
- return std::move(this->__val_);
- }
-
- template <class... _Args>
- _LIBCPP_HIDE_FROM_ABI
- _LIBCPP_CONSTEXPR_SINCE_CXX20 void __construct(_Args&&... __args)
- {
- _LIBCPP_ASSERT_INTERNAL(!has_value(), "__construct called for engaged __optional_storage");
- std::__construct_at(std::addressof(this->__val_), std::forward<_Args>(__args)...);
- this->__engaged_ = true;
- }
+struct __optional_storage_base : __optional_destruct_base<_Tp> {
+ using __base = __optional_destruct_base<_Tp>;
+ using value_type = _Tp;
+ using __base::__base;
+
+ _LIBCPP_HIDE_FROM_ABI constexpr bool has_value() const noexcept { return this->__engaged_; }
+
+ _LIBCPP_HIDE_FROM_ABI constexpr value_type& __get() & noexcept { return this->__val_; }
+ _LIBCPP_HIDE_FROM_ABI constexpr const value_type& __get() const& noexcept { return this->__val_; }
+ _LIBCPP_HIDE_FROM_ABI constexpr value_type&& __get() && noexcept { return std::move(this->__val_); }
+ _LIBCPP_HIDE_FROM_ABI constexpr const value_type&& __get() const&& noexcept { return std::move(this->__val_); }
+
+ template <class... _Args>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __construct(_Args&&... __args) {
+ _LIBCPP_ASSERT_INTERNAL(!has_value(), "__construct called for engaged __optional_storage");
+ std::__construct_at(std::addressof(this->__val_), std::forward<_Args>(__args)...);
+ this->__engaged_ = true;
+ }
- template <class _That>
- _LIBCPP_HIDE_FROM_ABI
- _LIBCPP_CONSTEXPR_SINCE_CXX20 void __construct_from(_That&& __opt)
- {
- if (__opt.has_value())
- __construct(std::forward<_That>(__opt).__get());
- }
+ template <class _That>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __construct_from(_That&& __opt) {
+ if (__opt.has_value())
+ __construct(std::forward<_That>(__opt).__get());
+ }
- template <class _That>
- _LIBCPP_HIDE_FROM_ABI
- _LIBCPP_CONSTEXPR_SINCE_CXX20 void __assign_from(_That&& __opt)
- {
- if (this->__engaged_ == __opt.has_value())
- {
- if (this->__engaged_)
- this->__val_ = std::forward<_That>(__opt).__get();
- }
- else
- {
- if (this->__engaged_)
- this->reset();
- else
- __construct(std::forward<_That>(__opt).__get());
- }
+ template <class _That>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __assign_from(_That&& __opt) {
+ if (this->__engaged_ == __opt.has_value()) {
+ if (this->__engaged_)
+ this->__val_ = std::forward<_That>(__opt).__get();
+ } else {
+ if (this->__engaged_)
+ this->reset();
+ else
+ __construct(std::forward<_That>(__opt).__get());
}
+ }
};
// optional<T&> is currently required to be ill-formed. However, it may
// be allowed in the future. For this reason, it has already been implemented
// to ensure we can make the change in an ABI-compatible manner.
template <class _Tp>
-struct __optional_storage_base<_Tp, true>
-{
- using value_type = _Tp;
- using __raw_type = remove_reference_t<_Tp>;
- __raw_type* __value_;
+struct __optional_storage_base<_Tp, true> {
+ using value_type = _Tp;
+ using __raw_type = remove_reference_t<_Tp>;
+ __raw_type* __value_;
+
+ template <class _Up>
+ static _LIBCPP_HIDE_FROM_ABI constexpr bool __can_bind_reference() {
+ using _RawUp = __libcpp_remove_reference_t<_Up>;
+ using _UpPtr = _RawUp*;
+ using _RawTp = __libcpp_remove_reference_t<_Tp>;
+ using _TpPtr = _RawTp*;
+ using _CheckLValueArg =
+ integral_constant<bool,
+ (is_lvalue_reference<_Up>::value && is_convertible<_UpPtr, _TpPtr>::value) ||
+ is_same<_RawUp, reference_wrapper<_RawTp>>::value ||
+ is_same<_RawUp, reference_wrapper<__remove_const_t<_RawTp>>>::value >;
+ return (is_lvalue_reference<_Tp>::value && _CheckLValueArg::value) ||
+ (is_rvalue_reference<_Tp>::value && !is_lvalue_reference<_Up>::value &&
+ is_convertible<_UpPtr, _TpPtr>::value);
+ }
- template <class _Up>
- static _LIBCPP_HIDE_FROM_ABI constexpr bool __can_bind_reference() {
- using _RawUp = __libcpp_remove_reference_t<_Up>;
- using _UpPtr = _RawUp*;
- using _RawTp = __libcpp_remove_reference_t<_Tp>;
- using _TpPtr = _RawTp*;
- using _CheckLValueArg = integral_constant<bool,
- (is_lvalue_reference<_Up>::value && is_convertible<_UpPtr, _TpPtr>::value)
- || is_same<_RawUp, reference_wrapper<_RawTp>>::value
- || is_same<_RawUp, reference_wrapper<__remove_const_t<_RawTp>>>::value
- >;
- return (is_lvalue_reference<_Tp>::value && _CheckLValueArg::value)
- || (is_rvalue_reference<_Tp>::value && !is_lvalue_reference<_Up>::value &&
- is_convertible<_UpPtr, _TpPtr>::value);
- }
+ _LIBCPP_HIDE_FROM_ABI constexpr __optional_storage_base() noexcept : __value_(nullptr) {}
- _LIBCPP_HIDE_FROM_ABI
- constexpr __optional_storage_base() noexcept
- : __value_(nullptr) {}
-
- template <class _UArg>
- _LIBCPP_HIDE_FROM_ABI
- constexpr explicit __optional_storage_base(in_place_t, _UArg&& __uarg)
- : __value_(std::addressof(__uarg))
- {
- static_assert(__can_bind_reference<_UArg>(),
- "Attempted to construct a reference element in tuple from a "
- "possible temporary");
- }
+ template <class _UArg>
+ _LIBCPP_HIDE_FROM_ABI constexpr explicit __optional_storage_base(in_place_t, _UArg&& __uarg)
+ : __value_(std::addressof(__uarg)) {
+ static_assert(__can_bind_reference<_UArg>(),
+ "Attempted to construct a reference element in tuple from a "
+ "possible temporary");
+ }
- _LIBCPP_HIDE_FROM_ABI
- _LIBCPP_CONSTEXPR_SINCE_CXX20 void reset() noexcept { __value_ = nullptr; }
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr bool has_value() const noexcept
- { return __value_ != nullptr; }
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr value_type& __get() const& noexcept
- { return *__value_; }
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr value_type&& __get() const&& noexcept
- { return std::forward<value_type>(*__value_); }
-
- template <class _UArg>
- _LIBCPP_HIDE_FROM_ABI
- _LIBCPP_CONSTEXPR_SINCE_CXX20 void __construct(_UArg&& __val)
- {
- _LIBCPP_ASSERT_INTERNAL(!has_value(), "__construct called for engaged __optional_storage");
- static_assert(__can_bind_reference<_UArg>(),
- "Attempted to construct a reference element in tuple from a "
- "possible temporary");
- __value_ = std::addressof(__val);
- }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void reset() noexcept { __value_ = nullptr; }
- template <class _That>
- _LIBCPP_HIDE_FROM_ABI
- _LIBCPP_CONSTEXPR_SINCE_CXX20 void __construct_from(_That&& __opt)
- {
- if (__opt.has_value())
- __construct(std::forward<_That>(__opt).__get());
- }
+ _LIBCPP_HIDE_FROM_ABI constexpr bool has_value() const noexcept { return __value_ != nullptr; }
+
+ _LIBCPP_HIDE_FROM_ABI constexpr value_type& __get() const& noexcept { return *__value_; }
- template <class _That>
- _LIBCPP_HIDE_FROM_ABI
- _LIBCPP_CONSTEXPR_SINCE_CXX20 void __assign_from(_That&& __opt)
- {
- if (has_value() == __opt.has_value())
- {
- if (has_value())
- *__value_ = std::forward<_That>(__opt).__get();
- }
- else
- {
- if (has_value())
- reset();
- else
- __construct(std::forward<_That>(__opt).__get());
- }
+ _LIBCPP_HIDE_FROM_ABI constexpr value_type&& __get() const&& noexcept { return std::forward<value_type>(*__value_); }
+
+ template <class _UArg>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __construct(_UArg&& __val) {
+ _LIBCPP_ASSERT_INTERNAL(!has_value(), "__construct called for engaged __optional_storage");
+ static_assert(__can_bind_reference<_UArg>(),
+ "Attempted to construct a reference element in tuple from a "
+ "possible temporary");
+ __value_ = std::addressof(__val);
+ }
+
+ template <class _That>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __construct_from(_That&& __opt) {
+ if (__opt.has_value())
+ __construct(std::forward<_That>(__opt).__get());
+ }
+
+ template <class _That>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __assign_from(_That&& __opt) {
+ if (has_value() == __opt.has_value()) {
+ if (has_value())
+ *__value_ = std::forward<_That>(__opt).__get();
+ } else {
+ if (has_value())
+ reset();
+ else
+ __construct(std::forward<_That>(__opt).__get());
}
+ }
};
template <class _Tp, bool = is_trivially_copy_constructible<_Tp>::value>
-struct __optional_copy_base : __optional_storage_base<_Tp>
-{
- using __optional_storage_base<_Tp>::__optional_storage_base;
+struct __optional_copy_base : __optional_storage_base<_Tp> {
+ using __optional_storage_base<_Tp>::__optional_storage_base;
};
template <class _Tp>
-struct __optional_copy_base<_Tp, false> : __optional_storage_base<_Tp>
-{
- using __optional_storage_base<_Tp>::__optional_storage_base;
+struct __optional_copy_base<_Tp, false> : __optional_storage_base<_Tp> {
+ using __optional_storage_base<_Tp>::__optional_storage_base;
- _LIBCPP_HIDE_FROM_ABI
- __optional_copy_base() = default;
+ _LIBCPP_HIDE_FROM_ABI __optional_copy_base() = default;
- _LIBCPP_HIDE_FROM_ABI
- _LIBCPP_CONSTEXPR_SINCE_CXX20 __optional_copy_base(const __optional_copy_base& __opt)
- {
- this->__construct_from(__opt);
- }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 __optional_copy_base(const __optional_copy_base& __opt) {
+ this->__construct_from(__opt);
+ }
- _LIBCPP_HIDE_FROM_ABI
- __optional_copy_base(__optional_copy_base&&) = default;
- _LIBCPP_HIDE_FROM_ABI
- __optional_copy_base& operator=(const __optional_copy_base&) = default;
- _LIBCPP_HIDE_FROM_ABI
- __optional_copy_base& operator=(__optional_copy_base&&) = default;
+ _LIBCPP_HIDE_FROM_ABI __optional_copy_base(__optional_copy_base&&) = default;
+ _LIBCPP_HIDE_FROM_ABI __optional_copy_base& operator=(const __optional_copy_base&) = default;
+ _LIBCPP_HIDE_FROM_ABI __optional_copy_base& operator=(__optional_copy_base&&) = default;
};
template <class _Tp, bool = is_trivially_move_constructible<_Tp>::value>
-struct __optional_move_base : __optional_copy_base<_Tp>
-{
- using __optional_copy_base<_Tp>::__optional_copy_base;
+struct __optional_move_base : __optional_copy_base<_Tp> {
+ using __optional_copy_base<_Tp>::__optional_copy_base;
};
template <class _Tp>
-struct __optional_move_base<_Tp, false> : __optional_copy_base<_Tp>
-{
- using value_type = _Tp;
- using __optional_copy_base<_Tp>::__optional_copy_base;
-
- _LIBCPP_HIDE_FROM_ABI
- __optional_move_base() = default;
- _LIBCPP_HIDE_FROM_ABI
- __optional_move_base(const __optional_move_base&) = default;
-
- _LIBCPP_HIDE_FROM_ABI
- _LIBCPP_CONSTEXPR_SINCE_CXX20 __optional_move_base(__optional_move_base&& __opt)
- noexcept(is_nothrow_move_constructible_v<value_type>)
- {
- this->__construct_from(std::move(__opt));
- }
+struct __optional_move_base<_Tp, false> : __optional_copy_base<_Tp> {
+ using value_type = _Tp;
+ using __optional_copy_base<_Tp>::__optional_copy_base;
- _LIBCPP_HIDE_FROM_ABI
- __optional_move_base& operator=(const __optional_move_base&) = default;
- _LIBCPP_HIDE_FROM_ABI
- __optional_move_base& operator=(__optional_move_base&&) = default;
+ _LIBCPP_HIDE_FROM_ABI __optional_move_base() = default;
+ _LIBCPP_HIDE_FROM_ABI __optional_move_base(const __optional_move_base&) = default;
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
+ __optional_move_base(__optional_move_base&& __opt) noexcept(is_nothrow_move_constructible_v<value_type>) {
+ this->__construct_from(std::move(__opt));
+ }
+
+ _LIBCPP_HIDE_FROM_ABI __optional_move_base& operator=(const __optional_move_base&) = default;
+ _LIBCPP_HIDE_FROM_ABI __optional_move_base& operator=(__optional_move_base&&) = default;
};
-template <class _Tp, bool =
- is_trivially_destructible<_Tp>::value &&
- is_trivially_copy_constructible<_Tp>::value &&
- is_trivially_copy_assignable<_Tp>::value>
-struct __optional_copy_assign_base : __optional_move_base<_Tp>
-{
- using __optional_move_base<_Tp>::__optional_move_base;
+template <class _Tp,
+ bool = is_trivially_destructible<_Tp>::value && is_trivially_copy_constructible<_Tp>::value &&
+ is_trivially_copy_assignable<_Tp>::value>
+struct __optional_copy_assign_base : __optional_move_base<_Tp> {
+ using __optional_move_base<_Tp>::__optional_move_base;
};
template <class _Tp>
-struct __optional_copy_assign_base<_Tp, false> : __optional_move_base<_Tp>
-{
- using __optional_move_base<_Tp>::__optional_move_base;
-
- _LIBCPP_HIDE_FROM_ABI
- __optional_copy_assign_base() = default;
- _LIBCPP_HIDE_FROM_ABI
- __optional_copy_assign_base(const __optional_copy_assign_base&) = default;
- _LIBCPP_HIDE_FROM_ABI
- __optional_copy_assign_base(__optional_copy_assign_base&&) = default;
-
- _LIBCPP_HIDE_FROM_ABI
- _LIBCPP_CONSTEXPR_SINCE_CXX20 __optional_copy_assign_base& operator=(const __optional_copy_assign_base& __opt)
- {
- this->__assign_from(__opt);
- return *this;
- }
+struct __optional_copy_assign_base<_Tp, false> : __optional_move_base<_Tp> {
+ using __optional_move_base<_Tp>::__optional_move_base;
+
+ _LIBCPP_HIDE_FROM_ABI __optional_copy_assign_base() = default;
+ _LIBCPP_HIDE_FROM_ABI __optional_copy_assign_base(const __optional_copy_assign_base&) = default;
+ _LIBCPP_HIDE_FROM_ABI __optional_copy_assign_base(__optional_copy_assign_base&&) = default;
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 __optional_copy_assign_base&
+ operator=(const __optional_copy_assign_base& __opt) {
+ this->__assign_from(__opt);
+ return *this;
+ }
- _LIBCPP_HIDE_FROM_ABI
- __optional_copy_assign_base& operator=(__optional_copy_assign_base&&) = default;
+ _LIBCPP_HIDE_FROM_ABI __optional_copy_assign_base& operator=(__optional_copy_assign_base&&) = default;
};
-template <class _Tp, bool =
- is_trivially_destructible<_Tp>::value &&
- is_trivially_move_constructible<_Tp>::value &&
- is_trivially_move_assignable<_Tp>::value>
-struct __optional_move_assign_base : __optional_copy_assign_base<_Tp>
-{
- using __optional_copy_assign_base<_Tp>::__optional_copy_assign_base;
+template <class _Tp,
+ bool = is_trivially_destructible<_Tp>::value && is_trivially_move_constructible<_Tp>::value &&
+ is_trivially_move_assignable<_Tp>::value>
+struct __optional_move_assign_base : __optional_copy_assign_base<_Tp> {
+ using __optional_copy_assign_base<_Tp>::__optional_copy_assign_base;
};
template <class _Tp>
-struct __optional_move_assign_base<_Tp, false> : __optional_copy_assign_base<_Tp>
-{
- using value_type = _Tp;
- using __optional_copy_assign_base<_Tp>::__optional_copy_assign_base;
-
- _LIBCPP_HIDE_FROM_ABI
- __optional_move_assign_base() = default;
- _LIBCPP_HIDE_FROM_ABI
- __optional_move_assign_base(const __optional_move_assign_base& __opt) = default;
- _LIBCPP_HIDE_FROM_ABI
- __optional_move_assign_base(__optional_move_assign_base&&) = default;
- _LIBCPP_HIDE_FROM_ABI
- __optional_move_assign_base& operator=(const __optional_move_assign_base&) = default;
-
- _LIBCPP_HIDE_FROM_ABI
- _LIBCPP_CONSTEXPR_SINCE_CXX20 __optional_move_assign_base& operator=(__optional_move_assign_base&& __opt)
- noexcept(is_nothrow_move_assignable_v<value_type> &&
- is_nothrow_move_constructible_v<value_type>)
- {
- this->__assign_from(std::move(__opt));
- return *this;
- }
+struct __optional_move_assign_base<_Tp, false> : __optional_copy_assign_base<_Tp> {
+ using value_type = _Tp;
+ using __optional_copy_assign_base<_Tp>::__optional_copy_assign_base;
+
+ _LIBCPP_HIDE_FROM_ABI __optional_move_assign_base() = default;
+ _LIBCPP_HIDE_FROM_ABI __optional_move_assign_base(const __optional_move_assign_base& __opt) = default;
+ _LIBCPP_HIDE_FROM_ABI __optional_move_assign_base(__optional_move_assign_base&&) = default;
+ _LIBCPP_HIDE_FROM_ABI __optional_move_assign_base& operator=(const __optional_move_assign_base&) = default;
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 __optional_move_assign_base&
+ operator=(__optional_move_assign_base&& __opt) noexcept(
+ is_nothrow_move_assignable_v<value_type> && is_nothrow_move_constructible_v<value_type>) {
+ this->__assign_from(std::move(__opt));
+ return *this;
+ }
};
template <class _Tp>
-using __optional_sfinae_ctor_base_t = __sfinae_ctor_base<
- is_copy_constructible<_Tp>::value,
- is_move_constructible<_Tp>::value
->;
+using __optional_sfinae_ctor_base_t =
+ __sfinae_ctor_base< is_copy_constructible<_Tp>::value, is_move_constructible<_Tp>::value >;
template <class _Tp>
-using __optional_sfinae_assign_base_t = __sfinae_assign_base<
- (is_copy_constructible<_Tp>::value && is_copy_assignable<_Tp>::value),
- (is_move_constructible<_Tp>::value && is_move_assignable<_Tp>::value)
->;
+using __optional_sfinae_assign_base_t =
+ __sfinae_assign_base< (is_copy_constructible<_Tp>::value && is_copy_assignable<_Tp>::value),
+ (is_move_constructible<_Tp>::value && is_move_assignable<_Tp>::value) >;
-template<class _Tp>
+template <class _Tp>
class optional;
-#if _LIBCPP_STD_VER >= 20
+# if _LIBCPP_STD_VER >= 20
template <class _Tp>
concept __is_derived_from_optional = requires(const _Tp& __t) { []<class _Up>(const optional<_Up>&) {}(__t); };
@@ -688,433 +574,295 @@ concept __is_derived_from_optional = requires(const _Tp& __t) { []<class _Up>(co
template <class _Tp>
struct __is_std_optional : false_type {};
-template <class _Tp> struct __is_std_optional<optional<_Tp>> : true_type {};
+template <class _Tp>
+struct __is_std_optional<optional<_Tp>> : true_type {};
template <class _Tp>
class _LIBCPP_DECLSPEC_EMPTY_BASES optional
- : private __optional_move_assign_base<_Tp>
- , private __optional_sfinae_ctor_base_t<_Tp>
- , private __optional_sfinae_assign_base_t<_Tp>
-{
- using __base = __optional_move_assign_base<_Tp>;
+ : private __optional_move_assign_base<_Tp>,
+ private __optional_sfinae_ctor_base_t<_Tp>,
+ private __optional_sfinae_assign_base_t<_Tp> {
+ using __base = __optional_move_assign_base<_Tp>;
+
public:
- using value_type = _Tp;
+ using value_type = _Tp;
private:
- // Disable the reference extension using this static assert.
- static_assert(!is_same_v<__remove_cvref_t<value_type>, in_place_t>,
- "instantiation of optional with in_place_t is ill-formed");
- static_assert(!is_same_v<__remove_cvref_t<value_type>, nullopt_t>,
- "instantiation of optional with nullopt_t is ill-formed");
- static_assert(!is_reference_v<value_type>,
- "instantiation of optional with a reference type is ill-formed");
- static_assert(is_destructible_v<value_type>,
- "instantiation of optional with a non-destructible type is ill-formed");
- static_assert(!is_array_v<value_type>,
- "instantiation of optional with an array type is ill-formed");
-
- // LWG2756: conditionally explicit conversion from _Up
- struct _CheckOptionalArgsConstructor {
- template <class _Up>
- _LIBCPP_HIDE_FROM_ABI static constexpr bool __enable_implicit() {
- return is_constructible_v<_Tp, _Up&&> &&
- is_convertible_v<_Up&&, _Tp>;
- }
+ // Disable the reference extension using this static assert.
+ static_assert(!is_same_v<__remove_cvref_t<value_type>, in_place_t>,
+ "instantiation of optional with in_place_t is ill-formed");
+ static_assert(!is_same_v<__remove_cvref_t<value_type>, nullopt_t>,
+ "instantiation of optional with nullopt_t is ill-formed");
+ static_assert(!is_reference_v<value_type>, "instantiation of optional with a reference type is ill-formed");
+ static_assert(is_destructible_v<value_type>, "instantiation of optional with a non-destructible type is ill-formed");
+ static_assert(!is_array_v<value_type>, "instantiation of optional with an array type is ill-formed");
+
+ // LWG2756: conditionally explicit conversion from _Up
+ struct _CheckOptionalArgsConstructor {
+ template <class _Up>
+ _LIBCPP_HIDE_FROM_ABI static constexpr bool __enable_implicit() {
+ return is_constructible_v<_Tp, _Up&&> && is_convertible_v<_Up&&, _Tp>;
+ }
- template <class _Up>
- _LIBCPP_HIDE_FROM_ABI static constexpr bool __enable_explicit() {
- return is_constructible_v<_Tp, _Up&&> &&
- !is_convertible_v<_Up&&, _Tp>;
- }
- };
template <class _Up>
- using _CheckOptionalArgsCtor = _If<
- _IsNotSame<__remove_cvref_t<_Up>, in_place_t>::value &&
- _IsNotSame<__remove_cvref_t<_Up>, optional>::value &&
- (!is_same_v<remove_cv_t<_Tp>, bool> || !__is_std_optional<__remove_cvref_t<_Up>>::value),
- _CheckOptionalArgsConstructor,
- __check_tuple_constructor_fail
- >;
- template <class _QualUp>
- struct _CheckOptionalLikeConstructor {
- template <class _Up, class _Opt = optional<_Up>>
- using __check_constructible_from_opt = _Or<
- is_constructible<_Tp, _Opt&>,
- is_constructible<_Tp, _Opt const&>,
- is_constructible<_Tp, _Opt&&>,
- is_constructible<_Tp, _Opt const&&>,
- is_convertible<_Opt&, _Tp>,
- is_convertible<_Opt const&, _Tp>,
- is_convertible<_Opt&&, _Tp>,
- is_convertible<_Opt const&&, _Tp>
- >;
- template <class _Up, class _Opt = optional<_Up>>
- using __check_assignable_from_opt = _Or<
- is_assignable<_Tp&, _Opt&>,
- is_assignable<_Tp&, _Opt const&>,
- is_assignable<_Tp&, _Opt&&>,
- is_assignable<_Tp&, _Opt const&&>
- >;
- template <class _Up, class _QUp = _QualUp>
- _LIBCPP_HIDE_FROM_ABI static constexpr bool __enable_implicit() {
- return is_convertible<_QUp, _Tp>::value &&
- (is_same_v<remove_cv_t<_Tp>, bool> || !__check_constructible_from_opt<_Up>::value);
- }
- template <class _Up, class _QUp = _QualUp>
- _LIBCPP_HIDE_FROM_ABI static constexpr bool __enable_explicit() {
- return !is_convertible<_QUp, _Tp>::value &&
- (is_same_v<remove_cv_t<_Tp>, bool> || !__check_constructible_from_opt<_Up>::value);
- }
- template <class _Up, class _QUp = _QualUp>
- _LIBCPP_HIDE_FROM_ABI static constexpr bool __enable_assign() {
- // Construction and assignability of _QUp to _Tp has already been
- // checked.
- return !__check_constructible_from_opt<_Up>::value &&
- !__check_assignable_from_opt<_Up>::value;
- }
- };
+ _LIBCPP_HIDE_FROM_ABI static constexpr bool __enable_explicit() {
+ return is_constructible_v<_Tp, _Up&&> && !is_convertible_v<_Up&&, _Tp>;
+ }
+ };
+ template <class _Up>
+ using _CheckOptionalArgsCtor =
+ _If< _IsNotSame<__remove_cvref_t<_Up>, in_place_t>::value && _IsNotSame<__remove_cvref_t<_Up>, optional>::value &&
+ (!is_same_v<remove_cv_t<_Tp>, bool> || !__is_std_optional<__remove_cvref_t<_Up>>::value),
+ _CheckOptionalArgsConstructor,
+ __check_tuple_constructor_fail >;
+ template <class _QualUp>
+ struct _CheckOptionalLikeConstructor {
+ template <class _Up, class _Opt = optional<_Up>>
+ using __check_constructible_from_opt =
+ _Or< is_constructible<_Tp, _Opt&>,
+ is_constructible<_Tp, _Opt const&>,
+ is_constructible<_Tp, _Opt&&>,
+ is_constructible<_Tp, _Opt const&&>,
+ is_convertible<_Opt&, _Tp>,
+ is_convertible<_Opt const&, _Tp>,
+ is_convertible<_Opt&&, _Tp>,
+ is_convertible<_Opt const&&, _Tp> >;
+ template <class _Up, class _Opt = optional<_Up>>
+ using __check_assignable_from_opt =
+ _Or< is_assignable<_Tp&, _Opt&>,
+ is_assignable<_Tp&, _Opt const&>,
+ is_assignable<_Tp&, _Opt&&>,
+ is_assignable<_Tp&, _Opt const&&> >;
+ template <class _Up, class _QUp = _QualUp>
+ _LIBCPP_HIDE_FROM_ABI static constexpr bool __enable_implicit() {
+ return is_convertible<_QUp, _Tp>::value &&
+ (is_same_v<remove_cv_t<_Tp>, bool> || !__check_constructible_from_opt<_Up>::value);
+ }
+ template <class _Up, class _QUp = _QualUp>
+ _LIBCPP_HIDE_FROM_ABI static constexpr bool __enable_explicit() {
+ return !is_convertible<_QUp, _Tp>::value &&
+ (is_same_v<remove_cv_t<_Tp>, bool> || !__check_constructible_from_opt<_Up>::value);
+ }
+ template <class _Up, class _QUp = _QualUp>
+ _LIBCPP_HIDE_FROM_ABI static constexpr bool __enable_assign() {
+ // Construction and assignability of _QUp to _Tp has already been
+ // checked.
+ return !__check_constructible_from_opt<_Up>::value && !__check_assignable_from_opt<_Up>::value;
+ }
+ };
- template <class _Up, class _QualUp>
- using _CheckOptionalLikeCtor = _If<
- _And<
- _IsNotSame<_Up, _Tp>,
- is_constructible<_Tp, _QualUp>
- >::value,
- _CheckOptionalLikeConstructor<_QualUp>,
- __check_tuple_constructor_fail
- >;
- template <class _Up, class _QualUp>
- using _CheckOptionalLikeAssign = _If<
- _And<
- _IsNotSame<_Up, _Tp>,
- is_constructible<_Tp, _QualUp>,
- is_assignable<_Tp&, _QualUp>
- >::value,
- _CheckOptionalLikeConstructor<_QualUp>,
- __check_tuple_constructor_fail
- >;
+ template <class _Up, class _QualUp>
+ using _CheckOptionalLikeCtor =
+ _If< _And< _IsNotSame<_Up, _Tp>, is_constructible<_Tp, _QualUp> >::value,
+ _CheckOptionalLikeConstructor<_QualUp>,
+ __check_tuple_constructor_fail >;
+ template <class _Up, class _QualUp>
+ using _CheckOptionalLikeAssign =
+ _If< _And< _IsNotSame<_Up, _Tp>, is_constructible<_Tp, _QualUp>, is_assignable<_Tp&, _QualUp> >::value,
+ _CheckOptionalLikeConstructor<_QualUp>,
+ __check_tuple_constructor_fail >;
public:
+ _LIBCPP_HIDE_FROM_ABI constexpr optional() noexcept {}
+ _LIBCPP_HIDE_FROM_ABI constexpr optional(const optional&) = default;
+ _LIBCPP_HIDE_FROM_ABI constexpr optional(optional&&) = default;
+ _LIBCPP_HIDE_FROM_ABI constexpr optional(nullopt_t) noexcept {}
+
+ template <
+ class _InPlaceT,
+ class... _Args,
+ class = enable_if_t< _And< _IsSame<_InPlaceT, in_place_t>, is_constructible<value_type, _Args...> >::value > >
+ _LIBCPP_HIDE_FROM_ABI constexpr explicit optional(_InPlaceT, _Args&&... __args)
+ : __base(in_place, std::forward<_Args>(__args)...) {}
+
+ template <class _Up,
+ class... _Args,
+ class = enable_if_t< is_constructible_v<value_type, initializer_list<_Up>&, _Args...>> >
+ _LIBCPP_HIDE_FROM_ABI constexpr explicit optional(in_place_t, initializer_list<_Up> __il, _Args&&... __args)
+ : __base(in_place, __il, std::forward<_Args>(__args)...) {}
+
+ template <class _Up = value_type,
+ enable_if_t< _CheckOptionalArgsCtor<_Up>::template __enable_implicit<_Up>(), int> = 0>
+ _LIBCPP_HIDE_FROM_ABI constexpr optional(_Up&& __v) : __base(in_place, std::forward<_Up>(__v)) {}
+
+ template <class _Up, enable_if_t< _CheckOptionalArgsCtor<_Up>::template __enable_explicit<_Up>(), int> = 0>
+ _LIBCPP_HIDE_FROM_ABI constexpr explicit optional(_Up&& __v) : __base(in_place, std::forward<_Up>(__v)) {}
+
+ // LWG2756: conditionally explicit conversion from const optional<_Up>&
+ template <class _Up,
+ enable_if_t< _CheckOptionalLikeCtor<_Up, _Up const&>::template __enable_implicit<_Up>(), int> = 0>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 optional(const optional<_Up>& __v) {
+ this->__construct_from(__v);
+ }
+ template <class _Up,
+ enable_if_t< _CheckOptionalLikeCtor<_Up, _Up const&>::template __enable_explicit<_Up>(), int> = 0>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 explicit optional(const optional<_Up>& __v) {
+ this->__construct_from(__v);
+ }
- _LIBCPP_HIDE_FROM_ABI constexpr optional() noexcept {}
- _LIBCPP_HIDE_FROM_ABI constexpr optional(const optional&) = default;
- _LIBCPP_HIDE_FROM_ABI constexpr optional(optional&&) = default;
- _LIBCPP_HIDE_FROM_ABI constexpr optional(nullopt_t) noexcept {}
-
- template <class _InPlaceT, class... _Args, class = enable_if_t<
- _And<
- _IsSame<_InPlaceT, in_place_t>,
- is_constructible<value_type, _Args...>
- >::value
- >
- >
- _LIBCPP_HIDE_FROM_ABI
- constexpr explicit optional(_InPlaceT, _Args&&... __args)
- : __base(in_place, std::forward<_Args>(__args)...) {}
-
- template <class _Up, class... _Args, class = enable_if_t<
- is_constructible_v<value_type, initializer_list<_Up>&, _Args...>>
- >
- _LIBCPP_HIDE_FROM_ABI
- constexpr explicit optional(in_place_t, initializer_list<_Up> __il, _Args&&... __args)
- : __base(in_place, __il, std::forward<_Args>(__args)...) {}
-
- template <class _Up = value_type, enable_if_t<
- _CheckOptionalArgsCtor<_Up>::template __enable_implicit<_Up>()
- , int> = 0>
- _LIBCPP_HIDE_FROM_ABI
- constexpr optional(_Up&& __v)
- : __base(in_place, std::forward<_Up>(__v)) {}
-
- template <class _Up, enable_if_t<
- _CheckOptionalArgsCtor<_Up>::template __enable_explicit<_Up>()
- , int> = 0>
- _LIBCPP_HIDE_FROM_ABI
- constexpr explicit optional(_Up&& __v)
- : __base(in_place, std::forward<_Up>(__v)) {}
-
- // LWG2756: conditionally explicit conversion from const optional<_Up>&
- template <class _Up, enable_if_t<
- _CheckOptionalLikeCtor<_Up, _Up const&>::template __enable_implicit<_Up>()
- , int> = 0>
- _LIBCPP_HIDE_FROM_ABI
- _LIBCPP_CONSTEXPR_SINCE_CXX20 optional(const optional<_Up>& __v)
- {
- this->__construct_from(__v);
- }
- template <class _Up, enable_if_t<
- _CheckOptionalLikeCtor<_Up, _Up const&>::template __enable_explicit<_Up>()
- , int> = 0>
- _LIBCPP_HIDE_FROM_ABI
- _LIBCPP_CONSTEXPR_SINCE_CXX20 explicit optional(const optional<_Up>& __v)
- {
- this->__construct_from(__v);
- }
+ // LWG2756: conditionally explicit conversion from optional<_Up>&&
+ template <class _Up, enable_if_t< _CheckOptionalLikeCtor<_Up, _Up&&>::template __enable_implicit<_Up>(), int> = 0>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 optional(optional<_Up>&& __v) {
+ this->__construct_from(std::move(__v));
+ }
+ template <class _Up, enable_if_t< _CheckOptionalLikeCtor<_Up, _Up&&>::template __enable_explicit<_Up>(), int> = 0>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 explicit optional(optional<_Up>&& __v) {
+ this->__construct_from(std::move(__v));
+ }
- // LWG2756: conditionally explicit conversion from optional<_Up>&&
- template <class _Up, enable_if_t<
- _CheckOptionalLikeCtor<_Up, _Up &&>::template __enable_implicit<_Up>()
- , int> = 0>
- _LIBCPP_HIDE_FROM_ABI
- _LIBCPP_CONSTEXPR_SINCE_CXX20 optional(optional<_Up>&& __v)
- {
- this->__construct_from(std::move(__v));
- }
- template <class _Up, enable_if_t<
- _CheckOptionalLikeCtor<_Up, _Up &&>::template __enable_explicit<_Up>()
- , int> = 0>
- _LIBCPP_HIDE_FROM_ABI
- _LIBCPP_CONSTEXPR_SINCE_CXX20 explicit optional(optional<_Up>&& __v)
- {
- this->__construct_from(std::move(__v));
- }
+# if _LIBCPP_STD_VER >= 23
+ template <class _Fp, class... _Args>
+ _LIBCPP_HIDE_FROM_ABI constexpr explicit optional(__optional_construct_from_invoke_tag, _Fp&& __f, _Args&&... __args)
+ : __base(__optional_construct_from_invoke_tag{}, std::forward<_Fp>(__f), std::forward<_Args>(__args)...) {}
+# endif
-#if _LIBCPP_STD_VER >= 23
- template<class _Fp, class... _Args>
- _LIBCPP_HIDE_FROM_ABI
- constexpr explicit optional(__optional_construct_from_invoke_tag, _Fp&& __f, _Args&&... __args)
- : __base(__optional_construct_from_invoke_tag{}, std::forward<_Fp>(__f), std::forward<_Args>(__args)...) {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 optional& operator=(nullopt_t) noexcept {
+ reset();
+ return *this;
}
-#endif
- _LIBCPP_HIDE_FROM_ABI
- _LIBCPP_CONSTEXPR_SINCE_CXX20 optional& operator=(nullopt_t) noexcept
- {
- reset();
- return *this;
- }
+ _LIBCPP_HIDE_FROM_ABI constexpr optional& operator=(const optional&) = default;
+ _LIBCPP_HIDE_FROM_ABI constexpr optional& operator=(optional&&) = default;
+
+ // LWG2756
+ template <
+ class _Up = value_type,
+ class = enable_if_t< _And< _IsNotSame<__remove_cvref_t<_Up>, optional>,
+ _Or< _IsNotSame<__remove_cvref_t<_Up>, value_type>, _Not<is_scalar<value_type>> >,
+ is_constructible<value_type, _Up>,
+ is_assignable<value_type&, _Up> >::value> >
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 optional& operator=(_Up&& __v) {
+ if (this->has_value())
+ this->__get() = std::forward<_Up>(__v);
+ else
+ this->__construct(std::forward<_Up>(__v));
+ return *this;
+ }
- _LIBCPP_HIDE_FROM_ABI constexpr optional& operator=(const optional&) = default;
- _LIBCPP_HIDE_FROM_ABI constexpr optional& operator=(optional&&) = default;
-
- // LWG2756
- template <class _Up = value_type,
- class = enable_if_t<
- _And<
- _IsNotSame<__remove_cvref_t<_Up>, optional>,
- _Or<
- _IsNotSame<__remove_cvref_t<_Up>, value_type>,
- _Not<is_scalar<value_type>>
- >,
- is_constructible<value_type, _Up>,
- is_assignable<value_type&, _Up>
- >::value>
- >
- _LIBCPP_HIDE_FROM_ABI
- _LIBCPP_CONSTEXPR_SINCE_CXX20 optional&
- operator=(_Up&& __v)
- {
- if (this->has_value())
- this->__get() = std::forward<_Up>(__v);
- else
- this->__construct(std::forward<_Up>(__v));
- return *this;
- }
+ // LWG2756
+ template <class _Up,
+ enable_if_t< _CheckOptionalLikeAssign<_Up, _Up const&>::template __enable_assign<_Up>(), int> = 0>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 optional& operator=(const optional<_Up>& __v) {
+ this->__assign_from(__v);
+ return *this;
+ }
- // LWG2756
- template <class _Up, enable_if_t<
- _CheckOptionalLikeAssign<_Up, _Up const&>::template __enable_assign<_Up>()
- , int> = 0>
- _LIBCPP_HIDE_FROM_ABI
- _LIBCPP_CONSTEXPR_SINCE_CXX20 optional&
- operator=(const optional<_Up>& __v)
- {
- this->__assign_from(__v);
- return *this;
- }
+ // LWG2756
+ template <class _Up, enable_if_t< _CheckOptionalLikeCtor<_Up, _Up&&>::template __enable_assign<_Up>(), int> = 0>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 optional& operator=(optional<_Up>&& __v) {
+ this->__assign_from(std::move(__v));
+ return *this;
+ }
- // LWG2756
- template <class _Up, enable_if_t<
- _CheckOptionalLikeCtor<_Up, _Up &&>::template __enable_assign<_Up>()
- , int> = 0>
- _LIBCPP_HIDE_FROM_ABI
- _LIBCPP_CONSTEXPR_SINCE_CXX20 optional&
- operator=(optional<_Up>&& __v)
- {
- this->__assign_from(std::move(__v));
- return *this;
- }
+ template <class... _Args, class = enable_if_t< is_constructible_v<value_type, _Args...> > >
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _Tp& emplace(_Args&&... __args) {
+ reset();
+ this->__construct(std::forward<_Args>(__args)...);
+ return this->__get();
+ }
- template <class... _Args,
- class = enable_if_t
- <
- is_constructible_v<value_type, _Args...>
- >
- >
- _LIBCPP_HIDE_FROM_ABI
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _Tp &
- emplace(_Args&&... __args)
- {
- reset();
- this->__construct(std::forward<_Args>(__args)...);
- return this->__get();
- }
+ template <class _Up,
+ class... _Args,
+ class = enable_if_t< is_constructible_v<value_type, initializer_list<_Up>&, _Args...> > >
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _Tp& emplace(initializer_list<_Up> __il, _Args&&... __args) {
+ reset();
+ this->__construct(__il, std::forward<_Args>(__args)...);
+ return this->__get();
+ }
- template <class _Up, class... _Args,
- class = enable_if_t
- <
- is_constructible_v<value_type, initializer_list<_Up>&, _Args...>
- >
- >
- _LIBCPP_HIDE_FROM_ABI
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _Tp &
- emplace(initializer_list<_Up> __il, _Args&&... __args)
- {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void
+ swap(optional& __opt) noexcept(is_nothrow_move_constructible_v<value_type> && is_nothrow_swappable_v<value_type>) {
+ if (this->has_value() == __opt.has_value()) {
+ using std::swap;
+ if (this->has_value())
+ swap(this->__get(), __opt.__get());
+ } else {
+ if (this->has_value()) {
+ __opt.__construct(std::move(this->__get()));
reset();
- this->__construct(__il, std::forward<_Args>(__args)...);
- return this->__get();
- }
-
- _LIBCPP_HIDE_FROM_ABI
- _LIBCPP_CONSTEXPR_SINCE_CXX20 void swap(optional& __opt)
- noexcept(is_nothrow_move_constructible_v<value_type> &&
- is_nothrow_swappable_v<value_type>)
- {
- if (this->has_value() == __opt.has_value())
- {
- using std::swap;
- if (this->has_value())
- swap(this->__get(), __opt.__get());
- }
- else
- {
- if (this->has_value())
- {
- __opt.__construct(std::move(this->__get()));
- reset();
- }
- else
- {
- this->__construct(std::move(__opt.__get()));
- __opt.reset();
- }
- }
+ } else {
+ this->__construct(std::move(__opt.__get()));
+ __opt.reset();
+ }
}
+ }
- _LIBCPP_HIDE_FROM_ABI
- constexpr
- add_pointer_t<value_type const>
- operator->() const
- {
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(this->has_value(), "optional operator-> called on a disengaged value");
- return std::addressof(this->__get());
- }
+ _LIBCPP_HIDE_FROM_ABI constexpr add_pointer_t<value_type const> operator->() const {
+ _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(this->has_value(), "optional operator-> called on a disengaged value");
+ return std::addressof(this->__get());
+ }
- _LIBCPP_HIDE_FROM_ABI
- constexpr
- add_pointer_t<value_type>
- operator->()
- {
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(this->has_value(), "optional operator-> called on a disengaged value");
- return std::addressof(this->__get());
- }
+ _LIBCPP_HIDE_FROM_ABI constexpr add_pointer_t<value_type> operator->() {
+ _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(this->has_value(), "optional operator-> called on a disengaged value");
+ return std::addressof(this->__get());
+ }
- _LIBCPP_HIDE_FROM_ABI
- constexpr
- const value_type&
- operator*() const& noexcept
- {
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(this->has_value(), "optional operator* called on a disengaged value");
- return this->__get();
- }
+ _LIBCPP_HIDE_FROM_ABI constexpr const value_type& operator*() const& noexcept {
+ _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(this->has_value(), "optional operator* called on a disengaged value");
+ return this->__get();
+ }
- _LIBCPP_HIDE_FROM_ABI
- constexpr
- value_type&
- operator*() & noexcept
- {
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(this->has_value(), "optional operator* called on a disengaged value");
- return this->__get();
- }
+ _LIBCPP_HIDE_FROM_ABI constexpr value_type& operator*() & noexcept {
+ _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(this->has_value(), "optional operator* called on a disengaged value");
+ return this->__get();
+ }
- _LIBCPP_HIDE_FROM_ABI
- constexpr
- value_type&&
- operator*() && noexcept
- {
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(this->has_value(), "optional operator* called on a disengaged value");
- return std::move(this->__get());
- }
+ _LIBCPP_HIDE_FROM_ABI constexpr value_type&& operator*() && noexcept {
+ _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(this->has_value(), "optional operator* called on a disengaged value");
+ return std::move(this->__get());
+ }
- _LIBCPP_HIDE_FROM_ABI
- constexpr
- const value_type&&
- operator*() const&& noexcept
- {
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(this->has_value(), "optional operator* called on a disengaged value");
- return std::move(this->__get());
- }
+ _LIBCPP_HIDE_FROM_ABI constexpr const value_type&& operator*() const&& noexcept {
+ _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(this->has_value(), "optional operator* called on a disengaged value");
+ return std::move(this->__get());
+ }
- _LIBCPP_HIDE_FROM_ABI
- constexpr explicit operator bool() const noexcept { return has_value(); }
+ _LIBCPP_HIDE_FROM_ABI constexpr explicit operator bool() const noexcept { return has_value(); }
- using __base::has_value;
- using __base::__get;
+ using __base::__get;
+ using __base::has_value;
- _LIBCPP_HIDE_FROM_ABI
- _LIBCPP_AVAILABILITY_THROW_BAD_OPTIONAL_ACCESS
- constexpr value_type const& value() const&
- {
- if (!this->has_value())
- __throw_bad_optional_access();
- return this->__get();
- }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_THROW_BAD_OPTIONAL_ACCESS constexpr value_type const& value() const& {
+ if (!this->has_value())
+ __throw_bad_optional_access();
+ return this->__get();
+ }
- _LIBCPP_HIDE_FROM_ABI
- _LIBCPP_AVAILABILITY_THROW_BAD_OPTIONAL_ACCESS
- constexpr value_type& value() &
- {
- if (!this->has_value())
- __throw_bad_optional_access();
- return this->__get();
- }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_THROW_BAD_OPTIONAL_ACCESS constexpr value_type& value() & {
+ if (!this->has_value())
+ __throw_bad_optional_access();
+ return this->__get();
+ }
- _LIBCPP_HIDE_FROM_ABI
- _LIBCPP_AVAILABILITY_THROW_BAD_OPTIONAL_ACCESS
- constexpr value_type&& value() &&
- {
- if (!this->has_value())
- __throw_bad_optional_access();
- return std::move(this->__get());
- }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_THROW_BAD_OPTIONAL_ACCESS constexpr value_type&& value() && {
+ if (!this->has_value())
+ __throw_bad_optional_access();
+ return std::move(this->__get());
+ }
- _LIBCPP_HIDE_FROM_ABI
- _LIBCPP_AVAILABILITY_THROW_BAD_OPTIONAL_ACCESS
- constexpr value_type const&& value() const&&
- {
- if (!this->has_value())
- __throw_bad_optional_access();
- return std::move(this->__get());
- }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_THROW_BAD_OPTIONAL_ACCESS constexpr value_type const&& value() const&& {
+ if (!this->has_value())
+ __throw_bad_optional_access();
+ return std::move(this->__get());
+ }
- template <class _Up>
- _LIBCPP_HIDE_FROM_ABI
- constexpr value_type value_or(_Up&& __v) const&
- {
- static_assert(is_copy_constructible_v<value_type>,
- "optional<T>::value_or: T must be copy constructible");
- static_assert(is_convertible_v<_Up, value_type>,
- "optional<T>::value_or: U must be convertible to T");
- return this->has_value() ? this->__get() :
- static_cast<value_type>(std::forward<_Up>(__v));
- }
+ template <class _Up>
+ _LIBCPP_HIDE_FROM_ABI constexpr value_type value_or(_Up&& __v) const& {
+ static_assert(is_copy_constructible_v<value_type>, "optional<T>::value_or: T must be copy constructible");
+ static_assert(is_convertible_v<_Up, value_type>, "optional<T>::value_or: U must be convertible to T");
+ return this->has_value() ? this->__get() : static_cast<value_type>(std::forward<_Up>(__v));
+ }
- template <class _Up>
- _LIBCPP_HIDE_FROM_ABI
- constexpr value_type value_or(_Up&& __v) &&
- {
- static_assert(is_move_constructible_v<value_type>,
- "optional<T>::value_or: T must be move constructible");
- static_assert(is_convertible_v<_Up, value_type>,
- "optional<T>::value_or: U must be convertible to T");
- return this->has_value() ? std::move(this->__get()) :
- static_cast<value_type>(std::forward<_Up>(__v));
- }
+ template <class _Up>
+ _LIBCPP_HIDE_FROM_ABI constexpr value_type value_or(_Up&& __v) && {
+ static_assert(is_move_constructible_v<value_type>, "optional<T>::value_or: T must be move constructible");
+ static_assert(is_convertible_v<_Up, value_type>, "optional<T>::value_or: U must be convertible to T");
+ return this->has_value() ? std::move(this->__get()) : static_cast<value_type>(std::forward<_Up>(__v));
+ }
-#if _LIBCPP_STD_VER >= 23
- template<class _Func>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_THROW_BAD_OPTIONAL_ACCESS
- constexpr auto and_then(_Func&& __f) & {
+# if _LIBCPP_STD_VER >= 23
+ template <class _Func>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_THROW_BAD_OPTIONAL_ACCESS constexpr auto and_then(_Func&& __f) & {
using _Up = invoke_result_t<_Func, value_type&>;
static_assert(__is_std_optional<remove_cvref_t<_Up>>::value,
"Result of f(value()) must be a specialization of std::optional");
@@ -1123,9 +871,8 @@ public:
return remove_cvref_t<_Up>();
}
- template<class _Func>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_THROW_BAD_OPTIONAL_ACCESS
- constexpr auto and_then(_Func&& __f) const& {
+ template <class _Func>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_THROW_BAD_OPTIONAL_ACCESS constexpr auto and_then(_Func&& __f) const& {
using _Up = invoke_result_t<_Func, const value_type&>;
static_assert(__is_std_optional<remove_cvref_t<_Up>>::value,
"Result of f(value()) must be a specialization of std::optional");
@@ -1134,9 +881,8 @@ public:
return remove_cvref_t<_Up>();
}
- template<class _Func>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_THROW_BAD_OPTIONAL_ACCESS
- constexpr auto and_then(_Func&& __f) && {
+ template <class _Func>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_THROW_BAD_OPTIONAL_ACCESS constexpr auto and_then(_Func&& __f) && {
using _Up = invoke_result_t<_Func, value_type&&>;
static_assert(__is_std_optional<remove_cvref_t<_Up>>::value,
"Result of f(std::move(value())) must be a specialization of std::optional");
@@ -1145,9 +891,8 @@ public:
return remove_cvref_t<_Up>();
}
- template<class _Func>
- _LIBCPP_HIDE_FROM_ABI
- constexpr auto and_then(_Func&& __f) const&& {
+ template <class _Func>
+ _LIBCPP_HIDE_FROM_ABI constexpr auto and_then(_Func&& __f) const&& {
using _Up = invoke_result_t<_Func, const value_type&&>;
static_assert(__is_std_optional<remove_cvref_t<_Up>>::value,
"Result of f(std::move(value())) must be a specialization of std::optional");
@@ -1156,69 +901,58 @@ public:
return remove_cvref_t<_Up>();
}
- template<class _Func>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_THROW_BAD_OPTIONAL_ACCESS
- constexpr auto transform(_Func&& __f) & {
+ template <class _Func>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_THROW_BAD_OPTIONAL_ACCESS constexpr auto transform(_Func&& __f) & {
using _Up = remove_cv_t<invoke_result_t<_Func, value_type&>>;
static_assert(!is_array_v<_Up>, "Result of f(value()) should not be an Array");
- static_assert(!is_same_v<_Up, in_place_t>,
- "Result of f(value()) should not be std::in_place_t");
- static_assert(!is_same_v<_Up, nullopt_t>,
- "Result of f(value()) should not be std::nullopt_t");
+ static_assert(!is_same_v<_Up, in_place_t>, "Result of f(value()) should not be std::in_place_t");
+ static_assert(!is_same_v<_Up, nullopt_t>, "Result of f(value()) should not be std::nullopt_t");
static_assert(is_object_v<_Up>, "Result of f(value()) should be an object type");
if (*this)
return optional<_Up>(__optional_construct_from_invoke_tag{}, std::forward<_Func>(__f), value());
return optional<_Up>();
}
- template<class _Func>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_THROW_BAD_OPTIONAL_ACCESS
- constexpr auto transform(_Func&& __f) const& {
+ template <class _Func>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_THROW_BAD_OPTIONAL_ACCESS constexpr auto transform(_Func&& __f) const& {
using _Up = remove_cv_t<invoke_result_t<_Func, const value_type&>>;
static_assert(!is_array_v<_Up>, "Result of f(value()) should not be an Array");
- static_assert(!is_same_v<_Up, in_place_t>,
- "Result of f(value()) should not be std::in_place_t");
- static_assert(!is_same_v<_Up, nullopt_t>,
- "Result of f(value()) should not be std::nullopt_t");
+ static_assert(!is_same_v<_Up, in_place_t>, "Result of f(value()) should not be std::in_place_t");
+ static_assert(!is_same_v<_Up, nullopt_t>, "Result of f(value()) should not be std::nullopt_t");
static_assert(is_object_v<_Up>, "Result of f(value()) should be an object type");
if (*this)
return optional<_Up>(__optional_construct_from_invoke_tag{}, std::forward<_Func>(__f), value());
return optional<_Up>();
}
- template<class _Func>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_THROW_BAD_OPTIONAL_ACCESS
- constexpr auto transform(_Func&& __f) && {
+ template <class _Func>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_THROW_BAD_OPTIONAL_ACCESS constexpr auto transform(_Func&& __f) && {
using _Up = remove_cv_t<invoke_result_t<_Func, value_type&&>>;
static_assert(!is_array_v<_Up>, "Result of f(std::move(value())) should not be an Array");
- static_assert(!is_same_v<_Up, in_place_t>,
- "Result of f(std::move(value())) should not be std::in_place_t");
- static_assert(!is_same_v<_Up, nullopt_t>,
- "Result of f(std::move(value())) should not be std::nullopt_t");
+ static_assert(!is_same_v<_Up, in_place_t>, "Result of f(std::move(value())) should not be std::in_place_t");
+ static_assert(!is_same_v<_Up, nullopt_t>, "Result of f(std::move(value())) should not be std::nullopt_t");
static_assert(is_object_v<_Up>, "Result of f(std::move(value())) should be an object type");
if (*this)
return optional<_Up>(__optional_construct_from_invoke_tag{}, std::forward<_Func>(__f), std::move(value()));
return optional<_Up>();
}
- template<class _Func>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_THROW_BAD_OPTIONAL_ACCESS
- constexpr auto transform(_Func&& __f) const&& {
+ template <class _Func>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_THROW_BAD_OPTIONAL_ACCESS constexpr auto transform(_Func&& __f) const&& {
using _Up = remove_cvref_t<invoke_result_t<_Func, const value_type&&>>;
static_assert(!is_array_v<_Up>, "Result of f(std::move(value())) should not be an Array");
- static_assert(!is_same_v<_Up, in_place_t>,
- "Result of f(std::move(value())) should not be std::in_place_t");
- static_assert(!is_same_v<_Up, nullopt_t>,
- "Result of f(std::move(value())) should not be std::nullopt_t");
+ static_assert(!is_same_v<_Up, in_place_t>, "Result of f(std::move(value())) should not be std::in_place_t");
+ static_assert(!is_same_v<_Up, nullopt_t>, "Result of f(std::move(value())) should not be std::nullopt_t");
static_assert(is_object_v<_Up>, "Result of f(std::move(value())) should be an object type");
if (*this)
return optional<_Up>(__optional_construct_from_invoke_tag{}, std::forward<_Func>(__f), std::move(value()));
return optional<_Up>();
}
- template<invocable _Func>
- _LIBCPP_HIDE_FROM_ABI
- constexpr optional or_else(_Func&& __f) const& requires is_copy_constructible_v<value_type> {
+ template <invocable _Func>
+ _LIBCPP_HIDE_FROM_ABI constexpr optional or_else(_Func&& __f) const&
+ requires is_copy_constructible_v<value_type>
+ {
static_assert(is_same_v<remove_cvref_t<invoke_result_t<_Func>>, optional>,
"Result of f() should be the same type as this optional");
if (*this)
@@ -1226,446 +960,323 @@ public:
return std::forward<_Func>(__f)();
}
- template<invocable _Func>
- _LIBCPP_HIDE_FROM_ABI
- constexpr optional or_else(_Func&& __f) && requires is_move_constructible_v<value_type> {
+ template <invocable _Func>
+ _LIBCPP_HIDE_FROM_ABI constexpr optional or_else(_Func&& __f) &&
+ requires is_move_constructible_v<value_type>
+ {
static_assert(is_same_v<remove_cvref_t<invoke_result_t<_Func>>, optional>,
"Result of f() should be the same type as this optional");
if (*this)
return std::move(*this);
return std::forward<_Func>(__f)();
}
-#endif // _LIBCPP_STD_VER >= 23
+# endif // _LIBCPP_STD_VER >= 23
- using __base::reset;
+ using __base::reset;
};
-#if _LIBCPP_STD_VER >= 17
-template<class _Tp>
- optional(_Tp) -> optional<_Tp>;
-#endif
+# if _LIBCPP_STD_VER >= 17
+template <class _Tp>
+optional(_Tp) -> optional<_Tp>;
+# endif
// Comparisons between optionals
template <class _Tp, class _Up>
-_LIBCPP_HIDE_FROM_ABI constexpr
-enable_if_t<
- is_convertible_v<decltype(std::declval<const _Tp&>() ==
- std::declval<const _Up&>()), bool>,
- bool
->
-operator==(const optional<_Tp>& __x, const optional<_Up>& __y)
-{
- if (static_cast<bool>(__x) != static_cast<bool>(__y))
- return false;
- if (!static_cast<bool>(__x))
- return true;
- return *__x == *__y;
+_LIBCPP_HIDE_FROM_ABI constexpr enable_if_t<
+ is_convertible_v<decltype(std::declval<const _Tp&>() == std::declval<const _Up&>()), bool>,
+ bool >
+operator==(const optional<_Tp>& __x, const optional<_Up>& __y) {
+ if (static_cast<bool>(__x) != static_cast<bool>(__y))
+ return false;
+ if (!static_cast<bool>(__x))
+ return true;
+ return *__x == *__y;
}
template <class _Tp, class _Up>
-_LIBCPP_HIDE_FROM_ABI constexpr
-enable_if_t<
- is_convertible_v<decltype(std::declval<const _Tp&>() !=
- std::declval<const _Up&>()), bool>,
- bool
->
-operator!=(const optional<_Tp>& __x, const optional<_Up>& __y)
-{
- if (static_cast<bool>(__x) != static_cast<bool>(__y))
- return true;
- if (!static_cast<bool>(__x))
- return false;
- return *__x != *__y;
+_LIBCPP_HIDE_FROM_ABI constexpr enable_if_t<
+ is_convertible_v<decltype(std::declval<const _Tp&>() != std::declval<const _Up&>()), bool>,
+ bool >
+operator!=(const optional<_Tp>& __x, const optional<_Up>& __y) {
+ if (static_cast<bool>(__x) != static_cast<bool>(__y))
+ return true;
+ if (!static_cast<bool>(__x))
+ return false;
+ return *__x != *__y;
}
template <class _Tp, class _Up>
-_LIBCPP_HIDE_FROM_ABI constexpr
-enable_if_t<
- is_convertible_v<decltype(std::declval<const _Tp&>() <
- std::declval<const _Up&>()), bool>,
- bool
->
-operator<(const optional<_Tp>& __x, const optional<_Up>& __y)
-{
- if (!static_cast<bool>(__y))
- return false;
- if (!static_cast<bool>(__x))
- return true;
- return *__x < *__y;
+_LIBCPP_HIDE_FROM_ABI constexpr enable_if_t<
+ is_convertible_v<decltype(std::declval<const _Tp&>() < std::declval<const _Up&>()), bool>,
+ bool >
+operator<(const optional<_Tp>& __x, const optional<_Up>& __y) {
+ if (!static_cast<bool>(__y))
+ return false;
+ if (!static_cast<bool>(__x))
+ return true;
+ return *__x < *__y;
}
template <class _Tp, class _Up>
-_LIBCPP_HIDE_FROM_ABI constexpr
-enable_if_t<
- is_convertible_v<decltype(std::declval<const _Tp&>() >
- std::declval<const _Up&>()), bool>,
- bool
->
-operator>(const optional<_Tp>& __x, const optional<_Up>& __y)
-{
- if (!static_cast<bool>(__x))
- return false;
- if (!static_cast<bool>(__y))
- return true;
- return *__x > *__y;
+_LIBCPP_HIDE_FROM_ABI constexpr enable_if_t<
+ is_convertible_v<decltype(std::declval<const _Tp&>() > std::declval<const _Up&>()), bool>,
+ bool >
+operator>(const optional<_Tp>& __x, const optional<_Up>& __y) {
+ if (!static_cast<bool>(__x))
+ return false;
+ if (!static_cast<bool>(__y))
+ return true;
+ return *__x > *__y;
}
template <class _Tp, class _Up>
-_LIBCPP_HIDE_FROM_ABI constexpr
-enable_if_t<
- is_convertible_v<decltype(std::declval<const _Tp&>() <=
- std::declval<const _Up&>()), bool>,
- bool
->
-operator<=(const optional<_Tp>& __x, const optional<_Up>& __y)
-{
- if (!static_cast<bool>(__x))
- return true;
- if (!static_cast<bool>(__y))
- return false;
- return *__x <= *__y;
+_LIBCPP_HIDE_FROM_ABI constexpr enable_if_t<
+ is_convertible_v<decltype(std::declval<const _Tp&>() <= std::declval<const _Up&>()), bool>,
+ bool >
+operator<=(const optional<_Tp>& __x, const optional<_Up>& __y) {
+ if (!static_cast<bool>(__x))
+ return true;
+ if (!static_cast<bool>(__y))
+ return false;
+ return *__x <= *__y;
}
template <class _Tp, class _Up>
-_LIBCPP_HIDE_FROM_ABI constexpr
-enable_if_t<
- is_convertible_v<decltype(std::declval<const _Tp&>() >=
- std::declval<const _Up&>()), bool>,
- bool
->
-operator>=(const optional<_Tp>& __x, const optional<_Up>& __y)
-{
- if (!static_cast<bool>(__y))
- return true;
- if (!static_cast<bool>(__x))
- return false;
- return *__x >= *__y;
+_LIBCPP_HIDE_FROM_ABI constexpr enable_if_t<
+ is_convertible_v<decltype(std::declval<const _Tp&>() >= std::declval<const _Up&>()), bool>,
+ bool >
+operator>=(const optional<_Tp>& __x, const optional<_Up>& __y) {
+ if (!static_cast<bool>(__y))
+ return true;
+ if (!static_cast<bool>(__x))
+ return false;
+ return *__x >= *__y;
}
-#if _LIBCPP_STD_VER >= 20
+# if _LIBCPP_STD_VER >= 20
template <class _Tp, three_way_comparable_with<_Tp> _Up>
_LIBCPP_HIDE_FROM_ABI constexpr compare_three_way_result_t<_Tp, _Up>
operator<=>(const optional<_Tp>& __x, const optional<_Up>& __y) {
- if (__x && __y)
- return *__x <=> *__y;
- return __x.has_value() <=> __y.has_value();
+ if (__x && __y)
+ return *__x <=> *__y;
+ return __x.has_value() <=> __y.has_value();
}
-#endif // _LIBCPP_STD_VER >= 20
+# endif // _LIBCPP_STD_VER >= 20
// Comparisons with nullopt
template <class _Tp>
-_LIBCPP_HIDE_FROM_ABI constexpr
-bool
-operator==(const optional<_Tp>& __x, nullopt_t) noexcept
-{
- return !static_cast<bool>(__x);
+_LIBCPP_HIDE_FROM_ABI constexpr bool operator==(const optional<_Tp>& __x, nullopt_t) noexcept {
+ return !static_cast<bool>(__x);
}
-#if _LIBCPP_STD_VER <= 17
+# if _LIBCPP_STD_VER <= 17
template <class _Tp>
-_LIBCPP_HIDE_FROM_ABI constexpr
-bool
-operator==(nullopt_t, const optional<_Tp>& __x) noexcept
-{
- return !static_cast<bool>(__x);
+_LIBCPP_HIDE_FROM_ABI constexpr bool operator==(nullopt_t, const optional<_Tp>& __x) noexcept {
+ return !static_cast<bool>(__x);
}
template <class _Tp>
-_LIBCPP_HIDE_FROM_ABI constexpr
-bool
-operator!=(const optional<_Tp>& __x, nullopt_t) noexcept
-{
- return static_cast<bool>(__x);
+_LIBCPP_HIDE_FROM_ABI constexpr bool operator!=(const optional<_Tp>& __x, nullopt_t) noexcept {
+ return static_cast<bool>(__x);
}
template <class _Tp>
-_LIBCPP_HIDE_FROM_ABI constexpr
-bool
-operator!=(nullopt_t, const optional<_Tp>& __x) noexcept
-{
- return static_cast<bool>(__x);
+_LIBCPP_HIDE_FROM_ABI constexpr bool operator!=(nullopt_t, const optional<_Tp>& __x) noexcept {
+ return static_cast<bool>(__x);
}
template <class _Tp>
-_LIBCPP_HIDE_FROM_ABI constexpr
-bool
-operator<(const optional<_Tp>&, nullopt_t) noexcept
-{
- return false;
+_LIBCPP_HIDE_FROM_ABI constexpr bool operator<(const optional<_Tp>&, nullopt_t) noexcept {
+ return false;
}
template <class _Tp>
-_LIBCPP_HIDE_FROM_ABI constexpr
-bool
-operator<(nullopt_t, const optional<_Tp>& __x) noexcept
-{
- return static_cast<bool>(__x);
+_LIBCPP_HIDE_FROM_ABI constexpr bool operator<(nullopt_t, const optional<_Tp>& __x) noexcept {
+ return static_cast<bool>(__x);
}
template <class _Tp>
-_LIBCPP_HIDE_FROM_ABI constexpr
-bool
-operator<=(const optional<_Tp>& __x, nullopt_t) noexcept
-{
- return !static_cast<bool>(__x);
+_LIBCPP_HIDE_FROM_ABI constexpr bool operator<=(const optional<_Tp>& __x, nullopt_t) noexcept {
+ return !static_cast<bool>(__x);
}
template <class _Tp>
-_LIBCPP_HIDE_FROM_ABI constexpr
-bool
-operator<=(nullopt_t, const optional<_Tp>&) noexcept
-{
- return true;
+_LIBCPP_HIDE_FROM_ABI constexpr bool operator<=(nullopt_t, const optional<_Tp>&) noexcept {
+ return true;
}
template <class _Tp>
-_LIBCPP_HIDE_FROM_ABI constexpr
-bool
-operator>(const optional<_Tp>& __x, nullopt_t) noexcept
-{
- return static_cast<bool>(__x);
+_LIBCPP_HIDE_FROM_ABI constexpr bool operator>(const optional<_Tp>& __x, nullopt_t) noexcept {
+ return static_cast<bool>(__x);
}
template <class _Tp>
-_LIBCPP_HIDE_FROM_ABI constexpr
-bool
-operator>(nullopt_t, const optional<_Tp>&) noexcept
-{
- return false;
+_LIBCPP_HIDE_FROM_ABI constexpr bool operator>(nullopt_t, const optional<_Tp>&) noexcept {
+ return false;
}
template <class _Tp>
-_LIBCPP_HIDE_FROM_ABI constexpr
-bool
-operator>=(const optional<_Tp>&, nullopt_t) noexcept
-{
- return true;
+_LIBCPP_HIDE_FROM_ABI constexpr bool operator>=(const optional<_Tp>&, nullopt_t) noexcept {
+ return true;
}
template <class _Tp>
-_LIBCPP_HIDE_FROM_ABI constexpr
-bool
-operator>=(nullopt_t, const optional<_Tp>& __x) noexcept
-{
- return !static_cast<bool>(__x);
+_LIBCPP_HIDE_FROM_ABI constexpr bool operator>=(nullopt_t, const optional<_Tp>& __x) noexcept {
+ return !static_cast<bool>(__x);
}
-#else // _LIBCPP_STD_VER <= 17
+# else // _LIBCPP_STD_VER <= 17
template <class _Tp>
_LIBCPP_HIDE_FROM_ABI constexpr strong_ordering operator<=>(const optional<_Tp>& __x, nullopt_t) noexcept {
- return __x.has_value() <=> false;
+ return __x.has_value() <=> false;
}
-#endif // _LIBCPP_STD_VER <= 17
+# endif // _LIBCPP_STD_VER <= 17
// Comparisons with T
template <class _Tp, class _Up>
-_LIBCPP_HIDE_FROM_ABI constexpr
-enable_if_t<
- is_convertible_v<decltype(std::declval<const _Tp&>() ==
- std::declval<const _Up&>()), bool>,
- bool
->
-operator==(const optional<_Tp>& __x, const _Up& __v)
-{
- return static_cast<bool>(__x) ? *__x == __v : false;
+_LIBCPP_HIDE_FROM_ABI constexpr enable_if_t<
+ is_convertible_v<decltype(std::declval<const _Tp&>() == std::declval<const _Up&>()), bool>,
+ bool >
+operator==(const optional<_Tp>& __x, const _Up& __v) {
+ return static_cast<bool>(__x) ? *__x == __v : false;
}
template <class _Tp, class _Up>
-_LIBCPP_HIDE_FROM_ABI constexpr
-enable_if_t<
- is_convertible_v<decltype(std::declval<const _Tp&>() ==
- std::declval<const _Up&>()), bool>,
- bool
->
-operator==(const _Tp& __v, const optional<_Up>& __x)
-{
- return static_cast<bool>(__x) ? __v == *__x : false;
+_LIBCPP_HIDE_FROM_ABI constexpr enable_if_t<
+ is_convertible_v<decltype(std::declval<const _Tp&>() == std::declval<const _Up&>()), bool>,
+ bool >
+operator==(const _Tp& __v, const optional<_Up>& __x) {
+ return static_cast<bool>(__x) ? __v == *__x : false;
}
template <class _Tp, class _Up>
-_LIBCPP_HIDE_FROM_ABI constexpr
-enable_if_t<
- is_convertible_v<decltype(std::declval<const _Tp&>() !=
- std::declval<const _Up&>()), bool>,
- bool
->
-operator!=(const optional<_Tp>& __x, const _Up& __v)
-{
- return static_cast<bool>(__x) ? *__x != __v : true;
+_LIBCPP_HIDE_FROM_ABI constexpr enable_if_t<
+ is_convertible_v<decltype(std::declval<const _Tp&>() != std::declval<const _Up&>()), bool>,
+ bool >
+operator!=(const optional<_Tp>& __x, const _Up& __v) {
+ return static_cast<bool>(__x) ? *__x != __v : true;
}
template <class _Tp, class _Up>
-_LIBCPP_HIDE_FROM_ABI constexpr
-enable_if_t<
- is_convertible_v<decltype(std::declval<const _Tp&>() !=
- std::declval<const _Up&>()), bool>,
- bool
->
-operator!=(const _Tp& __v, const optional<_Up>& __x)
-{
- return static_cast<bool>(__x) ? __v != *__x : true;
+_LIBCPP_HIDE_FROM_ABI constexpr enable_if_t<
+ is_convertible_v<decltype(std::declval<const _Tp&>() != std::declval<const _Up&>()), bool>,
+ bool >
+operator!=(const _Tp& __v, const optional<_Up>& __x) {
+ return static_cast<bool>(__x) ? __v != *__x : true;
}
template <class _Tp, class _Up>
-_LIBCPP_HIDE_FROM_ABI constexpr
-enable_if_t<
- is_convertible_v<decltype(std::declval<const _Tp&>() <
- std::declval<const _Up&>()), bool>,
- bool
->
-operator<(const optional<_Tp>& __x, const _Up& __v)
-{
- return static_cast<bool>(__x) ? *__x < __v : true;
+_LIBCPP_HIDE_FROM_ABI constexpr enable_if_t<
+ is_convertible_v<decltype(std::declval<const _Tp&>() < std::declval<const _Up&>()), bool>,
+ bool >
+operator<(const optional<_Tp>& __x, const _Up& __v) {
+ return static_cast<bool>(__x) ? *__x < __v : true;
}
template <class _Tp, class _Up>
-_LIBCPP_HIDE_FROM_ABI constexpr
-enable_if_t<
- is_convertible_v<decltype(std::declval<const _Tp&>() <
- std::declval<const _Up&>()), bool>,
- bool
->
-operator<(const _Tp& __v, const optional<_Up>& __x)
-{
- return static_cast<bool>(__x) ? __v < *__x : false;
+_LIBCPP_HIDE_FROM_ABI constexpr enable_if_t<
+ is_convertible_v<decltype(std::declval<const _Tp&>() < std::declval<const _Up&>()), bool>,
+ bool >
+operator<(const _Tp& __v, const optional<_Up>& __x) {
+ return static_cast<bool>(__x) ? __v < *__x : false;
}
template <class _Tp, class _Up>
-_LIBCPP_HIDE_FROM_ABI constexpr
-enable_if_t<
- is_convertible_v<decltype(std::declval<const _Tp&>() <=
- std::declval<const _Up&>()), bool>,
- bool
->
-operator<=(const optional<_Tp>& __x, const _Up& __v)
-{
- return static_cast<bool>(__x) ? *__x <= __v : true;
+_LIBCPP_HIDE_FROM_ABI constexpr enable_if_t<
+ is_convertible_v<decltype(std::declval<const _Tp&>() <= std::declval<const _Up&>()), bool>,
+ bool >
+operator<=(const optional<_Tp>& __x, const _Up& __v) {
+ return static_cast<bool>(__x) ? *__x <= __v : true;
}
template <class _Tp, class _Up>
-_LIBCPP_HIDE_FROM_ABI constexpr
-enable_if_t<
- is_convertible_v<decltype(std::declval<const _Tp&>() <=
- std::declval<const _Up&>()), bool>,
- bool
->
-operator<=(const _Tp& __v, const optional<_Up>& __x)
-{
- return static_cast<bool>(__x) ? __v <= *__x : false;
+_LIBCPP_HIDE_FROM_ABI constexpr enable_if_t<
+ is_convertible_v<decltype(std::declval<const _Tp&>() <= std::declval<const _Up&>()), bool>,
+ bool >
+operator<=(const _Tp& __v, const optional<_Up>& __x) {
+ return static_cast<bool>(__x) ? __v <= *__x : false;
}
template <class _Tp, class _Up>
-_LIBCPP_HIDE_FROM_ABI constexpr
-enable_if_t<
- is_convertible_v<decltype(std::declval<const _Tp&>() >
- std::declval<const _Up&>()), bool>,
- bool
->
-operator>(const optional<_Tp>& __x, const _Up& __v)
-{
- return static_cast<bool>(__x) ? *__x > __v : false;
+_LIBCPP_HIDE_FROM_ABI constexpr enable_if_t<
+ is_convertible_v<decltype(std::declval<const _Tp&>() > std::declval<const _Up&>()), bool>,
+ bool >
+operator>(const optional<_Tp>& __x, const _Up& __v) {
+ return static_cast<bool>(__x) ? *__x > __v : false;
}
template <class _Tp, class _Up>
-_LIBCPP_HIDE_FROM_ABI constexpr
-enable_if_t<
- is_convertible_v<decltype(std::declval<const _Tp&>() >
- std::declval<const _Up&>()), bool>,
- bool
->
-operator>(const _Tp& __v, const optional<_Up>& __x)
-{
- return static_cast<bool>(__x) ? __v > *__x : true;
+_LIBCPP_HIDE_FROM_ABI constexpr enable_if_t<
+ is_convertible_v<decltype(std::declval<const _Tp&>() > std::declval<const _Up&>()), bool>,
+ bool >
+operator>(const _Tp& __v, const optional<_Up>& __x) {
+ return static_cast<bool>(__x) ? __v > *__x : true;
}
template <class _Tp, class _Up>
-_LIBCPP_HIDE_FROM_ABI constexpr
-enable_if_t<
- is_convertible_v<decltype(std::declval<const _Tp&>() >=
- std::declval<const _Up&>()), bool>,
- bool
->
-operator>=(const optional<_Tp>& __x, const _Up& __v)
-{
- return static_cast<bool>(__x) ? *__x >= __v : false;
+_LIBCPP_HIDE_FROM_ABI constexpr enable_if_t<
+ is_convertible_v<decltype(std::declval<const _Tp&>() >= std::declval<const _Up&>()), bool>,
+ bool >
+operator>=(const optional<_Tp>& __x, const _Up& __v) {
+ return static_cast<bool>(__x) ? *__x >= __v : false;
}
template <class _Tp, class _Up>
-_LIBCPP_HIDE_FROM_ABI constexpr
-enable_if_t<
- is_convertible_v<decltype(std::declval<const _Tp&>() >=
- std::declval<const _Up&>()), bool>,
- bool
->
-operator>=(const _Tp& __v, const optional<_Up>& __x)
-{
- return static_cast<bool>(__x) ? __v >= *__x : true;
+_LIBCPP_HIDE_FROM_ABI constexpr enable_if_t<
+ is_convertible_v<decltype(std::declval<const _Tp&>() >= std::declval<const _Up&>()), bool>,
+ bool >
+operator>=(const _Tp& __v, const optional<_Up>& __x) {
+ return static_cast<bool>(__x) ? __v >= *__x : true;
}
-#if _LIBCPP_STD_VER >= 20
+# if _LIBCPP_STD_VER >= 20
template <class _Tp, class _Up>
requires(!__is_derived_from_optional<_Up>) && three_way_comparable_with<_Tp, _Up>
_LIBCPP_HIDE_FROM_ABI constexpr compare_three_way_result_t<_Tp, _Up>
operator<=>(const optional<_Tp>& __x, const _Up& __v) {
- return __x.has_value() ? *__x <=> __v : strong_ordering::less;
+ return __x.has_value() ? *__x <=> __v : strong_ordering::less;
}
-#endif // _LIBCPP_STD_VER >= 20
-
+# endif // _LIBCPP_STD_VER >= 20
template <class _Tp>
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-enable_if_t<
- is_move_constructible_v<_Tp> && is_swappable_v<_Tp>,
- void
->
-swap(optional<_Tp>& __x, optional<_Tp>& __y) noexcept(noexcept(__x.swap(__y)))
-{
- __x.swap(__y);
+ enable_if_t< is_move_constructible_v<_Tp> && is_swappable_v<_Tp>, void >
+ swap(optional<_Tp>& __x, optional<_Tp>& __y) noexcept(noexcept(__x.swap(__y))) {
+ __x.swap(__y);
}
template <class _Tp>
-_LIBCPP_HIDE_FROM_ABI constexpr
-optional<decay_t<_Tp>> make_optional(_Tp&& __v)
-{
- return optional<decay_t<_Tp>>(std::forward<_Tp>(__v));
+_LIBCPP_HIDE_FROM_ABI constexpr optional<decay_t<_Tp>> make_optional(_Tp&& __v) {
+ return optional<decay_t<_Tp>>(std::forward<_Tp>(__v));
}
template <class _Tp, class... _Args>
-_LIBCPP_HIDE_FROM_ABI constexpr
-optional<_Tp> make_optional(_Args&&... __args)
-{
- return optional<_Tp>(in_place, std::forward<_Args>(__args)...);
+_LIBCPP_HIDE_FROM_ABI constexpr optional<_Tp> make_optional(_Args&&... __args) {
+ return optional<_Tp>(in_place, std::forward<_Args>(__args)...);
}
template <class _Tp, class _Up, class... _Args>
-_LIBCPP_HIDE_FROM_ABI constexpr
-optional<_Tp> make_optional(initializer_list<_Up> __il, _Args&&... __args)
-{
- return optional<_Tp>(in_place, __il, std::forward<_Args>(__args)...);
+_LIBCPP_HIDE_FROM_ABI constexpr optional<_Tp> make_optional(initializer_list<_Up> __il, _Args&&... __args) {
+ return optional<_Tp>(in_place, __il, std::forward<_Args>(__args)...);
}
template <class _Tp>
-struct _LIBCPP_TEMPLATE_VIS hash<
- __enable_hash_helper<optional<_Tp>, remove_const_t<_Tp>>
->
-{
-#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_BINDER_TYPEDEFS)
- _LIBCPP_DEPRECATED_IN_CXX17 typedef optional<_Tp> argument_type;
- _LIBCPP_DEPRECATED_IN_CXX17 typedef size_t result_type;
-#endif
-
- _LIBCPP_HIDE_FROM_ABI
- size_t operator()(const optional<_Tp>& __opt) const
- {
- return static_cast<bool>(__opt) ? hash<remove_const_t<_Tp>>()(*__opt) : 0;
- }
+struct _LIBCPP_TEMPLATE_VIS hash< __enable_hash_helper<optional<_Tp>, remove_const_t<_Tp>> > {
+# if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_BINDER_TYPEDEFS)
+ _LIBCPP_DEPRECATED_IN_CXX17 typedef optional<_Tp> argument_type;
+ _LIBCPP_DEPRECATED_IN_CXX17 typedef size_t result_type;
+# endif
+
+ _LIBCPP_HIDE_FROM_ABI size_t operator()(const optional<_Tp>& __opt) const {
+ return static_cast<bool>(__opt) ? hash<remove_const_t<_Tp>>()(*__opt) : 0;
+ }
};
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/ostream b/contrib/llvm-project/libcxx/include/ostream
index ef74f5ddc66c..88ee9d93a1d3 100644
--- a/contrib/llvm-project/libcxx/include/ostream
+++ b/contrib/llvm-project/libcxx/include/ostream
@@ -159,13 +159,24 @@ basic_ostream<wchar_t, traits>& operator<<(basic_ostream<wchar_t, traits>&, cons
template<class traits>
basic_ostream<wchar_t, traits>& operator<<(basic_ostream<wchar_t, traits>&, const char32_t*) = delete; // since C++20
+// [ostream.formatted.print], print functions
+template<class... Args> // since C++23
+ void print(ostream& os, format_string<Args...> fmt, Args&&... args);
+template<class... Args> // since C++23
+ void println(ostream& os, format_string<Args...> fmt, Args&&... args);
+
+void vprint_unicode(ostream& os, string_view fmt, format_args args); // since C++23
+void vprint_nonunicode(ostream& os, string_view fmt, format_args args); // since C++23
} // std
*/
#include <__assert> // all public C++ headers provide the assertion handler
+#include <__availability>
#include <__config>
#include <__exception/operations.h>
+#include <__format/format_args.h>
+#include <__format/format_functions.h>
#include <__fwd/ostream.h>
#include <__memory/shared_ptr.h>
#include <__memory/unique_ptr.h>
@@ -176,10 +187,13 @@ basic_ostream<wchar_t, traits>& operator<<(basic_ostream<wchar_t, traits>&, cons
#include <__type_traits/void_t.h>
#include <__utility/declval.h>
#include <bitset>
+#include <cstdio>
#include <ios>
#include <locale>
#include <new>
+#include <print>
#include <streambuf>
+#include <string_view>
#include <version>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
@@ -189,931 +203,743 @@ basic_ostream<wchar_t, traits>& operator<<(basic_ostream<wchar_t, traits>&, cons
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _CharT, class _Traits>
-class _LIBCPP_TEMPLATE_VIS basic_ostream
- : virtual public basic_ios<_CharT, _Traits>
-{
+class _LIBCPP_TEMPLATE_VIS basic_ostream : virtual public basic_ios<_CharT, _Traits> {
public:
- // types (inherited from basic_ios (27.5.4)):
- typedef _CharT char_type;
- typedef _Traits traits_type;
- typedef typename traits_type::int_type int_type;
- typedef typename traits_type::pos_type pos_type;
- typedef typename traits_type::off_type off_type;
+ // types (inherited from basic_ios (27.5.4)):
+ typedef _CharT char_type;
+ typedef _Traits traits_type;
+ typedef typename traits_type::int_type int_type;
+ typedef typename traits_type::pos_type pos_type;
+ typedef typename traits_type::off_type off_type;
+
+ // 27.7.2.2 Constructor/destructor:
+ inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1 explicit basic_ostream(basic_streambuf<char_type, traits_type>* __sb) {
+ this->init(__sb);
+ }
+ ~basic_ostream() override;
- // 27.7.2.2 Constructor/destructor:
- inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1
- explicit basic_ostream(basic_streambuf<char_type, traits_type>* __sb)
- { this->init(__sb); }
- ~basic_ostream() override;
protected:
- inline _LIBCPP_HIDE_FROM_ABI
- basic_ostream(basic_ostream&& __rhs);
+ inline _LIBCPP_HIDE_FROM_ABI basic_ostream(basic_ostream&& __rhs);
- // 27.7.2.3 Assign/swap
- inline _LIBCPP_HIDE_FROM_ABI
- basic_ostream& operator=(basic_ostream&& __rhs);
+ // 27.7.2.3 Assign/swap
+ inline _LIBCPP_HIDE_FROM_ABI basic_ostream& operator=(basic_ostream&& __rhs);
- inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1
- void swap(basic_ostream& __rhs)
- { basic_ios<char_type, traits_type>::swap(__rhs); }
+ inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1 void swap(basic_ostream& __rhs) {
+ basic_ios<char_type, traits_type>::swap(__rhs);
+ }
- basic_ostream (const basic_ostream& __rhs) = delete;
- basic_ostream& operator=(const basic_ostream& __rhs) = delete;
+ basic_ostream(const basic_ostream& __rhs) = delete;
+ basic_ostream& operator=(const basic_ostream& __rhs) = delete;
public:
- // 27.7.2.4 Prefix/suffix:
- class _LIBCPP_TEMPLATE_VIS sentry;
+ // 27.7.2.4 Prefix/suffix:
+ class _LIBCPP_TEMPLATE_VIS sentry;
- // 27.7.2.6 Formatted output:
- inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1
- basic_ostream& operator<<(basic_ostream& (*__pf)(basic_ostream&))
- { return __pf(*this); }
-
- inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1
- basic_ostream& operator<<(basic_ios<char_type, traits_type>&
- (*__pf)(basic_ios<char_type,traits_type>&))
- { __pf(*this); return *this; }
-
- inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1
- basic_ostream& operator<<(ios_base& (*__pf)(ios_base&))
- { __pf(*this); return *this; }
-
- basic_ostream& operator<<(bool __n);
- basic_ostream& operator<<(short __n);
- basic_ostream& operator<<(unsigned short __n);
- basic_ostream& operator<<(int __n);
- basic_ostream& operator<<(unsigned int __n);
- basic_ostream& operator<<(long __n);
- basic_ostream& operator<<(unsigned long __n);
- basic_ostream& operator<<(long long __n);
- basic_ostream& operator<<(unsigned long long __n);
- basic_ostream& operator<<(float __f);
- basic_ostream& operator<<(double __f);
- basic_ostream& operator<<(long double __f);
- basic_ostream& operator<<(const void* __p);
+ // 27.7.2.6 Formatted output:
+ inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1 basic_ostream& operator<<(basic_ostream& (*__pf)(basic_ostream&)) {
+ return __pf(*this);
+ }
+
+ inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1 basic_ostream&
+ operator<<(basic_ios<char_type, traits_type>& (*__pf)(basic_ios<char_type, traits_type>&)) {
+ __pf(*this);
+ return *this;
+ }
+
+ inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1 basic_ostream& operator<<(ios_base& (*__pf)(ios_base&)) {
+ __pf(*this);
+ return *this;
+ }
+
+ basic_ostream& operator<<(bool __n);
+ basic_ostream& operator<<(short __n);
+ basic_ostream& operator<<(unsigned short __n);
+ basic_ostream& operator<<(int __n);
+ basic_ostream& operator<<(unsigned int __n);
+ basic_ostream& operator<<(long __n);
+ basic_ostream& operator<<(unsigned long __n);
+ basic_ostream& operator<<(long long __n);
+ basic_ostream& operator<<(unsigned long long __n);
+ basic_ostream& operator<<(float __f);
+ basic_ostream& operator<<(double __f);
+ basic_ostream& operator<<(long double __f);
+ basic_ostream& operator<<(const void* __p);
#if _LIBCPP_STD_VER >= 23
- _LIBCPP_HIDE_FROM_ABI
- basic_ostream& operator<<(const volatile void* __p) {
- return operator<<(const_cast<const void*>(__p));
- }
+ _LIBCPP_HIDE_FROM_ABI basic_ostream& operator<<(const volatile void* __p) {
+ return operator<<(const_cast<const void*>(__p));
+ }
#endif
- basic_ostream& operator<<(basic_streambuf<char_type, traits_type>* __sb);
+ basic_ostream& operator<<(basic_streambuf<char_type, traits_type>* __sb);
#if _LIBCPP_STD_VER >= 17
-// LWG 2221 - nullptr. This is not backported to older standards modes.
-// See https://reviews.llvm.org/D127033 for more info on the rationale.
- _LIBCPP_HIDE_FROM_ABI
- basic_ostream& operator<<(nullptr_t)
- { return *this << "nullptr"; }
+ // LWG 2221 - nullptr. This is not backported to older standards modes.
+ // See https://reviews.llvm.org/D127033 for more info on the rationale.
+ _LIBCPP_HIDE_FROM_ABI basic_ostream& operator<<(nullptr_t) { return *this << "nullptr"; }
#endif
- // 27.7.2.7 Unformatted output:
- basic_ostream& put(char_type __c);
- basic_ostream& write(const char_type* __s, streamsize __n);
- basic_ostream& flush();
+ // 27.7.2.7 Unformatted output:
+ basic_ostream& put(char_type __c);
+ basic_ostream& write(const char_type* __s, streamsize __n);
+ basic_ostream& flush();
- // 27.7.2.5 seeks:
- inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1
- pos_type tellp();
- inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1
- basic_ostream& seekp(pos_type __pos);
- inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1
- basic_ostream& seekp(off_type __off, ios_base::seekdir __dir);
+ // 27.7.2.5 seeks:
+ inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1 pos_type tellp();
+ inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1 basic_ostream& seekp(pos_type __pos);
+ inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1 basic_ostream& seekp(off_type __off, ios_base::seekdir __dir);
protected:
- _LIBCPP_HIDE_FROM_ABI
- basic_ostream() {} // extension, intentially does not initialize
+ _LIBCPP_HIDE_FROM_ABI basic_ostream() {} // extension, intentially does not initialize
};
template <class _CharT, class _Traits>
-class _LIBCPP_TEMPLATE_VIS basic_ostream<_CharT, _Traits>::sentry
-{
- bool __ok_;
- basic_ostream<_CharT, _Traits>& __os_;
+class _LIBCPP_TEMPLATE_VIS basic_ostream<_CharT, _Traits>::sentry {
+ bool __ok_;
+ basic_ostream<_CharT, _Traits>& __os_;
public:
- explicit sentry(basic_ostream<_CharT, _Traits>& __os);
- ~sentry();
- sentry(const sentry&) = delete;
- sentry& operator=(const sentry&) = delete;
+ explicit sentry(basic_ostream<_CharT, _Traits>& __os);
+ ~sentry();
+ sentry(const sentry&) = delete;
+ sentry& operator=(const sentry&) = delete;
- _LIBCPP_HIDE_FROM_ABI
- explicit operator bool() const {return __ok_;}
+ _LIBCPP_HIDE_FROM_ABI explicit operator bool() const { return __ok_; }
};
template <class _CharT, class _Traits>
-basic_ostream<_CharT, _Traits>::sentry::sentry(basic_ostream<_CharT, _Traits>& __os)
- : __ok_(false),
- __os_(__os)
-{
- if (__os.good())
- {
- if (__os.tie())
- __os.tie()->flush();
- __ok_ = true;
- }
+basic_ostream<_CharT, _Traits>::sentry::sentry(basic_ostream<_CharT, _Traits>& __os) : __ok_(false), __os_(__os) {
+ if (__os.good()) {
+ if (__os.tie())
+ __os.tie()->flush();
+ __ok_ = true;
+ }
}
template <class _CharT, class _Traits>
-basic_ostream<_CharT, _Traits>::sentry::~sentry()
-{
- if (__os_.rdbuf() && __os_.good() && (__os_.flags() & ios_base::unitbuf)
- && !uncaught_exception())
- {
+basic_ostream<_CharT, _Traits>::sentry::~sentry() {
+ if (__os_.rdbuf() && __os_.good() && (__os_.flags() & ios_base::unitbuf) && !uncaught_exception()) {
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- try
- {
+ try {
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- if (__os_.rdbuf()->pubsync() == -1)
- __os_.setstate(ios_base::badbit);
+ if (__os_.rdbuf()->pubsync() == -1)
+ __os_.setstate(ios_base::badbit);
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- }
- catch (...)
- {
- }
-#endif // _LIBCPP_HAS_NO_EXCEPTIONS
+ } catch (...) {
}
+#endif // _LIBCPP_HAS_NO_EXCEPTIONS
+ }
}
template <class _CharT, class _Traits>
-basic_ostream<_CharT, _Traits>::basic_ostream(basic_ostream&& __rhs)
-{
- this->move(__rhs);
+basic_ostream<_CharT, _Traits>::basic_ostream(basic_ostream&& __rhs) {
+ this->move(__rhs);
}
template <class _CharT, class _Traits>
-basic_ostream<_CharT, _Traits>&
-basic_ostream<_CharT, _Traits>::operator=(basic_ostream&& __rhs)
-{
- swap(__rhs);
- return *this;
+basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::operator=(basic_ostream&& __rhs) {
+ swap(__rhs);
+ return *this;
}
template <class _CharT, class _Traits>
-basic_ostream<_CharT, _Traits>::~basic_ostream()
-{
-}
+basic_ostream<_CharT, _Traits>::~basic_ostream() {}
template <class _CharT, class _Traits>
basic_ostream<_CharT, _Traits>&
-basic_ostream<_CharT, _Traits>::operator<<(basic_streambuf<char_type, traits_type>* __sb)
-{
+basic_ostream<_CharT, _Traits>::operator<<(basic_streambuf<char_type, traits_type>* __sb) {
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- try
- {
+ try {
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- sentry __s(*this);
- if (__s)
- {
- if (__sb)
- {
+ sentry __s(*this);
+ if (__s) {
+ if (__sb) {
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- try
- {
+ try {
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- typedef istreambuf_iterator<_CharT, _Traits> _Ip;
- typedef ostreambuf_iterator<_CharT, _Traits> _Op;
- _Ip __i(__sb);
- _Ip __eof;
- _Op __o(*this);
- size_t __c = 0;
- for (; __i != __eof; ++__i, ++__o, ++__c)
- {
- *__o = *__i;
- if (__o.failed())
- break;
- }
- if (__c == 0)
- this->setstate(ios_base::failbit);
+ typedef istreambuf_iterator<_CharT, _Traits> _Ip;
+ typedef ostreambuf_iterator<_CharT, _Traits> _Op;
+ _Ip __i(__sb);
+ _Ip __eof;
+ _Op __o(*this);
+ size_t __c = 0;
+ for (; __i != __eof; ++__i, ++__o, ++__c) {
+ *__o = *__i;
+ if (__o.failed())
+ break;
+ }
+ if (__c == 0)
+ this->setstate(ios_base::failbit);
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- }
- catch (...)
- {
- this->__set_failbit_and_consider_rethrow();
- }
-#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- }
- else
- this->setstate(ios_base::badbit);
+ } catch (...) {
+ this->__set_failbit_and_consider_rethrow();
}
-#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- }
- catch (...)
- {
- this->__set_badbit_and_consider_rethrow();
+#endif // _LIBCPP_HAS_NO_EXCEPTIONS
+ } else
+ this->setstate(ios_base::badbit);
}
+#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
+ } catch (...) {
+ this->__set_badbit_and_consider_rethrow();
+ }
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- return *this;
+ return *this;
}
template <class _CharT, class _Traits>
-basic_ostream<_CharT, _Traits>&
-basic_ostream<_CharT, _Traits>::operator<<(bool __n)
-{
+basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::operator<<(bool __n) {
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- try
- {
+ try {
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- sentry __s(*this);
- if (__s)
- {
- typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp;
- const _Fp& __f = std::use_facet<_Fp>(this->getloc());
- if (__f.put(*this, *this, this->fill(), __n).failed())
- this->setstate(ios_base::badbit | ios_base::failbit);
- }
-#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- }
- catch (...)
- {
- this->__set_badbit_and_consider_rethrow();
+ sentry __s(*this);
+ if (__s) {
+ typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp;
+ const _Fp& __f = std::use_facet<_Fp>(this->getloc());
+ if (__f.put(*this, *this, this->fill(), __n).failed())
+ this->setstate(ios_base::badbit | ios_base::failbit);
}
+#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
+ } catch (...) {
+ this->__set_badbit_and_consider_rethrow();
+ }
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- return *this;
+ return *this;
}
template <class _CharT, class _Traits>
-basic_ostream<_CharT, _Traits>&
-basic_ostream<_CharT, _Traits>::operator<<(short __n)
-{
+basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::operator<<(short __n) {
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- try
- {
+ try {
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- sentry __s(*this);
- if (__s)
- {
- ios_base::fmtflags __flags = ios_base::flags() & ios_base::basefield;
- typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp;
- const _Fp& __f = std::use_facet<_Fp>(this->getloc());
- if (__f.put(*this, *this, this->fill(),
- __flags == ios_base::oct || __flags == ios_base::hex ?
- static_cast<long>(static_cast<unsigned short>(__n)) :
- static_cast<long>(__n)).failed())
- this->setstate(ios_base::badbit | ios_base::failbit);
- }
-#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- }
- catch (...)
- {
- this->__set_badbit_and_consider_rethrow();
+ sentry __s(*this);
+ if (__s) {
+ ios_base::fmtflags __flags = ios_base::flags() & ios_base::basefield;
+ typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp;
+ const _Fp& __f = std::use_facet<_Fp>(this->getloc());
+ if (__f.put(*this,
+ *this,
+ this->fill(),
+ __flags == ios_base::oct || __flags == ios_base::hex
+ ? static_cast<long>(static_cast<unsigned short>(__n))
+ : static_cast<long>(__n))
+ .failed())
+ this->setstate(ios_base::badbit | ios_base::failbit);
}
+#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
+ } catch (...) {
+ this->__set_badbit_and_consider_rethrow();
+ }
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- return *this;
+ return *this;
}
template <class _CharT, class _Traits>
-basic_ostream<_CharT, _Traits>&
-basic_ostream<_CharT, _Traits>::operator<<(unsigned short __n)
-{
+basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::operator<<(unsigned short __n) {
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- try
- {
+ try {
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- sentry __s(*this);
- if (__s)
- {
- typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp;
- const _Fp& __f = std::use_facet<_Fp>(this->getloc());
- if (__f.put(*this, *this, this->fill(), static_cast<unsigned long>(__n)).failed())
- this->setstate(ios_base::badbit | ios_base::failbit);
- }
-#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- }
- catch (...)
- {
- this->__set_badbit_and_consider_rethrow();
+ sentry __s(*this);
+ if (__s) {
+ typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp;
+ const _Fp& __f = std::use_facet<_Fp>(this->getloc());
+ if (__f.put(*this, *this, this->fill(), static_cast<unsigned long>(__n)).failed())
+ this->setstate(ios_base::badbit | ios_base::failbit);
}
+#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
+ } catch (...) {
+ this->__set_badbit_and_consider_rethrow();
+ }
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- return *this;
+ return *this;
}
template <class _CharT, class _Traits>
-basic_ostream<_CharT, _Traits>&
-basic_ostream<_CharT, _Traits>::operator<<(int __n)
-{
+basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::operator<<(int __n) {
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- try
- {
+ try {
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- sentry __s(*this);
- if (__s)
- {
- ios_base::fmtflags __flags = ios_base::flags() & ios_base::basefield;
- typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp;
- const _Fp& __f = std::use_facet<_Fp>(this->getloc());
- if (__f.put(*this, *this, this->fill(),
- __flags == ios_base::oct || __flags == ios_base::hex ?
- static_cast<long>(static_cast<unsigned int>(__n)) :
- static_cast<long>(__n)).failed())
- this->setstate(ios_base::badbit | ios_base::failbit);
- }
-#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- }
- catch (...)
- {
- this->__set_badbit_and_consider_rethrow();
+ sentry __s(*this);
+ if (__s) {
+ ios_base::fmtflags __flags = ios_base::flags() & ios_base::basefield;
+ typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp;
+ const _Fp& __f = std::use_facet<_Fp>(this->getloc());
+ if (__f.put(*this,
+ *this,
+ this->fill(),
+ __flags == ios_base::oct || __flags == ios_base::hex
+ ? static_cast<long>(static_cast<unsigned int>(__n))
+ : static_cast<long>(__n))
+ .failed())
+ this->setstate(ios_base::badbit | ios_base::failbit);
}
+#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
+ } catch (...) {
+ this->__set_badbit_and_consider_rethrow();
+ }
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- return *this;
+ return *this;
}
template <class _CharT, class _Traits>
-basic_ostream<_CharT, _Traits>&
-basic_ostream<_CharT, _Traits>::operator<<(unsigned int __n)
-{
+basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::operator<<(unsigned int __n) {
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- try
- {
+ try {
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- sentry __s(*this);
- if (__s)
- {
- typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp;
- const _Fp& __f = std::use_facet<_Fp>(this->getloc());
- if (__f.put(*this, *this, this->fill(), static_cast<unsigned long>(__n)).failed())
- this->setstate(ios_base::badbit | ios_base::failbit);
- }
-#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- }
- catch (...)
- {
- this->__set_badbit_and_consider_rethrow();
+ sentry __s(*this);
+ if (__s) {
+ typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp;
+ const _Fp& __f = std::use_facet<_Fp>(this->getloc());
+ if (__f.put(*this, *this, this->fill(), static_cast<unsigned long>(__n)).failed())
+ this->setstate(ios_base::badbit | ios_base::failbit);
}
+#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
+ } catch (...) {
+ this->__set_badbit_and_consider_rethrow();
+ }
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- return *this;
+ return *this;
}
template <class _CharT, class _Traits>
-basic_ostream<_CharT, _Traits>&
-basic_ostream<_CharT, _Traits>::operator<<(long __n)
-{
+basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::operator<<(long __n) {
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- try
- {
+ try {
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- sentry __s(*this);
- if (__s)
- {
- typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp;
- const _Fp& __f = std::use_facet<_Fp>(this->getloc());
- if (__f.put(*this, *this, this->fill(), __n).failed())
- this->setstate(ios_base::badbit | ios_base::failbit);
- }
-#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- }
- catch (...)
- {
- this->__set_badbit_and_consider_rethrow();
+ sentry __s(*this);
+ if (__s) {
+ typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp;
+ const _Fp& __f = std::use_facet<_Fp>(this->getloc());
+ if (__f.put(*this, *this, this->fill(), __n).failed())
+ this->setstate(ios_base::badbit | ios_base::failbit);
}
+#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
+ } catch (...) {
+ this->__set_badbit_and_consider_rethrow();
+ }
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- return *this;
+ return *this;
}
template <class _CharT, class _Traits>
-basic_ostream<_CharT, _Traits>&
-basic_ostream<_CharT, _Traits>::operator<<(unsigned long __n)
-{
+basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::operator<<(unsigned long __n) {
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- try
- {
+ try {
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- sentry __s(*this);
- if (__s)
- {
- typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp;
- const _Fp& __f = std::use_facet<_Fp>(this->getloc());
- if (__f.put(*this, *this, this->fill(), __n).failed())
- this->setstate(ios_base::badbit | ios_base::failbit);
- }
-#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- }
- catch (...)
- {
- this->__set_badbit_and_consider_rethrow();
+ sentry __s(*this);
+ if (__s) {
+ typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp;
+ const _Fp& __f = std::use_facet<_Fp>(this->getloc());
+ if (__f.put(*this, *this, this->fill(), __n).failed())
+ this->setstate(ios_base::badbit | ios_base::failbit);
}
+#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
+ } catch (...) {
+ this->__set_badbit_and_consider_rethrow();
+ }
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- return *this;
+ return *this;
}
template <class _CharT, class _Traits>
-basic_ostream<_CharT, _Traits>&
-basic_ostream<_CharT, _Traits>::operator<<(long long __n)
-{
+basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::operator<<(long long __n) {
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- try
- {
+ try {
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- sentry __s(*this);
- if (__s)
- {
- typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp;
- const _Fp& __f = std::use_facet<_Fp>(this->getloc());
- if (__f.put(*this, *this, this->fill(), __n).failed())
- this->setstate(ios_base::badbit | ios_base::failbit);
- }
-#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- }
- catch (...)
- {
- this->__set_badbit_and_consider_rethrow();
+ sentry __s(*this);
+ if (__s) {
+ typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp;
+ const _Fp& __f = std::use_facet<_Fp>(this->getloc());
+ if (__f.put(*this, *this, this->fill(), __n).failed())
+ this->setstate(ios_base::badbit | ios_base::failbit);
}
+#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
+ } catch (...) {
+ this->__set_badbit_and_consider_rethrow();
+ }
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- return *this;
+ return *this;
}
template <class _CharT, class _Traits>
-basic_ostream<_CharT, _Traits>&
-basic_ostream<_CharT, _Traits>::operator<<(unsigned long long __n)
-{
+basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::operator<<(unsigned long long __n) {
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- try
- {
+ try {
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- sentry __s(*this);
- if (__s)
- {
- typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp;
- const _Fp& __f = std::use_facet<_Fp>(this->getloc());
- if (__f.put(*this, *this, this->fill(), __n).failed())
- this->setstate(ios_base::badbit | ios_base::failbit);
- }
-#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- }
- catch (...)
- {
- this->__set_badbit_and_consider_rethrow();
+ sentry __s(*this);
+ if (__s) {
+ typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp;
+ const _Fp& __f = std::use_facet<_Fp>(this->getloc());
+ if (__f.put(*this, *this, this->fill(), __n).failed())
+ this->setstate(ios_base::badbit | ios_base::failbit);
}
+#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
+ } catch (...) {
+ this->__set_badbit_and_consider_rethrow();
+ }
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- return *this;
+ return *this;
}
template <class _CharT, class _Traits>
-basic_ostream<_CharT, _Traits>&
-basic_ostream<_CharT, _Traits>::operator<<(float __n)
-{
+basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::operator<<(float __n) {
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- try
- {
+ try {
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- sentry __s(*this);
- if (__s)
- {
- typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp;
- const _Fp& __f = std::use_facet<_Fp>(this->getloc());
- if (__f.put(*this, *this, this->fill(), static_cast<double>(__n)).failed())
- this->setstate(ios_base::badbit | ios_base::failbit);
- }
-#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- }
- catch (...)
- {
- this->__set_badbit_and_consider_rethrow();
+ sentry __s(*this);
+ if (__s) {
+ typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp;
+ const _Fp& __f = std::use_facet<_Fp>(this->getloc());
+ if (__f.put(*this, *this, this->fill(), static_cast<double>(__n)).failed())
+ this->setstate(ios_base::badbit | ios_base::failbit);
}
+#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
+ } catch (...) {
+ this->__set_badbit_and_consider_rethrow();
+ }
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- return *this;
+ return *this;
}
template <class _CharT, class _Traits>
-basic_ostream<_CharT, _Traits>&
-basic_ostream<_CharT, _Traits>::operator<<(double __n)
-{
+basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::operator<<(double __n) {
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- try
- {
+ try {
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- sentry __s(*this);
- if (__s)
- {
- typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp;
- const _Fp& __f = std::use_facet<_Fp>(this->getloc());
- if (__f.put(*this, *this, this->fill(), __n).failed())
- this->setstate(ios_base::badbit | ios_base::failbit);
- }
-#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- }
- catch (...)
- {
- this->__set_badbit_and_consider_rethrow();
+ sentry __s(*this);
+ if (__s) {
+ typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp;
+ const _Fp& __f = std::use_facet<_Fp>(this->getloc());
+ if (__f.put(*this, *this, this->fill(), __n).failed())
+ this->setstate(ios_base::badbit | ios_base::failbit);
}
+#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
+ } catch (...) {
+ this->__set_badbit_and_consider_rethrow();
+ }
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- return *this;
+ return *this;
}
template <class _CharT, class _Traits>
-basic_ostream<_CharT, _Traits>&
-basic_ostream<_CharT, _Traits>::operator<<(long double __n)
-{
+basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::operator<<(long double __n) {
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- try
- {
+ try {
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- sentry __s(*this);
- if (__s)
- {
- typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp;
- const _Fp& __f = std::use_facet<_Fp>(this->getloc());
- if (__f.put(*this, *this, this->fill(), __n).failed())
- this->setstate(ios_base::badbit | ios_base::failbit);
- }
-#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- }
- catch (...)
- {
- this->__set_badbit_and_consider_rethrow();
+ sentry __s(*this);
+ if (__s) {
+ typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp;
+ const _Fp& __f = std::use_facet<_Fp>(this->getloc());
+ if (__f.put(*this, *this, this->fill(), __n).failed())
+ this->setstate(ios_base::badbit | ios_base::failbit);
}
+#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
+ } catch (...) {
+ this->__set_badbit_and_consider_rethrow();
+ }
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- return *this;
+ return *this;
}
template <class _CharT, class _Traits>
-basic_ostream<_CharT, _Traits>&
-basic_ostream<_CharT, _Traits>::operator<<(const void* __n)
-{
+basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::operator<<(const void* __n) {
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- try
- {
+ try {
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- sentry __s(*this);
- if (__s)
- {
- typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp;
- const _Fp& __f = std::use_facet<_Fp>(this->getloc());
- if (__f.put(*this, *this, this->fill(), __n).failed())
- this->setstate(ios_base::badbit | ios_base::failbit);
- }
-#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- }
- catch (...)
- {
- this->__set_badbit_and_consider_rethrow();
+ sentry __s(*this);
+ if (__s) {
+ typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp;
+ const _Fp& __f = std::use_facet<_Fp>(this->getloc());
+ if (__f.put(*this, *this, this->fill(), __n).failed())
+ this->setstate(ios_base::badbit | ios_base::failbit);
}
+#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
+ } catch (...) {
+ this->__set_badbit_and_consider_rethrow();
+ }
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- return *this;
+ return *this;
}
-template<class _CharT, class _Traits>
+template <class _CharT, class _Traits>
_LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>&
-__put_character_sequence(basic_ostream<_CharT, _Traits>& __os,
- const _CharT* __str, size_t __len)
-{
+__put_character_sequence(basic_ostream<_CharT, _Traits>& __os, const _CharT* __str, size_t __len) {
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- try
- {
+ try {
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- typename basic_ostream<_CharT, _Traits>::sentry __s(__os);
- if (__s)
- {
- typedef ostreambuf_iterator<_CharT, _Traits> _Ip;
- if (std::__pad_and_output(_Ip(__os),
- __str,
- (__os.flags() & ios_base::adjustfield) == ios_base::left ?
- __str + __len :
- __str,
- __str + __len,
- __os,
- __os.fill()).failed())
- __os.setstate(ios_base::badbit | ios_base::failbit);
- }
-#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- }
- catch (...)
- {
- __os.__set_badbit_and_consider_rethrow();
+ typename basic_ostream<_CharT, _Traits>::sentry __s(__os);
+ if (__s) {
+ typedef ostreambuf_iterator<_CharT, _Traits> _Ip;
+ if (std::__pad_and_output(
+ _Ip(__os),
+ __str,
+ (__os.flags() & ios_base::adjustfield) == ios_base::left ? __str + __len : __str,
+ __str + __len,
+ __os,
+ __os.fill())
+ .failed())
+ __os.setstate(ios_base::badbit | ios_base::failbit);
}
+#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
+ } catch (...) {
+ __os.__set_badbit_and_consider_rethrow();
+ }
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- return __os;
+ return __os;
}
-
-template<class _CharT, class _Traits>
-_LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>&
-operator<<(basic_ostream<_CharT, _Traits>& __os, _CharT __c)
-{
- return std::__put_character_sequence(__os, &__c, 1);
+template <class _CharT, class _Traits>
+_LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>& operator<<(basic_ostream<_CharT, _Traits>& __os, _CharT __c) {
+ return std::__put_character_sequence(__os, &__c, 1);
}
-template<class _CharT, class _Traits>
-_LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>&
-operator<<(basic_ostream<_CharT, _Traits>& __os, char __cn)
-{
+template <class _CharT, class _Traits>
+_LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>& operator<<(basic_ostream<_CharT, _Traits>& __os, char __cn) {
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- try
- {
+ try {
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- typename basic_ostream<_CharT, _Traits>::sentry __s(__os);
- if (__s)
- {
- _CharT __c = __os.widen(__cn);
- typedef ostreambuf_iterator<_CharT, _Traits> _Ip;
- if (std::__pad_and_output(_Ip(__os),
- &__c,
- (__os.flags() & ios_base::adjustfield) == ios_base::left ?
- &__c + 1 :
- &__c,
- &__c + 1,
- __os,
- __os.fill()).failed())
- __os.setstate(ios_base::badbit | ios_base::failbit);
- }
-#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- }
- catch (...)
- {
- __os.__set_badbit_and_consider_rethrow();
+ typename basic_ostream<_CharT, _Traits>::sentry __s(__os);
+ if (__s) {
+ _CharT __c = __os.widen(__cn);
+ typedef ostreambuf_iterator<_CharT, _Traits> _Ip;
+ if (std::__pad_and_output(
+ _Ip(__os),
+ &__c,
+ (__os.flags() & ios_base::adjustfield) == ios_base::left ? &__c + 1 : &__c,
+ &__c + 1,
+ __os,
+ __os.fill())
+ .failed())
+ __os.setstate(ios_base::badbit | ios_base::failbit);
}
+#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
+ } catch (...) {
+ __os.__set_badbit_and_consider_rethrow();
+ }
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- return __os;
+ return __os;
}
-template<class _Traits>
-_LIBCPP_HIDE_FROM_ABI basic_ostream<char, _Traits>&
-operator<<(basic_ostream<char, _Traits>& __os, char __c)
-{
- return std::__put_character_sequence(__os, &__c, 1);
+template <class _Traits>
+_LIBCPP_HIDE_FROM_ABI basic_ostream<char, _Traits>& operator<<(basic_ostream<char, _Traits>& __os, char __c) {
+ return std::__put_character_sequence(__os, &__c, 1);
}
-template<class _Traits>
-_LIBCPP_HIDE_FROM_ABI basic_ostream<char, _Traits>&
-operator<<(basic_ostream<char, _Traits>& __os, signed char __c)
-{
- return std::__put_character_sequence(__os, (char *) &__c, 1);
+template <class _Traits>
+_LIBCPP_HIDE_FROM_ABI basic_ostream<char, _Traits>& operator<<(basic_ostream<char, _Traits>& __os, signed char __c) {
+ return std::__put_character_sequence(__os, (char*)&__c, 1);
}
-template<class _Traits>
-_LIBCPP_HIDE_FROM_ABI basic_ostream<char, _Traits>&
-operator<<(basic_ostream<char, _Traits>& __os, unsigned char __c)
-{
- return std::__put_character_sequence(__os, (char *) &__c, 1);
+template <class _Traits>
+_LIBCPP_HIDE_FROM_ABI basic_ostream<char, _Traits>& operator<<(basic_ostream<char, _Traits>& __os, unsigned char __c) {
+ return std::__put_character_sequence(__os, (char*)&__c, 1);
}
-template<class _CharT, class _Traits>
+template <class _CharT, class _Traits>
_LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>&
-operator<<(basic_ostream<_CharT, _Traits>& __os, const _CharT* __str)
-{
- return std::__put_character_sequence(__os, __str, _Traits::length(__str));
+operator<<(basic_ostream<_CharT, _Traits>& __os, const _CharT* __str) {
+ return std::__put_character_sequence(__os, __str, _Traits::length(__str));
}
-template<class _CharT, class _Traits>
+template <class _CharT, class _Traits>
_LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>&
-operator<<(basic_ostream<_CharT, _Traits>& __os, const char* __strn)
-{
+operator<<(basic_ostream<_CharT, _Traits>& __os, const char* __strn) {
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- try
- {
+ try {
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- typename basic_ostream<_CharT, _Traits>::sentry __s(__os);
- if (__s)
- {
- typedef ostreambuf_iterator<_CharT, _Traits> _Ip;
- size_t __len = char_traits<char>::length(__strn);
- const int __bs = 100;
- _CharT __wbb[__bs];
- _CharT* __wb = __wbb;
- unique_ptr<_CharT, void(*)(void*)> __h(0, free);
- if (__len > __bs)
- {
- __wb = (_CharT*)malloc(__len*sizeof(_CharT));
- if (__wb == 0)
- __throw_bad_alloc();
- __h.reset(__wb);
- }
- for (_CharT* __p = __wb; *__strn != '\0'; ++__strn, ++__p)
- *__p = __os.widen(*__strn);
- if (std::__pad_and_output(_Ip(__os),
- __wb,
- (__os.flags() & ios_base::adjustfield) == ios_base::left ?
- __wb + __len :
- __wb,
- __wb + __len,
- __os,
- __os.fill()).failed())
- __os.setstate(ios_base::badbit | ios_base::failbit);
- }
-#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- }
- catch (...)
- {
- __os.__set_badbit_and_consider_rethrow();
+ typename basic_ostream<_CharT, _Traits>::sentry __s(__os);
+ if (__s) {
+ typedef ostreambuf_iterator<_CharT, _Traits> _Ip;
+ size_t __len = char_traits<char>::length(__strn);
+ const int __bs = 100;
+ _CharT __wbb[__bs];
+ _CharT* __wb = __wbb;
+ unique_ptr<_CharT, void (*)(void*)> __h(0, free);
+ if (__len > __bs) {
+ __wb = (_CharT*)malloc(__len * sizeof(_CharT));
+ if (__wb == 0)
+ __throw_bad_alloc();
+ __h.reset(__wb);
+ }
+ for (_CharT* __p = __wb; *__strn != '\0'; ++__strn, ++__p)
+ *__p = __os.widen(*__strn);
+ if (std::__pad_and_output(
+ _Ip(__os),
+ __wb,
+ (__os.flags() & ios_base::adjustfield) == ios_base::left ? __wb + __len : __wb,
+ __wb + __len,
+ __os,
+ __os.fill())
+ .failed())
+ __os.setstate(ios_base::badbit | ios_base::failbit);
}
+#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
+ } catch (...) {
+ __os.__set_badbit_and_consider_rethrow();
+ }
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- return __os;
+ return __os;
}
-template<class _Traits>
-_LIBCPP_HIDE_FROM_ABI basic_ostream<char, _Traits>&
-operator<<(basic_ostream<char, _Traits>& __os, const char* __str)
-{
- return std::__put_character_sequence(__os, __str, _Traits::length(__str));
+template <class _Traits>
+_LIBCPP_HIDE_FROM_ABI basic_ostream<char, _Traits>& operator<<(basic_ostream<char, _Traits>& __os, const char* __str) {
+ return std::__put_character_sequence(__os, __str, _Traits::length(__str));
}
-template<class _Traits>
+template <class _Traits>
_LIBCPP_HIDE_FROM_ABI basic_ostream<char, _Traits>&
-operator<<(basic_ostream<char, _Traits>& __os, const signed char* __str)
-{
- const char *__s = (const char *) __str;
- return std::__put_character_sequence(__os, __s, _Traits::length(__s));
+operator<<(basic_ostream<char, _Traits>& __os, const signed char* __str) {
+ const char* __s = (const char*)__str;
+ return std::__put_character_sequence(__os, __s, _Traits::length(__s));
}
-template<class _Traits>
+template <class _Traits>
_LIBCPP_HIDE_FROM_ABI basic_ostream<char, _Traits>&
-operator<<(basic_ostream<char, _Traits>& __os, const unsigned char* __str)
-{
- const char *__s = (const char *) __str;
- return std::__put_character_sequence(__os, __s, _Traits::length(__s));
+operator<<(basic_ostream<char, _Traits>& __os, const unsigned char* __str) {
+ const char* __s = (const char*)__str;
+ return std::__put_character_sequence(__os, __s, _Traits::length(__s));
}
template <class _CharT, class _Traits>
-basic_ostream<_CharT, _Traits>&
-basic_ostream<_CharT, _Traits>::put(char_type __c)
-{
+basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::put(char_type __c) {
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- try
- {
+ try {
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- sentry __s(*this);
- if (__s)
- {
- typedef ostreambuf_iterator<_CharT, _Traits> _Op;
- _Op __o(*this);
- *__o = __c;
- if (__o.failed())
- this->setstate(ios_base::badbit);
- }
-#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- }
- catch (...)
- {
- this->__set_badbit_and_consider_rethrow();
+ sentry __s(*this);
+ if (__s) {
+ typedef ostreambuf_iterator<_CharT, _Traits> _Op;
+ _Op __o(*this);
+ *__o = __c;
+ if (__o.failed())
+ this->setstate(ios_base::badbit);
}
+#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
+ } catch (...) {
+ this->__set_badbit_and_consider_rethrow();
+ }
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- return *this;
+ return *this;
}
template <class _CharT, class _Traits>
-basic_ostream<_CharT, _Traits>&
-basic_ostream<_CharT, _Traits>::write(const char_type* __s, streamsize __n)
-{
+basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::write(const char_type* __s, streamsize __n) {
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- try
- {
+ try {
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- sentry __sen(*this);
- if (__sen && __n)
- {
- if (this->rdbuf()->sputn(__s, __n) != __n)
- this->setstate(ios_base::badbit);
- }
-#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- }
- catch (...)
- {
- this->__set_badbit_and_consider_rethrow();
+ sentry __sen(*this);
+ if (__sen && __n) {
+ if (this->rdbuf()->sputn(__s, __n) != __n)
+ this->setstate(ios_base::badbit);
}
+#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
+ } catch (...) {
+ this->__set_badbit_and_consider_rethrow();
+ }
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- return *this;
+ return *this;
}
template <class _CharT, class _Traits>
-basic_ostream<_CharT, _Traits>&
-basic_ostream<_CharT, _Traits>::flush()
-{
+basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::flush() {
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- try
- {
+ try {
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- if (this->rdbuf())
- {
- sentry __s(*this);
- if (__s)
- {
- if (this->rdbuf()->pubsync() == -1)
- this->setstate(ios_base::badbit);
- }
- }
-#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- }
- catch (...)
- {
- this->__set_badbit_and_consider_rethrow();
+ if (this->rdbuf()) {
+ sentry __s(*this);
+ if (__s) {
+ if (this->rdbuf()->pubsync() == -1)
+ this->setstate(ios_base::badbit);
+ }
}
+#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
+ } catch (...) {
+ this->__set_badbit_and_consider_rethrow();
+ }
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- return *this;
+ return *this;
}
template <class _CharT, class _Traits>
-typename basic_ostream<_CharT, _Traits>::pos_type
-basic_ostream<_CharT, _Traits>::tellp()
-{
- if (this->fail())
- return pos_type(-1);
- return this->rdbuf()->pubseekoff(0, ios_base::cur, ios_base::out);
+typename basic_ostream<_CharT, _Traits>::pos_type basic_ostream<_CharT, _Traits>::tellp() {
+ if (this->fail())
+ return pos_type(-1);
+ return this->rdbuf()->pubseekoff(0, ios_base::cur, ios_base::out);
}
template <class _CharT, class _Traits>
-basic_ostream<_CharT, _Traits>&
-basic_ostream<_CharT, _Traits>::seekp(pos_type __pos)
-{
- sentry __s(*this);
- if (!this->fail())
- {
- if (this->rdbuf()->pubseekpos(__pos, ios_base::out) == pos_type(-1))
- this->setstate(ios_base::failbit);
- }
- return *this;
+basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::seekp(pos_type __pos) {
+ sentry __s(*this);
+ if (!this->fail()) {
+ if (this->rdbuf()->pubseekpos(__pos, ios_base::out) == pos_type(-1))
+ this->setstate(ios_base::failbit);
+ }
+ return *this;
}
template <class _CharT, class _Traits>
-basic_ostream<_CharT, _Traits>&
-basic_ostream<_CharT, _Traits>::seekp(off_type __off, ios_base::seekdir __dir)
-{
- sentry __s(*this);
- if (!this->fail())
- {
- if (this->rdbuf()->pubseekoff(__off, __dir, ios_base::out) == pos_type(-1))
- this->setstate(ios_base::failbit);
- }
- return *this;
+basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::seekp(off_type __off, ios_base::seekdir __dir) {
+ sentry __s(*this);
+ if (!this->fail()) {
+ if (this->rdbuf()->pubseekoff(__off, __dir, ios_base::out) == pos_type(-1))
+ this->setstate(ios_base::failbit);
+ }
+ return *this;
}
template <class _CharT, class _Traits>
-_LIBCPP_HIDE_FROM_ABI inline
-basic_ostream<_CharT, _Traits>&
-endl(basic_ostream<_CharT, _Traits>& __os)
-{
- __os.put(__os.widen('\n'));
- __os.flush();
- return __os;
+_LIBCPP_HIDE_FROM_ABI inline basic_ostream<_CharT, _Traits>& endl(basic_ostream<_CharT, _Traits>& __os) {
+ __os.put(__os.widen('\n'));
+ __os.flush();
+ return __os;
}
template <class _CharT, class _Traits>
-_LIBCPP_HIDE_FROM_ABI inline
-basic_ostream<_CharT, _Traits>&
-ends(basic_ostream<_CharT, _Traits>& __os)
-{
- __os.put(_CharT());
- return __os;
+_LIBCPP_HIDE_FROM_ABI inline basic_ostream<_CharT, _Traits>& ends(basic_ostream<_CharT, _Traits>& __os) {
+ __os.put(_CharT());
+ return __os;
}
template <class _CharT, class _Traits>
-_LIBCPP_HIDE_FROM_ABI inline
-basic_ostream<_CharT, _Traits>&
-flush(basic_ostream<_CharT, _Traits>& __os)
-{
- __os.flush();
- return __os;
+_LIBCPP_HIDE_FROM_ABI inline basic_ostream<_CharT, _Traits>& flush(basic_ostream<_CharT, _Traits>& __os) {
+ __os.flush();
+ return __os;
}
template <class _Stream, class _Tp, class = void>
-struct __is_ostreamable : false_type { };
+struct __is_ostreamable : false_type {};
template <class _Stream, class _Tp>
-struct __is_ostreamable<_Stream, _Tp, decltype(
- std::declval<_Stream>() << std::declval<_Tp>(), void()
-)> : true_type { };
+struct __is_ostreamable<_Stream, _Tp, decltype(std::declval<_Stream>() << std::declval<_Tp>(), void())> : true_type {};
template <class _Stream,
class _Tp,
__enable_if_t<_And<is_base_of<ios_base, _Stream>, __is_ostreamable<_Stream&, const _Tp&> >::value, int> = 0>
-_LIBCPP_HIDE_FROM_ABI
-_Stream&& operator<<(_Stream&& __os, const _Tp& __x)
-{
- __os << __x;
- return std::move(__os);
+_LIBCPP_HIDE_FROM_ABI _Stream&& operator<<(_Stream&& __os, const _Tp& __x) {
+ __os << __x;
+ return std::move(__os);
}
-template<class _CharT, class _Traits, class _Allocator>
+template <class _CharT, class _Traits, class _Allocator>
basic_ostream<_CharT, _Traits>&
-operator<<(basic_ostream<_CharT, _Traits>& __os,
- const basic_string<_CharT, _Traits, _Allocator>& __str)
-{
- return std::__put_character_sequence(__os, __str.data(), __str.size());
+operator<<(basic_ostream<_CharT, _Traits>& __os, const basic_string<_CharT, _Traits, _Allocator>& __str) {
+ return std::__put_character_sequence(__os, __str.data(), __str.size());
}
-template<class _CharT, class _Traits>
+template <class _CharT, class _Traits>
_LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>&
-operator<<(basic_ostream<_CharT, _Traits>& __os,
- basic_string_view<_CharT, _Traits> __sv)
-{
- return std::__put_character_sequence(__os, __sv.data(), __sv.size());
+operator<<(basic_ostream<_CharT, _Traits>& __os, basic_string_view<_CharT, _Traits> __sv) {
+ return std::__put_character_sequence(__os, __sv.data(), __sv.size());
}
template <class _CharT, class _Traits>
-inline _LIBCPP_HIDE_FROM_ABI
-basic_ostream<_CharT, _Traits>&
-operator<<(basic_ostream<_CharT, _Traits>& __os, const error_code& __ec)
-{
- return __os << __ec.category().name() << ':' << __ec.value();
+inline _LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>&
+operator<<(basic_ostream<_CharT, _Traits>& __os, const error_code& __ec) {
+ return __os << __ec.category().name() << ':' << __ec.value();
}
-template<class _CharT, class _Traits, class _Yp>
-inline _LIBCPP_HIDE_FROM_ABI
-basic_ostream<_CharT, _Traits>&
-operator<<(basic_ostream<_CharT, _Traits>& __os, shared_ptr<_Yp> const& __p)
-{
- return __os << __p.get();
+template <class _CharT, class _Traits, class _Yp>
+inline _LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>&
+operator<<(basic_ostream<_CharT, _Traits>& __os, shared_ptr<_Yp> const& __p) {
+ return __os << __p.get();
}
template <
@@ -1127,21 +953,19 @@ template <
int> = 0>
inline _LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>&
operator<<(basic_ostream<_CharT, _Traits>& __os, unique_ptr<_Yp, _Dp> const& __p) {
- return __os << __p.get();
+ return __os << __p.get();
}
template <class _CharT, class _Traits, size_t _Size>
_LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>&
-operator<<(basic_ostream<_CharT, _Traits>& __os, const bitset<_Size>& __x)
-{
- return __os << __x.template to_string<_CharT, _Traits>
- (std::use_facet<ctype<_CharT> >(__os.getloc()).widen('0'),
- std::use_facet<ctype<_CharT> >(__os.getloc()).widen('1'));
+operator<<(basic_ostream<_CharT, _Traits>& __os, const bitset<_Size>& __x) {
+ return __os << __x.template to_string<_CharT, _Traits>(std::use_facet<ctype<_CharT> >(__os.getloc()).widen('0'),
+ std::use_facet<ctype<_CharT> >(__os.getloc()).widen('1'));
}
#if _LIBCPP_STD_VER >= 20
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+# ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
template <class _Traits>
basic_ostream<char, _Traits>& operator<<(basic_ostream<char, _Traits>&, wchar_t) = delete;
@@ -1160,9 +984,9 @@ basic_ostream<wchar_t, _Traits>& operator<<(basic_ostream<wchar_t, _Traits>&, co
template <class _Traits>
basic_ostream<wchar_t, _Traits>& operator<<(basic_ostream<wchar_t, _Traits>&, const char32_t*) = delete;
-#endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS
+# endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS
-#ifndef _LIBCPP_HAS_NO_CHAR8_T
+# ifndef _LIBCPP_HAS_NO_CHAR8_T
template <class _Traits>
basic_ostream<char, _Traits>& operator<<(basic_ostream<char, _Traits>&, char8_t) = delete;
@@ -1174,7 +998,7 @@ basic_ostream<char, _Traits>& operator<<(basic_ostream<char, _Traits>&, const ch
template <class _Traits>
basic_ostream<wchar_t, _Traits>& operator<<(basic_ostream<wchar_t, _Traits>&, const char8_t*) = delete;
-#endif
+# endif
template <class _Traits>
basic_ostream<char, _Traits>& operator<<(basic_ostream<char, _Traits>&, char16_t) = delete;
@@ -1195,6 +1019,151 @@ extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_ostream<char>;
extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_ostream<wchar_t>;
#endif
+#if _LIBCPP_STD_VER >= 23
+
+template <class = void> // TODO PRINT template or availability markup fires too eagerly (http://llvm.org/PR61563).
+_LIBCPP_HIDE_FROM_ABI inline void
+__vprint_nonunicode(ostream& __os, string_view __fmt, format_args __args, bool __write_nl) {
+ // [ostream.formatted.print]/3
+ // Effects: Behaves as a formatted output function
+ // ([ostream.formatted.reqmts]) of os, except that:
+ // - failure to generate output is reported as specified below, and
+ // - any exception thrown by the call to vformat is propagated without regard
+ // to the value of os.exceptions() and without turning on ios_base::badbit
+ // in the error state of os.
+ // After constructing a sentry object, the function initializes an automatic
+ // variable via
+ // string out = vformat(os.getloc(), fmt, args);
+
+ ostream::sentry __s(__os);
+ if (__s) {
+ string __o = std::vformat(__os.getloc(), __fmt, __args);
+ if (__write_nl)
+ __o += '\n';
+
+ const char* __str = __o.data();
+ size_t __len = __o.size();
+
+# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
+ try {
+# endif // _LIBCPP_HAS_NO_EXCEPTIONS
+ typedef ostreambuf_iterator<char> _Ip;
+ if (std::__pad_and_output(
+ _Ip(__os),
+ __str,
+ (__os.flags() & ios_base::adjustfield) == ios_base::left ? __str + __len : __str,
+ __str + __len,
+ __os,
+ __os.fill())
+ .failed())
+ __os.setstate(ios_base::badbit | ios_base::failbit);
+
+# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
+ } catch (...) {
+ __os.__set_badbit_and_consider_rethrow();
+ }
+# endif // _LIBCPP_HAS_NO_EXCEPTIONS
+ }
+}
+
+template <class = void> // TODO PRINT template or availability markup fires too eagerly (http://llvm.org/PR61563).
+_LIBCPP_HIDE_FROM_ABI inline void vprint_nonunicode(ostream& __os, string_view __fmt, format_args __args) {
+ std::__vprint_nonunicode(__os, __fmt, __args, false);
+}
+
+// Returns the FILE* associated with the __os.
+// Returns a nullptr when no FILE* is associated with __os.
+// This function is in the dylib since the type of the buffer associated
+// with std::cout, std::cerr, and std::clog is only known in the dylib.
+//
+// This function implements part of the implementation-defined behavior
+// of [ostream.formatted.print]/3
+// If the function is vprint_unicode and os is a stream that refers to
+// a terminal capable of displaying Unicode which is determined in an
+// implementation-defined manner, writes out to the terminal using the
+// native Unicode API;
+// Whether the returned FILE* is "a terminal capable of displaying Unicode"
+// is determined in the same way as the print(FILE*, ...) overloads.
+_LIBCPP_AVAILABILITY_PRINT _LIBCPP_EXPORTED_FROM_ABI FILE* __get_ostream_file(ostream& __os);
+
+# ifndef _LIBCPP_HAS_NO_UNICODE
+template <class = void> // TODO PRINT template or availability markup fires too eagerly (http://llvm.org/PR61563).
+_LIBCPP_AVAILABILITY_PRINT _LIBCPP_HIDE_FROM_ABI void
+__vprint_unicode(ostream& __os, string_view __fmt, format_args __args, bool __write_nl) {
+ FILE* __file = std::__get_ostream_file(__os);
+ if (!__file || !__print::__is_terminal(__file))
+ return std::__vprint_nonunicode(__os, __fmt, __args, __write_nl);
+
+ // [ostream.formatted.print]/3
+ // If the function is vprint_unicode and os is a stream that refers to a
+ // terminal capable of displaying Unicode which is determined in an
+ // implementation-defined manner, writes out to the terminal using the
+ // native Unicode API; if out contains invalid code units, the behavior is
+ // undefined and implementations are encouraged to diagnose it. If the
+ // native Unicode API is used, the function flushes os before writing out.
+ //
+ // This is the path for the native API, start with flushing.
+ __os.flush();
+
+# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
+ try {
+# endif // _LIBCPP_HAS_NO_EXCEPTIONS
+ ostream::sentry __s(__os);
+ if (__s) {
+# ifndef _LIBCPP_WIN32API
+ __print::__vprint_unicode_posix(__file, __fmt, __args, __write_nl, true);
+# elif !defined(_LIBCPP_HAS_NO_WIDE_CHARACTERS)
+ __print::__vprint_unicode_windows(__file, __fmt, __args, __write_nl, true);
+# else
+# error "Windows builds with wchar_t disabled are not supported."
+# endif
+ }
+
+# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
+ } catch (...) {
+ __os.__set_badbit_and_consider_rethrow();
+ }
+# endif // _LIBCPP_HAS_NO_EXCEPTIONS
+}
+
+template <class = void> // TODO PRINT template or availability markup fires too eagerly (http://llvm.org/PR61563).
+_LIBCPP_AVAILABILITY_PRINT _LIBCPP_HIDE_FROM_ABI inline void
+vprint_unicode(ostream& __os, string_view __fmt, format_args __args) {
+ std::__vprint_unicode(__os, __fmt, __args, false);
+}
+# endif // _LIBCPP_HAS_NO_UNICODE
+
+template <class... _Args>
+_LIBCPP_AVAILABILITY_PRINT _LIBCPP_HIDE_FROM_ABI void
+print(ostream& __os, format_string<_Args...> __fmt, _Args&&... __args) {
+# ifndef _LIBCPP_HAS_NO_UNICODE
+ if constexpr (__print::__use_unicode)
+ std::__vprint_unicode(__os, __fmt.get(), std::make_format_args(__args...), false);
+ else
+ std::__vprint_nonunicode(__os, __fmt.get(), std::make_format_args(__args...), false);
+# else // _LIBCPP_HAS_NO_UNICODE
+ std::__vprint_nonunicode(__os, __fmt.get(), std::make_format_args(__args...), false);
+# endif // _LIBCPP_HAS_NO_UNICODE
+}
+
+template <class... _Args>
+_LIBCPP_AVAILABILITY_PRINT _LIBCPP_HIDE_FROM_ABI void
+println(ostream& __os, format_string<_Args...> __fmt, _Args&&... __args) {
+# ifndef _LIBCPP_HAS_NO_UNICODE
+ // Note the wording in the Standard is inefficient. The output of
+ // std::format is a std::string which is then copied. This solution
+ // just appends a newline at the end of the output.
+ if constexpr (__print::__use_unicode)
+ std::__vprint_unicode(__os, __fmt.get(), std::make_format_args(__args...), true);
+ else
+ std::__vprint_nonunicode(__os, __fmt.get(), std::make_format_args(__args...), true);
+# else // _LIBCPP_HAS_NO_UNICODE
+ std::__vprint_nonunicode(__os, __fmt.get(), std::make_format_args(__args...), true);
+# endif // _LIBCPP_HAS_NO_UNICODE
+}
+
+#endif // _LIBCPP_STD_VER >= 23
+
_LIBCPP_END_NAMESPACE_STD
#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
diff --git a/contrib/llvm-project/libcxx/include/print b/contrib/llvm-project/libcxx/include/print
index d119c8bda749..0f8e73f8eb5c 100644
--- a/contrib/llvm-project/libcxx/include/print
+++ b/contrib/llvm-project/libcxx/include/print
@@ -59,7 +59,7 @@ namespace std {
_LIBCPP_BEGIN_NAMESPACE_STD
-#ifdef _WIN32
+#ifdef _LIBCPP_WIN32API
_LIBCPP_EXPORTED_FROM_ABI bool __is_windows_terminal(FILE* __stream);
# ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
@@ -75,7 +75,7 @@ _LIBCPP_EXPORTED_FROM_ABI bool __is_windows_terminal(FILE* __stream);
_LIBCPP_EXPORTED_FROM_ABI void __write_to_windows_console(FILE* __stream, wstring_view __view);
# endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS
-#endif // _WIN32
+#endif // _LIBCPP_WIN32API
#if _LIBCPP_STD_VER >= 23
@@ -198,7 +198,11 @@ inline constexpr bool __use_unicode = true;
# endif
_LIBCPP_HIDE_FROM_ABI inline bool __is_terminal(FILE* __stream) {
-# ifdef _WIN32
+ // The macro _LIBCPP_TESTING_PRINT_IS_TERMINAL is used to change
+ // the behavior in the test. This is not part of the public API.
+# ifdef _LIBCPP_TESTING_PRINT_IS_TERMINAL
+ return _LIBCPP_TESTING_PRINT_IS_TERMINAL(__stream);
+# elif defined(_LIBCPP_WIN32API)
return std::__is_windows_terminal(__stream);
# elif __has_include(<unistd.h>)
return isatty(fileno(__stream));
@@ -271,7 +275,7 @@ __vprint_unicode_windows(FILE* __stream, string_view __fmt, format_args __args,
// the behavior in the test. This is not part of the public API.
# ifdef _LIBCPP_TESTING_PRINT_WRITE_TO_WINDOWS_CONSOLE_FUNCTION
_LIBCPP_TESTING_PRINT_WRITE_TO_WINDOWS_CONSOLE_FUNCTION(__stream, __view);
-# elif defined(_WIN32)
+# elif defined(_LIBCPP_WIN32API)
std::__write_to_windows_console(__stream, __view);
# else
std::__throw_runtime_error("No defintion of _LIBCPP_TESTING_PRINT_WRITE_TO_WINDOWS_CONSOLE_FUNCTION and "
@@ -309,7 +313,7 @@ __vprint_unicode([[maybe_unused]] FILE* __stream,
// so there the call can be forwarded to the non_unicode API. On
// Windows there is a different API. This API requires transcoding.
-# ifndef _WIN32
+# ifndef _LIBCPP_WIN32API
__print::__vprint_unicode_posix(__stream, __fmt, __args, __write_nl, __print::__is_terminal(__stream));
# elif !defined(_LIBCPP_HAS_NO_WIDE_CHARACTERS)
__print::__vprint_unicode_windows(__stream, __fmt, __args, __write_nl, __print::__is_terminal(__stream));
diff --git a/contrib/llvm-project/libcxx/include/queue b/contrib/llvm-project/libcxx/include/queue
index c9a4eb27a9a6..692e38bb3522 100644
--- a/contrib/llvm-project/libcxx/include/queue
+++ b/contrib/llvm-project/libcxx/include/queue
@@ -285,212 +285,170 @@ template <class T, class Container, class Compare>
_LIBCPP_BEGIN_NAMESPACE_STD
-template <class _Tp, class _Container = deque<_Tp> > class _LIBCPP_TEMPLATE_VIS queue;
+template <class _Tp, class _Container = deque<_Tp> >
+class _LIBCPP_TEMPLATE_VIS queue;
template <class _Tp, class _Container>
-_LIBCPP_HIDE_FROM_ABI
-bool
-operator==(const queue<_Tp, _Container>& __x,const queue<_Tp, _Container>& __y);
+_LIBCPP_HIDE_FROM_ABI bool operator==(const queue<_Tp, _Container>& __x, const queue<_Tp, _Container>& __y);
template <class _Tp, class _Container>
-_LIBCPP_HIDE_FROM_ABI
-bool
-operator< (const queue<_Tp, _Container>& __x,const queue<_Tp, _Container>& __y);
+_LIBCPP_HIDE_FROM_ABI bool operator<(const queue<_Tp, _Container>& __x, const queue<_Tp, _Container>& __y);
template <class _Tp, class _Container /*= deque<_Tp>*/>
-class _LIBCPP_TEMPLATE_VIS queue
-{
+class _LIBCPP_TEMPLATE_VIS queue {
public:
- typedef _Container container_type;
- typedef typename container_type::value_type value_type;
- typedef typename container_type::reference reference;
- typedef typename container_type::const_reference const_reference;
- typedef typename container_type::size_type size_type;
- static_assert((is_same<_Tp, value_type>::value), "" );
+ typedef _Container container_type;
+ typedef typename container_type::value_type value_type;
+ typedef typename container_type::reference reference;
+ typedef typename container_type::const_reference const_reference;
+ typedef typename container_type::size_type size_type;
+ static_assert((is_same<_Tp, value_type>::value), "");
protected:
- container_type c;
+ container_type c;
public:
- _LIBCPP_HIDE_FROM_ABI
- queue()
- _NOEXCEPT_(is_nothrow_default_constructible<container_type>::value)
- : c() {}
+ _LIBCPP_HIDE_FROM_ABI queue() _NOEXCEPT_(is_nothrow_default_constructible<container_type>::value) : c() {}
- _LIBCPP_HIDE_FROM_ABI
- queue(const queue& __q) : c(__q.c) {}
+ _LIBCPP_HIDE_FROM_ABI queue(const queue& __q) : c(__q.c) {}
#if _LIBCPP_STD_VER >= 23
- template <class _InputIterator,
- class = __enable_if_t<__has_input_iterator_category<_InputIterator>::value>>
- _LIBCPP_HIDE_FROM_ABI
- queue(_InputIterator __first, _InputIterator __last) : c(__first, __last) {}
-
- template <_ContainerCompatibleRange<_Tp> _Range>
- _LIBCPP_HIDE_FROM_ABI
- queue(from_range_t, _Range&& __range) : c(from_range, std::forward<_Range>(__range)) {}
-
- template <class _InputIterator,
- class _Alloc,
- class = __enable_if_t<__has_input_iterator_category<_InputIterator>::value>,
- class = __enable_if_t<uses_allocator<container_type, _Alloc>::value>>
- _LIBCPP_HIDE_FROM_ABI
- queue(_InputIterator __first, _InputIterator __second, const _Alloc& __alloc) : c(__first, __second, __alloc) {}
-
- template <_ContainerCompatibleRange<_Tp> _Range,
- class _Alloc,
- class = __enable_if_t<uses_allocator<container_type, _Alloc>::value>>
- _LIBCPP_HIDE_FROM_ABI
- queue(from_range_t, _Range&& __range, const _Alloc& __alloc)
+ template <class _InputIterator, class = __enable_if_t<__has_input_iterator_category<_InputIterator>::value>>
+ _LIBCPP_HIDE_FROM_ABI queue(_InputIterator __first, _InputIterator __last) : c(__first, __last) {}
+
+ template <_ContainerCompatibleRange<_Tp> _Range>
+ _LIBCPP_HIDE_FROM_ABI queue(from_range_t, _Range&& __range) : c(from_range, std::forward<_Range>(__range)) {}
+
+ template <class _InputIterator,
+ class _Alloc,
+ class = __enable_if_t<__has_input_iterator_category<_InputIterator>::value>,
+ class = __enable_if_t<uses_allocator<container_type, _Alloc>::value>>
+ _LIBCPP_HIDE_FROM_ABI queue(_InputIterator __first, _InputIterator __second, const _Alloc& __alloc)
+ : c(__first, __second, __alloc) {}
+
+ template <_ContainerCompatibleRange<_Tp> _Range,
+ class _Alloc,
+ class = __enable_if_t<uses_allocator<container_type, _Alloc>::value>>
+ _LIBCPP_HIDE_FROM_ABI queue(from_range_t, _Range&& __range, const _Alloc& __alloc)
: c(from_range, std::forward<_Range>(__range), __alloc) {}
#endif
- _LIBCPP_HIDE_FROM_ABI
- queue& operator=(const queue& __q) {c = __q.c; return *this;}
+ _LIBCPP_HIDE_FROM_ABI queue& operator=(const queue& __q) {
+ c = __q.c;
+ return *this;
+ }
#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI
- queue(queue&& __q)
- _NOEXCEPT_(is_nothrow_move_constructible<container_type>::value)
- : c(std::move(__q.c)) {}
-
- _LIBCPP_HIDE_FROM_ABI
- queue& operator=(queue&& __q)
- _NOEXCEPT_(is_nothrow_move_assignable<container_type>::value)
- {c = std::move(__q.c); return *this;}
+ _LIBCPP_HIDE_FROM_ABI queue(queue&& __q) _NOEXCEPT_(is_nothrow_move_constructible<container_type>::value)
+ : c(std::move(__q.c)) {}
+
+ _LIBCPP_HIDE_FROM_ABI queue& operator=(queue&& __q) _NOEXCEPT_(is_nothrow_move_assignable<container_type>::value) {
+ c = std::move(__q.c);
+ return *this;
+ }
#endif // _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI
- explicit queue(const container_type& __c) : c(__c) {}
+ _LIBCPP_HIDE_FROM_ABI explicit queue(const container_type& __c) : c(__c) {}
#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI
- explicit queue(container_type&& __c) : c(std::move(__c)) {}
+ _LIBCPP_HIDE_FROM_ABI explicit queue(container_type&& __c) : c(std::move(__c)) {}
#endif // _LIBCPP_CXX03_LANG
- template <class _Alloc>
- _LIBCPP_HIDE_FROM_ABI
- explicit queue(const _Alloc& __a,
- __enable_if_t<uses_allocator<container_type, _Alloc>::value>* = 0)
- : c(__a) {}
- template <class _Alloc>
- _LIBCPP_HIDE_FROM_ABI
- queue(const queue& __q, const _Alloc& __a,
- __enable_if_t<uses_allocator<container_type, _Alloc>::value>* = 0)
- : c(__q.c, __a) {}
- template <class _Alloc>
- _LIBCPP_HIDE_FROM_ABI
- queue(const container_type& __c, const _Alloc& __a,
- __enable_if_t<uses_allocator<container_type, _Alloc>::value>* = 0)
- : c(__c, __a) {}
+ template <class _Alloc>
+ _LIBCPP_HIDE_FROM_ABI explicit queue(const _Alloc& __a,
+ __enable_if_t<uses_allocator<container_type, _Alloc>::value>* = 0)
+ : c(__a) {}
+ template <class _Alloc>
+ _LIBCPP_HIDE_FROM_ABI
+ queue(const queue& __q, const _Alloc& __a, __enable_if_t<uses_allocator<container_type, _Alloc>::value>* = 0)
+ : c(__q.c, __a) {}
+ template <class _Alloc>
+ _LIBCPP_HIDE_FROM_ABI
+ queue(const container_type& __c, const _Alloc& __a, __enable_if_t<uses_allocator<container_type, _Alloc>::value>* = 0)
+ : c(__c, __a) {}
#ifndef _LIBCPP_CXX03_LANG
- template <class _Alloc>
- _LIBCPP_HIDE_FROM_ABI
- queue(container_type&& __c, const _Alloc& __a,
- __enable_if_t<uses_allocator<container_type, _Alloc>::value>* = 0)
- : c(std::move(__c), __a) {}
- template <class _Alloc>
- _LIBCPP_HIDE_FROM_ABI
- queue(queue&& __q, const _Alloc& __a,
- __enable_if_t<uses_allocator<container_type, _Alloc>::value>* = 0)
- : c(std::move(__q.c), __a) {}
+ template <class _Alloc>
+ _LIBCPP_HIDE_FROM_ABI
+ queue(container_type&& __c, const _Alloc& __a, __enable_if_t<uses_allocator<container_type, _Alloc>::value>* = 0)
+ : c(std::move(__c), __a) {}
+ template <class _Alloc>
+ _LIBCPP_HIDE_FROM_ABI
+ queue(queue&& __q, const _Alloc& __a, __enable_if_t<uses_allocator<container_type, _Alloc>::value>* = 0)
+ : c(std::move(__q.c), __a) {}
#endif // _LIBCPP_CXX03_LANG
- _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_HIDE_FROM_ABI
- bool empty() const {return c.empty();}
- _LIBCPP_HIDE_FROM_ABI
- size_type size() const {return c.size();}
-
- _LIBCPP_HIDE_FROM_ABI
- reference front() {return c.front();}
- _LIBCPP_HIDE_FROM_ABI
- const_reference front() const {return c.front();}
- _LIBCPP_HIDE_FROM_ABI
- reference back() {return c.back();}
- _LIBCPP_HIDE_FROM_ABI
- const_reference back() const {return c.back();}
-
- _LIBCPP_HIDE_FROM_ABI
- void push(const value_type& __v) {c.push_back(__v);}
-#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI
- void push(value_type&& __v) {c.push_back(std::move(__v));}
+ _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_HIDE_FROM_ABI bool empty() const { return c.empty(); }
+ _LIBCPP_HIDE_FROM_ABI size_type size() const { return c.size(); }
-#if _LIBCPP_STD_VER >= 23
- template <_ContainerCompatibleRange<_Tp> _Range>
- _LIBCPP_HIDE_FROM_ABI
- void push_range(_Range&& __range) {
- if constexpr (requires (container_type& __c) {
- __c.append_range(std::forward<_Range>(__range));
- }) {
- c.append_range(std::forward<_Range>(__range));
- } else {
- ranges::copy(std::forward<_Range>(__range), std::back_inserter(c));
- }
- }
-#endif
+ _LIBCPP_HIDE_FROM_ABI reference front() { return c.front(); }
+ _LIBCPP_HIDE_FROM_ABI const_reference front() const { return c.front(); }
+ _LIBCPP_HIDE_FROM_ABI reference back() { return c.back(); }
+ _LIBCPP_HIDE_FROM_ABI const_reference back() const { return c.back(); }
- template <class... _Args>
- _LIBCPP_HIDE_FROM_ABI
-#if _LIBCPP_STD_VER >= 17
- decltype(auto) emplace(_Args&&... __args)
- { return c.emplace_back(std::forward<_Args>(__args)...);}
-#else
- void emplace(_Args&&... __args)
- { c.emplace_back(std::forward<_Args>(__args)...);}
-#endif
-#endif // _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI
- void pop() {c.pop_front();}
-
- _LIBCPP_HIDE_FROM_ABI
- void swap(queue& __q)
- _NOEXCEPT_(__is_nothrow_swappable<container_type>::value)
- {
- using std::swap;
- swap(c, __q.c);
+ _LIBCPP_HIDE_FROM_ABI void push(const value_type& __v) { c.push_back(__v); }
+#ifndef _LIBCPP_CXX03_LANG
+ _LIBCPP_HIDE_FROM_ABI void push(value_type&& __v) { c.push_back(std::move(__v)); }
+
+# if _LIBCPP_STD_VER >= 23
+ template <_ContainerCompatibleRange<_Tp> _Range>
+ _LIBCPP_HIDE_FROM_ABI void push_range(_Range&& __range) {
+ if constexpr (requires(container_type& __c) { __c.append_range(std::forward<_Range>(__range)); }) {
+ c.append_range(std::forward<_Range>(__range));
+ } else {
+ ranges::copy(std::forward<_Range>(__range), std::back_inserter(c));
}
+ }
+# endif
+
+ template <class... _Args>
+ _LIBCPP_HIDE_FROM_ABI
+# if _LIBCPP_STD_VER >= 17
+ decltype(auto)
+ emplace(_Args&&... __args) {
+ return c.emplace_back(std::forward<_Args>(__args)...);
+ }
+# else
+ void
+ emplace(_Args&&... __args) {
+ c.emplace_back(std::forward<_Args>(__args)...);
+ }
+# endif
+#endif // _LIBCPP_CXX03_LANG
+ _LIBCPP_HIDE_FROM_ABI void pop() { c.pop_front(); }
+
+ _LIBCPP_HIDE_FROM_ABI void swap(queue& __q) _NOEXCEPT_(__is_nothrow_swappable<container_type>::value) {
+ using std::swap;
+ swap(c, __q.c);
+ }
- _LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI const _Container& __get_container() const { return c; }
+ _LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI const _Container& __get_container() const { return c; }
- template <class _T1, class _OtherContainer>
- friend
- _LIBCPP_HIDE_FROM_ABI
- bool
- operator==(const queue<_T1, _OtherContainer>& __x,const queue<_T1, _OtherContainer>& __y);
+ template <class _T1, class _OtherContainer>
+ friend _LIBCPP_HIDE_FROM_ABI bool
+ operator==(const queue<_T1, _OtherContainer>& __x, const queue<_T1, _OtherContainer>& __y);
- template <class _T1, class _OtherContainer>
- friend
- _LIBCPP_HIDE_FROM_ABI
- bool
- operator< (const queue<_T1, _OtherContainer>& __x,const queue<_T1, _OtherContainer>& __y);
+ template <class _T1, class _OtherContainer>
+ friend _LIBCPP_HIDE_FROM_ABI bool
+ operator<(const queue<_T1, _OtherContainer>& __x, const queue<_T1, _OtherContainer>& __y);
};
#if _LIBCPP_STD_VER >= 17
-template<class _Container,
- class = enable_if_t<!__is_allocator<_Container>::value>
->
-queue(_Container)
- -> queue<typename _Container::value_type, _Container>;
-
-template<class _Container,
- class _Alloc,
- class = enable_if_t<!__is_allocator<_Container>::value>,
- class = enable_if_t<uses_allocator<_Container, _Alloc>::value>
->
-queue(_Container, _Alloc)
- -> queue<typename _Container::value_type, _Container>;
+template <class _Container, class = enable_if_t<!__is_allocator<_Container>::value> >
+queue(_Container) -> queue<typename _Container::value_type, _Container>;
+
+template <class _Container,
+ class _Alloc,
+ class = enable_if_t<!__is_allocator<_Container>::value>,
+ class = enable_if_t<uses_allocator<_Container, _Alloc>::value> >
+queue(_Container, _Alloc) -> queue<typename _Container::value_type, _Container>;
#endif
#if _LIBCPP_STD_VER >= 23
-template <class _InputIterator,
- class = __enable_if_t<__has_input_iterator_category<_InputIterator>::value>>
-queue(_InputIterator, _InputIterator)
- -> queue<__iter_value_type<_InputIterator>>;
+template <class _InputIterator, class = __enable_if_t<__has_input_iterator_category<_InputIterator>::value>>
+queue(_InputIterator, _InputIterator) -> queue<__iter_value_type<_InputIterator>>;
template <ranges::input_range _Range>
-queue(from_range_t, _Range&&)
- -> queue<ranges::range_value_t<_Range>>;
+queue(from_range_t, _Range&&) -> queue<ranges::range_value_t<_Range>>;
template <class _InputIterator,
class _Alloc,
@@ -499,59 +457,39 @@ template <class _InputIterator,
queue(_InputIterator, _InputIterator, _Alloc)
-> queue<__iter_value_type<_InputIterator>, deque<__iter_value_type<_InputIterator>, _Alloc>>;
-template <ranges::input_range _Range,
- class _Alloc,
- class = __enable_if_t<__is_allocator<_Alloc>::value>>
+template <ranges::input_range _Range, class _Alloc, class = __enable_if_t<__is_allocator<_Alloc>::value>>
queue(from_range_t, _Range&&, _Alloc)
-> queue<ranges::range_value_t<_Range>, deque<ranges::range_value_t<_Range>, _Alloc>>;
#endif
template <class _Tp, class _Container>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator==(const queue<_Tp, _Container>& __x,const queue<_Tp, _Container>& __y)
-{
- return __x.c == __y.c;
+inline _LIBCPP_HIDE_FROM_ABI bool operator==(const queue<_Tp, _Container>& __x, const queue<_Tp, _Container>& __y) {
+ return __x.c == __y.c;
}
template <class _Tp, class _Container>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator< (const queue<_Tp, _Container>& __x,const queue<_Tp, _Container>& __y)
-{
- return __x.c < __y.c;
+inline _LIBCPP_HIDE_FROM_ABI bool operator<(const queue<_Tp, _Container>& __x, const queue<_Tp, _Container>& __y) {
+ return __x.c < __y.c;
}
template <class _Tp, class _Container>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator!=(const queue<_Tp, _Container>& __x,const queue<_Tp, _Container>& __y)
-{
- return !(__x == __y);
+inline _LIBCPP_HIDE_FROM_ABI bool operator!=(const queue<_Tp, _Container>& __x, const queue<_Tp, _Container>& __y) {
+ return !(__x == __y);
}
template <class _Tp, class _Container>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator> (const queue<_Tp, _Container>& __x,const queue<_Tp, _Container>& __y)
-{
- return __y < __x;
+inline _LIBCPP_HIDE_FROM_ABI bool operator>(const queue<_Tp, _Container>& __x, const queue<_Tp, _Container>& __y) {
+ return __y < __x;
}
template <class _Tp, class _Container>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator>=(const queue<_Tp, _Container>& __x,const queue<_Tp, _Container>& __y)
-{
- return !(__x < __y);
+inline _LIBCPP_HIDE_FROM_ABI bool operator>=(const queue<_Tp, _Container>& __x, const queue<_Tp, _Container>& __y) {
+ return !(__x < __y);
}
template <class _Tp, class _Container>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator<=(const queue<_Tp, _Container>& __x,const queue<_Tp, _Container>& __y)
-{
- return !(__y < __x);
+inline _LIBCPP_HIDE_FROM_ABI bool operator<=(const queue<_Tp, _Container>& __x, const queue<_Tp, _Container>& __y) {
+ return !(__y < __x);
}
#if _LIBCPP_STD_VER >= 20
@@ -559,281 +497,255 @@ operator<=(const queue<_Tp, _Container>& __x,const queue<_Tp, _Container>& __y)
template <class _Tp, three_way_comparable _Container>
_LIBCPP_HIDE_FROM_ABI compare_three_way_result_t<_Container>
operator<=>(const queue<_Tp, _Container>& __x, const queue<_Tp, _Container>& __y) {
- // clang 16 bug: declaring `friend operator<=>` causes "use of overloaded operator '*' is ambiguous" errors
- return __x.__get_container() <=> __y.__get_container();
+ // clang 16 bug: declaring `friend operator<=>` causes "use of overloaded operator '*' is ambiguous" errors
+ return __x.__get_container() <=> __y.__get_container();
}
#endif
template <class _Tp, class _Container, __enable_if_t<__is_swappable<_Container>::value, int> = 0>
-inline _LIBCPP_HIDE_FROM_ABI
-void
-swap(queue<_Tp, _Container>& __x, queue<_Tp, _Container>& __y)
- _NOEXCEPT_(_NOEXCEPT_(__x.swap(__y)))
-{
- __x.swap(__y);
+inline _LIBCPP_HIDE_FROM_ABI void swap(queue<_Tp, _Container>& __x, queue<_Tp, _Container>& __y)
+ _NOEXCEPT_(_NOEXCEPT_(__x.swap(__y))) {
+ __x.swap(__y);
}
template <class _Tp, class _Container, class _Alloc>
-struct _LIBCPP_TEMPLATE_VIS uses_allocator<queue<_Tp, _Container>, _Alloc>
- : public uses_allocator<_Container, _Alloc>
-{
+struct _LIBCPP_TEMPLATE_VIS uses_allocator<queue<_Tp, _Container>, _Alloc> : public uses_allocator<_Container, _Alloc> {
};
-template <class _Tp, class _Container = vector<_Tp>,
- class _Compare = less<typename _Container::value_type> >
-class _LIBCPP_TEMPLATE_VIS priority_queue
-{
+template <class _Tp, class _Container = vector<_Tp>, class _Compare = less<typename _Container::value_type> >
+class _LIBCPP_TEMPLATE_VIS priority_queue {
public:
- typedef _Container container_type;
- typedef _Compare value_compare;
- typedef typename container_type::value_type value_type;
- typedef typename container_type::reference reference;
- typedef typename container_type::const_reference const_reference;
- typedef typename container_type::size_type size_type;
- static_assert((is_same<_Tp, value_type>::value), "" );
+ typedef _Container container_type;
+ typedef _Compare value_compare;
+ typedef typename container_type::value_type value_type;
+ typedef typename container_type::reference reference;
+ typedef typename container_type::const_reference const_reference;
+ typedef typename container_type::size_type size_type;
+ static_assert((is_same<_Tp, value_type>::value), "");
protected:
- container_type c;
- value_compare comp;
+ container_type c;
+ value_compare comp;
public:
- _LIBCPP_HIDE_FROM_ABI
- priority_queue()
- _NOEXCEPT_(is_nothrow_default_constructible<container_type>::value &&
- is_nothrow_default_constructible<value_compare>::value)
- : c(), comp() {}
+ _LIBCPP_HIDE_FROM_ABI priority_queue() _NOEXCEPT_(
+ is_nothrow_default_constructible<container_type>::value&& is_nothrow_default_constructible<value_compare>::value)
+ : c(), comp() {}
- _LIBCPP_HIDE_FROM_ABI
- priority_queue(const priority_queue& __q) : c(__q.c), comp(__q.comp) {}
+ _LIBCPP_HIDE_FROM_ABI priority_queue(const priority_queue& __q) : c(__q.c), comp(__q.comp) {}
- _LIBCPP_HIDE_FROM_ABI
- priority_queue& operator=(const priority_queue& __q)
- {c = __q.c; comp = __q.comp; return *this;}
+ _LIBCPP_HIDE_FROM_ABI priority_queue& operator=(const priority_queue& __q) {
+ c = __q.c;
+ comp = __q.comp;
+ return *this;
+ }
#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI
- priority_queue(priority_queue&& __q)
- _NOEXCEPT_(is_nothrow_move_constructible<container_type>::value &&
- is_nothrow_move_constructible<value_compare>::value)
- : c(std::move(__q.c)), comp(std::move(__q.comp)) {}
-
- _LIBCPP_HIDE_FROM_ABI
- priority_queue& operator=(priority_queue&& __q)
- _NOEXCEPT_(is_nothrow_move_assignable<container_type>::value &&
- is_nothrow_move_assignable<value_compare>::value)
- {c = std::move(__q.c); comp = std::move(__q.comp); return *this;}
+ _LIBCPP_HIDE_FROM_ABI priority_queue(priority_queue&& __q) _NOEXCEPT_(
+ is_nothrow_move_constructible<container_type>::value&& is_nothrow_move_constructible<value_compare>::value)
+ : c(std::move(__q.c)), comp(std::move(__q.comp)) {}
+
+ _LIBCPP_HIDE_FROM_ABI priority_queue& operator=(priority_queue&& __q)
+ _NOEXCEPT_(is_nothrow_move_assignable<container_type>::value&& is_nothrow_move_assignable<value_compare>::value) {
+ c = std::move(__q.c);
+ comp = std::move(__q.comp);
+ return *this;
+ }
#endif // _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI
- explicit priority_queue(const value_compare& __comp)
- : c(), comp(__comp) {}
- _LIBCPP_HIDE_FROM_ABI
- priority_queue(const value_compare& __comp, const container_type& __c);
+ _LIBCPP_HIDE_FROM_ABI explicit priority_queue(const value_compare& __comp) : c(), comp(__comp) {}
+ _LIBCPP_HIDE_FROM_ABI priority_queue(const value_compare& __comp, const container_type& __c);
#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI
- priority_queue(const value_compare& __comp, container_type&& __c);
+ _LIBCPP_HIDE_FROM_ABI priority_queue(const value_compare& __comp, container_type&& __c);
#endif
- template <class _InputIter, class = __enable_if_t<__has_input_iterator_category<_InputIter>::value> >
- _LIBCPP_HIDE_FROM_ABI
- priority_queue(_InputIter __f, _InputIter __l,
- const value_compare& __comp = value_compare());
- template <class _InputIter, class = __enable_if_t<__has_input_iterator_category<_InputIter>::value> >
- _LIBCPP_HIDE_FROM_ABI
- priority_queue(_InputIter __f, _InputIter __l,
- const value_compare& __comp, const container_type& __c);
+ template <class _InputIter, class = __enable_if_t<__has_input_iterator_category<_InputIter>::value> >
+ _LIBCPP_HIDE_FROM_ABI priority_queue(_InputIter __f, _InputIter __l, const value_compare& __comp = value_compare());
+ template <class _InputIter, class = __enable_if_t<__has_input_iterator_category<_InputIter>::value> >
+ _LIBCPP_HIDE_FROM_ABI
+ priority_queue(_InputIter __f, _InputIter __l, const value_compare& __comp, const container_type& __c);
#ifndef _LIBCPP_CXX03_LANG
- template <class _InputIter, class = __enable_if_t<__has_input_iterator_category<_InputIter>::value> >
- _LIBCPP_HIDE_FROM_ABI
- priority_queue(_InputIter __f, _InputIter __l,
- const value_compare& __comp, container_type&& __c);
+ template <class _InputIter, class = __enable_if_t<__has_input_iterator_category<_InputIter>::value> >
+ _LIBCPP_HIDE_FROM_ABI
+ priority_queue(_InputIter __f, _InputIter __l, const value_compare& __comp, container_type&& __c);
#endif // _LIBCPP_CXX03_LANG
#if _LIBCPP_STD_VER >= 23
- template <_ContainerCompatibleRange<_Tp> _Range>
- _LIBCPP_HIDE_FROM_ABI
- priority_queue(from_range_t, _Range&& __range, const value_compare& __comp = value_compare())
- : c(from_range, std::forward<_Range>(__range)),
- comp(__comp) {
- std::make_heap(c.begin(), c.end(), comp);
- }
+ template <_ContainerCompatibleRange<_Tp> _Range>
+ _LIBCPP_HIDE_FROM_ABI priority_queue(from_range_t, _Range&& __range, const value_compare& __comp = value_compare())
+ : c(from_range, std::forward<_Range>(__range)), comp(__comp) {
+ std::make_heap(c.begin(), c.end(), comp);
+ }
#endif
- template <class _Alloc>
- _LIBCPP_HIDE_FROM_ABI
- explicit priority_queue(const _Alloc& __a,
- __enable_if_t<uses_allocator<container_type, _Alloc>::value>* = 0);
- template <class _Alloc>
- _LIBCPP_HIDE_FROM_ABI
- priority_queue(const value_compare& __comp, const _Alloc& __a,
- __enable_if_t<uses_allocator<container_type, _Alloc>::value>* = 0);
- template <class _Alloc>
- _LIBCPP_HIDE_FROM_ABI
- priority_queue(const value_compare& __comp, const container_type& __c,
- const _Alloc& __a,
- __enable_if_t<uses_allocator<container_type, _Alloc>::value>* = 0);
- template <class _Alloc>
- _LIBCPP_HIDE_FROM_ABI
- priority_queue(const priority_queue& __q, const _Alloc& __a,
- __enable_if_t<uses_allocator<container_type, _Alloc>::value>* = 0);
+ template <class _Alloc>
+ _LIBCPP_HIDE_FROM_ABI explicit priority_queue(const _Alloc& __a,
+ __enable_if_t<uses_allocator<container_type, _Alloc>::value>* = 0);
+ template <class _Alloc>
+ _LIBCPP_HIDE_FROM_ABI
+ priority_queue(const value_compare& __comp,
+ const _Alloc& __a,
+ __enable_if_t<uses_allocator<container_type, _Alloc>::value>* = 0);
+ template <class _Alloc>
+ _LIBCPP_HIDE_FROM_ABI
+ priority_queue(const value_compare& __comp,
+ const container_type& __c,
+ const _Alloc& __a,
+ __enable_if_t<uses_allocator<container_type, _Alloc>::value>* = 0);
+ template <class _Alloc>
+ _LIBCPP_HIDE_FROM_ABI priority_queue(
+ const priority_queue& __q, const _Alloc& __a, __enable_if_t<uses_allocator<container_type, _Alloc>::value>* = 0);
#ifndef _LIBCPP_CXX03_LANG
- template <class _Alloc>
- _LIBCPP_HIDE_FROM_ABI
- priority_queue(const value_compare& __comp, container_type&& __c,
- const _Alloc& __a,
- __enable_if_t<uses_allocator<container_type, _Alloc>::value>* = 0);
- template <class _Alloc>
- _LIBCPP_HIDE_FROM_ABI
- priority_queue(priority_queue&& __q, const _Alloc& __a,
- __enable_if_t<uses_allocator<container_type, _Alloc>::value>* = 0);
+ template <class _Alloc>
+ _LIBCPP_HIDE_FROM_ABI
+ priority_queue(const value_compare& __comp,
+ container_type&& __c,
+ const _Alloc& __a,
+ __enable_if_t<uses_allocator<container_type, _Alloc>::value>* = 0);
+ template <class _Alloc>
+ _LIBCPP_HIDE_FROM_ABI priority_queue(
+ priority_queue&& __q, const _Alloc& __a, __enable_if_t<uses_allocator<container_type, _Alloc>::value>* = 0);
#endif // _LIBCPP_CXX03_LANG
- template <class _InputIter, class _Alloc, class = __enable_if_t<__has_input_iterator_category<_InputIter>::value> >
- _LIBCPP_HIDE_FROM_ABI
- priority_queue(_InputIter __f, _InputIter __l, const _Alloc& __a,
- __enable_if_t<uses_allocator<container_type, _Alloc>::value>* = 0);
-
- template <class _InputIter, class _Alloc, class = __enable_if_t<__has_input_iterator_category<_InputIter>::value> >
- _LIBCPP_HIDE_FROM_ABI
- priority_queue(_InputIter __f, _InputIter __l,
- const value_compare& __comp, const _Alloc& __a,
- __enable_if_t<uses_allocator<container_type, _Alloc>::value>* = 0);
-
- template <class _InputIter, class _Alloc, class = __enable_if_t<__has_input_iterator_category<_InputIter>::value> >
- _LIBCPP_HIDE_FROM_ABI
- priority_queue(_InputIter __f, _InputIter __l,
- const value_compare& __comp, const container_type& __c, const _Alloc& __a,
- __enable_if_t<uses_allocator<container_type, _Alloc>::value>* = 0);
+ template <class _InputIter, class _Alloc, class = __enable_if_t<__has_input_iterator_category<_InputIter>::value> >
+ _LIBCPP_HIDE_FROM_ABI
+ priority_queue(_InputIter __f,
+ _InputIter __l,
+ const _Alloc& __a,
+ __enable_if_t<uses_allocator<container_type, _Alloc>::value>* = 0);
+
+ template <class _InputIter, class _Alloc, class = __enable_if_t<__has_input_iterator_category<_InputIter>::value> >
+ _LIBCPP_HIDE_FROM_ABI priority_queue(
+ _InputIter __f,
+ _InputIter __l,
+ const value_compare& __comp,
+ const _Alloc& __a,
+ __enable_if_t<uses_allocator<container_type, _Alloc>::value>* = 0);
+
+ template <class _InputIter, class _Alloc, class = __enable_if_t<__has_input_iterator_category<_InputIter>::value> >
+ _LIBCPP_HIDE_FROM_ABI priority_queue(
+ _InputIter __f,
+ _InputIter __l,
+ const value_compare& __comp,
+ const container_type& __c,
+ const _Alloc& __a,
+ __enable_if_t<uses_allocator<container_type, _Alloc>::value>* = 0);
#ifndef _LIBCPP_CXX03_LANG
- template <class _InputIter, class _Alloc, class = __enable_if_t<__has_input_iterator_category<_InputIter>::value> >
- _LIBCPP_HIDE_FROM_ABI
- priority_queue(_InputIter __f, _InputIter __l,
- const value_compare& __comp, container_type&& __c, const _Alloc& __a,
- __enable_if_t<uses_allocator<container_type, _Alloc>::value>* = 0);
-#endif // _LIBCPP_CXX03_LANG
+ template <class _InputIter, class _Alloc, class = __enable_if_t<__has_input_iterator_category<_InputIter>::value> >
+ _LIBCPP_HIDE_FROM_ABI priority_queue(
+ _InputIter __f,
+ _InputIter __l,
+ const value_compare& __comp,
+ container_type&& __c,
+ const _Alloc& __a,
+ __enable_if_t<uses_allocator<container_type, _Alloc>::value>* = 0);
+#endif // _LIBCPP_CXX03_LANG
#if _LIBCPP_STD_VER >= 23
- template <_ContainerCompatibleRange<_Tp> _Range,
- class _Alloc,
- class = enable_if_t<uses_allocator<_Container, _Alloc>::value>>
- _LIBCPP_HIDE_FROM_ABI
- priority_queue(from_range_t, _Range&& __range, const value_compare& __comp, const _Alloc& __a)
- : c(from_range, std::forward<_Range>(__range), __a),
- comp(__comp) {
- std::make_heap(c.begin(), c.end(), comp);
- }
+ template <_ContainerCompatibleRange<_Tp> _Range,
+ class _Alloc,
+ class = enable_if_t<uses_allocator<_Container, _Alloc>::value>>
+ _LIBCPP_HIDE_FROM_ABI priority_queue(from_range_t, _Range&& __range, const value_compare& __comp, const _Alloc& __a)
+ : c(from_range, std::forward<_Range>(__range), __a), comp(__comp) {
+ std::make_heap(c.begin(), c.end(), comp);
+ }
- template <_ContainerCompatibleRange<_Tp> _Range,
- class _Alloc,
- class = enable_if_t<uses_allocator<_Container, _Alloc>::value>>
- _LIBCPP_HIDE_FROM_ABI
- priority_queue(from_range_t, _Range&& __range, const _Alloc& __a)
- : c(from_range, std::forward<_Range>(__range), __a),
- comp() {
- std::make_heap(c.begin(), c.end(), comp);
- }
+ template <_ContainerCompatibleRange<_Tp> _Range,
+ class _Alloc,
+ class = enable_if_t<uses_allocator<_Container, _Alloc>::value>>
+ _LIBCPP_HIDE_FROM_ABI priority_queue(from_range_t, _Range&& __range, const _Alloc& __a)
+ : c(from_range, std::forward<_Range>(__range), __a), comp() {
+ std::make_heap(c.begin(), c.end(), comp);
+ }
#endif
- _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_HIDE_FROM_ABI
- bool empty() const {return c.empty();}
- _LIBCPP_HIDE_FROM_ABI
- size_type size() const {return c.size();}
- _LIBCPP_HIDE_FROM_ABI
- const_reference top() const {return c.front();}
+ _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_HIDE_FROM_ABI bool empty() const { return c.empty(); }
+ _LIBCPP_HIDE_FROM_ABI size_type size() const { return c.size(); }
+ _LIBCPP_HIDE_FROM_ABI const_reference top() const { return c.front(); }
- _LIBCPP_HIDE_FROM_ABI
- void push(const value_type& __v);
+ _LIBCPP_HIDE_FROM_ABI void push(const value_type& __v);
#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI
- void push(value_type&& __v);
-
-#if _LIBCPP_STD_VER >= 23
- template <_ContainerCompatibleRange<_Tp> _Range>
- _LIBCPP_HIDE_FROM_ABI
- void push_range(_Range&& __range) {
- if constexpr (requires (container_type& __c) {
- __c.append_range(std::forward<_Range>(__range));
- }) {
- c.append_range(std::forward<_Range>(__range));
- } else {
- ranges::copy(std::forward<_Range>(__range), std::back_inserter(c));
- }
-
- std::make_heap(c.begin(), c.end(), comp);
+ _LIBCPP_HIDE_FROM_ABI void push(value_type&& __v);
+
+# if _LIBCPP_STD_VER >= 23
+ template <_ContainerCompatibleRange<_Tp> _Range>
+ _LIBCPP_HIDE_FROM_ABI void push_range(_Range&& __range) {
+ if constexpr (requires(container_type& __c) { __c.append_range(std::forward<_Range>(__range)); }) {
+ c.append_range(std::forward<_Range>(__range));
+ } else {
+ ranges::copy(std::forward<_Range>(__range), std::back_inserter(c));
}
-#endif
- template <class... _Args>
- _LIBCPP_HIDE_FROM_ABI
- void emplace(_Args&&... __args);
+ std::make_heap(c.begin(), c.end(), comp);
+ }
+# endif
+
+ template <class... _Args>
+ _LIBCPP_HIDE_FROM_ABI void emplace(_Args&&... __args);
#endif // _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI
- void pop();
+ _LIBCPP_HIDE_FROM_ABI void pop();
- _LIBCPP_HIDE_FROM_ABI
- void swap(priority_queue& __q)
- _NOEXCEPT_(__is_nothrow_swappable<container_type>::value &&
- __is_nothrow_swappable<value_compare>::value);
+ _LIBCPP_HIDE_FROM_ABI void swap(priority_queue& __q)
+ _NOEXCEPT_(__is_nothrow_swappable<container_type>::value&& __is_nothrow_swappable<value_compare>::value);
- _LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI const _Container& __get_container() const { return c; }
+ _LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI const _Container& __get_container() const { return c; }
};
#if _LIBCPP_STD_VER >= 17
template <class _Compare,
class _Container,
class = enable_if_t<!__is_allocator<_Compare>::value>,
- class = enable_if_t<!__is_allocator<_Container>::value>
->
-priority_queue(_Compare, _Container)
- -> priority_queue<typename _Container::value_type, _Container, _Compare>;
+ class = enable_if_t<!__is_allocator<_Container>::value> >
+priority_queue(_Compare, _Container) -> priority_queue<typename _Container::value_type, _Container, _Compare>;
-template<class _InputIterator,
- class _Compare = less<__iter_value_type<_InputIterator>>,
- class _Container = vector<__iter_value_type<_InputIterator>>,
- class = enable_if_t<__has_input_iterator_category<_InputIterator>::value>,
- class = enable_if_t<!__is_allocator<_Compare>::value>,
- class = enable_if_t<!__is_allocator<_Container>::value>
->
+template <class _InputIterator,
+ class _Compare = less<__iter_value_type<_InputIterator>>,
+ class _Container = vector<__iter_value_type<_InputIterator>>,
+ class = enable_if_t<__has_input_iterator_category<_InputIterator>::value>,
+ class = enable_if_t<!__is_allocator<_Compare>::value>,
+ class = enable_if_t<!__is_allocator<_Container>::value> >
priority_queue(_InputIterator, _InputIterator, _Compare = _Compare(), _Container = _Container())
-> priority_queue<__iter_value_type<_InputIterator>, _Container, _Compare>;
-template<class _Compare,
- class _Container,
- class _Alloc,
- class = enable_if_t<!__is_allocator<_Compare>::value>,
- class = enable_if_t<!__is_allocator<_Container>::value>,
- class = enable_if_t<uses_allocator<_Container, _Alloc>::value>
->
-priority_queue(_Compare, _Container, _Alloc)
- -> priority_queue<typename _Container::value_type, _Container, _Compare>;
+template <class _Compare,
+ class _Container,
+ class _Alloc,
+ class = enable_if_t<!__is_allocator<_Compare>::value>,
+ class = enable_if_t<!__is_allocator<_Container>::value>,
+ class = enable_if_t<uses_allocator<_Container, _Alloc>::value> >
+priority_queue(_Compare, _Container, _Alloc) -> priority_queue<typename _Container::value_type, _Container, _Compare>;
-template<class _InputIterator, class _Allocator,
- class = enable_if_t<__has_input_iterator_category<_InputIterator>::value>,
- class = enable_if_t<__is_allocator<_Allocator>::value>
->
+template <class _InputIterator,
+ class _Allocator,
+ class = enable_if_t<__has_input_iterator_category<_InputIterator>::value>,
+ class = enable_if_t<__is_allocator<_Allocator>::value> >
priority_queue(_InputIterator, _InputIterator, _Allocator)
-> priority_queue<__iter_value_type<_InputIterator>,
vector<__iter_value_type<_InputIterator>, _Allocator>,
less<__iter_value_type<_InputIterator>>>;
-template<class _InputIterator, class _Compare, class _Allocator,
- class = enable_if_t<__has_input_iterator_category<_InputIterator>::value>,
- class = enable_if_t<!__is_allocator<_Compare>::value>,
- class = enable_if_t<__is_allocator<_Allocator>::value>
->
+template <class _InputIterator,
+ class _Compare,
+ class _Allocator,
+ class = enable_if_t<__has_input_iterator_category<_InputIterator>::value>,
+ class = enable_if_t<!__is_allocator<_Compare>::value>,
+ class = enable_if_t<__is_allocator<_Allocator>::value> >
priority_queue(_InputIterator, _InputIterator, _Compare, _Allocator)
-> priority_queue<__iter_value_type<_InputIterator>,
- vector<__iter_value_type<_InputIterator>, _Allocator>, _Compare>;
-
-template<class _InputIterator, class _Compare, class _Container, class _Alloc,
- class = enable_if_t<__has_input_iterator_category<_InputIterator>::value>,
- class = enable_if_t<!__is_allocator<_Compare>::value>,
- class = enable_if_t<!__is_allocator<_Container>::value>,
- class = enable_if_t<uses_allocator<_Container, _Alloc>::value>
->
+ vector<__iter_value_type<_InputIterator>, _Allocator>,
+ _Compare>;
+
+template <class _InputIterator,
+ class _Compare,
+ class _Container,
+ class _Alloc,
+ class = enable_if_t<__has_input_iterator_category<_InputIterator>::value>,
+ class = enable_if_t<!__is_allocator<_Compare>::value>,
+ class = enable_if_t<!__is_allocator<_Container>::value>,
+ class = enable_if_t<uses_allocator<_Container, _Alloc>::value> >
priority_queue(_InputIterator, _InputIterator, _Compare, _Container, _Alloc)
-> priority_queue<typename _Container::value_type, _Container, _Compare>;
#endif
@@ -842,7 +754,7 @@ priority_queue(_InputIterator, _InputIterator, _Compare, _Container, _Alloc)
template <ranges::input_range _Range,
class _Compare = less<ranges::range_value_t<_Range>>,
- class = enable_if_t<!__is_allocator<_Compare>::value>>
+ class = enable_if_t<!__is_allocator<_Compare>::value>>
priority_queue(from_range_t, _Range&&, _Compare = _Compare())
-> priority_queue<ranges::range_value_t<_Range>, vector<ranges::range_value_t<_Range>>, _Compare>;
@@ -852,278 +764,210 @@ template <ranges::input_range _Range,
class = enable_if_t<!__is_allocator<_Compare>::value>,
class = enable_if_t<__is_allocator<_Alloc>::value>>
priority_queue(from_range_t, _Range&&, _Compare, _Alloc)
- -> priority_queue<ranges::range_value_t<_Range>, vector<ranges::range_value_t<_Range>, _Alloc>,
- _Compare>;
+ -> priority_queue<ranges::range_value_t<_Range>, vector<ranges::range_value_t<_Range>, _Alloc>, _Compare>;
-template <ranges::input_range _Range,
- class _Alloc,
- class = enable_if_t<__is_allocator<_Alloc>::value>>
+template <ranges::input_range _Range, class _Alloc, class = enable_if_t<__is_allocator<_Alloc>::value>>
priority_queue(from_range_t, _Range&&, _Alloc)
-> priority_queue<ranges::range_value_t<_Range>, vector<ranges::range_value_t<_Range>, _Alloc>>;
#endif
template <class _Tp, class _Container, class _Compare>
-inline
-priority_queue<_Tp, _Container, _Compare>::priority_queue(const _Compare& __comp,
- const container_type& __c)
- : c(__c),
- comp(__comp)
-{
- std::make_heap(c.begin(), c.end(), comp);
+inline priority_queue<_Tp, _Container, _Compare>::priority_queue(const _Compare& __comp, const container_type& __c)
+ : c(__c), comp(__comp) {
+ std::make_heap(c.begin(), c.end(), comp);
}
#ifndef _LIBCPP_CXX03_LANG
template <class _Tp, class _Container, class _Compare>
-inline
-priority_queue<_Tp, _Container, _Compare>::priority_queue(const value_compare& __comp,
- container_type&& __c)
- : c(std::move(__c)),
- comp(__comp)
-{
- std::make_heap(c.begin(), c.end(), comp);
+inline priority_queue<_Tp, _Container, _Compare>::priority_queue(const value_compare& __comp, container_type&& __c)
+ : c(std::move(__c)), comp(__comp) {
+ std::make_heap(c.begin(), c.end(), comp);
}
#endif // _LIBCPP_CXX03_LANG
template <class _Tp, class _Container, class _Compare>
template <class _InputIter, class>
-inline
-priority_queue<_Tp, _Container, _Compare>::priority_queue(_InputIter __f, _InputIter __l,
- const value_compare& __comp)
- : c(__f, __l),
- comp(__comp)
-{
- std::make_heap(c.begin(), c.end(), comp);
+inline priority_queue<_Tp, _Container, _Compare>::priority_queue(
+ _InputIter __f, _InputIter __l, const value_compare& __comp)
+ : c(__f, __l), comp(__comp) {
+ std::make_heap(c.begin(), c.end(), comp);
}
template <class _Tp, class _Container, class _Compare>
template <class _InputIter, class>
-inline
-priority_queue<_Tp, _Container, _Compare>::priority_queue(_InputIter __f, _InputIter __l,
- const value_compare& __comp,
- const container_type& __c)
- : c(__c),
- comp(__comp)
-{
- c.insert(c.end(), __f, __l);
- std::make_heap(c.begin(), c.end(), comp);
+inline priority_queue<_Tp, _Container, _Compare>::priority_queue(
+ _InputIter __f, _InputIter __l, const value_compare& __comp, const container_type& __c)
+ : c(__c), comp(__comp) {
+ c.insert(c.end(), __f, __l);
+ std::make_heap(c.begin(), c.end(), comp);
}
#ifndef _LIBCPP_CXX03_LANG
template <class _Tp, class _Container, class _Compare>
template <class _InputIter, class>
-inline
-priority_queue<_Tp, _Container, _Compare>::priority_queue(_InputIter __f, _InputIter __l,
- const value_compare& __comp,
- container_type&& __c)
- : c(std::move(__c)),
- comp(__comp)
-{
- c.insert(c.end(), __f, __l);
- std::make_heap(c.begin(), c.end(), comp);
+inline priority_queue<_Tp, _Container, _Compare>::priority_queue(
+ _InputIter __f, _InputIter __l, const value_compare& __comp, container_type&& __c)
+ : c(std::move(__c)), comp(__comp) {
+ c.insert(c.end(), __f, __l);
+ std::make_heap(c.begin(), c.end(), comp);
}
#endif // _LIBCPP_CXX03_LANG
template <class _Tp, class _Container, class _Compare>
template <class _Alloc>
-inline
-priority_queue<_Tp, _Container, _Compare>::priority_queue(const _Alloc& __a,
- __enable_if_t<uses_allocator<container_type, _Alloc>::value>*)
- : c(__a)
-{
-}
+inline priority_queue<_Tp, _Container, _Compare>::priority_queue(
+ const _Alloc& __a, __enable_if_t<uses_allocator<container_type, _Alloc>::value>*)
+ : c(__a) {}
template <class _Tp, class _Container, class _Compare>
template <class _Alloc>
-inline
-priority_queue<_Tp, _Container, _Compare>::priority_queue(const value_compare& __comp,
- const _Alloc& __a,
- __enable_if_t<uses_allocator<container_type, _Alloc>::value>*)
- : c(__a),
- comp(__comp)
-{
-}
+inline priority_queue<_Tp, _Container, _Compare>::priority_queue(
+ const value_compare& __comp, const _Alloc& __a, __enable_if_t<uses_allocator<container_type, _Alloc>::value>*)
+ : c(__a), comp(__comp) {}
template <class _Tp, class _Container, class _Compare>
template <class _Alloc>
-inline
-priority_queue<_Tp, _Container, _Compare>::priority_queue(const value_compare& __comp,
- const container_type& __c,
- const _Alloc& __a,
- __enable_if_t<uses_allocator<container_type, _Alloc>::value>*)
- : c(__c, __a),
- comp(__comp)
-{
- std::make_heap(c.begin(), c.end(), comp);
+inline priority_queue<_Tp, _Container, _Compare>::priority_queue(
+ const value_compare& __comp,
+ const container_type& __c,
+ const _Alloc& __a,
+ __enable_if_t<uses_allocator<container_type, _Alloc>::value>*)
+ : c(__c, __a), comp(__comp) {
+ std::make_heap(c.begin(), c.end(), comp);
}
template <class _Tp, class _Container, class _Compare>
template <class _Alloc>
-inline
-priority_queue<_Tp, _Container, _Compare>::priority_queue(const priority_queue& __q,
- const _Alloc& __a,
- __enable_if_t<uses_allocator<container_type, _Alloc>::value>*)
- : c(__q.c, __a),
- comp(__q.comp)
-{
-}
+inline priority_queue<_Tp, _Container, _Compare>::priority_queue(
+ const priority_queue& __q, const _Alloc& __a, __enable_if_t<uses_allocator<container_type, _Alloc>::value>*)
+ : c(__q.c, __a), comp(__q.comp) {}
#ifndef _LIBCPP_CXX03_LANG
template <class _Tp, class _Container, class _Compare>
template <class _Alloc>
-inline
-priority_queue<_Tp, _Container, _Compare>::priority_queue(const value_compare& __comp,
- container_type&& __c,
- const _Alloc& __a,
- __enable_if_t<uses_allocator<container_type, _Alloc>::value>*)
- : c(std::move(__c), __a),
- comp(__comp)
-{
- std::make_heap(c.begin(), c.end(), comp);
+inline priority_queue<_Tp, _Container, _Compare>::priority_queue(
+ const value_compare& __comp,
+ container_type&& __c,
+ const _Alloc& __a,
+ __enable_if_t<uses_allocator<container_type, _Alloc>::value>*)
+ : c(std::move(__c), __a), comp(__comp) {
+ std::make_heap(c.begin(), c.end(), comp);
}
template <class _Tp, class _Container, class _Compare>
template <class _Alloc>
-inline
-priority_queue<_Tp, _Container, _Compare>::priority_queue(priority_queue&& __q,
- const _Alloc& __a,
- __enable_if_t<uses_allocator<container_type, _Alloc>::value>*)
- : c(std::move(__q.c), __a),
- comp(std::move(__q.comp))
-{
-}
+inline priority_queue<_Tp, _Container, _Compare>::priority_queue(
+ priority_queue&& __q, const _Alloc& __a, __enable_if_t<uses_allocator<container_type, _Alloc>::value>*)
+ : c(std::move(__q.c), __a), comp(std::move(__q.comp)) {}
-#endif // _LIBCPP_CXX03_LANG
+#endif // _LIBCPP_CXX03_LANG
template <class _Tp, class _Container, class _Compare>
template <class _InputIter, class _Alloc, class>
-inline
-priority_queue<_Tp, _Container, _Compare>::priority_queue(
- _InputIter __f, _InputIter __l, const _Alloc& __a,
- __enable_if_t<uses_allocator<container_type, _Alloc>::value>*)
- : c(__f, __l, __a),
- comp()
-{
- std::make_heap(c.begin(), c.end(), comp);
+inline priority_queue<_Tp, _Container, _Compare>::priority_queue(
+ _InputIter __f, _InputIter __l, const _Alloc& __a, __enable_if_t<uses_allocator<container_type, _Alloc>::value>*)
+ : c(__f, __l, __a), comp() {
+ std::make_heap(c.begin(), c.end(), comp);
}
template <class _Tp, class _Container, class _Compare>
template <class _InputIter, class _Alloc, class>
-inline
-priority_queue<_Tp, _Container, _Compare>::priority_queue(
- _InputIter __f, _InputIter __l,
- const value_compare& __comp, const _Alloc& __a,
- __enable_if_t<uses_allocator<container_type, _Alloc>::value>*)
- : c(__f, __l, __a),
- comp(__comp)
-{
- std::make_heap(c.begin(), c.end(), comp);
+inline priority_queue<_Tp, _Container, _Compare>::priority_queue(
+ _InputIter __f,
+ _InputIter __l,
+ const value_compare& __comp,
+ const _Alloc& __a,
+ __enable_if_t<uses_allocator<container_type, _Alloc>::value>*)
+ : c(__f, __l, __a), comp(__comp) {
+ std::make_heap(c.begin(), c.end(), comp);
}
template <class _Tp, class _Container, class _Compare>
template <class _InputIter, class _Alloc, class>
-inline
-priority_queue<_Tp, _Container, _Compare>::priority_queue(
- _InputIter __f, _InputIter __l,
- const value_compare& __comp, const container_type& __c, const _Alloc& __a,
- __enable_if_t<uses_allocator<container_type, _Alloc>::value>*)
- : c(__c, __a),
- comp(__comp)
-{
- c.insert(c.end(), __f, __l);
- std::make_heap(c.begin(), c.end(), comp);
+inline priority_queue<_Tp, _Container, _Compare>::priority_queue(
+ _InputIter __f,
+ _InputIter __l,
+ const value_compare& __comp,
+ const container_type& __c,
+ const _Alloc& __a,
+ __enable_if_t<uses_allocator<container_type, _Alloc>::value>*)
+ : c(__c, __a), comp(__comp) {
+ c.insert(c.end(), __f, __l);
+ std::make_heap(c.begin(), c.end(), comp);
}
#ifndef _LIBCPP_CXX03_LANG
template <class _Tp, class _Container, class _Compare>
template <class _InputIter, class _Alloc, class>
-inline
-priority_queue<_Tp, _Container, _Compare>::priority_queue(
- _InputIter __f, _InputIter __l, const value_compare& __comp,
- container_type&& __c, const _Alloc& __a,
- __enable_if_t<uses_allocator<container_type, _Alloc>::value>*)
- : c(std::move(__c), __a),
- comp(__comp)
-{
- c.insert(c.end(), __f, __l);
- std::make_heap(c.begin(), c.end(), comp);
+inline priority_queue<_Tp, _Container, _Compare>::priority_queue(
+ _InputIter __f,
+ _InputIter __l,
+ const value_compare& __comp,
+ container_type&& __c,
+ const _Alloc& __a,
+ __enable_if_t<uses_allocator<container_type, _Alloc>::value>*)
+ : c(std::move(__c), __a), comp(__comp) {
+ c.insert(c.end(), __f, __l);
+ std::make_heap(c.begin(), c.end(), comp);
}
-#endif // _LIBCPP_CXX03_LANG
+#endif // _LIBCPP_CXX03_LANG
template <class _Tp, class _Container, class _Compare>
-inline
-void
-priority_queue<_Tp, _Container, _Compare>::push(const value_type& __v)
-{
- c.push_back(__v);
- std::push_heap(c.begin(), c.end(), comp);
+inline void priority_queue<_Tp, _Container, _Compare>::push(const value_type& __v) {
+ c.push_back(__v);
+ std::push_heap(c.begin(), c.end(), comp);
}
#ifndef _LIBCPP_CXX03_LANG
template <class _Tp, class _Container, class _Compare>
-inline
-void
-priority_queue<_Tp, _Container, _Compare>::push(value_type&& __v)
-{
- c.push_back(std::move(__v));
- std::push_heap(c.begin(), c.end(), comp);
+inline void priority_queue<_Tp, _Container, _Compare>::push(value_type&& __v) {
+ c.push_back(std::move(__v));
+ std::push_heap(c.begin(), c.end(), comp);
}
template <class _Tp, class _Container, class _Compare>
template <class... _Args>
-inline
-void
-priority_queue<_Tp, _Container, _Compare>::emplace(_Args&&... __args)
-{
- c.emplace_back(std::forward<_Args>(__args)...);
- std::push_heap(c.begin(), c.end(), comp);
+inline void priority_queue<_Tp, _Container, _Compare>::emplace(_Args&&... __args) {
+ c.emplace_back(std::forward<_Args>(__args)...);
+ std::push_heap(c.begin(), c.end(), comp);
}
#endif // _LIBCPP_CXX03_LANG
template <class _Tp, class _Container, class _Compare>
-inline
-void
-priority_queue<_Tp, _Container, _Compare>::pop()
-{
- std::pop_heap(c.begin(), c.end(), comp);
- c.pop_back();
+inline void priority_queue<_Tp, _Container, _Compare>::pop() {
+ std::pop_heap(c.begin(), c.end(), comp);
+ c.pop_back();
}
template <class _Tp, class _Container, class _Compare>
-inline
-void
-priority_queue<_Tp, _Container, _Compare>::swap(priority_queue& __q)
- _NOEXCEPT_(__is_nothrow_swappable<container_type>::value &&
- __is_nothrow_swappable<value_compare>::value)
-{
- using std::swap;
- swap(c, __q.c);
- swap(comp, __q.comp);
+inline void priority_queue<_Tp, _Container, _Compare>::swap(priority_queue& __q)
+ _NOEXCEPT_(__is_nothrow_swappable<container_type>::value&& __is_nothrow_swappable<value_compare>::value) {
+ using std::swap;
+ swap(c, __q.c);
+ swap(comp, __q.comp);
}
-template <class _Tp, class _Container, class _Compare,
+template <class _Tp,
+ class _Container,
+ class _Compare,
__enable_if_t<__is_swappable<_Container>::value && __is_swappable<_Compare>::value, int> = 0>
-inline _LIBCPP_HIDE_FROM_ABI
-void
-swap(priority_queue<_Tp, _Container, _Compare>& __x,
- priority_queue<_Tp, _Container, _Compare>& __y)
- _NOEXCEPT_(_NOEXCEPT_(__x.swap(__y)))
-{
- __x.swap(__y);
+inline _LIBCPP_HIDE_FROM_ABI void
+swap(priority_queue<_Tp, _Container, _Compare>& __x, priority_queue<_Tp, _Container, _Compare>& __y)
+ _NOEXCEPT_(_NOEXCEPT_(__x.swap(__y))) {
+ __x.swap(__y);
}
template <class _Tp, class _Container, class _Compare, class _Alloc>
struct _LIBCPP_TEMPLATE_VIS uses_allocator<priority_queue<_Tp, _Container, _Compare>, _Alloc>
- : public uses_allocator<_Container, _Alloc>
-{
-};
+ : public uses_allocator<_Container, _Alloc> {};
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/ranges b/contrib/llvm-project/libcxx/include/ranges
index f71a92f8a660..660d533b2a78 100644
--- a/contrib/llvm-project/libcxx/include/ranges
+++ b/contrib/llvm-project/libcxx/include/ranges
@@ -417,7 +417,7 @@ namespace std {
#include <version>
#if !defined(_LIBCPP_HAS_NO_LOCALIZATION)
-#include <__ranges/istream_view.h>
+# include <__ranges/istream_view.h>
#endif
// standard-mandated includes
diff --git a/contrib/llvm-project/libcxx/include/ratio b/contrib/llvm-project/libcxx/include/ratio
index c9637ab818cd..3b11a2aa5bf6 100644
--- a/contrib/llvm-project/libcxx/include/ratio
+++ b/contrib/llvm-project/libcxx/include/ratio
@@ -95,176 +95,164 @@ using quetta = ratio <1'000'000'000'000'000'000'000'000'000'000, 1>; // Since C+
_LIBCPP_PUSH_MACROS
#include <__undef_macros>
-
_LIBCPP_BEGIN_NAMESPACE_STD
// __static_gcd
template <intmax_t _Xp, intmax_t _Yp>
-struct __static_gcd
-{
- static const intmax_t value = __static_gcd<_Yp, _Xp % _Yp>::value;
+struct __static_gcd {
+ static const intmax_t value = __static_gcd<_Yp, _Xp % _Yp>::value;
};
template <intmax_t _Xp>
-struct __static_gcd<_Xp, 0>
-{
- static const intmax_t value = _Xp;
+struct __static_gcd<_Xp, 0> {
+ static const intmax_t value = _Xp;
};
template <>
-struct __static_gcd<0, 0>
-{
- static const intmax_t value = 1;
+struct __static_gcd<0, 0> {
+ static const intmax_t value = 1;
};
// __static_lcm
template <intmax_t _Xp, intmax_t _Yp>
-struct __static_lcm
-{
- static const intmax_t value = _Xp / __static_gcd<_Xp, _Yp>::value * _Yp;
+struct __static_lcm {
+ static const intmax_t value = _Xp / __static_gcd<_Xp, _Yp>::value * _Yp;
};
template <intmax_t _Xp>
-struct __static_abs
-{
- static const intmax_t value = _Xp < 0 ? -_Xp : _Xp;
+struct __static_abs {
+ static const intmax_t value = _Xp < 0 ? -_Xp : _Xp;
};
template <intmax_t _Xp>
-struct __static_sign
-{
- static const intmax_t value = _Xp == 0 ? 0 : (_Xp < 0 ? -1 : 1);
+struct __static_sign {
+ static const intmax_t value = _Xp == 0 ? 0 : (_Xp < 0 ? -1 : 1);
};
template <intmax_t _Xp, intmax_t _Yp, intmax_t = __static_sign<_Yp>::value>
class __ll_add;
template <intmax_t _Xp, intmax_t _Yp>
-class __ll_add<_Xp, _Yp, 1>
-{
- static const intmax_t min = (1LL << (sizeof(intmax_t) * CHAR_BIT - 1)) + 1;
- static const intmax_t max = -min;
+class __ll_add<_Xp, _Yp, 1> {
+ static const intmax_t min = (1LL << (sizeof(intmax_t) * CHAR_BIT - 1)) + 1;
+ static const intmax_t max = -min;
+
+ static_assert(_Xp <= max - _Yp, "overflow in __ll_add");
- static_assert(_Xp <= max - _Yp, "overflow in __ll_add");
public:
- static const intmax_t value = _Xp + _Yp;
+ static const intmax_t value = _Xp + _Yp;
};
template <intmax_t _Xp, intmax_t _Yp>
-class __ll_add<_Xp, _Yp, 0>
-{
+class __ll_add<_Xp, _Yp, 0> {
public:
- static const intmax_t value = _Xp;
+ static const intmax_t value = _Xp;
};
template <intmax_t _Xp, intmax_t _Yp>
-class __ll_add<_Xp, _Yp, -1>
-{
- static const intmax_t min = (1LL << (sizeof(intmax_t) * CHAR_BIT - 1)) + 1;
- static const intmax_t max = -min;
+class __ll_add<_Xp, _Yp, -1> {
+ static const intmax_t min = (1LL << (sizeof(intmax_t) * CHAR_BIT - 1)) + 1;
+ static const intmax_t max = -min;
+
+ static_assert(min - _Yp <= _Xp, "overflow in __ll_add");
- static_assert(min - _Yp <= _Xp, "overflow in __ll_add");
public:
- static const intmax_t value = _Xp + _Yp;
+ static const intmax_t value = _Xp + _Yp;
};
template <intmax_t _Xp, intmax_t _Yp, intmax_t = __static_sign<_Yp>::value>
class __ll_sub;
template <intmax_t _Xp, intmax_t _Yp>
-class __ll_sub<_Xp, _Yp, 1>
-{
- static const intmax_t min = (1LL << (sizeof(intmax_t) * CHAR_BIT - 1)) + 1;
- static const intmax_t max = -min;
+class __ll_sub<_Xp, _Yp, 1> {
+ static const intmax_t min = (1LL << (sizeof(intmax_t) * CHAR_BIT - 1)) + 1;
+ static const intmax_t max = -min;
+
+ static_assert(min + _Yp <= _Xp, "overflow in __ll_sub");
- static_assert(min + _Yp <= _Xp, "overflow in __ll_sub");
public:
- static const intmax_t value = _Xp - _Yp;
+ static const intmax_t value = _Xp - _Yp;
};
template <intmax_t _Xp, intmax_t _Yp>
-class __ll_sub<_Xp, _Yp, 0>
-{
+class __ll_sub<_Xp, _Yp, 0> {
public:
- static const intmax_t value = _Xp;
+ static const intmax_t value = _Xp;
};
template <intmax_t _Xp, intmax_t _Yp>
-class __ll_sub<_Xp, _Yp, -1>
-{
- static const intmax_t min = (1LL << (sizeof(intmax_t) * CHAR_BIT - 1)) + 1;
- static const intmax_t max = -min;
+class __ll_sub<_Xp, _Yp, -1> {
+ static const intmax_t min = (1LL << (sizeof(intmax_t) * CHAR_BIT - 1)) + 1;
+ static const intmax_t max = -min;
+
+ static_assert(_Xp <= max + _Yp, "overflow in __ll_sub");
- static_assert(_Xp <= max + _Yp, "overflow in __ll_sub");
public:
- static const intmax_t value = _Xp - _Yp;
+ static const intmax_t value = _Xp - _Yp;
};
template <intmax_t _Xp, intmax_t _Yp>
-class __ll_mul
-{
- static const intmax_t nan = (1LL << (sizeof(intmax_t) * CHAR_BIT - 1));
- static const intmax_t min = nan + 1;
- static const intmax_t max = -min;
- static const intmax_t __a_x = __static_abs<_Xp>::value;
- static const intmax_t __a_y = __static_abs<_Yp>::value;
+class __ll_mul {
+ static const intmax_t nan = (1LL << (sizeof(intmax_t) * CHAR_BIT - 1));
+ static const intmax_t min = nan + 1;
+ static const intmax_t max = -min;
+ static const intmax_t __a_x = __static_abs<_Xp>::value;
+ static const intmax_t __a_y = __static_abs<_Yp>::value;
+
+ static_assert(_Xp != nan && _Yp != nan && __a_x <= max / __a_y, "overflow in __ll_mul");
- static_assert(_Xp != nan && _Yp != nan && __a_x <= max / __a_y, "overflow in __ll_mul");
public:
- static const intmax_t value = _Xp * _Yp;
+ static const intmax_t value = _Xp * _Yp;
};
template <intmax_t _Yp>
-class __ll_mul<0, _Yp>
-{
+class __ll_mul<0, _Yp> {
public:
- static const intmax_t value = 0;
+ static const intmax_t value = 0;
};
template <intmax_t _Xp>
-class __ll_mul<_Xp, 0>
-{
+class __ll_mul<_Xp, 0> {
public:
- static const intmax_t value = 0;
+ static const intmax_t value = 0;
};
template <>
-class __ll_mul<0, 0>
-{
+class __ll_mul<0, 0> {
public:
- static const intmax_t value = 0;
+ static const intmax_t value = 0;
};
// Not actually used but left here in case needed in future maintenance
template <intmax_t _Xp, intmax_t _Yp>
-class __ll_div
-{
- static const intmax_t nan = (1LL << (sizeof(intmax_t) * CHAR_BIT - 1));
- static const intmax_t min = nan + 1;
- static const intmax_t max = -min;
+class __ll_div {
+ static const intmax_t nan = (1LL << (sizeof(intmax_t) * CHAR_BIT - 1));
+ static const intmax_t min = nan + 1;
+ static const intmax_t max = -min;
+
+ static_assert(_Xp != nan && _Yp != nan && _Yp != 0, "overflow in __ll_div");
- static_assert(_Xp != nan && _Yp != nan && _Yp != 0, "overflow in __ll_div");
public:
- static const intmax_t value = _Xp / _Yp;
+ static const intmax_t value = _Xp / _Yp;
};
template <intmax_t _Num, intmax_t _Den = 1>
-class _LIBCPP_TEMPLATE_VIS ratio
-{
- static_assert(__static_abs<_Num>::value >= 0, "ratio numerator is out of range");
- static_assert(_Den != 0, "ratio divide by 0");
- static_assert(__static_abs<_Den>::value > 0, "ratio denominator is out of range");
- static _LIBCPP_CONSTEXPR const intmax_t __na = __static_abs<_Num>::value;
- static _LIBCPP_CONSTEXPR const intmax_t __da = __static_abs<_Den>::value;
- static _LIBCPP_CONSTEXPR const intmax_t __s = __static_sign<_Num>::value * __static_sign<_Den>::value;
- static _LIBCPP_CONSTEXPR const intmax_t __gcd = __static_gcd<__na, __da>::value;
+class _LIBCPP_TEMPLATE_VIS ratio {
+ static_assert(__static_abs<_Num>::value >= 0, "ratio numerator is out of range");
+ static_assert(_Den != 0, "ratio divide by 0");
+ static_assert(__static_abs<_Den>::value > 0, "ratio denominator is out of range");
+ static _LIBCPP_CONSTEXPR const intmax_t __na = __static_abs<_Num>::value;
+ static _LIBCPP_CONSTEXPR const intmax_t __da = __static_abs<_Den>::value;
+ static _LIBCPP_CONSTEXPR const intmax_t __s = __static_sign<_Num>::value * __static_sign<_Den>::value;
+ static _LIBCPP_CONSTEXPR const intmax_t __gcd = __static_gcd<__na, __da>::value;
+
public:
- static _LIBCPP_CONSTEXPR const intmax_t num = __s * __na / __gcd;
- static _LIBCPP_CONSTEXPR const intmax_t den = __da / __gcd;
+ static _LIBCPP_CONSTEXPR const intmax_t num = __s * __na / __gcd;
+ static _LIBCPP_CONSTEXPR const intmax_t den = __da / __gcd;
- typedef ratio<num, den> type;
+ typedef ratio<num, den> type;
};
template <intmax_t _Num, intmax_t _Den>
@@ -273,236 +261,200 @@ _LIBCPP_CONSTEXPR const intmax_t ratio<_Num, _Den>::num;
template <intmax_t _Num, intmax_t _Den>
_LIBCPP_CONSTEXPR const intmax_t ratio<_Num, _Den>::den;
-template <class _Tp> struct __is_ratio : false_type {};
-template <intmax_t _Num, intmax_t _Den> struct __is_ratio<ratio<_Num, _Den> > : true_type {};
+template <class _Tp>
+struct __is_ratio : false_type {};
+template <intmax_t _Num, intmax_t _Den>
+struct __is_ratio<ratio<_Num, _Den> > : true_type {};
typedef ratio<1LL, 1000000000000000000LL> atto;
-typedef ratio<1LL, 1000000000000000LL> femto;
-typedef ratio<1LL, 1000000000000LL> pico;
-typedef ratio<1LL, 1000000000LL> nano;
-typedef ratio<1LL, 1000000LL> micro;
-typedef ratio<1LL, 1000LL> milli;
-typedef ratio<1LL, 100LL> centi;
-typedef ratio<1LL, 10LL> deci;
-typedef ratio< 10LL, 1LL> deca;
-typedef ratio< 100LL, 1LL> hecto;
-typedef ratio< 1000LL, 1LL> kilo;
-typedef ratio< 1000000LL, 1LL> mega;
-typedef ratio< 1000000000LL, 1LL> giga;
-typedef ratio< 1000000000000LL, 1LL> tera;
-typedef ratio< 1000000000000000LL, 1LL> peta;
+typedef ratio<1LL, 1000000000000000LL> femto;
+typedef ratio<1LL, 1000000000000LL> pico;
+typedef ratio<1LL, 1000000000LL> nano;
+typedef ratio<1LL, 1000000LL> micro;
+typedef ratio<1LL, 1000LL> milli;
+typedef ratio<1LL, 100LL> centi;
+typedef ratio<1LL, 10LL> deci;
+typedef ratio< 10LL, 1LL> deca;
+typedef ratio< 100LL, 1LL> hecto;
+typedef ratio< 1000LL, 1LL> kilo;
+typedef ratio< 1000000LL, 1LL> mega;
+typedef ratio< 1000000000LL, 1LL> giga;
+typedef ratio< 1000000000000LL, 1LL> tera;
+typedef ratio< 1000000000000000LL, 1LL> peta;
typedef ratio<1000000000000000000LL, 1LL> exa;
template <class _R1, class _R2>
-struct __ratio_multiply
-{
+struct __ratio_multiply {
private:
- static const intmax_t __gcd_n1_d2 = __static_gcd<_R1::num, _R2::den>::value;
- static const intmax_t __gcd_d1_n2 = __static_gcd<_R1::den, _R2::num>::value;
+ static const intmax_t __gcd_n1_d2 = __static_gcd<_R1::num, _R2::den>::value;
+ static const intmax_t __gcd_d1_n2 = __static_gcd<_R1::den, _R2::num>::value;
+
public:
- typedef typename ratio
- <
- __ll_mul<_R1::num / __gcd_n1_d2, _R2::num / __gcd_d1_n2>::value,
- __ll_mul<_R2::den / __gcd_n1_d2, _R1::den / __gcd_d1_n2>::value
- >::type type;
+ typedef typename ratio< __ll_mul<_R1::num / __gcd_n1_d2, _R2::num / __gcd_d1_n2>::value,
+ __ll_mul<_R2::den / __gcd_n1_d2, _R1::den / __gcd_d1_n2>::value >::type type;
};
#ifndef _LIBCPP_CXX03_LANG
-template <class _R1, class _R2> using ratio_multiply
- = typename __ratio_multiply<_R1, _R2>::type;
+template <class _R1, class _R2>
+using ratio_multiply = typename __ratio_multiply<_R1, _R2>::type;
-#else // _LIBCPP_CXX03_LANG
+#else // _LIBCPP_CXX03_LANG
template <class _R1, class _R2>
-struct _LIBCPP_TEMPLATE_VIS ratio_multiply
- : public __ratio_multiply<_R1, _R2>::type {};
+struct _LIBCPP_TEMPLATE_VIS ratio_multiply : public __ratio_multiply<_R1, _R2>::type {};
#endif // _LIBCPP_CXX03_LANG
template <class _R1, class _R2>
-struct __ratio_divide
-{
+struct __ratio_divide {
private:
- static const intmax_t __gcd_n1_n2 = __static_gcd<_R1::num, _R2::num>::value;
- static const intmax_t __gcd_d1_d2 = __static_gcd<_R1::den, _R2::den>::value;
+ static const intmax_t __gcd_n1_n2 = __static_gcd<_R1::num, _R2::num>::value;
+ static const intmax_t __gcd_d1_d2 = __static_gcd<_R1::den, _R2::den>::value;
+
public:
- typedef typename ratio
- <
- __ll_mul<_R1::num / __gcd_n1_n2, _R2::den / __gcd_d1_d2>::value,
- __ll_mul<_R2::num / __gcd_n1_n2, _R1::den / __gcd_d1_d2>::value
- >::type type;
+ typedef typename ratio< __ll_mul<_R1::num / __gcd_n1_n2, _R2::den / __gcd_d1_d2>::value,
+ __ll_mul<_R2::num / __gcd_n1_n2, _R1::den / __gcd_d1_d2>::value >::type type;
};
#ifndef _LIBCPP_CXX03_LANG
-template <class _R1, class _R2> using ratio_divide
- = typename __ratio_divide<_R1, _R2>::type;
+template <class _R1, class _R2>
+using ratio_divide = typename __ratio_divide<_R1, _R2>::type;
-#else // _LIBCPP_CXX03_LANG
+#else // _LIBCPP_CXX03_LANG
template <class _R1, class _R2>
-struct _LIBCPP_TEMPLATE_VIS ratio_divide
- : public __ratio_divide<_R1, _R2>::type {};
+struct _LIBCPP_TEMPLATE_VIS ratio_divide : public __ratio_divide<_R1, _R2>::type {};
#endif // _LIBCPP_CXX03_LANG
template <class _R1, class _R2>
-struct __ratio_add
-{
+struct __ratio_add {
private:
- static const intmax_t __gcd_n1_n2 = __static_gcd<_R1::num, _R2::num>::value;
- static const intmax_t __gcd_d1_d2 = __static_gcd<_R1::den, _R2::den>::value;
+ static const intmax_t __gcd_n1_n2 = __static_gcd<_R1::num, _R2::num>::value;
+ static const intmax_t __gcd_d1_d2 = __static_gcd<_R1::den, _R2::den>::value;
+
public:
- typedef typename ratio_multiply
- <
- ratio<__gcd_n1_n2, _R1::den / __gcd_d1_d2>,
- ratio
- <
- __ll_add
- <
- __ll_mul<_R1::num / __gcd_n1_n2, _R2::den / __gcd_d1_d2>::value,
- __ll_mul<_R2::num / __gcd_n1_n2, _R1::den / __gcd_d1_d2>::value
- >::value,
- _R2::den
- >
- >::type type;
+ typedef typename ratio_multiply<
+ ratio<__gcd_n1_n2, _R1::den / __gcd_d1_d2>,
+ ratio< __ll_add< __ll_mul<_R1::num / __gcd_n1_n2, _R2::den / __gcd_d1_d2>::value,
+ __ll_mul<_R2::num / __gcd_n1_n2, _R1::den / __gcd_d1_d2>::value >::value,
+ _R2::den > >::type type;
};
#ifndef _LIBCPP_CXX03_LANG
-template <class _R1, class _R2> using ratio_add
- = typename __ratio_add<_R1, _R2>::type;
+template <class _R1, class _R2>
+using ratio_add = typename __ratio_add<_R1, _R2>::type;
-#else // _LIBCPP_CXX03_LANG
+#else // _LIBCPP_CXX03_LANG
template <class _R1, class _R2>
-struct _LIBCPP_TEMPLATE_VIS ratio_add
- : public __ratio_add<_R1, _R2>::type {};
+struct _LIBCPP_TEMPLATE_VIS ratio_add : public __ratio_add<_R1, _R2>::type {};
#endif // _LIBCPP_CXX03_LANG
template <class _R1, class _R2>
-struct __ratio_subtract
-{
+struct __ratio_subtract {
private:
- static const intmax_t __gcd_n1_n2 = __static_gcd<_R1::num, _R2::num>::value;
- static const intmax_t __gcd_d1_d2 = __static_gcd<_R1::den, _R2::den>::value;
+ static const intmax_t __gcd_n1_n2 = __static_gcd<_R1::num, _R2::num>::value;
+ static const intmax_t __gcd_d1_d2 = __static_gcd<_R1::den, _R2::den>::value;
+
public:
- typedef typename ratio_multiply
- <
- ratio<__gcd_n1_n2, _R1::den / __gcd_d1_d2>,
- ratio
- <
- __ll_sub
- <
- __ll_mul<_R1::num / __gcd_n1_n2, _R2::den / __gcd_d1_d2>::value,
- __ll_mul<_R2::num / __gcd_n1_n2, _R1::den / __gcd_d1_d2>::value
- >::value,
- _R2::den
- >
- >::type type;
+ typedef typename ratio_multiply<
+ ratio<__gcd_n1_n2, _R1::den / __gcd_d1_d2>,
+ ratio< __ll_sub< __ll_mul<_R1::num / __gcd_n1_n2, _R2::den / __gcd_d1_d2>::value,
+ __ll_mul<_R2::num / __gcd_n1_n2, _R1::den / __gcd_d1_d2>::value >::value,
+ _R2::den > >::type type;
};
#ifndef _LIBCPP_CXX03_LANG
-template <class _R1, class _R2> using ratio_subtract
- = typename __ratio_subtract<_R1, _R2>::type;
+template <class _R1, class _R2>
+using ratio_subtract = typename __ratio_subtract<_R1, _R2>::type;
-#else // _LIBCPP_CXX03_LANG
+#else // _LIBCPP_CXX03_LANG
template <class _R1, class _R2>
-struct _LIBCPP_TEMPLATE_VIS ratio_subtract
- : public __ratio_subtract<_R1, _R2>::type {};
+struct _LIBCPP_TEMPLATE_VIS ratio_subtract : public __ratio_subtract<_R1, _R2>::type {};
#endif // _LIBCPP_CXX03_LANG
// ratio_equal
template <class _R1, class _R2>
-struct _LIBCPP_TEMPLATE_VIS ratio_equal
- : _BoolConstant<(_R1::num == _R2::num && _R1::den == _R2::den)> {};
+struct _LIBCPP_TEMPLATE_VIS ratio_equal : _BoolConstant<(_R1::num == _R2::num && _R1::den == _R2::den)> {};
template <class _R1, class _R2>
-struct _LIBCPP_TEMPLATE_VIS ratio_not_equal
- : _BoolConstant<!ratio_equal<_R1, _R2>::value> {};
+struct _LIBCPP_TEMPLATE_VIS ratio_not_equal : _BoolConstant<!ratio_equal<_R1, _R2>::value> {};
// ratio_less
-template <class _R1, class _R2, bool _Odd = false,
- intmax_t _Q1 = _R1::num / _R1::den, intmax_t _M1 = _R1::num % _R1::den,
- intmax_t _Q2 = _R2::num / _R2::den, intmax_t _M2 = _R2::num % _R2::den>
-struct __ratio_less1
-{
- static const bool value = _Odd ? _Q2 < _Q1 : _Q1 < _Q2;
+template <class _R1,
+ class _R2,
+ bool _Odd = false,
+ intmax_t _Q1 = _R1::num / _R1::den,
+ intmax_t _M1 = _R1::num % _R1::den,
+ intmax_t _Q2 = _R2::num / _R2::den,
+ intmax_t _M2 = _R2::num % _R2::den>
+struct __ratio_less1 {
+ static const bool value = _Odd ? _Q2 < _Q1 : _Q1 < _Q2;
};
template <class _R1, class _R2, bool _Odd, intmax_t _Qp>
-struct __ratio_less1<_R1, _R2, _Odd, _Qp, 0, _Qp, 0>
-{
- static const bool value = false;
+struct __ratio_less1<_R1, _R2, _Odd, _Qp, 0, _Qp, 0> {
+ static const bool value = false;
};
template <class _R1, class _R2, bool _Odd, intmax_t _Qp, intmax_t _M2>
-struct __ratio_less1<_R1, _R2, _Odd, _Qp, 0, _Qp, _M2>
-{
- static const bool value = !_Odd;
+struct __ratio_less1<_R1, _R2, _Odd, _Qp, 0, _Qp, _M2> {
+ static const bool value = !_Odd;
};
template <class _R1, class _R2, bool _Odd, intmax_t _Qp, intmax_t _M1>
-struct __ratio_less1<_R1, _R2, _Odd, _Qp, _M1, _Qp, 0>
-{
- static const bool value = _Odd;
+struct __ratio_less1<_R1, _R2, _Odd, _Qp, _M1, _Qp, 0> {
+ static const bool value = _Odd;
};
-template <class _R1, class _R2, bool _Odd, intmax_t _Qp, intmax_t _M1,
- intmax_t _M2>
-struct __ratio_less1<_R1, _R2, _Odd, _Qp, _M1, _Qp, _M2>
-{
- static const bool value = __ratio_less1<ratio<_R1::den, _M1>,
- ratio<_R2::den, _M2>, !_Odd>::value;
+template <class _R1, class _R2, bool _Odd, intmax_t _Qp, intmax_t _M1, intmax_t _M2>
+struct __ratio_less1<_R1, _R2, _Odd, _Qp, _M1, _Qp, _M2> {
+ static const bool value = __ratio_less1<ratio<_R1::den, _M1>, ratio<_R2::den, _M2>, !_Odd>::value;
};
-template <class _R1, class _R2, intmax_t _S1 = __static_sign<_R1::num>::value,
- intmax_t _S2 = __static_sign<_R2::num>::value>
-struct __ratio_less
-{
- static const bool value = _S1 < _S2;
+template <class _R1,
+ class _R2,
+ intmax_t _S1 = __static_sign<_R1::num>::value,
+ intmax_t _S2 = __static_sign<_R2::num>::value>
+struct __ratio_less {
+ static const bool value = _S1 < _S2;
};
template <class _R1, class _R2>
-struct __ratio_less<_R1, _R2, 1LL, 1LL>
-{
- static const bool value = __ratio_less1<_R1, _R2>::value;
+struct __ratio_less<_R1, _R2, 1LL, 1LL> {
+ static const bool value = __ratio_less1<_R1, _R2>::value;
};
template <class _R1, class _R2>
-struct __ratio_less<_R1, _R2, -1LL, -1LL>
-{
- static const bool value = __ratio_less1<ratio<-_R2::num, _R2::den>, ratio<-_R1::num, _R1::den> >::value;
+struct __ratio_less<_R1, _R2, -1LL, -1LL> {
+ static const bool value = __ratio_less1<ratio<-_R2::num, _R2::den>, ratio<-_R1::num, _R1::den> >::value;
};
template <class _R1, class _R2>
-struct _LIBCPP_TEMPLATE_VIS ratio_less
- : _BoolConstant<__ratio_less<_R1, _R2>::value> {};
+struct _LIBCPP_TEMPLATE_VIS ratio_less : _BoolConstant<__ratio_less<_R1, _R2>::value> {};
template <class _R1, class _R2>
-struct _LIBCPP_TEMPLATE_VIS ratio_less_equal
- : _BoolConstant<!ratio_less<_R2, _R1>::value> {};
+struct _LIBCPP_TEMPLATE_VIS ratio_less_equal : _BoolConstant<!ratio_less<_R2, _R1>::value> {};
template <class _R1, class _R2>
-struct _LIBCPP_TEMPLATE_VIS ratio_greater
- : _BoolConstant<ratio_less<_R2, _R1>::value> {};
+struct _LIBCPP_TEMPLATE_VIS ratio_greater : _BoolConstant<ratio_less<_R2, _R1>::value> {};
template <class _R1, class _R2>
-struct _LIBCPP_TEMPLATE_VIS ratio_greater_equal
- : _BoolConstant<!ratio_less<_R1, _R2>::value> {};
+struct _LIBCPP_TEMPLATE_VIS ratio_greater_equal : _BoolConstant<!ratio_less<_R1, _R2>::value> {};
template <class _R1, class _R2>
-struct __ratio_gcd
-{
- typedef ratio<__static_gcd<_R1::num, _R2::num>::value,
- __static_lcm<_R1::den, _R2::den>::value> type;
+struct __ratio_gcd {
+ typedef ratio<__static_gcd<_R1::num, _R2::num>::value, __static_lcm<_R1::den, _R2::den>::value> type;
};
#if _LIBCPP_STD_VER >= 17
diff --git a/contrib/llvm-project/libcxx/include/regex b/contrib/llvm-project/libcxx/include/regex
index 008fe70a0ca6..061194cb2eba 100644
--- a/contrib/llvm-project/libcxx/include/regex
+++ b/contrib/llvm-project/libcxx/include/regex
@@ -831,375 +831,289 @@ typedef regex_token_iterator<wstring::const_iterator> wsregex_token_iterator;
_LIBCPP_PUSH_MACROS
#include <__undef_macros>
-
#define _LIBCPP_REGEX_COMPLEXITY_FACTOR 4096
_LIBCPP_BEGIN_NAMESPACE_STD
-namespace regex_constants
-{
+namespace regex_constants {
// syntax_option_type
-enum syntax_option_type
-{
- icase = 1 << 0,
- nosubs = 1 << 1,
- optimize = 1 << 2,
- collate = 1 << 3,
+enum syntax_option_type {
+ icase = 1 << 0,
+ nosubs = 1 << 1,
+ optimize = 1 << 2,
+ collate = 1 << 3,
#ifdef _LIBCPP_ABI_REGEX_CONSTANTS_NONZERO
- ECMAScript = 1 << 9,
+ ECMAScript = 1 << 9,
#else
- ECMAScript = 0,
+ ECMAScript = 0,
#endif
- basic = 1 << 4,
- extended = 1 << 5,
- awk = 1 << 6,
- grep = 1 << 7,
- egrep = 1 << 8,
- // 1 << 9 may be used by ECMAScript
- multiline = 1 << 10
+ basic = 1 << 4,
+ extended = 1 << 5,
+ awk = 1 << 6,
+ grep = 1 << 7,
+ egrep = 1 << 8,
+ // 1 << 9 may be used by ECMAScript
+ multiline = 1 << 10
};
-_LIBCPP_HIDE_FROM_ABI inline _LIBCPP_CONSTEXPR
-syntax_option_type __get_grammar(syntax_option_type __g)
-{
+_LIBCPP_HIDE_FROM_ABI inline _LIBCPP_CONSTEXPR syntax_option_type __get_grammar(syntax_option_type __g) {
#ifdef _LIBCPP_ABI_REGEX_CONSTANTS_NONZERO
- return static_cast<syntax_option_type>(__g & 0x3F0);
+ return static_cast<syntax_option_type>(__g & 0x3F0);
#else
- return static_cast<syntax_option_type>(__g & 0x1F0);
+ return static_cast<syntax_option_type>(__g & 0x1F0);
#endif
}
-inline _LIBCPP_HIDE_FROM_ABI
-_LIBCPP_CONSTEXPR
-syntax_option_type
-operator~(syntax_option_type __x)
-{
- return syntax_option_type(~int(__x) & 0x1FF);
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR syntax_option_type operator~(syntax_option_type __x) {
+ return syntax_option_type(~int(__x) & 0x1FF);
}
-inline _LIBCPP_HIDE_FROM_ABI
-_LIBCPP_CONSTEXPR
-syntax_option_type
-operator&(syntax_option_type __x, syntax_option_type __y)
-{
- return syntax_option_type(int(__x) & int(__y));
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR syntax_option_type
+operator&(syntax_option_type __x, syntax_option_type __y) {
+ return syntax_option_type(int(__x) & int(__y));
}
-inline _LIBCPP_HIDE_FROM_ABI
-_LIBCPP_CONSTEXPR
-syntax_option_type
-operator|(syntax_option_type __x, syntax_option_type __y)
-{
- return syntax_option_type(int(__x) | int(__y));
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR syntax_option_type
+operator|(syntax_option_type __x, syntax_option_type __y) {
+ return syntax_option_type(int(__x) | int(__y));
}
-inline _LIBCPP_HIDE_FROM_ABI
-_LIBCPP_CONSTEXPR
-syntax_option_type
-operator^(syntax_option_type __x, syntax_option_type __y)
-{
- return syntax_option_type(int(__x) ^ int(__y));
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR syntax_option_type
+operator^(syntax_option_type __x, syntax_option_type __y) {
+ return syntax_option_type(int(__x) ^ int(__y));
}
-inline _LIBCPP_HIDE_FROM_ABI
-syntax_option_type&
-operator&=(syntax_option_type& __x, syntax_option_type __y)
-{
- __x = __x & __y;
- return __x;
+inline _LIBCPP_HIDE_FROM_ABI syntax_option_type& operator&=(syntax_option_type& __x, syntax_option_type __y) {
+ __x = __x & __y;
+ return __x;
}
-inline _LIBCPP_HIDE_FROM_ABI
-syntax_option_type&
-operator|=(syntax_option_type& __x, syntax_option_type __y)
-{
- __x = __x | __y;
- return __x;
+inline _LIBCPP_HIDE_FROM_ABI syntax_option_type& operator|=(syntax_option_type& __x, syntax_option_type __y) {
+ __x = __x | __y;
+ return __x;
}
-inline _LIBCPP_HIDE_FROM_ABI
-syntax_option_type&
-operator^=(syntax_option_type& __x, syntax_option_type __y)
-{
- __x = __x ^ __y;
- return __x;
+inline _LIBCPP_HIDE_FROM_ABI syntax_option_type& operator^=(syntax_option_type& __x, syntax_option_type __y) {
+ __x = __x ^ __y;
+ return __x;
}
// match_flag_type
-enum match_flag_type
-{
- match_default = 0,
- match_not_bol = 1 << 0,
- match_not_eol = 1 << 1,
- match_not_bow = 1 << 2,
- match_not_eow = 1 << 3,
- match_any = 1 << 4,
- match_not_null = 1 << 5,
- match_continuous = 1 << 6,
- match_prev_avail = 1 << 7,
- format_default = 0,
- format_sed = 1 << 8,
- format_no_copy = 1 << 9,
- format_first_only = 1 << 10,
- __no_update_pos = 1 << 11,
- __full_match = 1 << 12
+enum match_flag_type {
+ match_default = 0,
+ match_not_bol = 1 << 0,
+ match_not_eol = 1 << 1,
+ match_not_bow = 1 << 2,
+ match_not_eow = 1 << 3,
+ match_any = 1 << 4,
+ match_not_null = 1 << 5,
+ match_continuous = 1 << 6,
+ match_prev_avail = 1 << 7,
+ format_default = 0,
+ format_sed = 1 << 8,
+ format_no_copy = 1 << 9,
+ format_first_only = 1 << 10,
+ __no_update_pos = 1 << 11,
+ __full_match = 1 << 12
};
-inline _LIBCPP_HIDE_FROM_ABI
-_LIBCPP_CONSTEXPR
-match_flag_type
-operator~(match_flag_type __x)
-{
- return match_flag_type(~int(__x) & 0x0FFF);
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR match_flag_type operator~(match_flag_type __x) {
+ return match_flag_type(~int(__x) & 0x0FFF);
}
-inline _LIBCPP_HIDE_FROM_ABI
-_LIBCPP_CONSTEXPR
-match_flag_type
-operator&(match_flag_type __x, match_flag_type __y)
-{
- return match_flag_type(int(__x) & int(__y));
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR match_flag_type operator&(match_flag_type __x, match_flag_type __y) {
+ return match_flag_type(int(__x) & int(__y));
}
-inline _LIBCPP_HIDE_FROM_ABI
-_LIBCPP_CONSTEXPR
-match_flag_type
-operator|(match_flag_type __x, match_flag_type __y)
-{
- return match_flag_type(int(__x) | int(__y));
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR match_flag_type operator|(match_flag_type __x, match_flag_type __y) {
+ return match_flag_type(int(__x) | int(__y));
}
-inline _LIBCPP_HIDE_FROM_ABI
-_LIBCPP_CONSTEXPR
-match_flag_type
-operator^(match_flag_type __x, match_flag_type __y)
-{
- return match_flag_type(int(__x) ^ int(__y));
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR match_flag_type operator^(match_flag_type __x, match_flag_type __y) {
+ return match_flag_type(int(__x) ^ int(__y));
}
-inline _LIBCPP_HIDE_FROM_ABI
-match_flag_type&
-operator&=(match_flag_type& __x, match_flag_type __y)
-{
- __x = __x & __y;
- return __x;
+inline _LIBCPP_HIDE_FROM_ABI match_flag_type& operator&=(match_flag_type& __x, match_flag_type __y) {
+ __x = __x & __y;
+ return __x;
}
-inline _LIBCPP_HIDE_FROM_ABI
-match_flag_type&
-operator|=(match_flag_type& __x, match_flag_type __y)
-{
- __x = __x | __y;
- return __x;
+inline _LIBCPP_HIDE_FROM_ABI match_flag_type& operator|=(match_flag_type& __x, match_flag_type __y) {
+ __x = __x | __y;
+ return __x;
}
-inline _LIBCPP_HIDE_FROM_ABI
-match_flag_type&
-operator^=(match_flag_type& __x, match_flag_type __y)
-{
- __x = __x ^ __y;
- return __x;
+inline _LIBCPP_HIDE_FROM_ABI match_flag_type& operator^=(match_flag_type& __x, match_flag_type __y) {
+ __x = __x ^ __y;
+ return __x;
}
-enum error_type
-{
- error_collate = 1,
- error_ctype,
- error_escape,
- error_backref,
- error_brack,
- error_paren,
- error_brace,
- error_badbrace,
- error_range,
- error_space,
- error_badrepeat,
- error_complexity,
- error_stack,
- __re_err_grammar,
- __re_err_empty,
- __re_err_unknown,
- __re_err_parse
+enum error_type {
+ error_collate = 1,
+ error_ctype,
+ error_escape,
+ error_backref,
+ error_brack,
+ error_paren,
+ error_brace,
+ error_badbrace,
+ error_range,
+ error_space,
+ error_badrepeat,
+ error_complexity,
+ error_stack,
+ __re_err_grammar,
+ __re_err_empty,
+ __re_err_unknown,
+ __re_err_parse
};
} // namespace regex_constants
-class _LIBCPP_EXPORTED_FROM_ABI regex_error
- : public runtime_error
-{
- regex_constants::error_type __code_;
+class _LIBCPP_EXPORTED_FROM_ABI regex_error : public runtime_error {
+ regex_constants::error_type __code_;
+
public:
- explicit regex_error(regex_constants::error_type __ecode);
- _LIBCPP_HIDE_FROM_ABI regex_error(const regex_error&) _NOEXCEPT = default;
- ~regex_error() _NOEXCEPT override;
- _LIBCPP_HIDE_FROM_ABI
- regex_constants::error_type code() const {return __code_;}
+ explicit regex_error(regex_constants::error_type __ecode);
+ _LIBCPP_HIDE_FROM_ABI regex_error(const regex_error&) _NOEXCEPT = default;
+ ~regex_error() _NOEXCEPT override;
+ _LIBCPP_HIDE_FROM_ABI regex_constants::error_type code() const { return __code_; }
};
template <regex_constants::error_type _Ev>
-_LIBCPP_NORETURN inline _LIBCPP_HIDE_FROM_ABI
-void __throw_regex_error()
-{
+_LIBCPP_NORETURN inline _LIBCPP_HIDE_FROM_ABI void __throw_regex_error() {
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- throw regex_error(_Ev);
+ throw regex_error(_Ev);
#else
- _LIBCPP_VERBOSE_ABORT("regex_error was thrown in -fno-exceptions mode");
+ _LIBCPP_VERBOSE_ABORT("regex_error was thrown in -fno-exceptions mode");
#endif
}
template <class _CharT>
-struct _LIBCPP_TEMPLATE_VIS regex_traits
-{
+struct _LIBCPP_TEMPLATE_VIS regex_traits {
public:
- typedef _CharT char_type;
- typedef basic_string<char_type> string_type;
- typedef locale locale_type;
+ typedef _CharT char_type;
+ typedef basic_string<char_type> string_type;
+ typedef locale locale_type;
#if defined(__BIONIC__) || defined(_NEWLIB_VERSION)
- // Originally bionic's ctype_base used its own ctype masks because the
- // builtin ctype implementation wasn't in libc++ yet. Bionic's ctype mask
- // was only 8 bits wide and already saturated, so it used a wider type here
- // to make room for __regex_word (then a part of this class rather than
- // ctype_base). Bionic has since moved to the builtin ctype_base
- // implementation, but this was not updated to match. Since then Android has
- // needed to maintain a stable libc++ ABI, and this can't be changed without
- // an ABI break.
- // We also need this workaround for newlib since _NEWLIB_VERSION is not
- // defined yet inside __config, so we can't set the
- // _LIBCPP_PROVIDES_DEFAULT_RUNE_TABLE macro. Additionally, newlib is
- // often used for space constrained environments, so it makes sense not to
- // duplicate the ctype table.
- typedef uint16_t char_class_type;
+ // Originally bionic's ctype_base used its own ctype masks because the
+ // builtin ctype implementation wasn't in libc++ yet. Bionic's ctype mask
+ // was only 8 bits wide and already saturated, so it used a wider type here
+ // to make room for __regex_word (then a part of this class rather than
+ // ctype_base). Bionic has since moved to the builtin ctype_base
+ // implementation, but this was not updated to match. Since then Android has
+ // needed to maintain a stable libc++ ABI, and this can't be changed without
+ // an ABI break.
+ // We also need this workaround for newlib since _NEWLIB_VERSION is not
+ // defined yet inside __config, so we can't set the
+ // _LIBCPP_PROVIDES_DEFAULT_RUNE_TABLE macro. Additionally, newlib is
+ // often used for space constrained environments, so it makes sense not to
+ // duplicate the ctype table.
+ typedef uint16_t char_class_type;
#else
- typedef ctype_base::mask char_class_type;
+ typedef ctype_base::mask char_class_type;
#endif
- static const char_class_type __regex_word = ctype_base::__regex_word;
+ static const char_class_type __regex_word = ctype_base::__regex_word;
+
private:
- locale __loc_;
- const ctype<char_type>* __ct_;
- const collate<char_type>* __col_;
+ locale __loc_;
+ const ctype<char_type>* __ct_;
+ const collate<char_type>* __col_;
public:
- regex_traits();
-
- _LIBCPP_HIDE_FROM_ABI
- static size_t length(const char_type* __p)
- {return char_traits<char_type>::length(__p);}
- _LIBCPP_HIDE_FROM_ABI
- char_type translate(char_type __c) const {return __c;}
- char_type translate_nocase(char_type __c) const;
- template <class _ForwardIterator>
- string_type
- transform(_ForwardIterator __f, _ForwardIterator __l) const;
- template <class _ForwardIterator>
- _LIBCPP_HIDE_FROM_ABI
- string_type
- transform_primary( _ForwardIterator __f, _ForwardIterator __l) const
- {return __transform_primary(__f, __l, char_type());}
- template <class _ForwardIterator>
- _LIBCPP_HIDE_FROM_ABI
- string_type
- lookup_collatename(_ForwardIterator __f, _ForwardIterator __l) const
- {return __lookup_collatename(__f, __l, char_type());}
- template <class _ForwardIterator>
- _LIBCPP_HIDE_FROM_ABI
- char_class_type
- lookup_classname(_ForwardIterator __f, _ForwardIterator __l,
- bool __icase = false) const
- {return __lookup_classname(__f, __l, __icase, char_type());}
- bool isctype(char_type __c, char_class_type __m) const;
- _LIBCPP_HIDE_FROM_ABI
- int value(char_type __ch, int __radix) const
- {return __regex_traits_value(__ch, __radix);}
- locale_type imbue(locale_type __l);
- _LIBCPP_HIDE_FROM_ABI
- locale_type getloc()const {return __loc_;}
+ regex_traits();
+
+ _LIBCPP_HIDE_FROM_ABI static size_t length(const char_type* __p) { return char_traits<char_type>::length(__p); }
+ _LIBCPP_HIDE_FROM_ABI char_type translate(char_type __c) const { return __c; }
+ char_type translate_nocase(char_type __c) const;
+ template <class _ForwardIterator>
+ string_type transform(_ForwardIterator __f, _ForwardIterator __l) const;
+ template <class _ForwardIterator>
+ _LIBCPP_HIDE_FROM_ABI string_type transform_primary(_ForwardIterator __f, _ForwardIterator __l) const {
+ return __transform_primary(__f, __l, char_type());
+ }
+ template <class _ForwardIterator>
+ _LIBCPP_HIDE_FROM_ABI string_type lookup_collatename(_ForwardIterator __f, _ForwardIterator __l) const {
+ return __lookup_collatename(__f, __l, char_type());
+ }
+ template <class _ForwardIterator>
+ _LIBCPP_HIDE_FROM_ABI char_class_type
+ lookup_classname(_ForwardIterator __f, _ForwardIterator __l, bool __icase = false) const {
+ return __lookup_classname(__f, __l, __icase, char_type());
+ }
+ bool isctype(char_type __c, char_class_type __m) const;
+ _LIBCPP_HIDE_FROM_ABI int value(char_type __ch, int __radix) const { return __regex_traits_value(__ch, __radix); }
+ locale_type imbue(locale_type __l);
+ _LIBCPP_HIDE_FROM_ABI locale_type getloc() const { return __loc_; }
private:
- void __init();
+ void __init();
- template <class _ForwardIterator>
- string_type
- __transform_primary(_ForwardIterator __f, _ForwardIterator __l, char) const;
+ template <class _ForwardIterator>
+ string_type __transform_primary(_ForwardIterator __f, _ForwardIterator __l, char) const;
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
- template <class _ForwardIterator>
- string_type
- __transform_primary(_ForwardIterator __f, _ForwardIterator __l, wchar_t) const;
+ template <class _ForwardIterator>
+ string_type __transform_primary(_ForwardIterator __f, _ForwardIterator __l, wchar_t) const;
#endif
- template <class _ForwardIterator>
- string_type
- __lookup_collatename(_ForwardIterator __f, _ForwardIterator __l, char) const;
+ template <class _ForwardIterator>
+ string_type __lookup_collatename(_ForwardIterator __f, _ForwardIterator __l, char) const;
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
- template <class _ForwardIterator>
- string_type
- __lookup_collatename(_ForwardIterator __f, _ForwardIterator __l, wchar_t) const;
+ template <class _ForwardIterator>
+ string_type __lookup_collatename(_ForwardIterator __f, _ForwardIterator __l, wchar_t) const;
#endif
- template <class _ForwardIterator>
- char_class_type
- __lookup_classname(_ForwardIterator __f, _ForwardIterator __l,
- bool __icase, char) const;
+ template <class _ForwardIterator>
+ char_class_type __lookup_classname(_ForwardIterator __f, _ForwardIterator __l, bool __icase, char) const;
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
- template <class _ForwardIterator>
- char_class_type
- __lookup_classname(_ForwardIterator __f, _ForwardIterator __l,
- bool __icase, wchar_t) const;
+ template <class _ForwardIterator>
+ char_class_type __lookup_classname(_ForwardIterator __f, _ForwardIterator __l, bool __icase, wchar_t) const;
#endif
- static int __regex_traits_value(unsigned char __ch, int __radix);
- _LIBCPP_HIDE_FROM_ABI
- int __regex_traits_value(char __ch, int __radix) const
- {return __regex_traits_value(static_cast<unsigned char>(__ch), __radix);}
+ static int __regex_traits_value(unsigned char __ch, int __radix);
+ _LIBCPP_HIDE_FROM_ABI int __regex_traits_value(char __ch, int __radix) const {
+ return __regex_traits_value(static_cast<unsigned char>(__ch), __radix);
+ }
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
- _LIBCPP_HIDE_FROM_ABI
- int __regex_traits_value(wchar_t __ch, int __radix) const;
+ _LIBCPP_HIDE_FROM_ABI int __regex_traits_value(wchar_t __ch, int __radix) const;
#endif
};
template <class _CharT>
-const typename regex_traits<_CharT>::char_class_type
-regex_traits<_CharT>::__regex_word;
+const typename regex_traits<_CharT>::char_class_type regex_traits<_CharT>::__regex_word;
template <class _CharT>
-regex_traits<_CharT>::regex_traits()
-{
- __init();
+regex_traits<_CharT>::regex_traits() {
+ __init();
}
template <class _CharT>
-typename regex_traits<_CharT>::char_type
-regex_traits<_CharT>::translate_nocase(char_type __c) const
-{
- return __ct_->tolower(__c);
+typename regex_traits<_CharT>::char_type regex_traits<_CharT>::translate_nocase(char_type __c) const {
+ return __ct_->tolower(__c);
}
template <class _CharT>
template <class _ForwardIterator>
typename regex_traits<_CharT>::string_type
-regex_traits<_CharT>::transform(_ForwardIterator __f, _ForwardIterator __l) const
-{
- string_type __s(__f, __l);
- return __col_->transform(__s.data(), __s.data() + __s.size());
+regex_traits<_CharT>::transform(_ForwardIterator __f, _ForwardIterator __l) const {
+ string_type __s(__f, __l);
+ return __col_->transform(__s.data(), __s.data() + __s.size());
}
template <class _CharT>
-void
-regex_traits<_CharT>::__init()
-{
- __ct_ = &std::use_facet<ctype<char_type> >(__loc_);
- __col_ = &std::use_facet<collate<char_type> >(__loc_);
+void regex_traits<_CharT>::__init() {
+ __ct_ = &std::use_facet<ctype<char_type> >(__loc_);
+ __col_ = &std::use_facet<collate<char_type> >(__loc_);
}
template <class _CharT>
-typename regex_traits<_CharT>::locale_type
-regex_traits<_CharT>::imbue(locale_type __l)
-{
- locale __r = __loc_;
- __loc_ = __l;
- __init();
- return __r;
+typename regex_traits<_CharT>::locale_type regex_traits<_CharT>::imbue(locale_type __l) {
+ locale __r = __loc_;
+ __loc_ = __l;
+ __init();
+ return __r;
}
// transform_primary is very FreeBSD-specific
@@ -1207,46 +1121,40 @@ regex_traits<_CharT>::imbue(locale_type __l)
template <class _CharT>
template <class _ForwardIterator>
typename regex_traits<_CharT>::string_type
-regex_traits<_CharT>::__transform_primary(_ForwardIterator __f,
- _ForwardIterator __l, char) const
-{
- const string_type __s(__f, __l);
- string_type __d = __col_->transform(__s.data(), __s.data() + __s.size());
- switch (__d.size())
- {
- case 1:
- break;
- case 12:
- __d[11] = __d[3];
- break;
- default:
- __d.clear();
- break;
- }
- return __d;
+regex_traits<_CharT>::__transform_primary(_ForwardIterator __f, _ForwardIterator __l, char) const {
+ const string_type __s(__f, __l);
+ string_type __d = __col_->transform(__s.data(), __s.data() + __s.size());
+ switch (__d.size()) {
+ case 1:
+ break;
+ case 12:
+ __d[11] = __d[3];
+ break;
+ default:
+ __d.clear();
+ break;
+ }
+ return __d;
}
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
template <class _CharT>
template <class _ForwardIterator>
typename regex_traits<_CharT>::string_type
-regex_traits<_CharT>::__transform_primary(_ForwardIterator __f,
- _ForwardIterator __l, wchar_t) const
-{
- const string_type __s(__f, __l);
- string_type __d = __col_->transform(__s.data(), __s.data() + __s.size());
- switch (__d.size())
- {
- case 1:
- break;
- case 3:
- __d[2] = __d[0];
- break;
- default:
- __d.clear();
- break;
- }
- return __d;
+regex_traits<_CharT>::__transform_primary(_ForwardIterator __f, _ForwardIterator __l, wchar_t) const {
+ const string_type __s(__f, __l);
+ string_type __d = __col_->transform(__s.data(), __s.data() + __s.size());
+ switch (__d.size()) {
+ case 1:
+ break;
+ case 3:
+ __d[2] = __d[0];
+ break;
+ default:
+ __d.clear();
+ break;
+ }
+ return __d;
}
#endif
@@ -1257,59 +1165,49 @@ _LIBCPP_EXPORTED_FROM_ABI string __get_collation_name(const char* __s);
template <class _CharT>
template <class _ForwardIterator>
typename regex_traits<_CharT>::string_type
-regex_traits<_CharT>::__lookup_collatename(_ForwardIterator __f,
- _ForwardIterator __l, char) const
-{
- string_type __s(__f, __l);
- string_type __r;
- if (!__s.empty())
- {
- __r = std::__get_collation_name(__s.c_str());
- if (__r.empty() && __s.size() <= 2)
- {
- __r = __col_->transform(__s.data(), __s.data() + __s.size());
- if (__r.size() == 1 || __r.size() == 12)
- __r = __s;
- else
- __r.clear();
- }
+regex_traits<_CharT>::__lookup_collatename(_ForwardIterator __f, _ForwardIterator __l, char) const {
+ string_type __s(__f, __l);
+ string_type __r;
+ if (!__s.empty()) {
+ __r = std::__get_collation_name(__s.c_str());
+ if (__r.empty() && __s.size() <= 2) {
+ __r = __col_->transform(__s.data(), __s.data() + __s.size());
+ if (__r.size() == 1 || __r.size() == 12)
+ __r = __s;
+ else
+ __r.clear();
}
- return __r;
+ }
+ return __r;
}
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
template <class _CharT>
template <class _ForwardIterator>
typename regex_traits<_CharT>::string_type
-regex_traits<_CharT>::__lookup_collatename(_ForwardIterator __f,
- _ForwardIterator __l, wchar_t) const
-{
- string_type __s(__f, __l);
- string __n;
- __n.reserve(__s.size());
- for (typename string_type::const_iterator __i = __s.begin(), __e = __s.end();
- __i != __e; ++__i)
- {
- if (static_cast<unsigned>(*__i) >= 127)
- return string_type();
- __n.push_back(char(*__i));
+regex_traits<_CharT>::__lookup_collatename(_ForwardIterator __f, _ForwardIterator __l, wchar_t) const {
+ string_type __s(__f, __l);
+ string __n;
+ __n.reserve(__s.size());
+ for (typename string_type::const_iterator __i = __s.begin(), __e = __s.end(); __i != __e; ++__i) {
+ if (static_cast<unsigned>(*__i) >= 127)
+ return string_type();
+ __n.push_back(char(*__i));
+ }
+ string_type __r;
+ if (!__s.empty()) {
+ __n = __get_collation_name(__n.c_str());
+ if (!__n.empty())
+ __r.assign(__n.begin(), __n.end());
+ else if (__s.size() <= 2) {
+ __r = __col_->transform(__s.data(), __s.data() + __s.size());
+ if (__r.size() == 1 || __r.size() == 3)
+ __r = __s;
+ else
+ __r.clear();
}
- string_type __r;
- if (!__s.empty())
- {
- __n = __get_collation_name(__n.c_str());
- if (!__n.empty())
- __r.assign(__n.begin(), __n.end());
- else if (__s.size() <= 2)
- {
- __r = __col_->transform(__s.data(), __s.data() + __s.size());
- if (__r.size() == 1 || __r.size() == 3)
- __r = __s;
- else
- __r.clear();
- }
- }
- return __r;
+ }
+ return __r;
}
#endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS
@@ -1320,5040 +1218,4064 @@ regex_traits<char>::char_class_type _LIBCPP_EXPORTED_FROM_ABI __get_classname(co
template <class _CharT>
template <class _ForwardIterator>
typename regex_traits<_CharT>::char_class_type
-regex_traits<_CharT>::__lookup_classname(_ForwardIterator __f,
- _ForwardIterator __l,
- bool __icase, char) const
-{
- string_type __s(__f, __l);
- __ct_->tolower(&__s[0], &__s[0] + __s.size());
- return std::__get_classname(__s.c_str(), __icase);
+regex_traits<_CharT>::__lookup_classname(_ForwardIterator __f, _ForwardIterator __l, bool __icase, char) const {
+ string_type __s(__f, __l);
+ __ct_->tolower(&__s[0], &__s[0] + __s.size());
+ return std::__get_classname(__s.c_str(), __icase);
}
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
template <class _CharT>
template <class _ForwardIterator>
typename regex_traits<_CharT>::char_class_type
-regex_traits<_CharT>::__lookup_classname(_ForwardIterator __f,
- _ForwardIterator __l,
- bool __icase, wchar_t) const
-{
- string_type __s(__f, __l);
- __ct_->tolower(&__s[0], &__s[0] + __s.size());
- string __n;
- __n.reserve(__s.size());
- for (typename string_type::const_iterator __i = __s.begin(), __e = __s.end();
- __i != __e; ++__i)
- {
- if (static_cast<unsigned>(*__i) >= 127)
- return char_class_type();
- __n.push_back(char(*__i));
- }
- return __get_classname(__n.c_str(), __icase);
+regex_traits<_CharT>::__lookup_classname(_ForwardIterator __f, _ForwardIterator __l, bool __icase, wchar_t) const {
+ string_type __s(__f, __l);
+ __ct_->tolower(&__s[0], &__s[0] + __s.size());
+ string __n;
+ __n.reserve(__s.size());
+ for (typename string_type::const_iterator __i = __s.begin(), __e = __s.end(); __i != __e; ++__i) {
+ if (static_cast<unsigned>(*__i) >= 127)
+ return char_class_type();
+ __n.push_back(char(*__i));
+ }
+ return __get_classname(__n.c_str(), __icase);
}
#endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS
template <class _CharT>
-bool
-regex_traits<_CharT>::isctype(char_type __c, char_class_type __m) const
-{
- if (__ct_->is(__m, __c))
- return true;
- return (__c == '_' && (__m & __regex_word));
+bool regex_traits<_CharT>::isctype(char_type __c, char_class_type __m) const {
+ if (__ct_->is(__m, __c))
+ return true;
+ return (__c == '_' && (__m & __regex_word));
}
-inline _LIBCPP_HIDE_FROM_ABI
-bool __is_07(unsigned char __c)
-{
- return (__c & 0xF8u) ==
+inline _LIBCPP_HIDE_FROM_ABI bool __is_07(unsigned char __c) {
+ return (__c & 0xF8u) ==
#if defined(__MVS__) && !defined(__NATIVE_ASCII_F)
- 0xF0;
+ 0xF0;
#else
- 0x30;
+ 0x30;
#endif
}
-inline _LIBCPP_HIDE_FROM_ABI
-bool __is_89(unsigned char __c)
-{
- return (__c & 0xFEu) ==
+inline _LIBCPP_HIDE_FROM_ABI bool __is_89(unsigned char __c) {
+ return (__c & 0xFEu) ==
#if defined(__MVS__) && !defined(__NATIVE_ASCII_F)
- 0xF8;
+ 0xF8;
#else
- 0x38;
+ 0x38;
#endif
}
-inline _LIBCPP_HIDE_FROM_ABI
-unsigned char __to_lower(unsigned char __c)
-{
+inline _LIBCPP_HIDE_FROM_ABI unsigned char __to_lower(unsigned char __c) {
#if defined(__MVS__) && !defined(__NATIVE_ASCII_F)
- return __c & 0xBF;
+ return __c & 0xBF;
#else
- return __c | 0x20;
+ return __c | 0x20;
#endif
}
template <class _CharT>
-int
-regex_traits<_CharT>::__regex_traits_value(unsigned char __ch, int __radix)
-{
- if (__is_07(__ch)) // '0' <= __ch && __ch <= '7'
- return __ch - '0';
- if (__radix != 8)
- {
- if (__is_89(__ch)) // '8' <= __ch && __ch <= '9'
- return __ch - '0';
- if (__radix == 16)
- {
- __ch = __to_lower(__ch); // tolower
- if ('a' <= __ch && __ch <= 'f')
- return __ch - ('a' - 10);
- }
+int regex_traits<_CharT>::__regex_traits_value(unsigned char __ch, int __radix) {
+ if (__is_07(__ch)) // '0' <= __ch && __ch <= '7'
+ return __ch - '0';
+ if (__radix != 8) {
+ if (__is_89(__ch)) // '8' <= __ch && __ch <= '9'
+ return __ch - '0';
+ if (__radix == 16) {
+ __ch = __to_lower(__ch); // tolower
+ if ('a' <= __ch && __ch <= 'f')
+ return __ch - ('a' - 10);
}
- return -1;
+ }
+ return -1;
}
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
template <class _CharT>
-inline
-int
-regex_traits<_CharT>::__regex_traits_value(wchar_t __ch, int __radix) const
-{
- return __regex_traits_value(static_cast<unsigned char>(__ct_->narrow(__ch, char_type())), __radix);
+inline int regex_traits<_CharT>::__regex_traits_value(wchar_t __ch, int __radix) const {
+ return __regex_traits_value(static_cast<unsigned char>(__ct_->narrow(__ch, char_type())), __radix);
}
#endif
-template <class _CharT> class __node;
+template <class _CharT>
+class __node;
-template <class _BidirectionalIterator> class _LIBCPP_TEMPLATE_VIS sub_match;
+template <class _BidirectionalIterator>
+class _LIBCPP_TEMPLATE_VIS sub_match;
-template <class _BidirectionalIterator,
- class _Allocator = allocator<sub_match<_BidirectionalIterator> > >
+template <class _BidirectionalIterator, class _Allocator = allocator<sub_match<_BidirectionalIterator> > >
class _LIBCPP_TEMPLATE_VIS match_results;
template <class _CharT>
-struct __state
-{
- enum
- {
- __end_state = -1000,
- __consume_input, // -999
- __begin_marked_expr, // -998
- __end_marked_expr, // -997
- __pop_state, // -996
- __accept_and_consume, // -995
- __accept_but_not_consume, // -994
- __reject, // -993
- __split,
- __repeat
- };
-
- int __do_;
- const _CharT* __first_;
- const _CharT* __current_;
- const _CharT* __last_;
- vector<sub_match<const _CharT*> > __sub_matches_;
- vector<pair<size_t, const _CharT*> > __loop_data_;
- const __node<_CharT>* __node_;
- regex_constants::match_flag_type __flags_;
- bool __at_first_;
-
- _LIBCPP_HIDE_FROM_ABI
- __state()
- : __do_(0), __first_(nullptr), __current_(nullptr), __last_(nullptr),
- __node_(nullptr), __flags_(), __at_first_(false) {}
+struct __state {
+ enum {
+ __end_state = -1000,
+ __consume_input, // -999
+ __begin_marked_expr, // -998
+ __end_marked_expr, // -997
+ __pop_state, // -996
+ __accept_and_consume, // -995
+ __accept_but_not_consume, // -994
+ __reject, // -993
+ __split,
+ __repeat
+ };
+
+ int __do_;
+ const _CharT* __first_;
+ const _CharT* __current_;
+ const _CharT* __last_;
+ vector<sub_match<const _CharT*> > __sub_matches_;
+ vector<pair<size_t, const _CharT*> > __loop_data_;
+ const __node<_CharT>* __node_;
+ regex_constants::match_flag_type __flags_;
+ bool __at_first_;
+
+ _LIBCPP_HIDE_FROM_ABI __state()
+ : __do_(0),
+ __first_(nullptr),
+ __current_(nullptr),
+ __last_(nullptr),
+ __node_(nullptr),
+ __flags_(),
+ __at_first_(false) {}
};
// __node
template <class _CharT>
-class __node
-{
- __node(const __node&);
- __node& operator=(const __node&);
+class __node {
+ __node(const __node&);
+ __node& operator=(const __node&);
+
public:
- typedef std::__state<_CharT> __state;
+ typedef std::__state<_CharT> __state;
- _LIBCPP_HIDE_FROM_ABI
- __node() {}
- _LIBCPP_HIDE_FROM_ABI_VIRTUAL
- virtual ~__node() {}
+ _LIBCPP_HIDE_FROM_ABI __node() {}
+ _LIBCPP_HIDE_FROM_ABI_VIRTUAL
+ virtual ~__node() {}
- _LIBCPP_HIDE_FROM_ABI_VIRTUAL
- virtual void __exec(__state&) const {}
- _LIBCPP_HIDE_FROM_ABI_VIRTUAL
- virtual void __exec_split(bool, __state&) const {}
+ _LIBCPP_HIDE_FROM_ABI_VIRTUAL
+ virtual void __exec(__state&) const {}
+ _LIBCPP_HIDE_FROM_ABI_VIRTUAL
+ virtual void __exec_split(bool, __state&) const {}
};
// __end_state
template <class _CharT>
-class __end_state
- : public __node<_CharT>
-{
+class __end_state : public __node<_CharT> {
public:
- typedef std::__state<_CharT> __state;
+ typedef std::__state<_CharT> __state;
- _LIBCPP_HIDE_FROM_ABI
- __end_state() {}
+ _LIBCPP_HIDE_FROM_ABI __end_state() {}
- _LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual void __exec(__state&) const;
+ _LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual void __exec(__state&) const;
};
template <class _CharT>
-void
-__end_state<_CharT>::__exec(__state& __s) const
-{
- __s.__do_ = __state::__end_state;
+void __end_state<_CharT>::__exec(__state& __s) const {
+ __s.__do_ = __state::__end_state;
}
// __has_one_state
template <class _CharT>
-class __has_one_state
- : public __node<_CharT>
-{
- __node<_CharT>* __first_;
+class __has_one_state : public __node<_CharT> {
+ __node<_CharT>* __first_;
public:
- _LIBCPP_HIDE_FROM_ABI
- explicit __has_one_state(__node<_CharT>* __s)
- : __first_(__s) {}
-
- _LIBCPP_HIDE_FROM_ABI
- __node<_CharT>* first() const {return __first_;}
- _LIBCPP_HIDE_FROM_ABI
- __node<_CharT>*& first() {return __first_;}
+ _LIBCPP_HIDE_FROM_ABI explicit __has_one_state(__node<_CharT>* __s) : __first_(__s) {}
+
+ _LIBCPP_HIDE_FROM_ABI __node<_CharT>* first() const { return __first_; }
+ _LIBCPP_HIDE_FROM_ABI __node<_CharT>*& first() { return __first_; }
};
// __owns_one_state
template <class _CharT>
-class __owns_one_state
- : public __has_one_state<_CharT>
-{
- typedef __has_one_state<_CharT> base;
+class __owns_one_state : public __has_one_state<_CharT> {
+ typedef __has_one_state<_CharT> base;
public:
- _LIBCPP_HIDE_FROM_ABI
- explicit __owns_one_state(__node<_CharT>* __s)
- : base(__s) {}
+ _LIBCPP_HIDE_FROM_ABI explicit __owns_one_state(__node<_CharT>* __s) : base(__s) {}
- ~__owns_one_state() override;
+ ~__owns_one_state() override;
};
template <class _CharT>
-__owns_one_state<_CharT>::~__owns_one_state()
-{
- delete this->first();
+__owns_one_state<_CharT>::~__owns_one_state() {
+ delete this->first();
}
// __empty_state
template <class _CharT>
-class __empty_state
- : public __owns_one_state<_CharT>
-{
- typedef __owns_one_state<_CharT> base;
+class __empty_state : public __owns_one_state<_CharT> {
+ typedef __owns_one_state<_CharT> base;
public:
- typedef std::__state<_CharT> __state;
+ typedef std::__state<_CharT> __state;
- _LIBCPP_HIDE_FROM_ABI
- explicit __empty_state(__node<_CharT>* __s)
- : base(__s) {}
+ _LIBCPP_HIDE_FROM_ABI explicit __empty_state(__node<_CharT>* __s) : base(__s) {}
- _LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual void __exec(__state&) const;
+ _LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual void __exec(__state&) const;
};
template <class _CharT>
-void
-__empty_state<_CharT>::__exec(__state& __s) const
-{
- __s.__do_ = __state::__accept_but_not_consume;
- __s.__node_ = this->first();
+void __empty_state<_CharT>::__exec(__state& __s) const {
+ __s.__do_ = __state::__accept_but_not_consume;
+ __s.__node_ = this->first();
}
// __empty_non_own_state
template <class _CharT>
-class __empty_non_own_state
- : public __has_one_state<_CharT>
-{
- typedef __has_one_state<_CharT> base;
+class __empty_non_own_state : public __has_one_state<_CharT> {
+ typedef __has_one_state<_CharT> base;
public:
- typedef std::__state<_CharT> __state;
+ typedef std::__state<_CharT> __state;
- _LIBCPP_HIDE_FROM_ABI
- explicit __empty_non_own_state(__node<_CharT>* __s)
- : base(__s) {}
+ _LIBCPP_HIDE_FROM_ABI explicit __empty_non_own_state(__node<_CharT>* __s) : base(__s) {}
- _LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual void __exec(__state&) const;
+ _LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual void __exec(__state&) const;
};
template <class _CharT>
-void
-__empty_non_own_state<_CharT>::__exec(__state& __s) const
-{
- __s.__do_ = __state::__accept_but_not_consume;
- __s.__node_ = this->first();
+void __empty_non_own_state<_CharT>::__exec(__state& __s) const {
+ __s.__do_ = __state::__accept_but_not_consume;
+ __s.__node_ = this->first();
}
// __repeat_one_loop
template <class _CharT>
-class __repeat_one_loop
- : public __has_one_state<_CharT>
-{
- typedef __has_one_state<_CharT> base;
+class __repeat_one_loop : public __has_one_state<_CharT> {
+ typedef __has_one_state<_CharT> base;
public:
- typedef std::__state<_CharT> __state;
+ typedef std::__state<_CharT> __state;
- _LIBCPP_HIDE_FROM_ABI
- explicit __repeat_one_loop(__node<_CharT>* __s)
- : base(__s) {}
+ _LIBCPP_HIDE_FROM_ABI explicit __repeat_one_loop(__node<_CharT>* __s) : base(__s) {}
- _LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual void __exec(__state&) const;
+ _LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual void __exec(__state&) const;
};
template <class _CharT>
-void
-__repeat_one_loop<_CharT>::__exec(__state& __s) const
-{
- __s.__do_ = __state::__repeat;
- __s.__node_ = this->first();
+void __repeat_one_loop<_CharT>::__exec(__state& __s) const {
+ __s.__do_ = __state::__repeat;
+ __s.__node_ = this->first();
}
// __owns_two_states
template <class _CharT>
-class __owns_two_states
- : public __owns_one_state<_CharT>
-{
- typedef __owns_one_state<_CharT> base;
+class __owns_two_states : public __owns_one_state<_CharT> {
+ typedef __owns_one_state<_CharT> base;
- base* __second_;
+ base* __second_;
public:
- _LIBCPP_HIDE_FROM_ABI
- explicit __owns_two_states(__node<_CharT>* __s1, base* __s2)
- : base(__s1), __second_(__s2) {}
+ _LIBCPP_HIDE_FROM_ABI explicit __owns_two_states(__node<_CharT>* __s1, base* __s2) : base(__s1), __second_(__s2) {}
- _LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual ~__owns_two_states();
+ _LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual ~__owns_two_states();
- _LIBCPP_HIDE_FROM_ABI
- base* second() const {return __second_;}
- _LIBCPP_HIDE_FROM_ABI
- base*& second() {return __second_;}
+ _LIBCPP_HIDE_FROM_ABI base* second() const { return __second_; }
+ _LIBCPP_HIDE_FROM_ABI base*& second() { return __second_; }
};
template <class _CharT>
-__owns_two_states<_CharT>::~__owns_two_states()
-{
- delete __second_;
+__owns_two_states<_CharT>::~__owns_two_states() {
+ delete __second_;
}
// __loop
template <class _CharT>
-class __loop
- : public __owns_two_states<_CharT>
-{
- typedef __owns_two_states<_CharT> base;
+class __loop : public __owns_two_states<_CharT> {
+ typedef __owns_two_states<_CharT> base;
- size_t __min_;
- size_t __max_;
- unsigned __loop_id_;
- unsigned __mexp_begin_;
- unsigned __mexp_end_;
- bool __greedy_;
+ size_t __min_;
+ size_t __max_;
+ unsigned __loop_id_;
+ unsigned __mexp_begin_;
+ unsigned __mexp_end_;
+ bool __greedy_;
public:
- typedef std::__state<_CharT> __state;
-
- _LIBCPP_HIDE_FROM_ABI
- explicit __loop(unsigned __loop_id,
- __node<_CharT>* __s1, __owns_one_state<_CharT>* __s2,
- unsigned __mexp_begin, unsigned __mexp_end,
- bool __greedy = true,
- size_t __min = 0,
- size_t __max = numeric_limits<size_t>::max())
- : base(__s1, __s2), __min_(__min), __max_(__max), __loop_id_(__loop_id),
- __mexp_begin_(__mexp_begin), __mexp_end_(__mexp_end),
- __greedy_(__greedy) {}
-
- _LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual void __exec(__state& __s) const;
- _LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual void __exec_split(bool __second, __state& __s) const;
+ typedef std::__state<_CharT> __state;
+
+ _LIBCPP_HIDE_FROM_ABI explicit __loop(
+ unsigned __loop_id,
+ __node<_CharT>* __s1,
+ __owns_one_state<_CharT>* __s2,
+ unsigned __mexp_begin,
+ unsigned __mexp_end,
+ bool __greedy = true,
+ size_t __min = 0,
+ size_t __max = numeric_limits<size_t>::max())
+ : base(__s1, __s2),
+ __min_(__min),
+ __max_(__max),
+ __loop_id_(__loop_id),
+ __mexp_begin_(__mexp_begin),
+ __mexp_end_(__mexp_end),
+ __greedy_(__greedy) {}
+
+ _LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual void __exec(__state& __s) const;
+ _LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual void __exec_split(bool __second, __state& __s) const;
private:
- _LIBCPP_HIDE_FROM_ABI
- void __init_repeat(__state& __s) const
- {
- __s.__loop_data_[__loop_id_].second = __s.__current_;
- for (size_t __i = __mexp_begin_-1; __i != __mexp_end_-1; ++__i)
- {
- __s.__sub_matches_[__i].first = __s.__last_;
- __s.__sub_matches_[__i].second = __s.__last_;
- __s.__sub_matches_[__i].matched = false;
- }
+ _LIBCPP_HIDE_FROM_ABI void __init_repeat(__state& __s) const {
+ __s.__loop_data_[__loop_id_].second = __s.__current_;
+ for (size_t __i = __mexp_begin_ - 1; __i != __mexp_end_ - 1; ++__i) {
+ __s.__sub_matches_[__i].first = __s.__last_;
+ __s.__sub_matches_[__i].second = __s.__last_;
+ __s.__sub_matches_[__i].matched = false;
}
+ }
};
template <class _CharT>
-void
-__loop<_CharT>::__exec(__state& __s) const
-{
- if (__s.__do_ == __state::__repeat)
- {
- bool __do_repeat = ++__s.__loop_data_[__loop_id_].first < __max_;
- bool __do_alt = __s.__loop_data_[__loop_id_].first >= __min_;
- if (__do_repeat && __do_alt &&
- __s.__loop_data_[__loop_id_].second == __s.__current_)
- __do_repeat = false;
- if (__do_repeat && __do_alt)
- __s.__do_ = __state::__split;
- else if (__do_repeat)
- {
- __s.__do_ = __state::__accept_but_not_consume;
- __s.__node_ = this->first();
- __init_repeat(__s);
- }
- else
- {
- __s.__do_ = __state::__accept_but_not_consume;
- __s.__node_ = this->second();
- }
+void __loop<_CharT>::__exec(__state& __s) const {
+ if (__s.__do_ == __state::__repeat) {
+ bool __do_repeat = ++__s.__loop_data_[__loop_id_].first < __max_;
+ bool __do_alt = __s.__loop_data_[__loop_id_].first >= __min_;
+ if (__do_repeat && __do_alt && __s.__loop_data_[__loop_id_].second == __s.__current_)
+ __do_repeat = false;
+ if (__do_repeat && __do_alt)
+ __s.__do_ = __state::__split;
+ else if (__do_repeat) {
+ __s.__do_ = __state::__accept_but_not_consume;
+ __s.__node_ = this->first();
+ __init_repeat(__s);
+ } else {
+ __s.__do_ = __state::__accept_but_not_consume;
+ __s.__node_ = this->second();
}
- else
- {
- __s.__loop_data_[__loop_id_].first = 0;
- bool __do_repeat = 0 < __max_;
- bool __do_alt = 0 >= __min_;
- if (__do_repeat && __do_alt)
- __s.__do_ = __state::__split;
- else if (__do_repeat)
- {
- __s.__do_ = __state::__accept_but_not_consume;
- __s.__node_ = this->first();
- __init_repeat(__s);
- }
- else
- {
- __s.__do_ = __state::__accept_but_not_consume;
- __s.__node_ = this->second();
- }
+ } else {
+ __s.__loop_data_[__loop_id_].first = 0;
+ bool __do_repeat = 0 < __max_;
+ bool __do_alt = 0 >= __min_;
+ if (__do_repeat && __do_alt)
+ __s.__do_ = __state::__split;
+ else if (__do_repeat) {
+ __s.__do_ = __state::__accept_but_not_consume;
+ __s.__node_ = this->first();
+ __init_repeat(__s);
+ } else {
+ __s.__do_ = __state::__accept_but_not_consume;
+ __s.__node_ = this->second();
}
+ }
}
template <class _CharT>
-void
-__loop<_CharT>::__exec_split(bool __second, __state& __s) const
-{
- __s.__do_ = __state::__accept_but_not_consume;
- if (__greedy_ != __second)
- {
- __s.__node_ = this->first();
- __init_repeat(__s);
- }
- else
- __s.__node_ = this->second();
+void __loop<_CharT>::__exec_split(bool __second, __state& __s) const {
+ __s.__do_ = __state::__accept_but_not_consume;
+ if (__greedy_ != __second) {
+ __s.__node_ = this->first();
+ __init_repeat(__s);
+ } else
+ __s.__node_ = this->second();
}
// __alternate
template <class _CharT>
-class __alternate
- : public __owns_two_states<_CharT>
-{
- typedef __owns_two_states<_CharT> base;
+class __alternate : public __owns_two_states<_CharT> {
+ typedef __owns_two_states<_CharT> base;
public:
- typedef std::__state<_CharT> __state;
+ typedef std::__state<_CharT> __state;
- _LIBCPP_HIDE_FROM_ABI
- explicit __alternate(__owns_one_state<_CharT>* __s1,
- __owns_one_state<_CharT>* __s2)
- : base(__s1, __s2) {}
+ _LIBCPP_HIDE_FROM_ABI explicit __alternate(__owns_one_state<_CharT>* __s1, __owns_one_state<_CharT>* __s2)
+ : base(__s1, __s2) {}
- _LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual void __exec(__state& __s) const;
- _LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual void __exec_split(bool __second, __state& __s) const;
+ _LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual void __exec(__state& __s) const;
+ _LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual void __exec_split(bool __second, __state& __s) const;
};
template <class _CharT>
-void
-__alternate<_CharT>::__exec(__state& __s) const
-{
- __s.__do_ = __state::__split;
+void __alternate<_CharT>::__exec(__state& __s) const {
+ __s.__do_ = __state::__split;
}
template <class _CharT>
-void
-__alternate<_CharT>::__exec_split(bool __second, __state& __s) const
-{
- __s.__do_ = __state::__accept_but_not_consume;
- if (__second)
- __s.__node_ = this->second();
- else
- __s.__node_ = this->first();
+void __alternate<_CharT>::__exec_split(bool __second, __state& __s) const {
+ __s.__do_ = __state::__accept_but_not_consume;
+ if (__second)
+ __s.__node_ = this->second();
+ else
+ __s.__node_ = this->first();
}
// __begin_marked_subexpression
template <class _CharT>
-class __begin_marked_subexpression
- : public __owns_one_state<_CharT>
-{
- typedef __owns_one_state<_CharT> base;
+class __begin_marked_subexpression : public __owns_one_state<_CharT> {
+ typedef __owns_one_state<_CharT> base;
+
+ unsigned __mexp_;
- unsigned __mexp_;
public:
- typedef std::__state<_CharT> __state;
+ typedef std::__state<_CharT> __state;
- _LIBCPP_HIDE_FROM_ABI
- explicit __begin_marked_subexpression(unsigned __mexp, __node<_CharT>* __s)
- : base(__s), __mexp_(__mexp) {}
+ _LIBCPP_HIDE_FROM_ABI explicit __begin_marked_subexpression(unsigned __mexp, __node<_CharT>* __s)
+ : base(__s), __mexp_(__mexp) {}
- _LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual void __exec(__state&) const;
+ _LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual void __exec(__state&) const;
};
template <class _CharT>
-void
-__begin_marked_subexpression<_CharT>::__exec(__state& __s) const
-{
- __s.__do_ = __state::__accept_but_not_consume;
- __s.__sub_matches_[__mexp_-1].first = __s.__current_;
- __s.__node_ = this->first();
+void __begin_marked_subexpression<_CharT>::__exec(__state& __s) const {
+ __s.__do_ = __state::__accept_but_not_consume;
+ __s.__sub_matches_[__mexp_ - 1].first = __s.__current_;
+ __s.__node_ = this->first();
}
// __end_marked_subexpression
template <class _CharT>
-class __end_marked_subexpression
- : public __owns_one_state<_CharT>
-{
- typedef __owns_one_state<_CharT> base;
+class __end_marked_subexpression : public __owns_one_state<_CharT> {
+ typedef __owns_one_state<_CharT> base;
+
+ unsigned __mexp_;
- unsigned __mexp_;
public:
- typedef std::__state<_CharT> __state;
+ typedef std::__state<_CharT> __state;
- _LIBCPP_HIDE_FROM_ABI
- explicit __end_marked_subexpression(unsigned __mexp, __node<_CharT>* __s)
- : base(__s), __mexp_(__mexp) {}
+ _LIBCPP_HIDE_FROM_ABI explicit __end_marked_subexpression(unsigned __mexp, __node<_CharT>* __s)
+ : base(__s), __mexp_(__mexp) {}
- _LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual void __exec(__state&) const;
+ _LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual void __exec(__state&) const;
};
template <class _CharT>
-void
-__end_marked_subexpression<_CharT>::__exec(__state& __s) const
-{
- __s.__do_ = __state::__accept_but_not_consume;
- __s.__sub_matches_[__mexp_-1].second = __s.__current_;
- __s.__sub_matches_[__mexp_-1].matched = true;
- __s.__node_ = this->first();
+void __end_marked_subexpression<_CharT>::__exec(__state& __s) const {
+ __s.__do_ = __state::__accept_but_not_consume;
+ __s.__sub_matches_[__mexp_ - 1].second = __s.__current_;
+ __s.__sub_matches_[__mexp_ - 1].matched = true;
+ __s.__node_ = this->first();
}
// __back_ref
template <class _CharT>
-class __back_ref
- : public __owns_one_state<_CharT>
-{
- typedef __owns_one_state<_CharT> base;
+class __back_ref : public __owns_one_state<_CharT> {
+ typedef __owns_one_state<_CharT> base;
+
+ unsigned __mexp_;
- unsigned __mexp_;
public:
- typedef std::__state<_CharT> __state;
+ typedef std::__state<_CharT> __state;
- _LIBCPP_HIDE_FROM_ABI
- explicit __back_ref(unsigned __mexp, __node<_CharT>* __s)
- : base(__s), __mexp_(__mexp) {}
+ _LIBCPP_HIDE_FROM_ABI explicit __back_ref(unsigned __mexp, __node<_CharT>* __s) : base(__s), __mexp_(__mexp) {}
- _LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual void __exec(__state&) const;
+ _LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual void __exec(__state&) const;
};
template <class _CharT>
-void
-__back_ref<_CharT>::__exec(__state& __s) const
-{
- if (__mexp_ > __s.__sub_matches_.size())
- __throw_regex_error<regex_constants::error_backref>();
- sub_match<const _CharT*>& __sm = __s.__sub_matches_[__mexp_-1];
- if (__sm.matched)
- {
- ptrdiff_t __len = __sm.second - __sm.first;
- if (__s.__last_ - __s.__current_ >= __len &&
- std::equal(__sm.first, __sm.second, __s.__current_))
- {
- __s.__do_ = __state::__accept_but_not_consume;
- __s.__current_ += __len;
- __s.__node_ = this->first();
- }
- else
- {
- __s.__do_ = __state::__reject;
- __s.__node_ = nullptr;
- }
- }
- else
- {
- __s.__do_ = __state::__reject;
- __s.__node_ = nullptr;
+void __back_ref<_CharT>::__exec(__state& __s) const {
+ if (__mexp_ > __s.__sub_matches_.size())
+ __throw_regex_error<regex_constants::error_backref>();
+ sub_match<const _CharT*>& __sm = __s.__sub_matches_[__mexp_ - 1];
+ if (__sm.matched) {
+ ptrdiff_t __len = __sm.second - __sm.first;
+ if (__s.__last_ - __s.__current_ >= __len && std::equal(__sm.first, __sm.second, __s.__current_)) {
+ __s.__do_ = __state::__accept_but_not_consume;
+ __s.__current_ += __len;
+ __s.__node_ = this->first();
+ } else {
+ __s.__do_ = __state::__reject;
+ __s.__node_ = nullptr;
}
+ } else {
+ __s.__do_ = __state::__reject;
+ __s.__node_ = nullptr;
+ }
}
// __back_ref_icase
template <class _CharT, class _Traits>
-class __back_ref_icase
- : public __owns_one_state<_CharT>
-{
- typedef __owns_one_state<_CharT> base;
+class __back_ref_icase : public __owns_one_state<_CharT> {
+ typedef __owns_one_state<_CharT> base;
+
+ _Traits __traits_;
+ unsigned __mexp_;
- _Traits __traits_;
- unsigned __mexp_;
public:
- typedef std::__state<_CharT> __state;
+ typedef std::__state<_CharT> __state;
- _LIBCPP_HIDE_FROM_ABI
- explicit __back_ref_icase(const _Traits& __traits, unsigned __mexp,
- __node<_CharT>* __s)
- : base(__s), __traits_(__traits), __mexp_(__mexp) {}
+ _LIBCPP_HIDE_FROM_ABI explicit __back_ref_icase(const _Traits& __traits, unsigned __mexp, __node<_CharT>* __s)
+ : base(__s), __traits_(__traits), __mexp_(__mexp) {}
- _LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual void __exec(__state&) const;
+ _LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual void __exec(__state&) const;
};
template <class _CharT, class _Traits>
-void
-__back_ref_icase<_CharT, _Traits>::__exec(__state& __s) const
-{
- sub_match<const _CharT*>& __sm = __s.__sub_matches_[__mexp_-1];
- if (__sm.matched)
- {
- ptrdiff_t __len = __sm.second - __sm.first;
- if (__s.__last_ - __s.__current_ >= __len)
- {
- for (ptrdiff_t __i = 0; __i < __len; ++__i)
- {
- if (__traits_.translate_nocase(__sm.first[__i]) !=
- __traits_.translate_nocase(__s.__current_[__i]))
- goto __not_equal;
- }
- __s.__do_ = __state::__accept_but_not_consume;
- __s.__current_ += __len;
- __s.__node_ = this->first();
- }
- else
- {
- __s.__do_ = __state::__reject;
- __s.__node_ = nullptr;
- }
- }
- else
- {
-__not_equal:
- __s.__do_ = __state::__reject;
- __s.__node_ = nullptr;
+void __back_ref_icase<_CharT, _Traits>::__exec(__state& __s) const {
+ sub_match<const _CharT*>& __sm = __s.__sub_matches_[__mexp_ - 1];
+ if (__sm.matched) {
+ ptrdiff_t __len = __sm.second - __sm.first;
+ if (__s.__last_ - __s.__current_ >= __len) {
+ for (ptrdiff_t __i = 0; __i < __len; ++__i) {
+ if (__traits_.translate_nocase(__sm.first[__i]) != __traits_.translate_nocase(__s.__current_[__i]))
+ goto __not_equal;
+ }
+ __s.__do_ = __state::__accept_but_not_consume;
+ __s.__current_ += __len;
+ __s.__node_ = this->first();
+ } else {
+ __s.__do_ = __state::__reject;
+ __s.__node_ = nullptr;
}
+ } else {
+ __not_equal:
+ __s.__do_ = __state::__reject;
+ __s.__node_ = nullptr;
+ }
}
// __back_ref_collate
template <class _CharT, class _Traits>
-class __back_ref_collate
- : public __owns_one_state<_CharT>
-{
- typedef __owns_one_state<_CharT> base;
+class __back_ref_collate : public __owns_one_state<_CharT> {
+ typedef __owns_one_state<_CharT> base;
+
+ _Traits __traits_;
+ unsigned __mexp_;
- _Traits __traits_;
- unsigned __mexp_;
public:
- typedef std::__state<_CharT> __state;
+ typedef std::__state<_CharT> __state;
- _LIBCPP_HIDE_FROM_ABI
- explicit __back_ref_collate(const _Traits& __traits, unsigned __mexp,
- __node<_CharT>* __s)
- : base(__s), __traits_(__traits), __mexp_(__mexp) {}
+ _LIBCPP_HIDE_FROM_ABI explicit __back_ref_collate(const _Traits& __traits, unsigned __mexp, __node<_CharT>* __s)
+ : base(__s), __traits_(__traits), __mexp_(__mexp) {}
- _LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual void __exec(__state&) const;
+ _LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual void __exec(__state&) const;
};
template <class _CharT, class _Traits>
-void
-__back_ref_collate<_CharT, _Traits>::__exec(__state& __s) const
-{
- sub_match<const _CharT*>& __sm = __s.__sub_matches_[__mexp_-1];
- if (__sm.matched)
- {
- ptrdiff_t __len = __sm.second - __sm.first;
- if (__s.__last_ - __s.__current_ >= __len)
- {
- for (ptrdiff_t __i = 0; __i < __len; ++__i)
- {
- if (__traits_.translate(__sm.first[__i]) !=
- __traits_.translate(__s.__current_[__i]))
- goto __not_equal;
- }
- __s.__do_ = __state::__accept_but_not_consume;
- __s.__current_ += __len;
- __s.__node_ = this->first();
- }
- else
- {
- __s.__do_ = __state::__reject;
- __s.__node_ = nullptr;
- }
- }
- else
- {
-__not_equal:
- __s.__do_ = __state::__reject;
- __s.__node_ = nullptr;
+void __back_ref_collate<_CharT, _Traits>::__exec(__state& __s) const {
+ sub_match<const _CharT*>& __sm = __s.__sub_matches_[__mexp_ - 1];
+ if (__sm.matched) {
+ ptrdiff_t __len = __sm.second - __sm.first;
+ if (__s.__last_ - __s.__current_ >= __len) {
+ for (ptrdiff_t __i = 0; __i < __len; ++__i) {
+ if (__traits_.translate(__sm.first[__i]) != __traits_.translate(__s.__current_[__i]))
+ goto __not_equal;
+ }
+ __s.__do_ = __state::__accept_but_not_consume;
+ __s.__current_ += __len;
+ __s.__node_ = this->first();
+ } else {
+ __s.__do_ = __state::__reject;
+ __s.__node_ = nullptr;
}
+ } else {
+ __not_equal:
+ __s.__do_ = __state::__reject;
+ __s.__node_ = nullptr;
+ }
}
// __word_boundary
template <class _CharT, class _Traits>
-class __word_boundary
- : public __owns_one_state<_CharT>
-{
- typedef __owns_one_state<_CharT> base;
+class __word_boundary : public __owns_one_state<_CharT> {
+ typedef __owns_one_state<_CharT> base;
+
+ _Traits __traits_;
+ bool __invert_;
- _Traits __traits_;
- bool __invert_;
public:
- typedef std::__state<_CharT> __state;
+ typedef std::__state<_CharT> __state;
- _LIBCPP_HIDE_FROM_ABI
- explicit __word_boundary(const _Traits& __traits, bool __invert,
- __node<_CharT>* __s)
- : base(__s), __traits_(__traits), __invert_(__invert) {}
+ _LIBCPP_HIDE_FROM_ABI explicit __word_boundary(const _Traits& __traits, bool __invert, __node<_CharT>* __s)
+ : base(__s), __traits_(__traits), __invert_(__invert) {}
- _LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual void __exec(__state&) const;
+ _LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual void __exec(__state&) const;
};
template <class _CharT, class _Traits>
-void
-__word_boundary<_CharT, _Traits>::__exec(__state& __s) const
-{
- bool __is_word_b = false;
- if (__s.__first_ != __s.__last_)
- {
- if (__s.__current_ == __s.__last_)
- {
- if (!(__s.__flags_ & regex_constants::match_not_eow))
- {
- _CharT __c = __s.__current_[-1];
- __is_word_b = __c == '_' ||
- __traits_.isctype(__c, ctype_base::alnum);
- }
- }
- else if (__s.__current_ == __s.__first_ &&
- !(__s.__flags_ & regex_constants::match_prev_avail))
- {
- if (!(__s.__flags_ & regex_constants::match_not_bow))
- {
- _CharT __c = *__s.__current_;
- __is_word_b = __c == '_' ||
- __traits_.isctype(__c, ctype_base::alnum);
- }
- }
- else
- {
- _CharT __c1 = __s.__current_[-1];
- _CharT __c2 = *__s.__current_;
- bool __is_c1_b = __c1 == '_' ||
- __traits_.isctype(__c1, ctype_base::alnum);
- bool __is_c2_b = __c2 == '_' ||
- __traits_.isctype(__c2, ctype_base::alnum);
- __is_word_b = __is_c1_b != __is_c2_b;
- }
- }
- if (__is_word_b != __invert_)
- {
- __s.__do_ = __state::__accept_but_not_consume;
- __s.__node_ = this->first();
- }
- else
- {
- __s.__do_ = __state::__reject;
- __s.__node_ = nullptr;
+void __word_boundary<_CharT, _Traits>::__exec(__state& __s) const {
+ bool __is_word_b = false;
+ if (__s.__first_ != __s.__last_) {
+ if (__s.__current_ == __s.__last_) {
+ if (!(__s.__flags_ & regex_constants::match_not_eow)) {
+ _CharT __c = __s.__current_[-1];
+ __is_word_b = __c == '_' || __traits_.isctype(__c, ctype_base::alnum);
+ }
+ } else if (__s.__current_ == __s.__first_ && !(__s.__flags_ & regex_constants::match_prev_avail)) {
+ if (!(__s.__flags_ & regex_constants::match_not_bow)) {
+ _CharT __c = *__s.__current_;
+ __is_word_b = __c == '_' || __traits_.isctype(__c, ctype_base::alnum);
+ }
+ } else {
+ _CharT __c1 = __s.__current_[-1];
+ _CharT __c2 = *__s.__current_;
+ bool __is_c1_b = __c1 == '_' || __traits_.isctype(__c1, ctype_base::alnum);
+ bool __is_c2_b = __c2 == '_' || __traits_.isctype(__c2, ctype_base::alnum);
+ __is_word_b = __is_c1_b != __is_c2_b;
}
+ }
+ if (__is_word_b != __invert_) {
+ __s.__do_ = __state::__accept_but_not_consume;
+ __s.__node_ = this->first();
+ } else {
+ __s.__do_ = __state::__reject;
+ __s.__node_ = nullptr;
+ }
}
// __l_anchor
template <class _CharT>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR
-bool __is_eol(_CharT __c)
-{
- return __c == '\r' || __c == '\n';
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool __is_eol(_CharT __c) {
+ return __c == '\r' || __c == '\n';
}
template <class _CharT>
-class __l_anchor_multiline
- : public __owns_one_state<_CharT>
-{
- typedef __owns_one_state<_CharT> base;
+class __l_anchor_multiline : public __owns_one_state<_CharT> {
+ typedef __owns_one_state<_CharT> base;
- bool __multiline_;
+ bool __multiline_;
public:
- typedef std::__state<_CharT> __state;
+ typedef std::__state<_CharT> __state;
- _LIBCPP_HIDE_FROM_ABI
- __l_anchor_multiline(bool __multiline, __node<_CharT>* __s)
- : base(__s), __multiline_(__multiline) {}
+ _LIBCPP_HIDE_FROM_ABI __l_anchor_multiline(bool __multiline, __node<_CharT>* __s)
+ : base(__s), __multiline_(__multiline) {}
- _LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual void __exec(__state&) const;
+ _LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual void __exec(__state&) const;
};
template <class _CharT>
-void
-__l_anchor_multiline<_CharT>::__exec(__state& __s) const
-{
- if (__s.__at_first_ && __s.__current_ == __s.__first_ &&
- !(__s.__flags_ & regex_constants::match_not_bol))
- {
- __s.__do_ = __state::__accept_but_not_consume;
- __s.__node_ = this->first();
- }
- else if (__multiline_ &&
- !__s.__at_first_ &&
- std::__is_eol(*std::prev(__s.__current_)))
- {
- __s.__do_ = __state::__accept_but_not_consume;
- __s.__node_ = this->first();
- }
- else
- {
- __s.__do_ = __state::__reject;
- __s.__node_ = nullptr;
- }
+void __l_anchor_multiline<_CharT>::__exec(__state& __s) const {
+ if (__s.__at_first_ && __s.__current_ == __s.__first_ && !(__s.__flags_ & regex_constants::match_not_bol)) {
+ __s.__do_ = __state::__accept_but_not_consume;
+ __s.__node_ = this->first();
+ } else if (__multiline_ && !__s.__at_first_ && std::__is_eol(*std::prev(__s.__current_))) {
+ __s.__do_ = __state::__accept_but_not_consume;
+ __s.__node_ = this->first();
+ } else {
+ __s.__do_ = __state::__reject;
+ __s.__node_ = nullptr;
+ }
}
// __r_anchor
template <class _CharT>
-class __r_anchor_multiline
- : public __owns_one_state<_CharT>
-{
- typedef __owns_one_state<_CharT> base;
+class __r_anchor_multiline : public __owns_one_state<_CharT> {
+ typedef __owns_one_state<_CharT> base;
- bool __multiline_;
+ bool __multiline_;
public:
- typedef std::__state<_CharT> __state;
+ typedef std::__state<_CharT> __state;
- _LIBCPP_HIDE_FROM_ABI
- __r_anchor_multiline(bool __multiline, __node<_CharT>* __s)
- : base(__s), __multiline_(__multiline) {}
+ _LIBCPP_HIDE_FROM_ABI __r_anchor_multiline(bool __multiline, __node<_CharT>* __s)
+ : base(__s), __multiline_(__multiline) {}
- _LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual void __exec(__state&) const;
+ _LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual void __exec(__state&) const;
};
template <class _CharT>
-void
-__r_anchor_multiline<_CharT>::__exec(__state& __s) const
-{
- if (__s.__current_ == __s.__last_ &&
- !(__s.__flags_ & regex_constants::match_not_eol))
- {
- __s.__do_ = __state::__accept_but_not_consume;
- __s.__node_ = this->first();
- }
- else if (__multiline_ && std::__is_eol(*__s.__current_))
- {
- __s.__do_ = __state::__accept_but_not_consume;
- __s.__node_ = this->first();
- }
- else
- {
- __s.__do_ = __state::__reject;
- __s.__node_ = nullptr;
- }
+void __r_anchor_multiline<_CharT>::__exec(__state& __s) const {
+ if (__s.__current_ == __s.__last_ && !(__s.__flags_ & regex_constants::match_not_eol)) {
+ __s.__do_ = __state::__accept_but_not_consume;
+ __s.__node_ = this->first();
+ } else if (__multiline_ && std::__is_eol(*__s.__current_)) {
+ __s.__do_ = __state::__accept_but_not_consume;
+ __s.__node_ = this->first();
+ } else {
+ __s.__do_ = __state::__reject;
+ __s.__node_ = nullptr;
+ }
}
// __match_any
template <class _CharT>
-class __match_any
- : public __owns_one_state<_CharT>
-{
- typedef __owns_one_state<_CharT> base;
+class __match_any : public __owns_one_state<_CharT> {
+ typedef __owns_one_state<_CharT> base;
public:
- typedef std::__state<_CharT> __state;
+ typedef std::__state<_CharT> __state;
- _LIBCPP_HIDE_FROM_ABI
- __match_any(__node<_CharT>* __s)
- : base(__s) {}
+ _LIBCPP_HIDE_FROM_ABI __match_any(__node<_CharT>* __s) : base(__s) {}
- _LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual void __exec(__state&) const;
+ _LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual void __exec(__state&) const;
};
template <class _CharT>
-void
-__match_any<_CharT>::__exec(__state& __s) const
-{
- if (__s.__current_ != __s.__last_ && *__s.__current_ != 0)
- {
- __s.__do_ = __state::__accept_and_consume;
- ++__s.__current_;
- __s.__node_ = this->first();
- }
- else
- {
- __s.__do_ = __state::__reject;
- __s.__node_ = nullptr;
- }
+void __match_any<_CharT>::__exec(__state& __s) const {
+ if (__s.__current_ != __s.__last_ && *__s.__current_ != 0) {
+ __s.__do_ = __state::__accept_and_consume;
+ ++__s.__current_;
+ __s.__node_ = this->first();
+ } else {
+ __s.__do_ = __state::__reject;
+ __s.__node_ = nullptr;
+ }
}
// __match_any_but_newline
template <class _CharT>
-class __match_any_but_newline
- : public __owns_one_state<_CharT>
-{
- typedef __owns_one_state<_CharT> base;
+class __match_any_but_newline : public __owns_one_state<_CharT> {
+ typedef __owns_one_state<_CharT> base;
public:
- typedef std::__state<_CharT> __state;
+ typedef std::__state<_CharT> __state;
- _LIBCPP_HIDE_FROM_ABI
- __match_any_but_newline(__node<_CharT>* __s)
- : base(__s) {}
+ _LIBCPP_HIDE_FROM_ABI __match_any_but_newline(__node<_CharT>* __s) : base(__s) {}
- void __exec(__state&) const override;
+ void __exec(__state&) const override;
};
-template <> _LIBCPP_EXPORTED_FROM_ABI void __match_any_but_newline<char>::__exec(__state&) const;
+template <>
+_LIBCPP_EXPORTED_FROM_ABI void __match_any_but_newline<char>::__exec(__state&) const;
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
-template <> _LIBCPP_EXPORTED_FROM_ABI void __match_any_but_newline<wchar_t>::__exec(__state&) const;
+template <>
+_LIBCPP_EXPORTED_FROM_ABI void __match_any_but_newline<wchar_t>::__exec(__state&) const;
#endif
// __match_char
template <class _CharT>
-class __match_char
- : public __owns_one_state<_CharT>
-{
- typedef __owns_one_state<_CharT> base;
+class __match_char : public __owns_one_state<_CharT> {
+ typedef __owns_one_state<_CharT> base;
- _CharT __c_;
+ _CharT __c_;
+
+ __match_char(const __match_char&);
+ __match_char& operator=(const __match_char&);
- __match_char(const __match_char&);
- __match_char& operator=(const __match_char&);
public:
- typedef std::__state<_CharT> __state;
+ typedef std::__state<_CharT> __state;
- _LIBCPP_HIDE_FROM_ABI
- __match_char(_CharT __c, __node<_CharT>* __s)
- : base(__s), __c_(__c) {}
+ _LIBCPP_HIDE_FROM_ABI __match_char(_CharT __c, __node<_CharT>* __s) : base(__s), __c_(__c) {}
- _LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual void __exec(__state&) const;
+ _LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual void __exec(__state&) const;
};
template <class _CharT>
-void
-__match_char<_CharT>::__exec(__state& __s) const
-{
- if (__s.__current_ != __s.__last_ && *__s.__current_ == __c_)
- {
- __s.__do_ = __state::__accept_and_consume;
- ++__s.__current_;
- __s.__node_ = this->first();
- }
- else
- {
- __s.__do_ = __state::__reject;
- __s.__node_ = nullptr;
- }
+void __match_char<_CharT>::__exec(__state& __s) const {
+ if (__s.__current_ != __s.__last_ && *__s.__current_ == __c_) {
+ __s.__do_ = __state::__accept_and_consume;
+ ++__s.__current_;
+ __s.__node_ = this->first();
+ } else {
+ __s.__do_ = __state::__reject;
+ __s.__node_ = nullptr;
+ }
}
// __match_char_icase
template <class _CharT, class _Traits>
-class __match_char_icase
- : public __owns_one_state<_CharT>
-{
- typedef __owns_one_state<_CharT> base;
+class __match_char_icase : public __owns_one_state<_CharT> {
+ typedef __owns_one_state<_CharT> base;
- _Traits __traits_;
- _CharT __c_;
+ _Traits __traits_;
+ _CharT __c_;
+
+ __match_char_icase(const __match_char_icase&);
+ __match_char_icase& operator=(const __match_char_icase&);
- __match_char_icase(const __match_char_icase&);
- __match_char_icase& operator=(const __match_char_icase&);
public:
- typedef std::__state<_CharT> __state;
+ typedef std::__state<_CharT> __state;
- _LIBCPP_HIDE_FROM_ABI
- __match_char_icase(const _Traits& __traits, _CharT __c, __node<_CharT>* __s)
- : base(__s), __traits_(__traits), __c_(__traits.translate_nocase(__c)) {}
+ _LIBCPP_HIDE_FROM_ABI __match_char_icase(const _Traits& __traits, _CharT __c, __node<_CharT>* __s)
+ : base(__s), __traits_(__traits), __c_(__traits.translate_nocase(__c)) {}
- _LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual void __exec(__state&) const;
+ _LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual void __exec(__state&) const;
};
template <class _CharT, class _Traits>
-void
-__match_char_icase<_CharT, _Traits>::__exec(__state& __s) const
-{
- if (__s.__current_ != __s.__last_ &&
- __traits_.translate_nocase(*__s.__current_) == __c_)
- {
- __s.__do_ = __state::__accept_and_consume;
- ++__s.__current_;
- __s.__node_ = this->first();
- }
- else
- {
- __s.__do_ = __state::__reject;
- __s.__node_ = nullptr;
- }
+void __match_char_icase<_CharT, _Traits>::__exec(__state& __s) const {
+ if (__s.__current_ != __s.__last_ && __traits_.translate_nocase(*__s.__current_) == __c_) {
+ __s.__do_ = __state::__accept_and_consume;
+ ++__s.__current_;
+ __s.__node_ = this->first();
+ } else {
+ __s.__do_ = __state::__reject;
+ __s.__node_ = nullptr;
+ }
}
// __match_char_collate
template <class _CharT, class _Traits>
-class __match_char_collate
- : public __owns_one_state<_CharT>
-{
- typedef __owns_one_state<_CharT> base;
+class __match_char_collate : public __owns_one_state<_CharT> {
+ typedef __owns_one_state<_CharT> base;
+
+ _Traits __traits_;
+ _CharT __c_;
- _Traits __traits_;
- _CharT __c_;
+ __match_char_collate(const __match_char_collate&);
+ __match_char_collate& operator=(const __match_char_collate&);
- __match_char_collate(const __match_char_collate&);
- __match_char_collate& operator=(const __match_char_collate&);
public:
- typedef std::__state<_CharT> __state;
+ typedef std::__state<_CharT> __state;
- _LIBCPP_HIDE_FROM_ABI
- __match_char_collate(const _Traits& __traits, _CharT __c, __node<_CharT>* __s)
- : base(__s), __traits_(__traits), __c_(__traits.translate(__c)) {}
+ _LIBCPP_HIDE_FROM_ABI __match_char_collate(const _Traits& __traits, _CharT __c, __node<_CharT>* __s)
+ : base(__s), __traits_(__traits), __c_(__traits.translate(__c)) {}
- _LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual void __exec(__state&) const;
+ _LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual void __exec(__state&) const;
};
template <class _CharT, class _Traits>
-void
-__match_char_collate<_CharT, _Traits>::__exec(__state& __s) const
-{
- if (__s.__current_ != __s.__last_ &&
- __traits_.translate(*__s.__current_) == __c_)
- {
- __s.__do_ = __state::__accept_and_consume;
- ++__s.__current_;
- __s.__node_ = this->first();
- }
- else
- {
- __s.__do_ = __state::__reject;
- __s.__node_ = nullptr;
- }
+void __match_char_collate<_CharT, _Traits>::__exec(__state& __s) const {
+ if (__s.__current_ != __s.__last_ && __traits_.translate(*__s.__current_) == __c_) {
+ __s.__do_ = __state::__accept_and_consume;
+ ++__s.__current_;
+ __s.__node_ = this->first();
+ } else {
+ __s.__do_ = __state::__reject;
+ __s.__node_ = nullptr;
+ }
}
// __bracket_expression
template <class _CharT, class _Traits>
-class __bracket_expression
- : public __owns_one_state<_CharT>
-{
- typedef __owns_one_state<_CharT> base;
- typedef typename _Traits::string_type string_type;
-
- _Traits __traits_;
- vector<_CharT> __chars_;
- vector<_CharT> __neg_chars_;
- vector<pair<string_type, string_type> > __ranges_;
- vector<pair<_CharT, _CharT> > __digraphs_;
- vector<string_type> __equivalences_;
- typename regex_traits<_CharT>::char_class_type __mask_;
- typename regex_traits<_CharT>::char_class_type __neg_mask_;
- bool __negate_;
- bool __icase_;
- bool __collate_;
- bool __might_have_digraph_;
-
- __bracket_expression(const __bracket_expression&);
- __bracket_expression& operator=(const __bracket_expression&);
+class __bracket_expression : public __owns_one_state<_CharT> {
+ typedef __owns_one_state<_CharT> base;
+ typedef typename _Traits::string_type string_type;
+
+ _Traits __traits_;
+ vector<_CharT> __chars_;
+ vector<_CharT> __neg_chars_;
+ vector<pair<string_type, string_type> > __ranges_;
+ vector<pair<_CharT, _CharT> > __digraphs_;
+ vector<string_type> __equivalences_;
+ typename regex_traits<_CharT>::char_class_type __mask_;
+ typename regex_traits<_CharT>::char_class_type __neg_mask_;
+ bool __negate_;
+ bool __icase_;
+ bool __collate_;
+ bool __might_have_digraph_;
+
+ __bracket_expression(const __bracket_expression&);
+ __bracket_expression& operator=(const __bracket_expression&);
+
public:
- typedef std::__state<_CharT> __state;
-
- _LIBCPP_HIDE_FROM_ABI
- __bracket_expression(const _Traits& __traits, __node<_CharT>* __s,
- bool __negate, bool __icase, bool __collate)
- : base(__s), __traits_(__traits), __mask_(), __neg_mask_(),
- __negate_(__negate), __icase_(__icase), __collate_(__collate),
- __might_have_digraph_(__traits_.getloc().name() != "C") {}
-
- _LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual void __exec(__state&) const;
-
- _LIBCPP_HIDE_FROM_ABI
- bool __negated() const {return __negate_;}
-
- _LIBCPP_HIDE_FROM_ABI
- void __add_char(_CharT __c)
- {
- if (__icase_)
- __chars_.push_back(__traits_.translate_nocase(__c));
- else if (__collate_)
- __chars_.push_back(__traits_.translate(__c));
- else
- __chars_.push_back(__c);
- }
- _LIBCPP_HIDE_FROM_ABI
- void __add_neg_char(_CharT __c)
- {
- if (__icase_)
- __neg_chars_.push_back(__traits_.translate_nocase(__c));
- else if (__collate_)
- __neg_chars_.push_back(__traits_.translate(__c));
- else
- __neg_chars_.push_back(__c);
- }
- _LIBCPP_HIDE_FROM_ABI
- void __add_range(string_type __b, string_type __e)
- {
- if (__collate_)
- {
- if (__icase_)
- {
- for (size_t __i = 0; __i < __b.size(); ++__i)
- __b[__i] = __traits_.translate_nocase(__b[__i]);
- for (size_t __i = 0; __i < __e.size(); ++__i)
- __e[__i] = __traits_.translate_nocase(__e[__i]);
- }
- else
- {
- for (size_t __i = 0; __i < __b.size(); ++__i)
- __b[__i] = __traits_.translate(__b[__i]);
- for (size_t __i = 0; __i < __e.size(); ++__i)
- __e[__i] = __traits_.translate(__e[__i]);
- }
- __ranges_.push_back(std::make_pair(
- __traits_.transform(__b.begin(), __b.end()),
- __traits_.transform(__e.begin(), __e.end())));
- }
- else
- {
- if (__b.size() != 1 || __e.size() != 1)
- __throw_regex_error<regex_constants::error_range>();
- if (__icase_)
- {
- __b[0] = __traits_.translate_nocase(__b[0]);
- __e[0] = __traits_.translate_nocase(__e[0]);
- }
- __ranges_.push_back(std::make_pair(std::move(__b), std::move(__e)));
- }
- }
- _LIBCPP_HIDE_FROM_ABI
- void __add_digraph(_CharT __c1, _CharT __c2)
- {
- if (__icase_)
- __digraphs_.push_back(std::make_pair(__traits_.translate_nocase(__c1),
- __traits_.translate_nocase(__c2)));
- else if (__collate_)
- __digraphs_.push_back(std::make_pair(__traits_.translate(__c1),
- __traits_.translate(__c2)));
- else
- __digraphs_.push_back(std::make_pair(__c1, __c2));
- }
- _LIBCPP_HIDE_FROM_ABI
- void __add_equivalence(const string_type& __s)
- {__equivalences_.push_back(__s);}
- _LIBCPP_HIDE_FROM_ABI
- void __add_class(typename regex_traits<_CharT>::char_class_type __mask)
- {__mask_ |= __mask;}
- _LIBCPP_HIDE_FROM_ABI
- void __add_neg_class(typename regex_traits<_CharT>::char_class_type __mask)
- {__neg_mask_ |= __mask;}
+ typedef std::__state<_CharT> __state;
+
+ _LIBCPP_HIDE_FROM_ABI
+ __bracket_expression(const _Traits& __traits, __node<_CharT>* __s, bool __negate, bool __icase, bool __collate)
+ : base(__s),
+ __traits_(__traits),
+ __mask_(),
+ __neg_mask_(),
+ __negate_(__negate),
+ __icase_(__icase),
+ __collate_(__collate),
+ __might_have_digraph_(__traits_.getloc().name() != "C") {}
+
+ _LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual void __exec(__state&) const;
+
+ _LIBCPP_HIDE_FROM_ABI bool __negated() const { return __negate_; }
+
+ _LIBCPP_HIDE_FROM_ABI void __add_char(_CharT __c) {
+ if (__icase_)
+ __chars_.push_back(__traits_.translate_nocase(__c));
+ else if (__collate_)
+ __chars_.push_back(__traits_.translate(__c));
+ else
+ __chars_.push_back(__c);
+ }
+ _LIBCPP_HIDE_FROM_ABI void __add_neg_char(_CharT __c) {
+ if (__icase_)
+ __neg_chars_.push_back(__traits_.translate_nocase(__c));
+ else if (__collate_)
+ __neg_chars_.push_back(__traits_.translate(__c));
+ else
+ __neg_chars_.push_back(__c);
+ }
+ _LIBCPP_HIDE_FROM_ABI void __add_range(string_type __b, string_type __e) {
+ if (__collate_) {
+ if (__icase_) {
+ for (size_t __i = 0; __i < __b.size(); ++__i)
+ __b[__i] = __traits_.translate_nocase(__b[__i]);
+ for (size_t __i = 0; __i < __e.size(); ++__i)
+ __e[__i] = __traits_.translate_nocase(__e[__i]);
+ } else {
+ for (size_t __i = 0; __i < __b.size(); ++__i)
+ __b[__i] = __traits_.translate(__b[__i]);
+ for (size_t __i = 0; __i < __e.size(); ++__i)
+ __e[__i] = __traits_.translate(__e[__i]);
+ }
+ __ranges_.push_back(
+ std::make_pair(__traits_.transform(__b.begin(), __b.end()), __traits_.transform(__e.begin(), __e.end())));
+ } else {
+ if (__b.size() != 1 || __e.size() != 1)
+ __throw_regex_error<regex_constants::error_range>();
+ if (__icase_) {
+ __b[0] = __traits_.translate_nocase(__b[0]);
+ __e[0] = __traits_.translate_nocase(__e[0]);
+ }
+ __ranges_.push_back(std::make_pair(std::move(__b), std::move(__e)));
+ }
+ }
+ _LIBCPP_HIDE_FROM_ABI void __add_digraph(_CharT __c1, _CharT __c2) {
+ if (__icase_)
+ __digraphs_.push_back(std::make_pair(__traits_.translate_nocase(__c1), __traits_.translate_nocase(__c2)));
+ else if (__collate_)
+ __digraphs_.push_back(std::make_pair(__traits_.translate(__c1), __traits_.translate(__c2)));
+ else
+ __digraphs_.push_back(std::make_pair(__c1, __c2));
+ }
+ _LIBCPP_HIDE_FROM_ABI void __add_equivalence(const string_type& __s) { __equivalences_.push_back(__s); }
+ _LIBCPP_HIDE_FROM_ABI void __add_class(typename regex_traits<_CharT>::char_class_type __mask) { __mask_ |= __mask; }
+ _LIBCPP_HIDE_FROM_ABI void __add_neg_class(typename regex_traits<_CharT>::char_class_type __mask) {
+ __neg_mask_ |= __mask;
+ }
};
template <class _CharT, class _Traits>
-void
-__bracket_expression<_CharT, _Traits>::__exec(__state& __s) const
-{
- bool __found = false;
- unsigned __consumed = 0;
- if (__s.__current_ != __s.__last_)
- {
- ++__consumed;
- if (__might_have_digraph_)
- {
- const _CharT* __next = std::next(__s.__current_);
- if (__next != __s.__last_)
- {
- pair<_CharT, _CharT> __ch2(*__s.__current_, *__next);
- if (__icase_)
- {
- __ch2.first = __traits_.translate_nocase(__ch2.first);
- __ch2.second = __traits_.translate_nocase(__ch2.second);
- }
- else if (__collate_)
- {
- __ch2.first = __traits_.translate(__ch2.first);
- __ch2.second = __traits_.translate(__ch2.second);
- }
- if (!__traits_.lookup_collatename(&__ch2.first, &__ch2.first+2).empty())
- {
- // __ch2 is a digraph in this locale
- ++__consumed;
- for (size_t __i = 0; __i < __digraphs_.size(); ++__i)
- {
- if (__ch2 == __digraphs_[__i])
- {
- __found = true;
- goto __exit;
- }
- }
- if (__collate_ && !__ranges_.empty())
- {
- string_type __s2 = __traits_.transform(&__ch2.first,
- &__ch2.first + 2);
- for (size_t __i = 0; __i < __ranges_.size(); ++__i)
- {
- if (__ranges_[__i].first <= __s2 &&
- __s2 <= __ranges_[__i].second)
- {
- __found = true;
- goto __exit;
- }
- }
- }
- if (!__equivalences_.empty())
- {
- string_type __s2 = __traits_.transform_primary(&__ch2.first,
- &__ch2.first + 2);
- for (size_t __i = 0; __i < __equivalences_.size(); ++__i)
- {
- if (__s2 == __equivalences_[__i])
- {
- __found = true;
- goto __exit;
- }
- }
- }
- if (__traits_.isctype(__ch2.first, __mask_) &&
- __traits_.isctype(__ch2.second, __mask_))
- {
- __found = true;
- goto __exit;
- }
- if (!__traits_.isctype(__ch2.first, __neg_mask_) &&
- !__traits_.isctype(__ch2.second, __neg_mask_))
- {
- __found = true;
- goto __exit;
- }
- goto __exit;
- }
- }
+void __bracket_expression<_CharT, _Traits>::__exec(__state& __s) const {
+ bool __found = false;
+ unsigned __consumed = 0;
+ if (__s.__current_ != __s.__last_) {
+ ++__consumed;
+ if (__might_have_digraph_) {
+ const _CharT* __next = std::next(__s.__current_);
+ if (__next != __s.__last_) {
+ pair<_CharT, _CharT> __ch2(*__s.__current_, *__next);
+ if (__icase_) {
+ __ch2.first = __traits_.translate_nocase(__ch2.first);
+ __ch2.second = __traits_.translate_nocase(__ch2.second);
+ } else if (__collate_) {
+ __ch2.first = __traits_.translate(__ch2.first);
+ __ch2.second = __traits_.translate(__ch2.second);
}
- // test *__s.__current_ as not a digraph
- _CharT __ch = *__s.__current_;
- if (__icase_)
- __ch = __traits_.translate_nocase(__ch);
- else if (__collate_)
- __ch = __traits_.translate(__ch);
- for (size_t __i = 0; __i < __chars_.size(); ++__i)
- {
- if (__ch == __chars_[__i])
- {
+ if (!__traits_.lookup_collatename(&__ch2.first, &__ch2.first + 2).empty()) {
+ // __ch2 is a digraph in this locale
+ ++__consumed;
+ for (size_t __i = 0; __i < __digraphs_.size(); ++__i) {
+ if (__ch2 == __digraphs_[__i]) {
+ __found = true;
+ goto __exit;
+ }
+ }
+ if (__collate_ && !__ranges_.empty()) {
+ string_type __s2 = __traits_.transform(&__ch2.first, &__ch2.first + 2);
+ for (size_t __i = 0; __i < __ranges_.size(); ++__i) {
+ if (__ranges_[__i].first <= __s2 && __s2 <= __ranges_[__i].second) {
__found = true;
goto __exit;
+ }
}
- }
- // When there's at least one of __neg_chars_ and __neg_mask_, the set
- // of "__found" chars is
- // union(complement(union(__neg_chars_, __neg_mask_)),
- // other cases...)
- //
- // It doesn't make sense to check this when there are no __neg_chars_
- // and no __neg_mask_.
- if (!(__neg_mask_ == 0 && __neg_chars_.empty()))
- {
- const bool __in_neg_mask = __traits_.isctype(__ch, __neg_mask_);
- const bool __in_neg_chars =
- std::find(__neg_chars_.begin(), __neg_chars_.end(), __ch) !=
- __neg_chars_.end();
- if (!(__in_neg_mask || __in_neg_chars))
- {
+ }
+ if (!__equivalences_.empty()) {
+ string_type __s2 = __traits_.transform_primary(&__ch2.first, &__ch2.first + 2);
+ for (size_t __i = 0; __i < __equivalences_.size(); ++__i) {
+ if (__s2 == __equivalences_[__i]) {
+ __found = true;
+ goto __exit;
+ }
+ }
+ }
+ if (__traits_.isctype(__ch2.first, __mask_) && __traits_.isctype(__ch2.second, __mask_)) {
__found = true;
goto __exit;
}
- }
- if (!__ranges_.empty())
- {
- string_type __s2 = __collate_ ?
- __traits_.transform(&__ch, &__ch + 1) :
- string_type(1, __ch);
- for (size_t __i = 0; __i < __ranges_.size(); ++__i)
- {
- if (__ranges_[__i].first <= __s2 && __s2 <= __ranges_[__i].second)
- {
- __found = true;
- goto __exit;
- }
- }
- }
- if (!__equivalences_.empty())
- {
- string_type __s2 = __traits_.transform_primary(&__ch, &__ch + 1);
- for (size_t __i = 0; __i < __equivalences_.size(); ++__i)
- {
- if (__s2 == __equivalences_[__i])
- {
- __found = true;
- goto __exit;
- }
- }
- }
- if (__traits_.isctype(__ch, __mask_))
- {
+ if (!__traits_.isctype(__ch2.first, __neg_mask_) && !__traits_.isctype(__ch2.second, __neg_mask_)) {
__found = true;
goto __exit;
+ }
+ goto __exit;
}
+ }
}
- else
- __found = __negate_; // force reject
-__exit:
- if (__found != __negate_)
- {
- __s.__do_ = __state::__accept_and_consume;
- __s.__current_ += __consumed;
- __s.__node_ = this->first();
+ // test *__s.__current_ as not a digraph
+ _CharT __ch = *__s.__current_;
+ if (__icase_)
+ __ch = __traits_.translate_nocase(__ch);
+ else if (__collate_)
+ __ch = __traits_.translate(__ch);
+ for (size_t __i = 0; __i < __chars_.size(); ++__i) {
+ if (__ch == __chars_[__i]) {
+ __found = true;
+ goto __exit;
+ }
}
- else
- {
- __s.__do_ = __state::__reject;
- __s.__node_ = nullptr;
+ // When there's at least one of __neg_chars_ and __neg_mask_, the set
+ // of "__found" chars is
+ // union(complement(union(__neg_chars_, __neg_mask_)),
+ // other cases...)
+ //
+ // It doesn't make sense to check this when there are no __neg_chars_
+ // and no __neg_mask_.
+ if (!(__neg_mask_ == 0 && __neg_chars_.empty())) {
+ const bool __in_neg_mask = __traits_.isctype(__ch, __neg_mask_);
+ const bool __in_neg_chars = std::find(__neg_chars_.begin(), __neg_chars_.end(), __ch) != __neg_chars_.end();
+ if (!(__in_neg_mask || __in_neg_chars)) {
+ __found = true;
+ goto __exit;
+ }
}
+ if (!__ranges_.empty()) {
+ string_type __s2 = __collate_ ? __traits_.transform(&__ch, &__ch + 1) : string_type(1, __ch);
+ for (size_t __i = 0; __i < __ranges_.size(); ++__i) {
+ if (__ranges_[__i].first <= __s2 && __s2 <= __ranges_[__i].second) {
+ __found = true;
+ goto __exit;
+ }
+ }
+ }
+ if (!__equivalences_.empty()) {
+ string_type __s2 = __traits_.transform_primary(&__ch, &__ch + 1);
+ for (size_t __i = 0; __i < __equivalences_.size(); ++__i) {
+ if (__s2 == __equivalences_[__i]) {
+ __found = true;
+ goto __exit;
+ }
+ }
+ }
+ if (__traits_.isctype(__ch, __mask_)) {
+ __found = true;
+ goto __exit;
+ }
+ } else
+ __found = __negate_; // force reject
+__exit:
+ if (__found != __negate_) {
+ __s.__do_ = __state::__accept_and_consume;
+ __s.__current_ += __consumed;
+ __s.__node_ = this->first();
+ } else {
+ __s.__do_ = __state::__reject;
+ __s.__node_ = nullptr;
+ }
}
-template <class _CharT, class _Traits> class __lookahead;
+template <class _CharT, class _Traits>
+class __lookahead;
template <class _CharT, class _Traits = regex_traits<_CharT> >
- class _LIBCPP_TEMPLATE_VIS basic_regex;
+class _LIBCPP_TEMPLATE_VIS basic_regex;
-typedef basic_regex<char> regex;
+typedef basic_regex<char> regex;
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
typedef basic_regex<wchar_t> wregex;
#endif
template <class _CharT, class _Traits>
-class
- _LIBCPP_TEMPLATE_VIS
- _LIBCPP_PREFERRED_NAME(regex)
- _LIBCPP_IF_WIDE_CHARACTERS(_LIBCPP_PREFERRED_NAME(wregex))
- basic_regex
-{
+class _LIBCPP_TEMPLATE_VIS _LIBCPP_PREFERRED_NAME(regex)
+ _LIBCPP_IF_WIDE_CHARACTERS(_LIBCPP_PREFERRED_NAME(wregex)) basic_regex {
public:
- // types:
- typedef _CharT value_type;
- typedef _Traits traits_type;
- typedef typename _Traits::string_type string_type;
- typedef regex_constants::syntax_option_type flag_type;
- typedef typename _Traits::locale_type locale_type;
+ // types:
+ typedef _CharT value_type;
+ typedef _Traits traits_type;
+ typedef typename _Traits::string_type string_type;
+ typedef regex_constants::syntax_option_type flag_type;
+ typedef typename _Traits::locale_type locale_type;
private:
- _Traits __traits_;
- flag_type __flags_;
- unsigned __marked_count_;
- unsigned __loop_count_;
- int __open_count_;
- shared_ptr<__empty_state<_CharT> > __start_;
- __owns_one_state<_CharT>* __end_;
+ _Traits __traits_;
+ flag_type __flags_;
+ unsigned __marked_count_;
+ unsigned __loop_count_;
+ int __open_count_;
+ shared_ptr<__empty_state<_CharT> > __start_;
+ __owns_one_state<_CharT>* __end_;
- typedef std::__state<_CharT> __state;
- typedef std::__node<_CharT> __node;
+ typedef std::__state<_CharT> __state;
+ typedef std::__node<_CharT> __node;
public:
- // constants:
- static const regex_constants::syntax_option_type icase = regex_constants::icase;
- static const regex_constants::syntax_option_type nosubs = regex_constants::nosubs;
- static const regex_constants::syntax_option_type optimize = regex_constants::optimize;
- static const regex_constants::syntax_option_type collate = regex_constants::collate;
- static const regex_constants::syntax_option_type ECMAScript = regex_constants::ECMAScript;
- static const regex_constants::syntax_option_type basic = regex_constants::basic;
- static const regex_constants::syntax_option_type extended = regex_constants::extended;
- static const regex_constants::syntax_option_type awk = regex_constants::awk;
- static const regex_constants::syntax_option_type grep = regex_constants::grep;
- static const regex_constants::syntax_option_type egrep = regex_constants::egrep;
- static const regex_constants::syntax_option_type multiline = regex_constants::multiline;
-
- // construct/copy/destroy:
- _LIBCPP_HIDE_FROM_ABI
- basic_regex()
- : __flags_(regex_constants::ECMAScript), __marked_count_(0), __loop_count_(0), __open_count_(0),
- __end_(nullptr)
- {}
- _LIBCPP_HIDE_FROM_ABI
- explicit basic_regex(const value_type* __p, flag_type __f = regex_constants::ECMAScript)
- : __flags_(__f), __marked_count_(0), __loop_count_(0), __open_count_(0),
- __end_(nullptr)
- {
- __init(__p, __p + __traits_.length(__p));
- }
-
- _LIBCPP_HIDE_FROM_ABI
- basic_regex(const value_type* __p, size_t __len, flag_type __f = regex_constants::ECMAScript)
- : __flags_(__f), __marked_count_(0), __loop_count_(0), __open_count_(0),
- __end_(nullptr)
- {
- __init(__p, __p + __len);
- }
-
-// basic_regex(const basic_regex&) = default;
-// basic_regex(basic_regex&&) = default;
- template <class _ST, class _SA>
- _LIBCPP_HIDE_FROM_ABI
- explicit basic_regex(const basic_string<value_type, _ST, _SA>& __p,
- flag_type __f = regex_constants::ECMAScript)
- : __flags_(__f), __marked_count_(0), __loop_count_(0), __open_count_(0),
- __end_(nullptr)
- {
- __init(__p.begin(), __p.end());
- }
-
- template <class _ForwardIterator>
- _LIBCPP_HIDE_FROM_ABI
- basic_regex(_ForwardIterator __first, _ForwardIterator __last,
- flag_type __f = regex_constants::ECMAScript)
- : __flags_(__f), __marked_count_(0), __loop_count_(0), __open_count_(0),
- __end_(nullptr)
- {
- __init(__first, __last);
- }
+ // constants:
+ static const regex_constants::syntax_option_type icase = regex_constants::icase;
+ static const regex_constants::syntax_option_type nosubs = regex_constants::nosubs;
+ static const regex_constants::syntax_option_type optimize = regex_constants::optimize;
+ static const regex_constants::syntax_option_type collate = regex_constants::collate;
+ static const regex_constants::syntax_option_type ECMAScript = regex_constants::ECMAScript;
+ static const regex_constants::syntax_option_type basic = regex_constants::basic;
+ static const regex_constants::syntax_option_type extended = regex_constants::extended;
+ static const regex_constants::syntax_option_type awk = regex_constants::awk;
+ static const regex_constants::syntax_option_type grep = regex_constants::grep;
+ static const regex_constants::syntax_option_type egrep = regex_constants::egrep;
+ static const regex_constants::syntax_option_type multiline = regex_constants::multiline;
+
+ // construct/copy/destroy:
+ _LIBCPP_HIDE_FROM_ABI basic_regex()
+ : __flags_(regex_constants::ECMAScript),
+ __marked_count_(0),
+ __loop_count_(0),
+ __open_count_(0),
+ __end_(nullptr) {}
+ _LIBCPP_HIDE_FROM_ABI explicit basic_regex(const value_type* __p, flag_type __f = regex_constants::ECMAScript)
+ : __flags_(__f), __marked_count_(0), __loop_count_(0), __open_count_(0), __end_(nullptr) {
+ __init(__p, __p + __traits_.length(__p));
+ }
+
+ _LIBCPP_HIDE_FROM_ABI basic_regex(const value_type* __p, size_t __len, flag_type __f = regex_constants::ECMAScript)
+ : __flags_(__f), __marked_count_(0), __loop_count_(0), __open_count_(0), __end_(nullptr) {
+ __init(__p, __p + __len);
+ }
+
+ // basic_regex(const basic_regex&) = default;
+ // basic_regex(basic_regex&&) = default;
+ template <class _ST, class _SA>
+ _LIBCPP_HIDE_FROM_ABI explicit basic_regex(const basic_string<value_type, _ST, _SA>& __p,
+ flag_type __f = regex_constants::ECMAScript)
+ : __flags_(__f), __marked_count_(0), __loop_count_(0), __open_count_(0), __end_(nullptr) {
+ __init(__p.begin(), __p.end());
+ }
+
+ template <class _ForwardIterator>
+ _LIBCPP_HIDE_FROM_ABI
+ basic_regex(_ForwardIterator __first, _ForwardIterator __last, flag_type __f = regex_constants::ECMAScript)
+ : __flags_(__f), __marked_count_(0), __loop_count_(0), __open_count_(0), __end_(nullptr) {
+ __init(__first, __last);
+ }
#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI
- basic_regex(initializer_list<value_type> __il,
- flag_type __f = regex_constants::ECMAScript)
- : __flags_(__f), __marked_count_(0), __loop_count_(0), __open_count_(0),
- __end_(nullptr)
- {
- __init(__il.begin(), __il.end());
- }
+ _LIBCPP_HIDE_FROM_ABI basic_regex(initializer_list<value_type> __il, flag_type __f = regex_constants::ECMAScript)
+ : __flags_(__f), __marked_count_(0), __loop_count_(0), __open_count_(0), __end_(nullptr) {
+ __init(__il.begin(), __il.end());
+ }
#endif // _LIBCPP_CXX03_LANG
-// ~basic_regex() = default;
+ // ~basic_regex() = default;
-// basic_regex& operator=(const basic_regex&) = default;
-// basic_regex& operator=(basic_regex&&) = default;
- _LIBCPP_HIDE_FROM_ABI
- basic_regex& operator=(const value_type* __p)
- {return assign(__p);}
+ // basic_regex& operator=(const basic_regex&) = default;
+ // basic_regex& operator=(basic_regex&&) = default;
+ _LIBCPP_HIDE_FROM_ABI basic_regex& operator=(const value_type* __p) { return assign(__p); }
#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI
- basic_regex& operator=(initializer_list<value_type> __il)
- {return assign(__il);}
+ _LIBCPP_HIDE_FROM_ABI basic_regex& operator=(initializer_list<value_type> __il) { return assign(__il); }
#endif // _LIBCPP_CXX03_LANG
- template <class _ST, class _SA>
- _LIBCPP_HIDE_FROM_ABI
- basic_regex& operator=(const basic_string<value_type, _ST, _SA>& __p)
- {return assign(__p);}
+ template <class _ST, class _SA>
+ _LIBCPP_HIDE_FROM_ABI basic_regex& operator=(const basic_string<value_type, _ST, _SA>& __p) {
+ return assign(__p);
+ }
- // assign:
- _LIBCPP_HIDE_FROM_ABI
- basic_regex& assign(const basic_regex& __that)
- {return *this = __that;}
+ // assign:
+ _LIBCPP_HIDE_FROM_ABI basic_regex& assign(const basic_regex& __that) { return *this = __that; }
#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI
- basic_regex& assign(basic_regex&& __that) _NOEXCEPT
- {return *this = std::move(__that);}
+ _LIBCPP_HIDE_FROM_ABI basic_regex& assign(basic_regex&& __that) _NOEXCEPT { return *this = std::move(__that); }
#endif
- _LIBCPP_HIDE_FROM_ABI
- basic_regex& assign(const value_type* __p, flag_type __f = regex_constants::ECMAScript)
- {return assign(__p, __p + __traits_.length(__p), __f);}
- _LIBCPP_HIDE_FROM_ABI
- basic_regex& assign(const value_type* __p, size_t __len, flag_type __f = regex_constants::ECMAScript)
- {return assign(__p, __p + __len, __f);}
- template <class _ST, class _SA>
- _LIBCPP_HIDE_FROM_ABI
- basic_regex& assign(const basic_string<value_type, _ST, _SA>& __s,
- flag_type __f = regex_constants::ECMAScript)
- {return assign(__s.begin(), __s.end(), __f);}
-
- template <class _InputIterator, __enable_if_t<__has_exactly_input_iterator_category<_InputIterator>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI
- basic_regex&
- assign(_InputIterator __first, _InputIterator __last,
- flag_type __f = regex_constants::ECMAScript)
- {
- basic_string<_CharT> __t(__first, __last);
- return assign(__t.begin(), __t.end(), __f);
- }
+ _LIBCPP_HIDE_FROM_ABI basic_regex& assign(const value_type* __p, flag_type __f = regex_constants::ECMAScript) {
+ return assign(__p, __p + __traits_.length(__p), __f);
+ }
+ _LIBCPP_HIDE_FROM_ABI basic_regex&
+ assign(const value_type* __p, size_t __len, flag_type __f = regex_constants::ECMAScript) {
+ return assign(__p, __p + __len, __f);
+ }
+ template <class _ST, class _SA>
+ _LIBCPP_HIDE_FROM_ABI basic_regex&
+ assign(const basic_string<value_type, _ST, _SA>& __s, flag_type __f = regex_constants::ECMAScript) {
+ return assign(__s.begin(), __s.end(), __f);
+ }
+
+ template <class _InputIterator, __enable_if_t<__has_exactly_input_iterator_category<_InputIterator>::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI basic_regex&
+ assign(_InputIterator __first, _InputIterator __last, flag_type __f = regex_constants::ECMAScript) {
+ basic_string<_CharT> __t(__first, __last);
+ return assign(__t.begin(), __t.end(), __f);
+ }
private:
- _LIBCPP_HIDE_FROM_ABI
- void __member_init(flag_type __f)
- {
- __flags_ = __f;
- __marked_count_ = 0;
- __loop_count_ = 0;
- __open_count_ = 0;
- __end_ = nullptr;
- }
-public:
+ _LIBCPP_HIDE_FROM_ABI void __member_init(flag_type __f) {
+ __flags_ = __f;
+ __marked_count_ = 0;
+ __loop_count_ = 0;
+ __open_count_ = 0;
+ __end_ = nullptr;
+ }
- template <class _ForwardIterator, __enable_if_t<__has_forward_iterator_category<_ForwardIterator>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI
- basic_regex&
- assign(_ForwardIterator __first, _ForwardIterator __last,
- flag_type __f = regex_constants::ECMAScript)
- {
- return assign(basic_regex(__first, __last, __f));
- }
+public:
+ template <class _ForwardIterator, __enable_if_t<__has_forward_iterator_category<_ForwardIterator>::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI basic_regex&
+ assign(_ForwardIterator __first, _ForwardIterator __last, flag_type __f = regex_constants::ECMAScript) {
+ return assign(basic_regex(__first, __last, __f));
+ }
#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI
- basic_regex& assign(initializer_list<value_type> __il,
- flag_type __f = regex_constants::ECMAScript)
- {return assign(__il.begin(), __il.end(), __f);}
+ _LIBCPP_HIDE_FROM_ABI basic_regex&
+ assign(initializer_list<value_type> __il, flag_type __f = regex_constants::ECMAScript) {
+ return assign(__il.begin(), __il.end(), __f);
+ }
#endif // _LIBCPP_CXX03_LANG
- // const operations:
- _LIBCPP_HIDE_FROM_ABI
- unsigned mark_count() const {return __marked_count_;}
- _LIBCPP_HIDE_FROM_ABI
- flag_type flags() const {return __flags_;}
+ // const operations:
+ _LIBCPP_HIDE_FROM_ABI unsigned mark_count() const { return __marked_count_; }
+ _LIBCPP_HIDE_FROM_ABI flag_type flags() const { return __flags_; }
- // locale:
- _LIBCPP_HIDE_FROM_ABI
- locale_type imbue(locale_type __loc)
- {
- __member_init(ECMAScript);
- __start_.reset();
- return __traits_.imbue(__loc);
- }
- _LIBCPP_HIDE_FROM_ABI
- locale_type getloc() const {return __traits_.getloc();}
+ // locale:
+ _LIBCPP_HIDE_FROM_ABI locale_type imbue(locale_type __loc) {
+ __member_init(ECMAScript);
+ __start_.reset();
+ return __traits_.imbue(__loc);
+ }
+ _LIBCPP_HIDE_FROM_ABI locale_type getloc() const { return __traits_.getloc(); }
- // swap:
- void swap(basic_regex& __r);
+ // swap:
+ void swap(basic_regex& __r);
private:
- _LIBCPP_HIDE_FROM_ABI
- unsigned __loop_count() const {return __loop_count_;}
-
- _LIBCPP_HIDE_FROM_ABI
- bool __use_multiline() const
- {
- return __get_grammar(__flags_) == ECMAScript && (__flags_ & multiline);
- }
-
- template <class _ForwardIterator>
- void
- __init(_ForwardIterator __first, _ForwardIterator __last);
- template <class _ForwardIterator>
- _ForwardIterator
- __parse(_ForwardIterator __first, _ForwardIterator __last);
- template <class _ForwardIterator>
- _ForwardIterator
- __parse_basic_reg_exp(_ForwardIterator __first, _ForwardIterator __last);
- template <class _ForwardIterator>
- _ForwardIterator
- __parse_RE_expression(_ForwardIterator __first, _ForwardIterator __last);
- template <class _ForwardIterator>
- _ForwardIterator
- __parse_simple_RE(_ForwardIterator __first, _ForwardIterator __last);
- template <class _ForwardIterator>
- _ForwardIterator
- __parse_nondupl_RE(_ForwardIterator __first, _ForwardIterator __last);
- template <class _ForwardIterator>
- _ForwardIterator
- __parse_one_char_or_coll_elem_RE(_ForwardIterator __first, _ForwardIterator __last);
- template <class _ForwardIterator>
- _ForwardIterator
- __parse_Back_open_paren(_ForwardIterator __first, _ForwardIterator __last);
- template <class _ForwardIterator>
- _ForwardIterator
- __parse_Back_close_paren(_ForwardIterator __first, _ForwardIterator __last);
- template <class _ForwardIterator>
- _ForwardIterator
- __parse_Back_open_brace(_ForwardIterator __first, _ForwardIterator __last);
- template <class _ForwardIterator>
- _ForwardIterator
- __parse_Back_close_brace(_ForwardIterator __first, _ForwardIterator __last);
- template <class _ForwardIterator>
- _ForwardIterator
- __parse_BACKREF(_ForwardIterator __first, _ForwardIterator __last);
- template <class _ForwardIterator>
- _ForwardIterator
- __parse_ORD_CHAR(_ForwardIterator __first, _ForwardIterator __last);
- template <class _ForwardIterator>
- _ForwardIterator
- __parse_QUOTED_CHAR(_ForwardIterator __first, _ForwardIterator __last);
- template <class _ForwardIterator>
- _ForwardIterator
- __parse_RE_dupl_symbol(_ForwardIterator __first, _ForwardIterator __last,
- __owns_one_state<_CharT>* __s,
- unsigned __mexp_begin, unsigned __mexp_end);
- template <class _ForwardIterator>
- _ForwardIterator
- __parse_ERE_dupl_symbol(_ForwardIterator __first, _ForwardIterator __last,
- __owns_one_state<_CharT>* __s,
- unsigned __mexp_begin, unsigned __mexp_end);
- template <class _ForwardIterator>
- _ForwardIterator
- __parse_bracket_expression(_ForwardIterator __first, _ForwardIterator __last);
- template <class _ForwardIterator>
- _ForwardIterator
- __parse_follow_list(_ForwardIterator __first, _ForwardIterator __last,
- __bracket_expression<_CharT, _Traits>* __ml);
- template <class _ForwardIterator>
- _ForwardIterator
- __parse_expression_term(_ForwardIterator __first, _ForwardIterator __last,
- __bracket_expression<_CharT, _Traits>* __ml);
- template <class _ForwardIterator>
- _ForwardIterator
- __parse_equivalence_class(_ForwardIterator __first, _ForwardIterator __last,
- __bracket_expression<_CharT, _Traits>* __ml);
- template <class _ForwardIterator>
- _ForwardIterator
- __parse_character_class(_ForwardIterator __first, _ForwardIterator __last,
- __bracket_expression<_CharT, _Traits>* __ml);
- template <class _ForwardIterator>
- _ForwardIterator
- __parse_collating_symbol(_ForwardIterator __first, _ForwardIterator __last,
- basic_string<_CharT>& __col_sym);
- template <class _ForwardIterator>
- _ForwardIterator
- __parse_DUP_COUNT(_ForwardIterator __first, _ForwardIterator __last, int& __c);
- template <class _ForwardIterator>
- _ForwardIterator
- __parse_extended_reg_exp(_ForwardIterator __first, _ForwardIterator __last);
- template <class _ForwardIterator>
- _ForwardIterator
- __parse_ERE_branch(_ForwardIterator __first, _ForwardIterator __last);
- template <class _ForwardIterator>
- _ForwardIterator
- __parse_ERE_expression(_ForwardIterator __first, _ForwardIterator __last);
- template <class _ForwardIterator>
- _ForwardIterator
- __parse_one_char_or_coll_elem_ERE(_ForwardIterator __first, _ForwardIterator __last);
- template <class _ForwardIterator>
- _ForwardIterator
- __parse_ORD_CHAR_ERE(_ForwardIterator __first, _ForwardIterator __last);
- template <class _ForwardIterator>
- _ForwardIterator
- __parse_QUOTED_CHAR_ERE(_ForwardIterator __first, _ForwardIterator __last);
- template <class _ForwardIterator>
- _ForwardIterator
- __parse_ecma_exp(_ForwardIterator __first, _ForwardIterator __last);
- template <class _ForwardIterator>
- _ForwardIterator
- __parse_alternative(_ForwardIterator __first, _ForwardIterator __last);
- template <class _ForwardIterator>
- _ForwardIterator
- __parse_term(_ForwardIterator __first, _ForwardIterator __last);
- template <class _ForwardIterator>
- _ForwardIterator
- __parse_assertion(_ForwardIterator __first, _ForwardIterator __last);
- template <class _ForwardIterator>
- _ForwardIterator
- __parse_atom(_ForwardIterator __first, _ForwardIterator __last);
- template <class _ForwardIterator>
- _ForwardIterator
- __parse_atom_escape(_ForwardIterator __first, _ForwardIterator __last);
- template <class _ForwardIterator>
- _ForwardIterator
- __parse_decimal_escape(_ForwardIterator __first, _ForwardIterator __last);
- template <class _ForwardIterator>
- _ForwardIterator
- __parse_character_class_escape(_ForwardIterator __first, _ForwardIterator __last);
- template <class _ForwardIterator>
- _ForwardIterator
- __parse_character_escape(_ForwardIterator __first, _ForwardIterator __last,
- basic_string<_CharT>* __str = nullptr);
- template <class _ForwardIterator>
- _ForwardIterator
- __parse_pattern_character(_ForwardIterator __first, _ForwardIterator __last);
- template <class _ForwardIterator>
- _ForwardIterator
- __parse_grep(_ForwardIterator __first, _ForwardIterator __last);
- template <class _ForwardIterator>
- _ForwardIterator
- __parse_egrep(_ForwardIterator __first, _ForwardIterator __last);
- template <class _ForwardIterator>
- _ForwardIterator
- __parse_class_escape(_ForwardIterator __first, _ForwardIterator __last,
- basic_string<_CharT>& __str,
- __bracket_expression<_CharT, _Traits>* __ml);
- template <class _ForwardIterator>
- _ForwardIterator
- __parse_awk_escape(_ForwardIterator __first, _ForwardIterator __last,
- basic_string<_CharT>* __str = nullptr);
-
- bool __test_back_ref(_CharT);
-
- _LIBCPP_HIDE_FROM_ABI
- void __push_l_anchor();
- void __push_r_anchor();
- void __push_match_any();
- void __push_match_any_but_newline();
- _LIBCPP_HIDE_FROM_ABI
- void __push_greedy_inf_repeat(size_t __min, __owns_one_state<_CharT>* __s,
- unsigned __mexp_begin = 0, unsigned __mexp_end = 0)
- {__push_loop(__min, numeric_limits<size_t>::max(), __s,
- __mexp_begin, __mexp_end);}
- _LIBCPP_HIDE_FROM_ABI
- void __push_nongreedy_inf_repeat(size_t __min, __owns_one_state<_CharT>* __s,
- unsigned __mexp_begin = 0, unsigned __mexp_end = 0)
- {__push_loop(__min, numeric_limits<size_t>::max(), __s,
- __mexp_begin, __mexp_end, false);}
- void __push_loop(size_t __min, size_t __max, __owns_one_state<_CharT>* __s,
- size_t __mexp_begin = 0, size_t __mexp_end = 0,
- bool __greedy = true);
- __bracket_expression<_CharT, _Traits>* __start_matching_list(bool __negate);
- void __push_char(value_type __c);
- void __push_back_ref(int __i);
- void __push_alternation(__owns_one_state<_CharT>* __sa,
- __owns_one_state<_CharT>* __sb);
- void __push_begin_marked_subexpression();
- void __push_end_marked_subexpression(unsigned);
- void __push_empty();
- void __push_word_boundary(bool);
- void __push_lookahead(const basic_regex&, bool, unsigned);
-
- template <class _Allocator>
- bool
- __search(const _CharT* __first, const _CharT* __last,
- match_results<const _CharT*, _Allocator>& __m,
- regex_constants::match_flag_type __flags) const;
-
- template <class _Allocator>
- bool
- __match_at_start(const _CharT* __first, const _CharT* __last,
- match_results<const _CharT*, _Allocator>& __m,
- regex_constants::match_flag_type __flags, bool) const;
- template <class _Allocator>
- bool
- __match_at_start_ecma(const _CharT* __first, const _CharT* __last,
- match_results<const _CharT*, _Allocator>& __m,
- regex_constants::match_flag_type __flags, bool) const;
- template <class _Allocator>
- bool
- __match_at_start_posix_nosubs(const _CharT* __first, const _CharT* __last,
- match_results<const _CharT*, _Allocator>& __m,
- regex_constants::match_flag_type __flags, bool) const;
- template <class _Allocator>
- bool
- __match_at_start_posix_subs(const _CharT* __first, const _CharT* __last,
- match_results<const _CharT*, _Allocator>& __m,
- regex_constants::match_flag_type __flags, bool) const;
-
- template <class _Bp, class _Ap, class _Cp, class _Tp>
- friend
- bool
- regex_search(_Bp, _Bp, match_results<_Bp, _Ap>&, const basic_regex<_Cp, _Tp>&,
- regex_constants::match_flag_type);
-
- template <class _Ap, class _Cp, class _Tp>
- friend
- bool
- regex_search(const _Cp*, const _Cp*, match_results<const _Cp*, _Ap>&,
- const basic_regex<_Cp, _Tp>&, regex_constants::match_flag_type);
-
- template <class _Bp, class _Cp, class _Tp>
- friend
- bool
- regex_search(_Bp, _Bp, const basic_regex<_Cp, _Tp>&,
- regex_constants::match_flag_type);
-
- template <class _Cp, class _Tp>
- friend
- bool
- regex_search(const _Cp*, const _Cp*,
- const basic_regex<_Cp, _Tp>&, regex_constants::match_flag_type);
-
- template <class _Cp, class _Ap, class _Tp>
- friend
- bool
- regex_search(const _Cp*, match_results<const _Cp*, _Ap>&, const basic_regex<_Cp, _Tp>&,
- regex_constants::match_flag_type);
-
- template <class _ST, class _SA, class _Cp, class _Tp>
- friend
- bool
- regex_search(const basic_string<_Cp, _ST, _SA>& __s,
- const basic_regex<_Cp, _Tp>& __e,
- regex_constants::match_flag_type __flags);
-
- template <class _ST, class _SA, class _Ap, class _Cp, class _Tp>
- friend
- bool
- regex_search(const basic_string<_Cp, _ST, _SA>& __s,
- match_results<typename basic_string<_Cp, _ST, _SA>::const_iterator, _Ap>&,
- const basic_regex<_Cp, _Tp>& __e,
- regex_constants::match_flag_type __flags);
-
- template <class _Iter, class _Ap, class _Cp, class _Tp>
- friend
- bool
- regex_search(__wrap_iter<_Iter> __first,
- __wrap_iter<_Iter> __last,
- match_results<__wrap_iter<_Iter>, _Ap>& __m,
- const basic_regex<_Cp, _Tp>& __e,
- regex_constants::match_flag_type __flags);
-
- template <class, class> friend class __lookahead;
+ _LIBCPP_HIDE_FROM_ABI unsigned __loop_count() const { return __loop_count_; }
+
+ _LIBCPP_HIDE_FROM_ABI bool __use_multiline() const {
+ return __get_grammar(__flags_) == ECMAScript && (__flags_ & multiline);
+ }
+
+ template <class _ForwardIterator>
+ void __init(_ForwardIterator __first, _ForwardIterator __last);
+ template <class _ForwardIterator>
+ _ForwardIterator __parse(_ForwardIterator __first, _ForwardIterator __last);
+ template <class _ForwardIterator>
+ _ForwardIterator __parse_basic_reg_exp(_ForwardIterator __first, _ForwardIterator __last);
+ template <class _ForwardIterator>
+ _ForwardIterator __parse_RE_expression(_ForwardIterator __first, _ForwardIterator __last);
+ template <class _ForwardIterator>
+ _ForwardIterator __parse_simple_RE(_ForwardIterator __first, _ForwardIterator __last);
+ template <class _ForwardIterator>
+ _ForwardIterator __parse_nondupl_RE(_ForwardIterator __first, _ForwardIterator __last);
+ template <class _ForwardIterator>
+ _ForwardIterator __parse_one_char_or_coll_elem_RE(_ForwardIterator __first, _ForwardIterator __last);
+ template <class _ForwardIterator>
+ _ForwardIterator __parse_Back_open_paren(_ForwardIterator __first, _ForwardIterator __last);
+ template <class _ForwardIterator>
+ _ForwardIterator __parse_Back_close_paren(_ForwardIterator __first, _ForwardIterator __last);
+ template <class _ForwardIterator>
+ _ForwardIterator __parse_Back_open_brace(_ForwardIterator __first, _ForwardIterator __last);
+ template <class _ForwardIterator>
+ _ForwardIterator __parse_Back_close_brace(_ForwardIterator __first, _ForwardIterator __last);
+ template <class _ForwardIterator>
+ _ForwardIterator __parse_BACKREF(_ForwardIterator __first, _ForwardIterator __last);
+ template <class _ForwardIterator>
+ _ForwardIterator __parse_ORD_CHAR(_ForwardIterator __first, _ForwardIterator __last);
+ template <class _ForwardIterator>
+ _ForwardIterator __parse_QUOTED_CHAR(_ForwardIterator __first, _ForwardIterator __last);
+ template <class _ForwardIterator>
+ _ForwardIterator __parse_RE_dupl_symbol(
+ _ForwardIterator __first,
+ _ForwardIterator __last,
+ __owns_one_state<_CharT>* __s,
+ unsigned __mexp_begin,
+ unsigned __mexp_end);
+ template <class _ForwardIterator>
+ _ForwardIterator __parse_ERE_dupl_symbol(
+ _ForwardIterator __first,
+ _ForwardIterator __last,
+ __owns_one_state<_CharT>* __s,
+ unsigned __mexp_begin,
+ unsigned __mexp_end);
+ template <class _ForwardIterator>
+ _ForwardIterator __parse_bracket_expression(_ForwardIterator __first, _ForwardIterator __last);
+ template <class _ForwardIterator>
+ _ForwardIterator
+ __parse_follow_list(_ForwardIterator __first, _ForwardIterator __last, __bracket_expression<_CharT, _Traits>* __ml);
+ template <class _ForwardIterator>
+ _ForwardIterator __parse_expression_term(
+ _ForwardIterator __first, _ForwardIterator __last, __bracket_expression<_CharT, _Traits>* __ml);
+ template <class _ForwardIterator>
+ _ForwardIterator __parse_equivalence_class(
+ _ForwardIterator __first, _ForwardIterator __last, __bracket_expression<_CharT, _Traits>* __ml);
+ template <class _ForwardIterator>
+ _ForwardIterator __parse_character_class(
+ _ForwardIterator __first, _ForwardIterator __last, __bracket_expression<_CharT, _Traits>* __ml);
+ template <class _ForwardIterator>
+ _ForwardIterator
+ __parse_collating_symbol(_ForwardIterator __first, _ForwardIterator __last, basic_string<_CharT>& __col_sym);
+ template <class _ForwardIterator>
+ _ForwardIterator __parse_DUP_COUNT(_ForwardIterator __first, _ForwardIterator __last, int& __c);
+ template <class _ForwardIterator>
+ _ForwardIterator __parse_extended_reg_exp(_ForwardIterator __first, _ForwardIterator __last);
+ template <class _ForwardIterator>
+ _ForwardIterator __parse_ERE_branch(_ForwardIterator __first, _ForwardIterator __last);
+ template <class _ForwardIterator>
+ _ForwardIterator __parse_ERE_expression(_ForwardIterator __first, _ForwardIterator __last);
+ template <class _ForwardIterator>
+ _ForwardIterator __parse_one_char_or_coll_elem_ERE(_ForwardIterator __first, _ForwardIterator __last);
+ template <class _ForwardIterator>
+ _ForwardIterator __parse_ORD_CHAR_ERE(_ForwardIterator __first, _ForwardIterator __last);
+ template <class _ForwardIterator>
+ _ForwardIterator __parse_QUOTED_CHAR_ERE(_ForwardIterator __first, _ForwardIterator __last);
+ template <class _ForwardIterator>
+ _ForwardIterator __parse_ecma_exp(_ForwardIterator __first, _ForwardIterator __last);
+ template <class _ForwardIterator>
+ _ForwardIterator __parse_alternative(_ForwardIterator __first, _ForwardIterator __last);
+ template <class _ForwardIterator>
+ _ForwardIterator __parse_term(_ForwardIterator __first, _ForwardIterator __last);
+ template <class _ForwardIterator>
+ _ForwardIterator __parse_assertion(_ForwardIterator __first, _ForwardIterator __last);
+ template <class _ForwardIterator>
+ _ForwardIterator __parse_atom(_ForwardIterator __first, _ForwardIterator __last);
+ template <class _ForwardIterator>
+ _ForwardIterator __parse_atom_escape(_ForwardIterator __first, _ForwardIterator __last);
+ template <class _ForwardIterator>
+ _ForwardIterator __parse_decimal_escape(_ForwardIterator __first, _ForwardIterator __last);
+ template <class _ForwardIterator>
+ _ForwardIterator __parse_character_class_escape(_ForwardIterator __first, _ForwardIterator __last);
+ template <class _ForwardIterator>
+ _ForwardIterator
+ __parse_character_escape(_ForwardIterator __first, _ForwardIterator __last, basic_string<_CharT>* __str = nullptr);
+ template <class _ForwardIterator>
+ _ForwardIterator __parse_pattern_character(_ForwardIterator __first, _ForwardIterator __last);
+ template <class _ForwardIterator>
+ _ForwardIterator __parse_grep(_ForwardIterator __first, _ForwardIterator __last);
+ template <class _ForwardIterator>
+ _ForwardIterator __parse_egrep(_ForwardIterator __first, _ForwardIterator __last);
+ template <class _ForwardIterator>
+ _ForwardIterator __parse_class_escape(
+ _ForwardIterator __first,
+ _ForwardIterator __last,
+ basic_string<_CharT>& __str,
+ __bracket_expression<_CharT, _Traits>* __ml);
+ template <class _ForwardIterator>
+ _ForwardIterator
+ __parse_awk_escape(_ForwardIterator __first, _ForwardIterator __last, basic_string<_CharT>* __str = nullptr);
+
+ bool __test_back_ref(_CharT);
+
+ _LIBCPP_HIDE_FROM_ABI void __push_l_anchor();
+ void __push_r_anchor();
+ void __push_match_any();
+ void __push_match_any_but_newline();
+ _LIBCPP_HIDE_FROM_ABI void __push_greedy_inf_repeat(
+ size_t __min, __owns_one_state<_CharT>* __s, unsigned __mexp_begin = 0, unsigned __mexp_end = 0) {
+ __push_loop(__min, numeric_limits<size_t>::max(), __s, __mexp_begin, __mexp_end);
+ }
+ _LIBCPP_HIDE_FROM_ABI void __push_nongreedy_inf_repeat(
+ size_t __min, __owns_one_state<_CharT>* __s, unsigned __mexp_begin = 0, unsigned __mexp_end = 0) {
+ __push_loop(__min, numeric_limits<size_t>::max(), __s, __mexp_begin, __mexp_end, false);
+ }
+ void __push_loop(size_t __min,
+ size_t __max,
+ __owns_one_state<_CharT>* __s,
+ size_t __mexp_begin = 0,
+ size_t __mexp_end = 0,
+ bool __greedy = true);
+ __bracket_expression<_CharT, _Traits>* __start_matching_list(bool __negate);
+ void __push_char(value_type __c);
+ void __push_back_ref(int __i);
+ void __push_alternation(__owns_one_state<_CharT>* __sa, __owns_one_state<_CharT>* __sb);
+ void __push_begin_marked_subexpression();
+ void __push_end_marked_subexpression(unsigned);
+ void __push_empty();
+ void __push_word_boundary(bool);
+ void __push_lookahead(const basic_regex&, bool, unsigned);
+
+ template <class _Allocator>
+ bool __search(const _CharT* __first,
+ const _CharT* __last,
+ match_results<const _CharT*, _Allocator>& __m,
+ regex_constants::match_flag_type __flags) const;
+
+ template <class _Allocator>
+ bool __match_at_start(const _CharT* __first,
+ const _CharT* __last,
+ match_results<const _CharT*, _Allocator>& __m,
+ regex_constants::match_flag_type __flags,
+ bool) const;
+ template <class _Allocator>
+ bool __match_at_start_ecma(
+ const _CharT* __first,
+ const _CharT* __last,
+ match_results<const _CharT*, _Allocator>& __m,
+ regex_constants::match_flag_type __flags,
+ bool) const;
+ template <class _Allocator>
+ bool __match_at_start_posix_nosubs(
+ const _CharT* __first,
+ const _CharT* __last,
+ match_results<const _CharT*, _Allocator>& __m,
+ regex_constants::match_flag_type __flags,
+ bool) const;
+ template <class _Allocator>
+ bool __match_at_start_posix_subs(
+ const _CharT* __first,
+ const _CharT* __last,
+ match_results<const _CharT*, _Allocator>& __m,
+ regex_constants::match_flag_type __flags,
+ bool) const;
+
+ template <class _Bp, class _Ap, class _Cp, class _Tp>
+ friend bool
+ regex_search(_Bp, _Bp, match_results<_Bp, _Ap>&, const basic_regex<_Cp, _Tp>&, regex_constants::match_flag_type);
+
+ template <class _Ap, class _Cp, class _Tp>
+ friend bool
+ regex_search(const _Cp*,
+ const _Cp*,
+ match_results<const _Cp*, _Ap>&,
+ const basic_regex<_Cp, _Tp>&,
+ regex_constants::match_flag_type);
+
+ template <class _Bp, class _Cp, class _Tp>
+ friend bool regex_search(_Bp, _Bp, const basic_regex<_Cp, _Tp>&, regex_constants::match_flag_type);
+
+ template <class _Cp, class _Tp>
+ friend bool regex_search(const _Cp*, const _Cp*, const basic_regex<_Cp, _Tp>&, regex_constants::match_flag_type);
+
+ template <class _Cp, class _Ap, class _Tp>
+ friend bool regex_search(
+ const _Cp*, match_results<const _Cp*, _Ap>&, const basic_regex<_Cp, _Tp>&, regex_constants::match_flag_type);
+
+ template <class _ST, class _SA, class _Cp, class _Tp>
+ friend bool regex_search(const basic_string<_Cp, _ST, _SA>& __s,
+ const basic_regex<_Cp, _Tp>& __e,
+ regex_constants::match_flag_type __flags);
+
+ template <class _ST, class _SA, class _Ap, class _Cp, class _Tp>
+ friend bool regex_search(const basic_string<_Cp, _ST, _SA>& __s,
+ match_results<typename basic_string<_Cp, _ST, _SA>::const_iterator, _Ap>&,
+ const basic_regex<_Cp, _Tp>& __e,
+ regex_constants::match_flag_type __flags);
+
+ template <class _Iter, class _Ap, class _Cp, class _Tp>
+ friend bool
+ regex_search(__wrap_iter<_Iter> __first,
+ __wrap_iter<_Iter> __last,
+ match_results<__wrap_iter<_Iter>, _Ap>& __m,
+ const basic_regex<_Cp, _Tp>& __e,
+ regex_constants::match_flag_type __flags);
+
+ template <class, class>
+ friend class __lookahead;
};
#if _LIBCPP_STD_VER >= 17
-template <class _ForwardIterator,
- __enable_if_t<__has_forward_iterator_category<_ForwardIterator>::value, int> = 0>
-basic_regex(_ForwardIterator, _ForwardIterator,
- regex_constants::syntax_option_type = regex_constants::ECMAScript)
+template <class _ForwardIterator, __enable_if_t<__has_forward_iterator_category<_ForwardIterator>::value, int> = 0>
+basic_regex(_ForwardIterator, _ForwardIterator, regex_constants::syntax_option_type = regex_constants::ECMAScript)
-> basic_regex<typename iterator_traits<_ForwardIterator>::value_type>;
#endif
template <class _CharT, class _Traits>
- const regex_constants::syntax_option_type basic_regex<_CharT, _Traits>::icase;
+const regex_constants::syntax_option_type basic_regex<_CharT, _Traits>::icase;
template <class _CharT, class _Traits>
- const regex_constants::syntax_option_type basic_regex<_CharT, _Traits>::nosubs;
+const regex_constants::syntax_option_type basic_regex<_CharT, _Traits>::nosubs;
template <class _CharT, class _Traits>
- const regex_constants::syntax_option_type basic_regex<_CharT, _Traits>::optimize;
+const regex_constants::syntax_option_type basic_regex<_CharT, _Traits>::optimize;
template <class _CharT, class _Traits>
- const regex_constants::syntax_option_type basic_regex<_CharT, _Traits>::collate;
+const regex_constants::syntax_option_type basic_regex<_CharT, _Traits>::collate;
template <class _CharT, class _Traits>
- const regex_constants::syntax_option_type basic_regex<_CharT, _Traits>::ECMAScript;
+const regex_constants::syntax_option_type basic_regex<_CharT, _Traits>::ECMAScript;
template <class _CharT, class _Traits>
- const regex_constants::syntax_option_type basic_regex<_CharT, _Traits>::basic;
+const regex_constants::syntax_option_type basic_regex<_CharT, _Traits>::basic;
template <class _CharT, class _Traits>
- const regex_constants::syntax_option_type basic_regex<_CharT, _Traits>::extended;
+const regex_constants::syntax_option_type basic_regex<_CharT, _Traits>::extended;
template <class _CharT, class _Traits>
- const regex_constants::syntax_option_type basic_regex<_CharT, _Traits>::awk;
+const regex_constants::syntax_option_type basic_regex<_CharT, _Traits>::awk;
template <class _CharT, class _Traits>
- const regex_constants::syntax_option_type basic_regex<_CharT, _Traits>::grep;
+const regex_constants::syntax_option_type basic_regex<_CharT, _Traits>::grep;
template <class _CharT, class _Traits>
- const regex_constants::syntax_option_type basic_regex<_CharT, _Traits>::egrep;
+const regex_constants::syntax_option_type basic_regex<_CharT, _Traits>::egrep;
template <class _CharT, class _Traits>
-void
-basic_regex<_CharT, _Traits>::swap(basic_regex& __r)
-{
- using std::swap;
- swap(__traits_, __r.__traits_);
- swap(__flags_, __r.__flags_);
- swap(__marked_count_, __r.__marked_count_);
- swap(__loop_count_, __r.__loop_count_);
- swap(__open_count_, __r.__open_count_);
- swap(__start_, __r.__start_);
- swap(__end_, __r.__end_);
+void basic_regex<_CharT, _Traits>::swap(basic_regex& __r) {
+ using std::swap;
+ swap(__traits_, __r.__traits_);
+ swap(__flags_, __r.__flags_);
+ swap(__marked_count_, __r.__marked_count_);
+ swap(__loop_count_, __r.__loop_count_);
+ swap(__open_count_, __r.__open_count_);
+ swap(__start_, __r.__start_);
+ swap(__end_, __r.__end_);
}
template <class _CharT, class _Traits>
-inline _LIBCPP_HIDE_FROM_ABI
-void
-swap(basic_regex<_CharT, _Traits>& __x, basic_regex<_CharT, _Traits>& __y)
-{
- return __x.swap(__y);
+inline _LIBCPP_HIDE_FROM_ABI void swap(basic_regex<_CharT, _Traits>& __x, basic_regex<_CharT, _Traits>& __y) {
+ return __x.swap(__y);
}
// __lookahead
template <class _CharT, class _Traits>
-class __lookahead
- : public __owns_one_state<_CharT>
-{
- typedef __owns_one_state<_CharT> base;
+class __lookahead : public __owns_one_state<_CharT> {
+ typedef __owns_one_state<_CharT> base;
+
+ basic_regex<_CharT, _Traits> __exp_;
+ unsigned __mexp_;
+ bool __invert_;
- basic_regex<_CharT, _Traits> __exp_;
- unsigned __mexp_;
- bool __invert_;
+ __lookahead(const __lookahead&);
+ __lookahead& operator=(const __lookahead&);
- __lookahead(const __lookahead&);
- __lookahead& operator=(const __lookahead&);
public:
- typedef std::__state<_CharT> __state;
+ typedef std::__state<_CharT> __state;
- _LIBCPP_HIDE_FROM_ABI
- __lookahead(const basic_regex<_CharT, _Traits>& __exp, bool __invert, __node<_CharT>* __s, unsigned __mexp)
- : base(__s), __exp_(__exp), __mexp_(__mexp), __invert_(__invert) {}
+ _LIBCPP_HIDE_FROM_ABI
+ __lookahead(const basic_regex<_CharT, _Traits>& __exp, bool __invert, __node<_CharT>* __s, unsigned __mexp)
+ : base(__s), __exp_(__exp), __mexp_(__mexp), __invert_(__invert) {}
- _LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual void __exec(__state&) const;
+ _LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual void __exec(__state&) const;
};
template <class _CharT, class _Traits>
-void
-__lookahead<_CharT, _Traits>::__exec(__state& __s) const
-{
- match_results<const _CharT*> __m;
- __m.__init(1 + __exp_.mark_count(), __s.__current_, __s.__last_);
- bool __matched = __exp_.__match_at_start_ecma(
- __s.__current_, __s.__last_,
- __m,
- (__s.__flags_ | regex_constants::match_continuous) &
- ~regex_constants::__full_match,
- __s.__at_first_ && __s.__current_ == __s.__first_);
- if (__matched != __invert_)
- {
- __s.__do_ = __state::__accept_but_not_consume;
- __s.__node_ = this->first();
- for (unsigned __i = 1; __i < __m.size(); ++__i) {
- __s.__sub_matches_[__mexp_ + __i - 1] = __m.__matches_[__i];
- }
- }
- else
- {
- __s.__do_ = __state::__reject;
- __s.__node_ = nullptr;
+void __lookahead<_CharT, _Traits>::__exec(__state& __s) const {
+ match_results<const _CharT*> __m;
+ __m.__init(1 + __exp_.mark_count(), __s.__current_, __s.__last_);
+ bool __matched = __exp_.__match_at_start_ecma(
+ __s.__current_,
+ __s.__last_,
+ __m,
+ (__s.__flags_ | regex_constants::match_continuous) & ~regex_constants::__full_match,
+ __s.__at_first_ && __s.__current_ == __s.__first_);
+ if (__matched != __invert_) {
+ __s.__do_ = __state::__accept_but_not_consume;
+ __s.__node_ = this->first();
+ for (unsigned __i = 1; __i < __m.size(); ++__i) {
+ __s.__sub_matches_[__mexp_ + __i - 1] = __m.__matches_[__i];
}
+ } else {
+ __s.__do_ = __state::__reject;
+ __s.__node_ = nullptr;
+ }
}
template <class _CharT, class _Traits>
template <class _ForwardIterator>
-void
-basic_regex<_CharT, _Traits>::__init(_ForwardIterator __first, _ForwardIterator __last)
-{
- if (__get_grammar(__flags_) == 0) __flags_ |= regex_constants::ECMAScript;
- _ForwardIterator __temp = __parse(__first, __last);
- if ( __temp != __last)
- __throw_regex_error<regex_constants::__re_err_parse>();
+void basic_regex<_CharT, _Traits>::__init(_ForwardIterator __first, _ForwardIterator __last) {
+ if (__get_grammar(__flags_) == 0)
+ __flags_ |= regex_constants::ECMAScript;
+ _ForwardIterator __temp = __parse(__first, __last);
+ if (__temp != __last)
+ __throw_regex_error<regex_constants::__re_err_parse>();
}
template <class _CharT, class _Traits>
template <class _ForwardIterator>
-_ForwardIterator
-basic_regex<_CharT, _Traits>::__parse(_ForwardIterator __first,
- _ForwardIterator __last)
-{
- {
- unique_ptr<__node> __h(new __end_state<_CharT>);
- __start_.reset(new __empty_state<_CharT>(__h.get()));
- __h.release();
- __end_ = __start_.get();
- }
- switch (__get_grammar(__flags_))
- {
- case ECMAScript:
- __first = __parse_ecma_exp(__first, __last);
- break;
- case basic:
- __first = __parse_basic_reg_exp(__first, __last);
- break;
- case extended:
- case awk:
- __first = __parse_extended_reg_exp(__first, __last);
- break;
- case grep:
- __first = __parse_grep(__first, __last);
- break;
- case egrep:
- __first = __parse_egrep(__first, __last);
- break;
- default:
- __throw_regex_error<regex_constants::__re_err_grammar>();
- }
- return __first;
+_ForwardIterator basic_regex<_CharT, _Traits>::__parse(_ForwardIterator __first, _ForwardIterator __last) {
+ {
+ unique_ptr<__node> __h(new __end_state<_CharT>);
+ __start_.reset(new __empty_state<_CharT>(__h.get()));
+ __h.release();
+ __end_ = __start_.get();
+ }
+ switch (__get_grammar(__flags_)) {
+ case ECMAScript:
+ __first = __parse_ecma_exp(__first, __last);
+ break;
+ case basic:
+ __first = __parse_basic_reg_exp(__first, __last);
+ break;
+ case extended:
+ case awk:
+ __first = __parse_extended_reg_exp(__first, __last);
+ break;
+ case grep:
+ __first = __parse_grep(__first, __last);
+ break;
+ case egrep:
+ __first = __parse_egrep(__first, __last);
+ break;
+ default:
+ __throw_regex_error<regex_constants::__re_err_grammar>();
+ }
+ return __first;
}
template <class _CharT, class _Traits>
template <class _ForwardIterator>
_ForwardIterator
-basic_regex<_CharT, _Traits>::__parse_basic_reg_exp(_ForwardIterator __first,
- _ForwardIterator __last)
-{
- if (__first != __last)
- {
- if (*__first == '^')
- {
- __push_l_anchor();
- ++__first;
- }
- if (__first != __last)
- {
- __first = __parse_RE_expression(__first, __last);
- if (__first != __last)
- {
- _ForwardIterator __temp = std::next(__first);
- if (__temp == __last && *__first == '$')
- {
- __push_r_anchor();
- ++__first;
- }
- }
+basic_regex<_CharT, _Traits>::__parse_basic_reg_exp(_ForwardIterator __first, _ForwardIterator __last) {
+ if (__first != __last) {
+ if (*__first == '^') {
+ __push_l_anchor();
+ ++__first;
+ }
+ if (__first != __last) {
+ __first = __parse_RE_expression(__first, __last);
+ if (__first != __last) {
+ _ForwardIterator __temp = std::next(__first);
+ if (__temp == __last && *__first == '$') {
+ __push_r_anchor();
+ ++__first;
}
- if (__first != __last)
- __throw_regex_error<regex_constants::__re_err_empty>();
+ }
}
- return __first;
+ if (__first != __last)
+ __throw_regex_error<regex_constants::__re_err_empty>();
+ }
+ return __first;
}
template <class _CharT, class _Traits>
template <class _ForwardIterator>
_ForwardIterator
-basic_regex<_CharT, _Traits>::__parse_extended_reg_exp(_ForwardIterator __first,
- _ForwardIterator __last)
-{
- __owns_one_state<_CharT>* __sa = __end_;
- _ForwardIterator __temp = __parse_ERE_branch(__first, __last);
+basic_regex<_CharT, _Traits>::__parse_extended_reg_exp(_ForwardIterator __first, _ForwardIterator __last) {
+ __owns_one_state<_CharT>* __sa = __end_;
+ _ForwardIterator __temp = __parse_ERE_branch(__first, __last);
+ if (__temp == __first)
+ __throw_regex_error<regex_constants::__re_err_empty>();
+ __first = __temp;
+ while (__first != __last && *__first == '|') {
+ __owns_one_state<_CharT>* __sb = __end_;
+ __temp = __parse_ERE_branch(++__first, __last);
if (__temp == __first)
- __throw_regex_error<regex_constants::__re_err_empty>();
+ __throw_regex_error<regex_constants::__re_err_empty>();
+ __push_alternation(__sa, __sb);
__first = __temp;
- while (__first != __last && *__first == '|')
- {
- __owns_one_state<_CharT>* __sb = __end_;
- __temp = __parse_ERE_branch(++__first, __last);
- if (__temp == __first)
- __throw_regex_error<regex_constants::__re_err_empty>();
- __push_alternation(__sa, __sb);
- __first = __temp;
- }
- return __first;
+ }
+ return __first;
}
template <class _CharT, class _Traits>
template <class _ForwardIterator>
-_ForwardIterator
-basic_regex<_CharT, _Traits>::__parse_ERE_branch(_ForwardIterator __first,
- _ForwardIterator __last)
-{
- _ForwardIterator __temp = __parse_ERE_expression(__first, __last);
- if (__temp == __first)
- __throw_regex_error<regex_constants::__re_err_empty>();
- do
- {
- __first = __temp;
- __temp = __parse_ERE_expression(__first, __last);
- } while (__temp != __first);
- return __first;
+_ForwardIterator basic_regex<_CharT, _Traits>::__parse_ERE_branch(_ForwardIterator __first, _ForwardIterator __last) {
+ _ForwardIterator __temp = __parse_ERE_expression(__first, __last);
+ if (__temp == __first)
+ __throw_regex_error<regex_constants::__re_err_empty>();
+ do {
+ __first = __temp;
+ __temp = __parse_ERE_expression(__first, __last);
+ } while (__temp != __first);
+ return __first;
}
template <class _CharT, class _Traits>
template <class _ForwardIterator>
_ForwardIterator
-basic_regex<_CharT, _Traits>::__parse_ERE_expression(_ForwardIterator __first,
- _ForwardIterator __last)
-{
- __owns_one_state<_CharT>* __e = __end_;
- unsigned __mexp_begin = __marked_count_;
- _ForwardIterator __temp = __parse_one_char_or_coll_elem_ERE(__first, __last);
- if (__temp == __first && __temp != __last)
- {
- switch (*__temp)
- {
- case '^':
- __push_l_anchor();
- ++__temp;
- break;
- case '$':
- __push_r_anchor();
- ++__temp;
- break;
- case '(':
- __push_begin_marked_subexpression();
- unsigned __temp_count = __marked_count_;
- ++__open_count_;
- __temp = __parse_extended_reg_exp(++__temp, __last);
- if (__temp == __last || *__temp != ')')
- __throw_regex_error<regex_constants::error_paren>();
- __push_end_marked_subexpression(__temp_count);
- --__open_count_;
- ++__temp;
- break;
- }
+basic_regex<_CharT, _Traits>::__parse_ERE_expression(_ForwardIterator __first, _ForwardIterator __last) {
+ __owns_one_state<_CharT>* __e = __end_;
+ unsigned __mexp_begin = __marked_count_;
+ _ForwardIterator __temp = __parse_one_char_or_coll_elem_ERE(__first, __last);
+ if (__temp == __first && __temp != __last) {
+ switch (*__temp) {
+ case '^':
+ __push_l_anchor();
+ ++__temp;
+ break;
+ case '$':
+ __push_r_anchor();
+ ++__temp;
+ break;
+ case '(':
+ __push_begin_marked_subexpression();
+ unsigned __temp_count = __marked_count_;
+ ++__open_count_;
+ __temp = __parse_extended_reg_exp(++__temp, __last);
+ if (__temp == __last || *__temp != ')')
+ __throw_regex_error<regex_constants::error_paren>();
+ __push_end_marked_subexpression(__temp_count);
+ --__open_count_;
+ ++__temp;
+ break;
}
- if (__temp != __first)
- __temp = __parse_ERE_dupl_symbol(__temp, __last, __e, __mexp_begin+1,
- __marked_count_+1);
- __first = __temp;
- return __first;
+ }
+ if (__temp != __first)
+ __temp = __parse_ERE_dupl_symbol(__temp, __last, __e, __mexp_begin + 1, __marked_count_ + 1);
+ __first = __temp;
+ return __first;
}
template <class _CharT, class _Traits>
template <class _ForwardIterator>
_ForwardIterator
-basic_regex<_CharT, _Traits>::__parse_RE_expression(_ForwardIterator __first,
- _ForwardIterator __last)
-{
- while (true)
- {
- _ForwardIterator __temp = __parse_simple_RE(__first, __last);
- if (__temp == __first)
- break;
- __first = __temp;
- }
- return __first;
+basic_regex<_CharT, _Traits>::__parse_RE_expression(_ForwardIterator __first, _ForwardIterator __last) {
+ while (true) {
+ _ForwardIterator __temp = __parse_simple_RE(__first, __last);
+ if (__temp == __first)
+ break;
+ __first = __temp;
+ }
+ return __first;
}
template <class _CharT, class _Traits>
template <class _ForwardIterator>
-_ForwardIterator
-basic_regex<_CharT, _Traits>::__parse_simple_RE(_ForwardIterator __first,
- _ForwardIterator __last)
-{
- if (__first != __last)
- {
- __owns_one_state<_CharT>* __e = __end_;
- unsigned __mexp_begin = __marked_count_;
- _ForwardIterator __temp = __parse_nondupl_RE(__first, __last);
- if (__temp != __first)
- __first = __parse_RE_dupl_symbol(__temp, __last, __e,
- __mexp_begin+1, __marked_count_+1);
- }
- return __first;
+_ForwardIterator basic_regex<_CharT, _Traits>::__parse_simple_RE(_ForwardIterator __first, _ForwardIterator __last) {
+ if (__first != __last) {
+ __owns_one_state<_CharT>* __e = __end_;
+ unsigned __mexp_begin = __marked_count_;
+ _ForwardIterator __temp = __parse_nondupl_RE(__first, __last);
+ if (__temp != __first)
+ __first = __parse_RE_dupl_symbol(__temp, __last, __e, __mexp_begin + 1, __marked_count_ + 1);
+ }
+ return __first;
}
template <class _CharT, class _Traits>
template <class _ForwardIterator>
-_ForwardIterator
-basic_regex<_CharT, _Traits>::__parse_nondupl_RE(_ForwardIterator __first,
- _ForwardIterator __last)
-{
- _ForwardIterator __temp = __first;
- __first = __parse_one_char_or_coll_elem_RE(__first, __last);
- if (__temp == __first)
- {
- __temp = __parse_Back_open_paren(__first, __last);
- if (__temp != __first)
- {
- __push_begin_marked_subexpression();
- unsigned __temp_count = __marked_count_;
- __first = __parse_RE_expression(__temp, __last);
- __temp = __parse_Back_close_paren(__first, __last);
- if (__temp == __first)
- __throw_regex_error<regex_constants::error_paren>();
- __push_end_marked_subexpression(__temp_count);
- __first = __temp;
- }
- else
- __first = __parse_BACKREF(__first, __last);
- }
- return __first;
+_ForwardIterator basic_regex<_CharT, _Traits>::__parse_nondupl_RE(_ForwardIterator __first, _ForwardIterator __last) {
+ _ForwardIterator __temp = __first;
+ __first = __parse_one_char_or_coll_elem_RE(__first, __last);
+ if (__temp == __first) {
+ __temp = __parse_Back_open_paren(__first, __last);
+ if (__temp != __first) {
+ __push_begin_marked_subexpression();
+ unsigned __temp_count = __marked_count_;
+ __first = __parse_RE_expression(__temp, __last);
+ __temp = __parse_Back_close_paren(__first, __last);
+ if (__temp == __first)
+ __throw_regex_error<regex_constants::error_paren>();
+ __push_end_marked_subexpression(__temp_count);
+ __first = __temp;
+ } else
+ __first = __parse_BACKREF(__first, __last);
+ }
+ return __first;
}
template <class _CharT, class _Traits>
template <class _ForwardIterator>
_ForwardIterator
-basic_regex<_CharT, _Traits>::__parse_one_char_or_coll_elem_RE(
- _ForwardIterator __first,
- _ForwardIterator __last)
-{
- _ForwardIterator __temp = __parse_ORD_CHAR(__first, __last);
- if (__temp == __first)
- {
- __temp = __parse_QUOTED_CHAR(__first, __last);
- if (__temp == __first)
- {
- if (__temp != __last && *__temp == '.')
- {
- __push_match_any();
- ++__temp;
- }
- else
- __temp = __parse_bracket_expression(__first, __last);
- }
+basic_regex<_CharT, _Traits>::__parse_one_char_or_coll_elem_RE(_ForwardIterator __first, _ForwardIterator __last) {
+ _ForwardIterator __temp = __parse_ORD_CHAR(__first, __last);
+ if (__temp == __first) {
+ __temp = __parse_QUOTED_CHAR(__first, __last);
+ if (__temp == __first) {
+ if (__temp != __last && *__temp == '.') {
+ __push_match_any();
+ ++__temp;
+ } else
+ __temp = __parse_bracket_expression(__first, __last);
}
- __first = __temp;
- return __first;
+ }
+ __first = __temp;
+ return __first;
}
template <class _CharT, class _Traits>
template <class _ForwardIterator>
_ForwardIterator
-basic_regex<_CharT, _Traits>::__parse_one_char_or_coll_elem_ERE(
- _ForwardIterator __first,
- _ForwardIterator __last)
-{
- _ForwardIterator __temp = __parse_ORD_CHAR_ERE(__first, __last);
- if (__temp == __first)
- {
- __temp = __parse_QUOTED_CHAR_ERE(__first, __last);
- if (__temp == __first)
- {
- if (__temp != __last && *__temp == '.')
- {
- __push_match_any();
- ++__temp;
- }
- else
- __temp = __parse_bracket_expression(__first, __last);
- }
+basic_regex<_CharT, _Traits>::__parse_one_char_or_coll_elem_ERE(_ForwardIterator __first, _ForwardIterator __last) {
+ _ForwardIterator __temp = __parse_ORD_CHAR_ERE(__first, __last);
+ if (__temp == __first) {
+ __temp = __parse_QUOTED_CHAR_ERE(__first, __last);
+ if (__temp == __first) {
+ if (__temp != __last && *__temp == '.') {
+ __push_match_any();
+ ++__temp;
+ } else
+ __temp = __parse_bracket_expression(__first, __last);
}
- __first = __temp;
- return __first;
+ }
+ __first = __temp;
+ return __first;
}
template <class _CharT, class _Traits>
template <class _ForwardIterator>
_ForwardIterator
-basic_regex<_CharT, _Traits>::__parse_Back_open_paren(_ForwardIterator __first,
- _ForwardIterator __last)
-{
- if (__first != __last)
- {
- _ForwardIterator __temp = std::next(__first);
- if (__temp != __last)
- {
- if (*__first == '\\' && *__temp == '(')
- __first = ++__temp;
- }
+basic_regex<_CharT, _Traits>::__parse_Back_open_paren(_ForwardIterator __first, _ForwardIterator __last) {
+ if (__first != __last) {
+ _ForwardIterator __temp = std::next(__first);
+ if (__temp != __last) {
+ if (*__first == '\\' && *__temp == '(')
+ __first = ++__temp;
}
- return __first;
+ }
+ return __first;
}
template <class _CharT, class _Traits>
template <class _ForwardIterator>
_ForwardIterator
-basic_regex<_CharT, _Traits>::__parse_Back_close_paren(_ForwardIterator __first,
- _ForwardIterator __last)
-{
- if (__first != __last)
- {
- _ForwardIterator __temp = std::next(__first);
- if (__temp != __last)
- {
- if (*__first == '\\' && *__temp == ')')
- __first = ++__temp;
- }
+basic_regex<_CharT, _Traits>::__parse_Back_close_paren(_ForwardIterator __first, _ForwardIterator __last) {
+ if (__first != __last) {
+ _ForwardIterator __temp = std::next(__first);
+ if (__temp != __last) {
+ if (*__first == '\\' && *__temp == ')')
+ __first = ++__temp;
}
- return __first;
+ }
+ return __first;
}
template <class _CharT, class _Traits>
template <class _ForwardIterator>
_ForwardIterator
-basic_regex<_CharT, _Traits>::__parse_Back_open_brace(_ForwardIterator __first,
- _ForwardIterator __last)
-{
- if (__first != __last)
- {
- _ForwardIterator __temp = std::next(__first);
- if (__temp != __last)
- {
- if (*__first == '\\' && *__temp == '{')
- __first = ++__temp;
- }
+basic_regex<_CharT, _Traits>::__parse_Back_open_brace(_ForwardIterator __first, _ForwardIterator __last) {
+ if (__first != __last) {
+ _ForwardIterator __temp = std::next(__first);
+ if (__temp != __last) {
+ if (*__first == '\\' && *__temp == '{')
+ __first = ++__temp;
}
- return __first;
+ }
+ return __first;
}
template <class _CharT, class _Traits>
template <class _ForwardIterator>
_ForwardIterator
-basic_regex<_CharT, _Traits>::__parse_Back_close_brace(_ForwardIterator __first,
- _ForwardIterator __last)
-{
- if (__first != __last)
- {
- _ForwardIterator __temp = std::next(__first);
- if (__temp != __last)
- {
- if (*__first == '\\' && *__temp == '}')
- __first = ++__temp;
- }
+basic_regex<_CharT, _Traits>::__parse_Back_close_brace(_ForwardIterator __first, _ForwardIterator __last) {
+ if (__first != __last) {
+ _ForwardIterator __temp = std::next(__first);
+ if (__temp != __last) {
+ if (*__first == '\\' && *__temp == '}')
+ __first = ++__temp;
}
- return __first;
+ }
+ return __first;
}
template <class _CharT, class _Traits>
template <class _ForwardIterator>
-_ForwardIterator
-basic_regex<_CharT, _Traits>::__parse_BACKREF(_ForwardIterator __first,
- _ForwardIterator __last)
-{
- if (__first != __last)
- {
- _ForwardIterator __temp = std::next(__first);
- if (__temp != __last && *__first == '\\' && __test_back_ref(*__temp))
- __first = ++__temp;
- }
- return __first;
+_ForwardIterator basic_regex<_CharT, _Traits>::__parse_BACKREF(_ForwardIterator __first, _ForwardIterator __last) {
+ if (__first != __last) {
+ _ForwardIterator __temp = std::next(__first);
+ if (__temp != __last && *__first == '\\' && __test_back_ref(*__temp))
+ __first = ++__temp;
+ }
+ return __first;
}
template <class _CharT, class _Traits>
template <class _ForwardIterator>
-_ForwardIterator
-basic_regex<_CharT, _Traits>::__parse_ORD_CHAR(_ForwardIterator __first,
- _ForwardIterator __last)
-{
- if (__first != __last)
- {
- _ForwardIterator __temp = std::next(__first);
- if (__temp == __last && *__first == '$')
- return __first;
- // Not called inside a bracket
- if (*__first == '.' || *__first == '\\' || *__first == '[')
- return __first;
+_ForwardIterator basic_regex<_CharT, _Traits>::__parse_ORD_CHAR(_ForwardIterator __first, _ForwardIterator __last) {
+ if (__first != __last) {
+ _ForwardIterator __temp = std::next(__first);
+ if (__temp == __last && *__first == '$')
+ return __first;
+ // Not called inside a bracket
+ if (*__first == '.' || *__first == '\\' || *__first == '[')
+ return __first;
+ __push_char(*__first);
+ ++__first;
+ }
+ return __first;
+}
+
+template <class _CharT, class _Traits>
+template <class _ForwardIterator>
+_ForwardIterator basic_regex<_CharT, _Traits>::__parse_ORD_CHAR_ERE(_ForwardIterator __first, _ForwardIterator __last) {
+ if (__first != __last) {
+ switch (*__first) {
+ case '^':
+ case '.':
+ case '[':
+ case '$':
+ case '(':
+ case '|':
+ case '*':
+ case '+':
+ case '?':
+ case '{':
+ case '\\':
+ break;
+ case ')':
+ if (__open_count_ == 0) {
__push_char(*__first);
++__first;
+ }
+ break;
+ default:
+ __push_char(*__first);
+ ++__first;
+ break;
}
- return __first;
+ }
+ return __first;
}
template <class _CharT, class _Traits>
template <class _ForwardIterator>
-_ForwardIterator
-basic_regex<_CharT, _Traits>::__parse_ORD_CHAR_ERE(_ForwardIterator __first,
- _ForwardIterator __last)
-{
- if (__first != __last)
- {
- switch (*__first)
- {
+_ForwardIterator basic_regex<_CharT, _Traits>::__parse_QUOTED_CHAR(_ForwardIterator __first, _ForwardIterator __last) {
+ if (__first != __last) {
+ _ForwardIterator __temp = std::next(__first);
+ if (__temp != __last) {
+ if (*__first == '\\') {
+ switch (*__temp) {
case '^':
case '.':
+ case '*':
case '[':
case '$':
- case '(':
- case '|':
- case '*':
- case '+':
- case '?':
- case '{':
case '\\':
- break;
- case ')':
- if (__open_count_ == 0)
- {
- __push_char(*__first);
- ++__first;
- }
- break;
- default:
- __push_char(*__first);
- ++__first;
- break;
- }
- }
- return __first;
-}
-
-template <class _CharT, class _Traits>
-template <class _ForwardIterator>
-_ForwardIterator
-basic_regex<_CharT, _Traits>::__parse_QUOTED_CHAR(_ForwardIterator __first,
- _ForwardIterator __last)
-{
- if (__first != __last)
- {
- _ForwardIterator __temp = std::next(__first);
- if (__temp != __last)
- {
- if (*__first == '\\')
- {
- switch (*__temp)
- {
- case '^':
- case '.':
- case '*':
- case '[':
- case '$':
- case '\\':
- __push_char(*__temp);
- __first = ++__temp;
- break;
- }
- }
+ __push_char(*__temp);
+ __first = ++__temp;
+ break;
}
+ }
}
- return __first;
+ }
+ return __first;
}
template <class _CharT, class _Traits>
template <class _ForwardIterator>
_ForwardIterator
-basic_regex<_CharT, _Traits>::__parse_QUOTED_CHAR_ERE(_ForwardIterator __first,
- _ForwardIterator __last)
-{
- if (__first != __last)
- {
- _ForwardIterator __temp = std::next(__first);
- if (__temp != __last)
- {
- if (*__first == '\\')
- {
- switch (*__temp)
- {
- case '^':
- case '.':
- case '*':
- case '[':
- case '$':
- case '\\':
- case '(':
- case ')':
- case '|':
- case '+':
- case '?':
- case '{':
- case '}':
- __push_char(*__temp);
- __first = ++__temp;
- break;
- default:
- if (__get_grammar(__flags_) == awk)
- __first = __parse_awk_escape(++__first, __last);
- else if(__test_back_ref(*__temp))
- __first = ++__temp;
- break;
- }
- }
+basic_regex<_CharT, _Traits>::__parse_QUOTED_CHAR_ERE(_ForwardIterator __first, _ForwardIterator __last) {
+ if (__first != __last) {
+ _ForwardIterator __temp = std::next(__first);
+ if (__temp != __last) {
+ if (*__first == '\\') {
+ switch (*__temp) {
+ case '^':
+ case '.':
+ case '*':
+ case '[':
+ case '$':
+ case '\\':
+ case '(':
+ case ')':
+ case '|':
+ case '+':
+ case '?':
+ case '{':
+ case '}':
+ __push_char(*__temp);
+ __first = ++__temp;
+ break;
+ default:
+ if (__get_grammar(__flags_) == awk)
+ __first = __parse_awk_escape(++__first, __last);
+ else if (__test_back_ref(*__temp))
+ __first = ++__temp;
+ break;
}
+ }
}
- return __first;
+ }
+ return __first;
}
template <class _CharT, class _Traits>
template <class _ForwardIterator>
-_ForwardIterator
-basic_regex<_CharT, _Traits>::__parse_RE_dupl_symbol(_ForwardIterator __first,
- _ForwardIterator __last,
- __owns_one_state<_CharT>* __s,
- unsigned __mexp_begin,
- unsigned __mexp_end)
-{
- if (__first != __last)
- {
- if (*__first == '*')
- {
- __push_greedy_inf_repeat(0, __s, __mexp_begin, __mexp_end);
- ++__first;
- }
- else
- {
- _ForwardIterator __temp = __parse_Back_open_brace(__first, __last);
- if (__temp != __first)
- {
- int __min = 0;
- __first = __temp;
- __temp = __parse_DUP_COUNT(__first, __last, __min);
- if (__temp == __first)
- __throw_regex_error<regex_constants::error_badbrace>();
- __first = __temp;
- if (__first == __last)
- __throw_regex_error<regex_constants::error_brace>();
- if (*__first != ',')
- {
- __temp = __parse_Back_close_brace(__first, __last);
- if (__temp == __first)
- __throw_regex_error<regex_constants::error_brace>();
- __push_loop(__min, __min, __s, __mexp_begin, __mexp_end,
- true);
- __first = __temp;
- }
- else
- {
- ++__first; // consume ','
- int __max = -1;
- __first = __parse_DUP_COUNT(__first, __last, __max);
- __temp = __parse_Back_close_brace(__first, __last);
- if (__temp == __first)
- __throw_regex_error<regex_constants::error_brace>();
- if (__max == -1)
- __push_greedy_inf_repeat(__min, __s, __mexp_begin, __mexp_end);
- else
- {
- if (__max < __min)
- __throw_regex_error<regex_constants::error_badbrace>();
- __push_loop(__min, __max, __s, __mexp_begin, __mexp_end,
- true);
- }
- __first = __temp;
- }
- }
+_ForwardIterator basic_regex<_CharT, _Traits>::__parse_RE_dupl_symbol(
+ _ForwardIterator __first,
+ _ForwardIterator __last,
+ __owns_one_state<_CharT>* __s,
+ unsigned __mexp_begin,
+ unsigned __mexp_end) {
+ if (__first != __last) {
+ if (*__first == '*') {
+ __push_greedy_inf_repeat(0, __s, __mexp_begin, __mexp_end);
+ ++__first;
+ } else {
+ _ForwardIterator __temp = __parse_Back_open_brace(__first, __last);
+ if (__temp != __first) {
+ int __min = 0;
+ __first = __temp;
+ __temp = __parse_DUP_COUNT(__first, __last, __min);
+ if (__temp == __first)
+ __throw_regex_error<regex_constants::error_badbrace>();
+ __first = __temp;
+ if (__first == __last)
+ __throw_regex_error<regex_constants::error_brace>();
+ if (*__first != ',') {
+ __temp = __parse_Back_close_brace(__first, __last);
+ if (__temp == __first)
+ __throw_regex_error<regex_constants::error_brace>();
+ __push_loop(__min, __min, __s, __mexp_begin, __mexp_end, true);
+ __first = __temp;
+ } else {
+ ++__first; // consume ','
+ int __max = -1;
+ __first = __parse_DUP_COUNT(__first, __last, __max);
+ __temp = __parse_Back_close_brace(__first, __last);
+ if (__temp == __first)
+ __throw_regex_error<regex_constants::error_brace>();
+ if (__max == -1)
+ __push_greedy_inf_repeat(__min, __s, __mexp_begin, __mexp_end);
+ else {
+ if (__max < __min)
+ __throw_regex_error<regex_constants::error_badbrace>();
+ __push_loop(__min, __max, __s, __mexp_begin, __mexp_end, true);
+ }
+ __first = __temp;
}
+ }
}
- return __first;
+ }
+ return __first;
}
template <class _CharT, class _Traits>
template <class _ForwardIterator>
-_ForwardIterator
-basic_regex<_CharT, _Traits>::__parse_ERE_dupl_symbol(_ForwardIterator __first,
- _ForwardIterator __last,
- __owns_one_state<_CharT>* __s,
- unsigned __mexp_begin,
- unsigned __mexp_end)
-{
- if (__first != __last)
- {
- unsigned __grammar = __get_grammar(__flags_);
- switch (*__first)
- {
- case '*':
- ++__first;
- if (__grammar == ECMAScript && __first != __last && *__first == '?')
- {
- ++__first;
- __push_nongreedy_inf_repeat(0, __s, __mexp_begin, __mexp_end);
- }
- else
- __push_greedy_inf_repeat(0, __s, __mexp_begin, __mexp_end);
- break;
- case '+':
+_ForwardIterator basic_regex<_CharT, _Traits>::__parse_ERE_dupl_symbol(
+ _ForwardIterator __first,
+ _ForwardIterator __last,
+ __owns_one_state<_CharT>* __s,
+ unsigned __mexp_begin,
+ unsigned __mexp_end) {
+ if (__first != __last) {
+ unsigned __grammar = __get_grammar(__flags_);
+ switch (*__first) {
+ case '*':
+ ++__first;
+ if (__grammar == ECMAScript && __first != __last && *__first == '?') {
+ ++__first;
+ __push_nongreedy_inf_repeat(0, __s, __mexp_begin, __mexp_end);
+ } else
+ __push_greedy_inf_repeat(0, __s, __mexp_begin, __mexp_end);
+ break;
+ case '+':
+ ++__first;
+ if (__grammar == ECMAScript && __first != __last && *__first == '?') {
+ ++__first;
+ __push_nongreedy_inf_repeat(1, __s, __mexp_begin, __mexp_end);
+ } else
+ __push_greedy_inf_repeat(1, __s, __mexp_begin, __mexp_end);
+ break;
+ case '?':
+ ++__first;
+ if (__grammar == ECMAScript && __first != __last && *__first == '?') {
+ ++__first;
+ __push_loop(0, 1, __s, __mexp_begin, __mexp_end, false);
+ } else
+ __push_loop(0, 1, __s, __mexp_begin, __mexp_end);
+ break;
+ case '{': {
+ int __min;
+ _ForwardIterator __temp = __parse_DUP_COUNT(++__first, __last, __min);
+ if (__temp == __first)
+ __throw_regex_error<regex_constants::error_badbrace>();
+ __first = __temp;
+ if (__first == __last)
+ __throw_regex_error<regex_constants::error_brace>();
+ switch (*__first) {
+ case '}':
+ ++__first;
+ if (__grammar == ECMAScript && __first != __last && *__first == '?') {
+ ++__first;
+ __push_loop(__min, __min, __s, __mexp_begin, __mexp_end, false);
+ } else
+ __push_loop(__min, __min, __s, __mexp_begin, __mexp_end);
+ break;
+ case ',':
+ ++__first;
+ if (__first == __last)
+ __throw_regex_error<regex_constants::error_badbrace>();
+ if (*__first == '}') {
+ ++__first;
+ if (__grammar == ECMAScript && __first != __last && *__first == '?') {
++__first;
- if (__grammar == ECMAScript && __first != __last && *__first == '?')
- {
- ++__first;
- __push_nongreedy_inf_repeat(1, __s, __mexp_begin, __mexp_end);
- }
- else
- __push_greedy_inf_repeat(1, __s, __mexp_begin, __mexp_end);
- break;
- case '?':
+ __push_nongreedy_inf_repeat(__min, __s, __mexp_begin, __mexp_end);
+ } else
+ __push_greedy_inf_repeat(__min, __s, __mexp_begin, __mexp_end);
+ } else {
+ int __max = -1;
+ __temp = __parse_DUP_COUNT(__first, __last, __max);
+ if (__temp == __first)
+ __throw_regex_error<regex_constants::error_brace>();
+ __first = __temp;
+ if (__first == __last || *__first != '}')
+ __throw_regex_error<regex_constants::error_brace>();
+ ++__first;
+ if (__max < __min)
+ __throw_regex_error<regex_constants::error_badbrace>();
+ if (__grammar == ECMAScript && __first != __last && *__first == '?') {
++__first;
- if (__grammar == ECMAScript && __first != __last && *__first == '?')
- {
- ++__first;
- __push_loop(0, 1, __s, __mexp_begin, __mexp_end, false);
- }
- else
- __push_loop(0, 1, __s, __mexp_begin, __mexp_end);
- break;
- case '{':
- {
- int __min;
- _ForwardIterator __temp = __parse_DUP_COUNT(++__first, __last, __min);
- if (__temp == __first)
- __throw_regex_error<regex_constants::error_badbrace>();
- __first = __temp;
- if (__first == __last)
- __throw_regex_error<regex_constants::error_brace>();
- switch (*__first)
- {
- case '}':
- ++__first;
- if (__grammar == ECMAScript && __first != __last && *__first == '?')
- {
- ++__first;
- __push_loop(__min, __min, __s, __mexp_begin, __mexp_end, false);
- }
- else
- __push_loop(__min, __min, __s, __mexp_begin, __mexp_end);
- break;
- case ',':
- ++__first;
- if (__first == __last)
- __throw_regex_error<regex_constants::error_badbrace>();
- if (*__first == '}')
- {
- ++__first;
- if (__grammar == ECMAScript && __first != __last && *__first == '?')
- {
- ++__first;
- __push_nongreedy_inf_repeat(__min, __s, __mexp_begin, __mexp_end);
- }
- else
- __push_greedy_inf_repeat(__min, __s, __mexp_begin, __mexp_end);
- }
- else
- {
- int __max = -1;
- __temp = __parse_DUP_COUNT(__first, __last, __max);
- if (__temp == __first)
- __throw_regex_error<regex_constants::error_brace>();
- __first = __temp;
- if (__first == __last || *__first != '}')
- __throw_regex_error<regex_constants::error_brace>();
- ++__first;
- if (__max < __min)
- __throw_regex_error<regex_constants::error_badbrace>();
- if (__grammar == ECMAScript && __first != __last && *__first == '?')
- {
- ++__first;
- __push_loop(__min, __max, __s, __mexp_begin, __mexp_end, false);
- }
- else
- __push_loop(__min, __max, __s, __mexp_begin, __mexp_end);
- }
- break;
- default:
- __throw_regex_error<regex_constants::error_badbrace>();
- }
- }
- break;
+ __push_loop(__min, __max, __s, __mexp_begin, __mexp_end, false);
+ } else
+ __push_loop(__min, __max, __s, __mexp_begin, __mexp_end);
}
+ break;
+ default:
+ __throw_regex_error<regex_constants::error_badbrace>();
+ }
+ } break;
}
- return __first;
+ }
+ return __first;
}
template <class _CharT, class _Traits>
template <class _ForwardIterator>
_ForwardIterator
-basic_regex<_CharT, _Traits>::__parse_bracket_expression(_ForwardIterator __first,
- _ForwardIterator __last)
-{
- if (__first != __last && *__first == '[')
- {
- ++__first;
- if (__first == __last)
- __throw_regex_error<regex_constants::error_brack>();
- bool __negate = false;
- if (*__first == '^')
- {
- ++__first;
- __negate = true;
- }
- __bracket_expression<_CharT, _Traits>* __ml = __start_matching_list(__negate);
- // __ml owned by *this
- if (__first == __last)
- __throw_regex_error<regex_constants::error_brack>();
- if (__get_grammar(__flags_) != ECMAScript && *__first == ']')
- {
- __ml->__add_char(']');
- ++__first;
- }
- __first = __parse_follow_list(__first, __last, __ml);
- if (__first == __last)
- __throw_regex_error<regex_constants::error_brack>();
- if (*__first == '-')
- {
- __ml->__add_char('-');
- ++__first;
- }
- if (__first == __last || *__first != ']')
- __throw_regex_error<regex_constants::error_brack>();
- ++__first;
+basic_regex<_CharT, _Traits>::__parse_bracket_expression(_ForwardIterator __first, _ForwardIterator __last) {
+ if (__first != __last && *__first == '[') {
+ ++__first;
+ if (__first == __last)
+ __throw_regex_error<regex_constants::error_brack>();
+ bool __negate = false;
+ if (*__first == '^') {
+ ++__first;
+ __negate = true;
+ }
+ __bracket_expression<_CharT, _Traits>* __ml = __start_matching_list(__negate);
+ // __ml owned by *this
+ if (__first == __last)
+ __throw_regex_error<regex_constants::error_brack>();
+ if (__get_grammar(__flags_) != ECMAScript && *__first == ']') {
+ __ml->__add_char(']');
+ ++__first;
+ }
+ __first = __parse_follow_list(__first, __last, __ml);
+ if (__first == __last)
+ __throw_regex_error<regex_constants::error_brack>();
+ if (*__first == '-') {
+ __ml->__add_char('-');
+ ++__first;
}
- return __first;
+ if (__first == __last || *__first != ']')
+ __throw_regex_error<regex_constants::error_brack>();
+ ++__first;
+ }
+ return __first;
}
template <class _CharT, class _Traits>
template <class _ForwardIterator>
-_ForwardIterator
-basic_regex<_CharT, _Traits>::__parse_follow_list(_ForwardIterator __first,
- _ForwardIterator __last,
- __bracket_expression<_CharT, _Traits>* __ml)
-{
- if (__first != __last)
- {
- while (true)
- {
- _ForwardIterator __temp = __parse_expression_term(__first, __last,
- __ml);
- if (__temp == __first)
- break;
- __first = __temp;
- }
+_ForwardIterator basic_regex<_CharT, _Traits>::__parse_follow_list(
+ _ForwardIterator __first, _ForwardIterator __last, __bracket_expression<_CharT, _Traits>* __ml) {
+ if (__first != __last) {
+ while (true) {
+ _ForwardIterator __temp = __parse_expression_term(__first, __last, __ml);
+ if (__temp == __first)
+ break;
+ __first = __temp;
}
- return __first;
+ }
+ return __first;
}
template <class _CharT, class _Traits>
template <class _ForwardIterator>
-_ForwardIterator
-basic_regex<_CharT, _Traits>::__parse_expression_term(_ForwardIterator __first,
- _ForwardIterator __last,
- __bracket_expression<_CharT, _Traits>* __ml)
-{
- if (__first != __last && *__first != ']')
- {
- _ForwardIterator __temp = std::next(__first);
- basic_string<_CharT> __start_range;
- if (__temp != __last && *__first == '[')
- {
- if (*__temp == '=')
- return __parse_equivalence_class(++__temp, __last, __ml);
- else if (*__temp == ':')
- return __parse_character_class(++__temp, __last, __ml);
- else if (*__temp == '.')
- __first = __parse_collating_symbol(++__temp, __last, __start_range);
- }
- unsigned __grammar = __get_grammar(__flags_);
- if (__start_range.empty())
- {
- if ((__grammar == ECMAScript || __grammar == awk) && *__first == '\\')
- {
- if (__grammar == ECMAScript)
- __first = __parse_class_escape(++__first, __last, __start_range, __ml);
- else
- __first = __parse_awk_escape(++__first, __last, &__start_range);
- }
- else
- {
- __start_range = *__first;
- ++__first;
- }
- }
- if (__first != __last && *__first != ']')
- {
- __temp = std::next(__first);
- if (__temp != __last && *__first == '-' && *__temp != ']')
- {
- // parse a range
- basic_string<_CharT> __end_range;
- __first = __temp;
- ++__temp;
- if (__temp != __last && *__first == '[' && *__temp == '.')
- __first = __parse_collating_symbol(++__temp, __last, __end_range);
- else
- {
- if ((__grammar == ECMAScript || __grammar == awk) && *__first == '\\')
- {
- if (__grammar == ECMAScript)
- __first = __parse_class_escape(++__first, __last,
- __end_range, __ml);
- else
- __first = __parse_awk_escape(++__first, __last,
- &__end_range);
- }
- else
- {
- __end_range = *__first;
- ++__first;
- }
- }
- __ml->__add_range(std::move(__start_range), std::move(__end_range));
- }
- else if (!__start_range.empty())
- {
- if (__start_range.size() == 1)
- __ml->__add_char(__start_range[0]);
- else
- __ml->__add_digraph(__start_range[0], __start_range[1]);
- }
- }
- else if (!__start_range.empty())
- {
- if (__start_range.size() == 1)
- __ml->__add_char(__start_range[0]);
+_ForwardIterator basic_regex<_CharT, _Traits>::__parse_expression_term(
+ _ForwardIterator __first, _ForwardIterator __last, __bracket_expression<_CharT, _Traits>* __ml) {
+ if (__first != __last && *__first != ']') {
+ _ForwardIterator __temp = std::next(__first);
+ basic_string<_CharT> __start_range;
+ if (__temp != __last && *__first == '[') {
+ if (*__temp == '=')
+ return __parse_equivalence_class(++__temp, __last, __ml);
+ else if (*__temp == ':')
+ return __parse_character_class(++__temp, __last, __ml);
+ else if (*__temp == '.')
+ __first = __parse_collating_symbol(++__temp, __last, __start_range);
+ }
+ unsigned __grammar = __get_grammar(__flags_);
+ if (__start_range.empty()) {
+ if ((__grammar == ECMAScript || __grammar == awk) && *__first == '\\') {
+ if (__grammar == ECMAScript)
+ __first = __parse_class_escape(++__first, __last, __start_range, __ml);
+ else
+ __first = __parse_awk_escape(++__first, __last, &__start_range);
+ } else {
+ __start_range = *__first;
+ ++__first;
+ }
+ }
+ if (__first != __last && *__first != ']') {
+ __temp = std::next(__first);
+ if (__temp != __last && *__first == '-' && *__temp != ']') {
+ // parse a range
+ basic_string<_CharT> __end_range;
+ __first = __temp;
+ ++__temp;
+ if (__temp != __last && *__first == '[' && *__temp == '.')
+ __first = __parse_collating_symbol(++__temp, __last, __end_range);
+ else {
+ if ((__grammar == ECMAScript || __grammar == awk) && *__first == '\\') {
+ if (__grammar == ECMAScript)
+ __first = __parse_class_escape(++__first, __last, __end_range, __ml);
else
- __ml->__add_digraph(__start_range[0], __start_range[1]);
+ __first = __parse_awk_escape(++__first, __last, &__end_range);
+ } else {
+ __end_range = *__first;
+ ++__first;
+ }
}
+ __ml->__add_range(std::move(__start_range), std::move(__end_range));
+ } else if (!__start_range.empty()) {
+ if (__start_range.size() == 1)
+ __ml->__add_char(__start_range[0]);
+ else
+ __ml->__add_digraph(__start_range[0], __start_range[1]);
+ }
+ } else if (!__start_range.empty()) {
+ if (__start_range.size() == 1)
+ __ml->__add_char(__start_range[0]);
+ else
+ __ml->__add_digraph(__start_range[0], __start_range[1]);
}
- return __first;
+ }
+ return __first;
}
template <class _CharT, class _Traits>
template <class _ForwardIterator>
-_ForwardIterator
-basic_regex<_CharT, _Traits>::__parse_class_escape(_ForwardIterator __first,
- _ForwardIterator __last,
- basic_string<_CharT>& __str,
- __bracket_expression<_CharT, _Traits>* __ml)
-{
- if (__first == __last)
- __throw_regex_error<regex_constants::error_escape>();
- switch (*__first)
- {
- case 0:
- __str = *__first;
- return ++__first;
- case 'b':
- __str = _CharT(8);
- return ++__first;
- case 'd':
- __ml->__add_class(ctype_base::digit);
- return ++__first;
- case 'D':
- __ml->__add_neg_class(ctype_base::digit);
- return ++__first;
- case 's':
- __ml->__add_class(ctype_base::space);
- return ++__first;
- case 'S':
- __ml->__add_neg_class(ctype_base::space);
- return ++__first;
- case 'w':
- __ml->__add_class(ctype_base::alnum);
- __ml->__add_char('_');
- return ++__first;
- case 'W':
- __ml->__add_neg_class(ctype_base::alnum);
- __ml->__add_neg_char('_');
- return ++__first;
- }
- __first = __parse_character_escape(__first, __last, &__str);
- return __first;
+_ForwardIterator basic_regex<_CharT, _Traits>::__parse_class_escape(
+ _ForwardIterator __first,
+ _ForwardIterator __last,
+ basic_string<_CharT>& __str,
+ __bracket_expression<_CharT, _Traits>* __ml) {
+ if (__first == __last)
+ __throw_regex_error<regex_constants::error_escape>();
+ switch (*__first) {
+ case 0:
+ __str = *__first;
+ return ++__first;
+ case 'b':
+ __str = _CharT(8);
+ return ++__first;
+ case 'd':
+ __ml->__add_class(ctype_base::digit);
+ return ++__first;
+ case 'D':
+ __ml->__add_neg_class(ctype_base::digit);
+ return ++__first;
+ case 's':
+ __ml->__add_class(ctype_base::space);
+ return ++__first;
+ case 'S':
+ __ml->__add_neg_class(ctype_base::space);
+ return ++__first;
+ case 'w':
+ __ml->__add_class(ctype_base::alnum);
+ __ml->__add_char('_');
+ return ++__first;
+ case 'W':
+ __ml->__add_neg_class(ctype_base::alnum);
+ __ml->__add_neg_char('_');
+ return ++__first;
+ }
+ __first = __parse_character_escape(__first, __last, &__str);
+ return __first;
}
template <class _CharT, class _Traits>
template <class _ForwardIterator>
-_ForwardIterator
-basic_regex<_CharT, _Traits>::__parse_awk_escape(_ForwardIterator __first,
- _ForwardIterator __last,
- basic_string<_CharT>* __str)
-{
- if (__first == __last)
- __throw_regex_error<regex_constants::error_escape>();
- switch (*__first)
- {
- case '\\':
- case '"':
- case '/':
- if (__str)
- *__str = *__first;
- else
- __push_char(*__first);
- return ++__first;
- case 'a':
- if (__str)
- *__str = _CharT(7);
- else
- __push_char(_CharT(7));
- return ++__first;
- case 'b':
- if (__str)
- *__str = _CharT(8);
- else
- __push_char(_CharT(8));
- return ++__first;
- case 'f':
- if (__str)
- *__str = _CharT(0xC);
- else
- __push_char(_CharT(0xC));
- return ++__first;
- case 'n':
- if (__str)
- *__str = _CharT(0xA);
- else
- __push_char(_CharT(0xA));
- return ++__first;
- case 'r':
- if (__str)
- *__str = _CharT(0xD);
- else
- __push_char(_CharT(0xD));
- return ++__first;
- case 't':
- if (__str)
- *__str = _CharT(0x9);
- else
- __push_char(_CharT(0x9));
- return ++__first;
- case 'v':
- if (__str)
- *__str = _CharT(0xB);
- else
- __push_char(_CharT(0xB));
- return ++__first;
- }
- if ('0' <= *__first && *__first <= '7')
- {
- unsigned __val = *__first - '0';
- if (++__first != __last && ('0' <= *__first && *__first <= '7'))
- {
- __val = 8 * __val + *__first - '0';
- if (++__first != __last && ('0' <= *__first && *__first <= '7'))
- __val = 8 * __val + *__first++ - '0';
- }
- if (__str)
- *__str = _CharT(__val);
- else
- __push_char(_CharT(__val));
+_ForwardIterator basic_regex<_CharT, _Traits>::__parse_awk_escape(
+ _ForwardIterator __first, _ForwardIterator __last, basic_string<_CharT>* __str) {
+ if (__first == __last)
+ __throw_regex_error<regex_constants::error_escape>();
+ switch (*__first) {
+ case '\\':
+ case '"':
+ case '/':
+ if (__str)
+ *__str = *__first;
+ else
+ __push_char(*__first);
+ return ++__first;
+ case 'a':
+ if (__str)
+ *__str = _CharT(7);
+ else
+ __push_char(_CharT(7));
+ return ++__first;
+ case 'b':
+ if (__str)
+ *__str = _CharT(8);
+ else
+ __push_char(_CharT(8));
+ return ++__first;
+ case 'f':
+ if (__str)
+ *__str = _CharT(0xC);
+ else
+ __push_char(_CharT(0xC));
+ return ++__first;
+ case 'n':
+ if (__str)
+ *__str = _CharT(0xA);
+ else
+ __push_char(_CharT(0xA));
+ return ++__first;
+ case 'r':
+ if (__str)
+ *__str = _CharT(0xD);
+ else
+ __push_char(_CharT(0xD));
+ return ++__first;
+ case 't':
+ if (__str)
+ *__str = _CharT(0x9);
+ else
+ __push_char(_CharT(0x9));
+ return ++__first;
+ case 'v':
+ if (__str)
+ *__str = _CharT(0xB);
+ else
+ __push_char(_CharT(0xB));
+ return ++__first;
+ }
+ if ('0' <= *__first && *__first <= '7') {
+ unsigned __val = *__first - '0';
+ if (++__first != __last && ('0' <= *__first && *__first <= '7')) {
+ __val = 8 * __val + *__first - '0';
+ if (++__first != __last && ('0' <= *__first && *__first <= '7'))
+ __val = 8 * __val + *__first++ - '0';
}
+ if (__str)
+ *__str = _CharT(__val);
else
- __throw_regex_error<regex_constants::error_escape>();
- return __first;
+ __push_char(_CharT(__val));
+ } else
+ __throw_regex_error<regex_constants::error_escape>();
+ return __first;
}
template <class _CharT, class _Traits>
template <class _ForwardIterator>
-_ForwardIterator
-basic_regex<_CharT, _Traits>::__parse_equivalence_class(_ForwardIterator __first,
- _ForwardIterator __last,
- __bracket_expression<_CharT, _Traits>* __ml)
-{
- // Found [=
- // This means =] must exist
- value_type __equal_close[2] = {'=', ']'};
- _ForwardIterator __temp = std::search(__first, __last, __equal_close,
- __equal_close+2);
- if (__temp == __last)
- __throw_regex_error<regex_constants::error_brack>();
- // [__first, __temp) contains all text in [= ... =]
- string_type __collate_name =
- __traits_.lookup_collatename(__first, __temp);
- if (__collate_name.empty())
- __throw_regex_error<regex_constants::error_collate>();
- string_type __equiv_name =
- __traits_.transform_primary(__collate_name.begin(),
- __collate_name.end());
- if (!__equiv_name.empty())
- __ml->__add_equivalence(__equiv_name);
- else
- {
- switch (__collate_name.size())
- {
- case 1:
- __ml->__add_char(__collate_name[0]);
- break;
- case 2:
- __ml->__add_digraph(__collate_name[0], __collate_name[1]);
- break;
- default:
- __throw_regex_error<regex_constants::error_collate>();
- }
+_ForwardIterator basic_regex<_CharT, _Traits>::__parse_equivalence_class(
+ _ForwardIterator __first, _ForwardIterator __last, __bracket_expression<_CharT, _Traits>* __ml) {
+ // Found [=
+ // This means =] must exist
+ value_type __equal_close[2] = {'=', ']'};
+ _ForwardIterator __temp = std::search(__first, __last, __equal_close, __equal_close + 2);
+ if (__temp == __last)
+ __throw_regex_error<regex_constants::error_brack>();
+ // [__first, __temp) contains all text in [= ... =]
+ string_type __collate_name = __traits_.lookup_collatename(__first, __temp);
+ if (__collate_name.empty())
+ __throw_regex_error<regex_constants::error_collate>();
+ string_type __equiv_name = __traits_.transform_primary(__collate_name.begin(), __collate_name.end());
+ if (!__equiv_name.empty())
+ __ml->__add_equivalence(__equiv_name);
+ else {
+ switch (__collate_name.size()) {
+ case 1:
+ __ml->__add_char(__collate_name[0]);
+ break;
+ case 2:
+ __ml->__add_digraph(__collate_name[0], __collate_name[1]);
+ break;
+ default:
+ __throw_regex_error<regex_constants::error_collate>();
}
- __first = std::next(__temp, 2);
- return __first;
+ }
+ __first = std::next(__temp, 2);
+ return __first;
}
template <class _CharT, class _Traits>
template <class _ForwardIterator>
-_ForwardIterator
-basic_regex<_CharT, _Traits>::__parse_character_class(_ForwardIterator __first,
- _ForwardIterator __last,
- __bracket_expression<_CharT, _Traits>* __ml)
-{
- // Found [:
- // This means :] must exist
- value_type __colon_close[2] = {':', ']'};
- _ForwardIterator __temp = std::search(__first, __last, __colon_close,
- __colon_close+2);
- if (__temp == __last)
- __throw_regex_error<regex_constants::error_brack>();
- // [__first, __temp) contains all text in [: ... :]
- typedef typename _Traits::char_class_type char_class_type;
- char_class_type __class_type =
- __traits_.lookup_classname(__first, __temp, __flags_ & icase);
- if (__class_type == 0)
- __throw_regex_error<regex_constants::error_ctype>();
- __ml->__add_class(__class_type);
- __first = std::next(__temp, 2);
- return __first;
+_ForwardIterator basic_regex<_CharT, _Traits>::__parse_character_class(
+ _ForwardIterator __first, _ForwardIterator __last, __bracket_expression<_CharT, _Traits>* __ml) {
+ // Found [:
+ // This means :] must exist
+ value_type __colon_close[2] = {':', ']'};
+ _ForwardIterator __temp = std::search(__first, __last, __colon_close, __colon_close + 2);
+ if (__temp == __last)
+ __throw_regex_error<regex_constants::error_brack>();
+ // [__first, __temp) contains all text in [: ... :]
+ typedef typename _Traits::char_class_type char_class_type;
+ char_class_type __class_type = __traits_.lookup_classname(__first, __temp, __flags_ & icase);
+ if (__class_type == 0)
+ __throw_regex_error<regex_constants::error_ctype>();
+ __ml->__add_class(__class_type);
+ __first = std::next(__temp, 2);
+ return __first;
}
template <class _CharT, class _Traits>
template <class _ForwardIterator>
-_ForwardIterator
-basic_regex<_CharT, _Traits>::__parse_collating_symbol(_ForwardIterator __first,
- _ForwardIterator __last,
- basic_string<_CharT>& __col_sym)
-{
- // Found [.
- // This means .] must exist
- value_type __dot_close[2] = {'.', ']'};
- _ForwardIterator __temp = std::search(__first, __last, __dot_close,
- __dot_close+2);
- if (__temp == __last)
- __throw_regex_error<regex_constants::error_brack>();
- // [__first, __temp) contains all text in [. ... .]
- __col_sym = __traits_.lookup_collatename(__first, __temp);
- switch (__col_sym.size())
- {
- case 1:
- case 2:
- break;
- default:
- __throw_regex_error<regex_constants::error_collate>();
- }
- __first = std::next(__temp, 2);
- return __first;
+_ForwardIterator basic_regex<_CharT, _Traits>::__parse_collating_symbol(
+ _ForwardIterator __first, _ForwardIterator __last, basic_string<_CharT>& __col_sym) {
+ // Found [.
+ // This means .] must exist
+ value_type __dot_close[2] = {'.', ']'};
+ _ForwardIterator __temp = std::search(__first, __last, __dot_close, __dot_close + 2);
+ if (__temp == __last)
+ __throw_regex_error<regex_constants::error_brack>();
+ // [__first, __temp) contains all text in [. ... .]
+ __col_sym = __traits_.lookup_collatename(__first, __temp);
+ switch (__col_sym.size()) {
+ case 1:
+ case 2:
+ break;
+ default:
+ __throw_regex_error<regex_constants::error_collate>();
+ }
+ __first = std::next(__temp, 2);
+ return __first;
}
template <class _CharT, class _Traits>
template <class _ForwardIterator>
_ForwardIterator
-basic_regex<_CharT, _Traits>::__parse_DUP_COUNT(_ForwardIterator __first,
- _ForwardIterator __last,
- int& __c)
-{
- if (__first != __last )
- {
- int __val = __traits_.value(*__first, 10);
- if ( __val != -1 )
- {
- __c = __val;
- for (++__first;
- __first != __last && ( __val = __traits_.value(*__first, 10)) != -1;
- ++__first)
- {
- if (__c >= numeric_limits<int>::max() / 10)
- __throw_regex_error<regex_constants::error_badbrace>();
- __c *= 10;
- __c += __val;
- }
- }
+basic_regex<_CharT, _Traits>::__parse_DUP_COUNT(_ForwardIterator __first, _ForwardIterator __last, int& __c) {
+ if (__first != __last) {
+ int __val = __traits_.value(*__first, 10);
+ if (__val != -1) {
+ __c = __val;
+ for (++__first; __first != __last && (__val = __traits_.value(*__first, 10)) != -1; ++__first) {
+ if (__c >= numeric_limits<int>::max() / 10)
+ __throw_regex_error<regex_constants::error_badbrace>();
+ __c *= 10;
+ __c += __val;
+ }
}
- return __first;
+ }
+ return __first;
}
template <class _CharT, class _Traits>
template <class _ForwardIterator>
-_ForwardIterator
-basic_regex<_CharT, _Traits>::__parse_ecma_exp(_ForwardIterator __first,
- _ForwardIterator __last)
-{
- __owns_one_state<_CharT>* __sa = __end_;
- _ForwardIterator __temp = __parse_alternative(__first, __last);
+_ForwardIterator basic_regex<_CharT, _Traits>::__parse_ecma_exp(_ForwardIterator __first, _ForwardIterator __last) {
+ __owns_one_state<_CharT>* __sa = __end_;
+ _ForwardIterator __temp = __parse_alternative(__first, __last);
+ if (__temp == __first)
+ __push_empty();
+ __first = __temp;
+ while (__first != __last && *__first == '|') {
+ __owns_one_state<_CharT>* __sb = __end_;
+ __temp = __parse_alternative(++__first, __last);
if (__temp == __first)
- __push_empty();
+ __push_empty();
+ __push_alternation(__sa, __sb);
__first = __temp;
- while (__first != __last && *__first == '|')
- {
- __owns_one_state<_CharT>* __sb = __end_;
- __temp = __parse_alternative(++__first, __last);
- if (__temp == __first)
- __push_empty();
- __push_alternation(__sa, __sb);
- __first = __temp;
- }
- return __first;
+ }
+ return __first;
}
template <class _CharT, class _Traits>
template <class _ForwardIterator>
-_ForwardIterator
-basic_regex<_CharT, _Traits>::__parse_alternative(_ForwardIterator __first,
- _ForwardIterator __last)
-{
- while (true)
- {
- _ForwardIterator __temp = __parse_term(__first, __last);
- if (__temp == __first)
- break;
- __first = __temp;
- }
- return __first;
+_ForwardIterator basic_regex<_CharT, _Traits>::__parse_alternative(_ForwardIterator __first, _ForwardIterator __last) {
+ while (true) {
+ _ForwardIterator __temp = __parse_term(__first, __last);
+ if (__temp == __first)
+ break;
+ __first = __temp;
+ }
+ return __first;
}
template <class _CharT, class _Traits>
template <class _ForwardIterator>
-_ForwardIterator
-basic_regex<_CharT, _Traits>::__parse_term(_ForwardIterator __first,
- _ForwardIterator __last)
-{
- _ForwardIterator __temp = __parse_assertion(__first, __last);
- if (__temp == __first)
- {
- __owns_one_state<_CharT>* __e = __end_;
- unsigned __mexp_begin = __marked_count_;
- __temp = __parse_atom(__first, __last);
- if (__temp != __first)
- __first = __parse_ERE_dupl_symbol(__temp, __last, __e,
- __mexp_begin+1, __marked_count_+1);
- }
- else
- __first = __temp;
- return __first;
+_ForwardIterator basic_regex<_CharT, _Traits>::__parse_term(_ForwardIterator __first, _ForwardIterator __last) {
+ _ForwardIterator __temp = __parse_assertion(__first, __last);
+ if (__temp == __first) {
+ __owns_one_state<_CharT>* __e = __end_;
+ unsigned __mexp_begin = __marked_count_;
+ __temp = __parse_atom(__first, __last);
+ if (__temp != __first)
+ __first = __parse_ERE_dupl_symbol(__temp, __last, __e, __mexp_begin + 1, __marked_count_ + 1);
+ } else
+ __first = __temp;
+ return __first;
}
template <class _CharT, class _Traits>
template <class _ForwardIterator>
-_ForwardIterator
-basic_regex<_CharT, _Traits>::__parse_assertion(_ForwardIterator __first,
- _ForwardIterator __last)
-{
- if (__first != __last)
- {
- switch (*__first)
- {
- case '^':
- __push_l_anchor();
- ++__first;
- break;
- case '$':
- __push_r_anchor();
- ++__first;
- break;
- case '\\':
- {
- _ForwardIterator __temp = std::next(__first);
- if (__temp != __last)
- {
- if (*__temp == 'b')
- {
- __push_word_boundary(false);
- __first = ++__temp;
- }
- else if (*__temp == 'B')
- {
- __push_word_boundary(true);
- __first = ++__temp;
- }
- }
- }
- break;
- case '(':
- {
- _ForwardIterator __temp = std::next(__first);
- if (__temp != __last && *__temp == '?')
- {
- if (++__temp != __last)
- {
- switch (*__temp)
- {
- case '=':
- {
- basic_regex __exp;
- __exp.__flags_ = __flags_;
- __temp = __exp.__parse(++__temp, __last);
- unsigned __mexp = __exp.__marked_count_;
- __push_lookahead(std::move(__exp), false, __marked_count_);
- __marked_count_ += __mexp;
- if (__temp == __last || *__temp != ')')
- __throw_regex_error<regex_constants::error_paren>();
- __first = ++__temp;
- }
- break;
- case '!':
- {
- basic_regex __exp;
- __exp.__flags_ = __flags_;
- __temp = __exp.__parse(++__temp, __last);
- unsigned __mexp = __exp.__marked_count_;
- __push_lookahead(std::move(__exp), true, __marked_count_);
- __marked_count_ += __mexp;
- if (__temp == __last || *__temp != ')')
- __throw_regex_error<regex_constants::error_paren>();
- __first = ++__temp;
- }
- break;
- }
- }
- }
- }
- break;
+_ForwardIterator basic_regex<_CharT, _Traits>::__parse_assertion(_ForwardIterator __first, _ForwardIterator __last) {
+ if (__first != __last) {
+ switch (*__first) {
+ case '^':
+ __push_l_anchor();
+ ++__first;
+ break;
+ case '$':
+ __push_r_anchor();
+ ++__first;
+ break;
+ case '\\': {
+ _ForwardIterator __temp = std::next(__first);
+ if (__temp != __last) {
+ if (*__temp == 'b') {
+ __push_word_boundary(false);
+ __first = ++__temp;
+ } else if (*__temp == 'B') {
+ __push_word_boundary(true);
+ __first = ++__temp;
+ }
+ }
+ } break;
+ case '(': {
+ _ForwardIterator __temp = std::next(__first);
+ if (__temp != __last && *__temp == '?') {
+ if (++__temp != __last) {
+ switch (*__temp) {
+ case '=': {
+ basic_regex __exp;
+ __exp.__flags_ = __flags_;
+ __temp = __exp.__parse(++__temp, __last);
+ unsigned __mexp = __exp.__marked_count_;
+ __push_lookahead(std::move(__exp), false, __marked_count_);
+ __marked_count_ += __mexp;
+ if (__temp == __last || *__temp != ')')
+ __throw_regex_error<regex_constants::error_paren>();
+ __first = ++__temp;
+ } break;
+ case '!': {
+ basic_regex __exp;
+ __exp.__flags_ = __flags_;
+ __temp = __exp.__parse(++__temp, __last);
+ unsigned __mexp = __exp.__marked_count_;
+ __push_lookahead(std::move(__exp), true, __marked_count_);
+ __marked_count_ += __mexp;
+ if (__temp == __last || *__temp != ')')
+ __throw_regex_error<regex_constants::error_paren>();
+ __first = ++__temp;
+ } break;
+ }
}
+ }
+ } break;
}
- return __first;
+ }
+ return __first;
}
template <class _CharT, class _Traits>
template <class _ForwardIterator>
-_ForwardIterator
-basic_regex<_CharT, _Traits>::__parse_atom(_ForwardIterator __first,
- _ForwardIterator __last)
-{
- if (__first != __last)
- {
- switch (*__first)
- {
- case '.':
- __push_match_any_but_newline();
- ++__first;
- break;
- case '\\':
- __first = __parse_atom_escape(__first, __last);
- break;
- case '[':
- __first = __parse_bracket_expression(__first, __last);
- break;
- case '(':
- {
- ++__first;
- if (__first == __last)
- __throw_regex_error<regex_constants::error_paren>();
- _ForwardIterator __temp = std::next(__first);
- if (__temp != __last && *__first == '?' && *__temp == ':')
- {
- ++__open_count_;
- __first = __parse_ecma_exp(++__temp, __last);
- if (__first == __last || *__first != ')')
- __throw_regex_error<regex_constants::error_paren>();
- --__open_count_;
- ++__first;
- }
- else
- {
- __push_begin_marked_subexpression();
- unsigned __temp_count = __marked_count_;
- ++__open_count_;
- __first = __parse_ecma_exp(__first, __last);
- if (__first == __last || *__first != ')')
- __throw_regex_error<regex_constants::error_paren>();
- __push_end_marked_subexpression(__temp_count);
- --__open_count_;
- ++__first;
- }
- }
- break;
- case '*':
- case '+':
- case '?':
- case '{':
- __throw_regex_error<regex_constants::error_badrepeat>();
- break;
- default:
- __first = __parse_pattern_character(__first, __last);
- break;
- }
+_ForwardIterator basic_regex<_CharT, _Traits>::__parse_atom(_ForwardIterator __first, _ForwardIterator __last) {
+ if (__first != __last) {
+ switch (*__first) {
+ case '.':
+ __push_match_any_but_newline();
+ ++__first;
+ break;
+ case '\\':
+ __first = __parse_atom_escape(__first, __last);
+ break;
+ case '[':
+ __first = __parse_bracket_expression(__first, __last);
+ break;
+ case '(': {
+ ++__first;
+ if (__first == __last)
+ __throw_regex_error<regex_constants::error_paren>();
+ _ForwardIterator __temp = std::next(__first);
+ if (__temp != __last && *__first == '?' && *__temp == ':') {
+ ++__open_count_;
+ __first = __parse_ecma_exp(++__temp, __last);
+ if (__first == __last || *__first != ')')
+ __throw_regex_error<regex_constants::error_paren>();
+ --__open_count_;
+ ++__first;
+ } else {
+ __push_begin_marked_subexpression();
+ unsigned __temp_count = __marked_count_;
+ ++__open_count_;
+ __first = __parse_ecma_exp(__first, __last);
+ if (__first == __last || *__first != ')')
+ __throw_regex_error<regex_constants::error_paren>();
+ __push_end_marked_subexpression(__temp_count);
+ --__open_count_;
+ ++__first;
+ }
+ } break;
+ case '*':
+ case '+':
+ case '?':
+ case '{':
+ __throw_regex_error<regex_constants::error_badrepeat>();
+ break;
+ default:
+ __first = __parse_pattern_character(__first, __last);
+ break;
}
- return __first;
+ }
+ return __first;
}
template <class _CharT, class _Traits>
template <class _ForwardIterator>
-_ForwardIterator
-basic_regex<_CharT, _Traits>::__parse_atom_escape(_ForwardIterator __first,
- _ForwardIterator __last)
-{
- if (__first != __last && *__first == '\\')
- {
- _ForwardIterator __t1 = std::next(__first);
- if (__t1 == __last)
- __throw_regex_error<regex_constants::error_escape>();
-
- _ForwardIterator __t2 = __parse_decimal_escape(__t1, __last);
+_ForwardIterator basic_regex<_CharT, _Traits>::__parse_atom_escape(_ForwardIterator __first, _ForwardIterator __last) {
+ if (__first != __last && *__first == '\\') {
+ _ForwardIterator __t1 = std::next(__first);
+ if (__t1 == __last)
+ __throw_regex_error<regex_constants::error_escape>();
+
+ _ForwardIterator __t2 = __parse_decimal_escape(__t1, __last);
+ if (__t2 != __t1)
+ __first = __t2;
+ else {
+ __t2 = __parse_character_class_escape(__t1, __last);
+ if (__t2 != __t1)
+ __first = __t2;
+ else {
+ __t2 = __parse_character_escape(__t1, __last);
if (__t2 != __t1)
- __first = __t2;
- else
- {
- __t2 = __parse_character_class_escape(__t1, __last);
- if (__t2 != __t1)
- __first = __t2;
- else
- {
- __t2 = __parse_character_escape(__t1, __last);
- if (__t2 != __t1)
- __first = __t2;
- }
- }
+ __first = __t2;
+ }
}
- return __first;
+ }
+ return __first;
}
template <class _CharT, class _Traits>
template <class _ForwardIterator>
_ForwardIterator
-basic_regex<_CharT, _Traits>::__parse_decimal_escape(_ForwardIterator __first,
- _ForwardIterator __last)
-{
- if (__first != __last)
- {
- if (*__first == '0')
- {
- __push_char(_CharT());
- ++__first;
- }
- else if ('1' <= *__first && *__first <= '9')
- {
- unsigned __v = *__first - '0';
- for (++__first;
- __first != __last && '0' <= *__first && *__first <= '9'; ++__first)
- {
- if (__v >= numeric_limits<unsigned>::max() / 10)
- __throw_regex_error<regex_constants::error_backref>();
- __v = 10 * __v + *__first - '0';
- }
- if (__v == 0 || __v > mark_count())
- __throw_regex_error<regex_constants::error_backref>();
- __push_back_ref(__v);
- }
+basic_regex<_CharT, _Traits>::__parse_decimal_escape(_ForwardIterator __first, _ForwardIterator __last) {
+ if (__first != __last) {
+ if (*__first == '0') {
+ __push_char(_CharT());
+ ++__first;
+ } else if ('1' <= *__first && *__first <= '9') {
+ unsigned __v = *__first - '0';
+ for (++__first; __first != __last && '0' <= *__first && *__first <= '9'; ++__first) {
+ if (__v >= numeric_limits<unsigned>::max() / 10)
+ __throw_regex_error<regex_constants::error_backref>();
+ __v = 10 * __v + *__first - '0';
+ }
+ if (__v == 0 || __v > mark_count())
+ __throw_regex_error<regex_constants::error_backref>();
+ __push_back_ref(__v);
}
- return __first;
+ }
+ return __first;
}
template <class _CharT, class _Traits>
template <class _ForwardIterator>
_ForwardIterator
-basic_regex<_CharT, _Traits>::__parse_character_class_escape(_ForwardIterator __first,
- _ForwardIterator __last)
-{
- if (__first != __last)
- {
- __bracket_expression<_CharT, _Traits>* __ml;
- switch (*__first)
- {
- case 'd':
- __ml = __start_matching_list(false);
- __ml->__add_class(ctype_base::digit);
- ++__first;
- break;
- case 'D':
- __ml = __start_matching_list(true);
- __ml->__add_class(ctype_base::digit);
- ++__first;
- break;
- case 's':
- __ml = __start_matching_list(false);
- __ml->__add_class(ctype_base::space);
- ++__first;
- break;
- case 'S':
- __ml = __start_matching_list(true);
- __ml->__add_class(ctype_base::space);
- ++__first;
- break;
- case 'w':
- __ml = __start_matching_list(false);
- __ml->__add_class(ctype_base::alnum);
- __ml->__add_char('_');
- ++__first;
- break;
- case 'W':
- __ml = __start_matching_list(true);
- __ml->__add_class(ctype_base::alnum);
- __ml->__add_char('_');
- ++__first;
- break;
- }
+basic_regex<_CharT, _Traits>::__parse_character_class_escape(_ForwardIterator __first, _ForwardIterator __last) {
+ if (__first != __last) {
+ __bracket_expression<_CharT, _Traits>* __ml;
+ switch (*__first) {
+ case 'd':
+ __ml = __start_matching_list(false);
+ __ml->__add_class(ctype_base::digit);
+ ++__first;
+ break;
+ case 'D':
+ __ml = __start_matching_list(true);
+ __ml->__add_class(ctype_base::digit);
+ ++__first;
+ break;
+ case 's':
+ __ml = __start_matching_list(false);
+ __ml->__add_class(ctype_base::space);
+ ++__first;
+ break;
+ case 'S':
+ __ml = __start_matching_list(true);
+ __ml->__add_class(ctype_base::space);
+ ++__first;
+ break;
+ case 'w':
+ __ml = __start_matching_list(false);
+ __ml->__add_class(ctype_base::alnum);
+ __ml->__add_char('_');
+ ++__first;
+ break;
+ case 'W':
+ __ml = __start_matching_list(true);
+ __ml->__add_class(ctype_base::alnum);
+ __ml->__add_char('_');
+ ++__first;
+ break;
}
- return __first;
+ }
+ return __first;
}
template <class _CharT, class _Traits>
template <class _ForwardIterator>
-_ForwardIterator
-basic_regex<_CharT, _Traits>::__parse_character_escape(_ForwardIterator __first,
- _ForwardIterator __last,
- basic_string<_CharT>* __str)
-{
- if (__first != __last)
- {
- _ForwardIterator __t;
- unsigned __sum = 0;
- int __hd;
- switch (*__first)
- {
- case 'f':
- if (__str)
- *__str = _CharT(0xC);
- else
- __push_char(_CharT(0xC));
- ++__first;
- break;
- case 'n':
- if (__str)
- *__str = _CharT(0xA);
- else
- __push_char(_CharT(0xA));
- ++__first;
- break;
- case 'r':
- if (__str)
- *__str = _CharT(0xD);
- else
- __push_char(_CharT(0xD));
- ++__first;
- break;
- case 't':
- if (__str)
- *__str = _CharT(0x9);
- else
- __push_char(_CharT(0x9));
- ++__first;
- break;
- case 'v':
- if (__str)
- *__str = _CharT(0xB);
- else
- __push_char(_CharT(0xB));
- ++__first;
- break;
- case 'c':
- if ((__t = std::next(__first)) != __last)
- {
- if (('A' <= *__t && *__t <= 'Z') ||
- ('a' <= *__t && *__t <= 'z'))
- {
- if (__str)
- *__str = _CharT(*__t % 32);
- else
- __push_char(_CharT(*__t % 32));
- __first = ++__t;
- }
- else
- __throw_regex_error<regex_constants::error_escape>();
- }
- else
- __throw_regex_error<regex_constants::error_escape>();
- break;
- case 'u':
- ++__first;
- if (__first == __last)
- __throw_regex_error<regex_constants::error_escape>();
- __hd = __traits_.value(*__first, 16);
- if (__hd == -1)
- __throw_regex_error<regex_constants::error_escape>();
- __sum = 16 * __sum + static_cast<unsigned>(__hd);
- ++__first;
- if (__first == __last)
- __throw_regex_error<regex_constants::error_escape>();
- __hd = __traits_.value(*__first, 16);
- if (__hd == -1)
- __throw_regex_error<regex_constants::error_escape>();
- __sum = 16 * __sum + static_cast<unsigned>(__hd);
- // fallthrough
- case 'x':
- ++__first;
- if (__first == __last)
- __throw_regex_error<regex_constants::error_escape>();
- __hd = __traits_.value(*__first, 16);
- if (__hd == -1)
- __throw_regex_error<regex_constants::error_escape>();
- __sum = 16 * __sum + static_cast<unsigned>(__hd);
- ++__first;
- if (__first == __last)
- __throw_regex_error<regex_constants::error_escape>();
- __hd = __traits_.value(*__first, 16);
- if (__hd == -1)
- __throw_regex_error<regex_constants::error_escape>();
- __sum = 16 * __sum + static_cast<unsigned>(__hd);
- if (__str)
- *__str = _CharT(__sum);
- else
- __push_char(_CharT(__sum));
- ++__first;
- break;
- case '0':
- if (__str)
- *__str = _CharT(0);
- else
- __push_char(_CharT(0));
- ++__first;
- break;
- default:
- if (*__first != '_' && !__traits_.isctype(*__first, ctype_base::alnum))
- {
- if (__str)
- *__str = *__first;
- else
- __push_char(*__first);
- ++__first;
- }
- else
- __throw_regex_error<regex_constants::error_escape>();
- break;
- }
+_ForwardIterator basic_regex<_CharT, _Traits>::__parse_character_escape(
+ _ForwardIterator __first, _ForwardIterator __last, basic_string<_CharT>* __str) {
+ if (__first != __last) {
+ _ForwardIterator __t;
+ unsigned __sum = 0;
+ int __hd;
+ switch (*__first) {
+ case 'f':
+ if (__str)
+ *__str = _CharT(0xC);
+ else
+ __push_char(_CharT(0xC));
+ ++__first;
+ break;
+ case 'n':
+ if (__str)
+ *__str = _CharT(0xA);
+ else
+ __push_char(_CharT(0xA));
+ ++__first;
+ break;
+ case 'r':
+ if (__str)
+ *__str = _CharT(0xD);
+ else
+ __push_char(_CharT(0xD));
+ ++__first;
+ break;
+ case 't':
+ if (__str)
+ *__str = _CharT(0x9);
+ else
+ __push_char(_CharT(0x9));
+ ++__first;
+ break;
+ case 'v':
+ if (__str)
+ *__str = _CharT(0xB);
+ else
+ __push_char(_CharT(0xB));
+ ++__first;
+ break;
+ case 'c':
+ if ((__t = std::next(__first)) != __last) {
+ if (('A' <= *__t && *__t <= 'Z') || ('a' <= *__t && *__t <= 'z')) {
+ if (__str)
+ *__str = _CharT(*__t % 32);
+ else
+ __push_char(_CharT(*__t % 32));
+ __first = ++__t;
+ } else
+ __throw_regex_error<regex_constants::error_escape>();
+ } else
+ __throw_regex_error<regex_constants::error_escape>();
+ break;
+ case 'u':
+ ++__first;
+ if (__first == __last)
+ __throw_regex_error<regex_constants::error_escape>();
+ __hd = __traits_.value(*__first, 16);
+ if (__hd == -1)
+ __throw_regex_error<regex_constants::error_escape>();
+ __sum = 16 * __sum + static_cast<unsigned>(__hd);
+ ++__first;
+ if (__first == __last)
+ __throw_regex_error<regex_constants::error_escape>();
+ __hd = __traits_.value(*__first, 16);
+ if (__hd == -1)
+ __throw_regex_error<regex_constants::error_escape>();
+ __sum = 16 * __sum + static_cast<unsigned>(__hd);
+ // fallthrough
+ case 'x':
+ ++__first;
+ if (__first == __last)
+ __throw_regex_error<regex_constants::error_escape>();
+ __hd = __traits_.value(*__first, 16);
+ if (__hd == -1)
+ __throw_regex_error<regex_constants::error_escape>();
+ __sum = 16 * __sum + static_cast<unsigned>(__hd);
+ ++__first;
+ if (__first == __last)
+ __throw_regex_error<regex_constants::error_escape>();
+ __hd = __traits_.value(*__first, 16);
+ if (__hd == -1)
+ __throw_regex_error<regex_constants::error_escape>();
+ __sum = 16 * __sum + static_cast<unsigned>(__hd);
+ if (__str)
+ *__str = _CharT(__sum);
+ else
+ __push_char(_CharT(__sum));
+ ++__first;
+ break;
+ case '0':
+ if (__str)
+ *__str = _CharT(0);
+ else
+ __push_char(_CharT(0));
+ ++__first;
+ break;
+ default:
+ if (*__first != '_' && !__traits_.isctype(*__first, ctype_base::alnum)) {
+ if (__str)
+ *__str = *__first;
+ else
+ __push_char(*__first);
+ ++__first;
+ } else
+ __throw_regex_error<regex_constants::error_escape>();
+ break;
}
- return __first;
+ }
+ return __first;
}
template <class _CharT, class _Traits>
template <class _ForwardIterator>
_ForwardIterator
-basic_regex<_CharT, _Traits>::__parse_pattern_character(_ForwardIterator __first,
- _ForwardIterator __last)
-{
- if (__first != __last)
- {
- switch (*__first)
- {
- case '^':
- case '$':
- case '\\':
- case '.':
- case '*':
- case '+':
- case '?':
- case '(':
- case ')':
- case '[':
- case ']':
- case '{':
- case '}':
- case '|':
- break;
- default:
- __push_char(*__first);
- ++__first;
- break;
- }
+basic_regex<_CharT, _Traits>::__parse_pattern_character(_ForwardIterator __first, _ForwardIterator __last) {
+ if (__first != __last) {
+ switch (*__first) {
+ case '^':
+ case '$':
+ case '\\':
+ case '.':
+ case '*':
+ case '+':
+ case '?':
+ case '(':
+ case ')':
+ case '[':
+ case ']':
+ case '{':
+ case '}':
+ case '|':
+ break;
+ default:
+ __push_char(*__first);
+ ++__first;
+ break;
}
- return __first;
+ }
+ return __first;
}
template <class _CharT, class _Traits>
template <class _ForwardIterator>
-_ForwardIterator
-basic_regex<_CharT, _Traits>::__parse_grep(_ForwardIterator __first,
- _ForwardIterator __last)
-{
- __owns_one_state<_CharT>* __sa = __end_;
- _ForwardIterator __t1 = std::find(__first, __last, _CharT('\n'));
+_ForwardIterator basic_regex<_CharT, _Traits>::__parse_grep(_ForwardIterator __first, _ForwardIterator __last) {
+ __owns_one_state<_CharT>* __sa = __end_;
+ _ForwardIterator __t1 = std::find(__first, __last, _CharT('\n'));
+ if (__t1 != __first)
+ __parse_basic_reg_exp(__first, __t1);
+ else
+ __push_empty();
+ __first = __t1;
+ if (__first != __last)
+ ++__first;
+ while (__first != __last) {
+ __t1 = std::find(__first, __last, _CharT('\n'));
+ __owns_one_state<_CharT>* __sb = __end_;
if (__t1 != __first)
- __parse_basic_reg_exp(__first, __t1);
+ __parse_basic_reg_exp(__first, __t1);
else
- __push_empty();
+ __push_empty();
+ __push_alternation(__sa, __sb);
__first = __t1;
if (__first != __last)
- ++__first;
- while (__first != __last)
- {
- __t1 = std::find(__first, __last, _CharT('\n'));
- __owns_one_state<_CharT>* __sb = __end_;
- if (__t1 != __first)
- __parse_basic_reg_exp(__first, __t1);
- else
- __push_empty();
- __push_alternation(__sa, __sb);
- __first = __t1;
- if (__first != __last)
- ++__first;
- }
- return __first;
+ ++__first;
+ }
+ return __first;
}
template <class _CharT, class _Traits>
template <class _ForwardIterator>
-_ForwardIterator
-basic_regex<_CharT, _Traits>::__parse_egrep(_ForwardIterator __first,
- _ForwardIterator __last)
-{
- __owns_one_state<_CharT>* __sa = __end_;
- _ForwardIterator __t1 = std::find(__first, __last, _CharT('\n'));
+_ForwardIterator basic_regex<_CharT, _Traits>::__parse_egrep(_ForwardIterator __first, _ForwardIterator __last) {
+ __owns_one_state<_CharT>* __sa = __end_;
+ _ForwardIterator __t1 = std::find(__first, __last, _CharT('\n'));
+ if (__t1 != __first)
+ __parse_extended_reg_exp(__first, __t1);
+ else
+ __push_empty();
+ __first = __t1;
+ if (__first != __last)
+ ++__first;
+ while (__first != __last) {
+ __t1 = std::find(__first, __last, _CharT('\n'));
+ __owns_one_state<_CharT>* __sb = __end_;
if (__t1 != __first)
- __parse_extended_reg_exp(__first, __t1);
+ __parse_extended_reg_exp(__first, __t1);
else
- __push_empty();
+ __push_empty();
+ __push_alternation(__sa, __sb);
__first = __t1;
if (__first != __last)
- ++__first;
- while (__first != __last)
- {
- __t1 = std::find(__first, __last, _CharT('\n'));
- __owns_one_state<_CharT>* __sb = __end_;
- if (__t1 != __first)
- __parse_extended_reg_exp(__first, __t1);
- else
- __push_empty();
- __push_alternation(__sa, __sb);
- __first = __t1;
- if (__first != __last)
- ++__first;
- }
- return __first;
+ ++__first;
+ }
+ return __first;
}
template <class _CharT, class _Traits>
-bool
-basic_regex<_CharT, _Traits>::__test_back_ref(_CharT __c)
-{
- unsigned __val = __traits_.value(__c, 10);
- if (__val >= 1 && __val <= 9)
- {
- if (__val > mark_count())
- __throw_regex_error<regex_constants::error_backref>();
- __push_back_ref(__val);
- return true;
- }
+bool basic_regex<_CharT, _Traits>::__test_back_ref(_CharT __c) {
+ unsigned __val = __traits_.value(__c, 10);
+ if (__val >= 1 && __val <= 9) {
+ if (__val > mark_count())
+ __throw_regex_error<regex_constants::error_backref>();
+ __push_back_ref(__val);
+ return true;
+ }
- return false;
+ return false;
}
template <class _CharT, class _Traits>
-void
-basic_regex<_CharT, _Traits>::__push_loop(size_t __min, size_t __max,
- __owns_one_state<_CharT>* __s, size_t __mexp_begin, size_t __mexp_end,
- bool __greedy)
-{
- unique_ptr<__empty_state<_CharT> > __e1(new __empty_state<_CharT>(__end_->first()));
- __end_->first() = nullptr;
- unique_ptr<__loop<_CharT> > __e2(new __loop<_CharT>(__loop_count_,
- __s->first(), __e1.get(), __mexp_begin, __mexp_end, __greedy,
- __min, __max));
- __s->first() = nullptr;
- __e1.release();
- __end_->first() = new __repeat_one_loop<_CharT>(__e2.get());
- __end_ = __e2->second();
- __s->first() = __e2.release();
- ++__loop_count_;
+void basic_regex<_CharT, _Traits>::__push_loop(
+ size_t __min, size_t __max, __owns_one_state<_CharT>* __s, size_t __mexp_begin, size_t __mexp_end, bool __greedy) {
+ unique_ptr<__empty_state<_CharT> > __e1(new __empty_state<_CharT>(__end_->first()));
+ __end_->first() = nullptr;
+ unique_ptr<__loop<_CharT> > __e2(
+ new __loop<_CharT>(__loop_count_, __s->first(), __e1.get(), __mexp_begin, __mexp_end, __greedy, __min, __max));
+ __s->first() = nullptr;
+ __e1.release();
+ __end_->first() = new __repeat_one_loop<_CharT>(__e2.get());
+ __end_ = __e2->second();
+ __s->first() = __e2.release();
+ ++__loop_count_;
}
template <class _CharT, class _Traits>
-void
-basic_regex<_CharT, _Traits>::__push_char(value_type __c)
-{
- if (flags() & icase)
- __end_->first() = new __match_char_icase<_CharT, _Traits>
- (__traits_, __c, __end_->first());
- else if (flags() & collate)
- __end_->first() = new __match_char_collate<_CharT, _Traits>
- (__traits_, __c, __end_->first());
- else
- __end_->first() = new __match_char<_CharT>(__c, __end_->first());
- __end_ = static_cast<__owns_one_state<_CharT>*>(__end_->first());
+void basic_regex<_CharT, _Traits>::__push_char(value_type __c) {
+ if (flags() & icase)
+ __end_->first() = new __match_char_icase<_CharT, _Traits>(__traits_, __c, __end_->first());
+ else if (flags() & collate)
+ __end_->first() = new __match_char_collate<_CharT, _Traits>(__traits_, __c, __end_->first());
+ else
+ __end_->first() = new __match_char<_CharT>(__c, __end_->first());
+ __end_ = static_cast<__owns_one_state<_CharT>*>(__end_->first());
}
template <class _CharT, class _Traits>
-void
-basic_regex<_CharT, _Traits>::__push_begin_marked_subexpression()
-{
- if (!(__flags_ & nosubs))
- {
- __end_->first() =
- new __begin_marked_subexpression<_CharT>(++__marked_count_,
- __end_->first());
- __end_ = static_cast<__owns_one_state<_CharT>*>(__end_->first());
- }
+void basic_regex<_CharT, _Traits>::__push_begin_marked_subexpression() {
+ if (!(__flags_ & nosubs)) {
+ __end_->first() = new __begin_marked_subexpression<_CharT>(++__marked_count_, __end_->first());
+ __end_ = static_cast<__owns_one_state<_CharT>*>(__end_->first());
+ }
}
template <class _CharT, class _Traits>
-void
-basic_regex<_CharT, _Traits>::__push_end_marked_subexpression(unsigned __sub)
-{
- if (!(__flags_ & nosubs))
- {
- __end_->first() =
- new __end_marked_subexpression<_CharT>(__sub, __end_->first());
- __end_ = static_cast<__owns_one_state<_CharT>*>(__end_->first());
- }
+void basic_regex<_CharT, _Traits>::__push_end_marked_subexpression(unsigned __sub) {
+ if (!(__flags_ & nosubs)) {
+ __end_->first() = new __end_marked_subexpression<_CharT>(__sub, __end_->first());
+ __end_ = static_cast<__owns_one_state<_CharT>*>(__end_->first());
+ }
}
template <class _CharT, class _Traits>
-void
-basic_regex<_CharT, _Traits>::__push_l_anchor()
-{
- __end_->first() = new __l_anchor_multiline<_CharT>(__use_multiline(), __end_->first());
- __end_ = static_cast<__owns_one_state<_CharT>*>(__end_->first());
+void basic_regex<_CharT, _Traits>::__push_l_anchor() {
+ __end_->first() = new __l_anchor_multiline<_CharT>(__use_multiline(), __end_->first());
+ __end_ = static_cast<__owns_one_state<_CharT>*>(__end_->first());
}
template <class _CharT, class _Traits>
-void
-basic_regex<_CharT, _Traits>::__push_r_anchor()
-{
- __end_->first() = new __r_anchor_multiline<_CharT>(__use_multiline(), __end_->first());
- __end_ = static_cast<__owns_one_state<_CharT>*>(__end_->first());
+void basic_regex<_CharT, _Traits>::__push_r_anchor() {
+ __end_->first() = new __r_anchor_multiline<_CharT>(__use_multiline(), __end_->first());
+ __end_ = static_cast<__owns_one_state<_CharT>*>(__end_->first());
}
template <class _CharT, class _Traits>
-void
-basic_regex<_CharT, _Traits>::__push_match_any()
-{
- __end_->first() = new __match_any<_CharT>(__end_->first());
- __end_ = static_cast<__owns_one_state<_CharT>*>(__end_->first());
+void basic_regex<_CharT, _Traits>::__push_match_any() {
+ __end_->first() = new __match_any<_CharT>(__end_->first());
+ __end_ = static_cast<__owns_one_state<_CharT>*>(__end_->first());
}
template <class _CharT, class _Traits>
-void
-basic_regex<_CharT, _Traits>::__push_match_any_but_newline()
-{
- __end_->first() = new __match_any_but_newline<_CharT>(__end_->first());
- __end_ = static_cast<__owns_one_state<_CharT>*>(__end_->first());
+void basic_regex<_CharT, _Traits>::__push_match_any_but_newline() {
+ __end_->first() = new __match_any_but_newline<_CharT>(__end_->first());
+ __end_ = static_cast<__owns_one_state<_CharT>*>(__end_->first());
}
template <class _CharT, class _Traits>
-void
-basic_regex<_CharT, _Traits>::__push_empty()
-{
- __end_->first() = new __empty_state<_CharT>(__end_->first());
- __end_ = static_cast<__owns_one_state<_CharT>*>(__end_->first());
+void basic_regex<_CharT, _Traits>::__push_empty() {
+ __end_->first() = new __empty_state<_CharT>(__end_->first());
+ __end_ = static_cast<__owns_one_state<_CharT>*>(__end_->first());
}
template <class _CharT, class _Traits>
-void
-basic_regex<_CharT, _Traits>::__push_word_boundary(bool __invert)
-{
- __end_->first() = new __word_boundary<_CharT, _Traits>(__traits_, __invert,
- __end_->first());
- __end_ = static_cast<__owns_one_state<_CharT>*>(__end_->first());
+void basic_regex<_CharT, _Traits>::__push_word_boundary(bool __invert) {
+ __end_->first() = new __word_boundary<_CharT, _Traits>(__traits_, __invert, __end_->first());
+ __end_ = static_cast<__owns_one_state<_CharT>*>(__end_->first());
}
template <class _CharT, class _Traits>
-void
-basic_regex<_CharT, _Traits>::__push_back_ref(int __i)
-{
- if (flags() & icase)
- __end_->first() = new __back_ref_icase<_CharT, _Traits>
- (__traits_, __i, __end_->first());
- else if (flags() & collate)
- __end_->first() = new __back_ref_collate<_CharT, _Traits>
- (__traits_, __i, __end_->first());
- else
- __end_->first() = new __back_ref<_CharT>(__i, __end_->first());
- __end_ = static_cast<__owns_one_state<_CharT>*>(__end_->first());
+void basic_regex<_CharT, _Traits>::__push_back_ref(int __i) {
+ if (flags() & icase)
+ __end_->first() = new __back_ref_icase<_CharT, _Traits>(__traits_, __i, __end_->first());
+ else if (flags() & collate)
+ __end_->first() = new __back_ref_collate<_CharT, _Traits>(__traits_, __i, __end_->first());
+ else
+ __end_->first() = new __back_ref<_CharT>(__i, __end_->first());
+ __end_ = static_cast<__owns_one_state<_CharT>*>(__end_->first());
}
template <class _CharT, class _Traits>
-void
-basic_regex<_CharT, _Traits>::__push_alternation(__owns_one_state<_CharT>* __sa,
- __owns_one_state<_CharT>* __ea)
-{
- __sa->first() = new __alternate<_CharT>(
- static_cast<__owns_one_state<_CharT>*>(__sa->first()),
- static_cast<__owns_one_state<_CharT>*>(__ea->first()));
- __ea->first() = nullptr;
- __ea->first() = new __empty_state<_CharT>(__end_->first());
- __end_->first() = nullptr;
- __end_->first() = new __empty_non_own_state<_CharT>(__ea->first());
- __end_ = static_cast<__owns_one_state<_CharT>*>(__ea->first());
+void basic_regex<_CharT, _Traits>::__push_alternation(__owns_one_state<_CharT>* __sa, __owns_one_state<_CharT>* __ea) {
+ __sa->first() = new __alternate<_CharT>(
+ static_cast<__owns_one_state<_CharT>*>(__sa->first()), static_cast<__owns_one_state<_CharT>*>(__ea->first()));
+ __ea->first() = nullptr;
+ __ea->first() = new __empty_state<_CharT>(__end_->first());
+ __end_->first() = nullptr;
+ __end_->first() = new __empty_non_own_state<_CharT>(__ea->first());
+ __end_ = static_cast<__owns_one_state<_CharT>*>(__ea->first());
}
template <class _CharT, class _Traits>
-__bracket_expression<_CharT, _Traits>*
-basic_regex<_CharT, _Traits>::__start_matching_list(bool __negate)
-{
- __bracket_expression<_CharT, _Traits>* __r =
- new __bracket_expression<_CharT, _Traits>(__traits_, __end_->first(),
- __negate, __flags_ & icase,
- __flags_ & collate);
- __end_->first() = __r;
- __end_ = __r;
- return __r;
+__bracket_expression<_CharT, _Traits>* basic_regex<_CharT, _Traits>::__start_matching_list(bool __negate) {
+ __bracket_expression<_CharT, _Traits>* __r = new __bracket_expression<_CharT, _Traits>(
+ __traits_, __end_->first(), __negate, __flags_ & icase, __flags_ & collate);
+ __end_->first() = __r;
+ __end_ = __r;
+ return __r;
}
template <class _CharT, class _Traits>
-void
-basic_regex<_CharT, _Traits>::__push_lookahead(const basic_regex& __exp,
- bool __invert,
- unsigned __mexp)
-{
- __end_->first() = new __lookahead<_CharT, _Traits>(__exp, __invert,
- __end_->first(), __mexp);
- __end_ = static_cast<__owns_one_state<_CharT>*>(__end_->first());
+void basic_regex<_CharT, _Traits>::__push_lookahead(const basic_regex& __exp, bool __invert, unsigned __mexp) {
+ __end_->first() = new __lookahead<_CharT, _Traits>(__exp, __invert, __end_->first(), __mexp);
+ __end_ = static_cast<__owns_one_state<_CharT>*>(__end_->first());
}
// sub_match
-typedef sub_match<const char*> csub_match;
-typedef sub_match<string::const_iterator> ssub_match;
+typedef sub_match<const char*> csub_match;
+typedef sub_match<string::const_iterator> ssub_match;
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
-typedef sub_match<const wchar_t*> wcsub_match;
+typedef sub_match<const wchar_t*> wcsub_match;
typedef sub_match<wstring::const_iterator> wssub_match;
#endif
template <class _BidirectionalIterator>
-class
- _LIBCPP_TEMPLATE_VIS
- _LIBCPP_PREFERRED_NAME(csub_match)
- _LIBCPP_IF_WIDE_CHARACTERS(_LIBCPP_PREFERRED_NAME(wcsub_match))
- _LIBCPP_PREFERRED_NAME(ssub_match)
- _LIBCPP_IF_WIDE_CHARACTERS(_LIBCPP_PREFERRED_NAME(wssub_match))
- sub_match
- : public pair<_BidirectionalIterator, _BidirectionalIterator>
-{
+class _LIBCPP_TEMPLATE_VIS _LIBCPP_PREFERRED_NAME(csub_match)
+ _LIBCPP_IF_WIDE_CHARACTERS(_LIBCPP_PREFERRED_NAME(wcsub_match)) _LIBCPP_PREFERRED_NAME(ssub_match)
+ _LIBCPP_IF_WIDE_CHARACTERS(_LIBCPP_PREFERRED_NAME(wssub_match)) sub_match
+ : public pair<_BidirectionalIterator, _BidirectionalIterator> {
public:
- typedef _BidirectionalIterator iterator;
- typedef typename iterator_traits<iterator>::value_type value_type;
- typedef typename iterator_traits<iterator>::difference_type difference_type;
- typedef basic_string<value_type> string_type;
+ typedef _BidirectionalIterator iterator;
+ typedef typename iterator_traits<iterator>::value_type value_type;
+ typedef typename iterator_traits<iterator>::difference_type difference_type;
+ typedef basic_string<value_type> string_type;
- bool matched;
+ bool matched;
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR sub_match() : matched() {}
+
+ _LIBCPP_HIDE_FROM_ABI difference_type length() const {
+ return matched ? std::distance(this->first, this->second) : 0;
+ }
+ _LIBCPP_HIDE_FROM_ABI string_type str() const {
+ return matched ? string_type(this->first, this->second) : string_type();
+ }
+ _LIBCPP_HIDE_FROM_ABI operator string_type() const { return str(); }
- _LIBCPP_HIDE_FROM_ABI
- _LIBCPP_CONSTEXPR sub_match() : matched() {}
-
- _LIBCPP_HIDE_FROM_ABI
- difference_type length() const
- {return matched ? std::distance(this->first, this->second) : 0;}
- _LIBCPP_HIDE_FROM_ABI
- string_type str() const
- {return matched ? string_type(this->first, this->second) : string_type();}
- _LIBCPP_HIDE_FROM_ABI
- operator string_type() const
- {return str();}
-
- _LIBCPP_HIDE_FROM_ABI
- int compare(const sub_match& __s) const
- {return str().compare(__s.str());}
- _LIBCPP_HIDE_FROM_ABI
- int compare(const string_type& __s) const
- {return str().compare(__s);}
- _LIBCPP_HIDE_FROM_ABI
- int compare(const value_type* __s) const
- {return str().compare(__s);}
-
- _LIBCPP_HIDE_FROM_ABI
- void swap(sub_match& __s)
+ _LIBCPP_HIDE_FROM_ABI int compare(const sub_match& __s) const { return str().compare(__s.str()); }
+ _LIBCPP_HIDE_FROM_ABI int compare(const string_type& __s) const { return str().compare(__s); }
+ _LIBCPP_HIDE_FROM_ABI int compare(const value_type* __s) const { return str().compare(__s); }
+
+ _LIBCPP_HIDE_FROM_ABI void swap(sub_match& __s)
#ifndef _LIBCPP_CXX03_LANG
- _NOEXCEPT(__is_nothrow_swappable<_BidirectionalIterator>::value)
+ _NOEXCEPT(__is_nothrow_swappable<_BidirectionalIterator>::value)
#endif // _LIBCPP_CXX03_LANG
- {
- this->pair<_BidirectionalIterator, _BidirectionalIterator>::swap(__s);
- std::swap(matched, __s.matched);
- }
+ {
+ this->pair<_BidirectionalIterator, _BidirectionalIterator>::swap(__s);
+ std::swap(matched, __s.matched);
+ }
};
template <class _BiIter>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator==(const sub_match<_BiIter>& __x, const sub_match<_BiIter>& __y)
-{
- return __x.compare(__y) == 0;
+inline _LIBCPP_HIDE_FROM_ABI bool operator==(const sub_match<_BiIter>& __x, const sub_match<_BiIter>& __y) {
+ return __x.compare(__y) == 0;
}
#if _LIBCPP_STD_VER >= 20
-template<class _BiIter>
+template <class _BiIter>
using __sub_match_cat = compare_three_way_result_t<basic_string<typename iterator_traits<_BiIter>::value_type>>;
template <class _BiIter>
_LIBCPP_HIDE_FROM_ABI auto operator<=>(const sub_match<_BiIter>& __x, const sub_match<_BiIter>& __y) {
- return static_cast<__sub_match_cat<_BiIter>>(__x.compare(__y) <=> 0);
+ return static_cast<__sub_match_cat<_BiIter>>(__x.compare(__y) <=> 0);
}
-#else // _LIBCPP_STD_VER >= 20
+#else // _LIBCPP_STD_VER >= 20
template <class _BiIter>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator!=(const sub_match<_BiIter>& __x, const sub_match<_BiIter>& __y)
-{
- return !(__x == __y);
+inline _LIBCPP_HIDE_FROM_ABI bool operator!=(const sub_match<_BiIter>& __x, const sub_match<_BiIter>& __y) {
+ return !(__x == __y);
}
template <class _BiIter>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator<(const sub_match<_BiIter>& __x, const sub_match<_BiIter>& __y)
-{
- return __x.compare(__y) < 0;
+inline _LIBCPP_HIDE_FROM_ABI bool operator<(const sub_match<_BiIter>& __x, const sub_match<_BiIter>& __y) {
+ return __x.compare(__y) < 0;
}
template <class _BiIter>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator<=(const sub_match<_BiIter>& __x, const sub_match<_BiIter>& __y)
-{
- return !(__y < __x);
+inline _LIBCPP_HIDE_FROM_ABI bool operator<=(const sub_match<_BiIter>& __x, const sub_match<_BiIter>& __y) {
+ return !(__y < __x);
}
template <class _BiIter>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator>=(const sub_match<_BiIter>& __x, const sub_match<_BiIter>& __y)
-{
- return !(__x < __y);
+inline _LIBCPP_HIDE_FROM_ABI bool operator>=(const sub_match<_BiIter>& __x, const sub_match<_BiIter>& __y) {
+ return !(__x < __y);
}
template <class _BiIter>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator>(const sub_match<_BiIter>& __x, const sub_match<_BiIter>& __y)
-{
- return __y < __x;
+inline _LIBCPP_HIDE_FROM_ABI bool operator>(const sub_match<_BiIter>& __x, const sub_match<_BiIter>& __y) {
+ return __y < __x;
}
template <class _BiIter, class _ST, class _SA>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
+inline _LIBCPP_HIDE_FROM_ABI bool
operator==(const basic_string<typename iterator_traits<_BiIter>::value_type, _ST, _SA>& __x,
- const sub_match<_BiIter>& __y)
-{
- return __y.compare(typename sub_match<_BiIter>::string_type(__x.data(), __x.size())) == 0;
+ const sub_match<_BiIter>& __y) {
+ return __y.compare(typename sub_match<_BiIter>::string_type(__x.data(), __x.size())) == 0;
}
template <class _BiIter, class _ST, class _SA>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
+inline _LIBCPP_HIDE_FROM_ABI bool
operator!=(const basic_string<typename iterator_traits<_BiIter>::value_type, _ST, _SA>& __x,
- const sub_match<_BiIter>& __y)
-{
- return !(__x == __y);
+ const sub_match<_BiIter>& __y) {
+ return !(__x == __y);
}
template <class _BiIter, class _ST, class _SA>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
+inline _LIBCPP_HIDE_FROM_ABI bool
operator<(const basic_string<typename iterator_traits<_BiIter>::value_type, _ST, _SA>& __x,
- const sub_match<_BiIter>& __y)
-{
- return __y.compare(typename sub_match<_BiIter>::string_type(__x.data(), __x.size())) > 0;
+ const sub_match<_BiIter>& __y) {
+ return __y.compare(typename sub_match<_BiIter>::string_type(__x.data(), __x.size())) > 0;
}
template <class _BiIter, class _ST, class _SA>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
+inline _LIBCPP_HIDE_FROM_ABI bool
operator>(const basic_string<typename iterator_traits<_BiIter>::value_type, _ST, _SA>& __x,
- const sub_match<_BiIter>& __y)
-{
- return __y < __x;
+ const sub_match<_BiIter>& __y) {
+ return __y < __x;
}
template <class _BiIter, class _ST, class _SA>
-inline _LIBCPP_HIDE_FROM_ABI
-bool operator>=(const basic_string<typename iterator_traits<_BiIter>::value_type, _ST, _SA>& __x,
- const sub_match<_BiIter>& __y)
-{
- return !(__x < __y);
+inline _LIBCPP_HIDE_FROM_ABI bool
+operator>=(const basic_string<typename iterator_traits<_BiIter>::value_type, _ST, _SA>& __x,
+ const sub_match<_BiIter>& __y) {
+ return !(__x < __y);
}
template <class _BiIter, class _ST, class _SA>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
+inline _LIBCPP_HIDE_FROM_ABI bool
operator<=(const basic_string<typename iterator_traits<_BiIter>::value_type, _ST, _SA>& __x,
- const sub_match<_BiIter>& __y)
-{
- return !(__y < __x);
+ const sub_match<_BiIter>& __y) {
+ return !(__y < __x);
}
#endif // _LIBCPP_STD_VER >= 20
template <class _BiIter, class _ST, class _SA>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
+inline _LIBCPP_HIDE_FROM_ABI bool
operator==(const sub_match<_BiIter>& __x,
- const basic_string<typename iterator_traits<_BiIter>::value_type, _ST, _SA>& __y)
-{
- return __x.compare(typename sub_match<_BiIter>::string_type(__y.data(), __y.size())) == 0;
+ const basic_string<typename iterator_traits<_BiIter>::value_type, _ST, _SA>& __y) {
+ return __x.compare(typename sub_match<_BiIter>::string_type(__y.data(), __y.size())) == 0;
}
#if _LIBCPP_STD_VER >= 20
template <class _BiIter, class _ST, class _SA>
-_LIBCPP_HIDE_FROM_ABI auto operator<=>(
- const sub_match<_BiIter>& __x, const basic_string<typename iterator_traits<_BiIter>::value_type, _ST, _SA>& __y) {
- return static_cast<__sub_match_cat<_BiIter>>(
- __x.compare(typename sub_match<_BiIter>::string_type(__y.data(), __y.size())) <=> 0);
+_LIBCPP_HIDE_FROM_ABI auto
+operator<=>(const sub_match<_BiIter>& __x,
+ const basic_string<typename iterator_traits<_BiIter>::value_type, _ST, _SA>& __y) {
+ return static_cast<__sub_match_cat<_BiIter>>(
+ __x.compare(typename sub_match<_BiIter>::string_type(__y.data(), __y.size())) <=> 0);
}
-#else // _LIBCPP_STD_VER >= 20
+#else // _LIBCPP_STD_VER >= 20
template <class _BiIter, class _ST, class _SA>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
+inline _LIBCPP_HIDE_FROM_ABI bool
operator!=(const sub_match<_BiIter>& __x,
- const basic_string<typename iterator_traits<_BiIter>::value_type, _ST, _SA>& __y)
-{
- return !(__x == __y);
+ const basic_string<typename iterator_traits<_BiIter>::value_type, _ST, _SA>& __y) {
+ return !(__x == __y);
}
template <class _BiIter, class _ST, class _SA>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
+inline _LIBCPP_HIDE_FROM_ABI bool
operator<(const sub_match<_BiIter>& __x,
- const basic_string<typename iterator_traits<_BiIter>::value_type, _ST, _SA>& __y)
-{
- return __x.compare(typename sub_match<_BiIter>::string_type(__y.data(), __y.size())) < 0;
+ const basic_string<typename iterator_traits<_BiIter>::value_type, _ST, _SA>& __y) {
+ return __x.compare(typename sub_match<_BiIter>::string_type(__y.data(), __y.size())) < 0;
}
template <class _BiIter, class _ST, class _SA>
-inline _LIBCPP_HIDE_FROM_ABI
-bool operator>(const sub_match<_BiIter>& __x,
- const basic_string<typename iterator_traits<_BiIter>::value_type, _ST, _SA>& __y)
-{
- return __y < __x;
+inline _LIBCPP_HIDE_FROM_ABI bool
+operator>(const sub_match<_BiIter>& __x,
+ const basic_string<typename iterator_traits<_BiIter>::value_type, _ST, _SA>& __y) {
+ return __y < __x;
}
template <class _BiIter, class _ST, class _SA>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
+inline _LIBCPP_HIDE_FROM_ABI bool
operator>=(const sub_match<_BiIter>& __x,
- const basic_string<typename iterator_traits<_BiIter>::value_type, _ST, _SA>& __y)
-{
- return !(__x < __y);
+ const basic_string<typename iterator_traits<_BiIter>::value_type, _ST, _SA>& __y) {
+ return !(__x < __y);
}
template <class _BiIter, class _ST, class _SA>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
+inline _LIBCPP_HIDE_FROM_ABI bool
operator<=(const sub_match<_BiIter>& __x,
- const basic_string<typename iterator_traits<_BiIter>::value_type, _ST, _SA>& __y)
-{
- return !(__y < __x);
+ const basic_string<typename iterator_traits<_BiIter>::value_type, _ST, _SA>& __y) {
+ return !(__y < __x);
}
template <class _BiIter>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator==(typename iterator_traits<_BiIter>::value_type const* __x,
- const sub_match<_BiIter>& __y)
-{
- return __y.compare(__x) == 0;
+inline _LIBCPP_HIDE_FROM_ABI bool
+operator==(typename iterator_traits<_BiIter>::value_type const* __x, const sub_match<_BiIter>& __y) {
+ return __y.compare(__x) == 0;
}
template <class _BiIter>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator!=(typename iterator_traits<_BiIter>::value_type const* __x,
- const sub_match<_BiIter>& __y)
-{
- return !(__x == __y);
+inline _LIBCPP_HIDE_FROM_ABI bool
+operator!=(typename iterator_traits<_BiIter>::value_type const* __x, const sub_match<_BiIter>& __y) {
+ return !(__x == __y);
}
template <class _BiIter>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator<(typename iterator_traits<_BiIter>::value_type const* __x,
- const sub_match<_BiIter>& __y)
-{
- return __y.compare(__x) > 0;
+inline _LIBCPP_HIDE_FROM_ABI bool
+operator<(typename iterator_traits<_BiIter>::value_type const* __x, const sub_match<_BiIter>& __y) {
+ return __y.compare(__x) > 0;
}
template <class _BiIter>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator>(typename iterator_traits<_BiIter>::value_type const* __x,
- const sub_match<_BiIter>& __y)
-{
- return __y < __x;
+inline _LIBCPP_HIDE_FROM_ABI bool
+operator>(typename iterator_traits<_BiIter>::value_type const* __x, const sub_match<_BiIter>& __y) {
+ return __y < __x;
}
template <class _BiIter>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator>=(typename iterator_traits<_BiIter>::value_type const* __x,
- const sub_match<_BiIter>& __y)
-{
- return !(__x < __y);
+inline _LIBCPP_HIDE_FROM_ABI bool
+operator>=(typename iterator_traits<_BiIter>::value_type const* __x, const sub_match<_BiIter>& __y) {
+ return !(__x < __y);
}
template <class _BiIter>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator<=(typename iterator_traits<_BiIter>::value_type const* __x,
- const sub_match<_BiIter>& __y)
-{
- return !(__y < __x);
+inline _LIBCPP_HIDE_FROM_ABI bool
+operator<=(typename iterator_traits<_BiIter>::value_type const* __x, const sub_match<_BiIter>& __y) {
+ return !(__y < __x);
}
#endif // _LIBCPP_STD_VER >= 20
template <class _BiIter>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator==(const sub_match<_BiIter>& __x,
- typename iterator_traits<_BiIter>::value_type const* __y)
-{
- return __x.compare(__y) == 0;
+inline _LIBCPP_HIDE_FROM_ABI bool
+operator==(const sub_match<_BiIter>& __x, typename iterator_traits<_BiIter>::value_type const* __y) {
+ return __x.compare(__y) == 0;
}
#if _LIBCPP_STD_VER >= 20
template <class _BiIter>
_LIBCPP_HIDE_FROM_ABI auto
operator<=>(const sub_match<_BiIter>& __x, typename iterator_traits<_BiIter>::value_type const* __y) {
- return static_cast<__sub_match_cat<_BiIter>>(__x.compare(__y) <=> 0);
+ return static_cast<__sub_match_cat<_BiIter>>(__x.compare(__y) <=> 0);
}
-#else // _LIBCPP_STD_VER >= 20
+#else // _LIBCPP_STD_VER >= 20
template <class _BiIter>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator!=(const sub_match<_BiIter>& __x,
- typename iterator_traits<_BiIter>::value_type const* __y)
-{
- return !(__x == __y);
+inline _LIBCPP_HIDE_FROM_ABI bool
+operator!=(const sub_match<_BiIter>& __x, typename iterator_traits<_BiIter>::value_type const* __y) {
+ return !(__x == __y);
}
template <class _BiIter>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator<(const sub_match<_BiIter>& __x,
- typename iterator_traits<_BiIter>::value_type const* __y)
-{
- return __x.compare(__y) < 0;
+inline _LIBCPP_HIDE_FROM_ABI bool
+operator<(const sub_match<_BiIter>& __x, typename iterator_traits<_BiIter>::value_type const* __y) {
+ return __x.compare(__y) < 0;
}
template <class _BiIter>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator>(const sub_match<_BiIter>& __x,
- typename iterator_traits<_BiIter>::value_type const* __y)
-{
- return __y < __x;
+inline _LIBCPP_HIDE_FROM_ABI bool
+operator>(const sub_match<_BiIter>& __x, typename iterator_traits<_BiIter>::value_type const* __y) {
+ return __y < __x;
}
template <class _BiIter>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator>=(const sub_match<_BiIter>& __x,
- typename iterator_traits<_BiIter>::value_type const* __y)
-{
- return !(__x < __y);
+inline _LIBCPP_HIDE_FROM_ABI bool
+operator>=(const sub_match<_BiIter>& __x, typename iterator_traits<_BiIter>::value_type const* __y) {
+ return !(__x < __y);
}
template <class _BiIter>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator<=(const sub_match<_BiIter>& __x,
- typename iterator_traits<_BiIter>::value_type const* __y)
-{
- return !(__y < __x);
+inline _LIBCPP_HIDE_FROM_ABI bool
+operator<=(const sub_match<_BiIter>& __x, typename iterator_traits<_BiIter>::value_type const* __y) {
+ return !(__y < __x);
}
template <class _BiIter>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator==(typename iterator_traits<_BiIter>::value_type const& __x,
- const sub_match<_BiIter>& __y)
-{
- typedef basic_string<typename iterator_traits<_BiIter>::value_type> string_type;
- return __y.compare(string_type(1, __x)) == 0;
+inline _LIBCPP_HIDE_FROM_ABI bool
+operator==(typename iterator_traits<_BiIter>::value_type const& __x, const sub_match<_BiIter>& __y) {
+ typedef basic_string<typename iterator_traits<_BiIter>::value_type> string_type;
+ return __y.compare(string_type(1, __x)) == 0;
}
template <class _BiIter>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator!=(typename iterator_traits<_BiIter>::value_type const& __x,
- const sub_match<_BiIter>& __y)
-{
- return !(__x == __y);
+inline _LIBCPP_HIDE_FROM_ABI bool
+operator!=(typename iterator_traits<_BiIter>::value_type const& __x, const sub_match<_BiIter>& __y) {
+ return !(__x == __y);
}
template <class _BiIter>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator<(typename iterator_traits<_BiIter>::value_type const& __x,
- const sub_match<_BiIter>& __y)
-{
- typedef basic_string<typename iterator_traits<_BiIter>::value_type> string_type;
- return __y.compare(string_type(1, __x)) > 0;
+inline _LIBCPP_HIDE_FROM_ABI bool
+operator<(typename iterator_traits<_BiIter>::value_type const& __x, const sub_match<_BiIter>& __y) {
+ typedef basic_string<typename iterator_traits<_BiIter>::value_type> string_type;
+ return __y.compare(string_type(1, __x)) > 0;
}
template <class _BiIter>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator>(typename iterator_traits<_BiIter>::value_type const& __x,
- const sub_match<_BiIter>& __y)
-{
- return __y < __x;
+inline _LIBCPP_HIDE_FROM_ABI bool
+operator>(typename iterator_traits<_BiIter>::value_type const& __x, const sub_match<_BiIter>& __y) {
+ return __y < __x;
}
template <class _BiIter>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator>=(typename iterator_traits<_BiIter>::value_type const& __x,
- const sub_match<_BiIter>& __y)
-{
- return !(__x < __y);
+inline _LIBCPP_HIDE_FROM_ABI bool
+operator>=(typename iterator_traits<_BiIter>::value_type const& __x, const sub_match<_BiIter>& __y) {
+ return !(__x < __y);
}
template <class _BiIter>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator<=(typename iterator_traits<_BiIter>::value_type const& __x,
- const sub_match<_BiIter>& __y)
-{
- return !(__y < __x);
+inline _LIBCPP_HIDE_FROM_ABI bool
+operator<=(typename iterator_traits<_BiIter>::value_type const& __x, const sub_match<_BiIter>& __y) {
+ return !(__y < __x);
}
#endif // _LIBCPP_STD_VER >= 20
template <class _BiIter>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator==(const sub_match<_BiIter>& __x,
- typename iterator_traits<_BiIter>::value_type const& __y)
-{
- typedef basic_string<typename iterator_traits<_BiIter>::value_type> string_type;
- return __x.compare(string_type(1, __y)) == 0;
+inline _LIBCPP_HIDE_FROM_ABI bool
+operator==(const sub_match<_BiIter>& __x, typename iterator_traits<_BiIter>::value_type const& __y) {
+ typedef basic_string<typename iterator_traits<_BiIter>::value_type> string_type;
+ return __x.compare(string_type(1, __y)) == 0;
}
#if _LIBCPP_STD_VER >= 20
template <class _BiIter>
_LIBCPP_HIDE_FROM_ABI auto
operator<=>(const sub_match<_BiIter>& __x, typename iterator_traits<_BiIter>::value_type const& __y) {
- using string_type = basic_string<typename iterator_traits<_BiIter>::value_type>;
- return static_cast<__sub_match_cat<_BiIter>>(__x.compare(string_type(1, __y)) <=> 0);
+ using string_type = basic_string<typename iterator_traits<_BiIter>::value_type>;
+ return static_cast<__sub_match_cat<_BiIter>>(__x.compare(string_type(1, __y)) <=> 0);
}
-#else // _LIBCPP_STD_VER >= 20
+#else // _LIBCPP_STD_VER >= 20
template <class _BiIter>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator!=(const sub_match<_BiIter>& __x,
- typename iterator_traits<_BiIter>::value_type const& __y)
-{
- return !(__x == __y);
+inline _LIBCPP_HIDE_FROM_ABI bool
+operator!=(const sub_match<_BiIter>& __x, typename iterator_traits<_BiIter>::value_type const& __y) {
+ return !(__x == __y);
}
template <class _BiIter>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator<(const sub_match<_BiIter>& __x,
- typename iterator_traits<_BiIter>::value_type const& __y)
-{
- typedef basic_string<typename iterator_traits<_BiIter>::value_type> string_type;
- return __x.compare(string_type(1, __y)) < 0;
+inline _LIBCPP_HIDE_FROM_ABI bool
+operator<(const sub_match<_BiIter>& __x, typename iterator_traits<_BiIter>::value_type const& __y) {
+ typedef basic_string<typename iterator_traits<_BiIter>::value_type> string_type;
+ return __x.compare(string_type(1, __y)) < 0;
}
template <class _BiIter>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator>(const sub_match<_BiIter>& __x,
- typename iterator_traits<_BiIter>::value_type const& __y)
-{
- return __y < __x;
+inline _LIBCPP_HIDE_FROM_ABI bool
+operator>(const sub_match<_BiIter>& __x, typename iterator_traits<_BiIter>::value_type const& __y) {
+ return __y < __x;
}
template <class _BiIter>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator>=(const sub_match<_BiIter>& __x,
- typename iterator_traits<_BiIter>::value_type const& __y)
-{
- return !(__x < __y);
+inline _LIBCPP_HIDE_FROM_ABI bool
+operator>=(const sub_match<_BiIter>& __x, typename iterator_traits<_BiIter>::value_type const& __y) {
+ return !(__x < __y);
}
template <class _BiIter>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator<=(const sub_match<_BiIter>& __x,
- typename iterator_traits<_BiIter>::value_type const& __y)
-{
- return !(__y < __x);
+inline _LIBCPP_HIDE_FROM_ABI bool
+operator<=(const sub_match<_BiIter>& __x, typename iterator_traits<_BiIter>::value_type const& __y) {
+ return !(__y < __x);
}
#endif // _LIBCPP_STD_VER >= 20
template <class _CharT, class _ST, class _BiIter>
-inline _LIBCPP_HIDE_FROM_ABI
-basic_ostream<_CharT, _ST>&
-operator<<(basic_ostream<_CharT, _ST>& __os, const sub_match<_BiIter>& __m)
-{
- return __os << __m.str();
+inline _LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _ST>&
+operator<<(basic_ostream<_CharT, _ST>& __os, const sub_match<_BiIter>& __m) {
+ return __os << __m.str();
}
-typedef match_results<const char*> cmatch;
-typedef match_results<string::const_iterator> smatch;
+typedef match_results<const char*> cmatch;
+typedef match_results<string::const_iterator> smatch;
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
-typedef match_results<const wchar_t*> wcmatch;
+typedef match_results<const wchar_t*> wcmatch;
typedef match_results<wstring::const_iterator> wsmatch;
#endif
template <class _BidirectionalIterator, class _Allocator>
-class
- _LIBCPP_TEMPLATE_VIS
- _LIBCPP_PREFERRED_NAME(cmatch)
- _LIBCPP_IF_WIDE_CHARACTERS(_LIBCPP_PREFERRED_NAME(wcmatch))
- _LIBCPP_PREFERRED_NAME(smatch)
- _LIBCPP_IF_WIDE_CHARACTERS(_LIBCPP_PREFERRED_NAME(wsmatch))
- match_results
-{
+class _LIBCPP_TEMPLATE_VIS _LIBCPP_PREFERRED_NAME(cmatch) _LIBCPP_IF_WIDE_CHARACTERS(_LIBCPP_PREFERRED_NAME(wcmatch))
+ _LIBCPP_PREFERRED_NAME(smatch) _LIBCPP_IF_WIDE_CHARACTERS(_LIBCPP_PREFERRED_NAME(wsmatch)) match_results {
public:
- typedef _Allocator allocator_type;
- typedef sub_match<_BidirectionalIterator> value_type;
+ typedef _Allocator allocator_type;
+ typedef sub_match<_BidirectionalIterator> value_type;
+
private:
- typedef vector<value_type, allocator_type> __container_type;
+ typedef vector<value_type, allocator_type> __container_type;
- __container_type __matches_;
- value_type __unmatched_;
- value_type __prefix_;
- value_type __suffix_;
- bool __ready_;
-public:
- _BidirectionalIterator __position_start_;
- typedef const value_type& const_reference;
- typedef value_type& reference;
- typedef typename __container_type::const_iterator const_iterator;
- typedef const_iterator iterator;
- typedef typename iterator_traits<_BidirectionalIterator>::difference_type difference_type;
- typedef typename allocator_traits<allocator_type>::size_type size_type;
- typedef typename iterator_traits<_BidirectionalIterator>::value_type char_type;
- typedef basic_string<char_type> string_type;
+ __container_type __matches_;
+ value_type __unmatched_;
+ value_type __prefix_;
+ value_type __suffix_;
+ bool __ready_;
- // construct/copy/destroy:
+public:
+ _BidirectionalIterator __position_start_;
+ typedef const value_type& const_reference;
+ typedef value_type& reference;
+ typedef typename __container_type::const_iterator const_iterator;
+ typedef const_iterator iterator;
+ typedef typename iterator_traits<_BidirectionalIterator>::difference_type difference_type;
+ typedef typename allocator_traits<allocator_type>::size_type size_type;
+ typedef typename iterator_traits<_BidirectionalIterator>::value_type char_type;
+ typedef basic_string<char_type> string_type;
+
+ // construct/copy/destroy:
#ifndef _LIBCPP_CXX03_LANG
- match_results() : match_results(allocator_type()) {}
- explicit match_results(const allocator_type& __a);
+ match_results() : match_results(allocator_type()) {}
+ explicit match_results(const allocator_type& __a);
#else
- explicit match_results(const allocator_type& __a = allocator_type());
+ explicit match_results(const allocator_type& __a = allocator_type());
#endif
-// match_results(const match_results&) = default;
-// match_results& operator=(const match_results&) = default;
-// match_results(match_results&& __m) = default;
-// match_results& operator=(match_results&& __m) = default;
-// ~match_results() = default;
-
- _LIBCPP_HIDE_FROM_ABI
- bool ready() const {return __ready_;}
-
- // size:
- _LIBCPP_HIDE_FROM_ABI
- size_type size() const _NOEXCEPT {return __matches_.size();}
- _LIBCPP_HIDE_FROM_ABI
- size_type max_size() const _NOEXCEPT {return __matches_.max_size();}
- _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_HIDE_FROM_ABI
- bool empty() const _NOEXCEPT {return size() == 0;}
-
- // element access:
- _LIBCPP_HIDE_FROM_ABI
- difference_type length(size_type __sub = 0) const
- {
- _LIBCPP_ASSERT_UNCATEGORIZED(ready(), "match_results::length() called when not ready");
- return (*this)[__sub].length();
- }
- _LIBCPP_HIDE_FROM_ABI
- difference_type position(size_type __sub = 0) const
- {
- _LIBCPP_ASSERT_UNCATEGORIZED(ready(), "match_results::position() called when not ready");
- return std::distance(__position_start_, (*this)[__sub].first);
- }
- _LIBCPP_HIDE_FROM_ABI
- string_type str(size_type __sub = 0) const
- {
- _LIBCPP_ASSERT_UNCATEGORIZED(ready(), "match_results::str() called when not ready");
- return (*this)[__sub].str();
- }
- _LIBCPP_HIDE_FROM_ABI
- const_reference operator[](size_type __n) const
- {
- _LIBCPP_ASSERT_UNCATEGORIZED(ready(), "match_results::operator[]() called when not ready");
- return __n < __matches_.size() ? __matches_[__n] : __unmatched_;
- }
-
- _LIBCPP_HIDE_FROM_ABI
- const_reference prefix() const
- {
- _LIBCPP_ASSERT_UNCATEGORIZED(ready(), "match_results::prefix() called when not ready");
- return __prefix_;
- }
- _LIBCPP_HIDE_FROM_ABI
- const_reference suffix() const
- {
- _LIBCPP_ASSERT_UNCATEGORIZED(ready(), "match_results::suffix() called when not ready");
- return __suffix_;
- }
-
- _LIBCPP_HIDE_FROM_ABI
- const_iterator begin() const {return empty() ? __matches_.end() : __matches_.begin();}
- _LIBCPP_HIDE_FROM_ABI
- const_iterator end() const {return __matches_.end();}
- _LIBCPP_HIDE_FROM_ABI
- const_iterator cbegin() const {return empty() ? __matches_.end() : __matches_.begin();}
- _LIBCPP_HIDE_FROM_ABI
- const_iterator cend() const {return __matches_.end();}
-
- // format:
- template <class _OutputIter>
- _OutputIter
- format(_OutputIter __output_iter, const char_type* __fmt_first,
- const char_type* __fmt_last,
- regex_constants::match_flag_type __flags = regex_constants::format_default) const;
- template <class _OutputIter, class _ST, class _SA>
- _LIBCPP_HIDE_FROM_ABI
- _OutputIter
- format(_OutputIter __output_iter, const basic_string<char_type, _ST, _SA>& __fmt,
- regex_constants::match_flag_type __flags = regex_constants::format_default) const
- {return format(__output_iter, __fmt.data(), __fmt.data() + __fmt.size(), __flags);}
- template <class _ST, class _SA>
- _LIBCPP_HIDE_FROM_ABI
- basic_string<char_type, _ST, _SA>
- format(const basic_string<char_type, _ST, _SA>& __fmt,
- regex_constants::match_flag_type __flags = regex_constants::format_default) const
- {
- basic_string<char_type, _ST, _SA> __r;
- format(std::back_inserter(__r), __fmt.data(), __fmt.data() + __fmt.size(),
- __flags);
- return __r;
- }
- _LIBCPP_HIDE_FROM_ABI
- string_type
- format(const char_type* __fmt,
- regex_constants::match_flag_type __flags = regex_constants::format_default) const
- {
- string_type __r;
- format(std::back_inserter(__r), __fmt,
- __fmt + char_traits<char_type>::length(__fmt), __flags);
- return __r;
- }
-
- // allocator:
- _LIBCPP_HIDE_FROM_ABI
- allocator_type get_allocator() const {return __matches_.get_allocator();}
-
- // swap:
- void swap(match_results& __m);
-
- template <class _Bp, class _Ap>
- _LIBCPP_HIDE_FROM_ABI
- void __assign(_BidirectionalIterator __f, _BidirectionalIterator __l,
- const match_results<_Bp, _Ap>& __m, bool __no_update_pos)
- {
- _Bp __mf = __m.prefix().first;
- __matches_.resize(__m.size());
- for (size_type __i = 0; __i < __matches_.size(); ++__i)
- {
- __matches_[__i].first = std::next(__f, std::distance(__mf, __m[__i].first));
- __matches_[__i].second = std::next(__f, std::distance(__mf, __m[__i].second));
- __matches_[__i].matched = __m[__i].matched;
- }
- __unmatched_.first = __l;
- __unmatched_.second = __l;
- __unmatched_.matched = false;
- __prefix_.first = std::next(__f, std::distance(__mf, __m.prefix().first));
- __prefix_.second = std::next(__f, std::distance(__mf, __m.prefix().second));
- __prefix_.matched = __m.prefix().matched;
- __suffix_.first = std::next(__f, std::distance(__mf, __m.suffix().first));
- __suffix_.second = std::next(__f, std::distance(__mf, __m.suffix().second));
- __suffix_.matched = __m.suffix().matched;
- if (!__no_update_pos)
- __position_start_ = __prefix_.first;
- __ready_ = __m.ready();
+ // match_results(const match_results&) = default;
+ // match_results& operator=(const match_results&) = default;
+ // match_results(match_results&& __m) = default;
+ // match_results& operator=(match_results&& __m) = default;
+ // ~match_results() = default;
+
+ _LIBCPP_HIDE_FROM_ABI bool ready() const { return __ready_; }
+
+ // size:
+ _LIBCPP_HIDE_FROM_ABI size_type size() const _NOEXCEPT { return __matches_.size(); }
+ _LIBCPP_HIDE_FROM_ABI size_type max_size() const _NOEXCEPT { return __matches_.max_size(); }
+ _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_HIDE_FROM_ABI bool empty() const _NOEXCEPT { return size() == 0; }
+
+ // element access:
+ _LIBCPP_HIDE_FROM_ABI difference_type length(size_type __sub = 0) const {
+ _LIBCPP_ASSERT_UNCATEGORIZED(ready(), "match_results::length() called when not ready");
+ return (*this)[__sub].length();
+ }
+ _LIBCPP_HIDE_FROM_ABI difference_type position(size_type __sub = 0) const {
+ _LIBCPP_ASSERT_UNCATEGORIZED(ready(), "match_results::position() called when not ready");
+ return std::distance(__position_start_, (*this)[__sub].first);
+ }
+ _LIBCPP_HIDE_FROM_ABI string_type str(size_type __sub = 0) const {
+ _LIBCPP_ASSERT_UNCATEGORIZED(ready(), "match_results::str() called when not ready");
+ return (*this)[__sub].str();
+ }
+ _LIBCPP_HIDE_FROM_ABI const_reference operator[](size_type __n) const {
+ _LIBCPP_ASSERT_UNCATEGORIZED(ready(), "match_results::operator[]() called when not ready");
+ return __n < __matches_.size() ? __matches_[__n] : __unmatched_;
+ }
+
+ _LIBCPP_HIDE_FROM_ABI const_reference prefix() const {
+ _LIBCPP_ASSERT_UNCATEGORIZED(ready(), "match_results::prefix() called when not ready");
+ return __prefix_;
+ }
+ _LIBCPP_HIDE_FROM_ABI const_reference suffix() const {
+ _LIBCPP_ASSERT_UNCATEGORIZED(ready(), "match_results::suffix() called when not ready");
+ return __suffix_;
+ }
+
+ _LIBCPP_HIDE_FROM_ABI const_iterator begin() const { return empty() ? __matches_.end() : __matches_.begin(); }
+ _LIBCPP_HIDE_FROM_ABI const_iterator end() const { return __matches_.end(); }
+ _LIBCPP_HIDE_FROM_ABI const_iterator cbegin() const { return empty() ? __matches_.end() : __matches_.begin(); }
+ _LIBCPP_HIDE_FROM_ABI const_iterator cend() const { return __matches_.end(); }
+
+ // format:
+ template <class _OutputIter>
+ _OutputIter format(_OutputIter __output_iter,
+ const char_type* __fmt_first,
+ const char_type* __fmt_last,
+ regex_constants::match_flag_type __flags = regex_constants::format_default) const;
+ template <class _OutputIter, class _ST, class _SA>
+ _LIBCPP_HIDE_FROM_ABI _OutputIter
+ format(_OutputIter __output_iter,
+ const basic_string<char_type, _ST, _SA>& __fmt,
+ regex_constants::match_flag_type __flags = regex_constants::format_default) const {
+ return format(__output_iter, __fmt.data(), __fmt.data() + __fmt.size(), __flags);
+ }
+ template <class _ST, class _SA>
+ _LIBCPP_HIDE_FROM_ABI basic_string<char_type, _ST, _SA>
+ format(const basic_string<char_type, _ST, _SA>& __fmt,
+ regex_constants::match_flag_type __flags = regex_constants::format_default) const {
+ basic_string<char_type, _ST, _SA> __r;
+ format(std::back_inserter(__r), __fmt.data(), __fmt.data() + __fmt.size(), __flags);
+ return __r;
+ }
+ _LIBCPP_HIDE_FROM_ABI string_type
+ format(const char_type* __fmt, regex_constants::match_flag_type __flags = regex_constants::format_default) const {
+ string_type __r;
+ format(std::back_inserter(__r), __fmt, __fmt + char_traits<char_type>::length(__fmt), __flags);
+ return __r;
+ }
+
+ // allocator:
+ _LIBCPP_HIDE_FROM_ABI allocator_type get_allocator() const { return __matches_.get_allocator(); }
+
+ // swap:
+ void swap(match_results& __m);
+
+ template <class _Bp, class _Ap>
+ _LIBCPP_HIDE_FROM_ABI void
+ __assign(_BidirectionalIterator __f,
+ _BidirectionalIterator __l,
+ const match_results<_Bp, _Ap>& __m,
+ bool __no_update_pos) {
+ _Bp __mf = __m.prefix().first;
+ __matches_.resize(__m.size());
+ for (size_type __i = 0; __i < __matches_.size(); ++__i) {
+ __matches_[__i].first = std::next(__f, std::distance(__mf, __m[__i].first));
+ __matches_[__i].second = std::next(__f, std::distance(__mf, __m[__i].second));
+ __matches_[__i].matched = __m[__i].matched;
}
+ __unmatched_.first = __l;
+ __unmatched_.second = __l;
+ __unmatched_.matched = false;
+ __prefix_.first = std::next(__f, std::distance(__mf, __m.prefix().first));
+ __prefix_.second = std::next(__f, std::distance(__mf, __m.prefix().second));
+ __prefix_.matched = __m.prefix().matched;
+ __suffix_.first = std::next(__f, std::distance(__mf, __m.suffix().first));
+ __suffix_.second = std::next(__f, std::distance(__mf, __m.suffix().second));
+ __suffix_.matched = __m.suffix().matched;
+ if (!__no_update_pos)
+ __position_start_ = __prefix_.first;
+ __ready_ = __m.ready();
+ }
private:
- void __init(unsigned __s,
- _BidirectionalIterator __f, _BidirectionalIterator __l,
- bool __no_update_pos = false);
+ void __init(unsigned __s, _BidirectionalIterator __f, _BidirectionalIterator __l, bool __no_update_pos = false);
- template <class, class> friend class basic_regex;
+ template <class, class>
+ friend class basic_regex;
- template <class _Bp, class _Ap, class _Cp, class _Tp>
- friend
- bool
- regex_match(_Bp, _Bp, match_results<_Bp, _Ap>&, const basic_regex<_Cp, _Tp>&,
- regex_constants::match_flag_type);
+ template <class _Bp, class _Ap, class _Cp, class _Tp>
+ friend bool
+ regex_match(_Bp, _Bp, match_results<_Bp, _Ap>&, const basic_regex<_Cp, _Tp>&, regex_constants::match_flag_type);
- template <class _Bp, class _Ap>
- friend
- bool
- operator==(const match_results<_Bp, _Ap>&, const match_results<_Bp, _Ap>&);
+ template <class _Bp, class _Ap>
+ friend bool operator==(const match_results<_Bp, _Ap>&, const match_results<_Bp, _Ap>&);
- template <class, class> friend class __lookahead;
+ template <class, class>
+ friend class __lookahead;
};
template <class _BidirectionalIterator, class _Allocator>
-match_results<_BidirectionalIterator, _Allocator>::match_results(
- const allocator_type& __a)
- : __matches_(__a),
- __unmatched_(),
- __prefix_(),
- __suffix_(),
- __ready_(false),
- __position_start_()
-{
-}
+match_results<_BidirectionalIterator, _Allocator>::match_results(const allocator_type& __a)
+ : __matches_(__a), __unmatched_(), __prefix_(), __suffix_(), __ready_(false), __position_start_() {}
template <class _BidirectionalIterator, class _Allocator>
-void
-match_results<_BidirectionalIterator, _Allocator>::__init(unsigned __s,
- _BidirectionalIterator __f, _BidirectionalIterator __l,
- bool __no_update_pos)
-{
- __unmatched_.first = __l;
- __unmatched_.second = __l;
- __unmatched_.matched = false;
- __matches_.assign(__s, __unmatched_);
- __prefix_.first = __f;
- __prefix_.second = __f;
- __prefix_.matched = false;
- __suffix_ = __unmatched_;
- if (!__no_update_pos)
- __position_start_ = __prefix_.first;
- __ready_ = true;
+void match_results<_BidirectionalIterator, _Allocator>::__init(
+ unsigned __s, _BidirectionalIterator __f, _BidirectionalIterator __l, bool __no_update_pos) {
+ __unmatched_.first = __l;
+ __unmatched_.second = __l;
+ __unmatched_.matched = false;
+ __matches_.assign(__s, __unmatched_);
+ __prefix_.first = __f;
+ __prefix_.second = __f;
+ __prefix_.matched = false;
+ __suffix_ = __unmatched_;
+ if (!__no_update_pos)
+ __position_start_ = __prefix_.first;
+ __ready_ = true;
}
template <class _BidirectionalIterator, class _Allocator>
template <class _OutputIter>
-_OutputIter
-match_results<_BidirectionalIterator, _Allocator>::format(_OutputIter __output_iter,
- const char_type* __fmt_first, const char_type* __fmt_last,
- regex_constants::match_flag_type __flags) const
-{
- _LIBCPP_ASSERT_UNCATEGORIZED(ready(), "match_results::format() called when not ready");
- if (__flags & regex_constants::format_sed)
- {
- for (; __fmt_first != __fmt_last; ++__fmt_first)
- {
- if (*__fmt_first == '&')
- __output_iter = std::copy(__matches_[0].first, __matches_[0].second,
- __output_iter);
- else if (*__fmt_first == '\\' && __fmt_first + 1 != __fmt_last)
- {
- ++__fmt_first;
- if ('0' <= *__fmt_first && *__fmt_first <= '9')
- {
- size_t __i = *__fmt_first - '0';
- __output_iter = std::copy((*this)[__i].first,
- (*this)[__i].second, __output_iter);
- }
- else
- {
- *__output_iter = *__fmt_first;
- ++__output_iter;
- }
- }
- else
- {
- *__output_iter = *__fmt_first;
- ++__output_iter;
- }
+_OutputIter match_results<_BidirectionalIterator, _Allocator>::format(
+ _OutputIter __output_iter,
+ const char_type* __fmt_first,
+ const char_type* __fmt_last,
+ regex_constants::match_flag_type __flags) const {
+ _LIBCPP_ASSERT_UNCATEGORIZED(ready(), "match_results::format() called when not ready");
+ if (__flags & regex_constants::format_sed) {
+ for (; __fmt_first != __fmt_last; ++__fmt_first) {
+ if (*__fmt_first == '&')
+ __output_iter = std::copy(__matches_[0].first, __matches_[0].second, __output_iter);
+ else if (*__fmt_first == '\\' && __fmt_first + 1 != __fmt_last) {
+ ++__fmt_first;
+ if ('0' <= *__fmt_first && *__fmt_first <= '9') {
+ size_t __i = *__fmt_first - '0';
+ __output_iter = std::copy((*this)[__i].first, (*this)[__i].second, __output_iter);
+ } else {
+ *__output_iter = *__fmt_first;
+ ++__output_iter;
}
+ } else {
+ *__output_iter = *__fmt_first;
+ ++__output_iter;
+ }
}
- else
- {
- for (; __fmt_first != __fmt_last; ++__fmt_first)
- {
- if (*__fmt_first == '$' && __fmt_first + 1 != __fmt_last)
- {
- switch (__fmt_first[1])
- {
- case '$':
- *__output_iter = *++__fmt_first;
- ++__output_iter;
- break;
- case '&':
- ++__fmt_first;
- __output_iter = std::copy(__matches_[0].first, __matches_[0].second,
- __output_iter);
- break;
- case '`':
- ++__fmt_first;
- __output_iter = std::copy(__prefix_.first, __prefix_.second, __output_iter);
- break;
- case '\'':
- ++__fmt_first;
- __output_iter = std::copy(__suffix_.first, __suffix_.second, __output_iter);
- break;
- default:
- if ('0' <= __fmt_first[1] && __fmt_first[1] <= '9')
- {
- ++__fmt_first;
- size_t __idx = *__fmt_first - '0';
- if (__fmt_first + 1 != __fmt_last &&
- '0' <= __fmt_first[1] && __fmt_first[1] <= '9')
- {
- ++__fmt_first;
- if (__idx >= numeric_limits<size_t>::max() / 10)
- __throw_regex_error<regex_constants::error_escape>();
- __idx = 10 * __idx + *__fmt_first - '0';
- }
- __output_iter = std::copy((*this)[__idx].first,
- (*this)[__idx].second, __output_iter);
- }
- else
- {
- *__output_iter = *__fmt_first;
- ++__output_iter;
- }
- break;
- }
- }
- else
- {
- *__output_iter = *__fmt_first;
- ++__output_iter;
+ } else {
+ for (; __fmt_first != __fmt_last; ++__fmt_first) {
+ if (*__fmt_first == '$' && __fmt_first + 1 != __fmt_last) {
+ switch (__fmt_first[1]) {
+ case '$':
+ *__output_iter = *++__fmt_first;
+ ++__output_iter;
+ break;
+ case '&':
+ ++__fmt_first;
+ __output_iter = std::copy(__matches_[0].first, __matches_[0].second, __output_iter);
+ break;
+ case '`':
+ ++__fmt_first;
+ __output_iter = std::copy(__prefix_.first, __prefix_.second, __output_iter);
+ break;
+ case '\'':
+ ++__fmt_first;
+ __output_iter = std::copy(__suffix_.first, __suffix_.second, __output_iter);
+ break;
+ default:
+ if ('0' <= __fmt_first[1] && __fmt_first[1] <= '9') {
+ ++__fmt_first;
+ size_t __idx = *__fmt_first - '0';
+ if (__fmt_first + 1 != __fmt_last && '0' <= __fmt_first[1] && __fmt_first[1] <= '9') {
+ ++__fmt_first;
+ if (__idx >= numeric_limits<size_t>::max() / 10)
+ __throw_regex_error<regex_constants::error_escape>();
+ __idx = 10 * __idx + *__fmt_first - '0';
}
+ __output_iter = std::copy((*this)[__idx].first, (*this)[__idx].second, __output_iter);
+ } else {
+ *__output_iter = *__fmt_first;
+ ++__output_iter;
+ }
+ break;
}
+ } else {
+ *__output_iter = *__fmt_first;
+ ++__output_iter;
+ }
}
- return __output_iter;
+ }
+ return __output_iter;
}
template <class _BidirectionalIterator, class _Allocator>
-void
-match_results<_BidirectionalIterator, _Allocator>::swap(match_results& __m)
-{
- using std::swap;
- swap(__matches_, __m.__matches_);
- swap(__unmatched_, __m.__unmatched_);
- swap(__prefix_, __m.__prefix_);
- swap(__suffix_, __m.__suffix_);
- swap(__position_start_, __m.__position_start_);
- swap(__ready_, __m.__ready_);
+void match_results<_BidirectionalIterator, _Allocator>::swap(match_results& __m) {
+ using std::swap;
+ swap(__matches_, __m.__matches_);
+ swap(__unmatched_, __m.__unmatched_);
+ swap(__prefix_, __m.__prefix_);
+ swap(__suffix_, __m.__suffix_);
+ swap(__position_start_, __m.__position_start_);
+ swap(__ready_, __m.__ready_);
}
template <class _BidirectionalIterator, class _Allocator>
-_LIBCPP_HIDE_FROM_ABI bool
-operator==(const match_results<_BidirectionalIterator, _Allocator>& __x,
- const match_results<_BidirectionalIterator, _Allocator>& __y)
-{
- if (__x.__ready_ != __y.__ready_)
- return false;
- if (!__x.__ready_)
- return true;
- return __x.__matches_ == __y.__matches_ &&
- __x.__prefix_ == __y.__prefix_ &&
- __x.__suffix_ == __y.__suffix_;
+_LIBCPP_HIDE_FROM_ABI bool operator==(const match_results<_BidirectionalIterator, _Allocator>& __x,
+ const match_results<_BidirectionalIterator, _Allocator>& __y) {
+ if (__x.__ready_ != __y.__ready_)
+ return false;
+ if (!__x.__ready_)
+ return true;
+ return __x.__matches_ == __y.__matches_ && __x.__prefix_ == __y.__prefix_ && __x.__suffix_ == __y.__suffix_;
}
#if _LIBCPP_STD_VER < 20
template <class _BidirectionalIterator, class _Allocator>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator!=(const match_results<_BidirectionalIterator, _Allocator>& __x,
- const match_results<_BidirectionalIterator, _Allocator>& __y)
-{
- return !(__x == __y);
+inline _LIBCPP_HIDE_FROM_ABI bool operator!=(const match_results<_BidirectionalIterator, _Allocator>& __x,
+ const match_results<_BidirectionalIterator, _Allocator>& __y) {
+ return !(__x == __y);
}
#endif
template <class _BidirectionalIterator, class _Allocator>
-inline _LIBCPP_HIDE_FROM_ABI
-void
-swap(match_results<_BidirectionalIterator, _Allocator>& __x,
- match_results<_BidirectionalIterator, _Allocator>& __y)
-{
- __x.swap(__y);
+inline _LIBCPP_HIDE_FROM_ABI void
+swap(match_results<_BidirectionalIterator, _Allocator>& __x, match_results<_BidirectionalIterator, _Allocator>& __y) {
+ __x.swap(__y);
}
// regex_search
template <class _CharT, class _Traits>
template <class _Allocator>
-bool
-basic_regex<_CharT, _Traits>::__match_at_start_ecma(
- const _CharT* __first, const _CharT* __last,
- match_results<const _CharT*, _Allocator>& __m,
- regex_constants::match_flag_type __flags, bool __at_first) const
-{
- vector<__state> __states;
- __node* __st = __start_.get();
- if (__st)
- {
- sub_match<const _CharT*> __unmatched;
- __unmatched.first = __last;
- __unmatched.second = __last;
- __unmatched.matched = false;
-
- __states.push_back(__state());
- __states.back().__do_ = 0;
- __states.back().__first_ = __first;
- __states.back().__current_ = __first;
- __states.back().__last_ = __last;
- __states.back().__sub_matches_.resize(mark_count(), __unmatched);
- __states.back().__loop_data_.resize(__loop_count());
- __states.back().__node_ = __st;
- __states.back().__flags_ = __flags;
- __states.back().__at_first_ = __at_first;
- int __counter = 0;
- int __length = __last - __first;
- do
- {
- ++__counter;
- if (__counter % _LIBCPP_REGEX_COMPLEXITY_FACTOR == 0 &&
- __counter / _LIBCPP_REGEX_COMPLEXITY_FACTOR >= __length)
- __throw_regex_error<regex_constants::error_complexity>();
- __state& __s = __states.back();
- if (__s.__node_)
- __s.__node_->__exec(__s);
- switch (__s.__do_)
- {
- case __state::__end_state:
- if ((__flags & regex_constants::match_not_null) &&
- __s.__current_ == __first)
- {
- __states.pop_back();
- break;
- }
- if ((__flags & regex_constants::__full_match) &&
- __s.__current_ != __last)
- {
- __states.pop_back();
- break;
- }
- __m.__matches_[0].first = __first;
- __m.__matches_[0].second = std::next(__first, __s.__current_ - __first);
- __m.__matches_[0].matched = true;
- for (unsigned __i = 0; __i < __s.__sub_matches_.size(); ++__i)
- __m.__matches_[__i+1] = __s.__sub_matches_[__i];
- return true;
- case __state::__accept_and_consume:
- case __state::__repeat:
- case __state::__accept_but_not_consume:
- break;
- case __state::__split:
- {
- __state __snext = __s;
- __s.__node_->__exec_split(true, __s);
- __snext.__node_->__exec_split(false, __snext);
- __states.push_back(std::move(__snext));
- }
- break;
- case __state::__reject:
- __states.pop_back();
- break;
- default:
- __throw_regex_error<regex_constants::__re_err_unknown>();
- break;
-
- }
- } while (!__states.empty());
- }
- return false;
+bool basic_regex<_CharT, _Traits>::__match_at_start_ecma(
+ const _CharT* __first,
+ const _CharT* __last,
+ match_results<const _CharT*, _Allocator>& __m,
+ regex_constants::match_flag_type __flags,
+ bool __at_first) const {
+ vector<__state> __states;
+ __node* __st = __start_.get();
+ if (__st) {
+ sub_match<const _CharT*> __unmatched;
+ __unmatched.first = __last;
+ __unmatched.second = __last;
+ __unmatched.matched = false;
+
+ __states.push_back(__state());
+ __states.back().__do_ = 0;
+ __states.back().__first_ = __first;
+ __states.back().__current_ = __first;
+ __states.back().__last_ = __last;
+ __states.back().__sub_matches_.resize(mark_count(), __unmatched);
+ __states.back().__loop_data_.resize(__loop_count());
+ __states.back().__node_ = __st;
+ __states.back().__flags_ = __flags;
+ __states.back().__at_first_ = __at_first;
+ int __counter = 0;
+ int __length = __last - __first;
+ do {
+ ++__counter;
+ if (__counter % _LIBCPP_REGEX_COMPLEXITY_FACTOR == 0 && __counter / _LIBCPP_REGEX_COMPLEXITY_FACTOR >= __length)
+ __throw_regex_error<regex_constants::error_complexity>();
+ __state& __s = __states.back();
+ if (__s.__node_)
+ __s.__node_->__exec(__s);
+ switch (__s.__do_) {
+ case __state::__end_state:
+ if ((__flags & regex_constants::match_not_null) && __s.__current_ == __first) {
+ __states.pop_back();
+ break;
+ }
+ if ((__flags & regex_constants::__full_match) && __s.__current_ != __last) {
+ __states.pop_back();
+ break;
+ }
+ __m.__matches_[0].first = __first;
+ __m.__matches_[0].second = std::next(__first, __s.__current_ - __first);
+ __m.__matches_[0].matched = true;
+ for (unsigned __i = 0; __i < __s.__sub_matches_.size(); ++__i)
+ __m.__matches_[__i + 1] = __s.__sub_matches_[__i];
+ return true;
+ case __state::__accept_and_consume:
+ case __state::__repeat:
+ case __state::__accept_but_not_consume:
+ break;
+ case __state::__split: {
+ __state __snext = __s;
+ __s.__node_->__exec_split(true, __s);
+ __snext.__node_->__exec_split(false, __snext);
+ __states.push_back(std::move(__snext));
+ } break;
+ case __state::__reject:
+ __states.pop_back();
+ break;
+ default:
+ __throw_regex_error<regex_constants::__re_err_unknown>();
+ break;
+ }
+ } while (!__states.empty());
+ }
+ return false;
}
template <class _CharT, class _Traits>
template <class _Allocator>
-bool
-basic_regex<_CharT, _Traits>::__match_at_start_posix_nosubs(
- const _CharT* __first, const _CharT* __last,
- match_results<const _CharT*, _Allocator>& __m,
- regex_constants::match_flag_type __flags, bool __at_first) const
-{
- deque<__state> __states;
- ptrdiff_t __highest_j = 0;
- ptrdiff_t __np = std::distance(__first, __last);
- __node* __st = __start_.get();
- if (__st)
- {
- __states.push_back(__state());
- __states.back().__do_ = 0;
- __states.back().__first_ = __first;
- __states.back().__current_ = __first;
- __states.back().__last_ = __last;
- __states.back().__loop_data_.resize(__loop_count());
- __states.back().__node_ = __st;
- __states.back().__flags_ = __flags;
- __states.back().__at_first_ = __at_first;
- bool __matched = false;
- int __counter = 0;
- int __length = __last - __first;
- do
- {
- ++__counter;
- if (__counter % _LIBCPP_REGEX_COMPLEXITY_FACTOR == 0 &&
- __counter / _LIBCPP_REGEX_COMPLEXITY_FACTOR >= __length)
- __throw_regex_error<regex_constants::error_complexity>();
- __state& __s = __states.back();
- if (__s.__node_)
- __s.__node_->__exec(__s);
- switch (__s.__do_)
- {
- case __state::__end_state:
- if ((__flags & regex_constants::match_not_null) &&
- __s.__current_ == __first)
- {
- __states.pop_back();
- break;
- }
- if ((__flags & regex_constants::__full_match) &&
- __s.__current_ != __last)
- {
- __states.pop_back();
- break;
- }
- if (!__matched || __highest_j < __s.__current_ - __s.__first_)
- __highest_j = __s.__current_ - __s.__first_;
- __matched = true;
- if (__highest_j == __np)
- __states.clear();
- else
- __states.pop_back();
- break;
- case __state::__consume_input:
- break;
- case __state::__accept_and_consume:
- __states.push_front(std::move(__s));
- __states.pop_back();
- break;
- case __state::__repeat:
- case __state::__accept_but_not_consume:
- break;
- case __state::__split:
- {
- __state __snext = __s;
- __s.__node_->__exec_split(true, __s);
- __snext.__node_->__exec_split(false, __snext);
- __states.push_back(std::move(__snext));
- }
- break;
- case __state::__reject:
- __states.pop_back();
- break;
- default:
- __throw_regex_error<regex_constants::__re_err_unknown>();
- break;
- }
- } while (!__states.empty());
- if (__matched)
- {
- __m.__matches_[0].first = __first;
- __m.__matches_[0].second = std::next(__first, __highest_j);
- __m.__matches_[0].matched = true;
- return true;
+bool basic_regex<_CharT, _Traits>::__match_at_start_posix_nosubs(
+ const _CharT* __first,
+ const _CharT* __last,
+ match_results<const _CharT*, _Allocator>& __m,
+ regex_constants::match_flag_type __flags,
+ bool __at_first) const {
+ deque<__state> __states;
+ ptrdiff_t __highest_j = 0;
+ ptrdiff_t __np = std::distance(__first, __last);
+ __node* __st = __start_.get();
+ if (__st) {
+ __states.push_back(__state());
+ __states.back().__do_ = 0;
+ __states.back().__first_ = __first;
+ __states.back().__current_ = __first;
+ __states.back().__last_ = __last;
+ __states.back().__loop_data_.resize(__loop_count());
+ __states.back().__node_ = __st;
+ __states.back().__flags_ = __flags;
+ __states.back().__at_first_ = __at_first;
+ bool __matched = false;
+ int __counter = 0;
+ int __length = __last - __first;
+ do {
+ ++__counter;
+ if (__counter % _LIBCPP_REGEX_COMPLEXITY_FACTOR == 0 && __counter / _LIBCPP_REGEX_COMPLEXITY_FACTOR >= __length)
+ __throw_regex_error<regex_constants::error_complexity>();
+ __state& __s = __states.back();
+ if (__s.__node_)
+ __s.__node_->__exec(__s);
+ switch (__s.__do_) {
+ case __state::__end_state:
+ if ((__flags & regex_constants::match_not_null) && __s.__current_ == __first) {
+ __states.pop_back();
+ break;
+ }
+ if ((__flags & regex_constants::__full_match) && __s.__current_ != __last) {
+ __states.pop_back();
+ break;
}
+ if (!__matched || __highest_j < __s.__current_ - __s.__first_)
+ __highest_j = __s.__current_ - __s.__first_;
+ __matched = true;
+ if (__highest_j == __np)
+ __states.clear();
+ else
+ __states.pop_back();
+ break;
+ case __state::__consume_input:
+ break;
+ case __state::__accept_and_consume:
+ __states.push_front(std::move(__s));
+ __states.pop_back();
+ break;
+ case __state::__repeat:
+ case __state::__accept_but_not_consume:
+ break;
+ case __state::__split: {
+ __state __snext = __s;
+ __s.__node_->__exec_split(true, __s);
+ __snext.__node_->__exec_split(false, __snext);
+ __states.push_back(std::move(__snext));
+ } break;
+ case __state::__reject:
+ __states.pop_back();
+ break;
+ default:
+ __throw_regex_error<regex_constants::__re_err_unknown>();
+ break;
+ }
+ } while (!__states.empty());
+ if (__matched) {
+ __m.__matches_[0].first = __first;
+ __m.__matches_[0].second = std::next(__first, __highest_j);
+ __m.__matches_[0].matched = true;
+ return true;
}
- return false;
+ }
+ return false;
}
template <class _CharT, class _Traits>
template <class _Allocator>
-bool
-basic_regex<_CharT, _Traits>::__match_at_start_posix_subs(
- const _CharT* __first, const _CharT* __last,
- match_results<const _CharT*, _Allocator>& __m,
- regex_constants::match_flag_type __flags, bool __at_first) const
-{
- vector<__state> __states;
- __state __best_state;
- ptrdiff_t __highest_j = 0;
- ptrdiff_t __np = std::distance(__first, __last);
- __node* __st = __start_.get();
- if (__st)
- {
- sub_match<const _CharT*> __unmatched;
- __unmatched.first = __last;
- __unmatched.second = __last;
- __unmatched.matched = false;
-
- __states.push_back(__state());
- __states.back().__do_ = 0;
- __states.back().__first_ = __first;
- __states.back().__current_ = __first;
- __states.back().__last_ = __last;
- __states.back().__sub_matches_.resize(mark_count(), __unmatched);
- __states.back().__loop_data_.resize(__loop_count());
- __states.back().__node_ = __st;
- __states.back().__flags_ = __flags;
- __states.back().__at_first_ = __at_first;
- bool __matched = false;
- int __counter = 0;
- int __length = __last - __first;
- do
- {
- ++__counter;
- if (__counter % _LIBCPP_REGEX_COMPLEXITY_FACTOR == 0 &&
- __counter / _LIBCPP_REGEX_COMPLEXITY_FACTOR >= __length)
- __throw_regex_error<regex_constants::error_complexity>();
- __state& __s = __states.back();
- if (__s.__node_)
- __s.__node_->__exec(__s);
- switch (__s.__do_)
- {
- case __state::__end_state:
- if ((__flags & regex_constants::match_not_null) &&
- __s.__current_ == __first)
- {
- __states.pop_back();
- break;
- }
- if ((__flags & regex_constants::__full_match) &&
- __s.__current_ != __last)
- {
- __states.pop_back();
- break;
- }
- if (!__matched || __highest_j < __s.__current_ - __s.__first_)
- {
- __highest_j = __s.__current_ - __s.__first_;
- __best_state = __s;
- }
- __matched = true;
- if (__highest_j == __np)
- __states.clear();
- else
- __states.pop_back();
- break;
- case __state::__accept_and_consume:
- case __state::__repeat:
- case __state::__accept_but_not_consume:
- break;
- case __state::__split:
- {
- __state __snext = __s;
- __s.__node_->__exec_split(true, __s);
- __snext.__node_->__exec_split(false, __snext);
- __states.push_back(std::move(__snext));
- }
- break;
- case __state::__reject:
- __states.pop_back();
- break;
- default:
- __throw_regex_error<regex_constants::__re_err_unknown>();
- break;
- }
- } while (!__states.empty());
- if (__matched)
- {
- __m.__matches_[0].first = __first;
- __m.__matches_[0].second = std::next(__first, __highest_j);
- __m.__matches_[0].matched = true;
- for (unsigned __i = 0; __i < __best_state.__sub_matches_.size(); ++__i)
- __m.__matches_[__i+1] = __best_state.__sub_matches_[__i];
- return true;
+bool basic_regex<_CharT, _Traits>::__match_at_start_posix_subs(
+ const _CharT* __first,
+ const _CharT* __last,
+ match_results<const _CharT*, _Allocator>& __m,
+ regex_constants::match_flag_type __flags,
+ bool __at_first) const {
+ vector<__state> __states;
+ __state __best_state;
+ ptrdiff_t __highest_j = 0;
+ ptrdiff_t __np = std::distance(__first, __last);
+ __node* __st = __start_.get();
+ if (__st) {
+ sub_match<const _CharT*> __unmatched;
+ __unmatched.first = __last;
+ __unmatched.second = __last;
+ __unmatched.matched = false;
+
+ __states.push_back(__state());
+ __states.back().__do_ = 0;
+ __states.back().__first_ = __first;
+ __states.back().__current_ = __first;
+ __states.back().__last_ = __last;
+ __states.back().__sub_matches_.resize(mark_count(), __unmatched);
+ __states.back().__loop_data_.resize(__loop_count());
+ __states.back().__node_ = __st;
+ __states.back().__flags_ = __flags;
+ __states.back().__at_first_ = __at_first;
+ bool __matched = false;
+ int __counter = 0;
+ int __length = __last - __first;
+ do {
+ ++__counter;
+ if (__counter % _LIBCPP_REGEX_COMPLEXITY_FACTOR == 0 && __counter / _LIBCPP_REGEX_COMPLEXITY_FACTOR >= __length)
+ __throw_regex_error<regex_constants::error_complexity>();
+ __state& __s = __states.back();
+ if (__s.__node_)
+ __s.__node_->__exec(__s);
+ switch (__s.__do_) {
+ case __state::__end_state:
+ if ((__flags & regex_constants::match_not_null) && __s.__current_ == __first) {
+ __states.pop_back();
+ break;
+ }
+ if ((__flags & regex_constants::__full_match) && __s.__current_ != __last) {
+ __states.pop_back();
+ break;
}
+ if (!__matched || __highest_j < __s.__current_ - __s.__first_) {
+ __highest_j = __s.__current_ - __s.__first_;
+ __best_state = __s;
+ }
+ __matched = true;
+ if (__highest_j == __np)
+ __states.clear();
+ else
+ __states.pop_back();
+ break;
+ case __state::__accept_and_consume:
+ case __state::__repeat:
+ case __state::__accept_but_not_consume:
+ break;
+ case __state::__split: {
+ __state __snext = __s;
+ __s.__node_->__exec_split(true, __s);
+ __snext.__node_->__exec_split(false, __snext);
+ __states.push_back(std::move(__snext));
+ } break;
+ case __state::__reject:
+ __states.pop_back();
+ break;
+ default:
+ __throw_regex_error<regex_constants::__re_err_unknown>();
+ break;
+ }
+ } while (!__states.empty());
+ if (__matched) {
+ __m.__matches_[0].first = __first;
+ __m.__matches_[0].second = std::next(__first, __highest_j);
+ __m.__matches_[0].matched = true;
+ for (unsigned __i = 0; __i < __best_state.__sub_matches_.size(); ++__i)
+ __m.__matches_[__i + 1] = __best_state.__sub_matches_[__i];
+ return true;
}
- return false;
+ }
+ return false;
}
template <class _CharT, class _Traits>
template <class _Allocator>
-bool
-basic_regex<_CharT, _Traits>::__match_at_start(
- const _CharT* __first, const _CharT* __last,
- match_results<const _CharT*, _Allocator>& __m,
- regex_constants::match_flag_type __flags, bool __at_first) const
-{
- if (__get_grammar(__flags_) == ECMAScript)
- return __match_at_start_ecma(__first, __last, __m, __flags, __at_first);
- if (mark_count() == 0)
- return __match_at_start_posix_nosubs(__first, __last, __m, __flags, __at_first);
- return __match_at_start_posix_subs(__first, __last, __m, __flags, __at_first);
+bool basic_regex<_CharT, _Traits>::__match_at_start(
+ const _CharT* __first,
+ const _CharT* __last,
+ match_results<const _CharT*, _Allocator>& __m,
+ regex_constants::match_flag_type __flags,
+ bool __at_first) const {
+ if (__get_grammar(__flags_) == ECMAScript)
+ return __match_at_start_ecma(__first, __last, __m, __flags, __at_first);
+ if (mark_count() == 0)
+ return __match_at_start_posix_nosubs(__first, __last, __m, __flags, __at_first);
+ return __match_at_start_posix_subs(__first, __last, __m, __flags, __at_first);
}
template <class _CharT, class _Traits>
template <class _Allocator>
-bool
-basic_regex<_CharT, _Traits>::__search(
- const _CharT* __first, const _CharT* __last,
- match_results<const _CharT*, _Allocator>& __m,
- regex_constants::match_flag_type __flags) const
-{
- if (__flags & regex_constants::match_prev_avail)
- __flags &= ~(regex_constants::match_not_bol | regex_constants::match_not_bow);
-
- __m.__init(1 + mark_count(), __first, __last,
- __flags & regex_constants::__no_update_pos);
- if (__match_at_start(__first, __last, __m, __flags,
- !(__flags & regex_constants::__no_update_pos)))
- {
- __m.__prefix_.second = __m[0].first;
+bool basic_regex<_CharT, _Traits>::__search(
+ const _CharT* __first,
+ const _CharT* __last,
+ match_results<const _CharT*, _Allocator>& __m,
+ regex_constants::match_flag_type __flags) const {
+ if (__flags & regex_constants::match_prev_avail)
+ __flags &= ~(regex_constants::match_not_bol | regex_constants::match_not_bow);
+
+ __m.__init(1 + mark_count(), __first, __last, __flags & regex_constants::__no_update_pos);
+ if (__match_at_start(__first, __last, __m, __flags, !(__flags & regex_constants::__no_update_pos))) {
+ __m.__prefix_.second = __m[0].first;
+ __m.__prefix_.matched = __m.__prefix_.first != __m.__prefix_.second;
+ __m.__suffix_.first = __m[0].second;
+ __m.__suffix_.matched = __m.__suffix_.first != __m.__suffix_.second;
+ return true;
+ }
+ if (__first != __last && !(__flags & regex_constants::match_continuous)) {
+ __flags |= regex_constants::match_prev_avail;
+ for (++__first; __first != __last; ++__first) {
+ __m.__matches_.assign(__m.size(), __m.__unmatched_);
+ if (__match_at_start(__first, __last, __m, __flags, false)) {
+ __m.__prefix_.second = __m[0].first;
__m.__prefix_.matched = __m.__prefix_.first != __m.__prefix_.second;
- __m.__suffix_.first = __m[0].second;
+ __m.__suffix_.first = __m[0].second;
__m.__suffix_.matched = __m.__suffix_.first != __m.__suffix_.second;
return true;
+ }
+ __m.__matches_.assign(__m.size(), __m.__unmatched_);
}
- if (__first != __last && !(__flags & regex_constants::match_continuous))
- {
- __flags |= regex_constants::match_prev_avail;
- for (++__first; __first != __last; ++__first)
- {
- __m.__matches_.assign(__m.size(), __m.__unmatched_);
- if (__match_at_start(__first, __last, __m, __flags, false))
- {
- __m.__prefix_.second = __m[0].first;
- __m.__prefix_.matched = __m.__prefix_.first != __m.__prefix_.second;
- __m.__suffix_.first = __m[0].second;
- __m.__suffix_.matched = __m.__suffix_.first != __m.__suffix_.second;
- return true;
- }
- __m.__matches_.assign(__m.size(), __m.__unmatched_);
- }
- }
- __m.__matches_.clear();
- return false;
+ }
+ __m.__matches_.clear();
+ return false;
}
template <class _BidirectionalIterator, class _Allocator, class _CharT, class _Traits>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-regex_search(_BidirectionalIterator __first, _BidirectionalIterator __last,
+inline _LIBCPP_HIDE_FROM_ABI bool
+regex_search(_BidirectionalIterator __first,
+ _BidirectionalIterator __last,
match_results<_BidirectionalIterator, _Allocator>& __m,
const basic_regex<_CharT, _Traits>& __e,
- regex_constants::match_flag_type __flags = regex_constants::match_default)
-{
- int __offset = (__flags & regex_constants::match_prev_avail) ? 1 : 0;
- basic_string<_CharT> __s(std::prev(__first, __offset), __last);
- match_results<const _CharT*> __mc;
- bool __r = __e.__search(__s.data() + __offset, __s.data() + __s.size(), __mc, __flags);
- __m.__assign(__first, __last, __mc, __flags & regex_constants::__no_update_pos);
- return __r;
+ regex_constants::match_flag_type __flags = regex_constants::match_default) {
+ int __offset = (__flags & regex_constants::match_prev_avail) ? 1 : 0;
+ basic_string<_CharT> __s(std::prev(__first, __offset), __last);
+ match_results<const _CharT*> __mc;
+ bool __r = __e.__search(__s.data() + __offset, __s.data() + __s.size(), __mc, __flags);
+ __m.__assign(__first, __last, __mc, __flags & regex_constants::__no_update_pos);
+ return __r;
}
template <class _Iter, class _Allocator, class _CharT, class _Traits>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
+inline _LIBCPP_HIDE_FROM_ABI bool
regex_search(__wrap_iter<_Iter> __first,
__wrap_iter<_Iter> __last,
match_results<__wrap_iter<_Iter>, _Allocator>& __m,
const basic_regex<_CharT, _Traits>& __e,
- regex_constants::match_flag_type __flags = regex_constants::match_default)
-{
- match_results<const _CharT*> __mc;
- bool __r = __e.__search(__first.base(), __last.base(), __mc, __flags);
- __m.__assign(__first, __last, __mc, __flags & regex_constants::__no_update_pos);
- return __r;
+ regex_constants::match_flag_type __flags = regex_constants::match_default) {
+ match_results<const _CharT*> __mc;
+ bool __r = __e.__search(__first.base(), __last.base(), __mc, __flags);
+ __m.__assign(__first, __last, __mc, __flags & regex_constants::__no_update_pos);
+ return __r;
}
template <class _Allocator, class _CharT, class _Traits>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-regex_search(const _CharT* __first, const _CharT* __last,
+inline _LIBCPP_HIDE_FROM_ABI bool
+regex_search(const _CharT* __first,
+ const _CharT* __last,
match_results<const _CharT*, _Allocator>& __m,
const basic_regex<_CharT, _Traits>& __e,
- regex_constants::match_flag_type __flags = regex_constants::match_default)
-{
- return __e.__search(__first, __last, __m, __flags);
+ regex_constants::match_flag_type __flags = regex_constants::match_default) {
+ return __e.__search(__first, __last, __m, __flags);
}
template <class _BidirectionalIterator, class _CharT, class _Traits>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-regex_search(_BidirectionalIterator __first, _BidirectionalIterator __last,
+inline _LIBCPP_HIDE_FROM_ABI bool
+regex_search(_BidirectionalIterator __first,
+ _BidirectionalIterator __last,
const basic_regex<_CharT, _Traits>& __e,
- regex_constants::match_flag_type __flags = regex_constants::match_default)
-{
- basic_string<_CharT> __s(__first, __last);
- match_results<const _CharT*> __mc;
- return __e.__search(__s.data(), __s.data() + __s.size(), __mc, __flags);
+ regex_constants::match_flag_type __flags = regex_constants::match_default) {
+ basic_string<_CharT> __s(__first, __last);
+ match_results<const _CharT*> __mc;
+ return __e.__search(__s.data(), __s.data() + __s.size(), __mc, __flags);
}
template <class _CharT, class _Traits>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-regex_search(const _CharT* __first, const _CharT* __last,
+inline _LIBCPP_HIDE_FROM_ABI bool
+regex_search(const _CharT* __first,
+ const _CharT* __last,
const basic_regex<_CharT, _Traits>& __e,
- regex_constants::match_flag_type __flags = regex_constants::match_default)
-{
- match_results<const _CharT*> __mc;
- return __e.__search(__first, __last, __mc, __flags);
+ regex_constants::match_flag_type __flags = regex_constants::match_default) {
+ match_results<const _CharT*> __mc;
+ return __e.__search(__first, __last, __mc, __flags);
}
template <class _CharT, class _Allocator, class _Traits>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-regex_search(const _CharT* __str, match_results<const _CharT*, _Allocator>& __m,
+inline _LIBCPP_HIDE_FROM_ABI bool
+regex_search(const _CharT* __str,
+ match_results<const _CharT*, _Allocator>& __m,
const basic_regex<_CharT, _Traits>& __e,
- regex_constants::match_flag_type __flags = regex_constants::match_default)
-{
- return __e.__search(__str, __str + _Traits::length(__str), __m, __flags);
+ regex_constants::match_flag_type __flags = regex_constants::match_default) {
+ return __e.__search(__str, __str + _Traits::length(__str), __m, __flags);
}
template <class _CharT, class _Traits>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-regex_search(const _CharT* __str, const basic_regex<_CharT, _Traits>& __e,
- regex_constants::match_flag_type __flags = regex_constants::match_default)
-{
- match_results<const _CharT*> __m;
- return std::regex_search(__str, __m, __e, __flags);
+inline _LIBCPP_HIDE_FROM_ABI bool
+regex_search(const _CharT* __str,
+ const basic_regex<_CharT, _Traits>& __e,
+ regex_constants::match_flag_type __flags = regex_constants::match_default) {
+ match_results<const _CharT*> __m;
+ return std::regex_search(__str, __m, __e, __flags);
}
template <class _ST, class _SA, class _CharT, class _Traits>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
+inline _LIBCPP_HIDE_FROM_ABI bool
regex_search(const basic_string<_CharT, _ST, _SA>& __s,
const basic_regex<_CharT, _Traits>& __e,
- regex_constants::match_flag_type __flags = regex_constants::match_default)
-{
- match_results<const _CharT*> __mc;
- return __e.__search(__s.data(), __s.data() + __s.size(), __mc, __flags);
+ regex_constants::match_flag_type __flags = regex_constants::match_default) {
+ match_results<const _CharT*> __mc;
+ return __e.__search(__s.data(), __s.data() + __s.size(), __mc, __flags);
}
template <class _ST, class _SA, class _Allocator, class _CharT, class _Traits>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
+inline _LIBCPP_HIDE_FROM_ABI bool
regex_search(const basic_string<_CharT, _ST, _SA>& __s,
match_results<typename basic_string<_CharT, _ST, _SA>::const_iterator, _Allocator>& __m,
const basic_regex<_CharT, _Traits>& __e,
- regex_constants::match_flag_type __flags = regex_constants::match_default)
-{
- match_results<const _CharT*> __mc;
- bool __r = __e.__search(__s.data(), __s.data() + __s.size(), __mc, __flags);
- __m.__assign(__s.begin(), __s.end(), __mc, __flags & regex_constants::__no_update_pos);
- return __r;
+ regex_constants::match_flag_type __flags = regex_constants::match_default) {
+ match_results<const _CharT*> __mc;
+ bool __r = __e.__search(__s.data(), __s.data() + __s.size(), __mc, __flags);
+ __m.__assign(__s.begin(), __s.end(), __mc, __flags & regex_constants::__no_update_pos);
+ return __r;
}
#if _LIBCPP_STD_VER >= 14
template <class _ST, class _SA, class _Ap, class _Cp, class _Tp>
-bool
-regex_search(const basic_string<_Cp, _ST, _SA>&& __s,
- match_results<typename basic_string<_Cp, _ST, _SA>::const_iterator, _Ap>&,
- const basic_regex<_Cp, _Tp>& __e,
- regex_constants::match_flag_type __flags = regex_constants::match_default) = delete;
+bool regex_search(const basic_string<_Cp, _ST, _SA>&& __s,
+ match_results<typename basic_string<_Cp, _ST, _SA>::const_iterator, _Ap>&,
+ const basic_regex<_Cp, _Tp>& __e,
+ regex_constants::match_flag_type __flags = regex_constants::match_default) = delete;
#endif
// regex_match
template <class _BidirectionalIterator, class _Allocator, class _CharT, class _Traits>
_LIBCPP_HIDE_FROM_ABI bool
-regex_match(_BidirectionalIterator __first, _BidirectionalIterator __last,
+regex_match(_BidirectionalIterator __first,
+ _BidirectionalIterator __last,
match_results<_BidirectionalIterator, _Allocator>& __m,
const basic_regex<_CharT, _Traits>& __e,
- regex_constants::match_flag_type __flags = regex_constants::match_default)
-{
- bool __r = std::regex_search(
- __first, __last, __m, __e,
- __flags | regex_constants::match_continuous |
- regex_constants::__full_match);
- if (__r)
- {
- __r = !__m.suffix().matched;
- if (!__r)
- __m.__matches_.clear();
- }
- return __r;
+ regex_constants::match_flag_type __flags = regex_constants::match_default) {
+ bool __r = std::regex_search(
+ __first, __last, __m, __e, __flags | regex_constants::match_continuous | regex_constants::__full_match);
+ if (__r) {
+ __r = !__m.suffix().matched;
+ if (!__r)
+ __m.__matches_.clear();
+ }
+ return __r;
}
template <class _BidirectionalIterator, class _CharT, class _Traits>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-regex_match(_BidirectionalIterator __first, _BidirectionalIterator __last,
+inline _LIBCPP_HIDE_FROM_ABI bool
+regex_match(_BidirectionalIterator __first,
+ _BidirectionalIterator __last,
const basic_regex<_CharT, _Traits>& __e,
- regex_constants::match_flag_type __flags = regex_constants::match_default)
-{
- match_results<_BidirectionalIterator> __m;
- return std::regex_match(__first, __last, __m, __e, __flags);
+ regex_constants::match_flag_type __flags = regex_constants::match_default) {
+ match_results<_BidirectionalIterator> __m;
+ return std::regex_match(__first, __last, __m, __e, __flags);
}
template <class _CharT, class _Allocator, class _Traits>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-regex_match(const _CharT* __str, match_results<const _CharT*, _Allocator>& __m,
+inline _LIBCPP_HIDE_FROM_ABI bool
+regex_match(const _CharT* __str,
+ match_results<const _CharT*, _Allocator>& __m,
const basic_regex<_CharT, _Traits>& __e,
- regex_constants::match_flag_type __flags = regex_constants::match_default)
-{
- return std::regex_match(__str, __str + _Traits::length(__str), __m, __e, __flags);
+ regex_constants::match_flag_type __flags = regex_constants::match_default) {
+ return std::regex_match(__str, __str + _Traits::length(__str), __m, __e, __flags);
}
template <class _ST, class _SA, class _Allocator, class _CharT, class _Traits>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
+inline _LIBCPP_HIDE_FROM_ABI bool
regex_match(const basic_string<_CharT, _ST, _SA>& __s,
match_results<typename basic_string<_CharT, _ST, _SA>::const_iterator, _Allocator>& __m,
const basic_regex<_CharT, _Traits>& __e,
- regex_constants::match_flag_type __flags = regex_constants::match_default)
-{
- return std::regex_match(__s.begin(), __s.end(), __m, __e, __flags);
+ regex_constants::match_flag_type __flags = regex_constants::match_default) {
+ return std::regex_match(__s.begin(), __s.end(), __m, __e, __flags);
}
#if _LIBCPP_STD_VER >= 14
template <class _ST, class _SA, class _Allocator, class _CharT, class _Traits>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
+inline _LIBCPP_HIDE_FROM_ABI bool
regex_match(const basic_string<_CharT, _ST, _SA>&& __s,
match_results<typename basic_string<_CharT, _ST, _SA>::const_iterator, _Allocator>& __m,
const basic_regex<_CharT, _Traits>& __e,
@@ -6361,576 +5283,491 @@ regex_match(const basic_string<_CharT, _ST, _SA>&& __s,
#endif
template <class _CharT, class _Traits>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-regex_match(const _CharT* __str, const basic_regex<_CharT, _Traits>& __e,
- regex_constants::match_flag_type __flags = regex_constants::match_default)
-{
- return std::regex_match(__str, __str + _Traits::length(__str), __e, __flags);
+inline _LIBCPP_HIDE_FROM_ABI bool
+regex_match(const _CharT* __str,
+ const basic_regex<_CharT, _Traits>& __e,
+ regex_constants::match_flag_type __flags = regex_constants::match_default) {
+ return std::regex_match(__str, __str + _Traits::length(__str), __e, __flags);
}
template <class _ST, class _SA, class _CharT, class _Traits>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
+inline _LIBCPP_HIDE_FROM_ABI bool
regex_match(const basic_string<_CharT, _ST, _SA>& __s,
const basic_regex<_CharT, _Traits>& __e,
- regex_constants::match_flag_type __flags = regex_constants::match_default)
-{
- return std::regex_match(__s.begin(), __s.end(), __e, __flags);
+ regex_constants::match_flag_type __flags = regex_constants::match_default) {
+ return std::regex_match(__s.begin(), __s.end(), __e, __flags);
}
// regex_iterator
template <class _BidirectionalIterator,
- class _CharT = typename iterator_traits<_BidirectionalIterator>::value_type,
+ class _CharT = typename iterator_traits<_BidirectionalIterator>::value_type,
class _Traits = regex_traits<_CharT> >
- class _LIBCPP_TEMPLATE_VIS regex_iterator;
+class _LIBCPP_TEMPLATE_VIS regex_iterator;
-typedef regex_iterator<const char*> cregex_iterator;
-typedef regex_iterator<string::const_iterator> sregex_iterator;
+typedef regex_iterator<const char*> cregex_iterator;
+typedef regex_iterator<string::const_iterator> sregex_iterator;
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
-typedef regex_iterator<const wchar_t*> wcregex_iterator;
+typedef regex_iterator<const wchar_t*> wcregex_iterator;
typedef regex_iterator<wstring::const_iterator> wsregex_iterator;
#endif
template <class _BidirectionalIterator, class _CharT, class _Traits>
-class
- _LIBCPP_TEMPLATE_VIS
- _LIBCPP_PREFERRED_NAME(cregex_iterator)
- _LIBCPP_IF_WIDE_CHARACTERS(_LIBCPP_PREFERRED_NAME(wcregex_iterator))
- _LIBCPP_PREFERRED_NAME(sregex_iterator)
- _LIBCPP_IF_WIDE_CHARACTERS(_LIBCPP_PREFERRED_NAME(wsregex_iterator))
- regex_iterator
-{
+class _LIBCPP_TEMPLATE_VIS _LIBCPP_PREFERRED_NAME(cregex_iterator)
+ _LIBCPP_IF_WIDE_CHARACTERS(_LIBCPP_PREFERRED_NAME(wcregex_iterator)) _LIBCPP_PREFERRED_NAME(sregex_iterator)
+ _LIBCPP_IF_WIDE_CHARACTERS(_LIBCPP_PREFERRED_NAME(wsregex_iterator)) regex_iterator {
public:
- typedef basic_regex<_CharT, _Traits> regex_type;
- typedef match_results<_BidirectionalIterator> value_type;
- typedef ptrdiff_t difference_type;
- typedef const value_type* pointer;
- typedef const value_type& reference;
- typedef forward_iterator_tag iterator_category;
+ typedef basic_regex<_CharT, _Traits> regex_type;
+ typedef match_results<_BidirectionalIterator> value_type;
+ typedef ptrdiff_t difference_type;
+ typedef const value_type* pointer;
+ typedef const value_type& reference;
+ typedef forward_iterator_tag iterator_category;
#if _LIBCPP_STD_VER >= 20
- typedef input_iterator_tag iterator_concept;
+ typedef input_iterator_tag iterator_concept;
#endif
private:
- _BidirectionalIterator __begin_;
- _BidirectionalIterator __end_;
- const regex_type* __pregex_;
- regex_constants::match_flag_type __flags_;
- value_type __match_;
+ _BidirectionalIterator __begin_;
+ _BidirectionalIterator __end_;
+ const regex_type* __pregex_;
+ regex_constants::match_flag_type __flags_;
+ value_type __match_;
public:
- regex_iterator();
- regex_iterator(_BidirectionalIterator __a, _BidirectionalIterator __b,
- const regex_type& __re,
- regex_constants::match_flag_type __m
- = regex_constants::match_default);
+ regex_iterator();
+ regex_iterator(_BidirectionalIterator __a,
+ _BidirectionalIterator __b,
+ const regex_type& __re,
+ regex_constants::match_flag_type __m = regex_constants::match_default);
#if _LIBCPP_STD_VER >= 14
- regex_iterator(_BidirectionalIterator __a, _BidirectionalIterator __b,
- const regex_type&& __re,
- regex_constants::match_flag_type __m
- = regex_constants::match_default) = delete;
+ regex_iterator(_BidirectionalIterator __a,
+ _BidirectionalIterator __b,
+ const regex_type&& __re,
+ regex_constants::match_flag_type __m = regex_constants::match_default) = delete;
#endif
- _LIBCPP_HIDE_FROM_ABI bool operator==(const regex_iterator& __x) const;
+ _LIBCPP_HIDE_FROM_ABI bool operator==(const regex_iterator& __x) const;
#if _LIBCPP_STD_VER >= 20
- _LIBCPP_HIDE_FROM_ABI bool operator==(default_sentinel_t) const { return *this == regex_iterator(); }
+ _LIBCPP_HIDE_FROM_ABI bool operator==(default_sentinel_t) const { return *this == regex_iterator(); }
#endif
#if _LIBCPP_STD_VER < 20
- _LIBCPP_HIDE_FROM_ABI
- bool operator!=(const regex_iterator& __x) const {return !(*this == __x);}
+ _LIBCPP_HIDE_FROM_ABI bool operator!=(const regex_iterator& __x) const { return !(*this == __x); }
#endif
- _LIBCPP_HIDE_FROM_ABI
- reference operator*() const {return __match_;}
- _LIBCPP_HIDE_FROM_ABI
- pointer operator->() const {return std::addressof(__match_);}
+ _LIBCPP_HIDE_FROM_ABI reference operator*() const { return __match_; }
+ _LIBCPP_HIDE_FROM_ABI pointer operator->() const { return std::addressof(__match_); }
- regex_iterator& operator++();
- _LIBCPP_HIDE_FROM_ABI
- regex_iterator operator++(int)
- {
- regex_iterator __t(*this);
- ++(*this);
- return __t;
- }
+ regex_iterator& operator++();
+ _LIBCPP_HIDE_FROM_ABI regex_iterator operator++(int) {
+ regex_iterator __t(*this);
+ ++(*this);
+ return __t;
+ }
};
template <class _BidirectionalIterator, class _CharT, class _Traits>
regex_iterator<_BidirectionalIterator, _CharT, _Traits>::regex_iterator()
- : __begin_(), __end_(), __pregex_(nullptr), __flags_(), __match_()
-{
-}
+ : __begin_(), __end_(), __pregex_(nullptr), __flags_(), __match_() {}
template <class _BidirectionalIterator, class _CharT, class _Traits>
-regex_iterator<_BidirectionalIterator, _CharT, _Traits>::
- regex_iterator(_BidirectionalIterator __a, _BidirectionalIterator __b,
- const regex_type& __re, regex_constants::match_flag_type __m)
- : __begin_(__a),
- __end_(__b),
- __pregex_(std::addressof(__re)),
- __flags_(__m)
-{
- std::regex_search(__begin_, __end_, __match_, *__pregex_, __flags_);
+regex_iterator<_BidirectionalIterator, _CharT, _Traits>::regex_iterator(
+ _BidirectionalIterator __a,
+ _BidirectionalIterator __b,
+ const regex_type& __re,
+ regex_constants::match_flag_type __m)
+ : __begin_(__a), __end_(__b), __pregex_(std::addressof(__re)), __flags_(__m) {
+ std::regex_search(__begin_, __end_, __match_, *__pregex_, __flags_);
}
template <class _BidirectionalIterator, class _CharT, class _Traits>
-bool
-regex_iterator<_BidirectionalIterator, _CharT, _Traits>::
- operator==(const regex_iterator& __x) const
-{
- if (__match_.empty() && __x.__match_.empty())
- return true;
- if (__match_.empty() || __x.__match_.empty())
- return false;
- return __begin_ == __x.__begin_ &&
- __end_ == __x.__end_ &&
- __pregex_ == __x.__pregex_ &&
- __flags_ == __x.__flags_ &&
- __match_[0] == __x.__match_[0];
+bool regex_iterator<_BidirectionalIterator, _CharT, _Traits>::operator==(const regex_iterator& __x) const {
+ if (__match_.empty() && __x.__match_.empty())
+ return true;
+ if (__match_.empty() || __x.__match_.empty())
+ return false;
+ return __begin_ == __x.__begin_ && __end_ == __x.__end_ && __pregex_ == __x.__pregex_ && __flags_ == __x.__flags_ &&
+ __match_[0] == __x.__match_[0];
}
template <class _BidirectionalIterator, class _CharT, class _Traits>
regex_iterator<_BidirectionalIterator, _CharT, _Traits>&
-regex_iterator<_BidirectionalIterator, _CharT, _Traits>::operator++()
-{
- __flags_ |= regex_constants::__no_update_pos;
- _BidirectionalIterator __start = __match_[0].second;
- if (__match_[0].first == __match_[0].second)
- {
- if (__start == __end_)
- {
- __match_ = value_type();
- return *this;
- }
- else if (std::regex_search(__start, __end_, __match_, *__pregex_,
- __flags_ | regex_constants::match_not_null |
- regex_constants::match_continuous))
- return *this;
- else
- ++__start;
- }
- __flags_ |= regex_constants::match_prev_avail;
- if (!std::regex_search(__start, __end_, __match_, *__pregex_, __flags_))
- __match_ = value_type();
- return *this;
+regex_iterator<_BidirectionalIterator, _CharT, _Traits>::operator++() {
+ __flags_ |= regex_constants::__no_update_pos;
+ _BidirectionalIterator __start = __match_[0].second;
+ if (__match_[0].first == __match_[0].second) {
+ if (__start == __end_) {
+ __match_ = value_type();
+ return *this;
+ } else if (std::regex_search(__start,
+ __end_,
+ __match_,
+ *__pregex_,
+ __flags_ | regex_constants::match_not_null | regex_constants::match_continuous))
+ return *this;
+ else
+ ++__start;
+ }
+ __flags_ |= regex_constants::match_prev_avail;
+ if (!std::regex_search(__start, __end_, __match_, *__pregex_, __flags_))
+ __match_ = value_type();
+ return *this;
}
// regex_token_iterator
template <class _BidirectionalIterator,
- class _CharT = typename iterator_traits<_BidirectionalIterator>::value_type,
+ class _CharT = typename iterator_traits<_BidirectionalIterator>::value_type,
class _Traits = regex_traits<_CharT> >
- class _LIBCPP_TEMPLATE_VIS regex_token_iterator;
+class _LIBCPP_TEMPLATE_VIS regex_token_iterator;
-typedef regex_token_iterator<const char*> cregex_token_iterator;
-typedef regex_token_iterator<string::const_iterator> sregex_token_iterator;
+typedef regex_token_iterator<const char*> cregex_token_iterator;
+typedef regex_token_iterator<string::const_iterator> sregex_token_iterator;
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
-typedef regex_token_iterator<const wchar_t*> wcregex_token_iterator;
+typedef regex_token_iterator<const wchar_t*> wcregex_token_iterator;
typedef regex_token_iterator<wstring::const_iterator> wsregex_token_iterator;
#endif
template <class _BidirectionalIterator, class _CharT, class _Traits>
-class
- _LIBCPP_TEMPLATE_VIS
- _LIBCPP_PREFERRED_NAME(cregex_token_iterator)
+class _LIBCPP_TEMPLATE_VIS _LIBCPP_PREFERRED_NAME(cregex_token_iterator)
_LIBCPP_IF_WIDE_CHARACTERS(_LIBCPP_PREFERRED_NAME(wcregex_token_iterator))
- _LIBCPP_PREFERRED_NAME(sregex_token_iterator)
- _LIBCPP_IF_WIDE_CHARACTERS(_LIBCPP_PREFERRED_NAME(wsregex_token_iterator))
- regex_token_iterator
-{
+ _LIBCPP_PREFERRED_NAME(sregex_token_iterator)
+ _LIBCPP_IF_WIDE_CHARACTERS(_LIBCPP_PREFERRED_NAME(wsregex_token_iterator)) regex_token_iterator {
public:
- typedef basic_regex<_CharT, _Traits> regex_type;
- typedef sub_match<_BidirectionalIterator> value_type;
- typedef ptrdiff_t difference_type;
- typedef const value_type* pointer;
- typedef const value_type& reference;
- typedef forward_iterator_tag iterator_category;
+ typedef basic_regex<_CharT, _Traits> regex_type;
+ typedef sub_match<_BidirectionalIterator> value_type;
+ typedef ptrdiff_t difference_type;
+ typedef const value_type* pointer;
+ typedef const value_type& reference;
+ typedef forward_iterator_tag iterator_category;
#if _LIBCPP_STD_VER >= 20
- typedef input_iterator_tag iterator_concept;
+ typedef input_iterator_tag iterator_concept;
#endif
private:
- typedef regex_iterator<_BidirectionalIterator, _CharT, _Traits> _Position;
+ typedef regex_iterator<_BidirectionalIterator, _CharT, _Traits> _Position;
- _Position __position_;
- const value_type* __result_;
- value_type __suffix_;
- ptrdiff_t __n_;
- vector<int> __subs_;
+ _Position __position_;
+ const value_type* __result_;
+ value_type __suffix_;
+ ptrdiff_t __n_;
+ vector<int> __subs_;
public:
- regex_token_iterator();
- regex_token_iterator(_BidirectionalIterator __a, _BidirectionalIterator __b,
- const regex_type& __re, int __submatch = 0,
- regex_constants::match_flag_type __m =
- regex_constants::match_default);
+ regex_token_iterator();
+ regex_token_iterator(_BidirectionalIterator __a,
+ _BidirectionalIterator __b,
+ const regex_type& __re,
+ int __submatch = 0,
+ regex_constants::match_flag_type __m = regex_constants::match_default);
#if _LIBCPP_STD_VER >= 14
- regex_token_iterator(_BidirectionalIterator __a, _BidirectionalIterator __b,
- const regex_type&& __re, int __submatch = 0,
- regex_constants::match_flag_type __m =
- regex_constants::match_default) = delete;
+ regex_token_iterator(_BidirectionalIterator __a,
+ _BidirectionalIterator __b,
+ const regex_type&& __re,
+ int __submatch = 0,
+ regex_constants::match_flag_type __m = regex_constants::match_default) = delete;
#endif
- regex_token_iterator(_BidirectionalIterator __a, _BidirectionalIterator __b,
- const regex_type& __re, const vector<int>& __submatches,
- regex_constants::match_flag_type __m =
- regex_constants::match_default);
+ regex_token_iterator(_BidirectionalIterator __a,
+ _BidirectionalIterator __b,
+ const regex_type& __re,
+ const vector<int>& __submatches,
+ regex_constants::match_flag_type __m = regex_constants::match_default);
#if _LIBCPP_STD_VER >= 14
- regex_token_iterator(_BidirectionalIterator __a, _BidirectionalIterator __b,
- const regex_type&& __re, const vector<int>& __submatches,
- regex_constants::match_flag_type __m =
- regex_constants::match_default) = delete;
+ regex_token_iterator(_BidirectionalIterator __a,
+ _BidirectionalIterator __b,
+ const regex_type&& __re,
+ const vector<int>& __submatches,
+ regex_constants::match_flag_type __m = regex_constants::match_default) = delete;
#endif
#ifndef _LIBCPP_CXX03_LANG
- regex_token_iterator(_BidirectionalIterator __a, _BidirectionalIterator __b,
- const regex_type& __re,
- initializer_list<int> __submatches,
- regex_constants::match_flag_type __m =
- regex_constants::match_default);
-
-#if _LIBCPP_STD_VER >= 14
- regex_token_iterator(_BidirectionalIterator __a, _BidirectionalIterator __b,
- const regex_type&& __re,
- initializer_list<int> __submatches,
- regex_constants::match_flag_type __m =
- regex_constants::match_default) = delete;
-#endif
+ regex_token_iterator(_BidirectionalIterator __a,
+ _BidirectionalIterator __b,
+ const regex_type& __re,
+ initializer_list<int> __submatches,
+ regex_constants::match_flag_type __m = regex_constants::match_default);
+
+# if _LIBCPP_STD_VER >= 14
+ regex_token_iterator(_BidirectionalIterator __a,
+ _BidirectionalIterator __b,
+ const regex_type&& __re,
+ initializer_list<int> __submatches,
+ regex_constants::match_flag_type __m = regex_constants::match_default) = delete;
+# endif
#endif // _LIBCPP_CXX03_LANG
- template <size_t _Np>
- regex_token_iterator(_BidirectionalIterator __a,
- _BidirectionalIterator __b,
- const regex_type& __re,
- const int (&__submatches)[_Np],
- regex_constants::match_flag_type __m =
- regex_constants::match_default);
+ template <size_t _Np>
+ regex_token_iterator(_BidirectionalIterator __a,
+ _BidirectionalIterator __b,
+ const regex_type& __re,
+ const int (&__submatches)[_Np],
+ regex_constants::match_flag_type __m = regex_constants::match_default);
#if _LIBCPP_STD_VER >= 14
- template <size_t _Np>
- regex_token_iterator(_BidirectionalIterator __a,
- _BidirectionalIterator __b,
- const regex_type&& __re,
- const int (&__submatches)[_Np],
- regex_constants::match_flag_type __m =
- regex_constants::match_default) = delete;
+ template <size_t _Np>
+ regex_token_iterator(_BidirectionalIterator __a,
+ _BidirectionalIterator __b,
+ const regex_type&& __re,
+ const int (&__submatches)[_Np],
+ regex_constants::match_flag_type __m = regex_constants::match_default) = delete;
#endif
- regex_token_iterator(const regex_token_iterator&);
- regex_token_iterator& operator=(const regex_token_iterator&);
+ regex_token_iterator(const regex_token_iterator&);
+ regex_token_iterator& operator=(const regex_token_iterator&);
- _LIBCPP_HIDE_FROM_ABI bool operator==(const regex_token_iterator& __x) const;
+ _LIBCPP_HIDE_FROM_ABI bool operator==(const regex_token_iterator& __x) const;
#if _LIBCPP_STD_VER >= 20
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_HIDE_FROM_ABI bool operator==(default_sentinel_t) const {
- return *this == regex_token_iterator();
- }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_HIDE_FROM_ABI bool operator==(default_sentinel_t) const {
+ return *this == regex_token_iterator();
+ }
#endif
#if _LIBCPP_STD_VER < 20
- _LIBCPP_HIDE_FROM_ABI
- bool operator!=(const regex_token_iterator& __x) const {return !(*this == __x);}
+ _LIBCPP_HIDE_FROM_ABI bool operator!=(const regex_token_iterator& __x) const { return !(*this == __x); }
#endif
- _LIBCPP_HIDE_FROM_ABI
- const value_type& operator*() const {return *__result_;}
- _LIBCPP_HIDE_FROM_ABI
- const value_type* operator->() const {return __result_;}
+ _LIBCPP_HIDE_FROM_ABI const value_type& operator*() const { return *__result_; }
+ _LIBCPP_HIDE_FROM_ABI const value_type* operator->() const { return __result_; }
- regex_token_iterator& operator++();
- _LIBCPP_HIDE_FROM_ABI
- regex_token_iterator operator++(int)
- {
- regex_token_iterator __t(*this);
- ++(*this);
- return __t;
- }
+ regex_token_iterator& operator++();
+ _LIBCPP_HIDE_FROM_ABI regex_token_iterator operator++(int) {
+ regex_token_iterator __t(*this);
+ ++(*this);
+ return __t;
+ }
private:
- void __init(_BidirectionalIterator __a, _BidirectionalIterator __b);
- void __establish_result () {
- if (__subs_[__n_] == -1)
- __result_ = &__position_->prefix();
- else
- __result_ = &(*__position_)[__subs_[__n_]];
- }
+ void __init(_BidirectionalIterator __a, _BidirectionalIterator __b);
+ void __establish_result() {
+ if (__subs_[__n_] == -1)
+ __result_ = &__position_->prefix();
+ else
+ __result_ = &(*__position_)[__subs_[__n_]];
+ }
};
template <class _BidirectionalIterator, class _CharT, class _Traits>
-regex_token_iterator<_BidirectionalIterator, _CharT, _Traits>::
- regex_token_iterator()
- : __result_(nullptr),
- __suffix_(),
- __n_(0)
-{
-}
+regex_token_iterator<_BidirectionalIterator, _CharT, _Traits>::regex_token_iterator()
+ : __result_(nullptr), __suffix_(), __n_(0) {}
template <class _BidirectionalIterator, class _CharT, class _Traits>
-void
-regex_token_iterator<_BidirectionalIterator, _CharT, _Traits>::
- __init(_BidirectionalIterator __a, _BidirectionalIterator __b)
-{
- if (__position_ != _Position())
- __establish_result ();
- else if (__subs_[__n_] == -1)
- {
- __suffix_.matched = true;
- __suffix_.first = __a;
- __suffix_.second = __b;
- __result_ = &__suffix_;
- }
- else
- __result_ = nullptr;
+void regex_token_iterator<_BidirectionalIterator, _CharT, _Traits>::__init(
+ _BidirectionalIterator __a, _BidirectionalIterator __b) {
+ if (__position_ != _Position())
+ __establish_result();
+ else if (__subs_[__n_] == -1) {
+ __suffix_.matched = true;
+ __suffix_.first = __a;
+ __suffix_.second = __b;
+ __result_ = &__suffix_;
+ } else
+ __result_ = nullptr;
}
template <class _BidirectionalIterator, class _CharT, class _Traits>
-regex_token_iterator<_BidirectionalIterator, _CharT, _Traits>::
- regex_token_iterator(_BidirectionalIterator __a, _BidirectionalIterator __b,
- const regex_type& __re, int __submatch,
- regex_constants::match_flag_type __m)
- : __position_(__a, __b, __re, __m),
- __n_(0),
- __subs_(1, __submatch)
-{
- __init(__a, __b);
+regex_token_iterator<_BidirectionalIterator, _CharT, _Traits>::regex_token_iterator(
+ _BidirectionalIterator __a,
+ _BidirectionalIterator __b,
+ const regex_type& __re,
+ int __submatch,
+ regex_constants::match_flag_type __m)
+ : __position_(__a, __b, __re, __m), __n_(0), __subs_(1, __submatch) {
+ __init(__a, __b);
}
template <class _BidirectionalIterator, class _CharT, class _Traits>
-regex_token_iterator<_BidirectionalIterator, _CharT, _Traits>::
- regex_token_iterator(_BidirectionalIterator __a, _BidirectionalIterator __b,
- const regex_type& __re, const vector<int>& __submatches,
- regex_constants::match_flag_type __m)
- : __position_(__a, __b, __re, __m),
- __n_(0),
- __subs_(__submatches)
-{
- __init(__a, __b);
+regex_token_iterator<_BidirectionalIterator, _CharT, _Traits>::regex_token_iterator(
+ _BidirectionalIterator __a,
+ _BidirectionalIterator __b,
+ const regex_type& __re,
+ const vector<int>& __submatches,
+ regex_constants::match_flag_type __m)
+ : __position_(__a, __b, __re, __m), __n_(0), __subs_(__submatches) {
+ __init(__a, __b);
}
#ifndef _LIBCPP_CXX03_LANG
template <class _BidirectionalIterator, class _CharT, class _Traits>
-regex_token_iterator<_BidirectionalIterator, _CharT, _Traits>::
- regex_token_iterator(_BidirectionalIterator __a, _BidirectionalIterator __b,
- const regex_type& __re,
- initializer_list<int> __submatches,
- regex_constants::match_flag_type __m)
- : __position_(__a, __b, __re, __m),
- __n_(0),
- __subs_(__submatches)
-{
- __init(__a, __b);
+regex_token_iterator<_BidirectionalIterator, _CharT, _Traits>::regex_token_iterator(
+ _BidirectionalIterator __a,
+ _BidirectionalIterator __b,
+ const regex_type& __re,
+ initializer_list<int> __submatches,
+ regex_constants::match_flag_type __m)
+ : __position_(__a, __b, __re, __m), __n_(0), __subs_(__submatches) {
+ __init(__a, __b);
}
#endif // _LIBCPP_CXX03_LANG
template <class _BidirectionalIterator, class _CharT, class _Traits>
template <size_t _Np>
-regex_token_iterator<_BidirectionalIterator, _CharT, _Traits>::
- regex_token_iterator(_BidirectionalIterator __a, _BidirectionalIterator __b,
- const regex_type& __re,
- const int (&__submatches)[_Np],
- regex_constants::match_flag_type __m)
- : __position_(__a, __b, __re, __m),
- __n_(0),
- __subs_(begin(__submatches), end(__submatches))
-{
- __init(__a, __b);
+regex_token_iterator<_BidirectionalIterator, _CharT, _Traits>::regex_token_iterator(
+ _BidirectionalIterator __a,
+ _BidirectionalIterator __b,
+ const regex_type& __re,
+ const int (&__submatches)[_Np],
+ regex_constants::match_flag_type __m)
+ : __position_(__a, __b, __re, __m), __n_(0), __subs_(begin(__submatches), end(__submatches)) {
+ __init(__a, __b);
}
template <class _BidirectionalIterator, class _CharT, class _Traits>
-regex_token_iterator<_BidirectionalIterator, _CharT, _Traits>::
- regex_token_iterator(const regex_token_iterator& __x)
+regex_token_iterator<_BidirectionalIterator, _CharT, _Traits>::regex_token_iterator(const regex_token_iterator& __x)
: __position_(__x.__position_),
__result_(__x.__result_),
__suffix_(__x.__suffix_),
__n_(__x.__n_),
- __subs_(__x.__subs_)
-{
- if (__x.__result_ == &__x.__suffix_)
- __result_ = &__suffix_;
- else if ( __result_ != nullptr )
- __establish_result ();
+ __subs_(__x.__subs_) {
+ if (__x.__result_ == &__x.__suffix_)
+ __result_ = &__suffix_;
+ else if (__result_ != nullptr)
+ __establish_result();
}
template <class _BidirectionalIterator, class _CharT, class _Traits>
regex_token_iterator<_BidirectionalIterator, _CharT, _Traits>&
-regex_token_iterator<_BidirectionalIterator, _CharT, _Traits>::
- operator=(const regex_token_iterator& __x)
-{
- if (this != &__x)
- {
- __position_ = __x.__position_;
- if (__x.__result_ == &__x.__suffix_)
- __result_ = &__suffix_;
- else
- __result_ = __x.__result_;
- __suffix_ = __x.__suffix_;
- __n_ = __x.__n_;
- __subs_ = __x.__subs_;
+regex_token_iterator<_BidirectionalIterator, _CharT, _Traits>::operator=(const regex_token_iterator& __x) {
+ if (this != &__x) {
+ __position_ = __x.__position_;
+ if (__x.__result_ == &__x.__suffix_)
+ __result_ = &__suffix_;
+ else
+ __result_ = __x.__result_;
+ __suffix_ = __x.__suffix_;
+ __n_ = __x.__n_;
+ __subs_ = __x.__subs_;
- if ( __result_ != nullptr && __result_ != &__suffix_ )
- __establish_result();
- }
- return *this;
+ if (__result_ != nullptr && __result_ != &__suffix_)
+ __establish_result();
+ }
+ return *this;
}
template <class _BidirectionalIterator, class _CharT, class _Traits>
-bool
-regex_token_iterator<_BidirectionalIterator, _CharT, _Traits>::
- operator==(const regex_token_iterator& __x) const
-{
- if (__result_ == nullptr && __x.__result_ == nullptr)
- return true;
- if (__result_ == &__suffix_ && __x.__result_ == &__x.__suffix_ &&
- __suffix_ == __x.__suffix_)
- return true;
- if (__result_ == nullptr || __x.__result_ == nullptr)
- return false;
- if (__result_ == &__suffix_ || __x.__result_ == &__x.__suffix_)
- return false;
- return __position_ == __x.__position_ && __n_ == __x.__n_ &&
- __subs_ == __x.__subs_;
+bool regex_token_iterator<_BidirectionalIterator, _CharT, _Traits>::operator==(const regex_token_iterator& __x) const {
+ if (__result_ == nullptr && __x.__result_ == nullptr)
+ return true;
+ if (__result_ == &__suffix_ && __x.__result_ == &__x.__suffix_ && __suffix_ == __x.__suffix_)
+ return true;
+ if (__result_ == nullptr || __x.__result_ == nullptr)
+ return false;
+ if (__result_ == &__suffix_ || __x.__result_ == &__x.__suffix_)
+ return false;
+ return __position_ == __x.__position_ && __n_ == __x.__n_ && __subs_ == __x.__subs_;
}
template <class _BidirectionalIterator, class _CharT, class _Traits>
regex_token_iterator<_BidirectionalIterator, _CharT, _Traits>&
-regex_token_iterator<_BidirectionalIterator, _CharT, _Traits>::operator++()
-{
- _Position __prev = __position_;
- if (__result_ == &__suffix_)
+regex_token_iterator<_BidirectionalIterator, _CharT, _Traits>::operator++() {
+ _Position __prev = __position_;
+ if (__result_ == &__suffix_)
+ __result_ = nullptr;
+ else if (static_cast<size_t>(__n_ + 1) < __subs_.size()) {
+ ++__n_;
+ __establish_result();
+ } else {
+ __n_ = 0;
+ ++__position_;
+ if (__position_ != _Position())
+ __establish_result();
+ else {
+ if (std::find(__subs_.begin(), __subs_.end(), -1) != __subs_.end() && __prev->suffix().length() != 0) {
+ __suffix_.matched = true;
+ __suffix_.first = __prev->suffix().first;
+ __suffix_.second = __prev->suffix().second;
+ __result_ = &__suffix_;
+ } else
__result_ = nullptr;
- else if (static_cast<size_t>(__n_ + 1) < __subs_.size())
- {
- ++__n_;
- __establish_result();
}
- else
- {
- __n_ = 0;
- ++__position_;
- if (__position_ != _Position())
- __establish_result();
- else
- {
- if (std::find(__subs_.begin(), __subs_.end(), -1) != __subs_.end()
- && __prev->suffix().length() != 0)
- {
- __suffix_.matched = true;
- __suffix_.first = __prev->suffix().first;
- __suffix_.second = __prev->suffix().second;
- __result_ = &__suffix_;
- }
- else
- __result_ = nullptr;
- }
- }
- return *this;
+ }
+ return *this;
}
// regex_replace
-template <class _OutputIterator, class _BidirectionalIterator,
- class _Traits, class _CharT>
-_LIBCPP_HIDE_FROM_ABI _OutputIterator
-regex_replace(_OutputIterator __output_iter,
- _BidirectionalIterator __first, _BidirectionalIterator __last,
- const basic_regex<_CharT, _Traits>& __e, const _CharT* __fmt,
- regex_constants::match_flag_type __flags = regex_constants::match_default)
-{
- typedef regex_iterator<_BidirectionalIterator, _CharT, _Traits> _Iter;
- _Iter __i(__first, __last, __e, __flags);
- _Iter __eof;
- if (__i == __eof)
- {
- if (!(__flags & regex_constants::format_no_copy))
- __output_iter = std::copy(__first, __last, __output_iter);
- }
- else
- {
- sub_match<_BidirectionalIterator> __lm;
- for (size_t __len = char_traits<_CharT>::length(__fmt); __i != __eof; ++__i)
- {
- if (!(__flags & regex_constants::format_no_copy))
- __output_iter = std::copy(__i->prefix().first, __i->prefix().second, __output_iter);
- __output_iter = __i->format(__output_iter, __fmt, __fmt + __len, __flags);
- __lm = __i->suffix();
- if (__flags & regex_constants::format_first_only)
- break;
- }
- if (!(__flags & regex_constants::format_no_copy))
- __output_iter = std::copy(__lm.first, __lm.second, __output_iter);
+template <class _OutputIterator, class _BidirectionalIterator, class _Traits, class _CharT>
+_LIBCPP_HIDE_FROM_ABI _OutputIterator regex_replace(
+ _OutputIterator __output_iter,
+ _BidirectionalIterator __first,
+ _BidirectionalIterator __last,
+ const basic_regex<_CharT, _Traits>& __e,
+ const _CharT* __fmt,
+ regex_constants::match_flag_type __flags = regex_constants::match_default) {
+ typedef regex_iterator<_BidirectionalIterator, _CharT, _Traits> _Iter;
+ _Iter __i(__first, __last, __e, __flags);
+ _Iter __eof;
+ if (__i == __eof) {
+ if (!(__flags & regex_constants::format_no_copy))
+ __output_iter = std::copy(__first, __last, __output_iter);
+ } else {
+ sub_match<_BidirectionalIterator> __lm;
+ for (size_t __len = char_traits<_CharT>::length(__fmt); __i != __eof; ++__i) {
+ if (!(__flags & regex_constants::format_no_copy))
+ __output_iter = std::copy(__i->prefix().first, __i->prefix().second, __output_iter);
+ __output_iter = __i->format(__output_iter, __fmt, __fmt + __len, __flags);
+ __lm = __i->suffix();
+ if (__flags & regex_constants::format_first_only)
+ break;
}
- return __output_iter;
+ if (!(__flags & regex_constants::format_no_copy))
+ __output_iter = std::copy(__lm.first, __lm.second, __output_iter);
+ }
+ return __output_iter;
}
-template <class _OutputIterator, class _BidirectionalIterator,
- class _Traits, class _CharT, class _ST, class _SA>
-inline _LIBCPP_HIDE_FROM_ABI
-_OutputIterator
-regex_replace(_OutputIterator __output_iter,
- _BidirectionalIterator __first, _BidirectionalIterator __last,
- const basic_regex<_CharT, _Traits>& __e,
- const basic_string<_CharT, _ST, _SA>& __fmt,
- regex_constants::match_flag_type __flags = regex_constants::match_default)
-{
- return std::regex_replace(__output_iter, __first, __last, __e, __fmt.c_str(), __flags);
+template <class _OutputIterator, class _BidirectionalIterator, class _Traits, class _CharT, class _ST, class _SA>
+inline _LIBCPP_HIDE_FROM_ABI _OutputIterator regex_replace(
+ _OutputIterator __output_iter,
+ _BidirectionalIterator __first,
+ _BidirectionalIterator __last,
+ const basic_regex<_CharT, _Traits>& __e,
+ const basic_string<_CharT, _ST, _SA>& __fmt,
+ regex_constants::match_flag_type __flags = regex_constants::match_default) {
+ return std::regex_replace(__output_iter, __first, __last, __e, __fmt.c_str(), __flags);
}
-template <class _Traits, class _CharT, class _ST, class _SA, class _FST,
- class _FSA>
-inline _LIBCPP_HIDE_FROM_ABI
-basic_string<_CharT, _ST, _SA>
+template <class _Traits, class _CharT, class _ST, class _SA, class _FST, class _FSA>
+inline _LIBCPP_HIDE_FROM_ABI basic_string<_CharT, _ST, _SA>
regex_replace(const basic_string<_CharT, _ST, _SA>& __s,
const basic_regex<_CharT, _Traits>& __e,
const basic_string<_CharT, _FST, _FSA>& __fmt,
- regex_constants::match_flag_type __flags = regex_constants::match_default)
-{
- basic_string<_CharT, _ST, _SA> __r;
- std::regex_replace(std::back_inserter(__r), __s.begin(), __s.end(), __e,
- __fmt.c_str(), __flags);
- return __r;
+ regex_constants::match_flag_type __flags = regex_constants::match_default) {
+ basic_string<_CharT, _ST, _SA> __r;
+ std::regex_replace(std::back_inserter(__r), __s.begin(), __s.end(), __e, __fmt.c_str(), __flags);
+ return __r;
}
template <class _Traits, class _CharT, class _ST, class _SA>
-inline _LIBCPP_HIDE_FROM_ABI
-basic_string<_CharT, _ST, _SA>
+inline _LIBCPP_HIDE_FROM_ABI basic_string<_CharT, _ST, _SA>
regex_replace(const basic_string<_CharT, _ST, _SA>& __s,
- const basic_regex<_CharT, _Traits>& __e, const _CharT* __fmt,
- regex_constants::match_flag_type __flags = regex_constants::match_default)
-{
- basic_string<_CharT, _ST, _SA> __r;
- std::regex_replace(std::back_inserter(__r), __s.begin(), __s.end(), __e,
- __fmt, __flags);
- return __r;
+ const basic_regex<_CharT, _Traits>& __e,
+ const _CharT* __fmt,
+ regex_constants::match_flag_type __flags = regex_constants::match_default) {
+ basic_string<_CharT, _ST, _SA> __r;
+ std::regex_replace(std::back_inserter(__r), __s.begin(), __s.end(), __e, __fmt, __flags);
+ return __r;
}
template <class _Traits, class _CharT, class _ST, class _SA>
-inline _LIBCPP_HIDE_FROM_ABI
-basic_string<_CharT>
+inline _LIBCPP_HIDE_FROM_ABI basic_string<_CharT>
regex_replace(const _CharT* __s,
const basic_regex<_CharT, _Traits>& __e,
const basic_string<_CharT, _ST, _SA>& __fmt,
- regex_constants::match_flag_type __flags = regex_constants::match_default)
-{
- basic_string<_CharT> __r;
- std::regex_replace(std::back_inserter(__r), __s,
- __s + char_traits<_CharT>::length(__s), __e,
- __fmt.c_str(), __flags);
- return __r;
+ regex_constants::match_flag_type __flags = regex_constants::match_default) {
+ basic_string<_CharT> __r;
+ std::regex_replace(std::back_inserter(__r), __s, __s + char_traits<_CharT>::length(__s), __e, __fmt.c_str(), __flags);
+ return __r;
}
template <class _Traits, class _CharT>
-inline _LIBCPP_HIDE_FROM_ABI
-basic_string<_CharT>
+inline _LIBCPP_HIDE_FROM_ABI basic_string<_CharT>
regex_replace(const _CharT* __s,
const basic_regex<_CharT, _Traits>& __e,
const _CharT* __fmt,
- regex_constants::match_flag_type __flags = regex_constants::match_default)
-{
- basic_string<_CharT> __r;
- std::regex_replace(std::back_inserter(__r), __s,
- __s + char_traits<_CharT>::length(__s), __e,
- __fmt, __flags);
- return __r;
+ regex_constants::match_flag_type __flags = regex_constants::match_default) {
+ basic_string<_CharT> __r;
+ std::regex_replace(std::back_inserter(__r), __s, __s + char_traits<_CharT>::length(__s), __e, __fmt, __flags);
+ return __r;
}
_LIBCPP_END_NAMESPACE_STD
@@ -6939,15 +5776,16 @@ _LIBCPP_END_NAMESPACE_STD
_LIBCPP_BEGIN_NAMESPACE_STD
namespace pmr {
template <class _BidirT>
-using match_results _LIBCPP_AVAILABILITY_PMR = std::match_results<_BidirT, polymorphic_allocator<std::sub_match<_BidirT>>>;
+using match_results _LIBCPP_AVAILABILITY_PMR =
+ std::match_results<_BidirT, polymorphic_allocator<std::sub_match<_BidirT>>>;
-using cmatch _LIBCPP_AVAILABILITY_PMR = match_results<const char*>;
-using smatch _LIBCPP_AVAILABILITY_PMR = match_results<std::pmr::string::const_iterator>;
+using cmatch _LIBCPP_AVAILABILITY_PMR = match_results<const char*>;
+using smatch _LIBCPP_AVAILABILITY_PMR = match_results<std::pmr::string::const_iterator>;
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+# ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
using wcmatch _LIBCPP_AVAILABILITY_PMR = match_results<const wchar_t*>;
using wsmatch _LIBCPP_AVAILABILITY_PMR = match_results<std::pmr::wstring::const_iterator>;
-#endif
+# endif
} // namespace pmr
_LIBCPP_END_NAMESPACE_STD
#endif
diff --git a/contrib/llvm-project/libcxx/include/scoped_allocator b/contrib/llvm-project/libcxx/include/scoped_allocator
index d0bc847332e8..6078906e9224 100644
--- a/contrib/llvm-project/libcxx/include/scoped_allocator
+++ b/contrib/llvm-project/libcxx/include/scoped_allocator
@@ -139,563 +139,418 @@ _LIBCPP_BEGIN_NAMESPACE_STD
// scoped_allocator_adaptor
-template <class ..._Allocs>
+template <class... _Allocs>
class scoped_allocator_adaptor;
-template <class ..._Allocs> struct __get_poc_copy_assignment;
+template <class... _Allocs>
+struct __get_poc_copy_assignment;
template <class _A0>
-struct __get_poc_copy_assignment<_A0>
-{
- static const bool value = allocator_traits<_A0>::
- propagate_on_container_copy_assignment::value;
+struct __get_poc_copy_assignment<_A0> {
+ static const bool value = allocator_traits<_A0>::propagate_on_container_copy_assignment::value;
};
-template <class _A0, class ..._Allocs>
-struct __get_poc_copy_assignment<_A0, _Allocs...>
-{
- static const bool value =
- allocator_traits<_A0>::propagate_on_container_copy_assignment::value ||
- __get_poc_copy_assignment<_Allocs...>::value;
+template <class _A0, class... _Allocs>
+struct __get_poc_copy_assignment<_A0, _Allocs...> {
+ static const bool value = allocator_traits<_A0>::propagate_on_container_copy_assignment::value ||
+ __get_poc_copy_assignment<_Allocs...>::value;
};
-template <class ..._Allocs> struct __get_poc_move_assignment;
+template <class... _Allocs>
+struct __get_poc_move_assignment;
template <class _A0>
-struct __get_poc_move_assignment<_A0>
-{
- static const bool value = allocator_traits<_A0>::
- propagate_on_container_move_assignment::value;
+struct __get_poc_move_assignment<_A0> {
+ static const bool value = allocator_traits<_A0>::propagate_on_container_move_assignment::value;
};
-template <class _A0, class ..._Allocs>
-struct __get_poc_move_assignment<_A0, _Allocs...>
-{
- static const bool value =
- allocator_traits<_A0>::propagate_on_container_move_assignment::value ||
- __get_poc_move_assignment<_Allocs...>::value;
+template <class _A0, class... _Allocs>
+struct __get_poc_move_assignment<_A0, _Allocs...> {
+ static const bool value = allocator_traits<_A0>::propagate_on_container_move_assignment::value ||
+ __get_poc_move_assignment<_Allocs...>::value;
};
-template <class ..._Allocs> struct __get_poc_swap;
+template <class... _Allocs>
+struct __get_poc_swap;
template <class _A0>
-struct __get_poc_swap<_A0>
-{
- static const bool value = allocator_traits<_A0>::
- propagate_on_container_swap::value;
+struct __get_poc_swap<_A0> {
+ static const bool value = allocator_traits<_A0>::propagate_on_container_swap::value;
};
-template <class _A0, class ..._Allocs>
-struct __get_poc_swap<_A0, _Allocs...>
-{
- static const bool value =
- allocator_traits<_A0>::propagate_on_container_swap::value ||
- __get_poc_swap<_Allocs...>::value;
+template <class _A0, class... _Allocs>
+struct __get_poc_swap<_A0, _Allocs...> {
+ static const bool value =
+ allocator_traits<_A0>::propagate_on_container_swap::value || __get_poc_swap<_Allocs...>::value;
};
-template <class ..._Allocs> struct __get_is_always_equal;
+template <class... _Allocs>
+struct __get_is_always_equal;
template <class _A0>
-struct __get_is_always_equal<_A0>
-{
- static const bool value = allocator_traits<_A0>::is_always_equal::value;
+struct __get_is_always_equal<_A0> {
+ static const bool value = allocator_traits<_A0>::is_always_equal::value;
};
-template <class _A0, class ..._Allocs>
-struct __get_is_always_equal<_A0, _Allocs...>
-{
- static const bool value =
- allocator_traits<_A0>::is_always_equal::value &&
- __get_is_always_equal<_Allocs...>::value;
+template <class _A0, class... _Allocs>
+struct __get_is_always_equal<_A0, _Allocs...> {
+ static const bool value = allocator_traits<_A0>::is_always_equal::value && __get_is_always_equal<_Allocs...>::value;
};
-template <class ..._Allocs>
+template <class... _Allocs>
class __scoped_allocator_storage;
template <class _OuterAlloc, class... _InnerAllocs>
-class __scoped_allocator_storage<_OuterAlloc, _InnerAllocs...>
- : public _OuterAlloc
-{
- typedef _OuterAlloc outer_allocator_type;
+class __scoped_allocator_storage<_OuterAlloc, _InnerAllocs...> : public _OuterAlloc {
+ typedef _OuterAlloc outer_allocator_type;
+
protected:
- typedef scoped_allocator_adaptor<_InnerAllocs...> inner_allocator_type;
+ typedef scoped_allocator_adaptor<_InnerAllocs...> inner_allocator_type;
private:
- inner_allocator_type __inner_;
+ inner_allocator_type __inner_;
protected:
-
- _LIBCPP_HIDE_FROM_ABI
- __scoped_allocator_storage() _NOEXCEPT {}
-
- template <class _OuterA2,
- __enable_if_t<is_constructible<outer_allocator_type, _OuterA2>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI
- __scoped_allocator_storage(_OuterA2&& __outer_alloc,
- const _InnerAllocs& ...__inner_allocs) _NOEXCEPT
- : outer_allocator_type(std::forward<_OuterA2>(__outer_alloc)),
- __inner_(__inner_allocs...) {}
-
- template <class _OuterA2,
- __enable_if_t<is_constructible<outer_allocator_type, const _OuterA2&>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI
- __scoped_allocator_storage(
- const __scoped_allocator_storage<_OuterA2, _InnerAllocs...>& __other) _NOEXCEPT
- : outer_allocator_type(__other.outer_allocator()),
- __inner_(__other.inner_allocator()) {}
-
- template <class _OuterA2,
- __enable_if_t<is_constructible<outer_allocator_type, _OuterA2>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI
- __scoped_allocator_storage(
- __scoped_allocator_storage<_OuterA2, _InnerAllocs...>&& __other) _NOEXCEPT
- : outer_allocator_type(std::move(__other.outer_allocator())),
- __inner_(std::move(__other.inner_allocator())) {}
-
- template <class _OuterA2,
- __enable_if_t<is_constructible<outer_allocator_type, _OuterA2>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI
- __scoped_allocator_storage(_OuterA2&& __o,
- const inner_allocator_type& __i) _NOEXCEPT
- : outer_allocator_type(std::forward<_OuterA2>(__o)),
- __inner_(__i)
- {
- }
-
- _LIBCPP_HIDE_FROM_ABI
- inner_allocator_type& inner_allocator() _NOEXCEPT {return __inner_;}
- _LIBCPP_HIDE_FROM_ABI
- const inner_allocator_type& inner_allocator() const _NOEXCEPT {return __inner_;}
-
- _LIBCPP_HIDE_FROM_ABI
- outer_allocator_type& outer_allocator() _NOEXCEPT
- {return static_cast<outer_allocator_type&>(*this);}
- _LIBCPP_HIDE_FROM_ABI
- const outer_allocator_type& outer_allocator() const _NOEXCEPT
- {return static_cast<const outer_allocator_type&>(*this);}
-
- scoped_allocator_adaptor<outer_allocator_type, _InnerAllocs...>
- _LIBCPP_HIDE_FROM_ABI
- select_on_container_copy_construction() const _NOEXCEPT
- {
- return scoped_allocator_adaptor<outer_allocator_type, _InnerAllocs...>
- (
- allocator_traits<outer_allocator_type>::
- select_on_container_copy_construction(outer_allocator()),
- allocator_traits<inner_allocator_type>::
- select_on_container_copy_construction(inner_allocator())
- );
- }
-
- template <class...> friend class __scoped_allocator_storage;
+ _LIBCPP_HIDE_FROM_ABI __scoped_allocator_storage() _NOEXCEPT {}
+
+ template <class _OuterA2, __enable_if_t<is_constructible<outer_allocator_type, _OuterA2>::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI
+ __scoped_allocator_storage(_OuterA2&& __outer_alloc, const _InnerAllocs&... __inner_allocs) _NOEXCEPT
+ : outer_allocator_type(std::forward<_OuterA2>(__outer_alloc)),
+ __inner_(__inner_allocs...) {}
+
+ template <class _OuterA2, __enable_if_t<is_constructible<outer_allocator_type, const _OuterA2&>::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI
+ __scoped_allocator_storage(const __scoped_allocator_storage<_OuterA2, _InnerAllocs...>& __other) _NOEXCEPT
+ : outer_allocator_type(__other.outer_allocator()),
+ __inner_(__other.inner_allocator()) {}
+
+ template <class _OuterA2, __enable_if_t<is_constructible<outer_allocator_type, _OuterA2>::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI
+ __scoped_allocator_storage(__scoped_allocator_storage<_OuterA2, _InnerAllocs...>&& __other) _NOEXCEPT
+ : outer_allocator_type(std::move(__other.outer_allocator())),
+ __inner_(std::move(__other.inner_allocator())) {}
+
+ template <class _OuterA2, __enable_if_t<is_constructible<outer_allocator_type, _OuterA2>::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI __scoped_allocator_storage(_OuterA2&& __o, const inner_allocator_type& __i) _NOEXCEPT
+ : outer_allocator_type(std::forward<_OuterA2>(__o)),
+ __inner_(__i) {}
+
+ _LIBCPP_HIDE_FROM_ABI inner_allocator_type& inner_allocator() _NOEXCEPT { return __inner_; }
+ _LIBCPP_HIDE_FROM_ABI const inner_allocator_type& inner_allocator() const _NOEXCEPT { return __inner_; }
+
+ _LIBCPP_HIDE_FROM_ABI outer_allocator_type& outer_allocator() _NOEXCEPT {
+ return static_cast<outer_allocator_type&>(*this);
+ }
+ _LIBCPP_HIDE_FROM_ABI const outer_allocator_type& outer_allocator() const _NOEXCEPT {
+ return static_cast<const outer_allocator_type&>(*this);
+ }
+
+ scoped_allocator_adaptor<outer_allocator_type, _InnerAllocs...> _LIBCPP_HIDE_FROM_ABI
+ select_on_container_copy_construction() const _NOEXCEPT {
+ return scoped_allocator_adaptor<outer_allocator_type, _InnerAllocs...>(
+ allocator_traits<outer_allocator_type>::select_on_container_copy_construction(outer_allocator()),
+ allocator_traits<inner_allocator_type>::select_on_container_copy_construction(inner_allocator()));
+ }
+
+ template <class...>
+ friend class __scoped_allocator_storage;
};
template <class _OuterAlloc>
-class __scoped_allocator_storage<_OuterAlloc>
- : public _OuterAlloc
-{
- typedef _OuterAlloc outer_allocator_type;
+class __scoped_allocator_storage<_OuterAlloc> : public _OuterAlloc {
+ typedef _OuterAlloc outer_allocator_type;
+
protected:
- typedef scoped_allocator_adaptor<_OuterAlloc> inner_allocator_type;
-
- _LIBCPP_HIDE_FROM_ABI
- __scoped_allocator_storage() _NOEXCEPT {}
-
- template <class _OuterA2,
- __enable_if_t<is_constructible<outer_allocator_type, _OuterA2>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI
- __scoped_allocator_storage(_OuterA2&& __outer_alloc) _NOEXCEPT
- : outer_allocator_type(std::forward<_OuterA2>(__outer_alloc)) {}
-
- template <class _OuterA2,
- __enable_if_t<is_constructible<outer_allocator_type, const _OuterA2&>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI
- __scoped_allocator_storage(
- const __scoped_allocator_storage<_OuterA2>& __other) _NOEXCEPT
- : outer_allocator_type(__other.outer_allocator()) {}
-
- template <class _OuterA2,
- __enable_if_t<is_constructible<outer_allocator_type, _OuterA2>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI
- __scoped_allocator_storage(
- __scoped_allocator_storage<_OuterA2>&& __other) _NOEXCEPT
- : outer_allocator_type(std::move(__other.outer_allocator())) {}
-
- _LIBCPP_HIDE_FROM_ABI
- inner_allocator_type& inner_allocator() _NOEXCEPT
- {return static_cast<inner_allocator_type&>(*this);}
- _LIBCPP_HIDE_FROM_ABI
- const inner_allocator_type& inner_allocator() const _NOEXCEPT
- {return static_cast<const inner_allocator_type&>(*this);}
-
- _LIBCPP_HIDE_FROM_ABI
- outer_allocator_type& outer_allocator() _NOEXCEPT
- {return static_cast<outer_allocator_type&>(*this);}
- _LIBCPP_HIDE_FROM_ABI
- const outer_allocator_type& outer_allocator() const _NOEXCEPT
- {return static_cast<const outer_allocator_type&>(*this);}
-
- _LIBCPP_HIDE_FROM_ABI
- scoped_allocator_adaptor<outer_allocator_type>
- select_on_container_copy_construction() const _NOEXCEPT
- {return scoped_allocator_adaptor<outer_allocator_type>(
- allocator_traits<outer_allocator_type>::
- select_on_container_copy_construction(outer_allocator())
- );}
-
- __scoped_allocator_storage(const outer_allocator_type& __o,
- const inner_allocator_type& __i) _NOEXCEPT;
-
- template <class...> friend class __scoped_allocator_storage;
+ typedef scoped_allocator_adaptor<_OuterAlloc> inner_allocator_type;
+
+ _LIBCPP_HIDE_FROM_ABI __scoped_allocator_storage() _NOEXCEPT {}
+
+ template <class _OuterA2, __enable_if_t<is_constructible<outer_allocator_type, _OuterA2>::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI __scoped_allocator_storage(_OuterA2&& __outer_alloc) _NOEXCEPT
+ : outer_allocator_type(std::forward<_OuterA2>(__outer_alloc)) {}
+
+ template <class _OuterA2, __enable_if_t<is_constructible<outer_allocator_type, const _OuterA2&>::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI __scoped_allocator_storage(const __scoped_allocator_storage<_OuterA2>& __other) _NOEXCEPT
+ : outer_allocator_type(__other.outer_allocator()) {}
+
+ template <class _OuterA2, __enable_if_t<is_constructible<outer_allocator_type, _OuterA2>::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI __scoped_allocator_storage(__scoped_allocator_storage<_OuterA2>&& __other) _NOEXCEPT
+ : outer_allocator_type(std::move(__other.outer_allocator())) {}
+
+ _LIBCPP_HIDE_FROM_ABI inner_allocator_type& inner_allocator() _NOEXCEPT {
+ return static_cast<inner_allocator_type&>(*this);
+ }
+ _LIBCPP_HIDE_FROM_ABI const inner_allocator_type& inner_allocator() const _NOEXCEPT {
+ return static_cast<const inner_allocator_type&>(*this);
+ }
+
+ _LIBCPP_HIDE_FROM_ABI outer_allocator_type& outer_allocator() _NOEXCEPT {
+ return static_cast<outer_allocator_type&>(*this);
+ }
+ _LIBCPP_HIDE_FROM_ABI const outer_allocator_type& outer_allocator() const _NOEXCEPT {
+ return static_cast<const outer_allocator_type&>(*this);
+ }
+
+ _LIBCPP_HIDE_FROM_ABI scoped_allocator_adaptor<outer_allocator_type>
+ select_on_container_copy_construction() const _NOEXCEPT {
+ return scoped_allocator_adaptor<outer_allocator_type>(
+ allocator_traits<outer_allocator_type>::select_on_container_copy_construction(outer_allocator()));
+ }
+
+ __scoped_allocator_storage(const outer_allocator_type& __o, const inner_allocator_type& __i) _NOEXCEPT;
+
+ template <class...>
+ friend class __scoped_allocator_storage;
};
// __outermost
template <class _Alloc>
-decltype(std::declval<_Alloc>().outer_allocator(), true_type())
-__has_outer_allocator_test(_Alloc&& __a);
+decltype(std::declval<_Alloc>().outer_allocator(), true_type()) __has_outer_allocator_test(_Alloc&& __a);
template <class _Alloc>
-false_type
-__has_outer_allocator_test(const volatile _Alloc& __a);
+false_type __has_outer_allocator_test(const volatile _Alloc& __a);
template <class _Alloc>
struct __has_outer_allocator
- : public common_type
- <
- decltype(std::__has_outer_allocator_test(std::declval<_Alloc&>()))
- >::type
-{
-};
+ : public common_type< decltype(std::__has_outer_allocator_test(std::declval<_Alloc&>())) >::type {};
template <class _Alloc, bool = __has_outer_allocator<_Alloc>::value>
-struct __outermost
-{
- typedef _Alloc type;
- _LIBCPP_HIDE_FROM_ABI
- type& operator()(type& __a) const _NOEXCEPT {return __a;}
+struct __outermost {
+ typedef _Alloc type;
+ _LIBCPP_HIDE_FROM_ABI type& operator()(type& __a) const _NOEXCEPT { return __a; }
};
template <class _Alloc>
-struct __outermost<_Alloc, true>
-{
- typedef __libcpp_remove_reference_t
- <
- decltype(std::declval<_Alloc>().outer_allocator())
- > _OuterAlloc;
- typedef typename __outermost<_OuterAlloc>::type type;
- _LIBCPP_HIDE_FROM_ABI
- type& operator()(_Alloc& __a) const _NOEXCEPT
- {return __outermost<_OuterAlloc>()(__a.outer_allocator());}
+struct __outermost<_Alloc, true> {
+ typedef __libcpp_remove_reference_t< decltype(std::declval<_Alloc>().outer_allocator()) > _OuterAlloc;
+ typedef typename __outermost<_OuterAlloc>::type type;
+ _LIBCPP_HIDE_FROM_ABI type& operator()(_Alloc& __a) const _NOEXCEPT {
+ return __outermost<_OuterAlloc>()(__a.outer_allocator());
+ }
};
template <class _OuterAlloc, class... _InnerAllocs>
class _LIBCPP_TEMPLATE_VIS scoped_allocator_adaptor<_OuterAlloc, _InnerAllocs...>
- : public __scoped_allocator_storage<_OuterAlloc, _InnerAllocs...>
-{
- typedef __scoped_allocator_storage<_OuterAlloc, _InnerAllocs...> base;
- typedef allocator_traits<_OuterAlloc> _OuterTraits;
-public:
- typedef _OuterAlloc outer_allocator_type;
- typedef typename base::inner_allocator_type inner_allocator_type;
- typedef typename _OuterTraits::size_type size_type;
- typedef typename _OuterTraits::difference_type difference_type;
- typedef typename _OuterTraits::pointer pointer;
- typedef typename _OuterTraits::const_pointer const_pointer;
- typedef typename _OuterTraits::void_pointer void_pointer;
- typedef typename _OuterTraits::const_void_pointer const_void_pointer;
-
- typedef integral_constant
- <
- bool,
- __get_poc_copy_assignment<outer_allocator_type,
- _InnerAllocs...>::value
- > propagate_on_container_copy_assignment;
- typedef integral_constant
- <
- bool,
- __get_poc_move_assignment<outer_allocator_type,
- _InnerAllocs...>::value
- > propagate_on_container_move_assignment;
- typedef integral_constant
- <
- bool,
- __get_poc_swap<outer_allocator_type, _InnerAllocs...>::value
- > propagate_on_container_swap;
- typedef integral_constant
- <
- bool,
- __get_is_always_equal<outer_allocator_type, _InnerAllocs...>::value
- > is_always_equal;
-
- template <class _Tp>
- struct rebind
- {
- typedef scoped_allocator_adaptor
- <
- typename _OuterTraits::template rebind_alloc<_Tp>, _InnerAllocs...
- > other;
- };
-
- _LIBCPP_HIDE_FROM_ABI
- scoped_allocator_adaptor() _NOEXCEPT {}
- template <class _OuterA2,
- __enable_if_t<is_constructible<outer_allocator_type, _OuterA2>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI
- scoped_allocator_adaptor(_OuterA2&& __outer_alloc,
- const _InnerAllocs& ...__inner_allocs) _NOEXCEPT
- : base(std::forward<_OuterA2>(__outer_alloc), __inner_allocs...) {}
- // scoped_allocator_adaptor(const scoped_allocator_adaptor& __other) = default;
- template <class _OuterA2,
- __enable_if_t<is_constructible<outer_allocator_type, const _OuterA2&>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI
- scoped_allocator_adaptor(
- const scoped_allocator_adaptor<_OuterA2, _InnerAllocs...>& __other) _NOEXCEPT
- : base(__other) {}
- template <class _OuterA2,
- __enable_if_t<is_constructible<outer_allocator_type, _OuterA2>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI
- scoped_allocator_adaptor(
- scoped_allocator_adaptor<_OuterA2, _InnerAllocs...>&& __other) _NOEXCEPT
- : base(std::move(__other)) {}
-
- // scoped_allocator_adaptor& operator=(const scoped_allocator_adaptor&) = default;
- // scoped_allocator_adaptor& operator=(scoped_allocator_adaptor&&) = default;
- // ~scoped_allocator_adaptor() = default;
-
- _LIBCPP_HIDE_FROM_ABI
- inner_allocator_type& inner_allocator() _NOEXCEPT
- {return base::inner_allocator();}
- _LIBCPP_HIDE_FROM_ABI
- const inner_allocator_type& inner_allocator() const _NOEXCEPT
- {return base::inner_allocator();}
-
- _LIBCPP_HIDE_FROM_ABI
- outer_allocator_type& outer_allocator() _NOEXCEPT
- {return base::outer_allocator();}
- _LIBCPP_HIDE_FROM_ABI
- const outer_allocator_type& outer_allocator() const _NOEXCEPT
- {return base::outer_allocator();}
-
- _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_HIDE_FROM_ABI
- pointer allocate(size_type __n)
- {return allocator_traits<outer_allocator_type>::
- allocate(outer_allocator(), __n);}
- _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_HIDE_FROM_ABI
- pointer allocate(size_type __n, const_void_pointer __hint)
- {return allocator_traits<outer_allocator_type>::
- allocate(outer_allocator(), __n, __hint);}
-
- _LIBCPP_HIDE_FROM_ABI
- void deallocate(pointer __p, size_type __n) _NOEXCEPT
- {allocator_traits<outer_allocator_type>::
- deallocate(outer_allocator(), __p, __n);}
-
- _LIBCPP_HIDE_FROM_ABI
- size_type max_size() const
- {return allocator_traits<outer_allocator_type>::max_size(outer_allocator());}
-
-#if _LIBCPP_STD_VER >= 20
- template <class _Type, class... _Args>
- _LIBCPP_HIDE_FROM_ABI void construct(_Type* __ptr, _Args&&... __args) {
- using _OM = __outermost<outer_allocator_type>;
- std::apply(
- [__ptr, this](auto&&... __newargs) {
- allocator_traits<typename _OM::type>::construct(
- _OM()(outer_allocator()), __ptr, std::forward<decltype(__newargs)>(__newargs)...);
- },
- std::uses_allocator_construction_args<_Type>(inner_allocator(), std::forward<_Args>(__args)...));
- }
-#else
- template <class _Tp, class... _Args>
- _LIBCPP_HIDE_FROM_ABI
- void construct(_Tp* __p, _Args&& ...__args)
- {__construct(__uses_alloc_ctor<_Tp, inner_allocator_type&, _Args...>(),
- __p, std::forward<_Args>(__args)...);}
-
- template <class _T1, class _T2, class... _Args1, class... _Args2>
- _LIBCPP_HIDE_FROM_ABI void construct(pair<_T1, _T2>* __p, piecewise_construct_t,
- tuple<_Args1...> __x, tuple<_Args2...> __y)
- {
- typedef __outermost<outer_allocator_type> _OM;
- allocator_traits<typename _OM::type>::construct(
- _OM()(outer_allocator()), __p, piecewise_construct
- , __transform_tuple(
- typename __uses_alloc_ctor<
- _T1, inner_allocator_type&, _Args1...
- >::type()
- , std::move(__x)
- , typename __make_tuple_indices<sizeof...(_Args1)>::type{}
- )
- , __transform_tuple(
- typename __uses_alloc_ctor<
- _T2, inner_allocator_type&, _Args2...
- >::type()
- , std::move(__y)
- , typename __make_tuple_indices<sizeof...(_Args2)>::type{}
- )
- );
- }
-
- template <class _T1, class _T2>
- _LIBCPP_HIDE_FROM_ABI void construct(pair<_T1, _T2>* __p)
- { construct(__p, piecewise_construct, tuple<>{}, tuple<>{}); }
-
- template <class _T1, class _T2, class _Up, class _Vp>
- _LIBCPP_HIDE_FROM_ABI void construct(pair<_T1, _T2>* __p, _Up&& __x, _Vp&& __y) {
- construct(__p, piecewise_construct,
- std::forward_as_tuple(std::forward<_Up>(__x)),
- std::forward_as_tuple(std::forward<_Vp>(__y)));
- }
-
- template <class _T1, class _T2, class _Up, class _Vp>
- _LIBCPP_HIDE_FROM_ABI void construct(pair<_T1, _T2>* __p, const pair<_Up, _Vp>& __x) {
- construct(__p, piecewise_construct,
- std::forward_as_tuple(__x.first),
- std::forward_as_tuple(__x.second));
- }
-
- template <class _T1, class _T2, class _Up, class _Vp>
- _LIBCPP_HIDE_FROM_ABI void construct(pair<_T1, _T2>* __p, pair<_Up, _Vp>&& __x) {
- construct(__p, piecewise_construct,
- std::forward_as_tuple(std::forward<_Up>(__x.first)),
- std::forward_as_tuple(std::forward<_Vp>(__x.second)));
- }
-#endif
+ : public __scoped_allocator_storage<_OuterAlloc, _InnerAllocs...> {
+ typedef __scoped_allocator_storage<_OuterAlloc, _InnerAllocs...> base;
+ typedef allocator_traits<_OuterAlloc> _OuterTraits;
- template <class _Tp>
- _LIBCPP_HIDE_FROM_ABI
- void destroy(_Tp* __p)
- {
- typedef __outermost<outer_allocator_type> _OM;
- allocator_traits<typename _OM::type>::
- destroy(_OM()(outer_allocator()), __p);
- }
-
- _LIBCPP_HIDE_FROM_ABI
- scoped_allocator_adaptor select_on_container_copy_construction() const _NOEXCEPT
- {return base::select_on_container_copy_construction();}
+public:
+ typedef _OuterAlloc outer_allocator_type;
+ typedef typename base::inner_allocator_type inner_allocator_type;
+ typedef typename _OuterTraits::size_type size_type;
+ typedef typename _OuterTraits::difference_type difference_type;
+ typedef typename _OuterTraits::pointer pointer;
+ typedef typename _OuterTraits::const_pointer const_pointer;
+ typedef typename _OuterTraits::void_pointer void_pointer;
+ typedef typename _OuterTraits::const_void_pointer const_void_pointer;
+
+ typedef integral_constant< bool, __get_poc_copy_assignment<outer_allocator_type, _InnerAllocs...>::value >
+ propagate_on_container_copy_assignment;
+ typedef integral_constant< bool, __get_poc_move_assignment<outer_allocator_type, _InnerAllocs...>::value >
+ propagate_on_container_move_assignment;
+ typedef integral_constant< bool, __get_poc_swap<outer_allocator_type, _InnerAllocs...>::value >
+ propagate_on_container_swap;
+ typedef integral_constant< bool, __get_is_always_equal<outer_allocator_type, _InnerAllocs...>::value >
+ is_always_equal;
+
+ template <class _Tp>
+ struct rebind {
+ typedef scoped_allocator_adaptor< typename _OuterTraits::template rebind_alloc<_Tp>, _InnerAllocs... > other;
+ };
+
+ _LIBCPP_HIDE_FROM_ABI scoped_allocator_adaptor() _NOEXCEPT {}
+ template <class _OuterA2, __enable_if_t<is_constructible<outer_allocator_type, _OuterA2>::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI
+ scoped_allocator_adaptor(_OuterA2&& __outer_alloc, const _InnerAllocs&... __inner_allocs) _NOEXCEPT
+ : base(std::forward<_OuterA2>(__outer_alloc), __inner_allocs...) {}
+ // scoped_allocator_adaptor(const scoped_allocator_adaptor& __other) = default;
+ template <class _OuterA2, __enable_if_t<is_constructible<outer_allocator_type, const _OuterA2&>::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI
+ scoped_allocator_adaptor(const scoped_allocator_adaptor<_OuterA2, _InnerAllocs...>& __other) _NOEXCEPT
+ : base(__other) {}
+ template <class _OuterA2, __enable_if_t<is_constructible<outer_allocator_type, _OuterA2>::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI
+ scoped_allocator_adaptor(scoped_allocator_adaptor<_OuterA2, _InnerAllocs...>&& __other) _NOEXCEPT
+ : base(std::move(__other)) {}
+
+ // scoped_allocator_adaptor& operator=(const scoped_allocator_adaptor&) = default;
+ // scoped_allocator_adaptor& operator=(scoped_allocator_adaptor&&) = default;
+ // ~scoped_allocator_adaptor() = default;
+
+ _LIBCPP_HIDE_FROM_ABI inner_allocator_type& inner_allocator() _NOEXCEPT { return base::inner_allocator(); }
+ _LIBCPP_HIDE_FROM_ABI const inner_allocator_type& inner_allocator() const _NOEXCEPT {
+ return base::inner_allocator();
+ }
+
+ _LIBCPP_HIDE_FROM_ABI outer_allocator_type& outer_allocator() _NOEXCEPT { return base::outer_allocator(); }
+ _LIBCPP_HIDE_FROM_ABI const outer_allocator_type& outer_allocator() const _NOEXCEPT {
+ return base::outer_allocator();
+ }
+
+ _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_HIDE_FROM_ABI pointer allocate(size_type __n) {
+ return allocator_traits<outer_allocator_type>::allocate(outer_allocator(), __n);
+ }
+ _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_HIDE_FROM_ABI pointer allocate(size_type __n, const_void_pointer __hint) {
+ return allocator_traits<outer_allocator_type>::allocate(outer_allocator(), __n, __hint);
+ }
+
+ _LIBCPP_HIDE_FROM_ABI void deallocate(pointer __p, size_type __n) _NOEXCEPT {
+ allocator_traits<outer_allocator_type>::deallocate(outer_allocator(), __p, __n);
+ }
+
+ _LIBCPP_HIDE_FROM_ABI size_type max_size() const {
+ return allocator_traits<outer_allocator_type>::max_size(outer_allocator());
+ }
+
+# if _LIBCPP_STD_VER >= 20
+ template <class _Type, class... _Args>
+ _LIBCPP_HIDE_FROM_ABI void construct(_Type* __ptr, _Args&&... __args) {
+ using _OM = __outermost<outer_allocator_type>;
+ std::apply(
+ [__ptr, this](auto&&... __newargs) {
+ allocator_traits<typename _OM::type>::construct(
+ _OM()(outer_allocator()), __ptr, std::forward<decltype(__newargs)>(__newargs)...);
+ },
+ std::uses_allocator_construction_args<_Type>(inner_allocator(), std::forward<_Args>(__args)...));
+ }
+# else
+ template <class _Tp, class... _Args>
+ _LIBCPP_HIDE_FROM_ABI void construct(_Tp* __p, _Args&&... __args) {
+ __construct(__uses_alloc_ctor<_Tp, inner_allocator_type&, _Args...>(), __p, std::forward<_Args>(__args)...);
+ }
+
+ template <class _T1, class _T2, class... _Args1, class... _Args2>
+ _LIBCPP_HIDE_FROM_ABI void
+ construct(pair<_T1, _T2>* __p, piecewise_construct_t, tuple<_Args1...> __x, tuple<_Args2...> __y) {
+ typedef __outermost<outer_allocator_type> _OM;
+ allocator_traits<typename _OM::type>::construct(
+ _OM()(outer_allocator()),
+ __p,
+ piecewise_construct,
+ __transform_tuple(typename __uses_alloc_ctor< _T1, inner_allocator_type&, _Args1... >::type(),
+ std::move(__x),
+ typename __make_tuple_indices<sizeof...(_Args1)>::type{}),
+ __transform_tuple(typename __uses_alloc_ctor< _T2, inner_allocator_type&, _Args2... >::type(),
+ std::move(__y),
+ typename __make_tuple_indices<sizeof...(_Args2)>::type{}));
+ }
+
+ template <class _T1, class _T2>
+ _LIBCPP_HIDE_FROM_ABI void construct(pair<_T1, _T2>* __p) {
+ construct(__p, piecewise_construct, tuple<>{}, tuple<>{});
+ }
+
+ template <class _T1, class _T2, class _Up, class _Vp>
+ _LIBCPP_HIDE_FROM_ABI void construct(pair<_T1, _T2>* __p, _Up&& __x, _Vp&& __y) {
+ construct(__p,
+ piecewise_construct,
+ std::forward_as_tuple(std::forward<_Up>(__x)),
+ std::forward_as_tuple(std::forward<_Vp>(__y)));
+ }
+
+ template <class _T1, class _T2, class _Up, class _Vp>
+ _LIBCPP_HIDE_FROM_ABI void construct(pair<_T1, _T2>* __p, const pair<_Up, _Vp>& __x) {
+ construct(__p, piecewise_construct, std::forward_as_tuple(__x.first), std::forward_as_tuple(__x.second));
+ }
+
+ template <class _T1, class _T2, class _Up, class _Vp>
+ _LIBCPP_HIDE_FROM_ABI void construct(pair<_T1, _T2>* __p, pair<_Up, _Vp>&& __x) {
+ construct(__p,
+ piecewise_construct,
+ std::forward_as_tuple(std::forward<_Up>(__x.first)),
+ std::forward_as_tuple(std::forward<_Vp>(__x.second)));
+ }
+# endif
+
+ template <class _Tp>
+ _LIBCPP_HIDE_FROM_ABI void destroy(_Tp* __p) {
+ typedef __outermost<outer_allocator_type> _OM;
+ allocator_traits<typename _OM::type>::destroy(_OM()(outer_allocator()), __p);
+ }
+
+ _LIBCPP_HIDE_FROM_ABI scoped_allocator_adaptor select_on_container_copy_construction() const _NOEXCEPT {
+ return base::select_on_container_copy_construction();
+ }
private:
-
-
- template <class _OuterA2,
- __enable_if_t<is_constructible<outer_allocator_type, _OuterA2>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI
- scoped_allocator_adaptor(_OuterA2&& __o,
- const inner_allocator_type& __i) _NOEXCEPT
- : base(std::forward<_OuterA2>(__o), __i) {}
-
- template <class _Tp, class... _Args>
- _LIBCPP_HIDE_FROM_ABI
- void __construct(integral_constant<int, 0>, _Tp* __p, _Args&& ...__args)
- {
- typedef __outermost<outer_allocator_type> _OM;
- allocator_traits<typename _OM::type>::construct
- (
- _OM()(outer_allocator()),
- __p,
- std::forward<_Args>(__args)...
- );
- }
-
- template <class _Tp, class... _Args>
- _LIBCPP_HIDE_FROM_ABI
- void __construct(integral_constant<int, 1>, _Tp* __p, _Args&& ...__args)
- {
- typedef __outermost<outer_allocator_type> _OM;
- allocator_traits<typename _OM::type>::construct
- (
- _OM()(outer_allocator()),
- __p, allocator_arg, inner_allocator(),
- std::forward<_Args>(__args)...
- );
- }
-
- template <class _Tp, class... _Args>
- _LIBCPP_HIDE_FROM_ABI
- void __construct(integral_constant<int, 2>, _Tp* __p, _Args&& ...__args)
- {
- typedef __outermost<outer_allocator_type> _OM;
- allocator_traits<typename _OM::type>::construct
- (
- _OM()(outer_allocator()),
- __p,
- std::forward<_Args>(__args)...,
- inner_allocator()
- );
- }
-
- template <class ..._Args, size_t ..._Idx>
- _LIBCPP_HIDE_FROM_ABI
- tuple<_Args&&...>
- __transform_tuple(integral_constant<int, 0>, tuple<_Args...>&& __t,
- __tuple_indices<_Idx...>)
- {
- return std::forward_as_tuple(std::get<_Idx>(std::move(__t))...);
- }
-
- template <class ..._Args, size_t ..._Idx>
- _LIBCPP_HIDE_FROM_ABI
- tuple<allocator_arg_t, inner_allocator_type&, _Args&&...>
- __transform_tuple(integral_constant<int, 1>, tuple<_Args...> && __t,
- __tuple_indices<_Idx...>)
- {
- using _Tup = tuple<allocator_arg_t, inner_allocator_type&, _Args&&...>;
- return _Tup(allocator_arg, inner_allocator(),
- std::get<_Idx>(std::move(__t))...);
- }
-
- template <class ..._Args, size_t ..._Idx>
- _LIBCPP_HIDE_FROM_ABI
- tuple<_Args&&..., inner_allocator_type&>
- __transform_tuple(integral_constant<int, 2>, tuple<_Args...> && __t,
- __tuple_indices<_Idx...>)
- {
- using _Tup = tuple<_Args&&..., inner_allocator_type&>;
- return _Tup(std::get<_Idx>(std::move(__t))..., inner_allocator());
- }
-
- template <class...> friend class __scoped_allocator_storage;
+ template <class _OuterA2, __enable_if_t<is_constructible<outer_allocator_type, _OuterA2>::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI scoped_allocator_adaptor(_OuterA2&& __o, const inner_allocator_type& __i) _NOEXCEPT
+ : base(std::forward<_OuterA2>(__o), __i) {}
+
+ template <class _Tp, class... _Args>
+ _LIBCPP_HIDE_FROM_ABI void __construct(integral_constant<int, 0>, _Tp* __p, _Args&&... __args) {
+ typedef __outermost<outer_allocator_type> _OM;
+ allocator_traits<typename _OM::type>::construct(_OM()(outer_allocator()), __p, std::forward<_Args>(__args)...);
+ }
+
+ template <class _Tp, class... _Args>
+ _LIBCPP_HIDE_FROM_ABI void __construct(integral_constant<int, 1>, _Tp* __p, _Args&&... __args) {
+ typedef __outermost<outer_allocator_type> _OM;
+ allocator_traits<typename _OM::type>::construct(
+ _OM()(outer_allocator()), __p, allocator_arg, inner_allocator(), std::forward<_Args>(__args)...);
+ }
+
+ template <class _Tp, class... _Args>
+ _LIBCPP_HIDE_FROM_ABI void __construct(integral_constant<int, 2>, _Tp* __p, _Args&&... __args) {
+ typedef __outermost<outer_allocator_type> _OM;
+ allocator_traits<typename _OM::type>::construct(
+ _OM()(outer_allocator()), __p, std::forward<_Args>(__args)..., inner_allocator());
+ }
+
+ template <class... _Args, size_t... _Idx>
+ _LIBCPP_HIDE_FROM_ABI tuple<_Args&&...>
+ __transform_tuple(integral_constant<int, 0>, tuple<_Args...>&& __t, __tuple_indices<_Idx...>) {
+ return std::forward_as_tuple(std::get<_Idx>(std::move(__t))...);
+ }
+
+ template <class... _Args, size_t... _Idx>
+ _LIBCPP_HIDE_FROM_ABI tuple<allocator_arg_t, inner_allocator_type&, _Args&&...>
+ __transform_tuple(integral_constant<int, 1>, tuple<_Args...>&& __t, __tuple_indices<_Idx...>) {
+ using _Tup = tuple<allocator_arg_t, inner_allocator_type&, _Args&&...>;
+ return _Tup(allocator_arg, inner_allocator(), std::get<_Idx>(std::move(__t))...);
+ }
+
+ template <class... _Args, size_t... _Idx>
+ _LIBCPP_HIDE_FROM_ABI tuple<_Args&&..., inner_allocator_type&>
+ __transform_tuple(integral_constant<int, 2>, tuple<_Args...>&& __t, __tuple_indices<_Idx...>) {
+ using _Tup = tuple<_Args&&..., inner_allocator_type&>;
+ return _Tup(std::get<_Idx>(std::move(__t))..., inner_allocator());
+ }
+
+ template <class...>
+ friend class __scoped_allocator_storage;
};
-#if _LIBCPP_STD_VER >= 17
-template<class _OuterAlloc, class... _InnerAllocs>
- scoped_allocator_adaptor(_OuterAlloc, _InnerAllocs...)
- -> scoped_allocator_adaptor<_OuterAlloc, _InnerAllocs...>;
-#endif
+# if _LIBCPP_STD_VER >= 17
+template <class _OuterAlloc, class... _InnerAllocs>
+scoped_allocator_adaptor(_OuterAlloc, _InnerAllocs...) -> scoped_allocator_adaptor<_OuterAlloc, _InnerAllocs...>;
+# endif
template <class _OuterA1, class _OuterA2>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator==(const scoped_allocator_adaptor<_OuterA1>& __a,
- const scoped_allocator_adaptor<_OuterA2>& __b) _NOEXCEPT
-{
- return __a.outer_allocator() == __b.outer_allocator();
+inline _LIBCPP_HIDE_FROM_ABI bool
+operator==(const scoped_allocator_adaptor<_OuterA1>& __a, const scoped_allocator_adaptor<_OuterA2>& __b) _NOEXCEPT {
+ return __a.outer_allocator() == __b.outer_allocator();
}
template <class _OuterA1, class _OuterA2, class _InnerA0, class... _InnerAllocs>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
+inline _LIBCPP_HIDE_FROM_ABI bool
operator==(const scoped_allocator_adaptor<_OuterA1, _InnerA0, _InnerAllocs...>& __a,
- const scoped_allocator_adaptor<_OuterA2, _InnerA0, _InnerAllocs...>& __b) _NOEXCEPT
-{
- return __a.outer_allocator() == __b.outer_allocator() &&
- __a.inner_allocator() == __b.inner_allocator();
+ const scoped_allocator_adaptor<_OuterA2, _InnerA0, _InnerAllocs...>& __b) _NOEXCEPT {
+ return __a.outer_allocator() == __b.outer_allocator() && __a.inner_allocator() == __b.inner_allocator();
}
-#if _LIBCPP_STD_VER <= 17
+# if _LIBCPP_STD_VER <= 17
template <class _OuterA1, class _OuterA2, class... _InnerAllocs>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator!=(const scoped_allocator_adaptor<_OuterA1, _InnerAllocs...>& __a,
- const scoped_allocator_adaptor<_OuterA2, _InnerAllocs...>& __b) _NOEXCEPT
-{
- return !(__a == __b);
+inline _LIBCPP_HIDE_FROM_ABI bool operator!=(const scoped_allocator_adaptor<_OuterA1, _InnerAllocs...>& __a,
+ const scoped_allocator_adaptor<_OuterA2, _InnerAllocs...>& __b) _NOEXCEPT {
+ return !(__a == __b);
}
-#endif // _LIBCPP_STD_VER <= 17
+# endif // _LIBCPP_STD_VER <= 17
#endif // !defined(_LIBCPP_CXX03_LANG)
diff --git a/contrib/llvm-project/libcxx/include/semaphore b/contrib/llvm-project/libcxx/include/semaphore
index 81f3cd2a7945..de45b8b5db10 100644
--- a/contrib/llvm-project/libcxx/include/semaphore
+++ b/contrib/llvm-project/libcxx/include/semaphore
@@ -64,7 +64,7 @@ using binary_semaphore = counting_semaphore<1>;
#endif
#ifdef _LIBCPP_HAS_NO_THREADS
-# error "<semaphore> is not supported since libc++ has been configured without support for threads."
+# error "<semaphore> is not supported since libc++ has been configured without support for threads."
#endif
_LIBCPP_PUSH_MACROS
@@ -82,124 +82,95 @@ functions. It avoids contention against users' own use of those facilities.
*/
-#define _LIBCPP_SEMAPHORE_MAX (numeric_limits<ptrdiff_t>::max())
+# define _LIBCPP_SEMAPHORE_MAX (numeric_limits<ptrdiff_t>::max())
-class __atomic_semaphore_base
-{
- __atomic_base<ptrdiff_t> __a_;
+class __atomic_semaphore_base {
+ __atomic_base<ptrdiff_t> __a_;
public:
- _LIBCPP_HIDE_FROM_ABI
- constexpr explicit __atomic_semaphore_base(ptrdiff_t __count) : __a_(__count)
- {
- }
- _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI
- void release(ptrdiff_t __update = 1)
- {
- auto __old = __a_.fetch_add(__update, memory_order_release);
- _LIBCPP_ASSERT_UNCATEGORIZED(__update <= _LIBCPP_SEMAPHORE_MAX - __old, "update is greater than the expected value");
-
- if (__old > 0)
- {
- // Nothing to do
- }
- else if (__update > 1)
- __a_.notify_all();
- else
- __a_.notify_one();
- }
- _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI
- void acquire()
- {
- auto const __test_fn = [this]() -> bool {
- auto __old = __a_.load(memory_order_relaxed);
- return (__old != 0) && __a_.compare_exchange_strong(__old, __old - 1, memory_order_acquire, memory_order_relaxed);
- };
- __cxx_atomic_wait(&__a_.__a_, __test_fn);
- }
- template <class _Rep, class _Period>
- _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI
- bool try_acquire_for(chrono::duration<_Rep, _Period> const& __rel_time)
- {
- if (__rel_time == chrono::duration<_Rep, _Period>::zero())
- return try_acquire();
- auto const __test_fn = [this]() { return try_acquire(); };
- return std::__libcpp_thread_poll_with_backoff(__test_fn, __libcpp_timed_backoff_policy(), __rel_time);
- }
- _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI
- bool try_acquire()
- {
- auto __old = __a_.load(memory_order_acquire);
- while (true) {
- if (__old == 0)
- return false;
- if (__a_.compare_exchange_strong(__old, __old - 1, memory_order_acquire, memory_order_relaxed))
- return true;
- }
+ _LIBCPP_HIDE_FROM_ABI constexpr explicit __atomic_semaphore_base(ptrdiff_t __count) : __a_(__count) {}
+ _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI void release(ptrdiff_t __update = 1) {
+ auto __old = __a_.fetch_add(__update, memory_order_release);
+ _LIBCPP_ASSERT_UNCATEGORIZED(
+ __update <= _LIBCPP_SEMAPHORE_MAX - __old, "update is greater than the expected value");
+
+ if (__old > 0) {
+ // Nothing to do
+ } else if (__update > 1)
+ __a_.notify_all();
+ else
+ __a_.notify_one();
+ }
+ _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI void acquire() {
+ auto const __test_fn = [this]() -> bool {
+ auto __old = __a_.load(memory_order_relaxed);
+ return (__old != 0) && __a_.compare_exchange_strong(__old, __old - 1, memory_order_acquire, memory_order_relaxed);
+ };
+ __cxx_atomic_wait(&__a_.__a_, __test_fn);
+ }
+ template <class _Rep, class _Period>
+ _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI bool
+ try_acquire_for(chrono::duration<_Rep, _Period> const& __rel_time) {
+ if (__rel_time == chrono::duration<_Rep, _Period>::zero())
+ return try_acquire();
+ auto const __test_fn = [this]() { return try_acquire(); };
+ return std::__libcpp_thread_poll_with_backoff(__test_fn, __libcpp_timed_backoff_policy(), __rel_time);
+ }
+ _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI bool try_acquire() {
+ auto __old = __a_.load(memory_order_acquire);
+ while (true) {
+ if (__old == 0)
+ return false;
+ if (__a_.compare_exchange_strong(__old, __old - 1, memory_order_acquire, memory_order_relaxed))
+ return true;
}
+ }
};
-template<ptrdiff_t __least_max_value = _LIBCPP_SEMAPHORE_MAX>
-class counting_semaphore
-{
- __atomic_semaphore_base __semaphore_;
+template <ptrdiff_t __least_max_value = _LIBCPP_SEMAPHORE_MAX>
+class counting_semaphore {
+ __atomic_semaphore_base __semaphore_;
public:
- static_assert(__least_max_value >= 0, "The least maximum value must be a positive number");
-
- static constexpr ptrdiff_t max() noexcept {
- return __least_max_value;
- }
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr explicit counting_semaphore(ptrdiff_t __count) : __semaphore_(__count)
- {
- _LIBCPP_ASSERT_UNCATEGORIZED(
- __count >= 0,
- "counting_semaphore::counting_semaphore(ptrdiff_t): counting_semaphore cannot be "
- "initialized with a negative value");
- _LIBCPP_ASSERT_UNCATEGORIZED(
- __count <= max(),
- "counting_semaphore::counting_semaphore(ptrdiff_t): counting_semaphore cannot be "
- "initialized with a value greater than max()");
- }
- ~counting_semaphore() = default;
-
- counting_semaphore(const counting_semaphore&) = delete;
- counting_semaphore& operator=(const counting_semaphore&) = delete;
-
- _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI
- void release(ptrdiff_t __update = 1)
- {
- _LIBCPP_ASSERT_UNCATEGORIZED(__update >= 0, "counting_semaphore:release called with a negative value");
- __semaphore_.release(__update);
- }
- _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI
- void acquire()
- {
- __semaphore_.acquire();
- }
- template<class _Rep, class _Period>
- _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI
- bool try_acquire_for(chrono::duration<_Rep, _Period> const& __rel_time)
- {
- return __semaphore_.try_acquire_for(chrono::duration_cast<chrono::nanoseconds>(__rel_time));
- }
- _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI
- bool try_acquire()
- {
- return __semaphore_.try_acquire();
- }
- template <class _Clock, class _Duration>
- _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI
- bool try_acquire_until(chrono::time_point<_Clock, _Duration> const& __abs_time)
- {
- auto const __current = _Clock::now();
- if (__current >= __abs_time)
- return try_acquire();
- else
- return try_acquire_for(__abs_time - __current);
- }
+ static_assert(__least_max_value >= 0, "The least maximum value must be a positive number");
+
+ static constexpr ptrdiff_t max() noexcept { return __least_max_value; }
+
+ _LIBCPP_HIDE_FROM_ABI constexpr explicit counting_semaphore(ptrdiff_t __count) : __semaphore_(__count) {
+ _LIBCPP_ASSERT_UNCATEGORIZED(
+ __count >= 0,
+ "counting_semaphore::counting_semaphore(ptrdiff_t): counting_semaphore cannot be "
+ "initialized with a negative value");
+ _LIBCPP_ASSERT_UNCATEGORIZED(
+ __count <= max(),
+ "counting_semaphore::counting_semaphore(ptrdiff_t): counting_semaphore cannot be "
+ "initialized with a value greater than max()");
+ }
+ ~counting_semaphore() = default;
+
+ counting_semaphore(const counting_semaphore&) = delete;
+ counting_semaphore& operator=(const counting_semaphore&) = delete;
+
+ _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI void release(ptrdiff_t __update = 1) {
+ _LIBCPP_ASSERT_UNCATEGORIZED(__update >= 0, "counting_semaphore:release called with a negative value");
+ __semaphore_.release(__update);
+ }
+ _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI void acquire() { __semaphore_.acquire(); }
+ template <class _Rep, class _Period>
+ _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI bool
+ try_acquire_for(chrono::duration<_Rep, _Period> const& __rel_time) {
+ return __semaphore_.try_acquire_for(chrono::duration_cast<chrono::nanoseconds>(__rel_time));
+ }
+ _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI bool try_acquire() { return __semaphore_.try_acquire(); }
+ template <class _Clock, class _Duration>
+ _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI bool
+ try_acquire_until(chrono::time_point<_Clock, _Duration> const& __abs_time) {
+ auto const __current = _Clock::now();
+ if (__current >= __abs_time)
+ return try_acquire();
+ else
+ return try_acquire_for(__abs_time - __current);
+ }
};
using binary_semaphore = counting_semaphore<1>;
diff --git a/contrib/llvm-project/libcxx/include/set b/contrib/llvm-project/libcxx/include/set
index b2d87b93f38d..08677a94054f 100644
--- a/contrib/llvm-project/libcxx/include/set
+++ b/contrib/llvm-project/libcxx/include/set
@@ -557,567 +557,435 @@ _LIBCPP_BEGIN_NAMESPACE_STD
template <class _Key, class _Compare, class _Allocator>
class multiset;
-template <class _Key, class _Compare = less<_Key>,
- class _Allocator = allocator<_Key> >
-class _LIBCPP_TEMPLATE_VIS set
-{
+template <class _Key, class _Compare = less<_Key>, class _Allocator = allocator<_Key> >
+class _LIBCPP_TEMPLATE_VIS set {
public:
- // types:
- typedef _Key key_type;
- typedef key_type value_type;
- typedef __type_identity_t<_Compare> key_compare;
- typedef key_compare value_compare;
- typedef __type_identity_t<_Allocator> allocator_type;
- typedef value_type& reference;
- typedef const value_type& const_reference;
-
- static_assert((is_same<typename allocator_type::value_type, value_type>::value),
- "Allocator::value_type must be same type as value_type");
+ // types:
+ typedef _Key key_type;
+ typedef key_type value_type;
+ typedef __type_identity_t<_Compare> key_compare;
+ typedef key_compare value_compare;
+ typedef __type_identity_t<_Allocator> allocator_type;
+ typedef value_type& reference;
+ typedef const value_type& const_reference;
+
+ static_assert((is_same<typename allocator_type::value_type, value_type>::value),
+ "Allocator::value_type must be same type as value_type");
private:
- typedef __tree<value_type, value_compare, allocator_type> __base;
- typedef allocator_traits<allocator_type> __alloc_traits;
+ typedef __tree<value_type, value_compare, allocator_type> __base;
+ typedef allocator_traits<allocator_type> __alloc_traits;
- static_assert(is_same<allocator_type, __rebind_alloc<__alloc_traits, value_type> >::value,
- "[allocator.requirements] states that rebinding an allocator to the same type should result in the "
- "original allocator");
+ static_assert(is_same<allocator_type, __rebind_alloc<__alloc_traits, value_type> >::value,
+ "[allocator.requirements] states that rebinding an allocator to the same type should result in the "
+ "original allocator");
- __base __tree_;
+ __base __tree_;
public:
- typedef typename __base::pointer pointer;
- typedef typename __base::const_pointer const_pointer;
- typedef typename __base::size_type size_type;
- typedef typename __base::difference_type difference_type;
- typedef typename __base::const_iterator iterator;
- typedef typename __base::const_iterator const_iterator;
- typedef std::reverse_iterator<iterator> reverse_iterator;
- typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
+ typedef typename __base::pointer pointer;
+ typedef typename __base::const_pointer const_pointer;
+ typedef typename __base::size_type size_type;
+ typedef typename __base::difference_type difference_type;
+ typedef typename __base::const_iterator iterator;
+ typedef typename __base::const_iterator const_iterator;
+ typedef std::reverse_iterator<iterator> reverse_iterator;
+ typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
#if _LIBCPP_STD_VER >= 17
- typedef __set_node_handle<typename __base::__node, allocator_type> node_type;
- typedef __insert_return_type<iterator, node_type> insert_return_type;
+ typedef __set_node_handle<typename __base::__node, allocator_type> node_type;
+ typedef __insert_return_type<iterator, node_type> insert_return_type;
#endif
- template <class _Key2, class _Compare2, class _Alloc2>
- friend class _LIBCPP_TEMPLATE_VIS set;
- template <class _Key2, class _Compare2, class _Alloc2>
- friend class _LIBCPP_TEMPLATE_VIS multiset;
-
- _LIBCPP_HIDE_FROM_ABI
- set()
- _NOEXCEPT_(
- is_nothrow_default_constructible<allocator_type>::value &&
- is_nothrow_default_constructible<key_compare>::value &&
- is_nothrow_copy_constructible<key_compare>::value)
- : __tree_(value_compare()) {}
-
- _LIBCPP_HIDE_FROM_ABI
- explicit set(const value_compare& __comp)
- _NOEXCEPT_(
- is_nothrow_default_constructible<allocator_type>::value &&
- is_nothrow_copy_constructible<key_compare>::value)
- : __tree_(__comp) {}
-
- _LIBCPP_HIDE_FROM_ABI
- explicit set(const value_compare& __comp, const allocator_type& __a)
- : __tree_(__comp, __a) {}
- template <class _InputIterator>
- _LIBCPP_HIDE_FROM_ABI
- set(_InputIterator __f, _InputIterator __l,
- const value_compare& __comp = value_compare())
- : __tree_(__comp)
- {
- insert(__f, __l);
- }
-
- template <class _InputIterator>
- _LIBCPP_HIDE_FROM_ABI
- set(_InputIterator __f, _InputIterator __l, const value_compare& __comp,
- const allocator_type& __a)
- : __tree_(__comp, __a)
- {
- insert(__f, __l);
- }
+ template <class _Key2, class _Compare2, class _Alloc2>
+ friend class _LIBCPP_TEMPLATE_VIS set;
+ template <class _Key2, class _Compare2, class _Alloc2>
+ friend class _LIBCPP_TEMPLATE_VIS multiset;
+
+ _LIBCPP_HIDE_FROM_ABI set() _NOEXCEPT_(
+ is_nothrow_default_constructible<allocator_type>::value&& is_nothrow_default_constructible<key_compare>::value&&
+ is_nothrow_copy_constructible<key_compare>::value)
+ : __tree_(value_compare()) {}
+
+ _LIBCPP_HIDE_FROM_ABI explicit set(const value_compare& __comp) _NOEXCEPT_(
+ is_nothrow_default_constructible<allocator_type>::value&& is_nothrow_copy_constructible<key_compare>::value)
+ : __tree_(__comp) {}
+
+ _LIBCPP_HIDE_FROM_ABI explicit set(const value_compare& __comp, const allocator_type& __a) : __tree_(__comp, __a) {}
+ template <class _InputIterator>
+ _LIBCPP_HIDE_FROM_ABI set(_InputIterator __f, _InputIterator __l, const value_compare& __comp = value_compare())
+ : __tree_(__comp) {
+ insert(__f, __l);
+ }
+
+ template <class _InputIterator>
+ _LIBCPP_HIDE_FROM_ABI
+ set(_InputIterator __f, _InputIterator __l, const value_compare& __comp, const allocator_type& __a)
+ : __tree_(__comp, __a) {
+ insert(__f, __l);
+ }
#if _LIBCPP_STD_VER >= 23
- template <_ContainerCompatibleRange<value_type> _Range>
- _LIBCPP_HIDE_FROM_ABI
- set(from_range_t, _Range&& __range, const key_compare& __comp = key_compare(),
- const allocator_type& __a = allocator_type())
+ template <_ContainerCompatibleRange<value_type> _Range>
+ _LIBCPP_HIDE_FROM_ABI
+ set(from_range_t,
+ _Range&& __range,
+ const key_compare& __comp = key_compare(),
+ const allocator_type& __a = allocator_type())
: __tree_(__comp, __a) {
- insert_range(std::forward<_Range>(__range));
- }
+ insert_range(std::forward<_Range>(__range));
+ }
#endif
#if _LIBCPP_STD_VER >= 14
- template <class _InputIterator>
- _LIBCPP_HIDE_FROM_ABI
- set(_InputIterator __f, _InputIterator __l, const allocator_type& __a)
- : set(__f, __l, key_compare(), __a) {}
+ template <class _InputIterator>
+ _LIBCPP_HIDE_FROM_ABI set(_InputIterator __f, _InputIterator __l, const allocator_type& __a)
+ : set(__f, __l, key_compare(), __a) {}
#endif
#if _LIBCPP_STD_VER >= 23
- template <_ContainerCompatibleRange<value_type> _Range>
- _LIBCPP_HIDE_FROM_ABI
- set(from_range_t, _Range&& __range, const allocator_type& __a)
+ template <_ContainerCompatibleRange<value_type> _Range>
+ _LIBCPP_HIDE_FROM_ABI set(from_range_t, _Range&& __range, const allocator_type& __a)
: set(from_range, std::forward<_Range>(__range), key_compare(), __a) {}
#endif
- _LIBCPP_HIDE_FROM_ABI
- set(const set& __s)
- : __tree_(__s.__tree_)
- {
- insert(__s.begin(), __s.end());
- }
+ _LIBCPP_HIDE_FROM_ABI set(const set& __s) : __tree_(__s.__tree_) { insert(__s.begin(), __s.end()); }
- _LIBCPP_HIDE_FROM_ABI
- set& operator=(const set& __s)
- {
- __tree_ = __s.__tree_;
- return *this;
- }
+ _LIBCPP_HIDE_FROM_ABI set& operator=(const set& __s) {
+ __tree_ = __s.__tree_;
+ return *this;
+ }
#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI
- set(set&& __s)
- _NOEXCEPT_(is_nothrow_move_constructible<__base>::value)
- : __tree_(std::move(__s.__tree_)) {}
+ _LIBCPP_HIDE_FROM_ABI set(set&& __s) _NOEXCEPT_(is_nothrow_move_constructible<__base>::value)
+ : __tree_(std::move(__s.__tree_)) {}
#endif // _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI
- explicit set(const allocator_type& __a)
- : __tree_(__a) {}
+ _LIBCPP_HIDE_FROM_ABI explicit set(const allocator_type& __a) : __tree_(__a) {}
- _LIBCPP_HIDE_FROM_ABI
- set(const set& __s, const allocator_type& __a)
- : __tree_(__s.__tree_.value_comp(), __a)
- {
- insert(__s.begin(), __s.end());
- }
+ _LIBCPP_HIDE_FROM_ABI set(const set& __s, const allocator_type& __a) : __tree_(__s.__tree_.value_comp(), __a) {
+ insert(__s.begin(), __s.end());
+ }
#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI set(set&& __s, const allocator_type& __a);
-
- _LIBCPP_HIDE_FROM_ABI
- set(initializer_list<value_type> __il, const value_compare& __comp = value_compare())
- : __tree_(__comp)
- {
- insert(__il.begin(), __il.end());
- }
-
- _LIBCPP_HIDE_FROM_ABI
- set(initializer_list<value_type> __il, const value_compare& __comp,
- const allocator_type& __a)
- : __tree_(__comp, __a)
- {
- insert(__il.begin(), __il.end());
- }
+ _LIBCPP_HIDE_FROM_ABI set(set&& __s, const allocator_type& __a);
-#if _LIBCPP_STD_VER >= 14
- _LIBCPP_HIDE_FROM_ABI
- set(initializer_list<value_type> __il, const allocator_type& __a)
- : set(__il, key_compare(), __a) {}
-#endif
+ _LIBCPP_HIDE_FROM_ABI set(initializer_list<value_type> __il, const value_compare& __comp = value_compare())
+ : __tree_(__comp) {
+ insert(__il.begin(), __il.end());
+ }
- _LIBCPP_HIDE_FROM_ABI
- set& operator=(initializer_list<value_type> __il)
- {
- __tree_.__assign_unique(__il.begin(), __il.end());
- return *this;
- }
-
- _LIBCPP_HIDE_FROM_ABI
- set& operator=(set&& __s)
- _NOEXCEPT_(is_nothrow_move_assignable<__base>::value)
- {
- __tree_ = std::move(__s.__tree_);
- return *this;
- }
+ _LIBCPP_HIDE_FROM_ABI set(initializer_list<value_type> __il, const value_compare& __comp, const allocator_type& __a)
+ : __tree_(__comp, __a) {
+ insert(__il.begin(), __il.end());
+ }
+
+# if _LIBCPP_STD_VER >= 14
+ _LIBCPP_HIDE_FROM_ABI set(initializer_list<value_type> __il, const allocator_type& __a)
+ : set(__il, key_compare(), __a) {}
+# endif
+
+ _LIBCPP_HIDE_FROM_ABI set& operator=(initializer_list<value_type> __il) {
+ __tree_.__assign_unique(__il.begin(), __il.end());
+ return *this;
+ }
+
+ _LIBCPP_HIDE_FROM_ABI set& operator=(set&& __s) _NOEXCEPT_(is_nothrow_move_assignable<__base>::value) {
+ __tree_ = std::move(__s.__tree_);
+ return *this;
+ }
#endif // _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI
- ~set() {
- static_assert(sizeof(__diagnose_non_const_comparator<_Key, _Compare>()), "");
- }
+ _LIBCPP_HIDE_FROM_ABI ~set() { static_assert(sizeof(__diagnose_non_const_comparator<_Key, _Compare>()), ""); }
- _LIBCPP_HIDE_FROM_ABI
- iterator begin() _NOEXCEPT {return __tree_.begin();}
- _LIBCPP_HIDE_FROM_ABI
- const_iterator begin() const _NOEXCEPT {return __tree_.begin();}
- _LIBCPP_HIDE_FROM_ABI
- iterator end() _NOEXCEPT {return __tree_.end();}
- _LIBCPP_HIDE_FROM_ABI
- const_iterator end() const _NOEXCEPT {return __tree_.end();}
-
- _LIBCPP_HIDE_FROM_ABI
- reverse_iterator rbegin() _NOEXCEPT
- {return reverse_iterator(end());}
- _LIBCPP_HIDE_FROM_ABI
- const_reverse_iterator rbegin() const _NOEXCEPT
- {return const_reverse_iterator(end());}
- _LIBCPP_HIDE_FROM_ABI
- reverse_iterator rend() _NOEXCEPT
- {return reverse_iterator(begin());}
- _LIBCPP_HIDE_FROM_ABI
- const_reverse_iterator rend() const _NOEXCEPT
- {return const_reverse_iterator(begin());}
-
- _LIBCPP_HIDE_FROM_ABI
- const_iterator cbegin() const _NOEXCEPT {return begin();}
- _LIBCPP_HIDE_FROM_ABI
- const_iterator cend() const _NOEXCEPT {return end();}
- _LIBCPP_HIDE_FROM_ABI
- const_reverse_iterator crbegin() const _NOEXCEPT {return rbegin();}
- _LIBCPP_HIDE_FROM_ABI
- const_reverse_iterator crend() const _NOEXCEPT {return rend();}
-
- _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_HIDE_FROM_ABI
- bool empty() const _NOEXCEPT {return __tree_.size() == 0;}
- _LIBCPP_HIDE_FROM_ABI
- size_type size() const _NOEXCEPT {return __tree_.size();}
- _LIBCPP_HIDE_FROM_ABI
- size_type max_size() const _NOEXCEPT {return __tree_.max_size();}
+ _LIBCPP_HIDE_FROM_ABI iterator begin() _NOEXCEPT { return __tree_.begin(); }
+ _LIBCPP_HIDE_FROM_ABI const_iterator begin() const _NOEXCEPT { return __tree_.begin(); }
+ _LIBCPP_HIDE_FROM_ABI iterator end() _NOEXCEPT { return __tree_.end(); }
+ _LIBCPP_HIDE_FROM_ABI const_iterator end() const _NOEXCEPT { return __tree_.end(); }
- // modifiers:
+ _LIBCPP_HIDE_FROM_ABI reverse_iterator rbegin() _NOEXCEPT { return reverse_iterator(end()); }
+ _LIBCPP_HIDE_FROM_ABI const_reverse_iterator rbegin() const _NOEXCEPT { return const_reverse_iterator(end()); }
+ _LIBCPP_HIDE_FROM_ABI reverse_iterator rend() _NOEXCEPT { return reverse_iterator(begin()); }
+ _LIBCPP_HIDE_FROM_ABI const_reverse_iterator rend() const _NOEXCEPT { return const_reverse_iterator(begin()); }
+
+ _LIBCPP_HIDE_FROM_ABI const_iterator cbegin() const _NOEXCEPT { return begin(); }
+ _LIBCPP_HIDE_FROM_ABI const_iterator cend() const _NOEXCEPT { return end(); }
+ _LIBCPP_HIDE_FROM_ABI const_reverse_iterator crbegin() const _NOEXCEPT { return rbegin(); }
+ _LIBCPP_HIDE_FROM_ABI const_reverse_iterator crend() const _NOEXCEPT { return rend(); }
+
+ _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_HIDE_FROM_ABI bool empty() const _NOEXCEPT { return __tree_.size() == 0; }
+ _LIBCPP_HIDE_FROM_ABI size_type size() const _NOEXCEPT { return __tree_.size(); }
+ _LIBCPP_HIDE_FROM_ABI size_type max_size() const _NOEXCEPT { return __tree_.max_size(); }
+
+ // modifiers:
#ifndef _LIBCPP_CXX03_LANG
- template <class... _Args>
- _LIBCPP_HIDE_FROM_ABI
- pair<iterator, bool> emplace(_Args&&... __args)
- {return __tree_.__emplace_unique(std::forward<_Args>(__args)...);}
- template <class... _Args>
- _LIBCPP_HIDE_FROM_ABI
- iterator emplace_hint(const_iterator __p, _Args&&... __args)
- {return __tree_.__emplace_hint_unique(__p, std::forward<_Args>(__args)...);}
+ template <class... _Args>
+ _LIBCPP_HIDE_FROM_ABI pair<iterator, bool> emplace(_Args&&... __args) {
+ return __tree_.__emplace_unique(std::forward<_Args>(__args)...);
+ }
+ template <class... _Args>
+ _LIBCPP_HIDE_FROM_ABI iterator emplace_hint(const_iterator __p, _Args&&... __args) {
+ return __tree_.__emplace_hint_unique(__p, std::forward<_Args>(__args)...);
+ }
#endif // _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI
- pair<iterator,bool> insert(const value_type& __v)
- {return __tree_.__insert_unique(__v);}
- _LIBCPP_HIDE_FROM_ABI
- iterator insert(const_iterator __p, const value_type& __v)
- {return __tree_.__insert_unique(__p, __v);}
-
- template <class _InputIterator>
- _LIBCPP_HIDE_FROM_ABI
- void insert(_InputIterator __f, _InputIterator __l)
- {
- for (const_iterator __e = cend(); __f != __l; ++__f)
- __tree_.__insert_unique(__e, *__f);
- }
+ _LIBCPP_HIDE_FROM_ABI pair<iterator, bool> insert(const value_type& __v) { return __tree_.__insert_unique(__v); }
+ _LIBCPP_HIDE_FROM_ABI iterator insert(const_iterator __p, const value_type& __v) {
+ return __tree_.__insert_unique(__p, __v);
+ }
+
+ template <class _InputIterator>
+ _LIBCPP_HIDE_FROM_ABI void insert(_InputIterator __f, _InputIterator __l) {
+ for (const_iterator __e = cend(); __f != __l; ++__f)
+ __tree_.__insert_unique(__e, *__f);
+ }
#if _LIBCPP_STD_VER >= 23
- template <_ContainerCompatibleRange<value_type> _Range>
- _LIBCPP_HIDE_FROM_ABI
- void insert_range(_Range&& __range) {
- const_iterator __end = cend();
- for (auto&& __element : __range) {
- __tree_.__insert_unique(__end, std::forward<decltype(__element)>(__element));
- }
+ template <_ContainerCompatibleRange<value_type> _Range>
+ _LIBCPP_HIDE_FROM_ABI void insert_range(_Range&& __range) {
+ const_iterator __end = cend();
+ for (auto&& __element : __range) {
+ __tree_.__insert_unique(__end, std::forward<decltype(__element)>(__element));
}
+ }
#endif
#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI
- pair<iterator,bool> insert(value_type&& __v)
- {return __tree_.__insert_unique(std::move(__v));}
+ _LIBCPP_HIDE_FROM_ABI pair<iterator, bool> insert(value_type&& __v) {
+ return __tree_.__insert_unique(std::move(__v));
+ }
- _LIBCPP_HIDE_FROM_ABI
- iterator insert(const_iterator __p, value_type&& __v)
- {return __tree_.__insert_unique(__p, std::move(__v));}
+ _LIBCPP_HIDE_FROM_ABI iterator insert(const_iterator __p, value_type&& __v) {
+ return __tree_.__insert_unique(__p, std::move(__v));
+ }
- _LIBCPP_HIDE_FROM_ABI
- void insert(initializer_list<value_type> __il)
- {insert(__il.begin(), __il.end());}
+ _LIBCPP_HIDE_FROM_ABI void insert(initializer_list<value_type> __il) { insert(__il.begin(), __il.end()); }
#endif // _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI
- iterator erase(const_iterator __p) {return __tree_.erase(__p);}
- _LIBCPP_HIDE_FROM_ABI
- size_type erase(const key_type& __k)
- {return __tree_.__erase_unique(__k);}
- _LIBCPP_HIDE_FROM_ABI
- iterator erase(const_iterator __f, const_iterator __l)
- {return __tree_.erase(__f, __l);}
- _LIBCPP_HIDE_FROM_ABI
- void clear() _NOEXCEPT {__tree_.clear();}
+ _LIBCPP_HIDE_FROM_ABI iterator erase(const_iterator __p) { return __tree_.erase(__p); }
+ _LIBCPP_HIDE_FROM_ABI size_type erase(const key_type& __k) { return __tree_.__erase_unique(__k); }
+ _LIBCPP_HIDE_FROM_ABI iterator erase(const_iterator __f, const_iterator __l) { return __tree_.erase(__f, __l); }
+ _LIBCPP_HIDE_FROM_ABI void clear() _NOEXCEPT { __tree_.clear(); }
#if _LIBCPP_STD_VER >= 17
- _LIBCPP_HIDE_FROM_ABI
- insert_return_type insert(node_type&& __nh)
- {
- _LIBCPP_ASSERT_UNCATEGORIZED(__nh.empty() || __nh.get_allocator() == get_allocator(),
- "node_type with incompatible allocator passed to set::insert()");
- return __tree_.template __node_handle_insert_unique<
- node_type, insert_return_type>(std::move(__nh));
- }
- _LIBCPP_HIDE_FROM_ABI
- iterator insert(const_iterator __hint, node_type&& __nh)
- {
- _LIBCPP_ASSERT_UNCATEGORIZED(__nh.empty() || __nh.get_allocator() == get_allocator(),
- "node_type with incompatible allocator passed to set::insert()");
- return __tree_.template __node_handle_insert_unique<node_type>(
- __hint, std::move(__nh));
- }
- _LIBCPP_HIDE_FROM_ABI
- node_type extract(key_type const& __key)
- {
- return __tree_.template __node_handle_extract<node_type>(__key);
- }
- _LIBCPP_HIDE_FROM_ABI
- node_type extract(const_iterator __it)
- {
- return __tree_.template __node_handle_extract<node_type>(__it);
- }
- template <class _Compare2>
- _LIBCPP_HIDE_FROM_ABI
- void merge(set<key_type, _Compare2, allocator_type>& __source)
- {
- _LIBCPP_ASSERT_UNCATEGORIZED(__source.get_allocator() == get_allocator(),
- "merging container with incompatible allocator");
- __tree_.__node_handle_merge_unique(__source.__tree_);
- }
- template <class _Compare2>
- _LIBCPP_HIDE_FROM_ABI
- void merge(set<key_type, _Compare2, allocator_type>&& __source)
- {
- _LIBCPP_ASSERT_UNCATEGORIZED(__source.get_allocator() == get_allocator(),
- "merging container with incompatible allocator");
- __tree_.__node_handle_merge_unique(__source.__tree_);
- }
- template <class _Compare2>
- _LIBCPP_HIDE_FROM_ABI
- void merge(multiset<key_type, _Compare2, allocator_type>& __source)
- {
- _LIBCPP_ASSERT_UNCATEGORIZED(__source.get_allocator() == get_allocator(),
- "merging container with incompatible allocator");
- __tree_.__node_handle_merge_unique(__source.__tree_);
- }
- template <class _Compare2>
- _LIBCPP_HIDE_FROM_ABI
- void merge(multiset<key_type, _Compare2, allocator_type>&& __source)
- {
- _LIBCPP_ASSERT_UNCATEGORIZED(__source.get_allocator() == get_allocator(),
- "merging container with incompatible allocator");
- __tree_.__node_handle_merge_unique(__source.__tree_);
- }
+ _LIBCPP_HIDE_FROM_ABI insert_return_type insert(node_type&& __nh) {
+ _LIBCPP_ASSERT_UNCATEGORIZED(__nh.empty() || __nh.get_allocator() == get_allocator(),
+ "node_type with incompatible allocator passed to set::insert()");
+ return __tree_.template __node_handle_insert_unique< node_type, insert_return_type>(std::move(__nh));
+ }
+ _LIBCPP_HIDE_FROM_ABI iterator insert(const_iterator __hint, node_type&& __nh) {
+ _LIBCPP_ASSERT_UNCATEGORIZED(__nh.empty() || __nh.get_allocator() == get_allocator(),
+ "node_type with incompatible allocator passed to set::insert()");
+ return __tree_.template __node_handle_insert_unique<node_type>(__hint, std::move(__nh));
+ }
+ _LIBCPP_HIDE_FROM_ABI node_type extract(key_type const& __key) {
+ return __tree_.template __node_handle_extract<node_type>(__key);
+ }
+ _LIBCPP_HIDE_FROM_ABI node_type extract(const_iterator __it) {
+ return __tree_.template __node_handle_extract<node_type>(__it);
+ }
+ template <class _Compare2>
+ _LIBCPP_HIDE_FROM_ABI void merge(set<key_type, _Compare2, allocator_type>& __source) {
+ _LIBCPP_ASSERT_UNCATEGORIZED(
+ __source.get_allocator() == get_allocator(), "merging container with incompatible allocator");
+ __tree_.__node_handle_merge_unique(__source.__tree_);
+ }
+ template <class _Compare2>
+ _LIBCPP_HIDE_FROM_ABI void merge(set<key_type, _Compare2, allocator_type>&& __source) {
+ _LIBCPP_ASSERT_UNCATEGORIZED(
+ __source.get_allocator() == get_allocator(), "merging container with incompatible allocator");
+ __tree_.__node_handle_merge_unique(__source.__tree_);
+ }
+ template <class _Compare2>
+ _LIBCPP_HIDE_FROM_ABI void merge(multiset<key_type, _Compare2, allocator_type>& __source) {
+ _LIBCPP_ASSERT_UNCATEGORIZED(
+ __source.get_allocator() == get_allocator(), "merging container with incompatible allocator");
+ __tree_.__node_handle_merge_unique(__source.__tree_);
+ }
+ template <class _Compare2>
+ _LIBCPP_HIDE_FROM_ABI void merge(multiset<key_type, _Compare2, allocator_type>&& __source) {
+ _LIBCPP_ASSERT_UNCATEGORIZED(
+ __source.get_allocator() == get_allocator(), "merging container with incompatible allocator");
+ __tree_.__node_handle_merge_unique(__source.__tree_);
+ }
#endif
- _LIBCPP_HIDE_FROM_ABI
- void swap(set& __s) _NOEXCEPT_(__is_nothrow_swappable<__base>::value)
- {__tree_.swap(__s.__tree_);}
+ _LIBCPP_HIDE_FROM_ABI void swap(set& __s) _NOEXCEPT_(__is_nothrow_swappable<__base>::value) {
+ __tree_.swap(__s.__tree_);
+ }
- _LIBCPP_HIDE_FROM_ABI
- allocator_type get_allocator() const _NOEXCEPT {return __tree_.__alloc();}
- _LIBCPP_HIDE_FROM_ABI
- key_compare key_comp() const {return __tree_.value_comp();}
- _LIBCPP_HIDE_FROM_ABI
- value_compare value_comp() const {return __tree_.value_comp();}
+ _LIBCPP_HIDE_FROM_ABI allocator_type get_allocator() const _NOEXCEPT { return __tree_.__alloc(); }
+ _LIBCPP_HIDE_FROM_ABI key_compare key_comp() const { return __tree_.value_comp(); }
+ _LIBCPP_HIDE_FROM_ABI value_compare value_comp() const { return __tree_.value_comp(); }
- // set operations:
- _LIBCPP_HIDE_FROM_ABI
- iterator find(const key_type& __k) {return __tree_.find(__k);}
- _LIBCPP_HIDE_FROM_ABI
- const_iterator find(const key_type& __k) const {return __tree_.find(__k);}
+ // set operations:
+ _LIBCPP_HIDE_FROM_ABI iterator find(const key_type& __k) { return __tree_.find(__k); }
+ _LIBCPP_HIDE_FROM_ABI const_iterator find(const key_type& __k) const { return __tree_.find(__k); }
#if _LIBCPP_STD_VER >= 14
- template <typename _K2, enable_if_t<__is_transparent<_Compare, _K2>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI
- iterator
- find(const _K2& __k) {return __tree_.find(__k);}
- template <typename _K2, enable_if_t<__is_transparent<_Compare, _K2>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI
- const_iterator
- find(const _K2& __k) const {return __tree_.find(__k);}
+ template <typename _K2, enable_if_t<__is_transparent<_Compare, _K2>::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI iterator find(const _K2& __k) {
+ return __tree_.find(__k);
+ }
+ template <typename _K2, enable_if_t<__is_transparent<_Compare, _K2>::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI const_iterator find(const _K2& __k) const {
+ return __tree_.find(__k);
+ }
#endif
- _LIBCPP_HIDE_FROM_ABI
- size_type count(const key_type& __k) const
- {return __tree_.__count_unique(__k);}
+ _LIBCPP_HIDE_FROM_ABI size_type count(const key_type& __k) const { return __tree_.__count_unique(__k); }
#if _LIBCPP_STD_VER >= 14
- template <typename _K2, enable_if_t<__is_transparent<_Compare, _K2>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI
- size_type
- count(const _K2& __k) const {return __tree_.__count_multi(__k);}
+ template <typename _K2, enable_if_t<__is_transparent<_Compare, _K2>::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI size_type count(const _K2& __k) const {
+ return __tree_.__count_multi(__k);
+ }
#endif
#if _LIBCPP_STD_VER >= 20
- _LIBCPP_HIDE_FROM_ABI
- bool contains(const key_type& __k) const {return find(__k) != end();}
- template <typename _K2, enable_if_t<__is_transparent<_Compare, _K2>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI
- bool
- contains(const _K2& __k) const { return find(__k) != end(); }
+ _LIBCPP_HIDE_FROM_ABI bool contains(const key_type& __k) const { return find(__k) != end(); }
+ template <typename _K2, enable_if_t<__is_transparent<_Compare, _K2>::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI bool contains(const _K2& __k) const {
+ return find(__k) != end();
+ }
#endif // _LIBCPP_STD_VER >= 20
- _LIBCPP_HIDE_FROM_ABI
- iterator lower_bound(const key_type& __k)
- {return __tree_.lower_bound(__k);}
- _LIBCPP_HIDE_FROM_ABI
- const_iterator lower_bound(const key_type& __k) const
- {return __tree_.lower_bound(__k);}
+ _LIBCPP_HIDE_FROM_ABI iterator lower_bound(const key_type& __k) { return __tree_.lower_bound(__k); }
+ _LIBCPP_HIDE_FROM_ABI const_iterator lower_bound(const key_type& __k) const { return __tree_.lower_bound(__k); }
#if _LIBCPP_STD_VER >= 14
- template <typename _K2, enable_if_t<__is_transparent<_Compare, _K2>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI
- iterator
- lower_bound(const _K2& __k) {return __tree_.lower_bound(__k);}
-
- template <typename _K2, enable_if_t<__is_transparent<_Compare, _K2>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI
- const_iterator
- lower_bound(const _K2& __k) const {return __tree_.lower_bound(__k);}
+ template <typename _K2, enable_if_t<__is_transparent<_Compare, _K2>::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI iterator lower_bound(const _K2& __k) {
+ return __tree_.lower_bound(__k);
+ }
+
+ template <typename _K2, enable_if_t<__is_transparent<_Compare, _K2>::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI const_iterator lower_bound(const _K2& __k) const {
+ return __tree_.lower_bound(__k);
+ }
#endif
- _LIBCPP_HIDE_FROM_ABI
- iterator upper_bound(const key_type& __k)
- {return __tree_.upper_bound(__k);}
- _LIBCPP_HIDE_FROM_ABI
- const_iterator upper_bound(const key_type& __k) const
- {return __tree_.upper_bound(__k);}
+ _LIBCPP_HIDE_FROM_ABI iterator upper_bound(const key_type& __k) { return __tree_.upper_bound(__k); }
+ _LIBCPP_HIDE_FROM_ABI const_iterator upper_bound(const key_type& __k) const { return __tree_.upper_bound(__k); }
#if _LIBCPP_STD_VER >= 14
- template <typename _K2, enable_if_t<__is_transparent<_Compare, _K2>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI
- iterator
- upper_bound(const _K2& __k) {return __tree_.upper_bound(__k);}
- template <typename _K2, enable_if_t<__is_transparent<_Compare, _K2>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI
- const_iterator
- upper_bound(const _K2& __k) const {return __tree_.upper_bound(__k);}
+ template <typename _K2, enable_if_t<__is_transparent<_Compare, _K2>::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI iterator upper_bound(const _K2& __k) {
+ return __tree_.upper_bound(__k);
+ }
+ template <typename _K2, enable_if_t<__is_transparent<_Compare, _K2>::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI const_iterator upper_bound(const _K2& __k) const {
+ return __tree_.upper_bound(__k);
+ }
#endif
- _LIBCPP_HIDE_FROM_ABI
- pair<iterator,iterator> equal_range(const key_type& __k)
- {return __tree_.__equal_range_unique(__k);}
- _LIBCPP_HIDE_FROM_ABI
- pair<const_iterator,const_iterator> equal_range(const key_type& __k) const
- {return __tree_.__equal_range_unique(__k);}
+ _LIBCPP_HIDE_FROM_ABI pair<iterator, iterator> equal_range(const key_type& __k) {
+ return __tree_.__equal_range_unique(__k);
+ }
+ _LIBCPP_HIDE_FROM_ABI pair<const_iterator, const_iterator> equal_range(const key_type& __k) const {
+ return __tree_.__equal_range_unique(__k);
+ }
#if _LIBCPP_STD_VER >= 14
- template <typename _K2, enable_if_t<__is_transparent<_Compare, _K2>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI
- pair<iterator,iterator>
- equal_range(const _K2& __k) {return __tree_.__equal_range_multi(__k);}
- template <typename _K2, enable_if_t<__is_transparent<_Compare, _K2>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI
- pair<const_iterator,const_iterator>
- equal_range(const _K2& __k) const {return __tree_.__equal_range_multi(__k);}
+ template <typename _K2, enable_if_t<__is_transparent<_Compare, _K2>::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI pair<iterator, iterator> equal_range(const _K2& __k) {
+ return __tree_.__equal_range_multi(__k);
+ }
+ template <typename _K2, enable_if_t<__is_transparent<_Compare, _K2>::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI pair<const_iterator, const_iterator> equal_range(const _K2& __k) const {
+ return __tree_.__equal_range_multi(__k);
+ }
#endif
};
#if _LIBCPP_STD_VER >= 17
-template<class _InputIterator,
- class _Compare = less<__iter_value_type<_InputIterator>>,
- class _Allocator = allocator<__iter_value_type<_InputIterator>>,
- class = enable_if_t<__has_input_iterator_category<_InputIterator>::value, void>,
- class = enable_if_t<__is_allocator<_Allocator>::value, void>,
- class = enable_if_t<!__is_allocator<_Compare>::value, void>>
+template <class _InputIterator,
+ class _Compare = less<__iter_value_type<_InputIterator>>,
+ class _Allocator = allocator<__iter_value_type<_InputIterator>>,
+ class = enable_if_t<__has_input_iterator_category<_InputIterator>::value, void>,
+ class = enable_if_t<__is_allocator<_Allocator>::value, void>,
+ class = enable_if_t<!__is_allocator<_Compare>::value, void>>
set(_InputIterator, _InputIterator, _Compare = _Compare(), _Allocator = _Allocator())
- -> set<__iter_value_type<_InputIterator>, _Compare, _Allocator>;
+ -> set<__iter_value_type<_InputIterator>, _Compare, _Allocator>;
-#if _LIBCPP_STD_VER >= 23
-template <ranges::input_range _Range, class _Compare = less<ranges::range_value_t<_Range>>,
+# if _LIBCPP_STD_VER >= 23
+template <ranges::input_range _Range,
+ class _Compare = less<ranges::range_value_t<_Range>>,
class _Allocator = allocator<ranges::range_value_t<_Range>>,
- class = enable_if_t<__is_allocator<_Allocator>::value, void>,
- class = enable_if_t<!__is_allocator<_Compare>::value, void>>
+ class = enable_if_t<__is_allocator<_Allocator>::value, void>,
+ class = enable_if_t<!__is_allocator<_Compare>::value, void>>
set(from_range_t, _Range&&, _Compare = _Compare(), _Allocator = _Allocator())
- -> set<ranges::range_value_t<_Range>, _Compare, _Allocator>;
-#endif
-
-template<class _Key, class _Compare = less<_Key>,
- class _Allocator = allocator<_Key>,
- class = enable_if_t<!__is_allocator<_Compare>::value, void>,
- class = enable_if_t<__is_allocator<_Allocator>::value, void>>
-set(initializer_list<_Key>, _Compare = _Compare(), _Allocator = _Allocator())
- -> set<_Key, _Compare, _Allocator>;
-
-template<class _InputIterator, class _Allocator,
- class = enable_if_t<__has_input_iterator_category<_InputIterator>::value, void>,
- class = enable_if_t<__is_allocator<_Allocator>::value, void>>
+ -> set<ranges::range_value_t<_Range>, _Compare, _Allocator>;
+# endif
+
+template <class _Key,
+ class _Compare = less<_Key>,
+ class _Allocator = allocator<_Key>,
+ class = enable_if_t<!__is_allocator<_Compare>::value, void>,
+ class = enable_if_t<__is_allocator<_Allocator>::value, void>>
+set(initializer_list<_Key>, _Compare = _Compare(), _Allocator = _Allocator()) -> set<_Key, _Compare, _Allocator>;
+
+template <class _InputIterator,
+ class _Allocator,
+ class = enable_if_t<__has_input_iterator_category<_InputIterator>::value, void>,
+ class = enable_if_t<__is_allocator<_Allocator>::value, void>>
set(_InputIterator, _InputIterator, _Allocator)
- -> set<__iter_value_type<_InputIterator>,
- less<__iter_value_type<_InputIterator>>, _Allocator>;
+ -> set<__iter_value_type<_InputIterator>, less<__iter_value_type<_InputIterator>>, _Allocator>;
-#if _LIBCPP_STD_VER >= 23
-template <ranges::input_range _Range, class _Allocator,
- class = enable_if_t<__is_allocator<_Allocator>::value, void>>
+# if _LIBCPP_STD_VER >= 23
+template <ranges::input_range _Range, class _Allocator, class = enable_if_t<__is_allocator<_Allocator>::value, void>>
set(from_range_t, _Range&&, _Allocator)
- -> set<ranges::range_value_t<_Range>, less<ranges::range_value_t<_Range>>, _Allocator>;
-#endif
+ -> set<ranges::range_value_t<_Range>, less<ranges::range_value_t<_Range>>, _Allocator>;
+# endif
-template<class _Key, class _Allocator,
- class = enable_if_t<__is_allocator<_Allocator>::value, void>>
-set(initializer_list<_Key>, _Allocator)
- -> set<_Key, less<_Key>, _Allocator>;
+template <class _Key, class _Allocator, class = enable_if_t<__is_allocator<_Allocator>::value, void>>
+set(initializer_list<_Key>, _Allocator) -> set<_Key, less<_Key>, _Allocator>;
#endif
#ifndef _LIBCPP_CXX03_LANG
template <class _Key, class _Compare, class _Allocator>
-set<_Key, _Compare, _Allocator>::set(set&& __s, const allocator_type& __a)
- : __tree_(std::move(__s.__tree_), __a)
-{
- if (__a != __s.get_allocator())
- {
- const_iterator __e = cend();
- while (!__s.empty())
- insert(__e, std::move(__s.__tree_.remove(__s.begin())->__value_));
- }
+set<_Key, _Compare, _Allocator>::set(set&& __s, const allocator_type& __a) : __tree_(std::move(__s.__tree_), __a) {
+ if (__a != __s.get_allocator()) {
+ const_iterator __e = cend();
+ while (!__s.empty())
+ insert(__e, std::move(__s.__tree_.remove(__s.begin())->__value_));
+ }
}
#endif // _LIBCPP_CXX03_LANG
template <class _Key, class _Compare, class _Allocator>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator==(const set<_Key, _Compare, _Allocator>& __x,
- const set<_Key, _Compare, _Allocator>& __y)
-{
- return __x.size() == __y.size() && std::equal(__x.begin(), __x.end(), __y.begin());
+inline _LIBCPP_HIDE_FROM_ABI bool
+operator==(const set<_Key, _Compare, _Allocator>& __x, const set<_Key, _Compare, _Allocator>& __y) {
+ return __x.size() == __y.size() && std::equal(__x.begin(), __x.end(), __y.begin());
}
#if _LIBCPP_STD_VER <= 17
template <class _Key, class _Compare, class _Allocator>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator< (const set<_Key, _Compare, _Allocator>& __x,
- const set<_Key, _Compare, _Allocator>& __y)
-{
- return std::lexicographical_compare(__x.begin(), __x.end(), __y.begin(), __y.end());
+inline _LIBCPP_HIDE_FROM_ABI bool
+operator<(const set<_Key, _Compare, _Allocator>& __x, const set<_Key, _Compare, _Allocator>& __y) {
+ return std::lexicographical_compare(__x.begin(), __x.end(), __y.begin(), __y.end());
}
template <class _Key, class _Compare, class _Allocator>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator!=(const set<_Key, _Compare, _Allocator>& __x,
- const set<_Key, _Compare, _Allocator>& __y)
-{
- return !(__x == __y);
+inline _LIBCPP_HIDE_FROM_ABI bool
+operator!=(const set<_Key, _Compare, _Allocator>& __x, const set<_Key, _Compare, _Allocator>& __y) {
+ return !(__x == __y);
}
template <class _Key, class _Compare, class _Allocator>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator> (const set<_Key, _Compare, _Allocator>& __x,
- const set<_Key, _Compare, _Allocator>& __y)
-{
- return __y < __x;
+inline _LIBCPP_HIDE_FROM_ABI bool
+operator>(const set<_Key, _Compare, _Allocator>& __x, const set<_Key, _Compare, _Allocator>& __y) {
+ return __y < __x;
}
template <class _Key, class _Compare, class _Allocator>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator>=(const set<_Key, _Compare, _Allocator>& __x,
- const set<_Key, _Compare, _Allocator>& __y)
-{
- return !(__x < __y);
+inline _LIBCPP_HIDE_FROM_ABI bool
+operator>=(const set<_Key, _Compare, _Allocator>& __x, const set<_Key, _Compare, _Allocator>& __y) {
+ return !(__x < __y);
}
template <class _Key, class _Compare, class _Allocator>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator<=(const set<_Key, _Compare, _Allocator>& __x,
- const set<_Key, _Compare, _Allocator>& __y)
-{
- return !(__y < __x);
+inline _LIBCPP_HIDE_FROM_ABI bool
+operator<=(const set<_Key, _Compare, _Allocator>& __x, const set<_Key, _Compare, _Allocator>& __y) {
+ return !(__y < __x);
}
#else // _LIBCPP_STD_VER <= 17
@@ -1125,590 +993,459 @@ operator<=(const set<_Key, _Compare, _Allocator>& __x,
template <class _Key, class _Allocator>
_LIBCPP_HIDE_FROM_ABI __synth_three_way_result<_Key>
operator<=>(const set<_Key, _Allocator>& __x, const set<_Key, _Allocator>& __y) {
- return std::lexicographical_compare_three_way(
- __x.begin(), __x.end(), __y.begin(), __y.end(), std::__synth_three_way<_Key, _Key>);
+ return std::lexicographical_compare_three_way(
+ __x.begin(), __x.end(), __y.begin(), __y.end(), std::__synth_three_way<_Key, _Key>);
}
#endif // _LIBCPP_STD_VER <= 17
// specialized algorithms:
template <class _Key, class _Compare, class _Allocator>
-inline _LIBCPP_HIDE_FROM_ABI
-void
-swap(set<_Key, _Compare, _Allocator>& __x,
- set<_Key, _Compare, _Allocator>& __y)
- _NOEXCEPT_(_NOEXCEPT_(__x.swap(__y)))
-{
- __x.swap(__y);
+inline _LIBCPP_HIDE_FROM_ABI void swap(set<_Key, _Compare, _Allocator>& __x, set<_Key, _Compare, _Allocator>& __y)
+ _NOEXCEPT_(_NOEXCEPT_(__x.swap(__y))) {
+ __x.swap(__y);
}
#if _LIBCPP_STD_VER >= 20
template <class _Key, class _Compare, class _Allocator, class _Predicate>
-inline _LIBCPP_HIDE_FROM_ABI
- typename set<_Key, _Compare, _Allocator>::size_type
- erase_if(set<_Key, _Compare, _Allocator>& __c, _Predicate __pred) {
+inline _LIBCPP_HIDE_FROM_ABI typename set<_Key, _Compare, _Allocator>::size_type
+erase_if(set<_Key, _Compare, _Allocator>& __c, _Predicate __pred) {
return std::__libcpp_erase_if_container(__c, __pred);
}
#endif
-template <class _Key, class _Compare = less<_Key>,
- class _Allocator = allocator<_Key> >
-class _LIBCPP_TEMPLATE_VIS multiset
-{
+template <class _Key, class _Compare = less<_Key>, class _Allocator = allocator<_Key> >
+class _LIBCPP_TEMPLATE_VIS multiset {
public:
- // types:
- typedef _Key key_type;
- typedef key_type value_type;
- typedef __type_identity_t<_Compare> key_compare;
- typedef key_compare value_compare;
- typedef __type_identity_t<_Allocator> allocator_type;
- typedef value_type& reference;
- typedef const value_type& const_reference;
-
- static_assert((is_same<typename allocator_type::value_type, value_type>::value),
- "Allocator::value_type must be same type as value_type");
+ // types:
+ typedef _Key key_type;
+ typedef key_type value_type;
+ typedef __type_identity_t<_Compare> key_compare;
+ typedef key_compare value_compare;
+ typedef __type_identity_t<_Allocator> allocator_type;
+ typedef value_type& reference;
+ typedef const value_type& const_reference;
+
+ static_assert((is_same<typename allocator_type::value_type, value_type>::value),
+ "Allocator::value_type must be same type as value_type");
private:
- typedef __tree<value_type, value_compare, allocator_type> __base;
- typedef allocator_traits<allocator_type> __alloc_traits;
+ typedef __tree<value_type, value_compare, allocator_type> __base;
+ typedef allocator_traits<allocator_type> __alloc_traits;
- static_assert(is_same<allocator_type, __rebind_alloc<__alloc_traits, value_type> >::value,
- "[allocator.requirements] states that rebinding an allocator to the same type should result in the "
- "original allocator");
+ static_assert(is_same<allocator_type, __rebind_alloc<__alloc_traits, value_type> >::value,
+ "[allocator.requirements] states that rebinding an allocator to the same type should result in the "
+ "original allocator");
- __base __tree_;
+ __base __tree_;
public:
- typedef typename __base::pointer pointer;
- typedef typename __base::const_pointer const_pointer;
- typedef typename __base::size_type size_type;
- typedef typename __base::difference_type difference_type;
- typedef typename __base::const_iterator iterator;
- typedef typename __base::const_iterator const_iterator;
- typedef std::reverse_iterator<iterator> reverse_iterator;
- typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
+ typedef typename __base::pointer pointer;
+ typedef typename __base::const_pointer const_pointer;
+ typedef typename __base::size_type size_type;
+ typedef typename __base::difference_type difference_type;
+ typedef typename __base::const_iterator iterator;
+ typedef typename __base::const_iterator const_iterator;
+ typedef std::reverse_iterator<iterator> reverse_iterator;
+ typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
#if _LIBCPP_STD_VER >= 17
- typedef __set_node_handle<typename __base::__node, allocator_type> node_type;
+ typedef __set_node_handle<typename __base::__node, allocator_type> node_type;
#endif
- template <class _Key2, class _Compare2, class _Alloc2>
- friend class _LIBCPP_TEMPLATE_VIS set;
- template <class _Key2, class _Compare2, class _Alloc2>
- friend class _LIBCPP_TEMPLATE_VIS multiset;
-
- // construct/copy/destroy:
- _LIBCPP_HIDE_FROM_ABI
- multiset()
- _NOEXCEPT_(
- is_nothrow_default_constructible<allocator_type>::value &&
- is_nothrow_default_constructible<key_compare>::value &&
- is_nothrow_copy_constructible<key_compare>::value)
- : __tree_(value_compare()) {}
-
- _LIBCPP_HIDE_FROM_ABI
- explicit multiset(const value_compare& __comp)
- _NOEXCEPT_(
- is_nothrow_default_constructible<allocator_type>::value &&
- is_nothrow_copy_constructible<key_compare>::value)
- : __tree_(__comp) {}
-
- _LIBCPP_HIDE_FROM_ABI
- explicit multiset(const value_compare& __comp, const allocator_type& __a)
- : __tree_(__comp, __a) {}
- template <class _InputIterator>
- _LIBCPP_HIDE_FROM_ABI
- multiset(_InputIterator __f, _InputIterator __l,
- const value_compare& __comp = value_compare())
- : __tree_(__comp)
- {
- insert(__f, __l);
- }
+ template <class _Key2, class _Compare2, class _Alloc2>
+ friend class _LIBCPP_TEMPLATE_VIS set;
+ template <class _Key2, class _Compare2, class _Alloc2>
+ friend class _LIBCPP_TEMPLATE_VIS multiset;
+
+ // construct/copy/destroy:
+ _LIBCPP_HIDE_FROM_ABI multiset() _NOEXCEPT_(
+ is_nothrow_default_constructible<allocator_type>::value&& is_nothrow_default_constructible<key_compare>::value&&
+ is_nothrow_copy_constructible<key_compare>::value)
+ : __tree_(value_compare()) {}
+
+ _LIBCPP_HIDE_FROM_ABI explicit multiset(const value_compare& __comp) _NOEXCEPT_(
+ is_nothrow_default_constructible<allocator_type>::value&& is_nothrow_copy_constructible<key_compare>::value)
+ : __tree_(__comp) {}
+
+ _LIBCPP_HIDE_FROM_ABI explicit multiset(const value_compare& __comp, const allocator_type& __a)
+ : __tree_(__comp, __a) {}
+ template <class _InputIterator>
+ _LIBCPP_HIDE_FROM_ABI multiset(_InputIterator __f, _InputIterator __l, const value_compare& __comp = value_compare())
+ : __tree_(__comp) {
+ insert(__f, __l);
+ }
#if _LIBCPP_STD_VER >= 14
- template <class _InputIterator>
- _LIBCPP_HIDE_FROM_ABI
- multiset(_InputIterator __f, _InputIterator __l, const allocator_type& __a)
- : multiset(__f, __l, key_compare(), __a) {}
+ template <class _InputIterator>
+ _LIBCPP_HIDE_FROM_ABI multiset(_InputIterator __f, _InputIterator __l, const allocator_type& __a)
+ : multiset(__f, __l, key_compare(), __a) {}
#endif
- template <class _InputIterator>
- _LIBCPP_HIDE_FROM_ABI
- multiset(_InputIterator __f, _InputIterator __l,
- const value_compare& __comp, const allocator_type& __a)
- : __tree_(__comp, __a)
- {
- insert(__f, __l);
- }
+ template <class _InputIterator>
+ _LIBCPP_HIDE_FROM_ABI
+ multiset(_InputIterator __f, _InputIterator __l, const value_compare& __comp, const allocator_type& __a)
+ : __tree_(__comp, __a) {
+ insert(__f, __l);
+ }
#if _LIBCPP_STD_VER >= 23
- template <_ContainerCompatibleRange<value_type> _Range>
- _LIBCPP_HIDE_FROM_ABI
- multiset(from_range_t, _Range&& __range, const key_compare& __comp = key_compare(),
- const allocator_type& __a = allocator_type())
+ template <_ContainerCompatibleRange<value_type> _Range>
+ _LIBCPP_HIDE_FROM_ABI
+ multiset(from_range_t,
+ _Range&& __range,
+ const key_compare& __comp = key_compare(),
+ const allocator_type& __a = allocator_type())
: __tree_(__comp, __a) {
- insert_range(std::forward<_Range>(__range));
- }
+ insert_range(std::forward<_Range>(__range));
+ }
- template <_ContainerCompatibleRange<value_type> _Range>
- _LIBCPP_HIDE_FROM_ABI
- multiset(from_range_t, _Range&& __range, const allocator_type& __a)
+ template <_ContainerCompatibleRange<value_type> _Range>
+ _LIBCPP_HIDE_FROM_ABI multiset(from_range_t, _Range&& __range, const allocator_type& __a)
: multiset(from_range, std::forward<_Range>(__range), key_compare(), __a) {}
#endif
- _LIBCPP_HIDE_FROM_ABI
- multiset(const multiset& __s)
- : __tree_(__s.__tree_.value_comp(),
- __alloc_traits::select_on_container_copy_construction(__s.__tree_.__alloc()))
- {
- insert(__s.begin(), __s.end());
- }
-
- _LIBCPP_HIDE_FROM_ABI
- multiset& operator=(const multiset& __s)
- {
- __tree_ = __s.__tree_;
- return *this;
- }
+ _LIBCPP_HIDE_FROM_ABI multiset(const multiset& __s)
+ : __tree_(__s.__tree_.value_comp(),
+ __alloc_traits::select_on_container_copy_construction(__s.__tree_.__alloc())) {
+ insert(__s.begin(), __s.end());
+ }
+
+ _LIBCPP_HIDE_FROM_ABI multiset& operator=(const multiset& __s) {
+ __tree_ = __s.__tree_;
+ return *this;
+ }
#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI
- multiset(multiset&& __s)
- _NOEXCEPT_(is_nothrow_move_constructible<__base>::value)
- : __tree_(std::move(__s.__tree_)) {}
+ _LIBCPP_HIDE_FROM_ABI multiset(multiset&& __s) _NOEXCEPT_(is_nothrow_move_constructible<__base>::value)
+ : __tree_(std::move(__s.__tree_)) {}
- _LIBCPP_HIDE_FROM_ABI multiset(multiset&& __s, const allocator_type& __a);
+ _LIBCPP_HIDE_FROM_ABI multiset(multiset&& __s, const allocator_type& __a);
#endif // _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI
- explicit multiset(const allocator_type& __a)
- : __tree_(__a) {}
- _LIBCPP_HIDE_FROM_ABI
- multiset(const multiset& __s, const allocator_type& __a)
- : __tree_(__s.__tree_.value_comp(), __a)
- {
- insert(__s.begin(), __s.end());
- }
+ _LIBCPP_HIDE_FROM_ABI explicit multiset(const allocator_type& __a) : __tree_(__a) {}
+ _LIBCPP_HIDE_FROM_ABI multiset(const multiset& __s, const allocator_type& __a)
+ : __tree_(__s.__tree_.value_comp(), __a) {
+ insert(__s.begin(), __s.end());
+ }
#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI
- multiset(initializer_list<value_type> __il, const value_compare& __comp = value_compare())
- : __tree_(__comp)
- {
- insert(__il.begin(), __il.end());
- }
-
- _LIBCPP_HIDE_FROM_ABI
- multiset(initializer_list<value_type> __il, const value_compare& __comp,
- const allocator_type& __a)
- : __tree_(__comp, __a)
- {
- insert(__il.begin(), __il.end());
- }
+ _LIBCPP_HIDE_FROM_ABI multiset(initializer_list<value_type> __il, const value_compare& __comp = value_compare())
+ : __tree_(__comp) {
+ insert(__il.begin(), __il.end());
+ }
-#if _LIBCPP_STD_VER >= 14
- _LIBCPP_HIDE_FROM_ABI
- multiset(initializer_list<value_type> __il, const allocator_type& __a)
- : multiset(__il, key_compare(), __a) {}
-#endif
-
- _LIBCPP_HIDE_FROM_ABI
- multiset& operator=(initializer_list<value_type> __il)
- {
- __tree_.__assign_multi(__il.begin(), __il.end());
- return *this;
- }
-
- _LIBCPP_HIDE_FROM_ABI
- multiset& operator=(multiset&& __s)
- _NOEXCEPT_(is_nothrow_move_assignable<__base>::value)
- {
- __tree_ = std::move(__s.__tree_);
- return *this;
- }
+ _LIBCPP_HIDE_FROM_ABI
+ multiset(initializer_list<value_type> __il, const value_compare& __comp, const allocator_type& __a)
+ : __tree_(__comp, __a) {
+ insert(__il.begin(), __il.end());
+ }
+
+# if _LIBCPP_STD_VER >= 14
+ _LIBCPP_HIDE_FROM_ABI multiset(initializer_list<value_type> __il, const allocator_type& __a)
+ : multiset(__il, key_compare(), __a) {}
+# endif
+
+ _LIBCPP_HIDE_FROM_ABI multiset& operator=(initializer_list<value_type> __il) {
+ __tree_.__assign_multi(__il.begin(), __il.end());
+ return *this;
+ }
+
+ _LIBCPP_HIDE_FROM_ABI multiset& operator=(multiset&& __s) _NOEXCEPT_(is_nothrow_move_assignable<__base>::value) {
+ __tree_ = std::move(__s.__tree_);
+ return *this;
+ }
#endif // _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI
- ~multiset() {
- static_assert(sizeof(__diagnose_non_const_comparator<_Key, _Compare>()), "");
- }
+ _LIBCPP_HIDE_FROM_ABI ~multiset() { static_assert(sizeof(__diagnose_non_const_comparator<_Key, _Compare>()), ""); }
- _LIBCPP_HIDE_FROM_ABI
- iterator begin() _NOEXCEPT {return __tree_.begin();}
- _LIBCPP_HIDE_FROM_ABI
- const_iterator begin() const _NOEXCEPT {return __tree_.begin();}
- _LIBCPP_HIDE_FROM_ABI
- iterator end() _NOEXCEPT {return __tree_.end();}
- _LIBCPP_HIDE_FROM_ABI
- const_iterator end() const _NOEXCEPT {return __tree_.end();}
-
- _LIBCPP_HIDE_FROM_ABI
- reverse_iterator rbegin() _NOEXCEPT
- {return reverse_iterator(end());}
- _LIBCPP_HIDE_FROM_ABI
- const_reverse_iterator rbegin() const _NOEXCEPT
- {return const_reverse_iterator(end());}
- _LIBCPP_HIDE_FROM_ABI
- reverse_iterator rend() _NOEXCEPT
- {return reverse_iterator(begin());}
- _LIBCPP_HIDE_FROM_ABI
- const_reverse_iterator rend() const _NOEXCEPT
- {return const_reverse_iterator(begin());}
-
- _LIBCPP_HIDE_FROM_ABI
- const_iterator cbegin() const _NOEXCEPT {return begin();}
- _LIBCPP_HIDE_FROM_ABI
- const_iterator cend() const _NOEXCEPT {return end();}
- _LIBCPP_HIDE_FROM_ABI
- const_reverse_iterator crbegin() const _NOEXCEPT {return rbegin();}
- _LIBCPP_HIDE_FROM_ABI
- const_reverse_iterator crend() const _NOEXCEPT {return rend();}
-
- _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_HIDE_FROM_ABI
- bool empty() const _NOEXCEPT {return __tree_.size() == 0;}
- _LIBCPP_HIDE_FROM_ABI
- size_type size() const _NOEXCEPT {return __tree_.size();}
- _LIBCPP_HIDE_FROM_ABI
- size_type max_size() const _NOEXCEPT {return __tree_.max_size();}
+ _LIBCPP_HIDE_FROM_ABI iterator begin() _NOEXCEPT { return __tree_.begin(); }
+ _LIBCPP_HIDE_FROM_ABI const_iterator begin() const _NOEXCEPT { return __tree_.begin(); }
+ _LIBCPP_HIDE_FROM_ABI iterator end() _NOEXCEPT { return __tree_.end(); }
+ _LIBCPP_HIDE_FROM_ABI const_iterator end() const _NOEXCEPT { return __tree_.end(); }
- // modifiers:
+ _LIBCPP_HIDE_FROM_ABI reverse_iterator rbegin() _NOEXCEPT { return reverse_iterator(end()); }
+ _LIBCPP_HIDE_FROM_ABI const_reverse_iterator rbegin() const _NOEXCEPT { return const_reverse_iterator(end()); }
+ _LIBCPP_HIDE_FROM_ABI reverse_iterator rend() _NOEXCEPT { return reverse_iterator(begin()); }
+ _LIBCPP_HIDE_FROM_ABI const_reverse_iterator rend() const _NOEXCEPT { return const_reverse_iterator(begin()); }
+
+ _LIBCPP_HIDE_FROM_ABI const_iterator cbegin() const _NOEXCEPT { return begin(); }
+ _LIBCPP_HIDE_FROM_ABI const_iterator cend() const _NOEXCEPT { return end(); }
+ _LIBCPP_HIDE_FROM_ABI const_reverse_iterator crbegin() const _NOEXCEPT { return rbegin(); }
+ _LIBCPP_HIDE_FROM_ABI const_reverse_iterator crend() const _NOEXCEPT { return rend(); }
+
+ _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_HIDE_FROM_ABI bool empty() const _NOEXCEPT { return __tree_.size() == 0; }
+ _LIBCPP_HIDE_FROM_ABI size_type size() const _NOEXCEPT { return __tree_.size(); }
+ _LIBCPP_HIDE_FROM_ABI size_type max_size() const _NOEXCEPT { return __tree_.max_size(); }
+
+ // modifiers:
#ifndef _LIBCPP_CXX03_LANG
- template <class... _Args>
- _LIBCPP_HIDE_FROM_ABI
- iterator emplace(_Args&&... __args)
- {return __tree_.__emplace_multi(std::forward<_Args>(__args)...);}
- template <class... _Args>
- _LIBCPP_HIDE_FROM_ABI
- iterator emplace_hint(const_iterator __p, _Args&&... __args)
- {return __tree_.__emplace_hint_multi(__p, std::forward<_Args>(__args)...);}
+ template <class... _Args>
+ _LIBCPP_HIDE_FROM_ABI iterator emplace(_Args&&... __args) {
+ return __tree_.__emplace_multi(std::forward<_Args>(__args)...);
+ }
+ template <class... _Args>
+ _LIBCPP_HIDE_FROM_ABI iterator emplace_hint(const_iterator __p, _Args&&... __args) {
+ return __tree_.__emplace_hint_multi(__p, std::forward<_Args>(__args)...);
+ }
#endif // _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI
- iterator insert(const value_type& __v)
- {return __tree_.__insert_multi(__v);}
- _LIBCPP_HIDE_FROM_ABI
- iterator insert(const_iterator __p, const value_type& __v)
- {return __tree_.__insert_multi(__p, __v);}
-
- template <class _InputIterator>
- _LIBCPP_HIDE_FROM_ABI
- void insert(_InputIterator __f, _InputIterator __l)
- {
- for (const_iterator __e = cend(); __f != __l; ++__f)
- __tree_.__insert_multi(__e, *__f);
- }
+ _LIBCPP_HIDE_FROM_ABI iterator insert(const value_type& __v) { return __tree_.__insert_multi(__v); }
+ _LIBCPP_HIDE_FROM_ABI iterator insert(const_iterator __p, const value_type& __v) {
+ return __tree_.__insert_multi(__p, __v);
+ }
+
+ template <class _InputIterator>
+ _LIBCPP_HIDE_FROM_ABI void insert(_InputIterator __f, _InputIterator __l) {
+ for (const_iterator __e = cend(); __f != __l; ++__f)
+ __tree_.__insert_multi(__e, *__f);
+ }
#if _LIBCPP_STD_VER >= 23
- template <_ContainerCompatibleRange<value_type> _Range>
- _LIBCPP_HIDE_FROM_ABI
- void insert_range(_Range&& __range) {
- const_iterator __end = cend();
- for (auto&& __element : __range) {
- __tree_.__insert_multi(__end, std::forward<decltype(__element)>(__element));
- }
+ template <_ContainerCompatibleRange<value_type> _Range>
+ _LIBCPP_HIDE_FROM_ABI void insert_range(_Range&& __range) {
+ const_iterator __end = cend();
+ for (auto&& __element : __range) {
+ __tree_.__insert_multi(__end, std::forward<decltype(__element)>(__element));
}
+ }
#endif
#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI
- iterator insert(value_type&& __v)
- {return __tree_.__insert_multi(std::move(__v));}
+ _LIBCPP_HIDE_FROM_ABI iterator insert(value_type&& __v) { return __tree_.__insert_multi(std::move(__v)); }
- _LIBCPP_HIDE_FROM_ABI
- iterator insert(const_iterator __p, value_type&& __v)
- {return __tree_.__insert_multi(__p, std::move(__v));}
+ _LIBCPP_HIDE_FROM_ABI iterator insert(const_iterator __p, value_type&& __v) {
+ return __tree_.__insert_multi(__p, std::move(__v));
+ }
- _LIBCPP_HIDE_FROM_ABI
- void insert(initializer_list<value_type> __il)
- {insert(__il.begin(), __il.end());}
+ _LIBCPP_HIDE_FROM_ABI void insert(initializer_list<value_type> __il) { insert(__il.begin(), __il.end()); }
#endif // _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI
- iterator erase(const_iterator __p) {return __tree_.erase(__p);}
- _LIBCPP_HIDE_FROM_ABI
- size_type erase(const key_type& __k) {return __tree_.__erase_multi(__k);}
- _LIBCPP_HIDE_FROM_ABI
- iterator erase(const_iterator __f, const_iterator __l)
- {return __tree_.erase(__f, __l);}
- _LIBCPP_HIDE_FROM_ABI
- void clear() _NOEXCEPT {__tree_.clear();}
+ _LIBCPP_HIDE_FROM_ABI iterator erase(const_iterator __p) { return __tree_.erase(__p); }
+ _LIBCPP_HIDE_FROM_ABI size_type erase(const key_type& __k) { return __tree_.__erase_multi(__k); }
+ _LIBCPP_HIDE_FROM_ABI iterator erase(const_iterator __f, const_iterator __l) { return __tree_.erase(__f, __l); }
+ _LIBCPP_HIDE_FROM_ABI void clear() _NOEXCEPT { __tree_.clear(); }
#if _LIBCPP_STD_VER >= 17
- _LIBCPP_HIDE_FROM_ABI
- iterator insert(node_type&& __nh)
- {
- _LIBCPP_ASSERT_UNCATEGORIZED(__nh.empty() || __nh.get_allocator() == get_allocator(),
- "node_type with incompatible allocator passed to multiset::insert()");
- return __tree_.template __node_handle_insert_multi<node_type>(
- std::move(__nh));
- }
- _LIBCPP_HIDE_FROM_ABI
- iterator insert(const_iterator __hint, node_type&& __nh)
- {
- _LIBCPP_ASSERT_UNCATEGORIZED(__nh.empty() || __nh.get_allocator() == get_allocator(),
- "node_type with incompatible allocator passed to multiset::insert()");
- return __tree_.template __node_handle_insert_multi<node_type>(
- __hint, std::move(__nh));
- }
- _LIBCPP_HIDE_FROM_ABI
- node_type extract(key_type const& __key)
- {
- return __tree_.template __node_handle_extract<node_type>(__key);
- }
- _LIBCPP_HIDE_FROM_ABI
- node_type extract(const_iterator __it)
- {
- return __tree_.template __node_handle_extract<node_type>(__it);
- }
- template <class _Compare2>
- _LIBCPP_HIDE_FROM_ABI
- void merge(multiset<key_type, _Compare2, allocator_type>& __source)
- {
- _LIBCPP_ASSERT_UNCATEGORIZED(__source.get_allocator() == get_allocator(),
- "merging container with incompatible allocator");
- __tree_.__node_handle_merge_multi(__source.__tree_);
- }
- template <class _Compare2>
- _LIBCPP_HIDE_FROM_ABI
- void merge(multiset<key_type, _Compare2, allocator_type>&& __source)
- {
- _LIBCPP_ASSERT_UNCATEGORIZED(__source.get_allocator() == get_allocator(),
- "merging container with incompatible allocator");
- __tree_.__node_handle_merge_multi(__source.__tree_);
- }
- template <class _Compare2>
- _LIBCPP_HIDE_FROM_ABI
- void merge(set<key_type, _Compare2, allocator_type>& __source)
- {
- _LIBCPP_ASSERT_UNCATEGORIZED(__source.get_allocator() == get_allocator(),
- "merging container with incompatible allocator");
- __tree_.__node_handle_merge_multi(__source.__tree_);
- }
- template <class _Compare2>
- _LIBCPP_HIDE_FROM_ABI
- void merge(set<key_type, _Compare2, allocator_type>&& __source)
- {
- _LIBCPP_ASSERT_UNCATEGORIZED(__source.get_allocator() == get_allocator(),
- "merging container with incompatible allocator");
- __tree_.__node_handle_merge_multi(__source.__tree_);
- }
+ _LIBCPP_HIDE_FROM_ABI iterator insert(node_type&& __nh) {
+ _LIBCPP_ASSERT_UNCATEGORIZED(__nh.empty() || __nh.get_allocator() == get_allocator(),
+ "node_type with incompatible allocator passed to multiset::insert()");
+ return __tree_.template __node_handle_insert_multi<node_type>(std::move(__nh));
+ }
+ _LIBCPP_HIDE_FROM_ABI iterator insert(const_iterator __hint, node_type&& __nh) {
+ _LIBCPP_ASSERT_UNCATEGORIZED(__nh.empty() || __nh.get_allocator() == get_allocator(),
+ "node_type with incompatible allocator passed to multiset::insert()");
+ return __tree_.template __node_handle_insert_multi<node_type>(__hint, std::move(__nh));
+ }
+ _LIBCPP_HIDE_FROM_ABI node_type extract(key_type const& __key) {
+ return __tree_.template __node_handle_extract<node_type>(__key);
+ }
+ _LIBCPP_HIDE_FROM_ABI node_type extract(const_iterator __it) {
+ return __tree_.template __node_handle_extract<node_type>(__it);
+ }
+ template <class _Compare2>
+ _LIBCPP_HIDE_FROM_ABI void merge(multiset<key_type, _Compare2, allocator_type>& __source) {
+ _LIBCPP_ASSERT_UNCATEGORIZED(
+ __source.get_allocator() == get_allocator(), "merging container with incompatible allocator");
+ __tree_.__node_handle_merge_multi(__source.__tree_);
+ }
+ template <class _Compare2>
+ _LIBCPP_HIDE_FROM_ABI void merge(multiset<key_type, _Compare2, allocator_type>&& __source) {
+ _LIBCPP_ASSERT_UNCATEGORIZED(
+ __source.get_allocator() == get_allocator(), "merging container with incompatible allocator");
+ __tree_.__node_handle_merge_multi(__source.__tree_);
+ }
+ template <class _Compare2>
+ _LIBCPP_HIDE_FROM_ABI void merge(set<key_type, _Compare2, allocator_type>& __source) {
+ _LIBCPP_ASSERT_UNCATEGORIZED(
+ __source.get_allocator() == get_allocator(), "merging container with incompatible allocator");
+ __tree_.__node_handle_merge_multi(__source.__tree_);
+ }
+ template <class _Compare2>
+ _LIBCPP_HIDE_FROM_ABI void merge(set<key_type, _Compare2, allocator_type>&& __source) {
+ _LIBCPP_ASSERT_UNCATEGORIZED(
+ __source.get_allocator() == get_allocator(), "merging container with incompatible allocator");
+ __tree_.__node_handle_merge_multi(__source.__tree_);
+ }
#endif
- _LIBCPP_HIDE_FROM_ABI
- void swap(multiset& __s)
- _NOEXCEPT_(__is_nothrow_swappable<__base>::value)
- {__tree_.swap(__s.__tree_);}
+ _LIBCPP_HIDE_FROM_ABI void swap(multiset& __s) _NOEXCEPT_(__is_nothrow_swappable<__base>::value) {
+ __tree_.swap(__s.__tree_);
+ }
- _LIBCPP_HIDE_FROM_ABI
- allocator_type get_allocator() const _NOEXCEPT {return __tree_.__alloc();}
- _LIBCPP_HIDE_FROM_ABI
- key_compare key_comp() const {return __tree_.value_comp();}
- _LIBCPP_HIDE_FROM_ABI
- value_compare value_comp() const {return __tree_.value_comp();}
+ _LIBCPP_HIDE_FROM_ABI allocator_type get_allocator() const _NOEXCEPT { return __tree_.__alloc(); }
+ _LIBCPP_HIDE_FROM_ABI key_compare key_comp() const { return __tree_.value_comp(); }
+ _LIBCPP_HIDE_FROM_ABI value_compare value_comp() const { return __tree_.value_comp(); }
- // set operations:
- _LIBCPP_HIDE_FROM_ABI
- iterator find(const key_type& __k) {return __tree_.find(__k);}
- _LIBCPP_HIDE_FROM_ABI
- const_iterator find(const key_type& __k) const {return __tree_.find(__k);}
+ // set operations:
+ _LIBCPP_HIDE_FROM_ABI iterator find(const key_type& __k) { return __tree_.find(__k); }
+ _LIBCPP_HIDE_FROM_ABI const_iterator find(const key_type& __k) const { return __tree_.find(__k); }
#if _LIBCPP_STD_VER >= 14
- template <typename _K2, enable_if_t<__is_transparent<_Compare, _K2>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI
- iterator
- find(const _K2& __k) {return __tree_.find(__k);}
- template <typename _K2, enable_if_t<__is_transparent<_Compare, _K2>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI
- const_iterator
- find(const _K2& __k) const {return __tree_.find(__k);}
+ template <typename _K2, enable_if_t<__is_transparent<_Compare, _K2>::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI iterator find(const _K2& __k) {
+ return __tree_.find(__k);
+ }
+ template <typename _K2, enable_if_t<__is_transparent<_Compare, _K2>::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI const_iterator find(const _K2& __k) const {
+ return __tree_.find(__k);
+ }
#endif
- _LIBCPP_HIDE_FROM_ABI
- size_type count(const key_type& __k) const
- {return __tree_.__count_multi(__k);}
+ _LIBCPP_HIDE_FROM_ABI size_type count(const key_type& __k) const { return __tree_.__count_multi(__k); }
#if _LIBCPP_STD_VER >= 14
- template <typename _K2, enable_if_t<__is_transparent<_Compare, _K2>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI
- size_type
- count(const _K2& __k) const {return __tree_.__count_multi(__k);}
+ template <typename _K2, enable_if_t<__is_transparent<_Compare, _K2>::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI size_type count(const _K2& __k) const {
+ return __tree_.__count_multi(__k);
+ }
#endif
#if _LIBCPP_STD_VER >= 20
- _LIBCPP_HIDE_FROM_ABI
- bool contains(const key_type& __k) const {return find(__k) != end();}
- template <typename _K2, enable_if_t<__is_transparent<_Compare, _K2>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI
- bool
- contains(const _K2& __k) const { return find(__k) != end(); }
+ _LIBCPP_HIDE_FROM_ABI bool contains(const key_type& __k) const { return find(__k) != end(); }
+ template <typename _K2, enable_if_t<__is_transparent<_Compare, _K2>::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI bool contains(const _K2& __k) const {
+ return find(__k) != end();
+ }
#endif // _LIBCPP_STD_VER >= 20
- _LIBCPP_HIDE_FROM_ABI
- iterator lower_bound(const key_type& __k)
- {return __tree_.lower_bound(__k);}
- _LIBCPP_HIDE_FROM_ABI
- const_iterator lower_bound(const key_type& __k) const
- {return __tree_.lower_bound(__k);}
+ _LIBCPP_HIDE_FROM_ABI iterator lower_bound(const key_type& __k) { return __tree_.lower_bound(__k); }
+ _LIBCPP_HIDE_FROM_ABI const_iterator lower_bound(const key_type& __k) const { return __tree_.lower_bound(__k); }
#if _LIBCPP_STD_VER >= 14
- template <typename _K2, enable_if_t<__is_transparent<_Compare, _K2>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI
- iterator
- lower_bound(const _K2& __k) {return __tree_.lower_bound(__k);}
-
- template <typename _K2, enable_if_t<__is_transparent<_Compare, _K2>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI
- const_iterator
- lower_bound(const _K2& __k) const {return __tree_.lower_bound(__k);}
+ template <typename _K2, enable_if_t<__is_transparent<_Compare, _K2>::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI iterator lower_bound(const _K2& __k) {
+ return __tree_.lower_bound(__k);
+ }
+
+ template <typename _K2, enable_if_t<__is_transparent<_Compare, _K2>::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI const_iterator lower_bound(const _K2& __k) const {
+ return __tree_.lower_bound(__k);
+ }
#endif
- _LIBCPP_HIDE_FROM_ABI
- iterator upper_bound(const key_type& __k)
- {return __tree_.upper_bound(__k);}
- _LIBCPP_HIDE_FROM_ABI
- const_iterator upper_bound(const key_type& __k) const
- {return __tree_.upper_bound(__k);}
+ _LIBCPP_HIDE_FROM_ABI iterator upper_bound(const key_type& __k) { return __tree_.upper_bound(__k); }
+ _LIBCPP_HIDE_FROM_ABI const_iterator upper_bound(const key_type& __k) const { return __tree_.upper_bound(__k); }
#if _LIBCPP_STD_VER >= 14
- template <typename _K2, enable_if_t<__is_transparent<_Compare, _K2>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI
- iterator
- upper_bound(const _K2& __k) {return __tree_.upper_bound(__k);}
- template <typename _K2, enable_if_t<__is_transparent<_Compare, _K2>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI
- const_iterator
- upper_bound(const _K2& __k) const {return __tree_.upper_bound(__k);}
+ template <typename _K2, enable_if_t<__is_transparent<_Compare, _K2>::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI iterator upper_bound(const _K2& __k) {
+ return __tree_.upper_bound(__k);
+ }
+ template <typename _K2, enable_if_t<__is_transparent<_Compare, _K2>::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI const_iterator upper_bound(const _K2& __k) const {
+ return __tree_.upper_bound(__k);
+ }
#endif
- _LIBCPP_HIDE_FROM_ABI
- pair<iterator,iterator> equal_range(const key_type& __k)
- {return __tree_.__equal_range_multi(__k);}
- _LIBCPP_HIDE_FROM_ABI
- pair<const_iterator,const_iterator> equal_range(const key_type& __k) const
- {return __tree_.__equal_range_multi(__k);}
+ _LIBCPP_HIDE_FROM_ABI pair<iterator, iterator> equal_range(const key_type& __k) {
+ return __tree_.__equal_range_multi(__k);
+ }
+ _LIBCPP_HIDE_FROM_ABI pair<const_iterator, const_iterator> equal_range(const key_type& __k) const {
+ return __tree_.__equal_range_multi(__k);
+ }
#if _LIBCPP_STD_VER >= 14
- template <typename _K2, enable_if_t<__is_transparent<_Compare, _K2>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI
- pair<iterator,iterator>
- equal_range(const _K2& __k) {return __tree_.__equal_range_multi(__k);}
- template <typename _K2, enable_if_t<__is_transparent<_Compare, _K2>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI
- pair<const_iterator,const_iterator>
- equal_range(const _K2& __k) const {return __tree_.__equal_range_multi(__k);}
+ template <typename _K2, enable_if_t<__is_transparent<_Compare, _K2>::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI pair<iterator, iterator> equal_range(const _K2& __k) {
+ return __tree_.__equal_range_multi(__k);
+ }
+ template <typename _K2, enable_if_t<__is_transparent<_Compare, _K2>::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI pair<const_iterator, const_iterator> equal_range(const _K2& __k) const {
+ return __tree_.__equal_range_multi(__k);
+ }
#endif
};
#if _LIBCPP_STD_VER >= 17
-template<class _InputIterator,
- class _Compare = less<__iter_value_type<_InputIterator>>,
- class _Allocator = allocator<__iter_value_type<_InputIterator>>,
- class = enable_if_t<__has_input_iterator_category<_InputIterator>::value, void>,
- class = enable_if_t<__is_allocator<_Allocator>::value, void>,
- class = enable_if_t<!__is_allocator<_Compare>::value, void>>
+template <class _InputIterator,
+ class _Compare = less<__iter_value_type<_InputIterator>>,
+ class _Allocator = allocator<__iter_value_type<_InputIterator>>,
+ class = enable_if_t<__has_input_iterator_category<_InputIterator>::value, void>,
+ class = enable_if_t<__is_allocator<_Allocator>::value, void>,
+ class = enable_if_t<!__is_allocator<_Compare>::value, void>>
multiset(_InputIterator, _InputIterator, _Compare = _Compare(), _Allocator = _Allocator())
- -> multiset<__iter_value_type<_InputIterator>, _Compare, _Allocator>;
+ -> multiset<__iter_value_type<_InputIterator>, _Compare, _Allocator>;
-#if _LIBCPP_STD_VER >= 23
-template <ranges::input_range _Range, class _Compare = less<ranges::range_value_t<_Range>>,
+# if _LIBCPP_STD_VER >= 23
+template <ranges::input_range _Range,
+ class _Compare = less<ranges::range_value_t<_Range>>,
class _Allocator = allocator<ranges::range_value_t<_Range>>,
- class = enable_if_t<__is_allocator<_Allocator>::value, void>,
- class = enable_if_t<!__is_allocator<_Compare>::value, void>>
+ class = enable_if_t<__is_allocator<_Allocator>::value, void>,
+ class = enable_if_t<!__is_allocator<_Compare>::value, void>>
multiset(from_range_t, _Range&&, _Compare = _Compare(), _Allocator = _Allocator())
- -> multiset<ranges::range_value_t<_Range>, _Compare, _Allocator>;
-#endif
-
-template<class _Key, class _Compare = less<_Key>,
- class _Allocator = allocator<_Key>,
- class = enable_if_t<__is_allocator<_Allocator>::value, void>,
- class = enable_if_t<!__is_allocator<_Compare>::value, void>>
+ -> multiset<ranges::range_value_t<_Range>, _Compare, _Allocator>;
+# endif
+
+template <class _Key,
+ class _Compare = less<_Key>,
+ class _Allocator = allocator<_Key>,
+ class = enable_if_t<__is_allocator<_Allocator>::value, void>,
+ class = enable_if_t<!__is_allocator<_Compare>::value, void>>
multiset(initializer_list<_Key>, _Compare = _Compare(), _Allocator = _Allocator())
- -> multiset<_Key, _Compare, _Allocator>;
+ -> multiset<_Key, _Compare, _Allocator>;
-template<class _InputIterator, class _Allocator,
- class = enable_if_t<__has_input_iterator_category<_InputIterator>::value, void>,
- class = enable_if_t<__is_allocator<_Allocator>::value, void>>
+template <class _InputIterator,
+ class _Allocator,
+ class = enable_if_t<__has_input_iterator_category<_InputIterator>::value, void>,
+ class = enable_if_t<__is_allocator<_Allocator>::value, void>>
multiset(_InputIterator, _InputIterator, _Allocator)
- -> multiset<__iter_value_type<_InputIterator>,
- less<__iter_value_type<_InputIterator>>, _Allocator>;
+ -> multiset<__iter_value_type<_InputIterator>, less<__iter_value_type<_InputIterator>>, _Allocator>;
-#if _LIBCPP_STD_VER >= 23
-template <ranges::input_range _Range, class _Allocator,
- class = enable_if_t<__is_allocator<_Allocator>::value, void>>
+# if _LIBCPP_STD_VER >= 23
+template <ranges::input_range _Range, class _Allocator, class = enable_if_t<__is_allocator<_Allocator>::value, void>>
multiset(from_range_t, _Range&&, _Allocator)
- -> multiset<ranges::range_value_t<_Range>, less<ranges::range_value_t<_Range>>, _Allocator>;
-#endif
+ -> multiset<ranges::range_value_t<_Range>, less<ranges::range_value_t<_Range>>, _Allocator>;
+# endif
-template<class _Key, class _Allocator,
- class = enable_if_t<__is_allocator<_Allocator>::value, void>>
-multiset(initializer_list<_Key>, _Allocator)
- -> multiset<_Key, less<_Key>, _Allocator>;
+template <class _Key, class _Allocator, class = enable_if_t<__is_allocator<_Allocator>::value, void>>
+multiset(initializer_list<_Key>, _Allocator) -> multiset<_Key, less<_Key>, _Allocator>;
#endif
#ifndef _LIBCPP_CXX03_LANG
template <class _Key, class _Compare, class _Allocator>
multiset<_Key, _Compare, _Allocator>::multiset(multiset&& __s, const allocator_type& __a)
- : __tree_(std::move(__s.__tree_), __a)
-{
- if (__a != __s.get_allocator())
- {
- const_iterator __e = cend();
- while (!__s.empty())
- insert(__e, std::move(__s.__tree_.remove(__s.begin())->__value_));
- }
+ : __tree_(std::move(__s.__tree_), __a) {
+ if (__a != __s.get_allocator()) {
+ const_iterator __e = cend();
+ while (!__s.empty())
+ insert(__e, std::move(__s.__tree_.remove(__s.begin())->__value_));
+ }
}
#endif // _LIBCPP_CXX03_LANG
template <class _Key, class _Compare, class _Allocator>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator==(const multiset<_Key, _Compare, _Allocator>& __x,
- const multiset<_Key, _Compare, _Allocator>& __y)
-{
- return __x.size() == __y.size() && std::equal(__x.begin(), __x.end(), __y.begin());
+inline _LIBCPP_HIDE_FROM_ABI bool
+operator==(const multiset<_Key, _Compare, _Allocator>& __x, const multiset<_Key, _Compare, _Allocator>& __y) {
+ return __x.size() == __y.size() && std::equal(__x.begin(), __x.end(), __y.begin());
}
#if _LIBCPP_STD_VER <= 17
template <class _Key, class _Compare, class _Allocator>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator< (const multiset<_Key, _Compare, _Allocator>& __x,
- const multiset<_Key, _Compare, _Allocator>& __y)
-{
- return std::lexicographical_compare(__x.begin(), __x.end(), __y.begin(), __y.end());
+inline _LIBCPP_HIDE_FROM_ABI bool
+operator<(const multiset<_Key, _Compare, _Allocator>& __x, const multiset<_Key, _Compare, _Allocator>& __y) {
+ return std::lexicographical_compare(__x.begin(), __x.end(), __y.begin(), __y.end());
}
template <class _Key, class _Compare, class _Allocator>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator!=(const multiset<_Key, _Compare, _Allocator>& __x,
- const multiset<_Key, _Compare, _Allocator>& __y)
-{
- return !(__x == __y);
+inline _LIBCPP_HIDE_FROM_ABI bool
+operator!=(const multiset<_Key, _Compare, _Allocator>& __x, const multiset<_Key, _Compare, _Allocator>& __y) {
+ return !(__x == __y);
}
template <class _Key, class _Compare, class _Allocator>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator> (const multiset<_Key, _Compare, _Allocator>& __x,
- const multiset<_Key, _Compare, _Allocator>& __y)
-{
- return __y < __x;
+inline _LIBCPP_HIDE_FROM_ABI bool
+operator>(const multiset<_Key, _Compare, _Allocator>& __x, const multiset<_Key, _Compare, _Allocator>& __y) {
+ return __y < __x;
}
template <class _Key, class _Compare, class _Allocator>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator>=(const multiset<_Key, _Compare, _Allocator>& __x,
- const multiset<_Key, _Compare, _Allocator>& __y)
-{
- return !(__x < __y);
+inline _LIBCPP_HIDE_FROM_ABI bool
+operator>=(const multiset<_Key, _Compare, _Allocator>& __x, const multiset<_Key, _Compare, _Allocator>& __y) {
+ return !(__x < __y);
}
template <class _Key, class _Compare, class _Allocator>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator<=(const multiset<_Key, _Compare, _Allocator>& __x,
- const multiset<_Key, _Compare, _Allocator>& __y)
-{
- return !(__y < __x);
+inline _LIBCPP_HIDE_FROM_ABI bool
+operator<=(const multiset<_Key, _Compare, _Allocator>& __x, const multiset<_Key, _Compare, _Allocator>& __y) {
+ return !(__y < __x);
}
#else // _LIBCPP_STD_VER <= 17
@@ -1716,27 +1453,23 @@ operator<=(const multiset<_Key, _Compare, _Allocator>& __x,
template <class _Key, class _Allocator>
_LIBCPP_HIDE_FROM_ABI __synth_three_way_result<_Key>
operator<=>(const multiset<_Key, _Allocator>& __x, const multiset<_Key, _Allocator>& __y) {
- return std::lexicographical_compare_three_way(
- __x.begin(), __x.end(), __y.begin(), __y.end(), std::__synth_three_way<_Key, _Key>);
+ return std::lexicographical_compare_three_way(
+ __x.begin(), __x.end(), __y.begin(), __y.end(), std::__synth_three_way<_Key, _Key>);
}
#endif // _LIBCPP_STD_VER <= 17
template <class _Key, class _Compare, class _Allocator>
-inline _LIBCPP_HIDE_FROM_ABI
-void
-swap(multiset<_Key, _Compare, _Allocator>& __x,
- multiset<_Key, _Compare, _Allocator>& __y)
- _NOEXCEPT_(_NOEXCEPT_(__x.swap(__y)))
-{
- __x.swap(__y);
+inline _LIBCPP_HIDE_FROM_ABI void
+swap(multiset<_Key, _Compare, _Allocator>& __x, multiset<_Key, _Compare, _Allocator>& __y)
+ _NOEXCEPT_(_NOEXCEPT_(__x.swap(__y))) {
+ __x.swap(__y);
}
#if _LIBCPP_STD_VER >= 20
template <class _Key, class _Compare, class _Allocator, class _Predicate>
-inline _LIBCPP_HIDE_FROM_ABI
- typename multiset<_Key, _Compare, _Allocator>::size_type
- erase_if(multiset<_Key, _Compare, _Allocator>& __c, _Predicate __pred) {
+inline _LIBCPP_HIDE_FROM_ABI typename multiset<_Key, _Compare, _Allocator>::size_type
+erase_if(multiset<_Key, _Compare, _Allocator>& __c, _Predicate __pred) {
return std::__libcpp_erase_if_container(__c, __pred);
}
#endif
diff --git a/contrib/llvm-project/libcxx/include/span b/contrib/llvm-project/libcxx/include/span
index f94bda40fa73..7dd53110ac29 100644
--- a/contrib/llvm-project/libcxx/include/span
+++ b/contrib/llvm-project/libcxx/include/span
@@ -144,8 +144,8 @@ template<class R>
#include <__type_traits/remove_reference.h>
#include <__type_traits/type_identity.h>
#include <__utility/forward.h>
-#include <array> // for array
-#include <cstddef> // for byte
+#include <array> // for array
+#include <cstddef> // for byte
#include <version>
// standard-mandated includes
@@ -182,19 +182,20 @@ struct __is_std_span<span<_Tp, _Sz>> : true_type {};
template <class _Range, class _ElementType>
concept __span_compatible_range =
- ranges::contiguous_range<_Range> && //
- ranges::sized_range<_Range> && //
- (ranges::borrowed_range<_Range> || is_const_v<_ElementType>) && //
- !__is_std_span<remove_cvref_t<_Range>>::value && //
- !__is_std_array<remove_cvref_t<_Range>>::value && //
- !is_array_v<remove_cvref_t<_Range>> && //
- is_convertible_v<remove_reference_t<ranges::range_reference_t<_Range>>(*)[], _ElementType(*)[]>;
+ ranges::contiguous_range<_Range> && //
+ ranges::sized_range<_Range> && //
+ (ranges::borrowed_range<_Range> || is_const_v<_ElementType>)&& //
+ !__is_std_span<remove_cvref_t<_Range>>::value && //
+ !__is_std_array<remove_cvref_t<_Range>>::value && //
+ !is_array_v<remove_cvref_t<_Range>> && //
+ is_convertible_v<remove_reference_t<ranges::range_reference_t<_Range>> (*)[], _ElementType (*)[]>;
template <class _From, class _To>
-concept __span_array_convertible = is_convertible_v<_From(*)[], _To(*)[]>;
+concept __span_array_convertible = is_convertible_v<_From (*)[], _To (*)[]>;
template <class _It, class _Tp>
-concept __span_compatible_iterator = contiguous_iterator<_It> && __span_array_convertible<remove_reference_t<iter_reference_t<_It>>, _Tp>;
+concept __span_compatible_iterator =
+ contiguous_iterator<_It> && __span_array_convertible<remove_reference_t<iter_reference_t<_It>>, _Tp>;
template <class _Sentinel, class _It>
concept __span_compatible_sentinel_for = sized_sentinel_for<_Sentinel, _It> && !is_convertible_v<_Sentinel, size_t>;
@@ -202,356 +203,313 @@ concept __span_compatible_sentinel_for = sized_sentinel_for<_Sentinel, _It> && !
template <typename _Tp, size_t _Extent>
class _LIBCPP_TEMPLATE_VIS span {
public:
-// constants and types
- using element_type = _Tp;
- using value_type = remove_cv_t<_Tp>;
- using size_type = size_t;
- using difference_type = ptrdiff_t;
- using pointer = _Tp *;
- using const_pointer = const _Tp *;
- using reference = _Tp &;
- using const_reference = const _Tp &;
-#ifdef _LIBCPP_ABI_BOUNDED_ITERATORS
- using iterator = __bounded_iter<pointer>;
-#else
- using iterator = __wrap_iter<pointer>;
-#endif
- using reverse_iterator = std::reverse_iterator<iterator>;
-
- static constexpr size_type extent = _Extent;
-
-// [span.cons], span constructors, copy, assignment, and destructor
- template <size_t _Sz = _Extent> requires(_Sz == 0)
- _LIBCPP_HIDE_FROM_ABI constexpr span() noexcept : __data_{nullptr} {}
-
- constexpr span (const span&) noexcept = default;
- constexpr span& operator=(const span&) noexcept = default;
-
- template <__span_compatible_iterator<element_type> _It>
- _LIBCPP_HIDE_FROM_ABI
- constexpr explicit span(_It __first, size_type __count)
- : __data_{std::to_address(__first)} {
- (void)__count;
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(_Extent == __count, "size mismatch in span's constructor (iterator, len)");
- }
-
- template <__span_compatible_iterator<element_type> _It, __span_compatible_sentinel_for<_It> _End>
- _LIBCPP_HIDE_FROM_ABI
- constexpr explicit span(_It __first, _End __last) : __data_{std::to_address(__first)} {
- // [span.cons]/10
- // Throws: When and what last - first throws.
- [[maybe_unused]] auto __dist = __last - __first;
- _LIBCPP_ASSERT_VALID_INPUT_RANGE(__dist >= 0, "invalid range in span's constructor (iterator, sentinel)");
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
- __dist == _Extent, "invalid range in span's constructor (iterator, sentinel): last - first != extent");
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr span(type_identity_t<element_type> (&__arr)[_Extent]) noexcept : __data_{__arr} {}
-
- template <__span_array_convertible<element_type> _OtherElementType>
- _LIBCPP_HIDE_FROM_ABI
- constexpr span(array<_OtherElementType, _Extent>& __arr) noexcept : __data_{__arr.data()} {}
-
- template <class _OtherElementType>
- requires __span_array_convertible<const _OtherElementType, element_type>
- _LIBCPP_HIDE_FROM_ABI
- constexpr span(const array<_OtherElementType, _Extent>& __arr) noexcept : __data_{__arr.data()} {}
-
- template <__span_compatible_range<element_type> _Range>
- _LIBCPP_HIDE_FROM_ABI
- constexpr explicit span(_Range&& __r) : __data_{ranges::data(__r)} {
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
- ranges::size(__r) == _Extent, "size mismatch in span's constructor (range)");
- }
-
- template <__span_array_convertible<element_type> _OtherElementType>
- _LIBCPP_HIDE_FROM_ABI
- constexpr span(const span<_OtherElementType, _Extent>& __other)
- : __data_{__other.data()} {}
-
- template <__span_array_convertible<element_type> _OtherElementType>
- _LIBCPP_HIDE_FROM_ABI
- constexpr explicit span(const span<_OtherElementType, dynamic_extent>& __other) noexcept
- : __data_{__other.data()} {
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
- _Extent == __other.size(), "size mismatch in span's constructor (other span)");
- }
-
- template <size_t _Count>
- _LIBCPP_HIDE_FROM_ABI
- constexpr span<element_type, _Count> first() const noexcept
- {
- static_assert(_Count <= _Extent, "span<T, N>::first<Count>(): Count out of range");
- return span<element_type, _Count>{data(), _Count};
- }
-
- template <size_t _Count>
- _LIBCPP_HIDE_FROM_ABI
- constexpr span<element_type, _Count> last() const noexcept
- {
- static_assert(_Count <= _Extent, "span<T, N>::last<Count>(): Count out of range");
- return span<element_type, _Count>{data() + size() - _Count, _Count};
- }
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr span<element_type, dynamic_extent> first(size_type __count) const noexcept
- {
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__count <= size(), "span<T, N>::first(count): count out of range");
- return {data(), __count};
- }
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr span<element_type, dynamic_extent> last(size_type __count) const noexcept
- {
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__count <= size(), "span<T, N>::last(count): count out of range");
- return {data() + size() - __count, __count};
- }
-
- template <size_t _Offset, size_t _Count = dynamic_extent>
- _LIBCPP_HIDE_FROM_ABI
- constexpr auto subspan() const noexcept
- -> span<element_type, _Count != dynamic_extent ? _Count : _Extent - _Offset>
- {
- static_assert(_Offset <= _Extent, "span<T, N>::subspan<Offset, Count>(): Offset out of range");
- static_assert(_Count == dynamic_extent || _Count <= _Extent - _Offset, "span<T, N>::subspan<Offset, Count>(): Offset + Count out of range");
-
- using _ReturnType = span<element_type, _Count != dynamic_extent ? _Count : _Extent - _Offset>;
- return _ReturnType{data() + _Offset, _Count == dynamic_extent ? size() - _Offset : _Count};
- }
-
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr span<element_type, dynamic_extent>
- subspan(size_type __offset, size_type __count = dynamic_extent) const noexcept
- {
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
- __offset <= size(), "span<T, N>::subspan(offset, count): offset out of range");
- if (__count == dynamic_extent)
- return {data() + __offset, size() - __offset};
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
- __count <= size() - __offset, "span<T, N>::subspan(offset, count): offset + count out of range");
- return {data() + __offset, __count};
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr size_type size() const noexcept { return _Extent; }
- _LIBCPP_HIDE_FROM_ABI constexpr size_type size_bytes() const noexcept { return _Extent * sizeof(element_type); }
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool empty() const noexcept { return _Extent == 0; }
-
- _LIBCPP_HIDE_FROM_ABI constexpr reference operator[](size_type __idx) const noexcept
- {
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__idx < size(), "span<T, N>::operator[](index): index out of range");
- return __data_[__idx];
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr reference front() const noexcept
- {
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(!empty(), "span<T, N>::front() on empty span");
- return __data_[0];
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr reference back() const noexcept
- {
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(!empty(), "span<T, N>::back() on empty span");
- return __data_[size()-1];
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr pointer data() const noexcept { return __data_; }
-
-// [span.iter], span iterator support
- _LIBCPP_HIDE_FROM_ABI constexpr iterator begin() const noexcept {
-#ifdef _LIBCPP_ABI_BOUNDED_ITERATORS
- return std::__make_bounded_iter(data(), data(), data() + size());
-#else
- return iterator(data());
-#endif
- }
- _LIBCPP_HIDE_FROM_ABI constexpr iterator end() const noexcept {
-#ifdef _LIBCPP_ABI_BOUNDED_ITERATORS
- return std::__make_bounded_iter(data() + size(), data(), data() + size());
-#else
- return iterator(data() + size());
-#endif
- }
- _LIBCPP_HIDE_FROM_ABI constexpr reverse_iterator rbegin() const noexcept { return reverse_iterator(end()); }
- _LIBCPP_HIDE_FROM_ABI constexpr reverse_iterator rend() const noexcept { return reverse_iterator(begin()); }
-
- _LIBCPP_HIDE_FROM_ABI span<const byte, _Extent * sizeof(element_type)> __as_bytes() const noexcept
- { return span<const byte, _Extent * sizeof(element_type)>{reinterpret_cast<const byte *>(data()), size_bytes()}; }
-
- _LIBCPP_HIDE_FROM_ABI span<byte, _Extent * sizeof(element_type)> __as_writable_bytes() const noexcept
- { return span<byte, _Extent * sizeof(element_type)>{reinterpret_cast<byte *>(data()), size_bytes()}; }
+ // constants and types
+ using element_type = _Tp;
+ using value_type = remove_cv_t<_Tp>;
+ using size_type = size_t;
+ using difference_type = ptrdiff_t;
+ using pointer = _Tp*;
+ using const_pointer = const _Tp*;
+ using reference = _Tp&;
+ using const_reference = const _Tp&;
+# ifdef _LIBCPP_ABI_BOUNDED_ITERATORS
+ using iterator = __bounded_iter<pointer>;
+# else
+ using iterator = __wrap_iter<pointer>;
+# endif
+ using reverse_iterator = std::reverse_iterator<iterator>;
+
+ static constexpr size_type extent = _Extent;
+
+ // [span.cons], span constructors, copy, assignment, and destructor
+ template <size_t _Sz = _Extent>
+ requires(_Sz == 0)
+ _LIBCPP_HIDE_FROM_ABI constexpr span() noexcept : __data_{nullptr} {}
+
+ constexpr span(const span&) noexcept = default;
+ constexpr span& operator=(const span&) noexcept = default;
+
+ template <__span_compatible_iterator<element_type> _It>
+ _LIBCPP_HIDE_FROM_ABI constexpr explicit span(_It __first, size_type __count) : __data_{std::to_address(__first)} {
+ (void)__count;
+ _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(_Extent == __count, "size mismatch in span's constructor (iterator, len)");
+ }
+
+ template <__span_compatible_iterator<element_type> _It, __span_compatible_sentinel_for<_It> _End>
+ _LIBCPP_HIDE_FROM_ABI constexpr explicit span(_It __first, _End __last) : __data_{std::to_address(__first)} {
+ // [span.cons]/10
+ // Throws: When and what last - first throws.
+ [[maybe_unused]] auto __dist = __last - __first;
+ _LIBCPP_ASSERT_VALID_INPUT_RANGE(__dist >= 0, "invalid range in span's constructor (iterator, sentinel)");
+ _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
+ __dist == _Extent, "invalid range in span's constructor (iterator, sentinel): last - first != extent");
+ }
+
+ _LIBCPP_HIDE_FROM_ABI constexpr span(type_identity_t<element_type> (&__arr)[_Extent]) noexcept : __data_{__arr} {}
+
+ template <__span_array_convertible<element_type> _OtherElementType>
+ _LIBCPP_HIDE_FROM_ABI constexpr span(array<_OtherElementType, _Extent>& __arr) noexcept : __data_{__arr.data()} {}
+
+ template <class _OtherElementType>
+ requires __span_array_convertible<const _OtherElementType, element_type>
+ _LIBCPP_HIDE_FROM_ABI constexpr span(const array<_OtherElementType, _Extent>& __arr) noexcept
+ : __data_{__arr.data()} {}
+
+ template <__span_compatible_range<element_type> _Range>
+ _LIBCPP_HIDE_FROM_ABI constexpr explicit span(_Range&& __r) : __data_{ranges::data(__r)} {
+ _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(ranges::size(__r) == _Extent, "size mismatch in span's constructor (range)");
+ }
+
+ template <__span_array_convertible<element_type> _OtherElementType>
+ _LIBCPP_HIDE_FROM_ABI constexpr span(const span<_OtherElementType, _Extent>& __other) : __data_{__other.data()} {}
+
+ template <__span_array_convertible<element_type> _OtherElementType>
+ _LIBCPP_HIDE_FROM_ABI constexpr explicit span(const span<_OtherElementType, dynamic_extent>& __other) noexcept
+ : __data_{__other.data()} {
+ _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(_Extent == __other.size(), "size mismatch in span's constructor (other span)");
+ }
+
+ template <size_t _Count>
+ _LIBCPP_HIDE_FROM_ABI constexpr span<element_type, _Count> first() const noexcept {
+ static_assert(_Count <= _Extent, "span<T, N>::first<Count>(): Count out of range");
+ return span<element_type, _Count>{data(), _Count};
+ }
+
+ template <size_t _Count>
+ _LIBCPP_HIDE_FROM_ABI constexpr span<element_type, _Count> last() const noexcept {
+ static_assert(_Count <= _Extent, "span<T, N>::last<Count>(): Count out of range");
+ return span<element_type, _Count>{data() + size() - _Count, _Count};
+ }
+
+ _LIBCPP_HIDE_FROM_ABI constexpr span<element_type, dynamic_extent> first(size_type __count) const noexcept {
+ _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__count <= size(), "span<T, N>::first(count): count out of range");
+ return {data(), __count};
+ }
+
+ _LIBCPP_HIDE_FROM_ABI constexpr span<element_type, dynamic_extent> last(size_type __count) const noexcept {
+ _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__count <= size(), "span<T, N>::last(count): count out of range");
+ return {data() + size() - __count, __count};
+ }
+
+ template <size_t _Offset, size_t _Count = dynamic_extent>
+ _LIBCPP_HIDE_FROM_ABI constexpr auto subspan() const noexcept
+ -> span<element_type, _Count != dynamic_extent ? _Count : _Extent - _Offset> {
+ static_assert(_Offset <= _Extent, "span<T, N>::subspan<Offset, Count>(): Offset out of range");
+ static_assert(_Count == dynamic_extent || _Count <= _Extent - _Offset,
+ "span<T, N>::subspan<Offset, Count>(): Offset + Count out of range");
+
+ using _ReturnType = span<element_type, _Count != dynamic_extent ? _Count : _Extent - _Offset>;
+ return _ReturnType{data() + _Offset, _Count == dynamic_extent ? size() - _Offset : _Count};
+ }
+
+ _LIBCPP_HIDE_FROM_ABI constexpr span<element_type, dynamic_extent>
+ subspan(size_type __offset, size_type __count = dynamic_extent) const noexcept {
+ _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__offset <= size(), "span<T, N>::subspan(offset, count): offset out of range");
+ if (__count == dynamic_extent)
+ return {data() + __offset, size() - __offset};
+ _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
+ __count <= size() - __offset, "span<T, N>::subspan(offset, count): offset + count out of range");
+ return {data() + __offset, __count};
+ }
+
+ _LIBCPP_HIDE_FROM_ABI constexpr size_type size() const noexcept { return _Extent; }
+ _LIBCPP_HIDE_FROM_ABI constexpr size_type size_bytes() const noexcept { return _Extent * sizeof(element_type); }
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool empty() const noexcept { return _Extent == 0; }
+
+ _LIBCPP_HIDE_FROM_ABI constexpr reference operator[](size_type __idx) const noexcept {
+ _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__idx < size(), "span<T, N>::operator[](index): index out of range");
+ return __data_[__idx];
+ }
+
+ _LIBCPP_HIDE_FROM_ABI constexpr reference front() const noexcept {
+ _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(!empty(), "span<T, N>::front() on empty span");
+ return __data_[0];
+ }
+
+ _LIBCPP_HIDE_FROM_ABI constexpr reference back() const noexcept {
+ _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(!empty(), "span<T, N>::back() on empty span");
+ return __data_[size() - 1];
+ }
+
+ _LIBCPP_HIDE_FROM_ABI constexpr pointer data() const noexcept { return __data_; }
+
+ // [span.iter], span iterator support
+ _LIBCPP_HIDE_FROM_ABI constexpr iterator begin() const noexcept {
+# ifdef _LIBCPP_ABI_BOUNDED_ITERATORS
+ return std::__make_bounded_iter(data(), data(), data() + size());
+# else
+ return iterator(data());
+# endif
+ }
+ _LIBCPP_HIDE_FROM_ABI constexpr iterator end() const noexcept {
+# ifdef _LIBCPP_ABI_BOUNDED_ITERATORS
+ return std::__make_bounded_iter(data() + size(), data(), data() + size());
+# else
+ return iterator(data() + size());
+# endif
+ }
+ _LIBCPP_HIDE_FROM_ABI constexpr reverse_iterator rbegin() const noexcept { return reverse_iterator(end()); }
+ _LIBCPP_HIDE_FROM_ABI constexpr reverse_iterator rend() const noexcept { return reverse_iterator(begin()); }
+
+ _LIBCPP_HIDE_FROM_ABI span<const byte, _Extent * sizeof(element_type)> __as_bytes() const noexcept {
+ return span<const byte, _Extent * sizeof(element_type)>{reinterpret_cast<const byte*>(data()), size_bytes()};
+ }
+
+ _LIBCPP_HIDE_FROM_ABI span<byte, _Extent * sizeof(element_type)> __as_writable_bytes() const noexcept {
+ return span<byte, _Extent * sizeof(element_type)>{reinterpret_cast<byte*>(data()), size_bytes()};
+ }
private:
- pointer __data_;
+ pointer __data_;
};
-
template <typename _Tp>
class _LIBCPP_TEMPLATE_VIS span<_Tp, dynamic_extent> {
public:
-// constants and types
- using element_type = _Tp;
- using value_type = remove_cv_t<_Tp>;
- using size_type = size_t;
- using difference_type = ptrdiff_t;
- using pointer = _Tp *;
- using const_pointer = const _Tp *;
- using reference = _Tp &;
- using const_reference = const _Tp &;
-#ifdef _LIBCPP_ABI_BOUNDED_ITERATORS
- using iterator = __bounded_iter<pointer>;
-#else
- using iterator = __wrap_iter<pointer>;
-#endif
- using reverse_iterator = std::reverse_iterator<iterator>;
-
- static constexpr size_type extent = dynamic_extent;
-
-// [span.cons], span constructors, copy, assignment, and destructor
- _LIBCPP_HIDE_FROM_ABI constexpr span() noexcept : __data_{nullptr}, __size_{0} {}
-
- constexpr span (const span&) noexcept = default;
- constexpr span& operator=(const span&) noexcept = default;
-
- template <__span_compatible_iterator<element_type> _It>
- _LIBCPP_HIDE_FROM_ABI
- constexpr span(_It __first, size_type __count)
- : __data_{std::to_address(__first)}, __size_{__count} {}
-
- template <__span_compatible_iterator<element_type> _It, __span_compatible_sentinel_for<_It> _End>
- _LIBCPP_HIDE_FROM_ABI constexpr span(_It __first, _End __last)
- : __data_(std::to_address(__first)), __size_(__last - __first) {
- _LIBCPP_ASSERT_VALID_INPUT_RANGE(
- __last - __first >= 0, "invalid range in span's constructor (iterator, sentinel)");
- }
-
- template <size_t _Sz>
- _LIBCPP_HIDE_FROM_ABI
- constexpr span(type_identity_t<element_type> (&__arr)[_Sz]) noexcept : __data_{__arr}, __size_{_Sz} {}
-
- template <__span_array_convertible<element_type> _OtherElementType, size_t _Sz>
- _LIBCPP_HIDE_FROM_ABI
- constexpr span(array<_OtherElementType, _Sz>& __arr) noexcept : __data_{__arr.data()}, __size_{_Sz} {}
-
- template <class _OtherElementType, size_t _Sz>
- requires __span_array_convertible<const _OtherElementType, element_type>
- _LIBCPP_HIDE_FROM_ABI
- constexpr span(const array<_OtherElementType, _Sz>& __arr) noexcept : __data_{__arr.data()}, __size_{_Sz} {}
-
- template <__span_compatible_range<element_type> _Range>
- _LIBCPP_HIDE_FROM_ABI
- constexpr span(_Range&& __r) : __data_(ranges::data(__r)), __size_{ranges::size(__r)} {}
-
- template <__span_array_convertible<element_type> _OtherElementType, size_t _OtherExtent>
- _LIBCPP_HIDE_FROM_ABI
- constexpr span(const span<_OtherElementType, _OtherExtent>& __other) noexcept
- : __data_{__other.data()}, __size_{__other.size()} {}
-
- template <size_t _Count>
- _LIBCPP_HIDE_FROM_ABI
- constexpr span<element_type, _Count> first() const noexcept
- {
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(_Count <= size(), "span<T>::first<Count>(): Count out of range");
- return span<element_type, _Count>{data(), _Count};
- }
-
- template <size_t _Count>
- _LIBCPP_HIDE_FROM_ABI
- constexpr span<element_type, _Count> last() const noexcept
- {
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(_Count <= size(), "span<T>::last<Count>(): Count out of range");
- return span<element_type, _Count>{data() + size() - _Count, _Count};
- }
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr span<element_type, dynamic_extent> first(size_type __count) const noexcept
- {
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__count <= size(), "span<T>::first(count): count out of range");
- return {data(), __count};
- }
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr span<element_type, dynamic_extent> last (size_type __count) const noexcept
- {
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__count <= size(), "span<T>::last(count): count out of range");
- return {data() + size() - __count, __count};
- }
-
- template <size_t _Offset, size_t _Count = dynamic_extent>
- _LIBCPP_HIDE_FROM_ABI
- constexpr span<element_type, _Count> subspan() const noexcept
- {
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
- _Offset <= size(), "span<T>::subspan<Offset, Count>(): Offset out of range");
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(_Count == dynamic_extent || _Count <= size() - _Offset,
- "span<T>::subspan<Offset, Count>(): Offset + Count out of range");
- return span<element_type, _Count>{data() + _Offset, _Count == dynamic_extent ? size() - _Offset : _Count};
- }
-
- constexpr span<element_type, dynamic_extent>
- _LIBCPP_HIDE_FROM_ABI
- subspan(size_type __offset, size_type __count = dynamic_extent) const noexcept
- {
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__offset <= size(), "span<T>::subspan(offset, count): offset out of range");
- if (__count == dynamic_extent)
- return {data() + __offset, size() - __offset};
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
- __count <= size() - __offset, "span<T>::subspan(offset, count): offset + count out of range");
- return {data() + __offset, __count};
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr size_type size() const noexcept { return __size_; }
- _LIBCPP_HIDE_FROM_ABI constexpr size_type size_bytes() const noexcept { return __size_ * sizeof(element_type); }
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool empty() const noexcept { return __size_ == 0; }
-
- _LIBCPP_HIDE_FROM_ABI constexpr reference operator[](size_type __idx) const noexcept
- {
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__idx < size(), "span<T>::operator[](index): index out of range");
- return __data_[__idx];
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr reference front() const noexcept
- {
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(!empty(), "span<T>::front() on empty span");
- return __data_[0];
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr reference back() const noexcept
- {
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(!empty(), "span<T>::back() on empty span");
- return __data_[size()-1];
- }
-
-
- _LIBCPP_HIDE_FROM_ABI constexpr pointer data() const noexcept { return __data_; }
-
-// [span.iter], span iterator support
- _LIBCPP_HIDE_FROM_ABI constexpr iterator begin() const noexcept {
-#ifdef _LIBCPP_ABI_BOUNDED_ITERATORS
- return std::__make_bounded_iter(data(), data(), data() + size());
-#else
- return iterator(data());
-#endif
- }
- _LIBCPP_HIDE_FROM_ABI constexpr iterator end() const noexcept {
-#ifdef _LIBCPP_ABI_BOUNDED_ITERATORS
- return std::__make_bounded_iter(data() + size(), data(), data() + size());
-#else
- return iterator(data() + size());
-#endif
- }
- _LIBCPP_HIDE_FROM_ABI constexpr reverse_iterator rbegin() const noexcept { return reverse_iterator(end()); }
- _LIBCPP_HIDE_FROM_ABI constexpr reverse_iterator rend() const noexcept { return reverse_iterator(begin()); }
-
- _LIBCPP_HIDE_FROM_ABI span<const byte, dynamic_extent> __as_bytes() const noexcept
- { return {reinterpret_cast<const byte *>(data()), size_bytes()}; }
-
- _LIBCPP_HIDE_FROM_ABI span<byte, dynamic_extent> __as_writable_bytes() const noexcept
- { return {reinterpret_cast<byte *>(data()), size_bytes()}; }
+ // constants and types
+ using element_type = _Tp;
+ using value_type = remove_cv_t<_Tp>;
+ using size_type = size_t;
+ using difference_type = ptrdiff_t;
+ using pointer = _Tp*;
+ using const_pointer = const _Tp*;
+ using reference = _Tp&;
+ using const_reference = const _Tp&;
+# ifdef _LIBCPP_ABI_BOUNDED_ITERATORS
+ using iterator = __bounded_iter<pointer>;
+# else
+ using iterator = __wrap_iter<pointer>;
+# endif
+ using reverse_iterator = std::reverse_iterator<iterator>;
+
+ static constexpr size_type extent = dynamic_extent;
+
+ // [span.cons], span constructors, copy, assignment, and destructor
+ _LIBCPP_HIDE_FROM_ABI constexpr span() noexcept : __data_{nullptr}, __size_{0} {}
+
+ constexpr span(const span&) noexcept = default;
+ constexpr span& operator=(const span&) noexcept = default;
+
+ template <__span_compatible_iterator<element_type> _It>
+ _LIBCPP_HIDE_FROM_ABI constexpr span(_It __first, size_type __count)
+ : __data_{std::to_address(__first)}, __size_{__count} {}
+
+ template <__span_compatible_iterator<element_type> _It, __span_compatible_sentinel_for<_It> _End>
+ _LIBCPP_HIDE_FROM_ABI constexpr span(_It __first, _End __last)
+ : __data_(std::to_address(__first)), __size_(__last - __first) {
+ _LIBCPP_ASSERT_VALID_INPUT_RANGE(__last - __first >= 0, "invalid range in span's constructor (iterator, sentinel)");
+ }
+
+ template <size_t _Sz>
+ _LIBCPP_HIDE_FROM_ABI constexpr span(type_identity_t<element_type> (&__arr)[_Sz]) noexcept
+ : __data_{__arr}, __size_{_Sz} {}
+
+ template <__span_array_convertible<element_type> _OtherElementType, size_t _Sz>
+ _LIBCPP_HIDE_FROM_ABI constexpr span(array<_OtherElementType, _Sz>& __arr) noexcept
+ : __data_{__arr.data()}, __size_{_Sz} {}
+
+ template <class _OtherElementType, size_t _Sz>
+ requires __span_array_convertible<const _OtherElementType, element_type>
+ _LIBCPP_HIDE_FROM_ABI constexpr span(const array<_OtherElementType, _Sz>& __arr) noexcept
+ : __data_{__arr.data()}, __size_{_Sz} {}
+
+ template <__span_compatible_range<element_type> _Range>
+ _LIBCPP_HIDE_FROM_ABI constexpr span(_Range&& __r) : __data_(ranges::data(__r)), __size_{ranges::size(__r)} {}
+
+ template <__span_array_convertible<element_type> _OtherElementType, size_t _OtherExtent>
+ _LIBCPP_HIDE_FROM_ABI constexpr span(const span<_OtherElementType, _OtherExtent>& __other) noexcept
+ : __data_{__other.data()}, __size_{__other.size()} {}
+
+ template <size_t _Count>
+ _LIBCPP_HIDE_FROM_ABI constexpr span<element_type, _Count> first() const noexcept {
+ _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(_Count <= size(), "span<T>::first<Count>(): Count out of range");
+ return span<element_type, _Count>{data(), _Count};
+ }
+
+ template <size_t _Count>
+ _LIBCPP_HIDE_FROM_ABI constexpr span<element_type, _Count> last() const noexcept {
+ _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(_Count <= size(), "span<T>::last<Count>(): Count out of range");
+ return span<element_type, _Count>{data() + size() - _Count, _Count};
+ }
+
+ _LIBCPP_HIDE_FROM_ABI constexpr span<element_type, dynamic_extent> first(size_type __count) const noexcept {
+ _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__count <= size(), "span<T>::first(count): count out of range");
+ return {data(), __count};
+ }
+
+ _LIBCPP_HIDE_FROM_ABI constexpr span<element_type, dynamic_extent> last(size_type __count) const noexcept {
+ _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__count <= size(), "span<T>::last(count): count out of range");
+ return {data() + size() - __count, __count};
+ }
+
+ template <size_t _Offset, size_t _Count = dynamic_extent>
+ _LIBCPP_HIDE_FROM_ABI constexpr span<element_type, _Count> subspan() const noexcept {
+ _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(_Offset <= size(), "span<T>::subspan<Offset, Count>(): Offset out of range");
+ _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(_Count == dynamic_extent || _Count <= size() - _Offset,
+ "span<T>::subspan<Offset, Count>(): Offset + Count out of range");
+ return span<element_type, _Count>{data() + _Offset, _Count == dynamic_extent ? size() - _Offset : _Count};
+ }
+
+ constexpr span<element_type, dynamic_extent> _LIBCPP_HIDE_FROM_ABI
+ subspan(size_type __offset, size_type __count = dynamic_extent) const noexcept {
+ _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__offset <= size(), "span<T>::subspan(offset, count): offset out of range");
+ if (__count == dynamic_extent)
+ return {data() + __offset, size() - __offset};
+ _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
+ __count <= size() - __offset, "span<T>::subspan(offset, count): offset + count out of range");
+ return {data() + __offset, __count};
+ }
+
+ _LIBCPP_HIDE_FROM_ABI constexpr size_type size() const noexcept { return __size_; }
+ _LIBCPP_HIDE_FROM_ABI constexpr size_type size_bytes() const noexcept { return __size_ * sizeof(element_type); }
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool empty() const noexcept { return __size_ == 0; }
+
+ _LIBCPP_HIDE_FROM_ABI constexpr reference operator[](size_type __idx) const noexcept {
+ _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__idx < size(), "span<T>::operator[](index): index out of range");
+ return __data_[__idx];
+ }
+
+ _LIBCPP_HIDE_FROM_ABI constexpr reference front() const noexcept {
+ _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(!empty(), "span<T>::front() on empty span");
+ return __data_[0];
+ }
+
+ _LIBCPP_HIDE_FROM_ABI constexpr reference back() const noexcept {
+ _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(!empty(), "span<T>::back() on empty span");
+ return __data_[size() - 1];
+ }
+
+ _LIBCPP_HIDE_FROM_ABI constexpr pointer data() const noexcept { return __data_; }
+
+ // [span.iter], span iterator support
+ _LIBCPP_HIDE_FROM_ABI constexpr iterator begin() const noexcept {
+# ifdef _LIBCPP_ABI_BOUNDED_ITERATORS
+ return std::__make_bounded_iter(data(), data(), data() + size());
+# else
+ return iterator(data());
+# endif
+ }
+ _LIBCPP_HIDE_FROM_ABI constexpr iterator end() const noexcept {
+# ifdef _LIBCPP_ABI_BOUNDED_ITERATORS
+ return std::__make_bounded_iter(data() + size(), data(), data() + size());
+# else
+ return iterator(data() + size());
+# endif
+ }
+ _LIBCPP_HIDE_FROM_ABI constexpr reverse_iterator rbegin() const noexcept { return reverse_iterator(end()); }
+ _LIBCPP_HIDE_FROM_ABI constexpr reverse_iterator rend() const noexcept { return reverse_iterator(begin()); }
+
+ _LIBCPP_HIDE_FROM_ABI span<const byte, dynamic_extent> __as_bytes() const noexcept {
+ return {reinterpret_cast<const byte*>(data()), size_bytes()};
+ }
+
+ _LIBCPP_HIDE_FROM_ABI span<byte, dynamic_extent> __as_writable_bytes() const noexcept {
+ return {reinterpret_cast<byte*>(data()), size_bytes()};
+ }
private:
- pointer __data_;
- size_type __size_;
+ pointer __data_;
+ size_type __size_;
};
template <class _Tp, size_t _Extent>
@@ -562,31 +520,32 @@ inline constexpr bool ranges::enable_view<span<_ElementType, _Extent>> = true;
// as_bytes & as_writable_bytes
template <class _Tp, size_t _Extent>
-_LIBCPP_HIDE_FROM_ABI
-auto as_bytes(span<_Tp, _Extent> __s) noexcept
-{ return __s.__as_bytes(); }
+_LIBCPP_HIDE_FROM_ABI auto as_bytes(span<_Tp, _Extent> __s) noexcept {
+ return __s.__as_bytes();
+}
-template <class _Tp, size_t _Extent> requires(!is_const_v<_Tp>)
-_LIBCPP_HIDE_FROM_ABI
-auto as_writable_bytes(span<_Tp, _Extent> __s) noexcept
-{ return __s.__as_writable_bytes(); }
+template <class _Tp, size_t _Extent>
+ requires(!is_const_v<_Tp>)
+_LIBCPP_HIDE_FROM_ABI auto as_writable_bytes(span<_Tp, _Extent> __s) noexcept {
+ return __s.__as_writable_bytes();
+}
-#if _LIBCPP_STD_VER >= 20
-template<contiguous_iterator _It, class _EndOrSize>
- span(_It, _EndOrSize) -> span<remove_reference_t<iter_reference_t<_It>>>;
-#endif // _LIBCPP_STD_VER >= 20
+# if _LIBCPP_STD_VER >= 20
+template <contiguous_iterator _It, class _EndOrSize>
+span(_It, _EndOrSize) -> span<remove_reference_t<iter_reference_t<_It>>>;
+# endif // _LIBCPP_STD_VER >= 20
-template<class _Tp, size_t _Sz>
- span(_Tp (&)[_Sz]) -> span<_Tp, _Sz>;
+template <class _Tp, size_t _Sz>
+span(_Tp (&)[_Sz]) -> span<_Tp, _Sz>;
-template<class _Tp, size_t _Sz>
- span(array<_Tp, _Sz>&) -> span<_Tp, _Sz>;
+template <class _Tp, size_t _Sz>
+span(array<_Tp, _Sz>&) -> span<_Tp, _Sz>;
-template<class _Tp, size_t _Sz>
- span(const array<_Tp, _Sz>&) -> span<const _Tp, _Sz>;
+template <class _Tp, size_t _Sz>
+span(const array<_Tp, _Sz>&) -> span<const _Tp, _Sz>;
-template<ranges::contiguous_range _Range>
- span(_Range&&) -> span<remove_reference_t<ranges::range_reference_t<_Range>>>;
+template <ranges::contiguous_range _Range>
+span(_Range&&) -> span<remove_reference_t<ranges::range_reference_t<_Range>>>;
#endif // _LIBCPP_STD_VER >= 20
diff --git a/contrib/llvm-project/libcxx/include/sstream b/contrib/llvm-project/libcxx/include/sstream
index 0f4fb33a66fd..bd5cea9a5e94 100644
--- a/contrib/llvm-project/libcxx/include/sstream
+++ b/contrib/llvm-project/libcxx/include/sstream
@@ -287,13 +287,12 @@ typedef basic_stringstream<wchar_t> wstringstream;
_LIBCPP_PUSH_MACROS
#include <__undef_macros>
-
// TODO(LLVM-19): Remove this once we drop support for Clang 16,
// which had this bug: https://github.com/llvm/llvm-project/issues/40363
#ifdef _WIN32
-#define _LIBCPP_HIDE_FROM_ABI_SSTREAM _LIBCPP_ALWAYS_INLINE
+# define _LIBCPP_HIDE_FROM_ABI_SSTREAM _LIBCPP_ALWAYS_INLINE
#else
-#define _LIBCPP_HIDE_FROM_ABI_SSTREAM _LIBCPP_HIDE_FROM_ABI
+# define _LIBCPP_HIDE_FROM_ABI_SSTREAM _LIBCPP_HIDE_FROM_ABI
#endif
_LIBCPP_BEGIN_NAMESPACE_STD
@@ -301,900 +300,801 @@ _LIBCPP_BEGIN_NAMESPACE_STD
// Class template basic_stringbuf [stringbuf]
template <class _CharT, class _Traits, class _Allocator>
-class _LIBCPP_TEMPLATE_VIS basic_stringbuf
- : public basic_streambuf<_CharT, _Traits>
-{
+class _LIBCPP_TEMPLATE_VIS basic_stringbuf : public basic_streambuf<_CharT, _Traits> {
public:
- typedef _CharT char_type;
- typedef _Traits traits_type;
- typedef typename traits_type::int_type int_type;
- typedef typename traits_type::pos_type pos_type;
- typedef typename traits_type::off_type off_type;
- typedef _Allocator allocator_type;
+ typedef _CharT char_type;
+ typedef _Traits traits_type;
+ typedef typename traits_type::int_type int_type;
+ typedef typename traits_type::pos_type pos_type;
+ typedef typename traits_type::off_type off_type;
+ typedef _Allocator allocator_type;
- typedef basic_string<char_type, traits_type, allocator_type> string_type;
+ typedef basic_string<char_type, traits_type, allocator_type> string_type;
private:
-
- string_type __str_;
- mutable char_type* __hm_;
- ios_base::openmode __mode_;
- _LIBCPP_HIDE_FROM_ABI void __init_buf_ptrs();
- _LIBCPP_HIDE_FROM_ABI void __move_init(basic_stringbuf&& __rhs);
+ string_type __str_;
+ mutable char_type* __hm_;
+ ios_base::openmode __mode_;
+ _LIBCPP_HIDE_FROM_ABI void __init_buf_ptrs();
+ _LIBCPP_HIDE_FROM_ABI void __move_init(basic_stringbuf&& __rhs);
public:
- // [stringbuf.cons] constructors:
- _LIBCPP_HIDE_FROM_ABI
- basic_stringbuf()
- : __hm_(nullptr), __mode_(ios_base::in | ios_base::out) {}
-
- _LIBCPP_HIDE_FROM_ABI
- explicit basic_stringbuf(ios_base::openmode __wch)
- : __hm_(nullptr), __mode_(__wch) {}
-
- _LIBCPP_HIDE_FROM_ABI
- explicit basic_stringbuf(const string_type& __s,
- ios_base::openmode __wch = ios_base::in | ios_base::out)
- : __str_(__s.get_allocator()), __hm_(nullptr), __mode_(__wch)
- {
- str(__s);
- }
+ // [stringbuf.cons] constructors:
+ _LIBCPP_HIDE_FROM_ABI basic_stringbuf() : __hm_(nullptr), __mode_(ios_base::in | ios_base::out) {}
-#if _LIBCPP_STD_VER >= 20
- _LIBCPP_HIDE_FROM_ABI explicit basic_stringbuf(const allocator_type& __a)
- : basic_stringbuf(ios_base::in | ios_base::out, __a) {}
-
- _LIBCPP_HIDE_FROM_ABI basic_stringbuf(ios_base::openmode __wch, const allocator_type& __a)
- : __str_(__a), __hm_(nullptr), __mode_(__wch) {}
-
- _LIBCPP_HIDE_FROM_ABI explicit basic_stringbuf(string_type&& __s,
- ios_base::openmode __wch = ios_base::in | ios_base::out)
- : __str_(std::move(__s)), __hm_(nullptr), __mode_(__wch) {
- __init_buf_ptrs();
- }
+ _LIBCPP_HIDE_FROM_ABI explicit basic_stringbuf(ios_base::openmode __wch) : __hm_(nullptr), __mode_(__wch) {}
- template <class _SAlloc>
- _LIBCPP_HIDE_FROM_ABI
- basic_stringbuf(const basic_string<char_type, traits_type, _SAlloc>& __s, const allocator_type& __a)
- : basic_stringbuf(__s, ios_base::in | ios_base::out, __a) {}
+ _LIBCPP_HIDE_FROM_ABI explicit basic_stringbuf(const string_type& __s,
+ ios_base::openmode __wch = ios_base::in | ios_base::out)
+ : __str_(__s.get_allocator()), __hm_(nullptr), __mode_(__wch) {
+ str(__s);
+ }
- template <class _SAlloc>
- _LIBCPP_HIDE_FROM_ABI basic_stringbuf(
- const basic_string<char_type, traits_type, _SAlloc>& __s, ios_base::openmode __wch, const allocator_type& __a)
- : __str_(__s, __a), __hm_(nullptr), __mode_(__wch) {
- __init_buf_ptrs();
- }
-
- template <class _SAlloc>
- requires (!is_same_v<_SAlloc, allocator_type>)
- _LIBCPP_HIDE_FROM_ABI explicit basic_stringbuf(const basic_string<char_type, traits_type, _SAlloc>& __s,
- ios_base::openmode __wch = ios_base::in | ios_base::out)
- : __str_(__s), __hm_(nullptr), __mode_(__wch) {
- __init_buf_ptrs();
- }
+#if _LIBCPP_STD_VER >= 20
+ _LIBCPP_HIDE_FROM_ABI explicit basic_stringbuf(const allocator_type& __a)
+ : basic_stringbuf(ios_base::in | ios_base::out, __a) {}
+
+ _LIBCPP_HIDE_FROM_ABI basic_stringbuf(ios_base::openmode __wch, const allocator_type& __a)
+ : __str_(__a), __hm_(nullptr), __mode_(__wch) {}
+
+ _LIBCPP_HIDE_FROM_ABI explicit basic_stringbuf(string_type&& __s,
+ ios_base::openmode __wch = ios_base::in | ios_base::out)
+ : __str_(std::move(__s)), __hm_(nullptr), __mode_(__wch) {
+ __init_buf_ptrs();
+ }
+
+ template <class _SAlloc>
+ _LIBCPP_HIDE_FROM_ABI
+ basic_stringbuf(const basic_string<char_type, traits_type, _SAlloc>& __s, const allocator_type& __a)
+ : basic_stringbuf(__s, ios_base::in | ios_base::out, __a) {}
+
+ template <class _SAlloc>
+ _LIBCPP_HIDE_FROM_ABI basic_stringbuf(
+ const basic_string<char_type, traits_type, _SAlloc>& __s, ios_base::openmode __wch, const allocator_type& __a)
+ : __str_(__s, __a), __hm_(nullptr), __mode_(__wch) {
+ __init_buf_ptrs();
+ }
+
+ template <class _SAlloc>
+ requires(!is_same_v<_SAlloc, allocator_type>)
+ _LIBCPP_HIDE_FROM_ABI explicit basic_stringbuf(const basic_string<char_type, traits_type, _SAlloc>& __s,
+ ios_base::openmode __wch = ios_base::in | ios_base::out)
+ : __str_(__s), __hm_(nullptr), __mode_(__wch) {
+ __init_buf_ptrs();
+ }
#endif // _LIBCPP_STD_VER >= 20
- basic_stringbuf(basic_stringbuf&& __rhs) : __mode_(__rhs.__mode_) { __move_init(std::move(__rhs)); }
+ basic_stringbuf(basic_stringbuf&& __rhs) : __mode_(__rhs.__mode_) { __move_init(std::move(__rhs)); }
#if _LIBCPP_STD_VER >= 20
- _LIBCPP_HIDE_FROM_ABI basic_stringbuf(basic_stringbuf&& __rhs, const allocator_type& __a)
- : basic_stringbuf(__rhs.__mode_, __a) {
- __move_init(std::move(__rhs));
- }
+ _LIBCPP_HIDE_FROM_ABI basic_stringbuf(basic_stringbuf&& __rhs, const allocator_type& __a)
+ : basic_stringbuf(__rhs.__mode_, __a) {
+ __move_init(std::move(__rhs));
+ }
#endif
- // [stringbuf.assign] Assign and swap:
- basic_stringbuf& operator=(basic_stringbuf&& __rhs);
- void swap(basic_stringbuf& __rhs)
+ // [stringbuf.assign] Assign and swap:
+ basic_stringbuf& operator=(basic_stringbuf&& __rhs);
+ void swap(basic_stringbuf& __rhs)
#if _LIBCPP_STD_VER >= 20
- noexcept(allocator_traits<allocator_type>::propagate_on_container_swap::value ||
- allocator_traits<allocator_type>::is_always_equal::value)
+ noexcept(allocator_traits<allocator_type>::propagate_on_container_swap::value ||
+ allocator_traits<allocator_type>::is_always_equal::value)
#endif
- ;
+ ;
- // [stringbuf.members] Member functions:
+ // [stringbuf.members] Member functions:
#if _LIBCPP_STD_VER >= 20
- _LIBCPP_HIDE_FROM_ABI allocator_type get_allocator() const noexcept { return __str_.get_allocator(); }
+ _LIBCPP_HIDE_FROM_ABI allocator_type get_allocator() const noexcept { return __str_.get_allocator(); }
#endif
#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_BUILDING_LIBRARY)
- string_type str() const;
+ string_type str() const;
#else
- _LIBCPP_HIDE_FROM_ABI_SSTREAM string_type str() const & { return str(__str_.get_allocator()); }
-
- _LIBCPP_HIDE_FROM_ABI_SSTREAM string_type str() && {
- const basic_string_view<_CharT, _Traits> __view = view();
- typename string_type::size_type __pos = __view.empty() ? 0 : __view.data() - __str_.data();
- // In C++23, this is just string_type(std::move(__str_), __pos, __view.size(), __str_.get_allocator());
- // But we need something that works in C++20 also.
- string_type __result(__str_.get_allocator());
- __result.__move_assign(std::move(__str_), __pos, __view.size());
- __str_.clear();
- __init_buf_ptrs();
- return __result;
- }
+ _LIBCPP_HIDE_FROM_ABI_SSTREAM string_type str() const& { return str(__str_.get_allocator()); }
+
+ _LIBCPP_HIDE_FROM_ABI_SSTREAM string_type str() && {
+ const basic_string_view<_CharT, _Traits> __view = view();
+ typename string_type::size_type __pos = __view.empty() ? 0 : __view.data() - __str_.data();
+ // In C++23, this is just string_type(std::move(__str_), __pos, __view.size(), __str_.get_allocator());
+ // But we need something that works in C++20 also.
+ string_type __result(__str_.get_allocator());
+ __result.__move_assign(std::move(__str_), __pos, __view.size());
+ __str_.clear();
+ __init_buf_ptrs();
+ return __result;
+ }
#endif // _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_BUILDING_LIBRARY)
#if _LIBCPP_STD_VER >= 20
- template <class _SAlloc>
- requires __is_allocator<_SAlloc>::value
- _LIBCPP_HIDE_FROM_ABI basic_string<char_type, traits_type, _SAlloc> str(const _SAlloc& __sa) const {
- return basic_string<_CharT, _Traits, _SAlloc>(view(), __sa);
- }
+ template <class _SAlloc>
+ requires __is_allocator<_SAlloc>::value
+ _LIBCPP_HIDE_FROM_ABI basic_string<char_type, traits_type, _SAlloc> str(const _SAlloc& __sa) const {
+ return basic_string<_CharT, _Traits, _SAlloc>(view(), __sa);
+ }
- _LIBCPP_HIDE_FROM_ABI basic_string_view<char_type, traits_type> view() const noexcept;
+ _LIBCPP_HIDE_FROM_ABI basic_string_view<char_type, traits_type> view() const noexcept;
#endif // _LIBCPP_STD_VER >= 20
- void str(const string_type& __s) {
- __str_ = __s;
- __init_buf_ptrs();
- }
+ void str(const string_type& __s) {
+ __str_ = __s;
+ __init_buf_ptrs();
+ }
#if _LIBCPP_STD_VER >= 20
- template <class _SAlloc>
- requires (!is_same_v<_SAlloc, allocator_type>)
- _LIBCPP_HIDE_FROM_ABI void str(const basic_string<char_type, traits_type, _SAlloc>& __s) {
- __str_ = __s;
- __init_buf_ptrs();
- }
-
- _LIBCPP_HIDE_FROM_ABI void str(string_type&& __s) {
- __str_ = std::move(__s);
- __init_buf_ptrs();
- }
+ template <class _SAlloc>
+ requires(!is_same_v<_SAlloc, allocator_type>)
+ _LIBCPP_HIDE_FROM_ABI void str(const basic_string<char_type, traits_type, _SAlloc>& __s) {
+ __str_ = __s;
+ __init_buf_ptrs();
+ }
+
+ _LIBCPP_HIDE_FROM_ABI void str(string_type&& __s) {
+ __str_ = std::move(__s);
+ __init_buf_ptrs();
+ }
#endif // _LIBCPP_STD_VER >= 20
protected:
- // [stringbuf.virtuals] Overridden virtual functions:
- int_type underflow() override;
- int_type pbackfail(int_type __c = traits_type::eof()) override;
- int_type overflow (int_type __c = traits_type::eof()) override;
- pos_type seekoff(off_type __off, ios_base::seekdir __way,
- ios_base::openmode __wch = ios_base::in | ios_base::out) override;
- _LIBCPP_HIDE_FROM_ABI_VIRTUAL
- pos_type seekpos(pos_type __sp,
- ios_base::openmode __wch = ios_base::in | ios_base::out) override {
- return seekoff(__sp, ios_base::beg, __wch);
- }
+ // [stringbuf.virtuals] Overridden virtual functions:
+ int_type underflow() override;
+ int_type pbackfail(int_type __c = traits_type::eof()) override;
+ int_type overflow(int_type __c = traits_type::eof()) override;
+ pos_type
+ seekoff(off_type __off, ios_base::seekdir __way, ios_base::openmode __wch = ios_base::in | ios_base::out) override;
+ _LIBCPP_HIDE_FROM_ABI_VIRTUAL
+ pos_type seekpos(pos_type __sp, ios_base::openmode __wch = ios_base::in | ios_base::out) override {
+ return seekoff(__sp, ios_base::beg, __wch);
+ }
};
template <class _CharT, class _Traits, class _Allocator>
_LIBCPP_HIDE_FROM_ABI void basic_stringbuf<_CharT, _Traits, _Allocator>::__move_init(basic_stringbuf&& __rhs) {
- char_type* __p = const_cast<char_type*>(__rhs.__str_.data());
- ptrdiff_t __binp = -1;
- ptrdiff_t __ninp = -1;
- ptrdiff_t __einp = -1;
- if (__rhs.eback() != nullptr)
- {
- __binp = __rhs.eback() - __p;
- __ninp = __rhs.gptr() - __p;
- __einp = __rhs.egptr() - __p;
- }
- ptrdiff_t __bout = -1;
- ptrdiff_t __nout = -1;
- ptrdiff_t __eout = -1;
- if (__rhs.pbase() != nullptr)
- {
- __bout = __rhs.pbase() - __p;
- __nout = __rhs.pptr() - __p;
- __eout = __rhs.epptr() - __p;
- }
- ptrdiff_t __hm = __rhs.__hm_ == nullptr ? -1 : __rhs.__hm_ - __p;
- __str_ = std::move(__rhs.__str_);
- __p = const_cast<char_type*>(__str_.data());
- if (__binp != -1)
- this->setg(__p + __binp, __p + __ninp, __p + __einp);
- if (__bout != -1)
- {
- this->setp(__p + __bout, __p + __eout);
- this->__pbump(__nout);
- }
- __hm_ = __hm == -1 ? nullptr : __p + __hm;
- __p = const_cast<char_type*>(__rhs.__str_.data());
- __rhs.setg(__p, __p, __p);
- __rhs.setp(__p, __p);
- __rhs.__hm_ = __p;
- this->pubimbue(__rhs.getloc());
+ char_type* __p = const_cast<char_type*>(__rhs.__str_.data());
+ ptrdiff_t __binp = -1;
+ ptrdiff_t __ninp = -1;
+ ptrdiff_t __einp = -1;
+ if (__rhs.eback() != nullptr) {
+ __binp = __rhs.eback() - __p;
+ __ninp = __rhs.gptr() - __p;
+ __einp = __rhs.egptr() - __p;
+ }
+ ptrdiff_t __bout = -1;
+ ptrdiff_t __nout = -1;
+ ptrdiff_t __eout = -1;
+ if (__rhs.pbase() != nullptr) {
+ __bout = __rhs.pbase() - __p;
+ __nout = __rhs.pptr() - __p;
+ __eout = __rhs.epptr() - __p;
+ }
+ ptrdiff_t __hm = __rhs.__hm_ == nullptr ? -1 : __rhs.__hm_ - __p;
+ __str_ = std::move(__rhs.__str_);
+ __p = const_cast<char_type*>(__str_.data());
+ if (__binp != -1)
+ this->setg(__p + __binp, __p + __ninp, __p + __einp);
+ if (__bout != -1) {
+ this->setp(__p + __bout, __p + __eout);
+ this->__pbump(__nout);
+ }
+ __hm_ = __hm == -1 ? nullptr : __p + __hm;
+ __p = const_cast<char_type*>(__rhs.__str_.data());
+ __rhs.setg(__p, __p, __p);
+ __rhs.setp(__p, __p);
+ __rhs.__hm_ = __p;
+ this->pubimbue(__rhs.getloc());
}
template <class _CharT, class _Traits, class _Allocator>
basic_stringbuf<_CharT, _Traits, _Allocator>&
-basic_stringbuf<_CharT, _Traits, _Allocator>::operator=(basic_stringbuf&& __rhs)
-{
- char_type* __p = const_cast<char_type*>(__rhs.__str_.data());
- ptrdiff_t __binp = -1;
- ptrdiff_t __ninp = -1;
- ptrdiff_t __einp = -1;
- if (__rhs.eback() != nullptr)
- {
- __binp = __rhs.eback() - __p;
- __ninp = __rhs.gptr() - __p;
- __einp = __rhs.egptr() - __p;
- }
- ptrdiff_t __bout = -1;
- ptrdiff_t __nout = -1;
- ptrdiff_t __eout = -1;
- if (__rhs.pbase() != nullptr)
- {
- __bout = __rhs.pbase() - __p;
- __nout = __rhs.pptr() - __p;
- __eout = __rhs.epptr() - __p;
- }
- ptrdiff_t __hm = __rhs.__hm_ == nullptr ? -1 : __rhs.__hm_ - __p;
- __str_ = std::move(__rhs.__str_);
- __p = const_cast<char_type*>(__str_.data());
- if (__binp != -1)
- this->setg(__p + __binp, __p + __ninp, __p + __einp);
- else
- this->setg(nullptr, nullptr, nullptr);
- if (__bout != -1)
- {
- this->setp(__p + __bout, __p + __eout);
- this->__pbump(__nout);
- }
- else
- this->setp(nullptr, nullptr);
-
- __hm_ = __hm == -1 ? nullptr : __p + __hm;
- __mode_ = __rhs.__mode_;
- __p = const_cast<char_type*>(__rhs.__str_.data());
- __rhs.setg(__p, __p, __p);
- __rhs.setp(__p, __p);
- __rhs.__hm_ = __p;
- this->pubimbue(__rhs.getloc());
- return *this;
+basic_stringbuf<_CharT, _Traits, _Allocator>::operator=(basic_stringbuf&& __rhs) {
+ char_type* __p = const_cast<char_type*>(__rhs.__str_.data());
+ ptrdiff_t __binp = -1;
+ ptrdiff_t __ninp = -1;
+ ptrdiff_t __einp = -1;
+ if (__rhs.eback() != nullptr) {
+ __binp = __rhs.eback() - __p;
+ __ninp = __rhs.gptr() - __p;
+ __einp = __rhs.egptr() - __p;
+ }
+ ptrdiff_t __bout = -1;
+ ptrdiff_t __nout = -1;
+ ptrdiff_t __eout = -1;
+ if (__rhs.pbase() != nullptr) {
+ __bout = __rhs.pbase() - __p;
+ __nout = __rhs.pptr() - __p;
+ __eout = __rhs.epptr() - __p;
+ }
+ ptrdiff_t __hm = __rhs.__hm_ == nullptr ? -1 : __rhs.__hm_ - __p;
+ __str_ = std::move(__rhs.__str_);
+ __p = const_cast<char_type*>(__str_.data());
+ if (__binp != -1)
+ this->setg(__p + __binp, __p + __ninp, __p + __einp);
+ else
+ this->setg(nullptr, nullptr, nullptr);
+ if (__bout != -1) {
+ this->setp(__p + __bout, __p + __eout);
+ this->__pbump(__nout);
+ } else
+ this->setp(nullptr, nullptr);
+
+ __hm_ = __hm == -1 ? nullptr : __p + __hm;
+ __mode_ = __rhs.__mode_;
+ __p = const_cast<char_type*>(__rhs.__str_.data());
+ __rhs.setg(__p, __p, __p);
+ __rhs.setp(__p, __p);
+ __rhs.__hm_ = __p;
+ this->pubimbue(__rhs.getloc());
+ return *this;
}
template <class _CharT, class _Traits, class _Allocator>
-void
-basic_stringbuf<_CharT, _Traits, _Allocator>::swap(basic_stringbuf& __rhs)
+void basic_stringbuf<_CharT, _Traits, _Allocator>::swap(basic_stringbuf& __rhs)
#if _LIBCPP_STD_VER >= 20
noexcept(allocator_traits<_Allocator>::propagate_on_container_swap::value ||
allocator_traits<_Allocator>::is_always_equal::value)
#endif
{
- char_type* __p = const_cast<char_type*>(__rhs.__str_.data());
- ptrdiff_t __rbinp = -1;
- ptrdiff_t __rninp = -1;
- ptrdiff_t __reinp = -1;
- if (__rhs.eback() != nullptr)
- {
- __rbinp = __rhs.eback() - __p;
- __rninp = __rhs.gptr() - __p;
- __reinp = __rhs.egptr() - __p;
- }
- ptrdiff_t __rbout = -1;
- ptrdiff_t __rnout = -1;
- ptrdiff_t __reout = -1;
- if (__rhs.pbase() != nullptr)
- {
- __rbout = __rhs.pbase() - __p;
- __rnout = __rhs.pptr() - __p;
- __reout = __rhs.epptr() - __p;
- }
- ptrdiff_t __rhm = __rhs.__hm_ == nullptr ? -1 : __rhs.__hm_ - __p;
- __p = const_cast<char_type*>(__str_.data());
- ptrdiff_t __lbinp = -1;
- ptrdiff_t __lninp = -1;
- ptrdiff_t __leinp = -1;
- if (this->eback() != nullptr)
- {
- __lbinp = this->eback() - __p;
- __lninp = this->gptr() - __p;
- __leinp = this->egptr() - __p;
- }
- ptrdiff_t __lbout = -1;
- ptrdiff_t __lnout = -1;
- ptrdiff_t __leout = -1;
- if (this->pbase() != nullptr)
- {
- __lbout = this->pbase() - __p;
- __lnout = this->pptr() - __p;
- __leout = this->epptr() - __p;
- }
- ptrdiff_t __lhm = __hm_ == nullptr ? -1 : __hm_ - __p;
- std::swap(__mode_, __rhs.__mode_);
- __str_.swap(__rhs.__str_);
- __p = const_cast<char_type*>(__str_.data());
- if (__rbinp != -1)
- this->setg(__p + __rbinp, __p + __rninp, __p + __reinp);
- else
- this->setg(nullptr, nullptr, nullptr);
- if (__rbout != -1)
- {
- this->setp(__p + __rbout, __p + __reout);
- this->__pbump(__rnout);
- }
- else
- this->setp(nullptr, nullptr);
- __hm_ = __rhm == -1 ? nullptr : __p + __rhm;
- __p = const_cast<char_type*>(__rhs.__str_.data());
- if (__lbinp != -1)
- __rhs.setg(__p + __lbinp, __p + __lninp, __p + __leinp);
- else
- __rhs.setg(nullptr, nullptr, nullptr);
- if (__lbout != -1)
- {
- __rhs.setp(__p + __lbout, __p + __leout);
- __rhs.__pbump(__lnout);
- }
- else
- __rhs.setp(nullptr, nullptr);
- __rhs.__hm_ = __lhm == -1 ? nullptr : __p + __lhm;
- locale __tl = __rhs.getloc();
- __rhs.pubimbue(this->getloc());
- this->pubimbue(__tl);
+ char_type* __p = const_cast<char_type*>(__rhs.__str_.data());
+ ptrdiff_t __rbinp = -1;
+ ptrdiff_t __rninp = -1;
+ ptrdiff_t __reinp = -1;
+ if (__rhs.eback() != nullptr) {
+ __rbinp = __rhs.eback() - __p;
+ __rninp = __rhs.gptr() - __p;
+ __reinp = __rhs.egptr() - __p;
+ }
+ ptrdiff_t __rbout = -1;
+ ptrdiff_t __rnout = -1;
+ ptrdiff_t __reout = -1;
+ if (__rhs.pbase() != nullptr) {
+ __rbout = __rhs.pbase() - __p;
+ __rnout = __rhs.pptr() - __p;
+ __reout = __rhs.epptr() - __p;
+ }
+ ptrdiff_t __rhm = __rhs.__hm_ == nullptr ? -1 : __rhs.__hm_ - __p;
+ __p = const_cast<char_type*>(__str_.data());
+ ptrdiff_t __lbinp = -1;
+ ptrdiff_t __lninp = -1;
+ ptrdiff_t __leinp = -1;
+ if (this->eback() != nullptr) {
+ __lbinp = this->eback() - __p;
+ __lninp = this->gptr() - __p;
+ __leinp = this->egptr() - __p;
+ }
+ ptrdiff_t __lbout = -1;
+ ptrdiff_t __lnout = -1;
+ ptrdiff_t __leout = -1;
+ if (this->pbase() != nullptr) {
+ __lbout = this->pbase() - __p;
+ __lnout = this->pptr() - __p;
+ __leout = this->epptr() - __p;
+ }
+ ptrdiff_t __lhm = __hm_ == nullptr ? -1 : __hm_ - __p;
+ std::swap(__mode_, __rhs.__mode_);
+ __str_.swap(__rhs.__str_);
+ __p = const_cast<char_type*>(__str_.data());
+ if (__rbinp != -1)
+ this->setg(__p + __rbinp, __p + __rninp, __p + __reinp);
+ else
+ this->setg(nullptr, nullptr, nullptr);
+ if (__rbout != -1) {
+ this->setp(__p + __rbout, __p + __reout);
+ this->__pbump(__rnout);
+ } else
+ this->setp(nullptr, nullptr);
+ __hm_ = __rhm == -1 ? nullptr : __p + __rhm;
+ __p = const_cast<char_type*>(__rhs.__str_.data());
+ if (__lbinp != -1)
+ __rhs.setg(__p + __lbinp, __p + __lninp, __p + __leinp);
+ else
+ __rhs.setg(nullptr, nullptr, nullptr);
+ if (__lbout != -1) {
+ __rhs.setp(__p + __lbout, __p + __leout);
+ __rhs.__pbump(__lnout);
+ } else
+ __rhs.setp(nullptr, nullptr);
+ __rhs.__hm_ = __lhm == -1 ? nullptr : __p + __lhm;
+ locale __tl = __rhs.getloc();
+ __rhs.pubimbue(this->getloc());
+ this->pubimbue(__tl);
}
template <class _CharT, class _Traits, class _Allocator>
-inline _LIBCPP_HIDE_FROM_ABI
-void
-swap(basic_stringbuf<_CharT, _Traits, _Allocator>& __x,
- basic_stringbuf<_CharT, _Traits, _Allocator>& __y)
+inline _LIBCPP_HIDE_FROM_ABI void
+swap(basic_stringbuf<_CharT, _Traits, _Allocator>& __x, basic_stringbuf<_CharT, _Traits, _Allocator>& __y)
#if _LIBCPP_STD_VER >= 20
noexcept(noexcept(__x.swap(__y)))
#endif
{
- __x.swap(__y);
+ __x.swap(__y);
}
#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_BUILDING_LIBRARY)
template <class _CharT, class _Traits, class _Allocator>
-basic_string<_CharT, _Traits, _Allocator>
-basic_stringbuf<_CharT, _Traits, _Allocator>::str() const {
- if (__mode_ & ios_base::out) {
- if (__hm_ < this->pptr())
- __hm_ = this->pptr();
- return string_type(this->pbase(), __hm_, __str_.get_allocator());
- } else if (__mode_ & ios_base::in)
- return string_type(this->eback(), this->egptr(), __str_.get_allocator());
- return string_type(__str_.get_allocator());
+basic_string<_CharT, _Traits, _Allocator> basic_stringbuf<_CharT, _Traits, _Allocator>::str() const {
+ if (__mode_ & ios_base::out) {
+ if (__hm_ < this->pptr())
+ __hm_ = this->pptr();
+ return string_type(this->pbase(), __hm_, __str_.get_allocator());
+ } else if (__mode_ & ios_base::in)
+ return string_type(this->eback(), this->egptr(), __str_.get_allocator());
+ return string_type(__str_.get_allocator());
}
#endif // _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_BUILDING_LIBRARY)
template <class _CharT, class _Traits, class _Allocator>
_LIBCPP_HIDE_FROM_ABI void basic_stringbuf<_CharT, _Traits, _Allocator>::__init_buf_ptrs() {
- __hm_ = nullptr;
- char_type* __data = const_cast<char_type*>(__str_.data());
- typename string_type::size_type __sz = __str_.size();
- if (__mode_ & ios_base::in) {
- __hm_ = __data + __sz;
- this->setg(__data, __data, __hm_);
- }
- if (__mode_ & ios_base::out) {
- __hm_ = __data + __sz;
- __str_.resize(__str_.capacity());
- this->setp(__data, __data + __str_.size());
- if (__mode_ & (ios_base::app | ios_base::ate)) {
- while (__sz > INT_MAX) {
- this->pbump(INT_MAX);
- __sz -= INT_MAX;
- }
- if (__sz > 0)
- this->pbump(__sz);
- }
+ __hm_ = nullptr;
+ char_type* __data = const_cast<char_type*>(__str_.data());
+ typename string_type::size_type __sz = __str_.size();
+ if (__mode_ & ios_base::in) {
+ __hm_ = __data + __sz;
+ this->setg(__data, __data, __hm_);
+ }
+ if (__mode_ & ios_base::out) {
+ __hm_ = __data + __sz;
+ __str_.resize(__str_.capacity());
+ this->setp(__data, __data + __str_.size());
+ if (__mode_ & (ios_base::app | ios_base::ate)) {
+ while (__sz > INT_MAX) {
+ this->pbump(INT_MAX);
+ __sz -= INT_MAX;
+ }
+ if (__sz > 0)
+ this->pbump(__sz);
}
+ }
}
#if _LIBCPP_STD_VER >= 20
template <class _CharT, class _Traits, class _Allocator>
_LIBCPP_HIDE_FROM_ABI basic_string_view<_CharT, _Traits>
basic_stringbuf<_CharT, _Traits, _Allocator>::view() const noexcept {
- if (__mode_ & ios_base::out) {
- if (__hm_ < this->pptr())
- __hm_ = this->pptr();
- return basic_string_view<_CharT, _Traits>(this->pbase(), __hm_);
- } else if (__mode_ & ios_base::in)
- return basic_string_view<_CharT, _Traits>(this->eback(), this->egptr());
- return basic_string_view<_CharT, _Traits>();
+ if (__mode_ & ios_base::out) {
+ if (__hm_ < this->pptr())
+ __hm_ = this->pptr();
+ return basic_string_view<_CharT, _Traits>(this->pbase(), __hm_);
+ } else if (__mode_ & ios_base::in)
+ return basic_string_view<_CharT, _Traits>(this->eback(), this->egptr());
+ return basic_string_view<_CharT, _Traits>();
}
#endif // _LIBCPP_STD_VER >= 20
template <class _CharT, class _Traits, class _Allocator>
typename basic_stringbuf<_CharT, _Traits, _Allocator>::int_type
-basic_stringbuf<_CharT, _Traits, _Allocator>::underflow()
-{
- if (__hm_ < this->pptr())
- __hm_ = this->pptr();
- if (__mode_ & ios_base::in)
- {
- if (this->egptr() < __hm_)
- this->setg(this->eback(), this->gptr(), __hm_);
- if (this->gptr() < this->egptr())
- return traits_type::to_int_type(*this->gptr());
- }
- return traits_type::eof();
+basic_stringbuf<_CharT, _Traits, _Allocator>::underflow() {
+ if (__hm_ < this->pptr())
+ __hm_ = this->pptr();
+ if (__mode_ & ios_base::in) {
+ if (this->egptr() < __hm_)
+ this->setg(this->eback(), this->gptr(), __hm_);
+ if (this->gptr() < this->egptr())
+ return traits_type::to_int_type(*this->gptr());
+ }
+ return traits_type::eof();
}
template <class _CharT, class _Traits, class _Allocator>
typename basic_stringbuf<_CharT, _Traits, _Allocator>::int_type
-basic_stringbuf<_CharT, _Traits, _Allocator>::pbackfail(int_type __c)
-{
- if (__hm_ < this->pptr())
- __hm_ = this->pptr();
- if (this->eback() < this->gptr())
- {
- if (traits_type::eq_int_type(__c, traits_type::eof()))
- {
- this->setg(this->eback(), this->gptr()-1, __hm_);
- return traits_type::not_eof(__c);
- }
- if ((__mode_ & ios_base::out) ||
- traits_type::eq(traits_type::to_char_type(__c), this->gptr()[-1]))
- {
- this->setg(this->eback(), this->gptr()-1, __hm_);
- *this->gptr() = traits_type::to_char_type(__c);
- return __c;
- }
+basic_stringbuf<_CharT, _Traits, _Allocator>::pbackfail(int_type __c) {
+ if (__hm_ < this->pptr())
+ __hm_ = this->pptr();
+ if (this->eback() < this->gptr()) {
+ if (traits_type::eq_int_type(__c, traits_type::eof())) {
+ this->setg(this->eback(), this->gptr() - 1, __hm_);
+ return traits_type::not_eof(__c);
+ }
+ if ((__mode_ & ios_base::out) || traits_type::eq(traits_type::to_char_type(__c), this->gptr()[-1])) {
+ this->setg(this->eback(), this->gptr() - 1, __hm_);
+ *this->gptr() = traits_type::to_char_type(__c);
+ return __c;
}
- return traits_type::eof();
+ }
+ return traits_type::eof();
}
template <class _CharT, class _Traits, class _Allocator>
typename basic_stringbuf<_CharT, _Traits, _Allocator>::int_type
-basic_stringbuf<_CharT, _Traits, _Allocator>::overflow(int_type __c)
-{
- if (!traits_type::eq_int_type(__c, traits_type::eof()))
- {
- ptrdiff_t __ninp = this->gptr() - this->eback();
- if (this->pptr() == this->epptr())
- {
- if (!(__mode_ & ios_base::out))
- return traits_type::eof();
+basic_stringbuf<_CharT, _Traits, _Allocator>::overflow(int_type __c) {
+ if (!traits_type::eq_int_type(__c, traits_type::eof())) {
+ ptrdiff_t __ninp = this->gptr() - this->eback();
+ if (this->pptr() == this->epptr()) {
+ if (!(__mode_ & ios_base::out))
+ return traits_type::eof();
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- try
- {
+ try {
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- ptrdiff_t __nout = this->pptr() - this->pbase();
- ptrdiff_t __hm = __hm_ - this->pbase();
- __str_.push_back(char_type());
- __str_.resize(__str_.capacity());
- char_type* __p = const_cast<char_type*>(__str_.data());
- this->setp(__p, __p + __str_.size());
- this->__pbump(__nout);
- __hm_ = this->pbase() + __hm;
+ ptrdiff_t __nout = this->pptr() - this->pbase();
+ ptrdiff_t __hm = __hm_ - this->pbase();
+ __str_.push_back(char_type());
+ __str_.resize(__str_.capacity());
+ char_type* __p = const_cast<char_type*>(__str_.data());
+ this->setp(__p, __p + __str_.size());
+ this->__pbump(__nout);
+ __hm_ = this->pbase() + __hm;
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- }
- catch (...)
- {
- return traits_type::eof();
- }
+ } catch (...) {
+ return traits_type::eof();
+ }
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- }
- __hm_ = std::max(this->pptr() + 1, __hm_);
- if (__mode_ & ios_base::in)
- {
- char_type* __p = const_cast<char_type*>(__str_.data());
- this->setg(__p, __p + __ninp, __hm_);
- }
- return this->sputc(traits_type::to_char_type(__c));
}
- return traits_type::not_eof(__c);
+ __hm_ = std::max(this->pptr() + 1, __hm_);
+ if (__mode_ & ios_base::in) {
+ char_type* __p = const_cast<char_type*>(__str_.data());
+ this->setg(__p, __p + __ninp, __hm_);
+ }
+ return this->sputc(traits_type::to_char_type(__c));
+ }
+ return traits_type::not_eof(__c);
}
template <class _CharT, class _Traits, class _Allocator>
-typename basic_stringbuf<_CharT, _Traits, _Allocator>::pos_type
-basic_stringbuf<_CharT, _Traits, _Allocator>::seekoff(off_type __off,
- ios_base::seekdir __way,
- ios_base::openmode __wch)
-{
- if (__hm_ < this->pptr())
- __hm_ = this->pptr();
- if ((__wch & (ios_base::in | ios_base::out)) == 0)
- return pos_type(-1);
- if ((__wch & (ios_base::in | ios_base::out)) == (ios_base::in | ios_base::out)
- && __way == ios_base::cur)
- return pos_type(-1);
- const ptrdiff_t __hm = __hm_ == nullptr ? 0 : __hm_ - __str_.data();
- off_type __noff;
- switch (__way)
- {
- case ios_base::beg:
- __noff = 0;
- break;
- case ios_base::cur:
- if (__wch & ios_base::in)
- __noff = this->gptr() - this->eback();
- else
- __noff = this->pptr() - this->pbase();
- break;
- case ios_base::end:
- __noff = __hm;
- break;
- default:
- return pos_type(-1);
- }
- __noff += __off;
- if (__noff < 0 || __hm < __noff)
- return pos_type(-1);
- if (__noff != 0)
- {
- if ((__wch & ios_base::in) && this->gptr() == nullptr)
- return pos_type(-1);
- if ((__wch & ios_base::out) && this->pptr() == nullptr)
- return pos_type(-1);
- }
+typename basic_stringbuf<_CharT, _Traits, _Allocator>::pos_type basic_stringbuf<_CharT, _Traits, _Allocator>::seekoff(
+ off_type __off, ios_base::seekdir __way, ios_base::openmode __wch) {
+ if (__hm_ < this->pptr())
+ __hm_ = this->pptr();
+ if ((__wch & (ios_base::in | ios_base::out)) == 0)
+ return pos_type(-1);
+ if ((__wch & (ios_base::in | ios_base::out)) == (ios_base::in | ios_base::out) && __way == ios_base::cur)
+ return pos_type(-1);
+ const ptrdiff_t __hm = __hm_ == nullptr ? 0 : __hm_ - __str_.data();
+ off_type __noff;
+ switch (__way) {
+ case ios_base::beg:
+ __noff = 0;
+ break;
+ case ios_base::cur:
if (__wch & ios_base::in)
- this->setg(this->eback(), this->eback() + __noff, __hm_);
- if (__wch & ios_base::out)
- {
- this->setp(this->pbase(), this->epptr());
- this->__pbump(__noff);
- }
- return pos_type(__noff);
+ __noff = this->gptr() - this->eback();
+ else
+ __noff = this->pptr() - this->pbase();
+ break;
+ case ios_base::end:
+ __noff = __hm;
+ break;
+ default:
+ return pos_type(-1);
+ }
+ __noff += __off;
+ if (__noff < 0 || __hm < __noff)
+ return pos_type(-1);
+ if (__noff != 0) {
+ if ((__wch & ios_base::in) && this->gptr() == nullptr)
+ return pos_type(-1);
+ if ((__wch & ios_base::out) && this->pptr() == nullptr)
+ return pos_type(-1);
+ }
+ if (__wch & ios_base::in)
+ this->setg(this->eback(), this->eback() + __noff, __hm_);
+ if (__wch & ios_base::out) {
+ this->setp(this->pbase(), this->epptr());
+ this->__pbump(__noff);
+ }
+ return pos_type(__noff);
}
// Class template basic_istringstream [istringstream]
template <class _CharT, class _Traits, class _Allocator>
-class _LIBCPP_TEMPLATE_VIS basic_istringstream
- : public basic_istream<_CharT, _Traits>
-{
+class _LIBCPP_TEMPLATE_VIS basic_istringstream : public basic_istream<_CharT, _Traits> {
public:
- typedef _CharT char_type;
- typedef _Traits traits_type;
- typedef typename traits_type::int_type int_type;
- typedef typename traits_type::pos_type pos_type;
- typedef typename traits_type::off_type off_type;
- typedef _Allocator allocator_type;
+ typedef _CharT char_type;
+ typedef _Traits traits_type;
+ typedef typename traits_type::int_type int_type;
+ typedef typename traits_type::pos_type pos_type;
+ typedef typename traits_type::off_type off_type;
+ typedef _Allocator allocator_type;
- typedef basic_string<char_type, traits_type, allocator_type> string_type;
+ typedef basic_string<char_type, traits_type, allocator_type> string_type;
private:
- basic_stringbuf<char_type, traits_type, allocator_type> __sb_;
+ basic_stringbuf<char_type, traits_type, allocator_type> __sb_;
public:
- // [istringstream.cons] Constructors:
- _LIBCPP_HIDE_FROM_ABI
- basic_istringstream()
- : basic_istream<_CharT, _Traits>(&__sb_), __sb_(ios_base::in) {}
+ // [istringstream.cons] Constructors:
+ _LIBCPP_HIDE_FROM_ABI basic_istringstream() : basic_istream<_CharT, _Traits>(&__sb_), __sb_(ios_base::in) {}
- _LIBCPP_HIDE_FROM_ABI
- explicit basic_istringstream(ios_base::openmode __wch)
- : basic_istream<_CharT, _Traits>(&__sb_), __sb_(__wch | ios_base::in) {}
+ _LIBCPP_HIDE_FROM_ABI explicit basic_istringstream(ios_base::openmode __wch)
+ : basic_istream<_CharT, _Traits>(&__sb_), __sb_(__wch | ios_base::in) {}
- _LIBCPP_HIDE_FROM_ABI
- explicit basic_istringstream(const string_type& __s,
- ios_base::openmode __wch = ios_base::in)
- : basic_istream<_CharT, _Traits>(&__sb_)
- , __sb_(__s, __wch | ios_base::in)
- { }
+ _LIBCPP_HIDE_FROM_ABI explicit basic_istringstream(const string_type& __s, ios_base::openmode __wch = ios_base::in)
+ : basic_istream<_CharT, _Traits>(&__sb_), __sb_(__s, __wch | ios_base::in) {}
#if _LIBCPP_STD_VER >= 20
- _LIBCPP_HIDE_FROM_ABI basic_istringstream(ios_base::openmode __wch, const _Allocator& __a)
- : basic_istream<_CharT, _Traits>(std::addressof(__sb_)), __sb_(__wch | ios_base::in, __a) {}
+ _LIBCPP_HIDE_FROM_ABI basic_istringstream(ios_base::openmode __wch, const _Allocator& __a)
+ : basic_istream<_CharT, _Traits>(std::addressof(__sb_)), __sb_(__wch | ios_base::in, __a) {}
- _LIBCPP_HIDE_FROM_ABI explicit basic_istringstream(string_type&& __s, ios_base::openmode __wch = ios_base::in)
- : basic_istream<_CharT, _Traits>(std::addressof(__sb_)), __sb_(std::move(__s), __wch | ios_base::in) {}
+ _LIBCPP_HIDE_FROM_ABI explicit basic_istringstream(string_type&& __s, ios_base::openmode __wch = ios_base::in)
+ : basic_istream<_CharT, _Traits>(std::addressof(__sb_)), __sb_(std::move(__s), __wch | ios_base::in) {}
- template <class _SAlloc>
- _LIBCPP_HIDE_FROM_ABI basic_istringstream(const basic_string<_CharT, _Traits, _SAlloc>& __s, const _Allocator& __a)
- : basic_istringstream(__s, ios_base::in, __a) {}
+ template <class _SAlloc>
+ _LIBCPP_HIDE_FROM_ABI basic_istringstream(const basic_string<_CharT, _Traits, _SAlloc>& __s, const _Allocator& __a)
+ : basic_istringstream(__s, ios_base::in, __a) {}
- template <class _SAlloc>
- _LIBCPP_HIDE_FROM_ABI basic_istringstream(
- const basic_string<_CharT, _Traits, _SAlloc>& __s, ios_base::openmode __wch, const _Allocator& __a)
- : basic_istream<_CharT, _Traits>(std::addressof(__sb_)), __sb_(__s, __wch | ios_base::in, __a) {}
+ template <class _SAlloc>
+ _LIBCPP_HIDE_FROM_ABI basic_istringstream(
+ const basic_string<_CharT, _Traits, _SAlloc>& __s, ios_base::openmode __wch, const _Allocator& __a)
+ : basic_istream<_CharT, _Traits>(std::addressof(__sb_)), __sb_(__s, __wch | ios_base::in, __a) {}
- template <class _SAlloc>
- _LIBCPP_HIDE_FROM_ABI explicit basic_istringstream(const basic_string<_CharT, _Traits, _SAlloc>& __s,
- ios_base::openmode __wch = ios_base::in)
- : basic_istream<_CharT, _Traits>(std::addressof(__sb_)), __sb_(__s, __wch | ios_base::in) {}
+ template <class _SAlloc>
+ _LIBCPP_HIDE_FROM_ABI explicit basic_istringstream(const basic_string<_CharT, _Traits, _SAlloc>& __s,
+ ios_base::openmode __wch = ios_base::in)
+ : basic_istream<_CharT, _Traits>(std::addressof(__sb_)), __sb_(__s, __wch | ios_base::in) {}
#endif // _LIBCPP_STD_VER >= 20
- _LIBCPP_HIDE_FROM_ABI
- basic_istringstream(basic_istringstream&& __rhs)
- : basic_istream<_CharT, _Traits>(std::move(__rhs))
- , __sb_(std::move(__rhs.__sb_))
- {
- basic_istream<_CharT, _Traits>::set_rdbuf(&__sb_);
- }
+ _LIBCPP_HIDE_FROM_ABI basic_istringstream(basic_istringstream&& __rhs)
+ : basic_istream<_CharT, _Traits>(std::move(__rhs)), __sb_(std::move(__rhs.__sb_)) {
+ basic_istream<_CharT, _Traits>::set_rdbuf(&__sb_);
+ }
- // [istringstream.assign] Assign and swap:
- basic_istringstream& operator=(basic_istringstream&& __rhs) {
- basic_istream<char_type, traits_type>::operator=(std::move(__rhs));
- __sb_ = std::move(__rhs.__sb_);
- return *this;
- }
- _LIBCPP_HIDE_FROM_ABI
- void swap(basic_istringstream& __rhs) {
- basic_istream<char_type, traits_type>::swap(__rhs);
- __sb_.swap(__rhs.__sb_);
- }
+ // [istringstream.assign] Assign and swap:
+ basic_istringstream& operator=(basic_istringstream&& __rhs) {
+ basic_istream<char_type, traits_type>::operator=(std::move(__rhs));
+ __sb_ = std::move(__rhs.__sb_);
+ return *this;
+ }
+ _LIBCPP_HIDE_FROM_ABI void swap(basic_istringstream& __rhs) {
+ basic_istream<char_type, traits_type>::swap(__rhs);
+ __sb_.swap(__rhs.__sb_);
+ }
- // [istringstream.members] Member functions:
- _LIBCPP_HIDE_FROM_ABI
- basic_stringbuf<char_type, traits_type, allocator_type>* rdbuf() const {
- return const_cast<basic_stringbuf<char_type, traits_type, allocator_type>*>(&__sb_);
- }
+ // [istringstream.members] Member functions:
+ _LIBCPP_HIDE_FROM_ABI basic_stringbuf<char_type, traits_type, allocator_type>* rdbuf() const {
+ return const_cast<basic_stringbuf<char_type, traits_type, allocator_type>*>(&__sb_);
+ }
#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_BUILDING_LIBRARY)
- _LIBCPP_HIDE_FROM_ABI string_type str() const { return __sb_.str(); }
+ _LIBCPP_HIDE_FROM_ABI string_type str() const { return __sb_.str(); }
#else
- _LIBCPP_HIDE_FROM_ABI_SSTREAM string_type str() const & { return __sb_.str(); }
+ _LIBCPP_HIDE_FROM_ABI_SSTREAM string_type str() const& { return __sb_.str(); }
- _LIBCPP_HIDE_FROM_ABI_SSTREAM string_type str() && { return std::move(__sb_).str(); }
+ _LIBCPP_HIDE_FROM_ABI_SSTREAM string_type str() && { return std::move(__sb_).str(); }
#endif
#if _LIBCPP_STD_VER >= 20
- template <class _SAlloc>
- requires __is_allocator<_SAlloc>::value
- _LIBCPP_HIDE_FROM_ABI basic_string<char_type, traits_type, _SAlloc> str(const _SAlloc& __sa) const {
- return __sb_.str(__sa);
- }
+ template <class _SAlloc>
+ requires __is_allocator<_SAlloc>::value
+ _LIBCPP_HIDE_FROM_ABI basic_string<char_type, traits_type, _SAlloc> str(const _SAlloc& __sa) const {
+ return __sb_.str(__sa);
+ }
- _LIBCPP_HIDE_FROM_ABI basic_string_view<char_type, traits_type> view() const noexcept { return __sb_.view(); }
+ _LIBCPP_HIDE_FROM_ABI basic_string_view<char_type, traits_type> view() const noexcept { return __sb_.view(); }
#endif // _LIBCPP_STD_VER >= 20
- _LIBCPP_HIDE_FROM_ABI void str(const string_type& __s) { __sb_.str(__s); }
+ _LIBCPP_HIDE_FROM_ABI void str(const string_type& __s) { __sb_.str(__s); }
#if _LIBCPP_STD_VER >= 20
- template <class _SAlloc>
- _LIBCPP_HIDE_FROM_ABI void str(const basic_string<char_type, traits_type, _SAlloc>& __s) {
- __sb_.str(__s);
- }
+ template <class _SAlloc>
+ _LIBCPP_HIDE_FROM_ABI void str(const basic_string<char_type, traits_type, _SAlloc>& __s) {
+ __sb_.str(__s);
+ }
- _LIBCPP_HIDE_FROM_ABI void str(string_type&& __s) { __sb_.str(std::move(__s)); }
+ _LIBCPP_HIDE_FROM_ABI void str(string_type&& __s) { __sb_.str(std::move(__s)); }
#endif // _LIBCPP_STD_VER >= 20
};
template <class _CharT, class _Traits, class _Allocator>
-inline _LIBCPP_HIDE_FROM_ABI
-void
-swap(basic_istringstream<_CharT, _Traits, _Allocator>& __x,
- basic_istringstream<_CharT, _Traits, _Allocator>& __y)
-{
- __x.swap(__y);
+inline _LIBCPP_HIDE_FROM_ABI void
+swap(basic_istringstream<_CharT, _Traits, _Allocator>& __x, basic_istringstream<_CharT, _Traits, _Allocator>& __y) {
+ __x.swap(__y);
}
// Class template basic_ostringstream [ostringstream]
template <class _CharT, class _Traits, class _Allocator>
-class _LIBCPP_TEMPLATE_VIS basic_ostringstream
- : public basic_ostream<_CharT, _Traits>
-{
+class _LIBCPP_TEMPLATE_VIS basic_ostringstream : public basic_ostream<_CharT, _Traits> {
public:
- typedef _CharT char_type;
- typedef _Traits traits_type;
- typedef typename traits_type::int_type int_type;
- typedef typename traits_type::pos_type pos_type;
- typedef typename traits_type::off_type off_type;
- typedef _Allocator allocator_type;
+ typedef _CharT char_type;
+ typedef _Traits traits_type;
+ typedef typename traits_type::int_type int_type;
+ typedef typename traits_type::pos_type pos_type;
+ typedef typename traits_type::off_type off_type;
+ typedef _Allocator allocator_type;
- typedef basic_string<char_type, traits_type, allocator_type> string_type;
+ typedef basic_string<char_type, traits_type, allocator_type> string_type;
private:
- basic_stringbuf<char_type, traits_type, allocator_type> __sb_;
+ basic_stringbuf<char_type, traits_type, allocator_type> __sb_;
public:
- // [ostringstream.cons] Constructors:
- _LIBCPP_HIDE_FROM_ABI
- basic_ostringstream()
- : basic_ostream<_CharT, _Traits>(&__sb_), __sb_(ios_base::out) {}
+ // [ostringstream.cons] Constructors:
+ _LIBCPP_HIDE_FROM_ABI basic_ostringstream() : basic_ostream<_CharT, _Traits>(&__sb_), __sb_(ios_base::out) {}
- _LIBCPP_HIDE_FROM_ABI
- explicit basic_ostringstream(ios_base::openmode __wch)
- : basic_ostream<_CharT, _Traits>(&__sb_), __sb_(__wch | ios_base::out) {}
+ _LIBCPP_HIDE_FROM_ABI explicit basic_ostringstream(ios_base::openmode __wch)
+ : basic_ostream<_CharT, _Traits>(&__sb_), __sb_(__wch | ios_base::out) {}
- _LIBCPP_HIDE_FROM_ABI
- explicit basic_ostringstream(const string_type& __s,
- ios_base::openmode __wch = ios_base::out)
- : basic_ostream<_CharT, _Traits>(&__sb_)
- , __sb_(__s, __wch | ios_base::out)
- { }
+ _LIBCPP_HIDE_FROM_ABI explicit basic_ostringstream(const string_type& __s, ios_base::openmode __wch = ios_base::out)
+ : basic_ostream<_CharT, _Traits>(&__sb_), __sb_(__s, __wch | ios_base::out) {}
#if _LIBCPP_STD_VER >= 20
- _LIBCPP_HIDE_FROM_ABI basic_ostringstream(ios_base::openmode __wch, const _Allocator& __a)
- : basic_ostream<_CharT, _Traits>(std::addressof(__sb_)), __sb_(__wch | ios_base::out, __a) {}
-
- _LIBCPP_HIDE_FROM_ABI explicit basic_ostringstream(string_type&& __s, ios_base::openmode __wch = ios_base::out)
- : basic_ostream<_CharT, _Traits>(std::addressof(__sb_)), __sb_(std::move(__s), __wch | ios_base::out) {}
-
- template <class _SAlloc>
- _LIBCPP_HIDE_FROM_ABI basic_ostringstream(const basic_string<_CharT, _Traits, _SAlloc>& __s, const _Allocator& __a)
- : basic_ostringstream(__s, ios_base::out, __a) {}
-
- template <class _SAlloc>
- _LIBCPP_HIDE_FROM_ABI basic_ostringstream(
- const basic_string<_CharT, _Traits, _SAlloc>& __s, ios_base::openmode __wch, const _Allocator& __a)
- : basic_ostream<_CharT, _Traits>(std::addressof(__sb_)), __sb_(__s, __wch | ios_base::out, __a) {}
-
- template <class _SAlloc>
- requires (!is_same_v<_SAlloc, allocator_type>)
- _LIBCPP_HIDE_FROM_ABI explicit basic_ostringstream(const basic_string<_CharT, _Traits, _SAlloc>& __s,
- ios_base::openmode __wch = ios_base::out)
- : basic_ostream<_CharT, _Traits>(std::addressof(__sb_)), __sb_(__s, __wch | ios_base::out) {}
+ _LIBCPP_HIDE_FROM_ABI basic_ostringstream(ios_base::openmode __wch, const _Allocator& __a)
+ : basic_ostream<_CharT, _Traits>(std::addressof(__sb_)), __sb_(__wch | ios_base::out, __a) {}
+
+ _LIBCPP_HIDE_FROM_ABI explicit basic_ostringstream(string_type&& __s, ios_base::openmode __wch = ios_base::out)
+ : basic_ostream<_CharT, _Traits>(std::addressof(__sb_)), __sb_(std::move(__s), __wch | ios_base::out) {}
+
+ template <class _SAlloc>
+ _LIBCPP_HIDE_FROM_ABI basic_ostringstream(const basic_string<_CharT, _Traits, _SAlloc>& __s, const _Allocator& __a)
+ : basic_ostringstream(__s, ios_base::out, __a) {}
+
+ template <class _SAlloc>
+ _LIBCPP_HIDE_FROM_ABI basic_ostringstream(
+ const basic_string<_CharT, _Traits, _SAlloc>& __s, ios_base::openmode __wch, const _Allocator& __a)
+ : basic_ostream<_CharT, _Traits>(std::addressof(__sb_)), __sb_(__s, __wch | ios_base::out, __a) {}
+
+ template <class _SAlloc>
+ requires(!is_same_v<_SAlloc, allocator_type>)
+ _LIBCPP_HIDE_FROM_ABI explicit basic_ostringstream(const basic_string<_CharT, _Traits, _SAlloc>& __s,
+ ios_base::openmode __wch = ios_base::out)
+ : basic_ostream<_CharT, _Traits>(std::addressof(__sb_)), __sb_(__s, __wch | ios_base::out) {}
#endif // _LIBCPP_STD_VER >= 20
- _LIBCPP_HIDE_FROM_ABI
- basic_ostringstream(basic_ostringstream&& __rhs)
- : basic_ostream<_CharT, _Traits>(std::move(__rhs))
- , __sb_(std::move(__rhs.__sb_))
- {
- basic_ostream<_CharT, _Traits>::set_rdbuf(&__sb_);
- }
+ _LIBCPP_HIDE_FROM_ABI basic_ostringstream(basic_ostringstream&& __rhs)
+ : basic_ostream<_CharT, _Traits>(std::move(__rhs)), __sb_(std::move(__rhs.__sb_)) {
+ basic_ostream<_CharT, _Traits>::set_rdbuf(&__sb_);
+ }
- // [ostringstream.assign] Assign and swap:
- basic_ostringstream& operator=(basic_ostringstream&& __rhs) {
- basic_ostream<char_type, traits_type>::operator=(std::move(__rhs));
- __sb_ = std::move(__rhs.__sb_);
- return *this;
- }
+ // [ostringstream.assign] Assign and swap:
+ basic_ostringstream& operator=(basic_ostringstream&& __rhs) {
+ basic_ostream<char_type, traits_type>::operator=(std::move(__rhs));
+ __sb_ = std::move(__rhs.__sb_);
+ return *this;
+ }
- _LIBCPP_HIDE_FROM_ABI
- void swap(basic_ostringstream& __rhs) {
- basic_ostream<char_type, traits_type>::swap(__rhs);
- __sb_.swap(__rhs.__sb_);
- }
+ _LIBCPP_HIDE_FROM_ABI void swap(basic_ostringstream& __rhs) {
+ basic_ostream<char_type, traits_type>::swap(__rhs);
+ __sb_.swap(__rhs.__sb_);
+ }
- // [ostringstream.members] Member functions:
- _LIBCPP_HIDE_FROM_ABI
- basic_stringbuf<char_type, traits_type, allocator_type>* rdbuf() const {
- return const_cast<basic_stringbuf<char_type, traits_type, allocator_type>*>(&__sb_);
- }
+ // [ostringstream.members] Member functions:
+ _LIBCPP_HIDE_FROM_ABI basic_stringbuf<char_type, traits_type, allocator_type>* rdbuf() const {
+ return const_cast<basic_stringbuf<char_type, traits_type, allocator_type>*>(&__sb_);
+ }
#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_BUILDING_LIBRARY)
- _LIBCPP_HIDE_FROM_ABI string_type str() const { return __sb_.str(); }
+ _LIBCPP_HIDE_FROM_ABI string_type str() const { return __sb_.str(); }
#else
- _LIBCPP_HIDE_FROM_ABI_SSTREAM string_type str() const & { return __sb_.str(); }
+ _LIBCPP_HIDE_FROM_ABI_SSTREAM string_type str() const& { return __sb_.str(); }
- _LIBCPP_HIDE_FROM_ABI_SSTREAM string_type str() && { return std::move(__sb_).str(); }
+ _LIBCPP_HIDE_FROM_ABI_SSTREAM string_type str() && { return std::move(__sb_).str(); }
#endif
#if _LIBCPP_STD_VER >= 20
- template <class _SAlloc>
- requires __is_allocator<_SAlloc>::value
- _LIBCPP_HIDE_FROM_ABI basic_string<char_type, traits_type, _SAlloc> str(const _SAlloc& __sa) const {
- return __sb_.str(__sa);
- }
+ template <class _SAlloc>
+ requires __is_allocator<_SAlloc>::value
+ _LIBCPP_HIDE_FROM_ABI basic_string<char_type, traits_type, _SAlloc> str(const _SAlloc& __sa) const {
+ return __sb_.str(__sa);
+ }
- _LIBCPP_HIDE_FROM_ABI basic_string_view<char_type, traits_type> view() const noexcept { return __sb_.view(); }
+ _LIBCPP_HIDE_FROM_ABI basic_string_view<char_type, traits_type> view() const noexcept { return __sb_.view(); }
#endif // _LIBCPP_STD_VER >= 20
- _LIBCPP_HIDE_FROM_ABI void str(const string_type& __s) { __sb_.str(__s); }
+ _LIBCPP_HIDE_FROM_ABI void str(const string_type& __s) { __sb_.str(__s); }
#if _LIBCPP_STD_VER >= 20
- template <class _SAlloc>
- _LIBCPP_HIDE_FROM_ABI void str(const basic_string<char_type, traits_type, _SAlloc>& __s) {
- __sb_.str(__s);
- }
+ template <class _SAlloc>
+ _LIBCPP_HIDE_FROM_ABI void str(const basic_string<char_type, traits_type, _SAlloc>& __s) {
+ __sb_.str(__s);
+ }
- _LIBCPP_HIDE_FROM_ABI void str(string_type&& __s) { __sb_.str(std::move(__s)); }
+ _LIBCPP_HIDE_FROM_ABI void str(string_type&& __s) { __sb_.str(std::move(__s)); }
#endif // _LIBCPP_STD_VER >= 20
};
template <class _CharT, class _Traits, class _Allocator>
-inline _LIBCPP_HIDE_FROM_ABI
-void
-swap(basic_ostringstream<_CharT, _Traits, _Allocator>& __x,
- basic_ostringstream<_CharT, _Traits, _Allocator>& __y)
-{
- __x.swap(__y);
+inline _LIBCPP_HIDE_FROM_ABI void
+swap(basic_ostringstream<_CharT, _Traits, _Allocator>& __x, basic_ostringstream<_CharT, _Traits, _Allocator>& __y) {
+ __x.swap(__y);
}
// Class template basic_stringstream [stringstream]
template <class _CharT, class _Traits, class _Allocator>
-class _LIBCPP_TEMPLATE_VIS basic_stringstream
- : public basic_iostream<_CharT, _Traits>
-{
+class _LIBCPP_TEMPLATE_VIS basic_stringstream : public basic_iostream<_CharT, _Traits> {
public:
- typedef _CharT char_type;
- typedef _Traits traits_type;
- typedef typename traits_type::int_type int_type;
- typedef typename traits_type::pos_type pos_type;
- typedef typename traits_type::off_type off_type;
- typedef _Allocator allocator_type;
+ typedef _CharT char_type;
+ typedef _Traits traits_type;
+ typedef typename traits_type::int_type int_type;
+ typedef typename traits_type::pos_type pos_type;
+ typedef typename traits_type::off_type off_type;
+ typedef _Allocator allocator_type;
- typedef basic_string<char_type, traits_type, allocator_type> string_type;
+ typedef basic_string<char_type, traits_type, allocator_type> string_type;
private:
- basic_stringbuf<char_type, traits_type, allocator_type> __sb_;
+ basic_stringbuf<char_type, traits_type, allocator_type> __sb_;
public:
- // [stringstream.cons] constructors
- _LIBCPP_HIDE_FROM_ABI
- basic_stringstream()
- : basic_iostream<_CharT, _Traits>(&__sb_), __sb_(ios_base::in | ios_base::out) {}
+ // [stringstream.cons] constructors
+ _LIBCPP_HIDE_FROM_ABI basic_stringstream()
+ : basic_iostream<_CharT, _Traits>(&__sb_), __sb_(ios_base::in | ios_base::out) {}
- _LIBCPP_HIDE_FROM_ABI
- explicit basic_stringstream(ios_base::openmode __wch)
- : basic_iostream<_CharT, _Traits>(&__sb_), __sb_(__wch) {}
+ _LIBCPP_HIDE_FROM_ABI explicit basic_stringstream(ios_base::openmode __wch)
+ : basic_iostream<_CharT, _Traits>(&__sb_), __sb_(__wch) {}
- _LIBCPP_HIDE_FROM_ABI
- explicit basic_stringstream(const string_type& __s,
- ios_base::openmode __wch = ios_base::in | ios_base::out)
- : basic_iostream<_CharT, _Traits>(&__sb_)
- , __sb_(__s, __wch)
- { }
+ _LIBCPP_HIDE_FROM_ABI explicit basic_stringstream(const string_type& __s,
+ ios_base::openmode __wch = ios_base::in | ios_base::out)
+ : basic_iostream<_CharT, _Traits>(&__sb_), __sb_(__s, __wch) {}
#if _LIBCPP_STD_VER >= 20
- _LIBCPP_HIDE_FROM_ABI basic_stringstream(ios_base::openmode __wch, const _Allocator& __a)
- : basic_iostream<_CharT, _Traits>(std::addressof(__sb_)), __sb_(__wch, __a) {}
-
- _LIBCPP_HIDE_FROM_ABI explicit basic_stringstream(string_type&& __s, ios_base::openmode __wch = ios_base::out | ios_base::in)
- : basic_iostream<_CharT, _Traits>(std::addressof(__sb_)), __sb_(std::move(__s), __wch) {}
-
- template <class _SAlloc>
- _LIBCPP_HIDE_FROM_ABI basic_stringstream(const basic_string<_CharT, _Traits, _SAlloc>& __s, const _Allocator& __a)
- : basic_stringstream(__s, ios_base::out | ios_base::in, __a) {}
-
- template <class _SAlloc>
- _LIBCPP_HIDE_FROM_ABI basic_stringstream(
- const basic_string<_CharT, _Traits, _SAlloc>& __s, ios_base::openmode __wch, const _Allocator& __a)
- : basic_iostream<_CharT, _Traits>(std::addressof(__sb_)), __sb_(__s, __wch, __a) {}
-
- template <class _SAlloc>
- requires (!is_same_v<_SAlloc, allocator_type>)
- _LIBCPP_HIDE_FROM_ABI explicit basic_stringstream(const basic_string<_CharT, _Traits, _SAlloc>& __s,
- ios_base::openmode __wch = ios_base::out | ios_base::in)
- : basic_iostream<_CharT, _Traits>(std::addressof(__sb_)), __sb_(__s, __wch) {}
+ _LIBCPP_HIDE_FROM_ABI basic_stringstream(ios_base::openmode __wch, const _Allocator& __a)
+ : basic_iostream<_CharT, _Traits>(std::addressof(__sb_)), __sb_(__wch, __a) {}
+
+ _LIBCPP_HIDE_FROM_ABI explicit basic_stringstream(string_type&& __s,
+ ios_base::openmode __wch = ios_base::out | ios_base::in)
+ : basic_iostream<_CharT, _Traits>(std::addressof(__sb_)), __sb_(std::move(__s), __wch) {}
+
+ template <class _SAlloc>
+ _LIBCPP_HIDE_FROM_ABI basic_stringstream(const basic_string<_CharT, _Traits, _SAlloc>& __s, const _Allocator& __a)
+ : basic_stringstream(__s, ios_base::out | ios_base::in, __a) {}
+
+ template <class _SAlloc>
+ _LIBCPP_HIDE_FROM_ABI
+ basic_stringstream(const basic_string<_CharT, _Traits, _SAlloc>& __s, ios_base::openmode __wch, const _Allocator& __a)
+ : basic_iostream<_CharT, _Traits>(std::addressof(__sb_)), __sb_(__s, __wch, __a) {}
+
+ template <class _SAlloc>
+ requires(!is_same_v<_SAlloc, allocator_type>)
+ _LIBCPP_HIDE_FROM_ABI explicit basic_stringstream(const basic_string<_CharT, _Traits, _SAlloc>& __s,
+ ios_base::openmode __wch = ios_base::out | ios_base::in)
+ : basic_iostream<_CharT, _Traits>(std::addressof(__sb_)), __sb_(__s, __wch) {}
#endif // _LIBCPP_STD_VER >= 20
- _LIBCPP_HIDE_FROM_ABI
- basic_stringstream(basic_stringstream&& __rhs)
- : basic_iostream<_CharT, _Traits>(std::move(__rhs))
- , __sb_(std::move(__rhs.__sb_))
- {
- basic_istream<_CharT, _Traits>::set_rdbuf(&__sb_);
- }
+ _LIBCPP_HIDE_FROM_ABI basic_stringstream(basic_stringstream&& __rhs)
+ : basic_iostream<_CharT, _Traits>(std::move(__rhs)), __sb_(std::move(__rhs.__sb_)) {
+ basic_istream<_CharT, _Traits>::set_rdbuf(&__sb_);
+ }
- // [stringstream.assign] Assign and swap:
- basic_stringstream& operator=(basic_stringstream&& __rhs) {
- basic_iostream<char_type, traits_type>::operator=(std::move(__rhs));
- __sb_ = std::move(__rhs.__sb_);
- return *this;
- }
- _LIBCPP_HIDE_FROM_ABI
- void swap(basic_stringstream& __rhs) {
- basic_iostream<char_type, traits_type>::swap(__rhs);
- __sb_.swap(__rhs.__sb_);
- }
+ // [stringstream.assign] Assign and swap:
+ basic_stringstream& operator=(basic_stringstream&& __rhs) {
+ basic_iostream<char_type, traits_type>::operator=(std::move(__rhs));
+ __sb_ = std::move(__rhs.__sb_);
+ return *this;
+ }
+ _LIBCPP_HIDE_FROM_ABI void swap(basic_stringstream& __rhs) {
+ basic_iostream<char_type, traits_type>::swap(__rhs);
+ __sb_.swap(__rhs.__sb_);
+ }
- // [stringstream.members] Member functions:
- _LIBCPP_HIDE_FROM_ABI
- basic_stringbuf<char_type, traits_type, allocator_type>* rdbuf() const {
- return const_cast<basic_stringbuf<char_type, traits_type, allocator_type>*>(&__sb_);
- }
+ // [stringstream.members] Member functions:
+ _LIBCPP_HIDE_FROM_ABI basic_stringbuf<char_type, traits_type, allocator_type>* rdbuf() const {
+ return const_cast<basic_stringbuf<char_type, traits_type, allocator_type>*>(&__sb_);
+ }
#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_BUILDING_LIBRARY)
- _LIBCPP_HIDE_FROM_ABI string_type str() const { return __sb_.str(); }
+ _LIBCPP_HIDE_FROM_ABI string_type str() const { return __sb_.str(); }
#else
- _LIBCPP_HIDE_FROM_ABI_SSTREAM string_type str() const & { return __sb_.str(); }
+ _LIBCPP_HIDE_FROM_ABI_SSTREAM string_type str() const& { return __sb_.str(); }
- _LIBCPP_HIDE_FROM_ABI_SSTREAM string_type str() && { return std::move(__sb_).str(); }
+ _LIBCPP_HIDE_FROM_ABI_SSTREAM string_type str() && { return std::move(__sb_).str(); }
#endif
#if _LIBCPP_STD_VER >= 20
- template <class _SAlloc>
- requires __is_allocator<_SAlloc>::value
- _LIBCPP_HIDE_FROM_ABI basic_string<char_type, traits_type, _SAlloc> str(const _SAlloc& __sa) const {
- return __sb_.str(__sa);
- }
+ template <class _SAlloc>
+ requires __is_allocator<_SAlloc>::value
+ _LIBCPP_HIDE_FROM_ABI basic_string<char_type, traits_type, _SAlloc> str(const _SAlloc& __sa) const {
+ return __sb_.str(__sa);
+ }
- _LIBCPP_HIDE_FROM_ABI basic_string_view<char_type, traits_type> view() const noexcept { return __sb_.view(); }
+ _LIBCPP_HIDE_FROM_ABI basic_string_view<char_type, traits_type> view() const noexcept { return __sb_.view(); }
#endif // _LIBCPP_STD_VER >= 20
- _LIBCPP_HIDE_FROM_ABI void str(const string_type& __s) { __sb_.str(__s); }
+ _LIBCPP_HIDE_FROM_ABI void str(const string_type& __s) { __sb_.str(__s); }
#if _LIBCPP_STD_VER >= 20
- template <class _SAlloc>
- _LIBCPP_HIDE_FROM_ABI void str(const basic_string<char_type, traits_type, _SAlloc>& __s) {
- __sb_.str(__s);
- }
+ template <class _SAlloc>
+ _LIBCPP_HIDE_FROM_ABI void str(const basic_string<char_type, traits_type, _SAlloc>& __s) {
+ __sb_.str(__s);
+ }
- _LIBCPP_HIDE_FROM_ABI void str(string_type&& __s) { __sb_.str(std::move(__s)); }
+ _LIBCPP_HIDE_FROM_ABI void str(string_type&& __s) { __sb_.str(std::move(__s)); }
#endif // _LIBCPP_STD_VER >= 20
};
template <class _CharT, class _Traits, class _Allocator>
-inline _LIBCPP_HIDE_FROM_ABI
-void
-swap(basic_stringstream<_CharT, _Traits, _Allocator>& __x,
- basic_stringstream<_CharT, _Traits, _Allocator>& __y)
-{
- __x.swap(__y);
+inline _LIBCPP_HIDE_FROM_ABI void
+swap(basic_stringstream<_CharT, _Traits, _Allocator>& __x, basic_stringstream<_CharT, _Traits, _Allocator>& __y) {
+ __x.swap(__y);
}
#if _LIBCPP_AVAILABILITY_HAS_ADDITIONAL_IOSTREAM_EXPLICIT_INSTANTIATIONS_1
diff --git a/contrib/llvm-project/libcxx/include/stack b/contrib/llvm-project/libcxx/include/stack
index 63cd7dead78e..546380b0aacd 100644
--- a/contrib/llvm-project/libcxx/include/stack
+++ b/contrib/llvm-project/libcxx/include/stack
@@ -140,267 +140,207 @@ template <class T, class Container>
_LIBCPP_BEGIN_NAMESPACE_STD
-template <class _Tp, class _Container = deque<_Tp> > class _LIBCPP_TEMPLATE_VIS stack;
+template <class _Tp, class _Container = deque<_Tp> >
+class _LIBCPP_TEMPLATE_VIS stack;
template <class _Tp, class _Container>
-_LIBCPP_HIDE_FROM_ABI
-bool
-operator==(const stack<_Tp, _Container>& __x, const stack<_Tp, _Container>& __y);
+_LIBCPP_HIDE_FROM_ABI bool operator==(const stack<_Tp, _Container>& __x, const stack<_Tp, _Container>& __y);
template <class _Tp, class _Container>
-_LIBCPP_HIDE_FROM_ABI
-bool
-operator< (const stack<_Tp, _Container>& __x, const stack<_Tp, _Container>& __y);
+_LIBCPP_HIDE_FROM_ABI bool operator<(const stack<_Tp, _Container>& __x, const stack<_Tp, _Container>& __y);
template <class _Tp, class _Container /*= deque<_Tp>*/>
-class _LIBCPP_TEMPLATE_VIS stack
-{
+class _LIBCPP_TEMPLATE_VIS stack {
public:
- typedef _Container container_type;
- typedef typename container_type::value_type value_type;
- typedef typename container_type::reference reference;
- typedef typename container_type::const_reference const_reference;
- typedef typename container_type::size_type size_type;
- static_assert((is_same<_Tp, value_type>::value), "" );
+ typedef _Container container_type;
+ typedef typename container_type::value_type value_type;
+ typedef typename container_type::reference reference;
+ typedef typename container_type::const_reference const_reference;
+ typedef typename container_type::size_type size_type;
+ static_assert((is_same<_Tp, value_type>::value), "");
protected:
- container_type c;
+ container_type c;
public:
- _LIBCPP_HIDE_FROM_ABI
- stack()
- _NOEXCEPT_(is_nothrow_default_constructible<container_type>::value)
- : c() {}
-
- _LIBCPP_HIDE_FROM_ABI
- stack(const stack& __q) : c(__q.c) {}
+ _LIBCPP_HIDE_FROM_ABI stack() _NOEXCEPT_(is_nothrow_default_constructible<container_type>::value) : c() {}
- _LIBCPP_HIDE_FROM_ABI
- stack& operator=(const stack& __q) {c = __q.c; return *this;}
+ _LIBCPP_HIDE_FROM_ABI stack(const stack& __q) : c(__q.c) {}
+ _LIBCPP_HIDE_FROM_ABI stack& operator=(const stack& __q) {
+ c = __q.c;
+ return *this;
+ }
#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI
- stack(stack&& __q)
- _NOEXCEPT_(is_nothrow_move_constructible<container_type>::value)
- : c(std::move(__q.c)) {}
-
- _LIBCPP_HIDE_FROM_ABI
- stack& operator=(stack&& __q)
- _NOEXCEPT_(is_nothrow_move_assignable<container_type>::value)
- {c = std::move(__q.c); return *this;}
-
- _LIBCPP_HIDE_FROM_ABI
- explicit stack(container_type&& __c) : c(std::move(__c)) {}
+ _LIBCPP_HIDE_FROM_ABI stack(stack&& __q) _NOEXCEPT_(is_nothrow_move_constructible<container_type>::value)
+ : c(std::move(__q.c)) {}
+
+ _LIBCPP_HIDE_FROM_ABI stack& operator=(stack&& __q) _NOEXCEPT_(is_nothrow_move_assignable<container_type>::value) {
+ c = std::move(__q.c);
+ return *this;
+ }
+
+ _LIBCPP_HIDE_FROM_ABI explicit stack(container_type&& __c) : c(std::move(__c)) {}
#endif // _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI
- explicit stack(const container_type& __c) : c(__c) {}
-
- template <class _Alloc>
- _LIBCPP_HIDE_FROM_ABI
- explicit stack(const _Alloc& __a,
- __enable_if_t<uses_allocator<container_type, _Alloc>::value>* = 0)
- : c(__a) {}
- template <class _Alloc>
- _LIBCPP_HIDE_FROM_ABI
- stack(const container_type& __c, const _Alloc& __a,
- __enable_if_t<uses_allocator<container_type, _Alloc>::value>* = 0)
- : c(__c, __a) {}
- template <class _Alloc>
- _LIBCPP_HIDE_FROM_ABI
- stack(const stack& __s, const _Alloc& __a,
- __enable_if_t<uses_allocator<container_type, _Alloc>::value>* = 0)
- : c(__s.c, __a) {}
+ _LIBCPP_HIDE_FROM_ABI explicit stack(const container_type& __c) : c(__c) {}
+
+ template <class _Alloc>
+ _LIBCPP_HIDE_FROM_ABI explicit stack(const _Alloc& __a,
+ __enable_if_t<uses_allocator<container_type, _Alloc>::value>* = 0)
+ : c(__a) {}
+ template <class _Alloc>
+ _LIBCPP_HIDE_FROM_ABI
+ stack(const container_type& __c, const _Alloc& __a, __enable_if_t<uses_allocator<container_type, _Alloc>::value>* = 0)
+ : c(__c, __a) {}
+ template <class _Alloc>
+ _LIBCPP_HIDE_FROM_ABI
+ stack(const stack& __s, const _Alloc& __a, __enable_if_t<uses_allocator<container_type, _Alloc>::value>* = 0)
+ : c(__s.c, __a) {}
#ifndef _LIBCPP_CXX03_LANG
- template <class _Alloc>
- _LIBCPP_HIDE_FROM_ABI
- stack(container_type&& __c, const _Alloc& __a,
- __enable_if_t<uses_allocator<container_type, _Alloc>::value>* = 0)
- : c(std::move(__c), __a) {}
- template <class _Alloc>
- _LIBCPP_HIDE_FROM_ABI
- stack(stack&& __s, const _Alloc& __a,
- __enable_if_t<uses_allocator<container_type, _Alloc>::value>* = 0)
- : c(std::move(__s.c), __a) {}
+ template <class _Alloc>
+ _LIBCPP_HIDE_FROM_ABI
+ stack(container_type&& __c, const _Alloc& __a, __enable_if_t<uses_allocator<container_type, _Alloc>::value>* = 0)
+ : c(std::move(__c), __a) {}
+ template <class _Alloc>
+ _LIBCPP_HIDE_FROM_ABI
+ stack(stack&& __s, const _Alloc& __a, __enable_if_t<uses_allocator<container_type, _Alloc>::value>* = 0)
+ : c(std::move(__s.c), __a) {}
#endif // _LIBCPP_CXX03_LANG
#if _LIBCPP_STD_VER >= 23
- template <class _InputIterator,
- class = __enable_if_t<__has_input_iterator_category<_InputIterator>::value>>
- _LIBCPP_HIDE_FROM_ABI
- stack(_InputIterator __first, _InputIterator __last) : c(__first, __last) {}
-
- template <_ContainerCompatibleRange<_Tp> _Range>
- _LIBCPP_HIDE_FROM_ABI
- stack(from_range_t, _Range&& __range) : c(from_range, std::forward<_Range>(__range)) {}
-
- template <class _InputIterator,
- class _Alloc,
- class = __enable_if_t<__has_input_iterator_category<_InputIterator>::value>,
- class = __enable_if_t<uses_allocator<container_type, _Alloc>::value>>
- _LIBCPP_HIDE_FROM_ABI
- stack(_InputIterator __first, _InputIterator __last, const _Alloc& __alloc) : c(__first, __last, __alloc) {}
-
- template <_ContainerCompatibleRange<_Tp> _Range,
- class _Alloc,
- class = __enable_if_t<uses_allocator<container_type, _Alloc>::value>>
- _LIBCPP_HIDE_FROM_ABI
- stack(from_range_t, _Range&& __range, const _Alloc& __alloc)
- : c(from_range, std::forward<_Range>(__range), __alloc) {}
+ template <class _InputIterator, class = __enable_if_t<__has_input_iterator_category<_InputIterator>::value>>
+ _LIBCPP_HIDE_FROM_ABI stack(_InputIterator __first, _InputIterator __last) : c(__first, __last) {}
-#endif
+ template <_ContainerCompatibleRange<_Tp> _Range>
+ _LIBCPP_HIDE_FROM_ABI stack(from_range_t, _Range&& __range) : c(from_range, std::forward<_Range>(__range)) {}
- _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_HIDE_FROM_ABI
- bool empty() const {return c.empty();}
- _LIBCPP_HIDE_FROM_ABI
- size_type size() const {return c.size();}
- _LIBCPP_HIDE_FROM_ABI
- reference top() {return c.back();}
- _LIBCPP_HIDE_FROM_ABI
- const_reference top() const {return c.back();}
-
- _LIBCPP_HIDE_FROM_ABI
- void push(const value_type& __v) {c.push_back(__v);}
-#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI
- void push(value_type&& __v) {c.push_back(std::move(__v));}
+ template <class _InputIterator,
+ class _Alloc,
+ class = __enable_if_t<__has_input_iterator_category<_InputIterator>::value>,
+ class = __enable_if_t<uses_allocator<container_type, _Alloc>::value>>
+ _LIBCPP_HIDE_FROM_ABI stack(_InputIterator __first, _InputIterator __last, const _Alloc& __alloc)
+ : c(__first, __last, __alloc) {}
-#if _LIBCPP_STD_VER >= 23
- template <_ContainerCompatibleRange<_Tp> _Range>
- _LIBCPP_HIDE_FROM_ABI
- void push_range(_Range&& __range) {
- if constexpr (requires (container_type& __c) {
- __c.append_range(std::forward<_Range>(__range));
- }) {
- c.append_range(std::forward<_Range>(__range));
- } else {
- ranges::copy(std::forward<_Range>(__range), std::back_inserter(c));
- }
- }
-#endif
+ template <_ContainerCompatibleRange<_Tp> _Range,
+ class _Alloc,
+ class = __enable_if_t<uses_allocator<container_type, _Alloc>::value>>
+ _LIBCPP_HIDE_FROM_ABI stack(from_range_t, _Range&& __range, const _Alloc& __alloc)
+ : c(from_range, std::forward<_Range>(__range), __alloc) {}
- template <class... _Args>
- _LIBCPP_HIDE_FROM_ABI
-#if _LIBCPP_STD_VER >= 17
- decltype(auto) emplace(_Args&&... __args)
- { return c.emplace_back(std::forward<_Args>(__args)...);}
-#else
- void emplace(_Args&&... __args)
- { c.emplace_back(std::forward<_Args>(__args)...);}
#endif
-#endif // _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI
- void pop() {c.pop_back();}
+ _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_HIDE_FROM_ABI bool empty() const { return c.empty(); }
+ _LIBCPP_HIDE_FROM_ABI size_type size() const { return c.size(); }
+ _LIBCPP_HIDE_FROM_ABI reference top() { return c.back(); }
+ _LIBCPP_HIDE_FROM_ABI const_reference top() const { return c.back(); }
- _LIBCPP_HIDE_FROM_ABI
- void swap(stack& __s)
- _NOEXCEPT_(__is_nothrow_swappable<container_type>::value)
- {
- using std::swap;
- swap(c, __s.c);
+ _LIBCPP_HIDE_FROM_ABI void push(const value_type& __v) { c.push_back(__v); }
+#ifndef _LIBCPP_CXX03_LANG
+ _LIBCPP_HIDE_FROM_ABI void push(value_type&& __v) { c.push_back(std::move(__v)); }
+
+# if _LIBCPP_STD_VER >= 23
+ template <_ContainerCompatibleRange<_Tp> _Range>
+ _LIBCPP_HIDE_FROM_ABI void push_range(_Range&& __range) {
+ if constexpr (requires(container_type& __c) { __c.append_range(std::forward<_Range>(__range)); }) {
+ c.append_range(std::forward<_Range>(__range));
+ } else {
+ ranges::copy(std::forward<_Range>(__range), std::back_inserter(c));
}
+ }
+# endif
+
+ template <class... _Args>
+ _LIBCPP_HIDE_FROM_ABI
+# if _LIBCPP_STD_VER >= 17
+ decltype(auto)
+ emplace(_Args&&... __args) {
+ return c.emplace_back(std::forward<_Args>(__args)...);
+ }
+# else
+ void
+ emplace(_Args&&... __args) {
+ c.emplace_back(std::forward<_Args>(__args)...);
+ }
+# endif
+#endif // _LIBCPP_CXX03_LANG
+
+ _LIBCPP_HIDE_FROM_ABI void pop() { c.pop_back(); }
+
+ _LIBCPP_HIDE_FROM_ABI void swap(stack& __s) _NOEXCEPT_(__is_nothrow_swappable<container_type>::value) {
+ using std::swap;
+ swap(c, __s.c);
+ }
- _LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI const _Container& __get_container() const { return c; }
+ _LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI const _Container& __get_container() const { return c; }
- template <class _T1, class _OtherContainer>
- friend
- bool
- operator==(const stack<_T1, _OtherContainer>& __x, const stack<_T1, _OtherContainer>& __y);
+ template <class _T1, class _OtherContainer>
+ friend bool operator==(const stack<_T1, _OtherContainer>& __x, const stack<_T1, _OtherContainer>& __y);
- template <class _T1, class _OtherContainer>
- friend
- bool
- operator< (const stack<_T1, _OtherContainer>& __x, const stack<_T1, _OtherContainer>& __y);
+ template <class _T1, class _OtherContainer>
+ friend bool operator<(const stack<_T1, _OtherContainer>& __x, const stack<_T1, _OtherContainer>& __y);
};
#if _LIBCPP_STD_VER >= 17
-template<class _Container,
- class = enable_if_t<!__is_allocator<_Container>::value>
->
-stack(_Container)
- -> stack<typename _Container::value_type, _Container>;
-
-template<class _Container,
- class _Alloc,
- class = enable_if_t<!__is_allocator<_Container>::value>,
- class = enable_if_t<uses_allocator<_Container, _Alloc>::value>
- >
-stack(_Container, _Alloc)
- -> stack<typename _Container::value_type, _Container>;
+template <class _Container, class = enable_if_t<!__is_allocator<_Container>::value> >
+stack(_Container) -> stack<typename _Container::value_type, _Container>;
+
+template <class _Container,
+ class _Alloc,
+ class = enable_if_t<!__is_allocator<_Container>::value>,
+ class = enable_if_t<uses_allocator<_Container, _Alloc>::value> >
+stack(_Container, _Alloc) -> stack<typename _Container::value_type, _Container>;
#endif
#if _LIBCPP_STD_VER >= 23
-template<class _InputIterator,
- class = __enable_if_t<__has_input_iterator_category<_InputIterator>::value>>
-stack(_InputIterator, _InputIterator)
- -> stack<__iter_value_type<_InputIterator>>;
+template <class _InputIterator, class = __enable_if_t<__has_input_iterator_category<_InputIterator>::value>>
+stack(_InputIterator, _InputIterator) -> stack<__iter_value_type<_InputIterator>>;
template <ranges::input_range _Range>
stack(from_range_t, _Range&&) -> stack<ranges::range_value_t<_Range>>;
-template<class _InputIterator,
- class _Alloc,
- class = __enable_if_t<__has_input_iterator_category<_InputIterator>::value>,
- class = __enable_if_t<__is_allocator<_Alloc>::value>>
+template <class _InputIterator,
+ class _Alloc,
+ class = __enable_if_t<__has_input_iterator_category<_InputIterator>::value>,
+ class = __enable_if_t<__is_allocator<_Alloc>::value>>
stack(_InputIterator, _InputIterator, _Alloc)
-> stack<__iter_value_type<_InputIterator>, deque<__iter_value_type<_InputIterator>, _Alloc>>;
-template <ranges::input_range _Range,
- class _Alloc,
- class = __enable_if_t<__is_allocator<_Alloc>::value>>
+template <ranges::input_range _Range, class _Alloc, class = __enable_if_t<__is_allocator<_Alloc>::value>>
stack(from_range_t, _Range&&, _Alloc)
- -> stack<ranges::range_value_t<_Range>, deque<ranges::range_value_t<_Range>, _Alloc>>;
+ -> stack<ranges::range_value_t<_Range>, deque<ranges::range_value_t<_Range>, _Alloc>>;
#endif
template <class _Tp, class _Container>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator==(const stack<_Tp, _Container>& __x, const stack<_Tp, _Container>& __y)
-{
- return __x.c == __y.c;
+inline _LIBCPP_HIDE_FROM_ABI bool operator==(const stack<_Tp, _Container>& __x, const stack<_Tp, _Container>& __y) {
+ return __x.c == __y.c;
}
template <class _Tp, class _Container>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator< (const stack<_Tp, _Container>& __x, const stack<_Tp, _Container>& __y)
-{
- return __x.c < __y.c;
+inline _LIBCPP_HIDE_FROM_ABI bool operator<(const stack<_Tp, _Container>& __x, const stack<_Tp, _Container>& __y) {
+ return __x.c < __y.c;
}
template <class _Tp, class _Container>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator!=(const stack<_Tp, _Container>& __x, const stack<_Tp, _Container>& __y)
-{
- return !(__x == __y);
+inline _LIBCPP_HIDE_FROM_ABI bool operator!=(const stack<_Tp, _Container>& __x, const stack<_Tp, _Container>& __y) {
+ return !(__x == __y);
}
template <class _Tp, class _Container>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator> (const stack<_Tp, _Container>& __x, const stack<_Tp, _Container>& __y)
-{
- return __y < __x;
+inline _LIBCPP_HIDE_FROM_ABI bool operator>(const stack<_Tp, _Container>& __x, const stack<_Tp, _Container>& __y) {
+ return __y < __x;
}
template <class _Tp, class _Container>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator>=(const stack<_Tp, _Container>& __x, const stack<_Tp, _Container>& __y)
-{
- return !(__x < __y);
+inline _LIBCPP_HIDE_FROM_ABI bool operator>=(const stack<_Tp, _Container>& __x, const stack<_Tp, _Container>& __y) {
+ return !(__x < __y);
}
template <class _Tp, class _Container>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator<=(const stack<_Tp, _Container>& __x, const stack<_Tp, _Container>& __y)
-{
- return !(__y < __x);
+inline _LIBCPP_HIDE_FROM_ABI bool operator<=(const stack<_Tp, _Container>& __x, const stack<_Tp, _Container>& __y) {
+ return !(__y < __x);
}
#if _LIBCPP_STD_VER >= 20
@@ -408,25 +348,20 @@ operator<=(const stack<_Tp, _Container>& __x, const stack<_Tp, _Container>& __y)
template <class _Tp, three_way_comparable _Container>
_LIBCPP_HIDE_FROM_ABI compare_three_way_result_t<_Container>
operator<=>(const stack<_Tp, _Container>& __x, const stack<_Tp, _Container>& __y) {
- // clang 16 bug: declaring `friend operator<=>` causes "use of overloaded operator '*' is ambiguous" errors
- return __x.__get_container() <=> __y.__get_container();
+ // clang 16 bug: declaring `friend operator<=>` causes "use of overloaded operator '*' is ambiguous" errors
+ return __x.__get_container() <=> __y.__get_container();
}
#endif
template <class _Tp, class _Container, __enable_if_t<__is_swappable<_Container>::value, int> = 0>
-inline _LIBCPP_HIDE_FROM_ABI
-void
-swap(stack<_Tp, _Container>& __x, stack<_Tp, _Container>& __y)
- _NOEXCEPT_(_NOEXCEPT_(__x.swap(__y)))
-{
- __x.swap(__y);
+inline _LIBCPP_HIDE_FROM_ABI void swap(stack<_Tp, _Container>& __x, stack<_Tp, _Container>& __y)
+ _NOEXCEPT_(_NOEXCEPT_(__x.swap(__y))) {
+ __x.swap(__y);
}
template <class _Tp, class _Container, class _Alloc>
-struct _LIBCPP_TEMPLATE_VIS uses_allocator<stack<_Tp, _Container>, _Alloc>
- : public uses_allocator<_Container, _Alloc>
-{
+struct _LIBCPP_TEMPLATE_VIS uses_allocator<stack<_Tp, _Container>, _Alloc> : public uses_allocator<_Container, _Alloc> {
};
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/stdatomic.h b/contrib/llvm-project/libcxx/include/stdatomic.h
index 9c002e52918e..79772eb7fce1 100644
--- a/contrib/llvm-project/libcxx/include/stdatomic.h
+++ b/contrib/llvm-project/libcxx/include/stdatomic.h
@@ -123,14 +123,14 @@ using std::atomic_signal_fence // see below
#if defined(__cplusplus) && _LIBCPP_STD_VER >= 23
-#include <atomic>
-#include <version>
+# include <atomic>
+# include <version>
-#ifdef _Atomic
-# undef _Atomic
-#endif
+# ifdef _Atomic
+# undef _Atomic
+# endif
-#define _Atomic(_Tp) ::std::atomic<_Tp>
+# define _Atomic(_Tp) ::std::atomic<_Tp>
using std::memory_order _LIBCPP_USING_IF_EXISTS;
using std::memory_order_relaxed _LIBCPP_USING_IF_EXISTS;
@@ -226,9 +226,9 @@ using std::atomic_thread_fence _LIBCPP_USING_IF_EXISTS;
// the header. We do this because Clang has historically shipped a <stdatomic.h>
// header that would be available in all Standard modes, and we don't want to
// break that use case.
-# if __has_include_next(<stdatomic.h>)
-# include_next <stdatomic.h>
-# endif
+# if __has_include_next(<stdatomic.h>)
+# include_next <stdatomic.h>
+# endif
#endif // defined(__cplusplus) && _LIBCPP_STD_VER >= 23
diff --git a/contrib/llvm-project/libcxx/include/stdbool.h b/contrib/llvm-project/libcxx/include/stdbool.h
index 74869b46d561..e74d91f45945 100644
--- a/contrib/llvm-project/libcxx/include/stdbool.h
+++ b/contrib/llvm-project/libcxx/include/stdbool.h
@@ -30,11 +30,11 @@ Macros:
#endif
#ifdef __cplusplus
-#undef bool
-#undef true
-#undef false
-#undef __bool_true_false_are_defined
-#define __bool_true_false_are_defined 1
+# undef bool
+# undef true
+# undef false
+# undef __bool_true_false_are_defined
+# define __bool_true_false_are_defined 1
#endif
#endif // _LIBCPP_STDBOOL_H
diff --git a/contrib/llvm-project/libcxx/include/stddef.h b/contrib/llvm-project/libcxx/include/stddef.h
index f1725db06212..887776b150e4 100644
--- a/contrib/llvm-project/libcxx/include/stddef.h
+++ b/contrib/llvm-project/libcxx/include/stddef.h
@@ -7,17 +7,17 @@
//
//===----------------------------------------------------------------------===//
-#if defined(__need_ptrdiff_t) || defined(__need_size_t) || \
- defined(__need_wchar_t) || defined(__need_NULL) || defined(__need_wint_t)
+#if defined(__need_ptrdiff_t) || defined(__need_size_t) || defined(__need_wchar_t) || defined(__need_NULL) || \
+ defined(__need_wint_t)
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
+# if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+# pragma GCC system_header
+# endif
-#include_next <stddef.h>
+# include_next <stddef.h>
#elif !defined(_LIBCPP_STDDEF_H)
-#define _LIBCPP_STDDEF_H
+# define _LIBCPP_STDDEF_H
/*
stddef.h synopsis
@@ -36,18 +36,18 @@ Types:
*/
-#include <__config>
+# include <__config>
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
+# if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+# pragma GCC system_header
+# endif
# if __has_include_next(<stddef.h>)
# include_next <stddef.h>
# endif
-#ifdef __cplusplus
- typedef decltype(nullptr) nullptr_t;
-#endif
+# ifdef __cplusplus
+typedef decltype(nullptr) nullptr_t;
+# endif
#endif // _LIBCPP_STDDEF_H
diff --git a/contrib/llvm-project/libcxx/include/stdexcept b/contrib/llvm-project/libcxx/include/stdexcept
index d41e94a5f9e8..3016c130a91b 100644
--- a/contrib/llvm-project/libcxx/include/stdexcept
+++ b/contrib/llvm-project/libcxx/include/stdexcept
@@ -54,166 +54,154 @@ public:
_LIBCPP_BEGIN_NAMESPACE_STD
#ifndef _LIBCPP_ABI_VCRUNTIME
-class _LIBCPP_HIDDEN __libcpp_refstring
-{
- const char* __imp_;
+class _LIBCPP_HIDDEN __libcpp_refstring {
+ const char* __imp_;
+
+ bool __uses_refcount() const;
- bool __uses_refcount() const;
public:
- explicit __libcpp_refstring(const char* __msg);
- __libcpp_refstring(const __libcpp_refstring& __s) _NOEXCEPT;
- __libcpp_refstring& operator=(const __libcpp_refstring& __s) _NOEXCEPT;
- ~__libcpp_refstring();
+ explicit __libcpp_refstring(const char* __msg);
+ __libcpp_refstring(const __libcpp_refstring& __s) _NOEXCEPT;
+ __libcpp_refstring& operator=(const __libcpp_refstring& __s) _NOEXCEPT;
+ ~__libcpp_refstring();
- _LIBCPP_HIDE_FROM_ABI const char* c_str() const _NOEXCEPT {return __imp_;}
+ _LIBCPP_HIDE_FROM_ABI const char* c_str() const _NOEXCEPT { return __imp_; }
};
#endif // !_LIBCPP_ABI_VCRUNTIME
_LIBCPP_END_NAMESPACE_STD
-namespace std // purposefully not using versioning namespace
+namespace std // purposefully not using versioning namespace
{
-class _LIBCPP_EXPORTED_FROM_ABI logic_error
- : public exception
-{
+class _LIBCPP_EXPORTED_FROM_ABI logic_error : public exception {
#ifndef _LIBCPP_ABI_VCRUNTIME
+
private:
- std::__libcpp_refstring __imp_;
+ std::__libcpp_refstring __imp_;
+
public:
- explicit logic_error(const string&);
- explicit logic_error(const char*);
+ explicit logic_error(const string&);
+ explicit logic_error(const char*);
- logic_error(const logic_error&) _NOEXCEPT;
- logic_error& operator=(const logic_error&) _NOEXCEPT;
+ logic_error(const logic_error&) _NOEXCEPT;
+ logic_error& operator=(const logic_error&) _NOEXCEPT;
- ~logic_error() _NOEXCEPT override;
+ ~logic_error() _NOEXCEPT override;
- const char* what() const _NOEXCEPT override;
+ const char* what() const _NOEXCEPT override;
#else
+
public:
- explicit logic_error(const std::string&); // Symbol uses versioned std::string
- _LIBCPP_HIDE_FROM_ABI explicit logic_error(const char* __s) : exception(__s) {}
+ explicit logic_error(const std::string&); // Symbol uses versioned std::string
+ _LIBCPP_HIDE_FROM_ABI explicit logic_error(const char* __s) : exception(__s) {}
#endif
};
-class _LIBCPP_EXPORTED_FROM_ABI runtime_error
- : public exception
-{
+class _LIBCPP_EXPORTED_FROM_ABI runtime_error : public exception {
#ifndef _LIBCPP_ABI_VCRUNTIME
+
private:
- std::__libcpp_refstring __imp_;
+ std::__libcpp_refstring __imp_;
+
public:
- explicit runtime_error(const string&);
- explicit runtime_error(const char*);
+ explicit runtime_error(const string&);
+ explicit runtime_error(const char*);
- runtime_error(const runtime_error&) _NOEXCEPT;
- runtime_error& operator=(const runtime_error&) _NOEXCEPT;
+ runtime_error(const runtime_error&) _NOEXCEPT;
+ runtime_error& operator=(const runtime_error&) _NOEXCEPT;
- ~runtime_error() _NOEXCEPT override;
+ ~runtime_error() _NOEXCEPT override;
- const char* what() const _NOEXCEPT override;
+ const char* what() const _NOEXCEPT override;
#else
+
public:
- explicit runtime_error(const std::string&); // Symbol uses versioned std::string
- _LIBCPP_HIDE_FROM_ABI explicit runtime_error(const char* __s) : exception(__s) {}
+ explicit runtime_error(const std::string&); // Symbol uses versioned std::string
+ _LIBCPP_HIDE_FROM_ABI explicit runtime_error(const char* __s) : exception(__s) {}
#endif // _LIBCPP_ABI_VCRUNTIME
};
-class _LIBCPP_EXPORTED_FROM_ABI domain_error
- : public logic_error
-{
+class _LIBCPP_EXPORTED_FROM_ABI domain_error : public logic_error {
public:
- _LIBCPP_HIDE_FROM_ABI explicit domain_error(const string& __s) : logic_error(__s) {}
- _LIBCPP_HIDE_FROM_ABI explicit domain_error(const char* __s) : logic_error(__s) {}
+ _LIBCPP_HIDE_FROM_ABI explicit domain_error(const string& __s) : logic_error(__s) {}
+ _LIBCPP_HIDE_FROM_ABI explicit domain_error(const char* __s) : logic_error(__s) {}
#ifndef _LIBCPP_ABI_VCRUNTIME
- _LIBCPP_HIDE_FROM_ABI domain_error(const domain_error&) _NOEXCEPT = default;
- _LIBCPP_HIDE_FROM_ABI domain_error& operator=(const domain_error&) _NOEXCEPT = default;
- ~domain_error() _NOEXCEPT override;
+ _LIBCPP_HIDE_FROM_ABI domain_error(const domain_error&) _NOEXCEPT = default;
+ _LIBCPP_HIDE_FROM_ABI domain_error& operator=(const domain_error&) _NOEXCEPT = default;
+ ~domain_error() _NOEXCEPT override;
#endif
};
-class _LIBCPP_EXPORTED_FROM_ABI invalid_argument
- : public logic_error
-{
+class _LIBCPP_EXPORTED_FROM_ABI invalid_argument : public logic_error {
public:
- _LIBCPP_HIDE_FROM_ABI explicit invalid_argument(const string& __s) : logic_error(__s) {}
- _LIBCPP_HIDE_FROM_ABI explicit invalid_argument(const char* __s) : logic_error(__s) {}
+ _LIBCPP_HIDE_FROM_ABI explicit invalid_argument(const string& __s) : logic_error(__s) {}
+ _LIBCPP_HIDE_FROM_ABI explicit invalid_argument(const char* __s) : logic_error(__s) {}
#ifndef _LIBCPP_ABI_VCRUNTIME
- _LIBCPP_HIDE_FROM_ABI invalid_argument(const invalid_argument&) _NOEXCEPT = default;
- _LIBCPP_HIDE_FROM_ABI invalid_argument& operator=(const invalid_argument&) _NOEXCEPT = default;
- ~invalid_argument() _NOEXCEPT override;
+ _LIBCPP_HIDE_FROM_ABI invalid_argument(const invalid_argument&) _NOEXCEPT = default;
+ _LIBCPP_HIDE_FROM_ABI invalid_argument& operator=(const invalid_argument&) _NOEXCEPT = default;
+ ~invalid_argument() _NOEXCEPT override;
#endif
};
-class _LIBCPP_EXPORTED_FROM_ABI length_error
- : public logic_error
-{
+class _LIBCPP_EXPORTED_FROM_ABI length_error : public logic_error {
public:
- _LIBCPP_HIDE_FROM_ABI explicit length_error(const string& __s) : logic_error(__s) {}
- _LIBCPP_HIDE_FROM_ABI explicit length_error(const char* __s) : logic_error(__s) {}
+ _LIBCPP_HIDE_FROM_ABI explicit length_error(const string& __s) : logic_error(__s) {}
+ _LIBCPP_HIDE_FROM_ABI explicit length_error(const char* __s) : logic_error(__s) {}
#ifndef _LIBCPP_ABI_VCRUNTIME
- _LIBCPP_HIDE_FROM_ABI length_error(const length_error&) _NOEXCEPT = default;
- _LIBCPP_HIDE_FROM_ABI length_error& operator=(const length_error&) _NOEXCEPT = default;
- ~length_error() _NOEXCEPT override;
+ _LIBCPP_HIDE_FROM_ABI length_error(const length_error&) _NOEXCEPT = default;
+ _LIBCPP_HIDE_FROM_ABI length_error& operator=(const length_error&) _NOEXCEPT = default;
+ ~length_error() _NOEXCEPT override;
#endif
};
-class _LIBCPP_EXPORTED_FROM_ABI out_of_range
- : public logic_error
-{
+class _LIBCPP_EXPORTED_FROM_ABI out_of_range : public logic_error {
public:
- _LIBCPP_HIDE_FROM_ABI explicit out_of_range(const string& __s) : logic_error(__s) {}
- _LIBCPP_HIDE_FROM_ABI explicit out_of_range(const char* __s) : logic_error(__s) {}
+ _LIBCPP_HIDE_FROM_ABI explicit out_of_range(const string& __s) : logic_error(__s) {}
+ _LIBCPP_HIDE_FROM_ABI explicit out_of_range(const char* __s) : logic_error(__s) {}
#ifndef _LIBCPP_ABI_VCRUNTIME
- _LIBCPP_HIDE_FROM_ABI out_of_range(const out_of_range&) _NOEXCEPT = default;
- _LIBCPP_HIDE_FROM_ABI out_of_range& operator=(const out_of_range&) _NOEXCEPT = default;
- ~out_of_range() _NOEXCEPT override;
+ _LIBCPP_HIDE_FROM_ABI out_of_range(const out_of_range&) _NOEXCEPT = default;
+ _LIBCPP_HIDE_FROM_ABI out_of_range& operator=(const out_of_range&) _NOEXCEPT = default;
+ ~out_of_range() _NOEXCEPT override;
#endif
};
-class _LIBCPP_EXPORTED_FROM_ABI range_error
- : public runtime_error
-{
+class _LIBCPP_EXPORTED_FROM_ABI range_error : public runtime_error {
public:
- _LIBCPP_HIDE_FROM_ABI explicit range_error(const string& __s) : runtime_error(__s) {}
- _LIBCPP_HIDE_FROM_ABI explicit range_error(const char* __s) : runtime_error(__s) {}
+ _LIBCPP_HIDE_FROM_ABI explicit range_error(const string& __s) : runtime_error(__s) {}
+ _LIBCPP_HIDE_FROM_ABI explicit range_error(const char* __s) : runtime_error(__s) {}
#ifndef _LIBCPP_ABI_VCRUNTIME
- _LIBCPP_HIDE_FROM_ABI range_error(const range_error&) _NOEXCEPT = default;
- _LIBCPP_HIDE_FROM_ABI range_error& operator=(const range_error&) _NOEXCEPT = default;
- ~range_error() _NOEXCEPT override;
+ _LIBCPP_HIDE_FROM_ABI range_error(const range_error&) _NOEXCEPT = default;
+ _LIBCPP_HIDE_FROM_ABI range_error& operator=(const range_error&) _NOEXCEPT = default;
+ ~range_error() _NOEXCEPT override;
#endif
};
-class _LIBCPP_EXPORTED_FROM_ABI overflow_error
- : public runtime_error
-{
+class _LIBCPP_EXPORTED_FROM_ABI overflow_error : public runtime_error {
public:
- _LIBCPP_HIDE_FROM_ABI explicit overflow_error(const string& __s) : runtime_error(__s) {}
- _LIBCPP_HIDE_FROM_ABI explicit overflow_error(const char* __s) : runtime_error(__s) {}
+ _LIBCPP_HIDE_FROM_ABI explicit overflow_error(const string& __s) : runtime_error(__s) {}
+ _LIBCPP_HIDE_FROM_ABI explicit overflow_error(const char* __s) : runtime_error(__s) {}
#ifndef _LIBCPP_ABI_VCRUNTIME
- _LIBCPP_HIDE_FROM_ABI overflow_error(const overflow_error&) _NOEXCEPT = default;
- _LIBCPP_HIDE_FROM_ABI overflow_error& operator=(const overflow_error&) _NOEXCEPT = default;
- ~overflow_error() _NOEXCEPT override;
+ _LIBCPP_HIDE_FROM_ABI overflow_error(const overflow_error&) _NOEXCEPT = default;
+ _LIBCPP_HIDE_FROM_ABI overflow_error& operator=(const overflow_error&) _NOEXCEPT = default;
+ ~overflow_error() _NOEXCEPT override;
#endif
};
-class _LIBCPP_EXPORTED_FROM_ABI underflow_error
- : public runtime_error
-{
+class _LIBCPP_EXPORTED_FROM_ABI underflow_error : public runtime_error {
public:
- _LIBCPP_HIDE_FROM_ABI explicit underflow_error(const string& __s) : runtime_error(__s) {}
- _LIBCPP_HIDE_FROM_ABI explicit underflow_error(const char* __s) : runtime_error(__s) {}
+ _LIBCPP_HIDE_FROM_ABI explicit underflow_error(const string& __s) : runtime_error(__s) {}
+ _LIBCPP_HIDE_FROM_ABI explicit underflow_error(const char* __s) : runtime_error(__s) {}
#ifndef _LIBCPP_ABI_VCRUNTIME
- _LIBCPP_HIDE_FROM_ABI underflow_error(const underflow_error&) _NOEXCEPT = default;
- _LIBCPP_HIDE_FROM_ABI underflow_error& operator=(const underflow_error&) _NOEXCEPT = default;
- ~underflow_error() _NOEXCEPT override;
+ _LIBCPP_HIDE_FROM_ABI underflow_error(const underflow_error&) _NOEXCEPT = default;
+ _LIBCPP_HIDE_FROM_ABI underflow_error& operator=(const underflow_error&) _NOEXCEPT = default;
+ ~underflow_error() _NOEXCEPT override;
#endif
};
@@ -224,83 +212,67 @@ _LIBCPP_BEGIN_NAMESPACE_STD
// in the dylib
_LIBCPP_NORETURN _LIBCPP_EXPORTED_FROM_ABI void __throw_runtime_error(const char*);
-_LIBCPP_NORETURN inline _LIBCPP_HIDE_FROM_ABI
-void __throw_logic_error(const char*__msg)
-{
+_LIBCPP_NORETURN inline _LIBCPP_HIDE_FROM_ABI void __throw_logic_error(const char* __msg) {
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- throw logic_error(__msg);
+ throw logic_error(__msg);
#else
- _LIBCPP_VERBOSE_ABORT("logic_error was thrown in -fno-exceptions mode with message \"%s\"", __msg);
+ _LIBCPP_VERBOSE_ABORT("logic_error was thrown in -fno-exceptions mode with message \"%s\"", __msg);
#endif
}
-_LIBCPP_NORETURN inline _LIBCPP_HIDE_FROM_ABI
-void __throw_domain_error(const char*__msg)
-{
+_LIBCPP_NORETURN inline _LIBCPP_HIDE_FROM_ABI void __throw_domain_error(const char* __msg) {
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- throw domain_error(__msg);
+ throw domain_error(__msg);
#else
- _LIBCPP_VERBOSE_ABORT("domain_error was thrown in -fno-exceptions mode with message \"%s\"", __msg);
+ _LIBCPP_VERBOSE_ABORT("domain_error was thrown in -fno-exceptions mode with message \"%s\"", __msg);
#endif
}
-_LIBCPP_NORETURN inline _LIBCPP_HIDE_FROM_ABI
-void __throw_invalid_argument(const char*__msg)
-{
+_LIBCPP_NORETURN inline _LIBCPP_HIDE_FROM_ABI void __throw_invalid_argument(const char* __msg) {
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- throw invalid_argument(__msg);
+ throw invalid_argument(__msg);
#else
- _LIBCPP_VERBOSE_ABORT("invalid_argument was thrown in -fno-exceptions mode with message \"%s\"", __msg);
+ _LIBCPP_VERBOSE_ABORT("invalid_argument was thrown in -fno-exceptions mode with message \"%s\"", __msg);
#endif
}
-_LIBCPP_NORETURN inline _LIBCPP_HIDE_FROM_ABI
-void __throw_length_error(const char*__msg)
-{
+_LIBCPP_NORETURN inline _LIBCPP_HIDE_FROM_ABI void __throw_length_error(const char* __msg) {
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- throw length_error(__msg);
+ throw length_error(__msg);
#else
- _LIBCPP_VERBOSE_ABORT("length_error was thrown in -fno-exceptions mode with message \"%s\"", __msg);
+ _LIBCPP_VERBOSE_ABORT("length_error was thrown in -fno-exceptions mode with message \"%s\"", __msg);
#endif
}
-_LIBCPP_NORETURN inline _LIBCPP_HIDE_FROM_ABI
-void __throw_out_of_range(const char*__msg)
-{
+_LIBCPP_NORETURN inline _LIBCPP_HIDE_FROM_ABI void __throw_out_of_range(const char* __msg) {
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- throw out_of_range(__msg);
+ throw out_of_range(__msg);
#else
- _LIBCPP_VERBOSE_ABORT("out_of_range was thrown in -fno-exceptions mode with message \"%s\"", __msg);
+ _LIBCPP_VERBOSE_ABORT("out_of_range was thrown in -fno-exceptions mode with message \"%s\"", __msg);
#endif
}
-_LIBCPP_NORETURN inline _LIBCPP_HIDE_FROM_ABI
-void __throw_range_error(const char*__msg)
-{
+_LIBCPP_NORETURN inline _LIBCPP_HIDE_FROM_ABI void __throw_range_error(const char* __msg) {
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- throw range_error(__msg);
+ throw range_error(__msg);
#else
- _LIBCPP_VERBOSE_ABORT("range_error was thrown in -fno-exceptions mode with message \"%s\"", __msg);
+ _LIBCPP_VERBOSE_ABORT("range_error was thrown in -fno-exceptions mode with message \"%s\"", __msg);
#endif
}
-_LIBCPP_NORETURN inline _LIBCPP_HIDE_FROM_ABI
-void __throw_overflow_error(const char*__msg)
-{
+_LIBCPP_NORETURN inline _LIBCPP_HIDE_FROM_ABI void __throw_overflow_error(const char* __msg) {
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- throw overflow_error(__msg);
+ throw overflow_error(__msg);
#else
- _LIBCPP_VERBOSE_ABORT("overflow_error was thrown in -fno-exceptions mode with message \"%s\"", __msg);
+ _LIBCPP_VERBOSE_ABORT("overflow_error was thrown in -fno-exceptions mode with message \"%s\"", __msg);
#endif
}
-_LIBCPP_NORETURN inline _LIBCPP_HIDE_FROM_ABI
-void __throw_underflow_error(const char*__msg)
-{
+_LIBCPP_NORETURN inline _LIBCPP_HIDE_FROM_ABI void __throw_underflow_error(const char* __msg) {
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- throw underflow_error(__msg);
+ throw underflow_error(__msg);
#else
- _LIBCPP_VERBOSE_ABORT("underflow_error was thrown in -fno-exceptions mode with message \"%s\"", __msg);
+ _LIBCPP_VERBOSE_ABORT("underflow_error was thrown in -fno-exceptions mode with message \"%s\"", __msg);
#endif
}
diff --git a/contrib/llvm-project/libcxx/include/stdint.h b/contrib/llvm-project/libcxx/include/stdint.h
index fa7b011c71ae..35e5b8cbdad2 100644
--- a/contrib/llvm-project/libcxx/include/stdint.h
+++ b/contrib/llvm-project/libcxx/include/stdint.h
@@ -12,7 +12,7 @@
// is defined until an inclusion of it without _STD_TYPES_T occurs, in which
// case the header guard macro is defined.
#if !defined(_AIX) || !defined(_STD_TYPES_T)
-#define _LIBCPP_STDINT_H
+# define _LIBCPP_STDINT_H
#endif // _STD_TYPES_T
/*
@@ -114,10 +114,10 @@ Macros:
are defined
*/
#if defined(__cplusplus) && !defined(__STDC_LIMIT_MACROS)
-# define __STDC_LIMIT_MACROS
+# define __STDC_LIMIT_MACROS
#endif
#if defined(__cplusplus) && !defined(__STDC_CONSTANT_MACROS)
-# define __STDC_CONSTANT_MACROS
+# define __STDC_CONSTANT_MACROS
#endif
#if __has_include_next(<stdint.h>)
diff --git a/contrib/llvm-project/libcxx/include/stdio.h b/contrib/llvm-project/libcxx/include/stdio.h
index 72ed5c9f94af..3aa559393f18 100644
--- a/contrib/llvm-project/libcxx/include/stdio.h
+++ b/contrib/llvm-project/libcxx/include/stdio.h
@@ -9,14 +9,14 @@
#if defined(__need_FILE) || defined(__need___FILE)
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
+# if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+# pragma GCC system_header
+# endif
-#include_next <stdio.h>
+# include_next <stdio.h>
#elif !defined(_LIBCPP_STDIO_H)
-#define _LIBCPP_STDIO_H
+# define _LIBCPP_STDIO_H
/*
stdio.h synopsis
@@ -98,26 +98,26 @@ int ferror(FILE* stream);
void perror(const char* s);
*/
-#include <__config>
+# include <__config>
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
+# if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+# pragma GCC system_header
+# endif
# if __has_include_next(<stdio.h>)
# include_next <stdio.h>
# endif
-#ifdef __cplusplus
+# ifdef __cplusplus
-#undef getc
-#undef putc
-#undef clearerr
-#undef feof
-#undef ferror
-#undef putchar
-#undef getchar
+# undef getc
+# undef putc
+# undef clearerr
+# undef feof
+# undef ferror
+# undef putchar
+# undef getchar
-#endif
+# endif
#endif // _LIBCPP_STDIO_H
diff --git a/contrib/llvm-project/libcxx/include/stdlib.h b/contrib/llvm-project/libcxx/include/stdlib.h
index 712f12149c13..a9ba438a2c42 100644
--- a/contrib/llvm-project/libcxx/include/stdlib.h
+++ b/contrib/llvm-project/libcxx/include/stdlib.h
@@ -9,14 +9,14 @@
#if defined(__need_malloc_and_calloc)
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
+# if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+# pragma GCC system_header
+# endif
-#include_next <stdlib.h>
+# include_next <stdlib.h>
#elif !defined(_LIBCPP_STDLIB_H)
-#define _LIBCPP_STDLIB_H
+# define _LIBCPP_STDLIB_H
/*
stdlib.h synopsis
@@ -84,39 +84,37 @@ void *aligned_alloc(size_t alignment, size_t size); // C11
*/
-#include <__config>
+# include <__config>
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
+# if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+# pragma GCC system_header
+# endif
# if __has_include_next(<stdlib.h>)
# include_next <stdlib.h>
# endif
-#ifdef __cplusplus
+# ifdef __cplusplus
extern "C++" {
// abs
-#ifdef abs
-# undef abs
-#endif
-#ifdef labs
-# undef labs
-#endif
-#ifdef llabs
-# undef llabs
-#endif
+# ifdef abs
+# undef abs
+# endif
+# ifdef labs
+# undef labs
+# endif
+# ifdef llabs
+# undef llabs
+# endif
// MSVCRT already has the correct prototype in <stdlib.h> if __cplusplus is defined
-#if !defined(_LIBCPP_MSVCRT)
-_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI long abs(long __x) _NOEXCEPT {
- return __builtin_labs(__x);
-}
+# if !defined(_LIBCPP_MSVCRT)
+_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI long abs(long __x) _NOEXCEPT { return __builtin_labs(__x); }
_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI long long abs(long long __x) _NOEXCEPT {
return __builtin_llabs(__x);
}
-#endif // !defined(_LIBCPP_MSVCRT)
+# endif // !defined(_LIBCPP_MSVCRT)
_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI float abs(float __lcpp_x) _NOEXCEPT {
return __builtin_fabsf(__lcpp_x); // Use builtins to prevent needing math.h
@@ -126,36 +124,30 @@ _LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI double abs(double __lcpp_x) _
return __builtin_fabs(__lcpp_x);
}
-_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI long double
-abs(long double __lcpp_x) _NOEXCEPT {
+_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI long double abs(long double __lcpp_x) _NOEXCEPT {
return __builtin_fabsl(__lcpp_x);
}
// div
-#ifdef div
-# undef div
-#endif
-#ifdef ldiv
-# undef ldiv
-#endif
-#ifdef lldiv
-# undef lldiv
-#endif
+# ifdef div
+# undef div
+# endif
+# ifdef ldiv
+# undef ldiv
+# endif
+# ifdef lldiv
+# undef lldiv
+# endif
// MSVCRT already has the correct prototype in <stdlib.h> if __cplusplus is defined
-#if !defined(_LIBCPP_MSVCRT)
-inline _LIBCPP_HIDE_FROM_ABI ldiv_t div(long __x, long __y) _NOEXCEPT {
- return ::ldiv(__x, __y);
-}
-#if !(defined(__FreeBSD__) && !defined(__LONG_LONG_SUPPORTED))
-inline _LIBCPP_HIDE_FROM_ABI lldiv_t div(long long __x,
- long long __y) _NOEXCEPT {
- return ::lldiv(__x, __y);
-}
-#endif
-#endif // _LIBCPP_MSVCRT
+# if !defined(_LIBCPP_MSVCRT)
+inline _LIBCPP_HIDE_FROM_ABI ldiv_t div(long __x, long __y) _NOEXCEPT { return ::ldiv(__x, __y); }
+# if !(defined(__FreeBSD__) && !defined(__LONG_LONG_SUPPORTED))
+inline _LIBCPP_HIDE_FROM_ABI lldiv_t div(long long __x, long long __y) _NOEXCEPT { return ::lldiv(__x, __y); }
+# endif
+# endif // _LIBCPP_MSVCRT
} // extern "C++"
-#endif // __cplusplus
+# endif // __cplusplus
#endif // _LIBCPP_STDLIB_H
diff --git a/contrib/llvm-project/libcxx/include/streambuf b/contrib/llvm-project/libcxx/include/streambuf
index b0e65b13151f..577ad340d033 100644
--- a/contrib/llvm-project/libcxx/include/streambuf
+++ b/contrib/llvm-project/libcxx/include/streambuf
@@ -125,201 +125,173 @@ _LIBCPP_PUSH_MACROS
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _CharT, class _Traits>
-class _LIBCPP_TEMPLATE_VIS basic_streambuf
-{
+class _LIBCPP_TEMPLATE_VIS basic_streambuf {
public:
- // types:
- typedef _CharT char_type;
- typedef _Traits traits_type;
- typedef typename traits_type::int_type int_type;
- typedef typename traits_type::pos_type pos_type;
- typedef typename traits_type::off_type off_type;
-
- static_assert((is_same<_CharT, typename traits_type::char_type>::value),
- "traits_type::char_type must be the same type as CharT");
-
- virtual ~basic_streambuf();
-
- // 27.6.2.2.1 locales:
- inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1
- locale pubimbue(const locale& __loc) {
- imbue(__loc);
- locale __r = __loc_;
- __loc_ = __loc;
- return __r;
- }
-
- inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1
- locale getloc() const { return __loc_; }
-
- // 27.6.2.2.2 buffer and positioning:
- inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1
- basic_streambuf* pubsetbuf(char_type* __s, streamsize __n)
- { return setbuf(__s, __n); }
-
- inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1
- pos_type pubseekoff(off_type __off, ios_base::seekdir __way,
- ios_base::openmode __which = ios_base::in | ios_base::out)
- { return seekoff(__off, __way, __which); }
-
- inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1
- pos_type pubseekpos(pos_type __sp,
- ios_base::openmode __which = ios_base::in | ios_base::out)
- { return seekpos(__sp, __which); }
-
- inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1
- int pubsync() { return sync(); }
-
- // Get and put areas:
- // 27.6.2.2.3 Get area:
- inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1
- streamsize in_avail() {
- if (__ninp_ < __einp_)
- return static_cast<streamsize>(__einp_ - __ninp_);
- return showmanyc();
- }
-
- inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1
- int_type snextc() {
- if (sbumpc() == traits_type::eof())
- return traits_type::eof();
- return sgetc();
- }
-
- inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1
- int_type sbumpc() {
- if (__ninp_ == __einp_)
- return uflow();
- return traits_type::to_int_type(*__ninp_++);
- }
-
- inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1
- int_type sgetc() {
- if (__ninp_ == __einp_)
- return underflow();
- return traits_type::to_int_type(*__ninp_);
- }
-
- inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1
- streamsize sgetn(char_type* __s, streamsize __n)
- { return xsgetn(__s, __n); }
-
- // 27.6.2.2.4 Putback:
- inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1
- int_type sputbackc(char_type __c) {
- if (__binp_ == __ninp_ || !traits_type::eq(__c, __ninp_[-1]))
- return pbackfail(traits_type::to_int_type(__c));
- return traits_type::to_int_type(*--__ninp_);
- }
-
- inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1
- int_type sungetc() {
- if (__binp_ == __ninp_)
- return pbackfail();
- return traits_type::to_int_type(*--__ninp_);
- }
-
- // 27.6.2.2.5 Put area:
- inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1
- int_type sputc(char_type __c) {
- if (__nout_ == __eout_)
- return overflow(traits_type::to_int_type(__c));
- *__nout_++ = __c;
- return traits_type::to_int_type(__c);
- }
-
- inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1
- streamsize sputn(const char_type* __s, streamsize __n)
- { return xsputn(__s, __n); }
+ // types:
+ typedef _CharT char_type;
+ typedef _Traits traits_type;
+ typedef typename traits_type::int_type int_type;
+ typedef typename traits_type::pos_type pos_type;
+ typedef typename traits_type::off_type off_type;
+
+ static_assert((is_same<_CharT, typename traits_type::char_type>::value),
+ "traits_type::char_type must be the same type as CharT");
+
+ virtual ~basic_streambuf();
+
+ // 27.6.2.2.1 locales:
+ inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1 locale pubimbue(const locale& __loc) {
+ imbue(__loc);
+ locale __r = __loc_;
+ __loc_ = __loc;
+ return __r;
+ }
+
+ inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1 locale getloc() const { return __loc_; }
+
+ // 27.6.2.2.2 buffer and positioning:
+ inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1 basic_streambuf* pubsetbuf(char_type* __s, streamsize __n) {
+ return setbuf(__s, __n);
+ }
+
+ inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1 pos_type
+ pubseekoff(off_type __off, ios_base::seekdir __way, ios_base::openmode __which = ios_base::in | ios_base::out) {
+ return seekoff(__off, __way, __which);
+ }
+
+ inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1 pos_type
+ pubseekpos(pos_type __sp, ios_base::openmode __which = ios_base::in | ios_base::out) {
+ return seekpos(__sp, __which);
+ }
+
+ inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1 int pubsync() { return sync(); }
+
+ // Get and put areas:
+ // 27.6.2.2.3 Get area:
+ inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1 streamsize in_avail() {
+ if (__ninp_ < __einp_)
+ return static_cast<streamsize>(__einp_ - __ninp_);
+ return showmanyc();
+ }
+
+ inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1 int_type snextc() {
+ if (sbumpc() == traits_type::eof())
+ return traits_type::eof();
+ return sgetc();
+ }
+
+ inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1 int_type sbumpc() {
+ if (__ninp_ == __einp_)
+ return uflow();
+ return traits_type::to_int_type(*__ninp_++);
+ }
+
+ inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1 int_type sgetc() {
+ if (__ninp_ == __einp_)
+ return underflow();
+ return traits_type::to_int_type(*__ninp_);
+ }
+
+ inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1 streamsize sgetn(char_type* __s, streamsize __n) { return xsgetn(__s, __n); }
+
+ // 27.6.2.2.4 Putback:
+ inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1 int_type sputbackc(char_type __c) {
+ if (__binp_ == __ninp_ || !traits_type::eq(__c, __ninp_[-1]))
+ return pbackfail(traits_type::to_int_type(__c));
+ return traits_type::to_int_type(*--__ninp_);
+ }
+
+ inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1 int_type sungetc() {
+ if (__binp_ == __ninp_)
+ return pbackfail();
+ return traits_type::to_int_type(*--__ninp_);
+ }
+
+ // 27.6.2.2.5 Put area:
+ inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1 int_type sputc(char_type __c) {
+ if (__nout_ == __eout_)
+ return overflow(traits_type::to_int_type(__c));
+ *__nout_++ = __c;
+ return traits_type::to_int_type(__c);
+ }
+
+ inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1 streamsize sputn(const char_type* __s, streamsize __n) {
+ return xsputn(__s, __n);
+ }
protected:
- basic_streambuf();
- basic_streambuf(const basic_streambuf& __rhs);
- basic_streambuf& operator=(const basic_streambuf& __rhs);
- void swap(basic_streambuf& __rhs);
-
- // 27.6.2.3.2 Get area:
- _LIBCPP_HIDE_FROM_ABI char_type* eback() const {return __binp_;}
- _LIBCPP_HIDE_FROM_ABI char_type* gptr() const {return __ninp_;}
- _LIBCPP_HIDE_FROM_ABI char_type* egptr() const {return __einp_;}
-
- inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1
- void gbump(int __n) { __ninp_ += __n; }
-
- inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1
- void setg(char_type* __gbeg, char_type* __gnext, char_type* __gend) {
- __binp_ = __gbeg;
- __ninp_ = __gnext;
- __einp_ = __gend;
- }
-
- // 27.6.2.3.3 Put area:
- _LIBCPP_HIDE_FROM_ABI char_type* pbase() const {return __bout_;}
- _LIBCPP_HIDE_FROM_ABI char_type* pptr() const {return __nout_;}
- _LIBCPP_HIDE_FROM_ABI char_type* epptr() const {return __eout_;}
-
- inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1
- void pbump(int __n) { __nout_ += __n; }
-
- _LIBCPP_HIDE_FROM_ABI
- void __pbump(streamsize __n) { __nout_ += __n; }
-
- inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1
- void setp(char_type* __pbeg, char_type* __pend) {
- __bout_ = __nout_ = __pbeg;
- __eout_ = __pend;
- }
-
- // 27.6.2.4 virtual functions:
- // 27.6.2.4.1 Locales:
- virtual void imbue(const locale& __loc);
-
- // 27.6.2.4.2 Buffer management and positioning:
- virtual basic_streambuf* setbuf(char_type* __s, streamsize __n);
- virtual pos_type seekoff(off_type __off, ios_base::seekdir __way,
- ios_base::openmode __which = ios_base::in | ios_base::out);
- virtual pos_type seekpos(pos_type __sp,
- ios_base::openmode __which = ios_base::in | ios_base::out);
- virtual int sync();
-
- // 27.6.2.4.3 Get area:
- virtual streamsize showmanyc();
- virtual streamsize xsgetn(char_type* __s, streamsize __n);
- virtual int_type underflow();
- virtual int_type uflow();
-
- // 27.6.2.4.4 Putback:
- virtual int_type pbackfail(int_type __c = traits_type::eof());
-
- // 27.6.2.4.5 Put area:
- virtual streamsize xsputn(const char_type* __s, streamsize __n);
- virtual int_type overflow(int_type __c = traits_type::eof());
+ basic_streambuf();
+ basic_streambuf(const basic_streambuf& __rhs);
+ basic_streambuf& operator=(const basic_streambuf& __rhs);
+ void swap(basic_streambuf& __rhs);
+
+ // 27.6.2.3.2 Get area:
+ _LIBCPP_HIDE_FROM_ABI char_type* eback() const { return __binp_; }
+ _LIBCPP_HIDE_FROM_ABI char_type* gptr() const { return __ninp_; }
+ _LIBCPP_HIDE_FROM_ABI char_type* egptr() const { return __einp_; }
+
+ inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1 void gbump(int __n) { __ninp_ += __n; }
+
+ inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1 void setg(char_type* __gbeg, char_type* __gnext, char_type* __gend) {
+ __binp_ = __gbeg;
+ __ninp_ = __gnext;
+ __einp_ = __gend;
+ }
+
+ // 27.6.2.3.3 Put area:
+ _LIBCPP_HIDE_FROM_ABI char_type* pbase() const { return __bout_; }
+ _LIBCPP_HIDE_FROM_ABI char_type* pptr() const { return __nout_; }
+ _LIBCPP_HIDE_FROM_ABI char_type* epptr() const { return __eout_; }
+
+ inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1 void pbump(int __n) { __nout_ += __n; }
+
+ _LIBCPP_HIDE_FROM_ABI void __pbump(streamsize __n) { __nout_ += __n; }
+
+ inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1 void setp(char_type* __pbeg, char_type* __pend) {
+ __bout_ = __nout_ = __pbeg;
+ __eout_ = __pend;
+ }
+
+ // 27.6.2.4 virtual functions:
+ // 27.6.2.4.1 Locales:
+ virtual void imbue(const locale& __loc);
+
+ // 27.6.2.4.2 Buffer management and positioning:
+ virtual basic_streambuf* setbuf(char_type* __s, streamsize __n);
+ virtual pos_type
+ seekoff(off_type __off, ios_base::seekdir __way, ios_base::openmode __which = ios_base::in | ios_base::out);
+ virtual pos_type seekpos(pos_type __sp, ios_base::openmode __which = ios_base::in | ios_base::out);
+ virtual int sync();
+
+ // 27.6.2.4.3 Get area:
+ virtual streamsize showmanyc();
+ virtual streamsize xsgetn(char_type* __s, streamsize __n);
+ virtual int_type underflow();
+ virtual int_type uflow();
+
+ // 27.6.2.4.4 Putback:
+ virtual int_type pbackfail(int_type __c = traits_type::eof());
+
+ // 27.6.2.4.5 Put area:
+ virtual streamsize xsputn(const char_type* __s, streamsize __n);
+ virtual int_type overflow(int_type __c = traits_type::eof());
private:
- locale __loc_;
- char_type* __binp_;
- char_type* __ninp_;
- char_type* __einp_;
- char_type* __bout_;
- char_type* __nout_;
- char_type* __eout_;
+ locale __loc_;
+ char_type* __binp_;
+ char_type* __ninp_;
+ char_type* __einp_;
+ char_type* __bout_;
+ char_type* __nout_;
+ char_type* __eout_;
};
template <class _CharT, class _Traits>
-basic_streambuf<_CharT, _Traits>::~basic_streambuf()
-{
-}
+basic_streambuf<_CharT, _Traits>::~basic_streambuf() {}
template <class _CharT, class _Traits>
basic_streambuf<_CharT, _Traits>::basic_streambuf()
- : __binp_(nullptr),
- __ninp_(nullptr),
- __einp_(nullptr),
- __bout_(nullptr),
- __nout_(nullptr),
- __eout_(nullptr)
-{
-}
+ : __binp_(nullptr), __ninp_(nullptr), __einp_(nullptr), __bout_(nullptr), __nout_(nullptr), __eout_(nullptr) {}
template <class _CharT, class _Traits>
basic_streambuf<_CharT, _Traits>::basic_streambuf(const basic_streambuf& __sb)
@@ -329,164 +301,124 @@ basic_streambuf<_CharT, _Traits>::basic_streambuf(const basic_streambuf& __sb)
__einp_(__sb.__einp_),
__bout_(__sb.__bout_),
__nout_(__sb.__nout_),
- __eout_(__sb.__eout_)
-{
-}
+ __eout_(__sb.__eout_) {}
template <class _CharT, class _Traits>
-basic_streambuf<_CharT, _Traits>&
-basic_streambuf<_CharT, _Traits>::operator=(const basic_streambuf& __sb)
-{
- __loc_ = __sb.__loc_;
- __binp_ = __sb.__binp_;
- __ninp_ = __sb.__ninp_;
- __einp_ = __sb.__einp_;
- __bout_ = __sb.__bout_;
- __nout_ = __sb.__nout_;
- __eout_ = __sb.__eout_;
- return *this;
+basic_streambuf<_CharT, _Traits>& basic_streambuf<_CharT, _Traits>::operator=(const basic_streambuf& __sb) {
+ __loc_ = __sb.__loc_;
+ __binp_ = __sb.__binp_;
+ __ninp_ = __sb.__ninp_;
+ __einp_ = __sb.__einp_;
+ __bout_ = __sb.__bout_;
+ __nout_ = __sb.__nout_;
+ __eout_ = __sb.__eout_;
+ return *this;
}
template <class _CharT, class _Traits>
-void
-basic_streambuf<_CharT, _Traits>::swap(basic_streambuf& __sb)
-{
- std::swap(__loc_, __sb.__loc_);
- std::swap(__binp_, __sb.__binp_);
- std::swap(__ninp_, __sb.__ninp_);
- std::swap(__einp_, __sb.__einp_);
- std::swap(__bout_, __sb.__bout_);
- std::swap(__nout_, __sb.__nout_);
- std::swap(__eout_, __sb.__eout_);
+void basic_streambuf<_CharT, _Traits>::swap(basic_streambuf& __sb) {
+ std::swap(__loc_, __sb.__loc_);
+ std::swap(__binp_, __sb.__binp_);
+ std::swap(__ninp_, __sb.__ninp_);
+ std::swap(__einp_, __sb.__einp_);
+ std::swap(__bout_, __sb.__bout_);
+ std::swap(__nout_, __sb.__nout_);
+ std::swap(__eout_, __sb.__eout_);
}
template <class _CharT, class _Traits>
-void
-basic_streambuf<_CharT, _Traits>::imbue(const locale&)
-{
-}
+void basic_streambuf<_CharT, _Traits>::imbue(const locale&) {}
template <class _CharT, class _Traits>
-basic_streambuf<_CharT, _Traits>*
-basic_streambuf<_CharT, _Traits>::setbuf(char_type*, streamsize)
-{
- return this;
+basic_streambuf<_CharT, _Traits>* basic_streambuf<_CharT, _Traits>::setbuf(char_type*, streamsize) {
+ return this;
}
template <class _CharT, class _Traits>
typename basic_streambuf<_CharT, _Traits>::pos_type
-basic_streambuf<_CharT, _Traits>::seekoff(off_type, ios_base::seekdir,
- ios_base::openmode)
-{
- return pos_type(off_type(-1));
+basic_streambuf<_CharT, _Traits>::seekoff(off_type, ios_base::seekdir, ios_base::openmode) {
+ return pos_type(off_type(-1));
}
template <class _CharT, class _Traits>
typename basic_streambuf<_CharT, _Traits>::pos_type
-basic_streambuf<_CharT, _Traits>::seekpos(pos_type, ios_base::openmode)
-{
- return pos_type(off_type(-1));
+basic_streambuf<_CharT, _Traits>::seekpos(pos_type, ios_base::openmode) {
+ return pos_type(off_type(-1));
}
template <class _CharT, class _Traits>
-int
-basic_streambuf<_CharT, _Traits>::sync()
-{
- return 0;
+int basic_streambuf<_CharT, _Traits>::sync() {
+ return 0;
}
template <class _CharT, class _Traits>
-streamsize
-basic_streambuf<_CharT, _Traits>::showmanyc()
-{
- return 0;
+streamsize basic_streambuf<_CharT, _Traits>::showmanyc() {
+ return 0;
}
template <class _CharT, class _Traits>
-streamsize
-basic_streambuf<_CharT, _Traits>::xsgetn(char_type* __s, streamsize __n)
-{
- const int_type __eof = traits_type::eof();
- int_type __c;
- streamsize __i = 0;
- while(__i < __n)
- {
- if (__ninp_ < __einp_)
- {
- const streamsize __len = std::min(static_cast<streamsize>(INT_MAX),
- std::min(__einp_ - __ninp_, __n - __i));
- traits_type::copy(__s, __ninp_, __len);
- __s += __len;
- __i += __len;
- this->gbump(__len);
- }
- else if ((__c = uflow()) != __eof)
- {
- *__s = traits_type::to_char_type(__c);
- ++__s;
- ++__i;
- }
- else
- break;
- }
- return __i;
+streamsize basic_streambuf<_CharT, _Traits>::xsgetn(char_type* __s, streamsize __n) {
+ const int_type __eof = traits_type::eof();
+ int_type __c;
+ streamsize __i = 0;
+ while (__i < __n) {
+ if (__ninp_ < __einp_) {
+ const streamsize __len = std::min(static_cast<streamsize>(INT_MAX), std::min(__einp_ - __ninp_, __n - __i));
+ traits_type::copy(__s, __ninp_, __len);
+ __s += __len;
+ __i += __len;
+ this->gbump(__len);
+ } else if ((__c = uflow()) != __eof) {
+ *__s = traits_type::to_char_type(__c);
+ ++__s;
+ ++__i;
+ } else
+ break;
+ }
+ return __i;
}
template <class _CharT, class _Traits>
-typename basic_streambuf<_CharT, _Traits>::int_type
-basic_streambuf<_CharT, _Traits>::underflow()
-{
- return traits_type::eof();
+typename basic_streambuf<_CharT, _Traits>::int_type basic_streambuf<_CharT, _Traits>::underflow() {
+ return traits_type::eof();
}
template <class _CharT, class _Traits>
-typename basic_streambuf<_CharT, _Traits>::int_type
-basic_streambuf<_CharT, _Traits>::uflow()
-{
- if (underflow() == traits_type::eof())
- return traits_type::eof();
- return traits_type::to_int_type(*__ninp_++);
+typename basic_streambuf<_CharT, _Traits>::int_type basic_streambuf<_CharT, _Traits>::uflow() {
+ if (underflow() == traits_type::eof())
+ return traits_type::eof();
+ return traits_type::to_int_type(*__ninp_++);
}
template <class _CharT, class _Traits>
-typename basic_streambuf<_CharT, _Traits>::int_type
-basic_streambuf<_CharT, _Traits>::pbackfail(int_type)
-{
- return traits_type::eof();
+typename basic_streambuf<_CharT, _Traits>::int_type basic_streambuf<_CharT, _Traits>::pbackfail(int_type) {
+ return traits_type::eof();
}
template <class _CharT, class _Traits>
-streamsize
-basic_streambuf<_CharT, _Traits>::xsputn(const char_type* __s, streamsize __n)
-{
- streamsize __i = 0;
- int_type __eof = traits_type::eof();
- while( __i < __n)
- {
- if (__nout_ >= __eout_)
- {
- if (overflow(traits_type::to_int_type(*__s)) == __eof)
- break;
- ++__s;
- ++__i;
- }
- else
- {
- streamsize __chunk_size = std::min(__eout_ - __nout_, __n - __i);
- traits_type::copy(__nout_, __s, __chunk_size);
- __nout_ += __chunk_size;
- __s += __chunk_size;
- __i += __chunk_size;
- }
+streamsize basic_streambuf<_CharT, _Traits>::xsputn(const char_type* __s, streamsize __n) {
+ streamsize __i = 0;
+ int_type __eof = traits_type::eof();
+ while (__i < __n) {
+ if (__nout_ >= __eout_) {
+ if (overflow(traits_type::to_int_type(*__s)) == __eof)
+ break;
+ ++__s;
+ ++__i;
+ } else {
+ streamsize __chunk_size = std::min(__eout_ - __nout_, __n - __i);
+ traits_type::copy(__nout_, __s, __chunk_size);
+ __nout_ += __chunk_size;
+ __s += __chunk_size;
+ __i += __chunk_size;
}
- return __i;
+ }
+ return __i;
}
template <class _CharT, class _Traits>
-typename basic_streambuf<_CharT, _Traits>::int_type
-basic_streambuf<_CharT, _Traits>::overflow(int_type)
-{
- return traits_type::eof();
+typename basic_streambuf<_CharT, _Traits>::int_type basic_streambuf<_CharT, _Traits>::overflow(int_type) {
+ return traits_type::eof();
}
extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_streambuf<char>;
diff --git a/contrib/llvm-project/libcxx/include/string b/contrib/llvm-project/libcxx/include/string
index 5bb4e941af36..c676182fba8b 100644
--- a/contrib/llvm-project/libcxx/include/string
+++ b/contrib/llvm-project/libcxx/include/string
@@ -618,7 +618,7 @@ basic_string<char32_t> operator""s( const char32_t *str, size_t len );
#include <__utility/swap.h>
#include <__utility/unreachable.h>
#include <climits>
-#include <cstdio> // EOF
+#include <cstdio> // EOF
#include <cstring>
#include <limits>
#include <stdexcept>
@@ -665,30 +665,24 @@ _LIBCPP_BEGIN_NAMESPACE_STD
// basic_string
-template<class _CharT, class _Traits, class _Allocator>
-basic_string<_CharT, _Traits, _Allocator>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-operator+(const basic_string<_CharT, _Traits, _Allocator>& __x,
- const basic_string<_CharT, _Traits, _Allocator>& __y);
-
-template<class _CharT, class _Traits, class _Allocator>
-_LIBCPP_HIDDEN _LIBCPP_CONSTEXPR_SINCE_CXX20
-basic_string<_CharT, _Traits, _Allocator>
-operator+(const _CharT* __x, const basic_string<_CharT,_Traits,_Allocator>& __y);
-
-template<class _CharT, class _Traits, class _Allocator>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-basic_string<_CharT, _Traits, _Allocator>
-operator+(_CharT __x, const basic_string<_CharT,_Traits,_Allocator>& __y);
-
-template<class _CharT, class _Traits, class _Allocator>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-basic_string<_CharT, _Traits, _Allocator>
+template <class _CharT, class _Traits, class _Allocator>
+basic_string<_CharT, _Traits, _Allocator> _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
+operator+(const basic_string<_CharT, _Traits, _Allocator>& __x, const basic_string<_CharT, _Traits, _Allocator>& __y);
+
+template <class _CharT, class _Traits, class _Allocator>
+_LIBCPP_HIDDEN _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string<_CharT, _Traits, _Allocator>
+operator+(const _CharT* __x, const basic_string<_CharT, _Traits, _Allocator>& __y);
+
+template <class _CharT, class _Traits, class _Allocator>
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string<_CharT, _Traits, _Allocator>
+operator+(_CharT __x, const basic_string<_CharT, _Traits, _Allocator>& __y);
+
+template <class _CharT, class _Traits, class _Allocator>
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string<_CharT, _Traits, _Allocator>
operator+(const basic_string<_CharT, _Traits, _Allocator>& __x, const _CharT* __y);
-template<class _CharT, class _Traits, class _Allocator>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-basic_string<_CharT, _Traits, _Allocator>
+template <class _CharT, class _Traits, class _Allocator>
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string<_CharT, _Traits, _Allocator>
operator+(const basic_string<_CharT, _Traits, _Allocator>& __x, _CharT __y);
extern template _LIBCPP_EXPORTED_FROM_ABI string operator+
@@ -698,199 +692,187 @@ template <class _Iter>
struct __string_is_trivial_iterator : public false_type {};
template <class _Tp>
-struct __string_is_trivial_iterator<_Tp*>
- : public is_arithmetic<_Tp> {};
+struct __string_is_trivial_iterator<_Tp*> : public is_arithmetic<_Tp> {};
template <class _Iter>
-struct __string_is_trivial_iterator<__wrap_iter<_Iter> >
- : public __string_is_trivial_iterator<_Iter> {};
+struct __string_is_trivial_iterator<__wrap_iter<_Iter> > : public __string_is_trivial_iterator<_Iter> {};
template <class _CharT, class _Traits, class _Tp>
-struct __can_be_converted_to_string_view : public _BoolConstant<
- is_convertible<const _Tp&, basic_string_view<_CharT, _Traits> >::value &&
- !is_convertible<const _Tp&, const _CharT*>::value
- > {};
+struct __can_be_converted_to_string_view
+ : public _BoolConstant< is_convertible<const _Tp&, basic_string_view<_CharT, _Traits> >::value &&
+ !is_convertible<const _Tp&, const _CharT*>::value > {};
struct __uninitialized_size_tag {};
struct __init_with_sentinel_tag {};
-template<class _CharT, class _Traits, class _Allocator>
-class basic_string
-{
+template <class _CharT, class _Traits, class _Allocator>
+class basic_string {
private:
using __default_allocator_type = allocator<_CharT>;
public:
- typedef basic_string __self;
- typedef basic_string_view<_CharT, _Traits> __self_view;
- typedef _Traits traits_type;
- typedef _CharT value_type;
- typedef _Allocator allocator_type;
- typedef allocator_traits<allocator_type> __alloc_traits;
- typedef typename __alloc_traits::size_type size_type;
- typedef typename __alloc_traits::difference_type difference_type;
- typedef value_type& reference;
- typedef const value_type& const_reference;
- typedef typename __alloc_traits::pointer pointer;
- typedef typename __alloc_traits::const_pointer const_pointer;
-
- static_assert((!is_array<value_type>::value), "Character type of basic_string must not be an array");
- static_assert(( is_standard_layout<value_type>::value), "Character type of basic_string must be standard-layout");
- static_assert(( is_trivial<value_type>::value), "Character type of basic_string must be trivial");
- static_assert(( is_same<_CharT, typename traits_type::char_type>::value),
- "traits_type::char_type must be the same type as CharT");
- static_assert(( is_same<typename allocator_type::value_type, value_type>::value),
- "Allocator::value_type must be same type as value_type");
-
- static_assert(is_same<allocator_type, __rebind_alloc<__alloc_traits, value_type> >::value,
- "[allocator.requirements] states that rebinding an allocator to the same type should result in the "
- "original allocator");
-
- // TODO: Implement iterator bounds checking without requiring the global database.
- typedef __wrap_iter<pointer> iterator;
- typedef __wrap_iter<const_pointer> const_iterator;
- typedef std::reverse_iterator<iterator> reverse_iterator;
- typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
+ typedef basic_string __self;
+ typedef basic_string_view<_CharT, _Traits> __self_view;
+ typedef _Traits traits_type;
+ typedef _CharT value_type;
+ typedef _Allocator allocator_type;
+ typedef allocator_traits<allocator_type> __alloc_traits;
+ typedef typename __alloc_traits::size_type size_type;
+ typedef typename __alloc_traits::difference_type difference_type;
+ typedef value_type& reference;
+ typedef const value_type& const_reference;
+ typedef typename __alloc_traits::pointer pointer;
+ typedef typename __alloc_traits::const_pointer const_pointer;
+
+ static_assert((!is_array<value_type>::value), "Character type of basic_string must not be an array");
+ static_assert((is_standard_layout<value_type>::value), "Character type of basic_string must be standard-layout");
+ static_assert((is_trivial<value_type>::value), "Character type of basic_string must be trivial");
+ static_assert((is_same<_CharT, typename traits_type::char_type>::value),
+ "traits_type::char_type must be the same type as CharT");
+ static_assert((is_same<typename allocator_type::value_type, value_type>::value),
+ "Allocator::value_type must be same type as value_type");
+
+ static_assert(is_same<allocator_type, __rebind_alloc<__alloc_traits, value_type> >::value,
+ "[allocator.requirements] states that rebinding an allocator to the same type should result in the "
+ "original allocator");
+
+ // TODO: Implement iterator bounds checking without requiring the global database.
+ typedef __wrap_iter<pointer> iterator;
+ typedef __wrap_iter<const_pointer> const_iterator;
+ typedef std::reverse_iterator<iterator> reverse_iterator;
+ typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
private:
- static_assert(CHAR_BIT == 8, "This implementation assumes that one byte contains 8 bits");
+ static_assert(CHAR_BIT == 8, "This implementation assumes that one byte contains 8 bits");
#ifdef _LIBCPP_ABI_ALTERNATE_STRING_LAYOUT
- struct __long
- {
- pointer __data_;
- size_type __size_;
- size_type __cap_ : sizeof(size_type) * CHAR_BIT - 1;
- size_type __is_long_ : 1;
- };
-
- enum {__min_cap = (sizeof(__long) - 1)/sizeof(value_type) > 2 ?
- (sizeof(__long) - 1)/sizeof(value_type) : 2};
-
- struct __short
- {
- value_type __data_[__min_cap];
- unsigned char __padding_[sizeof(value_type) - 1];
- unsigned char __size_ : 7;
- unsigned char __is_long_ : 1;
- };
-
-// The __endian_factor is required because the field we use to store the size
-// has one fewer bit than it would if it were not a bitfield.
-//
-// If the LSB is used to store the short-flag in the short string representation,
-// we have to multiply the size by two when it is stored and divide it by two when
-// it is loaded to make sure that we always store an even number. In the long string
-// representation, we can ignore this because we can assume that we always allocate
-// an even amount of value_types.
-//
-// If the MSB is used for the short-flag, the max_size() is numeric_limits<size_type>::max() / 2.
-// This does not impact the short string representation, since we never need the MSB
-// for representing the size of a short string anyway.
-
-#ifdef _LIBCPP_BIG_ENDIAN
- static const size_type __endian_factor = 2;
-#else
- static const size_type __endian_factor = 1;
-#endif
+ struct __long {
+ pointer __data_;
+ size_type __size_;
+ size_type __cap_ : sizeof(size_type) * CHAR_BIT - 1;
+ size_type __is_long_ : 1;
+ };
+
+ enum { __min_cap = (sizeof(__long) - 1) / sizeof(value_type) > 2 ? (sizeof(__long) - 1) / sizeof(value_type) : 2 };
+
+ struct __short {
+ value_type __data_[__min_cap];
+ unsigned char __padding_[sizeof(value_type) - 1];
+ unsigned char __size_ : 7;
+ unsigned char __is_long_ : 1;
+ };
+
+ // The __endian_factor is required because the field we use to store the size
+ // has one fewer bit than it would if it were not a bitfield.
+ //
+ // If the LSB is used to store the short-flag in the short string representation,
+ // we have to multiply the size by two when it is stored and divide it by two when
+ // it is loaded to make sure that we always store an even number. In the long string
+ // representation, we can ignore this because we can assume that we always allocate
+ // an even amount of value_types.
+ //
+ // If the MSB is used for the short-flag, the max_size() is numeric_limits<size_type>::max() / 2.
+ // This does not impact the short string representation, since we never need the MSB
+ // for representing the size of a short string anyway.
+
+# ifdef _LIBCPP_BIG_ENDIAN
+ static const size_type __endian_factor = 2;
+# else
+ static const size_type __endian_factor = 1;
+# endif
#else // _LIBCPP_ABI_ALTERNATE_STRING_LAYOUT
-#ifdef _LIBCPP_BIG_ENDIAN
- static const size_type __endian_factor = 1;
-#else
- static const size_type __endian_factor = 2;
-#endif
+# ifdef _LIBCPP_BIG_ENDIAN
+ static const size_type __endian_factor = 1;
+# else
+ static const size_type __endian_factor = 2;
+# endif
- // Attribute 'packed' is used to keep the layout compatible with the
- // previous definition that did not use bit fields. This is because on
- // some platforms bit fields have a default size rather than the actual
- // size used, e.g., it is 4 bytes on AIX. See D128285 for details.
- struct __long
- {
- struct _LIBCPP_PACKED {
- size_type __is_long_ : 1;
- size_type __cap_ : sizeof(size_type) * CHAR_BIT - 1;
- };
- size_type __size_;
- pointer __data_;
+ // Attribute 'packed' is used to keep the layout compatible with the
+ // previous definition that did not use bit fields. This is because on
+ // some platforms bit fields have a default size rather than the actual
+ // size used, e.g., it is 4 bytes on AIX. See D128285 for details.
+ struct __long {
+ struct _LIBCPP_PACKED {
+ size_type __is_long_ : 1;
+ size_type __cap_ : sizeof(size_type) * CHAR_BIT - 1;
};
+ size_type __size_;
+ pointer __data_;
+ };
- enum {__min_cap = (sizeof(__long) - 1)/sizeof(value_type) > 2 ?
- (sizeof(__long) - 1)/sizeof(value_type) : 2};
-
- struct __short
- {
- struct _LIBCPP_PACKED {
- unsigned char __is_long_ : 1;
- unsigned char __size_ : 7;
- };
- char __padding_[sizeof(value_type) - 1];
- value_type __data_[__min_cap];
+ enum { __min_cap = (sizeof(__long) - 1) / sizeof(value_type) > 2 ? (sizeof(__long) - 1) / sizeof(value_type) : 2 };
+
+ struct __short {
+ struct _LIBCPP_PACKED {
+ unsigned char __is_long_ : 1;
+ unsigned char __size_ : 7;
};
+ char __padding_[sizeof(value_type) - 1];
+ value_type __data_[__min_cap];
+ };
#endif // _LIBCPP_ABI_ALTERNATE_STRING_LAYOUT
- static_assert(sizeof(__short) == (sizeof(value_type) * (__min_cap + 1)), "__short has an unexpected size.");
+ static_assert(sizeof(__short) == (sizeof(value_type) * (__min_cap + 1)), "__short has an unexpected size.");
- union __ulx{__long __lx; __short __lxx;};
+ union __ulx {
+ __long __lx;
+ __short __lxx;
+ };
- enum {__n_words = sizeof(__ulx) / sizeof(size_type)};
+ enum { __n_words = sizeof(__ulx) / sizeof(size_type) };
- struct __raw
- {
- size_type __words[__n_words];
- };
+ struct __raw {
+ size_type __words[__n_words];
+ };
- struct __rep
- {
- union
- {
- __short __s;
- __long __l;
- __raw __r;
- };
+ struct __rep {
+ union {
+ __short __s;
+ __long __l;
+ __raw __r;
};
+ };
- __compressed_pair<__rep, allocator_type> __r_;
-
- // Construct a string with the given allocator and enough storage to hold `__size` characters, but
- // don't initialize the characters. The contents of the string, including the null terminator, must be
- // initialized separately.
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- explicit basic_string(__uninitialized_size_tag, size_type __size, const allocator_type& __a)
- : __r_(__default_init_tag(), __a) {
- if (__size > max_size())
- __throw_length_error();
- if (__fits_in_sso(__size)) {
- __r_.first() = __rep();
- __set_short_size(__size);
- } else {
- auto __capacity = __recommend(__size) + 1;
- auto __allocation = __alloc_traits::allocate(__alloc(), __capacity);
- __begin_lifetime(__allocation, __capacity);
- __set_long_cap(__capacity);
- __set_long_pointer(__allocation);
- __set_long_size(__size);
- }
- __annotate_new(__size);
- }
+ __compressed_pair<__rep, allocator_type> __r_;
- template <class _Iter, class _Sent>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- basic_string(__init_with_sentinel_tag, _Iter __first, _Sent __last, const allocator_type& __a)
- : __r_(__default_init_tag(), __a) {
- __init_with_sentinel(std::move(__first), std::move(__last));
+ // Construct a string with the given allocator and enough storage to hold `__size` characters, but
+ // don't initialize the characters. The contents of the string, including the null terminator, must be
+ // initialized separately.
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 explicit basic_string(
+ __uninitialized_size_tag, size_type __size, const allocator_type& __a)
+ : __r_(__default_init_tag(), __a) {
+ if (__size > max_size())
+ __throw_length_error();
+ if (__fits_in_sso(__size)) {
+ __r_.first() = __rep();
+ __set_short_size(__size);
+ } else {
+ auto __capacity = __recommend(__size) + 1;
+ auto __allocation = __alloc_traits::allocate(__alloc(), __capacity);
+ __begin_lifetime(__allocation, __capacity);
+ __set_long_cap(__capacity);
+ __set_long_pointer(__allocation);
+ __set_long_size(__size);
}
+ __annotate_new(__size);
+ }
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 iterator __make_iterator(pointer __p) {
- return iterator(__p);
- }
+ template <class _Iter, class _Sent>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
+ basic_string(__init_with_sentinel_tag, _Iter __first, _Sent __last, const allocator_type& __a)
+ : __r_(__default_init_tag(), __a) {
+ __init_with_sentinel(std::move(__first), std::move(__last));
+ }
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 const_iterator __make_const_iterator(const_pointer __p) const {
- return const_iterator(__p);
- }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 iterator __make_iterator(pointer __p) { return iterator(__p); }
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 const_iterator __make_const_iterator(const_pointer __p) const {
+ return const_iterator(__p);
+ }
public:
_LIBCPP_TEMPLATE_DATA_VIS static const size_type npos = -1;
@@ -898,7 +880,7 @@ public:
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string()
_NOEXCEPT_(is_nothrow_default_constructible<allocator_type>::value)
: __r_(__value_init_tag(), __default_init_tag()) {
- __annotate_new(0);
+ __annotate_new(0);
}
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 explicit basic_string(const allocator_type& __a)
@@ -908,34 +890,30 @@ public:
_NOEXCEPT
#endif
: __r_(__value_init_tag(), __a) {
- __annotate_new(0);
+ __annotate_new(0);
}
_LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_STRING_INTERNAL_MEMORY_ACCESS basic_string(const basic_string& __str)
: __r_(__default_init_tag(), __alloc_traits::select_on_container_copy_construction(__str.__alloc())) {
- if (!__str.__is_long())
- {
+ if (!__str.__is_long()) {
__r_.first() = __str.__r_.first();
__annotate_new(__get_short_size());
- }
- else
+ } else
__init_copy_ctor_external(std::__to_address(__str.__get_long_pointer()), __str.__get_long_size());
}
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_STRING_INTERNAL_MEMORY_ACCESS basic_string(const basic_string& __str, const allocator_type& __a)
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_STRING_INTERNAL_MEMORY_ACCESS
+ basic_string(const basic_string& __str, const allocator_type& __a)
: __r_(__default_init_tag(), __a) {
- if (!__str.__is_long())
- {
+ if (!__str.__is_long()) {
__r_.first() = __str.__r_.first();
__annotate_new(__get_short_size());
- }
- else
+ } else
__init_copy_ctor_external(std::__to_address(__str.__get_long_pointer()), __str.__get_long_size());
}
#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- basic_string(basic_string&& __str)
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string(basic_string&& __str)
# if _LIBCPP_STD_VER <= 14
_NOEXCEPT_(is_nothrow_move_constructible<allocator_type>::value)
# else
@@ -944,15 +922,14 @@ public:
// Turning off ASan instrumentation for variable initialization with _LIBCPP_STRING_INTERNAL_MEMORY_ACCESS
// does not work consistently during initialization of __r_, so we instead unpoison __str's memory manually first.
// __str's memory needs to be unpoisoned only in the case where it's a short string.
- : __r_( ( (__str.__is_long() ? 0 : (__str.__annotate_delete(), 0)), std::move(__str.__r_)) ) {
+ : __r_(((__str.__is_long() ? 0 : (__str.__annotate_delete(), 0)), std::move(__str.__r_))) {
__str.__r_.first() = __rep();
__str.__annotate_new(0);
- if(!__is_long())
+ if (!__is_long())
__annotate_new(size());
}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- basic_string(basic_string&& __str, const allocator_type& __a)
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string(basic_string&& __str, const allocator_type& __a)
: __r_(__default_init_tag(), __a) {
if (__str.__is_long() && __a != __str.__alloc()) // copy, not move
__init(std::__to_address(__str.__get_long_pointer()), __str.__get_long_size());
@@ -961,10 +938,10 @@ public:
__r_.first() = __rep();
if (!__str.__is_long())
__str.__annotate_delete();
- __r_.first() = __str.__r_.first();
+ __r_.first() = __str.__r_.first();
__str.__r_.first() = __rep();
__str.__annotate_new(0);
- if(!__is_long() && this != &__str)
+ if (!__is_long() && this != &__str)
__annotate_new(size());
}
}
@@ -1007,12 +984,12 @@ public:
}
#if _LIBCPP_STD_VER >= 23
- _LIBCPP_HIDE_FROM_ABI constexpr
- basic_string(basic_string&& __str, size_type __pos, const _Allocator& __alloc = _Allocator())
+ _LIBCPP_HIDE_FROM_ABI constexpr basic_string(
+ basic_string&& __str, size_type __pos, const _Allocator& __alloc = _Allocator())
: basic_string(std::move(__str), __pos, npos, __alloc) {}
- _LIBCPP_HIDE_FROM_ABI constexpr
- basic_string(basic_string&& __str, size_type __pos, size_type __n, const _Allocator& __alloc = _Allocator())
+ _LIBCPP_HIDE_FROM_ABI constexpr basic_string(
+ basic_string&& __str, size_type __pos, size_type __n, const _Allocator& __alloc = _Allocator())
: __r_(__default_init_tag(), __alloc) {
if (__pos > __str.size())
__throw_out_of_range();
@@ -1099,8 +1076,8 @@ public:
#if _LIBCPP_STD_VER >= 23
template <_ContainerCompatibleRange<_CharT> _Range>
- _LIBCPP_HIDE_FROM_ABI constexpr
- basic_string(from_range_t, _Range&& __range, const allocator_type& __a = allocator_type())
+ _LIBCPP_HIDE_FROM_ABI constexpr basic_string(
+ from_range_t, _Range&& __range, const allocator_type& __a = allocator_type())
: __r_(__default_init_tag(), __a) {
if constexpr (ranges::forward_range<_Range> || ranges::sized_range<_Range>) {
__init_with_size(ranges::begin(__range), ranges::end(__range), ranges::distance(__range));
@@ -1128,116 +1105,117 @@ public:
__alloc_traits::deallocate(__alloc(), __get_long_pointer(), __get_long_cap());
}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- operator __self_view() const _NOEXCEPT { return __self_view(data(), size()); }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 operator __self_view() const _NOEXCEPT {
+ return __self_view(data(), size());
+ }
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_STRING_INTERNAL_MEMORY_ACCESS basic_string& operator=(const basic_string& __str);
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_STRING_INTERNAL_MEMORY_ACCESS basic_string&
+ operator=(const basic_string& __str);
- template <class _Tp, __enable_if_t<__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value &&
- !__is_same_uncvref<_Tp, basic_string>::value, int> = 0>
- _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& operator=(const _Tp& __t) {
- __self_view __sv = __t;
- return assign(__sv);
- }
+ template <class _Tp,
+ __enable_if_t<__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value &&
+ !__is_same_uncvref<_Tp, basic_string>::value,
+ int> = 0>
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& operator=(const _Tp& __t) {
+ __self_view __sv = __t;
+ return assign(__sv);
+ }
#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string&
- operator=(basic_string&& __str) _NOEXCEPT_((__noexcept_move_assign_container<_Allocator, __alloc_traits>::value)) {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& operator=(basic_string&& __str)
+ _NOEXCEPT_((__noexcept_move_assign_container<_Allocator, __alloc_traits>::value)) {
__move_assign(__str, integral_constant<bool, __alloc_traits::propagate_on_container_move_assignment::value>());
return *this;
}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- basic_string& operator=(initializer_list<value_type> __il) {return assign(__il.begin(), __il.size());}
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& operator=(initializer_list<value_type> __il) {
+ return assign(__il.begin(), __il.size());
+ }
#endif
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- basic_string& operator=(const value_type* __s) {return assign(__s);}
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& operator=(const value_type* __s) {
+ return assign(__s);
+ }
#if _LIBCPP_STD_VER >= 23
- basic_string& operator=(nullptr_t) = delete;
+ basic_string& operator=(nullptr_t) = delete;
#endif
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_STRING_INTERNAL_MEMORY_ACCESS basic_string& operator=(value_type __c);
-
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- iterator begin() _NOEXCEPT
- {return __make_iterator(__get_pointer());}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- const_iterator begin() const _NOEXCEPT
- {return __make_const_iterator(__get_pointer());}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- iterator end() _NOEXCEPT
- {return __make_iterator(__get_pointer() + size());}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- const_iterator end() const _NOEXCEPT
- {return __make_const_iterator(__get_pointer() + size());}
-
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- reverse_iterator rbegin() _NOEXCEPT
- {return reverse_iterator(end());}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- const_reverse_iterator rbegin() const _NOEXCEPT
- {return const_reverse_iterator(end());}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- reverse_iterator rend() _NOEXCEPT
- {return reverse_iterator(begin());}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- const_reverse_iterator rend() const _NOEXCEPT
- {return const_reverse_iterator(begin());}
-
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- const_iterator cbegin() const _NOEXCEPT
- {return begin();}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- const_iterator cend() const _NOEXCEPT
- {return end();}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- const_reverse_iterator crbegin() const _NOEXCEPT
- {return rbegin();}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- const_reverse_iterator crend() const _NOEXCEPT
- {return rend();}
-
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type size() const _NOEXCEPT
- {return __is_long() ? __get_long_size() : __get_short_size();}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type length() const _NOEXCEPT {return size();}
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_STRING_INTERNAL_MEMORY_ACCESS basic_string& operator=(value_type __c);
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 iterator begin() _NOEXCEPT {
+ return __make_iterator(__get_pointer());
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 const_iterator begin() const _NOEXCEPT {
+ return __make_const_iterator(__get_pointer());
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 iterator end() _NOEXCEPT {
+ return __make_iterator(__get_pointer() + size());
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 const_iterator end() const _NOEXCEPT {
+ return __make_const_iterator(__get_pointer() + size());
+ }
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 reverse_iterator rbegin() _NOEXCEPT {
+ return reverse_iterator(end());
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 const_reverse_iterator rbegin() const _NOEXCEPT {
+ return const_reverse_iterator(end());
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 reverse_iterator rend() _NOEXCEPT {
+ return reverse_iterator(begin());
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 const_reverse_iterator rend() const _NOEXCEPT {
+ return const_reverse_iterator(begin());
+ }
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 const_iterator cbegin() const _NOEXCEPT { return begin(); }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 const_iterator cend() const _NOEXCEPT { return end(); }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 const_reverse_iterator crbegin() const _NOEXCEPT {
+ return rbegin();
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 const_reverse_iterator crend() const _NOEXCEPT { return rend(); }
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type size() const _NOEXCEPT {
+ return __is_long() ? __get_long_size() : __get_short_size();
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type length() const _NOEXCEPT { return size(); }
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type max_size() const _NOEXCEPT {
size_type __m = __alloc_traits::max_size(__alloc());
if (__m <= std::numeric_limits<size_type>::max() / 2) {
return __m - __alignment;
} else {
- bool __uses_lsb = __endian_factor == 2;
+ bool __uses_lsb = __endian_factor == 2;
return __uses_lsb ? __m - __alignment : (__m / 2) - __alignment;
}
}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type capacity() const _NOEXCEPT {
- return (__is_long() ? __get_long_cap() : static_cast<size_type>(__min_cap)) - 1;
- }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type capacity() const _NOEXCEPT {
+ return (__is_long() ? __get_long_cap() : static_cast<size_type>(__min_cap)) - 1;
+ }
- _LIBCPP_CONSTEXPR_SINCE_CXX20 void resize(size_type __n, value_type __c);
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void resize(size_type __n) { resize(__n, value_type()); }
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 void resize(size_type __n, value_type __c);
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void resize(size_type __n) { resize(__n, value_type()); }
- _LIBCPP_CONSTEXPR_SINCE_CXX20 void reserve(size_type __requested_capacity);
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 void reserve(size_type __requested_capacity);
#if _LIBCPP_STD_VER >= 23
- template <class _Op>
- _LIBCPP_HIDE_FROM_ABI constexpr
- void resize_and_overwrite(size_type __n, _Op __op) {
- __resize_default_init(__n);
- __erase_to_end(std::move(__op)(data(), _LIBCPP_AUTO_CAST(__n)));
- }
+ template <class _Op>
+ _LIBCPP_HIDE_FROM_ABI constexpr void resize_and_overwrite(size_type __n, _Op __op) {
+ __resize_default_init(__n);
+ __erase_to_end(std::move(__op)(data(), _LIBCPP_AUTO_CAST(__n)));
+ }
#endif
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __resize_default_init(size_type __n);
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __resize_default_init(size_type __n);
#if _LIBCPP_STD_VER < 26 || defined(_LIBCPP_ENABLE_CXX26_REMOVED_STRING_RESERVE)
- _LIBCPP_DEPRECATED_IN_CXX20 _LIBCPP_HIDE_FROM_ABI void reserve() _NOEXCEPT { shrink_to_fit(); }
+ _LIBCPP_DEPRECATED_IN_CXX20 _LIBCPP_HIDE_FROM_ABI void reserve() _NOEXCEPT { shrink_to_fit(); }
#endif
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void shrink_to_fit() _NOEXCEPT;
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void clear() _NOEXCEPT;
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void shrink_to_fit() _NOEXCEPT;
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void clear() _NOEXCEPT;
- _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- bool empty() const _NOEXCEPT {return size() == 0;}
+ _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool empty() const _NOEXCEPT {
+ return size() == 0;
+ }
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 const_reference operator[](size_type __pos) const _NOEXCEPT {
_LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__pos <= size(), "string index out of bounds");
@@ -1255,38 +1233,40 @@ public:
return *(__get_pointer() + __pos);
}
- _LIBCPP_CONSTEXPR_SINCE_CXX20 const_reference at(size_type __n) const;
- _LIBCPP_CONSTEXPR_SINCE_CXX20 reference at(size_type __n);
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 const_reference at(size_type __n) const;
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 reference at(size_type __n);
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& operator+=(const basic_string& __str) {
- return append(__str);
- }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& operator+=(const basic_string& __str) {
+ return append(__str);
+ }
- template <class _Tp,
- __enable_if_t<__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value &&
- !__is_same_uncvref<_Tp, basic_string >::value,
- int> = 0>
- _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string&
- operator+=(const _Tp& __t) {
- __self_view __sv = __t; return append(__sv);
- }
+ template <class _Tp,
+ __enable_if_t<__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value &&
+ !__is_same_uncvref<_Tp, basic_string >::value,
+ int> = 0>
+ _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string&
+ operator+=(const _Tp& __t) {
+ __self_view __sv = __t;
+ return append(__sv);
+ }
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& operator+=(const value_type* __s) {
- return append(__s);
- }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& operator+=(const value_type* __s) {
+ return append(__s);
+ }
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& operator+=(value_type __c) {
- push_back(__c);
- return *this;
- }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& operator+=(value_type __c) {
+ push_back(__c);
+ return *this;
+ }
#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- basic_string& operator+=(initializer_list<value_type> __il) { return append(__il); }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& operator+=(initializer_list<value_type> __il) {
+ return append(__il);
+ }
#endif // _LIBCPP_CXX03_LANG
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& append(const basic_string& __str) {
- return append(__str.data(), __str.size());
+ return append(__str.data(), __str.size());
}
template <class _Tp,
@@ -1295,56 +1275,55 @@ public:
int> = 0>
_LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string&
append(const _Tp& __t) {
- __self_view __sv = __t;
- return append(__sv.data(), __sv.size());
+ __self_view __sv = __t;
+ return append(__sv.data(), __sv.size());
}
- _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& append(const basic_string& __str, size_type __pos, size_type __n=npos);
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& append(const basic_string& __str, size_type __pos, size_type __n = npos);
- template <class _Tp,
- __enable_if_t<__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value &&
- !__is_same_uncvref<_Tp, basic_string>::value,
- int> = 0>
- _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_SINCE_CXX20
+ template <class _Tp,
+ __enable_if_t<__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value &&
+ !__is_same_uncvref<_Tp, basic_string>::value,
+ int> = 0>
+ _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_SINCE_CXX20
- basic_string&
- append(const _Tp& __t, size_type __pos, size_type __n = npos);
+ basic_string&
+ append(const _Tp& __t, size_type __pos, size_type __n = npos);
- _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& append(const value_type* __s, size_type __n);
- _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& append(const value_type* __s);
- _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& append(size_type __n, value_type __c);
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& append(const value_type* __s, size_type __n);
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& append(const value_type* __s);
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& append(size_type __n, value_type __c);
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- void __append_default_init(size_type __n);
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __append_default_init(size_type __n);
- template <class _InputIterator, __enable_if_t<__has_exactly_input_iterator_category<_InputIterator>::value, int> = 0>
- _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string&
- append(_InputIterator __first, _InputIterator __last) {
- const basic_string __temp(__first, __last, __alloc());
- append(__temp.data(), __temp.size());
- return *this;
- }
+ template <class _InputIterator, __enable_if_t<__has_exactly_input_iterator_category<_InputIterator>::value, int> = 0>
+ _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string&
+ append(_InputIterator __first, _InputIterator __last) {
+ const basic_string __temp(__first, __last, __alloc());
+ append(__temp.data(), __temp.size());
+ return *this;
+ }
- template <class _ForwardIterator, __enable_if_t<__has_forward_iterator_category<_ForwardIterator>::value, int> = 0>
- _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string&
- append(_ForwardIterator __first, _ForwardIterator __last);
+ template <class _ForwardIterator, __enable_if_t<__has_forward_iterator_category<_ForwardIterator>::value, int> = 0>
+ _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string&
+ append(_ForwardIterator __first, _ForwardIterator __last);
#if _LIBCPP_STD_VER >= 23
- template <_ContainerCompatibleRange<_CharT> _Range>
- _LIBCPP_HIDE_FROM_ABI
- constexpr basic_string& append_range(_Range&& __range) {
- insert_range(end(), std::forward<_Range>(__range));
- return *this;
- }
+ template <_ContainerCompatibleRange<_CharT> _Range>
+ _LIBCPP_HIDE_FROM_ABI constexpr basic_string& append_range(_Range&& __range) {
+ insert_range(end(), std::forward<_Range>(__range));
+ return *this;
+ }
#endif
#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- basic_string& append(initializer_list<value_type> __il) {return append(__il.begin(), __il.size());}
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& append(initializer_list<value_type> __il) {
+ return append(__il.begin(), __il.size());
+ }
#endif // _LIBCPP_CXX03_LANG
- _LIBCPP_CONSTEXPR_SINCE_CXX20 void push_back(value_type __c);
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void pop_back();
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 void push_back(value_type __c);
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void pop_back();
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 reference front() _NOEXCEPT {
_LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(!empty(), "string::front(): string is empty");
@@ -1374,14 +1353,13 @@ public:
}
#if _LIBCPP_STD_VER >= 20
- _LIBCPP_HIDE_FROM_ABI constexpr
- void __move_assign(basic_string&& __str, size_type __pos, size_type __len) {
+ _LIBCPP_HIDE_FROM_ABI constexpr void __move_assign(basic_string&& __str, size_type __pos, size_type __len) {
// Pilfer the allocation from __str.
_LIBCPP_ASSERT_INTERNAL(__alloc() == __str.__alloc(), "__move_assign called with wrong allocator");
size_type __old_sz = __str.size();
if (!__str.__is_long())
__str.__annotate_delete();
- __r_.first() = __str.__r_.first();
+ __r_.first() = __str.__r_.first();
__str.__r_.first() = __rep();
__str.__annotate_new(0);
@@ -1391,60 +1369,62 @@ public:
if (!__is_long()) {
__annotate_new(__len);
- } else if(__old_sz > __len) {
+ } else if (__old_sz > __len) {
__annotate_shrink(__old_sz);
}
}
#endif
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- basic_string& assign(const basic_string& __str) { return *this = __str; }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& assign(const basic_string& __str) {
+ return *this = __str;
+ }
#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- basic_string& assign(basic_string&& __str)
- _NOEXCEPT_((__noexcept_move_assign_container<_Allocator, __alloc_traits>::value))
- {*this = std::move(__str); return *this;}
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& assign(basic_string&& __str)
+ _NOEXCEPT_((__noexcept_move_assign_container<_Allocator, __alloc_traits>::value)) {
+ *this = std::move(__str);
+ return *this;
+ }
#endif
- _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& assign(const basic_string& __str, size_type __pos, size_type __n=npos);
-
- template <class _Tp,
- __enable_if_t<__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value &&
- !__is_same_uncvref<_Tp, basic_string>::value,
- int> = 0>
- _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string&
- assign(const _Tp& __t, size_type __pos, size_type __n = npos);
-
- _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& assign(const value_type* __s, size_type __n);
- _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& assign(const value_type* __s);
- _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& assign(size_type __n, value_type __c);
- template <class _InputIterator, __enable_if_t<__has_exactly_input_iterator_category<_InputIterator>::value, int> = 0>
- _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string&
- assign(_InputIterator __first, _InputIterator __last);
-
- template <class _ForwardIterator, __enable_if_t<__has_forward_iterator_category<_ForwardIterator>::value, int> = 0>
- _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string&
- assign(_ForwardIterator __first, _ForwardIterator __last);
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& assign(const basic_string& __str, size_type __pos, size_type __n = npos);
-#if _LIBCPP_STD_VER >= 23
- template <_ContainerCompatibleRange<_CharT> _Range>
- _LIBCPP_HIDE_FROM_ABI
- constexpr basic_string& assign_range(_Range&& __range) {
- if constexpr (__string_is_trivial_iterator<ranges::iterator_t<_Range>>::value &&
- (ranges::forward_range<_Range> || ranges::sized_range<_Range>)) {
- size_type __n = static_cast<size_type>(ranges::distance(__range));
- __assign_trivial(ranges::begin(__range), ranges::end(__range), __n);
+ template <class _Tp,
+ __enable_if_t<__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value &&
+ !__is_same_uncvref<_Tp, basic_string>::value,
+ int> = 0>
+ _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string&
+ assign(const _Tp& __t, size_type __pos, size_type __n = npos);
- } else {
- __assign_with_sentinel(ranges::begin(__range), ranges::end(__range));
- }
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& assign(const value_type* __s, size_type __n);
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& assign(const value_type* __s);
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& assign(size_type __n, value_type __c);
+ template <class _InputIterator, __enable_if_t<__has_exactly_input_iterator_category<_InputIterator>::value, int> = 0>
+ _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string&
+ assign(_InputIterator __first, _InputIterator __last);
- return *this;
+ template <class _ForwardIterator, __enable_if_t<__has_forward_iterator_category<_ForwardIterator>::value, int> = 0>
+ _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string&
+ assign(_ForwardIterator __first, _ForwardIterator __last);
+
+#if _LIBCPP_STD_VER >= 23
+ template <_ContainerCompatibleRange<_CharT> _Range>
+ _LIBCPP_HIDE_FROM_ABI constexpr basic_string& assign_range(_Range&& __range) {
+ if constexpr (__string_is_trivial_iterator<ranges::iterator_t<_Range>>::value &&
+ (ranges::forward_range<_Range> || ranges::sized_range<_Range>)) {
+ size_type __n = static_cast<size_type>(ranges::distance(__range));
+ __assign_trivial(ranges::begin(__range), ranges::end(__range), __n);
+
+ } else {
+ __assign_with_sentinel(ranges::begin(__range), ranges::end(__range));
}
+
+ return *this;
+ }
#endif
#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- basic_string& assign(initializer_list<value_type> __il) {return assign(__il.begin(), __il.size());}
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& assign(initializer_list<value_type> __il) {
+ return assign(__il.begin(), __il.size());
+ }
#endif // _LIBCPP_CXX03_LANG
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string&
@@ -1474,18 +1454,17 @@ public:
_LIBCPP_CONSTEXPR_SINCE_CXX20 iterator insert(const_iterator __pos, value_type __c);
#if _LIBCPP_STD_VER >= 23
- template <_ContainerCompatibleRange<_CharT> _Range>
- _LIBCPP_HIDE_FROM_ABI
- constexpr iterator insert_range(const_iterator __position, _Range&& __range) {
- if constexpr (ranges::forward_range<_Range> || ranges::sized_range<_Range>) {
- auto __n = static_cast<size_type>(ranges::distance(__range));
- return __insert_with_size(__position, ranges::begin(__range), ranges::end(__range), __n);
+ template <_ContainerCompatibleRange<_CharT> _Range>
+ _LIBCPP_HIDE_FROM_ABI constexpr iterator insert_range(const_iterator __position, _Range&& __range) {
+ if constexpr (ranges::forward_range<_Range> || ranges::sized_range<_Range>) {
+ auto __n = static_cast<size_type>(ranges::distance(__range));
+ return __insert_with_size(__position, ranges::begin(__range), ranges::end(__range), __n);
- } else {
- basic_string __temp(from_range, std::forward<_Range>(__range), __alloc());
- return insert(__position, __temp.data(), __temp.data() + __temp.size());
- }
+ } else {
+ basic_string __temp(from_range, std::forward<_Range>(__range), __alloc());
+ return insert(__position, __temp.data(), __temp.data() + __temp.size());
}
+ }
#endif
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 iterator
@@ -1504,16 +1483,15 @@ public:
insert(const_iterator __pos, _ForwardIterator __first, _ForwardIterator __last);
#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- iterator insert(const_iterator __pos, initializer_list<value_type> __il)
- {return insert(__pos, __il.begin(), __il.end());}
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 iterator
+ insert(const_iterator __pos, initializer_list<value_type> __il) {
+ return insert(__pos, __il.begin(), __il.end());
+ }
#endif // _LIBCPP_CXX03_LANG
- _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& erase(size_type __pos = 0, size_type __n = npos);
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- iterator erase(const_iterator __pos);
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- iterator erase(const_iterator __first, const_iterator __last);
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& erase(size_type __pos = 0, size_type __n = npos);
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 iterator erase(const_iterator __pos);
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 iterator erase(const_iterator __first, const_iterator __last);
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string&
replace(size_type __pos1, size_type __n1, const basic_string& __str) {
@@ -1576,707 +1554,682 @@ public:
#if _LIBCPP_STD_VER >= 23
template <_ContainerCompatibleRange<_CharT> _Range>
- _LIBCPP_HIDE_FROM_ABI
- constexpr basic_string& replace_with_range(const_iterator __i1, const_iterator __i2, _Range&& __range) {
+ _LIBCPP_HIDE_FROM_ABI constexpr basic_string&
+ replace_with_range(const_iterator __i1, const_iterator __i2, _Range&& __range) {
basic_string __temp(from_range, std::forward<_Range>(__range), __alloc());
return replace(__i1, __i2, __temp);
}
#endif
#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- basic_string& replace(const_iterator __i1, const_iterator __i2, initializer_list<value_type> __il)
- {return replace(__i1, __i2, __il.begin(), __il.end());}
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string&
+ replace(const_iterator __i1, const_iterator __i2, initializer_list<value_type> __il) {
+ return replace(__i1, __i2, __il.begin(), __il.end());
+ }
#endif // _LIBCPP_CXX03_LANG
- _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type copy(value_type* __s, size_type __n, size_type __pos = 0) const;
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type copy(value_type* __s, size_type __n, size_type __pos = 0) const;
#if _LIBCPP_STD_VER <= 20
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- basic_string substr(size_type __pos = 0, size_type __n = npos) const {
- return basic_string(*this, __pos, __n);
- }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string
+ substr(size_type __pos = 0, size_type __n = npos) const {
+ return basic_string(*this, __pos, __n);
+ }
#else
- _LIBCPP_HIDE_FROM_ABI constexpr
- basic_string substr(size_type __pos = 0, size_type __n = npos) const& {
- return basic_string(*this, __pos, __n);
- }
+ _LIBCPP_HIDE_FROM_ABI constexpr basic_string substr(size_type __pos = 0, size_type __n = npos) const& {
+ return basic_string(*this, __pos, __n);
+ }
- _LIBCPP_HIDE_FROM_ABI constexpr
- basic_string substr(size_type __pos = 0, size_type __n = npos) && {
- return basic_string(std::move(*this), __pos, __n);
- }
+ _LIBCPP_HIDE_FROM_ABI constexpr basic_string substr(size_type __pos = 0, size_type __n = npos) && {
+ return basic_string(std::move(*this), __pos, __n);
+ }
#endif
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- void swap(basic_string& __str)
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void swap(basic_string& __str)
#if _LIBCPP_STD_VER >= 14
- _NOEXCEPT;
+ _NOEXCEPT;
#else
- _NOEXCEPT_(!__alloc_traits::propagate_on_container_swap::value ||
- __is_nothrow_swappable<allocator_type>::value);
+ _NOEXCEPT_(!__alloc_traits::propagate_on_container_swap::value || __is_nothrow_swappable<allocator_type>::value);
#endif
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- const value_type* c_str() const _NOEXCEPT {return data();}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- const value_type* data() const _NOEXCEPT {return std::__to_address(__get_pointer());}
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 const value_type* c_str() const _NOEXCEPT { return data(); }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 const value_type* data() const _NOEXCEPT {
+ return std::__to_address(__get_pointer());
+ }
#if _LIBCPP_STD_VER >= 17
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- value_type* data() _NOEXCEPT {return std::__to_address(__get_pointer());}
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 value_type* data() _NOEXCEPT {
+ return std::__to_address(__get_pointer());
+ }
#endif
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- allocator_type get_allocator() const _NOEXCEPT {return __alloc();}
-
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- size_type find(const basic_string& __str, size_type __pos = 0) const _NOEXCEPT;
-
- template <class _Tp, __enable_if_t<__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value, int> = 0>
- _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
- find(const _Tp& __t, size_type __pos = 0) const _NOEXCEPT;
-
- _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type find(const value_type* __s, size_type __pos, size_type __n) const _NOEXCEPT;
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- size_type find(const value_type* __s, size_type __pos = 0) const _NOEXCEPT;
- _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type find(value_type __c, size_type __pos = 0) const _NOEXCEPT;
-
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- size_type rfind(const basic_string& __str, size_type __pos = npos) const _NOEXCEPT;
-
- template <class _Tp, __enable_if_t<__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value, int> = 0>
- _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
- rfind(const _Tp& __t, size_type __pos = npos) const _NOEXCEPT;
-
- _LIBCPP_CONSTEXPR_SINCE_CXX20
- size_type rfind(const value_type* __s, size_type __pos, size_type __n) const _NOEXCEPT;
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- size_type rfind(const value_type* __s, size_type __pos = npos) const _NOEXCEPT;
- _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type rfind(value_type __c, size_type __pos = npos) const _NOEXCEPT;
-
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- size_type find_first_of(const basic_string& __str, size_type __pos = 0) const _NOEXCEPT;
-
- template <class _Tp, __enable_if_t<__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value, int> = 0>
- _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
- find_first_of(const _Tp& __t, size_type __pos = 0) const _NOEXCEPT;
-
- _LIBCPP_CONSTEXPR_SINCE_CXX20
- size_type find_first_of(const value_type* __s, size_type __pos, size_type __n) const _NOEXCEPT;
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- size_type find_first_of(const value_type* __s, size_type __pos = 0) const _NOEXCEPT;
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- size_type find_first_of(value_type __c, size_type __pos = 0) const _NOEXCEPT;
-
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- size_type find_last_of(const basic_string& __str, size_type __pos = npos) const _NOEXCEPT;
-
- template <class _Tp, __enable_if_t<__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value, int> = 0>
- _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
- find_last_of(const _Tp& __t, size_type __pos = npos) const _NOEXCEPT;
-
- _LIBCPP_CONSTEXPR_SINCE_CXX20
- size_type find_last_of(const value_type* __s, size_type __pos, size_type __n) const _NOEXCEPT;
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- size_type find_last_of(const value_type* __s, size_type __pos = npos) const _NOEXCEPT;
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- size_type find_last_of(value_type __c, size_type __pos = npos) const _NOEXCEPT;
-
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- size_type find_first_not_of(const basic_string& __str, size_type __pos = 0) const _NOEXCEPT;
-
- template <class _Tp, __enable_if_t<__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value, int> = 0>
- _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
- find_first_not_of(const _Tp& __t, size_type __pos = 0) const _NOEXCEPT;
-
- _LIBCPP_CONSTEXPR_SINCE_CXX20
- size_type find_first_not_of(const value_type* __s, size_type __pos, size_type __n) const _NOEXCEPT;
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- size_type find_first_not_of(const value_type* __s, size_type __pos = 0) const _NOEXCEPT;
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- size_type find_first_not_of(value_type __c, size_type __pos = 0) const _NOEXCEPT;
-
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- size_type find_last_not_of(const basic_string& __str, size_type __pos = npos) const _NOEXCEPT;
-
- template <class _Tp, __enable_if_t<__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value, int> = 0>
- _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
- find_last_not_of(const _Tp& __t, size_type __pos = npos) const _NOEXCEPT;
-
- _LIBCPP_CONSTEXPR_SINCE_CXX20
- size_type find_last_not_of(const value_type* __s, size_type __pos, size_type __n) const _NOEXCEPT;
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- size_type find_last_not_of(const value_type* __s, size_type __pos = npos) const _NOEXCEPT;
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- size_type find_last_not_of(value_type __c, size_type __pos = npos) const _NOEXCEPT;
-
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- int compare(const basic_string& __str) const _NOEXCEPT;
-
- template <class _Tp, __enable_if_t<__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value, int> = 0>
- _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_SINCE_CXX20 int
- compare(const _Tp& __t) const _NOEXCEPT;
-
- template <class _Tp, __enable_if_t<__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value, int> = 0>
- _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_SINCE_CXX20 int
- compare(size_type __pos1, size_type __n1, const _Tp& __t) const;
-
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- int compare(size_type __pos1, size_type __n1, const basic_string& __str) const;
- _LIBCPP_CONSTEXPR_SINCE_CXX20
- int compare(size_type __pos1, size_type __n1, const basic_string& __str, size_type __pos2,
- size_type __n2 = npos) const;
-
- template <class _Tp,
- __enable_if_t<__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value &&
- !__is_same_uncvref<_Tp, basic_string>::value,
- int> = 0>
- inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 int
- compare(size_type __pos1, size_type __n1, const _Tp& __t, size_type __pos2, size_type __n2 = npos) const;
-
- _LIBCPP_CONSTEXPR_SINCE_CXX20 int compare(const value_type* __s) const _NOEXCEPT;
- _LIBCPP_CONSTEXPR_SINCE_CXX20 int compare(size_type __pos1, size_type __n1, const value_type* __s) const;
- _LIBCPP_CONSTEXPR_SINCE_CXX20
- int compare(size_type __pos1, size_type __n1, const value_type* __s, size_type __n2) const;
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 allocator_type get_allocator() const _NOEXCEPT {
+ return __alloc();
+ }
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
+ find(const basic_string& __str, size_type __pos = 0) const _NOEXCEPT;
+
+ template <class _Tp, __enable_if_t<__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value, int> = 0>
+ _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
+ find(const _Tp& __t, size_type __pos = 0) const _NOEXCEPT;
+
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type find(const value_type* __s, size_type __pos, size_type __n) const _NOEXCEPT;
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
+ find(const value_type* __s, size_type __pos = 0) const _NOEXCEPT;
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type find(value_type __c, size_type __pos = 0) const _NOEXCEPT;
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
+ rfind(const basic_string& __str, size_type __pos = npos) const _NOEXCEPT;
+
+ template <class _Tp, __enable_if_t<__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value, int> = 0>
+ _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
+ rfind(const _Tp& __t, size_type __pos = npos) const _NOEXCEPT;
+
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type rfind(const value_type* __s, size_type __pos, size_type __n) const _NOEXCEPT;
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
+ rfind(const value_type* __s, size_type __pos = npos) const _NOEXCEPT;
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type rfind(value_type __c, size_type __pos = npos) const _NOEXCEPT;
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
+ find_first_of(const basic_string& __str, size_type __pos = 0) const _NOEXCEPT;
+
+ template <class _Tp, __enable_if_t<__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value, int> = 0>
+ _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
+ find_first_of(const _Tp& __t, size_type __pos = 0) const _NOEXCEPT;
+
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
+ find_first_of(const value_type* __s, size_type __pos, size_type __n) const _NOEXCEPT;
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
+ find_first_of(const value_type* __s, size_type __pos = 0) const _NOEXCEPT;
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
+ find_first_of(value_type __c, size_type __pos = 0) const _NOEXCEPT;
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
+ find_last_of(const basic_string& __str, size_type __pos = npos) const _NOEXCEPT;
+
+ template <class _Tp, __enable_if_t<__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value, int> = 0>
+ _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
+ find_last_of(const _Tp& __t, size_type __pos = npos) const _NOEXCEPT;
+
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
+ find_last_of(const value_type* __s, size_type __pos, size_type __n) const _NOEXCEPT;
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
+ find_last_of(const value_type* __s, size_type __pos = npos) const _NOEXCEPT;
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
+ find_last_of(value_type __c, size_type __pos = npos) const _NOEXCEPT;
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
+ find_first_not_of(const basic_string& __str, size_type __pos = 0) const _NOEXCEPT;
+
+ template <class _Tp, __enable_if_t<__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value, int> = 0>
+ _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
+ find_first_not_of(const _Tp& __t, size_type __pos = 0) const _NOEXCEPT;
+
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
+ find_first_not_of(const value_type* __s, size_type __pos, size_type __n) const _NOEXCEPT;
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
+ find_first_not_of(const value_type* __s, size_type __pos = 0) const _NOEXCEPT;
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
+ find_first_not_of(value_type __c, size_type __pos = 0) const _NOEXCEPT;
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
+ find_last_not_of(const basic_string& __str, size_type __pos = npos) const _NOEXCEPT;
+
+ template <class _Tp, __enable_if_t<__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value, int> = 0>
+ _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
+ find_last_not_of(const _Tp& __t, size_type __pos = npos) const _NOEXCEPT;
+
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
+ find_last_not_of(const value_type* __s, size_type __pos, size_type __n) const _NOEXCEPT;
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
+ find_last_not_of(const value_type* __s, size_type __pos = npos) const _NOEXCEPT;
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
+ find_last_not_of(value_type __c, size_type __pos = npos) const _NOEXCEPT;
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 int compare(const basic_string& __str) const _NOEXCEPT;
+
+ template <class _Tp, __enable_if_t<__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value, int> = 0>
+ _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_SINCE_CXX20 int
+ compare(const _Tp& __t) const _NOEXCEPT;
+
+ template <class _Tp, __enable_if_t<__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value, int> = 0>
+ _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_SINCE_CXX20 int
+ compare(size_type __pos1, size_type __n1, const _Tp& __t) const;
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 int
+ compare(size_type __pos1, size_type __n1, const basic_string& __str) const;
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 int
+ compare(size_type __pos1, size_type __n1, const basic_string& __str, size_type __pos2, size_type __n2 = npos) const;
+
+ template <class _Tp,
+ __enable_if_t<__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value &&
+ !__is_same_uncvref<_Tp, basic_string>::value,
+ int> = 0>
+ inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 int
+ compare(size_type __pos1, size_type __n1, const _Tp& __t, size_type __pos2, size_type __n2 = npos) const;
+
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 int compare(const value_type* __s) const _NOEXCEPT;
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 int compare(size_type __pos1, size_type __n1, const value_type* __s) const;
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 int
+ compare(size_type __pos1, size_type __n1, const value_type* __s, size_type __n2) const;
#if _LIBCPP_STD_VER >= 20
- constexpr _LIBCPP_HIDE_FROM_ABI
- bool starts_with(__self_view __sv) const noexcept
- { return __self_view(data(), size()).starts_with(__sv); }
+ constexpr _LIBCPP_HIDE_FROM_ABI bool starts_with(__self_view __sv) const noexcept {
+ return __self_view(data(), size()).starts_with(__sv);
+ }
- constexpr _LIBCPP_HIDE_FROM_ABI
- bool starts_with(value_type __c) const noexcept
- { return !empty() && _Traits::eq(front(), __c); }
+ constexpr _LIBCPP_HIDE_FROM_ABI bool starts_with(value_type __c) const noexcept {
+ return !empty() && _Traits::eq(front(), __c);
+ }
- constexpr _LIBCPP_HIDE_FROM_ABI
- bool starts_with(const value_type* __s) const noexcept
- { return starts_with(__self_view(__s)); }
+ constexpr _LIBCPP_HIDE_FROM_ABI bool starts_with(const value_type* __s) const noexcept {
+ return starts_with(__self_view(__s));
+ }
- constexpr _LIBCPP_HIDE_FROM_ABI
- bool ends_with(__self_view __sv) const noexcept
- { return __self_view(data(), size()).ends_with( __sv); }
+ constexpr _LIBCPP_HIDE_FROM_ABI bool ends_with(__self_view __sv) const noexcept {
+ return __self_view(data(), size()).ends_with(__sv);
+ }
- constexpr _LIBCPP_HIDE_FROM_ABI
- bool ends_with(value_type __c) const noexcept
- { return !empty() && _Traits::eq(back(), __c); }
+ constexpr _LIBCPP_HIDE_FROM_ABI bool ends_with(value_type __c) const noexcept {
+ return !empty() && _Traits::eq(back(), __c);
+ }
- constexpr _LIBCPP_HIDE_FROM_ABI
- bool ends_with(const value_type* __s) const noexcept
- { return ends_with(__self_view(__s)); }
+ constexpr _LIBCPP_HIDE_FROM_ABI bool ends_with(const value_type* __s) const noexcept {
+ return ends_with(__self_view(__s));
+ }
#endif
#if _LIBCPP_STD_VER >= 23
- constexpr _LIBCPP_HIDE_FROM_ABI
- bool contains(__self_view __sv) const noexcept
- { return __self_view(data(), size()).contains(__sv); }
+ constexpr _LIBCPP_HIDE_FROM_ABI bool contains(__self_view __sv) const noexcept {
+ return __self_view(data(), size()).contains(__sv);
+ }
- constexpr _LIBCPP_HIDE_FROM_ABI
- bool contains(value_type __c) const noexcept
- { return __self_view(data(), size()).contains(__c); }
+ constexpr _LIBCPP_HIDE_FROM_ABI bool contains(value_type __c) const noexcept {
+ return __self_view(data(), size()).contains(__c);
+ }
- constexpr _LIBCPP_HIDE_FROM_ABI
- bool contains(const value_type* __s) const
- { return __self_view(data(), size()).contains(__s); }
+ constexpr _LIBCPP_HIDE_FROM_ABI bool contains(const value_type* __s) const {
+ return __self_view(data(), size()).contains(__s);
+ }
#endif
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool __invariants() const;
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool __invariants() const;
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __clear_and_shrink() _NOEXCEPT;
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __clear_and_shrink() _NOEXCEPT;
private:
- template<class _Alloc>
- inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- bool friend operator==(const basic_string<char, char_traits<char>, _Alloc>& __lhs,
- const basic_string<char, char_traits<char>, _Alloc>& __rhs) _NOEXCEPT;
+ template <class _Alloc>
+ inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool friend
+ operator==(const basic_string<char, char_traits<char>, _Alloc>& __lhs,
+ const basic_string<char, char_traits<char>, _Alloc>& __rhs) _NOEXCEPT;
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __shrink_or_extend(size_type __target_capacity);
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __shrink_or_extend(size_type __target_capacity);
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_STRING_INTERNAL_MEMORY_ACCESS
- bool __is_long() const _NOEXCEPT {
- if (__libcpp_is_constant_evaluated() && __builtin_constant_p(__r_.first().__l.__is_long_)) {
- return __r_.first().__l.__is_long_;
- }
- return __r_.first().__s.__is_long_;
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_STRING_INTERNAL_MEMORY_ACCESS bool
+ __is_long() const _NOEXCEPT {
+ if (__libcpp_is_constant_evaluated() && __builtin_constant_p(__r_.first().__l.__is_long_)) {
+ return __r_.first().__l.__is_long_;
}
+ return __r_.first().__s.__is_long_;
+ }
- static _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __begin_lifetime(pointer __begin, size_type __n) {
+ static _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __begin_lifetime(pointer __begin, size_type __n) {
#if _LIBCPP_STD_VER >= 20
- if (__libcpp_is_constant_evaluated()) {
- for (size_type __i = 0; __i != __n; ++__i)
- std::construct_at(std::addressof(__begin[__i]));
- }
+ if (__libcpp_is_constant_evaluated()) {
+ for (size_type __i = 0; __i != __n; ++__i)
+ std::construct_at(std::addressof(__begin[__i]));
+ }
#else
- (void)__begin;
- (void)__n;
+ (void)__begin;
+ (void)__n;
#endif // _LIBCPP_STD_VER >= 20
- }
+ }
- _LIBCPP_CONSTEXPR _LIBCPP_HIDE_FROM_ABI static bool __fits_in_sso(size_type __sz) {
- return __sz < __min_cap;
- }
+ _LIBCPP_CONSTEXPR _LIBCPP_HIDE_FROM_ABI static bool __fits_in_sso(size_type __sz) { return __sz < __min_cap; }
- template <class _Iterator, class _Sentinel>
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI
- void __assign_trivial(_Iterator __first, _Sentinel __last, size_type __n);
-
- template <class _Iterator, class _Sentinel>
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI
- void __assign_with_sentinel(_Iterator __first, _Sentinel __last);
-
- template <class _ForwardIterator, class _Sentinel>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
- iterator __insert_from_safe_copy(size_type __n, size_type __ip, _ForwardIterator __first, _Sentinel __last) {
- size_type __sz = size();
- size_type __cap = capacity();
- value_type* __p;
- if (__cap - __sz >= __n)
- {
- __annotate_increase(__n);
- __p = std::__to_address(__get_pointer());
- size_type __n_move = __sz - __ip;
- if (__n_move != 0)
- traits_type::move(__p + __ip + __n, __p + __ip, __n_move);
- }
- else
- {
- __grow_by_without_replace(__cap, __sz + __n - __cap, __sz, __ip, 0, __n);
- __p = std::__to_address(__get_long_pointer());
- }
- __sz += __n;
- __set_size(__sz);
- traits_type::assign(__p[__sz], value_type());
- for (__p += __ip; __first != __last; ++__p, ++__first)
- traits_type::assign(*__p, *__first);
+ template <class _Iterator, class _Sentinel>
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void
+ __assign_trivial(_Iterator __first, _Sentinel __last, size_type __n);
- return begin() + __ip;
+ template <class _Iterator, class _Sentinel>
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __assign_with_sentinel(_Iterator __first, _Sentinel __last);
+
+ template <class _ForwardIterator, class _Sentinel>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 iterator
+ __insert_from_safe_copy(size_type __n, size_type __ip, _ForwardIterator __first, _Sentinel __last) {
+ size_type __sz = size();
+ size_type __cap = capacity();
+ value_type* __p;
+ if (__cap - __sz >= __n) {
+ __annotate_increase(__n);
+ __p = std::__to_address(__get_pointer());
+ size_type __n_move = __sz - __ip;
+ if (__n_move != 0)
+ traits_type::move(__p + __ip + __n, __p + __ip, __n_move);
+ } else {
+ __grow_by_without_replace(__cap, __sz + __n - __cap, __sz, __ip, 0, __n);
+ __p = std::__to_address(__get_long_pointer());
}
+ __sz += __n;
+ __set_size(__sz);
+ traits_type::assign(__p[__sz], value_type());
+ for (__p += __ip; __first != __last; ++__p, ++__first)
+ traits_type::assign(*__p, *__first);
- template<class _Iterator, class _Sentinel>
- _LIBCPP_CONSTEXPR_SINCE_CXX20
- iterator __insert_with_size(const_iterator __pos, _Iterator __first, _Sentinel __last, size_type __n);
+ return begin() + __ip;
+ }
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 allocator_type& __alloc() _NOEXCEPT { return __r_.second(); }
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR const allocator_type& __alloc() const _NOEXCEPT { return __r_.second(); }
+ template <class _Iterator, class _Sentinel>
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 iterator
+ __insert_with_size(const_iterator __pos, _Iterator __first, _Sentinel __last, size_type __n);
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_STRING_INTERNAL_MEMORY_ACCESS
- void __set_short_size(size_type __s) _NOEXCEPT {
- _LIBCPP_ASSERT_INTERNAL(
- __s < __min_cap, "__s should never be greater than or equal to the short string capacity");
- __r_.first().__s.__size_ = __s;
- __r_.first().__s.__is_long_ = false;
- }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 allocator_type& __alloc() _NOEXCEPT { return __r_.second(); }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR const allocator_type& __alloc() const _NOEXCEPT { return __r_.second(); }
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_STRING_INTERNAL_MEMORY_ACCESS
- size_type __get_short_size() const _NOEXCEPT {
- _LIBCPP_ASSERT_INTERNAL(
- !__r_.first().__s.__is_long_, "String has to be short when trying to get the short size");
- return __r_.first().__s.__size_;
- }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_STRING_INTERNAL_MEMORY_ACCESS void
+ __set_short_size(size_type __s) _NOEXCEPT {
+ _LIBCPP_ASSERT_INTERNAL(__s < __min_cap, "__s should never be greater than or equal to the short string capacity");
+ __r_.first().__s.__size_ = __s;
+ __r_.first().__s.__is_long_ = false;
+ }
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- void __set_long_size(size_type __s) _NOEXCEPT
- {__r_.first().__l.__size_ = __s;}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- size_type __get_long_size() const _NOEXCEPT
- {return __r_.first().__l.__size_;}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- void __set_size(size_type __s) _NOEXCEPT
- {if (__is_long()) __set_long_size(__s); else __set_short_size(__s);}
-
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- void __set_long_cap(size_type __s) _NOEXCEPT {
- __r_.first().__l.__cap_ = __s / __endian_factor;
- __r_.first().__l.__is_long_ = true;
- }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_STRING_INTERNAL_MEMORY_ACCESS size_type
+ __get_short_size() const _NOEXCEPT {
+ _LIBCPP_ASSERT_INTERNAL(!__r_.first().__s.__is_long_, "String has to be short when trying to get the short size");
+ return __r_.first().__s.__size_;
+ }
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- size_type __get_long_cap() const _NOEXCEPT {
- return __r_.first().__l.__cap_ * __endian_factor;
- }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __set_long_size(size_type __s) _NOEXCEPT {
+ __r_.first().__l.__size_ = __s;
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type __get_long_size() const _NOEXCEPT {
+ return __r_.first().__l.__size_;
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __set_size(size_type __s) _NOEXCEPT {
+ if (__is_long())
+ __set_long_size(__s);
+ else
+ __set_short_size(__s);
+ }
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __set_long_cap(size_type __s) _NOEXCEPT {
+ __r_.first().__l.__cap_ = __s / __endian_factor;
+ __r_.first().__l.__is_long_ = true;
+ }
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- void __set_long_pointer(pointer __p) _NOEXCEPT
- {__r_.first().__l.__data_ = __p;}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- pointer __get_long_pointer() _NOEXCEPT
- {return __r_.first().__l.__data_;}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- const_pointer __get_long_pointer() const _NOEXCEPT
- {return __r_.first().__l.__data_;}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- pointer __get_short_pointer() _NOEXCEPT
- {return pointer_traits<pointer>::pointer_to(__r_.first().__s.__data_[0]);}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- const_pointer __get_short_pointer() const _NOEXCEPT
- {return pointer_traits<const_pointer>::pointer_to(__r_.first().__s.__data_[0]);}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- pointer __get_pointer() _NOEXCEPT
- {return __is_long() ? __get_long_pointer() : __get_short_pointer();}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- const_pointer __get_pointer() const _NOEXCEPT
- {return __is_long() ? __get_long_pointer() : __get_short_pointer();}
-
- // The following functions are no-ops outside of AddressSanitizer mode.
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __annotate_contiguous_container(const void* __old_mid, const void* __new_mid) const {
- (void)__old_mid;
- (void)__new_mid;
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type __get_long_cap() const _NOEXCEPT {
+ return __r_.first().__l.__cap_ * __endian_factor;
+ }
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __set_long_pointer(pointer __p) _NOEXCEPT {
+ __r_.first().__l.__data_ = __p;
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 pointer __get_long_pointer() _NOEXCEPT {
+ return __r_.first().__l.__data_;
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 const_pointer __get_long_pointer() const _NOEXCEPT {
+ return __r_.first().__l.__data_;
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 pointer __get_short_pointer() _NOEXCEPT {
+ return pointer_traits<pointer>::pointer_to(__r_.first().__s.__data_[0]);
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 const_pointer __get_short_pointer() const _NOEXCEPT {
+ return pointer_traits<const_pointer>::pointer_to(__r_.first().__s.__data_[0]);
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 pointer __get_pointer() _NOEXCEPT {
+ return __is_long() ? __get_long_pointer() : __get_short_pointer();
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 const_pointer __get_pointer() const _NOEXCEPT {
+ return __is_long() ? __get_long_pointer() : __get_short_pointer();
+ }
+
+ // The following functions are no-ops outside of AddressSanitizer mode.
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void
+ __annotate_contiguous_container(const void* __old_mid, const void* __new_mid) const {
+ (void)__old_mid;
+ (void)__new_mid;
#if !defined(_LIBCPP_HAS_NO_ASAN) && defined(_LIBCPP_INSTRUMENTED_WITH_ASAN)
- const void* __begin = data();
- const void* __end = data() + capacity() + 1;
- if (!__libcpp_is_constant_evaluated() && __begin != nullptr && is_same<allocator_type, __default_allocator_type>::value)
- __sanitizer_annotate_contiguous_container(__begin, __end, __old_mid, __new_mid);
+ const void* __begin = data();
+ const void* __end = data() + capacity() + 1;
+ if (!__libcpp_is_constant_evaluated() && __begin != nullptr &&
+ is_same<allocator_type, __default_allocator_type>::value)
+ __sanitizer_annotate_contiguous_container(__begin, __end, __old_mid, __new_mid);
#endif
- }
+ }
- // ASan: short string is poisoned if and only if this function returns true.
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool __asan_short_string_is_annotated() const _NOEXCEPT {
- return _LIBCPP_SHORT_STRING_ANNOTATIONS_ALLOWED && !__libcpp_is_constant_evaluated();
- }
+ // ASan: short string is poisoned if and only if this function returns true.
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool __asan_short_string_is_annotated() const _NOEXCEPT {
+ return _LIBCPP_SHORT_STRING_ANNOTATIONS_ALLOWED && !__libcpp_is_constant_evaluated();
+ }
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __annotate_new(size_type __current_size) const _NOEXCEPT {
- if (!__libcpp_is_constant_evaluated() && (__asan_short_string_is_annotated() || __is_long()))
- __annotate_contiguous_container(data() + capacity() + 1, data() + __current_size + 1);
- }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __annotate_new(size_type __current_size) const _NOEXCEPT {
+ (void) __current_size;
+#if !defined(_LIBCPP_HAS_NO_ASAN) && defined(_LIBCPP_INSTRUMENTED_WITH_ASAN)
+ if (!__libcpp_is_constant_evaluated() && (__asan_short_string_is_annotated() || __is_long()))
+ __annotate_contiguous_container(data() + capacity() + 1, data() + __current_size + 1);
+#endif
+ }
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __annotate_delete() const _NOEXCEPT {
- if (!__libcpp_is_constant_evaluated() && (__asan_short_string_is_annotated() || __is_long()))
- __annotate_contiguous_container(data() + size() + 1, data() + capacity() + 1);
- }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __annotate_delete() const _NOEXCEPT {
+#if !defined(_LIBCPP_HAS_NO_ASAN) && defined(_LIBCPP_INSTRUMENTED_WITH_ASAN)
+ if (!__libcpp_is_constant_evaluated() && (__asan_short_string_is_annotated() || __is_long()))
+ __annotate_contiguous_container(data() + size() + 1, data() + capacity() + 1);
+#endif
+ }
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __annotate_increase(size_type __n) const _NOEXCEPT {
- if (!__libcpp_is_constant_evaluated() && (__asan_short_string_is_annotated() || __is_long()))
- __annotate_contiguous_container(data() + size() + 1, data() + size() + 1 + __n);
- }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __annotate_increase(size_type __n) const _NOEXCEPT {
+ (void) __n;
+#if !defined(_LIBCPP_HAS_NO_ASAN) && defined(_LIBCPP_INSTRUMENTED_WITH_ASAN)
+ if (!__libcpp_is_constant_evaluated() && (__asan_short_string_is_annotated() || __is_long()))
+ __annotate_contiguous_container(data() + size() + 1, data() + size() + 1 + __n);
+#endif
+ }
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __annotate_shrink(size_type __old_size) const _NOEXCEPT {
- if (!__libcpp_is_constant_evaluated() && (__asan_short_string_is_annotated() || __is_long()))
- __annotate_contiguous_container(data() + __old_size + 1, data() + size() + 1);
- }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __annotate_shrink(size_type __old_size) const _NOEXCEPT {
+ (void) __old_size;
+#if !defined(_LIBCPP_HAS_NO_ASAN) && defined(_LIBCPP_INSTRUMENTED_WITH_ASAN)
+ if (!__libcpp_is_constant_evaluated() && (__asan_short_string_is_annotated() || __is_long()))
+ __annotate_contiguous_container(data() + __old_size + 1, data() + size() + 1);
+#endif
+ }
- template <size_type __a> static
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- size_type __align_it(size_type __s) _NOEXCEPT
- {return (__s + (__a-1)) & ~(__a-1);}
- enum {
- __alignment =
+ template <size_type __a>
+ static _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type __align_it(size_type __s) _NOEXCEPT {
+ return (__s + (__a - 1)) & ~(__a - 1);
+ }
+ enum {
+ __alignment =
#ifdef _LIBCPP_ABI_STRING_8_BYTE_ALIGNMENT
- 8
+ 8
#else
- 16
+ 16
#endif
- };
- static _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- size_type __recommend(size_type __s) _NOEXCEPT
- {
- if (__s < __min_cap) {
- return static_cast<size_type>(__min_cap) - 1;
- }
- size_type __guess = __align_it<sizeof(value_type) < __alignment ?
- __alignment/sizeof(value_type) : 1 > (__s+1) - 1;
- if (__guess == __min_cap) ++__guess;
- return __guess;
+ };
+ static _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type __recommend(size_type __s) _NOEXCEPT {
+ if (__s < __min_cap) {
+ return static_cast<size_type>(__min_cap) - 1;
}
+ size_type __guess =
+ __align_it < sizeof(value_type) < __alignment ? __alignment / sizeof(value_type) : 1 > (__s + 1) - 1;
+ if (__guess == __min_cap)
+ ++__guess;
+ return __guess;
+ }
+
+ inline _LIBCPP_CONSTEXPR_SINCE_CXX20 void __init(const value_type* __s, size_type __sz, size_type __reserve);
+ inline _LIBCPP_CONSTEXPR_SINCE_CXX20 void __init(const value_type* __s, size_type __sz);
+ inline _LIBCPP_CONSTEXPR_SINCE_CXX20 void __init(size_type __n, value_type __c);
+
+ // Slow path for the (inlined) copy constructor for 'long' strings.
+ // Always externally instantiated and not inlined.
+ // Requires that __s is zero terminated.
+ // The main reason for this function to exist is because for unstable, we
+ // want to allow inlining of the copy constructor. However, we don't want
+ // to call the __init() functions as those are marked as inline which may
+ // result in over-aggressive inlining by the compiler, where our aim is
+ // to only inline the fast path code directly in the ctor.
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_NOINLINE void __init_copy_ctor_external(const value_type* __s, size_type __sz);
+
+ template <class _InputIterator, __enable_if_t<__has_exactly_input_iterator_category<_InputIterator>::value, int> = 0>
+ inline _LIBCPP_CONSTEXPR_SINCE_CXX20 void __init(_InputIterator __first, _InputIterator __last);
+
+ template <class _ForwardIterator, __enable_if_t<__has_forward_iterator_category<_ForwardIterator>::value, int> = 0>
+ inline _LIBCPP_CONSTEXPR_SINCE_CXX20 void __init(_ForwardIterator __first, _ForwardIterator __last);
+
+ template <class _InputIterator, class _Sentinel>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void
+ __init_with_sentinel(_InputIterator __first, _Sentinel __last);
+ template <class _InputIterator, class _Sentinel>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void
+ __init_with_size(_InputIterator __first, _Sentinel __last, size_type __sz);
- inline _LIBCPP_CONSTEXPR_SINCE_CXX20
- void __init(const value_type* __s, size_type __sz, size_type __reserve);
- inline _LIBCPP_CONSTEXPR_SINCE_CXX20
- void __init(const value_type* __s, size_type __sz);
- inline _LIBCPP_CONSTEXPR_SINCE_CXX20
- void __init(size_type __n, value_type __c);
-
- // Slow path for the (inlined) copy constructor for 'long' strings.
- // Always externally instantiated and not inlined.
- // Requires that __s is zero terminated.
- // The main reason for this function to exist is because for unstable, we
- // want to allow inlining of the copy constructor. However, we don't want
- // to call the __init() functions as those are marked as inline which may
- // result in over-aggressive inlining by the compiler, where our aim is
- // to only inline the fast path code directly in the ctor.
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_NOINLINE void __init_copy_ctor_external(const value_type* __s, size_type __sz);
-
- template <class _InputIterator, __enable_if_t<__has_exactly_input_iterator_category<_InputIterator>::value, int> = 0>
- inline _LIBCPP_CONSTEXPR_SINCE_CXX20 void __init(_InputIterator __first, _InputIterator __last);
-
- template <class _ForwardIterator, __enable_if_t<__has_forward_iterator_category<_ForwardIterator>::value, int> = 0>
- inline _LIBCPP_CONSTEXPR_SINCE_CXX20 void __init(_ForwardIterator __first, _ForwardIterator __last);
-
- template <class _InputIterator, class _Sentinel>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- void __init_with_sentinel(_InputIterator __first, _Sentinel __last);
- template <class _InputIterator, class _Sentinel>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- void __init_with_size(_InputIterator __first, _Sentinel __last, size_type __sz);
-
- _LIBCPP_CONSTEXPR_SINCE_CXX20
+ _LIBCPP_CONSTEXPR_SINCE_CXX20
#if _LIBCPP_ABI_VERSION >= 2 // We want to use the function in the dylib in ABIv1
- _LIBCPP_HIDE_FROM_ABI
+ _LIBCPP_HIDE_FROM_ABI
#endif
- _LIBCPP_DEPRECATED_("use __grow_by_without_replace")
- void __grow_by(size_type __old_cap, size_type __delta_cap, size_type __old_sz,
- size_type __n_copy, size_type __n_del, size_type __n_add = 0);
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI
- void __grow_by_without_replace(size_type __old_cap, size_type __delta_cap, size_type __old_sz,
- size_type __n_copy, size_type __n_del, size_type __n_add = 0);
- _LIBCPP_CONSTEXPR_SINCE_CXX20
- void __grow_by_and_replace(size_type __old_cap, size_type __delta_cap, size_type __old_sz,
- size_type __n_copy, size_type __n_del,
- size_type __n_add, const value_type* __p_new_stuff);
-
- // __assign_no_alias is invoked for assignment operations where we
- // have proof that the input does not alias the current instance.
- // For example, operator=(basic_string) performs a 'self' check.
- template <bool __is_short>
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_NOINLINE basic_string& __assign_no_alias(const value_type* __s, size_type __n);
+ _LIBCPP_DEPRECATED_("use __grow_by_without_replace") void __grow_by(
+ size_type __old_cap,
+ size_type __delta_cap,
+ size_type __old_sz,
+ size_type __n_copy,
+ size_type __n_del,
+ size_type __n_add = 0);
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __grow_by_without_replace(
+ size_type __old_cap,
+ size_type __delta_cap,
+ size_type __old_sz,
+ size_type __n_copy,
+ size_type __n_del,
+ size_type __n_add = 0);
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 void __grow_by_and_replace(
+ size_type __old_cap,
+ size_type __delta_cap,
+ size_type __old_sz,
+ size_type __n_copy,
+ size_type __n_del,
+ size_type __n_add,
+ const value_type* __p_new_stuff);
+
+ // __assign_no_alias is invoked for assignment operations where we
+ // have proof that the input does not alias the current instance.
+ // For example, operator=(basic_string) performs a 'self' check.
+ template <bool __is_short>
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_NOINLINE basic_string& __assign_no_alias(const value_type* __s, size_type __n);
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __erase_to_end(size_type __pos) {
__null_terminate_at(std::__to_address(__get_pointer()), __pos);
}
- // __erase_external_with_move is invoked for erase() invocations where
- // `n ~= npos`, likely requiring memory moves on the string data.
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_NOINLINE void __erase_external_with_move(size_type __pos, size_type __n);
-
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- void __copy_assign_alloc(const basic_string& __str)
- {__copy_assign_alloc(__str, integral_constant<bool,
- __alloc_traits::propagate_on_container_copy_assignment::value>());}
-
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- void __copy_assign_alloc(const basic_string& __str, true_type)
- {
- if (__alloc() == __str.__alloc())
- __alloc() = __str.__alloc();
- else
- {
- if (!__str.__is_long())
- {
- __clear_and_shrink();
- __alloc() = __str.__alloc();
- }
- else
- {
- __annotate_delete();
- allocator_type __a = __str.__alloc();
- auto __allocation = std::__allocate_at_least(__a, __str.__get_long_cap());
- __begin_lifetime(__allocation.ptr, __allocation.count);
- if (__is_long())
- __alloc_traits::deallocate(__alloc(), __get_long_pointer(), __get_long_cap());
- __alloc() = std::move(__a);
- __set_long_pointer(__allocation.ptr);
- __set_long_cap(__allocation.count);
- __set_long_size(__str.size());
- __annotate_new(__get_long_size());
- }
- }
- }
+ // __erase_external_with_move is invoked for erase() invocations where
+ // `n ~= npos`, likely requiring memory moves on the string data.
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_NOINLINE void __erase_external_with_move(size_type __pos, size_type __n);
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- void __copy_assign_alloc(const basic_string&, false_type) _NOEXCEPT
- {}
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __copy_assign_alloc(const basic_string& __str) {
+ __copy_assign_alloc(
+ __str, integral_constant<bool, __alloc_traits::propagate_on_container_copy_assignment::value>());
+ }
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __copy_assign_alloc(const basic_string& __str, true_type) {
+ if (__alloc() == __str.__alloc())
+ __alloc() = __str.__alloc();
+ else {
+ if (!__str.__is_long()) {
+ __clear_and_shrink();
+ __alloc() = __str.__alloc();
+ } else {
+ __annotate_delete();
+ allocator_type __a = __str.__alloc();
+ auto __allocation = std::__allocate_at_least(__a, __str.__get_long_cap());
+ __begin_lifetime(__allocation.ptr, __allocation.count);
+ if (__is_long())
+ __alloc_traits::deallocate(__alloc(), __get_long_pointer(), __get_long_cap());
+ __alloc() = std::move(__a);
+ __set_long_pointer(__allocation.ptr);
+ __set_long_cap(__allocation.count);
+ __set_long_size(__str.size());
+ __annotate_new(__get_long_size());
+ }
+ }
+ }
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void
+ __copy_assign_alloc(const basic_string&, false_type) _NOEXCEPT {}
#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- void __move_assign(basic_string& __str, false_type)
- _NOEXCEPT_(__alloc_traits::is_always_equal::value);
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_STRING_INTERNAL_MEMORY_ACCESS
- void __move_assign(basic_string& __str, true_type)
-#if _LIBCPP_STD_VER >= 17
- _NOEXCEPT;
-#else
- _NOEXCEPT_(is_nothrow_move_assignable<allocator_type>::value);
-#endif
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __move_assign(basic_string& __str, false_type)
+ _NOEXCEPT_(__alloc_traits::is_always_equal::value);
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_STRING_INTERNAL_MEMORY_ACCESS void
+ __move_assign(basic_string& __str, true_type)
+# if _LIBCPP_STD_VER >= 17
+ _NOEXCEPT;
+# else
+ _NOEXCEPT_(is_nothrow_move_assignable<allocator_type>::value);
+# endif
#endif
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- void
- __move_assign_alloc(basic_string& __str)
- _NOEXCEPT_(
- !__alloc_traits::propagate_on_container_move_assignment::value ||
- is_nothrow_move_assignable<allocator_type>::value)
- {__move_assign_alloc(__str, integral_constant<bool,
- __alloc_traits::propagate_on_container_move_assignment::value>());}
-
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- void __move_assign_alloc(basic_string& __c, true_type)
- _NOEXCEPT_(is_nothrow_move_assignable<allocator_type>::value)
- {
- __alloc() = std::move(__c.__alloc());
- }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __move_assign_alloc(basic_string& __str)
+ _NOEXCEPT_(!__alloc_traits::propagate_on_container_move_assignment::value ||
+ is_nothrow_move_assignable<allocator_type>::value) {
+ __move_assign_alloc(
+ __str, integral_constant<bool, __alloc_traits::propagate_on_container_move_assignment::value>());
+ }
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- void __move_assign_alloc(basic_string&, false_type)
- _NOEXCEPT
- {}
-
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_NOINLINE basic_string& __assign_external(const value_type* __s);
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_NOINLINE basic_string& __assign_external(const value_type* __s, size_type __n);
-
- // Assigns the value in __s, guaranteed to be __n < __min_cap in length.
- inline _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& __assign_short(const value_type* __s, size_type __n) {
- size_type __old_size = size();
- if (__n > __old_size)
- __annotate_increase(__n - __old_size);
- pointer __p = __is_long()
- ? (__set_long_size(__n), __get_long_pointer())
- : (__set_short_size(__n), __get_short_pointer());
- traits_type::move(std::__to_address(__p), __s, __n);
- traits_type::assign(__p[__n], value_type());
- if (__old_size > __n)
- __annotate_shrink(__old_size);
- return *this;
- }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __move_assign_alloc(basic_string& __c, true_type)
+ _NOEXCEPT_(is_nothrow_move_assignable<allocator_type>::value) {
+ __alloc() = std::move(__c.__alloc());
+ }
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- basic_string& __null_terminate_at(value_type* __p, size_type __newsz) {
- size_type __old_size = size();
- if (__newsz > __old_size)
- __annotate_increase(__newsz - __old_size);
- __set_size(__newsz);
- traits_type::assign(__p[__newsz], value_type());
- if (__old_size > __newsz)
- __annotate_shrink(__old_size);
- return *this;
- }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __move_assign_alloc(basic_string&, false_type) _NOEXCEPT {}
- template <class _Tp>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool __addr_in_range(const _Tp& __v) const {
- return std::__is_pointer_in_range(data(), data() + size() + 1, std::addressof(__v));
- }
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_NOINLINE basic_string& __assign_external(const value_type* __s);
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_NOINLINE basic_string& __assign_external(const value_type* __s, size_type __n);
- _LIBCPP_NORETURN _LIBCPP_HIDE_FROM_ABI
- void __throw_length_error() const {
- std::__throw_length_error("basic_string");
- }
+ // Assigns the value in __s, guaranteed to be __n < __min_cap in length.
+ inline _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& __assign_short(const value_type* __s, size_type __n) {
+ size_type __old_size = size();
+ if (__n > __old_size)
+ __annotate_increase(__n - __old_size);
+ pointer __p =
+ __is_long() ? (__set_long_size(__n), __get_long_pointer()) : (__set_short_size(__n), __get_short_pointer());
+ traits_type::move(std::__to_address(__p), __s, __n);
+ traits_type::assign(__p[__n], value_type());
+ if (__old_size > __n)
+ __annotate_shrink(__old_size);
+ return *this;
+ }
- _LIBCPP_NORETURN _LIBCPP_HIDE_FROM_ABI
- void __throw_out_of_range() const {
- std::__throw_out_of_range("basic_string");
- }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string&
+ __null_terminate_at(value_type* __p, size_type __newsz) {
+ size_type __old_size = size();
+ if (__newsz > __old_size)
+ __annotate_increase(__newsz - __old_size);
+ __set_size(__newsz);
+ traits_type::assign(__p[__newsz], value_type());
+ if (__old_size > __newsz)
+ __annotate_shrink(__old_size);
+ return *this;
+ }
+
+ template <class _Tp>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool __addr_in_range(const _Tp& __v) const {
+ return std::__is_pointer_in_range(data(), data() + size() + 1, std::addressof(__v));
+ }
- friend _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string operator+<>(const basic_string&, const basic_string&);
- friend _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string operator+<>(const value_type*, const basic_string&);
- friend _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string operator+<>(value_type, const basic_string&);
- friend _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string operator+<>(const basic_string&, const value_type*);
- friend _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string operator+<>(const basic_string&, value_type);
+ _LIBCPP_NORETURN _LIBCPP_HIDE_FROM_ABI void __throw_length_error() const {
+ std::__throw_length_error("basic_string");
+ }
+
+ _LIBCPP_NORETURN _LIBCPP_HIDE_FROM_ABI void __throw_out_of_range() const {
+ std::__throw_out_of_range("basic_string");
+ }
+
+ friend _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string operator+ <>(const basic_string&, const basic_string&);
+ friend _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string operator+ <>(const value_type*, const basic_string&);
+ friend _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string operator+ <>(value_type, const basic_string&);
+ friend _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string operator+ <>(const basic_string&, const value_type*);
+ friend _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string operator+ <>(const basic_string&, value_type);
};
// These declarations must appear before any functions are implicitly used
// so that they have the correct visibility specifier.
#define _LIBCPP_DECLARE(...) extern template __VA_ARGS__;
#ifdef _LIBCPP_ABI_STRING_OPTIMIZED_EXTERNAL_INSTANTIATION
- _LIBCPP_STRING_UNSTABLE_EXTERN_TEMPLATE_LIST(_LIBCPP_DECLARE, char)
-# ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
- _LIBCPP_STRING_UNSTABLE_EXTERN_TEMPLATE_LIST(_LIBCPP_DECLARE, wchar_t)
-# endif
+_LIBCPP_STRING_UNSTABLE_EXTERN_TEMPLATE_LIST(_LIBCPP_DECLARE, char)
+# ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+_LIBCPP_STRING_UNSTABLE_EXTERN_TEMPLATE_LIST(_LIBCPP_DECLARE, wchar_t)
+# endif
#else
- _LIBCPP_STRING_V1_EXTERN_TEMPLATE_LIST(_LIBCPP_DECLARE, char)
-# ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
- _LIBCPP_STRING_V1_EXTERN_TEMPLATE_LIST(_LIBCPP_DECLARE, wchar_t)
-# endif
+_LIBCPP_STRING_V1_EXTERN_TEMPLATE_LIST(_LIBCPP_DECLARE, char)
+# ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+_LIBCPP_STRING_V1_EXTERN_TEMPLATE_LIST(_LIBCPP_DECLARE, wchar_t)
+# endif
#endif
#undef _LIBCPP_DECLARE
-
#if _LIBCPP_STD_VER >= 17
-template<class _InputIterator,
- class _CharT = __iter_value_type<_InputIterator>,
- class _Allocator = allocator<_CharT>,
- class = enable_if_t<__has_input_iterator_category<_InputIterator>::value>,
- class = enable_if_t<__is_allocator<_Allocator>::value>
- >
+template <class _InputIterator,
+ class _CharT = __iter_value_type<_InputIterator>,
+ class _Allocator = allocator<_CharT>,
+ class = enable_if_t<__has_input_iterator_category<_InputIterator>::value>,
+ class = enable_if_t<__is_allocator<_Allocator>::value> >
basic_string(_InputIterator, _InputIterator, _Allocator = _Allocator())
- -> basic_string<_CharT, char_traits<_CharT>, _Allocator>;
+ -> basic_string<_CharT, char_traits<_CharT>, _Allocator>;
-template<class _CharT,
- class _Traits,
- class _Allocator = allocator<_CharT>,
- class = enable_if_t<__is_allocator<_Allocator>::value>
- >
+template <class _CharT,
+ class _Traits,
+ class _Allocator = allocator<_CharT>,
+ class = enable_if_t<__is_allocator<_Allocator>::value> >
explicit basic_string(basic_string_view<_CharT, _Traits>, const _Allocator& = _Allocator())
- -> basic_string<_CharT, _Traits, _Allocator>;
-
-template<class _CharT,
- class _Traits,
- class _Allocator = allocator<_CharT>,
- class = enable_if_t<__is_allocator<_Allocator>::value>,
- class _Sz = typename allocator_traits<_Allocator>::size_type
- >
+ -> basic_string<_CharT, _Traits, _Allocator>;
+
+template <class _CharT,
+ class _Traits,
+ class _Allocator = allocator<_CharT>,
+ class = enable_if_t<__is_allocator<_Allocator>::value>,
+ class _Sz = typename allocator_traits<_Allocator>::size_type >
basic_string(basic_string_view<_CharT, _Traits>, _Sz, _Sz, const _Allocator& = _Allocator())
- -> basic_string<_CharT, _Traits, _Allocator>;
+ -> basic_string<_CharT, _Traits, _Allocator>;
#endif
#if _LIBCPP_STD_VER >= 23
template <ranges::input_range _Range,
class _Allocator = allocator<ranges::range_value_t<_Range>>,
- class = enable_if_t<__is_allocator<_Allocator>::value>
- >
+ class = enable_if_t<__is_allocator<_Allocator>::value> >
basic_string(from_range_t, _Range&&, _Allocator = _Allocator())
- -> basic_string<ranges::range_value_t<_Range>, char_traits<ranges::range_value_t<_Range>>, _Allocator>;
+ -> basic_string<ranges::range_value_t<_Range>, char_traits<ranges::range_value_t<_Range>>, _Allocator>;
#endif
template <class _CharT, class _Traits, class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-void basic_string<_CharT, _Traits, _Allocator>::__init(const value_type* __s,
- size_type __sz,
- size_type __reserve)
-{
- if (__libcpp_is_constant_evaluated())
- __r_.first() = __rep();
- if (__reserve > max_size())
- __throw_length_error();
- pointer __p;
- if (__fits_in_sso(__reserve))
- {
- __set_short_size(__sz);
- __p = __get_short_pointer();
- }
- else
- {
- auto __allocation = std::__allocate_at_least(__alloc(), __recommend(__reserve) + 1);
- __p = __allocation.ptr;
- __begin_lifetime(__p, __allocation.count);
- __set_long_pointer(__p);
- __set_long_cap(__allocation.count);
- __set_long_size(__sz);
- }
- traits_type::copy(std::__to_address(__p), __s, __sz);
- traits_type::assign(__p[__sz], value_type());
- __annotate_new(__sz);
+_LIBCPP_CONSTEXPR_SINCE_CXX20 void
+basic_string<_CharT, _Traits, _Allocator>::__init(const value_type* __s, size_type __sz, size_type __reserve) {
+ if (__libcpp_is_constant_evaluated())
+ __r_.first() = __rep();
+ if (__reserve > max_size())
+ __throw_length_error();
+ pointer __p;
+ if (__fits_in_sso(__reserve)) {
+ __set_short_size(__sz);
+ __p = __get_short_pointer();
+ } else {
+ auto __allocation = std::__allocate_at_least(__alloc(), __recommend(__reserve) + 1);
+ __p = __allocation.ptr;
+ __begin_lifetime(__p, __allocation.count);
+ __set_long_pointer(__p);
+ __set_long_cap(__allocation.count);
+ __set_long_size(__sz);
+ }
+ traits_type::copy(std::__to_address(__p), __s, __sz);
+ traits_type::assign(__p[__sz], value_type());
+ __annotate_new(__sz);
}
template <class _CharT, class _Traits, class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-void
-basic_string<_CharT, _Traits, _Allocator>::__init(const value_type* __s, size_type __sz)
-{
- if (__libcpp_is_constant_evaluated())
- __r_.first() = __rep();
- if (__sz > max_size())
- __throw_length_error();
- pointer __p;
- if (__fits_in_sso(__sz))
- {
- __set_short_size(__sz);
- __p = __get_short_pointer();
- }
- else
- {
- auto __allocation = std::__allocate_at_least(__alloc(), __recommend(__sz) + 1);
- __p = __allocation.ptr;
- __begin_lifetime(__p, __allocation.count);
- __set_long_pointer(__p);
- __set_long_cap(__allocation.count);
- __set_long_size(__sz);
- }
- traits_type::copy(std::__to_address(__p), __s, __sz);
- traits_type::assign(__p[__sz], value_type());
- __annotate_new(__sz);
+_LIBCPP_CONSTEXPR_SINCE_CXX20 void
+basic_string<_CharT, _Traits, _Allocator>::__init(const value_type* __s, size_type __sz) {
+ if (__libcpp_is_constant_evaluated())
+ __r_.first() = __rep();
+ if (__sz > max_size())
+ __throw_length_error();
+ pointer __p;
+ if (__fits_in_sso(__sz)) {
+ __set_short_size(__sz);
+ __p = __get_short_pointer();
+ } else {
+ auto __allocation = std::__allocate_at_least(__alloc(), __recommend(__sz) + 1);
+ __p = __allocation.ptr;
+ __begin_lifetime(__p, __allocation.count);
+ __set_long_pointer(__p);
+ __set_long_cap(__allocation.count);
+ __set_long_size(__sz);
+ }
+ traits_type::copy(std::__to_address(__p), __s, __sz);
+ traits_type::assign(__p[__sz], value_type());
+ __annotate_new(__sz);
}
template <class _CharT, class _Traits, class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_NOINLINE
-void basic_string<_CharT, _Traits, _Allocator>::__init_copy_ctor_external(
- const value_type* __s, size_type __sz) {
+_LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_NOINLINE void
+basic_string<_CharT, _Traits, _Allocator>::__init_copy_ctor_external(const value_type* __s, size_type __sz) {
if (__libcpp_is_constant_evaluated())
__r_.first() = __rep();
@@ -2288,7 +2241,7 @@ void basic_string<_CharT, _Traits, _Allocator>::__init_copy_ctor_external(
if (__sz > max_size())
__throw_length_error();
auto __allocation = std::__allocate_at_least(__alloc(), __recommend(__sz) + 1);
- __p = __allocation.ptr;
+ __p = __allocation.ptr;
__begin_lifetime(__p, __allocation.count);
__set_long_pointer(__p);
__set_long_cap(__allocation.count);
@@ -2299,197 +2252,178 @@ void basic_string<_CharT, _Traits, _Allocator>::__init_copy_ctor_external(
}
template <class _CharT, class _Traits, class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-void
-basic_string<_CharT, _Traits, _Allocator>::__init(size_type __n, value_type __c)
-{
- if (__libcpp_is_constant_evaluated())
- __r_.first() = __rep();
+_LIBCPP_CONSTEXPR_SINCE_CXX20 void basic_string<_CharT, _Traits, _Allocator>::__init(size_type __n, value_type __c) {
+ if (__libcpp_is_constant_evaluated())
+ __r_.first() = __rep();
- if (__n > max_size())
- __throw_length_error();
- pointer __p;
- if (__fits_in_sso(__n))
- {
- __set_short_size(__n);
- __p = __get_short_pointer();
- }
- else
- {
- auto __allocation = std::__allocate_at_least(__alloc(), __recommend(__n) + 1);
- __p = __allocation.ptr;
- __begin_lifetime(__p, __allocation.count);
- __set_long_pointer(__p);
- __set_long_cap(__allocation.count);
- __set_long_size(__n);
- }
- traits_type::assign(std::__to_address(__p), __n, __c);
- traits_type::assign(__p[__n], value_type());
- __annotate_new(__n);
+ if (__n > max_size())
+ __throw_length_error();
+ pointer __p;
+ if (__fits_in_sso(__n)) {
+ __set_short_size(__n);
+ __p = __get_short_pointer();
+ } else {
+ auto __allocation = std::__allocate_at_least(__alloc(), __recommend(__n) + 1);
+ __p = __allocation.ptr;
+ __begin_lifetime(__p, __allocation.count);
+ __set_long_pointer(__p);
+ __set_long_cap(__allocation.count);
+ __set_long_size(__n);
+ }
+ traits_type::assign(std::__to_address(__p), __n, __c);
+ traits_type::assign(__p[__n], value_type());
+ __annotate_new(__n);
}
template <class _CharT, class _Traits, class _Allocator>
template <class _InputIterator, __enable_if_t<__has_exactly_input_iterator_category<_InputIterator>::value, int> >
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-void basic_string<_CharT, _Traits, _Allocator>::__init(_InputIterator __first, _InputIterator __last)
-{
+_LIBCPP_CONSTEXPR_SINCE_CXX20 void
+basic_string<_CharT, _Traits, _Allocator>::__init(_InputIterator __first, _InputIterator __last) {
__init_with_sentinel(std::move(__first), std::move(__last));
}
template <class _CharT, class _Traits, class _Allocator>
template <class _InputIterator, class _Sentinel>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-void basic_string<_CharT, _Traits, _Allocator>::__init_with_sentinel(_InputIterator __first, _Sentinel __last) {
- __r_.first() = __rep();
- __annotate_new(0);
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void
+basic_string<_CharT, _Traits, _Allocator>::__init_with_sentinel(_InputIterator __first, _Sentinel __last) {
+ __r_.first() = __rep();
+ __annotate_new(0);
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- try
- {
+ try {
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
for (; __first != __last; ++__first)
- push_back(*__first);
+ push_back(*__first);
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- }
- catch (...)
- {
- __annotate_delete();
- if (__is_long())
- __alloc_traits::deallocate(__alloc(), __get_long_pointer(), __get_long_cap());
- throw;
- }
+ } catch (...) {
+ __annotate_delete();
+ if (__is_long())
+ __alloc_traits::deallocate(__alloc(), __get_long_pointer(), __get_long_cap());
+ throw;
+ }
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
}
template <class _CharT, class _Traits, class _Allocator>
template <class _ForwardIterator, __enable_if_t<__has_forward_iterator_category<_ForwardIterator>::value, int> >
_LIBCPP_CONSTEXPR_SINCE_CXX20 void
-basic_string<_CharT, _Traits, _Allocator>::__init(_ForwardIterator __first, _ForwardIterator __last)
-{
+basic_string<_CharT, _Traits, _Allocator>::__init(_ForwardIterator __first, _ForwardIterator __last) {
size_type __sz = static_cast<size_type>(std::distance(__first, __last));
__init_with_size(__first, __last, __sz);
}
template <class _CharT, class _Traits, class _Allocator>
template <class _InputIterator, class _Sentinel>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-void basic_string<_CharT, _Traits, _Allocator>::__init_with_size(
- _InputIterator __first, _Sentinel __last, size_type __sz) {
- if (__libcpp_is_constant_evaluated())
- __r_.first() = __rep();
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void
+basic_string<_CharT, _Traits, _Allocator>::__init_with_size(_InputIterator __first, _Sentinel __last, size_type __sz) {
+ if (__libcpp_is_constant_evaluated())
+ __r_.first() = __rep();
- if (__sz > max_size())
- __throw_length_error();
+ if (__sz > max_size())
+ __throw_length_error();
- pointer __p;
- if (__fits_in_sso(__sz))
- {
- __set_short_size(__sz);
- __p = __get_short_pointer();
+ pointer __p;
+ if (__fits_in_sso(__sz)) {
+ __set_short_size(__sz);
+ __p = __get_short_pointer();
- }
- else
- {
- auto __allocation = std::__allocate_at_least(__alloc(), __recommend(__sz) + 1);
- __p = __allocation.ptr;
- __begin_lifetime(__p, __allocation.count);
- __set_long_pointer(__p);
- __set_long_cap(__allocation.count);
- __set_long_size(__sz);
- }
+ } else {
+ auto __allocation = std::__allocate_at_least(__alloc(), __recommend(__sz) + 1);
+ __p = __allocation.ptr;
+ __begin_lifetime(__p, __allocation.count);
+ __set_long_pointer(__p);
+ __set_long_cap(__allocation.count);
+ __set_long_size(__sz);
+ }
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- try
- {
-#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- for (; __first != __last; ++__first, (void) ++__p)
- traits_type::assign(*__p, *__first);
+ try {
+#endif // _LIBCPP_HAS_NO_EXCEPTIONS
+ for (; __first != __last; ++__first, (void)++__p)
+ traits_type::assign(*__p, *__first);
traits_type::assign(*__p, value_type());
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- }
- catch (...)
- {
- if (__is_long())
- __alloc_traits::deallocate(__alloc(), __get_long_pointer(), __get_long_cap());
- throw;
- }
-#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- __annotate_new(__sz);
+ } catch (...) {
+ if (__is_long())
+ __alloc_traits::deallocate(__alloc(), __get_long_pointer(), __get_long_cap());
+ throw;
+ }
+#endif // _LIBCPP_HAS_NO_EXCEPTIONS
+ __annotate_new(__sz);
}
template <class _CharT, class _Traits, class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-void
-basic_string<_CharT, _Traits, _Allocator>::__grow_by_and_replace
- (size_type __old_cap, size_type __delta_cap, size_type __old_sz,
- size_type __n_copy, size_type __n_del, size_type __n_add, const value_type* __p_new_stuff)
-{
- size_type __ms = max_size();
- if (__delta_cap > __ms - __old_cap - 1)
- __throw_length_error();
- pointer __old_p = __get_pointer();
- size_type __cap = __old_cap < __ms / 2 - __alignment ?
- __recommend(std::max(__old_cap + __delta_cap, 2 * __old_cap)) :
- __ms - 1;
- __annotate_delete();
- auto __allocation = std::__allocate_at_least(__alloc(), __cap + 1);
- pointer __p = __allocation.ptr;
- __begin_lifetime(__p, __allocation.count);
- if (__n_copy != 0)
- traits_type::copy(std::__to_address(__p),
- std::__to_address(__old_p), __n_copy);
- if (__n_add != 0)
- traits_type::copy(std::__to_address(__p) + __n_copy, __p_new_stuff, __n_add);
- size_type __sec_cp_sz = __old_sz - __n_del - __n_copy;
- if (__sec_cp_sz != 0)
- traits_type::copy(std::__to_address(__p) + __n_copy + __n_add,
- std::__to_address(__old_p) + __n_copy + __n_del, __sec_cp_sz);
- if (__old_cap+1 != __min_cap)
- __alloc_traits::deallocate(__alloc(), __old_p, __old_cap+1);
- __set_long_pointer(__p);
- __set_long_cap(__allocation.count);
- __old_sz = __n_copy + __n_add + __sec_cp_sz;
- __set_long_size(__old_sz);
- traits_type::assign(__p[__old_sz], value_type());
- __annotate_new(__old_cap + __delta_cap);
+_LIBCPP_CONSTEXPR_SINCE_CXX20 void basic_string<_CharT, _Traits, _Allocator>::__grow_by_and_replace(
+ size_type __old_cap,
+ size_type __delta_cap,
+ size_type __old_sz,
+ size_type __n_copy,
+ size_type __n_del,
+ size_type __n_add,
+ const value_type* __p_new_stuff) {
+ size_type __ms = max_size();
+ if (__delta_cap > __ms - __old_cap - 1)
+ __throw_length_error();
+ pointer __old_p = __get_pointer();
+ size_type __cap =
+ __old_cap < __ms / 2 - __alignment ? __recommend(std::max(__old_cap + __delta_cap, 2 * __old_cap)) : __ms - 1;
+ __annotate_delete();
+ auto __allocation = std::__allocate_at_least(__alloc(), __cap + 1);
+ pointer __p = __allocation.ptr;
+ __begin_lifetime(__p, __allocation.count);
+ if (__n_copy != 0)
+ traits_type::copy(std::__to_address(__p), std::__to_address(__old_p), __n_copy);
+ if (__n_add != 0)
+ traits_type::copy(std::__to_address(__p) + __n_copy, __p_new_stuff, __n_add);
+ size_type __sec_cp_sz = __old_sz - __n_del - __n_copy;
+ if (__sec_cp_sz != 0)
+ traits_type::copy(
+ std::__to_address(__p) + __n_copy + __n_add, std::__to_address(__old_p) + __n_copy + __n_del, __sec_cp_sz);
+ if (__old_cap + 1 != __min_cap)
+ __alloc_traits::deallocate(__alloc(), __old_p, __old_cap + 1);
+ __set_long_pointer(__p);
+ __set_long_cap(__allocation.count);
+ __old_sz = __n_copy + __n_add + __sec_cp_sz;
+ __set_long_size(__old_sz);
+ traits_type::assign(__p[__old_sz], value_type());
+ __annotate_new(__old_cap + __delta_cap);
}
// __grow_by is deprecated because it does not set the size. It may not update the size when the size is changed, and it
// may also not set the size at all when the string was short initially. This leads to unpredictable size value. It is
// not removed or changed to avoid breaking the ABI.
template <class _CharT, class _Traits, class _Allocator>
-void
-_LIBCPP_CONSTEXPR_SINCE_CXX20
+void _LIBCPP_CONSTEXPR_SINCE_CXX20
#if _LIBCPP_ABI_VERSION >= 2 // We want to use the function in the dylib in ABIv1
_LIBCPP_HIDE_FROM_ABI
#endif
- _LIBCPP_DEPRECATED_("use __grow_by_without_replace")
-basic_string<_CharT, _Traits, _Allocator>::__grow_by(size_type __old_cap, size_type __delta_cap, size_type __old_sz,
- size_type __n_copy, size_type __n_del, size_type __n_add)
-{
- size_type __ms = max_size();
- if (__delta_cap > __ms - __old_cap)
- __throw_length_error();
- pointer __old_p = __get_pointer();
- size_type __cap = __old_cap < __ms / 2 - __alignment ?
- __recommend(std::max(__old_cap + __delta_cap, 2 * __old_cap)) :
- __ms - 1;
- __annotate_delete();
- auto __allocation = std::__allocate_at_least(__alloc(), __cap + 1);
- pointer __p = __allocation.ptr;
- __begin_lifetime(__p, __allocation.count);
- if (__n_copy != 0)
- traits_type::copy(std::__to_address(__p),
- std::__to_address(__old_p), __n_copy);
- size_type __sec_cp_sz = __old_sz - __n_del - __n_copy;
- if (__sec_cp_sz != 0)
- traits_type::copy(std::__to_address(__p) + __n_copy + __n_add,
- std::__to_address(__old_p) + __n_copy + __n_del,
- __sec_cp_sz);
- if (__old_cap + 1 != __min_cap)
- __alloc_traits::deallocate(__alloc(), __old_p, __old_cap + 1);
- __set_long_pointer(__p);
- __set_long_cap(__allocation.count);
+ _LIBCPP_DEPRECATED_("use __grow_by_without_replace") basic_string<_CharT, _Traits, _Allocator>::__grow_by(
+ size_type __old_cap,
+ size_type __delta_cap,
+ size_type __old_sz,
+ size_type __n_copy,
+ size_type __n_del,
+ size_type __n_add) {
+ size_type __ms = max_size();
+ if (__delta_cap > __ms - __old_cap)
+ __throw_length_error();
+ pointer __old_p = __get_pointer();
+ size_type __cap =
+ __old_cap < __ms / 2 - __alignment ? __recommend(std::max(__old_cap + __delta_cap, 2 * __old_cap)) : __ms - 1;
+ __annotate_delete();
+ auto __allocation = std::__allocate_at_least(__alloc(), __cap + 1);
+ pointer __p = __allocation.ptr;
+ __begin_lifetime(__p, __allocation.count);
+ if (__n_copy != 0)
+ traits_type::copy(std::__to_address(__p), std::__to_address(__old_p), __n_copy);
+ size_type __sec_cp_sz = __old_sz - __n_del - __n_copy;
+ if (__sec_cp_sz != 0)
+ traits_type::copy(
+ std::__to_address(__p) + __n_copy + __n_add, std::__to_address(__old_p) + __n_copy + __n_del, __sec_cp_sz);
+ if (__old_cap + 1 != __min_cap)
+ __alloc_traits::deallocate(__alloc(), __old_p, __old_cap + 1);
+ __set_long_pointer(__p);
+ __set_long_cap(__allocation.count);
}
template <class _CharT, class _Traits, class _Allocator>
@@ -2501,21 +2435,19 @@ basic_string<_CharT, _Traits, _Allocator>::__grow_by_without_replace(
size_type __n_copy,
size_type __n_del,
size_type __n_add) {
- _LIBCPP_SUPPRESS_DEPRECATED_PUSH
- __grow_by(__old_cap, __delta_cap, __old_sz, __n_copy, __n_del, __n_add);
- _LIBCPP_SUPPRESS_DEPRECATED_POP
- __set_long_size(__old_sz - __n_del + __n_add);
- __annotate_new(__old_sz - __n_del + __n_add);
+ _LIBCPP_SUPPRESS_DEPRECATED_PUSH
+ __grow_by(__old_cap, __delta_cap, __old_sz, __n_copy, __n_del, __n_add);
+ _LIBCPP_SUPPRESS_DEPRECATED_POP
+ __set_long_size(__old_sz - __n_del + __n_add);
+ __annotate_new(__old_sz - __n_del + __n_add);
}
// assign
template <class _CharT, class _Traits, class _Allocator>
template <bool __is_short>
-_LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_NOINLINE
-basic_string<_CharT, _Traits, _Allocator>&
-basic_string<_CharT, _Traits, _Allocator>::__assign_no_alias(
- const value_type* __s, size_type __n) {
+_LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_NOINLINE basic_string<_CharT, _Traits, _Allocator>&
+basic_string<_CharT, _Traits, _Allocator>::__assign_no_alias(const value_type* __s, size_type __n) {
size_type __cap = __is_short ? static_cast<size_type>(__min_cap) : __get_long_cap();
if (__n < __cap) {
size_type __old_size = __is_short ? __get_short_size() : __get_long_size();
@@ -2535,10 +2467,8 @@ basic_string<_CharT, _Traits, _Allocator>::__assign_no_alias(
}
template <class _CharT, class _Traits, class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_NOINLINE
-basic_string<_CharT, _Traits, _Allocator>&
-basic_string<_CharT, _Traits, _Allocator>::__assign_external(
- const value_type* __s, size_type __n) {
+_LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_NOINLINE basic_string<_CharT, _Traits, _Allocator>&
+basic_string<_CharT, _Traits, _Allocator>::__assign_external(const value_type* __s, size_type __n) {
size_type __cap = capacity();
if (__cap >= __n) {
size_type __old_size = size();
@@ -2555,41 +2485,31 @@ basic_string<_CharT, _Traits, _Allocator>::__assign_external(
}
template <class _CharT, class _Traits, class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-basic_string<_CharT, _Traits, _Allocator>&
-basic_string<_CharT, _Traits, _Allocator>::assign(const value_type* __s, size_type __n)
-{
- _LIBCPP_ASSERT_NON_NULL(__n == 0 || __s != nullptr, "string::assign received nullptr");
- return (__builtin_constant_p(__n) && __fits_in_sso(__n))
- ? __assign_short(__s, __n)
- : __assign_external(__s, __n);
+_LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string<_CharT, _Traits, _Allocator>&
+basic_string<_CharT, _Traits, _Allocator>::assign(const value_type* __s, size_type __n) {
+ _LIBCPP_ASSERT_NON_NULL(__n == 0 || __s != nullptr, "string::assign received nullptr");
+ return (__builtin_constant_p(__n) && __fits_in_sso(__n)) ? __assign_short(__s, __n) : __assign_external(__s, __n);
}
template <class _CharT, class _Traits, class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-basic_string<_CharT, _Traits, _Allocator>&
-basic_string<_CharT, _Traits, _Allocator>::assign(size_type __n, value_type __c)
-{
- size_type __cap = capacity();
- size_type __old_size = size();
- if (__cap < __n)
- {
- size_type __sz = size();
- __grow_by_without_replace(__cap, __n - __cap, __sz, 0, __sz);
- __annotate_increase(__n);
- }
- else if(__n > __old_size)
- __annotate_increase(__n - __old_size);
- value_type* __p = std::__to_address(__get_pointer());
- traits_type::assign(__p, __n, __c);
- return __null_terminate_at(__p, __n);
+_LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string<_CharT, _Traits, _Allocator>&
+basic_string<_CharT, _Traits, _Allocator>::assign(size_type __n, value_type __c) {
+ size_type __cap = capacity();
+ size_type __old_size = size();
+ if (__cap < __n) {
+ size_type __sz = size();
+ __grow_by_without_replace(__cap, __n - __cap, __sz, 0, __sz);
+ __annotate_increase(__n);
+ } else if (__n > __old_size)
+ __annotate_increase(__n - __old_size);
+ value_type* __p = std::__to_address(__get_pointer());
+ traits_type::assign(__p, __n, __c);
+ return __null_terminate_at(__p, __n);
}
template <class _CharT, class _Traits, class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-basic_string<_CharT, _Traits, _Allocator>&
-basic_string<_CharT, _Traits, _Allocator>::operator=(value_type __c)
-{
+_LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string<_CharT, _Traits, _Allocator>&
+basic_string<_CharT, _Traits, _Allocator>::operator=(value_type __c) {
pointer __p;
size_type __old_size = size();
if (__old_size == 0)
@@ -2609,10 +2529,8 @@ basic_string<_CharT, _Traits, _Allocator>::operator=(value_type __c)
}
template <class _CharT, class _Traits, class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_STRING_INTERNAL_MEMORY_ACCESS
-basic_string<_CharT, _Traits, _Allocator>&
-basic_string<_CharT, _Traits, _Allocator>::operator=(const basic_string& __str)
-{
+_LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_STRING_INTERNAL_MEMORY_ACCESS basic_string<_CharT, _Traits, _Allocator>&
+basic_string<_CharT, _Traits, _Allocator>::operator=(const basic_string& __str) {
if (this != std::addressof(__str)) {
__copy_assign_alloc(__str);
if (!__is_long()) {
@@ -2636,41 +2554,37 @@ basic_string<_CharT, _Traits, _Allocator>::operator=(const basic_string& __str)
#ifndef _LIBCPP_CXX03_LANG
template <class _CharT, class _Traits, class _Allocator>
-inline _LIBCPP_CONSTEXPR_SINCE_CXX20
-void
+inline _LIBCPP_CONSTEXPR_SINCE_CXX20 void
basic_string<_CharT, _Traits, _Allocator>::__move_assign(basic_string& __str, false_type)
- _NOEXCEPT_(__alloc_traits::is_always_equal::value)
-{
- if (__alloc() != __str.__alloc())
- assign(__str);
- else
- __move_assign(__str, true_type());
+ _NOEXCEPT_(__alloc_traits::is_always_equal::value) {
+ if (__alloc() != __str.__alloc())
+ assign(__str);
+ else
+ __move_assign(__str, true_type());
}
template <class _CharT, class _Traits, class _Allocator>
-inline _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_STRING_INTERNAL_MEMORY_ACCESS
-void
+inline _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_STRING_INTERNAL_MEMORY_ACCESS void
basic_string<_CharT, _Traits, _Allocator>::__move_assign(basic_string& __str, true_type)
-#if _LIBCPP_STD_VER >= 17
+# if _LIBCPP_STD_VER >= 17
_NOEXCEPT
-#else
+# else
_NOEXCEPT_(is_nothrow_move_assignable<allocator_type>::value)
-#endif
+# endif
{
__annotate_delete();
if (__is_long()) {
- __alloc_traits::deallocate(__alloc(), __get_long_pointer(),
- __get_long_cap());
-#if _LIBCPP_STD_VER <= 14
+ __alloc_traits::deallocate(__alloc(), __get_long_pointer(), __get_long_cap());
+# if _LIBCPP_STD_VER <= 14
if (!is_nothrow_move_assignable<allocator_type>::value) {
__set_short_size(0);
traits_type::assign(__get_short_pointer()[0], value_type());
__annotate_new(0);
}
-#endif
+# endif
}
size_type __str_old_size = __str.size();
- bool __str_was_short = !__str.__is_long();
+ bool __str_was_short = !__str.__is_long();
__move_assign_alloc(__str);
__r_.first() = __str.__r_.first();
@@ -2699,28 +2613,25 @@ basic_string<_CharT, _Traits, _Allocator>::__move_assign(basic_string& __str, tr
#endif
template <class _CharT, class _Traits, class _Allocator>
-template<class _InputIterator, __enable_if_t<__has_exactly_input_iterator_category<_InputIterator>::value, int> >
+template <class _InputIterator, __enable_if_t<__has_exactly_input_iterator_category<_InputIterator>::value, int> >
_LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string<_CharT, _Traits, _Allocator>&
-basic_string<_CharT, _Traits, _Allocator>::assign(_InputIterator __first, _InputIterator __last)
-{
+basic_string<_CharT, _Traits, _Allocator>::assign(_InputIterator __first, _InputIterator __last) {
__assign_with_sentinel(__first, __last);
return *this;
}
template <class _CharT, class _Traits, class _Allocator>
template <class _InputIterator, class _Sentinel>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-void
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void
basic_string<_CharT, _Traits, _Allocator>::__assign_with_sentinel(_InputIterator __first, _Sentinel __last) {
const basic_string __temp(__init_with_sentinel_tag(), std::move(__first), std::move(__last), __alloc());
assign(__temp.data(), __temp.size());
}
template <class _CharT, class _Traits, class _Allocator>
-template<class _ForwardIterator, __enable_if_t<__has_forward_iterator_category<_ForwardIterator>::value, int> >
+template <class _ForwardIterator, __enable_if_t<__has_forward_iterator_category<_ForwardIterator>::value, int> >
_LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string<_CharT, _Traits, _Allocator>&
-basic_string<_CharT, _Traits, _Allocator>::assign(_ForwardIterator __first, _ForwardIterator __last)
-{
+basic_string<_CharT, _Traits, _Allocator>::assign(_ForwardIterator __first, _ForwardIterator __last) {
if (__string_is_trivial_iterator<_ForwardIterator>::value) {
size_type __n = static_cast<size_type>(std::distance(__first, __last));
__assign_trivial(__first, __last, __n);
@@ -2733,14 +2644,13 @@ basic_string<_CharT, _Traits, _Allocator>::assign(_ForwardIterator __first, _For
template <class _CharT, class _Traits, class _Allocator>
template <class _Iterator, class _Sentinel>
-_LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI
-void
+_LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void
basic_string<_CharT, _Traits, _Allocator>::__assign_trivial(_Iterator __first, _Sentinel __last, size_type __n) {
_LIBCPP_ASSERT_INTERNAL(
__string_is_trivial_iterator<_Iterator>::value, "The iterator type given to `__assign_trivial` must be trivial");
size_type __old_size = size();
- size_type __cap = capacity();
+ size_type __cap = capacity();
if (__cap < __n) {
// Unlike `append` functions, if the input range points into the string itself, there is no case that the input
// range could get invalidated by reallocation:
@@ -2751,27 +2661,24 @@ basic_string<_CharT, _Traits, _Allocator>::__assign_trivial(_Iterator __first, _
size_type __sz = size();
__grow_by_without_replace(__cap, __n - __cap, __sz, 0, __sz);
__annotate_increase(__n);
- }
- else if (__n > __old_size)
- __annotate_increase(__n - __old_size);
- pointer __p = __get_pointer();
- for (; __first != __last; ++__p, (void) ++__first)
- traits_type::assign(*__p, *__first);
- traits_type::assign(*__p, value_type());
- __set_size(__n);
- if (__n < __old_size)
- __annotate_shrink(__old_size);
+ } else if (__n > __old_size)
+ __annotate_increase(__n - __old_size);
+ pointer __p = __get_pointer();
+ for (; __first != __last; ++__p, (void)++__first)
+ traits_type::assign(*__p, *__first);
+ traits_type::assign(*__p, value_type());
+ __set_size(__n);
+ if (__n < __old_size)
+ __annotate_shrink(__old_size);
}
template <class _CharT, class _Traits, class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-basic_string<_CharT, _Traits, _Allocator>&
-basic_string<_CharT, _Traits, _Allocator>::assign(const basic_string& __str, size_type __pos, size_type __n)
-{
- size_type __sz = __str.size();
- if (__pos > __sz)
- __throw_out_of_range();
- return assign(__str.data() + __pos, std::min(__n, __sz - __pos));
+_LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string<_CharT, _Traits, _Allocator>&
+basic_string<_CharT, _Traits, _Allocator>::assign(const basic_string& __str, size_type __pos, size_type __n) {
+ size_type __sz = __str.size();
+ if (__pos > __sz)
+ __throw_out_of_range();
+ return assign(__str.data() + __pos, std::min(__n, __sz - __pos));
}
template <class _CharT, class _Traits, class _Allocator>
@@ -2781,179 +2688,146 @@ template <class _Tp,
int> >
_LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string<_CharT, _Traits, _Allocator>&
basic_string<_CharT, _Traits, _Allocator>::assign(const _Tp& __t, size_type __pos, size_type __n) {
- __self_view __sv = __t;
- size_type __sz = __sv.size();
- if (__pos > __sz)
- __throw_out_of_range();
- return assign(__sv.data() + __pos, std::min(__n, __sz - __pos));
+ __self_view __sv = __t;
+ size_type __sz = __sv.size();
+ if (__pos > __sz)
+ __throw_out_of_range();
+ return assign(__sv.data() + __pos, std::min(__n, __sz - __pos));
}
template <class _CharT, class _Traits, class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_NOINLINE
-basic_string<_CharT, _Traits, _Allocator>&
+_LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_NOINLINE basic_string<_CharT, _Traits, _Allocator>&
basic_string<_CharT, _Traits, _Allocator>::__assign_external(const value_type* __s) {
return __assign_external(__s, traits_type::length(__s));
}
template <class _CharT, class _Traits, class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-basic_string<_CharT, _Traits, _Allocator>&
-basic_string<_CharT, _Traits, _Allocator>::assign(const value_type* __s)
-{
- _LIBCPP_ASSERT_NON_NULL(__s != nullptr, "string::assign received nullptr");
- return __builtin_constant_p(*__s)
- ? (__fits_in_sso(traits_type::length(__s))
- ? __assign_short(__s, traits_type::length(__s))
- : __assign_external(__s, traits_type::length(__s)))
- : __assign_external(__s);
+_LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string<_CharT, _Traits, _Allocator>&
+basic_string<_CharT, _Traits, _Allocator>::assign(const value_type* __s) {
+ _LIBCPP_ASSERT_NON_NULL(__s != nullptr, "string::assign received nullptr");
+ return __builtin_constant_p(*__s)
+ ? (__fits_in_sso(traits_type::length(__s)) ? __assign_short(__s, traits_type::length(__s))
+ : __assign_external(__s, traits_type::length(__s)))
+ : __assign_external(__s);
}
// append
template <class _CharT, class _Traits, class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-basic_string<_CharT, _Traits, _Allocator>&
-basic_string<_CharT, _Traits, _Allocator>::append(const value_type* __s, size_type __n)
-{
- _LIBCPP_ASSERT_NON_NULL(__n == 0 || __s != nullptr, "string::append received nullptr");
- size_type __cap = capacity();
- size_type __sz = size();
- if (__cap - __sz >= __n)
- {
- if (__n)
- {
- __annotate_increase(__n);
- value_type* __p = std::__to_address(__get_pointer());
- traits_type::copy(__p + __sz, __s, __n);
- __sz += __n;
- __set_size(__sz);
- traits_type::assign(__p[__sz], value_type());
- }
+_LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string<_CharT, _Traits, _Allocator>&
+basic_string<_CharT, _Traits, _Allocator>::append(const value_type* __s, size_type __n) {
+ _LIBCPP_ASSERT_NON_NULL(__n == 0 || __s != nullptr, "string::append received nullptr");
+ size_type __cap = capacity();
+ size_type __sz = size();
+ if (__cap - __sz >= __n) {
+ if (__n) {
+ __annotate_increase(__n);
+ value_type* __p = std::__to_address(__get_pointer());
+ traits_type::copy(__p + __sz, __s, __n);
+ __sz += __n;
+ __set_size(__sz);
+ traits_type::assign(__p[__sz], value_type());
}
- else
- __grow_by_and_replace(__cap, __sz + __n - __cap, __sz, __sz, 0, __n, __s);
- return *this;
+ } else
+ __grow_by_and_replace(__cap, __sz + __n - __cap, __sz, __sz, 0, __n, __s);
+ return *this;
}
template <class _CharT, class _Traits, class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-basic_string<_CharT, _Traits, _Allocator>&
-basic_string<_CharT, _Traits, _Allocator>::append(size_type __n, value_type __c)
-{
- if (__n)
- {
- size_type __cap = capacity();
- size_type __sz = size();
- if (__cap - __sz < __n)
- __grow_by_without_replace(__cap, __sz + __n - __cap, __sz, __sz, 0);
- __annotate_increase(__n);
- pointer __p = __get_pointer();
- traits_type::assign(std::__to_address(__p) + __sz, __n, __c);
- __sz += __n;
- __set_size(__sz);
- traits_type::assign(__p[__sz], value_type());
- }
- return *this;
+_LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string<_CharT, _Traits, _Allocator>&
+basic_string<_CharT, _Traits, _Allocator>::append(size_type __n, value_type __c) {
+ if (__n) {
+ size_type __cap = capacity();
+ size_type __sz = size();
+ if (__cap - __sz < __n)
+ __grow_by_without_replace(__cap, __sz + __n - __cap, __sz, __sz, 0);
+ __annotate_increase(__n);
+ pointer __p = __get_pointer();
+ traits_type::assign(std::__to_address(__p) + __sz, __n, __c);
+ __sz += __n;
+ __set_size(__sz);
+ traits_type::assign(__p[__sz], value_type());
+ }
+ return *this;
}
template <class _CharT, class _Traits, class _Allocator>
_LIBCPP_CONSTEXPR_SINCE_CXX20 inline void
-basic_string<_CharT, _Traits, _Allocator>::__append_default_init(size_type __n)
-{
- if (__n)
- {
- size_type __cap = capacity();
- size_type __sz = size();
- if (__cap - __sz < __n)
- __grow_by_without_replace(__cap, __sz + __n - __cap, __sz, __sz, 0);
- __annotate_increase(__n);
- pointer __p = __get_pointer();
- __sz += __n;
- __set_size(__sz);
- traits_type::assign(__p[__sz], value_type());
- }
+basic_string<_CharT, _Traits, _Allocator>::__append_default_init(size_type __n) {
+ if (__n) {
+ size_type __cap = capacity();
+ size_type __sz = size();
+ if (__cap - __sz < __n)
+ __grow_by_without_replace(__cap, __sz + __n - __cap, __sz, __sz, 0);
+ __annotate_increase(__n);
+ pointer __p = __get_pointer();
+ __sz += __n;
+ __set_size(__sz);
+ traits_type::assign(__p[__sz], value_type());
+ }
}
template <class _CharT, class _Traits, class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-void
-basic_string<_CharT, _Traits, _Allocator>::push_back(value_type __c)
-{
- bool __is_short = !__is_long();
- size_type __cap;
- size_type __sz;
- if (__is_short)
- {
- __cap = __min_cap - 1;
- __sz = __get_short_size();
- }
- else
- {
- __cap = __get_long_cap() - 1;
- __sz = __get_long_size();
- }
- if (__sz == __cap)
- {
- __grow_by_without_replace(__cap, 1, __sz, __sz, 0);
- __annotate_increase(1);
- __is_short = false; // the string is always long after __grow_by
- } else
- __annotate_increase(1);
- pointer __p = __get_pointer();
- if (__is_short)
- {
- __p = __get_short_pointer() + __sz;
- __set_short_size(__sz+1);
- }
- else
- {
- __p = __get_long_pointer() + __sz;
- __set_long_size(__sz+1);
- }
- traits_type::assign(*__p, __c);
- traits_type::assign(*++__p, value_type());
+_LIBCPP_CONSTEXPR_SINCE_CXX20 void basic_string<_CharT, _Traits, _Allocator>::push_back(value_type __c) {
+ bool __is_short = !__is_long();
+ size_type __cap;
+ size_type __sz;
+ if (__is_short) {
+ __cap = __min_cap - 1;
+ __sz = __get_short_size();
+ } else {
+ __cap = __get_long_cap() - 1;
+ __sz = __get_long_size();
+ }
+ if (__sz == __cap) {
+ __grow_by_without_replace(__cap, 1, __sz, __sz, 0);
+ __annotate_increase(1);
+ __is_short = false; // the string is always long after __grow_by
+ } else
+ __annotate_increase(1);
+ pointer __p = __get_pointer();
+ if (__is_short) {
+ __p = __get_short_pointer() + __sz;
+ __set_short_size(__sz + 1);
+ } else {
+ __p = __get_long_pointer() + __sz;
+ __set_long_size(__sz + 1);
+ }
+ traits_type::assign(*__p, __c);
+ traits_type::assign(*++__p, value_type());
}
template <class _CharT, class _Traits, class _Allocator>
-template<class _ForwardIterator, __enable_if_t<__has_forward_iterator_category<_ForwardIterator>::value, int> >
+template <class _ForwardIterator, __enable_if_t<__has_forward_iterator_category<_ForwardIterator>::value, int> >
_LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string<_CharT, _Traits, _Allocator>&
-basic_string<_CharT, _Traits, _Allocator>::append(
- _ForwardIterator __first, _ForwardIterator __last)
-{
- size_type __sz = size();
- size_type __cap = capacity();
- size_type __n = static_cast<size_type>(std::distance(__first, __last));
- if (__n)
- {
- if (__string_is_trivial_iterator<_ForwardIterator>::value &&
- !__addr_in_range(*__first))
- {
- if (__cap - __sz < __n)
- __grow_by_without_replace(__cap, __sz + __n - __cap, __sz, __sz, 0);
- __annotate_increase(__n);
- pointer __p = __get_pointer() + __sz;
- for (; __first != __last; ++__p, (void) ++__first)
- traits_type::assign(*__p, *__first);
- traits_type::assign(*__p, value_type());
- __set_size(__sz + __n);
- }
- else
- {
- const basic_string __temp(__first, __last, __alloc());
- append(__temp.data(), __temp.size());
- }
+basic_string<_CharT, _Traits, _Allocator>::append(_ForwardIterator __first, _ForwardIterator __last) {
+ size_type __sz = size();
+ size_type __cap = capacity();
+ size_type __n = static_cast<size_type>(std::distance(__first, __last));
+ if (__n) {
+ if (__string_is_trivial_iterator<_ForwardIterator>::value && !__addr_in_range(*__first)) {
+ if (__cap - __sz < __n)
+ __grow_by_without_replace(__cap, __sz + __n - __cap, __sz, __sz, 0);
+ __annotate_increase(__n);
+ pointer __p = __get_pointer() + __sz;
+ for (; __first != __last; ++__p, (void)++__first)
+ traits_type::assign(*__p, *__first);
+ traits_type::assign(*__p, value_type());
+ __set_size(__sz + __n);
+ } else {
+ const basic_string __temp(__first, __last, __alloc());
+ append(__temp.data(), __temp.size());
}
- return *this;
+ }
+ return *this;
}
template <class _CharT, class _Traits, class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-basic_string<_CharT, _Traits, _Allocator>&
-basic_string<_CharT, _Traits, _Allocator>::append(const basic_string& __str, size_type __pos, size_type __n)
-{
- size_type __sz = __str.size();
- if (__pos > __sz)
- __throw_out_of_range();
- return append(__str.data() + __pos, std::min(__n, __sz - __pos));
+_LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string<_CharT, _Traits, _Allocator>&
+basic_string<_CharT, _Traits, _Allocator>::append(const basic_string& __str, size_type __pos, size_type __n) {
+ size_type __sz = __str.size();
+ if (__pos > __sz)
+ __throw_out_of_range();
+ return append(__str.data() + __pos, std::min(__n, __sz - __pos));
}
template <class _CharT, class _Traits, class _Allocator>
@@ -2963,140 +2837,119 @@ template <class _Tp,
int> >
_LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string<_CharT, _Traits, _Allocator>&
basic_string<_CharT, _Traits, _Allocator>::append(const _Tp& __t, size_type __pos, size_type __n) {
- __self_view __sv = __t;
- size_type __sz = __sv.size();
- if (__pos > __sz)
- __throw_out_of_range();
- return append(__sv.data() + __pos, std::min(__n, __sz - __pos));
+ __self_view __sv = __t;
+ size_type __sz = __sv.size();
+ if (__pos > __sz)
+ __throw_out_of_range();
+ return append(__sv.data() + __pos, std::min(__n, __sz - __pos));
}
template <class _CharT, class _Traits, class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-basic_string<_CharT, _Traits, _Allocator>&
-basic_string<_CharT, _Traits, _Allocator>::append(const value_type* __s)
-{
- _LIBCPP_ASSERT_NON_NULL(__s != nullptr, "string::append received nullptr");
- return append(__s, traits_type::length(__s));
+_LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string<_CharT, _Traits, _Allocator>&
+basic_string<_CharT, _Traits, _Allocator>::append(const value_type* __s) {
+ _LIBCPP_ASSERT_NON_NULL(__s != nullptr, "string::append received nullptr");
+ return append(__s, traits_type::length(__s));
}
// insert
template <class _CharT, class _Traits, class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-basic_string<_CharT, _Traits, _Allocator>&
-basic_string<_CharT, _Traits, _Allocator>::insert(size_type __pos, const value_type* __s, size_type __n)
-{
- _LIBCPP_ASSERT_NON_NULL(__n == 0 || __s != nullptr, "string::insert received nullptr");
- size_type __sz = size();
- if (__pos > __sz)
- __throw_out_of_range();
- size_type __cap = capacity();
- if (__cap - __sz >= __n)
- {
- if (__n)
- {
- __annotate_increase(__n);
- value_type* __p = std::__to_address(__get_pointer());
- size_type __n_move = __sz - __pos;
- if (__n_move != 0)
- {
- if (std::__is_pointer_in_range(__p + __pos, __p + __sz, __s))
- __s += __n;
- traits_type::move(__p + __pos + __n, __p + __pos, __n_move);
- }
- traits_type::move(__p + __pos, __s, __n);
- __sz += __n;
- __set_size(__sz);
- traits_type::assign(__p[__sz], value_type());
- }
+_LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string<_CharT, _Traits, _Allocator>&
+basic_string<_CharT, _Traits, _Allocator>::insert(size_type __pos, const value_type* __s, size_type __n) {
+ _LIBCPP_ASSERT_NON_NULL(__n == 0 || __s != nullptr, "string::insert received nullptr");
+ size_type __sz = size();
+ if (__pos > __sz)
+ __throw_out_of_range();
+ size_type __cap = capacity();
+ if (__cap - __sz >= __n) {
+ if (__n) {
+ __annotate_increase(__n);
+ value_type* __p = std::__to_address(__get_pointer());
+ size_type __n_move = __sz - __pos;
+ if (__n_move != 0) {
+ if (std::__is_pointer_in_range(__p + __pos, __p + __sz, __s))
+ __s += __n;
+ traits_type::move(__p + __pos + __n, __p + __pos, __n_move);
+ }
+ traits_type::move(__p + __pos, __s, __n);
+ __sz += __n;
+ __set_size(__sz);
+ traits_type::assign(__p[__sz], value_type());
}
- else
- __grow_by_and_replace(__cap, __sz + __n - __cap, __sz, __pos, 0, __n, __s);
- return *this;
+ } else
+ __grow_by_and_replace(__cap, __sz + __n - __cap, __sz, __pos, 0, __n, __s);
+ return *this;
}
template <class _CharT, class _Traits, class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-basic_string<_CharT, _Traits, _Allocator>&
-basic_string<_CharT, _Traits, _Allocator>::insert(size_type __pos, size_type __n, value_type __c)
-{
- size_type __sz = size();
- if (__pos > __sz)
- __throw_out_of_range();
- if (__n)
- {
- size_type __cap = capacity();
- value_type* __p;
- if (__cap - __sz >= __n)
- {
- __annotate_increase(__n);
- __p = std::__to_address(__get_pointer());
- size_type __n_move = __sz - __pos;
- if (__n_move != 0)
- traits_type::move(__p + __pos + __n, __p + __pos, __n_move);
- }
- else
- {
- __grow_by_without_replace(__cap, __sz + __n - __cap, __sz, __pos, 0, __n);
- __p = std::__to_address(__get_long_pointer());
- }
- traits_type::assign(__p + __pos, __n, __c);
- __sz += __n;
- __set_size(__sz);
- traits_type::assign(__p[__sz], value_type());
+_LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string<_CharT, _Traits, _Allocator>&
+basic_string<_CharT, _Traits, _Allocator>::insert(size_type __pos, size_type __n, value_type __c) {
+ size_type __sz = size();
+ if (__pos > __sz)
+ __throw_out_of_range();
+ if (__n) {
+ size_type __cap = capacity();
+ value_type* __p;
+ if (__cap - __sz >= __n) {
+ __annotate_increase(__n);
+ __p = std::__to_address(__get_pointer());
+ size_type __n_move = __sz - __pos;
+ if (__n_move != 0)
+ traits_type::move(__p + __pos + __n, __p + __pos, __n_move);
+ } else {
+ __grow_by_without_replace(__cap, __sz + __n - __cap, __sz, __pos, 0, __n);
+ __p = std::__to_address(__get_long_pointer());
}
- return *this;
+ traits_type::assign(__p + __pos, __n, __c);
+ __sz += __n;
+ __set_size(__sz);
+ traits_type::assign(__p[__sz], value_type());
+ }
+ return *this;
}
template <class _CharT, class _Traits, class _Allocator>
-template<class _InputIterator, __enable_if_t<__has_exactly_input_iterator_category<_InputIterator>::value, int> >
+template <class _InputIterator, __enable_if_t<__has_exactly_input_iterator_category<_InputIterator>::value, int> >
_LIBCPP_CONSTEXPR_SINCE_CXX20 typename basic_string<_CharT, _Traits, _Allocator>::iterator
-basic_string<_CharT, _Traits, _Allocator>::insert(const_iterator __pos, _InputIterator __first, _InputIterator __last)
-{
+basic_string<_CharT, _Traits, _Allocator>::insert(const_iterator __pos, _InputIterator __first, _InputIterator __last) {
const basic_string __temp(__first, __last, __alloc());
return insert(__pos, __temp.data(), __temp.data() + __temp.size());
}
template <class _CharT, class _Traits, class _Allocator>
-template<class _ForwardIterator, __enable_if_t<__has_forward_iterator_category<_ForwardIterator>::value, int> >
+template <class _ForwardIterator, __enable_if_t<__has_forward_iterator_category<_ForwardIterator>::value, int> >
_LIBCPP_CONSTEXPR_SINCE_CXX20 typename basic_string<_CharT, _Traits, _Allocator>::iterator
-basic_string<_CharT, _Traits, _Allocator>::insert(const_iterator __pos, _ForwardIterator __first, _ForwardIterator __last)
-{
- auto __n = static_cast<size_type>(std::distance(__first, __last));
- return __insert_with_size(__pos, __first, __last, __n);
+basic_string<_CharT, _Traits, _Allocator>::insert(
+ const_iterator __pos, _ForwardIterator __first, _ForwardIterator __last) {
+ auto __n = static_cast<size_type>(std::distance(__first, __last));
+ return __insert_with_size(__pos, __first, __last, __n);
}
template <class _CharT, class _Traits, class _Allocator>
-template<class _Iterator, class _Sentinel>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-typename basic_string<_CharT, _Traits, _Allocator>::iterator
+template <class _Iterator, class _Sentinel>
+_LIBCPP_CONSTEXPR_SINCE_CXX20 typename basic_string<_CharT, _Traits, _Allocator>::iterator
basic_string<_CharT, _Traits, _Allocator>::__insert_with_size(
const_iterator __pos, _Iterator __first, _Sentinel __last, size_type __n) {
- size_type __ip = static_cast<size_type>(__pos - begin());
- if (__n == 0)
- return begin() + __ip;
+ size_type __ip = static_cast<size_type>(__pos - begin());
+ if (__n == 0)
+ return begin() + __ip;
- if (__string_is_trivial_iterator<_Iterator>::value && !__addr_in_range(*__first))
- {
- return __insert_from_safe_copy(__n, __ip, __first, __last);
- }
- else
- {
- const basic_string __temp(__init_with_sentinel_tag(), __first, __last, __alloc());
- return __insert_from_safe_copy(__n, __ip, __temp.begin(), __temp.end());
- }
+ if (__string_is_trivial_iterator<_Iterator>::value && !__addr_in_range(*__first)) {
+ return __insert_from_safe_copy(__n, __ip, __first, __last);
+ } else {
+ const basic_string __temp(__init_with_sentinel_tag(), __first, __last, __alloc());
+ return __insert_from_safe_copy(__n, __ip, __temp.begin(), __temp.end());
+ }
}
template <class _CharT, class _Traits, class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-basic_string<_CharT, _Traits, _Allocator>&
-basic_string<_CharT, _Traits, _Allocator>::insert(size_type __pos1, const basic_string& __str,
- size_type __pos2, size_type __n)
-{
- size_type __str_sz = __str.size();
- if (__pos2 > __str_sz)
- __throw_out_of_range();
- return insert(__pos1, __str.data() + __pos2, std::min(__n, __str_sz - __pos2));
+_LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string<_CharT, _Traits, _Allocator>&
+basic_string<_CharT, _Traits, _Allocator>::insert(
+ size_type __pos1, const basic_string& __str, size_type __pos2, size_type __n) {
+ size_type __str_sz = __str.size();
+ if (__pos2 > __str_sz)
+ __throw_out_of_range();
+ return insert(__pos1, __str.data() + __pos2, std::min(__n, __str_sz - __pos2));
}
template <class _CharT, class _Traits, class _Allocator>
@@ -3106,152 +2959,133 @@ template <class _Tp,
int> >
_LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string<_CharT, _Traits, _Allocator>&
basic_string<_CharT, _Traits, _Allocator>::insert(size_type __pos1, const _Tp& __t, size_type __pos2, size_type __n) {
- __self_view __sv = __t;
- size_type __str_sz = __sv.size();
- if (__pos2 > __str_sz)
- __throw_out_of_range();
- return insert(__pos1, __sv.data() + __pos2, std::min(__n, __str_sz - __pos2));
+ __self_view __sv = __t;
+ size_type __str_sz = __sv.size();
+ if (__pos2 > __str_sz)
+ __throw_out_of_range();
+ return insert(__pos1, __sv.data() + __pos2, std::min(__n, __str_sz - __pos2));
}
template <class _CharT, class _Traits, class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-basic_string<_CharT, _Traits, _Allocator>&
-basic_string<_CharT, _Traits, _Allocator>::insert(size_type __pos, const value_type* __s)
-{
- _LIBCPP_ASSERT_NON_NULL(__s != nullptr, "string::insert received nullptr");
- return insert(__pos, __s, traits_type::length(__s));
+_LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string<_CharT, _Traits, _Allocator>&
+basic_string<_CharT, _Traits, _Allocator>::insert(size_type __pos, const value_type* __s) {
+ _LIBCPP_ASSERT_NON_NULL(__s != nullptr, "string::insert received nullptr");
+ return insert(__pos, __s, traits_type::length(__s));
}
template <class _CharT, class _Traits, class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-typename basic_string<_CharT, _Traits, _Allocator>::iterator
-basic_string<_CharT, _Traits, _Allocator>::insert(const_iterator __pos, value_type __c)
-{
- size_type __ip = static_cast<size_type>(__pos - begin());
- size_type __sz = size();
- size_type __cap = capacity();
- value_type* __p;
- if (__cap == __sz)
- {
- __grow_by_without_replace(__cap, 1, __sz, __ip, 0, 1);
- __p = std::__to_address(__get_long_pointer());
- }
- else
- {
- __annotate_increase(1);
- __p = std::__to_address(__get_pointer());
- size_type __n_move = __sz - __ip;
- if (__n_move != 0)
- traits_type::move(__p + __ip + 1, __p + __ip, __n_move);
- }
- traits_type::assign(__p[__ip], __c);
- traits_type::assign(__p[++__sz], value_type());
- __set_size(__sz);
- return begin() + static_cast<difference_type>(__ip);
+_LIBCPP_CONSTEXPR_SINCE_CXX20 typename basic_string<_CharT, _Traits, _Allocator>::iterator
+basic_string<_CharT, _Traits, _Allocator>::insert(const_iterator __pos, value_type __c) {
+ size_type __ip = static_cast<size_type>(__pos - begin());
+ size_type __sz = size();
+ size_type __cap = capacity();
+ value_type* __p;
+ if (__cap == __sz) {
+ __grow_by_without_replace(__cap, 1, __sz, __ip, 0, 1);
+ __p = std::__to_address(__get_long_pointer());
+ } else {
+ __annotate_increase(1);
+ __p = std::__to_address(__get_pointer());
+ size_type __n_move = __sz - __ip;
+ if (__n_move != 0)
+ traits_type::move(__p + __ip + 1, __p + __ip, __n_move);
+ }
+ traits_type::assign(__p[__ip], __c);
+ traits_type::assign(__p[++__sz], value_type());
+ __set_size(__sz);
+ return begin() + static_cast<difference_type>(__ip);
}
// replace
template <class _CharT, class _Traits, class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-basic_string<_CharT, _Traits, _Allocator>&
-basic_string<_CharT, _Traits, _Allocator>::replace(size_type __pos, size_type __n1, const value_type* __s, size_type __n2)
- _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK
-{
- _LIBCPP_ASSERT_NON_NULL(__n2 == 0 || __s != nullptr, "string::replace received nullptr");
- size_type __sz = size();
- if (__pos > __sz)
- __throw_out_of_range();
- __n1 = std::min(__n1, __sz - __pos);
- size_type __cap = capacity();
- if (__cap - __sz + __n1 >= __n2)
- {
- value_type* __p = std::__to_address(__get_pointer());
- if (__n1 != __n2)
- {
- if (__n2 > __n1)
- __annotate_increase(__n2 - __n1);
- size_type __n_move = __sz - __pos - __n1;
- if (__n_move != 0)
- {
- if (__n1 > __n2)
- {
- traits_type::move(__p + __pos, __s, __n2);
- traits_type::move(__p + __pos + __n2, __p + __pos + __n1, __n_move);
- return __null_terminate_at(__p, __sz + (__n2 - __n1));
- }
- if (std::__is_pointer_in_range(__p + __pos + 1, __p + __sz, __s))
- {
- if (__p + __pos + __n1 <= __s)
- __s += __n2 - __n1;
- else // __p + __pos < __s < __p + __pos + __n1
- {
- traits_type::move(__p + __pos, __s, __n1);
- __pos += __n1;
- __s += __n2;
- __n2 -= __n1;
- __n1 = 0;
- }
- }
- traits_type::move(__p + __pos + __n2, __p + __pos + __n1, __n_move);
- }
+_LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string<_CharT, _Traits, _Allocator>&
+basic_string<_CharT, _Traits, _Allocator>::replace(
+ size_type __pos, size_type __n1, const value_type* __s, size_type __n2)
+ _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK {
+ _LIBCPP_ASSERT_NON_NULL(__n2 == 0 || __s != nullptr, "string::replace received nullptr");
+ size_type __sz = size();
+ if (__pos > __sz)
+ __throw_out_of_range();
+ __n1 = std::min(__n1, __sz - __pos);
+ size_type __cap = capacity();
+ if (__cap - __sz + __n1 >= __n2) {
+ value_type* __p = std::__to_address(__get_pointer());
+ if (__n1 != __n2) {
+ if (__n2 > __n1)
+ __annotate_increase(__n2 - __n1);
+ size_type __n_move = __sz - __pos - __n1;
+ if (__n_move != 0) {
+ if (__n1 > __n2) {
+ traits_type::move(__p + __pos, __s, __n2);
+ traits_type::move(__p + __pos + __n2, __p + __pos + __n1, __n_move);
+ return __null_terminate_at(__p, __sz + (__n2 - __n1));
+ }
+ if (std::__is_pointer_in_range(__p + __pos + 1, __p + __sz, __s)) {
+ if (__p + __pos + __n1 <= __s)
+ __s += __n2 - __n1;
+ else // __p + __pos < __s < __p + __pos + __n1
+ {
+ traits_type::move(__p + __pos, __s, __n1);
+ __pos += __n1;
+ __s += __n2;
+ __n2 -= __n1;
+ __n1 = 0;
+ }
}
- traits_type::move(__p + __pos, __s, __n2);
- return __null_terminate_at(__p, __sz + (__n2 - __n1));
+ traits_type::move(__p + __pos + __n2, __p + __pos + __n1, __n_move);
+ }
}
- else
- __grow_by_and_replace(__cap, __sz - __n1 + __n2 - __cap, __sz, __pos, __n1, __n2, __s);
- return *this;
+ traits_type::move(__p + __pos, __s, __n2);
+ return __null_terminate_at(__p, __sz + (__n2 - __n1));
+ } else
+ __grow_by_and_replace(__cap, __sz - __n1 + __n2 - __cap, __sz, __pos, __n1, __n2, __s);
+ return *this;
}
template <class _CharT, class _Traits, class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-basic_string<_CharT, _Traits, _Allocator>&
-basic_string<_CharT, _Traits, _Allocator>::replace(size_type __pos, size_type __n1, size_type __n2, value_type __c)
-{
- size_type __sz = size();
- if (__pos > __sz)
- __throw_out_of_range();
- __n1 = std::min(__n1, __sz - __pos);
- size_type __cap = capacity();
- value_type* __p;
- if (__cap - __sz + __n1 >= __n2) {
- __p = std::__to_address(__get_pointer());
- if (__n1 != __n2) {
- if (__n2 > __n1)
- __annotate_increase(__n2 - __n1);
- size_type __n_move = __sz - __pos - __n1;
- if (__n_move != 0)
- traits_type::move(__p + __pos + __n2, __p + __pos + __n1, __n_move);
- }
- } else {
- __grow_by_without_replace(__cap, __sz - __n1 + __n2 - __cap, __sz, __pos, __n1, __n2);
- __p = std::__to_address(__get_long_pointer());
+_LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string<_CharT, _Traits, _Allocator>&
+basic_string<_CharT, _Traits, _Allocator>::replace(size_type __pos, size_type __n1, size_type __n2, value_type __c) {
+ size_type __sz = size();
+ if (__pos > __sz)
+ __throw_out_of_range();
+ __n1 = std::min(__n1, __sz - __pos);
+ size_type __cap = capacity();
+ value_type* __p;
+ if (__cap - __sz + __n1 >= __n2) {
+ __p = std::__to_address(__get_pointer());
+ if (__n1 != __n2) {
+ if (__n2 > __n1)
+ __annotate_increase(__n2 - __n1);
+ size_type __n_move = __sz - __pos - __n1;
+ if (__n_move != 0)
+ traits_type::move(__p + __pos + __n2, __p + __pos + __n1, __n_move);
}
- traits_type::assign(__p + __pos, __n2, __c);
- return __null_terminate_at(__p, __sz - (__n1 - __n2));
+ } else {
+ __grow_by_without_replace(__cap, __sz - __n1 + __n2 - __cap, __sz, __pos, __n1, __n2);
+ __p = std::__to_address(__get_long_pointer());
+ }
+ traits_type::assign(__p + __pos, __n2, __c);
+ return __null_terminate_at(__p, __sz - (__n1 - __n2));
}
template <class _CharT, class _Traits, class _Allocator>
-template<class _InputIterator, __enable_if_t<__has_input_iterator_category<_InputIterator>::value, int> >
+template <class _InputIterator, __enable_if_t<__has_input_iterator_category<_InputIterator>::value, int> >
_LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string<_CharT, _Traits, _Allocator>&
-basic_string<_CharT, _Traits, _Allocator>::replace(const_iterator __i1, const_iterator __i2,
- _InputIterator __j1, _InputIterator __j2)
-{
- const basic_string __temp(__j1, __j2, __alloc());
- return replace(__i1, __i2, __temp);
+basic_string<_CharT, _Traits, _Allocator>::replace(
+ const_iterator __i1, const_iterator __i2, _InputIterator __j1, _InputIterator __j2) {
+ const basic_string __temp(__j1, __j2, __alloc());
+ return replace(__i1, __i2, __temp);
}
template <class _CharT, class _Traits, class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-basic_string<_CharT, _Traits, _Allocator>&
-basic_string<_CharT, _Traits, _Allocator>::replace(size_type __pos1, size_type __n1, const basic_string& __str,
- size_type __pos2, size_type __n2)
-{
- size_type __str_sz = __str.size();
- if (__pos2 > __str_sz)
- __throw_out_of_range();
- return replace(__pos1, __n1, __str.data() + __pos2, std::min(__n2, __str_sz - __pos2));
+_LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string<_CharT, _Traits, _Allocator>&
+basic_string<_CharT, _Traits, _Allocator>::replace(
+ size_type __pos1, size_type __n1, const basic_string& __str, size_type __pos2, size_type __n2) {
+ size_type __str_sz = __str.size();
+ if (__pos2 > __str_sz)
+ __throw_out_of_range();
+ return replace(__pos1, __n1, __str.data() + __pos2, std::min(__n2, __str_sz - __pos2));
}
template <class _CharT, class _Traits, class _Allocator>
@@ -3262,20 +3096,18 @@ template <class _Tp,
_LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string<_CharT, _Traits, _Allocator>&
basic_string<_CharT, _Traits, _Allocator>::replace(
size_type __pos1, size_type __n1, const _Tp& __t, size_type __pos2, size_type __n2) {
- __self_view __sv = __t;
- size_type __str_sz = __sv.size();
- if (__pos2 > __str_sz)
- __throw_out_of_range();
- return replace(__pos1, __n1, __sv.data() + __pos2, std::min(__n2, __str_sz - __pos2));
+ __self_view __sv = __t;
+ size_type __str_sz = __sv.size();
+ if (__pos2 > __str_sz)
+ __throw_out_of_range();
+ return replace(__pos1, __n1, __sv.data() + __pos2, std::min(__n2, __str_sz - __pos2));
}
template <class _CharT, class _Traits, class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-basic_string<_CharT, _Traits, _Allocator>&
-basic_string<_CharT, _Traits, _Allocator>::replace(size_type __pos, size_type __n1, const value_type* __s)
-{
- _LIBCPP_ASSERT_NON_NULL(__s != nullptr, "string::replace received nullptr");
- return replace(__pos, __n1, __s, traits_type::length(__s));
+_LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string<_CharT, _Traits, _Allocator>&
+basic_string<_CharT, _Traits, _Allocator>::replace(size_type __pos, size_type __n1, const value_type* __s) {
+ _LIBCPP_ASSERT_NON_NULL(__s != nullptr, "string::replace received nullptr");
+ return replace(__pos, __n1, __s, traits_type::length(__s));
}
// erase
@@ -3283,28 +3115,22 @@ basic_string<_CharT, _Traits, _Allocator>::replace(size_type __pos, size_type __
// 'externally instantiated' erase() implementation, called when __n != npos.
// Does not check __pos against size()
template <class _CharT, class _Traits, class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_NOINLINE
-void
-basic_string<_CharT, _Traits, _Allocator>::__erase_external_with_move(
- size_type __pos, size_type __n)
-{
- if (__n)
- {
- size_type __sz = size();
- value_type* __p = std::__to_address(__get_pointer());
- __n = std::min(__n, __sz - __pos);
- size_type __n_move = __sz - __pos - __n;
- if (__n_move != 0)
- traits_type::move(__p + __pos, __p + __pos + __n, __n_move);
- __null_terminate_at(__p, __sz - __n);
- }
+_LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_NOINLINE void
+basic_string<_CharT, _Traits, _Allocator>::__erase_external_with_move(size_type __pos, size_type __n) {
+ if (__n) {
+ size_type __sz = size();
+ value_type* __p = std::__to_address(__get_pointer());
+ __n = std::min(__n, __sz - __pos);
+ size_type __n_move = __sz - __pos - __n;
+ if (__n_move != 0)
+ traits_type::move(__p + __pos, __p + __pos + __n, __n_move);
+ __null_terminate_at(__p, __sz - __n);
+ }
}
template <class _CharT, class _Traits, class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-basic_string<_CharT, _Traits, _Allocator>&
-basic_string<_CharT, _Traits, _Allocator>::erase(size_type __pos,
- size_type __n) {
+_LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string<_CharT, _Traits, _Allocator>&
+basic_string<_CharT, _Traits, _Allocator>::erase(size_type __pos, size_type __n) {
if (__pos > size())
__throw_out_of_range();
if (__n == npos) {
@@ -3316,653 +3142,494 @@ basic_string<_CharT, _Traits, _Allocator>::erase(size_type __pos,
}
template <class _CharT, class _Traits, class _Allocator>
-inline _LIBCPP_CONSTEXPR_SINCE_CXX20
-typename basic_string<_CharT, _Traits, _Allocator>::iterator
-basic_string<_CharT, _Traits, _Allocator>::erase(const_iterator __pos)
-{
+inline _LIBCPP_CONSTEXPR_SINCE_CXX20 typename basic_string<_CharT, _Traits, _Allocator>::iterator
+basic_string<_CharT, _Traits, _Allocator>::erase(const_iterator __pos) {
_LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
__pos != end(), "string::erase(iterator) called with a non-dereferenceable iterator");
- iterator __b = begin();
+ iterator __b = begin();
size_type __r = static_cast<size_type>(__pos - __b);
erase(__r, 1);
return __b + static_cast<difference_type>(__r);
}
template <class _CharT, class _Traits, class _Allocator>
-inline _LIBCPP_CONSTEXPR_SINCE_CXX20
-typename basic_string<_CharT, _Traits, _Allocator>::iterator
-basic_string<_CharT, _Traits, _Allocator>::erase(const_iterator __first, const_iterator __last)
-{
+inline _LIBCPP_CONSTEXPR_SINCE_CXX20 typename basic_string<_CharT, _Traits, _Allocator>::iterator
+basic_string<_CharT, _Traits, _Allocator>::erase(const_iterator __first, const_iterator __last) {
_LIBCPP_ASSERT_VALID_INPUT_RANGE(__first <= __last, "string::erase(first, last) called with invalid range");
- iterator __b = begin();
+ iterator __b = begin();
size_type __r = static_cast<size_type>(__first - __b);
erase(__r, static_cast<size_type>(__last - __first));
return __b + static_cast<difference_type>(__r);
}
template <class _CharT, class _Traits, class _Allocator>
-inline _LIBCPP_CONSTEXPR_SINCE_CXX20
-void
-basic_string<_CharT, _Traits, _Allocator>::pop_back()
-{
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(!empty(), "string::pop_back(): string is already empty");
- __erase_to_end(size() - 1);
+inline _LIBCPP_CONSTEXPR_SINCE_CXX20 void basic_string<_CharT, _Traits, _Allocator>::pop_back() {
+ _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(!empty(), "string::pop_back(): string is already empty");
+ __erase_to_end(size() - 1);
}
template <class _CharT, class _Traits, class _Allocator>
-inline _LIBCPP_CONSTEXPR_SINCE_CXX20
-void
-basic_string<_CharT, _Traits, _Allocator>::clear() _NOEXCEPT
-{
- size_type __old_size = size();
- if (__is_long())
- {
- traits_type::assign(*__get_long_pointer(), value_type());
- __set_long_size(0);
- }
- else
- {
- traits_type::assign(*__get_short_pointer(), value_type());
- __set_short_size(0);
- }
- __annotate_shrink(__old_size);
+inline _LIBCPP_CONSTEXPR_SINCE_CXX20 void basic_string<_CharT, _Traits, _Allocator>::clear() _NOEXCEPT {
+ size_type __old_size = size();
+ if (__is_long()) {
+ traits_type::assign(*__get_long_pointer(), value_type());
+ __set_long_size(0);
+ } else {
+ traits_type::assign(*__get_short_pointer(), value_type());
+ __set_short_size(0);
+ }
+ __annotate_shrink(__old_size);
}
template <class _CharT, class _Traits, class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-void
-basic_string<_CharT, _Traits, _Allocator>::resize(size_type __n, value_type __c)
-{
- size_type __sz = size();
- if (__n > __sz)
- append(__n - __sz, __c);
- else
- __erase_to_end(__n);
+_LIBCPP_CONSTEXPR_SINCE_CXX20 void basic_string<_CharT, _Traits, _Allocator>::resize(size_type __n, value_type __c) {
+ size_type __sz = size();
+ if (__n > __sz)
+ append(__n - __sz, __c);
+ else
+ __erase_to_end(__n);
}
template <class _CharT, class _Traits, class _Allocator>
_LIBCPP_CONSTEXPR_SINCE_CXX20 inline void
-basic_string<_CharT, _Traits, _Allocator>::__resize_default_init(size_type __n)
-{
- size_type __sz = size();
- if (__n > __sz) {
- __append_default_init(__n - __sz);
- } else
- __erase_to_end(__n);
+basic_string<_CharT, _Traits, _Allocator>::__resize_default_init(size_type __n) {
+ size_type __sz = size();
+ if (__n > __sz) {
+ __append_default_init(__n - __sz);
+ } else
+ __erase_to_end(__n);
}
template <class _CharT, class _Traits, class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-void
-basic_string<_CharT, _Traits, _Allocator>::reserve(size_type __requested_capacity)
-{
- if (__requested_capacity > max_size())
- __throw_length_error();
+_LIBCPP_CONSTEXPR_SINCE_CXX20 void basic_string<_CharT, _Traits, _Allocator>::reserve(size_type __requested_capacity) {
+ if (__requested_capacity > max_size())
+ __throw_length_error();
- // Make sure reserve(n) never shrinks. This is technically only required in C++20
- // and later (since P0966R1), however we provide consistent behavior in all Standard
- // modes because this function is instantiated in the shared library.
- if (__requested_capacity <= capacity())
- return;
+ // Make sure reserve(n) never shrinks. This is technically only required in C++20
+ // and later (since P0966R1), however we provide consistent behavior in all Standard
+ // modes because this function is instantiated in the shared library.
+ if (__requested_capacity <= capacity())
+ return;
- size_type __target_capacity = std::max(__requested_capacity, size());
- __target_capacity = __recommend(__target_capacity);
- if (__target_capacity == capacity()) return;
+ size_type __target_capacity = std::max(__requested_capacity, size());
+ __target_capacity = __recommend(__target_capacity);
+ if (__target_capacity == capacity())
+ return;
- __shrink_or_extend(__target_capacity);
+ __shrink_or_extend(__target_capacity);
}
template <class _CharT, class _Traits, class _Allocator>
-inline _LIBCPP_CONSTEXPR_SINCE_CXX20
-void
-basic_string<_CharT, _Traits, _Allocator>::shrink_to_fit() _NOEXCEPT
-{
- size_type __target_capacity = __recommend(size());
- if (__target_capacity == capacity()) return;
+inline _LIBCPP_CONSTEXPR_SINCE_CXX20 void basic_string<_CharT, _Traits, _Allocator>::shrink_to_fit() _NOEXCEPT {
+ size_type __target_capacity = __recommend(size());
+ if (__target_capacity == capacity())
+ return;
- __shrink_or_extend(__target_capacity);
+ __shrink_or_extend(__target_capacity);
}
template <class _CharT, class _Traits, class _Allocator>
-inline _LIBCPP_CONSTEXPR_SINCE_CXX20
-void
-basic_string<_CharT, _Traits, _Allocator>::__shrink_or_extend(size_type __target_capacity)
-{
- __annotate_delete();
- size_type __cap = capacity();
- size_type __sz = size();
-
- pointer __new_data, __p;
- bool __was_long, __now_long;
- if (__fits_in_sso(__target_capacity))
- {
- __was_long = true;
- __now_long = false;
- __new_data = __get_short_pointer();
- __p = __get_long_pointer();
- }
- else
- {
- if (__target_capacity > __cap) {
- auto __allocation = std::__allocate_at_least(__alloc(), __target_capacity + 1);
- __new_data = __allocation.ptr;
- __target_capacity = __allocation.count - 1;
- }
- else
- {
- #ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- try
- {
- #endif // _LIBCPP_HAS_NO_EXCEPTIONS
- auto __allocation = std::__allocate_at_least(__alloc(), __target_capacity + 1);
- __new_data = __allocation.ptr;
- __target_capacity = __allocation.count - 1;
- #ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- }
- catch (...)
- {
- return;
- }
- #else // _LIBCPP_HAS_NO_EXCEPTIONS
- if (__new_data == nullptr)
- return;
- #endif // _LIBCPP_HAS_NO_EXCEPTIONS
- }
- __begin_lifetime(__new_data, __target_capacity + 1);
- __now_long = true;
- __was_long = __is_long();
- __p = __get_pointer();
- }
- traits_type::copy(std::__to_address(__new_data),
- std::__to_address(__p), size()+1);
- if (__was_long)
- __alloc_traits::deallocate(__alloc(), __p, __cap+1);
- if (__now_long)
- {
- __set_long_cap(__target_capacity+1);
- __set_long_size(__sz);
- __set_long_pointer(__new_data);
+inline _LIBCPP_CONSTEXPR_SINCE_CXX20 void
+basic_string<_CharT, _Traits, _Allocator>::__shrink_or_extend(size_type __target_capacity) {
+ __annotate_delete();
+ size_type __cap = capacity();
+ size_type __sz = size();
+
+ pointer __new_data, __p;
+ bool __was_long, __now_long;
+ if (__fits_in_sso(__target_capacity)) {
+ __was_long = true;
+ __now_long = false;
+ __new_data = __get_short_pointer();
+ __p = __get_long_pointer();
+ } else {
+ if (__target_capacity > __cap) {
+ auto __allocation = std::__allocate_at_least(__alloc(), __target_capacity + 1);
+ __new_data = __allocation.ptr;
+ __target_capacity = __allocation.count - 1;
+ } else {
+#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
+ try {
+#endif // _LIBCPP_HAS_NO_EXCEPTIONS
+ auto __allocation = std::__allocate_at_least(__alloc(), __target_capacity + 1);
+ __new_data = __allocation.ptr;
+ __target_capacity = __allocation.count - 1;
+#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
+ } catch (...) {
+ return;
+ }
+#else // _LIBCPP_HAS_NO_EXCEPTIONS
+ if (__new_data == nullptr)
+ return;
+#endif // _LIBCPP_HAS_NO_EXCEPTIONS
}
- else
- __set_short_size(__sz);
- __annotate_new(__sz);
+ __begin_lifetime(__new_data, __target_capacity + 1);
+ __now_long = true;
+ __was_long = __is_long();
+ __p = __get_pointer();
+ }
+ traits_type::copy(std::__to_address(__new_data), std::__to_address(__p), size() + 1);
+ if (__was_long)
+ __alloc_traits::deallocate(__alloc(), __p, __cap + 1);
+ if (__now_long) {
+ __set_long_cap(__target_capacity + 1);
+ __set_long_size(__sz);
+ __set_long_pointer(__new_data);
+ } else
+ __set_short_size(__sz);
+ __annotate_new(__sz);
}
template <class _CharT, class _Traits, class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-typename basic_string<_CharT, _Traits, _Allocator>::const_reference
-basic_string<_CharT, _Traits, _Allocator>::at(size_type __n) const
-{
- if (__n >= size())
- __throw_out_of_range();
- return (*this)[__n];
+_LIBCPP_CONSTEXPR_SINCE_CXX20 typename basic_string<_CharT, _Traits, _Allocator>::const_reference
+basic_string<_CharT, _Traits, _Allocator>::at(size_type __n) const {
+ if (__n >= size())
+ __throw_out_of_range();
+ return (*this)[__n];
}
template <class _CharT, class _Traits, class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-typename basic_string<_CharT, _Traits, _Allocator>::reference
-basic_string<_CharT, _Traits, _Allocator>::at(size_type __n)
-{
- if (__n >= size())
- __throw_out_of_range();
- return (*this)[__n];
+_LIBCPP_CONSTEXPR_SINCE_CXX20 typename basic_string<_CharT, _Traits, _Allocator>::reference
+basic_string<_CharT, _Traits, _Allocator>::at(size_type __n) {
+ if (__n >= size())
+ __throw_out_of_range();
+ return (*this)[__n];
}
template <class _CharT, class _Traits, class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-typename basic_string<_CharT, _Traits, _Allocator>::size_type
-basic_string<_CharT, _Traits, _Allocator>::copy(value_type* __s, size_type __n, size_type __pos) const
-{
- size_type __sz = size();
- if (__pos > __sz)
- __throw_out_of_range();
- size_type __rlen = std::min(__n, __sz - __pos);
- traits_type::copy(__s, data() + __pos, __rlen);
- return __rlen;
+_LIBCPP_CONSTEXPR_SINCE_CXX20 typename basic_string<_CharT, _Traits, _Allocator>::size_type
+basic_string<_CharT, _Traits, _Allocator>::copy(value_type* __s, size_type __n, size_type __pos) const {
+ size_type __sz = size();
+ if (__pos > __sz)
+ __throw_out_of_range();
+ size_type __rlen = std::min(__n, __sz - __pos);
+ traits_type::copy(__s, data() + __pos, __rlen);
+ return __rlen;
}
template <class _CharT, class _Traits, class _Allocator>
-inline _LIBCPP_CONSTEXPR_SINCE_CXX20
-void
-basic_string<_CharT, _Traits, _Allocator>::swap(basic_string& __str)
+inline _LIBCPP_CONSTEXPR_SINCE_CXX20 void basic_string<_CharT, _Traits, _Allocator>::swap(basic_string& __str)
#if _LIBCPP_STD_VER >= 14
- _NOEXCEPT
+ _NOEXCEPT
#else
- _NOEXCEPT_(!__alloc_traits::propagate_on_container_swap::value ||
- __is_nothrow_swappable<allocator_type>::value)
+ _NOEXCEPT_(!__alloc_traits::propagate_on_container_swap::value || __is_nothrow_swappable<allocator_type>::value)
#endif
{
- _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(
- __alloc_traits::propagate_on_container_swap::value ||
- __alloc_traits::is_always_equal::value ||
- __alloc() == __str.__alloc(), "swapping non-equal allocators");
- if (!__is_long())
- __annotate_delete();
- if (this != &__str && !__str.__is_long())
- __str.__annotate_delete();
- std::swap(__r_.first(), __str.__r_.first());
- std::__swap_allocator(__alloc(), __str.__alloc());
- if (!__is_long())
- __annotate_new(__get_short_size());
- if (this != &__str && !__str.__is_long())
- __str.__annotate_new(__str.__get_short_size());
+ _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(
+ __alloc_traits::propagate_on_container_swap::value || __alloc_traits::is_always_equal::value ||
+ __alloc() == __str.__alloc(),
+ "swapping non-equal allocators");
+ if (!__is_long())
+ __annotate_delete();
+ if (this != &__str && !__str.__is_long())
+ __str.__annotate_delete();
+ std::swap(__r_.first(), __str.__r_.first());
+ std::__swap_allocator(__alloc(), __str.__alloc());
+ if (!__is_long())
+ __annotate_new(__get_short_size());
+ if (this != &__str && !__str.__is_long())
+ __str.__annotate_new(__str.__get_short_size());
}
// find
template <class _Traits>
-struct _LIBCPP_HIDDEN __traits_eq
-{
- typedef typename _Traits::char_type char_type;
- _LIBCPP_HIDE_FROM_ABI
- bool operator()(const char_type& __x, const char_type& __y) _NOEXCEPT
- {return _Traits::eq(__x, __y);}
+struct _LIBCPP_HIDDEN __traits_eq {
+ typedef typename _Traits::char_type char_type;
+ _LIBCPP_HIDE_FROM_ABI bool operator()(const char_type& __x, const char_type& __y) _NOEXCEPT {
+ return _Traits::eq(__x, __y);
+ }
};
-template<class _CharT, class _Traits, class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-typename basic_string<_CharT, _Traits, _Allocator>::size_type
-basic_string<_CharT, _Traits, _Allocator>::find(const value_type* __s,
- size_type __pos,
- size_type __n) const _NOEXCEPT
-{
- _LIBCPP_ASSERT_NON_NULL(__n == 0 || __s != nullptr, "string::find(): received nullptr");
- return std::__str_find<value_type, size_type, traits_type, npos>
- (data(), size(), __s, __pos, __n);
+template <class _CharT, class _Traits, class _Allocator>
+_LIBCPP_CONSTEXPR_SINCE_CXX20 typename basic_string<_CharT, _Traits, _Allocator>::size_type
+basic_string<_CharT, _Traits, _Allocator>::find(const value_type* __s, size_type __pos, size_type __n) const _NOEXCEPT {
+ _LIBCPP_ASSERT_NON_NULL(__n == 0 || __s != nullptr, "string::find(): received nullptr");
+ return std::__str_find<value_type, size_type, traits_type, npos>(data(), size(), __s, __pos, __n);
}
-template<class _CharT, class _Traits, class _Allocator>
-inline _LIBCPP_CONSTEXPR_SINCE_CXX20
-typename basic_string<_CharT, _Traits, _Allocator>::size_type
-basic_string<_CharT, _Traits, _Allocator>::find(const basic_string& __str,
- size_type __pos) const _NOEXCEPT
-{
- return std::__str_find<value_type, size_type, traits_type, npos>
- (data(), size(), __str.data(), __pos, __str.size());
+template <class _CharT, class _Traits, class _Allocator>
+inline _LIBCPP_CONSTEXPR_SINCE_CXX20 typename basic_string<_CharT, _Traits, _Allocator>::size_type
+basic_string<_CharT, _Traits, _Allocator>::find(const basic_string& __str, size_type __pos) const _NOEXCEPT {
+ return std::__str_find<value_type, size_type, traits_type, npos>(data(), size(), __str.data(), __pos, __str.size());
}
-template<class _CharT, class _Traits, class _Allocator>
+template <class _CharT, class _Traits, class _Allocator>
template <class _Tp, __enable_if_t<__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value, int> >
_LIBCPP_CONSTEXPR_SINCE_CXX20 typename basic_string<_CharT, _Traits, _Allocator>::size_type
-basic_string<_CharT, _Traits, _Allocator>::find(const _Tp &__t,
- size_type __pos) const _NOEXCEPT
-{
- __self_view __sv = __t;
- return std::__str_find<value_type, size_type, traits_type, npos>
- (data(), size(), __sv.data(), __pos, __sv.size());
+basic_string<_CharT, _Traits, _Allocator>::find(const _Tp& __t, size_type __pos) const _NOEXCEPT {
+ __self_view __sv = __t;
+ return std::__str_find<value_type, size_type, traits_type, npos>(data(), size(), __sv.data(), __pos, __sv.size());
}
-template<class _CharT, class _Traits, class _Allocator>
-inline _LIBCPP_CONSTEXPR_SINCE_CXX20
-typename basic_string<_CharT, _Traits, _Allocator>::size_type
-basic_string<_CharT, _Traits, _Allocator>::find(const value_type* __s,
- size_type __pos) const _NOEXCEPT
-{
- _LIBCPP_ASSERT_NON_NULL(__s != nullptr, "string::find(): received nullptr");
- return std::__str_find<value_type, size_type, traits_type, npos>
- (data(), size(), __s, __pos, traits_type::length(__s));
+template <class _CharT, class _Traits, class _Allocator>
+inline _LIBCPP_CONSTEXPR_SINCE_CXX20 typename basic_string<_CharT, _Traits, _Allocator>::size_type
+basic_string<_CharT, _Traits, _Allocator>::find(const value_type* __s, size_type __pos) const _NOEXCEPT {
+ _LIBCPP_ASSERT_NON_NULL(__s != nullptr, "string::find(): received nullptr");
+ return std::__str_find<value_type, size_type, traits_type, npos>(
+ data(), size(), __s, __pos, traits_type::length(__s));
}
-template<class _CharT, class _Traits, class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-typename basic_string<_CharT, _Traits, _Allocator>::size_type
-basic_string<_CharT, _Traits, _Allocator>::find(value_type __c,
- size_type __pos) const _NOEXCEPT
-{
- return std::__str_find<value_type, size_type, traits_type, npos>
- (data(), size(), __c, __pos);
+template <class _CharT, class _Traits, class _Allocator>
+_LIBCPP_CONSTEXPR_SINCE_CXX20 typename basic_string<_CharT, _Traits, _Allocator>::size_type
+basic_string<_CharT, _Traits, _Allocator>::find(value_type __c, size_type __pos) const _NOEXCEPT {
+ return std::__str_find<value_type, size_type, traits_type, npos>(data(), size(), __c, __pos);
}
// rfind
-template<class _CharT, class _Traits, class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-typename basic_string<_CharT, _Traits, _Allocator>::size_type
-basic_string<_CharT, _Traits, _Allocator>::rfind(const value_type* __s,
- size_type __pos,
- size_type __n) const _NOEXCEPT
-{
- _LIBCPP_ASSERT_NON_NULL(__n == 0 || __s != nullptr, "string::rfind(): received nullptr");
- return std::__str_rfind<value_type, size_type, traits_type, npos>
- (data(), size(), __s, __pos, __n);
+template <class _CharT, class _Traits, class _Allocator>
+_LIBCPP_CONSTEXPR_SINCE_CXX20 typename basic_string<_CharT, _Traits, _Allocator>::size_type
+basic_string<_CharT, _Traits, _Allocator>::rfind(
+ const value_type* __s, size_type __pos, size_type __n) const _NOEXCEPT {
+ _LIBCPP_ASSERT_NON_NULL(__n == 0 || __s != nullptr, "string::rfind(): received nullptr");
+ return std::__str_rfind<value_type, size_type, traits_type, npos>(data(), size(), __s, __pos, __n);
}
-template<class _CharT, class _Traits, class _Allocator>
-inline _LIBCPP_CONSTEXPR_SINCE_CXX20
-typename basic_string<_CharT, _Traits, _Allocator>::size_type
-basic_string<_CharT, _Traits, _Allocator>::rfind(const basic_string& __str,
- size_type __pos) const _NOEXCEPT
-{
- return std::__str_rfind<value_type, size_type, traits_type, npos>
- (data(), size(), __str.data(), __pos, __str.size());
+template <class _CharT, class _Traits, class _Allocator>
+inline _LIBCPP_CONSTEXPR_SINCE_CXX20 typename basic_string<_CharT, _Traits, _Allocator>::size_type
+basic_string<_CharT, _Traits, _Allocator>::rfind(const basic_string& __str, size_type __pos) const _NOEXCEPT {
+ return std::__str_rfind<value_type, size_type, traits_type, npos>(data(), size(), __str.data(), __pos, __str.size());
}
-template<class _CharT, class _Traits, class _Allocator>
+template <class _CharT, class _Traits, class _Allocator>
template <class _Tp, __enable_if_t<__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value, int> >
_LIBCPP_CONSTEXPR_SINCE_CXX20 typename basic_string<_CharT, _Traits, _Allocator>::size_type
-basic_string<_CharT, _Traits, _Allocator>::rfind(const _Tp& __t,
- size_type __pos) const _NOEXCEPT
-{
- __self_view __sv = __t;
- return std::__str_rfind<value_type, size_type, traits_type, npos>
- (data(), size(), __sv.data(), __pos, __sv.size());
+basic_string<_CharT, _Traits, _Allocator>::rfind(const _Tp& __t, size_type __pos) const _NOEXCEPT {
+ __self_view __sv = __t;
+ return std::__str_rfind<value_type, size_type, traits_type, npos>(data(), size(), __sv.data(), __pos, __sv.size());
}
-template<class _CharT, class _Traits, class _Allocator>
-inline _LIBCPP_CONSTEXPR_SINCE_CXX20
-typename basic_string<_CharT, _Traits, _Allocator>::size_type
-basic_string<_CharT, _Traits, _Allocator>::rfind(const value_type* __s,
- size_type __pos) const _NOEXCEPT
-{
- _LIBCPP_ASSERT_NON_NULL(__s != nullptr, "string::rfind(): received nullptr");
- return std::__str_rfind<value_type, size_type, traits_type, npos>
- (data(), size(), __s, __pos, traits_type::length(__s));
+template <class _CharT, class _Traits, class _Allocator>
+inline _LIBCPP_CONSTEXPR_SINCE_CXX20 typename basic_string<_CharT, _Traits, _Allocator>::size_type
+basic_string<_CharT, _Traits, _Allocator>::rfind(const value_type* __s, size_type __pos) const _NOEXCEPT {
+ _LIBCPP_ASSERT_NON_NULL(__s != nullptr, "string::rfind(): received nullptr");
+ return std::__str_rfind<value_type, size_type, traits_type, npos>(
+ data(), size(), __s, __pos, traits_type::length(__s));
}
-template<class _CharT, class _Traits, class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-typename basic_string<_CharT, _Traits, _Allocator>::size_type
-basic_string<_CharT, _Traits, _Allocator>::rfind(value_type __c,
- size_type __pos) const _NOEXCEPT
-{
- return std::__str_rfind<value_type, size_type, traits_type, npos>
- (data(), size(), __c, __pos);
+template <class _CharT, class _Traits, class _Allocator>
+_LIBCPP_CONSTEXPR_SINCE_CXX20 typename basic_string<_CharT, _Traits, _Allocator>::size_type
+basic_string<_CharT, _Traits, _Allocator>::rfind(value_type __c, size_type __pos) const _NOEXCEPT {
+ return std::__str_rfind<value_type, size_type, traits_type, npos>(data(), size(), __c, __pos);
}
// find_first_of
-template<class _CharT, class _Traits, class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-typename basic_string<_CharT, _Traits, _Allocator>::size_type
-basic_string<_CharT, _Traits, _Allocator>::find_first_of(const value_type* __s,
- size_type __pos,
- size_type __n) const _NOEXCEPT
-{
- _LIBCPP_ASSERT_NON_NULL(__n == 0 || __s != nullptr, "string::find_first_of(): received nullptr");
- return std::__str_find_first_of<value_type, size_type, traits_type, npos>
- (data(), size(), __s, __pos, __n);
+template <class _CharT, class _Traits, class _Allocator>
+_LIBCPP_CONSTEXPR_SINCE_CXX20 typename basic_string<_CharT, _Traits, _Allocator>::size_type
+basic_string<_CharT, _Traits, _Allocator>::find_first_of(
+ const value_type* __s, size_type __pos, size_type __n) const _NOEXCEPT {
+ _LIBCPP_ASSERT_NON_NULL(__n == 0 || __s != nullptr, "string::find_first_of(): received nullptr");
+ return std::__str_find_first_of<value_type, size_type, traits_type, npos>(data(), size(), __s, __pos, __n);
}
-template<class _CharT, class _Traits, class _Allocator>
-inline _LIBCPP_CONSTEXPR_SINCE_CXX20
-typename basic_string<_CharT, _Traits, _Allocator>::size_type
-basic_string<_CharT, _Traits, _Allocator>::find_first_of(const basic_string& __str,
- size_type __pos) const _NOEXCEPT
-{
- return std::__str_find_first_of<value_type, size_type, traits_type, npos>
- (data(), size(), __str.data(), __pos, __str.size());
+template <class _CharT, class _Traits, class _Allocator>
+inline _LIBCPP_CONSTEXPR_SINCE_CXX20 typename basic_string<_CharT, _Traits, _Allocator>::size_type
+basic_string<_CharT, _Traits, _Allocator>::find_first_of(const basic_string& __str, size_type __pos) const _NOEXCEPT {
+ return std::__str_find_first_of<value_type, size_type, traits_type, npos>(
+ data(), size(), __str.data(), __pos, __str.size());
}
-template<class _CharT, class _Traits, class _Allocator>
+template <class _CharT, class _Traits, class _Allocator>
template <class _Tp, __enable_if_t<__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value, int> >
_LIBCPP_CONSTEXPR_SINCE_CXX20 typename basic_string<_CharT, _Traits, _Allocator>::size_type
-basic_string<_CharT, _Traits, _Allocator>::find_first_of(const _Tp& __t,
- size_type __pos) const _NOEXCEPT
-{
- __self_view __sv = __t;
- return std::__str_find_first_of<value_type, size_type, traits_type, npos>
- (data(), size(), __sv.data(), __pos, __sv.size());
+basic_string<_CharT, _Traits, _Allocator>::find_first_of(const _Tp& __t, size_type __pos) const _NOEXCEPT {
+ __self_view __sv = __t;
+ return std::__str_find_first_of<value_type, size_type, traits_type, npos>(
+ data(), size(), __sv.data(), __pos, __sv.size());
}
-template<class _CharT, class _Traits, class _Allocator>
-inline _LIBCPP_CONSTEXPR_SINCE_CXX20
-typename basic_string<_CharT, _Traits, _Allocator>::size_type
-basic_string<_CharT, _Traits, _Allocator>::find_first_of(const value_type* __s,
- size_type __pos) const _NOEXCEPT
-{
- _LIBCPP_ASSERT_NON_NULL(__s != nullptr, "string::find_first_of(): received nullptr");
- return std::__str_find_first_of<value_type, size_type, traits_type, npos>
- (data(), size(), __s, __pos, traits_type::length(__s));
+template <class _CharT, class _Traits, class _Allocator>
+inline _LIBCPP_CONSTEXPR_SINCE_CXX20 typename basic_string<_CharT, _Traits, _Allocator>::size_type
+basic_string<_CharT, _Traits, _Allocator>::find_first_of(const value_type* __s, size_type __pos) const _NOEXCEPT {
+ _LIBCPP_ASSERT_NON_NULL(__s != nullptr, "string::find_first_of(): received nullptr");
+ return std::__str_find_first_of<value_type, size_type, traits_type, npos>(
+ data(), size(), __s, __pos, traits_type::length(__s));
}
-template<class _CharT, class _Traits, class _Allocator>
-inline _LIBCPP_CONSTEXPR_SINCE_CXX20
-typename basic_string<_CharT, _Traits, _Allocator>::size_type
-basic_string<_CharT, _Traits, _Allocator>::find_first_of(value_type __c,
- size_type __pos) const _NOEXCEPT
-{
- return find(__c, __pos);
+template <class _CharT, class _Traits, class _Allocator>
+inline _LIBCPP_CONSTEXPR_SINCE_CXX20 typename basic_string<_CharT, _Traits, _Allocator>::size_type
+basic_string<_CharT, _Traits, _Allocator>::find_first_of(value_type __c, size_type __pos) const _NOEXCEPT {
+ return find(__c, __pos);
}
// find_last_of
-template<class _CharT, class _Traits, class _Allocator>
-inline _LIBCPP_CONSTEXPR_SINCE_CXX20
-typename basic_string<_CharT, _Traits, _Allocator>::size_type
-basic_string<_CharT, _Traits, _Allocator>::find_last_of(const value_type* __s,
- size_type __pos,
- size_type __n) const _NOEXCEPT
-{
- _LIBCPP_ASSERT_NON_NULL(__n == 0 || __s != nullptr, "string::find_last_of(): received nullptr");
- return std::__str_find_last_of<value_type, size_type, traits_type, npos>
- (data(), size(), __s, __pos, __n);
+template <class _CharT, class _Traits, class _Allocator>
+inline _LIBCPP_CONSTEXPR_SINCE_CXX20 typename basic_string<_CharT, _Traits, _Allocator>::size_type
+basic_string<_CharT, _Traits, _Allocator>::find_last_of(
+ const value_type* __s, size_type __pos, size_type __n) const _NOEXCEPT {
+ _LIBCPP_ASSERT_NON_NULL(__n == 0 || __s != nullptr, "string::find_last_of(): received nullptr");
+ return std::__str_find_last_of<value_type, size_type, traits_type, npos>(data(), size(), __s, __pos, __n);
}
-template<class _CharT, class _Traits, class _Allocator>
-inline _LIBCPP_CONSTEXPR_SINCE_CXX20
-typename basic_string<_CharT, _Traits, _Allocator>::size_type
-basic_string<_CharT, _Traits, _Allocator>::find_last_of(const basic_string& __str,
- size_type __pos) const _NOEXCEPT
-{
- return std::__str_find_last_of<value_type, size_type, traits_type, npos>
- (data(), size(), __str.data(), __pos, __str.size());
+template <class _CharT, class _Traits, class _Allocator>
+inline _LIBCPP_CONSTEXPR_SINCE_CXX20 typename basic_string<_CharT, _Traits, _Allocator>::size_type
+basic_string<_CharT, _Traits, _Allocator>::find_last_of(const basic_string& __str, size_type __pos) const _NOEXCEPT {
+ return std::__str_find_last_of<value_type, size_type, traits_type, npos>(
+ data(), size(), __str.data(), __pos, __str.size());
}
-template<class _CharT, class _Traits, class _Allocator>
+template <class _CharT, class _Traits, class _Allocator>
template <class _Tp, __enable_if_t<__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value, int> >
_LIBCPP_CONSTEXPR_SINCE_CXX20 typename basic_string<_CharT, _Traits, _Allocator>::size_type
-basic_string<_CharT, _Traits, _Allocator>::find_last_of(const _Tp& __t,
- size_type __pos) const _NOEXCEPT
-{
- __self_view __sv = __t;
- return std::__str_find_last_of<value_type, size_type, traits_type, npos>
- (data(), size(), __sv.data(), __pos, __sv.size());
+basic_string<_CharT, _Traits, _Allocator>::find_last_of(const _Tp& __t, size_type __pos) const _NOEXCEPT {
+ __self_view __sv = __t;
+ return std::__str_find_last_of<value_type, size_type, traits_type, npos>(
+ data(), size(), __sv.data(), __pos, __sv.size());
}
-template<class _CharT, class _Traits, class _Allocator>
-inline _LIBCPP_CONSTEXPR_SINCE_CXX20
-typename basic_string<_CharT, _Traits, _Allocator>::size_type
-basic_string<_CharT, _Traits, _Allocator>::find_last_of(const value_type* __s,
- size_type __pos) const _NOEXCEPT
-{
- _LIBCPP_ASSERT_NON_NULL(__s != nullptr, "string::find_last_of(): received nullptr");
- return std::__str_find_last_of<value_type, size_type, traits_type, npos>
- (data(), size(), __s, __pos, traits_type::length(__s));
+template <class _CharT, class _Traits, class _Allocator>
+inline _LIBCPP_CONSTEXPR_SINCE_CXX20 typename basic_string<_CharT, _Traits, _Allocator>::size_type
+basic_string<_CharT, _Traits, _Allocator>::find_last_of(const value_type* __s, size_type __pos) const _NOEXCEPT {
+ _LIBCPP_ASSERT_NON_NULL(__s != nullptr, "string::find_last_of(): received nullptr");
+ return std::__str_find_last_of<value_type, size_type, traits_type, npos>(
+ data(), size(), __s, __pos, traits_type::length(__s));
}
-template<class _CharT, class _Traits, class _Allocator>
-inline _LIBCPP_CONSTEXPR_SINCE_CXX20
-typename basic_string<_CharT, _Traits, _Allocator>::size_type
-basic_string<_CharT, _Traits, _Allocator>::find_last_of(value_type __c,
- size_type __pos) const _NOEXCEPT
-{
- return rfind(__c, __pos);
+template <class _CharT, class _Traits, class _Allocator>
+inline _LIBCPP_CONSTEXPR_SINCE_CXX20 typename basic_string<_CharT, _Traits, _Allocator>::size_type
+basic_string<_CharT, _Traits, _Allocator>::find_last_of(value_type __c, size_type __pos) const _NOEXCEPT {
+ return rfind(__c, __pos);
}
// find_first_not_of
-template<class _CharT, class _Traits, class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-typename basic_string<_CharT, _Traits, _Allocator>::size_type
-basic_string<_CharT, _Traits, _Allocator>::find_first_not_of(const value_type* __s,
- size_type __pos,
- size_type __n) const _NOEXCEPT
-{
- _LIBCPP_ASSERT_NON_NULL(__n == 0 || __s != nullptr, "string::find_first_not_of(): received nullptr");
- return std::__str_find_first_not_of<value_type, size_type, traits_type, npos>
- (data(), size(), __s, __pos, __n);
+template <class _CharT, class _Traits, class _Allocator>
+_LIBCPP_CONSTEXPR_SINCE_CXX20 typename basic_string<_CharT, _Traits, _Allocator>::size_type
+basic_string<_CharT, _Traits, _Allocator>::find_first_not_of(
+ const value_type* __s, size_type __pos, size_type __n) const _NOEXCEPT {
+ _LIBCPP_ASSERT_NON_NULL(__n == 0 || __s != nullptr, "string::find_first_not_of(): received nullptr");
+ return std::__str_find_first_not_of<value_type, size_type, traits_type, npos>(data(), size(), __s, __pos, __n);
}
-template<class _CharT, class _Traits, class _Allocator>
-inline _LIBCPP_CONSTEXPR_SINCE_CXX20
-typename basic_string<_CharT, _Traits, _Allocator>::size_type
-basic_string<_CharT, _Traits, _Allocator>::find_first_not_of(const basic_string& __str,
- size_type __pos) const _NOEXCEPT
-{
- return std::__str_find_first_not_of<value_type, size_type, traits_type, npos>
- (data(), size(), __str.data(), __pos, __str.size());
+template <class _CharT, class _Traits, class _Allocator>
+inline _LIBCPP_CONSTEXPR_SINCE_CXX20 typename basic_string<_CharT, _Traits, _Allocator>::size_type
+basic_string<_CharT, _Traits, _Allocator>::find_first_not_of(
+ const basic_string& __str, size_type __pos) const _NOEXCEPT {
+ return std::__str_find_first_not_of<value_type, size_type, traits_type, npos>(
+ data(), size(), __str.data(), __pos, __str.size());
}
-template<class _CharT, class _Traits, class _Allocator>
+template <class _CharT, class _Traits, class _Allocator>
template <class _Tp, __enable_if_t<__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value, int> >
_LIBCPP_CONSTEXPR_SINCE_CXX20 typename basic_string<_CharT, _Traits, _Allocator>::size_type
-basic_string<_CharT, _Traits, _Allocator>::find_first_not_of(const _Tp& __t,
- size_type __pos) const _NOEXCEPT
-{
- __self_view __sv = __t;
- return std::__str_find_first_not_of<value_type, size_type, traits_type, npos>
- (data(), size(), __sv.data(), __pos, __sv.size());
+basic_string<_CharT, _Traits, _Allocator>::find_first_not_of(const _Tp& __t, size_type __pos) const _NOEXCEPT {
+ __self_view __sv = __t;
+ return std::__str_find_first_not_of<value_type, size_type, traits_type, npos>(
+ data(), size(), __sv.data(), __pos, __sv.size());
}
-template<class _CharT, class _Traits, class _Allocator>
-inline _LIBCPP_CONSTEXPR_SINCE_CXX20
-typename basic_string<_CharT, _Traits, _Allocator>::size_type
-basic_string<_CharT, _Traits, _Allocator>::find_first_not_of(const value_type* __s,
- size_type __pos) const _NOEXCEPT
-{
- _LIBCPP_ASSERT_NON_NULL(__s != nullptr, "string::find_first_not_of(): received nullptr");
- return std::__str_find_first_not_of<value_type, size_type, traits_type, npos>
- (data(), size(), __s, __pos, traits_type::length(__s));
+template <class _CharT, class _Traits, class _Allocator>
+inline _LIBCPP_CONSTEXPR_SINCE_CXX20 typename basic_string<_CharT, _Traits, _Allocator>::size_type
+basic_string<_CharT, _Traits, _Allocator>::find_first_not_of(const value_type* __s, size_type __pos) const _NOEXCEPT {
+ _LIBCPP_ASSERT_NON_NULL(__s != nullptr, "string::find_first_not_of(): received nullptr");
+ return std::__str_find_first_not_of<value_type, size_type, traits_type, npos>(
+ data(), size(), __s, __pos, traits_type::length(__s));
}
-template<class _CharT, class _Traits, class _Allocator>
-inline _LIBCPP_CONSTEXPR_SINCE_CXX20
-typename basic_string<_CharT, _Traits, _Allocator>::size_type
-basic_string<_CharT, _Traits, _Allocator>::find_first_not_of(value_type __c,
- size_type __pos) const _NOEXCEPT
-{
- return std::__str_find_first_not_of<value_type, size_type, traits_type, npos>
- (data(), size(), __c, __pos);
+template <class _CharT, class _Traits, class _Allocator>
+inline _LIBCPP_CONSTEXPR_SINCE_CXX20 typename basic_string<_CharT, _Traits, _Allocator>::size_type
+basic_string<_CharT, _Traits, _Allocator>::find_first_not_of(value_type __c, size_type __pos) const _NOEXCEPT {
+ return std::__str_find_first_not_of<value_type, size_type, traits_type, npos>(data(), size(), __c, __pos);
}
// find_last_not_of
-template<class _CharT, class _Traits, class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-typename basic_string<_CharT, _Traits, _Allocator>::size_type
-basic_string<_CharT, _Traits, _Allocator>::find_last_not_of(const value_type* __s,
- size_type __pos,
- size_type __n) const _NOEXCEPT
-{
- _LIBCPP_ASSERT_NON_NULL(__n == 0 || __s != nullptr, "string::find_last_not_of(): received nullptr");
- return std::__str_find_last_not_of<value_type, size_type, traits_type, npos>
- (data(), size(), __s, __pos, __n);
+template <class _CharT, class _Traits, class _Allocator>
+_LIBCPP_CONSTEXPR_SINCE_CXX20 typename basic_string<_CharT, _Traits, _Allocator>::size_type
+basic_string<_CharT, _Traits, _Allocator>::find_last_not_of(
+ const value_type* __s, size_type __pos, size_type __n) const _NOEXCEPT {
+ _LIBCPP_ASSERT_NON_NULL(__n == 0 || __s != nullptr, "string::find_last_not_of(): received nullptr");
+ return std::__str_find_last_not_of<value_type, size_type, traits_type, npos>(data(), size(), __s, __pos, __n);
}
-template<class _CharT, class _Traits, class _Allocator>
-inline _LIBCPP_CONSTEXPR_SINCE_CXX20
-typename basic_string<_CharT, _Traits, _Allocator>::size_type
-basic_string<_CharT, _Traits, _Allocator>::find_last_not_of(const basic_string& __str,
- size_type __pos) const _NOEXCEPT
-{
- return std::__str_find_last_not_of<value_type, size_type, traits_type, npos>
- (data(), size(), __str.data(), __pos, __str.size());
+template <class _CharT, class _Traits, class _Allocator>
+inline _LIBCPP_CONSTEXPR_SINCE_CXX20 typename basic_string<_CharT, _Traits, _Allocator>::size_type
+basic_string<_CharT, _Traits, _Allocator>::find_last_not_of(
+ const basic_string& __str, size_type __pos) const _NOEXCEPT {
+ return std::__str_find_last_not_of<value_type, size_type, traits_type, npos>(
+ data(), size(), __str.data(), __pos, __str.size());
}
-template<class _CharT, class _Traits, class _Allocator>
+template <class _CharT, class _Traits, class _Allocator>
template <class _Tp, __enable_if_t<__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value, int> >
_LIBCPP_CONSTEXPR_SINCE_CXX20 typename basic_string<_CharT, _Traits, _Allocator>::size_type
-basic_string<_CharT, _Traits, _Allocator>::find_last_not_of(const _Tp& __t,
- size_type __pos) const _NOEXCEPT
-{
- __self_view __sv = __t;
- return std::__str_find_last_not_of<value_type, size_type, traits_type, npos>
- (data(), size(), __sv.data(), __pos, __sv.size());
+basic_string<_CharT, _Traits, _Allocator>::find_last_not_of(const _Tp& __t, size_type __pos) const _NOEXCEPT {
+ __self_view __sv = __t;
+ return std::__str_find_last_not_of<value_type, size_type, traits_type, npos>(
+ data(), size(), __sv.data(), __pos, __sv.size());
}
-template<class _CharT, class _Traits, class _Allocator>
-inline _LIBCPP_CONSTEXPR_SINCE_CXX20
-typename basic_string<_CharT, _Traits, _Allocator>::size_type
-basic_string<_CharT, _Traits, _Allocator>::find_last_not_of(const value_type* __s,
- size_type __pos) const _NOEXCEPT
-{
- _LIBCPP_ASSERT_NON_NULL(__s != nullptr, "string::find_last_not_of(): received nullptr");
- return std::__str_find_last_not_of<value_type, size_type, traits_type, npos>
- (data(), size(), __s, __pos, traits_type::length(__s));
+template <class _CharT, class _Traits, class _Allocator>
+inline _LIBCPP_CONSTEXPR_SINCE_CXX20 typename basic_string<_CharT, _Traits, _Allocator>::size_type
+basic_string<_CharT, _Traits, _Allocator>::find_last_not_of(const value_type* __s, size_type __pos) const _NOEXCEPT {
+ _LIBCPP_ASSERT_NON_NULL(__s != nullptr, "string::find_last_not_of(): received nullptr");
+ return std::__str_find_last_not_of<value_type, size_type, traits_type, npos>(
+ data(), size(), __s, __pos, traits_type::length(__s));
}
-template<class _CharT, class _Traits, class _Allocator>
-inline _LIBCPP_CONSTEXPR_SINCE_CXX20
-typename basic_string<_CharT, _Traits, _Allocator>::size_type
-basic_string<_CharT, _Traits, _Allocator>::find_last_not_of(value_type __c,
- size_type __pos) const _NOEXCEPT
-{
- return std::__str_find_last_not_of<value_type, size_type, traits_type, npos>
- (data(), size(), __c, __pos);
+template <class _CharT, class _Traits, class _Allocator>
+inline _LIBCPP_CONSTEXPR_SINCE_CXX20 typename basic_string<_CharT, _Traits, _Allocator>::size_type
+basic_string<_CharT, _Traits, _Allocator>::find_last_not_of(value_type __c, size_type __pos) const _NOEXCEPT {
+ return std::__str_find_last_not_of<value_type, size_type, traits_type, npos>(data(), size(), __c, __pos);
}
// compare
template <class _CharT, class _Traits, class _Allocator>
template <class _Tp, __enable_if_t<__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value, int> >
-_LIBCPP_CONSTEXPR_SINCE_CXX20 int
-basic_string<_CharT, _Traits, _Allocator>::compare(const _Tp& __t) const _NOEXCEPT
-{
- __self_view __sv = __t;
- size_t __lhs_sz = size();
- size_t __rhs_sz = __sv.size();
- int __result = traits_type::compare(data(), __sv.data(),
- std::min(__lhs_sz, __rhs_sz));
- if (__result != 0)
- return __result;
- if (__lhs_sz < __rhs_sz)
- return -1;
- if (__lhs_sz > __rhs_sz)
- return 1;
- return 0;
-}
-
-template <class _CharT, class _Traits, class _Allocator>
-inline _LIBCPP_CONSTEXPR_SINCE_CXX20
-int
-basic_string<_CharT, _Traits, _Allocator>::compare(const basic_string& __str) const _NOEXCEPT
-{
- return compare(__self_view(__str));
+_LIBCPP_CONSTEXPR_SINCE_CXX20 int basic_string<_CharT, _Traits, _Allocator>::compare(const _Tp& __t) const _NOEXCEPT {
+ __self_view __sv = __t;
+ size_t __lhs_sz = size();
+ size_t __rhs_sz = __sv.size();
+ int __result = traits_type::compare(data(), __sv.data(), std::min(__lhs_sz, __rhs_sz));
+ if (__result != 0)
+ return __result;
+ if (__lhs_sz < __rhs_sz)
+ return -1;
+ if (__lhs_sz > __rhs_sz)
+ return 1;
+ return 0;
}
template <class _CharT, class _Traits, class _Allocator>
-inline _LIBCPP_CONSTEXPR_SINCE_CXX20
-int
-basic_string<_CharT, _Traits, _Allocator>::compare(size_type __pos1,
- size_type __n1,
- const value_type* __s,
- size_type __n2) const
-{
- _LIBCPP_ASSERT_NON_NULL(__n2 == 0 || __s != nullptr, "string::compare(): received nullptr");
- size_type __sz = size();
- if (__pos1 > __sz || __n2 == npos)
- __throw_out_of_range();
- size_type __rlen = std::min(__n1, __sz - __pos1);
- int __r = traits_type::compare(data() + __pos1, __s, std::min(__rlen, __n2));
- if (__r == 0)
- {
- if (__rlen < __n2)
- __r = -1;
- else if (__rlen > __n2)
- __r = 1;
- }
- return __r;
+inline _LIBCPP_CONSTEXPR_SINCE_CXX20 int
+basic_string<_CharT, _Traits, _Allocator>::compare(const basic_string& __str) const _NOEXCEPT {
+ return compare(__self_view(__str));
+}
+
+template <class _CharT, class _Traits, class _Allocator>
+inline _LIBCPP_CONSTEXPR_SINCE_CXX20 int basic_string<_CharT, _Traits, _Allocator>::compare(
+ size_type __pos1, size_type __n1, const value_type* __s, size_type __n2) const {
+ _LIBCPP_ASSERT_NON_NULL(__n2 == 0 || __s != nullptr, "string::compare(): received nullptr");
+ size_type __sz = size();
+ if (__pos1 > __sz || __n2 == npos)
+ __throw_out_of_range();
+ size_type __rlen = std::min(__n1, __sz - __pos1);
+ int __r = traits_type::compare(data() + __pos1, __s, std::min(__rlen, __n2));
+ if (__r == 0) {
+ if (__rlen < __n2)
+ __r = -1;
+ else if (__rlen > __n2)
+ __r = 1;
+ }
+ return __r;
}
template <class _CharT, class _Traits, class _Allocator>
template <class _Tp, __enable_if_t<__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value, int> >
_LIBCPP_CONSTEXPR_SINCE_CXX20 int
-basic_string<_CharT, _Traits, _Allocator>::compare(size_type __pos1,
- size_type __n1,
- const _Tp& __t) const
-{
- __self_view __sv = __t;
- return compare(__pos1, __n1, __sv.data(), __sv.size());
+basic_string<_CharT, _Traits, _Allocator>::compare(size_type __pos1, size_type __n1, const _Tp& __t) const {
+ __self_view __sv = __t;
+ return compare(__pos1, __n1, __sv.data(), __sv.size());
}
template <class _CharT, class _Traits, class _Allocator>
-inline _LIBCPP_CONSTEXPR_SINCE_CXX20
-int
-basic_string<_CharT, _Traits, _Allocator>::compare(size_type __pos1,
- size_type __n1,
- const basic_string& __str) const
-{
- return compare(__pos1, __n1, __str.data(), __str.size());
+inline _LIBCPP_CONSTEXPR_SINCE_CXX20 int
+basic_string<_CharT, _Traits, _Allocator>::compare(size_type __pos1, size_type __n1, const basic_string& __str) const {
+ return compare(__pos1, __n1, __str.data(), __str.size());
}
template <class _CharT, class _Traits, class _Allocator>
@@ -3972,67 +3639,49 @@ template <class _Tp,
int> >
_LIBCPP_CONSTEXPR_SINCE_CXX20 int basic_string<_CharT, _Traits, _Allocator>::compare(
size_type __pos1, size_type __n1, const _Tp& __t, size_type __pos2, size_type __n2) const {
- __self_view __sv = __t;
- return __self_view(*this).substr(__pos1, __n1).compare(__sv.substr(__pos2, __n2));
+ __self_view __sv = __t;
+ return __self_view(*this).substr(__pos1, __n1).compare(__sv.substr(__pos2, __n2));
}
template <class _CharT, class _Traits, class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-int
-basic_string<_CharT, _Traits, _Allocator>::compare(size_type __pos1,
- size_type __n1,
- const basic_string& __str,
- size_type __pos2,
- size_type __n2) const
-{
- return compare(__pos1, __n1, __self_view(__str), __pos2, __n2);
+_LIBCPP_CONSTEXPR_SINCE_CXX20 int basic_string<_CharT, _Traits, _Allocator>::compare(
+ size_type __pos1, size_type __n1, const basic_string& __str, size_type __pos2, size_type __n2) const {
+ return compare(__pos1, __n1, __self_view(__str), __pos2, __n2);
}
template <class _CharT, class _Traits, class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-int
-basic_string<_CharT, _Traits, _Allocator>::compare(const value_type* __s) const _NOEXCEPT
-{
- _LIBCPP_ASSERT_NON_NULL(__s != nullptr, "string::compare(): received nullptr");
- return compare(0, npos, __s, traits_type::length(__s));
+_LIBCPP_CONSTEXPR_SINCE_CXX20 int
+basic_string<_CharT, _Traits, _Allocator>::compare(const value_type* __s) const _NOEXCEPT {
+ _LIBCPP_ASSERT_NON_NULL(__s != nullptr, "string::compare(): received nullptr");
+ return compare(0, npos, __s, traits_type::length(__s));
}
template <class _CharT, class _Traits, class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-int
-basic_string<_CharT, _Traits, _Allocator>::compare(size_type __pos1,
- size_type __n1,
- const value_type* __s) const
-{
- _LIBCPP_ASSERT_NON_NULL(__s != nullptr, "string::compare(): received nullptr");
- return compare(__pos1, __n1, __s, traits_type::length(__s));
+_LIBCPP_CONSTEXPR_SINCE_CXX20 int
+basic_string<_CharT, _Traits, _Allocator>::compare(size_type __pos1, size_type __n1, const value_type* __s) const {
+ _LIBCPP_ASSERT_NON_NULL(__s != nullptr, "string::compare(): received nullptr");
+ return compare(__pos1, __n1, __s, traits_type::length(__s));
}
// __invariants
-template<class _CharT, class _Traits, class _Allocator>
-inline _LIBCPP_CONSTEXPR_SINCE_CXX20
-bool
-basic_string<_CharT, _Traits, _Allocator>::__invariants() const
-{
- if (size() > capacity())
- return false;
- if (capacity() < __min_cap - 1)
- return false;
- if (data() == nullptr)
- return false;
- if (!_Traits::eq(data()[size()], value_type()))
- return false;
- return true;
+template <class _CharT, class _Traits, class _Allocator>
+inline _LIBCPP_CONSTEXPR_SINCE_CXX20 bool basic_string<_CharT, _Traits, _Allocator>::__invariants() const {
+ if (size() > capacity())
+ return false;
+ if (capacity() < __min_cap - 1)
+ return false;
+ if (data() == nullptr)
+ return false;
+ if (!_Traits::eq(data()[size()], value_type()))
+ return false;
+ return true;
}
// __clear_and_shrink
-template<class _CharT, class _Traits, class _Allocator>
-inline _LIBCPP_CONSTEXPR_SINCE_CXX20
-void
-basic_string<_CharT, _Traits, _Allocator>::__clear_and_shrink() _NOEXCEPT
-{
+template <class _CharT, class _Traits, class _Allocator>
+inline _LIBCPP_CONSTEXPR_SINCE_CXX20 void basic_string<_CharT, _Traits, _Allocator>::__clear_and_shrink() _NOEXCEPT {
clear();
if (__is_long()) {
__annotate_delete();
@@ -4043,407 +3692,324 @@ basic_string<_CharT, _Traits, _Allocator>::__clear_and_shrink() _NOEXCEPT
// operator==
-template<class _CharT, class _Traits, class _Allocator>
-inline _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI
-bool
+template <class _CharT, class _Traits, class _Allocator>
+inline _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI bool
operator==(const basic_string<_CharT, _Traits, _Allocator>& __lhs,
- const basic_string<_CharT, _Traits, _Allocator>& __rhs) _NOEXCEPT
-{
+ const basic_string<_CharT, _Traits, _Allocator>& __rhs) _NOEXCEPT {
#if _LIBCPP_STD_VER >= 20
- return basic_string_view<_CharT, _Traits>(__lhs) == basic_string_view<_CharT, _Traits>(__rhs);
+ return basic_string_view<_CharT, _Traits>(__lhs) == basic_string_view<_CharT, _Traits>(__rhs);
#else
- size_t __lhs_sz = __lhs.size();
- return __lhs_sz == __rhs.size() && _Traits::compare(__lhs.data(),
- __rhs.data(),
- __lhs_sz) == 0;
+ size_t __lhs_sz = __lhs.size();
+ return __lhs_sz == __rhs.size() && _Traits::compare(__lhs.data(), __rhs.data(), __lhs_sz) == 0;
#endif
}
-template<class _Allocator>
-inline _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI
-bool
+template <class _Allocator>
+inline _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI bool
operator==(const basic_string<char, char_traits<char>, _Allocator>& __lhs,
- const basic_string<char, char_traits<char>, _Allocator>& __rhs) _NOEXCEPT
-{
- size_t __lhs_sz = __lhs.size();
- if (__lhs_sz != __rhs.size())
- return false;
- const char* __lp = __lhs.data();
- const char* __rp = __rhs.data();
- if (__lhs.__is_long())
- return char_traits<char>::compare(__lp, __rp, __lhs_sz) == 0;
- for (; __lhs_sz != 0; --__lhs_sz, ++__lp, ++__rp)
- if (*__lp != *__rp)
- return false;
- return true;
+ const basic_string<char, char_traits<char>, _Allocator>& __rhs) _NOEXCEPT {
+ size_t __lhs_sz = __lhs.size();
+ if (__lhs_sz != __rhs.size())
+ return false;
+ const char* __lp = __lhs.data();
+ const char* __rp = __rhs.data();
+ if (__lhs.__is_long())
+ return char_traits<char>::compare(__lp, __rp, __lhs_sz) == 0;
+ for (; __lhs_sz != 0; --__lhs_sz, ++__lp, ++__rp)
+ if (*__lp != *__rp)
+ return false;
+ return true;
}
#if _LIBCPP_STD_VER <= 17
-template<class _CharT, class _Traits, class _Allocator>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator==(const _CharT* __lhs,
- const basic_string<_CharT, _Traits, _Allocator>& __rhs) _NOEXCEPT
-{
- typedef basic_string<_CharT, _Traits, _Allocator> _String;
- _LIBCPP_ASSERT_NON_NULL(__lhs != nullptr, "operator==(char*, basic_string): received nullptr");
- size_t __lhs_len = _Traits::length(__lhs);
- if (__lhs_len != __rhs.size()) return false;
- return __rhs.compare(0, _String::npos, __lhs, __lhs_len) == 0;
+template <class _CharT, class _Traits, class _Allocator>
+inline _LIBCPP_HIDE_FROM_ABI bool
+operator==(const _CharT* __lhs, const basic_string<_CharT, _Traits, _Allocator>& __rhs) _NOEXCEPT {
+ typedef basic_string<_CharT, _Traits, _Allocator> _String;
+ _LIBCPP_ASSERT_NON_NULL(__lhs != nullptr, "operator==(char*, basic_string): received nullptr");
+ size_t __lhs_len = _Traits::length(__lhs);
+ if (__lhs_len != __rhs.size())
+ return false;
+ return __rhs.compare(0, _String::npos, __lhs, __lhs_len) == 0;
}
#endif // _LIBCPP_STD_VER <= 17
-template<class _CharT, class _Traits, class _Allocator>
-inline _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI
-bool
-operator==(const basic_string<_CharT,_Traits,_Allocator>& __lhs,
- const _CharT* __rhs) _NOEXCEPT
-{
+template <class _CharT, class _Traits, class _Allocator>
+inline _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI bool
+operator==(const basic_string<_CharT, _Traits, _Allocator>& __lhs, const _CharT* __rhs) _NOEXCEPT {
#if _LIBCPP_STD_VER >= 20
- return basic_string_view<_CharT, _Traits>(__lhs) == basic_string_view<_CharT, _Traits>(__rhs);
+ return basic_string_view<_CharT, _Traits>(__lhs) == basic_string_view<_CharT, _Traits>(__rhs);
#else
- typedef basic_string<_CharT, _Traits, _Allocator> _String;
- _LIBCPP_ASSERT_NON_NULL(__rhs != nullptr, "operator==(basic_string, char*): received nullptr");
- size_t __rhs_len = _Traits::length(__rhs);
- if (__rhs_len != __lhs.size()) return false;
- return __lhs.compare(0, _String::npos, __rhs, __rhs_len) == 0;
+ typedef basic_string<_CharT, _Traits, _Allocator> _String;
+ _LIBCPP_ASSERT_NON_NULL(__rhs != nullptr, "operator==(basic_string, char*): received nullptr");
+ size_t __rhs_len = _Traits::length(__rhs);
+ if (__rhs_len != __lhs.size())
+ return false;
+ return __lhs.compare(0, _String::npos, __rhs, __rhs_len) == 0;
#endif
}
#if _LIBCPP_STD_VER >= 20
template <class _CharT, class _Traits, class _Allocator>
-_LIBCPP_HIDE_FROM_ABI constexpr auto operator<=>(
- const basic_string<_CharT, _Traits, _Allocator>& __lhs,
- const basic_string<_CharT, _Traits, _Allocator>& __rhs) noexcept {
- return basic_string_view<_CharT, _Traits>(__lhs) <=> basic_string_view<_CharT, _Traits>(__rhs);
+_LIBCPP_HIDE_FROM_ABI constexpr auto operator<=>(const basic_string<_CharT, _Traits, _Allocator>& __lhs,
+ const basic_string<_CharT, _Traits, _Allocator>& __rhs) noexcept {
+ return basic_string_view<_CharT, _Traits>(__lhs) <=> basic_string_view<_CharT, _Traits>(__rhs);
}
template <class _CharT, class _Traits, class _Allocator>
_LIBCPP_HIDE_FROM_ABI constexpr auto
operator<=>(const basic_string<_CharT, _Traits, _Allocator>& __lhs, const _CharT* __rhs) {
- return basic_string_view<_CharT, _Traits>(__lhs) <=> basic_string_view<_CharT, _Traits>(__rhs);
+ return basic_string_view<_CharT, _Traits>(__lhs) <=> basic_string_view<_CharT, _Traits>(__rhs);
}
-#else // _LIBCPP_STD_VER >= 20
+#else // _LIBCPP_STD_VER >= 20
-template<class _CharT, class _Traits, class _Allocator>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator!=(const basic_string<_CharT,_Traits,_Allocator>& __lhs,
- const basic_string<_CharT, _Traits, _Allocator>& __rhs) _NOEXCEPT
-{
- return !(__lhs == __rhs);
+template <class _CharT, class _Traits, class _Allocator>
+inline _LIBCPP_HIDE_FROM_ABI bool operator!=(const basic_string<_CharT, _Traits, _Allocator>& __lhs,
+ const basic_string<_CharT, _Traits, _Allocator>& __rhs) _NOEXCEPT {
+ return !(__lhs == __rhs);
}
-template<class _CharT, class _Traits, class _Allocator>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator!=(const _CharT* __lhs,
- const basic_string<_CharT, _Traits, _Allocator>& __rhs) _NOEXCEPT
-{
- return !(__lhs == __rhs);
+template <class _CharT, class _Traits, class _Allocator>
+inline _LIBCPP_HIDE_FROM_ABI bool
+operator!=(const _CharT* __lhs, const basic_string<_CharT, _Traits, _Allocator>& __rhs) _NOEXCEPT {
+ return !(__lhs == __rhs);
}
-template<class _CharT, class _Traits, class _Allocator>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator!=(const basic_string<_CharT, _Traits, _Allocator>& __lhs,
- const _CharT* __rhs) _NOEXCEPT
-{
- return !(__lhs == __rhs);
+template <class _CharT, class _Traits, class _Allocator>
+inline _LIBCPP_HIDE_FROM_ABI bool
+operator!=(const basic_string<_CharT, _Traits, _Allocator>& __lhs, const _CharT* __rhs) _NOEXCEPT {
+ return !(__lhs == __rhs);
}
// operator<
-template<class _CharT, class _Traits, class _Allocator>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator< (const basic_string<_CharT, _Traits, _Allocator>& __lhs,
- const basic_string<_CharT, _Traits, _Allocator>& __rhs) _NOEXCEPT
-{
- return __lhs.compare(__rhs) < 0;
+template <class _CharT, class _Traits, class _Allocator>
+inline _LIBCPP_HIDE_FROM_ABI bool operator<(const basic_string<_CharT, _Traits, _Allocator>& __lhs,
+ const basic_string<_CharT, _Traits, _Allocator>& __rhs) _NOEXCEPT {
+ return __lhs.compare(__rhs) < 0;
}
-template<class _CharT, class _Traits, class _Allocator>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator< (const basic_string<_CharT, _Traits, _Allocator>& __lhs,
- const _CharT* __rhs) _NOEXCEPT
-{
- return __lhs.compare(__rhs) < 0;
+template <class _CharT, class _Traits, class _Allocator>
+inline _LIBCPP_HIDE_FROM_ABI bool
+operator<(const basic_string<_CharT, _Traits, _Allocator>& __lhs, const _CharT* __rhs) _NOEXCEPT {
+ return __lhs.compare(__rhs) < 0;
}
-template<class _CharT, class _Traits, class _Allocator>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator< (const _CharT* __lhs,
- const basic_string<_CharT, _Traits, _Allocator>& __rhs) _NOEXCEPT
-{
- return __rhs.compare(__lhs) > 0;
+template <class _CharT, class _Traits, class _Allocator>
+inline _LIBCPP_HIDE_FROM_ABI bool
+operator<(const _CharT* __lhs, const basic_string<_CharT, _Traits, _Allocator>& __rhs) _NOEXCEPT {
+ return __rhs.compare(__lhs) > 0;
}
// operator>
-template<class _CharT, class _Traits, class _Allocator>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator> (const basic_string<_CharT, _Traits, _Allocator>& __lhs,
- const basic_string<_CharT, _Traits, _Allocator>& __rhs) _NOEXCEPT
-{
- return __rhs < __lhs;
+template <class _CharT, class _Traits, class _Allocator>
+inline _LIBCPP_HIDE_FROM_ABI bool operator>(const basic_string<_CharT, _Traits, _Allocator>& __lhs,
+ const basic_string<_CharT, _Traits, _Allocator>& __rhs) _NOEXCEPT {
+ return __rhs < __lhs;
}
-template<class _CharT, class _Traits, class _Allocator>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator> (const basic_string<_CharT, _Traits, _Allocator>& __lhs,
- const _CharT* __rhs) _NOEXCEPT
-{
- return __rhs < __lhs;
+template <class _CharT, class _Traits, class _Allocator>
+inline _LIBCPP_HIDE_FROM_ABI bool
+operator>(const basic_string<_CharT, _Traits, _Allocator>& __lhs, const _CharT* __rhs) _NOEXCEPT {
+ return __rhs < __lhs;
}
-template<class _CharT, class _Traits, class _Allocator>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator> (const _CharT* __lhs,
- const basic_string<_CharT, _Traits, _Allocator>& __rhs) _NOEXCEPT
-{
- return __rhs < __lhs;
+template <class _CharT, class _Traits, class _Allocator>
+inline _LIBCPP_HIDE_FROM_ABI bool
+operator>(const _CharT* __lhs, const basic_string<_CharT, _Traits, _Allocator>& __rhs) _NOEXCEPT {
+ return __rhs < __lhs;
}
// operator<=
-template<class _CharT, class _Traits, class _Allocator>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator<=(const basic_string<_CharT, _Traits, _Allocator>& __lhs,
- const basic_string<_CharT, _Traits, _Allocator>& __rhs) _NOEXCEPT
-{
- return !(__rhs < __lhs);
+template <class _CharT, class _Traits, class _Allocator>
+inline _LIBCPP_HIDE_FROM_ABI bool operator<=(const basic_string<_CharT, _Traits, _Allocator>& __lhs,
+ const basic_string<_CharT, _Traits, _Allocator>& __rhs) _NOEXCEPT {
+ return !(__rhs < __lhs);
}
-template<class _CharT, class _Traits, class _Allocator>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator<=(const basic_string<_CharT, _Traits, _Allocator>& __lhs,
- const _CharT* __rhs) _NOEXCEPT
-{
- return !(__rhs < __lhs);
+template <class _CharT, class _Traits, class _Allocator>
+inline _LIBCPP_HIDE_FROM_ABI bool
+operator<=(const basic_string<_CharT, _Traits, _Allocator>& __lhs, const _CharT* __rhs) _NOEXCEPT {
+ return !(__rhs < __lhs);
}
-template<class _CharT, class _Traits, class _Allocator>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator<=(const _CharT* __lhs,
- const basic_string<_CharT, _Traits, _Allocator>& __rhs) _NOEXCEPT
-{
- return !(__rhs < __lhs);
+template <class _CharT, class _Traits, class _Allocator>
+inline _LIBCPP_HIDE_FROM_ABI bool
+operator<=(const _CharT* __lhs, const basic_string<_CharT, _Traits, _Allocator>& __rhs) _NOEXCEPT {
+ return !(__rhs < __lhs);
}
// operator>=
-template<class _CharT, class _Traits, class _Allocator>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator>=(const basic_string<_CharT, _Traits, _Allocator>& __lhs,
- const basic_string<_CharT, _Traits, _Allocator>& __rhs) _NOEXCEPT
-{
- return !(__lhs < __rhs);
+template <class _CharT, class _Traits, class _Allocator>
+inline _LIBCPP_HIDE_FROM_ABI bool operator>=(const basic_string<_CharT, _Traits, _Allocator>& __lhs,
+ const basic_string<_CharT, _Traits, _Allocator>& __rhs) _NOEXCEPT {
+ return !(__lhs < __rhs);
}
-template<class _CharT, class _Traits, class _Allocator>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator>=(const basic_string<_CharT, _Traits, _Allocator>& __lhs,
- const _CharT* __rhs) _NOEXCEPT
-{
- return !(__lhs < __rhs);
+template <class _CharT, class _Traits, class _Allocator>
+inline _LIBCPP_HIDE_FROM_ABI bool
+operator>=(const basic_string<_CharT, _Traits, _Allocator>& __lhs, const _CharT* __rhs) _NOEXCEPT {
+ return !(__lhs < __rhs);
}
-template<class _CharT, class _Traits, class _Allocator>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator>=(const _CharT* __lhs,
- const basic_string<_CharT, _Traits, _Allocator>& __rhs) _NOEXCEPT
-{
- return !(__lhs < __rhs);
+template <class _CharT, class _Traits, class _Allocator>
+inline _LIBCPP_HIDE_FROM_ABI bool
+operator>=(const _CharT* __lhs, const basic_string<_CharT, _Traits, _Allocator>& __rhs) _NOEXCEPT {
+ return !(__lhs < __rhs);
}
#endif // _LIBCPP_STD_VER >= 20
// operator +
-template<class _CharT, class _Traits, class _Allocator>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-basic_string<_CharT, _Traits, _Allocator>
+template <class _CharT, class _Traits, class _Allocator>
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string<_CharT, _Traits, _Allocator>
operator+(const basic_string<_CharT, _Traits, _Allocator>& __lhs,
- const basic_string<_CharT, _Traits, _Allocator>& __rhs)
-{
- using _String = basic_string<_CharT, _Traits, _Allocator>;
- auto __lhs_sz = __lhs.size();
- auto __rhs_sz = __rhs.size();
- _String __r(__uninitialized_size_tag(),
- __lhs_sz + __rhs_sz,
- _String::__alloc_traits::select_on_container_copy_construction(__lhs.get_allocator()));
- auto __ptr = std::__to_address(__r.__get_pointer());
- _Traits::copy(__ptr, __lhs.data(), __lhs_sz);
- _Traits::copy(__ptr + __lhs_sz, __rhs.data(), __rhs_sz);
- _Traits::assign(__ptr + __lhs_sz + __rhs_sz, 1, _CharT());
- return __r;
-}
-
-template<class _CharT, class _Traits, class _Allocator>
-_LIBCPP_HIDDEN _LIBCPP_CONSTEXPR_SINCE_CXX20
-basic_string<_CharT, _Traits, _Allocator>
-operator+(const _CharT* __lhs , const basic_string<_CharT,_Traits,_Allocator>& __rhs)
-{
- using _String = basic_string<_CharT, _Traits, _Allocator>;
- auto __lhs_sz = _Traits::length(__lhs);
- auto __rhs_sz = __rhs.size();
- _String __r(__uninitialized_size_tag(),
- __lhs_sz + __rhs_sz,
- _String::__alloc_traits::select_on_container_copy_construction(__rhs.get_allocator()));
- auto __ptr = std::__to_address(__r.__get_pointer());
- _Traits::copy(__ptr, __lhs, __lhs_sz);
- _Traits::copy(__ptr + __lhs_sz, __rhs.data(), __rhs_sz);
- _Traits::assign(__ptr + __lhs_sz + __rhs_sz, 1, _CharT());
- return __r;
-}
-
-template<class _CharT, class _Traits, class _Allocator>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-basic_string<_CharT, _Traits, _Allocator>
-operator+(_CharT __lhs, const basic_string<_CharT,_Traits,_Allocator>& __rhs)
-{
- using _String = basic_string<_CharT, _Traits, _Allocator>;
- typename _String::size_type __rhs_sz = __rhs.size();
- _String __r(__uninitialized_size_tag(),
- __rhs_sz + 1,
- _String::__alloc_traits::select_on_container_copy_construction(__rhs.get_allocator()));
- auto __ptr = std::__to_address(__r.__get_pointer());
- _Traits::assign(__ptr, 1, __lhs);
- _Traits::copy(__ptr + 1, __rhs.data(), __rhs_sz);
- _Traits::assign(__ptr + 1 + __rhs_sz, 1, _CharT());
- return __r;
-}
-
-template<class _CharT, class _Traits, class _Allocator>
-inline _LIBCPP_CONSTEXPR_SINCE_CXX20
-basic_string<_CharT, _Traits, _Allocator>
-operator+(const basic_string<_CharT, _Traits, _Allocator>& __lhs, const _CharT* __rhs)
-{
- using _String = basic_string<_CharT, _Traits, _Allocator>;
- typename _String::size_type __lhs_sz = __lhs.size();
- typename _String::size_type __rhs_sz = _Traits::length(__rhs);
- _String __r(__uninitialized_size_tag(),
- __lhs_sz + __rhs_sz,
- _String::__alloc_traits::select_on_container_copy_construction(__lhs.get_allocator()));
- auto __ptr = std::__to_address(__r.__get_pointer());
- _Traits::copy(__ptr, __lhs.data(), __lhs_sz);
- _Traits::copy(__ptr + __lhs_sz, __rhs, __rhs_sz);
- _Traits::assign(__ptr + __lhs_sz + __rhs_sz, 1, _CharT());
- return __r;
-}
-
-template<class _CharT, class _Traits, class _Allocator>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-basic_string<_CharT, _Traits, _Allocator>
-operator+(const basic_string<_CharT, _Traits, _Allocator>& __lhs, _CharT __rhs)
-{
- using _String = basic_string<_CharT, _Traits, _Allocator>;
- typename _String::size_type __lhs_sz = __lhs.size();
- _String __r(__uninitialized_size_tag(),
- __lhs_sz + 1,
- _String::__alloc_traits::select_on_container_copy_construction(__lhs.get_allocator()));
- auto __ptr = std::__to_address(__r.__get_pointer());
- _Traits::copy(__ptr, __lhs.data(), __lhs_sz);
- _Traits::assign(__ptr + __lhs_sz, 1, __rhs);
- _Traits::assign(__ptr + 1 + __lhs_sz, 1, _CharT());
- return __r;
+ const basic_string<_CharT, _Traits, _Allocator>& __rhs) {
+ using _String = basic_string<_CharT, _Traits, _Allocator>;
+ auto __lhs_sz = __lhs.size();
+ auto __rhs_sz = __rhs.size();
+ _String __r(__uninitialized_size_tag(),
+ __lhs_sz + __rhs_sz,
+ _String::__alloc_traits::select_on_container_copy_construction(__lhs.get_allocator()));
+ auto __ptr = std::__to_address(__r.__get_pointer());
+ _Traits::copy(__ptr, __lhs.data(), __lhs_sz);
+ _Traits::copy(__ptr + __lhs_sz, __rhs.data(), __rhs_sz);
+ _Traits::assign(__ptr + __lhs_sz + __rhs_sz, 1, _CharT());
+ return __r;
+}
+
+template <class _CharT, class _Traits, class _Allocator>
+_LIBCPP_HIDDEN _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string<_CharT, _Traits, _Allocator>
+operator+(const _CharT* __lhs, const basic_string<_CharT, _Traits, _Allocator>& __rhs) {
+ using _String = basic_string<_CharT, _Traits, _Allocator>;
+ auto __lhs_sz = _Traits::length(__lhs);
+ auto __rhs_sz = __rhs.size();
+ _String __r(__uninitialized_size_tag(),
+ __lhs_sz + __rhs_sz,
+ _String::__alloc_traits::select_on_container_copy_construction(__rhs.get_allocator()));
+ auto __ptr = std::__to_address(__r.__get_pointer());
+ _Traits::copy(__ptr, __lhs, __lhs_sz);
+ _Traits::copy(__ptr + __lhs_sz, __rhs.data(), __rhs_sz);
+ _Traits::assign(__ptr + __lhs_sz + __rhs_sz, 1, _CharT());
+ return __r;
+}
+
+template <class _CharT, class _Traits, class _Allocator>
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string<_CharT, _Traits, _Allocator>
+operator+(_CharT __lhs, const basic_string<_CharT, _Traits, _Allocator>& __rhs) {
+ using _String = basic_string<_CharT, _Traits, _Allocator>;
+ typename _String::size_type __rhs_sz = __rhs.size();
+ _String __r(__uninitialized_size_tag(),
+ __rhs_sz + 1,
+ _String::__alloc_traits::select_on_container_copy_construction(__rhs.get_allocator()));
+ auto __ptr = std::__to_address(__r.__get_pointer());
+ _Traits::assign(__ptr, 1, __lhs);
+ _Traits::copy(__ptr + 1, __rhs.data(), __rhs_sz);
+ _Traits::assign(__ptr + 1 + __rhs_sz, 1, _CharT());
+ return __r;
+}
+
+template <class _CharT, class _Traits, class _Allocator>
+inline _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string<_CharT, _Traits, _Allocator>
+operator+(const basic_string<_CharT, _Traits, _Allocator>& __lhs, const _CharT* __rhs) {
+ using _String = basic_string<_CharT, _Traits, _Allocator>;
+ typename _String::size_type __lhs_sz = __lhs.size();
+ typename _String::size_type __rhs_sz = _Traits::length(__rhs);
+ _String __r(__uninitialized_size_tag(),
+ __lhs_sz + __rhs_sz,
+ _String::__alloc_traits::select_on_container_copy_construction(__lhs.get_allocator()));
+ auto __ptr = std::__to_address(__r.__get_pointer());
+ _Traits::copy(__ptr, __lhs.data(), __lhs_sz);
+ _Traits::copy(__ptr + __lhs_sz, __rhs, __rhs_sz);
+ _Traits::assign(__ptr + __lhs_sz + __rhs_sz, 1, _CharT());
+ return __r;
+}
+
+template <class _CharT, class _Traits, class _Allocator>
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string<_CharT, _Traits, _Allocator>
+operator+(const basic_string<_CharT, _Traits, _Allocator>& __lhs, _CharT __rhs) {
+ using _String = basic_string<_CharT, _Traits, _Allocator>;
+ typename _String::size_type __lhs_sz = __lhs.size();
+ _String __r(__uninitialized_size_tag(),
+ __lhs_sz + 1,
+ _String::__alloc_traits::select_on_container_copy_construction(__lhs.get_allocator()));
+ auto __ptr = std::__to_address(__r.__get_pointer());
+ _Traits::copy(__ptr, __lhs.data(), __lhs_sz);
+ _Traits::assign(__ptr + __lhs_sz, 1, __rhs);
+ _Traits::assign(__ptr + 1 + __lhs_sz, 1, _CharT());
+ return __r;
}
#ifndef _LIBCPP_CXX03_LANG
-template<class _CharT, class _Traits, class _Allocator>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-basic_string<_CharT, _Traits, _Allocator>
-operator+(basic_string<_CharT, _Traits, _Allocator>&& __lhs, const basic_string<_CharT, _Traits, _Allocator>& __rhs)
-{
- return std::move(__lhs.append(__rhs));
+template <class _CharT, class _Traits, class _Allocator>
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string<_CharT, _Traits, _Allocator>
+operator+(basic_string<_CharT, _Traits, _Allocator>&& __lhs, const basic_string<_CharT, _Traits, _Allocator>& __rhs) {
+ return std::move(__lhs.append(__rhs));
}
-template<class _CharT, class _Traits, class _Allocator>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-basic_string<_CharT, _Traits, _Allocator>
-operator+(const basic_string<_CharT, _Traits, _Allocator>& __lhs, basic_string<_CharT, _Traits, _Allocator>&& __rhs)
-{
- return std::move(__rhs.insert(0, __lhs));
+template <class _CharT, class _Traits, class _Allocator>
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string<_CharT, _Traits, _Allocator>
+operator+(const basic_string<_CharT, _Traits, _Allocator>& __lhs, basic_string<_CharT, _Traits, _Allocator>&& __rhs) {
+ return std::move(__rhs.insert(0, __lhs));
}
-template<class _CharT, class _Traits, class _Allocator>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-basic_string<_CharT, _Traits, _Allocator>
-operator+(basic_string<_CharT, _Traits, _Allocator>&& __lhs, basic_string<_CharT, _Traits, _Allocator>&& __rhs)
-{
- return std::move(__lhs.append(__rhs));
+template <class _CharT, class _Traits, class _Allocator>
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string<_CharT, _Traits, _Allocator>
+operator+(basic_string<_CharT, _Traits, _Allocator>&& __lhs, basic_string<_CharT, _Traits, _Allocator>&& __rhs) {
+ return std::move(__lhs.append(__rhs));
}
-template<class _CharT, class _Traits, class _Allocator>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-basic_string<_CharT, _Traits, _Allocator>
-operator+(const _CharT* __lhs , basic_string<_CharT,_Traits,_Allocator>&& __rhs)
-{
- return std::move(__rhs.insert(0, __lhs));
+template <class _CharT, class _Traits, class _Allocator>
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string<_CharT, _Traits, _Allocator>
+operator+(const _CharT* __lhs, basic_string<_CharT, _Traits, _Allocator>&& __rhs) {
+ return std::move(__rhs.insert(0, __lhs));
}
-template<class _CharT, class _Traits, class _Allocator>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-basic_string<_CharT, _Traits, _Allocator>
-operator+(_CharT __lhs, basic_string<_CharT,_Traits,_Allocator>&& __rhs)
-{
- __rhs.insert(__rhs.begin(), __lhs);
- return std::move(__rhs);
+template <class _CharT, class _Traits, class _Allocator>
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string<_CharT, _Traits, _Allocator>
+operator+(_CharT __lhs, basic_string<_CharT, _Traits, _Allocator>&& __rhs) {
+ __rhs.insert(__rhs.begin(), __lhs);
+ return std::move(__rhs);
}
-template<class _CharT, class _Traits, class _Allocator>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-basic_string<_CharT, _Traits, _Allocator>
-operator+(basic_string<_CharT, _Traits, _Allocator>&& __lhs, const _CharT* __rhs)
-{
- return std::move(__lhs.append(__rhs));
+template <class _CharT, class _Traits, class _Allocator>
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string<_CharT, _Traits, _Allocator>
+operator+(basic_string<_CharT, _Traits, _Allocator>&& __lhs, const _CharT* __rhs) {
+ return std::move(__lhs.append(__rhs));
}
-template<class _CharT, class _Traits, class _Allocator>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-basic_string<_CharT, _Traits, _Allocator>
-operator+(basic_string<_CharT, _Traits, _Allocator>&& __lhs, _CharT __rhs)
-{
- __lhs.push_back(__rhs);
- return std::move(__lhs);
+template <class _CharT, class _Traits, class _Allocator>
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string<_CharT, _Traits, _Allocator>
+operator+(basic_string<_CharT, _Traits, _Allocator>&& __lhs, _CharT __rhs) {
+ __lhs.push_back(__rhs);
+ return std::move(__lhs);
}
#endif // _LIBCPP_CXX03_LANG
// swap
-template<class _CharT, class _Traits, class _Allocator>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-void
-swap(basic_string<_CharT, _Traits, _Allocator>& __lhs,
- basic_string<_CharT, _Traits, _Allocator>& __rhs)
- _NOEXCEPT_(_NOEXCEPT_(__lhs.swap(__rhs)))
-{
- __lhs.swap(__rhs);
+template <class _CharT, class _Traits, class _Allocator>
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void
+swap(basic_string<_CharT, _Traits, _Allocator>& __lhs, basic_string<_CharT, _Traits, _Allocator>& __rhs)
+ _NOEXCEPT_(_NOEXCEPT_(__lhs.swap(__rhs))) {
+ __lhs.swap(__rhs);
}
-_LIBCPP_EXPORTED_FROM_ABI int stoi (const string& __str, size_t* __idx = nullptr, int __base = 10);
-_LIBCPP_EXPORTED_FROM_ABI long stol (const string& __str, size_t* __idx = nullptr, int __base = 10);
-_LIBCPP_EXPORTED_FROM_ABI unsigned long stoul (const string& __str, size_t* __idx = nullptr, int __base = 10);
-_LIBCPP_EXPORTED_FROM_ABI long long stoll (const string& __str, size_t* __idx = nullptr, int __base = 10);
+_LIBCPP_EXPORTED_FROM_ABI int stoi(const string& __str, size_t* __idx = nullptr, int __base = 10);
+_LIBCPP_EXPORTED_FROM_ABI long stol(const string& __str, size_t* __idx = nullptr, int __base = 10);
+_LIBCPP_EXPORTED_FROM_ABI unsigned long stoul(const string& __str, size_t* __idx = nullptr, int __base = 10);
+_LIBCPP_EXPORTED_FROM_ABI long long stoll(const string& __str, size_t* __idx = nullptr, int __base = 10);
_LIBCPP_EXPORTED_FROM_ABI unsigned long long stoull(const string& __str, size_t* __idx = nullptr, int __base = 10);
-_LIBCPP_EXPORTED_FROM_ABI float stof (const string& __str, size_t* __idx = nullptr);
-_LIBCPP_EXPORTED_FROM_ABI double stod (const string& __str, size_t* __idx = nullptr);
+_LIBCPP_EXPORTED_FROM_ABI float stof(const string& __str, size_t* __idx = nullptr);
+_LIBCPP_EXPORTED_FROM_ABI double stod(const string& __str, size_t* __idx = nullptr);
_LIBCPP_EXPORTED_FROM_ABI long double stold(const string& __str, size_t* __idx = nullptr);
_LIBCPP_EXPORTED_FROM_ABI string to_string(int __val);
@@ -4457,14 +4023,14 @@ _LIBCPP_EXPORTED_FROM_ABI string to_string(double __val);
_LIBCPP_EXPORTED_FROM_ABI string to_string(long double __val);
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
-_LIBCPP_EXPORTED_FROM_ABI int stoi (const wstring& __str, size_t* __idx = nullptr, int __base = 10);
-_LIBCPP_EXPORTED_FROM_ABI long stol (const wstring& __str, size_t* __idx = nullptr, int __base = 10);
-_LIBCPP_EXPORTED_FROM_ABI unsigned long stoul (const wstring& __str, size_t* __idx = nullptr, int __base = 10);
-_LIBCPP_EXPORTED_FROM_ABI long long stoll (const wstring& __str, size_t* __idx = nullptr, int __base = 10);
+_LIBCPP_EXPORTED_FROM_ABI int stoi(const wstring& __str, size_t* __idx = nullptr, int __base = 10);
+_LIBCPP_EXPORTED_FROM_ABI long stol(const wstring& __str, size_t* __idx = nullptr, int __base = 10);
+_LIBCPP_EXPORTED_FROM_ABI unsigned long stoul(const wstring& __str, size_t* __idx = nullptr, int __base = 10);
+_LIBCPP_EXPORTED_FROM_ABI long long stoll(const wstring& __str, size_t* __idx = nullptr, int __base = 10);
_LIBCPP_EXPORTED_FROM_ABI unsigned long long stoull(const wstring& __str, size_t* __idx = nullptr, int __base = 10);
-_LIBCPP_EXPORTED_FROM_ABI float stof (const wstring& __str, size_t* __idx = nullptr);
-_LIBCPP_EXPORTED_FROM_ABI double stod (const wstring& __str, size_t* __idx = nullptr);
+_LIBCPP_EXPORTED_FROM_ABI float stof(const wstring& __str, size_t* __idx = nullptr);
+_LIBCPP_EXPORTED_FROM_ABI double stod(const wstring& __str, size_t* __idx = nullptr);
_LIBCPP_EXPORTED_FROM_ABI long double stold(const wstring& __str, size_t* __idx = nullptr);
_LIBCPP_EXPORTED_FROM_ABI wstring to_wstring(int __val);
@@ -4478,17 +4044,16 @@ _LIBCPP_EXPORTED_FROM_ABI wstring to_wstring(double __val);
_LIBCPP_EXPORTED_FROM_ABI wstring to_wstring(long double __val);
#endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS
-template<class _CharT, class _Traits, class _Allocator>
-_LIBCPP_TEMPLATE_DATA_VIS
-const typename basic_string<_CharT, _Traits, _Allocator>::size_type
- basic_string<_CharT, _Traits, _Allocator>::npos;
+template <class _CharT, class _Traits, class _Allocator>
+_LIBCPP_TEMPLATE_DATA_VIS const typename basic_string<_CharT, _Traits, _Allocator>::size_type
+ basic_string<_CharT, _Traits, _Allocator>::npos;
template <class _CharT, class _Allocator>
struct __string_hash : public __unary_function<basic_string<_CharT, char_traits<_CharT>, _Allocator>, size_t> {
- _LIBCPP_HIDE_FROM_ABI size_t
- operator()(const basic_string<_CharT, char_traits<_CharT>, _Allocator>& __val) const _NOEXCEPT {
- return std::__do_string_hash(__val.data(), __val.data() + __val.size());
- }
+ _LIBCPP_HIDE_FROM_ABI size_t
+ operator()(const basic_string<_CharT, char_traits<_CharT>, _Allocator>& __val) const _NOEXCEPT {
+ return std::__do_string_hash(__val.data(), __val.data() + __val.size());
+ }
};
template <class _Allocator>
@@ -4510,111 +4075,90 @@ template <class _Allocator>
struct hash<basic_string<wchar_t, char_traits<wchar_t>, _Allocator> > : __string_hash<wchar_t, _Allocator> {};
#endif
-template<class _CharT, class _Traits, class _Allocator>
+template <class _CharT, class _Traits, class _Allocator>
_LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>&
-operator<<(basic_ostream<_CharT, _Traits>& __os,
- const basic_string<_CharT, _Traits, _Allocator>& __str);
+operator<<(basic_ostream<_CharT, _Traits>& __os, const basic_string<_CharT, _Traits, _Allocator>& __str);
-template<class _CharT, class _Traits, class _Allocator>
+template <class _CharT, class _Traits, class _Allocator>
_LIBCPP_HIDE_FROM_ABI basic_istream<_CharT, _Traits>&
-operator>>(basic_istream<_CharT, _Traits>& __is,
- basic_string<_CharT, _Traits, _Allocator>& __str);
+operator>>(basic_istream<_CharT, _Traits>& __is, basic_string<_CharT, _Traits, _Allocator>& __str);
-template<class _CharT, class _Traits, class _Allocator>
+template <class _CharT, class _Traits, class _Allocator>
_LIBCPP_HIDE_FROM_ABI basic_istream<_CharT, _Traits>&
-getline(basic_istream<_CharT, _Traits>& __is,
- basic_string<_CharT, _Traits, _Allocator>& __str, _CharT __dlm);
-
-template<class _CharT, class _Traits, class _Allocator>
-inline _LIBCPP_HIDE_FROM_ABI
-basic_istream<_CharT, _Traits>&
-getline(basic_istream<_CharT, _Traits>& __is,
- basic_string<_CharT, _Traits, _Allocator>& __str);
-
-template<class _CharT, class _Traits, class _Allocator>
-inline _LIBCPP_HIDE_FROM_ABI
-basic_istream<_CharT, _Traits>&
-getline(basic_istream<_CharT, _Traits>&& __is,
- basic_string<_CharT, _Traits, _Allocator>& __str, _CharT __dlm);
-
-template<class _CharT, class _Traits, class _Allocator>
-inline _LIBCPP_HIDE_FROM_ABI
-basic_istream<_CharT, _Traits>&
-getline(basic_istream<_CharT, _Traits>&& __is,
- basic_string<_CharT, _Traits, _Allocator>& __str);
+getline(basic_istream<_CharT, _Traits>& __is, basic_string<_CharT, _Traits, _Allocator>& __str, _CharT __dlm);
+
+template <class _CharT, class _Traits, class _Allocator>
+inline _LIBCPP_HIDE_FROM_ABI basic_istream<_CharT, _Traits>&
+getline(basic_istream<_CharT, _Traits>& __is, basic_string<_CharT, _Traits, _Allocator>& __str);
+
+template <class _CharT, class _Traits, class _Allocator>
+inline _LIBCPP_HIDE_FROM_ABI basic_istream<_CharT, _Traits>&
+getline(basic_istream<_CharT, _Traits>&& __is, basic_string<_CharT, _Traits, _Allocator>& __str, _CharT __dlm);
+
+template <class _CharT, class _Traits, class _Allocator>
+inline _LIBCPP_HIDE_FROM_ABI basic_istream<_CharT, _Traits>&
+getline(basic_istream<_CharT, _Traits>&& __is, basic_string<_CharT, _Traits, _Allocator>& __str);
#if _LIBCPP_STD_VER >= 20
template <class _CharT, class _Traits, class _Allocator, class _Up>
-inline _LIBCPP_HIDE_FROM_ABI
- typename basic_string<_CharT, _Traits, _Allocator>::size_type
- erase(basic_string<_CharT, _Traits, _Allocator>& __str, const _Up& __v) {
+inline _LIBCPP_HIDE_FROM_ABI typename basic_string<_CharT, _Traits, _Allocator>::size_type
+erase(basic_string<_CharT, _Traits, _Allocator>& __str, const _Up& __v) {
auto __old_size = __str.size();
__str.erase(std::remove(__str.begin(), __str.end(), __v), __str.end());
return __old_size - __str.size();
}
template <class _CharT, class _Traits, class _Allocator, class _Predicate>
-inline _LIBCPP_HIDE_FROM_ABI
- typename basic_string<_CharT, _Traits, _Allocator>::size_type
- erase_if(basic_string<_CharT, _Traits, _Allocator>& __str,
- _Predicate __pred) {
+inline _LIBCPP_HIDE_FROM_ABI typename basic_string<_CharT, _Traits, _Allocator>::size_type
+erase_if(basic_string<_CharT, _Traits, _Allocator>& __str, _Predicate __pred) {
auto __old_size = __str.size();
- __str.erase(std::remove_if(__str.begin(), __str.end(), __pred),
- __str.end());
+ __str.erase(std::remove_if(__str.begin(), __str.end(), __pred), __str.end());
return __old_size - __str.size();
}
#endif
#if _LIBCPP_STD_VER >= 14
// Literal suffixes for basic_string [basic.string.literals]
-inline namespace literals
-{
- inline namespace string_literals
- {
- inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- basic_string<char> operator""s( const char *__str, size_t __len )
- {
- return basic_string<char> (__str, __len);
- }
+inline namespace literals {
+inline namespace string_literals {
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string<char>
+operator""s(const char* __str, size_t __len) {
+ return basic_string<char>(__str, __len);
+}
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
- inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- basic_string<wchar_t> operator""s( const wchar_t *__str, size_t __len )
- {
- return basic_string<wchar_t> (__str, __len);
- }
-#endif
+# ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string<wchar_t>
+operator""s(const wchar_t* __str, size_t __len) {
+ return basic_string<wchar_t>(__str, __len);
+}
+# endif
-#ifndef _LIBCPP_HAS_NO_CHAR8_T
- inline _LIBCPP_HIDE_FROM_ABI constexpr
- basic_string<char8_t> operator""s(const char8_t *__str, size_t __len)
- {
- return basic_string<char8_t> (__str, __len);
- }
-#endif
+# ifndef _LIBCPP_HAS_NO_CHAR8_T
+inline _LIBCPP_HIDE_FROM_ABI constexpr basic_string<char8_t> operator""s(const char8_t* __str, size_t __len) {
+ return basic_string<char8_t>(__str, __len);
+}
+# endif
- inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- basic_string<char16_t> operator""s( const char16_t *__str, size_t __len )
- {
- return basic_string<char16_t> (__str, __len);
- }
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string<char16_t>
+operator""s(const char16_t* __str, size_t __len) {
+ return basic_string<char16_t>(__str, __len);
+}
- inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- basic_string<char32_t> operator""s( const char32_t *__str, size_t __len )
- {
- return basic_string<char32_t> (__str, __len);
- }
- } // namespace string_literals
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string<char32_t>
+operator""s(const char32_t* __str, size_t __len) {
+ return basic_string<char32_t>(__str, __len);
+}
+} // namespace string_literals
} // namespace literals
-#if _LIBCPP_STD_VER >= 20
+# if _LIBCPP_STD_VER >= 20
template <>
inline constexpr bool __format::__enable_insertable<std::basic_string<char>> = true;
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+# ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
template <>
inline constexpr bool __format::__enable_insertable<std::basic_string<wchar_t>> = true;
-#endif
-#endif
+# endif
+# endif
#endif
diff --git a/contrib/llvm-project/libcxx/include/string.h b/contrib/llvm-project/libcxx/include/string.h
index 673d90316d00..ae10d5ad2c76 100644
--- a/contrib/llvm-project/libcxx/include/string.h
+++ b/contrib/llvm-project/libcxx/include/string.h
@@ -65,7 +65,7 @@ size_t strlen(const char* s);
// <string.h>. This macro can be defined by users if their C library provides
// the right signature.
#if defined(__CORRECT_ISO_CPP_STRING_H_PROTO) || defined(_LIBCPP_MSVCRT) || defined(_STRING_H_CPLUSPLUS_98_CONFORMANCE_)
-#define _LIBCPP_STRING_H_HAS_CONST_OVERLOADS
+# define _LIBCPP_STRING_H_HAS_CONST_OVERLOADS
#endif
#if defined(__cplusplus) && !defined(_LIBCPP_STRING_H_HAS_CONST_OVERLOADS) && defined(_LIBCPP_PREFERRED_OVERLOAD)
diff --git a/contrib/llvm-project/libcxx/include/string_view b/contrib/llvm-project/libcxx/include/string_view
index 3712584a6666..909224fe7e3d 100644
--- a/contrib/llvm-project/libcxx/include/string_view
+++ b/contrib/llvm-project/libcxx/include/string_view
@@ -255,505 +255,421 @@ namespace std {
_LIBCPP_PUSH_MACROS
#include <__undef_macros>
-
_LIBCPP_BEGIN_NAMESPACE_STD
// TODO: This is a workaround for some vendors to carry a downstream diff to accept `nullptr` in
// string_view constructors. This can be refactored when this exact form isn't needed anymore.
template <class _Traits>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR
-inline size_t __char_traits_length_checked(const typename _Traits::char_type* __s) _NOEXCEPT {
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR inline size_t
+__char_traits_length_checked(const typename _Traits::char_type* __s) _NOEXCEPT {
// This needs to be a single statement for C++11 constexpr
return _LIBCPP_ASSERT_NON_NULL(
__s != nullptr, "null pointer passed to non-null argument of char_traits<...>::length"),
_Traits::length(__s);
}
-template<class _CharT, class _Traits>
+template <class _CharT, class _Traits>
class basic_string_view {
public:
- // types
- using traits_type = _Traits;
- using value_type = _CharT;
- using pointer = _CharT*;
- using const_pointer = const _CharT*;
- using reference = _CharT&;
- using const_reference = const _CharT&;
+ // types
+ using traits_type = _Traits;
+ using value_type = _CharT;
+ using pointer = _CharT*;
+ using const_pointer = const _CharT*;
+ using reference = _CharT&;
+ using const_reference = const _CharT&;
#ifdef _LIBCPP_ABI_BOUNDED_ITERATORS
- using const_iterator = __bounded_iter<const_pointer>;
+ using const_iterator = __bounded_iter<const_pointer>;
#else
- using const_iterator = const_pointer; // See [string.view.iterators]
+ using const_iterator = const_pointer; // See [string.view.iterators]
#endif
- using iterator = const_iterator;
- using const_reverse_iterator = std::reverse_iterator<const_iterator>;
- using reverse_iterator = const_reverse_iterator;
- using size_type = size_t;
- using difference_type = ptrdiff_t;
- static _LIBCPP_CONSTEXPR const size_type npos = -1; // size_type(-1);
-
- static_assert((!is_array<value_type>::value), "Character type of basic_string_view must not be an array");
- static_assert(( is_standard_layout<value_type>::value), "Character type of basic_string_view must be standard-layout");
- static_assert(( is_trivial<value_type>::value), "Character type of basic_string_view must be trivial");
- static_assert((is_same<_CharT, typename traits_type::char_type>::value),
- "traits_type::char_type must be the same type as CharT");
-
- // [string.view.cons], construct/copy
- _LIBCPP_CONSTEXPR _LIBCPP_HIDE_FROM_ABI
- basic_string_view() _NOEXCEPT : __data_(nullptr), __size_(0) {}
-
- _LIBCPP_HIDE_FROM_ABI
- basic_string_view(const basic_string_view&) _NOEXCEPT = default;
-
- _LIBCPP_HIDE_FROM_ABI
- basic_string_view& operator=(const basic_string_view&) _NOEXCEPT = default;
-
- _LIBCPP_CONSTEXPR _LIBCPP_HIDE_FROM_ABI
- basic_string_view(const _CharT* __s, size_type __len) _NOEXCEPT
- : __data_(__s), __size_(__len)
- {
+ using iterator = const_iterator;
+ using const_reverse_iterator = std::reverse_iterator<const_iterator>;
+ using reverse_iterator = const_reverse_iterator;
+ using size_type = size_t;
+ using difference_type = ptrdiff_t;
+ static _LIBCPP_CONSTEXPR const size_type npos = -1; // size_type(-1);
+
+ static_assert((!is_array<value_type>::value), "Character type of basic_string_view must not be an array");
+ static_assert((is_standard_layout<value_type>::value), "Character type of basic_string_view must be standard-layout");
+ static_assert((is_trivial<value_type>::value), "Character type of basic_string_view must be trivial");
+ static_assert((is_same<_CharT, typename traits_type::char_type>::value),
+ "traits_type::char_type must be the same type as CharT");
+
+ // [string.view.cons], construct/copy
+ _LIBCPP_CONSTEXPR _LIBCPP_HIDE_FROM_ABI basic_string_view() _NOEXCEPT : __data_(nullptr), __size_(0) {}
+
+ _LIBCPP_HIDE_FROM_ABI basic_string_view(const basic_string_view&) _NOEXCEPT = default;
+
+ _LIBCPP_HIDE_FROM_ABI basic_string_view& operator=(const basic_string_view&) _NOEXCEPT = default;
+
+ _LIBCPP_CONSTEXPR _LIBCPP_HIDE_FROM_ABI basic_string_view(const _CharT* __s, size_type __len) _NOEXCEPT
+ : __data_(__s),
+ __size_(__len) {
#if _LIBCPP_STD_VER >= 14
- _LIBCPP_ASSERT_UNCATEGORIZED(
- __len <= static_cast<size_type>(numeric_limits<difference_type>::max()),
- "string_view::string_view(_CharT *, size_t): length does not fit in difference_type");
+ _LIBCPP_ASSERT_UNCATEGORIZED(__len <= static_cast<size_type>(numeric_limits<difference_type>::max()),
+ "string_view::string_view(_CharT *, size_t): length does not fit in difference_type");
_LIBCPP_ASSERT_NON_NULL(
__len == 0 || __s != nullptr, "string_view::string_view(_CharT *, size_t): received nullptr");
#endif
- }
+ }
#if _LIBCPP_STD_VER >= 20
- template <contiguous_iterator _It, sized_sentinel_for<_It> _End>
- requires (is_same_v<iter_value_t<_It>, _CharT> && !is_convertible_v<_End, size_type>)
- constexpr _LIBCPP_HIDE_FROM_ABI basic_string_view(_It __begin, _End __end)
- : __data_(std::to_address(__begin)), __size_(__end - __begin)
- {
- _LIBCPP_ASSERT_VALID_INPUT_RANGE((__end - __begin) >= 0,
- "std::string_view::string_view(iterator, sentinel) received invalid range");
- }
+ template <contiguous_iterator _It, sized_sentinel_for<_It> _End>
+ requires(is_same_v<iter_value_t<_It>, _CharT> && !is_convertible_v<_End, size_type>)
+ constexpr _LIBCPP_HIDE_FROM_ABI basic_string_view(_It __begin, _End __end)
+ : __data_(std::to_address(__begin)), __size_(__end - __begin) {
+ _LIBCPP_ASSERT_VALID_INPUT_RANGE(
+ (__end - __begin) >= 0, "std::string_view::string_view(iterator, sentinel) received invalid range");
+ }
#endif // _LIBCPP_STD_VER >= 20
#if _LIBCPP_STD_VER >= 23
- template <class _Range>
- requires (
- !is_same_v<remove_cvref_t<_Range>, basic_string_view> &&
- ranges::contiguous_range<_Range> &&
- ranges::sized_range<_Range> &&
- is_same_v<ranges::range_value_t<_Range>, _CharT> &&
- !is_convertible_v<_Range, const _CharT*> &&
- (!requires(remove_cvref_t<_Range>& __d) {
- __d.operator std::basic_string_view<_CharT, _Traits>();
- })
- )
- constexpr explicit _LIBCPP_HIDE_FROM_ABI
- basic_string_view(_Range&& __r) : __data_(ranges::data(__r)), __size_(ranges::size(__r)) {}
+ template <class _Range>
+ requires(!is_same_v<remove_cvref_t<_Range>, basic_string_view> && ranges::contiguous_range<_Range> &&
+ ranges::sized_range<_Range> && is_same_v<ranges::range_value_t<_Range>, _CharT> &&
+ !is_convertible_v<_Range, const _CharT*> &&
+ (!requires(remove_cvref_t<_Range>& __d) { __d.operator std::basic_string_view<_CharT, _Traits>(); }))
+ constexpr explicit _LIBCPP_HIDE_FROM_ABI basic_string_view(_Range&& __r)
+ : __data_(ranges::data(__r)), __size_(ranges::size(__r)) {}
#endif // _LIBCPP_STD_VER >= 23
- _LIBCPP_CONSTEXPR _LIBCPP_HIDE_FROM_ABI
- basic_string_view(const _CharT* __s)
- : __data_(__s), __size_(std::__char_traits_length_checked<_Traits>(__s)) {}
+ _LIBCPP_CONSTEXPR _LIBCPP_HIDE_FROM_ABI basic_string_view(const _CharT* __s)
+ : __data_(__s), __size_(std::__char_traits_length_checked<_Traits>(__s)) {}
#if _LIBCPP_STD_VER >= 23
- basic_string_view(nullptr_t) = delete;
+ basic_string_view(nullptr_t) = delete;
#endif
- // [string.view.iterators], iterators
- _LIBCPP_CONSTEXPR _LIBCPP_HIDE_FROM_ABI
- const_iterator begin() const _NOEXCEPT { return cbegin(); }
+ // [string.view.iterators], iterators
+ _LIBCPP_CONSTEXPR _LIBCPP_HIDE_FROM_ABI const_iterator begin() const _NOEXCEPT { return cbegin(); }
- _LIBCPP_CONSTEXPR _LIBCPP_HIDE_FROM_ABI
- const_iterator end() const _NOEXCEPT { return cend(); }
+ _LIBCPP_CONSTEXPR _LIBCPP_HIDE_FROM_ABI const_iterator end() const _NOEXCEPT { return cend(); }
- _LIBCPP_CONSTEXPR _LIBCPP_HIDE_FROM_ABI
- const_iterator cbegin() const _NOEXCEPT {
+ _LIBCPP_CONSTEXPR _LIBCPP_HIDE_FROM_ABI const_iterator cbegin() const _NOEXCEPT {
#ifdef _LIBCPP_ABI_BOUNDED_ITERATORS
- return std::__make_bounded_iter(data(), data(), data() + size());
+ return std::__make_bounded_iter(data(), data(), data() + size());
#else
- return __data_;
+ return __data_;
#endif
- }
+ }
- _LIBCPP_CONSTEXPR _LIBCPP_HIDE_FROM_ABI
- const_iterator cend() const _NOEXCEPT {
+ _LIBCPP_CONSTEXPR _LIBCPP_HIDE_FROM_ABI const_iterator cend() const _NOEXCEPT {
#ifdef _LIBCPP_ABI_BOUNDED_ITERATORS
- return std::__make_bounded_iter(data() + size(), data(), data() + size());
+ return std::__make_bounded_iter(data() + size(), data(), data() + size());
#else
- return __data_ + __size_;
+ return __data_ + __size_;
#endif
- }
-
- _LIBCPP_CONSTEXPR_SINCE_CXX17 _LIBCPP_HIDE_FROM_ABI
- const_reverse_iterator rbegin() const _NOEXCEPT { return const_reverse_iterator(cend()); }
-
- _LIBCPP_CONSTEXPR_SINCE_CXX17 _LIBCPP_HIDE_FROM_ABI
- const_reverse_iterator rend() const _NOEXCEPT { return const_reverse_iterator(cbegin()); }
-
- _LIBCPP_CONSTEXPR_SINCE_CXX17 _LIBCPP_HIDE_FROM_ABI
- const_reverse_iterator crbegin() const _NOEXCEPT { return const_reverse_iterator(cend()); }
-
- _LIBCPP_CONSTEXPR_SINCE_CXX17 _LIBCPP_HIDE_FROM_ABI
- const_reverse_iterator crend() const _NOEXCEPT { return const_reverse_iterator(cbegin()); }
-
- // [string.view.capacity], capacity
- _LIBCPP_CONSTEXPR _LIBCPP_HIDE_FROM_ABI
- size_type size() const _NOEXCEPT { return __size_; }
-
- _LIBCPP_CONSTEXPR _LIBCPP_HIDE_FROM_ABI
- size_type length() const _NOEXCEPT { return __size_; }
-
- _LIBCPP_CONSTEXPR _LIBCPP_HIDE_FROM_ABI
- size_type max_size() const _NOEXCEPT { return numeric_limits<size_type>::max() / sizeof(value_type); }
-
- _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR
- bool empty() const _NOEXCEPT { return __size_ == 0; }
-
- // [string.view.access], element access
- _LIBCPP_CONSTEXPR _LIBCPP_HIDE_FROM_ABI
- const_reference operator[](size_type __pos) const _NOEXCEPT {
- return _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__pos < size(), "string_view[] index out of bounds"), __data_[__pos];
- }
-
- _LIBCPP_CONSTEXPR _LIBCPP_HIDE_FROM_ABI
- const_reference at(size_type __pos) const
- {
- return __pos >= size()
- ? (__throw_out_of_range("string_view::at"), __data_[0])
- : __data_[__pos];
- }
-
- _LIBCPP_CONSTEXPR _LIBCPP_HIDE_FROM_ABI
- const_reference front() const _NOEXCEPT
- {
- return _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(!empty(), "string_view::front(): string is empty"), __data_[0];
- }
-
- _LIBCPP_CONSTEXPR _LIBCPP_HIDE_FROM_ABI
- const_reference back() const _NOEXCEPT
- {
- return _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(!empty(), "string_view::back(): string is empty"),
- __data_[__size_ - 1];
- }
-
- _LIBCPP_CONSTEXPR _LIBCPP_HIDE_FROM_ABI
- const_pointer data() const _NOEXCEPT { return __data_; }
-
- // [string.view.modifiers], modifiers:
- _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
- void remove_prefix(size_type __n) _NOEXCEPT
- {
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__n <= size(), "remove_prefix() can't remove more than size()");
- __data_ += __n;
- __size_ -= __n;
- }
-
- _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
- void remove_suffix(size_type __n) _NOEXCEPT
- {
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__n <= size(), "remove_suffix() can't remove more than size()");
- __size_ -= __n;
- }
-
- _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
- void swap(basic_string_view& __other) _NOEXCEPT
- {
- const value_type *__p = __data_;
- __data_ = __other.__data_;
- __other.__data_ = __p;
-
- size_type __sz = __size_;
- __size_ = __other.__size_;
- __other.__size_ = __sz;
- }
-
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- size_type copy(_CharT* __s, size_type __n, size_type __pos = 0) const
- {
- if (__pos > size())
- __throw_out_of_range("string_view::copy");
- size_type __rlen = std::min(__n, size() - __pos);
- _Traits::copy(__s, data() + __pos, __rlen);
- return __rlen;
- }
-
- _LIBCPP_CONSTEXPR _LIBCPP_HIDE_FROM_ABI
- basic_string_view substr(size_type __pos = 0, size_type __n = npos) const
- {
- return __pos > size()
- ? (__throw_out_of_range("string_view::substr"), basic_string_view())
- : basic_string_view(data() + __pos, std::min(__n, size() - __pos));
- }
-
- _LIBCPP_CONSTEXPR_SINCE_CXX14 int compare(basic_string_view __sv) const _NOEXCEPT
- {
- size_type __rlen = std::min(size(), __sv.size());
- int __retval = _Traits::compare(data(), __sv.data(), __rlen);
- if (__retval == 0) // first __rlen chars matched
- __retval = size() == __sv.size() ? 0 : (size() < __sv.size() ? -1 : 1);
- return __retval;
- }
-
- _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
- int compare(size_type __pos1, size_type __n1, basic_string_view __sv) const
- {
- return substr(__pos1, __n1).compare(__sv);
- }
-
- _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
- int compare( size_type __pos1, size_type __n1,
- basic_string_view __sv, size_type __pos2, size_type __n2) const
- {
- return substr(__pos1, __n1).compare(__sv.substr(__pos2, __n2));
- }
-
- _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
- int compare(const _CharT* __s) const _NOEXCEPT
- {
- return compare(basic_string_view(__s));
- }
-
- _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
- int compare(size_type __pos1, size_type __n1, const _CharT* __s) const
- {
- return substr(__pos1, __n1).compare(basic_string_view(__s));
- }
-
- _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
- int compare(size_type __pos1, size_type __n1, const _CharT* __s, size_type __n2) const
- {
- return substr(__pos1, __n1).compare(basic_string_view(__s, __n2));
- }
-
- // find
- _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
- size_type find(basic_string_view __s, size_type __pos = 0) const _NOEXCEPT
- {
- _LIBCPP_ASSERT_NON_NULL(__s.size() == 0 || __s.data() != nullptr, "string_view::find(): received nullptr");
- return std::__str_find<value_type, size_type, traits_type, npos>
- (data(), size(), __s.data(), __pos, __s.size());
- }
-
- _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
- size_type find(_CharT __c, size_type __pos = 0) const _NOEXCEPT
- {
- return std::__str_find<value_type, size_type, traits_type, npos>
- (data(), size(), __c, __pos);
- }
-
- _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
- size_type find(const _CharT* __s, size_type __pos, size_type __n) const _NOEXCEPT
- {
- _LIBCPP_ASSERT_NON_NULL(__n == 0 || __s != nullptr, "string_view::find(): received nullptr");
- return std::__str_find<value_type, size_type, traits_type, npos>
- (data(), size(), __s, __pos, __n);
- }
-
- _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
- size_type find(const _CharT* __s, size_type __pos = 0) const _NOEXCEPT
- {
- _LIBCPP_ASSERT_NON_NULL(__s != nullptr, "string_view::find(): received nullptr");
- return std::__str_find<value_type, size_type, traits_type, npos>
- (data(), size(), __s, __pos, traits_type::length(__s));
- }
-
- // rfind
- _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
- size_type rfind(basic_string_view __s, size_type __pos = npos) const _NOEXCEPT
- {
- _LIBCPP_ASSERT_NON_NULL(__s.size() == 0 || __s.data() != nullptr, "string_view::find(): received nullptr");
- return std::__str_rfind<value_type, size_type, traits_type, npos>
- (data(), size(), __s.data(), __pos, __s.size());
- }
-
- _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
- size_type rfind(_CharT __c, size_type __pos = npos) const _NOEXCEPT
- {
- return std::__str_rfind<value_type, size_type, traits_type, npos>
- (data(), size(), __c, __pos);
- }
-
- _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
- size_type rfind(const _CharT* __s, size_type __pos, size_type __n) const _NOEXCEPT
- {
- _LIBCPP_ASSERT_NON_NULL(__n == 0 || __s != nullptr, "string_view::rfind(): received nullptr");
- return std::__str_rfind<value_type, size_type, traits_type, npos>
- (data(), size(), __s, __pos, __n);
- }
-
- _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
- size_type rfind(const _CharT* __s, size_type __pos=npos) const _NOEXCEPT
- {
- _LIBCPP_ASSERT_NON_NULL(__s != nullptr, "string_view::rfind(): received nullptr");
- return std::__str_rfind<value_type, size_type, traits_type, npos>
- (data(), size(), __s, __pos, traits_type::length(__s));
- }
-
- // find_first_of
- _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
- size_type find_first_of(basic_string_view __s, size_type __pos = 0) const _NOEXCEPT
- {
- _LIBCPP_ASSERT_NON_NULL(
- __s.size() == 0 || __s.data() != nullptr, "string_view::find_first_of(): received nullptr");
- return std::__str_find_first_of<value_type, size_type, traits_type, npos>
- (data(), size(), __s.data(), __pos, __s.size());
- }
-
- _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
- size_type find_first_of(_CharT __c, size_type __pos = 0) const _NOEXCEPT
- { return find(__c, __pos); }
-
- _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
- size_type find_first_of(const _CharT* __s, size_type __pos, size_type __n) const _NOEXCEPT
- {
- _LIBCPP_ASSERT_NON_NULL(__n == 0 || __s != nullptr, "string_view::find_first_of(): received nullptr");
- return std::__str_find_first_of<value_type, size_type, traits_type, npos>
- (data(), size(), __s, __pos, __n);
- }
-
- _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
- size_type find_first_of(const _CharT* __s, size_type __pos=0) const _NOEXCEPT
- {
- _LIBCPP_ASSERT_NON_NULL(__s != nullptr, "string_view::find_first_of(): received nullptr");
- return std::__str_find_first_of<value_type, size_type, traits_type, npos>
- (data(), size(), __s, __pos, traits_type::length(__s));
- }
-
- // find_last_of
- _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
- size_type find_last_of(basic_string_view __s, size_type __pos=npos) const _NOEXCEPT
- {
- _LIBCPP_ASSERT_NON_NULL(
- __s.size() == 0 || __s.data() != nullptr, "string_view::find_last_of(): received nullptr");
- return std::__str_find_last_of<value_type, size_type, traits_type, npos>
- (data(), size(), __s.data(), __pos, __s.size());
- }
-
- _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
- size_type find_last_of(_CharT __c, size_type __pos = npos) const _NOEXCEPT
- { return rfind(__c, __pos); }
-
- _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
- size_type find_last_of(const _CharT* __s, size_type __pos, size_type __n) const _NOEXCEPT
- {
- _LIBCPP_ASSERT_NON_NULL(__n == 0 || __s != nullptr, "string_view::find_last_of(): received nullptr");
- return std::__str_find_last_of<value_type, size_type, traits_type, npos>
- (data(), size(), __s, __pos, __n);
- }
-
- _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
- size_type find_last_of(const _CharT* __s, size_type __pos=npos) const _NOEXCEPT
- {
- _LIBCPP_ASSERT_NON_NULL(__s != nullptr, "string_view::find_last_of(): received nullptr");
- return std::__str_find_last_of<value_type, size_type, traits_type, npos>
- (data(), size(), __s, __pos, traits_type::length(__s));
- }
-
- // find_first_not_of
- _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
- size_type find_first_not_of(basic_string_view __s, size_type __pos=0) const _NOEXCEPT
- {
- _LIBCPP_ASSERT_NON_NULL(
- __s.size() == 0 || __s.data() != nullptr, "string_view::find_first_not_of(): received nullptr");
- return std::__str_find_first_not_of<value_type, size_type, traits_type, npos>
- (data(), size(), __s.data(), __pos, __s.size());
- }
-
- _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
- size_type find_first_not_of(_CharT __c, size_type __pos=0) const _NOEXCEPT
- {
- return std::__str_find_first_not_of<value_type, size_type, traits_type, npos>
- (data(), size(), __c, __pos);
- }
-
- _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
- size_type find_first_not_of(const _CharT* __s, size_type __pos, size_type __n) const _NOEXCEPT
- {
- _LIBCPP_ASSERT_NON_NULL(__n == 0 || __s != nullptr, "string_view::find_first_not_of(): received nullptr");
- return std::__str_find_first_not_of<value_type, size_type, traits_type, npos>
- (data(), size(), __s, __pos, __n);
- }
-
- _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
- size_type find_first_not_of(const _CharT* __s, size_type __pos=0) const _NOEXCEPT
- {
- _LIBCPP_ASSERT_NON_NULL(__s != nullptr, "string_view::find_first_not_of(): received nullptr");
- return std::__str_find_first_not_of<value_type, size_type, traits_type, npos>
- (data(), size(), __s, __pos, traits_type::length(__s));
- }
-
- // find_last_not_of
- _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
- size_type find_last_not_of(basic_string_view __s, size_type __pos=npos) const _NOEXCEPT
- {
- _LIBCPP_ASSERT_NON_NULL(
- __s.size() == 0 || __s.data() != nullptr, "string_view::find_last_not_of(): received nullptr");
- return std::__str_find_last_not_of<value_type, size_type, traits_type, npos>
- (data(), size(), __s.data(), __pos, __s.size());
- }
-
- _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
- size_type find_last_not_of(_CharT __c, size_type __pos=npos) const _NOEXCEPT
- {
- return std::__str_find_last_not_of<value_type, size_type, traits_type, npos>
- (data(), size(), __c, __pos);
- }
-
- _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
- size_type find_last_not_of(const _CharT* __s, size_type __pos, size_type __n) const _NOEXCEPT
- {
- _LIBCPP_ASSERT_NON_NULL(__n == 0 || __s != nullptr, "string_view::find_last_not_of(): received nullptr");
- return std::__str_find_last_not_of<value_type, size_type, traits_type, npos>
- (data(), size(), __s, __pos, __n);
- }
-
- _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
- size_type find_last_not_of(const _CharT* __s, size_type __pos=npos) const _NOEXCEPT
- {
- _LIBCPP_ASSERT_NON_NULL(__s != nullptr, "string_view::find_last_not_of(): received nullptr");
- return std::__str_find_last_not_of<value_type, size_type, traits_type, npos>
- (data(), size(), __s, __pos, traits_type::length(__s));
- }
+ }
+
+ _LIBCPP_CONSTEXPR_SINCE_CXX17 _LIBCPP_HIDE_FROM_ABI const_reverse_iterator rbegin() const _NOEXCEPT {
+ return const_reverse_iterator(cend());
+ }
+
+ _LIBCPP_CONSTEXPR_SINCE_CXX17 _LIBCPP_HIDE_FROM_ABI const_reverse_iterator rend() const _NOEXCEPT {
+ return const_reverse_iterator(cbegin());
+ }
+
+ _LIBCPP_CONSTEXPR_SINCE_CXX17 _LIBCPP_HIDE_FROM_ABI const_reverse_iterator crbegin() const _NOEXCEPT {
+ return const_reverse_iterator(cend());
+ }
+
+ _LIBCPP_CONSTEXPR_SINCE_CXX17 _LIBCPP_HIDE_FROM_ABI const_reverse_iterator crend() const _NOEXCEPT {
+ return const_reverse_iterator(cbegin());
+ }
+
+ // [string.view.capacity], capacity
+ _LIBCPP_CONSTEXPR _LIBCPP_HIDE_FROM_ABI size_type size() const _NOEXCEPT { return __size_; }
+
+ _LIBCPP_CONSTEXPR _LIBCPP_HIDE_FROM_ABI size_type length() const _NOEXCEPT { return __size_; }
+
+ _LIBCPP_CONSTEXPR _LIBCPP_HIDE_FROM_ABI size_type max_size() const _NOEXCEPT {
+ return numeric_limits<size_type>::max() / sizeof(value_type);
+ }
+
+ _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool empty() const _NOEXCEPT {
+ return __size_ == 0;
+ }
+
+ // [string.view.access], element access
+ _LIBCPP_CONSTEXPR _LIBCPP_HIDE_FROM_ABI const_reference operator[](size_type __pos) const _NOEXCEPT {
+ return _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__pos < size(), "string_view[] index out of bounds"), __data_[__pos];
+ }
+
+ _LIBCPP_CONSTEXPR _LIBCPP_HIDE_FROM_ABI const_reference at(size_type __pos) const {
+ return __pos >= size() ? (__throw_out_of_range("string_view::at"), __data_[0]) : __data_[__pos];
+ }
+
+ _LIBCPP_CONSTEXPR _LIBCPP_HIDE_FROM_ABI const_reference front() const _NOEXCEPT {
+ return _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(!empty(), "string_view::front(): string is empty"), __data_[0];
+ }
+
+ _LIBCPP_CONSTEXPR _LIBCPP_HIDE_FROM_ABI const_reference back() const _NOEXCEPT {
+ return _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(!empty(), "string_view::back(): string is empty"), __data_[__size_ - 1];
+ }
+
+ _LIBCPP_CONSTEXPR _LIBCPP_HIDE_FROM_ABI const_pointer data() const _NOEXCEPT { return __data_; }
+
+ // [string.view.modifiers], modifiers:
+ _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI void remove_prefix(size_type __n) _NOEXCEPT {
+ _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__n <= size(), "remove_prefix() can't remove more than size()");
+ __data_ += __n;
+ __size_ -= __n;
+ }
+
+ _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI void remove_suffix(size_type __n) _NOEXCEPT {
+ _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__n <= size(), "remove_suffix() can't remove more than size()");
+ __size_ -= __n;
+ }
+
+ _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI void swap(basic_string_view& __other) _NOEXCEPT {
+ const value_type* __p = __data_;
+ __data_ = __other.__data_;
+ __other.__data_ = __p;
+
+ size_type __sz = __size_;
+ __size_ = __other.__size_;
+ __other.__size_ = __sz;
+ }
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
+ copy(_CharT* __s, size_type __n, size_type __pos = 0) const {
+ if (__pos > size())
+ __throw_out_of_range("string_view::copy");
+ size_type __rlen = std::min(__n, size() - __pos);
+ _Traits::copy(__s, data() + __pos, __rlen);
+ return __rlen;
+ }
+
+ _LIBCPP_CONSTEXPR _LIBCPP_HIDE_FROM_ABI basic_string_view substr(size_type __pos = 0, size_type __n = npos) const {
+ return __pos > size() ? (__throw_out_of_range("string_view::substr"), basic_string_view())
+ : basic_string_view(data() + __pos, std::min(__n, size() - __pos));
+ }
+
+ _LIBCPP_CONSTEXPR_SINCE_CXX14 int compare(basic_string_view __sv) const _NOEXCEPT {
+ size_type __rlen = std::min(size(), __sv.size());
+ int __retval = _Traits::compare(data(), __sv.data(), __rlen);
+ if (__retval == 0) // first __rlen chars matched
+ __retval = size() == __sv.size() ? 0 : (size() < __sv.size() ? -1 : 1);
+ return __retval;
+ }
+
+ _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI int
+ compare(size_type __pos1, size_type __n1, basic_string_view __sv) const {
+ return substr(__pos1, __n1).compare(__sv);
+ }
+
+ _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI int
+ compare(size_type __pos1, size_type __n1, basic_string_view __sv, size_type __pos2, size_type __n2) const {
+ return substr(__pos1, __n1).compare(__sv.substr(__pos2, __n2));
+ }
+
+ _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI int compare(const _CharT* __s) const _NOEXCEPT {
+ return compare(basic_string_view(__s));
+ }
+
+ _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI int
+ compare(size_type __pos1, size_type __n1, const _CharT* __s) const {
+ return substr(__pos1, __n1).compare(basic_string_view(__s));
+ }
+
+ _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI int
+ compare(size_type __pos1, size_type __n1, const _CharT* __s, size_type __n2) const {
+ return substr(__pos1, __n1).compare(basic_string_view(__s, __n2));
+ }
+
+ // find
+ _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI size_type
+ find(basic_string_view __s, size_type __pos = 0) const _NOEXCEPT {
+ _LIBCPP_ASSERT_NON_NULL(__s.size() == 0 || __s.data() != nullptr, "string_view::find(): received nullptr");
+ return std::__str_find<value_type, size_type, traits_type, npos>(data(), size(), __s.data(), __pos, __s.size());
+ }
+
+ _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI size_type find(_CharT __c, size_type __pos = 0) const _NOEXCEPT {
+ return std::__str_find<value_type, size_type, traits_type, npos>(data(), size(), __c, __pos);
+ }
+
+ _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI size_type
+ find(const _CharT* __s, size_type __pos, size_type __n) const _NOEXCEPT {
+ _LIBCPP_ASSERT_NON_NULL(__n == 0 || __s != nullptr, "string_view::find(): received nullptr");
+ return std::__str_find<value_type, size_type, traits_type, npos>(data(), size(), __s, __pos, __n);
+ }
+
+ _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI size_type
+ find(const _CharT* __s, size_type __pos = 0) const _NOEXCEPT {
+ _LIBCPP_ASSERT_NON_NULL(__s != nullptr, "string_view::find(): received nullptr");
+ return std::__str_find<value_type, size_type, traits_type, npos>(
+ data(), size(), __s, __pos, traits_type::length(__s));
+ }
+
+ // rfind
+ _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI size_type
+ rfind(basic_string_view __s, size_type __pos = npos) const _NOEXCEPT {
+ _LIBCPP_ASSERT_NON_NULL(__s.size() == 0 || __s.data() != nullptr, "string_view::find(): received nullptr");
+ return std::__str_rfind<value_type, size_type, traits_type, npos>(data(), size(), __s.data(), __pos, __s.size());
+ }
+
+ _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI size_type
+ rfind(_CharT __c, size_type __pos = npos) const _NOEXCEPT {
+ return std::__str_rfind<value_type, size_type, traits_type, npos>(data(), size(), __c, __pos);
+ }
+
+ _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI size_type
+ rfind(const _CharT* __s, size_type __pos, size_type __n) const _NOEXCEPT {
+ _LIBCPP_ASSERT_NON_NULL(__n == 0 || __s != nullptr, "string_view::rfind(): received nullptr");
+ return std::__str_rfind<value_type, size_type, traits_type, npos>(data(), size(), __s, __pos, __n);
+ }
+
+ _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI size_type
+ rfind(const _CharT* __s, size_type __pos = npos) const _NOEXCEPT {
+ _LIBCPP_ASSERT_NON_NULL(__s != nullptr, "string_view::rfind(): received nullptr");
+ return std::__str_rfind<value_type, size_type, traits_type, npos>(
+ data(), size(), __s, __pos, traits_type::length(__s));
+ }
+
+ // find_first_of
+ _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI size_type
+ find_first_of(basic_string_view __s, size_type __pos = 0) const _NOEXCEPT {
+ _LIBCPP_ASSERT_NON_NULL(__s.size() == 0 || __s.data() != nullptr, "string_view::find_first_of(): received nullptr");
+ return std::__str_find_first_of<value_type, size_type, traits_type, npos>(
+ data(), size(), __s.data(), __pos, __s.size());
+ }
+
+ _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI size_type
+ find_first_of(_CharT __c, size_type __pos = 0) const _NOEXCEPT {
+ return find(__c, __pos);
+ }
+
+ _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI size_type
+ find_first_of(const _CharT* __s, size_type __pos, size_type __n) const _NOEXCEPT {
+ _LIBCPP_ASSERT_NON_NULL(__n == 0 || __s != nullptr, "string_view::find_first_of(): received nullptr");
+ return std::__str_find_first_of<value_type, size_type, traits_type, npos>(data(), size(), __s, __pos, __n);
+ }
+
+ _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI size_type
+ find_first_of(const _CharT* __s, size_type __pos = 0) const _NOEXCEPT {
+ _LIBCPP_ASSERT_NON_NULL(__s != nullptr, "string_view::find_first_of(): received nullptr");
+ return std::__str_find_first_of<value_type, size_type, traits_type, npos>(
+ data(), size(), __s, __pos, traits_type::length(__s));
+ }
+
+ // find_last_of
+ _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI size_type
+ find_last_of(basic_string_view __s, size_type __pos = npos) const _NOEXCEPT {
+ _LIBCPP_ASSERT_NON_NULL(__s.size() == 0 || __s.data() != nullptr, "string_view::find_last_of(): received nullptr");
+ return std::__str_find_last_of<value_type, size_type, traits_type, npos>(
+ data(), size(), __s.data(), __pos, __s.size());
+ }
+
+ _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI size_type
+ find_last_of(_CharT __c, size_type __pos = npos) const _NOEXCEPT {
+ return rfind(__c, __pos);
+ }
+
+ _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI size_type
+ find_last_of(const _CharT* __s, size_type __pos, size_type __n) const _NOEXCEPT {
+ _LIBCPP_ASSERT_NON_NULL(__n == 0 || __s != nullptr, "string_view::find_last_of(): received nullptr");
+ return std::__str_find_last_of<value_type, size_type, traits_type, npos>(data(), size(), __s, __pos, __n);
+ }
+
+ _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI size_type
+ find_last_of(const _CharT* __s, size_type __pos = npos) const _NOEXCEPT {
+ _LIBCPP_ASSERT_NON_NULL(__s != nullptr, "string_view::find_last_of(): received nullptr");
+ return std::__str_find_last_of<value_type, size_type, traits_type, npos>(
+ data(), size(), __s, __pos, traits_type::length(__s));
+ }
+
+ // find_first_not_of
+ _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI size_type
+ find_first_not_of(basic_string_view __s, size_type __pos = 0) const _NOEXCEPT {
+ _LIBCPP_ASSERT_NON_NULL(
+ __s.size() == 0 || __s.data() != nullptr, "string_view::find_first_not_of(): received nullptr");
+ return std::__str_find_first_not_of<value_type, size_type, traits_type, npos>(
+ data(), size(), __s.data(), __pos, __s.size());
+ }
+
+ _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI size_type
+ find_first_not_of(_CharT __c, size_type __pos = 0) const _NOEXCEPT {
+ return std::__str_find_first_not_of<value_type, size_type, traits_type, npos>(data(), size(), __c, __pos);
+ }
+
+ _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI size_type
+ find_first_not_of(const _CharT* __s, size_type __pos, size_type __n) const _NOEXCEPT {
+ _LIBCPP_ASSERT_NON_NULL(__n == 0 || __s != nullptr, "string_view::find_first_not_of(): received nullptr");
+ return std::__str_find_first_not_of<value_type, size_type, traits_type, npos>(data(), size(), __s, __pos, __n);
+ }
+
+ _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI size_type
+ find_first_not_of(const _CharT* __s, size_type __pos = 0) const _NOEXCEPT {
+ _LIBCPP_ASSERT_NON_NULL(__s != nullptr, "string_view::find_first_not_of(): received nullptr");
+ return std::__str_find_first_not_of<value_type, size_type, traits_type, npos>(
+ data(), size(), __s, __pos, traits_type::length(__s));
+ }
+
+ // find_last_not_of
+ _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI size_type
+ find_last_not_of(basic_string_view __s, size_type __pos = npos) const _NOEXCEPT {
+ _LIBCPP_ASSERT_NON_NULL(
+ __s.size() == 0 || __s.data() != nullptr, "string_view::find_last_not_of(): received nullptr");
+ return std::__str_find_last_not_of<value_type, size_type, traits_type, npos>(
+ data(), size(), __s.data(), __pos, __s.size());
+ }
+
+ _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI size_type
+ find_last_not_of(_CharT __c, size_type __pos = npos) const _NOEXCEPT {
+ return std::__str_find_last_not_of<value_type, size_type, traits_type, npos>(data(), size(), __c, __pos);
+ }
+
+ _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI size_type
+ find_last_not_of(const _CharT* __s, size_type __pos, size_type __n) const _NOEXCEPT {
+ _LIBCPP_ASSERT_NON_NULL(__n == 0 || __s != nullptr, "string_view::find_last_not_of(): received nullptr");
+ return std::__str_find_last_not_of<value_type, size_type, traits_type, npos>(data(), size(), __s, __pos, __n);
+ }
+
+ _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI size_type
+ find_last_not_of(const _CharT* __s, size_type __pos = npos) const _NOEXCEPT {
+ _LIBCPP_ASSERT_NON_NULL(__s != nullptr, "string_view::find_last_not_of(): received nullptr");
+ return std::__str_find_last_not_of<value_type, size_type, traits_type, npos>(
+ data(), size(), __s, __pos, traits_type::length(__s));
+ }
#if _LIBCPP_STD_VER >= 20
- constexpr _LIBCPP_HIDE_FROM_ABI
- bool starts_with(basic_string_view __s) const noexcept
- { return size() >= __s.size() && compare(0, __s.size(), __s) == 0; }
+ constexpr _LIBCPP_HIDE_FROM_ABI bool starts_with(basic_string_view __s) const noexcept {
+ return size() >= __s.size() && compare(0, __s.size(), __s) == 0;
+ }
- constexpr _LIBCPP_HIDE_FROM_ABI
- bool starts_with(value_type __c) const noexcept
- { return !empty() && _Traits::eq(front(), __c); }
+ constexpr _LIBCPP_HIDE_FROM_ABI bool starts_with(value_type __c) const noexcept {
+ return !empty() && _Traits::eq(front(), __c);
+ }
- constexpr _LIBCPP_HIDE_FROM_ABI
- bool starts_with(const value_type* __s) const noexcept
- { return starts_with(basic_string_view(__s)); }
+ constexpr _LIBCPP_HIDE_FROM_ABI bool starts_with(const value_type* __s) const noexcept {
+ return starts_with(basic_string_view(__s));
+ }
- constexpr _LIBCPP_HIDE_FROM_ABI
- bool ends_with(basic_string_view __s) const noexcept
- { return size() >= __s.size() && compare(size() - __s.size(), npos, __s) == 0; }
+ constexpr _LIBCPP_HIDE_FROM_ABI bool ends_with(basic_string_view __s) const noexcept {
+ return size() >= __s.size() && compare(size() - __s.size(), npos, __s) == 0;
+ }
- constexpr _LIBCPP_HIDE_FROM_ABI
- bool ends_with(value_type __c) const noexcept
- { return !empty() && _Traits::eq(back(), __c); }
+ constexpr _LIBCPP_HIDE_FROM_ABI bool ends_with(value_type __c) const noexcept {
+ return !empty() && _Traits::eq(back(), __c);
+ }
- constexpr _LIBCPP_HIDE_FROM_ABI
- bool ends_with(const value_type* __s) const noexcept
- { return ends_with(basic_string_view(__s)); }
+ constexpr _LIBCPP_HIDE_FROM_ABI bool ends_with(const value_type* __s) const noexcept {
+ return ends_with(basic_string_view(__s));
+ }
#endif
#if _LIBCPP_STD_VER >= 23
- constexpr _LIBCPP_HIDE_FROM_ABI
- bool contains(basic_string_view __sv) const noexcept
- { return find(__sv) != npos; }
+ constexpr _LIBCPP_HIDE_FROM_ABI bool contains(basic_string_view __sv) const noexcept { return find(__sv) != npos; }
- constexpr _LIBCPP_HIDE_FROM_ABI
- bool contains(value_type __c) const noexcept
- { return find(__c) != npos; }
+ constexpr _LIBCPP_HIDE_FROM_ABI bool contains(value_type __c) const noexcept { return find(__c) != npos; }
- constexpr _LIBCPP_HIDE_FROM_ABI
- bool contains(const value_type* __s) const
- { return find(__s) != npos; }
+ constexpr _LIBCPP_HIDE_FROM_ABI bool contains(const value_type* __s) const { return find(__s) != npos; }
#endif
private:
- const value_type* __data_;
- size_type __size_;
+ const value_type* __data_;
+ size_type __size_;
};
_LIBCPP_CTAD_SUPPORTED_FOR_TYPE(basic_string_view);
@@ -769,220 +685,194 @@ inline constexpr bool ranges::enable_borrowed_range<basic_string_view<_CharT, _T
#if _LIBCPP_STD_VER >= 20
template <contiguous_iterator _It, sized_sentinel_for<_It> _End>
- basic_string_view(_It, _End) -> basic_string_view<iter_value_t<_It>>;
+basic_string_view(_It, _End) -> basic_string_view<iter_value_t<_It>>;
#endif // _LIBCPP_STD_VER >= 20
-
#if _LIBCPP_STD_VER >= 23
template <ranges::contiguous_range _Range>
- basic_string_view(_Range) -> basic_string_view<ranges::range_value_t<_Range>>;
+basic_string_view(_Range) -> basic_string_view<ranges::range_value_t<_Range>>;
#endif
// [string.view.comparison]
#if _LIBCPP_STD_VER >= 20
-template<class _CharT, class _Traits>
-_LIBCPP_HIDE_FROM_ABI constexpr
-bool operator==(basic_string_view<_CharT, _Traits> __lhs,
- type_identity_t<basic_string_view<_CharT, _Traits>> __rhs) noexcept {
- if (__lhs.size() != __rhs.size()) return false;
- return __lhs.compare(__rhs) == 0;
+template <class _CharT, class _Traits>
+_LIBCPP_HIDE_FROM_ABI constexpr bool operator==(basic_string_view<_CharT, _Traits> __lhs,
+ type_identity_t<basic_string_view<_CharT, _Traits>> __rhs) noexcept {
+ if (__lhs.size() != __rhs.size())
+ return false;
+ return __lhs.compare(__rhs) == 0;
}
template <class _CharT, class _Traits>
-_LIBCPP_HIDE_FROM_ABI constexpr auto operator<=>(
- basic_string_view<_CharT, _Traits> __lhs, type_identity_t<basic_string_view<_CharT, _Traits>> __rhs) noexcept {
- if constexpr (requires { typename _Traits::comparison_category; }) {
- // [string.view]/4
- static_assert(
- __comparison_category<typename _Traits::comparison_category>,
- "return type is not a comparison category type");
- return static_cast<typename _Traits::comparison_category>(__lhs.compare(__rhs) <=> 0);
- } else {
- return static_cast<weak_ordering>(__lhs.compare(__rhs) <=> 0);
- }
+_LIBCPP_HIDE_FROM_ABI constexpr auto operator<=>(basic_string_view<_CharT, _Traits> __lhs,
+ type_identity_t<basic_string_view<_CharT, _Traits>> __rhs) noexcept {
+ if constexpr (requires { typename _Traits::comparison_category; }) {
+ // [string.view]/4
+ static_assert(
+ __comparison_category<typename _Traits::comparison_category>, "return type is not a comparison category type");
+ return static_cast<typename _Traits::comparison_category>(__lhs.compare(__rhs) <=> 0);
+ } else {
+ return static_cast<weak_ordering>(__lhs.compare(__rhs) <=> 0);
+ }
}
#else
// operator ==
-template<class _CharT, class _Traits>
-_LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
-bool operator==(basic_string_view<_CharT, _Traits> __lhs,
- basic_string_view<_CharT, _Traits> __rhs) _NOEXCEPT
-{
- if (__lhs.size() != __rhs.size()) return false;
- return __lhs.compare(__rhs) == 0;
+template <class _CharT, class _Traits>
+_LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI bool
+operator==(basic_string_view<_CharT, _Traits> __lhs, basic_string_view<_CharT, _Traits> __rhs) _NOEXCEPT {
+ if (__lhs.size() != __rhs.size())
+ return false;
+ return __lhs.compare(__rhs) == 0;
}
// The dummy default template parameters are used to work around a MSVC issue with mangling, see VSO-409326 for details.
// This applies to the other sufficient overloads below for the other comparison operators.
-template<class _CharT, class _Traits, int = 1>
-_LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
-bool operator==(basic_string_view<_CharT, _Traits> __lhs,
- __type_identity_t<basic_string_view<_CharT, _Traits> > __rhs) _NOEXCEPT
-{
- if (__lhs.size() != __rhs.size()) return false;
- return __lhs.compare(__rhs) == 0;
+template <class _CharT, class _Traits, int = 1>
+_LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI bool
+operator==(basic_string_view<_CharT, _Traits> __lhs,
+ __type_identity_t<basic_string_view<_CharT, _Traits> > __rhs) _NOEXCEPT {
+ if (__lhs.size() != __rhs.size())
+ return false;
+ return __lhs.compare(__rhs) == 0;
}
-template<class _CharT, class _Traits, int = 2>
-_LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
-bool operator==(__type_identity_t<basic_string_view<_CharT, _Traits> > __lhs,
- basic_string_view<_CharT, _Traits> __rhs) _NOEXCEPT
-{
- if (__lhs.size() != __rhs.size()) return false;
- return __lhs.compare(__rhs) == 0;
+template <class _CharT, class _Traits, int = 2>
+_LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI bool
+operator==(__type_identity_t<basic_string_view<_CharT, _Traits> > __lhs,
+ basic_string_view<_CharT, _Traits> __rhs) _NOEXCEPT {
+ if (__lhs.size() != __rhs.size())
+ return false;
+ return __lhs.compare(__rhs) == 0;
}
// operator !=
-template<class _CharT, class _Traits>
-_LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
-bool operator!=(basic_string_view<_CharT, _Traits> __lhs, basic_string_view<_CharT, _Traits> __rhs) _NOEXCEPT
-{
- if (__lhs.size() != __rhs.size())
- return true;
- return __lhs.compare(__rhs) != 0;
+template <class _CharT, class _Traits>
+_LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI bool
+operator!=(basic_string_view<_CharT, _Traits> __lhs, basic_string_view<_CharT, _Traits> __rhs) _NOEXCEPT {
+ if (__lhs.size() != __rhs.size())
+ return true;
+ return __lhs.compare(__rhs) != 0;
}
-template<class _CharT, class _Traits, int = 1>
-_LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
-bool operator!=(basic_string_view<_CharT, _Traits> __lhs,
- __type_identity_t<basic_string_view<_CharT, _Traits> > __rhs) _NOEXCEPT
-{
- if (__lhs.size() != __rhs.size())
- return true;
- return __lhs.compare(__rhs) != 0;
+template <class _CharT, class _Traits, int = 1>
+_LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI bool
+operator!=(basic_string_view<_CharT, _Traits> __lhs,
+ __type_identity_t<basic_string_view<_CharT, _Traits> > __rhs) _NOEXCEPT {
+ if (__lhs.size() != __rhs.size())
+ return true;
+ return __lhs.compare(__rhs) != 0;
}
-template<class _CharT, class _Traits, int = 2>
-_LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
-bool operator!=(__type_identity_t<basic_string_view<_CharT, _Traits> > __lhs,
- basic_string_view<_CharT, _Traits> __rhs) _NOEXCEPT
-{
- if (__lhs.size() != __rhs.size())
- return true;
- return __lhs.compare(__rhs) != 0;
+template <class _CharT, class _Traits, int = 2>
+_LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI bool
+operator!=(__type_identity_t<basic_string_view<_CharT, _Traits> > __lhs,
+ basic_string_view<_CharT, _Traits> __rhs) _NOEXCEPT {
+ if (__lhs.size() != __rhs.size())
+ return true;
+ return __lhs.compare(__rhs) != 0;
}
-
// operator <
-template<class _CharT, class _Traits>
-_LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
-bool operator<(basic_string_view<_CharT, _Traits> __lhs, basic_string_view<_CharT, _Traits> __rhs) _NOEXCEPT
-{
- return __lhs.compare(__rhs) < 0;
+template <class _CharT, class _Traits>
+_LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI bool
+operator<(basic_string_view<_CharT, _Traits> __lhs, basic_string_view<_CharT, _Traits> __rhs) _NOEXCEPT {
+ return __lhs.compare(__rhs) < 0;
}
-template<class _CharT, class _Traits, int = 1>
-_LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
-bool operator<(basic_string_view<_CharT, _Traits> __lhs,
- __type_identity_t<basic_string_view<_CharT, _Traits> > __rhs) _NOEXCEPT
-{
- return __lhs.compare(__rhs) < 0;
+template <class _CharT, class _Traits, int = 1>
+_LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI bool
+operator<(basic_string_view<_CharT, _Traits> __lhs,
+ __type_identity_t<basic_string_view<_CharT, _Traits> > __rhs) _NOEXCEPT {
+ return __lhs.compare(__rhs) < 0;
}
-template<class _CharT, class _Traits, int = 2>
-_LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
-bool operator<(__type_identity_t<basic_string_view<_CharT, _Traits> > __lhs,
- basic_string_view<_CharT, _Traits> __rhs) _NOEXCEPT
-{
- return __lhs.compare(__rhs) < 0;
+template <class _CharT, class _Traits, int = 2>
+_LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI bool
+operator<(__type_identity_t<basic_string_view<_CharT, _Traits> > __lhs,
+ basic_string_view<_CharT, _Traits> __rhs) _NOEXCEPT {
+ return __lhs.compare(__rhs) < 0;
}
-
// operator >
-template<class _CharT, class _Traits>
-_LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
-bool operator> (basic_string_view<_CharT, _Traits> __lhs, basic_string_view<_CharT, _Traits> __rhs) _NOEXCEPT
-{
- return __lhs.compare(__rhs) > 0;
+template <class _CharT, class _Traits>
+_LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI bool
+operator>(basic_string_view<_CharT, _Traits> __lhs, basic_string_view<_CharT, _Traits> __rhs) _NOEXCEPT {
+ return __lhs.compare(__rhs) > 0;
}
-template<class _CharT, class _Traits, int = 1>
-_LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
-bool operator>(basic_string_view<_CharT, _Traits> __lhs,
- __type_identity_t<basic_string_view<_CharT, _Traits> > __rhs) _NOEXCEPT
-{
- return __lhs.compare(__rhs) > 0;
+template <class _CharT, class _Traits, int = 1>
+_LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI bool
+operator>(basic_string_view<_CharT, _Traits> __lhs,
+ __type_identity_t<basic_string_view<_CharT, _Traits> > __rhs) _NOEXCEPT {
+ return __lhs.compare(__rhs) > 0;
}
-template<class _CharT, class _Traits, int = 2>
-_LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
-bool operator>(__type_identity_t<basic_string_view<_CharT, _Traits> > __lhs,
- basic_string_view<_CharT, _Traits> __rhs) _NOEXCEPT
-{
- return __lhs.compare(__rhs) > 0;
+template <class _CharT, class _Traits, int = 2>
+_LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI bool
+operator>(__type_identity_t<basic_string_view<_CharT, _Traits> > __lhs,
+ basic_string_view<_CharT, _Traits> __rhs) _NOEXCEPT {
+ return __lhs.compare(__rhs) > 0;
}
-
// operator <=
-template<class _CharT, class _Traits>
-_LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
-bool operator<=(basic_string_view<_CharT, _Traits> __lhs, basic_string_view<_CharT, _Traits> __rhs) _NOEXCEPT
-{
- return __lhs.compare(__rhs) <= 0;
+template <class _CharT, class _Traits>
+_LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI bool
+operator<=(basic_string_view<_CharT, _Traits> __lhs, basic_string_view<_CharT, _Traits> __rhs) _NOEXCEPT {
+ return __lhs.compare(__rhs) <= 0;
}
-template<class _CharT, class _Traits, int = 1>
-_LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
-bool operator<=(basic_string_view<_CharT, _Traits> __lhs,
- __type_identity_t<basic_string_view<_CharT, _Traits> > __rhs) _NOEXCEPT
-{
- return __lhs.compare(__rhs) <= 0;
+template <class _CharT, class _Traits, int = 1>
+_LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI bool
+operator<=(basic_string_view<_CharT, _Traits> __lhs,
+ __type_identity_t<basic_string_view<_CharT, _Traits> > __rhs) _NOEXCEPT {
+ return __lhs.compare(__rhs) <= 0;
}
-template<class _CharT, class _Traits, int = 2>
-_LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
-bool operator<=(__type_identity_t<basic_string_view<_CharT, _Traits> > __lhs,
- basic_string_view<_CharT, _Traits> __rhs) _NOEXCEPT
-{
- return __lhs.compare(__rhs) <= 0;
+template <class _CharT, class _Traits, int = 2>
+_LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI bool
+operator<=(__type_identity_t<basic_string_view<_CharT, _Traits> > __lhs,
+ basic_string_view<_CharT, _Traits> __rhs) _NOEXCEPT {
+ return __lhs.compare(__rhs) <= 0;
}
-
// operator >=
-template<class _CharT, class _Traits>
-_LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
-bool operator>=(basic_string_view<_CharT, _Traits> __lhs, basic_string_view<_CharT, _Traits> __rhs) _NOEXCEPT
-{
- return __lhs.compare(__rhs) >= 0;
+template <class _CharT, class _Traits>
+_LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI bool
+operator>=(basic_string_view<_CharT, _Traits> __lhs, basic_string_view<_CharT, _Traits> __rhs) _NOEXCEPT {
+ return __lhs.compare(__rhs) >= 0;
}
-
-template<class _CharT, class _Traits, int = 1>
-_LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
-bool operator>=(basic_string_view<_CharT, _Traits> __lhs,
- __type_identity_t<basic_string_view<_CharT, _Traits> > __rhs) _NOEXCEPT
-{
- return __lhs.compare(__rhs) >= 0;
+template <class _CharT, class _Traits, int = 1>
+_LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI bool
+operator>=(basic_string_view<_CharT, _Traits> __lhs,
+ __type_identity_t<basic_string_view<_CharT, _Traits> > __rhs) _NOEXCEPT {
+ return __lhs.compare(__rhs) >= 0;
}
-template<class _CharT, class _Traits, int = 2>
-_LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
-bool operator>=(__type_identity_t<basic_string_view<_CharT, _Traits> > __lhs,
- basic_string_view<_CharT, _Traits> __rhs) _NOEXCEPT
-{
- return __lhs.compare(__rhs) >= 0;
+template <class _CharT, class _Traits, int = 2>
+_LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI bool
+operator>=(__type_identity_t<basic_string_view<_CharT, _Traits> > __lhs,
+ basic_string_view<_CharT, _Traits> __rhs) _NOEXCEPT {
+ return __lhs.compare(__rhs) >= 0;
}
#endif // _LIBCPP_STD_VER >= 20
-template<class _CharT, class _Traits>
+template <class _CharT, class _Traits>
_LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>&
-operator<<(basic_ostream<_CharT, _Traits>& __os,
- basic_string_view<_CharT, _Traits> __str);
+operator<<(basic_ostream<_CharT, _Traits>& __os, basic_string_view<_CharT, _Traits> __str);
// [string.view.hash]
-template<class _CharT>
-struct __string_view_hash : public __unary_function<basic_string_view<_CharT, char_traits<_CharT> >, size_t>
-{
- _LIBCPP_HIDE_FROM_ABI
- size_t operator()(const basic_string_view<_CharT, char_traits<_CharT> > __val) const _NOEXCEPT {
- return std::__do_string_hash(__val.data(), __val.data() + __val.size());
- }
+template <class _CharT>
+struct __string_view_hash : public __unary_function<basic_string_view<_CharT, char_traits<_CharT> >, size_t> {
+ _LIBCPP_HIDE_FROM_ABI size_t operator()(const basic_string_view<_CharT, char_traits<_CharT> > __val) const _NOEXCEPT {
+ return std::__do_string_hash(__val.data(), __val.data() + __val.size());
+ }
};
template <>
@@ -1005,44 +895,37 @@ struct hash<basic_string_view<wchar_t, char_traits<wchar_t> > > : __string_view_
#endif
#if _LIBCPP_STD_VER >= 14
-inline namespace literals
-{
- inline namespace string_view_literals
- {
- inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR
- basic_string_view<char> operator""sv(const char *__str, size_t __len) _NOEXCEPT
- {
- return basic_string_view<char> (__str, __len);
- }
+inline namespace literals {
+inline namespace string_view_literals {
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR basic_string_view<char>
+operator""sv(const char* __str, size_t __len) _NOEXCEPT {
+ return basic_string_view<char>(__str, __len);
+}
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
- inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR
- basic_string_view<wchar_t> operator""sv(const wchar_t *__str, size_t __len) _NOEXCEPT
- {
- return basic_string_view<wchar_t> (__str, __len);
- }
-#endif
+# ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR basic_string_view<wchar_t>
+operator""sv(const wchar_t* __str, size_t __len) _NOEXCEPT {
+ return basic_string_view<wchar_t>(__str, __len);
+}
+# endif
-#ifndef _LIBCPP_HAS_NO_CHAR8_T
- inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR
- basic_string_view<char8_t> operator""sv(const char8_t *__str, size_t __len) _NOEXCEPT
- {
- return basic_string_view<char8_t> (__str, __len);
- }
-#endif
+# ifndef _LIBCPP_HAS_NO_CHAR8_T
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR basic_string_view<char8_t>
+operator""sv(const char8_t* __str, size_t __len) _NOEXCEPT {
+ return basic_string_view<char8_t>(__str, __len);
+}
+# endif
+
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR basic_string_view<char16_t>
+operator""sv(const char16_t* __str, size_t __len) _NOEXCEPT {
+ return basic_string_view<char16_t>(__str, __len);
+}
- inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR
- basic_string_view<char16_t> operator""sv(const char16_t *__str, size_t __len) _NOEXCEPT
- {
- return basic_string_view<char16_t> (__str, __len);
- }
-
- inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR
- basic_string_view<char32_t> operator""sv(const char32_t *__str, size_t __len) _NOEXCEPT
- {
- return basic_string_view<char32_t> (__str, __len);
- }
- } // namespace string_view_literals
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR basic_string_view<char32_t>
+operator""sv(const char32_t* __str, size_t __len) _NOEXCEPT {
+ return basic_string_view<char32_t>(__str, __len);
+}
+} // namespace string_view_literals
} // namespace literals
#endif
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/strstream b/contrib/llvm-project/libcxx/include/strstream
index d42ca7e9271c..7843184e4da4 100644
--- a/contrib/llvm-project/libcxx/include/strstream
+++ b/contrib/llvm-project/libcxx/include/strstream
@@ -141,267 +141,201 @@ private:
_LIBCPP_BEGIN_NAMESPACE_STD
-class _LIBCPP_DEPRECATED _LIBCPP_EXPORTED_FROM_ABI strstreambuf
- : public streambuf
-{
+class _LIBCPP_DEPRECATED _LIBCPP_EXPORTED_FROM_ABI strstreambuf : public streambuf {
public:
#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI strstreambuf() : strstreambuf(0) {}
- explicit strstreambuf(streamsize __alsize);
+ _LIBCPP_HIDE_FROM_ABI strstreambuf() : strstreambuf(0) {}
+ explicit strstreambuf(streamsize __alsize);
#else
- explicit strstreambuf(streamsize __alsize = 0);
+ explicit strstreambuf(streamsize __alsize = 0);
#endif
- strstreambuf(void* (*__palloc)(size_t), void (*__pfree)(void*));
- strstreambuf(char* __gnext, streamsize __n, char* __pbeg = nullptr);
- strstreambuf(const char* __gnext, streamsize __n);
+ strstreambuf(void* (*__palloc)(size_t), void (*__pfree)(void*));
+ strstreambuf(char* __gnext, streamsize __n, char* __pbeg = nullptr);
+ strstreambuf(const char* __gnext, streamsize __n);
- strstreambuf(signed char* __gnext, streamsize __n, signed char* __pbeg = nullptr);
- strstreambuf(const signed char* __gnext, streamsize __n);
- strstreambuf(unsigned char* __gnext, streamsize __n, unsigned char* __pbeg = nullptr);
- strstreambuf(const unsigned char* __gnext, streamsize __n);
+ strstreambuf(signed char* __gnext, streamsize __n, signed char* __pbeg = nullptr);
+ strstreambuf(const signed char* __gnext, streamsize __n);
+ strstreambuf(unsigned char* __gnext, streamsize __n, unsigned char* __pbeg = nullptr);
+ strstreambuf(const unsigned char* __gnext, streamsize __n);
#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI
- strstreambuf(strstreambuf&& __rhs);
- _LIBCPP_HIDE_FROM_ABI
- strstreambuf& operator=(strstreambuf&& __rhs);
+ _LIBCPP_HIDE_FROM_ABI strstreambuf(strstreambuf&& __rhs);
+ _LIBCPP_HIDE_FROM_ABI strstreambuf& operator=(strstreambuf&& __rhs);
#endif // _LIBCPP_CXX03_LANG
- ~strstreambuf() override;
+ ~strstreambuf() override;
- void swap(strstreambuf& __rhs);
+ void swap(strstreambuf& __rhs);
- void freeze(bool __freezefl = true);
- char* str();
- int pcount() const;
+ void freeze(bool __freezefl = true);
+ char* str();
+ int pcount() const;
protected:
- int_type overflow (int_type __c = EOF) override;
- int_type pbackfail(int_type __c = EOF) override;
- int_type underflow() override;
- pos_type seekoff(off_type __off, ios_base::seekdir __way,
- ios_base::openmode __which = ios_base::in | ios_base::out) override;
- pos_type seekpos(pos_type __sp,
- ios_base::openmode __which = ios_base::in | ios_base::out) override;
+ int_type overflow(int_type __c = EOF) override;
+ int_type pbackfail(int_type __c = EOF) override;
+ int_type underflow() override;
+ pos_type
+ seekoff(off_type __off, ios_base::seekdir __way, ios_base::openmode __which = ios_base::in | ios_base::out) override;
+ pos_type seekpos(pos_type __sp, ios_base::openmode __which = ios_base::in | ios_base::out) override;
private:
- typedef unsigned __mode_type;
- static const __mode_type __allocated = 0x01;
- static const __mode_type __constant = 0x02;
- static const __mode_type __dynamic = 0x04;
- static const __mode_type __frozen = 0x08;
- static const streamsize __default_alsize = 4096;
-
- __mode_type __strmode_;
- streamsize __alsize_;
- void* (*__palloc_)(size_t);
- void (*__pfree_)(void*);
-
- void __init(char* __gnext, streamsize __n, char* __pbeg);
+ typedef unsigned __mode_type;
+ static const __mode_type __allocated = 0x01;
+ static const __mode_type __constant = 0x02;
+ static const __mode_type __dynamic = 0x04;
+ static const __mode_type __frozen = 0x08;
+ static const streamsize __default_alsize = 4096;
+
+ __mode_type __strmode_;
+ streamsize __alsize_;
+ void* (*__palloc_)(size_t);
+ void (*__pfree_)(void*);
+
+ void __init(char* __gnext, streamsize __n, char* __pbeg);
};
#ifndef _LIBCPP_CXX03_LANG
-inline _LIBCPP_HIDE_FROM_ABI
-strstreambuf::strstreambuf(strstreambuf&& __rhs)
+inline _LIBCPP_HIDE_FROM_ABI strstreambuf::strstreambuf(strstreambuf&& __rhs)
: streambuf(__rhs),
__strmode_(__rhs.__strmode_),
__alsize_(__rhs.__alsize_),
__palloc_(__rhs.__palloc_),
- __pfree_(__rhs.__pfree_)
-{
- __rhs.setg(nullptr, nullptr, nullptr);
- __rhs.setp(nullptr, nullptr);
+ __pfree_(__rhs.__pfree_) {
+ __rhs.setg(nullptr, nullptr, nullptr);
+ __rhs.setp(nullptr, nullptr);
}
-inline _LIBCPP_HIDE_FROM_ABI
-strstreambuf&
-strstreambuf::operator=(strstreambuf&& __rhs)
-{
- if (eback() && (__strmode_ & __allocated) != 0 && (__strmode_ & __frozen) == 0)
- {
- if (__pfree_)
- __pfree_(eback());
- else
- delete [] eback();
- }
- streambuf::operator=(__rhs);
- __strmode_ = __rhs.__strmode_;
- __alsize_ = __rhs.__alsize_;
- __palloc_ = __rhs.__palloc_;
- __pfree_ = __rhs.__pfree_;
- __rhs.setg(nullptr, nullptr, nullptr);
- __rhs.setp(nullptr, nullptr);
- return *this;
+inline _LIBCPP_HIDE_FROM_ABI strstreambuf& strstreambuf::operator=(strstreambuf&& __rhs) {
+ if (eback() && (__strmode_ & __allocated) != 0 && (__strmode_ & __frozen) == 0) {
+ if (__pfree_)
+ __pfree_(eback());
+ else
+ delete[] eback();
+ }
+ streambuf::operator=(__rhs);
+ __strmode_ = __rhs.__strmode_;
+ __alsize_ = __rhs.__alsize_;
+ __palloc_ = __rhs.__palloc_;
+ __pfree_ = __rhs.__pfree_;
+ __rhs.setg(nullptr, nullptr, nullptr);
+ __rhs.setp(nullptr, nullptr);
+ return *this;
}
#endif // _LIBCPP_CXX03_LANG
-class _LIBCPP_DEPRECATED _LIBCPP_EXPORTED_FROM_ABI istrstream
- : public istream
-{
+class _LIBCPP_DEPRECATED _LIBCPP_EXPORTED_FROM_ABI istrstream : public istream {
public:
- _LIBCPP_HIDE_FROM_ABI
- explicit istrstream(const char* __s)
- : istream(&__sb_), __sb_(__s, 0) {}
- _LIBCPP_HIDE_FROM_ABI
- explicit istrstream(char* __s)
- : istream(&__sb_), __sb_(__s, 0) {}
- _LIBCPP_HIDE_FROM_ABI
- istrstream(const char* __s, streamsize __n)
- : istream(&__sb_), __sb_(__s, __n) {}
- _LIBCPP_HIDE_FROM_ABI
- istrstream(char* __s, streamsize __n)
- : istream(&__sb_), __sb_(__s, __n) {}
+ _LIBCPP_HIDE_FROM_ABI explicit istrstream(const char* __s) : istream(&__sb_), __sb_(__s, 0) {}
+ _LIBCPP_HIDE_FROM_ABI explicit istrstream(char* __s) : istream(&__sb_), __sb_(__s, 0) {}
+ _LIBCPP_HIDE_FROM_ABI istrstream(const char* __s, streamsize __n) : istream(&__sb_), __sb_(__s, __n) {}
+ _LIBCPP_HIDE_FROM_ABI istrstream(char* __s, streamsize __n) : istream(&__sb_), __sb_(__s, __n) {}
#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI
- istrstream(istrstream&& __rhs) // extension
- : istream(std::move(static_cast<istream&>(__rhs))),
- __sb_(std::move(__rhs.__sb_))
- {
- istream::set_rdbuf(&__sb_);
- }
-
- _LIBCPP_HIDE_FROM_ABI
- istrstream& operator=(istrstream&& __rhs)
- {
- __sb_ = std::move(__rhs.__sb_);
- istream::operator=(std::move(__rhs));
- return *this;
- }
+ _LIBCPP_HIDE_FROM_ABI istrstream(istrstream&& __rhs) // extension
+ : istream(std::move(static_cast<istream&>(__rhs))), __sb_(std::move(__rhs.__sb_)) {
+ istream::set_rdbuf(&__sb_);
+ }
+
+ _LIBCPP_HIDE_FROM_ABI istrstream& operator=(istrstream&& __rhs) {
+ __sb_ = std::move(__rhs.__sb_);
+ istream::operator=(std::move(__rhs));
+ return *this;
+ }
#endif // _LIBCPP_CXX03_LANG
- ~istrstream() override;
+ ~istrstream() override;
- _LIBCPP_HIDE_FROM_ABI
- void swap(istrstream& __rhs)
- {
- istream::swap(__rhs);
- __sb_.swap(__rhs.__sb_);
- }
+ _LIBCPP_HIDE_FROM_ABI void swap(istrstream& __rhs) {
+ istream::swap(__rhs);
+ __sb_.swap(__rhs.__sb_);
+ }
- _LIBCPP_HIDE_FROM_ABI
- strstreambuf* rdbuf() const {return const_cast<strstreambuf*>(&__sb_);}
- _LIBCPP_HIDE_FROM_ABI
- char *str() {return __sb_.str();}
+ _LIBCPP_HIDE_FROM_ABI strstreambuf* rdbuf() const { return const_cast<strstreambuf*>(&__sb_); }
+ _LIBCPP_HIDE_FROM_ABI char* str() { return __sb_.str(); }
private:
- strstreambuf __sb_;
+ strstreambuf __sb_;
};
-class _LIBCPP_DEPRECATED _LIBCPP_EXPORTED_FROM_ABI ostrstream
- : public ostream
-{
+class _LIBCPP_DEPRECATED _LIBCPP_EXPORTED_FROM_ABI ostrstream : public ostream {
public:
- _LIBCPP_HIDE_FROM_ABI
- ostrstream()
- : ostream(&__sb_) {}
- _LIBCPP_HIDE_FROM_ABI
- ostrstream(char* __s, int __n, ios_base::openmode __mode = ios_base::out)
- : ostream(&__sb_),
- __sb_(__s, __n, __s + (__mode & ios::app ? std::strlen(__s) : 0))
- {}
+ _LIBCPP_HIDE_FROM_ABI ostrstream() : ostream(&__sb_) {}
+ _LIBCPP_HIDE_FROM_ABI ostrstream(char* __s, int __n, ios_base::openmode __mode = ios_base::out)
+ : ostream(&__sb_), __sb_(__s, __n, __s + (__mode & ios::app ? std::strlen(__s) : 0)) {}
#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI
- ostrstream(ostrstream&& __rhs) // extension
- : ostream(std::move(static_cast<ostream&>(__rhs))),
- __sb_(std::move(__rhs.__sb_))
- {
- ostream::set_rdbuf(&__sb_);
- }
-
- _LIBCPP_HIDE_FROM_ABI
- ostrstream& operator=(ostrstream&& __rhs)
- {
- __sb_ = std::move(__rhs.__sb_);
- ostream::operator=(std::move(__rhs));
- return *this;
- }
+ _LIBCPP_HIDE_FROM_ABI ostrstream(ostrstream&& __rhs) // extension
+ : ostream(std::move(static_cast<ostream&>(__rhs))), __sb_(std::move(__rhs.__sb_)) {
+ ostream::set_rdbuf(&__sb_);
+ }
+
+ _LIBCPP_HIDE_FROM_ABI ostrstream& operator=(ostrstream&& __rhs) {
+ __sb_ = std::move(__rhs.__sb_);
+ ostream::operator=(std::move(__rhs));
+ return *this;
+ }
#endif // _LIBCPP_CXX03_LANG
- ~ostrstream() override;
+ ~ostrstream() override;
- _LIBCPP_HIDE_FROM_ABI
- void swap(ostrstream& __rhs)
- {
- ostream::swap(__rhs);
- __sb_.swap(__rhs.__sb_);
- }
+ _LIBCPP_HIDE_FROM_ABI void swap(ostrstream& __rhs) {
+ ostream::swap(__rhs);
+ __sb_.swap(__rhs.__sb_);
+ }
- _LIBCPP_HIDE_FROM_ABI
- strstreambuf* rdbuf() const {return const_cast<strstreambuf*>(&__sb_);}
- _LIBCPP_HIDE_FROM_ABI
- void freeze(bool __freezefl = true) {__sb_.freeze(__freezefl);}
- _LIBCPP_HIDE_FROM_ABI
- char* str() {return __sb_.str();}
- _LIBCPP_HIDE_FROM_ABI
- int pcount() const {return __sb_.pcount();}
+ _LIBCPP_HIDE_FROM_ABI strstreambuf* rdbuf() const { return const_cast<strstreambuf*>(&__sb_); }
+ _LIBCPP_HIDE_FROM_ABI void freeze(bool __freezefl = true) { __sb_.freeze(__freezefl); }
+ _LIBCPP_HIDE_FROM_ABI char* str() { return __sb_.str(); }
+ _LIBCPP_HIDE_FROM_ABI int pcount() const { return __sb_.pcount(); }
private:
- strstreambuf __sb_; // exposition only
+ strstreambuf __sb_; // exposition only
};
-class _LIBCPP_DEPRECATED _LIBCPP_EXPORTED_FROM_ABI strstream
- : public iostream
-{
+class _LIBCPP_DEPRECATED _LIBCPP_EXPORTED_FROM_ABI strstream : public iostream {
public:
- // Types
- typedef char char_type;
- typedef char_traits<char>::int_type int_type;
- typedef char_traits<char>::pos_type pos_type;
- typedef char_traits<char>::off_type off_type;
+ // Types
+ typedef char char_type;
+ typedef char_traits<char>::int_type int_type;
+ typedef char_traits<char>::pos_type pos_type;
+ typedef char_traits<char>::off_type off_type;
- // constructors/destructor
- _LIBCPP_HIDE_FROM_ABI
- strstream()
- : iostream(&__sb_) {}
- _LIBCPP_HIDE_FROM_ABI
- strstream(char* __s, int __n, ios_base::openmode __mode = ios_base::in | ios_base::out)
- : iostream(&__sb_),
- __sb_(__s, __n, __s + (__mode & ios::app ? std::strlen(__s) : 0))
- {}
+ // constructors/destructor
+ _LIBCPP_HIDE_FROM_ABI strstream() : iostream(&__sb_) {}
+ _LIBCPP_HIDE_FROM_ABI strstream(char* __s, int __n, ios_base::openmode __mode = ios_base::in | ios_base::out)
+ : iostream(&__sb_), __sb_(__s, __n, __s + (__mode & ios::app ? std::strlen(__s) : 0)) {}
#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI
- strstream(strstream&& __rhs) // extension
- : iostream(std::move(static_cast<iostream&>(__rhs))),
- __sb_(std::move(__rhs.__sb_))
- {
- iostream::set_rdbuf(&__sb_);
- }
-
- _LIBCPP_HIDE_FROM_ABI
- strstream& operator=(strstream&& __rhs)
- {
- __sb_ = std::move(__rhs.__sb_);
- iostream::operator=(std::move(__rhs));
- return *this;
- }
+ _LIBCPP_HIDE_FROM_ABI strstream(strstream&& __rhs) // extension
+ : iostream(std::move(static_cast<iostream&>(__rhs))), __sb_(std::move(__rhs.__sb_)) {
+ iostream::set_rdbuf(&__sb_);
+ }
+
+ _LIBCPP_HIDE_FROM_ABI strstream& operator=(strstream&& __rhs) {
+ __sb_ = std::move(__rhs.__sb_);
+ iostream::operator=(std::move(__rhs));
+ return *this;
+ }
#endif // _LIBCPP_CXX03_LANG
- ~strstream() override;
+ ~strstream() override;
- _LIBCPP_HIDE_FROM_ABI
- void swap(strstream& __rhs)
- {
- iostream::swap(__rhs);
- __sb_.swap(__rhs.__sb_);
- }
+ _LIBCPP_HIDE_FROM_ABI void swap(strstream& __rhs) {
+ iostream::swap(__rhs);
+ __sb_.swap(__rhs.__sb_);
+ }
- // Members:
- _LIBCPP_HIDE_FROM_ABI
- strstreambuf* rdbuf() const {return const_cast<strstreambuf*>(&__sb_);}
- _LIBCPP_HIDE_FROM_ABI
- void freeze(bool __freezefl = true) {__sb_.freeze(__freezefl);}
- _LIBCPP_HIDE_FROM_ABI
- int pcount() const {return __sb_.pcount();}
- _LIBCPP_HIDE_FROM_ABI
- char* str() {return __sb_.str();}
+ // Members:
+ _LIBCPP_HIDE_FROM_ABI strstreambuf* rdbuf() const { return const_cast<strstreambuf*>(&__sb_); }
+ _LIBCPP_HIDE_FROM_ABI void freeze(bool __freezefl = true) { __sb_.freeze(__freezefl); }
+ _LIBCPP_HIDE_FROM_ABI int pcount() const { return __sb_.pcount(); }
+ _LIBCPP_HIDE_FROM_ABI char* str() { return __sb_.str(); }
private:
- strstreambuf __sb_; // exposition only
+ strstreambuf __sb_; // exposition only
};
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/thread b/contrib/llvm-project/libcxx/include/thread
index 943085b7af03..1cf22bf6aaf9 100644
--- a/contrib/llvm-project/libcxx/include/thread
+++ b/contrib/llvm-project/libcxx/include/thread
@@ -106,7 +106,7 @@ void sleep_for(const chrono::duration<Rep, Period>& rel_time);
#endif
#ifdef _LIBCPP_HAS_NO_THREADS
-# error "<thread> is not supported since libc++ has been configured without support for threads."
+# error "<thread> is not supported since libc++ has been configured without support for threads."
#endif
#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES)
diff --git a/contrib/llvm-project/libcxx/include/tuple b/contrib/llvm-project/libcxx/include/tuple
index 194138f7076c..8c954fc72c37 100644
--- a/contrib/llvm-project/libcxx/include/tuple
+++ b/contrib/llvm-project/libcxx/include/tuple
@@ -282,1400 +282,1170 @@ _LIBCPP_BEGIN_NAMESPACE_STD
#ifndef _LIBCPP_CXX03_LANG
-
// __tuple_leaf
-template <size_t _Ip, class _Hp,
- bool=is_empty<_Hp>::value && !__libcpp_is_final<_Hp>::value
- >
+template <size_t _Ip, class _Hp, bool = is_empty<_Hp>::value && !__libcpp_is_final<_Hp>::value >
class __tuple_leaf;
template <size_t _Ip, class _Hp, bool _Ep>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
-void swap(__tuple_leaf<_Ip, _Hp, _Ep>& __x, __tuple_leaf<_Ip, _Hp, _Ep>& __y)
- _NOEXCEPT_(__is_nothrow_swappable<_Hp>::value)
-{
- swap(__x.get(), __y.get());
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 void
+swap(__tuple_leaf<_Ip, _Hp, _Ep>& __x, __tuple_leaf<_Ip, _Hp, _Ep>& __y)
+ _NOEXCEPT_(__is_nothrow_swappable<_Hp>::value) {
+ swap(__x.get(), __y.get());
}
template <size_t _Ip, class _Hp, bool _Ep>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
-void swap(const __tuple_leaf<_Ip, _Hp, _Ep>& __x, const __tuple_leaf<_Ip, _Hp, _Ep>& __y)
- _NOEXCEPT_(__is_nothrow_swappable<const _Hp>::value) {
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 void
+swap(const __tuple_leaf<_Ip, _Hp, _Ep>& __x, const __tuple_leaf<_Ip, _Hp, _Ep>& __y)
+ _NOEXCEPT_(__is_nothrow_swappable<const _Hp>::value) {
swap(__x.get(), __y.get());
}
template <size_t _Ip, class _Hp, bool>
-class __tuple_leaf
-{
- _Hp __value_;
+class __tuple_leaf {
+ _Hp __value_;
- template <class _Tp>
- static _LIBCPP_HIDE_FROM_ABI constexpr bool __can_bind_reference() {
-#if __has_keyword(__reference_binds_to_temporary)
- return !__reference_binds_to_temporary(_Hp, _Tp);
-#else
- return true;
-#endif
- }
+ template <class _Tp>
+ static _LIBCPP_HIDE_FROM_ABI constexpr bool __can_bind_reference() {
+# if __has_keyword(__reference_binds_to_temporary)
+ return !__reference_binds_to_temporary(_Hp, _Tp);
+# else
+ return true;
+# endif
+ }
+
+ _LIBCPP_CONSTEXPR_SINCE_CXX14 __tuple_leaf& operator=(const __tuple_leaf&);
- _LIBCPP_CONSTEXPR_SINCE_CXX14
- __tuple_leaf& operator=(const __tuple_leaf&);
public:
- _LIBCPP_HIDE_FROM_ABI constexpr __tuple_leaf()
- _NOEXCEPT_(is_nothrow_default_constructible<_Hp>::value) : __value_()
- {static_assert(!is_reference<_Hp>::value,
- "Attempted to default construct a reference element in a tuple");}
-
- template <class _Alloc>
- _LIBCPP_HIDE_FROM_ABI constexpr
- __tuple_leaf(integral_constant<int, 0>, const _Alloc&)
- : __value_()
- {static_assert(!is_reference<_Hp>::value,
- "Attempted to default construct a reference element in a tuple");}
-
- template <class _Alloc>
- _LIBCPP_HIDE_FROM_ABI constexpr
- __tuple_leaf(integral_constant<int, 1>, const _Alloc& __a)
- : __value_(allocator_arg_t(), __a)
- {static_assert(!is_reference<_Hp>::value,
- "Attempted to default construct a reference element in a tuple");}
-
- template <class _Alloc>
- _LIBCPP_HIDE_FROM_ABI constexpr
- __tuple_leaf(integral_constant<int, 2>, const _Alloc& __a)
- : __value_(__a)
- {static_assert(!is_reference<_Hp>::value,
- "Attempted to default construct a reference element in a tuple");}
-
- template <class _Tp,
- class = __enable_if_t<
- _And<
- _IsNotSame<__remove_cvref_t<_Tp>, __tuple_leaf>,
- is_constructible<_Hp, _Tp>
- >::value
- >
- >
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
- explicit __tuple_leaf(_Tp&& __t) _NOEXCEPT_((is_nothrow_constructible<_Hp, _Tp>::value))
- : __value_(std::forward<_Tp>(__t))
- {static_assert(__can_bind_reference<_Tp&&>(),
- "Attempted construction of reference element binds to a temporary whose lifetime has ended");}
-
- template <class _Tp, class _Alloc>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
- explicit __tuple_leaf(integral_constant<int, 0>, const _Alloc&, _Tp&& __t)
- : __value_(std::forward<_Tp>(__t))
- {static_assert(__can_bind_reference<_Tp&&>(),
- "Attempted construction of reference element binds to a temporary whose lifetime has ended");}
-
- template <class _Tp, class _Alloc>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
- explicit __tuple_leaf(integral_constant<int, 1>, const _Alloc& __a, _Tp&& __t)
- : __value_(allocator_arg_t(), __a, std::forward<_Tp>(__t))
- {static_assert(!is_reference<_Hp>::value,
- "Attempted to uses-allocator construct a reference element in a tuple");}
-
- template <class _Tp, class _Alloc>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
- explicit __tuple_leaf(integral_constant<int, 2>, const _Alloc& __a, _Tp&& __t)
- : __value_(std::forward<_Tp>(__t), __a)
- {static_assert(!is_reference<_Hp>::value,
- "Attempted to uses-allocator construct a reference element in a tuple");}
-
- _LIBCPP_HIDE_FROM_ABI __tuple_leaf(const __tuple_leaf& __t) = default;
- _LIBCPP_HIDE_FROM_ABI __tuple_leaf(__tuple_leaf&& __t) = default;
-
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
- int swap(__tuple_leaf& __t) _NOEXCEPT_(__is_nothrow_swappable<__tuple_leaf>::value)
- {
- std::swap(*this, __t);
- return 0;
- }
-
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
- int swap(const __tuple_leaf& __t) const _NOEXCEPT_(__is_nothrow_swappable<const __tuple_leaf>::value) {
- std::swap(*this, __t);
- return 0;
- }
-
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _Hp& get() _NOEXCEPT {return __value_;}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 const _Hp& get() const _NOEXCEPT {return __value_;}
+ _LIBCPP_HIDE_FROM_ABI constexpr __tuple_leaf() _NOEXCEPT_(is_nothrow_default_constructible<_Hp>::value) : __value_() {
+ static_assert(!is_reference<_Hp>::value, "Attempted to default construct a reference element in a tuple");
+ }
+
+ template <class _Alloc>
+ _LIBCPP_HIDE_FROM_ABI constexpr __tuple_leaf(integral_constant<int, 0>, const _Alloc&) : __value_() {
+ static_assert(!is_reference<_Hp>::value, "Attempted to default construct a reference element in a tuple");
+ }
+
+ template <class _Alloc>
+ _LIBCPP_HIDE_FROM_ABI constexpr __tuple_leaf(integral_constant<int, 1>, const _Alloc& __a)
+ : __value_(allocator_arg_t(), __a) {
+ static_assert(!is_reference<_Hp>::value, "Attempted to default construct a reference element in a tuple");
+ }
+
+ template <class _Alloc>
+ _LIBCPP_HIDE_FROM_ABI constexpr __tuple_leaf(integral_constant<int, 2>, const _Alloc& __a) : __value_(__a) {
+ static_assert(!is_reference<_Hp>::value, "Attempted to default construct a reference element in a tuple");
+ }
+
+ template <class _Tp,
+ class = __enable_if_t<
+ _And< _IsNotSame<__remove_cvref_t<_Tp>, __tuple_leaf>, is_constructible<_Hp, _Tp> >::value > >
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 explicit __tuple_leaf(_Tp&& __t)
+ _NOEXCEPT_((is_nothrow_constructible<_Hp, _Tp>::value))
+ : __value_(std::forward<_Tp>(__t)) {
+ static_assert(__can_bind_reference<_Tp&&>(),
+ "Attempted construction of reference element binds to a temporary whose lifetime has ended");
+ }
+
+ template <class _Tp, class _Alloc>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 explicit __tuple_leaf(
+ integral_constant<int, 0>, const _Alloc&, _Tp&& __t)
+ : __value_(std::forward<_Tp>(__t)) {
+ static_assert(__can_bind_reference<_Tp&&>(),
+ "Attempted construction of reference element binds to a temporary whose lifetime has ended");
+ }
+
+ template <class _Tp, class _Alloc>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 explicit __tuple_leaf(
+ integral_constant<int, 1>, const _Alloc& __a, _Tp&& __t)
+ : __value_(allocator_arg_t(), __a, std::forward<_Tp>(__t)) {
+ static_assert(!is_reference<_Hp>::value, "Attempted to uses-allocator construct a reference element in a tuple");
+ }
+
+ template <class _Tp, class _Alloc>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 explicit __tuple_leaf(
+ integral_constant<int, 2>, const _Alloc& __a, _Tp&& __t)
+ : __value_(std::forward<_Tp>(__t), __a) {
+ static_assert(!is_reference<_Hp>::value, "Attempted to uses-allocator construct a reference element in a tuple");
+ }
+
+ _LIBCPP_HIDE_FROM_ABI __tuple_leaf(const __tuple_leaf& __t) = default;
+ _LIBCPP_HIDE_FROM_ABI __tuple_leaf(__tuple_leaf&& __t) = default;
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 int swap(__tuple_leaf& __t)
+ _NOEXCEPT_(__is_nothrow_swappable<__tuple_leaf>::value) {
+ std::swap(*this, __t);
+ return 0;
+ }
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 int swap(const __tuple_leaf& __t) const
+ _NOEXCEPT_(__is_nothrow_swappable<const __tuple_leaf>::value) {
+ std::swap(*this, __t);
+ return 0;
+ }
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _Hp& get() _NOEXCEPT { return __value_; }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 const _Hp& get() const _NOEXCEPT { return __value_; }
};
template <size_t _Ip, class _Hp>
-class __tuple_leaf<_Ip, _Hp, true>
- : private _Hp
-{
- _LIBCPP_CONSTEXPR_SINCE_CXX14
- __tuple_leaf& operator=(const __tuple_leaf&);
+class __tuple_leaf<_Ip, _Hp, true> : private _Hp {
+ _LIBCPP_CONSTEXPR_SINCE_CXX14 __tuple_leaf& operator=(const __tuple_leaf&);
+
public:
- _LIBCPP_HIDE_FROM_ABI constexpr __tuple_leaf()
- _NOEXCEPT_(is_nothrow_default_constructible<_Hp>::value) {}
-
- template <class _Alloc>
- _LIBCPP_HIDE_FROM_ABI constexpr
- __tuple_leaf(integral_constant<int, 0>, const _Alloc&) {}
-
- template <class _Alloc>
- _LIBCPP_HIDE_FROM_ABI constexpr
- __tuple_leaf(integral_constant<int, 1>, const _Alloc& __a)
- : _Hp(allocator_arg_t(), __a) {}
-
- template <class _Alloc>
- _LIBCPP_HIDE_FROM_ABI constexpr
- __tuple_leaf(integral_constant<int, 2>, const _Alloc& __a)
- : _Hp(__a) {}
-
- template <class _Tp,
- class = __enable_if_t<
- _And<
- _IsNotSame<__remove_cvref_t<_Tp>, __tuple_leaf>,
- is_constructible<_Hp, _Tp>
- >::value
- >
- >
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
- explicit __tuple_leaf(_Tp&& __t) _NOEXCEPT_((is_nothrow_constructible<_Hp, _Tp>::value))
- : _Hp(std::forward<_Tp>(__t)) {}
-
- template <class _Tp, class _Alloc>
- _LIBCPP_HIDE_FROM_ABI constexpr
- explicit __tuple_leaf(integral_constant<int, 0>, const _Alloc&, _Tp&& __t)
- : _Hp(std::forward<_Tp>(__t)) {}
-
- template <class _Tp, class _Alloc>
- _LIBCPP_HIDE_FROM_ABI constexpr
- explicit __tuple_leaf(integral_constant<int, 1>, const _Alloc& __a, _Tp&& __t)
- : _Hp(allocator_arg_t(), __a, std::forward<_Tp>(__t)) {}
-
- template <class _Tp, class _Alloc>
- _LIBCPP_HIDE_FROM_ABI constexpr
- explicit __tuple_leaf(integral_constant<int, 2>, const _Alloc& __a, _Tp&& __t)
- : _Hp(std::forward<_Tp>(__t), __a) {}
-
- __tuple_leaf(__tuple_leaf const &) = default;
- __tuple_leaf(__tuple_leaf &&) = default;
-
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
- int
- swap(__tuple_leaf& __t) _NOEXCEPT_(__is_nothrow_swappable<__tuple_leaf>::value)
- {
- std::swap(*this, __t);
- return 0;
- }
-
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
- int swap(const __tuple_leaf& __rhs) const _NOEXCEPT_(__is_nothrow_swappable<const __tuple_leaf>::value) {
- std::swap(*this, __rhs);
- return 0;
- }
-
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _Hp& get() _NOEXCEPT {return static_cast<_Hp&>(*this);}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 const _Hp& get() const _NOEXCEPT {return static_cast<const _Hp&>(*this);}
+ _LIBCPP_HIDE_FROM_ABI constexpr __tuple_leaf() _NOEXCEPT_(is_nothrow_default_constructible<_Hp>::value) {}
+
+ template <class _Alloc>
+ _LIBCPP_HIDE_FROM_ABI constexpr __tuple_leaf(integral_constant<int, 0>, const _Alloc&) {}
+
+ template <class _Alloc>
+ _LIBCPP_HIDE_FROM_ABI constexpr __tuple_leaf(integral_constant<int, 1>, const _Alloc& __a)
+ : _Hp(allocator_arg_t(), __a) {}
+
+ template <class _Alloc>
+ _LIBCPP_HIDE_FROM_ABI constexpr __tuple_leaf(integral_constant<int, 2>, const _Alloc& __a) : _Hp(__a) {}
+
+ template <class _Tp,
+ class = __enable_if_t<
+ _And< _IsNotSame<__remove_cvref_t<_Tp>, __tuple_leaf>, is_constructible<_Hp, _Tp> >::value > >
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 explicit __tuple_leaf(_Tp&& __t)
+ _NOEXCEPT_((is_nothrow_constructible<_Hp, _Tp>::value))
+ : _Hp(std::forward<_Tp>(__t)) {}
+
+ template <class _Tp, class _Alloc>
+ _LIBCPP_HIDE_FROM_ABI constexpr explicit __tuple_leaf(integral_constant<int, 0>, const _Alloc&, _Tp&& __t)
+ : _Hp(std::forward<_Tp>(__t)) {}
+
+ template <class _Tp, class _Alloc>
+ _LIBCPP_HIDE_FROM_ABI constexpr explicit __tuple_leaf(integral_constant<int, 1>, const _Alloc& __a, _Tp&& __t)
+ : _Hp(allocator_arg_t(), __a, std::forward<_Tp>(__t)) {}
+
+ template <class _Tp, class _Alloc>
+ _LIBCPP_HIDE_FROM_ABI constexpr explicit __tuple_leaf(integral_constant<int, 2>, const _Alloc& __a, _Tp&& __t)
+ : _Hp(std::forward<_Tp>(__t), __a) {}
+
+ __tuple_leaf(__tuple_leaf const&) = default;
+ __tuple_leaf(__tuple_leaf&&) = default;
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 int swap(__tuple_leaf& __t)
+ _NOEXCEPT_(__is_nothrow_swappable<__tuple_leaf>::value) {
+ std::swap(*this, __t);
+ return 0;
+ }
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 int swap(const __tuple_leaf& __rhs) const
+ _NOEXCEPT_(__is_nothrow_swappable<const __tuple_leaf>::value) {
+ std::swap(*this, __rhs);
+ return 0;
+ }
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _Hp& get() _NOEXCEPT { return static_cast<_Hp&>(*this); }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 const _Hp& get() const _NOEXCEPT {
+ return static_cast<const _Hp&>(*this);
+ }
};
-template <class ..._Tp>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
-void __swallow(_Tp&&...) _NOEXCEPT {}
+template <class... _Tp>
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 void __swallow(_Tp&&...) _NOEXCEPT {}
template <class _Tp>
struct __all_default_constructible;
-template <class ..._Tp>
-struct __all_default_constructible<__tuple_types<_Tp...>>
- : __all<is_default_constructible<_Tp>::value...>
-{ };
+template <class... _Tp>
+struct __all_default_constructible<__tuple_types<_Tp...>> : __all<is_default_constructible<_Tp>::value...> {};
// __tuple_impl
-template<class _Indx, class ..._Tp> struct __tuple_impl;
+template <class _Indx, class... _Tp>
+struct __tuple_impl;
-template<size_t ..._Indx, class ..._Tp>
+template <size_t... _Indx, class... _Tp>
struct _LIBCPP_DECLSPEC_EMPTY_BASES __tuple_impl<__tuple_indices<_Indx...>, _Tp...>
- : public __tuple_leaf<_Indx, _Tp>...
-{
- _LIBCPP_HIDE_FROM_ABI
- constexpr __tuple_impl()
- _NOEXCEPT_(__all<is_nothrow_default_constructible<_Tp>::value...>::value) {}
-
- template <size_t ..._Uf, class ..._Tf,
- size_t ..._Ul, class ..._Tl, class ..._Up>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
- explicit
- __tuple_impl(__tuple_indices<_Uf...>, __tuple_types<_Tf...>,
- __tuple_indices<_Ul...>, __tuple_types<_Tl...>,
- _Up&&... __u)
- _NOEXCEPT_((__all<is_nothrow_constructible<_Tf, _Up>::value...>::value &&
- __all<is_nothrow_default_constructible<_Tl>::value...>::value)) :
- __tuple_leaf<_Uf, _Tf>(std::forward<_Up>(__u))...,
- __tuple_leaf<_Ul, _Tl>()...
- {}
-
- template <class _Alloc, size_t ..._Uf, class ..._Tf,
- size_t ..._Ul, class ..._Tl, class ..._Up>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
- explicit
- __tuple_impl(allocator_arg_t, const _Alloc& __a,
- __tuple_indices<_Uf...>, __tuple_types<_Tf...>,
- __tuple_indices<_Ul...>, __tuple_types<_Tl...>,
- _Up&&... __u) :
- __tuple_leaf<_Uf, _Tf>(__uses_alloc_ctor<_Tf, _Alloc, _Up>(), __a,
- std::forward<_Up>(__u))...,
- __tuple_leaf<_Ul, _Tl>(__uses_alloc_ctor<_Tl, _Alloc>(), __a)...
- {}
-
- template <class _Tuple,
- class = __enable_if_t<__tuple_constructible<_Tuple, tuple<_Tp...> >::value>
- >
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
- __tuple_impl(_Tuple&& __t) _NOEXCEPT_((__all<is_nothrow_constructible<_Tp, typename tuple_element<_Indx,
- typename __make_tuple_types<_Tuple>::type>::type>::value...>::value))
- : __tuple_leaf<_Indx, _Tp>(std::forward<typename tuple_element<_Indx,
- typename __make_tuple_types<_Tuple>::type>::type>(std::get<_Indx>(__t)))...
- {}
-
- template <class _Alloc, class _Tuple,
- class = __enable_if_t<__tuple_constructible<_Tuple, tuple<_Tp...> >::value>
- >
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
- __tuple_impl(allocator_arg_t, const _Alloc& __a, _Tuple&& __t)
- : __tuple_leaf<_Indx, _Tp>(__uses_alloc_ctor<_Tp, _Alloc, typename tuple_element<_Indx,
- typename __make_tuple_types<_Tuple>::type>::type>(), __a,
- std::forward<typename tuple_element<_Indx,
- typename __make_tuple_types<_Tuple>::type>::type>(std::get<_Indx>(__t)))...
- {}
-
- __tuple_impl(const __tuple_impl&) = default;
- __tuple_impl(__tuple_impl&&) = default;
-
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
- void swap(__tuple_impl& __t)
- _NOEXCEPT_(__all<__is_nothrow_swappable<_Tp>::value...>::value)
- {
- std::__swallow(__tuple_leaf<_Indx, _Tp>::swap(static_cast<__tuple_leaf<_Indx, _Tp>&>(__t))...);
- }
-
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
- void swap(const __tuple_impl& __t) const
- _NOEXCEPT_(__all<__is_nothrow_swappable<const _Tp>::value...>::value)
- {
- std::__swallow(__tuple_leaf<_Indx, _Tp>::swap(static_cast<const __tuple_leaf<_Indx, _Tp>&>(__t))...);
- }
+ : public __tuple_leaf<_Indx, _Tp>... {
+ _LIBCPP_HIDE_FROM_ABI constexpr __tuple_impl()
+ _NOEXCEPT_(__all<is_nothrow_default_constructible<_Tp>::value...>::value) {}
+
+ template <size_t... _Uf, class... _Tf, size_t... _Ul, class... _Tl, class... _Up>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 explicit __tuple_impl(
+ __tuple_indices<_Uf...>, __tuple_types<_Tf...>, __tuple_indices<_Ul...>, __tuple_types<_Tl...>, _Up&&... __u)
+ _NOEXCEPT_((__all<is_nothrow_constructible<_Tf, _Up>::value...>::value &&
+ __all<is_nothrow_default_constructible<_Tl>::value...>::value))
+ : __tuple_leaf<_Uf, _Tf>(std::forward<_Up>(__u))..., __tuple_leaf<_Ul, _Tl>()... {}
+
+ template <class _Alloc, size_t... _Uf, class... _Tf, size_t... _Ul, class... _Tl, class... _Up>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 explicit __tuple_impl(
+ allocator_arg_t,
+ const _Alloc& __a,
+ __tuple_indices<_Uf...>,
+ __tuple_types<_Tf...>,
+ __tuple_indices<_Ul...>,
+ __tuple_types<_Tl...>,
+ _Up&&... __u)
+ : __tuple_leaf<_Uf, _Tf>(__uses_alloc_ctor<_Tf, _Alloc, _Up>(), __a, std::forward<_Up>(__u))...,
+ __tuple_leaf<_Ul, _Tl>(__uses_alloc_ctor<_Tl, _Alloc>(), __a)... {}
+
+ template <class _Tuple, class = __enable_if_t<__tuple_constructible<_Tuple, tuple<_Tp...> >::value> >
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 __tuple_impl(_Tuple&& __t) _NOEXCEPT_(
+ (__all<is_nothrow_constructible<
+ _Tp,
+ typename tuple_element<_Indx, typename __make_tuple_types<_Tuple>::type>::type>::value...>::value))
+ : __tuple_leaf<_Indx, _Tp>(
+ std::forward<typename tuple_element<_Indx, typename __make_tuple_types<_Tuple>::type>::type>(
+ std::get<_Indx>(__t)))... {}
+
+ template <class _Alloc, class _Tuple, class = __enable_if_t<__tuple_constructible<_Tuple, tuple<_Tp...> >::value> >
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 __tuple_impl(allocator_arg_t, const _Alloc& __a, _Tuple&& __t)
+ : __tuple_leaf<_Indx, _Tp>(
+ __uses_alloc_ctor<_Tp,
+ _Alloc,
+ typename tuple_element<_Indx, typename __make_tuple_types<_Tuple>::type>::type>(),
+ __a,
+ std::forward<typename tuple_element<_Indx, typename __make_tuple_types<_Tuple>::type>::type>(
+ std::get<_Indx>(__t)))... {}
+
+ __tuple_impl(const __tuple_impl&) = default;
+ __tuple_impl(__tuple_impl&&) = default;
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 void swap(__tuple_impl& __t)
+ _NOEXCEPT_(__all<__is_nothrow_swappable<_Tp>::value...>::value) {
+ std::__swallow(__tuple_leaf<_Indx, _Tp>::swap(static_cast<__tuple_leaf<_Indx, _Tp>&>(__t))...);
+ }
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 void swap(const __tuple_impl& __t) const
+ _NOEXCEPT_(__all<__is_nothrow_swappable<const _Tp>::value...>::value) {
+ std::__swallow(__tuple_leaf<_Indx, _Tp>::swap(static_cast<const __tuple_leaf<_Indx, _Tp>&>(__t))...);
+ }
};
-template<class _Dest, class _Source, size_t ..._Np>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
-void __memberwise_copy_assign(_Dest& __dest, _Source const& __source, __tuple_indices<_Np...>) {
- std::__swallow(((std::get<_Np>(__dest) = std::get<_Np>(__source)), void(), 0)...);
+template <class _Dest, class _Source, size_t... _Np>
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 void
+__memberwise_copy_assign(_Dest& __dest, _Source const& __source, __tuple_indices<_Np...>) {
+ std::__swallow(((std::get<_Np>(__dest) = std::get<_Np>(__source)), void(), 0)...);
}
-template<class _Dest, class _Source, class ..._Up, size_t ..._Np>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
-void __memberwise_forward_assign(_Dest& __dest, _Source&& __source, __tuple_types<_Up...>, __tuple_indices<_Np...>) {
- std::__swallow(((
- std::get<_Np>(__dest) = std::forward<_Up>(std::get<_Np>(__source))
- ), void(), 0)...);
+template <class _Dest, class _Source, class... _Up, size_t... _Np>
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 void
+__memberwise_forward_assign(_Dest& __dest, _Source&& __source, __tuple_types<_Up...>, __tuple_indices<_Np...>) {
+ std::__swallow(((std::get<_Np>(__dest) = std::forward<_Up>(std::get<_Np>(__source))), void(), 0)...);
}
-template <class ..._Tp>
-class _LIBCPP_TEMPLATE_VIS tuple
-{
- typedef __tuple_impl<typename __make_tuple_indices<sizeof...(_Tp)>::type, _Tp...> _BaseT;
-
- _BaseT __base_;
-
- template <size_t _Jp, class ..._Up> friend _LIBCPP_CONSTEXPR_SINCE_CXX14
- typename tuple_element<_Jp, tuple<_Up...> >::type& get(tuple<_Up...>&) _NOEXCEPT;
- template <size_t _Jp, class ..._Up> friend _LIBCPP_CONSTEXPR_SINCE_CXX14
- const typename tuple_element<_Jp, tuple<_Up...> >::type& get(const tuple<_Up...>&) _NOEXCEPT;
- template <size_t _Jp, class ..._Up> friend _LIBCPP_CONSTEXPR_SINCE_CXX14
- typename tuple_element<_Jp, tuple<_Up...> >::type&& get(tuple<_Up...>&&) _NOEXCEPT;
- template <size_t _Jp, class ..._Up> friend _LIBCPP_CONSTEXPR_SINCE_CXX14
- const typename tuple_element<_Jp, tuple<_Up...> >::type&& get(const tuple<_Up...>&&) _NOEXCEPT;
+template <class... _Tp>
+class _LIBCPP_TEMPLATE_VIS tuple {
+ typedef __tuple_impl<typename __make_tuple_indices<sizeof...(_Tp)>::type, _Tp...> _BaseT;
+
+ _BaseT __base_;
+
+ template <size_t _Jp, class... _Up>
+ friend _LIBCPP_CONSTEXPR_SINCE_CXX14 typename tuple_element<_Jp, tuple<_Up...> >::type& get(tuple<_Up...>&) _NOEXCEPT;
+ template <size_t _Jp, class... _Up>
+ friend _LIBCPP_CONSTEXPR_SINCE_CXX14 const typename tuple_element<_Jp, tuple<_Up...> >::type&
+ get(const tuple<_Up...>&) _NOEXCEPT;
+ template <size_t _Jp, class... _Up>
+ friend _LIBCPP_CONSTEXPR_SINCE_CXX14 typename tuple_element<_Jp, tuple<_Up...> >::type&&
+ get(tuple<_Up...>&&) _NOEXCEPT;
+ template <size_t _Jp, class... _Up>
+ friend _LIBCPP_CONSTEXPR_SINCE_CXX14 const typename tuple_element<_Jp, tuple<_Up...> >::type&&
+ get(const tuple<_Up...>&&) _NOEXCEPT;
+
public:
- // [tuple.cnstr]
-
-_LIBCPP_DIAGNOSTIC_PUSH
-_LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Wc++20-extensions")
-_LIBCPP_GCC_DIAGNOSTIC_IGNORED("-Wc++20-extensions")
-
- // tuple() constructors (including allocator_arg_t variants)
- template <template<class...> class _IsImpDefault = __is_implicitly_default_constructible,
- template<class...> class _IsDefault = is_default_constructible, __enable_if_t<
- _And<
- _IsDefault<_Tp>...
- >::value
- , int> = 0>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR
- explicit(_Not<_Lazy<_And, _IsImpDefault<_Tp>...> >::value) tuple()
- _NOEXCEPT_(_And<is_nothrow_default_constructible<_Tp>...>::value)
- { }
-
- template <class _Alloc,
- template<class...> class _IsImpDefault = __is_implicitly_default_constructible,
- template<class...> class _IsDefault = is_default_constructible, __enable_if_t<
- _And<
- _IsDefault<_Tp>...
- >::value
- , int> = 0>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- explicit(_Not<_Lazy<_And, _IsImpDefault<_Tp>...> >::value) tuple(allocator_arg_t, _Alloc const& __a)
- : __base_(allocator_arg_t(), __a,
- __tuple_indices<>(), __tuple_types<>(),
- typename __make_tuple_indices<sizeof...(_Tp), 0>::type(),
- __tuple_types<_Tp...>()) {}
-
- // tuple(const T&...) constructors (including allocator_arg_t variants)
- template <template<class...> class _And = _And, __enable_if_t<
- _And<
- _BoolConstant<sizeof...(_Tp) >= 1>,
- is_copy_constructible<_Tp>...
- >::value
- , int> = 0>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
- explicit(_Not<_Lazy<_And, is_convertible<const _Tp&, _Tp>...> >::value) tuple(const _Tp& ... __t)
- _NOEXCEPT_(_And<is_nothrow_copy_constructible<_Tp>...>::value)
- : __base_(typename __make_tuple_indices<sizeof...(_Tp)>::type(),
+ // [tuple.cnstr]
+
+ _LIBCPP_DIAGNOSTIC_PUSH
+ _LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Wc++20-extensions")
+ _LIBCPP_GCC_DIAGNOSTIC_IGNORED("-Wc++20-extensions")
+
+ // tuple() constructors (including allocator_arg_t variants)
+ template <template <class...> class _IsImpDefault = __is_implicitly_default_constructible,
+ template <class...> class _IsDefault = is_default_constructible,
+ __enable_if_t< _And< _IsDefault<_Tp>... >::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR explicit(_Not<_Lazy<_And, _IsImpDefault<_Tp>...> >::value) tuple()
+ _NOEXCEPT_(_And<is_nothrow_default_constructible<_Tp>...>::value) {}
+
+ template <class _Alloc,
+ template <class...> class _IsImpDefault = __is_implicitly_default_constructible,
+ template <class...> class _IsDefault = is_default_constructible,
+ __enable_if_t< _And< _IsDefault<_Tp>... >::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 explicit(_Not<_Lazy<_And, _IsImpDefault<_Tp>...> >::value)
+ tuple(allocator_arg_t, _Alloc const& __a)
+ : __base_(allocator_arg_t(),
+ __a,
+ __tuple_indices<>(),
+ __tuple_types<>(),
+ typename __make_tuple_indices<sizeof...(_Tp), 0>::type(),
+ __tuple_types<_Tp...>()) {}
+
+ // tuple(const T&...) constructors (including allocator_arg_t variants)
+ template <template <class...> class _And = _And,
+ __enable_if_t< _And< _BoolConstant<sizeof...(_Tp) >= 1>, is_copy_constructible<_Tp>... >::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 explicit(
+ _Not<_Lazy<_And, is_convertible<const _Tp&, _Tp>...> >::value) tuple(const _Tp&... __t)
+ _NOEXCEPT_(_And<is_nothrow_copy_constructible<_Tp>...>::value)
+ : __base_(typename __make_tuple_indices<sizeof...(_Tp)>::type(),
typename __make_tuple_types<tuple, sizeof...(_Tp)>::type(),
typename __make_tuple_indices<0>::type(),
typename __make_tuple_types<tuple, 0>::type(),
- __t...
- ) {}
-
- template <class _Alloc, template<class...> class _And = _And, __enable_if_t<
- _And<
- _BoolConstant<sizeof...(_Tp) >= 1>,
- is_copy_constructible<_Tp>...
- >::value
- , int> = 0>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- explicit(_Not<_Lazy<_And, is_convertible<const _Tp&, _Tp>...> >::value) tuple(allocator_arg_t, const _Alloc& __a, const _Tp& ... __t)
- : __base_(allocator_arg_t(), __a,
+ __t...) {}
+
+ template <class _Alloc,
+ template <class...> class _And = _And,
+ __enable_if_t< _And< _BoolConstant<sizeof...(_Tp) >= 1>, is_copy_constructible<_Tp>... >::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 explicit(
+ _Not<_Lazy<_And, is_convertible<const _Tp&, _Tp>...> >::value)
+ tuple(allocator_arg_t, const _Alloc& __a, const _Tp&... __t)
+ : __base_(allocator_arg_t(),
+ __a,
typename __make_tuple_indices<sizeof...(_Tp)>::type(),
typename __make_tuple_types<tuple, sizeof...(_Tp)>::type(),
typename __make_tuple_indices<0>::type(),
typename __make_tuple_types<tuple, 0>::type(),
- __t...
- ) {}
-
- // tuple(U&& ...) constructors (including allocator_arg_t variants)
- template <class ..._Up> struct _IsThisTuple : false_type { };
- template <class _Up> struct _IsThisTuple<_Up> : is_same<__remove_cvref_t<_Up>, tuple> { };
-
- template <class ..._Up>
- struct _EnableUTypesCtor : _And<
- _BoolConstant<sizeof...(_Tp) >= 1>,
- _Not<_IsThisTuple<_Up...> >, // extension to allow mis-behaved user constructors
- is_constructible<_Tp, _Up>...
- > { };
-
- template <class ..._Up, __enable_if_t<
- _And<
- _BoolConstant<sizeof...(_Up) == sizeof...(_Tp)>,
- _EnableUTypesCtor<_Up...>
- >::value
- , int> = 0>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
- explicit(_Not<_Lazy<_And, is_convertible<_Up, _Tp>...> >::value) tuple(_Up&&... __u)
- _NOEXCEPT_((_And<is_nothrow_constructible<_Tp, _Up>...>::value))
- : __base_(typename __make_tuple_indices<sizeof...(_Up)>::type(),
- typename __make_tuple_types<tuple, sizeof...(_Up)>::type(),
- typename __make_tuple_indices<sizeof...(_Tp), sizeof...(_Up)>::type(),
- typename __make_tuple_types<tuple, sizeof...(_Tp), sizeof...(_Up)>::type(),
- std::forward<_Up>(__u)...) {}
-
- template <class _Alloc, class ..._Up, __enable_if_t<
- _And<
- _BoolConstant<sizeof...(_Up) == sizeof...(_Tp)>,
- _EnableUTypesCtor<_Up...>
- >::value
- , int> = 0>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- explicit(_Not<_Lazy<_And, is_convertible<_Up, _Tp>...> >::value) tuple(allocator_arg_t, const _Alloc& __a, _Up&&... __u)
- : __base_(allocator_arg_t(), __a,
- typename __make_tuple_indices<sizeof...(_Up)>::type(),
- typename __make_tuple_types<tuple, sizeof...(_Up)>::type(),
- typename __make_tuple_indices<sizeof...(_Tp), sizeof...(_Up)>::type(),
- typename __make_tuple_types<tuple, sizeof...(_Tp), sizeof...(_Up)>::type(),
- std::forward<_Up>(__u)...) {}
-
- // Copy and move constructors (including the allocator_arg_t variants)
- tuple(const tuple&) = default;
- tuple(tuple&&) = default;
-
- template <class _Alloc, template<class...> class _And = _And, __enable_if_t<
- _And<is_copy_constructible<_Tp>...>::value
- , int> = 0>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- tuple(allocator_arg_t, const _Alloc& __alloc, const tuple& __t)
- : __base_(allocator_arg_t(), __alloc, __t)
- { }
-
- template <class _Alloc, template<class...> class _And = _And, __enable_if_t<
- _And<is_move_constructible<_Tp>...>::value
- , int> = 0>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- tuple(allocator_arg_t, const _Alloc& __alloc, tuple&& __t)
- : __base_(allocator_arg_t(), __alloc, std::move(__t))
- { }
-
- // tuple(const tuple<U...>&) constructors (including allocator_arg_t variants)
-
- template <class _OtherTuple, class _DecayedOtherTuple = __remove_cvref_t<_OtherTuple>, class = void>
- struct _EnableCtorFromUTypesTuple : false_type {};
-
- template <class _OtherTuple, class... _Up>
- struct _EnableCtorFromUTypesTuple<_OtherTuple, tuple<_Up...>,
- // the length of the packs needs to checked first otherwise the 2 packs cannot be expanded simultaneously below
- __enable_if_t<sizeof...(_Up) == sizeof...(_Tp)>> : _And<
- // the two conditions below are not in spec. The purpose is to disable the UTypes Ctor when copy/move Ctor can work.
- // Otherwise, is_constructible can trigger hard error in those cases https://godbolt.org/z/M94cGdKcE
- _Not<is_same<_OtherTuple, const tuple&> >,
- _Not<is_same<_OtherTuple, tuple&&> >,
- is_constructible<_Tp, __copy_cvref_t<_OtherTuple, _Up> >...,
- _Lazy<_Or, _BoolConstant<sizeof...(_Tp) != 1>,
- // _Tp and _Up are 1-element packs - the pack expansions look
- // weird to avoid tripping up the type traits in degenerate cases
- _Lazy<_And,
- _Not<is_same<_Tp, _Up> >...,
- _Not<is_convertible<_OtherTuple, _Tp> >...,
- _Not<is_constructible<_Tp, _OtherTuple> >...
- >
- >
- > {};
-
- template <class ..._Up, __enable_if_t<
- _And<
- _EnableCtorFromUTypesTuple<const tuple<_Up...>&>
- >::value
- , int> = 0>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
- explicit(_Not<_Lazy<_And, is_convertible<const _Up&, _Tp>...> >::value) tuple(const tuple<_Up...>& __t)
- _NOEXCEPT_((_And<is_nothrow_constructible<_Tp, const _Up&>...>::value))
- : __base_(__t)
- { }
-
- template <class ..._Up, class _Alloc, __enable_if_t<
- _And<
- _EnableCtorFromUTypesTuple<const tuple<_Up...>&>
- >::value
- , int> = 0>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- explicit(_Not<_Lazy<_And, is_convertible<const _Up&, _Tp>...> >::value) tuple(allocator_arg_t, const _Alloc& __a, const tuple<_Up...>& __t)
- : __base_(allocator_arg_t(), __a, __t)
- { }
-
-#if _LIBCPP_STD_VER >= 23
- // tuple(tuple<U...>&) constructors (including allocator_arg_t variants)
-
- template <class... _Up, enable_if_t<
- _EnableCtorFromUTypesTuple<tuple<_Up...>&>::value>* = nullptr>
- _LIBCPP_HIDE_FROM_ABI constexpr
- explicit(!_Lazy<_And, is_convertible<_Up&, _Tp>...>::value)
- tuple(tuple<_Up...>& __t) : __base_(__t) {}
-
- template <class _Alloc, class... _Up, enable_if_t<
- _EnableCtorFromUTypesTuple<tuple<_Up...>&>::value>* = nullptr>
- _LIBCPP_HIDE_FROM_ABI constexpr
- explicit(!_Lazy<_And, is_convertible<_Up&, _Tp>...>::value)
- tuple(allocator_arg_t, const _Alloc& __alloc, tuple<_Up...>& __t) : __base_(allocator_arg_t(), __alloc, __t) {}
-#endif // _LIBCPP_STD_VER >= 23
-
- // tuple(tuple<U...>&&) constructors (including allocator_arg_t variants)
- template <class ..._Up, __enable_if_t<
- _And<
- _EnableCtorFromUTypesTuple<tuple<_Up...>&&>
- >::value
- , int> = 0>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
- explicit(_Not<_Lazy<_And, is_convertible<_Up, _Tp>...> >::value) tuple(tuple<_Up...>&& __t)
- _NOEXCEPT_((_And<is_nothrow_constructible<_Tp, _Up>...>::value))
- : __base_(std::move(__t))
- { }
-
- template <class _Alloc, class ..._Up, __enable_if_t<
- _And<
- _EnableCtorFromUTypesTuple<tuple<_Up...>&&>
- >::value
- , int> = 0>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- explicit(_Not<_Lazy<_And, is_convertible<_Up, _Tp>...> >::value) tuple(allocator_arg_t, const _Alloc& __a, tuple<_Up...>&& __t)
- : __base_(allocator_arg_t(), __a, std::move(__t))
- { }
-
-#if _LIBCPP_STD_VER >= 23
- // tuple(const tuple<U...>&&) constructors (including allocator_arg_t variants)
-
- template <class... _Up, enable_if_t<
- _EnableCtorFromUTypesTuple<const tuple<_Up...>&&>::value>* = nullptr>
- _LIBCPP_HIDE_FROM_ABI constexpr
- explicit(!_Lazy<_And, is_convertible<const _Up&&, _Tp>...>::value)
- tuple(const tuple<_Up...>&& __t) : __base_(std::move(__t)) {}
-
- template <class _Alloc, class... _Up, enable_if_t<
- _EnableCtorFromUTypesTuple<const tuple<_Up...>&&>::value>* = nullptr>
- _LIBCPP_HIDE_FROM_ABI constexpr
- explicit(!_Lazy<_And, is_convertible<const _Up&&, _Tp>...>::value)
- tuple(allocator_arg_t, const _Alloc& __alloc, const tuple<_Up...>&& __t)
- : __base_(allocator_arg_t(), __alloc, std::move(__t)) {}
-#endif // _LIBCPP_STD_VER >= 23
-
- // tuple(const pair<U1, U2>&) constructors (including allocator_arg_t variants)
-
- template <template <class...> class _Pred, class _Pair, class _DecayedPair = __remove_cvref_t<_Pair>, class _Tuple = tuple>
- struct _CtorPredicateFromPair : false_type{};
-
- template <template <class...> class _Pred, class _Pair, class _Up1, class _Up2, class _Tp1, class _Tp2>
- struct _CtorPredicateFromPair<_Pred, _Pair, pair<_Up1, _Up2>, tuple<_Tp1, _Tp2> > : _And<
- _Pred<_Tp1, __copy_cvref_t<_Pair, _Up1> >,
- _Pred<_Tp2, __copy_cvref_t<_Pair, _Up2> >
- > {};
-
- template <class _Pair>
- struct _EnableCtorFromPair : _CtorPredicateFromPair<is_constructible, _Pair>{};
-
- template <class _Pair>
- struct _NothrowConstructibleFromPair : _CtorPredicateFromPair<is_nothrow_constructible, _Pair>{};
-
- template <class _Pair, class _DecayedPair = __remove_cvref_t<_Pair>, class _Tuple = tuple>
- struct _BothImplicitlyConvertible : false_type{};
-
- template <class _Pair, class _Up1, class _Up2, class _Tp1, class _Tp2>
- struct _BothImplicitlyConvertible<_Pair, pair<_Up1, _Up2>, tuple<_Tp1, _Tp2> > : _And<
- is_convertible<__copy_cvref_t<_Pair, _Up1>, _Tp1>,
- is_convertible<__copy_cvref_t<_Pair, _Up2>, _Tp2>
- > {};
-
- template <class _Up1, class _Up2, template<class...> class _And = _And, __enable_if_t<
- _And<
- _EnableCtorFromPair<const pair<_Up1, _Up2>&>
- >::value
- , int> = 0>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
- explicit(_Not<_BothImplicitlyConvertible<const pair<_Up1, _Up2>&> >::value) tuple(const pair<_Up1, _Up2>& __p)
- _NOEXCEPT_((_NothrowConstructibleFromPair<const pair<_Up1, _Up2>&>::value))
- : __base_(__p)
- { }
-
- template <class _Alloc, class _Up1, class _Up2, template<class...> class _And = _And, __enable_if_t<
- _And<
- _EnableCtorFromPair<const pair<_Up1, _Up2>&>
- >::value
- , int> = 0>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- explicit(_Not<_BothImplicitlyConvertible<const pair<_Up1, _Up2>&> >::value) tuple(allocator_arg_t, const _Alloc& __a, const pair<_Up1, _Up2>& __p)
- : __base_(allocator_arg_t(), __a, __p)
- { }
-
-#if _LIBCPP_STD_VER >= 23
- // tuple(pair<U1, U2>&) constructors (including allocator_arg_t variants)
-
- template <class _U1, class _U2, enable_if_t<
- _EnableCtorFromPair<pair<_U1, _U2>&>::value>* = nullptr>
- _LIBCPP_HIDE_FROM_ABI constexpr
- explicit(!_BothImplicitlyConvertible<pair<_U1, _U2>&>::value)
- tuple(pair<_U1, _U2>& __p) : __base_(__p) {}
-
- template <class _Alloc, class _U1, class _U2, enable_if_t<
- _EnableCtorFromPair<std::pair<_U1, _U2>&>::value>* = nullptr>
- _LIBCPP_HIDE_FROM_ABI constexpr
- explicit(!_BothImplicitlyConvertible<pair<_U1, _U2>&>::value)
- tuple(allocator_arg_t, const _Alloc& __alloc, pair<_U1, _U2>& __p) : __base_(allocator_arg_t(), __alloc, __p) {}
-#endif
+ __t...) {}
+
+ // tuple(U&& ...) constructors (including allocator_arg_t variants)
+ template <class... _Up>
+ struct _IsThisTuple : false_type {};
+ template <class _Up>
+ struct _IsThisTuple<_Up> : is_same<__remove_cvref_t<_Up>, tuple> {};
+
+ template <class... _Up>
+ struct _EnableUTypesCtor
+ : _And< _BoolConstant<sizeof...(_Tp) >= 1>,
+ _Not<_IsThisTuple<_Up...> >, // extension to allow mis-behaved user constructors
+ is_constructible<_Tp, _Up>... > {};
+
+ template <class... _Up,
+ __enable_if_t< _And< _BoolConstant<sizeof...(_Up) == sizeof...(_Tp)>, _EnableUTypesCtor<_Up...> >::value,
+ int> = 0>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 explicit(_Not<_Lazy<_And, is_convertible<_Up, _Tp>...> >::value)
+ tuple(_Up&&... __u) _NOEXCEPT_((_And<is_nothrow_constructible<_Tp, _Up>...>::value))
+ : __base_(typename __make_tuple_indices<sizeof...(_Up)>::type(),
+ typename __make_tuple_types<tuple, sizeof...(_Up)>::type(),
+ typename __make_tuple_indices<sizeof...(_Tp), sizeof...(_Up)>::type(),
+ typename __make_tuple_types<tuple, sizeof...(_Tp), sizeof...(_Up)>::type(),
+ std::forward<_Up>(__u)...) {}
+
+ template <class _Alloc,
+ class... _Up,
+ __enable_if_t< _And< _BoolConstant<sizeof...(_Up) == sizeof...(_Tp)>, _EnableUTypesCtor<_Up...> >::value,
+ int> = 0>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 explicit(_Not<_Lazy<_And, is_convertible<_Up, _Tp>...> >::value)
+ tuple(allocator_arg_t, const _Alloc& __a, _Up&&... __u)
+ : __base_(allocator_arg_t(),
+ __a,
+ typename __make_tuple_indices<sizeof...(_Up)>::type(),
+ typename __make_tuple_types<tuple, sizeof...(_Up)>::type(),
+ typename __make_tuple_indices<sizeof...(_Tp), sizeof...(_Up)>::type(),
+ typename __make_tuple_types<tuple, sizeof...(_Tp), sizeof...(_Up)>::type(),
+ std::forward<_Up>(__u)...) {}
+
+ // Copy and move constructors (including the allocator_arg_t variants)
+ tuple(const tuple&) = default;
+ tuple(tuple&&) = default;
+
+ template <class _Alloc,
+ template <class...> class _And = _And,
+ __enable_if_t< _And<is_copy_constructible<_Tp>...>::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 tuple(allocator_arg_t, const _Alloc& __alloc, const tuple& __t)
+ : __base_(allocator_arg_t(), __alloc, __t) {}
+
+ template <class _Alloc,
+ template <class...> class _And = _And,
+ __enable_if_t< _And<is_move_constructible<_Tp>...>::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 tuple(allocator_arg_t, const _Alloc& __alloc, tuple&& __t)
+ : __base_(allocator_arg_t(), __alloc, std::move(__t)) {}
+
+ // tuple(const tuple<U...>&) constructors (including allocator_arg_t variants)
+
+ template <class _OtherTuple, class _DecayedOtherTuple = __remove_cvref_t<_OtherTuple>, class = void>
+ struct _EnableCtorFromUTypesTuple : false_type {};
+
+ template <class _OtherTuple, class... _Up>
+ struct _EnableCtorFromUTypesTuple<
+ _OtherTuple,
+ tuple<_Up...>,
+ // the length of the packs needs to checked first otherwise the 2 packs cannot be expanded simultaneously below
+ __enable_if_t<sizeof...(_Up) == sizeof...(_Tp)>>
+ : _And<
+ // the two conditions below are not in spec. The purpose is to disable the UTypes Ctor when copy/move Ctor
+ // can work. Otherwise, is_constructible can trigger hard error in those cases
+ // https://godbolt.org/z/M94cGdKcE
+ _Not<is_same<_OtherTuple, const tuple&> >,
+ _Not<is_same<_OtherTuple, tuple&&> >,
+ is_constructible<_Tp, __copy_cvref_t<_OtherTuple, _Up> >...,
+ _Lazy<_Or,
+ _BoolConstant<sizeof...(_Tp) != 1>,
+ // _Tp and _Up are 1-element packs - the pack expansions look
+ // weird to avoid tripping up the type traits in degenerate cases
+ _Lazy<_And,
+ _Not<is_same<_Tp, _Up> >...,
+ _Not<is_convertible<_OtherTuple, _Tp> >...,
+ _Not<is_constructible<_Tp, _OtherTuple> >... > > > {};
+
+ template <class... _Up, __enable_if_t< _And< _EnableCtorFromUTypesTuple<const tuple<_Up...>&> >::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 explicit(
+ _Not<_Lazy<_And, is_convertible<const _Up&, _Tp>...> >::value) tuple(const tuple<_Up...>& __t)
+ _NOEXCEPT_((_And<is_nothrow_constructible<_Tp, const _Up&>...>::value))
+ : __base_(__t) {}
+
+ template <class... _Up,
+ class _Alloc,
+ __enable_if_t< _And< _EnableCtorFromUTypesTuple<const tuple<_Up...>&> >::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 explicit(
+ _Not<_Lazy<_And, is_convertible<const _Up&, _Tp>...> >::value)
+ tuple(allocator_arg_t, const _Alloc& __a, const tuple<_Up...>& __t)
+ : __base_(allocator_arg_t(), __a, __t) {}
+
+# if _LIBCPP_STD_VER >= 23
+ // tuple(tuple<U...>&) constructors (including allocator_arg_t variants)
+
+ template <class... _Up, enable_if_t< _EnableCtorFromUTypesTuple<tuple<_Up...>&>::value>* = nullptr>
+ _LIBCPP_HIDE_FROM_ABI constexpr explicit(!_Lazy<_And, is_convertible<_Up&, _Tp>...>::value) tuple(tuple<_Up...>& __t)
+ : __base_(__t) {}
+
+ template <class _Alloc, class... _Up, enable_if_t< _EnableCtorFromUTypesTuple<tuple<_Up...>&>::value>* = nullptr>
+ _LIBCPP_HIDE_FROM_ABI constexpr explicit(!_Lazy<_And, is_convertible<_Up&, _Tp>...>::value)
+ tuple(allocator_arg_t, const _Alloc& __alloc, tuple<_Up...>& __t)
+ : __base_(allocator_arg_t(), __alloc, __t) {}
+# endif // _LIBCPP_STD_VER >= 23
+
+ // tuple(tuple<U...>&&) constructors (including allocator_arg_t variants)
+ template <class... _Up, __enable_if_t< _And< _EnableCtorFromUTypesTuple<tuple<_Up...>&&> >::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 explicit(_Not<_Lazy<_And, is_convertible<_Up, _Tp>...> >::value)
+ tuple(tuple<_Up...>&& __t) _NOEXCEPT_((_And<is_nothrow_constructible<_Tp, _Up>...>::value))
+ : __base_(std::move(__t)) {}
+
+ template <class _Alloc,
+ class... _Up,
+ __enable_if_t< _And< _EnableCtorFromUTypesTuple<tuple<_Up...>&&> >::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 explicit(_Not<_Lazy<_And, is_convertible<_Up, _Tp>...> >::value)
+ tuple(allocator_arg_t, const _Alloc& __a, tuple<_Up...>&& __t)
+ : __base_(allocator_arg_t(), __a, std::move(__t)) {}
+
+# if _LIBCPP_STD_VER >= 23
+ // tuple(const tuple<U...>&&) constructors (including allocator_arg_t variants)
+
+ template <class... _Up, enable_if_t< _EnableCtorFromUTypesTuple<const tuple<_Up...>&&>::value>* = nullptr>
+ _LIBCPP_HIDE_FROM_ABI constexpr explicit(!_Lazy<_And, is_convertible<const _Up&&, _Tp>...>::value)
+ tuple(const tuple<_Up...>&& __t)
+ : __base_(std::move(__t)) {}
+
+ template <class _Alloc,
+ class... _Up,
+ enable_if_t< _EnableCtorFromUTypesTuple<const tuple<_Up...>&&>::value>* = nullptr>
+ _LIBCPP_HIDE_FROM_ABI constexpr explicit(!_Lazy<_And, is_convertible<const _Up&&, _Tp>...>::value)
+ tuple(allocator_arg_t, const _Alloc& __alloc, const tuple<_Up...>&& __t)
+ : __base_(allocator_arg_t(), __alloc, std::move(__t)) {}
+# endif // _LIBCPP_STD_VER >= 23
+
+ // tuple(const pair<U1, U2>&) constructors (including allocator_arg_t variants)
+
+ template <template <class...> class _Pred,
+ class _Pair,
+ class _DecayedPair = __remove_cvref_t<_Pair>,
+ class _Tuple = tuple>
+ struct _CtorPredicateFromPair : false_type {};
+
+ template <template <class...> class _Pred, class _Pair, class _Up1, class _Up2, class _Tp1, class _Tp2>
+ struct _CtorPredicateFromPair<_Pred, _Pair, pair<_Up1, _Up2>, tuple<_Tp1, _Tp2> >
+ : _And< _Pred<_Tp1, __copy_cvref_t<_Pair, _Up1> >, _Pred<_Tp2, __copy_cvref_t<_Pair, _Up2> > > {};
+
+ template <class _Pair>
+ struct _EnableCtorFromPair : _CtorPredicateFromPair<is_constructible, _Pair> {};
+
+ template <class _Pair>
+ struct _NothrowConstructibleFromPair : _CtorPredicateFromPair<is_nothrow_constructible, _Pair> {};
+
+ template <class _Pair, class _DecayedPair = __remove_cvref_t<_Pair>, class _Tuple = tuple>
+ struct _BothImplicitlyConvertible : false_type {};
+
+ template <class _Pair, class _Up1, class _Up2, class _Tp1, class _Tp2>
+ struct _BothImplicitlyConvertible<_Pair, pair<_Up1, _Up2>, tuple<_Tp1, _Tp2> >
+ : _And< is_convertible<__copy_cvref_t<_Pair, _Up1>, _Tp1>, is_convertible<__copy_cvref_t<_Pair, _Up2>, _Tp2> > {};
+
+ template <class _Up1,
+ class _Up2,
+ template <class...> class _And = _And,
+ __enable_if_t< _And< _EnableCtorFromPair<const pair<_Up1, _Up2>&> >::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 explicit(
+ _Not<_BothImplicitlyConvertible<const pair<_Up1, _Up2>&> >::value) tuple(const pair<_Up1, _Up2>& __p)
+ _NOEXCEPT_((_NothrowConstructibleFromPair<const pair<_Up1, _Up2>&>::value))
+ : __base_(__p) {}
+
+ template <class _Alloc,
+ class _Up1,
+ class _Up2,
+ template <class...> class _And = _And,
+ __enable_if_t< _And< _EnableCtorFromPair<const pair<_Up1, _Up2>&> >::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 explicit(
+ _Not<_BothImplicitlyConvertible<const pair<_Up1, _Up2>&> >::value)
+ tuple(allocator_arg_t, const _Alloc& __a, const pair<_Up1, _Up2>& __p)
+ : __base_(allocator_arg_t(), __a, __p) {}
+
+# if _LIBCPP_STD_VER >= 23
+ // tuple(pair<U1, U2>&) constructors (including allocator_arg_t variants)
+
+ template <class _U1, class _U2, enable_if_t< _EnableCtorFromPair<pair<_U1, _U2>&>::value>* = nullptr>
+ _LIBCPP_HIDE_FROM_ABI constexpr explicit(!_BothImplicitlyConvertible<pair<_U1, _U2>&>::value)
+ tuple(pair<_U1, _U2>& __p)
+ : __base_(__p) {}
+
+ template <class _Alloc,
+ class _U1,
+ class _U2,
+ enable_if_t< _EnableCtorFromPair<std::pair<_U1, _U2>&>::value>* = nullptr>
+ _LIBCPP_HIDE_FROM_ABI constexpr explicit(!_BothImplicitlyConvertible<pair<_U1, _U2>&>::value)
+ tuple(allocator_arg_t, const _Alloc& __alloc, pair<_U1, _U2>& __p)
+ : __base_(allocator_arg_t(), __alloc, __p) {}
+# endif
- // tuple(pair<U1, U2>&&) constructors (including allocator_arg_t variants)
-
- template <class _Up1, class _Up2, template<class...> class _And = _And, __enable_if_t<
- _And<
- _EnableCtorFromPair<pair<_Up1, _Up2>&&>
- >::value
- , int> = 0>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
- explicit(_Not<_BothImplicitlyConvertible<pair<_Up1, _Up2>&&> >::value) tuple(pair<_Up1, _Up2>&& __p)
- _NOEXCEPT_((_NothrowConstructibleFromPair<pair<_Up1, _Up2>&&>::value))
- : __base_(std::move(__p))
- { }
-
- template <class _Alloc, class _Up1, class _Up2, template<class...> class _And = _And, __enable_if_t<
- _And<
- _EnableCtorFromPair<pair<_Up1, _Up2>&&>
- >::value
- , int> = 0>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- explicit(_Not<_BothImplicitlyConvertible<pair<_Up1, _Up2>&&> >::value) tuple(allocator_arg_t, const _Alloc& __a, pair<_Up1, _Up2>&& __p)
- : __base_(allocator_arg_t(), __a, std::move(__p))
- { }
-
-#if _LIBCPP_STD_VER >= 23
- // tuple(const pair<U1, U2>&&) constructors (including allocator_arg_t variants)
-
- template <class _U1, class _U2, enable_if_t<
- _EnableCtorFromPair<const pair<_U1, _U2>&&>::value>* = nullptr>
- _LIBCPP_HIDE_FROM_ABI constexpr
- explicit(!_BothImplicitlyConvertible<const pair<_U1, _U2>&&>::value)
- tuple(const pair<_U1, _U2>&& __p) : __base_(std::move(__p)) {}
-
- template <class _Alloc, class _U1, class _U2, enable_if_t<
- _EnableCtorFromPair<const pair<_U1, _U2>&&>::value>* = nullptr>
- _LIBCPP_HIDE_FROM_ABI constexpr
- explicit(!_BothImplicitlyConvertible<const pair<_U1, _U2>&&>::value)
- tuple(allocator_arg_t, const _Alloc& __alloc, const pair<_U1, _U2>&& __p)
- : __base_(allocator_arg_t(), __alloc, std::move(__p)) {}
-#endif // _LIBCPP_STD_VER >= 23
-
-_LIBCPP_DIAGNOSTIC_POP
-
- // [tuple.assign]
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- tuple& operator=(_If<_And<is_copy_assignable<_Tp>...>::value, tuple, __nat> const& __tuple)
- _NOEXCEPT_((_And<is_nothrow_copy_assignable<_Tp>...>::value))
- {
- std::__memberwise_copy_assign(*this, __tuple,
- typename __make_tuple_indices<sizeof...(_Tp)>::type());
- return *this;
- }
-
-#if _LIBCPP_STD_VER >= 23
- _LIBCPP_HIDE_FROM_ABI constexpr
- const tuple& operator=(tuple const& __tuple) const
- requires (_And<is_copy_assignable<const _Tp>...>::value) {
- std::__memberwise_copy_assign(*this, __tuple, typename __make_tuple_indices<sizeof...(_Tp)>::type());
- return *this;
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr
- const tuple& operator=(tuple&& __tuple) const
- requires (_And<is_assignable<const _Tp&, _Tp>...>::value) {
- std::__memberwise_forward_assign(*this,
- std::move(__tuple),
- __tuple_types<_Tp...>(),
- typename __make_tuple_indices<sizeof...(_Tp)>::type());
- return *this;
- }
-#endif // _LIBCPP_STD_VER >= 23
-
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- tuple& operator=(_If<_And<is_move_assignable<_Tp>...>::value, tuple, __nat>&& __tuple)
- _NOEXCEPT_((_And<is_nothrow_move_assignable<_Tp>...>::value))
- {
- std::__memberwise_forward_assign(*this, std::move(__tuple),
- __tuple_types<_Tp...>(),
- typename __make_tuple_indices<sizeof...(_Tp)>::type());
- return *this;
- }
-
- template<class... _Up, __enable_if_t<
- _And<
- _BoolConstant<sizeof...(_Tp) == sizeof...(_Up)>,
- is_assignable<_Tp&, _Up const&>...
- >::value
- ,int> = 0>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- tuple& operator=(tuple<_Up...> const& __tuple)
- _NOEXCEPT_((_And<is_nothrow_assignable<_Tp&, _Up const&>...>::value))
- {
- std::__memberwise_copy_assign(*this, __tuple,
- typename __make_tuple_indices<sizeof...(_Tp)>::type());
- return *this;
- }
-
- template<class... _Up, __enable_if_t<
- _And<
- _BoolConstant<sizeof...(_Tp) == sizeof...(_Up)>,
- is_assignable<_Tp&, _Up>...
- >::value
- ,int> = 0>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- tuple& operator=(tuple<_Up...>&& __tuple)
- _NOEXCEPT_((_And<is_nothrow_assignable<_Tp&, _Up>...>::value))
- {
- std::__memberwise_forward_assign(*this, std::move(__tuple),
- __tuple_types<_Up...>(),
- typename __make_tuple_indices<sizeof...(_Tp)>::type());
- return *this;
- }
-
-
-#if _LIBCPP_STD_VER >= 23
- template <class... _UTypes, enable_if_t<
- _And<_BoolConstant<sizeof...(_Tp) == sizeof...(_UTypes)>,
- is_assignable<const _Tp&, const _UTypes&>...>::value>* = nullptr>
- _LIBCPP_HIDE_FROM_ABI constexpr
- const tuple& operator=(const tuple<_UTypes...>& __u) const {
- std::__memberwise_copy_assign(*this,
- __u,
- typename __make_tuple_indices<sizeof...(_Tp)>::type());
- return *this;
- }
-
- template <class... _UTypes, enable_if_t<
- _And<_BoolConstant<sizeof...(_Tp) == sizeof...(_UTypes)>,
- is_assignable<const _Tp&, _UTypes>...>::value>* = nullptr>
- _LIBCPP_HIDE_FROM_ABI constexpr
- const tuple& operator=(tuple<_UTypes...>&& __u) const {
- std::__memberwise_forward_assign(*this,
- __u,
- __tuple_types<_UTypes...>(),
- typename __make_tuple_indices<sizeof...(_Tp)>::type());
- return *this;
- }
-#endif // _LIBCPP_STD_VER >= 23
-
- template <template<class...> class _Pred, bool _Const,
- class _Pair, class _DecayedPair = __remove_cvref_t<_Pair>, class _Tuple = tuple>
- struct _AssignPredicateFromPair : false_type {};
-
- template <template<class...> class _Pred, bool _Const,
- class _Pair, class _Up1, class _Up2, class _Tp1, class _Tp2>
- struct _AssignPredicateFromPair<_Pred, _Const, _Pair, pair<_Up1, _Up2>, tuple<_Tp1, _Tp2> > :
- _And<_Pred<__maybe_const<_Const, _Tp1>&, __copy_cvref_t<_Pair, _Up1> >,
- _Pred<__maybe_const<_Const, _Tp2>&, __copy_cvref_t<_Pair, _Up2> >
- > {};
-
- template <bool _Const, class _Pair>
- struct _EnableAssignFromPair : _AssignPredicateFromPair<is_assignable, _Const, _Pair> {};
-
- template <bool _Const, class _Pair>
- struct _NothrowAssignFromPair : _AssignPredicateFromPair<is_nothrow_assignable, _Const, _Pair> {};
-
-#if _LIBCPP_STD_VER >= 23
- template <class _U1, class _U2, enable_if_t<
- _EnableAssignFromPair<true, const pair<_U1, _U2>&>::value>* = nullptr>
- _LIBCPP_HIDE_FROM_ABI constexpr
- const tuple& operator=(const pair<_U1, _U2>& __pair) const
+ // tuple(pair<U1, U2>&&) constructors (including allocator_arg_t variants)
+
+ template <class _Up1,
+ class _Up2,
+ template <class...> class _And = _And,
+ __enable_if_t< _And< _EnableCtorFromPair<pair<_Up1, _Up2>&&> >::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 explicit(
+ _Not<_BothImplicitlyConvertible<pair<_Up1, _Up2>&&> >::value) tuple(pair<_Up1, _Up2>&& __p)
+ _NOEXCEPT_((_NothrowConstructibleFromPair<pair<_Up1, _Up2>&&>::value))
+ : __base_(std::move(__p)) {}
+
+ template <class _Alloc,
+ class _Up1,
+ class _Up2,
+ template <class...> class _And = _And,
+ __enable_if_t< _And< _EnableCtorFromPair<pair<_Up1, _Up2>&&> >::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 explicit(
+ _Not<_BothImplicitlyConvertible<pair<_Up1, _Up2>&&> >::value)
+ tuple(allocator_arg_t, const _Alloc& __a, pair<_Up1, _Up2>&& __p)
+ : __base_(allocator_arg_t(), __a, std::move(__p)) {}
+
+# if _LIBCPP_STD_VER >= 23
+ // tuple(const pair<U1, U2>&&) constructors (including allocator_arg_t variants)
+
+ template <class _U1, class _U2, enable_if_t< _EnableCtorFromPair<const pair<_U1, _U2>&&>::value>* = nullptr>
+ _LIBCPP_HIDE_FROM_ABI constexpr explicit(!_BothImplicitlyConvertible<const pair<_U1, _U2>&&>::value)
+ tuple(const pair<_U1, _U2>&& __p)
+ : __base_(std::move(__p)) {}
+
+ template <class _Alloc,
+ class _U1,
+ class _U2,
+ enable_if_t< _EnableCtorFromPair<const pair<_U1, _U2>&&>::value>* = nullptr>
+ _LIBCPP_HIDE_FROM_ABI constexpr explicit(!_BothImplicitlyConvertible<const pair<_U1, _U2>&&>::value)
+ tuple(allocator_arg_t, const _Alloc& __alloc, const pair<_U1, _U2>&& __p)
+ : __base_(allocator_arg_t(), __alloc, std::move(__p)) {}
+# endif // _LIBCPP_STD_VER >= 23
+
+ _LIBCPP_DIAGNOSTIC_POP
+
+ // [tuple.assign]
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 tuple&
+ operator=(_If<_And<is_copy_assignable<_Tp>...>::value, tuple, __nat> const& __tuple)
+ _NOEXCEPT_((_And<is_nothrow_copy_assignable<_Tp>...>::value)) {
+ std::__memberwise_copy_assign(*this, __tuple, typename __make_tuple_indices<sizeof...(_Tp)>::type());
+ return *this;
+ }
+
+# if _LIBCPP_STD_VER >= 23
+ _LIBCPP_HIDE_FROM_ABI constexpr const tuple& operator=(tuple const& __tuple) const
+ requires(_And<is_copy_assignable<const _Tp>...>::value)
+ {
+ std::__memberwise_copy_assign(*this, __tuple, typename __make_tuple_indices<sizeof...(_Tp)>::type());
+ return *this;
+ }
+
+ _LIBCPP_HIDE_FROM_ABI constexpr const tuple& operator=(tuple&& __tuple) const
+ requires(_And<is_assignable<const _Tp&, _Tp>...>::value)
+ {
+ std::__memberwise_forward_assign(
+ *this, std::move(__tuple), __tuple_types<_Tp...>(), typename __make_tuple_indices<sizeof...(_Tp)>::type());
+ return *this;
+ }
+# endif // _LIBCPP_STD_VER >= 23
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 tuple&
+ operator=(_If<_And<is_move_assignable<_Tp>...>::value, tuple, __nat>&& __tuple)
+ _NOEXCEPT_((_And<is_nothrow_move_assignable<_Tp>...>::value)) {
+ std::__memberwise_forward_assign(
+ *this, std::move(__tuple), __tuple_types<_Tp...>(), typename __make_tuple_indices<sizeof...(_Tp)>::type());
+ return *this;
+ }
+
+ template <
+ class... _Up,
+ __enable_if_t< _And< _BoolConstant<sizeof...(_Tp) == sizeof...(_Up)>, is_assignable<_Tp&, _Up const&>... >::value,
+ int> = 0>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 tuple& operator=(tuple<_Up...> const& __tuple)
+ _NOEXCEPT_((_And<is_nothrow_assignable<_Tp&, _Up const&>...>::value)) {
+ std::__memberwise_copy_assign(*this, __tuple, typename __make_tuple_indices<sizeof...(_Tp)>::type());
+ return *this;
+ }
+
+ template <class... _Up,
+ __enable_if_t< _And< _BoolConstant<sizeof...(_Tp) == sizeof...(_Up)>, is_assignable<_Tp&, _Up>... >::value,
+ int> = 0>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 tuple& operator=(tuple<_Up...>&& __tuple)
+ _NOEXCEPT_((_And<is_nothrow_assignable<_Tp&, _Up>...>::value)) {
+ std::__memberwise_forward_assign(
+ *this, std::move(__tuple), __tuple_types<_Up...>(), typename __make_tuple_indices<sizeof...(_Tp)>::type());
+ return *this;
+ }
+
+# if _LIBCPP_STD_VER >= 23
+ template <class... _UTypes,
+ enable_if_t< _And<_BoolConstant<sizeof...(_Tp) == sizeof...(_UTypes)>,
+ is_assignable<const _Tp&, const _UTypes&>...>::value>* = nullptr>
+ _LIBCPP_HIDE_FROM_ABI constexpr const tuple& operator=(const tuple<_UTypes...>& __u) const {
+ std::__memberwise_copy_assign(*this, __u, typename __make_tuple_indices<sizeof...(_Tp)>::type());
+ return *this;
+ }
+
+ template <class... _UTypes,
+ enable_if_t< _And<_BoolConstant<sizeof...(_Tp) == sizeof...(_UTypes)>,
+ is_assignable<const _Tp&, _UTypes>...>::value>* = nullptr>
+ _LIBCPP_HIDE_FROM_ABI constexpr const tuple& operator=(tuple<_UTypes...>&& __u) const {
+ std::__memberwise_forward_assign(
+ *this, __u, __tuple_types<_UTypes...>(), typename __make_tuple_indices<sizeof...(_Tp)>::type());
+ return *this;
+ }
+# endif // _LIBCPP_STD_VER >= 23
+
+ template <template <class...> class _Pred,
+ bool _Const,
+ class _Pair,
+ class _DecayedPair = __remove_cvref_t<_Pair>,
+ class _Tuple = tuple>
+ struct _AssignPredicateFromPair : false_type {};
+
+ template <template <class...> class _Pred, bool _Const, class _Pair, class _Up1, class _Up2, class _Tp1, class _Tp2>
+ struct _AssignPredicateFromPair<_Pred, _Const, _Pair, pair<_Up1, _Up2>, tuple<_Tp1, _Tp2> >
+ : _And<_Pred<__maybe_const<_Const, _Tp1>&, __copy_cvref_t<_Pair, _Up1> >,
+ _Pred<__maybe_const<_Const, _Tp2>&, __copy_cvref_t<_Pair, _Up2> > > {};
+
+ template <bool _Const, class _Pair>
+ struct _EnableAssignFromPair : _AssignPredicateFromPair<is_assignable, _Const, _Pair> {};
+
+ template <bool _Const, class _Pair>
+ struct _NothrowAssignFromPair : _AssignPredicateFromPair<is_nothrow_assignable, _Const, _Pair> {};
+
+# if _LIBCPP_STD_VER >= 23
+ template <class _U1, class _U2, enable_if_t< _EnableAssignFromPair<true, const pair<_U1, _U2>&>::value>* = nullptr>
+ _LIBCPP_HIDE_FROM_ABI constexpr const tuple& operator=(const pair<_U1, _U2>& __pair) const
noexcept(_NothrowAssignFromPair<true, const pair<_U1, _U2>&>::value) {
- std::get<0>(*this) = __pair.first;
- std::get<1>(*this) = __pair.second;
- return *this;
- }
-
- template <class _U1, class _U2, enable_if_t<
- _EnableAssignFromPair<true, pair<_U1, _U2>&&>::value>* = nullptr>
- _LIBCPP_HIDE_FROM_ABI constexpr
- const tuple& operator=(pair<_U1, _U2>&& __pair) const
+ std::get<0>(*this) = __pair.first;
+ std::get<1>(*this) = __pair.second;
+ return *this;
+ }
+
+ template <class _U1, class _U2, enable_if_t< _EnableAssignFromPair<true, pair<_U1, _U2>&&>::value>* = nullptr>
+ _LIBCPP_HIDE_FROM_ABI constexpr const tuple& operator=(pair<_U1, _U2>&& __pair) const
noexcept(_NothrowAssignFromPair<true, pair<_U1, _U2>&&>::value) {
- std::get<0>(*this) = std::move(__pair.first);
- std::get<1>(*this) = std::move(__pair.second);
- return *this;
- }
-#endif // _LIBCPP_STD_VER >= 23
-
- template<class _Up1, class _Up2, __enable_if_t<
- _EnableAssignFromPair<false, pair<_Up1, _Up2> const&>::value
- ,int> = 0>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- tuple& operator=(pair<_Up1, _Up2> const& __pair)
- _NOEXCEPT_((_NothrowAssignFromPair<false, pair<_Up1, _Up2> const&>::value))
- {
- std::get<0>(*this) = __pair.first;
- std::get<1>(*this) = __pair.second;
- return *this;
- }
-
- template<class _Up1, class _Up2, __enable_if_t<
- _EnableAssignFromPair<false, pair<_Up1, _Up2>&&>::value
- ,int> = 0>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- tuple& operator=(pair<_Up1, _Up2>&& __pair)
- _NOEXCEPT_((_NothrowAssignFromPair<false, pair<_Up1, _Up2>&&>::value))
- {
- std::get<0>(*this) = std::forward<_Up1>(__pair.first);
- std::get<1>(*this) = std::forward<_Up2>(__pair.second);
- return *this;
- }
-
- // EXTENSION
- template<class _Up, size_t _Np, class = __enable_if_t<
- _And<
- _BoolConstant<_Np == sizeof...(_Tp)>,
- is_assignable<_Tp&, _Up const&>...
- >::value
- > >
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- tuple& operator=(array<_Up, _Np> const& __array)
- _NOEXCEPT_((_And<is_nothrow_assignable<_Tp&, _Up const&>...>::value))
- {
- std::__memberwise_copy_assign(*this, __array,
- typename __make_tuple_indices<sizeof...(_Tp)>::type());
- return *this;
- }
-
- // EXTENSION
- template<class _Up, size_t _Np, class = void, class = __enable_if_t<
- _And<
- _BoolConstant<_Np == sizeof...(_Tp)>,
- is_assignable<_Tp&, _Up>...
- >::value
- > >
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- tuple& operator=(array<_Up, _Np>&& __array)
- _NOEXCEPT_((_And<is_nothrow_assignable<_Tp&, _Up>...>::value))
- {
- std::__memberwise_forward_assign(*this, std::move(__array),
- __tuple_types<_If<true, _Up, _Tp>...>(),
- typename __make_tuple_indices<sizeof...(_Tp)>::type());
- return *this;
- }
-
- // [tuple.swap]
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- void swap(tuple& __t) _NOEXCEPT_(__all<__is_nothrow_swappable<_Tp>::value...>::value)
- {__base_.swap(__t.__base_);}
-
-#if _LIBCPP_STD_VER >= 23
- _LIBCPP_HIDE_FROM_ABI constexpr
- void swap(const tuple& __t) const noexcept(__all<is_nothrow_swappable_v<const _Tp&>...>::value) {
- __base_.swap(__t.__base_);
- }
-#endif // _LIBCPP_STD_VER >= 23
+ std::get<0>(*this) = std::move(__pair.first);
+ std::get<1>(*this) = std::move(__pair.second);
+ return *this;
+ }
+# endif // _LIBCPP_STD_VER >= 23
+
+ template <class _Up1,
+ class _Up2,
+ __enable_if_t< _EnableAssignFromPair<false, pair<_Up1, _Up2> const&>::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 tuple& operator=(pair<_Up1, _Up2> const& __pair)
+ _NOEXCEPT_((_NothrowAssignFromPair<false, pair<_Up1, _Up2> const&>::value)) {
+ std::get<0>(*this) = __pair.first;
+ std::get<1>(*this) = __pair.second;
+ return *this;
+ }
+
+ template <class _Up1, class _Up2, __enable_if_t< _EnableAssignFromPair<false, pair<_Up1, _Up2>&&>::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 tuple& operator=(pair<_Up1, _Up2>&& __pair)
+ _NOEXCEPT_((_NothrowAssignFromPair<false, pair<_Up1, _Up2>&&>::value)) {
+ std::get<0>(*this) = std::forward<_Up1>(__pair.first);
+ std::get<1>(*this) = std::forward<_Up2>(__pair.second);
+ return *this;
+ }
+
+ // EXTENSION
+ template <
+ class _Up,
+ size_t _Np,
+ class = __enable_if_t< _And< _BoolConstant<_Np == sizeof...(_Tp)>, is_assignable<_Tp&, _Up const&>... >::value > >
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 tuple& operator=(array<_Up, _Np> const& __array)
+ _NOEXCEPT_((_And<is_nothrow_assignable<_Tp&, _Up const&>...>::value)) {
+ std::__memberwise_copy_assign(*this, __array, typename __make_tuple_indices<sizeof...(_Tp)>::type());
+ return *this;
+ }
+
+ // EXTENSION
+ template <class _Up,
+ size_t _Np,
+ class = void,
+ class = __enable_if_t< _And< _BoolConstant<_Np == sizeof...(_Tp)>, is_assignable<_Tp&, _Up>... >::value > >
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 tuple& operator=(array<_Up, _Np>&& __array)
+ _NOEXCEPT_((_And<is_nothrow_assignable<_Tp&, _Up>...>::value)) {
+ std::__memberwise_forward_assign(
+ *this,
+ std::move(__array),
+ __tuple_types<_If<true, _Up, _Tp>...>(),
+ typename __make_tuple_indices<sizeof...(_Tp)>::type());
+ return *this;
+ }
+
+ // [tuple.swap]
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void swap(tuple& __t)
+ _NOEXCEPT_(__all<__is_nothrow_swappable<_Tp>::value...>::value) {
+ __base_.swap(__t.__base_);
+ }
+
+# if _LIBCPP_STD_VER >= 23
+ _LIBCPP_HIDE_FROM_ABI constexpr void swap(const tuple& __t) const
+ noexcept(__all<is_nothrow_swappable_v<const _Tp&>...>::value) {
+ __base_.swap(__t.__base_);
+ }
+# endif // _LIBCPP_STD_VER >= 23
};
template <>
-class _LIBCPP_TEMPLATE_VIS tuple<>
-{
+class _LIBCPP_TEMPLATE_VIS tuple<> {
public:
- constexpr tuple() _NOEXCEPT = default;
- template <class _Alloc>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- tuple(allocator_arg_t, const _Alloc&) _NOEXCEPT {}
- template <class _Alloc>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- tuple(allocator_arg_t, const _Alloc&, const tuple&) _NOEXCEPT {}
- template <class _Up>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- tuple(array<_Up, 0>) _NOEXCEPT {}
- template <class _Alloc, class _Up>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- tuple(allocator_arg_t, const _Alloc&, array<_Up, 0>) _NOEXCEPT {}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- void swap(tuple&) _NOEXCEPT {}
-#if _LIBCPP_STD_VER >= 23
- _LIBCPP_HIDE_FROM_ABI constexpr void swap(const tuple&) const noexcept {}
-#endif
+ constexpr tuple() _NOEXCEPT = default;
+ template <class _Alloc>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 tuple(allocator_arg_t, const _Alloc&) _NOEXCEPT {}
+ template <class _Alloc>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 tuple(allocator_arg_t, const _Alloc&, const tuple&) _NOEXCEPT {}
+ template <class _Up>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 tuple(array<_Up, 0>) _NOEXCEPT {}
+ template <class _Alloc, class _Up>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 tuple(allocator_arg_t, const _Alloc&, array<_Up, 0>) _NOEXCEPT {}
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void swap(tuple&) _NOEXCEPT {}
+# if _LIBCPP_STD_VER >= 23
+ _LIBCPP_HIDE_FROM_ABI constexpr void swap(const tuple&) const noexcept {}
+# endif
};
-#if _LIBCPP_STD_VER >= 23
-template <class... _TTypes, class... _UTypes, template<class> class _TQual, template<class> class _UQual>
- requires requires { typename tuple<common_reference_t<_TQual<_TTypes>, _UQual<_UTypes>>...>; }
+# if _LIBCPP_STD_VER >= 23
+template <class... _TTypes, class... _UTypes, template <class> class _TQual, template <class> class _UQual>
+ requires requires { typename tuple<common_reference_t<_TQual<_TTypes>, _UQual<_UTypes>>...>; }
struct basic_common_reference<tuple<_TTypes...>, tuple<_UTypes...>, _TQual, _UQual> {
- using type = tuple<common_reference_t<_TQual<_TTypes>, _UQual<_UTypes>>...>;
+ using type = tuple<common_reference_t<_TQual<_TTypes>, _UQual<_UTypes>>...>;
};
template <class... _TTypes, class... _UTypes>
- requires requires { typename tuple<common_type_t<_TTypes, _UTypes>...>; }
+ requires requires { typename tuple<common_type_t<_TTypes, _UTypes>...>; }
struct common_type<tuple<_TTypes...>, tuple<_UTypes...>> {
- using type = tuple<common_type_t<_TTypes, _UTypes>...>;
+ using type = tuple<common_type_t<_TTypes, _UTypes>...>;
};
-#endif // _LIBCPP_STD_VER >= 23
+# endif // _LIBCPP_STD_VER >= 23
-#if _LIBCPP_STD_VER >= 17
-template <class ..._Tp>
+# if _LIBCPP_STD_VER >= 17
+template <class... _Tp>
tuple(_Tp...) -> tuple<_Tp...>;
template <class _Tp1, class _Tp2>
tuple(pair<_Tp1, _Tp2>) -> tuple<_Tp1, _Tp2>;
-template <class _Alloc, class ..._Tp>
+template <class _Alloc, class... _Tp>
tuple(allocator_arg_t, _Alloc, _Tp...) -> tuple<_Tp...>;
template <class _Alloc, class _Tp1, class _Tp2>
tuple(allocator_arg_t, _Alloc, pair<_Tp1, _Tp2>) -> tuple<_Tp1, _Tp2>;
-template <class _Alloc, class ..._Tp>
+template <class _Alloc, class... _Tp>
tuple(allocator_arg_t, _Alloc, tuple<_Tp...>) -> tuple<_Tp...>;
-#endif
+# endif
-template <class ..._Tp, __enable_if_t<__all<__is_swappable<_Tp>::value...>::value, int> = 0>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-void
-swap(tuple<_Tp...>& __t, tuple<_Tp...>& __u)
- _NOEXCEPT_(__all<__is_nothrow_swappable<_Tp>::value...>::value)
- {__t.swap(__u);}
+template <class... _Tp, __enable_if_t<__all<__is_swappable<_Tp>::value...>::value, int> = 0>
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void swap(tuple<_Tp...>& __t, tuple<_Tp...>& __u)
+ _NOEXCEPT_(__all<__is_nothrow_swappable<_Tp>::value...>::value) {
+ __t.swap(__u);
+}
-#if _LIBCPP_STD_VER >= 23
+# if _LIBCPP_STD_VER >= 23
template <class... _Tp>
-_LIBCPP_HIDE_FROM_ABI constexpr
-enable_if_t<__all<is_swappable_v<const _Tp>...>::value, void>
-swap(const tuple<_Tp...>& __lhs, const tuple<_Tp...>& __rhs)
- noexcept(__all<is_nothrow_swappable_v<const _Tp>...>::value) {
- __lhs.swap(__rhs);
+_LIBCPP_HIDE_FROM_ABI constexpr enable_if_t<__all<is_swappable_v<const _Tp>...>::value, void>
+swap(const tuple<_Tp...>& __lhs,
+ const tuple<_Tp...>& __rhs) noexcept(__all<is_nothrow_swappable_v<const _Tp>...>::value) {
+ __lhs.swap(__rhs);
}
-#endif
+# endif
// get
-template <size_t _Ip, class ..._Tp>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
-typename tuple_element<_Ip, tuple<_Tp...> >::type&
-get(tuple<_Tp...>& __t) _NOEXCEPT
-{
- typedef _LIBCPP_NODEBUG typename tuple_element<_Ip, tuple<_Tp...> >::type type;
- return static_cast<__tuple_leaf<_Ip, type>&>(__t.__base_).get();
+template <size_t _Ip, class... _Tp>
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 typename tuple_element<_Ip, tuple<_Tp...> >::type&
+get(tuple<_Tp...>& __t) _NOEXCEPT {
+ typedef _LIBCPP_NODEBUG typename tuple_element<_Ip, tuple<_Tp...> >::type type;
+ return static_cast<__tuple_leaf<_Ip, type>&>(__t.__base_).get();
}
-template <size_t _Ip, class ..._Tp>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
-const typename tuple_element<_Ip, tuple<_Tp...> >::type&
-get(const tuple<_Tp...>& __t) _NOEXCEPT
-{
- typedef _LIBCPP_NODEBUG typename tuple_element<_Ip, tuple<_Tp...> >::type type;
- return static_cast<const __tuple_leaf<_Ip, type>&>(__t.__base_).get();
+template <size_t _Ip, class... _Tp>
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 const typename tuple_element<_Ip, tuple<_Tp...> >::type&
+get(const tuple<_Tp...>& __t) _NOEXCEPT {
+ typedef _LIBCPP_NODEBUG typename tuple_element<_Ip, tuple<_Tp...> >::type type;
+ return static_cast<const __tuple_leaf<_Ip, type>&>(__t.__base_).get();
}
-template <size_t _Ip, class ..._Tp>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
-typename tuple_element<_Ip, tuple<_Tp...> >::type&&
-get(tuple<_Tp...>&& __t) _NOEXCEPT
-{
- typedef _LIBCPP_NODEBUG typename tuple_element<_Ip, tuple<_Tp...> >::type type;
- return static_cast<type&&>(
- static_cast<__tuple_leaf<_Ip, type>&&>(__t.__base_).get());
+template <size_t _Ip, class... _Tp>
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 typename tuple_element<_Ip, tuple<_Tp...> >::type&&
+get(tuple<_Tp...>&& __t) _NOEXCEPT {
+ typedef _LIBCPP_NODEBUG typename tuple_element<_Ip, tuple<_Tp...> >::type type;
+ return static_cast<type&&>(static_cast<__tuple_leaf<_Ip, type>&&>(__t.__base_).get());
}
-template <size_t _Ip, class ..._Tp>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
-const typename tuple_element<_Ip, tuple<_Tp...> >::type&&
-get(const tuple<_Tp...>&& __t) _NOEXCEPT
-{
- typedef _LIBCPP_NODEBUG typename tuple_element<_Ip, tuple<_Tp...> >::type type;
- return static_cast<const type&&>(
- static_cast<const __tuple_leaf<_Ip, type>&&>(__t.__base_).get());
+template <size_t _Ip, class... _Tp>
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 const typename tuple_element<_Ip, tuple<_Tp...> >::type&&
+get(const tuple<_Tp...>&& __t) _NOEXCEPT {
+ typedef _LIBCPP_NODEBUG typename tuple_element<_Ip, tuple<_Tp...> >::type type;
+ return static_cast<const type&&>(static_cast<const __tuple_leaf<_Ip, type>&&>(__t.__base_).get());
}
-#if _LIBCPP_STD_VER >= 14
+# if _LIBCPP_STD_VER >= 14
namespace __find_detail {
static constexpr size_t __not_found = static_cast<size_t>(-1);
static constexpr size_t __ambiguous = __not_found - 1;
-inline _LIBCPP_HIDE_FROM_ABI
-constexpr size_t __find_idx_return(size_t __curr_i, size_t __res, bool __matches) {
- return !__matches ? __res :
- (__res == __not_found ? __curr_i : __ambiguous);
+inline _LIBCPP_HIDE_FROM_ABI constexpr size_t __find_idx_return(size_t __curr_i, size_t __res, bool __matches) {
+ return !__matches ? __res : (__res == __not_found ? __curr_i : __ambiguous);
}
template <size_t _Nx>
-inline _LIBCPP_HIDE_FROM_ABI
-constexpr size_t __find_idx(size_t __i, const bool (&__matches)[_Nx]) {
- return __i == _Nx ? __not_found :
- __find_detail::__find_idx_return(__i, __find_detail::__find_idx(__i + 1, __matches), __matches[__i]);
+inline _LIBCPP_HIDE_FROM_ABI constexpr size_t __find_idx(size_t __i, const bool (&__matches)[_Nx]) {
+ return __i == _Nx
+ ? __not_found
+ : __find_detail::__find_idx_return(__i, __find_detail::__find_idx(__i + 1, __matches), __matches[__i]);
}
-template <class _T1, class ..._Args>
+template <class _T1, class... _Args>
struct __find_exactly_one_checked {
- static constexpr bool __matches[sizeof...(_Args)] = {is_same<_T1, _Args>::value...};
- static constexpr size_t value = __find_detail::__find_idx(0, __matches);
- static_assert(value != __not_found, "type not found in type list" );
- static_assert(value != __ambiguous, "type occurs more than once in type list");
+ static constexpr bool __matches[sizeof...(_Args)] = {is_same<_T1, _Args>::value...};
+ static constexpr size_t value = __find_detail::__find_idx(0, __matches);
+ static_assert(value != __not_found, "type not found in type list");
+ static_assert(value != __ambiguous, "type occurs more than once in type list");
};
template <class _T1>
struct __find_exactly_one_checked<_T1> {
- static_assert(!is_same<_T1, _T1>::value, "type not in empty type list");
+ static_assert(!is_same<_T1, _T1>::value, "type not in empty type list");
};
} // namespace __find_detail
template <typename _T1, typename... _Args>
-struct __find_exactly_one_t
- : public __find_detail::__find_exactly_one_checked<_T1, _Args...> {
-};
+struct __find_exactly_one_t : public __find_detail::__find_exactly_one_checked<_T1, _Args...> {};
template <class _T1, class... _Args>
-inline _LIBCPP_HIDE_FROM_ABI
-constexpr _T1& get(tuple<_Args...>& __tup) noexcept
-{
- return std::get<__find_exactly_one_t<_T1, _Args...>::value>(__tup);
+inline _LIBCPP_HIDE_FROM_ABI constexpr _T1& get(tuple<_Args...>& __tup) noexcept {
+ return std::get<__find_exactly_one_t<_T1, _Args...>::value>(__tup);
}
template <class _T1, class... _Args>
-inline _LIBCPP_HIDE_FROM_ABI
-constexpr _T1 const& get(tuple<_Args...> const& __tup) noexcept
-{
- return std::get<__find_exactly_one_t<_T1, _Args...>::value>(__tup);
+inline _LIBCPP_HIDE_FROM_ABI constexpr _T1 const& get(tuple<_Args...> const& __tup) noexcept {
+ return std::get<__find_exactly_one_t<_T1, _Args...>::value>(__tup);
}
template <class _T1, class... _Args>
-inline _LIBCPP_HIDE_FROM_ABI
-constexpr _T1&& get(tuple<_Args...>&& __tup) noexcept
-{
- return std::get<__find_exactly_one_t<_T1, _Args...>::value>(std::move(__tup));
+inline _LIBCPP_HIDE_FROM_ABI constexpr _T1&& get(tuple<_Args...>&& __tup) noexcept {
+ return std::get<__find_exactly_one_t<_T1, _Args...>::value>(std::move(__tup));
}
template <class _T1, class... _Args>
-inline _LIBCPP_HIDE_FROM_ABI
-constexpr _T1 const&& get(tuple<_Args...> const&& __tup) noexcept
-{
- return std::get<__find_exactly_one_t<_T1, _Args...>::value>(std::move(__tup));
+inline _LIBCPP_HIDE_FROM_ABI constexpr _T1 const&& get(tuple<_Args...> const&& __tup) noexcept {
+ return std::get<__find_exactly_one_t<_T1, _Args...>::value>(std::move(__tup));
}
-#endif
+# endif
// tie
-template <class ..._Tp>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
-tuple<_Tp&...>
-tie(_Tp&... __t) _NOEXCEPT
-{
- return tuple<_Tp&...>(__t...);
+template <class... _Tp>
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 tuple<_Tp&...> tie(_Tp&... __t) _NOEXCEPT {
+ return tuple<_Tp&...>(__t...);
}
template <class _Up>
-struct __ignore_t
-{
- template <class _Tp>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
- const __ignore_t& operator=(_Tp&&) const {return *this;}
+struct __ignore_t {
+ template <class _Tp>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 const __ignore_t& operator=(_Tp&&) const {
+ return *this;
+ }
};
# if _LIBCPP_STD_VER >= 17
inline constexpr __ignore_t<unsigned char> ignore = __ignore_t<unsigned char>();
# else
namespace {
- constexpr __ignore_t<unsigned char> ignore = __ignore_t<unsigned char>();
+constexpr __ignore_t<unsigned char> ignore = __ignore_t<unsigned char>();
} // namespace
# endif
template <class... _Tp>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
-tuple<typename __unwrap_ref_decay<_Tp>::type...>
-make_tuple(_Tp&&... __t)
-{
- return tuple<typename __unwrap_ref_decay<_Tp>::type...>(std::forward<_Tp>(__t)...);
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 tuple<typename __unwrap_ref_decay<_Tp>::type...>
+make_tuple(_Tp&&... __t) {
+ return tuple<typename __unwrap_ref_decay<_Tp>::type...>(std::forward<_Tp>(__t)...);
}
template <class... _Tp>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
-tuple<_Tp&&...>
-forward_as_tuple(_Tp&&... __t) _NOEXCEPT
-{
- return tuple<_Tp&&...>(std::forward<_Tp>(__t)...);
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 tuple<_Tp&&...> forward_as_tuple(_Tp&&... __t) _NOEXCEPT {
+ return tuple<_Tp&&...>(std::forward<_Tp>(__t)...);
}
template <size_t _Ip>
-struct __tuple_equal
-{
- template <class _Tp, class _Up>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
- bool operator()(const _Tp& __x, const _Up& __y)
- {
- return __tuple_equal<_Ip - 1>()(__x, __y) && std::get<_Ip-1>(__x) == std::get<_Ip-1>(__y);
- }
+struct __tuple_equal {
+ template <class _Tp, class _Up>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 bool operator()(const _Tp& __x, const _Up& __y) {
+ return __tuple_equal<_Ip - 1>()(__x, __y) && std::get<_Ip - 1>(__x) == std::get<_Ip - 1>(__y);
+ }
};
template <>
-struct __tuple_equal<0>
-{
- template <class _Tp, class _Up>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
- bool operator()(const _Tp&, const _Up&)
- {
- return true;
- }
+struct __tuple_equal<0> {
+ template <class _Tp, class _Up>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 bool operator()(const _Tp&, const _Up&) {
+ return true;
+ }
};
-template <class ..._Tp, class ..._Up>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
-bool
-operator==(const tuple<_Tp...>& __x, const tuple<_Up...>& __y)
-{
- static_assert (sizeof...(_Tp) == sizeof...(_Up), "Can't compare tuples of different sizes");
- return __tuple_equal<sizeof...(_Tp)>()(__x, __y);
+template <class... _Tp, class... _Up>
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 bool
+operator==(const tuple<_Tp...>& __x, const tuple<_Up...>& __y) {
+ static_assert(sizeof...(_Tp) == sizeof...(_Up), "Can't compare tuples of different sizes");
+ return __tuple_equal<sizeof...(_Tp)>()(__x, __y);
}
-#if _LIBCPP_STD_VER >= 20
+# if _LIBCPP_STD_VER >= 20
// operator<=>
-template <class ..._Tp, class ..._Up, size_t ..._Is>
-_LIBCPP_HIDE_FROM_ABI constexpr
-auto
+template <class... _Tp, class... _Up, size_t... _Is>
+_LIBCPP_HIDE_FROM_ABI constexpr auto
__tuple_compare_three_way(const tuple<_Tp...>& __x, const tuple<_Up...>& __y, index_sequence<_Is...>) {
- common_comparison_category_t<__synth_three_way_result<_Tp, _Up>...> __result = strong_ordering::equal;
- static_cast<void>(((__result = std::__synth_three_way(std::get<_Is>(__x), std::get<_Is>(__y)), __result != 0) || ...));
- return __result;
+ common_comparison_category_t<__synth_three_way_result<_Tp, _Up>...> __result = strong_ordering::equal;
+ static_cast<void>(
+ ((__result = std::__synth_three_way(std::get<_Is>(__x), std::get<_Is>(__y)), __result != 0) || ...));
+ return __result;
}
-template <class ..._Tp, class ..._Up>
-requires (sizeof...(_Tp) == sizeof...(_Up))
-_LIBCPP_HIDE_FROM_ABI constexpr
-common_comparison_category_t<__synth_three_way_result<_Tp, _Up>...>
-operator<=>(const tuple<_Tp...>& __x, const tuple<_Up...>& __y)
-{
- return std::__tuple_compare_three_way(__x, __y, index_sequence_for<_Tp...>{});
+template <class... _Tp, class... _Up>
+ requires(sizeof...(_Tp) == sizeof...(_Up))
+_LIBCPP_HIDE_FROM_ABI constexpr common_comparison_category_t<__synth_three_way_result<_Tp, _Up>...>
+operator<=>(const tuple<_Tp...>& __x, const tuple<_Up...>& __y) {
+ return std::__tuple_compare_three_way(__x, __y, index_sequence_for<_Tp...>{});
}
-#else // _LIBCPP_STD_VER >= 20
+# else // _LIBCPP_STD_VER >= 20
-template <class ..._Tp, class ..._Up>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
-bool
-operator!=(const tuple<_Tp...>& __x, const tuple<_Up...>& __y)
-{
- return !(__x == __y);
+template <class... _Tp, class... _Up>
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 bool
+operator!=(const tuple<_Tp...>& __x, const tuple<_Up...>& __y) {
+ return !(__x == __y);
}
template <size_t _Ip>
-struct __tuple_less
-{
- template <class _Tp, class _Up>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
- bool operator()(const _Tp& __x, const _Up& __y)
- {
- const size_t __idx = tuple_size<_Tp>::value - _Ip;
- if (std::get<__idx>(__x) < std::get<__idx>(__y))
- return true;
- if (std::get<__idx>(__y) < std::get<__idx>(__x))
- return false;
- return __tuple_less<_Ip-1>()(__x, __y);
- }
+struct __tuple_less {
+ template <class _Tp, class _Up>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 bool operator()(const _Tp& __x, const _Up& __y) {
+ const size_t __idx = tuple_size<_Tp>::value - _Ip;
+ if (std::get<__idx>(__x) < std::get<__idx>(__y))
+ return true;
+ if (std::get<__idx>(__y) < std::get<__idx>(__x))
+ return false;
+ return __tuple_less<_Ip - 1>()(__x, __y);
+ }
};
template <>
-struct __tuple_less<0>
-{
- template <class _Tp, class _Up>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
- bool operator()(const _Tp&, const _Up&)
- {
- return false;
- }
+struct __tuple_less<0> {
+ template <class _Tp, class _Up>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 bool operator()(const _Tp&, const _Up&) {
+ return false;
+ }
};
-template <class ..._Tp, class ..._Up>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
-bool
-operator<(const tuple<_Tp...>& __x, const tuple<_Up...>& __y)
-{
- static_assert (sizeof...(_Tp) == sizeof...(_Up), "Can't compare tuples of different sizes");
- return __tuple_less<sizeof...(_Tp)>()(__x, __y);
+template <class... _Tp, class... _Up>
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 bool
+operator<(const tuple<_Tp...>& __x, const tuple<_Up...>& __y) {
+ static_assert(sizeof...(_Tp) == sizeof...(_Up), "Can't compare tuples of different sizes");
+ return __tuple_less<sizeof...(_Tp)>()(__x, __y);
}
-template <class ..._Tp, class ..._Up>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
-bool
-operator>(const tuple<_Tp...>& __x, const tuple<_Up...>& __y)
-{
- return __y < __x;
+template <class... _Tp, class... _Up>
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 bool
+operator>(const tuple<_Tp...>& __x, const tuple<_Up...>& __y) {
+ return __y < __x;
}
-template <class ..._Tp, class ..._Up>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
-bool
-operator>=(const tuple<_Tp...>& __x, const tuple<_Up...>& __y)
-{
- return !(__x < __y);
+template <class... _Tp, class... _Up>
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 bool
+operator>=(const tuple<_Tp...>& __x, const tuple<_Up...>& __y) {
+ return !(__x < __y);
}
-template <class ..._Tp, class ..._Up>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
-bool
-operator<=(const tuple<_Tp...>& __x, const tuple<_Up...>& __y)
-{
- return !(__y < __x);
+template <class... _Tp, class... _Up>
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 bool
+operator<=(const tuple<_Tp...>& __x, const tuple<_Up...>& __y) {
+ return !(__y < __x);
}
-#endif // _LIBCPP_STD_VER >= 20
+# endif // _LIBCPP_STD_VER >= 20
// tuple_cat
-template <class _Tp, class _Up> struct __tuple_cat_type;
+template <class _Tp, class _Up>
+struct __tuple_cat_type;
-template <class ..._Ttypes, class ..._Utypes>
-struct __tuple_cat_type<tuple<_Ttypes...>, __tuple_types<_Utypes...> >
-{
- typedef _LIBCPP_NODEBUG tuple<_Ttypes..., _Utypes...> type;
+template <class... _Ttypes, class... _Utypes>
+struct __tuple_cat_type<tuple<_Ttypes...>, __tuple_types<_Utypes...> > {
+ typedef _LIBCPP_NODEBUG tuple<_Ttypes..., _Utypes...> type;
};
-template <class _ResultTuple, bool _Is_Tuple0TupleLike, class ..._Tuples>
-struct __tuple_cat_return_1
-{
-};
+template <class _ResultTuple, bool _Is_Tuple0TupleLike, class... _Tuples>
+struct __tuple_cat_return_1 {};
-template <class ..._Types, class _Tuple0>
-struct __tuple_cat_return_1<tuple<_Types...>, true, _Tuple0>
-{
- using type _LIBCPP_NODEBUG = typename __tuple_cat_type<
- tuple<_Types...>,
- typename __make_tuple_types<__remove_cvref_t<_Tuple0> >::type
- >::type;
+template <class... _Types, class _Tuple0>
+struct __tuple_cat_return_1<tuple<_Types...>, true, _Tuple0> {
+ using type _LIBCPP_NODEBUG =
+ typename __tuple_cat_type< tuple<_Types...>,
+ typename __make_tuple_types<__remove_cvref_t<_Tuple0> >::type >::type;
};
-template <class ..._Types, class _Tuple0, class _Tuple1, class ..._Tuples>
+template <class... _Types, class _Tuple0, class _Tuple1, class... _Tuples>
struct __tuple_cat_return_1<tuple<_Types...>, true, _Tuple0, _Tuple1, _Tuples...>
: public __tuple_cat_return_1<
- typename __tuple_cat_type<
- tuple<_Types...>,
- typename __make_tuple_types<__remove_cvref_t<_Tuple0> >::type
- >::type,
- __tuple_like_ext<__libcpp_remove_reference_t<_Tuple1> >::value,
- _Tuple1, _Tuples...>
-{
-};
+ typename __tuple_cat_type< tuple<_Types...>,
+ typename __make_tuple_types<__remove_cvref_t<_Tuple0> >::type >::type,
+ __tuple_like_ext<__libcpp_remove_reference_t<_Tuple1> >::value,
+ _Tuple1,
+ _Tuples...> {};
-template <class ..._Tuples> struct __tuple_cat_return;
+template <class... _Tuples>
+struct __tuple_cat_return;
-template <class _Tuple0, class ..._Tuples>
+template <class _Tuple0, class... _Tuples>
struct __tuple_cat_return<_Tuple0, _Tuples...>
: public __tuple_cat_return_1<tuple<>,
- __tuple_like_ext<__libcpp_remove_reference_t<_Tuple0> >::value, _Tuple0,
- _Tuples...>
-{
-};
+ __tuple_like_ext<__libcpp_remove_reference_t<_Tuple0> >::value,
+ _Tuple0,
+ _Tuples...> {};
template <>
-struct __tuple_cat_return<>
-{
- typedef _LIBCPP_NODEBUG tuple<> type;
+struct __tuple_cat_return<> {
+ typedef _LIBCPP_NODEBUG tuple<> type;
};
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
-tuple<>
-tuple_cat()
-{
- return tuple<>();
-}
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 tuple<> tuple_cat() { return tuple<>(); }
-template <class _Rp, class _Indices, class _Tuple0, class ..._Tuples>
+template <class _Rp, class _Indices, class _Tuple0, class... _Tuples>
struct __tuple_cat_return_ref_imp;
-template <class ..._Types, size_t ..._I0, class _Tuple0>
-struct __tuple_cat_return_ref_imp<tuple<_Types...>, __tuple_indices<_I0...>, _Tuple0>
-{
- typedef _LIBCPP_NODEBUG __libcpp_remove_reference_t<_Tuple0> _T0;
- typedef tuple<_Types..., __apply_cv_t<_Tuple0, typename tuple_element<_I0, _T0>::type>&&...> type;
+template <class... _Types, size_t... _I0, class _Tuple0>
+struct __tuple_cat_return_ref_imp<tuple<_Types...>, __tuple_indices<_I0...>, _Tuple0> {
+ typedef _LIBCPP_NODEBUG __libcpp_remove_reference_t<_Tuple0> _T0;
+ typedef tuple<_Types..., __apply_cv_t<_Tuple0, typename tuple_element<_I0, _T0>::type>&&...> type;
};
-template <class ..._Types, size_t ..._I0, class _Tuple0, class _Tuple1, class ..._Tuples>
-struct __tuple_cat_return_ref_imp<tuple<_Types...>, __tuple_indices<_I0...>,
- _Tuple0, _Tuple1, _Tuples...>
+template <class... _Types, size_t... _I0, class _Tuple0, class _Tuple1, class... _Tuples>
+struct __tuple_cat_return_ref_imp<tuple<_Types...>, __tuple_indices<_I0...>, _Tuple0, _Tuple1, _Tuples...>
: public __tuple_cat_return_ref_imp<
- tuple<_Types..., __apply_cv_t<_Tuple0,
- typename tuple_element<_I0, __libcpp_remove_reference_t<_Tuple0>>::type>&&...>,
- typename __make_tuple_indices<tuple_size<__libcpp_remove_reference_t<_Tuple1> >::value>::type,
- _Tuple1, _Tuples...>
-{
-};
+ tuple<_Types...,
+ __apply_cv_t<_Tuple0, typename tuple_element<_I0, __libcpp_remove_reference_t<_Tuple0>>::type>&&...>,
+ typename __make_tuple_indices<tuple_size<__libcpp_remove_reference_t<_Tuple1> >::value>::type,
+ _Tuple1,
+ _Tuples...> {};
-template <class _Tuple0, class ..._Tuples>
+template <class _Tuple0, class... _Tuples>
struct __tuple_cat_return_ref
- : public __tuple_cat_return_ref_imp<tuple<>,
- typename __make_tuple_indices<
- tuple_size<__libcpp_remove_reference_t<_Tuple0> >::value
- >::type, _Tuple0, _Tuples...>
-{
-};
+ : public __tuple_cat_return_ref_imp<
+ tuple<>,
+ typename __make_tuple_indices< tuple_size<__libcpp_remove_reference_t<_Tuple0> >::value >::type,
+ _Tuple0,
+ _Tuples...> {};
template <class _Types, class _I0, class _J0>
struct __tuple_cat;
-template <class ..._Types, size_t ..._I0, size_t ..._J0>
-struct __tuple_cat<tuple<_Types...>, __tuple_indices<_I0...>, __tuple_indices<_J0...> >
-{
- template <class _Tuple0>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
- typename __tuple_cat_return_ref<tuple<_Types...>&&, _Tuple0&&>::type
- operator()(tuple<_Types...> __t, _Tuple0&& __t0)
- {
- (void)__t; // avoid unused parameter warning on GCC when _I0 is empty
- return std::forward_as_tuple(
- std::forward<_Types>(std::get<_I0>(__t))...,
- std::get<_J0>(std::forward<_Tuple0>(__t0))...);
- }
-
- template <class _Tuple0, class _Tuple1, class ..._Tuples>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
- typename __tuple_cat_return_ref<tuple<_Types...>&&, _Tuple0&&, _Tuple1&&, _Tuples&&...>::type
- operator()(tuple<_Types...> __t, _Tuple0&& __t0, _Tuple1&& __t1, _Tuples&& ...__tpls)
- {
- (void)__t; // avoid unused parameter warning on GCC when _I0 is empty
- typedef _LIBCPP_NODEBUG __libcpp_remove_reference_t<_Tuple0> _T0;
- typedef _LIBCPP_NODEBUG __libcpp_remove_reference_t<_Tuple1> _T1;
- return __tuple_cat<tuple<_Types..., __apply_cv_t<_Tuple0, typename tuple_element<_J0, _T0>::type>&&...>,
- typename __make_tuple_indices<sizeof...(_Types) + tuple_size<_T0>::value>::type,
- typename __make_tuple_indices<tuple_size<_T1>::value>::type>()(
- std::forward_as_tuple(
- std::forward<_Types>(std::get<_I0>(__t))...,
- std::get<_J0>(std::forward<_Tuple0>(__t0))...),
- std::forward<_Tuple1>(__t1), std::forward<_Tuples>(__tpls)...);
- }
+template <class... _Types, size_t... _I0, size_t... _J0>
+struct __tuple_cat<tuple<_Types...>, __tuple_indices<_I0...>, __tuple_indices<_J0...> > {
+ template <class _Tuple0>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
+ typename __tuple_cat_return_ref<tuple<_Types...>&&, _Tuple0&&>::type
+ operator()(tuple<_Types...> __t, _Tuple0&& __t0) {
+ (void)__t; // avoid unused parameter warning on GCC when _I0 is empty
+ return std::forward_as_tuple(
+ std::forward<_Types>(std::get<_I0>(__t))..., std::get<_J0>(std::forward<_Tuple0>(__t0))...);
+ }
+
+ template <class _Tuple0, class _Tuple1, class... _Tuples>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
+ typename __tuple_cat_return_ref<tuple<_Types...>&&, _Tuple0&&, _Tuple1&&, _Tuples&&...>::type
+ operator()(tuple<_Types...> __t, _Tuple0&& __t0, _Tuple1&& __t1, _Tuples&&... __tpls) {
+ (void)__t; // avoid unused parameter warning on GCC when _I0 is empty
+ typedef _LIBCPP_NODEBUG __libcpp_remove_reference_t<_Tuple0> _T0;
+ typedef _LIBCPP_NODEBUG __libcpp_remove_reference_t<_Tuple1> _T1;
+ return __tuple_cat<tuple<_Types..., __apply_cv_t<_Tuple0, typename tuple_element<_J0, _T0>::type>&&...>,
+ typename __make_tuple_indices<sizeof...(_Types) + tuple_size<_T0>::value>::type,
+ typename __make_tuple_indices<tuple_size<_T1>::value>::type>()(
+ std::forward_as_tuple(
+ std::forward<_Types>(std::get<_I0>(__t))..., std::get<_J0>(std::forward<_Tuple0>(__t0))...),
+ std::forward<_Tuple1>(__t1),
+ std::forward<_Tuples>(__tpls)...);
+ }
};
template <class _Tuple0, class... _Tuples>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
-typename __tuple_cat_return<_Tuple0, _Tuples...>::type
-tuple_cat(_Tuple0&& __t0, _Tuples&&... __tpls)
-{
- typedef _LIBCPP_NODEBUG __libcpp_remove_reference_t<_Tuple0> _T0;
- return __tuple_cat<tuple<>, __tuple_indices<>,
- typename __make_tuple_indices<tuple_size<_T0>::value>::type>()
- (tuple<>(), std::forward<_Tuple0>(__t0),
- std::forward<_Tuples>(__tpls)...);
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 typename __tuple_cat_return<_Tuple0, _Tuples...>::type
+tuple_cat(_Tuple0&& __t0, _Tuples&&... __tpls) {
+ typedef _LIBCPP_NODEBUG __libcpp_remove_reference_t<_Tuple0> _T0;
+ return __tuple_cat<tuple<>, __tuple_indices<>, typename __make_tuple_indices<tuple_size<_T0>::value>::type>()(
+ tuple<>(), std::forward<_Tuple0>(__t0), std::forward<_Tuples>(__tpls)...);
}
-template <class ..._Tp, class _Alloc>
-struct _LIBCPP_TEMPLATE_VIS uses_allocator<tuple<_Tp...>, _Alloc>
- : true_type {};
+template <class... _Tp, class _Alloc>
+struct _LIBCPP_TEMPLATE_VIS uses_allocator<tuple<_Tp...>, _Alloc> : true_type {};
template <class _T1, class _T2>
-template <class... _Args1, class... _Args2, size_t ..._I1, size_t ..._I2>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-pair<_T1, _T2>::pair(piecewise_construct_t,
- tuple<_Args1...>& __first_args, tuple<_Args2...>& __second_args,
- __tuple_indices<_I1...>, __tuple_indices<_I2...>)
- : first(std::forward<_Args1>(std::get<_I1>( __first_args))...),
- second(std::forward<_Args2>(std::get<_I2>(__second_args))...)
-{
-}
+template <class... _Args1, class... _Args2, size_t... _I1, size_t... _I2>
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 pair<_T1, _T2>::pair(
+ piecewise_construct_t,
+ tuple<_Args1...>& __first_args,
+ tuple<_Args2...>& __second_args,
+ __tuple_indices<_I1...>,
+ __tuple_indices<_I2...>)
+ : first(std::forward<_Args1>(std::get<_I1>(__first_args))...),
+ second(std::forward<_Args2>(std::get<_I2>(__second_args))...) {}
-#if _LIBCPP_STD_VER >= 17
+# if _LIBCPP_STD_VER >= 17
template <class _Tp>
inline constexpr size_t tuple_size_v = tuple_size<_Tp>::value;
-#define _LIBCPP_NOEXCEPT_RETURN(...) noexcept(noexcept(__VA_ARGS__)) { return __VA_ARGS__; }
-
-template <class _Fn, class _Tuple, size_t ..._Id>
-inline _LIBCPP_HIDE_FROM_ABI
-constexpr decltype(auto) __apply_tuple_impl(_Fn && __f, _Tuple && __t,
- __tuple_indices<_Id...>)
-_LIBCPP_NOEXCEPT_RETURN(
- std::__invoke(
- std::forward<_Fn>(__f),
- std::get<_Id>(std::forward<_Tuple>(__t))...)
-)
-
-template <class _Fn, class _Tuple>
-inline _LIBCPP_HIDE_FROM_ABI
-constexpr decltype(auto) apply(_Fn && __f, _Tuple && __t)
-_LIBCPP_NOEXCEPT_RETURN(
- std::__apply_tuple_impl(
- std::forward<_Fn>(__f), std::forward<_Tuple>(__t),
- typename __make_tuple_indices<tuple_size_v<remove_reference_t<_Tuple>>>::type{})
-)
-
-template <class _Tp, class _Tuple, size_t... _Idx>
-inline _LIBCPP_HIDE_FROM_ABI
-constexpr _Tp __make_from_tuple_impl(_Tuple&& __t, __tuple_indices<_Idx...>)
-_LIBCPP_NOEXCEPT_RETURN(
- _Tp(std::get<_Idx>(std::forward<_Tuple>(__t))...)
-)
-
-template <class _Tp, class _Tuple>
-inline _LIBCPP_HIDE_FROM_ABI
-constexpr _Tp make_from_tuple(_Tuple&& __t)
-_LIBCPP_NOEXCEPT_RETURN(
- std::__make_from_tuple_impl<_Tp>(std::forward<_Tuple>(__t),
- typename __make_tuple_indices<tuple_size_v<remove_reference_t<_Tuple>>>::type{})
-)
-
-#undef _LIBCPP_NOEXCEPT_RETURN
-
-#endif // _LIBCPP_STD_VER >= 17
+# define _LIBCPP_NOEXCEPT_RETURN(...) \
+ noexcept(noexcept(__VA_ARGS__)) { return __VA_ARGS__; }
+
+template <class _Fn, class _Tuple, size_t... _Id>
+inline _LIBCPP_HIDE_FROM_ABI constexpr decltype(auto)
+__apply_tuple_impl(_Fn&& __f, _Tuple&& __t, __tuple_indices<_Id...>)
+ _LIBCPP_NOEXCEPT_RETURN(std::__invoke(std::forward<_Fn>(__f), std::get<_Id>(std::forward<_Tuple>(__t))...))
+
+ template <class _Fn, class _Tuple>
+ inline _LIBCPP_HIDE_FROM_ABI constexpr decltype(auto) apply(_Fn&& __f, _Tuple&& __t) _LIBCPP_NOEXCEPT_RETURN(
+ std::__apply_tuple_impl(std::forward<_Fn>(__f),
+ std::forward<_Tuple>(__t),
+ typename __make_tuple_indices<tuple_size_v<remove_reference_t<_Tuple>>>::type{}))
+
+ template <class _Tp, class _Tuple, size_t... _Idx>
+ inline _LIBCPP_HIDE_FROM_ABI constexpr _Tp
+ __make_from_tuple_impl(_Tuple&& __t, __tuple_indices<_Idx...>)
+ _LIBCPP_NOEXCEPT_RETURN(_Tp(std::get<_Idx>(std::forward<_Tuple>(__t))...))
+
+ template <class _Tp, class _Tuple>
+ inline _LIBCPP_HIDE_FROM_ABI constexpr _Tp
+ make_from_tuple(_Tuple&& __t) _LIBCPP_NOEXCEPT_RETURN(std::__make_from_tuple_impl<_Tp>(
+ std::forward<_Tuple>(__t), typename __make_tuple_indices<tuple_size_v<remove_reference_t<_Tuple>>>::type{}))
+
+# undef _LIBCPP_NOEXCEPT_RETURN
+
+# endif // _LIBCPP_STD_VER >= 17
#endif // !defined(_LIBCPP_CXX03_LANG)
-_LIBCPP_END_NAMESPACE_STD
+ _LIBCPP_END_NAMESPACE_STD
-_LIBCPP_POP_MACROS
+ _LIBCPP_POP_MACROS
#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
# include <exception>
diff --git a/contrib/llvm-project/libcxx/include/typeindex b/contrib/llvm-project/libcxx/include/typeindex
index 36bf90722c21..e6ea12afd524 100644
--- a/contrib/llvm-project/libcxx/include/typeindex
+++ b/contrib/llvm-project/libcxx/include/typeindex
@@ -60,59 +60,40 @@ struct hash<type_index>
_LIBCPP_BEGIN_NAMESPACE_STD
-class _LIBCPP_TEMPLATE_VIS type_index
-{
- const type_info* __t_;
+class _LIBCPP_TEMPLATE_VIS type_index {
+ const type_info* __t_;
+
public:
- _LIBCPP_HIDE_FROM_ABI
- type_index(const type_info& __y) _NOEXCEPT : __t_(&__y) {}
+ _LIBCPP_HIDE_FROM_ABI type_index(const type_info& __y) _NOEXCEPT : __t_(&__y) {}
- _LIBCPP_HIDE_FROM_ABI
- bool operator==(const type_index& __y) const _NOEXCEPT
- {return *__t_ == *__y.__t_;}
+ _LIBCPP_HIDE_FROM_ABI bool operator==(const type_index& __y) const _NOEXCEPT { return *__t_ == *__y.__t_; }
#if _LIBCPP_STD_VER <= 17
- _LIBCPP_HIDE_FROM_ABI
- bool operator!=(const type_index& __y) const _NOEXCEPT
- {return *__t_ != *__y.__t_;}
+ _LIBCPP_HIDE_FROM_ABI bool operator!=(const type_index& __y) const _NOEXCEPT { return *__t_ != *__y.__t_; }
#endif
- _LIBCPP_HIDE_FROM_ABI
- bool operator< (const type_index& __y) const _NOEXCEPT
- {return __t_->before(*__y.__t_);}
- _LIBCPP_HIDE_FROM_ABI
- bool operator<=(const type_index& __y) const _NOEXCEPT
- {return !__y.__t_->before(*__t_);}
- _LIBCPP_HIDE_FROM_ABI
- bool operator> (const type_index& __y) const _NOEXCEPT
- {return __y.__t_->before(*__t_);}
- _LIBCPP_HIDE_FROM_ABI
- bool operator>=(const type_index& __y) const _NOEXCEPT
- {return !__t_->before(*__y.__t_);}
+ _LIBCPP_HIDE_FROM_ABI bool operator<(const type_index& __y) const _NOEXCEPT { return __t_->before(*__y.__t_); }
+ _LIBCPP_HIDE_FROM_ABI bool operator<=(const type_index& __y) const _NOEXCEPT { return !__y.__t_->before(*__t_); }
+ _LIBCPP_HIDE_FROM_ABI bool operator>(const type_index& __y) const _NOEXCEPT { return __y.__t_->before(*__t_); }
+ _LIBCPP_HIDE_FROM_ABI bool operator>=(const type_index& __y) const _NOEXCEPT { return !__t_->before(*__y.__t_); }
#if _LIBCPP_STD_VER >= 20
- _LIBCPP_HIDE_FROM_ABI
- strong_ordering operator<=>(const type_index& __y) const noexcept {
- if (*__t_ == *__y.__t_)
- return strong_ordering::equal;
- if (__t_->before(*__y.__t_))
- return strong_ordering::less;
- return strong_ordering::greater;
- }
+ _LIBCPP_HIDE_FROM_ABI strong_ordering operator<=>(const type_index& __y) const noexcept {
+ if (*__t_ == *__y.__t_)
+ return strong_ordering::equal;
+ if (__t_->before(*__y.__t_))
+ return strong_ordering::less;
+ return strong_ordering::greater;
+ }
#endif
- _LIBCPP_HIDE_FROM_ABI
- size_t hash_code() const _NOEXCEPT {return __t_->hash_code();}
- _LIBCPP_HIDE_FROM_ABI
- const char* name() const _NOEXCEPT {return __t_->name();}
+ _LIBCPP_HIDE_FROM_ABI size_t hash_code() const _NOEXCEPT { return __t_->hash_code(); }
+ _LIBCPP_HIDE_FROM_ABI const char* name() const _NOEXCEPT { return __t_->name(); }
};
-template <class _Tp> struct _LIBCPP_TEMPLATE_VIS hash;
+template <class _Tp>
+struct _LIBCPP_TEMPLATE_VIS hash;
template <>
-struct _LIBCPP_TEMPLATE_VIS hash<type_index>
- : public __unary_function<type_index, size_t>
-{
- _LIBCPP_HIDE_FROM_ABI
- size_t operator()(type_index __index) const _NOEXCEPT
- {return __index.hash_code();}
+struct _LIBCPP_TEMPLATE_VIS hash<type_index> : public __unary_function<type_index, size_t> {
+ _LIBCPP_HIDE_FROM_ABI size_t operator()(type_index __index) const _NOEXCEPT { return __index.hash_code(); }
};
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/typeinfo b/contrib/llvm-project/libcxx/include/typeinfo
index e8b75734f2ec..39a90676cc44 100644
--- a/contrib/llvm-project/libcxx/include/typeinfo
+++ b/contrib/llvm-project/libcxx/include/typeinfo
@@ -70,57 +70,49 @@ public:
#endif
#if defined(_LIBCPP_ABI_VCRUNTIME)
-#include <vcruntime_typeinfo.h>
+# include <vcruntime_typeinfo.h>
#else
-namespace std // purposefully not using versioning namespace
+namespace std // purposefully not using versioning namespace
{
+# if defined(_LIBCPP_ABI_MICROSOFT)
-#if defined(_LIBCPP_ABI_MICROSOFT)
-
-class _LIBCPP_EXPORTED_FROM_ABI type_info
-{
- type_info& operator=(const type_info&);
- type_info(const type_info&);
+class _LIBCPP_EXPORTED_FROM_ABI type_info {
+ type_info& operator=(const type_info&);
+ type_info(const type_info&);
- mutable struct {
- const char *__undecorated_name;
- const char __decorated_name[1];
- } __data;
+ mutable struct {
+ const char* __undecorated_name;
+ const char __decorated_name[1];
+ } __data;
- int __compare(const type_info &__rhs) const _NOEXCEPT;
+ int __compare(const type_info& __rhs) const _NOEXCEPT;
public:
- virtual ~type_info();
+ virtual ~type_info();
- const char *name() const _NOEXCEPT;
+ const char* name() const _NOEXCEPT;
- _LIBCPP_HIDE_FROM_ABI
- bool before(const type_info& __arg) const _NOEXCEPT {
- return __compare(__arg) < 0;
- }
+ _LIBCPP_HIDE_FROM_ABI bool before(const type_info& __arg) const _NOEXCEPT { return __compare(__arg) < 0; }
- size_t hash_code() const _NOEXCEPT;
+ size_t hash_code() const _NOEXCEPT;
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23
- bool operator==(const type_info& __arg) const _NOEXCEPT {
- // When evaluated in a constant expression, both type infos simply can't come
- // from different translation units, so it is sufficient to compare their addresses.
- if (__libcpp_is_constant_evaluated()) {
- return this == &__arg;
- }
- return __compare(__arg) == 0;
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bool operator==(const type_info& __arg) const _NOEXCEPT {
+ // When evaluated in a constant expression, both type infos simply can't come
+ // from different translation units, so it is sufficient to compare their addresses.
+ if (__libcpp_is_constant_evaluated()) {
+ return this == &__arg;
}
+ return __compare(__arg) == 0;
+ }
-#if _LIBCPP_STD_VER <= 17
- _LIBCPP_HIDE_FROM_ABI
- bool operator!=(const type_info& __arg) const _NOEXCEPT
- { return !operator==(__arg); }
-#endif
+# if _LIBCPP_STD_VER <= 17
+ _LIBCPP_HIDE_FROM_ABI bool operator!=(const type_info& __arg) const _NOEXCEPT { return !operator==(__arg); }
+# endif
};
-#else // !defined(_LIBCPP_ABI_MICROSOFT)
+# else // !defined(_LIBCPP_ABI_MICROSOFT)
// ========================================================================== //
// Implementations
@@ -175,64 +167,58 @@ public:
// This value can be overriden in the __config_site. When it's not overriden,
// we pick a default implementation based on the platform here.
-#ifndef _LIBCPP_TYPEINFO_COMPARISON_IMPLEMENTATION
+# ifndef _LIBCPP_TYPEINFO_COMPARISON_IMPLEMENTATION
- // Windows and AIX binaries can't merge typeinfos, so use the NonUnique implementation.
-# if defined(_LIBCPP_OBJECT_FORMAT_COFF) || defined(_LIBCPP_OBJECT_FORMAT_XCOFF)
-# define _LIBCPP_TYPEINFO_COMPARISON_IMPLEMENTATION 2
+// Windows and AIX binaries can't merge typeinfos, so use the NonUnique implementation.
+# if defined(_LIBCPP_OBJECT_FORMAT_COFF) || defined(_LIBCPP_OBJECT_FORMAT_XCOFF)
+# define _LIBCPP_TYPEINFO_COMPARISON_IMPLEMENTATION 2
- // On arm64 on Apple platforms, use the special NonUniqueARMRTTIBit implementation.
-# elif defined(__APPLE__) && defined(__LP64__) && !defined(__x86_64__)
-# define _LIBCPP_TYPEINFO_COMPARISON_IMPLEMENTATION 3
+// On arm64 on Apple platforms, use the special NonUniqueARMRTTIBit implementation.
+# elif defined(__APPLE__) && defined(__LP64__) && !defined(__x86_64__)
+# define _LIBCPP_TYPEINFO_COMPARISON_IMPLEMENTATION 3
- // On all other platforms, assume the Itanium C++ ABI and use the Unique implementation.
-# else
-# define _LIBCPP_TYPEINFO_COMPARISON_IMPLEMENTATION 1
-# endif
-#endif
+// On all other platforms, assume the Itanium C++ ABI and use the Unique implementation.
+# else
+# define _LIBCPP_TYPEINFO_COMPARISON_IMPLEMENTATION 1
+# endif
+# endif
struct __type_info_implementations {
struct __string_impl_base {
typedef const char* __type_name_t;
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_ALWAYS_INLINE
- _LIBCPP_CONSTEXPR static const char* __type_name_to_string(__type_name_t __v) _NOEXCEPT {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR static const char*
+ __type_name_to_string(__type_name_t __v) _NOEXCEPT {
return __v;
}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_ALWAYS_INLINE
- _LIBCPP_CONSTEXPR static __type_name_t __string_to_type_name(const char* __v) _NOEXCEPT {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR static __type_name_t
+ __string_to_type_name(const char* __v) _NOEXCEPT {
return __v;
}
};
struct __unique_impl : __string_impl_base {
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_ALWAYS_INLINE
- static size_t __hash(__type_name_t __v) _NOEXCEPT {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_ALWAYS_INLINE static size_t __hash(__type_name_t __v) _NOEXCEPT {
return reinterpret_cast<size_t>(__v);
}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_ALWAYS_INLINE
- static bool __eq(__type_name_t __lhs, __type_name_t __rhs) _NOEXCEPT {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_ALWAYS_INLINE static bool __eq(__type_name_t __lhs, __type_name_t __rhs) _NOEXCEPT {
return __lhs == __rhs;
}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_ALWAYS_INLINE
- static bool __lt(__type_name_t __lhs, __type_name_t __rhs) _NOEXCEPT {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_ALWAYS_INLINE static bool __lt(__type_name_t __lhs, __type_name_t __rhs) _NOEXCEPT {
return __lhs < __rhs;
}
};
struct __non_unique_impl : __string_impl_base {
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_ALWAYS_INLINE
- static size_t __hash(__type_name_t __ptr) _NOEXCEPT {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_ALWAYS_INLINE static size_t __hash(__type_name_t __ptr) _NOEXCEPT {
size_t __hash = 5381;
while (unsigned char __c = static_cast<unsigned char>(*__ptr++))
__hash = (__hash * 33) ^ __c;
return __hash;
}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_ALWAYS_INLINE
- static bool __eq(__type_name_t __lhs, __type_name_t __rhs) _NOEXCEPT {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_ALWAYS_INLINE static bool __eq(__type_name_t __lhs, __type_name_t __rhs) _NOEXCEPT {
return __lhs == __rhs || __builtin_strcmp(__lhs, __rhs) == 0;
}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_ALWAYS_INLINE
- static bool __lt(__type_name_t __lhs, __type_name_t __rhs) _NOEXCEPT {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_ALWAYS_INLINE static bool __lt(__type_name_t __lhs, __type_name_t __rhs) _NOEXCEPT {
return __builtin_strcmp(__lhs, __rhs) < 0;
}
};
@@ -240,24 +226,19 @@ struct __type_info_implementations {
struct __non_unique_arm_rtti_bit_impl {
typedef uintptr_t __type_name_t;
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_ALWAYS_INLINE
- static const char* __type_name_to_string(__type_name_t __v) _NOEXCEPT {
- return reinterpret_cast<const char*>(__v &
- ~__non_unique_rtti_bit::value);
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_ALWAYS_INLINE static const char* __type_name_to_string(__type_name_t __v) _NOEXCEPT {
+ return reinterpret_cast<const char*>(__v & ~__non_unique_rtti_bit::value);
}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_ALWAYS_INLINE
- static __type_name_t __string_to_type_name(const char* __v) _NOEXCEPT {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_ALWAYS_INLINE static __type_name_t __string_to_type_name(const char* __v) _NOEXCEPT {
return reinterpret_cast<__type_name_t>(__v);
}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_ALWAYS_INLINE
- static size_t __hash(__type_name_t __v) _NOEXCEPT {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_ALWAYS_INLINE static size_t __hash(__type_name_t __v) _NOEXCEPT {
if (__is_type_name_unique(__v))
return __v;
return __non_unique_impl::__hash(__type_name_to_string(__v));
}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_ALWAYS_INLINE
- static bool __eq(__type_name_t __lhs, __type_name_t __rhs) _NOEXCEPT {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_ALWAYS_INLINE static bool __eq(__type_name_t __lhs, __type_name_t __rhs) _NOEXCEPT {
if (__lhs == __rhs)
return true;
if (__is_type_name_unique(__lhs) || __is_type_name_unique(__rhs))
@@ -266,109 +247,86 @@ struct __type_info_implementations {
return false;
return __builtin_strcmp(__type_name_to_string(__lhs), __type_name_to_string(__rhs)) == 0;
}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_ALWAYS_INLINE
- static bool __lt(__type_name_t __lhs, __type_name_t __rhs) _NOEXCEPT {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_ALWAYS_INLINE static bool __lt(__type_name_t __lhs, __type_name_t __rhs) _NOEXCEPT {
if (__is_type_name_unique(__lhs) || __is_type_name_unique(__rhs))
return __lhs < __rhs;
return __builtin_strcmp(__type_name_to_string(__lhs), __type_name_to_string(__rhs)) < 0;
}
- private:
+ private:
// The unique bit is the top bit. It is expected that __type_name_t is 64 bits when
// this implementation is actually used.
- typedef integral_constant<__type_name_t,
- (1ULL << ((__CHAR_BIT__ * sizeof(__type_name_t)) - 1))> __non_unique_rtti_bit;
+ typedef integral_constant<__type_name_t, (1ULL << ((__CHAR_BIT__ * sizeof(__type_name_t)) - 1))>
+ __non_unique_rtti_bit;
- _LIBCPP_HIDE_FROM_ABI
- static bool __is_type_name_unique(__type_name_t __lhs) _NOEXCEPT {
+ _LIBCPP_HIDE_FROM_ABI static bool __is_type_name_unique(__type_name_t __lhs) _NOEXCEPT {
return !(__lhs & __non_unique_rtti_bit::value);
}
};
typedef
-#if _LIBCPP_TYPEINFO_COMPARISON_IMPLEMENTATION == 1
- __unique_impl
-#elif _LIBCPP_TYPEINFO_COMPARISON_IMPLEMENTATION == 2
- __non_unique_impl
-#elif _LIBCPP_TYPEINFO_COMPARISON_IMPLEMENTATION == 3
- __non_unique_arm_rtti_bit_impl
-#else
-# error invalid configuration for _LIBCPP_TYPEINFO_COMPARISON_IMPLEMENTATION
-#endif
- __impl;
+# if _LIBCPP_TYPEINFO_COMPARISON_IMPLEMENTATION == 1
+ __unique_impl
+# elif _LIBCPP_TYPEINFO_COMPARISON_IMPLEMENTATION == 2
+ __non_unique_impl
+# elif _LIBCPP_TYPEINFO_COMPARISON_IMPLEMENTATION == 3
+ __non_unique_arm_rtti_bit_impl
+# else
+# error invalid configuration for _LIBCPP_TYPEINFO_COMPARISON_IMPLEMENTATION
+# endif
+ __impl;
};
-class _LIBCPP_EXPORTED_FROM_ABI type_info
-{
+class _LIBCPP_EXPORTED_FROM_ABI type_info {
type_info& operator=(const type_info&);
type_info(const type_info&);
- protected:
- typedef __type_info_implementations::__impl __impl;
+protected:
+ typedef __type_info_implementations::__impl __impl;
- __impl::__type_name_t __type_name;
+ __impl::__type_name_t __type_name;
- _LIBCPP_HIDE_FROM_ABI
- explicit type_info(const char* __n)
- : __type_name(__impl::__string_to_type_name(__n)) {}
+ _LIBCPP_HIDE_FROM_ABI explicit type_info(const char* __n) : __type_name(__impl::__string_to_type_name(__n)) {}
public:
- virtual ~type_info();
+ virtual ~type_info();
- _LIBCPP_HIDE_FROM_ABI
- const char* name() const _NOEXCEPT
- {
- return __impl::__type_name_to_string(__type_name);
- }
+ _LIBCPP_HIDE_FROM_ABI const char* name() const _NOEXCEPT { return __impl::__type_name_to_string(__type_name); }
- _LIBCPP_HIDE_FROM_ABI
- bool before(const type_info& __arg) const _NOEXCEPT
- {
- return __impl::__lt(__type_name, __arg.__type_name);
- }
+ _LIBCPP_HIDE_FROM_ABI bool before(const type_info& __arg) const _NOEXCEPT {
+ return __impl::__lt(__type_name, __arg.__type_name);
+ }
- _LIBCPP_HIDE_FROM_ABI
- size_t hash_code() const _NOEXCEPT
- {
- return __impl::__hash(__type_name);
- }
+ _LIBCPP_HIDE_FROM_ABI size_t hash_code() const _NOEXCEPT { return __impl::__hash(__type_name); }
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23
- bool operator==(const type_info& __arg) const _NOEXCEPT
- {
- // When evaluated in a constant expression, both type infos simply can't come
- // from different translation units, so it is sufficient to compare their addresses.
- if (__libcpp_is_constant_evaluated()) {
- return this == &__arg;
- }
- return __impl::__eq(__type_name, __arg.__type_name);
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bool operator==(const type_info& __arg) const _NOEXCEPT {
+ // When evaluated in a constant expression, both type infos simply can't come
+ // from different translation units, so it is sufficient to compare their addresses.
+ if (__libcpp_is_constant_evaluated()) {
+ return this == &__arg;
}
+ return __impl::__eq(__type_name, __arg.__type_name);
+ }
-#if _LIBCPP_STD_VER <= 17
- _LIBCPP_HIDE_FROM_ABI
- bool operator!=(const type_info& __arg) const _NOEXCEPT
- { return !operator==(__arg); }
-#endif
+# if _LIBCPP_STD_VER <= 17
+ _LIBCPP_HIDE_FROM_ABI bool operator!=(const type_info& __arg) const _NOEXCEPT { return !operator==(__arg); }
+# endif
};
-#endif // defined(_LIBCPP_ABI_MICROSOFT)
+# endif // defined(_LIBCPP_ABI_MICROSOFT)
-class _LIBCPP_EXPORTED_FROM_ABI bad_cast
- : public exception
-{
- public:
+class _LIBCPP_EXPORTED_FROM_ABI bad_cast : public exception {
+public:
bad_cast() _NOEXCEPT;
- _LIBCPP_HIDE_FROM_ABI bad_cast(const bad_cast&) _NOEXCEPT = default;
+ _LIBCPP_HIDE_FROM_ABI bad_cast(const bad_cast&) _NOEXCEPT = default;
_LIBCPP_HIDE_FROM_ABI bad_cast& operator=(const bad_cast&) _NOEXCEPT = default;
~bad_cast() _NOEXCEPT override;
const char* what() const _NOEXCEPT override;
};
-class _LIBCPP_EXPORTED_FROM_ABI bad_typeid
- : public exception
-{
- public:
+class _LIBCPP_EXPORTED_FROM_ABI bad_typeid : public exception {
+public:
bad_typeid() _NOEXCEPT;
- _LIBCPP_HIDE_FROM_ABI bad_typeid(const bad_typeid&) _NOEXCEPT = default;
+ _LIBCPP_HIDE_FROM_ABI bad_typeid(const bad_typeid&) _NOEXCEPT = default;
_LIBCPP_HIDE_FROM_ABI bad_typeid& operator=(const bad_typeid&) _NOEXCEPT = default;
~bad_typeid() _NOEXCEPT override;
const char* what() const _NOEXCEPT override;
@@ -403,13 +361,11 @@ private:
#endif // defined(_LIBCPP_ABI_VCRUNTIME) && _HAS_EXCEPTIONS == 0
_LIBCPP_BEGIN_NAMESPACE_STD
-_LIBCPP_NORETURN inline _LIBCPP_HIDE_FROM_ABI
-void __throw_bad_cast()
-{
+_LIBCPP_NORETURN inline _LIBCPP_HIDE_FROM_ABI void __throw_bad_cast() {
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- throw bad_cast();
+ throw bad_cast();
#else
- _LIBCPP_VERBOSE_ABORT("bad_cast was thrown in -fno-exceptions mode");
+ _LIBCPP_VERBOSE_ABORT("bad_cast was thrown in -fno-exceptions mode");
#endif
}
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/uchar.h b/contrib/llvm-project/libcxx/include/uchar.h
index 546113f7eab4..07b78611406d 100644
--- a/contrib/llvm-project/libcxx/include/uchar.h
+++ b/contrib/llvm-project/libcxx/include/uchar.h
@@ -44,12 +44,12 @@ size_t c32rtomb(char* s, char32_t c32, mbstate_t* ps);
// error on those platforms. When the platform doesn't provide <uchar.h>, at
// least include <stddef.h> so we get the declaration for size_t, and try to
// get the declaration of mbstate_t too.
-#if __has_include_next(<uchar.h>)
-# include_next <uchar.h>
-#else
-# include <__mbstate_t.h>
-# include <stddef.h>
-#endif
+# if __has_include_next(<uchar.h>)
+# include_next <uchar.h>
+# else
+# include <__mbstate_t.h>
+# include <stddef.h>
+# endif
#endif // _LIBCPP_CXX03_LANG
diff --git a/contrib/llvm-project/libcxx/include/unordered_map b/contrib/llvm-project/libcxx/include/unordered_map
index c8abefd9ead5..4be25fc1cdd8 100644
--- a/contrib/llvm-project/libcxx/include/unordered_map
+++ b/contrib/llvm-project/libcxx/include/unordered_map
@@ -627,2152 +627,1903 @@ template <class Key, class T, class Hash, class Pred, class Alloc>
_LIBCPP_BEGIN_NAMESPACE_STD
-template <class _Key, class _Cp, class _Hash, class _Pred,
+template <class _Key,
+ class _Cp,
+ class _Hash,
+ class _Pred,
bool = is_empty<_Hash>::value && !__libcpp_is_final<_Hash>::value>
-class __unordered_map_hasher
- : private _Hash
-{
+class __unordered_map_hasher : private _Hash {
public:
- _LIBCPP_HIDE_FROM_ABI
- __unordered_map_hasher()
- _NOEXCEPT_(is_nothrow_default_constructible<_Hash>::value)
- : _Hash() {}
- _LIBCPP_HIDE_FROM_ABI
- __unordered_map_hasher(const _Hash& __h)
- _NOEXCEPT_(is_nothrow_copy_constructible<_Hash>::value)
- : _Hash(__h) {}
- _LIBCPP_HIDE_FROM_ABI
- const _Hash& hash_function() const _NOEXCEPT {return *this;}
- _LIBCPP_HIDE_FROM_ABI
- size_t operator()(const _Cp& __x) const
- {return static_cast<const _Hash&>(*this)(__x.__get_value().first);}
- _LIBCPP_HIDE_FROM_ABI
- size_t operator()(const _Key& __x) const
- {return static_cast<const _Hash&>(*this)(__x);}
+ _LIBCPP_HIDE_FROM_ABI __unordered_map_hasher() _NOEXCEPT_(is_nothrow_default_constructible<_Hash>::value) : _Hash() {}
+ _LIBCPP_HIDE_FROM_ABI __unordered_map_hasher(const _Hash& __h) _NOEXCEPT_(is_nothrow_copy_constructible<_Hash>::value)
+ : _Hash(__h) {}
+ _LIBCPP_HIDE_FROM_ABI const _Hash& hash_function() const _NOEXCEPT { return *this; }
+ _LIBCPP_HIDE_FROM_ABI size_t operator()(const _Cp& __x) const {
+ return static_cast<const _Hash&>(*this)(__x.__get_value().first);
+ }
+ _LIBCPP_HIDE_FROM_ABI size_t operator()(const _Key& __x) const { return static_cast<const _Hash&>(*this)(__x); }
#if _LIBCPP_STD_VER >= 20
- template <typename _K2>
- _LIBCPP_HIDE_FROM_ABI
- size_t operator()(const _K2& __x) const
- {return static_cast<const _Hash&>(*this)(__x);}
+ template <typename _K2>
+ _LIBCPP_HIDE_FROM_ABI size_t operator()(const _K2& __x) const {
+ return static_cast<const _Hash&>(*this)(__x);
+ }
#endif
- _LIBCPP_HIDE_FROM_ABI
- void swap(__unordered_map_hasher& __y)
- _NOEXCEPT_(__is_nothrow_swappable<_Hash>::value)
- {
- using std::swap;
- swap(static_cast<_Hash&>(*this), static_cast<_Hash&>(__y));
- }
+ _LIBCPP_HIDE_FROM_ABI void swap(__unordered_map_hasher& __y) _NOEXCEPT_(__is_nothrow_swappable<_Hash>::value) {
+ using std::swap;
+ swap(static_cast<_Hash&>(*this), static_cast<_Hash&>(__y));
+ }
};
template <class _Key, class _Cp, class _Hash, class _Pred>
-class __unordered_map_hasher<_Key, _Cp, _Hash, _Pred, false>
-{
- _Hash __hash_;
+class __unordered_map_hasher<_Key, _Cp, _Hash, _Pred, false> {
+ _Hash __hash_;
+
public:
- _LIBCPP_HIDE_FROM_ABI
- __unordered_map_hasher()
- _NOEXCEPT_(is_nothrow_default_constructible<_Hash>::value)
- : __hash_() {}
- _LIBCPP_HIDE_FROM_ABI
- __unordered_map_hasher(const _Hash& __h)
- _NOEXCEPT_(is_nothrow_copy_constructible<_Hash>::value)
- : __hash_(__h) {}
- _LIBCPP_HIDE_FROM_ABI
- const _Hash& hash_function() const _NOEXCEPT {return __hash_;}
- _LIBCPP_HIDE_FROM_ABI
- size_t operator()(const _Cp& __x) const
- {return __hash_(__x.__get_value().first);}
- _LIBCPP_HIDE_FROM_ABI
- size_t operator()(const _Key& __x) const
- {return __hash_(__x);}
+ _LIBCPP_HIDE_FROM_ABI __unordered_map_hasher() _NOEXCEPT_(is_nothrow_default_constructible<_Hash>::value)
+ : __hash_() {}
+ _LIBCPP_HIDE_FROM_ABI __unordered_map_hasher(const _Hash& __h) _NOEXCEPT_(is_nothrow_copy_constructible<_Hash>::value)
+ : __hash_(__h) {}
+ _LIBCPP_HIDE_FROM_ABI const _Hash& hash_function() const _NOEXCEPT { return __hash_; }
+ _LIBCPP_HIDE_FROM_ABI size_t operator()(const _Cp& __x) const { return __hash_(__x.__get_value().first); }
+ _LIBCPP_HIDE_FROM_ABI size_t operator()(const _Key& __x) const { return __hash_(__x); }
#if _LIBCPP_STD_VER >= 20
- template <typename _K2>
- _LIBCPP_HIDE_FROM_ABI
- size_t operator()(const _K2& __x) const
- {return __hash_(__x);}
+ template <typename _K2>
+ _LIBCPP_HIDE_FROM_ABI size_t operator()(const _K2& __x) const {
+ return __hash_(__x);
+ }
#endif
- _LIBCPP_HIDE_FROM_ABI
- void swap(__unordered_map_hasher& __y)
- _NOEXCEPT_(__is_nothrow_swappable<_Hash>::value)
- {
- using std::swap;
- swap(__hash_, __y.__hash_);
- }
+ _LIBCPP_HIDE_FROM_ABI void swap(__unordered_map_hasher& __y) _NOEXCEPT_(__is_nothrow_swappable<_Hash>::value) {
+ using std::swap;
+ swap(__hash_, __y.__hash_);
+ }
};
template <class _Key, class _Cp, class _Hash, class _Pred, bool __b>
-inline _LIBCPP_HIDE_FROM_ABI
-void
+inline _LIBCPP_HIDE_FROM_ABI void
swap(__unordered_map_hasher<_Key, _Cp, _Hash, _Pred, __b>& __x,
- __unordered_map_hasher<_Key, _Cp, _Hash, _Pred, __b>& __y)
- _NOEXCEPT_(_NOEXCEPT_(__x.swap(__y)))
-{
- __x.swap(__y);
+ __unordered_map_hasher<_Key, _Cp, _Hash, _Pred, __b>& __y) _NOEXCEPT_(_NOEXCEPT_(__x.swap(__y))) {
+ __x.swap(__y);
}
-template <class _Key, class _Cp, class _Pred, class _Hash,
+template <class _Key,
+ class _Cp,
+ class _Pred,
+ class _Hash,
bool = is_empty<_Pred>::value && !__libcpp_is_final<_Pred>::value>
-class __unordered_map_equal
- : private _Pred
-{
+class __unordered_map_equal : private _Pred {
public:
- _LIBCPP_HIDE_FROM_ABI
- __unordered_map_equal()
- _NOEXCEPT_(is_nothrow_default_constructible<_Pred>::value)
- : _Pred() {}
- _LIBCPP_HIDE_FROM_ABI
- __unordered_map_equal(const _Pred& __p)
- _NOEXCEPT_(is_nothrow_copy_constructible<_Pred>::value)
- : _Pred(__p) {}
- _LIBCPP_HIDE_FROM_ABI
- const _Pred& key_eq() const _NOEXCEPT {return *this;}
- _LIBCPP_HIDE_FROM_ABI
- bool operator()(const _Cp& __x, const _Cp& __y) const
- {return static_cast<const _Pred&>(*this)(__x.__get_value().first, __y.__get_value().first);}
- _LIBCPP_HIDE_FROM_ABI
- bool operator()(const _Cp& __x, const _Key& __y) const
- {return static_cast<const _Pred&>(*this)(__x.__get_value().first, __y);}
- _LIBCPP_HIDE_FROM_ABI
- bool operator()(const _Key& __x, const _Cp& __y) const
- {return static_cast<const _Pred&>(*this)(__x, __y.__get_value().first);}
+ _LIBCPP_HIDE_FROM_ABI __unordered_map_equal() _NOEXCEPT_(is_nothrow_default_constructible<_Pred>::value) : _Pred() {}
+ _LIBCPP_HIDE_FROM_ABI __unordered_map_equal(const _Pred& __p) _NOEXCEPT_(is_nothrow_copy_constructible<_Pred>::value)
+ : _Pred(__p) {}
+ _LIBCPP_HIDE_FROM_ABI const _Pred& key_eq() const _NOEXCEPT { return *this; }
+ _LIBCPP_HIDE_FROM_ABI bool operator()(const _Cp& __x, const _Cp& __y) const {
+ return static_cast<const _Pred&>(*this)(__x.__get_value().first, __y.__get_value().first);
+ }
+ _LIBCPP_HIDE_FROM_ABI bool operator()(const _Cp& __x, const _Key& __y) const {
+ return static_cast<const _Pred&>(*this)(__x.__get_value().first, __y);
+ }
+ _LIBCPP_HIDE_FROM_ABI bool operator()(const _Key& __x, const _Cp& __y) const {
+ return static_cast<const _Pred&>(*this)(__x, __y.__get_value().first);
+ }
#if _LIBCPP_STD_VER >= 20
- template <typename _K2>
- _LIBCPP_HIDE_FROM_ABI
- bool operator()(const _Cp& __x, const _K2& __y) const
- {return static_cast<const _Pred&>(*this)(__x.__get_value().first, __y);}
- template <typename _K2>
- _LIBCPP_HIDE_FROM_ABI
- bool operator()(const _K2& __x, const _Cp& __y) const
- {return static_cast<const _Pred&>(*this)(__x, __y.__get_value().first);}
- template <typename _K2>
- _LIBCPP_HIDE_FROM_ABI
- bool operator()(const _Key& __x, const _K2& __y) const
- {return static_cast<const _Pred&>(*this)(__x, __y);}
- template <typename _K2>
- _LIBCPP_HIDE_FROM_ABI
- bool operator()(const _K2& __x, const _Key& __y) const
- {return static_cast<const _Pred&>(*this)(__x, __y);}
+ template <typename _K2>
+ _LIBCPP_HIDE_FROM_ABI bool operator()(const _Cp& __x, const _K2& __y) const {
+ return static_cast<const _Pred&>(*this)(__x.__get_value().first, __y);
+ }
+ template <typename _K2>
+ _LIBCPP_HIDE_FROM_ABI bool operator()(const _K2& __x, const _Cp& __y) const {
+ return static_cast<const _Pred&>(*this)(__x, __y.__get_value().first);
+ }
+ template <typename _K2>
+ _LIBCPP_HIDE_FROM_ABI bool operator()(const _Key& __x, const _K2& __y) const {
+ return static_cast<const _Pred&>(*this)(__x, __y);
+ }
+ template <typename _K2>
+ _LIBCPP_HIDE_FROM_ABI bool operator()(const _K2& __x, const _Key& __y) const {
+ return static_cast<const _Pred&>(*this)(__x, __y);
+ }
#endif
- _LIBCPP_HIDE_FROM_ABI
- void swap(__unordered_map_equal& __y)
- _NOEXCEPT_(__is_nothrow_swappable<_Pred>::value)
- {
- using std::swap;
- swap(static_cast<_Pred&>(*this), static_cast<_Pred&>(__y));
- }
+ _LIBCPP_HIDE_FROM_ABI void swap(__unordered_map_equal& __y) _NOEXCEPT_(__is_nothrow_swappable<_Pred>::value) {
+ using std::swap;
+ swap(static_cast<_Pred&>(*this), static_cast<_Pred&>(__y));
+ }
};
template <class _Key, class _Cp, class _Pred, class _Hash>
-class __unordered_map_equal<_Key, _Cp, _Pred, _Hash, false>
-{
- _Pred __pred_;
+class __unordered_map_equal<_Key, _Cp, _Pred, _Hash, false> {
+ _Pred __pred_;
+
public:
- _LIBCPP_HIDE_FROM_ABI
- __unordered_map_equal()
- _NOEXCEPT_(is_nothrow_default_constructible<_Pred>::value)
- : __pred_() {}
- _LIBCPP_HIDE_FROM_ABI
- __unordered_map_equal(const _Pred& __p)
- _NOEXCEPT_(is_nothrow_copy_constructible<_Pred>::value)
- : __pred_(__p) {}
- _LIBCPP_HIDE_FROM_ABI
- const _Pred& key_eq() const _NOEXCEPT {return __pred_;}
- _LIBCPP_HIDE_FROM_ABI
- bool operator()(const _Cp& __x, const _Cp& __y) const
- {return __pred_(__x.__get_value().first, __y.__get_value().first);}
- _LIBCPP_HIDE_FROM_ABI
- bool operator()(const _Cp& __x, const _Key& __y) const
- {return __pred_(__x.__get_value().first, __y);}
- _LIBCPP_HIDE_FROM_ABI
- bool operator()(const _Key& __x, const _Cp& __y) const
- {return __pred_(__x, __y.__get_value().first);}
+ _LIBCPP_HIDE_FROM_ABI __unordered_map_equal() _NOEXCEPT_(is_nothrow_default_constructible<_Pred>::value)
+ : __pred_() {}
+ _LIBCPP_HIDE_FROM_ABI __unordered_map_equal(const _Pred& __p) _NOEXCEPT_(is_nothrow_copy_constructible<_Pred>::value)
+ : __pred_(__p) {}
+ _LIBCPP_HIDE_FROM_ABI const _Pred& key_eq() const _NOEXCEPT { return __pred_; }
+ _LIBCPP_HIDE_FROM_ABI bool operator()(const _Cp& __x, const _Cp& __y) const {
+ return __pred_(__x.__get_value().first, __y.__get_value().first);
+ }
+ _LIBCPP_HIDE_FROM_ABI bool operator()(const _Cp& __x, const _Key& __y) const {
+ return __pred_(__x.__get_value().first, __y);
+ }
+ _LIBCPP_HIDE_FROM_ABI bool operator()(const _Key& __x, const _Cp& __y) const {
+ return __pred_(__x, __y.__get_value().first);
+ }
#if _LIBCPP_STD_VER >= 20
- template <typename _K2>
- _LIBCPP_HIDE_FROM_ABI
- bool operator()(const _Cp& __x, const _K2& __y) const
- {return __pred_(__x.__get_value().first, __y);}
- template <typename _K2>
- _LIBCPP_HIDE_FROM_ABI
- bool operator()(const _K2& __x, const _Cp& __y) const
- {return __pred_(__x, __y.__get_value().first);}
- template <typename _K2>
- _LIBCPP_HIDE_FROM_ABI
- bool operator()(const _Key& __x, const _K2& __y) const
- {return __pred_(__x, __y);}
- template <typename _K2>
- _LIBCPP_HIDE_FROM_ABI
- bool operator()(const _K2& __x, const _Key& __y) const
- {return __pred_(__x, __y);}
+ template <typename _K2>
+ _LIBCPP_HIDE_FROM_ABI bool operator()(const _Cp& __x, const _K2& __y) const {
+ return __pred_(__x.__get_value().first, __y);
+ }
+ template <typename _K2>
+ _LIBCPP_HIDE_FROM_ABI bool operator()(const _K2& __x, const _Cp& __y) const {
+ return __pred_(__x, __y.__get_value().first);
+ }
+ template <typename _K2>
+ _LIBCPP_HIDE_FROM_ABI bool operator()(const _Key& __x, const _K2& __y) const {
+ return __pred_(__x, __y);
+ }
+ template <typename _K2>
+ _LIBCPP_HIDE_FROM_ABI bool operator()(const _K2& __x, const _Key& __y) const {
+ return __pred_(__x, __y);
+ }
#endif
- _LIBCPP_HIDE_FROM_ABI
- void swap(__unordered_map_equal& __y)
- _NOEXCEPT_(__is_nothrow_swappable<_Pred>::value)
- {
- using std::swap;
- swap(__pred_, __y.__pred_);
- }
+ _LIBCPP_HIDE_FROM_ABI void swap(__unordered_map_equal& __y) _NOEXCEPT_(__is_nothrow_swappable<_Pred>::value) {
+ using std::swap;
+ swap(__pred_, __y.__pred_);
+ }
};
template <class _Key, class _Cp, class _Pred, class _Hash, bool __b>
-inline _LIBCPP_HIDE_FROM_ABI
-void
-swap(__unordered_map_equal<_Key, _Cp, _Pred, _Hash, __b>& __x,
- __unordered_map_equal<_Key, _Cp, _Pred, _Hash, __b>& __y)
- _NOEXCEPT_(_NOEXCEPT_(__x.swap(__y)))
-{
- __x.swap(__y);
+inline _LIBCPP_HIDE_FROM_ABI void
+swap(__unordered_map_equal<_Key, _Cp, _Pred, _Hash, __b>& __x, __unordered_map_equal<_Key, _Cp, _Pred, _Hash, __b>& __y)
+ _NOEXCEPT_(_NOEXCEPT_(__x.swap(__y))) {
+ __x.swap(__y);
}
template <class _Alloc>
-class __hash_map_node_destructor
-{
- typedef _Alloc allocator_type;
- typedef allocator_traits<allocator_type> __alloc_traits;
+class __hash_map_node_destructor {
+ typedef _Alloc allocator_type;
+ typedef allocator_traits<allocator_type> __alloc_traits;
public:
+ typedef typename __alloc_traits::pointer pointer;
- typedef typename __alloc_traits::pointer pointer;
private:
+ allocator_type& __na_;
- allocator_type& __na_;
-
- __hash_map_node_destructor& operator=(const __hash_map_node_destructor&);
+ __hash_map_node_destructor& operator=(const __hash_map_node_destructor&);
public:
- bool __first_constructed;
- bool __second_constructed;
+ bool __first_constructed;
+ bool __second_constructed;
- _LIBCPP_HIDE_FROM_ABI
- explicit __hash_map_node_destructor(allocator_type& __na) _NOEXCEPT
- : __na_(__na),
- __first_constructed(false),
- __second_constructed(false)
- {}
+ _LIBCPP_HIDE_FROM_ABI explicit __hash_map_node_destructor(allocator_type& __na) _NOEXCEPT
+ : __na_(__na),
+ __first_constructed(false),
+ __second_constructed(false) {}
#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI
- __hash_map_node_destructor(__hash_node_destructor<allocator_type>&& __x)
- _NOEXCEPT
- : __na_(__x.__na_),
- __first_constructed(__x.__value_constructed),
- __second_constructed(__x.__value_constructed)
- {
- __x.__value_constructed = false;
- }
+ _LIBCPP_HIDE_FROM_ABI __hash_map_node_destructor(__hash_node_destructor<allocator_type>&& __x) _NOEXCEPT
+ : __na_(__x.__na_),
+ __first_constructed(__x.__value_constructed),
+ __second_constructed(__x.__value_constructed) {
+ __x.__value_constructed = false;
+ }
#else // _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI
- __hash_map_node_destructor(const __hash_node_destructor<allocator_type>& __x)
- : __na_(__x.__na_),
- __first_constructed(__x.__value_constructed),
- __second_constructed(__x.__value_constructed)
- {
- const_cast<bool&>(__x.__value_constructed) = false;
- }
+ _LIBCPP_HIDE_FROM_ABI __hash_map_node_destructor(const __hash_node_destructor<allocator_type>& __x)
+ : __na_(__x.__na_), __first_constructed(__x.__value_constructed), __second_constructed(__x.__value_constructed) {
+ const_cast<bool&>(__x.__value_constructed) = false;
+ }
#endif // _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI
- void operator()(pointer __p) _NOEXCEPT
- {
- if (__second_constructed)
- __alloc_traits::destroy(__na_, std::addressof(__p->__get_value().__get_value().second));
- if (__first_constructed)
- __alloc_traits::destroy(__na_, std::addressof(__p->__get_value().__get_value().first));
- if (__p)
- __alloc_traits::deallocate(__na_, __p, 1);
- }
+ _LIBCPP_HIDE_FROM_ABI void operator()(pointer __p) _NOEXCEPT {
+ if (__second_constructed)
+ __alloc_traits::destroy(__na_, std::addressof(__p->__get_value().__get_value().second));
+ if (__first_constructed)
+ __alloc_traits::destroy(__na_, std::addressof(__p->__get_value().__get_value().first));
+ if (__p)
+ __alloc_traits::deallocate(__na_, __p, 1);
+ }
};
#ifndef _LIBCPP_CXX03_LANG
template <class _Key, class _Tp>
-struct _LIBCPP_STANDALONE_DEBUG __hash_value_type
-{
- typedef _Key key_type;
- typedef _Tp mapped_type;
- typedef pair<const key_type, mapped_type> value_type;
- typedef pair<key_type&, mapped_type&> __nc_ref_pair_type;
- typedef pair<key_type&&, mapped_type&&> __nc_rref_pair_type;
+struct _LIBCPP_STANDALONE_DEBUG __hash_value_type {
+ typedef _Key key_type;
+ typedef _Tp mapped_type;
+ typedef pair<const key_type, mapped_type> value_type;
+ typedef pair<key_type&, mapped_type&> __nc_ref_pair_type;
+ typedef pair<key_type&&, mapped_type&&> __nc_rref_pair_type;
private:
- value_type __cc_;
+ value_type __cc_;
public:
- _LIBCPP_HIDE_FROM_ABI
- value_type& __get_value()
- {
-#if _LIBCPP_STD_VER >= 17
- return *std::launder(std::addressof(__cc_));
-#else
- return __cc_;
-#endif
- }
-
- _LIBCPP_HIDE_FROM_ABI
- const value_type& __get_value() const
- {
-#if _LIBCPP_STD_VER >= 17
- return *std::launder(std::addressof(__cc_));
-#else
- return __cc_;
-#endif
- }
-
- _LIBCPP_HIDE_FROM_ABI
- __nc_ref_pair_type __ref()
- {
- value_type& __v = __get_value();
- return __nc_ref_pair_type(const_cast<key_type&>(__v.first), __v.second);
- }
-
- _LIBCPP_HIDE_FROM_ABI
- __nc_rref_pair_type __move()
- {
- value_type& __v = __get_value();
- return __nc_rref_pair_type(
- std::move(const_cast<key_type&>(__v.first)),
- std::move(__v.second));
- }
-
- _LIBCPP_HIDE_FROM_ABI
- __hash_value_type& operator=(const __hash_value_type& __v)
- {
- __ref() = __v.__get_value();
- return *this;
- }
+ _LIBCPP_HIDE_FROM_ABI value_type& __get_value() {
+# if _LIBCPP_STD_VER >= 17
+ return *std::launder(std::addressof(__cc_));
+# else
+ return __cc_;
+# endif
+ }
+
+ _LIBCPP_HIDE_FROM_ABI const value_type& __get_value() const {
+# if _LIBCPP_STD_VER >= 17
+ return *std::launder(std::addressof(__cc_));
+# else
+ return __cc_;
+# endif
+ }
+
+ _LIBCPP_HIDE_FROM_ABI __nc_ref_pair_type __ref() {
+ value_type& __v = __get_value();
+ return __nc_ref_pair_type(const_cast<key_type&>(__v.first), __v.second);
+ }
+
+ _LIBCPP_HIDE_FROM_ABI __nc_rref_pair_type __move() {
+ value_type& __v = __get_value();
+ return __nc_rref_pair_type(std::move(const_cast<key_type&>(__v.first)), std::move(__v.second));
+ }
+
+ _LIBCPP_HIDE_FROM_ABI __hash_value_type& operator=(const __hash_value_type& __v) {
+ __ref() = __v.__get_value();
+ return *this;
+ }
- _LIBCPP_HIDE_FROM_ABI
- __hash_value_type& operator=(__hash_value_type&& __v)
- {
- __ref() = __v.__move();
- return *this;
- }
+ _LIBCPP_HIDE_FROM_ABI __hash_value_type& operator=(__hash_value_type&& __v) {
+ __ref() = __v.__move();
+ return *this;
+ }
- template <class _ValueTp,
- class = __enable_if_t<__is_same_uncvref<_ValueTp, value_type>::value>
- >
- _LIBCPP_HIDE_FROM_ABI
- __hash_value_type& operator=(_ValueTp&& __v)
- {
- __ref() = std::forward<_ValueTp>(__v);
- return *this;
- }
+ template <class _ValueTp, class = __enable_if_t<__is_same_uncvref<_ValueTp, value_type>::value> >
+ _LIBCPP_HIDE_FROM_ABI __hash_value_type& operator=(_ValueTp&& __v) {
+ __ref() = std::forward<_ValueTp>(__v);
+ return *this;
+ }
private:
- __hash_value_type(const __hash_value_type& __v) = delete;
- __hash_value_type(__hash_value_type&& __v) = delete;
- template <class ..._Args>
- explicit __hash_value_type(_Args&& ...__args) = delete;
+ __hash_value_type(const __hash_value_type& __v) = delete;
+ __hash_value_type(__hash_value_type&& __v) = delete;
+ template <class... _Args>
+ explicit __hash_value_type(_Args&&... __args) = delete;
- ~__hash_value_type() = delete;
+ ~__hash_value_type() = delete;
};
#else
template <class _Key, class _Tp>
-struct __hash_value_type
-{
- typedef _Key key_type;
- typedef _Tp mapped_type;
- typedef pair<const key_type, mapped_type> value_type;
+struct __hash_value_type {
+ typedef _Key key_type;
+ typedef _Tp mapped_type;
+ typedef pair<const key_type, mapped_type> value_type;
private:
- value_type __cc_;
+ value_type __cc_;
public:
- _LIBCPP_HIDE_FROM_ABI
- value_type& __get_value() { return __cc_; }
- _LIBCPP_HIDE_FROM_ABI
- const value_type& __get_value() const { return __cc_; }
+ _LIBCPP_HIDE_FROM_ABI value_type& __get_value() { return __cc_; }
+ _LIBCPP_HIDE_FROM_ABI const value_type& __get_value() const { return __cc_; }
private:
- ~__hash_value_type();
+ ~__hash_value_type();
};
#endif
template <class _HashIterator>
-class _LIBCPP_TEMPLATE_VIS __hash_map_iterator
-{
- _HashIterator __i_;
+class _LIBCPP_TEMPLATE_VIS __hash_map_iterator {
+ _HashIterator __i_;
- typedef __hash_node_types_from_iterator<_HashIterator> _NodeTypes;
+ typedef __hash_node_types_from_iterator<_HashIterator> _NodeTypes;
public:
- typedef forward_iterator_tag iterator_category;
- typedef typename _NodeTypes::__map_value_type value_type;
- typedef typename _NodeTypes::difference_type difference_type;
- typedef value_type& reference;
- typedef typename _NodeTypes::__map_value_type_pointer pointer;
-
- _LIBCPP_HIDE_FROM_ABI
- __hash_map_iterator() _NOEXCEPT {}
-
- _LIBCPP_HIDE_FROM_ABI
- __hash_map_iterator(_HashIterator __i) _NOEXCEPT : __i_(__i) {}
-
- _LIBCPP_HIDE_FROM_ABI
- reference operator*() const {return __i_->__get_value();}
- _LIBCPP_HIDE_FROM_ABI
- pointer operator->() const {return pointer_traits<pointer>::pointer_to(__i_->__get_value());}
-
- _LIBCPP_HIDE_FROM_ABI
- __hash_map_iterator& operator++() {++__i_; return *this;}
- _LIBCPP_HIDE_FROM_ABI
- __hash_map_iterator operator++(int)
- {
- __hash_map_iterator __t(*this);
- ++(*this);
- return __t;
- }
+ typedef forward_iterator_tag iterator_category;
+ typedef typename _NodeTypes::__map_value_type value_type;
+ typedef typename _NodeTypes::difference_type difference_type;
+ typedef value_type& reference;
+ typedef typename _NodeTypes::__map_value_type_pointer pointer;
+
+ _LIBCPP_HIDE_FROM_ABI __hash_map_iterator() _NOEXCEPT {}
- friend _LIBCPP_HIDE_FROM_ABI
- bool operator==(const __hash_map_iterator& __x, const __hash_map_iterator& __y)
- {return __x.__i_ == __y.__i_;}
+ _LIBCPP_HIDE_FROM_ABI __hash_map_iterator(_HashIterator __i) _NOEXCEPT : __i_(__i) {}
+
+ _LIBCPP_HIDE_FROM_ABI reference operator*() const { return __i_->__get_value(); }
+ _LIBCPP_HIDE_FROM_ABI pointer operator->() const { return pointer_traits<pointer>::pointer_to(__i_->__get_value()); }
+
+ _LIBCPP_HIDE_FROM_ABI __hash_map_iterator& operator++() {
+ ++__i_;
+ return *this;
+ }
+ _LIBCPP_HIDE_FROM_ABI __hash_map_iterator operator++(int) {
+ __hash_map_iterator __t(*this);
+ ++(*this);
+ return __t;
+ }
+
+ friend _LIBCPP_HIDE_FROM_ABI bool operator==(const __hash_map_iterator& __x, const __hash_map_iterator& __y) {
+ return __x.__i_ == __y.__i_;
+ }
#if _LIBCPP_STD_VER <= 17
- friend _LIBCPP_HIDE_FROM_ABI
- bool operator!=(const __hash_map_iterator& __x, const __hash_map_iterator& __y)
- {return __x.__i_ != __y.__i_;}
+ friend _LIBCPP_HIDE_FROM_ABI bool operator!=(const __hash_map_iterator& __x, const __hash_map_iterator& __y) {
+ return __x.__i_ != __y.__i_;
+ }
#endif
- template <class, class, class, class, class> friend class _LIBCPP_TEMPLATE_VIS unordered_map;
- template <class, class, class, class, class> friend class _LIBCPP_TEMPLATE_VIS unordered_multimap;
- template <class> friend class _LIBCPP_TEMPLATE_VIS __hash_const_iterator;
- template <class> friend class _LIBCPP_TEMPLATE_VIS __hash_const_local_iterator;
- template <class> friend class _LIBCPP_TEMPLATE_VIS __hash_map_const_iterator;
+ template <class, class, class, class, class>
+ friend class _LIBCPP_TEMPLATE_VIS unordered_map;
+ template <class, class, class, class, class>
+ friend class _LIBCPP_TEMPLATE_VIS unordered_multimap;
+ template <class>
+ friend class _LIBCPP_TEMPLATE_VIS __hash_const_iterator;
+ template <class>
+ friend class _LIBCPP_TEMPLATE_VIS __hash_const_local_iterator;
+ template <class>
+ friend class _LIBCPP_TEMPLATE_VIS __hash_map_const_iterator;
};
template <class _HashIterator>
-class _LIBCPP_TEMPLATE_VIS __hash_map_const_iterator
-{
- _HashIterator __i_;
+class _LIBCPP_TEMPLATE_VIS __hash_map_const_iterator {
+ _HashIterator __i_;
- typedef __hash_node_types_from_iterator<_HashIterator> _NodeTypes;
+ typedef __hash_node_types_from_iterator<_HashIterator> _NodeTypes;
public:
- typedef forward_iterator_tag iterator_category;
- typedef typename _NodeTypes::__map_value_type value_type;
- typedef typename _NodeTypes::difference_type difference_type;
- typedef const value_type& reference;
- typedef typename _NodeTypes::__const_map_value_type_pointer pointer;
-
- _LIBCPP_HIDE_FROM_ABI
- __hash_map_const_iterator() _NOEXCEPT {}
-
- _LIBCPP_HIDE_FROM_ABI
- __hash_map_const_iterator(_HashIterator __i) _NOEXCEPT : __i_(__i) {}
- _LIBCPP_HIDE_FROM_ABI
- __hash_map_const_iterator(
- __hash_map_iterator<typename _HashIterator::__non_const_iterator> __i)
- _NOEXCEPT
- : __i_(__i.__i_) {}
-
- _LIBCPP_HIDE_FROM_ABI
- reference operator*() const {return __i_->__get_value();}
- _LIBCPP_HIDE_FROM_ABI
- pointer operator->() const {return pointer_traits<pointer>::pointer_to(__i_->__get_value());}
-
- _LIBCPP_HIDE_FROM_ABI
- __hash_map_const_iterator& operator++() {++__i_; return *this;}
- _LIBCPP_HIDE_FROM_ABI
- __hash_map_const_iterator operator++(int)
- {
- __hash_map_const_iterator __t(*this);
- ++(*this);
- return __t;
- }
+ typedef forward_iterator_tag iterator_category;
+ typedef typename _NodeTypes::__map_value_type value_type;
+ typedef typename _NodeTypes::difference_type difference_type;
+ typedef const value_type& reference;
+ typedef typename _NodeTypes::__const_map_value_type_pointer pointer;
+
+ _LIBCPP_HIDE_FROM_ABI __hash_map_const_iterator() _NOEXCEPT {}
+
+ _LIBCPP_HIDE_FROM_ABI __hash_map_const_iterator(_HashIterator __i) _NOEXCEPT : __i_(__i) {}
+ _LIBCPP_HIDE_FROM_ABI
+ __hash_map_const_iterator(__hash_map_iterator<typename _HashIterator::__non_const_iterator> __i) _NOEXCEPT
+ : __i_(__i.__i_) {}
+
+ _LIBCPP_HIDE_FROM_ABI reference operator*() const { return __i_->__get_value(); }
+ _LIBCPP_HIDE_FROM_ABI pointer operator->() const { return pointer_traits<pointer>::pointer_to(__i_->__get_value()); }
- friend _LIBCPP_HIDE_FROM_ABI
- bool operator==(const __hash_map_const_iterator& __x, const __hash_map_const_iterator& __y)
- {return __x.__i_ == __y.__i_;}
+ _LIBCPP_HIDE_FROM_ABI __hash_map_const_iterator& operator++() {
+ ++__i_;
+ return *this;
+ }
+ _LIBCPP_HIDE_FROM_ABI __hash_map_const_iterator operator++(int) {
+ __hash_map_const_iterator __t(*this);
+ ++(*this);
+ return __t;
+ }
+
+ friend _LIBCPP_HIDE_FROM_ABI bool
+ operator==(const __hash_map_const_iterator& __x, const __hash_map_const_iterator& __y) {
+ return __x.__i_ == __y.__i_;
+ }
#if _LIBCPP_STD_VER <= 17
- friend _LIBCPP_HIDE_FROM_ABI
- bool operator!=(const __hash_map_const_iterator& __x, const __hash_map_const_iterator& __y)
- {return __x.__i_ != __y.__i_;}
+ friend _LIBCPP_HIDE_FROM_ABI bool
+ operator!=(const __hash_map_const_iterator& __x, const __hash_map_const_iterator& __y) {
+ return __x.__i_ != __y.__i_;
+ }
#endif
- template <class, class, class, class, class> friend class _LIBCPP_TEMPLATE_VIS unordered_map;
- template <class, class, class, class, class> friend class _LIBCPP_TEMPLATE_VIS unordered_multimap;
- template <class> friend class _LIBCPP_TEMPLATE_VIS __hash_const_iterator;
- template <class> friend class _LIBCPP_TEMPLATE_VIS __hash_const_local_iterator;
+ template <class, class, class, class, class>
+ friend class _LIBCPP_TEMPLATE_VIS unordered_map;
+ template <class, class, class, class, class>
+ friend class _LIBCPP_TEMPLATE_VIS unordered_multimap;
+ template <class>
+ friend class _LIBCPP_TEMPLATE_VIS __hash_const_iterator;
+ template <class>
+ friend class _LIBCPP_TEMPLATE_VIS __hash_const_local_iterator;
};
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
class unordered_multimap;
-template <class _Key, class _Tp, class _Hash = hash<_Key>, class _Pred = equal_to<_Key>,
+template <class _Key,
+ class _Tp,
+ class _Hash = hash<_Key>,
+ class _Pred = equal_to<_Key>,
class _Alloc = allocator<pair<const _Key, _Tp> > >
-class _LIBCPP_TEMPLATE_VIS unordered_map
-{
+class _LIBCPP_TEMPLATE_VIS unordered_map {
public:
- // types
- typedef _Key key_type;
- typedef _Tp mapped_type;
- typedef __type_identity_t<_Hash> hasher;
- typedef __type_identity_t<_Pred> key_equal;
- typedef __type_identity_t<_Alloc> allocator_type;
- typedef pair<const key_type, mapped_type> value_type;
- typedef value_type& reference;
- typedef const value_type& const_reference;
- static_assert((is_same<value_type, typename allocator_type::value_type>::value),
- "Allocator::value_type must be same type as value_type");
+ // types
+ typedef _Key key_type;
+ typedef _Tp mapped_type;
+ typedef __type_identity_t<_Hash> hasher;
+ typedef __type_identity_t<_Pred> key_equal;
+ typedef __type_identity_t<_Alloc> allocator_type;
+ typedef pair<const key_type, mapped_type> value_type;
+ typedef value_type& reference;
+ typedef const value_type& const_reference;
+ static_assert((is_same<value_type, typename allocator_type::value_type>::value),
+ "Allocator::value_type must be same type as value_type");
private:
- typedef __hash_value_type<key_type, mapped_type> __value_type;
- typedef __unordered_map_hasher<key_type, __value_type, hasher, key_equal> __hasher;
- typedef __unordered_map_equal<key_type, __value_type, key_equal, hasher> __key_equal;
- typedef __rebind_alloc<allocator_traits<allocator_type>, __value_type> __allocator_type;
-
- typedef __hash_table<__value_type, __hasher,
- __key_equal, __allocator_type> __table;
-
- __table __table_;
-
- typedef typename __table::_NodeTypes _NodeTypes;
- typedef typename __table::__node_pointer __node_pointer;
- typedef typename __table::__node_const_pointer __node_const_pointer;
- typedef typename __table::__node_traits __node_traits;
- typedef typename __table::__node_allocator __node_allocator;
- typedef typename __table::__node __node;
- typedef __hash_map_node_destructor<__node_allocator> _Dp;
- typedef unique_ptr<__node, _Dp> __node_holder;
- typedef allocator_traits<allocator_type> __alloc_traits;
-
- static_assert(is_same<allocator_type, __rebind_alloc<__alloc_traits, value_type> >::value,
- "[allocator.requirements] states that rebinding an allocator to the same type should result in the "
- "original allocator");
-
- static_assert((is_same<typename __table::__container_value_type, value_type>::value), "");
- static_assert((is_same<typename __table::__node_value_type, __value_type>::value), "");
+ typedef __hash_value_type<key_type, mapped_type> __value_type;
+ typedef __unordered_map_hasher<key_type, __value_type, hasher, key_equal> __hasher;
+ typedef __unordered_map_equal<key_type, __value_type, key_equal, hasher> __key_equal;
+ typedef __rebind_alloc<allocator_traits<allocator_type>, __value_type> __allocator_type;
+
+ typedef __hash_table<__value_type, __hasher, __key_equal, __allocator_type> __table;
+
+ __table __table_;
+
+ typedef typename __table::_NodeTypes _NodeTypes;
+ typedef typename __table::__node_pointer __node_pointer;
+ typedef typename __table::__node_const_pointer __node_const_pointer;
+ typedef typename __table::__node_traits __node_traits;
+ typedef typename __table::__node_allocator __node_allocator;
+ typedef typename __table::__node __node;
+ typedef __hash_map_node_destructor<__node_allocator> _Dp;
+ typedef unique_ptr<__node, _Dp> __node_holder;
+ typedef allocator_traits<allocator_type> __alloc_traits;
+
+ static_assert(is_same<allocator_type, __rebind_alloc<__alloc_traits, value_type> >::value,
+ "[allocator.requirements] states that rebinding an allocator to the same type should result in the "
+ "original allocator");
+
+ static_assert((is_same<typename __table::__container_value_type, value_type>::value), "");
+ static_assert((is_same<typename __table::__node_value_type, __value_type>::value), "");
+
public:
- typedef typename __alloc_traits::pointer pointer;
- typedef typename __alloc_traits::const_pointer const_pointer;
- typedef typename __table::size_type size_type;
- typedef typename __table::difference_type difference_type;
+ typedef typename __alloc_traits::pointer pointer;
+ typedef typename __alloc_traits::const_pointer const_pointer;
+ typedef typename __table::size_type size_type;
+ typedef typename __table::difference_type difference_type;
- typedef __hash_map_iterator<typename __table::iterator> iterator;
- typedef __hash_map_const_iterator<typename __table::const_iterator> const_iterator;
- typedef __hash_map_iterator<typename __table::local_iterator> local_iterator;
- typedef __hash_map_const_iterator<typename __table::const_local_iterator> const_local_iterator;
+ typedef __hash_map_iterator<typename __table::iterator> iterator;
+ typedef __hash_map_const_iterator<typename __table::const_iterator> const_iterator;
+ typedef __hash_map_iterator<typename __table::local_iterator> local_iterator;
+ typedef __hash_map_const_iterator<typename __table::const_local_iterator> const_local_iterator;
#if _LIBCPP_STD_VER >= 17
- typedef __map_node_handle<__node, allocator_type> node_type;
- typedef __insert_return_type<iterator, node_type> insert_return_type;
+ typedef __map_node_handle<__node, allocator_type> node_type;
+ typedef __insert_return_type<iterator, node_type> insert_return_type;
#endif
- template <class _Key2, class _Tp2, class _Hash2, class _Pred2, class _Alloc2>
- friend class _LIBCPP_TEMPLATE_VIS unordered_map;
- template <class _Key2, class _Tp2, class _Hash2, class _Pred2, class _Alloc2>
- friend class _LIBCPP_TEMPLATE_VIS unordered_multimap;
-
- _LIBCPP_HIDE_FROM_ABI
- unordered_map()
- _NOEXCEPT_(is_nothrow_default_constructible<__table>::value)
- {
- }
- explicit _LIBCPP_HIDE_FROM_ABI unordered_map(size_type __n, const hasher& __hf = hasher(),
- const key_equal& __eql = key_equal());
- _LIBCPP_HIDE_FROM_ABI unordered_map(size_type __n, const hasher& __hf,
- const key_equal& __eql,
- const allocator_type& __a);
- template <class _InputIterator>
- _LIBCPP_HIDE_FROM_ABI unordered_map(_InputIterator __first, _InputIterator __last);
- template <class _InputIterator>
- _LIBCPP_HIDE_FROM_ABI unordered_map(_InputIterator __first, _InputIterator __last,
- size_type __n, const hasher& __hf = hasher(),
- const key_equal& __eql = key_equal());
- template <class _InputIterator>
- _LIBCPP_HIDE_FROM_ABI unordered_map(_InputIterator __first, _InputIterator __last,
- size_type __n, const hasher& __hf,
- const key_equal& __eql,
- const allocator_type& __a);
+ template <class _Key2, class _Tp2, class _Hash2, class _Pred2, class _Alloc2>
+ friend class _LIBCPP_TEMPLATE_VIS unordered_map;
+ template <class _Key2, class _Tp2, class _Hash2, class _Pred2, class _Alloc2>
+ friend class _LIBCPP_TEMPLATE_VIS unordered_multimap;
+
+ _LIBCPP_HIDE_FROM_ABI unordered_map() _NOEXCEPT_(is_nothrow_default_constructible<__table>::value) {}
+ explicit _LIBCPP_HIDE_FROM_ABI
+ unordered_map(size_type __n, const hasher& __hf = hasher(), const key_equal& __eql = key_equal());
+ _LIBCPP_HIDE_FROM_ABI
+ unordered_map(size_type __n, const hasher& __hf, const key_equal& __eql, const allocator_type& __a);
+ template <class _InputIterator>
+ _LIBCPP_HIDE_FROM_ABI unordered_map(_InputIterator __first, _InputIterator __last);
+ template <class _InputIterator>
+ _LIBCPP_HIDE_FROM_ABI
+ unordered_map(_InputIterator __first,
+ _InputIterator __last,
+ size_type __n,
+ const hasher& __hf = hasher(),
+ const key_equal& __eql = key_equal());
+ template <class _InputIterator>
+ _LIBCPP_HIDE_FROM_ABI unordered_map(
+ _InputIterator __first,
+ _InputIterator __last,
+ size_type __n,
+ const hasher& __hf,
+ const key_equal& __eql,
+ const allocator_type& __a);
#if _LIBCPP_STD_VER >= 23
- template <_ContainerCompatibleRange<value_type> _Range>
- _LIBCPP_HIDE_FROM_ABI
- unordered_map(from_range_t, _Range&& __range, size_type __n = /*implementation-defined*/0,
- const hasher& __hf = hasher(), const key_equal& __eql = key_equal(),
- const allocator_type& __a = allocator_type())
- : __table_(__hf, __eql, typename __table::allocator_type(__a)) {
- if (__n > 0) {
- __table_.__rehash_unique(__n);
- }
- insert_range(std::forward<_Range>(__range));
+ template <_ContainerCompatibleRange<value_type> _Range>
+ _LIBCPP_HIDE_FROM_ABI unordered_map(
+ from_range_t,
+ _Range&& __range,
+ size_type __n = /*implementation-defined*/ 0,
+ const hasher& __hf = hasher(),
+ const key_equal& __eql = key_equal(),
+ const allocator_type& __a = allocator_type())
+ : __table_(__hf, __eql, typename __table::allocator_type(__a)) {
+ if (__n > 0) {
+ __table_.__rehash_unique(__n);
}
+ insert_range(std::forward<_Range>(__range));
+ }
#endif
- _LIBCPP_HIDE_FROM_ABI
- explicit unordered_map(const allocator_type& __a);
- _LIBCPP_HIDE_FROM_ABI unordered_map(const unordered_map& __u);
- _LIBCPP_HIDE_FROM_ABI unordered_map(const unordered_map& __u, const allocator_type& __a);
+ _LIBCPP_HIDE_FROM_ABI explicit unordered_map(const allocator_type& __a);
+ _LIBCPP_HIDE_FROM_ABI unordered_map(const unordered_map& __u);
+ _LIBCPP_HIDE_FROM_ABI unordered_map(const unordered_map& __u, const allocator_type& __a);
#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI
- unordered_map(unordered_map&& __u)
- _NOEXCEPT_(is_nothrow_move_constructible<__table>::value);
- _LIBCPP_HIDE_FROM_ABI unordered_map(unordered_map&& __u, const allocator_type& __a);
- _LIBCPP_HIDE_FROM_ABI unordered_map(initializer_list<value_type> __il);
- _LIBCPP_HIDE_FROM_ABI unordered_map(initializer_list<value_type> __il, size_type __n,
- const hasher& __hf = hasher(), const key_equal& __eql = key_equal());
- _LIBCPP_HIDE_FROM_ABI unordered_map(initializer_list<value_type> __il, size_type __n,
- const hasher& __hf, const key_equal& __eql,
- const allocator_type& __a);
+ _LIBCPP_HIDE_FROM_ABI unordered_map(unordered_map&& __u) _NOEXCEPT_(is_nothrow_move_constructible<__table>::value);
+ _LIBCPP_HIDE_FROM_ABI unordered_map(unordered_map&& __u, const allocator_type& __a);
+ _LIBCPP_HIDE_FROM_ABI unordered_map(initializer_list<value_type> __il);
+ _LIBCPP_HIDE_FROM_ABI
+ unordered_map(initializer_list<value_type> __il,
+ size_type __n,
+ const hasher& __hf = hasher(),
+ const key_equal& __eql = key_equal());
+ _LIBCPP_HIDE_FROM_ABI unordered_map(
+ initializer_list<value_type> __il,
+ size_type __n,
+ const hasher& __hf,
+ const key_equal& __eql,
+ const allocator_type& __a);
#endif // _LIBCPP_CXX03_LANG
#if _LIBCPP_STD_VER >= 14
- _LIBCPP_HIDE_FROM_ABI
- unordered_map(size_type __n, const allocator_type& __a)
+ _LIBCPP_HIDE_FROM_ABI unordered_map(size_type __n, const allocator_type& __a)
: unordered_map(__n, hasher(), key_equal(), __a) {}
- _LIBCPP_HIDE_FROM_ABI
- unordered_map(size_type __n, const hasher& __hf, const allocator_type& __a)
+ _LIBCPP_HIDE_FROM_ABI unordered_map(size_type __n, const hasher& __hf, const allocator_type& __a)
: unordered_map(__n, __hf, key_equal(), __a) {}
- template <class _InputIterator>
- _LIBCPP_HIDE_FROM_ABI
- unordered_map(_InputIterator __first, _InputIterator __last, size_type __n, const allocator_type& __a)
+ template <class _InputIterator>
+ _LIBCPP_HIDE_FROM_ABI
+ unordered_map(_InputIterator __first, _InputIterator __last, size_type __n, const allocator_type& __a)
: unordered_map(__first, __last, __n, hasher(), key_equal(), __a) {}
- template <class _InputIterator>
- _LIBCPP_HIDE_FROM_ABI
- unordered_map(_InputIterator __first, _InputIterator __last, size_type __n, const hasher& __hf,
- const allocator_type& __a)
+ template <class _InputIterator>
+ _LIBCPP_HIDE_FROM_ABI unordered_map(
+ _InputIterator __first, _InputIterator __last, size_type __n, const hasher& __hf, const allocator_type& __a)
: unordered_map(__first, __last, __n, __hf, key_equal(), __a) {}
-#if _LIBCPP_STD_VER >= 23
- template <_ContainerCompatibleRange<value_type> _Range>
- _LIBCPP_HIDE_FROM_ABI
- unordered_map(from_range_t, _Range&& __range, size_type __n, const allocator_type& __a)
- : unordered_map(from_range, std::forward<_Range>(__range), __n, hasher(), key_equal(), __a) {}
-
- template <_ContainerCompatibleRange<value_type> _Range>
- _LIBCPP_HIDE_FROM_ABI
- unordered_map(from_range_t, _Range&& __range, size_type __n, const hasher& __hf, const allocator_type& __a)
- : unordered_map(from_range, std::forward<_Range>(__range), __n, __hf, key_equal(), __a) {}
-#endif
+# if _LIBCPP_STD_VER >= 23
+ template <_ContainerCompatibleRange<value_type> _Range>
+ _LIBCPP_HIDE_FROM_ABI unordered_map(from_range_t, _Range&& __range, size_type __n, const allocator_type& __a)
+ : unordered_map(from_range, std::forward<_Range>(__range), __n, hasher(), key_equal(), __a) {}
- _LIBCPP_HIDE_FROM_ABI
- unordered_map(initializer_list<value_type> __il, size_type __n, const allocator_type& __a)
+ template <_ContainerCompatibleRange<value_type> _Range>
+ _LIBCPP_HIDE_FROM_ABI
+ unordered_map(from_range_t, _Range&& __range, size_type __n, const hasher& __hf, const allocator_type& __a)
+ : unordered_map(from_range, std::forward<_Range>(__range), __n, __hf, key_equal(), __a) {}
+# endif
+
+ _LIBCPP_HIDE_FROM_ABI unordered_map(initializer_list<value_type> __il, size_type __n, const allocator_type& __a)
: unordered_map(__il, __n, hasher(), key_equal(), __a) {}
- _LIBCPP_HIDE_FROM_ABI
- unordered_map(initializer_list<value_type> __il, size_type __n, const hasher& __hf,
- const allocator_type& __a)
+ _LIBCPP_HIDE_FROM_ABI
+ unordered_map(initializer_list<value_type> __il, size_type __n, const hasher& __hf, const allocator_type& __a)
: unordered_map(__il, __n, __hf, key_equal(), __a) {}
#endif
- _LIBCPP_HIDE_FROM_ABI
- ~unordered_map() {
- static_assert(sizeof(std::__diagnose_unordered_container_requirements<_Key, _Hash, _Pred>(0)), "");
- }
+ _LIBCPP_HIDE_FROM_ABI ~unordered_map() {
+ static_assert(sizeof(std::__diagnose_unordered_container_requirements<_Key, _Hash, _Pred>(0)), "");
+ }
- _LIBCPP_HIDE_FROM_ABI
- unordered_map& operator=(const unordered_map& __u)
- {
+ _LIBCPP_HIDE_FROM_ABI unordered_map& operator=(const unordered_map& __u) {
#ifndef _LIBCPP_CXX03_LANG
- __table_ = __u.__table_;
+ __table_ = __u.__table_;
#else
- if (this != std::addressof(__u)) {
- __table_.clear();
- __table_.hash_function() = __u.__table_.hash_function();
- __table_.key_eq() = __u.__table_.key_eq();
- __table_.max_load_factor() = __u.__table_.max_load_factor();
- __table_.__copy_assign_alloc(__u.__table_);
- insert(__u.begin(), __u.end());
- }
-#endif
- return *this;
+ if (this != std::addressof(__u)) {
+ __table_.clear();
+ __table_.hash_function() = __u.__table_.hash_function();
+ __table_.key_eq() = __u.__table_.key_eq();
+ __table_.max_load_factor() = __u.__table_.max_load_factor();
+ __table_.__copy_assign_alloc(__u.__table_);
+ insert(__u.begin(), __u.end());
}
+#endif
+ return *this;
+ }
#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI
- unordered_map& operator=(unordered_map&& __u)
- _NOEXCEPT_(is_nothrow_move_assignable<__table>::value);
- _LIBCPP_HIDE_FROM_ABI
- unordered_map& operator=(initializer_list<value_type> __il);
+ _LIBCPP_HIDE_FROM_ABI unordered_map& operator=(unordered_map&& __u)
+ _NOEXCEPT_(is_nothrow_move_assignable<__table>::value);
+ _LIBCPP_HIDE_FROM_ABI unordered_map& operator=(initializer_list<value_type> __il);
#endif // _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI
- allocator_type get_allocator() const _NOEXCEPT
- {return allocator_type(__table_.__node_alloc());}
-
- _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_HIDE_FROM_ABI
- bool empty() const _NOEXCEPT {return __table_.size() == 0;}
- _LIBCPP_HIDE_FROM_ABI
- size_type size() const _NOEXCEPT {return __table_.size();}
- _LIBCPP_HIDE_FROM_ABI
- size_type max_size() const _NOEXCEPT {return __table_.max_size();}
-
- _LIBCPP_HIDE_FROM_ABI
- iterator begin() _NOEXCEPT {return __table_.begin();}
- _LIBCPP_HIDE_FROM_ABI
- iterator end() _NOEXCEPT {return __table_.end();}
- _LIBCPP_HIDE_FROM_ABI
- const_iterator begin() const _NOEXCEPT {return __table_.begin();}
- _LIBCPP_HIDE_FROM_ABI
- const_iterator end() const _NOEXCEPT {return __table_.end();}
- _LIBCPP_HIDE_FROM_ABI
- const_iterator cbegin() const _NOEXCEPT {return __table_.begin();}
- _LIBCPP_HIDE_FROM_ABI
- const_iterator cend() const _NOEXCEPT {return __table_.end();}
-
- _LIBCPP_HIDE_FROM_ABI
- pair<iterator, bool> insert(const value_type& __x)
- {return __table_.__insert_unique(__x);}
-
- _LIBCPP_HIDE_FROM_ABI iterator insert(const_iterator, const value_type& __x) {
- return insert(__x).first;
- }
+ _LIBCPP_HIDE_FROM_ABI allocator_type get_allocator() const _NOEXCEPT {
+ return allocator_type(__table_.__node_alloc());
+ }
+
+ _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_HIDE_FROM_ABI bool empty() const _NOEXCEPT { return __table_.size() == 0; }
+ _LIBCPP_HIDE_FROM_ABI size_type size() const _NOEXCEPT { return __table_.size(); }
+ _LIBCPP_HIDE_FROM_ABI size_type max_size() const _NOEXCEPT { return __table_.max_size(); }
+
+ _LIBCPP_HIDE_FROM_ABI iterator begin() _NOEXCEPT { return __table_.begin(); }
+ _LIBCPP_HIDE_FROM_ABI iterator end() _NOEXCEPT { return __table_.end(); }
+ _LIBCPP_HIDE_FROM_ABI const_iterator begin() const _NOEXCEPT { return __table_.begin(); }
+ _LIBCPP_HIDE_FROM_ABI const_iterator end() const _NOEXCEPT { return __table_.end(); }
+ _LIBCPP_HIDE_FROM_ABI const_iterator cbegin() const _NOEXCEPT { return __table_.begin(); }
+ _LIBCPP_HIDE_FROM_ABI const_iterator cend() const _NOEXCEPT { return __table_.end(); }
+
+ _LIBCPP_HIDE_FROM_ABI pair<iterator, bool> insert(const value_type& __x) { return __table_.__insert_unique(__x); }
+
+ _LIBCPP_HIDE_FROM_ABI iterator insert(const_iterator, const value_type& __x) { return insert(__x).first; }
- template <class _InputIterator>
- _LIBCPP_HIDE_FROM_ABI
- void insert(_InputIterator __first, _InputIterator __last);
+ template <class _InputIterator>
+ _LIBCPP_HIDE_FROM_ABI void insert(_InputIterator __first, _InputIterator __last);
#if _LIBCPP_STD_VER >= 23
- template <_ContainerCompatibleRange<value_type> _Range>
- _LIBCPP_HIDE_FROM_ABI
- void insert_range(_Range&& __range) {
- for (auto&& __element : __range) {
- __table_.__insert_unique(std::forward<decltype(__element)>(__element));
- }
+ template <_ContainerCompatibleRange<value_type> _Range>
+ _LIBCPP_HIDE_FROM_ABI void insert_range(_Range&& __range) {
+ for (auto&& __element : __range) {
+ __table_.__insert_unique(std::forward<decltype(__element)>(__element));
}
+ }
#endif
#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI
- void insert(initializer_list<value_type> __il)
- {insert(__il.begin(), __il.end());}
+ _LIBCPP_HIDE_FROM_ABI void insert(initializer_list<value_type> __il) { insert(__il.begin(), __il.end()); }
- _LIBCPP_HIDE_FROM_ABI
- pair<iterator, bool> insert(value_type&& __x)
- {return __table_.__insert_unique(std::move(__x));}
+ _LIBCPP_HIDE_FROM_ABI pair<iterator, bool> insert(value_type&& __x) {
+ return __table_.__insert_unique(std::move(__x));
+ }
- _LIBCPP_HIDE_FROM_ABI iterator insert(const_iterator, value_type&& __x) {
- return __table_.__insert_unique(std::move(__x)).first;
- }
-
- template <class _Pp,
- class = __enable_if_t<is_constructible<value_type, _Pp>::value> >
- _LIBCPP_HIDE_FROM_ABI
- pair<iterator, bool> insert(_Pp&& __x)
- {return __table_.__insert_unique(std::forward<_Pp>(__x));}
-
- template <class _Pp,
- class = __enable_if_t<is_constructible<value_type, _Pp>::value> >
- _LIBCPP_HIDE_FROM_ABI
- iterator insert(const_iterator, _Pp&& __x)
- {
- return insert(std::forward<_Pp>(__x)).first;
- }
-
- template <class... _Args>
- _LIBCPP_HIDE_FROM_ABI
- pair<iterator, bool> emplace(_Args&&... __args) {
- return __table_.__emplace_unique(std::forward<_Args>(__args)...);
- }
-
- template <class... _Args>
- _LIBCPP_HIDE_FROM_ABI
- iterator emplace_hint(const_iterator, _Args&&... __args) {
- return __table_.__emplace_unique(std::forward<_Args>(__args)...).first;
- }
+ _LIBCPP_HIDE_FROM_ABI iterator insert(const_iterator, value_type&& __x) {
+ return __table_.__insert_unique(std::move(__x)).first;
+ }
-#endif // _LIBCPP_CXX03_LANG
+ template <class _Pp, class = __enable_if_t<is_constructible<value_type, _Pp>::value> >
+ _LIBCPP_HIDE_FROM_ABI pair<iterator, bool> insert(_Pp&& __x) {
+ return __table_.__insert_unique(std::forward<_Pp>(__x));
+ }
-#if _LIBCPP_STD_VER >= 17
- template <class... _Args>
- _LIBCPP_HIDE_FROM_ABI
- pair<iterator, bool> try_emplace(const key_type& __k, _Args&&... __args)
- {
- return __table_.__emplace_unique_key_args(__k, piecewise_construct,
- std::forward_as_tuple(__k),
- std::forward_as_tuple(std::forward<_Args>(__args)...));
- }
+ template <class _Pp, class = __enable_if_t<is_constructible<value_type, _Pp>::value> >
+ _LIBCPP_HIDE_FROM_ABI iterator insert(const_iterator, _Pp&& __x) {
+ return insert(std::forward<_Pp>(__x)).first;
+ }
- template <class... _Args>
- _LIBCPP_HIDE_FROM_ABI
- pair<iterator, bool> try_emplace(key_type&& __k, _Args&&... __args)
- {
- return __table_.__emplace_unique_key_args(__k, piecewise_construct,
- std::forward_as_tuple(std::move(__k)),
- std::forward_as_tuple(std::forward<_Args>(__args)...));
- }
+ template <class... _Args>
+ _LIBCPP_HIDE_FROM_ABI pair<iterator, bool> emplace(_Args&&... __args) {
+ return __table_.__emplace_unique(std::forward<_Args>(__args)...);
+ }
- template <class... _Args>
- _LIBCPP_HIDE_FROM_ABI
- iterator try_emplace(const_iterator, const key_type& __k, _Args&&... __args)
- {
- return try_emplace(__k, std::forward<_Args>(__args)...).first;
- }
+ template <class... _Args>
+ _LIBCPP_HIDE_FROM_ABI iterator emplace_hint(const_iterator, _Args&&... __args) {
+ return __table_.__emplace_unique(std::forward<_Args>(__args)...).first;
+ }
- template <class... _Args>
- _LIBCPP_HIDE_FROM_ABI
- iterator try_emplace(const_iterator, key_type&& __k, _Args&&... __args)
- {
- return try_emplace(std::move(__k), std::forward<_Args>(__args)...).first;
- }
+#endif // _LIBCPP_CXX03_LANG
- template <class _Vp>
- _LIBCPP_HIDE_FROM_ABI
- pair<iterator, bool> insert_or_assign(const key_type& __k, _Vp&& __v)
- {
- pair<iterator, bool> __res = __table_.__emplace_unique_key_args(__k,
- __k, std::forward<_Vp>(__v));
- if (!__res.second) {
- __res.first->second = std::forward<_Vp>(__v);
- }
- return __res;
+#if _LIBCPP_STD_VER >= 17
+ template <class... _Args>
+ _LIBCPP_HIDE_FROM_ABI pair<iterator, bool> try_emplace(const key_type& __k, _Args&&... __args) {
+ return __table_.__emplace_unique_key_args(
+ __k, piecewise_construct, std::forward_as_tuple(__k), std::forward_as_tuple(std::forward<_Args>(__args)...));
+ }
+
+ template <class... _Args>
+ _LIBCPP_HIDE_FROM_ABI pair<iterator, bool> try_emplace(key_type&& __k, _Args&&... __args) {
+ return __table_.__emplace_unique_key_args(
+ __k,
+ piecewise_construct,
+ std::forward_as_tuple(std::move(__k)),
+ std::forward_as_tuple(std::forward<_Args>(__args)...));
+ }
+
+ template <class... _Args>
+ _LIBCPP_HIDE_FROM_ABI iterator try_emplace(const_iterator, const key_type& __k, _Args&&... __args) {
+ return try_emplace(__k, std::forward<_Args>(__args)...).first;
+ }
+
+ template <class... _Args>
+ _LIBCPP_HIDE_FROM_ABI iterator try_emplace(const_iterator, key_type&& __k, _Args&&... __args) {
+ return try_emplace(std::move(__k), std::forward<_Args>(__args)...).first;
+ }
+
+ template <class _Vp>
+ _LIBCPP_HIDE_FROM_ABI pair<iterator, bool> insert_or_assign(const key_type& __k, _Vp&& __v) {
+ pair<iterator, bool> __res = __table_.__emplace_unique_key_args(__k, __k, std::forward<_Vp>(__v));
+ if (!__res.second) {
+ __res.first->second = std::forward<_Vp>(__v);
}
-
- template <class _Vp>
- _LIBCPP_HIDE_FROM_ABI
- pair<iterator, bool> insert_or_assign(key_type&& __k, _Vp&& __v)
- {
- pair<iterator, bool> __res = __table_.__emplace_unique_key_args(__k,
- std::move(__k), std::forward<_Vp>(__v));
- if (!__res.second) {
- __res.first->second = std::forward<_Vp>(__v);
- }
- return __res;
+ return __res;
+ }
+
+ template <class _Vp>
+ _LIBCPP_HIDE_FROM_ABI pair<iterator, bool> insert_or_assign(key_type&& __k, _Vp&& __v) {
+ pair<iterator, bool> __res = __table_.__emplace_unique_key_args(__k, std::move(__k), std::forward<_Vp>(__v));
+ if (!__res.second) {
+ __res.first->second = std::forward<_Vp>(__v);
}
-
- template <class _Vp>
- _LIBCPP_HIDE_FROM_ABI
- iterator insert_or_assign(const_iterator, const key_type& __k, _Vp&& __v)
- {
- return insert_or_assign(__k, std::forward<_Vp>(__v)).first;
- }
-
- template <class _Vp>
- _LIBCPP_HIDE_FROM_ABI
- iterator insert_or_assign(const_iterator, key_type&& __k, _Vp&& __v)
- {
- return insert_or_assign(std::move(__k), std::forward<_Vp>(__v)).first;
- }
+ return __res;
+ }
+
+ template <class _Vp>
+ _LIBCPP_HIDE_FROM_ABI iterator insert_or_assign(const_iterator, const key_type& __k, _Vp&& __v) {
+ return insert_or_assign(__k, std::forward<_Vp>(__v)).first;
+ }
+
+ template <class _Vp>
+ _LIBCPP_HIDE_FROM_ABI iterator insert_or_assign(const_iterator, key_type&& __k, _Vp&& __v) {
+ return insert_or_assign(std::move(__k), std::forward<_Vp>(__v)).first;
+ }
#endif // _LIBCPP_STD_VER >= 17
- _LIBCPP_HIDE_FROM_ABI
- iterator erase(const_iterator __p) {return __table_.erase(__p.__i_);}
- _LIBCPP_HIDE_FROM_ABI
- iterator erase(iterator __p) {return __table_.erase(__p.__i_);}
- _LIBCPP_HIDE_FROM_ABI
- size_type erase(const key_type& __k) {return __table_.__erase_unique(__k);}
- _LIBCPP_HIDE_FROM_ABI
- iterator erase(const_iterator __first, const_iterator __last)
- {return __table_.erase(__first.__i_, __last.__i_);}
- _LIBCPP_HIDE_FROM_ABI
- void clear() _NOEXCEPT {__table_.clear();}
+ _LIBCPP_HIDE_FROM_ABI iterator erase(const_iterator __p) { return __table_.erase(__p.__i_); }
+ _LIBCPP_HIDE_FROM_ABI iterator erase(iterator __p) { return __table_.erase(__p.__i_); }
+ _LIBCPP_HIDE_FROM_ABI size_type erase(const key_type& __k) { return __table_.__erase_unique(__k); }
+ _LIBCPP_HIDE_FROM_ABI iterator erase(const_iterator __first, const_iterator __last) {
+ return __table_.erase(__first.__i_, __last.__i_);
+ }
+ _LIBCPP_HIDE_FROM_ABI void clear() _NOEXCEPT { __table_.clear(); }
#if _LIBCPP_STD_VER >= 17
- _LIBCPP_HIDE_FROM_ABI
- insert_return_type insert(node_type&& __nh)
- {
- _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(__nh.empty() || __nh.get_allocator() == get_allocator(),
- "node_type with incompatible allocator passed to unordered_map::insert()");
- return __table_.template __node_handle_insert_unique<
- node_type, insert_return_type>(std::move(__nh));
- }
- _LIBCPP_HIDE_FROM_ABI
- iterator insert(const_iterator __hint, node_type&& __nh)
- {
- _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(__nh.empty() || __nh.get_allocator() == get_allocator(),
- "node_type with incompatible allocator passed to unordered_map::insert()");
- return __table_.template __node_handle_insert_unique<node_type>(
- __hint.__i_, std::move(__nh));
- }
- _LIBCPP_HIDE_FROM_ABI
- node_type extract(key_type const& __key)
- {
- return __table_.template __node_handle_extract<node_type>(__key);
- }
- _LIBCPP_HIDE_FROM_ABI
- node_type extract(const_iterator __it)
- {
- return __table_.template __node_handle_extract<node_type>(
- __it.__i_);
- }
-
- template <class _H2, class _P2>
- _LIBCPP_HIDE_FROM_ABI
- void merge(unordered_map<key_type, mapped_type, _H2, _P2, allocator_type>& __source)
- {
- _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(__source.get_allocator() == get_allocator(),
- "merging container with incompatible allocator");
- return __table_.__node_handle_merge_unique(__source.__table_);
- }
- template <class _H2, class _P2>
- _LIBCPP_HIDE_FROM_ABI
- void merge(unordered_map<key_type, mapped_type, _H2, _P2, allocator_type>&& __source)
- {
- _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(__source.get_allocator() == get_allocator(),
- "merging container with incompatible allocator");
- return __table_.__node_handle_merge_unique(__source.__table_);
- }
- template <class _H2, class _P2>
- _LIBCPP_HIDE_FROM_ABI
- void merge(unordered_multimap<key_type, mapped_type, _H2, _P2, allocator_type>& __source)
- {
- _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(__source.get_allocator() == get_allocator(),
- "merging container with incompatible allocator");
- return __table_.__node_handle_merge_unique(__source.__table_);
- }
- template <class _H2, class _P2>
- _LIBCPP_HIDE_FROM_ABI
- void merge(unordered_multimap<key_type, mapped_type, _H2, _P2, allocator_type>&& __source)
- {
- _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(__source.get_allocator() == get_allocator(),
- "merging container with incompatible allocator");
- return __table_.__node_handle_merge_unique(__source.__table_);
- }
+ _LIBCPP_HIDE_FROM_ABI insert_return_type insert(node_type&& __nh) {
+ _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(__nh.empty() || __nh.get_allocator() == get_allocator(),
+ "node_type with incompatible allocator passed to unordered_map::insert()");
+ return __table_.template __node_handle_insert_unique< node_type, insert_return_type>(std::move(__nh));
+ }
+ _LIBCPP_HIDE_FROM_ABI iterator insert(const_iterator __hint, node_type&& __nh) {
+ _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(__nh.empty() || __nh.get_allocator() == get_allocator(),
+ "node_type with incompatible allocator passed to unordered_map::insert()");
+ return __table_.template __node_handle_insert_unique<node_type>(__hint.__i_, std::move(__nh));
+ }
+ _LIBCPP_HIDE_FROM_ABI node_type extract(key_type const& __key) {
+ return __table_.template __node_handle_extract<node_type>(__key);
+ }
+ _LIBCPP_HIDE_FROM_ABI node_type extract(const_iterator __it) {
+ return __table_.template __node_handle_extract<node_type>(__it.__i_);
+ }
+
+ template <class _H2, class _P2>
+ _LIBCPP_HIDE_FROM_ABI void merge(unordered_map<key_type, mapped_type, _H2, _P2, allocator_type>& __source) {
+ _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(
+ __source.get_allocator() == get_allocator(), "merging container with incompatible allocator");
+ return __table_.__node_handle_merge_unique(__source.__table_);
+ }
+ template <class _H2, class _P2>
+ _LIBCPP_HIDE_FROM_ABI void merge(unordered_map<key_type, mapped_type, _H2, _P2, allocator_type>&& __source) {
+ _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(
+ __source.get_allocator() == get_allocator(), "merging container with incompatible allocator");
+ return __table_.__node_handle_merge_unique(__source.__table_);
+ }
+ template <class _H2, class _P2>
+ _LIBCPP_HIDE_FROM_ABI void merge(unordered_multimap<key_type, mapped_type, _H2, _P2, allocator_type>& __source) {
+ _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(
+ __source.get_allocator() == get_allocator(), "merging container with incompatible allocator");
+ return __table_.__node_handle_merge_unique(__source.__table_);
+ }
+ template <class _H2, class _P2>
+ _LIBCPP_HIDE_FROM_ABI void merge(unordered_multimap<key_type, mapped_type, _H2, _P2, allocator_type>&& __source) {
+ _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(
+ __source.get_allocator() == get_allocator(), "merging container with incompatible allocator");
+ return __table_.__node_handle_merge_unique(__source.__table_);
+ }
#endif
- _LIBCPP_HIDE_FROM_ABI
- void swap(unordered_map& __u)
- _NOEXCEPT_(__is_nothrow_swappable<__table>::value)
- { __table_.swap(__u.__table_);}
-
- _LIBCPP_HIDE_FROM_ABI
- hasher hash_function() const
- {return __table_.hash_function().hash_function();}
- _LIBCPP_HIDE_FROM_ABI
- key_equal key_eq() const
- {return __table_.key_eq().key_eq();}
-
- _LIBCPP_HIDE_FROM_ABI
- iterator find(const key_type& __k) {return __table_.find(__k);}
- _LIBCPP_HIDE_FROM_ABI
- const_iterator find(const key_type& __k) const {return __table_.find(__k);}
+ _LIBCPP_HIDE_FROM_ABI void swap(unordered_map& __u) _NOEXCEPT_(__is_nothrow_swappable<__table>::value) {
+ __table_.swap(__u.__table_);
+ }
+
+ _LIBCPP_HIDE_FROM_ABI hasher hash_function() const { return __table_.hash_function().hash_function(); }
+ _LIBCPP_HIDE_FROM_ABI key_equal key_eq() const { return __table_.key_eq().key_eq(); }
+
+ _LIBCPP_HIDE_FROM_ABI iterator find(const key_type& __k) { return __table_.find(__k); }
+ _LIBCPP_HIDE_FROM_ABI const_iterator find(const key_type& __k) const { return __table_.find(__k); }
#if _LIBCPP_STD_VER >= 20
- template <class _K2, enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr>
- _LIBCPP_HIDE_FROM_ABI
- iterator find(const _K2& __k) {return __table_.find(__k);}
- template <class _K2, enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr>
- _LIBCPP_HIDE_FROM_ABI
- const_iterator find(const _K2& __k) const {return __table_.find(__k);}
+ template <class _K2,
+ enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr>
+ _LIBCPP_HIDE_FROM_ABI iterator find(const _K2& __k) {
+ return __table_.find(__k);
+ }
+ template <class _K2,
+ enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr>
+ _LIBCPP_HIDE_FROM_ABI const_iterator find(const _K2& __k) const {
+ return __table_.find(__k);
+ }
#endif // _LIBCPP_STD_VER >= 20
- _LIBCPP_HIDE_FROM_ABI
- size_type count(const key_type& __k) const {return __table_.__count_unique(__k);}
+ _LIBCPP_HIDE_FROM_ABI size_type count(const key_type& __k) const { return __table_.__count_unique(__k); }
#if _LIBCPP_STD_VER >= 20
- template <class _K2, enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr>
- _LIBCPP_HIDE_FROM_ABI
- size_type count(const _K2& __k) const {return __table_.__count_unique(__k);}
+ template <class _K2,
+ enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr>
+ _LIBCPP_HIDE_FROM_ABI size_type count(const _K2& __k) const {
+ return __table_.__count_unique(__k);
+ }
#endif // _LIBCPP_STD_VER >= 20
#if _LIBCPP_STD_VER >= 20
- _LIBCPP_HIDE_FROM_ABI
- bool contains(const key_type& __k) const {return find(__k) != end();}
+ _LIBCPP_HIDE_FROM_ABI bool contains(const key_type& __k) const { return find(__k) != end(); }
- template <class _K2, enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr>
- _LIBCPP_HIDE_FROM_ABI
- bool contains(const _K2& __k) const {return find(__k) != end();}
+ template <class _K2,
+ enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr>
+ _LIBCPP_HIDE_FROM_ABI bool contains(const _K2& __k) const {
+ return find(__k) != end();
+ }
#endif // _LIBCPP_STD_VER >= 20
- _LIBCPP_HIDE_FROM_ABI
- pair<iterator, iterator> equal_range(const key_type& __k)
- {return __table_.__equal_range_unique(__k);}
- _LIBCPP_HIDE_FROM_ABI
- pair<const_iterator, const_iterator> equal_range(const key_type& __k) const
- {return __table_.__equal_range_unique(__k);}
+ _LIBCPP_HIDE_FROM_ABI pair<iterator, iterator> equal_range(const key_type& __k) {
+ return __table_.__equal_range_unique(__k);
+ }
+ _LIBCPP_HIDE_FROM_ABI pair<const_iterator, const_iterator> equal_range(const key_type& __k) const {
+ return __table_.__equal_range_unique(__k);
+ }
#if _LIBCPP_STD_VER >= 20
- template <class _K2, enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr>
- _LIBCPP_HIDE_FROM_ABI
- pair<iterator, iterator> equal_range(const _K2& __k)
- {return __table_.__equal_range_unique(__k);}
- template <class _K2, enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr>
- _LIBCPP_HIDE_FROM_ABI
- pair<const_iterator, const_iterator> equal_range(const _K2& __k) const
- {return __table_.__equal_range_unique(__k);}
+ template <class _K2,
+ enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr>
+ _LIBCPP_HIDE_FROM_ABI pair<iterator, iterator> equal_range(const _K2& __k) {
+ return __table_.__equal_range_unique(__k);
+ }
+ template <class _K2,
+ enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr>
+ _LIBCPP_HIDE_FROM_ABI pair<const_iterator, const_iterator> equal_range(const _K2& __k) const {
+ return __table_.__equal_range_unique(__k);
+ }
#endif // _LIBCPP_STD_VER >= 20
- _LIBCPP_HIDE_FROM_ABI mapped_type& operator[](const key_type& __k);
+ _LIBCPP_HIDE_FROM_ABI mapped_type& operator[](const key_type& __k);
#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI mapped_type& operator[](key_type&& __k);
+ _LIBCPP_HIDE_FROM_ABI mapped_type& operator[](key_type&& __k);
#endif
- _LIBCPP_HIDE_FROM_ABI mapped_type& at(const key_type& __k);
- _LIBCPP_HIDE_FROM_ABI const mapped_type& at(const key_type& __k) const;
-
- _LIBCPP_HIDE_FROM_ABI
- size_type bucket_count() const _NOEXCEPT {return __table_.bucket_count();}
- _LIBCPP_HIDE_FROM_ABI
- size_type max_bucket_count() const _NOEXCEPT {return __table_.max_bucket_count();}
-
- _LIBCPP_HIDE_FROM_ABI
- size_type bucket_size(size_type __n) const
- {return __table_.bucket_size(__n);}
- _LIBCPP_HIDE_FROM_ABI
- size_type bucket(const key_type& __k) const {return __table_.bucket(__k);}
-
- _LIBCPP_HIDE_FROM_ABI
- local_iterator begin(size_type __n) {return __table_.begin(__n);}
- _LIBCPP_HIDE_FROM_ABI
- local_iterator end(size_type __n) {return __table_.end(__n);}
- _LIBCPP_HIDE_FROM_ABI
- const_local_iterator begin(size_type __n) const {return __table_.cbegin(__n);}
- _LIBCPP_HIDE_FROM_ABI
- const_local_iterator end(size_type __n) const {return __table_.cend(__n);}
- _LIBCPP_HIDE_FROM_ABI
- const_local_iterator cbegin(size_type __n) const {return __table_.cbegin(__n);}
- _LIBCPP_HIDE_FROM_ABI
- const_local_iterator cend(size_type __n) const {return __table_.cend(__n);}
-
- _LIBCPP_HIDE_FROM_ABI
- float load_factor() const _NOEXCEPT {return __table_.load_factor();}
- _LIBCPP_HIDE_FROM_ABI
- float max_load_factor() const _NOEXCEPT {return __table_.max_load_factor();}
- _LIBCPP_HIDE_FROM_ABI
- void max_load_factor(float __mlf) {__table_.max_load_factor(__mlf);}
- _LIBCPP_HIDE_FROM_ABI
- void rehash(size_type __n) {__table_.__rehash_unique(__n);}
- _LIBCPP_HIDE_FROM_ABI
- void reserve(size_type __n) {__table_.__reserve_unique(__n);}
+ _LIBCPP_HIDE_FROM_ABI mapped_type& at(const key_type& __k);
+ _LIBCPP_HIDE_FROM_ABI const mapped_type& at(const key_type& __k) const;
-private:
+ _LIBCPP_HIDE_FROM_ABI size_type bucket_count() const _NOEXCEPT { return __table_.bucket_count(); }
+ _LIBCPP_HIDE_FROM_ABI size_type max_bucket_count() const _NOEXCEPT { return __table_.max_bucket_count(); }
+
+ _LIBCPP_HIDE_FROM_ABI size_type bucket_size(size_type __n) const { return __table_.bucket_size(__n); }
+ _LIBCPP_HIDE_FROM_ABI size_type bucket(const key_type& __k) const { return __table_.bucket(__k); }
+ _LIBCPP_HIDE_FROM_ABI local_iterator begin(size_type __n) { return __table_.begin(__n); }
+ _LIBCPP_HIDE_FROM_ABI local_iterator end(size_type __n) { return __table_.end(__n); }
+ _LIBCPP_HIDE_FROM_ABI const_local_iterator begin(size_type __n) const { return __table_.cbegin(__n); }
+ _LIBCPP_HIDE_FROM_ABI const_local_iterator end(size_type __n) const { return __table_.cend(__n); }
+ _LIBCPP_HIDE_FROM_ABI const_local_iterator cbegin(size_type __n) const { return __table_.cbegin(__n); }
+ _LIBCPP_HIDE_FROM_ABI const_local_iterator cend(size_type __n) const { return __table_.cend(__n); }
+
+ _LIBCPP_HIDE_FROM_ABI float load_factor() const _NOEXCEPT { return __table_.load_factor(); }
+ _LIBCPP_HIDE_FROM_ABI float max_load_factor() const _NOEXCEPT { return __table_.max_load_factor(); }
+ _LIBCPP_HIDE_FROM_ABI void max_load_factor(float __mlf) { __table_.max_load_factor(__mlf); }
+ _LIBCPP_HIDE_FROM_ABI void rehash(size_type __n) { __table_.__rehash_unique(__n); }
+ _LIBCPP_HIDE_FROM_ABI void reserve(size_type __n) { __table_.__reserve_unique(__n); }
+
+private:
#ifdef _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI __node_holder __construct_node_with_key(const key_type& __k);
+ _LIBCPP_HIDE_FROM_ABI __node_holder __construct_node_with_key(const key_type& __k);
#endif
};
#if _LIBCPP_STD_VER >= 17
-template<class _InputIterator,
- class _Hash = hash<__iter_key_type<_InputIterator>>,
- class _Pred = equal_to<__iter_key_type<_InputIterator>>,
- class _Allocator = allocator<__iter_to_alloc_type<_InputIterator>>,
- class = enable_if_t<__has_input_iterator_category<_InputIterator>::value>,
- class = enable_if_t<!__is_allocator<_Hash>::value>,
- class = enable_if_t<!is_integral<_Hash>::value>,
- class = enable_if_t<!__is_allocator<_Pred>::value>,
- class = enable_if_t<__is_allocator<_Allocator>::value>>
-unordered_map(_InputIterator, _InputIterator, typename allocator_traits<_Allocator>::size_type = 0,
- _Hash = _Hash(), _Pred = _Pred(), _Allocator = _Allocator())
- -> unordered_map<__iter_key_type<_InputIterator>, __iter_mapped_type<_InputIterator>, _Hash, _Pred, _Allocator>;
-
-#if _LIBCPP_STD_VER >= 23
+template <class _InputIterator,
+ class _Hash = hash<__iter_key_type<_InputIterator>>,
+ class _Pred = equal_to<__iter_key_type<_InputIterator>>,
+ class _Allocator = allocator<__iter_to_alloc_type<_InputIterator>>,
+ class = enable_if_t<__has_input_iterator_category<_InputIterator>::value>,
+ class = enable_if_t<!__is_allocator<_Hash>::value>,
+ class = enable_if_t<!is_integral<_Hash>::value>,
+ class = enable_if_t<!__is_allocator<_Pred>::value>,
+ class = enable_if_t<__is_allocator<_Allocator>::value>>
+unordered_map(_InputIterator,
+ _InputIterator,
+ typename allocator_traits<_Allocator>::size_type = 0,
+ _Hash = _Hash(),
+ _Pred = _Pred(),
+ _Allocator = _Allocator())
+ -> unordered_map<__iter_key_type<_InputIterator>, __iter_mapped_type<_InputIterator>, _Hash, _Pred, _Allocator>;
+
+# if _LIBCPP_STD_VER >= 23
template <ranges::input_range _Range,
- class _Hash = hash<__range_key_type<_Range>>,
- class _Pred = equal_to<__range_key_type<_Range>>,
+ class _Hash = hash<__range_key_type<_Range>>,
+ class _Pred = equal_to<__range_key_type<_Range>>,
class _Allocator = allocator<__range_to_alloc_type<_Range>>,
- class = enable_if_t<!__is_allocator<_Hash>::value>,
- class = enable_if_t<!is_integral<_Hash>::value>,
- class = enable_if_t<!__is_allocator<_Pred>::value>,
+ class = enable_if_t<!__is_allocator<_Hash>::value>,
+ class = enable_if_t<!is_integral<_Hash>::value>,
+ class = enable_if_t<!__is_allocator<_Pred>::value>,
+ class = enable_if_t<__is_allocator<_Allocator>::value>>
+unordered_map(from_range_t,
+ _Range&&,
+ typename allocator_traits<_Allocator>::size_type = 0,
+ _Hash = _Hash(),
+ _Pred = _Pred(),
+ _Allocator = _Allocator())
+ -> unordered_map<__range_key_type<_Range>, __range_mapped_type<_Range>, _Hash, _Pred, _Allocator>; // C++23
+# endif
+
+template <class _Key,
+ class _Tp,
+ class _Hash = hash<remove_const_t<_Key>>,
+ class _Pred = equal_to<remove_const_t<_Key>>,
+ class _Allocator = allocator<pair<const _Key, _Tp>>,
+ class = enable_if_t<!__is_allocator<_Hash>::value>,
+ class = enable_if_t<!is_integral<_Hash>::value>,
+ class = enable_if_t<!__is_allocator<_Pred>::value>,
+ class = enable_if_t<__is_allocator<_Allocator>::value>>
+unordered_map(initializer_list<pair<_Key, _Tp>>,
+ typename allocator_traits<_Allocator>::size_type = 0,
+ _Hash = _Hash(),
+ _Pred = _Pred(),
+ _Allocator = _Allocator()) -> unordered_map<remove_const_t<_Key>, _Tp, _Hash, _Pred, _Allocator>;
+
+template <class _InputIterator,
+ class _Allocator,
+ class = enable_if_t<__has_input_iterator_category<_InputIterator>::value>,
class = enable_if_t<__is_allocator<_Allocator>::value>>
-unordered_map(from_range_t, _Range&&, typename allocator_traits<_Allocator>::size_type = 0,
- _Hash = _Hash(), _Pred = _Pred(), _Allocator = _Allocator())
- -> unordered_map<__range_key_type<_Range>, __range_mapped_type<_Range>, _Hash, _Pred, _Allocator>; // C++23
-#endif
-
-template<class _Key, class _Tp, class _Hash = hash<remove_const_t<_Key>>,
- class _Pred = equal_to<remove_const_t<_Key>>,
- class _Allocator = allocator<pair<const _Key, _Tp>>,
- class = enable_if_t<!__is_allocator<_Hash>::value>,
- class = enable_if_t<!is_integral<_Hash>::value>,
- class = enable_if_t<!__is_allocator<_Pred>::value>,
- class = enable_if_t<__is_allocator<_Allocator>::value>>
-unordered_map(initializer_list<pair<_Key, _Tp>>, typename allocator_traits<_Allocator>::size_type = 0,
- _Hash = _Hash(), _Pred = _Pred(), _Allocator = _Allocator())
- -> unordered_map<remove_const_t<_Key>, _Tp, _Hash, _Pred, _Allocator>;
-
-template<class _InputIterator, class _Allocator,
- class = enable_if_t<__has_input_iterator_category<_InputIterator>::value>,
- class = enable_if_t<__is_allocator<_Allocator>::value>>
unordered_map(_InputIterator, _InputIterator, typename allocator_traits<_Allocator>::size_type, _Allocator)
- -> unordered_map<__iter_key_type<_InputIterator>, __iter_mapped_type<_InputIterator>,
- hash<__iter_key_type<_InputIterator>>, equal_to<__iter_key_type<_InputIterator>>, _Allocator>;
-
-template<class _InputIterator, class _Allocator,
- class = enable_if_t<__has_input_iterator_category<_InputIterator>::value>,
- class = enable_if_t<__is_allocator<_Allocator>::value>>
+ -> unordered_map<__iter_key_type<_InputIterator>,
+ __iter_mapped_type<_InputIterator>,
+ hash<__iter_key_type<_InputIterator>>,
+ equal_to<__iter_key_type<_InputIterator>>,
+ _Allocator>;
+
+template <class _InputIterator,
+ class _Allocator,
+ class = enable_if_t<__has_input_iterator_category<_InputIterator>::value>,
+ class = enable_if_t<__is_allocator<_Allocator>::value>>
unordered_map(_InputIterator, _InputIterator, _Allocator)
- -> unordered_map<__iter_key_type<_InputIterator>, __iter_mapped_type<_InputIterator>,
- hash<__iter_key_type<_InputIterator>>, equal_to<__iter_key_type<_InputIterator>>, _Allocator>;
-
-template<class _InputIterator, class _Hash, class _Allocator,
- class = enable_if_t<__has_input_iterator_category<_InputIterator>::value>,
- class = enable_if_t<!__is_allocator<_Hash>::value>,
- class = enable_if_t<!is_integral<_Hash>::value>,
- class = enable_if_t<__is_allocator<_Allocator>::value>>
+ -> unordered_map<__iter_key_type<_InputIterator>,
+ __iter_mapped_type<_InputIterator>,
+ hash<__iter_key_type<_InputIterator>>,
+ equal_to<__iter_key_type<_InputIterator>>,
+ _Allocator>;
+
+template <class _InputIterator,
+ class _Hash,
+ class _Allocator,
+ class = enable_if_t<__has_input_iterator_category<_InputIterator>::value>,
+ class = enable_if_t<!__is_allocator<_Hash>::value>,
+ class = enable_if_t<!is_integral<_Hash>::value>,
+ class = enable_if_t<__is_allocator<_Allocator>::value>>
unordered_map(_InputIterator, _InputIterator, typename allocator_traits<_Allocator>::size_type, _Hash, _Allocator)
- -> unordered_map<__iter_key_type<_InputIterator>, __iter_mapped_type<_InputIterator>,
- _Hash, equal_to<__iter_key_type<_InputIterator>>, _Allocator>;
+ -> unordered_map<__iter_key_type<_InputIterator>,
+ __iter_mapped_type<_InputIterator>,
+ _Hash,
+ equal_to<__iter_key_type<_InputIterator>>,
+ _Allocator>;
-#if _LIBCPP_STD_VER >= 23
+# if _LIBCPP_STD_VER >= 23
-template <ranges::input_range _Range, class _Allocator,
- class = enable_if_t<__is_allocator<_Allocator>::value>>
+template <ranges::input_range _Range, class _Allocator, class = enable_if_t<__is_allocator<_Allocator>::value>>
unordered_map(from_range_t, _Range&&, typename allocator_traits<_Allocator>::size_type, _Allocator)
- -> unordered_map<__range_key_type<_Range>, __range_mapped_type<_Range>, hash<__range_key_type<_Range>>,
- equal_to<__range_key_type<_Range>>, _Allocator>;
+ -> unordered_map<__range_key_type<_Range>,
+ __range_mapped_type<_Range>,
+ hash<__range_key_type<_Range>>,
+ equal_to<__range_key_type<_Range>>,
+ _Allocator>;
-template <ranges::input_range _Range, class _Allocator,
- class = enable_if_t<__is_allocator<_Allocator>::value>>
+template <ranges::input_range _Range, class _Allocator, class = enable_if_t<__is_allocator<_Allocator>::value>>
unordered_map(from_range_t, _Range&&, _Allocator)
- -> unordered_map<__range_key_type<_Range>, __range_mapped_type<_Range>, hash<__range_key_type<_Range>>,
- equal_to<__range_key_type<_Range>>, _Allocator>;
+ -> unordered_map<__range_key_type<_Range>,
+ __range_mapped_type<_Range>,
+ hash<__range_key_type<_Range>>,
+ equal_to<__range_key_type<_Range>>,
+ _Allocator>;
-template <ranges::input_range _Range, class _Hash, class _Allocator,
+template <ranges::input_range _Range,
+ class _Hash,
+ class _Allocator,
class = enable_if_t<!__is_allocator<_Hash>::value>,
class = enable_if_t<!is_integral<_Hash>::value>,
class = enable_if_t<__is_allocator<_Allocator>::value>>
unordered_map(from_range_t, _Range&&, typename allocator_traits<_Allocator>::size_type, _Hash, _Allocator)
- -> unordered_map<__range_key_type<_Range>, __range_mapped_type<_Range>, _Hash,
- equal_to<__range_key_type<_Range>>, _Allocator>;
+ -> unordered_map<__range_key_type<_Range>,
+ __range_mapped_type<_Range>,
+ _Hash,
+ equal_to<__range_key_type<_Range>>,
+ _Allocator>;
-#endif
+# endif
-template<class _Key, class _Tp, class _Allocator,
- class = enable_if_t<__is_allocator<_Allocator>::value>>
+template <class _Key, class _Tp, class _Allocator, class = enable_if_t<__is_allocator<_Allocator>::value>>
unordered_map(initializer_list<pair<_Key, _Tp>>, typename allocator_traits<_Allocator>::size_type, _Allocator)
- -> unordered_map<remove_const_t<_Key>, _Tp,
- hash<remove_const_t<_Key>>,
- equal_to<remove_const_t<_Key>>, _Allocator>;
+ -> unordered_map<remove_const_t<_Key>, _Tp, hash<remove_const_t<_Key>>, equal_to<remove_const_t<_Key>>, _Allocator>;
-template<class _Key, class _Tp, class _Allocator,
- class = enable_if_t<__is_allocator<_Allocator>::value>>
+template <class _Key, class _Tp, class _Allocator, class = enable_if_t<__is_allocator<_Allocator>::value>>
unordered_map(initializer_list<pair<_Key, _Tp>>, _Allocator)
- -> unordered_map<remove_const_t<_Key>, _Tp,
- hash<remove_const_t<_Key>>,
- equal_to<remove_const_t<_Key>>, _Allocator>;
-
-template<class _Key, class _Tp, class _Hash, class _Allocator,
- class = enable_if_t<!__is_allocator<_Hash>::value>,
- class = enable_if_t<!is_integral<_Hash>::value>,
- class = enable_if_t<__is_allocator<_Allocator>::value>>
+ -> unordered_map<remove_const_t<_Key>, _Tp, hash<remove_const_t<_Key>>, equal_to<remove_const_t<_Key>>, _Allocator>;
+
+template <class _Key,
+ class _Tp,
+ class _Hash,
+ class _Allocator,
+ class = enable_if_t<!__is_allocator<_Hash>::value>,
+ class = enable_if_t<!is_integral<_Hash>::value>,
+ class = enable_if_t<__is_allocator<_Allocator>::value>>
unordered_map(initializer_list<pair<_Key, _Tp>>, typename allocator_traits<_Allocator>::size_type, _Hash, _Allocator)
- -> unordered_map<remove_const_t<_Key>, _Tp, _Hash,
- equal_to<remove_const_t<_Key>>, _Allocator>;
+ -> unordered_map<remove_const_t<_Key>, _Tp, _Hash, equal_to<remove_const_t<_Key>>, _Allocator>;
#endif
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
-unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map(
- size_type __n, const hasher& __hf, const key_equal& __eql)
- : __table_(__hf, __eql)
-{
- __table_.__rehash_unique(__n);
+unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map(size_type __n, const hasher& __hf, const key_equal& __eql)
+ : __table_(__hf, __eql) {
+ __table_.__rehash_unique(__n);
}
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map(
- size_type __n, const hasher& __hf, const key_equal& __eql,
- const allocator_type& __a)
- : __table_(__hf, __eql, typename __table::allocator_type(__a))
-{
- __table_.__rehash_unique(__n);
+ size_type __n, const hasher& __hf, const key_equal& __eql, const allocator_type& __a)
+ : __table_(__hf, __eql, typename __table::allocator_type(__a)) {
+ __table_.__rehash_unique(__n);
}
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
-inline
-unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map(
- const allocator_type& __a)
- : __table_(typename __table::allocator_type(__a))
-{
-}
+inline unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map(const allocator_type& __a)
+ : __table_(typename __table::allocator_type(__a)) {}
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
template <class _InputIterator>
-unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map(
- _InputIterator __first, _InputIterator __last)
-{
- insert(__first, __last);
+unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map(_InputIterator __first, _InputIterator __last) {
+ insert(__first, __last);
}
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
template <class _InputIterator>
unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map(
- _InputIterator __first, _InputIterator __last, size_type __n,
- const hasher& __hf, const key_equal& __eql)
- : __table_(__hf, __eql)
-{
- __table_.__rehash_unique(__n);
- insert(__first, __last);
+ _InputIterator __first, _InputIterator __last, size_type __n, const hasher& __hf, const key_equal& __eql)
+ : __table_(__hf, __eql) {
+ __table_.__rehash_unique(__n);
+ insert(__first, __last);
}
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
template <class _InputIterator>
unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map(
- _InputIterator __first, _InputIterator __last, size_type __n,
- const hasher& __hf, const key_equal& __eql, const allocator_type& __a)
- : __table_(__hf, __eql, typename __table::allocator_type(__a))
-{
- __table_.__rehash_unique(__n);
- insert(__first, __last);
+ _InputIterator __first,
+ _InputIterator __last,
+ size_type __n,
+ const hasher& __hf,
+ const key_equal& __eql,
+ const allocator_type& __a)
+ : __table_(__hf, __eql, typename __table::allocator_type(__a)) {
+ __table_.__rehash_unique(__n);
+ insert(__first, __last);
}
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
-unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map(
- const unordered_map& __u)
- : __table_(__u.__table_)
-{
- __table_.__rehash_unique(__u.bucket_count());
- insert(__u.begin(), __u.end());
+unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map(const unordered_map& __u) : __table_(__u.__table_) {
+ __table_.__rehash_unique(__u.bucket_count());
+ insert(__u.begin(), __u.end());
}
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
-unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map(
- const unordered_map& __u, const allocator_type& __a)
- : __table_(__u.__table_, typename __table::allocator_type(__a))
-{
- __table_.__rehash_unique(__u.bucket_count());
- insert(__u.begin(), __u.end());
+unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map(const unordered_map& __u, const allocator_type& __a)
+ : __table_(__u.__table_, typename __table::allocator_type(__a)) {
+ __table_.__rehash_unique(__u.bucket_count());
+ insert(__u.begin(), __u.end());
}
#ifndef _LIBCPP_CXX03_LANG
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
-inline
-unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map(
- unordered_map&& __u)
+inline unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map(unordered_map&& __u)
_NOEXCEPT_(is_nothrow_move_constructible<__table>::value)
- : __table_(std::move(__u.__table_))
-{
-}
+ : __table_(std::move(__u.__table_)) {}
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
-unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map(
- unordered_map&& __u, const allocator_type& __a)
- : __table_(std::move(__u.__table_), typename __table::allocator_type(__a))
-{
- if (__a != __u.get_allocator())
- {
- iterator __i = __u.begin();
- while (__u.size() != 0) {
- __table_.__emplace_unique(
- __u.__table_.remove((__i++).__i_)->__get_value().__move());
- }
+unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map(unordered_map&& __u, const allocator_type& __a)
+ : __table_(std::move(__u.__table_), typename __table::allocator_type(__a)) {
+ if (__a != __u.get_allocator()) {
+ iterator __i = __u.begin();
+ while (__u.size() != 0) {
+ __table_.__emplace_unique(__u.__table_.remove((__i++).__i_)->__get_value().__move());
}
+ }
}
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
-unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map(
- initializer_list<value_type> __il)
-{
- insert(__il.begin(), __il.end());
+unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map(initializer_list<value_type> __il) {
+ insert(__il.begin(), __il.end());
}
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map(
- initializer_list<value_type> __il, size_type __n, const hasher& __hf,
- const key_equal& __eql)
- : __table_(__hf, __eql)
-{
- __table_.__rehash_unique(__n);
- insert(__il.begin(), __il.end());
+ initializer_list<value_type> __il, size_type __n, const hasher& __hf, const key_equal& __eql)
+ : __table_(__hf, __eql) {
+ __table_.__rehash_unique(__n);
+ insert(__il.begin(), __il.end());
}
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map(
- initializer_list<value_type> __il, size_type __n, const hasher& __hf,
- const key_equal& __eql, const allocator_type& __a)
- : __table_(__hf, __eql, typename __table::allocator_type(__a))
-{
- __table_.__rehash_unique(__n);
- insert(__il.begin(), __il.end());
+ initializer_list<value_type> __il,
+ size_type __n,
+ const hasher& __hf,
+ const key_equal& __eql,
+ const allocator_type& __a)
+ : __table_(__hf, __eql, typename __table::allocator_type(__a)) {
+ __table_.__rehash_unique(__n);
+ insert(__il.begin(), __il.end());
}
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
-inline
-unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>&
+inline unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>&
unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::operator=(unordered_map&& __u)
- _NOEXCEPT_(is_nothrow_move_assignable<__table>::value)
-{
- __table_ = std::move(__u.__table_);
- return *this;
+ _NOEXCEPT_(is_nothrow_move_assignable<__table>::value) {
+ __table_ = std::move(__u.__table_);
+ return *this;
}
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
-inline
-unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>&
-unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::operator=(
- initializer_list<value_type> __il)
-{
- __table_.__assign_unique(__il.begin(), __il.end());
- return *this;
+inline unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>&
+unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::operator=(initializer_list<value_type> __il) {
+ __table_.__assign_unique(__il.begin(), __il.end());
+ return *this;
}
#endif // _LIBCPP_CXX03_LANG
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
template <class _InputIterator>
-inline
-void
-unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::insert(_InputIterator __first,
- _InputIterator __last)
-{
- for (; __first != __last; ++__first)
- __table_.__insert_unique(*__first);
+inline void unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::insert(_InputIterator __first, _InputIterator __last) {
+ for (; __first != __last; ++__first)
+ __table_.__insert_unique(*__first);
}
#ifndef _LIBCPP_CXX03_LANG
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
-_Tp&
-unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::operator[](const key_type& __k)
-{
- return __table_.__emplace_unique_key_args(__k,
- piecewise_construct, std::forward_as_tuple(__k),
- std::forward_as_tuple()).first->__get_value().second;
+_Tp& unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::operator[](const key_type& __k) {
+ return __table_
+ .__emplace_unique_key_args(__k, piecewise_construct, std::forward_as_tuple(__k), std::forward_as_tuple())
+ .first->__get_value()
+ .second;
}
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
-_Tp&
-unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::operator[](key_type&& __k)
-{
- return __table_.__emplace_unique_key_args(__k,
- piecewise_construct, std::forward_as_tuple(std::move(__k)),
- std::forward_as_tuple()).first->__get_value().second;
+_Tp& unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::operator[](key_type&& __k) {
+ return __table_
+ .__emplace_unique_key_args(
+ __k, piecewise_construct, std::forward_as_tuple(std::move(__k)), std::forward_as_tuple())
+ .first->__get_value()
+ .second;
}
#else // _LIBCPP_CXX03_LANG
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
typename unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::__node_holder
-unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::__construct_node_with_key(const key_type& __k)
-{
- __node_allocator& __na = __table_.__node_alloc();
- __node_holder __h(__node_traits::allocate(__na, 1), _Dp(__na));
- __node_traits::construct(__na, std::addressof(__h->__get_value().__get_value().first), __k);
- __h.get_deleter().__first_constructed = true;
- __node_traits::construct(__na, std::addressof(__h->__get_value().__get_value().second));
- __h.get_deleter().__second_constructed = true;
- return __h;
+unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::__construct_node_with_key(const key_type& __k) {
+ __node_allocator& __na = __table_.__node_alloc();
+ __node_holder __h(__node_traits::allocate(__na, 1), _Dp(__na));
+ __node_traits::construct(__na, std::addressof(__h->__get_value().__get_value().first), __k);
+ __h.get_deleter().__first_constructed = true;
+ __node_traits::construct(__na, std::addressof(__h->__get_value().__get_value().second));
+ __h.get_deleter().__second_constructed = true;
+ return __h;
}
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
-_Tp&
-unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::operator[](const key_type& __k)
-{
- iterator __i = find(__k);
- if (__i != end())
- return __i->second;
- __node_holder __h = __construct_node_with_key(__k);
- pair<iterator, bool> __r = __table_.__node_insert_unique(__h.get());
- __h.release();
- return __r.first->second;
+_Tp& unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::operator[](const key_type& __k) {
+ iterator __i = find(__k);
+ if (__i != end())
+ return __i->second;
+ __node_holder __h = __construct_node_with_key(__k);
+ pair<iterator, bool> __r = __table_.__node_insert_unique(__h.get());
+ __h.release();
+ return __r.first->second;
}
#endif // _LIBCPP_CXX03_LANG
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
-_Tp&
-unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::at(const key_type& __k)
-{
- iterator __i = find(__k);
- if (__i == end())
- __throw_out_of_range("unordered_map::at: key not found");
- return __i->second;
+_Tp& unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::at(const key_type& __k) {
+ iterator __i = find(__k);
+ if (__i == end())
+ __throw_out_of_range("unordered_map::at: key not found");
+ return __i->second;
}
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
-const _Tp&
-unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::at(const key_type& __k) const
-{
- const_iterator __i = find(__k);
- if (__i == end())
- __throw_out_of_range("unordered_map::at: key not found");
- return __i->second;
+const _Tp& unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::at(const key_type& __k) const {
+ const_iterator __i = find(__k);
+ if (__i == end())
+ __throw_out_of_range("unordered_map::at: key not found");
+ return __i->second;
}
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
-inline _LIBCPP_HIDE_FROM_ABI
-void
-swap(unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
- unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __y)
- _NOEXCEPT_(_NOEXCEPT_(__x.swap(__y)))
-{
- __x.swap(__y);
+inline _LIBCPP_HIDE_FROM_ABI void
+swap(unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __x, unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __y)
+ _NOEXCEPT_(_NOEXCEPT_(__x.swap(__y))) {
+ __x.swap(__y);
}
#if _LIBCPP_STD_VER >= 20
-template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc,
- class _Predicate>
-inline _LIBCPP_HIDE_FROM_ABI
- typename unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::size_type
- erase_if(unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __c,
- _Predicate __pred) {
+template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc, class _Predicate>
+inline _LIBCPP_HIDE_FROM_ABI typename unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::size_type
+erase_if(unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __c, _Predicate __pred) {
return std::__libcpp_erase_if_container(__c, __pred);
}
#endif
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
-_LIBCPP_HIDE_FROM_ABI bool
-operator==(const unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
- const unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __y)
-{
- if (__x.size() != __y.size())
- return false;
- typedef typename unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::const_iterator
- const_iterator;
- for (const_iterator __i = __x.begin(), __ex = __x.end(), __ey = __y.end();
- __i != __ex; ++__i)
- {
- const_iterator __j = __y.find(__i->first);
- if (__j == __ey || !(*__i == *__j))
- return false;
- }
- return true;
+_LIBCPP_HIDE_FROM_ABI bool operator==(const unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
+ const unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __y) {
+ if (__x.size() != __y.size())
+ return false;
+ typedef typename unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::const_iterator const_iterator;
+ for (const_iterator __i = __x.begin(), __ex = __x.end(), __ey = __y.end(); __i != __ex; ++__i) {
+ const_iterator __j = __y.find(__i->first);
+ if (__j == __ey || !(*__i == *__j))
+ return false;
+ }
+ return true;
}
#if _LIBCPP_STD_VER <= 17
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator!=(const unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
- const unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __y)
-{
- return !(__x == __y);
+inline _LIBCPP_HIDE_FROM_ABI bool operator!=(const unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
+ const unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __y) {
+ return !(__x == __y);
}
#endif
-template <class _Key, class _Tp, class _Hash = hash<_Key>, class _Pred = equal_to<_Key>,
+template <class _Key,
+ class _Tp,
+ class _Hash = hash<_Key>,
+ class _Pred = equal_to<_Key>,
class _Alloc = allocator<pair<const _Key, _Tp> > >
-class _LIBCPP_TEMPLATE_VIS unordered_multimap
-{
+class _LIBCPP_TEMPLATE_VIS unordered_multimap {
public:
- // types
- typedef _Key key_type;
- typedef _Tp mapped_type;
- typedef __type_identity_t<_Hash> hasher;
- typedef __type_identity_t<_Pred> key_equal;
- typedef __type_identity_t<_Alloc> allocator_type;
- typedef pair<const key_type, mapped_type> value_type;
- typedef value_type& reference;
- typedef const value_type& const_reference;
- static_assert((is_same<value_type, typename allocator_type::value_type>::value),
- "Allocator::value_type must be same type as value_type");
+ // types
+ typedef _Key key_type;
+ typedef _Tp mapped_type;
+ typedef __type_identity_t<_Hash> hasher;
+ typedef __type_identity_t<_Pred> key_equal;
+ typedef __type_identity_t<_Alloc> allocator_type;
+ typedef pair<const key_type, mapped_type> value_type;
+ typedef value_type& reference;
+ typedef const value_type& const_reference;
+ static_assert((is_same<value_type, typename allocator_type::value_type>::value),
+ "Allocator::value_type must be same type as value_type");
private:
- typedef __hash_value_type<key_type, mapped_type> __value_type;
- typedef __unordered_map_hasher<key_type, __value_type, hasher, key_equal> __hasher;
- typedef __unordered_map_equal<key_type, __value_type, key_equal, hasher> __key_equal;
- typedef __rebind_alloc<allocator_traits<allocator_type>, __value_type> __allocator_type;
-
- typedef __hash_table<__value_type, __hasher,
- __key_equal, __allocator_type> __table;
-
- __table __table_;
-
- typedef typename __table::_NodeTypes _NodeTypes;
- typedef typename __table::__node_traits __node_traits;
- typedef typename __table::__node_allocator __node_allocator;
- typedef typename __table::__node __node;
- typedef __hash_map_node_destructor<__node_allocator> _Dp;
- typedef unique_ptr<__node, _Dp> __node_holder;
- typedef allocator_traits<allocator_type> __alloc_traits;
- static_assert((is_same<typename __node_traits::size_type,
- typename __alloc_traits::size_type>::value),
- "Allocator uses different size_type for different types");
-
- static_assert(is_same<allocator_type, __rebind_alloc<__alloc_traits, value_type> >::value,
- "[allocator.requirements] states that rebinding an allocator to the same type should result in the "
- "original allocator");
-
- public:
- typedef typename __alloc_traits::pointer pointer;
- typedef typename __alloc_traits::const_pointer const_pointer;
- typedef typename __table::size_type size_type;
- typedef typename __table::difference_type difference_type;
-
- typedef __hash_map_iterator<typename __table::iterator> iterator;
- typedef __hash_map_const_iterator<typename __table::const_iterator> const_iterator;
- typedef __hash_map_iterator<typename __table::local_iterator> local_iterator;
- typedef __hash_map_const_iterator<typename __table::const_local_iterator> const_local_iterator;
+ typedef __hash_value_type<key_type, mapped_type> __value_type;
+ typedef __unordered_map_hasher<key_type, __value_type, hasher, key_equal> __hasher;
+ typedef __unordered_map_equal<key_type, __value_type, key_equal, hasher> __key_equal;
+ typedef __rebind_alloc<allocator_traits<allocator_type>, __value_type> __allocator_type;
+
+ typedef __hash_table<__value_type, __hasher, __key_equal, __allocator_type> __table;
+
+ __table __table_;
+
+ typedef typename __table::_NodeTypes _NodeTypes;
+ typedef typename __table::__node_traits __node_traits;
+ typedef typename __table::__node_allocator __node_allocator;
+ typedef typename __table::__node __node;
+ typedef __hash_map_node_destructor<__node_allocator> _Dp;
+ typedef unique_ptr<__node, _Dp> __node_holder;
+ typedef allocator_traits<allocator_type> __alloc_traits;
+ static_assert((is_same<typename __node_traits::size_type, typename __alloc_traits::size_type>::value),
+ "Allocator uses different size_type for different types");
+
+ static_assert(is_same<allocator_type, __rebind_alloc<__alloc_traits, value_type> >::value,
+ "[allocator.requirements] states that rebinding an allocator to the same type should result in the "
+ "original allocator");
+
+public:
+ typedef typename __alloc_traits::pointer pointer;
+ typedef typename __alloc_traits::const_pointer const_pointer;
+ typedef typename __table::size_type size_type;
+ typedef typename __table::difference_type difference_type;
+
+ typedef __hash_map_iterator<typename __table::iterator> iterator;
+ typedef __hash_map_const_iterator<typename __table::const_iterator> const_iterator;
+ typedef __hash_map_iterator<typename __table::local_iterator> local_iterator;
+ typedef __hash_map_const_iterator<typename __table::const_local_iterator> const_local_iterator;
#if _LIBCPP_STD_VER >= 17
- typedef __map_node_handle<__node, allocator_type> node_type;
+ typedef __map_node_handle<__node, allocator_type> node_type;
#endif
- template <class _Key2, class _Tp2, class _Hash2, class _Pred2, class _Alloc2>
- friend class _LIBCPP_TEMPLATE_VIS unordered_map;
- template <class _Key2, class _Tp2, class _Hash2, class _Pred2, class _Alloc2>
- friend class _LIBCPP_TEMPLATE_VIS unordered_multimap;
-
- _LIBCPP_HIDE_FROM_ABI
- unordered_multimap()
- _NOEXCEPT_(is_nothrow_default_constructible<__table>::value)
- {
- }
- explicit _LIBCPP_HIDE_FROM_ABI unordered_multimap(size_type __n, const hasher& __hf = hasher(),
- const key_equal& __eql = key_equal());
- _LIBCPP_HIDE_FROM_ABI unordered_multimap(size_type __n, const hasher& __hf,
- const key_equal& __eql,
- const allocator_type& __a);
- template <class _InputIterator>
- _LIBCPP_HIDE_FROM_ABI unordered_multimap(_InputIterator __first, _InputIterator __last);
- template <class _InputIterator>
- _LIBCPP_HIDE_FROM_ABI unordered_multimap(_InputIterator __first, _InputIterator __last,
- size_type __n, const hasher& __hf = hasher(),
- const key_equal& __eql = key_equal());
- template <class _InputIterator>
- _LIBCPP_HIDE_FROM_ABI unordered_multimap(_InputIterator __first, _InputIterator __last,
- size_type __n, const hasher& __hf,
- const key_equal& __eql,
- const allocator_type& __a);
+ template <class _Key2, class _Tp2, class _Hash2, class _Pred2, class _Alloc2>
+ friend class _LIBCPP_TEMPLATE_VIS unordered_map;
+ template <class _Key2, class _Tp2, class _Hash2, class _Pred2, class _Alloc2>
+ friend class _LIBCPP_TEMPLATE_VIS unordered_multimap;
+
+ _LIBCPP_HIDE_FROM_ABI unordered_multimap() _NOEXCEPT_(is_nothrow_default_constructible<__table>::value) {}
+ explicit _LIBCPP_HIDE_FROM_ABI
+ unordered_multimap(size_type __n, const hasher& __hf = hasher(), const key_equal& __eql = key_equal());
+ _LIBCPP_HIDE_FROM_ABI
+ unordered_multimap(size_type __n, const hasher& __hf, const key_equal& __eql, const allocator_type& __a);
+ template <class _InputIterator>
+ _LIBCPP_HIDE_FROM_ABI unordered_multimap(_InputIterator __first, _InputIterator __last);
+ template <class _InputIterator>
+ _LIBCPP_HIDE_FROM_ABI unordered_multimap(
+ _InputIterator __first,
+ _InputIterator __last,
+ size_type __n,
+ const hasher& __hf = hasher(),
+ const key_equal& __eql = key_equal());
+ template <class _InputIterator>
+ _LIBCPP_HIDE_FROM_ABI unordered_multimap(
+ _InputIterator __first,
+ _InputIterator __last,
+ size_type __n,
+ const hasher& __hf,
+ const key_equal& __eql,
+ const allocator_type& __a);
#if _LIBCPP_STD_VER >= 23
- template <_ContainerCompatibleRange<value_type> _Range>
- _LIBCPP_HIDE_FROM_ABI
- unordered_multimap(from_range_t, _Range&& __range, size_type __n = /*implementation-defined*/0,
- const hasher& __hf = hasher(), const key_equal& __eql = key_equal(),
- const allocator_type& __a = allocator_type())
- : __table_(__hf, __eql, typename __table::allocator_type(__a)) {
- if (__n > 0) {
- __table_.__rehash_multi(__n);
- }
- insert_range(std::forward<_Range>(__range));
+ template <_ContainerCompatibleRange<value_type> _Range>
+ _LIBCPP_HIDE_FROM_ABI unordered_multimap(
+ from_range_t,
+ _Range&& __range,
+ size_type __n = /*implementation-defined*/ 0,
+ const hasher& __hf = hasher(),
+ const key_equal& __eql = key_equal(),
+ const allocator_type& __a = allocator_type())
+ : __table_(__hf, __eql, typename __table::allocator_type(__a)) {
+ if (__n > 0) {
+ __table_.__rehash_multi(__n);
}
+ insert_range(std::forward<_Range>(__range));
+ }
#endif
- _LIBCPP_HIDE_FROM_ABI
- explicit unordered_multimap(const allocator_type& __a);
- _LIBCPP_HIDE_FROM_ABI unordered_multimap(const unordered_multimap& __u);
- _LIBCPP_HIDE_FROM_ABI unordered_multimap(const unordered_multimap& __u, const allocator_type& __a);
+ _LIBCPP_HIDE_FROM_ABI explicit unordered_multimap(const allocator_type& __a);
+ _LIBCPP_HIDE_FROM_ABI unordered_multimap(const unordered_multimap& __u);
+ _LIBCPP_HIDE_FROM_ABI unordered_multimap(const unordered_multimap& __u, const allocator_type& __a);
#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI
- unordered_multimap(unordered_multimap&& __u)
- _NOEXCEPT_(is_nothrow_move_constructible<__table>::value);
- _LIBCPP_HIDE_FROM_ABI unordered_multimap(unordered_multimap&& __u, const allocator_type& __a);
- _LIBCPP_HIDE_FROM_ABI unordered_multimap(initializer_list<value_type> __il);
- _LIBCPP_HIDE_FROM_ABI unordered_multimap(initializer_list<value_type> __il, size_type __n,
- const hasher& __hf = hasher(),
- const key_equal& __eql = key_equal());
- _LIBCPP_HIDE_FROM_ABI unordered_multimap(initializer_list<value_type> __il, size_type __n,
- const hasher& __hf, const key_equal& __eql,
- const allocator_type& __a);
+ _LIBCPP_HIDE_FROM_ABI unordered_multimap(unordered_multimap&& __u)
+ _NOEXCEPT_(is_nothrow_move_constructible<__table>::value);
+ _LIBCPP_HIDE_FROM_ABI unordered_multimap(unordered_multimap&& __u, const allocator_type& __a);
+ _LIBCPP_HIDE_FROM_ABI unordered_multimap(initializer_list<value_type> __il);
+ _LIBCPP_HIDE_FROM_ABI unordered_multimap(
+ initializer_list<value_type> __il,
+ size_type __n,
+ const hasher& __hf = hasher(),
+ const key_equal& __eql = key_equal());
+ _LIBCPP_HIDE_FROM_ABI unordered_multimap(
+ initializer_list<value_type> __il,
+ size_type __n,
+ const hasher& __hf,
+ const key_equal& __eql,
+ const allocator_type& __a);
#endif // _LIBCPP_CXX03_LANG
#if _LIBCPP_STD_VER >= 14
- _LIBCPP_HIDE_FROM_ABI
- unordered_multimap(size_type __n, const allocator_type& __a)
+ _LIBCPP_HIDE_FROM_ABI unordered_multimap(size_type __n, const allocator_type& __a)
: unordered_multimap(__n, hasher(), key_equal(), __a) {}
- _LIBCPP_HIDE_FROM_ABI
- unordered_multimap(size_type __n, const hasher& __hf, const allocator_type& __a)
+ _LIBCPP_HIDE_FROM_ABI unordered_multimap(size_type __n, const hasher& __hf, const allocator_type& __a)
: unordered_multimap(__n, __hf, key_equal(), __a) {}
- template <class _InputIterator>
- _LIBCPP_HIDE_FROM_ABI
- unordered_multimap(_InputIterator __first, _InputIterator __last, size_type __n, const allocator_type& __a)
+ template <class _InputIterator>
+ _LIBCPP_HIDE_FROM_ABI
+ unordered_multimap(_InputIterator __first, _InputIterator __last, size_type __n, const allocator_type& __a)
: unordered_multimap(__first, __last, __n, hasher(), key_equal(), __a) {}
- template <class _InputIterator>
- _LIBCPP_HIDE_FROM_ABI
- unordered_multimap(_InputIterator __first, _InputIterator __last, size_type __n, const hasher& __hf,
- const allocator_type& __a)
+ template <class _InputIterator>
+ _LIBCPP_HIDE_FROM_ABI unordered_multimap(
+ _InputIterator __first, _InputIterator __last, size_type __n, const hasher& __hf, const allocator_type& __a)
: unordered_multimap(__first, __last, __n, __hf, key_equal(), __a) {}
-#if _LIBCPP_STD_VER >= 23
- template <_ContainerCompatibleRange<value_type> _Range>
- _LIBCPP_HIDE_FROM_ABI
- unordered_multimap(from_range_t, _Range&& __range, size_type __n, const allocator_type& __a)
- : unordered_multimap(from_range, std::forward<_Range>(__range), __n, hasher(), key_equal(), __a) {}
-
- template <_ContainerCompatibleRange<value_type> _Range>
- _LIBCPP_HIDE_FROM_ABI
- unordered_multimap(from_range_t, _Range&& __range, size_type __n, const hasher& __hf, const allocator_type& __a)
- : unordered_multimap(from_range, std::forward<_Range>(__range), __n, __hf, key_equal(), __a) {}
-#endif
+# if _LIBCPP_STD_VER >= 23
+ template <_ContainerCompatibleRange<value_type> _Range>
+ _LIBCPP_HIDE_FROM_ABI unordered_multimap(from_range_t, _Range&& __range, size_type __n, const allocator_type& __a)
+ : unordered_multimap(from_range, std::forward<_Range>(__range), __n, hasher(), key_equal(), __a) {}
- _LIBCPP_HIDE_FROM_ABI
- unordered_multimap(initializer_list<value_type> __il, size_type __n, const allocator_type& __a)
+ template <_ContainerCompatibleRange<value_type> _Range>
+ _LIBCPP_HIDE_FROM_ABI
+ unordered_multimap(from_range_t, _Range&& __range, size_type __n, const hasher& __hf, const allocator_type& __a)
+ : unordered_multimap(from_range, std::forward<_Range>(__range), __n, __hf, key_equal(), __a) {}
+# endif
+
+ _LIBCPP_HIDE_FROM_ABI unordered_multimap(initializer_list<value_type> __il, size_type __n, const allocator_type& __a)
: unordered_multimap(__il, __n, hasher(), key_equal(), __a) {}
- _LIBCPP_HIDE_FROM_ABI
- unordered_multimap(initializer_list<value_type> __il, size_type __n, const hasher& __hf,
- const allocator_type& __a)
+ _LIBCPP_HIDE_FROM_ABI
+ unordered_multimap(initializer_list<value_type> __il, size_type __n, const hasher& __hf, const allocator_type& __a)
: unordered_multimap(__il, __n, __hf, key_equal(), __a) {}
#endif
- _LIBCPP_HIDE_FROM_ABI
- ~unordered_multimap() {
- static_assert(sizeof(std::__diagnose_unordered_container_requirements<_Key, _Hash, _Pred>(0)), "");
- }
+ _LIBCPP_HIDE_FROM_ABI ~unordered_multimap() {
+ static_assert(sizeof(std::__diagnose_unordered_container_requirements<_Key, _Hash, _Pred>(0)), "");
+ }
- _LIBCPP_HIDE_FROM_ABI
- unordered_multimap& operator=(const unordered_multimap& __u)
- {
+ _LIBCPP_HIDE_FROM_ABI unordered_multimap& operator=(const unordered_multimap& __u) {
#ifndef _LIBCPP_CXX03_LANG
- __table_ = __u.__table_;
+ __table_ = __u.__table_;
#else
- if (this != std::addressof(__u)) {
- __table_.clear();
- __table_.hash_function() = __u.__table_.hash_function();
- __table_.key_eq() = __u.__table_.key_eq();
- __table_.max_load_factor() = __u.__table_.max_load_factor();
- __table_.__copy_assign_alloc(__u.__table_);
- insert(__u.begin(), __u.end());
- }
-#endif
- return *this;
+ if (this != std::addressof(__u)) {
+ __table_.clear();
+ __table_.hash_function() = __u.__table_.hash_function();
+ __table_.key_eq() = __u.__table_.key_eq();
+ __table_.max_load_factor() = __u.__table_.max_load_factor();
+ __table_.__copy_assign_alloc(__u.__table_);
+ insert(__u.begin(), __u.end());
}
+#endif
+ return *this;
+ }
#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI
- unordered_multimap& operator=(unordered_multimap&& __u)
- _NOEXCEPT_(is_nothrow_move_assignable<__table>::value);
- _LIBCPP_HIDE_FROM_ABI
- unordered_multimap& operator=(initializer_list<value_type> __il);
+ _LIBCPP_HIDE_FROM_ABI unordered_multimap& operator=(unordered_multimap&& __u)
+ _NOEXCEPT_(is_nothrow_move_assignable<__table>::value);
+ _LIBCPP_HIDE_FROM_ABI unordered_multimap& operator=(initializer_list<value_type> __il);
#endif // _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI
- allocator_type get_allocator() const _NOEXCEPT
- {return allocator_type(__table_.__node_alloc());}
-
- _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_HIDE_FROM_ABI
- bool empty() const _NOEXCEPT {return __table_.size() == 0;}
- _LIBCPP_HIDE_FROM_ABI
- size_type size() const _NOEXCEPT {return __table_.size();}
- _LIBCPP_HIDE_FROM_ABI
- size_type max_size() const _NOEXCEPT {return __table_.max_size();}
-
- _LIBCPP_HIDE_FROM_ABI
- iterator begin() _NOEXCEPT {return __table_.begin();}
- _LIBCPP_HIDE_FROM_ABI
- iterator end() _NOEXCEPT {return __table_.end();}
- _LIBCPP_HIDE_FROM_ABI
- const_iterator begin() const _NOEXCEPT {return __table_.begin();}
- _LIBCPP_HIDE_FROM_ABI
- const_iterator end() const _NOEXCEPT {return __table_.end();}
- _LIBCPP_HIDE_FROM_ABI
- const_iterator cbegin() const _NOEXCEPT {return __table_.begin();}
- _LIBCPP_HIDE_FROM_ABI
- const_iterator cend() const _NOEXCEPT {return __table_.end();}
-
- _LIBCPP_HIDE_FROM_ABI
- iterator insert(const value_type& __x) {return __table_.__insert_multi(__x);}
-
- _LIBCPP_HIDE_FROM_ABI
- iterator insert(const_iterator __p, const value_type& __x)
- {return __table_.__insert_multi(__p.__i_, __x);}
-
- template <class _InputIterator>
- _LIBCPP_HIDE_FROM_ABI
- void insert(_InputIterator __first, _InputIterator __last);
+ _LIBCPP_HIDE_FROM_ABI allocator_type get_allocator() const _NOEXCEPT {
+ return allocator_type(__table_.__node_alloc());
+ }
+
+ _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_HIDE_FROM_ABI bool empty() const _NOEXCEPT { return __table_.size() == 0; }
+ _LIBCPP_HIDE_FROM_ABI size_type size() const _NOEXCEPT { return __table_.size(); }
+ _LIBCPP_HIDE_FROM_ABI size_type max_size() const _NOEXCEPT { return __table_.max_size(); }
+
+ _LIBCPP_HIDE_FROM_ABI iterator begin() _NOEXCEPT { return __table_.begin(); }
+ _LIBCPP_HIDE_FROM_ABI iterator end() _NOEXCEPT { return __table_.end(); }
+ _LIBCPP_HIDE_FROM_ABI const_iterator begin() const _NOEXCEPT { return __table_.begin(); }
+ _LIBCPP_HIDE_FROM_ABI const_iterator end() const _NOEXCEPT { return __table_.end(); }
+ _LIBCPP_HIDE_FROM_ABI const_iterator cbegin() const _NOEXCEPT { return __table_.begin(); }
+ _LIBCPP_HIDE_FROM_ABI const_iterator cend() const _NOEXCEPT { return __table_.end(); }
+
+ _LIBCPP_HIDE_FROM_ABI iterator insert(const value_type& __x) { return __table_.__insert_multi(__x); }
+
+ _LIBCPP_HIDE_FROM_ABI iterator insert(const_iterator __p, const value_type& __x) {
+ return __table_.__insert_multi(__p.__i_, __x);
+ }
+
+ template <class _InputIterator>
+ _LIBCPP_HIDE_FROM_ABI void insert(_InputIterator __first, _InputIterator __last);
#if _LIBCPP_STD_VER >= 23
- template <_ContainerCompatibleRange<value_type> _Range>
- _LIBCPP_HIDE_FROM_ABI
- void insert_range(_Range&& __range) {
- for (auto&& __element : __range) {
- __table_.__insert_multi(std::forward<decltype(__element)>(__element));
- }
+ template <_ContainerCompatibleRange<value_type> _Range>
+ _LIBCPP_HIDE_FROM_ABI void insert_range(_Range&& __range) {
+ for (auto&& __element : __range) {
+ __table_.__insert_multi(std::forward<decltype(__element)>(__element));
}
+ }
#endif
#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI
- void insert(initializer_list<value_type> __il)
- {insert(__il.begin(), __il.end());}
- _LIBCPP_HIDE_FROM_ABI
- iterator insert(value_type&& __x) {return __table_.__insert_multi(std::move(__x));}
-
- _LIBCPP_HIDE_FROM_ABI
- iterator insert(const_iterator __p, value_type&& __x)
- {return __table_.__insert_multi(__p.__i_, std::move(__x));}
-
- template <class _Pp,
- class = __enable_if_t<is_constructible<value_type, _Pp>::value> >
- _LIBCPP_HIDE_FROM_ABI
- iterator insert(_Pp&& __x)
- {return __table_.__insert_multi(std::forward<_Pp>(__x));}
-
- template <class _Pp,
- class = __enable_if_t<is_constructible<value_type, _Pp>::value> >
- _LIBCPP_HIDE_FROM_ABI
- iterator insert(const_iterator __p, _Pp&& __x)
- {return __table_.__insert_multi(__p.__i_, std::forward<_Pp>(__x));}
-
- template <class... _Args>
- _LIBCPP_HIDE_FROM_ABI iterator emplace(_Args&&... __args) {
- return __table_.__emplace_multi(std::forward<_Args>(__args)...);
- }
-
- template <class... _Args>
- _LIBCPP_HIDE_FROM_ABI iterator emplace_hint(const_iterator __p, _Args&&... __args) {
- return __table_.__emplace_hint_multi(__p.__i_, std::forward<_Args>(__args)...);
- }
+ _LIBCPP_HIDE_FROM_ABI void insert(initializer_list<value_type> __il) { insert(__il.begin(), __il.end()); }
+ _LIBCPP_HIDE_FROM_ABI iterator insert(value_type&& __x) { return __table_.__insert_multi(std::move(__x)); }
+
+ _LIBCPP_HIDE_FROM_ABI iterator insert(const_iterator __p, value_type&& __x) {
+ return __table_.__insert_multi(__p.__i_, std::move(__x));
+ }
+
+ template <class _Pp, class = __enable_if_t<is_constructible<value_type, _Pp>::value> >
+ _LIBCPP_HIDE_FROM_ABI iterator insert(_Pp&& __x) {
+ return __table_.__insert_multi(std::forward<_Pp>(__x));
+ }
+
+ template <class _Pp, class = __enable_if_t<is_constructible<value_type, _Pp>::value> >
+ _LIBCPP_HIDE_FROM_ABI iterator insert(const_iterator __p, _Pp&& __x) {
+ return __table_.__insert_multi(__p.__i_, std::forward<_Pp>(__x));
+ }
+
+ template <class... _Args>
+ _LIBCPP_HIDE_FROM_ABI iterator emplace(_Args&&... __args) {
+ return __table_.__emplace_multi(std::forward<_Args>(__args)...);
+ }
+
+ template <class... _Args>
+ _LIBCPP_HIDE_FROM_ABI iterator emplace_hint(const_iterator __p, _Args&&... __args) {
+ return __table_.__emplace_hint_multi(__p.__i_, std::forward<_Args>(__args)...);
+ }
#endif // _LIBCPP_CXX03_LANG
-
- _LIBCPP_HIDE_FROM_ABI
- iterator erase(const_iterator __p) {return __table_.erase(__p.__i_);}
- _LIBCPP_HIDE_FROM_ABI
- iterator erase(iterator __p) {return __table_.erase(__p.__i_);}
- _LIBCPP_HIDE_FROM_ABI
- size_type erase(const key_type& __k) {return __table_.__erase_multi(__k);}
- _LIBCPP_HIDE_FROM_ABI
- iterator erase(const_iterator __first, const_iterator __last)
- {return __table_.erase(__first.__i_, __last.__i_);}
- _LIBCPP_HIDE_FROM_ABI
- void clear() _NOEXCEPT {__table_.clear();}
+ _LIBCPP_HIDE_FROM_ABI iterator erase(const_iterator __p) { return __table_.erase(__p.__i_); }
+ _LIBCPP_HIDE_FROM_ABI iterator erase(iterator __p) { return __table_.erase(__p.__i_); }
+ _LIBCPP_HIDE_FROM_ABI size_type erase(const key_type& __k) { return __table_.__erase_multi(__k); }
+ _LIBCPP_HIDE_FROM_ABI iterator erase(const_iterator __first, const_iterator __last) {
+ return __table_.erase(__first.__i_, __last.__i_);
+ }
+ _LIBCPP_HIDE_FROM_ABI void clear() _NOEXCEPT { __table_.clear(); }
#if _LIBCPP_STD_VER >= 17
- _LIBCPP_HIDE_FROM_ABI
- iterator insert(node_type&& __nh)
- {
- _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(__nh.empty() || __nh.get_allocator() == get_allocator(),
- "node_type with incompatible allocator passed to unordered_multimap::insert()");
- return __table_.template __node_handle_insert_multi<node_type>(
- std::move(__nh));
- }
- _LIBCPP_HIDE_FROM_ABI
- iterator insert(const_iterator __hint, node_type&& __nh)
- {
- _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(__nh.empty() || __nh.get_allocator() == get_allocator(),
- "node_type with incompatible allocator passed to unordered_multimap::insert()");
- return __table_.template __node_handle_insert_multi<node_type>(
- __hint.__i_, std::move(__nh));
- }
- _LIBCPP_HIDE_FROM_ABI
- node_type extract(key_type const& __key)
- {
- return __table_.template __node_handle_extract<node_type>(__key);
- }
- _LIBCPP_HIDE_FROM_ABI
- node_type extract(const_iterator __it)
- {
- return __table_.template __node_handle_extract<node_type>(
- __it.__i_);
- }
-
- template <class _H2, class _P2>
- _LIBCPP_HIDE_FROM_ABI
- void merge(unordered_multimap<key_type, mapped_type, _H2, _P2, allocator_type>& __source)
- {
- _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(__source.get_allocator() == get_allocator(),
- "merging container with incompatible allocator");
- return __table_.__node_handle_merge_multi(__source.__table_);
- }
- template <class _H2, class _P2>
- _LIBCPP_HIDE_FROM_ABI
- void merge(unordered_multimap<key_type, mapped_type, _H2, _P2, allocator_type>&& __source)
- {
- _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(__source.get_allocator() == get_allocator(),
- "merging container with incompatible allocator");
- return __table_.__node_handle_merge_multi(__source.__table_);
- }
- template <class _H2, class _P2>
- _LIBCPP_HIDE_FROM_ABI
- void merge(unordered_map<key_type, mapped_type, _H2, _P2, allocator_type>& __source)
- {
- _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(__source.get_allocator() == get_allocator(),
- "merging container with incompatible allocator");
- return __table_.__node_handle_merge_multi(__source.__table_);
- }
- template <class _H2, class _P2>
- _LIBCPP_HIDE_FROM_ABI
- void merge(unordered_map<key_type, mapped_type, _H2, _P2, allocator_type>&& __source)
- {
- _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(__source.get_allocator() == get_allocator(),
- "merging container with incompatible allocator");
- return __table_.__node_handle_merge_multi(__source.__table_);
- }
+ _LIBCPP_HIDE_FROM_ABI iterator insert(node_type&& __nh) {
+ _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(__nh.empty() || __nh.get_allocator() == get_allocator(),
+ "node_type with incompatible allocator passed to unordered_multimap::insert()");
+ return __table_.template __node_handle_insert_multi<node_type>(std::move(__nh));
+ }
+ _LIBCPP_HIDE_FROM_ABI iterator insert(const_iterator __hint, node_type&& __nh) {
+ _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(__nh.empty() || __nh.get_allocator() == get_allocator(),
+ "node_type with incompatible allocator passed to unordered_multimap::insert()");
+ return __table_.template __node_handle_insert_multi<node_type>(__hint.__i_, std::move(__nh));
+ }
+ _LIBCPP_HIDE_FROM_ABI node_type extract(key_type const& __key) {
+ return __table_.template __node_handle_extract<node_type>(__key);
+ }
+ _LIBCPP_HIDE_FROM_ABI node_type extract(const_iterator __it) {
+ return __table_.template __node_handle_extract<node_type>(__it.__i_);
+ }
+
+ template <class _H2, class _P2>
+ _LIBCPP_HIDE_FROM_ABI void merge(unordered_multimap<key_type, mapped_type, _H2, _P2, allocator_type>& __source) {
+ _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(
+ __source.get_allocator() == get_allocator(), "merging container with incompatible allocator");
+ return __table_.__node_handle_merge_multi(__source.__table_);
+ }
+ template <class _H2, class _P2>
+ _LIBCPP_HIDE_FROM_ABI void merge(unordered_multimap<key_type, mapped_type, _H2, _P2, allocator_type>&& __source) {
+ _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(
+ __source.get_allocator() == get_allocator(), "merging container with incompatible allocator");
+ return __table_.__node_handle_merge_multi(__source.__table_);
+ }
+ template <class _H2, class _P2>
+ _LIBCPP_HIDE_FROM_ABI void merge(unordered_map<key_type, mapped_type, _H2, _P2, allocator_type>& __source) {
+ _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(
+ __source.get_allocator() == get_allocator(), "merging container with incompatible allocator");
+ return __table_.__node_handle_merge_multi(__source.__table_);
+ }
+ template <class _H2, class _P2>
+ _LIBCPP_HIDE_FROM_ABI void merge(unordered_map<key_type, mapped_type, _H2, _P2, allocator_type>&& __source) {
+ _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(
+ __source.get_allocator() == get_allocator(), "merging container with incompatible allocator");
+ return __table_.__node_handle_merge_multi(__source.__table_);
+ }
#endif
- _LIBCPP_HIDE_FROM_ABI
- void swap(unordered_multimap& __u)
- _NOEXCEPT_(__is_nothrow_swappable<__table>::value)
- {__table_.swap(__u.__table_);}
-
- _LIBCPP_HIDE_FROM_ABI
- hasher hash_function() const
- {return __table_.hash_function().hash_function();}
- _LIBCPP_HIDE_FROM_ABI
- key_equal key_eq() const
- {return __table_.key_eq().key_eq();}
-
- _LIBCPP_HIDE_FROM_ABI
- iterator find(const key_type& __k) {return __table_.find(__k);}
- _LIBCPP_HIDE_FROM_ABI
- const_iterator find(const key_type& __k) const {return __table_.find(__k);}
+ _LIBCPP_HIDE_FROM_ABI void swap(unordered_multimap& __u) _NOEXCEPT_(__is_nothrow_swappable<__table>::value) {
+ __table_.swap(__u.__table_);
+ }
+
+ _LIBCPP_HIDE_FROM_ABI hasher hash_function() const { return __table_.hash_function().hash_function(); }
+ _LIBCPP_HIDE_FROM_ABI key_equal key_eq() const { return __table_.key_eq().key_eq(); }
+
+ _LIBCPP_HIDE_FROM_ABI iterator find(const key_type& __k) { return __table_.find(__k); }
+ _LIBCPP_HIDE_FROM_ABI const_iterator find(const key_type& __k) const { return __table_.find(__k); }
#if _LIBCPP_STD_VER >= 20
- template <class _K2, enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr>
- _LIBCPP_HIDE_FROM_ABI
- iterator find(const _K2& __k) {return __table_.find(__k);}
- template <class _K2, enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr>
- _LIBCPP_HIDE_FROM_ABI
- const_iterator find(const _K2& __k) const {return __table_.find(__k);}
+ template <class _K2,
+ enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr>
+ _LIBCPP_HIDE_FROM_ABI iterator find(const _K2& __k) {
+ return __table_.find(__k);
+ }
+ template <class _K2,
+ enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr>
+ _LIBCPP_HIDE_FROM_ABI const_iterator find(const _K2& __k) const {
+ return __table_.find(__k);
+ }
#endif // _LIBCPP_STD_VER >= 20
- _LIBCPP_HIDE_FROM_ABI
- size_type count(const key_type& __k) const {return __table_.__count_multi(__k);}
+ _LIBCPP_HIDE_FROM_ABI size_type count(const key_type& __k) const { return __table_.__count_multi(__k); }
#if _LIBCPP_STD_VER >= 20
- template <class _K2, enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr>
- _LIBCPP_HIDE_FROM_ABI
- size_type count(const _K2& __k) const {return __table_.__count_multi(__k);}
+ template <class _K2,
+ enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr>
+ _LIBCPP_HIDE_FROM_ABI size_type count(const _K2& __k) const {
+ return __table_.__count_multi(__k);
+ }
#endif // _LIBCPP_STD_VER >= 20
#if _LIBCPP_STD_VER >= 20
- _LIBCPP_HIDE_FROM_ABI
- bool contains(const key_type& __k) const {return find(__k) != end();}
+ _LIBCPP_HIDE_FROM_ABI bool contains(const key_type& __k) const { return find(__k) != end(); }
- template <class _K2, enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr>
- _LIBCPP_HIDE_FROM_ABI
- bool contains(const _K2& __k) const {return find(__k) != end();}
+ template <class _K2,
+ enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr>
+ _LIBCPP_HIDE_FROM_ABI bool contains(const _K2& __k) const {
+ return find(__k) != end();
+ }
#endif // _LIBCPP_STD_VER >= 20
- _LIBCPP_HIDE_FROM_ABI
- pair<iterator, iterator> equal_range(const key_type& __k)
- {return __table_.__equal_range_multi(__k);}
- _LIBCPP_HIDE_FROM_ABI
- pair<const_iterator, const_iterator> equal_range(const key_type& __k) const
- {return __table_.__equal_range_multi(__k);}
+ _LIBCPP_HIDE_FROM_ABI pair<iterator, iterator> equal_range(const key_type& __k) {
+ return __table_.__equal_range_multi(__k);
+ }
+ _LIBCPP_HIDE_FROM_ABI pair<const_iterator, const_iterator> equal_range(const key_type& __k) const {
+ return __table_.__equal_range_multi(__k);
+ }
#if _LIBCPP_STD_VER >= 20
- template <class _K2, enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr>
- _LIBCPP_HIDE_FROM_ABI
- pair<iterator, iterator> equal_range(const _K2& __k)
- {return __table_.__equal_range_multi(__k);}
- template <class _K2, enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr>
- _LIBCPP_HIDE_FROM_ABI
- pair<const_iterator, const_iterator> equal_range(const _K2& __k) const
- {return __table_.__equal_range_multi(__k);}
+ template <class _K2,
+ enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr>
+ _LIBCPP_HIDE_FROM_ABI pair<iterator, iterator> equal_range(const _K2& __k) {
+ return __table_.__equal_range_multi(__k);
+ }
+ template <class _K2,
+ enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr>
+ _LIBCPP_HIDE_FROM_ABI pair<const_iterator, const_iterator> equal_range(const _K2& __k) const {
+ return __table_.__equal_range_multi(__k);
+ }
#endif // _LIBCPP_STD_VER >= 20
- _LIBCPP_HIDE_FROM_ABI
- size_type bucket_count() const _NOEXCEPT {return __table_.bucket_count();}
- _LIBCPP_HIDE_FROM_ABI
- size_type max_bucket_count() const _NOEXCEPT
- {return __table_.max_bucket_count();}
-
- _LIBCPP_HIDE_FROM_ABI
- size_type bucket_size(size_type __n) const
- {return __table_.bucket_size(__n);}
- _LIBCPP_HIDE_FROM_ABI
- size_type bucket(const key_type& __k) const {return __table_.bucket(__k);}
-
- _LIBCPP_HIDE_FROM_ABI
- local_iterator begin(size_type __n) {return __table_.begin(__n);}
- _LIBCPP_HIDE_FROM_ABI
- local_iterator end(size_type __n) {return __table_.end(__n);}
- _LIBCPP_HIDE_FROM_ABI
- const_local_iterator begin(size_type __n) const {return __table_.cbegin(__n);}
- _LIBCPP_HIDE_FROM_ABI
- const_local_iterator end(size_type __n) const {return __table_.cend(__n);}
- _LIBCPP_HIDE_FROM_ABI
- const_local_iterator cbegin(size_type __n) const {return __table_.cbegin(__n);}
- _LIBCPP_HIDE_FROM_ABI
- const_local_iterator cend(size_type __n) const {return __table_.cend(__n);}
-
- _LIBCPP_HIDE_FROM_ABI
- float load_factor() const _NOEXCEPT {return __table_.load_factor();}
- _LIBCPP_HIDE_FROM_ABI
- float max_load_factor() const _NOEXCEPT {return __table_.max_load_factor();}
- _LIBCPP_HIDE_FROM_ABI
- void max_load_factor(float __mlf) {__table_.max_load_factor(__mlf);}
- _LIBCPP_HIDE_FROM_ABI
- void rehash(size_type __n) {__table_.__rehash_multi(__n);}
- _LIBCPP_HIDE_FROM_ABI
- void reserve(size_type __n) {__table_.__reserve_multi(__n);}
+ _LIBCPP_HIDE_FROM_ABI size_type bucket_count() const _NOEXCEPT { return __table_.bucket_count(); }
+ _LIBCPP_HIDE_FROM_ABI size_type max_bucket_count() const _NOEXCEPT { return __table_.max_bucket_count(); }
+
+ _LIBCPP_HIDE_FROM_ABI size_type bucket_size(size_type __n) const { return __table_.bucket_size(__n); }
+ _LIBCPP_HIDE_FROM_ABI size_type bucket(const key_type& __k) const { return __table_.bucket(__k); }
+
+ _LIBCPP_HIDE_FROM_ABI local_iterator begin(size_type __n) { return __table_.begin(__n); }
+ _LIBCPP_HIDE_FROM_ABI local_iterator end(size_type __n) { return __table_.end(__n); }
+ _LIBCPP_HIDE_FROM_ABI const_local_iterator begin(size_type __n) const { return __table_.cbegin(__n); }
+ _LIBCPP_HIDE_FROM_ABI const_local_iterator end(size_type __n) const { return __table_.cend(__n); }
+ _LIBCPP_HIDE_FROM_ABI const_local_iterator cbegin(size_type __n) const { return __table_.cbegin(__n); }
+ _LIBCPP_HIDE_FROM_ABI const_local_iterator cend(size_type __n) const { return __table_.cend(__n); }
+
+ _LIBCPP_HIDE_FROM_ABI float load_factor() const _NOEXCEPT { return __table_.load_factor(); }
+ _LIBCPP_HIDE_FROM_ABI float max_load_factor() const _NOEXCEPT { return __table_.max_load_factor(); }
+ _LIBCPP_HIDE_FROM_ABI void max_load_factor(float __mlf) { __table_.max_load_factor(__mlf); }
+ _LIBCPP_HIDE_FROM_ABI void rehash(size_type __n) { __table_.__rehash_multi(__n); }
+ _LIBCPP_HIDE_FROM_ABI void reserve(size_type __n) { __table_.__reserve_multi(__n); }
};
#if _LIBCPP_STD_VER >= 17
-template<class _InputIterator,
- class _Hash = hash<__iter_key_type<_InputIterator>>,
- class _Pred = equal_to<__iter_key_type<_InputIterator>>,
- class _Allocator = allocator<__iter_to_alloc_type<_InputIterator>>,
- class = enable_if_t<__has_input_iterator_category<_InputIterator>::value>,
- class = enable_if_t<!__is_allocator<_Hash>::value>,
- class = enable_if_t<!is_integral<_Hash>::value>,
- class = enable_if_t<!__is_allocator<_Pred>::value>,
- class = enable_if_t<__is_allocator<_Allocator>::value>>
-unordered_multimap(_InputIterator, _InputIterator, typename allocator_traits<_Allocator>::size_type = 0,
- _Hash = _Hash(), _Pred = _Pred(), _Allocator = _Allocator())
- -> unordered_multimap<__iter_key_type<_InputIterator>, __iter_mapped_type<_InputIterator>, _Hash, _Pred, _Allocator>;
-
-#if _LIBCPP_STD_VER >= 23
+template <class _InputIterator,
+ class _Hash = hash<__iter_key_type<_InputIterator>>,
+ class _Pred = equal_to<__iter_key_type<_InputIterator>>,
+ class _Allocator = allocator<__iter_to_alloc_type<_InputIterator>>,
+ class = enable_if_t<__has_input_iterator_category<_InputIterator>::value>,
+ class = enable_if_t<!__is_allocator<_Hash>::value>,
+ class = enable_if_t<!is_integral<_Hash>::value>,
+ class = enable_if_t<!__is_allocator<_Pred>::value>,
+ class = enable_if_t<__is_allocator<_Allocator>::value>>
+unordered_multimap(_InputIterator,
+ _InputIterator,
+ typename allocator_traits<_Allocator>::size_type = 0,
+ _Hash = _Hash(),
+ _Pred = _Pred(),
+ _Allocator = _Allocator())
+ -> unordered_multimap<__iter_key_type<_InputIterator>,
+ __iter_mapped_type<_InputIterator>,
+ _Hash,
+ _Pred,
+ _Allocator>;
+
+# if _LIBCPP_STD_VER >= 23
template <ranges::input_range _Range,
- class _Hash = hash<__range_key_type<_Range>>,
- class _Pred = equal_to<__range_key_type<_Range>>,
+ class _Hash = hash<__range_key_type<_Range>>,
+ class _Pred = equal_to<__range_key_type<_Range>>,
class _Allocator = allocator<__range_to_alloc_type<_Range>>,
- class = enable_if_t<!__is_allocator<_Hash>::value>,
- class = enable_if_t<!is_integral<_Hash>::value>,
- class = enable_if_t<!__is_allocator<_Pred>::value>,
+ class = enable_if_t<!__is_allocator<_Hash>::value>,
+ class = enable_if_t<!is_integral<_Hash>::value>,
+ class = enable_if_t<!__is_allocator<_Pred>::value>,
+ class = enable_if_t<__is_allocator<_Allocator>::value>>
+unordered_multimap(from_range_t,
+ _Range&&,
+ typename allocator_traits<_Allocator>::size_type = 0,
+ _Hash = _Hash(),
+ _Pred = _Pred(),
+ _Allocator = _Allocator())
+ -> unordered_multimap<__range_key_type<_Range>, __range_mapped_type<_Range>, _Hash, _Pred, _Allocator>;
+# endif
+
+template <class _Key,
+ class _Tp,
+ class _Hash = hash<remove_const_t<_Key>>,
+ class _Pred = equal_to<remove_const_t<_Key>>,
+ class _Allocator = allocator<pair<const _Key, _Tp>>,
+ class = enable_if_t<!__is_allocator<_Hash>::value>,
+ class = enable_if_t<!is_integral<_Hash>::value>,
+ class = enable_if_t<!__is_allocator<_Pred>::value>,
+ class = enable_if_t<__is_allocator<_Allocator>::value>>
+unordered_multimap(initializer_list<pair<_Key, _Tp>>,
+ typename allocator_traits<_Allocator>::size_type = 0,
+ _Hash = _Hash(),
+ _Pred = _Pred(),
+ _Allocator = _Allocator())
+ -> unordered_multimap<remove_const_t<_Key>, _Tp, _Hash, _Pred, _Allocator>;
+
+template <class _InputIterator,
+ class _Allocator,
+ class = enable_if_t<__has_input_iterator_category<_InputIterator>::value>,
class = enable_if_t<__is_allocator<_Allocator>::value>>
-unordered_multimap(from_range_t, _Range&&, typename allocator_traits<_Allocator>::size_type = 0,
- _Hash = _Hash(), _Pred = _Pred(), _Allocator = _Allocator())
- -> unordered_multimap<__range_key_type<_Range>, __range_mapped_type<_Range>, _Hash, _Pred, _Allocator>;
-#endif
-
-template<class _Key, class _Tp, class _Hash = hash<remove_const_t<_Key>>,
- class _Pred = equal_to<remove_const_t<_Key>>,
- class _Allocator = allocator<pair<const _Key, _Tp>>,
- class = enable_if_t<!__is_allocator<_Hash>::value>,
- class = enable_if_t<!is_integral<_Hash>::value>,
- class = enable_if_t<!__is_allocator<_Pred>::value>,
- class = enable_if_t<__is_allocator<_Allocator>::value>>
-unordered_multimap(initializer_list<pair<_Key, _Tp>>, typename allocator_traits<_Allocator>::size_type = 0,
- _Hash = _Hash(), _Pred = _Pred(), _Allocator = _Allocator())
- -> unordered_multimap<remove_const_t<_Key>, _Tp, _Hash, _Pred, _Allocator>;
-
-template<class _InputIterator, class _Allocator,
- class = enable_if_t<__has_input_iterator_category<_InputIterator>::value>,
- class = enable_if_t<__is_allocator<_Allocator>::value>>
unordered_multimap(_InputIterator, _InputIterator, typename allocator_traits<_Allocator>::size_type, _Allocator)
- -> unordered_multimap<__iter_key_type<_InputIterator>, __iter_mapped_type<_InputIterator>,
- hash<__iter_key_type<_InputIterator>>, equal_to<__iter_key_type<_InputIterator>>, _Allocator>;
-
-template<class _InputIterator, class _Allocator,
- class = enable_if_t<__has_input_iterator_category<_InputIterator>::value>,
- class = enable_if_t<__is_allocator<_Allocator>::value>>
+ -> unordered_multimap<__iter_key_type<_InputIterator>,
+ __iter_mapped_type<_InputIterator>,
+ hash<__iter_key_type<_InputIterator>>,
+ equal_to<__iter_key_type<_InputIterator>>,
+ _Allocator>;
+
+template <class _InputIterator,
+ class _Allocator,
+ class = enable_if_t<__has_input_iterator_category<_InputIterator>::value>,
+ class = enable_if_t<__is_allocator<_Allocator>::value>>
unordered_multimap(_InputIterator, _InputIterator, _Allocator)
- -> unordered_multimap<__iter_key_type<_InputIterator>, __iter_mapped_type<_InputIterator>,
- hash<__iter_key_type<_InputIterator>>, equal_to<__iter_key_type<_InputIterator>>, _Allocator>;
-
-template<class _InputIterator, class _Hash, class _Allocator,
- class = enable_if_t<__has_input_iterator_category<_InputIterator>::value>,
- class = enable_if_t<!__is_allocator<_Hash>::value>,
- class = enable_if_t<!is_integral<_Hash>::value>,
- class = enable_if_t<__is_allocator<_Allocator>::value>>
+ -> unordered_multimap<__iter_key_type<_InputIterator>,
+ __iter_mapped_type<_InputIterator>,
+ hash<__iter_key_type<_InputIterator>>,
+ equal_to<__iter_key_type<_InputIterator>>,
+ _Allocator>;
+
+template <class _InputIterator,
+ class _Hash,
+ class _Allocator,
+ class = enable_if_t<__has_input_iterator_category<_InputIterator>::value>,
+ class = enable_if_t<!__is_allocator<_Hash>::value>,
+ class = enable_if_t<!is_integral<_Hash>::value>,
+ class = enable_if_t<__is_allocator<_Allocator>::value>>
unordered_multimap(_InputIterator, _InputIterator, typename allocator_traits<_Allocator>::size_type, _Hash, _Allocator)
- -> unordered_multimap<__iter_key_type<_InputIterator>, __iter_mapped_type<_InputIterator>,
- _Hash, equal_to<__iter_key_type<_InputIterator>>, _Allocator>;
+ -> unordered_multimap<__iter_key_type<_InputIterator>,
+ __iter_mapped_type<_InputIterator>,
+ _Hash,
+ equal_to<__iter_key_type<_InputIterator>>,
+ _Allocator>;
-#if _LIBCPP_STD_VER >= 23
+# if _LIBCPP_STD_VER >= 23
-template <ranges::input_range _Range, class _Allocator,
- class = enable_if_t<__is_allocator<_Allocator>::value>>
+template <ranges::input_range _Range, class _Allocator, class = enable_if_t<__is_allocator<_Allocator>::value>>
unordered_multimap(from_range_t, _Range&&, typename allocator_traits<_Allocator>::size_type, _Allocator)
- -> unordered_multimap<__range_key_type<_Range>, __range_mapped_type<_Range>, hash<__range_key_type<_Range>>,
- equal_to<__range_key_type<_Range>>, _Allocator>;
+ -> unordered_multimap<__range_key_type<_Range>,
+ __range_mapped_type<_Range>,
+ hash<__range_key_type<_Range>>,
+ equal_to<__range_key_type<_Range>>,
+ _Allocator>;
-template <ranges::input_range _Range, class _Allocator,
- class = enable_if_t<__is_allocator<_Allocator>::value>>
+template <ranges::input_range _Range, class _Allocator, class = enable_if_t<__is_allocator<_Allocator>::value>>
unordered_multimap(from_range_t, _Range&&, _Allocator)
- -> unordered_multimap<__range_key_type<_Range>, __range_mapped_type<_Range>, hash<__range_key_type<_Range>>,
- equal_to<__range_key_type<_Range>>, _Allocator>;
+ -> unordered_multimap<__range_key_type<_Range>,
+ __range_mapped_type<_Range>,
+ hash<__range_key_type<_Range>>,
+ equal_to<__range_key_type<_Range>>,
+ _Allocator>;
-template <ranges::input_range _Range, class _Hash, class _Allocator,
+template <ranges::input_range _Range,
+ class _Hash,
+ class _Allocator,
class = enable_if_t<!__is_allocator<_Hash>::value>,
class = enable_if_t<!is_integral<_Hash>::value>,
class = enable_if_t<__is_allocator<_Allocator>::value>>
unordered_multimap(from_range_t, _Range&&, typename allocator_traits<_Allocator>::size_type, _Hash, _Allocator)
- -> unordered_multimap<__range_key_type<_Range>, __range_mapped_type<_Range>, _Hash,
- equal_to<__range_key_type<_Range>>, _Allocator>;
+ -> unordered_multimap<__range_key_type<_Range>,
+ __range_mapped_type<_Range>,
+ _Hash,
+ equal_to<__range_key_type<_Range>>,
+ _Allocator>;
-#endif
+# endif
-template<class _Key, class _Tp, class _Allocator,
- class = enable_if_t<__is_allocator<_Allocator>::value>>
+template <class _Key, class _Tp, class _Allocator, class = enable_if_t<__is_allocator<_Allocator>::value>>
unordered_multimap(initializer_list<pair<_Key, _Tp>>, typename allocator_traits<_Allocator>::size_type, _Allocator)
- -> unordered_multimap<remove_const_t<_Key>, _Tp,
- hash<remove_const_t<_Key>>,
- equal_to<remove_const_t<_Key>>, _Allocator>;
+ -> unordered_multimap<remove_const_t<_Key>,
+ _Tp,
+ hash<remove_const_t<_Key>>,
+ equal_to<remove_const_t<_Key>>,
+ _Allocator>;
-template<class _Key, class _Tp, class _Allocator,
- class = enable_if_t<__is_allocator<_Allocator>::value>>
+template <class _Key, class _Tp, class _Allocator, class = enable_if_t<__is_allocator<_Allocator>::value>>
unordered_multimap(initializer_list<pair<_Key, _Tp>>, _Allocator)
- -> unordered_multimap<remove_const_t<_Key>, _Tp,
- hash<remove_const_t<_Key>>,
- equal_to<remove_const_t<_Key>>, _Allocator>;
-
-template<class _Key, class _Tp, class _Hash, class _Allocator,
- class = enable_if_t<!__is_allocator<_Hash>::value>,
- class = enable_if_t<!is_integral<_Hash>::value>,
- class = enable_if_t<__is_allocator<_Allocator>::value>>
-unordered_multimap(initializer_list<pair<_Key, _Tp>>, typename allocator_traits<_Allocator>::size_type, _Hash, _Allocator)
- -> unordered_multimap<remove_const_t<_Key>, _Tp, _Hash,
- equal_to<remove_const_t<_Key>>, _Allocator>;
+ -> unordered_multimap<remove_const_t<_Key>,
+ _Tp,
+ hash<remove_const_t<_Key>>,
+ equal_to<remove_const_t<_Key>>,
+ _Allocator>;
+
+template <class _Key,
+ class _Tp,
+ class _Hash,
+ class _Allocator,
+ class = enable_if_t<!__is_allocator<_Hash>::value>,
+ class = enable_if_t<!is_integral<_Hash>::value>,
+ class = enable_if_t<__is_allocator<_Allocator>::value>>
+unordered_multimap(
+ initializer_list<pair<_Key, _Tp>>, typename allocator_traits<_Allocator>::size_type, _Hash, _Allocator)
+ -> unordered_multimap<remove_const_t<_Key>, _Tp, _Hash, equal_to<remove_const_t<_Key>>, _Allocator>;
#endif
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_multimap(
- size_type __n, const hasher& __hf, const key_equal& __eql)
- : __table_(__hf, __eql)
-{
- __table_.__rehash_multi(__n);
+ size_type __n, const hasher& __hf, const key_equal& __eql)
+ : __table_(__hf, __eql) {
+ __table_.__rehash_multi(__n);
}
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_multimap(
- size_type __n, const hasher& __hf, const key_equal& __eql,
- const allocator_type& __a)
- : __table_(__hf, __eql, typename __table::allocator_type(__a))
-{
- __table_.__rehash_multi(__n);
+ size_type __n, const hasher& __hf, const key_equal& __eql, const allocator_type& __a)
+ : __table_(__hf, __eql, typename __table::allocator_type(__a)) {
+ __table_.__rehash_multi(__n);
}
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
template <class _InputIterator>
-unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_multimap(
- _InputIterator __first, _InputIterator __last)
-{
- insert(__first, __last);
+unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_multimap(_InputIterator __first, _InputIterator __last) {
+ insert(__first, __last);
}
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
template <class _InputIterator>
unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_multimap(
- _InputIterator __first, _InputIterator __last, size_type __n,
- const hasher& __hf, const key_equal& __eql)
- : __table_(__hf, __eql)
-{
- __table_.__rehash_multi(__n);
- insert(__first, __last);
+ _InputIterator __first, _InputIterator __last, size_type __n, const hasher& __hf, const key_equal& __eql)
+ : __table_(__hf, __eql) {
+ __table_.__rehash_multi(__n);
+ insert(__first, __last);
}
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
template <class _InputIterator>
unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_multimap(
- _InputIterator __first, _InputIterator __last, size_type __n,
- const hasher& __hf, const key_equal& __eql, const allocator_type& __a)
- : __table_(__hf, __eql, typename __table::allocator_type(__a))
-{
- __table_.__rehash_multi(__n);
- insert(__first, __last);
+ _InputIterator __first,
+ _InputIterator __last,
+ size_type __n,
+ const hasher& __hf,
+ const key_equal& __eql,
+ const allocator_type& __a)
+ : __table_(__hf, __eql, typename __table::allocator_type(__a)) {
+ __table_.__rehash_multi(__n);
+ insert(__first, __last);
}
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
-inline
-unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_multimap(
- const allocator_type& __a)
- : __table_(typename __table::allocator_type(__a))
-{
-}
+inline unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_multimap(const allocator_type& __a)
+ : __table_(typename __table::allocator_type(__a)) {}
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
-unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_multimap(
- const unordered_multimap& __u)
- : __table_(__u.__table_)
-{
- __table_.__rehash_multi(__u.bucket_count());
- insert(__u.begin(), __u.end());
+unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_multimap(const unordered_multimap& __u)
+ : __table_(__u.__table_) {
+ __table_.__rehash_multi(__u.bucket_count());
+ insert(__u.begin(), __u.end());
}
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_multimap(
- const unordered_multimap& __u, const allocator_type& __a)
- : __table_(__u.__table_, typename __table::allocator_type(__a))
-{
- __table_.__rehash_multi(__u.bucket_count());
- insert(__u.begin(), __u.end());
+ const unordered_multimap& __u, const allocator_type& __a)
+ : __table_(__u.__table_, typename __table::allocator_type(__a)) {
+ __table_.__rehash_multi(__u.bucket_count());
+ insert(__u.begin(), __u.end());
}
#ifndef _LIBCPP_CXX03_LANG
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
-inline
-unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_multimap(
- unordered_multimap&& __u)
+inline unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_multimap(unordered_multimap&& __u)
_NOEXCEPT_(is_nothrow_move_constructible<__table>::value)
- : __table_(std::move(__u.__table_))
-{
-}
+ : __table_(std::move(__u.__table_)) {}
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_multimap(
- unordered_multimap&& __u, const allocator_type& __a)
- : __table_(std::move(__u.__table_), typename __table::allocator_type(__a))
-{
- if (__a != __u.get_allocator())
- {
- iterator __i = __u.begin();
- while (__u.size() != 0)
- {
- __table_.__insert_multi(
- __u.__table_.remove((__i++).__i_)->__get_value().__move());
- }
+ unordered_multimap&& __u, const allocator_type& __a)
+ : __table_(std::move(__u.__table_), typename __table::allocator_type(__a)) {
+ if (__a != __u.get_allocator()) {
+ iterator __i = __u.begin();
+ while (__u.size() != 0) {
+ __table_.__insert_multi(__u.__table_.remove((__i++).__i_)->__get_value().__move());
}
+ }
}
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
-unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_multimap(
- initializer_list<value_type> __il)
-{
- insert(__il.begin(), __il.end());
+unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_multimap(initializer_list<value_type> __il) {
+ insert(__il.begin(), __il.end());
}
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_multimap(
- initializer_list<value_type> __il, size_type __n, const hasher& __hf,
- const key_equal& __eql)
- : __table_(__hf, __eql)
-{
- __table_.__rehash_multi(__n);
- insert(__il.begin(), __il.end());
+ initializer_list<value_type> __il, size_type __n, const hasher& __hf, const key_equal& __eql)
+ : __table_(__hf, __eql) {
+ __table_.__rehash_multi(__n);
+ insert(__il.begin(), __il.end());
}
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_multimap(
- initializer_list<value_type> __il, size_type __n, const hasher& __hf,
- const key_equal& __eql, const allocator_type& __a)
- : __table_(__hf, __eql, typename __table::allocator_type(__a))
-{
- __table_.__rehash_multi(__n);
- insert(__il.begin(), __il.end());
+ initializer_list<value_type> __il,
+ size_type __n,
+ const hasher& __hf,
+ const key_equal& __eql,
+ const allocator_type& __a)
+ : __table_(__hf, __eql, typename __table::allocator_type(__a)) {
+ __table_.__rehash_multi(__n);
+ insert(__il.begin(), __il.end());
}
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
-inline
-unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>&
+inline unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>&
unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::operator=(unordered_multimap&& __u)
- _NOEXCEPT_(is_nothrow_move_assignable<__table>::value)
-{
- __table_ = std::move(__u.__table_);
- return *this;
+ _NOEXCEPT_(is_nothrow_move_assignable<__table>::value) {
+ __table_ = std::move(__u.__table_);
+ return *this;
}
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
-inline
-unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>&
-unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::operator=(
- initializer_list<value_type> __il)
-{
- __table_.__assign_multi(__il.begin(), __il.end());
- return *this;
+inline unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>&
+unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::operator=(initializer_list<value_type> __il) {
+ __table_.__assign_multi(__il.begin(), __il.end());
+ return *this;
}
#endif // _LIBCPP_CXX03_LANG
-
-
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
template <class _InputIterator>
-inline
-void
-unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::insert(_InputIterator __first,
- _InputIterator __last)
-{
- for (; __first != __last; ++__first)
- __table_.__insert_multi(*__first);
+inline void unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::insert(_InputIterator __first, _InputIterator __last) {
+ for (; __first != __last; ++__first)
+ __table_.__insert_multi(*__first);
}
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
-inline _LIBCPP_HIDE_FROM_ABI
-void
-swap(unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
- unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __y)
- _NOEXCEPT_(_NOEXCEPT_(__x.swap(__y)))
-{
- __x.swap(__y);
+inline _LIBCPP_HIDE_FROM_ABI void
+swap(unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __x, unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __y)
+ _NOEXCEPT_(_NOEXCEPT_(__x.swap(__y))) {
+ __x.swap(__y);
}
#if _LIBCPP_STD_VER >= 20
-template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc,
- class _Predicate>
-inline _LIBCPP_HIDE_FROM_ABI
- typename unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::size_type
- erase_if(unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __c,
- _Predicate __pred) {
+template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc, class _Predicate>
+inline _LIBCPP_HIDE_FROM_ABI typename unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::size_type
+erase_if(unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __c, _Predicate __pred) {
return std::__libcpp_erase_if_container(__c, __pred);
}
#endif
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
-_LIBCPP_HIDE_FROM_ABI bool
-operator==(const unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
- const unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __y)
-{
- if (__x.size() != __y.size())
- return false;
- typedef typename unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::const_iterator
- const_iterator;
- typedef pair<const_iterator, const_iterator> _EqRng;
- for (const_iterator __i = __x.begin(), __ex = __x.end(); __i != __ex;)
- {
- _EqRng __xeq = __x.equal_range(__i->first);
- _EqRng __yeq = __y.equal_range(__i->first);
- if (std::distance(__xeq.first, __xeq.second) !=
- std::distance(__yeq.first, __yeq.second) ||
- !std::is_permutation(__xeq.first, __xeq.second, __yeq.first))
- return false;
- __i = __xeq.second;
- }
- return true;
+_LIBCPP_HIDE_FROM_ABI bool operator==(const unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
+ const unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __y) {
+ if (__x.size() != __y.size())
+ return false;
+ typedef typename unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::const_iterator const_iterator;
+ typedef pair<const_iterator, const_iterator> _EqRng;
+ for (const_iterator __i = __x.begin(), __ex = __x.end(); __i != __ex;) {
+ _EqRng __xeq = __x.equal_range(__i->first);
+ _EqRng __yeq = __y.equal_range(__i->first);
+ if (std::distance(__xeq.first, __xeq.second) != std::distance(__yeq.first, __yeq.second) ||
+ !std::is_permutation(__xeq.first, __xeq.second, __yeq.first))
+ return false;
+ __i = __xeq.second;
+ }
+ return true;
}
#if _LIBCPP_STD_VER <= 17
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator!=(const unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
- const unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __y)
-{
- return !(__x == __y);
+inline _LIBCPP_HIDE_FROM_ABI bool operator!=(const unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
+ const unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __y) {
+ return !(__x == __y);
}
#endif
diff --git a/contrib/llvm-project/libcxx/include/unordered_set b/contrib/llvm-project/libcxx/include/unordered_set
index 4f78bfde11af..6414885f4c51 100644
--- a/contrib/llvm-project/libcxx/include/unordered_set
+++ b/contrib/llvm-project/libcxx/include/unordered_set
@@ -575,1388 +575,1222 @@ _LIBCPP_BEGIN_NAMESPACE_STD
template <class _Value, class _Hash, class _Pred, class _Alloc>
class unordered_multiset;
-template <class _Value, class _Hash = hash<_Value>, class _Pred = equal_to<_Value>,
- class _Alloc = allocator<_Value> >
-class _LIBCPP_TEMPLATE_VIS unordered_set
-{
+template <class _Value, class _Hash = hash<_Value>, class _Pred = equal_to<_Value>, class _Alloc = allocator<_Value> >
+class _LIBCPP_TEMPLATE_VIS unordered_set {
public:
- // types
- typedef _Value key_type;
- typedef key_type value_type;
- typedef __type_identity_t<_Hash> hasher;
- typedef __type_identity_t<_Pred> key_equal;
- typedef __type_identity_t<_Alloc> allocator_type;
- typedef value_type& reference;
- typedef const value_type& const_reference;
- static_assert((is_same<value_type, typename allocator_type::value_type>::value),
- "Allocator::value_type must be same type as value_type");
+ // types
+ typedef _Value key_type;
+ typedef key_type value_type;
+ typedef __type_identity_t<_Hash> hasher;
+ typedef __type_identity_t<_Pred> key_equal;
+ typedef __type_identity_t<_Alloc> allocator_type;
+ typedef value_type& reference;
+ typedef const value_type& const_reference;
+ static_assert((is_same<value_type, typename allocator_type::value_type>::value),
+ "Allocator::value_type must be same type as value_type");
+
+ static_assert(is_same<allocator_type, __rebind_alloc<allocator_traits<allocator_type>, value_type> >::value,
+ "[allocator.requirements] states that rebinding an allocator to the same type should result in the "
+ "original allocator");
- static_assert(is_same<allocator_type, __rebind_alloc<allocator_traits<allocator_type>, value_type> >::value,
- "[allocator.requirements] states that rebinding an allocator to the same type should result in the "
- "original allocator");
-
- private:
- typedef __hash_table<value_type, hasher, key_equal, allocator_type> __table;
+private:
+ typedef __hash_table<value_type, hasher, key_equal, allocator_type> __table;
- __table __table_;
+ __table __table_;
public:
- typedef typename __table::pointer pointer;
- typedef typename __table::const_pointer const_pointer;
- typedef typename __table::size_type size_type;
- typedef typename __table::difference_type difference_type;
+ typedef typename __table::pointer pointer;
+ typedef typename __table::const_pointer const_pointer;
+ typedef typename __table::size_type size_type;
+ typedef typename __table::difference_type difference_type;
- typedef typename __table::const_iterator iterator;
- typedef typename __table::const_iterator const_iterator;
- typedef typename __table::const_local_iterator local_iterator;
- typedef typename __table::const_local_iterator const_local_iterator;
+ typedef typename __table::const_iterator iterator;
+ typedef typename __table::const_iterator const_iterator;
+ typedef typename __table::const_local_iterator local_iterator;
+ typedef typename __table::const_local_iterator const_local_iterator;
#if _LIBCPP_STD_VER >= 17
- typedef __set_node_handle<typename __table::__node, allocator_type> node_type;
- typedef __insert_return_type<iterator, node_type> insert_return_type;
+ typedef __set_node_handle<typename __table::__node, allocator_type> node_type;
+ typedef __insert_return_type<iterator, node_type> insert_return_type;
#endif
- template <class _Value2, class _Hash2, class _Pred2, class _Alloc2>
- friend class _LIBCPP_TEMPLATE_VIS unordered_set;
- template <class _Value2, class _Hash2, class _Pred2, class _Alloc2>
- friend class _LIBCPP_TEMPLATE_VIS unordered_multiset;
+ template <class _Value2, class _Hash2, class _Pred2, class _Alloc2>
+ friend class _LIBCPP_TEMPLATE_VIS unordered_set;
+ template <class _Value2, class _Hash2, class _Pred2, class _Alloc2>
+ friend class _LIBCPP_TEMPLATE_VIS unordered_multiset;
- _LIBCPP_HIDE_FROM_ABI
- unordered_set()
- _NOEXCEPT_(is_nothrow_default_constructible<__table>::value)
- {
- }
- explicit _LIBCPP_HIDE_FROM_ABI unordered_set(size_type __n, const hasher& __hf = hasher(),
- const key_equal& __eql = key_equal());
+ _LIBCPP_HIDE_FROM_ABI unordered_set() _NOEXCEPT_(is_nothrow_default_constructible<__table>::value) {}
+ explicit _LIBCPP_HIDE_FROM_ABI
+ unordered_set(size_type __n, const hasher& __hf = hasher(), const key_equal& __eql = key_equal());
#if _LIBCPP_STD_VER >= 14
- inline _LIBCPP_HIDE_FROM_ABI
- unordered_set(size_type __n, const allocator_type& __a)
- : unordered_set(__n, hasher(), key_equal(), __a) {}
- inline _LIBCPP_HIDE_FROM_ABI
- unordered_set(size_type __n, const hasher& __hf, const allocator_type& __a)
- : unordered_set(__n, __hf, key_equal(), __a) {}
+ inline _LIBCPP_HIDE_FROM_ABI unordered_set(size_type __n, const allocator_type& __a)
+ : unordered_set(__n, hasher(), key_equal(), __a) {}
+ inline _LIBCPP_HIDE_FROM_ABI unordered_set(size_type __n, const hasher& __hf, const allocator_type& __a)
+ : unordered_set(__n, __hf, key_equal(), __a) {}
#endif
- _LIBCPP_HIDE_FROM_ABI unordered_set(size_type __n, const hasher& __hf, const key_equal& __eql,
- const allocator_type& __a);
- template <class _InputIterator>
- _LIBCPP_HIDE_FROM_ABI unordered_set(_InputIterator __first, _InputIterator __last);
- template <class _InputIterator>
- _LIBCPP_HIDE_FROM_ABI unordered_set(_InputIterator __first, _InputIterator __last,
- size_type __n, const hasher& __hf = hasher(),
- const key_equal& __eql = key_equal());
- template <class _InputIterator>
- _LIBCPP_HIDE_FROM_ABI unordered_set(_InputIterator __first, _InputIterator __last,
- size_type __n, const hasher& __hf, const key_equal& __eql,
- const allocator_type& __a);
+ _LIBCPP_HIDE_FROM_ABI
+ unordered_set(size_type __n, const hasher& __hf, const key_equal& __eql, const allocator_type& __a);
+ template <class _InputIterator>
+ _LIBCPP_HIDE_FROM_ABI unordered_set(_InputIterator __first, _InputIterator __last);
+ template <class _InputIterator>
+ _LIBCPP_HIDE_FROM_ABI
+ unordered_set(_InputIterator __first,
+ _InputIterator __last,
+ size_type __n,
+ const hasher& __hf = hasher(),
+ const key_equal& __eql = key_equal());
+ template <class _InputIterator>
+ _LIBCPP_HIDE_FROM_ABI unordered_set(
+ _InputIterator __first,
+ _InputIterator __last,
+ size_type __n,
+ const hasher& __hf,
+ const key_equal& __eql,
+ const allocator_type& __a);
#if _LIBCPP_STD_VER >= 23
- template <_ContainerCompatibleRange<value_type> _Range>
- _LIBCPP_HIDE_FROM_ABI
- unordered_set(from_range_t, _Range&& __range, size_type __n = /*implementation-defined*/0,
- const hasher& __hf = hasher(), const key_equal& __eql = key_equal(),
- const allocator_type& __a = allocator_type())
- : __table_(__hf, __eql, __a) {
- if (__n > 0) {
- __table_.__rehash_unique(__n);
- }
- insert_range(std::forward<_Range>(__range));
+ template <_ContainerCompatibleRange<value_type> _Range>
+ _LIBCPP_HIDE_FROM_ABI unordered_set(
+ from_range_t,
+ _Range&& __range,
+ size_type __n = /*implementation-defined*/ 0,
+ const hasher& __hf = hasher(),
+ const key_equal& __eql = key_equal(),
+ const allocator_type& __a = allocator_type())
+ : __table_(__hf, __eql, __a) {
+ if (__n > 0) {
+ __table_.__rehash_unique(__n);
}
+ insert_range(std::forward<_Range>(__range));
+ }
#endif
#if _LIBCPP_STD_VER >= 14
- template <class _InputIterator>
- inline _LIBCPP_HIDE_FROM_ABI
- unordered_set(_InputIterator __first, _InputIterator __last,
- size_type __n, const allocator_type& __a)
- : unordered_set(__first, __last, __n, hasher(), key_equal(), __a) {}
- template <class _InputIterator>
- _LIBCPP_HIDE_FROM_ABI unordered_set(_InputIterator __first, _InputIterator __last,
- size_type __n, const hasher& __hf, const allocator_type& __a)
- : unordered_set(__first, __last, __n, __hf, key_equal(), __a) {}
+ template <class _InputIterator>
+ inline _LIBCPP_HIDE_FROM_ABI
+ unordered_set(_InputIterator __first, _InputIterator __last, size_type __n, const allocator_type& __a)
+ : unordered_set(__first, __last, __n, hasher(), key_equal(), __a) {}
+ template <class _InputIterator>
+ _LIBCPP_HIDE_FROM_ABI unordered_set(
+ _InputIterator __first, _InputIterator __last, size_type __n, const hasher& __hf, const allocator_type& __a)
+ : unordered_set(__first, __last, __n, __hf, key_equal(), __a) {}
#endif
#if _LIBCPP_STD_VER >= 23
- template <_ContainerCompatibleRange<value_type> _Range>
- _LIBCPP_HIDE_FROM_ABI
- unordered_set(from_range_t, _Range&& __range, size_type __n, const allocator_type& __a)
- : unordered_set(from_range, std::forward<_Range>(__range), __n, hasher(), key_equal(), __a) {}
-
- template <_ContainerCompatibleRange<value_type> _Range>
- _LIBCPP_HIDE_FROM_ABI
- unordered_set(from_range_t, _Range&& __range, size_type __n, const hasher& __hf, const allocator_type& __a)
- : unordered_set(from_range, std::forward<_Range>(__range), __n, __hf, key_equal(), __a) {}
+ template <_ContainerCompatibleRange<value_type> _Range>
+ _LIBCPP_HIDE_FROM_ABI unordered_set(from_range_t, _Range&& __range, size_type __n, const allocator_type& __a)
+ : unordered_set(from_range, std::forward<_Range>(__range), __n, hasher(), key_equal(), __a) {}
+
+ template <_ContainerCompatibleRange<value_type> _Range>
+ _LIBCPP_HIDE_FROM_ABI
+ unordered_set(from_range_t, _Range&& __range, size_type __n, const hasher& __hf, const allocator_type& __a)
+ : unordered_set(from_range, std::forward<_Range>(__range), __n, __hf, key_equal(), __a) {}
#endif
- _LIBCPP_HIDE_FROM_ABI
- explicit unordered_set(const allocator_type& __a);
- _LIBCPP_HIDE_FROM_ABI unordered_set(const unordered_set& __u);
- _LIBCPP_HIDE_FROM_ABI unordered_set(const unordered_set& __u, const allocator_type& __a);
+ _LIBCPP_HIDE_FROM_ABI explicit unordered_set(const allocator_type& __a);
+ _LIBCPP_HIDE_FROM_ABI unordered_set(const unordered_set& __u);
+ _LIBCPP_HIDE_FROM_ABI unordered_set(const unordered_set& __u, const allocator_type& __a);
#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI
- unordered_set(unordered_set&& __u)
- _NOEXCEPT_(is_nothrow_move_constructible<__table>::value);
- _LIBCPP_HIDE_FROM_ABI unordered_set(unordered_set&& __u, const allocator_type& __a);
- _LIBCPP_HIDE_FROM_ABI unordered_set(initializer_list<value_type> __il);
- _LIBCPP_HIDE_FROM_ABI unordered_set(initializer_list<value_type> __il, size_type __n,
- const hasher& __hf = hasher(),
- const key_equal& __eql = key_equal());
- _LIBCPP_HIDE_FROM_ABI unordered_set(initializer_list<value_type> __il, size_type __n,
- const hasher& __hf, const key_equal& __eql,
- const allocator_type& __a);
-#if _LIBCPP_STD_VER >= 14
- inline _LIBCPP_HIDE_FROM_ABI
- unordered_set(initializer_list<value_type> __il, size_type __n,
- const allocator_type& __a)
- : unordered_set(__il, __n, hasher(), key_equal(), __a) {}
- inline _LIBCPP_HIDE_FROM_ABI
- unordered_set(initializer_list<value_type> __il, size_type __n,
- const hasher& __hf, const allocator_type& __a)
- : unordered_set(__il, __n, __hf, key_equal(), __a) {}
-#endif
+ _LIBCPP_HIDE_FROM_ABI unordered_set(unordered_set&& __u) _NOEXCEPT_(is_nothrow_move_constructible<__table>::value);
+ _LIBCPP_HIDE_FROM_ABI unordered_set(unordered_set&& __u, const allocator_type& __a);
+ _LIBCPP_HIDE_FROM_ABI unordered_set(initializer_list<value_type> __il);
+ _LIBCPP_HIDE_FROM_ABI
+ unordered_set(initializer_list<value_type> __il,
+ size_type __n,
+ const hasher& __hf = hasher(),
+ const key_equal& __eql = key_equal());
+ _LIBCPP_HIDE_FROM_ABI unordered_set(
+ initializer_list<value_type> __il,
+ size_type __n,
+ const hasher& __hf,
+ const key_equal& __eql,
+ const allocator_type& __a);
+# if _LIBCPP_STD_VER >= 14
+ inline _LIBCPP_HIDE_FROM_ABI
+ unordered_set(initializer_list<value_type> __il, size_type __n, const allocator_type& __a)
+ : unordered_set(__il, __n, hasher(), key_equal(), __a) {}
+ inline _LIBCPP_HIDE_FROM_ABI
+ unordered_set(initializer_list<value_type> __il, size_type __n, const hasher& __hf, const allocator_type& __a)
+ : unordered_set(__il, __n, __hf, key_equal(), __a) {}
+# endif
#endif // _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI
- ~unordered_set() {
- static_assert(sizeof(std::__diagnose_unordered_container_requirements<_Value, _Hash, _Pred>(0)), "");
- }
+ _LIBCPP_HIDE_FROM_ABI ~unordered_set() {
+ static_assert(sizeof(std::__diagnose_unordered_container_requirements<_Value, _Hash, _Pred>(0)), "");
+ }
- _LIBCPP_HIDE_FROM_ABI
- unordered_set& operator=(const unordered_set& __u)
- {
- __table_ = __u.__table_;
- return *this;
- }
+ _LIBCPP_HIDE_FROM_ABI unordered_set& operator=(const unordered_set& __u) {
+ __table_ = __u.__table_;
+ return *this;
+ }
#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI
- unordered_set& operator=(unordered_set&& __u)
- _NOEXCEPT_(is_nothrow_move_assignable<__table>::value);
- _LIBCPP_HIDE_FROM_ABI
- unordered_set& operator=(initializer_list<value_type> __il);
+ _LIBCPP_HIDE_FROM_ABI unordered_set& operator=(unordered_set&& __u)
+ _NOEXCEPT_(is_nothrow_move_assignable<__table>::value);
+ _LIBCPP_HIDE_FROM_ABI unordered_set& operator=(initializer_list<value_type> __il);
#endif // _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI
- allocator_type get_allocator() const _NOEXCEPT
- {return allocator_type(__table_.__node_alloc());}
-
- _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_HIDE_FROM_ABI
- bool empty() const _NOEXCEPT {return __table_.size() == 0;}
- _LIBCPP_HIDE_FROM_ABI
- size_type size() const _NOEXCEPT {return __table_.size();}
- _LIBCPP_HIDE_FROM_ABI
- size_type max_size() const _NOEXCEPT {return __table_.max_size();}
-
- _LIBCPP_HIDE_FROM_ABI
- iterator begin() _NOEXCEPT {return __table_.begin();}
- _LIBCPP_HIDE_FROM_ABI
- iterator end() _NOEXCEPT {return __table_.end();}
- _LIBCPP_HIDE_FROM_ABI
- const_iterator begin() const _NOEXCEPT {return __table_.begin();}
- _LIBCPP_HIDE_FROM_ABI
- const_iterator end() const _NOEXCEPT {return __table_.end();}
- _LIBCPP_HIDE_FROM_ABI
- const_iterator cbegin() const _NOEXCEPT {return __table_.begin();}
- _LIBCPP_HIDE_FROM_ABI
- const_iterator cend() const _NOEXCEPT {return __table_.end();}
+ _LIBCPP_HIDE_FROM_ABI allocator_type get_allocator() const _NOEXCEPT {
+ return allocator_type(__table_.__node_alloc());
+ }
-#ifndef _LIBCPP_CXX03_LANG
- template <class... _Args>
- _LIBCPP_HIDE_FROM_ABI
- pair<iterator, bool> emplace(_Args&&... __args)
- {return __table_.__emplace_unique(std::forward<_Args>(__args)...);}
- template <class... _Args>
- _LIBCPP_HIDE_FROM_ABI
- iterator emplace_hint(const_iterator, _Args&&... __args) {
- return __table_.__emplace_unique(std::forward<_Args>(__args)...).first;
- }
+ _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_HIDE_FROM_ABI bool empty() const _NOEXCEPT { return __table_.size() == 0; }
+ _LIBCPP_HIDE_FROM_ABI size_type size() const _NOEXCEPT { return __table_.size(); }
+ _LIBCPP_HIDE_FROM_ABI size_type max_size() const _NOEXCEPT { return __table_.max_size(); }
- _LIBCPP_HIDE_FROM_ABI
- pair<iterator, bool> insert(value_type&& __x)
- {return __table_.__insert_unique(std::move(__x));}
- _LIBCPP_HIDE_FROM_ABI
- iterator insert(const_iterator, value_type&& __x) {
- return insert(std::move(__x)).first;
- }
+ _LIBCPP_HIDE_FROM_ABI iterator begin() _NOEXCEPT { return __table_.begin(); }
+ _LIBCPP_HIDE_FROM_ABI iterator end() _NOEXCEPT { return __table_.end(); }
+ _LIBCPP_HIDE_FROM_ABI const_iterator begin() const _NOEXCEPT { return __table_.begin(); }
+ _LIBCPP_HIDE_FROM_ABI const_iterator end() const _NOEXCEPT { return __table_.end(); }
+ _LIBCPP_HIDE_FROM_ABI const_iterator cbegin() const _NOEXCEPT { return __table_.begin(); }
+ _LIBCPP_HIDE_FROM_ABI const_iterator cend() const _NOEXCEPT { return __table_.end(); }
- _LIBCPP_HIDE_FROM_ABI
- void insert(initializer_list<value_type> __il)
- {insert(__il.begin(), __il.end());}
+#ifndef _LIBCPP_CXX03_LANG
+ template <class... _Args>
+ _LIBCPP_HIDE_FROM_ABI pair<iterator, bool> emplace(_Args&&... __args) {
+ return __table_.__emplace_unique(std::forward<_Args>(__args)...);
+ }
+ template <class... _Args>
+ _LIBCPP_HIDE_FROM_ABI iterator emplace_hint(const_iterator, _Args&&... __args) {
+ return __table_.__emplace_unique(std::forward<_Args>(__args)...).first;
+ }
+
+ _LIBCPP_HIDE_FROM_ABI pair<iterator, bool> insert(value_type&& __x) {
+ return __table_.__insert_unique(std::move(__x));
+ }
+ _LIBCPP_HIDE_FROM_ABI iterator insert(const_iterator, value_type&& __x) { return insert(std::move(__x)).first; }
+
+ _LIBCPP_HIDE_FROM_ABI void insert(initializer_list<value_type> __il) { insert(__il.begin(), __il.end()); }
#endif // _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI
- pair<iterator, bool> insert(const value_type& __x)
- {return __table_.__insert_unique(__x);}
+ _LIBCPP_HIDE_FROM_ABI pair<iterator, bool> insert(const value_type& __x) { return __table_.__insert_unique(__x); }
- _LIBCPP_HIDE_FROM_ABI
- iterator insert(const_iterator, const value_type& __x) {
- return insert(__x).first;
- }
- template <class _InputIterator>
- _LIBCPP_HIDE_FROM_ABI
- void insert(_InputIterator __first, _InputIterator __last);
+ _LIBCPP_HIDE_FROM_ABI iterator insert(const_iterator, const value_type& __x) { return insert(__x).first; }
+ template <class _InputIterator>
+ _LIBCPP_HIDE_FROM_ABI void insert(_InputIterator __first, _InputIterator __last);
#if _LIBCPP_STD_VER >= 23
- template <_ContainerCompatibleRange<value_type> _Range>
- _LIBCPP_HIDE_FROM_ABI
- void insert_range(_Range&& __range) {
- for (auto&& __element : __range) {
- __table_.__insert_unique(std::forward<decltype(__element)>(__element));
- }
+ template <_ContainerCompatibleRange<value_type> _Range>
+ _LIBCPP_HIDE_FROM_ABI void insert_range(_Range&& __range) {
+ for (auto&& __element : __range) {
+ __table_.__insert_unique(std::forward<decltype(__element)>(__element));
}
+ }
#endif
- _LIBCPP_HIDE_FROM_ABI
- iterator erase(const_iterator __p) {return __table_.erase(__p);}
- _LIBCPP_HIDE_FROM_ABI
- size_type erase(const key_type& __k) {return __table_.__erase_unique(__k);}
- _LIBCPP_HIDE_FROM_ABI
- iterator erase(const_iterator __first, const_iterator __last)
- {return __table_.erase(__first, __last);}
- _LIBCPP_HIDE_FROM_ABI
- void clear() _NOEXCEPT {__table_.clear();}
+ _LIBCPP_HIDE_FROM_ABI iterator erase(const_iterator __p) { return __table_.erase(__p); }
+ _LIBCPP_HIDE_FROM_ABI size_type erase(const key_type& __k) { return __table_.__erase_unique(__k); }
+ _LIBCPP_HIDE_FROM_ABI iterator erase(const_iterator __first, const_iterator __last) {
+ return __table_.erase(__first, __last);
+ }
+ _LIBCPP_HIDE_FROM_ABI void clear() _NOEXCEPT { __table_.clear(); }
#if _LIBCPP_STD_VER >= 17
- _LIBCPP_HIDE_FROM_ABI
- insert_return_type insert(node_type&& __nh)
- {
- _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(__nh.empty() || __nh.get_allocator() == get_allocator(),
- "node_type with incompatible allocator passed to unordered_set::insert()");
- return __table_.template __node_handle_insert_unique<
- node_type, insert_return_type>(std::move(__nh));
- }
- _LIBCPP_HIDE_FROM_ABI
- iterator insert(const_iterator __h, node_type&& __nh)
- {
- _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(__nh.empty() || __nh.get_allocator() == get_allocator(),
- "node_type with incompatible allocator passed to unordered_set::insert()");
- return __table_.template __node_handle_insert_unique<node_type>(
- __h, std::move(__nh));
- }
- _LIBCPP_HIDE_FROM_ABI
- node_type extract(key_type const& __key)
- {
- return __table_.template __node_handle_extract<node_type>(__key);
- }
- _LIBCPP_HIDE_FROM_ABI
- node_type extract(const_iterator __it)
- {
- return __table_.template __node_handle_extract<node_type>(__it);
- }
-
- template<class _H2, class _P2>
- _LIBCPP_HIDE_FROM_ABI
- void merge(unordered_set<key_type, _H2, _P2, allocator_type>& __source)
- {
- _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(__source.get_allocator() == get_allocator(),
- "merging container with incompatible allocator");
- __table_.__node_handle_merge_unique(__source.__table_);
- }
- template<class _H2, class _P2>
- _LIBCPP_HIDE_FROM_ABI
- void merge(unordered_set<key_type, _H2, _P2, allocator_type>&& __source)
- {
- _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(__source.get_allocator() == get_allocator(),
- "merging container with incompatible allocator");
- __table_.__node_handle_merge_unique(__source.__table_);
- }
- template<class _H2, class _P2>
- _LIBCPP_HIDE_FROM_ABI
- void merge(unordered_multiset<key_type, _H2, _P2, allocator_type>& __source)
- {
- _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(__source.get_allocator() == get_allocator(),
- "merging container with incompatible allocator");
- __table_.__node_handle_merge_unique(__source.__table_);
- }
- template<class _H2, class _P2>
- _LIBCPP_HIDE_FROM_ABI
- void merge(unordered_multiset<key_type, _H2, _P2, allocator_type>&& __source)
- {
- _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(__source.get_allocator() == get_allocator(),
- "merging container with incompatible allocator");
- __table_.__node_handle_merge_unique(__source.__table_);
- }
+ _LIBCPP_HIDE_FROM_ABI insert_return_type insert(node_type&& __nh) {
+ _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(__nh.empty() || __nh.get_allocator() == get_allocator(),
+ "node_type with incompatible allocator passed to unordered_set::insert()");
+ return __table_.template __node_handle_insert_unique< node_type, insert_return_type>(std::move(__nh));
+ }
+ _LIBCPP_HIDE_FROM_ABI iterator insert(const_iterator __h, node_type&& __nh) {
+ _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(__nh.empty() || __nh.get_allocator() == get_allocator(),
+ "node_type with incompatible allocator passed to unordered_set::insert()");
+ return __table_.template __node_handle_insert_unique<node_type>(__h, std::move(__nh));
+ }
+ _LIBCPP_HIDE_FROM_ABI node_type extract(key_type const& __key) {
+ return __table_.template __node_handle_extract<node_type>(__key);
+ }
+ _LIBCPP_HIDE_FROM_ABI node_type extract(const_iterator __it) {
+ return __table_.template __node_handle_extract<node_type>(__it);
+ }
+
+ template <class _H2, class _P2>
+ _LIBCPP_HIDE_FROM_ABI void merge(unordered_set<key_type, _H2, _P2, allocator_type>& __source) {
+ _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(
+ __source.get_allocator() == get_allocator(), "merging container with incompatible allocator");
+ __table_.__node_handle_merge_unique(__source.__table_);
+ }
+ template <class _H2, class _P2>
+ _LIBCPP_HIDE_FROM_ABI void merge(unordered_set<key_type, _H2, _P2, allocator_type>&& __source) {
+ _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(
+ __source.get_allocator() == get_allocator(), "merging container with incompatible allocator");
+ __table_.__node_handle_merge_unique(__source.__table_);
+ }
+ template <class _H2, class _P2>
+ _LIBCPP_HIDE_FROM_ABI void merge(unordered_multiset<key_type, _H2, _P2, allocator_type>& __source) {
+ _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(
+ __source.get_allocator() == get_allocator(), "merging container with incompatible allocator");
+ __table_.__node_handle_merge_unique(__source.__table_);
+ }
+ template <class _H2, class _P2>
+ _LIBCPP_HIDE_FROM_ABI void merge(unordered_multiset<key_type, _H2, _P2, allocator_type>&& __source) {
+ _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(
+ __source.get_allocator() == get_allocator(), "merging container with incompatible allocator");
+ __table_.__node_handle_merge_unique(__source.__table_);
+ }
#endif
- _LIBCPP_HIDE_FROM_ABI
- void swap(unordered_set& __u)
- _NOEXCEPT_(__is_nothrow_swappable<__table>::value)
- {__table_.swap(__u.__table_);}
+ _LIBCPP_HIDE_FROM_ABI void swap(unordered_set& __u) _NOEXCEPT_(__is_nothrow_swappable<__table>::value) {
+ __table_.swap(__u.__table_);
+ }
- _LIBCPP_HIDE_FROM_ABI
- hasher hash_function() const {return __table_.hash_function();}
- _LIBCPP_HIDE_FROM_ABI
- key_equal key_eq() const {return __table_.key_eq();}
+ _LIBCPP_HIDE_FROM_ABI hasher hash_function() const { return __table_.hash_function(); }
+ _LIBCPP_HIDE_FROM_ABI key_equal key_eq() const { return __table_.key_eq(); }
- _LIBCPP_HIDE_FROM_ABI
- iterator find(const key_type& __k) {return __table_.find(__k);}
- _LIBCPP_HIDE_FROM_ABI
- const_iterator find(const key_type& __k) const {return __table_.find(__k);}
+ _LIBCPP_HIDE_FROM_ABI iterator find(const key_type& __k) { return __table_.find(__k); }
+ _LIBCPP_HIDE_FROM_ABI const_iterator find(const key_type& __k) const { return __table_.find(__k); }
#if _LIBCPP_STD_VER >= 20
- template <class _K2, enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr>
- _LIBCPP_HIDE_FROM_ABI
- iterator find(const _K2& __k) {return __table_.find(__k);}
- template <class _K2, enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr>
- _LIBCPP_HIDE_FROM_ABI
- const_iterator find(const _K2& __k) const {return __table_.find(__k);}
+ template <class _K2,
+ enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr>
+ _LIBCPP_HIDE_FROM_ABI iterator find(const _K2& __k) {
+ return __table_.find(__k);
+ }
+ template <class _K2,
+ enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr>
+ _LIBCPP_HIDE_FROM_ABI const_iterator find(const _K2& __k) const {
+ return __table_.find(__k);
+ }
#endif // _LIBCPP_STD_VER >= 20
- _LIBCPP_HIDE_FROM_ABI
- size_type count(const key_type& __k) const {return __table_.__count_unique(__k);}
+ _LIBCPP_HIDE_FROM_ABI size_type count(const key_type& __k) const { return __table_.__count_unique(__k); }
#if _LIBCPP_STD_VER >= 20
- template <class _K2, enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr>
- _LIBCPP_HIDE_FROM_ABI
- size_type count(const _K2& __k) const {return __table_.__count_unique(__k);}
+ template <class _K2,
+ enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr>
+ _LIBCPP_HIDE_FROM_ABI size_type count(const _K2& __k) const {
+ return __table_.__count_unique(__k);
+ }
#endif // _LIBCPP_STD_VER >= 20
#if _LIBCPP_STD_VER >= 20
- _LIBCPP_HIDE_FROM_ABI
- bool contains(const key_type& __k) const {return find(__k) != end();}
+ _LIBCPP_HIDE_FROM_ABI bool contains(const key_type& __k) const { return find(__k) != end(); }
- template <class _K2, enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr>
- _LIBCPP_HIDE_FROM_ABI
- bool contains(const _K2& __k) const {return find(__k) != end();}
+ template <class _K2,
+ enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr>
+ _LIBCPP_HIDE_FROM_ABI bool contains(const _K2& __k) const {
+ return find(__k) != end();
+ }
#endif // _LIBCPP_STD_VER >= 20
- _LIBCPP_HIDE_FROM_ABI
- pair<iterator, iterator> equal_range(const key_type& __k)
- {return __table_.__equal_range_unique(__k);}
- _LIBCPP_HIDE_FROM_ABI
- pair<const_iterator, const_iterator> equal_range(const key_type& __k) const
- {return __table_.__equal_range_unique(__k);}
+ _LIBCPP_HIDE_FROM_ABI pair<iterator, iterator> equal_range(const key_type& __k) {
+ return __table_.__equal_range_unique(__k);
+ }
+ _LIBCPP_HIDE_FROM_ABI pair<const_iterator, const_iterator> equal_range(const key_type& __k) const {
+ return __table_.__equal_range_unique(__k);
+ }
#if _LIBCPP_STD_VER >= 20
- template <class _K2, enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr>
- _LIBCPP_HIDE_FROM_ABI
- pair<iterator, iterator> equal_range(const _K2& __k)
- {return __table_.__equal_range_unique(__k);}
- template <class _K2, enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr>
- _LIBCPP_HIDE_FROM_ABI
- pair<const_iterator, const_iterator> equal_range(const _K2& __k) const
- {return __table_.__equal_range_unique(__k);}
+ template <class _K2,
+ enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr>
+ _LIBCPP_HIDE_FROM_ABI pair<iterator, iterator> equal_range(const _K2& __k) {
+ return __table_.__equal_range_unique(__k);
+ }
+ template <class _K2,
+ enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr>
+ _LIBCPP_HIDE_FROM_ABI pair<const_iterator, const_iterator> equal_range(const _K2& __k) const {
+ return __table_.__equal_range_unique(__k);
+ }
#endif // _LIBCPP_STD_VER >= 20
- _LIBCPP_HIDE_FROM_ABI
- size_type bucket_count() const _NOEXCEPT {return __table_.bucket_count();}
- _LIBCPP_HIDE_FROM_ABI
- size_type max_bucket_count() const _NOEXCEPT {return __table_.max_bucket_count();}
-
- _LIBCPP_HIDE_FROM_ABI
- size_type bucket_size(size_type __n) const {return __table_.bucket_size(__n);}
- _LIBCPP_HIDE_FROM_ABI
- size_type bucket(const key_type& __k) const {return __table_.bucket(__k);}
-
- _LIBCPP_HIDE_FROM_ABI
- local_iterator begin(size_type __n) {return __table_.begin(__n);}
- _LIBCPP_HIDE_FROM_ABI
- local_iterator end(size_type __n) {return __table_.end(__n);}
- _LIBCPP_HIDE_FROM_ABI
- const_local_iterator begin(size_type __n) const {return __table_.cbegin(__n);}
- _LIBCPP_HIDE_FROM_ABI
- const_local_iterator end(size_type __n) const {return __table_.cend(__n);}
- _LIBCPP_HIDE_FROM_ABI
- const_local_iterator cbegin(size_type __n) const {return __table_.cbegin(__n);}
- _LIBCPP_HIDE_FROM_ABI
- const_local_iterator cend(size_type __n) const {return __table_.cend(__n);}
-
- _LIBCPP_HIDE_FROM_ABI
- float load_factor() const _NOEXCEPT {return __table_.load_factor();}
- _LIBCPP_HIDE_FROM_ABI
- float max_load_factor() const _NOEXCEPT {return __table_.max_load_factor();}
- _LIBCPP_HIDE_FROM_ABI
- void max_load_factor(float __mlf) {__table_.max_load_factor(__mlf);}
- _LIBCPP_HIDE_FROM_ABI
- void rehash(size_type __n) {__table_.__rehash_unique(__n);}
- _LIBCPP_HIDE_FROM_ABI
- void reserve(size_type __n) {__table_.__reserve_unique(__n);}
+ _LIBCPP_HIDE_FROM_ABI size_type bucket_count() const _NOEXCEPT { return __table_.bucket_count(); }
+ _LIBCPP_HIDE_FROM_ABI size_type max_bucket_count() const _NOEXCEPT { return __table_.max_bucket_count(); }
+
+ _LIBCPP_HIDE_FROM_ABI size_type bucket_size(size_type __n) const { return __table_.bucket_size(__n); }
+ _LIBCPP_HIDE_FROM_ABI size_type bucket(const key_type& __k) const { return __table_.bucket(__k); }
+
+ _LIBCPP_HIDE_FROM_ABI local_iterator begin(size_type __n) { return __table_.begin(__n); }
+ _LIBCPP_HIDE_FROM_ABI local_iterator end(size_type __n) { return __table_.end(__n); }
+ _LIBCPP_HIDE_FROM_ABI const_local_iterator begin(size_type __n) const { return __table_.cbegin(__n); }
+ _LIBCPP_HIDE_FROM_ABI const_local_iterator end(size_type __n) const { return __table_.cend(__n); }
+ _LIBCPP_HIDE_FROM_ABI const_local_iterator cbegin(size_type __n) const { return __table_.cbegin(__n); }
+ _LIBCPP_HIDE_FROM_ABI const_local_iterator cend(size_type __n) const { return __table_.cend(__n); }
+
+ _LIBCPP_HIDE_FROM_ABI float load_factor() const _NOEXCEPT { return __table_.load_factor(); }
+ _LIBCPP_HIDE_FROM_ABI float max_load_factor() const _NOEXCEPT { return __table_.max_load_factor(); }
+ _LIBCPP_HIDE_FROM_ABI void max_load_factor(float __mlf) { __table_.max_load_factor(__mlf); }
+ _LIBCPP_HIDE_FROM_ABI void rehash(size_type __n) { __table_.__rehash_unique(__n); }
+ _LIBCPP_HIDE_FROM_ABI void reserve(size_type __n) { __table_.__reserve_unique(__n); }
};
#if _LIBCPP_STD_VER >= 17
-template<class _InputIterator,
- class _Hash = hash<__iter_value_type<_InputIterator>>,
- class _Pred = equal_to<__iter_value_type<_InputIterator>>,
- class _Allocator = allocator<__iter_value_type<_InputIterator>>,
- class = enable_if_t<__has_input_iterator_category<_InputIterator>::value>,
- class = enable_if_t<!__is_allocator<_Hash>::value>,
- class = enable_if_t<!is_integral<_Hash>::value>,
- class = enable_if_t<!__is_allocator<_Pred>::value>,
- class = enable_if_t<__is_allocator<_Allocator>::value>>
-unordered_set(_InputIterator, _InputIterator, typename allocator_traits<_Allocator>::size_type = 0,
- _Hash = _Hash(), _Pred = _Pred(), _Allocator = _Allocator())
- -> unordered_set<__iter_value_type<_InputIterator>, _Hash, _Pred, _Allocator>;
-
-#if _LIBCPP_STD_VER >= 23
+template <class _InputIterator,
+ class _Hash = hash<__iter_value_type<_InputIterator>>,
+ class _Pred = equal_to<__iter_value_type<_InputIterator>>,
+ class _Allocator = allocator<__iter_value_type<_InputIterator>>,
+ class = enable_if_t<__has_input_iterator_category<_InputIterator>::value>,
+ class = enable_if_t<!__is_allocator<_Hash>::value>,
+ class = enable_if_t<!is_integral<_Hash>::value>,
+ class = enable_if_t<!__is_allocator<_Pred>::value>,
+ class = enable_if_t<__is_allocator<_Allocator>::value>>
+unordered_set(_InputIterator,
+ _InputIterator,
+ typename allocator_traits<_Allocator>::size_type = 0,
+ _Hash = _Hash(),
+ _Pred = _Pred(),
+ _Allocator = _Allocator()) -> unordered_set<__iter_value_type<_InputIterator>, _Hash, _Pred, _Allocator>;
+
+# if _LIBCPP_STD_VER >= 23
template <ranges::input_range _Range,
- class _Hash = hash<ranges::range_value_t<_Range>>,
- class _Pred = equal_to<ranges::range_value_t<_Range>>,
+ class _Hash = hash<ranges::range_value_t<_Range>>,
+ class _Pred = equal_to<ranges::range_value_t<_Range>>,
class _Allocator = allocator<ranges::range_value_t<_Range>>,
+ class = enable_if_t<!__is_allocator<_Hash>::value>,
+ class = enable_if_t<!is_integral<_Hash>::value>,
+ class = enable_if_t<!__is_allocator<_Pred>::value>,
+ class = enable_if_t<__is_allocator<_Allocator>::value>>
+unordered_set(from_range_t,
+ _Range&&,
+ typename allocator_traits<_Allocator>::size_type = 0,
+ _Hash = _Hash(),
+ _Pred = _Pred(),
+ _Allocator = _Allocator())
+ -> unordered_set<ranges::range_value_t<_Range>, _Hash, _Pred, _Allocator>; // C++23
+# endif
+
+template <class _Tp,
+ class _Hash = hash<_Tp>,
+ class _Pred = equal_to<_Tp>,
+ class _Allocator = allocator<_Tp>,
+ class = enable_if_t<!__is_allocator<_Hash>::value>,
+ class = enable_if_t<!is_integral<_Hash>::value>,
+ class = enable_if_t<!__is_allocator<_Pred>::value>,
+ class = enable_if_t<__is_allocator<_Allocator>::value>>
+unordered_set(initializer_list<_Tp>,
+ typename allocator_traits<_Allocator>::size_type = 0,
+ _Hash = _Hash(),
+ _Pred = _Pred(),
+ _Allocator = _Allocator()) -> unordered_set<_Tp, _Hash, _Pred, _Allocator>;
+
+template <class _InputIterator,
+ class _Allocator,
+ class = enable_if_t<__has_input_iterator_category<_InputIterator>::value>,
+ class = enable_if_t<__is_allocator<_Allocator>::value>>
+unordered_set(_InputIterator, _InputIterator, typename allocator_traits<_Allocator>::size_type, _Allocator)
+ -> unordered_set<__iter_value_type<_InputIterator>,
+ hash<__iter_value_type<_InputIterator>>,
+ equal_to<__iter_value_type<_InputIterator>>,
+ _Allocator>;
+
+template <class _InputIterator,
+ class _Hash,
+ class _Allocator,
+ class = enable_if_t<__has_input_iterator_category<_InputIterator>::value>,
class = enable_if_t<!__is_allocator<_Hash>::value>,
class = enable_if_t<!is_integral<_Hash>::value>,
- class = enable_if_t<!__is_allocator<_Pred>::value>,
class = enable_if_t<__is_allocator<_Allocator>::value>>
-unordered_set(from_range_t, _Range&&, typename allocator_traits<_Allocator>::size_type = 0,
- _Hash = _Hash(), _Pred = _Pred(), _Allocator = _Allocator())
- -> unordered_set<ranges::range_value_t<_Range>, _Hash, _Pred, _Allocator>; // C++23
-#endif
-
-template<class _Tp, class _Hash = hash<_Tp>,
- class _Pred = equal_to<_Tp>,
- class _Allocator = allocator<_Tp>,
- class = enable_if_t<!__is_allocator<_Hash>::value>,
- class = enable_if_t<!is_integral<_Hash>::value>,
- class = enable_if_t<!__is_allocator<_Pred>::value>,
- class = enable_if_t<__is_allocator<_Allocator>::value>>
-unordered_set(initializer_list<_Tp>, typename allocator_traits<_Allocator>::size_type = 0,
- _Hash = _Hash(), _Pred = _Pred(), _Allocator = _Allocator())
- -> unordered_set<_Tp, _Hash, _Pred, _Allocator>;
-
-template<class _InputIterator, class _Allocator,
- class = enable_if_t<__has_input_iterator_category<_InputIterator>::value>,
- class = enable_if_t<__is_allocator<_Allocator>::value>>
-unordered_set(_InputIterator, _InputIterator,
- typename allocator_traits<_Allocator>::size_type, _Allocator)
- -> unordered_set<__iter_value_type<_InputIterator>,
- hash<__iter_value_type<_InputIterator>>,
- equal_to<__iter_value_type<_InputIterator>>,
- _Allocator>;
-
-template<class _InputIterator, class _Hash, class _Allocator,
- class = enable_if_t<__has_input_iterator_category<_InputIterator>::value>,
- class = enable_if_t<!__is_allocator<_Hash>::value>,
- class = enable_if_t<!is_integral<_Hash>::value>,
- class = enable_if_t<__is_allocator<_Allocator>::value>>
-unordered_set(_InputIterator, _InputIterator,
- typename allocator_traits<_Allocator>::size_type, _Hash, _Allocator)
- -> unordered_set<__iter_value_type<_InputIterator>, _Hash,
- equal_to<__iter_value_type<_InputIterator>>,
- _Allocator>;
+unordered_set(_InputIterator, _InputIterator, typename allocator_traits<_Allocator>::size_type, _Hash, _Allocator)
+ -> unordered_set<__iter_value_type<_InputIterator>, _Hash, equal_to<__iter_value_type<_InputIterator>>, _Allocator>;
-#if _LIBCPP_STD_VER >= 23
+# if _LIBCPP_STD_VER >= 23
-template <ranges::input_range _Range, class _Allocator,
- class = enable_if_t<__is_allocator<_Allocator>::value>>
+template <ranges::input_range _Range, class _Allocator, class = enable_if_t<__is_allocator<_Allocator>::value>>
unordered_set(from_range_t, _Range&&, typename allocator_traits<_Allocator>::size_type, _Allocator)
- -> unordered_set<ranges::range_value_t<_Range>, hash<ranges::range_value_t<_Range>>,
- equal_to<ranges::range_value_t<_Range>>, _Allocator>;
+ -> unordered_set<ranges::range_value_t<_Range>,
+ hash<ranges::range_value_t<_Range>>,
+ equal_to<ranges::range_value_t<_Range>>,
+ _Allocator>;
-template <ranges::input_range _Range, class _Allocator,
- class = enable_if_t<__is_allocator<_Allocator>::value>>
+template <ranges::input_range _Range, class _Allocator, class = enable_if_t<__is_allocator<_Allocator>::value>>
unordered_set(from_range_t, _Range&&, _Allocator)
- -> unordered_set<ranges::range_value_t<_Range>, hash<ranges::range_value_t<_Range>>,
- equal_to<ranges::range_value_t<_Range>>, _Allocator>;
+ -> unordered_set<ranges::range_value_t<_Range>,
+ hash<ranges::range_value_t<_Range>>,
+ equal_to<ranges::range_value_t<_Range>>,
+ _Allocator>;
-template <ranges::input_range _Range, class _Hash, class _Allocator,
+template <ranges::input_range _Range,
+ class _Hash,
+ class _Allocator,
class = enable_if_t<!__is_allocator<_Hash>::value>,
class = enable_if_t<!is_integral<_Hash>::value>,
class = enable_if_t<__is_allocator<_Allocator>::value>>
unordered_set(from_range_t, _Range&&, typename allocator_traits<_Allocator>::size_type, _Hash, _Allocator)
- -> unordered_set<ranges::range_value_t<_Range>, _Hash, equal_to<ranges::range_value_t<_Range>>, _Allocator>;
+ -> unordered_set<ranges::range_value_t<_Range>, _Hash, equal_to<ranges::range_value_t<_Range>>, _Allocator>;
-#endif
+# endif
-template<class _Tp, class _Allocator,
- class = enable_if_t<__is_allocator<_Allocator>::value>>
+template <class _Tp, class _Allocator, class = enable_if_t<__is_allocator<_Allocator>::value>>
unordered_set(initializer_list<_Tp>, typename allocator_traits<_Allocator>::size_type, _Allocator)
- -> unordered_set<_Tp, hash<_Tp>, equal_to<_Tp>, _Allocator>;
+ -> unordered_set<_Tp, hash<_Tp>, equal_to<_Tp>, _Allocator>;
-template<class _Tp, class _Hash, class _Allocator,
- class = enable_if_t<!__is_allocator<_Hash>::value>,
- class = enable_if_t<!is_integral<_Hash>::value>,
- class = enable_if_t<__is_allocator<_Allocator>::value>>
+template <class _Tp,
+ class _Hash,
+ class _Allocator,
+ class = enable_if_t<!__is_allocator<_Hash>::value>,
+ class = enable_if_t<!is_integral<_Hash>::value>,
+ class = enable_if_t<__is_allocator<_Allocator>::value>>
unordered_set(initializer_list<_Tp>, typename allocator_traits<_Allocator>::size_type, _Hash, _Allocator)
- -> unordered_set<_Tp, _Hash, equal_to<_Tp>, _Allocator>;
+ -> unordered_set<_Tp, _Hash, equal_to<_Tp>, _Allocator>;
#endif
template <class _Value, class _Hash, class _Pred, class _Alloc>
-unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set(size_type __n,
- const hasher& __hf, const key_equal& __eql)
- : __table_(__hf, __eql)
-{
- __table_.__rehash_unique(__n);
+unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set(size_type __n, const hasher& __hf, const key_equal& __eql)
+ : __table_(__hf, __eql) {
+ __table_.__rehash_unique(__n);
}
template <class _Value, class _Hash, class _Pred, class _Alloc>
-unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set(size_type __n,
- const hasher& __hf, const key_equal& __eql, const allocator_type& __a)
- : __table_(__hf, __eql, __a)
-{
- __table_.__rehash_unique(__n);
+unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set(
+ size_type __n, const hasher& __hf, const key_equal& __eql, const allocator_type& __a)
+ : __table_(__hf, __eql, __a) {
+ __table_.__rehash_unique(__n);
}
template <class _Value, class _Hash, class _Pred, class _Alloc>
template <class _InputIterator>
-unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set(
- _InputIterator __first, _InputIterator __last)
-{
- insert(__first, __last);
+unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set(_InputIterator __first, _InputIterator __last) {
+ insert(__first, __last);
}
template <class _Value, class _Hash, class _Pred, class _Alloc>
template <class _InputIterator>
unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set(
- _InputIterator __first, _InputIterator __last, size_type __n,
- const hasher& __hf, const key_equal& __eql)
- : __table_(__hf, __eql)
-{
- __table_.__rehash_unique(__n);
- insert(__first, __last);
+ _InputIterator __first, _InputIterator __last, size_type __n, const hasher& __hf, const key_equal& __eql)
+ : __table_(__hf, __eql) {
+ __table_.__rehash_unique(__n);
+ insert(__first, __last);
}
template <class _Value, class _Hash, class _Pred, class _Alloc>
template <class _InputIterator>
unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set(
- _InputIterator __first, _InputIterator __last, size_type __n,
- const hasher& __hf, const key_equal& __eql, const allocator_type& __a)
- : __table_(__hf, __eql, __a)
-{
- __table_.__rehash_unique(__n);
- insert(__first, __last);
+ _InputIterator __first,
+ _InputIterator __last,
+ size_type __n,
+ const hasher& __hf,
+ const key_equal& __eql,
+ const allocator_type& __a)
+ : __table_(__hf, __eql, __a) {
+ __table_.__rehash_unique(__n);
+ insert(__first, __last);
}
template <class _Value, class _Hash, class _Pred, class _Alloc>
-inline
-unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set(
- const allocator_type& __a)
- : __table_(__a)
-{
-}
+inline unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set(const allocator_type& __a) : __table_(__a) {}
template <class _Value, class _Hash, class _Pred, class _Alloc>
-unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set(
- const unordered_set& __u)
- : __table_(__u.__table_)
-{
- __table_.__rehash_unique(__u.bucket_count());
- insert(__u.begin(), __u.end());
+unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set(const unordered_set& __u) : __table_(__u.__table_) {
+ __table_.__rehash_unique(__u.bucket_count());
+ insert(__u.begin(), __u.end());
}
template <class _Value, class _Hash, class _Pred, class _Alloc>
-unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set(
- const unordered_set& __u, const allocator_type& __a)
- : __table_(__u.__table_, __a)
-{
- __table_.__rehash_unique(__u.bucket_count());
- insert(__u.begin(), __u.end());
+unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set(const unordered_set& __u, const allocator_type& __a)
+ : __table_(__u.__table_, __a) {
+ __table_.__rehash_unique(__u.bucket_count());
+ insert(__u.begin(), __u.end());
}
#ifndef _LIBCPP_CXX03_LANG
template <class _Value, class _Hash, class _Pred, class _Alloc>
-inline
-unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set(
- unordered_set&& __u)
+inline unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set(unordered_set&& __u)
_NOEXCEPT_(is_nothrow_move_constructible<__table>::value)
- : __table_(std::move(__u.__table_))
-{
-}
+ : __table_(std::move(__u.__table_)) {}
template <class _Value, class _Hash, class _Pred, class _Alloc>
-unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set(
- unordered_set&& __u, const allocator_type& __a)
- : __table_(std::move(__u.__table_), __a)
-{
- if (__a != __u.get_allocator())
- {
- iterator __i = __u.begin();
- while (__u.size() != 0)
- __table_.__insert_unique(std::move(__u.__table_.remove(__i++)->__get_value()));
- }
+unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set(unordered_set&& __u, const allocator_type& __a)
+ : __table_(std::move(__u.__table_), __a) {
+ if (__a != __u.get_allocator()) {
+ iterator __i = __u.begin();
+ while (__u.size() != 0)
+ __table_.__insert_unique(std::move(__u.__table_.remove(__i++)->__get_value()));
+ }
}
template <class _Value, class _Hash, class _Pred, class _Alloc>
-unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set(
- initializer_list<value_type> __il)
-{
- insert(__il.begin(), __il.end());
+unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set(initializer_list<value_type> __il) {
+ insert(__il.begin(), __il.end());
}
template <class _Value, class _Hash, class _Pred, class _Alloc>
unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set(
- initializer_list<value_type> __il, size_type __n, const hasher& __hf,
- const key_equal& __eql)
- : __table_(__hf, __eql)
-{
- __table_.__rehash_unique(__n);
- insert(__il.begin(), __il.end());
+ initializer_list<value_type> __il, size_type __n, const hasher& __hf, const key_equal& __eql)
+ : __table_(__hf, __eql) {
+ __table_.__rehash_unique(__n);
+ insert(__il.begin(), __il.end());
}
template <class _Value, class _Hash, class _Pred, class _Alloc>
unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set(
- initializer_list<value_type> __il, size_type __n, const hasher& __hf,
- const key_equal& __eql, const allocator_type& __a)
- : __table_(__hf, __eql, __a)
-{
- __table_.__rehash_unique(__n);
- insert(__il.begin(), __il.end());
+ initializer_list<value_type> __il,
+ size_type __n,
+ const hasher& __hf,
+ const key_equal& __eql,
+ const allocator_type& __a)
+ : __table_(__hf, __eql, __a) {
+ __table_.__rehash_unique(__n);
+ insert(__il.begin(), __il.end());
}
template <class _Value, class _Hash, class _Pred, class _Alloc>
-inline
-unordered_set<_Value, _Hash, _Pred, _Alloc>&
+inline unordered_set<_Value, _Hash, _Pred, _Alloc>&
unordered_set<_Value, _Hash, _Pred, _Alloc>::operator=(unordered_set&& __u)
- _NOEXCEPT_(is_nothrow_move_assignable<__table>::value)
-{
- __table_ = std::move(__u.__table_);
- return *this;
+ _NOEXCEPT_(is_nothrow_move_assignable<__table>::value) {
+ __table_ = std::move(__u.__table_);
+ return *this;
}
template <class _Value, class _Hash, class _Pred, class _Alloc>
-inline
-unordered_set<_Value, _Hash, _Pred, _Alloc>&
-unordered_set<_Value, _Hash, _Pred, _Alloc>::operator=(
- initializer_list<value_type> __il)
-{
- __table_.__assign_unique(__il.begin(), __il.end());
- return *this;
+inline unordered_set<_Value, _Hash, _Pred, _Alloc>&
+unordered_set<_Value, _Hash, _Pred, _Alloc>::operator=(initializer_list<value_type> __il) {
+ __table_.__assign_unique(__il.begin(), __il.end());
+ return *this;
}
#endif // _LIBCPP_CXX03_LANG
template <class _Value, class _Hash, class _Pred, class _Alloc>
template <class _InputIterator>
-inline
-void
-unordered_set<_Value, _Hash, _Pred, _Alloc>::insert(_InputIterator __first,
- _InputIterator __last)
-{
- for (; __first != __last; ++__first)
- __table_.__insert_unique(*__first);
+inline void unordered_set<_Value, _Hash, _Pred, _Alloc>::insert(_InputIterator __first, _InputIterator __last) {
+ for (; __first != __last; ++__first)
+ __table_.__insert_unique(*__first);
}
template <class _Value, class _Hash, class _Pred, class _Alloc>
-inline _LIBCPP_HIDE_FROM_ABI
-void
-swap(unordered_set<_Value, _Hash, _Pred, _Alloc>& __x,
- unordered_set<_Value, _Hash, _Pred, _Alloc>& __y)
- _NOEXCEPT_(_NOEXCEPT_(__x.swap(__y)))
-{
- __x.swap(__y);
+inline _LIBCPP_HIDE_FROM_ABI void
+swap(unordered_set<_Value, _Hash, _Pred, _Alloc>& __x, unordered_set<_Value, _Hash, _Pred, _Alloc>& __y)
+ _NOEXCEPT_(_NOEXCEPT_(__x.swap(__y))) {
+ __x.swap(__y);
}
#if _LIBCPP_STD_VER >= 20
-template <class _Value, class _Hash, class _Pred, class _Alloc,
- class _Predicate>
-inline _LIBCPP_HIDE_FROM_ABI
- typename unordered_set<_Value, _Hash, _Pred, _Alloc>::size_type
- erase_if(unordered_set<_Value, _Hash, _Pred, _Alloc>& __c,
- _Predicate __pred) {
+template <class _Value, class _Hash, class _Pred, class _Alloc, class _Predicate>
+inline _LIBCPP_HIDE_FROM_ABI typename unordered_set<_Value, _Hash, _Pred, _Alloc>::size_type
+erase_if(unordered_set<_Value, _Hash, _Pred, _Alloc>& __c, _Predicate __pred) {
return std::__libcpp_erase_if_container(__c, __pred);
}
#endif
template <class _Value, class _Hash, class _Pred, class _Alloc>
-_LIBCPP_HIDE_FROM_ABI bool
-operator==(const unordered_set<_Value, _Hash, _Pred, _Alloc>& __x,
- const unordered_set<_Value, _Hash, _Pred, _Alloc>& __y)
-{
- if (__x.size() != __y.size())
- return false;
- typedef typename unordered_set<_Value, _Hash, _Pred, _Alloc>::const_iterator
- const_iterator;
- for (const_iterator __i = __x.begin(), __ex = __x.end(), __ey = __y.end();
- __i != __ex; ++__i)
- {
- const_iterator __j = __y.find(*__i);
- if (__j == __ey || !(*__i == *__j))
- return false;
- }
- return true;
+_LIBCPP_HIDE_FROM_ABI bool operator==(const unordered_set<_Value, _Hash, _Pred, _Alloc>& __x,
+ const unordered_set<_Value, _Hash, _Pred, _Alloc>& __y) {
+ if (__x.size() != __y.size())
+ return false;
+ typedef typename unordered_set<_Value, _Hash, _Pred, _Alloc>::const_iterator const_iterator;
+ for (const_iterator __i = __x.begin(), __ex = __x.end(), __ey = __y.end(); __i != __ex; ++__i) {
+ const_iterator __j = __y.find(*__i);
+ if (__j == __ey || !(*__i == *__j))
+ return false;
+ }
+ return true;
}
#if _LIBCPP_STD_VER <= 17
template <class _Value, class _Hash, class _Pred, class _Alloc>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator!=(const unordered_set<_Value, _Hash, _Pred, _Alloc>& __x,
- const unordered_set<_Value, _Hash, _Pred, _Alloc>& __y)
-{
- return !(__x == __y);
+inline _LIBCPP_HIDE_FROM_ABI bool operator!=(const unordered_set<_Value, _Hash, _Pred, _Alloc>& __x,
+ const unordered_set<_Value, _Hash, _Pred, _Alloc>& __y) {
+ return !(__x == __y);
}
#endif
-template <class _Value, class _Hash = hash<_Value>, class _Pred = equal_to<_Value>,
- class _Alloc = allocator<_Value> >
-class _LIBCPP_TEMPLATE_VIS unordered_multiset
-{
+template <class _Value, class _Hash = hash<_Value>, class _Pred = equal_to<_Value>, class _Alloc = allocator<_Value> >
+class _LIBCPP_TEMPLATE_VIS unordered_multiset {
public:
- // types
- typedef _Value key_type;
- typedef key_type value_type;
- typedef __type_identity_t<_Hash> hasher;
- typedef __type_identity_t<_Pred> key_equal;
- typedef __type_identity_t<_Alloc> allocator_type;
- typedef value_type& reference;
- typedef const value_type& const_reference;
- static_assert((is_same<value_type, typename allocator_type::value_type>::value),
- "Allocator::value_type must be same type as value_type");
+ // types
+ typedef _Value key_type;
+ typedef key_type value_type;
+ typedef __type_identity_t<_Hash> hasher;
+ typedef __type_identity_t<_Pred> key_equal;
+ typedef __type_identity_t<_Alloc> allocator_type;
+ typedef value_type& reference;
+ typedef const value_type& const_reference;
+ static_assert((is_same<value_type, typename allocator_type::value_type>::value),
+ "Allocator::value_type must be same type as value_type");
private:
- typedef __hash_table<value_type, hasher, key_equal, allocator_type> __table;
+ typedef __hash_table<value_type, hasher, key_equal, allocator_type> __table;
- __table __table_;
+ __table __table_;
public:
- typedef typename __table::pointer pointer;
- typedef typename __table::const_pointer const_pointer;
- typedef typename __table::size_type size_type;
- typedef typename __table::difference_type difference_type;
+ typedef typename __table::pointer pointer;
+ typedef typename __table::const_pointer const_pointer;
+ typedef typename __table::size_type size_type;
+ typedef typename __table::difference_type difference_type;
- typedef typename __table::const_iterator iterator;
- typedef typename __table::const_iterator const_iterator;
- typedef typename __table::const_local_iterator local_iterator;
- typedef typename __table::const_local_iterator const_local_iterator;
+ typedef typename __table::const_iterator iterator;
+ typedef typename __table::const_iterator const_iterator;
+ typedef typename __table::const_local_iterator local_iterator;
+ typedef typename __table::const_local_iterator const_local_iterator;
#if _LIBCPP_STD_VER >= 17
- typedef __set_node_handle<typename __table::__node, allocator_type> node_type;
+ typedef __set_node_handle<typename __table::__node, allocator_type> node_type;
#endif
- template <class _Value2, class _Hash2, class _Pred2, class _Alloc2>
- friend class _LIBCPP_TEMPLATE_VIS unordered_set;
- template <class _Value2, class _Hash2, class _Pred2, class _Alloc2>
- friend class _LIBCPP_TEMPLATE_VIS unordered_multiset;
+ template <class _Value2, class _Hash2, class _Pred2, class _Alloc2>
+ friend class _LIBCPP_TEMPLATE_VIS unordered_set;
+ template <class _Value2, class _Hash2, class _Pred2, class _Alloc2>
+ friend class _LIBCPP_TEMPLATE_VIS unordered_multiset;
- _LIBCPP_HIDE_FROM_ABI
- unordered_multiset()
- _NOEXCEPT_(is_nothrow_default_constructible<__table>::value)
- {
- }
- explicit _LIBCPP_HIDE_FROM_ABI unordered_multiset(size_type __n, const hasher& __hf = hasher(),
- const key_equal& __eql = key_equal());
- _LIBCPP_HIDE_FROM_ABI unordered_multiset(size_type __n, const hasher& __hf,
- const key_equal& __eql, const allocator_type& __a);
+ _LIBCPP_HIDE_FROM_ABI unordered_multiset() _NOEXCEPT_(is_nothrow_default_constructible<__table>::value) {}
+ explicit _LIBCPP_HIDE_FROM_ABI
+ unordered_multiset(size_type __n, const hasher& __hf = hasher(), const key_equal& __eql = key_equal());
+ _LIBCPP_HIDE_FROM_ABI
+ unordered_multiset(size_type __n, const hasher& __hf, const key_equal& __eql, const allocator_type& __a);
#if _LIBCPP_STD_VER >= 14
- inline _LIBCPP_HIDE_FROM_ABI
- unordered_multiset(size_type __n, const allocator_type& __a)
- : unordered_multiset(__n, hasher(), key_equal(), __a) {}
- inline _LIBCPP_HIDE_FROM_ABI
- unordered_multiset(size_type __n, const hasher& __hf, const allocator_type& __a)
- : unordered_multiset(__n, __hf, key_equal(), __a) {}
+ inline _LIBCPP_HIDE_FROM_ABI unordered_multiset(size_type __n, const allocator_type& __a)
+ : unordered_multiset(__n, hasher(), key_equal(), __a) {}
+ inline _LIBCPP_HIDE_FROM_ABI unordered_multiset(size_type __n, const hasher& __hf, const allocator_type& __a)
+ : unordered_multiset(__n, __hf, key_equal(), __a) {}
#endif
- template <class _InputIterator>
- _LIBCPP_HIDE_FROM_ABI unordered_multiset(_InputIterator __first, _InputIterator __last);
- template <class _InputIterator>
- _LIBCPP_HIDE_FROM_ABI unordered_multiset(_InputIterator __first, _InputIterator __last,
- size_type __n, const hasher& __hf = hasher(),
- const key_equal& __eql = key_equal());
- template <class _InputIterator>
- _LIBCPP_HIDE_FROM_ABI unordered_multiset(_InputIterator __first, _InputIterator __last,
- size_type __n , const hasher& __hf,
- const key_equal& __eql, const allocator_type& __a);
+ template <class _InputIterator>
+ _LIBCPP_HIDE_FROM_ABI unordered_multiset(_InputIterator __first, _InputIterator __last);
+ template <class _InputIterator>
+ _LIBCPP_HIDE_FROM_ABI unordered_multiset(
+ _InputIterator __first,
+ _InputIterator __last,
+ size_type __n,
+ const hasher& __hf = hasher(),
+ const key_equal& __eql = key_equal());
+ template <class _InputIterator>
+ _LIBCPP_HIDE_FROM_ABI unordered_multiset(
+ _InputIterator __first,
+ _InputIterator __last,
+ size_type __n,
+ const hasher& __hf,
+ const key_equal& __eql,
+ const allocator_type& __a);
#if _LIBCPP_STD_VER >= 23
- template <_ContainerCompatibleRange<value_type> _Range>
- _LIBCPP_HIDE_FROM_ABI
- unordered_multiset(from_range_t, _Range&& __range, size_type __n = /*implementation-defined*/0,
- const hasher& __hf = hasher(), const key_equal& __eql = key_equal(),
- const allocator_type& __a = allocator_type())
- : __table_(__hf, __eql, __a) {
- if (__n > 0) {
- __table_.__rehash_multi(__n);
- }
- insert_range(std::forward<_Range>(__range));
+ template <_ContainerCompatibleRange<value_type> _Range>
+ _LIBCPP_HIDE_FROM_ABI unordered_multiset(
+ from_range_t,
+ _Range&& __range,
+ size_type __n = /*implementation-defined*/ 0,
+ const hasher& __hf = hasher(),
+ const key_equal& __eql = key_equal(),
+ const allocator_type& __a = allocator_type())
+ : __table_(__hf, __eql, __a) {
+ if (__n > 0) {
+ __table_.__rehash_multi(__n);
}
+ insert_range(std::forward<_Range>(__range));
+ }
#endif
#if _LIBCPP_STD_VER >= 14
- template <class _InputIterator>
- inline _LIBCPP_HIDE_FROM_ABI
- unordered_multiset(_InputIterator __first, _InputIterator __last,
- size_type __n, const allocator_type& __a)
- : unordered_multiset(__first, __last, __n, hasher(), key_equal(), __a) {}
- template <class _InputIterator>
- inline _LIBCPP_HIDE_FROM_ABI
- unordered_multiset(_InputIterator __first, _InputIterator __last,
- size_type __n, const hasher& __hf, const allocator_type& __a)
- : unordered_multiset(__first, __last, __n, __hf, key_equal(), __a) {}
+ template <class _InputIterator>
+ inline _LIBCPP_HIDE_FROM_ABI
+ unordered_multiset(_InputIterator __first, _InputIterator __last, size_type __n, const allocator_type& __a)
+ : unordered_multiset(__first, __last, __n, hasher(), key_equal(), __a) {}
+ template <class _InputIterator>
+ inline _LIBCPP_HIDE_FROM_ABI unordered_multiset(
+ _InputIterator __first, _InputIterator __last, size_type __n, const hasher& __hf, const allocator_type& __a)
+ : unordered_multiset(__first, __last, __n, __hf, key_equal(), __a) {}
#endif
#if _LIBCPP_STD_VER >= 23
- template <_ContainerCompatibleRange<value_type> _Range>
- _LIBCPP_HIDE_FROM_ABI
- unordered_multiset(from_range_t, _Range&& __range, size_type __n, const allocator_type& __a)
- : unordered_multiset(from_range, std::forward<_Range>(__range), __n, hasher(), key_equal(), __a) {}
-
- template <_ContainerCompatibleRange<value_type> _Range>
- _LIBCPP_HIDE_FROM_ABI
- unordered_multiset(from_range_t, _Range&& __range, size_type __n, const hasher& __hf, const allocator_type& __a)
- : unordered_multiset(from_range, std::forward<_Range>(__range), __n, __hf, key_equal(), __a) {}
+ template <_ContainerCompatibleRange<value_type> _Range>
+ _LIBCPP_HIDE_FROM_ABI unordered_multiset(from_range_t, _Range&& __range, size_type __n, const allocator_type& __a)
+ : unordered_multiset(from_range, std::forward<_Range>(__range), __n, hasher(), key_equal(), __a) {}
+
+ template <_ContainerCompatibleRange<value_type> _Range>
+ _LIBCPP_HIDE_FROM_ABI
+ unordered_multiset(from_range_t, _Range&& __range, size_type __n, const hasher& __hf, const allocator_type& __a)
+ : unordered_multiset(from_range, std::forward<_Range>(__range), __n, __hf, key_equal(), __a) {}
#endif
- _LIBCPP_HIDE_FROM_ABI
- explicit unordered_multiset(const allocator_type& __a);
- _LIBCPP_HIDE_FROM_ABI unordered_multiset(const unordered_multiset& __u);
- _LIBCPP_HIDE_FROM_ABI unordered_multiset(const unordered_multiset& __u, const allocator_type& __a);
+ _LIBCPP_HIDE_FROM_ABI explicit unordered_multiset(const allocator_type& __a);
+ _LIBCPP_HIDE_FROM_ABI unordered_multiset(const unordered_multiset& __u);
+ _LIBCPP_HIDE_FROM_ABI unordered_multiset(const unordered_multiset& __u, const allocator_type& __a);
#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI
- unordered_multiset(unordered_multiset&& __u)
- _NOEXCEPT_(is_nothrow_move_constructible<__table>::value);
- _LIBCPP_HIDE_FROM_ABI unordered_multiset(unordered_multiset&& __u, const allocator_type& __a);
- _LIBCPP_HIDE_FROM_ABI unordered_multiset(initializer_list<value_type> __il);
- _LIBCPP_HIDE_FROM_ABI unordered_multiset(initializer_list<value_type> __il, size_type __n,
- const hasher& __hf = hasher(),
- const key_equal& __eql = key_equal());
- _LIBCPP_HIDE_FROM_ABI unordered_multiset(initializer_list<value_type> __il, size_type __n,
- const hasher& __hf, const key_equal& __eql,
- const allocator_type& __a);
-#if _LIBCPP_STD_VER >= 14
- inline _LIBCPP_HIDE_FROM_ABI
- unordered_multiset(initializer_list<value_type> __il, size_type __n, const allocator_type& __a)
+ _LIBCPP_HIDE_FROM_ABI unordered_multiset(unordered_multiset&& __u)
+ _NOEXCEPT_(is_nothrow_move_constructible<__table>::value);
+ _LIBCPP_HIDE_FROM_ABI unordered_multiset(unordered_multiset&& __u, const allocator_type& __a);
+ _LIBCPP_HIDE_FROM_ABI unordered_multiset(initializer_list<value_type> __il);
+ _LIBCPP_HIDE_FROM_ABI unordered_multiset(
+ initializer_list<value_type> __il,
+ size_type __n,
+ const hasher& __hf = hasher(),
+ const key_equal& __eql = key_equal());
+ _LIBCPP_HIDE_FROM_ABI unordered_multiset(
+ initializer_list<value_type> __il,
+ size_type __n,
+ const hasher& __hf,
+ const key_equal& __eql,
+ const allocator_type& __a);
+# if _LIBCPP_STD_VER >= 14
+ inline _LIBCPP_HIDE_FROM_ABI
+ unordered_multiset(initializer_list<value_type> __il, size_type __n, const allocator_type& __a)
: unordered_multiset(__il, __n, hasher(), key_equal(), __a) {}
- inline _LIBCPP_HIDE_FROM_ABI
- unordered_multiset(initializer_list<value_type> __il, size_type __n, const hasher& __hf, const allocator_type& __a)
+ inline _LIBCPP_HIDE_FROM_ABI
+ unordered_multiset(initializer_list<value_type> __il, size_type __n, const hasher& __hf, const allocator_type& __a)
: unordered_multiset(__il, __n, __hf, key_equal(), __a) {}
-#endif
+# endif
#endif // _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI
- ~unordered_multiset() {
- static_assert(sizeof(std::__diagnose_unordered_container_requirements<_Value, _Hash, _Pred>(0)), "");
- }
+ _LIBCPP_HIDE_FROM_ABI ~unordered_multiset() {
+ static_assert(sizeof(std::__diagnose_unordered_container_requirements<_Value, _Hash, _Pred>(0)), "");
+ }
- _LIBCPP_HIDE_FROM_ABI
- unordered_multiset& operator=(const unordered_multiset& __u)
- {
- __table_ = __u.__table_;
- return *this;
- }
+ _LIBCPP_HIDE_FROM_ABI unordered_multiset& operator=(const unordered_multiset& __u) {
+ __table_ = __u.__table_;
+ return *this;
+ }
#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI
- unordered_multiset& operator=(unordered_multiset&& __u)
- _NOEXCEPT_(is_nothrow_move_assignable<__table>::value);
- _LIBCPP_HIDE_FROM_ABI unordered_multiset& operator=(initializer_list<value_type> __il);
+ _LIBCPP_HIDE_FROM_ABI unordered_multiset& operator=(unordered_multiset&& __u)
+ _NOEXCEPT_(is_nothrow_move_assignable<__table>::value);
+ _LIBCPP_HIDE_FROM_ABI unordered_multiset& operator=(initializer_list<value_type> __il);
#endif // _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI
- allocator_type get_allocator() const _NOEXCEPT
- {return allocator_type(__table_.__node_alloc());}
-
- _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_HIDE_FROM_ABI
- bool empty() const _NOEXCEPT {return __table_.size() == 0;}
- _LIBCPP_HIDE_FROM_ABI
- size_type size() const _NOEXCEPT {return __table_.size();}
- _LIBCPP_HIDE_FROM_ABI
- size_type max_size() const _NOEXCEPT {return __table_.max_size();}
-
- _LIBCPP_HIDE_FROM_ABI
- iterator begin() _NOEXCEPT {return __table_.begin();}
- _LIBCPP_HIDE_FROM_ABI
- iterator end() _NOEXCEPT {return __table_.end();}
- _LIBCPP_HIDE_FROM_ABI
- const_iterator begin() const _NOEXCEPT {return __table_.begin();}
- _LIBCPP_HIDE_FROM_ABI
- const_iterator end() const _NOEXCEPT {return __table_.end();}
- _LIBCPP_HIDE_FROM_ABI
- const_iterator cbegin() const _NOEXCEPT {return __table_.begin();}
- _LIBCPP_HIDE_FROM_ABI
- const_iterator cend() const _NOEXCEPT {return __table_.end();}
+ _LIBCPP_HIDE_FROM_ABI allocator_type get_allocator() const _NOEXCEPT {
+ return allocator_type(__table_.__node_alloc());
+ }
+
+ _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_HIDE_FROM_ABI bool empty() const _NOEXCEPT { return __table_.size() == 0; }
+ _LIBCPP_HIDE_FROM_ABI size_type size() const _NOEXCEPT { return __table_.size(); }
+ _LIBCPP_HIDE_FROM_ABI size_type max_size() const _NOEXCEPT { return __table_.max_size(); }
+
+ _LIBCPP_HIDE_FROM_ABI iterator begin() _NOEXCEPT { return __table_.begin(); }
+ _LIBCPP_HIDE_FROM_ABI iterator end() _NOEXCEPT { return __table_.end(); }
+ _LIBCPP_HIDE_FROM_ABI const_iterator begin() const _NOEXCEPT { return __table_.begin(); }
+ _LIBCPP_HIDE_FROM_ABI const_iterator end() const _NOEXCEPT { return __table_.end(); }
+ _LIBCPP_HIDE_FROM_ABI const_iterator cbegin() const _NOEXCEPT { return __table_.begin(); }
+ _LIBCPP_HIDE_FROM_ABI const_iterator cend() const _NOEXCEPT { return __table_.end(); }
#ifndef _LIBCPP_CXX03_LANG
- template <class... _Args>
- _LIBCPP_HIDE_FROM_ABI
- iterator emplace(_Args&&... __args)
- {return __table_.__emplace_multi(std::forward<_Args>(__args)...);}
- template <class... _Args>
- _LIBCPP_HIDE_FROM_ABI
- iterator emplace_hint(const_iterator __p, _Args&&... __args)
- {return __table_.__emplace_hint_multi(__p, std::forward<_Args>(__args)...);}
-
- _LIBCPP_HIDE_FROM_ABI
- iterator insert(value_type&& __x) {return __table_.__insert_multi(std::move(__x));}
- _LIBCPP_HIDE_FROM_ABI
- iterator insert(const_iterator __p, value_type&& __x)
- {return __table_.__insert_multi(__p, std::move(__x));}
- _LIBCPP_HIDE_FROM_ABI
- void insert(initializer_list<value_type> __il)
- {insert(__il.begin(), __il.end());}
+ template <class... _Args>
+ _LIBCPP_HIDE_FROM_ABI iterator emplace(_Args&&... __args) {
+ return __table_.__emplace_multi(std::forward<_Args>(__args)...);
+ }
+ template <class... _Args>
+ _LIBCPP_HIDE_FROM_ABI iterator emplace_hint(const_iterator __p, _Args&&... __args) {
+ return __table_.__emplace_hint_multi(__p, std::forward<_Args>(__args)...);
+ }
+
+ _LIBCPP_HIDE_FROM_ABI iterator insert(value_type&& __x) { return __table_.__insert_multi(std::move(__x)); }
+ _LIBCPP_HIDE_FROM_ABI iterator insert(const_iterator __p, value_type&& __x) {
+ return __table_.__insert_multi(__p, std::move(__x));
+ }
+ _LIBCPP_HIDE_FROM_ABI void insert(initializer_list<value_type> __il) { insert(__il.begin(), __il.end()); }
#endif // _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI
- iterator insert(const value_type& __x) {return __table_.__insert_multi(__x);}
+ _LIBCPP_HIDE_FROM_ABI iterator insert(const value_type& __x) { return __table_.__insert_multi(__x); }
- _LIBCPP_HIDE_FROM_ABI
- iterator insert(const_iterator __p, const value_type& __x)
- {return __table_.__insert_multi(__p, __x);}
+ _LIBCPP_HIDE_FROM_ABI iterator insert(const_iterator __p, const value_type& __x) {
+ return __table_.__insert_multi(__p, __x);
+ }
- template <class _InputIterator>
- _LIBCPP_HIDE_FROM_ABI
- void insert(_InputIterator __first, _InputIterator __last);
+ template <class _InputIterator>
+ _LIBCPP_HIDE_FROM_ABI void insert(_InputIterator __first, _InputIterator __last);
#if _LIBCPP_STD_VER >= 23
- template <_ContainerCompatibleRange<value_type> _Range>
- _LIBCPP_HIDE_FROM_ABI
- void insert_range(_Range&& __range) {
- for (auto&& __element : __range) {
- __table_.__insert_multi(std::forward<decltype(__element)>(__element));
- }
+ template <_ContainerCompatibleRange<value_type> _Range>
+ _LIBCPP_HIDE_FROM_ABI void insert_range(_Range&& __range) {
+ for (auto&& __element : __range) {
+ __table_.__insert_multi(std::forward<decltype(__element)>(__element));
}
+ }
#endif
#if _LIBCPP_STD_VER >= 17
- _LIBCPP_HIDE_FROM_ABI
- iterator insert(node_type&& __nh)
- {
- _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(__nh.empty() || __nh.get_allocator() == get_allocator(),
- "node_type with incompatible allocator passed to unordered_multiset::insert()");
- return __table_.template __node_handle_insert_multi<node_type>(
- std::move(__nh));
- }
- _LIBCPP_HIDE_FROM_ABI
- iterator insert(const_iterator __hint, node_type&& __nh)
- {
- _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(__nh.empty() || __nh.get_allocator() == get_allocator(),
- "node_type with incompatible allocator passed to unordered_multiset::insert()");
- return __table_.template __node_handle_insert_multi<node_type>(
- __hint, std::move(__nh));
- }
- _LIBCPP_HIDE_FROM_ABI
- node_type extract(const_iterator __position)
- {
- return __table_.template __node_handle_extract<node_type>(
- __position);
- }
- _LIBCPP_HIDE_FROM_ABI
- node_type extract(key_type const& __key)
- {
- return __table_.template __node_handle_extract<node_type>(__key);
- }
-
- template <class _H2, class _P2>
- _LIBCPP_HIDE_FROM_ABI
- void merge(unordered_multiset<key_type, _H2, _P2, allocator_type>& __source)
- {
- _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(__source.get_allocator() == get_allocator(),
- "merging container with incompatible allocator");
- return __table_.__node_handle_merge_multi(__source.__table_);
- }
- template <class _H2, class _P2>
- _LIBCPP_HIDE_FROM_ABI
- void merge(unordered_multiset<key_type, _H2, _P2, allocator_type>&& __source)
- {
- _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(__source.get_allocator() == get_allocator(),
- "merging container with incompatible allocator");
- return __table_.__node_handle_merge_multi(__source.__table_);
- }
- template <class _H2, class _P2>
- _LIBCPP_HIDE_FROM_ABI
- void merge(unordered_set<key_type, _H2, _P2, allocator_type>& __source)
- {
- _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(__source.get_allocator() == get_allocator(),
- "merging container with incompatible allocator");
- return __table_.__node_handle_merge_multi(__source.__table_);
- }
- template <class _H2, class _P2>
- _LIBCPP_HIDE_FROM_ABI
- void merge(unordered_set<key_type, _H2, _P2, allocator_type>&& __source)
- {
- _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(__source.get_allocator() == get_allocator(),
- "merging container with incompatible allocator");
- return __table_.__node_handle_merge_multi(__source.__table_);
- }
+ _LIBCPP_HIDE_FROM_ABI iterator insert(node_type&& __nh) {
+ _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(__nh.empty() || __nh.get_allocator() == get_allocator(),
+ "node_type with incompatible allocator passed to unordered_multiset::insert()");
+ return __table_.template __node_handle_insert_multi<node_type>(std::move(__nh));
+ }
+ _LIBCPP_HIDE_FROM_ABI iterator insert(const_iterator __hint, node_type&& __nh) {
+ _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(__nh.empty() || __nh.get_allocator() == get_allocator(),
+ "node_type with incompatible allocator passed to unordered_multiset::insert()");
+ return __table_.template __node_handle_insert_multi<node_type>(__hint, std::move(__nh));
+ }
+ _LIBCPP_HIDE_FROM_ABI node_type extract(const_iterator __position) {
+ return __table_.template __node_handle_extract<node_type>(__position);
+ }
+ _LIBCPP_HIDE_FROM_ABI node_type extract(key_type const& __key) {
+ return __table_.template __node_handle_extract<node_type>(__key);
+ }
+
+ template <class _H2, class _P2>
+ _LIBCPP_HIDE_FROM_ABI void merge(unordered_multiset<key_type, _H2, _P2, allocator_type>& __source) {
+ _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(
+ __source.get_allocator() == get_allocator(), "merging container with incompatible allocator");
+ return __table_.__node_handle_merge_multi(__source.__table_);
+ }
+ template <class _H2, class _P2>
+ _LIBCPP_HIDE_FROM_ABI void merge(unordered_multiset<key_type, _H2, _P2, allocator_type>&& __source) {
+ _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(
+ __source.get_allocator() == get_allocator(), "merging container with incompatible allocator");
+ return __table_.__node_handle_merge_multi(__source.__table_);
+ }
+ template <class _H2, class _P2>
+ _LIBCPP_HIDE_FROM_ABI void merge(unordered_set<key_type, _H2, _P2, allocator_type>& __source) {
+ _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(
+ __source.get_allocator() == get_allocator(), "merging container with incompatible allocator");
+ return __table_.__node_handle_merge_multi(__source.__table_);
+ }
+ template <class _H2, class _P2>
+ _LIBCPP_HIDE_FROM_ABI void merge(unordered_set<key_type, _H2, _P2, allocator_type>&& __source) {
+ _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(
+ __source.get_allocator() == get_allocator(), "merging container with incompatible allocator");
+ return __table_.__node_handle_merge_multi(__source.__table_);
+ }
#endif
- _LIBCPP_HIDE_FROM_ABI
- iterator erase(const_iterator __p) {return __table_.erase(__p);}
- _LIBCPP_HIDE_FROM_ABI
- size_type erase(const key_type& __k) {return __table_.__erase_multi(__k);}
- _LIBCPP_HIDE_FROM_ABI
- iterator erase(const_iterator __first, const_iterator __last)
- {return __table_.erase(__first, __last);}
- _LIBCPP_HIDE_FROM_ABI
- void clear() _NOEXCEPT {__table_.clear();}
-
- _LIBCPP_HIDE_FROM_ABI
- void swap(unordered_multiset& __u)
- _NOEXCEPT_(__is_nothrow_swappable<__table>::value)
- {__table_.swap(__u.__table_);}
-
- _LIBCPP_HIDE_FROM_ABI
- hasher hash_function() const {return __table_.hash_function();}
- _LIBCPP_HIDE_FROM_ABI
- key_equal key_eq() const {return __table_.key_eq();}
-
- _LIBCPP_HIDE_FROM_ABI
- iterator find(const key_type& __k) {return __table_.find(__k);}
- _LIBCPP_HIDE_FROM_ABI
- const_iterator find(const key_type& __k) const {return __table_.find(__k);}
+ _LIBCPP_HIDE_FROM_ABI iterator erase(const_iterator __p) { return __table_.erase(__p); }
+ _LIBCPP_HIDE_FROM_ABI size_type erase(const key_type& __k) { return __table_.__erase_multi(__k); }
+ _LIBCPP_HIDE_FROM_ABI iterator erase(const_iterator __first, const_iterator __last) {
+ return __table_.erase(__first, __last);
+ }
+ _LIBCPP_HIDE_FROM_ABI void clear() _NOEXCEPT { __table_.clear(); }
+
+ _LIBCPP_HIDE_FROM_ABI void swap(unordered_multiset& __u) _NOEXCEPT_(__is_nothrow_swappable<__table>::value) {
+ __table_.swap(__u.__table_);
+ }
+
+ _LIBCPP_HIDE_FROM_ABI hasher hash_function() const { return __table_.hash_function(); }
+ _LIBCPP_HIDE_FROM_ABI key_equal key_eq() const { return __table_.key_eq(); }
+
+ _LIBCPP_HIDE_FROM_ABI iterator find(const key_type& __k) { return __table_.find(__k); }
+ _LIBCPP_HIDE_FROM_ABI const_iterator find(const key_type& __k) const { return __table_.find(__k); }
#if _LIBCPP_STD_VER >= 20
- template<class _K2, enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr>
- _LIBCPP_HIDE_FROM_ABI
- iterator find(const _K2& __k) {return __table_.find(__k);}
- template<class _K2, enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr>
- _LIBCPP_HIDE_FROM_ABI
- const_iterator find(const _K2& __k) const {return __table_.find(__k);}
+ template <class _K2,
+ enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr>
+ _LIBCPP_HIDE_FROM_ABI iterator find(const _K2& __k) {
+ return __table_.find(__k);
+ }
+ template <class _K2,
+ enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr>
+ _LIBCPP_HIDE_FROM_ABI const_iterator find(const _K2& __k) const {
+ return __table_.find(__k);
+ }
#endif // _LIBCPP_STD_VER >= 20
- _LIBCPP_HIDE_FROM_ABI
- size_type count(const key_type& __k) const {return __table_.__count_multi(__k);}
+ _LIBCPP_HIDE_FROM_ABI size_type count(const key_type& __k) const { return __table_.__count_multi(__k); }
#if _LIBCPP_STD_VER >= 20
- template<class _K2, enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr>
- _LIBCPP_HIDE_FROM_ABI
- size_type count(const _K2& __k) const {return __table_.__count_multi(__k);}
+ template <class _K2,
+ enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr>
+ _LIBCPP_HIDE_FROM_ABI size_type count(const _K2& __k) const {
+ return __table_.__count_multi(__k);
+ }
#endif // _LIBCPP_STD_VER >= 20
#if _LIBCPP_STD_VER >= 20
- _LIBCPP_HIDE_FROM_ABI
- bool contains(const key_type& __k) const {return find(__k) != end();}
+ _LIBCPP_HIDE_FROM_ABI bool contains(const key_type& __k) const { return find(__k) != end(); }
- template<class _K2, enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr>
- _LIBCPP_HIDE_FROM_ABI
- bool contains(const _K2& __k) const {return find(__k) != end();}
+ template <class _K2,
+ enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr>
+ _LIBCPP_HIDE_FROM_ABI bool contains(const _K2& __k) const {
+ return find(__k) != end();
+ }
#endif // _LIBCPP_STD_VER >= 20
- _LIBCPP_HIDE_FROM_ABI
- pair<iterator, iterator> equal_range(const key_type& __k)
- {return __table_.__equal_range_multi(__k);}
- _LIBCPP_HIDE_FROM_ABI
- pair<const_iterator, const_iterator> equal_range(const key_type& __k) const
- {return __table_.__equal_range_multi(__k);}
+ _LIBCPP_HIDE_FROM_ABI pair<iterator, iterator> equal_range(const key_type& __k) {
+ return __table_.__equal_range_multi(__k);
+ }
+ _LIBCPP_HIDE_FROM_ABI pair<const_iterator, const_iterator> equal_range(const key_type& __k) const {
+ return __table_.__equal_range_multi(__k);
+ }
#if _LIBCPP_STD_VER >= 20
- template<class _K2, enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr>
- _LIBCPP_HIDE_FROM_ABI
- pair<iterator, iterator> equal_range(const _K2& __k)
- {return __table_.__equal_range_multi(__k);}
- template<class _K2, enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr>
- _LIBCPP_HIDE_FROM_ABI
- pair<const_iterator, const_iterator> equal_range(const _K2& __k) const
- {return __table_.__equal_range_multi(__k);}
+ template <class _K2,
+ enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr>
+ _LIBCPP_HIDE_FROM_ABI pair<iterator, iterator> equal_range(const _K2& __k) {
+ return __table_.__equal_range_multi(__k);
+ }
+ template <class _K2,
+ enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr>
+ _LIBCPP_HIDE_FROM_ABI pair<const_iterator, const_iterator> equal_range(const _K2& __k) const {
+ return __table_.__equal_range_multi(__k);
+ }
#endif // _LIBCPP_STD_VER >= 20
- _LIBCPP_HIDE_FROM_ABI
- size_type bucket_count() const _NOEXCEPT {return __table_.bucket_count();}
- _LIBCPP_HIDE_FROM_ABI
- size_type max_bucket_count() const _NOEXCEPT {return __table_.max_bucket_count();}
-
- _LIBCPP_HIDE_FROM_ABI
- size_type bucket_size(size_type __n) const {return __table_.bucket_size(__n);}
- _LIBCPP_HIDE_FROM_ABI
- size_type bucket(const key_type& __k) const {return __table_.bucket(__k);}
-
- _LIBCPP_HIDE_FROM_ABI
- local_iterator begin(size_type __n) {return __table_.begin(__n);}
- _LIBCPP_HIDE_FROM_ABI
- local_iterator end(size_type __n) {return __table_.end(__n);}
- _LIBCPP_HIDE_FROM_ABI
- const_local_iterator begin(size_type __n) const {return __table_.cbegin(__n);}
- _LIBCPP_HIDE_FROM_ABI
- const_local_iterator end(size_type __n) const {return __table_.cend(__n);}
- _LIBCPP_HIDE_FROM_ABI
- const_local_iterator cbegin(size_type __n) const {return __table_.cbegin(__n);}
- _LIBCPP_HIDE_FROM_ABI
- const_local_iterator cend(size_type __n) const {return __table_.cend(__n);}
-
- _LIBCPP_HIDE_FROM_ABI
- float load_factor() const _NOEXCEPT {return __table_.load_factor();}
- _LIBCPP_HIDE_FROM_ABI
- float max_load_factor() const _NOEXCEPT {return __table_.max_load_factor();}
- _LIBCPP_HIDE_FROM_ABI
- void max_load_factor(float __mlf) {__table_.max_load_factor(__mlf);}
- _LIBCPP_HIDE_FROM_ABI
- void rehash(size_type __n) {__table_.__rehash_multi(__n);}
- _LIBCPP_HIDE_FROM_ABI
- void reserve(size_type __n) {__table_.__reserve_multi(__n);}
+ _LIBCPP_HIDE_FROM_ABI size_type bucket_count() const _NOEXCEPT { return __table_.bucket_count(); }
+ _LIBCPP_HIDE_FROM_ABI size_type max_bucket_count() const _NOEXCEPT { return __table_.max_bucket_count(); }
+
+ _LIBCPP_HIDE_FROM_ABI size_type bucket_size(size_type __n) const { return __table_.bucket_size(__n); }
+ _LIBCPP_HIDE_FROM_ABI size_type bucket(const key_type& __k) const { return __table_.bucket(__k); }
+
+ _LIBCPP_HIDE_FROM_ABI local_iterator begin(size_type __n) { return __table_.begin(__n); }
+ _LIBCPP_HIDE_FROM_ABI local_iterator end(size_type __n) { return __table_.end(__n); }
+ _LIBCPP_HIDE_FROM_ABI const_local_iterator begin(size_type __n) const { return __table_.cbegin(__n); }
+ _LIBCPP_HIDE_FROM_ABI const_local_iterator end(size_type __n) const { return __table_.cend(__n); }
+ _LIBCPP_HIDE_FROM_ABI const_local_iterator cbegin(size_type __n) const { return __table_.cbegin(__n); }
+ _LIBCPP_HIDE_FROM_ABI const_local_iterator cend(size_type __n) const { return __table_.cend(__n); }
+
+ _LIBCPP_HIDE_FROM_ABI float load_factor() const _NOEXCEPT { return __table_.load_factor(); }
+ _LIBCPP_HIDE_FROM_ABI float max_load_factor() const _NOEXCEPT { return __table_.max_load_factor(); }
+ _LIBCPP_HIDE_FROM_ABI void max_load_factor(float __mlf) { __table_.max_load_factor(__mlf); }
+ _LIBCPP_HIDE_FROM_ABI void rehash(size_type __n) { __table_.__rehash_multi(__n); }
+ _LIBCPP_HIDE_FROM_ABI void reserve(size_type __n) { __table_.__reserve_multi(__n); }
};
#if _LIBCPP_STD_VER >= 17
-template<class _InputIterator,
- class _Hash = hash<__iter_value_type<_InputIterator>>,
- class _Pred = equal_to<__iter_value_type<_InputIterator>>,
- class _Allocator = allocator<__iter_value_type<_InputIterator>>,
- class = enable_if_t<__has_input_iterator_category<_InputIterator>::value>,
- class = enable_if_t<!__is_allocator<_Hash>::value>,
- class = enable_if_t<!is_integral<_Hash>::value>,
- class = enable_if_t<!__is_allocator<_Pred>::value>,
- class = enable_if_t<__is_allocator<_Allocator>::value>>
-unordered_multiset(_InputIterator, _InputIterator, typename allocator_traits<_Allocator>::size_type = 0,
- _Hash = _Hash(), _Pred = _Pred(), _Allocator = _Allocator())
- -> unordered_multiset<__iter_value_type<_InputIterator>, _Hash, _Pred, _Allocator>;
-
-#if _LIBCPP_STD_VER >= 23
+template <class _InputIterator,
+ class _Hash = hash<__iter_value_type<_InputIterator>>,
+ class _Pred = equal_to<__iter_value_type<_InputIterator>>,
+ class _Allocator = allocator<__iter_value_type<_InputIterator>>,
+ class = enable_if_t<__has_input_iterator_category<_InputIterator>::value>,
+ class = enable_if_t<!__is_allocator<_Hash>::value>,
+ class = enable_if_t<!is_integral<_Hash>::value>,
+ class = enable_if_t<!__is_allocator<_Pred>::value>,
+ class = enable_if_t<__is_allocator<_Allocator>::value>>
+unordered_multiset(
+ _InputIterator,
+ _InputIterator,
+ typename allocator_traits<_Allocator>::size_type = 0,
+ _Hash = _Hash(),
+ _Pred = _Pred(),
+ _Allocator = _Allocator()) -> unordered_multiset<__iter_value_type<_InputIterator>, _Hash, _Pred, _Allocator>;
+
+# if _LIBCPP_STD_VER >= 23
template <ranges::input_range _Range,
- class _Hash = hash<ranges::range_value_t<_Range>>,
- class _Pred = equal_to<ranges::range_value_t<_Range>>,
+ class _Hash = hash<ranges::range_value_t<_Range>>,
+ class _Pred = equal_to<ranges::range_value_t<_Range>>,
class _Allocator = allocator<ranges::range_value_t<_Range>>,
+ class = enable_if_t<!__is_allocator<_Hash>::value>,
+ class = enable_if_t<!is_integral<_Hash>::value>,
+ class = enable_if_t<!__is_allocator<_Pred>::value>,
+ class = enable_if_t<__is_allocator<_Allocator>::value>>
+unordered_multiset(
+ from_range_t,
+ _Range&&,
+ typename allocator_traits<_Allocator>::size_type = 0,
+ _Hash = _Hash(),
+ _Pred = _Pred(),
+ _Allocator = _Allocator()) -> unordered_multiset<ranges::range_value_t<_Range>, _Hash, _Pred, _Allocator>; // C++23
+# endif
+
+template <class _Tp,
+ class _Hash = hash<_Tp>,
+ class _Pred = equal_to<_Tp>,
+ class _Allocator = allocator<_Tp>,
+ class = enable_if_t<!__is_allocator<_Hash>::value>,
+ class = enable_if_t<!is_integral<_Hash>::value>,
+ class = enable_if_t<!__is_allocator<_Pred>::value>,
+ class = enable_if_t<__is_allocator<_Allocator>::value>>
+unordered_multiset(initializer_list<_Tp>,
+ typename allocator_traits<_Allocator>::size_type = 0,
+ _Hash = _Hash(),
+ _Pred = _Pred(),
+ _Allocator = _Allocator()) -> unordered_multiset<_Tp, _Hash, _Pred, _Allocator>;
+
+template <class _InputIterator,
+ class _Allocator,
+ class = enable_if_t<__has_input_iterator_category<_InputIterator>::value>,
+ class = enable_if_t<__is_allocator<_Allocator>::value>>
+unordered_multiset(_InputIterator, _InputIterator, typename allocator_traits<_Allocator>::size_type, _Allocator)
+ -> unordered_multiset<__iter_value_type<_InputIterator>,
+ hash<__iter_value_type<_InputIterator>>,
+ equal_to<__iter_value_type<_InputIterator>>,
+ _Allocator>;
+
+template <class _InputIterator,
+ class _Hash,
+ class _Allocator,
+ class = enable_if_t<__has_input_iterator_category<_InputIterator>::value>,
class = enable_if_t<!__is_allocator<_Hash>::value>,
class = enable_if_t<!is_integral<_Hash>::value>,
- class = enable_if_t<!__is_allocator<_Pred>::value>,
class = enable_if_t<__is_allocator<_Allocator>::value>>
-unordered_multiset(from_range_t, _Range&&, typename allocator_traits<_Allocator>::size_type = 0,
- _Hash = _Hash(), _Pred = _Pred(), _Allocator = _Allocator())
- -> unordered_multiset<ranges::range_value_t<_Range>, _Hash, _Pred, _Allocator>; // C++23
-#endif
+unordered_multiset(_InputIterator, _InputIterator, typename allocator_traits<_Allocator>::size_type, _Hash, _Allocator)
+ -> unordered_multiset<__iter_value_type<_InputIterator>,
+ _Hash,
+ equal_to<__iter_value_type<_InputIterator>>,
+ _Allocator>;
-template<class _Tp, class _Hash = hash<_Tp>,
- class _Pred = equal_to<_Tp>, class _Allocator = allocator<_Tp>,
- class = enable_if_t<!__is_allocator<_Hash>::value>,
- class = enable_if_t<!is_integral<_Hash>::value>,
- class = enable_if_t<!__is_allocator<_Pred>::value>,
- class = enable_if_t<__is_allocator<_Allocator>::value>>
-unordered_multiset(initializer_list<_Tp>, typename allocator_traits<_Allocator>::size_type = 0,
- _Hash = _Hash(), _Pred = _Pred(), _Allocator = _Allocator())
- -> unordered_multiset<_Tp, _Hash, _Pred, _Allocator>;
-
-template<class _InputIterator, class _Allocator,
- class = enable_if_t<__has_input_iterator_category<_InputIterator>::value>,
- class = enable_if_t<__is_allocator<_Allocator>::value>>
-unordered_multiset(_InputIterator, _InputIterator, typename allocator_traits<_Allocator>::size_type, _Allocator)
- -> unordered_multiset<__iter_value_type<_InputIterator>,
- hash<__iter_value_type<_InputIterator>>,
- equal_to<__iter_value_type<_InputIterator>>,
- _Allocator>;
-
-template<class _InputIterator, class _Hash, class _Allocator,
- class = enable_if_t<__has_input_iterator_category<_InputIterator>::value>,
- class = enable_if_t<!__is_allocator<_Hash>::value>,
- class = enable_if_t<!is_integral<_Hash>::value>,
- class = enable_if_t<__is_allocator<_Allocator>::value>>
-unordered_multiset(_InputIterator, _InputIterator, typename allocator_traits<_Allocator>::size_type,
- _Hash, _Allocator)
- -> unordered_multiset<__iter_value_type<_InputIterator>, _Hash,
- equal_to<__iter_value_type<_InputIterator>>,
- _Allocator>;
+# if _LIBCPP_STD_VER >= 23
-#if _LIBCPP_STD_VER >= 23
-
-template <ranges::input_range _Range, class _Allocator,
- class = enable_if_t<__is_allocator<_Allocator>::value>>
+template <ranges::input_range _Range, class _Allocator, class = enable_if_t<__is_allocator<_Allocator>::value>>
unordered_multiset(from_range_t, _Range&&, typename allocator_traits<_Allocator>::size_type, _Allocator)
- -> unordered_multiset<ranges::range_value_t<_Range>, hash<ranges::range_value_t<_Range>>,
- equal_to<ranges::range_value_t<_Range>>, _Allocator>;
+ -> unordered_multiset<ranges::range_value_t<_Range>,
+ hash<ranges::range_value_t<_Range>>,
+ equal_to<ranges::range_value_t<_Range>>,
+ _Allocator>;
-template <ranges::input_range _Range, class _Allocator,
- class = enable_if_t<__is_allocator<_Allocator>::value>>
+template <ranges::input_range _Range, class _Allocator, class = enable_if_t<__is_allocator<_Allocator>::value>>
unordered_multiset(from_range_t, _Range&&, _Allocator)
- -> unordered_multiset<ranges::range_value_t<_Range>, hash<ranges::range_value_t<_Range>>,
- equal_to<ranges::range_value_t<_Range>>, _Allocator>;
+ -> unordered_multiset<ranges::range_value_t<_Range>,
+ hash<ranges::range_value_t<_Range>>,
+ equal_to<ranges::range_value_t<_Range>>,
+ _Allocator>;
-template <ranges::input_range _Range, class _Hash, class _Allocator,
+template <ranges::input_range _Range,
+ class _Hash,
+ class _Allocator,
class = enable_if_t<!__is_allocator<_Hash>::value>,
class = enable_if_t<!is_integral<_Hash>::value>,
class = enable_if_t<__is_allocator<_Allocator>::value>>
unordered_multiset(from_range_t, _Range&&, typename allocator_traits<_Allocator>::size_type, _Hash, _Allocator)
- -> unordered_multiset<ranges::range_value_t<_Range>, _Hash, equal_to<ranges::range_value_t<_Range>>, _Allocator>;
+ -> unordered_multiset<ranges::range_value_t<_Range>, _Hash, equal_to<ranges::range_value_t<_Range>>, _Allocator>;
-#endif
+# endif
-template<class _Tp, class _Allocator,
- class = enable_if_t<__is_allocator<_Allocator>::value>>
+template <class _Tp, class _Allocator, class = enable_if_t<__is_allocator<_Allocator>::value>>
unordered_multiset(initializer_list<_Tp>, typename allocator_traits<_Allocator>::size_type, _Allocator)
- -> unordered_multiset<_Tp, hash<_Tp>, equal_to<_Tp>, _Allocator>;
+ -> unordered_multiset<_Tp, hash<_Tp>, equal_to<_Tp>, _Allocator>;
-template<class _Tp, class _Hash, class _Allocator,
- class = enable_if_t<!__is_allocator<_Hash>::value>,
- class = enable_if_t<!is_integral<_Hash>::value>,
- class = enable_if_t<__is_allocator<_Allocator>::value>>
+template <class _Tp,
+ class _Hash,
+ class _Allocator,
+ class = enable_if_t<!__is_allocator<_Hash>::value>,
+ class = enable_if_t<!is_integral<_Hash>::value>,
+ class = enable_if_t<__is_allocator<_Allocator>::value>>
unordered_multiset(initializer_list<_Tp>, typename allocator_traits<_Allocator>::size_type, _Hash, _Allocator)
- -> unordered_multiset<_Tp, _Hash, equal_to<_Tp>, _Allocator>;
+ -> unordered_multiset<_Tp, _Hash, equal_to<_Tp>, _Allocator>;
#endif
template <class _Value, class _Hash, class _Pred, class _Alloc>
unordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset(
- size_type __n, const hasher& __hf, const key_equal& __eql)
- : __table_(__hf, __eql)
-{
- __table_.__rehash_multi(__n);
+ size_type __n, const hasher& __hf, const key_equal& __eql)
+ : __table_(__hf, __eql) {
+ __table_.__rehash_multi(__n);
}
template <class _Value, class _Hash, class _Pred, class _Alloc>
unordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset(
- size_type __n, const hasher& __hf, const key_equal& __eql,
- const allocator_type& __a)
- : __table_(__hf, __eql, __a)
-{
- __table_.__rehash_multi(__n);
+ size_type __n, const hasher& __hf, const key_equal& __eql, const allocator_type& __a)
+ : __table_(__hf, __eql, __a) {
+ __table_.__rehash_multi(__n);
}
template <class _Value, class _Hash, class _Pred, class _Alloc>
template <class _InputIterator>
-unordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset(
- _InputIterator __first, _InputIterator __last)
-{
- insert(__first, __last);
+unordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset(_InputIterator __first, _InputIterator __last) {
+ insert(__first, __last);
}
template <class _Value, class _Hash, class _Pred, class _Alloc>
template <class _InputIterator>
unordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset(
- _InputIterator __first, _InputIterator __last, size_type __n,
- const hasher& __hf, const key_equal& __eql)
- : __table_(__hf, __eql)
-{
- __table_.__rehash_multi(__n);
- insert(__first, __last);
+ _InputIterator __first, _InputIterator __last, size_type __n, const hasher& __hf, const key_equal& __eql)
+ : __table_(__hf, __eql) {
+ __table_.__rehash_multi(__n);
+ insert(__first, __last);
}
template <class _Value, class _Hash, class _Pred, class _Alloc>
template <class _InputIterator>
unordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset(
- _InputIterator __first, _InputIterator __last, size_type __n,
- const hasher& __hf, const key_equal& __eql, const allocator_type& __a)
- : __table_(__hf, __eql, __a)
-{
- __table_.__rehash_multi(__n);
- insert(__first, __last);
+ _InputIterator __first,
+ _InputIterator __last,
+ size_type __n,
+ const hasher& __hf,
+ const key_equal& __eql,
+ const allocator_type& __a)
+ : __table_(__hf, __eql, __a) {
+ __table_.__rehash_multi(__n);
+ insert(__first, __last);
}
template <class _Value, class _Hash, class _Pred, class _Alloc>
-inline
-unordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset(
- const allocator_type& __a)
- : __table_(__a)
-{
-}
+inline unordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset(const allocator_type& __a)
+ : __table_(__a) {}
template <class _Value, class _Hash, class _Pred, class _Alloc>
-unordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset(
- const unordered_multiset& __u)
- : __table_(__u.__table_)
-{
- __table_.__rehash_multi(__u.bucket_count());
- insert(__u.begin(), __u.end());
+unordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset(const unordered_multiset& __u)
+ : __table_(__u.__table_) {
+ __table_.__rehash_multi(__u.bucket_count());
+ insert(__u.begin(), __u.end());
}
template <class _Value, class _Hash, class _Pred, class _Alloc>
unordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset(
- const unordered_multiset& __u, const allocator_type& __a)
- : __table_(__u.__table_, __a)
-{
- __table_.__rehash_multi(__u.bucket_count());
- insert(__u.begin(), __u.end());
+ const unordered_multiset& __u, const allocator_type& __a)
+ : __table_(__u.__table_, __a) {
+ __table_.__rehash_multi(__u.bucket_count());
+ insert(__u.begin(), __u.end());
}
#ifndef _LIBCPP_CXX03_LANG
template <class _Value, class _Hash, class _Pred, class _Alloc>
-inline
-unordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset(
- unordered_multiset&& __u)
+inline unordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset(unordered_multiset&& __u)
_NOEXCEPT_(is_nothrow_move_constructible<__table>::value)
- : __table_(std::move(__u.__table_))
-{
-}
+ : __table_(std::move(__u.__table_)) {}
template <class _Value, class _Hash, class _Pred, class _Alloc>
unordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset(
- unordered_multiset&& __u, const allocator_type& __a)
- : __table_(std::move(__u.__table_), __a)
-{
- if (__a != __u.get_allocator())
- {
- iterator __i = __u.begin();
- while (__u.size() != 0)
- __table_.__insert_multi(std::move(__u.__table_.remove(__i++)->__get_value()));
- }
+ unordered_multiset&& __u, const allocator_type& __a)
+ : __table_(std::move(__u.__table_), __a) {
+ if (__a != __u.get_allocator()) {
+ iterator __i = __u.begin();
+ while (__u.size() != 0)
+ __table_.__insert_multi(std::move(__u.__table_.remove(__i++)->__get_value()));
+ }
}
template <class _Value, class _Hash, class _Pred, class _Alloc>
-unordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset(
- initializer_list<value_type> __il)
-{
- insert(__il.begin(), __il.end());
+unordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset(initializer_list<value_type> __il) {
+ insert(__il.begin(), __il.end());
}
template <class _Value, class _Hash, class _Pred, class _Alloc>
unordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset(
- initializer_list<value_type> __il, size_type __n, const hasher& __hf,
- const key_equal& __eql)
- : __table_(__hf, __eql)
-{
- __table_.__rehash_multi(__n);
- insert(__il.begin(), __il.end());
+ initializer_list<value_type> __il, size_type __n, const hasher& __hf, const key_equal& __eql)
+ : __table_(__hf, __eql) {
+ __table_.__rehash_multi(__n);
+ insert(__il.begin(), __il.end());
}
template <class _Value, class _Hash, class _Pred, class _Alloc>
unordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset(
- initializer_list<value_type> __il, size_type __n, const hasher& __hf,
- const key_equal& __eql, const allocator_type& __a)
- : __table_(__hf, __eql, __a)
-{
- __table_.__rehash_multi(__n);
- insert(__il.begin(), __il.end());
+ initializer_list<value_type> __il,
+ size_type __n,
+ const hasher& __hf,
+ const key_equal& __eql,
+ const allocator_type& __a)
+ : __table_(__hf, __eql, __a) {
+ __table_.__rehash_multi(__n);
+ insert(__il.begin(), __il.end());
}
template <class _Value, class _Hash, class _Pred, class _Alloc>
-inline
-unordered_multiset<_Value, _Hash, _Pred, _Alloc>&
-unordered_multiset<_Value, _Hash, _Pred, _Alloc>::operator=(
- unordered_multiset&& __u)
- _NOEXCEPT_(is_nothrow_move_assignable<__table>::value)
-{
- __table_ = std::move(__u.__table_);
- return *this;
+inline unordered_multiset<_Value, _Hash, _Pred, _Alloc>&
+unordered_multiset<_Value, _Hash, _Pred, _Alloc>::operator=(unordered_multiset&& __u)
+ _NOEXCEPT_(is_nothrow_move_assignable<__table>::value) {
+ __table_ = std::move(__u.__table_);
+ return *this;
}
template <class _Value, class _Hash, class _Pred, class _Alloc>
-inline
-unordered_multiset<_Value, _Hash, _Pred, _Alloc>&
-unordered_multiset<_Value, _Hash, _Pred, _Alloc>::operator=(
- initializer_list<value_type> __il)
-{
- __table_.__assign_multi(__il.begin(), __il.end());
- return *this;
+inline unordered_multiset<_Value, _Hash, _Pred, _Alloc>&
+unordered_multiset<_Value, _Hash, _Pred, _Alloc>::operator=(initializer_list<value_type> __il) {
+ __table_.__assign_multi(__il.begin(), __il.end());
+ return *this;
}
#endif // _LIBCPP_CXX03_LANG
template <class _Value, class _Hash, class _Pred, class _Alloc>
template <class _InputIterator>
-inline
-void
-unordered_multiset<_Value, _Hash, _Pred, _Alloc>::insert(_InputIterator __first,
- _InputIterator __last)
-{
- for (; __first != __last; ++__first)
- __table_.__insert_multi(*__first);
+inline void unordered_multiset<_Value, _Hash, _Pred, _Alloc>::insert(_InputIterator __first, _InputIterator __last) {
+ for (; __first != __last; ++__first)
+ __table_.__insert_multi(*__first);
}
template <class _Value, class _Hash, class _Pred, class _Alloc>
-inline _LIBCPP_HIDE_FROM_ABI
-void
-swap(unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __x,
- unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __y)
- _NOEXCEPT_(_NOEXCEPT_(__x.swap(__y)))
-{
- __x.swap(__y);
+inline _LIBCPP_HIDE_FROM_ABI void
+swap(unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __x, unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __y)
+ _NOEXCEPT_(_NOEXCEPT_(__x.swap(__y))) {
+ __x.swap(__y);
}
#if _LIBCPP_STD_VER >= 20
-template <class _Value, class _Hash, class _Pred, class _Alloc,
- class _Predicate>
-inline _LIBCPP_HIDE_FROM_ABI
- typename unordered_multiset<_Value, _Hash, _Pred, _Alloc>::size_type
- erase_if(unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __c,
- _Predicate __pred) {
+template <class _Value, class _Hash, class _Pred, class _Alloc, class _Predicate>
+inline _LIBCPP_HIDE_FROM_ABI typename unordered_multiset<_Value, _Hash, _Pred, _Alloc>::size_type
+erase_if(unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __c, _Predicate __pred) {
return std::__libcpp_erase_if_container(__c, __pred);
}
#endif
template <class _Value, class _Hash, class _Pred, class _Alloc>
-_LIBCPP_HIDE_FROM_ABI bool
-operator==(const unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __x,
- const unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __y)
-{
- if (__x.size() != __y.size())
- return false;
- typedef typename unordered_multiset<_Value, _Hash, _Pred, _Alloc>::const_iterator
- const_iterator;
- typedef pair<const_iterator, const_iterator> _EqRng;
- for (const_iterator __i = __x.begin(), __ex = __x.end(); __i != __ex;)
- {
- _EqRng __xeq = __x.equal_range(*__i);
- _EqRng __yeq = __y.equal_range(*__i);
- if (std::distance(__xeq.first, __xeq.second) !=
- std::distance(__yeq.first, __yeq.second) ||
- !std::is_permutation(__xeq.first, __xeq.second, __yeq.first))
- return false;
- __i = __xeq.second;
- }
- return true;
+_LIBCPP_HIDE_FROM_ABI bool operator==(const unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __x,
+ const unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __y) {
+ if (__x.size() != __y.size())
+ return false;
+ typedef typename unordered_multiset<_Value, _Hash, _Pred, _Alloc>::const_iterator const_iterator;
+ typedef pair<const_iterator, const_iterator> _EqRng;
+ for (const_iterator __i = __x.begin(), __ex = __x.end(); __i != __ex;) {
+ _EqRng __xeq = __x.equal_range(*__i);
+ _EqRng __yeq = __y.equal_range(*__i);
+ if (std::distance(__xeq.first, __xeq.second) != std::distance(__yeq.first, __yeq.second) ||
+ !std::is_permutation(__xeq.first, __xeq.second, __yeq.first))
+ return false;
+ __i = __xeq.second;
+ }
+ return true;
}
#if _LIBCPP_STD_VER <= 17
template <class _Value, class _Hash, class _Pred, class _Alloc>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator!=(const unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __x,
- const unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __y)
-{
- return !(__x == __y);
+inline _LIBCPP_HIDE_FROM_ABI bool operator!=(const unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __x,
+ const unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __y) {
+ return !(__x == __y);
}
#endif
@@ -1970,7 +1804,8 @@ template <class _KeyT, class _HashT = std::hash<_KeyT>, class _PredT = std::equa
using unordered_set _LIBCPP_AVAILABILITY_PMR = std::unordered_set<_KeyT, _HashT, _PredT, polymorphic_allocator<_KeyT>>;
template <class _KeyT, class _HashT = std::hash<_KeyT>, class _PredT = std::equal_to<_KeyT>>
-using unordered_multiset _LIBCPP_AVAILABILITY_PMR = std::unordered_multiset<_KeyT, _HashT, _PredT, polymorphic_allocator<_KeyT>>;
+using unordered_multiset _LIBCPP_AVAILABILITY_PMR =
+ std::unordered_multiset<_KeyT, _HashT, _PredT, polymorphic_allocator<_KeyT>>;
} // namespace pmr
_LIBCPP_END_NAMESPACE_STD
#endif
diff --git a/contrib/llvm-project/libcxx/include/valarray b/contrib/llvm-project/libcxx/include/valarray
index 19f26d0940a0..fb6186849521 100644
--- a/contrib/llvm-project/libcxx/include/valarray
+++ b/contrib/llvm-project/libcxx/include/valarray
@@ -379,355 +379,264 @@ _LIBCPP_PUSH_MACROS
_LIBCPP_BEGIN_NAMESPACE_STD
-template<class _Tp> class _LIBCPP_TEMPLATE_VIS valarray;
+template <class _Tp>
+class _LIBCPP_TEMPLATE_VIS valarray;
+
+class _LIBCPP_TEMPLATE_VIS slice {
+ size_t __start_;
+ size_t __size_;
+ size_t __stride_;
-class _LIBCPP_TEMPLATE_VIS slice
-{
- size_t __start_;
- size_t __size_;
- size_t __stride_;
public:
- _LIBCPP_HIDE_FROM_ABI
- slice()
- : __start_(0),
- __size_(0),
- __stride_(0)
- {}
-
- _LIBCPP_HIDE_FROM_ABI
- slice(size_t __start, size_t __size, size_t __stride)
- : __start_(__start),
- __size_(__size),
- __stride_(__stride)
- {}
-
- _LIBCPP_HIDE_FROM_ABI size_t start() const {return __start_;}
- _LIBCPP_HIDE_FROM_ABI size_t size() const {return __size_;}
- _LIBCPP_HIDE_FROM_ABI size_t stride() const {return __stride_;}
+ _LIBCPP_HIDE_FROM_ABI slice() : __start_(0), __size_(0), __stride_(0) {}
+
+ _LIBCPP_HIDE_FROM_ABI slice(size_t __start, size_t __size, size_t __stride)
+ : __start_(__start), __size_(__size), __stride_(__stride) {}
+
+ _LIBCPP_HIDE_FROM_ABI size_t start() const { return __start_; }
+ _LIBCPP_HIDE_FROM_ABI size_t size() const { return __size_; }
+ _LIBCPP_HIDE_FROM_ABI size_t stride() const { return __stride_; }
#if _LIBCPP_STD_VER >= 20
- _LIBCPP_HIDE_FROM_ABI friend bool operator==(const slice& __x, const slice& __y) {
- return __x.start() == __y.start() && __x.size() == __y.size() && __x.stride() == __y.stride();
- }
+ _LIBCPP_HIDE_FROM_ABI friend bool operator==(const slice& __x, const slice& __y) {
+ return __x.start() == __y.start() && __x.size() == __y.size() && __x.stride() == __y.stride();
+ }
#endif
};
-template <class _Tp> class _LIBCPP_TEMPLATE_VIS slice_array;
+template <class _Tp>
+class _LIBCPP_TEMPLATE_VIS slice_array;
class _LIBCPP_EXPORTED_FROM_ABI gslice;
-template <class _Tp> class _LIBCPP_TEMPLATE_VIS gslice_array;
-template <class _Tp> class _LIBCPP_TEMPLATE_VIS mask_array;
-template <class _Tp> class _LIBCPP_TEMPLATE_VIS indirect_array;
+template <class _Tp>
+class _LIBCPP_TEMPLATE_VIS gslice_array;
+template <class _Tp>
+class _LIBCPP_TEMPLATE_VIS mask_array;
+template <class _Tp>
+class _LIBCPP_TEMPLATE_VIS indirect_array;
template <class _Tp>
-_LIBCPP_HIDE_FROM_ABI
-_Tp*
-begin(valarray<_Tp>& __v);
+_LIBCPP_HIDE_FROM_ABI _Tp* begin(valarray<_Tp>& __v);
template <class _Tp>
-_LIBCPP_HIDE_FROM_ABI
-const _Tp*
-begin(const valarray<_Tp>& __v);
+_LIBCPP_HIDE_FROM_ABI const _Tp* begin(const valarray<_Tp>& __v);
template <class _Tp>
-_LIBCPP_HIDE_FROM_ABI
-_Tp*
-end(valarray<_Tp>& __v);
+_LIBCPP_HIDE_FROM_ABI _Tp* end(valarray<_Tp>& __v);
template <class _Tp>
-_LIBCPP_HIDE_FROM_ABI
-const _Tp*
-end(const valarray<_Tp>& __v);
+_LIBCPP_HIDE_FROM_ABI const _Tp* end(const valarray<_Tp>& __v);
template <class _Op, class _A0>
-struct _UnaryOp
-{
- typedef typename _Op::__result_type __result_type;
- using value_type = __decay_t<__result_type>;
+struct _UnaryOp {
+ typedef typename _Op::__result_type __result_type;
+ using value_type = __decay_t<__result_type>;
- _Op __op_;
- _A0 __a0_;
+ _Op __op_;
+ _A0 __a0_;
- _LIBCPP_HIDE_FROM_ABI
- _UnaryOp(const _Op& __op, const _A0& __a0) : __op_(__op), __a0_(__a0) {}
+ _LIBCPP_HIDE_FROM_ABI _UnaryOp(const _Op& __op, const _A0& __a0) : __op_(__op), __a0_(__a0) {}
- _LIBCPP_HIDE_FROM_ABI
- __result_type operator[](size_t __i) const {return __op_(__a0_[__i]);}
+ _LIBCPP_HIDE_FROM_ABI __result_type operator[](size_t __i) const { return __op_(__a0_[__i]); }
- _LIBCPP_HIDE_FROM_ABI
- size_t size() const {return __a0_.size();}
+ _LIBCPP_HIDE_FROM_ABI size_t size() const { return __a0_.size(); }
};
template <class _Op, class _A0, class _A1>
-struct _BinaryOp
-{
- typedef typename _Op::__result_type __result_type;
- using value_type = __decay_t<__result_type>;
+struct _BinaryOp {
+ typedef typename _Op::__result_type __result_type;
+ using value_type = __decay_t<__result_type>;
- _Op __op_;
- _A0 __a0_;
- _A1 __a1_;
+ _Op __op_;
+ _A0 __a0_;
+ _A1 __a1_;
- _LIBCPP_HIDE_FROM_ABI
- _BinaryOp(const _Op& __op, const _A0& __a0, const _A1& __a1)
- : __op_(__op), __a0_(__a0), __a1_(__a1) {}
+ _LIBCPP_HIDE_FROM_ABI _BinaryOp(const _Op& __op, const _A0& __a0, const _A1& __a1)
+ : __op_(__op), __a0_(__a0), __a1_(__a1) {}
- _LIBCPP_HIDE_FROM_ABI
- __result_type operator[](size_t __i) const {return __op_(__a0_[__i], __a1_[__i]);}
+ _LIBCPP_HIDE_FROM_ABI __result_type operator[](size_t __i) const { return __op_(__a0_[__i], __a1_[__i]); }
- _LIBCPP_HIDE_FROM_ABI
- size_t size() const {return __a0_.size();}
+ _LIBCPP_HIDE_FROM_ABI size_t size() const { return __a0_.size(); }
};
template <class _Tp>
-class __scalar_expr
-{
+class __scalar_expr {
public:
- typedef _Tp value_type;
- typedef const _Tp& __result_type;
+ typedef _Tp value_type;
+ typedef const _Tp& __result_type;
+
private:
- const value_type& __t_;
- size_t __s_;
+ const value_type& __t_;
+ size_t __s_;
+
public:
- _LIBCPP_HIDE_FROM_ABI
- explicit __scalar_expr(const value_type& __t, size_t __s) : __t_(__t), __s_(__s) {}
+ _LIBCPP_HIDE_FROM_ABI explicit __scalar_expr(const value_type& __t, size_t __s) : __t_(__t), __s_(__s) {}
- _LIBCPP_HIDE_FROM_ABI
- __result_type operator[](size_t) const {return __t_;}
+ _LIBCPP_HIDE_FROM_ABI __result_type operator[](size_t) const { return __t_; }
- _LIBCPP_HIDE_FROM_ABI
- size_t size() const {return __s_;}
+ _LIBCPP_HIDE_FROM_ABI size_t size() const { return __s_; }
};
template <class _Tp>
-struct __unary_plus
-{
- typedef _Tp __result_type;
- _LIBCPP_HIDE_FROM_ABI
- _Tp operator()(const _Tp& __x) const
- {return +__x;}
+struct __unary_plus {
+ typedef _Tp __result_type;
+ _LIBCPP_HIDE_FROM_ABI _Tp operator()(const _Tp& __x) const { return +__x; }
};
template <class _Tp>
-struct __bit_not
-{
- typedef _Tp __result_type;
- _LIBCPP_HIDE_FROM_ABI
- _Tp operator()(const _Tp& __x) const
- {return ~__x;}
+struct __bit_not {
+ typedef _Tp __result_type;
+ _LIBCPP_HIDE_FROM_ABI _Tp operator()(const _Tp& __x) const { return ~__x; }
};
template <class _Tp>
-struct __bit_shift_left
-{
- typedef _Tp __result_type;
- _LIBCPP_HIDE_FROM_ABI
- _Tp operator()(const _Tp& __x, const _Tp& __y) const
- {return __x << __y;}
+struct __bit_shift_left {
+ typedef _Tp __result_type;
+ _LIBCPP_HIDE_FROM_ABI _Tp operator()(const _Tp& __x, const _Tp& __y) const { return __x << __y; }
};
template <class _Tp>
-struct __bit_shift_right
-{
- typedef _Tp __result_type;
- _LIBCPP_HIDE_FROM_ABI
- _Tp operator()(const _Tp& __x, const _Tp& __y) const
- {return __x >> __y;}
+struct __bit_shift_right {
+ typedef _Tp __result_type;
+ _LIBCPP_HIDE_FROM_ABI _Tp operator()(const _Tp& __x, const _Tp& __y) const { return __x >> __y; }
};
template <class _Tp, class _Fp>
-struct __apply_expr
-{
+struct __apply_expr {
private:
- _Fp __f_;
+ _Fp __f_;
+
public:
- typedef _Tp __result_type;
+ typedef _Tp __result_type;
- _LIBCPP_HIDE_FROM_ABI
- explicit __apply_expr(_Fp __f) : __f_(__f) {}
+ _LIBCPP_HIDE_FROM_ABI explicit __apply_expr(_Fp __f) : __f_(__f) {}
- _LIBCPP_HIDE_FROM_ABI
- _Tp operator()(const _Tp& __x) const
- {return __f_(__x);}
+ _LIBCPP_HIDE_FROM_ABI _Tp operator()(const _Tp& __x) const { return __f_(__x); }
};
template <class _Tp>
-struct __abs_expr
-{
- typedef _Tp __result_type;
- _LIBCPP_HIDE_FROM_ABI
- _Tp operator()(const _Tp& __x) const
- {return std::abs(__x);}
+struct __abs_expr {
+ typedef _Tp __result_type;
+ _LIBCPP_HIDE_FROM_ABI _Tp operator()(const _Tp& __x) const { return std::abs(__x); }
};
template <class _Tp>
-struct __acos_expr
-{
- typedef _Tp __result_type;
- _LIBCPP_HIDE_FROM_ABI
- _Tp operator()(const _Tp& __x) const
- {return std::acos(__x);}
+struct __acos_expr {
+ typedef _Tp __result_type;
+ _LIBCPP_HIDE_FROM_ABI _Tp operator()(const _Tp& __x) const { return std::acos(__x); }
};
template <class _Tp>
-struct __asin_expr
-{
- typedef _Tp __result_type;
- _LIBCPP_HIDE_FROM_ABI
- _Tp operator()(const _Tp& __x) const
- {return std::asin(__x);}
+struct __asin_expr {
+ typedef _Tp __result_type;
+ _LIBCPP_HIDE_FROM_ABI _Tp operator()(const _Tp& __x) const { return std::asin(__x); }
};
template <class _Tp>
-struct __atan_expr
-{
- typedef _Tp __result_type;
- _LIBCPP_HIDE_FROM_ABI
- _Tp operator()(const _Tp& __x) const
- {return std::atan(__x);}
+struct __atan_expr {
+ typedef _Tp __result_type;
+ _LIBCPP_HIDE_FROM_ABI _Tp operator()(const _Tp& __x) const { return std::atan(__x); }
};
template <class _Tp>
-struct __atan2_expr
-{
- typedef _Tp __result_type;
- _LIBCPP_HIDE_FROM_ABI
- _Tp operator()(const _Tp& __x, const _Tp& __y) const
- {return std::atan2(__x, __y);}
+struct __atan2_expr {
+ typedef _Tp __result_type;
+ _LIBCPP_HIDE_FROM_ABI _Tp operator()(const _Tp& __x, const _Tp& __y) const { return std::atan2(__x, __y); }
};
template <class _Tp>
-struct __cos_expr
-{
- typedef _Tp __result_type;
- _LIBCPP_HIDE_FROM_ABI
- _Tp operator()(const _Tp& __x) const
- {return std::cos(__x);}
+struct __cos_expr {
+ typedef _Tp __result_type;
+ _LIBCPP_HIDE_FROM_ABI _Tp operator()(const _Tp& __x) const { return std::cos(__x); }
};
template <class _Tp>
-struct __cosh_expr
-{
- typedef _Tp __result_type;
- _LIBCPP_HIDE_FROM_ABI
- _Tp operator()(const _Tp& __x) const
- {return std::cosh(__x);}
+struct __cosh_expr {
+ typedef _Tp __result_type;
+ _LIBCPP_HIDE_FROM_ABI _Tp operator()(const _Tp& __x) const { return std::cosh(__x); }
};
template <class _Tp>
-struct __exp_expr
-{
- typedef _Tp __result_type;
- _LIBCPP_HIDE_FROM_ABI
- _Tp operator()(const _Tp& __x) const
- {return std::exp(__x);}
+struct __exp_expr {
+ typedef _Tp __result_type;
+ _LIBCPP_HIDE_FROM_ABI _Tp operator()(const _Tp& __x) const { return std::exp(__x); }
};
template <class _Tp>
-struct __log_expr
-{
- typedef _Tp __result_type;
- _LIBCPP_HIDE_FROM_ABI
- _Tp operator()(const _Tp& __x) const
- {return std::log(__x);}
+struct __log_expr {
+ typedef _Tp __result_type;
+ _LIBCPP_HIDE_FROM_ABI _Tp operator()(const _Tp& __x) const { return std::log(__x); }
};
template <class _Tp>
-struct __log10_expr
-{
- typedef _Tp __result_type;
- _LIBCPP_HIDE_FROM_ABI
- _Tp operator()(const _Tp& __x) const
- {return std::log10(__x);}
+struct __log10_expr {
+ typedef _Tp __result_type;
+ _LIBCPP_HIDE_FROM_ABI _Tp operator()(const _Tp& __x) const { return std::log10(__x); }
};
template <class _Tp>
-struct __pow_expr
-{
- typedef _Tp __result_type;
- _LIBCPP_HIDE_FROM_ABI
- _Tp operator()(const _Tp& __x, const _Tp& __y) const
- {return std::pow(__x, __y);}
+struct __pow_expr {
+ typedef _Tp __result_type;
+ _LIBCPP_HIDE_FROM_ABI _Tp operator()(const _Tp& __x, const _Tp& __y) const { return std::pow(__x, __y); }
};
template <class _Tp>
-struct __sin_expr
-{
- typedef _Tp __result_type;
- _LIBCPP_HIDE_FROM_ABI
- _Tp operator()(const _Tp& __x) const
- {return std::sin(__x);}
+struct __sin_expr {
+ typedef _Tp __result_type;
+ _LIBCPP_HIDE_FROM_ABI _Tp operator()(const _Tp& __x) const { return std::sin(__x); }
};
template <class _Tp>
-struct __sinh_expr
-{
- typedef _Tp __result_type;
- _LIBCPP_HIDE_FROM_ABI
- _Tp operator()(const _Tp& __x) const
- {return std::sinh(__x);}
+struct __sinh_expr {
+ typedef _Tp __result_type;
+ _LIBCPP_HIDE_FROM_ABI _Tp operator()(const _Tp& __x) const { return std::sinh(__x); }
};
template <class _Tp>
-struct __sqrt_expr
-{
- typedef _Tp __result_type;
- _LIBCPP_HIDE_FROM_ABI
- _Tp operator()(const _Tp& __x) const
- {return std::sqrt(__x);}
+struct __sqrt_expr {
+ typedef _Tp __result_type;
+ _LIBCPP_HIDE_FROM_ABI _Tp operator()(const _Tp& __x) const { return std::sqrt(__x); }
};
template <class _Tp>
-struct __tan_expr
-{
- typedef _Tp __result_type;
- _LIBCPP_HIDE_FROM_ABI
- _Tp operator()(const _Tp& __x) const
- {return std::tan(__x);}
+struct __tan_expr {
+ typedef _Tp __result_type;
+ _LIBCPP_HIDE_FROM_ABI _Tp operator()(const _Tp& __x) const { return std::tan(__x); }
};
template <class _Tp>
-struct __tanh_expr
-{
- typedef _Tp __result_type;
- _LIBCPP_HIDE_FROM_ABI
- _Tp operator()(const _Tp& __x) const
- {return std::tanh(__x);}
+struct __tanh_expr {
+ typedef _Tp __result_type;
+ _LIBCPP_HIDE_FROM_ABI _Tp operator()(const _Tp& __x) const { return std::tanh(__x); }
};
template <class _ValExpr>
-class __slice_expr
-{
- typedef __libcpp_remove_reference_t<_ValExpr> _RmExpr;
+class __slice_expr {
+ typedef __libcpp_remove_reference_t<_ValExpr> _RmExpr;
+
public:
- typedef typename _RmExpr::value_type value_type;
- typedef value_type __result_type;
+ typedef typename _RmExpr::value_type value_type;
+ typedef value_type __result_type;
private:
- _ValExpr __expr_;
- size_t __start_;
- size_t __size_;
- size_t __stride_;
-
- _LIBCPP_HIDE_FROM_ABI
- __slice_expr(const slice& __sl, const _RmExpr& __e)
- : __expr_(__e),
- __start_(__sl.start()),
- __size_(__sl.size()),
- __stride_(__sl.stride())
- {}
-public:
+ _ValExpr __expr_;
+ size_t __start_;
+ size_t __size_;
+ size_t __stride_;
+
+ _LIBCPP_HIDE_FROM_ABI __slice_expr(const slice& __sl, const _RmExpr& __e)
+ : __expr_(__e), __start_(__sl.start()), __size_(__sl.size()), __stride_(__sl.stride()) {}
- _LIBCPP_HIDE_FROM_ABI
- __result_type operator[](size_t __i) const
- {return __expr_[__start_ + __i * __stride_];}
+public:
+ _LIBCPP_HIDE_FROM_ABI __result_type operator[](size_t __i) const { return __expr_[__start_ + __i * __stride_]; }
- _LIBCPP_HIDE_FROM_ABI
- size_t size() const {return __size_;}
+ _LIBCPP_HIDE_FROM_ABI size_t size() const { return __size_; }
- template <class> friend class __val_expr;
- template <class> friend class _LIBCPP_TEMPLATE_VIS valarray;
+ template <class>
+ friend class __val_expr;
+ template <class>
+ friend class _LIBCPP_TEMPLATE_VIS valarray;
};
template <class _ValExpr>
@@ -737,2576 +646,1904 @@ template <class _ValExpr>
class __indirect_expr;
template <class _ValExpr>
-class __shift_expr
-{
- typedef __libcpp_remove_reference_t<_ValExpr> _RmExpr;
+class __shift_expr {
+ typedef __libcpp_remove_reference_t<_ValExpr> _RmExpr;
+
public:
- typedef typename _RmExpr::value_type value_type;
- typedef value_type __result_type;
+ typedef typename _RmExpr::value_type value_type;
+ typedef value_type __result_type;
private:
- _ValExpr __expr_;
- size_t __size_;
- ptrdiff_t __ul_;
- ptrdiff_t __sn_;
- ptrdiff_t __n_;
- static const ptrdiff_t _Np = static_cast<ptrdiff_t>(
- sizeof(ptrdiff_t) * __CHAR_BIT__ - 1);
-
- _LIBCPP_HIDE_FROM_ABI
- __shift_expr(int __n, const _RmExpr& __e)
- : __expr_(__e),
- __size_(__e.size()),
- __n_(__n)
- {
- ptrdiff_t __neg_n = static_cast<ptrdiff_t>(__n_ >> _Np);
- __sn_ = __neg_n | static_cast<ptrdiff_t>(static_cast<size_t>(-__n_) >> _Np);
- __ul_ = ((__size_ - __n_) & ~__neg_n) | ((__n_ + 1) & __neg_n);
- }
-public:
+ _ValExpr __expr_;
+ size_t __size_;
+ ptrdiff_t __ul_;
+ ptrdiff_t __sn_;
+ ptrdiff_t __n_;
+ static const ptrdiff_t _Np = static_cast<ptrdiff_t>(sizeof(ptrdiff_t) * __CHAR_BIT__ - 1);
+
+ _LIBCPP_HIDE_FROM_ABI __shift_expr(int __n, const _RmExpr& __e) : __expr_(__e), __size_(__e.size()), __n_(__n) {
+ ptrdiff_t __neg_n = static_cast<ptrdiff_t>(__n_ >> _Np);
+ __sn_ = __neg_n | static_cast<ptrdiff_t>(static_cast<size_t>(-__n_) >> _Np);
+ __ul_ = ((__size_ - __n_) & ~__neg_n) | ((__n_ + 1) & __neg_n);
+ }
- _LIBCPP_HIDE_FROM_ABI
- __result_type operator[](size_t __j) const
- {
- ptrdiff_t __i = static_cast<ptrdiff_t>(__j);
- ptrdiff_t __m = (__sn_ * __i - __ul_) >> _Np;
- return (__expr_[(__i + __n_) & __m] & __m) | (value_type() & ~__m);
- }
+public:
+ _LIBCPP_HIDE_FROM_ABI __result_type operator[](size_t __j) const {
+ ptrdiff_t __i = static_cast<ptrdiff_t>(__j);
+ ptrdiff_t __m = (__sn_ * __i - __ul_) >> _Np;
+ return (__expr_[(__i + __n_) & __m] & __m) | (value_type() & ~__m);
+ }
- _LIBCPP_HIDE_FROM_ABI
- size_t size() const {return __size_;}
+ _LIBCPP_HIDE_FROM_ABI size_t size() const { return __size_; }
- template <class> friend class __val_expr;
+ template <class>
+ friend class __val_expr;
};
template <class _ValExpr>
-class __cshift_expr
-{
- typedef __libcpp_remove_reference_t<_ValExpr> _RmExpr;
+class __cshift_expr {
+ typedef __libcpp_remove_reference_t<_ValExpr> _RmExpr;
+
public:
- typedef typename _RmExpr::value_type value_type;
- typedef value_type __result_type;
+ typedef typename _RmExpr::value_type value_type;
+ typedef value_type __result_type;
private:
- _ValExpr __expr_;
- size_t __size_;
- size_t __m_;
- size_t __o1_;
- size_t __o2_;
-
- _LIBCPP_HIDE_FROM_ABI
- __cshift_expr(int __n, const _RmExpr& __e)
- : __expr_(__e),
- __size_(__e.size())
- {
- __n %= static_cast<int>(__size_);
- if (__n >= 0)
- {
- __m_ = __size_ - __n;
- __o1_ = __n;
- __o2_ = __n - __size_;
- }
- else
- {
- __m_ = -__n;
- __o1_ = __n + __size_;
- __o2_ = __n;
- }
- }
-public:
+ _ValExpr __expr_;
+ size_t __size_;
+ size_t __m_;
+ size_t __o1_;
+ size_t __o2_;
+
+ _LIBCPP_HIDE_FROM_ABI __cshift_expr(int __n, const _RmExpr& __e) : __expr_(__e), __size_(__e.size()) {
+ __n %= static_cast<int>(__size_);
+ if (__n >= 0) {
+ __m_ = __size_ - __n;
+ __o1_ = __n;
+ __o2_ = __n - __size_;
+ } else {
+ __m_ = -__n;
+ __o1_ = __n + __size_;
+ __o2_ = __n;
+ }
+ }
- _LIBCPP_HIDE_FROM_ABI
- __result_type operator[](size_t __i) const
- {
- if (__i < __m_)
- return __expr_[__i + __o1_];
- return __expr_[__i + __o2_];
- }
+public:
+ _LIBCPP_HIDE_FROM_ABI __result_type operator[](size_t __i) const {
+ if (__i < __m_)
+ return __expr_[__i + __o1_];
+ return __expr_[__i + __o2_];
+ }
- _LIBCPP_HIDE_FROM_ABI
- size_t size() const {return __size_;}
+ _LIBCPP_HIDE_FROM_ABI size_t size() const { return __size_; }
- template <class> friend class __val_expr;
+ template <class>
+ friend class __val_expr;
};
-template<class _ValExpr>
+template <class _ValExpr>
class __val_expr;
-template<class _ValExpr>
+template <class _ValExpr>
struct __is_val_expr : false_type {};
-template<class _ValExpr>
+template <class _ValExpr>
struct __is_val_expr<__val_expr<_ValExpr> > : true_type {};
-template<class _Tp>
+template <class _Tp>
struct __is_val_expr<valarray<_Tp> > : true_type {};
-template<class _Tp>
-class _LIBCPP_TEMPLATE_VIS valarray
-{
+template <class _Tp>
+class _LIBCPP_TEMPLATE_VIS valarray {
public:
- typedef _Tp value_type;
- typedef _Tp __result_type;
+ typedef _Tp value_type;
+ typedef _Tp __result_type;
private:
- value_type* __begin_;
- value_type* __end_;
+ value_type* __begin_;
+ value_type* __end_;
public:
- // construct/destroy:
- _LIBCPP_HIDE_FROM_ABI
- valarray() : __begin_(nullptr), __end_(nullptr) {}
- inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1
- explicit valarray(size_t __n);
- _LIBCPP_HIDE_FROM_ABI
- valarray(const value_type& __x, size_t __n);
- valarray(const value_type* __p, size_t __n);
- valarray(const valarray& __v);
+ // construct/destroy:
+ _LIBCPP_HIDE_FROM_ABI valarray() : __begin_(nullptr), __end_(nullptr) {}
+ inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1 explicit valarray(size_t __n);
+ _LIBCPP_HIDE_FROM_ABI valarray(const value_type& __x, size_t __n);
+ valarray(const value_type* __p, size_t __n);
+ valarray(const valarray& __v);
#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI
- valarray(valarray&& __v) _NOEXCEPT;
- valarray(initializer_list<value_type> __il);
+ _LIBCPP_HIDE_FROM_ABI valarray(valarray&& __v) _NOEXCEPT;
+ valarray(initializer_list<value_type> __il);
#endif // _LIBCPP_CXX03_LANG
- valarray(const slice_array<value_type>& __sa);
- valarray(const gslice_array<value_type>& __ga);
- valarray(const mask_array<value_type>& __ma);
- valarray(const indirect_array<value_type>& __ia);
- inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1
- ~valarray();
-
- // assignment:
- valarray& operator=(const valarray& __v);
+ valarray(const slice_array<value_type>& __sa);
+ valarray(const gslice_array<value_type>& __ga);
+ valarray(const mask_array<value_type>& __ma);
+ valarray(const indirect_array<value_type>& __ia);
+ inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1 ~valarray();
+
+ // assignment:
+ valarray& operator=(const valarray& __v);
#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI
- valarray& operator=(valarray&& __v) _NOEXCEPT;
- _LIBCPP_HIDE_FROM_ABI
- valarray& operator=(initializer_list<value_type>);
+ _LIBCPP_HIDE_FROM_ABI valarray& operator=(valarray&& __v) _NOEXCEPT;
+ _LIBCPP_HIDE_FROM_ABI valarray& operator=(initializer_list<value_type>);
#endif // _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI
- valarray& operator=(const value_type& __x);
- _LIBCPP_HIDE_FROM_ABI
- valarray& operator=(const slice_array<value_type>& __sa);
- _LIBCPP_HIDE_FROM_ABI
- valarray& operator=(const gslice_array<value_type>& __ga);
- _LIBCPP_HIDE_FROM_ABI
- valarray& operator=(const mask_array<value_type>& __ma);
- _LIBCPP_HIDE_FROM_ABI
- valarray& operator=(const indirect_array<value_type>& __ia);
- template <class _ValExpr>
- _LIBCPP_HIDE_FROM_ABI
- valarray& operator=(const __val_expr<_ValExpr>& __v);
-
- // element access:
- _LIBCPP_HIDE_FROM_ABI
- const value_type& operator[](size_t __i) const {return __begin_[__i];}
-
- _LIBCPP_HIDE_FROM_ABI
- value_type& operator[](size_t __i) {return __begin_[__i];}
-
- // subset operations:
- _LIBCPP_HIDE_FROM_ABI
- __val_expr<__slice_expr<const valarray&> > operator[](slice __s) const;
- _LIBCPP_HIDE_FROM_ABI
- slice_array<value_type> operator[](slice __s);
- _LIBCPP_HIDE_FROM_ABI
- __val_expr<__indirect_expr<const valarray&> > operator[](const gslice& __gs) const;
- _LIBCPP_HIDE_FROM_ABI
- gslice_array<value_type> operator[](const gslice& __gs);
+ _LIBCPP_HIDE_FROM_ABI valarray& operator=(const value_type& __x);
+ _LIBCPP_HIDE_FROM_ABI valarray& operator=(const slice_array<value_type>& __sa);
+ _LIBCPP_HIDE_FROM_ABI valarray& operator=(const gslice_array<value_type>& __ga);
+ _LIBCPP_HIDE_FROM_ABI valarray& operator=(const mask_array<value_type>& __ma);
+ _LIBCPP_HIDE_FROM_ABI valarray& operator=(const indirect_array<value_type>& __ia);
+ template <class _ValExpr>
+ _LIBCPP_HIDE_FROM_ABI valarray& operator=(const __val_expr<_ValExpr>& __v);
+
+ // element access:
+ _LIBCPP_HIDE_FROM_ABI const value_type& operator[](size_t __i) const { return __begin_[__i]; }
+
+ _LIBCPP_HIDE_FROM_ABI value_type& operator[](size_t __i) { return __begin_[__i]; }
+
+ // subset operations:
+ _LIBCPP_HIDE_FROM_ABI __val_expr<__slice_expr<const valarray&> > operator[](slice __s) const;
+ _LIBCPP_HIDE_FROM_ABI slice_array<value_type> operator[](slice __s);
+ _LIBCPP_HIDE_FROM_ABI __val_expr<__indirect_expr<const valarray&> > operator[](const gslice& __gs) const;
+ _LIBCPP_HIDE_FROM_ABI gslice_array<value_type> operator[](const gslice& __gs);
#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI
- __val_expr<__indirect_expr<const valarray&> > operator[](gslice&& __gs) const;
- _LIBCPP_HIDE_FROM_ABI
- gslice_array<value_type> operator[](gslice&& __gs);
+ _LIBCPP_HIDE_FROM_ABI __val_expr<__indirect_expr<const valarray&> > operator[](gslice&& __gs) const;
+ _LIBCPP_HIDE_FROM_ABI gslice_array<value_type> operator[](gslice&& __gs);
#endif // _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI
- __val_expr<__mask_expr<const valarray&> > operator[](const valarray<bool>& __vb) const;
- _LIBCPP_HIDE_FROM_ABI
- mask_array<value_type> operator[](const valarray<bool>& __vb);
+ _LIBCPP_HIDE_FROM_ABI __val_expr<__mask_expr<const valarray&> > operator[](const valarray<bool>& __vb) const;
+ _LIBCPP_HIDE_FROM_ABI mask_array<value_type> operator[](const valarray<bool>& __vb);
#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI
- __val_expr<__mask_expr<const valarray&> > operator[](valarray<bool>&& __vb) const;
- _LIBCPP_HIDE_FROM_ABI
- mask_array<value_type> operator[](valarray<bool>&& __vb);
+ _LIBCPP_HIDE_FROM_ABI __val_expr<__mask_expr<const valarray&> > operator[](valarray<bool>&& __vb) const;
+ _LIBCPP_HIDE_FROM_ABI mask_array<value_type> operator[](valarray<bool>&& __vb);
#endif // _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI
- __val_expr<__indirect_expr<const valarray&> > operator[](const valarray<size_t>& __vs) const;
- _LIBCPP_HIDE_FROM_ABI
- indirect_array<value_type> operator[](const valarray<size_t>& __vs);
+ _LIBCPP_HIDE_FROM_ABI __val_expr<__indirect_expr<const valarray&> > operator[](const valarray<size_t>& __vs) const;
+ _LIBCPP_HIDE_FROM_ABI indirect_array<value_type> operator[](const valarray<size_t>& __vs);
#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI
- __val_expr<__indirect_expr<const valarray&> > operator[](valarray<size_t>&& __vs) const;
- _LIBCPP_HIDE_FROM_ABI
- indirect_array<value_type> operator[](valarray<size_t>&& __vs);
+ _LIBCPP_HIDE_FROM_ABI __val_expr<__indirect_expr<const valarray&> > operator[](valarray<size_t>&& __vs) const;
+ _LIBCPP_HIDE_FROM_ABI indirect_array<value_type> operator[](valarray<size_t>&& __vs);
#endif // _LIBCPP_CXX03_LANG
- // unary operators:
- _LIBCPP_HIDE_FROM_ABI
- __val_expr<_UnaryOp<__unary_plus<_Tp>, const valarray&> > operator+() const;
- _LIBCPP_HIDE_FROM_ABI
- __val_expr<_UnaryOp<negate<_Tp>, const valarray&> > operator-() const;
- _LIBCPP_HIDE_FROM_ABI
- __val_expr<_UnaryOp<__bit_not<_Tp>, const valarray&> > operator~() const;
- _LIBCPP_HIDE_FROM_ABI
- __val_expr<_UnaryOp<logical_not<_Tp>, const valarray&> > operator!() const;
+ // unary operators:
+ _LIBCPP_HIDE_FROM_ABI __val_expr<_UnaryOp<__unary_plus<_Tp>, const valarray&> > operator+() const;
+ _LIBCPP_HIDE_FROM_ABI __val_expr<_UnaryOp<negate<_Tp>, const valarray&> > operator-() const;
+ _LIBCPP_HIDE_FROM_ABI __val_expr<_UnaryOp<__bit_not<_Tp>, const valarray&> > operator~() const;
+ _LIBCPP_HIDE_FROM_ABI __val_expr<_UnaryOp<logical_not<_Tp>, const valarray&> > operator!() const;
- // computed assignment:
- _LIBCPP_HIDE_FROM_ABI
- valarray& operator*= (const value_type& __x);
- _LIBCPP_HIDE_FROM_ABI
- valarray& operator/= (const value_type& __x);
- _LIBCPP_HIDE_FROM_ABI
- valarray& operator%= (const value_type& __x);
- _LIBCPP_HIDE_FROM_ABI
- valarray& operator+= (const value_type& __x);
- _LIBCPP_HIDE_FROM_ABI
- valarray& operator-= (const value_type& __x);
- _LIBCPP_HIDE_FROM_ABI
- valarray& operator^= (const value_type& __x);
- _LIBCPP_HIDE_FROM_ABI
- valarray& operator&= (const value_type& __x);
- _LIBCPP_HIDE_FROM_ABI
- valarray& operator|= (const value_type& __x);
- _LIBCPP_HIDE_FROM_ABI
- valarray& operator<<=(const value_type& __x);
- _LIBCPP_HIDE_FROM_ABI
- valarray& operator>>=(const value_type& __x);
-
- template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI valarray&
- operator*= (const _Expr& __v);
-
- template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI valarray&
- operator/= (const _Expr& __v);
-
- template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI valarray&
- operator%= (const _Expr& __v);
-
- template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI valarray&
- operator+= (const _Expr& __v);
-
- template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI valarray&
- operator-= (const _Expr& __v);
-
- template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI valarray&
- operator^= (const _Expr& __v);
-
- template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI valarray&
- operator|= (const _Expr& __v);
-
- template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI valarray&
- operator&= (const _Expr& __v);
-
- template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI valarray&
- operator<<= (const _Expr& __v);
-
- template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI valarray&
- operator>>= (const _Expr& __v);
+ // computed assignment:
+ _LIBCPP_HIDE_FROM_ABI valarray& operator*=(const value_type& __x);
+ _LIBCPP_HIDE_FROM_ABI valarray& operator/=(const value_type& __x);
+ _LIBCPP_HIDE_FROM_ABI valarray& operator%=(const value_type& __x);
+ _LIBCPP_HIDE_FROM_ABI valarray& operator+=(const value_type& __x);
+ _LIBCPP_HIDE_FROM_ABI valarray& operator-=(const value_type& __x);
+ _LIBCPP_HIDE_FROM_ABI valarray& operator^=(const value_type& __x);
+ _LIBCPP_HIDE_FROM_ABI valarray& operator&=(const value_type& __x);
+ _LIBCPP_HIDE_FROM_ABI valarray& operator|=(const value_type& __x);
+ _LIBCPP_HIDE_FROM_ABI valarray& operator<<=(const value_type& __x);
+ _LIBCPP_HIDE_FROM_ABI valarray& operator>>=(const value_type& __x);
- // member functions:
- _LIBCPP_HIDE_FROM_ABI
- void swap(valarray& __v) _NOEXCEPT;
+ template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI valarray& operator*=(const _Expr& __v);
- _LIBCPP_HIDE_FROM_ABI
- size_t size() const {return static_cast<size_t>(__end_ - __begin_);}
+ template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI valarray& operator/=(const _Expr& __v);
- _LIBCPP_HIDE_FROM_ABI
- value_type sum() const;
- _LIBCPP_HIDE_FROM_ABI
- value_type min() const;
- _LIBCPP_HIDE_FROM_ABI
- value_type max() const;
+ template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI valarray& operator%=(const _Expr& __v);
+
+ template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI valarray& operator+=(const _Expr& __v);
+
+ template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI valarray& operator-=(const _Expr& __v);
- valarray shift (int __i) const;
- valarray cshift(int __i) const;
- valarray apply(value_type __f(value_type)) const;
- valarray apply(value_type __f(const value_type&)) const;
- void resize(size_t __n, value_type __x = value_type());
+ template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI valarray& operator^=(const _Expr& __v);
+
+ template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI valarray& operator|=(const _Expr& __v);
+
+ template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI valarray& operator&=(const _Expr& __v);
+
+ template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI valarray& operator<<=(const _Expr& __v);
+
+ template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI valarray& operator>>=(const _Expr& __v);
+
+ // member functions:
+ _LIBCPP_HIDE_FROM_ABI void swap(valarray& __v) _NOEXCEPT;
+
+ _LIBCPP_HIDE_FROM_ABI size_t size() const { return static_cast<size_t>(__end_ - __begin_); }
+
+ _LIBCPP_HIDE_FROM_ABI value_type sum() const;
+ _LIBCPP_HIDE_FROM_ABI value_type min() const;
+ _LIBCPP_HIDE_FROM_ABI value_type max() const;
+
+ valarray shift(int __i) const;
+ valarray cshift(int __i) const;
+ valarray apply(value_type __f(value_type)) const;
+ valarray apply(value_type __f(const value_type&)) const;
+ void resize(size_t __n, value_type __x = value_type());
private:
- template <class> friend class _LIBCPP_TEMPLATE_VIS valarray;
- template <class> friend class _LIBCPP_TEMPLATE_VIS slice_array;
- template <class> friend class _LIBCPP_TEMPLATE_VIS gslice_array;
- template <class> friend class _LIBCPP_TEMPLATE_VIS mask_array;
- template <class> friend class __mask_expr;
- template <class> friend class _LIBCPP_TEMPLATE_VIS indirect_array;
- template <class> friend class __indirect_expr;
- template <class> friend class __val_expr;
-
- template <class _Up>
- friend
- _Up*
- begin(valarray<_Up>& __v);
-
- template <class _Up>
- friend
- const _Up*
- begin(const valarray<_Up>& __v);
-
- template <class _Up>
- friend
- _Up*
- end(valarray<_Up>& __v);
-
- template <class _Up>
- friend
- const _Up*
- end(const valarray<_Up>& __v);
-
- _LIBCPP_HIDE_FROM_ABI
- void __clear(size_t __capacity);
- valarray& __assign_range(const value_type* __f, const value_type* __l);
+ template <class>
+ friend class _LIBCPP_TEMPLATE_VIS valarray;
+ template <class>
+ friend class _LIBCPP_TEMPLATE_VIS slice_array;
+ template <class>
+ friend class _LIBCPP_TEMPLATE_VIS gslice_array;
+ template <class>
+ friend class _LIBCPP_TEMPLATE_VIS mask_array;
+ template <class>
+ friend class __mask_expr;
+ template <class>
+ friend class _LIBCPP_TEMPLATE_VIS indirect_array;
+ template <class>
+ friend class __indirect_expr;
+ template <class>
+ friend class __val_expr;
+
+ template <class _Up>
+ friend _Up* begin(valarray<_Up>& __v);
+
+ template <class _Up>
+ friend const _Up* begin(const valarray<_Up>& __v);
+
+ template <class _Up>
+ friend _Up* end(valarray<_Up>& __v);
+
+ template <class _Up>
+ friend const _Up* end(const valarray<_Up>& __v);
+
+ _LIBCPP_HIDE_FROM_ABI void __clear(size_t __capacity);
+ valarray& __assign_range(const value_type* __f, const value_type* __l);
};
#if _LIBCPP_STD_VER >= 17
-template<class _Tp, size_t _Size>
-valarray(const _Tp(&)[_Size], size_t) -> valarray<_Tp>;
+template <class _Tp, size_t _Size>
+valarray(const _Tp (&)[_Size], size_t) -> valarray<_Tp>;
#endif
extern template _LIBCPP_EXPORTED_FROM_ABI void valarray<size_t>::resize(size_t, size_t);
template <class _Op, class _Tp>
-struct _UnaryOp<_Op, valarray<_Tp> >
-{
- typedef typename _Op::__result_type __result_type;
- using value_type = __decay_t<__result_type>;
+struct _UnaryOp<_Op, valarray<_Tp> > {
+ typedef typename _Op::__result_type __result_type;
+ using value_type = __decay_t<__result_type>;
- _Op __op_;
- const valarray<_Tp>& __a0_;
+ _Op __op_;
+ const valarray<_Tp>& __a0_;
- _LIBCPP_HIDE_FROM_ABI
- _UnaryOp(const _Op& __op, const valarray<_Tp>& __a0) : __op_(__op), __a0_(__a0) {}
+ _LIBCPP_HIDE_FROM_ABI _UnaryOp(const _Op& __op, const valarray<_Tp>& __a0) : __op_(__op), __a0_(__a0) {}
- _LIBCPP_HIDE_FROM_ABI
- __result_type operator[](size_t __i) const {return __op_(__a0_[__i]);}
+ _LIBCPP_HIDE_FROM_ABI __result_type operator[](size_t __i) const { return __op_(__a0_[__i]); }
- _LIBCPP_HIDE_FROM_ABI
- size_t size() const {return __a0_.size();}
+ _LIBCPP_HIDE_FROM_ABI size_t size() const { return __a0_.size(); }
};
template <class _Op, class _Tp, class _A1>
-struct _BinaryOp<_Op, valarray<_Tp>, _A1>
-{
- typedef typename _Op::__result_type __result_type;
- using value_type = __decay_t<__result_type>;
+struct _BinaryOp<_Op, valarray<_Tp>, _A1> {
+ typedef typename _Op::__result_type __result_type;
+ using value_type = __decay_t<__result_type>;
- _Op __op_;
- const valarray<_Tp>& __a0_;
- _A1 __a1_;
+ _Op __op_;
+ const valarray<_Tp>& __a0_;
+ _A1 __a1_;
- _LIBCPP_HIDE_FROM_ABI
- _BinaryOp(const _Op& __op, const valarray<_Tp>& __a0, const _A1& __a1)
- : __op_(__op), __a0_(__a0), __a1_(__a1) {}
+ _LIBCPP_HIDE_FROM_ABI _BinaryOp(const _Op& __op, const valarray<_Tp>& __a0, const _A1& __a1)
+ : __op_(__op), __a0_(__a0), __a1_(__a1) {}
- _LIBCPP_HIDE_FROM_ABI
- __result_type operator[](size_t __i) const {return __op_(__a0_[__i], __a1_[__i]);}
+ _LIBCPP_HIDE_FROM_ABI __result_type operator[](size_t __i) const { return __op_(__a0_[__i], __a1_[__i]); }
- _LIBCPP_HIDE_FROM_ABI
- size_t size() const {return __a0_.size();}
+ _LIBCPP_HIDE_FROM_ABI size_t size() const { return __a0_.size(); }
};
template <class _Op, class _A0, class _Tp>
-struct _BinaryOp<_Op, _A0, valarray<_Tp> >
-{
- typedef typename _Op::__result_type __result_type;
- using value_type = __decay_t<__result_type>;
+struct _BinaryOp<_Op, _A0, valarray<_Tp> > {
+ typedef typename _Op::__result_type __result_type;
+ using value_type = __decay_t<__result_type>;
- _Op __op_;
- _A0 __a0_;
- const valarray<_Tp>& __a1_;
+ _Op __op_;
+ _A0 __a0_;
+ const valarray<_Tp>& __a1_;
- _LIBCPP_HIDE_FROM_ABI
- _BinaryOp(const _Op& __op, const _A0& __a0, const valarray<_Tp>& __a1)
- : __op_(__op), __a0_(__a0), __a1_(__a1) {}
+ _LIBCPP_HIDE_FROM_ABI _BinaryOp(const _Op& __op, const _A0& __a0, const valarray<_Tp>& __a1)
+ : __op_(__op), __a0_(__a0), __a1_(__a1) {}
- _LIBCPP_HIDE_FROM_ABI
- __result_type operator[](size_t __i) const {return __op_(__a0_[__i], __a1_[__i]);}
+ _LIBCPP_HIDE_FROM_ABI __result_type operator[](size_t __i) const { return __op_(__a0_[__i], __a1_[__i]); }
- _LIBCPP_HIDE_FROM_ABI
- size_t size() const {return __a0_.size();}
+ _LIBCPP_HIDE_FROM_ABI size_t size() const { return __a0_.size(); }
};
template <class _Op, class _Tp>
-struct _BinaryOp<_Op, valarray<_Tp>, valarray<_Tp> >
-{
- typedef typename _Op::__result_type __result_type;
- using value_type = __decay_t<__result_type>;
+struct _BinaryOp<_Op, valarray<_Tp>, valarray<_Tp> > {
+ typedef typename _Op::__result_type __result_type;
+ using value_type = __decay_t<__result_type>;
- _Op __op_;
- const valarray<_Tp>& __a0_;
- const valarray<_Tp>& __a1_;
+ _Op __op_;
+ const valarray<_Tp>& __a0_;
+ const valarray<_Tp>& __a1_;
- _LIBCPP_HIDE_FROM_ABI
- _BinaryOp(const _Op& __op, const valarray<_Tp>& __a0, const valarray<_Tp>& __a1)
- : __op_(__op), __a0_(__a0), __a1_(__a1) {}
+ _LIBCPP_HIDE_FROM_ABI _BinaryOp(const _Op& __op, const valarray<_Tp>& __a0, const valarray<_Tp>& __a1)
+ : __op_(__op), __a0_(__a0), __a1_(__a1) {}
- _LIBCPP_HIDE_FROM_ABI
- __result_type operator[](size_t __i) const {return __op_(__a0_[__i], __a1_[__i]);}
+ _LIBCPP_HIDE_FROM_ABI __result_type operator[](size_t __i) const { return __op_(__a0_[__i], __a1_[__i]); }
- _LIBCPP_HIDE_FROM_ABI
- size_t size() const {return __a0_.size();}
+ _LIBCPP_HIDE_FROM_ABI size_t size() const { return __a0_.size(); }
};
// slice_array
template <class _Tp>
-class _LIBCPP_TEMPLATE_VIS slice_array
-{
+class _LIBCPP_TEMPLATE_VIS slice_array {
public:
- typedef _Tp value_type;
+ typedef _Tp value_type;
private:
- value_type* __vp_;
- size_t __size_;
- size_t __stride_;
+ value_type* __vp_;
+ size_t __size_;
+ size_t __stride_;
public:
- template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
- void
- _LIBCPP_HIDE_FROM_ABI
- operator=(const _Expr& __v) const;
-
- template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
- void
- _LIBCPP_HIDE_FROM_ABI
- operator*=(const _Expr& __v) const;
-
- template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
- void
- _LIBCPP_HIDE_FROM_ABI
- operator/=(const _Expr& __v) const;
-
- template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
- void
- _LIBCPP_HIDE_FROM_ABI
- operator%=(const _Expr& __v) const;
-
- template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
- void
- _LIBCPP_HIDE_FROM_ABI
- operator+=(const _Expr& __v) const;
-
- template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
- void
- _LIBCPP_HIDE_FROM_ABI
- operator-=(const _Expr& __v) const;
-
- template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
- void
- _LIBCPP_HIDE_FROM_ABI
- operator^=(const _Expr& __v) const;
-
- template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
- void
- _LIBCPP_HIDE_FROM_ABI
- operator&=(const _Expr& __v) const;
-
- template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
- void
- _LIBCPP_HIDE_FROM_ABI
- operator|=(const _Expr& __v) const;
-
- template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
- void
- _LIBCPP_HIDE_FROM_ABI
- operator<<=(const _Expr& __v) const;
-
- template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
- void
- _LIBCPP_HIDE_FROM_ABI
- operator>>=(const _Expr& __v) const;
-
- slice_array(slice_array const&) = default;
-
- _LIBCPP_HIDE_FROM_ABI
- const slice_array& operator=(const slice_array& __sa) const;
-
- _LIBCPP_HIDE_FROM_ABI
- void operator=(const value_type& __x) const;
-
- _LIBCPP_HIDE_FROM_ABI
- void operator=(const valarray<value_type>& __va) const;
+ template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
+ void _LIBCPP_HIDE_FROM_ABI operator=(const _Expr& __v) const;
+
+ template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
+ void _LIBCPP_HIDE_FROM_ABI operator*=(const _Expr& __v) const;
+
+ template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
+ void _LIBCPP_HIDE_FROM_ABI operator/=(const _Expr& __v) const;
+
+ template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
+ void _LIBCPP_HIDE_FROM_ABI operator%=(const _Expr& __v) const;
+
+ template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
+ void _LIBCPP_HIDE_FROM_ABI operator+=(const _Expr& __v) const;
+
+ template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
+ void _LIBCPP_HIDE_FROM_ABI operator-=(const _Expr& __v) const;
+
+ template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
+ void _LIBCPP_HIDE_FROM_ABI operator^=(const _Expr& __v) const;
+
+ template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
+ void _LIBCPP_HIDE_FROM_ABI operator&=(const _Expr& __v) const;
+
+ template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
+ void _LIBCPP_HIDE_FROM_ABI operator|=(const _Expr& __v) const;
+
+ template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
+ void _LIBCPP_HIDE_FROM_ABI operator<<=(const _Expr& __v) const;
+
+ template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
+ void _LIBCPP_HIDE_FROM_ABI operator>>=(const _Expr& __v) const;
+
+ slice_array(slice_array const&) = default;
+
+ _LIBCPP_HIDE_FROM_ABI const slice_array& operator=(const slice_array& __sa) const;
+
+ _LIBCPP_HIDE_FROM_ABI void operator=(const value_type& __x) const;
+
+ _LIBCPP_HIDE_FROM_ABI void operator=(const valarray<value_type>& __va) const;
private:
- _LIBCPP_HIDE_FROM_ABI
- slice_array(const slice& __sl, const valarray<value_type>& __v)
- : __vp_(const_cast<value_type*>(__v.__begin_ + __sl.start())),
- __size_(__sl.size()),
- __stride_(__sl.stride())
- {}
-
- template <class> friend class valarray;
+ _LIBCPP_HIDE_FROM_ABI slice_array(const slice& __sl, const valarray<value_type>& __v)
+ : __vp_(const_cast<value_type*>(__v.__begin_ + __sl.start())), __size_(__sl.size()), __stride_(__sl.stride()) {}
+
+ template <class>
+ friend class valarray;
};
template <class _Tp>
-inline
-const slice_array<_Tp>&
-slice_array<_Tp>::operator=(const slice_array& __sa) const
-{
- value_type* __t = __vp_;
- const value_type* __s = __sa.__vp_;
- for (size_t __n = __size_; __n; --__n, __t += __stride_, __s += __sa.__stride_)
- *__t = *__s;
- return *this;
+inline const slice_array<_Tp>& slice_array<_Tp>::operator=(const slice_array& __sa) const {
+ value_type* __t = __vp_;
+ const value_type* __s = __sa.__vp_;
+ for (size_t __n = __size_; __n; --__n, __t += __stride_, __s += __sa.__stride_)
+ *__t = *__s;
+ return *this;
}
template <class _Tp>
template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> >
-inline
-void
-slice_array<_Tp>::operator=(const _Expr& __v) const
-{
- value_type* __t = __vp_;
- for (size_t __i = 0; __i < __size_; ++__i, __t += __stride_)
- *__t = __v[__i];
+inline void slice_array<_Tp>::operator=(const _Expr& __v) const {
+ value_type* __t = __vp_;
+ for (size_t __i = 0; __i < __size_; ++__i, __t += __stride_)
+ *__t = __v[__i];
}
template <class _Tp>
-inline void
-slice_array<_Tp>::operator=(const valarray<value_type>& __va) const
-{
- value_type* __t = __vp_;
- for (size_t __i = 0; __i < __va.size(); ++__i, __t += __stride_)
- *__t = __va[__i];
+inline void slice_array<_Tp>::operator=(const valarray<value_type>& __va) const {
+ value_type* __t = __vp_;
+ for (size_t __i = 0; __i < __va.size(); ++__i, __t += __stride_)
+ *__t = __va[__i];
}
template <class _Tp>
template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> >
-inline
-void
-slice_array<_Tp>::operator*=(const _Expr& __v) const
-{
- value_type* __t = __vp_;
- for (size_t __i = 0; __i < __size_; ++__i, __t += __stride_)
- *__t *= __v[__i];
+inline void slice_array<_Tp>::operator*=(const _Expr& __v) const {
+ value_type* __t = __vp_;
+ for (size_t __i = 0; __i < __size_; ++__i, __t += __stride_)
+ *__t *= __v[__i];
}
template <class _Tp>
template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> >
-inline
-void
-slice_array<_Tp>::operator/=(const _Expr& __v) const
-{
- value_type* __t = __vp_;
- for (size_t __i = 0; __i < __size_; ++__i, __t += __stride_)
- *__t /= __v[__i];
+inline void slice_array<_Tp>::operator/=(const _Expr& __v) const {
+ value_type* __t = __vp_;
+ for (size_t __i = 0; __i < __size_; ++__i, __t += __stride_)
+ *__t /= __v[__i];
}
template <class _Tp>
template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> >
-inline
-void
-slice_array<_Tp>::operator%=(const _Expr& __v) const
-{
- value_type* __t = __vp_;
- for (size_t __i = 0; __i < __size_; ++__i, __t += __stride_)
- *__t %= __v[__i];
+inline void slice_array<_Tp>::operator%=(const _Expr& __v) const {
+ value_type* __t = __vp_;
+ for (size_t __i = 0; __i < __size_; ++__i, __t += __stride_)
+ *__t %= __v[__i];
}
template <class _Tp>
template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> >
-inline
-void
-slice_array<_Tp>::operator+=(const _Expr& __v) const
-{
- value_type* __t = __vp_;
- for (size_t __i = 0; __i < __size_; ++__i, __t += __stride_)
- *__t += __v[__i];
+inline void slice_array<_Tp>::operator+=(const _Expr& __v) const {
+ value_type* __t = __vp_;
+ for (size_t __i = 0; __i < __size_; ++__i, __t += __stride_)
+ *__t += __v[__i];
}
template <class _Tp>
template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> >
-inline
-void
-slice_array<_Tp>::operator-=(const _Expr& __v) const
-{
- value_type* __t = __vp_;
- for (size_t __i = 0; __i < __size_; ++__i, __t += __stride_)
- *__t -= __v[__i];
+inline void slice_array<_Tp>::operator-=(const _Expr& __v) const {
+ value_type* __t = __vp_;
+ for (size_t __i = 0; __i < __size_; ++__i, __t += __stride_)
+ *__t -= __v[__i];
}
template <class _Tp>
template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> >
-inline
-void
-slice_array<_Tp>::operator^=(const _Expr& __v) const
-{
- value_type* __t = __vp_;
- for (size_t __i = 0; __i < __size_; ++__i, __t += __stride_)
- *__t ^= __v[__i];
+inline void slice_array<_Tp>::operator^=(const _Expr& __v) const {
+ value_type* __t = __vp_;
+ for (size_t __i = 0; __i < __size_; ++__i, __t += __stride_)
+ *__t ^= __v[__i];
}
template <class _Tp>
template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> >
-inline
-void
-slice_array<_Tp>::operator&=(const _Expr& __v) const
-{
- value_type* __t = __vp_;
- for (size_t __i = 0; __i < __size_; ++__i, __t += __stride_)
- *__t &= __v[__i];
+inline void slice_array<_Tp>::operator&=(const _Expr& __v) const {
+ value_type* __t = __vp_;
+ for (size_t __i = 0; __i < __size_; ++__i, __t += __stride_)
+ *__t &= __v[__i];
}
template <class _Tp>
template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> >
-inline
-void
-slice_array<_Tp>::operator|=(const _Expr& __v) const
-{
- value_type* __t = __vp_;
- for (size_t __i = 0; __i < __size_; ++__i, __t += __stride_)
- *__t |= __v[__i];
+inline void slice_array<_Tp>::operator|=(const _Expr& __v) const {
+ value_type* __t = __vp_;
+ for (size_t __i = 0; __i < __size_; ++__i, __t += __stride_)
+ *__t |= __v[__i];
}
template <class _Tp>
template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> >
-inline
-void
-slice_array<_Tp>::operator<<=(const _Expr& __v) const
-{
- value_type* __t = __vp_;
- for (size_t __i = 0; __i < __size_; ++__i, __t += __stride_)
- *__t <<= __v[__i];
+inline void slice_array<_Tp>::operator<<=(const _Expr& __v) const {
+ value_type* __t = __vp_;
+ for (size_t __i = 0; __i < __size_; ++__i, __t += __stride_)
+ *__t <<= __v[__i];
}
template <class _Tp>
template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> >
-inline
-void
-slice_array<_Tp>::operator>>=(const _Expr& __v) const
-{
- value_type* __t = __vp_;
- for (size_t __i = 0; __i < __size_; ++__i, __t += __stride_)
- *__t >>= __v[__i];
+inline void slice_array<_Tp>::operator>>=(const _Expr& __v) const {
+ value_type* __t = __vp_;
+ for (size_t __i = 0; __i < __size_; ++__i, __t += __stride_)
+ *__t >>= __v[__i];
}
template <class _Tp>
-inline
-void
-slice_array<_Tp>::operator=(const value_type& __x) const
-{
- value_type* __t = __vp_;
- for (size_t __n = __size_; __n; --__n, __t += __stride_)
- *__t = __x;
+inline void slice_array<_Tp>::operator=(const value_type& __x) const {
+ value_type* __t = __vp_;
+ for (size_t __n = __size_; __n; --__n, __t += __stride_)
+ *__t = __x;
}
// gslice
-class _LIBCPP_EXPORTED_FROM_ABI gslice
-{
- valarray<size_t> __size_;
- valarray<size_t> __stride_;
- valarray<size_t> __1d_;
+class _LIBCPP_EXPORTED_FROM_ABI gslice {
+ valarray<size_t> __size_;
+ valarray<size_t> __stride_;
+ valarray<size_t> __1d_;
public:
- _LIBCPP_HIDE_FROM_ABI
- gslice() {}
+ _LIBCPP_HIDE_FROM_ABI gslice() {}
- _LIBCPP_HIDE_FROM_ABI
- gslice(size_t __start, const valarray<size_t>& __size,
- const valarray<size_t>& __stride)
- : __size_(__size),
- __stride_(__stride)
- {__init(__start);}
+ _LIBCPP_HIDE_FROM_ABI gslice(size_t __start, const valarray<size_t>& __size, const valarray<size_t>& __stride)
+ : __size_(__size), __stride_(__stride) {
+ __init(__start);
+ }
#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI
- gslice(size_t __start, const valarray<size_t>& __size,
- valarray<size_t>&& __stride)
- : __size_(__size),
- __stride_(std::move(__stride))
- {__init(__start);}
-
- _LIBCPP_HIDE_FROM_ABI
- gslice(size_t __start, valarray<size_t>&& __size,
- const valarray<size_t>& __stride)
- : __size_(std::move(__size)),
- __stride_(__stride)
- {__init(__start);}
-
- _LIBCPP_HIDE_FROM_ABI
- gslice(size_t __start, valarray<size_t>&& __size,
- valarray<size_t>&& __stride)
- : __size_(std::move(__size)),
- __stride_(std::move(__stride))
- {__init(__start);}
+ _LIBCPP_HIDE_FROM_ABI gslice(size_t __start, const valarray<size_t>& __size, valarray<size_t>&& __stride)
+ : __size_(__size), __stride_(std::move(__stride)) {
+ __init(__start);
+ }
+
+ _LIBCPP_HIDE_FROM_ABI gslice(size_t __start, valarray<size_t>&& __size, const valarray<size_t>& __stride)
+ : __size_(std::move(__size)), __stride_(__stride) {
+ __init(__start);
+ }
+
+ _LIBCPP_HIDE_FROM_ABI gslice(size_t __start, valarray<size_t>&& __size, valarray<size_t>&& __stride)
+ : __size_(std::move(__size)), __stride_(std::move(__stride)) {
+ __init(__start);
+ }
#endif // _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI
- size_t start() const {return __1d_.size() ? __1d_[0] : 0;}
+ _LIBCPP_HIDE_FROM_ABI size_t start() const { return __1d_.size() ? __1d_[0] : 0; }
- _LIBCPP_HIDE_FROM_ABI
- valarray<size_t> size() const {return __size_;}
+ _LIBCPP_HIDE_FROM_ABI valarray<size_t> size() const { return __size_; }
- _LIBCPP_HIDE_FROM_ABI
- valarray<size_t> stride() const {return __stride_;}
+ _LIBCPP_HIDE_FROM_ABI valarray<size_t> stride() const { return __stride_; }
private:
- void __init(size_t __start);
-
- template <class> friend class gslice_array;
- template <class> friend class valarray;
- template <class> friend class __val_expr;
+ void __init(size_t __start);
+
+ template <class>
+ friend class gslice_array;
+ template <class>
+ friend class valarray;
+ template <class>
+ friend class __val_expr;
};
// gslice_array
template <class _Tp>
-class _LIBCPP_TEMPLATE_VIS gslice_array
-{
+class _LIBCPP_TEMPLATE_VIS gslice_array {
public:
- typedef _Tp value_type;
+ typedef _Tp value_type;
private:
- value_type* __vp_;
- valarray<size_t> __1d_;
+ value_type* __vp_;
+ valarray<size_t> __1d_;
public:
- template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
- void
- _LIBCPP_HIDE_FROM_ABI
- operator=(const _Expr& __v) const;
-
- template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
- void
- _LIBCPP_HIDE_FROM_ABI
- operator*=(const _Expr& __v) const;
-
- template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
- void
- _LIBCPP_HIDE_FROM_ABI
- operator/=(const _Expr& __v) const;
-
- template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
- void
- _LIBCPP_HIDE_FROM_ABI
- operator%=(const _Expr& __v) const;
-
- template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
- void
- _LIBCPP_HIDE_FROM_ABI
- operator+=(const _Expr& __v) const;
-
- template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
- void
- _LIBCPP_HIDE_FROM_ABI
- operator-=(const _Expr& __v) const;
-
- template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
- void
- _LIBCPP_HIDE_FROM_ABI
- operator^=(const _Expr& __v) const;
-
- template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
- void
- _LIBCPP_HIDE_FROM_ABI
- operator&=(const _Expr& __v) const;
-
- template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
- void
- _LIBCPP_HIDE_FROM_ABI
- operator|=(const _Expr& __v) const;
-
- template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
- void
- _LIBCPP_HIDE_FROM_ABI
- operator<<=(const _Expr& __v) const;
-
- template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
- void
- _LIBCPP_HIDE_FROM_ABI
- operator>>=(const _Expr& __v) const;
-
- _LIBCPP_HIDE_FROM_ABI
- const gslice_array& operator=(const gslice_array& __ga) const;
-
- _LIBCPP_HIDE_FROM_ABI
- void operator=(const value_type& __x) const;
-
- gslice_array(const gslice_array&) = default;
+ template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
+ void _LIBCPP_HIDE_FROM_ABI operator=(const _Expr& __v) const;
+
+ template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
+ void _LIBCPP_HIDE_FROM_ABI operator*=(const _Expr& __v) const;
+
+ template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
+ void _LIBCPP_HIDE_FROM_ABI operator/=(const _Expr& __v) const;
+
+ template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
+ void _LIBCPP_HIDE_FROM_ABI operator%=(const _Expr& __v) const;
+
+ template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
+ void _LIBCPP_HIDE_FROM_ABI operator+=(const _Expr& __v) const;
+
+ template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
+ void _LIBCPP_HIDE_FROM_ABI operator-=(const _Expr& __v) const;
+
+ template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
+ void _LIBCPP_HIDE_FROM_ABI operator^=(const _Expr& __v) const;
+
+ template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
+ void _LIBCPP_HIDE_FROM_ABI operator&=(const _Expr& __v) const;
+
+ template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
+ void _LIBCPP_HIDE_FROM_ABI operator|=(const _Expr& __v) const;
+
+ template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
+ void _LIBCPP_HIDE_FROM_ABI operator<<=(const _Expr& __v) const;
+
+ template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
+ void _LIBCPP_HIDE_FROM_ABI operator>>=(const _Expr& __v) const;
+
+ _LIBCPP_HIDE_FROM_ABI const gslice_array& operator=(const gslice_array& __ga) const;
+
+ _LIBCPP_HIDE_FROM_ABI void operator=(const value_type& __x) const;
+
+ gslice_array(const gslice_array&) = default;
private:
- gslice_array(const gslice& __gs, const valarray<value_type>& __v)
- : __vp_(const_cast<value_type*>(__v.__begin_)),
- __1d_(__gs.__1d_)
- {}
+ gslice_array(const gslice& __gs, const valarray<value_type>& __v)
+ : __vp_(const_cast<value_type*>(__v.__begin_)), __1d_(__gs.__1d_) {}
#ifndef _LIBCPP_CXX03_LANG
- gslice_array(gslice&& __gs, const valarray<value_type>& __v)
- : __vp_(const_cast<value_type*>(__v.__begin_)),
- __1d_(std::move(__gs.__1d_))
- {}
+ gslice_array(gslice&& __gs, const valarray<value_type>& __v)
+ : __vp_(const_cast<value_type*>(__v.__begin_)), __1d_(std::move(__gs.__1d_)) {}
#endif // _LIBCPP_CXX03_LANG
- template <class> friend class valarray;
+ template <class>
+ friend class valarray;
};
template <class _Tp>
template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> >
-inline
-void
-gslice_array<_Tp>::operator=(const _Expr& __v) const
-{
- typedef const size_t* _Ip;
- size_t __j = 0;
- for (_Ip __i = __1d_.__begin_, __e = __1d_.__end_; __i != __e; ++__i, ++__j)
- __vp_[*__i] = __v[__j];
+inline void gslice_array<_Tp>::operator=(const _Expr& __v) const {
+ typedef const size_t* _Ip;
+ size_t __j = 0;
+ for (_Ip __i = __1d_.__begin_, __e = __1d_.__end_; __i != __e; ++__i, ++__j)
+ __vp_[*__i] = __v[__j];
}
template <class _Tp>
template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> >
-inline
-void
-gslice_array<_Tp>::operator*=(const _Expr& __v) const
-{
- typedef const size_t* _Ip;
- size_t __j = 0;
- for (_Ip __i = __1d_.__begin_, __e = __1d_.__end_; __i != __e; ++__i, ++__j)
- __vp_[*__i] *= __v[__j];
+inline void gslice_array<_Tp>::operator*=(const _Expr& __v) const {
+ typedef const size_t* _Ip;
+ size_t __j = 0;
+ for (_Ip __i = __1d_.__begin_, __e = __1d_.__end_; __i != __e; ++__i, ++__j)
+ __vp_[*__i] *= __v[__j];
}
template <class _Tp>
template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> >
-inline
-void
-gslice_array<_Tp>::operator/=(const _Expr& __v) const
-{
- typedef const size_t* _Ip;
- size_t __j = 0;
- for (_Ip __i = __1d_.__begin_, __e = __1d_.__end_; __i != __e; ++__i, ++__j)
- __vp_[*__i] /= __v[__j];
+inline void gslice_array<_Tp>::operator/=(const _Expr& __v) const {
+ typedef const size_t* _Ip;
+ size_t __j = 0;
+ for (_Ip __i = __1d_.__begin_, __e = __1d_.__end_; __i != __e; ++__i, ++__j)
+ __vp_[*__i] /= __v[__j];
}
template <class _Tp>
template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> >
-inline
-void
-gslice_array<_Tp>::operator%=(const _Expr& __v) const
-{
- typedef const size_t* _Ip;
- size_t __j = 0;
- for (_Ip __i = __1d_.__begin_, __e = __1d_.__end_; __i != __e; ++__i, ++__j)
- __vp_[*__i] %= __v[__j];
+inline void gslice_array<_Tp>::operator%=(const _Expr& __v) const {
+ typedef const size_t* _Ip;
+ size_t __j = 0;
+ for (_Ip __i = __1d_.__begin_, __e = __1d_.__end_; __i != __e; ++__i, ++__j)
+ __vp_[*__i] %= __v[__j];
}
template <class _Tp>
template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> >
-inline
-void
-gslice_array<_Tp>::operator+=(const _Expr& __v) const
-{
- typedef const size_t* _Ip;
- size_t __j = 0;
- for (_Ip __i = __1d_.__begin_, __e = __1d_.__end_; __i != __e; ++__i, ++__j)
- __vp_[*__i] += __v[__j];
+inline void gslice_array<_Tp>::operator+=(const _Expr& __v) const {
+ typedef const size_t* _Ip;
+ size_t __j = 0;
+ for (_Ip __i = __1d_.__begin_, __e = __1d_.__end_; __i != __e; ++__i, ++__j)
+ __vp_[*__i] += __v[__j];
}
template <class _Tp>
template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> >
-inline
-void
-gslice_array<_Tp>::operator-=(const _Expr& __v) const
-{
- typedef const size_t* _Ip;
- size_t __j = 0;
- for (_Ip __i = __1d_.__begin_, __e = __1d_.__end_; __i != __e; ++__i, ++__j)
- __vp_[*__i] -= __v[__j];
+inline void gslice_array<_Tp>::operator-=(const _Expr& __v) const {
+ typedef const size_t* _Ip;
+ size_t __j = 0;
+ for (_Ip __i = __1d_.__begin_, __e = __1d_.__end_; __i != __e; ++__i, ++__j)
+ __vp_[*__i] -= __v[__j];
}
template <class _Tp>
template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> >
-inline
-void
-gslice_array<_Tp>::operator^=(const _Expr& __v) const
-{
- typedef const size_t* _Ip;
- size_t __j = 0;
- for (_Ip __i = __1d_.__begin_, __e = __1d_.__end_; __i != __e; ++__i, ++__j)
- __vp_[*__i] ^= __v[__j];
+inline void gslice_array<_Tp>::operator^=(const _Expr& __v) const {
+ typedef const size_t* _Ip;
+ size_t __j = 0;
+ for (_Ip __i = __1d_.__begin_, __e = __1d_.__end_; __i != __e; ++__i, ++__j)
+ __vp_[*__i] ^= __v[__j];
}
template <class _Tp>
template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> >
-inline
-void
-gslice_array<_Tp>::operator&=(const _Expr& __v) const
-{
- typedef const size_t* _Ip;
- size_t __j = 0;
- for (_Ip __i = __1d_.__begin_, __e = __1d_.__end_; __i != __e; ++__i, ++__j)
- __vp_[*__i] &= __v[__j];
+inline void gslice_array<_Tp>::operator&=(const _Expr& __v) const {
+ typedef const size_t* _Ip;
+ size_t __j = 0;
+ for (_Ip __i = __1d_.__begin_, __e = __1d_.__end_; __i != __e; ++__i, ++__j)
+ __vp_[*__i] &= __v[__j];
}
template <class _Tp>
template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> >
-inline
-void
-gslice_array<_Tp>::operator|=(const _Expr& __v) const
-{
- typedef const size_t* _Ip;
- size_t __j = 0;
- for (_Ip __i = __1d_.__begin_, __e = __1d_.__end_; __i != __e; ++__i, ++__j)
- __vp_[*__i] |= __v[__j];
+inline void gslice_array<_Tp>::operator|=(const _Expr& __v) const {
+ typedef const size_t* _Ip;
+ size_t __j = 0;
+ for (_Ip __i = __1d_.__begin_, __e = __1d_.__end_; __i != __e; ++__i, ++__j)
+ __vp_[*__i] |= __v[__j];
}
template <class _Tp>
template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> >
-inline
-void
-gslice_array<_Tp>::operator<<=(const _Expr& __v) const
-{
- typedef const size_t* _Ip;
- size_t __j = 0;
- for (_Ip __i = __1d_.__begin_, __e = __1d_.__end_; __i != __e; ++__i, ++__j)
- __vp_[*__i] <<= __v[__j];
+inline void gslice_array<_Tp>::operator<<=(const _Expr& __v) const {
+ typedef const size_t* _Ip;
+ size_t __j = 0;
+ for (_Ip __i = __1d_.__begin_, __e = __1d_.__end_; __i != __e; ++__i, ++__j)
+ __vp_[*__i] <<= __v[__j];
}
template <class _Tp>
template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> >
-inline
-void
-gslice_array<_Tp>::operator>>=(const _Expr& __v) const
-{
- typedef const size_t* _Ip;
- size_t __j = 0;
- for (_Ip __i = __1d_.__begin_, __e = __1d_.__end_; __i != __e; ++__i, ++__j)
- __vp_[*__i] >>= __v[__j];
+inline void gslice_array<_Tp>::operator>>=(const _Expr& __v) const {
+ typedef const size_t* _Ip;
+ size_t __j = 0;
+ for (_Ip __i = __1d_.__begin_, __e = __1d_.__end_; __i != __e; ++__i, ++__j)
+ __vp_[*__i] >>= __v[__j];
}
template <class _Tp>
-inline
-const gslice_array<_Tp>&
-gslice_array<_Tp>::operator=(const gslice_array& __ga) const
-{
- typedef const size_t* _Ip;
- const value_type* __s = __ga.__vp_;
- for (_Ip __i = __1d_.__begin_, __e = __1d_.__end_, __j = __ga.__1d_.__begin_;
- __i != __e; ++__i, ++__j)
- __vp_[*__i] = __s[*__j];
- return *this;
+inline const gslice_array<_Tp>& gslice_array<_Tp>::operator=(const gslice_array& __ga) const {
+ typedef const size_t* _Ip;
+ const value_type* __s = __ga.__vp_;
+ for (_Ip __i = __1d_.__begin_, __e = __1d_.__end_, __j = __ga.__1d_.__begin_; __i != __e; ++__i, ++__j)
+ __vp_[*__i] = __s[*__j];
+ return *this;
}
template <class _Tp>
-inline
-void
-gslice_array<_Tp>::operator=(const value_type& __x) const
-{
- typedef const size_t* _Ip;
- for (_Ip __i = __1d_.__begin_, __e = __1d_.__end_; __i != __e; ++__i)
- __vp_[*__i] = __x;
+inline void gslice_array<_Tp>::operator=(const value_type& __x) const {
+ typedef const size_t* _Ip;
+ for (_Ip __i = __1d_.__begin_, __e = __1d_.__end_; __i != __e; ++__i)
+ __vp_[*__i] = __x;
}
// mask_array
template <class _Tp>
-class _LIBCPP_TEMPLATE_VIS mask_array
-{
+class _LIBCPP_TEMPLATE_VIS mask_array {
public:
- typedef _Tp value_type;
+ typedef _Tp value_type;
private:
- value_type* __vp_;
- valarray<size_t> __1d_;
+ value_type* __vp_;
+ valarray<size_t> __1d_;
public:
- template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
- void
- _LIBCPP_HIDE_FROM_ABI
- operator=(const _Expr& __v) const;
-
- template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
- void
- _LIBCPP_HIDE_FROM_ABI
- operator*=(const _Expr& __v) const;
-
- template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
- void
- _LIBCPP_HIDE_FROM_ABI
- operator/=(const _Expr& __v) const;
-
- template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
- void
- _LIBCPP_HIDE_FROM_ABI
- operator%=(const _Expr& __v) const;
-
- template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
- void
- _LIBCPP_HIDE_FROM_ABI
- operator+=(const _Expr& __v) const;
-
- template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
- void
- _LIBCPP_HIDE_FROM_ABI
- operator-=(const _Expr& __v) const;
-
- template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
- void
- _LIBCPP_HIDE_FROM_ABI
- operator^=(const _Expr& __v) const;
-
- template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
- void
- _LIBCPP_HIDE_FROM_ABI
- operator&=(const _Expr& __v) const;
-
- template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
- void
- _LIBCPP_HIDE_FROM_ABI
- operator|=(const _Expr& __v) const;
-
- template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
- void
- _LIBCPP_HIDE_FROM_ABI
- operator<<=(const _Expr& __v) const;
-
- template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
- void
- _LIBCPP_HIDE_FROM_ABI
- operator>>=(const _Expr& __v) const;
-
- mask_array(const mask_array&) = default;
-
- _LIBCPP_HIDE_FROM_ABI
- const mask_array& operator=(const mask_array& __ma) const;
-
- _LIBCPP_HIDE_FROM_ABI
- void operator=(const value_type& __x) const;
+ template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
+ void _LIBCPP_HIDE_FROM_ABI operator=(const _Expr& __v) const;
+
+ template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
+ void _LIBCPP_HIDE_FROM_ABI operator*=(const _Expr& __v) const;
+
+ template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
+ void _LIBCPP_HIDE_FROM_ABI operator/=(const _Expr& __v) const;
+
+ template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
+ void _LIBCPP_HIDE_FROM_ABI operator%=(const _Expr& __v) const;
+
+ template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
+ void _LIBCPP_HIDE_FROM_ABI operator+=(const _Expr& __v) const;
+
+ template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
+ void _LIBCPP_HIDE_FROM_ABI operator-=(const _Expr& __v) const;
+
+ template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
+ void _LIBCPP_HIDE_FROM_ABI operator^=(const _Expr& __v) const;
+
+ template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
+ void _LIBCPP_HIDE_FROM_ABI operator&=(const _Expr& __v) const;
+
+ template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
+ void _LIBCPP_HIDE_FROM_ABI operator|=(const _Expr& __v) const;
+
+ template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
+ void _LIBCPP_HIDE_FROM_ABI operator<<=(const _Expr& __v) const;
+
+ template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
+ void _LIBCPP_HIDE_FROM_ABI operator>>=(const _Expr& __v) const;
+
+ mask_array(const mask_array&) = default;
+
+ _LIBCPP_HIDE_FROM_ABI const mask_array& operator=(const mask_array& __ma) const;
+
+ _LIBCPP_HIDE_FROM_ABI void operator=(const value_type& __x) const;
private:
- _LIBCPP_HIDE_FROM_ABI
- mask_array(const valarray<bool>& __vb, const valarray<value_type>& __v)
- : __vp_(const_cast<value_type*>(__v.__begin_)),
- __1d_(static_cast<size_t>(count(__vb.__begin_, __vb.__end_, true)))
- {
- size_t __j = 0;
- for (size_t __i = 0; __i < __vb.size(); ++__i)
- if (__vb[__i])
- __1d_[__j++] = __i;
- }
-
- template <class> friend class valarray;
+ _LIBCPP_HIDE_FROM_ABI mask_array(const valarray<bool>& __vb, const valarray<value_type>& __v)
+ : __vp_(const_cast<value_type*>(__v.__begin_)),
+ __1d_(static_cast<size_t>(count(__vb.__begin_, __vb.__end_, true))) {
+ size_t __j = 0;
+ for (size_t __i = 0; __i < __vb.size(); ++__i)
+ if (__vb[__i])
+ __1d_[__j++] = __i;
+ }
+
+ template <class>
+ friend class valarray;
};
template <class _Tp>
template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> >
-inline
- void
-mask_array<_Tp>::operator=(const _Expr& __v) const
-{
- size_t __n = __1d_.size();
- for (size_t __i = 0; __i < __n; ++__i)
- __vp_[__1d_[__i]] = __v[__i];
+inline void mask_array<_Tp>::operator=(const _Expr& __v) const {
+ size_t __n = __1d_.size();
+ for (size_t __i = 0; __i < __n; ++__i)
+ __vp_[__1d_[__i]] = __v[__i];
}
template <class _Tp>
template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> >
-inline
- void
-mask_array<_Tp>::operator*=(const _Expr& __v) const
-{
- size_t __n = __1d_.size();
- for (size_t __i = 0; __i < __n; ++__i)
- __vp_[__1d_[__i]] *= __v[__i];
+inline void mask_array<_Tp>::operator*=(const _Expr& __v) const {
+ size_t __n = __1d_.size();
+ for (size_t __i = 0; __i < __n; ++__i)
+ __vp_[__1d_[__i]] *= __v[__i];
}
template <class _Tp>
template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> >
-inline
- void
-mask_array<_Tp>::operator/=(const _Expr& __v) const
-{
- size_t __n = __1d_.size();
- for (size_t __i = 0; __i < __n; ++__i)
- __vp_[__1d_[__i]] /= __v[__i];
+inline void mask_array<_Tp>::operator/=(const _Expr& __v) const {
+ size_t __n = __1d_.size();
+ for (size_t __i = 0; __i < __n; ++__i)
+ __vp_[__1d_[__i]] /= __v[__i];
}
template <class _Tp>
template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> >
-inline
- void
-mask_array<_Tp>::operator%=(const _Expr& __v) const
-{
- size_t __n = __1d_.size();
- for (size_t __i = 0; __i < __n; ++__i)
- __vp_[__1d_[__i]] %= __v[__i];
+inline void mask_array<_Tp>::operator%=(const _Expr& __v) const {
+ size_t __n = __1d_.size();
+ for (size_t __i = 0; __i < __n; ++__i)
+ __vp_[__1d_[__i]] %= __v[__i];
}
template <class _Tp>
template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> >
-inline
- void
-mask_array<_Tp>::operator+=(const _Expr& __v) const
-{
- size_t __n = __1d_.size();
- for (size_t __i = 0; __i < __n; ++__i)
- __vp_[__1d_[__i]] += __v[__i];
+inline void mask_array<_Tp>::operator+=(const _Expr& __v) const {
+ size_t __n = __1d_.size();
+ for (size_t __i = 0; __i < __n; ++__i)
+ __vp_[__1d_[__i]] += __v[__i];
}
template <class _Tp>
template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> >
-inline
- void
-mask_array<_Tp>::operator-=(const _Expr& __v) const
-{
- size_t __n = __1d_.size();
- for (size_t __i = 0; __i < __n; ++__i)
- __vp_[__1d_[__i]] -= __v[__i];
+inline void mask_array<_Tp>::operator-=(const _Expr& __v) const {
+ size_t __n = __1d_.size();
+ for (size_t __i = 0; __i < __n; ++__i)
+ __vp_[__1d_[__i]] -= __v[__i];
}
template <class _Tp>
template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> >
-inline
- void
-mask_array<_Tp>::operator^=(const _Expr& __v) const
-{
- size_t __n = __1d_.size();
- for (size_t __i = 0; __i < __n; ++__i)
- __vp_[__1d_[__i]] ^= __v[__i];
+inline void mask_array<_Tp>::operator^=(const _Expr& __v) const {
+ size_t __n = __1d_.size();
+ for (size_t __i = 0; __i < __n; ++__i)
+ __vp_[__1d_[__i]] ^= __v[__i];
}
template <class _Tp>
template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> >
-inline
- void
-mask_array<_Tp>::operator&=(const _Expr& __v) const
-{
- size_t __n = __1d_.size();
- for (size_t __i = 0; __i < __n; ++__i)
- __vp_[__1d_[__i]] &= __v[__i];
+inline void mask_array<_Tp>::operator&=(const _Expr& __v) const {
+ size_t __n = __1d_.size();
+ for (size_t __i = 0; __i < __n; ++__i)
+ __vp_[__1d_[__i]] &= __v[__i];
}
template <class _Tp>
template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> >
-inline
- void
-mask_array<_Tp>::operator|=(const _Expr& __v) const
-{
- size_t __n = __1d_.size();
- for (size_t __i = 0; __i < __n; ++__i)
- __vp_[__1d_[__i]] |= __v[__i];
+inline void mask_array<_Tp>::operator|=(const _Expr& __v) const {
+ size_t __n = __1d_.size();
+ for (size_t __i = 0; __i < __n; ++__i)
+ __vp_[__1d_[__i]] |= __v[__i];
}
template <class _Tp>
template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> >
-inline
- void
-mask_array<_Tp>::operator<<=(const _Expr& __v) const
-{
- size_t __n = __1d_.size();
- for (size_t __i = 0; __i < __n; ++__i)
- __vp_[__1d_[__i]] <<= __v[__i];
+inline void mask_array<_Tp>::operator<<=(const _Expr& __v) const {
+ size_t __n = __1d_.size();
+ for (size_t __i = 0; __i < __n; ++__i)
+ __vp_[__1d_[__i]] <<= __v[__i];
}
template <class _Tp>
template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> >
-inline
- void
-mask_array<_Tp>::operator>>=(const _Expr& __v) const
-{
- size_t __n = __1d_.size();
- for (size_t __i = 0; __i < __n; ++__i)
- __vp_[__1d_[__i]] >>= __v[__i];
+inline void mask_array<_Tp>::operator>>=(const _Expr& __v) const {
+ size_t __n = __1d_.size();
+ for (size_t __i = 0; __i < __n; ++__i)
+ __vp_[__1d_[__i]] >>= __v[__i];
}
template <class _Tp>
-inline
-const mask_array<_Tp>&
-mask_array<_Tp>::operator=(const mask_array& __ma) const
-{
- size_t __n = __1d_.size();
- for (size_t __i = 0; __i < __n; ++__i)
- __vp_[__1d_[__i]] = __ma.__vp_[__1d_[__i]];
- return *this;
+inline const mask_array<_Tp>& mask_array<_Tp>::operator=(const mask_array& __ma) const {
+ size_t __n = __1d_.size();
+ for (size_t __i = 0; __i < __n; ++__i)
+ __vp_[__1d_[__i]] = __ma.__vp_[__1d_[__i]];
+ return *this;
}
template <class _Tp>
-inline
-void
-mask_array<_Tp>::operator=(const value_type& __x) const
-{
- size_t __n = __1d_.size();
- for (size_t __i = 0; __i < __n; ++__i)
- __vp_[__1d_[__i]] = __x;
+inline void mask_array<_Tp>::operator=(const value_type& __x) const {
+ size_t __n = __1d_.size();
+ for (size_t __i = 0; __i < __n; ++__i)
+ __vp_[__1d_[__i]] = __x;
}
template <class _ValExpr>
-class __mask_expr
-{
- typedef __libcpp_remove_reference_t<_ValExpr> _RmExpr;
+class __mask_expr {
+ typedef __libcpp_remove_reference_t<_ValExpr> _RmExpr;
+
public:
- typedef typename _RmExpr::value_type value_type;
- typedef value_type __result_type;
+ typedef typename _RmExpr::value_type value_type;
+ typedef value_type __result_type;
private:
- _ValExpr __expr_;
- valarray<size_t> __1d_;
-
- _LIBCPP_HIDE_FROM_ABI
- __mask_expr(const valarray<bool>& __vb, const _RmExpr& __e)
- : __expr_(__e),
- __1d_(static_cast<size_t>(count(__vb.__begin_, __vb.__end_, true)))
- {
- size_t __j = 0;
- for (size_t __i = 0; __i < __vb.size(); ++__i)
- if (__vb[__i])
- __1d_[__j++] = __i;
- }
+ _ValExpr __expr_;
+ valarray<size_t> __1d_;
+
+ _LIBCPP_HIDE_FROM_ABI __mask_expr(const valarray<bool>& __vb, const _RmExpr& __e)
+ : __expr_(__e), __1d_(static_cast<size_t>(count(__vb.__begin_, __vb.__end_, true))) {
+ size_t __j = 0;
+ for (size_t __i = 0; __i < __vb.size(); ++__i)
+ if (__vb[__i])
+ __1d_[__j++] = __i;
+ }
public:
- _LIBCPP_HIDE_FROM_ABI
- __result_type operator[](size_t __i) const
- {return __expr_[__1d_[__i]];}
+ _LIBCPP_HIDE_FROM_ABI __result_type operator[](size_t __i) const { return __expr_[__1d_[__i]]; }
- _LIBCPP_HIDE_FROM_ABI
- size_t size() const {return __1d_.size();}
+ _LIBCPP_HIDE_FROM_ABI size_t size() const { return __1d_.size(); }
- template <class> friend class __val_expr;
- template <class> friend class valarray;
+ template <class>
+ friend class __val_expr;
+ template <class>
+ friend class valarray;
};
// indirect_array
template <class _Tp>
-class _LIBCPP_TEMPLATE_VIS indirect_array
-{
+class _LIBCPP_TEMPLATE_VIS indirect_array {
public:
- typedef _Tp value_type;
+ typedef _Tp value_type;
private:
- value_type* __vp_;
- valarray<size_t> __1d_;
+ value_type* __vp_;
+ valarray<size_t> __1d_;
public:
- template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
- void
- _LIBCPP_HIDE_FROM_ABI
- operator=(const _Expr& __v) const;
-
- template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
- void
- _LIBCPP_HIDE_FROM_ABI
- operator*=(const _Expr& __v) const;
-
- template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
- void
- _LIBCPP_HIDE_FROM_ABI
- operator/=(const _Expr& __v) const;
-
- template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
- void
- _LIBCPP_HIDE_FROM_ABI
- operator%=(const _Expr& __v) const;
-
- template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
- void
- _LIBCPP_HIDE_FROM_ABI
- operator+=(const _Expr& __v) const;
-
- template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
- void
- _LIBCPP_HIDE_FROM_ABI
- operator-=(const _Expr& __v) const;
-
- template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
- void
- _LIBCPP_HIDE_FROM_ABI
- operator^=(const _Expr& __v) const;
-
- template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
- void
- _LIBCPP_HIDE_FROM_ABI
- operator&=(const _Expr& __v) const;
-
- template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
- void
- _LIBCPP_HIDE_FROM_ABI
- operator|=(const _Expr& __v) const;
-
- template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
- void
- _LIBCPP_HIDE_FROM_ABI
- operator<<=(const _Expr& __v) const;
-
- template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
- void
- _LIBCPP_HIDE_FROM_ABI
- operator>>=(const _Expr& __v) const;
-
- indirect_array(const indirect_array&) = default;
-
- _LIBCPP_HIDE_FROM_ABI
- const indirect_array& operator=(const indirect_array& __ia) const;
-
- _LIBCPP_HIDE_FROM_ABI
- void operator=(const value_type& __x) const;
+ template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
+ void _LIBCPP_HIDE_FROM_ABI operator=(const _Expr& __v) const;
+
+ template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
+ void _LIBCPP_HIDE_FROM_ABI operator*=(const _Expr& __v) const;
+
+ template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
+ void _LIBCPP_HIDE_FROM_ABI operator/=(const _Expr& __v) const;
+
+ template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
+ void _LIBCPP_HIDE_FROM_ABI operator%=(const _Expr& __v) const;
+
+ template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
+ void _LIBCPP_HIDE_FROM_ABI operator+=(const _Expr& __v) const;
+
+ template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
+ void _LIBCPP_HIDE_FROM_ABI operator-=(const _Expr& __v) const;
+
+ template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
+ void _LIBCPP_HIDE_FROM_ABI operator^=(const _Expr& __v) const;
+
+ template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
+ void _LIBCPP_HIDE_FROM_ABI operator&=(const _Expr& __v) const;
+
+ template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
+ void _LIBCPP_HIDE_FROM_ABI operator|=(const _Expr& __v) const;
+
+ template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
+ void _LIBCPP_HIDE_FROM_ABI operator<<=(const _Expr& __v) const;
+
+ template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
+ void _LIBCPP_HIDE_FROM_ABI operator>>=(const _Expr& __v) const;
+
+ indirect_array(const indirect_array&) = default;
+
+ _LIBCPP_HIDE_FROM_ABI const indirect_array& operator=(const indirect_array& __ia) const;
+
+ _LIBCPP_HIDE_FROM_ABI void operator=(const value_type& __x) const;
private:
- _LIBCPP_HIDE_FROM_ABI
- indirect_array(const valarray<size_t>& __ia, const valarray<value_type>& __v)
- : __vp_(const_cast<value_type*>(__v.__begin_)),
- __1d_(__ia)
- {}
+ _LIBCPP_HIDE_FROM_ABI indirect_array(const valarray<size_t>& __ia, const valarray<value_type>& __v)
+ : __vp_(const_cast<value_type*>(__v.__begin_)), __1d_(__ia) {}
#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI
- indirect_array(valarray<size_t>&& __ia, const valarray<value_type>& __v)
- : __vp_(const_cast<value_type*>(__v.__begin_)),
- __1d_(std::move(__ia))
- {}
+ _LIBCPP_HIDE_FROM_ABI indirect_array(valarray<size_t>&& __ia, const valarray<value_type>& __v)
+ : __vp_(const_cast<value_type*>(__v.__begin_)), __1d_(std::move(__ia)) {}
#endif // _LIBCPP_CXX03_LANG
- template <class> friend class valarray;
+ template <class>
+ friend class valarray;
};
template <class _Tp>
template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> >
-inline
-void
-indirect_array<_Tp>::operator=(const _Expr& __v) const
-{
- size_t __n = __1d_.size();
- for (size_t __i = 0; __i < __n; ++__i)
- __vp_[__1d_[__i]] = __v[__i];
+inline void indirect_array<_Tp>::operator=(const _Expr& __v) const {
+ size_t __n = __1d_.size();
+ for (size_t __i = 0; __i < __n; ++__i)
+ __vp_[__1d_[__i]] = __v[__i];
}
template <class _Tp>
template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> >
-inline
-void
-indirect_array<_Tp>::operator*=(const _Expr& __v) const
-{
- size_t __n = __1d_.size();
- for (size_t __i = 0; __i < __n; ++__i)
- __vp_[__1d_[__i]] *= __v[__i];
+inline void indirect_array<_Tp>::operator*=(const _Expr& __v) const {
+ size_t __n = __1d_.size();
+ for (size_t __i = 0; __i < __n; ++__i)
+ __vp_[__1d_[__i]] *= __v[__i];
}
template <class _Tp>
template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> >
-inline
-void
-indirect_array<_Tp>::operator/=(const _Expr& __v) const
-{
- size_t __n = __1d_.size();
- for (size_t __i = 0; __i < __n; ++__i)
- __vp_[__1d_[__i]] /= __v[__i];
+inline void indirect_array<_Tp>::operator/=(const _Expr& __v) const {
+ size_t __n = __1d_.size();
+ for (size_t __i = 0; __i < __n; ++__i)
+ __vp_[__1d_[__i]] /= __v[__i];
}
template <class _Tp>
template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> >
-inline
-void
-indirect_array<_Tp>::operator%=(const _Expr& __v) const
-{
- size_t __n = __1d_.size();
- for (size_t __i = 0; __i < __n; ++__i)
- __vp_[__1d_[__i]] %= __v[__i];
+inline void indirect_array<_Tp>::operator%=(const _Expr& __v) const {
+ size_t __n = __1d_.size();
+ for (size_t __i = 0; __i < __n; ++__i)
+ __vp_[__1d_[__i]] %= __v[__i];
}
template <class _Tp>
template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> >
-inline
-void
-indirect_array<_Tp>::operator+=(const _Expr& __v) const
-{
- size_t __n = __1d_.size();
- for (size_t __i = 0; __i < __n; ++__i)
- __vp_[__1d_[__i]] += __v[__i];
+inline void indirect_array<_Tp>::operator+=(const _Expr& __v) const {
+ size_t __n = __1d_.size();
+ for (size_t __i = 0; __i < __n; ++__i)
+ __vp_[__1d_[__i]] += __v[__i];
}
template <class _Tp>
template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> >
-inline
-void
-indirect_array<_Tp>::operator-=(const _Expr& __v) const
-{
- size_t __n = __1d_.size();
- for (size_t __i = 0; __i < __n; ++__i)
- __vp_[__1d_[__i]] -= __v[__i];
+inline void indirect_array<_Tp>::operator-=(const _Expr& __v) const {
+ size_t __n = __1d_.size();
+ for (size_t __i = 0; __i < __n; ++__i)
+ __vp_[__1d_[__i]] -= __v[__i];
}
template <class _Tp>
template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> >
-inline
-void
-indirect_array<_Tp>::operator^=(const _Expr& __v) const
-{
- size_t __n = __1d_.size();
- for (size_t __i = 0; __i < __n; ++__i)
- __vp_[__1d_[__i]] ^= __v[__i];
+inline void indirect_array<_Tp>::operator^=(const _Expr& __v) const {
+ size_t __n = __1d_.size();
+ for (size_t __i = 0; __i < __n; ++__i)
+ __vp_[__1d_[__i]] ^= __v[__i];
}
template <class _Tp>
template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> >
-inline
-void
-indirect_array<_Tp>::operator&=(const _Expr& __v) const
-{
- size_t __n = __1d_.size();
- for (size_t __i = 0; __i < __n; ++__i)
- __vp_[__1d_[__i]] &= __v[__i];
+inline void indirect_array<_Tp>::operator&=(const _Expr& __v) const {
+ size_t __n = __1d_.size();
+ for (size_t __i = 0; __i < __n; ++__i)
+ __vp_[__1d_[__i]] &= __v[__i];
}
template <class _Tp>
template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> >
-inline
-void
-indirect_array<_Tp>::operator|=(const _Expr& __v) const
-{
- size_t __n = __1d_.size();
- for (size_t __i = 0; __i < __n; ++__i)
- __vp_[__1d_[__i]] |= __v[__i];
+inline void indirect_array<_Tp>::operator|=(const _Expr& __v) const {
+ size_t __n = __1d_.size();
+ for (size_t __i = 0; __i < __n; ++__i)
+ __vp_[__1d_[__i]] |= __v[__i];
}
template <class _Tp>
template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> >
-inline
-void
-indirect_array<_Tp>::operator<<=(const _Expr& __v) const
-{
- size_t __n = __1d_.size();
- for (size_t __i = 0; __i < __n; ++__i)
- __vp_[__1d_[__i]] <<= __v[__i];
+inline void indirect_array<_Tp>::operator<<=(const _Expr& __v) const {
+ size_t __n = __1d_.size();
+ for (size_t __i = 0; __i < __n; ++__i)
+ __vp_[__1d_[__i]] <<= __v[__i];
}
template <class _Tp>
template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> >
-inline
-void
-indirect_array<_Tp>::operator>>=(const _Expr& __v) const
-{
- size_t __n = __1d_.size();
- for (size_t __i = 0; __i < __n; ++__i)
- __vp_[__1d_[__i]] >>= __v[__i];
+inline void indirect_array<_Tp>::operator>>=(const _Expr& __v) const {
+ size_t __n = __1d_.size();
+ for (size_t __i = 0; __i < __n; ++__i)
+ __vp_[__1d_[__i]] >>= __v[__i];
}
template <class _Tp>
-inline
-const indirect_array<_Tp>&
-indirect_array<_Tp>::operator=(const indirect_array& __ia) const
-{
- typedef const size_t* _Ip;
- const value_type* __s = __ia.__vp_;
- for (_Ip __i = __1d_.__begin_, __e = __1d_.__end_, __j = __ia.__1d_.__begin_;
- __i != __e; ++__i, ++__j)
- __vp_[*__i] = __s[*__j];
- return *this;
+inline const indirect_array<_Tp>& indirect_array<_Tp>::operator=(const indirect_array& __ia) const {
+ typedef const size_t* _Ip;
+ const value_type* __s = __ia.__vp_;
+ for (_Ip __i = __1d_.__begin_, __e = __1d_.__end_, __j = __ia.__1d_.__begin_; __i != __e; ++__i, ++__j)
+ __vp_[*__i] = __s[*__j];
+ return *this;
}
template <class _Tp>
-inline
-void
-indirect_array<_Tp>::operator=(const value_type& __x) const
-{
- typedef const size_t* _Ip;
- for (_Ip __i = __1d_.__begin_, __e = __1d_.__end_; __i != __e; ++__i)
- __vp_[*__i] = __x;
+inline void indirect_array<_Tp>::operator=(const value_type& __x) const {
+ typedef const size_t* _Ip;
+ for (_Ip __i = __1d_.__begin_, __e = __1d_.__end_; __i != __e; ++__i)
+ __vp_[*__i] = __x;
}
template <class _ValExpr>
-class __indirect_expr
-{
- typedef __libcpp_remove_reference_t<_ValExpr> _RmExpr;
+class __indirect_expr {
+ typedef __libcpp_remove_reference_t<_ValExpr> _RmExpr;
+
public:
- typedef typename _RmExpr::value_type value_type;
- typedef value_type __result_type;
+ typedef typename _RmExpr::value_type value_type;
+ typedef value_type __result_type;
private:
- _ValExpr __expr_;
- valarray<size_t> __1d_;
+ _ValExpr __expr_;
+ valarray<size_t> __1d_;
- _LIBCPP_HIDE_FROM_ABI
- __indirect_expr(const valarray<size_t>& __ia, const _RmExpr& __e)
- : __expr_(__e),
- __1d_(__ia)
- {}
+ _LIBCPP_HIDE_FROM_ABI __indirect_expr(const valarray<size_t>& __ia, const _RmExpr& __e) : __expr_(__e), __1d_(__ia) {}
#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI
- __indirect_expr(valarray<size_t>&& __ia, const _RmExpr& __e)
- : __expr_(__e),
- __1d_(std::move(__ia))
- {}
+ _LIBCPP_HIDE_FROM_ABI __indirect_expr(valarray<size_t>&& __ia, const _RmExpr& __e)
+ : __expr_(__e), __1d_(std::move(__ia)) {}
#endif // _LIBCPP_CXX03_LANG
public:
- _LIBCPP_HIDE_FROM_ABI
- __result_type operator[](size_t __i) const
- {return __expr_[__1d_[__i]];}
+ _LIBCPP_HIDE_FROM_ABI __result_type operator[](size_t __i) const { return __expr_[__1d_[__i]]; }
- _LIBCPP_HIDE_FROM_ABI
- size_t size() const {return __1d_.size();}
+ _LIBCPP_HIDE_FROM_ABI size_t size() const { return __1d_.size(); }
- template <class> friend class __val_expr;
- template <class> friend class _LIBCPP_TEMPLATE_VIS valarray;
+ template <class>
+ friend class __val_expr;
+ template <class>
+ friend class _LIBCPP_TEMPLATE_VIS valarray;
};
-template<class _ValExpr>
-class __val_expr
-{
- typedef __libcpp_remove_reference_t<_ValExpr> _RmExpr;
+template <class _ValExpr>
+class __val_expr {
+ typedef __libcpp_remove_reference_t<_ValExpr> _RmExpr;
+
+ _ValExpr __expr_;
- _ValExpr __expr_;
public:
- typedef typename _RmExpr::value_type value_type;
- typedef typename _RmExpr::__result_type __result_type;
+ typedef typename _RmExpr::value_type value_type;
+ typedef typename _RmExpr::__result_type __result_type;
- _LIBCPP_HIDE_FROM_ABI
- explicit __val_expr(const _RmExpr& __e) : __expr_(__e) {}
+ _LIBCPP_HIDE_FROM_ABI explicit __val_expr(const _RmExpr& __e) : __expr_(__e) {}
- _LIBCPP_HIDE_FROM_ABI
- __result_type operator[](size_t __i) const
- {return __expr_[__i];}
+ _LIBCPP_HIDE_FROM_ABI __result_type operator[](size_t __i) const { return __expr_[__i]; }
- _LIBCPP_HIDE_FROM_ABI
- __val_expr<__slice_expr<_ValExpr> > operator[](slice __s) const
- {
- typedef __slice_expr<_ValExpr> _NewExpr;
- return __val_expr< _NewExpr >(_NewExpr(__s, __expr_));
- }
+ _LIBCPP_HIDE_FROM_ABI __val_expr<__slice_expr<_ValExpr> > operator[](slice __s) const {
+ typedef __slice_expr<_ValExpr> _NewExpr;
+ return __val_expr< _NewExpr >(_NewExpr(__s, __expr_));
+ }
- _LIBCPP_HIDE_FROM_ABI
- __val_expr<__indirect_expr<_ValExpr> > operator[](const gslice& __gs) const
- {
- typedef __indirect_expr<_ValExpr> _NewExpr;
- return __val_expr<_NewExpr >(_NewExpr(__gs.__1d_, __expr_));
- }
+ _LIBCPP_HIDE_FROM_ABI __val_expr<__indirect_expr<_ValExpr> > operator[](const gslice& __gs) const {
+ typedef __indirect_expr<_ValExpr> _NewExpr;
+ return __val_expr<_NewExpr >(_NewExpr(__gs.__1d_, __expr_));
+ }
- _LIBCPP_HIDE_FROM_ABI
- __val_expr<__mask_expr<_ValExpr> > operator[](const valarray<bool>& __vb) const
- {
- typedef __mask_expr<_ValExpr> _NewExpr;
- return __val_expr< _NewExpr >( _NewExpr(__vb, __expr_));
- }
+ _LIBCPP_HIDE_FROM_ABI __val_expr<__mask_expr<_ValExpr> > operator[](const valarray<bool>& __vb) const {
+ typedef __mask_expr<_ValExpr> _NewExpr;
+ return __val_expr< _NewExpr >(_NewExpr(__vb, __expr_));
+ }
- _LIBCPP_HIDE_FROM_ABI
- __val_expr<__indirect_expr<_ValExpr> > operator[](const valarray<size_t>& __vs) const
- {
- typedef __indirect_expr<_ValExpr> _NewExpr;
- return __val_expr< _NewExpr >(_NewExpr(__vs, __expr_));
- }
+ _LIBCPP_HIDE_FROM_ABI __val_expr<__indirect_expr<_ValExpr> > operator[](const valarray<size_t>& __vs) const {
+ typedef __indirect_expr<_ValExpr> _NewExpr;
+ return __val_expr< _NewExpr >(_NewExpr(__vs, __expr_));
+ }
- _LIBCPP_HIDE_FROM_ABI
- __val_expr<_UnaryOp<__unary_plus<value_type>, _ValExpr> >
- operator+() const
- {
- typedef _UnaryOp<__unary_plus<value_type>, _ValExpr> _NewExpr;
- return __val_expr<_NewExpr>(_NewExpr(__unary_plus<value_type>(), __expr_));
- }
+ _LIBCPP_HIDE_FROM_ABI __val_expr<_UnaryOp<__unary_plus<value_type>, _ValExpr> > operator+() const {
+ typedef _UnaryOp<__unary_plus<value_type>, _ValExpr> _NewExpr;
+ return __val_expr<_NewExpr>(_NewExpr(__unary_plus<value_type>(), __expr_));
+ }
- _LIBCPP_HIDE_FROM_ABI
- __val_expr<_UnaryOp<negate<value_type>, _ValExpr> >
- operator-() const
- {
- typedef _UnaryOp<negate<value_type>, _ValExpr> _NewExpr;
- return __val_expr<_NewExpr>(_NewExpr(negate<value_type>(), __expr_));
- }
+ _LIBCPP_HIDE_FROM_ABI __val_expr<_UnaryOp<negate<value_type>, _ValExpr> > operator-() const {
+ typedef _UnaryOp<negate<value_type>, _ValExpr> _NewExpr;
+ return __val_expr<_NewExpr>(_NewExpr(negate<value_type>(), __expr_));
+ }
- _LIBCPP_HIDE_FROM_ABI
- __val_expr<_UnaryOp<__bit_not<value_type>, _ValExpr> >
- operator~() const
- {
- typedef _UnaryOp<__bit_not<value_type>, _ValExpr> _NewExpr;
- return __val_expr<_NewExpr>(_NewExpr(__bit_not<value_type>(), __expr_));
- }
+ _LIBCPP_HIDE_FROM_ABI __val_expr<_UnaryOp<__bit_not<value_type>, _ValExpr> > operator~() const {
+ typedef _UnaryOp<__bit_not<value_type>, _ValExpr> _NewExpr;
+ return __val_expr<_NewExpr>(_NewExpr(__bit_not<value_type>(), __expr_));
+ }
- _LIBCPP_HIDE_FROM_ABI
- __val_expr<_UnaryOp<logical_not<value_type>, _ValExpr> >
- operator!() const
- {
- typedef _UnaryOp<logical_not<value_type>, _ValExpr> _NewExpr;
- return __val_expr<_NewExpr>(_NewExpr(logical_not<value_type>(), __expr_));
- }
+ _LIBCPP_HIDE_FROM_ABI __val_expr<_UnaryOp<logical_not<value_type>, _ValExpr> > operator!() const {
+ typedef _UnaryOp<logical_not<value_type>, _ValExpr> _NewExpr;
+ return __val_expr<_NewExpr>(_NewExpr(logical_not<value_type>(), __expr_));
+ }
- operator valarray<__result_type>() const;
+ operator valarray<__result_type>() const;
- _LIBCPP_HIDE_FROM_ABI
- size_t size() const {return __expr_.size();}
+ _LIBCPP_HIDE_FROM_ABI size_t size() const { return __expr_.size(); }
- _LIBCPP_HIDE_FROM_ABI
- __result_type sum() const
- {
- size_t __n = __expr_.size();
- __result_type __r = __n ? __expr_[0] : __result_type();
- for (size_t __i = 1; __i < __n; ++__i)
- __r += __expr_[__i];
- return __r;
- }
+ _LIBCPP_HIDE_FROM_ABI __result_type sum() const {
+ size_t __n = __expr_.size();
+ __result_type __r = __n ? __expr_[0] : __result_type();
+ for (size_t __i = 1; __i < __n; ++__i)
+ __r += __expr_[__i];
+ return __r;
+ }
- _LIBCPP_HIDE_FROM_ABI
- __result_type min() const
- {
- size_t __n = size();
- __result_type __r = __n ? (*this)[0] : __result_type();
- for (size_t __i = 1; __i < __n; ++__i)
- {
- __result_type __x = __expr_[__i];
- if (__x < __r)
- __r = __x;
- }
- return __r;
+ _LIBCPP_HIDE_FROM_ABI __result_type min() const {
+ size_t __n = size();
+ __result_type __r = __n ? (*this)[0] : __result_type();
+ for (size_t __i = 1; __i < __n; ++__i) {
+ __result_type __x = __expr_[__i];
+ if (__x < __r)
+ __r = __x;
}
+ return __r;
+ }
- _LIBCPP_HIDE_FROM_ABI
- __result_type max() const
- {
- size_t __n = size();
- __result_type __r = __n ? (*this)[0] : __result_type();
- for (size_t __i = 1; __i < __n; ++__i)
- {
- __result_type __x = __expr_[__i];
- if (__r < __x)
- __r = __x;
- }
- return __r;
+ _LIBCPP_HIDE_FROM_ABI __result_type max() const {
+ size_t __n = size();
+ __result_type __r = __n ? (*this)[0] : __result_type();
+ for (size_t __i = 1; __i < __n; ++__i) {
+ __result_type __x = __expr_[__i];
+ if (__r < __x)
+ __r = __x;
}
+ return __r;
+ }
- _LIBCPP_HIDE_FROM_ABI
- __val_expr<__shift_expr<_ValExpr> > shift (int __i) const
- {return __val_expr<__shift_expr<_ValExpr> >(__shift_expr<_ValExpr>(__i, __expr_));}
-
- _LIBCPP_HIDE_FROM_ABI
- __val_expr<__cshift_expr<_ValExpr> > cshift(int __i) const
- {return __val_expr<__cshift_expr<_ValExpr> >(__cshift_expr<_ValExpr>(__i, __expr_));}
-
- _LIBCPP_HIDE_FROM_ABI
- __val_expr<_UnaryOp<__apply_expr<value_type, value_type(*)(value_type)>, _ValExpr> >
- apply(value_type __f(value_type)) const
- {
- typedef __apply_expr<value_type, value_type(*)(value_type)> _Op;
- typedef _UnaryOp<_Op, _ValExpr> _NewExpr;
- return __val_expr<_NewExpr>(_NewExpr(_Op(__f), __expr_));
- }
+ _LIBCPP_HIDE_FROM_ABI __val_expr<__shift_expr<_ValExpr> > shift(int __i) const {
+ return __val_expr<__shift_expr<_ValExpr> >(__shift_expr<_ValExpr>(__i, __expr_));
+ }
- _LIBCPP_HIDE_FROM_ABI
- __val_expr<_UnaryOp<__apply_expr<value_type, value_type(*)(const value_type&)>, _ValExpr> >
- apply(value_type __f(const value_type&)) const
- {
- typedef __apply_expr<value_type, value_type(*)(const value_type&)> _Op;
- typedef _UnaryOp<_Op, _ValExpr> _NewExpr;
- return __val_expr<_NewExpr>(_NewExpr(_Op(__f), __expr_));
- }
+ _LIBCPP_HIDE_FROM_ABI __val_expr<__cshift_expr<_ValExpr> > cshift(int __i) const {
+ return __val_expr<__cshift_expr<_ValExpr> >(__cshift_expr<_ValExpr>(__i, __expr_));
+ }
+
+ _LIBCPP_HIDE_FROM_ABI __val_expr<_UnaryOp<__apply_expr<value_type, value_type (*)(value_type)>, _ValExpr> >
+ apply(value_type __f(value_type)) const {
+ typedef __apply_expr<value_type, value_type (*)(value_type)> _Op;
+ typedef _UnaryOp<_Op, _ValExpr> _NewExpr;
+ return __val_expr<_NewExpr>(_NewExpr(_Op(__f), __expr_));
+ }
+
+ _LIBCPP_HIDE_FROM_ABI __val_expr<_UnaryOp<__apply_expr<value_type, value_type (*)(const value_type&)>, _ValExpr> >
+ apply(value_type __f(const value_type&)) const {
+ typedef __apply_expr<value_type, value_type (*)(const value_type&)> _Op;
+ typedef _UnaryOp<_Op, _ValExpr> _NewExpr;
+ return __val_expr<_NewExpr>(_NewExpr(_Op(__f), __expr_));
+ }
};
-template<class _ValExpr>
-__val_expr<_ValExpr>::operator valarray<__val_expr::__result_type>() const
-{
- valarray<__result_type> __r;
- size_t __n = __expr_.size();
- if (__n)
- {
- __r.__begin_ =
- __r.__end_ = allocator<__result_type>().allocate(__n);
- for (size_t __i = 0; __i != __n; ++__r.__end_, ++__i)
- ::new ((void*)__r.__end_) __result_type(__expr_[__i]);
- }
- return __r;
+template <class _ValExpr>
+__val_expr<_ValExpr>::operator valarray<__val_expr::__result_type>() const {
+ valarray<__result_type> __r;
+ size_t __n = __expr_.size();
+ if (__n) {
+ __r.__begin_ = __r.__end_ = allocator<__result_type>().allocate(__n);
+ for (size_t __i = 0; __i != __n; ++__r.__end_, ++__i)
+ ::new ((void*)__r.__end_) __result_type(__expr_[__i]);
+ }
+ return __r;
}
// valarray
template <class _Tp>
-inline
-valarray<_Tp>::valarray(size_t __n)
- : __begin_(nullptr),
- __end_(nullptr)
-{
- if (__n)
- {
- __begin_ = __end_ = allocator<value_type>().allocate(__n);
+inline valarray<_Tp>::valarray(size_t __n) : __begin_(nullptr), __end_(nullptr) {
+ if (__n) {
+ __begin_ = __end_ = allocator<value_type>().allocate(__n);
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- try
- {
+ try {
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- for (size_t __n_left = __n; __n_left; --__n_left, ++__end_)
- ::new ((void*)__end_) value_type();
+ for (size_t __n_left = __n; __n_left; --__n_left, ++__end_)
+ ::new ((void*)__end_) value_type();
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- }
- catch (...)
- {
- __clear(__n);
- throw;
- }
-#endif // _LIBCPP_HAS_NO_EXCEPTIONS
+ } catch (...) {
+ __clear(__n);
+ throw;
}
+#endif // _LIBCPP_HAS_NO_EXCEPTIONS
+ }
}
template <class _Tp>
-inline
-valarray<_Tp>::valarray(const value_type& __x, size_t __n)
- : __begin_(nullptr),
- __end_(nullptr)
-{
- resize(__n, __x);
+inline valarray<_Tp>::valarray(const value_type& __x, size_t __n) : __begin_(nullptr), __end_(nullptr) {
+ resize(__n, __x);
}
template <class _Tp>
-valarray<_Tp>::valarray(const value_type* __p, size_t __n)
- : __begin_(nullptr),
- __end_(nullptr)
-{
- if (__n)
- {
- __begin_ = __end_ = allocator<value_type>().allocate(__n);
+valarray<_Tp>::valarray(const value_type* __p, size_t __n) : __begin_(nullptr), __end_(nullptr) {
+ if (__n) {
+ __begin_ = __end_ = allocator<value_type>().allocate(__n);
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- try
- {
+ try {
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- for (size_t __n_left = __n; __n_left; ++__end_, ++__p, --__n_left)
- ::new ((void*)__end_) value_type(*__p);
+ for (size_t __n_left = __n; __n_left; ++__end_, ++__p, --__n_left)
+ ::new ((void*)__end_) value_type(*__p);
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- }
- catch (...)
- {
- __clear(__n);
- throw;
- }
-#endif // _LIBCPP_HAS_NO_EXCEPTIONS
+ } catch (...) {
+ __clear(__n);
+ throw;
}
+#endif // _LIBCPP_HAS_NO_EXCEPTIONS
+ }
}
template <class _Tp>
-valarray<_Tp>::valarray(const valarray& __v)
- : __begin_(nullptr),
- __end_(nullptr)
-{
- if (__v.size())
- {
- __begin_ = __end_ = allocator<value_type>().allocate(__v.size());
+valarray<_Tp>::valarray(const valarray& __v) : __begin_(nullptr), __end_(nullptr) {
+ if (__v.size()) {
+ __begin_ = __end_ = allocator<value_type>().allocate(__v.size());
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- try
- {
+ try {
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- for (value_type* __p = __v.__begin_; __p != __v.__end_; ++__end_, ++__p)
- ::new ((void*)__end_) value_type(*__p);
+ for (value_type* __p = __v.__begin_; __p != __v.__end_; ++__end_, ++__p)
+ ::new ((void*)__end_) value_type(*__p);
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- }
- catch (...)
- {
- __clear(__v.size());
- throw;
- }
-#endif // _LIBCPP_HAS_NO_EXCEPTIONS
+ } catch (...) {
+ __clear(__v.size());
+ throw;
}
+#endif // _LIBCPP_HAS_NO_EXCEPTIONS
+ }
}
#ifndef _LIBCPP_CXX03_LANG
template <class _Tp>
-inline
-valarray<_Tp>::valarray(valarray&& __v) _NOEXCEPT
- : __begin_(__v.__begin_),
- __end_(__v.__end_)
-{
- __v.__begin_ = __v.__end_ = nullptr;
+inline valarray<_Tp>::valarray(valarray&& __v) _NOEXCEPT : __begin_(__v.__begin_), __end_(__v.__end_) {
+ __v.__begin_ = __v.__end_ = nullptr;
}
template <class _Tp>
-valarray<_Tp>::valarray(initializer_list<value_type> __il)
- : __begin_(nullptr),
- __end_(nullptr)
-{
- const size_t __n = __il.size();
- if (__n)
- {
- __begin_ = __end_ = allocator<value_type>().allocate(__n);
-#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- try
- {
-#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- size_t __n_left = __n;
- for (const value_type* __p = __il.begin(); __n_left; ++__end_, ++__p, --__n_left)
- ::new ((void*)__end_) value_type(*__p);
-#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- }
- catch (...)
- {
- __clear(__n);
- throw;
- }
-#endif // _LIBCPP_HAS_NO_EXCEPTIONS
+valarray<_Tp>::valarray(initializer_list<value_type> __il) : __begin_(nullptr), __end_(nullptr) {
+ const size_t __n = __il.size();
+ if (__n) {
+ __begin_ = __end_ = allocator<value_type>().allocate(__n);
+# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
+ try {
+# endif // _LIBCPP_HAS_NO_EXCEPTIONS
+ size_t __n_left = __n;
+ for (const value_type* __p = __il.begin(); __n_left; ++__end_, ++__p, --__n_left)
+ ::new ((void*)__end_) value_type(*__p);
+# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
+ } catch (...) {
+ __clear(__n);
+ throw;
}
+# endif // _LIBCPP_HAS_NO_EXCEPTIONS
+ }
}
#endif // _LIBCPP_CXX03_LANG
template <class _Tp>
-valarray<_Tp>::valarray(const slice_array<value_type>& __sa)
- : __begin_(nullptr),
- __end_(nullptr)
-{
- const size_t __n = __sa.__size_;
- if (__n)
- {
- __begin_ = __end_ = allocator<value_type>().allocate(__n);
+valarray<_Tp>::valarray(const slice_array<value_type>& __sa) : __begin_(nullptr), __end_(nullptr) {
+ const size_t __n = __sa.__size_;
+ if (__n) {
+ __begin_ = __end_ = allocator<value_type>().allocate(__n);
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- try
- {
+ try {
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- size_t __n_left = __n;
- for (const value_type* __p = __sa.__vp_; __n_left; ++__end_, __p += __sa.__stride_, --__n_left)
- ::new ((void*)__end_) value_type(*__p);
+ size_t __n_left = __n;
+ for (const value_type* __p = __sa.__vp_; __n_left; ++__end_, __p += __sa.__stride_, --__n_left)
+ ::new ((void*)__end_) value_type(*__p);
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- }
- catch (...)
- {
- __clear(__n);
- throw;
- }
-#endif // _LIBCPP_HAS_NO_EXCEPTIONS
+ } catch (...) {
+ __clear(__n);
+ throw;
}
+#endif // _LIBCPP_HAS_NO_EXCEPTIONS
+ }
}
template <class _Tp>
-valarray<_Tp>::valarray(const gslice_array<value_type>& __ga)
- : __begin_(nullptr),
- __end_(nullptr)
-{
- const size_t __n = __ga.__1d_.size();
- if (__n)
- {
- __begin_ = __end_ = allocator<value_type>().allocate(__n);
+valarray<_Tp>::valarray(const gslice_array<value_type>& __ga) : __begin_(nullptr), __end_(nullptr) {
+ const size_t __n = __ga.__1d_.size();
+ if (__n) {
+ __begin_ = __end_ = allocator<value_type>().allocate(__n);
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- try
- {
+ try {
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- typedef const size_t* _Ip;
- const value_type* __s = __ga.__vp_;
- for (_Ip __i = __ga.__1d_.__begin_, __e = __ga.__1d_.__end_;
- __i != __e; ++__i, ++__end_)
- ::new ((void*)__end_) value_type(__s[*__i]);
+ typedef const size_t* _Ip;
+ const value_type* __s = __ga.__vp_;
+ for (_Ip __i = __ga.__1d_.__begin_, __e = __ga.__1d_.__end_; __i != __e; ++__i, ++__end_)
+ ::new ((void*)__end_) value_type(__s[*__i]);
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- }
- catch (...)
- {
- __clear(__n);
- throw;
- }
-#endif // _LIBCPP_HAS_NO_EXCEPTIONS
+ } catch (...) {
+ __clear(__n);
+ throw;
}
+#endif // _LIBCPP_HAS_NO_EXCEPTIONS
+ }
}
template <class _Tp>
-valarray<_Tp>::valarray(const mask_array<value_type>& __ma)
- : __begin_(nullptr),
- __end_(nullptr)
-{
- const size_t __n = __ma.__1d_.size();
- if (__n)
- {
- __begin_ = __end_ = allocator<value_type>().allocate(__n);
+valarray<_Tp>::valarray(const mask_array<value_type>& __ma) : __begin_(nullptr), __end_(nullptr) {
+ const size_t __n = __ma.__1d_.size();
+ if (__n) {
+ __begin_ = __end_ = allocator<value_type>().allocate(__n);
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- try
- {
+ try {
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- typedef const size_t* _Ip;
- const value_type* __s = __ma.__vp_;
- for (_Ip __i = __ma.__1d_.__begin_, __e = __ma.__1d_.__end_;
- __i != __e; ++__i, ++__end_)
- ::new ((void*)__end_) value_type(__s[*__i]);
+ typedef const size_t* _Ip;
+ const value_type* __s = __ma.__vp_;
+ for (_Ip __i = __ma.__1d_.__begin_, __e = __ma.__1d_.__end_; __i != __e; ++__i, ++__end_)
+ ::new ((void*)__end_) value_type(__s[*__i]);
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- }
- catch (...)
- {
- __clear(__n);
- throw;
- }
-#endif // _LIBCPP_HAS_NO_EXCEPTIONS
+ } catch (...) {
+ __clear(__n);
+ throw;
}
+#endif // _LIBCPP_HAS_NO_EXCEPTIONS
+ }
}
template <class _Tp>
-valarray<_Tp>::valarray(const indirect_array<value_type>& __ia)
- : __begin_(nullptr),
- __end_(nullptr)
-{
- const size_t __n = __ia.__1d_.size();
- if (__n)
- {
- __begin_ = __end_ = allocator<value_type>().allocate(__n);
+valarray<_Tp>::valarray(const indirect_array<value_type>& __ia) : __begin_(nullptr), __end_(nullptr) {
+ const size_t __n = __ia.__1d_.size();
+ if (__n) {
+ __begin_ = __end_ = allocator<value_type>().allocate(__n);
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- try
- {
+ try {
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- typedef const size_t* _Ip;
- const value_type* __s = __ia.__vp_;
- for (_Ip __i = __ia.__1d_.__begin_, __e = __ia.__1d_.__end_;
- __i != __e; ++__i, ++__end_)
- ::new ((void*)__end_) value_type(__s[*__i]);
+ typedef const size_t* _Ip;
+ const value_type* __s = __ia.__vp_;
+ for (_Ip __i = __ia.__1d_.__begin_, __e = __ia.__1d_.__end_; __i != __e; ++__i, ++__end_)
+ ::new ((void*)__end_) value_type(__s[*__i]);
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- }
- catch (...)
- {
- __clear(__n);
- throw;
- }
-#endif // _LIBCPP_HAS_NO_EXCEPTIONS
+ } catch (...) {
+ __clear(__n);
+ throw;
}
+#endif // _LIBCPP_HAS_NO_EXCEPTIONS
+ }
}
template <class _Tp>
-inline
-valarray<_Tp>::~valarray()
-{
- __clear(size());
+inline valarray<_Tp>::~valarray() {
+ __clear(size());
}
template <class _Tp>
-valarray<_Tp>&
-valarray<_Tp>::__assign_range(const value_type* __f, const value_type* __l)
-{
- size_t __n = __l - __f;
- if (size() != __n)
- {
- __clear(size());
- __begin_ = allocator<value_type>().allocate(__n);
- __end_ = __begin_ + __n;
- std::uninitialized_copy(__f, __l, __begin_);
- } else {
- std::copy(__f, __l, __begin_);
- }
- return *this;
+valarray<_Tp>& valarray<_Tp>::__assign_range(const value_type* __f, const value_type* __l) {
+ size_t __n = __l - __f;
+ if (size() != __n) {
+ __clear(size());
+ __begin_ = allocator<value_type>().allocate(__n);
+ __end_ = __begin_ + __n;
+ std::uninitialized_copy(__f, __l, __begin_);
+ } else {
+ std::copy(__f, __l, __begin_);
+ }
+ return *this;
}
template <class _Tp>
-valarray<_Tp>&
-valarray<_Tp>::operator=(const valarray& __v)
-{
- if (this != std::addressof(__v))
- return __assign_range(__v.__begin_, __v.__end_);
- return *this;
+valarray<_Tp>& valarray<_Tp>::operator=(const valarray& __v) {
+ if (this != std::addressof(__v))
+ return __assign_range(__v.__begin_, __v.__end_);
+ return *this;
}
#ifndef _LIBCPP_CXX03_LANG
template <class _Tp>
-inline
-valarray<_Tp>&
-valarray<_Tp>::operator=(valarray&& __v) _NOEXCEPT
-{
- __clear(size());
- __begin_ = __v.__begin_;
- __end_ = __v.__end_;
- __v.__begin_ = nullptr;
- __v.__end_ = nullptr;
- return *this;
+inline valarray<_Tp>& valarray<_Tp>::operator=(valarray&& __v) _NOEXCEPT {
+ __clear(size());
+ __begin_ = __v.__begin_;
+ __end_ = __v.__end_;
+ __v.__begin_ = nullptr;
+ __v.__end_ = nullptr;
+ return *this;
}
template <class _Tp>
-inline
-valarray<_Tp>&
-valarray<_Tp>::operator=(initializer_list<value_type> __il)
-{
- return __assign_range(__il.begin(), __il.end());
+inline valarray<_Tp>& valarray<_Tp>::operator=(initializer_list<value_type> __il) {
+ return __assign_range(__il.begin(), __il.end());
}
#endif // _LIBCPP_CXX03_LANG
template <class _Tp>
-inline
-valarray<_Tp>&
-valarray<_Tp>::operator=(const value_type& __x)
-{
- std::fill(__begin_, __end_, __x);
- return *this;
+inline valarray<_Tp>& valarray<_Tp>::operator=(const value_type& __x) {
+ std::fill(__begin_, __end_, __x);
+ return *this;
}
template <class _Tp>
-inline
-valarray<_Tp>&
-valarray<_Tp>::operator=(const slice_array<value_type>& __sa)
-{
- value_type* __t = __begin_;
- const value_type* __s = __sa.__vp_;
- for (size_t __n = __sa.__size_; __n; --__n, __s += __sa.__stride_, ++__t)
- *__t = *__s;
- return *this;
+inline valarray<_Tp>& valarray<_Tp>::operator=(const slice_array<value_type>& __sa) {
+ value_type* __t = __begin_;
+ const value_type* __s = __sa.__vp_;
+ for (size_t __n = __sa.__size_; __n; --__n, __s += __sa.__stride_, ++__t)
+ *__t = *__s;
+ return *this;
}
template <class _Tp>
-inline
-valarray<_Tp>&
-valarray<_Tp>::operator=(const gslice_array<value_type>& __ga)
-{
- typedef const size_t* _Ip;
- value_type* __t = __begin_;
- const value_type* __s = __ga.__vp_;
- for (_Ip __i = __ga.__1d_.__begin_, __e = __ga.__1d_.__end_;
- __i != __e; ++__i, ++__t)
- *__t = __s[*__i];
- return *this;
+inline valarray<_Tp>& valarray<_Tp>::operator=(const gslice_array<value_type>& __ga) {
+ typedef const size_t* _Ip;
+ value_type* __t = __begin_;
+ const value_type* __s = __ga.__vp_;
+ for (_Ip __i = __ga.__1d_.__begin_, __e = __ga.__1d_.__end_; __i != __e; ++__i, ++__t)
+ *__t = __s[*__i];
+ return *this;
}
template <class _Tp>
-inline
-valarray<_Tp>&
-valarray<_Tp>::operator=(const mask_array<value_type>& __ma)
-{
- typedef const size_t* _Ip;
- value_type* __t = __begin_;
- const value_type* __s = __ma.__vp_;
- for (_Ip __i = __ma.__1d_.__begin_, __e = __ma.__1d_.__end_;
- __i != __e; ++__i, ++__t)
- *__t = __s[*__i];
- return *this;
+inline valarray<_Tp>& valarray<_Tp>::operator=(const mask_array<value_type>& __ma) {
+ typedef const size_t* _Ip;
+ value_type* __t = __begin_;
+ const value_type* __s = __ma.__vp_;
+ for (_Ip __i = __ma.__1d_.__begin_, __e = __ma.__1d_.__end_; __i != __e; ++__i, ++__t)
+ *__t = __s[*__i];
+ return *this;
}
template <class _Tp>
-inline
-valarray<_Tp>&
-valarray<_Tp>::operator=(const indirect_array<value_type>& __ia)
-{
- typedef const size_t* _Ip;
- value_type* __t = __begin_;
- const value_type* __s = __ia.__vp_;
- for (_Ip __i = __ia.__1d_.__begin_, __e = __ia.__1d_.__end_;
- __i != __e; ++__i, ++__t)
- *__t = __s[*__i];
- return *this;
+inline valarray<_Tp>& valarray<_Tp>::operator=(const indirect_array<value_type>& __ia) {
+ typedef const size_t* _Ip;
+ value_type* __t = __begin_;
+ const value_type* __s = __ia.__vp_;
+ for (_Ip __i = __ia.__1d_.__begin_, __e = __ia.__1d_.__end_; __i != __e; ++__i, ++__t)
+ *__t = __s[*__i];
+ return *this;
}
template <class _Tp>
template <class _ValExpr>
-inline
-valarray<_Tp>&
-valarray<_Tp>::operator=(const __val_expr<_ValExpr>& __v)
-{
- size_t __n = __v.size();
- if (size() != __n)
- resize(__n);
- value_type* __t = __begin_;
- for (size_t __i = 0; __i != __n; ++__t, ++__i)
- *__t = __result_type(__v[__i]);
- return *this;
+inline valarray<_Tp>& valarray<_Tp>::operator=(const __val_expr<_ValExpr>& __v) {
+ size_t __n = __v.size();
+ if (size() != __n)
+ resize(__n);
+ value_type* __t = __begin_;
+ for (size_t __i = 0; __i != __n; ++__t, ++__i)
+ *__t = __result_type(__v[__i]);
+ return *this;
}
template <class _Tp>
-inline
-__val_expr<__slice_expr<const valarray<_Tp>&> >
-valarray<_Tp>::operator[](slice __s) const
-{
- return __val_expr<__slice_expr<const valarray&> >(__slice_expr<const valarray&>(__s, *this));
+inline __val_expr<__slice_expr<const valarray<_Tp>&> > valarray<_Tp>::operator[](slice __s) const {
+ return __val_expr<__slice_expr<const valarray&> >(__slice_expr<const valarray&>(__s, *this));
}
template <class _Tp>
-inline
-slice_array<_Tp>
-valarray<_Tp>::operator[](slice __s)
-{
- return slice_array<value_type>(__s, *this);
+inline slice_array<_Tp> valarray<_Tp>::operator[](slice __s) {
+ return slice_array<value_type>(__s, *this);
}
template <class _Tp>
-inline
-__val_expr<__indirect_expr<const valarray<_Tp>&> >
-valarray<_Tp>::operator[](const gslice& __gs) const
-{
- return __val_expr<__indirect_expr<const valarray&> >(__indirect_expr<const valarray&>(__gs.__1d_, *this));
+inline __val_expr<__indirect_expr<const valarray<_Tp>&> > valarray<_Tp>::operator[](const gslice& __gs) const {
+ return __val_expr<__indirect_expr<const valarray&> >(__indirect_expr<const valarray&>(__gs.__1d_, *this));
}
template <class _Tp>
-inline
-gslice_array<_Tp>
-valarray<_Tp>::operator[](const gslice& __gs)
-{
- return gslice_array<value_type>(__gs, *this);
+inline gslice_array<_Tp> valarray<_Tp>::operator[](const gslice& __gs) {
+ return gslice_array<value_type>(__gs, *this);
}
#ifndef _LIBCPP_CXX03_LANG
template <class _Tp>
-inline
-__val_expr<__indirect_expr<const valarray<_Tp>&> >
-valarray<_Tp>::operator[](gslice&& __gs) const
-{
- return __val_expr<__indirect_expr<const valarray&> >(__indirect_expr<const valarray&>(std::move(__gs.__1d_), *this));
+inline __val_expr<__indirect_expr<const valarray<_Tp>&> > valarray<_Tp>::operator[](gslice&& __gs) const {
+ return __val_expr<__indirect_expr<const valarray&> >(__indirect_expr<const valarray&>(std::move(__gs.__1d_), *this));
}
template <class _Tp>
-inline
-gslice_array<_Tp>
-valarray<_Tp>::operator[](gslice&& __gs)
-{
- return gslice_array<value_type>(std::move(__gs), *this);
+inline gslice_array<_Tp> valarray<_Tp>::operator[](gslice&& __gs) {
+ return gslice_array<value_type>(std::move(__gs), *this);
}
#endif // _LIBCPP_CXX03_LANG
template <class _Tp>
-inline
-__val_expr<__mask_expr<const valarray<_Tp>&> >
-valarray<_Tp>::operator[](const valarray<bool>& __vb) const
-{
- return __val_expr<__mask_expr<const valarray&> >(__mask_expr<const valarray&>(__vb, *this));
+inline __val_expr<__mask_expr<const valarray<_Tp>&> > valarray<_Tp>::operator[](const valarray<bool>& __vb) const {
+ return __val_expr<__mask_expr<const valarray&> >(__mask_expr<const valarray&>(__vb, *this));
}
template <class _Tp>
-inline
-mask_array<_Tp>
-valarray<_Tp>::operator[](const valarray<bool>& __vb)
-{
- return mask_array<value_type>(__vb, *this);
+inline mask_array<_Tp> valarray<_Tp>::operator[](const valarray<bool>& __vb) {
+ return mask_array<value_type>(__vb, *this);
}
#ifndef _LIBCPP_CXX03_LANG
template <class _Tp>
-inline
-__val_expr<__mask_expr<const valarray<_Tp>&> >
-valarray<_Tp>::operator[](valarray<bool>&& __vb) const
-{
- return __val_expr<__mask_expr<const valarray&> >(__mask_expr<const valarray&>(std::move(__vb), *this));
+inline __val_expr<__mask_expr<const valarray<_Tp>&> > valarray<_Tp>::operator[](valarray<bool>&& __vb) const {
+ return __val_expr<__mask_expr<const valarray&> >(__mask_expr<const valarray&>(std::move(__vb), *this));
}
template <class _Tp>
-inline
-mask_array<_Tp>
-valarray<_Tp>::operator[](valarray<bool>&& __vb)
-{
- return mask_array<value_type>(std::move(__vb), *this);
+inline mask_array<_Tp> valarray<_Tp>::operator[](valarray<bool>&& __vb) {
+ return mask_array<value_type>(std::move(__vb), *this);
}
#endif // _LIBCPP_CXX03_LANG
template <class _Tp>
-inline
-__val_expr<__indirect_expr<const valarray<_Tp>&> >
-valarray<_Tp>::operator[](const valarray<size_t>& __vs) const
-{
- return __val_expr<__indirect_expr<const valarray&> >(__indirect_expr<const valarray&>(__vs, *this));
+inline __val_expr<__indirect_expr<const valarray<_Tp>&> >
+valarray<_Tp>::operator[](const valarray<size_t>& __vs) const {
+ return __val_expr<__indirect_expr<const valarray&> >(__indirect_expr<const valarray&>(__vs, *this));
}
template <class _Tp>
-inline
-indirect_array<_Tp>
-valarray<_Tp>::operator[](const valarray<size_t>& __vs)
-{
- return indirect_array<value_type>(__vs, *this);
+inline indirect_array<_Tp> valarray<_Tp>::operator[](const valarray<size_t>& __vs) {
+ return indirect_array<value_type>(__vs, *this);
}
#ifndef _LIBCPP_CXX03_LANG
template <class _Tp>
-inline
-__val_expr<__indirect_expr<const valarray<_Tp>&> >
-valarray<_Tp>::operator[](valarray<size_t>&& __vs) const
-{
- return __val_expr<__indirect_expr<const valarray&> >(__indirect_expr<const valarray&>(std::move(__vs), *this));
+inline __val_expr<__indirect_expr<const valarray<_Tp>&> > valarray<_Tp>::operator[](valarray<size_t>&& __vs) const {
+ return __val_expr<__indirect_expr<const valarray&> >(__indirect_expr<const valarray&>(std::move(__vs), *this));
}
template <class _Tp>
-inline
-indirect_array<_Tp>
-valarray<_Tp>::operator[](valarray<size_t>&& __vs)
-{
- return indirect_array<value_type>(std::move(__vs), *this);
+inline indirect_array<_Tp> valarray<_Tp>::operator[](valarray<size_t>&& __vs) {
+ return indirect_array<value_type>(std::move(__vs), *this);
}
#endif // _LIBCPP_CXX03_LANG
template <class _Tp>
-inline
-__val_expr<_UnaryOp<__unary_plus<_Tp>, const valarray<_Tp>&> >
-valarray<_Tp>::operator+() const
-{
- using _Op = _UnaryOp<__unary_plus<_Tp>, const valarray<_Tp>&>;
- return __val_expr<_Op>(_Op(__unary_plus<_Tp>(), *this));
+inline __val_expr<_UnaryOp<__unary_plus<_Tp>, const valarray<_Tp>&> > valarray<_Tp>::operator+() const {
+ using _Op = _UnaryOp<__unary_plus<_Tp>, const valarray<_Tp>&>;
+ return __val_expr<_Op>(_Op(__unary_plus<_Tp>(), *this));
}
template <class _Tp>
-inline
-__val_expr<_UnaryOp<negate<_Tp>, const valarray<_Tp>&> >
-valarray<_Tp>::operator-() const
-{
- using _Op = _UnaryOp<negate<_Tp>, const valarray<_Tp>&>;
- return __val_expr<_Op>(_Op(negate<_Tp>(), *this));
+inline __val_expr<_UnaryOp<negate<_Tp>, const valarray<_Tp>&> > valarray<_Tp>::operator-() const {
+ using _Op = _UnaryOp<negate<_Tp>, const valarray<_Tp>&>;
+ return __val_expr<_Op>(_Op(negate<_Tp>(), *this));
}
template <class _Tp>
-inline
-__val_expr<_UnaryOp<__bit_not<_Tp>, const valarray<_Tp>&> >
-valarray<_Tp>::operator~() const
-{
- using _Op = _UnaryOp<__bit_not<_Tp>, const valarray<_Tp>&>;
- return __val_expr<_Op>(_Op(__bit_not<_Tp>(), *this));
+inline __val_expr<_UnaryOp<__bit_not<_Tp>, const valarray<_Tp>&> > valarray<_Tp>::operator~() const {
+ using _Op = _UnaryOp<__bit_not<_Tp>, const valarray<_Tp>&>;
+ return __val_expr<_Op>(_Op(__bit_not<_Tp>(), *this));
}
template <class _Tp>
-inline
-__val_expr<_UnaryOp<logical_not<_Tp>, const valarray<_Tp>&> >
-valarray<_Tp>::operator!() const
-{
- using _Op = _UnaryOp<logical_not<_Tp>, const valarray<_Tp>&>;
- return __val_expr<_Op>(_Op(logical_not<_Tp>(), *this));
+inline __val_expr<_UnaryOp<logical_not<_Tp>, const valarray<_Tp>&> > valarray<_Tp>::operator!() const {
+ using _Op = _UnaryOp<logical_not<_Tp>, const valarray<_Tp>&>;
+ return __val_expr<_Op>(_Op(logical_not<_Tp>(), *this));
}
template <class _Tp>
-inline
-valarray<_Tp>&
-valarray<_Tp>::operator*=(const value_type& __x)
-{
- for (value_type* __p = __begin_; __p != __end_; ++__p)
- *__p *= __x;
- return *this;
+inline valarray<_Tp>& valarray<_Tp>::operator*=(const value_type& __x) {
+ for (value_type* __p = __begin_; __p != __end_; ++__p)
+ *__p *= __x;
+ return *this;
}
template <class _Tp>
-inline
-valarray<_Tp>&
-valarray<_Tp>::operator/=(const value_type& __x)
-{
- for (value_type* __p = __begin_; __p != __end_; ++__p)
- *__p /= __x;
- return *this;
+inline valarray<_Tp>& valarray<_Tp>::operator/=(const value_type& __x) {
+ for (value_type* __p = __begin_; __p != __end_; ++__p)
+ *__p /= __x;
+ return *this;
}
template <class _Tp>
-inline
-valarray<_Tp>&
-valarray<_Tp>::operator%=(const value_type& __x)
-{
- for (value_type* __p = __begin_; __p != __end_; ++__p)
- *__p %= __x;
- return *this;
+inline valarray<_Tp>& valarray<_Tp>::operator%=(const value_type& __x) {
+ for (value_type* __p = __begin_; __p != __end_; ++__p)
+ *__p %= __x;
+ return *this;
}
template <class _Tp>
-inline
-valarray<_Tp>&
-valarray<_Tp>::operator+=(const value_type& __x)
-{
- for (value_type* __p = __begin_; __p != __end_; ++__p)
- *__p += __x;
- return *this;
+inline valarray<_Tp>& valarray<_Tp>::operator+=(const value_type& __x) {
+ for (value_type* __p = __begin_; __p != __end_; ++__p)
+ *__p += __x;
+ return *this;
}
template <class _Tp>
-inline
-valarray<_Tp>&
-valarray<_Tp>::operator-=(const value_type& __x)
-{
- for (value_type* __p = __begin_; __p != __end_; ++__p)
- *__p -= __x;
- return *this;
+inline valarray<_Tp>& valarray<_Tp>::operator-=(const value_type& __x) {
+ for (value_type* __p = __begin_; __p != __end_; ++__p)
+ *__p -= __x;
+ return *this;
}
template <class _Tp>
-inline
-valarray<_Tp>&
-valarray<_Tp>::operator^=(const value_type& __x)
-{
- for (value_type* __p = __begin_; __p != __end_; ++__p)
- *__p ^= __x;
- return *this;
+inline valarray<_Tp>& valarray<_Tp>::operator^=(const value_type& __x) {
+ for (value_type* __p = __begin_; __p != __end_; ++__p)
+ *__p ^= __x;
+ return *this;
}
template <class _Tp>
-inline
-valarray<_Tp>&
-valarray<_Tp>::operator&=(const value_type& __x)
-{
- for (value_type* __p = __begin_; __p != __end_; ++__p)
- *__p &= __x;
- return *this;
+inline valarray<_Tp>& valarray<_Tp>::operator&=(const value_type& __x) {
+ for (value_type* __p = __begin_; __p != __end_; ++__p)
+ *__p &= __x;
+ return *this;
}
template <class _Tp>
-inline
-valarray<_Tp>&
-valarray<_Tp>::operator|=(const value_type& __x)
-{
- for (value_type* __p = __begin_; __p != __end_; ++__p)
- *__p |= __x;
- return *this;
+inline valarray<_Tp>& valarray<_Tp>::operator|=(const value_type& __x) {
+ for (value_type* __p = __begin_; __p != __end_; ++__p)
+ *__p |= __x;
+ return *this;
}
template <class _Tp>
-inline
-valarray<_Tp>&
-valarray<_Tp>::operator<<=(const value_type& __x)
-{
- for (value_type* __p = __begin_; __p != __end_; ++__p)
- *__p <<= __x;
- return *this;
+inline valarray<_Tp>& valarray<_Tp>::operator<<=(const value_type& __x) {
+ for (value_type* __p = __begin_; __p != __end_; ++__p)
+ *__p <<= __x;
+ return *this;
}
template <class _Tp>
-inline
-valarray<_Tp>&
-valarray<_Tp>::operator>>=(const value_type& __x)
-{
- for (value_type* __p = __begin_; __p != __end_; ++__p)
- *__p >>= __x;
- return *this;
+inline valarray<_Tp>& valarray<_Tp>::operator>>=(const value_type& __x) {
+ for (value_type* __p = __begin_; __p != __end_; ++__p)
+ *__p >>= __x;
+ return *this;
}
template <class _Tp>
template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> >
-inline
- valarray<_Tp>&
-valarray<_Tp>::operator*=(const _Expr& __v)
-{
- size_t __i = 0;
- for (value_type* __t = __begin_; __t != __end_ ; ++__t, ++__i)
- *__t *= __v[__i];
- return *this;
+inline valarray<_Tp>& valarray<_Tp>::operator*=(const _Expr& __v) {
+ size_t __i = 0;
+ for (value_type* __t = __begin_; __t != __end_; ++__t, ++__i)
+ *__t *= __v[__i];
+ return *this;
}
template <class _Tp>
template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> >
-inline
- valarray<_Tp>&
-valarray<_Tp>::operator/=(const _Expr& __v)
-{
- size_t __i = 0;
- for (value_type* __t = __begin_; __t != __end_ ; ++__t, ++__i)
- *__t /= __v[__i];
- return *this;
+inline valarray<_Tp>& valarray<_Tp>::operator/=(const _Expr& __v) {
+ size_t __i = 0;
+ for (value_type* __t = __begin_; __t != __end_; ++__t, ++__i)
+ *__t /= __v[__i];
+ return *this;
}
template <class _Tp>
template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> >
-inline
- valarray<_Tp>&
-valarray<_Tp>::operator%=(const _Expr& __v)
-{
- size_t __i = 0;
- for (value_type* __t = __begin_; __t != __end_ ; ++__t, ++__i)
- *__t %= __v[__i];
- return *this;
+inline valarray<_Tp>& valarray<_Tp>::operator%=(const _Expr& __v) {
+ size_t __i = 0;
+ for (value_type* __t = __begin_; __t != __end_; ++__t, ++__i)
+ *__t %= __v[__i];
+ return *this;
}
template <class _Tp>
template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> >
-inline
- valarray<_Tp>&
-valarray<_Tp>::operator+=(const _Expr& __v)
-{
- size_t __i = 0;
- for (value_type* __t = __begin_; __t != __end_ ; ++__t, ++__i)
- *__t += __v[__i];
- return *this;
+inline valarray<_Tp>& valarray<_Tp>::operator+=(const _Expr& __v) {
+ size_t __i = 0;
+ for (value_type* __t = __begin_; __t != __end_; ++__t, ++__i)
+ *__t += __v[__i];
+ return *this;
}
template <class _Tp>
template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> >
-inline
- valarray<_Tp>&
-valarray<_Tp>::operator-=(const _Expr& __v)
-{
- size_t __i = 0;
- for (value_type* __t = __begin_; __t != __end_ ; ++__t, ++__i)
- *__t -= __v[__i];
- return *this;
+inline valarray<_Tp>& valarray<_Tp>::operator-=(const _Expr& __v) {
+ size_t __i = 0;
+ for (value_type* __t = __begin_; __t != __end_; ++__t, ++__i)
+ *__t -= __v[__i];
+ return *this;
}
template <class _Tp>
template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> >
-inline
- valarray<_Tp>&
-valarray<_Tp>::operator^=(const _Expr& __v)
-{
- size_t __i = 0;
- for (value_type* __t = __begin_; __t != __end_ ; ++__t, ++__i)
- *__t ^= __v[__i];
- return *this;
+inline valarray<_Tp>& valarray<_Tp>::operator^=(const _Expr& __v) {
+ size_t __i = 0;
+ for (value_type* __t = __begin_; __t != __end_; ++__t, ++__i)
+ *__t ^= __v[__i];
+ return *this;
}
template <class _Tp>
template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> >
-inline
- valarray<_Tp>&
-valarray<_Tp>::operator|=(const _Expr& __v)
-{
- size_t __i = 0;
- for (value_type* __t = __begin_; __t != __end_ ; ++__t, ++__i)
- *__t |= __v[__i];
- return *this;
+inline valarray<_Tp>& valarray<_Tp>::operator|=(const _Expr& __v) {
+ size_t __i = 0;
+ for (value_type* __t = __begin_; __t != __end_; ++__t, ++__i)
+ *__t |= __v[__i];
+ return *this;
}
template <class _Tp>
template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> >
-inline
- valarray<_Tp>&
-valarray<_Tp>::operator&=(const _Expr& __v)
-{
- size_t __i = 0;
- for (value_type* __t = __begin_; __t != __end_ ; ++__t, ++__i)
- *__t &= __v[__i];
- return *this;
+inline valarray<_Tp>& valarray<_Tp>::operator&=(const _Expr& __v) {
+ size_t __i = 0;
+ for (value_type* __t = __begin_; __t != __end_; ++__t, ++__i)
+ *__t &= __v[__i];
+ return *this;
}
template <class _Tp>
template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> >
-inline
- valarray<_Tp>&
-valarray<_Tp>::operator<<=(const _Expr& __v)
-{
- size_t __i = 0;
- for (value_type* __t = __begin_; __t != __end_ ; ++__t, ++__i)
- *__t <<= __v[__i];
- return *this;
+inline valarray<_Tp>& valarray<_Tp>::operator<<=(const _Expr& __v) {
+ size_t __i = 0;
+ for (value_type* __t = __begin_; __t != __end_; ++__t, ++__i)
+ *__t <<= __v[__i];
+ return *this;
}
template <class _Tp>
template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> >
-inline
- valarray<_Tp>&
-valarray<_Tp>::operator>>=(const _Expr& __v)
-{
- size_t __i = 0;
- for (value_type* __t = __begin_; __t != __end_ ; ++__t, ++__i)
- *__t >>= __v[__i];
- return *this;
+inline valarray<_Tp>& valarray<_Tp>::operator>>=(const _Expr& __v) {
+ size_t __i = 0;
+ for (value_type* __t = __begin_; __t != __end_; ++__t, ++__i)
+ *__t >>= __v[__i];
+ return *this;
}
template <class _Tp>
-inline
-void
-valarray<_Tp>::swap(valarray& __v) _NOEXCEPT
-{
- std::swap(__begin_, __v.__begin_);
- std::swap(__end_, __v.__end_);
+inline void valarray<_Tp>::swap(valarray& __v) _NOEXCEPT {
+ std::swap(__begin_, __v.__begin_);
+ std::swap(__end_, __v.__end_);
}
template <class _Tp>
-inline
-_Tp
-valarray<_Tp>::sum() const
-{
- if (__begin_ == __end_)
- return value_type();
- const value_type* __p = __begin_;
- _Tp __r = *__p;
- for (++__p; __p != __end_; ++__p)
- __r += *__p;
- return __r;
+inline _Tp valarray<_Tp>::sum() const {
+ if (__begin_ == __end_)
+ return value_type();
+ const value_type* __p = __begin_;
+ _Tp __r = *__p;
+ for (++__p; __p != __end_; ++__p)
+ __r += *__p;
+ return __r;
}
template <class _Tp>
-inline
-_Tp
-valarray<_Tp>::min() const
-{
- if (__begin_ == __end_)
- return value_type();
- return *std::min_element(__begin_, __end_);
+inline _Tp valarray<_Tp>::min() const {
+ if (__begin_ == __end_)
+ return value_type();
+ return *std::min_element(__begin_, __end_);
}
template <class _Tp>
-inline
-_Tp
-valarray<_Tp>::max() const
-{
- if (__begin_ == __end_)
- return value_type();
- return *std::max_element(__begin_, __end_);
+inline _Tp valarray<_Tp>::max() const {
+ if (__begin_ == __end_)
+ return value_type();
+ return *std::max_element(__begin_, __end_);
}
template <class _Tp>
-valarray<_Tp>
-valarray<_Tp>::shift(int __i) const
-{
- valarray<value_type> __r;
- size_t __n = size();
- if (__n)
- {
- __r.__begin_ = __r.__end_ = allocator<value_type>().allocate(__n);
- const value_type* __sb;
- value_type* __tb;
- value_type* __te;
- if (__i >= 0)
- {
- __i = std::min(__i, static_cast<int>(__n));
- __sb = __begin_ + __i;
- __tb = __r.__begin_;
- __te = __r.__begin_ + (__n - __i);
- }
- else
- {
- __i = std::min(-__i, static_cast<int>(__n));
- __sb = __begin_;
- __tb = __r.__begin_ + __i;
- __te = __r.__begin_ + __n;
- }
- for (; __r.__end_ != __tb; ++__r.__end_)
- ::new ((void*)__r.__end_) value_type();
- for (; __r.__end_ != __te; ++__r.__end_, ++__sb)
- ::new ((void*)__r.__end_) value_type(*__sb);
- for (__te = __r.__begin_ + __n; __r.__end_ != __te; ++__r.__end_)
- ::new ((void*)__r.__end_) value_type();
+valarray<_Tp> valarray<_Tp>::shift(int __i) const {
+ valarray<value_type> __r;
+ size_t __n = size();
+ if (__n) {
+ __r.__begin_ = __r.__end_ = allocator<value_type>().allocate(__n);
+ const value_type* __sb;
+ value_type* __tb;
+ value_type* __te;
+ if (__i >= 0) {
+ __i = std::min(__i, static_cast<int>(__n));
+ __sb = __begin_ + __i;
+ __tb = __r.__begin_;
+ __te = __r.__begin_ + (__n - __i);
+ } else {
+ __i = std::min(-__i, static_cast<int>(__n));
+ __sb = __begin_;
+ __tb = __r.__begin_ + __i;
+ __te = __r.__begin_ + __n;
}
- return __r;
+ for (; __r.__end_ != __tb; ++__r.__end_)
+ ::new ((void*)__r.__end_) value_type();
+ for (; __r.__end_ != __te; ++__r.__end_, ++__sb)
+ ::new ((void*)__r.__end_) value_type(*__sb);
+ for (__te = __r.__begin_ + __n; __r.__end_ != __te; ++__r.__end_)
+ ::new ((void*)__r.__end_) value_type();
+ }
+ return __r;
}
template <class _Tp>
-valarray<_Tp>
-valarray<_Tp>::cshift(int __i) const
-{
- valarray<value_type> __r;
- size_t __n = size();
- if (__n)
- {
- __r.__begin_ = __r.__end_ = allocator<value_type>().allocate(__n);
- __i %= static_cast<int>(__n);
- const value_type* __m = __i >= 0 ? __begin_ + __i : __end_ + __i;
- for (const value_type* __s = __m; __s != __end_; ++__r.__end_, ++__s)
- ::new ((void*)__r.__end_) value_type(*__s);
- for (const value_type* __s = __begin_; __s != __m; ++__r.__end_, ++__s)
- ::new ((void*)__r.__end_) value_type(*__s);
- }
- return __r;
+valarray<_Tp> valarray<_Tp>::cshift(int __i) const {
+ valarray<value_type> __r;
+ size_t __n = size();
+ if (__n) {
+ __r.__begin_ = __r.__end_ = allocator<value_type>().allocate(__n);
+ __i %= static_cast<int>(__n);
+ const value_type* __m = __i >= 0 ? __begin_ + __i : __end_ + __i;
+ for (const value_type* __s = __m; __s != __end_; ++__r.__end_, ++__s)
+ ::new ((void*)__r.__end_) value_type(*__s);
+ for (const value_type* __s = __begin_; __s != __m; ++__r.__end_, ++__s)
+ ::new ((void*)__r.__end_) value_type(*__s);
+ }
+ return __r;
}
template <class _Tp>
-valarray<_Tp>
-valarray<_Tp>::apply(value_type __f(value_type)) const
-{
- valarray<value_type> __r;
- size_t __n = size();
- if (__n)
- {
- __r.__begin_ = __r.__end_ = allocator<value_type>().allocate(__n);
- for (const value_type* __p = __begin_; __n; ++__r.__end_, ++__p, --__n)
- ::new ((void*)__r.__end_) value_type(__f(*__p));
- }
- return __r;
+valarray<_Tp> valarray<_Tp>::apply(value_type __f(value_type)) const {
+ valarray<value_type> __r;
+ size_t __n = size();
+ if (__n) {
+ __r.__begin_ = __r.__end_ = allocator<value_type>().allocate(__n);
+ for (const value_type* __p = __begin_; __n; ++__r.__end_, ++__p, --__n)
+ ::new ((void*)__r.__end_) value_type(__f(*__p));
+ }
+ return __r;
}
template <class _Tp>
-valarray<_Tp>
-valarray<_Tp>::apply(value_type __f(const value_type&)) const
-{
- valarray<value_type> __r;
- size_t __n = size();
- if (__n)
- {
- __r.__begin_ = __r.__end_ = allocator<value_type>().allocate(__n);
- for (const value_type* __p = __begin_; __n; ++__r.__end_, ++__p, --__n)
- ::new ((void*)__r.__end_) value_type(__f(*__p));
- }
- return __r;
+valarray<_Tp> valarray<_Tp>::apply(value_type __f(const value_type&)) const {
+ valarray<value_type> __r;
+ size_t __n = size();
+ if (__n) {
+ __r.__begin_ = __r.__end_ = allocator<value_type>().allocate(__n);
+ for (const value_type* __p = __begin_; __n; ++__r.__end_, ++__p, --__n)
+ ::new ((void*)__r.__end_) value_type(__f(*__p));
+ }
+ return __r;
}
template <class _Tp>
-inline
-void valarray<_Tp>::__clear(size_t __capacity)
-{
- if (__begin_ != nullptr)
- {
+inline void valarray<_Tp>::__clear(size_t __capacity) {
+ if (__begin_ != nullptr) {
while (__end_ != __begin_)
(--__end_)->~value_type();
allocator<value_type>().deallocate(__begin_, __capacity);
@@ -3315,888 +2552,719 @@ void valarray<_Tp>::__clear(size_t __capacity)
}
template <class _Tp>
-void
-valarray<_Tp>::resize(size_t __n, value_type __x)
-{
- __clear(size());
- if (__n)
- {
- __begin_ = __end_ = allocator<value_type>().allocate(__n);
+void valarray<_Tp>::resize(size_t __n, value_type __x) {
+ __clear(size());
+ if (__n) {
+ __begin_ = __end_ = allocator<value_type>().allocate(__n);
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- try
- {
+ try {
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- for (size_t __n_left = __n; __n_left; --__n_left, ++__end_)
- ::new ((void*)__end_) value_type(__x);
+ for (size_t __n_left = __n; __n_left; --__n_left, ++__end_)
+ ::new ((void*)__end_) value_type(__x);
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- }
- catch (...)
- {
- __clear(__n);
- throw;
- }
-#endif // _LIBCPP_HAS_NO_EXCEPTIONS
+ } catch (...) {
+ __clear(__n);
+ throw;
}
+#endif // _LIBCPP_HAS_NO_EXCEPTIONS
+ }
}
-template<class _Tp>
-inline _LIBCPP_HIDE_FROM_ABI
-void
-swap(valarray<_Tp>& __x, valarray<_Tp>& __y) _NOEXCEPT
-{
- __x.swap(__y);
+template <class _Tp>
+inline _LIBCPP_HIDE_FROM_ABI void swap(valarray<_Tp>& __x, valarray<_Tp>& __y) _NOEXCEPT {
+ __x.swap(__y);
}
-template<class _Expr1, class _Expr2, __enable_if_t<__is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value, int> = 0>
-inline _LIBCPP_HIDE_FROM_ABI
-__val_expr<_BinaryOp<multiplies<typename _Expr1::value_type>, _Expr1, _Expr2> >
-operator*(const _Expr1& __x, const _Expr2& __y)
-{
- typedef typename _Expr1::value_type value_type;
- typedef _BinaryOp<multiplies<value_type>, _Expr1, _Expr2> _Op;
- return __val_expr<_Op>(_Op(multiplies<value_type>(), __x, __y));
+template <class _Expr1,
+ class _Expr2,
+ __enable_if_t<__is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value, int> = 0>
+inline _LIBCPP_HIDE_FROM_ABI __val_expr<_BinaryOp<multiplies<typename _Expr1::value_type>, _Expr1, _Expr2> >
+operator*(const _Expr1& __x, const _Expr2& __y) {
+ typedef typename _Expr1::value_type value_type;
+ typedef _BinaryOp<multiplies<value_type>, _Expr1, _Expr2> _Op;
+ return __val_expr<_Op>(_Op(multiplies<value_type>(), __x, __y));
}
-template<class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
+template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
inline _LIBCPP_HIDE_FROM_ABI
-__val_expr<_BinaryOp<multiplies<typename _Expr::value_type>,
- _Expr, __scalar_expr<typename _Expr::value_type> > >
-operator*(const _Expr& __x, const typename _Expr::value_type& __y)
-{
- typedef typename _Expr::value_type value_type;
- typedef _BinaryOp<multiplies<value_type>, _Expr, __scalar_expr<value_type> > _Op;
- return __val_expr<_Op>(_Op(multiplies<value_type>(),
- __x, __scalar_expr<value_type>(__y, __x.size())));
+ __val_expr<_BinaryOp<multiplies<typename _Expr::value_type>, _Expr, __scalar_expr<typename _Expr::value_type> > >
+ operator*(const _Expr& __x, const typename _Expr::value_type& __y) {
+ typedef typename _Expr::value_type value_type;
+ typedef _BinaryOp<multiplies<value_type>, _Expr, __scalar_expr<value_type> > _Op;
+ return __val_expr<_Op>(_Op(multiplies<value_type>(), __x, __scalar_expr<value_type>(__y, __x.size())));
}
-template<class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
+template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
inline _LIBCPP_HIDE_FROM_ABI
-__val_expr<_BinaryOp<multiplies<typename _Expr::value_type>,
- __scalar_expr<typename _Expr::value_type>, _Expr> >
-operator*(const typename _Expr::value_type& __x, const _Expr& __y)
-{
- typedef typename _Expr::value_type value_type;
- typedef _BinaryOp<multiplies<value_type>, __scalar_expr<value_type>, _Expr> _Op;
- return __val_expr<_Op>(_Op(multiplies<value_type>(),
- __scalar_expr<value_type>(__x, __y.size()), __y));
+ __val_expr<_BinaryOp<multiplies<typename _Expr::value_type>, __scalar_expr<typename _Expr::value_type>, _Expr> >
+ operator*(const typename _Expr::value_type& __x, const _Expr& __y) {
+ typedef typename _Expr::value_type value_type;
+ typedef _BinaryOp<multiplies<value_type>, __scalar_expr<value_type>, _Expr> _Op;
+ return __val_expr<_Op>(_Op(multiplies<value_type>(), __scalar_expr<value_type>(__x, __y.size()), __y));
}
-template<class _Expr1, class _Expr2, __enable_if_t<__is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value, int> = 0>
-inline _LIBCPP_HIDE_FROM_ABI
-__val_expr<_BinaryOp<divides<typename _Expr1::value_type>, _Expr1, _Expr2> >
-operator/(const _Expr1& __x, const _Expr2& __y)
-{
- typedef typename _Expr1::value_type value_type;
- typedef _BinaryOp<divides<value_type>, _Expr1, _Expr2> _Op;
- return __val_expr<_Op>(_Op(divides<value_type>(), __x, __y));
+template <class _Expr1,
+ class _Expr2,
+ __enable_if_t<__is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value, int> = 0>
+inline _LIBCPP_HIDE_FROM_ABI __val_expr<_BinaryOp<divides<typename _Expr1::value_type>, _Expr1, _Expr2> >
+operator/(const _Expr1& __x, const _Expr2& __y) {
+ typedef typename _Expr1::value_type value_type;
+ typedef _BinaryOp<divides<value_type>, _Expr1, _Expr2> _Op;
+ return __val_expr<_Op>(_Op(divides<value_type>(), __x, __y));
}
-template<class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
+template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
inline _LIBCPP_HIDE_FROM_ABI
-__val_expr<_BinaryOp<divides<typename _Expr::value_type>,
- _Expr, __scalar_expr<typename _Expr::value_type> > >
-operator/(const _Expr& __x, const typename _Expr::value_type& __y)
-{
- typedef typename _Expr::value_type value_type;
- typedef _BinaryOp<divides<value_type>, _Expr, __scalar_expr<value_type> > _Op;
- return __val_expr<_Op>(_Op(divides<value_type>(),
- __x, __scalar_expr<value_type>(__y, __x.size())));
+ __val_expr<_BinaryOp<divides<typename _Expr::value_type>, _Expr, __scalar_expr<typename _Expr::value_type> > >
+ operator/(const _Expr& __x, const typename _Expr::value_type& __y) {
+ typedef typename _Expr::value_type value_type;
+ typedef _BinaryOp<divides<value_type>, _Expr, __scalar_expr<value_type> > _Op;
+ return __val_expr<_Op>(_Op(divides<value_type>(), __x, __scalar_expr<value_type>(__y, __x.size())));
}
-template<class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
+template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
inline _LIBCPP_HIDE_FROM_ABI
-__val_expr<_BinaryOp<divides<typename _Expr::value_type>,
- __scalar_expr<typename _Expr::value_type>, _Expr> >
-operator/(const typename _Expr::value_type& __x, const _Expr& __y)
-{
- typedef typename _Expr::value_type value_type;
- typedef _BinaryOp<divides<value_type>, __scalar_expr<value_type>, _Expr> _Op;
- return __val_expr<_Op>(_Op(divides<value_type>(),
- __scalar_expr<value_type>(__x, __y.size()), __y));
+ __val_expr<_BinaryOp<divides<typename _Expr::value_type>, __scalar_expr<typename _Expr::value_type>, _Expr> >
+ operator/(const typename _Expr::value_type& __x, const _Expr& __y) {
+ typedef typename _Expr::value_type value_type;
+ typedef _BinaryOp<divides<value_type>, __scalar_expr<value_type>, _Expr> _Op;
+ return __val_expr<_Op>(_Op(divides<value_type>(), __scalar_expr<value_type>(__x, __y.size()), __y));
}
-template<class _Expr1, class _Expr2, __enable_if_t<__is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value, int> = 0>
-inline _LIBCPP_HIDE_FROM_ABI
-__val_expr<_BinaryOp<modulus<typename _Expr1::value_type>, _Expr1, _Expr2> >
-operator%(const _Expr1& __x, const _Expr2& __y)
-{
- typedef typename _Expr1::value_type value_type;
- typedef _BinaryOp<modulus<value_type>, _Expr1, _Expr2> _Op;
- return __val_expr<_Op>(_Op(modulus<value_type>(), __x, __y));
+template <class _Expr1,
+ class _Expr2,
+ __enable_if_t<__is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value, int> = 0>
+inline _LIBCPP_HIDE_FROM_ABI __val_expr<_BinaryOp<modulus<typename _Expr1::value_type>, _Expr1, _Expr2> >
+operator%(const _Expr1& __x, const _Expr2& __y) {
+ typedef typename _Expr1::value_type value_type;
+ typedef _BinaryOp<modulus<value_type>, _Expr1, _Expr2> _Op;
+ return __val_expr<_Op>(_Op(modulus<value_type>(), __x, __y));
}
-template<class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
+template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
inline _LIBCPP_HIDE_FROM_ABI
-__val_expr<_BinaryOp<modulus<typename _Expr::value_type>,
- _Expr, __scalar_expr<typename _Expr::value_type> > >
-operator%(const _Expr& __x, const typename _Expr::value_type& __y)
-{
- typedef typename _Expr::value_type value_type;
- typedef _BinaryOp<modulus<value_type>, _Expr, __scalar_expr<value_type> > _Op;
- return __val_expr<_Op>(_Op(modulus<value_type>(),
- __x, __scalar_expr<value_type>(__y, __x.size())));
+ __val_expr<_BinaryOp<modulus<typename _Expr::value_type>, _Expr, __scalar_expr<typename _Expr::value_type> > >
+ operator%(const _Expr& __x, const typename _Expr::value_type& __y) {
+ typedef typename _Expr::value_type value_type;
+ typedef _BinaryOp<modulus<value_type>, _Expr, __scalar_expr<value_type> > _Op;
+ return __val_expr<_Op>(_Op(modulus<value_type>(), __x, __scalar_expr<value_type>(__y, __x.size())));
}
-template<class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
+template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
inline _LIBCPP_HIDE_FROM_ABI
-__val_expr<_BinaryOp<modulus<typename _Expr::value_type>,
- __scalar_expr<typename _Expr::value_type>, _Expr> >
-operator%(const typename _Expr::value_type& __x, const _Expr& __y)
-{
- typedef typename _Expr::value_type value_type;
- typedef _BinaryOp<modulus<value_type>, __scalar_expr<value_type>, _Expr> _Op;
- return __val_expr<_Op>(_Op(modulus<value_type>(),
- __scalar_expr<value_type>(__x, __y.size()), __y));
+ __val_expr<_BinaryOp<modulus<typename _Expr::value_type>, __scalar_expr<typename _Expr::value_type>, _Expr> >
+ operator%(const typename _Expr::value_type& __x, const _Expr& __y) {
+ typedef typename _Expr::value_type value_type;
+ typedef _BinaryOp<modulus<value_type>, __scalar_expr<value_type>, _Expr> _Op;
+ return __val_expr<_Op>(_Op(modulus<value_type>(), __scalar_expr<value_type>(__x, __y.size()), __y));
}
-template<class _Expr1, class _Expr2, __enable_if_t<__is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value, int> = 0>
-inline _LIBCPP_HIDE_FROM_ABI
-__val_expr<_BinaryOp<plus<typename _Expr1::value_type>, _Expr1, _Expr2> >
-operator+(const _Expr1& __x, const _Expr2& __y)
-{
- typedef typename _Expr1::value_type value_type;
- typedef _BinaryOp<plus<value_type>, _Expr1, _Expr2> _Op;
- return __val_expr<_Op>(_Op(plus<value_type>(), __x, __y));
+template <class _Expr1,
+ class _Expr2,
+ __enable_if_t<__is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value, int> = 0>
+inline _LIBCPP_HIDE_FROM_ABI __val_expr<_BinaryOp<plus<typename _Expr1::value_type>, _Expr1, _Expr2> >
+operator+(const _Expr1& __x, const _Expr2& __y) {
+ typedef typename _Expr1::value_type value_type;
+ typedef _BinaryOp<plus<value_type>, _Expr1, _Expr2> _Op;
+ return __val_expr<_Op>(_Op(plus<value_type>(), __x, __y));
}
-template<class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
+template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
inline _LIBCPP_HIDE_FROM_ABI
-__val_expr<_BinaryOp<plus<typename _Expr::value_type>,
- _Expr, __scalar_expr<typename _Expr::value_type> > >
-operator+(const _Expr& __x, const typename _Expr::value_type& __y)
-{
- typedef typename _Expr::value_type value_type;
- typedef _BinaryOp<plus<value_type>, _Expr, __scalar_expr<value_type> > _Op;
- return __val_expr<_Op>(_Op(plus<value_type>(),
- __x, __scalar_expr<value_type>(__y, __x.size())));
+ __val_expr<_BinaryOp<plus<typename _Expr::value_type>, _Expr, __scalar_expr<typename _Expr::value_type> > >
+ operator+(const _Expr& __x, const typename _Expr::value_type& __y) {
+ typedef typename _Expr::value_type value_type;
+ typedef _BinaryOp<plus<value_type>, _Expr, __scalar_expr<value_type> > _Op;
+ return __val_expr<_Op>(_Op(plus<value_type>(), __x, __scalar_expr<value_type>(__y, __x.size())));
}
-template<class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
+template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
inline _LIBCPP_HIDE_FROM_ABI
-__val_expr<_BinaryOp<plus<typename _Expr::value_type>,
- __scalar_expr<typename _Expr::value_type>, _Expr> >
-operator+(const typename _Expr::value_type& __x, const _Expr& __y)
-{
- typedef typename _Expr::value_type value_type;
- typedef _BinaryOp<plus<value_type>, __scalar_expr<value_type>, _Expr> _Op;
- return __val_expr<_Op>(_Op(plus<value_type>(),
- __scalar_expr<value_type>(__x, __y.size()), __y));
+ __val_expr<_BinaryOp<plus<typename _Expr::value_type>, __scalar_expr<typename _Expr::value_type>, _Expr> >
+ operator+(const typename _Expr::value_type& __x, const _Expr& __y) {
+ typedef typename _Expr::value_type value_type;
+ typedef _BinaryOp<plus<value_type>, __scalar_expr<value_type>, _Expr> _Op;
+ return __val_expr<_Op>(_Op(plus<value_type>(), __scalar_expr<value_type>(__x, __y.size()), __y));
}
-template<class _Expr1, class _Expr2, __enable_if_t<__is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value, int> = 0>
-inline _LIBCPP_HIDE_FROM_ABI
-__val_expr<_BinaryOp<minus<typename _Expr1::value_type>, _Expr1, _Expr2> >
-operator-(const _Expr1& __x, const _Expr2& __y)
-{
- typedef typename _Expr1::value_type value_type;
- typedef _BinaryOp<minus<value_type>, _Expr1, _Expr2> _Op;
- return __val_expr<_Op>(_Op(minus<value_type>(), __x, __y));
+template <class _Expr1,
+ class _Expr2,
+ __enable_if_t<__is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value, int> = 0>
+inline _LIBCPP_HIDE_FROM_ABI __val_expr<_BinaryOp<minus<typename _Expr1::value_type>, _Expr1, _Expr2> >
+operator-(const _Expr1& __x, const _Expr2& __y) {
+ typedef typename _Expr1::value_type value_type;
+ typedef _BinaryOp<minus<value_type>, _Expr1, _Expr2> _Op;
+ return __val_expr<_Op>(_Op(minus<value_type>(), __x, __y));
}
-template<class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
+template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
inline _LIBCPP_HIDE_FROM_ABI
-__val_expr<_BinaryOp<minus<typename _Expr::value_type>,
- _Expr, __scalar_expr<typename _Expr::value_type> > >
-operator-(const _Expr& __x, const typename _Expr::value_type& __y)
-{
- typedef typename _Expr::value_type value_type;
- typedef _BinaryOp<minus<value_type>, _Expr, __scalar_expr<value_type> > _Op;
- return __val_expr<_Op>(_Op(minus<value_type>(),
- __x, __scalar_expr<value_type>(__y, __x.size())));
+ __val_expr<_BinaryOp<minus<typename _Expr::value_type>, _Expr, __scalar_expr<typename _Expr::value_type> > >
+ operator-(const _Expr& __x, const typename _Expr::value_type& __y) {
+ typedef typename _Expr::value_type value_type;
+ typedef _BinaryOp<minus<value_type>, _Expr, __scalar_expr<value_type> > _Op;
+ return __val_expr<_Op>(_Op(minus<value_type>(), __x, __scalar_expr<value_type>(__y, __x.size())));
}
-template<class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
+template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
inline _LIBCPP_HIDE_FROM_ABI
-__val_expr<_BinaryOp<minus<typename _Expr::value_type>,
- __scalar_expr<typename _Expr::value_type>, _Expr> >
-operator-(const typename _Expr::value_type& __x, const _Expr& __y)
-{
- typedef typename _Expr::value_type value_type;
- typedef _BinaryOp<minus<value_type>, __scalar_expr<value_type>, _Expr> _Op;
- return __val_expr<_Op>(_Op(minus<value_type>(),
- __scalar_expr<value_type>(__x, __y.size()), __y));
+ __val_expr<_BinaryOp<minus<typename _Expr::value_type>, __scalar_expr<typename _Expr::value_type>, _Expr> >
+ operator-(const typename _Expr::value_type& __x, const _Expr& __y) {
+ typedef typename _Expr::value_type value_type;
+ typedef _BinaryOp<minus<value_type>, __scalar_expr<value_type>, _Expr> _Op;
+ return __val_expr<_Op>(_Op(minus<value_type>(), __scalar_expr<value_type>(__x, __y.size()), __y));
}
-template<class _Expr1, class _Expr2, __enable_if_t<__is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value, int> = 0>
-inline _LIBCPP_HIDE_FROM_ABI
-__val_expr<_BinaryOp<bit_xor<typename _Expr1::value_type>, _Expr1, _Expr2> >
-operator^(const _Expr1& __x, const _Expr2& __y)
-{
- typedef typename _Expr1::value_type value_type;
- typedef _BinaryOp<bit_xor<value_type>, _Expr1, _Expr2> _Op;
- return __val_expr<_Op>(_Op(bit_xor<value_type>(), __x, __y));
+template <class _Expr1,
+ class _Expr2,
+ __enable_if_t<__is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value, int> = 0>
+inline _LIBCPP_HIDE_FROM_ABI __val_expr<_BinaryOp<bit_xor<typename _Expr1::value_type>, _Expr1, _Expr2> >
+operator^(const _Expr1& __x, const _Expr2& __y) {
+ typedef typename _Expr1::value_type value_type;
+ typedef _BinaryOp<bit_xor<value_type>, _Expr1, _Expr2> _Op;
+ return __val_expr<_Op>(_Op(bit_xor<value_type>(), __x, __y));
}
-template<class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
+template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
inline _LIBCPP_HIDE_FROM_ABI
-__val_expr<_BinaryOp<bit_xor<typename _Expr::value_type>,
- _Expr, __scalar_expr<typename _Expr::value_type> > >
-operator^(const _Expr& __x, const typename _Expr::value_type& __y)
-{
- typedef typename _Expr::value_type value_type;
- typedef _BinaryOp<bit_xor<value_type>, _Expr, __scalar_expr<value_type> > _Op;
- return __val_expr<_Op>(_Op(bit_xor<value_type>(),
- __x, __scalar_expr<value_type>(__y, __x.size())));
+ __val_expr<_BinaryOp<bit_xor<typename _Expr::value_type>, _Expr, __scalar_expr<typename _Expr::value_type> > >
+ operator^(const _Expr& __x, const typename _Expr::value_type& __y) {
+ typedef typename _Expr::value_type value_type;
+ typedef _BinaryOp<bit_xor<value_type>, _Expr, __scalar_expr<value_type> > _Op;
+ return __val_expr<_Op>(_Op(bit_xor<value_type>(), __x, __scalar_expr<value_type>(__y, __x.size())));
}
-template<class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
+template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
inline _LIBCPP_HIDE_FROM_ABI
-__val_expr<_BinaryOp<bit_xor<typename _Expr::value_type>,
- __scalar_expr<typename _Expr::value_type>, _Expr> >
-operator^(const typename _Expr::value_type& __x, const _Expr& __y)
-{
- typedef typename _Expr::value_type value_type;
- typedef _BinaryOp<bit_xor<value_type>, __scalar_expr<value_type>, _Expr> _Op;
- return __val_expr<_Op>(_Op(bit_xor<value_type>(),
- __scalar_expr<value_type>(__x, __y.size()), __y));
+ __val_expr<_BinaryOp<bit_xor<typename _Expr::value_type>, __scalar_expr<typename _Expr::value_type>, _Expr> >
+ operator^(const typename _Expr::value_type& __x, const _Expr& __y) {
+ typedef typename _Expr::value_type value_type;
+ typedef _BinaryOp<bit_xor<value_type>, __scalar_expr<value_type>, _Expr> _Op;
+ return __val_expr<_Op>(_Op(bit_xor<value_type>(), __scalar_expr<value_type>(__x, __y.size()), __y));
}
-template<class _Expr1, class _Expr2, __enable_if_t<__is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value, int> = 0>
-inline _LIBCPP_HIDE_FROM_ABI
-__val_expr<_BinaryOp<bit_and<typename _Expr1::value_type>, _Expr1, _Expr2> >
-operator&(const _Expr1& __x, const _Expr2& __y)
-{
- typedef typename _Expr1::value_type value_type;
- typedef _BinaryOp<bit_and<value_type>, _Expr1, _Expr2> _Op;
- return __val_expr<_Op>(_Op(bit_and<value_type>(), __x, __y));
+template <class _Expr1,
+ class _Expr2,
+ __enable_if_t<__is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value, int> = 0>
+inline _LIBCPP_HIDE_FROM_ABI __val_expr<_BinaryOp<bit_and<typename _Expr1::value_type>, _Expr1, _Expr2> >
+operator&(const _Expr1& __x, const _Expr2& __y) {
+ typedef typename _Expr1::value_type value_type;
+ typedef _BinaryOp<bit_and<value_type>, _Expr1, _Expr2> _Op;
+ return __val_expr<_Op>(_Op(bit_and<value_type>(), __x, __y));
}
-template<class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
+template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
inline _LIBCPP_HIDE_FROM_ABI
-__val_expr<_BinaryOp<bit_and<typename _Expr::value_type>,
- _Expr, __scalar_expr<typename _Expr::value_type> > >
-operator&(const _Expr& __x, const typename _Expr::value_type& __y)
-{
- typedef typename _Expr::value_type value_type;
- typedef _BinaryOp<bit_and<value_type>, _Expr, __scalar_expr<value_type> > _Op;
- return __val_expr<_Op>(_Op(bit_and<value_type>(),
- __x, __scalar_expr<value_type>(__y, __x.size())));
+ __val_expr<_BinaryOp<bit_and<typename _Expr::value_type>, _Expr, __scalar_expr<typename _Expr::value_type> > >
+ operator&(const _Expr& __x, const typename _Expr::value_type& __y) {
+ typedef typename _Expr::value_type value_type;
+ typedef _BinaryOp<bit_and<value_type>, _Expr, __scalar_expr<value_type> > _Op;
+ return __val_expr<_Op>(_Op(bit_and<value_type>(), __x, __scalar_expr<value_type>(__y, __x.size())));
}
-template<class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
+template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
inline _LIBCPP_HIDE_FROM_ABI
-__val_expr<_BinaryOp<bit_and<typename _Expr::value_type>,
- __scalar_expr<typename _Expr::value_type>, _Expr> >
-operator&(const typename _Expr::value_type& __x, const _Expr& __y)
-{
- typedef typename _Expr::value_type value_type;
- typedef _BinaryOp<bit_and<value_type>, __scalar_expr<value_type>, _Expr> _Op;
- return __val_expr<_Op>(_Op(bit_and<value_type>(),
- __scalar_expr<value_type>(__x, __y.size()), __y));
+ __val_expr<_BinaryOp<bit_and<typename _Expr::value_type>, __scalar_expr<typename _Expr::value_type>, _Expr> >
+ operator&(const typename _Expr::value_type& __x, const _Expr& __y) {
+ typedef typename _Expr::value_type value_type;
+ typedef _BinaryOp<bit_and<value_type>, __scalar_expr<value_type>, _Expr> _Op;
+ return __val_expr<_Op>(_Op(bit_and<value_type>(), __scalar_expr<value_type>(__x, __y.size()), __y));
}
-template<class _Expr1, class _Expr2, __enable_if_t<__is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value, int> = 0>
-inline _LIBCPP_HIDE_FROM_ABI
-__val_expr<_BinaryOp<bit_or<typename _Expr1::value_type>, _Expr1, _Expr2> >
-operator|(const _Expr1& __x, const _Expr2& __y)
-{
- typedef typename _Expr1::value_type value_type;
- typedef _BinaryOp<bit_or<value_type>, _Expr1, _Expr2> _Op;
- return __val_expr<_Op>(_Op(bit_or<value_type>(), __x, __y));
+template <class _Expr1,
+ class _Expr2,
+ __enable_if_t<__is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value, int> = 0>
+inline _LIBCPP_HIDE_FROM_ABI __val_expr<_BinaryOp<bit_or<typename _Expr1::value_type>, _Expr1, _Expr2> >
+operator|(const _Expr1& __x, const _Expr2& __y) {
+ typedef typename _Expr1::value_type value_type;
+ typedef _BinaryOp<bit_or<value_type>, _Expr1, _Expr2> _Op;
+ return __val_expr<_Op>(_Op(bit_or<value_type>(), __x, __y));
}
-template<class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
+template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
inline _LIBCPP_HIDE_FROM_ABI
-__val_expr<_BinaryOp<bit_or<typename _Expr::value_type>,
- _Expr, __scalar_expr<typename _Expr::value_type> > >
-operator|(const _Expr& __x, const typename _Expr::value_type& __y)
-{
- typedef typename _Expr::value_type value_type;
- typedef _BinaryOp<bit_or<value_type>, _Expr, __scalar_expr<value_type> > _Op;
- return __val_expr<_Op>(_Op(bit_or<value_type>(),
- __x, __scalar_expr<value_type>(__y, __x.size())));
+ __val_expr<_BinaryOp<bit_or<typename _Expr::value_type>, _Expr, __scalar_expr<typename _Expr::value_type> > >
+ operator|(const _Expr& __x, const typename _Expr::value_type& __y) {
+ typedef typename _Expr::value_type value_type;
+ typedef _BinaryOp<bit_or<value_type>, _Expr, __scalar_expr<value_type> > _Op;
+ return __val_expr<_Op>(_Op(bit_or<value_type>(), __x, __scalar_expr<value_type>(__y, __x.size())));
}
-template<class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
+template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
inline _LIBCPP_HIDE_FROM_ABI
-__val_expr<_BinaryOp<bit_or<typename _Expr::value_type>,
- __scalar_expr<typename _Expr::value_type>, _Expr> >
-operator|(const typename _Expr::value_type& __x, const _Expr& __y)
-{
- typedef typename _Expr::value_type value_type;
- typedef _BinaryOp<bit_or<value_type>, __scalar_expr<value_type>, _Expr> _Op;
- return __val_expr<_Op>(_Op(bit_or<value_type>(),
- __scalar_expr<value_type>(__x, __y.size()), __y));
+ __val_expr<_BinaryOp<bit_or<typename _Expr::value_type>, __scalar_expr<typename _Expr::value_type>, _Expr> >
+ operator|(const typename _Expr::value_type& __x, const _Expr& __y) {
+ typedef typename _Expr::value_type value_type;
+ typedef _BinaryOp<bit_or<value_type>, __scalar_expr<value_type>, _Expr> _Op;
+ return __val_expr<_Op>(_Op(bit_or<value_type>(), __scalar_expr<value_type>(__x, __y.size()), __y));
}
-template<class _Expr1, class _Expr2, __enable_if_t<__is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value, int> = 0>
-inline _LIBCPP_HIDE_FROM_ABI
-__val_expr<_BinaryOp<__bit_shift_left<typename _Expr1::value_type>, _Expr1, _Expr2> >
-operator<<(const _Expr1& __x, const _Expr2& __y)
-{
- typedef typename _Expr1::value_type value_type;
- typedef _BinaryOp<__bit_shift_left<value_type>, _Expr1, _Expr2> _Op;
- return __val_expr<_Op>(_Op(__bit_shift_left<value_type>(), __x, __y));
+template <class _Expr1,
+ class _Expr2,
+ __enable_if_t<__is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value, int> = 0>
+inline _LIBCPP_HIDE_FROM_ABI __val_expr<_BinaryOp<__bit_shift_left<typename _Expr1::value_type>, _Expr1, _Expr2> >
+operator<<(const _Expr1& __x, const _Expr2& __y) {
+ typedef typename _Expr1::value_type value_type;
+ typedef _BinaryOp<__bit_shift_left<value_type>, _Expr1, _Expr2> _Op;
+ return __val_expr<_Op>(_Op(__bit_shift_left<value_type>(), __x, __y));
}
-template<class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
-inline _LIBCPP_HIDE_FROM_ABI
-__val_expr<_BinaryOp<__bit_shift_left<typename _Expr::value_type>,
- _Expr, __scalar_expr<typename _Expr::value_type> > >
-operator<<(const _Expr& __x, const typename _Expr::value_type& __y)
-{
- typedef typename _Expr::value_type value_type;
- typedef _BinaryOp<__bit_shift_left<value_type>, _Expr, __scalar_expr<value_type> > _Op;
- return __val_expr<_Op>(_Op(__bit_shift_left<value_type>(),
- __x, __scalar_expr<value_type>(__y, __x.size())));
+template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
+inline _LIBCPP_HIDE_FROM_ABI __val_expr<
+ _BinaryOp<__bit_shift_left<typename _Expr::value_type>, _Expr, __scalar_expr<typename _Expr::value_type> > >
+operator<<(const _Expr& __x, const typename _Expr::value_type& __y) {
+ typedef typename _Expr::value_type value_type;
+ typedef _BinaryOp<__bit_shift_left<value_type>, _Expr, __scalar_expr<value_type> > _Op;
+ return __val_expr<_Op>(_Op(__bit_shift_left<value_type>(), __x, __scalar_expr<value_type>(__y, __x.size())));
}
-template<class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
-inline _LIBCPP_HIDE_FROM_ABI
-__val_expr<_BinaryOp<__bit_shift_left<typename _Expr::value_type>,
- __scalar_expr<typename _Expr::value_type>, _Expr> >
-operator<<(const typename _Expr::value_type& __x, const _Expr& __y)
-{
- typedef typename _Expr::value_type value_type;
- typedef _BinaryOp<__bit_shift_left<value_type>, __scalar_expr<value_type>, _Expr> _Op;
- return __val_expr<_Op>(_Op(__bit_shift_left<value_type>(),
- __scalar_expr<value_type>(__x, __y.size()), __y));
+template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
+inline _LIBCPP_HIDE_FROM_ABI __val_expr<
+ _BinaryOp<__bit_shift_left<typename _Expr::value_type>, __scalar_expr<typename _Expr::value_type>, _Expr> >
+operator<<(const typename _Expr::value_type& __x, const _Expr& __y) {
+ typedef typename _Expr::value_type value_type;
+ typedef _BinaryOp<__bit_shift_left<value_type>, __scalar_expr<value_type>, _Expr> _Op;
+ return __val_expr<_Op>(_Op(__bit_shift_left<value_type>(), __scalar_expr<value_type>(__x, __y.size()), __y));
}
-template<class _Expr1, class _Expr2, __enable_if_t<__is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value, int> = 0>
-inline _LIBCPP_HIDE_FROM_ABI
-__val_expr<_BinaryOp<__bit_shift_right<typename _Expr1::value_type>, _Expr1, _Expr2> >
-operator>>(const _Expr1& __x, const _Expr2& __y)
-{
- typedef typename _Expr1::value_type value_type;
- typedef _BinaryOp<__bit_shift_right<value_type>, _Expr1, _Expr2> _Op;
- return __val_expr<_Op>(_Op(__bit_shift_right<value_type>(), __x, __y));
+template <class _Expr1,
+ class _Expr2,
+ __enable_if_t<__is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value, int> = 0>
+inline _LIBCPP_HIDE_FROM_ABI __val_expr<_BinaryOp<__bit_shift_right<typename _Expr1::value_type>, _Expr1, _Expr2> >
+operator>>(const _Expr1& __x, const _Expr2& __y) {
+ typedef typename _Expr1::value_type value_type;
+ typedef _BinaryOp<__bit_shift_right<value_type>, _Expr1, _Expr2> _Op;
+ return __val_expr<_Op>(_Op(__bit_shift_right<value_type>(), __x, __y));
}
-template<class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
-inline _LIBCPP_HIDE_FROM_ABI
-__val_expr<_BinaryOp<__bit_shift_right<typename _Expr::value_type>,
- _Expr, __scalar_expr<typename _Expr::value_type> > >
-operator>>(const _Expr& __x, const typename _Expr::value_type& __y)
-{
- typedef typename _Expr::value_type value_type;
- typedef _BinaryOp<__bit_shift_right<value_type>, _Expr, __scalar_expr<value_type> > _Op;
- return __val_expr<_Op>(_Op(__bit_shift_right<value_type>(),
- __x, __scalar_expr<value_type>(__y, __x.size())));
+template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
+inline _LIBCPP_HIDE_FROM_ABI __val_expr<
+ _BinaryOp<__bit_shift_right<typename _Expr::value_type>, _Expr, __scalar_expr<typename _Expr::value_type> > >
+operator>>(const _Expr& __x, const typename _Expr::value_type& __y) {
+ typedef typename _Expr::value_type value_type;
+ typedef _BinaryOp<__bit_shift_right<value_type>, _Expr, __scalar_expr<value_type> > _Op;
+ return __val_expr<_Op>(_Op(__bit_shift_right<value_type>(), __x, __scalar_expr<value_type>(__y, __x.size())));
}
-template<class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
-inline _LIBCPP_HIDE_FROM_ABI
-__val_expr<_BinaryOp<__bit_shift_right<typename _Expr::value_type>,
- __scalar_expr<typename _Expr::value_type>, _Expr> >
-operator>>(const typename _Expr::value_type& __x, const _Expr& __y)
-{
- typedef typename _Expr::value_type value_type;
- typedef _BinaryOp<__bit_shift_right<value_type>, __scalar_expr<value_type>, _Expr> _Op;
- return __val_expr<_Op>(_Op(__bit_shift_right<value_type>(),
- __scalar_expr<value_type>(__x, __y.size()), __y));
+template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
+inline _LIBCPP_HIDE_FROM_ABI __val_expr<
+ _BinaryOp<__bit_shift_right<typename _Expr::value_type>, __scalar_expr<typename _Expr::value_type>, _Expr> >
+operator>>(const typename _Expr::value_type& __x, const _Expr& __y) {
+ typedef typename _Expr::value_type value_type;
+ typedef _BinaryOp<__bit_shift_right<value_type>, __scalar_expr<value_type>, _Expr> _Op;
+ return __val_expr<_Op>(_Op(__bit_shift_right<value_type>(), __scalar_expr<value_type>(__x, __y.size()), __y));
}
-template<class _Expr1, class _Expr2, __enable_if_t<__is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value, int> = 0>
-inline _LIBCPP_HIDE_FROM_ABI
-__val_expr<_BinaryOp<logical_and<typename _Expr1::value_type>, _Expr1, _Expr2> >
-operator&&(const _Expr1& __x, const _Expr2& __y)
-{
- typedef typename _Expr1::value_type value_type;
- typedef _BinaryOp<logical_and<value_type>, _Expr1, _Expr2> _Op;
- return __val_expr<_Op>(_Op(logical_and<value_type>(), __x, __y));
+template <class _Expr1,
+ class _Expr2,
+ __enable_if_t<__is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value, int> = 0>
+inline _LIBCPP_HIDE_FROM_ABI __val_expr<_BinaryOp<logical_and<typename _Expr1::value_type>, _Expr1, _Expr2> >
+operator&&(const _Expr1& __x, const _Expr2& __y) {
+ typedef typename _Expr1::value_type value_type;
+ typedef _BinaryOp<logical_and<value_type>, _Expr1, _Expr2> _Op;
+ return __val_expr<_Op>(_Op(logical_and<value_type>(), __x, __y));
}
-template<class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
+template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
inline _LIBCPP_HIDE_FROM_ABI
-__val_expr<_BinaryOp<logical_and<typename _Expr::value_type>,
- _Expr, __scalar_expr<typename _Expr::value_type> > >
-operator&&(const _Expr& __x, const typename _Expr::value_type& __y)
-{
- typedef typename _Expr::value_type value_type;
- typedef _BinaryOp<logical_and<value_type>, _Expr, __scalar_expr<value_type> > _Op;
- return __val_expr<_Op>(_Op(logical_and<value_type>(),
- __x, __scalar_expr<value_type>(__y, __x.size())));
+ __val_expr<_BinaryOp<logical_and<typename _Expr::value_type>, _Expr, __scalar_expr<typename _Expr::value_type> > >
+ operator&&(const _Expr& __x, const typename _Expr::value_type& __y) {
+ typedef typename _Expr::value_type value_type;
+ typedef _BinaryOp<logical_and<value_type>, _Expr, __scalar_expr<value_type> > _Op;
+ return __val_expr<_Op>(_Op(logical_and<value_type>(), __x, __scalar_expr<value_type>(__y, __x.size())));
}
-template<class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
+template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
inline _LIBCPP_HIDE_FROM_ABI
-__val_expr<_BinaryOp<logical_and<typename _Expr::value_type>,
- __scalar_expr<typename _Expr::value_type>, _Expr> >
-operator&&(const typename _Expr::value_type& __x, const _Expr& __y)
-{
- typedef typename _Expr::value_type value_type;
- typedef _BinaryOp<logical_and<value_type>, __scalar_expr<value_type>, _Expr> _Op;
- return __val_expr<_Op>(_Op(logical_and<value_type>(),
- __scalar_expr<value_type>(__x, __y.size()), __y));
+ __val_expr<_BinaryOp<logical_and<typename _Expr::value_type>, __scalar_expr<typename _Expr::value_type>, _Expr> >
+ operator&&(const typename _Expr::value_type& __x, const _Expr& __y) {
+ typedef typename _Expr::value_type value_type;
+ typedef _BinaryOp<logical_and<value_type>, __scalar_expr<value_type>, _Expr> _Op;
+ return __val_expr<_Op>(_Op(logical_and<value_type>(), __scalar_expr<value_type>(__x, __y.size()), __y));
}
-template<class _Expr1, class _Expr2, __enable_if_t<__is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value, int> = 0>
-inline _LIBCPP_HIDE_FROM_ABI
-__val_expr<_BinaryOp<logical_or<typename _Expr1::value_type>, _Expr1, _Expr2> >
-operator||(const _Expr1& __x, const _Expr2& __y)
-{
- typedef typename _Expr1::value_type value_type;
- typedef _BinaryOp<logical_or<value_type>, _Expr1, _Expr2> _Op;
- return __val_expr<_Op>(_Op(logical_or<value_type>(), __x, __y));
+template <class _Expr1,
+ class _Expr2,
+ __enable_if_t<__is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value, int> = 0>
+inline _LIBCPP_HIDE_FROM_ABI __val_expr<_BinaryOp<logical_or<typename _Expr1::value_type>, _Expr1, _Expr2> >
+operator||(const _Expr1& __x, const _Expr2& __y) {
+ typedef typename _Expr1::value_type value_type;
+ typedef _BinaryOp<logical_or<value_type>, _Expr1, _Expr2> _Op;
+ return __val_expr<_Op>(_Op(logical_or<value_type>(), __x, __y));
}
-template<class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
+template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
inline _LIBCPP_HIDE_FROM_ABI
-__val_expr<_BinaryOp<logical_or<typename _Expr::value_type>,
- _Expr, __scalar_expr<typename _Expr::value_type> > >
-operator||(const _Expr& __x, const typename _Expr::value_type& __y)
-{
- typedef typename _Expr::value_type value_type;
- typedef _BinaryOp<logical_or<value_type>, _Expr, __scalar_expr<value_type> > _Op;
- return __val_expr<_Op>(_Op(logical_or<value_type>(),
- __x, __scalar_expr<value_type>(__y, __x.size())));
+ __val_expr<_BinaryOp<logical_or<typename _Expr::value_type>, _Expr, __scalar_expr<typename _Expr::value_type> > >
+ operator||(const _Expr& __x, const typename _Expr::value_type& __y) {
+ typedef typename _Expr::value_type value_type;
+ typedef _BinaryOp<logical_or<value_type>, _Expr, __scalar_expr<value_type> > _Op;
+ return __val_expr<_Op>(_Op(logical_or<value_type>(), __x, __scalar_expr<value_type>(__y, __x.size())));
}
-template<class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
+template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
inline _LIBCPP_HIDE_FROM_ABI
-__val_expr<_BinaryOp<logical_or<typename _Expr::value_type>,
- __scalar_expr<typename _Expr::value_type>, _Expr> >
-operator||(const typename _Expr::value_type& __x, const _Expr& __y)
-{
- typedef typename _Expr::value_type value_type;
- typedef _BinaryOp<logical_or<value_type>, __scalar_expr<value_type>, _Expr> _Op;
- return __val_expr<_Op>(_Op(logical_or<value_type>(),
- __scalar_expr<value_type>(__x, __y.size()), __y));
+ __val_expr<_BinaryOp<logical_or<typename _Expr::value_type>, __scalar_expr<typename _Expr::value_type>, _Expr> >
+ operator||(const typename _Expr::value_type& __x, const _Expr& __y) {
+ typedef typename _Expr::value_type value_type;
+ typedef _BinaryOp<logical_or<value_type>, __scalar_expr<value_type>, _Expr> _Op;
+ return __val_expr<_Op>(_Op(logical_or<value_type>(), __scalar_expr<value_type>(__x, __y.size()), __y));
}
-template<class _Expr1, class _Expr2, __enable_if_t<__is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value, int> = 0>
-inline _LIBCPP_HIDE_FROM_ABI
-__val_expr<_BinaryOp<equal_to<typename _Expr1::value_type>, _Expr1, _Expr2> >
-operator==(const _Expr1& __x, const _Expr2& __y)
-{
- typedef typename _Expr1::value_type value_type;
- typedef _BinaryOp<equal_to<value_type>, _Expr1, _Expr2> _Op;
- return __val_expr<_Op>(_Op(equal_to<value_type>(), __x, __y));
+template <class _Expr1,
+ class _Expr2,
+ __enable_if_t<__is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value, int> = 0>
+inline _LIBCPP_HIDE_FROM_ABI __val_expr<_BinaryOp<equal_to<typename _Expr1::value_type>, _Expr1, _Expr2> >
+operator==(const _Expr1& __x, const _Expr2& __y) {
+ typedef typename _Expr1::value_type value_type;
+ typedef _BinaryOp<equal_to<value_type>, _Expr1, _Expr2> _Op;
+ return __val_expr<_Op>(_Op(equal_to<value_type>(), __x, __y));
}
-template<class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
+template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
inline _LIBCPP_HIDE_FROM_ABI
-__val_expr<_BinaryOp<equal_to<typename _Expr::value_type>,
- _Expr, __scalar_expr<typename _Expr::value_type> > >
-operator==(const _Expr& __x, const typename _Expr::value_type& __y)
-{
- typedef typename _Expr::value_type value_type;
- typedef _BinaryOp<equal_to<value_type>, _Expr, __scalar_expr<value_type> > _Op;
- return __val_expr<_Op>(_Op(equal_to<value_type>(),
- __x, __scalar_expr<value_type>(__y, __x.size())));
+ __val_expr<_BinaryOp<equal_to<typename _Expr::value_type>, _Expr, __scalar_expr<typename _Expr::value_type> > >
+ operator==(const _Expr& __x, const typename _Expr::value_type& __y) {
+ typedef typename _Expr::value_type value_type;
+ typedef _BinaryOp<equal_to<value_type>, _Expr, __scalar_expr<value_type> > _Op;
+ return __val_expr<_Op>(_Op(equal_to<value_type>(), __x, __scalar_expr<value_type>(__y, __x.size())));
}
-template<class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
+template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
inline _LIBCPP_HIDE_FROM_ABI
-__val_expr<_BinaryOp<equal_to<typename _Expr::value_type>,
- __scalar_expr<typename _Expr::value_type>, _Expr> >
-operator==(const typename _Expr::value_type& __x, const _Expr& __y)
-{
- typedef typename _Expr::value_type value_type;
- typedef _BinaryOp<equal_to<value_type>, __scalar_expr<value_type>, _Expr> _Op;
- return __val_expr<_Op>(_Op(equal_to<value_type>(),
- __scalar_expr<value_type>(__x, __y.size()), __y));
+ __val_expr<_BinaryOp<equal_to<typename _Expr::value_type>, __scalar_expr<typename _Expr::value_type>, _Expr> >
+ operator==(const typename _Expr::value_type& __x, const _Expr& __y) {
+ typedef typename _Expr::value_type value_type;
+ typedef _BinaryOp<equal_to<value_type>, __scalar_expr<value_type>, _Expr> _Op;
+ return __val_expr<_Op>(_Op(equal_to<value_type>(), __scalar_expr<value_type>(__x, __y.size()), __y));
}
-template<class _Expr1, class _Expr2, __enable_if_t<__is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value, int> = 0>
-inline _LIBCPP_HIDE_FROM_ABI
-__val_expr<_BinaryOp<not_equal_to<typename _Expr1::value_type>, _Expr1, _Expr2> >
-operator!=(const _Expr1& __x, const _Expr2& __y)
-{
- typedef typename _Expr1::value_type value_type;
- typedef _BinaryOp<not_equal_to<value_type>, _Expr1, _Expr2> _Op;
- return __val_expr<_Op>(_Op(not_equal_to<value_type>(), __x, __y));
+template <class _Expr1,
+ class _Expr2,
+ __enable_if_t<__is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value, int> = 0>
+inline _LIBCPP_HIDE_FROM_ABI __val_expr<_BinaryOp<not_equal_to<typename _Expr1::value_type>, _Expr1, _Expr2> >
+operator!=(const _Expr1& __x, const _Expr2& __y) {
+ typedef typename _Expr1::value_type value_type;
+ typedef _BinaryOp<not_equal_to<value_type>, _Expr1, _Expr2> _Op;
+ return __val_expr<_Op>(_Op(not_equal_to<value_type>(), __x, __y));
}
-template<class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
+template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
inline _LIBCPP_HIDE_FROM_ABI
-__val_expr<_BinaryOp<not_equal_to<typename _Expr::value_type>,
- _Expr, __scalar_expr<typename _Expr::value_type> > >
-operator!=(const _Expr& __x, const typename _Expr::value_type& __y)
-{
- typedef typename _Expr::value_type value_type;
- typedef _BinaryOp<not_equal_to<value_type>, _Expr, __scalar_expr<value_type> > _Op;
- return __val_expr<_Op>(_Op(not_equal_to<value_type>(),
- __x, __scalar_expr<value_type>(__y, __x.size())));
+ __val_expr<_BinaryOp<not_equal_to<typename _Expr::value_type>, _Expr, __scalar_expr<typename _Expr::value_type> > >
+ operator!=(const _Expr& __x, const typename _Expr::value_type& __y) {
+ typedef typename _Expr::value_type value_type;
+ typedef _BinaryOp<not_equal_to<value_type>, _Expr, __scalar_expr<value_type> > _Op;
+ return __val_expr<_Op>(_Op(not_equal_to<value_type>(), __x, __scalar_expr<value_type>(__y, __x.size())));
}
-template<class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
+template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
inline _LIBCPP_HIDE_FROM_ABI
-__val_expr<_BinaryOp<not_equal_to<typename _Expr::value_type>,
- __scalar_expr<typename _Expr::value_type>, _Expr> >
-operator!=(const typename _Expr::value_type& __x, const _Expr& __y)
-{
- typedef typename _Expr::value_type value_type;
- typedef _BinaryOp<not_equal_to<value_type>, __scalar_expr<value_type>, _Expr> _Op;
- return __val_expr<_Op>(_Op(not_equal_to<value_type>(),
- __scalar_expr<value_type>(__x, __y.size()), __y));
+ __val_expr<_BinaryOp<not_equal_to<typename _Expr::value_type>, __scalar_expr<typename _Expr::value_type>, _Expr> >
+ operator!=(const typename _Expr::value_type& __x, const _Expr& __y) {
+ typedef typename _Expr::value_type value_type;
+ typedef _BinaryOp<not_equal_to<value_type>, __scalar_expr<value_type>, _Expr> _Op;
+ return __val_expr<_Op>(_Op(not_equal_to<value_type>(), __scalar_expr<value_type>(__x, __y.size()), __y));
}
-template<class _Expr1, class _Expr2, __enable_if_t<__is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value, int> = 0>
-inline _LIBCPP_HIDE_FROM_ABI
-__val_expr<_BinaryOp<less<typename _Expr1::value_type>, _Expr1, _Expr2> >
-operator<(const _Expr1& __x, const _Expr2& __y)
-{
- typedef typename _Expr1::value_type value_type;
- typedef _BinaryOp<less<value_type>, _Expr1, _Expr2> _Op;
- return __val_expr<_Op>(_Op(less<value_type>(), __x, __y));
+template <class _Expr1,
+ class _Expr2,
+ __enable_if_t<__is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value, int> = 0>
+inline _LIBCPP_HIDE_FROM_ABI __val_expr<_BinaryOp<less<typename _Expr1::value_type>, _Expr1, _Expr2> >
+operator<(const _Expr1& __x, const _Expr2& __y) {
+ typedef typename _Expr1::value_type value_type;
+ typedef _BinaryOp<less<value_type>, _Expr1, _Expr2> _Op;
+ return __val_expr<_Op>(_Op(less<value_type>(), __x, __y));
}
-template<class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
+template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
inline _LIBCPP_HIDE_FROM_ABI
-__val_expr<_BinaryOp<less<typename _Expr::value_type>,
- _Expr, __scalar_expr<typename _Expr::value_type> > >
-operator<(const _Expr& __x, const typename _Expr::value_type& __y)
-{
- typedef typename _Expr::value_type value_type;
- typedef _BinaryOp<less<value_type>, _Expr, __scalar_expr<value_type> > _Op;
- return __val_expr<_Op>(_Op(less<value_type>(),
- __x, __scalar_expr<value_type>(__y, __x.size())));
+ __val_expr<_BinaryOp<less<typename _Expr::value_type>, _Expr, __scalar_expr<typename _Expr::value_type> > >
+ operator<(const _Expr& __x, const typename _Expr::value_type& __y) {
+ typedef typename _Expr::value_type value_type;
+ typedef _BinaryOp<less<value_type>, _Expr, __scalar_expr<value_type> > _Op;
+ return __val_expr<_Op>(_Op(less<value_type>(), __x, __scalar_expr<value_type>(__y, __x.size())));
}
-template<class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
+template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
inline _LIBCPP_HIDE_FROM_ABI
-__val_expr<_BinaryOp<less<typename _Expr::value_type>,
- __scalar_expr<typename _Expr::value_type>, _Expr> >
-operator<(const typename _Expr::value_type& __x, const _Expr& __y)
-{
- typedef typename _Expr::value_type value_type;
- typedef _BinaryOp<less<value_type>, __scalar_expr<value_type>, _Expr> _Op;
- return __val_expr<_Op>(_Op(less<value_type>(),
- __scalar_expr<value_type>(__x, __y.size()), __y));
+ __val_expr<_BinaryOp<less<typename _Expr::value_type>, __scalar_expr<typename _Expr::value_type>, _Expr> >
+ operator<(const typename _Expr::value_type& __x, const _Expr& __y) {
+ typedef typename _Expr::value_type value_type;
+ typedef _BinaryOp<less<value_type>, __scalar_expr<value_type>, _Expr> _Op;
+ return __val_expr<_Op>(_Op(less<value_type>(), __scalar_expr<value_type>(__x, __y.size()), __y));
}
-template<class _Expr1, class _Expr2, __enable_if_t<__is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value, int> = 0>
-inline _LIBCPP_HIDE_FROM_ABI
-__val_expr<_BinaryOp<greater<typename _Expr1::value_type>, _Expr1, _Expr2> >
-operator>(const _Expr1& __x, const _Expr2& __y)
-{
- typedef typename _Expr1::value_type value_type;
- typedef _BinaryOp<greater<value_type>, _Expr1, _Expr2> _Op;
- return __val_expr<_Op>(_Op(greater<value_type>(), __x, __y));
+template <class _Expr1,
+ class _Expr2,
+ __enable_if_t<__is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value, int> = 0>
+inline _LIBCPP_HIDE_FROM_ABI __val_expr<_BinaryOp<greater<typename _Expr1::value_type>, _Expr1, _Expr2> >
+operator>(const _Expr1& __x, const _Expr2& __y) {
+ typedef typename _Expr1::value_type value_type;
+ typedef _BinaryOp<greater<value_type>, _Expr1, _Expr2> _Op;
+ return __val_expr<_Op>(_Op(greater<value_type>(), __x, __y));
}
-template<class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
+template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
inline _LIBCPP_HIDE_FROM_ABI
-__val_expr<_BinaryOp<greater<typename _Expr::value_type>,
- _Expr, __scalar_expr<typename _Expr::value_type> > >
-operator>(const _Expr& __x, const typename _Expr::value_type& __y)
-{
- typedef typename _Expr::value_type value_type;
- typedef _BinaryOp<greater<value_type>, _Expr, __scalar_expr<value_type> > _Op;
- return __val_expr<_Op>(_Op(greater<value_type>(),
- __x, __scalar_expr<value_type>(__y, __x.size())));
+ __val_expr<_BinaryOp<greater<typename _Expr::value_type>, _Expr, __scalar_expr<typename _Expr::value_type> > >
+ operator>(const _Expr& __x, const typename _Expr::value_type& __y) {
+ typedef typename _Expr::value_type value_type;
+ typedef _BinaryOp<greater<value_type>, _Expr, __scalar_expr<value_type> > _Op;
+ return __val_expr<_Op>(_Op(greater<value_type>(), __x, __scalar_expr<value_type>(__y, __x.size())));
}
-template<class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
+template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
inline _LIBCPP_HIDE_FROM_ABI
-__val_expr<_BinaryOp<greater<typename _Expr::value_type>,
- __scalar_expr<typename _Expr::value_type>, _Expr> >
-operator>(const typename _Expr::value_type& __x, const _Expr& __y)
-{
- typedef typename _Expr::value_type value_type;
- typedef _BinaryOp<greater<value_type>, __scalar_expr<value_type>, _Expr> _Op;
- return __val_expr<_Op>(_Op(greater<value_type>(),
- __scalar_expr<value_type>(__x, __y.size()), __y));
+ __val_expr<_BinaryOp<greater<typename _Expr::value_type>, __scalar_expr<typename _Expr::value_type>, _Expr> >
+ operator>(const typename _Expr::value_type& __x, const _Expr& __y) {
+ typedef typename _Expr::value_type value_type;
+ typedef _BinaryOp<greater<value_type>, __scalar_expr<value_type>, _Expr> _Op;
+ return __val_expr<_Op>(_Op(greater<value_type>(), __scalar_expr<value_type>(__x, __y.size()), __y));
}
-template<class _Expr1, class _Expr2, __enable_if_t<__is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value, int> = 0>
-inline _LIBCPP_HIDE_FROM_ABI
-__val_expr<_BinaryOp<less_equal<typename _Expr1::value_type>, _Expr1, _Expr2> >
-operator<=(const _Expr1& __x, const _Expr2& __y)
-{
- typedef typename _Expr1::value_type value_type;
- typedef _BinaryOp<less_equal<value_type>, _Expr1, _Expr2> _Op;
- return __val_expr<_Op>(_Op(less_equal<value_type>(), __x, __y));
+template <class _Expr1,
+ class _Expr2,
+ __enable_if_t<__is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value, int> = 0>
+inline _LIBCPP_HIDE_FROM_ABI __val_expr<_BinaryOp<less_equal<typename _Expr1::value_type>, _Expr1, _Expr2> >
+operator<=(const _Expr1& __x, const _Expr2& __y) {
+ typedef typename _Expr1::value_type value_type;
+ typedef _BinaryOp<less_equal<value_type>, _Expr1, _Expr2> _Op;
+ return __val_expr<_Op>(_Op(less_equal<value_type>(), __x, __y));
}
-template<class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
+template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
inline _LIBCPP_HIDE_FROM_ABI
-__val_expr<_BinaryOp<less_equal<typename _Expr::value_type>,
- _Expr, __scalar_expr<typename _Expr::value_type> > >
-operator<=(const _Expr& __x, const typename _Expr::value_type& __y)
-{
- typedef typename _Expr::value_type value_type;
- typedef _BinaryOp<less_equal<value_type>, _Expr, __scalar_expr<value_type> > _Op;
- return __val_expr<_Op>(_Op(less_equal<value_type>(),
- __x, __scalar_expr<value_type>(__y, __x.size())));
+ __val_expr<_BinaryOp<less_equal<typename _Expr::value_type>, _Expr, __scalar_expr<typename _Expr::value_type> > >
+ operator<=(const _Expr& __x, const typename _Expr::value_type& __y) {
+ typedef typename _Expr::value_type value_type;
+ typedef _BinaryOp<less_equal<value_type>, _Expr, __scalar_expr<value_type> > _Op;
+ return __val_expr<_Op>(_Op(less_equal<value_type>(), __x, __scalar_expr<value_type>(__y, __x.size())));
}
-template<class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
+template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
inline _LIBCPP_HIDE_FROM_ABI
-__val_expr<_BinaryOp<less_equal<typename _Expr::value_type>,
- __scalar_expr<typename _Expr::value_type>, _Expr> >
-operator<=(const typename _Expr::value_type& __x, const _Expr& __y)
-{
- typedef typename _Expr::value_type value_type;
- typedef _BinaryOp<less_equal<value_type>, __scalar_expr<value_type>, _Expr> _Op;
- return __val_expr<_Op>(_Op(less_equal<value_type>(),
- __scalar_expr<value_type>(__x, __y.size()), __y));
+ __val_expr<_BinaryOp<less_equal<typename _Expr::value_type>, __scalar_expr<typename _Expr::value_type>, _Expr> >
+ operator<=(const typename _Expr::value_type& __x, const _Expr& __y) {
+ typedef typename _Expr::value_type value_type;
+ typedef _BinaryOp<less_equal<value_type>, __scalar_expr<value_type>, _Expr> _Op;
+ return __val_expr<_Op>(_Op(less_equal<value_type>(), __scalar_expr<value_type>(__x, __y.size()), __y));
}
-template<class _Expr1, class _Expr2, __enable_if_t<__is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value, int> = 0>
-inline _LIBCPP_HIDE_FROM_ABI
-__val_expr<_BinaryOp<greater_equal<typename _Expr1::value_type>, _Expr1, _Expr2> >
-operator>=(const _Expr1& __x, const _Expr2& __y)
-{
- typedef typename _Expr1::value_type value_type;
- typedef _BinaryOp<greater_equal<value_type>, _Expr1, _Expr2> _Op;
- return __val_expr<_Op>(_Op(greater_equal<value_type>(), __x, __y));
+template <class _Expr1,
+ class _Expr2,
+ __enable_if_t<__is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value, int> = 0>
+inline _LIBCPP_HIDE_FROM_ABI __val_expr<_BinaryOp<greater_equal<typename _Expr1::value_type>, _Expr1, _Expr2> >
+operator>=(const _Expr1& __x, const _Expr2& __y) {
+ typedef typename _Expr1::value_type value_type;
+ typedef _BinaryOp<greater_equal<value_type>, _Expr1, _Expr2> _Op;
+ return __val_expr<_Op>(_Op(greater_equal<value_type>(), __x, __y));
}
-template<class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
+template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
inline _LIBCPP_HIDE_FROM_ABI
-__val_expr<_BinaryOp<greater_equal<typename _Expr::value_type>,
- _Expr, __scalar_expr<typename _Expr::value_type> > >
-operator>=(const _Expr& __x, const typename _Expr::value_type& __y)
-{
- typedef typename _Expr::value_type value_type;
- typedef _BinaryOp<greater_equal<value_type>, _Expr, __scalar_expr<value_type> > _Op;
- return __val_expr<_Op>(_Op(greater_equal<value_type>(),
- __x, __scalar_expr<value_type>(__y, __x.size())));
+ __val_expr<_BinaryOp<greater_equal<typename _Expr::value_type>, _Expr, __scalar_expr<typename _Expr::value_type> > >
+ operator>=(const _Expr& __x, const typename _Expr::value_type& __y) {
+ typedef typename _Expr::value_type value_type;
+ typedef _BinaryOp<greater_equal<value_type>, _Expr, __scalar_expr<value_type> > _Op;
+ return __val_expr<_Op>(_Op(greater_equal<value_type>(), __x, __scalar_expr<value_type>(__y, __x.size())));
}
-template<class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
+template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
inline _LIBCPP_HIDE_FROM_ABI
-__val_expr<_BinaryOp<greater_equal<typename _Expr::value_type>,
- __scalar_expr<typename _Expr::value_type>, _Expr> >
-operator>=(const typename _Expr::value_type& __x, const _Expr& __y)
-{
- typedef typename _Expr::value_type value_type;
- typedef _BinaryOp<greater_equal<value_type>, __scalar_expr<value_type>, _Expr> _Op;
- return __val_expr<_Op>(_Op(greater_equal<value_type>(),
- __scalar_expr<value_type>(__x, __y.size()), __y));
+ __val_expr<_BinaryOp<greater_equal<typename _Expr::value_type>, __scalar_expr<typename _Expr::value_type>, _Expr> >
+ operator>=(const typename _Expr::value_type& __x, const _Expr& __y) {
+ typedef typename _Expr::value_type value_type;
+ typedef _BinaryOp<greater_equal<value_type>, __scalar_expr<value_type>, _Expr> _Op;
+ return __val_expr<_Op>(_Op(greater_equal<value_type>(), __scalar_expr<value_type>(__x, __y.size()), __y));
}
-template<class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
-inline _LIBCPP_HIDE_FROM_ABI
-__val_expr<_UnaryOp<__abs_expr<typename _Expr::value_type>, _Expr> >
-abs(const _Expr& __x)
-{
- typedef typename _Expr::value_type value_type;
- typedef _UnaryOp<__abs_expr<value_type>, _Expr> _Op;
- return __val_expr<_Op>(_Op(__abs_expr<value_type>(), __x));
+template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
+inline _LIBCPP_HIDE_FROM_ABI __val_expr<_UnaryOp<__abs_expr<typename _Expr::value_type>, _Expr> >
+abs(const _Expr& __x) {
+ typedef typename _Expr::value_type value_type;
+ typedef _UnaryOp<__abs_expr<value_type>, _Expr> _Op;
+ return __val_expr<_Op>(_Op(__abs_expr<value_type>(), __x));
}
-template<class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
-inline _LIBCPP_HIDE_FROM_ABI
-__val_expr<_UnaryOp<__acos_expr<typename _Expr::value_type>, _Expr> >
-acos(const _Expr& __x)
-{
- typedef typename _Expr::value_type value_type;
- typedef _UnaryOp<__acos_expr<value_type>, _Expr> _Op;
- return __val_expr<_Op>(_Op(__acos_expr<value_type>(), __x));
+template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
+inline _LIBCPP_HIDE_FROM_ABI __val_expr<_UnaryOp<__acos_expr<typename _Expr::value_type>, _Expr> >
+acos(const _Expr& __x) {
+ typedef typename _Expr::value_type value_type;
+ typedef _UnaryOp<__acos_expr<value_type>, _Expr> _Op;
+ return __val_expr<_Op>(_Op(__acos_expr<value_type>(), __x));
}
-template<class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
-inline _LIBCPP_HIDE_FROM_ABI
-__val_expr<_UnaryOp<__asin_expr<typename _Expr::value_type>, _Expr> >
-asin(const _Expr& __x)
-{
- typedef typename _Expr::value_type value_type;
- typedef _UnaryOp<__asin_expr<value_type>, _Expr> _Op;
- return __val_expr<_Op>(_Op(__asin_expr<value_type>(), __x));
+template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
+inline _LIBCPP_HIDE_FROM_ABI __val_expr<_UnaryOp<__asin_expr<typename _Expr::value_type>, _Expr> >
+asin(const _Expr& __x) {
+ typedef typename _Expr::value_type value_type;
+ typedef _UnaryOp<__asin_expr<value_type>, _Expr> _Op;
+ return __val_expr<_Op>(_Op(__asin_expr<value_type>(), __x));
}
-template<class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
-inline _LIBCPP_HIDE_FROM_ABI
-__val_expr<_UnaryOp<__atan_expr<typename _Expr::value_type>, _Expr> >
-atan(const _Expr& __x)
-{
- typedef typename _Expr::value_type value_type;
- typedef _UnaryOp<__atan_expr<value_type>, _Expr> _Op;
- return __val_expr<_Op>(_Op(__atan_expr<value_type>(), __x));
+template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
+inline _LIBCPP_HIDE_FROM_ABI __val_expr<_UnaryOp<__atan_expr<typename _Expr::value_type>, _Expr> >
+atan(const _Expr& __x) {
+ typedef typename _Expr::value_type value_type;
+ typedef _UnaryOp<__atan_expr<value_type>, _Expr> _Op;
+ return __val_expr<_Op>(_Op(__atan_expr<value_type>(), __x));
}
-template<class _Expr1, class _Expr2, __enable_if_t<__is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value, int> = 0>
-inline _LIBCPP_HIDE_FROM_ABI
-__val_expr<_BinaryOp<__atan2_expr<typename _Expr1::value_type>, _Expr1, _Expr2> >
-atan2(const _Expr1& __x, const _Expr2& __y)
-{
- typedef typename _Expr1::value_type value_type;
- typedef _BinaryOp<__atan2_expr<value_type>, _Expr1, _Expr2> _Op;
- return __val_expr<_Op>(_Op(__atan2_expr<value_type>(), __x, __y));
+template <class _Expr1,
+ class _Expr2,
+ __enable_if_t<__is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value, int> = 0>
+inline _LIBCPP_HIDE_FROM_ABI __val_expr<_BinaryOp<__atan2_expr<typename _Expr1::value_type>, _Expr1, _Expr2> >
+atan2(const _Expr1& __x, const _Expr2& __y) {
+ typedef typename _Expr1::value_type value_type;
+ typedef _BinaryOp<__atan2_expr<value_type>, _Expr1, _Expr2> _Op;
+ return __val_expr<_Op>(_Op(__atan2_expr<value_type>(), __x, __y));
}
-template<class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
+template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
inline _LIBCPP_HIDE_FROM_ABI
- __val_expr<_BinaryOp<__atan2_expr<typename _Expr::value_type>,
- _Expr, __scalar_expr<typename _Expr::value_type> > >
-atan2(const _Expr& __x, const typename _Expr::value_type& __y)
-{
- typedef typename _Expr::value_type value_type;
- typedef _BinaryOp<__atan2_expr<value_type>, _Expr, __scalar_expr<value_type> > _Op;
- return __val_expr<_Op>(_Op(__atan2_expr<value_type>(),
- __x, __scalar_expr<value_type>(__y, __x.size())));
+ __val_expr<_BinaryOp<__atan2_expr<typename _Expr::value_type>, _Expr, __scalar_expr<typename _Expr::value_type> > >
+ atan2(const _Expr& __x, const typename _Expr::value_type& __y) {
+ typedef typename _Expr::value_type value_type;
+ typedef _BinaryOp<__atan2_expr<value_type>, _Expr, __scalar_expr<value_type> > _Op;
+ return __val_expr<_Op>(_Op(__atan2_expr<value_type>(), __x, __scalar_expr<value_type>(__y, __x.size())));
}
-template<class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
+template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
inline _LIBCPP_HIDE_FROM_ABI
- __val_expr<_BinaryOp<__atan2_expr<typename _Expr::value_type>,
- __scalar_expr<typename _Expr::value_type>, _Expr> >
-atan2(const typename _Expr::value_type& __x, const _Expr& __y)
-{
- typedef typename _Expr::value_type value_type;
- typedef _BinaryOp<__atan2_expr<value_type>, __scalar_expr<value_type>, _Expr> _Op;
- return __val_expr<_Op>(_Op(__atan2_expr<value_type>(),
- __scalar_expr<value_type>(__x, __y.size()), __y));
+ __val_expr<_BinaryOp<__atan2_expr<typename _Expr::value_type>, __scalar_expr<typename _Expr::value_type>, _Expr> >
+ atan2(const typename _Expr::value_type& __x, const _Expr& __y) {
+ typedef typename _Expr::value_type value_type;
+ typedef _BinaryOp<__atan2_expr<value_type>, __scalar_expr<value_type>, _Expr> _Op;
+ return __val_expr<_Op>(_Op(__atan2_expr<value_type>(), __scalar_expr<value_type>(__x, __y.size()), __y));
}
-template<class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
-inline _LIBCPP_HIDE_FROM_ABI
-__val_expr<_UnaryOp<__cos_expr<typename _Expr::value_type>, _Expr> >
-cos(const _Expr& __x)
-{
- typedef typename _Expr::value_type value_type;
- typedef _UnaryOp<__cos_expr<value_type>, _Expr> _Op;
- return __val_expr<_Op>(_Op(__cos_expr<value_type>(), __x));
+template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
+inline _LIBCPP_HIDE_FROM_ABI __val_expr<_UnaryOp<__cos_expr<typename _Expr::value_type>, _Expr> >
+cos(const _Expr& __x) {
+ typedef typename _Expr::value_type value_type;
+ typedef _UnaryOp<__cos_expr<value_type>, _Expr> _Op;
+ return __val_expr<_Op>(_Op(__cos_expr<value_type>(), __x));
}
-template<class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
-inline _LIBCPP_HIDE_FROM_ABI
-__val_expr<_UnaryOp<__cosh_expr<typename _Expr::value_type>, _Expr> >
-cosh(const _Expr& __x)
-{
- typedef typename _Expr::value_type value_type;
- typedef _UnaryOp<__cosh_expr<value_type>, _Expr> _Op;
- return __val_expr<_Op>(_Op(__cosh_expr<value_type>(), __x));
+template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
+inline _LIBCPP_HIDE_FROM_ABI __val_expr<_UnaryOp<__cosh_expr<typename _Expr::value_type>, _Expr> >
+cosh(const _Expr& __x) {
+ typedef typename _Expr::value_type value_type;
+ typedef _UnaryOp<__cosh_expr<value_type>, _Expr> _Op;
+ return __val_expr<_Op>(_Op(__cosh_expr<value_type>(), __x));
}
-template<class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
-inline _LIBCPP_HIDE_FROM_ABI
-__val_expr<_UnaryOp<__exp_expr<typename _Expr::value_type>, _Expr> >
-exp(const _Expr& __x)
-{
- typedef typename _Expr::value_type value_type;
- typedef _UnaryOp<__exp_expr<value_type>, _Expr> _Op;
- return __val_expr<_Op>(_Op(__exp_expr<value_type>(), __x));
+template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
+inline _LIBCPP_HIDE_FROM_ABI __val_expr<_UnaryOp<__exp_expr<typename _Expr::value_type>, _Expr> >
+exp(const _Expr& __x) {
+ typedef typename _Expr::value_type value_type;
+ typedef _UnaryOp<__exp_expr<value_type>, _Expr> _Op;
+ return __val_expr<_Op>(_Op(__exp_expr<value_type>(), __x));
}
-template<class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
-inline _LIBCPP_HIDE_FROM_ABI
-__val_expr<_UnaryOp<__log_expr<typename _Expr::value_type>, _Expr> >
-log(const _Expr& __x)
-{
- typedef typename _Expr::value_type value_type;
- typedef _UnaryOp<__log_expr<value_type>, _Expr> _Op;
- return __val_expr<_Op>(_Op(__log_expr<value_type>(), __x));
+template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
+inline _LIBCPP_HIDE_FROM_ABI __val_expr<_UnaryOp<__log_expr<typename _Expr::value_type>, _Expr> >
+log(const _Expr& __x) {
+ typedef typename _Expr::value_type value_type;
+ typedef _UnaryOp<__log_expr<value_type>, _Expr> _Op;
+ return __val_expr<_Op>(_Op(__log_expr<value_type>(), __x));
}
-template<class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
-inline _LIBCPP_HIDE_FROM_ABI
-__val_expr<_UnaryOp<__log10_expr<typename _Expr::value_type>, _Expr> >
-log10(const _Expr& __x)
-{
- typedef typename _Expr::value_type value_type;
- typedef _UnaryOp<__log10_expr<value_type>, _Expr> _Op;
- return __val_expr<_Op>(_Op(__log10_expr<value_type>(), __x));
+template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
+inline _LIBCPP_HIDE_FROM_ABI __val_expr<_UnaryOp<__log10_expr<typename _Expr::value_type>, _Expr> >
+log10(const _Expr& __x) {
+ typedef typename _Expr::value_type value_type;
+ typedef _UnaryOp<__log10_expr<value_type>, _Expr> _Op;
+ return __val_expr<_Op>(_Op(__log10_expr<value_type>(), __x));
}
-template<class _Expr1, class _Expr2, __enable_if_t<__is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value, int> = 0>
-inline _LIBCPP_HIDE_FROM_ABI
-__val_expr<_BinaryOp<__pow_expr<typename _Expr1::value_type>, _Expr1, _Expr2> >
-pow(const _Expr1& __x, const _Expr2& __y)
-{
- typedef typename _Expr1::value_type value_type;
- typedef _BinaryOp<__pow_expr<value_type>, _Expr1, _Expr2> _Op;
- return __val_expr<_Op>(_Op(__pow_expr<value_type>(), __x, __y));
+template <class _Expr1,
+ class _Expr2,
+ __enable_if_t<__is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value, int> = 0>
+inline _LIBCPP_HIDE_FROM_ABI __val_expr<_BinaryOp<__pow_expr<typename _Expr1::value_type>, _Expr1, _Expr2> >
+pow(const _Expr1& __x, const _Expr2& __y) {
+ typedef typename _Expr1::value_type value_type;
+ typedef _BinaryOp<__pow_expr<value_type>, _Expr1, _Expr2> _Op;
+ return __val_expr<_Op>(_Op(__pow_expr<value_type>(), __x, __y));
}
-template<class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
+template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
inline _LIBCPP_HIDE_FROM_ABI
-__val_expr<_BinaryOp<__pow_expr<typename _Expr::value_type>,
- _Expr, __scalar_expr<typename _Expr::value_type> > >
-pow(const _Expr& __x, const typename _Expr::value_type& __y)
-{
- typedef typename _Expr::value_type value_type;
- typedef _BinaryOp<__pow_expr<value_type>, _Expr, __scalar_expr<value_type> > _Op;
- return __val_expr<_Op>(_Op(__pow_expr<value_type>(),
- __x, __scalar_expr<value_type>(__y, __x.size())));
+ __val_expr<_BinaryOp<__pow_expr<typename _Expr::value_type>, _Expr, __scalar_expr<typename _Expr::value_type> > >
+ pow(const _Expr& __x, const typename _Expr::value_type& __y) {
+ typedef typename _Expr::value_type value_type;
+ typedef _BinaryOp<__pow_expr<value_type>, _Expr, __scalar_expr<value_type> > _Op;
+ return __val_expr<_Op>(_Op(__pow_expr<value_type>(), __x, __scalar_expr<value_type>(__y, __x.size())));
}
-template<class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
+template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
inline _LIBCPP_HIDE_FROM_ABI
-__val_expr<_BinaryOp<__pow_expr<typename _Expr::value_type>,
- __scalar_expr<typename _Expr::value_type>, _Expr> >
-pow(const typename _Expr::value_type& __x, const _Expr& __y)
-{
- typedef typename _Expr::value_type value_type;
- typedef _BinaryOp<__pow_expr<value_type>, __scalar_expr<value_type>, _Expr> _Op;
- return __val_expr<_Op>(_Op(__pow_expr<value_type>(),
- __scalar_expr<value_type>(__x, __y.size()), __y));
+ __val_expr<_BinaryOp<__pow_expr<typename _Expr::value_type>, __scalar_expr<typename _Expr::value_type>, _Expr> >
+ pow(const typename _Expr::value_type& __x, const _Expr& __y) {
+ typedef typename _Expr::value_type value_type;
+ typedef _BinaryOp<__pow_expr<value_type>, __scalar_expr<value_type>, _Expr> _Op;
+ return __val_expr<_Op>(_Op(__pow_expr<value_type>(), __scalar_expr<value_type>(__x, __y.size()), __y));
}
-template<class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
-inline _LIBCPP_HIDE_FROM_ABI
- __val_expr<_UnaryOp<__sin_expr<typename _Expr::value_type>, _Expr> >
-sin(const _Expr& __x)
-{
- typedef typename _Expr::value_type value_type;
- typedef _UnaryOp<__sin_expr<value_type>, _Expr> _Op;
- return __val_expr<_Op>(_Op(__sin_expr<value_type>(), __x));
+template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
+inline _LIBCPP_HIDE_FROM_ABI __val_expr<_UnaryOp<__sin_expr<typename _Expr::value_type>, _Expr> >
+sin(const _Expr& __x) {
+ typedef typename _Expr::value_type value_type;
+ typedef _UnaryOp<__sin_expr<value_type>, _Expr> _Op;
+ return __val_expr<_Op>(_Op(__sin_expr<value_type>(), __x));
}
-template<class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
-inline _LIBCPP_HIDE_FROM_ABI
- __val_expr<_UnaryOp<__sinh_expr<typename _Expr::value_type>, _Expr> >
-sinh(const _Expr& __x)
-{
- typedef typename _Expr::value_type value_type;
- typedef _UnaryOp<__sinh_expr<value_type>, _Expr> _Op;
- return __val_expr<_Op>(_Op(__sinh_expr<value_type>(), __x));
+template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
+inline _LIBCPP_HIDE_FROM_ABI __val_expr<_UnaryOp<__sinh_expr<typename _Expr::value_type>, _Expr> >
+sinh(const _Expr& __x) {
+ typedef typename _Expr::value_type value_type;
+ typedef _UnaryOp<__sinh_expr<value_type>, _Expr> _Op;
+ return __val_expr<_Op>(_Op(__sinh_expr<value_type>(), __x));
}
-template<class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
-inline _LIBCPP_HIDE_FROM_ABI
- __val_expr<_UnaryOp<__sqrt_expr<typename _Expr::value_type>, _Expr> >
-sqrt(const _Expr& __x)
-{
- typedef typename _Expr::value_type value_type;
- typedef _UnaryOp<__sqrt_expr<value_type>, _Expr> _Op;
- return __val_expr<_Op>(_Op(__sqrt_expr<value_type>(), __x));
+template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
+inline _LIBCPP_HIDE_FROM_ABI __val_expr<_UnaryOp<__sqrt_expr<typename _Expr::value_type>, _Expr> >
+sqrt(const _Expr& __x) {
+ typedef typename _Expr::value_type value_type;
+ typedef _UnaryOp<__sqrt_expr<value_type>, _Expr> _Op;
+ return __val_expr<_Op>(_Op(__sqrt_expr<value_type>(), __x));
}
-template<class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
-inline _LIBCPP_HIDE_FROM_ABI
- __val_expr<_UnaryOp<__tan_expr<typename _Expr::value_type>, _Expr> >
-tan(const _Expr& __x)
-{
- typedef typename _Expr::value_type value_type;
- typedef _UnaryOp<__tan_expr<value_type>, _Expr> _Op;
- return __val_expr<_Op>(_Op(__tan_expr<value_type>(), __x));
+template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
+inline _LIBCPP_HIDE_FROM_ABI __val_expr<_UnaryOp<__tan_expr<typename _Expr::value_type>, _Expr> >
+tan(const _Expr& __x) {
+ typedef typename _Expr::value_type value_type;
+ typedef _UnaryOp<__tan_expr<value_type>, _Expr> _Op;
+ return __val_expr<_Op>(_Op(__tan_expr<value_type>(), __x));
}
-template<class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
-inline _LIBCPP_HIDE_FROM_ABI
- __val_expr<_UnaryOp<__tanh_expr<typename _Expr::value_type>, _Expr> >
-tanh(const _Expr& __x)
-{
- typedef typename _Expr::value_type value_type;
- typedef _UnaryOp<__tanh_expr<value_type>, _Expr> _Op;
- return __val_expr<_Op>(_Op(__tanh_expr<value_type>(), __x));
+template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
+inline _LIBCPP_HIDE_FROM_ABI __val_expr<_UnaryOp<__tanh_expr<typename _Expr::value_type>, _Expr> >
+tanh(const _Expr& __x) {
+ typedef typename _Expr::value_type value_type;
+ typedef _UnaryOp<__tanh_expr<value_type>, _Expr> _Op;
+ return __val_expr<_Op>(_Op(__tanh_expr<value_type>(), __x));
}
template <class _Tp>
-inline _LIBCPP_HIDE_FROM_ABI
-_Tp*
-begin(valarray<_Tp>& __v)
-{
- return __v.__begin_;
+inline _LIBCPP_HIDE_FROM_ABI _Tp* begin(valarray<_Tp>& __v) {
+ return __v.__begin_;
}
template <class _Tp>
-inline _LIBCPP_HIDE_FROM_ABI
-const _Tp*
-begin(const valarray<_Tp>& __v)
-{
- return __v.__begin_;
+inline _LIBCPP_HIDE_FROM_ABI const _Tp* begin(const valarray<_Tp>& __v) {
+ return __v.__begin_;
}
template <class _Tp>
-inline _LIBCPP_HIDE_FROM_ABI
-_Tp*
-end(valarray<_Tp>& __v)
-{
- return __v.__end_;
+inline _LIBCPP_HIDE_FROM_ABI _Tp* end(valarray<_Tp>& __v) {
+ return __v.__end_;
}
template <class _Tp>
-inline _LIBCPP_HIDE_FROM_ABI
-const _Tp*
-end(const valarray<_Tp>& __v)
-{
- return __v.__end_;
+inline _LIBCPP_HIDE_FROM_ABI const _Tp* end(const valarray<_Tp>& __v) {
+ return __v.__end_;
}
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/variant b/contrib/llvm-project/libcxx/include/variant
index 3b01e5e126d9..6179b2a1a0ab 100644
--- a/contrib/llvm-project/libcxx/include/variant
+++ b/contrib/llvm-project/libcxx/include/variant
@@ -262,7 +262,7 @@ namespace std { // explicitly not using versioning namespace
class _LIBCPP_EXPORTED_FROM_ABI _LIBCPP_AVAILABILITY_BAD_VARIANT_ACCESS bad_variant_access : public exception {
public:
- const char* what() const _NOEXCEPT override;
+ const char* what() const _NOEXCEPT override;
};
} // namespace std
@@ -273,26 +273,21 @@ _LIBCPP_BEGIN_NAMESPACE_STD
// Light N-dimensional array of function pointers. Used in place of std::array to avoid
// adding a dependency.
-template<class _Tp, size_t _Size>
+template <class _Tp, size_t _Size>
struct __farray {
static_assert(_Size > 0, "N-dimensional array should never be empty in std::visit");
_Tp __buf_[_Size] = {};
- _LIBCPP_HIDE_FROM_ABI constexpr
- const _Tp &operator[](size_t __n) const noexcept {
- return __buf_[__n];
- }
+ _LIBCPP_HIDE_FROM_ABI constexpr const _Tp& operator[](size_t __n) const noexcept { return __buf_[__n]; }
};
-_LIBCPP_NORETURN
-inline _LIBCPP_HIDE_FROM_ABI
-_LIBCPP_AVAILABILITY_THROW_BAD_VARIANT_ACCESS
-void __throw_bad_variant_access() {
-#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- throw bad_variant_access();
-#else
- _LIBCPP_VERBOSE_ABORT("bad_variant_access was thrown in -fno-exceptions mode");
-#endif
+_LIBCPP_NORETURN inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_THROW_BAD_VARIANT_ACCESS void
+__throw_bad_variant_access() {
+# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
+ throw bad_variant_access();
+# else
+ _LIBCPP_VERBOSE_ABORT("bad_variant_access was thrown in -fno-exceptions mode");
+# endif
}
template <class... _Types>
@@ -311,12 +306,10 @@ template <class _Tp>
struct _LIBCPP_TEMPLATE_VIS variant_size<volatile _Tp> : variant_size<_Tp> {};
template <class _Tp>
-struct _LIBCPP_TEMPLATE_VIS variant_size<const volatile _Tp>
- : variant_size<_Tp> {};
+struct _LIBCPP_TEMPLATE_VIS variant_size<const volatile _Tp> : variant_size<_Tp> {};
template <class... _Types>
-struct _LIBCPP_TEMPLATE_VIS variant_size<variant<_Types...>>
- : integral_constant<size_t, sizeof...(_Types)> {};
+struct _LIBCPP_TEMPLATE_VIS variant_size<variant<_Types...>> : integral_constant<size_t, sizeof...(_Types)> {};
template <size_t _Ip, class _Tp>
struct _LIBCPP_TEMPLATE_VIS variant_alternative;
@@ -325,16 +318,13 @@ template <size_t _Ip, class _Tp>
using variant_alternative_t = typename variant_alternative<_Ip, _Tp>::type;
template <size_t _Ip, class _Tp>
-struct _LIBCPP_TEMPLATE_VIS variant_alternative<_Ip, const _Tp>
- : add_const<variant_alternative_t<_Ip, _Tp>> {};
+struct _LIBCPP_TEMPLATE_VIS variant_alternative<_Ip, const _Tp> : add_const<variant_alternative_t<_Ip, _Tp>> {};
template <size_t _Ip, class _Tp>
-struct _LIBCPP_TEMPLATE_VIS variant_alternative<_Ip, volatile _Tp>
- : add_volatile<variant_alternative_t<_Ip, _Tp>> {};
+struct _LIBCPP_TEMPLATE_VIS variant_alternative<_Ip, volatile _Tp> : add_volatile<variant_alternative_t<_Ip, _Tp>> {};
template <size_t _Ip, class _Tp>
-struct _LIBCPP_TEMPLATE_VIS variant_alternative<_Ip, const volatile _Tp>
- : add_cv<variant_alternative_t<_Ip, _Tp>> {};
+struct _LIBCPP_TEMPLATE_VIS variant_alternative<_Ip, const volatile _Tp> : add_cv<variant_alternative_t<_Ip, _Tp>> {};
template <size_t _Ip, class... _Types>
struct _LIBCPP_TEMPLATE_VIS variant_alternative<_Ip, variant<_Types...>> {
@@ -354,14 +344,11 @@ _LIBCPP_HIDE_FROM_ABI constexpr int __choose_index_type(unsigned int __num_elem)
template <size_t _NumAlts>
using __variant_index_t =
-#ifndef _LIBCPP_ABI_VARIANT_INDEX_TYPE_OPTIMIZATION
- unsigned int;
-#else
- std::tuple_element_t<
- __choose_index_type(_NumAlts),
- std::tuple<unsigned char, unsigned short, unsigned int>
- >;
-#endif
+# ifndef _LIBCPP_ABI_VARIANT_INDEX_TYPE_OPTIMIZATION
+ unsigned int;
+# else
+ std::tuple_element_t< __choose_index_type(_NumAlts), std::tuple<unsigned char, unsigned short, unsigned int> >;
+# endif
template <class _IndexType>
constexpr _IndexType __variant_npos = static_cast<_IndexType>(-1);
@@ -370,36 +357,31 @@ template <class... _Types>
class _LIBCPP_TEMPLATE_VIS variant;
template <class... _Types>
-_LIBCPP_HIDE_FROM_ABI constexpr variant<_Types...>&
-__as_variant(variant<_Types...>& __vs) noexcept {
+_LIBCPP_HIDE_FROM_ABI constexpr variant<_Types...>& __as_variant(variant<_Types...>& __vs) noexcept {
return __vs;
}
template <class... _Types>
-_LIBCPP_HIDE_FROM_ABI constexpr const variant<_Types...>&
-__as_variant(const variant<_Types...>& __vs) noexcept {
+_LIBCPP_HIDE_FROM_ABI constexpr const variant<_Types...>& __as_variant(const variant<_Types...>& __vs) noexcept {
return __vs;
}
template <class... _Types>
-_LIBCPP_HIDE_FROM_ABI constexpr variant<_Types...>&&
-__as_variant(variant<_Types...>&& __vs) noexcept {
+_LIBCPP_HIDE_FROM_ABI constexpr variant<_Types...>&& __as_variant(variant<_Types...>&& __vs) noexcept {
return std::move(__vs);
}
template <class... _Types>
-_LIBCPP_HIDE_FROM_ABI constexpr const variant<_Types...>&&
-__as_variant(const variant<_Types...>&& __vs) noexcept {
+_LIBCPP_HIDE_FROM_ABI constexpr const variant<_Types...>&& __as_variant(const variant<_Types...>&& __vs) noexcept {
return std::move(__vs);
}
namespace __find_detail {
template <class _Tp, class... _Types>
-_LIBCPP_HIDE_FROM_ABI
-constexpr size_t __find_index() {
+_LIBCPP_HIDE_FROM_ABI constexpr size_t __find_index() {
constexpr bool __matches[] = {is_same_v<_Tp, _Types>...};
- size_t __result = __not_found;
+ size_t __result = __not_found;
for (size_t __i = 0; __i < sizeof...(_Types); ++__i) {
if (__matches[__i]) {
if (__result != __not_found) {
@@ -412,8 +394,7 @@ constexpr size_t __find_index() {
}
template <size_t _Index>
-struct __find_unambiguous_index_sfinae_impl
- : integral_constant<size_t, _Index> {};
+struct __find_unambiguous_index_sfinae_impl : integral_constant<size_t, _Index> {};
template <>
struct __find_unambiguous_index_sfinae_impl<__not_found> {};
@@ -422,8 +403,7 @@ template <>
struct __find_unambiguous_index_sfinae_impl<__ambiguous> {};
template <class _Tp, class... _Types>
-struct __find_unambiguous_index_sfinae
- : __find_unambiguous_index_sfinae_impl<__find_index<_Tp, _Types...>()> {};
+struct __find_unambiguous_index_sfinae : __find_unambiguous_index_sfinae_impl<__find_index<_Tp, _Types...>()> {};
} // namespace __find_detail
@@ -433,16 +413,14 @@ struct __valueless_t {};
enum class _Trait { _TriviallyAvailable, _Available, _Unavailable };
-template <typename _Tp,
- template <typename> class _IsTriviallyAvailable,
- template <typename> class _IsAvailable>
+template <typename _Tp, template <typename> class _IsTriviallyAvailable, template <typename> class _IsAvailable>
constexpr _Trait __trait =
- _IsTriviallyAvailable<_Tp>::value
- ? _Trait::_TriviallyAvailable
- : _IsAvailable<_Tp>::value ? _Trait::_Available : _Trait::_Unavailable;
+ _IsTriviallyAvailable<_Tp>::value ? _Trait::_TriviallyAvailable
+ : _IsAvailable<_Tp>::value
+ ? _Trait::_Available
+ : _Trait::_Unavailable;
-_LIBCPP_HIDE_FROM_ABI
-constexpr _Trait __common_trait(initializer_list<_Trait> __traits) {
+_LIBCPP_HIDE_FROM_ABI constexpr _Trait __common_trait(initializer_list<_Trait> __traits) {
_Trait __result = _Trait::_TriviallyAvailable;
for (_Trait __t : __traits) {
if (static_cast<int>(__t) > static_cast<int>(__result)) {
@@ -455,56 +433,45 @@ constexpr _Trait __common_trait(initializer_list<_Trait> __traits) {
template <typename... _Types>
struct __traits {
static constexpr _Trait __copy_constructible_trait =
- __variant_detail::__common_trait({__trait<_Types,
- is_trivially_copy_constructible,
- is_copy_constructible>...});
+ __variant_detail::__common_trait({__trait<_Types, is_trivially_copy_constructible, is_copy_constructible>...});
static constexpr _Trait __move_constructible_trait =
- __variant_detail::__common_trait({__trait<_Types,
- is_trivially_move_constructible,
- is_move_constructible>...});
+ __variant_detail::__common_trait({__trait<_Types, is_trivially_move_constructible, is_move_constructible>...});
static constexpr _Trait __copy_assignable_trait = __variant_detail::__common_trait(
- {__copy_constructible_trait,
- __trait<_Types, is_trivially_copy_assignable, is_copy_assignable>...});
+ {__copy_constructible_trait, __trait<_Types, is_trivially_copy_assignable, is_copy_assignable>...});
static constexpr _Trait __move_assignable_trait = __variant_detail::__common_trait(
- {__move_constructible_trait,
- __trait<_Types, is_trivially_move_assignable, is_move_assignable>...});
+ {__move_constructible_trait, __trait<_Types, is_trivially_move_assignable, is_move_assignable>...});
- static constexpr _Trait __destructible_trait = __variant_detail::__common_trait(
- {__trait<_Types, is_trivially_destructible, is_destructible>...});
+ static constexpr _Trait __destructible_trait =
+ __variant_detail::__common_trait({__trait<_Types, is_trivially_destructible, is_destructible>...});
};
namespace __access {
struct __union {
template <class _Vp>
- _LIBCPP_HIDE_FROM_ABI
- static constexpr auto&& __get_alt(_Vp&& __v, in_place_index_t<0>) {
+ _LIBCPP_HIDE_FROM_ABI static constexpr auto&& __get_alt(_Vp&& __v, in_place_index_t<0>) {
return std::forward<_Vp>(__v).__head;
}
template <class _Vp, size_t _Ip>
- _LIBCPP_HIDE_FROM_ABI
- static constexpr auto&& __get_alt(_Vp&& __v, in_place_index_t<_Ip>) {
+ _LIBCPP_HIDE_FROM_ABI static constexpr auto&& __get_alt(_Vp&& __v, in_place_index_t<_Ip>) {
return __get_alt(std::forward<_Vp>(__v).__tail, in_place_index<_Ip - 1>);
}
};
struct __base {
template <size_t _Ip, class _Vp>
- _LIBCPP_HIDE_FROM_ABI
- static constexpr auto&& __get_alt(_Vp&& __v) {
- return __union::__get_alt(std::forward<_Vp>(__v).__data,
- in_place_index<_Ip>);
+ _LIBCPP_HIDE_FROM_ABI static constexpr auto&& __get_alt(_Vp&& __v) {
+ return __union::__get_alt(std::forward<_Vp>(__v).__data, in_place_index<_Ip>);
}
};
struct __variant {
template <size_t _Ip, class _Vp>
- _LIBCPP_HIDE_FROM_ABI
- static constexpr auto&& __get_alt(_Vp&& __v) {
+ _LIBCPP_HIDE_FROM_ABI static constexpr auto&& __get_alt(_Vp&& __v) {
return __base::__get_alt<_Ip>(std::forward<_Vp>(__v).__impl_);
}
};
@@ -515,50 +482,38 @@ namespace __visitation {
struct __base {
template <class _Visitor, class... _Vs>
- _LIBCPP_HIDE_FROM_ABI
- static constexpr decltype(auto)
+ _LIBCPP_HIDE_FROM_ABI static constexpr decltype(auto)
__visit_alt_at(size_t __index, _Visitor&& __visitor, _Vs&&... __vs) {
- constexpr auto __fdiagonal =
- __make_fdiagonal<_Visitor&&,
- decltype(std::forward<_Vs>(__vs).__as_base())...>();
- return __fdiagonal[__index](std::forward<_Visitor>(__visitor),
- std::forward<_Vs>(__vs).__as_base()...);
+ constexpr auto __fdiagonal = __make_fdiagonal<_Visitor&&, decltype(std::forward<_Vs>(__vs).__as_base())...>();
+ return __fdiagonal[__index](std::forward<_Visitor>(__visitor), std::forward<_Vs>(__vs).__as_base()...);
}
template <class _Visitor, class... _Vs>
- _LIBCPP_HIDE_FROM_ABI
- static constexpr decltype(auto) __visit_alt(_Visitor&& __visitor,
- _Vs&&... __vs) {
- constexpr auto __fmatrix =
- __make_fmatrix<_Visitor&&,
- decltype(std::forward<_Vs>(__vs).__as_base())...>();
- return __at(__fmatrix, __vs.index()...)(
- std::forward<_Visitor>(__visitor),
- std::forward<_Vs>(__vs).__as_base()...);
+ _LIBCPP_HIDE_FROM_ABI static constexpr decltype(auto) __visit_alt(_Visitor&& __visitor, _Vs&&... __vs) {
+ constexpr auto __fmatrix = __make_fmatrix<_Visitor&&, decltype(std::forward<_Vs>(__vs).__as_base())...>();
+ return __at(__fmatrix, __vs.index()...)(std::forward<_Visitor>(__visitor), std::forward<_Vs>(__vs).__as_base()...);
}
private:
template <class _Tp>
- _LIBCPP_HIDE_FROM_ABI
- static constexpr const _Tp& __at(const _Tp& __elem) { return __elem; }
+ _LIBCPP_HIDE_FROM_ABI static constexpr const _Tp& __at(const _Tp& __elem) {
+ return __elem;
+ }
template <class _Tp, size_t _Np, typename... _Indices>
- _LIBCPP_HIDE_FROM_ABI
- static constexpr auto&& __at(const __farray<_Tp, _Np>& __elems,
- size_t __index, _Indices... __indices) {
+ _LIBCPP_HIDE_FROM_ABI static constexpr auto&&
+ __at(const __farray<_Tp, _Np>& __elems, size_t __index, _Indices... __indices) {
return __at(__elems[__index], __indices...);
}
template <class _Fp, class... _Fs>
static _LIBCPP_HIDE_FROM_ABI constexpr void __std_visit_visitor_return_type_check() {
static_assert(
- __all<is_same_v<_Fp, _Fs>...>::value,
- "`std::visit` requires the visitor to have a single return type.");
+ __all<is_same_v<_Fp, _Fs>...>::value, "`std::visit` requires the visitor to have a single return type.");
}
template <class... _Fs>
- _LIBCPP_HIDE_FROM_ABI
- static constexpr auto __make_farray(_Fs&&... __fs) {
+ _LIBCPP_HIDE_FROM_ABI static constexpr auto __make_farray(_Fs&&... __fs) {
__std_visit_visitor_return_type_check<__remove_cvref_t<_Fs>...>();
using __result = __farray<common_type_t<__remove_cvref_t<_Fs>...>, sizeof...(_Fs)>;
return __result{{std::forward<_Fs>(__fs)...}};
@@ -567,59 +522,46 @@ private:
template <size_t... _Is>
struct __dispatcher {
template <class _Fp, class... _Vs>
- _LIBCPP_HIDE_FROM_ABI
- static constexpr decltype(auto) __dispatch(_Fp __f, _Vs... __vs) {
- return std::__invoke(
- static_cast<_Fp>(__f),
- __access::__base::__get_alt<_Is>(static_cast<_Vs>(__vs))...);
+ _LIBCPP_HIDE_FROM_ABI static constexpr decltype(auto) __dispatch(_Fp __f, _Vs... __vs) {
+ return std::__invoke(static_cast<_Fp>(__f), __access::__base::__get_alt<_Is>(static_cast<_Vs>(__vs))...);
}
};
template <class _Fp, class... _Vs, size_t... _Is>
- _LIBCPP_HIDE_FROM_ABI
- static constexpr auto __make_dispatch(index_sequence<_Is...>) {
+ _LIBCPP_HIDE_FROM_ABI static constexpr auto __make_dispatch(index_sequence<_Is...>) {
return __dispatcher<_Is...>::template __dispatch<_Fp, _Vs...>;
}
template <size_t _Ip, class _Fp, class... _Vs>
- _LIBCPP_HIDE_FROM_ABI
- static constexpr auto __make_fdiagonal_impl() {
- return __make_dispatch<_Fp, _Vs...>(
- index_sequence<((void)__type_identity<_Vs>{}, _Ip)...>{});
+ _LIBCPP_HIDE_FROM_ABI static constexpr auto __make_fdiagonal_impl() {
+ return __make_dispatch<_Fp, _Vs...>(index_sequence<((void)__type_identity<_Vs>{}, _Ip)...>{});
}
template <class _Fp, class... _Vs, size_t... _Is>
- _LIBCPP_HIDE_FROM_ABI
- static constexpr auto __make_fdiagonal_impl(index_sequence<_Is...>) {
+ _LIBCPP_HIDE_FROM_ABI static constexpr auto __make_fdiagonal_impl(index_sequence<_Is...>) {
return __base::__make_farray(__make_fdiagonal_impl<_Is, _Fp, _Vs...>()...);
}
template <class _Fp, class _Vp, class... _Vs>
- _LIBCPP_HIDE_FROM_ABI
- static constexpr auto __make_fdiagonal() {
+ _LIBCPP_HIDE_FROM_ABI static constexpr auto __make_fdiagonal() {
constexpr size_t __np = __remove_cvref_t<_Vp>::__size();
static_assert(__all<(__np == __remove_cvref_t<_Vs>::__size())...>::value);
return __make_fdiagonal_impl<_Fp, _Vp, _Vs...>(make_index_sequence<__np>{});
}
template <class _Fp, class... _Vs, size_t... _Is>
- _LIBCPP_HIDE_FROM_ABI
- static constexpr auto __make_fmatrix_impl(index_sequence<_Is...> __is) {
+ _LIBCPP_HIDE_FROM_ABI static constexpr auto __make_fmatrix_impl(index_sequence<_Is...> __is) {
return __make_dispatch<_Fp, _Vs...>(__is);
}
template <class _Fp, class... _Vs, size_t... _Is, size_t... _Js, class... _Ls>
- _LIBCPP_HIDE_FROM_ABI
- static constexpr auto __make_fmatrix_impl(index_sequence<_Is...>,
- index_sequence<_Js...>,
- _Ls... __ls) {
- return __base::__make_farray(__make_fmatrix_impl<_Fp, _Vs...>(
- index_sequence<_Is..., _Js>{}, __ls...)...);
+ _LIBCPP_HIDE_FROM_ABI static constexpr auto
+ __make_fmatrix_impl(index_sequence<_Is...>, index_sequence<_Js...>, _Ls... __ls) {
+ return __base::__make_farray(__make_fmatrix_impl<_Fp, _Vs...>(index_sequence<_Is..., _Js>{}, __ls...)...);
}
template <class _Fp, class... _Vs>
- _LIBCPP_HIDE_FROM_ABI
- static constexpr auto __make_fmatrix() {
+ _LIBCPP_HIDE_FROM_ABI static constexpr auto __make_fmatrix() {
return __make_fmatrix_impl<_Fp, _Vs...>(
index_sequence<>{}, make_index_sequence<__remove_cvref_t<_Vs>::__size()>{}...);
}
@@ -627,110 +569,79 @@ private:
struct __variant {
template <class _Visitor, class... _Vs>
- _LIBCPP_HIDE_FROM_ABI
- static constexpr decltype(auto)
+ _LIBCPP_HIDE_FROM_ABI static constexpr decltype(auto)
__visit_alt_at(size_t __index, _Visitor&& __visitor, _Vs&&... __vs) {
- return __base::__visit_alt_at(__index,
- std::forward<_Visitor>(__visitor),
- std::forward<_Vs>(__vs).__impl_...);
+ return __base::__visit_alt_at(__index, std::forward<_Visitor>(__visitor), std::forward<_Vs>(__vs).__impl_...);
}
template <class _Visitor, class... _Vs>
- _LIBCPP_HIDE_FROM_ABI
- static constexpr decltype(auto) __visit_alt(_Visitor&& __visitor,
- _Vs&&... __vs) {
+ _LIBCPP_HIDE_FROM_ABI static constexpr decltype(auto) __visit_alt(_Visitor&& __visitor, _Vs&&... __vs) {
return __base::__visit_alt(
- std::forward<_Visitor>(__visitor),
- std::__as_variant(std::forward<_Vs>(__vs)).__impl_...);
+ std::forward<_Visitor>(__visitor), std::__as_variant(std::forward<_Vs>(__vs)).__impl_...);
}
template <class _Visitor, class... _Vs>
- _LIBCPP_HIDE_FROM_ABI
- static constexpr decltype(auto)
+ _LIBCPP_HIDE_FROM_ABI static constexpr decltype(auto)
__visit_value_at(size_t __index, _Visitor&& __visitor, _Vs&&... __vs) {
- return __visit_alt_at(
- __index,
- __make_value_visitor(std::forward<_Visitor>(__visitor)),
- std::forward<_Vs>(__vs)...);
+ return __visit_alt_at(__index, __make_value_visitor(std::forward<_Visitor>(__visitor)), std::forward<_Vs>(__vs)...);
}
template <class _Visitor, class... _Vs>
- _LIBCPP_HIDE_FROM_ABI
- static constexpr decltype(auto) __visit_value(_Visitor&& __visitor,
- _Vs&&... __vs) {
- return __visit_alt(
- __make_value_visitor(std::forward<_Visitor>(__visitor)),
- std::forward<_Vs>(__vs)...);
+ _LIBCPP_HIDE_FROM_ABI static constexpr decltype(auto) __visit_value(_Visitor&& __visitor, _Vs&&... __vs) {
+ return __visit_alt(__make_value_visitor(std::forward<_Visitor>(__visitor)), std::forward<_Vs>(__vs)...);
}
-#if _LIBCPP_STD_VER >= 20
+# if _LIBCPP_STD_VER >= 20
template <class _Rp, class _Visitor, class... _Vs>
- _LIBCPP_HIDE_FROM_ABI
- static constexpr _Rp __visit_value(_Visitor&& __visitor,
- _Vs&&... __vs) {
- return __visit_alt(
- __make_value_visitor<_Rp>(std::forward<_Visitor>(__visitor)),
- std::forward<_Vs>(__vs)...);
+ _LIBCPP_HIDE_FROM_ABI static constexpr _Rp __visit_value(_Visitor&& __visitor, _Vs&&... __vs) {
+ return __visit_alt(__make_value_visitor<_Rp>(std::forward<_Visitor>(__visitor)), std::forward<_Vs>(__vs)...);
}
-#endif
+# endif
private:
template <class _Visitor, class... _Values>
static _LIBCPP_HIDE_FROM_ABI constexpr void __std_visit_exhaustive_visitor_check() {
- static_assert(is_invocable_v<_Visitor, _Values...>,
- "`std::visit` requires the visitor to be exhaustive.");
+ static_assert(is_invocable_v<_Visitor, _Values...>, "`std::visit` requires the visitor to be exhaustive.");
}
template <class _Visitor>
struct __value_visitor {
template <class... _Alts>
- _LIBCPP_HIDE_FROM_ABI
- constexpr decltype(auto) operator()(_Alts&&... __alts) const {
- __std_visit_exhaustive_visitor_check<
- _Visitor,
- decltype((std::forward<_Alts>(__alts).__value))...>();
- return std::__invoke(std::forward<_Visitor>(__visitor),
- std::forward<_Alts>(__alts).__value...);
+ _LIBCPP_HIDE_FROM_ABI constexpr decltype(auto) operator()(_Alts&&... __alts) const {
+ __std_visit_exhaustive_visitor_check< _Visitor, decltype((std::forward<_Alts>(__alts).__value))...>();
+ return std::__invoke(std::forward<_Visitor>(__visitor), std::forward<_Alts>(__alts).__value...);
}
_Visitor&& __visitor;
};
-#if _LIBCPP_STD_VER >= 20
+# if _LIBCPP_STD_VER >= 20
template <class _Rp, class _Visitor>
struct __value_visitor_return_type {
template <class... _Alts>
- _LIBCPP_HIDE_FROM_ABI
- constexpr _Rp operator()(_Alts&&... __alts) const {
- __std_visit_exhaustive_visitor_check<
- _Visitor,
- decltype((std::forward<_Alts>(__alts).__value))...>();
+ _LIBCPP_HIDE_FROM_ABI constexpr _Rp operator()(_Alts&&... __alts) const {
+ __std_visit_exhaustive_visitor_check< _Visitor, decltype((std::forward<_Alts>(__alts).__value))...>();
if constexpr (is_void_v<_Rp>) {
- std::__invoke(std::forward<_Visitor>(__visitor),
- std::forward<_Alts>(__alts).__value...);
- }
- else {
- return std::__invoke(std::forward<_Visitor>(__visitor),
- std::forward<_Alts>(__alts).__value...);
+ std::__invoke(std::forward<_Visitor>(__visitor), std::forward<_Alts>(__alts).__value...);
+ } else {
+ return std::__invoke(std::forward<_Visitor>(__visitor), std::forward<_Alts>(__alts).__value...);
}
}
_Visitor&& __visitor;
};
-#endif
+# endif
template <class _Visitor>
- _LIBCPP_HIDE_FROM_ABI
- static constexpr auto __make_value_visitor(_Visitor&& __visitor) {
+ _LIBCPP_HIDE_FROM_ABI static constexpr auto __make_value_visitor(_Visitor&& __visitor) {
return __value_visitor<_Visitor>{std::forward<_Visitor>(__visitor)};
}
-#if _LIBCPP_STD_VER >= 20
+# if _LIBCPP_STD_VER >= 20
template <class _Rp, class _Visitor>
- _LIBCPP_HIDE_FROM_ABI
- static constexpr auto __make_value_visitor(_Visitor&& __visitor) {
+ _LIBCPP_HIDE_FROM_ABI static constexpr auto __make_value_visitor(_Visitor&& __visitor) {
return __value_visitor_return_type<_Rp, _Visitor>{std::forward<_Visitor>(__visitor)};
}
-#endif
+# endif
};
} // namespace __visitation
@@ -740,8 +651,7 @@ struct _LIBCPP_TEMPLATE_VIS __alt {
using __value_type = _Tp;
template <class... _Args>
- _LIBCPP_HIDE_FROM_ABI
- explicit constexpr __alt(in_place_t, _Args&&... __args)
+ _LIBCPP_HIDE_FROM_ABI explicit constexpr __alt(in_place_t, _Args&&... __args)
: __value(std::forward<_Args>(__args)...) {}
__value_type __value;
@@ -753,89 +663,71 @@ union _LIBCPP_TEMPLATE_VIS __union;
template <_Trait _DestructibleTrait, size_t _Index>
union _LIBCPP_TEMPLATE_VIS __union<_DestructibleTrait, _Index> {};
-#define _LIBCPP_VARIANT_UNION(destructible_trait, destructor) \
- template <size_t _Index, class _Tp, class... _Types> \
- union _LIBCPP_TEMPLATE_VIS __union<destructible_trait, \
- _Index, \
- _Tp, \
- _Types...> { \
- public: \
- _LIBCPP_HIDE_FROM_ABI \
- explicit constexpr __union(__valueless_t) noexcept : __dummy{} {} \
- \
- template <class... _Args> \
- _LIBCPP_HIDE_FROM_ABI \
- explicit constexpr __union(in_place_index_t<0>, _Args&&... __args) \
- : __head(in_place, std::forward<_Args>(__args)...) {} \
- \
- template <size_t _Ip, class... _Args> \
- _LIBCPP_HIDE_FROM_ABI \
- explicit constexpr __union(in_place_index_t<_Ip>, _Args&&... __args) \
- : __tail(in_place_index<_Ip - 1>, std::forward<_Args>(__args)...) {} \
- \
- __union(const __union&) = default; \
- __union(__union&&) = default; \
- \
- destructor \
- \
- __union& operator=(const __union&) = default; \
- __union& operator=(__union&&) = default; \
- \
- private: \
- char __dummy; \
- __alt<_Index, _Tp> __head; \
- __union<destructible_trait, _Index + 1, _Types...> __tail; \
- \
- friend struct __access::__union; \
- }
+# define _LIBCPP_VARIANT_UNION(destructible_trait, destructor) \
+ template <size_t _Index, class _Tp, class... _Types> \
+ union _LIBCPP_TEMPLATE_VIS __union<destructible_trait, _Index, _Tp, _Types...> { \
+ public: \
+ _LIBCPP_HIDE_FROM_ABI explicit constexpr __union(__valueless_t) noexcept : __dummy{} {} \
+ \
+ template <class... _Args> \
+ _LIBCPP_HIDE_FROM_ABI explicit constexpr __union(in_place_index_t<0>, _Args&&... __args) \
+ : __head(in_place, std::forward<_Args>(__args)...) {} \
+ \
+ template <size_t _Ip, class... _Args> \
+ _LIBCPP_HIDE_FROM_ABI explicit constexpr __union(in_place_index_t<_Ip>, _Args&&... __args) \
+ : __tail(in_place_index<_Ip - 1>, std::forward<_Args>(__args)...) {} \
+ \
+ __union(const __union&) = default; \
+ __union(__union&&) = default; \
+ \
+ destructor \
+ \
+ __union& \
+ operator=(const __union&) = default; \
+ __union& operator=(__union&&) = default; \
+ \
+ private: \
+ char __dummy; \
+ __alt<_Index, _Tp> __head; \
+ __union<destructible_trait, _Index + 1, _Types...> __tail; \
+ \
+ friend struct __access::__union; \
+ }
_LIBCPP_VARIANT_UNION(_Trait::_TriviallyAvailable, ~__union() = default;);
-_LIBCPP_VARIANT_UNION(_Trait::_Available, ~__union() {});
+_LIBCPP_VARIANT_UNION(_Trait::_Available, ~__union(){});
_LIBCPP_VARIANT_UNION(_Trait::_Unavailable, ~__union() = delete;);
-#undef _LIBCPP_VARIANT_UNION
+# undef _LIBCPP_VARIANT_UNION
template <_Trait _DestructibleTrait, class... _Types>
class _LIBCPP_TEMPLATE_VIS __base {
public:
using __index_t = __variant_index_t<sizeof...(_Types)>;
- _LIBCPP_HIDE_FROM_ABI
- explicit constexpr __base(__valueless_t __tag) noexcept
+ _LIBCPP_HIDE_FROM_ABI explicit constexpr __base(__valueless_t __tag) noexcept
: __data(__tag), __index(__variant_npos<__index_t>) {}
template <size_t _Ip, class... _Args>
- _LIBCPP_HIDE_FROM_ABI
- explicit constexpr __base(in_place_index_t<_Ip>, _Args&&... __args)
- :
- __data(in_place_index<_Ip>, std::forward<_Args>(__args)...),
- __index(_Ip) {}
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr bool valueless_by_exception() const noexcept {
- return index() == variant_npos;
- }
+ _LIBCPP_HIDE_FROM_ABI explicit constexpr __base(in_place_index_t<_Ip>, _Args&&... __args)
+ : __data(in_place_index<_Ip>, std::forward<_Args>(__args)...), __index(_Ip) {}
+
+ _LIBCPP_HIDE_FROM_ABI constexpr bool valueless_by_exception() const noexcept { return index() == variant_npos; }
- _LIBCPP_HIDE_FROM_ABI
- constexpr size_t index() const noexcept {
+ _LIBCPP_HIDE_FROM_ABI constexpr size_t index() const noexcept {
return __index == __variant_npos<__index_t> ? variant_npos : __index;
}
protected:
- _LIBCPP_HIDE_FROM_ABI
- constexpr auto&& __as_base() & { return *this; }
+ _LIBCPP_HIDE_FROM_ABI constexpr auto&& __as_base() & { return *this; }
- _LIBCPP_HIDE_FROM_ABI
- constexpr auto&& __as_base() && { return std::move(*this); }
+ _LIBCPP_HIDE_FROM_ABI constexpr auto&& __as_base() && { return std::move(*this); }
- _LIBCPP_HIDE_FROM_ABI
- constexpr auto&& __as_base() const & { return *this; }
+ _LIBCPP_HIDE_FROM_ABI constexpr auto&& __as_base() const& { return *this; }
- _LIBCPP_HIDE_FROM_ABI
- constexpr auto&& __as_base() const && { return std::move(*this); }
+ _LIBCPP_HIDE_FROM_ABI constexpr auto&& __as_base() const&& { return std::move(*this); }
- _LIBCPP_HIDE_FROM_ABI
- static constexpr size_t __size() { return sizeof...(_Types); }
+ _LIBCPP_HIDE_FROM_ABI static constexpr size_t __size() { return sizeof...(_Types); }
__union<_DestructibleTrait, 0, _Types...> __data;
__index_t __index;
@@ -847,33 +739,29 @@ protected:
template <class _Traits, _Trait = _Traits::__destructible_trait>
class _LIBCPP_TEMPLATE_VIS __dtor;
-#define _LIBCPP_VARIANT_DESTRUCTOR(destructible_trait, destructor, destroy) \
- template <class... _Types> \
- class _LIBCPP_TEMPLATE_VIS __dtor<__traits<_Types...>, \
- destructible_trait> \
- : public __base<destructible_trait, _Types...> { \
- using __base_type = __base<destructible_trait, _Types...>; \
- using __index_t = typename __base_type::__index_t; \
- \
- public: \
- using __base_type::__base_type; \
- using __base_type::operator=; \
- \
- __dtor(const __dtor&) = default; \
- __dtor(__dtor&&) = default; \
- destructor \
- __dtor& operator=(const __dtor&) = default; \
- __dtor& operator=(__dtor&&) = default; \
- \
- protected: \
- inline _LIBCPP_HIDE_FROM_ABI \
- destroy \
- }
+# define _LIBCPP_VARIANT_DESTRUCTOR(destructible_trait, destructor, destroy) \
+ template <class... _Types> \
+ class _LIBCPP_TEMPLATE_VIS __dtor<__traits<_Types...>, destructible_trait> \
+ : public __base<destructible_trait, _Types...> { \
+ using __base_type = __base<destructible_trait, _Types...>; \
+ using __index_t = typename __base_type::__index_t; \
+ \
+ public: \
+ using __base_type::__base_type; \
+ using __base_type::operator=; \
+ \
+ __dtor(const __dtor&) = default; \
+ __dtor(__dtor&&) = default; \
+ destructor __dtor& operator=(const __dtor&) = default; \
+ __dtor& operator=(__dtor&&) = default; \
+ \
+ protected: \
+ inline _LIBCPP_HIDE_FROM_ABI destroy \
+ }
_LIBCPP_VARIANT_DESTRUCTOR(
- _Trait::_TriviallyAvailable,
- ~__dtor() = default;,
- void __destroy() noexcept { this->__index = __variant_npos<__index_t>; });
+ _Trait::_TriviallyAvailable, ~__dtor() = default;
+ , void __destroy() noexcept { this->__index = __variant_npos<__index_t>; });
_LIBCPP_VARIANT_DESTRUCTOR(
_Trait::_Available,
@@ -890,12 +778,9 @@ _LIBCPP_VARIANT_DESTRUCTOR(
this->__index = __variant_npos<__index_t>;
});
-_LIBCPP_VARIANT_DESTRUCTOR(
- _Trait::_Unavailable,
- ~__dtor() = delete;,
- void __destroy() noexcept = delete;);
+_LIBCPP_VARIANT_DESTRUCTOR(_Trait::_Unavailable, ~__dtor() = delete;, void __destroy() noexcept = delete;);
-#undef _LIBCPP_VARIANT_DESTRUCTOR
+# undef _LIBCPP_VARIANT_DESTRUCTOR
template <class _Traits>
class _LIBCPP_TEMPLATE_VIS __ctor : public __dtor<_Traits> {
@@ -907,26 +792,22 @@ public:
protected:
template <size_t _Ip, class _Tp, class... _Args>
- _LIBCPP_HIDE_FROM_ABI
- static _Tp& __construct_alt(__alt<_Ip, _Tp>& __a, _Args&&... __args) {
- ::new ((void*)std::addressof(__a))
- __alt<_Ip, _Tp>(in_place, std::forward<_Args>(__args)...);
+ _LIBCPP_HIDE_FROM_ABI static _Tp& __construct_alt(__alt<_Ip, _Tp>& __a, _Args&&... __args) {
+ ::new ((void*)std::addressof(__a)) __alt<_Ip, _Tp>(in_place, std::forward<_Args>(__args)...);
return __a.__value;
}
template <class _Rhs>
- _LIBCPP_HIDE_FROM_ABI
- static void __generic_construct(__ctor& __lhs, _Rhs&& __rhs) {
+ _LIBCPP_HIDE_FROM_ABI static void __generic_construct(__ctor& __lhs, _Rhs&& __rhs) {
__lhs.__destroy();
if (!__rhs.valueless_by_exception()) {
__visitation::__base::__visit_alt_at(
__rhs.index(),
[](auto& __lhs_alt, auto&& __rhs_alt) {
- __construct_alt(
- __lhs_alt,
- std::forward<decltype(__rhs_alt)>(__rhs_alt).__value);
+ __construct_alt(__lhs_alt, std::forward<decltype(__rhs_alt)>(__rhs_alt).__value);
},
- __lhs, std::forward<_Rhs>(__rhs));
+ __lhs,
+ std::forward<_Rhs>(__rhs));
__lhs.__index = __rhs.index();
}
}
@@ -935,81 +816,63 @@ protected:
template <class _Traits, _Trait = _Traits::__move_constructible_trait>
class _LIBCPP_TEMPLATE_VIS __move_constructor;
-#define _LIBCPP_VARIANT_MOVE_CONSTRUCTOR(move_constructible_trait, \
- move_constructor) \
- template <class... _Types> \
- class _LIBCPP_TEMPLATE_VIS __move_constructor<__traits<_Types...>, \
- move_constructible_trait> \
- : public __ctor<__traits<_Types...>> { \
- using __base_type = __ctor<__traits<_Types...>>; \
- \
- public: \
- using __base_type::__base_type; \
- using __base_type::operator=; \
- \
- __move_constructor(const __move_constructor&) = default; \
- move_constructor \
- ~__move_constructor() = default; \
- __move_constructor& operator=(const __move_constructor&) = default; \
- __move_constructor& operator=(__move_constructor&&) = default; \
- }
+# define _LIBCPP_VARIANT_MOVE_CONSTRUCTOR(move_constructible_trait, move_constructor) \
+ template <class... _Types> \
+ class _LIBCPP_TEMPLATE_VIS __move_constructor<__traits<_Types...>, move_constructible_trait> \
+ : public __ctor<__traits<_Types...>> { \
+ using __base_type = __ctor<__traits<_Types...>>; \
+ \
+ public: \
+ using __base_type::__base_type; \
+ using __base_type::operator=; \
+ \
+ __move_constructor(const __move_constructor&) = default; \
+ move_constructor ~__move_constructor() = default; \
+ __move_constructor& operator=(const __move_constructor&) = default; \
+ __move_constructor& operator=(__move_constructor&&) = default; \
+ }
-_LIBCPP_VARIANT_MOVE_CONSTRUCTOR(
- _Trait::_TriviallyAvailable,
- __move_constructor(__move_constructor&& __that) = default;);
+_LIBCPP_VARIANT_MOVE_CONSTRUCTOR(_Trait::_TriviallyAvailable,
+ __move_constructor(__move_constructor&& __that) = default;);
_LIBCPP_VARIANT_MOVE_CONSTRUCTOR(
_Trait::_Available,
- __move_constructor(__move_constructor&& __that) noexcept(
- __all<is_nothrow_move_constructible_v<_Types>...>::value)
- : __move_constructor(__valueless_t{}) {
- this->__generic_construct(*this, std::move(__that));
- });
+ __move_constructor(__move_constructor&& __that) noexcept(__all<is_nothrow_move_constructible_v<_Types>...>::value)
+ : __move_constructor(__valueless_t{}) { this->__generic_construct(*this, std::move(__that)); });
-_LIBCPP_VARIANT_MOVE_CONSTRUCTOR(
- _Trait::_Unavailable,
- __move_constructor(__move_constructor&&) = delete;);
+_LIBCPP_VARIANT_MOVE_CONSTRUCTOR(_Trait::_Unavailable, __move_constructor(__move_constructor&&) = delete;);
-#undef _LIBCPP_VARIANT_MOVE_CONSTRUCTOR
+# undef _LIBCPP_VARIANT_MOVE_CONSTRUCTOR
template <class _Traits, _Trait = _Traits::__copy_constructible_trait>
class _LIBCPP_TEMPLATE_VIS __copy_constructor;
-#define _LIBCPP_VARIANT_COPY_CONSTRUCTOR(copy_constructible_trait, \
- copy_constructor) \
- template <class... _Types> \
- class _LIBCPP_TEMPLATE_VIS __copy_constructor<__traits<_Types...>, \
- copy_constructible_trait> \
- : public __move_constructor<__traits<_Types...>> { \
- using __base_type = __move_constructor<__traits<_Types...>>; \
- \
- public: \
- using __base_type::__base_type; \
- using __base_type::operator=; \
- \
- copy_constructor \
- __copy_constructor(__copy_constructor&&) = default; \
- ~__copy_constructor() = default; \
- __copy_constructor& operator=(const __copy_constructor&) = default; \
- __copy_constructor& operator=(__copy_constructor&&) = default; \
- }
+# define _LIBCPP_VARIANT_COPY_CONSTRUCTOR(copy_constructible_trait, copy_constructor) \
+ template <class... _Types> \
+ class _LIBCPP_TEMPLATE_VIS __copy_constructor<__traits<_Types...>, copy_constructible_trait> \
+ : public __move_constructor<__traits<_Types...>> { \
+ using __base_type = __move_constructor<__traits<_Types...>>; \
+ \
+ public: \
+ using __base_type::__base_type; \
+ using __base_type::operator=; \
+ \
+ copy_constructor __copy_constructor(__copy_constructor&&) = default; \
+ ~__copy_constructor() = default; \
+ __copy_constructor& operator=(const __copy_constructor&) = default; \
+ __copy_constructor& operator=(__copy_constructor&&) = default; \
+ }
-_LIBCPP_VARIANT_COPY_CONSTRUCTOR(
- _Trait::_TriviallyAvailable,
- __copy_constructor(const __copy_constructor& __that) = default;);
+_LIBCPP_VARIANT_COPY_CONSTRUCTOR(_Trait::_TriviallyAvailable,
+ __copy_constructor(const __copy_constructor& __that) = default;);
_LIBCPP_VARIANT_COPY_CONSTRUCTOR(
- _Trait::_Available,
- __copy_constructor(const __copy_constructor& __that)
- : __copy_constructor(__valueless_t{}) {
- this->__generic_construct(*this, __that);
- });
+ _Trait::_Available, __copy_constructor(const __copy_constructor& __that)
+ : __copy_constructor(__valueless_t{}) { this->__generic_construct(*this, __that); });
-_LIBCPP_VARIANT_COPY_CONSTRUCTOR(
- _Trait::_Unavailable,
- __copy_constructor(const __copy_constructor&) = delete;);
+_LIBCPP_VARIANT_COPY_CONSTRUCTOR(_Trait::_Unavailable, __copy_constructor(const __copy_constructor&) = delete;);
-#undef _LIBCPP_VARIANT_COPY_CONSTRUCTOR
+# undef _LIBCPP_VARIANT_COPY_CONSTRUCTOR
template <class _Traits>
class _LIBCPP_TEMPLATE_VIS __assignment : public __copy_constructor<_Traits> {
@@ -1020,40 +883,33 @@ public:
using __base_type::operator=;
template <size_t _Ip, class... _Args>
- _LIBCPP_HIDE_FROM_ABI
- auto& __emplace(_Args&&... __args) {
+ _LIBCPP_HIDE_FROM_ABI auto& __emplace(_Args&&... __args) {
this->__destroy();
- auto& __res = this->__construct_alt(__access::__base::__get_alt<_Ip>(*this),
- std::forward<_Args>(__args)...);
+ auto& __res = this->__construct_alt(__access::__base::__get_alt<_Ip>(*this), std::forward<_Args>(__args)...);
this->__index = _Ip;
return __res;
}
protected:
template <size_t _Ip, class _Tp, class _Arg>
- _LIBCPP_HIDE_FROM_ABI
- void __assign_alt(__alt<_Ip, _Tp>& __a, _Arg&& __arg) {
+ _LIBCPP_HIDE_FROM_ABI void __assign_alt(__alt<_Ip, _Tp>& __a, _Arg&& __arg) {
if (this->index() == _Ip) {
__a.__value = std::forward<_Arg>(__arg);
} else {
struct {
- _LIBCPP_HIDE_FROM_ABI void operator()(true_type) const {
- __this->__emplace<_Ip>(std::forward<_Arg>(__arg));
- }
+ _LIBCPP_HIDE_FROM_ABI void operator()(true_type) const { __this->__emplace<_Ip>(std::forward<_Arg>(__arg)); }
_LIBCPP_HIDE_FROM_ABI void operator()(false_type) const {
__this->__emplace<_Ip>(_Tp(std::forward<_Arg>(__arg)));
}
__assignment* __this;
_Arg&& __arg;
} __impl{this, std::forward<_Arg>(__arg)};
- __impl(bool_constant<is_nothrow_constructible_v<_Tp, _Arg> ||
- !is_nothrow_move_constructible_v<_Tp>>{});
+ __impl(bool_constant < is_nothrow_constructible_v<_Tp, _Arg> || !is_nothrow_move_constructible_v < _Tp >> {});
}
}
template <class _That>
- _LIBCPP_HIDE_FROM_ABI
- void __generic_assign(_That&& __that) {
+ _LIBCPP_HIDE_FROM_ABI void __generic_assign(_That&& __that) {
if (this->valueless_by_exception() && __that.valueless_by_exception()) {
// do nothing.
} else if (__that.valueless_by_exception()) {
@@ -1062,11 +918,10 @@ protected:
__visitation::__base::__visit_alt_at(
__that.index(),
[this](auto& __this_alt, auto&& __that_alt) {
- this->__assign_alt(
- __this_alt,
- std::forward<decltype(__that_alt)>(__that_alt).__value);
+ this->__assign_alt(__this_alt, std::forward<decltype(__that_alt)>(__that_alt).__value);
},
- *this, std::forward<_That>(__that));
+ *this,
+ std::forward<_That>(__that));
}
}
};
@@ -1074,104 +929,88 @@ protected:
template <class _Traits, _Trait = _Traits::__move_assignable_trait>
class _LIBCPP_TEMPLATE_VIS __move_assignment;
-#define _LIBCPP_VARIANT_MOVE_ASSIGNMENT(move_assignable_trait, \
- move_assignment) \
- template <class... _Types> \
- class _LIBCPP_TEMPLATE_VIS __move_assignment<__traits<_Types...>, \
- move_assignable_trait> \
- : public __assignment<__traits<_Types...>> { \
- using __base_type = __assignment<__traits<_Types...>>; \
- \
- public: \
- using __base_type::__base_type; \
- using __base_type::operator=; \
- \
- __move_assignment(const __move_assignment&) = default; \
- __move_assignment(__move_assignment&&) = default; \
- ~__move_assignment() = default; \
- __move_assignment& operator=(const __move_assignment&) = default; \
- move_assignment \
- }
+# define _LIBCPP_VARIANT_MOVE_ASSIGNMENT(move_assignable_trait, move_assignment) \
+ template <class... _Types> \
+ class _LIBCPP_TEMPLATE_VIS __move_assignment<__traits<_Types...>, move_assignable_trait> \
+ : public __assignment<__traits<_Types...>> { \
+ using __base_type = __assignment<__traits<_Types...>>; \
+ \
+ public: \
+ using __base_type::__base_type; \
+ using __base_type::operator=; \
+ \
+ __move_assignment(const __move_assignment&) = default; \
+ __move_assignment(__move_assignment&&) = default; \
+ ~__move_assignment() = default; \
+ __move_assignment& operator=(const __move_assignment&) = default; \
+ move_assignment \
+ }
-_LIBCPP_VARIANT_MOVE_ASSIGNMENT(
- _Trait::_TriviallyAvailable,
- __move_assignment& operator=(__move_assignment&& __that) = default;);
+_LIBCPP_VARIANT_MOVE_ASSIGNMENT(_Trait::_TriviallyAvailable,
+ __move_assignment& operator=(__move_assignment&& __that) = default;);
_LIBCPP_VARIANT_MOVE_ASSIGNMENT(
_Trait::_Available,
- __move_assignment& operator=(__move_assignment&& __that) noexcept(
- __all<(is_nothrow_move_constructible_v<_Types> &&
- is_nothrow_move_assignable_v<_Types>)...>::value) {
+ __move_assignment&
+ operator=(__move_assignment&& __that) noexcept(
+ __all<(is_nothrow_move_constructible_v<_Types> && is_nothrow_move_assignable_v<_Types>)...>::value) {
this->__generic_assign(std::move(__that));
return *this;
});
-_LIBCPP_VARIANT_MOVE_ASSIGNMENT(
- _Trait::_Unavailable,
- __move_assignment& operator=(__move_assignment&&) = delete;);
+_LIBCPP_VARIANT_MOVE_ASSIGNMENT(_Trait::_Unavailable, __move_assignment& operator=(__move_assignment&&) = delete;);
-#undef _LIBCPP_VARIANT_MOVE_ASSIGNMENT
+# undef _LIBCPP_VARIANT_MOVE_ASSIGNMENT
template <class _Traits, _Trait = _Traits::__copy_assignable_trait>
class _LIBCPP_TEMPLATE_VIS __copy_assignment;
-#define _LIBCPP_VARIANT_COPY_ASSIGNMENT(copy_assignable_trait, \
- copy_assignment) \
- template <class... _Types> \
- class _LIBCPP_TEMPLATE_VIS __copy_assignment<__traits<_Types...>, \
- copy_assignable_trait> \
- : public __move_assignment<__traits<_Types...>> { \
- using __base_type = __move_assignment<__traits<_Types...>>; \
- \
- public: \
- using __base_type::__base_type; \
- using __base_type::operator=; \
- \
- __copy_assignment(const __copy_assignment&) = default; \
- __copy_assignment(__copy_assignment&&) = default; \
- ~__copy_assignment() = default; \
- copy_assignment \
- __copy_assignment& operator=(__copy_assignment&&) = default; \
- }
+# define _LIBCPP_VARIANT_COPY_ASSIGNMENT(copy_assignable_trait, copy_assignment) \
+ template <class... _Types> \
+ class _LIBCPP_TEMPLATE_VIS __copy_assignment<__traits<_Types...>, copy_assignable_trait> \
+ : public __move_assignment<__traits<_Types...>> { \
+ using __base_type = __move_assignment<__traits<_Types...>>; \
+ \
+ public: \
+ using __base_type::__base_type; \
+ using __base_type::operator=; \
+ \
+ __copy_assignment(const __copy_assignment&) = default; \
+ __copy_assignment(__copy_assignment&&) = default; \
+ ~__copy_assignment() = default; \
+ copy_assignment __copy_assignment& operator=(__copy_assignment&&) = default; \
+ }
-_LIBCPP_VARIANT_COPY_ASSIGNMENT(
- _Trait::_TriviallyAvailable,
- __copy_assignment& operator=(const __copy_assignment& __that) = default;);
+_LIBCPP_VARIANT_COPY_ASSIGNMENT(_Trait::_TriviallyAvailable,
+ __copy_assignment& operator=(const __copy_assignment& __that) = default;);
_LIBCPP_VARIANT_COPY_ASSIGNMENT(
- _Trait::_Available,
- __copy_assignment& operator=(const __copy_assignment& __that) {
+ _Trait::_Available, __copy_assignment& operator=(const __copy_assignment& __that) {
this->__generic_assign(__that);
return *this;
});
-_LIBCPP_VARIANT_COPY_ASSIGNMENT(
- _Trait::_Unavailable,
- __copy_assignment& operator=(const __copy_assignment&) = delete;);
+_LIBCPP_VARIANT_COPY_ASSIGNMENT(_Trait::_Unavailable, __copy_assignment& operator=(const __copy_assignment&) = delete;);
-#undef _LIBCPP_VARIANT_COPY_ASSIGNMENT
+# undef _LIBCPP_VARIANT_COPY_ASSIGNMENT
template <class... _Types>
-class _LIBCPP_TEMPLATE_VIS __impl
- : public __copy_assignment<__traits<_Types...>> {
+class _LIBCPP_TEMPLATE_VIS __impl : public __copy_assignment<__traits<_Types...>> {
using __base_type = __copy_assignment<__traits<_Types...>>;
public:
using __base_type::__base_type; // get in_place_index_t constructor & friends
- _LIBCPP_HIDE_FROM_ABI __impl(__impl const&) = default;
- _LIBCPP_HIDE_FROM_ABI __impl(__impl&&) = default;
+ _LIBCPP_HIDE_FROM_ABI __impl(__impl const&) = default;
+ _LIBCPP_HIDE_FROM_ABI __impl(__impl&&) = default;
_LIBCPP_HIDE_FROM_ABI __impl& operator=(__impl const&) = default;
- _LIBCPP_HIDE_FROM_ABI __impl& operator=(__impl&&) = default;
+ _LIBCPP_HIDE_FROM_ABI __impl& operator=(__impl&&) = default;
template <size_t _Ip, class _Arg>
- _LIBCPP_HIDE_FROM_ABI
- void __assign(_Arg&& __arg) {
- this->__assign_alt(__access::__base::__get_alt<_Ip>(*this),
- std::forward<_Arg>(__arg));
+ _LIBCPP_HIDE_FROM_ABI void __assign(_Arg&& __arg) {
+ this->__assign_alt(__access::__base::__get_alt<_Ip>(*this), std::forward<_Arg>(__arg));
}
- inline _LIBCPP_HIDE_FROM_ABI
- void __swap(__impl& __that) {
+ inline _LIBCPP_HIDE_FROM_ABI void __swap(__impl& __that) {
if (this->valueless_by_exception() && __that.valueless_by_exception()) {
// do nothing.
} else if (this->index() == __that.index()) {
@@ -1190,7 +1029,7 @@ public:
std::swap(__lhs, __rhs);
}
__impl __tmp(std::move(*__rhs));
-#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
+# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
if constexpr (__all<is_nothrow_move_constructible_v<_Types>...>::value) {
this->__generic_construct(*__rhs, std::move(*__lhs));
} else {
@@ -1206,18 +1045,17 @@ public:
throw;
}
}
-#else
+# else
// this isn't consolidated with the `if constexpr` branch above due to
// `throw` being ill-formed with exceptions disabled even when discarded.
this->__generic_construct(*__rhs, std::move(*__lhs));
-#endif
+# endif
this->__generic_construct(*__lhs, std::move(__tmp));
}
}
private:
- inline _LIBCPP_HIDE_FROM_ABI
- bool __move_nothrow() const {
+ inline _LIBCPP_HIDE_FROM_ABI bool __move_nothrow() const {
constexpr bool __results[] = {is_nothrow_move_constructible_v<_Types>...};
return this->valueless_by_exception() || __results[this->index()];
}
@@ -1236,15 +1074,13 @@ struct __narrowing_check {
};
template <class _Dest, class _Source>
-using __check_for_narrowing _LIBCPP_NODEBUG =
- typename _If<
-#ifdef _LIBCPP_ENABLE_NARROWING_CONVERSIONS_IN_VARIANT
+using __check_for_narrowing _LIBCPP_NODEBUG = typename _If<
+# ifdef _LIBCPP_ENABLE_NARROWING_CONVERSIONS_IN_VARIANT
false &&
-#endif
- is_arithmetic<_Dest>::value,
+# endif
+ is_arithmetic<_Dest>::value,
__narrowing_check,
- __no_narrowing_check
- >::template _Apply<_Dest, _Source>;
+ __no_narrowing_check >::template _Apply<_Dest, _Source>;
template <class _Tp, size_t _Idx>
struct __overload {
@@ -1253,12 +1089,11 @@ struct __overload {
};
// TODO(LLVM-19): Remove all occurrences of this macro.
-#ifdef _LIBCPP_ENABLE_NARROWING_CONVERSIONS_IN_VARIANT
+# ifdef _LIBCPP_ENABLE_NARROWING_CONVERSIONS_IN_VARIANT
template <class _Tp, size_t>
-struct __overload_bool {
+struct __overload_bool {
template <class _Up, class _Ap = __remove_cvref_t<_Up>>
- auto operator()(bool, _Up&&) const
- -> enable_if_t<is_same_v<_Ap, bool>, __type_identity<_Tp>>;
+ auto operator()(bool, _Up&&) const -> enable_if_t<is_same_v<_Ap, bool>, __type_identity<_Tp>>;
};
template <size_t _Idx>
@@ -1269,9 +1104,9 @@ template <size_t _Idx>
struct __overload<bool volatile, _Idx> : __overload_bool<bool volatile, _Idx> {};
template <size_t _Idx>
struct __overload<bool const volatile, _Idx> : __overload_bool<bool const volatile, _Idx> {};
-#endif
+# endif
-template <class ..._Bases>
+template <class... _Bases>
struct __all_overloads : _Bases... {
void operator()() const;
using _Bases::operator()...;
@@ -1280,213 +1115,161 @@ struct __all_overloads : _Bases... {
template <class _IdxSeq>
struct __make_overloads_imp;
-template <size_t ..._Idx>
+template <size_t... _Idx>
struct __make_overloads_imp<__tuple_indices<_Idx...> > {
- template <class ..._Types>
+ template <class... _Types>
using _Apply _LIBCPP_NODEBUG = __all_overloads<__overload<_Types, _Idx>...>;
};
-template <class ..._Types>
-using _MakeOverloads _LIBCPP_NODEBUG = typename __make_overloads_imp<
- __make_indices_imp<sizeof...(_Types), 0> >::template _Apply<_Types...>;
+template <class... _Types>
+using _MakeOverloads _LIBCPP_NODEBUG =
+ typename __make_overloads_imp< __make_indices_imp<sizeof...(_Types), 0> >::template _Apply<_Types...>;
template <class _Tp, class... _Types>
-using __best_match_t =
- typename invoke_result_t<_MakeOverloads<_Types...>, _Tp, _Tp>::type;
+using __best_match_t = typename invoke_result_t<_MakeOverloads<_Types...>, _Tp, _Tp>::type;
} // namespace __variant_detail
template <class... _Types>
class _LIBCPP_TEMPLATE_VIS _LIBCPP_DECLSPEC_EMPTY_BASES variant
- : private __sfinae_ctor_base<
- __all<is_copy_constructible_v<_Types>...>::value,
- __all<is_move_constructible_v<_Types>...>::value>,
+ : private __sfinae_ctor_base< __all<is_copy_constructible_v<_Types>...>::value,
+ __all<is_move_constructible_v<_Types>...>::value>,
private __sfinae_assign_base<
- __all<(is_copy_constructible_v<_Types> &&
- is_copy_assignable_v<_Types>)...>::value,
- __all<(is_move_constructible_v<_Types> &&
- is_move_assignable_v<_Types>)...>::value> {
- static_assert(0 < sizeof...(_Types),
- "variant must consist of at least one alternative.");
+ __all<(is_copy_constructible_v<_Types> && is_copy_assignable_v<_Types>)...>::value,
+ __all<(is_move_constructible_v<_Types> && is_move_assignable_v<_Types>)...>::value> {
+ static_assert(0 < sizeof...(_Types), "variant must consist of at least one alternative.");
- static_assert(__all<!is_array_v<_Types>...>::value,
- "variant can not have an array type as an alternative.");
+ static_assert(__all<!is_array_v<_Types>...>::value, "variant can not have an array type as an alternative.");
- static_assert(__all<!is_reference_v<_Types>...>::value,
- "variant can not have a reference type as an alternative.");
+ static_assert(__all<!is_reference_v<_Types>...>::value, "variant can not have a reference type as an alternative.");
- static_assert(__all<!is_void_v<_Types>...>::value,
- "variant can not have a void type as an alternative.");
+ static_assert(__all<!is_void_v<_Types>...>::value, "variant can not have a void type as an alternative.");
using __first_type = variant_alternative_t<0, variant>;
public:
- template <bool _Dummy = true,
- enable_if_t<__dependent_type<is_default_constructible<__first_type>,
- _Dummy>::value,
- int> = 0>
- _LIBCPP_HIDE_FROM_ABI
- constexpr variant() noexcept(is_nothrow_default_constructible_v<__first_type>)
+ template <bool _Dummy = true,
+ enable_if_t<__dependent_type<is_default_constructible<__first_type>, _Dummy>::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI constexpr variant() noexcept(is_nothrow_default_constructible_v<__first_type>)
: __impl_(in_place_index<0>) {}
_LIBCPP_HIDE_FROM_ABI constexpr variant(const variant&) = default;
- _LIBCPP_HIDE_FROM_ABI constexpr variant(variant&&) = default;
-
- template <
- class _Arg,
- enable_if_t<!is_same_v<__remove_cvref_t<_Arg>, variant>, int> = 0,
- enable_if_t<!__is_inplace_type<__remove_cvref_t<_Arg>>::value, int> = 0,
- enable_if_t<!__is_inplace_index<__remove_cvref_t<_Arg>>::value, int> = 0,
- class _Tp = __variant_detail::__best_match_t<_Arg, _Types...>,
- size_t _Ip =
- __find_detail::__find_unambiguous_index_sfinae<_Tp, _Types...>::value,
- enable_if_t<is_constructible_v<_Tp, _Arg>, int> = 0>
- _LIBCPP_HIDE_FROM_ABI
- constexpr variant(_Arg&& __arg) noexcept(
- is_nothrow_constructible_v<_Tp, _Arg>)
+ _LIBCPP_HIDE_FROM_ABI constexpr variant(variant&&) = default;
+
+ template < class _Arg,
+ enable_if_t<!is_same_v<__remove_cvref_t<_Arg>, variant>, int> = 0,
+ enable_if_t<!__is_inplace_type<__remove_cvref_t<_Arg>>::value, int> = 0,
+ enable_if_t<!__is_inplace_index<__remove_cvref_t<_Arg>>::value, int> = 0,
+ class _Tp = __variant_detail::__best_match_t<_Arg, _Types...>,
+ size_t _Ip = __find_detail::__find_unambiguous_index_sfinae<_Tp, _Types...>::value,
+ enable_if_t<is_constructible_v<_Tp, _Arg>, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI constexpr variant(_Arg&& __arg) noexcept(is_nothrow_constructible_v<_Tp, _Arg>)
: __impl_(in_place_index<_Ip>, std::forward<_Arg>(__arg)) {}
- template <size_t _Ip, class... _Args,
- class = enable_if_t<(_Ip < sizeof...(_Types)), int>,
- class _Tp = variant_alternative_t<_Ip, variant<_Types...>>,
+ template <size_t _Ip,
+ class... _Args,
+ class = enable_if_t<(_Ip < sizeof...(_Types)), int>,
+ class _Tp = variant_alternative_t<_Ip, variant<_Types...>>,
enable_if_t<is_constructible_v<_Tp, _Args...>, int> = 0>
- _LIBCPP_HIDE_FROM_ABI
- explicit constexpr variant(
- in_place_index_t<_Ip>,
- _Args&&... __args) noexcept(is_nothrow_constructible_v<_Tp, _Args...>)
+ _LIBCPP_HIDE_FROM_ABI explicit constexpr variant(in_place_index_t<_Ip>, _Args&&... __args) noexcept(
+ is_nothrow_constructible_v<_Tp, _Args...>)
: __impl_(in_place_index<_Ip>, std::forward<_Args>(__args)...) {}
- template <
- size_t _Ip,
- class _Up,
- class... _Args,
- enable_if_t<(_Ip < sizeof...(_Types)), int> = 0,
- class _Tp = variant_alternative_t<_Ip, variant<_Types...>>,
- enable_if_t<is_constructible_v<_Tp, initializer_list<_Up>&, _Args...>,
- int> = 0>
- _LIBCPP_HIDE_FROM_ABI
- explicit constexpr variant(
+ template < size_t _Ip,
+ class _Up,
+ class... _Args,
+ enable_if_t<(_Ip < sizeof...(_Types)), int> = 0,
+ class _Tp = variant_alternative_t<_Ip, variant<_Types...>>,
+ enable_if_t<is_constructible_v<_Tp, initializer_list<_Up>&, _Args...>, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI explicit constexpr variant(
in_place_index_t<_Ip>,
initializer_list<_Up> __il,
- _Args&&... __args) noexcept(
- is_nothrow_constructible_v<_Tp, initializer_list<_Up>&, _Args...>)
+ _Args&&... __args) noexcept(is_nothrow_constructible_v<_Tp, initializer_list<_Up>&, _Args...>)
: __impl_(in_place_index<_Ip>, __il, std::forward<_Args>(__args)...) {}
- template <
- class _Tp,
- class... _Args,
- size_t _Ip =
- __find_detail::__find_unambiguous_index_sfinae<_Tp, _Types...>::value,
- enable_if_t<is_constructible_v<_Tp, _Args...>, int> = 0>
- _LIBCPP_HIDE_FROM_ABI
- explicit constexpr variant(in_place_type_t<_Tp>, _Args&&... __args) noexcept(
+ template < class _Tp,
+ class... _Args,
+ size_t _Ip = __find_detail::__find_unambiguous_index_sfinae<_Tp, _Types...>::value,
+ enable_if_t<is_constructible_v<_Tp, _Args...>, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI explicit constexpr variant(in_place_type_t<_Tp>, _Args&&... __args) noexcept(
is_nothrow_constructible_v<_Tp, _Args...>)
: __impl_(in_place_index<_Ip>, std::forward<_Args>(__args)...) {}
- template <
- class _Tp,
- class _Up,
- class... _Args,
- size_t _Ip =
- __find_detail::__find_unambiguous_index_sfinae<_Tp, _Types...>::value,
- enable_if_t<is_constructible_v<_Tp, initializer_list<_Up>&, _Args...>,
- int> = 0>
- _LIBCPP_HIDE_FROM_ABI
- explicit constexpr variant(
+ template < class _Tp,
+ class _Up,
+ class... _Args,
+ size_t _Ip = __find_detail::__find_unambiguous_index_sfinae<_Tp, _Types...>::value,
+ enable_if_t<is_constructible_v<_Tp, initializer_list<_Up>&, _Args...>, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI explicit constexpr variant(
in_place_type_t<_Tp>,
initializer_list<_Up> __il,
- _Args&&... __args) noexcept(
- is_nothrow_constructible_v<_Tp, initializer_list< _Up>&, _Args...>)
+ _Args&&... __args) noexcept(is_nothrow_constructible_v<_Tp, initializer_list< _Up>&, _Args...>)
: __impl_(in_place_index<_Ip>, __il, std::forward<_Args>(__args)...) {}
_LIBCPP_HIDE_FROM_ABI ~variant() = default;
_LIBCPP_HIDE_FROM_ABI constexpr variant& operator=(const variant&) = default;
- _LIBCPP_HIDE_FROM_ABI constexpr variant& operator=(variant&&) = default;
-
- template <
- class _Arg,
- enable_if_t<!is_same_v<__remove_cvref_t<_Arg>, variant>, int> = 0,
- class _Tp = __variant_detail::__best_match_t<_Arg, _Types...>,
- size_t _Ip =
- __find_detail::__find_unambiguous_index_sfinae<_Tp, _Types...>::value,
- enable_if_t<is_assignable_v<_Tp&, _Arg> && is_constructible_v<_Tp, _Arg>,
- int> = 0>
- _LIBCPP_HIDE_FROM_ABI
- variant& operator=(_Arg&& __arg) noexcept(
- is_nothrow_assignable_v<_Tp&, _Arg> &&
- is_nothrow_constructible_v<_Tp, _Arg>) {
+ _LIBCPP_HIDE_FROM_ABI constexpr variant& operator=(variant&&) = default;
+
+ template < class _Arg,
+ enable_if_t<!is_same_v<__remove_cvref_t<_Arg>, variant>, int> = 0,
+ class _Tp = __variant_detail::__best_match_t<_Arg, _Types...>,
+ size_t _Ip = __find_detail::__find_unambiguous_index_sfinae<_Tp, _Types...>::value,
+ enable_if_t<is_assignable_v<_Tp&, _Arg> && is_constructible_v<_Tp, _Arg>, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI variant&
+ operator=(_Arg&& __arg) noexcept(is_nothrow_assignable_v<_Tp&, _Arg> && is_nothrow_constructible_v<_Tp, _Arg>) {
__impl_.template __assign<_Ip>(std::forward<_Arg>(__arg));
return *this;
}
- template <
- size_t _Ip,
- class... _Args,
- enable_if_t<(_Ip < sizeof...(_Types)), int> = 0,
- class _Tp = variant_alternative_t<_Ip, variant<_Types...>>,
- enable_if_t<is_constructible_v<_Tp, _Args...>, int> = 0>
- _LIBCPP_HIDE_FROM_ABI
- _Tp& emplace(_Args&&... __args) {
+ template < size_t _Ip,
+ class... _Args,
+ enable_if_t<(_Ip < sizeof...(_Types)), int> = 0,
+ class _Tp = variant_alternative_t<_Ip, variant<_Types...>>,
+ enable_if_t<is_constructible_v<_Tp, _Args...>, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI _Tp& emplace(_Args&&... __args) {
return __impl_.template __emplace<_Ip>(std::forward<_Args>(__args)...);
}
- template <
- size_t _Ip,
- class _Up,
- class... _Args,
- enable_if_t<(_Ip < sizeof...(_Types)), int> = 0,
- class _Tp = variant_alternative_t<_Ip, variant<_Types...>>,
- enable_if_t<is_constructible_v<_Tp, initializer_list<_Up>&, _Args...>,
- int> = 0>
- _LIBCPP_HIDE_FROM_ABI
- _Tp& emplace(initializer_list<_Up> __il, _Args&&... __args) {
+ template < size_t _Ip,
+ class _Up,
+ class... _Args,
+ enable_if_t<(_Ip < sizeof...(_Types)), int> = 0,
+ class _Tp = variant_alternative_t<_Ip, variant<_Types...>>,
+ enable_if_t<is_constructible_v<_Tp, initializer_list<_Up>&, _Args...>, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI _Tp& emplace(initializer_list<_Up> __il, _Args&&... __args) {
return __impl_.template __emplace<_Ip>(__il, std::forward<_Args>(__args)...);
}
- template <
- class _Tp,
- class... _Args,
- size_t _Ip =
- __find_detail::__find_unambiguous_index_sfinae<_Tp, _Types...>::value,
- enable_if_t<is_constructible_v<_Tp, _Args...>, int> = 0>
- _LIBCPP_HIDE_FROM_ABI
- _Tp& emplace(_Args&&... __args) {
+ template < class _Tp,
+ class... _Args,
+ size_t _Ip = __find_detail::__find_unambiguous_index_sfinae<_Tp, _Types...>::value,
+ enable_if_t<is_constructible_v<_Tp, _Args...>, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI _Tp& emplace(_Args&&... __args) {
return __impl_.template __emplace<_Ip>(std::forward<_Args>(__args)...);
}
- template <
- class _Tp,
- class _Up,
- class... _Args,
- size_t _Ip =
- __find_detail::__find_unambiguous_index_sfinae<_Tp, _Types...>::value,
- enable_if_t<is_constructible_v<_Tp, initializer_list<_Up>&, _Args...>,
- int> = 0>
- _LIBCPP_HIDE_FROM_ABI
- _Tp& emplace(initializer_list<_Up> __il, _Args&&... __args) {
+ template < class _Tp,
+ class _Up,
+ class... _Args,
+ size_t _Ip = __find_detail::__find_unambiguous_index_sfinae<_Tp, _Types...>::value,
+ enable_if_t<is_constructible_v<_Tp, initializer_list<_Up>&, _Args...>, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI _Tp& emplace(initializer_list<_Up> __il, _Args&&... __args) {
return __impl_.template __emplace<_Ip>(__il, std::forward<_Args>(__args)...);
}
- _LIBCPP_HIDE_FROM_ABI
- constexpr bool valueless_by_exception() const noexcept {
+ _LIBCPP_HIDE_FROM_ABI constexpr bool valueless_by_exception() const noexcept {
return __impl_.valueless_by_exception();
}
- _LIBCPP_HIDE_FROM_ABI
- constexpr size_t index() const noexcept { return __impl_.index(); }
-
- template <
- bool _Dummy = true,
- enable_if_t<
- __all<(
- __dependent_type<is_move_constructible<_Types>, _Dummy>::value &&
- __dependent_type<is_swappable<_Types>, _Dummy>::value)...>::value,
- int> = 0>
- _LIBCPP_HIDE_FROM_ABI
- void swap(variant& __that) noexcept(
- __all<(is_nothrow_move_constructible_v<_Types> &&
- is_nothrow_swappable_v<_Types>)...>::value) {
+ _LIBCPP_HIDE_FROM_ABI constexpr size_t index() const noexcept { return __impl_.index(); }
+
+ template < bool _Dummy = true,
+ enable_if_t< __all<(__dependent_type<is_move_constructible<_Types>, _Dummy>::value &&
+ __dependent_type<is_swappable<_Types>, _Dummy>::value)...>::value,
+ int> = 0>
+ _LIBCPP_HIDE_FROM_ABI void swap(variant& __that) noexcept(
+ __all<(is_nothrow_move_constructible_v<_Types> && is_nothrow_swappable_v<_Types>)...>::value) {
__impl_.__swap(__that.__impl_);
}
@@ -1498,21 +1281,17 @@ private:
};
template <size_t _Ip, class... _Types>
-_LIBCPP_HIDE_FROM_ABI
-constexpr bool __holds_alternative(const variant<_Types...>& __v) noexcept {
+_LIBCPP_HIDE_FROM_ABI constexpr bool __holds_alternative(const variant<_Types...>& __v) noexcept {
return __v.index() == _Ip;
}
template <class _Tp, class... _Types>
-_LIBCPP_HIDE_FROM_ABI
-constexpr bool holds_alternative(const variant<_Types...>& __v) noexcept {
+_LIBCPP_HIDE_FROM_ABI constexpr bool holds_alternative(const variant<_Types...>& __v) noexcept {
return std::__holds_alternative<__find_exactly_one_t<_Tp, _Types...>::value>(__v);
}
template <size_t _Ip, class _Vp>
-_LIBCPP_HIDE_FROM_ABI
-_LIBCPP_AVAILABILITY_THROW_BAD_VARIANT_ACCESS
-constexpr auto&& __generic_get(_Vp&& __v) {
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_THROW_BAD_VARIANT_ACCESS constexpr auto&& __generic_get(_Vp&& __v) {
using __variant_detail::__access::__variant;
if (!std::__holds_alternative<_Ip>(__v)) {
__throw_bad_variant_access();
@@ -1522,9 +1301,8 @@ constexpr auto&& __generic_get(_Vp&& __v) {
template <size_t _Ip, class... _Types>
_LIBCPP_HIDE_FROM_ABI
-_LIBCPP_AVAILABILITY_THROW_BAD_VARIANT_ACCESS
-constexpr variant_alternative_t<_Ip, variant<_Types...>>& get(
- variant<_Types...>& __v) {
+ _LIBCPP_AVAILABILITY_THROW_BAD_VARIANT_ACCESS constexpr variant_alternative_t<_Ip, variant<_Types...>>&
+ get(variant<_Types...>& __v) {
static_assert(_Ip < sizeof...(_Types));
static_assert(!is_void_v<variant_alternative_t<_Ip, variant<_Types...>>>);
return std::__generic_get<_Ip>(__v);
@@ -1532,9 +1310,8 @@ constexpr variant_alternative_t<_Ip, variant<_Types...>>& get(
template <size_t _Ip, class... _Types>
_LIBCPP_HIDE_FROM_ABI
-_LIBCPP_AVAILABILITY_THROW_BAD_VARIANT_ACCESS
-constexpr variant_alternative_t<_Ip, variant<_Types...>>&& get(
- variant<_Types...>&& __v) {
+ _LIBCPP_AVAILABILITY_THROW_BAD_VARIANT_ACCESS constexpr variant_alternative_t<_Ip, variant<_Types...>>&&
+ get(variant<_Types...>&& __v) {
static_assert(_Ip < sizeof...(_Types));
static_assert(!is_void_v<variant_alternative_t<_Ip, variant<_Types...>>>);
return std::__generic_get<_Ip>(std::move(__v));
@@ -1542,9 +1319,8 @@ constexpr variant_alternative_t<_Ip, variant<_Types...>>&& get(
template <size_t _Ip, class... _Types>
_LIBCPP_HIDE_FROM_ABI
-_LIBCPP_AVAILABILITY_THROW_BAD_VARIANT_ACCESS
-constexpr const variant_alternative_t<_Ip, variant<_Types...>>& get(
- const variant<_Types...>& __v) {
+ _LIBCPP_AVAILABILITY_THROW_BAD_VARIANT_ACCESS constexpr const variant_alternative_t<_Ip, variant<_Types...>>&
+ get(const variant<_Types...>& __v) {
static_assert(_Ip < sizeof...(_Types));
static_assert(!is_void_v<variant_alternative_t<_Ip, variant<_Types...>>>);
return std::__generic_get<_Ip>(__v);
@@ -1552,60 +1328,47 @@ constexpr const variant_alternative_t<_Ip, variant<_Types...>>& get(
template <size_t _Ip, class... _Types>
_LIBCPP_HIDE_FROM_ABI
-_LIBCPP_AVAILABILITY_THROW_BAD_VARIANT_ACCESS
-constexpr const variant_alternative_t<_Ip, variant<_Types...>>&& get(
- const variant<_Types...>&& __v) {
+ _LIBCPP_AVAILABILITY_THROW_BAD_VARIANT_ACCESS constexpr const variant_alternative_t<_Ip, variant<_Types...>>&&
+ get(const variant<_Types...>&& __v) {
static_assert(_Ip < sizeof...(_Types));
static_assert(!is_void_v<variant_alternative_t<_Ip, variant<_Types...>>>);
return std::__generic_get<_Ip>(std::move(__v));
}
template <class _Tp, class... _Types>
-_LIBCPP_HIDE_FROM_ABI
-_LIBCPP_AVAILABILITY_THROW_BAD_VARIANT_ACCESS
-constexpr _Tp& get(variant<_Types...>& __v) {
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_THROW_BAD_VARIANT_ACCESS constexpr _Tp& get(variant<_Types...>& __v) {
static_assert(!is_void_v<_Tp>);
return std::get<__find_exactly_one_t<_Tp, _Types...>::value>(__v);
}
template <class _Tp, class... _Types>
-_LIBCPP_HIDE_FROM_ABI
-_LIBCPP_AVAILABILITY_THROW_BAD_VARIANT_ACCESS
-constexpr _Tp&& get(variant<_Types...>&& __v) {
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_THROW_BAD_VARIANT_ACCESS constexpr _Tp&& get(variant<_Types...>&& __v) {
static_assert(!is_void_v<_Tp>);
- return std::get<__find_exactly_one_t<_Tp, _Types...>::value>(
- std::move(__v));
+ return std::get<__find_exactly_one_t<_Tp, _Types...>::value>(std::move(__v));
}
template <class _Tp, class... _Types>
-_LIBCPP_HIDE_FROM_ABI
-_LIBCPP_AVAILABILITY_THROW_BAD_VARIANT_ACCESS
-constexpr const _Tp& get(const variant<_Types...>& __v) {
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_THROW_BAD_VARIANT_ACCESS constexpr const _Tp&
+get(const variant<_Types...>& __v) {
static_assert(!is_void_v<_Tp>);
return std::get<__find_exactly_one_t<_Tp, _Types...>::value>(__v);
}
template <class _Tp, class... _Types>
-_LIBCPP_HIDE_FROM_ABI
-_LIBCPP_AVAILABILITY_THROW_BAD_VARIANT_ACCESS
-constexpr const _Tp&& get(const variant<_Types...>&& __v) {
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_THROW_BAD_VARIANT_ACCESS constexpr const _Tp&&
+get(const variant<_Types...>&& __v) {
static_assert(!is_void_v<_Tp>);
- return std::get<__find_exactly_one_t<_Tp, _Types...>::value>(
- std::move(__v));
+ return std::get<__find_exactly_one_t<_Tp, _Types...>::value>(std::move(__v));
}
template <size_t _Ip, class _Vp>
-_LIBCPP_HIDE_FROM_ABI
-constexpr auto* __generic_get_if(_Vp* __v) noexcept {
+_LIBCPP_HIDE_FROM_ABI constexpr auto* __generic_get_if(_Vp* __v) noexcept {
using __variant_detail::__access::__variant;
- return __v && std::__holds_alternative<_Ip>(*__v)
- ? std::addressof(__variant::__get_alt<_Ip>(*__v).__value)
- : nullptr;
+ return __v && std::__holds_alternative<_Ip>(*__v) ? std::addressof(__variant::__get_alt<_Ip>(*__v).__value) : nullptr;
}
template <size_t _Ip, class... _Types>
-_LIBCPP_HIDE_FROM_ABI
-constexpr add_pointer_t<variant_alternative_t<_Ip, variant<_Types...>>>
+_LIBCPP_HIDE_FROM_ABI constexpr add_pointer_t<variant_alternative_t<_Ip, variant<_Types...>>>
get_if(variant<_Types...>* __v) noexcept {
static_assert(_Ip < sizeof...(_Types));
static_assert(!is_void_v<variant_alternative_t<_Ip, variant<_Types...>>>);
@@ -1613,8 +1376,7 @@ get_if(variant<_Types...>* __v) noexcept {
}
template <size_t _Ip, class... _Types>
-_LIBCPP_HIDE_FROM_ABI
-constexpr add_pointer_t<const variant_alternative_t<_Ip, variant<_Types...>>>
+_LIBCPP_HIDE_FROM_ABI constexpr add_pointer_t<const variant_alternative_t<_Ip, variant<_Types...>>>
get_if(const variant<_Types...>* __v) noexcept {
static_assert(_Ip < sizeof...(_Types));
static_assert(!is_void_v<variant_alternative_t<_Ip, variant<_Types...>>>);
@@ -1622,17 +1384,13 @@ get_if(const variant<_Types...>* __v) noexcept {
}
template <class _Tp, class... _Types>
-_LIBCPP_HIDE_FROM_ABI
-constexpr add_pointer_t<_Tp>
-get_if(variant<_Types...>* __v) noexcept {
+_LIBCPP_HIDE_FROM_ABI constexpr add_pointer_t<_Tp> get_if(variant<_Types...>* __v) noexcept {
static_assert(!is_void_v<_Tp>);
return std::get_if<__find_exactly_one_t<_Tp, _Types...>::value>(__v);
}
template <class _Tp, class... _Types>
-_LIBCPP_HIDE_FROM_ABI
-constexpr add_pointer_t<const _Tp>
-get_if(const variant<_Types...>* __v) noexcept {
+_LIBCPP_HIDE_FROM_ABI constexpr add_pointer_t<const _Tp> get_if(const variant<_Types...>* __v) noexcept {
static_assert(!is_void_v<_Tp>);
return std::get_if<__find_exactly_one_t<_Tp, _Types...>::value>(__v);
}
@@ -1640,27 +1398,27 @@ get_if(const variant<_Types...>* __v) noexcept {
template <class _Operator>
struct __convert_to_bool {
template <class _T1, class _T2>
- _LIBCPP_HIDE_FROM_ABI
- constexpr bool operator()(_T1 && __t1, _T2&& __t2) const {
+ _LIBCPP_HIDE_FROM_ABI constexpr bool operator()(_T1&& __t1, _T2&& __t2) const {
static_assert(is_convertible<decltype(_Operator{}(std::forward<_T1>(__t1), std::forward<_T2>(__t2))), bool>::value,
- "the relational operator does not return a type which is implicitly convertible to bool");
+ "the relational operator does not return a type which is implicitly convertible to bool");
return _Operator{}(std::forward<_T1>(__t1), std::forward<_T2>(__t2));
}
};
template <class... _Types>
-_LIBCPP_HIDE_FROM_ABI
-constexpr bool operator==(const variant<_Types...>& __lhs,
- const variant<_Types...>& __rhs) {
+_LIBCPP_HIDE_FROM_ABI constexpr bool operator==(const variant<_Types...>& __lhs, const variant<_Types...>& __rhs) {
using __variant_detail::__visitation::__variant;
- if (__lhs.index() != __rhs.index()) return false;
- if (__lhs.valueless_by_exception()) return true;
+ if (__lhs.index() != __rhs.index())
+ return false;
+ if (__lhs.valueless_by_exception())
+ return true;
return __variant::__visit_value_at(__lhs.index(), __convert_to_bool<equal_to<>>{}, __lhs, __rhs);
}
# if _LIBCPP_STD_VER >= 20
-template <class... _Types> requires (three_way_comparable<_Types> && ...)
+template <class... _Types>
+ requires(three_way_comparable<_Types> && ...)
_LIBCPP_HIDE_FROM_ABI constexpr common_comparison_category_t<compare_three_way_result_t<_Types>...>
operator<=>(const variant<_Types...>& __lhs, const variant<_Types...>& __rhs) {
using __variant_detail::__visitation::__variant;
@@ -1680,130 +1438,124 @@ operator<=>(const variant<_Types...>& __lhs, const variant<_Types...>& __rhs) {
# endif // _LIBCPP_STD_VER >= 20
template <class... _Types>
-_LIBCPP_HIDE_FROM_ABI
-constexpr bool operator!=(const variant<_Types...>& __lhs,
- const variant<_Types...>& __rhs) {
+_LIBCPP_HIDE_FROM_ABI constexpr bool operator!=(const variant<_Types...>& __lhs, const variant<_Types...>& __rhs) {
using __variant_detail::__visitation::__variant;
- if (__lhs.index() != __rhs.index()) return true;
- if (__lhs.valueless_by_exception()) return false;
- return __variant::__visit_value_at(
- __lhs.index(), __convert_to_bool<not_equal_to<>>{}, __lhs, __rhs);
+ if (__lhs.index() != __rhs.index())
+ return true;
+ if (__lhs.valueless_by_exception())
+ return false;
+ return __variant::__visit_value_at(__lhs.index(), __convert_to_bool<not_equal_to<>>{}, __lhs, __rhs);
}
template <class... _Types>
-_LIBCPP_HIDE_FROM_ABI
-constexpr bool operator<(const variant<_Types...>& __lhs,
- const variant<_Types...>& __rhs) {
+_LIBCPP_HIDE_FROM_ABI constexpr bool operator<(const variant<_Types...>& __lhs, const variant<_Types...>& __rhs) {
using __variant_detail::__visitation::__variant;
- if (__rhs.valueless_by_exception()) return false;
- if (__lhs.valueless_by_exception()) return true;
- if (__lhs.index() < __rhs.index()) return true;
- if (__lhs.index() > __rhs.index()) return false;
+ if (__rhs.valueless_by_exception())
+ return false;
+ if (__lhs.valueless_by_exception())
+ return true;
+ if (__lhs.index() < __rhs.index())
+ return true;
+ if (__lhs.index() > __rhs.index())
+ return false;
return __variant::__visit_value_at(__lhs.index(), __convert_to_bool<less<>>{}, __lhs, __rhs);
}
template <class... _Types>
-_LIBCPP_HIDE_FROM_ABI
-constexpr bool operator>(const variant<_Types...>& __lhs,
- const variant<_Types...>& __rhs) {
+_LIBCPP_HIDE_FROM_ABI constexpr bool operator>(const variant<_Types...>& __lhs, const variant<_Types...>& __rhs) {
using __variant_detail::__visitation::__variant;
- if (__lhs.valueless_by_exception()) return false;
- if (__rhs.valueless_by_exception()) return true;
- if (__lhs.index() > __rhs.index()) return true;
- if (__lhs.index() < __rhs.index()) return false;
+ if (__lhs.valueless_by_exception())
+ return false;
+ if (__rhs.valueless_by_exception())
+ return true;
+ if (__lhs.index() > __rhs.index())
+ return true;
+ if (__lhs.index() < __rhs.index())
+ return false;
return __variant::__visit_value_at(__lhs.index(), __convert_to_bool<greater<>>{}, __lhs, __rhs);
}
template <class... _Types>
-_LIBCPP_HIDE_FROM_ABI
-constexpr bool operator<=(const variant<_Types...>& __lhs,
- const variant<_Types...>& __rhs) {
+_LIBCPP_HIDE_FROM_ABI constexpr bool operator<=(const variant<_Types...>& __lhs, const variant<_Types...>& __rhs) {
using __variant_detail::__visitation::__variant;
- if (__lhs.valueless_by_exception()) return true;
- if (__rhs.valueless_by_exception()) return false;
- if (__lhs.index() < __rhs.index()) return true;
- if (__lhs.index() > __rhs.index()) return false;
- return __variant::__visit_value_at(
- __lhs.index(), __convert_to_bool<less_equal<>>{}, __lhs, __rhs);
+ if (__lhs.valueless_by_exception())
+ return true;
+ if (__rhs.valueless_by_exception())
+ return false;
+ if (__lhs.index() < __rhs.index())
+ return true;
+ if (__lhs.index() > __rhs.index())
+ return false;
+ return __variant::__visit_value_at(__lhs.index(), __convert_to_bool<less_equal<>>{}, __lhs, __rhs);
}
template <class... _Types>
-_LIBCPP_HIDE_FROM_ABI
-constexpr bool operator>=(const variant<_Types...>& __lhs,
- const variant<_Types...>& __rhs) {
+_LIBCPP_HIDE_FROM_ABI constexpr bool operator>=(const variant<_Types...>& __lhs, const variant<_Types...>& __rhs) {
using __variant_detail::__visitation::__variant;
- if (__rhs.valueless_by_exception()) return true;
- if (__lhs.valueless_by_exception()) return false;
- if (__lhs.index() > __rhs.index()) return true;
- if (__lhs.index() < __rhs.index()) return false;
- return __variant::__visit_value_at(
- __lhs.index(), __convert_to_bool<greater_equal<>>{}, __lhs, __rhs);
+ if (__rhs.valueless_by_exception())
+ return true;
+ if (__lhs.valueless_by_exception())
+ return false;
+ if (__lhs.index() > __rhs.index())
+ return true;
+ if (__lhs.index() < __rhs.index())
+ return false;
+ return __variant::__visit_value_at(__lhs.index(), __convert_to_bool<greater_equal<>>{}, __lhs, __rhs);
}
template <class... _Vs>
-_LIBCPP_HIDE_FROM_ABI
-_LIBCPP_AVAILABILITY_THROW_BAD_VARIANT_ACCESS
-constexpr void __throw_if_valueless(_Vs&&... __vs) {
- const bool __valueless =
- (... || std::__as_variant(__vs).valueless_by_exception());
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_THROW_BAD_VARIANT_ACCESS constexpr void __throw_if_valueless(_Vs&&... __vs) {
+ const bool __valueless = (... || std::__as_variant(__vs).valueless_by_exception());
if (__valueless) {
__throw_bad_variant_access();
}
}
-template <
- class _Visitor, class... _Vs,
- typename = void_t<decltype(std::__as_variant(std::declval<_Vs>()))...> >
-_LIBCPP_HIDE_FROM_ABI
-_LIBCPP_AVAILABILITY_THROW_BAD_VARIANT_ACCESS
-constexpr decltype(auto) visit(_Visitor&& __visitor, _Vs&&... __vs) {
+template < class _Visitor, class... _Vs, typename = void_t<decltype(std::__as_variant(std::declval<_Vs>()))...> >
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_THROW_BAD_VARIANT_ACCESS constexpr decltype(auto)
+visit(_Visitor&& __visitor, _Vs&&... __vs) {
using __variant_detail::__visitation::__variant;
std::__throw_if_valueless(std::forward<_Vs>(__vs)...);
- return __variant::__visit_value(std::forward<_Visitor>(__visitor),
- std::forward<_Vs>(__vs)...);
+ return __variant::__visit_value(std::forward<_Visitor>(__visitor), std::forward<_Vs>(__vs)...);
}
-#if _LIBCPP_STD_VER >= 20
-template <
- class _Rp, class _Visitor, class... _Vs,
- typename = void_t<decltype(std::__as_variant(std::declval<_Vs>()))...> >
-_LIBCPP_HIDE_FROM_ABI
-_LIBCPP_AVAILABILITY_THROW_BAD_VARIANT_ACCESS
-constexpr _Rp visit(_Visitor&& __visitor, _Vs&&... __vs) {
+# if _LIBCPP_STD_VER >= 20
+template < class _Rp,
+ class _Visitor,
+ class... _Vs,
+ typename = void_t<decltype(std::__as_variant(std::declval<_Vs>()))...> >
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_THROW_BAD_VARIANT_ACCESS constexpr _Rp
+visit(_Visitor&& __visitor, _Vs&&... __vs) {
using __variant_detail::__visitation::__variant;
std::__throw_if_valueless(std::forward<_Vs>(__vs)...);
- return __variant::__visit_value<_Rp>(std::forward<_Visitor>(__visitor),
- std::forward<_Vs>(__vs)...);
+ return __variant::__visit_value<_Rp>(std::forward<_Visitor>(__visitor), std::forward<_Vs>(__vs)...);
}
-#endif
+# endif
template <class... _Types>
-_LIBCPP_HIDE_FROM_ABI
-auto swap(variant<_Types...>& __lhs, variant<_Types...>& __rhs)
- noexcept(noexcept(__lhs.swap(__rhs)))
- -> decltype( __lhs.swap(__rhs))
- { return __lhs.swap(__rhs); }
+_LIBCPP_HIDE_FROM_ABI auto
+swap(variant<_Types...>& __lhs, variant<_Types...>& __rhs) noexcept(noexcept(__lhs.swap(__rhs)))
+ -> decltype(__lhs.swap(__rhs)) {
+ return __lhs.swap(__rhs);
+}
template <class... _Types>
-struct _LIBCPP_TEMPLATE_VIS hash<
- __enable_hash_helper<variant<_Types...>, remove_const_t<_Types>...>> {
+struct _LIBCPP_TEMPLATE_VIS hash< __enable_hash_helper<variant<_Types...>, remove_const_t<_Types>...>> {
using argument_type = variant<_Types...>;
- using result_type = size_t;
+ using result_type = size_t;
- _LIBCPP_HIDE_FROM_ABI
- result_type operator()(const argument_type& __v) const {
+ _LIBCPP_HIDE_FROM_ABI result_type operator()(const argument_type& __v) const {
using __variant_detail::__visitation::__variant;
size_t __res =
__v.valueless_by_exception()
- ? 299792458 // Random value chosen by the universe upon creation
- : __variant::__visit_alt(
- [](const auto& __alt) {
- using __alt_type = __remove_cvref_t<decltype(__alt)>;
- using __value_type = remove_const_t<
- typename __alt_type::__value_type>;
- return hash<__value_type>{}(__alt.__value);
- },
- __v);
+ ? 299792458 // Random value chosen by the universe upon creation
+ : __variant::__visit_alt(
+ [](const auto& __alt) {
+ using __alt_type = __remove_cvref_t<decltype(__alt)>;
+ using __value_type = remove_const_t< typename __alt_type::__value_type>;
+ return hash<__value_type>{}(__alt.__value);
+ },
+ __v);
return std::__hash_combine(__res, hash<size_t>{}(__v.index()));
}
};
@@ -1812,21 +1564,18 @@ struct _LIBCPP_TEMPLATE_VIS hash<
// type whereas std::get will throw or returning nullptr. This makes it faster than
// std::get.
template <size_t _Ip, class _Vp>
-_LIBCPP_HIDE_FROM_ABI
-constexpr auto&& __unchecked_get(_Vp&& __v) noexcept {
+_LIBCPP_HIDE_FROM_ABI constexpr auto&& __unchecked_get(_Vp&& __v) noexcept {
using __variant_detail::__access::__variant;
return __variant::__get_alt<_Ip>(std::forward<_Vp>(__v)).__value;
}
template <class _Tp, class... _Types>
-_LIBCPP_HIDE_FROM_ABI
-constexpr auto&& __unchecked_get(const variant<_Types...>& __v) noexcept {
+_LIBCPP_HIDE_FROM_ABI constexpr auto&& __unchecked_get(const variant<_Types...>& __v) noexcept {
return std::__unchecked_get<__find_exactly_one_t<_Tp, _Types...>::value>(__v);
}
template <class _Tp, class... _Types>
-_LIBCPP_HIDE_FROM_ABI
-constexpr auto&& __unchecked_get(variant<_Types...>& __v) noexcept {
+_LIBCPP_HIDE_FROM_ABI constexpr auto&& __unchecked_get(variant<_Types...>& __v) noexcept {
return std::__unchecked_get<__find_exactly_one_t<_Tp, _Types...>::value>(__v);
}
diff --git a/contrib/llvm-project/libcxx/include/vector b/contrib/llvm-project/libcxx/include/vector
index d010a1f6ec9f..0098273a195f 100644
--- a/contrib/llvm-project/libcxx/include/vector
+++ b/contrib/llvm-project/libcxx/include/vector
@@ -384,64 +384,59 @@ _LIBCPP_PUSH_MACROS
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _Tp, class _Allocator /* = allocator<_Tp> */>
-class _LIBCPP_TEMPLATE_VIS vector
-{
+class _LIBCPP_TEMPLATE_VIS vector {
private:
- typedef allocator<_Tp> __default_allocator_type;
+ typedef allocator<_Tp> __default_allocator_type;
+
public:
- typedef vector __self;
- typedef _Tp value_type;
- typedef _Allocator allocator_type;
- typedef allocator_traits<allocator_type> __alloc_traits;
- typedef value_type& reference;
- typedef const value_type& const_reference;
- typedef typename __alloc_traits::size_type size_type;
- typedef typename __alloc_traits::difference_type difference_type;
- typedef typename __alloc_traits::pointer pointer;
- typedef typename __alloc_traits::const_pointer const_pointer;
- // TODO: Implement iterator bounds checking without requiring the global database.
- typedef __wrap_iter<pointer> iterator;
- typedef __wrap_iter<const_pointer> const_iterator;
- typedef std::reverse_iterator<iterator> reverse_iterator;
- typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
-
- static_assert((is_same<typename allocator_type::value_type, value_type>::value),
- "Allocator::value_type must be same type as value_type");
-
- static_assert(is_same<allocator_type, __rebind_alloc<__alloc_traits, value_type> >::value,
- "[allocator.requirements] states that rebinding an allocator to the same type should result in the "
- "original allocator");
-
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI
- vector() _NOEXCEPT_(is_nothrow_default_constructible<allocator_type>::value)
- {
- }
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI explicit vector(const allocator_type& __a)
+ typedef vector __self;
+ typedef _Tp value_type;
+ typedef _Allocator allocator_type;
+ typedef allocator_traits<allocator_type> __alloc_traits;
+ typedef value_type& reference;
+ typedef const value_type& const_reference;
+ typedef typename __alloc_traits::size_type size_type;
+ typedef typename __alloc_traits::difference_type difference_type;
+ typedef typename __alloc_traits::pointer pointer;
+ typedef typename __alloc_traits::const_pointer const_pointer;
+ // TODO: Implement iterator bounds checking without requiring the global database.
+ typedef __wrap_iter<pointer> iterator;
+ typedef __wrap_iter<const_pointer> const_iterator;
+ typedef std::reverse_iterator<iterator> reverse_iterator;
+ typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
+
+ static_assert((is_same<typename allocator_type::value_type, value_type>::value),
+ "Allocator::value_type must be same type as value_type");
+
+ static_assert(is_same<allocator_type, __rebind_alloc<__alloc_traits, value_type> >::value,
+ "[allocator.requirements] states that rebinding an allocator to the same type should result in the "
+ "original allocator");
+
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI vector()
+ _NOEXCEPT_(is_nothrow_default_constructible<allocator_type>::value) {}
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI explicit vector(const allocator_type& __a)
#if _LIBCPP_STD_VER <= 14
- _NOEXCEPT_(is_nothrow_copy_constructible<allocator_type>::value)
+ _NOEXCEPT_(is_nothrow_copy_constructible<allocator_type>::value)
#else
- _NOEXCEPT
+ _NOEXCEPT
#endif
- : __end_cap_(nullptr, __a)
- {
- }
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI explicit vector(size_type __n);
+ : __end_cap_(nullptr, __a) {
+ }
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI explicit vector(size_type __n);
#if _LIBCPP_STD_VER >= 14
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI explicit vector(size_type __n, const allocator_type& __a);
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI explicit vector(size_type __n, const allocator_type& __a);
#endif
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI vector(size_type __n, const value_type& __x);
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI vector(size_type __n, const value_type& __x);
- template <class = __enable_if_t<__is_allocator<_Allocator>::value> >
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI
- vector(size_type __n, const value_type& __x, const allocator_type& __a)
- : __end_cap_(nullptr, __a)
- {
- if (__n > 0)
- {
- __vallocate(__n);
- __construct_at_end(__n, __x);
- }
+ template <class = __enable_if_t<__is_allocator<_Allocator>::value> >
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI
+ vector(size_type __n, const value_type& __x, const allocator_type& __a)
+ : __end_cap_(nullptr, __a) {
+ if (__n > 0) {
+ __vallocate(__n);
+ __construct_at_end(__n, __x);
}
+ }
template <class _InputIterator,
__enable_if_t<__has_exactly_input_iterator_category<_InputIterator>::value &&
@@ -462,7 +457,8 @@ public:
int> = 0>
_LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI vector(_ForwardIterator __first, _ForwardIterator __last);
- template <class _ForwardIterator,
+ template <
+ class _ForwardIterator,
__enable_if_t<__has_forward_iterator_category<_ForwardIterator>::value &&
is_constructible<value_type, typename iterator_traits<_ForwardIterator>::reference>::value,
int> = 0>
@@ -471,8 +467,9 @@ public:
#if _LIBCPP_STD_VER >= 23
template <_ContainerCompatibleRange<_Tp> _Range>
- _LIBCPP_HIDE_FROM_ABI constexpr vector(from_range_t, _Range&& __range,
- const allocator_type& __alloc = allocator_type()) : __end_cap_(nullptr, __alloc) {
+ _LIBCPP_HIDE_FROM_ABI constexpr vector(
+ from_range_t, _Range&& __range, const allocator_type& __alloc = allocator_type())
+ : __end_cap_(nullptr, __alloc) {
if constexpr (ranges::forward_range<_Range> || ranges::sized_range<_Range>) {
auto __n = static_cast<size_type>(ranges::distance(__range));
__init_with_size(ranges::begin(__range), ranges::end(__range), __n);
@@ -485,54 +482,52 @@ public:
private:
class __destroy_vector {
- public:
- _LIBCPP_CONSTEXPR _LIBCPP_HIDE_FROM_ABI __destroy_vector(vector& __vec) : __vec_(__vec) {}
-
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void operator()() {
- if (__vec_.__begin_ != nullptr) {
- __vec_.__clear();
- __vec_.__annotate_delete();
- __alloc_traits::deallocate(__vec_.__alloc(), __vec_.__begin_, __vec_.capacity());
- }
+ public:
+ _LIBCPP_CONSTEXPR _LIBCPP_HIDE_FROM_ABI __destroy_vector(vector& __vec) : __vec_(__vec) {}
+
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void operator()() {
+ if (__vec_.__begin_ != nullptr) {
+ __vec_.__clear();
+ __vec_.__annotate_delete();
+ __alloc_traits::deallocate(__vec_.__alloc(), __vec_.__begin_, __vec_.capacity());
}
+ }
- private:
- vector& __vec_;
+ private:
+ vector& __vec_;
};
public:
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI ~vector() { __destroy_vector(*this)(); }
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI ~vector() { __destroy_vector (*this)(); }
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI vector(const vector& __x);
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI vector(const vector& __x, const __type_identity_t<allocator_type>& __a);
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI
- vector& operator=(const vector& __x);
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI vector(const vector& __x);
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI
+ vector(const vector& __x, const __type_identity_t<allocator_type>& __a);
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI vector& operator=(const vector& __x);
#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI
- vector(initializer_list<value_type> __il);
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI vector(initializer_list<value_type> __il);
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI
- vector(initializer_list<value_type> __il, const allocator_type& __a);
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI
+ vector(initializer_list<value_type> __il, const allocator_type& __a);
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI
- vector& operator=(initializer_list<value_type> __il)
- {assign(__il.begin(), __il.end()); return *this;}
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI vector& operator=(initializer_list<value_type> __il) {
+ assign(__il.begin(), __il.end());
+ return *this;
+ }
#endif // !_LIBCPP_CXX03_LANG
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI
- vector(vector&& __x)
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI vector(vector&& __x)
#if _LIBCPP_STD_VER >= 17
- noexcept;
+ noexcept;
#else
- _NOEXCEPT_(is_nothrow_move_constructible<allocator_type>::value);
+ _NOEXCEPT_(is_nothrow_move_constructible<allocator_type>::value);
#endif
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI
- vector(vector&& __x, const __type_identity_t<allocator_type>& __a);
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI
- vector& operator=(vector&& __x)
- _NOEXCEPT_((__noexcept_move_assign_container<_Allocator, __alloc_traits>::value));
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI
+ vector(vector&& __x, const __type_identity_t<allocator_type>& __a);
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI vector& operator=(vector&& __x)
+ _NOEXCEPT_((__noexcept_move_assign_container<_Allocator, __alloc_traits>::value));
template <class _InputIterator,
__enable_if_t<__has_exactly_input_iterator_category<_InputIterator>::value &&
@@ -547,140 +542,129 @@ public:
_LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void assign(_ForwardIterator __first, _ForwardIterator __last);
#if _LIBCPP_STD_VER >= 23
- template <_ContainerCompatibleRange<_Tp> _Range>
- _LIBCPP_HIDE_FROM_ABI
- constexpr void assign_range(_Range&& __range) {
- if constexpr (ranges::forward_range<_Range> || ranges::sized_range<_Range>) {
- auto __n = static_cast<size_type>(ranges::distance(__range));
- __assign_with_size(ranges::begin(__range), ranges::end(__range), __n);
-
- } else {
- __assign_with_sentinel(ranges::begin(__range), ranges::end(__range));
- }
+ template <_ContainerCompatibleRange<_Tp> _Range>
+ _LIBCPP_HIDE_FROM_ABI constexpr void assign_range(_Range&& __range) {
+ if constexpr (ranges::forward_range<_Range> || ranges::sized_range<_Range>) {
+ auto __n = static_cast<size_type>(ranges::distance(__range));
+ __assign_with_size(ranges::begin(__range), ranges::end(__range), __n);
+
+ } else {
+ __assign_with_sentinel(ranges::begin(__range), ranges::end(__range));
}
+ }
#endif
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void assign(size_type __n, const_reference __u);
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void assign(size_type __n, const_reference __u);
#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI
- void assign(initializer_list<value_type> __il)
- {assign(__il.begin(), __il.end());}
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void assign(initializer_list<value_type> __il) {
+ assign(__il.begin(), __il.end());
+ }
#endif
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI
- allocator_type get_allocator() const _NOEXCEPT
- {return this->__alloc();}
-
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI iterator begin() _NOEXCEPT;
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI const_iterator begin() const _NOEXCEPT;
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI iterator end() _NOEXCEPT;
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI const_iterator end() const _NOEXCEPT;
-
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI
- reverse_iterator rbegin() _NOEXCEPT
- {return reverse_iterator(end());}
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI
- const_reverse_iterator rbegin() const _NOEXCEPT
- {return const_reverse_iterator(end());}
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI
- reverse_iterator rend() _NOEXCEPT
- {return reverse_iterator(begin());}
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI
- const_reverse_iterator rend() const _NOEXCEPT
- {return const_reverse_iterator(begin());}
-
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI
- const_iterator cbegin() const _NOEXCEPT
- {return begin();}
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI
- const_iterator cend() const _NOEXCEPT
- {return end();}
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI
- const_reverse_iterator crbegin() const _NOEXCEPT
- {return rbegin();}
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI
- const_reverse_iterator crend() const _NOEXCEPT
- {return rend();}
-
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI
- size_type size() const _NOEXCEPT
- {return static_cast<size_type>(this->__end_ - this->__begin_);}
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI
- size_type capacity() const _NOEXCEPT
- {return static_cast<size_type>(__end_cap() - this->__begin_);}
- _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI
- bool empty() const _NOEXCEPT
- {return this->__begin_ == this->__end_;}
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI size_type max_size() const _NOEXCEPT;
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void reserve(size_type __n);
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void shrink_to_fit() _NOEXCEPT;
-
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI reference operator[](size_type __n) _NOEXCEPT;
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI const_reference operator[](size_type __n) const _NOEXCEPT;
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI reference at(size_type __n);
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI const_reference at(size_type __n) const;
-
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI reference front() _NOEXCEPT
- {
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(!empty(), "front() called on an empty vector");
- return *this->__begin_;
- }
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI const_reference front() const _NOEXCEPT
- {
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(!empty(), "front() called on an empty vector");
- return *this->__begin_;
- }
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI reference back() _NOEXCEPT
- {
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(!empty(), "back() called on an empty vector");
- return *(this->__end_ - 1);
- }
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI const_reference back() const _NOEXCEPT
- {
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(!empty(), "back() called on an empty vector");
- return *(this->__end_ - 1);
- }
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI allocator_type get_allocator() const _NOEXCEPT {
+ return this->__alloc();
+ }
+
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI iterator begin() _NOEXCEPT;
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI const_iterator begin() const _NOEXCEPT;
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI iterator end() _NOEXCEPT;
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI const_iterator end() const _NOEXCEPT;
+
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI reverse_iterator rbegin() _NOEXCEPT {
+ return reverse_iterator(end());
+ }
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI const_reverse_iterator rbegin() const _NOEXCEPT {
+ return const_reverse_iterator(end());
+ }
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI reverse_iterator rend() _NOEXCEPT {
+ return reverse_iterator(begin());
+ }
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI const_reverse_iterator rend() const _NOEXCEPT {
+ return const_reverse_iterator(begin());
+ }
+
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI const_iterator cbegin() const _NOEXCEPT { return begin(); }
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI const_iterator cend() const _NOEXCEPT { return end(); }
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI const_reverse_iterator crbegin() const _NOEXCEPT {
+ return rbegin();
+ }
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI const_reverse_iterator crend() const _NOEXCEPT { return rend(); }
+
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI size_type size() const _NOEXCEPT {
+ return static_cast<size_type>(this->__end_ - this->__begin_);
+ }
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI size_type capacity() const _NOEXCEPT {
+ return static_cast<size_type>(__end_cap() - this->__begin_);
+ }
+ _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI bool empty() const _NOEXCEPT {
+ return this->__begin_ == this->__end_;
+ }
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI size_type max_size() const _NOEXCEPT;
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void reserve(size_type __n);
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void shrink_to_fit() _NOEXCEPT;
+
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI reference operator[](size_type __n) _NOEXCEPT;
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI const_reference operator[](size_type __n) const _NOEXCEPT;
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI reference at(size_type __n);
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI const_reference at(size_type __n) const;
+
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI reference front() _NOEXCEPT {
+ _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(!empty(), "front() called on an empty vector");
+ return *this->__begin_;
+ }
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI const_reference front() const _NOEXCEPT {
+ _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(!empty(), "front() called on an empty vector");
+ return *this->__begin_;
+ }
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI reference back() _NOEXCEPT {
+ _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(!empty(), "back() called on an empty vector");
+ return *(this->__end_ - 1);
+ }
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI const_reference back() const _NOEXCEPT {
+ _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(!empty(), "back() called on an empty vector");
+ return *(this->__end_ - 1);
+ }
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI
- value_type* data() _NOEXCEPT
- {return std::__to_address(this->__begin_);}
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI value_type* data() _NOEXCEPT {
+ return std::__to_address(this->__begin_);
+ }
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI
- const value_type* data() const _NOEXCEPT
- {return std::__to_address(this->__begin_);}
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI const value_type* data() const _NOEXCEPT {
+ return std::__to_address(this->__begin_);
+ }
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void push_back(const_reference __x);
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void push_back(const_reference __x);
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void push_back(value_type&& __x);
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void push_back(value_type&& __x);
- template <class... _Args>
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI
+ template <class... _Args>
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI
#if _LIBCPP_STD_VER >= 17
- reference emplace_back(_Args&&... __args);
+ reference
+ emplace_back(_Args&&... __args);
#else
- void emplace_back(_Args&&... __args);
+ void
+ emplace_back(_Args&&... __args);
#endif
#if _LIBCPP_STD_VER >= 23
- template <_ContainerCompatibleRange<_Tp> _Range>
- _LIBCPP_HIDE_FROM_ABI
- constexpr void append_range(_Range&& __range) {
- insert_range(end(), std::forward<_Range>(__range));
- }
+ template <_ContainerCompatibleRange<_Tp> _Range>
+ _LIBCPP_HIDE_FROM_ABI constexpr void append_range(_Range&& __range) {
+ insert_range(end(), std::forward<_Range>(__range));
+ }
#endif
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI
- void pop_back();
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void pop_back();
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI iterator insert(const_iterator __position, const_reference __x);
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI iterator insert(const_iterator __position, const_reference __x);
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI iterator insert(const_iterator __position, value_type&& __x);
- template <class... _Args>
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI iterator emplace(const_iterator __position, _Args&&... __args);
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI iterator insert(const_iterator __position, value_type&& __x);
+ template <class... _Args>
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI iterator emplace(const_iterator __position, _Args&&... __args);
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI
- iterator insert(const_iterator __position, size_type __n, const_reference __x);
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI iterator
+ insert(const_iterator __position, size_type __n, const_reference __x);
template <class _InputIterator,
__enable_if_t<__has_exactly_input_iterator_category<_InputIterator>::value &&
@@ -690,17 +674,16 @@ public:
insert(const_iterator __position, _InputIterator __first, _InputIterator __last);
#if _LIBCPP_STD_VER >= 23
- template <_ContainerCompatibleRange<_Tp> _Range>
- _LIBCPP_HIDE_FROM_ABI
- constexpr iterator insert_range(const_iterator __position, _Range&& __range) {
- if constexpr (ranges::forward_range<_Range> || ranges::sized_range<_Range>) {
- auto __n = static_cast<size_type>(ranges::distance(__range));
- return __insert_with_size(__position, ranges::begin(__range), ranges::end(__range), __n);
-
- } else {
- return __insert_with_sentinel(__position, ranges::begin(__range), ranges::end(__range));
- }
+ template <_ContainerCompatibleRange<_Tp> _Range>
+ _LIBCPP_HIDE_FROM_ABI constexpr iterator insert_range(const_iterator __position, _Range&& __range) {
+ if constexpr (ranges::forward_range<_Range> || ranges::sized_range<_Range>) {
+ auto __n = static_cast<size_type>(ranges::distance(__range));
+ return __insert_with_size(__position, ranges::begin(__range), ranges::end(__range), __n);
+
+ } else {
+ return __insert_with_sentinel(__position, ranges::begin(__range), ranges::end(__range));
}
+ }
#endif
template <
@@ -712,191 +695,185 @@ public:
insert(const_iterator __position, _ForwardIterator __first, _ForwardIterator __last);
#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI
- iterator insert(const_iterator __position, initializer_list<value_type> __il)
- {return insert(__position, __il.begin(), __il.end());}
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI iterator
+ insert(const_iterator __position, initializer_list<value_type> __il) {
+ return insert(__position, __il.begin(), __il.end());
+ }
#endif
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI iterator erase(const_iterator __position);
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI iterator erase(const_iterator __first, const_iterator __last);
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI iterator erase(const_iterator __position);
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI iterator erase(const_iterator __first, const_iterator __last);
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI
- void clear() _NOEXCEPT
- {
- size_type __old_size = size();
- __clear();
- __annotate_shrink(__old_size);
- }
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void clear() _NOEXCEPT {
+ size_type __old_size = size();
+ __clear();
+ __annotate_shrink(__old_size);
+ }
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void resize(size_type __sz);
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void resize(size_type __sz, const_reference __x);
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void resize(size_type __sz);
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void resize(size_type __sz, const_reference __x);
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void swap(vector&)
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void swap(vector&)
#if _LIBCPP_STD_VER >= 14
- _NOEXCEPT;
+ _NOEXCEPT;
#else
- _NOEXCEPT_(!__alloc_traits::propagate_on_container_swap::value ||
- __is_nothrow_swappable<allocator_type>::value);
+ _NOEXCEPT_(!__alloc_traits::propagate_on_container_swap::value || __is_nothrow_swappable<allocator_type>::value);
#endif
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI bool __invariants() const;
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI bool __invariants() const;
private:
- pointer __begin_ = nullptr;
- pointer __end_ = nullptr;
- __compressed_pair<pointer, allocator_type> __end_cap_ =
- __compressed_pair<pointer, allocator_type>(nullptr, __default_init_tag());
-
- // Allocate space for __n objects
- // throws length_error if __n > max_size()
- // throws (probably bad_alloc) if memory run out
- // Precondition: __begin_ == __end_ == __end_cap() == 0
- // Precondition: __n > 0
- // Postcondition: capacity() >= __n
- // Postcondition: size() == 0
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __vallocate(size_type __n) {
- if (__n > max_size())
- __throw_length_error();
- auto __allocation = std::__allocate_at_least(__alloc(), __n);
- __begin_ = __allocation.ptr;
- __end_ = __allocation.ptr;
- __end_cap() = __begin_ + __allocation.count;
- __annotate_new(0);
+ pointer __begin_ = nullptr;
+ pointer __end_ = nullptr;
+ __compressed_pair<pointer, allocator_type> __end_cap_ =
+ __compressed_pair<pointer, allocator_type>(nullptr, __default_init_tag());
+
+ // Allocate space for __n objects
+ // throws length_error if __n > max_size()
+ // throws (probably bad_alloc) if memory run out
+ // Precondition: __begin_ == __end_ == __end_cap() == 0
+ // Precondition: __n > 0
+ // Postcondition: capacity() >= __n
+ // Postcondition: size() == 0
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __vallocate(size_type __n) {
+ if (__n > max_size())
+ __throw_length_error();
+ auto __allocation = std::__allocate_at_least(__alloc(), __n);
+ __begin_ = __allocation.ptr;
+ __end_ = __allocation.ptr;
+ __end_cap() = __begin_ + __allocation.count;
+ __annotate_new(0);
+ }
+
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __vdeallocate() _NOEXCEPT;
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI size_type __recommend(size_type __new_size) const;
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __construct_at_end(size_type __n);
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __construct_at_end(size_type __n, const_reference __x);
+
+ template <class _InputIterator, class _Sentinel>
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void
+ __init_with_size(_InputIterator __first, _Sentinel __last, size_type __n) {
+ auto __guard = std::__make_exception_guard(__destroy_vector(*this));
+
+ if (__n > 0) {
+ __vallocate(__n);
+ __construct_at_end(__first, __last, __n);
}
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __vdeallocate() _NOEXCEPT;
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI size_type __recommend(size_type __new_size) const;
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __construct_at_end(size_type __n);
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI
- void __construct_at_end(size_type __n, const_reference __x);
+ __guard.__complete();
+ }
- template <class _InputIterator, class _Sentinel>
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI
- void __init_with_size(_InputIterator __first, _Sentinel __last, size_type __n) {
- auto __guard = std::__make_exception_guard(__destroy_vector(*this));
+ template <class _InputIterator, class _Sentinel>
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void
+ __init_with_sentinel(_InputIterator __first, _Sentinel __last) {
+ auto __guard = std::__make_exception_guard(__destroy_vector(*this));
- if (__n > 0) {
- __vallocate(__n);
- __construct_at_end(__first, __last, __n);
- }
+ for (; __first != __last; ++__first)
+ emplace_back(*__first);
- __guard.__complete();
- }
+ __guard.__complete();
+ }
- template <class _InputIterator, class _Sentinel>
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI
- void __init_with_sentinel(_InputIterator __first, _Sentinel __last) {
- auto __guard = std::__make_exception_guard(__destroy_vector(*this));
+ template <class _Iterator, class _Sentinel>
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __assign_with_sentinel(_Iterator __first, _Sentinel __last);
- for (; __first != __last; ++__first)
- emplace_back(*__first);
+ template <class _ForwardIterator, class _Sentinel>
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void
+ __assign_with_size(_ForwardIterator __first, _Sentinel __last, difference_type __n);
- __guard.__complete();
- }
+ template <class _InputIterator, class _Sentinel>
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI iterator
+ __insert_with_sentinel(const_iterator __position, _InputIterator __first, _Sentinel __last);
- template <class _Iterator, class _Sentinel>
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI
- void __assign_with_sentinel(_Iterator __first, _Sentinel __last);
-
- template <class _ForwardIterator, class _Sentinel>
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI
- void __assign_with_size(_ForwardIterator __first, _Sentinel __last, difference_type __n);
-
- template <class _InputIterator, class _Sentinel>
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI
- iterator __insert_with_sentinel(const_iterator __position, _InputIterator __first, _Sentinel __last);
-
- template <class _Iterator, class _Sentinel>
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI
- iterator __insert_with_size(const_iterator __position, _Iterator __first, _Sentinel __last, difference_type __n);
-
- template <class _InputIterator, class _Sentinel>
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI
- void __construct_at_end(_InputIterator __first, _Sentinel __last, size_type __n);
-
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __append(size_type __n);
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __append(size_type __n, const_reference __x);
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI
- iterator __make_iter(pointer __p) _NOEXCEPT { return iterator(__p); }
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI
- const_iterator __make_iter(const_pointer __p) const _NOEXCEPT { return const_iterator(__p); }
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __swap_out_circular_buffer(__split_buffer<value_type, allocator_type&>& __v);
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI pointer __swap_out_circular_buffer(__split_buffer<value_type, allocator_type&>& __v, pointer __p);
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __move_range(pointer __from_s, pointer __from_e, pointer __to);
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __move_assign(vector& __c, true_type)
- _NOEXCEPT_(is_nothrow_move_assignable<allocator_type>::value);
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __move_assign(vector& __c, false_type)
- _NOEXCEPT_(__alloc_traits::is_always_equal::value);
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI
- void __destruct_at_end(pointer __new_last) _NOEXCEPT
- {
- size_type __old_size = size();
- __base_destruct_at_end(__new_last);
- __annotate_shrink(__old_size);
- }
+ template <class _Iterator, class _Sentinel>
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI iterator
+ __insert_with_size(const_iterator __position, _Iterator __first, _Sentinel __last, difference_type __n);
- template <class _Up>
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI
- inline pointer __push_back_slow_path(_Up&& __x);
-
- template <class... _Args>
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI
- inline pointer __emplace_back_slow_path(_Args&&... __args);
-
- // The following functions are no-ops outside of AddressSanitizer mode.
- // We call annotations for every allocator, unless explicitly disabled.
- //
- // To disable annotations for a particular allocator, change value of
- // __asan_annotate_container_with_allocator to false.
- // For more details, see the "Using libc++" documentation page or
- // the documentation for __sanitizer_annotate_contiguous_container.
-
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI
- void __annotate_contiguous_container(const void *__beg,
- const void *__end,
- const void *__old_mid,
- const void *__new_mid) const
- {
- (void)__beg;
- (void)__end;
- (void)__old_mid;
- (void)__new_mid;
+ template <class _InputIterator, class _Sentinel>
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void
+ __construct_at_end(_InputIterator __first, _Sentinel __last, size_type __n);
+
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __append(size_type __n);
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __append(size_type __n, const_reference __x);
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI iterator __make_iter(pointer __p) _NOEXCEPT {
+ return iterator(__p);
+ }
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI const_iterator __make_iter(const_pointer __p) const _NOEXCEPT {
+ return const_iterator(__p);
+ }
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void
+ __swap_out_circular_buffer(__split_buffer<value_type, allocator_type&>& __v);
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI pointer
+ __swap_out_circular_buffer(__split_buffer<value_type, allocator_type&>& __v, pointer __p);
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void
+ __move_range(pointer __from_s, pointer __from_e, pointer __to);
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __move_assign(vector& __c, true_type)
+ _NOEXCEPT_(is_nothrow_move_assignable<allocator_type>::value);
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __move_assign(vector& __c, false_type)
+ _NOEXCEPT_(__alloc_traits::is_always_equal::value);
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __destruct_at_end(pointer __new_last) _NOEXCEPT {
+ size_type __old_size = size();
+ __base_destruct_at_end(__new_last);
+ __annotate_shrink(__old_size);
+ }
+
+ template <class _Up>
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI inline pointer __push_back_slow_path(_Up&& __x);
+
+ template <class... _Args>
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI inline pointer __emplace_back_slow_path(_Args&&... __args);
+
+ // The following functions are no-ops outside of AddressSanitizer mode.
+ // We call annotations for every allocator, unless explicitly disabled.
+ //
+ // To disable annotations for a particular allocator, change value of
+ // __asan_annotate_container_with_allocator to false.
+ // For more details, see the "Using libc++" documentation page or
+ // the documentation for __sanitizer_annotate_contiguous_container.
+
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __annotate_contiguous_container(
+ const void* __beg, const void* __end, const void* __old_mid, const void* __new_mid) const {
+ (void)__beg;
+ (void)__end;
+ (void)__old_mid;
+ (void)__new_mid;
#ifndef _LIBCPP_HAS_NO_ASAN
- if (!__libcpp_is_constant_evaluated() && __beg != nullptr && __asan_annotate_container_with_allocator<_Allocator>::value)
- __sanitizer_annotate_contiguous_container(__beg, __end, __old_mid, __new_mid);
+ if (!__libcpp_is_constant_evaluated() && __beg != nullptr &&
+ __asan_annotate_container_with_allocator<_Allocator>::value)
+ __sanitizer_annotate_contiguous_container(__beg, __end, __old_mid, __new_mid);
#endif
- }
+ }
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI
- void __annotate_new(size_type __current_size) const _NOEXCEPT {
- __annotate_contiguous_container(data(), data() + capacity(),
- data() + capacity(), data() + __current_size);
- }
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __annotate_new(size_type __current_size) const _NOEXCEPT {
+ (void)__current_size;
+#ifndef _LIBCPP_HAS_NO_ASAN
+ __annotate_contiguous_container(data(), data() + capacity(), data() + capacity(), data() + __current_size);
+#endif
+ }
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI
- void __annotate_delete() const _NOEXCEPT {
- __annotate_contiguous_container(data(), data() + capacity(),
- data() + size(), data() + capacity());
- }
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __annotate_delete() const _NOEXCEPT {
+#ifndef _LIBCPP_HAS_NO_ASAN
+ __annotate_contiguous_container(data(), data() + capacity(), data() + size(), data() + capacity());
+#endif
+ }
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI
- void __annotate_increase(size_type __n) const _NOEXCEPT
- {
- __annotate_contiguous_container(data(), data() + capacity(),
- data() + size(), data() + size() + __n);
- }
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __annotate_increase(size_type __n) const _NOEXCEPT {
+ (void)__n;
+#ifndef _LIBCPP_HAS_NO_ASAN
+ __annotate_contiguous_container(data(), data() + capacity(), data() + size(), data() + size() + __n);
+#endif
+ }
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI
- void __annotate_shrink(size_type __old_size) const _NOEXCEPT
- {
- __annotate_contiguous_container(data(), data() + capacity(),
- data() + __old_size, data() + size());
- }
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __annotate_shrink(size_type __old_size) const _NOEXCEPT {
+ (void)__old_size;
+#ifndef _LIBCPP_HAS_NO_ASAN
+ __annotate_contiguous_container(data(), data() + capacity(), data() + __old_size, data() + size());
+#endif
+ }
struct _ConstructTransaction {
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI
- explicit _ConstructTransaction(vector &__v, size_type __n)
- : __v_(__v), __pos_(__v.__end_), __new_end_(__v.__end_ + __n) {
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI explicit _ConstructTransaction(vector& __v, size_type __n)
+ : __v_(__v), __pos_(__v.__end_), __new_end_(__v.__end_ + __n) {
#ifndef _LIBCPP_HAS_NO_ASAN
__v_.__annotate_increase(__n);
#endif
@@ -910,76 +887,62 @@ private:
#endif
}
- vector &__v_;
+ vector& __v_;
pointer __pos_;
const_pointer const __new_end_;
private:
- _ConstructTransaction(_ConstructTransaction const&) = delete;
+ _ConstructTransaction(_ConstructTransaction const&) = delete;
_ConstructTransaction& operator=(_ConstructTransaction const&) = delete;
};
- template <class ..._Args>
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI
- void __construct_one_at_end(_Args&& ...__args) {
+ template <class... _Args>
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __construct_one_at_end(_Args&&... __args) {
_ConstructTransaction __tx(*this, 1);
- __alloc_traits::construct(this->__alloc(), std::__to_address(__tx.__pos_),
- std::forward<_Args>(__args)...);
+ __alloc_traits::construct(this->__alloc(), std::__to_address(__tx.__pos_), std::forward<_Args>(__args)...);
++__tx.__pos_;
}
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI
- allocator_type& __alloc() _NOEXCEPT
- {return this->__end_cap_.second();}
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI
- const allocator_type& __alloc() const _NOEXCEPT
- {return this->__end_cap_.second();}
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI
- pointer& __end_cap() _NOEXCEPT
- {return this->__end_cap_.first();}
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI
- const pointer& __end_cap() const _NOEXCEPT
- {return this->__end_cap_.first();}
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI allocator_type& __alloc() _NOEXCEPT {
+ return this->__end_cap_.second();
+ }
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI const allocator_type& __alloc() const _NOEXCEPT {
+ return this->__end_cap_.second();
+ }
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI pointer& __end_cap() _NOEXCEPT {
+ return this->__end_cap_.first();
+ }
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI const pointer& __end_cap() const _NOEXCEPT {
+ return this->__end_cap_.first();
+ }
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI
- void __clear() _NOEXCEPT {__base_destruct_at_end(this->__begin_);}
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __clear() _NOEXCEPT {
+ __base_destruct_at_end(this->__begin_);
+ }
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI
- void __base_destruct_at_end(pointer __new_last) _NOEXCEPT {
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __base_destruct_at_end(pointer __new_last) _NOEXCEPT {
pointer __soon_to_be_end = this->__end_;
while (__new_last != __soon_to_be_end)
- __alloc_traits::destroy(__alloc(), std::__to_address(--__soon_to_be_end));
+ __alloc_traits::destroy(__alloc(), std::__to_address(--__soon_to_be_end));
this->__end_ = __new_last;
}
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI
- void __copy_assign_alloc(const vector& __c)
- {__copy_assign_alloc(__c, integral_constant<bool,
- __alloc_traits::propagate_on_container_copy_assignment::value>());}
-
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI
- void __move_assign_alloc(vector& __c)
- _NOEXCEPT_(
- !__alloc_traits::propagate_on_container_move_assignment::value ||
- is_nothrow_move_assignable<allocator_type>::value)
- {__move_assign_alloc(__c, integral_constant<bool,
- __alloc_traits::propagate_on_container_move_assignment::value>());}
-
- _LIBCPP_NORETURN _LIBCPP_HIDE_FROM_ABI
- void __throw_length_error() const {
- std::__throw_length_error("vector");
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __copy_assign_alloc(const vector& __c) {
+ __copy_assign_alloc(__c, integral_constant<bool, __alloc_traits::propagate_on_container_copy_assignment::value>());
}
- _LIBCPP_NORETURN _LIBCPP_HIDE_FROM_ABI
- void __throw_out_of_range() const {
- std::__throw_out_of_range("vector");
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __move_assign_alloc(vector& __c)
+ _NOEXCEPT_(!__alloc_traits::propagate_on_container_move_assignment::value ||
+ is_nothrow_move_assignable<allocator_type>::value) {
+ __move_assign_alloc(__c, integral_constant<bool, __alloc_traits::propagate_on_container_move_assignment::value>());
}
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI
- void __copy_assign_alloc(const vector& __c, true_type)
- {
- if (__alloc() != __c.__alloc())
- {
+ _LIBCPP_NORETURN _LIBCPP_HIDE_FROM_ABI void __throw_length_error() const { std::__throw_length_error("vector"); }
+
+ _LIBCPP_NORETURN _LIBCPP_HIDE_FROM_ABI void __throw_out_of_range() const { std::__throw_out_of_range("vector"); }
+
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __copy_assign_alloc(const vector& __c, true_type) {
+ if (__alloc() != __c.__alloc()) {
__clear();
__annotate_delete();
__alloc_traits::deallocate(__alloc(), this->__begin_, capacity());
@@ -988,124 +951,97 @@ private:
__alloc() = __c.__alloc();
}
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI
- void __copy_assign_alloc(const vector&, false_type)
- {}
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __copy_assign_alloc(const vector&, false_type) {}
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI
- void __move_assign_alloc(vector& __c, true_type)
- _NOEXCEPT_(is_nothrow_move_assignable<allocator_type>::value)
- {
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __move_assign_alloc(vector& __c, true_type)
+ _NOEXCEPT_(is_nothrow_move_assignable<allocator_type>::value) {
__alloc() = std::move(__c.__alloc());
}
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI
- void __move_assign_alloc(vector&, false_type)
- _NOEXCEPT
- {}
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __move_assign_alloc(vector&, false_type) _NOEXCEPT {}
};
#if _LIBCPP_STD_VER >= 17
-template<class _InputIterator,
- class _Alloc = allocator<__iter_value_type<_InputIterator>>,
- class = enable_if_t<__has_input_iterator_category<_InputIterator>::value>,
- class = enable_if_t<__is_allocator<_Alloc>::value>
- >
-vector(_InputIterator, _InputIterator)
- -> vector<__iter_value_type<_InputIterator>, _Alloc>;
-
-template<class _InputIterator,
- class _Alloc,
- class = enable_if_t<__has_input_iterator_category<_InputIterator>::value>,
- class = enable_if_t<__is_allocator<_Alloc>::value>
- >
-vector(_InputIterator, _InputIterator, _Alloc)
- -> vector<__iter_value_type<_InputIterator>, _Alloc>;
+template <class _InputIterator,
+ class _Alloc = allocator<__iter_value_type<_InputIterator>>,
+ class = enable_if_t<__has_input_iterator_category<_InputIterator>::value>,
+ class = enable_if_t<__is_allocator<_Alloc>::value> >
+vector(_InputIterator, _InputIterator) -> vector<__iter_value_type<_InputIterator>, _Alloc>;
+
+template <class _InputIterator,
+ class _Alloc,
+ class = enable_if_t<__has_input_iterator_category<_InputIterator>::value>,
+ class = enable_if_t<__is_allocator<_Alloc>::value> >
+vector(_InputIterator, _InputIterator, _Alloc) -> vector<__iter_value_type<_InputIterator>, _Alloc>;
#endif
#if _LIBCPP_STD_VER >= 23
template <ranges::input_range _Range,
class _Alloc = allocator<ranges::range_value_t<_Range>>,
- class = enable_if_t<__is_allocator<_Alloc>::value>
- >
-vector(from_range_t, _Range&&, _Alloc = _Alloc())
- -> vector<ranges::range_value_t<_Range>, _Alloc>;
+ class = enable_if_t<__is_allocator<_Alloc>::value> >
+vector(from_range_t, _Range&&, _Alloc = _Alloc()) -> vector<ranges::range_value_t<_Range>, _Alloc>;
#endif
template <class _Tp, class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-void
-vector<_Tp, _Allocator>::__swap_out_circular_buffer(__split_buffer<value_type, allocator_type&>& __v)
-{
- __annotate_delete();
- using _RevIter = std::reverse_iterator<pointer>;
- __v.__begin_ = std::__uninitialized_allocator_move_if_noexcept(
- __alloc(), _RevIter(__end_), _RevIter(__begin_), _RevIter(__v.__begin_))
- .base();
- std::swap(this->__begin_, __v.__begin_);
- std::swap(this->__end_, __v.__end_);
- std::swap(this->__end_cap(), __v.__end_cap());
- __v.__first_ = __v.__begin_;
- __annotate_new(size());
-}
-
-template <class _Tp, class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-typename vector<_Tp, _Allocator>::pointer
-vector<_Tp, _Allocator>::__swap_out_circular_buffer(__split_buffer<value_type, allocator_type&>& __v, pointer __p)
-{
+_LIBCPP_CONSTEXPR_SINCE_CXX20 void
+vector<_Tp, _Allocator>::__swap_out_circular_buffer(__split_buffer<value_type, allocator_type&>& __v) {
+ __annotate_delete();
+ using _RevIter = std::reverse_iterator<pointer>;
+ __v.__begin_ = std::__uninitialized_allocator_move_if_noexcept(
+ __alloc(), _RevIter(__end_), _RevIter(__begin_), _RevIter(__v.__begin_))
+ .base();
+ std::swap(this->__begin_, __v.__begin_);
+ std::swap(this->__end_, __v.__end_);
+ std::swap(this->__end_cap(), __v.__end_cap());
+ __v.__first_ = __v.__begin_;
+ __annotate_new(size());
+}
+
+template <class _Tp, class _Allocator>
+_LIBCPP_CONSTEXPR_SINCE_CXX20 typename vector<_Tp, _Allocator>::pointer
+vector<_Tp, _Allocator>::__swap_out_circular_buffer(__split_buffer<value_type, allocator_type&>& __v, pointer __p) {
+ __annotate_delete();
+ pointer __r = __v.__begin_;
+ using _RevIter = std::reverse_iterator<pointer>;
+ __v.__begin_ = std::__uninitialized_allocator_move_if_noexcept(
+ __alloc(), _RevIter(__p), _RevIter(__begin_), _RevIter(__v.__begin_))
+ .base();
+ __v.__end_ = std::__uninitialized_allocator_move_if_noexcept(__alloc(), __p, __end_, __v.__end_);
+ std::swap(this->__begin_, __v.__begin_);
+ std::swap(this->__end_, __v.__end_);
+ std::swap(this->__end_cap(), __v.__end_cap());
+ __v.__first_ = __v.__begin_;
+ __annotate_new(size());
+ return __r;
+}
+
+template <class _Tp, class _Allocator>
+_LIBCPP_CONSTEXPR_SINCE_CXX20 void vector<_Tp, _Allocator>::__vdeallocate() _NOEXCEPT {
+ if (this->__begin_ != nullptr) {
+ clear();
__annotate_delete();
- pointer __r = __v.__begin_;
- using _RevIter = std::reverse_iterator<pointer>;
- __v.__begin_ = std::__uninitialized_allocator_move_if_noexcept(
- __alloc(), _RevIter(__p), _RevIter(__begin_), _RevIter(__v.__begin_))
- .base();
- __v.__end_ = std::__uninitialized_allocator_move_if_noexcept(__alloc(), __p, __end_, __v.__end_);
- std::swap(this->__begin_, __v.__begin_);
- std::swap(this->__end_, __v.__end_);
- std::swap(this->__end_cap(), __v.__end_cap());
- __v.__first_ = __v.__begin_;
- __annotate_new(size());
- return __r;
-}
-
-template <class _Tp, class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-void
-vector<_Tp, _Allocator>::__vdeallocate() _NOEXCEPT
-{
- if (this->__begin_ != nullptr)
- {
- clear();
- __annotate_delete();
- __alloc_traits::deallocate(this->__alloc(), this->__begin_, capacity());
- this->__begin_ = this->__end_ = this->__end_cap() = nullptr;
- }
+ __alloc_traits::deallocate(this->__alloc(), this->__begin_, capacity());
+ this->__begin_ = this->__end_ = this->__end_cap() = nullptr;
+ }
}
template <class _Tp, class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-typename vector<_Tp, _Allocator>::size_type
-vector<_Tp, _Allocator>::max_size() const _NOEXCEPT
-{
- return std::min<size_type>(__alloc_traits::max_size(this->__alloc()),
- numeric_limits<difference_type>::max());
+_LIBCPP_CONSTEXPR_SINCE_CXX20 typename vector<_Tp, _Allocator>::size_type
+vector<_Tp, _Allocator>::max_size() const _NOEXCEPT {
+ return std::min<size_type>(__alloc_traits::max_size(this->__alloc()), numeric_limits<difference_type>::max());
}
// Precondition: __new_size > capacity()
template <class _Tp, class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-inline _LIBCPP_HIDE_FROM_ABI
-typename vector<_Tp, _Allocator>::size_type
-vector<_Tp, _Allocator>::__recommend(size_type __new_size) const
-{
- const size_type __ms = max_size();
- if (__new_size > __ms)
- this->__throw_length_error();
- const size_type __cap = capacity();
- if (__cap >= __ms / 2)
- return __ms;
- return std::max<size_type>(2 * __cap, __new_size);
+_LIBCPP_CONSTEXPR_SINCE_CXX20 inline _LIBCPP_HIDE_FROM_ABI typename vector<_Tp, _Allocator>::size_type
+vector<_Tp, _Allocator>::__recommend(size_type __new_size) const {
+ const size_type __ms = max_size();
+ if (__new_size > __ms)
+ this->__throw_length_error();
+ const size_type __cap = capacity();
+ if (__cap >= __ms / 2)
+ return __ms;
+ return std::max<size_type>(2 * __cap, __new_size);
}
// Default constructs __n objects starting at __end_
@@ -1114,15 +1050,12 @@ vector<_Tp, _Allocator>::__recommend(size_type __new_size) const
// Precondition: size() + __n <= capacity()
// Postcondition: size() == size() + __n
template <class _Tp, class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-void
-vector<_Tp, _Allocator>::__construct_at_end(size_type __n)
-{
- _ConstructTransaction __tx(*this, __n);
- const_pointer __new_end = __tx.__new_end_;
- for (pointer __pos = __tx.__pos_; __pos != __new_end; __tx.__pos_ = ++__pos) {
- __alloc_traits::construct(this->__alloc(), std::__to_address(__pos));
- }
+_LIBCPP_CONSTEXPR_SINCE_CXX20 void vector<_Tp, _Allocator>::__construct_at_end(size_type __n) {
+ _ConstructTransaction __tx(*this, __n);
+ const_pointer __new_end = __tx.__new_end_;
+ for (pointer __pos = __tx.__pos_; __pos != __new_end; __tx.__pos_ = ++__pos) {
+ __alloc_traits::construct(this->__alloc(), std::__to_address(__pos));
+ }
}
// Copy constructs __n objects starting at __end_ from __x
@@ -1132,16 +1065,13 @@ vector<_Tp, _Allocator>::__construct_at_end(size_type __n)
// Postcondition: size() == old size() + __n
// Postcondition: [i] == __x for all i in [size() - __n, __n)
template <class _Tp, class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-inline
-void
-vector<_Tp, _Allocator>::__construct_at_end(size_type __n, const_reference __x)
-{
- _ConstructTransaction __tx(*this, __n);
- const_pointer __new_end = __tx.__new_end_;
- for (pointer __pos = __tx.__pos_; __pos != __new_end; __tx.__pos_ = ++__pos) {
- __alloc_traits::construct(this->__alloc(), std::__to_address(__pos), __x);
- }
+_LIBCPP_CONSTEXPR_SINCE_CXX20 inline void
+vector<_Tp, _Allocator>::__construct_at_end(size_type __n, const_reference __x) {
+ _ConstructTransaction __tx(*this, __n);
+ const_pointer __new_end = __tx.__new_end_;
+ for (pointer __pos = __tx.__pos_; __pos != __new_end; __tx.__pos_ = ++__pos) {
+ __alloc_traits::construct(this->__alloc(), std::__to_address(__pos), __x);
+ }
}
template <class _Tp, class _Allocator>
@@ -1157,19 +1087,15 @@ vector<_Tp, _Allocator>::__construct_at_end(_InputIterator __first, _Sentinel __
// Postcondition: size() == size() + __n
// Exception safety: strong.
template <class _Tp, class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-void
-vector<_Tp, _Allocator>::__append(size_type __n)
-{
- if (static_cast<size_type>(this->__end_cap() - this->__end_) >= __n)
- this->__construct_at_end(__n);
- else
- {
- allocator_type& __a = this->__alloc();
- __split_buffer<value_type, allocator_type&> __v(__recommend(size() + __n), size(), __a);
- __v.__construct_at_end(__n);
- __swap_out_circular_buffer(__v);
- }
+_LIBCPP_CONSTEXPR_SINCE_CXX20 void vector<_Tp, _Allocator>::__append(size_type __n) {
+ if (static_cast<size_type>(this->__end_cap() - this->__end_) >= __n)
+ this->__construct_at_end(__n);
+ else {
+ allocator_type& __a = this->__alloc();
+ __split_buffer<value_type, allocator_type&> __v(__recommend(size() + __n), size(), __a);
+ __v.__construct_at_end(__n);
+ __swap_out_circular_buffer(__v);
+ }
}
// Default constructs __n objects starting at __end_
@@ -1177,1403 +1103,1186 @@ vector<_Tp, _Allocator>::__append(size_type __n)
// Postcondition: size() == size() + __n
// Exception safety: strong.
template <class _Tp, class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-void
-vector<_Tp, _Allocator>::__append(size_type __n, const_reference __x)
-{
- if (static_cast<size_type>(this->__end_cap() - this->__end_) >= __n)
- this->__construct_at_end(__n, __x);
- else
- {
- allocator_type& __a = this->__alloc();
- __split_buffer<value_type, allocator_type&> __v(__recommend(size() + __n), size(), __a);
- __v.__construct_at_end(__n, __x);
- __swap_out_circular_buffer(__v);
- }
+_LIBCPP_CONSTEXPR_SINCE_CXX20 void vector<_Tp, _Allocator>::__append(size_type __n, const_reference __x) {
+ if (static_cast<size_type>(this->__end_cap() - this->__end_) >= __n)
+ this->__construct_at_end(__n, __x);
+ else {
+ allocator_type& __a = this->__alloc();
+ __split_buffer<value_type, allocator_type&> __v(__recommend(size() + __n), size(), __a);
+ __v.__construct_at_end(__n, __x);
+ __swap_out_circular_buffer(__v);
+ }
}
template <class _Tp, class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-vector<_Tp, _Allocator>::vector(size_type __n)
-{
- auto __guard = std::__make_exception_guard(__destroy_vector(*this));
- if (__n > 0)
- {
- __vallocate(__n);
- __construct_at_end(__n);
- }
- __guard.__complete();
+_LIBCPP_CONSTEXPR_SINCE_CXX20 vector<_Tp, _Allocator>::vector(size_type __n) {
+ auto __guard = std::__make_exception_guard(__destroy_vector(*this));
+ if (__n > 0) {
+ __vallocate(__n);
+ __construct_at_end(__n);
+ }
+ __guard.__complete();
}
#if _LIBCPP_STD_VER >= 14
template <class _Tp, class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-vector<_Tp, _Allocator>::vector(size_type __n, const allocator_type& __a)
- : __end_cap_(nullptr, __a)
-{
- auto __guard = std::__make_exception_guard(__destroy_vector(*this));
- if (__n > 0)
- {
- __vallocate(__n);
- __construct_at_end(__n);
- }
- __guard.__complete();
+_LIBCPP_CONSTEXPR_SINCE_CXX20 vector<_Tp, _Allocator>::vector(size_type __n, const allocator_type& __a)
+ : __end_cap_(nullptr, __a) {
+ auto __guard = std::__make_exception_guard(__destroy_vector(*this));
+ if (__n > 0) {
+ __vallocate(__n);
+ __construct_at_end(__n);
+ }
+ __guard.__complete();
}
#endif
template <class _Tp, class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-vector<_Tp, _Allocator>::vector(size_type __n, const value_type& __x)
-{
- auto __guard = std::__make_exception_guard(__destroy_vector(*this));
- if (__n > 0)
- {
- __vallocate(__n);
- __construct_at_end(__n, __x);
- }
- __guard.__complete();
+_LIBCPP_CONSTEXPR_SINCE_CXX20 vector<_Tp, _Allocator>::vector(size_type __n, const value_type& __x) {
+ auto __guard = std::__make_exception_guard(__destroy_vector(*this));
+ if (__n > 0) {
+ __vallocate(__n);
+ __construct_at_end(__n, __x);
+ }
+ __guard.__complete();
}
template <class _Tp, class _Allocator>
-template <class _InputIterator, __enable_if_t<__has_exactly_input_iterator_category<_InputIterator>::value &&
- is_constructible<_Tp, typename iterator_traits<_InputIterator>::reference>::value,
- int> >
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-vector<_Tp, _Allocator>::vector(_InputIterator __first, _InputIterator __last)
-{
+template <class _InputIterator,
+ __enable_if_t<__has_exactly_input_iterator_category<_InputIterator>::value &&
+ is_constructible<_Tp, typename iterator_traits<_InputIterator>::reference>::value,
+ int> >
+_LIBCPP_CONSTEXPR_SINCE_CXX20 vector<_Tp, _Allocator>::vector(_InputIterator __first, _InputIterator __last) {
__init_with_sentinel(__first, __last);
}
template <class _Tp, class _Allocator>
-template <class _InputIterator, __enable_if_t<__has_exactly_input_iterator_category<_InputIterator>::value &&
- is_constructible<_Tp, typename iterator_traits<_InputIterator>::reference>::value,
- int> >
+template <class _InputIterator,
+ __enable_if_t<__has_exactly_input_iterator_category<_InputIterator>::value &&
+ is_constructible<_Tp, typename iterator_traits<_InputIterator>::reference>::value,
+ int> >
_LIBCPP_CONSTEXPR_SINCE_CXX20
vector<_Tp, _Allocator>::vector(_InputIterator __first, _InputIterator __last, const allocator_type& __a)
- : __end_cap_(nullptr, __a)
-{
+ : __end_cap_(nullptr, __a) {
__init_with_sentinel(__first, __last);
}
template <class _Tp, class _Allocator>
-template <class _ForwardIterator, __enable_if_t<__has_forward_iterator_category<_ForwardIterator>::value &&
- is_constructible<_Tp, typename iterator_traits<_ForwardIterator>::reference>::value,
- int> >
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-vector<_Tp, _Allocator>::vector(_ForwardIterator __first, _ForwardIterator __last)
-{
+template <class _ForwardIterator,
+ __enable_if_t<__has_forward_iterator_category<_ForwardIterator>::value &&
+ is_constructible<_Tp, typename iterator_traits<_ForwardIterator>::reference>::value,
+ int> >
+_LIBCPP_CONSTEXPR_SINCE_CXX20 vector<_Tp, _Allocator>::vector(_ForwardIterator __first, _ForwardIterator __last) {
size_type __n = static_cast<size_type>(std::distance(__first, __last));
__init_with_size(__first, __last, __n);
}
template <class _Tp, class _Allocator>
-template <class _ForwardIterator, __enable_if_t<__has_forward_iterator_category<_ForwardIterator>::value &&
- is_constructible<_Tp, typename iterator_traits<_ForwardIterator>::reference>::value,
- int> >
+template <class _ForwardIterator,
+ __enable_if_t<__has_forward_iterator_category<_ForwardIterator>::value &&
+ is_constructible<_Tp, typename iterator_traits<_ForwardIterator>::reference>::value,
+ int> >
_LIBCPP_CONSTEXPR_SINCE_CXX20
vector<_Tp, _Allocator>::vector(_ForwardIterator __first, _ForwardIterator __last, const allocator_type& __a)
- : __end_cap_(nullptr, __a)
-{
+ : __end_cap_(nullptr, __a) {
size_type __n = static_cast<size_type>(std::distance(__first, __last));
__init_with_size(__first, __last, __n);
}
template <class _Tp, class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-vector<_Tp, _Allocator>::vector(const vector& __x)
- : __end_cap_(nullptr, __alloc_traits::select_on_container_copy_construction(__x.__alloc()))
-{
+_LIBCPP_CONSTEXPR_SINCE_CXX20 vector<_Tp, _Allocator>::vector(const vector& __x)
+ : __end_cap_(nullptr, __alloc_traits::select_on_container_copy_construction(__x.__alloc())) {
__init_with_size(__x.__begin_, __x.__end_, __x.size());
}
template <class _Tp, class _Allocator>
_LIBCPP_CONSTEXPR_SINCE_CXX20
vector<_Tp, _Allocator>::vector(const vector& __x, const __type_identity_t<allocator_type>& __a)
- : __end_cap_(nullptr, __a)
-{
+ : __end_cap_(nullptr, __a) {
__init_with_size(__x.__begin_, __x.__end_, __x.size());
}
template <class _Tp, class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-inline _LIBCPP_HIDE_FROM_ABI
-vector<_Tp, _Allocator>::vector(vector&& __x)
+_LIBCPP_CONSTEXPR_SINCE_CXX20 inline _LIBCPP_HIDE_FROM_ABI vector<_Tp, _Allocator>::vector(vector&& __x)
#if _LIBCPP_STD_VER >= 17
- noexcept
+ noexcept
#else
- _NOEXCEPT_(is_nothrow_move_constructible<allocator_type>::value)
+ _NOEXCEPT_(is_nothrow_move_constructible<allocator_type>::value)
#endif
- : __end_cap_(nullptr, std::move(__x.__alloc()))
-{
- this->__begin_ = __x.__begin_;
- this->__end_ = __x.__end_;
- this->__end_cap() = __x.__end_cap();
- __x.__begin_ = __x.__end_ = __x.__end_cap() = nullptr;
+ : __end_cap_(nullptr, std::move(__x.__alloc())) {
+ this->__begin_ = __x.__begin_;
+ this->__end_ = __x.__end_;
+ this->__end_cap() = __x.__end_cap();
+ __x.__begin_ = __x.__end_ = __x.__end_cap() = nullptr;
}
template <class _Tp, class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-inline _LIBCPP_HIDE_FROM_ABI
+_LIBCPP_CONSTEXPR_SINCE_CXX20 inline _LIBCPP_HIDE_FROM_ABI
vector<_Tp, _Allocator>::vector(vector&& __x, const __type_identity_t<allocator_type>& __a)
- : __end_cap_(nullptr, __a)
-{
- if (__a == __x.__alloc())
- {
- this->__begin_ = __x.__begin_;
- this->__end_ = __x.__end_;
- this->__end_cap() = __x.__end_cap();
- __x.__begin_ = __x.__end_ = __x.__end_cap() = nullptr;
- }
- else
- {
- typedef move_iterator<iterator> _Ip;
- auto __guard = std::__make_exception_guard(__destroy_vector(*this));
- assign(_Ip(__x.begin()), _Ip(__x.end()));
- __guard.__complete();
- }
+ : __end_cap_(nullptr, __a) {
+ if (__a == __x.__alloc()) {
+ this->__begin_ = __x.__begin_;
+ this->__end_ = __x.__end_;
+ this->__end_cap() = __x.__end_cap();
+ __x.__begin_ = __x.__end_ = __x.__end_cap() = nullptr;
+ } else {
+ typedef move_iterator<iterator> _Ip;
+ auto __guard = std::__make_exception_guard(__destroy_vector(*this));
+ assign(_Ip(__x.begin()), _Ip(__x.end()));
+ __guard.__complete();
+ }
}
#ifndef _LIBCPP_CXX03_LANG
template <class _Tp, class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-inline _LIBCPP_HIDE_FROM_ABI
-vector<_Tp, _Allocator>::vector(initializer_list<value_type> __il)
-{
- auto __guard = std::__make_exception_guard(__destroy_vector(*this));
- if (__il.size() > 0)
- {
- __vallocate(__il.size());
- __construct_at_end(__il.begin(), __il.end(), __il.size());
- }
- __guard.__complete();
+_LIBCPP_CONSTEXPR_SINCE_CXX20 inline _LIBCPP_HIDE_FROM_ABI
+vector<_Tp, _Allocator>::vector(initializer_list<value_type> __il) {
+ auto __guard = std::__make_exception_guard(__destroy_vector(*this));
+ if (__il.size() > 0) {
+ __vallocate(__il.size());
+ __construct_at_end(__il.begin(), __il.end(), __il.size());
+ }
+ __guard.__complete();
}
template <class _Tp, class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-inline _LIBCPP_HIDE_FROM_ABI
+_LIBCPP_CONSTEXPR_SINCE_CXX20 inline _LIBCPP_HIDE_FROM_ABI
vector<_Tp, _Allocator>::vector(initializer_list<value_type> __il, const allocator_type& __a)
- : __end_cap_(nullptr, __a)
-{
- auto __guard = std::__make_exception_guard(__destroy_vector(*this));
- if (__il.size() > 0)
- {
- __vallocate(__il.size());
- __construct_at_end(__il.begin(), __il.end(), __il.size());
- }
- __guard.__complete();
+ : __end_cap_(nullptr, __a) {
+ auto __guard = std::__make_exception_guard(__destroy_vector(*this));
+ if (__il.size() > 0) {
+ __vallocate(__il.size());
+ __construct_at_end(__il.begin(), __il.end(), __il.size());
+ }
+ __guard.__complete();
}
#endif // _LIBCPP_CXX03_LANG
template <class _Tp, class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-inline _LIBCPP_HIDE_FROM_ABI
-vector<_Tp, _Allocator>&
+_LIBCPP_CONSTEXPR_SINCE_CXX20 inline _LIBCPP_HIDE_FROM_ABI vector<_Tp, _Allocator>&
vector<_Tp, _Allocator>::operator=(vector&& __x)
- _NOEXCEPT_((__noexcept_move_assign_container<_Allocator, __alloc_traits>::value))
-{
- __move_assign(__x, integral_constant<bool,
- __alloc_traits::propagate_on_container_move_assignment::value>());
- return *this;
+ _NOEXCEPT_((__noexcept_move_assign_container<_Allocator, __alloc_traits>::value)) {
+ __move_assign(__x, integral_constant<bool, __alloc_traits::propagate_on_container_move_assignment::value>());
+ return *this;
}
template <class _Tp, class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-void
-vector<_Tp, _Allocator>::__move_assign(vector& __c, false_type)
- _NOEXCEPT_(__alloc_traits::is_always_equal::value)
-{
- if (__alloc() != __c.__alloc())
- {
- typedef move_iterator<iterator> _Ip;
- assign(_Ip(__c.begin()), _Ip(__c.end()));
- }
- else
- __move_assign(__c, true_type());
+_LIBCPP_CONSTEXPR_SINCE_CXX20 void vector<_Tp, _Allocator>::__move_assign(vector& __c, false_type)
+ _NOEXCEPT_(__alloc_traits::is_always_equal::value) {
+ if (__alloc() != __c.__alloc()) {
+ typedef move_iterator<iterator> _Ip;
+ assign(_Ip(__c.begin()), _Ip(__c.end()));
+ } else
+ __move_assign(__c, true_type());
}
template <class _Tp, class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-void
-vector<_Tp, _Allocator>::__move_assign(vector& __c, true_type)
- _NOEXCEPT_(is_nothrow_move_assignable<allocator_type>::value)
-{
- __vdeallocate();
- __move_assign_alloc(__c); // this can throw
- this->__begin_ = __c.__begin_;
- this->__end_ = __c.__end_;
- this->__end_cap() = __c.__end_cap();
- __c.__begin_ = __c.__end_ = __c.__end_cap() = nullptr;
+_LIBCPP_CONSTEXPR_SINCE_CXX20 void vector<_Tp, _Allocator>::__move_assign(vector& __c, true_type)
+ _NOEXCEPT_(is_nothrow_move_assignable<allocator_type>::value) {
+ __vdeallocate();
+ __move_assign_alloc(__c); // this can throw
+ this->__begin_ = __c.__begin_;
+ this->__end_ = __c.__end_;
+ this->__end_cap() = __c.__end_cap();
+ __c.__begin_ = __c.__end_ = __c.__end_cap() = nullptr;
}
template <class _Tp, class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-inline _LIBCPP_HIDE_FROM_ABI
-vector<_Tp, _Allocator>&
-vector<_Tp, _Allocator>::operator=(const vector& __x)
-{
- if (this != std::addressof(__x))
- {
- __copy_assign_alloc(__x);
- assign(__x.__begin_, __x.__end_);
- }
- return *this;
+_LIBCPP_CONSTEXPR_SINCE_CXX20 inline _LIBCPP_HIDE_FROM_ABI vector<_Tp, _Allocator>&
+vector<_Tp, _Allocator>::operator=(const vector& __x) {
+ if (this != std::addressof(__x)) {
+ __copy_assign_alloc(__x);
+ assign(__x.__begin_, __x.__end_);
+ }
+ return *this;
}
template <class _Tp, class _Allocator>
-template <class _InputIterator, __enable_if_t<__has_exactly_input_iterator_category<_InputIterator>::value &&
- is_constructible<_Tp, typename iterator_traits<_InputIterator>::reference>::value,
- int> >
-_LIBCPP_CONSTEXPR_SINCE_CXX20 void
-vector<_Tp, _Allocator>::assign(_InputIterator __first, _InputIterator __last)
-{
+template <class _InputIterator,
+ __enable_if_t<__has_exactly_input_iterator_category<_InputIterator>::value &&
+ is_constructible<_Tp, typename iterator_traits<_InputIterator>::reference>::value,
+ int> >
+_LIBCPP_CONSTEXPR_SINCE_CXX20 void vector<_Tp, _Allocator>::assign(_InputIterator __first, _InputIterator __last) {
__assign_with_sentinel(__first, __last);
}
template <class _Tp, class _Allocator>
template <class _Iterator, class _Sentinel>
-_LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI
-void vector<_Tp, _Allocator>::__assign_with_sentinel(_Iterator __first, _Sentinel __last) {
- clear();
- for (; __first != __last; ++__first)
- emplace_back(*__first);
+_LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void
+vector<_Tp, _Allocator>::__assign_with_sentinel(_Iterator __first, _Sentinel __last) {
+ clear();
+ for (; __first != __last; ++__first)
+ emplace_back(*__first);
}
template <class _Tp, class _Allocator>
-template <class _ForwardIterator, __enable_if_t<__has_forward_iterator_category<_ForwardIterator>::value &&
- is_constructible<_Tp, typename iterator_traits<_ForwardIterator>::reference>::value,
- int> >
-_LIBCPP_CONSTEXPR_SINCE_CXX20 void
-vector<_Tp, _Allocator>::assign(_ForwardIterator __first, _ForwardIterator __last)
-{
+template <class _ForwardIterator,
+ __enable_if_t<__has_forward_iterator_category<_ForwardIterator>::value &&
+ is_constructible<_Tp, typename iterator_traits<_ForwardIterator>::reference>::value,
+ int> >
+_LIBCPP_CONSTEXPR_SINCE_CXX20 void vector<_Tp, _Allocator>::assign(_ForwardIterator __first, _ForwardIterator __last) {
__assign_with_size(__first, __last, std::distance(__first, __last));
}
template <class _Tp, class _Allocator>
template <class _ForwardIterator, class _Sentinel>
-_LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI
-void vector<_Tp, _Allocator>::__assign_with_size(_ForwardIterator __first, _Sentinel __last, difference_type __n) {
- size_type __new_size = static_cast<size_type>(__n);
- if (__new_size <= capacity())
- {
- if (__new_size > size())
- {
- _ForwardIterator __mid = std::next(__first, size());
- std::copy(__first, __mid, this->__begin_);
- __construct_at_end(__mid, __last, __new_size - size());
- }
- else
- {
- pointer __m = std::__copy<_ClassicAlgPolicy>(__first, __last, this->__begin_).second;
- this->__destruct_at_end(__m);
- }
- }
- else
- {
- __vdeallocate();
- __vallocate(__recommend(__new_size));
- __construct_at_end(__first, __last, __new_size);
+_LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void
+vector<_Tp, _Allocator>::__assign_with_size(_ForwardIterator __first, _Sentinel __last, difference_type __n) {
+ size_type __new_size = static_cast<size_type>(__n);
+ if (__new_size <= capacity()) {
+ if (__new_size > size()) {
+ _ForwardIterator __mid = std::next(__first, size());
+ std::copy(__first, __mid, this->__begin_);
+ __construct_at_end(__mid, __last, __new_size - size());
+ } else {
+ pointer __m = std::__copy<_ClassicAlgPolicy>(__first, __last, this->__begin_).second;
+ this->__destruct_at_end(__m);
}
+ } else {
+ __vdeallocate();
+ __vallocate(__recommend(__new_size));
+ __construct_at_end(__first, __last, __new_size);
+ }
}
template <class _Tp, class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-void
-vector<_Tp, _Allocator>::assign(size_type __n, const_reference __u)
-{
- if (__n <= capacity())
- {
- size_type __s = size();
- std::fill_n(this->__begin_, std::min(__n, __s), __u);
- if (__n > __s)
- __construct_at_end(__n - __s, __u);
- else
- this->__destruct_at_end(this->__begin_ + __n);
- }
+_LIBCPP_CONSTEXPR_SINCE_CXX20 void vector<_Tp, _Allocator>::assign(size_type __n, const_reference __u) {
+ if (__n <= capacity()) {
+ size_type __s = size();
+ std::fill_n(this->__begin_, std::min(__n, __s), __u);
+ if (__n > __s)
+ __construct_at_end(__n - __s, __u);
else
- {
- __vdeallocate();
- __vallocate(__recommend(static_cast<size_type>(__n)));
- __construct_at_end(__n, __u);
- }
+ this->__destruct_at_end(this->__begin_ + __n);
+ } else {
+ __vdeallocate();
+ __vallocate(__recommend(static_cast<size_type>(__n)));
+ __construct_at_end(__n, __u);
+ }
}
template <class _Tp, class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-inline _LIBCPP_HIDE_FROM_ABI
-typename vector<_Tp, _Allocator>::iterator
-vector<_Tp, _Allocator>::begin() _NOEXCEPT
-{
- return __make_iter(this->__begin_);
+_LIBCPP_CONSTEXPR_SINCE_CXX20 inline _LIBCPP_HIDE_FROM_ABI typename vector<_Tp, _Allocator>::iterator
+vector<_Tp, _Allocator>::begin() _NOEXCEPT {
+ return __make_iter(this->__begin_);
}
template <class _Tp, class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-inline _LIBCPP_HIDE_FROM_ABI
-typename vector<_Tp, _Allocator>::const_iterator
-vector<_Tp, _Allocator>::begin() const _NOEXCEPT
-{
- return __make_iter(this->__begin_);
+_LIBCPP_CONSTEXPR_SINCE_CXX20 inline _LIBCPP_HIDE_FROM_ABI typename vector<_Tp, _Allocator>::const_iterator
+vector<_Tp, _Allocator>::begin() const _NOEXCEPT {
+ return __make_iter(this->__begin_);
}
template <class _Tp, class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-inline _LIBCPP_HIDE_FROM_ABI
-typename vector<_Tp, _Allocator>::iterator
-vector<_Tp, _Allocator>::end() _NOEXCEPT
-{
- return __make_iter(this->__end_);
+_LIBCPP_CONSTEXPR_SINCE_CXX20 inline _LIBCPP_HIDE_FROM_ABI typename vector<_Tp, _Allocator>::iterator
+vector<_Tp, _Allocator>::end() _NOEXCEPT {
+ return __make_iter(this->__end_);
}
template <class _Tp, class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-inline _LIBCPP_HIDE_FROM_ABI
-typename vector<_Tp, _Allocator>::const_iterator
-vector<_Tp, _Allocator>::end() const _NOEXCEPT
-{
- return __make_iter(this->__end_);
+_LIBCPP_CONSTEXPR_SINCE_CXX20 inline _LIBCPP_HIDE_FROM_ABI typename vector<_Tp, _Allocator>::const_iterator
+vector<_Tp, _Allocator>::end() const _NOEXCEPT {
+ return __make_iter(this->__end_);
}
template <class _Tp, class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-inline _LIBCPP_HIDE_FROM_ABI
-typename vector<_Tp, _Allocator>::reference
-vector<_Tp, _Allocator>::operator[](size_type __n) _NOEXCEPT
-{
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__n < size(), "vector[] index out of bounds");
- return this->__begin_[__n];
+_LIBCPP_CONSTEXPR_SINCE_CXX20 inline _LIBCPP_HIDE_FROM_ABI typename vector<_Tp, _Allocator>::reference
+vector<_Tp, _Allocator>::operator[](size_type __n) _NOEXCEPT {
+ _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__n < size(), "vector[] index out of bounds");
+ return this->__begin_[__n];
}
template <class _Tp, class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-inline _LIBCPP_HIDE_FROM_ABI
-typename vector<_Tp, _Allocator>::const_reference
-vector<_Tp, _Allocator>::operator[](size_type __n) const _NOEXCEPT
-{
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__n < size(), "vector[] index out of bounds");
- return this->__begin_[__n];
+_LIBCPP_CONSTEXPR_SINCE_CXX20 inline _LIBCPP_HIDE_FROM_ABI typename vector<_Tp, _Allocator>::const_reference
+vector<_Tp, _Allocator>::operator[](size_type __n) const _NOEXCEPT {
+ _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__n < size(), "vector[] index out of bounds");
+ return this->__begin_[__n];
}
template <class _Tp, class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-typename vector<_Tp, _Allocator>::reference
-vector<_Tp, _Allocator>::at(size_type __n)
-{
- if (__n >= size())
- this->__throw_out_of_range();
- return this->__begin_[__n];
+_LIBCPP_CONSTEXPR_SINCE_CXX20 typename vector<_Tp, _Allocator>::reference vector<_Tp, _Allocator>::at(size_type __n) {
+ if (__n >= size())
+ this->__throw_out_of_range();
+ return this->__begin_[__n];
}
template <class _Tp, class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-typename vector<_Tp, _Allocator>::const_reference
-vector<_Tp, _Allocator>::at(size_type __n) const
-{
- if (__n >= size())
- this->__throw_out_of_range();
- return this->__begin_[__n];
+_LIBCPP_CONSTEXPR_SINCE_CXX20 typename vector<_Tp, _Allocator>::const_reference
+vector<_Tp, _Allocator>::at(size_type __n) const {
+ if (__n >= size())
+ this->__throw_out_of_range();
+ return this->__begin_[__n];
}
template <class _Tp, class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-void
-vector<_Tp, _Allocator>::reserve(size_type __n)
-{
- if (__n > capacity())
- {
- if (__n > max_size())
- this->__throw_length_error();
- allocator_type& __a = this->__alloc();
- __split_buffer<value_type, allocator_type&> __v(__n, size(), __a);
- __swap_out_circular_buffer(__v);
- }
+_LIBCPP_CONSTEXPR_SINCE_CXX20 void vector<_Tp, _Allocator>::reserve(size_type __n) {
+ if (__n > capacity()) {
+ if (__n > max_size())
+ this->__throw_length_error();
+ allocator_type& __a = this->__alloc();
+ __split_buffer<value_type, allocator_type&> __v(__n, size(), __a);
+ __swap_out_circular_buffer(__v);
+ }
}
template <class _Tp, class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-void
-vector<_Tp, _Allocator>::shrink_to_fit() _NOEXCEPT
-{
- if (capacity() > size())
- {
+_LIBCPP_CONSTEXPR_SINCE_CXX20 void vector<_Tp, _Allocator>::shrink_to_fit() _NOEXCEPT {
+ if (capacity() > size()) {
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- try
- {
+ try {
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- allocator_type& __a = this->__alloc();
- __split_buffer<value_type, allocator_type&> __v(size(), size(), __a);
- __swap_out_circular_buffer(__v);
+ allocator_type& __a = this->__alloc();
+ __split_buffer<value_type, allocator_type&> __v(size(), size(), __a);
+ __swap_out_circular_buffer(__v);
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- }
- catch (...)
- {
- }
-#endif // _LIBCPP_HAS_NO_EXCEPTIONS
+ } catch (...) {
}
+#endif // _LIBCPP_HAS_NO_EXCEPTIONS
+ }
}
template <class _Tp, class _Allocator>
template <class _Up>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-typename vector<_Tp, _Allocator>::pointer
-vector<_Tp, _Allocator>::__push_back_slow_path(_Up&& __x)
-{
- allocator_type& __a = this->__alloc();
- __split_buffer<value_type, allocator_type&> __v(__recommend(size() + 1), size(), __a);
- // __v.push_back(std::forward<_Up>(__x));
- __alloc_traits::construct(__a, std::__to_address(__v.__end_), std::forward<_Up>(__x));
- __v.__end_++;
- __swap_out_circular_buffer(__v);
- return this->__end_;
-}
-
-template <class _Tp, class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-inline _LIBCPP_HIDE_FROM_ABI
-void
-vector<_Tp, _Allocator>::push_back(const_reference __x)
-{
- pointer __end = this->__end_;
- if (__end < this->__end_cap()) {
- __construct_one_at_end(__x);
- ++__end;
- } else {
- __end = __push_back_slow_path(__x);
- }
- this->__end_ = __end;
+_LIBCPP_CONSTEXPR_SINCE_CXX20 typename vector<_Tp, _Allocator>::pointer
+vector<_Tp, _Allocator>::__push_back_slow_path(_Up&& __x) {
+ allocator_type& __a = this->__alloc();
+ __split_buffer<value_type, allocator_type&> __v(__recommend(size() + 1), size(), __a);
+ // __v.push_back(std::forward<_Up>(__x));
+ __alloc_traits::construct(__a, std::__to_address(__v.__end_), std::forward<_Up>(__x));
+ __v.__end_++;
+ __swap_out_circular_buffer(__v);
+ return this->__end_;
+}
+
+template <class _Tp, class _Allocator>
+_LIBCPP_CONSTEXPR_SINCE_CXX20 inline _LIBCPP_HIDE_FROM_ABI void
+vector<_Tp, _Allocator>::push_back(const_reference __x) {
+ pointer __end = this->__end_;
+ if (__end < this->__end_cap()) {
+ __construct_one_at_end(__x);
+ ++__end;
+ } else {
+ __end = __push_back_slow_path(__x);
+ }
+ this->__end_ = __end;
}
template <class _Tp, class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-inline _LIBCPP_HIDE_FROM_ABI
-void
-vector<_Tp, _Allocator>::push_back(value_type&& __x)
-{
- pointer __end = this->__end_;
- if (__end < this->__end_cap()) {
- __construct_one_at_end(std::move(__x));
- ++__end;
- } else {
- __end = __push_back_slow_path(std::move(__x));
- }
- this->__end_ = __end;
+_LIBCPP_CONSTEXPR_SINCE_CXX20 inline _LIBCPP_HIDE_FROM_ABI void vector<_Tp, _Allocator>::push_back(value_type&& __x) {
+ pointer __end = this->__end_;
+ if (__end < this->__end_cap()) {
+ __construct_one_at_end(std::move(__x));
+ ++__end;
+ } else {
+ __end = __push_back_slow_path(std::move(__x));
+ }
+ this->__end_ = __end;
}
template <class _Tp, class _Allocator>
template <class... _Args>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-typename vector<_Tp, _Allocator>::pointer
-vector<_Tp, _Allocator>::__emplace_back_slow_path(_Args&&... __args)
-{
- allocator_type& __a = this->__alloc();
- __split_buffer<value_type, allocator_type&> __v(__recommend(size() + 1), size(), __a);
-// __v.emplace_back(std::forward<_Args>(__args)...);
- __alloc_traits::construct(__a, std::__to_address(__v.__end_), std::forward<_Args>(__args)...);
- __v.__end_++;
- __swap_out_circular_buffer(__v);
- return this->__end_;
+_LIBCPP_CONSTEXPR_SINCE_CXX20 typename vector<_Tp, _Allocator>::pointer
+vector<_Tp, _Allocator>::__emplace_back_slow_path(_Args&&... __args) {
+ allocator_type& __a = this->__alloc();
+ __split_buffer<value_type, allocator_type&> __v(__recommend(size() + 1), size(), __a);
+ // __v.emplace_back(std::forward<_Args>(__args)...);
+ __alloc_traits::construct(__a, std::__to_address(__v.__end_), std::forward<_Args>(__args)...);
+ __v.__end_++;
+ __swap_out_circular_buffer(__v);
+ return this->__end_;
}
template <class _Tp, class _Allocator>
template <class... _Args>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-inline
+_LIBCPP_CONSTEXPR_SINCE_CXX20 inline
#if _LIBCPP_STD_VER >= 17
-typename vector<_Tp, _Allocator>::reference
+ typename vector<_Tp, _Allocator>::reference
#else
-void
+ void
#endif
-vector<_Tp, _Allocator>::emplace_back(_Args&&... __args)
-{
- pointer __end = this->__end_;
- if (__end < this->__end_cap()) {
- __construct_one_at_end(std::forward<_Args>(__args)...);
- ++__end;
- } else {
- __end = __emplace_back_slow_path(std::forward<_Args>(__args)...);
- }
- this->__end_ = __end;
+ vector<_Tp, _Allocator>::emplace_back(_Args&&... __args) {
+ pointer __end = this->__end_;
+ if (__end < this->__end_cap()) {
+ __construct_one_at_end(std::forward<_Args>(__args)...);
+ ++__end;
+ } else {
+ __end = __emplace_back_slow_path(std::forward<_Args>(__args)...);
+ }
+ this->__end_ = __end;
#if _LIBCPP_STD_VER >= 17
- return *(__end - 1);
+ return *(__end - 1);
#endif
}
template <class _Tp, class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-inline
-void
-vector<_Tp, _Allocator>::pop_back()
-{
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(!empty(), "vector::pop_back called on an empty vector");
- this->__destruct_at_end(this->__end_ - 1);
+_LIBCPP_CONSTEXPR_SINCE_CXX20 inline void vector<_Tp, _Allocator>::pop_back() {
+ _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(!empty(), "vector::pop_back called on an empty vector");
+ this->__destruct_at_end(this->__end_ - 1);
}
template <class _Tp, class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-inline _LIBCPP_HIDE_FROM_ABI
-typename vector<_Tp, _Allocator>::iterator
-vector<_Tp, _Allocator>::erase(const_iterator __position)
-{
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__position != end(),
- "vector::erase(iterator) called with a non-dereferenceable iterator");
- difference_type __ps = __position - cbegin();
- pointer __p = this->__begin_ + __ps;
- this->__destruct_at_end(std::move(__p + 1, this->__end_, __p));
- return __make_iter(__p);
+_LIBCPP_CONSTEXPR_SINCE_CXX20 inline _LIBCPP_HIDE_FROM_ABI typename vector<_Tp, _Allocator>::iterator
+vector<_Tp, _Allocator>::erase(const_iterator __position) {
+ _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
+ __position != end(), "vector::erase(iterator) called with a non-dereferenceable iterator");
+ difference_type __ps = __position - cbegin();
+ pointer __p = this->__begin_ + __ps;
+ this->__destruct_at_end(std::move(__p + 1, this->__end_, __p));
+ return __make_iter(__p);
}
template <class _Tp, class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-typename vector<_Tp, _Allocator>::iterator
-vector<_Tp, _Allocator>::erase(const_iterator __first, const_iterator __last)
-{
- _LIBCPP_ASSERT_VALID_INPUT_RANGE(__first <= __last, "vector::erase(first, last) called with invalid range");
- pointer __p = this->__begin_ + (__first - begin());
- if (__first != __last) {
- this->__destruct_at_end(std::move(__p + (__last - __first), this->__end_, __p));
- }
- return __make_iter(__p);
+_LIBCPP_CONSTEXPR_SINCE_CXX20 typename vector<_Tp, _Allocator>::iterator
+vector<_Tp, _Allocator>::erase(const_iterator __first, const_iterator __last) {
+ _LIBCPP_ASSERT_VALID_INPUT_RANGE(__first <= __last, "vector::erase(first, last) called with invalid range");
+ pointer __p = this->__begin_ + (__first - begin());
+ if (__first != __last) {
+ this->__destruct_at_end(std::move(__p + (__last - __first), this->__end_, __p));
+ }
+ return __make_iter(__p);
}
template <class _Tp, class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-void
-vector<_Tp, _Allocator>::__move_range(pointer __from_s, pointer __from_e, pointer __to)
-{
- pointer __old_last = this->__end_;
- difference_type __n = __old_last - __to;
- {
- pointer __i = __from_s + __n;
- _ConstructTransaction __tx(*this, __from_e - __i);
- for (pointer __pos = __tx.__pos_; __i < __from_e;
- ++__i, (void) ++__pos, __tx.__pos_ = __pos) {
- __alloc_traits::construct(this->__alloc(),
- std::__to_address(__pos),
- std::move(*__i));
- }
+_LIBCPP_CONSTEXPR_SINCE_CXX20 void
+vector<_Tp, _Allocator>::__move_range(pointer __from_s, pointer __from_e, pointer __to) {
+ pointer __old_last = this->__end_;
+ difference_type __n = __old_last - __to;
+ {
+ pointer __i = __from_s + __n;
+ _ConstructTransaction __tx(*this, __from_e - __i);
+ for (pointer __pos = __tx.__pos_; __i < __from_e; ++__i, (void)++__pos, __tx.__pos_ = __pos) {
+ __alloc_traits::construct(this->__alloc(), std::__to_address(__pos), std::move(*__i));
}
- std::move_backward(__from_s, __from_s + __n, __old_last);
+ }
+ std::move_backward(__from_s, __from_s + __n, __old_last);
}
template <class _Tp, class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-typename vector<_Tp, _Allocator>::iterator
-vector<_Tp, _Allocator>::insert(const_iterator __position, const_reference __x)
-{
- pointer __p = this->__begin_ + (__position - begin());
- // We can't compare unrelated pointers inside constant expressions
- if (!__libcpp_is_constant_evaluated() && this->__end_ < this->__end_cap())
- {
- if (__p == this->__end_)
- {
- __construct_one_at_end(__x);
- }
- else
- {
- __move_range(__p, this->__end_, __p + 1);
- const_pointer __xr = pointer_traits<const_pointer>::pointer_to(__x);
- if (__p <= __xr && __xr < this->__end_)
- ++__xr;
- *__p = *__xr;
- }
- }
- else
- {
- allocator_type& __a = this->__alloc();
- __split_buffer<value_type, allocator_type&> __v(__recommend(size() + 1), __p - this->__begin_, __a);
- __v.push_back(__x);
- __p = __swap_out_circular_buffer(__v, __p);
+_LIBCPP_CONSTEXPR_SINCE_CXX20 typename vector<_Tp, _Allocator>::iterator
+vector<_Tp, _Allocator>::insert(const_iterator __position, const_reference __x) {
+ pointer __p = this->__begin_ + (__position - begin());
+ // We can't compare unrelated pointers inside constant expressions
+ if (!__libcpp_is_constant_evaluated() && this->__end_ < this->__end_cap()) {
+ if (__p == this->__end_) {
+ __construct_one_at_end(__x);
+ } else {
+ __move_range(__p, this->__end_, __p + 1);
+ const_pointer __xr = pointer_traits<const_pointer>::pointer_to(__x);
+ if (__p <= __xr && __xr < this->__end_)
+ ++__xr;
+ *__p = *__xr;
}
- return __make_iter(__p);
+ } else {
+ allocator_type& __a = this->__alloc();
+ __split_buffer<value_type, allocator_type&> __v(__recommend(size() + 1), __p - this->__begin_, __a);
+ __v.push_back(__x);
+ __p = __swap_out_circular_buffer(__v, __p);
+ }
+ return __make_iter(__p);
}
template <class _Tp, class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-typename vector<_Tp, _Allocator>::iterator
-vector<_Tp, _Allocator>::insert(const_iterator __position, value_type&& __x)
-{
- pointer __p = this->__begin_ + (__position - begin());
- if (this->__end_ < this->__end_cap())
- {
- if (__p == this->__end_)
- {
- __construct_one_at_end(std::move(__x));
- }
- else
- {
- __move_range(__p, this->__end_, __p + 1);
- *__p = std::move(__x);
- }
- }
- else
- {
- allocator_type& __a = this->__alloc();
- __split_buffer<value_type, allocator_type&> __v(__recommend(size() + 1), __p - this->__begin_, __a);
- __v.push_back(std::move(__x));
- __p = __swap_out_circular_buffer(__v, __p);
+_LIBCPP_CONSTEXPR_SINCE_CXX20 typename vector<_Tp, _Allocator>::iterator
+vector<_Tp, _Allocator>::insert(const_iterator __position, value_type&& __x) {
+ pointer __p = this->__begin_ + (__position - begin());
+ if (this->__end_ < this->__end_cap()) {
+ if (__p == this->__end_) {
+ __construct_one_at_end(std::move(__x));
+ } else {
+ __move_range(__p, this->__end_, __p + 1);
+ *__p = std::move(__x);
}
- return __make_iter(__p);
+ } else {
+ allocator_type& __a = this->__alloc();
+ __split_buffer<value_type, allocator_type&> __v(__recommend(size() + 1), __p - this->__begin_, __a);
+ __v.push_back(std::move(__x));
+ __p = __swap_out_circular_buffer(__v, __p);
+ }
+ return __make_iter(__p);
}
template <class _Tp, class _Allocator>
template <class... _Args>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-typename vector<_Tp, _Allocator>::iterator
-vector<_Tp, _Allocator>::emplace(const_iterator __position, _Args&&... __args)
-{
- pointer __p = this->__begin_ + (__position - begin());
- if (this->__end_ < this->__end_cap())
- {
- if (__p == this->__end_)
- {
- __construct_one_at_end(std::forward<_Args>(__args)...);
- }
- else
- {
- __temp_value<value_type, _Allocator> __tmp(this->__alloc(), std::forward<_Args>(__args)...);
- __move_range(__p, this->__end_, __p + 1);
- *__p = std::move(__tmp.get());
- }
- }
- else
- {
- allocator_type& __a = this->__alloc();
- __split_buffer<value_type, allocator_type&> __v(__recommend(size() + 1), __p - this->__begin_, __a);
- __v.emplace_back(std::forward<_Args>(__args)...);
- __p = __swap_out_circular_buffer(__v, __p);
+_LIBCPP_CONSTEXPR_SINCE_CXX20 typename vector<_Tp, _Allocator>::iterator
+vector<_Tp, _Allocator>::emplace(const_iterator __position, _Args&&... __args) {
+ pointer __p = this->__begin_ + (__position - begin());
+ if (this->__end_ < this->__end_cap()) {
+ if (__p == this->__end_) {
+ __construct_one_at_end(std::forward<_Args>(__args)...);
+ } else {
+ __temp_value<value_type, _Allocator> __tmp(this->__alloc(), std::forward<_Args>(__args)...);
+ __move_range(__p, this->__end_, __p + 1);
+ *__p = std::move(__tmp.get());
}
- return __make_iter(__p);
+ } else {
+ allocator_type& __a = this->__alloc();
+ __split_buffer<value_type, allocator_type&> __v(__recommend(size() + 1), __p - this->__begin_, __a);
+ __v.emplace_back(std::forward<_Args>(__args)...);
+ __p = __swap_out_circular_buffer(__v, __p);
+ }
+ return __make_iter(__p);
}
template <class _Tp, class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-typename vector<_Tp, _Allocator>::iterator
-vector<_Tp, _Allocator>::insert(const_iterator __position, size_type __n, const_reference __x)
-{
- pointer __p = this->__begin_ + (__position - begin());
- if (__n > 0)
- {
- // We can't compare unrelated pointers inside constant expressions
- if (!__libcpp_is_constant_evaluated() && __n <= static_cast<size_type>(this->__end_cap() - this->__end_))
- {
- size_type __old_n = __n;
- pointer __old_last = this->__end_;
- if (__n > static_cast<size_type>(this->__end_ - __p))
- {
- size_type __cx = __n - (this->__end_ - __p);
- __construct_at_end(__cx, __x);
- __n -= __cx;
- }
- if (__n > 0)
- {
- __move_range(__p, __old_last, __p + __old_n);
- const_pointer __xr = pointer_traits<const_pointer>::pointer_to(__x);
- if (__p <= __xr && __xr < this->__end_)
- __xr += __old_n;
- std::fill_n(__p, __n, *__xr);
- }
- }
- else
- {
- allocator_type& __a = this->__alloc();
- __split_buffer<value_type, allocator_type&> __v(__recommend(size() + __n), __p - this->__begin_, __a);
- __v.__construct_at_end(__n, __x);
- __p = __swap_out_circular_buffer(__v, __p);
- }
+_LIBCPP_CONSTEXPR_SINCE_CXX20 typename vector<_Tp, _Allocator>::iterator
+vector<_Tp, _Allocator>::insert(const_iterator __position, size_type __n, const_reference __x) {
+ pointer __p = this->__begin_ + (__position - begin());
+ if (__n > 0) {
+ // We can't compare unrelated pointers inside constant expressions
+ if (!__libcpp_is_constant_evaluated() && __n <= static_cast<size_type>(this->__end_cap() - this->__end_)) {
+ size_type __old_n = __n;
+ pointer __old_last = this->__end_;
+ if (__n > static_cast<size_type>(this->__end_ - __p)) {
+ size_type __cx = __n - (this->__end_ - __p);
+ __construct_at_end(__cx, __x);
+ __n -= __cx;
+ }
+ if (__n > 0) {
+ __move_range(__p, __old_last, __p + __old_n);
+ const_pointer __xr = pointer_traits<const_pointer>::pointer_to(__x);
+ if (__p <= __xr && __xr < this->__end_)
+ __xr += __old_n;
+ std::fill_n(__p, __n, *__xr);
+ }
+ } else {
+ allocator_type& __a = this->__alloc();
+ __split_buffer<value_type, allocator_type&> __v(__recommend(size() + __n), __p - this->__begin_, __a);
+ __v.__construct_at_end(__n, __x);
+ __p = __swap_out_circular_buffer(__v, __p);
}
- return __make_iter(__p);
+ }
+ return __make_iter(__p);
}
template <class _Tp, class _Allocator>
-template <class _InputIterator, __enable_if_t<__has_exactly_input_iterator_category<_InputIterator>::value &&
- is_constructible<_Tp, typename iterator_traits<_InputIterator>::reference>::value,
- int> >
+template <class _InputIterator,
+ __enable_if_t<__has_exactly_input_iterator_category<_InputIterator>::value &&
+ is_constructible<_Tp, typename iterator_traits<_InputIterator>::reference>::value,
+ int> >
_LIBCPP_CONSTEXPR_SINCE_CXX20 typename vector<_Tp, _Allocator>::iterator
-vector<_Tp, _Allocator>::insert(const_iterator __position, _InputIterator __first, _InputIterator __last)
-{
+vector<_Tp, _Allocator>::insert(const_iterator __position, _InputIterator __first, _InputIterator __last) {
return __insert_with_sentinel(__position, __first, __last);
}
template <class _Tp, class _Allocator>
template <class _InputIterator, class _Sentinel>
-_LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI
-typename vector<_Tp, _Allocator>::iterator
+_LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI typename vector<_Tp, _Allocator>::iterator
vector<_Tp, _Allocator>::__insert_with_sentinel(const_iterator __position, _InputIterator __first, _Sentinel __last) {
- difference_type __off = __position - begin();
- pointer __p = this->__begin_ + __off;
- allocator_type& __a = this->__alloc();
- pointer __old_last = this->__end_;
- for (; this->__end_ != this->__end_cap() && __first != __last; ++__first)
- {
- __construct_one_at_end(*__first);
- }
- __split_buffer<value_type, allocator_type&> __v(__a);
- if (__first != __last)
- {
+ difference_type __off = __position - begin();
+ pointer __p = this->__begin_ + __off;
+ allocator_type& __a = this->__alloc();
+ pointer __old_last = this->__end_;
+ for (; this->__end_ != this->__end_cap() && __first != __last; ++__first) {
+ __construct_one_at_end(*__first);
+ }
+ __split_buffer<value_type, allocator_type&> __v(__a);
+ if (__first != __last) {
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- try
- {
+ try {
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- __v.__construct_at_end_with_sentinel(std::move(__first), std::move(__last));
- difference_type __old_size = __old_last - this->__begin_;
- difference_type __old_p = __p - this->__begin_;
- reserve(__recommend(size() + __v.size()));
- __p = this->__begin_ + __old_p;
- __old_last = this->__begin_ + __old_size;
+ __v.__construct_at_end_with_sentinel(std::move(__first), std::move(__last));
+ difference_type __old_size = __old_last - this->__begin_;
+ difference_type __old_p = __p - this->__begin_;
+ reserve(__recommend(size() + __v.size()));
+ __p = this->__begin_ + __old_p;
+ __old_last = this->__begin_ + __old_size;
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- }
- catch (...)
- {
- erase(__make_iter(__old_last), end());
- throw;
- }
-#endif // _LIBCPP_HAS_NO_EXCEPTIONS
+ } catch (...) {
+ erase(__make_iter(__old_last), end());
+ throw;
}
- __p = std::rotate(__p, __old_last, this->__end_);
- insert(__make_iter(__p), std::make_move_iterator(__v.begin()),
- std::make_move_iterator(__v.end()));
- return begin() + __off;
+#endif // _LIBCPP_HAS_NO_EXCEPTIONS
+ }
+ __p = std::rotate(__p, __old_last, this->__end_);
+ insert(__make_iter(__p), std::make_move_iterator(__v.begin()), std::make_move_iterator(__v.end()));
+ return begin() + __off;
}
template <class _Tp, class _Allocator>
-template <class _ForwardIterator, __enable_if_t<__has_forward_iterator_category<_ForwardIterator>::value &&
- is_constructible<_Tp, typename iterator_traits<_ForwardIterator>::reference>::value,
- int> >
+template <class _ForwardIterator,
+ __enable_if_t<__has_forward_iterator_category<_ForwardIterator>::value &&
+ is_constructible<_Tp, typename iterator_traits<_ForwardIterator>::reference>::value,
+ int> >
_LIBCPP_CONSTEXPR_SINCE_CXX20 typename vector<_Tp, _Allocator>::iterator
-vector<_Tp, _Allocator>::insert(const_iterator __position, _ForwardIterator __first, _ForwardIterator __last)
-{
+vector<_Tp, _Allocator>::insert(const_iterator __position, _ForwardIterator __first, _ForwardIterator __last) {
return __insert_with_size(__position, __first, __last, std::distance(__first, __last));
}
template <class _Tp, class _Allocator>
template <class _Iterator, class _Sentinel>
-_LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI
-typename vector<_Tp, _Allocator>::iterator
-vector<_Tp, _Allocator>::__insert_with_size(const_iterator __position, _Iterator __first, _Sentinel __last,
- difference_type __n) {
- auto __insertion_size = __n;
- pointer __p = this->__begin_ + (__position - begin());
- if (__n > 0)
- {
- if (__n <= this->__end_cap() - this->__end_)
- {
- size_type __old_n = __n;
- pointer __old_last = this->__end_;
- _Iterator __m = std::next(__first, __n);
- difference_type __dx = this->__end_ - __p;
- if (__n > __dx)
- {
- __m = __first;
- difference_type __diff = this->__end_ - __p;
- std::advance(__m, __diff);
- __construct_at_end(__m, __last, __n - __diff);
- __n = __dx;
- }
- if (__n > 0)
- {
- __move_range(__p, __old_last, __p + __old_n);
- std::copy(__first, __m, __p);
- }
- }
- else
- {
- allocator_type& __a = this->__alloc();
- __split_buffer<value_type, allocator_type&> __v(__recommend(size() + __n), __p - this->__begin_, __a);
- __v.__construct_at_end_with_size(__first, __insertion_size);
- __p = __swap_out_circular_buffer(__v, __p);
- }
+_LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI typename vector<_Tp, _Allocator>::iterator
+vector<_Tp, _Allocator>::__insert_with_size(
+ const_iterator __position, _Iterator __first, _Sentinel __last, difference_type __n) {
+ auto __insertion_size = __n;
+ pointer __p = this->__begin_ + (__position - begin());
+ if (__n > 0) {
+ if (__n <= this->__end_cap() - this->__end_) {
+ size_type __old_n = __n;
+ pointer __old_last = this->__end_;
+ _Iterator __m = std::next(__first, __n);
+ difference_type __dx = this->__end_ - __p;
+ if (__n > __dx) {
+ __m = __first;
+ difference_type __diff = this->__end_ - __p;
+ std::advance(__m, __diff);
+ __construct_at_end(__m, __last, __n - __diff);
+ __n = __dx;
+ }
+ if (__n > 0) {
+ __move_range(__p, __old_last, __p + __old_n);
+ std::copy(__first, __m, __p);
+ }
+ } else {
+ allocator_type& __a = this->__alloc();
+ __split_buffer<value_type, allocator_type&> __v(__recommend(size() + __n), __p - this->__begin_, __a);
+ __v.__construct_at_end_with_size(__first, __insertion_size);
+ __p = __swap_out_circular_buffer(__v, __p);
}
- return __make_iter(__p);
+ }
+ return __make_iter(__p);
}
template <class _Tp, class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-void
-vector<_Tp, _Allocator>::resize(size_type __sz)
-{
- size_type __cs = size();
- if (__cs < __sz)
- this->__append(__sz - __cs);
- else if (__cs > __sz)
- this->__destruct_at_end(this->__begin_ + __sz);
+_LIBCPP_CONSTEXPR_SINCE_CXX20 void vector<_Tp, _Allocator>::resize(size_type __sz) {
+ size_type __cs = size();
+ if (__cs < __sz)
+ this->__append(__sz - __cs);
+ else if (__cs > __sz)
+ this->__destruct_at_end(this->__begin_ + __sz);
}
template <class _Tp, class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-void
-vector<_Tp, _Allocator>::resize(size_type __sz, const_reference __x)
-{
- size_type __cs = size();
- if (__cs < __sz)
- this->__append(__sz - __cs, __x);
- else if (__cs > __sz)
- this->__destruct_at_end(this->__begin_ + __sz);
+_LIBCPP_CONSTEXPR_SINCE_CXX20 void vector<_Tp, _Allocator>::resize(size_type __sz, const_reference __x) {
+ size_type __cs = size();
+ if (__cs < __sz)
+ this->__append(__sz - __cs, __x);
+ else if (__cs > __sz)
+ this->__destruct_at_end(this->__begin_ + __sz);
}
template <class _Tp, class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-void
-vector<_Tp, _Allocator>::swap(vector& __x)
+_LIBCPP_CONSTEXPR_SINCE_CXX20 void vector<_Tp, _Allocator>::swap(vector& __x)
#if _LIBCPP_STD_VER >= 14
_NOEXCEPT
#else
- _NOEXCEPT_(!__alloc_traits::propagate_on_container_swap::value ||
- __is_nothrow_swappable<allocator_type>::value)
+ _NOEXCEPT_(!__alloc_traits::propagate_on_container_swap::value || __is_nothrow_swappable<allocator_type>::value)
#endif
{
- _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(__alloc_traits::propagate_on_container_swap::value ||
- this->__alloc() == __x.__alloc(),
- "vector::swap: Either propagate_on_container_swap must be true"
- " or the allocators must compare equal");
- std::swap(this->__begin_, __x.__begin_);
- std::swap(this->__end_, __x.__end_);
- std::swap(this->__end_cap(), __x.__end_cap());
- std::__swap_allocator(this->__alloc(), __x.__alloc(),
- integral_constant<bool,__alloc_traits::propagate_on_container_swap::value>());
-}
-
-template <class _Tp, class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-bool
-vector<_Tp, _Allocator>::__invariants() const
-{
- if (this->__begin_ == nullptr)
- {
- if (this->__end_ != nullptr || this->__end_cap() != nullptr)
- return false;
- }
- else
- {
- if (this->__begin_ > this->__end_)
- return false;
- if (this->__begin_ == this->__end_cap())
- return false;
- if (this->__end_ > this->__end_cap())
- return false;
- }
- return true;
+ _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(
+ __alloc_traits::propagate_on_container_swap::value || this->__alloc() == __x.__alloc(),
+ "vector::swap: Either propagate_on_container_swap must be true"
+ " or the allocators must compare equal");
+ std::swap(this->__begin_, __x.__begin_);
+ std::swap(this->__end_, __x.__end_);
+ std::swap(this->__end_cap(), __x.__end_cap());
+ std::__swap_allocator(
+ this->__alloc(), __x.__alloc(), integral_constant<bool, __alloc_traits::propagate_on_container_swap::value>());
+}
+
+template <class _Tp, class _Allocator>
+_LIBCPP_CONSTEXPR_SINCE_CXX20 bool vector<_Tp, _Allocator>::__invariants() const {
+ if (this->__begin_ == nullptr) {
+ if (this->__end_ != nullptr || this->__end_cap() != nullptr)
+ return false;
+ } else {
+ if (this->__begin_ > this->__end_)
+ return false;
+ if (this->__begin_ == this->__end_cap())
+ return false;
+ if (this->__end_ > this->__end_cap())
+ return false;
+ }
+ return true;
}
// vector<bool>
-template <class _Allocator> class vector<bool, _Allocator>;
+template <class _Allocator>
+class vector<bool, _Allocator>;
-template <class _Allocator> struct hash<vector<bool, _Allocator> >;
+template <class _Allocator>
+struct hash<vector<bool, _Allocator> >;
template <class _Allocator>
-struct __has_storage_type<vector<bool, _Allocator> >
-{
- static const bool value = true;
+struct __has_storage_type<vector<bool, _Allocator> > {
+ static const bool value = true;
};
template <class _Allocator>
-class _LIBCPP_TEMPLATE_VIS vector<bool, _Allocator>
-{
+class _LIBCPP_TEMPLATE_VIS vector<bool, _Allocator> {
public:
- typedef vector __self;
- typedef bool value_type;
- typedef _Allocator allocator_type;
- typedef allocator_traits<allocator_type> __alloc_traits;
- typedef typename __alloc_traits::size_type size_type;
- typedef typename __alloc_traits::difference_type difference_type;
- typedef size_type __storage_type;
- typedef __bit_iterator<vector, false> pointer;
- typedef __bit_iterator<vector, true> const_pointer;
- typedef pointer iterator;
- typedef const_pointer const_iterator;
- typedef std::reverse_iterator<iterator> reverse_iterator;
- typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
+ typedef vector __self;
+ typedef bool value_type;
+ typedef _Allocator allocator_type;
+ typedef allocator_traits<allocator_type> __alloc_traits;
+ typedef typename __alloc_traits::size_type size_type;
+ typedef typename __alloc_traits::difference_type difference_type;
+ typedef size_type __storage_type;
+ typedef __bit_iterator<vector, false> pointer;
+ typedef __bit_iterator<vector, true> const_pointer;
+ typedef pointer iterator;
+ typedef const_pointer const_iterator;
+ typedef std::reverse_iterator<iterator> reverse_iterator;
+ typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
private:
- typedef __rebind_alloc<__alloc_traits, __storage_type> __storage_allocator;
- typedef allocator_traits<__storage_allocator> __storage_traits;
- typedef typename __storage_traits::pointer __storage_pointer;
- typedef typename __storage_traits::const_pointer __const_storage_pointer;
-
- __storage_pointer __begin_;
- size_type __size_;
- __compressed_pair<size_type, __storage_allocator> __cap_alloc_;
+ typedef __rebind_alloc<__alloc_traits, __storage_type> __storage_allocator;
+ typedef allocator_traits<__storage_allocator> __storage_traits;
+ typedef typename __storage_traits::pointer __storage_pointer;
+ typedef typename __storage_traits::const_pointer __const_storage_pointer;
+
+ __storage_pointer __begin_;
+ size_type __size_;
+ __compressed_pair<size_type, __storage_allocator> __cap_alloc_;
+
public:
- typedef __bit_reference<vector> reference;
+ typedef __bit_reference<vector> reference;
#ifdef _LIBCPP_ABI_BITSET_VECTOR_BOOL_CONST_SUBSCRIPT_RETURN_BOOL
- using const_reference = bool;
+ using const_reference = bool;
#else
- typedef __bit_const_reference<vector> const_reference;
+ typedef __bit_const_reference<vector> const_reference;
#endif
+
private:
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- size_type& __cap() _NOEXCEPT
- {return __cap_alloc_.first();}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- const size_type& __cap() const _NOEXCEPT
- {return __cap_alloc_.first();}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- __storage_allocator& __alloc() _NOEXCEPT
- {return __cap_alloc_.second();}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- const __storage_allocator& __alloc() const _NOEXCEPT
- {return __cap_alloc_.second();}
-
- static const unsigned __bits_per_word = static_cast<unsigned>(sizeof(__storage_type) * CHAR_BIT);
-
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- static size_type __internal_cap_to_external(size_type __n) _NOEXCEPT
- {return __n * __bits_per_word;}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- static size_type __external_cap_to_internal(size_type __n) _NOEXCEPT
- {return (__n - 1) / __bits_per_word + 1;}
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type& __cap() _NOEXCEPT { return __cap_alloc_.first(); }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 const size_type& __cap() const _NOEXCEPT {
+ return __cap_alloc_.first();
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 __storage_allocator& __alloc() _NOEXCEPT {
+ return __cap_alloc_.second();
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 const __storage_allocator& __alloc() const _NOEXCEPT {
+ return __cap_alloc_.second();
+ }
+
+ static const unsigned __bits_per_word = static_cast<unsigned>(sizeof(__storage_type) * CHAR_BIT);
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 static size_type
+ __internal_cap_to_external(size_type __n) _NOEXCEPT {
+ return __n * __bits_per_word;
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 static size_type
+ __external_cap_to_internal(size_type __n) _NOEXCEPT {
+ return (__n - 1) / __bits_per_word + 1;
+ }
public:
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- vector() _NOEXCEPT_(is_nothrow_default_constructible<allocator_type>::value);
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 vector()
+ _NOEXCEPT_(is_nothrow_default_constructible<allocator_type>::value);
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 explicit vector(const allocator_type& __a)
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 explicit vector(const allocator_type& __a)
#if _LIBCPP_STD_VER <= 14
- _NOEXCEPT_(is_nothrow_copy_constructible<allocator_type>::value);
+ _NOEXCEPT_(is_nothrow_copy_constructible<allocator_type>::value);
#else
- _NOEXCEPT;
+ _NOEXCEPT;
#endif
private:
class __destroy_vector {
- public:
- _LIBCPP_CONSTEXPR _LIBCPP_HIDE_FROM_ABI __destroy_vector(vector& __vec) : __vec_(__vec) {}
+ public:
+ _LIBCPP_CONSTEXPR _LIBCPP_HIDE_FROM_ABI __destroy_vector(vector& __vec) : __vec_(__vec) {}
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void operator()() {
- if (__vec_.__begin_ != nullptr)
- __storage_traits::deallocate(__vec_.__alloc(), __vec_.__begin_, __vec_.__cap());
- }
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void operator()() {
+ if (__vec_.__begin_ != nullptr)
+ __storage_traits::deallocate(__vec_.__alloc(), __vec_.__begin_, __vec_.__cap());
+ }
- private:
- vector& __vec_;
+ private:
+ vector& __vec_;
};
public:
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 ~vector() { __destroy_vector(*this)(); }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 ~vector() { __destroy_vector (*this)(); }
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 explicit vector(size_type __n);
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 explicit vector(size_type __n);
#if _LIBCPP_STD_VER >= 14
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 explicit vector(size_type __n, const allocator_type& __a);
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 explicit vector(size_type __n, const allocator_type& __a);
#endif
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 vector(size_type __n, const value_type& __v);
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 vector(size_type __n, const value_type& __v, const allocator_type& __a);
- template <class _InputIterator, __enable_if_t<__has_exactly_input_iterator_category<_InputIterator>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 vector(_InputIterator __first, _InputIterator __last);
- template <class _InputIterator, __enable_if_t<__has_exactly_input_iterator_category<_InputIterator>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 vector(_InputIterator __first, _InputIterator __last, const allocator_type& __a);
- template <class _ForwardIterator, __enable_if_t<__has_forward_iterator_category<_ForwardIterator>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 vector(_ForwardIterator __first, _ForwardIterator __last);
- template <class _ForwardIterator, __enable_if_t<__has_forward_iterator_category<_ForwardIterator>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 vector(_ForwardIterator __first, _ForwardIterator __last, const allocator_type& __a);
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 vector(size_type __n, const value_type& __v);
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
+ vector(size_type __n, const value_type& __v, const allocator_type& __a);
+ template <class _InputIterator, __enable_if_t<__has_exactly_input_iterator_category<_InputIterator>::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 vector(_InputIterator __first, _InputIterator __last);
+ template <class _InputIterator, __enable_if_t<__has_exactly_input_iterator_category<_InputIterator>::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
+ vector(_InputIterator __first, _InputIterator __last, const allocator_type& __a);
+ template <class _ForwardIterator, __enable_if_t<__has_forward_iterator_category<_ForwardIterator>::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 vector(_ForwardIterator __first, _ForwardIterator __last);
+ template <class _ForwardIterator, __enable_if_t<__has_forward_iterator_category<_ForwardIterator>::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
+ vector(_ForwardIterator __first, _ForwardIterator __last, const allocator_type& __a);
#if _LIBCPP_STD_VER >= 23
- template <_ContainerCompatibleRange<bool> _Range>
- _LIBCPP_HIDE_FROM_ABI constexpr
- vector(from_range_t, _Range&& __range, const allocator_type& __a = allocator_type())
- : __begin_(nullptr),
- __size_(0),
- __cap_alloc_(0, static_cast<__storage_allocator>(__a)) {
- if constexpr (ranges::forward_range<_Range> || ranges::sized_range<_Range>) {
- auto __n = static_cast<size_type>(ranges::distance(__range));
- __init_with_size(ranges::begin(__range), ranges::end(__range), __n);
+ template <_ContainerCompatibleRange<bool> _Range>
+ _LIBCPP_HIDE_FROM_ABI constexpr vector(from_range_t, _Range&& __range, const allocator_type& __a = allocator_type())
+ : __begin_(nullptr), __size_(0), __cap_alloc_(0, static_cast<__storage_allocator>(__a)) {
+ if constexpr (ranges::forward_range<_Range> || ranges::sized_range<_Range>) {
+ auto __n = static_cast<size_type>(ranges::distance(__range));
+ __init_with_size(ranges::begin(__range), ranges::end(__range), __n);
- } else {
- __init_with_sentinel(ranges::begin(__range), ranges::end(__range));
- }
+ } else {
+ __init_with_sentinel(ranges::begin(__range), ranges::end(__range));
}
+ }
#endif
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 vector(const vector& __v);
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 vector(const vector& __v, const allocator_type& __a);
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 vector& operator=(const vector& __v);
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 vector(const vector& __v);
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 vector(const vector& __v, const allocator_type& __a);
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 vector& operator=(const vector& __v);
#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 vector(initializer_list<value_type> __il);
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 vector(initializer_list<value_type> __il, const allocator_type& __a);
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 vector(initializer_list<value_type> __il);
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
+ vector(initializer_list<value_type> __il, const allocator_type& __a);
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- vector& operator=(initializer_list<value_type> __il)
- {assign(__il.begin(), __il.end()); return *this;}
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 vector& operator=(initializer_list<value_type> __il) {
+ assign(__il.begin(), __il.end());
+ return *this;
+ }
#endif // !_LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- vector(vector&& __v)
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 vector(vector&& __v)
#if _LIBCPP_STD_VER >= 17
- noexcept;
+ noexcept;
#else
- _NOEXCEPT_(is_nothrow_move_constructible<allocator_type>::value);
+ _NOEXCEPT_(is_nothrow_move_constructible<allocator_type>::value);
#endif
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 vector(vector&& __v, const __type_identity_t<allocator_type>& __a);
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- vector& operator=(vector&& __v)
- _NOEXCEPT_((__noexcept_move_assign_container<_Allocator, __alloc_traits>::value));
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
+ vector(vector&& __v, const __type_identity_t<allocator_type>& __a);
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 vector& operator=(vector&& __v)
+ _NOEXCEPT_((__noexcept_move_assign_container<_Allocator, __alloc_traits>::value));
- template <class _InputIterator, __enable_if_t<__has_exactly_input_iterator_category<_InputIterator>::value, int> = 0>
- void
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 assign(_InputIterator __first, _InputIterator __last);
- template <class _ForwardIterator, __enable_if_t<__has_forward_iterator_category<_ForwardIterator>::value, int> = 0>
- void
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 assign(_ForwardIterator __first, _ForwardIterator __last);
+ template <class _InputIterator, __enable_if_t<__has_exactly_input_iterator_category<_InputIterator>::value, int> = 0>
+ void _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 assign(_InputIterator __first, _InputIterator __last);
+ template <class _ForwardIterator, __enable_if_t<__has_forward_iterator_category<_ForwardIterator>::value, int> = 0>
+ void _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 assign(_ForwardIterator __first, _ForwardIterator __last);
#if _LIBCPP_STD_VER >= 23
- template <_ContainerCompatibleRange<bool> _Range>
- _LIBCPP_HIDE_FROM_ABI
- constexpr void assign_range(_Range&& __range) {
- if constexpr (ranges::forward_range<_Range> || ranges::sized_range<_Range>) {
- auto __n = static_cast<size_type>(ranges::distance(__range));
- __assign_with_size(ranges::begin(__range), ranges::end(__range), __n);
-
- } else {
- __assign_with_sentinel(ranges::begin(__range), ranges::end(__range));
- }
+ template <_ContainerCompatibleRange<bool> _Range>
+ _LIBCPP_HIDE_FROM_ABI constexpr void assign_range(_Range&& __range) {
+ if constexpr (ranges::forward_range<_Range> || ranges::sized_range<_Range>) {
+ auto __n = static_cast<size_type>(ranges::distance(__range));
+ __assign_with_size(ranges::begin(__range), ranges::end(__range), __n);
+
+ } else {
+ __assign_with_sentinel(ranges::begin(__range), ranges::end(__range));
}
+ }
#endif
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void assign(size_type __n, const value_type& __x);
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void assign(size_type __n, const value_type& __x);
#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- void assign(initializer_list<value_type> __il)
- {assign(__il.begin(), __il.end());}
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void assign(initializer_list<value_type> __il) {
+ assign(__il.begin(), __il.end());
+ }
#endif
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 allocator_type get_allocator() const _NOEXCEPT
- {return allocator_type(this->__alloc());}
-
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type max_size() const _NOEXCEPT;
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- size_type capacity() const _NOEXCEPT
- {return __internal_cap_to_external(__cap());}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- size_type size() const _NOEXCEPT
- {return __size_;}
- _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- bool empty() const _NOEXCEPT
- {return __size_ == 0;}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void reserve(size_type __n);
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void shrink_to_fit() _NOEXCEPT;
-
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- iterator begin() _NOEXCEPT
- {return __make_iter(0);}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- const_iterator begin() const _NOEXCEPT
- {return __make_iter(0);}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- iterator end() _NOEXCEPT
- {return __make_iter(__size_);}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- const_iterator end() const _NOEXCEPT
- {return __make_iter(__size_);}
-
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- reverse_iterator rbegin() _NOEXCEPT
- {return reverse_iterator(end());}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- const_reverse_iterator rbegin() const _NOEXCEPT
- {return const_reverse_iterator(end());}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- reverse_iterator rend() _NOEXCEPT
- {return reverse_iterator(begin());}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- const_reverse_iterator rend() const _NOEXCEPT
- {return const_reverse_iterator(begin());}
-
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- const_iterator cbegin() const _NOEXCEPT
- {return __make_iter(0);}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- const_iterator cend() const _NOEXCEPT
- {return __make_iter(__size_);}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- const_reverse_iterator crbegin() const _NOEXCEPT
- {return rbegin();}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- const_reverse_iterator crend() const _NOEXCEPT
- {return rend();}
-
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 reference operator[](size_type __n) {return __make_ref(__n);}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 const_reference operator[](size_type __n) const {return __make_ref(__n);}
- _LIBCPP_HIDE_FROM_ABI reference at(size_type __n);
- _LIBCPP_HIDE_FROM_ABI const_reference at(size_type __n) const;
-
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 reference front() {return __make_ref(0);}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 const_reference front() const {return __make_ref(0);}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 reference back() {return __make_ref(__size_ - 1);}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 const_reference back() const {return __make_ref(__size_ - 1);}
-
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void push_back(const value_type& __x);
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 allocator_type get_allocator() const _NOEXCEPT {
+ return allocator_type(this->__alloc());
+ }
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type max_size() const _NOEXCEPT;
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type capacity() const _NOEXCEPT {
+ return __internal_cap_to_external(__cap());
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type size() const _NOEXCEPT { return __size_; }
+ _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool empty() const _NOEXCEPT {
+ return __size_ == 0;
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void reserve(size_type __n);
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void shrink_to_fit() _NOEXCEPT;
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 iterator begin() _NOEXCEPT { return __make_iter(0); }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 const_iterator begin() const _NOEXCEPT { return __make_iter(0); }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 iterator end() _NOEXCEPT { return __make_iter(__size_); }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 const_iterator end() const _NOEXCEPT {
+ return __make_iter(__size_);
+ }
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 reverse_iterator rbegin() _NOEXCEPT {
+ return reverse_iterator(end());
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 const_reverse_iterator rbegin() const _NOEXCEPT {
+ return const_reverse_iterator(end());
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 reverse_iterator rend() _NOEXCEPT {
+ return reverse_iterator(begin());
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 const_reverse_iterator rend() const _NOEXCEPT {
+ return const_reverse_iterator(begin());
+ }
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 const_iterator cbegin() const _NOEXCEPT { return __make_iter(0); }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 const_iterator cend() const _NOEXCEPT {
+ return __make_iter(__size_);
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 const_reverse_iterator crbegin() const _NOEXCEPT {
+ return rbegin();
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 const_reverse_iterator crend() const _NOEXCEPT { return rend(); }
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 reference operator[](size_type __n) { return __make_ref(__n); }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 const_reference operator[](size_type __n) const {
+ return __make_ref(__n);
+ }
+ _LIBCPP_HIDE_FROM_ABI reference at(size_type __n);
+ _LIBCPP_HIDE_FROM_ABI const_reference at(size_type __n) const;
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 reference front() { return __make_ref(0); }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 const_reference front() const { return __make_ref(0); }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 reference back() { return __make_ref(__size_ - 1); }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 const_reference back() const { return __make_ref(__size_ - 1); }
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void push_back(const value_type& __x);
#if _LIBCPP_STD_VER >= 14
- template <class... _Args>
-#if _LIBCPP_STD_VER >= 17
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 reference emplace_back(_Args&&... __args)
-#else
- _LIBCPP_HIDE_FROM_ABI void emplace_back(_Args&&... __args)
-#endif
- {
- push_back ( value_type ( std::forward<_Args>(__args)... ));
-#if _LIBCPP_STD_VER >= 17
- return this->back();
-#endif
- }
+ template <class... _Args>
+# if _LIBCPP_STD_VER >= 17
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 reference emplace_back(_Args&&... __args)
+# else
+ _LIBCPP_HIDE_FROM_ABI void emplace_back(_Args&&... __args)
+# endif
+ {
+ push_back(value_type(std::forward<_Args>(__args)...));
+# if _LIBCPP_STD_VER >= 17
+ return this->back();
+# endif
+ }
#endif
#if _LIBCPP_STD_VER >= 23
- template <_ContainerCompatibleRange<bool> _Range>
- _LIBCPP_HIDE_FROM_ABI
- constexpr void append_range(_Range&& __range) {
- insert_range(end(), std::forward<_Range>(__range));
- }
+ template <_ContainerCompatibleRange<bool> _Range>
+ _LIBCPP_HIDE_FROM_ABI constexpr void append_range(_Range&& __range) {
+ insert_range(end(), std::forward<_Range>(__range));
+ }
#endif
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void pop_back() {--__size_;}
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void pop_back() { --__size_; }
#if _LIBCPP_STD_VER >= 14
- template <class... _Args>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 iterator emplace(const_iterator __position, _Args&&... __args)
- { return insert ( __position, value_type ( std::forward<_Args>(__args)... )); }
+ template <class... _Args>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 iterator emplace(const_iterator __position, _Args&&... __args) {
+ return insert(__position, value_type(std::forward<_Args>(__args)...));
+ }
#endif
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 iterator insert(const_iterator __position, const value_type& __x);
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 iterator insert(const_iterator __position, size_type __n, const value_type& __x);
- template <class _InputIterator, __enable_if_t<__has_exactly_input_iterator_category<_InputIterator>::value, int> = 0>
- iterator
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 insert(const_iterator __position, _InputIterator __first, _InputIterator __last);
- template <class _ForwardIterator, __enable_if_t<__has_forward_iterator_category<_ForwardIterator>::value, int> = 0>
- iterator
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 insert(const_iterator __position, _ForwardIterator __first, _ForwardIterator __last);
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 iterator insert(const_iterator __position, const value_type& __x);
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 iterator
+ insert(const_iterator __position, size_type __n, const value_type& __x);
+ template <class _InputIterator, __enable_if_t<__has_exactly_input_iterator_category<_InputIterator>::value, int> = 0>
+ iterator _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
+ insert(const_iterator __position, _InputIterator __first, _InputIterator __last);
+ template <class _ForwardIterator, __enable_if_t<__has_forward_iterator_category<_ForwardIterator>::value, int> = 0>
+ iterator _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
+ insert(const_iterator __position, _ForwardIterator __first, _ForwardIterator __last);
#if _LIBCPP_STD_VER >= 23
- template <_ContainerCompatibleRange<bool> _Range>
- _LIBCPP_HIDE_FROM_ABI
- constexpr iterator insert_range(const_iterator __position, _Range&& __range) {
- if constexpr (ranges::forward_range<_Range> || ranges::sized_range<_Range>) {
- auto __n = static_cast<size_type>(ranges::distance(__range));
- return __insert_with_size(__position, ranges::begin(__range), ranges::end(__range), __n);
-
- } else {
- return __insert_with_sentinel(__position, ranges::begin(__range), ranges::end(__range));
- }
+ template <_ContainerCompatibleRange<bool> _Range>
+ _LIBCPP_HIDE_FROM_ABI constexpr iterator insert_range(const_iterator __position, _Range&& __range) {
+ if constexpr (ranges::forward_range<_Range> || ranges::sized_range<_Range>) {
+ auto __n = static_cast<size_type>(ranges::distance(__range));
+ return __insert_with_size(__position, ranges::begin(__range), ranges::end(__range), __n);
+
+ } else {
+ return __insert_with_sentinel(__position, ranges::begin(__range), ranges::end(__range));
}
+ }
#endif
#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- iterator insert(const_iterator __position, initializer_list<value_type> __il)
- {return insert(__position, __il.begin(), __il.end());}
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 iterator
+ insert(const_iterator __position, initializer_list<value_type> __il) {
+ return insert(__position, __il.begin(), __il.end());
+ }
#endif
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 iterator erase(const_iterator __position);
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 iterator erase(const_iterator __first, const_iterator __last);
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 iterator erase(const_iterator __position);
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 iterator erase(const_iterator __first, const_iterator __last);
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- void clear() _NOEXCEPT {__size_ = 0;}
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void clear() _NOEXCEPT { __size_ = 0; }
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void swap(vector&)
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void swap(vector&)
#if _LIBCPP_STD_VER >= 14
- _NOEXCEPT;
+ _NOEXCEPT;
#else
- _NOEXCEPT_(!__alloc_traits::propagate_on_container_swap::value ||
- __is_nothrow_swappable<allocator_type>::value);
+ _NOEXCEPT_(!__alloc_traits::propagate_on_container_swap::value || __is_nothrow_swappable<allocator_type>::value);
#endif
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 static void swap(reference __x, reference __y) _NOEXCEPT { std::swap(__x, __y); }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 static void swap(reference __x, reference __y) _NOEXCEPT {
+ std::swap(__x, __y);
+ }
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void resize(size_type __sz, value_type __x = false);
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void flip() _NOEXCEPT;
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void resize(size_type __sz, value_type __x = false);
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void flip() _NOEXCEPT;
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool __invariants() const;
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool __invariants() const;
private:
- _LIBCPP_NORETURN _LIBCPP_HIDE_FROM_ABI
- void __throw_length_error() const {
- std::__throw_length_error("vector");
- }
+ _LIBCPP_NORETURN _LIBCPP_HIDE_FROM_ABI void __throw_length_error() const { std::__throw_length_error("vector"); }
- _LIBCPP_NORETURN _LIBCPP_HIDE_FROM_ABI
- void __throw_out_of_range() const {
- std::__throw_out_of_range("vector");
- }
+ _LIBCPP_NORETURN _LIBCPP_HIDE_FROM_ABI void __throw_out_of_range() const { std::__throw_out_of_range("vector"); }
- template <class _InputIterator, class _Sentinel>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- void __init_with_size(_InputIterator __first, _Sentinel __last, size_type __n) {
- auto __guard = std::__make_exception_guard(__destroy_vector(*this));
-
- if (__n > 0) {
- __vallocate(__n);
- __construct_at_end(std::move(__first), std::move(__last), __n);
- }
+ template <class _InputIterator, class _Sentinel>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void
+ __init_with_size(_InputIterator __first, _Sentinel __last, size_type __n) {
+ auto __guard = std::__make_exception_guard(__destroy_vector(*this));
- __guard.__complete();
+ if (__n > 0) {
+ __vallocate(__n);
+ __construct_at_end(std::move(__first), std::move(__last), __n);
}
- template <class _InputIterator, class _Sentinel>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- void __init_with_sentinel(_InputIterator __first, _Sentinel __last) {
+ __guard.__complete();
+ }
+
+ template <class _InputIterator, class _Sentinel>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void
+ __init_with_sentinel(_InputIterator __first, _Sentinel __last) {
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- try {
+ try {
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- for (; __first != __last; ++__first)
- push_back(*__first);
+ for (; __first != __last; ++__first)
+ push_back(*__first);
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- } catch (...) {
- if (__begin_ != nullptr)
- __storage_traits::deallocate(__alloc(), __begin_, __cap());
- throw;
- }
-#endif // _LIBCPP_HAS_NO_EXCEPTIONS
+ } catch (...) {
+ if (__begin_ != nullptr)
+ __storage_traits::deallocate(__alloc(), __begin_, __cap());
+ throw;
}
+#endif // _LIBCPP_HAS_NO_EXCEPTIONS
+ }
template <class _Iterator, class _Sentinel>
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI
- void __assign_with_sentinel(_Iterator __first, _Sentinel __last);
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __assign_with_sentinel(_Iterator __first, _Sentinel __last);
template <class _ForwardIterator, class _Sentinel>
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI
- void __assign_with_size(_ForwardIterator __first, _Sentinel __last, difference_type __ns);
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void
+ __assign_with_size(_ForwardIterator __first, _Sentinel __last, difference_type __ns);
template <class _InputIterator, class _Sentinel>
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI
- iterator __insert_with_sentinel(const_iterator __position, _InputIterator __first, _Sentinel __last);
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI iterator
+ __insert_with_sentinel(const_iterator __position, _InputIterator __first, _Sentinel __last);
template <class _Iterator, class _Sentinel>
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI
- iterator __insert_with_size(const_iterator __position, _Iterator __first, _Sentinel __last, difference_type __n);
-
- // Allocate space for __n objects
- // throws length_error if __n > max_size()
- // throws (probably bad_alloc) if memory run out
- // Precondition: __begin_ == __end_ == __cap() == 0
- // Precondition: __n > 0
- // Postcondition: capacity() >= __n
- // Postcondition: size() == 0
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __vallocate(size_type __n) {
- if (__n > max_size())
- __throw_length_error();
- auto __allocation = std::__allocate_at_least(__alloc(), __external_cap_to_internal(__n));
- __begin_ = __allocation.ptr;
- __size_ = 0;
- __cap() = __allocation.count;
- if (__libcpp_is_constant_evaluated()) {
- for (size_type __i = 0; __i != __cap(); ++__i)
- std::__construct_at(std::__to_address(__begin_) + __i);
- }
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI iterator
+ __insert_with_size(const_iterator __position, _Iterator __first, _Sentinel __last, difference_type __n);
+
+ // Allocate space for __n objects
+ // throws length_error if __n > max_size()
+ // throws (probably bad_alloc) if memory run out
+ // Precondition: __begin_ == __end_ == __cap() == 0
+ // Precondition: __n > 0
+ // Postcondition: capacity() >= __n
+ // Postcondition: size() == 0
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __vallocate(size_type __n) {
+ if (__n > max_size())
+ __throw_length_error();
+ auto __allocation = std::__allocate_at_least(__alloc(), __external_cap_to_internal(__n));
+ __begin_ = __allocation.ptr;
+ __size_ = 0;
+ __cap() = __allocation.count;
+ if (__libcpp_is_constant_evaluated()) {
+ for (size_type __i = 0; __i != __cap(); ++__i)
+ std::__construct_at(std::__to_address(__begin_) + __i);
}
+ }
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __vdeallocate() _NOEXCEPT;
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- static size_type __align_it(size_type __new_size) _NOEXCEPT
- {return (__new_size + (__bits_per_word-1)) & ~((size_type)__bits_per_word-1);}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type __recommend(size_type __new_size) const;
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __construct_at_end(size_type __n, bool __x);
- template <class _InputIterator, class _Sentinel>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- void __construct_at_end(_InputIterator __first, _Sentinel __last, size_type __n);
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __append(size_type __n, const_reference __x);
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- reference __make_ref(size_type __pos) _NOEXCEPT
- {return reference(__begin_ + __pos / __bits_per_word, __storage_type(1) << __pos % __bits_per_word);}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- const_reference __make_ref(size_type __pos) const _NOEXCEPT {
- return __bit_const_reference<vector>(__begin_ + __pos / __bits_per_word,
- __storage_type(1) << __pos % __bits_per_word);
- }
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- iterator __make_iter(size_type __pos) _NOEXCEPT
- {return iterator(__begin_ + __pos / __bits_per_word, static_cast<unsigned>(__pos % __bits_per_word));}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- const_iterator __make_iter(size_type __pos) const _NOEXCEPT
- {return const_iterator(__begin_ + __pos / __bits_per_word, static_cast<unsigned>(__pos % __bits_per_word));}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- iterator __const_iterator_cast(const_iterator __p) _NOEXCEPT
- {return begin() + (__p - cbegin());}
-
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- void __copy_assign_alloc(const vector& __v)
- {__copy_assign_alloc(__v, integral_constant<bool,
- __storage_traits::propagate_on_container_copy_assignment::value>());}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- void __copy_assign_alloc(const vector& __c, true_type)
- {
- if (__alloc() != __c.__alloc())
- __vdeallocate();
- __alloc() = __c.__alloc();
- }
-
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- void __copy_assign_alloc(const vector&, false_type)
- {}
-
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __move_assign(vector& __c, false_type);
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __move_assign(vector& __c, true_type)
- _NOEXCEPT_(is_nothrow_move_assignable<allocator_type>::value);
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- void __move_assign_alloc(vector& __c)
- _NOEXCEPT_(
- !__storage_traits::propagate_on_container_move_assignment::value ||
- is_nothrow_move_assignable<allocator_type>::value)
- {__move_assign_alloc(__c, integral_constant<bool,
- __storage_traits::propagate_on_container_move_assignment::value>());}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- void __move_assign_alloc(vector& __c, true_type)
- _NOEXCEPT_(is_nothrow_move_assignable<allocator_type>::value)
- {
- __alloc() = std::move(__c.__alloc());
- }
-
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- void __move_assign_alloc(vector&, false_type)
- _NOEXCEPT
- {}
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __vdeallocate() _NOEXCEPT;
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 static size_type __align_it(size_type __new_size) _NOEXCEPT {
+ return (__new_size + (__bits_per_word - 1)) & ~((size_type)__bits_per_word - 1);
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type __recommend(size_type __new_size) const;
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __construct_at_end(size_type __n, bool __x);
+ template <class _InputIterator, class _Sentinel>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void
+ __construct_at_end(_InputIterator __first, _Sentinel __last, size_type __n);
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __append(size_type __n, const_reference __x);
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 reference __make_ref(size_type __pos) _NOEXCEPT {
+ return reference(__begin_ + __pos / __bits_per_word, __storage_type(1) << __pos % __bits_per_word);
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 const_reference __make_ref(size_type __pos) const _NOEXCEPT {
+ return __bit_const_reference<vector>(
+ __begin_ + __pos / __bits_per_word, __storage_type(1) << __pos % __bits_per_word);
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 iterator __make_iter(size_type __pos) _NOEXCEPT {
+ return iterator(__begin_ + __pos / __bits_per_word, static_cast<unsigned>(__pos % __bits_per_word));
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 const_iterator __make_iter(size_type __pos) const _NOEXCEPT {
+ return const_iterator(__begin_ + __pos / __bits_per_word, static_cast<unsigned>(__pos % __bits_per_word));
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 iterator __const_iterator_cast(const_iterator __p) _NOEXCEPT {
+ return begin() + (__p - cbegin());
+ }
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_t __hash_code() const _NOEXCEPT;
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __copy_assign_alloc(const vector& __v) {
+ __copy_assign_alloc(
+ __v, integral_constant<bool, __storage_traits::propagate_on_container_copy_assignment::value>());
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __copy_assign_alloc(const vector& __c, true_type) {
+ if (__alloc() != __c.__alloc())
+ __vdeallocate();
+ __alloc() = __c.__alloc();
+ }
- friend class __bit_reference<vector>;
- friend class __bit_const_reference<vector>;
- friend class __bit_iterator<vector, false>;
- friend class __bit_iterator<vector, true>;
- friend struct __bit_array<vector>;
- friend struct _LIBCPP_TEMPLATE_VIS hash<vector>;
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __copy_assign_alloc(const vector&, false_type) {}
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __move_assign(vector& __c, false_type);
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __move_assign(vector& __c, true_type)
+ _NOEXCEPT_(is_nothrow_move_assignable<allocator_type>::value);
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __move_assign_alloc(vector& __c)
+ _NOEXCEPT_(!__storage_traits::propagate_on_container_move_assignment::value ||
+ is_nothrow_move_assignable<allocator_type>::value) {
+ __move_assign_alloc(
+ __c, integral_constant<bool, __storage_traits::propagate_on_container_move_assignment::value>());
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __move_assign_alloc(vector& __c, true_type)
+ _NOEXCEPT_(is_nothrow_move_assignable<allocator_type>::value) {
+ __alloc() = std::move(__c.__alloc());
+ }
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __move_assign_alloc(vector&, false_type) _NOEXCEPT {}
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_t __hash_code() const _NOEXCEPT;
+
+ friend class __bit_reference<vector>;
+ friend class __bit_const_reference<vector>;
+ friend class __bit_iterator<vector, false>;
+ friend class __bit_iterator<vector, true>;
+ friend struct __bit_array<vector>;
+ friend struct _LIBCPP_TEMPLATE_VIS hash<vector>;
};
template <class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20 void
-vector<bool, _Allocator>::__vdeallocate() _NOEXCEPT
-{
- if (this->__begin_ != nullptr)
- {
- __storage_traits::deallocate(this->__alloc(), this->__begin_, __cap());
- this->__begin_ = nullptr;
- this->__size_ = this->__cap() = 0;
- }
+_LIBCPP_CONSTEXPR_SINCE_CXX20 void vector<bool, _Allocator>::__vdeallocate() _NOEXCEPT {
+ if (this->__begin_ != nullptr) {
+ __storage_traits::deallocate(this->__alloc(), this->__begin_, __cap());
+ this->__begin_ = nullptr;
+ this->__size_ = this->__cap() = 0;
+ }
}
template <class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-typename vector<bool, _Allocator>::size_type
-vector<bool, _Allocator>::max_size() const _NOEXCEPT
-{
- size_type __amax = __storage_traits::max_size(__alloc());
- size_type __nmax = numeric_limits<size_type>::max() / 2; // end() >= begin(), always
- if (__nmax / __bits_per_word <= __amax)
- return __nmax;
- return __internal_cap_to_external(__amax);
+_LIBCPP_CONSTEXPR_SINCE_CXX20 typename vector<bool, _Allocator>::size_type
+vector<bool, _Allocator>::max_size() const _NOEXCEPT {
+ size_type __amax = __storage_traits::max_size(__alloc());
+ size_type __nmax = numeric_limits<size_type>::max() / 2; // end() >= begin(), always
+ if (__nmax / __bits_per_word <= __amax)
+ return __nmax;
+ return __internal_cap_to_external(__amax);
}
// Precondition: __new_size > capacity()
template <class _Allocator>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-typename vector<bool, _Allocator>::size_type
-vector<bool, _Allocator>::__recommend(size_type __new_size) const
-{
- const size_type __ms = max_size();
- if (__new_size > __ms)
- this->__throw_length_error();
- const size_type __cap = capacity();
- if (__cap >= __ms / 2)
- return __ms;
- return std::max(2 * __cap, __align_it(__new_size));
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 typename vector<bool, _Allocator>::size_type
+vector<bool, _Allocator>::__recommend(size_type __new_size) const {
+ const size_type __ms = max_size();
+ if (__new_size > __ms)
+ this->__throw_length_error();
+ const size_type __cap = capacity();
+ if (__cap >= __ms / 2)
+ return __ms;
+ return std::max(2 * __cap, __align_it(__new_size));
}
// Default constructs __n objects starting at __end_
@@ -2581,128 +2290,92 @@ vector<bool, _Allocator>::__recommend(size_type __new_size) const
// Precondition: size() + __n <= capacity()
// Postcondition: size() == size() + __n
template <class _Allocator>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-void
-vector<bool, _Allocator>::__construct_at_end(size_type __n, bool __x)
-{
- size_type __old_size = this->__size_;
- this->__size_ += __n;
- if (__old_size == 0 || ((__old_size - 1) / __bits_per_word) != ((this->__size_ - 1) / __bits_per_word))
- {
- if (this->__size_ <= __bits_per_word)
- this->__begin_[0] = __storage_type(0);
- else
- this->__begin_[(this->__size_ - 1) / __bits_per_word] = __storage_type(0);
- }
- std::fill_n(__make_iter(__old_size), __n, __x);
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void
+vector<bool, _Allocator>::__construct_at_end(size_type __n, bool __x) {
+ size_type __old_size = this->__size_;
+ this->__size_ += __n;
+ if (__old_size == 0 || ((__old_size - 1) / __bits_per_word) != ((this->__size_ - 1) / __bits_per_word)) {
+ if (this->__size_ <= __bits_per_word)
+ this->__begin_[0] = __storage_type(0);
+ else
+ this->__begin_[(this->__size_ - 1) / __bits_per_word] = __storage_type(0);
+ }
+ std::fill_n(__make_iter(__old_size), __n, __x);
}
template <class _Allocator>
template <class _InputIterator, class _Sentinel>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-void vector<bool, _Allocator>::__construct_at_end(_InputIterator __first, _Sentinel __last, size_type __n) {
- size_type __old_size = this->__size_;
- this->__size_ += __n;
- if (__old_size == 0 || ((__old_size - 1) / __bits_per_word) != ((this->__size_ - 1) / __bits_per_word))
- {
- if (this->__size_ <= __bits_per_word)
- this->__begin_[0] = __storage_type(0);
- else
- this->__begin_[(this->__size_ - 1) / __bits_per_word] = __storage_type(0);
- }
- std::__copy<_ClassicAlgPolicy>(__first, __last, __make_iter(__old_size));
+_LIBCPP_CONSTEXPR_SINCE_CXX20 void
+vector<bool, _Allocator>::__construct_at_end(_InputIterator __first, _Sentinel __last, size_type __n) {
+ size_type __old_size = this->__size_;
+ this->__size_ += __n;
+ if (__old_size == 0 || ((__old_size - 1) / __bits_per_word) != ((this->__size_ - 1) / __bits_per_word)) {
+ if (this->__size_ <= __bits_per_word)
+ this->__begin_[0] = __storage_type(0);
+ else
+ this->__begin_[(this->__size_ - 1) / __bits_per_word] = __storage_type(0);
+ }
+ std::__copy<_ClassicAlgPolicy>(__first, __last, __make_iter(__old_size));
}
template <class _Allocator>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-vector<bool, _Allocator>::vector()
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 vector<bool, _Allocator>::vector()
_NOEXCEPT_(is_nothrow_default_constructible<allocator_type>::value)
- : __begin_(nullptr),
- __size_(0),
- __cap_alloc_(0, __default_init_tag())
-{
-}
+ : __begin_(nullptr), __size_(0), __cap_alloc_(0, __default_init_tag()) {}
template <class _Allocator>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-vector<bool, _Allocator>::vector(const allocator_type& __a)
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 vector<bool, _Allocator>::vector(const allocator_type& __a)
#if _LIBCPP_STD_VER <= 14
- _NOEXCEPT_(is_nothrow_copy_constructible<allocator_type>::value)
+ _NOEXCEPT_(is_nothrow_copy_constructible<allocator_type>::value)
#else
_NOEXCEPT
#endif
- : __begin_(nullptr),
- __size_(0),
- __cap_alloc_(0, static_cast<__storage_allocator>(__a))
-{
+ : __begin_(nullptr), __size_(0), __cap_alloc_(0, static_cast<__storage_allocator>(__a)) {
}
template <class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-vector<bool, _Allocator>::vector(size_type __n)
- : __begin_(nullptr),
- __size_(0),
- __cap_alloc_(0, __default_init_tag())
-{
- if (__n > 0)
- {
- __vallocate(__n);
- __construct_at_end(__n, false);
- }
+_LIBCPP_CONSTEXPR_SINCE_CXX20 vector<bool, _Allocator>::vector(size_type __n)
+ : __begin_(nullptr), __size_(0), __cap_alloc_(0, __default_init_tag()) {
+ if (__n > 0) {
+ __vallocate(__n);
+ __construct_at_end(__n, false);
+ }
}
#if _LIBCPP_STD_VER >= 14
template <class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-vector<bool, _Allocator>::vector(size_type __n, const allocator_type& __a)
- : __begin_(nullptr),
- __size_(0),
- __cap_alloc_(0, static_cast<__storage_allocator>(__a))
-{
- if (__n > 0)
- {
- __vallocate(__n);
- __construct_at_end(__n, false);
- }
+_LIBCPP_CONSTEXPR_SINCE_CXX20 vector<bool, _Allocator>::vector(size_type __n, const allocator_type& __a)
+ : __begin_(nullptr), __size_(0), __cap_alloc_(0, static_cast<__storage_allocator>(__a)) {
+ if (__n > 0) {
+ __vallocate(__n);
+ __construct_at_end(__n, false);
+ }
}
#endif
template <class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-vector<bool, _Allocator>::vector(size_type __n, const value_type& __x)
- : __begin_(nullptr),
- __size_(0),
- __cap_alloc_(0, __default_init_tag())
-{
- if (__n > 0)
- {
- __vallocate(__n);
- __construct_at_end(__n, __x);
- }
+_LIBCPP_CONSTEXPR_SINCE_CXX20 vector<bool, _Allocator>::vector(size_type __n, const value_type& __x)
+ : __begin_(nullptr), __size_(0), __cap_alloc_(0, __default_init_tag()) {
+ if (__n > 0) {
+ __vallocate(__n);
+ __construct_at_end(__n, __x);
+ }
}
template <class _Allocator>
_LIBCPP_CONSTEXPR_SINCE_CXX20
vector<bool, _Allocator>::vector(size_type __n, const value_type& __x, const allocator_type& __a)
- : __begin_(nullptr),
- __size_(0),
- __cap_alloc_(0, static_cast<__storage_allocator>(__a))
-{
- if (__n > 0)
- {
- __vallocate(__n);
- __construct_at_end(__n, __x);
- }
+ : __begin_(nullptr), __size_(0), __cap_alloc_(0, static_cast<__storage_allocator>(__a)) {
+ if (__n > 0) {
+ __vallocate(__n);
+ __construct_at_end(__n, __x);
+ }
}
template <class _Allocator>
template <class _InputIterator, __enable_if_t<__has_exactly_input_iterator_category<_InputIterator>::value, int> >
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-vector<bool, _Allocator>::vector(_InputIterator __first, _InputIterator __last)
- : __begin_(nullptr),
- __size_(0),
- __cap_alloc_(0, __default_init_tag())
-{
+_LIBCPP_CONSTEXPR_SINCE_CXX20 vector<bool, _Allocator>::vector(_InputIterator __first, _InputIterator __last)
+ : __begin_(nullptr), __size_(0), __cap_alloc_(0, __default_init_tag()) {
__init_with_sentinel(__first, __last);
}
@@ -2710,21 +2383,14 @@ template <class _Allocator>
template <class _InputIterator, __enable_if_t<__has_exactly_input_iterator_category<_InputIterator>::value, int> >
_LIBCPP_CONSTEXPR_SINCE_CXX20
vector<bool, _Allocator>::vector(_InputIterator __first, _InputIterator __last, const allocator_type& __a)
- : __begin_(nullptr),
- __size_(0),
- __cap_alloc_(0, static_cast<__storage_allocator>(__a))
-{
+ : __begin_(nullptr), __size_(0), __cap_alloc_(0, static_cast<__storage_allocator>(__a)) {
__init_with_sentinel(__first, __last);
}
template <class _Allocator>
template <class _ForwardIterator, __enable_if_t<__has_forward_iterator_category<_ForwardIterator>::value, int> >
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-vector<bool, _Allocator>::vector(_ForwardIterator __first, _ForwardIterator __last)
- : __begin_(nullptr),
- __size_(0),
- __cap_alloc_(0, __default_init_tag())
-{
+_LIBCPP_CONSTEXPR_SINCE_CXX20 vector<bool, _Allocator>::vector(_ForwardIterator __first, _ForwardIterator __last)
+ : __begin_(nullptr), __size_(0), __cap_alloc_(0, __default_init_tag()) {
auto __n = static_cast<size_type>(std::distance(__first, __last));
__init_with_size(__first, __last, __n);
}
@@ -2733,10 +2399,7 @@ template <class _Allocator>
template <class _ForwardIterator, __enable_if_t<__has_forward_iterator_category<_ForwardIterator>::value, int> >
_LIBCPP_CONSTEXPR_SINCE_CXX20
vector<bool, _Allocator>::vector(_ForwardIterator __first, _ForwardIterator __last, const allocator_type& __a)
- : __begin_(nullptr),
- __size_(0),
- __cap_alloc_(0, static_cast<__storage_allocator>(__a))
-{
+ : __begin_(nullptr), __size_(0), __cap_alloc_(0, static_cast<__storage_allocator>(__a)) {
auto __n = static_cast<size_type>(std::distance(__first, __last));
__init_with_size(__first, __last, __n);
}
@@ -2744,85 +2407,62 @@ vector<bool, _Allocator>::vector(_ForwardIterator __first, _ForwardIterator __la
#ifndef _LIBCPP_CXX03_LANG
template <class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-vector<bool, _Allocator>::vector(initializer_list<value_type> __il)
- : __begin_(nullptr),
- __size_(0),
- __cap_alloc_(0, __default_init_tag())
-{
- size_type __n = static_cast<size_type>(__il.size());
- if (__n > 0)
- {
- __vallocate(__n);
- __construct_at_end(__il.begin(), __il.end(), __n);
- }
+_LIBCPP_CONSTEXPR_SINCE_CXX20 vector<bool, _Allocator>::vector(initializer_list<value_type> __il)
+ : __begin_(nullptr), __size_(0), __cap_alloc_(0, __default_init_tag()) {
+ size_type __n = static_cast<size_type>(__il.size());
+ if (__n > 0) {
+ __vallocate(__n);
+ __construct_at_end(__il.begin(), __il.end(), __n);
+ }
}
template <class _Allocator>
_LIBCPP_CONSTEXPR_SINCE_CXX20
vector<bool, _Allocator>::vector(initializer_list<value_type> __il, const allocator_type& __a)
- : __begin_(nullptr),
- __size_(0),
- __cap_alloc_(0, static_cast<__storage_allocator>(__a))
-{
- size_type __n = static_cast<size_type>(__il.size());
- if (__n > 0)
- {
- __vallocate(__n);
- __construct_at_end(__il.begin(), __il.end(), __n);
- }
+ : __begin_(nullptr), __size_(0), __cap_alloc_(0, static_cast<__storage_allocator>(__a)) {
+ size_type __n = static_cast<size_type>(__il.size());
+ if (__n > 0) {
+ __vallocate(__n);
+ __construct_at_end(__il.begin(), __il.end(), __n);
+ }
}
#endif // _LIBCPP_CXX03_LANG
template <class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-vector<bool, _Allocator>::vector(const vector& __v)
+_LIBCPP_CONSTEXPR_SINCE_CXX20 vector<bool, _Allocator>::vector(const vector& __v)
: __begin_(nullptr),
__size_(0),
- __cap_alloc_(0, __storage_traits::select_on_container_copy_construction(__v.__alloc()))
-{
- if (__v.size() > 0)
- {
- __vallocate(__v.size());
- __construct_at_end(__v.begin(), __v.end(), __v.size());
- }
+ __cap_alloc_(0, __storage_traits::select_on_container_copy_construction(__v.__alloc())) {
+ if (__v.size() > 0) {
+ __vallocate(__v.size());
+ __construct_at_end(__v.begin(), __v.end(), __v.size());
+ }
}
template <class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-vector<bool, _Allocator>::vector(const vector& __v, const allocator_type& __a)
- : __begin_(nullptr),
- __size_(0),
- __cap_alloc_(0, __a)
-{
- if (__v.size() > 0)
- {
- __vallocate(__v.size());
- __construct_at_end(__v.begin(), __v.end(), __v.size());
- }
+_LIBCPP_CONSTEXPR_SINCE_CXX20 vector<bool, _Allocator>::vector(const vector& __v, const allocator_type& __a)
+ : __begin_(nullptr), __size_(0), __cap_alloc_(0, __a) {
+ if (__v.size() > 0) {
+ __vallocate(__v.size());
+ __construct_at_end(__v.begin(), __v.end(), __v.size());
+ }
}
template <class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-vector<bool, _Allocator>&
-vector<bool, _Allocator>::operator=(const vector& __v)
-{
- if (this != std::addressof(__v))
- {
- __copy_assign_alloc(__v);
- if (__v.__size_)
- {
- if (__v.__size_ > capacity())
- {
- __vdeallocate();
- __vallocate(__v.__size_);
- }
- std::copy(__v.__begin_, __v.__begin_ + __external_cap_to_internal(__v.__size_), __begin_);
- }
- __size_ = __v.__size_;
+_LIBCPP_CONSTEXPR_SINCE_CXX20 vector<bool, _Allocator>& vector<bool, _Allocator>::operator=(const vector& __v) {
+ if (this != std::addressof(__v)) {
+ __copy_assign_alloc(__v);
+ if (__v.__size_) {
+ if (__v.__size_ > capacity()) {
+ __vdeallocate();
+ __vallocate(__v.__size_);
+ }
+ std::copy(__v.__begin_, __v.__begin_ + __external_cap_to_internal(__v.__size_), __begin_);
}
- return *this;
+ __size_ = __v.__size_;
+ }
+ return *this;
}
template <class _Allocator>
@@ -2835,523 +2475,419 @@ inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 vector<bool, _Allocat
: __begin_(__v.__begin_),
__size_(__v.__size_),
__cap_alloc_(std::move(__v.__cap_alloc_)) {
- __v.__begin_ = nullptr;
- __v.__size_ = 0;
- __v.__cap() = 0;
+ __v.__begin_ = nullptr;
+ __v.__size_ = 0;
+ __v.__cap() = 0;
}
template <class _Allocator>
_LIBCPP_CONSTEXPR_SINCE_CXX20
vector<bool, _Allocator>::vector(vector&& __v, const __type_identity_t<allocator_type>& __a)
- : __begin_(nullptr),
- __size_(0),
- __cap_alloc_(0, __a)
-{
- if (__a == allocator_type(__v.__alloc()))
- {
- this->__begin_ = __v.__begin_;
- this->__size_ = __v.__size_;
- this->__cap() = __v.__cap();
- __v.__begin_ = nullptr;
- __v.__cap() = __v.__size_ = 0;
- }
- else if (__v.size() > 0)
- {
- __vallocate(__v.size());
- __construct_at_end(__v.begin(), __v.end(), __v.size());
- }
+ : __begin_(nullptr), __size_(0), __cap_alloc_(0, __a) {
+ if (__a == allocator_type(__v.__alloc())) {
+ this->__begin_ = __v.__begin_;
+ this->__size_ = __v.__size_;
+ this->__cap() = __v.__cap();
+ __v.__begin_ = nullptr;
+ __v.__cap() = __v.__size_ = 0;
+ } else if (__v.size() > 0) {
+ __vallocate(__v.size());
+ __construct_at_end(__v.begin(), __v.end(), __v.size());
+ }
}
template <class _Allocator>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-vector<bool, _Allocator>&
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 vector<bool, _Allocator>&
vector<bool, _Allocator>::operator=(vector&& __v)
- _NOEXCEPT_((__noexcept_move_assign_container<_Allocator, __alloc_traits>::value))
-{
- __move_assign(__v, integral_constant<bool,
- __storage_traits::propagate_on_container_move_assignment::value>());
- return *this;
+ _NOEXCEPT_((__noexcept_move_assign_container<_Allocator, __alloc_traits>::value)) {
+ __move_assign(__v, integral_constant<bool, __storage_traits::propagate_on_container_move_assignment::value>());
+ return *this;
}
template <class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20 void
-vector<bool, _Allocator>::__move_assign(vector& __c, false_type)
-{
- if (__alloc() != __c.__alloc())
- assign(__c.begin(), __c.end());
- else
- __move_assign(__c, true_type());
+_LIBCPP_CONSTEXPR_SINCE_CXX20 void vector<bool, _Allocator>::__move_assign(vector& __c, false_type) {
+ if (__alloc() != __c.__alloc())
+ assign(__c.begin(), __c.end());
+ else
+ __move_assign(__c, true_type());
}
template <class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20 void
-vector<bool, _Allocator>::__move_assign(vector& __c, true_type)
- _NOEXCEPT_(is_nothrow_move_assignable<allocator_type>::value)
-{
- __vdeallocate();
- __move_assign_alloc(__c);
- this->__begin_ = __c.__begin_;
- this->__size_ = __c.__size_;
- this->__cap() = __c.__cap();
- __c.__begin_ = nullptr;
- __c.__cap() = __c.__size_ = 0;
+_LIBCPP_CONSTEXPR_SINCE_CXX20 void vector<bool, _Allocator>::__move_assign(vector& __c, true_type)
+ _NOEXCEPT_(is_nothrow_move_assignable<allocator_type>::value) {
+ __vdeallocate();
+ __move_assign_alloc(__c);
+ this->__begin_ = __c.__begin_;
+ this->__size_ = __c.__size_;
+ this->__cap() = __c.__cap();
+ __c.__begin_ = nullptr;
+ __c.__cap() = __c.__size_ = 0;
}
template <class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20 void
-vector<bool, _Allocator>::assign(size_type __n, const value_type& __x)
-{
- __size_ = 0;
- if (__n > 0)
- {
- size_type __c = capacity();
- if (__n <= __c)
- __size_ = __n;
- else
- {
- vector __v(get_allocator());
- __v.reserve(__recommend(__n));
- __v.__size_ = __n;
- swap(__v);
- }
- std::fill_n(begin(), __n, __x);
- }
+_LIBCPP_CONSTEXPR_SINCE_CXX20 void vector<bool, _Allocator>::assign(size_type __n, const value_type& __x) {
+ __size_ = 0;
+ if (__n > 0) {
+ size_type __c = capacity();
+ if (__n <= __c)
+ __size_ = __n;
+ else {
+ vector __v(get_allocator());
+ __v.reserve(__recommend(__n));
+ __v.__size_ = __n;
+ swap(__v);
+ }
+ std::fill_n(begin(), __n, __x);
+ }
}
template <class _Allocator>
template <class _InputIterator, __enable_if_t<__has_exactly_input_iterator_category<_InputIterator>::value, int> >
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-void
-vector<bool, _Allocator>::assign(_InputIterator __first, _InputIterator __last)
-{
+_LIBCPP_CONSTEXPR_SINCE_CXX20 void vector<bool, _Allocator>::assign(_InputIterator __first, _InputIterator __last) {
__assign_with_sentinel(__first, __last);
}
template <class _Allocator>
template <class _Iterator, class _Sentinel>
-_LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI
-void vector<bool, _Allocator>::__assign_with_sentinel(_Iterator __first, _Sentinel __last) {
- clear();
- for (; __first != __last; ++__first)
- push_back(*__first);
+_LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void
+vector<bool, _Allocator>::__assign_with_sentinel(_Iterator __first, _Sentinel __last) {
+ clear();
+ for (; __first != __last; ++__first)
+ push_back(*__first);
}
template <class _Allocator>
template <class _ForwardIterator, __enable_if_t<__has_forward_iterator_category<_ForwardIterator>::value, int> >
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-void
-vector<bool, _Allocator>::assign(_ForwardIterator __first, _ForwardIterator __last)
-{
+_LIBCPP_CONSTEXPR_SINCE_CXX20 void vector<bool, _Allocator>::assign(_ForwardIterator __first, _ForwardIterator __last) {
__assign_with_size(__first, __last, std::distance(__first, __last));
}
template <class _Allocator>
template <class _ForwardIterator, class _Sentinel>
-_LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI
-void vector<bool, _Allocator>::__assign_with_size(_ForwardIterator __first, _Sentinel __last, difference_type __ns) {
- _LIBCPP_ASSERT_VALID_INPUT_RANGE(__ns >= 0, "invalid range specified");
+_LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void
+vector<bool, _Allocator>::__assign_with_size(_ForwardIterator __first, _Sentinel __last, difference_type __ns) {
+ _LIBCPP_ASSERT_VALID_INPUT_RANGE(__ns >= 0, "invalid range specified");
- clear();
+ clear();
- const size_t __n = static_cast<size_type>(__ns);
- if (__n)
- {
- if (__n > capacity())
- {
- __vdeallocate();
- __vallocate(__n);
- }
- __construct_at_end(__first, __last, __n);
+ const size_t __n = static_cast<size_type>(__ns);
+ if (__n) {
+ if (__n > capacity()) {
+ __vdeallocate();
+ __vallocate(__n);
}
+ __construct_at_end(__first, __last, __n);
+ }
}
template <class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20 void
-vector<bool, _Allocator>::reserve(size_type __n)
-{
- if (__n > capacity())
- {
- if (__n > max_size())
- this->__throw_length_error();
- vector __v(this->get_allocator());
- __v.__vallocate(__n);
- __v.__construct_at_end(this->begin(), this->end(), this->size());
- swap(__v);
- }
+_LIBCPP_CONSTEXPR_SINCE_CXX20 void vector<bool, _Allocator>::reserve(size_type __n) {
+ if (__n > capacity()) {
+ if (__n > max_size())
+ this->__throw_length_error();
+ vector __v(this->get_allocator());
+ __v.__vallocate(__n);
+ __v.__construct_at_end(this->begin(), this->end(), this->size());
+ swap(__v);
+ }
}
template <class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20 void
-vector<bool, _Allocator>::shrink_to_fit() _NOEXCEPT
-{
- if (__external_cap_to_internal(size()) > __cap())
- {
+_LIBCPP_CONSTEXPR_SINCE_CXX20 void vector<bool, _Allocator>::shrink_to_fit() _NOEXCEPT {
+ if (__external_cap_to_internal(size()) > __cap()) {
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- try
- {
+ try {
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- vector(*this, allocator_type(__alloc())).swap(*this);
+ vector(*this, allocator_type(__alloc())).swap(*this);
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- }
- catch (...)
- {
- }
-#endif // _LIBCPP_HAS_NO_EXCEPTIONS
+ } catch (...) {
}
+#endif // _LIBCPP_HAS_NO_EXCEPTIONS
+ }
}
template <class _Allocator>
-typename vector<bool, _Allocator>::reference
-vector<bool, _Allocator>::at(size_type __n)
-{
- if (__n >= size())
- this->__throw_out_of_range();
- return (*this)[__n];
+typename vector<bool, _Allocator>::reference vector<bool, _Allocator>::at(size_type __n) {
+ if (__n >= size())
+ this->__throw_out_of_range();
+ return (*this)[__n];
}
template <class _Allocator>
-typename vector<bool, _Allocator>::const_reference
-vector<bool, _Allocator>::at(size_type __n) const
-{
- if (__n >= size())
- this->__throw_out_of_range();
- return (*this)[__n];
+typename vector<bool, _Allocator>::const_reference vector<bool, _Allocator>::at(size_type __n) const {
+ if (__n >= size())
+ this->__throw_out_of_range();
+ return (*this)[__n];
}
template <class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20 void
-vector<bool, _Allocator>::push_back(const value_type& __x)
-{
- if (this->__size_ == this->capacity())
- reserve(__recommend(this->__size_ + 1));
- ++this->__size_;
- back() = __x;
+_LIBCPP_CONSTEXPR_SINCE_CXX20 void vector<bool, _Allocator>::push_back(const value_type& __x) {
+ if (this->__size_ == this->capacity())
+ reserve(__recommend(this->__size_ + 1));
+ ++this->__size_;
+ back() = __x;
}
template <class _Allocator>
_LIBCPP_CONSTEXPR_SINCE_CXX20 typename vector<bool, _Allocator>::iterator
-vector<bool, _Allocator>::insert(const_iterator __position, const value_type& __x)
-{
- iterator __r;
- if (size() < capacity())
- {
- const_iterator __old_end = end();
- ++__size_;
- std::copy_backward(__position, __old_end, end());
- __r = __const_iterator_cast(__position);
- }
- else
- {
- vector __v(get_allocator());
- __v.reserve(__recommend(__size_ + 1));
- __v.__size_ = __size_ + 1;
- __r = std::copy(cbegin(), __position, __v.begin());
- std::copy_backward(__position, cend(), __v.end());
- swap(__v);
- }
- *__r = __x;
- return __r;
+vector<bool, _Allocator>::insert(const_iterator __position, const value_type& __x) {
+ iterator __r;
+ if (size() < capacity()) {
+ const_iterator __old_end = end();
+ ++__size_;
+ std::copy_backward(__position, __old_end, end());
+ __r = __const_iterator_cast(__position);
+ } else {
+ vector __v(get_allocator());
+ __v.reserve(__recommend(__size_ + 1));
+ __v.__size_ = __size_ + 1;
+ __r = std::copy(cbegin(), __position, __v.begin());
+ std::copy_backward(__position, cend(), __v.end());
+ swap(__v);
+ }
+ *__r = __x;
+ return __r;
}
template <class _Allocator>
_LIBCPP_CONSTEXPR_SINCE_CXX20 typename vector<bool, _Allocator>::iterator
-vector<bool, _Allocator>::insert(const_iterator __position, size_type __n, const value_type& __x)
-{
- iterator __r;
- size_type __c = capacity();
- if (__n <= __c && size() <= __c - __n)
- {
- const_iterator __old_end = end();
- __size_ += __n;
- std::copy_backward(__position, __old_end, end());
- __r = __const_iterator_cast(__position);
- }
- else
- {
- vector __v(get_allocator());
- __v.reserve(__recommend(__size_ + __n));
- __v.__size_ = __size_ + __n;
- __r = std::copy(cbegin(), __position, __v.begin());
- std::copy_backward(__position, cend(), __v.end());
- swap(__v);
- }
- std::fill_n(__r, __n, __x);
- return __r;
+vector<bool, _Allocator>::insert(const_iterator __position, size_type __n, const value_type& __x) {
+ iterator __r;
+ size_type __c = capacity();
+ if (__n <= __c && size() <= __c - __n) {
+ const_iterator __old_end = end();
+ __size_ += __n;
+ std::copy_backward(__position, __old_end, end());
+ __r = __const_iterator_cast(__position);
+ } else {
+ vector __v(get_allocator());
+ __v.reserve(__recommend(__size_ + __n));
+ __v.__size_ = __size_ + __n;
+ __r = std::copy(cbegin(), __position, __v.begin());
+ std::copy_backward(__position, cend(), __v.end());
+ swap(__v);
+ }
+ std::fill_n(__r, __n, __x);
+ return __r;
}
template <class _Allocator>
template <class _InputIterator, __enable_if_t<__has_exactly_input_iterator_category<_InputIterator>::value, int> >
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-typename vector<bool, _Allocator>::iterator
-vector<bool, _Allocator>::insert(const_iterator __position, _InputIterator __first, _InputIterator __last)
-{
+_LIBCPP_CONSTEXPR_SINCE_CXX20 typename vector<bool, _Allocator>::iterator
+vector<bool, _Allocator>::insert(const_iterator __position, _InputIterator __first, _InputIterator __last) {
return __insert_with_sentinel(__position, __first, __last);
}
template <class _Allocator>
template <class _InputIterator, class _Sentinel>
-_LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI
-typename vector<bool, _Allocator>::iterator
+_LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI typename vector<bool, _Allocator>::iterator
vector<bool, _Allocator>::__insert_with_sentinel(const_iterator __position, _InputIterator __first, _Sentinel __last) {
- difference_type __off = __position - begin();
- iterator __p = __const_iterator_cast(__position);
- iterator __old_end = end();
- for (; size() != capacity() && __first != __last; ++__first)
- {
- ++this->__size_;
- back() = *__first;
- }
- vector __v(get_allocator());
- if (__first != __last)
- {
+ difference_type __off = __position - begin();
+ iterator __p = __const_iterator_cast(__position);
+ iterator __old_end = end();
+ for (; size() != capacity() && __first != __last; ++__first) {
+ ++this->__size_;
+ back() = *__first;
+ }
+ vector __v(get_allocator());
+ if (__first != __last) {
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- try
- {
+ try {
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- __v.__assign_with_sentinel(std::move(__first), std::move(__last));
- difference_type __old_size = static_cast<difference_type>(__old_end - begin());
- difference_type __old_p = __p - begin();
- reserve(__recommend(size() + __v.size()));
- __p = begin() + __old_p;
- __old_end = begin() + __old_size;
+ __v.__assign_with_sentinel(std::move(__first), std::move(__last));
+ difference_type __old_size = static_cast<difference_type>(__old_end - begin());
+ difference_type __old_p = __p - begin();
+ reserve(__recommend(size() + __v.size()));
+ __p = begin() + __old_p;
+ __old_end = begin() + __old_size;
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- }
- catch (...)
- {
- erase(__old_end, end());
- throw;
- }
-#endif // _LIBCPP_HAS_NO_EXCEPTIONS
+ } catch (...) {
+ erase(__old_end, end());
+ throw;
}
- __p = std::rotate(__p, __old_end, end());
- insert(__p, __v.begin(), __v.end());
- return begin() + __off;
+#endif // _LIBCPP_HAS_NO_EXCEPTIONS
+ }
+ __p = std::rotate(__p, __old_end, end());
+ insert(__p, __v.begin(), __v.end());
+ return begin() + __off;
}
template <class _Allocator>
template <class _ForwardIterator, __enable_if_t<__has_forward_iterator_category<_ForwardIterator>::value, int> >
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-typename vector<bool, _Allocator>::iterator
-vector<bool, _Allocator>::insert(const_iterator __position, _ForwardIterator __first, _ForwardIterator __last)
-{
+_LIBCPP_CONSTEXPR_SINCE_CXX20 typename vector<bool, _Allocator>::iterator
+vector<bool, _Allocator>::insert(const_iterator __position, _ForwardIterator __first, _ForwardIterator __last) {
return __insert_with_size(__position, __first, __last, std::distance(__first, __last));
}
template <class _Allocator>
template <class _ForwardIterator, class _Sentinel>
-_LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI
-typename vector<bool, _Allocator>::iterator
-vector<bool, _Allocator>::__insert_with_size(const_iterator __position, _ForwardIterator __first, _Sentinel __last,
- difference_type __n_signed) {
- _LIBCPP_ASSERT_VALID_INPUT_RANGE(__n_signed >= 0, "invalid range specified");
- const size_type __n = static_cast<size_type>(__n_signed);
- iterator __r;
- size_type __c = capacity();
- if (__n <= __c && size() <= __c - __n)
- {
- const_iterator __old_end = end();
- __size_ += __n;
- std::copy_backward(__position, __old_end, end());
- __r = __const_iterator_cast(__position);
- }
- else
- {
- vector __v(get_allocator());
- __v.reserve(__recommend(__size_ + __n));
- __v.__size_ = __size_ + __n;
- __r = std::copy(cbegin(), __position, __v.begin());
- std::copy_backward(__position, cend(), __v.end());
- swap(__v);
- }
- std::__copy<_ClassicAlgPolicy>(__first, __last, __r);
- return __r;
+_LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI typename vector<bool, _Allocator>::iterator
+vector<bool, _Allocator>::__insert_with_size(
+ const_iterator __position, _ForwardIterator __first, _Sentinel __last, difference_type __n_signed) {
+ _LIBCPP_ASSERT_VALID_INPUT_RANGE(__n_signed >= 0, "invalid range specified");
+ const size_type __n = static_cast<size_type>(__n_signed);
+ iterator __r;
+ size_type __c = capacity();
+ if (__n <= __c && size() <= __c - __n) {
+ const_iterator __old_end = end();
+ __size_ += __n;
+ std::copy_backward(__position, __old_end, end());
+ __r = __const_iterator_cast(__position);
+ } else {
+ vector __v(get_allocator());
+ __v.reserve(__recommend(__size_ + __n));
+ __v.__size_ = __size_ + __n;
+ __r = std::copy(cbegin(), __position, __v.begin());
+ std::copy_backward(__position, cend(), __v.end());
+ swap(__v);
+ }
+ std::__copy<_ClassicAlgPolicy>(__first, __last, __r);
+ return __r;
}
template <class _Allocator>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-typename vector<bool, _Allocator>::iterator
-vector<bool, _Allocator>::erase(const_iterator __position)
-{
- iterator __r = __const_iterator_cast(__position);
- std::copy(__position + 1, this->cend(), __r);
- --__size_;
- return __r;
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 typename vector<bool, _Allocator>::iterator
+vector<bool, _Allocator>::erase(const_iterator __position) {
+ iterator __r = __const_iterator_cast(__position);
+ std::copy(__position + 1, this->cend(), __r);
+ --__size_;
+ return __r;
}
template <class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-typename vector<bool, _Allocator>::iterator
-vector<bool, _Allocator>::erase(const_iterator __first, const_iterator __last)
-{
- iterator __r = __const_iterator_cast(__first);
- difference_type __d = __last - __first;
- std::copy(__last, this->cend(), __r);
- __size_ -= __d;
- return __r;
+_LIBCPP_CONSTEXPR_SINCE_CXX20 typename vector<bool, _Allocator>::iterator
+vector<bool, _Allocator>::erase(const_iterator __first, const_iterator __last) {
+ iterator __r = __const_iterator_cast(__first);
+ difference_type __d = __last - __first;
+ std::copy(__last, this->cend(), __r);
+ __size_ -= __d;
+ return __r;
}
template <class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20 void
-vector<bool, _Allocator>::swap(vector& __x)
+_LIBCPP_CONSTEXPR_SINCE_CXX20 void vector<bool, _Allocator>::swap(vector& __x)
#if _LIBCPP_STD_VER >= 14
_NOEXCEPT
#else
- _NOEXCEPT_(!__alloc_traits::propagate_on_container_swap::value ||
- __is_nothrow_swappable<allocator_type>::value)
+ _NOEXCEPT_(!__alloc_traits::propagate_on_container_swap::value || __is_nothrow_swappable<allocator_type>::value)
#endif
{
- std::swap(this->__begin_, __x.__begin_);
- std::swap(this->__size_, __x.__size_);
- std::swap(this->__cap(), __x.__cap());
- std::__swap_allocator(this->__alloc(), __x.__alloc(),
- integral_constant<bool, __alloc_traits::propagate_on_container_swap::value>());
+ std::swap(this->__begin_, __x.__begin_);
+ std::swap(this->__size_, __x.__size_);
+ std::swap(this->__cap(), __x.__cap());
+ std::__swap_allocator(
+ this->__alloc(), __x.__alloc(), integral_constant<bool, __alloc_traits::propagate_on_container_swap::value>());
}
template <class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20 void
-vector<bool, _Allocator>::resize(size_type __sz, value_type __x)
-{
- size_type __cs = size();
- if (__cs < __sz)
- {
- iterator __r;
- size_type __c = capacity();
- size_type __n = __sz - __cs;
- if (__n <= __c && __cs <= __c - __n)
- {
- __r = end();
- __size_ += __n;
- }
- else
- {
- vector __v(get_allocator());
- __v.reserve(__recommend(__size_ + __n));
- __v.__size_ = __size_ + __n;
- __r = std::copy(cbegin(), cend(), __v.begin());
- swap(__v);
- }
- std::fill_n(__r, __n, __x);
+_LIBCPP_CONSTEXPR_SINCE_CXX20 void vector<bool, _Allocator>::resize(size_type __sz, value_type __x) {
+ size_type __cs = size();
+ if (__cs < __sz) {
+ iterator __r;
+ size_type __c = capacity();
+ size_type __n = __sz - __cs;
+ if (__n <= __c && __cs <= __c - __n) {
+ __r = end();
+ __size_ += __n;
+ } else {
+ vector __v(get_allocator());
+ __v.reserve(__recommend(__size_ + __n));
+ __v.__size_ = __size_ + __n;
+ __r = std::copy(cbegin(), cend(), __v.begin());
+ swap(__v);
}
- else
- __size_ = __sz;
+ std::fill_n(__r, __n, __x);
+ } else
+ __size_ = __sz;
}
template <class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20 void
-vector<bool, _Allocator>::flip() _NOEXCEPT
-{
- // do middle whole words
- size_type __n = __size_;
- __storage_pointer __p = __begin_;
- for (; __n >= __bits_per_word; ++__p, __n -= __bits_per_word)
- *__p = ~*__p;
- // do last partial word
- if (__n > 0)
- {
- __storage_type __m = ~__storage_type(0) >> (__bits_per_word - __n);
- __storage_type __b = *__p & __m;
- *__p &= ~__m;
- *__p |= ~__b & __m;
- }
+_LIBCPP_CONSTEXPR_SINCE_CXX20 void vector<bool, _Allocator>::flip() _NOEXCEPT {
+ // do middle whole words
+ size_type __n = __size_;
+ __storage_pointer __p = __begin_;
+ for (; __n >= __bits_per_word; ++__p, __n -= __bits_per_word)
+ *__p = ~*__p;
+ // do last partial word
+ if (__n > 0) {
+ __storage_type __m = ~__storage_type(0) >> (__bits_per_word - __n);
+ __storage_type __b = *__p & __m;
+ *__p &= ~__m;
+ *__p |= ~__b & __m;
+ }
}
template <class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20 bool
-vector<bool, _Allocator>::__invariants() const
-{
- if (this->__begin_ == nullptr)
- {
- if (this->__size_ != 0 || this->__cap() != 0)
- return false;
- }
- else
- {
- if (this->__cap() == 0)
- return false;
- if (this->__size_ > this->capacity())
- return false;
- }
- return true;
+_LIBCPP_CONSTEXPR_SINCE_CXX20 bool vector<bool, _Allocator>::__invariants() const {
+ if (this->__begin_ == nullptr) {
+ if (this->__size_ != 0 || this->__cap() != 0)
+ return false;
+ } else {
+ if (this->__cap() == 0)
+ return false;
+ if (this->__size_ > this->capacity())
+ return false;
+ }
+ return true;
}
template <class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20 size_t
-vector<bool, _Allocator>::__hash_code() const _NOEXCEPT
-{
- size_t __h = 0;
- // do middle whole words
- size_type __n = __size_;
- __storage_pointer __p = __begin_;
- for (; __n >= __bits_per_word; ++__p, __n -= __bits_per_word)
- __h ^= *__p;
- // do last partial word
- if (__n > 0)
- {
- const __storage_type __m = ~__storage_type(0) >> (__bits_per_word - __n);
- __h ^= *__p & __m;
- }
- return __h;
+_LIBCPP_CONSTEXPR_SINCE_CXX20 size_t vector<bool, _Allocator>::__hash_code() const _NOEXCEPT {
+ size_t __h = 0;
+ // do middle whole words
+ size_type __n = __size_;
+ __storage_pointer __p = __begin_;
+ for (; __n >= __bits_per_word; ++__p, __n -= __bits_per_word)
+ __h ^= *__p;
+ // do last partial word
+ if (__n > 0) {
+ const __storage_type __m = ~__storage_type(0) >> (__bits_per_word - __n);
+ __h ^= *__p & __m;
+ }
+ return __h;
}
template <class _Allocator>
struct _LIBCPP_TEMPLATE_VIS hash<vector<bool, _Allocator> >
- : public __unary_function<vector<bool, _Allocator>, size_t>
-{
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- size_t operator()(const vector<bool, _Allocator>& __vec) const _NOEXCEPT
- {return __vec.__hash_code();}
+ : public __unary_function<vector<bool, _Allocator>, size_t> {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_t
+ operator()(const vector<bool, _Allocator>& __vec) const _NOEXCEPT {
+ return __vec.__hash_code();
+ }
};
template <class _Tp, class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator==(const vector<_Tp, _Allocator>& __x, const vector<_Tp, _Allocator>& __y)
-{
- const typename vector<_Tp, _Allocator>::size_type __sz = __x.size();
- return __sz == __y.size() && std::equal(__x.begin(), __x.end(), __y.begin());
+_LIBCPP_CONSTEXPR_SINCE_CXX20 inline _LIBCPP_HIDE_FROM_ABI bool
+operator==(const vector<_Tp, _Allocator>& __x, const vector<_Tp, _Allocator>& __y) {
+ const typename vector<_Tp, _Allocator>::size_type __sz = __x.size();
+ return __sz == __y.size() && std::equal(__x.begin(), __x.end(), __y.begin());
}
#if _LIBCPP_STD_VER <= 17
template <class _Tp, class _Allocator>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator!=(const vector<_Tp, _Allocator>& __x, const vector<_Tp, _Allocator>& __y)
-{
- return !(__x == __y);
+inline _LIBCPP_HIDE_FROM_ABI bool operator!=(const vector<_Tp, _Allocator>& __x, const vector<_Tp, _Allocator>& __y) {
+ return !(__x == __y);
}
template <class _Tp, class _Allocator>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator< (const vector<_Tp, _Allocator>& __x, const vector<_Tp, _Allocator>& __y)
-{
- return std::lexicographical_compare(__x.begin(), __x.end(), __y.begin(), __y.end());
+inline _LIBCPP_HIDE_FROM_ABI bool operator<(const vector<_Tp, _Allocator>& __x, const vector<_Tp, _Allocator>& __y) {
+ return std::lexicographical_compare(__x.begin(), __x.end(), __y.begin(), __y.end());
}
template <class _Tp, class _Allocator>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator> (const vector<_Tp, _Allocator>& __x, const vector<_Tp, _Allocator>& __y)
-{
- return __y < __x;
+inline _LIBCPP_HIDE_FROM_ABI bool operator>(const vector<_Tp, _Allocator>& __x, const vector<_Tp, _Allocator>& __y) {
+ return __y < __x;
}
template <class _Tp, class _Allocator>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator>=(const vector<_Tp, _Allocator>& __x, const vector<_Tp, _Allocator>& __y)
-{
- return !(__x < __y);
+inline _LIBCPP_HIDE_FROM_ABI bool operator>=(const vector<_Tp, _Allocator>& __x, const vector<_Tp, _Allocator>& __y) {
+ return !(__x < __y);
}
template <class _Tp, class _Allocator>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator<=(const vector<_Tp, _Allocator>& __x, const vector<_Tp, _Allocator>& __y)
-{
- return !(__y < __x);
+inline _LIBCPP_HIDE_FROM_ABI bool operator<=(const vector<_Tp, _Allocator>& __x, const vector<_Tp, _Allocator>& __y) {
+ return !(__y < __x);
}
#else // _LIBCPP_STD_VER <= 17
@@ -3359,26 +2895,21 @@ operator<=(const vector<_Tp, _Allocator>& __x, const vector<_Tp, _Allocator>& __
template <class _Tp, class _Allocator>
_LIBCPP_HIDE_FROM_ABI constexpr __synth_three_way_result<_Tp>
operator<=>(const vector<_Tp, _Allocator>& __x, const vector<_Tp, _Allocator>& __y) {
- return std::lexicographical_compare_three_way(
- __x.begin(), __x.end(), __y.begin(), __y.end(), std::__synth_three_way<_Tp, _Tp>);
+ return std::lexicographical_compare_three_way(
+ __x.begin(), __x.end(), __y.begin(), __y.end(), std::__synth_three_way<_Tp, _Tp>);
}
#endif // _LIBCPP_STD_VER <= 17
template <class _Tp, class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-inline _LIBCPP_HIDE_FROM_ABI
-void
-swap(vector<_Tp, _Allocator>& __x, vector<_Tp, _Allocator>& __y)
- _NOEXCEPT_(_NOEXCEPT_(__x.swap(__y)))
-{
- __x.swap(__y);
+_LIBCPP_CONSTEXPR_SINCE_CXX20 inline _LIBCPP_HIDE_FROM_ABI void
+swap(vector<_Tp, _Allocator>& __x, vector<_Tp, _Allocator>& __y) _NOEXCEPT_(_NOEXCEPT_(__x.swap(__y))) {
+ __x.swap(__y);
}
#if _LIBCPP_STD_VER >= 20
template <class _Tp, class _Allocator, class _Up>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-inline _LIBCPP_HIDE_FROM_ABI typename vector<_Tp, _Allocator>::size_type
+_LIBCPP_CONSTEXPR_SINCE_CXX20 inline _LIBCPP_HIDE_FROM_ABI typename vector<_Tp, _Allocator>::size_type
erase(vector<_Tp, _Allocator>& __c, const _Up& __v) {
auto __old_size = __c.size();
__c.erase(std::remove(__c.begin(), __c.end(), __v), __c.end());
@@ -3386,8 +2917,7 @@ erase(vector<_Tp, _Allocator>& __c, const _Up& __v) {
}
template <class _Tp, class _Allocator, class _Predicate>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-inline _LIBCPP_HIDE_FROM_ABI typename vector<_Tp, _Allocator>::size_type
+_LIBCPP_CONSTEXPR_SINCE_CXX20 inline _LIBCPP_HIDE_FROM_ABI typename vector<_Tp, _Allocator>::size_type
erase_if(vector<_Tp, _Allocator>& __c, _Predicate __pred) {
auto __old_size = __c.size();
__c.erase(std::remove_if(__c.begin(), __c.end(), __pred), __c.end());
@@ -3396,10 +2926,10 @@ erase_if(vector<_Tp, _Allocator>& __c, _Predicate __pred) {
template <>
inline constexpr bool __format::__enable_insertable<vector<char>> = true;
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+# ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
template <>
inline constexpr bool __format::__enable_insertable<vector<wchar_t>> = true;
-#endif
+# endif
#endif // _LIBCPP_STD_VER >= 20
@@ -3414,12 +2944,12 @@ private:
public:
template <class _ParseContext>
_LIBCPP_HIDE_FROM_ABI constexpr typename _ParseContext::iterator parse(_ParseContext& __ctx) {
- return __underlying_.parse(__ctx);
+ return __underlying_.parse(__ctx);
}
template <class _FormatContext>
_LIBCPP_HIDE_FROM_ABI typename _FormatContext::iterator format(const _Tp& __ref, _FormatContext& __ctx) const {
- return __underlying_.format(__ref, __ctx);
+ return __underlying_.format(__ref, __ctx);
}
};
#endif // _LIBCPP_STD_VER >= 23
diff --git a/contrib/llvm-project/libcxx/include/version b/contrib/llvm-project/libcxx/include/version
index a91c344c4360..768710ef5c84 100644
--- a/contrib/llvm-project/libcxx/include/version
+++ b/contrib/llvm-project/libcxx/include/version
@@ -93,7 +93,7 @@ __cpp_lib_expected 202211L <expected>
__cpp_lib_filesystem 201703L <filesystem>
__cpp_lib_format 202106L <format>
__cpp_lib_format_ranges 202207L <format>
-__cpp_lib_format_uchar 202311L <>
+__cpp_lib_format_uchar 202311L <format>
__cpp_lib_formatters 202302L <stacktrace> <thread>
__cpp_lib_forward_like 202207L <utility>
__cpp_lib_freestanding_algorithm 202311L <algorithm>
@@ -188,7 +188,7 @@ __cpp_lib_remove_cvref 201711L <type_traits>
__cpp_lib_result_of_sfinae 201210L <functional> <type_traits>
__cpp_lib_robust_nonmodifying_seq_ops 201304L <algorithm>
__cpp_lib_sample 201603L <algorithm>
-__cpp_lib_saturation_arithmetic 202311L <>
+__cpp_lib_saturation_arithmetic 202311L <numeric>
__cpp_lib_scoped_lock 201703L <mutex>
__cpp_lib_semaphore 201907L <semaphore>
__cpp_lib_shared_mutex 201505L <shared_mutex>
@@ -454,7 +454,7 @@ __cpp_lib_within_lifetime 202306L <type_traits>
# undef __cpp_lib_optional
# define __cpp_lib_optional 202110L
// # define __cpp_lib_out_ptr 202106L
-// # define __cpp_lib_print 202207L
+# define __cpp_lib_print 202207L
// # define __cpp_lib_ranges_as_const 202207L
# define __cpp_lib_ranges_as_rvalue 202207L
// # define __cpp_lib_ranges_chunk 202202L
diff --git a/contrib/llvm-project/libcxx/include/wchar.h b/contrib/llvm-project/libcxx/include/wchar.h
index 41fe40db06f9..d4268c6d2c24 100644
--- a/contrib/llvm-project/libcxx/include/wchar.h
+++ b/contrib/llvm-project/libcxx/include/wchar.h
@@ -9,14 +9,14 @@
#if defined(__need_wint_t) || defined(__need_mbstate_t)
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
+# if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+# pragma GCC system_header
+# endif
-#include_next <wchar.h>
+# include_next <wchar.h>
#elif !defined(_LIBCPP_WCHAR_H)
-#define _LIBCPP_WCHAR_H
+# define _LIBCPP_WCHAR_H
/*
wchar.h synopsis
@@ -105,22 +105,23 @@ size_t wcsrtombs(char* restrict dst, const wchar_t** restrict src, size_t len,
*/
-#include <__config>
-#include <stddef.h>
+# include <__config>
+# include <stddef.h>
-#if defined(_LIBCPP_HAS_NO_WIDE_CHARACTERS)
-# error "The <wchar.h> header is not supported since libc++ has been configured with LIBCXX_ENABLE_WIDE_CHARACTERS disabled"
-#endif
+# if defined(_LIBCPP_HAS_NO_WIDE_CHARACTERS)
+# error \
+ "The <wchar.h> header is not supported since libc++ has been configured with LIBCXX_ENABLE_WIDE_CHARACTERS disabled"
+# endif
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
+# if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+# pragma GCC system_header
+# endif
// We define this here to support older versions of glibc <wchar.h> that do
// not define this for clang.
-#ifdef __cplusplus
-#define __CORRECT_ISO_CPP_WCHAR_H_PROTO
-#endif
+# ifdef __cplusplus
+# define __CORRECT_ISO_CPP_WCHAR_H_PROTO
+# endif
# if __has_include_next(<wchar.h>)
# include_next <wchar.h>
@@ -129,64 +130,82 @@ size_t wcsrtombs(char* restrict dst, const wchar_t** restrict src, size_t len,
# endif
// Determine whether we have const-correct overloads for wcschr and friends.
-#if defined(_WCHAR_H_CPLUSPLUS_98_CONFORMANCE_)
-# define _LIBCPP_WCHAR_H_HAS_CONST_OVERLOADS 1
-#elif defined(__GLIBC_PREREQ)
-# if __GLIBC_PREREQ(2, 10)
+# if defined(_WCHAR_H_CPLUSPLUS_98_CONFORMANCE_)
# define _LIBCPP_WCHAR_H_HAS_CONST_OVERLOADS 1
+# elif defined(__GLIBC_PREREQ)
+# if __GLIBC_PREREQ(2, 10)
+# define _LIBCPP_WCHAR_H_HAS_CONST_OVERLOADS 1
+# endif
+# elif defined(_LIBCPP_MSVCRT)
+# if defined(_CRT_CONST_CORRECT_OVERLOADS)
+# define _LIBCPP_WCHAR_H_HAS_CONST_OVERLOADS 1
+# endif
# endif
-#elif defined(_LIBCPP_MSVCRT)
-# if defined(_CRT_CONST_CORRECT_OVERLOADS)
-# define _LIBCPP_WCHAR_H_HAS_CONST_OVERLOADS 1
-# endif
-#endif
-#if defined(__cplusplus) && !defined(_LIBCPP_WCHAR_H_HAS_CONST_OVERLOADS) && defined(_LIBCPP_PREFERRED_OVERLOAD)
+# if defined(__cplusplus) && !defined(_LIBCPP_WCHAR_H_HAS_CONST_OVERLOADS) && defined(_LIBCPP_PREFERRED_OVERLOAD)
extern "C++" {
-inline _LIBCPP_HIDE_FROM_ABI
-wchar_t* __libcpp_wcschr(const wchar_t* __s, wchar_t __c) {return (wchar_t*)wcschr(__s, __c);}
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_PREFERRED_OVERLOAD
-const wchar_t* wcschr(const wchar_t* __s, wchar_t __c) {return __libcpp_wcschr(__s, __c);}
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_PREFERRED_OVERLOAD
- wchar_t* wcschr( wchar_t* __s, wchar_t __c) {return __libcpp_wcschr(__s, __c);}
-
-inline _LIBCPP_HIDE_FROM_ABI
-wchar_t* __libcpp_wcspbrk(const wchar_t* __s1, const wchar_t* __s2) {return (wchar_t*)wcspbrk(__s1, __s2);}
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_PREFERRED_OVERLOAD
-const wchar_t* wcspbrk(const wchar_t* __s1, const wchar_t* __s2) {return __libcpp_wcspbrk(__s1, __s2);}
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_PREFERRED_OVERLOAD
- wchar_t* wcspbrk( wchar_t* __s1, const wchar_t* __s2) {return __libcpp_wcspbrk(__s1, __s2);}
-
-inline _LIBCPP_HIDE_FROM_ABI
-wchar_t* __libcpp_wcsrchr(const wchar_t* __s, wchar_t __c) {return (wchar_t*)wcsrchr(__s, __c);}
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_PREFERRED_OVERLOAD
-const wchar_t* wcsrchr(const wchar_t* __s, wchar_t __c) {return __libcpp_wcsrchr(__s, __c);}
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_PREFERRED_OVERLOAD
- wchar_t* wcsrchr( wchar_t* __s, wchar_t __c) {return __libcpp_wcsrchr(__s, __c);}
-
-inline _LIBCPP_HIDE_FROM_ABI
-wchar_t* __libcpp_wcsstr(const wchar_t* __s1, const wchar_t* __s2) {return (wchar_t*)wcsstr(__s1, __s2);}
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_PREFERRED_OVERLOAD
-const wchar_t* wcsstr(const wchar_t* __s1, const wchar_t* __s2) {return __libcpp_wcsstr(__s1, __s2);}
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_PREFERRED_OVERLOAD
- wchar_t* wcsstr( wchar_t* __s1, const wchar_t* __s2) {return __libcpp_wcsstr(__s1, __s2);}
-
-inline _LIBCPP_HIDE_FROM_ABI
-wchar_t* __libcpp_wmemchr(const wchar_t* __s, wchar_t __c, size_t __n) {return (wchar_t*)wmemchr(__s, __c, __n);}
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_PREFERRED_OVERLOAD
-const wchar_t* wmemchr(const wchar_t* __s, wchar_t __c, size_t __n) {return __libcpp_wmemchr(__s, __c, __n);}
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_PREFERRED_OVERLOAD
- wchar_t* wmemchr( wchar_t* __s, wchar_t __c, size_t __n) {return __libcpp_wmemchr(__s, __c, __n);}
-}
-#endif
-
-#if defined(__cplusplus) && (defined(_LIBCPP_MSVCRT_LIKE) || defined(__MVS__))
+inline _LIBCPP_HIDE_FROM_ABI wchar_t* __libcpp_wcschr(const wchar_t* __s, wchar_t __c) {
+ return (wchar_t*)wcschr(__s, __c);
+}
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_PREFERRED_OVERLOAD const wchar_t* wcschr(const wchar_t* __s, wchar_t __c) {
+ return __libcpp_wcschr(__s, __c);
+}
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_PREFERRED_OVERLOAD wchar_t* wcschr(wchar_t* __s, wchar_t __c) {
+ return __libcpp_wcschr(__s, __c);
+}
+
+inline _LIBCPP_HIDE_FROM_ABI wchar_t* __libcpp_wcspbrk(const wchar_t* __s1, const wchar_t* __s2) {
+ return (wchar_t*)wcspbrk(__s1, __s2);
+}
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_PREFERRED_OVERLOAD const wchar_t*
+wcspbrk(const wchar_t* __s1, const wchar_t* __s2) {
+ return __libcpp_wcspbrk(__s1, __s2);
+}
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_PREFERRED_OVERLOAD wchar_t* wcspbrk(wchar_t* __s1, const wchar_t* __s2) {
+ return __libcpp_wcspbrk(__s1, __s2);
+}
+
+inline _LIBCPP_HIDE_FROM_ABI wchar_t* __libcpp_wcsrchr(const wchar_t* __s, wchar_t __c) {
+ return (wchar_t*)wcsrchr(__s, __c);
+}
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_PREFERRED_OVERLOAD const wchar_t* wcsrchr(const wchar_t* __s, wchar_t __c) {
+ return __libcpp_wcsrchr(__s, __c);
+}
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_PREFERRED_OVERLOAD wchar_t* wcsrchr(wchar_t* __s, wchar_t __c) {
+ return __libcpp_wcsrchr(__s, __c);
+}
+
+inline _LIBCPP_HIDE_FROM_ABI wchar_t* __libcpp_wcsstr(const wchar_t* __s1, const wchar_t* __s2) {
+ return (wchar_t*)wcsstr(__s1, __s2);
+}
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_PREFERRED_OVERLOAD const wchar_t*
+wcsstr(const wchar_t* __s1, const wchar_t* __s2) {
+ return __libcpp_wcsstr(__s1, __s2);
+}
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_PREFERRED_OVERLOAD wchar_t* wcsstr(wchar_t* __s1, const wchar_t* __s2) {
+ return __libcpp_wcsstr(__s1, __s2);
+}
+
+inline _LIBCPP_HIDE_FROM_ABI wchar_t* __libcpp_wmemchr(const wchar_t* __s, wchar_t __c, size_t __n) {
+ return (wchar_t*)wmemchr(__s, __c, __n);
+}
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_PREFERRED_OVERLOAD const wchar_t*
+wmemchr(const wchar_t* __s, wchar_t __c, size_t __n) {
+ return __libcpp_wmemchr(__s, __c, __n);
+}
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_PREFERRED_OVERLOAD wchar_t* wmemchr(wchar_t* __s, wchar_t __c, size_t __n) {
+ return __libcpp_wmemchr(__s, __c, __n);
+}
+}
+# endif
+
+# if defined(__cplusplus) && (defined(_LIBCPP_MSVCRT_LIKE) || defined(__MVS__))
extern "C" {
-size_t mbsnrtowcs(wchar_t *__restrict __dst, const char **__restrict __src,
- size_t __nmc, size_t __len, mbstate_t *__restrict __ps);
-size_t wcsnrtombs(char *__restrict __dst, const wchar_t **__restrict __src,
- size_t __nwc, size_t __len, mbstate_t *__restrict __ps);
+size_t mbsnrtowcs(
+ wchar_t* __restrict __dst, const char** __restrict __src, size_t __nmc, size_t __len, mbstate_t* __restrict __ps);
+size_t wcsnrtombs(
+ char* __restrict __dst, const wchar_t** __restrict __src, size_t __nwc, size_t __len, mbstate_t* __restrict __ps);
} // extern "C"
-#endif // __cplusplus && (_LIBCPP_MSVCRT || __MVS__)
+# endif // __cplusplus && (_LIBCPP_MSVCRT || __MVS__)
#endif // _LIBCPP_WCHAR_H
diff --git a/contrib/llvm-project/libcxx/include/wctype.h b/contrib/llvm-project/libcxx/include/wctype.h
index e4dc61ad5cf4..c76ec5a3f060 100644
--- a/contrib/llvm-project/libcxx/include/wctype.h
+++ b/contrib/llvm-project/libcxx/include/wctype.h
@@ -47,7 +47,8 @@ wctrans_t wctrans(const char* property);
#include <__config>
#if defined(_LIBCPP_HAS_NO_WIDE_CHARACTERS)
-# error "The <wctype.h> header is not supported since libc++ has been configured with LIBCXX_ENABLE_WIDE_CHARACTERS disabled"
+# error \
+ "The <wctype.h> header is not supported since libc++ has been configured with LIBCXX_ENABLE_WIDE_CHARACTERS disabled"
#endif
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
@@ -64,30 +65,30 @@ wctrans_t wctrans(const char* property);
// of these declarations (e.g. <wchar.h>), the second `using ::wint_t` with using_if_exists
// will fail because it does not refer to the same declaration.
#if __has_include_next(<wctype.h>)
-# include_next <wctype.h>
-# define _LIBCPP_INCLUDED_C_LIBRARY_WCTYPE_H
+# include_next <wctype.h>
+# define _LIBCPP_INCLUDED_C_LIBRARY_WCTYPE_H
#endif
#ifdef __cplusplus
-#undef iswalnum
-#undef iswalpha
-#undef iswblank
-#undef iswcntrl
-#undef iswdigit
-#undef iswgraph
-#undef iswlower
-#undef iswprint
-#undef iswpunct
-#undef iswspace
-#undef iswupper
-#undef iswxdigit
-#undef iswctype
-#undef wctype
-#undef towlower
-#undef towupper
-#undef towctrans
-#undef wctrans
+# undef iswalnum
+# undef iswalpha
+# undef iswblank
+# undef iswcntrl
+# undef iswdigit
+# undef iswgraph
+# undef iswlower
+# undef iswprint
+# undef iswpunct
+# undef iswspace
+# undef iswupper
+# undef iswxdigit
+# undef iswctype
+# undef wctype
+# undef towlower
+# undef towupper
+# undef towctrans
+# undef wctrans
#endif // __cplusplus