On Wednesday, 19 August 2020 at 20:09:31 UTC, bachmeier wrote:
On Wednesday, 19 August 2020 at 13:03:54 UTC, data pulverizer wrote: Maybe I'm the only one, but I think double*[] is hideous, and I'd sure hate for someone not used to D to see it. Alias is your friend. I think this is much nicer:

void main() {
    alias double* DoublePtr;
    DoublePtr[] arr;
    auto v = [1.0, 2.0, 3.0];
    auto w = [4.0, 5.0, 6.0];
    arr ~= [v.ptr, w.ptr];
    writeln(arr);
}

I know what you mean. I'm using something like this:

```
alias P(T) = T*;
P!(double)[] arr;
```

alias is one of those awesome chameleons in D. The template equivalent is

```
template P(T) = T*;
```

In this case I wonder if there is any difference as far as the compiler is concerned?

Reply via email to