Age | Commit message (Collapse) | Author |
|
|
|
|
|
|
|
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.
|
|
|
|
The changeset above touched every consumer of the two LLRegistrySingletons
originally defined with std::type_info* as keys. Those two
LLRegistrySingletons were changed to use const char* as keys, then all
consumers were changed to pass std::type_info::name() instead of the plain
std::type_info* pointer -- to deal with the observed fact that on Linux, a
given type might produce different std::type_info* pointers in different load
modules. Since then, Richard turned up the fascinating fact that at least some
implementations of gcc's std::type_info::before() method already accommodate
this peculiarity. It seems worth backing out the (dismayingly pervasive)
change to see if properly using std::type_info::before() as the map comparator
will work just as well, with conceptually simpler source code.
This backout is transitional: we don't expect things to build/run properly
until we've cherry-picked certain other pertinent changes.
|
|
Try to diagnose the cause of the misbehavior with a BOOST_STATIC_ASSERT.
|
|
Although LLRegistry and LLRegistrySingleton have always defined a COMPARATOR
template parameter, it wasn't used for the underlying map. Therefore every
type, including any pointer type, was being compared using std::less. This
happens to work most of the time -- but is tripping us up now.
Pass COMPARATOR to underlying std::map. Fix a couple minor bugs in
LLRegistryDefaultComparator (never before used!). Specialize for const char*.
Remove CompareTypeID and LLCompareTypeID because we now actively forbid using
LLRegistry<std::type_info*, ...>; remove only known reference
(LLWidgetNameRegistry definition).
|
|
Back out code that selects LLTypeInfoLookup for the underlying map
implementation when KEY = [const] std::type_info*, because LLTypeInfoLookup's
API is changing to become incompatible with std::map. Instead, fail with
STATIC_ASSERT when LLRegistry's KEY is [const] std::type_info*.
Fix all existing uses to use std::type_info::name() string instead.
|
|
In a number of places, the viewer uses a lookup based on std::type_info*. We
used to use std::map<std::type_info*, whatever>. But on Linux,
&typeid(SomeType) can produce different pointer values, depending on the
dynamic load module in which the code is executed. Introduce
LLTypeInfoLookup<T>, with an API that deliberately mimics
std::map<std::type_info*, T>. LLTypeInfoLookup::find() first tries an
efficient search for the specified std::type_info*. But if that fails, it
scans the underlying container for a match on the std::type_info::name()
string. If found, it caches the new std::type_info* to optimize subsequent
lookups with the same pointer.
Use LLTypeInfoLookup instead of std::map<std::type_info*, ...> in
llinitparam.h and llregistry.h.
Introduce LLSortedVector<KEY, VALUE>, a std::vector<std::pair<KEY, VALUE>>
maintained in sorted order with binary-search lookup. It presents a subset of
the std::map<KEY, VALUE> API.
|
|
moved LLInitParam, and LLRegistry to llcommon
moved LLUIColor, LLTrans, and LLXUIParser to llui
reviewed by Nat
|