Chris@102
|
1 /*
|
Chris@102
|
2 template <class Value, unsigned int Options = 0, class Hash = hash<Value>, class Pred = equal_to<Value>,
|
Chris@102
|
3 class Allocator = allocator<Value> >
|
Chris@102
|
4 class hash_set
|
Chris@102
|
5 {
|
Chris@102
|
6 public:
|
Chris@102
|
7 // types
|
Chris@102
|
8 typedef Value key_type;
|
Chris@102
|
9 typedef key_type value_type;
|
Chris@102
|
10 typedef Hash hasher;
|
Chris@102
|
11 typedef Pred key_equal;
|
Chris@102
|
12 typedef Allocator allocator_type;
|
Chris@102
|
13 typedef value_type& reference;
|
Chris@102
|
14 typedef const value_type& const_reference;
|
Chris@102
|
15 typedef typename allocator_traits<allocator_type>::pointer pointer;
|
Chris@102
|
16 typedef typename allocator_traits<allocator_type>::const_pointer const_pointer;
|
Chris@102
|
17 typedef typename allocator_traits<allocator_type>::size_type size_type;
|
Chris@102
|
18 typedef typename allocator_traits<allocator_type>::difference_type difference_type;
|
Chris@102
|
19
|
Chris@102
|
20 typedef /unspecified/ iterator;
|
Chris@102
|
21 typedef /unspecified/ const_iterator;
|
Chris@102
|
22 typedef /unspecified/ local_iterator;
|
Chris@102
|
23 typedef /unspecified/ const_local_iterator;
|
Chris@102
|
24
|
Chris@102
|
25 hash_set()
|
Chris@102
|
26 noexcept(
|
Chris@102
|
27 is_nothrow_default_constructible<hasher>::value &&
|
Chris@102
|
28 is_nothrow_default_constructible<key_equal>::value &&
|
Chris@102
|
29 is_nothrow_default_constructible<allocator_type>::value);
|
Chris@102
|
30 explicit hash_set(size_type n, const hasher& hf = hasher(),
|
Chris@102
|
31 const key_equal& eql = key_equal(),
|
Chris@102
|
32 const allocator_type& a = allocator_type());
|
Chris@102
|
33 template <class InputIterator>
|
Chris@102
|
34 hash_set(InputIterator f, InputIterator l,
|
Chris@102
|
35 size_type n = 0, const hasher& hf = hasher(),
|
Chris@102
|
36 const key_equal& eql = key_equal(),
|
Chris@102
|
37 const allocator_type& a = allocator_type());
|
Chris@102
|
38 explicit hash_set(const allocator_type&);
|
Chris@102
|
39 hash_set(const hash_set&);
|
Chris@102
|
40 hash_set(const hash_set&, const Allocator&);
|
Chris@102
|
41 hash_set(hash_set&&)
|
Chris@102
|
42 noexcept(
|
Chris@102
|
43 is_nothrow_move_constructible<hasher>::value &&
|
Chris@102
|
44 is_nothrow_move_constructible<key_equal>::value &&
|
Chris@102
|
45 is_nothrow_move_constructible<allocator_type>::value);
|
Chris@102
|
46 hash_set(hash_set&&, const Allocator&);
|
Chris@102
|
47 hash_set(initializer_list<value_type>, size_type n = 0,
|
Chris@102
|
48 const hasher& hf = hasher(), const key_equal& eql = key_equal(),
|
Chris@102
|
49 const allocator_type& a = allocator_type());
|
Chris@102
|
50 ~hash_set();
|
Chris@102
|
51 hash_set& operator=(const hash_set&);
|
Chris@102
|
52 hash_set& operator=(hash_set&&)
|
Chris@102
|
53 noexcept(
|
Chris@102
|
54 allocator_type::propagate_on_container_move_assignment::value &&
|
Chris@102
|
55 is_nothrow_move_assignable<allocator_type>::value &&
|
Chris@102
|
56 is_nothrow_move_assignable<hasher>::value &&
|
Chris@102
|
57 is_nothrow_move_assignable<key_equal>::value);
|
Chris@102
|
58 hash_set& operator=(initializer_list<value_type>);
|
Chris@102
|
59
|
Chris@102
|
60 allocator_type get_allocator() const noexcept;
|
Chris@102
|
61
|
Chris@102
|
62 bool empty() const noexcept;
|
Chris@102
|
63 size_type size() const noexcept;
|
Chris@102
|
64 size_type max_size() const noexcept;
|
Chris@102
|
65
|
Chris@102
|
66 iterator begin() noexcept;
|
Chris@102
|
67 iterator end() noexcept;
|
Chris@102
|
68 const_iterator begin() const noexcept;
|
Chris@102
|
69 const_iterator end() const noexcept;
|
Chris@102
|
70 const_iterator cbegin() const noexcept;
|
Chris@102
|
71 const_iterator cend() const noexcept;
|
Chris@102
|
72
|
Chris@102
|
73 template <class... Args>
|
Chris@102
|
74 pair<iterator, bool> emplace(BOOST_FWD_REF(Args)... args);
|
Chris@102
|
75 template <class... Args>
|
Chris@102
|
76 iterator emplace_hint(const_iterator position, BOOST_FWD_REF(Args)... args);
|
Chris@102
|
77 pair<iterator, bool> insert(const value_type& obj);
|
Chris@102
|
78 pair<iterator, bool> insert(value_type&& obj);
|
Chris@102
|
79 iterator insert(const_iterator hint, const value_type& obj);
|
Chris@102
|
80 iterator insert(const_iterator hint, value_type&& obj);
|
Chris@102
|
81 template <class InputIterator>
|
Chris@102
|
82 void insert(InputIterator first, InputIterator last);
|
Chris@102
|
83 void insert(initializer_list<value_type>);
|
Chris@102
|
84
|
Chris@102
|
85 iterator erase(const_iterator position);
|
Chris@102
|
86 size_type erase(const key_type& k);
|
Chris@102
|
87 iterator erase(const_iterator first, const_iterator last);
|
Chris@102
|
88 void clear() noexcept;
|
Chris@102
|
89
|
Chris@102
|
90 void swap(hash_set&)
|
Chris@102
|
91 noexcept(
|
Chris@102
|
92 (!allocator_type::propagate_on_container_swap::value ||
|
Chris@102
|
93 __is_nothrow_swappable<allocator_type>::value) &&
|
Chris@102
|
94 __is_nothrow_swappable<hasher>::value &&
|
Chris@102
|
95 __is_nothrow_swappable<key_equal>::value);
|
Chris@102
|
96
|
Chris@102
|
97 hasher hash_function() const;
|
Chris@102
|
98 key_equal key_eq() const;
|
Chris@102
|
99
|
Chris@102
|
100 iterator find(const key_type& k);
|
Chris@102
|
101 const_iterator find(const key_type& k) const;
|
Chris@102
|
102 size_type count(const key_type& k) const;
|
Chris@102
|
103 pair<iterator, iterator> equal_range(const key_type& k);
|
Chris@102
|
104 pair<const_iterator, const_iterator> equal_range(const key_type& k) const;
|
Chris@102
|
105
|
Chris@102
|
106 size_type bucket_count() const noexcept;
|
Chris@102
|
107 size_type max_bucket_count() const noexcept;
|
Chris@102
|
108
|
Chris@102
|
109 size_type bucket_size(size_type n) const;
|
Chris@102
|
110 size_type bucket(const key_type& k) const;
|
Chris@102
|
111
|
Chris@102
|
112 local_iterator begin(size_type n);
|
Chris@102
|
113 local_iterator end(size_type n);
|
Chris@102
|
114 const_local_iterator begin(size_type n) const;
|
Chris@102
|
115 const_local_iterator end(size_type n) const;
|
Chris@102
|
116 const_local_iterator cbegin(size_type n) const;
|
Chris@102
|
117 const_local_iterator cend(size_type n) const;
|
Chris@102
|
118
|
Chris@102
|
119 float load_factor() const noexcept;
|
Chris@102
|
120 float max_load_factor() const noexcept;
|
Chris@102
|
121 void max_load_factor(float z);
|
Chris@102
|
122 void rehash(size_type n);
|
Chris@102
|
123 void reserve(size_type n);
|
Chris@102
|
124 };
|
Chris@102
|
125
|
Chris@102
|
126 template <class Key, class T, unsigned int Options = 0, class Hash = hash<Key>, class Pred = equal_to<Key>,
|
Chris@102
|
127 class Allocator = allocator<pair<const Key, T> > >
|
Chris@102
|
128 class hash_map
|
Chris@102
|
129 {
|
Chris@102
|
130 public:
|
Chris@102
|
131 // types
|
Chris@102
|
132 typedef Key key_type;
|
Chris@102
|
133 typedef T mapped_type;
|
Chris@102
|
134 typedef Hash hasher;
|
Chris@102
|
135 typedef Pred key_equal;
|
Chris@102
|
136 typedef Allocator allocator_type;
|
Chris@102
|
137 typedef pair<const key_type, mapped_type> value_type;
|
Chris@102
|
138 typedef value_type& reference;
|
Chris@102
|
139 typedef const value_type& const_reference;
|
Chris@102
|
140 typedef typename allocator_traits<allocator_type>::pointer pointer;
|
Chris@102
|
141 typedef typename allocator_traits<allocator_type>::const_pointer const_pointer;
|
Chris@102
|
142 typedef typename allocator_traits<allocator_type>::size_type size_type;
|
Chris@102
|
143 typedef typename allocator_traits<allocator_type>::difference_type difference_type;
|
Chris@102
|
144
|
Chris@102
|
145 typedef /unspecified/ iterator;
|
Chris@102
|
146 typedef /unspecified/ const_iterator;
|
Chris@102
|
147 typedef /unspecified/ local_iterator;
|
Chris@102
|
148 typedef /unspecified/ const_local_iterator;
|
Chris@102
|
149
|
Chris@102
|
150 hash_map()
|
Chris@102
|
151 noexcept(
|
Chris@102
|
152 is_nothrow_default_constructible<hasher>::value &&
|
Chris@102
|
153 is_nothrow_default_constructible<key_equal>::value &&
|
Chris@102
|
154 is_nothrow_default_constructible<allocator_type>::value);
|
Chris@102
|
155 explicit hash_map(size_type n, const hasher& hf = hasher(),
|
Chris@102
|
156 const key_equal& eql = key_equal(),
|
Chris@102
|
157 const allocator_type& a = allocator_type());
|
Chris@102
|
158 template <class InputIterator>
|
Chris@102
|
159 hash_map(InputIterator f, InputIterator l,
|
Chris@102
|
160 size_type n = 0, const hasher& hf = hasher(),
|
Chris@102
|
161 const key_equal& eql = key_equal(),
|
Chris@102
|
162 const allocator_type& a = allocator_type());
|
Chris@102
|
163 explicit hash_map(const allocator_type&);
|
Chris@102
|
164 hash_map(const hash_map&);
|
Chris@102
|
165 hash_map(const hash_map&, const Allocator&);
|
Chris@102
|
166 hash_map(hash_map&&)
|
Chris@102
|
167 noexcept(
|
Chris@102
|
168 is_nothrow_move_constructible<hasher>::value &&
|
Chris@102
|
169 is_nothrow_move_constructible<key_equal>::value &&
|
Chris@102
|
170 is_nothrow_move_constructible<allocator_type>::value);
|
Chris@102
|
171 hash_map(hash_map&&, const Allocator&);
|
Chris@102
|
172 hash_map(initializer_list<value_type>, size_type n = 0,
|
Chris@102
|
173 const hasher& hf = hasher(), const key_equal& eql = key_equal(),
|
Chris@102
|
174 const allocator_type& a = allocator_type());
|
Chris@102
|
175 ~hash_map();
|
Chris@102
|
176 hash_map& operator=(const hash_map&);
|
Chris@102
|
177 hash_map& operator=(hash_map&&)
|
Chris@102
|
178 noexcept(
|
Chris@102
|
179 allocator_type::propagate_on_container_move_assignment::value &&
|
Chris@102
|
180 is_nothrow_move_assignable<allocator_type>::value &&
|
Chris@102
|
181 is_nothrow_move_assignable<hasher>::value &&
|
Chris@102
|
182 is_nothrow_move_assignable<key_equal>::value);
|
Chris@102
|
183 hash_map& operator=(initializer_list<value_type>);
|
Chris@102
|
184
|
Chris@102
|
185 allocator_type get_allocator() const noexcept;
|
Chris@102
|
186
|
Chris@102
|
187 bool empty() const noexcept;
|
Chris@102
|
188 size_type size() const noexcept;
|
Chris@102
|
189 size_type max_size() const noexcept;
|
Chris@102
|
190
|
Chris@102
|
191 iterator begin() noexcept;
|
Chris@102
|
192 iterator end() noexcept;
|
Chris@102
|
193 const_iterator begin() const noexcept;
|
Chris@102
|
194 const_iterator end() const noexcept;
|
Chris@102
|
195 const_iterator cbegin() const noexcept;
|
Chris@102
|
196 const_iterator cend() const noexcept;
|
Chris@102
|
197
|
Chris@102
|
198 template <class... Args>
|
Chris@102
|
199 pair<iterator, bool> emplace(BOOST_FWD_REF(Args)... args);
|
Chris@102
|
200 template <class... Args>
|
Chris@102
|
201 iterator emplace_hint(const_iterator position, BOOST_FWD_REF(Args)... args);
|
Chris@102
|
202 pair<iterator, bool> insert(const value_type& obj);
|
Chris@102
|
203 template <class P>
|
Chris@102
|
204 pair<iterator, bool> insert(P&& obj);
|
Chris@102
|
205 iterator insert(const_iterator hint, const value_type& obj);
|
Chris@102
|
206 template <class P>
|
Chris@102
|
207 iterator insert(const_iterator hint, P&& obj);
|
Chris@102
|
208 template <class InputIterator>
|
Chris@102
|
209 void insert(InputIterator first, InputIterator last);
|
Chris@102
|
210 void insert(initializer_list<value_type>);
|
Chris@102
|
211
|
Chris@102
|
212 iterator erase(const_iterator position);
|
Chris@102
|
213 size_type erase(const key_type& k);
|
Chris@102
|
214 iterator erase(const_iterator first, const_iterator last);
|
Chris@102
|
215 void clear() noexcept;
|
Chris@102
|
216
|
Chris@102
|
217 void swap(hash_map&)
|
Chris@102
|
218 noexcept(
|
Chris@102
|
219 (!allocator_type::propagate_on_container_swap::value ||
|
Chris@102
|
220 __is_nothrow_swappable<allocator_type>::value) &&
|
Chris@102
|
221 __is_nothrow_swappable<hasher>::value &&
|
Chris@102
|
222 __is_nothrow_swappable<key_equal>::value);
|
Chris@102
|
223
|
Chris@102
|
224 hasher hash_function() const;
|
Chris@102
|
225 key_equal key_eq() const;
|
Chris@102
|
226
|
Chris@102
|
227 iterator find(const key_type& k);
|
Chris@102
|
228 const_iterator find(const key_type& k) const;
|
Chris@102
|
229 size_type count(const key_type& k) const;
|
Chris@102
|
230 pair<iterator, iterator> equal_range(const key_type& k);
|
Chris@102
|
231 pair<const_iterator, const_iterator> equal_range(const key_type& k) const;
|
Chris@102
|
232
|
Chris@102
|
233 mapped_type& operator[](const key_type& k);
|
Chris@102
|
234 mapped_type& operator[](key_type&& k);
|
Chris@102
|
235
|
Chris@102
|
236 mapped_type& at(const key_type& k);
|
Chris@102
|
237 const mapped_type& at(const key_type& k) const;
|
Chris@102
|
238
|
Chris@102
|
239 size_type bucket_count() const noexcept;
|
Chris@102
|
240 size_type max_bucket_count() const noexcept;
|
Chris@102
|
241
|
Chris@102
|
242 size_type bucket_size(size_type n) const;
|
Chris@102
|
243 size_type bucket(const key_type& k) const;
|
Chris@102
|
244
|
Chris@102
|
245 local_iterator begin(size_type n);
|
Chris@102
|
246 local_iterator end(size_type n);
|
Chris@102
|
247 const_local_iterator begin(size_type n) const;
|
Chris@102
|
248 const_local_iterator end(size_type n) const;
|
Chris@102
|
249 const_local_iterator cbegin(size_type n) const;
|
Chris@102
|
250 const_local_iterator cend(size_type n) const;
|
Chris@102
|
251
|
Chris@102
|
252 float load_factor() const noexcept;
|
Chris@102
|
253 float max_load_factor() const noexcept;
|
Chris@102
|
254 void max_load_factor(float z);
|
Chris@102
|
255 void rehash(size_type n);
|
Chris@102
|
256 void reserve(size_type n);
|
Chris@102
|
257 };
|
Chris@102
|
258
|
Chris@102
|
259 */
|
Chris@102
|
260
|
Chris@102
|
261 template <class Key, class Value, class KeyOfValue, unsigned int Options = 0, class Hash = hash<Key>, class Pred = equal_to<Key>,
|
Chris@102
|
262 class Allocator = allocator<Value> >
|
Chris@102
|
263 class hash_table
|
Chris@102
|
264 {
|
Chris@102
|
265 public:
|
Chris@102
|
266 // types
|
Chris@102
|
267 typedef Value key_type;
|
Chris@102
|
268 typedef key_type value_type;
|
Chris@102
|
269 typedef Hash hasher;
|
Chris@102
|
270 typedef Pred key_equal;
|
Chris@102
|
271 typedef Allocator allocator_type;
|
Chris@102
|
272 typedef value_type& reference;
|
Chris@102
|
273 typedef const value_type& const_reference;
|
Chris@102
|
274 typedef typename allocator_traits<allocator_type>::pointer pointer;
|
Chris@102
|
275 typedef typename allocator_traits<allocator_type>::const_pointer const_pointer;
|
Chris@102
|
276 typedef typename allocator_traits<allocator_type>::size_type size_type;
|
Chris@102
|
277 typedef typename allocator_traits<allocator_type>::difference_type difference_type;
|
Chris@102
|
278
|
Chris@102
|
279 typedef /unspecified/ iterator;
|
Chris@102
|
280 typedef /unspecified/ const_iterator;
|
Chris@102
|
281 typedef /unspecified/ local_iterator;
|
Chris@102
|
282 typedef /unspecified/ const_local_iterator;
|
Chris@102
|
283
|
Chris@102
|
284 hash_set()
|
Chris@102
|
285 noexcept(
|
Chris@102
|
286 is_nothrow_default_constructible<hasher>::value &&
|
Chris@102
|
287 is_nothrow_default_constructible<key_equal>::value &&
|
Chris@102
|
288 is_nothrow_default_constructible<allocator_type>::value);
|
Chris@102
|
289 explicit hash_set(size_type n, const hasher& hf = hasher(),
|
Chris@102
|
290 const key_equal& eql = key_equal(),
|
Chris@102
|
291 const allocator_type& a = allocator_type());
|
Chris@102
|
292 template <class InputIterator>
|
Chris@102
|
293 hash_set(InputIterator f, InputIterator l,
|
Chris@102
|
294 size_type n = 0, const hasher& hf = hasher(),
|
Chris@102
|
295 const key_equal& eql = key_equal(),
|
Chris@102
|
296 const allocator_type& a = allocator_type());
|
Chris@102
|
297 explicit hash_set(const allocator_type&);
|
Chris@102
|
298 hash_set(const hash_set&);
|
Chris@102
|
299 hash_set(const hash_set&, const Allocator&);
|
Chris@102
|
300 hash_set(hash_set&&)
|
Chris@102
|
301 noexcept(
|
Chris@102
|
302 is_nothrow_move_constructible<hasher>::value &&
|
Chris@102
|
303 is_nothrow_move_constructible<key_equal>::value &&
|
Chris@102
|
304 is_nothrow_move_constructible<allocator_type>::value);
|
Chris@102
|
305 hash_set(hash_set&&, const Allocator&);
|
Chris@102
|
306 hash_set(initializer_list<value_type>, size_type n = 0,
|
Chris@102
|
307 const hasher& hf = hasher(), const key_equal& eql = key_equal(),
|
Chris@102
|
308 const allocator_type& a = allocator_type());
|
Chris@102
|
309 ~hash_set();
|
Chris@102
|
310 hash_set& operator=(const hash_set&);
|
Chris@102
|
311 hash_set& operator=(hash_set&&)
|
Chris@102
|
312 noexcept(
|
Chris@102
|
313 allocator_type::propagate_on_container_move_assignment::value &&
|
Chris@102
|
314 is_nothrow_move_assignable<allocator_type>::value &&
|
Chris@102
|
315 is_nothrow_move_assignable<hasher>::value &&
|
Chris@102
|
316 is_nothrow_move_assignable<key_equal>::value);
|
Chris@102
|
317 hash_set& operator=(initializer_list<value_type>);
|
Chris@102
|
318
|
Chris@102
|
319 allocator_type get_allocator() const noexcept;
|
Chris@102
|
320
|
Chris@102
|
321 bool empty() const noexcept;
|
Chris@102
|
322 size_type size() const noexcept;
|
Chris@102
|
323 size_type max_size() const noexcept;
|
Chris@102
|
324
|
Chris@102
|
325 iterator begin() noexcept;
|
Chris@102
|
326 iterator end() noexcept;
|
Chris@102
|
327 const_iterator begin() const noexcept;
|
Chris@102
|
328 const_iterator end() const noexcept;
|
Chris@102
|
329 const_iterator cbegin() const noexcept;
|
Chris@102
|
330 const_iterator cend() const noexcept;
|
Chris@102
|
331
|
Chris@102
|
332 template <class... Args>
|
Chris@102
|
333 pair<iterator, bool> emplace(BOOST_FWD_REF(Args)... args);
|
Chris@102
|
334 template <class... Args>
|
Chris@102
|
335 iterator emplace_hint(const_iterator position, BOOST_FWD_REF(Args)... args);
|
Chris@102
|
336 pair<iterator, bool> insert(const value_type& obj);
|
Chris@102
|
337 pair<iterator, bool> insert(value_type&& obj);
|
Chris@102
|
338 iterator insert(const_iterator hint, const value_type& obj);
|
Chris@102
|
339 iterator insert(const_iterator hint, value_type&& obj);
|
Chris@102
|
340 template <class InputIterator>
|
Chris@102
|
341 void insert(InputIterator first, InputIterator last);
|
Chris@102
|
342 void insert(initializer_list<value_type>);
|
Chris@102
|
343
|
Chris@102
|
344 iterator erase(const_iterator position);
|
Chris@102
|
345 size_type erase(const key_type& k);
|
Chris@102
|
346 iterator erase(const_iterator first, const_iterator last);
|
Chris@102
|
347 void clear() noexcept;
|
Chris@102
|
348
|
Chris@102
|
349 void swap(hash_set&)
|
Chris@102
|
350 noexcept(
|
Chris@102
|
351 (!allocator_type::propagate_on_container_swap::value ||
|
Chris@102
|
352 __is_nothrow_swappable<allocator_type>::value) &&
|
Chris@102
|
353 __is_nothrow_swappable<hasher>::value &&
|
Chris@102
|
354 __is_nothrow_swappable<key_equal>::value);
|
Chris@102
|
355
|
Chris@102
|
356 hasher hash_function() const;
|
Chris@102
|
357 key_equal key_eq() const;
|
Chris@102
|
358
|
Chris@102
|
359 iterator find(const key_type& k);
|
Chris@102
|
360 const_iterator find(const key_type& k) const;
|
Chris@102
|
361 size_type count(const key_type& k) const;
|
Chris@102
|
362 pair<iterator, iterator> equal_range(const key_type& k);
|
Chris@102
|
363 pair<const_iterator, const_iterator> equal_range(const key_type& k) const;
|
Chris@102
|
364
|
Chris@102
|
365 size_type bucket_count() const noexcept;
|
Chris@102
|
366 size_type max_bucket_count() const noexcept;
|
Chris@102
|
367
|
Chris@102
|
368 size_type bucket_size(size_type n) const;
|
Chris@102
|
369 size_type bucket(const key_type& k) const;
|
Chris@102
|
370
|
Chris@102
|
371 local_iterator begin(size_type n);
|
Chris@102
|
372 local_iterator end(size_type n);
|
Chris@102
|
373 const_local_iterator begin(size_type n) const;
|
Chris@102
|
374 const_local_iterator end(size_type n) const;
|
Chris@102
|
375 const_local_iterator cbegin(size_type n) const;
|
Chris@102
|
376 const_local_iterator cend(size_type n) const;
|
Chris@102
|
377
|
Chris@102
|
378 float load_factor() const noexcept;
|
Chris@102
|
379 float max_load_factor() const noexcept;
|
Chris@102
|
380 void max_load_factor(float z);
|
Chris@102
|
381 void rehash(size_type n);
|
Chris@102
|
382 void reserve(size_type n);
|
Chris@102
|
383 };
|