|
Ublas : |
From: Adrien Schvalberg (adrien.schvalberg_at_[hidden])
Date: 2005-08-01 09:35:11
Adrien Schvalberg a écrit :
> Hi all again,
>
> I have a problem of reference to reference in my code with VC++6
> I'm using boost 1.32.0
>
> I try to make the product of a matrix of doubles with a vector of points.
> As the +=, + and *(on left with double) operators are defined with my
> point class, this should work.
>
> See mvproduct.cpp for example code and vc6_output.txt for compiler error
> output.
>
> this code works with g++ 3.4.4 but not with VC++6.
>
> in functional.hpp, line 182 there is a hint, but I don't understand how
> to use it:
> // ISSUE Remove reference to avoid reference to reference problems
>
> does someone has any idea about this phenomenon?
>
> Adrien Schvalberg
>
> PS: I have to use VC6 for my work, so I understand that changing it
> would be great (and I'm stuck with many other limitations of VC6), but I
> can't ;-(
>
>
OK, self-answering, after some researchs, I've found the 2 following points:
1. I use BOOST_TT_BROKEN_COMPILER_SPEC(FakePoint) as a workaround to VC6 lacking
partial specialization of templates
2. I do a specialization of boost::numeric::ublas::promote_traits<T1, T2>
template<> struct boost::numeric::ublas::promote_traits<double, FakePoint>
{ typedef FakePoint promote_type; };
Does anyboday have a good idea about why T1 is the default return type in
promote_traits<T1, T2>?
Will it break something if I replace T1 by T2?
I do the following operation: W = M*V
with M: (mxn)-double matrix
V: n-Thing vector
Thing can be a point, a quaternion, anything you want such that double*Thing ->
Thing, Thing + Thing -> Thing, and Thing(0) (equals to the neutral element of Thing
addition law) are defined.
W should be a m-Thing vector, so the promote type should be Thing, ie T2
Adrien Schvalberg