#include <iostream>
struct reporting {
reporting() { std::cout << "Constructed" << std::endl;}
~reporting() { std::cout << "Destructed" << std::endl;}
reporting(reporting const&) { std::cout << "Copy-Constructed" << std::endl;}
reporting(reporting &&) { std::cout << "Move-Constructed" << std::endl;}
reporting & operator=(reporting const&) { std::cout << "Copy-Assigned" << std::endl; return *this;}
reporting & operator=(reporting &&) { std::cout << "Move-Assigned" << std::endl; return *this;}
void print() const {std::cout << "printing." << std::endl;}
};
const reporting& get_or(const reporting& def)
{
return def;
}
int main()
{
const reporting& foo = get_or(reporting{});
foo.print();
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgoKc3RydWN0IHJlcG9ydGluZyB7CglyZXBvcnRpbmcoKSB7IHN0ZDo6Y291dCA8PCAiQ29uc3RydWN0ZWQiIDw8IHN0ZDo6ZW5kbDt9Cgl+cmVwb3J0aW5nKCkgeyBzdGQ6OmNvdXQgPDwgIkRlc3RydWN0ZWQiIDw8IHN0ZDo6ZW5kbDt9CglyZXBvcnRpbmcocmVwb3J0aW5nIGNvbnN0JikgeyBzdGQ6OmNvdXQgPDwgIkNvcHktQ29uc3RydWN0ZWQiIDw8IHN0ZDo6ZW5kbDt9CglyZXBvcnRpbmcocmVwb3J0aW5nICYmKSB7IHN0ZDo6Y291dCA8PCAiTW92ZS1Db25zdHJ1Y3RlZCIgPDwgc3RkOjplbmRsO30KCXJlcG9ydGluZyAmIG9wZXJhdG9yPShyZXBvcnRpbmcgY29uc3QmKSB7IHN0ZDo6Y291dCA8PCAiQ29weS1Bc3NpZ25lZCIgPDwgc3RkOjplbmRsOyByZXR1cm4gKnRoaXM7fQoJcmVwb3J0aW5nICYgb3BlcmF0b3I9KHJlcG9ydGluZyAmJikgeyBzdGQ6OmNvdXQgPDwgIk1vdmUtQXNzaWduZWQiIDw8IHN0ZDo6ZW5kbDsgcmV0dXJuICp0aGlzO30KCQoJdm9pZCBwcmludCgpIGNvbnN0IHtzdGQ6OmNvdXQgPDwgInByaW50aW5nLiIgPDwgc3RkOjplbmRsO30KfTsKCmNvbnN0IHJlcG9ydGluZyYgZ2V0X29yKGNvbnN0IHJlcG9ydGluZyYgZGVmKQp7CiAgICByZXR1cm4gZGVmOwp9CgppbnQgbWFpbigpCnsKICAgIGNvbnN0IHJlcG9ydGluZyYgZm9vID0gZ2V0X29yKHJlcG9ydGluZ3t9KTsKCiAgICBmb28ucHJpbnQoKTsKICAgIHJldHVybiAwOwp9