1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-22 14:24:33 +01:00

Enable the use of std::string_view for find in ObjectRepository

This commit is contained in:
ζeh Matt
2025-04-21 02:35:44 +03:00
parent 32f652e493
commit a22c041379
2 changed files with 20 additions and 2 deletions

View File

@@ -69,7 +69,7 @@ struct ObjectEntryEqual
}
};
using ObjectIdentifierMap = std::unordered_map<std::string, size_t>;
using ObjectIdentifierMap = std::unordered_map<std::string, size_t, String::Hash, std::equal_to<>>;
using ObjectEntryMap = std::unordered_map<RCTObjectEntry, size_t, ObjectEntryHash, ObjectEntryEqual>;
class ObjectFileIndex final : public FileIndex<ObjectRepositoryItem>
@@ -235,7 +235,7 @@ public:
const ObjectRepositoryItem* FindObject(std::string_view identifier) const override final
{
auto kvp = _newItemMap.find(std::string(identifier));
auto kvp = _newItemMap.find(identifier);
if (kvp != _newItemMap.end())
{
return &_items[kvp->second];