From 8c7531643c1407c785f517116dba1e7bd04f70d3 Mon Sep 17 00:00:00 2001 From: Andreas Stöckel Date: Fri, 14 Nov 2014 01:23:12 +0100 Subject: fixed equals operator in Handle class when comparing Handles of different types --- src/core/dom/Managed.hpp | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/src/core/dom/Managed.hpp b/src/core/dom/Managed.hpp index aab18a5..deccb99 100644 --- a/src/core/dom/Managed.hpp +++ b/src/core/dom/Managed.hpp @@ -389,22 +389,23 @@ public: /** * Comparison operator between base Owned and base Owned. */ - bool operator==(const Handle &h) const { return ptr == h.ptr; } + template + bool operator==(const Handle &h) const { return ptr == h.get(); } /** * Comparison operator between base Owned and pointer. */ - friend bool operator==(const Handle &h, const Managed *o) + friend bool operator==(const Handle &h, const Managed *o) { - return h.ptr == o; + return h.get() == o; } /** * Comparison operator between base Owned and pointer. */ - friend bool operator==(const Managed *o, const Handle &h) + friend bool operator==(const Managed *o, const Handle &h) { - return h.ptr == o; + return o == h.get(); } /** @@ -418,11 +419,6 @@ public: bool operator!() const { return isNull(); } }; -/** - * Null represents a null handle. - */ -static const Handle Null{nullptr}; - /** * A Rooted represents a directed, garbage collected pointer at a managed * object. The lifetime of the represented managed object is guaranteed to be at -- cgit v1.2.3