aboutsummaryrefslogtreecommitdiff
path: root/src/tree.h
diff options
context:
space:
mode:
authorAdrian Kummerlaender2014-10-01 20:30:08 +0200
committerAdrian Kummerlaender2014-10-01 20:30:08 +0200
commit0840f434541b57fbd6d3c9d7b2a8b127cc680912 (patch)
tree330df31c2083a48c33be95a2bc7d40f8b5d25470 /src/tree.h
parent6498a968cd34e49e355cc0765ca2dafb842bc12b (diff)
downloadSimpleParser-0840f434541b57fbd6d3c9d7b2a8b127cc680912.tar
SimpleParser-0840f434541b57fbd6d3c9d7b2a8b127cc680912.tar.gz
SimpleParser-0840f434541b57fbd6d3c9d7b2a8b127cc680912.tar.bz2
SimpleParser-0840f434541b57fbd6d3c9d7b2a8b127cc680912.tar.lz
SimpleParser-0840f434541b57fbd6d3c9d7b2a8b127cc680912.tar.xz
SimpleParser-0840f434541b57fbd6d3c9d7b2a8b127cc680912.tar.zst
SimpleParser-0840f434541b57fbd6d3c9d7b2a8b127cc680912.zip
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
Diffstat (limited to 'src/tree.h')
-rw-r--r--src/tree.h4
1 files changed, 2 insertions, 2 deletions
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 <class NodeType, typename... Args>
- Node* addNode(Args&&... args);
+ template <class Type, typename... Args>
+ typename std::add_pointer<Type>::type addNode(Args&&... args);
Node* buildTree(const std::string&);