1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-07-04 23:51:47 +02:00

Provide std::hash<Symbol>

This commit is contained in:
Eelco Dolstra 2024-06-06 19:32:46 +02:00
parent c274e005b6
commit 6d843ce9fe
3 changed files with 14 additions and 3 deletions

View file

@ -69,6 +69,8 @@ public:
auto operator<=>(const Symbol other) const { return id <=> other.id; }
bool operator==(const Symbol other) const { return id == other.id; }
friend class std::hash<Symbol>;
};
/**
@ -132,3 +134,12 @@ public:
};
}
template<>
struct std::hash<nix::Symbol>
{
std::size_t operator()(const nix::Symbol & s) const noexcept
{
return std::hash<decltype(s.id)>{}(s.id);
}
};