Template overloading

Bill Baxter dnewsgroup at billbaxter.com
Sun Nov 25 10:50:30 PST 2007


Does anyone have a really good understanding of the dummy=void hack for 
making two templates with the same name but different arguments?  Every 
time I try to use that I end up I just end up randomly adding in 
dummy=voids here and there till it works.  Is there some rationale for 
where it should go (end of parameter list? beginning?)?  And what about 
when you have 3 or more templates you need to differentiate?

Also, am I right in thinking that if you pass any of the "real" template 
arguments explicitly then suddenly the dummy args must be passed too?

Any advice on best practices in this area?

My most recent run-in with this was trying to write a matrix multiply 
template that could take arguments of either Mat!(T),Mat!(T), or 
Mat!(T),Vec!(T).

--bb


More information about the Digitalmars-d-learn mailing list