STXXL  1.4.1
 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  * Copyright (C) 2014 Timo Bingmann <[email protected]>
11  *
12  * Distributed under the Boost Software License, Version 1.0.
13  * (See accompanying file LICENSE_1_0.txt or copy at
14  * http://www.boost.org/LICENSE_1_0.txt)
15  **************************************************************************/
16 
17 #ifndef STXXL_COMPAT_HASH_MAP_HEADER
18 #define STXXL_COMPAT_HASH_MAP_HEADER
19 
20 #include <stxxl/bits/config.h>
21 #include <stxxl/bits/namespace.h>
22 
23 #if __cplusplus >= 201103L
24  #include <unordered_map>
25 #elif STXXL_MSVC
26  #include <hash_map>
27 #elif defined(__GNUG__) && ((__GNUC__ * 10000 + __GNUC_MINOR__ * 100) >= 40200) && \
28  (!defined(__ICC) || (__ICC > 1110))
29  #include <tr1/unordered_map>
30 #else
31  #include <ext/hash_map>
32 #endif
33 
35 
36 template <class KeyType>
37 struct compat_hash {
38 #if __cplusplus >= 201103L
39  typedef std::hash<KeyType> result;
40 #elif STXXL_MSVC
41  typedef stdext::hash_compare<KeyType> result;
42 #elif defined(__GNUG__) && ((__GNUC__ * 10000 + __GNUC_MINOR__ * 100) >= 40200) && \
43  (!defined(__ICC) || (__ICC > 1110))
44  typedef std::tr1::hash<KeyType> result;
45 #else
46  typedef __gnu_cxx::hash<KeyType> result;
47 #endif
48 };
49 
50 template <class KeyType, class MappedType,
51  class HashType = typename compat_hash<KeyType>::result>
53 #if __cplusplus >= 201103L
54  typedef std::unordered_map<KeyType, MappedType, HashType> result;
55 #elif STXXL_MSVC
56  typedef stdext::hash_map<KeyType, MappedType, HashType> result;
57 #elif defined(__GNUG__) && ((__GNUC__ * 10000 + __GNUC_MINOR__ * 100) >= 40200) && \
58  (!defined(__ICC) || (__ICC > 1110))
59  typedef std::tr1::unordered_map<KeyType, MappedType, HashType> result;
60 #else
61  typedef __gnu_cxx::hash_map<KeyType, MappedType, HashType> result;
62 #endif
63 };
64 
65 template <class KeyType, class MappedType,
66  class HashType = typename compat_hash<KeyType>::result>
68 #if __cplusplus >= 201103L
69  typedef std::unordered_multimap<KeyType, MappedType, HashType> result;
70 #elif STXXL_MSVC
71  typedef stdext::hash_multimap<KeyType, MappedType, HashType> result;
72 #elif defined(__GNUG__) && ((__GNUC__ * 10000 + __GNUC_MINOR__ * 100) >= 40200) && \
73  (!defined(__ICC) || (__ICC > 1110))
74  typedef std::tr1::unordered_multimap<KeyType, MappedType, HashType> result;
75 #else
76  typedef __gnu_cxx::hash_multimap<KeyType, MappedType, HashType> result;
77 #endif
78 };
79 
81 
82 #endif // !STXXL_COMPAT_HASH_MAP_HEADER
__gnu_cxx::hash_multimap< KeyType, MappedType, HashType > result
Definition: hash_map.h:76
__gnu_cxx::hash_map< KeyType, MappedType, HashType > result
Definition: hash_map.h:61
#define STXXL_BEGIN_NAMESPACE
Definition: namespace.h:16
__gnu_cxx::hash< KeyType > result
Definition: hash_map.h:46
#define STXXL_END_NAMESPACE
Definition: namespace.h:17