I got a piece of code which uses a std::set to keep a bunch of pointer.
I used this to be sure of that each pointer will present only once in my container.
Then, I heard about std::unique_ptr that ensure the pointer will exists only once in my entire code, and that's exactly what I need.
So my question is quite simple, should I change my container type to std::vector ? Or It won't changes anything leaving a std::set ?
auto x = new xyz(); auto a = unique_ptr(x), b = unique_ptr(x);and don't usenewto create a unique_ptr, you will lose the advantages smart pointers give you.