Once we fix #614, we have an additional problem in iota_view<U,U>::iterator::operator- for an unsigned integral type U. The expected behavior is:
return x.value_ - y.value_;
However, if y.value_ > x.value_, then the result wraps to a large positive number. Once #614 is fixed, operator- will return a type that is capable of representing this large number, and so rather than returning a negative, we'll return a large positive.
Assuming 2s compliment (can we yet?), I think we can instead do the following for integral types:
using D1 = make_signed_t<W>;
using D2 = iter_difference_t<W>; // Once #614 is fixed, this has more bits for unsigned ints
return (D2) (D1) (i1 - i0);
Once we fix #614, we have an additional problem in
iota_view<U,U>::iterator::operator-
for an unsigned integral typeU
. The expected behavior is:However, if
y.value_ > x.value_
, then the result wraps to a large positive number. Once #614 is fixed,operator-
will return a type that is capable of representing this large number, and so rather than returning a negative, we'll return a large positive.Assuming 2s compliment (can we yet?), I think we can instead do the following for integral types: