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_MAP_H
|
williamr@2
|
21 |
#define _STLP_INTERNAL_WRAP_HASH_MAP_H
|
williamr@2
|
22 |
|
williamr@2
|
23 |
#ifndef _STLP_INTERNAL_HASH_MAP_H
|
williamr@2
|
24 |
# include <stl/_hash_map.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 |
// provide a "default" hash_map adaptor
|
williamr@2
|
32 |
# if defined (_STLP_MINIMUM_DEFAULT_TEMPLATE_PARAMS)
|
williamr@2
|
33 |
# define __HM_TEMPLATE_HEADER template <class _Key, class _Tp>
|
williamr@2
|
34 |
# define __HM_ARGUMENTS _Key, _Tp
|
williamr@2
|
35 |
# define __HM_BASE_ARGUMENTS _Key, _Tp, hash<_Key>, equal_to<_Key>, _STLP_DEFAULT_PAIR_ALLOCATOR(const _Key, _Tp)
|
williamr@2
|
36 |
# else
|
williamr@2
|
37 |
# define __HM_TEMPLATE_HEADER template <class _Key, class _Tp, class _HashFcn, class _EqualKey >
|
williamr@2
|
38 |
# define __HM_ARGUMENTS _Key, _Tp, _HashFcn, _EqualKey
|
williamr@2
|
39 |
# define __HM_BASE_ARGUMENTS _Key, _Tp, _HashFcn, _EqualKey, _STLP_DEFAULT_PAIR_ALLOCATOR(const _Key, _Tp)
|
williamr@2
|
40 |
# endif
|
williamr@2
|
41 |
|
williamr@2
|
42 |
|
williamr@2
|
43 |
# define __HM_SUPER __hash_map< __HM_BASE_ARGUMENTS >
|
williamr@2
|
44 |
# define __HMM_SUPER __hash_multimap< __HM_BASE_ARGUMENTS >
|
williamr@2
|
45 |
|
williamr@2
|
46 |
__HM_TEMPLATE_HEADER
|
williamr@2
|
47 |
class hash_map : public __HM_SUPER
|
williamr@2
|
48 |
{
|
williamr@2
|
49 |
typedef hash_map< __HM_ARGUMENTS > _Self;
|
williamr@2
|
50 |
public:
|
williamr@2
|
51 |
typedef __HM_SUPER _Super;
|
williamr@2
|
52 |
__IMPORT_WITH_ITERATORS(_Super)
|
williamr@2
|
53 |
typedef typename _Super::key_type key_type;
|
williamr@2
|
54 |
typedef typename _Super::hasher hasher;
|
williamr@2
|
55 |
typedef typename _Super::key_equal key_equal;
|
williamr@2
|
56 |
typedef _Tp data_type;
|
williamr@2
|
57 |
hash_map() {}
|
williamr@2
|
58 |
hash_map(size_type __n) : __HM_SUPER(__n) {}
|
williamr@2
|
59 |
hash_map(size_type __n, const hasher& __hf) : __HM_SUPER(__n, __hf) {}
|
williamr@2
|
60 |
hash_map(size_type __n, const hasher& __hf, const key_equal& __eql): __HM_SUPER(__n, __hf, __eql) {}
|
williamr@2
|
61 |
hash_map(const value_type* __f, const value_type* __l) : __HM_SUPER(__f,__l) {}
|
williamr@2
|
62 |
hash_map(const value_type* __f, const value_type* __l, size_type __n): __HM_SUPER(__f,__l,__n) {}
|
williamr@2
|
63 |
hash_map(const value_type* __f, const value_type* __l, size_type __n,
|
williamr@2
|
64 |
const hasher& __hf) : __HM_SUPER(__f,__l,__n,__hf) {}
|
williamr@2
|
65 |
hash_map(const value_type* __f, const value_type* __l, size_type __n,
|
williamr@2
|
66 |
const hasher& __hf, const key_equal& __eql) : __HM_SUPER(__f,__l,__n,__hf, __eql) {}
|
williamr@2
|
67 |
hash_map(const_iterator __f, const_iterator __l) : __HM_SUPER(__f,__l) { }
|
williamr@2
|
68 |
hash_map(const_iterator __f, const_iterator __l, size_type __n) : __HM_SUPER(__f,__l,__n) { }
|
williamr@2
|
69 |
hash_map(const_iterator __f, const_iterator __l, size_type __n,
|
williamr@2
|
70 |
const hasher& __hf) : __HM_SUPER(__f, __l, __n, __hf) { }
|
williamr@2
|
71 |
hash_map(const_iterator __f, const_iterator __l, size_type __n,
|
williamr@2
|
72 |
const hasher& __hf, const key_equal& __eql) : __HM_SUPER(__f, __l, __n, __hf, __eql) { }
|
williamr@2
|
73 |
# if defined (_STLP_BASE_MATCH_BUG)
|
williamr@2
|
74 |
friend inline bool operator== _STLP_NULL_TMPL_ARGS (const _Self& __hm1, const _Self& __hm2);
|
williamr@2
|
75 |
# endif
|
williamr@2
|
76 |
};
|
williamr@2
|
77 |
|
williamr@2
|
78 |
|
williamr@2
|
79 |
# if defined (_STLP_BASE_MATCH_BUG)
|
williamr@2
|
80 |
__HM_TEMPLATE_HEADER
|
williamr@2
|
81 |
inline bool operator==(const hash_map< __HM_ARGUMENTS >& __hm1,
|
williamr@2
|
82 |
const hash_map< __HM_ARGUMENTS >& __hm2)
|
williamr@2
|
83 |
{
|
williamr@2
|
84 |
typedef __HM_SUPER _Super;
|
williamr@2
|
85 |
return (const _Super&)__hm1 == (const _Super&)__hm2;
|
williamr@2
|
86 |
}
|
williamr@2
|
87 |
# endif
|
williamr@2
|
88 |
|
williamr@2
|
89 |
// provide a "default" hash_multimap adaptor
|
williamr@2
|
90 |
__HM_TEMPLATE_HEADER
|
williamr@2
|
91 |
class hash_multimap : public __HMM_SUPER
|
williamr@2
|
92 |
{
|
williamr@2
|
93 |
typedef hash_multimap< __HM_ARGUMENTS > _Self;
|
williamr@2
|
94 |
public:
|
williamr@2
|
95 |
typedef __HMM_SUPER _Super;
|
williamr@2
|
96 |
__IMPORT_WITH_ITERATORS(_Super)
|
williamr@2
|
97 |
typedef typename _Super::key_type key_type;
|
williamr@2
|
98 |
typedef typename _Super::hasher hasher;
|
williamr@2
|
99 |
typedef typename _Super::key_equal key_equal;
|
williamr@2
|
100 |
typedef _Tp data_type;
|
williamr@2
|
101 |
hash_multimap() {}
|
williamr@2
|
102 |
hash_multimap(size_type __n) : __HMM_SUPER(__n) {}
|
williamr@2
|
103 |
hash_multimap(size_type __n, const hasher& __hf) : __HMM_SUPER(__n, __hf) {}
|
williamr@2
|
104 |
hash_multimap(size_type __n, const hasher& __hf, const key_equal& __eql): __HMM_SUPER(__n, __hf, __eql) {}
|
williamr@2
|
105 |
hash_multimap(const value_type* __f, const value_type* __l) : __HMM_SUPER(__f,__l) {}
|
williamr@2
|
106 |
hash_multimap(const value_type* __f, const value_type* __l, size_type __n): __HMM_SUPER(__f,__l,__n) {}
|
williamr@2
|
107 |
hash_multimap(const value_type* __f, const value_type* __l, size_type __n,
|
williamr@2
|
108 |
const hasher& __hf) : __HMM_SUPER(__f,__l,__n,__hf) {}
|
williamr@2
|
109 |
hash_multimap(const value_type* __f, const value_type* __l, size_type __n,
|
williamr@2
|
110 |
const hasher& __hf, const key_equal& __eql) : __HMM_SUPER(__f,__l,__n,__hf, __eql) {}
|
williamr@2
|
111 |
|
williamr@2
|
112 |
hash_multimap(const_iterator __f, const_iterator __l) : __HMM_SUPER(__f,__l) { }
|
williamr@2
|
113 |
hash_multimap(const_iterator __f, const_iterator __l, size_type __n) : __HMM_SUPER(__f,__l,__n) { }
|
williamr@2
|
114 |
hash_multimap(const_iterator __f, const_iterator __l, size_type __n,
|
williamr@2
|
115 |
const hasher& __hf) : __HMM_SUPER(__f, __l, __n, __hf) { }
|
williamr@2
|
116 |
hash_multimap(const_iterator __f, const_iterator __l, size_type __n,
|
williamr@2
|
117 |
const hasher& __hf, const key_equal& __eql) : __HMM_SUPER(__f, __l, __n, __hf, __eql) { }
|
williamr@2
|
118 |
# if defined (_STLP_BASE_MATCH_BUG)
|
williamr@2
|
119 |
friend inline bool operator== _STLP_NULL_TMPL_ARGS (const _Self& __hm1, const _Self& __hm2);
|
williamr@2
|
120 |
# endif
|
williamr@2
|
121 |
};
|
williamr@2
|
122 |
|
williamr@2
|
123 |
# if defined (_STLP_BASE_MATCH_BUG)
|
williamr@2
|
124 |
__HM_TEMPLATE_HEADER
|
williamr@2
|
125 |
inline bool operator==(const hash_multimap< __HM_ARGUMENTS >& __hm1,
|
williamr@2
|
126 |
const hash_multimap< __HM_ARGUMENTS >& __hm2)
|
williamr@2
|
127 |
{
|
williamr@2
|
128 |
typedef __HMM_SUPER _Super;
|
williamr@2
|
129 |
return (const _Super&)__hm1 == (const _Super&)__hm2;
|
williamr@2
|
130 |
}
|
williamr@2
|
131 |
# endif
|
williamr@2
|
132 |
|
williamr@2
|
133 |
# undef __HM_SUPER
|
williamr@2
|
134 |
# undef __HMM_SUPER
|
williamr@2
|
135 |
# undef __HM_TEMPLATE_HEADER
|
williamr@2
|
136 |
# undef __HM_ARGUMENTS
|
williamr@2
|
137 |
# undef __HM_BASE_ARGUMENTS
|
williamr@2
|
138 |
|
williamr@2
|
139 |
# ifdef _STLP_USE_NAMESPACES
|
williamr@2
|
140 |
} /* namespace STLPORT */
|
williamr@2
|
141 |
# endif
|
williamr@2
|
142 |
|
williamr@2
|
143 |
#endif /* _STLP_INTERNAL_HASH_SET_H */
|
williamr@2
|
144 |
|
williamr@2
|
145 |
// Local Variables:
|
williamr@2
|
146 |
// mode:C++
|
williamr@2
|
147 |
// End:
|