42 #ifndef PB_DS_RANGED_HASH_FN_HPP 43 #define PB_DS_RANGED_HASH_FN_HPP 53 template<
typename Key,
typename Hash_Fn,
typename _Alloc,
54 typename Comb_Hash_Fn,
bool Store_Hash>
57 #define PB_DS_CLASS_T_DEC \ 58 template<typename Key, typename Hash_Fn, typename _Alloc, \ 59 typename Comb_Hash_Fn> 61 #define PB_DS_CLASS_C_DEC \ 62 ranged_hash_fn<Key, Hash_Fn, _Alloc, Comb_Hash_Fn, false> 69 template<
typename Key,
typename Hash_Fn,
typename _Alloc,
70 typename Comb_Hash_Fn>
72 :
public Hash_Fn,
public Comb_Hash_Fn
75 typedef typename _Alloc::size_type size_type;
76 typedef Hash_Fn hash_fn_base;
77 typedef Comb_Hash_Fn comb_hash_fn_base;
78 typedef typename _Alloc::template rebind< Key>::other key_allocator;
79 typedef typename key_allocator::const_reference key_const_reference;
88 swap(PB_DS_CLASS_C_DEC&);
91 notify_resized(size_type);
94 operator()(key_const_reference)
const;
99 ranged_hash_fn(size_type size)
100 { Comb_Hash_Fn::notify_resized(size); }
104 ranged_hash_fn(size_type size,
const Hash_Fn& r_hash_fn)
106 { Comb_Hash_Fn::notify_resized(size); }
110 ranged_hash_fn(size_type size,
const Hash_Fn& r_hash_fn,
111 const Comb_Hash_Fn& r_comb_hash_fn)
112 : Hash_Fn(r_hash_fn), Comb_Hash_Fn(r_comb_hash_fn)
113 { comb_hash_fn_base::notify_resized(size); }
118 swap(PB_DS_CLASS_C_DEC& other)
120 comb_hash_fn_base::swap(other);
121 std::swap((Hash_Fn& )(*
this), (Hash_Fn& )other);
127 notify_resized(size_type size)
128 { comb_hash_fn_base::notify_resized(size); }
131 inline typename PB_DS_CLASS_C_DEC::size_type
133 operator()(key_const_reference r_key)
const 134 {
return (comb_hash_fn_base::operator()(hash_fn_base::operator()(r_key)));}
136 #undef PB_DS_CLASS_T_DEC 137 #undef PB_DS_CLASS_C_DEC 139 #define PB_DS_CLASS_T_DEC \ 140 template<typename Key, typename Hash_Fn, typename _Alloc, \ 141 typename Comb_Hash_Fn> 143 #define PB_DS_CLASS_C_DEC \ 144 ranged_hash_fn<Key,Hash_Fn, _Alloc, Comb_Hash_Fn, true> 151 template<
typename Key,
typename Hash_Fn,
typename _Alloc,
152 typename Comb_Hash_Fn>
154 :
public Hash_Fn,
public Comb_Hash_Fn
157 typedef typename _Alloc::size_type size_type;
159 typedef Hash_Fn hash_fn_base;
160 typedef Comb_Hash_Fn comb_hash_fn_base;
161 typedef typename _Alloc::template rebind<Key>::other key_allocator;
162 typedef typename key_allocator::const_reference key_const_reference;
171 swap(PB_DS_CLASS_C_DEC&);
174 notify_resized(size_type);
177 operator()(key_const_reference)
const;
180 operator()(key_const_reference, size_type)
const;
185 ranged_hash_fn(size_type size)
186 { Comb_Hash_Fn::notify_resized(size); }
190 ranged_hash_fn(size_type size,
const Hash_Fn& r_hash_fn) :
192 { Comb_Hash_Fn::notify_resized(size); }
196 ranged_hash_fn(size_type size,
const Hash_Fn& r_hash_fn,
197 const Comb_Hash_Fn& r_comb_hash_fn)
198 : Hash_Fn(r_hash_fn), Comb_Hash_Fn(r_comb_hash_fn)
199 { comb_hash_fn_base::notify_resized(size); }
204 swap(PB_DS_CLASS_C_DEC& other)
206 comb_hash_fn_base::swap(other);
207 std::swap((Hash_Fn& )(*
this), (Hash_Fn& )other);
213 notify_resized(size_type size)
214 { comb_hash_fn_base::notify_resized(size); }
217 inline typename PB_DS_CLASS_C_DEC::comp_hash
219 operator()(key_const_reference r_key)
const 221 const size_type hash = hash_fn_base::operator()(r_key);
226 inline typename PB_DS_CLASS_C_DEC::comp_hash
229 #ifdef _GLIBCXX_DEBUG 230 (key_const_reference r_key, size_type hash)
const 232 (key_const_reference , size_type hash)
const 235 _GLIBCXX_DEBUG_ASSERT(hash == hash_fn_base::operator()(r_key));
239 #undef PB_DS_CLASS_T_DEC 240 #undef PB_DS_CLASS_C_DEC 242 #define PB_DS_CLASS_T_DEC \ 243 template<typename Key, typename _Alloc, typename Comb_Hash_Fn> 245 #define PB_DS_CLASS_C_DEC \ 246 ranged_hash_fn<Key, null_type, _Alloc, Comb_Hash_Fn, false> 254 template<
typename Key,
typename _Alloc,
typename Comb_Hash_Fn>
256 :
public Comb_Hash_Fn
259 typedef typename _Alloc::size_type size_type;
260 typedef Comb_Hash_Fn comb_hash_fn_base;
269 swap(PB_DS_CLASS_C_DEC&);
274 ranged_hash_fn(size_type size)
275 { Comb_Hash_Fn::notify_resized(size); }
279 ranged_hash_fn(size_type size,
const Comb_Hash_Fn& r_comb_hash_fn) :
280 Comb_Hash_Fn(r_comb_hash_fn)
285 ranged_hash_fn(size_type size,
const null_type& r_null_type,
286 const Comb_Hash_Fn& r_comb_hash_fn)
287 : Comb_Hash_Fn(r_comb_hash_fn)
293 swap(PB_DS_CLASS_C_DEC& other)
294 { comb_hash_fn_base::swap(other); }
296 #undef PB_DS_CLASS_T_DEC 297 #undef PB_DS_CLASS_C_DEC 299 #define PB_DS_CLASS_T_DEC \ 300 template<typename Key, typename _Alloc, typename Comb_Hash_Fn> 302 #define PB_DS_CLASS_C_DEC \ 303 ranged_hash_fn<Key, null_type, _Alloc, Comb_Hash_Fn, true> 311 template<
typename Key,
typename _Alloc,
typename Comb_Hash_Fn>
313 :
public Comb_Hash_Fn
316 typedef typename _Alloc::size_type size_type;
317 typedef Comb_Hash_Fn comb_hash_fn_base;
326 swap(PB_DS_CLASS_C_DEC&);
331 ranged_hash_fn(size_type size)
332 { Comb_Hash_Fn::notify_resized(size); }
336 ranged_hash_fn(size_type size,
const Comb_Hash_Fn& r_comb_hash_fn)
337 : Comb_Hash_Fn(r_comb_hash_fn)
342 ranged_hash_fn(size_type size,
const null_type& r_null_type,
343 const Comb_Hash_Fn& r_comb_hash_fn)
344 : Comb_Hash_Fn(r_comb_hash_fn)
350 swap(PB_DS_CLASS_C_DEC& other)
351 { comb_hash_fn_base::swap(other); }
353 #undef PB_DS_CLASS_T_DEC 354 #undef PB_DS_CLASS_C_DEC Struct holding two objects of arbitrary type.
GNU extensions for policy-based data structures for public use.
constexpr pair< typename __decay_and_strip< _T1 >::__type, typename __decay_and_strip< _T2 >::__type > make_pair(_T1 &&__x, _T2 &&__y)
A convenience wrapper for creating a pair from two objects.
Represents no type, or absence of type, for template tricks.