mirror of
https://github.com/NixOS/nix.git
synced 2025-11-16 15:32:43 +01:00
SourcePath: Implement boost::hash
This commit is contained in:
parent
8fbf4b9427
commit
47c16fc4bd
1 changed files with 11 additions and 3 deletions
|
|
@ -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);
|
||||
}
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue