digitalmars.D - Expression templates
- Bill Baxter (17/17) Oct 24 2006 I thought there was a big discussion on expression templates before, but...
I thought there was a big discussion on expression templates before, but I can't seem to find it. Anyway, I thought I'd see how it worked, so tried porting some code from here: http://www.flipcode.com/articles/article_fastervectormath.shtml The result was that the expression template version was much slower than just doing a plain assignment. But it does work. I mean you can write c ~= a + b, it creates an expression object and evaluates it only when writing it to c via opCatAssign. This is a very primitive version of expression templates in that ... there aren't any templates! It only creates an expression object out of one thing: the addition of two vectors. But according to the flipcode page this should already be faster than the straighforward add (though I don't really see why). I don't have any more time to spend on it but I thought I'd post it here if someone was interested in tinkering with it. --bb
Oct 24 2006