3 #ifndef GAUDIKERNEL_HASH_H
4 #define GAUDIKERNEL_HASH_H 1
14 #include "boost/functional/hash.hpp"
36 std::size_t len =
sizeof(T) ;
37 const char* p =
reinterpret_cast<const char*
>( &key );
38 while( len-- ) { res = ( res << 1 ) ^ *p; ++p; }
102 inline std::size_t
operator() (
const T& key )
const;
112 inline std::size_t operator() (
const T* key )
const;
117 template <
class T,
unsigned N>
122 inline std::size_t operator() ( T (&key) [
N] )
const
123 {
return boost::hash_range ( key , key + N ) ; }
127 template <
class T,
unsigned N>
132 inline std::size_t operator() (
const T (&key) [
N] )
const
133 {
return boost::hash_range ( key , key + N ) ; }
154 using namespace boost ;
161 using namespace boost ;
168 std::size_t seed = 0 ;
169 while ( key ) { boost::hash_combine ( seed , *key ) ; ++key ; }
178 #endif // GAUDIKERNEL_HASH_H