|
Boost : |
From: Jeremy Siek (jsiek_at_[hidden])
Date: 2002-05-15 14:32:39
Hi Herve,
Sounds like a good addition to the algorithms. I'll check this stuff into
the boost-sandbox.
Cheers,
Jeremy
On Mon, 13 May 2002, Herve Bronnimann wrote:
hbr> Hello boosters:
hbr>
hbr> I've recently assigned and completed a homework, an extension of
hbr> std::min_element and std::max_element. I've put in the Files section of
hbr> the Boost.org website (under non-capitalized minmax_element) and also
hbr> created a Wiki entry in STLAlgorithmExtensions for recording the
hbr> discussion.
hbr>
hbr> I sollicit your feedback and, if nobody objects, would like to propose
hbr> this as a boost library. It's a single file <boost/minmax.hpp>.
hbr>
hbr> The story is, minmax_element does the work of both min_element and
hbr> max_element, in a single traversal and using only 3n/2+1 comparisons.
hbr> Experimentally, it's just a tad slower than min_element alone. The
hbr> algorithm is well known, but I found it quite tricky to implement
hbr> correctly (esp. when elements can be identical and you want to return
hbr> the FIRST occurence of both min and max). Try it!
hbr>
hbr> Everything else is on the web site:
hbr>
hbr> http://groups.yahoo.com/group/boost/files/minmax_element/
hbr>
hbr> Please reply to me directly as well as the mailing list, as I read the
hbr> boost digest only (and not that frequently).
hbr> --
hbr> Herve Bronnimann
hbr> Assistant Professor, Computer Science Dept
hbr> Polytechnic University Tel (718) 260 3538
hbr> Six Metrotech Center Fax (718) 260 3609
hbr> Brooklyn, NY 11201 http://photon.poly/edu/~hbr/
hbr>
hbr> _______________________________________________
hbr> Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
hbr>
----------------------------------------------------------------------
Jeremy Siek http://php.indiana.edu/~jsiek/
Ph.D. Student, Indiana Univ. B'ton email: jsiek_at_[hidden]
C++ Booster (http://www.boost.org) office phone: (812) 855-3608
----------------------------------------------------------------------
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk