2 * Copyright (c) 2001 by Peter Simons <simons@cryp.to>.
6 #ifndef RESETABLE_VARIABLE_H
7 #define RESETABLE_VARIABLE_H
9 // This is a wrapper class about variables where you want to keep
10 // track of whether it has been assigened yet or not.
18 RESETABLE() : value(), is_set(false) {}
19 RESETABLE(const T & v) : value(v), is_set(true) {}
21 RESETABLE(const RESETABLE<T> & rvalue)
22 : value(rvalue.value),
26 RESETABLE<T> & operator=(const RESETABLE<T> & rhs)
33 RESETABLE<T> & operator=(const T & rhs)
40 const T & const_data() const throw() { return value; }
41 T & data() throw() { return value; }
42 const T & data() const throw() { return value; }
43 bool empty() const throw() { return !is_set; }
44 void reset() throw() { is_set = false; }
45 void splice(const RESETABLE<T> & rhs)
59 #endif // RESETABLE_VARIABLE_H