Thanks for your reply Tim.

Are x and y offsets with respect to the "parent" range cr? 
>
> If so, you can achieve this with a 1-liner, 
>
>     CartesianRange(cr.start+x-1, cr.start+y-1) 
>

No, not "Cartesian" offsets, but "linear" offsets transformed to Cartesian 
equivalent. 
That's why I think I need the dimensions of the parent range.


julia> I1 = CartesianIndex((3,3,3)) 
> CartesianIndex{3}((3,3,3)) 
>
> julia> I2 = CartesianIndex((5,1,7)) 
> CartesianIndex{3}((5,1,7)) 
>
> julia> R = CartesianRange(I1, I2) 
> CartesianRange{CartesianIndex{3}}(CartesianIndex{3}((3,3,3)),CartesianIndex{3}
>  
>
> ((5,1,7))) 
>
 
As you point out, R here is effectively an empty iterator.
However for my use, that same range R could be non-empty if it is a 
sub-range of a larger enclosing range.
Say CartesianSubRange(CartesianRange((8,8,8)), I1, I2))
So I want to iterate within the parent CartesianRange dimensions, from I1 
to I2.

Reply via email to