
I'm trying to make a "simple" cartesian vector class. It should be similar to the quaternion example that you give in the docs, but I can't get it to compile. I've attached a complete program. Here are the error I get when I try to compile it. Lets just focus on fixing the first few errors about no binary '*'. When I understand that, perhaps I'll be able to fix the rest.
One problem is here : // vector * T template<int Dim, class T1, class T2> inline typename boost::units::multiply_typeof_helper<T2, vector<Dim, T1> >::type operator*(const vector<Dim, T1>&lhs, const T2& rhs) { return rhs * lhs; } Since multiply_typeof_helper<T1,T2> is really just a glorified version of typeof(T1()*T2()), what you're saying here is that the return type of the product of a vector and a scalar is the return type of the product of a vector and a scalar. You need to define the top-level multiply operation; define it something like this : // vector * T template<int Dim, class T1, class T2> inline vector<Dim,typename boost::units::multiply_typeof_helper<T2, T1 >::type> operator*(const vector<Dim, T1>&lhs, const T2& rhs) { //return rhs * lhs; this return statement is also wrong, since it is recursive, defining the returned value in terms of the operator itself...} Cheers, Matthias