Attempt to represent the S^2->S^3 header reorganisation as a series of "hg rename" operations
4 * Hewlett-Packard Company
6 * Copyright (c) 1996,1997
7 * Silicon Graphics Computer Systems, Inc.
10 * Moscow Center for SPARC Technology
15 * This material is provided "as is", with absolutely no warranty expressed
16 * or implied. Any use is at your own risk.
18 * Permission to use or copy this software for any purpose is hereby granted
19 * without fee, provided the above notices are retained on all copies.
20 * Permission to modify the code and to distribute modified code is granted,
21 * provided the above notices are retained, and a notice that the code was
22 * modified is included with the above copyright notice.
26 /* NOTE: This is an internal header file, included by other STL headers.
27 * You should not attempt to use it directly.
30 #ifndef _STLP_INTERNAL_DBG_HASHTABLE_H
31 #define _STLP_INTERNAL_DBG_HASHTABLE_H
33 // Hashtable class, used to implement the hashed associative containers
34 // hash_set, hash_map, hash_multiset, and hash_multimap.
36 # include <stl/debug/_iterator.h>
39 # undef _DBG_hashtable
40 # define _DBG_hashtable hashtable
42 # define _STLP_DBG_HT_SUPER \
43 __WORKAROUND_DBG_RENAME(hashtable) <_Val, _Key, _HF, _ExK, _EqK, _All>
47 # ifdef _STLP_DEBUG_USE_DISTINCT_VALUE_TYPE_HELPERS
48 template <class _Val, class _Key, class _HF,
49 class _ExK, class _EqK, class _All>
51 value_type(const _DBG_iter_base< _STLP_DBG_HT_SUPER >&) {
55 template <class _Val, class _Key, class _HF,
56 class _ExK, class _EqK, class _All>
57 inline forward_iterator_tag
58 iterator_category(const _DBG_iter_base< _STLP_DBG_HT_SUPER >&) {
59 return forward_iterator_tag();
63 template <class _Val, class _Key, class _HF,
64 class _ExK, class _EqK, class _All>
65 class _DBG_hashtable : public _STLP_DBG_HT_SUPER {
66 typedef _DBG_hashtable<_Val, _Key, _HF, _ExK, _EqK, _All> _Self;
67 typedef _STLP_DBG_HT_SUPER _Base;
70 typedef _Key key_type;
72 typedef _EqK key_equal;
74 __IMPORT_CONTAINER_TYPEDEFS(_Base)
77 typedef _DBG_iter<_Base, _Nonconst_traits<value_type> > iterator;
78 typedef _DBG_iter<_Base, _Const_traits<value_type> > const_iterator;
79 typedef typename _Base::iterator _Base_iterator;
80 typedef typename _Base::const_iterator _Base_const_iterator;
83 void _Invalidate_all() {_M_iter_list._Invalidate_all();}
85 void _Invalidate_iterator(const const_iterator& __it) {
86 __invalidate_iterator(&_M_iter_list,__it);
88 void _Invalidate_iterators(const const_iterator& __first, const const_iterator& __last) {
89 const_iterator __cur = __first;
90 while (__cur != __last) __invalidate_iterator(&_M_iter_list, __cur++);
93 const _Base* _Get_base() const { return (const _Base*)this; }
94 _Base* _Get_base() { return (_Base*)this; }
97 _DBG_hashtable(size_type __n,
101 const allocator_type& __a = allocator_type()):
102 _STLP_DBG_HT_SUPER(__n, __hf, __eql, __ext, __a),
103 _M_iter_list(_Get_base()) {}
105 _DBG_hashtable(size_type __n,
108 const allocator_type& __a = allocator_type()):
110 _STLP_DBG_HT_SUPER(__n, __hf, __eql, __a),
111 _M_iter_list(_Get_base()) {}
113 _DBG_hashtable(const _Self& __ht):
114 _STLP_DBG_HT_SUPER(__ht),
115 _M_iter_list(_Get_base()) {}
117 _Self& operator= (const _Self& __ht) {
119 _Base::operator=(__ht);
123 void swap(_Self& __ht)
125 _M_iter_list._Swap_owners(__ht._M_iter_list);
129 iterator begin() { return iterator(&_M_iter_list, _Base::begin()); }
130 iterator end() { return iterator(&_M_iter_list, _Base::end()); }
132 const_iterator begin() const { return const_iterator(&_M_iter_list, _Base::begin()); }
133 const_iterator end() const { return const_iterator(&_M_iter_list, _Base::end()); }
135 pair<iterator, bool> insert_unique(const value_type& __obj)
137 pair < _Base_iterator, bool> __res =
138 _Base::insert_unique(__obj);
139 return pair<iterator, bool> ( iterator(&_M_iter_list, __res.first), __res.second);
142 iterator insert_equal(const value_type& __obj) {
143 return iterator(&_M_iter_list, _Base::insert_equal(__obj));
146 pair<iterator, bool> insert_unique_noresize(const value_type& __obj) {
147 pair < _Base_iterator, bool> __res =
148 _Base::insert_unique_noresize(__obj);
149 return pair<iterator, bool> ( iterator(&_M_iter_list, __res.first), __res.second);
152 iterator insert_equal_noresize(const value_type& __obj) {
153 return iterator(&_M_iter_list, _Base::insert_equal_noresize(__obj));
156 #ifdef _STLP_MEMBER_TEMPLATES
157 template <class _InputIterator>
158 void insert_unique(_InputIterator __f, _InputIterator __l) {
159 _Base::insert_unique(__f, __l);
162 template <class _InputIterator>
163 void insert_equal(_InputIterator __f, _InputIterator __l){
164 _Base::insert_equal(__f, __l);
167 #else /* _STLP_MEMBER_TEMPLATES */
169 void insert_unique(const value_type* __f, const value_type* __l) {
170 _Base::insert_unique(__f, __l);
173 void insert_equal(const value_type* __f, const value_type* __l) {
174 _Base::insert_equal(__f, __l);
177 void insert_unique(const_iterator __f, const_iterator __l) {
178 _Base::insert_unique(__f._M_iterator, __l._M_iterator);
181 void insert_equal(const_iterator __f, const_iterator __l) {
182 _Base::insert_equal(__f._M_iterator, __l._M_iterator);
184 #endif /*_STLP_MEMBER_TEMPLATES */
186 iterator find(const key_type& __key) {
187 return iterator(&_M_iter_list, _Base::find(__key));
190 const_iterator find(const key_type& __key) const {
191 return const_iterator(&_M_iter_list, _Base::find(__key));
194 pair<iterator, iterator>
195 equal_range(const key_type& __key) {
196 pair < _Base_iterator, _Base_iterator > __res =
197 _Base::equal_range(__key);
198 return pair<iterator,iterator> (iterator(&_M_iter_list,__res.first),
199 iterator(&_M_iter_list,__res.second));
202 pair<const_iterator, const_iterator>
203 equal_range(const key_type& __key) const {
204 pair < _Base_const_iterator, _Base_const_iterator > __res =
205 _Base::equal_range(__key);
206 return pair<const_iterator,const_iterator> (const_iterator(&_M_iter_list,__res.first),
207 const_iterator(&_M_iter_list,__res.second));
210 size_type erase(const key_type& __key) {
211 pair<const_iterator, const_iterator> __p = equal_range(__key);
212 size_type __n = distance(__p.first, __p.second);
213 _Invalidate_iterators(__p.first, __p.second);
214 _Base::erase(__p.first._M_iterator, __p.second._M_iterator);
218 void erase(const const_iterator& __it) {
219 _STLP_DEBUG_CHECK(__check_if_owner(&_M_iter_list, __it))
220 _STLP_DEBUG_CHECK(_Dereferenceable(__it))
221 _Invalidate_iterator(__it);
222 _Base::erase(__it._M_iterator);
224 void erase(const_iterator __first, const_iterator __last) {
225 _STLP_DEBUG_CHECK(__check_if_owner(&_M_iter_list, __first)&&
226 __check_if_owner(&_M_iter_list, __last))
227 _Invalidate_iterators(__first, __last);
228 _Base::erase(__first._M_iterator, __last._M_iterator);
230 void resize(size_type __num_elements_hint) {
231 _Base::resize(__num_elements_hint);
240 __owned_list _M_iter_list;
244 #define _STLP_TEMPLATE_HEADER template <class _Val, class _Key, class _HF, class _ExK, class _EqK, class _All>
245 #define _STLP_TEMPLATE_CONTAINER _DBG_hashtable<_Val,_Key,_HF,_ExK,_EqK,_All>
246 #define _STLP_TEMPLATE_CONTAINER_BASE hashtable<_Val,_Key,_HF,_ExK,_EqK,_All>
247 #include <stl/debug/_relops_hash_cont.h>
248 #undef _STLP_TEMPLATE_CONTAINER_BASE
249 #undef _STLP_TEMPLATE_CONTAINER
250 #undef _STLP_TEMPLATE_HEADER
255 #endif /* _STLP_INTERNAL_HASHTABLE_H */