April 29, 2004 Long template instantiations and virtual template struct funcs | ||||
---|---|---|---|---|
| ||||
I can see why one would wish to avoid virtual template class template member functions to keep a fixed size vtable (I miss them however!) Is that a feature that will be added? How about template struct template member functions: these are just syntactic sugar for making a static function... Speaking of making a static function...I made 2 vector classes, one for float vectors one for double, and I wish to multiply them. I am stuck with XVector!(double) k=XVector!(double).opCall(1,2,3); XVector!(float) l=XVector!(float).opCall(3,4,1);//why must call opCall? XVector!(double) m = VecOp!(typeof(k.x),typeof(l.x)). Mul(k,l); typing VecOp!(typeof(k.x),typeof(l.x).Mul(k,l) is lengthy, and obscures the function of the code, which is to multiply k with l. in C++ I would make a macro at the very worst (an overloaded operator at best) that did it #define VecMul(k,l) VecOp!(typeof(k.x),typeof(l.x).Mul(k,l) is there any shorthand for this, short of running gcc -E before gdc? -Daniel PS: Typeof is really cool! |
Copyright © 1999-2021 by the D Language Foundation