From 5dbbca882fb67c367e0c8b64ddacd837cec0d3b8 Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Mon, 16 Jun 2014 18:42:31 -0400 Subject: [PATCH] Variant - Updated operator-= to handle trivial values. --- src/Variant.cpp | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/src/Variant.cpp b/src/Variant.cpp index 9c864b88d..50769b4d2 100644 --- a/src/Variant.cpp +++ b/src/Variant.cpp @@ -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;