AutoPtr< T > Class Template Reference

A class intended to be used in stack scope to hold a pointer from new. The held pointer will be deleted automatically if the scope is left without calling Release on the AutoPtr first. More...

#include <dng_auto_ptr.h>

List of all members.


Public Member Functions

 AutoPtr ()
 Construct an AutoPtr with no referent.
 AutoPtr (T *p)
 ~AutoPtr ()
 Reset() is called on destruction.
void Alloc ()
 Call Reset with a pointer from new. Uses T's default constructor.
T * Get () const
 Return the owned pointer of this AutoPtr, NULL if none. No change in ownership or other effects occur.
T * Release ()
 Return the owned pointer of this AutoPtr, NULL if none. The AutoPtr gives up ownership and takes NULL as its value.
void Reset (T *p)
 If a pointer is owned, it is deleted. Ownership is taken of passed in pointer.
void Reset ()
 If a pointer is owned, it is deleted and the AutoPtr takes NULL as its value.
T * operator-> () const
 Allows members of the owned pointer to be accessed directly. It is an error to call this if the AutoPtr has NULL as its value.
T & operator* () const
 Returns a reference to the object that the owned pointer points to. It is an error to call this if the AutoPtr has NULL as its value.

Detailed Description

template<class T>
class AutoPtr< T >

A class intended to be used in stack scope to hold a pointer from new. The held pointer will be deleted automatically if the scope is left without calling Release on the AutoPtr first.

Constructor & Destructor Documentation

template<class T>
AutoPtr< T >::AutoPtr ( T *  p  )  [inline, explicit]

Construct an AutoPtr which owns the argument pointer.

Parameters:
p pointer which constructed AutoPtr takes ownership of. p will be deleted on destruction or Reset unless Release is called first.


The documentation for this class was generated from the following file:

Copyright © 2006-2009 Adobe Systems Incorporated.

Use of this website signifies your agreement to the Terms of Use and Online Privacy Policy.

Search powered by Google