Boost logo

Boost Users :

From: Christopher Currie (Christopher_at_[hidden])
Date: 2003-04-30 12:54:38


Christopher Currie wrote:
> "shared_ptr_basic_test.cpp"
> // ...
> // prior to this line, p5 is a shared_ptr<void> with
> // use_count == 1, weak_count == 1.
>
> line 226: weak_ptr<X> wp2 = static_pointer_cast<X>(p5);
>
> // static_pointer_cast creates a shared_ptr<X> temporary:
> // use_count == 2, weak_count == 2.
> // temporary is passed to weak_ptr<X>'s constructor
> // use_count == 2, weak_count == 3.
> // temporary is NOT immediately destructed.
>
> line 228: BOOST_TEST(wp3.use_count() == 1); // this test failed
>
> // Sometime after this point (possibly as late as the end of the
> // function scope) the temporary is destructed.

Oops, line 228 should be:

BOOST_TEST(wp2.use_count() == 1); // this test failed

Christopher


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net