tmp/tmpxjqqxl5w/{from.md → to.md}
RENAMED
|
@@ -1,46 +1,48 @@
|
|
| 1 |
#### `unique_ptr` for array objects with a runtime length <a id="unique.ptr.runtime">[[unique.ptr.runtime]]</a>
|
| 2 |
|
|
|
|
|
|
|
| 3 |
``` cpp
|
| 4 |
namespace std {
|
| 5 |
template<class T, class D> class unique_ptr<T[], D> {
|
| 6 |
public:
|
| 7 |
using pointer = see below;
|
| 8 |
using element_type = T;
|
| 9 |
using deleter_type = D;
|
| 10 |
|
| 11 |
// [unique.ptr.runtime.ctor], constructors
|
| 12 |
constexpr unique_ptr() noexcept;
|
| 13 |
-
template<class U> explicit unique_ptr(U p) noexcept;
|
| 14 |
-
template<class U> unique_ptr(U p, see below d) noexcept;
|
| 15 |
-
template<class U> unique_ptr(U p, see below d) noexcept;
|
| 16 |
-
unique_ptr(unique_ptr&& u) noexcept;
|
| 17 |
template<class U, class E>
|
| 18 |
-
unique_ptr(unique_ptr<U, E>&& u) noexcept;
|
| 19 |
constexpr unique_ptr(nullptr_t) noexcept;
|
| 20 |
|
| 21 |
// destructor
|
| 22 |
-
~unique_ptr();
|
| 23 |
|
| 24 |
// assignment
|
| 25 |
-
unique_ptr& operator=(unique_ptr&& u) noexcept;
|
| 26 |
template<class U, class E>
|
| 27 |
-
unique_ptr& operator=(unique_ptr<U, E>&& u) noexcept;
|
| 28 |
-
unique_ptr& operator=(nullptr_t) noexcept;
|
| 29 |
|
| 30 |
// [unique.ptr.runtime.observers], observers
|
| 31 |
-
T& operator[](size_t i) const;
|
| 32 |
-
pointer get() const noexcept;
|
| 33 |
-
deleter_type& get_deleter() noexcept;
|
| 34 |
-
const deleter_type& get_deleter() const noexcept;
|
| 35 |
-
explicit operator bool() const noexcept;
|
| 36 |
|
| 37 |
// [unique.ptr.runtime.modifiers], modifiers
|
| 38 |
-
pointer release() noexcept;
|
| 39 |
-
template<class U> void reset(U p) noexcept;
|
| 40 |
-
void reset(nullptr_t = nullptr) noexcept;
|
| 41 |
-
void swap(unique_ptr& u) noexcept;
|
| 42 |
|
| 43 |
// disable copy from lvalue
|
| 44 |
unique_ptr(const unique_ptr&) = delete;
|
| 45 |
unique_ptr& operator=(const unique_ptr&) = delete;
|
| 46 |
};
|
|
@@ -66,11 +68,11 @@ primary template.
|
|
| 66 |
The template argument `T` shall be a complete type.
|
| 67 |
|
| 68 |
##### Constructors <a id="unique.ptr.runtime.ctor">[[unique.ptr.runtime.ctor]]</a>
|
| 69 |
|
| 70 |
``` cpp
|
| 71 |
-
template<class U> explicit unique_ptr(U p) noexcept;
|
| 72 |
```
|
| 73 |
|
| 74 |
This constructor behaves the same as the constructor in the primary
|
| 75 |
template that takes a single parameter of type `pointer`.
|
| 76 |
|
|
@@ -79,12 +81,12 @@ template that takes a single parameter of type `pointer`.
|
|
| 79 |
- `U` is the same type as `pointer`, or
|
| 80 |
- `pointer` is the same type as `element_type*`, `U` is a pointer type
|
| 81 |
`V*`, and `V(*)[]` is convertible to `element_type(*)[]`.
|
| 82 |
|
| 83 |
``` cpp
|
| 84 |
-
template<class U> unique_ptr(U p, see below d) noexcept;
|
| 85 |
-
template<class U> unique_ptr(U p, see below d) noexcept;
|
| 86 |
```
|
| 87 |
|
| 88 |
These constructors behave the same as the constructors in the primary
|
| 89 |
template that take a parameter of type `pointer` and a second parameter.
|
| 90 |
|
|
@@ -94,11 +96,11 @@ template that take a parameter of type `pointer` and a second parameter.
|
|
| 94 |
- `U` is `nullptr_t`, or
|
| 95 |
- `pointer` is the same type as `element_type*`, `U` is a pointer type
|
| 96 |
`V*`, and `V(*)[]` is convertible to `element_type(*)[]`.
|
| 97 |
|
| 98 |
``` cpp
|
| 99 |
-
template<class U, class E> unique_ptr(unique_ptr<U, E>&& u) noexcept;
|
| 100 |
```
|
| 101 |
|
| 102 |
This constructor behaves the same as in the primary template.
|
| 103 |
|
| 104 |
*Constraints:* Where `UP` is `unique_ptr<U, E>`:
|
|
@@ -114,11 +116,11 @@ This constructor behaves the same as in the primary template.
|
|
| 114 |
primary template. — *end note*]
|
| 115 |
|
| 116 |
##### Assignment <a id="unique.ptr.runtime.asgn">[[unique.ptr.runtime.asgn]]</a>
|
| 117 |
|
| 118 |
``` cpp
|
| 119 |
-
template<class U, class E> unique_ptr& operator=(unique_ptr<U, E>&& u)noexcept;
|
| 120 |
```
|
| 121 |
|
| 122 |
This operator behaves the same as in the primary template.
|
| 123 |
|
| 124 |
*Constraints:* Where `UP` is `unique_ptr<U, E>`:
|
|
@@ -133,28 +135,28 @@ This operator behaves the same as in the primary template.
|
|
| 133 |
primary template. — *end note*]
|
| 134 |
|
| 135 |
##### Observers <a id="unique.ptr.runtime.observers">[[unique.ptr.runtime.observers]]</a>
|
| 136 |
|
| 137 |
``` cpp
|
| 138 |
-
T& operator[](size_t i) const;
|
| 139 |
```
|
| 140 |
|
| 141 |
*Preconditions:* `i` < the number of elements in the array to which the
|
| 142 |
stored pointer points.
|
| 143 |
|
| 144 |
*Returns:* `get()[i]`.
|
| 145 |
|
| 146 |
##### Modifiers <a id="unique.ptr.runtime.modifiers">[[unique.ptr.runtime.modifiers]]</a>
|
| 147 |
|
| 148 |
``` cpp
|
| 149 |
-
void reset(nullptr_t p = nullptr) noexcept;
|
| 150 |
```
|
| 151 |
|
| 152 |
*Effects:* Equivalent to `reset(pointer())`.
|
| 153 |
|
| 154 |
``` cpp
|
| 155 |
-
template<class U> void reset(U p) noexcept;
|
| 156 |
```
|
| 157 |
|
| 158 |
This function behaves the same as the `reset` member of the primary
|
| 159 |
template.
|
| 160 |
|
|
|
|
| 1 |
#### `unique_ptr` for array objects with a runtime length <a id="unique.ptr.runtime">[[unique.ptr.runtime]]</a>
|
| 2 |
|
| 3 |
+
##### General <a id="unique.ptr.runtime.general">[[unique.ptr.runtime.general]]</a>
|
| 4 |
+
|
| 5 |
``` cpp
|
| 6 |
namespace std {
|
| 7 |
template<class T, class D> class unique_ptr<T[], D> {
|
| 8 |
public:
|
| 9 |
using pointer = see below;
|
| 10 |
using element_type = T;
|
| 11 |
using deleter_type = D;
|
| 12 |
|
| 13 |
// [unique.ptr.runtime.ctor], constructors
|
| 14 |
constexpr unique_ptr() noexcept;
|
| 15 |
+
template<class U> constexpr explicit unique_ptr(U p) noexcept;
|
| 16 |
+
template<class U> constexpr unique_ptr(U p, see below d) noexcept;
|
| 17 |
+
template<class U> constexpr unique_ptr(U p, see below d) noexcept;
|
| 18 |
+
constexpr unique_ptr(unique_ptr&& u) noexcept;
|
| 19 |
template<class U, class E>
|
| 20 |
+
constexpr unique_ptr(unique_ptr<U, E>&& u) noexcept;
|
| 21 |
constexpr unique_ptr(nullptr_t) noexcept;
|
| 22 |
|
| 23 |
// destructor
|
| 24 |
+
constexpr ~unique_ptr();
|
| 25 |
|
| 26 |
// assignment
|
| 27 |
+
constexpr unique_ptr& operator=(unique_ptr&& u) noexcept;
|
| 28 |
template<class U, class E>
|
| 29 |
+
constexpr unique_ptr& operator=(unique_ptr<U, E>&& u) noexcept;
|
| 30 |
+
constexpr unique_ptr& operator=(nullptr_t) noexcept;
|
| 31 |
|
| 32 |
// [unique.ptr.runtime.observers], observers
|
| 33 |
+
constexpr T& operator[](size_t i) const;
|
| 34 |
+
constexpr pointer get() const noexcept;
|
| 35 |
+
constexpr deleter_type& get_deleter() noexcept;
|
| 36 |
+
constexpr const deleter_type& get_deleter() const noexcept;
|
| 37 |
+
constexpr explicit operator bool() const noexcept;
|
| 38 |
|
| 39 |
// [unique.ptr.runtime.modifiers], modifiers
|
| 40 |
+
constexpr pointer release() noexcept;
|
| 41 |
+
template<class U> constexpr void reset(U p) noexcept;
|
| 42 |
+
constexpr void reset(nullptr_t = nullptr) noexcept;
|
| 43 |
+
constexpr void swap(unique_ptr& u) noexcept;
|
| 44 |
|
| 45 |
// disable copy from lvalue
|
| 46 |
unique_ptr(const unique_ptr&) = delete;
|
| 47 |
unique_ptr& operator=(const unique_ptr&) = delete;
|
| 48 |
};
|
|
|
|
| 68 |
The template argument `T` shall be a complete type.
|
| 69 |
|
| 70 |
##### Constructors <a id="unique.ptr.runtime.ctor">[[unique.ptr.runtime.ctor]]</a>
|
| 71 |
|
| 72 |
``` cpp
|
| 73 |
+
template<class U> constexpr explicit unique_ptr(U p) noexcept;
|
| 74 |
```
|
| 75 |
|
| 76 |
This constructor behaves the same as the constructor in the primary
|
| 77 |
template that takes a single parameter of type `pointer`.
|
| 78 |
|
|
|
|
| 81 |
- `U` is the same type as `pointer`, or
|
| 82 |
- `pointer` is the same type as `element_type*`, `U` is a pointer type
|
| 83 |
`V*`, and `V(*)[]` is convertible to `element_type(*)[]`.
|
| 84 |
|
| 85 |
``` cpp
|
| 86 |
+
template<class U> constexpr unique_ptr(U p, see below d) noexcept;
|
| 87 |
+
template<class U> constexpr unique_ptr(U p, see below d) noexcept;
|
| 88 |
```
|
| 89 |
|
| 90 |
These constructors behave the same as the constructors in the primary
|
| 91 |
template that take a parameter of type `pointer` and a second parameter.
|
| 92 |
|
|
|
|
| 96 |
- `U` is `nullptr_t`, or
|
| 97 |
- `pointer` is the same type as `element_type*`, `U` is a pointer type
|
| 98 |
`V*`, and `V(*)[]` is convertible to `element_type(*)[]`.
|
| 99 |
|
| 100 |
``` cpp
|
| 101 |
+
template<class U, class E> constexpr unique_ptr(unique_ptr<U, E>&& u) noexcept;
|
| 102 |
```
|
| 103 |
|
| 104 |
This constructor behaves the same as in the primary template.
|
| 105 |
|
| 106 |
*Constraints:* Where `UP` is `unique_ptr<U, E>`:
|
|
|
|
| 116 |
primary template. — *end note*]
|
| 117 |
|
| 118 |
##### Assignment <a id="unique.ptr.runtime.asgn">[[unique.ptr.runtime.asgn]]</a>
|
| 119 |
|
| 120 |
``` cpp
|
| 121 |
+
template<class U, class E> constexpr unique_ptr& operator=(unique_ptr<U, E>&& u) noexcept;
|
| 122 |
```
|
| 123 |
|
| 124 |
This operator behaves the same as in the primary template.
|
| 125 |
|
| 126 |
*Constraints:* Where `UP` is `unique_ptr<U, E>`:
|
|
|
|
| 135 |
primary template. — *end note*]
|
| 136 |
|
| 137 |
##### Observers <a id="unique.ptr.runtime.observers">[[unique.ptr.runtime.observers]]</a>
|
| 138 |
|
| 139 |
``` cpp
|
| 140 |
+
constexpr T& operator[](size_t i) const;
|
| 141 |
```
|
| 142 |
|
| 143 |
*Preconditions:* `i` < the number of elements in the array to which the
|
| 144 |
stored pointer points.
|
| 145 |
|
| 146 |
*Returns:* `get()[i]`.
|
| 147 |
|
| 148 |
##### Modifiers <a id="unique.ptr.runtime.modifiers">[[unique.ptr.runtime.modifiers]]</a>
|
| 149 |
|
| 150 |
``` cpp
|
| 151 |
+
constexpr void reset(nullptr_t p = nullptr) noexcept;
|
| 152 |
```
|
| 153 |
|
| 154 |
*Effects:* Equivalent to `reset(pointer())`.
|
| 155 |
|
| 156 |
``` cpp
|
| 157 |
+
constexpr template<class U> void reset(U p) noexcept;
|
| 158 |
```
|
| 159 |
|
| 160 |
This function behaves the same as the `reset` member of the primary
|
| 161 |
template.
|
| 162 |
|