find
template<
typename Sequence
, typename T
>
struct find
{
typedef unspecified type;
};
Finds the first occurrence of type T in a Sequence.
#include "boost/mpl/find.hpp"
| Parameter | Requirement | Description |
|---|---|---|
Sequence | A model of Forward Sequence | A sequence to search in. |
T | A type | The type to search for. |
| Expression | Expression type | Precondition | Semantics | Postcondition |
|---|---|---|---|---|
typedef find<Sequence,T>::type i; | A model of Forward Iterator | Equivalent to typedef find_if<Sequence, is_same<_,T> >::type i; |
Linear. At most size<Sequence>::value comparisons for identity.
typedef vector<char,int,unsigned,long,unsigned long> types; typedef find<types,unsigned>::type iter; BOOST_STATIC_ASSERT(iter::position == 2);
Algorithms, find_if, contains, count, count_if