diff options
author | Nat Goodspeed <nat@lindenlab.com> | 2012-07-18 20:33:54 -0400 |
---|---|---|
committer | Nat Goodspeed <nat@lindenlab.com> | 2012-07-18 20:33:54 -0400 |
commit | 2e83dfa217feb90e7b94e499346ad9b98fa711b2 (patch) | |
tree | 5a04949eb59fe0ff1a5d92d8fb0222d1f33d3130 /indra/llcommon/llregistry.h | |
parent | 5e1e44ca7ea6fdbfb34a3a3968d5f07fc0ff3d7a (diff) |
MAINT-1175: Ditch LLTypeInfoLookup, make map<const type_info*> work.
Instead of forbidding std::map<const std::type_info*, ...> outright (which
includes LLRegistry<const std::type_info*, ...> and LLRegistrySingleton<const
std::type_info*, ...>), try to make it work by specializing std::less<const
std::type_info*> to use std::type_info::before().
Make LLRegistryDefaultComparator<T> use std::less<T> so it can capitalize on
that specialization.
Diffstat (limited to 'indra/llcommon/llregistry.h')
-rw-r--r-- | indra/llcommon/llregistry.h | 34 |
1 files changed, 4 insertions, 30 deletions
diff --git a/indra/llcommon/llregistry.h b/indra/llcommon/llregistry.h index 2df9bc6541..853c427a13 100644 --- a/indra/llcommon/llregistry.h +++ b/indra/llcommon/llregistry.h @@ -31,44 +31,18 @@ #include <boost/type_traits.hpp> #include "llsingleton.h" -#include "lltypeinfolookup.h" +#include "llstl.h" template <typename T> struct LLRegistryDefaultComparator { - // It would be Bad if this comparison were used for const char* - BOOST_STATIC_ASSERT(! (boost::is_same<typename boost::remove_const<typename boost::remove_pointer<T>::type>::type, char>::value)); - bool operator()(const T& lhs, const T& rhs) const { return lhs < rhs; } -}; - -// comparator for const char* registry keys -template <> -struct LLRegistryDefaultComparator<const char*> -{ - bool operator()(const char* lhs, const char* rhs) const + bool operator()(const T& lhs, const T& rhs) const { - return strcmp(lhs, rhs) < 0; + using std::less; + return less<T>()(lhs, rhs); } }; -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 { |