From 9dcf3e6b76665b46795a1e9209a523350f93bb98 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Herv=C3=A9=20Br=C3=B6nnimann?= The minmax library is composed of two headers <boost/algorithm/minmax.hpp>.
+ The minmax library is composed of two headers, <boost/algorithm/minmax.hpp>
and <boost/algorithm/minmax_element.hpp>.
+href="../../../boost/algorithm/minmax_element.hpp"><boost/algorithm/minmax_element.hpp>.
(See rationale.)
The problem solved by this library is that simultaneous min and max
computation requires
@@ -55,7 +55,7 @@ be enough. The present library solves both problems. The first file implements the function templates
minmax
as straightforward extensions of the C++
-standard. As it returns a pair of const&, we must use the const&, we must use the Boost.tuple library to construct such
pairs. (Please note: the intent is not to fix the known defaults of
std::min
@@ -85,25 +85,29 @@ comparisons and exactly n increments of the
-Minmax_element
-Synopsis of &boost/algorithm/minmax.hpp>
+Synopsis of <boost/algorithm/minmax.hpp>
-namespace boost {
+
#include <boost/tuple/tuple.hpp>
- #include <boost/tuple/tuple.hpp>
+namespace boost {
template <class T>
- std::tuple<T const&, T const&> >
+ tuple<T const&, T const&> >
minmax(const T& a, const T& b);
template <class T, class BinaryPredicate>
- std::tuple<T const&, T const&> >
+ tuple<T const&, T const&> >
minmax(const T& a, const T& b, BinaryPredicate comp);
+
+}
-Synopsis of &boost/algorithm/minmax_element.hpp>
+Synopsis of <boost/algorithm/minmax_element.hpp>
-namespace boost {
+
#include <utility> //for std::pair
+
+namespace boost {
template <class ForwardIterator>
std::pair<ForwardIterator,ForwardIterator>
diff --git a/minmax/index.html b/minmax/index.html
index 4bd605e..c2f2e45 100644
--- a/minmax/index.html
+++ b/minmax/index.html
@@ -36,10 +36,10 @@ HREF="../../../../boost/minmax.hpp">boost/algorithm/minmax.hpp>
Motivation
-
-Synopsis of &boost/algorithm/minmax.hpp>
+Synopsis of <boost/algorithm/minmax.hpp>
-namespace boost {
+
@@ -404,7 +408,7 @@ way to perform only three
comparisons per pair and return the first min and first max elements.
For a long time, it seemed any
attempts at doing so would consume four comparisons per pair in the worst
-case. This implementation achieves that.#include <boost/tuple/tuple.hpp>
- #include <boost/tuple/tuple.hpp>
+namespace boost {
template <class T>
- std::tuple<T const&, T const&> >
+ tuple<T const&, T const&> >
minmax(const T& a, const T& b);
template <class T, class BinaryPredicate>
- std::tuple<T const&, T const&> >
+ tuple<T const&, T const&> >
minmax(const T& a, const T& b, BinaryPredicate comp);
+
+}
-Synopsis of &boost/algorithm/minmax_element.hpp>
+Synopsis of <boost/algorithm/minmax_element.hpp>
-namespace boost {
+
#include <utility> // for std::pair
+
+namespace boost {
template <class ForwardIterator>
std::pair<ForwardIterator,ForwardIterator>
@@ -276,7 +280,7 @@ the library under
int main()
{
using namespace std;
- boost::tuple
It is not possible (or even desirable) to change the meaning of max_element, but it is still beneficial to provide a function called minmax_element, @@ -513,7 +517,7 @@ Comparable, nth_element .
© Copyright Hervé Brönnimann, Polytechnic University, 2002--2004. Use, modification, and distribution is subject to the Boost Software