1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-18 20:43:04 +01:00

Use plain std::string_view instead of const &

This commit is contained in:
Gymnasiast
2020-11-06 11:40:52 +01:00
parent 53aef4e549
commit ce15e20c94
4 changed files with 8 additions and 9 deletions

View File

@@ -49,11 +49,10 @@ using namespace OpenRCT2;
struct ObjectIdentifierHash
{
size_t operator()(const std::string_view& identifier) const
size_t operator()(std::string_view identifier) const
{
std::string copy = identifier.data();
uint32_t hash = 5381;
for (auto i : copy)
for (auto i : identifier)
{
hash = ((hash << 5) + hash) + i;
}
@@ -63,7 +62,7 @@ struct ObjectIdentifierHash
struct ObjectIdentifierEqual
{
bool operator()(const std::string_view& lhs, const std::string_view& rhs) const
bool operator()(std::string_view lhs, std::string_view rhs) const
{
return lhs == rhs;
}
@@ -306,9 +305,9 @@ public:
return nullptr;
}
const ObjectRepositoryItem* FindObject(const std::string_view& identifier) const override final
const ObjectRepositoryItem* FindObject(std::string_view identifier) const override final
{
auto kvp = _newItemMap.find(identifier.data());
auto kvp = _newItemMap.find(std::string(identifier));
if (kvp != _newItemMap.end())
{
return &_items[kvp->second];