27 Input/output library [input.output]

27.10 File systems [filesystems]

27.10.8 Class path [class.path]

27.10.8.5 path iterators [path.itr]

Path iterators iterate over the elements of pathstring in the generic format ([path.generic]).

A path::iterator is a constant iterator satisfying all the requirements of a bidirectional iterator ([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. Its value_type is path.

Calling any non-const member function of a path object invalidates all iterators referring to elements of that object.

For the elements of pathstring in the generic format, the forward traversal order is as follows:

  • The root-name element, if present.

  • The root-directory element, if present. [ Note: the generic format is required to ensure lexicographical comparison works correctly.  — end note ]

  • Each successive filename element, if present.

  • dot, if one or more trailing non-root slash characters are present.

The backward traversal order is the reverse of forward traversal.

iterator begin() const;

Returns: An iterator for the first present element in the traversal list above. If no elements are present, the end iterator.

iterator end() const;

Returns: The end iterator.