The Gaudi Framework
v30r3 (a5ef0a68)
|
Simple hash function. More...
#include <GaudiKernel/Hash.h>
Public Member Functions | |
std::size_t | operator() (const T &key) const |
the hash-function More... | |
template<> | |
size_t | operator() (const GaudiAlg::ID &key) const |
Hash-function for class GaudiAlg::ID. More... | |
template<> | |
std::size_t | operator() (const char *key) const |
(very)specific for C-strings More... | |
Simple hash function.
The default implementation is based on boost::hash
The usage requires to provide the specialization The default specialization are provided by boost::bash_value for
To provide own specialization for type TYPE or TYPE* there are four ways:
The first and the last ways are recommended. The second way can be needed if e.g. TYPE has non trivial properties, e.g. one need to use non-const or non-ref forms of hashing value For the last way the function must reside in the same namespace, where TYPE is defines, therefore if TYPE is in a global namespace it is better to avoid this way. The most natural place for this function is a "friend function" of the class. In this way it can have access to some useful internals of the class. However this is a bit intrusive way. The third way is not recommended, since sooner or later we'll need to migrate from boost::hash to std::tr1::hash.
Comparing the previous Gaudi implementation of GaudiUtils::Hash and boost::bash specializations, one can expect:
Probably the first two items are compensated by better "hashing"-performance
|
inline |
the hash-function
the generic implementations of hash-function
Definition at line 147 of file Hash.h.
|
inline |
Hash-function for class GaudiAlg::ID.
Definition at line 145 of file GaudiHistoID.h.
|
inline |