std::filesystem::directory_iterator::directory_iterator

From cppreference.com
 
 
 
 
directory_iterator();
(1) (since C++17)
explicit directory_iterator( const std::filesystem::path& p );
(2) (since C++17)
directory_iterator( const std::filesystem::path& p, std::error_code& ec );
(3) (since C++17)
directory_iterator( const directory_iterator& ) = default;
(4) (since C++17)
directory_iterator( directory_iterator&& ) = default;
(5) (since C++17)

Constructs a new directory iterator.

1) Constructs the end iterator.
2) Constructs a directory iterator that refers to the first directory entry of a directory identified by p. If p refers to an non-existing file or not a directory, returns the end iterator.

Parameters

Exceptions

1)
noexcept specification:  
noexcept
  
2) std::filesystem::filesystem_error if an error occurs. The exception object is constructed with p as an argument.
3)
noexcept specification:  
noexcept
  

Notes

To iterate over the current directory, construct the iterator as directory_iterator(".") instead of directory_iterator("").