gcc/libstdc++-v3/testsuite/25_algorithms
Jonathan Wakely 45cc42d6dc
libstdc++: Make equal and is_permutation short-circuit (LWG 3560)
We already implement short-circuiting for random access iterators, but
we also need to do so for ranges::equal and ranges::is_permutation when
given sized ranges that are not random access ranges (e.g. std::list).

libstdc++-v3/ChangeLog:

	* include/bits/ranges_algo.h (__is_permutation_fn::operator()):
	Short-circuit for sized ranges with different sizes, as per LWG
	3560.
	* include/bits/ranges_algobase.h (__equal_fn::operator()):
	Likewise.
	* include/bits/stl_algo.h (__is_permutation): Use if-constexpr
	for random access iterator branches.
	* include/bits/stl_algobase.h (__equal4): Likewise.
	* testsuite/25_algorithms/equal/lwg3560.cc: New test.
	* testsuite/25_algorithms/is_permutation/lwg3560.cc: New test.

Reviewed-by: Patrick Palka <ppalka@redhat.com>
2024-11-14 20:01:25 +00:00
..
adjacent_find
advance/istreambuf_iterators libstdc++: Use dg-additional-files in some algorithm tests 2024-07-24 12:25:26 +01:00
all_of
any_of
binary_search
clamp
contains libstdc++: Add some missing ranges feature-test macro tests 2024-08-22 11:24:07 -04:00
contains_subrange
copy libstdc++: Inline memmove optimizations for std::copy etc. [PR115444] 2024-10-18 14:49:34 +01:00
copy_backward libstdc++: Fix ranges::copy_backward for a single memcpyable element [PR117121] 2024-10-13 19:27:23 +01:00
copy_if
copy_n libstdc++: Inline memmove optimizations for std::copy etc. [PR115444] 2024-10-18 14:49:34 +01:00
count
count_if
equal libstdc++: Make equal and is_permutation short-circuit (LWG 3560) 2024-11-14 20:01:25 +00:00
equal_range
fill libstdc++: Use std::move for iterator in ranges::fill [PR117094] 2024-10-14 10:55:50 +01:00
fill_n libstdc++: Fix std::fill and std::fill_n optimizations [PR109150] 2024-06-21 17:06:59 +01:00
find libstdc++: Use dg-additional-files in some algorithm tests 2024-07-24 12:25:26 +01:00
find_end
find_first_of libstdc++: Make _GLIBCXX_NODISCARD work for C++11 and C++14 2024-11-14 17:00:40 +00:00
find_if
find_if_not
find_last libstdc++: Add some missing ranges feature-test macro tests 2024-08-22 11:24:07 -04:00
find_last_if
find_last_if_not
fold_left
fold_right
for_each
generate
generate_n
headers libstdc++: Define __cpp_lib_ranges in <algorithm> 2024-06-08 15:51:40 +01:00
heap
includes
inplace_merge
is_heap
is_heap_until
is_partitioned
is_permutation libstdc++: Make equal and is_permutation short-circuit (LWG 3560) 2024-11-14 20:01:25 +00:00
is_sorted
is_sorted_until
iter_swap
lexicographical_compare libstdc++: Make _GLIBCXX_NODISCARD work for C++11 and C++14 2024-11-14 17:00:40 +00:00
lexicographical_compare_three_way libstdc++: Fix conditions for using memcmp in std::lexicographical_compare_three_way [PR113960] 2024-02-29 17:49:43 +00:00
lower_bound libstdc++: Make _GLIBCXX_NODISCARD work for C++11 and C++14 2024-11-14 17:00:40 +00:00
make_heap
max
max_element
merge
min
min_element
minmax libstdc++: Make _GLIBCXX_NODISCARD work for C++11 and C++14 2024-11-14 17:00:40 +00:00
minmax_element
mismatch
move libstdc++: Do not use use memmove for 1-element ranges [PR108846,PR116471] 2024-09-13 13:50:29 +01:00
move_backward libstdc++: Do not use use memmove for 1-element ranges [PR108846,PR116471] 2024-09-13 13:50:29 +01:00
next_permutation
none_of
nth_element
partial_sort
partial_sort_copy
partition
partition_copy
partition_point
pop_heap
prev_permutation
pstl libstdc++: Make PSTL algorithms accept C++20 iterators [PR110512] 2024-09-15 16:15:22 +01:00
push_heap
random_shuffle libstdc++: Fix std::random_shuffle for low RAND_MAX [PR88935] 2024-08-23 13:39:35 +01:00
remove
remove_copy
remove_copy_if
remove_if
replace
replace_copy
replace_copy_if
replace_if
reverse
reverse_copy
rotate
rotate_copy
sample
search libstdc++: Make _GLIBCXX_NODISCARD work for C++11 and C++14 2024-11-14 17:00:40 +00:00
search_n libstdc++: Make _GLIBCXX_NODISCARD work for C++11 and C++14 2024-11-14 17:00:40 +00:00
set_difference
set_intersection
set_symmetric_difference
set_union
shift_left
shift_right
shuffle
sort
sort_heap
stable_partition
stable_sort libstdc++: Handle extended alignment in std::get_temporary_buffer [PR105258] 2024-06-03 21:17:54 +01:00
swap
swap_ranges
transform
unique libstdc++: Make _GLIBCXX_NODISCARD work for C++11 and C++14 2024-11-14 17:00:40 +00:00
unique_copy
upper_bound libstdc++: Make _GLIBCXX_NODISCARD work for C++11 and C++14 2024-11-14 17:00:40 +00:00
constexpr_macro.cc
cpp_lib_constexpr.cc
default_template_value.cc libstdc++: add default template parameters to algorithms 2024-09-22 17:45:05 +01:00