VideoTools
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
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<>. More...
 
template<typename T >
void operator<<= (std::auto_ptr< T > &ap, int)
 

Function Documentation

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

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:

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

Definition at line 44 of file gmemory.h.