From Jason Turner

[alg.find.end]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpnfh6knu7/{from.md → to.md} +35 -10
tmp/tmpnfh6knu7/{from.md → to.md} RENAMED
@@ -1,41 +1,66 @@
1
  ### Find end <a id="alg.find.end">[[alg.find.end]]</a>
2
 
3
  ``` cpp
4
  template<class ForwardIterator1, class ForwardIterator2>
5
- ForwardIterator1
6
  find_end(ForwardIterator1 first1, ForwardIterator1 last1,
7
  ForwardIterator2 first2, ForwardIterator2 last2);
8
  template<class ExecutionPolicy, class ForwardIterator1, class ForwardIterator2>
9
  ForwardIterator1
10
  find_end(ExecutionPolicy&& exec,
11
  ForwardIterator1 first1, ForwardIterator1 last1,
12
  ForwardIterator2 first2, ForwardIterator2 last2);
13
 
14
  template<class ForwardIterator1, class ForwardIterator2,
15
  class BinaryPredicate>
16
- ForwardIterator1
17
  find_end(ForwardIterator1 first1, ForwardIterator1 last1,
18
  ForwardIterator2 first2, ForwardIterator2 last2,
19
  BinaryPredicate pred);
20
  template<class ExecutionPolicy, class ForwardIterator1, class ForwardIterator2,
21
  class BinaryPredicate>
22
  ForwardIterator1
23
  find_end(ExecutionPolicy&& exec,
24
  ForwardIterator1 first1, ForwardIterator1 last1,
25
  ForwardIterator2 first2, ForwardIterator2 last2,
26
  BinaryPredicate pred);
 
 
 
 
 
 
 
 
 
 
 
 
 
27
  ```
28
 
29
- *Effects:* Finds a subsequence of equal values in a sequence.
30
 
31
- *Returns:* The last iterator `i` in the range \[`first1`,
32
- `last1 - (last2 - first2)`) such that for every non-negative integer
33
- `n < (last2 - first2)`, the following corresponding conditions hold:
34
- `*(i + n) == *(first2 + n), pred(*(i + n), *(first2 + n)) != false`.
35
- Returns `last1` if \[`first2`, `last2`) is empty or if no such iterator
36
- is found.
 
 
 
 
 
 
 
 
 
 
 
 
37
 
38
  *Complexity:* At most
39
  `(last2 - first2) * (last1 - first1 - (last2 - first2) + 1)`
40
- applications of the corresponding predicate.
41
 
 
1
  ### Find end <a id="alg.find.end">[[alg.find.end]]</a>
2
 
3
  ``` cpp
4
  template<class ForwardIterator1, class ForwardIterator2>
5
+ constexpr ForwardIterator1
6
  find_end(ForwardIterator1 first1, ForwardIterator1 last1,
7
  ForwardIterator2 first2, ForwardIterator2 last2);
8
  template<class ExecutionPolicy, class ForwardIterator1, class ForwardIterator2>
9
  ForwardIterator1
10
  find_end(ExecutionPolicy&& exec,
11
  ForwardIterator1 first1, ForwardIterator1 last1,
12
  ForwardIterator2 first2, ForwardIterator2 last2);
13
 
14
  template<class ForwardIterator1, class ForwardIterator2,
15
  class BinaryPredicate>
16
+ constexpr ForwardIterator1
17
  find_end(ForwardIterator1 first1, ForwardIterator1 last1,
18
  ForwardIterator2 first2, ForwardIterator2 last2,
19
  BinaryPredicate pred);
20
  template<class ExecutionPolicy, class ForwardIterator1, class ForwardIterator2,
21
  class BinaryPredicate>
22
  ForwardIterator1
23
  find_end(ExecutionPolicy&& exec,
24
  ForwardIterator1 first1, ForwardIterator1 last1,
25
  ForwardIterator2 first2, ForwardIterator2 last2,
26
  BinaryPredicate pred);
27
+
28
+ template<forward_iterator I1, sentinel_for<I1> S1, forward_iterator I2, sentinel_for<I2> S2,
29
+ class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity>
30
+ requires indirectly_comparable<I1, I2, Pred, Proj1, Proj2>
31
+ constexpr subrange<I1>
32
+ ranges::find_end(I1 first1, S1 last1, I2 first2, S2 last2, Pred pred = {},
33
+ Proj1 proj1 = {}, Proj2 proj2 = {});
34
+ template<forward_range R1, forward_range R2,
35
+ class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity>
36
+ requires indirectly_comparable<iterator_t<R1>, iterator_t<R2>, Pred, Proj1, Proj2>
37
+ constexpr borrowed_subrange_t<R1>
38
+ ranges::find_end(R1&& r1, R2&& r2, Pred pred = {},
39
+ Proj1 proj1 = {}, Proj2 proj2 = {});
40
  ```
41
 
42
+ Let:
43
 
44
+ - `pred` be `equal_to{}` for the overloads with no parameter `pred`;
45
+ - E be:
46
+ - `pred(*(i + n), *(first2 + n))` for the overloads in namespace
47
+ `std`;
48
+ - `invoke(pred, invoke(proj1, *(i + n)), invoke(proj2, *(first2 + n)))`
49
+ for the overloads in namespace `ranges`;
50
+ - `i` be `last1` if \[`first2`, `last2`) is empty, or if
51
+ `(last2 - first2) > (last1 - first1)` is `true`, or if there is no
52
+ iterator in the range \[`first1`, `last1 - (last2 - first2)`) such
53
+ that for every non-negative integer `n < (last2 - first2)`, E is
54
+ `true`. Otherwise `i` is the last such iterator in \[`first1`,
55
+ `last1 - (last2 - first2)`).
56
+
57
+ *Returns:*
58
+
59
+ - `i` for the overloads in namespace `std`.
60
+ - `{i, i + (i == last1 ? 0 : last2 - first2)}` for the overloads in
61
+ namespace `ranges`.
62
 
63
  *Complexity:* At most
64
  `(last2 - first2) * (last1 - first1 - (last2 - first2) + 1)`
65
+ applications of the corresponding predicate and any projections.
66