简体   繁体   中英

is C++17 std::filesystem::recursive_directory_iterator::pop equal to boost::filesystem::recursive_directory_iterator::no_push

As the C++17 std::filesystem is very similar to the boost::filesystem , I was trying to do the same thing asked in this question: Escaping some Directories in iteration

But I found out that in the std::filesystem::recursive_directory_iterator there is no no_push method implemented, and the nearest match to it is the pop method, but are they exactly equal in functionality?

The equivalent of no_push() or no_push(true) is disable_recursion_pending() .

There's no equivalent of no_push(false) .

They are not at all the same. std::filesystem::recursive_directory_iterator::pop

Moves the iterator one level up in the directory hierarchy.

Where as boost::filesystem::recursive_directory::no_push

Prevents the next iteration on a directory from moving into that directory.

no_push does not change the current iterator where as pop moves the iterator up. Boost also has a pop method that is the same as the standard.

The Standard has options, without them it will not iterate a symlink folder, where as you would use no_posh with boost to avoid iterating into a symlink folder.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM