From 505410a5c3b93f81deda8b9653c2237a433be5c1 Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Thu, 15 Mar 2007 06:57:03 +0000 Subject: This version may break hashing of strings, but at least you can hash FStrings... templates are confusing. --- src/hash.h | 37 ++++++++++++++----------------------- 1 file changed, 14 insertions(+), 23 deletions(-) (limited to 'src/hash.h') diff --git a/src/hash.h b/src/hash.h index 7f1ac65..6671ae6 100644 --- a/src/hash.h +++ b/src/hash.h @@ -18,10 +18,10 @@ enum eHashException }; template -uint32_t __calcHashCode( T k ); +uint32_t __calcHashCode( const T &k ); template -bool __cmpHashKeys( T a, T b ); +bool __cmpHashKeys( const T &a, const T &b ); struct __calcNextTSize_fast { @@ -649,31 +649,22 @@ protected: sizecalc szCalc; }; -template<> uint32_t __calcHashCode( const int k ); -template<> bool __cmpHashKeys( const int a, const int b ); +template<> uint32_t __calcHashCode( const int &k ); +template<> bool __cmpHashKeys( const int &a, const int &b ); -template<> uint32_t __calcHashCode( int k ); -template<> bool __cmpHashKeys( int a, int b ); +template<> uint32_t __calcHashCode( const unsigned int &k ); +template<> bool __cmpHashKeys( const unsigned int &a, const unsigned int &b ); -template<> uint32_t __calcHashCode( const unsigned int k ); -template<> bool __cmpHashKeys( const unsigned int a, const unsigned int b ); +template<> uint32_t __calcHashCode( const char * const &k ); +template<> bool __cmpHashKeys( const char * const &a, const char * const &b ); -template<> uint32_t __calcHashCode( unsigned int k ); -template<> bool __cmpHashKeys( unsigned int a, unsigned int b ); +template<> uint32_t __calcHashCode( char * const &k ); +template<> bool __cmpHashKeys( char * const &a, char * const &b ); -template<> uint32_t __calcHashCode( const char *k ); -template<> bool __cmpHashKeys( const char *a, const char *b ); +template<> uint32_t __calcHashCode( const std::string &k ); +template<> bool __cmpHashKeys( const std::string &a, const std::string &b ); -template<> uint32_t __calcHashCode( char *k ); -template<> bool __cmpHashKeys( char *a, char *b ); - -template<> uint32_t __calcHashCode( const std::string k ); -template<> bool __cmpHashKeys( const std::string a, const std::string b ); - -template<> uint32_t __calcHashCode( std::string k ); -template<> bool __cmpHashKeys( std::string a, std::string b ); - -template<> uint32_t __calcHashCode( Hashable &k ); -template<> bool __cmpHashKeys( Hashable &a, Hashable &b ); +template<> uint32_t __calcHashCode( const Hashable &k ); +template<> bool __cmpHashKeys( const Hashable &a, const Hashable &b ); #endif -- cgit v1.2.3