Chromium Code Reviews| 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()); |
|
Sam McNally
2016/09/22 05:40:51
null and empty strings will have the same hash.
tibell
2016/09/22 07:18:33
Done.
|
| + } |
| +}; |
| + |
| +} // namespace std |
| + |
| #endif // MOJO_PUBLIC_CPP_BINDINGS_STRING_H_ |