tmp/tmp2fe3l6_7/{from.md → to.md}
RENAMED
|
@@ -0,0 +1,97 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#### General <a id="fs.class.directory.iterator.general">[[fs.class.directory.iterator.general]]</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 subdirectories, see class
|
| 9 |
+
`recursive_directory_iterator` [[fs.class.rec.dir.itr]]. — *end note*]
|
| 10 |
+
|
| 11 |
+
``` cpp
|
| 12 |
+
namespace std::filesystem {
|
| 13 |
+
class directory_iterator {
|
| 14 |
+
public:
|
| 15 |
+
using iterator_category = input_iterator_tag;
|
| 16 |
+
using value_type = directory_entry;
|
| 17 |
+
using difference_type = ptrdiff_t;
|
| 18 |
+
using pointer = const directory_entry*;
|
| 19 |
+
using reference = const directory_entry&;
|
| 20 |
+
|
| 21 |
+
// [fs.dir.itr.members], member functions
|
| 22 |
+
directory_iterator() noexcept;
|
| 23 |
+
explicit directory_iterator(const path& p);
|
| 24 |
+
directory_iterator(const path& p, directory_options options);
|
| 25 |
+
directory_iterator(const path& p, error_code& ec);
|
| 26 |
+
directory_iterator(const path& p, directory_options options,
|
| 27 |
+
error_code& ec);
|
| 28 |
+
directory_iterator(const directory_iterator& rhs);
|
| 29 |
+
directory_iterator(directory_iterator&& rhs) noexcept;
|
| 30 |
+
~directory_iterator();
|
| 31 |
+
|
| 32 |
+
directory_iterator& operator=(const directory_iterator& rhs);
|
| 33 |
+
directory_iterator& operator=(directory_iterator&& rhs) noexcept;
|
| 34 |
+
|
| 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 |
+
bool operator==(default_sentinel_t) const noexcept {
|
| 41 |
+
return *this == directory_iterator();
|
| 42 |
+
}
|
| 43 |
+
|
| 44 |
+
// other members as required by [input.iterators], input iterators
|
| 45 |
+
};
|
| 46 |
+
}
|
| 47 |
+
```
|
| 48 |
+
|
| 49 |
+
`directory_iterator` meets the *Cpp17InputIterator* requirements
|
| 50 |
+
[[input.iterators]].
|
| 51 |
+
|
| 52 |
+
If an iterator of type `directory_iterator` reports an error or is
|
| 53 |
+
advanced past the last directory element, that iterator shall become
|
| 54 |
+
equal to the end iterator value. The `directory_iterator` default
|
| 55 |
+
constructor shall create an iterator equal to the end iterator value,
|
| 56 |
+
and this shall be the only valid iterator for the end condition.
|
| 57 |
+
|
| 58 |
+
The end iterator is not dereferenceable.
|
| 59 |
+
|
| 60 |
+
Two end iterators are always equal. An end iterator shall not be equal
|
| 61 |
+
to a non-end iterator.
|
| 62 |
+
|
| 63 |
+
The result of calling the `path()` member of the `directory_entry`
|
| 64 |
+
object obtained by dereferencing a `directory_iterator` is a reference
|
| 65 |
+
to a `path` object composed of the directory argument from which the
|
| 66 |
+
iterator was constructed with the filename of the directory entry
|
| 67 |
+
appended as if by `operator/=`.
|
| 68 |
+
|
| 69 |
+
Directory iteration shall not yield directory entries for the current
|
| 70 |
+
(dot) and parent (dot-dot) directories.
|
| 71 |
+
|
| 72 |
+
The order of directory entries obtained by dereferencing successive
|
| 73 |
+
increments of a `directory_iterator` is unspecified.
|
| 74 |
+
|
| 75 |
+
Constructors and non-const `directory_iterator` member functions store
|
| 76 |
+
the values of any cached attributes [[fs.class.directory.entry]] in the
|
| 77 |
+
`directory_entry` element returned by `operator*()`.
|
| 78 |
+
`directory_iterator` member functions shall not directly or indirectly
|
| 79 |
+
call any `directory_entry` `refresh` function.
|
| 80 |
+
|
| 81 |
+
[*Note 2*: The exact mechanism for storing cached attribute values is
|
| 82 |
+
not exposed to users. For exposition, class `directory_iterator` is
|
| 83 |
+
shown in [[fs.class.directory.entry]] as a friend of class
|
| 84 |
+
`directory_entry`. — *end note*]
|
| 85 |
+
|
| 86 |
+
[*Note 3*: A path obtained by dereferencing a directory iterator might
|
| 87 |
+
not actually exist; it could be a symbolic link to a non-existent file.
|
| 88 |
+
Recursively walking directory trees for purposes of removing and
|
| 89 |
+
renaming entries might invalidate symbolic links that are being
|
| 90 |
+
followed. — *end note*]
|
| 91 |
+
|
| 92 |
+
[*Note 4*: If a file is removed from or added to a directory after the
|
| 93 |
+
construction of a `directory_iterator` for the directory, it is
|
| 94 |
+
unspecified whether or not subsequently incrementing the iterator will
|
| 95 |
+
ever result in an iterator referencing the removed or added directory
|
| 96 |
+
entry. See POSIX `readdir`. — *end note*]
|
| 97 |
+
|