How can I dispatch on an SVector?
Not working:
function plot2d(pos::Union{Vector, SVector}, reltime=0.0; kwargs...)
plot2d__(pos, reltime; kwargs...)
end
How can I dispatch on an SVector?
Not working:
function plot2d(pos::Union{Vector, SVector}, reltime=0.0; kwargs...)
plot2d__(pos, reltime; kwargs...)
end
What’s happening?
julia> g(x::Union{Vector, SVector}) = x
g (generic function with 1 method)
julia> g(SVector(1,1,1))
3-element SVector{3, Int64} with indices SOneTo(3):
1
1
1
(you may want AbstractVector
instead of the Union)
Using AbstractVector solved my issue. Thank you!