add operator conversion for efficient parallelizing
This commit is contained in:
@@ -110,6 +110,12 @@ public:
|
||||
case OPERATOR:
|
||||
v.o = other.v.o;
|
||||
break;
|
||||
case CV:
|
||||
v.cv.w = other.v.cv.w;
|
||||
v.cv.i = other.v.cv.i;
|
||||
break;
|
||||
case NAT:
|
||||
break;
|
||||
default:
|
||||
std::cout << "Warning: token type is invalid\n";
|
||||
break;
|
||||
@@ -131,12 +137,47 @@ public:
|
||||
case OPERATOR:
|
||||
v.o = other.v.o;
|
||||
break;
|
||||
case CV:
|
||||
v.cv.w = other.v.cv.w;
|
||||
v.cv.i = other.v.cv.i;
|
||||
break;
|
||||
case NAT:
|
||||
break;
|
||||
default:
|
||||
std::cout << "Warning: token type is invalid\n";
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Expression::Token& operator=(const Expression::Token& other)
|
||||
{
|
||||
t = other.t;
|
||||
|
||||
switch (t)
|
||||
{
|
||||
case VAR:
|
||||
v.s = other.v.s;
|
||||
break;
|
||||
case CONST:
|
||||
v.d = other.v.d;
|
||||
break;
|
||||
case OPERATOR:
|
||||
v.o = other.v.o;
|
||||
break;
|
||||
case CV:
|
||||
v.cv.w = other.v.cv.w;
|
||||
v.cv.i = other.v.cv.i;
|
||||
break;
|
||||
case NAT:
|
||||
break;
|
||||
default:
|
||||
std::cout << "Warning: token type is invalid\n";
|
||||
break;
|
||||
}
|
||||
|
||||
return const_cast<Expression::Token&>(other);
|
||||
}
|
||||
|
||||
std::shared_ptr<std::string> to_str(void) const
|
||||
{
|
||||
switch (t)
|
||||
|
||||
Reference in New Issue
Block a user