#include <iostream>
#include <memory>
using namespace std;
void TestUP(unique_ptr<int> &temp)
{
cout<<*temp<<endl;
*temp=100;
}
int main (void)
{
int a{10};
unique_ptr<int> p{&a};
TestUP(p);
cout<<a<<endl; //yes, it is 100 now
p.release(); //you bind a local variable, don't forget to release
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8bWVtb3J5Pgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKdm9pZCBUZXN0VVAodW5pcXVlX3B0cjxpbnQ+ICZ0ZW1wKQp7CiAgICBjb3V0PDwqdGVtcDw8ZW5kbDsKICAgICp0ZW1wPTEwMDsKfQoKaW50IG1haW4gKHZvaWQpCnsKICAgIGludCBhezEwfTsKICAgIHVuaXF1ZV9wdHI8aW50PiBweyZhfTsKICAgIFRlc3RVUChwKTsKICAgIGNvdXQ8PGE8PGVuZGw7CS8veWVzLCBpdCBpcyAxMDAgbm93CiAgICBwLnJlbGVhc2UoKTsJLy95b3UgYmluZCBhIGxvY2FsIHZhcmlhYmxlLCBkb24ndCBmb3JnZXQgdG8gcmVsZWFzZQogICAgcmV0dXJuIDA7Cn0=