Adonthell  0.4
str_hash.h
Go to the documentation of this file.
00001 /*
00002    $Id: str_hash.h,v 1.4 2002/06/28 12:15:21 gnurou Exp $
00003 
00004    (C) Copyright 2001 Alexandre Courbot
00005    Part of the Adonthell Project http://adonthell.linuxgames.com
00006 
00007    This program is free software; you can redistribute it and/or modify
00008    it under the terms of the GNU General Public License.
00009    This program is distributed in the hope that it will be useful,
00010    but WITHOUT ANY WARRANTY.
00011 
00012    See the COPYING file for more details
00013 */
00014 
00015 /**
00016  * @file   str_hash.h
00017  * @author Alexandre Courbot <alexandrecourbot@linuxgames.com>
00018  * 
00019  * @brief  Declares the hash<string> type, to be able to declare
00020  *         hash_maps with strings as keys.
00021  */ 
00022 
00023 #ifndef STR_HASH_
00024 #define STR_HASH_
00025  
00026 #if __GNUG__ > 2
00027 #include <ext/hash_map>
00028 #else
00029 #include <hash_map>
00030 #endif
00031 #include <string>
00032 
00033 #if __GNUG__ > 2
00034 namespace __gnu_cxx
00035 #else
00036 namespace std
00037 #endif
00038 {
00039     template<> struct hash<std::string>
00040     {
00041         size_t operator()(const std::string & __s) const { return __stl_hash_string(__s.c_str()); }
00042     };
00043     
00044     
00045 };
00046 
00047 #if __GNUG__ > 2
00048 namespace std { using namespace __gnu_cxx; };
00049 #endif
00050 
00051 #endif