[libcxx-commits] [PATCH] D91181: [24/N] [libcxx] Make generic_*string return paths with forward slashes on windows

Marek Kurdej via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Fri Dec 18 03:15:22 PST 2020


curdeius added inline comments.


================
Comment at: libcxx/include/filesystem:1252
   _VSTD::u32string generic_u32string() const { return generic_string<char32_t>(); }
-  __u8_string generic_u8string() const { return u8string(); }
+  __u8_string generic_u8string() const {
+    __u8_string __s = u8string();
----------------
Hmmm. Why can't it be implemented in terms of `generic_string`?
I.e.: `{ return generic_string<typename __u8_string::value_type>(); }`


================
Comment at: libcxx/include/filesystem:1253-1254
+  __u8_string generic_u8string() const {
+    __u8_string __s = u8string();
+    _VSTD::replace(__s.begin(), __s.end(), '\\', '/');
+    return __s;
----------------
If I'm not mistaken it means that you traverse the string twice, once in `u8string()` to convert it using `_CVT`, and then in `replace()`.
I don't think it's a blocker, but just saying.
Same above in `generic_string<_ECharT, _Traits, _Allocator>`.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D91181/new/

https://reviews.llvm.org/D91181



More information about the libcxx-commits mailing list