3 // Copyright (C) 2005, 2006, 2009, 2011 Free Software Foundation, Inc.
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
8 // Foundation; either version 3, or (at your option) any later
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.
16 // You should have received a copy of the GNU General Public License
17 // along with this library; see the file COPYING3. If not see
18 // <http://www.gnu.org/licenses/>.
21 // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
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
33 * @file template_policy.hpp
34 * Contains template versions of policies.
37 #ifndef PB_DS_TEMPLATE_POLICY_HPP
38 #define PB_DS_TEMPLATE_POLICY_HPP
40 #include <ext/typelist.h>
41 #include <ext/pb_ds/hash_policy.hpp>
42 #include <ext/pb_ds/tree_policy.hpp>
43 #include <ext/pb_ds/list_update_policy.hpp>
49 template<typename _Alloc>
50 struct direct_mask_range_hashing_t_
51 : public __gnu_pbds::direct_mask_range_hashing<typename _Alloc::size_type>
53 typedef typename _Alloc::size_type size_type;
54 typedef __gnu_pbds::direct_mask_range_hashing<size_type> base_type;
57 template<typename _Alloc>
58 struct direct_mod_range_hashing_t_
59 : public __gnu_pbds::direct_mod_range_hashing<typename _Alloc::size_type>
61 typedef typename _Alloc::size_type size_type;
62 typedef __gnu_pbds::direct_mod_range_hashing<size_type> base_type;
65 template<typename _Alloc,
66 typename _Alloc::size_type Min_Load_Nom,
67 typename _Alloc::size_type Min_Load_Denom,
68 typename _Alloc::size_type Max_Load_Nom,
69 typename _Alloc::size_type Max_Load_Denom,
71 struct hash_load_check_resize_trigger_t_
72 : public __gnu_pbds::hash_load_check_resize_trigger<External_Access,
73 typename _Alloc::size_type>
75 typedef typename _Alloc::size_type size_type;
76 typedef __gnu_pbds::hash_load_check_resize_trigger<External_Access, size_type> base_type;
79 hash_load_check_resize_trigger_t_()
80 : base_type(static_cast<float>(Min_Load_Nom) / static_cast<float>(Min_Load_Denom), static_cast<float>(Max_Load_Nom) / static_cast<float>(Max_Load_Denom))
85 get_set_loads = External_Access,
90 template<typename _Alloc,
91 typename _Alloc::size_type Load_Nom,
92 typename _Alloc::size_type Load_Denom,
94 struct cc_hash_max_collision_check_resize_trigger_t_
95 : public __gnu_pbds::cc_hash_max_collision_check_resize_trigger<External_Access,
96 typename _Alloc::size_type>
98 typedef typename _Alloc::size_type size_type;
99 typedef __gnu_pbds::cc_hash_max_collision_check_resize_trigger<External_Access, size_type> base_type;
102 cc_hash_max_collision_check_resize_trigger_t_()
103 : base_type(static_cast<float>(Load_Nom) / static_cast<float>(Load_Denom))
108 get_set_load = External_Access,
109 get_set_loads = false
113 struct hash_prime_size_policy_t_ : public __gnu_pbds::hash_prime_size_policy
116 template<typename _Alloc>
117 struct hash_exponential_size_policy_t_
118 : public __gnu_pbds::hash_exponential_size_policy<typename _Alloc::size_type>
121 template<typename Key, typename _Alloc>
122 struct linear_probe_fn_t_
123 : public __gnu_pbds::linear_probe_fn<typename _Alloc::size_type>
126 template<typename Key, typename _Alloc>
127 struct quadratic_probe_fn_t_
128 : public __gnu_pbds::quadratic_probe_fn<typename _Alloc::size_type>
131 template<typename _Alloc, typename _Alloc::size_type Max_Count>
132 struct lu_counter_policy_t_
133 : public __gnu_pbds::lu_counter_policy<Max_Count, _Alloc>
135 typedef __gnu_pbds::lu_counter_policy<Max_Count, _Alloc> base_type;
138 struct lu_move_to_front_policy_t_
139 : public __gnu_pbds::lu_move_to_front_policy<>
142 } // namespace __gnu_pbds