Fighting compiler - experienced programmer but D novice
Chris Cain via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Mon Jun 2 20:35:45 PDT 2014
On Tuesday, 3 June 2014 at 03:17:10 UTC, Charles Parker wrote:
> ...
> Thanx for any help - Charlie
Well one thing is that you don't need the type parameters on the
this function. You're basically creating a templated this inside
the templated class which is not what you want.
try this:
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 data, int n) {
this.data = data;
nid = n;
in_edges = new E[];
out_edges = new E[];
}
Another thing is that you're missing the ! to instantiate
v
auto fee = new node!(string, u_edge)("Suck Moose", 1);
^
More information about the Digitalmars-d-learn
mailing list