In C ++, you cannot rely on a copy constructor that is called from the return statement because of a special clause in the standard that allows the compiler to omit the copy constructor call as a result of the return statement, even if the copy constructor has side effects. Thus, it is a bad style to write a copy constructor that does something else, and not just copy an instance of an instance.
Are there similar statements in the C ++ 11 standard that allow the compiler to exclude a call to the move constructor in certain circumstances - and if so, what are these circumstances?
source share