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 13:20:59


On 13/07/2014 01:18 p.m., Peter Dimov wrote:
> Agustín K-ballo Bergé wrote:
>> 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.
>
> I'm not sure I understand. Can you post the code example that
> demonstrates the accidental collapsing before the rvalue change?

As mentioned in the pull request, cases like the following:

   int i= 0;
   boost::reference_wrapper<int> r = boost::ref(boost::ref(i));

were performing "accidental collapsing", as it triggers an implicit
conversion followed by a (possibly elided) copy construction.

After the rvalue change, and without explicit collapsing, this results
in a compilation error.

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