
Hi, I have written the following code to simulate my problem: #include <vector> #include <shared_ptr.hpp> class Foo { public: Foo() { }; virtual ~Foo() { }; }; class Vector_Foo { public: Vector_Foo() { }; virtual ~Vector_Foo() { }; void AddFooObject(Foo* pFoo) { FooDataPtr ptrFoo(pFoo); m_vecChildren.push_back(ptrFoo); }; protected: typedef boost::shared_ptr<Foo> FooDataPtr; typedef std::vector<FooDataPtr> FooVector; FooVector m_vecChildren; }; int main( ) { Vector_Foo vec; Foo* pFoo = new Foo(); vec.AddFooObject(pFoo); vec.AddFooObject(pFoo); return 0; } When I now leave the function main, and the vec-Object is deleted I got an exception in the function: template< typename T > inline void checked_delete(T * x) { typedef char type_must_be_complete[sizeof(T)]; delete x; } in checked_delete.hpp What have I done wrong? Why doesnt my code work? Should I use another class then shared_ptr to do that what I want, namely to insert 2 pointers to the same Object in a vector? Thanks in advance Julia