I am trying to perform a simple experiment and need some help.
I wish to make a copy of the AbstractVector type as such:
struct AbstractVectorCopy{T} <: AbstractVector{T}
field::AbstractVector{T}
end
Then I want to be able to fill it with values, exactly the same way as for the AbstractVector:
using StaticArrays
# This works using AbstractVector
AbstractVector{SVector{3,Float32}}(zeros(SVector{3,Float32},100))
# This does not work using the copy
AbstractVectorCopy{SVector{3,Float32}}(zeros(SVector{3,Float32},100))
Any way to make it properly act like an “AbstractVector” but through my “new” type?
As explained in the first two subsections, “Avoid fields with abstract type” and “Avoid fields with abstract containers”, you probably don’t want to declare your field with an abstract type, for performance reasons.