D - Template Struct Member Functions, and lengthy template instantiations.
- Daniel Horn (19/19) Apr 29 2004 I can see why one would wish to avoid virtual template class template
- Walter (6/25) Apr 29 2004 No.
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? PS: Typeof is really cool!
Apr 29 2004
"Daniel Horn" <hellcatv hotmail.com> wrote in message news:c6rlj9$2aga$1 digitaldaemon.com...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?No.How about template struct template member functions: these are just syntactic sugar for making a static function...Already implemented.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?Will an alias work?PS: Typeof is really cool!Thanks!
Apr 29 2004