Boost logo

Boost :

From: Noel Yap (Noel.Yap_at_[hidden])
Date: 2003-05-03 18:13:27


Noel Yap wrote:
> std::auto_ptr< T > t( new T() );
> f( boost::dumb_ptr< T >( t.get() ); // clearly an in/out parameter

Or if you don't want to dynamically allocate t:

  T t;
  f( boost::dumb_ptr< T >( &t ) ); // clearly an in/out parameter

  static T t;
  f( boost::dumb_ptr< T >( &t ) ); // clearly an in/out parameter

  boost::dumb_ptr< T > t = f(); // must be an out parameter whose memory
is managed by f()

  T t = *f().get(); // must be an out parameter whose memory is managed
by f()

  T &t = *f(); // must be an out parameter whose memory is managed by
f()

Noel


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk