max_element function template — Finds the largest element in a range
template<typename FwdIter> FwdIter max_element(FwdIter first, FwdIter last); template<typename FwdIter, typename Compare> FwdIter max_element(FwdIter first, FwdIter last, Compare comp);
The max_element
function
template returns an iterator that points to the largest element in
the range [first
, last
). If there are multiple instances of
the largest element, the iterator points to the first such
instance.
The first form compares values using the <
operator. The second form calls
comp(*iter1
, *iter2)
.