Recursive Templates
Jarrett Billingsley
kb3ctd2 at yahoo.com
Wed Jul 30 05:48:11 PDT 2008
"Koroskin Denis" <2korden at gmail.com> wrote in message
news:op.ue3up2utenyajd at proton.creatstudio.intranet...
>
> How about, say, Set of Set of the self type? So that it becomes this:
>
> class MySet
> {
> MySet[] elems;
> // ...
> }
I'm not entirely sure what you're asking.
class Set(T)
{
T[] elems;
this() { Stdout.formatln("set"); }
}
class Set(T : Set!(U), U)
{
Set!(U) elems;
this() { Stdout.formatln("set of sets"); }
}
void main()
{
auto x = new Set!(Set!(int));
}
prints "set of sets".
More information about the Digitalmars-d
mailing list