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

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

Issue 2339413004: Allow Mojo structs as map keys (Closed)
Patch Set: Revert no-longer-needed changes to clone_equals_util.h 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
Index: mojo/public/cpp/bindings/string.h
diff --git a/mojo/public/cpp/bindings/string.h b/mojo/public/cpp/bindings/string.h
index 7cfd713f66959bbaac1e17d92127039d11bf31c7..42f2dbc097ad0b0226788656273441a7c39a583d 100644
--- a/mojo/public/cpp/bindings/string.h
+++ b/mojo/public/cpp/bindings/string.h
@@ -7,6 +7,7 @@
#include <stddef.h>
+#include <functional>
#include <string>
#include "base/logging.h"
@@ -193,4 +194,15 @@ struct TypeConverter<String, const char*> {
} // namespace mojo
+namespace std {
+
+template <>
+struct hash<mojo::String> {
+ size_t operator()(const mojo::String& value) const {
+ return hash<std::string>()(value.get());
+ }
+};
+
+} // namespace std
+
#endif // MOJO_PUBLIC_CPP_BINDINGS_STRING_H_

Powered by Google App Engine
This is Rietveld 408576698