Index: src/handles.h |
diff --git a/src/handles.h b/src/handles.h |
index eb57f0e26089383c9d7fe9f57a8cba5f41a111e2..7a296fe68a16acb2f1d05a076f1c84614bf82970 100644 |
--- a/src/handles.h |
+++ b/src/handles.h |
@@ -66,14 +66,32 @@ class MaybeHandle { |
bool is_null() const { return location_ == NULL; } |
+ template <typename S> |
+ bool operator==(MaybeHandle<S> that) const { |
+ return this->location_ == that.location_; |
+ } |
+ template <typename S> |
+ bool operator!=(MaybeHandle<S> that) const { |
+ return !(*this == that); |
+ } |
+ |
+ |
protected: |
T** location_; |
// MaybeHandles of different classes are allowed to access each |
// other's location_. |
template<class S> friend class MaybeHandle; |
+ template <typename S> |
+ friend size_t hash_value(MaybeHandle<S>); |
}; |
+template <typename S> |
+inline size_t hash_value(MaybeHandle<S> maybe_handle) { |
+ return bit_cast<size_t>(maybe_handle.location_); |
+} |
+ |
+ |
// ---------------------------------------------------------------------------- |
// A Handle provides a reference to an object that survives relocation by |
// the garbage collector. |