I often return objects by value, assuming that copy elision / RVO will happen.
But I don't have a good under-the-hood understanding of compilers, and the possibility that sometimes something in my code might sabotage copy elision without my knowledge, scares me.
Is there a simple set of rules to bear in mind under which I can be reasonably confident that copy elision happens (or at least, that I am not preventing it)?