Terje Slettebų wrote: > The compiler may elide such copy, even if the temporary being returned is a > named variable, and several compilers (such as g++ and the EDG based ones), > does this optimisation (RVO). For example: > > <snip/>
Playing devil's advocate, I think RVO can easily be fooled with not-so-tricky code. If you're really concerned about this situation, use some sort of smart pointer. For example: boost:shared_ptr< T > f( boost::shared_ptr< T > const in_ ); Noel _______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost