libmoost
moost::algorithm::modulo_partitioner< T > Class Template Reference

modulo_partitioner hashes the key then modulos the result against the number of buckets. This results in an even spread given a reasonable hasher. More...

#include <modulo_partitioner.hpp>

Inheritance diagram for moost::algorithm::modulo_partitioner< T >:
Collaboration diagram for moost::algorithm::modulo_partitioner< T >:

List of all members.

Public Member Functions

 basic_partitioner (size_t num_buckets)
size_t partition (const T &key) const
 return a bucket for the given key

Private Attributes

boost::hash< T > m_hasher

Detailed Description

template<typename T>
class moost::algorithm::modulo_partitioner< T >

modulo_partitioner hashes the key then modulos the result against the number of buckets. This results in an even spread given a reasonable hasher.

Definition at line 39 of file modulo_partitioner.hpp.


Member Function Documentation

template<typename T >
moost::algorithm::modulo_partitioner< T >::basic_partitioner ( size_t  num_buckets) [inline]

constructs a basic_partitioner

Parameters:
num_bucketsthe number of buckets to partition into.

Definition at line 49 of file modulo_partitioner.hpp.

template<typename T >
size_t moost::algorithm::modulo_partitioner< T >::partition ( const T &  key) const [inline, virtual]

return a bucket for the given key

Implements moost::algorithm::partitioner< T >.

Definition at line 55 of file modulo_partitioner.hpp.


Member Data Documentation

template<typename T >
boost::hash<T> moost::algorithm::modulo_partitioner< T >::m_hasher [private]

Definition at line 43 of file modulo_partitioner.hpp.


The documentation for this class was generated from the following file: