From Jason Turner

[alg.equal]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpi5xrknx6/{from.md → to.md} +43 -24
tmp/tmpi5xrknx6/{from.md → to.md} RENAMED
@@ -1,67 +1,86 @@
1
  ### Equal <a id="alg.equal">[[alg.equal]]</a>
2
 
3
  ``` cpp
4
  template<class InputIterator1, class InputIterator2>
5
- bool equal(InputIterator1 first1, InputIterator1 last1,
6
  InputIterator2 first2);
7
  template<class ExecutionPolicy, class ForwardIterator1, class ForwardIterator2>
8
  bool equal(ExecutionPolicy&& exec,
9
  ForwardIterator1 first1, ForwardIterator1 last1,
10
  ForwardIterator2 first2);
11
 
12
  template<class InputIterator1, class InputIterator2,
13
  class BinaryPredicate>
14
- bool equal(InputIterator1 first1, InputIterator1 last1,
15
  InputIterator2 first2, BinaryPredicate pred);
16
  template<class ExecutionPolicy, class ForwardIterator1, class ForwardIterator2,
17
  class BinaryPredicate>
18
  bool equal(ExecutionPolicy&& exec,
19
  ForwardIterator1 first1, ForwardIterator1 last1,
20
  ForwardIterator2 first2, BinaryPredicate pred);
21
 
22
  template<class InputIterator1, class InputIterator2>
23
- bool equal(InputIterator1 first1, InputIterator1 last1,
24
  InputIterator2 first2, InputIterator2 last2);
25
  template<class ExecutionPolicy, class ForwardIterator1, class ForwardIterator2>
26
  bool equal(ExecutionPolicy&& exec,
27
  ForwardIterator1 first1, ForwardIterator1 last1,
28
  ForwardIterator2 first2, ForwardIterator2 last2);
29
 
30
  template<class InputIterator1, class InputIterator2,
31
  class BinaryPredicate>
32
- bool equal(InputIterator1 first1, InputIterator1 last1,
33
  InputIterator2 first2, InputIterator2 last2,
34
  BinaryPredicate pred);
35
  template<class ExecutionPolicy, class ForwardIterator1, class ForwardIterator2,
36
  class BinaryPredicate>
37
  bool equal(ExecutionPolicy&& exec,
38
  ForwardIterator1 first1, ForwardIterator1 last1,
39
  ForwardIterator2 first2, ForwardIterator2 last2,
40
  BinaryPredicate pred);
 
 
 
 
 
 
 
 
 
 
 
 
41
  ```
42
 
43
- *Remarks:* If `last2` was not given in the argument list, it denotes
44
- `first2 + (last1 - first1)` below.
 
 
 
 
 
 
 
 
45
 
46
  *Returns:* If `last1 - first1 != last2 - first2`, return `false`.
47
- Otherwise return `true` if for every iterator `i` in the range
48
- \[`first1`, `last1`) the following corresponding conditions hold:
49
- `*i == *(first2 + (i - first1)), pred(*i, *(first2 + (i - first1))) != false`.
50
- Otherwise, returns `false`.
51
 
52
- *Complexity:*
53
 
54
- - For the overloads with no `ExecutionPolicy`,
55
- - if `InputIterator1` and `InputIterator2` meet the requirements of
56
- random access iterators ([[random.access.iterators]]) and
57
- `last1 - first1 != last2 - first2`, then no applications of the
58
- corresponding predicate; otherwise,
59
- - at most min(`last1 - first1`, `last2 - first2`) applications of the
60
- corresponding predicate.
61
- - For the overloads with no `ExecutionPolicy`,
62
- - if `ForwardIterator1` and `ForwardIterator2` meet the requirements
63
- of random access iterators and `last1 - first1 != last2 - first2`,
64
- then no applications of the corresponding predicate; otherwise,
65
- - 𝑂(min(`last1 - first1`, `last2 - first2`)) applications of the
66
- corresponding predicate.
 
67
 
 
1
  ### Equal <a id="alg.equal">[[alg.equal]]</a>
2
 
3
  ``` cpp
4
  template<class InputIterator1, class InputIterator2>
5
+ constexpr bool equal(InputIterator1 first1, InputIterator1 last1,
6
  InputIterator2 first2);
7
  template<class ExecutionPolicy, class ForwardIterator1, class ForwardIterator2>
8
  bool equal(ExecutionPolicy&& exec,
9
  ForwardIterator1 first1, ForwardIterator1 last1,
10
  ForwardIterator2 first2);
11
 
12
  template<class InputIterator1, class InputIterator2,
13
  class BinaryPredicate>
14
+ constexpr bool equal(InputIterator1 first1, InputIterator1 last1,
15
  InputIterator2 first2, BinaryPredicate pred);
16
  template<class ExecutionPolicy, class ForwardIterator1, class ForwardIterator2,
17
  class BinaryPredicate>
18
  bool equal(ExecutionPolicy&& exec,
19
  ForwardIterator1 first1, ForwardIterator1 last1,
20
  ForwardIterator2 first2, BinaryPredicate pred);
21
 
22
  template<class InputIterator1, class InputIterator2>
23
+ constexpr bool equal(InputIterator1 first1, InputIterator1 last1,
24
  InputIterator2 first2, InputIterator2 last2);
25
  template<class ExecutionPolicy, class ForwardIterator1, class ForwardIterator2>
26
  bool equal(ExecutionPolicy&& exec,
27
  ForwardIterator1 first1, ForwardIterator1 last1,
28
  ForwardIterator2 first2, ForwardIterator2 last2);
29
 
30
  template<class InputIterator1, class InputIterator2,
31
  class BinaryPredicate>
32
+ constexpr bool equal(InputIterator1 first1, InputIterator1 last1,
33
  InputIterator2 first2, InputIterator2 last2,
34
  BinaryPredicate pred);
35
  template<class ExecutionPolicy, class ForwardIterator1, class ForwardIterator2,
36
  class BinaryPredicate>
37
  bool equal(ExecutionPolicy&& exec,
38
  ForwardIterator1 first1, ForwardIterator1 last1,
39
  ForwardIterator2 first2, ForwardIterator2 last2,
40
  BinaryPredicate pred);
41
+
42
+ template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2,
43
+ class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity>
44
+ requires indirectly_comparable<I1, I2, Pred, Proj1, Proj2>
45
+ constexpr bool ranges::equal(I1 first1, S1 last1, I2 first2, S2 last2,
46
+ Pred pred = {},
47
+ Proj1 proj1 = {}, Proj2 proj2 = {});
48
+ template<input_range R1, input_range R2, class Pred = ranges::equal_to,
49
+ class Proj1 = identity, class Proj2 = identity>
50
+ requires indirectly_comparable<iterator_t<R1>, iterator_t<R2>, Pred, Proj1, Proj2>
51
+ constexpr bool ranges::equal(R1&& r1, R2&& r2, Pred pred = {},
52
+ Proj1 proj1 = {}, Proj2 proj2 = {});
53
  ```
54
 
55
+ Let:
56
+
57
+ - `last2` be `first2 + (last1 - first1)` for the overloads with no
58
+ parameter `last2` or `r2`;
59
+ - `pred` be `equal_to{}` for the overloads with no parameter `pred`;
60
+ - E be:
61
+ - `pred(*i, *(first2 + (i - first1)))` for the overloads with no
62
+ parameter `proj1`;
63
+ - `invoke(pred, invoke(proj1, *i), invoke(proj2, *(first2 + (i - first1))))`
64
+ for the overloads with parameter `proj1`.
65
 
66
  *Returns:* If `last1 - first1 != last2 - first2`, return `false`.
67
+ Otherwise return `true` if E holds for every iterator `i` in the range
68
+ \[`first1`, `last1`) Otherwise, returns `false`.
 
 
69
 
70
+ *Complexity:* If the types of `first1`, `last1`, `first2`, and `last2`:
71
 
72
+ - meet the *Cpp17RandomAccessIterator*
73
+ requirements [[random.access.iterators]] for the overloads in
74
+ namespace `std`;
75
+ - pairwise model `sized_sentinel_for` [[iterator.concept.sizedsentinel]]
76
+ for the overloads in namespace `ranges`,
77
+
78
+ and `last1 - first1 != last2 - first2`, then no applications of the
79
+ corresponding predicate and each projection; otherwise,
80
+
81
+ - For the overloads with no `ExecutionPolicy`, at most
82
+ min(`last1 - first1`, `last2 - first2`) applications of the
83
+ corresponding predicate and any projections.
84
+ - For the overloads with an `ExecutionPolicy`, 𝑂(min(`last1 - first1`,
85
+  `last2 - first2`)) applications of the corresponding predicate.
86