ACE
6.3.1
|
Smart pointer implementation designed for use as a class member. More...
#include <Value_Ptr.h>
Public Member Functions | |
Value_Ptr (T *p=0) | |
Constructor. More... | |
~Value_Ptr (void) | |
Destructor. More... | |
T & | operator* (void) const |
Deference operator. More... | |
T * | operator-> (void) const |
Pointer operator. More... | |
void | swap (Value_Ptr &other) |
Value_Ptr (Value_Ptr const &other) | |
Copy constructor. More... | |
Value_Ptr & | operator= (Value_Ptr const &other) |
Assignment operator. More... | |
template<typename U > | |
Value_Ptr (Value_Ptr< U > const &other) | |
Converting copy constructor. More... | |
template<typename U > | |
Value_Ptr & | operator= (Value_Ptr< U > const &other) |
Converting assignment operator. More... | |
Private Member Functions | |
template<typename U > | |
T * | create_from (U const *p) const |
Copying method invoked when copy constructing. More... | |
Private Attributes | |
T * | p_ |
Object owned by this Value_Ptr . More... | |
Friends | |
template<typename U > | |
class | Value_Ptr |
Smart pointer implementation designed for use as a class member.
Using a std::auto_ptr<>
as a class member is sometimes problematic since ownership of memory is transferred when copying such members. This Value_Ptr
class is explicitly designed to avoid such problems by performing copies of the underlying object rather than transfer ownership. This, for example, allows it to be readily used as a member in classes placed inside STL containers.
|
inlineexplicit |
Constructor.
|
inline |
Destructor.
|
inline |
Copy constructor.
|
inline |
Converting copy constructor.
|
inlineprivate |
Copying method invoked when copy constructing.
|
inline |
Deference operator.
|
inline |
Pointer operator.
|
inline |
Assignment operator.
|
inline |
Converting assignment operator.
|
inline |
|
private |
Object owned by this Value_Ptr
.