c++ - boost 文件系统中 is_regular 和 is_regular_file 之间的区别

标签 c++ boost boost-filesystem

我明白了here boost::filesystem::is_regularBOOST_FILESYSTEM_NO_DEPRECATED 保护,因此我认为不应再使用它。

我在文件上测试了这两种方法,它们似乎给出了相同的结果,但鉴于我在任何地方都找不到这些方法的文档,boost::filesystem::is_regular<之间的实际区别是什么boost::filesystem::is_regular_file?它们是相同的东西还是前者更通用(例如:常规符号链接(symbolic link)等)?

最佳答案

它们是相同的:

inline bool is_regular_file(file_status f) BOOST_NOEXCEPT {
  return f.type() == regular_file;
}

inline bool is_regular(file_status f) BOOST_NOEXCEPT {
  return f.type() == regular_file;
}

来源:

我怀疑当 Filesystem TSis_regular() 已被弃用。决定改为调用该函数 is_regular_file()

关于c++ - boost 文件系统中 is_regular 和 is_regular_file 之间的区别,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37899431/

相关文章:

java - 在 Java 中修复你的时间步长

c++ - 枚举变量作为动态模板参数

c++ - 这个 getter 返回的是构造函数给出的引用还是类内部对象的引用? C++

c++ - 在 callback 和 main 之间传递一个变量

c++ - 哪个带有 boost 的 mpi 存档?

c++ - C++ 类的构造函数中的线程池被杀死

c++ - 打开文件,不存在则创建,判断是否创建

c++ - 无法从主窗口打开小部件

c++ - 将 Boost.Filesystem 静态链接到共享库时出现问题

c++ - 如何使用 boost::filesystem 检查文件是常规文件还是符号链接(symbolic link)?