From Jason Turner

[set.symmetric.difference]

Diff to HTML by rtfpessoa

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