Range-based for loop to iterate over a NumPy array? #5292
Unanswered
CsatiZoltan
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I have an array
arr
of typepybind11::detail::unchecked_reference<int, 1>
over which I want to iterate.The standard for loop works:
My code would be more expressive with a range-based for loop:
but it does not compile:
Even the static analyzer warns me:
How could I iterate over a NumPy array elegantly?
Beta Was this translation helpful? Give feedback.
All reactions