summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAdam <Adam@anope.org>2010-06-27 22:21:49 -0400
committerAdam <Adam@anope.org>2010-06-27 22:21:49 -0400
commit051ebe3eea0f8529b64c0e443c61103ba2f7dee8 (patch)
treeb8a8f1e4013431dd3a6235203524e49b4a23bb51 /src
parentf17c4d4d04bc695cad75a277bb7ecf1afdef1efe (diff)
Fixed unordered_map to build on VS 2008
Diffstat (limited to 'src')
-rw-r--r--src/hashcomp.cpp45
1 files changed, 45 insertions, 0 deletions
diff --git a/src/hashcomp.cpp b/src/hashcomp.cpp
index f8a03c5f8..e13b3310a 100644
--- a/src/hashcomp.cpp
+++ b/src/hashcomp.cpp
@@ -163,6 +163,21 @@ bool sepstream::StreamEnd()
return n == tokens.end();
}
+#if defined(_WIN32) && _MSV_VER < 1600
+/** Compare two std::string's values for hashing in hash_map
+ * @param s1 The first string
+ * @param s2 The second string
+ * @return similar to strcmp, zero for equal, less than zero for str1
+ * being less and greater than zero for str1 being greater than str2.
+ */
+bool hash_compare_std_string::operator()(const std::string &s1, const std::string &s2) const
+{
+ if (s1.length() != s2.length())
+ return true;
+ return (std::char_traits<char>::compare(s1.c_str(), s2.c_str(), s1.length()) < 0);
+}
+#endif
+
/** Return a hash value for a string
* @param s The string
* @return The hash value
@@ -177,6 +192,21 @@ size_t hash_compare_std_string::operator()(const std::string &s) const
return t;
}
+#if defined(_WIN32) && _MSV_VER < 1600
+/** Compare two ci::string's values for hashing in hash_map
+ * @param s1 The first string
+ * @param s2 The second string
+ * @return similar to strcmp, zero for equal, less than zero for str1
+ * being less and greater than zero for str1 being greater than str2.
+ */
+bool hash_compare_ci_string::operator()(const ci::string &s1, const ci::string &s2) const
+{
+ if (s1.length() != s2.length())
+ return true;
+ return (ci::ci_char_traits::compare(s1.c_str(), s2.c_str(), s1.length()) < 0);
+}
+#endif
+
/** Return a hash value for a string using case insensitivity
* @param s The string
* @return The hash value
@@ -191,6 +221,21 @@ size_t hash_compare_ci_string::operator()(const ci::string &s) const
return t;
}
+#if defined(_WIN32) && _MSV_VER < 1600
+/** Compare two irc::string's values for hashing in hash_map
+ * @param s1 The first string
+ * @param s2 The second string
+ * @return similar to strcmp, zero for equal, less than zero for str1
+ * being less and greater than zero for str1 being greater than str2.
+ */
+bool hash_compare_irc_string::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(), s1.length()) < 0);
+}
+#endif
+
/** Return a hash value for a string using RFC1459 case sensitivity rules
* @param s The string
* @return The hash value