Hi Troy, Which version of ROOT are you using, newer version (3.10/02 and 4.00) should not have this problem. On a different note, it is not recommended to inherit from an stl container. STL containers do not have a virtual destructor (or any other virtual function). And using inheritance could lead to some trouble for example the following code would lead to a memory leak: MyClass *m = new MyClass; vector<SmartPtr<SomeType> > * v = m; delete v; // call ONLY ~vector and NOT ~MyClass nor ~TObject However, if you are aware of this limitation (no virtual table for stl container) and if you are careful, you can get it to work. Cheers, Philippe. -----Original Message----- From: owner-roottalk@pcroot.cern.ch [mailto:owner-roottalk@pcroot.cern.ch]On Behalf Of Troy D. Straszheim Sent: Monday, February 09, 2004 7:50 AM To: roottalk@pcroot.cern.ch Subject: [ROOT] Multiple inheritance Hi roottalk- I have another one: I have a smart pointer class (a simple one) and I would like to multiply inherit a class from TObject and a vector of smart pointers to objects. So the smart pointer looks like this, very basic: template <class T> class SmartPtr<T>; and my class would look like this: class MyClass : public vector<SmartPtr<SomeType> >, public TObject { ... }; I find that this gets through rootcint and compiles: class MyClass : public vector<SomeType>, public TObject { ... }; But the first does not compile, with the following error: RootDict.cxx:462: no matching function for call to `TBuffer::StreamObject( __gnu_cxx::__normal_iterator<SmartPtr<SomeType>*, std::vector<SmartPtr<SomeType>, std::allocator<SmartPtr<SomeType> > > >&, const std::type_info&)' /usr/local/root/include/TBuffer.h:199: candidates are: void TBuffer::StreamObject(void*, const std::type_info&) /usr/local/root/include/TBuffer.h:200: void TBuffer::StreamObject(void*, const char*) /usr/local/root/include/TBuffer.h:201: void TBuffer::StreamObject(void*, TClass*) Any ideas? Thanks, Troy Straszheim
This archive was generated by hypermail 2b29 : Sun Jan 02 2005 - 05:50:05 MET