// Call constr [1] : Create [1]
A objAA = objA ; // Call cpy-constr : Create [2]
return objAA; // Call Destr : Delete [1]
}
{
A CpyObj = CreateLocal(); [2]
} // Call Destr : Delete [2]
Вопрос - почему у меня в return нет вызова конструктора копирования?
NRVO?
In a return statement, when the operand is the name of a non-volatile object with automatic storage duration, which isn't a function parameter or a catch clause parameter, and which is of the same class type (ignoring cv-qualification) as the function return type. This variant of copy elision is known as NRVO, "named return value optimization".
Спасибо
Обсуждают сегодня