https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120415
--- Comment #10 from Jonathan Wakely <redi at gcc dot gnu.org> ---
There's a one-line fix:
[[nodiscard]] constexpr friend difference_type operator-(const
TransformIterator& x, const TransformIterator& y)
+ requires std::sized_sentinel_for<Iterator, Iterator>
{
return x.it - y.it;
}
This disables operator- for TransformIterator if the underlying iterator
doesn't support it, and that's enough to prevent the C++20 library trying to
use TransformIterator as a C++20 random access iterator.
Since this code attempts to be valid C++20 (e.g. it defines operator<=> for
Transformiterator) it REALLY needs to do this.
Ideally they should constrained ALL the operators on that adaptor.