This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of C++20 status.
Section: 31.12.12.2 [fs.rec.dir.itr.members] Status: C++20 Submitter: Casey Carter Opened: 2018-02-25 Last modified: 2021-02-25
Priority: 0
View all other issues in [fs.rec.dir.itr.members].
View all issues with C++20 status.
Discussion:
recursive_directory_iterator::pop is effectively a "supercharged" operator++: it advances the iterator forward as many steps as are necessary to reach the next entry in the parent directory. Just as is the case for operator++, pop must be allowed to invalidate iterator copies to allow efficient implementation. The most efficient fix seems to be borrowing the invalidation wording from 25.3.5.3 [input.iterators] Table 87's specification for the required ++r expression for input iterators.
[ 2018-03-06 Moved to Tentatively Ready after 5 positive votes on c++std-lib. ]
[2018-06 Rapperswil: Adopted]
Proposed resolution:
This wording is relative to N4727.
Change 31.12.12.2 [fs.rec.dir.itr.members] as indicated:
void pop(); void pop(error_code& ec);-26- Effects: If depth() == 0, set *this to recursive_directory_iterator(). Otherwise, cease iteration of the directory currently being iterated over, and continue iteration over the parent directory.
-?- Postconditions: Any copies of the previous value of *this are no longer required either to be dereferenceable or to be in the domain of ==.
-27- Throws: As specified in 31.12.5 [fs.err.report].