93 lines
3.1 KiB
Markdown
93 lines
3.1 KiB
Markdown
[fs.path.itr]
|
||
|
||
# 31 Input/output library [[input.output]](./#input.output)
|
||
|
||
## 31.12 File systems [[filesystems]](filesystems#fs.path.itr)
|
||
|
||
### 31.12.6 Class path [[fs.class.path]](fs.class.path#fs.path.itr)
|
||
|
||
#### 31.12.6.6 Iterators [fs.path.itr]
|
||
|
||
[1](#1)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L15281)
|
||
|
||
Path iterators iterate over the elements of the pathname
|
||
in the [generic format](fs.path.generic "31.12.6.2 Generic pathname format [fs.path.generic]")[.](#1.sentence-1)
|
||
|
||
[2](#2)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L15285)
|
||
|
||
A path::iterator is a constant iterator meeting all the
|
||
requirements of a [bidirectional iterator](bidirectional.iterators "24.3.5.6 Bidirectional iterators [bidirectional.iterators]") except that,
|
||
for dereferenceable iterators a and b of type path::iterator with a == b,
|
||
there is no requirement that *a and *b are bound to the same object[.](#2.sentence-1)
|
||
|
||
Its value_type is path[.](#2.sentence-2)
|
||
|
||
[3](#3)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L15296)
|
||
|
||
Calling any non-const member function of a path object
|
||
invalidates all iterators referring to elements of that object[.](#3.sentence-1)
|
||
|
||
[4](#4)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L15300)
|
||
|
||
For the elements of the pathname in the generic format,
|
||
the forward traversal order is as follows:
|
||
|
||
- [(4.1)](#4.1)
|
||
|
||
The [*root-name*](fs.path.generic#nt:root-name "31.12.6.2 Generic pathname format [fs.path.generic]") element, if present[.](#4.1.sentence-1)
|
||
|
||
- [(4.2)](#4.2)
|
||
|
||
The [*root-directory*](fs.path.generic#nt:root-directory "31.12.6.2 Generic pathname format [fs.path.generic]") element, if present[.](#4.2.sentence-1)
|
||
[*Note [1](#note-1)*:
|
||
It is possible that the use of the generic format is needed
|
||
to ensure correct lexicographical comparison[.](#4.2.sentence-2)
|
||
â *end note*]
|
||
|
||
- [(4.3)](#4.3)
|
||
|
||
Each successive [*filename*](fs.path.generic#nt:filename "31.12.6.2 Generic pathname format [fs.path.generic]") element, if present[.](#4.3.sentence-1)
|
||
|
||
- [(4.4)](#4.4)
|
||
|
||
An empty element, if a trailing non-root [*directory-separator*](fs.path.generic#nt:directory-separator "31.12.6.2 Generic pathname format [fs.path.generic]") is present[.](#4.4.sentence-1)
|
||
|
||
[5](#5)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L15315)
|
||
|
||
The backward traversal order is the reverse of forward traversal[.](#5.sentence-1)
|
||
|
||
[ð](#lib:begin,path)
|
||
|
||
`iterator begin() const;
|
||
`
|
||
|
||
[6](#6)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L15324)
|
||
|
||
*Returns*: An iterator for the first present element in the traversal
|
||
list above[.](#6.sentence-1)
|
||
|
||
If no elements are present, the end iterator[.](#6.sentence-2)
|
||
|
||
[ð](#lib:end,path)
|
||
|
||
`iterator end() const;
|
||
`
|
||
|
||
[7](#7)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L15336)
|
||
|
||
*Returns*: The end iterator[.](#7.sentence-1)
|