Fighting compiler - experienced programmer but D novice

Charles Parker via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Mon Jun 2 20:17:09 PDT 2014


./graph_structures.d(124): Error: class graph_structures.node(D,
E) is used as a type

I have no idea what this means:( Once we create a class, the
textbook examples show its use as a type which I believe is what
C++ & Java allow. Here's some code:

class node(D, E) {
      int nid;
      D data;
      E[] in_edges; // All edges for undirected graphs go here.
      E[] out_edges; // Only used by directed graphs

      this(D, E)(D data, int n) {
          this.data = data;
          nid = n;
          in_edges = new E[];
          out_edges = new E[];
      }

This is incomplete, but I believe the relevant stuff is my node
template uses 2 parameters corresponding to the data types for
the stored data and the edge types. Here's statement 124 in main:

      auto fee = new node(string, u_edge)("Suck Moose", 1);

I pass the 2 data types in the first parm list and the
constructor required arguments in the second list. I must be
missing something, but I don't see it:(

Thanx for any help - Charlie


More information about the Digitalmars-d-learn mailing list