diff options
author | John Wiegley <johnw@newartisans.com> | 2008-07-26 04:08:55 -0400 |
---|---|---|
committer | John Wiegley <johnw@newartisans.com> | 2008-07-26 04:08:55 -0400 |
commit | 961b30926b3b9f2b3e9c1a99df3f25fea6b13118 (patch) | |
tree | f0f5efcc0b63f337c4838b8aad46dea2cd7926e4 /pushvar.h | |
parent | ee396957226e2273bc60ede7192c27038c432f24 (diff) | |
download | fork-ledger-961b30926b3b9f2b3e9c1a99df3f25fea6b13118.tar.gz fork-ledger-961b30926b3b9f2b3e9c1a99df3f25fea6b13118.tar.bz2 fork-ledger-961b30926b3b9f2b3e9c1a99df3f25fea6b13118.zip |
--verify works again, but the memory totals at the end still need work.
Diffstat (limited to 'pushvar.h')
-rw-r--r-- | pushvar.h | 19 |
1 files changed, 16 insertions, 3 deletions
@@ -43,22 +43,35 @@ template <typename T> class push_variable : public boost::noncopyable { + push_variable(); + +public: T& var; T prev; bool enabled; -public: explicit push_variable(T& _var) - : var(_var), prev(var), enabled(true) {} + : var(_var), prev(var), enabled(true) { + TRACE_CTOR(push_variable, "T&"); + } explicit push_variable(T& _var, const T& value) : var(_var), prev(var), enabled(true) { + TRACE_CTOR(push_variable, "T&, constT&"); var = value; } - ~push_variable() { + ~push_variable() throw() { + TRACE_DTOR(push_variable); if (enabled) var = prev; } + T& operator*() { + return var; + } + T * operator->() { + return &var; + } + void clear() { enabled = false; } |