RE: [ROOT] std::map with std::pair key

From: Ivana Hrivnacova (Ivana.Hrivnacova@cern.ch)
Date: Fri Apr 26 2002 - 10:20:09 MEST


 Hi Philippe,

 Thank you for fast reply and fix.
 I tried Root from CVS and it works as you wrote.

 But this is not sufficient - as due to the missing
 streamer we cannot write/read the map in the file
 what we would like..
 
> This might actually be addressed in the next production release.

 In our case this is not substantial (we can make our
 own pair class) but generally it would be nice 
 to have this functionality.

 Cheers,

 Ivana 


==============================================================
 
e-mail:  Ivana.Hrivnacova@cern.ch
address: Institut Physique Nucleaire, 91406 Orsay, France
phone:   (33) 01 69 15 65 94
==============================================================


On Wed, 24 Apr 2002, Philippe Canal wrote:

> Hi Ivana,
> 
> The rootcint now in CVS will now produce a compilable dictionary file.
> However it will still complain:
> 
>   rootcint -f MyClassDict.cxx -c MyClass.h MyClassLinkdef.h
>   *** Datamember MyClass::fMap: template arg pair<int,int> has no Streamer() method (need manual intervention)
> 
> This is expected because the current version of ROOT did not implemented 
> STL container using non-instrumented class as template arguments.  (i.e.
> like your pair).
> 
> This might actually be addressed in the next production release.
> 
> Cheers,
> Philippe.
> 
> -----Original Message-----
> From: owner-roottalk@pcroot.cern.ch
> [mailto:owner-roottalk@pcroot.cern.ch]On Behalf Of Ivana Hrivnacova
> Sent: Wednesday, April 24, 2002 9:40 AM
> To: RootTalk
> Cc: David GUEZ
> Subject: [ROOT] std::map with std::pair key
> 
> 
> 
>  Hi,
> 
>  We have a problem with compiling
>  dictionary for the class like the following:
> 
> MyClass.h:
> ------------
> #ifndef MYCLASS_H
> #define MYCLASS_H
> 
> #include <map>
> #include <TObject.h>
> 
> class MyClass : public TObject
> {
>   public:
>     typedef std::pair<Int_t, Int_t>     MyPair;
>     typedef std::map<MyPair, Double_t>  MyMap;
> 
>     MyClass();
>     virtual ~MyClass();
> 
>   private:
>     // data members
>    MyMap  fMap; // 
> 
>   ClassDef(MyClass,1)  //Motif
> };
> 
> #endif //MyClass_H
> 
>   We declare it in LinkDef in a standard way as:
>   #pragma link C++ class  MyClass+;
> 
>   The compiler complains for some "unknown" variable:
>  
> Compiling TtestCint.cxx ...
> src/TtestCint.cxx: In function `void R__MyClass_fMap(TBuffer &, void *,
> int)':
> src/TtestCint.cxx:35: `unknown' undeclared (first use this function)
> src/TtestCint.cxx:35: (Each undeclared identifier is reported only once
> src/TtestCint.cxx:35: for each function it appears in.)
> src/TtestCint.cxx:35: parse error before `;'
> 
>  which really appears in the generated dictionary.
> 
>  Is there some work around for this
>  (besides implementing the pair class ourselves)?
> 
>  Best regards,
> 
>  Ivana
> 
>  P.S. We have Root version 3.03/03.
> 
> ==============================================================
> e-mail:  Ivana.Hrivnacova@cern.ch
> address: Institut Physique Nucleaire, 91406 Orsay, France
> phone:   (33) 01 69 15 65 94
> ==============================================================
> 
> 
> 



This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:50:51 MET