Top "Smart-pointers" questions

An abstract data type that simulates a pointer while providing additional features, such as automatic garbage collection or bounds checking

Why is auto_ptr being deprecated?

I heard auto_ptr is being deprecated in C++11. What is the reason for this? Also I would like to …

c++ c++11 smart-pointers auto-ptr
Create a boost::shared_ptr to an existing variable

I have an existing variable, e.g. int a = 3; How can I now create a boost::shared_ptr to a? …

c++ boost shared-ptr smart-pointers
creating a shared_ptr from unique_ptr

In a piece of code I reviewed lately, which compiled fine with g++-4.6, I encountered a strange try to …

c++ c++11 g++ smart-pointers clang++
How much is the overhead of smart pointers compared to normal pointers in C++?

How much is the overhead of smart pointers compared to normal pointers in C++11? In other words, is my code …

c++ performance c++11 smart-pointers
Is auto_ptr deprecated?

Will auto_ptr be deprecated in incoming C++ standard? Should unique_ptr be used for ownership transfer instead of shared_…

c++ standards smart-pointers auto-ptr unique-ptr
shared_ptr vs scoped_ptr

scoped_ptr is not copy able and is being deleted out of the scope. So it is kind of restricted …

c++ boost shared-ptr smart-pointers scoped-ptr
How to initialize std::unique_ptr in constructor?

A.hpp: class A { private: std::unique_ptr<std::ifstream> file; public: A(std::string filename); }; A.cpp: …

c++ smart-pointers ifstream unique-ptr
Dynamic casting for unique_ptr

As it was the case in Boost, C++11 provides some functions for casting shared_ptr: std::static_pointer_cast std::…

c++ casting c++11 smart-pointers unique-ptr
Which kind of pointer do I use when?

Ok, so the last time I wrote C++ for a living, std::auto_ptr was all the std lib had …

c++ pointers c++11 smart-pointers c++-faq
boost Shared_pointer NULL

I'm using reset() as a default value for my shared_pointer (equivalent to a NULL). But how do I check …

c++ boost shared-ptr smart-pointers