Boost logo

Boost :

From: Jason Hise (chaos_at_[hidden])
Date: 2005-03-13 12:56:11


I use the following as an implementation detail, and it was mentioned by
Pavel that a similar facility called state_saver is used in the
implementation of the serialization library. Does it make sense for
this to be refactored into boost/detail?

template < typename T >
struct auto_set
{
    T & var; T val;
    auto_set ( T & var, T val ) :
    var ( var ), val ( val ) { }
    ~ auto_set ( ) { var = val; }
};

-Jason


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