Adonthell  0.4
str_hash.h
Go to the documentation of this file.
1 /*
2  $Id: str_hash.h,v 1.4 2002/06/28 12:15:21 gnurou Exp $
3 
4  (C) Copyright 2001 Alexandre Courbot
5  Part of the Adonthell Project http://adonthell.linuxgames.com
6 
7  This program is free software; you can redistribute it and/or modify
8  it under the terms of the GNU General Public License.
9  This program is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY.
11 
12  See the COPYING file for more details
13 */
14 
15 /**
16  * @file str_hash.h
17  * @author Alexandre Courbot <alexandrecourbot@linuxgames.com>
18  *
19  * @brief Declares the hash<string> type, to be able to declare
20  * hash_maps with strings as keys.
21  */
22 
23 #ifndef STR_HASH_
24 #define STR_HASH_
25 
26 #if __GNUG__ > 2
27 #include <ext/hash_map>
28 #else
29 #include <hash_map>
30 #endif
31 #include <string>
32 
33 #if __GNUG__ > 2
34 namespace __gnu_cxx
35 #else
36 namespace std
37 #endif
38 {
39  template<> struct hash<std::string>
40  {
41  size_t operator()(const std::string & __s) const { return __stl_hash_string(__s.c_str()); }
42  };
43 
44 
45 };
46 
47 #if __GNUG__ > 2
48 namespace std { using namespace __gnu_cxx; };
49 #endif
50 
51 #endif
Definition: str_hash.h:36