Mail Archives: djgpp/1997/08/07/10:41:33
Erik Max Francis (max AT alcyone DOT com) writes:
> Paul Derbyshire wrote:
>
>> Try omitting the space after "operator":
>>
>> inline friend Vector operator* (Matrix& mat, Vector& vect);
>
> The original post hasn't shown up on my server, but this shouldn't be the
> problem. It's perfectly legal for there to be whitespace between the
> `operator' keyword and the symbol in the function name. operator new is a
> good example, since you _have_ to have whitespace. Namely, I do it all
> the time.
Well, there's also that he has the vector reversed now that I look a second
time. Vector * Matrix seems to be what he wants, so there should be
(Vector &vect, Matrix &mat) for params.
And, to make it easy to use, he needs to make a double dispatcher in Matrix:
inline friend Matrix operator* (Matrix &mat, Vector &vect) {
return vect*mat; // Matrix*vector calls vector*matrix which does the math.
}
And, you can redefine new? How's this done...and why, to make a handler
for exhausted heap?
--
.*. Where feelings are concerned, answers are rarely simple [GeneDeWeese]
-() < When I go to the theater, I always go straight to the "bag and mix"
`*' bulk candy section...because variety is the spice of life... [me]
Paul Derbyshire ao950 AT freenet DOT carleton DOT ca, http://chat.carleton.ca/~pderbysh
- Raw text -