to! converting 1D to 2D array

ed growlercab at gmail.com
Thu Mar 13 21:18:17 PDT 2014


On Thursday, 13 March 2014 at 18:17:03 UTC, Chris Williams wrote:
> On Thursday, 13 March 2014 at 03:31:09 UTC, ed wrote:
>> On Thursday, 13 March 2014 at 00:15:19 UTC, Chris Williams 
>> wrote:
>> [snip]
>>> It shouldn't and probably isn't working.
>>
>> It is working and in fact it is in a "const pure @safe" 
>> function. So I will trust it  :-)
>
> Well it's like a broken watch being correct twice a day. The 
> correct result doesn't mean that something is working.

But this is perfectly valid and safe D code, is it not?

long[4] a=[1,2,3,4];
int[2][2] b = a.to!(int[]);

which is no different to this:

int[] a_int = a.to!(int[]);
int[2][2] b = a_int;

Am I missing something here?

Thanks,
ed








More information about the Digitalmars-d-learn mailing list