Transient TString

Dear ROOT experts,

I wrote a class (deriving from TNamed) and I’m writing it to a file using the class->Write() function.
I understand that I can prevent class members from being written to file by adding //! after the member declaration. It works, but not for a TString member in the class. How can I prevent the TString from being written to the file?

Regards,
Jaap

Hi Jaap,

This would be a serious deficiency :frowning: … Do you have a reproducer? Does it also fail if you use std::string instead of TString? Which version of ROOT are you using?

Thanks,
Philippe.

Hi Philippe.

I’m seeing it with root v5-34-30. I attached two files that reproduce my issue. When I looked at bit closer, I saw that the content of the string is not saved, it is only that the string (both for TString and std::string) shows up in the TBrowser. I don’t know if that is intended or not.

Regards,
Jaap
macro.C (274 Bytes)
Reproducer.cpp (448 Bytes)

Hi,

[quote]I saw that the content of the string is not saved, it is only that the string (both for TString and std::string) shows up in the TBrowser.[/quote]Perfect. It is indeed completely intentional for the TBrowser to also let you browser transient members.

Cheers,
Philippe.