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

Unified Diff: base/files/file_path.h

Issue 2830093003: Replace uses of hash_map in //base (Closed)
Patch Set: WebKit callers Created 3 years, 8 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: base/files/file_path.h
diff --git a/base/files/file_path.h b/base/files/file_path.h
index 0be0ad0b1049e6809574ec5dcd372462cd106d41..56dfc216ad93ab0e01dd459cf0a8be5c19769bc6 100644
--- a/base/files/file_path.h
+++ b/base/files/file_path.h
@@ -472,6 +472,8 @@ void PrintTo(const FilePath& path, std::ostream* out);
// Provide a hash function so that hash_sets and maps can contain FilePath
// objects.
+//
+// TODO(brettw) remove this when base::hash_map is removed.
Łukasz Anforowicz 2017/04/24 18:46:10 I don't understand why we need to wait for removal
brettw 2017/04/25 23:32:36 I missed the forwarding to std::hash. I'll remove.
namespace BASE_HASH_NAMESPACE {
template<>
@@ -483,4 +485,17 @@ struct hash<base::FilePath> {
} // namespace BASE_HASH_NAMESPACE
+namespace std {
+
+template <>
+struct hash<base::FilePath> {
+ typedef base::FilePath argument_type;
+ typedef std::size_t result_type;
+ result_type operator()(argument_type const& f) const {
+ return hash<base::FilePath::StringType>()(f.value());
+ }
+};
+
+} // namespace std
+
#endif // BASE_FILES_FILE_PATH_H_

Powered by Google App Engine
This is Rietveld 408576698