Boost Users :
Subject: Re: [Boost-users] [Q] using boost operators return types
From: V S P (toreason_at_[hidden])
Date: 2009-03-23 12:54:25
Thank you for the reply
I am still a bit lost
for example, the doc says
produces T operator-(const T&, const T&)
T temp(t); temp -= t1.
so does this mean
T& operator -= (const T& ) ?
this is a separate question:
I have implemented the <addable> tempalte with +=
(as in the point example, but made it return a reference)
then I do
and I see in the debugger that
the *this in the operator += points to 100, not to 300
I am sure I am doing something wrong, but I thought
in the += operator, *this would mean the value of "a" variable
Is at least my understanding correct, that *this should be pointing to
and not 100?
thank you again,
On Mon, 23 Mar 2009 10:41 -0500, "Alan M. Carroll"
> At 09:55 AM 3/23/2009, V S P wrote:
> >I am using this example
> >but cannot understand
> >why object is returned from those operators and not an object reference
> That certainly is odd. It means that the following code will not work as
> point x(0,0), y(1,0), z(0,1);
> (x += y) += z; // x is (1,0), not (1,1).
> >second, I do not quite understand, what exactly is a set of
> >'automatically generated' operators and would I figure that out.
> It is documented in the comments of the example you cite, and listed in
> the table just below.
> Boost-users mailing list
-- V S P toreason_at_[hidden] -- http://www.fastmail.fm - I mean, what is it about a decent email service?
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net