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

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           See Also|                            |https://gcc.gnu.org/bugzill
                   |                            |a/show_bug.cgi?id=102181

--- Comment #10 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to Jonathan Wakely from comment #4)
> 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.

I have a patch to do this for PR 102181 however the suggested direction for lwg
3197 is to require Cpp17InputIterator for std distance, and not Do The Right
Thing for C++20 iterators. We could of course so it anyway as a valid
interpretation of a precondition violation.

Reply via email to