summaryrefslogtreecommitdiff
path: root/libstdc++-v3/include/ext/pb_ds/detail/hash_fn/ranged_probe_fn.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'libstdc++-v3/include/ext/pb_ds/detail/hash_fn/ranged_probe_fn.hpp')
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/hash_fn/ranged_probe_fn.hpp211
1 files changed, 62 insertions, 149 deletions
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/hash_fn/ranged_probe_fn.hpp b/libstdc++-v3/include/ext/pb_ds/detail/hash_fn/ranged_probe_fn.hpp
index 6fddfeb9d28..d4b834dd34f 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/hash_fn/ranged_probe_fn.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/hash_fn/ranged_probe_fn.hpp
@@ -57,48 +57,29 @@ namespace pb_ds
namespace detail
{
template<typename Key,
- class Hash_Fn,
- class Allocator,
- class Comb_Probe_Fn,
- class Probe_Fn,
+ typename Hash_Fn,
+ typename Allocator,
+ typename Comb_Probe_Fn,
+ typename Probe_Fn,
bool Store_Hash>
class ranged_probe_fn;
-#define PB_DS_CLASS_T_DEC \
- template< \
- typename Key, \
- class Hash_Fn, \
- class Allocator, \
- class Comb_Probe_Fn, \
- class Probe_Fn>
-
-#define PB_DS_CLASS_C_DEC \
- ranged_probe_fn< \
- Key, \
- Hash_Fn, \
- Allocator, \
- Comb_Probe_Fn, \
- Probe_Fn, \
- false>
+#define PB_DS_CLASS_T_DEC \
+ template<typename Key, typename Hash_Fn, typename Allocator, \
+ typename Comb_Probe_Fn, typename Probe_Fn>
+
+#define PB_DS_CLASS_C_DEC \
+ ranged_probe_fn<Key, Hash_Fn, Allocator, Comb_Probe_Fn, Probe_Fn, false>
/**
* Specialization 1- The client supplies a probe function and a ranged
* probe function, and requests that hash values not be stored.
**/
- template<typename Key,
- class Hash_Fn,
- class Allocator,
- class Comb_Probe_Fn,
- class Probe_Fn>
- class ranged_probe_fn<
- Key,
- Hash_Fn,
- Allocator,
- Comb_Probe_Fn,
- Probe_Fn,
- false> : public Hash_Fn,
- public Comb_Probe_Fn,
- public Probe_Fn
+ template<typename Key, typename Hash_Fn, typename Allocator,
+ typename Comb_Probe_Fn, typename Probe_Fn>
+ class ranged_probe_fn<Key, Hash_Fn, Allocator, Comb_Probe_Fn,
+ Probe_Fn, false>
+ : public Hash_Fn, public Comb_Probe_Fn, public Probe_Fn
{
protected:
typedef typename Allocator::size_type size_type;
@@ -138,26 +119,20 @@ namespace pb_ds
PB_DS_CLASS_T_DEC
PB_DS_CLASS_C_DEC::
ranged_probe_fn(size_type size)
- {
- Comb_Probe_Fn::notify_resized(size);
- }
+ { Comb_Probe_Fn::notify_resized(size); }
PB_DS_CLASS_T_DEC
PB_DS_CLASS_C_DEC::
ranged_probe_fn(size_type size, const Hash_Fn& r_hash_fn) :
Hash_Fn(r_hash_fn)
- {
- Comb_Probe_Fn::notify_resized(size);
- }
+ { Comb_Probe_Fn::notify_resized(size); }
PB_DS_CLASS_T_DEC
PB_DS_CLASS_C_DEC::
ranged_probe_fn(size_type size, const Hash_Fn& r_hash_fn, const Comb_Probe_Fn& r_comb_probe_fn) :
Hash_Fn(r_hash_fn),
Comb_Probe_Fn(r_comb_probe_fn)
- {
- comb_probe_fn_base::notify_resized(size);
- }
+ { comb_probe_fn_base::notify_resized(size); }
PB_DS_CLASS_T_DEC
PB_DS_CLASS_C_DEC::
@@ -165,9 +140,7 @@ namespace pb_ds
Hash_Fn(r_hash_fn),
Comb_Probe_Fn(r_comb_probe_fn),
Probe_Fn(r_probe_fn)
- {
- comb_probe_fn_base::notify_resized(size);
- }
+ { comb_probe_fn_base::notify_resized(size); }
PB_DS_CLASS_T_DEC
void
@@ -175,75 +148,48 @@ namespace pb_ds
swap(PB_DS_CLASS_C_DEC& other)
{
comb_probe_fn_base::swap(other);
-
- std::swap((Hash_Fn& )(*this), (Hash_Fn& )other);
+ std::swap((Hash_Fn& )(*this), (Hash_Fn&)other);
}
PB_DS_CLASS_T_DEC
void
PB_DS_CLASS_C_DEC::
notify_resized(size_type size)
- {
- comb_probe_fn_base::notify_resized(size);
- }
+ { comb_probe_fn_base::notify_resized(size); }
PB_DS_CLASS_T_DEC
inline typename PB_DS_CLASS_C_DEC::size_type
PB_DS_CLASS_C_DEC::
operator()(const_key_reference r_key) const
- {
- return (comb_probe_fn_base::operator()(
- hash_fn_base::operator()(r_key)));
- }
+ { return comb_probe_fn_base::operator()(hash_fn_base::operator()(r_key)); }
PB_DS_CLASS_T_DEC
inline typename PB_DS_CLASS_C_DEC::size_type
PB_DS_CLASS_C_DEC::
- operator()(const_key_reference /*r_key*/, size_type hash, size_type i) const
+ operator()(const_key_reference, size_type hash, size_type i) const
{
- return (comb_probe_fn_base::operator()(
- hash + probe_fn_base::operator()(i)));
+ return comb_probe_fn_base::operator()(hash + probe_fn_base::operator()(i));
}
#undef PB_DS_CLASS_T_DEC
#undef PB_DS_CLASS_C_DEC
-#define PB_DS_CLASS_T_DEC \
- template< \
- typename Key, \
- class Hash_Fn, \
- class Allocator, \
- class Comb_Probe_Fn, \
- class Probe_Fn>
-
-#define PB_DS_CLASS_C_DEC \
- ranged_probe_fn< \
- Key, \
- Hash_Fn, \
- Allocator, \
- Comb_Probe_Fn, \
- Probe_Fn, \
- true>
+#define PB_DS_CLASS_T_DEC \
+ template<typename Key, class Hash_Fn, class Allocator, \
+ class Comb_Probe_Fn, class Probe_Fn>
+
+#define PB_DS_CLASS_C_DEC \
+ ranged_probe_fn<Key, Hash_Fn, Allocator, Comb_Probe_Fn, Probe_Fn, true>
/**
* Specialization 2- The client supplies a probe function and a ranged
* probe function, and requests that hash values not be stored.
**/
- template<typename Key,
- class Hash_Fn,
- class Allocator,
- class Comb_Probe_Fn,
- class Probe_Fn>
- class ranged_probe_fn<
- Key,
- Hash_Fn,
- Allocator,
- Comb_Probe_Fn,
- Probe_Fn,
- true> :
- public Hash_Fn,
- public Comb_Probe_Fn,
- public Probe_Fn
+ template<typename Key, typename Hash_Fn, typename Allocator,
+ typename Comb_Probe_Fn, typename Probe_Fn>
+ class ranged_probe_fn<Key, Hash_Fn, Allocator, Comb_Probe_Fn,
+ Probe_Fn, true>
+ : public Hash_Fn, public Comb_Probe_Fn, public Probe_Fn
{
protected:
typedef typename Allocator::size_type size_type;
@@ -260,14 +206,16 @@ namespace pb_ds
typedef typename key_allocator::const_reference const_key_reference;
- protected:
ranged_probe_fn(size_type size);
ranged_probe_fn(size_type size, const Hash_Fn& r_hash_fn);
- ranged_probe_fn(size_type size, const Hash_Fn& r_hash_fn, const Comb_Probe_Fn& r_comb_probe_fn);
+ ranged_probe_fn(size_type size, const Hash_Fn& r_hash_fn,
+ const Comb_Probe_Fn& r_comb_probe_fn);
- ranged_probe_fn(size_type size, const Hash_Fn& r_hash_fn, const Comb_Probe_Fn& r_comb_probe_fn, const Probe_Fn& r_probe_fn);
+ ranged_probe_fn(size_type size, const Hash_Fn& r_hash_fn,
+ const Comb_Probe_Fn& r_comb_probe_fn,
+ const Probe_Fn& r_probe_fn);
void
swap(PB_DS_CLASS_C_DEC& other);
@@ -298,14 +246,17 @@ namespace pb_ds
PB_DS_CLASS_T_DEC
PB_DS_CLASS_C_DEC::
- ranged_probe_fn(size_type size, const Hash_Fn& r_hash_fn, const Comb_Probe_Fn& r_comb_probe_fn) :
+ ranged_probe_fn(size_type size, const Hash_Fn& r_hash_fn,
+ const Comb_Probe_Fn& r_comb_probe_fn) :
Hash_Fn(r_hash_fn),
Comb_Probe_Fn(r_comb_probe_fn)
{ comb_probe_fn_base::notify_resized(size); }
PB_DS_CLASS_T_DEC
PB_DS_CLASS_C_DEC::
- ranged_probe_fn(size_type size, const Hash_Fn& r_hash_fn, const Comb_Probe_Fn& r_comb_probe_fn, const Probe_Fn& r_probe_fn) :
+ ranged_probe_fn(size_type size, const Hash_Fn& r_hash_fn,
+ const Comb_Probe_Fn& r_comb_probe_fn,
+ const Probe_Fn& r_probe_fn) :
Hash_Fn(r_hash_fn),
Comb_Probe_Fn(r_comb_probe_fn),
Probe_Fn(r_probe_fn)
@@ -338,7 +289,7 @@ namespace pb_ds
PB_DS_CLASS_T_DEC
inline typename PB_DS_CLASS_C_DEC::size_type
PB_DS_CLASS_C_DEC::
- operator()(const_key_reference /*r_key*/, size_type hash, size_type i) const
+ operator()(const_key_reference, size_type hash, size_type i) const
{
return comb_probe_fn_base::operator()(hash + probe_fn_base::operator()(i));
}
@@ -360,33 +311,14 @@ namespace pb_ds
#undef PB_DS_CLASS_T_DEC
#undef PB_DS_CLASS_C_DEC
-#define PB_DS_CLASS_T_DEC \
- template<typename Key, class Allocator, class Comb_Probe_Fn>
-
-#define PB_DS_CLASS_C_DEC \
- ranged_probe_fn< \
- Key, \
- null_hash_fn, \
- Allocator, \
- Comb_Probe_Fn, \
- null_probe_fn, \
- false>
-
/**
* Specialization 3 and 4- The client does not supply a hash function or
* probe function, and requests that hash values not be stored.
**/
- template<typename Key, class Allocator, class Comb_Probe_Fn>
- class ranged_probe_fn<
- Key,
- null_hash_fn,
- Allocator,
- Comb_Probe_Fn,
- null_probe_fn,
- false> :
- public Comb_Probe_Fn,
- public null_hash_fn,
- public null_probe_fn
+ template<typename Key, typename Allocator, typename Comb_Probe_Fn>
+ class ranged_probe_fn<Key, null_hash_fn, Allocator, Comb_Probe_Fn,
+ null_probe_fn, false>
+ : public Comb_Probe_Fn, public null_hash_fn, public null_probe_fn
{
protected:
typedef typename Allocator::size_type size_type;
@@ -397,42 +329,23 @@ namespace pb_ds
typedef typename key_allocator::const_reference const_key_reference;
- protected:
- ranged_probe_fn(size_type size);
+ ranged_probe_fn(size_type size)
+ { Comb_Probe_Fn::notify_resized(size); }
- ranged_probe_fn(size_type size, const Comb_Probe_Fn& r_comb_probe_fn);
+ ranged_probe_fn(size_type size, const Comb_Probe_Fn& r_comb_probe_fn)
+ : Comb_Probe_Fn(r_comb_probe_fn)
+ { }
- ranged_probe_fn(size_type size, const null_hash_fn& r_null_hash_fn, const Comb_Probe_Fn& r_comb_probe_fn, const null_probe_fn& r_null_probe_fn);
+ ranged_probe_fn(size_type size, const null_hash_fn& r_null_hash_fn,
+ const Comb_Probe_Fn& r_comb_probe_fn,
+ const null_probe_fn& r_null_probe_fn)
+ : Comb_Probe_Fn(r_comb_probe_fn)
+ { }
void
- swap(PB_DS_CLASS_C_DEC& other);
+ swap(ranged_probe_fn& other)
+ { comb_probe_fn_base::swap(other); }
};
-
- PB_DS_CLASS_T_DEC
- PB_DS_CLASS_C_DEC::
- ranged_probe_fn(size_type size)
- { Comb_Probe_Fn::notify_resized(size); }
-
- PB_DS_CLASS_T_DEC
- PB_DS_CLASS_C_DEC::
- ranged_probe_fn(size_type size, const Comb_Probe_Fn& r_comb_probe_fn) :
- Comb_Probe_Fn(r_comb_probe_fn)
- { }
-
- PB_DS_CLASS_T_DEC
- PB_DS_CLASS_C_DEC::
- ranged_probe_fn(size_type size, const null_hash_fn& r_null_hash_fn, const Comb_Probe_Fn& r_comb_probe_fn, const null_probe_fn& r_null_probe_fn) :
- Comb_Probe_Fn(r_comb_probe_fn)
- { }
-
- PB_DS_CLASS_T_DEC
- void
- PB_DS_CLASS_C_DEC::
- swap(PB_DS_CLASS_C_DEC& other)
- { comb_probe_fn_base::swap(other); }
-
-#undef PB_DS_CLASS_T_DEC
-#undef PB_DS_CLASS_C_DEC
} // namespace detail
} // namespace pb_ds