My Project
stxxl::find
Author
Roman Dementiev (2006)

The semantics of the algorithm is equivalent to the STL std::find.

Prototype

template < typename ExtIterator, typename EqualityComparable >
ExtIterator find ( ExtIterator first,
ExtIterator last,
const EqualityComparable& value,
int_type nbuffers
)

Description

Requirements on types

  • EqualityComparable is a model of STL EqualityComparable concept.
  • ExtIterator is a model of External Random Access Iterator.
  • Equality is defined between objects of type EqualityComparable and objects of ExtIterator's value type.

Preconditions

[first, last) is a valid range.

Complexity

  • Internal work is linear.
  • External work: close to $ N/DB $ I/Os (read-only).

Example

typedef stxxl::VECTOR_GENERATOR<int>::result vector_type;
vector_type V;
// fill the vector ...
// find 7 in V
vector_type::iterator result = find(V.begin(), V.end(), 7);
if(result != V.end())
std::cout << "Found at position " << (result - V.begin()) << std::endl;
else
std::cout << "Not found" << std::endl;