1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-11-16 07:22:43 +01:00

SourcePath: Implement boost::hash

This commit is contained in:
Eelco Dolstra 2025-09-08 08:07:45 +02:00
parent 8fbf4b9427
commit 47c16fc4bd

View file

@ -119,15 +119,23 @@ struct SourcePath
std::ostream & operator<<(std::ostream & str, const SourcePath & path);
inline std::size_t hash_value(const SourcePath & path)
{
std::size_t hash = 0;
boost::hash_combine(hash, path.accessor->number);
boost::hash_combine(hash, path.path);
return hash;
}
} // namespace nix
template<>
struct std::hash<nix::SourcePath>
{
using is_avalanching = std::true_type;
std::size_t operator()(const nix::SourcePath & s) const noexcept
{
std::size_t hash = 0;
hash_combine(hash, s.accessor->number, s.path);
return hash;
return nix::hash_value(s);
}
};