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
5 changes: 1 addition & 4 deletions include/tmp/directory
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
#include <tmp/entry>
#include <tmp/export>

#include <cstddef>
#include <filesystem>
#include <string_view>
#include <system_error>
Expand Down Expand Up @@ -90,8 +89,6 @@ public:
} // namespace tmp

/// The template specialization of `std::hash` for `tmp::directory`
template<> struct TMP_EXPORT std::hash<tmp::directory> {
std::size_t operator()(const tmp::directory& directory) const noexcept;
};
template<> struct std::hash<tmp::directory> : std::hash<tmp::entry> {};

#endif // TMP_DIRECTORY_H
5 changes: 1 addition & 4 deletions include/tmp/file
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
#include <tmp/entry>
#include <tmp/export>

#include <cstddef>
#include <filesystem>
#include <fstream>
#include <ios>
Expand Down Expand Up @@ -173,8 +172,6 @@ private:
} // namespace tmp

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

#endif // TMP_FILE_H
6 changes: 0 additions & 6 deletions src/directory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

#include "create.hpp"

#include <cstddef>
#include <filesystem>
#include <string_view>
#include <system_error>
Expand Down Expand Up @@ -65,8 +64,3 @@ directory::~directory() noexcept = default;
directory::directory(directory&&) noexcept = default;
directory& directory::operator=(directory&&) noexcept = default;
} // namespace tmp

std::size_t std::hash<tmp::directory>::operator()(
const tmp::directory& directory) const noexcept {
return std::hash<tmp::entry>()(directory);
}
3 changes: 2 additions & 1 deletion src/entry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -207,5 +207,6 @@ bool entry::operator>=(const entry& rhs) const noexcept {

std::size_t
std::hash<tmp::entry>::operator()(const tmp::entry& entry) const noexcept {
return tmp::fs::hash_value(entry);
// `std::hash<std::filesystem::path>` was not included in the C++17 standard
return filesystem::hash_value(entry);
}
5 changes: 0 additions & 5 deletions src/file.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -322,8 +322,3 @@ file::~file() noexcept = default;
file::file(file&&) noexcept = default;
file& file::operator=(file&& other) noexcept = default;
} // namespace tmp

std::size_t
std::hash<tmp::file>::operator()(const tmp::file& file) const noexcept {
return std::hash<tmp::entry>()(file);
}