In C++!

I have a type defined in the core library like..
typedef float scalar;
//typedef double scalar; // <-- whole framework is now double precision

Next i instantiate vectors, matrices etc... from templates.
typedef vector_t<scalar, 3> vector;
typedef matrix_t<scalar, 3, 3> matrix;

Until now everything cool, here pain comes...

const scalar a = scalar(0.2) * math::consts<scalar>::pi; // can't drop cast, since 0.2 is double
const scalar b = a * scalar(0.9) + scalar(5); // " "
const vector v = vector(8.0) * scalar(3.0); // can't drop cast, error
...

Since D is superb, i like to know how you do it in D.
If you got a better idea in C++, i would like to hear that too!

Thanks!

--
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/

Reply via email to