Expression template in D struct
The Anh Tran
trtheanh at gmail.com
Wed May 6 18:31:46 PDT 2009
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.
More information about the Digitalmars-d-learn
mailing list