CINT and template functions

From: George Heintzelman (gah@bnl.gov)
Date: Tue Jan 25 2000 - 18:57:19 MET


Rooters,

I'm trying to explore what I can and can't do with templates in CINT, 
since I would like to use some of their features in ROOT programs. I've 
managed to get template classes linked in (with the small problem of 
the Streamer functions, but Masa says that that's been fixed in the 
newest CINT).  And, I know that template member functions are not 
supported (which is a shame, but I'll deal). However, I couldn't for 
the life of me get an ordinary template function to get recognized by 
CINT. I had a little piece of code like this to test:

#include "Rtypes.h"

template <class X>
Bool_t TestTemplate(const X &t) {
  size_t a = sizeof(X);
  printf("%d\n",&a);
}

I tried to .x and .L this piece of code (figuring CINT would force me 
to always interpret the code, but that's okay with me for some 
functions anyway); this gave me a segvio in root (version 2.23.10). I 
tried to link it into CINT using:

#pragme link C++ function TestTemplate*;

but that failed, with it being unable to find the function. I tried 
instantiating a version explicitly in the file, but then CINT 
complained about not supporting partial template specialization.

So, am I going about this completely wrong? Is there a way to get this 
to work?

George Heintzelman
gah@bnl.gov



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