std::filesy...ory_iterator(3)
π NAME π
okay so bestie, this is std::filesystem::recursive_directory_iterator::recursive_directory_iterator, straight from the C++ Standard Libary manual β yes, the page is literally std::filesy...ory_iterator(3) and the name is a whole mouthful, but we move π
. Itβs the constructor page for std::filesystem::recursive_directory_iterator, and itβs giving βlet me build you a recursive directory iteratorβ energy.
β¨ Synopsis β¨
Constructs a new recursive directory iterator. Here are all seven overloads, each one since C++17:
recursive_directory_iterator() noexcept;β(1), since C++17. Default constructor; constructs an end iterator.recursive_directory_iterator( const recursive_directory_iterator& other );β(2), since C++17. Copy constructor.recursive_directory_iterator( recursive_directory_iterator&& other ) noexcept;β(3), since C++17. Move constructor.explicit recursive_directory_iterator( const std::filesystem::path& p );β(4), since C++17.recursive_directory_iterator( const std::filesystem::path& p, std::filesystem::directory_options options );β(5), since C++17.recursive_directory_iterator( const std::filesystem::path& p, std::filesystem::directory_options options, std::error_code& ec );β(6), since C++17.recursive_directory_iterator( const std::filesystem::path& p, std::error_code& ec );β(7), since C++17.
(4)β(7) β constructs an iterator that refers to the first entry in the directory that p resolves to.
β οΈ This section is incomplete β Reason: errors.
π¦ Parameters π¦
pβ path to the filesystem object to which the directory iterator will refer.ecβ out-parameter for error reporting in the non-throwing overloads.optionsβ the set ofBitmaskTypeoptions that control the behavior of the directory iterator.otherβ another directory iterator to use as source to initialize the directory iterator with.
π Exceptions π
Any overload not marked noexcept may throw std::bad_alloc if memory allocation fails. no cap, even the βchillβ ones can still hit an allocation fail π.
4,5)β throwsstd::filesystem::filesystem_erroron underlying OS API errors, constructed withpas the first path argument and the OS error code as the error code argument.6,7)β sets astd::error_code¶meter to the OS API error code if an OS API call fails, and executesec.clear()if no errors occur.
πΈ Notes πΈ
Recursive directory iterators do not follow directory symlinks by default. To enable this behavior, specify directory_options::follow_directory_symlink among the options option set. iykyk π«Ά.
π Example π
β οΈ This section is incomplete β Reason: no example.
π Defect reports π
The following behavior-changing defect reports were applied retroactively to previously published C++ standards.
- DR:
LWG 3013 - Applied to:
C++17 - Behavior as published:
error_codeoverload markednoexceptbut can allocate memory - Correct behavior:
noexceptremoved
π Categories π
- Todo with reason
- Todo no example
signing off with source/version http://cppreference.com, date 2024.06.10, and manual std::filesy...ory_iterator(3) πβ¨ periodt.
π¦ where this page comes from
- nixpkgs unstable: stdman 2024.07.05
- opensuse-leap 16.0: stdman 2024.07.05-bp160.1.9 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms