aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2006-07-29 21:23:17 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2006-07-29 21:23:17 +0000
commit5703c6e076b08bf223930b2f3c86225f492f9202 (patch)
treeeb168734d01e303b6daba05d74a28b9f067c94ee
parent08624c5bb5c1e1405021c45fdfce30f2fe12c65c (diff)
downloadpaludis-5703c6e076b08bf223930b2f3c86225f492f9202.tar.gz
paludis-5703c6e076b08bf223930b2f3c86225f492f9202.tar.xz
Add MakeHasedMultiSet and MakeHashedMultiMap classes
-rw-r--r--paludis/hashed_containers.hh.in52
1 files changed, 52 insertions, 0 deletions
diff --git a/paludis/hashed_containers.hh.in b/paludis/hashed_containers.hh.in
index 857d064..a3e62f0 100644
--- a/paludis/hashed_containers.hh.in
+++ b/paludis/hashed_containers.hh.in
@@ -110,6 +110,32 @@ namespace paludis
};
/**
+ * Make a hashed map of some kind from Key_ to Value_.
+ *
+ * \ingroup grphashedcontainers
+ */
+ template <typename Key_, typename Value_>
+ struct MakeHashedMultiMap
+ {
+#if PALUDIS_HAVE_TR1_HASHES
+ /// Our map type.
+ typedef std::tr1::unordered_multimap<Key_, Value_, CRCHash<Key_> > Type;
+
+#elif PALUDIS_HAVE_EXT_HASHES
+ /// Our map type.
+ typedef __gnu_cxx::hash_multimap<Key_, Value_, CRCHash<Key_> > Type;
+
+#elif PALUDIS_HAVE_STD_HASHES
+ /// Our map type.
+ typedef std::hash_multimap<Key_, Value_, CRCHash<Key_> > Type;
+
+#else
+ /// Our map type.
+ typedef std::multimap<Key_, Value_> Type;
+#endif
+ };
+
+ /**
* Make a hashed set of some kind of Key_.
*
* \ingroup grphashedcontainers
@@ -135,6 +161,32 @@ namespace paludis
#endif
};
+ /**
+ * Make a hashed set of some kind of Key_.
+ *
+ * \ingroup grphashedcontainers
+ */
+ template <typename Key_>
+ struct MakeHashedMultiSet
+ {
+#if PALUDIS_HAVE_TR1_HASHES
+ /// Our set type.
+ typedef std::tr1::unordered_multiset<Key_, CRCHash<Key_> > Type;
+
+#elif PALUDIS_HAVE_EXT_HASHES
+ /// Our set type.
+ typedef __gnu_cxx::hash_multiset<Key_, CRCHash<Key_> > Type;
+
+#elif PALUDIS_HAVE_STD_HASHES
+ /// Our set type.
+ typedef std::hash_multiset<Key_, CRCHash<Key_> > Type;
+
+#else
+ /// Our set type.
+ typedef std::multiset<Key_> Type;
+#endif
+ };
+
#if PALUDIS_HAVE_TR1_HASHES || PALUDIS_HAVE_EXT_HASHES || PALUDIS_HAVE_STD_HASHES
namespace hashed_containers_internals
{