[units] User-defined vector class template won't compile

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.
Thanks, terry
try.cpp
using native typeof
C:/boost/boost_1_43_0\boost/units/operators.hpp(74) : error C2678: binary
'*' : no operator found which takes a left-hand operand of type 'double' (or
there is no acceptable conversion)
C:/boost/boost_1_43_0\boost/units/detail/one.hpp(47): could be 'T
boost::units::operator *<T>(const boost::units::one &,const T &)'
with
[
T=rci::cartesian::vector<3,double>
]
C:/boost/boost_1_43_0\boost/units/detail/one.hpp(53): or 'T
boost::units::operator *<double>(const T &,const boost::units::one &)'
with
[
T=double
]
C:/boost/boost_1_43_0\boost/units/detail/one.hpp(58): or
'boost::units::one boost::units::operator *(const boost::units::one &,const
boost::units::one &)'
while trying to match the argument list '(double,
rci::cartesian::vector

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

Your reply provided the key, thank you.
I misunderstood what multiply_typeof_helper was for. It's like common_type<> in C++0X, but its more specialized for each kind of operator.
Which is obviously important for units.
My program compiles and runs now. Thanks again.
terry
BTW, the return statement is not recursive, because it swaps the lhs and rhs.
// vector * T
template
participants (2)
-
Matthias Schabel
-
Terry Golubiewski