views:

176

answers:

2

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

+1  A: 

Maybe this may help you.

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

Dario
+3  A: 

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.

anon
More Effective C++ has an item on RVO ..so thought it would be good to know these things
yesraaj