[ROOT] Template class/function in ROOT interpreter?

From: Pierre-Luc Drouin (pldrouin@physics.carleton.ca)
Date: Sat Jul 27 2002 - 00:08:09 MEST


Hello, i'm trying use a QIO<U> (U being the typename) template class that
has a TryCast(W* uptr) template member function in the ROOT interpreter.
Here is a part of my QIO.h file:

template <typename U> class QIO
{
  private:
   template <typename V,typename W> V* TryCast(W* uptr) const;
};

#include "QIO.cxx"


Here is a part of my QIO.cxx file:

template <typename U> template <typename V,typename W> V*
QIO<U>::TryCast(W* uptr) const
{
  V* tobuf=dynamic_cast<V*>(uptr);
  if(!tobuf){
    cout << "ERROR:'" << typeid(W).name() << "' is not derived from '" <<
typeid(V).name() << "'\n";
    throw 1;
  }
  return tobuf;
}

When I type in the ROOT interpreter:

#include "QIO.h"
QIO<TH1F> a;

I get:
no such template V* QIO<TH1F> FILE:QIO.cxx LINE:48
Syntax error FILE:QIO.cxx LINE:48
*** Interpreter error recovered ***

Line 48 is the first line i've pasted for the file QIO.cxx

When I compile my code, everything works perfectly, but it doesn't work
with the ROOT interpreter.

How can I make it to work?

Pierre-Luc Drouin
SNO, Carleton University



This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:51:01 MET