Boost logo

Boost :

From: Andrei Alexandrescu (andrewalex_at_[hidden])
Date: 2002-10-22 15:33:58

"Daniel Frey" <d.frey_at_[hidden]> wrote in message
>And 'return T(lhs)+=rhs;' only looks like a
case for URVO, but it isn't. Try it out...<

Now I got it, thanks.

>If the compiler implements NRVO, it cannot be made any better - the
temporary is simply eliminated completely.<


>If the compiler doesn't
implement the NRVO, Mojo may be the best pattern.<


>As you can see from the
patch to operators.hpp, boost can provide both.<


>Maybe you want to add a
Mojo-friendly implementation of the non-NRVO version? ;)<


>I still hadn't the time to look at Mojo II, but if you can use only ONE
implementation, Mojo might be best for now.<


>For the future, I think more
and more compilers will implement the NRVO.<


>(Personally I'd be very
interested to hear about the VC++7, but for some reason no-one here seems
to test it and tell us the result :o).<

Everett beta does URVO consistently (even in debug mode) but no NRVO at all
(even in release mode). When using an explicit move, it correctly applies

>(Obviously, Mojo has more advantages and can help to reduce the cost of a
lot more copies, but this is another issue...)<



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