Array of pointers

bearophile bearophileHUGS at lycos.com
Sat Jan 18 03:34:00 PST 2014


Arjan Fetahu:

> Since each Node connects to multiple others i came up with this 
> solution.
>
> class Node {
>      auto content;
>      Node*[] nodes;
>      //..constructor..
> }

Nodes are reference types in D, so probably you don't need to use 
a * for Node. Alternatively use a struct handled by pointer.

"auto content;" can't compile, you need a type, or you have to 
template Node on T and use it for content.

Bye,
bearophile


More information about the Digitalmars-d-learn mailing list