strusBase  0.17
unordered_map.hpp
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2017 Patrick P. Frey
3  *
4  * This Source Code Form is subject to the terms of the Mozilla Public
5  * License, v. 2.0. If a copy of the MPL was not distributed with this
6  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
7  */
9 #ifndef _STRUS_UNORDERED_MAP_HPP_INCLUDED
10 #define _STRUS_UNORDERED_MAP_HPP_INCLUDED
11 
13 #if defined __GNUC__
14 #define STRUS_GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__)
15 #endif
16 
17 #undef STRUS_USE_STD_UNORDERED_MAP
18 #if __cplusplus >= 201103L
19 #if defined __clang__
20 #define STRUS_USE_STD_UNORDERED_MAP
21 #elif defined __GNUC__
22 #if STRUS_GCC_VERSION >= 40900
23 #define STRUS_USE_STD_UNORDERED_MAP
24 #endif // STRUS_GCC_VERSION
25 #endif // __clang__
26 #endif // __cplusplus
27 
28 #ifdef STRUS_USE_STD_UNORDERED_MAP
29 #include <unordered_map>
30 #include <functional>
31 
32 namespace strus {
33 
34 template<typename Key, typename Elem, typename Hash = std::hash<Key>, typename Pred = std::equal_to<Key> >
35 class unordered_map
36  :public std::unordered_map<Key,Elem,Hash,Pred>
37 {
38 public:
39  unordered_map(){}
40  unordered_map( const unordered_map& o)
41  :std::unordered_map<Key,Elem>(){}
42 };
43 }//namespace
44 
45 #else //STRUS_USE_STD_UNORDERED_MAP
46 #include <boost/unordered_map.hpp>
47 #include <functional>
48 
49 namespace strus {
50 
51 template<typename Key, typename Elem, typename Hash = boost::hash<Key>, typename Pred = std::equal_to<Key> >
53  :public boost::unordered_map<Key,Elem,Hash,Pred>
54 {
55 public:
58  :boost::unordered_map<Key,Elem>(){}
59 };
60 }//namespace
61 #endif //STRUS_USE_STD_UNORDERED_MAP
62 
63 #endif
64 
unordered_map(const unordered_map &o)
Definition: unordered_map.hpp:57
Definition: unordered_map.hpp:52
unordered_map()
Definition: unordered_map.hpp:56