Thanks. If I wanted to add a method to convert, what could I dispatch
on, ie what is the supertype that has all composite and immutable types
(and only those?)

Using v"0.4.0-dev+3661".

Tamas

On Thu, Mar 05 2015, Simon Danisch <[email protected]> wrote:

> easiest would probably be: [foo.(i) for i=1:length(names(Foo))]
>
>
> Am Donnerstag, 5. März 2015 10:51:36 UTC+1 schrieb Tamas Papp:
>>
>> If I have a composite type 
>>
>> type Foo 
>>   a 
>>   b 
>>   c 
>> end 
>>
>> I can initialize it with a vector like this: 
>>
>> x = Foo([1,2,3]...) 
>>
>> But how can I get the fields as a vector, eg [x.a,x.b,x.c] without 
>> enumerating them? convert(x, Vector) does not work. 
>>
>> I need this to go back and forth between the type and the vector 
>> representation of a set of parameters when using NLopt. 
>>
>> Best, 
>>
>> Tamas 
>>

Reply via email to