Hello, there is one issue which could be of interest for general discussion. ROOT has a pretty nice set of collection classes and I've been asked several times whether it is possible to use them outside the context of ROOT (means without TROOT object being initialized in the code.) Trying to find an answer I realized that some of the container classes (like TObjArray) could be used outside ROOT, others (like TOrdCollection) require TROOT object to be initialized. The thing which confuses me a little bit is the following. TOrdCollection class uses RTTI when TOrdCollection::IndexOf(TObject *obj) tries to define location of the object in the list. Here is its source code (taken from 1.03/09): -------------------------------------------------------------------------------- Int_t TOrdCollection::IndexOf(TObject *obj) const { // Return index of object in collection. Returns -1 when object not found. // Uses member IsEqual() to find object. for (Int_t i = 0; i < GetSize(); i++) if (fCont[PhysIndex(i)]->IsEqual(obj)) return i; return -1; } -------------------------------------------------------------------------------- TOrdCollection::IsEqual calls ROOT RTTI. Given the collection contains pointers to TObjects, why is it necessary to use RTTI when comparing TObject* to TObject* ? Isn't it enough just to compare to pointers to each other? Or this is related to ROOT I/O and persistency mechanism? Thanks, Pasha.
This archive was generated by hypermail 2b29 : Tue Jan 04 2000 - 00:34:31 MET