- Updated operator-= to handle trivial values.
This commit is contained in:
Paul Beckingham 2014-06-16 18:42:31 -04:00
parent e0bca6c4ad
commit 5dbbca882f

View file

@ -1217,13 +1217,20 @@ Variant& Variant::operator-= (const Variant& other)
case type_real: case type_real:
switch (right._type) switch (right._type)
{ {
case type_unknown: throw std::string ("Cannot subtract unknown type"); case type_unknown:
case type_boolean: right.cast (type_real); _real -= right._real; break; throw std::string ("Cannot subtract unknown type");
case type_integer: right.cast (type_real); _real -= right._real; break;
case type_real: _real -= right._real; break; case type_string:
case type_string: throw std::string ("Cannot subtract strings"); throw std::string ("Cannot subtract strings");
case type_date: right.cast (type_real); _real -= right._real; break;
case type_duration: right.cast (type_real); _real -= right._real; break; case type_boolean:
case type_integer:
case type_real:
case type_date:
case type_duration:
right.cast (type_real);
_real -= right._real;
break;
} }
break; break;