# find

### Synopsis

    template<
          typename Sequence
        , typename T
        >
    struct find
    {
        typedef unspecified type;
    };

### Description

Finds the first occurrence of type `T` in a `Sequence`.

### Definition

    #include "boost/mpl/find.hpp"

### Parameters

Parameter | Requirement | Description
--- | --- | ---
`Sequence` | A model of Forward Sequence | A sequence to search in.
`T` | A type | The type to search for.

### Expression semantics

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`;

### Complexity

Linear. At most `size<Sequence>::value` comparisons for identity.

### Example

    typedef vector<char,int,unsigned,long,unsigned long> types;
    typedef find<types,unsigned>::type iter;
    BOOST_STATIC_ASSERT(iter::position == 2);

### See also

Algorithms, `find_if`, `contains`, `count`, `count_if`

Table of Content | Reference
Last edited July 17, 2002 4:48 am