Re: [ROOT] Rootcint: std::map Streamer generation problem

From: Rene Brun (Rene.Brun@cern.ch)
Date: Fri Apr 20 2001 - 18:03:59 MEST


Hi Axel,

I see a problem with the code generation in rootcint in case of an STL map
where both arguments are objects. In my all my tests, I had always
a pointer to an object for the first argument.
eg map<TString*,TString*> or map<TString*,TString> are Ok
I will fix the problem in rootcint.
Thanks for reporting this problem.

Masa seems to be away for the time being.

Rene Brun

Axel Naumann wrote:
> 
> Hi,
> 
> I've looked around in the bug list, but couldn't find any hint on this. As
> far as I know cint now supports std::map<,> streamer generation. But it
> doesn't work for me:
> 
> ---
> class TMapTest: public TObject{
> 
>         std::map<TString, TString> _mapStrStr;
> 
>         ClassDef(TMapTest,1)
> };
> ---
> 
> added to linkdef.h with "TMapTest+", generates the following streamer:
> 
> ---
> void R__TMapTest__mapStrStr(TBuffer &R__b, void *p, int)
> {
>    map<TString,TString> &_mapStrStr = *(map<TString,TString> *)p;
>    if (R__b.IsReading()) {
>       {
>          _mapStrStr.clear();
>          int R__i, R__n;
>          R__b >> R__n;
>          for (R__i = 0; R__i < R__n; R__i++) {
>             TString R__t;
>             R__t.Streamer(R__b);
>             _mapStrStr.insert(make_pair(R__t,R__t2));
>          }
>       }
>    } else {
>       {
>          R__b << _mapStrStr.size();
>          map<TString,TString>::iterator R__k;
>          for (R__k = _mapStrStr.begin(); R__k != _mapStrStr.end(); ++R__k) {
>             (*R__k).Streamer(R__b);
>          }
>       }
>    }
> }
> ---
> 
> Obviously there's two errors, one in the IsReading block (R__t2 is never
> declared or streamed), one in the !IsReading block (can't stream a
> std::pair). Does anybody have any hints?
> Regards, Axel.
> 
> PS: When will Masa be back?



This archive was generated by hypermail 2b29 : Tue Jan 01 2002 - 17:50:43 MET