Boost logo

Boost :

From: Daniel Frey (d.frey_at_[hidden])
Date: 2008-04-27 15:02:33

My questions result from the observation that in the virtual dtor of
enable_shared_from_this, I tried BOOST_ASSERT( _shared_count.empty() ),
but this makes 3 tests fail. Looking at these tests, I don't see why
they should be legal:

In esft_constructor_test.cpp, line 143, X initializes early_px by
calling shared_from_this, but X is never passed to a shared_ptr which
then owns it. From what I understand, this should be illegal.

The next problem is esft_constructor_test.cpp, line 160.
y.shared_from_this() returns a shared_ptr, but again, no shared_ptr
takes ownership of Y later. While shared_from_this() is not called from
the ctor, I wonder if this is yet another use case or just an accident.

The test case in shared_from_this_test.cpp, line 135 is similar.

Regards, Daniel

Boost list run by bdawes at, gregod at, cpdaniel at, john at