42 #ifndef PB_DS_RANGED_PROBE_FN_HPP
43 #define PB_DS_RANGED_PROBE_FN_HPP
53 template<
typename Key,
typename Hash_Fn,
typename _Alloc,
54 typename Comb_Probe_Fn,
typename Probe_Fn,
bool Store_Hash>
57 #define PB_DS_CLASS_T_DEC \
58 template<typename Key, typename Hash_Fn, typename _Alloc, \
59 typename Comb_Probe_Fn, typename Probe_Fn>
61 #define PB_DS_CLASS_C_DEC \
62 ranged_probe_fn<Key, Hash_Fn, _Alloc, Comb_Probe_Fn, Probe_Fn, false>
69 template<
typename Key,
typename Hash_Fn,
typename _Alloc,
70 typename Comb_Probe_Fn,
typename Probe_Fn>
73 :
public Hash_Fn,
public Comb_Probe_Fn,
public Probe_Fn
76 typedef typename _Alloc::size_type size_type;
77 typedef Comb_Probe_Fn comb_probe_fn_base;
78 typedef Hash_Fn hash_fn_base;
79 typedef Probe_Fn probe_fn_base;
80 typedef typename rebind_traits<_Alloc, Key>::const_reference
93 swap(PB_DS_CLASS_C_DEC&);
96 notify_resized(size_type);
99 operator()(key_const_reference)
const;
102 operator()(key_const_reference, size_type, size_type)
const;
107 ranged_probe_fn(size_type size)
108 { Comb_Probe_Fn::notify_resized(size); }
112 ranged_probe_fn(size_type size,
const Hash_Fn& r_hash_fn)
114 { Comb_Probe_Fn::notify_resized(size); }
118 ranged_probe_fn(size_type size,
const Hash_Fn& r_hash_fn,
119 const Comb_Probe_Fn& r_comb_probe_fn)
120 : Hash_Fn(r_hash_fn), Comb_Probe_Fn(r_comb_probe_fn)
121 { comb_probe_fn_base::notify_resized(size); }
125 ranged_probe_fn(size_type size,
const Hash_Fn& r_hash_fn,
126 const Comb_Probe_Fn& r_comb_probe_fn,
127 const Probe_Fn& r_probe_fn)
128 : Hash_Fn(r_hash_fn), Comb_Probe_Fn(r_comb_probe_fn), Probe_Fn(r_probe_fn)
129 { comb_probe_fn_base::notify_resized(size); }
134 swap(PB_DS_CLASS_C_DEC& other)
136 comb_probe_fn_base::swap(other);
137 std::swap((Hash_Fn& )(*
this), (Hash_Fn&)other);
143 notify_resized(size_type size)
144 { comb_probe_fn_base::notify_resized(size); }
147 inline typename PB_DS_CLASS_C_DEC::size_type
149 operator()(key_const_reference r_key)
const
150 {
return comb_probe_fn_base::operator()(hash_fn_base::operator()(r_key)); }
153 inline typename PB_DS_CLASS_C_DEC::size_type
155 operator()(key_const_reference, size_type hash, size_type i)
const
157 return comb_probe_fn_base::operator()(hash + probe_fn_base::operator()(i));
160 #undef PB_DS_CLASS_T_DEC
161 #undef PB_DS_CLASS_C_DEC
163 #define PB_DS_CLASS_T_DEC \
164 template<typename Key, typename Hash_Fn, typename _Alloc, \
165 typename Comb_Probe_Fn, typename Probe_Fn>
167 #define PB_DS_CLASS_C_DEC \
168 ranged_probe_fn<Key, Hash_Fn, _Alloc, Comb_Probe_Fn, Probe_Fn, true>
174 template<
typename Key,
typename Hash_Fn,
typename _Alloc,
175 typename Comb_Probe_Fn,
typename Probe_Fn>
178 :
public Hash_Fn,
public Comb_Probe_Fn,
public Probe_Fn
181 typedef typename _Alloc::size_type size_type;
183 typedef Comb_Probe_Fn comb_probe_fn_base;
184 typedef Hash_Fn hash_fn_base;
185 typedef Probe_Fn probe_fn_base;
186 typedef typename rebind_traits<_Alloc, Key>::const_reference
194 const Comb_Probe_Fn&);
200 swap(PB_DS_CLASS_C_DEC&);
203 notify_resized(size_type);
206 operator()(key_const_reference)
const;
209 operator()(key_const_reference, size_type, size_type)
const;
212 operator()(key_const_reference, size_type)
const;
217 ranged_probe_fn(size_type size)
218 { Comb_Probe_Fn::notify_resized(size); }
222 ranged_probe_fn(size_type size,
const Hash_Fn& r_hash_fn)
224 { Comb_Probe_Fn::notify_resized(size); }
228 ranged_probe_fn(size_type size,
const Hash_Fn& r_hash_fn,
229 const Comb_Probe_Fn& r_comb_probe_fn)
230 : Hash_Fn(r_hash_fn), Comb_Probe_Fn(r_comb_probe_fn)
231 { comb_probe_fn_base::notify_resized(size); }
235 ranged_probe_fn(size_type size,
const Hash_Fn& r_hash_fn,
236 const Comb_Probe_Fn& r_comb_probe_fn,
237 const Probe_Fn& r_probe_fn)
238 : Hash_Fn(r_hash_fn), Comb_Probe_Fn(r_comb_probe_fn), Probe_Fn(r_probe_fn)
239 { comb_probe_fn_base::notify_resized(size); }
244 swap(PB_DS_CLASS_C_DEC& other)
246 comb_probe_fn_base::swap(other);
247 std::swap((Hash_Fn& )(*
this), (Hash_Fn& )other);
253 notify_resized(size_type size)
254 { comb_probe_fn_base::notify_resized(size); }
257 inline typename PB_DS_CLASS_C_DEC::comp_hash
259 operator()(key_const_reference r_key)
const
261 const size_type hash = hash_fn_base::operator()(r_key);
262 return std::make_pair(comb_probe_fn_base::operator()(hash), hash);
266 inline typename PB_DS_CLASS_C_DEC::size_type
268 operator()(key_const_reference, size_type hash, size_type i)
const
270 return comb_probe_fn_base::operator()(hash + probe_fn_base::operator()(i));
274 inline typename PB_DS_CLASS_C_DEC::size_type
277 #ifdef _GLIBCXX_DEBUG
278 (key_const_reference r_key, size_type hash)
const
280 (key_const_reference , size_type hash)
const
283 _GLIBCXX_DEBUG_ASSERT(hash == hash_fn_base::operator()(r_key));
287 #undef PB_DS_CLASS_T_DEC
288 #undef PB_DS_CLASS_C_DEC
295 template<
typename Key,
typename _Alloc,
typename Comb_Probe_Fn>
298 :
public Comb_Probe_Fn
301 typedef typename _Alloc::size_type size_type;
302 typedef Comb_Probe_Fn comb_probe_fn_base;
303 typedef typename rebind_traits<_Alloc, Key>::const_reference
307 { Comb_Probe_Fn::notify_resized(size); }
310 : Comb_Probe_Fn(r_comb_probe_fn)
314 const Comb_Probe_Fn& r_comb_probe_fn,
316 : Comb_Probe_Fn(r_comb_probe_fn)
321 { comb_probe_fn_base::swap(other); }
void swap(any &__x, any &__y) noexcept
Exchange the states of two any objects.
GNU extensions for policy-based data structures for public use.
Struct holding two objects of arbitrary type.
Represents no type, or absence of type, for template tricks.