xref: /aoo42x/main/stlport/systemstl/hash_map (revision dee715a7)
1e76eebc6SAndrew Rist/**************************************************************
2cdf0e10cSrcweir *
3e76eebc6SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one
4e76eebc6SAndrew Rist * or more contributor license agreements.  See the NOTICE file
5e76eebc6SAndrew Rist * distributed with this work for additional information
6e76eebc6SAndrew Rist * regarding copyright ownership.  The ASF licenses this file
7e76eebc6SAndrew Rist * to you under the Apache License, Version 2.0 (the
8e76eebc6SAndrew Rist * "License"); you may not use this file except in compliance
9e76eebc6SAndrew Rist * with the License.  You may obtain a copy of the License at
10e76eebc6SAndrew Rist *
11e76eebc6SAndrew Rist *   http://www.apache.org/licenses/LICENSE-2.0
12e76eebc6SAndrew Rist *
13e76eebc6SAndrew Rist * Unless required by applicable law or agreed to in writing,
14e76eebc6SAndrew Rist * software distributed under the License is distributed on an
15e76eebc6SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16e76eebc6SAndrew Rist * KIND, either express or implied.  See the License for the
17e76eebc6SAndrew Rist * specific language governing permissions and limitations
18e76eebc6SAndrew Rist * under the License.
19e76eebc6SAndrew Rist *
20e76eebc6SAndrew Rist *************************************************************/
21cdf0e10cSrcweir
22cdf0e10cSrcweir#ifndef SYSTEM_STL_HASHMAP
23cdf0e10cSrcweir#define SYSTEM_STL_HASHMAP
24cdf0e10cSrcweir
25*dee715a7SHerbert Dürr#ifdef HAVE_STL_INCLUDE_PATH
26*dee715a7SHerbert Dürr	// TODO: use computed include file name
27*dee715a7SHerbert Dürr	#include_next <unordered_map>
28*dee715a7SHerbert Dürr#elif defined(_MSC_VER)
29*dee715a7SHerbert Dürr	#include <../../VC/include/unordered_map>
30*dee715a7SHerbert Dürr	#define STLP4_EMUBASE_NS ::std::tr1
31*dee715a7SHerbert Dürr#else // fall back to boost/tr1
32*dee715a7SHerbert Dürr	#include <boost/tr1/tr1/unordered_map>
33*dee715a7SHerbert Dürr	#define STLP4_EMUBASE_NS ::boost
34*dee715a7SHerbert Dürr#endif
35cdf0e10cSrcweir
36cdf0e10cSrcweir
37*dee715a7SHerbert Dürr#ifndef NO_STLPORT4_EMULATION
38cdf0e10cSrcweir
39*dee715a7SHerbert Dürrnamespace std
40cdf0e10cSrcweir{
41*dee715a7SHerbert Dürr#ifdef STLP4_EMUBASE_NS
42*dee715a7SHerbert Dürr	using STLP4_EMUBASE_NS::hash;
43*dee715a7SHerbert Dürr	using STLP4_EMUBASE_NS::unordered_map;
44*dee715a7SHerbert Dürr	using STLP4_EMUBASE_NS::unordered_multimap;
45*dee715a7SHerbert Dürr	#undef STLP4_EMUBASE_NS
46*dee715a7SHerbert Dürr#endif
47cdf0e10cSrcweir
48*dee715a7SHerbert Dürr
49*dee715a7SHerbert Dürrtemplate<
50*dee715a7SHerbert Dürr	typename __K,
51*dee715a7SHerbert Dürr	typename __T,
52*dee715a7SHerbert Dürr	typename __H = hash<__K>,
53*dee715a7SHerbert Dürr	typename __E = equal_to<__K>,
54*dee715a7SHerbert Dürr	typename __A = allocator<pair<__K,__T> > >
55*dee715a7SHerbert Dürrclass hash_map
56*dee715a7SHerbert Dürr:	public unordered_map<__K,__T,__H,__E,__A>
57*dee715a7SHerbert Dürr{
58*dee715a7SHerbert Dürrpublic:
59*dee715a7SHerbert Dürr	typedef unordered_map<__K,__T,__H,__E,__A> _super;
60*dee715a7SHerbert Dürr	typedef __T data_type;
61*dee715a7SHerbert Dürr
62*dee715a7SHerbert Dürr	hash_map( void) {}
63*dee715a7SHerbert Dürr	hash_map( size_t n) : _super( n) {}
64*dee715a7SHerbert Dürr
65*dee715a7SHerbert Dürr#ifdef BOOST_TR1_UNORDERED_MAP_INCLUDED // workaround pre-BOOST_UNORDERED_USE_MOVE problem
66*dee715a7SHerbert Dürr	// in derived classes the copy assignment operator can only be declared implicitly if
67*dee715a7SHerbert Dürr	// its base class's assignment operator has the canonical signature.
68*dee715a7SHerbert Dürr	// boost's assignment operators don't have this canonical signature when move-semantics are enabled
69*dee715a7SHerbert Dürr	hash_map& operator=( const hash_map& r) { hash_map c(r); this->swap(c); return *this; }
70*dee715a7SHerbert Dürr#endif
71*dee715a7SHerbert Dürr
72*dee715a7SHerbert Dürr	void resize( size_t n) { _super::rehash(n); }
73*dee715a7SHerbert Dürrprivate:
74*dee715a7SHerbert Dürr	// setting the hasher dynamically is not supported in the emulation!
75*dee715a7SHerbert Dürr	hash_map( size_t, const __H&, const __E& rE=__E(), const __A& rA=__A()); // not implemented
76*dee715a7SHerbert Dürr};
77*dee715a7SHerbert Dürr
78*dee715a7SHerbert Dürrtemplate<
79*dee715a7SHerbert Dürr	typename __K,
80*dee715a7SHerbert Dürr	typename __T,
81*dee715a7SHerbert Dürr	typename __H = hash<__K>,
82*dee715a7SHerbert Dürr	typename __E = equal_to<__K>,
83*dee715a7SHerbert Dürr	typename __A = allocator<pair<__K,__T> > >
84*dee715a7SHerbert Dürrclass hash_multimap
85*dee715a7SHerbert Dürr:	public unordered_multimap<__K,__T,__H,__E,__A>
86cdf0e10cSrcweir{
87*dee715a7SHerbert Dürrpublic:
88*dee715a7SHerbert Dürr	typedef unordered_multimap<__K,__T,__H,__E,__A> _super;
89*dee715a7SHerbert Dürr	typedef __T data_type;
90*dee715a7SHerbert Dürr
91*dee715a7SHerbert Dürr	hash_multimap( void) {}
92*dee715a7SHerbert Dürr	hash_multimap( size_t n) : _super( n) {}
93*dee715a7SHerbert Dürr
94*dee715a7SHerbert Dürr#ifdef BOOST_TR1_UNORDERED_MAP_INCLUDED // workaround pre-BOOST_UNORDERED_USE_MOVE problem
95*dee715a7SHerbert Dürr	// in derived classes the copy assignment operator can only be declared implicitly if
96*dee715a7SHerbert Dürr	// its base class's assignment operator has the canonical signature.
97*dee715a7SHerbert Dürr	// boost's assignment operators don't have this canonical signature when move-semantics are enabled
98*dee715a7SHerbert Dürr	hash_multimap& operator=( const hash_multimap& r) { hash_multimap c(r); this->swap(c); return *this; }
99cdf0e10cSrcweir#endif
100cdf0e10cSrcweir
101*dee715a7SHerbert Dürr	void resize( size_t n) { _super::rehash(n); }
102*dee715a7SHerbert Dürrprivate:
103*dee715a7SHerbert Dürr	// setting the hasher dynamically is not supported in the emulation!
104*dee715a7SHerbert Dürr	hash_multimap( size_t, const __H&, const __E& rE=__E(), const __A& rA=__A()); // not implemented
105*dee715a7SHerbert Dürr};
106*dee715a7SHerbert Dürr
107*dee715a7SHerbert Dürr} // namespace std
108*dee715a7SHerbert Dürr
109*dee715a7SHerbert Dürr#endif // NO_STLPORT4_EMULATION
110cdf0e10cSrcweir
111cdf0e10cSrcweir#endif
112*dee715a7SHerbert Dürr
113