From: Aleksey Gurtovoy (alexy_at_[hidden])
Date: 2000-02-03 22:52:07


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:-)
>

No, I like 'auto-' prefix for such classes - besides a possibility of
deduction of a semantics for such class "by analogy" with familiar to all of
us 'auto_ptr', it also ties a class with the notion of 'automatic storage
duration', which also gives some hint about class behavior..

In view of Dave's proposal about some generalization of this class, I think
'auto_restore' or 'auto_assign' would be nice names, e.g.

| boost::auto_restore<bool> on_exit( flag, flag );
| flag = false;

or

| boost::auto_assign<bool> on_exit( flag, flag );
| flag = false;

But probably there are even better names. The only thing I am sure about is
that now I don't like 'temporary_value' at all =).

-Alexy

P.S. The more I think the less I like the fact the assignment of a new value
(with Dave's version of class) takes place on another line. I have some
vague ideas how to fix it, but they all are too ugly.. Any thoughts?