// An experiment with expression templates in D. // With DMD 0.173 version(Expression) is massively slower than version(Other) // // adapted from http://www.flipcode.com/articles/article_fastervectormath.shtml import std.stdio : writefln; struct vector { float[3] V; static vector opCall( float x, float y, float z ) { vector V; V.V[0]=x; V.V[1]=y; V.V[2]=z; return V; } float Evaluate( int I ) { return V[I]; } void opCatAssign( inout vecexp_2 Exp ) { for (int i=0; i