From 1c0172cca4f1e90679321912e20436a7f42f122d Mon Sep 17 00:00:00 2001 From: Goraf <22941576+Goraf@users.noreply.github.com> Date: Sat, 24 Feb 2018 15:32:06 +0100 Subject: more nullptr --- plugins/Ping/src/collection.h | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) (limited to 'plugins/Ping/src') diff --git a/plugins/Ping/src/collection.h b/plugins/Ping/src/collection.h index 73e36fe704..e19c5874d4 100644 --- a/plugins/Ping/src/collection.h +++ b/plugins/Ping/src/collection.h @@ -28,7 +28,7 @@ template class ListNode : public Node < T > public: ListNode *next, *prev; - ListNode(const T &v) : Node(v), next(0), prev(0) {} + ListNode(const T &v) : Node(v), next(nullptr), prev(nullptr) {} virtual ~ListNode() { if (next) next->prev = prev; @@ -57,8 +57,8 @@ public: virtual const bool has_val() { return (n ? true : false); } }; - LinkedList() : Collection(), head(0), tail(0) {}; - LinkedList(const LinkedList &other) : Collection(), head(0), tail(0) + LinkedList() : Collection(), head(nullptr), tail(nullptr) {}; + LinkedList(const LinkedList &other) : Collection(), head(nullptr), tail(nullptr) { for (Iterator i = other.begin(); i.has_val(); i.next()) add(i.val()); @@ -81,7 +81,7 @@ public: head = head->next; delete n; } - tail = 0; + tail = nullptr; Collection::count = 0; } @@ -160,7 +160,7 @@ public: ListNode *n = head; if (head) { head = head->next; - if (n == tail) tail = 0; + if (n == tail) tail = nullptr; val = n->val; delete n; Collection::count--; @@ -399,7 +399,7 @@ protected: n->left->parent = n->parent; } else { - if (n == root) root = 0; + if (n == root) root = nullptr; } delete n; Collection::count--; @@ -407,7 +407,7 @@ protected: virtual void insert_node(N *n) { - N *current = root, *parent = 0; + N *current = root, *parent = nullptr; while (current) { parent = current; if (n->val < current->val) @@ -482,8 +482,8 @@ public: virtual const bool has_val() { return (n ? true : false); } }; - BinaryTree() : Collection(), root(0) {}; - BinaryTree(BinaryTree &other) : Collection(), root(0) + BinaryTree() : Collection(), root(nullptr) {}; + BinaryTree(BinaryTree &other) : Collection(), root(nullptr) { for (Iterator i = other.begin(); i != pl.end(); ++i) add(i.val()); @@ -500,7 +500,7 @@ public: virtual void clear() { - N *current = root, *parent = 0; + N *current = root, *parent = nullptr; while (current) { if (current->left) current = current->left; else if (current->right) current = current->right; @@ -511,7 +511,7 @@ public: } } - root = 0; + root = nullptr; Collection::count = 0; } @@ -569,12 +569,12 @@ public: ColouredTreeNode *parent, *left, *right; char color; - ColouredTreeNode(const T &v, ColouredTreeNode *par) : Node(v), parent(par), left(0), right(0), color(BLACK) {} + ColouredTreeNode(const T &v, ColouredTreeNode *par) : Node(v), parent(par), left(nullptr), right(nullptr), color(BLACK) {} virtual ~ColouredTreeNode() { if (parent) { - if (parent->left == this) parent->left = 0; - if (parent->right == this)parent->right = 0; + if (parent->left == this) parent->left = nullptr; + if (parent->right == this)parent->right = nullptr; } } }; -- cgit v1.2.3