Boost logo

Boost :

From: John Panzer (jpanzer_at_[hidden])
Date: 2000-02-03 23:50:08

Aleksey Gurtovoy wrote:

> Beman Dawes <beman_at_[hidden]> wrote:
> > Let's see if we can do better that temp_value or temporary_value for
> names.
> >
> > How about auto_save or auto_restore? Or has auto_ptr given auto_... names
> > a bad name:-)
> >

For what it's worth:

As a data point that might indicate that this is a natural need and that
auto_XXX might be a natural name, a couple of months ago I invented
I a more limited version of this idea, calling it auto_resetter:

// A utility class to automatically set a
// variable to its default value. For
// scalar (integer, boolean) types, the
// default value is 0 or false.
template <class T>
class auto_resetter
   auto_resetter(T &v) : vr(v) {}
   ~auto_resetter() {vr = T();}
   T &vr;

John Panzer

Boost list run by bdawes at, gregod at, cpdaniel at, john at