Mail Archives: djgpp/2004/04/01/20:00:55
--------------CDD48D4729D3EB737F969B2F
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
This might not work, but... Try changing Matrix& operator* (double,
Matrix&) into Matrix& Matrix::operator* (double). You'll have to reverse
the arguments, ie:
weight=weight+(Matrix&)(Deltaweight*rate)
Chris wrote:
> As a result of my last posting, I apparently have a little catching up
> to do on the "new" C++ relative to updating my old programs. So,
> here's another one for the DJGPP warriors:
>
> In my header file, I have overloaded "*" as follows:
>
> friend Matrix & operator*(FLOAT_TYPE, Matrix &); // multiply
> scalar & matrix
>
> Of course, this compiles nicely. In implementation as follows:
>
> double rate;
> Matrix DeltaWeight(4,4);
> Matrix weight(4,4);
> ...
> weight=weight+(Matrix&)(rate*(Matrix&)DeltaWeight);
> ...
>
> and I get the following error:
>
> connect.cc:88: error: ISO C++ says that `Matrix& operator*(double,
> Matrix&)' and `operator*' are ambiguous even though the worst
> conversion for the former is better than the worst conversion for the
> latter
>
> In my header file, I have also overloaded the double() function to
> allow the casting of a 1x1 matrix into a double, but here I have
> explicitly cast DeltaWeight as a Matrix as well as the result of the
> multiplication.
>
> As always, any help is appreciated.
>
> --Chris
--------------CDD48D4729D3EB737F969B2F
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
This might not work, but... Try changing Matrix& operator* (double,
Matrix&) into Matrix& Matrix::operator* (double). You'll have to
reverse the arguments, ie:
<p><tt> weight=weight+(Matrix&)(Deltaweight*rate)</tt>
<p>Chris wrote:
<blockquote TYPE=CITE>As a result of my last posting, I apparently have
a little catching up
<br>to do on the "new" C++ relative to updating my old programs.
So,
<br>here's another one for the DJGPP warriors:
<p>In my header file, I have overloaded "*" as follows:
<p> friend Matrix & operator*(FLOAT_TYPE, Matrix
&); // multiply
<br>scalar & matrix
<p>Of course, this compiles nicely. In implementation as follows:
<p> double rate;
<br> Matrix DeltaWeight(4,4);
<br> Matrix weight(4,4);
<br>...
<br> weight=weight+(Matrix&)(rate*(Matrix&)DeltaWeight);
<br>...
<p>and I get the following error:
<p>connect.cc:88: error: ISO C++ says that `Matrix& operator*(double,
<br>Matrix&)' and `operator*' are ambiguous even though the worst
<br>conversion for the former is better than the worst conversion for the
<br>latter
<p>In my header file, I have also overloaded the double() function to
<br>allow the casting of a 1x1 matrix into a double, but here I have
<br>explicitly cast DeltaWeight as a Matrix as well as the result of the
<br>multiplication.
<p>As always, any help is appreciated.
<p>--Chris</blockquote>
</html>
--------------CDD48D4729D3EB737F969B2F--
- Raw text -