First of all, sorry for bringing back this can of worms to a new thread, but recently, I've been reviewing some interesting stuff that can potentially clarify math library development once and for all. Also, sorry if this issue has been discussed before, I don't have too much time to check all threads in detail ^^;
What I've been reviewing is the forthcoming revision of C++ STL, the so called "TR1" extension for the std namespace. And, if I'm not mistaken, it is already available in the latest version of GCC and also in VisualStudio 2008.
One of the proposed, and apparently approved new templates in the library is the std::tr1::array template, which is a lightweight wrapper of the C language array, so in short:
float vec3[3] = {01,2};
becomes
std::array<float,3> vec3 = {0,1,2};
As we all know, a c array cannot be returned from a function, and it is very unreliable when passed as a function parameter... but std::array does not have these disadvantages.
The whole point of the post is that, if, instead of developing our own vector classes using an internal "float array[3]", we begin developing them around std::array, we could, at some point, make passing math data from/to different math libraries much easier than it is now, or even have a class-less vector math library!
to illustrate my point, here's a sample that actually works, and could be compatible with *any math library using std::array as its data storage foundation:
template<typename _T>
_T DotProduct( const std::array<_T,3>& _a, const std::array<_T,3>& _b)
{
return _a[0]*_b[0] + _a[1]*_b[1] + _a[2] * _b[2];
}
Maybe it looks ugly, and I know that recently bullet got rid of all STL dependencies, but I think that solving the problem of interoperability between different math libraries is something worth the cost of using std::array.
Vic