From Jason Turner

[fs.class.directory.iterator]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpmo9j2ti5/{from.md → to.md} +16 -10
tmp/tmpmo9j2ti5/{from.md → to.md} RENAMED
@@ -1,13 +1,15 @@
1
  ### Class `directory_iterator` <a id="fs.class.directory.iterator">[[fs.class.directory.iterator]]</a>
2
 
 
 
3
  An object of type `directory_iterator` provides an iterator for a
4
  sequence of `directory_entry` elements representing the path and any
5
  cached attribute values [[fs.class.directory.entry]] for each file in a
6
  directory or in an *implementation-defined* directory-like file type.
7
 
8
- [*Note 1*: For iteration into sub-directories, see class
9
  `recursive_directory_iterator` [[fs.class.rec.dir.itr]]. — *end note*]
10
 
11
  ``` cpp
12
  namespace std::filesystem {
13
  class directory_iterator {
@@ -35,10 +37,14 @@ namespace std::filesystem {
35
  const directory_entry& operator*() const;
36
  const directory_entry* operator->() const;
37
  directory_iterator& operator++();
38
  directory_iterator& increment(error_code& ec);
39
 
 
 
 
 
40
  // other members as required by [input.iterators], input iterators
41
  };
42
  }
43
  ```
44
 
@@ -57,12 +63,12 @@ Two end iterators are always equal. An end iterator shall not be equal
57
  to a non-end iterator.
58
 
59
  The result of calling the `path()` member of the `directory_entry`
60
  object obtained by dereferencing a `directory_iterator` is a reference
61
  to a `path` object composed of the directory argument from which the
62
- iterator was constructed with filename of the directory entry appended
63
- as if by `operator/=`.
64
 
65
  Directory iteration shall not yield directory entries for the current
66
  (dot) and parent (dot-dot) directories.
67
 
68
  The order of directory entries obtained by dereferencing successive
@@ -77,21 +83,21 @@ call any `directory_entry` `refresh` function.
77
  [*Note 2*: The exact mechanism for storing cached attribute values is
78
  not exposed to users. For exposition, class `directory_iterator` is
79
  shown in [[fs.class.directory.entry]] as a friend of class
80
  `directory_entry`. — *end note*]
81
 
82
- [*Note 3*: Programs performing directory iteration may wish to test if
83
- the path obtained by dereferencing a directory iterator actually exists.
84
- It could be a symbolic link to a non-existent file. Programs recursively
85
- walking directory trees for purposes of removing and renaming entries
86
- may wish to avoid following symbolic links. — *end note*]
87
 
88
  [*Note 4*: If a file is removed from or added to a directory after the
89
  construction of a `directory_iterator` for the directory, it is
90
  unspecified whether or not subsequently incrementing the iterator will
91
  ever result in an iterator referencing the removed or added directory
92
- entry. See POSIX `readdir_r`. — *end note*]
93
 
94
  #### Members <a id="fs.dir.itr.members">[[fs.dir.itr.members]]</a>
95
 
96
  ``` cpp
97
  directory_iterator() noexcept;
@@ -165,10 +171,10 @@ directory_iterator begin(directory_iterator iter) noexcept;
165
  ```
166
 
167
  *Returns:* `iter`.
168
 
169
  ``` cpp
170
- directory_iterator end(const directory_iterator&) noexcept;
171
  ```
172
 
173
  *Returns:* `directory_iterator()`.
174
 
 
1
  ### Class `directory_iterator` <a id="fs.class.directory.iterator">[[fs.class.directory.iterator]]</a>
2
 
3
+ #### General <a id="fs.class.directory.iterator.general">[[fs.class.directory.iterator.general]]</a>
4
+
5
  An object of type `directory_iterator` provides an iterator for a
6
  sequence of `directory_entry` elements representing the path and any
7
  cached attribute values [[fs.class.directory.entry]] for each file in a
8
  directory or in an *implementation-defined* directory-like file type.
9
 
10
+ [*Note 1*: For iteration into subdirectories, see class
11
  `recursive_directory_iterator` [[fs.class.rec.dir.itr]]. — *end note*]
12
 
13
  ``` cpp
14
  namespace std::filesystem {
15
  class directory_iterator {
 
37
  const directory_entry& operator*() const;
38
  const directory_entry* operator->() const;
39
  directory_iterator& operator++();
40
  directory_iterator& increment(error_code& ec);
41
 
42
+ bool operator==(default_sentinel_t) const noexcept {
43
+ return *this == directory_iterator();
44
+ }
45
+
46
  // other members as required by [input.iterators], input iterators
47
  };
48
  }
49
  ```
50
 
 
63
  to a non-end iterator.
64
 
65
  The result of calling the `path()` member of the `directory_entry`
66
  object obtained by dereferencing a `directory_iterator` is a reference
67
  to a `path` object composed of the directory argument from which the
68
+ iterator was constructed with the filename of the directory entry
69
+ appended as if by `operator/=`.
70
 
71
  Directory iteration shall not yield directory entries for the current
72
  (dot) and parent (dot-dot) directories.
73
 
74
  The order of directory entries obtained by dereferencing successive
 
83
  [*Note 2*: The exact mechanism for storing cached attribute values is
84
  not exposed to users. For exposition, class `directory_iterator` is
85
  shown in [[fs.class.directory.entry]] as a friend of class
86
  `directory_entry`. — *end note*]
87
 
88
+ [*Note 3*: A path obtained by dereferencing a directory iterator might
89
+ not actually exist; it could be a symbolic link to a non-existent file.
90
+ Recursively walking directory trees for purposes of removing and
91
+ renaming entries might invalidate symbolic links that are being
92
+ followed. — *end note*]
93
 
94
  [*Note 4*: If a file is removed from or added to a directory after the
95
  construction of a `directory_iterator` for the directory, it is
96
  unspecified whether or not subsequently incrementing the iterator will
97
  ever result in an iterator referencing the removed or added directory
98
+ entry. See POSIX `readdir`. — *end note*]
99
 
100
  #### Members <a id="fs.dir.itr.members">[[fs.dir.itr.members]]</a>
101
 
102
  ``` cpp
103
  directory_iterator() noexcept;
 
171
  ```
172
 
173
  *Returns:* `iter`.
174
 
175
  ``` cpp
176
+ directory_iterator end(directory_iterator) noexcept;
177
  ```
178
 
179
  *Returns:* `directory_iterator()`.
180