diff --git a/src/PooledArrays.jl b/src/PooledArrays.jl index 1058f13..2d08f52 100644 --- a/src/PooledArrays.jl +++ b/src/PooledArrays.jl @@ -199,8 +199,8 @@ end PooledArray{T}(d, signed=signed, compress=compress) # Construct an empty PooledVector of a specific type -@inline PooledArray(t::Type) = PooledArray(Array(t,0)) -@inline PooledArray(t::Type, r::Type) = PooledArray(Array(t,0), r) +@inline PooledArray(t::Type) = PooledArray(Array{t}(undef,0)) +@inline PooledArray(t::Type, r::Type) = PooledArray(Array{t}(undef,0), r) ############################################################################## ## diff --git a/test/runtests.jl b/test/runtests.jl index f205d73..7ceadd4 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -15,6 +15,11 @@ end @testset "PooledArrays" begin @test eltype(PooledArray(Int[])) === Int + @test PooledArray(Int) == Int[] + @test PooledArray(Int) isa PooledVector{Int, UInt32} + @test PooledArray(Int, UInt64) == Int[] + @test PooledArray(Int, UInt64) isa PooledVector{Int, UInt64} + a = rand(10) b = rand(10,10) c = rand(1:10, 1000)