From Jason Turner

[set.difference]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmppiyi6ab0/{from.md → to.md} +29 -6
tmp/tmppiyi6ab0/{from.md → to.md} RENAMED
@@ -1,11 +1,11 @@
1
  #### `set_difference` <a id="set.difference">[[set.difference]]</a>
2
 
3
  ``` cpp
4
  template<class InputIterator1, class InputIterator2,
5
  class OutputIterator>
6
- OutputIterator
7
  set_difference(InputIterator1 first1, InputIterator1 last1,
8
  InputIterator2 first2, InputIterator2 last2,
9
  OutputIterator result);
10
  template<class ExecutionPolicy, class ForwardIterator1, class ForwardIterator2,
11
  class ForwardIterator>
@@ -15,35 +15,58 @@ template<class ExecutionPolicy, class ForwardIterator1, class ForwardIterator2,
15
  ForwardIterator2 first2, ForwardIterator2 last2,
16
  ForwardIterator result);
17
 
18
  template<class InputIterator1, class InputIterator2,
19
  class OutputIterator, class Compare>
20
- OutputIterator
21
  set_difference(InputIterator1 first1, InputIterator1 last1,
22
  InputIterator2 first2, InputIterator2 last2,
23
  OutputIterator result, Compare comp);
24
  template<class ExecutionPolicy, class ForwardIterator1, class ForwardIterator2,
25
  class ForwardIterator, class Compare>
26
  ForwardIterator
27
  set_difference(ExecutionPolicy&& exec,
28
  ForwardIterator1 first1, ForwardIterator1 last1,
29
  ForwardIterator2 first2, ForwardIterator2 last2,
30
  ForwardIterator result, Compare comp);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
31
  ```
32
 
33
- *Requires:* The resulting range shall not overlap with either of the
 
 
 
 
 
34
  original ranges.
35
 
36
  *Effects:* Copies the elements of the range \[`first1`, `last1`) which
37
  are not present in the range \[`first2`, `last2`) to the range beginning
38
  at `result`. The elements in the constructed range are sorted.
39
 
40
- *Returns:* The end of the constructed range.
 
 
 
 
41
 
42
  *Complexity:* At most `2 * ((last1 - first1) + (last2 - first2)) - 1`
43
- comparisons.
44
 
45
  *Remarks:* If \[`first1`, `last1`) contains m elements that are
46
  equivalent to each other and \[`first2`, `last2`) contains n elements
47
  that are equivalent to them, the last max(m - n, 0) elements from
48
- \[`first1`, `last1`) shall be copied to the output range.
49
 
 
1
  #### `set_difference` <a id="set.difference">[[set.difference]]</a>
2
 
3
  ``` cpp
4
  template<class InputIterator1, class InputIterator2,
5
  class OutputIterator>
6
+ constexpr OutputIterator
7
  set_difference(InputIterator1 first1, InputIterator1 last1,
8
  InputIterator2 first2, InputIterator2 last2,
9
  OutputIterator result);
10
  template<class ExecutionPolicy, class ForwardIterator1, class ForwardIterator2,
11
  class ForwardIterator>
 
15
  ForwardIterator2 first2, ForwardIterator2 last2,
16
  ForwardIterator result);
17
 
18
  template<class InputIterator1, class InputIterator2,
19
  class OutputIterator, class Compare>
20
+ constexpr OutputIterator
21
  set_difference(InputIterator1 first1, InputIterator1 last1,
22
  InputIterator2 first2, InputIterator2 last2,
23
  OutputIterator result, Compare comp);
24
  template<class ExecutionPolicy, class ForwardIterator1, class ForwardIterator2,
25
  class ForwardIterator, class Compare>
26
  ForwardIterator
27
  set_difference(ExecutionPolicy&& exec,
28
  ForwardIterator1 first1, ForwardIterator1 last1,
29
  ForwardIterator2 first2, ForwardIterator2 last2,
30
  ForwardIterator result, Compare comp);
31
+
32
+ template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2,
33
+ weakly_incrementable O, class Comp = ranges::less,
34
+ class Proj1 = identity, class Proj2 = identity>
35
+ requires mergeable<I1, I2, O, Comp, Proj1, Proj2>
36
+ constexpr ranges::set_difference_result<I1, O>
37
+ ranges::set_difference(I1 first1, S1 last1, I2 first2, S2 last2, O result,
38
+ Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {});
39
+ 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_difference_result<borrowed_iterator_t<R1>, O>
43
+ ranges::set_difference(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:* Copies the elements of the range \[`first1`, `last1`) which
56
  are not present in the range \[`first2`, `last2`) to the range beginning
57
  at `result`. The elements in the constructed range are sorted.
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, 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:* If \[`first1`, `last1`) contains m elements that are
69
  equivalent to each other and \[`first2`, `last2`) contains n elements
70
  that are equivalent to them, the last max(m - n, 0) elements from
71
+ \[`first1`, `last1`) is copied to the output range, in order.
72