annotate DEPENDENCIES/generic/include/boost/algorithm/minmax.hpp @ 125:34e428693f5d vext

Vext -> Repoint
author Chris Cannam
date Thu, 14 Jun 2018 11:15:39 +0100
parents 2665513ce2d3
children
rev   line source
Chris@16 1 // (C) Copyright Herve Bronnimann 2004.
Chris@16 2 //
Chris@16 3 // Distributed under the Boost Software License, Version 1.0. (See accompanying
Chris@16 4 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
Chris@16 5
Chris@16 6 /*
Chris@16 7 Revision history:
Chris@16 8 1 July 2004
Chris@16 9 Split the code into two headers to lessen dependence on
Chris@16 10 Boost.tuple. (Herve)
Chris@16 11 26 June 2004
Chris@16 12 Added the code for the boost minmax library. (Herve)
Chris@16 13 */
Chris@16 14
Chris@16 15 #ifndef BOOST_ALGORITHM_MINMAX_HPP
Chris@16 16 #define BOOST_ALGORITHM_MINMAX_HPP
Chris@16 17
Chris@16 18 /* PROPOSED STANDARD EXTENSIONS:
Chris@16 19 *
Chris@16 20 * minmax(a, b)
Chris@16 21 * Effect: (b<a) ? std::make_pair(b,a) : std::make_pair(a,b);
Chris@16 22 *
Chris@16 23 * minmax(a, b, comp)
Chris@16 24 * Effect: comp(b,a) ? std::make_pair(b,a) : std::make_pair(a,b);
Chris@16 25 *
Chris@16 26 */
Chris@16 27
Chris@16 28 #include <boost/tuple/tuple.hpp> // for using pairs with boost::cref
Chris@16 29 #include <boost/ref.hpp>
Chris@16 30
Chris@16 31 namespace boost {
Chris@16 32
Chris@16 33 template <typename T>
Chris@16 34 tuple< T const&, T const& >
Chris@16 35 minmax(T const& a, T const& b) {
Chris@16 36 return (b<a) ? make_tuple(cref(b),cref(a)) : make_tuple(cref(a),cref(b));
Chris@16 37 }
Chris@16 38
Chris@16 39 template <typename T, class BinaryPredicate>
Chris@16 40 tuple< T const&, T const& >
Chris@16 41 minmax(T const& a, T const& b, BinaryPredicate comp) {
Chris@16 42 return comp(b,a) ? make_tuple(cref(b),cref(a)) : make_tuple(cref(a),cref(b));
Chris@16 43 }
Chris@16 44
Chris@16 45 } // namespace boost
Chris@16 46
Chris@16 47 #endif // BOOST_ALGORITHM_MINMAX_HPP