FreeBSD Manual Pages
std::filesy...ory_iterator(3) C++ Standard Libarystd::filesy...ory_iterator(3) NAME std::filesystem::directory_iterator::directory_iterator - std::filesys- tem::directory_iterator::directory_iterator Synopsis directory_iterator() noexcept; (1) (since C++17) explicit directory_iterator( const std::filesystem::path& p ); (2) (since C++17) directory_iterator( const std::filesystem::path& p, (3) (since C++17) std::filesystem::directory_options options); directory_iterator( const std::filesystem::path& p, (4) (since C++17) std::error_code& ec ); directory_iterator( const std::filesystem::path& p, std::filesystem::directory_options options, (5) (since C++17) std::error_code& ec ); directory_iterator( const directory_iterator& ) = default; (6) (since C++17) directory_iterator( directory_iterator&& ) = default; (7) (since C++17) Constructs a new directory iterator. 1) Constructs the end iterator. 2) Constructs a directory iterator that refers to the first direc- tory entry of a directory identified by p. If p refers to an non-existing file or not a directory, throws std::filesystem::filesystem_error. 3) Same as (2), but if std::filesystem::directory_options::skip_per- mission_denied is set in options and construction encounters a permissions denied er- ror, constructs the end iterator and does not report an error. 4) Constructs a directory iterator that refers to the first direc- tory entry of a directory identified by p. If p refers to an non-existing file or not a directory, returns the end iterator and sets ec. 5) Same as (4), but if std::filesystem::directory_options::skip_per- mission_denied is set in options and construction encounters a permissions denied er- ror, constructs the end iterator and does not report an error. Parameters This section is incomplete Exceptions 2-5) The overload that does not take a std::error_code& parameter throws filesystem::filesystem_error on underlying OS API errors, con- structed with p as the first path argument and the OS error code as the error code argu- ment. The overload taking a std::error_code& parameter sets it to the OS API error code if an OS API call fails, and executes ec.clear() if no errors occur. Any overload not marked noexcept may throw std::bad_alloc if memory allocation fails. Notes To iterate over the current directory, construct the iterator as directory_iterator(".") instead of directory_iterator(""). Defect reports The following behavior-changing defect reports were applied retroac- tively to previously published C++ standards. DR Applied to Behavior as published Correct behavior LWG 3013 C++17 error_code overload marked noexcept but can noexcept removed allocate memory http://cppreference.com 2022.07.31 std::filesy...ory_iterator(3)
NAME | Synopsis | Parameters | Exceptions | Notes
Want to link to this manual page? Use this URL:
<https://man.freebsd.org/cgi/man.cgi?query=std::filesystem::directory_iterator::directory_iterator&sektion=3&manpath=FreeBSD+Ports+15.0>
