to! converting 1D to 2D array
monarch_dodra
monarchdodra at gmail.com
Wed Mar 12 00:59:05 PDT 2014
On Wednesday, 12 March 2014 at 07:43:46 UTC, bearophile wrote:
> monarch_dodra:
>
>> int[] a = [0, 1, 2, 3];
>> int[2][1][2][1] b;
>> *cast(int[4]*)&b = a;
>> assert(b == [[[[0, 1]], [[2, 3]]]]);
>
> Those pointers are not needed:
>
> cast(int[4])b = a;
>
> Bye,
> bearoophile
I'm *never* actually sure if these kinds of casts are value
casts, or re-interpreting casts.
Thanks.
More information about the Digitalmars-d-learn
mailing list