From Jason Turner

[set.union]

Diff to HTML by rtfpessoa

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