A cache is typically a use case for mutable (as the outside user of the
class wouldn't directly rely on the cache as part of the API, this would
only function to assist the API perform better), so we can mark the
selection cache as mutable and make the code nicer to read overall.
Performs the same changes that were recently applied to ITweakGunRes for
consistency. Also eliminates some sign conversion warnings and
deduplicates some array sizes.
We can use insert() with make_move_iterator() to perform the same
behavior, minus unnecessary copies.
While we're at it, we can collapse the code within the Area case, since
it's the exact same as the Mesh code.
Previously, any call to this function would always reset the timer to
0.0, rather than potentially decrement it.
GM8E v0 always returns within the conditional.
It's quite common to see maps or sets that make use of a string->object
association, usually as <std::string, T>. However, this can result in
inefficient code when performing lookups or indexing, as something like:
std::map<std::string, T> some_map;
...
auto iter = some_map.find("Name");
...
will result in a std::string instance being constructed around "Name",
which is less than ideal.
With a heterogenous comparator, however (such as std::less<>), like:
std::map<std::string, T, std::less<>>
we allow the container to do automatic type deduction and comparisons.
This allows types comparable to the key type to be used in find calls,
etc, without actually needing to construct the key type around the other
type.
The main way to enable containers to perform such behavior is by
defining a type named is_transparent within the comparator type.
Now that all elements of the std::vector would otherwise be constexpr,
we can use a std::array here instead, given they're all able to
deterministically be available at compile-time.
This gets rid of a runtime static heap allocation at program start.
All of these can be migrated into the cpp file, since they're only used
there.
Greatly reduces the amount of work the preprocessor has to do in files
that include this one.
All of these entries make use of captureless lambdas, so there's no need
to make use of std::function. We can just use a regular function
pointer, which allows making all of the file-static entries within
IScriptObject constexpr. Eliminating all of their runtime static
constructors.
Makes the data strongly typed and also allows tooling runtime checks for
debug builds if implementations support it (which MSVC, libstdc++ and
libc++ all support).