c ++ 14 std :: experimental :: filesystem :: v1和c ++ 17 std :: filesystem之间的区别? [英] Differences between c++14 std::experimental::filesystem::v1 and c++17 std::filesystem?

查看:1110
本文介绍了c ++ 14 std :: experimental :: filesystem :: v1和c ++ 17 std :: filesystem之间的区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我找到了此页面,描述了c ++ 14和c ++ 17之间的变化:

I found this page, describing the changes between c++14 and c++17:

https://isocpp.org/files/papers/p0636r0.html

。 。链接到此页面,该页面描述了建议的文件系统更改:

... It links to this page, which describes the proposed filesystem changes:

http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/p0218r0.html

我略读了一下。标准中的措词更改很小,但是我看到的唯一代码更改是名称空间更改,该更改删除了实验和 v1部分,因此 std :: experimental :: filesystem :: v1变成了 std :: filesystem

I skimmed through it. There are small wording changes to the standard, but the only code change I saw were namespace changes that removed the "experimental" and "v1" parts, so "std::experimental::filesystem::v1" became "std::filesystem", which is expected.

据我所知,除了命名空间路径之外,其他都没有改变。有人知道其他任何改变吗?

From what I can tell, nothing other than the namespace path changed. Does anyone know if anything else changed?

换句话说,我将gcc与-std = c ++ 14一起使用。我现在可以用std :: experimental :: filesystem编写代码,并且将来只要更改此命名空间就可以轻松切换到-std = c ++ 17吗?

In other words, I'm using gcc with -std=c++14. Can I write code now with std::experimental::filesystem and comfortably switch to -std=c++17 in the future with only this namespace change?

最近的问题我可以发现它们是重复项:

Closest questions I can find to being duplicates:

Boost文件系统和标准C ++文件系统库有何相似之处?

现代C ++的实验功能对长期项目是否可靠?

推荐答案

对文件系统库进行更改的主要论文是

The major papers making changes to the filesystem library are


  • P0219R1 ,添加了相对路径支持

  • P0317R1 ,将缓存添加到 dir ectory_entry

  • P0492R2 ,一长串修正和更改以响应国家机构的意见

  • P0430R2 ,支持某些非POSIX系统

  • P0219R1, adding relative paths support
  • P0317R1, adding caching to directory_entry
  • P0492R2, a lengthy list of fixes and changes in response to national body comments
  • P0430R2, support for certain non-POSIX systems

还有一些相对较小的修复程序和更改,可以找到 。查找状态为 C ++ 17的问题。请注意,其中一些更改随后被上面列出的论文所取代。

There are also some relatively minor fixes and changes that can be found in the LWG issue list. Look for issues with "C++17" status. Note that some of these changes are then superseded by the papers listed above.

对于现有的Filesystem TS代码,我希望P0492R2最重要,因为其余论文大多是功能的补充,而不是更改。 P0492R2包括技术说明和重大语义更改。紧随其后的是以下类别中的一些内容:

For existing Filesystem TS code, I expect that P0492R2 is the one that matters the most, since the remaining papers are mostly feature additions rather than changes. P0492R2 includes both technical clarifications and significant semantic changes. Some in the latter category that immediately come to mind are:


  • path(。profile)。stem( )现在是。profile

  • operator / path 上的$ c>的语义会发生很大变化。 path( / foo)/ / bar 现在是 / bar 而不是 / foo / bar ; Windows上的 path( C:\\x)/ D:y 现在是 D:y

  • 旧的绝对不见了。 system_complete 已重命名为 absolute

  • 权限的签名有微小变化。

  • path(".profile").stem() is now ".profile"
  • operator/ on path had its semantics changed significantly if the rhs is an absolute path or has a root-name. path("/foo") / "/bar" is now "/bar" rather than "/foo/bar"; path("C:\\x") / "D:y" on Windows is now "D:y".
  • The old absolute is gone. system_complete has been renamed absolute.
  • permissions's signature got a minor change.

这篇关于c ++ 14 std :: experimental :: filesystem :: v1和c ++ 17 std :: filesystem之间的区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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