std::filesystem::path::iterator::reference
should be allowed to be std::filesystem::path
Section: 31.12.6.6 [fs.path.itr] Status: New Submitter: Jiang An Opened: 2022-10-17 Last modified: 2022-11-01
Priority: 3
View all other issues in [fs.path.itr].
View all issues with New status.
Discussion:
Currently, 31.12.6.6 [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.
[2022-11-01; Reflector poll]
Set priority to 3 after reflector poll.
Proposed resolution:
This wording is relative to N4917.
Modify 31.12.6.6 [fs.path.itr] as indicated:
-2- A
path::iterator
is a constant iterator meeting all the requirements of a bidirectional iterator (24.3.5.6 [bidirectional.iterators]) except that, for dereferenceable iteratorsa
andb
of typepath::iterator
witha == b
, there is no requirement that*a
and*b
are bound to the same object, and itsreference
may bepath
. Itsvalue_type
ispath
.