julia
91505bb6 - Index a `CartesianIndex` with `begin`/`end` (#57985)

Commit
315 days ago
Index a `CartesianIndex` with `begin`/`end` (#57985) Currently, it is possible to index into a `CartesianIndex` using an `Int` index. ```julia julia> I = CartesianIndex(4,3) CartesianIndex(4, 3) julia> I[1] 4 julia> I[2] 3 ``` This PR adds the ability to use `begin`/`end` in the indexing: ```julia julia> I[begin] 4 julia> I[end] 3 ``` The advantage of this (particularly indexing with `end`) is that one doesn't need to know the number of dimensions. This makes writing generic code that accepts either a vector or a matrix easier.
Author
Parents
Loading