Boost logo

Boost Users :

From: Anders Hybertz (anders.hybertz_at_[hidden])
Date: 2003-06-05 08:20:17


Hi all

I have simplified my previous question about this issue to the
following sandbox code.

-----------------------------------------------------------------
#include <iostream>
#include <boost/shared_ptr.hpp>

struct Test : public boost::counted_base
{
    Test() : boost::counted_base( 1, 1 )
    {
        std::cout << "Construction" << std::endl;
    }
    ~Test()
    {
        std::cout << "Destruction" << std::endl;
    }
};

int main()
{
    {
        boost::shared_ptr<Test> spTest( new Test );
    }

    // In boost 1.29 the program output is :
    // Construction
    
    return 0;
}-----------------------------------------------------------------

Under boost 1.29.0 the program only writes out the text from the
construction of the Test object - the destructor is never being
called.

I want the same functionality under boost 1.30.0 - but without
changing any code in then main function - basically preserving the
interface.

I tried to used the boost::detail::sp_counted_base under 1.30.0 but
that did not work.

Any ideas ?

Thanks in advance

Anders Hybertz


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