std::filesystem::path::iterator::reference should be allowed to be std::filesystem::path
Jiang An

Created on 2022-10-17.00:00:00 last changed 13 months ago


Date: 2022-11-01.17:49:23

Proposed resolution:

This wording is relative to N4917.

  1. Modify [fs.path.itr] as indicated:

    -2- A path::iterator is a constant iterator meeting 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, and its reference may be path. Its value_type is path.

Date: 2022-11-15.00:00:00

[ 2022-11-01; Reflector poll ]

Set priority to 3 after reflector poll.

Date: 2022-10-17.00:00:00

Currently, [fs.path.itr]/2 effectively requires std::filesystem::path::iterator::reference to be a reference type, due to the requirements for (legacy) bidirectional iterators. However, it's reasonable for the operator* to return path by value, which can make the iterator model std::bidirectional_iterator, be compatible with std::reverse_iterator, and avoid complicated data structures (e.g. those in libstdc++) for achieving such purpose.

libc++ is already doing so. I think we should make such a strategy conforming.

Date User Action Args
2022-11-01 17:49:23adminsetmessages: + msg12913
2022-10-22 11:38:06adminsetmessages: + msg12880
2022-10-17 00:00:00admincreate