Re: [ROOT] Instantiation of precompiled STL containers and typedefs

From: Masaharu Goto (MXJ02154@nifty.ne.jp)
Date: Mon May 05 2003 - 16:20:43 MEST


Hello Walter,

Yes, this is due to a way how Cint deals with template with
default argument and typedef.  Basically, when Cint sees
vector<Int_t>, it actually instantiates vector<int,allocator<int> >
and typedef vector<Int_t> as the same class.  Unfortunately,
vector<int> is not defined and remains as an unknown name.
On the other hand, if vector<int> is instantiated, Cint creates
vector<int,allocator<int> > and typedef vector<int>.  When
vector<Int_t> is referred, it refers to vector<int>. This is why
it works for latter case.  I'll see if I can fix this behavior.

Thank you
Masa Goto


----- Original Message ----- 
From: "Walter F.J. Mueller" <W.F.J.Mueller@gsi.de>
To: <roottalk@pcroot.cern.ch>
Sent: Sunday, May 04, 2003 5:31 AM
Subject: [ROOT] Instantiation of precompiled STL containers and typedefs


> Dear ROOTers, Philippe, Masaharu, { using 3.05/04 }
> 
> I followed Philippe suggestion given on roottalk on 06-Sep-2002 and
> added something like
> 
>      #pragma link C++ class vector<Int_t>!-;
> 
> in a Linkdef file. As a result I was able to instantiate in CINT
> the vectors
> 
>     vector<Int_t>
>     vector<int,allocator<int> >
> 
> but not
> 
>     vector<int>
> 
> which results in the error message
> 
>     Limitation: Can't instantiate precompiled template vector<int>
> 
> If I use instead in the LinkDef file
> 
>     #pragma link C++ class vector<int>!-;
> 
> I can instantiate and use in CINT
> 
>     vector<Int_t>
>     vector<int,allocator<int> >
>     vector<int>
> 
> There seems to be some interference between typedefs and the way
> STL container instantiations are handled.
> 
>   Cheers,
> Walter
> 
> 
> -- 
> Walter F.J. Mueller   Mail:  W.F.J.Mueller@gsi.de
> GSI,  Abteilung KP3   Phone: +49-6159-71-2766
> D-64291 Darmstadt     FAX:   +49-6159-71-2989
> WWW:   http://www-kp3.gsi.de/www/kp3/people/mueller.html
> 



This archive was generated by hypermail 2b29 : Thu Jan 01 2004 - 17:50:11 MET