From Jason Turner

[alg.mismatch]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmp7846g9m1/{from.md → to.md} +97 -0
tmp/tmp7846g9m1/{from.md → to.md} RENAMED
@@ -0,0 +1,97 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ### Mismatch <a id="alg.mismatch">[[alg.mismatch]]</a>
2
+
3
+ ``` cpp
4
+ template<class InputIterator1, class InputIterator2>
5
+ constexpr pair<InputIterator1, InputIterator2>
6
+ mismatch(InputIterator1 first1, InputIterator1 last1,
7
+ InputIterator2 first2);
8
+ template<class ExecutionPolicy, class ForwardIterator1, class ForwardIterator2>
9
+ pair<ForwardIterator1, ForwardIterator2>
10
+ mismatch(ExecutionPolicy&& exec,
11
+ ForwardIterator1 first1, ForwardIterator1 last1,
12
+ ForwardIterator2 first2);
13
+
14
+ template<class InputIterator1, class InputIterator2,
15
+ class BinaryPredicate>
16
+ constexpr pair<InputIterator1, InputIterator2>
17
+ mismatch(InputIterator1 first1, InputIterator1 last1,
18
+ InputIterator2 first2, BinaryPredicate pred);
19
+ template<class ExecutionPolicy, class ForwardIterator1, class ForwardIterator2,
20
+ class BinaryPredicate>
21
+ pair<ForwardIterator1, ForwardIterator2>
22
+ mismatch(ExecutionPolicy&& exec,
23
+ ForwardIterator1 first1, ForwardIterator1 last1,
24
+ ForwardIterator2 first2, BinaryPredicate pred);
25
+
26
+ template<class InputIterator1, class InputIterator2>
27
+ constexpr pair<InputIterator1, InputIterator2>
28
+ mismatch(InputIterator1 first1, InputIterator1 last1,
29
+ InputIterator2 first2, InputIterator2 last2);
30
+ template<class ExecutionPolicy, class ForwardIterator1, class ForwardIterator2>
31
+ pair<ForwardIterator1, ForwardIterator2>
32
+ mismatch(ExecutionPolicy&& exec,
33
+ ForwardIterator1 first1, ForwardIterator1 last1,
34
+ ForwardIterator2 first2, ForwardIterator2 last2);
35
+
36
+ template<class InputIterator1, class InputIterator2,
37
+ class BinaryPredicate>
38
+ constexpr pair<InputIterator1, InputIterator2>
39
+ mismatch(InputIterator1 first1, InputIterator1 last1,
40
+ InputIterator2 first2, InputIterator2 last2,
41
+ BinaryPredicate pred);
42
+ template<class ExecutionPolicy, class ForwardIterator1, class ForwardIterator2,
43
+ class BinaryPredicate>
44
+ pair<ForwardIterator1, ForwardIterator2>
45
+ mismatch(ExecutionPolicy&& exec,
46
+ ForwardIterator1 first1, ForwardIterator1 last1,
47
+ ForwardIterator2 first2, ForwardIterator2 last2,
48
+ BinaryPredicate pred);
49
+
50
+ template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2,
51
+ class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity>
52
+ requires indirectly_comparable<I1, I2, Pred, Proj1, Proj2>
53
+ constexpr ranges::mismatch_result<I1, I2>
54
+ ranges::mismatch(I1 first1, S1 last1, I2 first2, S2 last2, Pred pred = {},
55
+ Proj1 proj1 = {}, Proj2 proj2 = {});
56
+ template<input_range R1, input_range R2,
57
+ class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity>
58
+ requires indirectly_comparable<iterator_t<R1>, iterator_t<R2>, Pred, Proj1, Proj2>
59
+ constexpr ranges::mismatch_result<borrowed_iterator_t<R1>, borrowed_iterator_t<R2>>
60
+ ranges::mismatch(R1&& r1, R2&& r2, Pred pred = {},
61
+ Proj1 proj1 = {}, Proj2 proj2 = {});
62
+
63
+ template<execution-policy Ep, random_access_iterator I1, sized_sentinel_for<I1> S1,
64
+ random_access_iterator I2, sized_sentinel_for<I2> S2,
65
+ class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity>
66
+ requires indirectly_comparable<I1, I2, Pred, Proj1, Proj2>
67
+ ranges::mismatch_result<I1, I2>
68
+ ranges::mismatch(Ep&& exec, I1 first1, S1 last1, I2 first2, S2 last2, Pred pred = {},
69
+ Proj1 proj1 = {}, Proj2 proj2 = {});
70
+ template<execution-policy Ep, sized-random-access-range R1, sized-random-access-range R2,
71
+ class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity>
72
+ requires indirectly_comparable<iterator_t<R1>, iterator_t<R2>, Pred, Proj1, Proj2>
73
+ ranges::mismatch_result<borrowed_iterator_t<R1>, borrowed_iterator_t<R2>>
74
+ ranges::mismatch(Ep&& exec, R1&& r1, R2&& r2, Pred pred = {},
75
+ Proj1 proj1 = {}, Proj2 proj2 = {});
76
+ ```
77
+
78
+ Let `last2` be `first2 + (last1 - first1)` for the overloads in
79
+ namespace `std` with no parameter `last2`.
80
+
81
+ Let E be:
82
+
83
+ - `!(*(first1 + n) == *(first2 + n))` for the overloads with no
84
+ parameter `pred`;
85
+ - `pred(*(first1 + n), *(first2 + n)) == false` for the overloads with a
86
+ parameter `pred` and no parameter `proj1`;
87
+ - `!invoke(pred, invoke(proj1, *(first1 + n)), invoke(proj2, *(first2 + n)))`
88
+ for the overloads with both parameters `pred` and `proj1`.
89
+
90
+ Let N be min(`last1 - first1`, `last2 - first2`).
91
+
92
+ *Returns:* `{ first1 + n, first2 + n }`, where `n` is the smallest
93
+ integer in \[`0`, N) such that E holds, or N if no such integer exists.
94
+
95
+ *Complexity:* At most N applications of the corresponding predicate and
96
+ any projections.
97
+