gmemory.h File Reference

#include "gdef.h"
#include <memory>

Go to the source code of this file.

Functions

template<typename T>
void operator<<= (std::auto_ptr< T > &ap, T *p)
 A portable fix for the problem of resetting an auto_ptr<>.
template<typename T>
void operator<<= (std::auto_ptr< T > &ap, int)
 A version for null-pointer constants.


Detailed Description

Definition in file gmemory.h.


Function Documentation

template<typename T>
void operator<<= ( std::auto_ptr< T > &  ap,
int   
) [inline]

A version for null-pointer constants.

Definition at line 57 of file gmemory.h.

template<typename T>
void operator<<= ( std::auto_ptr< T > &  ap,
T *  p 
) [inline]

A portable fix for the problem of resetting an auto_ptr<>.

Some compilers do not have a reset() method, and some have non-const assignment operators.

Usage:

 #include "gmemory.h"
 {
   std::auto_ptr<Foo> ptr ;
   for( int i = 0 ; i < 10 ; i++ )
   {
      ptr <<= new Foo ;
      if( ptr->fn() )
         eatFoo( ptr->release() ) ;
   }
 }

Definition at line 47 of file gmemory.h.


Generated on Fri Apr 18 15:56:12 2008 for E-MailRelay by  doxygen 1.5.5