tmp/tmpm_jgzw82/{from.md → to.md}
RENAMED
|
@@ -1,62 +1,85 @@
|
|
| 1 |
##### `shared_ptr` observers <a id="util.smartptr.shared.obs">[[util.smartptr.shared.obs]]</a>
|
| 2 |
|
| 3 |
``` cpp
|
| 4 |
-
|
| 5 |
```
|
| 6 |
|
| 7 |
-
*Returns:*
|
| 8 |
|
| 9 |
``` cpp
|
| 10 |
T& operator*() const noexcept;
|
| 11 |
```
|
| 12 |
|
| 13 |
*Requires:* `get() != 0`.
|
| 14 |
|
| 15 |
*Returns:* `*get()`.
|
| 16 |
|
| 17 |
-
*Remarks:* When `T` is `void`, it is unspecified
|
| 18 |
-
function is declared. If it is declared, it is
|
| 19 |
-
return type is, except that the declaration
|
| 20 |
-
the definition) of the function shall be well
|
|
|
|
| 21 |
|
| 22 |
``` cpp
|
| 23 |
T* operator->() const noexcept;
|
| 24 |
```
|
| 25 |
|
| 26 |
*Requires:* `get() != 0`.
|
| 27 |
|
| 28 |
*Returns:* `get()`.
|
| 29 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 30 |
``` cpp
|
| 31 |
long use_count() const noexcept;
|
| 32 |
```
|
| 33 |
|
| 34 |
-
*Returns:*
|
| 35 |
-
|
| 36 |
|
| 37 |
-
|
| 38 |
|
| 39 |
-
``
|
| 40 |
-
|
| 41 |
-
```
|
| 42 |
|
| 43 |
-
*
|
|
|
|
| 44 |
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
`
|
|
|
|
|
|
|
| 48 |
|
| 49 |
``` cpp
|
| 50 |
explicit operator bool() const noexcept;
|
| 51 |
```
|
| 52 |
|
| 53 |
*Returns:* `get() != 0`.
|
| 54 |
|
| 55 |
``` cpp
|
| 56 |
-
template<class U> bool owner_before(shared_ptr<U>
|
| 57 |
-
template<class U> bool owner_before(weak_ptr<U>
|
| 58 |
```
|
| 59 |
|
| 60 |
*Returns:* An unspecified value such that
|
| 61 |
|
| 62 |
- `x.owner_before(y)` defines a strict weak ordering as defined
|
|
|
|
| 1 |
##### `shared_ptr` 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 |
*Requires:* `get() != 0`.
|
| 14 |
|
| 15 |
*Returns:* `*get()`.
|
| 16 |
|
| 17 |
+
*Remarks:* When `T` is an array type or cv `void`, it is unspecified
|
| 18 |
+
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 well
|
| 21 |
+
formed.
|
| 22 |
|
| 23 |
``` cpp
|
| 24 |
T* operator->() const noexcept;
|
| 25 |
```
|
| 26 |
|
| 27 |
*Requires:* `get() != 0`.
|
| 28 |
|
| 29 |
*Returns:* `get()`.
|
| 30 |
|
| 31 |
+
*Remarks:* When `T` is an array type, it is unspecified whether this
|
| 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 |
+
*Requires:* `get() != 0 && i >= 0`. If `T` is `U[N]`, `i < N`.
|
| 41 |
+
|
| 42 |
+
*Returns:* `get()[i]`.
|
| 43 |
+
|
| 44 |
+
*Remarks:* When `T` is not an array type, it is unspecified whether this
|
| 45 |
+
member function is declared. If it is declared, it is unspecified what
|
| 46 |
+
its return type is, except that the declaration (although not
|
| 47 |
+
necessarily the definition) of the function shall be well formed.
|
| 48 |
+
|
| 49 |
+
*Throws:* Nothing.
|
| 50 |
+
|
| 51 |
``` cpp
|
| 52 |
long use_count() const noexcept;
|
| 53 |
```
|
| 54 |
|
| 55 |
+
*Returns:* The number of `shared_ptr` objects, `*this` included, that
|
| 56 |
+
share ownership with `*this`, or `0` when `*this` is empty.
|
| 57 |
|
| 58 |
+
*Synchronization:* None.
|
| 59 |
|
| 60 |
+
[*Note 4*: `get() == nullptr` does not imply a specific return value of
|
| 61 |
+
`use_count()`. — *end note*]
|
|
|
|
| 62 |
|
| 63 |
+
[*Note 5*: `weak_ptr<T>::lock()` can affect the return value of
|
| 64 |
+
`use_count()`. — *end note*]
|
| 65 |
|
| 66 |
+
[*Note 6*: When multiple threads can affect the return value of
|
| 67 |
+
`use_count()`, the result should be treated as approximate. In
|
| 68 |
+
particular, `use_count() == 1` does not imply that accesses through a
|
| 69 |
+
previously destroyed `shared_ptr` have in any sense
|
| 70 |
+
completed. — *end note*]
|
| 71 |
|
| 72 |
``` cpp
|
| 73 |
explicit operator bool() const noexcept;
|
| 74 |
```
|
| 75 |
|
| 76 |
*Returns:* `get() != 0`.
|
| 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 |
- `x.owner_before(y)` defines a strict weak ordering as defined
|