Top "Shared-ptr" questions

Reference counted smart pointer class implementing shared ownership

C++: "... is not a polymorphic type" while using boost::dynamic_pointer_cast

Why do I receive the following error for the following code? 1>C:\Libs\boost_1_44\boost/smart_ptr/shared_ptr.…

c++ compiler-errors shared-ptr dynamic-cast
intrusive_ptr in c++11

Does C++11 have something equivalent to boost::intrusive_ptr? My problem is that I have a C-style interface over my …

c++ c++11 boost shared-ptr smart-pointers
In gdb, I can call some class functions, but others "cannot be resolved". Why?

I have not worked on shared pointers yet .. I just know the concept. I'm trying to debug functions in the …

c++ debugging boost gdb shared-ptr
The cost of passing by shared_ptr

I use std::tr1::shared_ptr extensively throughout my application. This includes passing objects in as function arguments. Consider the …

c++ performance shared-ptr
std::shared_ptr and initializer lists

The std::shared_ptr constructor isn't behaving as I expected: #include <iostream> #include <vector> void func(…

c++ c++11 clang shared-ptr initializer-list
How to avoid memory leak with shared_ptr?

Consider the following code. using boost::shared_ptr; struct B; struct A{ ~A() { std::cout << "~A" << …

c++ boost memory-leaks shared-ptr smart-pointers
Why is GoogleMock leaking my shared_ptr?

I use GoogleMock/GoogleTest for testing, and I'm seeing some strange behavior when a matcher has a shared_ptr to …

c++ boost shared-ptr googletest googlemock
Should I use shared_ptr or unique_ptr

I've been making some objects using the pimpl idiom, but I'm not sure whether to use std::shared_ptr or …

c++ c++11 shared-ptr pimpl-idiom unique-ptr
Forward declarations and shared_ptr

I'm trying to refactor my code so that I use forward declarations instead of including lots of headers. I'm new …

c++ shared-ptr forward-declaration c++98
Can you allocate an array with something equivalent to make_shared?

buffer = new char[64]; buffer = std::make_shared<char>(char[64]); ??? Can you allocate memory to an array using make_…

c++ c++11 shared-ptr make-shared