简体   繁体   English

为什么 std::filesystem::u8path 在 c++20 中被弃用?

[英]Why is std::filesystem::u8path deprecated in c++20?

Introduced in c++17, std::filesystem::u8path seems to be deprecated in c++20.在 c++17 中引入, std::filesystem::u8path似乎在 c++20 中被弃用。

What is the reason for this choice?这个选择的原因是什么? What should I use in c++17?我应该在 c++17 中使用什么? What should I use in c++20?我应该在 c++20 中使用什么?

Because, thanks to the existence of the C++20 feature char8_t , this will work:因为,由于 C++20 特性char8_t的存在,这将起作用:

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. u8path存在允许检测 UTF-8 字符串和窄字符串之间的差异。 But since C++20 will give us an actual type for that, it is no longer necessary.但由于 C++20 将为我们提供一个实际的类型,它不再是必要的。


What should I use in c++17?我应该在 c++17 中使用什么?

Use u8path .使用u8path Deprecation does not mean removed or inaccessible .弃用并不意味着已删除无法访问 It merely means subject to eventual removal.它仅仅意味着最终会被移除。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM