From Jason Turner

[uninitialized.move]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmp1l9i3e1y/{from.md → to.md} +70 -16
tmp/tmp1l9i3e1y/{from.md → to.md} RENAMED
@@ -1,39 +1,93 @@
1
- #### `uninitialized_move` <a id="uninitialized.move">[[uninitialized.move]]</a>
2
 
3
  ``` cpp
4
- template <class InputIterator, class ForwardIterator>
5
- ForwardIterator uninitialized_move(InputIterator first, InputIterator last,
6
- ForwardIterator result);
7
  ```
8
 
 
 
 
9
  *Effects:* Equivalent to:
10
 
11
  ``` cpp
12
  for (; first != last; (void)++result, ++first)
13
- ::new (static_cast<void*>(addressof(*result)))
14
- typename iterator_traits<ForwardIterator>::value_type(std::move(*first));
15
  return result;
16
  ```
17
 
18
- *Remarks:* If an exception is thrown, some objects in the range
19
- \[`first`, `last`) are left in a valid but unspecified state.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
20
 
21
  ``` cpp
22
- template <class InputIterator, class Size, class ForwardIterator>
23
- pair<InputIterator, ForwardIterator>
24
- uninitialized_move_n(InputIterator first, Size n, ForwardIterator result);
 
 
25
  ```
26
 
 
 
 
 
 
 
 
 
 
 
 
 
 
27
  *Effects:* Equivalent to:
28
 
29
  ``` cpp
30
  for (; n > 0; ++result, (void) ++first, --n)
31
- ::new (static_cast<void*>(addressof(*result)))
32
- typename iterator_traits<ForwardIterator>::value_type(std::move(*first));
33
  return {first, result};
34
  ```
35
 
36
- *Remarks:* If an exception is thrown, some objects in the range
37
- \[`first`, `std::next(first,n)`) are left in a valid but unspecified
38
- state.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
39
 
 
1
+ ### `uninitialized_move` <a id="uninitialized.move">[[uninitialized.move]]</a>
2
 
3
  ``` cpp
4
+ template<class InputIterator, class NoThrowForwardIterator>
5
+ NoThrowForwardIterator uninitialized_move(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; (void)++result, ++first)
16
+ ::new (voidify(*result))
17
+ typename iterator_traits<NoThrowForwardIterator>::value_type(std::move(*first));
18
  return result;
19
  ```
20
 
21
+ ``` cpp
22
+ namespace ranges {
23
+ template<input_iterator I, sentinel_for<I> S1,
24
+ no-throw-forward-iterator O, no-throw-sentinel<O> S2>
25
+ requires constructible_from<iter_value_t<O>, iter_rvalue_reference_t<I>>
26
+ uninitialized_move_result<I, O>
27
+ uninitialized_move(I ifirst, S1 ilast, O ofirst, S2 olast);
28
+ template<input_range IR, no-throw-forward-range OR>
29
+ requires constructible_from<range_value_t<OR>, range_rvalue_reference_t<IR>>
30
+ uninitialized_move_result<borrowed_iterator_t<IR>, borrowed_iterator_t<OR>>
31
+ uninitialized_move(IR&& in_range, OR&& out_range);
32
+ }
33
+ ```
34
+
35
+ *Preconditions:* \[`ofirst`, `olast`) does not overlap with \[`ifirst`,
36
+ `ilast`).
37
+
38
+ *Effects:* Equivalent to:
39
 
40
  ``` cpp
41
+ for (; ifirst != ilast && ofirst != olast; ++ofirst, (void)++ifirst) {
42
+ ::new (voidify(*ofirst))
43
+ remove_reference_t<iter_reference_t<O>>(ranges::iter_move(ifirst));
44
+ }
45
+ return {std::move(ifirst), ofirst};
46
  ```
47
 
48
+ [*Note 1*: If an exception is thrown, some objects in the range
49
+ \[`first`, `last`) are left in a valid, but unspecified
50
+ state. — *end note*]
51
+
52
+ ``` cpp
53
+ template<class InputIterator, class Size, class NoThrowForwardIterator>
54
+ pair<InputIterator, NoThrowForwardIterator>
55
+ uninitialized_move_n(InputIterator first, Size n, NoThrowForwardIterator result);
56
+ ```
57
+
58
+ *Preconditions:* `result`+\[0, `n`) does not overlap with `first`+\[0,
59
+ `n`).
60
+
61
  *Effects:* Equivalent to:
62
 
63
  ``` cpp
64
  for (; n > 0; ++result, (void) ++first, --n)
65
+ ::new (voidify(*result))
66
+ typename iterator_traits<NoThrowForwardIterator>::value_type(std::move(*first));
67
  return {first, result};
68
  ```
69
 
70
+ ``` cpp
71
+ namespace ranges {
72
+ template<input_iterator I, no-throw-forward-iterator O, no-throw-sentinel<O> S>
73
+ requires constructible_from<iter_value_t<O>, iter_rvalue_reference_t<I>>
74
+ uninitialized_move_n_result<I, O>
75
+ uninitialized_move_n(I ifirst, iter_difference_t<I> n, O ofirst, S olast);
76
+ }
77
+ ```
78
+
79
+ *Preconditions:* \[`ofirst`, `olast`) does not overlap with
80
+ `ifirst`+\[0, `n`).
81
+
82
+ *Effects:* Equivalent to:
83
+
84
+ ``` cpp
85
+ auto t = uninitialized_move(counted_iterator(ifirst, n),
86
+ default_sentinel, ofirst, olast);
87
+ return {std::move(t.in).base(), t.out};
88
+ ```
89
+
90
+ [*Note 2*: If an exception is thrown, some objects in the range
91
+ `first`+\[0, `n`) are left in a valid but unspecified
92
+ state. — *end note*]
93