Boost logo

Boost :

From: Aleksey Gurtovoy (alexy_at_[hidden])
Date: 2000-02-16 01:05:45


Joseph Gottman <joegottman_at_[hidden]> wrote:

> > namespace boost {
> > namespace details {
> >
> > template<class T>
> > class auto_restore
> > {
> > protected:
> > typedef auto_restore<T> inherited;
> >
> > auto_restore( T& variable, const T& value )
> > : variable_( variable )
> > , value_( value ) {}
> >
> > ~auto_restore() { variable_ = value_; }
> >
> > private:
> > const T value_;
> > T& variable_;
> > };
> > } // namespace details
> >
>
> Shouldn't value_ be of type T, not const T &?

It isn't "const T &", it is "const T value_;".
A petty 'const'- correctness :).

-Alexy


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