最大值最小值(max,max_element)

min

  如果比不出大小就返回第一个引数

//版本一:调用operator< 
template <class LessThanComparable>
const LessThanComparable& min(const LessThanComparable &a,const LessThanComparable& b);

//版本二:调用自己定义的function object来比较
template <class T,class BinaryPredicate>
const T& min(const T &a,const T& b,v cmp);

max

  如果比不出大小就返回第一个引数

//版本一:调用operator< 
template <class LessThanComparable>
const LessThanComparable& max(const LessThanComparable &a,const LessThanComparable& b);

//版本二:调用自己定义的function object来比较
template <class T,class BinaryPredicate>
const T& max(const T &a,const T& b,v cmp);

min_element

  返回range内再有没有其他iterator 指向的值小于*i的iterator i,如果range为空,返回last

//版本一:调用operator< 
template <class ForwardIterator>
ForwardIterator min_element(ForwardIterator first,ForwardIterator last);

//版本二:调用自己定义的function object来比较,返回cmp(*j,*i)为false的i
template <class ForwardIterator,class BinaryPredicate>
ForwardIterator min_element(ForwardIterator first,ForwardIterator last,BinaryPredicate cmp);

max_element

  返回range内再也没有其他iterator所指的值大于*i的iterator i,若为空,返回last

//版本一:调用operator< 
template <class ForwardIterator>
ForwardIterator max_element(ForwardIterator first,ForwardIterator last);

//版本二:调用自己定义的function object来比较,返回cmp(*i,*j)为false的i
template <class ForwardIterator,class BinaryPredicate>
ForwardIterator max_element(ForwardIterator first,ForwardIterator last,BinaryPredicate cmp);
原文地址:https://www.cnblogs.com/tianzeng/p/10403569.html