Subject: Re: [boost] rvalue ref best practices?
From: Ion Gaztañaga (igaztanaga_at_[hidden])
Date: 2012-06-15 17:36:01
El 15/06/2012 19:41, Mathias Gaunard escribió:
> On 15/06/2012 18:02, Dave Abrahams wrote:
>> Most people don't know what "most objects" are like :-)
> The copy and swap idiom is usually what's used for non-containers.
>>> It doesn't seem a good idea to introduce a new function overloading
>>> mechanism to drop that would always void this guarantee.
>> I don't understand this sentence.
> Some words were left when I was rewriting it.
> It doesn't seem a good idea to introduce a new function overloading
> mechanism that would always void this guarantee.
I agree that is not desirable to weaken strong exception guarantees for
objects because of the syntax. However there is an alternative syntax
that does not void this guarantee as already constructed parameters are
passed like references. I don't think this should surprise the programmer:
//A & B constructed, c & d reused
C c(...); D d(...);
[A a, B b] -> int ret = produce_abcd(a, b, c, d);
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk