how to initialize an array of typedef-ed type?
Daniel Keep
daniel.keep.lists at gmail.com
Fri May 1 21:21:14 PDT 2009
Jarrett Billingsley wrote:
> On Fri, May 1, 2009 at 11:34 AM, MLT <none at anone.com> wrote:
>
>> Is there an easy way to convert arrays from one type to another?
>> int[] a=[1,2,3,4] ;
>> long[] b ;
>
> Not really. The best you can do is:
>
> b.length = a.length;
> foreach(i, ref v; b) v = a[i];
import std.conf;
b = to!(long[])(a);
That should work, in theory.
-- Daniel
More information about the Digitalmars-d-learn
mailing list