diff --git a/sprout/algorithm/max_element.hpp b/sprout/algorithm/max_element.hpp index 74eb108e..e6f2534e 100644 --- a/sprout/algorithm/max_element.hpp +++ b/sprout/algorithm/max_element.hpp @@ -18,9 +18,9 @@ namespace sprout { namespace detail { - template - inline SPROUT_CONSTEXPR InputIterator - iter_max(InputIterator a, InputIterator b, Compare comp) { + template + inline SPROUT_CONSTEXPR ForwardIterator + iter_max(ForwardIterator a, ForwardIterator b, Compare comp) { return comp(*a, *b) ? b : a; } diff --git a/sprout/algorithm/minmax_element.hpp b/sprout/algorithm/minmax_element.hpp index a684b917..9bba8516 100644 --- a/sprout/algorithm/minmax_element.hpp +++ b/sprout/algorithm/minmax_element.hpp @@ -19,20 +19,20 @@ namespace sprout { namespace detail { - template - inline SPROUT_CONSTEXPR InputIteratorPair - iter_minmax_pair(InputIteratorPair const& a, InputIteratorPair const& b, Compare comp) { - return InputIteratorPair( + template + inline SPROUT_CONSTEXPR ForwardIteratorPair + iter_minmax_pair(ForwardIteratorPair const& a, ForwardIteratorPair const& b, Compare comp) { + return ForwardIteratorPair( comp(*sprout::first(b), *sprout::first(a)) ? sprout::first(b) : sprout::first(a), - comp(*sprout::second(a), *sprout::second(b)) ? sprout::second(b) : sprout::second(a) + comp(*sprout::second(b), *sprout::second(a)) ? sprout::second(a) : sprout::second(b) ); } - template - inline SPROUT_CONSTEXPR InputIteratorPair - iter_minmax(InputIteratorPair const& a, InputIterator b, Compare comp) { - return InputIteratorPair( + template + inline SPROUT_CONSTEXPR ForwardIteratorPair + iter_minmax(ForwardIteratorPair const& a, ForwardIterator b, Compare comp) { + return ForwardIteratorPair( comp(*b, *sprout::first(a)) ? b : sprout::first(a), - comp(*sprout::second(a), *b) ? b : sprout::second(a) + comp(*sprout::second(b), *a) ? a : sprout::second(b) ); }