Re: Creating a pointer array

2020-08-22 Thread data pulverizer via Digitalmars-d-learn
On Wednesday, 19 August 2020 at 22:21:21 UTC, data pulverizer wrote: On Wednesday, 19 August 2020 at 21:10:00 UTC, data pulverizer wrote: alias is one of those awesome chameleons in D. The template equivalent is ``` template P(T) = T*; ``` Correction ... ``` template P(T){ alias P = T*; }

Re: Creating a pointer array

2020-08-19 Thread data pulverizer via Digitalmars-d-learn
On Wednesday, 19 August 2020 at 21:10:00 UTC, data pulverizer wrote: alias is one of those awesome chameleons in D. The template equivalent is ``` template P(T) = T*; ``` Correction ... ``` template P(T){ alias P = T*; } ```

Re: Creating a pointer array

2020-08-19 Thread data pulverizer via Digitalmars-d-learn
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:

Re: Creating a pointer array

2020-08-19 Thread H. S. Teoh via Digitalmars-d-learn
On Wed, Aug 19, 2020 at 08:09:31PM +, bachmeier via Digitalmars-d-learn 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. IMO, double*[] is absolutely logical. It's a natural consequence of type syntax. > Alias

Re: Creating a pointer array

2020-08-19 Thread bachmeier via Digitalmars-d-learn
On Wednesday, 19 August 2020 at 13:03:54 UTC, data pulverizer wrote: Hi all, How do you create an array of pointers in D? I tried something like ``` double* []y; ``` Or ``` (double*) []y; ``` But I get the error: ``` Error: only one index allowed to index double[] ``` Thanks in advance.

Re: Creating a pointer array

2020-08-19 Thread data pulverizer via Digitalmars-d-learn
On Wednesday, 19 August 2020 at 13:12:21 UTC, data pulverizer wrote: On Wednesday, 19 August 2020 at 13:08:37 UTC, Adam D. Ruppe wrote: On Wednesday, 19 August 2020 at 13:03:54 UTC, data pulverizer wrote: How do you create an array of pointers in D? I tried something like ``` double* []y; ```

Re: Creating a pointer array

2020-08-19 Thread data pulverizer via Digitalmars-d-learn
On Wednesday, 19 August 2020 at 13:08:37 UTC, Adam D. Ruppe wrote: On Wednesday, 19 August 2020 at 13:03:54 UTC, data pulverizer wrote: How do you create an array of pointers in D? I tried something like ``` double* []y; ``` I'd write it double*[] y; but yeah that's it. Error: only one i

Re: Creating a pointer array

2020-08-19 Thread Adam D. Ruppe via Digitalmars-d-learn
On Wednesday, 19 August 2020 at 13:03:54 UTC, data pulverizer wrote: How do you create an array of pointers in D? I tried something like ``` double* []y; ``` I'd write it double*[] y; but yeah that's it. Error: only one index allowed to index double[] That must be at the usage point whe

Creating a pointer array

2020-08-19 Thread data pulverizer via Digitalmars-d-learn
Hi all, How do you create an array of pointers in D? I tried something like ``` double* []y; ``` Or ``` (double*) []y; ``` But I get the error: ``` Error: only one index allowed to index double[] ``` Thanks in advance.