tmp/tmp7ty4uezh/{from.md → to.md}
RENAMED
|
@@ -1,15 +1,15 @@
|
|
| 1 |
##### Observers <a id="util.smartptr.shared.obs">[[util.smartptr.shared.obs]]</a>
|
| 2 |
|
| 3 |
``` cpp
|
| 4 |
-
element_type* get() const noexcept;
|
| 5 |
```
|
| 6 |
|
| 7 |
*Returns:* The stored pointer.
|
| 8 |
|
| 9 |
``` cpp
|
| 10 |
-
T& operator*() const noexcept;
|
| 11 |
```
|
| 12 |
|
| 13 |
*Preconditions:* `get() != nullptr`.
|
| 14 |
|
| 15 |
*Returns:* `*get()`.
|
|
@@ -19,11 +19,11 @@ whether this member function is declared. If it is declared, it is
|
|
| 19 |
unspecified what its return type is, except that the declaration
|
| 20 |
(although not necessarily the definition) of the function shall be
|
| 21 |
well-formed.
|
| 22 |
|
| 23 |
``` cpp
|
| 24 |
-
T* operator->() const noexcept;
|
| 25 |
```
|
| 26 |
|
| 27 |
*Preconditions:* `get() != nullptr`.
|
| 28 |
|
| 29 |
*Returns:* `get()`.
|
|
@@ -32,15 +32,16 @@ T* operator->() const noexcept;
|
|
| 32 |
member function is declared. If it is declared, it is unspecified what
|
| 33 |
its return type is, except that the declaration (although not
|
| 34 |
necessarily the definition) of the function shall be well-formed.
|
| 35 |
|
| 36 |
``` cpp
|
| 37 |
-
element_type& operator[](ptrdiff_t i) const;
|
| 38 |
```
|
| 39 |
|
| 40 |
-
*Preconditions:* `get() != nullptr
|
| 41 |
-
|
|
|
|
| 42 |
|
| 43 |
*Returns:* `get()[i]`.
|
| 44 |
|
| 45 |
*Throws:* Nothing.
|
| 46 |
|
|
@@ -48,11 +49,11 @@ element_type& operator[](ptrdiff_t i) const;
|
|
| 48 |
member function is declared. If it is declared, it is unspecified what
|
| 49 |
its return type is, except that the declaration (although not
|
| 50 |
necessarily the definition) of the function shall be well-formed.
|
| 51 |
|
| 52 |
``` cpp
|
| 53 |
-
long use_count() const noexcept;
|
| 54 |
```
|
| 55 |
|
| 56 |
*Synchronization:* None.
|
| 57 |
|
| 58 |
*Returns:* The number of `shared_ptr` objects, `*this` included, that
|
|
@@ -68,24 +69,41 @@ share ownership with `*this`, or `0` when `*this` is empty.
|
|
| 68 |
`use_count()`, the result is approximate. In particular,
|
| 69 |
`use_count() == 1` does not imply that accesses through a previously
|
| 70 |
destroyed `shared_ptr` have in any sense completed. — *end note*]
|
| 71 |
|
| 72 |
``` cpp
|
| 73 |
-
explicit operator bool() const noexcept;
|
| 74 |
```
|
| 75 |
|
| 76 |
*Returns:* `get() != nullptr`.
|
| 77 |
|
| 78 |
``` cpp
|
| 79 |
-
template<class U> bool owner_before(const shared_ptr<U>& b) const noexcept;
|
| 80 |
-
template<class U> bool owner_before(const weak_ptr<U>& b) const noexcept;
|
| 81 |
```
|
| 82 |
|
| 83 |
*Returns:* An unspecified value such that
|
| 84 |
|
| 85 |
-
- `
|
| 86 |
in [[alg.sorting]];
|
| 87 |
-
-
|
| 88 |
-
`
|
| 89 |
-
|
| 90 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 91 |
|
|
|
|
| 1 |
##### Observers <a id="util.smartptr.shared.obs">[[util.smartptr.shared.obs]]</a>
|
| 2 |
|
| 3 |
``` cpp
|
| 4 |
+
constexpr element_type* get() const noexcept;
|
| 5 |
```
|
| 6 |
|
| 7 |
*Returns:* The stored pointer.
|
| 8 |
|
| 9 |
``` cpp
|
| 10 |
+
constexpr T& operator*() const noexcept;
|
| 11 |
```
|
| 12 |
|
| 13 |
*Preconditions:* `get() != nullptr`.
|
| 14 |
|
| 15 |
*Returns:* `*get()`.
|
|
|
|
| 19 |
unspecified what its return type is, except that the declaration
|
| 20 |
(although not necessarily the definition) of the function shall be
|
| 21 |
well-formed.
|
| 22 |
|
| 23 |
``` cpp
|
| 24 |
+
constexpr T* operator->() const noexcept;
|
| 25 |
```
|
| 26 |
|
| 27 |
*Preconditions:* `get() != nullptr`.
|
| 28 |
|
| 29 |
*Returns:* `get()`.
|
|
|
|
| 32 |
member function is declared. If it is declared, it is unspecified what
|
| 33 |
its return type is, except that the declaration (although not
|
| 34 |
necessarily the definition) of the function shall be well-formed.
|
| 35 |
|
| 36 |
``` cpp
|
| 37 |
+
constexpr element_type& operator[](ptrdiff_t i) const;
|
| 38 |
```
|
| 39 |
|
| 40 |
+
*Preconditions:* `get() != nullptr` is `true`.
|
| 41 |
+
|
| 42 |
+
`i` ≥ 0. If `T` is `U[N]`, `i` < `N`.
|
| 43 |
|
| 44 |
*Returns:* `get()[i]`.
|
| 45 |
|
| 46 |
*Throws:* Nothing.
|
| 47 |
|
|
|
|
| 49 |
member function is declared. If it is declared, it is unspecified what
|
| 50 |
its return type is, except that the declaration (although not
|
| 51 |
necessarily the definition) of the function shall be well-formed.
|
| 52 |
|
| 53 |
``` cpp
|
| 54 |
+
constexpr long use_count() const noexcept;
|
| 55 |
```
|
| 56 |
|
| 57 |
*Synchronization:* None.
|
| 58 |
|
| 59 |
*Returns:* The number of `shared_ptr` objects, `*this` included, that
|
|
|
|
| 69 |
`use_count()`, the result is approximate. In particular,
|
| 70 |
`use_count() == 1` does not imply that accesses through a previously
|
| 71 |
destroyed `shared_ptr` have in any sense completed. — *end note*]
|
| 72 |
|
| 73 |
``` cpp
|
| 74 |
+
constexpr explicit operator bool() const noexcept;
|
| 75 |
```
|
| 76 |
|
| 77 |
*Returns:* `get() != nullptr`.
|
| 78 |
|
| 79 |
``` cpp
|
| 80 |
+
template<class U> constexpr bool owner_before(const shared_ptr<U>& b) const noexcept;
|
| 81 |
+
template<class U> constexpr bool owner_before(const weak_ptr<U>& b) const noexcept;
|
| 82 |
```
|
| 83 |
|
| 84 |
*Returns:* An unspecified value such that
|
| 85 |
|
| 86 |
+
- `owner_before(b)` defines a strict weak ordering as defined
|
| 87 |
in [[alg.sorting]];
|
| 88 |
+
- `!owner_before(b) && !b.owner_before(*this)` is `true` if and only if
|
| 89 |
+
`owner_equal(b)` is `true`.
|
| 90 |
+
|
| 91 |
+
``` cpp
|
| 92 |
+
size_t owner_hash() const noexcept;
|
| 93 |
+
```
|
| 94 |
+
|
| 95 |
+
*Returns:* An unspecified value such that, for any object `x` where
|
| 96 |
+
`owner_equal(x)` is `true`, `owner_hash() == x.owner_hash()` is `true`.
|
| 97 |
+
|
| 98 |
+
``` cpp
|
| 99 |
+
template<class U>
|
| 100 |
+
constexpr bool owner_equal(const shared_ptr<U>& b) const noexcept;
|
| 101 |
+
template<class U>
|
| 102 |
+
constexpr bool owner_equal(const weak_ptr<U>& b) const noexcept;
|
| 103 |
+
```
|
| 104 |
+
|
| 105 |
+
*Returns:* `true` if and only if `*this` and `b` share ownership or are
|
| 106 |
+
both empty. Otherwise returns `false`.
|
| 107 |
+
|
| 108 |
+
*Remarks:* `owner_equal` is an equivalence relation.
|
| 109 |
|