Top "Shared-ptr" questions

Reference counted smart pointer class implementing shared ownership

Assigning existing values to smart-ptrs?

I am just learning about smart pointers, and I am having trouble assigning a pre-existing location of a variable to …

c++ std shared-ptr tr1
Using std::move with std::shared_ptr

I have a function defined as follows: void foo(std::shared_ptr<X> x) { ... }; If I declare a …

c++ c++11 shared-ptr move-semantics
Alternatives of static_pointer_cast for unique_ptr

I understand that using static_pointer_cast with unique_ptr would lead to a shared ownership of the contained data. …

c++ c++11 casting shared-ptr unique-ptr
Why can't a weak_ptr be constructed from a unique_ptr?

If I understand correctly, a weak_ptr doesn't increment the reference count of the managed object, therefore it doesn't represent …

c++ shared-ptr smart-pointers unique-ptr weak-ptr
std::shared_ptr: reset() vs. assignment

This is a basic question, but I did not find a previous post about it. The title of the following …

c++ c++11 shared-ptr
How does a reference-counting smart pointer's reference counting work?

In other words, how does the implementation keeps track of the count? Is there a map-like object maintained which is …

c++ memory-management memory-leaks smart-pointers shared-ptr
What's your convention for typedef'ing shared_ptr?

I'm flip-flopping between naming conventions for typedef'ing the boost::shared_ptr template. For example: typedef boost::shared_ptr<Foo&…

c++ boost naming-conventions shared-ptr
Is boost shared_ptr <XXX> thread safe?

I have a question about boost::shared_ptr<T>. There are lots of thread. using namespace boost; class …

c++ boost thread-safety shared-ptr boost-smart-ptr
boost, shared ptr Vs weak ptr? Which to use when?

In my current project I am using boost::shared_ptr quite extensively. Recently my fellow team mates have also started …

c++ memory-management boost shared-ptr weak-ptr
dynamic_cast across a shared_ptr?

I have two classes A and B, B inherits from A. If I have a shared_ptr<A> …

c++ polymorphism shared-ptr dynamic-cast