gcc/libstdc++-v3/testsuite/25_algorithms/minmax
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
..
requirements/explicit_instantiation Update copyright years. 2021-01-04 10:26:59 +01:00
1.cc Update copyright years. 2021-01-04 10:26:59 +01:00
2.cc Update copyright years. 2021-01-04 10:26:59 +01:00
3.cc Update copyright years. 2021-01-04 10:26:59 +01:00
37547.cc Update copyright years. 2021-01-04 10:26:59 +01:00
constexpr.cc Update copyright years. 2021-01-04 10:26:59 +01:00
constrained.cc libstdc++: Reduce ranges::minmax/minmax_element comparison complexity 2021-06-18 19:33:39 -04:00