VM: the copy assignment operator is overloaded so you need a custom swap

db4
Björn Lindqvist 2014-06-16 23:59:27 +02:00 committed by John Benediktsson
parent 8beb4e179d
commit 441a4595bb
1 changed files with 9 additions and 1 deletions

View File

@ -26,7 +26,15 @@ template <typename Type> struct data_root : public tagged<Type> {
return *this;
}
~data_root() { parent->data_roots.pop_back(); }
~data_root() {
parent->data_roots.pop_back();
}
friend void swap(data_root<Type>& a, data_root<Type>& b) {
cell tmp = a.value_;
a.value_ = b.value_;
b.value_ = tmp;
}
};
/* A similar hack for the bignum implementation */