00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef TOOL_HASH_HH_
00023 # define TOOL_HASH_HH_
00024
00025 # ifdef DONT_USE_HASH
00026
00027 # include <set>
00028 # include <map>
00029
00030 # define HASH_NAMESPACE_BEGIN namespace tool {
00031 # define HASH_NAMESPACE_END }
00032
00033 namespace tool
00034 {
00035 template <class T>
00036 struct hash
00037 {
00038 };
00039 }
00040
00041 # else // ! DONT_USE_HASH
00042
00043 # ifdef __GNUC__ // GCC
00044
00045 # if __GNUC__ < 3 // GCC < 3.0
00046 # include <hash_set.h>
00047 # include <hash_map.h>
00048
00049 # define HASH_NAMESPACE_BEGIN
00050 # define HASH_NAMESPACE_END
00051
00052 namespace tool
00053 {
00054 using ::hash_map;
00055 using ::hash_set;
00056 }
00057
00058 # else // GCC >= 3.0
00059 # include <ext/hash_set>
00060 # include <ext/hash_map>
00061
00062 # if __GNUC_MINOR__ == 0 // GCC 3.0
00063
00064 # define HASH_NAMESPACE_BEGIN namespace std {
00065 # define HASH_NAMESPACE_END }
00066
00067 namespace tool
00068 {
00069 using ::std::hash_map;
00070 using ::std::hash_set;
00071 }
00072
00073 # else // GCC 3.1 and later
00074
00075 # define HASH_NAMESPACE_BEGIN namespace __gnu_cxx {
00076 # define HASH_NAMESPACE_END }
00077
00078 namespace tool
00079 {
00080 using ::__gnu_cxx::hash_map;
00081 using ::__gnu_cxx::hash_set;
00082 }
00083
00084 # endif // __GNUC_MINOR__ == 0
00085 # endif // __GNUC__ < 3
00086
00087 # else // ! __GNUC__ // ... There are other compilers, right?
00088
00089 # include <hash_set>
00090 # include <hash_map>
00091
00092 # define HASH_NAMESPACE_BEGIN namespace std {
00093 # define HASH_NAMESPACE_END }
00094
00095 namespace tool
00096 {
00097 using ::std::hash_map;
00098 using ::std::hash_set;
00099 }
00100
00101 # endif // __GNUC__
00102 # endif // DONT_USE_HASH
00103
00104 #endif // ! TOOL_HASH_HH_