It seems that Vararg is not supported except at last place, but I want its behavior.
What I am trying to do is to preallocate a vector of views into an Array, so that each view can be reused instead of having to be recreated many times. The detailed motivation is discussed here.
Here is what I wish I could be writing:
using EllipsisNotation
const SliceAll = Base.Slice{Base.OneTo{Int}}
const View{T, N} = SubArray{T,N-1,Array{T,N},Tuple{Vararg{SliceAll,N-1},Int},true} where {T,N}
struct Views{T,N}
x::Vector{View{T,N}}
Views{T,N}(x::AbstractArray{T,N}) = new([view(x, .., i) for i in 1:size(x)[end]])
end
So it is the Tuple{Vararg{SliceAll,N-1},Int}
part that is blocking me now.
Is there a way around this? Any suggestion appreciated!