#include <vbl_scoped_ptr.h>
vbl_scoped_ptr is a simple solution for simple needs; use vbl_shared_ptr or std::auto_ptr if your needs are more complex.
To use this to manage pointer member variables using forward declaration, explicitly define a destructor in your .cxx so that the vbl_scoped_ptr destructor is called there rather than being inlined. For example, Y.h:
struct X; struct Y { vbl_scoped_ptr<X> member; ~Y() { } // NO: causes ~vbl_scoped_ptr<X> to be instantated, which means X must be complete. ~Y(); // YES: destructor not yet generated };
#include "X.h" Y::~Y() { } // causes ~vbl_scoped_ptr<X> to be instantiated and inlined, but X is complete here, so all is well.
Definition at line 51 of file vbl_scoped_ptr.h.
Public Types | |
| typedef T | element_type |
Public Member Functions | |
| vbl_scoped_ptr (T *p=0) | |
| ~vbl_scoped_ptr () | |
| T must be complete when this destructor is instantiated. | |
| void | reset (T *p=0) |
| Make this own. | |
| T & | operator * () const |
| T * | operator-> () const |
| T * | get_pointer () const |
| operator safe_bool () const | |
| Safe implicit conversion to bool. | |
| bool | operator! () const |
| void | swap (vbl_scoped_ptr &b) |
Private Types | |
| typedef vbl_scoped_ptr< T > | this_type |
Private Member Functions | |
| vbl_scoped_ptr (vbl_scoped_ptr const &) | |
| vbl_scoped_ptr & | operator= (vbl_scoped_ptr const &) |
Private Attributes | |
| T * | ptr_ |
| VCL_SAFE_BOOL_DEFINE | |
|
|||||
|
Definition at line 65 of file vbl_scoped_ptr.h. |
|
|||||
|
Definition at line 60 of file vbl_scoped_ptr.h. |
|
||||||||||
|
|
|
||||||||||
|
Definition at line 68 of file vbl_scoped_ptr.h. |
|
|||||||||
|
T must be complete when this destructor is instantiated.
Definition at line 75 of file vbl_scoped_ptr.h. |
|
|||||||||
|
Definition at line 99 of file vbl_scoped_ptr.h. |
|
|||||||||
|
Definition at line 87 of file vbl_scoped_ptr.h. |
|
|||||||||
|
Safe implicit conversion to bool. This allows for if(sp) type of usage. Definition at line 109 of file vbl_scoped_ptr.h. |
|
|||||||||
|
Definition at line 115 of file vbl_scoped_ptr.h. |
|
|||||||||
|
Definition at line 93 of file vbl_scoped_ptr.h. |
|
||||||||||
|
|
|
||||||||||
|
Make this own.
Definition at line 81 of file vbl_scoped_ptr.h. |
|
||||||||||
|
Definition at line 121 of file vbl_scoped_ptr.h. |
|
|||||
|
Definition at line 54 of file vbl_scoped_ptr.h. |
|
|||||
|
Definition at line 62 of file vbl_scoped_ptr.h. |
1.4.4