CartesianIndex to an integer vector

To generalize, a composite data structure isn’t necessarily multiple elements semantically, let alone iterable. Complex{T} is a composite of 2 T fields, but we wouldn’t expect to collect it into Vector{T} with 2 elements; Complex is iterable so collect works, but it is 1 element like a typical Number. Of course, anything implemented with multiple elements can be processed to something that is semantically a collection; getfield.(::C, 1:fieldcount(C)) would collect the fields of a struct C, so it works on Complex.

Back to the topic at hand, there’s no cost to Tuple(::CartesianIndex) because it’s just a simple getter for the Tuple that CartesianIndex is built on: Tuple(index::CartesianIndex) = index.I.