aboutsummaryrefslogtreecommitdiff
path: root/src/hash.h
diff options
context:
space:
mode:
authorMike Buland <eichlan@xagasoft.com>2007-03-15 06:57:03 +0000
committerMike Buland <eichlan@xagasoft.com>2007-03-15 06:57:03 +0000
commit505410a5c3b93f81deda8b9653c2237a433be5c1 (patch)
treee4ac25af48878cdf466571a3d70577de9d3f890a /src/hash.h
parentcf847cc534a2a7ad06750c446028b7c6d126fe21 (diff)
downloadlibbu++-505410a5c3b93f81deda8b9653c2237a433be5c1.tar.gz
libbu++-505410a5c3b93f81deda8b9653c2237a433be5c1.tar.bz2
libbu++-505410a5c3b93f81deda8b9653c2237a433be5c1.tar.xz
libbu++-505410a5c3b93f81deda8b9653c2237a433be5c1.zip
This version may break hashing of strings, but at least you can hash FStrings...
templates are confusing.
Diffstat (limited to '')
-rw-r--r--src/hash.h37
1 files changed, 14 insertions, 23 deletions
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
18}; 18};
19 19
20template<typename T> 20template<typename T>
21uint32_t __calcHashCode( T k ); 21uint32_t __calcHashCode( const T &k );
22 22
23template<typename T> 23template<typename T>
24bool __cmpHashKeys( T a, T b ); 24bool __cmpHashKeys( const T &a, const T &b );
25 25
26struct __calcNextTSize_fast 26struct __calcNextTSize_fast
27{ 27{
@@ -649,31 +649,22 @@ protected:
649 sizecalc szCalc; 649 sizecalc szCalc;
650}; 650};
651 651
652template<> uint32_t __calcHashCode<const int>( const int k ); 652template<> uint32_t __calcHashCode<int>( const int &k );
653template<> bool __cmpHashKeys<const int>( const int a, const int b ); 653template<> bool __cmpHashKeys<int>( const int &a, const int &b );
654 654
655template<> uint32_t __calcHashCode<int>( int k ); 655template<> uint32_t __calcHashCode<unsigned int>( const unsigned int &k );
656template<> bool __cmpHashKeys<int>( int a, int b ); 656template<> bool __cmpHashKeys<unsigned int>( const unsigned int &a, const unsigned int &b );
657 657
658template<> uint32_t __calcHashCode<const unsigned int>( const unsigned int k ); 658template<> uint32_t __calcHashCode<const char *>( const char * const &k );
659template<> bool __cmpHashKeys<const unsigned int>( const unsigned int a, const unsigned int b ); 659template<> bool __cmpHashKeys<const char *>( const char * const &a, const char * const &b );
660 660
661template<> uint32_t __calcHashCode<unsigned int>( unsigned int k ); 661template<> uint32_t __calcHashCode<char *>( char * const &k );
662template<> bool __cmpHashKeys<unsigned int>( unsigned int a, unsigned int b ); 662template<> bool __cmpHashKeys<char *>( char * const &a, char * const &b );
663 663
664template<> uint32_t __calcHashCode<const char *>( const char *k ); 664template<> uint32_t __calcHashCode<std::string>( const std::string &k );
665template<> bool __cmpHashKeys<const char *>( const char *a, const char *b ); 665template<> bool __cmpHashKeys<std::string>( const std::string &a, const std::string &b );
666 666
667template<> uint32_t __calcHashCode<char *>( char *k ); 667template<> uint32_t __calcHashCode<Hashable>( const Hashable &k );
668template<> bool __cmpHashKeys<char *>( char *a, char *b ); 668template<> bool __cmpHashKeys<Hashable>( const Hashable &a, const Hashable &b );
669
670template<> uint32_t __calcHashCode<const std::string>( const std::string k );
671template<> bool __cmpHashKeys<const std::string>( const std::string a, const std::string b );
672
673template<> uint32_t __calcHashCode<std::string>( std::string k );
674template<> bool __cmpHashKeys<std::string>( std::string a, std::string b );
675
676template<> uint32_t __calcHashCode<Hashable &>( Hashable &k );
677template<> bool __cmpHashKeys<Hashable &>( Hashable &a, Hashable &b );
678 669
679#endif 670#endif