summaryrefslogtreecommitdiff
path: root/include/hashcomp.h
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 /include/hashcomp.h
parentf17c4d4d04bc695cad75a277bb7ecf1afdef1efe (diff)
Fixed unordered_map to build on VS 2008
Diffstat (limited to 'include/hashcomp.h')
-rw-r--r--include/hashcomp.h44
1 files changed, 42 insertions, 2 deletions
diff --git a/include/hashcomp.h b/include/hashcomp.h
index 5d19f2a1f..711f8275f 100644
--- a/include/hashcomp.h
+++ b/include/hashcomp.h
@@ -28,9 +28,15 @@
# define unordered_map hash_map
# endif
#else
+# if _MSV_VER >= 1600
/* MSVC 2010+ has tr1. Though MSVC and GCC use different includes! */
-# include <unordered_map>
-# define unordered_map_namespace std::tr1
+# include <unordered_map>
+# define unordered_map_namespace std::tr1
+# else
+# include <hash_map>
+# define unordered_map_namespace stdext
+# define unordered_map hash_map
+# endif
#endif
/*******************************************************
@@ -488,6 +494,18 @@ class spacesepstream : public sepstream
class CoreExport hash_compare_std_string
{
public:
+#if defined(_WIN32) && _MSV_VER < 1600
+ enum { bucket_size = 4, min_buckets = 8 };
+
+ /** 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 operator()(const std::string &s1, const std::string &s2) const;
+#endif
+
/** Return a hash value for a string
* @param s The string
* @return The hash value
@@ -500,6 +518,17 @@ class CoreExport hash_compare_std_string
class CoreExport hash_compare_ci_string
{
public:
+#if defined(_WIN32) && _MSV_VER < 1600
+ enum { bucket_size = 4, min_buckets = 8 };
+
+ /** 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 operator()(const ci::string &s1, const ci::string &s2) const;
+#endif
/** Return a hash value for a string using case insensitivity
* @param s The string
* @return The hash value
@@ -512,6 +541,17 @@ class CoreExport hash_compare_ci_string
class CoreExport hash_compare_irc_string
{
public:
+#if defined(_WIN32) && _MSV_VER < 1600
+ enum { bucket_size = 4, min_buckets = 8 };
+
+ /** 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 operator()(const irc::string &s1, const irc::string &s2) const;
+#endif
/** Return a hash value for a string using RFC1459 case sensitivity rules
* @param s The stirng
* @return The hash value