new int[]

Luís Marques luis at luismarques.eu
Wed Jan 10 22:35:01 UTC 2018


Due to compatibility with some C code, I basically need to do 
this:

     struct Wrapper
     {
         int[] x;
     }

     void main()
     {
         void* ctxptr = new Wrapper([1, 2, 3]);
         auto context = cast(Wrapper*) ctxptr;
         writeln(context.x);
     }

How can I do that without the wrapper? `new int[]` isn't 
supported, even though that's exactly what I want.


More information about the Digitalmars-d-learn mailing list