|
|
delpi
0.0.1
DElta-complete LP solver
|
Pointer to a generic object that supports intrusive reference counting. More...
#include <intrusive_ptr.hpp>
Public Types | |
| typedef T | element_type |
| The type this intrusive_ptr points to. | |
Public Member Functions | |
| intrusive_ptr (T *p, const bool add_ref=true) | |
| Construct a new intrusive_ptr object wrapping the given pointer p. | |
| intrusive_ptr (const intrusive_ptr &ip) | |
| Construct a new intrusive_ptr object from another intrusive_ptr object. | |
| intrusive_ptr (intrusive_ptr &&ip) noexcept | |
| Construct a new intrusive_ptr object from another intrusive_ptr object using move semantics. | |
| ~intrusive_ptr () | |
| Destruct the intrusive_ptr object, releasing the owned pointer. | |
| intrusive_ptr & | operator= (const intrusive_ptr &ip) |
| Copy assignment operator. | |
| intrusive_ptr & | operator= (intrusive_ptr &&ip) noexcept |
| Move assignment operator. | |
| intrusive_ptr & | operator= (T *ptr) |
| Copy assignment operator. | |
| void | reset () |
| Release the owned pointer, decrementing the reference count and setting ptr_ to null. | |
| void | swap (intrusive_ptr &ip) noexcept |
| Exchanges the owned pointer between two intrusive_ptr objects. | |
| void | attach (T *ptr) |
| Sets the owned pointer to the given pointer ptr without incrementing the reference count. | |
| T * | detach () |
| Surrenders the reference held by an intrusive_ptr pointer. | |
| operator bool_ () const noexcept | |
| Implicit bool conversion. | |
Protected Attributes | |
| T * | ptr_ |
| Raw pointer to the data. | |
Pointer to a generic object that supports intrusive reference counting.
Implementation based on the EASTL intrusive_ptr.
| T | class the intrusive_ptr is pointing to. Must have AddRef and Release methods. |
Definition at line 22 of file intrusive_ptr.hpp.
|
inlineexplicit |
Construct a new intrusive_ptr object wrapping the given pointer p.
If add_ref is true, the reference count of the object is incremented immediately.
| p | pointer to the object |
| add_ref | whether to increment the reference count |
Definition at line 39 of file intrusive_ptr.hpp.
|
inline |
Construct a new intrusive_ptr object from another intrusive_ptr object.
AddRef is immediately run on the object. The source intrusive_ptr object maintains its AddRef on the pointer.
| ip | intrusive_ptr object to copy |
Definition at line 53 of file intrusive_ptr.hpp.
|
inlinenoexcept |
Construct a new intrusive_ptr object from another intrusive_ptr object using move semantics.
| ip | intrusive_ptr object to move |
Definition at line 60 of file intrusive_ptr.hpp.
|
inline |
Sets the owned pointer to the given pointer ptr without incrementing the reference count.
The intrusive_ptr eventually only does a Release() on the object. Useful for assuming a reference that someone else has handed you and making sure it is always released.
| ptr | pointer to the object |
Definition at line 131 of file intrusive_ptr.hpp.
|
inline |
Surrenders the reference held by an intrusive_ptr pointer.
It returns the current reference and nulls the pointer without decrementing the reference count. Therefore, if the returned pointer is non-null it must be eventually released by the caller.
Definition at line 144 of file intrusive_ptr.hpp.
|
inlinenoexcept |
Implicit bool conversion.
Allows the intrusive_ptr to be used as a boolean in checks.
Definition at line 163 of file intrusive_ptr.hpp.
|
inline |
Copy assignment operator.
AddRef is immediately run on the object. The source ip maintains its reference to the pointer. If this pointer was already in use, the old object is released at the end.
| ip | intrusive_ptr object to copy |
Definition at line 76 of file intrusive_ptr.hpp.
|
inlinenoexcept |
Move assignment operator.
| ip | intrusive_ptr object to move |
Definition at line 86 of file intrusive_ptr.hpp.
|
inline |
Copy assignment operator.
AddRef is immediately run on the object. If this pointer was already in use, the old object is released at the end.
| ptr | raw pointer to the object |
Definition at line 100 of file intrusive_ptr.hpp.
|
inlinenoexcept |
Exchanges the owned pointer between two intrusive_ptr objects.
| ip | intrusive_ptr object to swap with |
Definition at line 122 of file intrusive_ptr.hpp.