[Bug libstdc++/100631] ranges::elements_view:: _Sentinel is missing __distance_from() that can access _M_current of _Iterator
hewillk at gmail dot com
gcc-bugzilla@gcc.gnu.org
Mon May 17 03:45:08 GMT 2021
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100631
--- Comment #1 from 康桓瑋 <hewillk at gmail dot com> ---
Another issue is that in elements_view::_Sentinel in ranges#L3677:
template<bool _Const2,
typename _Base2 = __detail::__maybe_const_t<_Const2, _Vp>>
requires sized_sentinel_for<sentinel_t<_Base>, iterator_t<_Base2>>
friend constexpr range_difference_t<_Base2>
operator-(const _Iterator<_Const2>& __x, const _Sentinel& __y)
{ return __x._M_current - __y._M_end; }
the return type of the function is range_difference_t<_Base2>, but in
[range.elements#sentinel], it is defined as range_difference_t<Base>:
template<bool OtherConst>
requires sized_sentinel_for<sentinel_t<Base>, iterator_t<maybe-
const<OtherConst, V>>>
friend constexpr range_difference_t<Base>
operator-(const iterator<OtherConst>& x, const sentinel& y);
Perhaps range_difference_t<Base> and range_difference_t<_Base2> are equivalent
in this case, but I am not sure.
More information about the Gcc-bugs
mailing list