Add range-based overloads of find*_backward().

This commit is contained in:
Zach Laine
2018-05-12 16:03:41 -05:00
parent 6c68cf8624
commit c5c5d24ff3
4 changed files with 163 additions and 15 deletions

View File

@ -42,26 +42,38 @@ that the member requires.
template<typename BidiIter, typename T>
BidiIter find_backward(BidiIter first, BidiIter last, T const & x);
The function `find_backward` returns an iterator to the last element of
`[first, last)` that is equal to `x`.
template<typename Range, typename T>
boost::range_iterator<Range> find_backward(Range & range, T const & x);
The function `find_backward` returns 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);
The function `find_not_backward` returns an iterator to the last element of
`[first, last)` that is not equal to `x`.
template<typename Range, typename T>
boost::range_iterator<Range> find_not_backward(Range & range, T const & 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.
template<typename BidiIter, typename Pred>
BidiIter find_if_backward(BidiIter first, BidiIter last, Pred p);
The function `find_if_backward` returns an iterator to the last element of
`[first, last)` for which `pred` returns `true`.
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.
template<typename BidiIter, typename Pred>
BidiIter find_if_not_backward(BidiIter first, BidiIter last, Pred p);
The function `find_if_not_backward` returns an iterator to the last element of
`[first, last)` for which `pred` returns `false`.
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.
[heading Examples]
@ -90,6 +102,10 @@ All of the variants take their parameters by value and do not depend upon any
global state. Therefore, all the routines in this file provide the strong
exception guarantee.
[heading Notes]
All variants are `constexpr` in C++14 or later.
[endsect]
[/ File equal.qbk

View File

@ -43,10 +43,10 @@ our find condition.
InputIter find_not(InputIter first, Sentinel last, T const & x);
template<typename Range, typename T>
typename boost::range_iterator<Range>::type find_not(Range & r, T const & x);
boost::range_iterator<Range> find_not(Range & r, T const & x);
The function `find_not` returns the first value in the sequence `[first,
last)` that is not equal to `x`.
The function `find_not` returns the first value that is not equal to `x` in
the sequence `[first, last)` or `r`, respectively.
[heading Examples]
@ -72,6 +72,10 @@ Linear.
`find_not` takes its parameters by value and do not depend upon any global
state. Therefore, it provides the strong exception guarantee.
[heading Notes]
`constexpr` in C++14 or later.
[endsect]
[/ File equal.qbk