Hi,
I have a class that has a few templated member functions that don't seem work in interpreted code. The full code can be browsed here:
http://minos.phy.bnl.gov/~bviren/minos/software/hm/HistMan/
This is a helper class that provides a simple histogram manager. It all works well in compiled code and non-templated methods work in interprete code, but templated methods don't. The actual implementation is a manually compiled library (not ACLiC) that is gSystem->Load()ed into a root session.
The meat of the problem can be seen by looking at the Book<>() method which is templated in order to assure type safety.
class HistMan {
public:
...
/// Book 1D or 2D histograms of type THType. Return pointer to created /// histogram (HistMan retains ownership) or 0 if "path/name" /// conflicts with previously existing histogram.template<class THType>
int nbinsx, Axis_t xmin, Axis_t xmax, const char* path=".") { TH1* h = Adopt(path, new THType(name,title,nbinsx,xmin,xmax)); return dynamic_cast<THType*>(h);}
};
This is supposed to be used like:
HistMan hm("path");
TH1D* h = hm.Get<TH1D>("h","hist",100,0,10);
but which produces the following in root:
Note that the object itself and non-templated methods (this one returns a reference to the underlying folder holding the histograms) work as well.
So, my question is: should this be expected to work, and if so what might I be doing wrong.
ROOT 4.01/05, GCC 3.3.5 x86 Debian.
Thanks,
-Brett.
Received on Wed Feb 16 2005 - 00:50:24 MET
This archive was generated by hypermail 2.2.0 : Tue Jan 02 2007 - 14:45:05 MET