some const & added
This commit is contained in:
parent
5315e58823
commit
4e91a66703
20
ml.cpp
20
ml.cpp
|
|
@ -419,7 +419,7 @@ public:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool operator!=(Value other) const {
|
bool operator!=(const Value &other) const {
|
||||||
return !(*this == other);
|
return !(*this == other);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -427,19 +427,19 @@ public:
|
||||||
/// ORDERING OPERATIONS ////////////////////////////////////////////////////////
|
/// ORDERING OPERATIONS ////////////////////////////////////////////////////////
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
bool operator>=(Value other) const {
|
bool operator>=(const Value &other) const {
|
||||||
return !(*this < other);
|
return !(*this < other);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool operator<=(Value other) const {
|
bool operator<=(const Value &other) const {
|
||||||
return (*this == other) || (*this < other);
|
return (*this == other) || (*this < other);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool operator>(Value other) const {
|
bool operator>(const Value &other) const {
|
||||||
return !(*this <= other);
|
return !(*this <= other);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool operator<(Value other) const {
|
bool operator<(const Value &other) const {
|
||||||
// Other type must be a float or an int
|
// Other type must be a float or an int
|
||||||
if (other.type != FLOAT && other.type != INT)
|
if (other.type != FLOAT && other.type != INT)
|
||||||
throw Error(*this, Environment(), INVALID_BIN_OP);
|
throw Error(*this, Environment(), INVALID_BIN_OP);
|
||||||
|
|
@ -465,7 +465,7 @@ public:
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
// This function adds two lisp values, and returns the lisp value result.
|
// This function adds two lisp values, and returns the lisp value result.
|
||||||
Value operator+(Value other) const {
|
Value operator+(const Value &other) const {
|
||||||
// If the other value's type is the unit type,
|
// If the other value's type is the unit type,
|
||||||
// don't even bother continuing.
|
// don't even bother continuing.
|
||||||
// Unit types consume all arithmetic operations.
|
// Unit types consume all arithmetic operations.
|
||||||
|
|
@ -513,7 +513,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
// This function subtracts two lisp values, and returns the lisp value result.
|
// This function subtracts two lisp values, and returns the lisp value result.
|
||||||
Value operator-(Value other) const {
|
Value operator-(const Value &other) const {
|
||||||
// If the other value's type is the unit type,
|
// If the other value's type is the unit type,
|
||||||
// don't even bother continuing.
|
// don't even bother continuing.
|
||||||
// Unit types consume all arithmetic operations.
|
// Unit types consume all arithmetic operations.
|
||||||
|
|
@ -545,7 +545,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
// This function multiplies two lisp values, and returns the lisp value result.
|
// This function multiplies two lisp values, and returns the lisp value result.
|
||||||
Value operator*(Value other) const {
|
Value operator*(const Value &other) const {
|
||||||
// If the other value's type is the unit type,
|
// If the other value's type is the unit type,
|
||||||
// don't even bother continuing.
|
// don't even bother continuing.
|
||||||
// Unit types consume all arithmetic operations.
|
// Unit types consume all arithmetic operations.
|
||||||
|
|
@ -575,7 +575,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
// This function divides two lisp values, and returns the lisp value result.
|
// This function divides two lisp values, and returns the lisp value result.
|
||||||
Value operator/(Value other) const {
|
Value operator/(const Value &other) const {
|
||||||
// If the other value's type is the unit type,
|
// If the other value's type is the unit type,
|
||||||
// don't even bother continuing.
|
// don't even bother continuing.
|
||||||
// Unit types consume all arithmetic operations.
|
// Unit types consume all arithmetic operations.
|
||||||
|
|
@ -605,7 +605,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
// This function finds the remainder of two lisp values, and returns the lisp value result.
|
// This function finds the remainder of two lisp values, and returns the lisp value result.
|
||||||
Value operator%(Value other) const {
|
Value operator%(const Value &other) const {
|
||||||
// If the other value's type is the unit type,
|
// If the other value's type is the unit type,
|
||||||
// don't even bother continuing.
|
// don't even bother continuing.
|
||||||
// Unit types consume all arithmetic operations.
|
// Unit types consume all arithmetic operations.
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue