tmp/tmp40hild86/{from.md → to.md}
RENAMED
|
@@ -1,31 +1,31 @@
|
|
| 1 |
-
#### Assignment <a id="util.smartptr.shared.assign">[[util.smartptr.shared.assign]]</a>
|
| 2 |
|
| 3 |
``` cpp
|
| 4 |
shared_ptr& operator=(const shared_ptr& r) noexcept;
|
| 5 |
template<class Y> shared_ptr& operator=(const shared_ptr<Y>& r) noexcept;
|
| 6 |
```
|
| 7 |
|
| 8 |
*Effects:* Equivalent to `shared_ptr(r).swap(*this)`.
|
| 9 |
|
| 10 |
*Returns:* `*this`.
|
| 11 |
|
| 12 |
-
[*Note
|
| 13 |
|
| 14 |
The use count updates caused by the temporary object construction and
|
| 15 |
-
destruction are not observable side effects, so the implementation
|
| 16 |
meet the effects (and the implied guarantees) via different means,
|
| 17 |
without creating a temporary. In particular, in the example:
|
| 18 |
|
| 19 |
``` cpp
|
| 20 |
shared_ptr<int> p(new int);
|
| 21 |
shared_ptr<void> q(p);
|
| 22 |
p = p;
|
| 23 |
q = p;
|
| 24 |
```
|
| 25 |
|
| 26 |
-
both assignments
|
| 27 |
|
| 28 |
— *end note*]
|
| 29 |
|
| 30 |
``` cpp
|
| 31 |
shared_ptr& operator=(shared_ptr&& r) noexcept;
|
|
|
|
| 1 |
+
##### Assignment <a id="util.smartptr.shared.assign">[[util.smartptr.shared.assign]]</a>
|
| 2 |
|
| 3 |
``` cpp
|
| 4 |
shared_ptr& operator=(const shared_ptr& r) noexcept;
|
| 5 |
template<class Y> shared_ptr& operator=(const shared_ptr<Y>& r) noexcept;
|
| 6 |
```
|
| 7 |
|
| 8 |
*Effects:* Equivalent to `shared_ptr(r).swap(*this)`.
|
| 9 |
|
| 10 |
*Returns:* `*this`.
|
| 11 |
|
| 12 |
+
[*Note 3*:
|
| 13 |
|
| 14 |
The use count updates caused by the temporary object construction and
|
| 15 |
+
destruction are not observable side effects, so the implementation can
|
| 16 |
meet the effects (and the implied guarantees) via different means,
|
| 17 |
without creating a temporary. In particular, in the example:
|
| 18 |
|
| 19 |
``` cpp
|
| 20 |
shared_ptr<int> p(new int);
|
| 21 |
shared_ptr<void> q(p);
|
| 22 |
p = p;
|
| 23 |
q = p;
|
| 24 |
```
|
| 25 |
|
| 26 |
+
both assignments can be no-ops.
|
| 27 |
|
| 28 |
— *end note*]
|
| 29 |
|
| 30 |
``` cpp
|
| 31 |
shared_ptr& operator=(shared_ptr&& r) noexcept;
|