@@ -8,22 +8,28 @@ using namespace std;
8
8
9
9
shared_ptr<expression> expression::operator +(
10
10
const shared_ptr<expression>& other) const {
11
- return make_unique <evaluation>(shared_from_this (), other, " +" ,
11
+ return make_shared <evaluation>(shared_from_this (), other, " +" ,
12
12
[](int a, int b) { return a + b; });
13
13
}
14
14
15
15
shared_ptr<expression> expression::operator -(
16
16
const shared_ptr<expression>& other) const {
17
- return make_unique <evaluation>(shared_from_this (), other, " -" ,
17
+ return make_shared <evaluation>(shared_from_this (), other, " -" ,
18
18
[](int a, int b) { return a - b; });
19
19
}
20
20
21
21
shared_ptr<expression> expression::operator *(
22
22
const shared_ptr<expression>& other) const {
23
- return make_unique <evaluation>(shared_from_this (), other, " *" ,
23
+ return make_shared <evaluation>(shared_from_this (), other, " *" ,
24
24
[](int a, int b) { return a * b; });
25
25
}
26
26
27
+ shared_ptr<expression> expression::operator /(
28
+ const shared_ptr<expression>& other) const {
29
+ return make_shared<evaluation>(shared_from_this (), other, " /" ,
30
+ [](int a, int b) { return a / b; });
31
+ }
32
+
27
33
expression::~expression () {}
28
34
29
35
literal::literal (int data) : data_(data) {}
0 commit comments