GothicKit / ZenKit

A re-implementation of file formats used by the early 2000's ZenGin
http://zk.gothickit.dev/
MIT License
44 stars 10 forks source link

[v1.1.0] Make internal associative contains use the `std::less<>` comparator #21

Closed lmichaelis closed 1 year ago

lmichaelis commented 1 year ago

This allows for find-ing keys of type std::string using std::string_view which makes everything faster.

lmichaelis commented 1 year ago

It seems this won't work for std::unordered_map in C++17. std::map would have to be used. This is fixed in C++20 with P0919R2 – Heterogeneous lookup for unordered containers.

The question then becomes, if we should prefer constant-time lookups with heap allocation to logarithmic-time lookups without heap allocations while keeping in mind that there may be thousands of keys.

lmichaelis commented 1 year ago

All APIs with the exception of the deprecated way_net::waypoint have been migrated.