From Jason Turner

[alg.find.last]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmp6cnfxjty/{from.md → to.md} +37 -0
tmp/tmp6cnfxjty/{from.md → to.md} RENAMED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ### Find last <a id="alg.find.last">[[alg.find.last]]</a>
2
+
3
+ ``` cpp
4
+ template<forward_iterator I, sentinel_for<I> S, class T, class Proj = identity>
5
+ requires indirect_binary_predicate<ranges::equal_to, projected<I, Proj>, const T*>
6
+ constexpr subrange<I> ranges::find_last(I first, S last, const T& value, Proj proj = {});
7
+ template<forward_range R, class T, class Proj = identity>
8
+ requires indirect_binary_predicate<ranges::equal_to, projected<iterator_t<R>, Proj>, const T*>
9
+ constexpr borrowed_subrange_t<R> ranges::find_last(R&& r, const T& value, Proj proj = {});
10
+ template<forward_iterator I, sentinel_for<I> S, class Proj = identity,
11
+ indirect_unary_predicate<projected<I, Proj>> Pred>
12
+ constexpr subrange<I> ranges::find_last_if(I first, S last, Pred pred, Proj proj = {});
13
+ template<forward_range R, class Proj = identity,
14
+ indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
15
+ constexpr borrowed_subrange_t<R> ranges::find_last_if(R&& r, Pred pred, Proj proj = {});
16
+ template<forward_iterator I, sentinel_for<I> S, class Proj = identity,
17
+ indirect_unary_predicate<projected<I, Proj>> Pred>
18
+ constexpr subrange<I> ranges::find_last_if_not(I first, S last, Pred pred, Proj proj = {});
19
+ template<forward_range R, class Proj = identity,
20
+ indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
21
+ constexpr borrowed_subrange_t<R> ranges::find_last_if_not(R&& r, Pred pred, Proj proj = {});
22
+ ```
23
+
24
+ Let E be:
25
+
26
+ - `bool(invoke(proj, *i) == value)` for `ranges::find_last`;
27
+ - `bool(invoke(pred, invoke(proj, *i)))` for `ranges::find_last_if`;
28
+ - `bool(!invoke(pred, invoke(proj, *i)))` for
29
+ `ranges::find_last_if_not`.
30
+
31
+ *Returns:* Let `i` be the last iterator in the range \[`first`, `last`)
32
+ for which E is `true`. Returns `{i, last}`, or `{last, last}` if no such
33
+ iterator is found.
34
+
35
+ *Complexity:* At most `last - first` applications of the corresponding
36
+ predicate and projection.
37
+