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: contains
Front Page / Algorithms / Querying Algorithms / contains

contains

Synopsis

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

Description

Returns a true-valued Integral Constant if one or more elements in Sequence are identical to T.

Parameters

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

Expression semantics

For any Forward Sequence s and arbitrary type t:

typedef contains::type r;
Return type:

Integral Constant.

Semantics:

Equivalent to

typedef not_< is_same<
      find::type
    , end::type
    > >::type r;

Complexity

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