templates

BLS windevguy at hotmail.de
Mon Apr 19 17:43:26 PDT 2010


On 19/04/2010 20:16, Ellery Newcomer wrote:
> Hello.
>
> Say I have a [struct] template T, which takes a param S.
>
> Any T!(S) satisfies a certain template constraint W, so I can use any
> T!(S) the same way. I want to be able to store heterogeneous T!(S) in a
> single list. Is there any good way to express the type for this?

Why not simply...

class C(O)
{
   private O obj;
   object next;
   this(O obj)
   {
     this.obj = obj;
   }
   ...
   invariant()
   {
     assert(this.obj fulfills W);
   }
   ...
}




More information about the Digitalmars-d-learn mailing list