Mercurial > dedupe
comparison RBTree.hpp @ 17:9a1825df8418
Plug memoryleaks.
| author | Tom Fredrik Blenning Klaussen <bfg@blenning.no> |
|---|---|
| date | Tue, 28 Aug 2012 19:15:33 +0200 |
| parents | 06166d6c083b |
| children | fcb7a71a22c1 |
comparison
equal
deleted
inserted
replaced
| 16:06166d6c083b | 17:9a1825df8418 |
|---|---|
| 29 | 29 |
| 30 public: | 30 public: |
| 31 RBTreeNode(const Data& data) : left(0), right(0), parent(0), red(true) | 31 RBTreeNode(const Data& data) : left(0), right(0), parent(0), red(true) |
| 32 { | 32 { |
| 33 this->data = data; | 33 this->data = data; |
| 34 } | |
| 35 | |
| 36 ~RBTreeNode() | |
| 37 { | |
| 38 delete left; | |
| 39 delete right; | |
| 34 } | 40 } |
| 35 | 41 |
| 36 void setColor(Color color) | 42 void setColor(Color color) |
| 37 { | 43 { |
| 38 red = (color == RED); | 44 red = (color == RED); |
| 267 RBTreeNode* node; | 273 RBTreeNode* node; |
| 268 public: | 274 public: |
| 269 RBTree() : node(0) | 275 RBTree() : node(0) |
| 270 { | 276 { |
| 271 } | 277 } |
| 278 | |
| 279 ~RBTree() | |
| 280 { | |
| 281 delete node; | |
| 282 } | |
| 272 | 283 |
| 273 bool consistent() const | 284 bool consistent() const |
| 274 { | 285 { |
| 275 if (node == 0) | 286 if (node == 0) |
| 276 return true; | 287 return true; |
