Pointer to template types?

Jesse Phillips via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Mon Apr 28 21:44:38 PDT 2014


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"])


More information about the Digitalmars-d-learn mailing list