to! converting 1D to 2D array

ed growlercab at gmail.com
Wed Mar 12 20:31:07 PDT 2014


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  :-)

> If nothing else, when you use to!(x)(y), "x" should be the type 
> that you're trying to convert into. So I would expect your code 
> to be to!(int[2][2])(a).

Yes, I'm aware of this, the conversion I was doing is as follows:

long[4] -> to! -> int[] ->implicit conv. -> int[2][2].

it is the implicit conversion that was failing, not the to! 
function. I didn't realise this until after bearophile's reply :D

Thanks,
ed


More information about the Digitalmars-d-learn mailing list