You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describes an input iterator that sequences through the filenames in a directory. For an iterator `X`, the expression `*X` evaluates to an object of class `directory_entry` that wraps the filename and anything known about its status.
14
14
15
15
The class stores an object of type `path`, called `mydir` here for the purposes of exposition, which represents the name of the directory to be sequenced, and an object of type `directory_entry` called `myentry` here, which represents the current filename in the directory sequence. A default constructed object of type `directory_entry` has an empty `mydir` pathname and represents the end-of-sequence iterator.
16
16
17
17
For example, given the directory `abc` with entries `def` and `ghi`, the code:
18
18
19
-
`for (directory_iterator next(path("abc")), end; next != end; ++next) visit(next->path());`
19
+
`for (directory_iterator next(path("abc")), end; next != end; ++next) visit(next->path());`
20
20
21
-
will call`visit` with the arguments `path("abc/def")` and `path("abc/ghi")`.
21
+
calls`visit` with the arguments `path("abc/def")` and `path("abc/ghi")`.
22
22
23
23
For more information and code examples, see [File System Navigation (C++)](../standard-library/file-system-navigation.md).
24
24
@@ -32,34 +32,34 @@ class directory_iterator;
32
32
33
33
|Constructor|Description|
34
34
|-|-|
35
-
|[directory_iterator](#directory_iterator)|Constructs an input iterator that sequences through the filenames in a directory.|
35
+
|[`directory_iterator`](#directory_iterator)|Constructs an input iterator that sequences through the filenames in a directory.|
36
36
37
37
### Member functions
38
38
39
39
|Member function|Description|
40
40
|-|-|
41
-
|[increment](#increment)|Attempts to advance to the next filename in the directory.|
41
+
|[`increment`](#increment)|Attempts to advance to the next filename in the directory.|
|[operator=](#op_as)|The defaulted member assignment operators behave as expected.|
49
-
|[operator==](#op_eq)|Returns **`true`** only if both **`*this`** and *right* are end-of-sequence iterators or both aren't end-of-sequence-iterators.|
50
-
|[operator*](#op_star)|Returns `myentry`.|
51
-
|[operator->](#op_cast)|Returns `&**this`.|
52
-
|[operator++](#op_increment)|Calls `increment()`, then returns **`*this`**, or makes a copy of the object, calls `increment()`, then returns the copy.|
|[`operator=`](#op_as)|The defaulted member assignment operators behave as expected.|
49
+
|[`operator==`](#op_eq)|Returns **`true`** only if both **`*this`** and *`right`* are end-of-sequence iterators or both aren't end-of-sequence-iterators.|
50
+
|[`operator*`](#op_star)|Returns `myentry`.|
51
+
|[`operator->`](#op_cast)|Returns `&**this`.|
52
+
|[`operator++`](#op_increment)|Calls `increment()`, then returns **`*this`**, or makes a copy of the object, calls `increment()`, then returns the copy.|
The first constructor produces an end-of-sequence iterator. The second and third constructors store *pval* in `mydir`, then attempt to open and read `mydir` as a directory. If successful, they store the first filename in the directory in `myentry`; otherwise they produce an end-of-sequence iterator.
62
+
The first constructor produces an end-of-sequence iterator. The second and third constructors store *`pval`* in `mydir`, then attempt to open and read `mydir` as a directory. If successful, they store the first filename in the directory in `myentry`; otherwise they produce an end-of-sequence iterator.
The function attempts to advance to the next filename in the directory. If successful, it stores that filename in `myentry`; otherwise it produces an end-of-sequence iterator.
The first member function calls `increment()`, then returns **`*this`**. The second member function makes a copy of the object, calls `increment()`, then returns the copy.
0 commit comments