On my question, I still know only one article, in which the use of NRVO is at least somehow described. An article from MSDN: Named Return Value Optimization in Visual C ++ 2005 . However, I am confused by the year of writing this article and the question arises: And what is the current state of affairs? After all, the yard is not 2005, but 2016!
This article provides three reasons for NOT to work:
- Different paths returning different named objects.
- Multiple return paths (even if the same named object is returned) with EH states introduced.
- The named object returned is referenced in an inline asm block.
Has anything changed since then?