Skip to content

Commit

Permalink
Merge pull request #168 from tkoolen/remove-deepcopy-specialization
Browse files Browse the repository at this point in the history
Remove deepcopy specialization for Dict
  • Loading branch information
tkoolen authored Feb 14, 2017
2 parents b576390 + 4fae3e2 commit 30ba38f
Showing 1 changed file with 0 additions and 18 deletions.
18 changes: 0 additions & 18 deletions src/util.jl
Original file line number Diff line number Diff line change
Expand Up @@ -17,24 +17,6 @@ Base.getindex{T}(A::NullVector{T}, i::Int) = zero(T)
# Base.setindex!{N}(A::NullVector, v, I::Vararg{Int, N}) = error()
Base.linearindexing{T}(::Type{NullVector{T}}) = Base.LinearFast()

# https://github.com/JuliaLang/julia/issues/19921
function Base.deepcopy_internal(x::Dict, stackdict::ObjectIdDict)
if haskey(stackdict, x)
return stackdict[x]::typeof(x)
end

if isbits(eltype(x))
return (stackdict[x] = copy(x))
end

dest = similar(x)
stackdict[x] = dest
for (k, v) in x
dest[Base.deepcopy_internal(k, stackdict)] = Base.deepcopy_internal(v, stackdict)
end
dest
end

# type of a view of a vector
# TODO: a bit too specific
typealias VectorSegment{T} SubArray{T,1,Array{T, 1},Tuple{UnitRange{Int64}},true}
Expand Down

0 comments on commit 30ba38f

Please sign in to comment.