Store a pointer in a TObject


I would like to know if there’s an easy way to store a pointer (ofstream*) in a root TObject?

I need this because I want to have a TMap of ofstream pointers. I was trying with the STL map<string,ofstream*>, but somehow this was not working correctly.

Thanks in advance,

Hi Miguel,

If by storing, you mean keep in memory for use in the same process, there is no issue introduce by TObject that should prevent you from doing so. Since those can not (and should not) be stored in a file, you may want to make sure that the data member is mark as transient.