williamr@2
|
1 |
/*
|
williamr@2
|
2 |
* Copyright (c) 1999, 2000
|
williamr@2
|
3 |
* Boris Fomitchev
|
williamr@2
|
4 |
*
|
williamr@2
|
5 |
* This material is provided "as is", with absolutely no warranty expressed
|
williamr@2
|
6 |
* or implied. Any use is at your own risk.
|
williamr@2
|
7 |
*
|
williamr@2
|
8 |
* Permission to use or copy this software for any purpose is hereby granted
|
williamr@2
|
9 |
* without fee, provided the above notices are retained on all copies.
|
williamr@2
|
10 |
* Permission to modify the code and to distribute modified code is granted,
|
williamr@2
|
11 |
* provided the above notices are retained, and a notice that the code was
|
williamr@2
|
12 |
* modified is included with the above copyright notice.
|
williamr@2
|
13 |
*
|
williamr@2
|
14 |
*/
|
williamr@2
|
15 |
|
williamr@2
|
16 |
/* NOTE: This is an internal header file, included by other STL headers.
|
williamr@2
|
17 |
* You should not attempt to use it directly.
|
williamr@2
|
18 |
*/
|
williamr@2
|
19 |
|
williamr@2
|
20 |
#ifndef _STLP_INTERNAL_WRAP_HASH_SET_H
|
williamr@2
|
21 |
#define _STLP_INTERNAL_WRAP_HASH_SET_H
|
williamr@2
|
22 |
|
williamr@2
|
23 |
#ifndef _STLP_INTERNAL_HASH_SET_H
|
williamr@2
|
24 |
# include <stl/_hash_set.h>
|
williamr@2
|
25 |
#endif
|
williamr@2
|
26 |
|
williamr@2
|
27 |
# ifdef _STLP_USE_NAMESPACES
|
williamr@2
|
28 |
namespace STLPORT {
|
williamr@2
|
29 |
# endif
|
williamr@2
|
30 |
|
williamr@2
|
31 |
# if defined (_STLP_MINIMUM_DEFAULT_TEMPLATE_PARAMS)
|
williamr@2
|
32 |
# define __HS_TEMPLATE_HEADER template <class _Value>
|
williamr@2
|
33 |
# define __HS_ARGUMENTS _Value
|
williamr@2
|
34 |
# define __HS_BASE_ARGUMENTS _Value, hash<_Value>, equal_to<_Value>, _STLP_DEFAULT_ALLOCATOR(_Value)
|
williamr@2
|
35 |
# else
|
williamr@2
|
36 |
# define __HS_TEMPLATE_HEADER template <class _Value, class _HashFcn, class _EqualKey >
|
williamr@2
|
37 |
# define __HS_ARGUMENTS _Value, _HashFcn, _EqualKey
|
williamr@2
|
38 |
# define __HS_BASE_ARGUMENTS _Value, _HashFcn, _EqualKey, _STLP_DEFAULT_ALLOCATOR(_Value)
|
williamr@2
|
39 |
# endif
|
williamr@2
|
40 |
|
williamr@2
|
41 |
|
williamr@2
|
42 |
# define __HS_SUPER __hash_set< __HS_BASE_ARGUMENTS >
|
williamr@2
|
43 |
# define __HMS_SUPER __hash_multiset< __HS_BASE_ARGUMENTS >
|
williamr@2
|
44 |
|
williamr@2
|
45 |
|
williamr@2
|
46 |
// provide a "default" hash_set adaptor
|
williamr@2
|
47 |
__HS_TEMPLATE_HEADER
|
williamr@2
|
48 |
class hash_set : public __HS_SUPER
|
williamr@2
|
49 |
{
|
williamr@2
|
50 |
typedef hash_set< __HS_ARGUMENTS > _Self;
|
williamr@2
|
51 |
public:
|
williamr@2
|
52 |
typedef __HS_SUPER _Super;
|
williamr@2
|
53 |
__IMPORT_WITH_ITERATORS(_Super)
|
williamr@2
|
54 |
typedef typename _Super::key_type key_type;
|
williamr@2
|
55 |
typedef typename _Super::hasher hasher;
|
williamr@2
|
56 |
typedef typename _Super::key_equal key_equal;
|
williamr@2
|
57 |
hash_set() {}
|
williamr@2
|
58 |
hash_set(size_type n) : __HS_SUPER(n) {}
|
williamr@2
|
59 |
hash_set(size_type n, const hasher& hf) : __HS_SUPER(n, hf) {}
|
williamr@2
|
60 |
hash_set(size_type n, const hasher& hf, const key_equal& eql): __HS_SUPER(n, hf, eql) {}
|
williamr@2
|
61 |
|
williamr@2
|
62 |
hash_set(const value_type* f, const value_type* l) : __HS_SUPER(f,l) {}
|
williamr@2
|
63 |
hash_set(const value_type* f, const value_type* l, size_type n): __HS_SUPER(f,l,n) {}
|
williamr@2
|
64 |
hash_set(const value_type* f, const value_type* l, size_type n,
|
williamr@2
|
65 |
const hasher& hf) : __HS_SUPER(f,l,n,hf) {}
|
williamr@2
|
66 |
hash_set(const value_type* f, const value_type* l, size_type n,
|
williamr@2
|
67 |
const hasher& hf, const key_equal& eql) : __HS_SUPER(f,l,n,hf, eql) {}
|
williamr@2
|
68 |
|
williamr@2
|
69 |
hash_set(const_iterator f, const_iterator l) : __HS_SUPER(f,l) { }
|
williamr@2
|
70 |
hash_set(const_iterator f, const_iterator l, size_type n) : __HS_SUPER(f,l,n) { }
|
williamr@2
|
71 |
hash_set(const_iterator f, const_iterator l, size_type n,
|
williamr@2
|
72 |
const hasher& hf) : __HS_SUPER(f, l, n, hf) { }
|
williamr@2
|
73 |
hash_set(const_iterator f, const_iterator l, size_type n,
|
williamr@2
|
74 |
const hasher& hf, const key_equal& eql) : __HS_SUPER(f, l, n, hf, eql) { }
|
williamr@2
|
75 |
# if defined (_STLP_BASE_MATCH_BUG)
|
williamr@2
|
76 |
friend inline bool operator== _STLP_NULL_TMPL_ARGS (const _Self& hs1, const _Self& hs2);
|
williamr@2
|
77 |
# endif
|
williamr@2
|
78 |
};
|
williamr@2
|
79 |
|
williamr@2
|
80 |
# if defined (_STLP_BASE_MATCH_BUG)
|
williamr@2
|
81 |
__HS_TEMPLATE_HEADER
|
williamr@2
|
82 |
inline bool operator==(const hash_set< __HS_ARGUMENTS >& hs1,
|
williamr@2
|
83 |
const hash_set< __HS_ARGUMENTS >& hs2)
|
williamr@2
|
84 |
{
|
williamr@2
|
85 |
typedef __HS_SUPER _Super;
|
williamr@2
|
86 |
return (const _Super&)hs1 == (const _Super&)hs2;
|
williamr@2
|
87 |
}
|
williamr@2
|
88 |
# endif
|
williamr@2
|
89 |
|
williamr@2
|
90 |
// provide a "default" hash_multiset adaptor
|
williamr@2
|
91 |
__HS_TEMPLATE_HEADER
|
williamr@2
|
92 |
class hash_multiset : public __HMS_SUPER
|
williamr@2
|
93 |
{
|
williamr@2
|
94 |
typedef hash_multiset< __HS_ARGUMENTS > _Self;
|
williamr@2
|
95 |
public:
|
williamr@2
|
96 |
typedef __HMS_SUPER _Super;
|
williamr@2
|
97 |
__IMPORT_WITH_ITERATORS(_Super)
|
williamr@2
|
98 |
typedef typename _Super::key_type key_type;
|
williamr@2
|
99 |
typedef typename _Super::hasher hasher;
|
williamr@2
|
100 |
typedef typename _Super::key_equal key_equal;
|
williamr@2
|
101 |
|
williamr@2
|
102 |
hash_multiset() {}
|
williamr@2
|
103 |
hash_multiset(size_type __n) : __HMS_SUPER(__n) {}
|
williamr@2
|
104 |
hash_multiset(size_type __n, const hasher& __hf) : __HMS_SUPER(__n, __hf) {}
|
williamr@2
|
105 |
hash_multiset(size_type __n, const hasher& __hf, const key_equal& __eql): __HMS_SUPER(__n, __hf, __eql) {}
|
williamr@2
|
106 |
|
williamr@2
|
107 |
hash_multiset(const value_type* __f, const value_type* __l) : __HMS_SUPER(__f,__l) {}
|
williamr@2
|
108 |
hash_multiset(const value_type* __f, const value_type* __l, size_type __n): __HMS_SUPER(__f,__l,__n) {}
|
williamr@2
|
109 |
hash_multiset(const value_type* __f, const value_type* __l, size_type __n,
|
williamr@2
|
110 |
const hasher& __hf) : __HMS_SUPER(__f,__l,__n,__hf) {}
|
williamr@2
|
111 |
hash_multiset(const value_type* __f, const value_type* __l, size_type __n,
|
williamr@2
|
112 |
const hasher& __hf, const key_equal& __eql) : __HMS_SUPER(__f,__l,__n,__hf, __eql) {}
|
williamr@2
|
113 |
|
williamr@2
|
114 |
hash_multiset(const_iterator __f, const_iterator __l) : __HMS_SUPER(__f,__l) { }
|
williamr@2
|
115 |
hash_multiset(const_iterator __f, const_iterator __l, size_type __n) : __HMS_SUPER(__f,__l,__n) { }
|
williamr@2
|
116 |
hash_multiset(const_iterator __f, const_iterator __l, size_type __n,
|
williamr@2
|
117 |
const hasher& __hf) : __HMS_SUPER(__f, __l, __n, __hf) { }
|
williamr@2
|
118 |
hash_multiset(const_iterator __f, const_iterator __l, size_type __n,
|
williamr@2
|
119 |
const hasher& __hf, const key_equal& __eql) : __HMS_SUPER(__f, __l, __n, __hf, __eql) { }
|
williamr@2
|
120 |
# if defined (_STLP_BASE_MATCH_BUG)
|
williamr@2
|
121 |
friend inline bool operator== _STLP_NULL_TMPL_ARGS (const _Self& __hs1, const _Self& __hs2);
|
williamr@2
|
122 |
# endif
|
williamr@2
|
123 |
};
|
williamr@2
|
124 |
|
williamr@2
|
125 |
# if defined (_STLP_BASE_MATCH_BUG)
|
williamr@2
|
126 |
__HS_TEMPLATE_HEADER
|
williamr@2
|
127 |
inline bool operator==(const hash_multiset< __HS_ARGUMENTS >& __hs1,
|
williamr@2
|
128 |
const hash_multiset< __HS_ARGUMENTS >& __hs2)
|
williamr@2
|
129 |
{
|
williamr@2
|
130 |
typedef __HMS_SUPER __s;
|
williamr@2
|
131 |
return _STLP_STD::operator==((const __s&)__hs1,(const __s&)__hs2);
|
williamr@2
|
132 |
}
|
williamr@2
|
133 |
# endif
|
williamr@2
|
134 |
|
williamr@2
|
135 |
|
williamr@2
|
136 |
# undef __HS_SUPER
|
williamr@2
|
137 |
# undef __HMS_SUPER
|
williamr@2
|
138 |
# undef __HS_ARGUMENTS
|
williamr@2
|
139 |
# undef __HS_BASE_ARGUMENTS
|
williamr@2
|
140 |
# undef __HS_TEMPLATE_HEADER
|
williamr@2
|
141 |
|
williamr@2
|
142 |
# ifdef _STLP_USE_NAMESPACES
|
williamr@2
|
143 |
} /* namespace STLPORT */
|
williamr@2
|
144 |
# endif
|
williamr@2
|
145 |
|
williamr@2
|
146 |
#endif /* _STLP_INTERNAL_HASH_SET_H */
|
williamr@2
|
147 |
|
williamr@2
|
148 |
// Local Variables:
|
williamr@2
|
149 |
// mode:C++
|
williamr@2
|
150 |
// End:
|