Original Post
I am trying to understand the changes and differences with some of the smart pointers and containers. Using the vector form of std::unique_ptr has some overlapping functionality with std::vector. What are the general guidelines here? What I think, is:
std::unique_ptr
std::unique_ptr
- is better to use when you want to transfer ownership
- has no overhead (memory or CPU)
std::vector:- is better when the initial size is unknown as it allows for dynamic growth
- keeps track of the size for you
Am I missing something?
- is better when the initial size is unknown as it allows for dynamic growth