Boost C++ Libraries

...one of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

The MPL Reference Manual: find
Front Page / Algorithms / Querying Algorithms / find

find

Synopsis

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

Description

Returns an iterator to the first occurrence of type T in a Sequence.

Parameters

Parameter Requirement Description
Sequence Forward Sequence A sequence to search in.
T Any type A type to search for.

Expression semantics

For any Forward Sequence s and arbitrary type t:

typedef find::type i;
Return type:

Forward Iterator.

Semantics:

Equivalent to

typedef find_if >::type i;

Complexity

Linear. At most size::value comparisons for identity.

Example

typedef vector types;
typedef find::type iter;

BOOST_MPL_ASSERT(( is_same< deref::type, unsigned > ));
BOOST_MPL_ASSERT_RELATION( iter::pos::value, ==, 2 );