Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inherit hash from tmp::entry #118

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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>

Expand Down Expand Up @@ -78,8 +77,6 @@ private:
} // 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> : public 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 @@ -125,8 +124,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> : public 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 "utils.hpp"

#include <cstddef>
#include <filesystem>
#include <string_view>
#include <system_error>
Expand Down Expand Up @@ -104,8 +103,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);
}
6 changes: 0 additions & 6 deletions src/file.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

#include "utils.hpp"

#include <cstddef>
#include <filesystem>
#include <fstream>
#include <ios>
Expand Down Expand Up @@ -124,8 +123,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);
}