you can always define a fake array type that has a 0 cost constructor.
struct OnlyZeros{T,N} <: AbstractArray{T,N}
size::NTuple{N,Int}
end
OnlyZeros{T}(size::NTuple{N,Int}) where {N,T} = OnlyZeros{T,N}(size)
OnlyZeros(size::NTuple{N,Int}) where N = OnlyZeros{Int,N}(size)
Base.size(A::OnlyZeros) = A.size
Base.getindex(A::OnlyZeros{T,N}, inds::Vararg{Int,N}) where {T,N} = zero(T)
And then you can write CartesianIndices(OnlyZeros(2,4,3))[5]
Thank you! Indeed, I was thinking of something like that.
Yet I am thinking why that is not already defined (an EmptyArray type). Probably if nobody never needed that I might have to rethink the way I have thought my problem.