Namespaces
Variants
Views
Actions

std::filesystem::recursive_directory_iterator::recursive_directory_iterator

From cppreference.com
 
 
 
 
recursive_directory_iterator() noexcept;
(1) (since C++17)
recursive_directory_iterator( const recursive_directory_iterator& rhs );
(2) (since C++17)
recursive_directory_iterator( recursive_directory_iterator&& rhs ) noexcept;
(3) (since C++17)
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 );
(4) (since C++17)
recursive_directory_iterator(

  const std::filesystem::path& p,
  std::filesystem::directory_options options,

  std::error_code& ec ) noexcept;
(5) (since C++17)
recursive_directory_iterator( const std::filesystem::path& p, std::error_code& ec ) noexcept;
(6) (since C++17)

Contructs new recursive directory iterator.

1) Default constructor. Constructs an end iterator.
2) Copy constructor.
3) Move constructor.
4-6) Constructs a iterator that refers to the first entry in the directory that p resolves to.

[edit] Parameters

[edit] Exceptions

The overload that does not take a std::error_code& parameter throws filesystem_error on underlying OS API errors, constructed with p as the first argument and the OS error code as the error code argument. std::bad_alloc may be thrown if memory allocation fails. 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.

[edit] 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.