diff options
author | Nat Goodspeed <nat@lindenlab.com> | 2024-06-27 19:47:00 -0400 |
---|---|---|
committer | Nat Goodspeed <nat@lindenlab.com> | 2024-06-27 19:47:00 -0400 |
commit | 0cc7436be1f57299384c5acad5d32e13f2f4d1cf (patch) | |
tree | accf51717e388f6daab391876c2a1d68c6e702bd /indra/llmath | |
parent | 6ee98f4e9b5ea9ade06056a9d1f4c1e0b1c00b44 (diff) |
Introduce TypeTag<T> template whose int value differs for each T.
This replaces type_tag<T>(), which searched and possibly extended the type_tags
unordered_map at runtime. If we called lua_emplace<T>() from different threads,
that would require locking type_tags.
In contrast, the compiler must instantiate a distinct TypeTag<T> for every
distinct T passed to lua_emplace<T>(), so each gets a distinct value at static
initialization time. No locking is required; no lookup; no allocations.
Add a test to llluamanager_test.cpp to verify that each distinct T passed to
lua_emplace<T>() gets its own TypeTag<T>::value, and that each gets its own
destructor -- but that different lua_emplace<T>() calls with the same T share
the same TypeTag<T>::value and the same destructor.
Diffstat (limited to 'indra/llmath')
0 files changed, 0 insertions, 0 deletions