Recursive Templates

Jarrett Billingsley kb3ctd2 at yahoo.com
Tue Jul 29 12:59:12 PDT 2008


"llee" <llee at goucher.edu> wrote in message 
news:g6nq50$2b9n$1 at digitalmars.com...
>I ran into a similar problem when working with sets. I could define sets 
>using templates, but I couldn't define sets of sets without the compiler 
>complaining about recursive definitions.
>
> For example:
>     class Set (T) { T[] elems; ... }
>
> but how would I define a set of sets?.
>
>     Set! (Set) family = ... does not work.

A set of sets of ... what?  You just need to specify what type it is.  "Set" 
is not a type, it is a template.

Set!(Set!(int)) family; 





More information about the Digitalmars-d mailing list