From Jason Turner

[alg.foreach]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpni6mj_1r/{from.md → to.md} +87 -7
tmp/tmpni6mj_1r/{from.md → to.md} RENAMED
@@ -4,21 +4,101 @@
4
  template<class InputIterator, class Function>
5
  Function for_each(InputIterator first, InputIterator last, Function f);
6
  ```
7
 
8
  *Requires:* `Function` shall meet the requirements of
9
- `MoveConstructible` (Table  [[moveconstructible]]). `Function` need not
10
- meet the requirements of `CopyConstructible`
11
- (Table  [[copyconstructible]]).
 
12
 
13
  *Effects:* Applies `f` to the result of dereferencing every iterator in
14
  the range \[`first`, `last`), starting from `first` and proceeding to
15
- `last - 1`. If the type of `first` satisfies the requirements of a
16
- mutable iterator, `f` may apply nonconstant functions through the
17
- dereferenced iterator.
18
 
19
- *Returns:* `std::move(f)`.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
20
 
21
  *Complexity:* Applies `f` exactly `last - first` times.
22
 
23
  *Remarks:* If `f` returns a result, the result is ignored.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
24
 
 
4
  template<class InputIterator, class Function>
5
  Function for_each(InputIterator first, InputIterator last, Function f);
6
  ```
7
 
8
  *Requires:* `Function` shall meet the requirements of
9
+ `MoveConstructible` (Table  [[tab:moveconstructible]]).
10
+
11
+ [*Note 1*: `Function` need not meet the requirements of
12
+ `CopyConstructible` (Table  [[tab:copyconstructible]]). — *end note*]
13
 
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` satisfies the requirements of a
19
+ mutable iterator, `f` may apply non-constant functions through the
20
+ dereferenced iterator. — *end note*]
21
+
22
+ *Returns:* `f`.
23
+
24
+ *Complexity:* Applies `f` exactly `last - first` times.
25
+
26
+ *Remarks:* If `f` returns a result, the result is ignored.
27
+
28
+ ``` cpp
29
+ template<class ExecutionPolicy, class ForwardIterator, class Function>
30
+ void for_each(ExecutionPolicy&& exec,
31
+ ForwardIterator first, ForwardIterator last,
32
+ Function f);
33
+ ```
34
+
35
+ *Requires:* `Function` shall meet the requirements of
36
+ `CopyConstructible`.
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` satisfies the requirements of a
42
+ mutable iterator, `f` may apply non-constant functions through the
43
+ dereferenced 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<class InputIterator, class Size, class Function>
58
+ InputIterator for_each_n(InputIterator first, Size n, Function f);
59
+ ```
60
+
61
+ *Requires:* `Function` shall meet the requirements of
62
+ `MoveConstructible`
63
+
64
+ [*Note 5*: `Function` need not meet the requirements of
65
+ `CopyConstructible`. — *end note*]
66
+
67
+ *Requires:* `n >= 0`.
68
+
69
+ *Effects:* Applies `f` to the result of dereferencing every iterator in
70
+ the range \[`first`, `first + n`) in order.
71
+
72
+ [*Note 6*: If the type of `first` satisfies the requirements of a
73
+ mutable iterator, `f` may apply non-constant functions through the
74
+ dereferenced iterator. — *end note*]
75
+
76
+ *Returns:* `first + n`.
77
+
78
+ *Remarks:* If `f` returns a result, the result is ignored.
79
+
80
+ ``` cpp
81
+ template<class ExecutionPolicy, class ForwardIterator, class Size, class Function>
82
+ ForwardIterator for_each_n(ExecutionPolicy&& exec, ForwardIterator first, Size n,
83
+ Function f);
84
+ ```
85
+
86
+ *Requires:* `Function` shall meet the requirements of
87
+ `CopyConstructible`.
88
+
89
+ *Requires:* `n >= 0`.
90
+
91
+ *Effects:* Applies `f` to the result of dereferencing every iterator in
92
+ the range \[`first`, `first + n`).
93
+
94
+ [*Note 7*: If the type of `first` satisfies the requirements of a
95
+ mutable iterator, `f` may apply non-constant functions through the
96
+ dereferenced iterator. — *end note*]
97
+
98
+ *Returns:* `first + n`.
99
+
100
+ *Remarks:* If `f` returns a result, the result is ignored.
101
+ Implementations do not have the freedom granted under
102
+ [[algorithms.parallel.exec]] to make arbitrary copies of elements from
103
+ the input sequence.
104