With the new standard coming (and parts already available in some compilers), the new type std::unique_ptr is supposed to be a replacement for std::auto_ptr. Does their usage exactly overlap...
In practice with C++, what is RAII, what are smart pointers, how are these implemented in a program and what are the benefits of using RAII with smart pointers?...
What is the difference between the following set of pointers? When do you use each pointer in production code, if at all? Examples would be appreciated! scoped_ptr shared_ptr weak_ptr...
Ok, so the last time I wrote C++ for a living, std::auto_ptr was all the std lib had available, and boost::shared_ptr was all the rage. I never really looked...
What is wrong with this program? #include <memory> #include <vector> int main() { std::vector<std::unique_ptr<int>> vec; int x(1); std::unique_ptr<int> ptr2x(&x); vec.push_back(ptr2x); //This tiny command has a vicious error. return 0;...
std::unique_ptr has support for arrays, for instance: std::unique_ptr<int> p(new int...
What is a smart pointer and when should I use one? 1 14 UPDATE This answer is rather old, and so describes what was ‘good’ at the time, which...