[ROOT] Re: STL container libs (RE:accessing vars)

From: George A. Heintzelman (gah@bnl.gov)
Date: Tue Oct 24 2000 - 17:08:18 MEST


> Hello Fons,
> 
> There are 2 things about STL and template class precompilation.
> 
> 1) It looks like many people are still using ROOT without precompiled
>   STL containers included in $CINTSYSDIR/stl/*.dll. This will make things
>   much simpler for many users.  Are those files included and/or built in 
>   the latest ROOT distribution?  If this is not the case, I recommend 
>   installing pure cint also. After the installation $CINTSYSDIR/stl/*.dll
>   are created if you use Linux, HP-UX, Solaris, VisualC++, BorlandC++,etc.
>   If you find those, copy all of them as $ROOTSYS/cint/stl/*.dll 
> 
> 2) About compiling template classes with script compiler, I am still not
>   sure about the requirement. Will you elaborate what is needed with
>   some examples?

Let's put aside the STL classes for now. I'm not sure how the 
precompiled containers work in CINT, quite honestly. (Would you have 
CINT-based support for things like 'vector<TLorentzVector>' available 
if you used it? )

Suppose you have a template class:

template <class T> mytemplate;

and you've linked this in for certain explicit instances of T, in 
LinkDef files:

#pragma link C++ class mytemplate<int>;
#pragma link C++ class mytemplate<TObject *>;

now, you're working in the interpreter, and you realize that you would 
really like an object of (say) class mytemplate<TString>. But CINT 
doesn't know about this, and will tell you it can't instantiate the 
precompiled template. You don't want to jump out of CINT and recompile 
your LinkDef file on the spot, and then restart, because you've got 
work in your session-in-progress. What I would like is a way, to add 
the template instantiation to CINT's vocabulary in much the same way 
the script compiler does for an ordinary class.

Now, maybe this already is possible, but I don't know how to do it. If 
so, enlightenment would be great. What I've tried to do is stuff like 
this:

(file temp.C):
#include "mytemplate.h"
#include "TString.h"

template class mytemplate<TString>; 
// This is C++'s explicit instantiation syntax (see Stroustrup).

and back in root do:

.L temp.C+

But this doesn't seem to work. Even more ideally, I would like to be 
able to do
.instantiate mytemplate<TString> 

at the CINT command line, but this is perhaps rather harder to 
implement (having to know the correct #include files to use).

Is that clear enough?

George



This archive was generated by hypermail 2b29 : Tue Jan 02 2001 - 11:50:35 MET