Back to Arangodb

find_if

3rdParty/boost/1.78.0/libs/mpl/doc/refmanual/find-if.html

3.12.9.12.7 KB
Original Source

| Prev Next | Back Along | Up Home | Full TOC | Front Page / Algorithms / Querying Algorithms / find_if |

find_if

Synopsis

template<
      typename Sequence
    , typename Pred
    >
struct[find\_if](./find-if.html){
    typedef_unspecified_type;
};

Description

Returns an iterator to the first element in Sequence that satisfies the predicate Pred.

#include <[boost/mpl/find\_if.hpp](../../../../boost/mpl/find_if.hpp)>

Parameters

ParameterRequirementDescription
SequenceForward SequenceA sequence to search in.
PredUnary Lambda ExpressionA search condition.

Expression semantics

For any Forward Sequence s and unary Lambda Expression pred:

typedef[find\_if](./find-if.html)<s,pred>::type i;

| Return type: |

Forward Iterator.

| | Semantics: |

i is the first iterator in the range [begin<s>::type, end<s>::type) such that

[apply](./apply.html)< pred,[deref](./deref.html)<i>::type >::type::value == true

If no such iterator exists, i is identical to end<s>::type.

|

Complexity

Linear. At most size<s>::value applications of pred.

Example

typedef[vector](./vector.html)<char,int,unsigned,long,unsigned long> types;
typedef[find\_if](./find-if.html)<types, is_same<[\_1](./placeholders.html),unsigned> >::type iter;[BOOST\_MPL\_ASSERT](./assert.html)(( is_same<[deref](./deref.html)<iter>::type, unsigned > ));[BOOST\_MPL\_ASSERT\_RELATION](./assert-relation.html)( iter::pos::value, ==, 2 );

See also

Querying Algorithms, find, count_if, lower_bound

| Prev Next | Back Along | Up Home | Full TOC |

Copyright © 2001-2009 Aleksey Gurtovoy and David Abrahams Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) |