temporary< T > Class Template Reference

Manage temporary object stored on the heap. More...

#include <object.h>

Inheritance diagram for temporary< T >:
Inheritance graph
[legend]
Collaboration diagram for temporary< T >:
Collaboration graph
[legend]

Public Member Functions

 temporary ()
 Construct a temporary object, create our stack frame reference.
T & operator* () const
 Access heap object through our temporary directly.
T * operator-> () const
 Access members of our heap object through our temporary.

Detailed Description

template<class T>
class temporary< T >

Manage temporary object stored on the heap.

This is used to create a object on the heap who's scope is controlled by the scope of a member function call. Sometimes we have data types and structures which cannot themselves appear as auto variables. We may also have a limited stack frame size in a thread context, and yet have a dynamic object that we only want to exist during the life of the method call. Using temporary allows any type to be created from the heap but have a lifespan of a method's stack frame. All types managed as temporary must have Temporary as a base class.

Author:
David Sugar <dyfet@gnutelephony.org>

Definition at line 374 of file object.h.


Member Function Documentation

template<class T >
T& temporary< T >::operator* (  )  const [inline]

Access heap object through our temporary directly.

Returns:
reference to heap resident object.

Definition at line 387 of file object.h.

template<class T >
T* temporary< T >::operator-> (  )  const [inline]

Access members of our heap object through our temporary.

Returns:
member reference of heap object.

Definition at line 394 of file object.h.


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

Generated on 28 Dec 2009 for UCommon by  doxygen 1.6.1