|
ACE 7.1.4
|
Smart pointer implementation designed for use as a class member. More...
#include <Value_Ptr.h>
Public Member Functions | |
| Value_Ptr (T *p=0) | |
| Constructor. | |
| ~Value_Ptr () | |
| Destructor. | |
| T & | operator* () const |
| Deference operator. | |
| T * | operator-> () const |
| Pointer operator. | |
| void | swap (Value_Ptr &other) |
| Value_Ptr (Value_Ptr const &other) | |
| Copy constructor. | |
| Value_Ptr & | operator= (Value_Ptr const &other) |
| Assignment operator. | |
| template<typename U > | |
| Value_Ptr (Value_Ptr< U > const &other) | |
| Converting copy constructor. | |
| template<typename U > | |
| Value_Ptr & | operator= (Value_Ptr< U > const &other) |
| Converting assignment operator. | |
Private Member Functions | |
| template<typename U > | |
| T * | create_from (U const *p) const |
| Copying method invoked when copy constructing. | |
Private Attributes | |
| T * | p_ |
Object owned by this Value_Ptr. | |
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 |
Non-throwing swap operation used to make assignment strongly exception-safe.
auto_ptr<>s, but why would one use an auto_ptr<> as the template argument for this particular template class!?
|
private |
Object owned by this Value_Ptr.