strhash.h

00001 // strhash.h, -*-c++-*-
00002 //
00003 //  Copyright 199 Daniel Burrows
00004 //
00005 //  Make hash_map<string, footype> do the Right Thing.
00006 
00007 #ifndef STRHASH_H
00008 #define STRHASH_H
00009 
00010 #include <cwidget-config.h>
00011 
00012 #ifdef CWIDGET_HAVE_HASH_MAP
00013 #include <hash_map>
00014 #else
00015 #ifdef CWIDGET_HAVE_EXT_HASH_MAP
00016 #include <ext/hash_map>
00017 #else
00018 // Fallback to the non-hashing map class
00019 #include <map>
00020 #define hash_map map
00021 #endif
00022 #endif
00023 
00024 #include <string>
00025 
00026 #if defined(CWIDGET_HAVE_HASH_MAP) || defined(CWIDGET_HAVE_EXT_HASH_MAP)
00027 namespace CWIDGET_HASH_NAMESPACE
00028 {
00029   template <>
00030   struct hash<std::string>
00031   {
00032     inline size_t operator()(const std::string &s) const
00033     {
00034       return hash<char *>()(s.c_str());
00035     }
00036   };
00037 }
00038 #endif
00039 
00040 #endif

Generated on Fri Nov 16 03:33:05 2007 for cwidget by  doxygen 1.5.1