Core: Cleanup Variant comparison operators
This commit is contained in:
parent
eb3d6d8cd3
commit
cabbc616c2
2 changed files with 6 additions and 15 deletions
|
|
@ -865,17 +865,6 @@ bool Variant::operator==(const Variant &p_variant) const {
|
|||
return hash_compare(p_variant);
|
||||
}
|
||||
|
||||
bool Variant::operator!=(const Variant &p_variant) const {
|
||||
// Don't use `!hash_compare(p_variant)` given it makes use of OP_EQUAL
|
||||
if (type != p_variant.type) { //evaluation of operator== needs to be more strict
|
||||
return true;
|
||||
}
|
||||
bool v;
|
||||
Variant r;
|
||||
evaluate(OP_NOT_EQUAL, *this, p_variant, r, v);
|
||||
return r;
|
||||
}
|
||||
|
||||
bool Variant::operator<(const Variant &p_variant) const {
|
||||
if (type != p_variant.type) { //if types differ, then order by type first
|
||||
return type < p_variant.type;
|
||||
|
|
|
|||
|
|
@ -835,11 +835,13 @@ public:
|
|||
static void get_utility_function_list(List<StringName> *r_functions);
|
||||
static int get_utility_function_count();
|
||||
|
||||
//argsVariant call()
|
||||
[[nodiscard]] bool operator==(const Variant &p_variant) const;
|
||||
[[nodiscard]] bool operator<(const Variant &p_variant) const;
|
||||
[[nodiscard]] _ALWAYS_INLINE_ bool operator!=(const Variant &p_variant) const { return !(*this == p_variant); }
|
||||
[[nodiscard]] _ALWAYS_INLINE_ bool operator<=(const Variant &p_variant) const { return !(p_variant < *this); }
|
||||
[[nodiscard]] _ALWAYS_INLINE_ bool operator>(const Variant &p_variant) const { return p_variant < *this; }
|
||||
[[nodiscard]] _ALWAYS_INLINE_ bool operator>=(const Variant &p_variant) const { return !(*this < p_variant); }
|
||||
|
||||
bool operator==(const Variant &p_variant) const;
|
||||
bool operator!=(const Variant &p_variant) const;
|
||||
bool operator<(const Variant &p_variant) const;
|
||||
uint32_t hash() const;
|
||||
uint32_t recursive_hash(int recursion_count) const;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue