File tree Expand file tree Collapse file tree 2 files changed +16
-2
lines changed Expand file tree Collapse file tree 2 files changed +16
-2
lines changed Original file line number Diff line number Diff line change @@ -40,6 +40,18 @@ struct Variable : optional<T>
40
40
}
41
41
};
42
42
43
+ // TODO: use auto more for return type of functions
44
+
45
+ template <typename T>
46
+ Variable<T>* var () {
47
+ return new Variable<T>();
48
+ }
49
+
50
+ template <typename T>
51
+ void deleteVar (Variable<T>* v) {
52
+ delete v;
53
+ }
54
+
43
55
template <typename T>
44
56
static void unbind (const T& t) {}
45
57
Original file line number Diff line number Diff line change @@ -33,8 +33,8 @@ bool test1()
33
33
{thor, god}};
34
34
35
35
// Rule
36
- Variable <Name> x ;
37
- auto rule1 = rule (atom<Mortal>(& x), atom<Thing>(& x, person));
36
+ auto x = var <Name>() ;
37
+ auto rule1 = rule (atom<Mortal>(x), atom<Thing>(x, person));
38
38
39
39
State<Thing, Mortal> state{things, {}};
40
40
@@ -45,6 +45,8 @@ bool test1()
45
45
state = fixPoint (rules, state);
46
46
cout << " after = " << state << endl;
47
47
48
+ deleteVar (x);
49
+
48
50
return true ;
49
51
}
50
52
You can’t perform that action at this time.
0 commit comments