Question

Is there other technique like RVO (return value optimization) or NRVO (named return value optimization) that can be use with VC2008?

Was it helpful?

Solution

Maybe this may help you.

But typically it's the compiler who does such kind of optimization, not you.

OTHER TIPS

I wouldn't worry too much about those optimisations if I were you. Apart from anything else, they are not portable.

If you are worried about writing efficient C++ code, the number one rule is to avoid copying altogether. Make sure you use reference in all places where they are possible, but don't try to use them where they are not. After, all sometimes you actually need a new value - as the return value for implementations of operator+(), for example.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top