diff options
author | avi@google.com <avi@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-12-17 16:05:15 +0000 |
---|---|---|
committer | avi@google.com <avi@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-12-17 16:05:15 +0000 |
commit | 9762f54d6f7b357b278dfffd7b47c44e63271db9 (patch) | |
tree | 3058df3fee825ff2ebf0596c4d38bfb1eed608c0 /base/file_path.h | |
parent | f59319f082c8fb59639cb7e4a420da17f5bcdb63 (diff) | |
download | chromium_src-9762f54d6f7b357b278dfffd7b47c44e63271db9.zip chromium_src-9762f54d6f7b357b278dfffd7b47c44e63271db9.tar.gz chromium_src-9762f54d6f7b357b278dfffd7b47c44e63271db9.tar.bz2 |
Allow hashmaps and hashsets of FilePath.
Review URL: http://codereview.chromium.org/14167
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@7138 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/file_path.h')
-rw-r--r-- | base/file_path.h | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/base/file_path.h b/base/file_path.h index 9049176..ae116ea 100644 --- a/base/file_path.h +++ b/base/file_path.h @@ -70,6 +70,11 @@ #include "base/basictypes.h" #include "base/compiler_specific.h" +#if defined(COMPILER_GCC) +#include <ext/hash_fun.h> +#include <tr1/functional> +#endif + // Windows-style drive letter support and pathname separator characters can be // enabled and disabled independently, to aid testing. These #defines are // here so that the same setting can be used in both the implementation and @@ -195,4 +200,18 @@ class FilePath { #define FILE_PATH_LITERAL(x) L ## x #endif // OS_WIN +#if defined(COMPILER_GCC) +// Implement hash function so that we can use FilePaths in hashsets and maps. +namespace __gnu_cxx { + +template<> +struct hash<FilePath> { + size_t operator()(const FilePath& f) const { + return std::tr1::hash<FilePath::StringType>()(f.value()); + } +}; + +} // namespace __gnu_cxx +#endif // defined(COMPILER_GCC) + #endif // BASE_FILE_PATH_H_ |