gcc/libstdc++-v3/testsuite/25_algorithms
Patrick Palka cc9c94d43d libstdc++: Reduce ranges::minmax/minmax_element comparison complexity
This rewrites ranges::minmax and ranges::minmax_element so that it
performs at most 3*N/2 many comparisons, as required by the standard.
In passing, this also fixes PR100387 by avoiding a premature std::move
in ranges::minmax and in std::shift_right.

	PR libstdc++/100387

libstdc++-v3/ChangeLog:

	* include/bits/ranges_algo.h (__minmax_fn::operator()): Rewrite
	to limit comparison complexity to 3*N/2.
	(__minmax_element_fn::operator()): Likewise.
	(shift_right): Avoid premature std::move of __result.
	* testsuite/25_algorithms/minmax/constrained.cc (test04, test05):
	New tests.
	* testsuite/25_algorithms/minmax_element/constrained.cc (test02):
	Likewise.
2021-06-18 19:33:39 -04:00
..
adjacent_find Update copyright years. 2021-01-04 10:26:59 +01:00
advance/istreambuf_iterators Update copyright years. 2021-01-04 10:26:59 +01:00
all_of Update copyright years. 2021-01-04 10:26:59 +01:00
any_of Update copyright years. 2021-01-04 10:26:59 +01:00
binary_search Update copyright years. 2021-01-04 10:26:59 +01:00
clamp libstdc++: Remove redundant -std=gnu++17 option from algorithm tests 2021-05-10 16:22:54 +01:00
copy libstdc++: Fix tests that fail in C++98 mode 2021-05-11 17:21:08 +01:00
copy_backward libstdc++ Fix undefined behaviour in testsuite 2021-05-04 22:34:20 +01:00
copy_if Update copyright years. 2021-01-04 10:26:59 +01:00
copy_n libstdc++: Improve static assert messages 2021-05-06 16:07:10 +01:00
count Update copyright years. 2021-01-04 10:26:59 +01:00
count_if Update copyright years. 2021-01-04 10:26:59 +01:00
equal Update copyright years. 2021-01-04 10:26:59 +01:00
equal_range Update copyright years. 2021-01-04 10:26:59 +01:00
fill Update copyright years. 2021-01-04 10:26:59 +01:00
fill_n Update copyright years. 2021-01-04 10:26:59 +01:00
find Update copyright years. 2021-01-04 10:26:59 +01:00
find_end Update copyright years. 2021-01-04 10:26:59 +01:00
find_first_of Update copyright years. 2021-01-04 10:26:59 +01:00
find_if Update copyright years. 2021-01-04 10:26:59 +01:00
find_if_not Update copyright years. 2021-01-04 10:26:59 +01:00
for_each libstdc++: Remove redundant -std=gnu++17 option from algorithm tests 2021-05-10 16:22:54 +01:00
generate Update copyright years. 2021-01-04 10:26:59 +01:00
generate_n Update copyright years. 2021-01-04 10:26:59 +01:00
headers Update copyright years. 2021-01-04 10:26:59 +01:00
heap Update copyright years. 2021-01-04 10:26:59 +01:00
includes Update copyright years. 2021-01-04 10:26:59 +01:00
inplace_merge libstdc++: Qualify functions used in tests 2021-05-24 18:42:09 +01:00
is_heap Update copyright years. 2021-01-04 10:26:59 +01:00
is_heap_until Update copyright years. 2021-01-04 10:26:59 +01:00
is_partitioned Update copyright years. 2021-01-04 10:26:59 +01:00
is_permutation Update copyright years. 2021-01-04 10:26:59 +01:00
is_sorted libstdc++: Qualify functions used in tests 2021-05-24 18:42:09 +01:00
is_sorted_until libstdc++: Qualify functions used in tests 2021-05-24 18:42:09 +01:00
iter_swap Update copyright years. 2021-01-04 10:26:59 +01:00
lexicographical_compare Update copyright years. 2021-01-04 10:26:59 +01:00
lexicographical_compare_three_way Update copyright years. 2021-01-04 10:26:59 +01:00
lower_bound Update copyright years. 2021-01-04 10:26:59 +01:00
make_heap Update copyright years. 2021-01-04 10:26:59 +01:00
max Update copyright years. 2021-01-04 10:26:59 +01:00
max_element Update copyright years. 2021-01-04 10:26:59 +01:00
merge Update copyright years. 2021-01-04 10:26:59 +01:00
min Update copyright years. 2021-01-04 10:26:59 +01:00
min_element Update copyright years. 2021-01-04 10:26:59 +01:00
minmax libstdc++: Reduce ranges::minmax/minmax_element comparison complexity 2021-06-18 19:33:39 -04:00
minmax_element libstdc++: Reduce ranges::minmax/minmax_element comparison complexity 2021-06-18 19:33:39 -04:00
mismatch Update copyright years. 2021-01-04 10:26:59 +01:00
move Update copyright years. 2021-01-04 10:26:59 +01:00
move_backward libstdc++ Fix undefined behaviour in testsuite 2021-05-04 22:34:20 +01:00
next_permutation Update copyright years. 2021-01-04 10:26:59 +01:00
none_of Update copyright years. 2021-01-04 10:26:59 +01:00
nth_element Update copyright years. 2021-01-04 10:26:59 +01:00
partial_sort Update copyright years. 2021-01-04 10:26:59 +01:00
partial_sort_copy Update copyright years. 2021-01-04 10:26:59 +01:00
partition Update copyright years. 2021-01-04 10:26:59 +01:00
partition_copy Update copyright years. 2021-01-04 10:26:59 +01:00
partition_point Update copyright years. 2021-01-04 10:26:59 +01:00
pop_heap Update copyright years. 2021-01-04 10:26:59 +01:00
prev_permutation Update copyright years. 2021-01-04 10:26:59 +01:00
pstl libstdc++: Fix some problems in PSTL tests 2021-05-12 14:51:15 +01:00
push_heap Update copyright years. 2021-01-04 10:26:59 +01:00
random_shuffle Update copyright years. 2021-01-04 10:26:59 +01:00
remove Update copyright years. 2021-01-04 10:26:59 +01:00
remove_copy Update copyright years. 2021-01-04 10:26:59 +01:00
remove_copy_if Update copyright years. 2021-01-04 10:26:59 +01:00
remove_if Update copyright years. 2021-01-04 10:26:59 +01:00
replace Update copyright years. 2021-01-04 10:26:59 +01:00
replace_copy Update copyright years. 2021-01-04 10:26:59 +01:00
replace_copy_if Update copyright years. 2021-01-04 10:26:59 +01:00
replace_if Update copyright years. 2021-01-04 10:26:59 +01:00
reverse Update copyright years. 2021-01-04 10:26:59 +01:00
reverse_copy Update copyright years. 2021-01-04 10:26:59 +01:00
rotate Update copyright years. 2021-01-04 10:26:59 +01:00
rotate_copy Update copyright years. 2021-01-04 10:26:59 +01:00
sample libstdc++: Remove redundant -std=gnu++17 option from algorithm tests 2021-05-10 16:22:54 +01:00
search libstdc++: Remove redundant -std=gnu++17 option from algorithm tests 2021-05-10 16:22:54 +01:00
search_n Update copyright years. 2021-01-04 10:26:59 +01:00
set_difference Update copyright years. 2021-01-04 10:26:59 +01:00
set_intersection Update copyright years. 2021-01-04 10:26:59 +01:00
set_symmetric_difference Update copyright years. 2021-01-04 10:26:59 +01:00
set_union Update copyright years. 2021-01-04 10:26:59 +01:00
shift_left Update copyright years. 2021-01-04 10:26:59 +01:00
shift_right Update copyright years. 2021-01-04 10:26:59 +01:00
shuffle Update copyright years. 2021-01-04 10:26:59 +01:00
sort Update copyright years. 2021-01-04 10:26:59 +01:00
sort_heap Update copyright years. 2021-01-04 10:26:59 +01:00
stable_partition Update copyright years. 2021-01-04 10:26:59 +01:00
stable_sort Update copyright years. 2021-01-04 10:26:59 +01:00
swap Update copyright years. 2021-01-04 10:26:59 +01:00
swap_ranges libstdc++: Qualify functions used in tests 2021-05-24 18:42:09 +01:00
transform Update copyright years. 2021-01-04 10:26:59 +01:00
unique Update copyright years. 2021-01-04 10:26:59 +01:00
unique_copy Update copyright years. 2021-01-04 10:26:59 +01:00
upper_bound Update copyright years. 2021-01-04 10:26:59 +01:00
constexpr_macro.cc Update copyright years. 2021-01-04 10:26:59 +01:00
cpp_lib_constexpr.cc Update copyright years. 2021-01-04 10:26:59 +01:00