RE: [ROOT] Templated constructors and assigment operators of template class

From: Philippe Canal (pcanal@fnal.gov)
Date: Wed May 19 2004 - 00:26:54 MEST


Hi Troy,

Thanks for reporting these issue.

Support for templated constructor and for templated member function 
returning a reference (or pointer) not via a typedef will be uploaded
in CVS shortly (i.e. all your example will work).

Cheers,
Philippe.

-----Original Message-----
From: owner-roottalk@pcroot.cern.ch
[mailto:owner-roottalk@pcroot.cern.ch]On Behalf Of Troy D. Straszheim
Sent: Tuesday, May 11, 2004 6:59 AM
To: roottalk@pcroot.cern.ch
Subject: [ROOT] Templated constructors and assigment operators of
template class


 
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