forked from boostorg/algorithm
find_{not,*backward} docs copy editing.
This commit is contained in:
@ -11,7 +11,7 @@ Distributed under the Boost Software License, Version 1.0.
|
||||
|
||||
The header file 'find_backward.hpp' contains variants of the stl algorithm
|
||||
`find`. These variants are like `find`, except that the evaluate the elements
|
||||
of the given sequence if reverse order.
|
||||
of the given sequence in reverse order.
|
||||
|
||||
Consider how finding the last element that is equal to `x` in a range is
|
||||
typically done:
|
||||
@ -23,7 +23,7 @@ typically done:
|
||||
}
|
||||
}
|
||||
|
||||
Raw loops are icky though. PErhaps we should do a bit of extra work to allow
|
||||
Raw loops are icky though. Perhaps we should do a bit of extra work to allow
|
||||
the use of `std::find()`:
|
||||
|
||||
auto rfirst = std::make_reverse_iterator(last);
|
||||
@ -31,31 +31,31 @@ the use of `std::find()`:
|
||||
auto it = std::find(rfirst, rlast);
|
||||
// Use it here...
|
||||
|
||||
That seems nicer, but it has two major drawbacks. First, it requires an
|
||||
unpleasant amount of typing. Second, it is considerably less efficient than
|
||||
forward-iterator `find` , since `std::reverse_iterator` calls its
|
||||
base-iterator's `operator--()` in most of its members before doing the work
|
||||
that the member requires.
|
||||
That seems nicer in that there is no raw loop, but it has two major drawbacks.
|
||||
First, it requires an unpleasant amount of typing. Second, it is less
|
||||
efficient than forward-iterator `find` , since `std::reverse_iterator` calls
|
||||
its base-iterator's `operator--()` in most of its member functions before
|
||||
doing the work that the member function requires.
|
||||
|
||||
[heading interface]
|
||||
|
||||
template<typename BidiIter, typename T>
|
||||
BidiIter find_backward(BidiIter first, BidiIter last, T const & x);
|
||||
BidiIter find_backward(BidiIter first, BidiIter last, const T & x);
|
||||
|
||||
template<typename Range, typename T>
|
||||
boost::range_iterator<Range> find_backward(Range & range, T const & x);
|
||||
boost::range_iterator<Range> find_backward(Range & range, const T & x);
|
||||
|
||||
The function `find_backward` returns an iterator to the last element that is
|
||||
equal to `x` in `[first, last)` or `r`, respectively.
|
||||
These overloads of `find_backward` return an iterator to the last element that
|
||||
is equal to `x` in `[first, last)` or `r`, respectively.
|
||||
|
||||
template<typename BidiIter, typename T>
|
||||
BidiIter find_not_backward(BidiIter first, BidiIter last, T const & x);
|
||||
BidiIter find_not_backward(BidiIter first, BidiIter last, const T & x);
|
||||
|
||||
template<typename Range, typename T>
|
||||
boost::range_iterator<Range> find_not_backward(Range & range, T const & x);
|
||||
boost::range_iterator<Range> find_not_backward(Range & range, const T & x);
|
||||
|
||||
The function `find_not_backward` returns an iterator to the last element that
|
||||
is not equal to `x` in `[first, last)` or `r`, respectively.
|
||||
These overloads of `find_not_backward` return an iterator to the last element
|
||||
that is not equal to `x` in `[first, last)` or `r`, respectively.
|
||||
|
||||
template<typename BidiIter, typename Pred>
|
||||
BidiIter find_if_backward(BidiIter first, BidiIter last, Pred p);
|
||||
@ -63,8 +63,8 @@ is not equal to `x` in `[first, last)` or `r`, respectively.
|
||||
template<typename Range, typename Pred>
|
||||
boost::range_iterator<Range> find_if_backward(Range & range, Pred p);
|
||||
|
||||
The function `find_if_backward` returns an iterator to the last element for
|
||||
which `pred` returns `true` in `[first, last)` or `r`, respectively.
|
||||
These overloads of `find_if_backward` return an iterator to the last element
|
||||
for which `pred` returns `true` in `[first, last)` or `r`, respectively.
|
||||
|
||||
template<typename BidiIter, typename Pred>
|
||||
BidiIter find_if_not_backward(BidiIter first, BidiIter last, Pred p);
|
||||
@ -72,8 +72,9 @@ which `pred` returns `true` in `[first, last)` or `r`, respectively.
|
||||
template<typename Range, typename Pred>
|
||||
boost::range_iterator<Range> find_if_not_backward(Range & range, Pred p);
|
||||
|
||||
The function `find_if_not_backward` returns an iterator to the last element
|
||||
for which `pred` returns `false` in `[first, last)` or `r`, respectively.
|
||||
These overloads of `find_if_not_backward` return an iterator to the last
|
||||
element for which `pred` returns `false` in `[first, last)` or `r`,
|
||||
respectively.
|
||||
|
||||
[heading Examples]
|
||||
|
||||
|
Reference in New Issue
Block a user