[ROOT] Templated constructors and assigment operators of template class

From: Troy D. Straszheim (troy@ifh.de)
Date: Tue May 11 2004 - 13:58:49 MEST


 
Hi roottalk-

I've upgraded to root 4.00.04 and am really impressed with how much
progress has occurred recently with support for templates.  In fact, I
have succeeded in creating a configuration header for the "boost"
libraries which rootcint is capable of parsing (at least on my
platform, (gcc 3.3.2).  I plan to make this available once I have
confirmed which parts of the boost libraries are usable.  My first
goal is the shared_ptr<>.  I have verified that basic functionality of
the boost shared_ptr<> works in the interpreter.

The issues that remain are the following: A little while ago I
requested (and got) a bugfix (could not instrument a templated
constructor) and this now appears to work fine.  However I am unable
to instrument a templated constructor in a *template* class.  

I have also discovered that, within a template class, functions that
return something of the form "MyClass&" must have that return value
type typedeffed in order for them to compile and instrument correctly.
This applies also to operators, which is where I originally discovered
it.  

template <class T>
class A {
public:

  template <class U>
    A(const U&); // rootcint doesnt find this

  typedef A& reference;

  template <class U>
  reference operator=(const U&); // rootcint finds this version ok

  template <class U>
  A& operator=(const U&);  // it can't find this version

}

I have attached a fairly extensive test case, and as far as I can tell
these are the only two issues.  The test case also contains a lot of
things that do work correctly for the sake of thoroughness.  The
generated file macro.C contains the things that work in the
interpreter, the file main.cxx contains a couple extras that do not.

Thanks, as always, for your help,

Troy Straszheim







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