minimax of input iterator range
(This is an extended (and formatted…) comment (don't like the repetition of the non-pair comparisons at the beginning and end of the sequence). Not having used C++ in a dozen years, I'm hopeless with move semantics, for one. (And not quite destined to review C++ postings…))  

Let me try something about the non-pair comparisons:

template &lt;typename InputIt, typename Compare&gt;
auto minmax_input(InputIt first, InputIt last, Compare comp, std::input_iterator_tag)
{
    using ValueType = typename std::iterator_traits&lt;InputIt&gt;::value_type;

    auto const
        &amp;minimum = *first,
        &amp;maximum = minimum;

    while (++first != last) {
        auto &amp;prev = *first;
        if (++first == last) { // left with half a pair: prev
            if (comp(prev, minimum))
                minimum = prev;
            else if (!comp(prev, maximum))
                maximum = prev;
            break;
        }
        if (comp(*first, prev)) {
            if (comp(*first, minimum))
                minimum = *first;
            if (!comp(prev, maximum))
                maximum = prev;
        } else {
            if (comp(prev, minimum))
                minimum = prev;
            if (!comp(*first, maximum))
                maximum = *first;
        }
    }

    return std::pair&lt;ValueType, ValueType&gt; {minimum, maximum};
}


(Come to think of it, I don't like the symmetrical pairs of comparisons in the loop…)

        auto min_max = std::minmax(one, *first);
        if (comp(min_max.first, minimum))
            minimum = min_max.first;
        if (!comp(min_max.second, maximum))
            maximum = min_max.second;