STXXL  1.4.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
hash_map.h
Go to the documentation of this file.
1 /***************************************************************************
2  * include/stxxl/bits/compat/hash_map.h
3  *
4  * compatibility interface to C++ standard extension hash_map
5  *
6  * Part of the STXXL. See http://stxxl.sourceforge.net
7  *
8  * Copyright (C) 2008, 2010, 2011 Andreas Beckmann <[email protected]>
9  * Copyright (C) 2009, 2010 Johannes Singler <[email protected]>
10  *
11  * Distributed under the Boost Software License, Version 1.0.
12  * (See accompanying file LICENSE_1_0.txt or copy at
13  * http://www.boost.org/LICENSE_1_0.txt)
14  **************************************************************************/
15 
16 #ifndef STXXL_COMPAT_HASH_MAP_HEADER
17 #define STXXL_COMPAT_HASH_MAP_HEADER
18 
19 #include <stxxl/bits/config.h>
20 #include <stxxl/bits/namespace.h>
21 
22 #if defined(__GXX_EXPERIMENTAL_CXX0X__)
23  #include <unordered_map>
24 #elif STXXL_MSVC
25  #include <hash_map>
26 #elif defined(__GNUG__) && ((__GNUC__ * 10000 + __GNUC_MINOR__ * 100) >= 40200) && \
27  (!defined(__ICC) || (__ICC > 1110))
28  #include <tr1/unordered_map>
29 #else
30  #include <ext/hash_map>
31 #endif
32 
34 
35 template <class _Tp>
36 struct compat_hash {
37 #if defined(__GXX_EXPERIMENTAL_CXX0X__)
38  typedef std::hash<_Tp> result;
39 #elif STXXL_MSVC
40  typedef stdext::hash_compare<_Tp> result;
41 #elif defined(__GNUG__) && ((__GNUC__ * 10000 + __GNUC_MINOR__ * 100) >= 40200) && \
42  (!defined(__ICC) || (__ICC > 1110))
43  typedef std::tr1::hash<_Tp> result;
44 #else
45  typedef __gnu_cxx::hash<_Tp> result;
46 #endif
47 };
48 
49 template <class _Key, class _Tp, class _Hash = typename compat_hash<_Key>::result>
51 #if defined(__GXX_EXPERIMENTAL_CXX0X__)
52  typedef std::unordered_map<_Key, _Tp, _Hash> result;
53 #elif STXXL_MSVC
54  typedef stdext::hash_map<_Key, _Tp, _Hash> result;
55 #elif defined(__GNUG__) && ((__GNUC__ * 10000 + __GNUC_MINOR__ * 100) >= 40200) && \
56  (!defined(__ICC) || (__ICC > 1110))
57  typedef std::tr1::unordered_map<_Key, _Tp, _Hash> result;
58 #else
59  typedef __gnu_cxx::hash_map<_Key, _Tp, _Hash> result;
60 #endif
61 };
62 
64 
65 #endif // !STXXL_COMPAT_HASH_MAP_HEADER
#define STXXL_BEGIN_NAMESPACE
Definition: namespace.h:16
__gnu_cxx::hash< _Tp > result
Definition: hash_map.h:45
__gnu_cxx::hash_map< _Key, _Tp, _Hash > result
Definition: hash_map.h:59
#define STXXL_END_NAMESPACE
Definition: namespace.h:17