3ds Max C++ API Reference
AutoPtr< Type > Class Template Reference

Old AutoPtr class, maintained to support backwards compatibility. More...

#include <autoptr.h>

+ Inheritance diagram for AutoPtr< Type >:

Public Member Functions

 AutoPtr (Type *p=NULL)
 Construct, assuming ownership of the pointed-to object. More...
 
 AutoPtr (const AutoPtrRef< Type > &ref)
 Construct from an AutoPtrRef. More...
 
template<typename OtherType >
 operator AutoPtr< OtherType > ()
 Destructive copy-convert allowing for cast of the pointer type. More...
 
- Public Member Functions inherited from AutoPtr< Type, DestructorPolicy >
 AutoPtr (Type *p=NULL)
 Construct, assuming ownership of the pointed-to object. More...
 
 ~AutoPtr ()
 Destructor - automatically cleans up the pointed-to object. More...
 
 AutoPtr (AutoPtr &a)
 Copy construct, assuming ownership from the source AutoPtr. More...
 
template<typename OtherType >
 AutoPtr (AutoPtr< OtherType, DestructorPolicy > &a)
 Conversion copy constructor. More...
 
AutoPtroperator= (const AutoPtr &a)
 Assignment, takes over ownership from the source AutoPtr. More...
 
template<typename OtherType >
AutoPtroperator= (AutoPtr< OtherType, DestructorPolicy > &a)
 Conversion assignment, takes over ownership of any type assignable to type from the source AutoPtr. More...
 
Type & operator* () const
 Dereferencing operator - works exactly like a plain pointer's operator*. More...
 
Type * operator-> () const
 Pointer-to-member dereferencing operator - works exactly like a plain pointer's operator->. More...
 
Type * Get () const
 Get the plain pointer back. More...
 
Type * Release ()
 Relinquish ownership of the pointed-to object to the caller. More...
 
void Reset (Type *p=NULL)
 Assume ownership of a new object, any existing pointer will be deleted. More...
 
bool IsNull () const
 Addition to the textbook interface. More...
 
 AutoPtr (const AutoPtrRef< Type > &ref)
 Construct from an AutoPtrRef. More...
 
template<typename OtherType >
 operator AutoPtrRef< OtherType > ()
 Convert to an AutoPtrRef. More...
 
template<typename OtherType >
 operator AutoPtr< OtherType, DestructorPolicy > ()
 Destructive copy-convert allowing for cast of the pointer type. More...
 

Additional Inherited Members

- Public Types inherited from AutoPtr< Type, DestructorPolicy >
typedef Type element_type
 Typedef to make the element type a member of the class. More...
 
typedef DestructorPolicy destructor
 Typedef to make the DestructionPolicy type a member of the class. More...
 

Detailed Description

template<typename Type>
class MaxSDK::Util::AutoPtr< Type >

Old AutoPtr class, maintained to support backwards compatibility.


The old single-pointer AutoPtr was removed from the Util namespace, and has been replaced with MaxSDK::AutoPtr<Type> using its default destruction policy template parameter.

Constructor & Destructor Documentation

◆ AutoPtr() [1/2]

AutoPtr ( Type *  p = NULL)
inlineexplicit

Construct, assuming ownership of the pointed-to object.

Parameters
pPlain pointer to an object - this AutoPtr will assume ownership of that object.
506  :
508  { };
Automatic memory-ownership pointer supporting "resource acquisition is initialization.
Definition: autoptr.h:163

◆ AutoPtr() [2/2]

AutoPtr ( const AutoPtrRef< Type > &  ref)
inline

Construct from an AutoPtrRef.

This may be done implicitly or explicitly. The Ref object exists to avoid temporarily needing to have two AutoPtrs own the same object.

Parameters
refhelper object.
517  :
518  MaxSDK::AutoPtr<Type>(ref.mPtr)
519  { }

Member Function Documentation

◆ operator AutoPtr< OtherType >()

operator AutoPtr< OtherType > ( )
inline

Destructive copy-convert allowing for cast of the pointer type.

525  {
526  return AutoPtr<OtherType>(this->Release());
527  }
Type * Release()
Relinquish ownership of the pointed-to object to the caller.
Definition: autoptr.h:311