[generator] Implement hash for OsmElement::Tag

Signed-off-by: x7z4w <x7z4w@noreply.codeberg.org>
This commit is contained in:
x7z4w
2025-11-24 17:34:56 +00:00
parent ce33990c85
commit f6eb060f4f
5 changed files with 20 additions and 4 deletions

View File

@@ -146,3 +146,13 @@ std::string DebugPrintID(OsmElement const & element);
std::string DebugPrint(OsmElement const & element);
std::string DebugPrint(OsmElement::EntityType type);
std::string DebugPrint(OsmElement::Tag const & tag);
template <>
struct std::hash<OsmElement::Tag>
{
using is_avalanching = void;
auto operator()(OsmElement::Tag const & tag) const noexcept -> std::uint64_t {
std::string const str = tag.m_key + tag.m_value;
return ankerl::unordered_dense::detail::wyhash::hash(str.data(), sizeof(char) * str.size());
}
};