mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-07-07 20:06:36 +02:00
Variant
- Updated operator-= to handle trivial values.
This commit is contained in:
parent
e0bca6c4ad
commit
5dbbca882f
1 changed files with 14 additions and 7 deletions
|
@ -1217,13 +1217,20 @@ Variant& Variant::operator-= (const Variant& other)
|
|||
case type_real:
|
||||
switch (right._type)
|
||||
{
|
||||
case type_unknown: throw std::string ("Cannot subtract unknown type");
|
||||
case type_boolean: right.cast (type_real); _real -= right._real; break;
|
||||
case type_integer: right.cast (type_real); _real -= right._real; break;
|
||||
case type_real: _real -= right._real; break;
|
||||
case type_string: 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_unknown:
|
||||
throw std::string ("Cannot subtract unknown type");
|
||||
|
||||
case type_string:
|
||||
throw std::string ("Cannot subtract strings");
|
||||
|
||||
case type_boolean:
|
||||
case type_integer:
|
||||
case type_real:
|
||||
case type_date:
|
||||
case type_duration:
|
||||
right.cast (type_real);
|
||||
_real -= right._real;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue