C ++ 17(std :: filesystem)是否提供与Boost.Filesystem相同的错误代码?

时间:2019-05-19 17:49:24

标签: c++ boost error-handling c++17 std-filesystem

我正在使用Boost.Filesystem准备代码,以最终实现C ++ 17 Xcode 10.x中std :: filesystem的可用性。是否存在跨平台方法来避免在这两个库之间进行转换,以解决常见的文件系统错误,例如:

  

no_such_file_or_directory(与ENOENT相同)

我希望能够在MacOS,Windows和Linux上以跨平台方式平稳过渡到C ++ 17 std :: filesystem支持。

(我看到其他张贴者为C ++ 17之前的版本(std :: filesystem之前的)编译器创建了自己的表搜索方法,但是由于std :: filesystem基于Boost.Filesystem,它是否可以更兼容?)< / p>

一些其他想法:

我看到C ++ std :: error_condition是CLASS,被称为“平台无关”。 boost :: system :: error_condition是一个类似的类,被视为“通用”类。

但是大多数boost文件系统操作都会返回boost :: system :: error_code。

本文很好地说明了我在c ++ std错误类的error_code和error_condition之间看到的断开连接。我希望提升效果会相同:

http://blog.think-async.com/2010/04/system-error-support-in-c0x-part-2.html

0 个答案:

没有答案