On Thursday, 1 December 2022 at 00:39:21 UTC, jwatson-CO-edu wrote:
Is there a way to write a single statement that creates a void pointer that points to an initialized float array?

        void* f = [1.0f, 1.0f, 1.0f].ptr;

Though I'd recommend keeping it typed as float[] until the last possible moment. If you are passing it a function, remmeber pointers convert to void* automatically, so you can do like:

float[] f = [1,1,1];

some_function_taking_void(f.ptr);

and it just works.

Reply via email to