|
Boost : |
From: Andrei Alexandrescu (andrewalex_at_[hidden])
Date: 2002-10-22 15:33:58
"Daniel Frey" <d.frey_at_[hidden]> wrote in message
news:ap4beu$bo$1_at_main.gmane.org...
>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.<
Oui.
>If the compiler doesn't
implement the NRVO, Mojo may be the best pattern.<
Si.
>As you can see from the
patch to operators.hpp, boost can provide both.<
Ja.
>Maybe you want to add a
Mojo-friendly implementation of the non-NRVO version? ;)<
Igen.
>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.<
Da.
>For the future, I think more
and more compilers will implement the NRVO.<
Shi4.
>(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
URVO.
>(Obviously, Mojo has more advantages and can help to reduce the cost of a
lot more copies, but this is another issue...)<
Hai.
Andrei
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk