aboutsummaryrefslogtreecommitdiff
path: root/src/tree.cc
diff options
context:
space:
mode:
authorAdrian Kummerlaender2014-09-16 19:57:28 +0200
committerAdrian Kummerlaender2014-09-16 19:57:28 +0200
commit0e3cfcde619fb60e6e43bf0ffe715df6d5c22218 (patch)
treede4eba6323b29e30e4d226ba1a905ba9bd12714b /src/tree.cc
parent9db4e054627eb30b4e5a7333405c423df5a8d490 (diff)
downloadSimpleParser-0e3cfcde619fb60e6e43bf0ffe715df6d5c22218.tar
SimpleParser-0e3cfcde619fb60e6e43bf0ffe715df6d5c22218.tar.gz
SimpleParser-0e3cfcde619fb60e6e43bf0ffe715df6d5c22218.tar.bz2
SimpleParser-0e3cfcde619fb60e6e43bf0ffe715df6d5c22218.tar.lz
SimpleParser-0e3cfcde619fb60e6e43bf0ffe715df6d5c22218.tar.xz
SimpleParser-0e3cfcde619fb60e6e43bf0ffe715df6d5c22218.tar.zst
SimpleParser-0e3cfcde619fb60e6e43bf0ffe715df6d5c22218.zip
Improved lexer readabilty and replaced raw new in tree construction
* "new" in Tree::addNode member method was replaced with C++14 std::make_unique * renamed and constified lexer local variables to increase readabilty ** replaced chunky if-clauses with switch-clauses where appropriate * updated README.md to mention C++14 requirement
Diffstat (limited to 'src/tree.cc')
-rw-r--r--src/tree.cc2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/tree.cc b/src/tree.cc
index e377c95..bc1414b 100644
--- a/src/tree.cc
+++ b/src/tree.cc
@@ -100,7 +100,7 @@ std::string Tree::print() {
template <typename NType, typename... Args>
Node* Tree::addNode(Node** place, Args&&... args) {
this->node_collection_.emplace_back(
- new NType(std::forward<Args>(args)...)
+ std::make_unique<NType>(std::forward<Args>(args)...)
);
if ( place != nullptr ) {