From 0840f434541b57fbd6d3c9d7b2a8b127cc680912 Mon Sep 17 00:00:00 2001 From: Adrian Kummerlaender Date: Wed, 1 Oct 2014 20:30:08 +0200 Subject: Moved child pointers to OperatorNode class * access was restricted by declaring them private and offering member methods such as "hasChildren" * only OperatorNode instances have children, there is no reason for wasting space by keeping empty pointers around in all other instances * this enabled the removal of all nullptr comparisons from tree construction * changed "Tree::addNode" factory method template to return a pointer to the type of the constructed node instance instead of a plain node pointer --- src/tree.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/tree.h') diff --git a/src/tree.h b/src/tree.h index e2eb7a6..1b673a2 100644 --- a/src/tree.h +++ b/src/tree.h @@ -18,8 +18,8 @@ class Tree { std::string print() const; private: - template - Node* addNode(Args&&... args); + template + typename std::add_pointer::type addNode(Args&&... args); Node* buildTree(const std::string&); -- cgit v1.2.3