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..d5035792b5c556fb6546e295aeb664a23a5d79ce 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,16 @@ struct TypeConverter<String, const char*> { |
} // namespace mojo |
+namespace std { |
+ |
+template <> |
+struct hash<mojo::String> { |
+ size_t operator()(const mojo::String& value) const { |
+ // TODO(tibell): Is |value| nullable? |
yzshen1
2016/09/20 23:44:40
value.get() won't fail even if |value| is null.
tibell
2016/09/21 07:10:53
Done.
|
+ return hash<std::string>()(value.get()); |
+ } |
+}; |
+ |
+} // namespace std |
+ |
#endif // MOJO_PUBLIC_CPP_BINDINGS_STRING_H_ |