[ROOT] Limitation: cannot instantiate precompiled template .....

From: Troy Straszheim (troy@ifh.de)
Date: Sun Jan 25 2004 - 22:27:30 MET


Greetings roottalk --

Thanks a million for the hint on plotting an stl vector.  It works like 
a charm, has helped a lot.

I'm still working on building the most generic interface possible 
between our internals and ROOT, and I have started to get an 
intermittent error which I think may pop up only when I instantiate 
templates in certain ways.

I have two base classes:

class BaseLeft { vector<int> v; }

and

class BaseRight { vector<int> v; }

and then a child class that inherits from both

class Child : public BaseLeft, public BaseRight { vector<float>, etc };

which also contains a vector of ints, a vector of floats and some other 
stuff.   No vectors of vectors or anything like that.

This class "Child", is given as the argument to a template class that 
inherits from TObject:

template <class T>
RootContainer : public TObject { ... };

and in my RootContainerLinkDef.h I have all the instantiations

#pragma link C++ class RootContainer<Child>+;
#pragma link C++ class Child+;
and then the others, in order, are BaseLeft, BaseRight, vector<int>, and 
vector<float>.

I branch the Child inside the RootContainer and write it to a TTree 
inside a TFile:  works fine.  When I try to read it back in with a 
macro, though, I get

Limitation: Can't instantiate precompiled template 
vector<int,allocator<int> > FILE:doit.C LINE:11

The strange thing is that this worked a minute ago, and I cannot figure 
out what I have changed.  Any hints?  I am thinking that it may have 
something to do with the order of the pragmas in RootContainerLinkDef.h. 
  How does root handle precompiled and non-precompiled templates?

Best,

Troy Straszheim



This archive was generated by hypermail 2b29 : Sun Jan 02 2005 - 05:50:05 MET