]> git.ipfire.org Git - thirdparty/gcc.git/blame - libstdc++-v3/testsuite/util/common_type/assoc/template_policy.hpp
Update copyright years.
[thirdparty/gcc.git] / libstdc++-v3 / testsuite / util / common_type / assoc / template_policy.hpp
CommitLineData
4569a895
AT
1// -*- C++ -*-
2
99dee823 3// Copyright (C) 2005-2021 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 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
d7f245b1 40#include <ext/typelist.h>
4569a895
AT
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
5e11f978 45namespace __gnu_pbds
4569a895 46{
4569a895
AT
47 namespace test
48 {
a345e45d 49 template<typename _Alloc>
f92ab29f 50 struct direct_mask_range_hashing_t_
a345e45d 51 : public __gnu_pbds::direct_mask_range_hashing<typename _Alloc::size_type>
4569a895 52 {
a345e45d 53 typedef typename _Alloc::size_type size_type;
5e11f978 54 typedef __gnu_pbds::direct_mask_range_hashing<size_type> base_type;
4569a895
AT
55 };
56
a345e45d 57 template<typename _Alloc>
f92ab29f 58 struct direct_mod_range_hashing_t_
a345e45d 59 : public __gnu_pbds::direct_mod_range_hashing<typename _Alloc::size_type>
4569a895 60 {
a345e45d 61 typedef typename _Alloc::size_type size_type;
5e11f978 62 typedef __gnu_pbds::direct_mod_range_hashing<size_type> base_type;
4569a895
AT
63 };
64
a345e45d
BK
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,
4569a895 70 bool External_Access>
f92ab29f 71 struct hash_load_check_resize_trigger_t_
5e11f978 72 : public __gnu_pbds::hash_load_check_resize_trigger<External_Access,
a345e45d 73 typename _Alloc::size_type>
4569a895 74 {
a345e45d 75 typedef typename _Alloc::size_type size_type;
5e11f978 76 typedef __gnu_pbds::hash_load_check_resize_trigger<External_Access, size_type> base_type;
4569a895
AT
77
78 inline
f92ab29f 79 hash_load_check_resize_trigger_t_()
3441f106 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))
4569a895
AT
81 { }
82
83 enum
84 {
85 get_set_loads = External_Access,
86 get_set_load = false
87 };
88 };
89
a345e45d
BK
90 template<typename _Alloc,
91 typename _Alloc::size_type Load_Nom,
92 typename _Alloc::size_type Load_Denom,
4569a895 93 bool External_Access>
f92ab29f 94 struct cc_hash_max_collision_check_resize_trigger_t_
5e11f978 95 : public __gnu_pbds::cc_hash_max_collision_check_resize_trigger<External_Access,
a345e45d 96 typename _Alloc::size_type>
4569a895 97 {
a345e45d 98 typedef typename _Alloc::size_type size_type;
5e11f978 99 typedef __gnu_pbds::cc_hash_max_collision_check_resize_trigger<External_Access, size_type> base_type;
4569a895
AT
100
101 inline
f92ab29f 102 cc_hash_max_collision_check_resize_trigger_t_()
3441f106 103 : base_type(static_cast<float>(Load_Nom) / static_cast<float>(Load_Denom))
4569a895
AT
104 { }
105
106 enum
107 {
108 get_set_load = External_Access,
109 get_set_loads = false
110 };
111 };
112
5e11f978 113 struct hash_prime_size_policy_t_ : public __gnu_pbds::hash_prime_size_policy
4569a895
AT
114 { };
115
a345e45d 116 template<typename _Alloc>
f92ab29f 117 struct hash_exponential_size_policy_t_
a345e45d 118 : public __gnu_pbds::hash_exponential_size_policy<typename _Alloc::size_type>
3441f106 119 { };
4569a895 120
a345e45d 121 template<typename Key, typename _Alloc>
f92ab29f 122 struct linear_probe_fn_t_
a345e45d 123 : public __gnu_pbds::linear_probe_fn<typename _Alloc::size_type>
4569a895
AT
124 { };
125
a345e45d 126 template<typename Key, typename _Alloc>
f92ab29f 127 struct quadratic_probe_fn_t_
a345e45d 128 : public __gnu_pbds::quadratic_probe_fn<typename _Alloc::size_type>
4569a895
AT
129 { };
130
a345e45d 131 template<typename _Alloc, typename _Alloc::size_type Max_Count>
f92ab29f 132 struct lu_counter_policy_t_
a345e45d 133 : public __gnu_pbds::lu_counter_policy<Max_Count, _Alloc>
4569a895 134 {
a345e45d 135 typedef __gnu_pbds::lu_counter_policy<Max_Count, _Alloc> base_type;
4569a895
AT
136 };
137
f92ab29f 138 struct lu_move_to_front_policy_t_
a345e45d 139 : public __gnu_pbds::lu_move_to_front_policy<>
4569a895 140 { };
4569a895 141 } // namespace test
5e11f978 142} // namespace __gnu_pbds
4569a895 143
f92ab29f 144#endif
4569a895 145