2 * Copyright (c) 1999, 2000
5 * This material is provided "as is", with absolutely no warranty expressed
6 * or implied. Any use is at your own risk.
8 * Permission to use or copy this software for any purpose is hereby granted
9 * without fee, provided the above notices are retained on all copies.
10 * Permission to modify the code and to distribute modified code is granted,
11 * provided the above notices are retained, and a notice that the code was
12 * modified is included with the above copyright notice.
16 /* NOTE: This is an internal header file, included by other STL headers.
17 * You should not attempt to use it directly.
20 #ifndef _STLP_INTERNAL_WRAP_HASH_SET_H
21 #define _STLP_INTERNAL_WRAP_HASH_SET_H
23 #ifndef _STLP_INTERNAL_HASH_SET_H
24 # include <stl/_hash_set.h>
27 # ifdef _STLP_USE_NAMESPACES
31 # if defined (_STLP_MINIMUM_DEFAULT_TEMPLATE_PARAMS)
32 # define __HS_TEMPLATE_HEADER template <class _Value>
33 # define __HS_ARGUMENTS _Value
34 # define __HS_BASE_ARGUMENTS _Value, hash<_Value>, equal_to<_Value>, _STLP_DEFAULT_ALLOCATOR(_Value)
36 # define __HS_TEMPLATE_HEADER template <class _Value, class _HashFcn, class _EqualKey >
37 # define __HS_ARGUMENTS _Value, _HashFcn, _EqualKey
38 # define __HS_BASE_ARGUMENTS _Value, _HashFcn, _EqualKey, _STLP_DEFAULT_ALLOCATOR(_Value)
42 # define __HS_SUPER __hash_set< __HS_BASE_ARGUMENTS >
43 # define __HMS_SUPER __hash_multiset< __HS_BASE_ARGUMENTS >
46 // provide a "default" hash_set adaptor
48 class hash_set : public __HS_SUPER
50 typedef hash_set< __HS_ARGUMENTS > _Self;
52 typedef __HS_SUPER _Super;
53 __IMPORT_WITH_ITERATORS(_Super)
54 typedef typename _Super::key_type key_type;
55 typedef typename _Super::hasher hasher;
56 typedef typename _Super::key_equal key_equal;
58 hash_set(size_type n) : __HS_SUPER(n) {}
59 hash_set(size_type n, const hasher& hf) : __HS_SUPER(n, hf) {}
60 hash_set(size_type n, const hasher& hf, const key_equal& eql): __HS_SUPER(n, hf, eql) {}
62 hash_set(const value_type* f, const value_type* l) : __HS_SUPER(f,l) {}
63 hash_set(const value_type* f, const value_type* l, size_type n): __HS_SUPER(f,l,n) {}
64 hash_set(const value_type* f, const value_type* l, size_type n,
65 const hasher& hf) : __HS_SUPER(f,l,n,hf) {}
66 hash_set(const value_type* f, const value_type* l, size_type n,
67 const hasher& hf, const key_equal& eql) : __HS_SUPER(f,l,n,hf, eql) {}
69 hash_set(const_iterator f, const_iterator l) : __HS_SUPER(f,l) { }
70 hash_set(const_iterator f, const_iterator l, size_type n) : __HS_SUPER(f,l,n) { }
71 hash_set(const_iterator f, const_iterator l, size_type n,
72 const hasher& hf) : __HS_SUPER(f, l, n, hf) { }
73 hash_set(const_iterator f, const_iterator l, size_type n,
74 const hasher& hf, const key_equal& eql) : __HS_SUPER(f, l, n, hf, eql) { }
75 # if defined (_STLP_BASE_MATCH_BUG)
76 friend inline bool operator== _STLP_NULL_TMPL_ARGS (const _Self& hs1, const _Self& hs2);
80 # if defined (_STLP_BASE_MATCH_BUG)
82 inline bool operator==(const hash_set< __HS_ARGUMENTS >& hs1,
83 const hash_set< __HS_ARGUMENTS >& hs2)
85 typedef __HS_SUPER _Super;
86 return (const _Super&)hs1 == (const _Super&)hs2;
90 // provide a "default" hash_multiset adaptor
92 class hash_multiset : public __HMS_SUPER
94 typedef hash_multiset< __HS_ARGUMENTS > _Self;
96 typedef __HMS_SUPER _Super;
97 __IMPORT_WITH_ITERATORS(_Super)
98 typedef typename _Super::key_type key_type;
99 typedef typename _Super::hasher hasher;
100 typedef typename _Super::key_equal key_equal;
103 hash_multiset(size_type __n) : __HMS_SUPER(__n) {}
104 hash_multiset(size_type __n, const hasher& __hf) : __HMS_SUPER(__n, __hf) {}
105 hash_multiset(size_type __n, const hasher& __hf, const key_equal& __eql): __HMS_SUPER(__n, __hf, __eql) {}
107 hash_multiset(const value_type* __f, const value_type* __l) : __HMS_SUPER(__f,__l) {}
108 hash_multiset(const value_type* __f, const value_type* __l, size_type __n): __HMS_SUPER(__f,__l,__n) {}
109 hash_multiset(const value_type* __f, const value_type* __l, size_type __n,
110 const hasher& __hf) : __HMS_SUPER(__f,__l,__n,__hf) {}
111 hash_multiset(const value_type* __f, const value_type* __l, size_type __n,
112 const hasher& __hf, const key_equal& __eql) : __HMS_SUPER(__f,__l,__n,__hf, __eql) {}
114 hash_multiset(const_iterator __f, const_iterator __l) : __HMS_SUPER(__f,__l) { }
115 hash_multiset(const_iterator __f, const_iterator __l, size_type __n) : __HMS_SUPER(__f,__l,__n) { }
116 hash_multiset(const_iterator __f, const_iterator __l, size_type __n,
117 const hasher& __hf) : __HMS_SUPER(__f, __l, __n, __hf) { }
118 hash_multiset(const_iterator __f, const_iterator __l, size_type __n,
119 const hasher& __hf, const key_equal& __eql) : __HMS_SUPER(__f, __l, __n, __hf, __eql) { }
120 # if defined (_STLP_BASE_MATCH_BUG)
121 friend inline bool operator== _STLP_NULL_TMPL_ARGS (const _Self& __hs1, const _Self& __hs2);
125 # if defined (_STLP_BASE_MATCH_BUG)
127 inline bool operator==(const hash_multiset< __HS_ARGUMENTS >& __hs1,
128 const hash_multiset< __HS_ARGUMENTS >& __hs2)
130 typedef __HMS_SUPER __s;
131 return _STLP_STD::operator==((const __s&)__hs1,(const __s&)__hs2);
138 # undef __HS_ARGUMENTS
139 # undef __HS_BASE_ARGUMENTS
140 # undef __HS_TEMPLATE_HEADER
142 # ifdef _STLP_USE_NAMESPACES
143 } /* namespace STLPORT */
146 #endif /* _STLP_INTERNAL_HASH_SET_H */