We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
similar
zero
1 parent addfd17 commit b48fe60Copy full SHA for b48fe60
src/PreallocationTools.jl
@@ -86,8 +86,9 @@ end
86
function Base.getindex(b::LazyBufferCache, u::T) where {T <: AbstractArray}
87
s = b.sizemap(size(u)) # required buffer size
88
buf = get!(b.bufs, (T, s)) do
89
- similar(u, s) # buffer to allocate if it was not found in b.bufs
90
- end::T # declare type since b.bufs dictionary is untyped
+ # declare type since b.bufs dictionary is untyped
+ zero(u)::T # buffer to allocate if it was not found in b.bufs
91
+ end
92
return buf
93
end
94
0 commit comments