Files
codeql/swift/extractor/infra/file/PathHash.h.workaround
2023-01-10 14:30:35 +01:00

18 lines
647 B
Plaintext

#pragma once
#include <filesystem>
#include <functional>
// workaround for https://cplusplus.github.io/LWG/issue3657
// notice that theoretically by the standard you are not allowed to specialize on std types...
// but it works, and this is recognized as a defect of the standard.
// Using a non-standard Hasher type would be a huge pain, as the automatic hash implementation of
// std::variant would not kick in (we use std::filesystem::path in a variant used as a map key).
namespace std {
template <>
struct hash<filesystem::path> {
size_t operator()(const filesystem::path& path) const { return hash_value(path); }
};
} // namespace std