summaryrefslogtreecommitdiff
path: root/indra/llcommon/llregistry.h
diff options
context:
space:
mode:
Diffstat (limited to 'indra/llcommon/llregistry.h')
-rw-r--r--indra/llcommon/llregistry.h28
1 files changed, 19 insertions, 9 deletions
diff --git a/indra/llcommon/llregistry.h b/indra/llcommon/llregistry.h
index babc1b87aa..2df9bc6541 100644
--- a/indra/llcommon/llregistry.h
+++ b/indra/llcommon/llregistry.h
@@ -30,8 +30,8 @@
#include <list>
#include <boost/type_traits.hpp>
-#include <boost/static_assert.hpp>
#include "llsingleton.h"
+#include "lltypeinfolookup.h"
template <typename T>
struct LLRegistryDefaultComparator
@@ -51,17 +51,27 @@ struct LLRegistryDefaultComparator<const char*>
}
};
+template <typename KEY, typename VALUE>
+struct LLRegistryMapSelector
+{
+ typedef std::map<KEY, VALUE> type;
+};
+
+template <typename VALUE>
+struct LLRegistryMapSelector<std::type_info*, VALUE>
+{
+ typedef LLTypeInfoLookup<VALUE> type;
+};
+
+template <typename VALUE>
+struct LLRegistryMapSelector<const std::type_info*, VALUE>
+{
+ typedef LLTypeInfoLookup<VALUE> type;
+};
+
template <typename KEY, typename VALUE, typename COMPARATOR = LLRegistryDefaultComparator<KEY> >
class LLRegistry
{
- // Do not use LLRegistry with KEY = std::type_info* or KEY = const std::type_info*.
- // This is known to fail on Linux.
- // If you must use LLRegistry with dynamic type info, use KEY = const char*
- // and pass std::type_info::name(); this works across load modules.
- // Disallow both std::type_info* and const std::type_info*. First remove
- // the pointer, then remove const, then compare is_same<std::type_info>.
- BOOST_STATIC_ASSERT(! (boost::is_same<typename boost::remove_const<typename boost::remove_pointer<KEY>::type>::type, std::type_info>::value));
-
public:
typedef LLRegistry<KEY, VALUE, COMPARATOR> registry_t;
typedef typename boost::add_reference<typename boost::add_const<KEY>::type>::type ref_const_key_t;