wdd
1
Hi,
I am only interested in ROOT 6. Lets say I have a
class like this with a template function.
class TestClass {
public:
…
template
void f();
};
And I want to call the template function from a
pyROOT script something like this.
import ROOT
b = ROOT.TestClass()
b.f(AType)()
I get errors like "object has no attribute ‘f’"
when I try it.
Is this possible in pyROOT? If not any suggestions
as to alternative approaches would be welcome.
Regards
David
Argue is bug with first instantiation. If explicit provided, next instantiation works fine:[code]$ cat toto.h
#include
class TestClass {
public:
template
void f() { std::cout << “a bientot” << std::endl; }
};
template void TestClass::f();[/code]
Note last line. Type not relevant, existence is. Now use:[code]>>> from ROOT import *
gInterpreter.LoadMacro(“toto.h”)
b = TestClass()
b.f(TObject)()
a bientot
[/code]
Should file with devs.
-Dom
wdd
3
Thanks. Your suggestion works.
Something like this early in the python script also seems to
make it work.
ROOT.gROOT.ProcessLine(‘template void TestClass::f();’)
-David
dryu
4
Sorry to revive this old thread, but was an issue ever filed? I still see this issue in 6.06.01.
wlav
5
Hi,
definitely no changes in git and I can’t find it in JIRA, so I don’t think so.
Cheers,
Wim