Thanks for the pointers; yes, that would work. However, this really smells
of the indirect way one needs to express things in C++ template
metaprogramming -- one of the reasons I'm currently trying to switch to
Julia.

-erik

On Fri, Sep 11, 2015 at 3:30 PM, Josh Langsfeld <jdla...@gmail.com> wrote:

> You can access the 'parameters' field of a type instance object. But the
> standard Julian way to get type parameters is to just define a helper
> function:
>
> typeparams{A,B}(::Type{T{A,B}}) = A,B
>
> On Friday, September 11, 2015 at 3:20:17 PM UTC-4, Erik Schnetter wrote:
>>
>> Is there a function in Julia that allows accessing the parameters of a
>> type?
>>
>> For example, if I have
>>
>>    type T{A,B} end
>>
>> then I'd like a way to convert `T{Int, Char}` to `(Int, Char)`.
>>
>> In other words, is there a way to get at the contents of `DataType`
>> objects?
>>
>> Thanks,
>> -erik
>>
>> --
>> Erik Schnetter <schn...@gmail.com>
>> http://www.perimeterinstitute.ca/personal/eschnetter/
>>
>


-- 
Erik Schnetter <schnet...@gmail.com>
http://www.perimeterinstitute.ca/personal/eschnetter/

Reply via email to