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

find
PrevUpHomeNext
Prototype

template<class SinglePassRange, class Value>
typename range_iterator<SinglePassRange>::type
find(SinglePassRange& rng, Value val);

template<
    range_return_value re,
    class SinglePassRange,
    class Value
    >
typename range_return<SinglePassRange, re>::type
find(SinglePassRange& rng, Value val);

Description

The versions of find that return an iterator, returns the first iterator in the range rng such that *i == value. end(rng) is returned if no such iterator exists. The versions of find that return a range_return, defines found in the same manner as the returned iterator described above.

Definition

Defined in the header file boost/range/algorithm/find.hpp

Requirements
  • SinglePassRange is a model of the Single Pass Range Concept.
  • Value is a model of the EqualityComparableConcept.
  • The operator== is defined for type Value to be compared with the SinglePassRange's value type.
Complexity

Linear. At most distance(rng) comparisons for equality.


PrevUpHomeNext