#include <memory>
#include <iostream>
class Example {
public:
Example() {std::cout << "constuctor" << this << std::endl;}
~Example() {std::cout << "destructor " << this << std::endl;}
};
class ABC {
public:
static std::unique_ptr<Example> get_example()
{
std::unique_ptr<Example> ptr = std::make_unique<Example>();
return ptr;
}
};
int main()
{
std::unique_ptr<Example> p = ABC::get_example();
std::cout << &p << std::endl;
}
I2luY2x1ZGUgPG1lbW9yeT4KI2luY2x1ZGUgPGlvc3RyZWFtPgoKY2xhc3MgRXhhbXBsZSB7CiAgcHVibGljOgogICAgRXhhbXBsZSgpIHtzdGQ6OmNvdXQgPDwgImNvbnN0dWN0b3IiIDw8IHRoaXMgPDwgc3RkOjplbmRsO30KICAgIH5FeGFtcGxlKCkge3N0ZDo6Y291dCA8PCAiZGVzdHJ1Y3RvciAiIDw8IHRoaXMgPDwgc3RkOjplbmRsO30KfTsKCmNsYXNzIEFCQyB7CiAgcHVibGljOgogICAgc3RhdGljIHN0ZDo6dW5pcXVlX3B0cjxFeGFtcGxlPiBnZXRfZXhhbXBsZSgpIAogICAgewogICAgICBzdGQ6OnVuaXF1ZV9wdHI8RXhhbXBsZT4gcHRyID0gc3RkOjptYWtlX3VuaXF1ZTxFeGFtcGxlPigpOwogICAgICByZXR1cm4gcHRyOwogICAgfQp9OwoKaW50IG1haW4oKQp7CglzdGQ6OnVuaXF1ZV9wdHI8RXhhbXBsZT4gcCA9IEFCQzo6Z2V0X2V4YW1wbGUoKTsKICAgIHN0ZDo6Y291dCA8PCAmcCA8PCBzdGQ6OmVuZGw7Cn0=