Return value optimization in VC2008

Is there another technique like RVO (return value optimization) or NRVO (called return value optimization) that can be used with VC2008?

0


a source to share


2 answers


Maybe this can help you.



But usually it is the compiler that does the optimization, not you.

+1


a source


I wouldn't worry too much about these optimizations if I were you. Among other things, they are not portable.



If you are worried about writing efficient C ++ code, rule number one is to avoid copying at all. Make sure you use the link wherever possible, but don't try to use it where it is missing. After that, you sometimes need a new value - as a return value for implementations of the + () operator, for example.

+2


a source







All Articles