find_{not,*backward} docs copy editing.

This commit is contained in:
Zach Laine
2018-05-12 16:47:47 -05:00
parent c5c5d24ff3
commit 6b2246468e
2 changed files with 27 additions and 28 deletions

View File

@ -23,9 +23,7 @@ the first occurrance of any number besides `1` in `vec`? We have to write an
unfortunate amount of code:
auto std::vector<int> vec = { 1, 1, 2 };
auto it = std::find_if(
vec.begin(), vec.end(),
[](int i) { return i != 1; });
auto it = std::find_if(vec.begin(), vec.end(), [](int i) { return i != 1; });
With `find_not()` the code gets much more terse:
@ -35,18 +33,18 @@ With `find_not()` the code gets much more terse:
The existing `find` variants are: `find()`, `find_if()`, and `find_if_not()`.
It seems natural to also have `find_not()`, for the very reason that we have
`find_if_not()` -- to avoid having to write a lambda to wrap the negation of
our find condition.
the find condition.
[heading interface]
template<typename InputIter, typename Sentinel, typename T>
InputIter find_not(InputIter first, Sentinel last, T const & x);
InputIter find_not(InputIter first, Sentinel last, const T & x);
template<typename Range, typename T>
boost::range_iterator<Range> find_not(Range & r, T const & x);
boost::range_iterator<Range> find_not(Range & r, const T & x);
The function `find_not` returns the first value that is not equal to `x` in
the sequence `[first, last)` or `r`, respectively.
These overloads of `find_not` return the first value that is not equal to `x`
in the sequence `[first, last)` or `r`, respectively.
[heading Examples]
@ -57,7 +55,7 @@ Given the container `c1` containing `{ 0, 1, 2 }`, then
[heading Iterator Requirements]
`equal` works on all iterators except output iterators.
`find_not` works on all iterators except output iterators.
The template parameter `Sentinel` is allowed to be different from `InputIter`,
or they may be the same. For an `InputIter` `it` and a `Sentinel` `end`, `it