On 11/30/22 16:48, Ali Çehreli wrote:
Functions are syntax sugar. :)
And I remembered std.array.staticArray. One its overloads should be useful:
import std;
void main() {
auto v3 = staticArray!(0.1f.repeat(5));
auto v4 = staticArray!5(0.1f.repeat);
writeln(v3);
writeln(v4);
On Thursday, 1 December 2022 at 00:47:18 UTC, Adam D Ruppe wrote:
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?
float[] f = [1,1,1];
some_function_taking_vo
On 11/30/22 16:39, 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? See below:
```d
float* arr = cast(float*) new float[4];
arr[0] = 0.1;
arr[1] = 0.1;
arr[2] = 0.1;
arr[3] = 0.1;
void* value = cast(void*) ar
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
possi