I'm trying to do something like this (which doesn't compile in its current
form):
type ArrayWrapper{T,N,AT <: AbstractArray{T,N}} <: AbstractArray{T,N}
arr::AT{T,N}
end
That is:
- wrapper around any type AT inherited from AbstractArray{T,N}
- wrapper should be itself parametrized by T and N
- wrapper should itself extend AbstractArray{T,N}
The code above currently gives an error:
ERROR: TypeError: instantiate_type: expected TypeConstructor, got TypeVar
and the closest thing that works looks like this:
type ArrayWrapper{T,N,AT <: AbstractArray} <: AbstractArray{T,N}
arr::AT
end
which looks too unconstrained.
Is there a way to get what I need?