any

| Home | Libraries | People | FAQ | More

##### any

###### Description

For a sequence `seq` and unary function object `f`, `any` returns true if `f` returns true for at least one element of `seq`.

###### Synopsis

    template<
        typename Sequence,
        typename F
        >
    typename result_of::any<Sequence,F>::type any(
        Sequence const& seq, F f);

Table 1.43. Parameters

Parameter | Requirement | Description
--- | --- | ---
`seq` | A model of Forward Sequence, `f(e)` must be a valid expression, convertible to `bool`, for each element `e` in `seq` | The sequence to search
`f` | A unary function object | The search predicate

###### Expression semantics

    any(seq, f);

Return type: `bool`

Semantics: Returns true if and only if `f(e)` evaluates to `true` for some element `e` in `seq`.

###### Complexity

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

###### Header

    #include <boost/fusion/algorithm/query/any.hpp>
    #include <boost/fusion/include/any.hpp>

###### Example

    struct odd
    {
        template<typename T>
        bool operator()(T t) const
        {
            return t % 2;
        }
    };
    ...
    assert(any(make_vector(1,2), odd()));
    assert(!any(make_vector(2,4), odd()));