1 .. Algorithms/Querying Algorithms//find_if |20
17 typedef |unspecified| type;
25 Returns an iterator to the first element in ``Sequence`` that satisfies
26 the predicate ``Pred``.
34 #include <boost/mpl/find_if.hpp>
41 +---------------+-------------------------------+-----------------------------------+
42 | Parameter | Requirement | Description |
43 +===============+===============================+===================================+
44 | ``Sequence`` | |Forward Sequence| | A sequence to search in. |
45 +---------------+-------------------------------+-----------------------------------+
46 | ``Pred`` | Unary |Lambda Expression| | A search condition. |
47 +---------------+-------------------------------+-----------------------------------+
53 For any |Forward Sequence| ``s`` and unary |Lambda Expression| ``pred``:
58 typedef find_if<s,pred>::type i;
64 ``i`` is the first iterator in the range |begin/end<s>| such that
68 apply< pred,deref<i>::type >::type::value == true
70 If no such iterator exists, ``i`` is identical to ``end<s>::type``.
76 Linear. At most ``size<s>::value`` applications of ``pred``.
84 typedef vector<char,int,unsigned,long,unsigned long> types;
85 typedef find_if<types, is_same<_1,unsigned> >::type iter;
87 BOOST_MPL_ASSERT(( is_same< deref<iter>::type, unsigned > ));
88 BOOST_MPL_ASSERT_RELATION( iter::pos::value, ==, 2 );
94 |Querying Algorithms|, |find|, |count_if|, |lower_bound|
97 .. copyright:: Copyright © 2001-2009 Aleksey Gurtovoy and David Abrahams
98 Distributed under the Boost Software License, Version 1.0. (See accompanying
99 file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)