Currently the code is:
struct Triplet
{ string wrd1;
string wrd2;
string wrd3;
int val = 1;
int opCmp(ref const Triplet t) const
{ if (wrd1 < t.wrd1) return -1;
if (wrd1 > t.wrd1) return 1;
if (wrd2 < t.wrd2) return -1;
if (wrd2 > t.wrd2) return 1;
if (wrd3 < t.wrd3) return -1;
if (wrd3 > t.wrd3) return 1;
return 0;
//auto i = wrd1.opCmp (t.wrd1);
//if (i != 0) return i;
//i = wrd2.opCmp (t.wrd2);
//if (i != 0) return i;
//return wrd3.opCmp (t.wrd3);
}
}
The commented out code was the original version, which wouldn't compile.
(The current code replaces it.) It gave messages like:
...ser$ rdmd --main -unittest -DdDocs parse1.d
parse1.d(114): Error: undefined identifier 'opCmp'
parse1.d(116): Error: undefined identifier 'opCmp'
parse1.d(118): Error: undefined identifier 'opCmp'
What was I doing wrong?