Hello,
is there some preprocessor macro that is capable of determining whether a custom class inheriting from TObject
(with ClassDef
) contains a method? Or maybe that just returns the class version?
The use-case would be to be able to change switch between class versions at compile time, without changing user code, e.g.:
MyObject *obj = new MyObject();
#if R__HasAttr(MyObject, SomeMethod) // or R__ClassVersion(MyObject) > 3
obj->SomeMethod();
#else
cout << "SomeMethod not yet implemented" << endl;
#endif
If I understand correctly, there is a way to do this at run time via TObject::Class_Version()
and using a TMethodCall
, so that, when switching to an old version, the compiler doesn’t complain that the method does not exist. But it would probably be nicer to have this check at compile time.
Thanks!