File tree Expand file tree Collapse file tree 1 file changed +5
-6
lines changed Expand file tree Collapse file tree 1 file changed +5
-6
lines changed Original file line number Diff line number Diff line change @@ -87,13 +87,12 @@ struct LazyBufferCache{F<:Function}
87
87
end
88
88
89
89
# override the [] method
90
- function Base. getindex (b:: LazyBufferCache , u:: AbstractArray{T} ) where {T}
90
+ function Base. getindex (b:: LazyBufferCache , u:: T ) where {T<: AbstractArray }
91
91
n = b. lengthmap (size (u)) # required buffer length
92
- buf = get! (b. bufs, T) do
93
- similar (u, T, n) # buffer to allocate if it was not found in b.bufs
94
- end :: typeof (u) # declare type since b.bufs dictionary is untyped
95
- # Doesn't work well with matrices, needs more thought!
96
- # return resize!(buf, n) # resize the buffer if needed, e.g. if problem was resized
92
+ buf = get! (b. bufs, (T, n)) do
93
+ similar (u, n) # buffer to allocate if it was not found in b.bufs
94
+ end :: T # declare type since b.bufs dictionary is untyped
95
+ return buf
97
96
end
98
97
99
98
export dualcache, get_tmp, LazyBufferCache
You can’t perform that action at this time.
0 commit comments