...one of the most highly
regarded and expertly designed C++ library projects in the
world.
— Herb Sutter and Andrei
Alexandrescu, C++
Coding Standards
Front Page / Algorithms / Querying Algorithms / find_if |
template< typename Sequence , typename Pred > struct find_if { typedef unspecified type; };
Returns an iterator to the first element in Sequence that satisfies the predicate Pred.
#include <boost/mpl/find_if.hpp>
Parameter | Requirement | Description |
---|---|---|
Sequence | Forward Sequence | A sequence to search in. |
Pred | Unary Lambda Expression | A search condition. |
For any Forward Sequence s and unary Lambda Expression pred:
typedef find_if::type i;
Return type: | |
---|---|
Semantics: | i is the first iterator in the range [begin apply< pred,deref::type >::type::value == true If no such iterator exists, i is identical to end |
Linear. At most size::value applications of pred.
typedef vectortypes; typedef find_if _1,unsigned> >::type iter; BOOST_MPL_ASSERT(( is_same< deref ::type, unsigned > )); BOOST_MPL_ASSERT_RELATION( iter::pos::value, ==, 2 );