tmp/tmpo0ykr696/{from.md → to.md}
RENAMED
|
@@ -9,26 +9,28 @@ template<class T>
|
|
| 9 |
volatile T* start_lifetime_as(volatile void* p) noexcept;
|
| 10 |
template<class T>
|
| 11 |
const volatile T* start_lifetime_as(const volatile void* p) noexcept;
|
| 12 |
```
|
| 13 |
|
| 14 |
-
*Mandates:* `T` is an implicit-lifetime
|
| 15 |
-
|
|
|
|
| 16 |
|
| 17 |
*Preconditions:* \[`p`, `(char*)p + sizeof(T)`) denotes a region of
|
| 18 |
allocated storage that is a subset of the region of storage reachable
|
| 19 |
through [[basic.compound]] `p` and suitably aligned for the type `T`.
|
| 20 |
|
| 21 |
*Effects:* Implicitly creates objects [[intro.object]] within the
|
| 22 |
denoted region consisting of an object *a* of type `T` whose address is
|
| 23 |
`p`, and objects nested within *a*, as follows: The object
|
| 24 |
representation of *a* is the contents of the storage prior to the call
|
| 25 |
to `start_lifetime_as`. The value of each created object *o* of
|
| 26 |
-
trivially
|
| 27 |
-
call to `bit_cast<U>(E)`
|
| 28 |
-
`U` denoting *o*, except
|
| 29 |
-
any other created object
|
|
|
|
| 30 |
|
| 31 |
[*Note 1*: The unspecified value can be indeterminate. — *end note*]
|
| 32 |
|
| 33 |
*Returns:* A pointer to the *a* defined in the *Effects* paragraph.
|
| 34 |
|
|
@@ -56,5 +58,81 @@ where `U` is the type “array of `n` `T`”. Otherwise, there are no
|
|
| 56 |
effects.
|
| 57 |
|
| 58 |
*Returns:* A pointer to the first element of the created array, if any;
|
| 59 |
otherwise, a pointer that compares equal to `p` [[expr.eq]].
|
| 60 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
volatile T* start_lifetime_as(volatile void* p) noexcept;
|
| 10 |
template<class T>
|
| 11 |
const volatile T* start_lifetime_as(const volatile void* p) noexcept;
|
| 12 |
```
|
| 13 |
|
| 14 |
+
*Mandates:* `T` is an implicit-lifetime
|
| 15 |
+
type [[term.implicit.lifetime.type]] and not an incomplete
|
| 16 |
+
type [[term.incomplete.type]].
|
| 17 |
|
| 18 |
*Preconditions:* \[`p`, `(char*)p + sizeof(T)`) denotes a region of
|
| 19 |
allocated storage that is a subset of the region of storage reachable
|
| 20 |
through [[basic.compound]] `p` and suitably aligned for the type `T`.
|
| 21 |
|
| 22 |
*Effects:* Implicitly creates objects [[intro.object]] within the
|
| 23 |
denoted region consisting of an object *a* of type `T` whose address is
|
| 24 |
`p`, and objects nested within *a*, as follows: The object
|
| 25 |
representation of *a* is the contents of the storage prior to the call
|
| 26 |
to `start_lifetime_as`. The value of each created object *o* of
|
| 27 |
+
trivially copyable type [[term.trivially.copyable.type]] `U` is
|
| 28 |
+
determined in the same manner as for a call to `bit_cast<U>(E)`
|
| 29 |
+
[[bit.cast]], where `E` is an lvalue of type `U` denoting *o*, except
|
| 30 |
+
that the storage is not accessed. The value of any other created object
|
| 31 |
+
is unspecified.
|
| 32 |
|
| 33 |
[*Note 1*: The unspecified value can be indeterminate. — *end note*]
|
| 34 |
|
| 35 |
*Returns:* A pointer to the *a* defined in the *Effects* paragraph.
|
| 36 |
|
|
|
|
| 58 |
effects.
|
| 59 |
|
| 60 |
*Returns:* A pointer to the first element of the created array, if any;
|
| 61 |
otherwise, a pointer that compares equal to `p` [[expr.eq]].
|
| 62 |
|
| 63 |
+
``` cpp
|
| 64 |
+
template<class T>
|
| 65 |
+
T* trivially_relocate(T* first, T* last, T* result);
|
| 66 |
+
```
|
| 67 |
+
|
| 68 |
+
*Mandates:* `is_trivially_relocatable_v<T> && !is_const_v<T>` is `true`.
|
| 69 |
+
`T` is not an array of unknown bound.
|
| 70 |
+
|
| 71 |
+
*Preconditions:*
|
| 72 |
+
|
| 73 |
+
- \[`first`, `last`) is a valid range.
|
| 74 |
+
- \[`result`, `result + (last - first)`) denotes a region of storage
|
| 75 |
+
that is a subset of the region reachable through `result`
|
| 76 |
+
[[basic.compound]] and suitably aligned for the type `T`.
|
| 77 |
+
- No element in the range \[`first`, `last`) is a
|
| 78 |
+
potentially-overlapping subobject.
|
| 79 |
+
|
| 80 |
+
*Ensures:* No effect if `result == first` is `true`. Otherwise, the
|
| 81 |
+
range denoted by \[`result`, `result + (last - first)`) contains objects
|
| 82 |
+
(including subobjects) whose lifetime has begun and whose object
|
| 83 |
+
representations are the original object representations of the
|
| 84 |
+
corresponding objects in the source range \[`first`, `last`) except for
|
| 85 |
+
any parts of the object representations used by the implementation to
|
| 86 |
+
represent type information [[intro.object]]. If any of the objects has
|
| 87 |
+
union type, its active member is the same as that of the corresponding
|
| 88 |
+
object in the source range. If any of the aforementioned objects has a
|
| 89 |
+
non-static data member of reference type, that reference refers to the
|
| 90 |
+
same entity as does the corresponding reference in the source range. The
|
| 91 |
+
lifetimes of the original objects in the source range have ended.
|
| 92 |
+
|
| 93 |
+
*Returns:* `result + (last - first)`.
|
| 94 |
+
|
| 95 |
+
*Throws:* Nothing.
|
| 96 |
+
|
| 97 |
+
*Complexity:* Linear in the length of the source range.
|
| 98 |
+
|
| 99 |
+
*Remarks:* The destination region of storage is considered
|
| 100 |
+
reused [[basic.life]]. No constructors or destructors are invoked.
|
| 101 |
+
|
| 102 |
+
[*Note 2*: Overlapping ranges are supported. — *end note*]
|
| 103 |
+
|
| 104 |
+
``` cpp
|
| 105 |
+
template<class T>
|
| 106 |
+
constexpr T* relocate(T* first, T* last, T* result);
|
| 107 |
+
```
|
| 108 |
+
|
| 109 |
+
*Mandates:* `is_nothrow_relocatable_v<T> && !is_const_v<T>` is `true`.
|
| 110 |
+
`T` is not an array of unknown bound.
|
| 111 |
+
|
| 112 |
+
*Preconditions:*
|
| 113 |
+
|
| 114 |
+
- \[`first`, `last`) is a valid range.
|
| 115 |
+
- \[`result`, `result + (last - first)`) denotes a region of storage
|
| 116 |
+
that is a subset of the region reachable through `result`
|
| 117 |
+
[[basic.compound]] and suitably aligned for the type `T`.
|
| 118 |
+
- No element in the range \[`first`, `last`) is a
|
| 119 |
+
potentially-overlapping subobject.
|
| 120 |
+
|
| 121 |
+
*Effects:*
|
| 122 |
+
|
| 123 |
+
- If `result == first` is `true`, no effect;
|
| 124 |
+
- otherwise, if not called during constant evaluation and
|
| 125 |
+
`is_trivially_relocatable_v<T>` is `true`, then has effects equivalent
|
| 126 |
+
to: `trivially_relocate(first, last, result);`
|
| 127 |
+
- otherwise, for each integer `i` in \[`0`, `last - first`),
|
| 128 |
+
- if `T` is an array type, equivalent to:
|
| 129 |
+
`relocate(begin(first[i]), end(first[i]), *start_lifetime_as<T>(result + i));`
|
| 130 |
+
- otherwise, equivalent to:
|
| 131 |
+
`construct_at(result + i, std::move(first[i])); destroy_at(first + i);`
|
| 132 |
+
|
| 133 |
+
*Returns:* `result + (last - first)`.
|
| 134 |
+
|
| 135 |
+
*Throws:* Nothing.
|
| 136 |
+
|
| 137 |
+
[*Note 3*: Overlapping ranges are supported. — *end note*]
|
| 138 |
+
|