https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100070

--- Comment #4 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Barry suggested out-of-band that we could change std::__iterator_category to
determine the result based on the C++20 iterator concepts. That looks
promising.

std::distance dispatches on the result of std::__iterator_category, and doesn't
care whether some meets all the Cpp17RandomAccessIterator requirements, it only
cares whether (last - first) is valid and efficient.

We need to audit all the uses of std::__iterator_category to see whether any
code in libstdc++ that gets used for std::forward_iterator_tag actually depends
on the reference type being a reference. So far it looks like the answer is no.

Reply via email to