Boost logo

Boost Users :

From: Petr Ferschmann (petr_at_[hidden])
Date: 2003-04-28 11:35:31


Hello,

why is not possible to call this:
-- cut here --
#include <boost/enable_shared_from_this.hpp>

class Trida;

boost::shared_ptr<Trida> trida;

class Trida : public boost::enable_shared_from_this<Trida>
{
public:
    Trida()
    {
        trida = this->shared_from_this();
    };
};

int main()
{
    boost::shared_ptr<Trida> tr(new Trida());
    
    return 0;
}
-- cut here --
It throws in constructor of shared_count(weak_count const & r).

I think the problem is that there is no one shared_ptr instance that
owns object tr yet when calling constructor.

May be it is BUG (and I don't know how to handle that). Can be at least
note in documentation?

-- 
                                  Petr "Fers" Ferschmann
 -=[  petr_at_[hidden]  ]==[ http://petr.ferschmann.cz/ ]=-
-=[ Koukni na http://www.postcard.cz/ ]==[ +420 604/781 009 ]=-
GPG Fingerprint:
[83B0 6378 7A9D D993 035E  60BD FEEC F665 D2C8 1B9A]
[Non-text portions of this message have been removed]

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