Boost logo

Boost Users :

From: Julia Donawald (yg-boost-users_at_[hidden])
Date: 2002-09-08 08:32:00


Hi,
the folllowing works not too:

#include <vector>
#include <shared_ptr.hpp>

class Foo
{
public:
 Foo()
 {
 };
 virtual ~Foo()
 {
 };
};

class Double_Foo
{
 public:
     Double_Foo()
     {
     };
     Double_Foo(Foo* pFoo1, Foo* pFoo2) : m_Foo1(pFoo1), m_Foo2(pFoo2)
     {
     };
     virtual ~Double_Foo()
     {
     };

protected:
     typedef boost::shared_ptr<Foo> FooDataPtr;

     FooDataPtr m_Foo1;
     FooDataPtr m_Foo2;
};

int main()
{
     Foo* pFoo = new Foo();

     Double_Foo DoubFoo(pFoo, pFoo);

     return 0;
}

I got the same error as in my former post. I read a bit about shared_ptr.
Maybe it has something to do with a cyclic, but I thought in anohter case of
cyclic data, namely if I have an object A which points to B and B holds a
member which points back to A.... that's in my case not?
If it has something to do with cyclic data then how can I solve it with
weak_ptr?

Thanks in advance
Julia


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