KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
What are recommended uses of a std::unique_ptr as to specifically where, when, and how is it is best used? I discovered: About unique_ptr performances I already know: std::unique_ptr was developed in C++11 as a replacement for std::auto_ptr That a std::unique_ptr has no reference counting and "owns" object it points to There is no copy/assign with a std::unique_ptr When I need a unique pointer, std::unique_ptr is the go to structure What I would like to know: Is using a std::unique_ptr ever preferable (other than uniqueness) to something else? What do I gain in this situation? If so, under what circumstances and when? Given the need for move semantics, would this make a std::unique_ptr less favorable overall? If a std::shared_ptr would suffice for dynamic memory management in nearly every situation, why does having at my disposal a std::unique_ptr matter (again, other than uniqueness)?
Tags (comma-separated)
Save Edits
Cancel