Forward referencing templates..

Bradley Smith user at domain.invalid
Thu Oct 26 10:32:30 PDT 2006


James Dean Palmer wrote:

> Sure, but remove the template aspect and consider the classes - we have 
> no trouble representing classes with infinitely recursive relationships. 
>  class Bob can point to an object of type Alice and Alice can point to 
> an object of type Bob.  I'd like to be able to do the same thing with 
> templatized classes.

That would be like the following, which does compile.

class edge(TNumeric) {
   face!(TNumeric) f;
   vector!(TNumeric) v;
}

class face(TNumeric) {
   surface!(TNumeric) s;
   edge!(TNumeric) e;
}

class surface(TNumeric) {
   face!(TNumeric) f;
}

class vector(TNumeric) {
}

alias vector!(double) vector3D;
alias edge!(double) edge3D;
alias face!(double) face3D;
alias surface!(double) surface3D;



More information about the Digitalmars-d mailing list