Title
recursive_directory_iterator::pop must invalidate
Status
c++20
Section
[fs.rec.dir.itr.members]
Submitter
Casey Carter

Created on 2018-02-25.00:00:00 last changed 38 months ago

Messages

Date: 2018-06-12.01:05:16

Proposed resolution:

This wording is relative to N4727.

  1. Change [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 [fs.err.report].

Date: 2018-06-12.01:05:16

[ 2018-06 Rapperswil: Adopted ]

Date: 2018-03-06.00:00:00

[ 2018-03-06 Moved to Tentatively Ready after 5 positive votes on c++std-lib. ]

Date: 2018-02-25.00:00:00

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 [input.iterators] Table 87's specification for the required ++r expression for input iterators.

History
Date User Action Args
2021-02-25 10:48:01adminsetstatus: wp -> c++20
2018-06-12 01:05:16adminsetmessages: + msg9883
2018-06-12 01:05:16adminsetstatus: voting -> wp
2018-05-06 19:23:13adminsetstatus: ready -> voting
2018-03-07 17:22:08adminsetmessages: + msg9715
2018-03-07 17:22:08adminsetstatus: new -> ready
2018-02-26 04:24:39adminsetmessages: + msg9690
2018-02-25 00:00:00admincreate