Update documentation of intrusive_ptr (document move ops, fix op<)

This commit is contained in:
Peter Dimov
2018-11-25 17:54:51 +02:00
parent f6c3508aee
commit 2e57ddb953

View File

@@ -54,12 +54,18 @@ namespace boost {
intrusive_ptr(intrusive_ptr const & r); intrusive_ptr(intrusive_ptr const & r);
template<class Y> intrusive_ptr(intrusive_ptr<Y> const & r); template<class Y> intrusive_ptr(intrusive_ptr<Y> const & r);
intrusive_ptr(intrusive_ptr && r);
template<class Y> intrusive_ptr(intrusive_ptr<Y> && r);
~intrusive_ptr(); ~intrusive_ptr();
intrusive_ptr & operator=(intrusive_ptr const & r); intrusive_ptr & operator=(intrusive_ptr const & r);
template<class Y> intrusive_ptr & operator=(intrusive_ptr<Y> const & r); template<class Y> intrusive_ptr & operator=(intrusive_ptr<Y> const & r);
intrusive_ptr & operator=(T * r); intrusive_ptr & operator=(T * r);
intrusive_ptr & operator=(intrusive_ptr && r);
template<class Y> intrusive_ptr & operator=(intrusive_ptr<Y> && r);
void reset(); void reset();
void reset(T * r); void reset(T * r);
void reset(T * r, bool add_ref); void reset(T * r, bool add_ref);
@@ -92,8 +98,8 @@ namespace boost {
template<class T, class U> template<class T, class U>
bool operator!=(T * a, intrusive_ptr<U> const & b) noexcept; bool operator!=(T * a, intrusive_ptr<U> const & b) noexcept;
template<class T, class U> template<class T>
bool operator<(intrusive_ptr<T> const & a, intrusive_ptr<U> const & b) noexcept; bool operator<(intrusive_ptr<T> const & a, intrusive_ptr<T> const & b) noexcept;
template<class T> void swap(intrusive_ptr<T> & a, intrusive_ptr<T> & b) noexcept; template<class T> void swap(intrusive_ptr<T> & a, intrusive_ptr<T> & b) noexcept;
@@ -158,6 +164,18 @@ template<class Y> intrusive_ptr(intrusive_ptr<Y> const & r);
Effects:: `T * p = r.get(); if(p != 0) intrusive_ptr_add_ref(p);`. Effects:: `T * p = r.get(); if(p != 0) intrusive_ptr_add_ref(p);`.
Postconditions:: `get() == r.get()`. Postconditions:: `get() == r.get()`.
```
intrusive_ptr(intrusive_ptr && r);
```
```
template<class Y> intrusive_ptr(intrusive_ptr<Y> && r);
```
[none]
* {blank}
+
Postconditions:: `get()` equals the old value of `r.get()`. `r.get() == 0`.
### destructor ### destructor
``` ```
@@ -187,6 +205,19 @@ intrusive_ptr & operator=(T * r);
Effects:: Equivalent to `intrusive_ptr(r).swap(*this)`. Effects:: Equivalent to `intrusive_ptr(r).swap(*this)`.
Returns:: `*this`. Returns:: `*this`.
```
intrusive_ptr & operator=(intrusive_ptr && r);
```
```
template<class Y> intrusive_ptr & operator=(intrusive_ptr<Y> && r);
```
[none]
* {blank}
+
Effects:: Equivalent to `intrusive_ptr(std::move(r)).swap(*this)`.
Returns:: `*this`.
### reset ### reset
``` ```
@@ -361,8 +392,8 @@ template<class T, class U>
Returns:: `a != b.get()`. Returns:: `a != b.get()`.
``` ```
template<class T, class U> template<class T>
bool operator<(intrusive_ptr<T> const & a, intrusive_ptr<U> const & b) noexcept; bool operator<(intrusive_ptr<T> const & a, intrusive_ptr<T> const & b) noexcept;
``` ```
[none] [none]