Base.eltype{T<:Foo}(::Type{T})=T.parameters[1]
should workOn Tue, Mar 3, 2015 at 9:58 PM, Sheehan Olver <[email protected]> wrote: > Suppose I have > > abstract Foo{T} > immutable Foo1{T} <:Foo{T} end > immutable Foo2{T} <:Foo{T} end > > > > How can I write a function that returns T given the type? E.g.: I want to > do > > Base.eltype(::Type{Foo{T}})=T > > > But this won't work for eltype(Foo1{T}) > > > >
