为什么在c ++ 20中不推荐使用std :: filesystem :: u8path? [英] Why is std::filesystem::u8path deprecated in c++20?

查看:115
本文介绍了为什么在c ++ 20中不推荐使用std :: filesystem :: u8path?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在c ++ 17中引入的 std :: filesystem :: u8path 在c ++ 20中似乎已被弃用。

Introduced in c++17, std::filesystem::u8path seems to be deprecated in c++20.

此选择的原因是什么?我应该在c ++ 17中使用什么?我应该在c ++ 20中使用什么?

What is the reason for this choice? What should I use in c++17? What should I use in c++20?

推荐答案

由于C ++ 20功能的存在, char8_t ,这将起作用:

Because, thanks to the existence of the C++20 feature char8_t, this will work:

path p(u8"A/utf8/path");

u8path 可以检测到UTF-8字符串和窄字符串之间的区别。但是由于C ++ 20为此会为我们提供实际的 type ,因此不再需要。

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.


我应该在c ++ 17中使用什么?

What should I use in c++17?

使用 u8path 。弃用并不表示已删除无法访问。它只是意味着会被最终删除。

Use u8path. Deprecation does not mean removed or inaccessible. It merely means subject to eventual removal.

这篇关于为什么在c ++ 20中不推荐使用std :: filesystem :: u8path?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆