Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions src/utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -148,8 +148,8 @@ copyat_or_push!{T}(a::AbstractVector{T},i::Int,x)

If `i<length(x)`, it's simply a `recursivecopy!` to the `i`th element. Otherwise, it will
`push!` a `deepcopy`.
"""
function copyat_or_push!(a::AbstractVector{T},i::Int,x,nc::Type{Val{perform_copy}}=Val{true}) where {T,perform_copy}
"""
function copyat_or_push!(a::AbstractVector{T},i::Int,x,perform_copy=true) where {T}
@inbounds if length(a) >= i
if !ArrayInterfaceCore.ismutable(T) || !perform_copy
# TODO: Check for `setindex!`` if T <: StaticArraysCore.StaticArray and use `copy!(b[i],a[i])`
Expand All @@ -171,7 +171,11 @@ function copyat_or_push!(a::AbstractVector{T},i::Int,x,nc::Type{Val{perform_copy
end
nothing
end


function copyat_or_push!(a::AbstractVector{T},i::Int,x,nc::Type{Val{perform_copy}}) where {T, perform_copy}
copyat_or_push!(a,i,x,perform_copy)
end

"""
```julia
recursive_one(a)
Expand Down