b6eda7a0127ef4594c20986ae893612c9f501ebd
[oota-llvm.git] / include / Support / hash_map
1 //===-- Support/hash_map - "Portable" wrapper around hash_map ---*- C++ -*-===//
2 // vim:ft=cpp
3 // 
4 // This file provides a wrapper around the mysterious <hash_map> header file
5 // that seems to move around between GCC releases into and out of namespaces at
6 // will.  #including this header will cause hash_map to be available in the
7 // global namespace.
8 //
9 //===----------------------------------------------------------------------===//
10
11 #ifndef SUPPORT_HASH_MAP
12 #define SUPPORT_HASH_MAP
13
14 // Compiler Support Matrix
15 //
16 // Version   Namespace   Header File
17 //  2.95.x       ::        hash_map
18 //  3.0.4       std      ext/hash_map
19 //  3.1      __gnu_cxx   ext/hash_map
20 //
21
22 #include "Config/config.h"
23
24 #ifdef HAVE_GNU_EXT_HASH_MAP
25 // This is for GCC-3.1+ which puts hash in ext/hash_map
26 #include <ext/hash_map>
27 #define HASH_NAMESPACE __gnu_cxx
28
29 #else
30
31 // This is for GCC-3.0.x which puts hashmap in the `ext' directory.
32 #ifdef HAVE_STD_EXT_HASH_MAP
33 #include <ext/hash_map>
34 #define HASH_NAMESPACE std
35
36 #else
37 // This handles older, pre-3.0 GCC which do not have the extentions in the `ext'
38 // directory, and ignore the `std' namespace.
39 #include <hash_map>
40 #define HASH_NAMESPACE std
41 #endif
42
43 #endif
44
45 using HASH_NAMESPACE::hash_map;
46 using HASH_NAMESPACE::hash_multimap;
47 using HASH_NAMESPACE::hash;
48
49 // Include vector because ext/hash_map includes stl_vector.h and leaves
50 // out specializations like stl_bvector.h, causing link conflicts.
51 #include <vector>
52
53 #include <Support/HashExtras.h>
54
55 #endif