SHARE
TWEET

Untitled

a guest Oct 19th, 2019 62 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. int main() {
  2.     UniquePtr<int> a;
  3.     int* t = new int;
  4.     *t = 5;
  5.     a.reset(t);
  6.     UniquePtr<int> b(std::move(a));
  7.     int *c = new int;
  8.     *c = 1000;
  9.     UniquePtr<int> z(std::move(c));
  10.     std::cout << *z;
  11.     z.swap(b);
  12.     std::cout << *(z.release());
  13.     return 0;
  14. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top