16#include <boost/functional/hash.hpp>
34 const char* p =
reinterpret_cast<const char*
>( &key );
35 return std::accumulate( p, p +
sizeof( T ), std::size_t{ 0 },
36 []( std::size_t res,
const char& c ) {
return ( res << 1 ) ^ c; } );
101 inline std::size_t
operator()(
const T* key )
const;
104 template <
class T,
unsigned N>
107 inline std::size_t
operator()( T ( &key )[N] )
const {
return boost::hash_range( key, key + N ); }
110 template <
class T,
unsigned N>
111 struct Hash<const T ( & )[N]> {
113 inline std::size_t
operator()(
const T ( &key )[N] )
const {
return boost::hash_range( key, key + N ); }
130 using namespace boost;
131 return hash_value( key );
136 using namespace boost;
137 return hash_value( key );
142 std::size_t seed = 0;
144 boost::hash_combine( seed, *key );
Generic hash implementation (for easy migration to the new Hash class).
std::size_t operator()(const T &key) const
the generic hash function
std::size_t operator()(const T *key) const
the hash-function
std::size_t operator()(T(&key)[N]) const
the hash-function
std::size_t operator()(const T(&key)[N]) const
the hash-function
std::size_t operator()(const T &key) const
the hash-function