#include <iostream>
struct MyClass
{
MyClass() //default ctor
{
std::cout << "Constructed" << std::endl;
}
MyClass(MyClass const&from) //copy ctor
{
std::cout << "Copied" << std::endl;
}
~MyClass() //dtor
{
std::cout << "Destructed" << std::endl;
}
};
void f(MyClass) //pass by value
{
std::cout << "f" << std::endl;
}
int main()
{
MyClass mc;
f(mc);
std::cout << "End of main" << std::endl;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgoKc3RydWN0IE15Q2xhc3MKewogICAgTXlDbGFzcygpIC8vZGVmYXVsdCBjdG9yCiAgICB7CiAgICAgICAgc3RkOjpjb3V0IDw8ICJDb25zdHJ1Y3RlZCIgPDwgc3RkOjplbmRsOwogICAgfQogICAgTXlDbGFzcyhNeUNsYXNzIGNvbnN0JmZyb20pIC8vY29weSBjdG9yCiAgICB7CiAgICAgICAgc3RkOjpjb3V0IDw8ICJDb3BpZWQiIDw8IHN0ZDo6ZW5kbDsKICAgIH0KICAgIH5NeUNsYXNzKCkgLy9kdG9yCiAgICB7CiAgICAgICAgc3RkOjpjb3V0IDw8ICJEZXN0cnVjdGVkIiA8PCBzdGQ6OmVuZGw7CiAgICB9Cn07Cgp2b2lkIGYoTXlDbGFzcykgLy9wYXNzIGJ5IHZhbHVlCnsKICAgIHN0ZDo6Y291dCA8PCAiZiIgPDwgc3RkOjplbmRsOwp9CgppbnQgbWFpbigpCnsKICAgIE15Q2xhc3MgbWM7CiAgICBmKG1jKTsKICAgIHN0ZDo6Y291dCA8PCAiRW5kIG9mIG1haW4iIDw8IHN0ZDo6ZW5kbDsKfQo=