Re: to! converting 1D to 2D array

2014-03-12 Thread ed
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 Thanks for this, the casts wor

Re: to! converting 1D to 2D array

2014-03-12 Thread ed
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 c

Re: to! converting 1D to 2D array

2014-03-12 Thread Chris Williams
On Wednesday, 12 March 2014 at 03:37:49 UTC, ed wrote: My understanding of your explanation is that it shouldn't work. It shouldn't and probably isn't working. 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

Re: Objective-C runtime: bindings are possible?

2014-03-12 Thread Paolo Invernizzi
On Tuesday, 11 March 2014 at 17:22:59 UTC, Jacob Carlborg wrote: On 2014-03-11 16:12, Paolo Invernizzi wrote: Hi all, I'm wondering if it is possible to directly interface with the objective-c runtime, as I've read [1] and I have some random crashes in my code right now. Yes, it's possible

Casting an interface to the type that implements it.

2014-03-12 Thread Steve Teale
This might be equivalent to 'How to do multiple inheritance in D'. I have a class ControlSet, that is just a bunch of widgets. I use it in various places to represent the contents of dialogs that are associated with some class. All such classes have to do is define themselves using the CSTar

Re: to! converting 1D to 2D array

2014-03-12 Thread bearophile
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

Re: to! converting 1D to 2D array

2014-03-12 Thread monarch_dodra
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 t