summaryrefslogtreecommitdiff
path: root/pushvar.h
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2008-07-26 04:08:55 -0400
committerJohn Wiegley <johnw@newartisans.com>2008-07-26 04:08:55 -0400
commit961b30926b3b9f2b3e9c1a99df3f25fea6b13118 (patch)
treef0f5efcc0b63f337c4838b8aad46dea2cd7926e4 /pushvar.h
parentee396957226e2273bc60ede7192c27038c432f24 (diff)
downloadfork-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.h19
1 files changed, 16 insertions, 3 deletions
diff --git a/pushvar.h b/pushvar.h
index 98944481..f8db82f8 100644
--- a/pushvar.h
+++ b/pushvar.h
@@ -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;
}