forked from jasder/antlr
Added default c-tor to ParseTree + improved createInstance.
createInstance now use move semantics for its parameters.
This commit is contained in:
parent
014070de66
commit
aabf4baf60
|
@ -33,6 +33,9 @@
|
|||
|
||||
using namespace antlr4::tree;
|
||||
|
||||
ParseTree::ParseTree() : parent(nullptr) {
|
||||
}
|
||||
|
||||
bool ParseTree::operator == (const ParseTree &other) const {
|
||||
return &other == this;
|
||||
}
|
||||
|
|
|
@ -45,6 +45,7 @@ namespace tree {
|
|||
// ml: This class unites 4 Java classes: RuleNode, ParseTree, SyntaxTree and Tree.
|
||||
class ANTLR4CPP_PUBLIC ParseTree {
|
||||
public:
|
||||
ParseTree();
|
||||
virtual ~ParseTree() {}
|
||||
|
||||
/// The parent of this node. If the return value is null, then this
|
||||
|
@ -102,7 +103,7 @@ namespace tree {
|
|||
class ANTLR4CPP_PUBLIC ParseTreeTracker {
|
||||
public:
|
||||
template<typename T, typename ... Args>
|
||||
T* createInstance(Args ... args) {
|
||||
T* createInstance(Args&& ... args) {
|
||||
static_assert(std::is_base_of<ParseTree, T>::value, "Argument must be a parse tree type");
|
||||
T* result = new T(args...);
|
||||
_allocated.push_back(result);
|
||||
|
|
Loading…
Reference in New Issue