Boost logo

Boost :

Subject: [boost] [shared_ptr] make_shared and enable_shared_from_this with boost 1.36
From: Michael Marcin (mike.marcin_at_[hidden])
Date: 2008-12-03 20:06:29


The following code throws boost::bad_weak_ptr using boost 1.36.

#include <boost/shared_ptr.hpp>
#include <boost/enable_shared_from_this.hpp>
#include <boost/make_shared.hpp>

class Test : public boost::enable_shared_from_this<Test> {};

int main()
{
     boost::shared_ptr<Test> test = boost::make_shared<Test>();
     test->shared_from_this();
}

-- 
Michael Marcin

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk