Boost logo

Boost :

From: Herve Bronnimann (hbr_at_[hidden])
Date: 2002-05-13 14:43:49


Hello boosters:

I've recently assigned and completed a homework, an extension of
std::min_element and std::max_element. I've put in the Files section of
the Boost.org website (under non-capitalized minmax_element) and also
created a Wiki entry in STLAlgorithmExtensions for recording the
discussion.

I sollicit your feedback and, if nobody objects, would like to propose
this as a boost library. It's a single file <boost/minmax.hpp>.

The story is, minmax_element does the work of both min_element and
max_element, in a single traversal and using only 3n/2+1 comparisons.
Experimentally, it's just a tad slower than min_element alone. The
algorithm is well known, but I found it quite tricky to implement
correctly (esp. when elements can be identical and you want to return
the FIRST occurence of both min and max). Try it!

Everything else is on the web site:

  http://groups.yahoo.com/group/boost/files/minmax_element/

Please reply to me directly as well as the mailing list, as I read the
boost digest only (and not that frequently).

-- 
Herve Bronnimann
Assistant Professor, Computer Science Dept
Polytechnic University                    Tel (718) 260 3538
Six Metrotech Center                      Fax (718) 260 3609
Brooklyn, NY 11201              http://photon.poly/edu/~hbr/

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk