std::experimental::filesystem::directory_iterator - cppreference.com

##### cppreference.com

##### Search

Create account

##### Namespaces

- Page
- Discussion

##### Variants

##### Views

- View
- Edit
- History

##### Actions

# std::experimental::filesystem::directory_iterator

From cppreference.com
< cpp‎ | experimental‎ | fs

Defined in header `<experimental/filesystem>` |  |
class directory_iterator : public std::iterator<input_iterator_tag, directory_entry>; |  | (filesystem TS)

directory_iterator is an input iterator that can advance through entries of a directory. Directory iteration never returns directory entries to the current (dot) and parent (dot-dot) directories. The order of directory entries is unspecified.

The past-the-end iterator (simply called the end iterator) is a special iterator. An end iterator is always equal to an end iterator and never equal to a non-end iterator. An end iterator is created by the default constructor of directory iterator and when a directory iterator is advanced past the last directory element. Calling operator* or operator-> on an end iterator yields undefined behavior.

If a file in a directory is deleted after the directory iterator has been created, the directory iterator may return a directory entry to the deleted file. If, on the other hand, a new file is created after the directory iterator has been created, iteration of the directory is not guaranteed to return a directory entry to the new file.

### [edit] Member functions

(constructor) | constructs a directory iterator (public member function) [edit]
(destructor) | default destructor (public member function) [edit]
operator= | assigns contents (public member function) [edit]
operator*operator-> | accesses the pointed-to entry (public member function) [edit]
incrementoperator++ | advances to the next entry (public member function) [edit]

Retrieved from "http://en.cppreference.com/mwiki/index.php?title=cpp/experimental/fs/directory_iterator&oldid=68517"