#include <AutoPtr.hpp>
Public Types | |
typedef X | element_type |
Public Member Functions | |
AutoPtr (X *p=0) | |
Construct a new AutoPtr object that assumes ownership of a given pointer. | |
~AutoPtr () | |
Destroy this AutoPtr object and the object it points to. | |
AutoPtr & | operator= (X *p) |
Assignment operator Assign a new pointer to this AutoPtr object. | |
X & | operator * () const |
X * | operator-> () const |
X * | get () const |
X * | release () |
Release ownership of the underlying pointer. | |
void | reset (X *p=0) |
Delete the object the underlying pointer points to and take ownership of a new pointer. | |
Private Member Functions | |
AutoPtr (const AutoPtr &a) | |
AutoPtr & | operator= (const AutoPtr &a) |
Private Attributes | |
X * | _ptr |
The AutoPtr class provides semantics of strict ownership. After construction an AutoPtr object owns the object whose pointer it holds. When an instantiation of AutoPtr is copied, ownership of the object is transferred to the destination AutoPtr. The behavior is undefined if more than one instantiation of AutoPtr owns the same object at the same time. Note: This class should not be used for a smart pointer to a dynamically allocated array. AutoPtrVec should be used for that. If AutoPtr holds a pointer to an array, the destructor for all objects in the array will not be called when AutoPtr delete the pointer
Definition at line 61 of file AutoPtr.hpp.
|
Definition at line 71 of file AutoPtr.hpp. |
|
|
|
Construct a new AutoPtr object that assumes ownership of a given pointer.
Definition at line 128 of file AutoPtr.hpp. |
|
Destroy this AutoPtr object and the object it points to.
Definition at line 142 of file AutoPtr.hpp. References BLOCXX_NAMESPACE::AutoPtr< X >::_ptr. |
|
Definition at line 155 of file AutoPtr.hpp. References BLOCXX_NAMESPACE::AutoPtr< X >::_ptr. |
|
Definition at line 149 of file AutoPtr.hpp. References BLOCXX_NAMESPACE::AutoPtr< X >::_ptr. |
|
Definition at line 152 of file AutoPtr.hpp. References BLOCXX_NAMESPACE::AutoPtr< X >::_ptr. |
|
Assignment operator Assign a new pointer to this AutoPtr object. If this AutoPtr object points to another object before this assignment, then that object will be destroyed first.
Definition at line 131 of file AutoPtr.hpp. References BLOCXX_NAMESPACE::AutoPtr< X >::_ptr, and BLOCXX_NAMESPACE::AutoPtr< X >::reset(). |
|
|
|
Release ownership of the underlying pointer.
Definition at line 158 of file AutoPtr.hpp. References BLOCXX_NAMESPACE::AutoPtr< X >::_ptr. |
|
Delete the object the underlying pointer points to and take ownership of a new pointer. This is similar to the assignment operator.
Definition at line 166 of file AutoPtr.hpp. References BLOCXX_NAMESPACE::AutoPtr< X >::_ptr. Referenced by BLOCXX_NAMESPACE::AutoPtr< X >::operator=(), and BLOCXX_NAMESPACE::TempFileStream::reset(). |
|