Luna::Variant::operator==
bool operator==(const Variant &rhs) const
Compares two variant for equality.
Parameters
-
in rhs
The variant to compare.
Return value
Returns true if two variants are equal. Returns false otherwise.
Remark
The comparison is proceeded as follows:1. If this->type() != ths.type(), returns false.
-
Otherwise, checks the type of the variant:1. If
type()isVariantType::null, returnstrue. -
If
type()isVariantType::object, returnstrueif two variants have the same key-value pairs. Every element ofrhswill be compared with the element with the same key in*thisrecursively. -
If
type()isVariantType::array, returnstrueif two variants have the same array data and size. Every element will be compared with the element with the same index in*thisrecursively. -
If
type()isVariantType::number, returnstrueif two variants have the same number type and value. -
If
type()isVariantType::string, returnstrueif two variants have the same string data. The string data is compared by comparing the underlying Name objects that contain the string. -
If
type()isVariantType::boolean, returnstrueif two variants have the same Boolean value. -
If
type()isVariantType::blob, returnstrueif two variants have the same blob data. The blob data is compared using memcmp.