Skip to content

Commit 360cb04

Browse files
committed
api: refactor equality comparision operator of __jule_Any
1 parent a8b6779 commit 360cb04

1 file changed

Lines changed: 2 additions & 10 deletions

File tree

api/any.hpp

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -140,16 +140,8 @@ class __jule_Any {
140140
if (this->operator==(nullptr)) {
141141
return other.operator==(nullptr);
142142
}
143-
144-
if (other.operator==(nullptr)) {
145-
return false;
146-
}
147-
148-
if (this->type != other.type) {
149-
return false;
150-
}
151-
152-
return this->type->eq(this->data.alloc, other.data.alloc);
143+
return other.operator!=(nullptr) && this->type == other.type &&
144+
this->type->eq(this->data.alloc, other.data.alloc);
153145
}
154146

155147
inline __jule_Bool operator!=(const __jule_Any &other) const noexcept {

0 commit comments

Comments
 (0)