summaryrefslogtreecommitdiff
path: root/stlport/systemstl/hash_map
blob: 5c2777f85c9787e336e6600e57dadd5d67fa969c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
/**************************************************************
 * 
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance
 * with the License.  You may obtain a copy of the License at
 * 
 *   http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on an
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 * KIND, either express or implied.  See the License for the
 * specific language governing permissions and limitations
 * under the License.
 * 
 *************************************************************/

#ifndef SYSTEM_STL_HASHMAP
#define SYSTEM_STL_HASHMAP

#ifdef HAVE_STL_INCLUDE_PATH
    // TODO: use computed include file name
    #include_next <unordered_map>
#elif defined(__cplusplus) && (__cplusplus >= 201103L)
    #include <unordered_map>
#elif defined(_MSC_VER)
    #pragma warning(push)
    #pragma warning(disable:4555)
    #include <../../VC/include/unordered_map>
    #pragma warning(pop)
    #define STLP4_EMUBASE_NS ::std::tr1
#else // fall back to boost/tr1
    #include <boost/tr1/tr1/unordered_map>
    #define STLP4_EMUBASE_NS ::boost
#endif


#ifndef NO_STLPORT4_EMULATION

namespace std
{
#ifdef STLP4_EMUBASE_NS
	using STLP4_EMUBASE_NS::hash;
	using STLP4_EMUBASE_NS::unordered_map;
	using STLP4_EMUBASE_NS::unordered_multimap;
	#undef STLP4_EMUBASE_NS
#endif


template<
	typename __K,
	typename __T,
	typename __H = hash<__K>,
	typename __E = equal_to<__K>,
	typename __A = allocator<pair<__K,__T> > >
class hash_map
:	public unordered_map<__K,__T,__H,__E,__A>
{
public:
	typedef unordered_map<__K,__T,__H,__E,__A> _super;

	hash_map( void) {}
	hash_map( size_t n) : _super( n) {}

private:
	// setting the hasher dynamically is not supported in the emulation!
	hash_map( size_t, const __H&, const __E& rE=__E(), const __A& rA=__A()); // not implemented
};

template<
	typename __K,
	typename __T,
	typename __H = hash<__K>,
	typename __E = equal_to<__K>,
	typename __A = allocator<pair<__K,__T> > >
class hash_multimap
:	public unordered_multimap<__K,__T,__H,__E,__A>
{
public:
	typedef unordered_multimap<__K,__T,__H,__E,__A> _super;

	hash_multimap( void) {}
	hash_multimap( size_t n) : _super( n) {}

private:
	// setting the hasher dynamically is not supported in the emulation!
	hash_multimap( size_t, const __H&, const __E& rE=__E(), const __A& rA=__A()); // not implemented
};

} // namespace std

#endif // NO_STLPORT4_EMULATION

#endif