1 |
742 |
jeremybenn |
// -*- C++ -*-
|
2 |
|
|
|
3 |
|
|
// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
|
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
|
8 |
|
|
// Foundation; either version 3, or (at your option) any later
|
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
|
17 |
|
|
// along with this library; see the file COPYING3. If not see
|
18 |
|
|
// <http://www.gnu.org/licenses/>.
|
19 |
|
|
|
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 template_policy.hpp
|
34 |
|
|
* Contains template versions of policies.
|
35 |
|
|
*/
|
36 |
|
|
|
37 |
|
|
#ifndef PB_DS_TEMPLATE_POLICY_HPP
|
38 |
|
|
#define PB_DS_TEMPLATE_POLICY_HPP
|
39 |
|
|
|
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>
|
44 |
|
|
|
45 |
|
|
namespace __gnu_pbds
|
46 |
|
|
{
|
47 |
|
|
namespace test
|
48 |
|
|
{
|
49 |
|
|
template<typename _Alloc>
|
50 |
|
|
struct direct_mask_range_hashing_t_
|
51 |
|
|
: public __gnu_pbds::direct_mask_range_hashing<typename _Alloc::size_type>
|
52 |
|
|
{
|
53 |
|
|
typedef typename _Alloc::size_type size_type;
|
54 |
|
|
typedef __gnu_pbds::direct_mask_range_hashing<size_type> base_type;
|
55 |
|
|
};
|
56 |
|
|
|
57 |
|
|
template<typename _Alloc>
|
58 |
|
|
struct direct_mod_range_hashing_t_
|
59 |
|
|
: public __gnu_pbds::direct_mod_range_hashing<typename _Alloc::size_type>
|
60 |
|
|
{
|
61 |
|
|
typedef typename _Alloc::size_type size_type;
|
62 |
|
|
typedef __gnu_pbds::direct_mod_range_hashing<size_type> base_type;
|
63 |
|
|
};
|
64 |
|
|
|
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,
|
70 |
|
|
bool External_Access>
|
71 |
|
|
struct hash_load_check_resize_trigger_t_
|
72 |
|
|
: public __gnu_pbds::hash_load_check_resize_trigger<External_Access,
|
73 |
|
|
typename _Alloc::size_type>
|
74 |
|
|
{
|
75 |
|
|
typedef typename _Alloc::size_type size_type;
|
76 |
|
|
typedef __gnu_pbds::hash_load_check_resize_trigger<External_Access, size_type> base_type;
|
77 |
|
|
|
78 |
|
|
inline
|
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))
|
81 |
|
|
{ }
|
82 |
|
|
|
83 |
|
|
enum
|
84 |
|
|
{
|
85 |
|
|
get_set_loads = External_Access,
|
86 |
|
|
get_set_load = false
|
87 |
|
|
};
|
88 |
|
|
};
|
89 |
|
|
|
90 |
|
|
template<typename _Alloc,
|
91 |
|
|
typename _Alloc::size_type Load_Nom,
|
92 |
|
|
typename _Alloc::size_type Load_Denom,
|
93 |
|
|
bool External_Access>
|
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>
|
97 |
|
|
{
|
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;
|
100 |
|
|
|
101 |
|
|
inline
|
102 |
|
|
cc_hash_max_collision_check_resize_trigger_t_()
|
103 |
|
|
: base_type(static_cast<float>(Load_Nom) / static_cast<float>(Load_Denom))
|
104 |
|
|
{ }
|
105 |
|
|
|
106 |
|
|
enum
|
107 |
|
|
{
|
108 |
|
|
get_set_load = External_Access,
|
109 |
|
|
get_set_loads = false
|
110 |
|
|
};
|
111 |
|
|
};
|
112 |
|
|
|
113 |
|
|
struct hash_prime_size_policy_t_ : public __gnu_pbds::hash_prime_size_policy
|
114 |
|
|
{ };
|
115 |
|
|
|
116 |
|
|
template<typename _Alloc>
|
117 |
|
|
struct hash_exponential_size_policy_t_
|
118 |
|
|
: public __gnu_pbds::hash_exponential_size_policy<typename _Alloc::size_type>
|
119 |
|
|
{ };
|
120 |
|
|
|
121 |
|
|
template<typename Key, typename _Alloc>
|
122 |
|
|
struct linear_probe_fn_t_
|
123 |
|
|
: public __gnu_pbds::linear_probe_fn<typename _Alloc::size_type>
|
124 |
|
|
{ };
|
125 |
|
|
|
126 |
|
|
template<typename Key, typename _Alloc>
|
127 |
|
|
struct quadratic_probe_fn_t_
|
128 |
|
|
: public __gnu_pbds::quadratic_probe_fn<typename _Alloc::size_type>
|
129 |
|
|
{ };
|
130 |
|
|
|
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>
|
134 |
|
|
{
|
135 |
|
|
typedef __gnu_pbds::lu_counter_policy<Max_Count, _Alloc> base_type;
|
136 |
|
|
};
|
137 |
|
|
|
138 |
|
|
struct lu_move_to_front_policy_t_
|
139 |
|
|
: public __gnu_pbds::lu_move_to_front_policy<>
|
140 |
|
|
{ };
|
141 |
|
|
} // namespace test
|
142 |
|
|
} // namespace __gnu_pbds
|
143 |
|
|
|
144 |
|
|
#endif
|
145 |
|
|
|