From Jason Turner

[alg.copy]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmp3m430gs0/{from.md → to.md} +34 -3
tmp/tmp3m430gs0/{from.md → to.md} RENAMED
@@ -4,25 +4,47 @@
4
  template<class InputIterator, class OutputIterator>
5
  OutputIterator copy(InputIterator first, InputIterator last,
6
  OutputIterator result);
7
  ```
8
 
 
 
9
  *Effects:* Copies elements in the range \[`first`, `last`) into the
10
  range \[`result`, `result + (last - first)`) starting from `first` and
11
  proceeding to `last`. For each non-negative integer
12
  `n < (last - first)`, performs `*(result + n) = *(first + n)`.
13
 
14
  *Returns:* `result + (last - first)`.
15
 
16
- *Requires:* `result` shall not be in the range \[`first`, `last`).
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
17
 
18
  *Complexity:* Exactly `last - first` assignments.
19
 
20
  ``` cpp
21
  template<class InputIterator, class Size, class OutputIterator>
22
  OutputIterator copy_n(InputIterator first, Size n,
23
  OutputIterator result);
 
 
 
 
24
  ```
25
 
26
  *Effects:* For each non-negative integer i < n, performs
27
  `*(result + i) = *(first + i)`.
28
 
@@ -32,15 +54,24 @@ template<class InputIterator, class Size, class OutputIterator>
32
 
33
  ``` cpp
34
  template<class InputIterator, class OutputIterator, class Predicate>
35
  OutputIterator copy_if(InputIterator first, InputIterator last,
36
  OutputIterator result, Predicate pred);
 
 
 
 
37
  ```
38
 
39
  *Requires:* The ranges \[`first`, `last`) and \[`result`,
40
  `result + (last - first)`) shall not overlap.
41
 
 
 
 
 
 
42
  *Effects:* Copies all of the elements referred to by the iterator `i` in
43
  the range \[`first`, `last`) for which `pred(*i)` is `true`.
44
 
45
  *Returns:* The end of the resulting range.
46
 
@@ -55,16 +86,16 @@ template<class BidirectionalIterator1, class BidirectionalIterator2>
55
  copy_backward(BidirectionalIterator1 first,
56
  BidirectionalIterator1 last,
57
  BidirectionalIterator2 result);
58
  ```
59
 
 
 
60
  *Effects:* Copies elements in the range \[`first`, `last`) into the
61
  range \[`result - (last-first)`, `result`) starting from `last - 1` and
62
  proceeding to `first`.[^2] For each positive integer
63
  `n <= (last - first)`, performs `*(result - n) = *(last - n)`.
64
 
65
- *Requires:* `result` shall not be in the range (`first`, `last`).
66
-
67
  *Returns:* `result - (last - first)`.
68
 
69
  *Complexity:* Exactly `last - first` assignments.
70
 
 
4
  template<class InputIterator, class OutputIterator>
5
  OutputIterator copy(InputIterator first, InputIterator last,
6
  OutputIterator result);
7
  ```
8
 
9
+ *Requires:* `result` shall not be in the range \[`first`, `last`).
10
+
11
  *Effects:* Copies elements in the range \[`first`, `last`) into the
12
  range \[`result`, `result + (last - first)`) starting from `first` and
13
  proceeding to `last`. For each non-negative integer
14
  `n < (last - first)`, performs `*(result + n) = *(first + n)`.
15
 
16
  *Returns:* `result + (last - first)`.
17
 
18
+ *Complexity:* Exactly `last - first` assignments.
19
+
20
+ ``` cpp
21
+ template<class ExecutionPolicy, class ForwardIterator1, class ForwardIterator2>
22
+ ForwardIterator2 copy(ExecutionPolicy&& policy,
23
+ ForwardIterator1 first, ForwardIterator1 last,
24
+ ForwardIterator2 result);
25
+ ```
26
+
27
+ *Requires:* The ranges \[`first`, `last`) and \[`result`,
28
+ `result + (last - first)`) shall not overlap.
29
+
30
+ *Effects:* Copies elements in the range \[`first`, `last`) into the
31
+ range \[`result`, `result + (last - first)`). For each non-negative
32
+ integer `n < (last - first)`, performs `*(result + n) = *(first + n)`.
33
+
34
+ *Returns:* `result + (last - first)`.
35
 
36
  *Complexity:* Exactly `last - first` assignments.
37
 
38
  ``` cpp
39
  template<class InputIterator, class Size, class OutputIterator>
40
  OutputIterator copy_n(InputIterator first, Size n,
41
  OutputIterator result);
42
+ template<class ExecutionPolicy, class ForwardIterator1, class Size, class ForwardIterator2>
43
+ ForwardIterator2 copy_n(ExecutionPolicy&& exec,
44
+ ForwardIterator1 first, Size n,
45
+ ForwardIterator2 result);
46
  ```
47
 
48
  *Effects:* For each non-negative integer i < n, performs
49
  `*(result + i) = *(first + i)`.
50
 
 
54
 
55
  ``` cpp
56
  template<class InputIterator, class OutputIterator, class Predicate>
57
  OutputIterator copy_if(InputIterator first, InputIterator last,
58
  OutputIterator result, Predicate pred);
59
+ template<class ExecutionPolicy, class ForwardIterator1, class ForwardIterator2, class Predicate>
60
+ ForwardIterator2 copy_if(ExecutionPolicy&& exec,
61
+ ForwardIterator1 first, ForwardIterator1 last,
62
+ ForwardIterator2 result, Predicate pred);
63
  ```
64
 
65
  *Requires:* The ranges \[`first`, `last`) and \[`result`,
66
  `result + (last - first)`) shall not overlap.
67
 
68
+ [*Note 1*: For the overload with an `ExecutionPolicy`, there may be a
69
+ performance cost if `iterator_traits<ForwardIterator1>::value_type` is
70
+ not `MoveConstructible`
71
+ (Table  [[tab:moveconstructible]]). — *end note*]
72
+
73
  *Effects:* Copies all of the elements referred to by the iterator `i` in
74
  the range \[`first`, `last`) for which `pred(*i)` is `true`.
75
 
76
  *Returns:* The end of the resulting range.
77
 
 
86
  copy_backward(BidirectionalIterator1 first,
87
  BidirectionalIterator1 last,
88
  BidirectionalIterator2 result);
89
  ```
90
 
91
+ *Requires:* `result` shall not be in the range (`first`, `last`).
92
+
93
  *Effects:* Copies elements in the range \[`first`, `last`) into the
94
  range \[`result - (last-first)`, `result`) starting from `last - 1` and
95
  proceeding to `first`.[^2] For each positive integer
96
  `n <= (last - first)`, performs `*(result - n) = *(last - n)`.
97
 
 
 
98
  *Returns:* `result - (last - first)`.
99
 
100
  *Complexity:* Exactly `last - first` assignments.
101