Top "Shared-ptr" questions

Reference counted smart pointer class implementing shared ownership

How does one downcast a std::shared_ptr?

Consider: struct SomethingThatsABase { virtual bool IsChildOne() const { return false; } virtual bool IsChildTwo() const { return false; } }; struct ChildOne : public SomethingThatsABase { virtual …

c++ c++11 shared-ptr downcast
shared_ptr Assertion px != 0 failed

I have a fairly complex multi threaded application (server) that from time to time will crash due to an assert: /…

shared-ptr boost-thread
Why would I std::move an std::shared_ptr?

I have been looking through the Clang source code and I found this snippet: void CompilerInstance::setInvocation( std::shared_ptr&…

c++ c++11 shared-ptr smart-pointers move-semantics
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
static_cast with boost::shared_ptr?

What is the equivalent of a static_cast with boost::shared_ptr? In other words, how do I have to …

c++ boost shared-ptr static-cast
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
Does using .reset() on a std::shared_ptr delete all instances

I'm new to shared_ptr's and I'm trying to figure out the exact functionality of the .reset() function. #include <…

c++ memory memory-leaks shared-memory shared-ptr
Is make_shared really more efficient than new?

I was experimenting with shared_ptr and make_shared from C++11 and programmed a little toy example to see what …

c++ shared-ptr clang libc++ make-shared
How to properly duplicate an object given its shared_ptr

I'm trying to make a duplicate of an object of a custom class Event. I have a shared pointer to …

c++ shared-ptr copy-constructor
How to initialize a shared_ptr that is a member of a class?

I am not sure about a good way to initialize a shared_ptr that is a member of a class. …

c++ boost initialization shared-ptr member