On Thu, 07 May 2009 03:31:46 +0200, The Anh Tran <[email protected]> wrote:

Trass3r wrote:
The Anh Tran schrieb:
One of my C++ struct is Vector3. It is a wrapper from D3DXVECTOR3.
I would like to use expression template to calculate where to point the gun. In C++, it is provided by boost::proto or boost::ublas.

 You calculate where to point the gun at compile-time?

No :)

I would like to learn D template programming; all i need is just a compile-time expression.

vPredicted = vEnd
+ (((ProjectileSpeed^2 * |vStart-vEnd|^2 - |(vStart-vEnd) X Velocity | ^2) ^ 0.5 + (vStart-vEnd) * vVelocity) / (ProjectileSpeed^2 - |vVelocity|^2)) * vVelocity

vXYZ is a struct, re-present 3D coordinate / velocity vector.

If you want something capable of processing the above, it will
probably have to work along the lines of BLADE: use a CTFE function
to parse the string and turn it into whatever code you prefer it to
be.

I do not believe there is such a library in existence, though I may
of course be wrong.

As for which functions are CTFE-able:
http://digitalmars.com/d/2.0/function.html#interpretation

--
 Simen

Reply via email to