til::static_map can't be constexpr until we move to C++20. It can't be constexpr because std::sort isn't constexpr until then. This poses a problem: if we start using it and treating it like a map, we'll incur a potentially high cost in static initialization in both code size in .text and runtime. This commit introduces presorted_static_map, which is static_map except that it doesn't automatically sort its keys. That's the only difference. At this point, it's just a maplike interface to a constant array of pairs that does a binary search. It should be used for small tables that are used infrequently enough as to not warrant their cost in code size or initialization time. It should also be used for tables that aren't going to be edited much by developers (like the color table in #7578.) |
||
---|---|---|
.. | ||
ut_til | ||
dirs | ||
precomp.cpp | ||
precomp.h |