xref: /trunk/main/stlport/systemstl/hash_set (revision 0021d11d)
1/**************************************************************
2 *
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements.  See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership.  The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance
9 * with the License.  You may obtain a copy of the License at
10 *
11 *   http://www.apache.org/licenses/LICENSE-2.0
12 *
13 * Unless required by applicable law or agreed to in writing,
14 * software distributed under the License is distributed on an
15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16 * KIND, either express or implied.  See the License for the
17 * specific language governing permissions and limitations
18 * under the License.
19 *
20 *************************************************************/
21
22#ifndef SYSTEM_STL_HASHSET
23#define SYSTEM_STL_HASHSET
24
25#ifdef HAVE_STL_INCLUDE_PATH
26	// TODO: use computed include file name
27	#include_next <unordered_set>
28#elif defined(__cplusplus) && (__cplusplus >= 201103L)
29	#include <unordered_set>
30#elif defined(_MSC_VER)
31	#include <../../VC/include/unordered_set>
32	#define STLP4_EMUBASE_NS ::std::tr1
33#else // fall back to boost/tr1
34	#include <boost/tr1/tr1/unordered_set>
35	#define STLP4_EMUBASE_NS ::boost
36#endif
37
38
39#ifndef NO_STLPORT4_EMULATION
40
41namespace std
42{
43#ifdef STLP4_EMUBASE_NS
44	using STLP4_EMUBASE_NS::hash;
45	using STLP4_EMUBASE_NS::unordered_set;
46	using STLP4_EMUBASE_NS::unordered_multiset;
47	#undef STLP4_EMUBASE_NS
48#endif
49
50
51template<
52	typename __K,
53	typename __H = hash<__K>,
54	typename __E = equal_to<__K>,
55	typename __A = allocator<__K> >
56class hash_set
57:	public unordered_set<__K,__H,__E,__A>
58{
59	typedef unordered_set<__K,__H,__E,__A> _super;
60public:
61	hash_set( void) {}
62	hash_set( size_t n) : _super(n) {}
63
64private:
65	// setting the hasher dynamically is not supported in the emulation!
66	hash_set( size_t, const __H&, const __E& rE=__E(), const __A& rA=__A()); // not implemented
67};
68
69template<
70	typename __K,
71	typename __H = hash<__K>,
72	typename __E = equal_to<__K>,
73	typename __A = allocator<__K> >
74class hash_multiset
75:	public unordered_multiset<__K,__H,__E,__A>
76{
77	typedef unordered_multiset<__K,__H,__E,__A> _super;
78public:
79	hash_multiset( void) {}
80	hash_multiset( size_t n) : _super( n) {}
81
82private:
83	// setting the hasher dynamically is not supported in the emulation!
84	hash_multiset( size_t, const __H&, const __E& rE=__E(), const __A& rA=__A()); // not implemented
85};
86
87} // namespace std
88
89#endif // NO_STLPORT4_EMULATION
90
91#endif
92
93