我明白了here boost::filesystem::is_regular
由 BOOST_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;
}
来源:
- https://github.com/boostorg/filesystem/blob/de527c68623eba5b87aa7442a48bd18d90e1b26d/include/boost/filesystem/operations.hpp#L321
- https://github.com/boostorg/filesystem/blob/de527c68623eba5b87aa7442a48bd18d90e1b26d/include/boost/filesystem/operations.hpp#L332
我怀疑当 Filesystem TS 时 is_regular()
已被弃用。决定改为调用该函数 is_regular_file()
。
关于c++ - boost 文件系统中 is_regular 和 is_regular_file 之间的区别,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37899431/