gpt4 book ai didi

c++ - directory_iterator 和/或 recursive_directory_iterator 是否保证返回相对路径?

转载 作者:太空狗 更新时间:2023-10-29 22:55:26 26 4
gpt4 key购买 nike

std::filesystem::directory_iterator 和/或 std::filesystem::recursive_directory_iterator 保证返回std: :filesystem::directory_entry 对象的路径相对于它们初始化时使用的基本目录?
或者他们可能返回带有绝对路径的条目?

最佳答案

来自 Filesystem draft N4100 :

The result of calling the path() member of the directory_entry object obtained by dereferencing a directory_iterator is a reference to a path object composed of the directory ar gument from which the iterator was constructed with filename of the directory entry appended as if by operator/=

所以看起来答案是:路径是相对于迭代器构造的路径的。

关于c++ - directory_iterator 和/或 recursive_directory_iterator 是否保证返回相对路径?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52146127/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com