tmp/tmpm857mz1z/{from.md → to.md}
RENAMED
|
@@ -37,16 +37,16 @@ pointer value and manually delete it on error or failure.
|
|
| 37 |
``` cpp
|
| 38 |
namespace std {
|
| 39 |
template<class Smart, class Pointer, class... Args>
|
| 40 |
class out_ptr_t {
|
| 41 |
public:
|
| 42 |
-
explicit out_ptr_t(Smart&, Args...);
|
| 43 |
out_ptr_t(const out_ptr_t&) = delete;
|
| 44 |
|
| 45 |
-
~out_ptr_t();
|
| 46 |
|
| 47 |
-
operator Pointer*() const noexcept;
|
| 48 |
operator void**() const noexcept;
|
| 49 |
|
| 50 |
private:
|
| 51 |
Smart& s; // exposition only
|
| 52 |
tuple<Args...> a; // exposition only
|
|
@@ -70,41 +70,40 @@ template.
|
|
| 70 |
|
| 71 |
Evaluations of the conversion functions on the same object may conflict
|
| 72 |
[[intro.races]].
|
| 73 |
|
| 74 |
``` cpp
|
| 75 |
-
explicit out_ptr_t(Smart& smart, Args... args);
|
| 76 |
```
|
| 77 |
|
| 78 |
*Effects:* Initializes `s` with `smart`, `a` with
|
| 79 |
`std::forward<Args>(args)...`, and value-initializes `p`. Then,
|
| 80 |
equivalent to:
|
| 81 |
|
| 82 |
-
-
|
|
|
|
| 83 |
s.reset();
|
| 84 |
```
|
| 85 |
|
| 86 |
if the expression `s.reset()` is well-formed;
|
| 87 |
-
|
| 88 |
- otherwise,
|
| 89 |
``` cpp
|
| 90 |
s = Smart();
|
| 91 |
```
|
| 92 |
|
| 93 |
if `is_constructible_v<Smart>` is `true`;
|
| 94 |
-
|
| 95 |
- otherwise, the program is ill-formed.
|
| 96 |
|
| 97 |
[*Note 1*: The constructor is not `noexcept` to allow for a variety of
|
| 98 |
non-terminating and safe implementation strategies. For example, an
|
| 99 |
implementation can allocate a `shared_ptr`’s internal node in the
|
| 100 |
constructor and let implementation-defined exceptions escape safely. The
|
| 101 |
destructor can then move the allocated control block in directly and
|
| 102 |
avoid any other exceptions. — *end note*]
|
| 103 |
|
| 104 |
``` cpp
|
| 105 |
-
~out_ptr_t();
|
| 106 |
```
|
| 107 |
|
| 108 |
Let `SP` be *`POINTER_OF_OR`*`(Smart, Pointer)` [[memory.general]].
|
| 109 |
|
| 110 |
*Effects:* Equivalent to:
|
|
@@ -130,11 +129,11 @@ Let `SP` be *`POINTER_OF_OR`*`(Smart, Pointer)` [[memory.general]].
|
|
| 130 |
|
| 131 |
if `is_constructible_v<Smart, SP, Args...>` is `true`;
|
| 132 |
- otherwise, the program is ill-formed.
|
| 133 |
|
| 134 |
``` cpp
|
| 135 |
-
operator Pointer*() const noexcept;
|
| 136 |
```
|
| 137 |
|
| 138 |
*Preconditions:* `operator void**()` has not been called on `*this`.
|
| 139 |
|
| 140 |
*Returns:* `addressof(const_cast<Pointer&>(p))`.
|
|
|
|
| 37 |
``` cpp
|
| 38 |
namespace std {
|
| 39 |
template<class Smart, class Pointer, class... Args>
|
| 40 |
class out_ptr_t {
|
| 41 |
public:
|
| 42 |
+
constexpr explicit out_ptr_t(Smart&, Args...);
|
| 43 |
out_ptr_t(const out_ptr_t&) = delete;
|
| 44 |
|
| 45 |
+
constexpr ~out_ptr_t();
|
| 46 |
|
| 47 |
+
constexpr operator Pointer*() const noexcept;
|
| 48 |
operator void**() const noexcept;
|
| 49 |
|
| 50 |
private:
|
| 51 |
Smart& s; // exposition only
|
| 52 |
tuple<Args...> a; // exposition only
|
|
|
|
| 70 |
|
| 71 |
Evaluations of the conversion functions on the same object may conflict
|
| 72 |
[[intro.races]].
|
| 73 |
|
| 74 |
``` cpp
|
| 75 |
+
constexpr explicit out_ptr_t(Smart& smart, Args... args);
|
| 76 |
```
|
| 77 |
|
| 78 |
*Effects:* Initializes `s` with `smart`, `a` with
|
| 79 |
`std::forward<Args>(args)...`, and value-initializes `p`. Then,
|
| 80 |
equivalent to:
|
| 81 |
|
| 82 |
+
-
|
| 83 |
+
``` cpp
|
| 84 |
s.reset();
|
| 85 |
```
|
| 86 |
|
| 87 |
if the expression `s.reset()` is well-formed;
|
|
|
|
| 88 |
- otherwise,
|
| 89 |
``` cpp
|
| 90 |
s = Smart();
|
| 91 |
```
|
| 92 |
|
| 93 |
if `is_constructible_v<Smart>` is `true`;
|
|
|
|
| 94 |
- otherwise, the program is ill-formed.
|
| 95 |
|
| 96 |
[*Note 1*: The constructor is not `noexcept` to allow for a variety of
|
| 97 |
non-terminating and safe implementation strategies. For example, an
|
| 98 |
implementation can allocate a `shared_ptr`’s internal node in the
|
| 99 |
constructor and let implementation-defined exceptions escape safely. The
|
| 100 |
destructor can then move the allocated control block in directly and
|
| 101 |
avoid any other exceptions. — *end note*]
|
| 102 |
|
| 103 |
``` cpp
|
| 104 |
+
constexpr ~out_ptr_t();
|
| 105 |
```
|
| 106 |
|
| 107 |
Let `SP` be *`POINTER_OF_OR`*`(Smart, Pointer)` [[memory.general]].
|
| 108 |
|
| 109 |
*Effects:* Equivalent to:
|
|
|
|
| 129 |
|
| 130 |
if `is_constructible_v<Smart, SP, Args...>` is `true`;
|
| 131 |
- otherwise, the program is ill-formed.
|
| 132 |
|
| 133 |
``` cpp
|
| 134 |
+
constexpr operator Pointer*() const noexcept;
|
| 135 |
```
|
| 136 |
|
| 137 |
*Preconditions:* `operator void**()` has not been called on `*this`.
|
| 138 |
|
| 139 |
*Returns:* `addressof(const_cast<Pointer&>(p))`.
|