#include <iostream>
struct Foo {
Foo() = default;
Foo(const Foo &) {}
Foo(Foo &&) = default;
};
struct Bar {
Bar() = default;
Bar(const Bar &) = default;
Bar(Bar &&);
};
Bar::Bar(Bar &&) = default;
Foo GetFoo() {
Foo foo;
std::cout << "GetFoo:" << &foo << std::endl;
return foo;
}
Bar GetBar() {
Bar bar;
std::cout << "GetBar:" << &bar << std::endl;
return bar;
}
int main() {
Foo foo = GetFoo();
std::cout << "foo:" << &foo << std::endl;
Bar bar = GetBar();
std::cout << "bar:" << &bar << std::endl;
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgpzdHJ1Y3QgRm9vIHsKCUZvbygpID0gZGVmYXVsdDsKCUZvbyhjb25zdCBGb28gJikge30KCUZvbyhGb28gJiYpID0gZGVmYXVsdDsKfTsKCnN0cnVjdCBCYXIgewoJQmFyKCkgPSBkZWZhdWx0OwoJQmFyKGNvbnN0IEJhciAmKSA9IGRlZmF1bHQ7CglCYXIoQmFyICYmKTsKfTsKQmFyOjpCYXIoQmFyICYmKSA9IGRlZmF1bHQ7CkZvbyBHZXRGb28oKSB7CglGb28gZm9vOwoJc3RkOjpjb3V0IDw8ICJHZXRGb286IiA8PCAmZm9vIDw8IHN0ZDo6ZW5kbDsKCXJldHVybiBmb287Cn0KCkJhciBHZXRCYXIoKSB7CglCYXIgYmFyOwoJc3RkOjpjb3V0IDw8ICJHZXRCYXI6IiA8PCAmYmFyIDw8IHN0ZDo6ZW5kbDsKCXJldHVybiBiYXI7Cn0KCmludCBtYWluKCkgewoJRm9vIGZvbyA9IEdldEZvbygpOwoJc3RkOjpjb3V0IDw8ICJmb286IiA8PCAmZm9vIDw8IHN0ZDo6ZW5kbDsKCUJhciBiYXIgPSBHZXRCYXIoKTsKCXN0ZDo6Y291dCA8PCAiYmFyOiIgPDwgJmJhciA8PCBzdGQ6OmVuZGw7CglyZXR1cm4gMDsKfQo=