diff options
author | Mike Buland <eichlan@xagasoft.com> | 2007-03-15 06:57:03 +0000 |
---|---|---|
committer | Mike Buland <eichlan@xagasoft.com> | 2007-03-15 06:57:03 +0000 |
commit | 505410a5c3b93f81deda8b9653c2237a433be5c1 (patch) | |
tree | e4ac25af48878cdf466571a3d70577de9d3f890a /src/hash.h | |
parent | cf847cc534a2a7ad06750c446028b7c6d126fe21 (diff) | |
download | libbu++-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 'src/hash.h')
-rw-r--r-- | src/hash.h | 37 |
1 files changed, 14 insertions, 23 deletions
@@ -18,10 +18,10 @@ enum eHashException | |||
18 | }; | 18 | }; |
19 | 19 | ||
20 | template<typename T> | 20 | template<typename T> |
21 | uint32_t __calcHashCode( T k ); | 21 | uint32_t __calcHashCode( const T &k ); |
22 | 22 | ||
23 | template<typename T> | 23 | template<typename T> |
24 | bool __cmpHashKeys( T a, T b ); | 24 | bool __cmpHashKeys( const T &a, const T &b ); |
25 | 25 | ||
26 | struct __calcNextTSize_fast | 26 | struct __calcNextTSize_fast |
27 | { | 27 | { |
@@ -649,31 +649,22 @@ protected: | |||
649 | sizecalc szCalc; | 649 | sizecalc szCalc; |
650 | }; | 650 | }; |
651 | 651 | ||
652 | template<> uint32_t __calcHashCode<const int>( const int k ); | 652 | template<> uint32_t __calcHashCode<int>( const int &k ); |
653 | template<> bool __cmpHashKeys<const int>( const int a, const int b ); | 653 | template<> bool __cmpHashKeys<int>( const int &a, const int &b ); |
654 | 654 | ||
655 | template<> uint32_t __calcHashCode<int>( int k ); | 655 | template<> uint32_t __calcHashCode<unsigned int>( const unsigned int &k ); |
656 | template<> bool __cmpHashKeys<int>( int a, int b ); | 656 | template<> bool __cmpHashKeys<unsigned int>( const unsigned int &a, const unsigned int &b ); |
657 | 657 | ||
658 | template<> uint32_t __calcHashCode<const unsigned int>( const unsigned int k ); | 658 | template<> uint32_t __calcHashCode<const char *>( const char * const &k ); |
659 | template<> bool __cmpHashKeys<const unsigned int>( const unsigned int a, const unsigned int b ); | 659 | template<> bool __cmpHashKeys<const char *>( const char * const &a, const char * const &b ); |
660 | 660 | ||
661 | template<> uint32_t __calcHashCode<unsigned int>( unsigned int k ); | 661 | template<> uint32_t __calcHashCode<char *>( char * const &k ); |
662 | template<> bool __cmpHashKeys<unsigned int>( unsigned int a, unsigned int b ); | 662 | template<> bool __cmpHashKeys<char *>( char * const &a, char * const &b ); |
663 | 663 | ||
664 | template<> uint32_t __calcHashCode<const char *>( const char *k ); | 664 | template<> uint32_t __calcHashCode<std::string>( const std::string &k ); |
665 | template<> bool __cmpHashKeys<const char *>( const char *a, const char *b ); | 665 | template<> bool __cmpHashKeys<std::string>( const std::string &a, const std::string &b ); |
666 | 666 | ||
667 | template<> uint32_t __calcHashCode<char *>( char *k ); | 667 | template<> uint32_t __calcHashCode<Hashable>( const Hashable &k ); |
668 | template<> bool __cmpHashKeys<char *>( char *a, char *b ); | 668 | template<> bool __cmpHashKeys<Hashable>( const Hashable &a, const Hashable &b ); |
669 | |||
670 | template<> uint32_t __calcHashCode<const std::string>( const std::string k ); | ||
671 | template<> bool __cmpHashKeys<const std::string>( const std::string a, const std::string b ); | ||
672 | |||
673 | template<> uint32_t __calcHashCode<std::string>( std::string k ); | ||
674 | template<> bool __cmpHashKeys<std::string>( std::string a, std::string b ); | ||
675 | |||
676 | template<> uint32_t __calcHashCode<Hashable &>( Hashable &k ); | ||
677 | template<> bool __cmpHashKeys<Hashable &>( Hashable &a, Hashable &b ); | ||
678 | 669 | ||
679 | #endif | 670 | #endif |