How to create an Array of some concrete type (i.e., not Any) with zero size?

question

#1

a=[] # you will get an Array{Any, 1} with zero size
That’s not I want.

a=fill(0::Int, 0) # yes you can get a zero sized Array{Int64, 1}.

But fill as is suggested by its name should not be used to initialize an empty array, shouldn’t it?

a=empty([0]) #yes this will also create a zero sized Array{Int64, 1} with zero size, but it is rather noisy, isn’t it?

What is the best way to create an empty Array of certain concrete type?

Thanks.


#2

Int[]


#3

Or, if you prefer a more verbose but slightly more obvious approach, Array{Int, 1}() and Vector{Int}() will also work.