From 58dd73a2dc5dafa81aebfb2bcbe08b7e03f816d2 Mon Sep 17 00:00:00 2001 From: chillitom Date: Thu, 9 Dec 2010 19:13:39 +0800 Subject: [PATCH] add Equals and HashCode to managed pointer MCefRefPtr --- CefSharp/ManagedCefRefPtr.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/CefSharp/ManagedCefRefPtr.h b/CefSharp/ManagedCefRefPtr.h index 2905bd1d9..8a6dcdf4d 100644 --- a/CefSharp/ManagedCefRefPtr.h +++ b/CefSharp/ManagedCefRefPtr.h @@ -96,6 +96,21 @@ public: swap(%r._ptr); } + virtual bool Equals(Object^ obj) override + { + if(obj->GetType() == GetType()) + { + MCefRefPtr^ other = safe_cast(obj); + return (*other)._ptr == _ptr; + } + return false; + } + + virtual int GetHashCode() override + { + return (int)_ptr; + } + private: T* _ptr; };