Recursive Templates

Bill Baxter wbaxter at gmail.com
Tue Jul 29 12:53:48 PDT 2008


On Wed, Jul 30, 2008 at 4:36 AM, llee <llee at goucher.edu> wrote:

> Oliver Dathe Wrote:
>
> > > Param! (Param) composite = new Param! (Param) ();
> >
> > You seem to have forgotten something:
> >
> > ... = new Param!( Param!(MISSING) );
>
> That's what I need to know. I don't know what to put there to allow
> composite to be an array of arbitrary Params.
>

Since the thing you end up with is a template still, you have to define a
new template that defines the alias you want:

  template SetOfSets(T) {  alias Set!(Set!(T)) SetOfSets; }

This is one place where D could be nicer.   I think extending the template
shortcut syntax to aliases would be nice:

   alias(T) Set!(Set!(T)) SetOfSets!(T);

It works for classes, structs and functions -- why not aliases too?

--bb
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20080730/6355afef/attachment.html>


More information about the Digitalmars-d mailing list