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:
parent
c274e005b6
commit
6d843ce9fe
3 changed files with 14 additions and 3 deletions
|
@ -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);
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue