Пример оптимизации возврата значения
#include<iostream>
struct Box {
Box() = default;
Box(const Box&) {
std::cout << "Copy Constructor being called \n";
}
};
Box func() {
return Box();
}
int main() {
std::cout << "Main function entered\n";
Box obj = func();
}
Rajesh Mani