How will the NRV optimization effect r-values?

J

James Smith

NRV changes a function that processes and returns an object into a
function that takes a reference to that object. When using r-values
this optimization seems to be unnecessary. I assume any code that
requires the optimization would now use r-values instead.


James Smith
(e-mail address removed)
 
A

Alf P. Steinbach

* James Smith:
NRV changes a function that processes and returns an object into a
function that takes a reference to that object. When using r-values
this optimization seems to be unnecessary. I assume any code that
requires the optimization would now use r-values instead.

Probably you're talking about rvalue references.

No, what goes on at the machine code level doesn't change.

It's how it's expressed at the C++ level, and what guarantees you have, that
changes.


Cheers & hth.,

- Alf
 
N

Noah Roberts

* James Smith:

Probably you're talking about rvalue references.

No, what goes on at the machine code level doesn't change.

It's how it's expressed at the C++ level, and what guarantees you have, that
changes.

The VS2010RC docs/websites claim that if NRV is not possible it will use
the move constructor if it is available. I don't know if this is a
requirement of C++0x or not.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,147
Messages
2,570,835
Members
47,383
Latest member
EzraGiffor

Latest Threads

Top