std::experimental::filesystem::recursive_directory_iterator:: disable_recursion_pending
Technical Specification | ||||
Filesystem library (filesystem TS) | ||||
Library fundamentals (library fundamentals TS) | ||||
Library fundamentals 2 (library fundamentals TS v2) | ||||
Library fundamentals 3 (library fundamentals TS v3) | ||||
Extensions for parallelism (parallelism TS) | ||||
Extensions for parallelism 2 (parallelism TS v2) | ||||
Extensions for concurrency (concurrency TS) | ||||
Extensions for concurrency 2 (concurrency TS v2) | ||||
Concepts (concepts TS) | ||||
Ranges (ranges TS) | ||||
Reflection (reflection TS) | ||||
Mathematical special functions (special functions TR) | ||||
Experimental Non-TS | ||||
Pattern Matching | ||||
Linear Algebra | ||||
std::execution | ||||
Contracts | ||||
2D Graphics |
Classes | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Functions | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
File types | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Member functions | ||||
recursive_directory_iterator::disable_recursion_pending
|
||||
Non-member functions | ||||
void
disable_recursion_pending
(
)
;
|
(filesystem TS) | |
Disables recursion to the currently referred subdirectory, if any.
The call modifies the pending recursion flag on the iterator in such a way that the next time increment is called, the iterator will advance within the current directly even if it is currently referring to a subdirectory that hasn't been visited.
The status of the pending recursion flag can be queried with recursion_pending() , which is false after this call. It is reset back to true after increment , and its initial value is also true .
The behavior is undefined if * this is the end iterator.
Parameters
(none)
Return value
(none)
Exceptions
May throw implementation-defined exceptions.
Example
#include <experimental/filesystem> #include <fstream> #include <iostream> #include <string> namespace fs = std::experimental::filesystem; int main() { fs::create_directories("sandbox/a/b/c"); fs::create_directories("sandbox/a/b/d/e"); std::ofstream("sandbox/a/b/file1.txt"); fs::create_symlink("a", "sandbox/syma"); for (auto i = fs::recursive_directory_iterator("sandbox"); i != fs::recursive_directory_iterator(); ++i) { std::cout << std::string(i.depth(), ' ') << *i; if (fs::is_symlink(i->symlink_status())) std::cout << " -> " << fs::read_symlink(*i); std::cout << '\n'; // do not descend into "b" if (i->path().filename() == "b") i.disable_recursion_pending(); } fs::remove_all("sandbox"); }
Output:
"sandbox/a" "sandbox/a/b" "sandbox/syma" -> "a"
See also
checks whether the recursion is disabled for the current directory
(public member function) |
|
advances to the next entry
(public member function) |