Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(253)

Unified Diff: mojo/public/cpp/bindings/array.h

Issue 2339413004: Allow Mojo structs as map keys (Closed)
Patch Set: Fix hash unit test on Windows Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « mojo/public/cpp/bindings/BUILD.gn ('k') | mojo/public/cpp/bindings/lib/hash_util.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/public/cpp/bindings/array.h
diff --git a/mojo/public/cpp/bindings/array.h b/mojo/public/cpp/bindings/array.h
index a253da1f3954eed84541177cfee46df4c17a7dfa..8d74763ea975bf7b2b0ad3872fa52652135e27e4 100644
--- a/mojo/public/cpp/bindings/array.h
+++ b/mojo/public/cpp/bindings/array.h
@@ -17,6 +17,7 @@
#include "mojo/public/cpp/bindings/lib/array_internal.h"
#include "mojo/public/cpp/bindings/lib/bindings_internal.h"
#include "mojo/public/cpp/bindings/lib/clone_equals_util.h"
+#include "mojo/public/cpp/bindings/lib/hash_util.h"
#include "mojo/public/cpp/bindings/lib/template_util.h"
#include "mojo/public/cpp/bindings/type_converter.h"
@@ -182,6 +183,10 @@ class Array {
return internal::Equals(vec_, other.vec_);
}
+ size_t Hash(size_t seed) const {
+ return is_null() ? seed : internal::Hash(seed, vec_);
+ }
+
private:
typedef std::vector<T> Array::*Testable;
« no previous file with comments | « mojo/public/cpp/bindings/BUILD.gn ('k') | mojo/public/cpp/bindings/lib/hash_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698