diff options
-rw-r--r-- | common/map.h | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/common/map.h b/common/map.h index 4d3b3f26ac..5fd655093c 100644 --- a/common/map.h +++ b/common/map.h @@ -79,6 +79,13 @@ public: _header = new Node(); _header->_right = _header->_left = _header; } + + ~Map<Key, Value>() + { + clearNodes(_root); + delete _header; + _root = _header = 0; + } /* * Return the object for the given key. If no match is found, a new entry @@ -160,7 +167,7 @@ public: delete node; } - void merge(Map<Key, Value> map) + void merge(const Map<Key, Value> &map) { // FIXME - this is a very bad algorithm. // Right now we insert the items from 'map' using the default iterator, @@ -234,8 +241,8 @@ protected: if (!node) return; - clearNodes(left); - clearNodes(right); + clearNodes(node->_left); + clearNodes(node->_right); delete node; } }; |