Smart Pointers and std::unique_ptr

An introduction to memory ownership using smart pointers and std::unique_ptr in C++

Ryan McCombe
Updated
Hello! I'm here to help you with any questions about this lesson. Feel free to ask me anything - whether it's about specific concepts, examples, or how to apply what you've learned!

Questions & Answers

Answers are generated by AI models and may not have been reviewed. Be mindful when running any code on your device.

Mixing Smart and Raw Pointers
Is it okay to mix smart pointers and raw pointers in the same program?
Should I Pass Smart Pointers by Reference?
Should I pass smart pointers by value or reference?
Dynamically Allocating Arrays with Smart Pointers
How do I dynamically allocate an array with smart pointers?
Using Smart Pointers with Custom Deleters
Can I use smart pointers with my own custom deleters?
std::make_unique vs new Keyword
What are the advantages of using std::make_unique over the new keyword?
Using std::move with std::unique_ptr
What does std::move do when used with std::unique_ptr?
Using std::unique_ptr as a Class Member
How do I use std::unique_ptr as a member of a class?