-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error when trying to iterate a distinct type based array #7167
Comments
Why should it work? The distinct type means arithmetic operations are not available. |
@Araq I disagree. Since all ordinal types are allowed as array indices, they should work with the items iterator even if they are distinct. Is there a reason why the iterator can't be implemented like this? iterator items*[IX, T](a: array[IX, T]): T {.inline.} =
## iterates over each item of `a`.
var i = low(IX).IX
if ord(i) <= ord(high(IX)):
while true:
yield a[i]
if ord(i) >= ord(high(IX)): break
inc(i) Having to borrow |
The real problem here is that |
Agreed that |
The text was updated successfully, but these errors were encountered: