From Jason Turner

[alg.foreach]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpkh_zt5k_/{from.md → to.md} +13 -17
tmp/tmpkh_zt5k_/{from.md → to.md} RENAMED
@@ -14,11 +14,11 @@ requirements ([[cpp17.moveconstructible]]).
14
  *Effects:* Applies `f` to the result of dereferencing every iterator in
15
  the range \[`first`, `last`), starting from `first` and proceeding to
16
  `last - 1`.
17
 
18
  [*Note 2*: If the type of `first` meets the requirements of a mutable
19
- iterator, `f` may apply non-constant functions through the dereferenced
20
  iterator. — *end note*]
21
 
22
  *Returns:* `f`.
23
 
24
  *Complexity:* Applies `f` exactly `last - first` times.
@@ -37,22 +37,22 @@ requirements.
37
 
38
  *Effects:* Applies `f` to the result of dereferencing every iterator in
39
  the range \[`first`, `last`).
40
 
41
  [*Note 3*: If the type of `first` meets the requirements of a mutable
42
- iterator, `f` may apply non-constant functions through the dereferenced
43
  iterator. — *end note*]
44
 
45
  *Complexity:* Applies `f` exactly `last - first` times.
46
 
47
  *Remarks:* If `f` returns a result, the result is ignored.
48
  Implementations do not have the freedom granted under
49
  [[algorithms.parallel.exec]] to make arbitrary copies of elements from
50
  the input sequence.
51
 
52
  [*Note 4*: Does not return a copy of its `Function` parameter, since
53
- parallelization may not permit efficient state
54
  accumulation. — *end note*]
55
 
56
  ``` cpp
57
  template<input_iterator I, sentinel_for<I> S, class Proj = identity,
58
  indirectly_unary_invocable<projected<I, Proj>> Fun>
@@ -67,11 +67,11 @@ template<input_range R, class Proj = identity,
67
  *Effects:* Calls `invoke(f, invoke(proj, *i))` for every iterator `i` in
68
  the range \[`first`, `last`), starting from `first` and proceeding to
69
  `last - 1`.
70
 
71
  [*Note 5*: If the result of `invoke(proj, *i)` is a mutable reference,
72
- `f` may apply non-constant functions. — *end note*]
73
 
74
  *Returns:* `{last, std::move(f)}`.
75
 
76
  *Complexity:* Applies `f` and `proj` exactly `last - first` times.
77
 
@@ -84,25 +84,23 @@ the range \[`first`, `last`), starting from `first` and proceeding to
84
  template<class InputIterator, class Size, class Function>
85
  constexpr InputIterator for_each_n(InputIterator first, Size n, Function f);
86
  ```
87
 
88
  *Mandates:* The type `Size` is convertible to an integral
89
- type ([[conv.integral]], [[class.conv]]).
90
 
91
- *Preconditions:* `Function` meets the *Cpp17MoveConstructible*
92
- requirements.
93
 
94
  [*Note 7*: `Function` need not meet the requirements of
95
  *Cpp17CopyConstructible*. — *end note*]
96
 
97
- *Preconditions:* `n >= 0` is `true`.
98
-
99
  *Effects:* Applies `f` to the result of dereferencing every iterator in
100
  the range \[`first`, `first + n`) in order.
101
 
102
  [*Note 8*: If the type of `first` meets the requirements of a mutable
103
- iterator, `f` may apply non-constant functions through the dereferenced
104
  iterator. — *end note*]
105
 
106
  *Returns:* `first + n`.
107
 
108
  *Remarks:* If `f` returns a result, the result is ignored.
@@ -112,22 +110,20 @@ template<class ExecutionPolicy, class ForwardIterator, class Size, class Functio
112
  ForwardIterator for_each_n(ExecutionPolicy&& exec, ForwardIterator first, Size n,
113
  Function f);
114
  ```
115
 
116
  *Mandates:* The type `Size` is convertible to an integral
117
- type ([[conv.integral]], [[class.conv]]).
118
 
119
- *Preconditions:* `Function` meets the *Cpp17CopyConstructible*
120
- requirements.
121
-
122
- *Preconditions:* `n >= 0` is `true`.
123
 
124
  *Effects:* Applies `f` to the result of dereferencing every iterator in
125
  the range \[`first`, `first + n`).
126
 
127
  [*Note 9*: If the type of `first` meets the requirements of a mutable
128
- iterator, `f` may apply non-constant functions through the dereferenced
129
  iterator. — *end note*]
130
 
131
  *Returns:* `first + n`.
132
 
133
  *Remarks:* If `f` returns a result, the result is ignored.
@@ -146,11 +142,11 @@ template<input_iterator I, class Proj = identity,
146
 
147
  *Effects:* Calls `invoke(f, invoke(proj, *i))` for every iterator `i` in
148
  the range \[`first`, `first + n`) in order.
149
 
150
  [*Note 10*: If the result of `invoke(proj, *i)` is a mutable reference,
151
- `f` may apply non-constant functions. — *end note*]
152
 
153
  *Returns:* `{first + n, std::move(f)}`.
154
 
155
  *Remarks:* If `f` returns a result, the result is ignored.
156
 
 
14
  *Effects:* Applies `f` to the result of dereferencing every iterator in
15
  the range \[`first`, `last`), starting from `first` and proceeding to
16
  `last - 1`.
17
 
18
  [*Note 2*: If the type of `first` meets the requirements of a mutable
19
+ iterator, `f` can apply non-constant functions through the dereferenced
20
  iterator. — *end note*]
21
 
22
  *Returns:* `f`.
23
 
24
  *Complexity:* Applies `f` exactly `last - first` times.
 
37
 
38
  *Effects:* Applies `f` to the result of dereferencing every iterator in
39
  the range \[`first`, `last`).
40
 
41
  [*Note 3*: If the type of `first` meets the requirements of a mutable
42
+ iterator, `f` can apply non-constant functions through the dereferenced
43
  iterator. — *end note*]
44
 
45
  *Complexity:* Applies `f` exactly `last - first` times.
46
 
47
  *Remarks:* If `f` returns a result, the result is ignored.
48
  Implementations do not have the freedom granted under
49
  [[algorithms.parallel.exec]] to make arbitrary copies of elements from
50
  the input sequence.
51
 
52
  [*Note 4*: Does not return a copy of its `Function` parameter, since
53
+ parallelization often does not permit efficient state
54
  accumulation. — *end note*]
55
 
56
  ``` cpp
57
  template<input_iterator I, sentinel_for<I> S, class Proj = identity,
58
  indirectly_unary_invocable<projected<I, Proj>> Fun>
 
67
  *Effects:* Calls `invoke(f, invoke(proj, *i))` for every iterator `i` in
68
  the range \[`first`, `last`), starting from `first` and proceeding to
69
  `last - 1`.
70
 
71
  [*Note 5*: If the result of `invoke(proj, *i)` is a mutable reference,
72
+ `f` can apply non-constant functions. — *end note*]
73
 
74
  *Returns:* `{last, std::move(f)}`.
75
 
76
  *Complexity:* Applies `f` and `proj` exactly `last - first` times.
77
 
 
84
  template<class InputIterator, class Size, class Function>
85
  constexpr InputIterator for_each_n(InputIterator first, Size n, Function f);
86
  ```
87
 
88
  *Mandates:* The type `Size` is convertible to an integral
89
+ type [[conv.integral]], [[class.conv]].
90
 
91
+ *Preconditions:* `n >= 0` is `true`. `Function` meets the
92
+ *Cpp17MoveConstructible* requirements.
93
 
94
  [*Note 7*: `Function` need not meet the requirements of
95
  *Cpp17CopyConstructible*. — *end note*]
96
 
 
 
97
  *Effects:* Applies `f` to the result of dereferencing every iterator in
98
  the range \[`first`, `first + n`) in order.
99
 
100
  [*Note 8*: If the type of `first` meets the requirements of a mutable
101
+ iterator, `f` can apply non-constant functions through the dereferenced
102
  iterator. — *end note*]
103
 
104
  *Returns:* `first + n`.
105
 
106
  *Remarks:* If `f` returns a result, the result is ignored.
 
110
  ForwardIterator for_each_n(ExecutionPolicy&& exec, ForwardIterator first, Size n,
111
  Function f);
112
  ```
113
 
114
  *Mandates:* The type `Size` is convertible to an integral
115
+ type [[conv.integral]], [[class.conv]].
116
 
117
+ *Preconditions:* `n >= 0` is `true`. `Function` meets the
118
+ *Cpp17CopyConstructible* requirements.
 
 
119
 
120
  *Effects:* Applies `f` to the result of dereferencing every iterator in
121
  the range \[`first`, `first + n`).
122
 
123
  [*Note 9*: If the type of `first` meets the requirements of a mutable
124
+ iterator, `f` can apply non-constant functions through the dereferenced
125
  iterator. — *end note*]
126
 
127
  *Returns:* `first + n`.
128
 
129
  *Remarks:* If `f` returns a result, the result is ignored.
 
142
 
143
  *Effects:* Calls `invoke(f, invoke(proj, *i))` for every iterator `i` in
144
  the range \[`first`, `first + n`) in order.
145
 
146
  [*Note 10*: If the result of `invoke(proj, *i)` is a mutable reference,
147
+ `f` can apply non-constant functions. — *end note*]
148
 
149
  *Returns:* `{first + n, std::move(f)}`.
150
 
151
  *Remarks:* If `f` returns a result, the result is ignored.
152