Boost logo

Boost :

Subject: Re: [boost] [Operators] Update, const-correctness and operator chaining
From: Andrew Ho (helloworld922_at_[hidden])
Date: 2013-07-02 13:12:59


Jonathan Wakely <jwakely.boost <at> kayari.org> writes:
>
> You can put an lvalue ref-qualifier on the assignment operator, to
> forbid assignment to rvalues.
>
> T& operator=(const T&)&;
>
> I'm not sure it's really beneficial to do so though.
>

Ok, so it's the User's prerogative to determine if this is important to them
or not, as well as depending on compiler support for N2439 (r-value ref for
*this).

Other than this rather obscure problem I haven't found any glaring issues
with the above set, and I've been using it when applicable. Has anyone else
found any outstanding issues with using these overloads?

Also, I'm curious as to what kind of regression tests we want for Operators,
if any. As far as I can tell there's no regression tests for the current
version of Operators.

Things which might make good tests:

1. General use case for every class
1a. Single operator call
1b. Chained operators

2. Cases where return-by-rvalue ref is known to fail
2a. T& res = a + b
2b. foreach(char c : custom_str1() + custom_str2())

Is there anything else we would want to test?


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk