Skip to content

Commit

Permalink
Check numeric types of Dynamics inside Variants when comparing
Browse files Browse the repository at this point in the history
  • Loading branch information
hughsando committed Jul 7, 2019
1 parent 97b4438 commit 8f43969
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions include/hx/LessThanEq.h
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,20 @@ struct CompareTraits< cpp::Variant >
case cpp::Variant::typeInt64: return CompareAsInt64;
case cpp::Variant::typeDouble: return CompareAsDouble;
case cpp::Variant::typeString: return CompareAsString;

case cpp::Variant::typeObject:
{
if (!inValue.valObject)
return CompareAsDynamic;
switch(inValue.valObject->__GetType())
{
case vtInt: case vtBool: return CompareAsInt;
case vtInt64: return CompareAsInt64;
case vtFloat: return CompareAsDouble;
case vtString: return CompareAsString;
default: return CompareAsDynamic;
}
}
default:
return CompareAsDynamic;
}
Expand Down

0 comments on commit 8f43969

Please sign in to comment.