From Jason Turner

[uninitialized.copy]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmp89i059_4/{from.md → to.md} +65 -13
tmp/tmp89i059_4/{from.md → to.md} RENAMED
@@ -1,35 +1,87 @@
1
- #### `uninitialized_copy` <a id="uninitialized.copy">[[uninitialized.copy]]</a>
2
 
3
  ``` cpp
4
- template <class InputIterator, class ForwardIterator>
5
- ForwardIterator uninitialized_copy(InputIterator first, InputIterator last,
6
- ForwardIterator result);
7
  ```
8
 
9
- *Effects:* As if by:
 
 
 
10
 
11
  ``` cpp
12
  for (; first != last; ++result, (void) ++first)
13
- ::new (static_cast<void*>(addressof(*result)))
14
- typename iterator_traits<ForwardIterator>::value_type(*first);
15
  ```
16
 
17
  *Returns:* `result`.
18
 
19
  ``` cpp
20
- template <class InputIterator, class Size, class ForwardIterator>
21
- ForwardIterator uninitialized_copy_n(InputIterator first, Size n,
22
- ForwardIterator result);
 
 
 
 
 
 
 
 
23
  ```
24
 
25
- *Effects:* As if by:
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
26
 
27
  ``` cpp
28
  for ( ; n > 0; ++result, (void) ++first, --n) {
29
- ::new (static_cast<void*>(addressof(*result)))
30
- typename iterator_traits<ForwardIterator>::value_type(*first);
31
  }
32
  ```
33
 
34
  *Returns:* `result`.
35
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ### `uninitialized_copy` <a id="uninitialized.copy">[[uninitialized.copy]]</a>
2
 
3
  ``` cpp
4
+ template<class InputIterator, class NoThrowForwardIterator>
5
+ NoThrowForwardIterator uninitialized_copy(InputIterator first, InputIterator last,
6
+ NoThrowForwardIterator result);
7
  ```
8
 
9
+ *Preconditions:* `result`+\[0, `(last - first)`) does not overlap with
10
+ \[`first`, `last`).
11
+
12
+ *Effects:* Equivalent to:
13
 
14
  ``` cpp
15
  for (; first != last; ++result, (void) ++first)
16
+ ::new (voidify(*result))
17
+ typename iterator_traits<NoThrowForwardIterator>::value_type(*first);
18
  ```
19
 
20
  *Returns:* `result`.
21
 
22
  ``` cpp
23
+ namespace ranges {
24
+ template<input_iterator I, sentinel_for<I> S1,
25
+ no-throw-forward-iterator O, no-throw-sentinel<O> S2>
26
+ requires constructible_from<iter_value_t<O>, iter_reference_t<I>>
27
+ uninitialized_copy_result<I, O>
28
+ uninitialized_copy(I ifirst, S1 ilast, O ofirst, S2 olast);
29
+ template<input_range IR, no-throw-forward-range OR>
30
+ requires constructible_from<range_value_t<OR>, range_reference_t<IR>>
31
+ uninitialized_copy_result<borrowed_iterator_t<IR>, borrowed_iterator_t<OR>>
32
+ uninitialized_copy(IR&& in_range, OR&& out_range);
33
+ }
34
  ```
35
 
36
+ *Preconditions:* \[`ofirst`, `olast`) does not overlap with \[`ifirst`,
37
+ `ilast`).
38
+
39
+ *Effects:* Equivalent to:
40
+
41
+ ``` cpp
42
+ for (; ifirst != ilast && ofirst != olast; ++ofirst, (void)++ifirst) {
43
+ ::new (voidify(*ofirst)) remove_reference_t<iter_reference_t<O>>(*ifirst);
44
+ }
45
+ return {std::move(ifirst), ofirst};
46
+ ```
47
+
48
+ ``` cpp
49
+ template<class InputIterator, class Size, class NoThrowForwardIterator>
50
+ NoThrowForwardIterator uninitialized_copy_n(InputIterator first, Size n,
51
+ NoThrowForwardIterator result);
52
+ ```
53
+
54
+ *Preconditions:* `result`+\[0, `n`) does not overlap with `first`+\[0,
55
+ `n`).
56
+
57
+ *Effects:* Equivalent to:
58
 
59
  ``` cpp
60
  for ( ; n > 0; ++result, (void) ++first, --n) {
61
+ ::new (voidify(*result))
62
+ typename iterator_traits<NoThrowForwardIterator>::value_type(*first);
63
  }
64
  ```
65
 
66
  *Returns:* `result`.
67
 
68
+ ``` cpp
69
+ namespace ranges {
70
+ template<input_iterator I, no-throw-forward-iterator O, no-throw-sentinel<O> S>
71
+ requires constructible_from<iter_value_t<O>, iter_reference_t<I>>
72
+ uninitialized_copy_n_result<I, O>
73
+ uninitialized_copy_n(I ifirst, iter_difference_t<I> n, O ofirst, S olast);
74
+ }
75
+ ```
76
+
77
+ *Preconditions:* \[`ofirst`, `olast`) does not overlap with
78
+ `ifirst`+\[0, `n`).
79
+
80
+ *Effects:* Equivalent to:
81
+
82
+ ``` cpp
83
+ auto t = uninitialized_copy(counted_iterator(ifirst, n),
84
+ default_sentinel, ofirst, olast);
85
+ return {std::move(t.in).base(), t.out};
86
+ ```
87
+