Created on 2022-01-02.00:00:00 last changed 13 months ago
Proposed resolution:
This wording is relative to N4901.
Modify [fs.filesystem.syn], header <filesystem> synopsis, as indicated:
#include <compare> // see [compare.syn] namespace std::filesystem { // [fs.class.path], paths class path; // [fs.path.nonmember], path non-member functions void swap(path& lhs, path& rhs) noexcept; size_t hash_value(const path& p) noexcept; […] } // [fs.path.hash], hash support namespace std { template<class T> struct hash; template<> struct hash<filesystem::path>; }
Following subclause [fs.path.nonmember], introduce a new subclause [fs.path.hash], as indicated:
29.12.6.? Hash support [fs.path.hash]
template<> struct hash<filesystem::path>;-?- For an object p of type filesystem::path, hash<filesystem::path>()(p) evaluates to the same result as filesystem::hash_value(p).
[ 2022-02-10 Approved at February 2022 virtual plenary. Status changed: Tentatively Ready → WP. ]
[ 2022-01-30; Reflector poll ]
Set status to Tentatively Ready after five votes in favour during reflector poll.
[ 2022-01-18; Daniel improves wording based on reflector discussion feedback ]
[ 2022-01-15; Daniel provides wording ]
Previous resolution [SUPERSEDED]:
This wording is relative to N4901.
Modify [fs.filesystem.syn], header <filesystem> synopsis, as indicated:
#include <compare> // see [compare.syn] namespace std::filesystem { // [fs.class.path], paths class path; // [fs.path.nonmember], path non-member functions void swap(path& lhs, path& rhs) noexcept; size_t hash_value(const path& p) noexcept; […] } // [fs.path.hash], hash support namespace std { template<class T> struct hash; template<> struct hash<filesystem::path>; }Following subclause [fs.path.nonmember], introduce a new subclause [fs.path.hash], as indicated:
29.12.6.? Hash support [fs.path.hash]
template<> struct hash<filesystem::path>;-?- For an object p of type filesystem::path, hash<filesystem::path>()(p) shall evaluate to the same result as hash_value(p).
The hash support of std::filesystem::path is provided by std::filesystem::hash_value, but the specialization std::hash<std::filesystem::path> is currently disabled. IMO the specialization should be enabled, and its operator() should return the same value as hash_value.
History | |||
---|---|---|---|
Date | User | Action | Args |
2023-11-22 15:47:43 | admin | set | status: wp -> c++23 |
2022-02-10 12:58:57 | admin | set | messages: + msg12363 |
2022-02-10 12:58:57 | admin | set | status: ready -> wp |
2022-01-30 17:01:07 | admin | set | messages: + msg12308 |
2022-01-30 17:01:07 | admin | set | status: new -> ready |
2022-01-18 16:46:24 | admin | set | messages: + msg12266 |
2022-01-15 19:52:22 | admin | set | messages: + msg12265 |
2022-01-15 19:52:22 | admin | set | messages: + msg12264 |
2022-01-02 00:00:00 | admin | create |