cc79682046
__dp_sign precision indicates that we found out what iterator comes first or last in the range. __dp_sign_max_size is the same plus it gives the information of the max size of the range that is to say the max_size value such that distance(lhs, rhs) < max_size. Thanks to this additional information we are able to tell when a copy of n elements to that range will fail even if we do not know exactly how large it is. This patch makes sure that we are properly using this information. libstdc++-v3/ChangeLog: PR libstdc++/99402 * include/debug/helper_functions.h (__can_advance(_InputIterator, const std::pair<_Diff, _Distance_precision>&, int)): New. (__can_advance(const _Safe_iterator<>&, const std::pair<_Diff, _Distance_precision>&, int)): New. * include/debug/macros.h (__glibcxx_check_can_increment_dist): New, use latter. (__glibcxx_check_can_increment_range): Adapt to use latter. (__glibcxx_check_can_decrement_range): Likewise. * include/debug/safe_iterator.h (_Safe_iterator<>::_M_can_advance(const std::pair<_Diff, _Distance_precision>&, int)): New. (__can_advance(const _Safe_iterator<>&, const std::pair<_Diff, _Distance_precision>&, int)): New. * include/debug/safe_iterator.tcc (_Safe_iterator<>::_M_can_advance(const std::pair<_Diff, _Distance_precision>&, int)): New. (_Safe_iterator<>::_M_valid_range(const _Safe_iterator<>&, std::pair<difference_type, _Distance_precision>&, bool)): Adapt for __dp_sign_max_size. (__copy_move_a): Adapt to use __glibcxx_check_can_increment_dist. (__copy_move_backward_a): Likewise. (__equal_aux): Likewise. * include/debug/stl_iterator.h (__can_advance(const std::reverse_iterator<>&, const std::pair<_Diff, _Distance_precision>&, int)): New. (__can_advance(const std::move_iterator<>&, const std::pair<_Diff, _Distance_precision>&, int)): New. * testsuite/25_algorithms/copy/debug/99402.cc: New test. |
||
---|---|---|
.. | ||
adjacent_find | ||
advance/istreambuf_iterators | ||
all_of | ||
any_of | ||
binary_search | ||
clamp | ||
copy | ||
copy_backward | ||
copy_if | ||
copy_n | ||
count | ||
count_if | ||
equal | ||
equal_range | ||
fill | ||
fill_n | ||
find | ||
find_end | ||
find_first_of | ||
find_if | ||
find_if_not | ||
for_each | ||
generate | ||
generate_n | ||
headers | ||
heap | ||
includes | ||
inplace_merge | ||
is_heap | ||
is_heap_until | ||
is_partitioned | ||
is_permutation | ||
is_sorted | ||
is_sorted_until | ||
iter_swap | ||
lexicographical_compare | ||
lexicographical_compare_three_way | ||
lower_bound | ||
make_heap | ||
max | ||
max_element | ||
merge | ||
min | ||
min_element | ||
minmax | ||
minmax_element | ||
mismatch | ||
move | ||
move_backward | ||
next_permutation | ||
none_of | ||
nth_element | ||
partial_sort | ||
partial_sort_copy | ||
partition | ||
partition_copy | ||
partition_point | ||
pop_heap | ||
prev_permutation | ||
pstl | ||
push_heap | ||
random_shuffle | ||
remove | ||
remove_copy | ||
remove_copy_if | ||
remove_if | ||
replace | ||
replace_copy | ||
replace_copy_if | ||
replace_if | ||
reverse | ||
reverse_copy | ||
rotate | ||
rotate_copy | ||
sample | ||
search | ||
search_n | ||
set_difference | ||
set_intersection | ||
set_symmetric_difference | ||
set_union | ||
shift_left | ||
shift_right | ||
shuffle | ||
sort | ||
sort_heap | ||
stable_partition | ||
stable_sort | ||
swap | ||
swap_ranges | ||
transform | ||
unique | ||
unique_copy | ||
upper_bound | ||
constexpr_macro.cc | ||
cpp_lib_constexpr.cc |