contains
template<
typename Sequence
, typename T
>
struct contains
{
typedef unspecified type;
};
Returns true_c if one or more elements in Sequence are identical to T, and false_c otherwise.
#include "boost/mpl/contains.hpp"
| Parameter | Requirement | Description |
|---|---|---|
Sequence | A model of Forward Sequence | A sequence to be examined. |
T | A type | The type to search for. |
| Expression | Expression type | Precondition | Semantics | Postcondition |
|---|---|---|---|---|
typedef contains<Sequence,T>::type c; | A model of bool Integral Constant | Equivalent to typedef logical_not< is_same< find<Sequence,T>::type, end<Sequence>::type > >::type c; |
Linear. At most size<Sequence>::value comparisons for identity.
typedef vector<char,int,unsigned,long,unsigned long> types; typedef contains<types,bool>::type result; BOOST_STATIC_ASSERT(!result::value);
Algorithms, find, find_if, count, count_if