Front Page / Algorithms / Querying Algorithms / max_element |
template< typename Sequence , typename Pred = less<_1,_2> > struct max_element { typedef unspecified type; };
Returns an iterator to the largest element in Sequence.
#include <boost/mpl/max_element.hpp>
Parameter | Requirement | Description |
---|---|---|
Sequence | Forward Sequence | A sequence to be searched. |
Pred | Binary Lambda Expression | A comparison criteria. |
For any Forward Sequence s and binary Lambda Expression pred:
typedef max_element<s,pred>::type i;
Return type: | |
---|---|
Semantics: | i is the first iterator in [begin<s>::type, end<s>::type) such that for every iterator j in [begin<s>::type, end<s>::type), apply< pred, deref<i>::type, deref<j>::type >::type::value == false |
Linear. Zero comparisons if s is empty, otherwise exactly size<s>::value - 1 comparisons.
typedef vector<bool,char[50],long,double> types; typedef max_element< transform_view< types,sizeof_<_1> > >::type iter; BOOST_MPL_ASSERT(( is_same< deref<iter::base>::type, char[50]> ));