How to chain constructor args to a template memeber

BCS none at anon.com
Thu Mar 11 12:03:23 PST 2010


Hello Steven,

> What about a static function instead of a constructor?
> 
> i.e.
> 
> static C create(Args...)(int foo, float bar, Args args)
> {
> auto c = new C(foo, bar);
> c.t = T(args);
> return c;
> }

That's my fallback position.

> It's a shame template constructors aren't allowed, they aren't even
> virtual functions!

Ditto.

-- 
... <IXOYE><





More information about the Digitalmars-d-learn mailing list