How does one do this, e.g. for an unsigned long? The two
TDirectory::WriteObjectAny() functions require either a class name or a pointer to a TClass object.
TDirectory::WriteObject() seems appropriate, but the TDirectory source file comments that it is “intentionally not implemented.” The source file also mentions
template <class T>
inline Int_t WriteObject(const T* obj, const char* name, Option_t *option="", Int_t bufsize=0)but a call to that fails with the message [quote]“unknown type for , it cannot be written”[/quote] That failure occurs whether one specifies the template arg, e.g.
WriteObject<unsigned long>(&MyNumber, "MyNumber"); or leaves it for the compiler to deduce. TDirectory’s other write functions all require a descendant of TObject. I must be missing something…
[EDIT} System: Yosemite (10.10.1), ROOT6 (HEAD of master branch, which I update ~daily)