
Cool! :-) Have you looked at Blitz++? You might find it easier to start with the code that they have there and modify it to take advantage of c++0x features than to start from scratch. Cheers, Greg On 2/21/11 12:19 PM, Тимофей Игнатьич wrote:
c++0x features allow us to implement some nice stuff:
- Safe variadic functions with parameter count checking. For example consider a constructor of the N dimensional vector of T takes only N farameters that are convertable to T and fails othervise:
vector<T, N> v(/*...N parameters convertable to T...*/); vector<float, 3> v(1,2,3); // good vector<float, 4> v(1.f,2.f); //fails vector<int, 3> v(1,2,3,4); //fails vector<int, 4> v(1,2,3,4); //good
or an N dimensional cross product function that takes exactly N-1 vectors of dimension N:
cross(v1,v2,v3,/*...*/, vn-1);
Please note that N is arbitrary positive integer and is only restricted by compiler's template recursion depth.
- Same type comversion as for fundamental types. This means that char multiplied by int gives int result and int multiplied by float gives float result. vectors work exactly the same:
vector<float, 3> vf; vector<int, 3> vl; vector<short, 3> vs; vector<double, 3> vd;
vi*vf; //returns vector<float, 3> vf*vd; //returns vector<double, 3> vs*vi; //returns vector<int, 3>
Among other notable features are matrix matrix and vector matrix multiplications, component vise addition/substraction/multiplication/division, dot product, matrix inversion, matrix determinant calculation, etc. I want to know if there is any interest in such a library in boost community, and if so to make it available for public inspecion and criticism.
_______________________________________________ Unsubscribe& other changes: http://lists.boost.org/mailman/listinfo.cgi/boost