File indexing completed on 2025-01-18 09:28:26
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015 #ifndef BOOST_ALGORITHM_MINMAX_HPP
0016 #define BOOST_ALGORITHM_MINMAX_HPP
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028 #include <boost/config.hpp>
0029 #include <boost/tuple/tuple.hpp> // for using pairs with boost::cref
0030 #include <boost/ref.hpp>
0031
0032 namespace boost {
0033
0034 template <typename T>
0035 tuple< T const&, T const& >
0036 minmax(T const& a, T const& b) {
0037 return (b<a) ? make_tuple(cref(b),cref(a)) : make_tuple(cref(a),cref(b));
0038 }
0039
0040 template <typename T, class BinaryPredicate>
0041 tuple< T const&, T const& >
0042 minmax(T const& a, T const& b, BinaryPredicate comp) {
0043 return comp(b,a) ? make_tuple(cref(b),cref(a)) : make_tuple(cref(a),cref(b));
0044 }
0045
0046 }
0047
0048 #endif