std::auto_ptr to std::unique_ptr
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 … Read more
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 … Read more
In practice with C++, what is RAII, what are smart pointers, how are these implemented in a program and what are the benefits … Read more
What is the difference between the following set of pointers? When do you use each pointer in production code, if at all? Examples … Read more
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 … Read more
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 … Read more
std::unique_ptr has support for arrays, for instance: std::unique_ptr<int[]> p(new int[10]); but is it needed? probably it is more convenient to use std::vector or … Read more
What is a smart pointer and when should I use one? 1 14 UPDATE This answer is rather old, and so describes what … Read more