Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 0 additions & 8 deletions include/tmp/directory
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,4 @@ private:
};
} // namespace tmp

/// The template specialization of `std::hash` for `tmp::directory`
template<> struct std::hash<tmp::directory> {
std::size_t operator()(const tmp::directory& directory) const noexcept {
// `std::hash<std::filesystem::path>` was not included in the C++17 standard
return filesystem::hash_value(directory);
}
};

#endif // TMP_DIRECTORY_H
7 changes: 0 additions & 7 deletions include/tmp/file
Original file line number Diff line number Diff line change
Expand Up @@ -86,11 +86,4 @@ private:
};
} // namespace tmp

/// The template specialization of `std::hash` for `tmp::file`
template<> struct std::hash<tmp::file> {
std::size_t operator()(const tmp::file& file) const noexcept {
return std::hash<tmp::file::native_handle_type>()(file.native_handle());
}
};

#endif // TMP_FILE_H
8 changes: 0 additions & 8 deletions tests/directory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -152,13 +152,5 @@ TEST(directory, swap) {
EXPECT_EQ(fst.path(), snd_path);
EXPECT_EQ(snd.path(), fst_path);
}

/// Tests directory hashing
TEST(directory, hash) {
directory tmpdir = directory();
std::hash hash = std::hash<directory>();

EXPECT_EQ(hash(tmpdir), fs::hash_value(tmpdir.path()));
}
} // namespace
} // namespace tmp
9 changes: 0 additions & 9 deletions tests/file.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -148,14 +148,5 @@ TEST(file, swap) {
EXPECT_TRUE(is_open(fst));
EXPECT_TRUE(is_open(snd));
}

/// Tests file hashing
TEST(file, hash) {
file tmpfile = file();
std::hash hash = std::hash<file>();

EXPECT_EQ(hash(tmpfile),
std::hash<file::native_handle_type>()(tmpfile.native_handle()));
}
} // namespace
} // namespace tmp