42 #ifndef PB_DS_HASH_EQ_FN_HPP
43 #define PB_DS_HASH_EQ_FN_HPP
53 template<
typename Key,
typename Eq_Fn,
typename _Alloc,
bool Store_Hash>
57 template<
typename Key,
typename Eq_Fn,
typename _Alloc>
58 struct hash_eq_fn<Key, Eq_Fn, _Alloc, false> :
public Eq_Fn
60 typedef Eq_Fn eq_fn_base;
61 typedef typename _Alloc::template rebind<Key>::other key_allocator;
62 typedef typename key_allocator::const_reference key_const_reference;
66 hash_eq_fn(
const Eq_Fn& r_eq_fn) : Eq_Fn(r_eq_fn) { }
69 operator()(key_const_reference r_lhs_key,
70 key_const_reference r_rhs_key)
const
71 {
return eq_fn_base::operator()(r_lhs_key, r_rhs_key); }
75 {
std::swap((Eq_Fn&)(*
this), (Eq_Fn&)other); }
80 template<
typename Key,
class Eq_Fn,
class _Alloc>
81 struct hash_eq_fn<Key, Eq_Fn, _Alloc, true> :
public Eq_Fn
83 typedef typename _Alloc::size_type size_type;
84 typedef Eq_Fn eq_fn_base;
85 typedef typename _Alloc::template rebind<Key>::other key_allocator;
86 typedef typename key_allocator::const_reference key_const_reference;
90 hash_eq_fn(
const Eq_Fn& r_eq_fn) : Eq_Fn(r_eq_fn) { }
93 operator()(key_const_reference r_lhs_key, size_type lhs_hash,
94 key_const_reference r_rhs_key, size_type rhs_hash)
const
96 _GLIBCXX_DEBUG_ASSERT(!eq_fn_base::operator()(r_lhs_key, r_rhs_key)
97 || lhs_hash == rhs_hash);
99 return (lhs_hash == rhs_hash &&
100 eq_fn_base::operator()(r_lhs_key, r_rhs_key));
105 {
std::swap((Eq_Fn&)(*
this), (Eq_Fn&)(other)); }
void swap(function< _Res(_Args...)> &__x, function< _Res(_Args...)> &__y)
Swap the targets of two polymorphic function object wrappers.