cgv
|
#include <ref_ptr.h>
Public Types | |
typedef ref_ptr< T, is_ref_counted > | this_type |
type of the reference counted pointer | |
typedef ref_ptr_impl< T, is_ref_counted > | base_type |
type of base class that implements the reference count specific methods | |
Public Member Functions | |
ref_ptr (T *p=0) | |
construction from pointer or empty if pointer is not given | |
ref_ptr (const this_type &r) | |
copy constructor for reference pointers of the same type | |
~ref_ptr () | |
destruct reference counted pointer | |
template<typename S > | |
ref_ptr (const ref_ptr< S, is_ref_counted > &s) | |
allow to copy ref_ptr | |
template<typename S > | |
ref_ptr< S, is_ref_counted > | up_cast () const |
use static cast to convert from T to S if T is a base class of S and has a virtual destructor | |
this_type & | operator= (const this_type &r) |
assignment to pointer of same type | |
template<typename S > | |
this_type & | operator= (const ref_ptr< S, is_ref_counted > &r) |
assignment to pointer of derived type with virtual destructor | |
T & | operator* () const |
access to element | |
T * | operator-> () const |
access to element pointer | |
bool | operator== (const this_type &r) const |
compare by pointer | |
bool | operator< (const this_type &r) const |
compare by pointer | |
bool | operator!= (const this_type &r) const |
compare by pointer | |
bool | unique () const |
check if this is the only reference | |
bool | empty () const |
check if pointer is not yet set | |
operator bool () const | |
conversion to bool results in false if the stored pointer is a null pointer | |
void | clear () |
set to null pointer | |
reference counted pointer, which can work together with types that are derived from ref_counted, in which case the reference count of ref_counted is used. Otherwise a reference count is allocated and access to the stored instance needs to follow two pointers.