CartesianIndex tuple accessor

What is the API for extracting the I from a CartesianIndex(I)? I need it as a Tuple of integers.

I can convert, eg

convert(Tuple, CartesianIndex((1, 2, 3)))

but I am wondering if this is the supported way.

You can do Tuple(CartesianIndex((1,2,3))).

It is defined in multidimensional.jl as:

# access to index tuple
Tuple(index::CartesianIndex) = index.I

which sounds like it should be the way to go.

Cheers

2 Likes