It seems unusual to me that the indexable CartesianIndex cannot also iterate (or splat).
julia> start(Base.CartesianIndex(1))
ERROR: MethodError: no method matching start(::CartesianIndex{1})
Closest candidates are:
start(::SimpleVector) at essentials.jl:259
start(::Base.MethodList) at reflection.jl:561
start(::ExponentialBackOff) at error.jl:107
For context, I had tried this for creating an expression in a generated function by splatting out the Cartesian indices (so run-time performance of iteration vs. indexing isn't an issue). The (or rather, my) workaround is significantly less elegant.
It seems unusual to me that the indexable
CartesianIndexcannot also iterate (or splat).For context, I had tried this for creating an expression in a generated function by splatting out the Cartesian indices (so run-time performance of iteration vs. indexing isn't an issue). The (or rather, my) workaround is significantly less elegant.