Boost logo

Boost Users :

Subject: Re: [Boost-users] [Q] using boost operators return types
From: Alan M. Carroll (amc_at_[hidden])
Date: 2009-03-23 11:41:31


At 09:55 AM 3/23/2009, V S P wrote:
>I am using this example
>http://www.boost.org/doc/libs/1_38_0/libs/utility/operators.htm#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 expected:

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[1] just below.

[1] http://www.boost.org/doc/libs/1_38_0/libs/utility/operators.htm#smpl_oprs


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