]> git.tdb.fi Git - libs/gl.git/blobdiff - source/programsyntax.h
Assorted refactoring and fixes
[libs/gl.git] / source / programsyntax.h
index c645a60a442ec91a616060f11c55327e9a34d4f6..cbce078e2d65c1eb74bb9985fa2639c4bc525326 100644 (file)
@@ -33,6 +33,10 @@ public:
        NodePtr(T *n = 0): node(n) { }
        NodePtr(const NodePtr &p): node(clone(p.node)) { }
        NodePtr &operator=(const NodePtr &p) { delete node; node = clone(p.node); return *this; }
+#if __cplusplus>=201103L
+       NodePtr(NodePtr &&p): node(p.node) { p.node = 0; }
+       NodePtr &operator=(NodePtr &&p) { delete node; node = p.node; p.node = 0; return *this; }
+#endif
        ~NodePtr() { delete node; }
 
 private:
@@ -223,7 +227,7 @@ struct FunctionDeclaration: Node
 
 struct Conditional: Node
 {
-       Expression *condition;
+       NodePtr<Expression> condition;
        Block body;
        Block else_body;