Boost logo

Boost :

Subject: Re: [boost] Temporary objects
From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2009-11-02 12:52:35


AMDG

DE wrote:
> on 31.10.2009 at 17:12
> Mathias Gaunard wrote :
>
>> NRVO doesn't involve the assignment operator at all.
>> The optimization also doesn't even require to know what the definition
>> of the copy constructor is, so static analysis of its definition is
>> irrelevant.
>>
> i mean that in an example like
>
> type foo(const type &to_be_processed)
> {
> type ret;
> //processing
> return ret;
> }
>
> semantics of the copy constructor does matter
> here nrvo likely not to take place (actually it should NOT take place)
>

This is exactly the case where NRVO should happen.
(NRVO stands for named return value optimization as
opposed to RVO which is for temporaries)

In Christ,
Steven Watanabe


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