tmp/tmp4c2245uo/{from.md → to.md}
RENAMED
|
@@ -1,6 +1,6 @@
|
|
| 1 |
-
####
|
| 2 |
|
| 3 |
``` cpp
|
| 4 |
element_type* get() const noexcept;
|
| 5 |
```
|
| 6 |
|
|
@@ -8,45 +8,45 @@ element_type* get() const noexcept;
|
|
| 8 |
|
| 9 |
``` cpp
|
| 10 |
T& operator*() const noexcept;
|
| 11 |
```
|
| 12 |
|
| 13 |
-
*
|
| 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
|
| 21 |
-
formed.
|
| 22 |
|
| 23 |
``` cpp
|
| 24 |
T* operator->() const noexcept;
|
| 25 |
```
|
| 26 |
|
| 27 |
-
*
|
| 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
|
| 35 |
|
| 36 |
``` cpp
|
| 37 |
element_type& operator[](ptrdiff_t i) const;
|
| 38 |
```
|
| 39 |
|
| 40 |
-
*
|
| 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
|
| 48 |
|
| 49 |
*Throws:* Nothing.
|
| 50 |
|
| 51 |
``` cpp
|
| 52 |
long use_count() const noexcept;
|
|
@@ -55,17 +55,17 @@ long use_count() const noexcept;
|
|
| 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
|
| 61 |
`use_count()`. — *end note*]
|
| 62 |
|
| 63 |
-
[*Note
|
| 64 |
`use_count()`. — *end note*]
|
| 65 |
|
| 66 |
-
[*Note
|
| 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 |
|
|
|
|
| 1 |
+
#### Observers <a id="util.smartptr.shared.obs">[[util.smartptr.shared.obs]]</a>
|
| 2 |
|
| 3 |
``` cpp
|
| 4 |
element_type* get() const noexcept;
|
| 5 |
```
|
| 6 |
|
|
|
|
| 8 |
|
| 9 |
``` cpp
|
| 10 |
T& operator*() const noexcept;
|
| 11 |
```
|
| 12 |
|
| 13 |
+
*Preconditions:* `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
|
| 21 |
+
well-formed.
|
| 22 |
|
| 23 |
``` cpp
|
| 24 |
T* operator->() const noexcept;
|
| 25 |
```
|
| 26 |
|
| 27 |
+
*Preconditions:* `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 |
+
*Preconditions:* `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;
|
|
|
|
| 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 1*: `get() == nullptr` does not imply a specific return value of
|
| 61 |
`use_count()`. — *end note*]
|
| 62 |
|
| 63 |
+
[*Note 2*: `weak_ptr<T>::lock()` can affect the return value of
|
| 64 |
`use_count()`. — *end note*]
|
| 65 |
|
| 66 |
+
[*Note 3*: 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 |
|