The LWG would like to accept N1840 into the C++0X working draft with one chanage:
In the header <algorithm> synopsis, add:
// 25.3.7, minimum and maximum:
// [ ... min, max, followed by]
template <class T>
pair<const T&, const T&>
minmax(const T& a, const T& b);
template <class T, class Compare>
pair<const T&, const T&>
minmax(const T& a, const T& b, Compare comp);
// [ ... min_element, and max_element]
In section 25.3.7, add:
template <class T>
pair<const T&, const T&>
minmax(const T& a, const T& b);
template <class T, class Compare>
pair<const T&, const T&>
minmax(const T& a, const T& b, Compare comp);
-7- Requires:Type T is LessThanComparable (20.1.2).
-8- Returns: pair<const T&, const T&>(b, a) if b is smaller than a, and pair<const T&, const T&>(a, b) otherwise.
-9- Remarks: Returns pair<const T&, const T&>(a, b) if a and b are equivalent.
-10- Complexity: Exactly one comparison.
In the header <algorithm> synopsis, add (and by the way, the comment heading 25.3.8 is missing in the synopsis even in the 2003 revision):
// 25.3.7, minimum and maximum:
// [... min_element, and max_element, followed by:]
template <class ForwardIterator>
pair<ForwardIterator, ForwardIterator>
minmax_element(ForwardIterator first, ForwardIterator last);
template <class ForwardIterator, class Compare>
pair<ForwardIterator, ForwardIterator>
minmax_element(ForwardIterator first, ForwardIterator last, Compare comp);
// 25.3.8, lexicographical comparisons:
// [... lexicographical_compare, etc.]
At the end of section 25.3.7, add:
template <class ForwardIterator>
pair<ForwardIterator, ForwardIterator>
minmax_element(ForwardIterator first, ForwardIterator last);
template <class ForwardIterator, class Compare>
pair<ForwardIterator, ForwardIterator>
minmax_element(ForwardIterator first, ForwardIterator last, Compare comp);
-15- Returns: std::make_pair(m, M) where m is the std::min_element and M the std::max_element of the input range [first, last) for the corresponding comparisons.
-16- Complexity: At most max(2*(last-first)-2, 0) applications of the corresponding comparisons.