Boost logo

Boost :

From: Daniel Frey (d.frey_at_[hidden])
Date: 2004-02-07 05:16:28

On Sat, 07 Feb 2004 01:00:49 +0100, David Abrahams wrote:

> The example below shows a technique for perfect forwarding that seems to
> work with GCC 3.3.1. rvalues are always moved automatically, and
> lvalues are copied.

Nice. No, more than that, it's great!

FWIW, I discovered that you can reduce the number of temporaries/objects
further. In source() and csource(), change 'return X();' to 'X nrv; return
nrv;'. Although I have to admit that I'm at a loss why the NRVO works
while the RVO seems to be broken for your code (tested on Intel 7.1 and
the GCC 3.3.2).

Regards, Daniel

Boost list run by bdawes at, gregod at, cpdaniel at, john at