From Jason Turner

[set.intersection]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpx218j90m/{from.md → to.md} +32 -9
tmp/tmpx218j90m/{from.md → to.md} RENAMED
@@ -1,11 +1,11 @@
1
  #### `set_intersection` <a id="set.intersection">[[set.intersection]]</a>
2
 
3
  ``` cpp
4
  template<class InputIterator1, class InputIterator2,
5
  class OutputIterator>
6
- OutputIterator
7
  set_intersection(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_intersection(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_intersection(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:* Constructs a sorted intersection of the elements from the two
37
  ranges; that is, the set of elements that are present in both of the
38
  ranges.
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 first min(m, n) elements shall be
48
- copied from the first range to the output range, in order.
49
 
 
1
  #### `set_intersection` <a id="set.intersection">[[set.intersection]]</a>
2
 
3
  ``` cpp
4
  template<class InputIterator1, class InputIterator2,
5
  class OutputIterator>
6
+ constexpr OutputIterator
7
  set_intersection(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_intersection(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_intersection(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_intersection_result<I1, I2, O>
37
+ ranges::set_intersection(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_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
69
+ m elements that are equivalent to each other and \[`first2`, `last2`)
70
+ contains n elements that are equivalent to them, the first min(m, n)
71
+ elements are copied from the first range to the output range, in order.
72