You need both the friend declaration and the declaration outside the class definition. See also TString.h. Cheers, Fons. Laurent Aphecetche wrote: > > Hi Rooters, > > I have a bit of a difficulty to make rootcint producing the right > dictionary for the classical "ostream& operator<<(ostream&, const > Class&)" operator. > > If I do this (i.e. the thing I would like to do) : > > class Class { > > public: > friend ostream& operator << (ostream&, const Class&) ; > ... > } ; > > and uses a LinkDef.h : > > #ifdef __CINT__ > > #pragma link off all globals; > #pragma link off all classes; > #pragma link off all functions; > > #pragma link C++ class Class-!; > #pragma link C++ function operator << (ostream&,const Class&) ; > > I got no code whatsoever in ClassDict.C for the << operator. > > Now, if I do : > > class Class { > ...}; > > ostream& operator << (ostream&, const Class&) ; > > with the same LinkDef.h, then I do have the correct dictionary. > > How can I make rootcint understand the first (preferred) form ? > > Thanks for your help, > > -- > Dr. Laurent APHECETCHE (mailto:aphecetc@in2p3.fr) (IN2P3-CNRS) > SUBATECH-EMN-4 rue Alfred Kastler-BP 20722-44307 NANTES cedex 03 > TEL (+33/0) 2 51 85 84 17 - FAX (+33/0) 2 51 85 84 24 (France) > Collaborations PHENIX http://www.phenix.bnl.gov/~aphecetc et MEGAPIE. -- Org: CERN, European Laboratory for Particle Physics. Mail: 1211 Geneve 23, Switzerland E-Mail: Fons.Rademakers@cern.ch Phone: +41 22 7679248 WWW: http://root.cern.ch/~rdm/ Fax: +41 22 7677910
This archive was generated by hypermail 2b29 : Tue Jan 01 2002 - 17:50:44 MET