[libcxx-commits] [libcxx] [libc++] fix back slash as root dir breaks lexically_relative, lexically_proximate and hash_value on Windows (PR #99780)

via libcxx-commits libcxx-commits at lists.llvm.org
Tue Aug 6 00:22:53 PDT 2024


================
@@ -368,7 +368,8 @@ size_t hash_value(const path& __p) noexcept {
   size_t hash_value = 0;
   hash<string_view_t> hasher;
   while (PP) {
-    hash_value = __hash_combine(hash_value, hasher(*PP));
+    string_view_t Part = PP.inRootDir() ? PATHSTR("/") : *PP;
----------------
RichardLuo0 wrote:

No, the `<DRIVE>:` is [root-name](https://timsong-cpp.github.io/cppwp/n4861/fs.class.path#nt:root-name). Its different from root-directory (which is '/' or '\').
What I did was use '/' to replace the root directory.

https://github.com/llvm/llvm-project/pull/99780


More information about the libcxx-commits mailing list