From 2e57ddb953bdbaf06363b87e9a4dca0a68c9562a Mon Sep 17 00:00:00 2001 From: Peter Dimov Date: Sun, 25 Nov 2018 17:54:51 +0200 Subject: [PATCH] Update documentation of intrusive_ptr (document move ops, fix op<) --- doc/smart_ptr/intrusive_ptr.adoc | 39 ++++++++++++++++++++++++++++---- 1 file changed, 35 insertions(+), 4 deletions(-) diff --git a/doc/smart_ptr/intrusive_ptr.adoc b/doc/smart_ptr/intrusive_ptr.adoc index daf6794..cb30a04 100644 --- a/doc/smart_ptr/intrusive_ptr.adoc +++ b/doc/smart_ptr/intrusive_ptr.adoc @@ -54,12 +54,18 @@ namespace boost { intrusive_ptr(intrusive_ptr const & r); template intrusive_ptr(intrusive_ptr const & r); + intrusive_ptr(intrusive_ptr && r); + template intrusive_ptr(intrusive_ptr && r); + ~intrusive_ptr(); intrusive_ptr & operator=(intrusive_ptr const & r); template intrusive_ptr & operator=(intrusive_ptr const & r); intrusive_ptr & operator=(T * r); + intrusive_ptr & operator=(intrusive_ptr && r); + template intrusive_ptr & operator=(intrusive_ptr && r); + void reset(); void reset(T * r); void reset(T * r, bool add_ref); @@ -92,8 +98,8 @@ namespace boost { template bool operator!=(T * a, intrusive_ptr const & b) noexcept; - template - bool operator<(intrusive_ptr const & a, intrusive_ptr const & b) noexcept; + template + bool operator<(intrusive_ptr const & a, intrusive_ptr const & b) noexcept; template void swap(intrusive_ptr & a, intrusive_ptr & b) noexcept; @@ -158,6 +164,18 @@ template intrusive_ptr(intrusive_ptr const & r); Effects:: `T * p = r.get(); if(p != 0) intrusive_ptr_add_ref(p);`. Postconditions:: `get() == r.get()`. +``` +intrusive_ptr(intrusive_ptr && r); +``` +``` +template intrusive_ptr(intrusive_ptr && r); +``` + +[none] +* {blank} ++ +Postconditions:: `get()` equals the old value of `r.get()`. `r.get() == 0`. + ### destructor ``` @@ -187,6 +205,19 @@ intrusive_ptr & operator=(T * r); Effects:: Equivalent to `intrusive_ptr(r).swap(*this)`. Returns:: `*this`. +``` +intrusive_ptr & operator=(intrusive_ptr && r); +``` +``` +template intrusive_ptr & operator=(intrusive_ptr && r); +``` + +[none] +* {blank} ++ +Effects:: Equivalent to `intrusive_ptr(std::move(r)).swap(*this)`. +Returns:: `*this`. + ### reset ``` @@ -361,8 +392,8 @@ template Returns:: `a != b.get()`. ``` -template - bool operator<(intrusive_ptr const & a, intrusive_ptr const & b) noexcept; +template + bool operator<(intrusive_ptr const & a, intrusive_ptr const & b) noexcept; ``` [none]