Phil Bouchard wrote:
I added the new repository with the right folder structure: https://github.com/philippeb8/block_ptr
Here's one vector example that shows what I had in mind: #include <boost/block_ptr.hpp> #include <vector> #include <iostream> struct X { static int instances; std::vector< boost::block_ptr<X> > v_; X() { ++instances; std::cout << "X(" << this << ")::X()\n"; v_.reserve( 4 ); } ~X() { std::cout << "X(" << this << ")::~X()\n"; --instances; } }; int X::instances = 0; int main() { boost::block_ptr<X> p = boost::make_block<X>(); p->v_.push_back( p ); std::cout << "--\n"; p.reset(); std::cout << "--\n"; } It doesn't seem to release the cycle. Other, more convoluted, examples can also be constructed, where the inner pointer is inside a std::function member of X storing a lambda/std::bind capturing p.