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

Unified Diff: base/hash_tables.h

Issue 20041: Make possible using pointer as a hash_table key when compiling using GCC. (Closed)
Patch Set: Created 11 years, 11 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/hash_tables.h
diff --git a/base/hash_tables.h b/base/hash_tables.h
index c2d3ddba158cf77cce5d21dbdb53935b33766cfc..6d1afbdd078e48460de782853b64d16dd3af1eba 100644
--- a/base/hash_tables.h
+++ b/base/hash_tables.h
@@ -7,7 +7,7 @@
// Deal with the differences between Microsoft and GNU implemenations
// of hash_map. Allows all platforms to use |base::hash_map| and
// |base::hash_set|.
-// eg:
+// eg:
// base::hash_map<int> my_map;
// base::hash_set<int> my_set;
//
@@ -77,7 +77,21 @@ struct hash<const std::string> {
size_t operator()(const std::string& s) const {
return std::tr1::hash<std::string>()(s);
}
-};
+};
+
+template<typename T>
+struct hash<T*> {
+ size_t operator()(T* s) const {
+ return std::tr1::hash<T*>()(s);
+ }
+};
+
+template<typename T>
+struct hash<const T*> {
+ size_t operator()(const T* s) const {
+ return std::tr1::hash<const T*>()(s);
+ }
+};
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698