Boost logo

Boost :

Subject: Re: [boost] copy on write for std containers
From: Jeffrey Lee Hellrung, Jr. (jhellrung_at_[hidden])
Date: 2010-12-04 19:18:45


On 12/4/2010 4:11 PM, Peter Foelsche wrote:
[...]
> Anybody know in which cases the compiler optimizes away
> or does not optimize away the call to the copy-constructor
> when returning an object by value?

http://en.wikipedia.org/wiki/Return_value_optimization

> I still think that something like this should be available in some
> library for people,
> which cannot write such a wrapper in a few minutes by themselves.

I think the point is that copy-on-write is rarely optimal, often
suboptimal, and increases complexity; hence it should not be encouraged.

- Jeff


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