[fs.dir.itr.members]

# 31 Input/output library [[input.output]](./#input.output)

## 31.12 File systems [[filesystems]](filesystems#fs.dir.itr.members)

### 31.12.11 Class directory_iterator [[fs.class.directory.iterator]](fs.class.directory.iterator#fs.dir.itr.members)

#### 31.12.11.2 Members [fs.dir.itr.members]

[ð](#lib:directory_iterator,constructor)

`directory_iterator() noexcept;
`

[1](#1)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L16655)

*Effects*: Constructs the end iterator[.](#1.sentence-1)

[ð](#lib:directory_iterator,constructor_)

`explicit directory_iterator(const path& p);
directory_iterator(const path& p, directory_options options);
directory_iterator(const path& p, error_code& ec);
directory_iterator(const path& p, directory_options options, error_code& ec);
`

[2](#2)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L16669)

*Effects*: For the directory that p resolves to, constructs an
iterator for the first element in a sequence of directory_entry elements representing the files in the directory, if any; otherwise the end
iterator[.](#2.sentence-1)

However, if(options & directory_options::skip_permission_denied) != directory_options::none and construction encounters an error indicating
that permission to access p is denied, constructs the end iterator
and does not report an error[.](#2.sentence-2)

[3](#3)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L16682)

*Throws*: As specified in [[fs.err.report]](fs.err.report "31.12.5 Error reporting")[.](#3.sentence-1)

[4](#4)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L16686)

[*Note [1](#note-1)*:

To iterate over the current directory, use directory_iterator(".") rather than directory_iterator("")[.](#4.sentence-1)

â *end note*]

[ð](#lib:directory_iterator,constructor__)

`directory_iterator(const directory_iterator& rhs);
directory_iterator(directory_iterator&& rhs) noexcept;
`

[5](#5)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L16699)

*Postconditions*: *this has the original value of rhs[.](#5.sentence-1)

[ð](#lib:operator=,directory_iterator)

`directory_iterator& operator=(const directory_iterator& rhs);
directory_iterator& operator=(directory_iterator&& rhs) noexcept;
`

[6](#6)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L16711)

*Effects*: If *this and rhs are the same
 object, the member has no effect[.](#6.sentence-1)

[7](#7)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L16716)

*Postconditions*: *this has the original value of rhs[.](#7.sentence-1)

[8](#8)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L16720)

*Returns*: *this[.](#8.sentence-1)

[ð](#lib:increment,directory_iterator)

`directory_iterator& operator++();
directory_iterator& increment(error_code& ec);
`

[9](#9)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L16733)

*Effects*: As specified for the prefix increment operation of[Input iterators](input.iterators "24.3.5.3 Input iterators [input.iterators]")[.](#9.sentence-1)

[10](#10)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L16738)

*Returns*: *this[.](#10.sentence-1)

[11](#11)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L16742)

*Throws*: As specified in [[fs.err.report]](fs.err.report "31.12.5 Error reporting")[.](#11.sentence-1)
