Hello, I am having a problem with using constant data members in classes that are then compiled into ROOT. The problem seems to be that the ShowMembers() function calls TMemberInspector::Inspect() with a pointer to the constant data member, while TMemberInspector::Inspect() is expecting a void* pointer, i.e., a const void* cannot be converted into a void*. I have worked around this problem by overloading TMemberInspector::Inspect() with a version that does take a const void*, viz., virtual void Inspect(TClass *cl, const char *parent, const char *name, const void *addr) = 0; I also had to modify TObject.cxx and TClass.cxx, that define classes deriving from TMemberInspector, so as to provide a definition for this pure virtual function. I have done this by simply calling the non-const version of Inspect with a const_cast, e.g., in TObject.cxx to the class TDumpMembers I have added void Inspect(TClass *cl, const char *parent, const char *name, const void *addr) { return Inspect( cl, parent, name, const_cast<void*>(addr) ); } Is there any problem in doing this? If not, could some such modification be done in future releases, so that I do not have to do this each time? If it matters, I am using ROOT version 3.01.06 compiled with gcc3.0 on a SuSE Linux 7.1 box, but have also had the same problem with older versions of ROOT. Regards, Gora
This archive was generated by hypermail 2b29 : Tue Jan 01 2002 - 17:51:10 MET