OWLNext    7.0
Borland's Object Windows Library for the modern age
Loading...
Searching...
No Matches
owl::TEnvelope< T > Class Template Reference

Envelope-letter type of smart pointers. More...

#include <owl/pointer.h>

Public Member Functions

 TEnvelope (T *object)
 
 TEnvelope (const TEnvelope &src)
 
 ~TEnvelope ()
 
TEnvelopeoperator= (const TEnvelope &src)
 
TEnvelopeoperator= (T *object)
 
T * operator-> ()
 
T & operator* ()
 

Detailed Description

template<class T>
class owl::TEnvelope< T >

Envelope-letter type of smart pointers.

In this implementation the envelope acts as a smart pointer to a reference-counted internal letter. This allows a lot of flexibility & safety in working with a single object (associated with the letter) being assigned to numerous envelopes in many scopes. An 'A' version is provided for use with arrays.

Use like:

TEnvelope<T> e1 = new T(x,y,x); // e1 now owns a T in a letter
e1->Func(); // invokes Func() on the new T
Func(*e1); // passing a T& or a T this way
TEnvelope<T> e2 = e1; // e2 safely shares the letter with e1
TAEnvelope<T> e1 = new T[99]; // e1 now owns T[] in a letter
e1[i].Func(); // invokes Func() on a T element
Func(e1[i]); // passing a T& or a T this way
TAEnvelope<T> e2 = e1; // e2 safely shares the letter with e1

Definition at line 153 of file pointer.h.

Constructor & Destructor Documentation

◆ TEnvelope() [1/2]

template<class T >
owl::TEnvelope< T >::TEnvelope ( T * object)
inline

Definition at line 155 of file pointer.h.

◆ TEnvelope() [2/2]

template<class T >
owl::TEnvelope< T >::TEnvelope ( const TEnvelope< T > & src)
inline

Definition at line 156 of file pointer.h.

◆ ~TEnvelope()

template<class T >
owl::TEnvelope< T >::~TEnvelope ( )
inline

Definition at line 157 of file pointer.h.

Member Function Documentation

◆ operator*()

template<class T >
T & owl::TEnvelope< T >::operator* ( )
inline

Definition at line 163 of file pointer.h.

◆ operator->()

template<class T >
T * owl::TEnvelope< T >::operator-> ( )
inline

Definition at line 162 of file pointer.h.

◆ operator=() [1/2]

template<class T >
TEnvelope< T > & owl::TEnvelope< T >::operator= ( const TEnvelope< T > & src)

Definition at line 262 of file pointer.h.

◆ operator=() [2/2]

template<class T >
TEnvelope< T > & owl::TEnvelope< T >::operator= ( T * object)

Definition at line 273 of file pointer.h.


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