diff options
author | Attila Molnar <attilamolnar@hush.com> | 2013-04-01 09:50:50 -0700 |
---|---|---|
committer | Attila Molnar <attilamolnar@hush.com> | 2013-04-01 09:50:50 -0700 |
commit | 66b90807bb94d88c8a34ec8a1fd7c1558941c47a (patch) | |
tree | b2147238c609c5b1733c518b1b932b0e40ddb8a0 /include/hashcomp.h | |
parent | 80e88c163dbd77b06b61d4fd734d51249cc0e172 (diff) | |
parent | fd655fa93a00a5f2993adb7ef562b6dbab8aa87c (diff) |
Merge pull request #452 from SaberUK/master+nuke-hashmap
Purge the deprecated hash_map from existance.
Diffstat (limited to 'include/hashcomp.h')
-rw-r--r-- | include/hashcomp.h | 81 |
1 files changed, 16 insertions, 65 deletions
diff --git a/include/hashcomp.h b/include/hashcomp.h index b75214181..2932f2a48 100644 --- a/include/hashcomp.h +++ b/include/hashcomp.h @@ -31,7 +31,7 @@ #include <deque> #include <map> #include <set> -#include "hash_map.h" +#include "inspircd.h" /******************************************************* * This file contains classes and templates that deal @@ -583,71 +583,22 @@ inline std::string& trim(std::string &str) return str; } -/** Hashing stuff is totally different on vc++'s hash_map implementation, so to save a buttload of - * \#ifdefs we'll just do it all at once. Except, of course, with TR1, when it's the same as GCC. - */ -BEGIN_HASHMAP_NAMESPACE - - /** Hashing function to hash irc::string - */ -#if defined(_WIN32) && !defined(HAS_TR1_UNORDERED) - template<> class CoreExport hash_compare<irc::string, std::less<irc::string> > - { - public: - enum { bucket_size = 4, min_buckets = 8 }; /* Got these numbers from the CRT source, if anyone wants to change them feel free. */ - - /** Compare two irc::string values for hashing in hash_map - */ - bool operator()(const irc::string & s1, const irc::string & s2) const - { - if(s1.length() != s2.length()) return true; - return (irc::irc_char_traits::compare(s1.c_str(), s2.c_str(), (size_t)s1.length()) < 0); - } - - /** Hash an irc::string value for hash_map - */ - size_t operator()(const irc::string & s) const; - }; - - template<> class CoreExport hash_compare<std::string, std::less<std::string> > +namespace std +{ + namespace tr1 { - public: - enum { bucket_size = 4, min_buckets = 8 }; /* Again, from the CRT source */ - - /** Compare two std::string values for hashing in hash_map - */ - bool operator()(const std::string & s1, const std::string & s2) const + + struct insensitive { - if(s1.length() != s2.length()) return true; - return (irc::irc_char_traits::compare(s1.c_str(), s2.c_str(), (size_t)s1.length()) < 0); - } - - /** Hash a std::string using RFC1459 case sensitivity rules - * @param s A string to hash - * @return The hash value - */ - size_t operator()(const std::string & s) const; - }; -#else - - /* XXX FIXME: Implement a hash function overriding std::string's that works with TR1! */ - -#ifdef HASHMAP_DEPRECATED - struct insensitive -#else - CoreExport template<> struct hash<std::string> -#endif - { - size_t CoreExport operator()(const std::string &s) const; - }; - -#endif - - /** Convert a string to lower case respecting RFC1459 - * @param n A string to lowercase - */ - void strlower(char *n); - -END_HASHMAP_NAMESPACE + size_t CoreExport operator()(const std::string &s) const; + }; + + /** Convert a string to lower case respecting RFC1459 + * @param n A string to lowercase + */ + void strlower(char *n); + + } +} #endif |