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);

 

相关文章:

  • 2021-12-20
  • 2022-12-23
  • 2021-09-19
  • 2021-08-21
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-10-20
  • 2021-09-24
  • 2021-09-19
  • 2021-07-24
相关资源
相似解决方案