Beautiful!! Now to rewrite the 100 for loops I made over every
possible choice of T :)
> On 4 Mar 2015, at 2:01 pm, Keno Fischer <[email protected]> wrote:
>
> Base.eltype{T<:Foo}(::Type{T})=T.parameters[1]
>
> should work
>
> On Tue, Mar 3, 2015 at 9:58 PM, Sheehan Olver <[email protected]
> <mailto:[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})
>
>
>
>