What you mean here exactly? Three approaches could be used, I think:
- Annotate the parametric types on the functions (this one is the most elegant, in my opinion, since the function will specialize to that type of
aanyway:
function f(a::A{N,T}) where {N,T}
# use N here
end
- Get the size internaly:
function f(a)
N = length(a.x) # a.x is the MVector{N,T}
...
end
- Annotate he size in your struct:
struct A{N,T}
N::Int
x::Vector{N,T}
end
and initialize it accordingly (and use a.N there)