Logo Search packages:      
Sourcecode: ocropus version File versions  Download package

colib::autodel< T > Class Template Reference

#include <smartptr.h>

List of all members.

Detailed Description

template<class T>
class colib::autodel< T >

Automatic deletion, linear assignment.

A smart pointer class that deletes the pointer it holds when it goes out of scope. Assignment is like it is for linear types: on assignment, the pointer gets moved to the destination, and the source gets set to NULL (this is convenient for returning values, for use in lists, and similar settings).

Definition at line 114 of file smartptr.h.

Public Member Functions

 autodel (T *other)
 Initialization with a pointer transfers ownership to the class.
 autodel ()
 Default constructor sets pointer to null.
T * move ()
 Take ownership away from this smart pointer and set the smart pointer to null.
bool operator! () const
 Testing whether the pointer is null.
T & operator* () const
T * operator-> () const
void operator= (autodel< T > &other)
void operator= (T *other)
T * ptr () const
 Conversion to pointer.
T & ref () const
 Same as operator*().
 ~autodel ()
 Destructor deletes any pointer held by the class.

Private Attributes

T * pointer

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

Generated by  Doxygen 1.6.0   Back to index