From Jason Turner

[set.intersection]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpp0o5hfbh/{from.md → to.md} +35 -6
tmp/tmpp0o5hfbh/{from.md → to.md} RENAMED
@@ -40,29 +40,58 @@ template<input_range R1, input_range R2, weakly_incrementable O,
40
  class Comp = ranges::less, class Proj1 = identity, class Proj2 = identity>
41
  requires mergeable<iterator_t<R1>, iterator_t<R2>, O, Comp, Proj1, Proj2>
42
  constexpr ranges::set_intersection_result<borrowed_iterator_t<R1>, borrowed_iterator_t<R2>, O>
43
  ranges::set_intersection(R1&& r1, R2&& r2, O result,
44
  Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {});
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
45
  ```
46
 
47
- Let `comp` be `less{}`, and `proj1` and `proj2` be `identity{}` for the
48
- overloads with no parameters by those names.
 
 
 
 
 
 
 
49
 
50
  *Preconditions:* The ranges \[`first1`, `last1`) and \[`first2`,
51
  `last2`) are sorted with respect to `comp` and `proj1` or `proj2`,
52
  respectively. The resulting range does not overlap with either of the
53
  original ranges.
54
 
55
- *Effects:* Constructs a sorted intersection of the elements from the two
56
  ranges; that is, the set of elements that are present in both of the
57
  ranges.
58
 
59
- *Returns:* Let `result_last` be the end of the constructed range.
60
- Returns
61
 
62
  - `result_last` for the overloads in namespace `std`.
63
- - `{last1, last2, result_last}` for the overloads in namespace `ranges`.
 
 
 
 
 
64
 
65
  *Complexity:* At most `2 * ((last1 - first1) + (last2 - first2)) - 1`
66
  comparisons and applications of each projection.
67
 
68
  *Remarks:* Stable [[algorithm.stable]]. If \[`first1`, `last1`) contains
 
40
  class Comp = ranges::less, class Proj1 = identity, class Proj2 = identity>
41
  requires mergeable<iterator_t<R1>, iterator_t<R2>, O, Comp, Proj1, Proj2>
42
  constexpr ranges::set_intersection_result<borrowed_iterator_t<R1>, borrowed_iterator_t<R2>, O>
43
  ranges::set_intersection(R1&& r1, R2&& r2, O result,
44
  Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {});
45
+
46
+ template<execution-policy Ep, random_access_iterator I1, sized_sentinel_for<I1> S1,
47
+ random_access_iterator I2, sized_sentinel_for<I2> S2,
48
+ random_access_iterator O, sized_sentinel_for<O> OutS, class Comp = ranges::less,
49
+ class Proj1 = identity, class Proj2 = identity>
50
+ requires mergeable<I1, I2, O, Comp, Proj1, Proj2>
51
+ ranges::set_intersection_result<I1, I2, O>
52
+ ranges::set_intersection(Ep&& exec, I1 first1, S1 last1,
53
+ I2 first2, S2 last2, O result, OutS result_last,
54
+ Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {});
55
+ template<execution-policy Ep, sized-random-access-range R1, sized-random-access-range R2,
56
+ sized-random-access-range OutR, class Comp = ranges::less,
57
+ class Proj1 = identity, class Proj2 = identity>
58
+ requires mergeable<iterator_t<R1>, iterator_t<R2>, iterator_t<OutR>, Comp, Proj1, Proj2>
59
+ ranges::set_intersection_result<borrowed_iterator_t<R1>, borrowed_iterator_t<R2>,
60
+ borrowed_iterator_t<OutR>>
61
+ ranges::set_intersection(Ep&& exec, R1&& r1, R2&& r2, OutR&& result_r, Comp comp = {},
62
+ Proj1 proj1 = {}, Proj2 proj2 = {});
63
  ```
64
 
65
+ Let:
66
+
67
+ - `comp` be `less{}`, and `proj1` and `proj2` be `identity{}` for the
68
+ overloads with no parameters by those names;
69
+ - M be the number of elements in \[`first1`, `last1`) that are present
70
+ in \[`first2`, `last2`);
71
+ - `result_last` be `result + `M for the overloads with no parameter
72
+ `result_last` or `result_r`;
73
+ - N be min(M, `result_last - result`).
74
 
75
  *Preconditions:* The ranges \[`first1`, `last1`) and \[`first2`,
76
  `last2`) are sorted with respect to `comp` and `proj1` or `proj2`,
77
  respectively. The resulting range does not overlap with either of the
78
  original ranges.
79
 
80
+ *Effects:* Constructs a sorted intersection of N elements from the two
81
  ranges; that is, the set of elements that are present in both of the
82
  ranges.
83
 
84
+ *Returns:*
 
85
 
86
  - `result_last` for the overloads in namespace `std`.
87
+ - `{last1, last2, result + `N`}` for the overloads in namespace
88
+ `ranges`, if N is equal to M.
89
+ - Otherwise, `{j1, j2, result_last}` for the overloads in namespace
90
+ `ranges`, where the iterators `j1` and `j2` point to positions past
91
+ the last copied or skipped elements in \[`first1`, `last1`) and
92
+ \[`first2`, `last2`), respectively.
93
 
94
  *Complexity:* At most `2 * ((last1 - first1) + (last2 - first2)) - 1`
95
  comparisons and applications of each projection.
96
 
97
  *Remarks:* Stable [[algorithm.stable]]. If \[`first1`, `last1`) contains