Template Function ADS::unboundedSearch

Function Documentation

template<class G, class P>
std::size_t ADS::unboundedSearch(G &&get, P &&pred)

unboundedSearch(): the first place i where get( i ), which gives an optional item, empty past the end of the sequence, gives no item or an item x with pred( x ); O( log i ) calls of get

Pre:

pred false and then true on the items of the sequence

Post:

get( r ) is empty or satisfies pred, and get( r - 1 ) does not