Boost logo

Boost :

Subject: Re: [boost] [core] Breaking change to boost::ref in 1.56
From: Agustín K-ballo Bergé (kaballo86_at_[hidden])
Date: 2014-07-13 11:01:30


On 13/07/2014 10:10 a.m., Agustín K-ballo Bergé wrote:
> On 13/07/2014 07:16 a.m., Andrey Semashev wrote:
>> On Sunday 13 July 2014 12:48:30 Peter Dimov wrote:
>>>> I'm not strongly opposed to reverting, but the change looks justified
>>>> enough to me. Allowing dangling reference wrappers is surely not the
>>>> correct behavior.
>>>
>>> Dangling reference wrappers are prevented by a separate and independent
>>> change
>>>
>>> https://github.com/boostorg/core/commit/45f7564db29a3bafa5dfd8c41396843493d1
>>>
>>> 378a
>>>
>>> that is (I think) not affected by the removal of the collapsing
>>> overloads.
>>
>> Ok, good. I take it that the motivating example:
>>
>> boost::ref(boost::ref(t));
>>
>> should not compile then?
>>
>
> IIRC, the change was motivated by that dubious case of
> `boost::ref(boost::ref(t))` which was working, although not in an
> obvious way, and stopped working after disabling references to rvalues.
>

I have been going over the changes and I recall some more stuff now.
Before I disabled creating references to rvalues, `boost::ref` was doing
"accidental reference collapsing" for two levels of wrapping. The
motivation of the change was to avoid breaking code that assumed
reference collapsing as in `std::ref` and just happened to work.

I would suggest consistency one way or another, but either is a breaking
change. It seems the simplest solution would be to remove the reference
collapsing, accidental or otherwise, and I would recommend that at least
for the short run if it makes Proto work again.

Regards,

-- 
Agustín K-ballo Bergé.-
http://talesofcpp.fusionfenix.com

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