...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 |
Returns an iterator to the first occurrence of type T in a Sequence.
#include <boost/mpl/find.hpp>
Parameter | Requirement | Description |
---|---|---|
Sequence | Forward Sequence | A sequence to search in. |
T | Any type | A type to search for. |
For any Forward Sequence s and arbitrary type t:
typedef find<s,t>::type i;
Return type: | Forward Iterator. |
---|---|
Semantics: | Equivalent to typedef find_if<s, is_same<_,t> >::type i; |
Linear. At most size<s>::value comparisons for identity.
typedef vector<char,int,unsigned,long,unsigned long> types; typedef find<types,unsigned>::type iter; BOOST_MPL_ASSERT(( is_same< deref<iter>::type, unsigned > )); BOOST_MPL_ASSERT_RELATION( iter::pos::value, ==, 2 );