diff options
author | Andreas Stöckel <astoecke@techfak.uni-bielefeld.de> | 2014-11-14 01:23:12 +0100 |
---|---|---|
committer | Andreas Stöckel <astoecke@techfak.uni-bielefeld.de> | 2014-11-14 01:23:12 +0100 |
commit | 8c7531643c1407c785f517116dba1e7bd04f70d3 (patch) | |
tree | 7e0c109c72d58f33bdd6e454d9391175ecd829be /src | |
parent | 8ae1ca37ae7b3e5443221908e7ca2a38a70c96ed (diff) |
fixed equals operator in Handle class when comparing Handles of different types
Diffstat (limited to 'src')
-rw-r--r-- | src/core/dom/Managed.hpp | 16 |
1 files 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<class T2> + bool operator==(const Handle<T2> &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<T> &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<T> &h) { - return h.ptr == o; + return o == h.get(); } /** @@ -419,11 +420,6 @@ public: }; /** - * Null represents a null handle. - */ -static const Handle<Managed> 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 * least as long as the lifetime of the Rooted handle instance. |