to! converting 1D to 2D array

bearophile bearophileHUGS at lycos.com
Wed Mar 12 00:43:44 PDT 2014


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


More information about the Digitalmars-d-learn mailing list