forked from boostorg/smart_ptr
Document weak_ptr aliasing constructors and empty
This commit is contained in:
@ -132,7 +132,6 @@ namespace boost {
|
|||||||
template<class Y> shared_ptr(shared_ptr<Y> && r) noexcept;
|
template<class Y> shared_ptr(shared_ptr<Y> && r) noexcept;
|
||||||
|
|
||||||
template<class Y> shared_ptr(shared_ptr<Y> const & r, element_type * p) noexcept;
|
template<class Y> shared_ptr(shared_ptr<Y> const & r, element_type * p) noexcept;
|
||||||
|
|
||||||
template<class Y> shared_ptr(shared_ptr<Y> && r, element_type * p) noexcept;
|
template<class Y> shared_ptr(shared_ptr<Y> && r, element_type * p) noexcept;
|
||||||
|
|
||||||
template<class Y> explicit shared_ptr(weak_ptr<Y> const & r);
|
template<class Y> explicit shared_ptr(weak_ptr<Y> const & r);
|
||||||
@ -373,7 +372,7 @@ template<class Y> shared_ptr(shared_ptr<Y> const & r, element_type * p) noexcept
|
|||||||
[none]
|
[none]
|
||||||
* {blank}
|
* {blank}
|
||||||
+
|
+
|
||||||
Effects:: constructs a `shared_ptr` that shares ownership with `r` and stores `p`.
|
Effects:: Copy-constructs a `shared_ptr` from `r`, while storing `p` instead.
|
||||||
|
|
||||||
Postconditions:: `get() == p && use_count() == r.use_count()`.
|
Postconditions:: `get() == p && use_count() == r.use_count()`.
|
||||||
|
|
||||||
|
@ -88,6 +88,10 @@ namespace boost {
|
|||||||
|
|
||||||
weak_ptr(weak_ptr && r) noexcept;
|
weak_ptr(weak_ptr && r) noexcept;
|
||||||
|
|
||||||
|
template<class Y> weak_ptr(shared_ptr<Y> const & r, element_type * p) noexcept;
|
||||||
|
template<class Y> weak_ptr(weak_ptr<Y> const & r, element_type * p) noexcept;
|
||||||
|
template<class Y> weak_ptr(weak_ptr<Y> && r, element_type * p) noexcept;
|
||||||
|
|
||||||
~weak_ptr() noexcept;
|
~weak_ptr() noexcept;
|
||||||
|
|
||||||
weak_ptr & operator=(weak_ptr const & r) noexcept;
|
weak_ptr & operator=(weak_ptr const & r) noexcept;
|
||||||
@ -98,6 +102,8 @@ namespace boost {
|
|||||||
long use_count() const noexcept;
|
long use_count() const noexcept;
|
||||||
bool expired() const noexcept;
|
bool expired() const noexcept;
|
||||||
|
|
||||||
|
bool empty() const noexcept;
|
||||||
|
|
||||||
shared_ptr<T> lock() const noexcept;
|
shared_ptr<T> lock() const noexcept;
|
||||||
|
|
||||||
void reset() noexcept;
|
void reset() noexcept;
|
||||||
@ -157,6 +163,21 @@ weak_ptr(weak_ptr && r) noexcept;
|
|||||||
Effects:: Constructs a `weak_ptr` that has the value `r` held.
|
Effects:: Constructs a `weak_ptr` that has the value `r` held.
|
||||||
Postconditions:: `r` is empty.
|
Postconditions:: `r` is empty.
|
||||||
|
|
||||||
|
### aliasing constructors
|
||||||
|
```
|
||||||
|
template<class Y> weak_ptr(shared_ptr<Y> const & r, element_type * p) noexcept;
|
||||||
|
```
|
||||||
|
```
|
||||||
|
template<class Y> weak_ptr(weak_ptr<Y> const & r, element_type * p) noexcept;
|
||||||
|
```
|
||||||
|
```
|
||||||
|
template<class Y> weak_ptr(weak_ptr<Y> && r, element_type * p) noexcept;
|
||||||
|
```
|
||||||
|
Effects:: Constructs a `weak_ptr` from `r` as if by using the corresponding converting/copy/move constructor, but stores `p` instead.
|
||||||
|
Postconditions:: `use_count() == r.use_count()`. When `!expired()`, `shared_ptr<T>(*this).get() == p`.
|
||||||
|
|
||||||
|
NOTE: These constructors are an extension, not present in `std::weak_ptr`.
|
||||||
|
|
||||||
### destructor
|
### destructor
|
||||||
```
|
```
|
||||||
~weak_ptr() noexcept;
|
~weak_ptr() noexcept;
|
||||||
@ -204,6 +225,17 @@ bool expired() const noexcept;
|
|||||||
+
|
+
|
||||||
Returns:: `use_count() == 0`.
|
Returns:: `use_count() == 0`.
|
||||||
|
|
||||||
|
### empty
|
||||||
|
```
|
||||||
|
bool empty() const noexcept;
|
||||||
|
```
|
||||||
|
[none]
|
||||||
|
* {blank}
|
||||||
|
+
|
||||||
|
Returns:: `true` when `*this` is empty, `false` otherwise.
|
||||||
|
|
||||||
|
NOTE: This function is an extension, not present in `std::weak_ptr`.
|
||||||
|
|
||||||
### lock
|
### lock
|
||||||
```
|
```
|
||||||
shared_ptr<T> lock() const noexcept;
|
shared_ptr<T> lock() const noexcept;
|
||||||
|
Reference in New Issue
Block a user