Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // --- unique_ptr ---
- T unique uptr(new T); // std::unique_ptr<T> uptr(std::make_unique<T>());
- uptr = T(); // *uptr = T();
- uptr.foo(); // uptr->foo();
- uptr->reset(new T); // uptr = std::make_unique<T>();
- (@uptr).reset(new T); // uptr = std::make_unique<T>();
- (*@uptr).foo(); // uptr->foo();
- // --- pointeur ---
- int x(123), y(456);
- int& ref(x); // int* ref = &x;
- ref = 345; // *ref = 345;
- @ref = @y; // ref = &y;
- assert(ref isnot null); // assert(ref != nullptr)
- // --- pointer X unique_ptr ---
- T& ptr(uptr);
- @ptr = @uptr;
Advertisement
Add Comment
Please, Sign In to add comment