Pointer to template types?

Chris via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue Apr 29 03:45:24 PDT 2014


On Tuesday, 29 April 2014 at 04:44:39 UTC, Jesse Phillips wrote:
> On Monday, 28 April 2014 at 10:40:49 UTC, Chris wrote:
>> Person!(string) *pptr;
>
> Just wanted to point out, the above is C style and not 
> recommended.
>
>     Person!(string)* pptr, pptr2, pptr3;
>
> In D the pointer is part of the type not the variable (all 
> three are pointers, unlike C where only the first would be a 
> pointer). By placing the pointer on the variable I do not 
> describe the types correctly.
>
>     Person!(string) *pptr, pptr2, pptr3;
>
> This should help when wanting to use more complex types:
>
>     Person!(string)*[string][][char]* paaaaapp; //:)
>
> used like :(I don't know my precedence):
>
>     *((*paaaaapp)['c'][1]["hello"])

Yes, you're right. Thanks for pointing this out. To be sure, I 
usually use a new line for pointers.


More information about the Digitalmars-d-learn mailing list