From 9762f54d6f7b357b278dfffd7b47c44e63271db9 Mon Sep 17 00:00:00 2001 From: "avi@google.com" Date: Wed, 17 Dec 2008 16:05:15 +0000 Subject: 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 --- base/file_path.h | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'base/file_path.h') 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 +#include +#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 { + size_t operator()(const FilePath& f) const { + return std::tr1::hash()(f.value()); + } +}; + +} // namespace __gnu_cxx +#endif // defined(COMPILER_GCC) + #endif // BASE_FILE_PATH_H_ -- cgit v1.1