I have writing code that maniuplates containers of arrays of custom types with several parameters, e.g.
SomeArrayType{T, G1, G2, N} <: AbstractArray{T, N}
, where the last parameter in SomeArrayType is always the array rank N. The arrays that can be in the container can differ in rank N but otherwise should be the same type, for example Vector{SomeArray{T, G1, G2}}
which can also be written Vector{SomeArray{T, G1, G2, N} where N}
.
I’d like to create a function arraytype
that strips the last (rank) parameter from the type, so that
arraytype(::Type{NewArrayType{T, X, Y, Z, N}}) = NewArrayType{T, X, Y, Z}
for any type that might be encountered. How would one write a function that generically strips the last parameter from a type?