]>
Commit | Line | Data |
---|---|---|
4569a895 AT |
1 | // -*- C++ -*- |
2 | ||
7adcbafe | 3 | // Copyright (C) 2005-2022 Free Software Foundation, Inc. |
4569a895 AT |
4 | // |
5 | // This file is part of the GNU ISO C++ Library. This library is free | |
6 | // software; you can redistribute it and/or modify it under the terms | |
7 | // of the GNU General Public License as published by the Free Software | |
748086b7 | 8 | // Foundation; either version 3, or (at your option) any later |
4569a895 AT |
9 | // version. |
10 | ||
11 | // This library is distributed in the hope that it will be useful, but | |
12 | // WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
14 | // General Public License for more details. | |
15 | ||
16 | // You should have received a copy of the GNU General Public License | |
748086b7 JJ |
17 | // along with this library; see the file COPYING3. If not see |
18 | // <http://www.gnu.org/licenses/>. | |
4569a895 | 19 | |
4569a895 AT |
20 | |
21 | // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. | |
22 | ||
23 | // Permission to use, copy, modify, sell, and distribute this software | |
24 | // is hereby granted without fee, provided that the above copyright | |
25 | // notice appears in all copies, and that both that copyright notice | |
26 | // and this permission notice appear in supporting documentation. None | |
27 | // of the above authors, nor IBM Haifa Research Laboratories, make any | |
28 | // representation about the suitability of this software for any | |
29 | // purpose. It is provided "as is" without express or implied | |
30 | // warranty. | |
31 | ||
32 | /** | |
33 | * @file common_type.hpp | |
34 | * Contains common types. | |
35 | */ | |
36 | ||
2e3f9c21 BK |
37 | #ifndef PB_DS_COMMON_TYPES_ASSOC_HPP |
38 | #define PB_DS_COMMON_TYPES_ASSOC_HPP | |
4569a895 AT |
39 | |
40 | #include <ext/pb_ds/detail/type_utils.hpp> | |
41 | #include <common_type/assoc/template_policy.hpp> | |
42 | #include <ext/pb_ds/assoc_container.hpp> | |
43 | ||
5e11f978 | 44 | namespace __gnu_pbds |
4569a895 | 45 | { |
4569a895 AT |
46 | namespace test |
47 | { | |
4569a895 AT |
48 | template<typename Key, |
49 | typename Data, | |
5e11f978 | 50 | class Hash_Fn = typename __gnu_pbds::detail::default_hash_fn<Key>::type, |
3441f106 | 51 | class Eq_Fn = std::equal_to<Key>, |
a345e45d | 52 | typename _Alloc = std::allocator<std::pair<const Key, Data> > > |
4569a895 AT |
53 | struct hash_common_types |
54 | { | |
55 | private: | |
a345e45d | 56 | typedef typename _Alloc::size_type size_type; |
4569a895 AT |
57 | |
58 | typedef | |
5e11f978 | 59 | __gnu_pbds::test::hash_load_check_resize_trigger_t_< |
a345e45d | 60 | _Alloc, |
4569a895 AT |
61 | 1, 8, |
62 | 1, 2, | |
63 | false> | |
64 | no_access_half_load_check_resize_trigger_policy; | |
65 | ||
66 | typedef | |
5e11f978 | 67 | __gnu_pbds::test::hash_load_check_resize_trigger_t_< |
a345e45d | 68 | _Alloc, |
4569a895 AT |
69 | 1, 8, |
70 | 1, 2, | |
71 | true> | |
72 | access_half_load_check_resize_trigger_policy; | |
73 | ||
74 | typedef | |
5e11f978 | 75 | __gnu_pbds::test::hash_load_check_resize_trigger_t_< |
a345e45d | 76 | _Alloc, |
4569a895 AT |
77 | 1, 8, |
78 | 1, 1, | |
79 | false> | |
80 | no_access_one_load_check_resize_trigger_policy; | |
81 | ||
82 | typedef | |
5e11f978 | 83 | __gnu_pbds::test::cc_hash_max_collision_check_resize_trigger_t_< |
a345e45d | 84 | _Alloc, |
4569a895 AT |
85 | 1, 2, |
86 | false> | |
87 | no_access_half_max_col_check_check_resize_trigger_policy; | |
88 | ||
89 | typedef | |
5e11f978 | 90 | __gnu_pbds::test::cc_hash_max_collision_check_resize_trigger_t_< |
a345e45d | 91 | _Alloc, |
4569a895 AT |
92 | 1, 2, |
93 | true> | |
94 | access_half_max_col_check_check_resize_trigger_policy; | |
95 | ||
a345e45d | 96 | typedef __gnu_pbds::test::linear_probe_fn_t_<Key, _Alloc> lin_p_t; |
4569a895 | 97 | |
a345e45d | 98 | typedef __gnu_pbds::test::quadratic_probe_fn_t_<Key, _Alloc> quad_p_t; |
4569a895 AT |
99 | |
100 | typedef | |
d7f245b1 | 101 | typename __gnu_cxx::typelist::create4< |
5e11f978 | 102 | __gnu_pbds::detail::false_type, |
a345e45d | 103 | __gnu_pbds::test::direct_mask_range_hashing_t_<_Alloc>, |
4569a895 | 104 | no_access_half_load_check_resize_trigger_policy, |
a345e45d | 105 | __gnu_pbds::test::hash_exponential_size_policy_t_<_Alloc> >::type |
4569a895 AT |
106 | performance_cc_policy0; |
107 | ||
108 | typedef | |
d7f245b1 | 109 | typename __gnu_cxx::typelist::create4< |
5e11f978 | 110 | __gnu_pbds::detail::false_type, |
a345e45d | 111 | __gnu_pbds::test::direct_mod_range_hashing_t_<_Alloc>, |
4569a895 | 112 | no_access_half_load_check_resize_trigger_policy, |
5e11f978 | 113 | __gnu_pbds::test::hash_prime_size_policy_t_>::type |
4569a895 AT |
114 | performance_cc_policy1; |
115 | ||
116 | typedef | |
d7f245b1 | 117 | typename __gnu_cxx::typelist::create4< |
5e11f978 | 118 | __gnu_pbds::detail::false_type, |
a345e45d | 119 | __gnu_pbds::test::direct_mask_range_hashing_t_<_Alloc>, |
4569a895 | 120 | no_access_one_load_check_resize_trigger_policy, |
a345e45d | 121 | __gnu_pbds::test::hash_exponential_size_policy_t_<_Alloc> >::type |
4569a895 AT |
122 | performance_cc_policy2; |
123 | ||
124 | typedef | |
d7f245b1 | 125 | typename __gnu_cxx::typelist::create4< |
5e11f978 | 126 | __gnu_pbds::detail::false_type, |
a345e45d | 127 | __gnu_pbds::test::direct_mod_range_hashing_t_<_Alloc>, |
4569a895 | 128 | no_access_one_load_check_resize_trigger_policy, |
5e11f978 | 129 | __gnu_pbds::test::hash_prime_size_policy_t_ >::type |
4569a895 AT |
130 | performance_cc_policy3; |
131 | ||
132 | typedef | |
d7f245b1 | 133 | typename __gnu_cxx::typelist::create4< |
5e11f978 | 134 | __gnu_pbds::detail::true_type, |
a345e45d | 135 | __gnu_pbds::test::direct_mask_range_hashing_t_<_Alloc>, |
4569a895 | 136 | no_access_half_load_check_resize_trigger_policy, |
a345e45d | 137 | __gnu_pbds::test::hash_exponential_size_policy_t_<_Alloc> >::type |
4569a895 AT |
138 | performance_cc_policy4; |
139 | ||
140 | typedef | |
d7f245b1 | 141 | typename __gnu_cxx::typelist::create4< |
5e11f978 | 142 | __gnu_pbds::detail::false_type, |
a345e45d | 143 | __gnu_pbds::test::direct_mask_range_hashing_t_<_Alloc>, |
4569a895 | 144 | no_access_half_max_col_check_check_resize_trigger_policy, |
a345e45d | 145 | __gnu_pbds::test::hash_exponential_size_policy_t_<_Alloc> >::type |
4569a895 AT |
146 | performance_cc_policy5; |
147 | ||
148 | typedef | |
d7f245b1 | 149 | typename __gnu_cxx::typelist::create4< |
5e11f978 | 150 | __gnu_pbds::detail::false_type, |
a345e45d | 151 | __gnu_pbds::test::direct_mask_range_hashing_t_<_Alloc>, |
4569a895 | 152 | access_half_max_col_check_check_resize_trigger_policy, |
a345e45d | 153 | __gnu_pbds::test::hash_exponential_size_policy_t_<_Alloc> >::type |
4569a895 AT |
154 | regression_cc_policy0; |
155 | ||
156 | typedef | |
d7f245b1 | 157 | typename __gnu_cxx::typelist::create4< |
5e11f978 | 158 | __gnu_pbds::detail::false_type, |
a345e45d | 159 | __gnu_pbds::test::direct_mask_range_hashing_t_<_Alloc>, |
4569a895 | 160 | access_half_load_check_resize_trigger_policy, |
a345e45d | 161 | __gnu_pbds::test::hash_exponential_size_policy_t_<_Alloc> >::type |
4569a895 AT |
162 | regression_cc_policy1; |
163 | ||
164 | typedef | |
d7f245b1 | 165 | typename __gnu_cxx::typelist::create4< |
5e11f978 | 166 | __gnu_pbds::detail::true_type, |
a345e45d | 167 | __gnu_pbds::test::direct_mod_range_hashing_t_<_Alloc>, |
4569a895 | 168 | no_access_half_load_check_resize_trigger_policy, |
a345e45d | 169 | __gnu_pbds::test::hash_prime_size_policy_t_>::type |
4569a895 AT |
170 | regression_cc_policy2; |
171 | ||
172 | typedef | |
d7f245b1 | 173 | typename __gnu_cxx::typelist::create5< |
5e11f978 | 174 | __gnu_pbds::detail::false_type, |
4569a895 | 175 | lin_p_t, |
a345e45d | 176 | __gnu_pbds::test::direct_mask_range_hashing_t_<_Alloc>, |
4569a895 | 177 | no_access_half_load_check_resize_trigger_policy, |
a345e45d | 178 | __gnu_pbds::test::hash_exponential_size_policy_t_<_Alloc> >::type |
4569a895 AT |
179 | performance_gp_policy0; |
180 | ||
181 | typedef | |
d7f245b1 | 182 | typename __gnu_cxx::typelist::create5< |
5e11f978 | 183 | __gnu_pbds::detail::false_type, |
4569a895 | 184 | quad_p_t, |
a345e45d | 185 | __gnu_pbds::test::direct_mod_range_hashing_t_<_Alloc>, |
4569a895 | 186 | no_access_half_load_check_resize_trigger_policy, |
5e11f978 | 187 | __gnu_pbds::test::hash_prime_size_policy_t_ >::type |
4569a895 AT |
188 | performance_gp_policy1; |
189 | ||
190 | typedef | |
d7f245b1 | 191 | typename __gnu_cxx::typelist::create5< |
5e11f978 | 192 | __gnu_pbds::detail::false_type, |
4569a895 | 193 | quad_p_t, |
a345e45d | 194 | __gnu_pbds::test::direct_mod_range_hashing_t_<_Alloc>, |
4569a895 | 195 | access_half_load_check_resize_trigger_policy, |
5e11f978 | 196 | __gnu_pbds::test::hash_prime_size_policy_t_>::type |
4569a895 AT |
197 | regression_gp_policy0; |
198 | ||
199 | typedef | |
d7f245b1 | 200 | typename __gnu_cxx::typelist::create5< |
5e11f978 | 201 | __gnu_pbds::detail::true_type, |
4569a895 | 202 | lin_p_t, |
a345e45d | 203 | __gnu_pbds::test::direct_mask_range_hashing_t_<_Alloc>, |
4569a895 | 204 | access_half_load_check_resize_trigger_policy, |
a345e45d | 205 | __gnu_pbds::test::hash_exponential_size_policy_t_<_Alloc> >::type |
4569a895 AT |
206 | regression_gp_policy1; |
207 | ||
208 | typedef | |
d7f245b1 | 209 | typename __gnu_cxx::typelist::create6< |
4569a895 AT |
210 | performance_cc_policy0, |
211 | performance_cc_policy1, | |
212 | performance_cc_policy2, | |
213 | performance_cc_policy3, | |
214 | performance_cc_policy4, | |
215 | performance_cc_policy5>::type | |
216 | performance_cc_range_hashing_policies; | |
217 | ||
218 | typedef | |
d7f245b1 | 219 | typename __gnu_cxx::typelist::create3< |
4569a895 AT |
220 | regression_cc_policy0, |
221 | regression_cc_policy1, | |
222 | regression_cc_policy2>::type | |
223 | regression_cc_range_hashing_policies; | |
224 | ||
225 | typedef | |
d7f245b1 | 226 | typename __gnu_cxx::typelist::create2< |
4569a895 AT |
227 | performance_gp_policy0, |
228 | performance_gp_policy1>::type | |
229 | performance_gp_range_hashing_policies; | |
230 | ||
231 | typedef | |
d7f245b1 | 232 | typename __gnu_cxx::typelist::create2< |
4569a895 AT |
233 | regression_gp_policy0, |
234 | regression_gp_policy1>::type | |
235 | regression_gp_range_hashing_policies; | |
236 | ||
237 | template<typename Policy_Tl> | |
238 | struct no_access_generic_cc_hash_table_t | |
239 | { | |
240 | private: | |
241 | typedef | |
a345e45d | 242 | typename __gnu_cxx::typelist::at_index<Policy_Tl, 0>::type |
4569a895 AT |
243 | store_hash_indicator; |
244 | ||
245 | enum | |
246 | { | |
247 | store_hash = store_hash_indicator::value | |
248 | }; | |
249 | ||
a345e45d | 250 | typedef typename __gnu_cxx::typelist::at_index<Policy_Tl, 1>::type |
4569a895 AT |
251 | comb_hash_fn; |
252 | ||
a345e45d | 253 | typedef typename __gnu_cxx::typelist::at_index<Policy_Tl, 2>::type |
4569a895 AT |
254 | trigger_policy; |
255 | ||
a345e45d | 256 | typedef typename __gnu_cxx::typelist::at_index<Policy_Tl, 3>::type |
4569a895 AT |
257 | size_policy; |
258 | ||
259 | public: | |
260 | typedef | |
5e11f978 | 261 | __gnu_pbds::cc_hash_table< |
4569a895 AT |
262 | Key, |
263 | Data, | |
264 | Hash_Fn, | |
265 | Eq_Fn, | |
266 | comb_hash_fn, | |
a345e45d BK |
267 | __gnu_pbds::hash_standard_resize_policy<size_policy, trigger_policy, |
268 | false>, | |
4569a895 | 269 | store_hash, |
a345e45d | 270 | _Alloc> |
4569a895 AT |
271 | type; |
272 | }; | |
273 | ||
274 | template<typename Policy_Tl> | |
275 | struct access_generic_cc_hash_table_t | |
276 | { | |
277 | private: | |
278 | typedef | |
a345e45d | 279 | typename __gnu_cxx::typelist::at_index<Policy_Tl, 0>::type |
4569a895 AT |
280 | store_hash_indicator; |
281 | ||
282 | enum | |
283 | { | |
284 | store_hash = store_hash_indicator::value | |
285 | }; | |
286 | ||
a345e45d | 287 | typedef typename __gnu_cxx::typelist::at_index<Policy_Tl, 1>::type |
4569a895 AT |
288 | comb_hash_fn; |
289 | ||
a345e45d | 290 | typedef typename __gnu_cxx::typelist::at_index<Policy_Tl, 2>::type |
4569a895 AT |
291 | trigger_policy; |
292 | ||
a345e45d | 293 | typedef typename __gnu_cxx::typelist::at_index<Policy_Tl, 3>::type |
4569a895 AT |
294 | size_policy; |
295 | ||
296 | public: | |
297 | typedef | |
5e11f978 | 298 | __gnu_pbds::cc_hash_table< |
4569a895 AT |
299 | Key, |
300 | Data, | |
301 | Hash_Fn, | |
302 | Eq_Fn, | |
303 | comb_hash_fn, | |
a345e45d BK |
304 | __gnu_pbds::hash_standard_resize_policy<size_policy, trigger_policy, |
305 | true>, | |
4569a895 | 306 | store_hash, |
a345e45d | 307 | _Alloc> |
4569a895 AT |
308 | type; |
309 | }; | |
310 | ||
311 | template<typename Policy_Tl> | |
312 | struct no_access_generic_gp_hash_table_t | |
313 | { | |
314 | private: | |
a345e45d | 315 | typedef typename __gnu_cxx::typelist::at_index<Policy_Tl, 0>::type |
4569a895 AT |
316 | store_hash_indicator; |
317 | ||
318 | enum | |
319 | { | |
320 | store_hash = store_hash_indicator::value | |
321 | }; | |
322 | ||
a345e45d | 323 | typedef typename __gnu_cxx::typelist::at_index<Policy_Tl, 1>::type |
4569a895 AT |
324 | probe_fn; |
325 | ||
a345e45d | 326 | typedef typename __gnu_cxx::typelist::at_index<Policy_Tl, 2>::type |
4569a895 AT |
327 | comb_probe_fn; |
328 | ||
a345e45d | 329 | typedef typename __gnu_cxx::typelist::at_index<Policy_Tl, 3>::type |
4569a895 AT |
330 | trigger_policy; |
331 | ||
a345e45d | 332 | typedef typename __gnu_cxx::typelist::at_index<Policy_Tl, 4>::type |
4569a895 AT |
333 | size_policy; |
334 | ||
335 | public: | |
336 | typedef | |
5e11f978 | 337 | __gnu_pbds::gp_hash_table< |
4569a895 AT |
338 | Key, |
339 | Data, | |
340 | Hash_Fn, | |
341 | Eq_Fn, | |
342 | comb_probe_fn, | |
343 | probe_fn, | |
a345e45d BK |
344 | __gnu_pbds::hash_standard_resize_policy<size_policy, trigger_policy, |
345 | false>, | |
4569a895 | 346 | store_hash, |
a345e45d | 347 | _Alloc> |
4569a895 AT |
348 | type; |
349 | }; | |
350 | ||
351 | template<typename Policy_Tl> | |
352 | struct access_generic_gp_hash_table_t | |
353 | { | |
354 | private: | |
a345e45d | 355 | typedef typename __gnu_cxx::typelist::at_index<Policy_Tl, 0>::type |
4569a895 AT |
356 | store_hash_indicator; |
357 | ||
358 | enum | |
359 | { | |
360 | store_hash = store_hash_indicator::value | |
361 | }; | |
362 | ||
a345e45d | 363 | typedef typename __gnu_cxx::typelist::at_index<Policy_Tl, 1>::type |
4569a895 AT |
364 | probe_fn; |
365 | ||
a345e45d | 366 | typedef typename __gnu_cxx::typelist::at_index<Policy_Tl, 2>::type |
4569a895 AT |
367 | comb_probe_fn; |
368 | ||
a345e45d | 369 | typedef typename __gnu_cxx::typelist::at_index<Policy_Tl, 3>::type |
4569a895 AT |
370 | trigger_policy; |
371 | ||
a345e45d | 372 | typedef typename __gnu_cxx::typelist::at_index<Policy_Tl, 4>::type |
4569a895 AT |
373 | size_policy; |
374 | ||
375 | public: | |
376 | typedef | |
5e11f978 | 377 | __gnu_pbds::gp_hash_table< |
4569a895 AT |
378 | Key, |
379 | Data, | |
380 | Hash_Fn, | |
381 | Eq_Fn, | |
382 | comb_probe_fn, | |
383 | probe_fn, | |
a345e45d BK |
384 | __gnu_pbds::hash_standard_resize_policy<size_policy, trigger_policy, |
385 | true>, | |
4569a895 | 386 | store_hash, |
a345e45d | 387 | _Alloc> |
4569a895 AT |
388 | type; |
389 | }; | |
390 | ||
391 | typedef | |
d7f245b1 | 392 | typename __gnu_cxx::typelist::transform< |
4569a895 AT |
393 | performance_cc_range_hashing_policies, |
394 | no_access_generic_cc_hash_table_t>::type | |
395 | performance_cc_types; | |
396 | ||
397 | typedef | |
d7f245b1 | 398 | typename __gnu_cxx::typelist::transform< |
4569a895 AT |
399 | regression_cc_range_hashing_policies, |
400 | access_generic_cc_hash_table_t>::type | |
401 | regression_cc_types; | |
402 | ||
403 | typedef | |
d7f245b1 | 404 | typename __gnu_cxx::typelist::at_index< |
4569a895 AT |
405 | performance_cc_types, |
406 | 0>::type | |
407 | performance_min_cc_type; | |
408 | ||
409 | typedef | |
d7f245b1 | 410 | typename __gnu_cxx::typelist::transform< |
4569a895 AT |
411 | performance_gp_range_hashing_policies, |
412 | no_access_generic_gp_hash_table_t>::type | |
413 | performance_gp_types; | |
414 | ||
415 | typedef | |
d7f245b1 | 416 | typename __gnu_cxx::typelist::transform< |
4569a895 AT |
417 | regression_gp_range_hashing_policies, |
418 | access_generic_gp_hash_table_t>::type | |
419 | regression_gp_types; | |
420 | ||
421 | typedef | |
d7f245b1 | 422 | typename __gnu_cxx::typelist::at_index< |
4569a895 AT |
423 | performance_gp_types, |
424 | 0>::type | |
425 | performance_min_gp_type; | |
426 | ||
427 | public: | |
428 | typedef | |
d7f245b1 | 429 | typename __gnu_cxx::typelist::append< |
4569a895 AT |
430 | performance_cc_types, |
431 | performance_gp_types>::type | |
432 | performance_tl; | |
433 | ||
434 | typedef | |
d7f245b1 | 435 | typename __gnu_cxx::typelist::append< |
4569a895 AT |
436 | regression_gp_types, |
437 | regression_cc_types>::type | |
438 | regression_tl; | |
439 | ||
440 | typedef | |
d7f245b1 | 441 | typename __gnu_cxx::typelist::create1< |
4569a895 AT |
442 | performance_min_cc_type>::type |
443 | performance_min_tl; | |
444 | }; | |
445 | ||
446 | template<typename Key, | |
447 | typename Data, | |
448 | class Comb_Hash_Fn_TL, | |
449 | class Comb_Probe_Fn_TL, | |
450 | class Eq_Fn = | |
451 | std::equal_to<Key>, | |
a345e45d | 452 | typename _Alloc = std::allocator<std::pair<const Key, Data> > > |
4569a895 AT |
453 | struct ranged_hash_common_types |
454 | { | |
455 | private: | |
a345e45d | 456 | typedef typename _Alloc::size_type size_type; |
4569a895 AT |
457 | |
458 | typedef | |
5e11f978 | 459 | __gnu_pbds::test::hash_load_check_resize_trigger_t_< |
a345e45d | 460 | _Alloc, |
4569a895 AT |
461 | 1, 8, |
462 | 1, 2, | |
463 | false> | |
464 | no_access_half_load_check_resize_trigger_policy; | |
465 | ||
466 | typedef | |
5e11f978 | 467 | __gnu_pbds::test::hash_load_check_resize_trigger_t_< |
a345e45d | 468 | _Alloc, |
4569a895 AT |
469 | 1, 8, |
470 | 1, 1, | |
471 | false> | |
472 | no_access_one_load_check_resize_trigger_policy; | |
473 | ||
474 | typedef | |
5e11f978 BK |
475 | __gnu_pbds::hash_standard_resize_policy< |
476 | __gnu_pbds::test::hash_exponential_size_policy_t_< | |
a345e45d | 477 | _Alloc>, |
4569a895 AT |
478 | no_access_half_load_check_resize_trigger_policy> |
479 | mask_half_resize_policy_t; | |
480 | ||
481 | typedef | |
5e11f978 BK |
482 | __gnu_pbds::hash_standard_resize_policy< |
483 | __gnu_pbds::test::hash_exponential_size_policy_t_< | |
a345e45d | 484 | _Alloc>, |
4569a895 AT |
485 | no_access_one_load_check_resize_trigger_policy> |
486 | mask_one_resize_policy_t; | |
487 | ||
488 | typedef | |
5e11f978 BK |
489 | __gnu_pbds::hash_standard_resize_policy< |
490 | __gnu_pbds::test::hash_prime_size_policy_t_, | |
4569a895 AT |
491 | no_access_half_load_check_resize_trigger_policy> |
492 | mod_half_resize_policy_t; | |
493 | ||
494 | typedef | |
5e11f978 BK |
495 | __gnu_pbds::hash_standard_resize_policy< |
496 | __gnu_pbds::test::hash_prime_size_policy_t_, | |
4569a895 AT |
497 | no_access_one_load_check_resize_trigger_policy> |
498 | mod_one_resize_policy_t; | |
499 | ||
500 | template<typename Comb_Hash_Fn_> | |
501 | struct half_resize_policy_selector; | |
502 | ||
a345e45d BK |
503 | template<typename _Alloc_> |
504 | struct half_resize_policy_selector<__gnu_pbds::test::direct_mask_range_hashing_t_<_Alloc_> > | |
4569a895 AT |
505 | { |
506 | typedef mask_half_resize_policy_t type; | |
507 | }; | |
508 | ||
a345e45d BK |
509 | template<typename _Alloc_> |
510 | struct half_resize_policy_selector<__gnu_pbds::test::direct_mod_range_hashing_t_<_Alloc_> > | |
4569a895 AT |
511 | { |
512 | typedef mod_half_resize_policy_t type; | |
513 | }; | |
514 | ||
515 | template<typename Comb_Hash_Fn_> | |
516 | struct one_resize_policy_selector; | |
517 | ||
a345e45d BK |
518 | template<typename _Alloc_> |
519 | struct one_resize_policy_selector<__gnu_pbds::test::direct_mask_range_hashing_t_<_Alloc_> > | |
4569a895 AT |
520 | { |
521 | typedef mask_one_resize_policy_t type; | |
522 | }; | |
523 | ||
a345e45d BK |
524 | template<typename _Alloc_> |
525 | struct one_resize_policy_selector<__gnu_pbds::test::direct_mod_range_hashing_t_<_Alloc_> > | |
4569a895 AT |
526 | { |
527 | typedef mod_one_resize_policy_t type; | |
528 | }; | |
529 | ||
530 | template<typename Comb_Hash_Fn> | |
531 | struct generic_cc_hash_table_t | |
532 | { | |
533 | typedef | |
5e11f978 | 534 | __gnu_pbds::cc_hash_table< |
4569a895 AT |
535 | Key, |
536 | Data, | |
a345e45d | 537 | __gnu_pbds::null_type, |
4569a895 AT |
538 | Eq_Fn, |
539 | Comb_Hash_Fn, | |
f92ab29f | 540 | typename one_resize_policy_selector<typename Comb_Hash_Fn::comb_fn>::type, |
a345e45d | 541 | false, _Alloc> |
4569a895 AT |
542 | type; |
543 | }; | |
544 | ||
545 | typedef | |
d7f245b1 | 546 | typename __gnu_cxx::typelist::transform< |
4569a895 AT |
547 | Comb_Hash_Fn_TL, |
548 | generic_cc_hash_table_t>::type | |
549 | performance_cc_types; | |
550 | ||
551 | template<typename Comb_Probe_Fn> | |
552 | struct no_access_generic_gp_hash_table_t | |
553 | { | |
554 | typedef | |
5e11f978 | 555 | __gnu_pbds::gp_hash_table< |
4569a895 AT |
556 | Key, |
557 | Data, | |
a345e45d | 558 | __gnu_pbds::null_type, |
4569a895 AT |
559 | Eq_Fn, |
560 | Comb_Probe_Fn, | |
a345e45d BK |
561 | __gnu_pbds::null_type, |
562 | typename half_resize_policy_selector<typename Comb_Probe_Fn::comb_fn>::type, | |
4569a895 | 563 | false, |
a345e45d | 564 | _Alloc> |
4569a895 AT |
565 | type; |
566 | }; | |
567 | ||
568 | typedef | |
d7f245b1 | 569 | typename __gnu_cxx::typelist::transform< |
4569a895 AT |
570 | Comb_Probe_Fn_TL, |
571 | no_access_generic_gp_hash_table_t>::type | |
572 | performance_gp_types; | |
573 | ||
574 | public: | |
575 | typedef | |
d7f245b1 | 576 | typename __gnu_cxx::typelist::append< |
4569a895 AT |
577 | performance_cc_types, |
578 | performance_gp_types>::type | |
579 | performance_tl; | |
580 | }; | |
581 | ||
582 | template<typename Key, typename Data, class Eq_Fn = std::equal_to<Key>, | |
a345e45d | 583 | typename _Alloc = std::allocator<char> > |
4569a895 AT |
584 | class lu_common_types |
585 | { | |
586 | private: | |
a345e45d | 587 | typedef typename _Alloc::size_type size_type; |
4569a895 | 588 | |
a345e45d | 589 | typedef __gnu_pbds::test::lu_move_to_front_policy_t_ mtf_u; |
4569a895 | 590 | |
a345e45d | 591 | typedef __gnu_pbds::test::lu_counter_policy_t_<_Alloc, 5> cnt_5_u; |
4569a895 | 592 | |
d7f245b1 | 593 | typedef typename __gnu_cxx::typelist::create1<mtf_u>::type lu_policy0; |
4569a895 | 594 | |
d7f245b1 | 595 | typedef typename __gnu_cxx::typelist::create1<cnt_5_u>::type lu_policy1; |
4569a895 AT |
596 | |
597 | typedef | |
875d0f10 | 598 | typename __gnu_cxx::typelist::create2<lu_policy0, lu_policy1>::type |
4569a895 AT |
599 | lu_policies; |
600 | ||
601 | template<typename Policy_Tl> | |
602 | struct generic_list_update_t | |
603 | { | |
604 | private: | |
605 | typedef | |
875d0f10 | 606 | typename __gnu_cxx::typelist::at_index<Policy_Tl, 0>::type |
4569a895 AT |
607 | update_policy_t; |
608 | ||
609 | public: | |
610 | typedef | |
a345e45d | 611 | __gnu_pbds::list_update<Key, Data, Eq_Fn, update_policy_t, _Alloc> |
4569a895 AT |
612 | type; |
613 | }; | |
614 | ||
615 | typedef | |
a345e45d | 616 | typename __gnu_cxx::typelist::transform<lu_policies, |
4569a895 AT |
617 | generic_list_update_t>::type |
618 | lu_types; | |
619 | ||
620 | typedef | |
a345e45d | 621 | typename __gnu_cxx::typelist::at_index<lu_types, 0>::type |
4569a895 AT |
622 | min_lu_type; |
623 | ||
624 | public: | |
625 | typedef lu_types performance_tl; | |
4569a895 AT |
626 | typedef lu_types regression_tl; |
627 | ||
d7f245b1 | 628 | typedef typename __gnu_cxx::typelist::create1<min_lu_type>::type performance_min_tl; |
4569a895 AT |
629 | }; |
630 | ||
631 | template<typename Key, typename Data, class Cmp_Fn = std::less<Key>, | |
a345e45d BK |
632 | template<typename Node_CItr, |
633 | class Node_Itr, | |
4569a895 | 634 | class Cmp_Fn_, |
a345e45d BK |
635 | typename _Alloc_> |
636 | class Node_Update = __gnu_pbds::null_node_update, | |
637 | typename _Alloc = std::allocator<std::pair<const Key, Data> > > | |
4569a895 AT |
638 | struct tree_common_types |
639 | { | |
640 | private: | |
641 | typedef | |
5e11f978 | 642 | __gnu_pbds::tree< |
4569a895 AT |
643 | Key, |
644 | Data, | |
645 | Cmp_Fn, | |
5e11f978 | 646 | __gnu_pbds::ov_tree_tag, |
4569a895 | 647 | Node_Update, |
a345e45d | 648 | _Alloc> |
4569a895 AT |
649 | ov_tree_assoc_container_t; |
650 | ||
651 | typedef | |
5e11f978 | 652 | __gnu_pbds::tree< |
4569a895 AT |
653 | Key, |
654 | Data, | |
655 | Cmp_Fn, | |
5e11f978 | 656 | __gnu_pbds::rb_tree_tag, |
4569a895 | 657 | Node_Update, |
a345e45d | 658 | _Alloc> |
4569a895 AT |
659 | rb_tree_assoc_container_t; |
660 | ||
661 | typedef | |
5e11f978 | 662 | __gnu_pbds::tree< |
4569a895 AT |
663 | Key, |
664 | Data, | |
665 | Cmp_Fn, | |
5e11f978 | 666 | __gnu_pbds::splay_tree_tag, |
4569a895 | 667 | Node_Update, |
a345e45d | 668 | _Alloc> |
4569a895 AT |
669 | splay_tree_assoc_container_t; |
670 | ||
671 | public: | |
672 | typedef | |
d7f245b1 | 673 | typename __gnu_cxx::typelist::create3< |
4569a895 AT |
674 | splay_tree_assoc_container_t, |
675 | rb_tree_assoc_container_t, | |
676 | ov_tree_assoc_container_t>::type | |
677 | performance_tl; | |
678 | ||
679 | typedef | |
d7f245b1 | 680 | typename __gnu_cxx::typelist::create3< |
4569a895 AT |
681 | ov_tree_assoc_container_t, |
682 | splay_tree_assoc_container_t, | |
683 | rb_tree_assoc_container_t>::type | |
684 | regression_tl; | |
685 | ||
686 | typedef | |
d7f245b1 | 687 | typename __gnu_cxx::typelist::create1< |
4569a895 AT |
688 | rb_tree_assoc_container_t>::type |
689 | performance_min_tl; | |
690 | }; | |
691 | ||
692 | template<typename Key, | |
693 | typename Data, | |
a345e45d BK |
694 | class _ATraits = |
695 | typename __gnu_pbds::detail::default_trie_access_traits<Key>::type, | |
5e11f978 | 696 | class Tag = __gnu_pbds::pat_trie_tag, |
a345e45d BK |
697 | template<typename Node_CItr, |
698 | typename Node_Itr, | |
699 | class _ATraits_, | |
700 | typename _Alloc_> | |
701 | class Node_Update = __gnu_pbds::null_node_update, | |
702 | typename _Alloc = std::allocator<char> > | |
4569a895 AT |
703 | class trie_common_types |
704 | { | |
705 | private: | |
a345e45d | 706 | typedef __gnu_pbds::trie<Key, Data, _ATraits, Tag, Node_Update, _Alloc> type; |
4569a895 AT |
707 | |
708 | public: | |
d7f245b1 BK |
709 | typedef typename __gnu_cxx::typelist::create1<type>::type performance_tl; |
710 | typedef typename __gnu_cxx::typelist::create1<type>::type regression_tl; | |
711 | typedef typename __gnu_cxx::typelist::create1<type>::type performance_min_tl; | |
4569a895 AT |
712 | }; |
713 | ||
714 | } // namespace test | |
5e11f978 | 715 | } // namespace __gnu_pbds |
4569a895 | 716 | |
2e3f9c21 | 717 | #endif // #ifndef PB_DS_COMMON_TYPES_ASSOC_HPP |