From Jason Turner

[alg.find.first.of]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpfliamg25/{from.md → to.md} +28 -7
tmp/tmpfliamg25/{from.md → to.md} RENAMED
@@ -1,39 +1,60 @@
1
  ### Find first <a id="alg.find.first.of">[[alg.find.first.of]]</a>
2
 
3
  ``` cpp
4
  template<class InputIterator, class ForwardIterator>
5
- InputIterator
6
  find_first_of(InputIterator first1, InputIterator last1,
7
  ForwardIterator first2, ForwardIterator last2);
8
  template<class ExecutionPolicy, class ForwardIterator1, class ForwardIterator2>
9
  ForwardIterator1
10
  find_first_of(ExecutionPolicy&& exec,
11
  ForwardIterator1 first1, ForwardIterator1 last1,
12
  ForwardIterator2 first2, ForwardIterator2 last2);
13
 
14
  template<class InputIterator, class ForwardIterator,
15
  class BinaryPredicate>
16
- InputIterator
17
  find_first_of(InputIterator first1, InputIterator last1,
18
  ForwardIterator first2, ForwardIterator last2,
19
  BinaryPredicate pred);
20
  template<class ExecutionPolicy, class ForwardIterator1, class ForwardIterator2,
21
  class BinaryPredicate>
22
  ForwardIterator1
23
  find_first_of(ExecutionPolicy&& exec,
24
  ForwardIterator1 first1, ForwardIterator1 last1,
25
  ForwardIterator2 first2, ForwardIterator2 last2,
26
  BinaryPredicate pred);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
27
  ```
28
 
 
 
 
 
 
 
 
 
29
  *Effects:* Finds an element that matches one of a set of values.
30
 
31
  *Returns:* The first iterator `i` in the range \[`first1`, `last1`) such
32
- that for some iterator `j` in the range \[`first2`, `last2`) the
33
- following conditions hold: `*i == *j, pred(*i,*j) != false`. Returns
34
- `last1` if \[`first2`, `last2`) is empty or if no such iterator is
35
- found.
36
 
37
  *Complexity:* At most `(last1-first1) * (last2-first2)` applications of
38
- the corresponding predicate.
39
 
 
1
  ### Find first <a id="alg.find.first.of">[[alg.find.first.of]]</a>
2
 
3
  ``` cpp
4
  template<class InputIterator, class ForwardIterator>
5
+ constexpr InputIterator
6
  find_first_of(InputIterator first1, InputIterator last1,
7
  ForwardIterator first2, ForwardIterator last2);
8
  template<class ExecutionPolicy, class ForwardIterator1, class ForwardIterator2>
9
  ForwardIterator1
10
  find_first_of(ExecutionPolicy&& exec,
11
  ForwardIterator1 first1, ForwardIterator1 last1,
12
  ForwardIterator2 first2, ForwardIterator2 last2);
13
 
14
  template<class InputIterator, class ForwardIterator,
15
  class BinaryPredicate>
16
+ constexpr InputIterator
17
  find_first_of(InputIterator first1, InputIterator last1,
18
  ForwardIterator first2, ForwardIterator last2,
19
  BinaryPredicate pred);
20
  template<class ExecutionPolicy, class ForwardIterator1, class ForwardIterator2,
21
  class BinaryPredicate>
22
  ForwardIterator1
23
  find_first_of(ExecutionPolicy&& exec,
24
  ForwardIterator1 first1, ForwardIterator1 last1,
25
  ForwardIterator2 first2, ForwardIterator2 last2,
26
  BinaryPredicate pred);
27
+
28
+ template<input_iterator I1, sentinel_for<I1> S1, forward_iterator I2, sentinel_for<I2> S2,
29
+ class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity>
30
+ requires indirectly_comparable<I1, I2, Pred, Proj1, Proj2>
31
+ constexpr I1 ranges::find_first_of(I1 first1, S1 last1, I2 first2, S2 last2,
32
+ Pred pred = {},
33
+ Proj1 proj1 = {}, Proj2 proj2 = {});
34
+ template<input_range R1, forward_range R2,
35
+ class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity>
36
+ requires indirectly_comparable<iterator_t<R1>, iterator_t<R2>, Pred, Proj1, Proj2>
37
+ constexpr borrowed_iterator_t<R1>
38
+ ranges::find_first_of(R1&& r1, R2&& r2,
39
+ Pred pred = {},
40
+ Proj1 proj1 = {}, Proj2 proj2 = {});
41
  ```
42
 
43
+ Let E be:
44
+
45
+ - `*i == *j` for the overloads with no parameter `pred`;
46
+ - `pred(*i, *j) != false` for the overloads with a parameter `pred` and
47
+ no parameter `proj1`;
48
+ - `bool(invoke(pred, invoke(proj1, *i), invoke(proj2, *j)))` for the
49
+ overloads with parameters `pred` and `proj1`.
50
+
51
  *Effects:* Finds an element that matches one of a set of values.
52
 
53
  *Returns:* The first iterator `i` in the range \[`first1`, `last1`) such
54
+ that for some iterator `j` in the range \[`first2`, `last2`) E holds.
55
+ Returns `last1` if \[`first2`, `last2`) is empty or if no such iterator
56
+ is found.
 
57
 
58
  *Complexity:* At most `(last1-first1) * (last2-first2)` applications of
59
+ the corresponding predicate and any projections.
60