Closed
Description
Why
Need a way to include the paths with only slashes rather than backslashes in the output in a cross-platform manner. This can be done by introducing type
in format-spec for path
.
How to use the proposed feature
On Windows,
std::filesystem::path filename = R"(C:\Users\zhihaoy\.cache)";
print("|{}|", filename); // prints |C:\Users\zhihaoy\.cache|
print("|{:n}|", filename); // prints `.native()` |C:\Users\zhihaoy\.cache|
print("|{:g}|", filename); // prints `.generic_wstring()` |C:/Users/zhihaoy/.cache|
On POSIX, the last line prints .generic_string()
.