dear all,
I’m trying to add a template class which is defined like this:
(MyClass.h)
template<class A, class B, UInt_t C>
class MyClass :
public TObject
{
....
pivate:
A a;
B b[C];
ClassDefT(MyClass, 1);
};
ClassDef3T2(MyClass, A, B, C);
(MyClass.cxx)
ClassImp3T(MyClass, A, B, C);
....
MyClassLinkDef.h
#ifdec __CINT__
#pragma link off all globals;
#pragma link off all classes;
#pragma link off all functions;
#pragma link C++ class MyClass<TObject, TObject, [what here?]>+
#endif
MyClass.cxx compiles without errors, but I do not how to manage the LinkDef file because I have a non-type parameter.
Could you help me, please?
you will have to provide a value for the third parameter.
The template is only fully specified if all the template arguments are specified. CINT cannot call functions or create / store / manage objects otherwise, because the type is not defined without it. It just shows that templates are a huge overhead for what you are trying to achieve (if the UInt_t really is an array dimension). It is a lot better, in any standards, not just CINT or ROOT, to use a dynamic structure like vectors. You can still preallocate them, you can still do bounds checking, and in the end you have almost the same performance with no code bloat.
Unfortunately I still have a little problem. What I’m trying to do is to create a shared library usging this kind of object… I can create it, but I get an error while loading the library…
I do not understand if I am doing something wrong somewhere (actually to me it looks ok).
could you, please have a look into my (attached) code?
I attach only LinkDef and .h files
$ echo _ZN19AliTOFMonitorObjectI23AliTOFMonitorObjectData7TObjectLj5EEC1Ev | c++filt
AliTOFMonitorObject<AliTOFMonitorObjectData, TObject, 5u>::AliTOFMonitorObject()
Did you implement that function?