Hi Volker, TString.h contains the definition of two global functions: inline unsigned Hash(const TString& s) { return s.Hash(); } inline unsigned Hash(const TString *s) { return s->Hash(); } These functions have a clear signature. I am very surprised to see that the latest version of G4 has an include file tvhdict.h with the following definition for a templated class Hash: template < class K > class Hash { public: Hash(unsigned (*f)( const K& )=HashDefault):fhashfun(f){} unsigned operator()( const K& key ) const; private: unsigned (*fhashfun)( const K& ); This class effectively clashes with the Root function Hash. This is also one of the many side effects of using templates. Each package should have a standard way for naming classes. This class should be called G4Hash and not Hash. Obviously the best solution to this problem would be to use the C++ namespace facility. This is unfortunately not possible for the time being if one wants to run with most compilers around. I suggest you forward your complaint to the Geant4 team. Rene Brun Volker Hejny wrote: > > Dear ROOTer, > > thanks to Rene Bruns advice concerning the libNew, the 'package' > Geant4 and Root runs well together. Now there is a new version > of Geant4 which offers the possiblity to use the Standard Template > Library instead of the commercial Tools.h++. Since the plan is, as it > is stated on the Geant webpage, to drop the support for Tools.h++ > in the next release, I tried out the STL support. > I got the following problem: > > /usr/local/GEANT4/geant4.0.1/source/global/STLInterface/rw/tvhdict.h: In > function unsigned int Hash(const class TString &)': > /usr/local/GEANT4/geant4.0.1/source/global/STLInterface/rw/tvhdict.h:21: > previous non-function declaration template <class K> class Hash<K>' > In file included from /usr/local/root/2.22/src/TList.h:23, > from /usr/local/root/2.22/src/TNamed.h:23, > from /usr/local/root/2.22/src/TDirectory.h:17, > from /usr/local/root/2.22/src/TFile.h:17, > from src/PWOEventAction.cc:32: > /usr/local/root/2.22/src/TString.h:318: conflicts with function declaration > unsigned int Hash(const class TString &)' > /usr/local/GEANT4/geant4.0.1/source/global/STLInterface/rw/tvhdict.h: In > function unsigned int Hash(const class TString *)': > /usr/local/GEANT4/geant4.0.1/source/global/STLInterface/rw/tvhdict.h:21: > previous non-function declaration template <class K> class Hash<K>' > /usr/local/root/2.22/src/TString.h:319: conflicts with function declaration > unsigned int Hash(const class TString *)' > > This seems to me a deeper problem and I fear that there is no > easy solution, rather than a workaround (which is not necessary at > the moment, because the Tools.h++ version still works fine). > I just want to know, what do you think about this conflict? > > Best regards, > Volker > > -- > Volker Hejny Tel: 02461/616853 ** > Institut f. Kernphysik Fax: 02461/613930 ** > ---------------------------------------------------------------- ** ** --- > Forschungszentrum Juelich GmbH, D-52425 Juelich **
This archive was generated by hypermail 2b29 : Tue Jan 04 2000 - 00:43:38 MET