Skip to content
This repository was archived by the owner on Mar 26, 2020. It is now read-only.

Commit dabb88e

Browse files
committed
operator== could be faster by checking node identity
1 parent db00e93 commit dabb88e

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

json11.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -302,6 +302,8 @@ const Json & JsonArray::operator[] (size_t i) const {
302302
bool Json::operator== (const Json &other) const {
303303
if (m_ptr->type() != other.m_ptr->type())
304304
return false;
305+
if (m_ptr == other.m_ptr)
306+
return true;
305307

306308
return m_ptr->equals(other.m_ptr.get());
307309
}

0 commit comments

Comments
 (0)