#include <iostream>
#include <memory>
using namespace std;
class Point1 {
public:
int x;
int y;
Point1(int x, int y);
~Point1();
};
Point1::Point1(int x1, int y1) {
x = x1;
y = y1;
cout << "criou" << endl; //estou deixando só para fins didáticos
}
Point1::~Point1() {
cout << "destruiu " << x << " " << y << endl; //para fins de debug
}
unique_ptr<Point1> retorno() {
unique_ptr<Point1> C(new Point1(1,4));
return C;
}
int main() {
auto C = retorno();
cout << C->x << endl;
cout << C->y << endl;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8bWVtb3J5Pgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKY2xhc3MgUG9pbnQxIHsKcHVibGljOgogICAgaW50IHg7CiAgICBpbnQgeTsKCiAgICBQb2ludDEoaW50IHgsIGludCB5KTsKICAgIH5Qb2ludDEoKTsKfTsKClBvaW50MTo6UG9pbnQxKGludCB4MSwgaW50IHkxKSB7CiAgICB4ID0geDE7CiAgICB5ID0geTE7CiAgICBjb3V0IDw8ICJjcmlvdSIgPDwgZW5kbDsgLy9lc3RvdSBkZWl4YW5kbyBzw7MgcGFyYSBmaW5zIGRpZMOhdGljb3MKfQoKUG9pbnQxOjp+UG9pbnQxKCkgewogICAgY291dCA8PCAiZGVzdHJ1aXUgIiA8PCB4IDw8ICIgIiA8PCB5IDw8IGVuZGw7IC8vcGFyYSBmaW5zIGRlIGRlYnVnCn0KCnVuaXF1ZV9wdHI8UG9pbnQxPiByZXRvcm5vKCkgewogICAgdW5pcXVlX3B0cjxQb2ludDE+IEMobmV3IFBvaW50MSgxLDQpKTsKICAgIHJldHVybiBDOwp9CgppbnQgbWFpbigpIHsKICAgIGF1dG8gQyA9IHJldG9ybm8oKTsKICAgIGNvdXQgPDwgQy0+eCA8PCBlbmRsOwogICAgY291dCA8PCBDLT55IDw8IGVuZGw7Cn0=