Introduced in c++17, std::filesystem::u8path
seems to be deprecated in c++20.
What is the reason for this choice? What should I use in c++17? What should I use in c++20?
u8path existed to allow the detection of the difference between a UTF-8 string and a narrow character string. But since C++20 will give us an actual type for that, it is no longer necessary. What should I use in c++17? Use u8path.
The path name has the following syntax: 1 root-name(optional): identifies the root on a filesystem with multiple roots (such as "C:" or "//myserver" ). In case of... 2 root-directory(optional): a directory separator that, if present, marks this path as absolute. If it is missing (and the... 3 Zero or more of the following: More ...
On those OS where native format differs between pathnames of directories and pathnames of files, a generic pathname is treated as a directory path if it ends on a directory separator and a regular file otherwise.
Use u8path. Deprecation does not mean removed or inaccessible. It merely means subject to eventual removal. Thanks for contributing an answer to Stack Overflow! Please be sure to answer the question.
Because, thanks to the existence of the C++20 feature char8_t
, this will work:
path p(u8"A/utf8/path");
u8path
existed to allow the detection of the difference between a UTF-8 string and a narrow character string. But since C++20 will give us an actual type for that, it is no longer necessary.
What should I use in c++17?
Use u8path
. Deprecation does not mean removed or inaccessible. It merely means subject to eventual removal.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With